summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/bfd
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2009-01-19 17:25:17 +0000
committerobrien <obrien@FreeBSD.org>2009-01-19 17:25:17 +0000
commit2b02dfaa48ad11ff3ee427ee1db57fb6017a8a5e (patch)
treeaf590d7b357b1c28ab81f0cde1b0ea76a098fb7e /contrib/binutils/bfd
parentcd5f96a9efbe194cb6e0506e727cb6d287247d69 (diff)
downloadFreeBSD-src-2b02dfaa48ad11ff3ee427ee1db57fb6017a8a5e.zip
FreeBSD-src-2b02dfaa48ad11ff3ee427ee1db57fb6017a8a5e.tar.gz
Rename vendor/binutils/*/contrib to vendor/binutils/*/x
Binutils has a "contrib" subdirectory - thus flattening cannot happen without renaming the upper level contrib directory in a first pass. Also, don't record this move and remove any keyword expansion.
Diffstat (limited to 'contrib/binutils/bfd')
-rw-r--r--contrib/binutils/bfd/ChangeLog1237
-rw-r--r--contrib/binutils/bfd/ChangeLog-00019592
-rw-r--r--contrib/binutils/bfd/ChangeLog-020311405
-rw-r--r--contrib/binutils/bfd/ChangeLog-91937848
-rw-r--r--contrib/binutils/bfd/ChangeLog-949510043
-rw-r--r--contrib/binutils/bfd/ChangeLog-96976729
-rw-r--r--contrib/binutils/bfd/ChangeLog-98995599
-rw-r--r--contrib/binutils/bfd/MAINTAINERS1
-rw-r--r--contrib/binutils/bfd/Makefile.am1632
-rw-r--r--contrib/binutils/bfd/Makefile.in2173
-rw-r--r--contrib/binutils/bfd/PORTING83
-rw-r--r--contrib/binutils/bfd/README49
-rw-r--r--contrib/binutils/bfd/TODO25
-rw-r--r--contrib/binutils/bfd/acinclude.m4151
-rw-r--r--contrib/binutils/bfd/aclocal.m4369
-rw-r--r--contrib/binutils/bfd/aout-arm.c565
-rw-r--r--contrib/binutils/bfd/aout-encap.c239
-rw-r--r--contrib/binutils/bfd/aout-sparcle.c36
-rw-r--r--contrib/binutils/bfd/aout-target.h662
-rw-r--r--contrib/binutils/bfd/aout0.c37
-rw-r--r--contrib/binutils/bfd/aout32.c23
-rw-r--r--contrib/binutils/bfd/aout64.c31
-rw-r--r--contrib/binutils/bfd/aoutf1.h846
-rw-r--r--contrib/binutils/bfd/aoutx.h5821
-rw-r--r--contrib/binutils/bfd/archive.c2159
-rw-r--r--contrib/binutils/bfd/archive64.c243
-rw-r--r--contrib/binutils/bfd/archures.c1144
-rw-r--r--contrib/binutils/bfd/armnetbsd.c53
-rw-r--r--contrib/binutils/bfd/bfd-in.h824
-rw-r--r--contrib/binutils/bfd/bfd-in2.h4398
-rw-r--r--contrib/binutils/bfd/bfd.c1392
-rw-r--r--contrib/binutils/bfd/bfdio.c442
-rw-r--r--contrib/binutils/bfd/bfdwin.c251
-rw-r--r--contrib/binutils/bfd/binary.c402
-rw-r--r--contrib/binutils/bfd/bout.c1579
-rw-r--r--contrib/binutils/bfd/cache.c366
-rw-r--r--contrib/binutils/bfd/coff-alpha.c2406
-rw-r--r--contrib/binutils/bfd/coff-arm.c2636
-rw-r--r--contrib/binutils/bfd/coff-aux.c135
-rw-r--r--contrib/binutils/bfd/coff-i386.c624
-rw-r--r--contrib/binutils/bfd/coff-ia64.c202
-rw-r--r--contrib/binutils/bfd/coff-mips.c2701
-rw-r--r--contrib/binutils/bfd/coff-ppc.c2869
-rw-r--r--contrib/binutils/bfd/coff-rs6000.c4453
-rw-r--r--contrib/binutils/bfd/coff-sparc.c219
-rw-r--r--contrib/binutils/bfd/coff64-rs6000.c2995
-rw-r--r--contrib/binutils/bfd/coffcode.h5709
-rw-r--r--contrib/binutils/bfd/coffgen.c2498
-rw-r--r--contrib/binutils/bfd/cofflink.c3016
-rw-r--r--contrib/binutils/bfd/coffswap.h906
-rwxr-xr-xcontrib/binutils/bfd/config.bfd1341
-rw-r--r--contrib/binutils/bfd/config.in288
-rwxr-xr-xcontrib/binutils/bfd/configure7520
-rw-r--r--contrib/binutils/bfd/configure.host74
-rw-r--r--contrib/binutils/bfd/configure.in949
-rw-r--r--contrib/binutils/bfd/corefile.c106
-rw-r--r--contrib/binutils/bfd/cpu-alpha.c51
-rw-r--r--contrib/binutils/bfd/cpu-arc.c70
-rw-r--r--contrib/binutils/bfd/cpu-arm.c427
-rw-r--r--contrib/binutils/bfd/cpu-i386.c101
-rw-r--r--contrib/binutils/bfd/cpu-ia64-opc.c588
-rw-r--r--contrib/binutils/bfd/cpu-ia64.c57
-rw-r--r--contrib/binutils/bfd/cpu-mips.c127
-rw-r--r--contrib/binutils/bfd/cpu-powerpc.c300
-rw-r--r--contrib/binutils/bfd/cpu-rs6000.c117
-rw-r--r--contrib/binutils/bfd/cpu-s390.c56
-rw-r--r--contrib/binutils/bfd/cpu-sparc.c169
-rw-r--r--contrib/binutils/bfd/demo64.c30
-rw-r--r--contrib/binutils/bfd/dep-in.sed31
-rw-r--r--contrib/binutils/bfd/doc/ChangeLog14
-rw-r--r--contrib/binutils/bfd/doc/ChangeLog-9103594
-rw-r--r--contrib/binutils/bfd/doc/Makefile.am307
-rw-r--r--contrib/binutils/bfd/doc/Makefile.in674
-rw-r--r--contrib/binutils/bfd/doc/aoutx.texi211
-rw-r--r--contrib/binutils/bfd/doc/archive.texi96
-rw-r--r--contrib/binutils/bfd/doc/archures.texi534
-rw-r--r--contrib/binutils/bfd/doc/bfd.texi585
-rw-r--r--contrib/binutils/bfd/doc/bfd.texinfo349
-rw-r--r--contrib/binutils/bfd/doc/bfdint.texi1890
-rw-r--r--contrib/binutils/bfd/doc/bfdio.texi41
-rw-r--r--contrib/binutils/bfd/doc/bfdsumm.texi148
-rw-r--r--contrib/binutils/bfd/doc/bfdt.texi690
-rw-r--r--contrib/binutils/bfd/doc/bfdwin.texi2
-rw-r--r--contrib/binutils/bfd/doc/cache.texi95
-rw-r--r--contrib/binutils/bfd/doc/chew.c1605
-rw-r--r--contrib/binutils/bfd/doc/coffcode.texi608
-rw-r--r--contrib/binutils/bfd/doc/core.texi38
-rw-r--r--contrib/binutils/bfd/doc/doc.str158
-rw-r--r--contrib/binutils/bfd/doc/elf.texi24
-rw-r--r--contrib/binutils/bfd/doc/elfcode.texi0
-rw-r--r--contrib/binutils/bfd/doc/fdl.texi366
-rw-r--r--contrib/binutils/bfd/doc/format.texi109
-rw-r--r--contrib/binutils/bfd/doc/hash.texi245
-rw-r--r--contrib/binutils/bfd/doc/header.sed13
-rw-r--r--contrib/binutils/bfd/doc/init.texi13
-rw-r--r--contrib/binutils/bfd/doc/libbfd.texi176
-rw-r--r--contrib/binutils/bfd/doc/linker.texi365
-rw-r--r--contrib/binutils/bfd/doc/mmo.texi365
-rw-r--r--contrib/binutils/bfd/doc/opncls.texi265
-rw-r--r--contrib/binutils/bfd/doc/proto.str135
-rw-r--r--contrib/binutils/bfd/doc/reloc.texi2068
-rw-r--r--contrib/binutils/bfd/doc/section.texi817
-rw-r--r--contrib/binutils/bfd/doc/syms.texi445
-rw-r--r--contrib/binutils/bfd/doc/targets.texi517
-rw-r--r--contrib/binutils/bfd/dwarf1.c586
-rw-r--r--contrib/binutils/bfd/dwarf2.c1876
-rw-r--r--contrib/binutils/bfd/ecoff.c4846
-rw-r--r--contrib/binutils/bfd/ecofflink.c2611
-rw-r--r--contrib/binutils/bfd/ecoffswap.h893
-rw-r--r--contrib/binutils/bfd/efi-app-ia32.c34
-rw-r--r--contrib/binutils/bfd/efi-app-ia64.c35
-rw-r--r--contrib/binutils/bfd/elf-bfd.h1762
-rw-r--r--contrib/binutils/bfd/elf-eh-frame.c1219
-rw-r--r--contrib/binutils/bfd/elf-strtab.c389
-rw-r--r--contrib/binutils/bfd/elf.c7513
-rw-r--r--contrib/binutils/bfd/elf32-arc.c253
-rw-r--r--contrib/binutils/bfd/elf32-arm.h4108
-rw-r--r--contrib/binutils/bfd/elf32-gen.c106
-rw-r--r--contrib/binutils/bfd/elf32-i386-fbsd.c56
-rw-r--r--contrib/binutils/bfd/elf32-i386.c3323
-rw-r--r--contrib/binutils/bfd/elf32-mips.c1618
-rw-r--r--contrib/binutils/bfd/elf32-ppc.c6209
-rw-r--r--contrib/binutils/bfd/elf32-ppc.h21
-rw-r--r--contrib/binutils/bfd/elf32-s390.c3498
-rw-r--r--contrib/binutils/bfd/elf32-sparc.c3479
-rw-r--r--contrib/binutils/bfd/elf32.c22
-rw-r--r--contrib/binutils/bfd/elf64-alpha-fbsd.c56
-rw-r--r--contrib/binutils/bfd/elf64-alpha.c5590
-rw-r--r--contrib/binutils/bfd/elf64-gen.c106
-rw-r--r--contrib/binutils/bfd/elf64-mips.c2815
-rw-r--r--contrib/binutils/bfd/elf64-ppc.c9024
-rw-r--r--contrib/binutils/bfd/elf64-ppc.h44
-rw-r--r--contrib/binutils/bfd/elf64-s390.c3445
-rw-r--r--contrib/binutils/bfd/elf64-sparc.c3224
-rw-r--r--contrib/binutils/bfd/elf64-x86-64.c2790
-rw-r--r--contrib/binutils/bfd/elf64.c22
-rw-r--r--contrib/binutils/bfd/elfarm-nabi.c752
-rw-r--r--contrib/binutils/bfd/elfarm-oabi.c426
-rw-r--r--contrib/binutils/bfd/elfcode.h1750
-rw-r--r--contrib/binutils/bfd/elfcore.h250
-rw-r--r--contrib/binutils/bfd/elflink.c8908
-rw-r--r--contrib/binutils/bfd/elflink.h8532
-rw-r--r--contrib/binutils/bfd/elfn32-mips.c1983
-rw-r--r--contrib/binutils/bfd/elfxx-ia64.c5047
-rw-r--r--contrib/binutils/bfd/elfxx-mips.c9234
-rw-r--r--contrib/binutils/bfd/elfxx-mips.h126
-rw-r--r--contrib/binutils/bfd/elfxx-target.h748
-rw-r--r--contrib/binutils/bfd/format.c436
-rw-r--r--contrib/binutils/bfd/freebsd.h106
-rw-r--r--contrib/binutils/bfd/gen-aout.c109
-rw-r--r--contrib/binutils/bfd/genlink.h111
-rw-r--r--contrib/binutils/bfd/hash.c734
-rw-r--r--contrib/binutils/bfd/host-aout.c87
-rw-r--r--contrib/binutils/bfd/hosts/alphalinux.h6
-rw-r--r--contrib/binutils/bfd/hosts/decstation.h17
-rw-r--r--contrib/binutils/bfd/hosts/i386bsd.h32
-rw-r--r--contrib/binutils/bfd/hosts/i386linux.h8
-rw-r--r--contrib/binutils/bfd/hosts/i386sco.h19
-rw-r--r--contrib/binutils/bfd/hosts/mipsbsd.h12
-rw-r--r--contrib/binutils/bfd/hosts/mipsmach3.h10
-rw-r--r--contrib/binutils/bfd/hosts/news-mips.h12
-rw-r--r--contrib/binutils/bfd/i386aout.c96
-rw-r--r--contrib/binutils/bfd/i386bsd.c50
-rw-r--r--contrib/binutils/bfd/i386freebsd.c37
-rw-r--r--contrib/binutils/bfd/i386linux.c776
-rw-r--r--contrib/binutils/bfd/i386netbsd.c38
-rw-r--r--contrib/binutils/bfd/ieee.c4128
-rw-r--r--contrib/binutils/bfd/ihex.c1051
-rw-r--r--contrib/binutils/bfd/init.c51
-rw-r--r--contrib/binutils/bfd/libaout.h666
-rw-r--r--contrib/binutils/bfd/libbfd-in.h647
-rw-r--r--contrib/binutils/bfd/libbfd.c857
-rw-r--r--contrib/binutils/bfd/libbfd.h1560
-rw-r--r--contrib/binutils/bfd/libcoff-in.h600
-rw-r--r--contrib/binutils/bfd/libcoff.h933
-rw-r--r--contrib/binutils/bfd/libecoff.h362
-rw-r--r--contrib/binutils/bfd/libieee.h135
-rw-r--r--contrib/binutils/bfd/libpei.h337
-rw-r--r--contrib/binutils/bfd/libxcoff.h245
-rw-r--r--contrib/binutils/bfd/linker.c2827
-rw-r--r--contrib/binutils/bfd/merge.c855
-rw-r--r--contrib/binutils/bfd/mipsbsd.c486
-rw-r--r--contrib/binutils/bfd/netbsd-core.c282
-rw-r--r--contrib/binutils/bfd/netbsd.h118
-rw-r--r--contrib/binutils/bfd/opncls.c1175
-rw-r--r--contrib/binutils/bfd/osf-core.c244
-rw-r--r--contrib/binutils/bfd/pe-arm.c47
-rw-r--r--contrib/binutils/bfd/pe-i386.c43
-rw-r--r--contrib/binutils/bfd/pe-mips.c1000
-rw-r--r--contrib/binutils/bfd/pe-ppc.c43
-rw-r--r--contrib/binutils/bfd/peXXigen.c2089
-rw-r--r--contrib/binutils/bfd/pei-mips.c30
-rw-r--r--contrib/binutils/bfd/peicode.h1347
-rw-r--r--contrib/binutils/bfd/po/BLD-POTFILES.in8
-rw-r--r--contrib/binutils/bfd/po/Make-in292
-rw-r--r--contrib/binutils/bfd/po/POTFILES.in255
-rw-r--r--contrib/binutils/bfd/po/SRC-POTFILES.in311
-rw-r--r--contrib/binutils/bfd/po/bfd.pot3005
-rw-r--r--contrib/binutils/bfd/ppcboot.c539
-rw-r--r--contrib/binutils/bfd/ptrace-core.c228
-rw-r--r--contrib/binutils/bfd/reloc.c4289
-rw-r--r--contrib/binutils/bfd/reloc16.c332
-rw-r--r--contrib/binutils/bfd/rs6000-core.c735
-rw-r--r--contrib/binutils/bfd/sco5-core.c420
-rw-r--r--contrib/binutils/bfd/section.c1368
-rw-r--r--contrib/binutils/bfd/simple.c257
-rw-r--r--contrib/binutils/bfd/sparclinux.c778
-rw-r--r--contrib/binutils/bfd/sparcnetbsd.c38
-rw-r--r--contrib/binutils/bfd/srec.c1403
-rw-r--r--contrib/binutils/bfd/stab-syms.c58
-rw-r--r--contrib/binutils/bfd/stabs.c880
-rw-r--r--contrib/binutils/bfd/stamp-h.in1
-rw-r--r--contrib/binutils/bfd/sunos.c2939
-rw-r--r--contrib/binutils/bfd/syms.c1362
-rw-r--r--contrib/binutils/bfd/sysdep.h164
-rw-r--r--contrib/binutils/bfd/targets.c1349
-rw-r--r--contrib/binutils/bfd/targmatch.sed33
-rw-r--r--contrib/binutils/bfd/tekhex.c1068
-rw-r--r--contrib/binutils/bfd/trad-core.c331
-rw-r--r--contrib/binutils/bfd/version.h3
-rw-r--r--contrib/binutils/bfd/xcoff-target.h196
-rw-r--r--contrib/binutils/bfd/xcofflink.c6167
222 files changed, 0 insertions, 299774 deletions
diff --git a/contrib/binutils/bfd/ChangeLog b/contrib/binutils/bfd/ChangeLog
deleted file mode 100644
index 04a27e1..0000000
--- a/contrib/binutils/bfd/ChangeLog
+++ /dev/null
@@ -1,1237 +0,0 @@
-2004-05-17 Daniel Jacobowitz <dan@debian.org>
-
- * configure.in: Mark unreleased for post-2.15 snapshots.
- * configure: Regenerate.
-
-2004-05-17 Daniel Jacobowitz <dan@debian.org>
-
- * configure.in: Bump version to 2.15. Mark as released.
- * configure: Regenerate.
-
-2004-05-13 Joel Sherrill <joel@oarcorp.com>
-
- * config.bfd (or32-*-rtems*): Switch to elf.
-
-2004-05-13 Nick Clifton <nickc@redhat.com>
-
- * po/fr.po: Updated French translation.
-
-2004-05-07 Daniel Jacobowitz <dan@debian.org>
-
- * configure.in: Bump version to 2.14.92.
- * configure: Regenerate.
-
-2004-05-07 Daniel Jacobowitz <dan@debian.org>
-
- Merge from mainline:
- 2004-04-16 Alan Modra <amodra@bigpond.net.au>
- * simple.c (bfd_simple_get_relocated_section_contents): Don't
- change reloc_done. Set and restore _cooked_size.
- (RETURN): Delete.
-
-2004-05-07 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-frv.c (elf32_frvfdpic_modify_segment_map): Return
- immediately if there's no link info.
- (elf32_frvfdpic_copy_private_bfd_data): New.
- (bfd_elf32_bfd_copy_private_bfd_data): Use it for frvfdpic.
-
-2004-05-06 Zack Weinberg <zack@codesourcery.com>
-
- * dwarf2.c (add_line_info): Also set info->filename to NULL if
- filename argument is null; do not call strlen on a null pointer.
-
-2004-05-06 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (elf32_arm_relocate_section): Remove R_ARM_PLT32
- special case.
-
-2004-05-05 Alexandre Oliva <aoliva@redhat.com>
-
- * configure.in (bfd_elf32_frvfdpic_vec): New.
- * configure: Rebuilt.
- * targets.c (bfd_elf32_frvfdpic_vec): New.
- * config.bfd: Enable it on frv-*-elf and frv-*-*linux*, as default
- on the latter.
- * elf32-frv.c: Prefix all identifiers added for FDPIC support with
- frvfdpic instead of frv. Rearrange elf-target macros such that
- the FDPIC-specific ones are only defined for this new target
- vector.
- (bfd_elf32_frvfdpic_vec): Declare.
- (IS_FDPIC): New.
- (elf32_frv_relocate_section): Use it to enable segment checking
- and to control rofixup emission. Add output section vma to
- applied relocation in non-LOAD non-ALLOC sections. Use
- _bfd_error_handler for errors.
- (_frv_create_got_section): Create .rel.got and .rofixup only in
- FDPIC. Create non-dynamic _gp at .got+2048 in non-FDPIC, like the
- linker script.
- (elf32_frvfdpic_size_dynamic_sections): Assume FDPIC.
- (elf32_frvfdpic_modify_segment_map): Likewise.
- (elf32_frv_finish_dynamic_sections): New, do-nothing.
- (elf32_frvfdpic_finish_dynamic_sections): Assume FDPIC. Improve
- error message if we miscompute the rofixup size.
- (frvfdpic_elf_use_relative_eh_frame): Assume FDPIC.
- (frvfdpic_elf_encode_eh_address): Likewise.
- (elf32_frv_check_relocs): Reject FDPIC-only relocs in non-FDPIC.
- Record relocs only in FDPIC. Make sure _gp is defined for GPREL
- relocs. Reject unknown relocation types.
- (elf32_frv_object_p): Make sure target vector matches FDPIC bits.
- (frv_elf_merge_private_bfd_data): Likewise.
- (ELF_MAXPAGESIZE): Revert to 0x1000 for elf32-frv; keep it as
- 0x4000 for newly-added elf32-frvfdpic.
-
-2004-05-05 Alexandre Oliva <aoliva@redhat.com>
-
- Merge from mainline:
- 2004-02-27 Alexandre Oliva <aoliva@redhat.com>
- * elf-bfd.h (struct elf_backend_data): Added
- elf_backend_can_make_relative_eh_frame,
- elf_backend_can_make_lsda_relative_eh_frame and
- elf_backend_encode_eh_address.
- (_bfd_elf_encode_eh_address): Declare.
- (_bfd_elf_can_make_relative): Declare.
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Use new
- hooks to decide whether to attempt to make_relative and
- make_lsda_relative.
- (_bfd_elf_write_section_eh_frame_hdr): Call encode_eh_address.
- (_bfd_elf_can_make_relative): New.
- (_bfd_elf_encode_eh_address): New.
- * elf32-frv.c (frv_elf_use_relative_eh_frame): New.
- (frv_elf_encode_eh_address): New.
- (elf_backend_can_make_relative_eh_frame): Define.
- (elf_backend_can_make_lsda_relative_eh_frame): Define.
- (elf_backend_encode_eh_address): Define.
- * elfxx-target.h
- (elf_backend_can_make_relative_eh_frame): Define.
- (elf_backend_can_make_lsda_relative_eh_frame): Define.
- (elf_backend_encode_eh_address): Define.
- (elfNN_bed): Add them.
-
-2004-04-27 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (xtensa_read_table_entries): Use section _cooked_size
- if set. Check reloc_done flag before applying relocations. Use
- output addresses, both when applying relocations and when comparing
- against the specified section.
- (elf_xtensa_relocate_section): Use output address to check if dynamic
- reloc is in a literal pool. Set section's reloc_done flag.
-
-2004-04-21 Philip Blundell <pb@nexus.co.uk>
-
- * elf32-arm.h (elf32_arm_check_relocs): Don't output REL32
- relocs for locally defined symbols during -shared final link.
- (elf32_arm_final_link_relocate): Likewise.
-
-2004-04-21 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (is_same_value): Add final_static_link argument and
- require relocations against a weak symbol to reference the same
- symbol hash entry if not a final, static link.
- (get_cached_value, add_value_map): Add final_static_link argument.
- (remove_literals): Pass final_static_link argument as needed.
-
-2004-04-16 Nick Clifton <nickc@redhat.com>
-
- * bfd.c (bfd_archive_filename): Catch NULL bfd pointers.
-
-2004-04-16 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.c (_bfd_elf_merge_symbol): Treat weak as strong only
- when it is a definition.
-
-2004-04-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Don't abort
- when statically linking PIC code.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2004-04-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * config.bfd: Remove mips*-*-mach3* and mips*-dec-mach3* targets.
- * configure.in: Remove mips-dec-bsd*, mips-dec-mach3*, mips-*-mach3*
- targets amd aout_mips_big_vec, aout_mips_little_vec target vectors.
- * configure: Regenerate.
-
-2004-04-09 Daniel Jacobowitz <drow@mvista.com>
-
- * configure.in: Update version to 2.14.91.
- * configure: Likewise.
-
-2004-04-09 Daniel Jacobowitz <drow@mvista.com>
-
- Merge from mainline:
- 2004-04-06 Daniel Jacobowitz <drow@mvista.com>
- * elfxx-mips.c (MIPS_ELF_STUB_SECTION_NAME): Always use
- ".MIPS.stubs".
-
- 2004-04-05 H.J. Lu <hongjiu.lu@intel.com>
- * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Always
- reserve the memory for dynamic linker
-
- 2004-04-05 Mark Kettenis <kettenis@gnu.org>
- * netbsd-core.c (CORE_WCOOKIE_OFFSET): New define.
- (netbsd_core_file_p): Create a .wcookie section for OpenBSD/sparc.
-
- 2004-04-01 Andy Chittenden <achittenden@bluearc.com>
- * stabs.c (struct stab_link_includes_totals): Add field 'symb'
- that keeps the characters in a B_INCL..B_EINCL range.
- (_bfd_link_section_stabs): When computing the sum of the
- characters in a B_INCL..B_EINCL range also keep a copy of those
- characters. Use this information to distinguish between
- include sections that have the same sum and the same length
- but which are nevertheless unique.
-
- 2004-03-31 Andy Chittenden <achittenden@bluearc.com>
- * stabs.c (struct stab_link_includes_totals): Rename field 'total'
- to 'sum_chars' and add field 'num_chars'.
- (_bfd_link_section_stabs): When computing the sum of the
- characters in a B_INCL..B_EINCL range also keep a count of the
- number of characters. Use this information to help distinguish
- between include sections when have the same sum but which
- nevertheless are still unique.
-
- 2004-03-31 Mattias Engdegård <mattias@virtutech.se>
- * stabs.c (_bfd_link_section_stabs): Do not skip N_EXCL stabs.
-
- 2004-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
- * elf32-hppa.c (elf32_hppa_check_relocs): Handle R_PARISC_PCREL32.
- (final_link_relocate): Likewise.
-
- 2004-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
- * elf-hppa.h (elf_hppa_reloc_final_type): Handle selectors for
- R_PARISC_PCREL32 and R_PARISC_PCREL64 relocations.
-
- 2004-03-17 Nathan Sidwell <nathan@codesourcery.com>
- * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Correct
- logic for null_input_bfd detection.
-
- 2004-03-12 Nick Clifton <nickc@redhat.com>
- Dave Murphy <wintermute2k4@ntlworld.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Skip most checks
- if the input bfd does not contain any code.
-
- 2004-03-02 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (struct frv_pic_relocs_info): Added fixups and
- dynrelocs.
- (_frv_count_got_plt_entries): Initialize them.
- (frv_pic_relocs_info_find): Add insert argument. Adjust all
- callers.
- (frv_pic_relocs_info_for_global): Likewise.
- (frv_pic_relocs_info_for_local): Likewise.
- (frv_pic_merge_early_relocs_info): New.
- (_frv_resolve_final_relocs_info): Use it in case one entry maps to
- another.
- (_frv_add_dyn_reloc): Add entry argument. Adjust all callers.
- Check that we don't exceed the allocated count for entry.
- (_frv_add_rofixup): Likewise.
- (_frv_emit_got_relocs_plt_entries): Adjust for coding standards.
- (elf32_frv_finish_dynamic_sections): Improve error message in case
- we emit too few rofixup entries.
-
- 2004-02-27 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_howto_table) <R_FRV_LABEL16>: Set
- complain_on_overflow to signed.
-
- 2004-02-27 Jakub Jelinek <jakub@redhat.com>
- * elf32-s390.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL
- for pc relative relocs.
- (elf_s390_relocate_section): Likewise.
- * elf64-s390.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL
- for pc relative relocs.
- (elf_s390_relocate_section): Likewise.
-
- 2004-02-26 H.J. Lu <hongjiu.lu@intel.com>
- * elfxx-ia64.c (elfNN_ia64_check_relocs): Fix call to
- count_dyn_reloc.
-
- 2004-02-25 H.J. Lu <hongjiu.lu@intel.com>
- * elfxx-ia64.c (elfNN_ia64_dyn_reloc_entry): Add the reltext.
- field to track if a relocation is against readonly section.
- (count_dyn_reloc): Take a new argument for rent->reltext.
- (elfNN_ia64_check_relocs): Adjust call to count_dyn_reloc.
- (get_reloc_section): Don't set ia64_info->reltext here.
- (allocate_dynrel_entries): Set ia64_info->reltext here.
-
- 2004-02-24 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (FRV_SYM_LOCAL): Weak undefined doesn't imply local.
- (_frv_emit_got_relocs_plt_entries): Decay relocation to protected
- function's descriptor to symbol+offset, and map local undefweak
- symbol to NULL function descriptor.
- (elf32_frv_relocate_section): Likewise.
-
- 2004-02-21 Danny Smith <daanysmith@users.sourceforge.net>
- * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Clear
- IMAGE_SCN_MEM_WRITE on known sections only.
-
- 2004-02-19 Jakub Jelinek <jakub@redhat.com>
- * elf32-sparc.c (elf32_sparc_finish_dynamic_sections): Clear
- .plt sh_entsize.
-
-2004-04-08 Richard Sandiford <rsandifo@redhat.com>
-
- * elflink.c: Include libiberty.h.
- * Makefile.am (elflink.lo): Depend on libiberty.h.
- * Makefile.in: Regenerate.
-
-2004-04-08 Alan Modra <amodra@bigpond.net.au>
-
- Apply from mainline.
- 2004-03-30 Jakub Jelinek <jakub@redhat.com>
- * elf.c (map_sections_to_segments): Fix handling of .tbss.
-
- 2004-03-27 Alan Modra <amodra@bigpond.net.au>
- * Makefile.am: Remove all mention of elflink.h.
- * Makefile.in: Regenerate.
- * bfd-in.h (bfd_elf_discard_info): Declare.
- (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete.
- * bfd-in2.h: Regenerate.
- * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol,
- bfd_elf32_link_record_dynamic_symbol,
- bfd_elf64_link_record_dynamic_symbol,
- _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link,
- bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol,
- _bfd_elf32_link_record_local_dynamic_symbol,
- _bfd_elf64_link_record_local_dynamic_symbol,
- _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets,
- _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link,
- _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry,
- _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets,
- _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry,
- _bfd_elf32_reloc_symbol_deleted_p,
- _bfd_elf64_reloc_symbol_deleted_p): Delete.
- (bfd_elf_link_record_dynamic_symbol,
- bfd_elf_link_record_local_dynamic_symbol,
- bfd_elf_final_link, bfd_elf_gc_sections,
- bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry,
- bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link,
- bfd_elf_reloc_symbol_deleted_p): Declare.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- * elf32-arm.h: Update for changed function names. Remove local
- WILL_CALL_FINISH_DYNAMIC_SECTION define.
- * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c,
- * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c,
- * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c,
- * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c,
- * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c,
- * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c,
- * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c,
- * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise.
- * elfxx-target.h (bfd_elfNN_bfd_final_link): Define.
- (bfd_elfNN_print_symbol): Define.
- * elfcode.h: Don't include elflink.h.
- (elf_bfd_discard_info, elf_reloc_symbol_deleted_p,
- elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections,
- elf_gc_common_finalize_got_offsets, elf_gc_common_final_link,
- elf_gc_record_vtinherit, elf_gc_record_vtentry,
- elf_link_record_local_dynamic_symbol): Don't define.
- * elflink.c: Update for changed function names. Move elflink.h
- code here.
- * elflink.h: Delete file.
- * po/SRC-POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
-
- 2004-03-27 Alan Modra <amodra@bigpond.net.au>
- * elf64-mmix.c (mmix_elf_relocate_section): Restore code setting
- "name" for global syms accidentally removed in 2004-03-20 change.
-
- 2004-03-27 Alan Modra <amodra@bigpond.net.au>
- * elf-bfd.h (struct elf_reloc_cookie): Add r_sym_shift field.
- * elflink.h: Replace all occurrences of sizeof (Elf_External_*)
- where Elf_External_* is different for 64 and 32 bit, with
- corresponding elf_size_info field.
- (struct elf_final_link_info): Use "bfd_byte *" instead
- of "Elf_External_Sym *" for external_syms and symbuf.
- (elf_link_adjust_relocs): Set up r_type_mask and r_sym_shift local
- vars and use instead of ELF_R_INFO and ELF_R_TYPE macros.
- (struct elf_link_sort_rela): Add "sym_mask" alias for "offset".
- (elf_link_sort_cmp1): Use sym_mask field instead of ELF_R_SYM.
- (elf_link_sort_cmp2): Adjust.
- (elf_link_sort_relocs): Set up r_sym_mask local var instead of
- using ELF_R_SYM macro. Set u.sym_mask.
- (elf_bfd_final_link): Call _bfd_elf_stringtab_init instead of macro
- version, elf_stringtab_init. Ditto for bfd_section_from_elf_index
- vs. section_from_elf_index. Adjust Elf_External_Sym pointer
- arithmetic. Pass bed to elf_link_flush_output_syms. Adjust
- Elf_External_Dyn pointer arithmentic. Use bed swap_dyn_in and
- swap_syn_out functions. Rearrange dyn swap in/out switch.
- (elf_link_output_sym): Adjust Elf_External_Sym pointer arithmentic.
- Pass bed to elf_link_flush_output_syms. Use bed swap_symbol_out.
- (elf_link_flush_output_syms): Add elf_backend_data arg.
- (elf_link_check_versioned_symbol): Likewise.
- (elf_link_output_extsym): Pass bed to elf_link_check_versioned_symbol.
- Adjust Elf_External_Sym pointer arithmetic. Use bed swap_symbol_out.
- (elf_link_input_bfd): Use bfd_section_from_elf_index. Set up
- r_type_mask and r_sym_shift local vars and use instead of ELF_R_SYM,
- ELF_R_TYPE and ELF_R_INFO macros.
- (elf_reloc_link_order): Select ELF32_R_INFO or ELF64_R_INFO invocation
- based on size rather than using ELF_R_INFO.
- (elf_gc_mark): Set up r_sym_shift local var and use instead of
- ELF_R_SYM macro.
- (struct alloc_got_off_arg): New.
- (elf_gc_common_finalize_got_offsets): Use elf_size_info instead of
- ARCH_SIZE. Pass get entry size down to elf_gc_allocate_got_offsets.
- (elf_gc_allocate_got_offsets): Adjust.
- (elf_reloc_symbol_deleted_p): Usee cookie.r_sym_shift instead of
- ELF_R_SYM. Use bfd_section_from_elf_index.
- (elf_bfd_discard_info): Set cookie.r_sym_shift.
- * elfcode.h (elf_stringtab_init, section_from_elf_index): Delete.
- (elf_slurp_symbol_table): Use bfd_section_from_elf_index.
-
- 2004-03-26 Alan Modra <amodra@bigpond.net.au>
- * elf64-ppc.c (elf_backend_add_symbol_hook): Define.
- (ppc64_elf_add_symbol_hook): New function.
- * elf-bfd.h (struct elf_backend_data <elf_add_symbol_hook>): Remove
- const from Elf_Internal_Sym param.
- * elflink.c (elf_link_add_object_symbols): Adjust.
- * elf-hppa.h (elf_hppa_add_symbol_hook): Adjust.
- * elf32-frv.c (elf32_frv_add_symbol_hook): Adjust.
- * elf32-i370.c (elf_backend_add_symbol_hook): Adjust.
- * elf32-m32r.c (m32r_elf_add_symbol_hook): Adjust.
- * elf32-m68hc1x.c (elf32_m68hc11_add_symbol_hook): Adjust.
- * elf32-m68hc1x.h (elf32_m68hc11_add_symbol_hook): Adjust.
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Adjust.
- * elf32-sh64.c (sh64_elf_add_symbol_hook): Adjust.
- * elf32-v850.c (v850_elf_add_symbol_hook): Adjust.
- * elf64-alpha.c (elf64_alpha_add_symbol_hook): Adjust.
- * elf64-mmix.c (mmix_elf_add_symbol_hook): Adjust.
- * elf64-sh64.c (sh64_elf64_add_symbol_hook): Adjust.
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Adjust.
- * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Adjust.
- * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Adjust.
- * elfxx-mips.h (_bfd_mips_elf_add_symbol_hook): Adjust.
-
- 2004-03-26 Alan Modra <amodra@bigpond.net.au>
- * elfxx-target.h (bfd_elfNN_bfd_link_add_symbols): Define.
- * elf-bfd.h (_bfd_elf_link_add_archive_symbols): Delete.
- (_bfd_elf_sort_symbol, _bfd_elf_add_dt_needed_tag): Delete.
- (_bfd_elf_finalize_dynstr, bfd_elf32_bfd_link_add_symbols): Delete.
- (bfd_elf64_bfd_link_add_symbols): Delete.
- (bfd_elf_link_add_symbols): Declare.
- * elfcode.h (elf_bfd_link_add_symbols): Delete.
- * elflink.c: Include safe-ctype.h.
- (elf_add_dt_needed_tag): Rename from _bfd_elf_add_dt_needed_tag,
- make static.
- (elf_sort_symbol): Rename from _bfd_elf_sort_symbol, make static.
- (elf_finalize_dynstr): Rename from _bfd_elf_finalize_dynstr, make
- static.
- (elf_link_add_archive_symbols): Rename from
- _bfd_elf_link_add_archive_symbols, make static.
- (elf_link_add_object_symbols): New function. Corresponding
- elflink.h function converted to use elf_size_info.
- (bfd_elf_link_add_symbols): Likewise.
- (bfd_elf_size_dynamic_sections): Adjust.
- * elflink.h (elf_bfd_link_add_symbols): Delete.
- (elf_link_add_object_symbols): Delete.
- * elf32-gen.c (elf32_generic_link_add_symbols): Call
- bfd_elf_link_add_symbols.
- * elf64-gen.c (elf64_generic_link_add_symbols): Likewise.
-
- 2004-03-25 Alan Modra <amodra@bigpond.net.au>
- * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed
- and chained shared libs only if dynsym. Clear dynsym on forced-local.
- * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare.
- (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete.
- (_bfd_elf_add_dt_needed_tag): Declare.
- (_bfd_elf_sort_symbol): Declare.
- (_bfd_elf_finalize_dynstr): Declare.
- (RELOC_FOR_GLOBAL_SYM): Formatting.
- * elfcode.h (elf_add_dynamic_entry): Delete.
- * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding
- elflink.h function converted to use elf_size_info.
- (_bfd_elf_add_dt_needed_tag): Likewise.
- (_bfd_elf_sort_symbol): Likewise.
- (_bfd_elf_finalize_dynstr): Likewise.
- (compute_bucket_count): Likewise.
- (bfd_elf_size_dynamic_sections): Likewise. Check result of
- _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref.
- (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from..
- * elflink.h: ..here.
- (sort_symbol, add_dt_needed_tag): Delete.
- (elf_add_dynamic_entry, elf_finalize_dynstr): Delete.
- (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete.
- Update all users.
- * elf32-arm.h (add_dynamic_entry): Update. Remove casts.
- * elf32-cris.c (add_dynamic_entry): Likewise.
- * elf32-hppa.c (add_dynamic_entry): Likewise.
- * elf32-i370.c (add_dynamic_entry): Likewise.
- * elf32-i386.c (add_dynamic_entry): Likewise.
- * elf32-m32r.c (add_dynamic_entry): Likewise.
- * elf32-m68k.c (add_dynamic_entry): Likewise.
- * elf32-ppc.c (add_dynamic_entry): Likewise.
- * elf32-s390.c (add_dynamic_entry): Likewise.
- * elf32-sh.c (add_dynamic_entry): Likewise.
- * elf32-sparc.c (add_dynamic_entry): Likewise.
- * elf32-vax.c (add_dynamic_entry): Likewise.
- * elf32-xtensa.c (add_dynamic_entry): Likewise.
- * elf64-alpha.c (add_dynamic_entry): Likewise.
- * elf64-hppa.c (add_dynamic_entry): Likewise.
- * elf64-ppc.c (add_dynamic_entry): Likewise.
- * elf64-s390.c (add_dynamic_entry): Likewise.
- * elf64-sparc.c (add_dynamic_entry): Likewise.
- * elf64-x86-64.c (add_dynamic_entry): Likewise.
- * elfxx-ia64.c (add_dynamic_entry): Likewise.
- * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise.
- * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
- * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise.
- * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
-
- 2004-03-22 Alan Modra <amodra@bigpond.net.au>
- * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add input_bfd, input_section
- and rel args. Group input and output args. Wrap to 80 columns.
- * elf-m10200.c, elf-m10300.c, elf32-arm.h, elf32-avr.c,
- elf32-cris.c, elf32-d10v.c, elf32-fr30.c, elf32-h8300.c,
- elf32-hppa.c, elf32-i386.c, elf32-i860.c, elf32-ip2k.c,
- elf32-iq2000.c, elf32-m68hc1x.c, elf32-m68k.c, elf32-mcore.c,
- elf32-msp430.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c,
- elf32-sparc.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c,
- elf32-xtensa.c, elf64-alpha.c, elf64-mmix.c, elf64-ppc.c,
- elf64-s390.c, elf64-sparc.c, elf64-x86-64.c, elfxx-ia64.c: Update
- RELOC_FOR_GLOBAL_SYMBOL invocation.
-
- 2004-03-20 H.J. Lu <hongjiu.lu@intel.com>
- * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Report error if
- unresolved symbols in objects aren't allowed.
- * elf-hppa.h (elf_hppa_relocate_section): Properly handle
- unresolved symbols.
- (elf_hppa_remark_useless_dynamic_symbols): Likewise.
- (elf_hppa_unmark_useless_dynamic_symbols):
- * elf32-frv.c (elf32_frv_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
- (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
- * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
- * elf-m10200.c (mn10200_elf_relocate_section): Use
- RELOC_FOR_GLOBAL_SYMBOL.
- * elf32-avr.c (elf32_avr_relocate_section): Likewise.
- * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
- * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
- * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
- * elf32-i860.c (elf32_i860_relocate_section): Likewise.
- * elf32-m68hc1x.c (m68hc11_get_relocation_value): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
- * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
- * elf32-v850.c (v850_elf_relocate_section): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
- * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
-
- 2004-03-19 Alan Modra <amodra@bigpond.net.au>
- H.J. Lu <hongjiu.lu@intel.com>
- * elflink.c (_bfd_elf_merge_symbol): Revert last change. Move
- type and size change code to where it was previously. Remove
- dt_needed param. Treat old weak syms as strong if new sym is
- from a shared lib, even when old sym is from another shared
- lib. Remove unnecessary tests of oldweak and newweak. Correct
- comments.
- (_bfd_elf_add_default_symbol): Remove dt_needed param. Update
- _bfd_elf_merge_symbol calls.
- * elflink.h (elf_link_add_object_symbols): Update calls. Remove
- dt_needed local var. Update comments.
- * elf-bfd.h (_bfd_elf_merge_symbol): Update prototype.
- (_bfd_elf_add_default_symbol): Likewise.
- * elflink.c (_bfd_elf_merge_symbol): Reinstate code to handle
- strong syms in one shared object overriding weak syms in another.
-
- 2004-03-18 Alan Modra <amodra@bigpond.net.au>
- * elf-bfd.h (struct elf_obj_tdata): Delete dt_soname field. Add
- dyn_lib_class field. Rearrange for better packing.
- (elf_dt_soname): Delete.
- (elf_dyn_lib_class): Define.
- * elf.c (bfd_elf_set_dt_needed_name): Update comment.
- (bfd_elf_set_dt_needed_soname): Delete.
- (bfd_elf_set_dyn_lib_class): New function.
- * elflink.h (add_dt_needed_tag): New function. Split out from..
- (elf_link_add_object_symbols): ..here. Rename "name" to "soname".
- Use elf_dyn_lib_class to set dt_needed and add_needed. Move fallback
- initialization of soname.
- (elf_link_check_versioned_symbol): Test elf_dyn_lib_class instead of
- elf_dt_soname.
- * bfd-in.h (enum dynamic_lib_link_class): New.
- (bfd_elf_set_dt_needed_soname): Delete.
- (bfd_elf_set_dyn_lib_class): Declare.
- * bfd-in2.h: Regenerate.
- * elflink.c (_bfd_elf_merge_symbol): Rewrite weak symbol handling.
- (_bfd_elf_add_default_symbol): Remove indirect BFD_ASSERTs.
- * elflink.h (elf_link_add_object_symbols): Don't clear dt_needed in
- symbol loop. Instead use add_needed to flag tag as written.
-
- 2004-03-03 Alexandre Oliva <aoliva@redhat.com>
- * elflink.c (bfd_elf_record_link_assignment): Mark undefweak and
- undefined symbols as hash_new.
-
- 2004-02-28 H.J. Lu <hongjiu.lu@intel.com>
- * elf-bfd.h (_bfd_elf_link_add_archive_symbols): New prototype.
- * elflink.h (is_global_data_symbol_definition): Moved to
- elflink.c.
- (elf_link_is_defined_archive_symbol): Likewise.
- (elf_link_add_archive_symbols): Likewise. Renamed to
- _bfd_elf_link_add_archive_symbols.
- * elflink.c (elf_link_is_defined_archive_symbol): Get the size
- of ELF symbol table entry from backend.
- (_bfd_elf_link_add_archive_symbols): Call bfd_link_add_symbols
- instead of elf_link_add_object_symbols.
-
- 2004-02-27 H.J. Lu <hongjiu.lu@intel.com>
- * elflink.h (sort_symbol): New.
- (elf_link_add_object_symbols): Use a sorted symbol array for
- weakdef.
-
- 2004-02-23 Jakub Jelinek <jakub@redhat.com>
- * elflink.h (size_dynamic_sections): If not adding DT_FLAGS and
- DF_BIND_NOW is set in info->flags, create DT_BIND_NOW dynamic entry.
-
- 2004-02-21 H.J. Lu <hongjiu.lu@intel.com>
- * elflink.c (_bfd_elf_merge_symbol): Properly handle undefined
- symbols with non-default visibility.
-
-2004-03-22 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (elf_xtensa_check_relocs): Remove code to read
- literal tables and check for relocs outside of literal pools.
- (elf_xtensa_make_sym_local): Don't clear ELF_LINK_NON_GOT_REF flag.
- (elf_xtensa_fix_refcounts): Don't check ELF_LINK_NON_GOT_REF or
- set DF_TEXTREL.
- (elf_xtensa_size_dynamic_sections): Don't add DT_TEXTREL entry.
- (elf_xtensa_relocate_section): Read literal tables and check for
- dynamic relocations in read-only sections and not in literal pools.
-
-2004-03-23 Alan Modra <amodra@bigpond.net.au>
-
- PR 51.
- * linker.c (bfd_wrapped_link_hash_lookup): Handle info->wrap_char.
-
-2004-03-22 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_16_GOTPLT,
- R_CRIS_16_GOTPLT>: Also error if there's no PLT for a symbol
- not defined by the executable, or defined in a DSO.
- <eliding run-time relocation of .got>: Initialize GOT entry for a
- function symbol or ELF_LINK_HASH_NEEDS_PLT statically in an
- executable.
- (cris_elf_gc_sweep_hook): Improve fallthrough marking.
- (elf_cris_try_fold_plt_to_got): Improve head comment. Do not fold
- a PLT reloc to GOT for an executable.
- (elf_cris_adjust_dynamic_symbol): Only fold a .got.plt entry with
- .got for a DSO and explain why.
- (elf_cris_discard_excess_program_dynamics): Also lose GOT-relocs
- and unreferenced symbols for which a PLT is defined. Adjust
- dynamic-symbol pruning correspondingly, to make sure we don't lose
- a dynamic symbol also defined by a DSO.
-
-2004-03-17 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
-
- * config.bfd: Switch sh-*-rtems* to ELF. Add sh-*-rtemscoff*.
-
-2004-03-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (elf_link_read_relocs_from_section): Don't use
- NUM_SHDR_ENTRIES in end of reloc calc. Move NULL shdr check..
- (_bfd_elf_link_read_relocs): ..to here.
- * elf32-ppc.c (ppc_elf_relax_section): Formatting.
-
- Merge from mainline.
- 2004-02-20 Jakub Jelinek <jakub@redhat.com>
- * elf32-ppc.c (allocate_dynrelocs): Create dynsym for undef weak
- symbols used in PIE relocs.
-
-2004-03-16 Alan Modra <amodra@bigpond.net.au>
-
- * configure.in (HOST_64BIT_TYPE, HOST_U_64BIT_TYPE): Don't override
- values selected in configure.host. Require both to be defined
- before setting BFD_HOST_64_BIT_DEFINED. Protect assignment to
- corresponding BFD_HOST vars with quotes.
- <${host64}-${target64}-${want64} in *true*>: Don't exempt gcc;
- Always require BFD_HOST_64_BIT_DEFINED.
- <file_ptr type>: Find off_t size before emitting message. Combine
- off_t and ftello64 conditional.
- * configure: Regenerate.
-
-2004-03-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-m32r.c (m32r_elf_create_dynamic_sections): Fix pointer
- aliasing warning. Remove trailing whitespace throughout file.
-
-2004-03-15 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
-
- * elf-hppa.h (elf_hppa_relocate_section): Pass input_bfd instead of
- input_section in calls to get_dyn_name.
- * elf64-hppa.c (get_dyn_name): Change type of first argument to "bfd *". Use section id of first section in input BFD to build dynamic name for
- local symbols.
- (elf64_hppa_check_relocs): Pass abfd in call to get_dyn_name.
-
-2004-03-15 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in.h (bfd_int64_t, bfd_uint64_t): New types.
- (BFD_HOST_64_BIT, BFD_HOST_U_64_BIT): Don't define here.
- (bfd_getb64, bfd_getl64, bfd_get_bits): Return bfd_uint64_t.
- (bfd_getb_signed_64, bfd_getl_signed_64): Return bfd_int64_t.
- (bfd_putb64, bfd_putl64, bfd_put_bits): Accept bfd_uint64_t.
- * configure.in (HOST_U_64BIT_TYPE): Set when sizeof long is 8.
- (BFD_HOST_64_BIT_DEFINED, BFD_HOST_64_BIT, BFD_HOST_U_64_BIT): Set
- when using long.
- * libbfd.c (EIGHT_GAZILLION, COERCE64): Use bfd_int64_t.
- (bfd_getb64): Return bfd_uint64_t. Enable when BFD_HOST_64_BIT.
- (bfd_getl64, bfd_getb_signed_64, bfd_getl_signed_64): Likewise.
- (bfd_putb64): Accept bfd_uint64_t. Enable when BFD_HOST_64_BIT.
- (bfd_putl64, bfd_put_bits, bfd_get_bits): Likewise.
- * dwarf2.c (struct attribute): Use bfd_int64_t and bfd_uint64_t.
- (read_8_bytes, read_indirect_string, read_address): Likewise.
- (read_abbrevs, parse_comp_unit): Likewise.
- * targets.c (struct bfd_target): Likewise.
- * aix386-core.c (NO_GET64, NO_PUT64, NO_GETS64): Define and use.
- * hppabsd-core.c: Likewise. Formatting.
- * hpux-core.c: Likewise.
- * irix-core.c: Likewise.
- * netbsd-core.c: Likewise.
- * osf-core.c: Likewise.
- * ptrace-core.c: Likewise.
- * sco5-core.c: Likewise.
- * trad-core.c: Likewise.
- * configure: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2004-03-15 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in.h (bfd_getb64, bfd_getl64): Replace bfd_byte* with void*.
- (bfd_getb32, bfd_getl32, bfd_getb16, bfd_getl16): Likewise.
- (bfd_getb_signed_64, bfd_getl_signed_64): Likewise.
- (bfd_getb_signed_32, bfd_getl_signed_32): Likewise.
- (bfd_getb_signed_16, bfd_getl_signed_16): Likewise.
- (bfd_putb64, bfd_putl64, bfd_putb32, bfd_putl32): Likewise.
- (bfd_putb16, bfd_putl16, bfd_get_bits, bfd_put_bits): Likewise.
- * libbfd.c: Likewise in function definitions.
- (bfd_put_8): Mask with 0xff rather than casting to char.
- (bfd_putb16, bfd_putl16, bfd_putb32, bfd_putl32): Likewise.
- (bfd_putb64, bfd_putl64, bfd_put_bits): Likewise.
- (H_PUT_64, H_PUT_32, H_PUT_16, H_PUT_8): Remove casts, simplify.
- (H_PUT_S64, H_PUT_S32, H_PUT_S16, H_PUT_S8): Likewise.
- (H_GET_64, H_GET_32, H_GET_16, H_GET_8): Likewise.
- (H_GET_S64, H_GET_S32, H_GET_S16, H_GET_S8): Likewise.
- * libaout.h (H_PUT_64 H_PUT_32, H_PUT_16): Remove casts, simplify.
- (H_PUT_S64, H_PUT_S32, H_PUT_S16): Likewise.
- (H_GET_64, H_GET_32, H_GET_16): Likewise.
- (H_GET_S64, H_GET_S32, H_GET_S16): Likewise.
- * archive.c (do_slurp_coff_armap): Update swap prototype.
- * coff-tic54x.c (tic54x_getl32): Replace bfd_byte* with void*.
- (tic54x_getl_signed_32): Likewise.
- (tic54x_putl32): Likewise. Mask with 0xff rather than casting to char.
- * mach-o.c (bfd_mach_o_read_header): Update get32 prototype.
- * pdp11.c (bfd_getp32): Make static, replace bfd_byte* with void*.
- (bfd_getp_signed_32, bfd_putp32): Likewise.
- * targets.c (struct bfd_target): Use void* in place of bfd_byte* for
- bfd_getx64, bfd_getx_signed_64, bfd_putx64, bfd_getx32,
- bfd_getx_signed_32, bfd_putx32, bfd_getx16, bfd_getx_signed_16,
- bfd_putx16, bfd_h_getx64, bfd_h_getx_signed_64, bfd_h_putx64,
- bfd_h_getx32, bfd_h_getx_signed_32, bfd_h_putx32, bfd_h_getx16,
- bfd_h_getx_signed_16, bfd_h_putx16.
- * aix386-core.c (NO_GET, NO_GETS, NO_PUT): Update prototypes.
- * hppabsd-core.c: Similarly. Rename NO_SIGNED_GET to NO_GETS.
- * hpux-core.c: Likewise.
- * irix-core.c: Likewise.
- * netbsd-core.c: Likewise.
- * osf-core.c: Likewise.
- * ptrace-core.c: Likewise.
- * sco5-core.c: Likewise.
- * trad-core.c: Likewise.
- * bfd-in2.h: Regenerate.
-
-2004-03-15 Matt Thomas <matt@3am-software.com>
-
- * config.bfd: Add x86-64 vector to NetBSD/i386 if 64bit BFD is
- selected.
-
-2004-03-13 Mark Kettenis <kettenis@gnu.org>
-
- * config.bfd: Add x86_64-*-openbsd*.
- * configure.in (x86_64-*-openbsd*): Set COREFILE to
- netbsd-core.lo.
- * configure: Regenerate.
-
-2004-03-09 Steve Ellcey <sje@cup.hp.com>
-
- * elfxx-ia64.c (plt_full_entry): Change ld8 to ld8.acq.
-
-2004-03-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * elf.c (map_sections_to_segments): Ignore .tbss sections for
- layout purposes.
-
-2004-02-17 Daniel Jacobowitz <drow@mvista.com>
- Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (mips_elf_calculate_relocation): Use
- _bfd_elf_symbol_refs_local_p to decide whether to decay
- a GOT_PAGE/GOT_OFST pair to GOT_DISP/addend.
- (_bfd_mips_elf_check_relocs): Add a global GOT entry for GOT_PAGE
- relocs if the symbol wasn't defined by a regular object file.
- Don't check the symbol's dynindx.
-
-2004-02-16 Andrew Cagney <cagney@redhat.com>
-
- * bfd-in.h (file_ptr, ufile_ptr): Configure type using
- @bfd_file_ptr@.
- * bfd-in2.h: Re-generate.
-
-2004-02-14 Andrew Cagney <cagney@redhat.com>
-
- * configure.host (HDEFINES): When hppa*-*-hpux*, define
- _LARGEFILE64_SOURCE.
-
-2004-02-13 Andrew Cagney <cagney@redhat.com>
-
- * elf.c (vma_page_aligned_bias): New function.
- (assign_file_positions_except_relocs)
- (assign_file_positions_for_segments): Replace broken modulo
- arithmetic with call to vma_page_aligned_bias.
-
-2004-02-11 Andrew Cagney <cagney@redhat.com>
-
- * bfd-in.h: Update copyright.
- (bfd_tell): Change return type to file_ptr.
- * bfd-in2.h: Re-generate.
- * cache.c: Update copyright.
- (bfd_cache_lookup_worker): Use real_fseek, do not cast offset
- parameter.
- (close_one): Use real_ftell.
- * bfdio.c: Update copyright.
- (real_ftell, real_fseek): New functions.
- (bfd_tell): Use real_fseek and real_ftell, change return type to
- file_ptr.
- (bfd_seek): Use real_ftell and real_fseek, change type of
- file_position to a file_ptr.
- * libbfd-in.h: Update copyright.
- (real_ftell, real_fseek): Declare.
- * libbfd.h: Re-generate.
-
- * configure.in (AC_CHECK_FUNCS): Check for ftello, ftello64,
- fseeko and fseeko64. Determine bfd_file_ptr.
- * configure: Re-generate.
- * config.in: Re-generate.
-
-2004-02-09 Anil Paranjpe <anilp1@KPITCummins.com>
-
- * coff-h8300.c: Added comments about relaxation for ldc.w and stc.w.
- * elf32-h8300.c: Likewise.
-
-2004-02-09 Christian Vogel <vogelchr@vogel.cx>
- Nick Clifton <nickc@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Catch
- GOT entries with no associated GOT subsection.
-
-2004-02-09 Richard Sandiford <rsandifo@redhat.com>
-
- * bfd-elf.h (elf_backend_name_local_section_symbols): New hook.
- * elf.c (swap_out_syms): Use it to decide whether local section
- symbols should be named.
- * elfxx-target.h (elf_backend_name_local_section_symbols): New macro.
- * elfxx-mips.h (_bfd_mips_elf_name_local_section_symbols): Declare.
- (elf_backend_name_local_section_symbols): Define.
- * elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): New.
-
-2004-01-30 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_brl): New function.
- (elfNN_ia64_relax_section): Optimize brl to br during the relax
- finalize pass.
-
-2004-01-30 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-frv.c (elf32_frv_always_size_sections): Initialize pointer
- to bfd_link_hash_entry passed by reference to
- _bfd_generic_link_add_one_symbol.
-
-2004-01-25 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Disallow imm
- relocations against dynamic symbols.
-
-2004-01-23 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (elf32_arm_check_relocs): Revert part of 2004-01-13
- change.
-
-2004-01-21 Tom Rix <tcrix@worldnet.att.net>
-
- * reloc.c: New 5 bit reloc, BFD_RELOC_M68HC12_5B, for m68hc12 movb/movw.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-2004-01-20 Danny Smith <dannysmith@users.sourceforge.net>
-
- * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Don't remove
- IMAGE_SCN_MEM_WRITE flag from .text section if WP_TEXT
- flag has been cleared.
-
-2004-01-19 Kazu Hirata <kazu@cs.umass.edu>
-
- * coff-h8300.c: Add and adjust comments about relaxation.
- * elf32-h8300.c: Likewise.
-
-2004-01-16 Kazu Hirata <kazu@cs.umass.edu>
-
- * coff-h8300.c: Fix comment typos.
- * elf32-h8300.c: Likewise.
-
-2004-01-16 Kazu Hirata <kazu@cs.umass.edu>
-
- * coff-h8300.c: Add comments about relaxation.
- * elf32-h8300.c: Likewise.
-
-2004-01-14 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * acinclude.m4: Quote names of macros to be defined by AC_DEFUN
- throughout.
- * aclocal.m4: Regenerate.
- * configure: Regenerate.
-
-2004-01-13 Ian Lance Taylor <ian@wasabisystems.com>
-
- * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Call
- mips_elf64_rtype_to_howto instead of using howto_table.
-
-2004-01-13 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Check that we created
- the .plt section.
- (elf32_arm_check_relocs): Don't increment the PLT refcount for
- relocs which would not use the PLT.
-
-2004-01-13 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_check_relocs): Ignore !SEC_ALLOC relocs.
- (ppc64_elf_gc_sweep_hook): Likewise.
- (ppc64_elf_size_dynamic_sections): Test for .plt directly.
-
-2004-01-12 Anil Paranjpe <anilp1@KPITCummins.com>
-
- Adds linker relaxation support for bit manipulation insns like
- band, bclr, biand, bild, bior, bist, bixor, bld, bnot, bor, bset,
- bst, btst, bxor.
- * elf32-h8300.c: Opcode for bit manipulation insn is checked in
- elf32_h8_relax_section function while relxation for aa:16 and aa:32.
- * coff-h8300.c: Opcode for bit manipulation insn is checked in
- h8300_reloc16_extra_cases function while relxation for aa:16 and aa:32.
-
-2004-01-12 Alan Modra <amodra@bigpond.net.au>
-
- * dwarf2.c: Convert to C90, remove unneeded casts and prototypes.
-
-2004-01-11 Kazu Hirata <kazu@cs.umass.edu>
-
- * elf32-h8300.c: Fix formatting.
-
-2004-01-11 Kazu Hirata <kazu@cs.umass.edu>
-
- * elf32-cris.c (cris_elf_gc_sweep_hook): Return early if no
- dynamic object is present. Declare r_symndx and h in an inner
- scope.
- * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.
-
-2004-01-09 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (struct elf32_arm_relocs_copied): Remove pc_count.
- (elf32_arm_copy_indirect_symbol): Don't copy pc_count.
- (elf32_arm_final_link_relocate): Handle PLT32 and PC24 relocs
- identically. Do not emit PC24 relocations for shared libraries.
- (elf32_arm_gc_sweep_hook): Handle PLT32 and PC24 relocs
- identically. Don't adjust pc_count.
- (elf32_arm_check_relocs): Handle PLT32 and PC24 relocs identically.
- Set ELF_LINK_HASH_NEEDS_PLT for both. Don't adjust pc_count; don't
- adjust count for branch relocations.
- (allocate_dynrelocs): Correct typo in call to
- WILL_CALL_FINISH_DYNAMIC_SYMBOL. Never allocate space for
- PC24 or PLT32 relocs when linking.
-
-2004-01-09 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
-
- * coff-arm.c (aoutarm_std_reloc_howto): [ARM_WINCE] Synchronize ARM_26D
- relocation howto with ARM_26 one for consistency.
- (coff_arm_relocate_section): Set partial_inplace for ARM_26 relocations
- that will be converted to ARM_26D ones, since we always want 'done'
- relocations to be reflected in section's data.
- (coff_arm_relocate_section): [ARM_WINCE] Quick fix for BL instruction
- offset.
- (_bfd_final_link_relocate): Do not modify "inplace" data, if not
- requested.
-
-2004-01-08 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
-
- * coff-arm.c (coff_arm_relocate_section): Do not alter relocs that
- are not partial_inplace during a relocatable link.
-
-2004-01-08 Kazu Hirata <kazu@cs.umass.edu>
-
- * elf32-m68k.c (elf_m68k_gc_sweep_hook): Return early
- if no dynamic object is present. Declare r_symndx and h in an
- inner scope.
-
-2004-01-07 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Don't install
- trampoline if it is known out of range.
-
-2004-01-06 Alexandre Oliva <aoliva@redhat.com>
-
- 2003-12-17 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (_frv_osec_readonly_p): New.
- (_frv_emit_got_relocs_plt_entries): Don't emit rofixup for
- undefweak symbol.
- (_frv_count_got_plt_entries): Adjust expected count accordingly.
- (elf32_frv_relocate_section): Likewise. Error out if attempting
- to emit rofixups or dynamic relocs in read-only segments. Use
- _bfd_elf_section_offset to adjust r_offsets in rofixups and
- dynamic relocations.
- 2003-12-12 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_relocate_section): Compute dynamic
- relocations or fixups involving merged sections correctly. Avoid
- crash when undefined symbol is referenced by R_FRV_32 or
- R_FRV_FUNCDESC_VALUE.
- 2003-12-02 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_relocate_section): Add output_offset of
- input section holding local symbol to addend of R_FRV_32 or
- R_FRV_FUNCDESC_VALUE dynamic relocation.
- 2003-11-27 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_modify_segment_map): Add link info arg.
- (elf32_frv_always_size_sections): Don't store pointer to
- __stacksize symbol in sec_info.
- (elf32_frv_modify_segment_map): Look it up here.
- 2003-11-26 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Emit the address
- of the lazy PLT entry, not only its offset, as the low word of a
- function descriptor.
- 2003-11-10 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_always_size_sections): Define __stacksize
- if a hash table entry already exists but is not a definition.
- 2003-11-05 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (frv_elf_link_hash_table_create): Use bfd_zalloc.
- (_frv_add_rofixup): Don't inline.
- (_frv_emit_got_relocs_plt_entries): Use NULL as funcdesc address
- for undefweak symbols.
- (elf32_frv_relocate_section): Avoid crash while computing
- relocation when linking with shared library. Only emit rofixups
- and dynamic relocations for alloc&load sections. Mark binaries
- with inter-segment relocations for relocation as a unit.
- (_frv_create_got_section): Rename .rofixup.got to .rofixup.
- (DEFAULT_STACK_SIZE): New.
- (_frv_count_got_plt_entries): Fix thinko in deciding whether to
- emit rofixups or dynamic relocs when linking dynamic non-PIE
- executables.
- (elf32_frv_size_dynamic_sections): Generate rofixup on PIEs and
- shared libs too. Reserve the last entry for the GOT pointer.
- (elf32_frv_finish_dynamic_sections): Emit it.
- (elf32_frv_always_size_sections): New.
- (elf32_frv_modify_segment_map): New.
- (elf32_frv_check_relocs): Reserve relocs32 space only in ALLOC
- sections.
- (frv_elf_merge_private_bfd_data): Clear PIC bit if FDPIC is set.
- (frv_elf_print_private_bfd_data): Handle FDPIC and LIBPIC.
- (elf_backend_always_size_sections): New.
- (elf_backend_modify_segment_map): New.
- 2003-10-31 Alexandre Oliva <aoliva@redhat.com>
- * config.bfd: Added frv-*-*linux*.
- * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Use idx 0 for
- ABS section, instead of crashing.
- (elf32_frv_relocate_section): Don't crash before warning about
- different segments in non-PIC relocation.
- 2003-10-17 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_relocate_section): Don't warn on LABEL24
- relocs to undefweak symbols.
- (elf32_frv_relocate_section): Ditto for undefined symbols.
- 2003-10-06 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_create_dynamic_sections): Make sure
- gotfixup section was created.
- 2003-09-30 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (elf32_frv_howto_table): Change GOT12,
- FUNCDESC_GOT12, GOTOFF12 and FUNCDESC_GOTOFF12 to
- complain_overflow_signed.
- * elf32-frv.c (_frv_add_rofixup): Do not error out if contents
- have not been allocated.
- (_frv_emit_got_relocs_plt_entries): Return non-void. Assert
- privfd only if dynamic sections were created.
- (elf32_frv_relocate_section): Compute gprel_segment, and use it
- for GPREL relocs. When linking relocatable FDPIC executables,
- emit warnings for relocations that would be illegal on PIE or
- shared libraries. Emit rofixup for R_FRV_32 only if input object
- is not FDPIC.
- (_frv_create_got_section): Define _gp symbol in the rofixup
- section.
- (elf32_frv_finish_dynamic_sections): If rofixups needed but
- dynamic sections missing, error out requesting -melf32frvfd.
- 2003-09-19 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Rearrange
- computation of addends from section and global or local symbol
- value. Change return type to bfd_boolean, and return a failure if
- a dynamic FUNCDESC or FUNCDESC_VALUE relocation that requires a
- nonzero addend is required.
- (elf32_frv_relocate_section): Likewise. Print error for
- unsupported nonzero addends.
- 2003-09-18 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (FRV_SYM_LOCAL): In the absence of dynamic sections,
- force everything local.
- (_frv_emit_got_relocs_plt_entries): Cope with NULL sec.
- * elf32-frv.c (struct frv_elf_link_hash_table): Added sgotfixup.
- (frv_gotfixup_section): New.
- (FRV_SYM_LOCAL): Accept undefweak and local common symbols.
- (struct frv_pic_relocs_info): Split relocs into relocs32, relocsfd
- and relocsfdv.
- (_frv_add_rofixup): New.
- (_frv_emit_got_relocs_plt_entries): Generate fixups for non-PIE
- fdpic executables. Use FRV_SYM_LOCAL more widely to simplify and
- improve some ugly conditions.
- (elf32_frv_relocate_section): Likewise. Reject inter-segment
- relocations in fdpic.
- (_frv_create_got_section): Create .rofixup.got section.
- (struct _frv_dynamic_got_info): Added fixups.
- (_frv_count_got_plt_entries): Account in-GOT relocations into
- relocs32, relocsfd and relocsfdv. Account them into relocs or
- fixups, as appropriate.
- (elf32_frv_size_dynamic_sections): Size rofixup section. Simplify
- sizing of gotrel.
- (elf32_frv_finish_dynamic_sections): Verify that the right number
- of relocations and fixups was generated.
- (elf32_frv_check_relocs): Compute relocs32, relocsfd and
- relocsfdv.
- * elf32-frv.c (FRV_SYM_LOCAL): New macro, used instead of
- SYMBOL_CALLS_LOCAL and SYMBOL_REFERENCES_LOCAL.
- (FRV_FUNCDESC_LOCAL): New macro, used to decide whether a function
- descriptor of a (formerly-)global symbol is local.
- (struct frv_pic_relocs_info): Adjust comments.
- (_frv_emit_got_relocs_plt_entries): Adjust.
- (elf32_frv_relocate_section): Likewise.
- (_frv_count_got_plt_entries): Likewise.
- * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Don't add global
- symbol's value to addend in the common preamble. Decay dynamic
- symbols to section+offset if they bind or call locally, for GOT
- and FUNCDESC_VALUE, respectively.
- (elf32_frv_relocate_section): Likewise.
- (elf32_frv_check_relocs): Don't register as dynamic symbols of
- internal or hidden visibility.
- 2003-09-17 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Get addend as
- argument, so as to not call _bfd_elf_rel_local_sym to compute it.
- (elf32_frv_relocate_section): Pass relocation addend in. Use
- original relocation addend to look up the got relocs/plt entries
- table. Do not call _bfd_elf_rel_local_sym. Don't error out when
- processing relocations that reference .scommon symbols.
- 2003-09-15 Alexandre Oliva <aoliva@redhat.com>
- Introduce support for dynamic linking.
- * elf32-frv.c (R_FRV_FUNCDESC_VALUE): Mark it as 64 bits.
- (elf32_frv_rel_32_howto, elf32_frv_rel_funcdesc_howto,
- elf32_frv_rel_funcdesc_value_howto): New REL descriptors.
- (frv_reloc_type_lookup): Return REL howtos for executables and
- dynamic libraries.
- (frv_info_to_howto_rel): New.
- (struct frv_elf_link_hash_table): New.
- (frv_hash_table, frv_got_section, frv_gotrel_section,
- frv_plt_section, frv_pltrel_section, frv_relocs_info,
- frv_got_initial_offset, frv_plt_initial_offset): New macros.
- (frv_elf_link_hash_table_create): New.
- (struct frv_pic_relocs_info): New.
- (frv_pic_relocs_info_hash, frv_pic_relocs_info_eq): New.
- (frv_pic_relocs_info_find): New.
- (frv_pic_relocs_info_for_global, frv_pic_relocs_info_for_local):
- New.
- (FRV_LZPLT_BLOCK_SIZE, FRV_LZPLT_RESOLVE_LOC): New.
- (_frv_add_dyn_reloc, _frv_osec_to_segment): New.
- (_frv_emit_got_relocs_plt_entries): New.
- (elf32_frv_relocate_section): Add support for dynamic linking.
- Handle new relocations.
- (_frv_create_got_section): New.
- (elf32_frv_create_dynamic_sections): New.
- (ELF_DYNAMIC_INTERPRETER): New.
- (struct _frv_dynamic_got_info): New.
- (_frv_count_got_plt_entries): New.
- (struct _frv_dynamic_got_plt_info): New.
- (_frv_compute_got_alloc_data): New.
- (_frv_get_got_entry, _frv_get_fd_entry): New.
- (_frv_assign_got_entries, _frv_assign_plt_entries): New.
- (_frv_resolve_final_relocs_info): New.
- (elf32_frv_size_dynamic_sections): New.
- (elf32_frv_finish_dynamic_sections): New.
- (elf32_frv_adjust_dynamic_symbol): New.
- (elf32_frv_finish_dynamic_symbol): New.
- (elf32_frv_check_relocs): Handle new relocs. Explain how the
- whole thing works.
- (elf_info_to_howto_rel): Define.
- (bfd_elf32_bfd_link_hash_table_create): Define.
- (elf_backend_create_dynamic_sections): Define.
- (elf_backend_adjust_dynamic_symbol): Define.
- (elf_backend_size_dynamic_sections): Define.
- (elf_backend_finish_dynamic_symbol): Define.
- (elf_backend_finish_dynamic_sections): Define.
- (elf_backend_want_got_sym): Define.
- (elf_backend_got_header_size): Define.
- (elf_backend_want_got_plt): Define.
- (elf_backend_plt_readonly): Define.
- (elf_backend_want_plt_sym): Define.
- (elf_backend_plt_header_size): Define.
- (elf_backend_may_use_rel_p): Define.
- (elf_backend_may_use_rela_p): Define.
- (elf_backend_default_use_rela_p): Define.
- 2003-08-08 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (R_FRV_FUNCDESC_VALUE, R_FRV_FUNCDESC_GOTOFF12,
- R_FRV_FUNCDESC_GOTOFFHI, R_FRV_FUNCDESC_GOTOFFLO, R_FRV_GOTOFF12,
- R_FRV_GOTOFFHI, R_FRV_GOTOFFLO): New.
- (frv_reloc_map): Map the corresponding BFD relocs to them.
- (frv_reloc_type_lookup): ... and back to BFD relocs.
- * reloc.c: New relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
- 2003-08-04 Alexandre Oliva <aoliva@redhat.com>
- * elf32-frv.c (R_FRV_GOT12, R_FRV_GOTHI, R_FRV_GOTLO,
- R_FRV_FUNCDESC, R_FRV_FUNCDESC_GOT12, R_FRV_FUNCDESC_GOTHI,
- R_FRV_FUNCDESC_GOTLO): New.
- (frv_reloc_map): Map the corresponding BFD relocs to them.
- (frv_reloc_type_lookup): ... and back to BFD relocs.
- * reloc.c: New relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-2004-01-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c (ELF_MAXPAGESIZE): Redefine for traditional
- targets to support pages of up to 64kB.
- (elf32_bed): Redefine to get a separate backend data structure for
- traditional targets.
- * elf64-mips.c (ELF_MAXPAGESIZE): Redefine for traditional
- targets to support pages of up to 64kB.
- (elf64_bed): Redefine to get a separate backend data structure for
- traditional targets.
- * elfn32-mips.c (ELF_MAXPAGESIZE): Redefine for traditional
- targets to support pages of up to 64kB.
- (elf32_bed): Redefine to get a separate backend data structure for
- traditional targets.
-
-2004-01-04 Mark Kettenis <kettenis@gnu.org>
-
- * elf32-sparc.c (elf32_sparc_grok_psinfo): New function.
-
-2004-01-02 Mark Kettenis <kettenis@gnu.org>
-
- * elf32-i386.c (elf_i386_grok_prstatus): Add support for FreeBSD.
- (elf_i386_grok_psinfo): Likewise.
-
-2004-01-02 Bernardo Innocenti <bernie@develer.com>
-
- * config.bfd: Add m68k-uClinux target.
-
-2004-01-01 Grant Edwards <grante@visi.com>
-
- * elflink.h (elf_gc_sections): Warn when gc-sections option is ignored.
- * elf32-h8300.c (elf32_h8_gc_mark_hook): New function.
- (elf32_h8_gc_sweep_hook): New function.
- (elf_backend_gc_mark_hook): Define.
- (elf_backend_gc_sweep_hook): Define.
- (elf_backend_can_gc_sections): Define.
-
-For older changes see ChangeLog-0203
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/ChangeLog-0001 b/contrib/binutils/bfd/ChangeLog-0001
deleted file mode 100644
index b5a3475..0000000
--- a/contrib/binutils/bfd/ChangeLog-0001
+++ /dev/null
@@ -1,9592 +0,0 @@
-2001-12-31 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_bfd_final_link): Check if dynobj is not NULL
- before looking for .eh_frame_hdr section.
- * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): If
- .eh_frame_hdr section is being stripped from output, don't do
- anything.
-
-2001-12-27 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (xcoff_generate_rtinit): Clean data_buffer alloc/free.
- * coff64-rs6000.c (xcoff64_generate_rtinit): Same.
- (xcoff_write_archive_contents_big): Rewrite.
- (xcoff_write_armap_big): Rewrite.
- (xcoff_write_one_armap_big): Delete.
- * libxcoff.h : Clean up.
-
-2001-12-21 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (bfd_xcoff_link_generate_rtinit): New function.
- Interface to linker for generation of __rtinit.
- * libxcoff.h (struct xcoff_backend_data_rec): Add new ops to xcoff
- backend to generate special linker symbol __rtinit.
- * coff-rs6000.c (bfd_xcoff_backend_data, bfd_pmac_xcoff_backend_data)
- : Add new rtinit ops
- * coff64-rs6000.c (bfd_xcoff_aix5_backend_data,
- bfd_xcoff_backend_data): Same.
- * bfd-in.h: Add bfd_xcoff_link_generate_rtinit.
- * bfd-in2.h : Regenerate.
-
-2001-12-21 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): Fix dst_mask for
- R_SPARC_DISP32. Support R_SPARC_PLT32.
- (sparc_reloc_map): Add BFD_RELOC_16_PCREL and BFD_RELOC_SPARC_PLT32.
- (elf32_sparc_check_relocs): Handle R_SPARC_PLT32.
- (elf32_sparc_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_howto_table): Fix dst_mask for
- R_SPARC_DISP32. Support R_SPARC_PLT32 and R_SPARC_PLT64.
- (sparc_reloc_map): Add BFD_RELOC_16_PCREL, BFD_RELOC_64_PCREL
- and BFD_RELOC_SPARC_PLT32.
- (sparc64_elf_check_relocs): Handle R_SPARC_PLT32 and R_SPARC_PLT64.
- (sparc64_elf_relocate_section): Likewise.
- * reloc.c (bfd_reloc_code_type): Add BFD_RELOC_SPARC_PLT32.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-2001-12-20 Tom Rix <trix@redhat.com>
-
- * coffcode.h (coff_compute_section_file_positions): Add special AIX
- loader alignment of text section.
-
-2001-12-20 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (mips-dec-netbsd*): Delete alias for mips*el-*-netbsd*.
-
- * config.bfd (arm-*-netbsdelf*): Add target.
- * configure.in: Include netbsd-core.lo for native arm-*-netbsd*.
- * configure: Regenerate.
-
-2001-12-20 Alan Modra <amodra@bigpond.net.au>
-
- * elfcode.h (elf_slurp_symbol_table): Test elf_elfsections for NULL,
- as can happen with a core file, before dereferencing.
-
-2001-12-19 Michael Snyder <msnyder@redhat.com>
-
- * elf32-i386.c (elf_i386_grok_psinfo): Fix copy-and-paste error:
- target is i386 (not mips), and size of descdata is 124 (not 128).
-
-2001-12-19 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size
- is 0, temporarily grow it to minimal CIE size.
- (_bfd_elf_write_section_eh_frame): If input .eh_frame section would
- end up empty, build a fake minimal CIE.
-
-2001-12-19 Steve Ellcey <sje@cup.hp.com>
-
- * config.bfd (bfd_elf32_ia64_hpux_big_vec): New vector for
- ia64*-*-hpux* target.
- (bfd_elf64_ia64_hpux_big_vec): Likewise.
- * targets.c: Ditto.
- * configure.in: Ditto.
- * configure: Regenerate
- * elfxx-ia64.c (elfNN_ia64_final_write_processing): Replace use of
- alloca with bfd_malloc.
- (get_local_sym_hash): Likewise.
- (elfNN_hpux_post_process_headers): New function.
- #include elfNN-target.h again with values for IA64 HP-UX vector.
-
-2001-12-18 Michael Snyder <msnyder@redhat.com>
-
- * elf.c (assign_file_positions_for_segments): Don't sort PT_NOTE
- sections of corefiles. Also it makes no sense to sort if count == 1.
-
-2001-12-18 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_copy_private_bfd_data): Also copy GP.
-
-2001-12-18 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_copy_private_bfd_data): Update comments.
-
-2001-12-18 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (_bfd_elf_copy_private_bfd_data): New. Prototype.
- (_bfd_mips_elf_copy_private_bfd_data): Removed.
-
- * elf.c (_bfd_elf_copy_private_bfd_data): New. Copy e_flags in
- the ELF header.
-
- * elf32-i370.c (??_elf_copy_private_bfd_data): Removed.
- (bfd_elf??_bfd_copy_private_bfd_data): Removed.
- * elf32-m32r.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-mips.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elfxx-ia64.c: Likewise.
-
- * elf64-mips.c (bfd_elf64_bfd_copy_private_bfd_data): Removed.
-
- * elfxx-target.h (bfd_elfNN_bfd_copy_private_bfd_data): Defined
- to _bfd_elf_copy_private_bfd_data.
-
-2001-12-18 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390 (elf_s390_check_relocs): Pass addend to
- gc_record_vtentry.
- * elf64-s390 (elf_s390_check_relocs): Likewise.
- Fix by Andreas Jaeger <aj@suse.de>.
-
-2001-12-18 Jason Thorpe <thorpej@wasabisystems.com>
-
- * configure.host: Correctly match all NetBSD/mips
- hosts.
-
-2001-12-18 matthew green <mrg@eterna.com.au>
-
- * config.bfd (m68*-*-netbsdelf*): New target.
- (m68*-*-netbsd): Also include bfd_elf32_m68k_vec.
- (m68*-*-netbsdaout*): New alias for m68*-*-netbsd.
-
-2001-12-18 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (size_dynamic_sections): Skip anonymous version tag.
- (elf_link_assign_sym_version): Don't count anonymous version tag.
-
-2001-12-18 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (struct cie): Add make_lsda_relative.
- (struct eh_cie_fde): Add lsda_encoding, lsda_offset,
- make_lsda_relative.
- (read_value, write_value): New.
- (_bfd_elf_discard_section_eh_frame): Inicialize
- lsda_encoding, lsda_offset and make_lsda_relative.
- (_bfd_elf_eh_frame_section_offset): If make_lsda_relative,
- request no dynamic reloc for LSDA field of FDE.
- (_bfd_elf_write_section_eh_frame): Handle make_lsda_relative.
- If a non-DW_EH_PE_absptr value is 0, don't adjust it by base
- or pcrel. Fix address computation for DW_EH_PE_pcrel relocs.
- Update LSDA field if LSDA encoding is DW_EH_PE_pcrel, because
- . might have changed due to deleted FDE or CIEs.
-
-2001-12-18 Jakub Jelinek <jakub@redhat.com>
-
- * elf-strtab.c (struct elf_strtab_hash_entry): Add u.next.
- (last_eq): Remove.
- (_bfd_elf_strtab_finalize): Don't use a hash table for last
- character chains, instead use an array.
-
-2001-12-18 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elf.c (elfcore_netbsd_get_lwpid): New function.
- (elfcore_grok_netbsd_procinfo): New function.
- (elfcore_grok_netbsd_note): New function.
- (elfcore_read_notes): Call elfcore_grok_netbsd_note to process
- NetBSD ELF core file notes.
-
-2001-12-18 Alan Modra <amodra@bigpond.net.au>
-
- * elfcode.h (struct bfd_preserve): New.
- (elf_object_p): Replace preserved_* vars with instance of above.
- Save and restore arch_info pointer rather than arch, mach so that
- more cases can be restored. Save and restore new section_tail,
- section_htab structure, and init appropriately. Move "rest of
- section header" code so that i_shdrp needs no NULL initialisation.
- Free old section_htab on success.
- * elfcore.h (elf_core_file_p): Likewise.
-
-2001-12-17 Tom Rix <trix@redhat.com>
-
- * coffcode.h (sec_to_styp_flags): Add STYP_EXCEPT and STYP_TYPCHK for
- xcoff.
-
-2001-12-17 Jakub Jelinek <jakub@redhat.com>
-
- * elf-bfd.h (elf_discarded_section): Define.
- * elflink.h (elf_link_input_bfd): Use it.
- (elf_reloc_symbol_deleted_p): Likewise.
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Don't warn about
- overflows for pc relative relocs against discarded sections.
-
-2001-12-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (_bfd_mips_elf_relocate_section): Formatting.
- * elf64-mips.c: Add most of the fixes and tweaks done in elf32-mips.c
- over the last months. Add some code for mips16 handling.
- (mips_elf64_check_mips16_stubs): New function.
- (mips_elf64_stub_section_p): Likewise.
- (mips_elf64_calculate_relocation): Change interface to support mips16.
- (mips_elf64_perform_relocation): Likewise.
-
-2001-12-17 Alan Modra <amodra@bigpond.net.au>
-
- Support for more than 64k ELF sections.
- * elf-bfd.h (elf_size_info <swap_symbol_out>): Add shndx param.
- (bfd_elf32_swap_symbol_in): Likewise.
- (bfd_elf32_swap_symbol_out): Likewise.
- (bfd_elf64_swap_symbol_in): Likewise.
- (bfd_elf64_swap_symbol_out): Likewise.
- (elf_reloc_cookie): Add locsym_shndx field. Make locsyms a PTR.
- (elf_obj_tdata): Add num_elf_sections, symtab_shndx_hdr and
- symtab_shndx_section.
- (elf_numsections): Define.
- (elf_symtab_shndx): Define.
- * elf.c (setup_group): Use elf_numsections rather than header e_shnum.
- (bfd_elf_find_section): Likewise.
- (bfd_section_from_elf_index): Likewise.
- (bfd_section_from_shdr): Likewise. Handle SHT_SYMTAB_SHNDX.
- (bfd_section_from_r_symndx): Read symbol shndx extension, and
- translate st_shndx for > SHN_HIRESERVE.
- (assign_section_numbers): Skip reserved sections. Assign
- symtab_shndx_section and elf_numsections. Exclude reserved
- sections from e_shnum. Set up symtab_shndx_hdr.
- (_bfd_elf_compute_section_file_positions): Handle symtab_shndx_hdr.
- (map_sections_to_segments): Don't map eh_frame_hdr unless required.
- (assign_file_positions_except_relocs): Use elf_numsections rather
- than header e_shnum. Skip reserved sections and symtab_shndx_section.
- (prep_headers): Set name for symtab_shndx_hdr.
- (_bfd_elf_assign_file_positions_for_relocs): Use elf_numsections.
- (_bfd_elf_write_object_contents): Likewise. Skip reserved sections.
- (_bfd_elf_section_from_bfd_section): Check bfd_{abs,com,und}_section
- first. Use elf_section_data if available. Use elf_numsections.
- Start scan at index 1.
- (copy_private_bfd_data ): Comment fixes.
- (MAP_ONESYMTAB): Define above SHN_HIOS.
- (MAP_DYNSYMTAB): Likewise.
- (MAP_STRTAB): Likewise.
- (MAP_SHSTRTAB): Likewise.
- (MAP_SYM_SHNDX): New define.
- (_bfd_elf_copy_private_symbol_data): Handle symtab_shndx_section.
- (swap_out_syms): Swap out SHT_SYMTAB_SHNDX section too.
- * elfcode.h (elf_swap_symbol_in): Add shndx param, and handle shndx
- extension.
- (elf_swap_symbol_out): Likewise.
- (elf_object_p): Set elf_numsections, and use instead of e_shnum.
- Initialialise reserved elf_elfsections to point at shdr[0]. Remove
- redundant bfd_release calls.
- (elf_slurp_symbol_table): Read symbol shndx extension, and use with
- elf_swap_symbol_in. Translate st_shndx for > SHN_HIRESERVE too.
- * elflink.h (elf_link_is_defined_archive_symbol): Read symbol shndx
- extension, and use with elf_swap_symbol_in.
- (elf_link_record_local_dynamic_symbol): Likewise.
- (elf_link_add_object_symbols): Likewise. Also translate st_shndx
- for elf sections > SHN_HIRESERVE.
- (NAME(bfd_elf,size_dynamic_sections)): Adjust elf_swap_symbol_out
- call.
- (struct elf_final_link_info): Add locsym_shndx and symshndxbuf.
- (elf_bfd_final_link): Allocate the above, and tidy code allocating
- other buffers. Use elf_numsections instead of e_shnum. Adjust
- elf_swap_symbol_out calls.
- (elf_link_output_sym): Swap out symbol shndx extension too.
- (elf_link_flush_output_syms): And flush them to disk.
- (elf_link_output_extsym): Use SHN_BAD. Adjust elf_swap_symbol_out
- calls.
- (elf_gc_mark): Read symbol shndx extension, and use with
- elf_swap_symbol_in.
- (elf_link_input_bfd): Likewise, Translate st_shndx for elf sections
- > SHN_HIRESERVE too. Use SHN_BAD.
- (elf_reloc_symbol_deleted_p): Use symbol shndx extensions with
- elf_swap_symbol_in. Translate st_shndx > SHN_HIRESERVE too.
- (elf_bfd_discard_info): Read symbol shndx extension. Don't attempt
- to continue after a bfd error.
- * elf-m10200.c (mn10200_elf_relax_section): Only read local syms.
- Stash them immediately to symtab_hdr->contents rather than later
- in multiple places. Clean up afterwards. Read symbol shndx
- extension, and use with swap_symbol_in. Translate SHN_UNDEF,
- SHN_ABS, SHN_COMMON and elf sections > SHN_HIRESERVE to bfd
- sections too. Remove dead code.
- (mn10200_elf_relax_delete_bytes): Use symbol shndx extension
- when swapping in symbols. Tidy code adjusting global syms.
- Don't swap in global syms.
- (mn10200_elf_symbol_address_p): Likewise. Remove extsyms param.
- (mn10200_elf_get_relocated_section_contents): Read symbol shndx
- extension, and use with swap_symbol_in. Rename "size" -> "amt"
- to maximize code in common with other files. Translate st_shndx
- for > SHN_HIRESERVE too. Remove dead code.
- * elf-m10300.c (mn10300_elf_relax_section): Only read local syms.
- Stash them immediately to symtab_hdr->contents rather than later
- in multiple places. Clean up afterwards. Read symbol shndx
- extension, and use with swap_symbol_in. Remove dead code.
- (mn10300_elf_relax_delete_bytes): As for elf-m10200.c.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): As for elf-m10300.c.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- * elf32-hppa.c (elf32_hppa_size_stubs): Read symbol shndx
- extension, and use with swap_symbol_in.
- * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
- * elf32-i370.c (i370_elf_finish_dynamic_sections): Adjust call to
- bfd_elf32_swap_symbol_out.
- * elf32-m32r.c (m32r_elf_get_relocated_section_contents): Translate
- elf sections > SHN_HIRESERVE too.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Only read
- local syms. Read symbol shndx extension, and use with swap_symbol_in.
- * elf32-mips.c (_bfd_mips_elf_final_write_processing): Use
- elf_numsections rather than header e_shnum.
- * elf32-sh.c (sh_elf_relax_section): As for elf-m10300.c.
- (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_get_relocated_section_contents): Likewise. Only read local
- symbols.
- * elf32-v850.c (v850_elf_symbol_processing): Use an unsigned int to
- hold section index. Use elf_numsections rather than e_shnum.
- Rename "index" -> "indx" to avoid shadowing warning.
- (v850_elf_add_symbol_hook): Likewise.
- * elf64-alpha.c (elf64_alpha_relax_section): Only read local syms.
- Read symbol shndx extension, and use with swap_symbol_in.
- * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
- Translate SHN_COMMON and elf sections > SHN_HIRESERVE too.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
- (elfNN_ia64_aix_add_symbol_hook): Use elf_numsections.
-
- * elf-m10300.c (mn10300_elf_gc_mark_hook): Remove unnecessary checks
- before calling bfd_section_from_elf_index on local syms.
- * elf32-arm.h (elf32_arm_gc_mark_hook): Likewise.
- * elf32-avr.c (elf32_avr_gc_mark_hook): Likewise.
- * elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
- * elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
- * elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
- * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
- * elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
- * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
- * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
- * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
- * elf32-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
- * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Likewise.
- * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
- * elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
- * elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
- * elf32-sparc.c (elf32_sparc_gc_mark_hook): Likewise.
- * elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
- * elf64-mips.c (mips_elf64_gc_mark_hook): Likewise.
- * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
- * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
- * elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
- * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
-
-2001-12-17 Alan Modra <amodra@bigpond.net.au>
-
- Hash bfd sections for fast lookup and create.
- * bfd.c (struct _bfd): Add section_htab, section_tail.
- * libbfd-in.h (_bfd_delete_bfd): Declare.
- (bfd_section_hash_newfunc): Declare.
- * opncls.c (_bfd_new_bfd): Free memory on failure. Init
- section_htab and section_tail.
- (_bfd_delete_bfd): New function.
- (bfd_openr): Use it.
- (bfd_fdopenr): Likewise.
- (bfd_openstreamr): Likewise.
- (bfd_openw): Likewise.
- (bfd_close): Likewise.
- (bfd_close_all_done): Likewise.
- (bfd_release): Comment.
- * section.c (struct section_hash_entry): New.
- (bfd_section_hash_newfunc): New function.
- (section_hash_lookup): Define.
- (bfd_section_init): New function, split out from
- bfd_make_section_anyway.
- (bfd_get_section_by_name): Lookup via hash table.
- (bfd_get_unique_section_name): Likewise.
- (bfd_make_section_old_way): Rewrite to use hash table.
- (bfd_make_section_anyway): Likewise.
- (bfd_make_section): Likewise. Return NULL for attempts to make
- BFD_{ABS,COM,UND,IND}_SECTION_NAME.
- (_bfd_strip_section_from_output): Adjust section_tail if needed.
- * configure.in: Bump bfd version.
- * configure: Regenerate.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2001-12-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf64-mips.c (mips_elf64_link_hash_entry): New link hash.
- (mips_elf64_high): New Function.
- (mips_elf64_higher): Likewise.
- (mips_elf64_highest): Likewise.
- (mips_elf64_info_to_howto_rel): Likewise.
- (mips_elf64_info_to_howto_rela): Likewise.
- (mips_elf64_write_rel): Likewise.
- (mips_elf64_write_rela): Likewise.
- (mips_elf64_link_hash_newfunc): Likewise.
- (mips_elf64_hi16_reloc): Likewise.
- (mips_elf64_higher_reloc): Likewise.
- (mips_elf64_highest_reloc): Likewise.
- (mips_elf64_gprel16_reloc): Likewise.
- (mips_elf64_gprel16_reloca): Likewise.
- (mips_elf64_literal_reloc): Likewise.
- (mips_elf64_gprel32_reloc): Likewise.
- (mips_elf64_shift6_reloc): Likewise.
- (mips_elf64_got16_reloc): Likewise.
- (mips_elf64_assign_gp): Likewise.
- (mips_elf64_final_gp): Likewise.
- (gprel16_with_gp): Likewise.
- (mips_elf64_additional_program_headers): Likewise.
- (mips_elf64_link_hash_table_create): Likewise.
- (mips_elf64_got_offset_from_index): Likewise.
- (_mips_elf64_got_info): Likewise.
- (mips_elf64_sign_extend): Likewise.
- (mips_elf64_overflow_p): Likewise.
- (mips_elf64_global_got_index): Likewise.
- (mips_elf64_sort_hash_table_f): Likewise.
- (mips_elf64_sort_hash_table): Likewise.
- (mips_elf64_swap_msym_out): Likewise.
- (mips_elf64_create_local_got_entry): Likewise.
- (mips_elf64_local_got_index): Likewise.
- (mips_elf64_got_page): Likewise.
- (mips_elf64_got16_entry): Likewise.
- (mips_elf64_local_relocation_p): Likewise.
- (mips_elf64_next_relocation): Likewise.
- (mips_elf64_create_dynamic_relocation): Likewise.
- (mips_elf64_calculate_relocation): Likewise.
- (mips_elf64_obtain_contents): Likewise.
- (mips_elf64_perform_relocation): Likewise.
- (mips_elf64_relocate_section): Likewise.
- (mips_elf64_create_dynamic_sections): Likewise.
- (mips_elf64_adjust_dynamic_symbol): Likewise.
- (mips_elf64_always_size_sections): Likewise.
- (mips_elf64_size_dynamic_sections): Likewise.
- (mips_elf64_finish_dynamic_symbol): Likewise.
- (mips_elf64_finish_dynamic_sections): Likewise.
- (mips_elf64_gc_mark_hook): Likewise.
- (mips_elf64_gc_sweep_hook): Likewise.
- (mips_elf64_create_got_section): Likewise.
- (mips_elf64_record_global_got_symbol): Likewise.
- (mips_elf64_create_msym_section): Likewise.
- (mips_elf64_allocate_dynamic_relocations): Likewise.
- (mips_elf64_check_relocs): Likewise.
- (mips_elf64_output_extsym): Likewise.
- (mips_elf64_swap_gptab_in): Likewise.
- (mips_elf64_swap_gptab_out): Likewise.
- (gptab_compare): Likewise.
- (mips_elf64_final_link): Likewise.
- (prev_reloc_addend): Remenber addend of previous parts of a combined
- reloc.
- (ELF_MIPS_GP_OFFSET): New define.
- (STUB_LW,STUB_MOVE,STUB_JALR,STUB_LI16): Likewise.
- (MIPS_FUNCTION_STUB_SIZE): Likewise.
- (mips_elf64_howto_rel): Fix HOWTO defines.
- (mips_elf64_howto_rela): Likewise.
- (mips_elf64_swap_reloca_out): Fix signedness.
- (mips_elf64_be_swap_reloc_in): Use ELF64* instead of ELF32*.
- (mips_elf64_be_swap_reloca_in): Likewise.
- (mips_elf64_be_swap_reloc_out): Likewise. Preserve extended type info.
- (mips_elf64_be_swap_reloca_out): Likewise.
-
-2001-12-15 Jakub Jelinek <jakub@redhat.com>
-
- * elf-bfd.h (_bfd_elf_maybe_strip_eh_frame_hdr): New prototype.
- * elf-eh-frame.c (struct eh_frame_hdr_info): Add strip.
- (_bfd_elf_discard_section_eh_frame): Don't create .eh_frame_hdr
- sec_info here. Free ehbuf.
- (_bfd_elf_discard_section_eh_frame_hdr): Don't size the section
- if hdr_info->strip.
- (_bfd_elf_maybe_strip_eh_frame_hdr): New.
- * elflink.h (size_dynamic_sections): Call it.
-
-2001-12-14 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_bfd_discard_info): Fix segfault when dynobj NULL.
-
-2001-12-13 Jakub Jelinek <jakub@redhat.com>
-
- * elf-bfd.h (enum elf_link_info_type): New.
- (struct bfd_elf_section_data): Remove stab_info and merge_info
- fields, add sec_info and sec_info_type.
- (struct elf_obj_tdata): Add eh_frame_hdr field.
- (_bfd_elf_discard_section_eh_frame): New prototype.
- (_bfd_elf_discard_section_eh_frame_hdr): Likewise.
- (_bfd_elf_eh_frame_section_offset): Likewise.
- (_bfd_elf_write_section_eh_frame): Likewise.
- (_bfd_elf_write_section_eh_frame_hdr): Likewise.
- * Makefile.am (BFD32_BACKENDS): Add elf-eh-frame.lo.
- (BFD32_BACKENDS_CFILES): Add elf-eh-frame.c.
- (elf-eh-frame.lo): New.
- * Makefile.in: Rebuilt.
- * configure.in (elf): Add elf-eh-frame.lo.
- * configure: Rebuilt.
- * elf.c (_bfd_elf_print_private_bfd_data): Support PT_GNU_EH_FRAME.
- (map_sections_to_segments): Create PT_GNU_EH_FRAME if requested.
- (get_program_header_size): Take into account PT_GNU_EH_FRAME
- segment.
- (_bfd_elf_rela_local_sym): Use sec_info_type and sec_info.
- (_bfd_elf_rel_local_sym): Likewise.
- (_bfd_elf_section_offset): Likewise. Call
- _bfd_elf_eh_frame_section_offset too.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Use sec_info_type and
- sec_info.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf-eh-frame.c: New file.
- * elflink.h (elf_link_add_object_symbols): Don't optimize SHF_MERGE
- .stab sections. Set sec_info_type, use sec_info instead
- of merge_info and stab_info.
- (elf_link_create_dynamic_sections): Create .eh_frame_hdr section
- if --eh-frame-hdr.
- (elf_bfd_final_link): Write .eh_frame_hdr section.
- (elf_link_sec_merge_syms): Use sec_info_type and sec_info.
- (elf_link_input_bfd): Likewise.
- Call _bfd_elf_write_section_eh_frame to write .eh_frame sections.
- (elf_bfd_discard_info): Add output_bfd argument.
- Call _bfd_elf_discard_section_eh_frame and
- _bfd_elf_discard_section_eh_frame_hdr.
- (elf_section_ignore_discarded_relocs): Use sec_info_type, not section
- names.
- * bfd-in.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Adjust
- prototypes.
- * bfd-in2.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Likewise.
-
-2001-12-12 Richard Henderson <rth@redhat.com>
-
- * syms.c (_bfd_generic_read_minisymbols): Early return for
- no symbols. Patch from FreeBSD folk; exact origin unknown.
-
-2001-12-11 Alan Modra <amodra@bigpond.net.au>
-
- * elfcode.h (elf_swap_ehdr_out): Adjust value written for e_shnum
- and e_shstrndx if out of range.
- (elf_object_p): Read extended values for e_shnum and e_shstrndx
- from the first section header. Allocate space in elf_elfsections
- for reserved sections and set to NULLs.
- (elf_write_shdrs_and_ehdr): Set overflow fields in first section
- header. Skip reserved sections in elf_elfsections. Remove
- duplicate size calculation.
-
-2001-12-07 Geoffrey Keating <geoffk@redhat.com>
- Richard Henderson <rth@redhat.com>
- Corinna Vinschen <vinschen@redhat.com>
-
- * Makefile.am: Add support for xstormy16.
- * archures.c: Add support for xstormy16.
- * config.bfd: Add support for xstormy16.
- * configure.in: Add support for xstormy16.
- * reloc.c: Add support for xstormy16.
- * targets.c: Add support for xstormy16.
- * cpu-xstormy16.c: New file.
- * elf32-xstormy16.c: New file.
- * Makefile.in: Regenerated.
- * bfd-in2.h: Regenerated.
- * configure: Regenerated.
- * libbfd.h: Regenerated.
-
-2001-12-07 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf.c (assign_file_positions_for_segments): Combine sentance
- fragments into a single sentance in order to permit better
- translation into foreign languages.
-
-2001-12-07 Jim Blandy <jimb@redhat.com>
-
- * elf32-s390.c (elf32_s390_grok_prstatus): New function.
- (elf_backend_grok_prstatus): Define.
-
-2001-12-07 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Revert
- 2001-09-14 change.
-
-2001-12-07 Jakub Jelinek <jakub@redhat.com>
-
- * elf.c (_bfd_elf_rela_local_sym): Only call
- _bfd_merged_section_offset if merge_info is non-NULL.
- (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New.
- * elf-bfd.h (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New
- prototypes.
- * elf32-arm.h (elf32_arm_final_link_relocate): Use
- _bfd_elf_section_offset.
- (elf32_arm_relocate_section): Use _bfd_elf_rel_local_sym.
- * elf32-i386.c (elf_i386_relocate_section): Use
- _bfd_elf_section_offset and _bfd_elf_rel_local_sym.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Use
- _bfd_elf_section_offset.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_create_dynamic_relocation): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
-
-2001-12-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (clobber_millicode_symbols): Don't do anything if
- already forced local.
-
-2001-12-05 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Combine
- fragmented sentence parts into a whole sentence to permit
- better translation into foreign languages.
-
-2001-12-06 Hans-Peter Nilsson <hp@bitrange.com>
-
- * configure: Regenerate.
- * Makefile.in: Regenerate.
-
-2001-12-05 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * Makefile.am: split up BFD_LIBS like statements in BFD32_LIBS and
- BFD64_LIBS, make the latter depending on the availability of BFD64.
- Add archive64.c source file.
- * archive64.c: New file implementing bfd_elf64_archive_slurp_armap
- and bfd_elf64_archive_write_armap, code from elf64-mips.c
- * archive.c (bfd_slurp_armap): Add ELF64 archive support.
- * config.bfd (mips*-*-irix6*): Allow with BFD64 only.
- (mips64*el-*-linux*): Likewise.
- (mips*el-*-linux*): Likewise. Reorder entries.
- * configure.in (bfd_libs): Define in dependency of BFD64 and
- AC_SUBST it.
- * elf64-mips.c (mips_elf64_slurp_armap): Remove, use
- bfd_elf64_archive_slurp_armap instead.
- (mips_elf64_write_armap): Remove, use bfd_elf64_archive_write_armap
- instead.
-
-2001-12-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * config.bfd: Remove trailing blanks.
- * elf32-mips.c (gprel16_with_gp): Remove superfluous casts.
-
-2001-12-04 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-d10v.c (elf_d10v_howto_table): Adjust bit-size of
- R_D10V_10_PCREL_L, R_D10V_10_PCREL_R, R_D10V_18,
- R_D10V_18_PCREL. Check 10_PCREL relocations as signed.
- Disable pointless overflow checking of NONE and 32.
-
-2001-12-04 Alan Modra <amodra@bigpond.net.au>
-
- * reloc.c (bfd_install_relocation): Correct reloc address test.
- (bfd_perform_relocation): Formatting fix.
- * bfd-in2.h: Regenerate for 2001-12-02 reloc.c change.
-
-2001-12-03 Nick Clifton <nickc@cambridge.redhat.com>
-
- * configure.in (LINGUAS): Add tr.
- * configure: Regenerate.
- * po/tr.po: Import from translation project's web site.
-
-2001-12-03 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (hppa_get_stub_entry): Remove debug message that
- happens to trigger on undefined symbols.
- (final_link_relocate): Return bfd_reloc_undefined for undefined
- stubs.
- (elf32_hppa_relocate_section): Don't say we can't handle a reloc
- if we have already warned about an undefined symbol.
-
-2001-12-02 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (NEWABI_P): New define.
- (USE_REL): Remove, replaced by
- (elf_backend_may_use_rel_p): New define.
- (elf_backend_may_use_rela_p): Likewise.
- (elf_backend_default_use_rela_p): Likewise.
- (elf_mips_howto_table): Rename to elf_mips_howto_table_rel.
- Fix some relocation definitions.
- (elf_mips_howto_table_rela): New RELA relocation definitions for
- NewABI support.
- (mips32_64bit_reloc): Use the renamed elf_mips_howto_table_rel.
- (bfd_elf32_bfd_reloc_type_lookup): Likewise.
- (mips_rtype_to_howto): Likewise.
- (_bfd_mips_elf_relocate_section): Likewise.
- (_bfd_mips_elf_object_p): Typo.
- (elf_backend_sign_extend_vma): Reordered together with many other
- defines nearby to resemble the order of declaration in the header
- file.
-
-2001-12-02 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * coff-mips.c (mips_bfd_reloc_type_lookup): Replace
- BFD_RELOC_MIPS_GPREL by BFD_RELOC_GPREL16.
- * pe-mips.c (mips_bfd_reloc_type_lookup): Likewise.
- * elf32-mips.c (mips_reloc_map): Likewise. Replace
- BFD_RELOC_MIPS_GPREL32 by BFD_RELOC_GPREL32.
- * elf64-mips.c (mips_reloc_map): Likewise.
- * reloc.c (BFD_RELOC_MIPS_GPREL): Remove.
- (BFD_RELOC_MIPS_GPREL32): Remove.
-
-2001-11-30 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_add_default_symbol): New.
- (elf_link_add_object_symbols): Call elf_add_default_symbol ()
- to create an indirect symbol from the default for the symbol
- with the default version if needed.
-
-2001-11-29 "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de>
-
- * elf.c (elfcore_grok_prstatus): Do not overwite the core signal
- if it has already been set by another thread.
-
-2001-11-28 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-alpha.c (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Defined.
- (elf64_alpha_relocate_section): Translate local_got_entries
- for STT_SECTION symbol to SHF_MERGE section the first time
- we see it.
- * elfxx-ia64.c (struct elfNN_ia64_local_hash_entry): Add
- sec_merge_done.
- (get_local_sym_hash): New, extracted from get_dyn_sym_info.
- (get_dyn_sym_info): Use it.
- (elfNN_ia64_relocate_section): Translate local dyn entries
- for STT_SECTION symbol to SHF_MERGE section the first time
- we see it.
-
-2001-11-27 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_bfd_discard_info): Skip if the input bfd isn't
- ELF.
-
-2001-11-26 Jeffrey A Law (law@cygnus.com)
-
- * stabs.c (_bfd_discard_section_stabs): Use PARAMS in function
- prototypes.
-
-2001-11-24 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Decrease default stub
- group sizes to accommodate c++.
-
-2001-11-23 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Don't clear
- relocations in non-alloced sections against global symbols
- defined in shared library being built.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2001-11-23 Jakub Jelinek <jakub@redhat.com>
-
- * elf.c (_bfd_elf_rela_local_sym): New.
- * elflink.h (elf_link_input_bfd): Don't consider empty
- merged sections as removed in relocation tests.
- * elf-bfd.h (_bfd_elf_rela_local_sym): Add prototype.
- * elf32-i386.c (elf_i386_relocate_section): Handle relocs
- against STT_SECTION symbol of SHF_MERGE section.
- * elf32-arm.h (elf32_arm_relocate_section): Likewise.
- * elf32-avr.c (elf32_avr_relocate_section): Call
- _bfd_elf_rela_local_sym.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
- * elf32-fr30.c (fr30_final_link_relocate): Likewise.
- * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-i860.c (elf32_i860_relocate_section): Likewise.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf32-v850.c (v850_elf_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elf-hppa.h (elf_hppa_relocate_section): Likewise.
- * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
- * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise for
- !partial_inplace relocs. Handle relocs against STT_SECTION
- symbol of SHF_MERGE for partial_inplace relocs.
-
-2001-11-21 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/Make-in (distclean): Move SRC-POTFILES.in and
- BLD-POTFILES.in to maintainer-clean target.
-
-2001-11-21 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Test r_symndx rather
- than sym_sec->output_section to detect relocs against discarded
- sections.
-
-2001-11-19 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_input_bfd): Assert r_symndx != 0 when
- discarding relocations.
-
-2001-11-19 Nick Clifton <nickc@cambridge.redhat.com>
-
- * section.c (bfd_is_const_section): New macro. Return true if the
- given seciton is one of the special, constant, sections.
- * bfd-in2.h: Regenerate.
- * coffgen.c (coff_count_linenumbers): Use bfd_is_const_section.
- (coff_write_native_symbol): Use bfd_is_const_section.
-
-2001-11-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (clobber_millicode_symbols): Dec dynstr refcount.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Don't consider undefined
- millicode syms as candidates for import stubs.
-
- * elf32-hppa.c (PLABEL_PLT_ENTRY_SIZE): Delete.
- (allocate_PIC_calls): Rename to allocate_plt_static.
- (allocate_dynrelocs): Move most of code handling .plt entries to..
- (allocate_plt_static): ..here. Don't drop plabel entries.
-
-2001-11-19 Hans-Peter Nilsson <hp@bitrange.com>
-
- * mmo.c: Adjust documentation tags to use texinfo 4 features.
-
-2001-11-16 Nick Clifton <nickc@cambridge.redhat.com>
-
- * section.c (bfd_is_const_section): New macro. Return true if the
- section pointer refers to one of the special, constant sections.
- * bfd-in2.h: Regenerate.
-
- * coffgen.c (coff_count_linenumbers): Only update the line number
- count in non-special sections.
- (coff_write_native_symbol): Only update the line number file
- position in non-special sections.
-
-2001-11-15 Daniel Jacobowitz <drow@mvista.com>
-
- * elflink.h (elf_reloc_symbol_deleted_p): Catch all relocs against
- local syms from discarded sections. Update comment.
-
-2001-11-15 Alan Modra <amodra@bigpond.net.au>
-
- * po/SRC-POTFILES.in: Regenerate.
-
- * elflink.h (elf_link_input_bfd): Complain about all relocs
- against local syms from discarded sections. K&R fixes.
- (elf_reloc_symbol_deleted_p): Don't try to swap in external syms.
- K&R fixes.
-
-2001-11-15 Alexandre Oliva <aoliva@redhat.com>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Disregard
- overflows in the .stab section.
-
-2001-11-14 Daniel Jacobowitz <drow@mvista.com>
-
- * bfd-in.h (bfd_elf32_discard_info): Add prototype.
- (bfd_elf64_discard_info): Likewise.
- * bfd-in2.h: Regenerate.
- * elf-bfd.h (struct elf_reloc_cookie): New.
- (struct elf_backend_data): Add elf_backend_discard_info,
- elf_backend_ignore_discarded_relocs, and elf_backend_write_section.
- (_bfd_elf32_reloc_symbol_deleted_p): Add prototype.
- (_bfd_elf64_reloc_symbol_deleted_p): Likewise.
- * elf32-mips.c (_bfd_elf32_mips_discard_info): New.
- (_bfd_elf32_mips_ignore_discarded_relocs): New.
- (_bfd_elf32_mips_write_section): New.
- (elf_backend_discard_info): Define.
- (elf_backend_ignore_discarded_relocs): Define.
- (elf_backend_write_section): Define.
- * elfcode.h (elf_bfd_discard_info): Define.
- (elf_reloc_symbol_deleted_p): Define.
- * elflink.h (elf_link_input_bfd): Check
- elf_section_ignore_discarded_relocs. Call
- bed->elf_backend_write_section if available.
- (elf_reloc_symbol_deleted_p): New.
- (elf_bfd_discard_info): New.
- (elf_section_ignore_discarded_relocs): New.
- * elfxx-target.h (elf_backend_discard_info): Define.
- (elf_backend_ignore_discarded_relocs): Define.
- (elf_backend_write_section): Define.
- (elfNN_bed): Add elf_backend_discard_info,
- elf_backend_ignore_discarded_relocs, and
- elf_backend_write_section.
- * libbfd-in.h (_bfd_discard_section_stabs): Add prototype.
- * libbfd.h: Regenerate.
- * stabs.c (_bfd_discard_section_stabs): New.
-
-2001-11-14 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390.c (elf_s390_relocate_section): Use the "unresolved_reloc"
- scheme to get rid of an ugly complicated test.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
-
-2001-11-14 Andreas Jaeger <aj@suse.de>
-
- * cpu-i386.c (bfd_x86_64_arch_intel_syntax,bfd_x86_64_arch): Use
- x86-64 for display.
-
-2001-11-14 Jakub Jelinek <jakub@redhat.com>
-
- * dwarf2.c (struct line_head) [total_length]: Change type to
- bfd_vma.
- (struct dwarf2_debug): Add dwarf_str_buffer and dwarf_str_size.
- (struct comp_unit): Add stash and offset_size.
- (read_8_bytes): Return bfd_vma.
- (read_indirect_string): New.
- (read_attribute): Handle DW_FORM_strp.
- (decode_line_info): Support 64-bit DWARF format.
- (_bfd_dwarf2_find_nearest_line): Likewise.
- (parse_comp_unit): Set offset_size and stash.
-
-2001-11-13 Keith Walker <keith.walker@arm.com>
-
- * dwarf2.c (read_attribute_value): New function to handle
- DW_FORM_indirect.
- (read_attribute): Use it.
-
-2001-11-13 Geoffrey Keating <geoffk@redhat.com>
-
- * dwarf2.c (decode_line_info): Properly deal with unknown standard
- opcodes.
-
-2001-11-13 John Marshall <jmarshall@acm.org>
- Alan Modra <amodra@bigpond.net.au>
-
- * section.c (bfd_make_section_anyway): Don't increment section_id
- and the BFD's section_count if adding the section failed.
- * vms.c (vms_new_section_hook): Adjust for bfd_make_section_anyway
- change.
-
-2001-11-12 Orjan Friberg <orjanf@axis.com>
-
- * elf32-cris.c (cris_elf_grok_prstatus): Adjust values to match new
- core dump format.
-
-2001-11-11 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_finish_dynamic_sections): Call
- _bfd_elf_strtab_size instead of _bfd_stringtab_size.
-
- * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Change
- dynstr type to `struct elf_strtab_hash *'.
-
-2001-11-11 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf-strtab.c (_bfd_elf_strtab_finalize): Make first variable i
- size_t. Rename second i to j.
-
-2001-11-10 Jeffrey A Law (law@cygnus.com)
-
- * binary.c: Include safe-ctype.h after bfd.h and sysdep.h.
-
-2001-11-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF
- relocs into shared libs.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
-
- * elf.c (bfd_section_from_r_symndx): New function.
- * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define.
- (struct sym_sec_cache): New.
- (bfd_section_from_r_symndx): Declare.
- (struct bfd_elf_section_data): Change local_dynrel type to PTR.
- * elflink.h (elf_link_input_bfd): Don't test for removed linkonce
- relocs when relocatable. Don't zero entire reloc, just zero the
- addend and sym.
- * elf32-hppa.c (struct elf32_hppa_link_hash_table): Add sym_sec.
- (elf32_hppa_link_hash_table_create): Init it.
- (elf32_hppa_check_relocs): Track dynamic relocs needed for local
- syms on a per-section basis as we do for globals.
- (elf32_hppa_gc_sweep_hook): Update for local_dynrel change.
- (allocate_dynrelocs): Warning fix.
- (elf32_hppa_size_dynamic_sections): Don't allocate relocs when
- section has been discarded.
- (elf32_hppa_relocate_section): Don't copy STN_UNDEF relocs
- into shared libs.
- * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec.
- (elf_i386_link_hash_table_create): Init it.
- (elf_i386_check_relocs): Track dynamic relocs needed for local
- syms on a per-section basis as we do for globals.
- (elf_i386_gc_sweep_hook): Update for local_dynrel change.
- Remove dead code.
- (allocate_dynrelocs): Warning fix.
- (elf_i386_size_dynamic_sections): Don't allocate relocs when
- section has been discarded.
- (elf_i386_relocate_section): Don't copy STN_UNDEF relocs
- into shared libs.
- * elf32-s390.c (struct elf_s390_link_hash_table): Add sym_sec.
- (elf_s390_link_hash_table_create): Init it.
- (elf_s390_check_relocs): Track dynamic relocs needed for local
- syms on a per-section basis as we do for globals.
- (elf_s390_gc_sweep_hook): Update for local_dynrel change.
- Remove dead code.
- (allocate_dynrelocs): Warning fix.
- (elf_s390_size_dynamic_sections): Don't allocate relocs when
- section has been discarded.
- (elf_s390_relocate_section): Don't copy STN_UNDEF relocs
- into shared libs.
- * elf64-ppc.c (struct ppc_link_hash_table): Add sym_sec.
- (ppc64_link_hash_table_create): Init it.
- (ppc64_elf_check_relocs): Track dynamic relocs needed for local
- syms on a per-section basis as we do for globals.
- (ppc64_elf_gc_sweep_hook): Update for local_dynrel change.
- (allocate_dynrelocs): Call the correct record_dynamic_dymbol
- function. Warning fix.
- (ppc64_elf_size_dynamic_sections): Don't allocate relocs when
- section has been discarded.
- (ppc64_elf_relocate_section): Don't copy STN_UNDEF relocs
- into shared libs.
- * elf64-s390.c (struct elf_s390_link_hash_table): Add sym_sec.
- (elf_s390_link_hash_table_create): Init it.
- (elf_s390_check_relocs): Track dynamic relocs needed for local
- syms on a per-section basis as we do for globals.
- (elf_s390_gc_sweep_hook): Update for local_dynrel change.
- Remove dead code.
- (allocate_dynrelocs): Warning fix.
- (elf_s390_size_dynamic_sections): Don't allocate relocs when
- section has been discarded.
- (elf_s390_relocate_section): Don't copy STN_UNDEF relocs
- into shared libs.
-
-2001-11-08 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390: Major rework that introduces all recent changes to
- the s390 backends. Get a closer match to elf32-i386.
- (elf_s390_relocate_section): Make use of dynamic section short-cuts.
- Localise vars, and delay setting. Better error reporting, replace
- BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a
- symbol is not defined in the regular object file and tread the weak
- definition as the normal one. Don't discard relocs for undefweak or
- undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in
- test for avoided copy relocs. Reinstate fudge for unresolved relocs
- in debugging sections.
- (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy
- reloc processing for weakdefs. Remove redundant casts and aborts.
- Delay setting of vars until needed. Move creation of dynamic symbols
- and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace
- BFD_ASSERT with abort. Discard .plt entries for everything with
- plt.refcount <= 0.
- (elf_s390_check_relocs): Don't allocate space for dynamic relocs,
- .got or .relgot here but do it in allocate_dynrelocs. Reference count
- possible .plt and .got entries. Don't test input section SEC_READONLY
- here to try to avoid copy relocs, and keep dyn_relocs regardless of
- ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of
- variables until needed. Remove separate switch stmt for creating .got
- section. Initialise local_got_refcounts to 0. Cache pointer to
- "sreloc" section in elf_section_data. Tweak condition under which .got
- created. Report files with bad relocation section names.
- (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that
- have been forced local. Use same test to decide if we can use a
- relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF
- comment. Move expressions out of function calls. Replace BFD_ASSERT
- with abort.
- (elf_s390_finish_dynamic_sections): Migrate common code out of switch
- statement. Replace BFD_ASSERT with abort.
- (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i"
- to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag
- instead of looking up section names for DT_TEXTREL. Replace
- BFD_ASSERT with abort. Zero out the dynamic allocated content space.
- Add a comment to remind us that one day this ought to be fixed.
- (struct elf_s390_link_hash_entry): Rename "root" to "elf".
- (struct elf_s390_link_hash_table): Likewise.
- (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get
- rid of unnecessary casts.
- (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields.
- Remove "section" field.
- (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
- Reference count possible .plt entries. Don't deallocate .got and
- .relgot space here.
- (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs.
- Update comment.
- (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to
- dyn_relocs.
- (elf_s390_discard_copies): Delete.
- (elf_s390_link_hash_traverse): Delete.
- (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link
- rather than gc variety).
- (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt,
- srelplt, sdynbss, srelbss fields.
- (elf_s390_link_hash_table_create): Init them.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (allocate_dynrelocs): New function.
- (create_got_section): New function.
- (elf_backend_can_refcount): Define.
- (elf_backend_copy_indirect_symbol): Define.
- (elf_s390_copy_indirect_symbol): New function.
- (elf_s390_create_dynamic_sections): New function.
- (readonly_dynrelocs): New function.
- * elf64-s390.c: Likewise.
-
-2001-11-07 Jakub Jelinek <jakub@redhat.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf-strtab.lo.
- (BFD32_BACKENDS_CFILES): Add elf-strtab.c.
- (elf-strtab.lo): Add rule.
- * Makefile.in: Rebuilt.
- * configure.in (elf): Add elf-strtab.lo.
- * configure: Rebuilt.
- * elf-bfd.h (elf_strtab_hash): Forward declare.
- (struct elf_link_hash_table): Change dynstr type to
- struct elf_strtab_hash *.
- (struct elf_obj_tdata): Change strtab_ptr type to
- struct elf_strtab_hash *.
- (_bfd_elf_strtab_init, _bfd_elf_strtab_free, _bfd_elf_strtab_add,
- _bfd_elf_strtab_addref, _bfd_elf_strtab_delref,
- _bfd_elf_strtab_clear_all_refs, _bfd_elf_strtab_size,
- _bfd_elf_strtab_offset, _bfd_elf_strtab_emit,
- _bfd_elf_strtab_finalize): New prototypes.
- * elf-strtab.c: New file.
- * elflink.h (elf_link_add_object_symbols): Use _bfd_elf_strtab_add
- and _bfd_elf_strtab_size instead of _bfd_stringtab calls.
- Call _bfd_elf_strtab_delref if DT_NEEDED entry is not needed or
- when forcing dynamic symbol to local.
- (elf_link_create_dynamic_sections): Call
- _bfd_elf_strtab_init instead of elf_stringtab_init.
- (elf_link_record_local_dynamic_symbol): Likewise, change
- dynstr type. Use _bfd_elf_strtab functions instead of
- _bfd_stringtab calls.
- (size_dynamic_sections): Use _bfd_elf_strtab functions instead of
- _bfd_stringtab calls. For DT_RUNPATH and Verdaux vda_name fields,
- call _bfd_elf_strtab_addref. Call elf_finalize_dynstr.
- (elf_adjust_dynstr_offsets, elf_finalize_dynstr): New functions.
- (elf_fix_symbol_flags): Call _bfd_elf_strtab_delref when forcing
- dynamic symbol to local.
- (elf_link_assign_sym_version): Likewise.
- (elf_bfd_final_link): Call _bfd_elf_strtab_emit instead of
- _bfd_stringtab_emit.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Change dynstr
- type. Call _bfd_elf_strtab functions instead of
- _bfd_stringtab functions.
- * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
- * elf.c (_bfd_elf_init_reloc_shdr): Likewise.
- (elf_fake_sections): Likewise.
- (assign_section_numbers): Call _bfd_elf_strtab_clear_all_refs
- on shstrtab hash table, call _bfd_elf_strtab_addref on each section
- name in the output. Call _bfd_elf_strtab_finalize and
- use _bfd_elf_strtab_offset to finalize sh_name section header fields.
- (_bfd_elf_compute_section_file_positions): Use _bfd_elf_strtab_size
- instead of _bfd_stringtab_size.
- (prep_headers): Change shstrtab type.
- Use _bfd_elf_strtab calls instead of _bfd_stringtab calls.
-
-2001-11-07 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd <removed linkonce relocs>): Fix
- bad symtab segfault. Formatting and warning fixes. Improve
- error message for internationalisation.
-
-2001-11-06 H.J. Lu (hjl@gnu.org)
-
- * elflink.h (elf_link_input_bfd): Complain about relocs against
- discarded sections.
-
-2001-11-03 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-target.h (elfNN_bed): Correct want_got_sym, want_dynbss order.
-
-2001-11-02 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Don't create
- dynamic relocation for symbols defined in regular objects when
- creating executables.
-
-2001-11-02 Nick Clifton <nickc@cambridge.redhat.com>
-
- * configure.in (ALL_LINGUAS): Add "fr".
- * configure: Regenerate.
- * po/fr.po: New file.
-
- * coffgen.c (coff_object_p): Add comment to H.J.'s recent patch.
-
-2001-11-02 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * som.c (setup_sections): Initialize subspace_sections.
-
-2001-11-02 H.J. Lu (hjl@gnu.org)
-
- * coffgen.c (coff_object_p): Return 0 if the header is too big.
-
-2001-11-02 Hans-Peter Nilsson <hp@axis.com>
-
- * elfcore.h (elf_core_file_p): Preserve and clear abfd section
- information. Save bfd arch and mach values. Restore on error.
-
-2001-11-02 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (hppa_handle_PIC_calls): Rename to mark_PIC_calls.
- (allocate_PIC_calls): New function.
- (allocate_dynrelocs): Don't allocate pic_call plt entries here.
- (elf32_hppa_size_dynamic_sections): Call allocate_PIC_calls.
- (elf32_hppa_finish_dynamic_symbol): Remove dead code.
-
-2001-11-02 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_grok_prstatus): New function.
- (cris_elf_grok_psinfo): New function.
- (elf_backend_grok_prstatus): Define.
- (elf_backend_grok_psinfo): Define.
-
-2001-11-01 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Correct branch
- prediction bits.
-
-2001-10-31 Chris Demetriou <cgd@demetriou.com>
-
- * elf32-mips.c (_bfd_mips_elf_hi16_reloc): Handle PC-relative
- relocations properly.
-
-2001-10-31 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_output_extsym): Don't clear the visibility
- field for relocateable.
-
-2001-11-01 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Don't count
- .plt relocs in DT_RELASZ.
-
-2001-10-29 NIIBE Yutaka <gniibe@m17n.org>
-
- * config.bfd: Supports sh3/sh4/sh3eb/sh4eb-unknown-linux-gnu
- targets.
-
-2001-10-31 Nick Clifton <nickc@cambridge.redhat.com>
-
- * targets.c: Fix typo: bfd_mmo_mmix_vec => bfd_mmo_vec.
-
-2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
-
- * Makefile.am (ALL_MACHINES): Add cpu-mmix.lo.
- (BFD64_BACKENDS): Add elf64-mmix.lo and mmo.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-mmix.c and mmo.c.
- Regenerate dependencies.
- * configure.in (bfd_elf64_mmix_vec, bfd_mmo_vec): New vectors.
- * config.bfd: [BFD64] (mmix-*-*): New case.
- * cpu-mmix.c, mmo.c, elf64-mmix.c: New files.
- * archures.c (enum bfd_architecture): Add bfd_arch_mmix.
- (bfd_mmix_arch): Declare.
- (bfd_archures_list): Add bfd_mmix_arch.
- * targets.c (enum bfd_flavour): Add bfd_target_mmo_flavour.
- (bfd_elf64_mmix_vec, bfd_mmo_vec): Declare.
- (bfd_target_vect) [BFD64]: Add bfd_elf64_mmix_vec and
- bfd_mmo_mmix_vec.
- * reloc.c: Add MMIX relocations.
- * bfd.c (struct _bfd, tdata): Add mmo_data.
- * Makefile.in: Regenerate.
- * configure: Regenerate.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * configure: Rebuild.
-
-2001-10-30 Richard Earnshaw (rearnsha@arm.com)
-
- * elf.c (_bfd_elf_make_section_from_shdr): Set the LMA based on the
- p_paddr of the segment that contains it.
- (copy_private_bfd_data): If the LMA for a segment is known, use it
- for matching sections to segments.
- (assign_file_positions_for_segments): Use the LMA when adjusting
- for inter-section alignment padding.
-
-2001-10-29 Kazu Hirata <kazu@hxi.com>
-
- * README: Fix a typo.
-
-2001-10-24 Richard Henderson <rth@redhat.com>
-
- * peXXigen.c (_bfd_XX_print_private_bfd_data_common): Copy
- timestamp to time_t for ctime.
-
-2001-10-24 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_reloc_type_lookup): Change loop to use
- unsigned, increasing index.
-
-2001-10-23 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_modify_segment_map): Check
- m != NULL before accessing it.
-
-2001-10-23 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd): Zero the reloc instead of doing
- bfd_reloc_type_lookup (bfd, BFD_RELOC_NONE) as bfd_reloc_type_lookup
- doesn't accept BFD_RELOC_* on some targets, eg. hppa.
-
- * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove plt_abs.
- (hppa_link_hash_newfunc): Likewise.
- (elf32_hppa_finish_dynamic_symbol): Likewise.
- (allocate_dynrelocs): Always allocate .got relocs if shared.
- (elf32_hppa_relocate_section): Output them too. Similarly
- consolidate .plt reloc code, and no longer initialise .plt
- when a reloc is output.
- (elf32_hppa_finish_dynamic_symbol): Only initialise .plt entries
- when no reloc is output.
-
- From Herbert Xu <herbert@gondor.apana.org.au>
- * elf32-hppa.c (final_link_relocate): Call bfd_set_error for
- unreachable branches.
-
-2001-10-22 H.J. Lu <hjl@gnu.org>
-
- * configure.in (WIN32LIBADD): Use -L../libiberty for
- mips*-*-linux*.
- * configure: Rebuild.
-
-2001-10-21 H.J. Lu <hjl@gnu.org>
-
- * configure.in (WIN32LIBADD): Include -L../libiberty/pic -liberty
- if shared library is enabled only for Linux hosts.
- * configure: Rebuild.
-
-2001-10-21 H.J. Lu <hjl@gnu.org>
-
- * configure.in (WIN32LIBADD): Check if PICFLAG is defined in
- ../libiberty/Makefile instead of $enable_shared.
- * configure: Rebuild.
-
-2001-10-21 H.J. Lu <hjl@gnu.org>
-
- * elf32-cris.c (cris_reloc_type_lookup): Use int for index. Cover
- index 0.
-
-2001-10-20 H.J. Lu <hjl@gnu.org>
-
- * configure.in (WIN32LIBADD): Include -L../libiberty/pic -liberty
- if shared library is enabled.
- * configure: Rebuild.
-
-2001-10-20 H.J. Lu <hjl@gnu.org>
-
- * elf32-cris.c (cris_reloc_type_lookup): Allow index 0.
-
-2001-10-19 H.J. Lu <hjl@gnu.org>
-
- * elfcode.h (elf_object_p): Don't clear D_PAGED if the section
- size is empty.
-
-2001-10-18 H.J. Lu <hjl@gnu.org>
-
- * elf32-i370.c (i370_elf_relocate_section): Ignore R_XXX_NONE.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
-
-2001-10-18 Jakub Jelinek <jakub@redhat.com>
-
- * section.c (_bfd_strip_section_from_output): Don't count
- SEC_EXCLUDE sections as references. Set SEC_EXCLUDE.
-
-2001-10-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf-m10200.c (mn10200_elf_relax_section): Cast assignment to
- Elf_Internal_Shdr.contents now that it's no longer a PTR.
- * elf-m10300.c (mn10300_elf_relax_section): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): Likewise.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
- * elf32-sh.c (sh_elf_relax_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
- * elf.c (setup_group): Warning fixes.
- * elflink.h (elf_link_sort_relocs): Likewise.
- * pdp11.c (slurp_reloc_table): Likewise.
-
-2001-10-16 Jeff Holcomb <jeffh@redhat.com>
-
- * elflink.h (elf_link_sort_relocs): Remove unnecessary pointer
- casts.
-
-2001-10-15 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_input_bfd): Set type to BFD_RELOC_NONE
- for relocations against discarded link-once section.
-
-2001-10-15 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_relocate_section): Report some detail on
- bfd_reloc_outofrange and similar errors.
-
- * elf.c (_bfd_elf_link_hash_copy_indirect): Test ind->root.type
- rather than ind->weakdef.
- * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
- * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise.
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
- * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
-
-2001-10-15 Alan Modra <amodra@bigpond.net.au>
- H.J. Lu <hjl@gnu.org>
-
- * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Merge dyn_reloc
- counts for aliases instead of aborting.
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
-
- * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Set plt.offset
- to -1 for non-function symbols.
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
- * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
- * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
- * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
- * elf64-x86-64.c (elf64_x86_64_adjust_dynamic_symbol): Likewise.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Refer to
- plt.offset instead of plt.refcount when setting to -1.
-
-2001-10-12 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_relocate_section): Treat R_ARM_THM_PC22
- like R_ARM_PC24. Include reloc number in error message about
- unresolvable relocs.
-
-2001-10-10 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_link_sort_cmp2): Don't mix PLT and non-PLT
- relocations against the same symbol in .rel{,a}.dyn section.
-
-2001-10-10 Kazu Hirata <kazu@hxi.com>
-
- * aout-encap.c: Fix comment typos.
- * aoutx.h: Likewise.
- * archive.c: Likewise.
- * bout.c: Likewise.
- * coff64-rs6000.c: Likewise.
- * coffcode.h: Likewise.
- * coffgen.c: Likewise.
- * cofflink.c: Likewise.
- * coff-mips.c: Likewise.
- * ecoff.c: Likewise.
- * elf32-m32r.c: Likewise.
- * libcoff-in.h: Likewise.
- * libecoff.h: Likewise.
- * libxcoff.h: Likewise.
- * nlm32-i386.c: Likewise.
- * pdp11.c: Likewise.
- * section.c: Likewise.
- * som.c: Likewise.
- * som.h: Likewise.
- * bfd-in2.h: Regenerate.
- * libcoff.h: Likewise.
-
-2001-10-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (elf_map_symbols): Don't create new section symbols; Use
- existing section syms. Update comments.
- (copy_private_bfd_data): Formatting fixes.
- (elfcore_grok_win32pstatus): Likewise.
- (swap_out_syms): Likewise. Remove unnecessary level of braces.
-
-2001-10-09 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct bfd_elf_section_data): Rename "group" to
- "group_name".
- (elf_group_name): Define.
- (elf_next_in_group): Define.
- * elf.c: Make use of elf_group_name and elf_next_in_group throughout.
- (setup_group): Don't use sec->lineno for SHT_GROUP section to store
- first member section; Instead use elf_next_in_group.
- (bfd_section_from_shdr): Likewise.
- (set_group_contents): Likewise. Use elf_section_syms, not sec->symbol.
-
-2001-10-09 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct bfd_elf_section_data): Add "group" and
- "next_in_group". Fix gp and gp_size comments.
- * elf.c (union elf_internal_group): New.
- (setup_group): New function.
- (_bfd_elf_make_section_from_shdr): Set BFD flags for SHT_GROUP.
- Call setup_group for SHF_GROUP sections.
- (bfd_section_from_shdr): Build a BFD section for SHT_GROUP.
- (elf_fake_sections): Set header type for SEC_GROUP, and header
- flags for sections in a group.
- (set_group_contents): New function.
- (_bfd_elf_compute_section_file_positions): Call it.
- (assign_section_numbers): Set sh_link for SHT_GROUP.
-
- * elflink.h (gc_mark_hook): Handle section groups.
- * elfxx-target.h: Add SEC_GROUP to applicable_flags.
- * section.c (SEC_GROUP): Define.
- (struct sec): Comment fixes.
- * bfd-in2.h: Regenerate.
-
- * elf.c (bfd_elf_print_symbol): Formatting fix; migrate expression
- out of function args.
- (_bfd_elf_canonicalize_reloc): Similarly.
- (_bfd_elf_get_symtab): Here too.
- (_bfd_elf_canonicalize_dynamic_symtab): And here.
- * elfcode.h (elf_slurp_symbol_table): Don't recalculate size for
- bfd_bread, and remove unnecessary cast.
-
-2001-10-08 Aldy Hernandez <aldyh@redhat.com>
-
- * config.bfd (targ_cpu): Add arm9e-*-elf.
-
-2001-10-06 Stephane Carrez <Stephane.Carrez@worldnet.fr>
-
- * dwarf2.c (comp_unit_find_nearest_line): Check for end of
- compilation unit.
-
-2001-10-06 Alan Modra <amodra@bigpond.net.au>
-
- * bfd.c (bfd_assert): Report bfd version.
- (_bfd_abort): Likewise.
-
- * elflink.h (elf_link_input_bfd): Don't zero discarded link-once
- section sym values. Instead replace any relocs against them with
- relocs against STN_UNDEF, which has a zero value.
-
- * elf32-arc.c (elf_arc_howto_table): Set partial_inplace for all
- relocs.
-
-2001-10-05 Jeff Law <law@redhat.com>
-
- * som.h (som_exec_data): New field "version_id".
- * som.c (som_object_setup): Record the version_id if it
- exists.
- (som_prep_headers): Do not initialize version_id here.
- (som_finish_writing): Initialize version_id here.
-
-2000-10-05 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (elf_mips_howto_table): Fix some relocation howtos
- according to the MIPS/SGI ELF64 ABI Draft.
- (mips_elf_sort_hash_table): Typo.
-
-2001-10-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Comment typo.
-
- * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Bail out after
- copying flags if this is a weakdef.
-
-2001-10-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_link_hash_entry): Reorganise for better
- packing.
-
- * elf32-mips.c (mips_elf_record_global_got_symbol): Set got.offset
- to 1 rather than 0 to avoid confusing copy_indirect_symbol.
- (mips_elf_sort_hash_table_f): Compare got.offset against 1.
-
- * Makefile.am (BFD_H_DEPS): Add symcat.h. Ensure everything
- depends on $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS), not just those
- backends we configure. Run "make dep-am".
- (install-data-local): Install symcat.h.
- * dep-in.sed: Remove symcat.h from dependencies.
- * Makefile.in: Regenerate.
-
-2001-10-03 Vassili Karpov <malc@pulsesoft.com>
-
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Handle nocopyreloc.
-
-2001-10-03 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf64-mips.c (elf_backend_may_use_rela_p): New define.
- (elf_backend_default_use_rela_p): New define.
-
-2001-10-03 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Fix typos in last
- change.
-
- * configure.in (AC_OUTPUT <bfd-in3.h>): Remove version.h.
- * configure: Regenerate.
- * Makefile.am (BFD_H_FILES): Add version.h.
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
- * elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using
- elf_backend_copy_indirect_symbol so that backend has a chance to
- copy other necessary fields.
- * elf-bfd.h (struct elf_backend_data): Update description of
- elf_backend_copy_indirect_symbol.
- * elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after
- copying flags if this is a weakdef.
- * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
- (elfNN_ia64_aix_add_symbol_hook): Use elf_link_hash_lookup rather
- than bfd_link_hash_lookup.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't do copy
- reloc processing for weakdefs.
- * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
- * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
-
-2001-10-02 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_check_relocs): Use a local var and cast
- result of ELF64_R_TYPE to enum before using in a switch.
- (ppc64_elf_gc_mark_hook): Likewise.
- (ppc64_elf_gc_sweep_hook): Likewise.
- (ppc64_elf_reloc_type_class): Likewise.
-
-2001-10-02 Alan Modra <amodra@bigpond.net.au>
-
- * version.h: New file.
- * bfd-in.h: (BFD_VERSION): Substitute bfd_version.
- (BFD_VERSION_DATE): Define.
- (BFD_VERSION_STRING): Define.
- * configure.in: AC_SUBST bfd_version, bfd_version_date and
- bfd_version_string.
- (AC_OUTPUT <bfd-in3.h>): Depend on version.h.
- * bfd-in2.h: Regenerate.
- * configure: Regenerate.
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
-
- * bfd-in.h: Include "symcat.h".
- (CONCAT4): Redefine as for old CAT4.
- * aout-arm.c: Use equivalent CONCAT* macro in place of CAT* macros.
- Add warning regarding whitespace.
- * aout-cris.c: Likewise.
- * aout-ns32k.c: Likewise.
- * aout-sparcle.c: Likewise.
- * aout-tic30.c: Likewise.
- * aout0.c: Likewise.
- * armnetbsd.c: Likewise.
- * demo64.c: Likewise.
- * elf-bfd.h: Likewise.
- * gen-aout.c: Likewise.
- * host-aout.c: Likewise.
- * hp300bsd.c: Likewise.
- * hp300hpux.c: Likewise.
- * i386aout.c: Likewise.
- * i386bsd.c: Likewise.
- * i386dynix.c: Likewise.
- * i386freebsd.c: Likewise.
- * i386linux.c: Likewise.
- * i386lynx.c: Likewise.
- * i386mach3.c: Likewise.
- * i386netbsd.c: Likewise.
- * libaout.h: Likewise.
- * m68k4knetbsd.c: Likewise.
- * m68klinux.c: Likewise.
- * m68klynx.c: Likewise.
- * m68knetbsd.c: Likewise.
- * m88kmach3.c: Likewise.
- * mipsbsd.c: Likewise.
- * newsos3.c: Likewise.
- * ns32knetbsd.c: Likewise.
- * pc532-mach.c: Likewise.
- * pdp11.c: Likewise.
- * riscix.c: Likewise.
- * sparclinux.c: Likewise.
- * sparclynx.c: Likewise.
- * sparcnetbsd.c: Likewise.
- * sunos.c: Likewise.
- * targets.c: Likewise.
- * vaxnetbsd.c: Likewise.
- * vms-hdr.c: Likewise.
-
-2001-10-01 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in.h: Remove comments regarding generated files.
- * libbfd-in.h: Likewise.
- * libcoff-in.h: Likewise.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Likewise.
- * libcoff.h: Likewise.
-
-2001-09-30 kaz Kojima <kkojima@rr.iij4u.or.jp>
- Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf32-sh.c (sh_elf_howto_table, R_SH_REL32): Make
- partial_inplace, matching assembler output. Set src_mask to
- all ones.
- (sh_elf_relocate_section): Delete misplaced comment.
- For relocatable linking against section symbol, call
- _bfd_relocate_contents for partial_inplace relocs and adjust
- rel->r_addend for others.
- <case R_SH_DIR32, R_SH_REL32>: Fetch partial_inplace addend with
- bfd_get_32, not at rel->r_addend.
-
-2001-09-30 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_link_hash_copy_indirect): Set ind refcounts to
- the old dir refcount, so we indirectly set them to init_refcount.
- Short-circuit asserts when we've just verified they are true.
-
-2001-09-29 Alan Modra <amodra@bigpond.net.au>
-
- * section.c (struct sec): Remove kept_section.
- (STD_SECTION): Remove kept_section initialisation.
- (bfd_make_section_anyway): Here too.
- * ecoff.c (bfd_debug_section): Remove kept_section initialisation.
- * cofflink.c (_bfd_coff_link_input_bfd): Don't test kept_section.
- * elflink.h (elf_link_input_bfd): Set discarded link-once section
- symbols to zero, and remove all code involved with kept_section
- and tracking section symbol values.
- * bfd-in2.h: Regenerate.
- * configure.in: Bump version number.
- * configure: Regenerate.
-
-2001-09-29 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (struct ppc_dyn_relocs): New.
- (IS_ABSOLUTE_RELOC): Define.
- (struct ppc_link_hash_entry): New.
- (struct ppc_link_hash_table): New.
- (ppc_hash_table): Define.
- (link_hash_newfunc): New function.
- (ppc64_elf_link_hash_table_create): New function.
- (create_got_section): New function.
- (ppc64_elf_create_dynamic_sections): Call create_got_section. Stash
- pointers to our dynamic sections in hash table.
- (ppc64_elf_copy_indirect_symbol): New function.
- (ppc64_elf_check_relocs): Remove DEBUG code. Use short-cuts to
- dynamic sections. Localise vars. Modify code for refcounts
- starting from zero. Don't allocate here, or force symbols dynamic.
- Don't copy all relocs if shared, select ones we need. Add code
- to track possible copy relocs for non-shared link.
- (ppc64_elf_gc_mark_hook): Update comment.
- (ppc64_elf_gc_sweep_hook): Sweep dynrelocs too.
- (ppc64_elf_adjust_dynamic_symbol): Remove DEBUG code. Rewrite .plt
- code for reference counting garbage collection. Don't create .plt
- entries for functions that don't comply with ABI naming convention,
- and don't allocate .plt space here. Use short-cuts to dynamic
- sections. If possible, keep dynamic relocations instead of using
- copy relocs. Remove confused comments.
- (ppc_adjust_dynindx): Delete.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (allocate_dynrelocs): New function.
- (readonly_dynrelocs): New function.
- (ppc64_elf_size_dynamic_sections): Rewrite. Allocate local .got
- space here, and call allocate_dynrelocs to allocate space for
- global .plt, .got and reloc sections. Use short-cuts to dynamic
- sections. Call readonly_dynrelocs to determine whether we need
- DT_TEXTREL. Don't generate section symbols here, the generic
- ELF linker code does it for us.
- (ppc64_elf_final_link): Call regular ELF backend linker rather than
- gc variety, since we do our own .got handling.
- (ppc64_elf_relocate_section): Remove DEBUG code. Make use of
- dynamic section short-cuts. Localise vars, and delay setting.
- Handle unknown relocs in main switch statement. Replace ugly
- complicated tests for unresolvable relocs with a simple direct
- scheme using "unresolved_reloc" var. Test ELF_ST_VISIBILITY
- before allowing an undefined sym in a shared lib. Do R_*_DS tests
- after main switch, when we've set addend. Do non-addend insn
- tweaks before main swithc. Ignore input_section->vma when
- calculating reloc offsets as it's always zero. Rewrite dynamic
- reloc handling. Consolidate R_*_HA handling. Handle more relocs.
- (ppc64_elf_finish_dynamic_symbol): Remove DEBUG code. Make use
- of dynamic section short-cuts. Reorganise .plt handling code.
- Remove confused comments. Take note of ELF_LINK_FORCED_LOCAL.
- Move expressions out of swap_reloca_out function calls.
- (ppc64_elf_reloc_type_class): New function.
- (ppc64_elf_info_to_howto): Move common expression to local var.
- (ppc64_elf_finish_dynamic_sections): Remove DEBUG code. Make use
- of dynamic section short-cuts. Don't fiddle with section syms
- here as the ELF linker does it for us.
- (elf_backend_can_refcount): Define.
- (bfd_elf64_bfd_link_hash_table_create): Define.
- (elf_backend_copy_indirect_symbol): Define.
- (elf_backend_reloc_type_class): Define.
- (elf_backend_*, bfd_elf64_bfd_* defines): Sort.
-
-2001-09-29 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_link_local_dynamic_entry): Add init_refcount.
- (struct elf_backend_data): Add can_refcount.
- * elf.c (_bfd_elf_link_hash_newfunc): Get rid of a few casts. Set
- got.refcount and plt.refcount from init_refcount.
- (_bfd_elf_link_hash_table_init): Set up init_refcount.
- (_bfd_elf_link_hash_copy_indirect): Reference got/plt.refcount
- rather than got/plt.offset, and test for <= 0 rather than -1.
- * elflink.h (size_dynamic_sections): Set init_refcount to -1.
- * elfxx-target.h (elf_backend_can_refcount): Define.
- (elfNN_bed): Init can_refcount.
- * linker.c (_bfd_link_hash_newfunc): Get rid of a few casts.
- (_bfd_generic_link_hash_newfunc): Likewise.
- * elf32-cris.c (cris_elf_check_relocs): Modify for refcounts
- starting from zero.
- (elf_backend_can_refcount): Define.
- * elf32-hppa.c (elf32_hppa_check_relocs): Modify for refcounts
- starting from zero.
- (elf32_hppa_copy_indirect_symbol): Make static to agree with
- prototype.
- (elf_backend_can_refcount): Define.
- * elf32-i386.c (elf_i386_check_relocs): Modify for refcounts
- starting from zero.
- (allocate_dynrelocs): Set plt/got.offset rather than *.refcount.
- (elf_i386_finish_dynamic_symbol): Expand SHN_UNDEF comment.
- (elf_i386_finish_dynamic_sections): Use local var so line < 80 chars.
- (elf_backend_can_refcount): Define.
- (elf_i386_copy_indirect_symbol): Make static to agree with
- prototype. Formatting fix.
- * elf32-m68k.c (elf_m68k_check_relocs): Modify for refcounts
- starting from zero.
- (elf_backend_can_refcount): Define.
- * elf32-ppc.c (ppc_elf_check_relocs): Modify for refcounts
- starting from zero.
- (elf_backend_can_refcount): Define.
- * elf32-s390.c (elf_s390_check_relocs): Modify for refcounts
- starting from zero.
- (elf_backend_can_refcount): Define.
- * elf64-s390.c (elf_s390_check_relocs): Modify for refcounts
- starting from zero.
- (elf_backend_can_refcount): Define.
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Modify for refcounts
- starting from zero.
- (elf_backend_can_refcount): Define.
-
- * som.c (som_write_symbol_strings): Cast current_offset in
- bfd_seek call to match param type.
-
-2001-09-28 J. Brobecker <brobecker@gnat.com>
-
- * som.c (som_write_symbol_strings): Fix incorrect type of
- current_offset to match the function definition. Fixes a build
- failure on HPUX-11.00.
-
-2001-09-28 Richard Henderson <rth@redhat.com>
-
- * elfxx-target.h [section_flags]: Add SEC_ARCH_BIT_0, SEC_SMALL_DATA,
- SEC_MERGE, SEC_STRINGS.
-
- * section.c (SEC_ARCH_BIT_0): New; replace unused SEC_BALIGN.
- * bfd-in2.h: Rebuild.
-
-2001-09-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-x86-64.c (elf64_x86_64_reloc_type_lookup): Don't map bfd
- reloc code using x86_64_reloc_map.
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Update comment since we
- no longer allocate here. Localise some vars to blocks where they
- are used.
- (elf32_hppa_adjust_dynamic_symbol): Correct a comment. Delay
- setting of vars until needed.
- (allocate_dynrelocs): Don't create a .plt entry without a reloc
- when symbol visibilty makes a function local.
- (elf32_hppa_finish_dynamic_symbol): Move expressions out of
- swap_reloca_out function calls.
- (elf32_hppa_relocate_section): Likewies. Comment typo fix.
- (elf32_hppa_finish_dynamic_sections): Migrate common code out of
- switch statement.
-
- * elf32-i386.c (elf_i386_check_relocs): Update comment since we
- no longer allocate here. Localise some vars to blocks where they
- are used. Remove separate switch stmt for creating .got sec.
- (elf_i386_adjust_dynamic_symbol): Correct a comment. Remove
- redundant casts and aborts. Delay setting of vars until needed.
- (allocate_dynrelocs): Remove redundant casts and aborts.
- (elf_i386_size_dynamic_sections): Move comment.
- (elf_i386_finish_dynamic_symbol): Move expressions out of function
- calls.
- (elf_i386_relocate_section): Likewise. Comment typo fix.
- (elf_i386_finish_dynamic_sections): Migrate common code out of
- switch statement.
- (elf_backend_* defines): Sort.
-
- * elf32-i386.c (allocate_dynrelocs): Don't create a .plt entry
- without a reloc when symbol visibilty makes a function local.
-
-2001-09-27 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix detection of
- conflicting float flags.
-
-2001-09-26 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386 (elf_i386_copy_indirect_symbol): New function.
- (elf_backend_copy_indirect_symbol): Define.
- (struct elf_i386_link_hash_entry): Rename "root" to "elf".
- (struct elf_i386_link_hash_table): Likewise.
- (link_hash_newfunc): Get rid of unnecessary casts.
- (elf_i386_link_hash_table_create): Likewise.
- (elf_i386_check_relocs): Initialise local_got_refcounts to 0.
- Don't test input section SEC_READONLY here to try to avoid copy
- relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
- (elf_i386_adjust_dynamic_symbol): Check output section SEC_READONLY
- here to properly test whether we need copy relocs. Do so for weak
- syms too.
-
- * elf32-hppa (elf32_hppa_copy_indirect_symbol): New function.
- (elf_backend_copy_indirect_symbol): Define.
- (struct elf32_hppa_link_hash_table): Rename "root" to "elf".
- (stub_hash_newfunc): Get rid of unnecessary casts.
- (hppa_link_hash_newfunc): Likewise.
- (elf32_hppa_check_relocs): Initialise local_got_refcounts to 0.
- Don't test input section SEC_READONLY here to try to avoid copy
- relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
- (elf32_hppa_adjust_dynamic_symbol): Check output section SEC_READONLY
- here to properly test whether we need copy relocs. Do so for weak
- syms too.
-
-2001-09-26 Alan Modra <amodra@bigpond.net.au>
-
- * bfd.c (_bfd_default_error_handlerl): Define using VPARAMS,
- VA_OPEN, VA_FIXEDARG, VA_CLOSE.
- (bfd_archive_filename): Cast bfd_malloc arg to the correct size.
-
-2001-09-25 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c (sparc64_elf_build_plt): Fix .plt[32768+] slot
- computation.
-
-2001-09-25 H.J. Lu <hjl@gnu.org>
-
- * bfd-in2.h: Regenerated.
-
-2001-09-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c: Add comment re linker function names and ordering.
- (elf_i386_link_hash_newfunc): Rename to link_hash_newfunc.
- (elf_i386_grok_prstatus): Move before linker functions.
- (elf_i386_grok_psinfo): Likewise.
- (elf_i386_fake_sections): Move so that functions are ordered.
- (elf_i386_reloc_type_class): Likewise. Comment function purpose.
-
-2001-09-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c: Rename occurrences of "hplink" to "htab"
- throughout file.
-
- * elf32-hppa.c: (LONG_BRANCH_PIC_IN_SHLIB): Delete. Remove all
- code handling this option.
- (LONG_BRANCH_VIA_PLT): Likewise.
- (RELATIVE_DYNRELOCS): Define as zero.
- (struct elf32_hppa_dyn_reloc_entry): Add "sec", and
- "pc_count" fields. Remove "section" field.
- (elf32_hppa_link_hash_entry): Rename reloc_entries to dyn_relocs.
- (elf32_hppa_check_relocs): Don't allocate space for dynamic
- relocs here. Instead, record all needed dynamic relocs via
- dyn_relocs and local_dynrel. Cache pointer to "sreloc" section
- in elf_section_data.
- (elf32_hppa_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
- (allocate_plt_and_got_and_discard_relocs): Rename to
- allocate_dynrelocs. Allocate rather than discarding dyn relocs.
- (readonly_dynrelocs): New function.
- (elf32_hppa_size_dynamic_sections): Mark output_bfd unused.
- Call readonly_dynrelocs to determine need for DT_TEXTREL.
- Rename "i" to "ibfd". Allocate space for local dyn relocs.
- (elf32_hppa_relocate_section): Make use of cached sreloc.
- (elf32_hppa_reloc_type_class): New function.
- (elf_backend_reloc_type_class): Define.
-
-2001-09-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct bfd_elf_section_data): Add "local_dynrel"
- and "sreloc" fields.
- * elf32-i386.c (struct elf_i386_dyn_relocs): Add "sec", and
- "pc_count" fields. Remove "section" field.
- (elf_i386_check_relocs): Don't set DF_TEXTREL here. Don't
- allocate space for dynamic relocs here. Instead, record all
- needed dynamic relocs via dyn_relocs and local_dynrel. Cache
- pointer to "sreloc" section in elf_section_data.
- (elf_i386_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
- (allocate_plt_and_got_and_discard_relocs): Rename to
- allocate_dynrelocs. Allocate rather than discarding dyn relocs.
- (readonly_dynrelocs): New function.
- (elf_i386_size_dynamic_sections): Call readonly_dynrelocs.
- Rename "i" to "ibfd". Allocate space for local dyn relocs.
- (elf_i386_relocate_section): Make use of cached sreloc.
-
-2001-09-24 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (elf_backend_reloc_type_class): Pass in the entire
- reloc rather than just the type.
- (_bfd_elf_reloc_type_class): Likewise.
- * elf.c (_bfd_elf_reloc_type_class): Likewise.
- * elf32-arm.h (elf32_arm_reloc_type_class): Likewise.
- * elf32-cris.c (elf_cris_reloc_type_class): Likewise.
- * elf32-i386.c (elf_i386_reloc_type_class): Likewise.
- * elf32-m68k.c (elf32_m68k_reloc_type_class): Likewise.
- * elf32-ppc.c (ppc_elf_reloc_type_class): Likewise.
- * elf32-s390.c (elf_s390_reloc_type_class): Likewise.
- * elf32-sh.c (sh_elf_reloc_type_class): Likewise.
- * elf32-sparc.c (elf32_sparc_reloc_type_class): Likewise.
- * elf64-alpha.c (elf64_alpha_reloc_type_class): Likewise.
- * elf64-s390.c (elf_s390_reloc_type_class): Likewise.
- * elf64-sparc.c (sparc64_elf_reloc_type_class): Likewise.
- * elf64-x86-64.c (elf64_x86_64_reloc_type_class): Likewise.
- * elfxx-ia64.c (elfNN_ia64_reloc_type_class): Likewise.
- * elflink.h: Formatting fixes.
- (elf_link_sort_relocs): Make "count" and "size" bfd_size_type.
- Call bfd_zmalloc rather than calloc. Remove unnecessary cast of
- o->contents to PTR. Update call to elf_backend_reloc_type_class.
-
-2001-09-22 John Reiser <jreiser@BitWagon.com>
-
- * elfcode.h (elf_object_p): Allow for no section header at all in
- non-ET_REL files. Honor 0 for e_shnum, e_shstrndx, e_shoff.
-
-2001-09-21 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elfxx-ia64.c: Fix compile time warning messages.
- * coff-mcore.c: Fix compile time warning messages.
- * coff-ppc.c: Fix compile time warning messages.
- * coffcode.h: Fix compile time warning messages.
- * elf32-mips.c: Fix compile time warning messages.
- * elf64-alpha.c: Fix compile time warning messages.
- * libbfd.c: Fix compile time warning messages.
- * bfd-in2.h: Regenerate.
-
-2001-09-21 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
-
- * aoutx.h: Formatting fixes.
- * merge.c (_bfd_merged_section_offset): Break line at 80 chars.
-
- * linker.c: Replace bfd_get_filename with bfd_archive_filename
- in error message.
-
-2001-09-21 Alan Modra <amodra@bigpond.net.au>
-
- * bfd.c (bfd_archive_filename): New function.
- * bfd-in2.h: Regenerate.
- * aout-adobe.c: Replace bfd_get_filename with bfd_archive_filename
- in error messages where the bfd is an input bfd.
- * aout-cris.c: Likewise.
- * coff-arm.c: Likewise.
- * coff-mcore.c: Likewise.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * coff-sh.c: Likewise.
- * coff-tic54x.c: Likewise.
- * coff-tic80.c: Likewise.
- * coff64-rs6000.c: Likewise.
- * coffcode.h: Likewise.
- * coffgen.c: Likewise.
- * cofflink.c: Likewise.
- * ecofflink.c: Likewise.
- * elf-hppa.h: Likewise.
- * elf.c: Likewise.
- * elf32-arm.h: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-gen.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-m32r.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-mips.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sparc.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-gen.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * elflink.h: Likewise.
- * elfxx-ia64.c: Likewise.
- * ieee.c: Likewise.
- * ihex.c: Likewise.
- * libbfd.c: Likewise.
- * pdp11.c: Likewise.
- * pe-mips.c: Likewise.
- * peicode.h: Likewise.
- * srec.c: Likewise.
- * xcofflink.c: Likewise.
-
- * elf32-arm.h: Make _bfd_error_handler calls K&R compatible.
-
- * elflink.c (_bfd_elf_create_linker_section): Better grammar for
- error message.
-
- * coff-mcore.c (coff_mcore_relocate_section): Internalionalise
- error message.
-
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Constify stt_types.
- Consolidate error messages, and split long messages to two lines.
-
-2001-09-20 John Reiser <jreiser@BitWagon.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Coordinate info->symbolic
- and info->allow_shlib_undefined.
- * elf32-cris.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mips.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sparc.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-hppa.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * elfxx-ia64.c: Likewise.
-
-2001-09-18 Bruno Haible <haible@clisp.cons.org>
-
- * aoutx.h: Include "safe-ctype.h" instead of <ctype.h>.
- (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
- * archive.c: Include "safe-ctype.h" instead of <ctype.h>.
- (_bfd_generic_read_ar_hdr_mag): Use ISDIGIT instead of isdigit.
- * archures.c: Include "safe-ctype.h" instead of <ctype.h>.
- (bfd_default_scan): Use ISDIGIT instead of isdigit.
- * bfd.c: Include "safe-ctype.h" instead of <ctype.h>.
- (bfd_scan_vma): Use ISXDIGIT/ISDIGIT/ISLOWER instead of
- isxdigit/isdigit/islower.
- * binary.c: Include "safe-ctype.h" instead of <ctype.h>.
- (mangle_name): Use ISALNUM instead of isalnum.
- * cpu-v850.c: Include "safe-ctype.h" instead of <ctype.h>.
- (scan): Use ISDIGIT instead of isdigit.
- * hosts/alphavms.h: Don't include <ctype.h>.
- * ieee.c: Include "safe-ctype.h" instead of <ctype.h>.
- (ieee_object_p): Use TOUPPER instead of toupper.
- * ihex.c: Include "safe-ctype.h" instead of <ctype.h>.
- (ihex_bad_byte): Use ISPRINT instead of isprint.
- * merge.c: Don't include <ctype.h>.
- * oasys.c: Include "safe-ctype.h" instead of <ctype.h>.
- (oasys_write_sections): Use ISDIGIT instead of isdigit.
- * pdp11.c: Include "safe-ctype.h" instead of <ctype.h>.
- (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
- * ppcboot.c: Include "safe-ctype.h" instead of <ctype.h>.
- (mangle_name): Use ISALNUM instead of isalnum.
- * som.c: Include "safe-ctype.h" instead of <ctype.h>.
- (som_set_reloc_info): Use ISUPPER/ISLOWER/ISDIGIT instead of
- isupper/islower/isdigit.
- (som_decode_symclass): Use TOUPPER instead of toupper.
- * srec.c: Include "safe-ctype.h" instead of <ctype.h>.
- (srec_bad_byte): Use ISPRINT instead of isprint.
- (srec_scan): Use ISSPACE instead of isspace.
- * stabs.c: Include "safe-ctype.h" instead of <ctype.h>.
- (_bfd_link_section_stabs): Use ISDIGIT instead of isdigit.
- * syms.c: Include "safe-ctype.h"
- (islower, toupper): Remove macro definitions.
- (bfd_decode_symclass): Use TOUPPER instead of toupper.
- * vms-gsd.c: Don't include <ctype.h>.
- * vms-hdr.c: Include "safe-ctype.h" instead of <ctype.h>.
- (_bfd_vms_write_hdr): Use ISLOWER/TOUPPER instead of
- islower/toupper.
- * vms-tir.c: Don't include <ctype.h>.
-
-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.
-
-2001-09-17 H.J. Lu <hjl@gnu.org>
-
- * dwarf1.c (parse_die): Take a new arg for the end of the
- section. Return false if die is beyond the section.
- (parse_functions_in_unit): Pass the end of the section to
- parse_die ().
- (_bfd_dwarf1_find_nearest_line): Likewise.
-
-2001-09-14 Michael Rauch <mrauch@netbsd.org>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Treat R_SPARC_UA32
- just like R_SPARC_32.
-
-2001-09-14 Kevin Lo <kevlo@openbsd.org>
-
- * configure.bfd: Add arm-openbsd target.
-
-2001-09-14 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * config.bfd: Change machine triplets from mips*el*-* to mips*el-*.
- Add support for mips64.
-
-2001-09-13 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-openrisc.c (ELF_MACHINE_ALT1): Define as EM_OPENRISC_OLD.
-
-2001-09-12 Alexandre Oliva <aoliva@redhat.com>
-
- * elf.c (prep_headers): Get the machine code from the elf
- backend data.
- * elf-m10200.c (ELF_MACHINE_CODE): Redefine to EM_MN10200.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10200.
- * elf-m10300.c (ELF_MACHINE_CODE): Redefine to EM_MN10300.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300.
- * elf-arc.c (arc_elf_final_write_processing): Don't override
- e_machine, it's now properly set in prep_headers.
- * elf32-avr.c (elf32_avr_object_p): Accept both EM_AVR and
- EM_AVR_OLD.
- (ELF_MACHINE_ALT1): Define to EM_AVR_OLD.
- * elf-d10v.c (ELF_MACHINE_CODE): Redefine to EM_D10V.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D10V.
- * elf-d30v.c (ELF_MACHINE_CODE): Redefine to EM_D30V.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D30V.
- * elf-fr30.c (ELF_MACHINE_CODE): Redefine to EM_FR30.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_FR30.
- * elf-m32r.c (ELF_MACHINE_CODE): Redefine to EM_M32R.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_M32R.
- * elf32-pj.c (ELF_MACHINE_ALT1): DEfine to EM_PJ_OLD.
- * elf-v850.c (ELF_MACHINE_CODE): Redefine to EM_V850.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_V850.
-
-2001-09-11 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_section_flags): New.
- (elf64_alpha_fake_sections): Map SEC_SMALL_DATA to SHF_ALPHA_GPREL.
-
-2001-09-11 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Do not
- apply HINT relocations against dynamic symbols.
-
-2001-09-11 H.J. Lu <hjl@gnu.org>
-
- * linker.c (link_action): Change COMMON_ROW\defw from CREF to COM.
-
-2001-09-09 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c: Delete all unused ERIC_neverdef and rth_notdef code.
-
- * elf64-alpha.c (elf64_alpha_relax_with_lituse): Nop out gpdisp
- following a call to a near function.
-
-2001-09-08 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Soft fail
- relocation errors. Fail gp-relative relocations against
- dynamic symbols.
-
-2001-09-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_relocate_section): Check !DEF_REGULAR
- as well as DEF_DYNAMIC in test for avoided copy relocs.
- (allocate_plt_and_got_and_discard_relocs): Likewise.
- * elf32-hppa.c (elf_i386_relocate_section): Likewise.
- (allocate_plt_and_got_and_discard_relocs): Likewise.
-
-2001-09-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Fix overflow handling
- of R_MIPS_PC16.
-
-2001-09-06 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf64-mips.c (mips_elf64_howto_table_rel): Fix relocation HOWTO
- definitions.
- (mips_elf64_howto_table_rel): Likewise.
-
-2001-09-05 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (bfd_xcoff_import_symbol): Handle import file XMC_XO
- and syscall symbols.
- (write_global_symbol) : Same.
- (bfd_xcoff_export_symbol): Remove unused syscall param.
- * libxcoff.h: Change prototype of bfd_xcoff_export symbol and
- bfd_xcoff_import_symbol.
- * bfd-in.h: Same.
- * bfd-in2.h : Regenerate.
-
-2001-09-04 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (SKIP_HOWTO): New.
- (elf64_alpha_howto_table): Use it to remove dead ECOFF relocs.
- Fix sizes of 16-bit mem format relocs.
- (elf64_alpha_reloc_map): Update to match.
- (elf64_alpha_relax_with_lituse): Use GPREL16 as appropriate.
- (elf64_alpha_relax_without_lituse): Likewise.
- (elf64_alpha_check_relocs): Handle GPREL16.
- (elf64_alpha_relocate_section): Likewise.
- * reloc.c (BFD_RELOC_ALPHA_USER_*): Remove.
- (BFD_RELOC_ALPHA_GPREL_HI16, BFD_RELOC_ALPHA_GPREL_LO16): New.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-2001-09-04 Jeff Law <law@redhat.com>
-
- * elf32-h8300.c (elf32_h8_relax_section): New function.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- (bfd_elf32_bfd_relax_section): Define.
- (bfd_elf32_bfd_get_relocated_section_contents): Likewise.
-
- * elf32-h8300.c (special): New function.
- (h8_elf_howto_table): Use it for SPECIAL_FUNCTION field in
- all relocations.
- (elf32_h8_final_link_relocate): Treat R_H8_DIR24A8 like 32bit
- relocations. Fix problems with the true 24bit reloc R_H8_DIR24R8.
- Fix minor problems with 8bit and 16bit PC relative relocations.
-
-2001-09-01 Andreas Jaeger <aj@suse.de>
-
- * vms-tir.c: Add missing prototypes.
- * vms-hdr.c: Likewise.
- * vms-gsd.c: Likewise.
- * vms-misc.c: Likewise.
-
-2001-08-31 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_check_relocs): Report filename
- with bad relocation.
-
-2001-08-31 Eric Christopher <echristo@redhat.com>
- Jason Eckhardt <jle@redhat.com>
-
- * archures.c: Add mipsisa32 and mipsisa64. Remove mips32,
- mips32_4k and mips64.
- * aoutx.h: Remove bfd_mach_mips32, bfd_mach_mips32_4k,
- bfd_mach_mips64. Add bfd_mach_mipsisa32, bfd_mach_mipsisa64.
- * cpu-mips.c: Ditto.
- * elf32-mips.c (_bfd_mips_elf_final_write_processing): Ditto.
- * bfd-in2.h: Regenerate.
-
-2001-08-31 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Duplicate memory
- value into R_ALPHA_RELATIVE's addend.
- (elf64_alpha_finish_dynamic_symbol): Likewise.
-
-2001-08-31 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_relocate_section): Do not rightshift
- recomputed addend during relocatable link if not USE_REL.
-
- * elflink.h (elf_gc_propagate_vtable_entries_used): Fix off-by-one
- error.
-
-2001-08-30 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Revert the last
- 2 changes.
- (_bfd_mips_elf_adjust_dynamic_symbol): Allocate dynamic
- relocations for weak definitions.
-
-2001-08-30 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-h8300.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-h8300.c.
- * Makefile.in: Rebuild.
-
-2001-08-30 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Don't create
- dynamic relocation for undefined weak symbols when creating
- executables. Check h->root.root.type, instead of h->root.type.
-
-2001-08-29 Joel Sherrill <joel@OARcorp.com>
-
- * config.bfd (i[3456]86-*-rtems*, m68*-*-rtems*): Change
- default from coff to elf.
-
-2001-08-29 Jeff Law <law@redhat.com>
-
- * elf32-h8300.c (h8_elf_howto_table): Add new PC relative
- relocations.
- (h8_reloc_map): Similarly.
- (elf32_h8_final_link_relocate): Remove incorrect overflow tests.
- Add support for PC relative relocations.
-
- * elf32-h8300.c: Put all prototypes together.
- (elf32_h8_info_to_howto): Parameter elf_reloc is used.
- (elf32_h8_final_link_relocate): New function for linker.
- (elf32_h8_relocate_section): Similarly.
- (elf_backend_relocate_section): Define.
-
- * cpu-h8300.c (h8300_scan, compatible): Prototype.
- (h8300_scan): Handle architecture:machine encodings typically
- found in linker scripts.
- * elf.c (prep_headers): Do not try to do H8 machine recognition
- here.
- * elf32-h8300.c: Add some missing prototypes.
- (elf32_h8_mach, elf32_h8_final_write_processing): New functions.
- (elf32_h8_object_p): Similarly.
-
-2001-08-29 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Fix XTY_LD symbol that
- does not follow a XTY_SD.
-
-2001-08-29 Alan Modra <amodra@bigpond.net.au>
-
- * targmatch.sed: Delete case statements.
- * config.bfd <powerpc-*-aix* entry>: Select 64 bit xcoff for
- aix4.3 and above.
-
-2001-08-29 J"orn Rennecke <amylaar@redhat.com>
-
- * Makefile.am (elf32-h8300.lo): New target.
- * config.bfd (h8300*-*-elf): New case.
- * configure.in (bfd_elf32_h8300_vec): New case.
- * elf.c (prep_headers): Add case for bfd_arch_h8300.
- * reloc.c (BFD_RELOC_H8_DIR16A8): New relocation.
- (BFD_RELOC_H8_DIR16R8, BFD_RELOC_H8_DIR24A8): Likewise.
- (BFD_RELOC_H8_DIR24R8, BFD_RELOC_H8_DIR32A16): Likewise.
- * targets.c (bfd_target bfd_elf32_h8300_vec): New extern declaration.
- * elf32-h8300.c: New file.
- * Makefile.in, bfd-in2.h, libbfd.h, configure: Regenerated.
-
-2001-08-28 Nick Clifton <nickc@cambridge.redhat.com>
-
- * sparclynx.c: Add missing prototypes.
- * coff-mcore.c: Add missing prototypes.
- * elf32-pj.c: Add missing prototypes.
- * nlm32-sparc.c: Add missing prototypes.
- * oasys.c: Add missing prototypes.
- * pdp11.c: Add missing prototypes.
- * pe-mips.c: Add missing prototypes.
- * riscix.c: Add missing prototypes.
-
-2001-08-27 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-i386.c: Add missing prototypes.
- * elf32-ppc.c: Likewise.
- * elf32-sh-lin.c: Likewise.
- * elfarm-nabi.c: Likewise.
-
-2001-08-27 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-i386.c (elf_i386_grok_prstatus): New function.
- (elf_i386_grok_psinfo): New function.
- (elf_backend_grok_prstatus): Define.
- (elf_backend_grok_psinfo): Likewise.
- * elf32-ppc.c (ppc_elf_grok_prstatus): New function.
- (ppc_elf_grok_psinfo): New function.
- (elf_backend_grok_prstatus): Define.
- (elf_backend_grok_psinfo): Likewise.
- * elf32-sh-lin.c (elf32_shlin_grok_prstatus): New function.
- (elf32_shlin_grok_psinfo): New function.
- (elf_backend_grok_prstatus): Define.
- (elf_backend_grok_psinfo): Likewise.
- * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): New function.
- (elf32_arm_nabi_grok_psinfo): New function.
- (elf_backend_grok_prstatus): Define.
- (elf_backend_grok_psinfo): Likewise.
-
-2001-08-27 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (mips_elf_create_dynamic_relocation): Add more
- sanity check.
- (mips_elf_calculate_relocation): Create dynamic relocation for
- symbols with weak definition or the ELF_LINK_HASH_DEF_REGULAR
- bit is not set.
-
-2001-08-27 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_hide_symbol): Add prototype.
- (_bfd_mips_elf_copy_indirect_symbol): Likewise.
- (_bfd_elf32_mips_grok_prstatus): Likewise.
- (_bfd_elf32_mips_grok_psinfo): Likewise.
- (_bfd_mips_elf_hide_symbol): Make it static and cast to
- `struct mips_elf_link_hash_entry *'.
- (_bfd_mips_elf_copy_indirect_symbol): Make it static.
-
-2001-08-27 Nick Clifton <nickc@cambridge.redhat.com>
-
- * mipsbsd.c: Add missing prototypes.
- * hp300hpux.c: Add missing prototypes.
- * i386aout.c: Add missing prototypes.
- * i386lynx.c: Add missing prototypes.
- * i386mach3.c: Add missing prototypes.
- * i386msdos.c: Add missing prototypes.
- * i386os9k.c: Add missing prototypes.
-
-2001-08-27 Linus Nordberg <linus@swox.se>
- Torbjorn Granlund <tege@swox.com>
- Staffan Ulfberg <staffanu@swox.se>
- Alan Modra <amodra@bigpond.net.au>
-
- * config.bfd: Add powerpc64 target. Add powerpc64 vectors to
- targ64_selvecs for 32 bit powerpc targets.
- * Makefile.am (BFD64_BACKENDS): Add elf64-ppc.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-ppc.c.
- Run "make dep-am".
- * Makefile.in: Regenerate.
- * configure.in: Add elf64_powerpc vecs.
- * configure: Regenerate.
- * cpu-powerpc.c: Default to bfd_mach_ppc_620 entry for 64 bit.
- * elf.c (prep_headers): EM_PPC64 for 64 bit ppc elf target.
- * targets.c: Add bfd_elf64_powerpc_vec and bfd_elf64_powerpcle_vec.
- * elf64-ppc.c: New file.
- * reloc.c: Add powerpc64 relocs.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2001-08-27 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (elf32_m68k_check_relocs): Set DF_TEXTREL if the
- reloc is against read-only section.
- (elf32_m68k_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (elf32_m68k_reloc_type_class): New function.
- (elf_backend_reloc_type_class): Define.
-
-2001-08-27 Andreas Jaeger <aj@suse.de>
-
- * elf64-s390.c (elf_s390_check_relocs): Set DF_TEXTREL if the
- reloc is against read-only section.
- (elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (elf_s390_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
-
- * elf32-s390.c (elf_s390_check_relocs): Set DF_TEXTREL if the
- reloc is against read-only section.
- (elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (elf_s390_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
-
- * elf32-ppc.c (ppc_elf_check_relocs): Set DF_TEXTREL if the reloc
- is against read-only section.
- (ppc_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (ppc_elf_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
-
-2001-08-26 Andreas Jaeger <aj@suse.de>
-
- * elf32-cris.c (cris_elf_check_relocs): Set DF_TEXTREL if the
- reloc is against read-only section.
- (elf_cris_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (elf_cris_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
-
- * elf32-sh.c (sh_elf_check_relocs): Set DF_TEXTREL if the reloc is
- against read-only section.
- (elf_backend_reloc_type_class): Define.
- (sh_elf_reloc_type_class): New.
- (sh_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
-
- * elf32-arm.h (elf32_arm_check_relocs): Set DF_TEXTREL if the
- reloc is against read-only section.
- (elf32_arm_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (elf32_arm_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
-
-2001-08-25 Andreas Jaeger <aj@suse.de>
-
- * oasys.c: Add missing prototypes.
-
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Add unused
- attribute for parameter.
- * elf.c (_bfd_elf_reloc_type_class): Likewise.
-
- * versados.c (get_4): Make static.
- (get_10): Make static.
- Add missing prototypes.
- (process_esd): Fix call to versados_new_symbol.
-
-2001-08-25 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-a29k.c: Add missing prototypes.
- * coff-apollo.c: Add missing prototypes.
- * coff-arm.c: Add missing prototypes.
- * coff-i860.c: Add missing prototypes.
- * coff-rs6000.c: Add missing prototypes.
- * coff-tic80.c: Add missing prototypes.
- * elf-m10200.c: Add missing prototypes.
- * elf-m10300.c: Add missing prototypes.
- * elf32-arm.h: Add missing prototypes.
- * elf32-d10v.c: Add missing prototypes.
- * elf32-m32r.c: Add missing prototypes.
- * elf32-mcore.c: Add missing prototypes.
- * elf32-openrisc.c: Add missing prototypes.
- * elf32-sh.c: Add missing prototypes.
- * elf32-sparc.c: Add missing prototypes.
- * elf32-v850.c: Add missing prototypes.
- * elfarm-nabi.c: Add missing prototypes.
- * elfarm-oabi.c: Add missing prototypes.
-
-2001-08-25 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (elf_mips_abi_name): Return the right ABI string for
- E_MIPS_ABI_O64 and E_MIPS_ABI_EABI64
-
-2001-08-24 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_merge_sections): Fail if not using an ELF
- hash structure.
-
-2001-08-24 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf-bfd.h (elf_hash_table): Revert definition.
- (is_elf_hash_table): New macro.
- * elflink.h (elf_link_add_object_symbols): Test
- is_elf_hash_table before accessing ELF only fields in hash
- structure.
- (elf_link_create_dynamic_sections): Fail if not using an ELF
- hash structure.
- (elf_add_dynamic_entry): Fail if not using an ELF hash
- structure.
- (elf_link_record_local_dynamic_symbol): Fail if not using an
- ELF hash structure.
- (size_dynamic_sections): Fail if not using an ELF hash
- structure.
- (elf_adjust_dynamic_symbol): Fail if not using an ELF
- hash structure.
- (elf_bfd_final_link): Fail if not using an ELF hash
- structure.
-
-2001-08-24 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (elf_hash_table): Return NULL if the linker hash
- table is not an ELF linker hash table.
-
- * elf.c (_bfd_elf_link_hash_table_init): Set the linker hash
- table type to bfd_link_elf_hash_table.
-
- * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_create): Revert
- the last change.
-
- * linker.c (_bfd_link_hash_table_init): Set the linker hash
- table type to bfd_link_generic_hash_table.
-
-2001-08-24 Alexandre Oliva <aoliva@redhat.com>
-
- * bfd.c (bfd_alt_mach_code): New function.
- * bfd-in2.h: Rebuilt.
-
-2001-08-24 Alexandre Oliva <aoliva@redhat.com>
-
- * elf-m10300.c (mn10300_elf_relocate_section): Test the right
- `type' field in the hash entry when deciding whether to follow a
- link.
-
-2001-08-24 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_link_sort_cmp1): Sort RELATIVE relocs first, not
- last.
- (elf_link_sort_relocs): Adjust accordingly.
-
- * elf64-alpha.c (struct alpha_elf_link_hash_entry): Add reltext flag.
- (elf64_alpha_check_relocs): Set it if section this reloc is against
- is read-only. Set DF_TEXTREL if a RELATIVE reloc is needed against
- read-only section.
- (elf64_alpha_calc_dynrel_sizes): Set DF_TEXTREL flag if relocation
- is is against read-only section.
- (elf64_alpha_size_dynamic_sections): Use DF_TEXTREL flag, don't
- check section names.
- (elf64_alpha_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
-
-2001-08-24 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * linker.c (_bfd_generic_link_add_archive_symbols): Replace alloca()
- by bfd_malloc().
-
-2001-08-23 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Set DF_TEXTREL if
- the reloc is against read-only section.
- (elf64_x86_64_size_dynamic_sections): Use DF_TEXTREL flag instead
- of looking up section names for DT_TEXTREL.
- (elf64_x86_64_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
-
-2001-08-23 H.J. Lu <hjl@gnu.org>
-
- * syms.c (bfd_print_symbol_vandf): Add abfd to arg.
- * bfd-in2.h (bfd_print_symbol_vandf): Regenerated.
-
- * aoutx.h (NAME(aout,print_symbol)): Pass abfd to
- bfd_print_symbol_vandf.
- * coffgen.c (coff_print_symbol): Likewise.
- * elf.c (bfd_elf_print_symbol): Likewise.
- * ieee.c (ieee_print_symbol): Likewise.
- * nlmcode.h (nlm_print_symbol): Likewise.
- * oasys.c (oasys_print_symbol): Likewise.
- * pdp11.c (NAME(aout,print_symbol)): Likewise.
- * som.c (som_print_symbol): Likewise.
- * srec.c (srec_print_symbol): Likewise.
- * tekhex.c (tekhex_print_symbol): Likewise.
- * versados.c (versados_print_symbol): Likewise.
- * vms.c (vms_print_symbol): Likewise.
-
- * elf.c (_bfd_elf_print_private_bfd_data): Replace fprintf_vma
- with bfd_fprintf_vma.
- (bfd_elf_print_symbol): Likewise.
- * syms.c (bfd_print_symbol_vandf): Likewise.
-
-2001-08-23 Nick Clifton <nickc@cambridge.redhat.com>
-
- * aoutf1.h (sunos_write_object_contents): Silence compile time
- warning.
- * libaout.h (N_SET_DYNAMIC): Silence compile time warning.
-
- * bout.c: Add missing function prototypes. Fix formatting.
- * coff-z8k.c: Add missing function prototypes. Fix formatting.
- * coff-w65.c: Add missing function prototypes. Fix formatting.
- * coff-h8500.c: Add missing function prototypes. Fix formatting.
- * coff-h8300.c: Add missing function prototypes. Fix formatting.
- * coff-tic54x.c: Add missing function prototypes. Fix formatting.
- * coff-tic30.c: Add missing function prototypes. Fix formatting.
- * coff-m68k.c: Add missing function prototypes. Fix formatting.
- * coff-rs6000.c: Add missing function prototypes. Fix formatting.
- * coff-sh.c: Add missing function prototypes. Fix formatting.
-
-2001-08-23 Jakub Jelinek <jakub@redhat.com>
-
- * elf-bfd.h (enum elf_reloc_type_class): New.
- (struct elf_backend_data): Add elf_backend_reloc_type_class.
- (_bfd_elf_reloc_type_class): New.
- * elfxx-target.h (elf_backend_reloc_type_class): Define.
- (elfNN_bed): Add elf_backend_reloc_type_class.
- * elf.c (_bfd_elf_reloc_type_class): New.
- * elf32-i386.c (elf_i386_check_relocs): Set DF_TEXTREL if the reloc
- is against read-only section.
- (elf_i386_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (elf_i386_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
- * elf32-sparc.c (elf32_sparc_check_relocs): Set DF_TEXTREL if the
- reloc is against read-only section.
- (elf32_sparc_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (elf32_sparc_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
- * elf64-sparc.c (sparc64_elf_check_relocs): Set DF_TEXTREL if the
- reloc is against read-only section.
- (sparc64_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
- looking up section names for DT_TEXTREL.
- (sparc64_elf_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
- * elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add reltext field.
- (elfNN_ia64_hash_table_create): Clear ia64_info.
- (get_reloc_section): Set DF_TEXTREL if the reloc is against read-only
- section.
- (elfNN_ia64_size_dynamic_sections): Use ia64_info->reltext flag
- instead of looking up section names for DT_TEXTREL.
- (elfNN_ia64_reloc_type_class): New.
- (elf_backend_reloc_type_class): Define.
- * elflink.h (size_dynamic_sections): Add spare DT_NULL tags.
- (struct elf_link_sort_rela): New.
- (elf_link_sort_cmp1, elf_link_sort_cmp2, elf_link_sort_relocs): New.
- (elf_bfd_final_link): Call elf_link_sort_relocs.
- Convert one spare DT_NULL into DT_RELCOUNT resp. DT_RELACOUNT if
- necessary.
-
-2001-08-23 Nick Clifton <nickc@cambridge.redhat.com>
-
- * configure.in (x86-bsdi): No corefile support.
- * configure: Regenerate.
-
-2001-08-22 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Add missing
- comma.
-
-2001-08-21 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coff-go32.c: Make DWARF2 sections use an alignment of 0. Set
- the alignment of dwarf2 linkonce sections to 0.
- * coff-sto32.c: Likewise.
-
-2001-08-20 Andreas Jaeger <aj@suse.de>
-
- * coff-sparc.c: Add missing prototypes.
- * elf32-s390.c: Likewise.
- * elf32-i960.c: Likewise.
- * aout-target.h: Likewise.
-
-2001-08-20 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (elf_obj_tdata): Add num_section_syms.
- (elf_num_section_syms): New for num_section_syms.
-
- * elf.c (elf_map_symbols): Set num_section_syms.
- (_bfd_elf_symbol_from_bfd_symbol): Check num_section_syms for
- the section symbol index.
-
-2001-08-20 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_create): Never
- select the generic has table creator. All elf backends need elf
- specific fields in the hash table.
-
-2001-08-20 Alan Modra <amodra@bigpond.net.au>
-
- * archive.c (offsetof): Remove define.
- * elf.c: Likewise.
- * oasys.c: Likewise
- * sysdep.h (offsetof): Define.
-
-2001-08-17 Alan Modra <amodra@bigpond.net.au>
-
- * bfd.c (bfd_get_gp_size): Return an unsigned int.
- (bfd_set_gp_size): Make param unsigned.
- * bfd-in2.h: Regenerate.
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Use elf_gp_size rather
- than calling bfd_get_gp_size.
- * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
- * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
-
-2001-08-17 Alan Modra <amodra@bigpond.net.au>
-
- * linker.c (default_fill_link_order): Handle four byte fill value.
-
-2001-08-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-sparc.c (sparc64_elf_output_arch_syms): Add missing
- prototype.
- * nlm32-alpha.c (nlm_alpha_write_external): Fix warning.
-
- * elf64-mips.c (UNUSED_RELOC): Define.
- (mips_elf64_howto_table_rel): Use it.
- (mips_elf64_howto_table_rela): Here too.
- (mips_elf64_write_relocs): Fix signed/unsigned warning.
-
- * coffcode.h (coff_write_object_contents): Add ATTRIBUTE_UNUSED to
- silence warning.
- * coffgen.c (coff_print_symbol): Fix warnings.
- (coff_find_nearest_line): Likewise.
- * cofflink.c (_bfd_coff_link_input_bfd): Likewise.
- * coff-alpha.c (alpha_convert_external_reloc): Likewise.
- * format.c (bfd_check_format_matches): Likewise.
- (bfd_set_format): Likewise.
- * coff-ia64.c: Add missing prototypes.
- * elf64-alpha.c (struct alpha_elf_link_hash_entry): Make addend
- signed to silence warnings.
- (elf64_alpha_relocate_section): Likewise.
- (elf64_alpha_find_reloc_at_ofs): Fix warnings.
- (elf64_alpha_add_symbol_hook): Likewise.
- (elf64_alpha_final_link): Likewise.
- (elf64_alpha_relax_section): Remove redundant assign to info.gotent.
- (elf64_alpha_merge_gots): Add ATTRIBUTE_UNUSED to unused args.
- (elf64_alpha_size_got_sections): Likewise.
- * elfxx-ia64.c: Add missing prototypes.
- (elfNN_ia64_relocate_section): Fix warning.
- (elfNN_ia64_unwind_entry_compare): Make params const.
-
-2001-08-17 Alan Modra <amodra@bigpond.net.au>
-
- * config.bfd (targ64_selvecs): New.
- <powerpc-*-aix* entry>: Use it here instead of ineffectual #ifdef.
-
- * bfd-in.h (BFD_VERSION): Remove wrong comment.
- (BFD_DEFAULT_TARGET_SIZE): New.
- (BFD_ARCH_SIZE): Comment.
- * configure.in (target_size): New. Set instead of target64 in
- selvecs case statement. Set target64 from it.
- (bfd_default_target_size): New. Set from taget_size. AC_SUBST.
- * bfd-in2.h: Regenerate.
- * configure: Regenerate.
-
-2001-08-17 Alan Modra <amodra@bigpond.net.au>
-
- * bfd.c (enum bfd_error): Add bfd_error_wrong_object_format.
- (bfd_errmsgs): Add corresponding message.
- * archive.c (bfd_generic_archive_p): Don't release bfd_ardata when
- finding an archive that contains different format object files.
- Return bfd_error_wrong_object_format for this case.
- * format.c: Formatting fixes. s/CONST/const/.
- (bfd_check_format_matches): Accept archives that give
- bfd_error_wrong_object_format if no full match is found. Tidy
- code handling matching_vector. Don't return a pointer to freed
- memory in `matching'. Handle ambiguous matches as for partial
- archive matches.
- * bfd-in2.h: Regenerate.
-
-2001-08-15 Alan Modra <amodra@bigpond.net.au>
-
- * libieee.h (common_header_type): Add last_byte field.
-
- * ieee.c: Add missing prototypes. Some format fixes.
- (struct output_buffer_struct): Move for availability to prototypes.
- (ieee_part_after): New function.
- (ieee_slurp_debug): Use it here.
- (ieee_seek): Pass in ieee_data_struct rather than bfd. Use
- ieee_part_after to set last_byte to one past end of current part.
- Update callers.
- (ieee_pos): Pass in ieee_data_struct rather than bfd.
- Update callers.
- (parse_expression): Don't go beyond the end of the current part.
- (ieee_slurp_external_symbols): Correct type passed to read_2bytes.
- (ieee_get_symtab_upper_bound, ieee_get_symtab,
- ieee_get_symbol_info, ieee_print_symbol, ieee_new_section_hook,
- ieee_get_reloc_upper_bound, ieee_canonicalize_reloc, block,
- ieee_set_section_contents, ieee_write_object_contents,
- ieee_make_empty_symbol): Make static.
- (ieee_archive_p): Correct comments regarding bfd_read.
- (ieee_object_p): Similarly.
- (ieee_mkobject): Move it. Clear output_ptr_start, output_ptr,
- output_ptr_end, input_ptr_start, input_ptr, input_ptr_end,
- input_bfd, output_bfd, output_buffer.
- (do_as_repeat): Write out ieee_set_current_pc_enum value as for
- do_with_relocs, ie. as a symbol for relocatable files.
- (ieee_vec): Add comments showing functions referenced by macros.
-
-2001-08-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * aout-tic30.c: Add missing prototypes. Fix formatting.
- * aout-ns32k.c: Add missing prototypes. Fix formatting.
- * peXXigen.c: Add missining prototypes. Fix formatting.
- * aout-adobe.c: Add missining prototypes. Fix formatting.
-
-2001-08-13 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-v850.c: Add missing function prototypes.
- Fix some formatting.
-
- * cpu-v850.c: Add missing function prototype.
- Fix some formatting.
-
-2001-08-11 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf-bfd.h (struct elf_backend_data): Add new fields
- 'elf_backend_sprintf_vma' and 'elf_backend_fprintf_vma'.
- (bfd_elf_sprintf_vma): Rename function prototype to
- '_bfd_elf_sprintf_vma'.
- (bfd_elf_fprintf_vma): Rename function prototype to
- '_bfd_elf_fprintf_vma'.
- * bfd.c (bfd_sprintf_vma): Do not invoke bfd_elf_sprintf_vma
- directly, instead indirect via the elf_backend_data structure.
- (bfd_fprintf_vma): Do not invoke bfd_elf_fprintf_vma directly,
- instead indirect via the elf_backend_data structure.
- * elf.c (bfd_elf_sprintf_vma): Rename to _bfd_elf_sprintf_vma.
- (bfd_elf_fprintf_vma): Rename to _bfd_elf_fprintf_vma.
- * elfxx-target.h (elf_backend_sprintf_vma): Initialise if not
- already defined.
- (elf_backend_fprintf_vma): Initialise if not already defined.
- (struct elf_backend_data): Initialise the
- elf_backend_sprintf_vma and elf_backend_fprintf_vma fields.
-
-2001-08-10 Andreas Jaeger <aj@suse.de>
-
- * elf64-sparc.c: Add missing prototypes.
- * elf32-cris.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf64-hppa.c: Likewise.
- * elf64-s390.c: Likewise.
-
-2001-08-10 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_elf_object_p): Make static.
- Add prototypes where needed.
-
-2001-08-10 H.J. Lu <hjl@gnu.org>
-
- * bfd.c (bfd_sprintf_vma): Fix a typo in the last change.
- (bfd_fprintf_vma): Likewise.
-
-2001-08-10 H.J. Lu <hjl@gnu.org>
-
- * bfd.c (bfd_sprintf_vma): Don't return void.
- (bfd_fprintf_vma): Likewise.
-
-2001-08-10 Andreas Jaeger <aj@suse.de>
-
- * configure.in: Add -Wstrict-prototypes and -Wmissing-prototypes
- to build warnings.
- * configure: Regenerate.
-
-2001-08-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (bfd_elf_sprintf_vma): Add ATTRIBUTE_UNUSED to quiet
- warning if not BFD64. Add braces so emacs auto format works.
- (bfd_elf_fprintf_vma): Likewise.
-
- * libxcoff.h (struct xcoff_backend_data_rec): Constify src param
- of _xcoff_swap_ld*.
- * coff-rs6000.c (xcoff_swap_ldhdr_in): Modify type of external
- param to agree with libxcoff.h.
- (xcoff_swap_ldhdr_out): Likewise.
- (xcoff_swap_ldsym_in): Likewise.
- (xcoff_swap_ldsym_out): Likewise.
- (xcoff_swap_ldrel_in): Likewise.
- (xcoff_swap_ldrel_out): Likewise.
- (xcoff_create_csect_from_smclas): Likewise.
- * coff64-rs6000.c: Add missing prototypes.
- (xcoff64_swap_ldhdr_in): Modify type of external param to agree
- with libxcoff.h.
- (xcoff64_swap_ldhdr_out): Likewise.
- (xcoff64_swap_ldsym_in): Likewise.
- (xcoff64_swap_ldsym_out): Likewise.
- (xcoff64_swap_ldrel_in): Likewise.
- (xcoff64_swap_ldrel_out): Likewise.
- (xcoff64_ppc_relocate_section): Make static.
- (xcoff64_slurp_armap): Likewise.
- (xcoff64_archive_p): Likewise.
- (xcoff64_openr_next_archived_file): Likewise.
- (xcoff64_sizeof_headers): Likewise.
- (xcoff64_is_lineno_count_overflow): Likewise.
- (xcoff64_is_reloc_count_overflow): Likewise.
- (xcoff64_loader_symbol_offset): Likewise.
- (xcoff64_loader_reloc_offset): Likewise.
- * elf64-gen.c: Add missing prototypes.
-
-2001-08-09 H.J. Lu <hjl@gnu.org>
-
- * elf.c (bfd_elf_sprintf_vma): Check ELFCLASS64 only in BFD64.
- (bfd_elf_fprintf_vma): Likewise.
-
-2001-08-09 H.J. Lu <hjl@gnu.org>
-
- * bfd-in.h (bfd_elf_sprintf_vma, bfd_elf_fprintf_vma): Moved
- to ...
- * elf-bfd.h: Here.
- * bfd-in2.h: Regenerated.
-
-2001-08-09 H.J. Lu <hjl@gnu.org>
-
- * bfd-in.h (bfd_sprintf_vma): New prototype.
- (bfd_fprintf_vma): Likewise.
- (bfd_elf_sprintf_vma): Likewise.
- (bfd_elf_fprintf_vma): Likewise.
- (bfd_printf_vma): New. Defined with bfd_fprintf_vma.
- * bfd-in2.h: Regenerated.
-
- * bfd.c (bfd_sprintf_vma): New. Defined.
- (bfd_fprintf_vma): Likewise.
-
- * elf.c (bfd_elf_sprintf_vma): New. Defined.
- (bfd_elf_fprintf_vma): Likewise.
-
-2001-08-09 Alan Modra <amodra@bigpond.net.au>
-
- * coff-rs6000.c: Add missing prototypes.
- (xcoff_ppc_relocate_section, xcoff_is_lineno_count_overflow,
- xcoff_is_reloc_count_overflow, xcoff_loader_symbol_offset,
- xcoff_loader_reloc_offset): Make static.
- * dwarf1.c: Add missing prototypes.
- * dwarf2.c: Add missing prototypes.
- (struct abbrev_info): Move definition.
- (struct attr_abbrev, ABBREV_HASH_SIZE, ATTR_ALLOC_CHUNK): Likewise.
- * elf.c: Add missing prototypes.
- * elf32-gen.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-ppc.c: Likewise.
- (ppc_elf_sort_rela): Use PTR instead of "void *".
- * elflink.h: Add missing prototypes. Formatting fixes.
- * merge.c: Add missing prototypes.
- (last4_eq): Use PTR instead of "void *".
- (last_eq): Likewise.
- * syms.c: Add missing prototypes.
-
-2001-08-09 Nick Clifton <nickc@cambridge.redhat.com>
-
- * bfd.c: Fix formatting.
- * bfd-in2.h: Regenerate.
-
-2001-08-09 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arc.c (R_ARC_B22_PCREL): Change 'partial_inplace' to
- true (this target uses REL relocations) and 'pcrel_offset' to
- false (the PC is implied, not stored in the offset).
-
-2001-08-08 Alan Modra <amodra@bigpond.net.au>
-
- 1999-10-19 Linus Nordberg <linus@swox.se>
- * elf-bfd.h (struct elf_backend_data): Add want_got_sym.
- * elfxx-target.h (elf_backend_want_got_sym): Define.
- (elfNN_bed): Add elf_backend_want_got_sym.
- * elflink.c (_bfd_elf_create_got_section): Define
- _GLOBAL_OFFSET_TABLE_ only if bed->want_got_sym.
-
-2001-08-08 Alexandre Oliva <aoliva@redhat.com>
-
- * dwarf2.c (struct dwarf2_debug): Add sec, sec_info_ptr and syms.
- (find_rela_addend): New function.
- (parse_comp_unit): Call it to find the abbrev offset addend.
- (_bfd_dwarf2_find_nearest_line): Initialize and maintain the new
- members of dwarf2_debug as debugging information is read.
-
-2001-08-07 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-sh.c (sh_coff_reloc_type_lookup): Provide for sh-coff
- targets as well as sh-pe.
-
-2001-08-03 Ben Harris <bjh21@netbsd.org>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Include offset of
- reloc from start of section when computing value for R_ARM_REL32
- reloc.
-
-2001-08-03 Alan Modra <amodra@bigpond.net.au>
-
- From H.J. Lu <hjl@gnu.org>
- * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Don't
- keep relocs for undefined syms if there are no dynamic sections in
- executable.
- * elf32-hppa.c (allocate_plt_and_got_and_discard_relocs): Likewise.
-
-2001-08-02 Paul Sokolovsky <paul.sokolovsky@technologist.com>
-
- * cofflink.c (coff_link_check_ar_symbols): also search for
- __imp__symbol as well as _symbol.
- * linker.c (_bfd_generic_link_add_archive_symbols): also
- search for __imp__symbol as well as _symbol.
-
-2001-08-01 Adam Nemet <anemet@lnxw.com>
-
- * elf.c (elf_sort_sections): Return zero only as the last step.
-
-2001-08-01 Nick Clifton <nickc@cambridge.redhat.com>
-
- * config.bfd (arm-vxworks): Change name of define from VXWORKS to
- ARM_COFF_BUGFIX.
- (arm-epoc-pe): Define ARM_COFF_BUGFIX.
- coff-arm.c (coff_arm_relocate_section): Replace VXWORKS with
- ARM_COFF_BUGFIX.
-
-2001-07-30 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * libecoff.h (_bfd_ecoff_styp_to_sec_flags): Changed return type
- to match corresponding bfd_coff_backend data member.
-
-2001-07-24 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Update dependencies with "make dep-am".
- * Makefile.in: Regenerate
-
-2001-07-15 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am (po/SRC-POTFILES.in): Use tmp.src instead of tmp.
- (po/BLD-POTFILES.in): Use tmp.bld instead of tmp.
- * Makefile.in: Regenerate.
-
-2001-07-11 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Set the ALLOC|LOAD
- flags when creating the reloc section if the ALLOC flag in the
- source section is set.
-
-2001-07-11 Steve Ellcey <sje@cup.hp.com>
-
- * reloc.c (bfd_reloc_code_type): Add IA64 relocs
- BFD_RELOC_IA64_LTOFF_FPTR32MSB and BFD_RELOC_IA64_LTOFF_FPTR32LSB
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * elfxx-ia64.c (ia64_howto_table): Define how to handle
- new relocations.
- (elfNN_ia64_reloc_type_lookup): Handle new relocations.
- (elfNN_ia64_check_relocs): Likewise.
- (elfNN_ia64_install_value): Likewise.
- (elfNN_ia64_relocate_section): Likewise.
-
-2001-07-11 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): Remove support for
- R_SPARC_UA64.
- (elf32_sparc_check_relocs): Likewise.
- Only create .rela section for alloced sections in shared libraries.
- (elf32_sparc_relocate_section): Likewise.
- Remove redundant check.
- Optimize unaligned reloc usage.
- * elf64-sparc.c (sparc64_elf_relocate_section): Remove redundant
- check.
-
-2001-07-11 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Only use the same
- ALLOC|LOAD flags as the source section for debugging sections
- when creating the reloc section.
-
-2001-07-05 Jim Wilson <wilson@redhat.com>
-
- * linker.c (_bfd_generic_link_add_one_symbol, case BIG): Use
- the section of the bigger symbol.
-
- * syms.c (bfd_is_local_label): Return false if BSF_SECTION_SYM.
-
-2001-07-05 Nick Clifton <nickc@cambridge.redhat.com>
-
- * peicode.h (coff_swap_scnhdr_in): For sections containing
- uninitialised data, only set their size to s_paddr if this does
- not reset their size to zero. MS's latest compilers will set
- s_paddr to zero.
-
-2001-07-04 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_final_write_processing):
- Handle bfd_mach_mips4400, bfd_mach_mips4600 and
- bfd_mach_mips5000.
-
-2001-07-03 Mark Elbrecht <snowball3@softhome.net>
-
- * bfd.c (bfd_get_sign_extend_vma): Support DJGPP COFF targets.
-
- * cofflink.c (_bfd_coff_link_input_bfd): Skip section symbols from
- sections being discarded.
-
-2001-06-30 Alan Modra <amodra@bigpond.net.au>
-
- * elfcore.h (elf_core_file_p): Call bfd_section_from_phdr directly
- instead of _bfd_elfcore_section_from_phdr.
- * elf-bfd.h (_bfd_elfcore_section_from_phdr): Remove.
- * elf.c (_bfd_elfcore_section_from_phdr): Remove.
- (_bfd_elfcore_make_pseudosection): Expedite tail-call.
- (elfcore_grok_prstatus): Likewise.
- (elfcore_grok_lwpstatus): Likewise.
- (bfd_get_elf_phdr_upper_bound): Likewise.
- (elfcore_make_note_pseudosection): Formatting.
- (_bfd_elfcore_strndup): Formatting.
- * elf32-mips.c (mips_elf_sym_is_global): Formatting.
- (_bfd_elf32_mips_grok_prstatus): Expedite tail-call.
-
-2001-06-29 Daniel Jacobowitz <drow@mvista.com>
-
- * elf-bfd.h: Add prototypes for _bfd_elfcore_make_pseudosection
- and _bfd_elfcore_strndup.
- (struct elf_backend_data): Add elf_backend_grok_prstatus
- and elf_backend_grok_psinfo.
- * elf.c (_bfd_elfcore_make_pseudosection): New function.
- (elfcore_grok_prstatus): Use it.
- (elfcore_make_note_pseudosection): Likewise.
- (elfcore_strndup): Rename to...
- (_bfd_elfcore_strndup): Here, and make global.
- (elfcore_grok_psinfo): Use _bfd_elfcore_strndup.
- (elfcore_grok_note): Call elf_backend_grok_prstatus
- and elf_backend_grok_psinfo if available.
- * elf32-mips.c (_bfd_elf32_mips_grok_prstatus): New function.
- (_bfd_elf32_mips_grok_psinfo): New function.
- (elf_backend_grok_prstatus): Define.
- (elf_backend_grok_psinfo): Define.
- * elfxx-target.h (elf_backend_grok_prstatus): Default to NULL.
- (elf_backend_grok_psinfo): Likewise.
- (elfNN_bed): Include elf_backend_grok_prstatus and
- elf_backend_grok_psinfo.
-
-2001-06-29 H.J. Lu <hjl@gnu.org>
-
- * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Check if
- hplink->sgot is NULL before filling GOT. Check if hplink->splt
- is NULL before filling PLT.
-
-2001-06-29 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_output_extsym): Revert 1999-04-10.
-
-2001-06-27 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Don't make syms dynamic
- here..
- (elf32_hppa_adjust_dynamic_symbol): ..nor here..
- (allocate_plt_and_got_and_discard_relocs): .. instead do so here
- after gc has run.
-
- * elf32-hppa.c (RELATIVE_DYNAMIC_RELOCS): Delete.
- (IS_ABSOLUTE_RELOC): Define.
- (elf32_hppa_link_hash_entry): Always include reloc_entries field.
- (hppa_link_hash_newfunc): Always init it.
- (elf32_hppa_check_relocs): Mark symbols as ELF_LINK_NON_GOT_REF to
- create COPY relocs only when the reloc is in a read-only section.
- Instead, allocate space for a dynamic reloc to reference the
- library symbol directly. Keep track of space we allocate using
- relocs_entries.
- (hppa_discard_copies): Delete, and move code to..
- (allocate_plt_and_got): ..here. Rename to
- allocate_plt_and_got_and_discard_relocs. Remove unneeded dynamic
- relocs for non-shared link.
- (elf32_hppa_size_dynamic_sections): Update calls to above.
- (elf32_hppa_relocate_section): Write out the dynamic relocs used
- in lieu of COPY relocs.
-
- * elf32-i386.c (elf_i386_check_relocs): Don't make syms dynamic
- here..
- (elf_i386_adjust_dynamic_symbol): ..nor here..
- (allocate_plt_and_got_and_discard_relocs): .. instead do so here
- after gc has run.
- (elf_i386_size_dynamic_sections): Fix a comment.
- (elf_i386_relocate_section <R_386_32, R_386_PC32>): Rearrange code
- involved in writing reloc out.
-
-2001-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_check_relocs <R_386_32, R_386_PC32>):
- Ensure syms are dynamic if we might be emitting a reloc.
- (allocate_plt_and_got_and_discard_relocs): Don't discard relocs
- for undefweak or undefined syms..
- (elf_i386_relocate_section <R_386_32, R_386_PC32>): .. and emit.
-
- * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Discard
- relocs without ELF_LINK_HASH_DEF_DYNAMIC set.
- (elf_i386_relocate_section <R_386_32, R_386_PC32>): Remove
- redundant bfd_link_hash_defined, bfd_link_hash_defweak test.
-
-2001-06-24 H.J. Lu <hjl@gnu.org>
-
- * cpu-i960.c (scan_960_mach): Don't modify const char *. Use
- strncasecmp/strcasecmp instead of strncmp/strcmp.
-
-2001-06-23 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_relocate_section <R_386_32, R_386_PC32>):
- Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined
- in the regular object file and treat the weak definition as
- the normal one.
-
-2001-06-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_relocate_section <R_386_GOT32>): Tighten
- unresolved_reloc test to exclude cases where we use "relocation"
- before setting it to point into the .got. Reinstate fudge for
- unresolved relocs in debugging sections.
-
- * elf32-i386.c (elf_i386_relocate_section): Replace ugly
- complicated tests for unresolvable relocs with a simple direct
- scheme using "unresolved_reloc" var.
-
- * elf32-i386.c (struct elf_i386_pcrel_relocs_copied): Rename to
- elf_i386_dyn_relocs. Update comment.
- (struct elf_i386_link_hash_entry): Rename pcrel_relocs_copied to
- dyn_relocs.
- (elf_i386_adjust_dynamic_symbol): Remove a BFD_ASSERT, change
- others to aborts.
- (allocate_plt_and_got_and_discard_relocs): Replace BFD_ASSERT with
- abort.
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_finish_dynamic_symbol): Likewise.
- (elf_i386_finish_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Likewise. Tidy R_386_GOT32 and error
- handling code.
-
- Avoid creating COPY relocs if possible.
- * elf32-i386.c (elf_i386_check_relocs): Tweak condition under
- which .got created. Mark symbols used by R_386_32 and R_386_PC32
- relocs as ELF_LINK_NON_GOT_REF to create COPY relocs only when the
- reloc is in a read-only section. Instead, allocate space for a
- dynamic reloc to reference the library symbol directly. Keep
- track of space we allocate using pcrel_relocs_copied.
- (discard_copies): Delete, and move code to ..
- (allocate_plt_and_got): ..here. Rename to
- allocate_plt_and_got_and_discard_relocs. Remove unneeded dynamic
- relocs for non-shared link.
- (elf_i386_size_dynamic_sections): Update calls to above functions.
- (elf_i386_relocate_section): Write out the dynamic relocs. Add
- more ugly logic to avoid "unresolvable relocation" error. Use
- htab shortcut in place of elf_hash_table macro.
- (elf_i386_finish_dynamic_sections): Allow that dynamic .got may
- not always be created now.
-
-2001-06-20 Bo Thorsen <bo@suse.co.uk>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix linking of
- shared libraries.
-
-2001-06-18 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * configure.host (mips64-*-linux): Reformat.
-
-2001-06-21 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Always
- allocate local .got space. Use shortcuts from hash table for .got
- and .plt rather than comparing section names.
- (elf32_hppa_check_relocs): Use local_plt_refcounts var rather than
- adjusting index into local_got_refcounts to document what we are
- really doing.
- (elf32_hppa_relocate_section): Similarly for local_plt_offsets.
- Tidy .got and .plt error checking.
-
-2001-06-20 Catherine Moore <clm@redhat.com>
-
- * elf-bfd.h (struct elf_backend_data):
- elf_backend_emit_relocs: New field: Function for emitting
- relocs.
- elf_backend_count_relocs: New field: Function for determining
- the number of relocs to be emitted.
- * elfxx-target.h: Provide default (NULL) values for
- elf_backend_emit_relocs and elf_backend_count_relocs.
- * elflink.h (elf_link_size_reloc_section): Make the hash table
- big enough to hold the relocs counted by either reloc_count or
- o->reloc_count.
- (elf_bfd_final_link) emit_relocs: New boolean, set if relocs
- should be emitted, either because of a command line option
- stored in the info structure or because the target provides a
- special reloc emitting function.
- If the target provides a reloc counting function use it,
- unless performing a relocatable link or emitting all relocs.
- Also set the SEC_RELOC flag on any output section which will
- contain relocs.
- (elf_link_input_bfd): emit_relocs: New boolean, set if relocs
- should be emitted, either because of a command line option
- stored in the info structure or because the target provides a
- special reloc emitting function.
- If the target provides a reloc emitting function, use it,
- unless performing a relocatable link or emitting all relocs.
-
-2001-06-20 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_size_dynamic_sections): Always
- allocate local .got space.
-
-2001-06-19 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix creation of
- dynamic symbols.
-
-2001-06-18 Hans-Peter Nilsson <hp@axis.com>
-
- * elflink.h (struct elf_assign_sym_version_info): Remove member
- export_dynamic. All users changed to use info member.
- NAME(bfd_elf,size_dynamic_sections)): Remove parameter
- export_dynamic, instead use member in parameter info.
- * bfd-in.h (bfd_elf32_size_dynamic_sections,
- bfd_elf64_size_dynamic_sections): Update prototype.
- * bfd-in2.h: Regenerate.
-
-2001-06-18 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_info_failed): Add a new field, verdefs.
- (NAME(bfd_elf,size_dynamic_sections): Pass verdefs to
- elf_export_symbol.
- (elf_export_symbol): Check eif->verdefs to decide if a symbol
- should be exported.
-
-2001-06-17 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (mips_elf_link_hash_entry): Add a new field,
- readonly_reloc, to record if a relocation in the .rel.dyn
- section is against a read-only section.
- (mips_elf_link_hash_newfunc): Initialize the readonly_reloc
- field to false.
- (_bfd_mips_elf_check_relocs): Record if there is a relocation
- in the .rel.dyn section against a read-only section by setting
- DF_TEXTREL or readonly_reloc.
- (_bfd_mips_elf_copy_indirect_symbol): Copy readonly_reloc if
- it is true.
- (_bfd_mips_elf_adjust_dynamic_symbol): Record DF_TEXTREL if
- there is a relocation in the .rel.dyn section against a
- read-only section.
- (_bfd_mips_elf_size_dynamic_sections): Set DT_TEXTREL if
- DF_TEXTREL is set.
-
-2001-06-12 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coffcode.h (styp_flags_to_sec_flags): Change to a boolean
- function. Move flagword result into parameter list. Remove
- comment about setting bfd_error_handler to intercept failure
- results.
- * coffgen.c (make_a_section_from_file): Examine result of
- calling bfd_coff_styp_to_sec_flags and pass a failure back to
- caller.
- * ecoff.h (styp_flags_to_sec_flags): Change to a boolean
- function. Move flagword result into parameter list.
- * libcoff.h: Regenerate.
- * libecoff.h: Regenerate.
-
-2001-06-13 Nick Clifton <nickc@cambridge.redhat.com>
-
- * aoutx.h (adjust_z_magic): Only pad the tesxt section if the data
- section is going to follow it.
-
-2001-06-12 Catherine Moore <clm@redhat.com>
-
- * elflink.h (elf_gc_propagate_vtable_entries): Replace FILE_ALIGN
- with the file_align entry from elf_backend_data.
- (elf_gc_smash_unused_vtentry_relocs): Likewise.
- (elf_gc_record_vtentry): Likewise.
-
-2001-06-10 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h: Whitespace changes.
- (elf_link_read_relocs_from_section): Use "unsigned int" iterator
- rather than "unsigned char".
- (elf_link_output_relocs): Likewise.
- (elf_link_input_bfd): Likewise.
- (elf_reloc_link_order): LIkewise.
- * elf.c: s/CONST/const/. Whitespace changes.
- * elf32-mips.c: Formatting fix.
-
- * Makefile.am (SOURCE_HFILES): Include xcoff-target.h, remove xcoff.h.
- * Makefile.in: Regenerate.
- * po/Make-in: Remove trailing tab.
-
-2001-06-09 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_plt0_entry): Correct error in last
- change.
- (elf32_arm_plt_entry): Likewise.
-
-2001-06-08 H.J. Lu <hjl@gnu.org>
-
- * elf.c (swap_out_syms): Keep names for global section symbols.
-
-2001-06-07 H.J. Lu <hjl@gnu.org>
-
- * config.bfd: Put back ecoff for Linux/mips. Firmwares on some
- MIPS-based machines need it.
-
-2001-06-07 H.J. Lu <hjl@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_object_p): Set the bad symtab
- for SGI only.
-
- * config.bfd: Remove ecoff from Linux/mips.
-
-2001-06-07 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Add an
- assertion.
- (elf64_x86_64_check_relocs): Fix VTENTRY relocation; set an
- alignment of 8 for .rela sections; handle further relocations.
-
-2001-06-06 Christian Groessler <cpg@aladdin.de>
-
- * coff-z8k.c: Fix formatting.
- Fix howtos: howto->size was always 1.
-
-2001-06-05 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * configure.host (mips64*-*-linux*): Define.
-
-2001-06-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_discard_copies): Rename to
- discard_copies, and use elf_link_hash_entry arg rather than
- elf_i386_link_hash_entry.
- (elf_i386_link_hash_traverse): Delete.
- (elf_i386_size_dynamic_sections): Adjust call to discard_copies.
- Tidy sizing of dynamic sections.
- (elf_i386_check_relocs <R_386_32, R_386_PC32>): Reference count
- possible .plt entries.
- (elf_i386_gc_sweep_hook): Likewise.
- (elf_i386_adjust_dynamic_symbol): Discard .plt entries for
- everything with plt.refcount <= 0.
-
- * elf32-i386.c (elf_i386_check_relocs): Don't allocate .got and
- .relgot space here.
- (elf_i386_gc_sweep_hook): ..and no need to deallocate here..
- (elf_i386_adjust_dynamic_symbol): ..and don't allocate .plt and
- .rel.plt here..
- (allocate_plt_and_got): ..instead do it all here. New function.
- (elf_i386_size_dynamic_sections): Allocate local .got space and
- call allocate_plt_and_got. No need to zap .relgot if not dynamic.
- (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link
- rather than gc variety).
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (elf_i386_relocate_section): Use it here and correct handling of
- R_386_GOT32. Provide section and offset for "unresolvable
- relocation" error message.
- (elf_i386_finish_dynamic_symbol): Correct handling of R_386_GOT32.
-
- * elf32-i386.c (struct elf_i386_link_hash_table): Add sgot,
- sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields.
- (elf_i386_link_hash_table_create): Init them.
- (create_got_section): New function.
- (elf_i386_create_dynamic_sections): New function.
- (elf_backend_create_dynamic_sections): Set to above.
- (elf_i386_check_relocs): Use shortcuts from hash table rather than
- calling bfd_get_section_by_name.
- (elf_i386_gc_sweep_hook): Likewise.
- (elf_i386_adjust_dynamic_symbol): Likewise.
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Likewise.
- (elf_i386_finish_dynamic_sections): Likewise.
-
- * elf32-hppa.c (allocate_plt_and_got): Skip indirect and warning syms.
-
-2001-06-02 H.J. Lu <hjl@gnu.org>
-
- * elf32-hppa.c (elf32_hppa_object_p): Check ELFOSABI_LINUX
- and ELFOSABI_HPUX.
- * elf64-hppa.c (elf64_hppa_object_p): Likewise.
-
-2001-06-02 H.J. Lu <hjl@gnu.org>
-
- * aout-cris.c (MACHTYPE_OK): New. Defined.
-
-2001-06-02 Hans-Peter Nilsson <hp@axis.com>
-
- * section.c (_bfd_strip_section_from_output): Handle NULL
- output_section.
-
-2001-06-02 H.J. Lu <hjl@gnu.org>
-
- * config.bfd (powerpc-*-aix*, powerpc-*-beos*, rs6000-*-*): Add
- rs6000coff64_vec only if BFD64 is defined.
- (powerpc64-*-aix*): Enable only if BFD64 is defined.
-
-2001-06-02 H.J. Lu <hjl@gnu.org>
-
- * coff-ia64.c (ia64coff_object_p): Rewrite with
- external_PEI_DOS_hdr and external_PEI_IMAGE_hdr.
-
-2001-06-01 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Add PC8
- relocation, small reformatting.
-
-2001-05-29 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Handle R_X86_64_64.
- (elf64_x86_64_relocate_section): Likewise.
-
-2001-05-30 Alan Modra <amodra@one.net.au>
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Don't NEED_PLT for
- millicode. Don't allocate .got and .rela.got space here..
- (elf32_hppa_gc_sweep_hook): ..and no need to deallocate here..
- (elf32_hppa_adjust_dynamic_symbol): ..and don't allocate .plt and
- .rela.plt here..
- (hppa_handle_PIC_calls): ..nor here..
- (allocate_plt_and_got): ..instead do it all here. New function.
- (elf32_hppa_size_dynamic_sections): Allocate local .got space and
- call allocate_plt_and_got. No need to zap .got if not dynamic.
- (elf32_hppa_final_link): Call regular bfd_final_link instead of
- gc_common_final_link.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (elf32_hppa_relocate_section): Use it here.
- (elf32_hppa_finish_dynamic_symbol): Remove superfluous test of
- dynamic_sections_created.
- (hppa_type_of_stub): Don't LONG_BRANCH_VIA_PLT if millicode sym.
-
-2001-05-28 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_86_64_size_info): Remove, we can use the
- generic version since we want a hashsize of 4.
- (elf_backend_size_info): Likewise.
-
-2001-05-28 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elflink.h (elf_link_size_reloc_section): Use bfd_zmalloc instead of
- a zeroing loop.
- (elf_link_output_relocs): Handle MIPS ELF64 relocations correctly.
- (elf_link_input_bfd): Likewise.
- (elf_reloc_link_order): Likewise.
- (elf_finish_pointer_linker_section): Typo. Handle MIPS ELF64
- relocations correctly.
-
-2001-05-28 Nicolas Pitre <nico@cam.org>
-
- * elf32-arm.h: fix PLT generation for big endian ARM
-
-2001-05-28 Alan Modra <amodra@one.net.au>
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Set up .plt entries
- for symbols forced local that need plabels.
- (elf32_hppa_adjust_dynamic_symbol): Don't allocate space in
- .plt.rela for local syms if non-shared.
- (hppa_build_one_stub): Mask lsb of plt.offset.
- (elf32_hppa_finish_dynamic_symbol): Abort if lsb of plt.offset set.
- (clobber_millicode_symbols): Correct comment.
- (elf32_hppa_relocate_section): Likewise.
- (elf32_hppa_finish_dynamic_symbol): Likewise.
-
-2001-05-28 Jeff Sturm <jsturm@one-point.com>
-
- * reloc.c: Add BFD_RELOC_SPARC_UA16 and BFD_RELOC_SPARC_UA64.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * elf32-sparc.c: Enable BFD_RELOC_SPARC_UA16, BFD_RELOC_SPARC_UA32
- and BFD_RELOC_SPARC_UA64 mapping
- * elf64-sparc.c: Likewise.
-
-2001-05-25 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am (BFD32_BACKENDS): Remove coff-pmac.lo.
- (BFD32_BACKENDS_CFILES): Remove coff-pmac.c.
- (coff-rs6000.lo): Remove the old dependency.
- * Makefile.in: Rebuild.
-
- * configure.in (pmac_xcoff_vec): Replace coff-pmac.lo with
- coff-rs6000.lo.
-
-2001-05-25 H.J. Lu <hjl@gnu.org>
-
- * coff-rs6000.c (rs6000coff_vec): Use rs6000coff_core_p,
- rs6000coff_core_file_matches_executable_p,
- rs6000coff_core_file_failing_command and
- rs6000coff_core_file_failing_signal only if AIX_CORE is
- defined.
- (pmac_xcoff_vec): Likewise.
- * coff64-rs6000.c (rs6000coff64_vec): Likewise.
-
-2001-05-25 Timothy Wall <twall@redhat.com>
-
- * elfxx-ia64.c (allocate_dynrel_entries): Don't allocate an entry
- for __GLOB_DATA_PTR on AIX5. Clean up some relocation bugs.
-
-2001-05-25 H.J. Lu <hjl@gnu.org>
-
- * bfd-in2.h: Regenerated.
- * libcoff.h: Likewise.
-
-2001-05-25 Alan Modra <amodra@one.net.au>
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Don't allow
- undefined millicode syms in shared libs.
- (hppa_build_one_stub): Turn BFD_ASSERTs into aborts.
- (elf32_hppa_check_relocs): Likewise.
- (elf32_hppa_adjust_dynamic_symbol): Likewise.
- (elf32_hppa_size_dynamic_sections): Likewise.
- (elf32_hppa_relocate_section): Likewise.
- (elf32_hppa_finish_dynamic_symbol): Likewise.
- (elf32_hppa_finish_dynamic_sections): Likewise.
-
-2001-05-24 Tom Rix <trix@redhat.com>
-
- * Makefile.am coff-pmac bfd now defined in coff-rs6000.c
- xcoff-target.h not used to define rs6000 or ppc bfd.
- * Makefile.in same
-
- * bfd-in.h : (struct lineno_cache_entry) promote element "offset"
- to 64 bit.
-
- * coff-rs6000.c : Many changes for 64 bit support. Move common
- 32/64 code to xcofflink.c. Explictly define the rs6000coff_vec
- and pmac_xcoff_vec
-
- * coff64-rs6000.c : Many changes for 64 bit support. 64 bit
- linker now supported. Explictly define the rs6000coff64_vec.
-
- * coffcode.h : (coff_set_arch_mach_hook) xcoff 64 bit support
- (coff_print_aux) same
- (coff_write_object_contents) same
- (coff_slurp_line_table) same
-
- * coffgen.c : (coff_fix_symbol_name) formatting
- (coff_mangle_symbols) xcoff 64 bit support
- (coff_write_symbol) same
- (coff_write_alien_symbol) same
- (coff_write_native_symbol) same
- (coff_write_symbols) same
- (coff_get_symbol_info) same
- (bfd_coff_get_syment) same
- (coff_print_symbol) same
-
- * config.bfd : add powerpc64-*-aix* target
-
- * libcoff-in.h : formatting
-
- * libcoff.h : move xcoff extern declarations to libxcoff.h
-
- * libxcoff.h : New file
-
- * xcofflink.c : Many changes for xcoff64 support. Move common
- structures to include/coff/xcoff.h. Move specific structure to
- backends coff-rs6000.c and coff64-rs6000.c. Use new backend
- functions, defined in libxcoff.h, to isolate 32/64 dependencies.
-
- (bfd_xcoff_size_dynamic_sections) : special __rtinit symbol for
- aix4.2+ -binitfini.
-
- (xcoff_build_ldsyms) : handle special __rtinit symbol.
-
-2001-05-23 Alexandre Oliva <aoliva@redhat.com>
-
- * elf64-sparc.c (sparc64_elf_slurp_reloc_table): Fix typo
- s/ENTIRES/ENTRIES/.
-
-2001-05-23 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * reloc.c (bfd_reloc_code_real): Add MIPS ELF64 relocations.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
- * aoutx.h (aout_@var{size}_machine_type): Add MIPS r12k support.
- * archures.c (bfd_mach_mips12000): Define.
- * cpu-mips.c (arch_info_struct): Add MIPS r12k support.
- * elf32-mips.c (_bfd_mips_elf_final_write_processing): Add MIPS r12k
- support.
- (_bfd_mips_elf_size_dynamic_sections): Use official bfd typedef.
- * bfd-in2.h: Regenerate.
- * elfxx-target.h: Do not redefine bfd_elfNN_bfd_make_debug_symbol.
-
-2001-05-23 kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (elf_sh_plt0_entry_be, elf_sh_plt0_entry,
- elf_sh_plt_entry_be, elf_sh_plt_entry, elf_sh_pic_plt_entry_be,
- elf_sh_pic_plt_entry): New PLT code, that does not use r2, since
- that is used by GCC.
-
-2001-05-23 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf-bfd.h (NUM_SHDR_ENTRIES): New macro: compute the number
- of entries in a structured section.
- * elf.c: Use new macro.
- * elf32-i386.c: Use new macro.
- * elf32-mips.c: Use new macro.
- * elf64-alpha.c: Use new macro.
- * elf64-sparc.c: Use new macro.
- * elfcode.h: Use new macro.
- * elflink.h: Use new macro.
-
-2001-05-23 Nick Clifton <nickc@cambridge.redhat.com>
-
- * bfdint.texi: Replace -oformat with --oformat.
-
-2001-05-21 Andreas Jaeger <aj@suse.de>
-
- * dwarf2.c (decode_line_info): Fix error message.
- (read_abbrevs): Fix test for offset as suggested by Alan Modra and
- adjust error message.
-
-2001-05-18 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Revert the last
- change.
-
-2001-05-17 Alan Modra <amodra@one.net.au>
-
- * elf32-hppa.c (clobber_millicode_symbols): Temporarily set
- ELF_LINK_FORCED_LOCAL to suit 2001-04-30 change.
- (hppa_build_one_stub): Add an assert to check plt.offset.
-
-2001-05-17 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the
- version definition to basename of the output filename.
-
-2001-05-17 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Set DT_NEEDED to
- basename of the bfd filename.
-
-2001-05-16 Alan Modra <amodra@one.net.au>
-
- * section.c (asection): Add linker_has_input field.
- (STD_SECTION): Adjust initialization to suit.
- * ecoff.c (bfd_debug_section): Likewise.
- * bfd-in2.h: Regenerate.
-
-2001-05-15 Alexandre Oliva <aoliva@redhat.com>
-
- * elf-m10300.c (mn10300_elf_relax_section): Don't relax
- negative 32-bit operands to 16 operands when the operand is
- going to be zero-extended by the modified opcode.
-
-2001-05-12 Peter Targett <peter.targett@arccores.com>
-
- * cpu-arc.c (arch_info_struct): Add entry 'base' representing old
- name for 'arc5' core versions.
- (bfd_arc_arch): Make bfd_mach_arc_6 default.
-
- * elf32-arc.c (arc_elf_object_p): Make E_ARC_MACH_ARC6 default
- architecture.
- (arc_elf_final_write_processing): Make bfd_mach_arc_6 default.
-
-2001-05-11 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c (is_unwind_section_name): Consider linkonce unwind
- sections as well.
- (elfNN_ia64_final_write_processing): Map .gnu.linkonce.ia64unw.FOO
- to .gnu.linkonce.t.FOO text section.
-
-2001-05-11 Jakub Jelinek <jakub@redhat.com>
-
- * merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix
- fields, change sec into secinfo.
- (struct sec_merge_info): Add chain, remove last fields.
- (struct sec_merge_sec_info): Add next, sec, psecinfo fields.
- (sec_merge_hash_lookup): If lookup could not use a string only
- because it has bad alignment, mark the old string for deletion.
- (sec_merge_add): Add secinfo argument. Don't compute entry's
- position, instead record the section.
- (sec_merge_emit): Update for the sec into secinfo change in
- struct sec_merge_hash_entry.
- (_bfd_merge_section): Only record the section for merging, defer
- putting strings into the hash table.
- (cmplengthentry, last4_eq, last_eq, record_section, merge_strings,
- _bfd_merge_sections): New functions.
- (_bfd_merged_section_offset): Update for the sec_merge_hash_entry
- changes.
- * libbfd-in.h (_bfd_merge_sections): Add prototype.
- (_bfd_nolink_bfd_merge_sections): Define.
- * libbfd.h: Likewise.
- (bfd_generic_merge_sections): Add prototype.
- * targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_merge_sections.
- (struct bfd_target): Likewise.
- * bfd.c (bfd_merge_sections): Define.
- * bfd-in2.h: Rebuilt.
- * elf.c (_bfd_elf_merge_sections): New function.
- * elf-bfd.h (_bfd_elf_merge_sections): Add prototype.
- * elfxx-target.h (bfd_elfNN_bfd_merge_sections): Define.
- * reloc.c (bfd_generic_merge_sections): New function.
- * vms.c (vms_bfd_merge_sections): New function.
- * aout-adobe.c (aout_32_bfd_merge_sections): Define.
- * aout-target.h (MY_bfd_merge_sections): Define.
- * aout-tic30.c (MY_bfd_merge_sections): Define.
- * binary.c (binary_bfd_merge_sections): Define.
- * bout.c (b_out_bfd_merge_sections): Define.
- * coff-alpha.c (_bfd_ecoff_bfd_merge_sections): Define.
- * coffcode.c (coff_bfd_merge_sections): Define.
- * coff-mips.c (_bfd_ecoff_bfd_merge_sections): Define.
- * i386msdos.c (msdos_bfd_merge_sections): Define.
- * i386os9k.c (os9k_bfd_merge_sections): Define.
- * ieee.c (ieee_bfd_merge_sections): Define.
- * ihex.c (ihex_bfd_merge_sections): Define.
- * nlm-target.h (nlm_bfd_merge_sections): Define.
- * oasys.c (oasys_bfd_merge_sections): Define.
- * ppcboot.c (ppcboot_bfd_merge_sections): Define.
- * som.c (som_bfd_merge_sections): Define.
- * srec.c (srec_bfd_merge_sections): Define.
- * tekhex.c (tekhex_bfd_merge_sections): Define.
- * versados.c (versados_bfd_merge_sections): Define.
- * xcoff-target.h (_bfd_xcoff_bfd_merge_sections): Define.
-
-2001-05-11 Nick Clifton <nickc@cambridge.redhat.com>
-
- * dwarf1.c (_bfd_dwarf1_find_nearest_line): Change type of 'addr'
- to be unsigned long, in order to match its use.
-
-2001-05-10 H.J. Lu <hjl@gnu.org>
-
- * linker.c (_bfd_generic_link_add_one_symbol): Check loop on
- indirect symbols.
-
-2001-05-09 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Fix a typo. Allocate
- versymhdr->sh_size bytes for extversym instead of hdr->sh_size.
- Remove the unused veriable `dynver'.
-
-2001-05-08 Ian Lance Taylor <ian@zembu.com>
-
- * coff-i386.c (coff_i386_reloc): Don't dump core if output_bfd is
- NULL or is not COFF.
- (coff_i386_rtype_to_howto): Don't dump core if output section
- owner is not COFF.
-
-2001-05-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * ecoff.c (bfd_debug_section): Fix initialization.
- * elf.c (_bfd_elf_slurp_version_tables): Change maxidx to unsigned, it
- is always a positive integer. Cast away sign mismatch.
- * elf32-mips.c: Fix misleading comment and typo.
- (_bfd_mips_elf_section_from_bfd_section): Remove unused attribute, use
- correct data type.
- * elflink.c: Fix typo.
- (_bfd_elf_create_dynamic_sections): Remove superfluous initialization.
- * ecoffswap.h (ecoff_swap_fdr_in): Cast away sign mismatch.
-
-2001-05-04 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (SREL16, SREL32, SREL64): Set pcrel_offset true.
-
-2001-05-04 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Set
- EF_ARM_HASENTRY if the start address is set.
-
-2001-05-03 Nick Clifton <nickc@cambridge.redhat.com>
-
- * targets.c (_bfd_target_vector_entries): Compute value based on
- the size of the _bfd_target_vector and not bfd_target_vector.
-
-2001-05-03 H.J. Lu <hjl@gnu.org>
-
- * elfcode.h: Include "libiberty.h".
-
- * elflink.h (elf_link_add_object_symbols): Set
- elf_dt_name (abfd) to basename of the bfd filename.
- (NAME(bfd_elf,size_dynamic_sections)): Set vn_file to basename
- of the bfd filename.
-
-2001-05-03 Andreas Jaeger <aj@suse.de>
-
- * elf64-gen.c (elf_generic_info_to_howto): Add unused attribute.
- (elf_generic_info_to_howto_rel): Likewise.
- * coff-alpha.c (reloc_nil): Likewise.
- (alpha_ecoff_bad_format_hook): Likewise.
- (alpha_adjust_reloc_out): Likewise.
- (alpha_bfd_reloc_type_lookup): Likewise.
- (alpha_convert_external_reloc): Likewise.
- * elf64-alpha.c (elf64_alpha_reloc_nil): Likewise.
- (elf64_alpha_reloc_bad): Likewise.
- (elf64_alpha_reloc_gpdisp): Likewise.
- (elf64_alpha_bfd_reloc_type_lookup): Likewise.
- (elf64_alpha_info_to_howto): Likewise.
- (elf64_alpha_add_symbol_hook): Likewise.
- (elf64_alpha_create_got_section): Likewise.
- (elf64_alpha_is_local_label_name): Likewise.
- (elf64_alpha_merge_ind_symbols): Likewise.
- * elf64-mips.c (mips_elf64_reloc_type_lookup): Likewise.
- (mips_elf64_get_reloc_upper_bound): Likewise.
- * nlm32-alpha.c (nlm_alpha_mangle_relocs): Likewise.
- (nlm_alpha_get_public_offset): Likewise.
-
-2001-05-02 Johan Rydberg <jrydberg@opencores.org>
-
- * elf32-openrisc.c (openrisc_elf_howto_table): Do not complain
- about overflow in R_OPENRISC_LO_16_IN_INSN and
- R_OPENRISC_HI_16_IN_INSN.
-
-2001-04-30 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_link_hash_hide_symbol): Set dynindx to -1
- only for ELF_LINK_FORCED_LOCAL.
- * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
- * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise.
- * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
-
- * elflink.h (elf_fix_symbol_flags): Set ELF_LINK_FORCED_LOCAL
- if the symbol has hidden or internal visibility.
-
-2001-04-30 Alan Modra <amodra@one.net.au>
-
- * elf32-hppa.c (final_link_relocate): Branch to .+8 for
- calls to undefined weak symbols.
-
-2001-04-30 Andreas Jaeger <aj@suse.de>, Andreas Schwab <schwab@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Correct test for
- R_X86_64_GOTPCREL, don't use assignments instead of comparisons.
-
-2001-04-27 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Only swap
- out handled entries.
- (elf64_x86_64_finish_dynamic_symbol): Set up GOT entries.
- (elf64_x86_64_relocate_section): Fix GOTPCREL calculation.
- (elf64_x86_64_relocate_section): Merge entries for GOTPCREL and
- GOT32.
-
-2001-04-27 Sean McNeil <sean@mcneil.com>
-
- * config.bfd: Add arm-vxworks target.
- * coff-arm (coff_arm_relocate_section): Add in symbol value to
- addend (fro VXworks targets).
-
-2001-04-26 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_check_relocs): Verify if r_symndx is
- valid.
-
-2001-04-25 Frank Ch. Eigler <fche@redhat.com>
-
- * bfd-in.h (bfd_cache_close): Declare newly exported function.
- * bfd-in2.h: Regenerated.
-
-2001-04-24 Jakub Jelinek <jakub@redhat.com>
-
- * merge.c (struct sec_merge_hash_entry): Add alignment field.
- (struct sec_merge_hash): Remove alignment_power.
- (sec_merge_hash_newfunc): Clear alignment.
- (sec_merge_hash_lookup): Pass alignment as argument.
- Use hashp->root.next, not hashp->next to walk the hash chain.
- If a string already in the hashtable does not have required
- alignment, create a new hashtable entry.
- (sec_merge_init): Remove alignment_power argument.
- (sec_merge_add): Add alignment argument.
- (sec_merge_emit): Alignment is now a per-entity thing, not per
- section.
- (_bfd_merge_section): Sanity check even non-SEC_STRINGS sections
- for proper alignment.
- Pass alignment information to sec_merge_add.
-
-2001-04-24 Christian Groessler <cpg@aladdin.de>
-
- * coff-z8k.c (extra_case): added handler for R_DISP7, R_CALLR
- and R_REL16 reloc types; accept odd values for R_REL16 type
-
-2001-04-24 Johan Rydberg <jrydberg@opencores.org>
-
- * cpu-openrisc.c: New file.
- * elf32-openrisc.c: Likewise.
-
- * Makefile.am (ALL_MACHINES): Add cpu-openrisc.lo.
- (ALL_MACHINES_CFILES): Add cpu-openrisc.c.
- (BFD32_BACKENDS): Add elf32-openrisc.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-openrisc.c.
- (cpu-openrisc.lo, elf32-openrisc.lo): New rules.
- * Makefile.in: Regenerated.
- * config.bfd: (openrisc-*-elf): New target.
- * configure.in (bfd_elf32_openrisc_vec): New vector.
- * configure: Regenerated.
- * libbfd.h: Regenerated.
- * bfd-in2.h: Regenerated.
- * reloc.c: Add OpenRISC relocations.
- * targets.c (bfd_elf32_openrisc_vec): Declare.
- (bfd_target_vect): Add bfd_elf32_openrisc_vec.
- * archures.c (enum bfd_architecture): Add bfd_arch_openrisc.
- (bfd_openrisc_arch): Declare.
- (bfd_archures_list): Add bfd_openrisc_arch.
- * elf.c (prep_headers): Add bfd_arch_openrisc.
-
-2001-04-23 Bo Thorsen <bo@suse.de>
-
- * elf64-x86-64.c: Add c++ vtable hack.
- Small whitespace and comment changes.
-
-2001-04-19 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_plt0_entry): Fix instructions.
- (elf64_x86_64_plt_entry): Likewise.
- (elf64_x86_64_finish_dynamic_sections): Fix PLT0 generation.
- (elf64_x86_64_finish_dynamic_symbol): Fix PLT generation.
-
-2001-04-17 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c: Tweak comments related to dynamic linking.
- (cris_elf_relocate_section): When not creating shared object, fill
- in the .got table for any symbol not in the dynamic symbol table.
- (elf_cris_finish_dynamic_symbol): When not creating shared object,
- only emit a .got.rela reloc if the symbol is in the dynamic symbol
- table.
- (cris_elf_check_relocs): Use variable r_type in all places rather
- than the original expression. Add default case in switch for
- reloc types.
- (elf_cris_size_dynamic_sections): Iterate over
- elf_cris_discard_excess_program_dynamics when not creating shared
- library.
- (elf_cris_discard_excess_dso_dynamics): Renamed from
- elf_cris_discard_copies. Correct typo, s/Rel/Rela/.
- (elf_cris_discard_excess_program_dynamics): New.
-
-2001-04-14 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coffcode.h (coff_write_object_contents): Use
- bfd_coff_swap_filehdr_out instead of coff_swap_filehdr_out.
-
-2001-04-14 H.J. Lu <hjl@gnu.org>
-
- * bfd-in2.h: Regenerate.
-
-2001-04-14 Jakub Jelinek <jakub@redhat.com>
-
- * section.c (STD_SECTION): Add entsize.
-
-2001-04-13 H.J. Lu <hjl@gnu.org>
-
- * section.c (SEC_MERGE): Define new flag for merging.
- (SEC_STRINGS): Likewise.
- (entsize): New field.
-
-2001-04-13 Roger Sayle <roger@metaphorics.com>
-
- * coff-i386.c (TARGET_SYM): SEC_READONLY is an applicable section
- flag on pe-i386 targets.
-
-2001-04-13 Jakub Jelinek <jakub@redhat.com>
-
- * libbfd-in.h (_bfd_merge_section): New.
- (_bfd_write_merged_section): New.
- (_bfd_merged_section_offset): New.
- * libbfd.h: Rebuilt.
- * linker.c (_bfd_generic_link_output_symbols): Handle
- discard_sec_merge.
- * aoutx.h (aout_link_write_symbols): Likewise.
- * pdp11.c (aout_link_write_symbols): Likewise.
- * elflink.h (elf_link_add_object_symbols): Call _bfd_merge_section.
- (elf_bfd_final_link): Adjust global symbols pointing into SEC_MERGE
- sections.
- (elf_link_sec_merge_syms): New.
- (elf_link_input_bfd): Call _bfd_merged_section_offset
- and _bfd_write_merged_section.
- Handle discard_sec_merge.
- * elf-bfd.h (struct elf_link_hash_table): Add merge_info
- field.
- (struct bfd_elf_section_data): Likewise.
- * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_MERGE and
- SEC_STRINGS section flags and entsize from their ELF counterparts.
- (_bfd_elf_link_hash_table_init): Initialize merge_info.
- (elf_fake_sections): Set SHF_MERGE, SHF_STRINGS and sh_entsize
- from their BFD counterparts.
- * merge.c: New file.
- * Makefile.am: Add strtab.lo.
- * Makefile.in: Rebuilt.
-
-2001-04-09 Hans-Peter Nilsson <hp@axis.com>
-
- * elflink.h (elf_fix_symbol_flags): For non-default visibilities,
- only hide symbols marked STV_INTERNAL or STV_HIDDEN.
-
-2001-04-05 Steven J. Hill <sjhill@cotw.com>
-
- * config.bfd (mips*el*-*-linux-gnu*): Use traditional little
- endian MIPS ELF target.
- * config.bfd (mips*-*-linux-gnu*): Use traditional big endian
- MIPS ELF target.
-
- * configure.in (bfd_elf64_tradbigmips_vec): New. Traditional
- 64bit big endian MIPS ELF target.
- (bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
- endian MIPS ELF target.
- * configure: Regenerated.
-
- * elf32-mips.c (IRIX_COMPAT): Handle traditional 64bit and
- little endian targets.
- (mips_elf_sym_is_global): Handle traditional targets.
-
- * elf64-mips.c (bfd_elf64_tradbigmips_vec): New. Traditional
- 64bit big endian MIPS ELF target.
- (bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
- endian MIPS ELF target.
-
- * targets.c: (_bfd_target_vector): Add bfd_elf64_tradbigmips_vec
- and bfd_elf64_tradlittlemips_vec.
-
-2001-04-05 David Mosberger <davidm@hpl.hp.com>
-
- * elf32-i386.c (elf_i386_fake_sections): Treat ".reloc" as an
- ordinary "progbits" section.
-
-2001-04-04 Alan Modra <alan@linuxcare.com.au>
-
- * elflink.h (elf_fix_symbol_flags): Call elf_backend_hide_symbol
- when -Bsymbolic causes a symbol to no longer need a .plt entry.
-
-2001-04-03 David Mosberger <davidm@hpl.hp.com>
-
- * efi-app-ia32.c (ALIGN_SECTIONS_IN_FILE): Deleted.
-
-2001-03-30 H.J. Lu <hjl@gnu.org>
-
- * efi-app-ia32.c (PEI_TARGET_SUBSYSTEM): Rename from ...
- (PEI_DEFAULT_TARGET_SUBSYSTEM): This.
-
-2001-03-26 H.J. Lu <hjl@gnu.org>
-
- * elf32-gen.c (elf32_generic_link_add_symbols): New. Check
- if there are any relocations for generic ELF.
- (bfd_elf32_bfd_link_add_symbols): Defined to
- elf32_generic_link_add_symbols.
- * elf64-gen.c (elf64_generic_link_add_symbols): New. Check
- if there are any relocations for generic ELF.
- (bfd_elf64_bfd_link_add_symbols): Defined to
- elf64_generic_link_add_symbols.
-
-2001-03-23 Nick Clifton <nickc@redhat.com>
-
- * Makefile.am (BUILD_CFILES): New variable: List of C source
- files created in build directory.
- (BUILD_HFILES): New variable: List of header files created in
- build directory.
- (POTFILES): Delete.
- (po/POTFILES.in): Replace rule with empty entry.
- (po/SRC-POTFILES.in): New rule: Create a list of source files
- in the source directory.
- (po/BLD-POTFILES.in): New rule: Create a list of source files
- in the build directory.
- (MOSTLYCLEAN): Do not delete source files created in build
- directory.
- * Makefile.in: Regenerate.
- * configure.in: Insert SRC-POTFILES.in and BLD-POTFILES.in
- into po/Makefile.
- * configure: Regenerate.
-
- * po/Make-in: Replace occurrences of POTFILES with SRC-POTFILES
- and BLD_POTFILES.
- Add .. to the search path when building bfd.pot.
- Delete POTFILES when performing distclean.
- Add comment describing why distclean is broken in maintainer mode.
- * po/POTFILES.in: Delete.
- * po/SRC-POTFILES.in: New file.
- * po/BLD-POTFILES.in: New file.
- * po/bfd.pot: Regenerate.
-
-2001-03-22 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c: Shlib and PIC support. PCREL tweaks.
- (elf_cris_discard_copies, elf_cris_adjust_gotplt_to_got,
- elf_cris_try_fold_plt_to_got, elf_cris_link_hash_newfunc,
- elf_cris_link_hash_table_create, elf_cris_adjust_dynamic_symbol,
- elf_cris_size_dynamic_sections, elf_cris_finish_dynamic_symbol,
- elf_cris_finish_dynamic_sections,elf_cris_hide_symbol): New
- functions.
- (cris_elf_howto_table) <R_CRIS_8_PCREL, R_CRIS_16_PCREL,
- R_CRIS_32_PCREL>: Correct comments. Set pcrel_offset to false.
- <R_CRIS_COPY, R_CRIS_GLOB_DAT, R_CRIS_JUMP_SLOT, R_CRIS_RELATIVE,
- R_CRIS_16_GOT, R_CRIS_32_GOT, R_CRIS_16_GOTPLT, R_CRIS_32_GOTPLT,
- R_CRIS_32_GOTREL, R_CRIS_32_PLT_GOTREL, R_CRIS_32_PLT_PCREL>:
- New HOWTO members for new relocs.
- (cris_reloc_map): Map new relocs.
- (ELF_DYNAMIC_INTERPRETER): Define.
- (PLT_ENTRY_SIZE): Define.
- (elf_cris_plt0_entry, elf_cris_plt_entry, elf_cris_pic_plt0_entry,
- elf_cris_pic_plt_entry): New, PLT templates.
- (struct elf_cris_pcrel_relocs_copied, struct
- elf_cris_link_hash_entry, struct elf_cris_link_hash_table): New.
- (elf_cris_link_hash_traverse, elf_cris_hash_table): Define.
- (cris_final_link_relocate): Check that 16-bit GOT relocs have
- positive values. Adjust PCREL relocs to be relative to location
- after relocation.
- (cris_elf_relocate_section): Handle relocations to dynamic
- objects. Handle new relocations. Call error handler when seeing
- non-PIC relocation for read-only sections while generating shared
- object.
- (cris_elf_check_relocs): Set reference counts for GOT and PLT
- entries.
- (bfd_elf32_bfd_link_hash_table_create,
- elf_backend_adjust_dynamic_symbol,
- elf_backend_size_dynamic_sections,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections,
- elf_backend_create_dynamic_sections, bfd_elf32_bfd_final_link,
- elf_backend_hide_symbol, elf_backend_want_got_plt,
- elf_backend_plt_readonly, elf_backend_want_plt_sym,
- elf_backend_got_header_size, elf_backend_plt_header_size):
- Define.
-
- * reloc.c: (BFD_RELOC_CRIS_COPY, BFD_RELOC_CRIS_GLOB_DAT,
- BFD_RELOC_CRIS_JUMP_SLOT, BFD_RELOC_CRIS_RELATIVE,
- BFD_RELOC_CRIS_32_GOT, BFD_RELOC_CRIS_16_GOT,
- BFD_RELOC_CRIS_32_GOTPLT, BFD_RELOC_CRIS_16_GOTPLT,
- BFD_RELOC_CRIS_32_GOTREL, BFD_RELOC_CRIS_32_PLT_GOTREL,
- BFD_RELOC_CRIS_32_PLT_PCREL): New relocs.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2001-03-21 Diego Novillo <dnovillo@redhat.com>
-
- (_bfd_mips_elf_relocate_section): Give a better error message when
- a relocation is not recognized.
-
-2001-03-21 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_set_gp): Check sec->output_section
- non-NULL before attempting to dereference.
-
-2001-03-20 H.J. Lu <hjl@gnu.org>
-
- * configure.in: Remove the redundent AC_ARG_PROGRAM.
- * configure: Rebuild.
-
-2001-03-20 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (elf_m68k_relocate_section): Don't need the
- relocation value when resolving a reference from a debugging
- section.
-
-2001-03-16 Scott Thomason <SThomaso@hii.com>
-
- * coff64-rs6000.c (xcoff64_swap_sym_out): Fix syntax errors.
- (xcoff64_swap_sym_out): Fix syntax errors.
-
-2001-03-16 Richard Sandiford <rsandifo@redhat.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix warning.
-
-2001-03-15 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_link_hash_entry): Add maybe_pic_call.
- (hppa_link_hash_newfunc): Init it.
- (hppa_type_of_stub): Only use non-PIC to PIC call stub if caller
- section appears to be non-PIC.
- (final_link_relocate): Likewise.
- (elf32_hppa_adjust_dynamic_symbol): Set maybe_pic_call for any
- possible candidate function, and set pic_call for those that will
- only have a .plt entry for the PIC call stub.
- (hppa_handle_PIC_calls): Set maybe_pic_call.
-
-2001-03-12 DJ Delorie <dj@redhat.com>
-
- * elf32-sh.c (sh_elf_relocate_section): Only relocation
- R_SH_DIR8WP* relocs if they're against external symbols, else
- they're just for relaxing. Validate the reloc values.
-
-2001-03-12 Stefan Geuken <mail@stefan-geuken.de>
-
- * binary.c (bfd_external_binary_architecture): Declare.
- (binary_object_p): If bfd_external_binary_architecture is defined,
- set the architecture to this string.
-
-2001-03-11 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_finish_dynamic_symbol): Don't make PLT
- entries that could serve as a definition for a weak symbol.
-
-2001-03-08 Nick Clifton <nickc@redhat.com>
-
- * Most files: Update copyright notices using Perl script created
- by Kevin Buettner <kevinb@redhat.com>.
-
-2001-03-07 Nick Clifton <nickc@redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Conditionalise
- prior patch on ! defined OLD_ARM_ABI.
-
-2001-03-07 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix handling of
- some relocation values.
-
-2001-03-06 Nick Clifton <nickc@redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Clear bit zero
- of offset in BLX(1) instruction.
- * coff-arm.c (coff_arm_relocate_section): Clear bit zero of
- offset in BLX(1) instruction.
- Fix formatting.
-
-2001-03-06 Nick Clifton <nickc@redhat.com>
-
- * coff-arm.c (coff_arm_reloc_type_lookup): Add
- BFD_RELOC_THUMB_PCREL_BLX.
-
-2001-03-06 Igor Shevlyakov <igor@windriver.com>
-
- * archures.c (bfd_default_scan): Add Coldfire CPUs.
- * bfd-in2.h: Regenerate.
- * cpu-m68k.c: Add Coldfire CPUs for arch table.
- * ieee.c (ieee_write_processor): Set proper id for
- Coldfire CPUs.
-
-2001-03-01 D.J. Barrow <djbarrow@de.ibm.com,barrow_dj@yahoo.com>
-
- * configure.in: Add s390 target.
- * configure: Regenerate.
-
-2001-02-28 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Add relocation
- to addend.
-
-2001-02-28 Philip Blundell <pb@futuretv.com>
-
- * elf32-arm.h: Update mentions of renamed EF_xx constants.
- (elf32_arm_print_private_bfd_data): Handle ARM EABI version 2.
-
-2001-02-27 H.J. Lu <hjl@gnu.org>
-
- * aoutx.h (NAME(aout,bfd_free_cached_info)): Return true if
- abfd->tdata.aout_data == NULL.
-
-2001-02-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c: Correct field selector in stub comments.
- (clobber_millicode_symbols): Formatting fix.
-
- * configure.in: Bump version to 2.11.90.
- * configure: Regenerate.
- * Makefile.am (CFILES): Rename to SOURCE_CFILES.
- (CFILES): $SOURCE_CFILES + generated C files.
- (POTFILES): Include $HFILES not $SOURCE_HFILES.
- Run "make dep-am"
- * Makefile.in: Regenerate.
- * doc/Makefile.in: This too.
-
-2001-02-26 Timothy Wall <twall@cygnus.com>
-
- * elfxx-ia64.c (elfNN_ia64_aix_add_symbol_hook): Remove obsolete
- comments.
-
-2001-02-26 Nick Clifton <nickc@redhat.com>
-
- * coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Tidy
- up, replacing multiple if statements with a switch.
- (handle_COMDAT): New function.
-
-2001-02-26 H.J. Lu <hjl@gnu.org>
-
- * coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Issue
- a warning for section flags we do not handle instead of
- aborting.
-
-2001-02-26 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (x86_64_elf_howto_table): Fix order of entries.
-
-2001-02-22 Timothy Wall <twall@cygnus.com>
-
- * config.bfd (targ_cpu): Add vectors for ia64-*-aix* (aka Monterey).
- * configure.in: Add objects for elf64_ia64_aix vectors.
- * configure: Regenerated.
- * configure.host: Recognize ia64-*-aix*.
- * elfxx-ia64.c: Add hooks for ELF64 on AIX5. Define new vectors
- for AIX. AIX5 requires most relocations to be dynamic (*all*
- binaries are somewhat similar to shared libraries).
- * targets.c: Add elf64_ia64_aix vectors.
-
-2001-02-21 David Mosberger <davidm@hpl.hp.com>
-
- * cpu-ia64-opc.c (elf64_ia64_operands}: Fix typo: error string for
- C8 said "1" instead of "8". Clarify error string for IMM22:
- "signed integer" instead of just "integer".
-
-2001-02-20 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Don't make
- PLT entries that could serve as a definition for a weak symbol.
-
-2001-02-19 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Don't make PLT
- entries that could serve as a definition for a weak symbol.
- * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Likewise.
-
-2001-02-18 David O'Brien <obrien@FreeBSD>
-
- * configure.in: Recognize FreeBSD/arm, FreeBSD/PowerPC, and treat
- FreeBSD/i386-CURRENT differently until I can figure out the needed
- corefile changes.
- * configure: Regenerate.
- * config.bfd: Recognize FreeBSD/x86-64, FreeBSD/ia64, FreeBSD/arm,
- FreeBSD/PowerPC, and FreeBSD/sparc64.
-
-2001-02-18 lars brinkhoff <lars@nocrew.org>
-
- * Makefile.am: Add PDP-11 a.out target.
- * config.bfd: Likewise.
- * configure.in: Likewise.
- * targets.c: Likewise.
- * archures.c: Likewise.
- * bfd-in2.h: Likewise. Add PDP-11 relocations.
- * libbfd.h: Add PDP-11 relocations.
- * reloc.c: Likewise.
- * cpu-pdp11.c: New file.
- * pdp11.c: New file.
-
- * libaout.h (GET_WORD) [ARCH_SIZE==16]: Define.
- (GET_SWORD) [ARCH_SIZE==16]: Likewise.
- (GET_SWORD) [ARCH_SIZE==16]: Likewise.
- (PUT_WORD) [ARCH_SIZE==16]: Likewise.
- (GET_MAGIC): New macro.
- (PUT_MAGIC): Likewise.
- * aout-target.h (MY(object_p)): Use GET_MAGIC to read magic word.
-
-2001-02-18 Jim Kingdon <jkingdon@engr.sgi.com>
-
- * irix-core.c (irix_core_core_file_p): Set the architecture (GDB
- multiarch needs it).
-
-2001-02-18 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_input_bfd): Ignore invalid section symbol
- index.
-
-2001-02-18 Kazu Hirata <kazu@hxi.com>
-
- * vms-misc.c: Fix formatting.
-
-2001-02-16 Kazu Hirata <kazu@hxi.com>
-
- * vms.c: Fix formatting.
-
-2001-02-14 H.J. Lu <hjl@gnu.org>
-
- * elf.c (elf_find_function): New function.
- (_bfd_elf_find_nearest_line): Call elf_find_function () to find
- the file name and function name.
-
-2001-02-14 Nick Clifton <nickc@redhat.com>
-
- * ecoff.c (bfd_debug_section): Update to initialise new fields in
- asection structure.
-
- * Makefile.am (BFD32_BACKENDS_CFILES): Remove peigen.c
- (BFD64_BACKENDS): Add pepigen.c
- Add rules to create peigen.c and pepigen.c from peXXigen.c.
-
- * Makefile.in: Regenerate.
- * configure: Regenerate.
- * po/POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
-
-2001-02-14 H.J. Lu <hjl@gnu.org>
-
- * libcoff-in.h (pe_tdata): Add members target_subsystem and
- force_minimum_alignment.
-
-2001-02-14 Bo Thorsen <bo@suse.de>
-
- * elf64-x86-64.c: Small formatting fixes and rearrangements of code.
- (elf64_86_64_size_info): Struct added to fix a problem
- with the hashtable string entries.
- (elf64_x86_64_adjust_dynamic_symbol): Add generation of .got.plt.
- (elf64_x86_64_size_dynamic_sections): A FIXME removed.
- (elf64_x86_64_size_dynamic_sections): Fix a dynamic entry and
- remove the FIXME for this.
- (elf64_x86_64_adjust_dynamic_symbol): Fix check for unneeded .plt
- section. Also removed the FIXME for it.
- (x86_64_elf_howto_table): Use bfd_elf_generic_reloc.
- (ELF_DYNAMIC_INTERPRETER): Fix the name of the dynamic linker.
- (elf64_x86_64_finish_dynamic_sections): Enable .got.plt writing.
-
-2001-02-13 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_final_link): Set __gp if required
- and not user provided.
-
-2001-02-13 Kazu Hirata <kazu@hxi.com>
-
- * vms.c (vms_print_symbol): Remove unreachable code.
-
- * rs6000-core.c: Fix formatting.
-
-2001-02-13 David Mosberger <davidm@hpl.hp.com>
-
- * peicode.h (coff_swap_filehdr_out) [COFF_IMAGE_WITH_PE]: Define
- as _bfd_XXi_only_swap_filehdr_out.
- (pe_mkobject) [PEI_FORCE_MINIMUM_ALIGNMENT]: Set
- pe->force_minimum_alignment to TRUE.
- (pe_mkobject) [PEI_TARGET_SUBSYSTEM]: Set pe->target_subsystem to
- PEI_TARGET_SUBSYSTEM.
- (pe_print_private_bfd_data): Call
- _bfd_XX_print_private_bfd_data_common() instead of
- _bfd_pe_print_private_bfd_data_common().
- (pe_bfd_copy_private_bfd_data): Call
- _bfd_XX_bfd_copy_private_bfd_data_common() instead of
- _bfd_pe_bfd_copy_private_bfd_data_common().
- (coff_bfd_copy_private_section_data): Define as
- _bfd_XX_bfd_copy_private_section_data instead of
- _bfd_pe_bfd_copy_private_section_data.
- (coff_get_symbol_info): Define as _bfd_XX_get_symbol_info instead
- of a _bfd_pe_get_symbol_info.
-
- * peigen.c: Delete.
-
- * peXXigen.c: Renamed from peigen.c.
- (COFF_WITH_XX): Define this macro (will get expanded into
- COFF_WITH_pep or COFF_WITH_pe, depending on whether this is being
- compiled as peigen.c or pepigen.c.
- [COFF_WITH_pep]: Include "coff/ia64.h" instead of "coff/i386.h" to
- define the canonical PEP structures and definitions.
- (_bfd_XXi_swap_aouthdr_out): If pe->force_minimum_alignment is in
- effect, enforce minimum file and section alignments. If
- extra->Subsystem is IMAGE_SUBSYSTEM_UNKNOWN, set it to
- pe->target_subsystem (this defaults to IMAGE_SUBSYSTEM_UNKNOWN,
- so, by default, this is a no-op).
-
- * libpei.h: Rename COFF_WITH_PEP to COFF_WITH_pep.
- (_bfd_XX_bfd_copy_private_bfd_data_common): Add macros to map
- _bfd_XXfoo to _bfd_pepfoo if COFF_WIT_PEP is defined and to
- _bfd_pefoo if it's not defined. Use these macros to define
- coff swap macros.
-
- * libcoff.h (pe_tdata): Add members target_subsystem and
- force_minimum_alignment.
-
- * efi-app-ia64.c (COFF_WITH_pep): Rename COFF_WITH_PEP to
- COFF_WITH_pep.
- (PEI_TARGET_SUBSYSTEM): Rename from PEI_DEFAULT_TARGET_SUBSYSTEM.
-
- * configure.in (bfd_efi_app_ia64_vec): Use pepigen.lo instead of
- peigen.lo.
-
- * coff-ia64.c: Rename COFF_WITH_PEP to COFF_WITH_pep.
- (AOUTSZ): Rename PEP64AOUTSZ and PEP64AOUTHDR to PEPAOUTSZ and
- PEPAOUTHDR.
-
- * Makefile.in (BFD64_BACKENDS): Mention pepigen.lo.
- (BFD64_BACKENDS_CFILES): Mention pepigen.c
- (peigen.c): Add rule to generate from peXXigen.c.
- (pepigen.c): Ditto.
- (pepigen.lo): List dependencies for pepigen.lo.
-
-2001-02-13 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_set_gp): Handle weak $global$. If
- $global$ referenced but not defined, set its value here.
-
-2001-02-09 Bo Thorsen <bo@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Set .rela.got section
- alignment to 3.
- (elf64_x86_64_check_relocs): Write R_X86_64_GOTPCREL GOT entry
- and relocation.
- (elf64_x86_64_relocate_section): Fix formatting.
- (elf64_x86_64_relocate_section): Fix addend for relocation of
- R_X86_64_(8|16|32|PC8|PC16|PC32).
-
-2001-02-12 Jan Hubicka <jh@suse.cz>
-
- * elf64-x86-64.c (x86_64_elf_howto): Fix name of R_X86_64_GOTPCREL.
-
-2001-02-11 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_bfd_final_link): Use file_align for SYMTAB
- alignment.
-
-2001-02-11 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c (mips_elf_create_dynamic_relocation): Undo patch
- from 2000-10-13. Do not add the symbol's value for R_MIPS_REL32
- relocations against dynsym symbols.
-
- * elf32-mips.c (elf_mips_howto_table): Fix the comment on
- the R_MIPS_26 relocation.
- (mips_elf_calculate_relocation): Use (p + 4) instead of p for
- the R_MIPS_26 relocation.
- (mips_elf_perform_relocation): Fix the comment on the R_MIPS16_26
- relocation.
- * elf64-mips.c (mips_elf64_howto_table_rel): Fix the comment on
- the R_MIPS_26 relocation.
- (mips_elf64_howto_table_rela): Likewise.
-
- * elf32-mips.c (struct mips_elf_link_hash_entry): Added no_fn_stub
- member to mark symbols that have non-CALL relocations against
- them.
- (mips_elf_link_hash_newfunc): Initialize no_fn_stub.
- (mips_elf_calculate_relocation): Handle R_MIPS_CALL16 like
- R_MIPS_GOT16.
- (_bfd_mips_elf_check_relocs): Set no_fn_stub for a symbol if a
- non-CALL relocation against it is encountered.
- (_bfd_mips_elf_copy_indirect_symbol): Merge no_fn_stub as well.
- (_bfd_mips_elf_adjust_dynamic_symbol): Only create a stub if
- no_fn_stub is not set.
-
- * elf32-mips.c (mips_elf_output_extsym): Get the output section
- information from the real symbol for indirect ones.
- Check no_fn_stub to find out if a symbol has a function stub
- indeed.
-
-2001-02-11 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * Makefile.am (stamp-lib): ranlib the libbfd.a in the build directory.
- * Makefile.in: Regenerate.
-
-2001-02-09 David Mosberger <davidm@hpl.hp.com>
-
- * elfxx-ia64.c (is_unwind_section_name): New function. Returns
- true if section name is an unwind table section name.
- (elfNN_ia64_additional_program_headers): Count each unwind section
- separately.
- (elfNN_ia64_modify_segment_map): Install one unwind program header
- for each unwind separate section. Note: normally the linker
- script merges the unwind sections that go into a single segment,
- so this still generates at most one unwind program header per
- segment.
-
- * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Accept any section
- name for SHT_IA_64_UNWIND, not just .IA_64.unwind.
- (elfNN_ia64_fake_sections): Mark sections with names that start
- with .IA_64.unwind but not with .IA_64.unwind_info as an IA-64
- unwind section.
-
- * elfxx-ia64.c (elfNN_ia64_final_write_processing): New function.
- Use it to make sh_info in unwind section point to the text section
- it applies to.
-
-2001-02-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * Makefile.am: Add linux target for S/390.
- * archures.c: Likewise.
- * bfd-in2.h: Likewise.
- * config.bfd: Likewise.
- * configure.in: Likewise.
- * elf.c: Likewise.
- * libbfd.h: Likewise.
- * targets.c: Likewise.
- * cpu-s390.c: New file.
- * elf32-s390.c: New file.
- * elf64-s390.c: New file.
-
-2001-02-09 Nick Clifton <nickc@redhat.com>
-
- * peigen.c (_bfd_pe_get_symbol_info): Suppress addition of
- ImageBase. This has already been done by coff_swap_hdr_in.
-
-2001-02-09 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c (sparc64_elf_copy_private_bfd_data): New function.
-
-2001-02-09 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c (sparc64_elf_check_relocs): Don't trust reloc_count.
- (sparc64_elf_relocate_section): Likewise.
-
-2001-02-09 Mark Kettenis <kettenis@gnu.org>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): Treat R_SPARC_UA32
- similar to R_SPARC_32.
- * elf64-sparc.c (sparc64_elf_howto_table): Likewise.
-
-2001-02-08 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_check_relocs): Reserve R_386_PC32
- relocation entries for weak definitions when building DSO with
- -Bsymbolic.
-
-2001-02-08 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Respect weakness
- before visibility. Locally defined protected symbols are not
- dynamic.
-
-2001-02-08 Geoffrey Keating <geoffk@redhat.com>
-
- * config.bfd: Enable coff64 for rs6000-*. Patch from
- <hzoli@austin.ibm.com>.
-
-2001-02-07 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coffgen.c (coff_find_nearest_line): If stabs info is successfully
- found, do not attempt to find dwarf2 info before returning.
-
-2001-02-07 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (is_global_symbol_definition): Rename to
- is_global_data_symbol_definition and have it reject function
- symbols.
- (elf_link_is_defined_archive_symbol): Use renamed function.
-
-2001-02-07 Todd Vierling <tv@wasabisystems.com>
-
- * libbfd-in.h (bfd_target_vector): Change extern array to pointer.
- * libbfd.h (bfd_target_vector): Likewise.
- * targets.c (bfd_target_vector): Rename to _bfd_target_vector and
- make static; create pointer reference named bfd_target_vector.
- (_bfd_target_vector_entries): Calculate this based on the array
- typed _bfd_target_vector.
-
-2001-02-06 H.J. Lu <hjl@gnu.org>
-
- * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Only hidden and
- internal symbols are not dynamic.
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise.
-
-2001-02-06 Nick Clifton <nickc@redhat.com>
-
- * Makefile.am (BFD64_BACKENDS_CFILES): Remove elf64-ia64.c, so
- that it will not be pulled into the list of files that make up
- po/POTFILES.in.
- * Makefile.in: Regenerate.
- * po/bfd.pot: Regenerate.
-
-2001-02-06 H.J. Lu <hjl@gnu.org>
-
- * peicode.h (coff_swap_filehdr_in): Remove the e_magic
- checking.
- (pe_bfd_object_p): Rewrite with external_PEI_DOS_hdr and
- external_PEI_IMAGE_hdr.
-
-2001-02-06 Kazu Hirata <kazu@hxi.com>
-
- * elf-m10200.c: Fix formatting.
-
-2001-02-04 Nick Clifton <nickc@redhat.com>
-
- * elf32-v850.c (v850_elf_reloc): Do not convert reloc addend to PC
- rel, it will be handled later on.
-
-2001-02-02 Fred Fish <fnf@ninemoons.com>
-
- * Makefile.in: Fix typo.
-
-2001-02-01 Kazu Hirata <kazu@hxi.com>
-
- * elf-m10300.c: Fix formatting.
-
-2001-01-30 Alan Modra <alan@linuxcare.com.au>
-
- * elf64-hppa.c (elf64_hppa_elf_get_symbol_type): New function.
- (elf_backend_get_symbol_type): Define.
- (elf64_hppa_object_p): Set architecture and machine from elf
- header flags.
-
-2001-01-30 Curtis L. Janssen <cljanss@ca.sandia.gov>
-
- * elf64-alpha.c (elf64_alpha_find_nearest_line): Query dwarf2
- before mdebug.
-
-2001-01-26 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Return false
- for non-default visibility.
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise, but
- delete ugly macro and replace with pretty function.
-
-2001-01-25 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coff-go32.c: Update copyright.
- * coff-stgo32.c: Likewise.
- * coff-go32.c (COFF_LONG_FILENAMES): Define.
- * coff-stgo32.c (COFF_LONG_FILENAMES): Likewise.
- * coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Remove .bss entry.
- * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
-
-2001-01-25 Kazu Hirata <kazu@hxi.com>
-
- * bfd-in2.h: Rebuild.
- * libbfd.h: Likewise.
-
-2001-01-23 H.J. Lu <hjl@gnu.org>
-
- * bfd-in2.h: Rebuild.
-
-2001-01-23 H.J. Lu <hjl@gnu.org>
-
- * vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_buf)
- is NULL or PRIV(vms_rec) is outside of the buffer.
-
-2001-01-23 Kazu Hirata <kazu@hxi.com>
-
- * coff64-rs6000.c: Fix formatting.
- * coff-arm.c: Likewise.
- * coffgen.c: Likewise.
- * cofflink.c: Likewise.
- * coff-mcore.c: Likewise.
- * coff-mips.c: Likewise.
- * coff-pmac.c: Likewise.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * elf32.c: Likewise.
- * elf32-fr30.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf32-i860.c: Likewise.
- * elf32-m32r.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elflink.c: Likewise.
- * elflink.h: Likewise.
- * elf-m10200.c: Likewise.
- * elf-m10300.c: Likewise.
- * elfxx-ia64.c: Likewise.
-
- * aoutx.h: Fix formatting.
- * bfd.c: Likewise.
- * bfd-in2.h: Likewise.
- * bfd-in.h: Likewise.
- * cpu-i386.c: Likewise.
- * cpu-m68hc11.c: Likewise.
- * dwarf2.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * format.c: Likewise.
- * freebsd.h: Likewise.
- * hash.c: Likewise.
- * hp300hpux.c: Likewise.
- * hppabsd-core.c: Likewise.
- * hpux-core.c: Likewise.
-
-2001-01-22 Bo Thorsen <bo@suse.de>
-
- * elf64-x86-64.c: Added PIC support for X86-64.
- (elf64_x86_64_link_hash_newfunc): Function added.
- (elf64_x86_64_link_hash_table_create): Likewise.
- (elf64_x86_64_check_relocs): Likewise.
- (elf64_x86_64_gc_mark_hook): Likewise.
- (elf64_x86_64_gc_sweep_hook): Likewise.
- (elf64_x86_64_adjust_dynamic_symbol): Likewise.
- (elf64_x86_64_size_dynamic_sections): Likewise.
- (elf64_x86_64_discard_copies): Likewise.
- (elf64_x86_64_finish_dynamic_symbol): Likewise.
- (elf64_x86_64_finish_dynamic_sections): Likewise.
- (elf64_x86_64_relocate_section): Add relocation of PIC sections.
-
-2001-01-21 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * Makefile.am (install-data-local): Make use of $(DESTDIR).
- * Makefile.in: Regenerate.
-
-2001-01-21 Kazu Hirata <kazu@hxi.com>
-
- * coff-a29k.c: Fix formatting.
-
-2001-01-19 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_check_relocs): Report files with bad
- relocation section names.
- (elf_i386_relocate_section): Report files with bad relocation
- section names and return false.
-
-2001-01-17 Bo Thorsen <bo@suse.de>
-
- * targets.c: Alphabetize list of xvecs.
-
-2001-01-14 Alan Modra <alan@linuxcare.com.au>
-
- * config.bfd: Add linux target variant for elfxx-hppa.
- * configure.in: Recognize bfd_elf32_hppa_linux_vec and
- bfd_elf64_hppa_linux_vec.
- * configure: Regenerate.
- * elf64-hppa.c: Include elf64-target.h again to support linux
- target variant.
- (elf64_hppa_post_process_headers): Set ELFOSABI_LINUX for linux.
- * elf32-hppa.c: Include elf32-target.h again to support linux
- target variant.
- (elf32_hppa_post_process_headers): New function.
- (elf_backend_post_process_headers): Define.
- * targets.c (bfd_target_vector): Add bfd_elf64_hppa_linux_vec and
- bfd_elf32_hppa_linux_vec.
-
- * elf32-hppa.c (elf32_hppa_link_hash_table): Add text_segment_base,
- and data_segment_base fields.
- (elf32_hppa_link_hash_table_create ): Init them.
- (elf32_hppa_check_relocs): Update comments.
- (hppa_record_segment_addr): New function.
- (elf32_hppa_relocate_section): Call it.
- (final_link_relocate): Handle R_PARISC_SEGREL32.
- (elf32_hppa_final_link): New function.
- (bfd_elf32_bfd_final_link): Define to call it.
- (hppa_unwind_entry_compare): New function.
- * cache.c (bfd_open_file): Create files in write+read mode.
-
- * elf-hppa.h (elf_hppa_howto_table): Set bitsize value for
- SEGREL32 and numerous other relocs. Change duplicate
- R_PARISC_NONE relocs to R_PARISC_UNIMPLEMENTED.
-
- * opncls.c (bfd_fdopenr): Add parens like the comment says around
- O_ACCMODE.
-
- * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Don't create
- .plt entries for DT_INIT and DT_FINI.
- (elf32_hppa_finish_dynamic_sections): Remove special handling of
- DT_INIT and DT_FINI.
-
- * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Use 16-bit
- offsets for stub .plt access if wide mode. Check offset in range.
-
-2001-01-13 Nick Clifton <nickc@redhat.com>
-
- * elf32-fr30.c (fr30_elf_howto_table): Remove spurious blank
- line.
-
- * coffcode.h (coff_canonicalize_reloc): Remove spurious blank
- line.
-
-2001-01-12 Alan Modra <alan@linuxcare.com.au>
-
- * configure.in ([bfd_elf64_x86_64_vec]): Set target64.
- * configure: Regenerate.
-
-2001-01-11 Peter Targett <peter.targett@arccores.com>
-
- * bfd-in2.h (bfd_architecture): Add bfd_mach_arc_5,
- bfd_mach_arc_6, bfd_mach_arc_7, bfd_mach_arc_8 for ARC variants.
- * cpu-arc.c (arch_info_struct): Add entries for variants.
- (bfd_arc_arch) Set default to bfd_mach_arc_5.
- (arc_get_mach) Don't assume machine names prefixed arc- before
- testing.
- * elf32-arc.c (arc_elf_object_p): Set machine number based on new
- selections.
- (arc_elf_final_write_processing) Likewise.
- (ELF_MACHINE_CODE) Use EM_ARC.
-
-2001-01-10 Nick Clifton <nickc@redhat.com>
-
- * coff-arm.c (LOCAL_LABEL_PREFIX): Change definition to "".
-
-2001-01-07 Philip Blundell <philb@gnu.org>
-
- * README: Replace `bug-gnu-utils@gnu.org' with
- `bug-binutils@gnu.org'.
-
-2001-01-04 Kazu Hirata <kazu@hxi.com>
-
- * som.c: Fix formatting.
-
-2001-01-03 Kazu Hirata <kazu@hxi.com>
-
- * ecoffswap.h: Fix formatting.
- * elf-bfd.h: Likewise.
- * elfarm-nabi.c: Likewise.
- * elfarm-oabi.c: Likewise.
- * elfcode.h: Likewise.
- * elfcore.h: Likewise.
- * elflink.c: Likewise.
- * elflink.h: Likewise.
- * elfxx-ia64.c: Likewise.
- * elfxx-target.h: Likewise.
- * libbfd.c: Likewise
- * linker.c: Likewise.
- * lynx-core.c: Likewise.
-
-2001-01-02 Kazu Hirata <kazu@hxi.com>
-
- * pc532-mach.c: Fix formatting.
- * pe-arm.c: Likewise.
- * pe-i386.c: Likewise.
- * pe-mips.c: Likewise.
- * pe-ppc.c: Likewise.
- * pe-sh.c: Likewise.
- * pei-mips.c: Likewise.
- * pei-sh.c: Likewise.
- * peicode.h: Likewise.
- * ppcboot.c: Likewise.
- * ptrace-core.c: Likewise.
-
-2001-01-01 Kazu Hirata <kazu@hxi.com>
-
- * reloc.c: Fix formatting.
- * riscix.c: Likewise.
- * rs6000-core.c: Likewise.
- * xcoff-target.h: Likewise.
-
-2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elfcode.h (elf_object_p): Also restore the bfd mach field on
- error, by calling bfd_default_set_arch_mach with incoming
- values.
-
-2000-12-26 Kazu Hirata <kazu@hxi.com>
-
- * vaxnetbsd.c: Fix formatting.
- * versados.c: Likewise.
- * vms-gsd.c: Likewise.
- * vms-hdr.c: Likewise.
- * vms-misc.c: Likewise.
-
-2000-12-25 Alexandre Oliva <aoliva@redhat.com>
-
- * archive.c (coff_write_armap): Don't write more than symbol_count
- `archive_member_file_ptr's.
-
-2000-12-25 Kazu Hirata <kazu@hxi.com>
-
- * vms-tir.c: Fix formatting.
-
-2000-12-23 Kazu Hirata <kazu@hxi.com>
-
- * vms.c: Fix formatting.
- * vms.h: Likewise.
-
-2000-12-21 Santeri Paavolainen <santtu@ssh.com>
-
- * vms-hdr.c: Include alloca.h if HAVE_ALLOCA_H is defined.
-
- * peicode.h (pe_ILF_object_p): Add const to import of TARGET_LITTLE_SYM.
-
- * elf32-m32r.c (m32r_elf_generic_reloc): Add cast to avoid (void *)
- arithmetic.
-
- * elf32-fr30.c: Add casts to avoid (void *) arithmetic.
-
- * coffcode.h (styp_to_sec_flags): Add empty statement after label.
-
-2000-12-21 Richard Sandiford <rsandifo@redhat.com>
-
- * libbfd.c (bfd_get_bits): Added
- (bfd_put_bits): Likewise
- * bfd-in.h: Declared the above.
- * bfd-in2.h: Regenerated.
-
-2000-12-20 Kazu Hirata <kazu@hxi.com>
-
- * targets.c: Fix formatting.
- * tekhex.c: Likewise.
- * trad-core.c: Likewise.
-
-2000-12-19 Kazu Hirata <kazu@hxi.com>
-
- * sco5-core.c: Fix formatting.
- * section.c: Likewise.
- * sparclinux.c: Likewise.
- * sparclynx.c: Likewise.
- * sparcnetbsd.c: Likewise.
- * srec.c: Likewise.
- * stabs.c: Likewise.
- * stab-syms.c: Likewise.
- * sunos.c: Likewise.
- * syms.c: Likewise.
- * sysdep.h: Likewise.
-
-2000-12-18 Nick Clifton <nickc@redhat.com>
-
- * coff-arm.c (EXTRA_S_FLAGS): Only define if not already
- defined.
- * epoc-pe-arm.c (EXTRA_S_FLAGS): Define.
- * epoc-pei-arm.c (EXTRA_S_FLAGS): Define.
-
-2000-12-18 Nick Clifton <nickc@redhat.com>
-
- * vms-misc.c (_bfd_vms_get_record): Add default case to
- file_format switch.
-
-2000-12-15 Miloslav Trmac <mitr@volny.cz>
-
- * elfcore.h (elf_core_file_p): Move to the start of the program
- headers before attempting to read them.
-
-2000-12-14 Kazu Hirata <kazu@hxi.com>
-
- * peigen.c: Fix formatting.
- * som.c: Likewise.
- * som.h: Likewise.
-
-2000-12-13 Kazu Hirata <kazu@hxi.com>
-
- * peigen.c: Fix formatting.
-
-2000-12-12 Jim Wilson <wilson@redhat.com>
-
- * elfxx-ia64.c (get_dyn_sym_info): Cast %p argument to void *.
-
-2000-12-08 Mark Salter <msalter@redhat.com>
-
- * binary.c (binary_set_section_contents): Ignore sections
- with zero size.
-
-2000-12-12 Kazu Hirata <kazu@hxi.com>
-
- * m68klinux.c: Fix formatting.
- * m68knetbsd.c: Likewise.
- * mipsbsd.c: Likewise.
- * netbsd-core.c: Likewise.
- * netbsd.h: Likewise.
- * newsos3.c: Likewise.
- * nlm32-alpha.c: Likewise.
- * nlm32-i386.c: Likewise.
- * nlm32-ppc.c: Likewise.
- * nlm32-sparc.c: Likewise.
- * nlmcode.h: Likewise.
- * nlmswap.h: Likewise.
- * nlm-target.h: Likewise.
- * ns32knetbsd.c: Likewise.
-
-2000-12-10 Fred Fish <fnf@be.com>
-
- * elflink.h (elf_link_output_extsym): Don't complain about undefined
- symbols in shared objects if allow_shlib_undefined is true.
-
-2000-12-12 Nick Clifton <nickc@redhat.com>
-
- * cpu-sh.c: Fix formattng.
- * elf.c: Fix formattng.
- * elf32-mips.c: Fix formattng.
- * elf32-sh.c: Fix formattng.
- * elf64-alpha.c: Fix formattng.
-
-2000-12-09 Nick Clifton <nickc@redhat.com>
-
- * elf32-mips.c (_bfd_mips_elf_find_nearest_line): Pass
- dwarf2_find_line_info as last parameter to invocation of
- _bfd_dwarf2_find_nearest_line.
- * elf32-arm.h (elf32_arm_find_nearest_line): Pass
- dwarf2_find_line_info as last parameter to invocation of
- _bfd_dwarf2_find_nearest_line.
-
-2000-12-08 Mark Elbrecht <snowball3@bigfoot.com>
-
- * Makefile.am (BFD32_BACKENDS): Move dwarf2.lo from here...
- (BFD_LIBS): ...to here.
- (BFD32_BACKENDS_CFILES): Move dwarf2.c from here...
- (BFD_LIBS_CFILES): ...to here.
- * Makefile.in: Regenerate.
- * configure.in: Remove dwarf.lo from the elf shell variable.
- * configure: Regenerate.
- * libcoff-in.h (coff_tdata): Add pointer dwarf2_find_line_info.
- * libcoff.h: Regenerate.
- * coffgen.c (coff_find_nearest_line): Call
- _bfd_dwarf2_find_nearest_line.
- * dwarf2.c (_bfd_dwarf2_find_nearest_line): Add parameter. Update
- accordingly.
- (read_abbrevs): Likewise
- (decode_line_info): Likewise.
- (parse_comp_unit): Likewise.
- (comp_unit_find_nearest_line): Likewise.
- * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
- * libbfd.h: Regenerate.
- * elf.c (_bfd_elf_find_nearest_line): Update call.
- * elf-bfd.h (elf_obj_tdata): Change dwarf2_find_line_info to type PTR.
- * dwarf2.c (concat_filename): Use IS_ABSOLUTE_PATH.
- * coffcode.h (STYP_XCOFF_DEBUG, STYP_DEBUG_INFO): New macros.
- (sec_to_styp_flags): Use them. Handle DWARF2 sections.
- (styp_to_sec_flags): Handle DWARF2 sections.
- * elf32-arm.h (elf32_arm_find_nearest_line): Add parameter to call
- to _bfd_find_nearest_line.
- * elf32-mips.c (_bfd_mips_elf_find_nearest_line): Add parameter to
- call to _bfd_find_nearest_line.
-
-2000-12-08 Kazu Hirata <kazu@hxi.com>
-
- * coffgen.c: Fix formatting.
- * elf-m10300.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-i960.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-ppc.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-sparc.c: Likewise.
-
-2000-12-07 Kazu Hirata <kazu@hxi.com>
-
- * elf32-ppc.c: Fix formatting.
- * elf64-x86-64.c: Likewise.
-
-2000-12-06 Ulf Carlsson <ulfc@engr.sgi.com>
-
- From Ralf Baechle <ralf@gnu.org>
-
- * elf32-mips.c (elf32_mips_merge_private_bfd_data): Always permit
- BFDs containing no sections or empty .text, .data or .bss sections
- to be merged, regardless of their flags.
-
-2000-12-06 Kazu Hirata <kazu@hxi.com>
-
- * elf32-m32r.c: Fix formatting.
- * elf32-m68hc11.c: Likewise.
- * elf32-m68hc12.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-pj.c: Likewise.
- * elf32-ppc.c: Likewise.
-
-2000-12-05 Kazu Hirata <kazu@hxi.com>
-
- * elf32-fr30.c: Fix formatting.
- * elf32-hppa.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-i860.c: Likewise.
- * elf32-i960.c: Likewise.
-
-2000-12-03 Kazu Hirata <kazu@hxi.com>
-
- * elf32-arm.h: Fix formatting.
- * elf32-avr.c: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-d10v.c: Likewise.
- * elf32-d30v.c: Likewise.
- * elf-hppa.h: Likewise.
- * elf-m10200.c: Likewise.
- * elf-m10300.c: Likewise.
-
-2000-12-01 Chris Demetriou <cgd@sibyte.com>
-
- * aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mips32 and
- bfd_mach_mips32_4k. Update FIXME comment.
- * archures.c (bfd_mach_mips32): New constant.
- (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
- the latter, renumber it.
- * bfd-in2.h (bfd_mach_mips32): New constant.
- (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
- the latter, renumber it.
- * cpu-mips.c (I_mips32): New constant.
- (I_mips4K, I_mips32_4k): Rename the former to the latter.
- (arch_info_struct): Add bfd_mach_mips32 entry, replace
- bfd_mach_mips4K entry with bfd_mach_mips32_4k entry.
- * elf32-mips.c (elf_mips_isa): Add E_MIPS_ARCH_32 case.
- (elf_mips_mach): Likewise. Also, replace E_MIPS_MACH_MIPS32
- with E_MIPS_MACH_MIPS32_4K.
- (_bfd_mips_elf_final_write_processing): Replace
- bfd_mach_mips4K with bfd_mach_mips32_4k case, add
- bfd_mach_mips32 case.
- (_bfd_mips_elf_merge_private_bfd_data): Generalize ISA mixing
- comparison with support for MIPS32.
- (_bfd_mips_elf_print_private_bfd_data): Print ISA name for
- MIPS32.
-
- * aoutx.h (NAME(aout,machine_type)): Add cases for
- bfd_mach_mips5 and bfd_mach_mips64.
- * archures.c (bfd_mach_mips5, bfd_mach_mips64): New constants.
- * bfd-in2.h (bfd_mach_mips5, bfd_mach_mips64): Likewise.
- * cpu_mips.c (I_mips5, I_mips64): New definitions.
- (arch_info_struct): Add entries for bfd_mach_mips5 and
- bfd_mach_mips64.
- * elf32-mips.c (elf_mips_isa, elf_mips_mach,
- _bfd_mips_elf_print_private_bfd_data): Add cases for
- E_MIPS_ARCH_5 and E_MIPS_ARCH_64.
- (_bfd_mips_elf_final_write_processing): Add cases for
- bfd_mach_mips5 and bfd_mach_mips64.
-
- * aoutx.h (NAME(aout,machine_type)): Add a
- bfd_mach_mips_sb1 case.
- * archures.c (bfd_mach_mips_sb1): New constant.
- * bfd-in2.h (bfd_mach_mips_sb1): New constant.
- * cpu-mips.c (I_sb1): New constant.
- (arch_info_struct): Add entry for bfd_mach_mips_sb1.
- * elf32-mips.c (elf_mips_mach): Add case for
- E_MIPS_MACH_SB1.
- (_bfd_mips_elf_final_write_processing): Add case for
- bfd_mach_mips_sb1.
-
-2000-12-01 Joel Sherrill <joel@OARcorp.com>
-
- * config.bfd (arm-*-rtems*, a29k-*rtems*): New targets.
- (sparc*-*-rtemself*, sparc*-*-rtemsaout*): New targets.
- (sparc*-*-rtems*): Switched from a.out to ELF.
-
-2000-11-30 Jan Hubicka <jh@suse.cz>
-
- * Makefile.am (BFD64_BACKENDS): Add elf64-x86-64.lo
- BFD64_BACKENDS_CFILES): Add elf64-x86-64.c
- (elf64-x86-64.lo): Add dependencies.
- * archures.c (DESCRIPTION): Add bfd_mach_x86_64,
- bfd_mach_x86_64_intel_syntax.
- * elf.c (prep_headers): Use EM_x86_64 for 64bit output.
- * config.bfd (x86_64): Add.
- * configure.in: Add support for bfd_elf64_x86_64_vec.
- * cpu-i386.c (bfd_x86_64_arch_intel_syntax, bfd_x86_64_arch): Add.
- (bfd_i386_arch, i8086_ar): Link in.
- * elf64-x86-64.c: New file.
- * reloc.c (ENUMDOC): Add BFD_RELOC_X86_64*.
- * targets.c (bfd_elf64_x86_64_vec): Add.
- (bfd_target_vect): Add bfd_elf64_x86_64_vec.
-
-2000-11-30 Kazu Hirata <kazu@hxi.com>
-
- * xcofflink.c: Fix formatting.
-
-2000-11-28 Kazu Hirata <kazu@hxi.com>
-
- * aoutx.h: Fix formatting.
- * bfd-in.h: Likewise.
- * bfd-in2.h: Likewise.
- * cache.c: Likewise.
- * cisco-core.c: Likewise.
- * coff64-rs6000.c: Likewise.
- * coffcode.h: Likewise.
- * coffswap.h: Likewise.
- * corefile.c: Likewise.
- * elf32-mips.c: Likewise.
-
-2000-11-27 Kazu Hirata <kazu@hxi.com>
-
- * aout-adobe.c: Fix formatting.
- * coff64-rs6000.c: Likewise.
- * coffgen.c: Likewise.
- * cofflink.c: Likewise.
-
-2000-11-27 Philip Blundell <pb@futuretv.com>
-
- * libcoff-in.h (coff_tdata): Add `strings_written' flag.
- (obj_coff_strings_written): New accessor macro for above.
- * libcoff.h: Regenerate.
- * cofflink.c (_bfd_coff_final_link): Say that we wrote the
- strings.
- * coffcode.h (coff_write_object_contents): No need to write out
- the string table if it's already been done.
-
-2000-11-22 Philip Blundell <pb@futuretv.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Don't object to
- weak undefined symbols.
-
-2000-11-24 Nick Clifton <nickc@redhat.com>
-
- * archures.c (bfd_mach_arm_5TE): Define.
- (bfd_mach_arm+XScale): Define.
- * bfd-in2.h: Regenerate.
-
- * coff-arm.c (coff_arm_reloc_type_lookup): Accept
- BFD_RELOC_ARM_PCREL_BLX.
-
- * coffcode.h (coff_set_flags): Set flags for 5t, 5te and
- XScale machine numbers.
-
- * config.bfd (xscale-elf): Add target.
- (xscale-coff): Add target.
-
- * cpu-arm.c: Add xscale machine name.
- Add v5t, v5te and XScale machine numbers.
-
-2000-11-23 Kazu Hirata <kazu@hxi.com>
-
- * aix386-core.c: Fix formatting.
-
-2000-11-22 Jim Wilson <wilson@redhat.com>
-
- * coff-ia64.c (howto_table): Use EMPTY_HOWTO.
- (in_reloc_p): Add ATTRIBUTE_UNUSED to unused parameters.
- * cpu-ia64-opc.c (ins_rsvd, ext_rsvd, ins_const, ext_const): Likewise.
- (ins_imms_scaled): Initialize sign_bit at function entry.
- (elf64_ia64_operands): Add missing initializers.
- * elfxx-ia64.c (elfNN_ia64_reloc, elfNN_ia64_reloc_type_lookup,
- elfNN_ia64_info_to_howto, elfNN_ia64_fake_sections,
- elfNN_ia64_add_symbol_hook, elfNN_ia64_is_local_label_name,
- elfNN_ia64_local_hash_table_init, get_fptr, get_pltoff,
- elfNN_ia64_adjust_dynamic_symbol): Add ATTRIBUTE_UNUSED for unused
- parameters.
- (elfNN_ia64_info_to_howto): Initialize free_relocs, free_contents,
- and free_extsyms at function entry.
- (elfNN_add_symbol_hook): Add unsigned cast to bfd_get_gp_size result.
- (elfNN_ia64_create_dynamic_sections): Delete unused local h.
- (get_got): Delete unused local srel.
- (elfNN_ia64_check_relocs): Initialize dynrel_type when declared.
- (elfNN_ia64_relocate_section): Delete unused local dynindx.
-
-2000-11-21 Kazu Hirata <kazu@hxi.com>
-
- * coff-a29k.c: Fix formatting.
- * coff-h8500.c: Likewise.
- * coff-i960.c: Likewise.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * coff-stgo32.c: Likewise.
- * coff-tic54x.c: Likewise.
- * coff-w65.c: Likewise.
- * cpu-h8500.c: Likewise.
- * cpu-hppa.c: Likewise.
- * cpu-ns32k.c: Likewise.
- * ecoff.c: Likewise.
- * ecofflink.c: Likewise.
-
-2000-11-21 Nick Clifton <nickc@redhat.com>
-
- * elf32-sh.c (sh_elf_reloc_loop): Fix compile time warning, and
- remove possibility of infinite loop.
-
-2000-11-20 Kazu Hirata <kazu@hxi.com>
-
- * aix386-core.c: Fix formatting.
- * aout-adobe.c: Likewise.
- * aout-arm.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.
- * bfd-in.h: Likewise.
- * bfd-in2.h: Likewise.
- * bfd.c: Likewise.
- * bout.c: Likewise.
-
-2000-11-17 H.J. Lu <hjl@gnu.org>
-
- * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Don't create
- pltoff entries for DT_INIT and DT_FINI.
- (elfNN_ia64_final_link): Don't set DT_INIT/FINI entries.
- (elfNN_ia64_finish_dynamic_sections): Don't fill in DT_INIT/FINI
- entries.
-
-2000-11-16 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_check_relocs): Handle IPLT relocs.
- (allocate_dynrel_entries): Likewise.
- (elfNN_ia64_relocate_section): Likewise. Set REL addends correctly.
- (set_pltoff_entry): Likewise.
- (ia64_howto_table): Remove R_IA64_SEGBASE, and R_IA64_EPLT[ML]SB
- (elfNN_ia64_reloc_type_lookup): Likewise.
- (elfNN_ia64_install_value): Likewise.
- (elfNN_ia64_relocate_section): Likewise.
- * reloc.c (BFD_RELOC_IA64_SEGBASE): Remove.
- (BFD_RELOC_IA64_EPLTMSB, BFD_RELOC_IA64_EPLTLSB): Remove.
-
-2000-11-16 Kazu Hirata <kazu@hxi.com>
-
- * cpu-a29k.c: Fix formatting.
- * cpu-alpha.c: Likewise.
- * cpu-arm.c: Likewise.
- * cpu-avr.c: Likewise.
- * cpu-d10v.c: Likewise.
- * cpu-h8500.c: Likewise.
- * cpu-hppa.c: Likewise.
- * cpu-i370.c: Likewise.
- * cpu-i386.c: Likewise.
- * cpu-i960.c: Likewise.
- * cpu-ia64-opc.c: Likewise.
- * cpu-ia64.c: Likewise.
- * cpu-m32r.c: Likewise.
- * cpu-m68hc11.c: Likewise.
- * cpu-m68hc12.c: Likewise.
- * cpu-m68k.c: Likewise.
- * cpu-m88k.c: Likewise.
- * cpu-mips.c: Likewise.
- * cpu-ns32k.c: Likewise.
- * cpu-pj.c: Likewise.
- * cpu-powerpc.c: Likewise.
- * cpu-sh.c: Likewise.
- * cpu-sparc.c: Likewise.
- * cpu-tic54x.c: Likewise.
- * cpu-v850.c: Likewise.
- * cpu-vax.c: Likewise.
- * cpu-w65.c: Likewise.
- * cpu-we32k.c: Likewise.
- * cpu-z8k.c: Likewise.
- * dwarf1.c: Likewise.
- * dwarf2.c: Likewise.
-
-2000-11-15 Kazu Hirata <kazu@hxi.com>
-
- * coff-arm.c: Fix formatting.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * coff-sh.c: Likewise.
- * coff-sparc.c: Likewise.
- * coff-tic30.c: Likewise.
- * coff-tic54x.c: Likewise.
- * coff-tic80.c: Likewise.
- * coff-w65.c: Likewise.
- * coff-we32k.c: Likewise.
- * coff-z8k.c: Likewise.
-
-2000-11-15 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Create the reloc
- section with the same ALLOC|LOAD flags as the source section.
-
-2000-11-14 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_opt_call): Only check bits used
- by STO_ALPHA constants.
-
-2000-11-14 Kazu Hirata <kazu@hxi.com>
-
- * coff-pmac.c: Fix formatting.
- * coff-ppc.c: Likewise.
-
-2000-11-13 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Also add indirect
- symbols for common symbols with the default version.
-
-2000-11-09 Philip Blundell <pb@futuretv.com>
-
- * section.c (STD_SECTION): Set gc_mark flag.
-
-2000-11-11 Kazu Hirata <kazu@hxi.com>
-
- * coff-i960.c: Likewise.
- * coff-m68k.c: Likewise.
- * coff-m88k.c: Likewise.
- * coff-mcore.c: Likewise.
- * coff-mips.c: Likewise.
-
-2000-11-11 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_relocate_section): Ignore R_SH_NONE relocs.
-
-2000-11-10 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c: Fix formatting.
- * coff-h8500.c: Likewise.
- * coff-i386.c: Likewise.
- * coff-i860.c: Likewise.
- * coff-i960.c: Likewise.
- * coff-ia64.c: Likewise.
-
-2000-11-09 Kazu Hirata <kazu@hxi.com>
-
- * archive.c: Fix formatting.
- * archures.c: Likewise.
-
-2000-11-07 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elf64_ia64_final_link): New local unwind_output_sec.
- Set it before bfd_elf64_bfd_final_link call. Use it after the call.
- * section.c (bfd_set_section_contents): Call memcpy if
- section->contents set and location not equal to contents plus offset.
-
-2000-11-08 Kazu Hirata <kazu@hxi.com>
-
- * bfd-in.h: Fix formatting.
- * bfd-in2.h: Likewise.
- * bfd.c: Likewise.
- * binary.c: Likewise.
- * bout.c: Likewise.
- * coff-a29k.c: Likewise.
- * coff-alpha.c: Likewise.
- * coff-apollo.c: Likewise.
- * coff-aux.c: Likewise.
-
-2000-11-07 Kazu Hirata <kazu@hxi.com>
-
- * aix386-core.c: Fix formatting.
- * aoutf1.h: Likewise.
- * aoutx.h: Likewise.
- * archures.c: Likewise.
- * armnetbsd.c: Likewise.
-
-2000-11-07 Alan Modra <alan@linuxcare.com.au>
-
- * coff-h8300.c (special): Adjust reloc address.
-
-2000-11-06 Steve Ellcey <sje@cup.hp.com>
-
- * archures.c (bfd_mach_ia64_elf64, bfd_mach_ia64_elf32): Add defines
- to differentiate elf32 and elf64 on ia64.
- * bfd-in2.h: Regenerate.
- * config.bfd: Add target for "ia64*-*-hpux*".
- * configure.in: Add bfd_elf32_ia64_big_vec to selvecs switch.
- * configure: Regenerate.
- * cpu-ia64.c (bfd_ia64_elf32_arch): Add elf32 arch info structure.
- * targets.c: Add bfd_target bfd_elf32_ia64_big_vec.
-
- * Makefile.am: Make elf32-ia64.c and elf64-ia64.c derived objects
- from elfxx-ia64.c. Add depenency rules for making elf32-ia64.lo.
- * Makefile.in: Regnerate.
- * elf64-ia64.c: Deleted.
- * elfxx-ia64.c: New file, paramaterized version of elf64-ia64.c.
-
-2000-11-06 Kazu Hirata <kazu@hxi.com>
-
- * aout-adobe.c: Fix formatting.
- * aout-arm.c: Likewise.
- * aout-cris.c: Likewise.
- * aout-encap.c: Likewise.
- * aout-ns32k.c: Likewise.
- * aout-target.h: Likewise.
- * aout-tic30.c: Likewise.
-
-2000-11-05 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Always permit
- BFDs containing no sections to be merged, regardless of their flags.
-
-2000-11-04 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_relocate_section): Suppress error message
- if a relocation for an undefined symbol also results in an
- overflow.
-
-2000-11-06 Christopher Faylor <cgf@cygnus.com>
-
- * config.bfd: Add support for Sun Chorus.
-
-2000-11-05 David O'Brien <obrien@FreeBSD.org>
-
- * configure.in: Recognize alpha-*-freebsd*.
- * configure: Regenerate.
-
-2000-11-02 Luciano Gemme <ishitawa@yahoo.com>
-
- * srec.c (CHUNK): Rename to DEFAULT_CHUNK.
- (Chunk): New global variable set by a parameter in objcopy.c.
- (S3Forced): New global variable set by a parameter in
- objcopy.c.
- (srec_set_section_contents): If S3Forced is true, always generate
- S3 records.
- (srec_write_section): Use 'Chunk' to limit maximum length of S
- records.
-
-2000-11-02 Per Lundberg <plundis@chaosdev.org>
-
- * config.bfd: Add support for i[3456]86-chaosdev-storm-chaos.
- * Makefile.in: Regenerate.
- * bfd-in2.h: Regenerate.
- * po/bfd.pot: Regenerate.
-
-2000-10-31 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Only handle
- EF_SOFT_FLOAT if it is defined.
-
-2000-10-27 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_copy_private_bfd_data): Don't refuse
- attempts to mix PIC code with non-PIC, just mark the output as
- being position dependent.
- (elf32_arm_merge_private_bfd_data): Likewise. Print an error
- message for EF_SOFT_FLOAT mismatches. Display diagnostics for
- all mismatches, not just the first one.
-
-2000-10-25 Chris Demetriou <cgd@sibyte.com>
-
- * ieee.c (ieee_archive_p): Plug one of many possible
- memory leaks in error handling.
-
-2000-10-20 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data,
- elf32_sparc_object_p, elf32_sparc_final_write_processing):
- Support v8plusb.
- * elf64-sparc.c (sparc64_elf_merge_private_bfd_data,
- sparc64_elf_object_p): Support v9b.
- * archures.c: Declare v8plusb and v9b machines.
- * bfd-in2.h: Ditto.
- * cpu-sparc.c: Ditto.
-
-2000-10-16 Geoffrey Keating <geoffk@shoggoth.cygnus.com>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Clear the location
- of a GOT reloc.
-
- * elf32-ppc.c (SYMBOL_REFERENCES_LOCAL): New macro.
- (SYMBOL_CALLS_LOCAL): New macro.
- (ppc_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
- (ppc_elf_check_relocs): Use SYMBOL_REFERENCES_LOCAL.
- (ppc_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.
- (ppc_elf_relocate_section): Use flag variable to determine
- whether the relocation refers to a local symbol.
- Test whether a PLTREL24 reloc will produce a reloc by looking
- to see whether a PLT entry was made.
-
-2000-10-14 Geoffrey Keating <geoffk@shoggoth.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make PLT
- entries that could serve as a definition for a weak symbol.
-
-2000-10-13 Ulf Carlsson <ulfc@engr.sgi.com>
-
- From Ralf Baechle <ralf@gnu.org>
-
- * elf32-mips.c (mips_elf_create_dynamic_relocation): New argument
- local_p. Add symbol value only for non-R_MIPS_REL32 relocations
- against local symbols.
- (_bfd_mips_elf_finish_dynamic_sections): Undo patch from 2000-10-01.
-
-2000-10-12 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (struct sec): Add kept_section.
- (struct bfd_comdat_info): Remove sec, we can use above.
- (STD_SECTION): Add initializer.
- (bfd_make_section_anyway): Init here too.
-
- * bfd-in2.h: Regenerate.
-
- * elflink.h (elf_link_add_object_symbols): Remove unnecessary
- zeroing of `flags'.
- (elf_link_input_bfd): Set all asection->symbol->value's here, and
- fudge values for discarded link-once section symbols.
-
- * elf64-hppa.c: Include alloca-conf.h
-
-2000-10-11 Alan Modra <alan@linuxcare.com.au>
-
- * elf.c (swap_out_syms): Revert 2000-10-07 changes.
-
- * ieee.c (ieee_make_empty_symbol): Oops, bfd_zalloc needs another arg.
-
-2000-10-10 Alan Modra <alan@linuxcare.com.au>
-
- * ieee.c (ieee_make_empty_symbol): Use bfd_zalloc, not bfd_zmalloc.
-
-2000-10-10 Tom Rix <trix@redhat.com>
-
- * section.c (bfd_make_section_anyway): Release newsect ptr when
- newsect->symbol fails to alloc. Use bfd_release instead of free.
-
-2000-10-09 Richard Henderson <rth@cygnus.com
-
- * elf64-ia64.c (elf64_ia64_unwind_entry_compare_bfd): New.
- (elf64_ia64_unwind_entry_compare): New.
- (elf64_ia64_final_link): Sort the .IA_64.unwind section.
-
-2000-10-07 Alan Modra <alan@linuxcare.com.au>
-
- * elflink.h (size_dynamic_sections): Don't create various tags if
- .dynstr is excluded from the link. Don't set first dynsym entry
- if dynsymcount is zero.
- (elf_bfd_final_link): Don't try to swap out dynamic syms if
- .dynsym excluded from the link. Don't try to write any dynamic
- sections excluded from the link.
-
- * elf.c (swap_out_syms): Handle global section symbols.
-
-2000-10-05 DJ Delorie <dj@redhat.com>
-
- * peigen.c (_bfd_pei_swap_scnhdr_out): note extended relocs
- * coffcode.h (coff_set_alignment_hook): read extended reloc count
- (coff_write_relocs): write extended reloc count
- (coff_write_object_contents): account for extended relocs
-
-2000-10-05 Jim Wilson <wilson@cygnus.com>
-
- * elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags
- field.
- * elf.c (_bfd_elf_make_section_from_shdr): Call the
- elf_backend_section_flags function.
- * elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion
- code.
- (elf64_ia64_section_flags): New function containing flag conversion
- code.
- (elf_backend_section_flags): Define to elf64_ia64_section_flags.
- * elfxx-target.h (elf_backend_section_flags): Define.
- (elfNN_bed): Initialize elf_backend_section_flags field.
-
-2000-10-02 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Correct call to
- _bfd_elf32_gc_record_vtable. Correct a comment.
-
-2000-10-01 Ulf Carlsson <ulfc@engr.sgi.com>
-
- From Ralf Baechle <ralf@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_finish_dynamic_sections): Mark gld
- produces binaries with got[1] = 0x80000001 to differenciate them
- for the dynamic linker from the broken binaries produced by old
- versions.
-
-2000-09-30 Petr Sorfa <petrs@sco.com>
-
- * elf.c (elfcore_grok_pstatus): Check for size of pxstatus_t.
- (elfcore_grok_lwpstatus): Check for size of lwpxstatus_t.
- * configure.in: Add check for pxstatus_t and lwpxstatus_t.
- * configure: Regenerate.
-
-2000-09-27 Hans-Peter Nilsson <hp@axis.com>
-
- Define two bfd_targets for absence and presence of leading
- underscore on symbols. Make sure to only link same kind.
- * elf32-cris.c (cris_elf_object_p,
- cris_elf_final_write_processing, cris_elf_print_private_bfd_data,
- cris_elf_merge_private_bfd_data): New.
- (elf_backend_object_p, elf_backend_final_write_processing,
- bfd_elf32_bfd_print_private_bfd_data,
- bfd_elf32_bfd_merge_private_bfd_data): Define.
- <Target vector definition>: Include elf32-target.h twice with
- different macro settings:
- (TARGET_LITTLE_SYM): First as bfd_elf32_cris_vec, then as
- bfd_elf32_us_cris_vec.
- (TARGET_LITTLE_NAME): First as "elf32-cris", then "elf32-us-cris".
- (elf_symbol_leading_char): First as 0, then '_'.
- (INCLUDED_TARGET_FILE): Define for second include of elf32-target.h.
- * config.bfd (cris-*-*): Add bfd_elf32_us_cris_vec to targ_selvecs.
- * configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vector.
- * configure: Regenerate.
- * targets.c: Declare bfd_elf32_us_cris_vec.
- * po/bfd.pot: Regenerate.
-
-2000-09-29 Momchil Velikov <velco@fadata.bg>
-
- * elf32-arm.h (arm_add_to_rel): Correctly adjust the addend for
- R_ARM_THM_PC22 relocations.
-
-2000-09-29 NIIBE Yutaka <gniibe@chroot.org>
-
- * elflink.h (elf_link_add_object_symbols): Don't bfd_release runpath.
-
-2000-09-29 Momchil Velikov <velco@fadata.bg>
-
- * elf.c (elf_fake_sections): Do not mark the section SHT_NOBITS if
- is has the SEC_HAS_CONTENTS flag set.
-
-2000-09-28 Örjan Friberg <orjanf@axis.com>
- Hans-Peter Nilsson <hp@axis.com>
-
- * aout-cris.c (N_TXTADDR): Define.
-
-2000-09-28 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * som.c: Include alloca-conf.h.
- * Makefile.am: "make dep-am"
- * Makefile.in: Regenerate.
-
-2000-09-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (plt_stub): New.
- (PLT_STUB_ENTRY): Define.
- (elf32_hppa_link_hash_table): Change multi_subspace to packed
- boolean. Add need_plt_stub, has_12bit_branch and has_17bit_branch.
- (elf32_hppa_link_hash_table_create): Init to suit.
- (elf32_hppa_check_relocs): Set has_12bit_branch and
- has_17bit_branch as appropriate.
- (elf32_hppa_adjust_dynamic_symbol): Set need_plt_stub for
- non-local functions.
- (elf32_hppa_size_dynamic_sections): Correct setting of reltext.
- Add space for plt_stub as needed.
- (elf32_hppa_finish_dynamic_symbol): Point .plt entries for global
- functions at plt_stub.
- (elf32_hppa_finish_dynamic_sections): Write plt_stub.
- (elf32_hppa_create_dynamic_sections): Leave .plt executable.
-
- * elf32-hppa.h (elf32_hppa_size_stubs): Add group_size param.
- * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. Use it instead
- of fixed size, and if negative, disable handling of input sections
- before stub section. Set up default stub group size depending
- on detected branch relocs.
- (hppa_build_one_stub): Use lrsel and rrsel for import stubs to
- ensure different offsets from sym_value aren't rounded to
- different 2k blocks. Use lrsel and rrsel for other stubs too for
- consistency rather than necessity.
- (elf32_hppa_check_relocs): Handle R_PARISC_DIR14F.
- (final_link_relocate): Likewise.
- (elf32_hppa_relocate_section): Likewise.
-
- * elf-hppa.h (elf_hppa_howto_table): Add R_PARISC_DIR14F reloc.
- (_bfd_elf_hppa_gen_reloc_type): Generate them.
- (elf_hppa_final_link_relocate): Handle them.
- (elf_hppa_relocate_insn): Likewise.
- (_bfd_elf_hppa_gen_reloc_type): Add missing e_ldsel and e_rdsel cases.
-
-2000-09-26 Hans-Peter Nilsson <hp@axis.com>
-
- * elfcode.h (elf_object_p): Preserve and clear abfd section
- information. Restore at error.
-
-2000-09-26 Paul Sokolovsky <Paul.Sokolovsky@technologist.com>
-
- * peigen.c (_bfd_pei_swap_aouthdr_in): If some DataDirectory
- is empty, make sure that its rva also 0. NT loader dislikes
- having otherwise.
-
-2000-09-26 Steve Ellcey <sje@cup.hp.com>
-
- * som.c (som_bfd_derive_misc_symbol_info): Make weak symbols
- global by default.
-
-2000-09-21 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Fix weak sym handling in
- currently unused RELATIVE_DYNAMIC_RELOCS code.
- (hppa_discard_copies): Likewise.
- (elf32_hppa_size_stubs): Size `input_list' array correctly. Correct
- comments. Don't check non-code output sections for stub grouping.
-
-2000-09-20 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_get_unique_section_name): Return NULL if
- bfd_malloc fails.
-
-2000-09-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * elf32-m68k.c (elf_cpu32_plt0_entry): Change the PLT entry 0
- instruction sequence to actually work.
- (elf_m68k_finish_dynamic_sections): Change the patch-in offset
- accordingly.
-
-2000-09-18 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_relocate_section): Use
- _bfd_final_link_relocate to apply the relocation against a section
- symbol, when doing relocatable links.
-
-2000-09-18 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_stub_hash_entry): Rename input_section
- to id_sec.
- (stub_hash_newfunc): Here too.
- (hppa_add_stub): And here.
- (elf32_hppa_link_hash_table): Remove stub_section_created,
- reloc_section_created, first_init_sec and first_fini_sec. Add
- stub_group.
- (elf32_hppa_link_hash_table_create): Init to suit.
- (hppa_get_stub_entry): Add support for grouping stub sections.
- (hppa_add_stub): Likewise. Remove sec_count param and init/fini
- section code. Index stub vars by section->id.
- (elf32_hppa_size_stubs): Likewise. Remove duplicated function
- exit paths. Zap allocation of above removed vars. Refine
- link-once test.
-
- * elf32-hppa.h (elf32_hppa_size_stubs): Add output_bfd param.
- * elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
- (hppa_get_stub_entry): Pass in pointer to elf32_hppa_link_hash_table
- rather than pointer to bfd_link_info.
- (hppa_add_stub): Likewise.
- (final_link_relocate): Likewise.
-
-2000-09-17 David Huggins-Daines <dhd@linuxcare.com>
-
- (elf32_hppa_size_stubs): Don't try to build stubs for discarded
- link-once sections.
-
-2000-09-16 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (ELF_MAXPAGESIZE): Define to 128, to match
- ld/emulparams/shelf.sh.
-
-2000-09-10 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): New function.
- * bfd-in.h (bfd_m68k_elf32_create_embedded_relocs): Add declaration.
- * bfd-in2.h: Regenerate.
-
-2000-09-15 Kenneth Block <Kenneth.Block@compaq.com>
-
- * elf64-alpha.c (elf64_alpha_relax_with_lituse): ld performs
- LITUSE relocations incorrectly if -relax is specified on the ld
- command line and the displacement field of the load or store
- instruction is non-zero. (Patch by paul.winalski@compaq.com)
-
-2000-09-15 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (hppa_add_stub): Dont set first_init_sec and
- first_fini_sec here.
- (elf32_hppa_size_stubs): Instead correctly find the first .init
- and .fini section here.
-
-2000-09-15 David Huggins-Daines <dhd@linuxcare.com>
-
- * elf32-hppa.c (clobber_millicode_symbols): New function.
- (elf32_hppa_size_dynamic_sections): Call it.
-
-2000-09-14 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_link_hash_entry): Make pic_call
- packed. Add plabel, plt_abs packed booleans.
- (hppa_link_hash_newfunc): Init new fields.
- (PLABEL_PLT_ENTRY_SIZE): Define.
- (hppa_stub_name): Use size_t len vars.
- (hppa_add_stub): Likewise.
- (elf32_hppa_build_stubs): Likewise.
- (hppa_build_one_stub): Kill some compiler warnings.
- (elf32_hppa_check_relocs): Always generate a plt entry for PLABELs
- if dynamic linking. Munge the local plt offsets into
- local_got_refcounts. Set h->plabel for all global PLABELs. Use
- size_t len vars. Add assert for plabel addend.
- (elf32_hppa_gc_sweep_hook): Sweep local plt entries too.
- (elf32_hppa_hide_symbol): New function.
- (elf_backend_hide_symbol): Define.
- (elf32_hppa_adjust_dynamic_symbol): Don't throw away plt entries
- with h->plabel set. Don't make plt entries to have dynamic syms
- when they have been forced local. If plt entry is used by a
- plabel, make it PLABEL_PLT_ENTRY_SIZE.
- (elf32_hppa_size_dynamic_sections): Set plt_abs for init fns.
- Set up .plt offsets for local syms.
- (elf32_hppa_relocate_section): Initialise plt entries for local
- syms. Leave weak undefined plabels zero. Make global plabel
- relocs against function symbol, and leave the addend zero.
- Use *ABS* DIR32 relocs instead of SEGREL32 for dynamic got relocs.
- (elf32_hppa_finish_dynamic_symbol): Set up IPLT relocs for
- non-dynamic syms. Init extra plt for plabels. Use *ABS* DIR32
- relocs instead of SEGREL32 for dynamic got relocs.
- (elf32_hppa_finish_dynamic_sections): Reserve one more .got entry.
- (elf_backend_got_header_size): Adjust.
- (elf32_hppa_set_gp): Calculate an "ideal" LTP.
-
- * elf32-hppa.c (LONG_BRANCH_VIA_PLT): Define.
- (hppa_type_of_stub): Use it instead of #if 0
- (hppa_discard_copies): Use it here too.
- (elf32_hppa_size_dynamic_sections): And here.
-
- * elf32-hppa.c (elf32_hppa_link_hash_table): Remove `offset' field.
- (elf32_hppa_link_hash_table_create): And here.
- (hppa_build_one_stub): And here. Instead keep track of stub
- offset using _raw_size.
- (elf32_hppa_size_stubs): Likewise.
- (elf32_hppa_build_stubs): Likewise.
- (hppa_size_one_stub): Likewise. Resize reloc section too.
-
- * elf32-hppa.c (hppa_add_stub): Correct first_init_sec and
- first_fini_sec handling. Don't search for reloc section or set
- hplink->reloc_section_created here.
- (elf32_hppa_size_stubs): Instead search for reloc sections, and
- set reloc_section_created here.
- (hppa_handle_PIC_calls): Set ELF_LINK_HASH_NEEDS_PLT.
- (elf32_hppa_size_dynamic_sections): Make a .plt entry for DT_INIT
- and DT_FINI.
- (elf32_hppa_finish_dynamic_sections): Set DT_INIT and DT_FINI.
-
- * elf32-hppa.c (hppa_build_one_stub): Replace `elf_hash_table (info)'
- with `hplink->root.'.
- (elf32_hppa_check_relocs): Likewise.
- (elf32_hppa_gc_sweep_hook): Likewise.
- (elf32_hppa_adjust_dynamic_symbol): Likewise.
- (hppa_handle_PIC_calls): Likewise.
- (elf32_hppa_size_dynamic_sections): Likewise.
- (elf32_hppa_set_gp): Likewise.
- (elf32_hppa_relocate_section): Likewise.
- (elf32_hppa_finish_dynamic_symbol): Likewise.
- (elf32_hppa_finish_dynamic_sections): Likewise.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf32-hppa.c (hppa_type_of_stub): Generate import stubs for
- defined weak symbols in shared links.
- (final_link_relocate): Calls to defined weak symbols in shared
- objects must go via import stubs, as the target might not be known
- at link time.
-
-2000-09-14 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_howto_table): Moved R_SH_GOT32, R_SH_PLT32,
- R_SH_COPY, R_SH_GLOB_DAT, R_SH_JMP_SLOT, R_SH_RELATIVE,
- R_SH_GOTOFF, R_SH_GOTPC) to the range from 160 to 167. Replaced
- the original entries with EMPTY_HOWTOs, and added new ones to fill
- in the gap.
- (sh_elf_info_to_howto): Make sure the new gap isn't used.
- (sh_elf_relocate_section): Likewise.
-
-2000-09-13 Anders Norlander <anorland@acc.umu.se>
-
- * cpu-mips.c (arch_info_struct): Add mips:4K
- * bfd-in2.h (bfd_mach_mips4K): New define.
- * archures.c: Add bfd_mach_mips4K to comment.
- * elf32-mips.c (_bfd_mips_elf_final_write_processing): Return
- E_MIPS_ARCH_2 for bfd_mach_mips4K.
-
-2000-09-13 Marco Franzen <marcof@thyron.com>
-
- * som.c (som_write_symbol_strings): Do not used fixed buffers,
- use size_t as a counter.
- (som_write_space_strings): Similarly.
-
-2000-09-12 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_pc26): New function
- and prototype.
- (elf32_i860_relocate_section): Invoke new function from here.
-
-2000-09-11 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Make debug_sec_names
- static.
-
-2000-09-10 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Emit 8 NULs for
- target section name instead of dumping core when the target symbol is
- undefined.
-
-2000-09-09 Kazu Hirata <kazu@hxi.com>
-
- * riscix.c: Remove DEFUN.
-
-2000-09-08 Nick Clifton <nickc@redhat.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Do not
- initialise flags in output bfd if the input bfd is the default
- architecture with the default flags.
-
-2000-09-08 Kazu Hirata <kazu@hxi.com>
-
- * archive.c: Fix formatting.
- * coff-arm.c: Likewise.
- * doc/chew.c: Likewise.
-
-2000-09-08 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_get_unique_section_name): Put a dot before the
- numeric suffix.
-
-2000-09-07 Kazu Hirata <kazu@hxi.com>
-
- * doc/chew.c: Remove all uses of DEFUN and DEFUN_VOID.
- * elf.c: Fix formatting.
-
-2000-09-07 Alexandre Oliva <aoliva@redhat.com>
-
- * config.bfd (sh-*-linux*): Added.
- * configure.in (bfd_elf32_shlin_vec, bfd_elf32_shblin_vec): New.
- * targets.c: Declare them.
- * elf32-sh-lin.c: New file.
- * Makefile.am: Compile it.
- * elf32-sh.c: Don't override defines from elf32-sh-lin.c.
- * configure, Makefile.in: Rebuilt.
-
-2000-09-06 Geoffrey Keating <geoffk@cygnus.com>
-
- * xcofflink.c (xcoff_link_input_bfd): Include the .tocbss
- pseduo-section when determining where the TOC ends.
-
- * coff-rs6000.c (_bfd_xcoff_swap_aux_out): Use bfd_h_put_16 to
- output x_tvndx as it is only two bytes wide.
-
- * coff-rs6000.c (xcoff_howto_table): A modifiable branch-absolute
- reloc is 26 or 32 bits wide.
-
- * coff-rs6000.c (_bfd_xcoff_rtype2howto): The bitsize is irrelevant
- for relocs that don't change anything. Also look at the full
- 6 bits of bitsize.
-
-2000-09-06 Philip Blundell <philb@gnu.org>
-
- * config.bfd (arm*-*-uclinux*): New target.
-
-2000-09-06 Alexandre Oliva <aoliva@redhat.com>
-
- * configure: Rebuilt with new libtool.m4.
-
-2000-09-06 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_get_unique_section_name): Avoid c++ reserved
- word for variable name.
- * bfd-in2.h: Regenerate.
-
-2000-09-05 Nick Clifton <nickc@redhat.com>
-
- * config.in: Regenerate.
- * libbfd.h: Regenerate.
- * po/bfd.pot: Regenerate.
- * doc/bfdint.texi: Remove CVS date string - it foils compares with
- local versions.
-
-2000-09-05 Steven Johnson <sbjohnson@ozemail.com.au>
-
- * cpu-powerpc.c (arch_info_struct): Added MPC860 Family entry.
-
-2000-09-05 Alan Modra <alan@linuxcare.com.au>
-
- Shared library and PIC support.
- * elf32-hppa.c (PLT_ENTRY_SIZE): New.
- (GOT_ENTRY_SIZE): New.
- (ELF_DYNAMIC_INTERPRETER): New.
- (STUB_SUFFIX): Define.
- (LONG_BRANCH_PIC_IN_SHLIB): Define.
- (RELATIVE_DYNAMIC_RELOCS): Define.
- (enum elf32_hppa_stub_type): New.
- (struct elf32_hppa_stub_hash_entry): Rename offset to
- stub_offset. Add a number of new fields.
- (struct elf32_hppa_link_hash_entry): New.
- (struct elf32_hppa_link_hash_table): Add numerous fields. Remove
- global_value.
- (elf32_hppa_hash_table): Rename to hppa_link_hash_table.
- (elf32_hppa_stub_hash_lookup): Rename to hppa_stub_hash_lookup.
- (elf32_hppa_stub_hash_newfunc): Rename to stub_hash_newfunc. Init
- new fields.
- (hppa_link_hash_newfunc): New function.
- (elf32_hppa_link_hash_table_create): Use above function. Init new
- fields.
- (elf32_hppa_stub_name): Rename to hppa_stub_name. Pass in reloc
- instead of addend, and remove sym_name from args. Don't use
- symbol name for local syms, instead use sym index.
- (elf32_hppa_size_of_stub): Rename to hppa_type_of_stub, and return
- stub type rather than size. Pass in hash and handle import stub
- case. Also pass in reloc instead of offset so we can calculate
- PCREL22F and PCREL12F branches properly.
- (elf32_hppa_build_one_stub): Rename to hppa_build_one_stub. Build
- import and export stubs too.
- (elf32_hppa_size_one_stub): Rename to hppa_size_one_stub. Handle
- import and export stub sizing.
- (elf32_hppa_check_relocs): New function.
- (elf32_hppa_adjust_dynamic_symbol): New function.
- (hppa_discard_copies): New function.
- (elf32_hppa_size_dynamic_sections): New function.
- (elf_backend_size_dynamic_sections): Define.
- (elf32_hppa_finish_dynamic_symbol): New function.
- (elf_backend_finish_dynamic_symbol): Define.
- (elf32_hppa_size_stubs): Stash params in link hash table, and move
- some local vars into the link hash table too. For shared links,
- trundle over function syms, generating export stubs. Handle
- PCREL22F branches. Break out stub creation code from here..
- (hppa_add_stub): .. to here. New function.
- (elf32_hppa_final_link): Rename to elf32_hppa_set_gp, and don't
- call the bfd linker. Use elf_gp to record global pointer.
- Calculate a value from sections if $global$ is missing.
- (bfd_elf32_bfd_final_link): Define as _bfd_elf32_gc_common_final_link.
- (elf32_hppa_gc_mark_hook): New function.
- (elf_backend_gc_mark_hook): Define.
- (elf32_hppa_gc_sweep_hook): New function.
- (elf_backend_gc_sweep_hook): Define.
- (elf32_hppa_bfd_final_link_relocate): Rename to final_link_relocate.
- Add rel to args, and remove howto, input_bfd, offset, addend,
- sym_name as we can recalculate these locally. Handle calls to
- dynamic objects, extra PIC relocs, PCREL22F branches. Change
- handling of undefined weak syms. Check that stubs are in range.
- Only look for import stubs on PCREL17F and PCREL22F relocs. Add
- message on hitting a DPREL21L reloc that needs fixing. Subtract
- off PC for PCREL14F. Break out code that does a stub lookup from
- here..
- (hppa_get_stub_entry): ..to here. New function.
- (elf32_hppa_relocate_insn): Merge into final_link_relocate.
- (elf32_hppa_relocate_section): Handle got and plt relocs, dynamic
- relocs, etc. etc.
- (elf32_hppa_finish_dynamic_sections): New function.
- (elf_backend_finish_dynamic_sections): Define.
- (elf_backend_final_write_processing) Define.
- (hppa_handle_PIC_calls): New function.
- (elf32_hppa_build_stubs): Call it. Pass link_info to
- hppa_build_one_stub.
- (elf32_hppa_create_dynamic_sections): New function
- to create .plt and .got then set .plt flags correctly.
- (elf_backend_create_dynamic_sections): Define.
- (elf32_hppa_object_p): New function.
- (elf_backend_object_p): Define.
- (elf32_hppa_elf_get_symbol_type): New function.
- (elf_backend_get_symbol_type): Define.
- (elf_backend_can_gc_sections): Define.
- (elf_backend_want_got_plt): Define.
- (elf_backend_plt_alignment): Set to 2.
- (elf_backend_plt_readonly): Define.
- (elf_backend_want_plt_sym): Define.
- (elf_backend_got_header_size): Reserve one entry.
-
- * elf32-hppa.h (elf32_hppa_build_stubs): Don't pass stub bfd.
- (elf32_hppa_size_stubs): Pass in multi_subspace.
- (elf32_hppa_set_gp): Declare.
-
- * section.c (SEC_HAS_GOT_REF): Define new flag for asection.
- (bfd_get_unique_section_name): New function.
- * bfd-in2.h: Regenerate.
-
- * elf64-hppa.c (elf64_hppa_check_relocs): Handle R_PARISC_PCREL12F.
- (elf64_hppa_size_dynamic_sections): Remove the FIXME at bfd_zalloc
- comment.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf64-hppa.c (elf64_hppa_check_relocs): Fix a warning.
- (elf64_hppa_mark_exported_functions): Set dyn_h->st_shndx.
- (elf64_hppa_link_output_symbol_hook): Test dyn_h->st_shndx has
- been updated in finish_dynamic_symbol before modifying function
- symbol.
-
- * elf-hppa.h (elf_hppa_howto_table): Restructure into groups of
- eight entries. Replace NULL with bfd_elf_generic_reloc. Add
- R_PARISC_GNU_VTENTRY, R_PARISC_GNU_VTINHERIT and R_PARISC_PCREL12F.
- (_bfd_elf_hppa_gen_reloc_type): Handle R_PARISC_GNU_VT*. Add some
- comments. Handle format == 12 for R_HPPA_PCREL_CALL.
- (elf_hppa_final_link_relocate): Handle R_PARISC_PCREL12F.
- (elf_hppa_relocate_insn): Likewise. Reformat some comments.
- (elf_hppa_final_write_processing): Expose it for ARCH_SIZE == 32.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf-hppa.h (elf_hppa_is_local_label_name): Accept the SysV/ELF
- style of local labels as well.
-
-2000-09-03 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_relocate_section): Don't try to relocate
- references to undefined symbols in debugging sections.
-
-2000-09-02 H.J. Lu <hjl@gnu.org>
-
- * reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
- BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE,
- BFD_RELOC_SH_GOTPC): Move them from the MIPS section to the SH
- section.
-
-2000-09-02 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (bfd_elf32_bfd_is_local_label_name): Define macro.
- (elf32_i860_is_local_label_name): New function and prototype.
-
-2000-09-02 Nick Clifton <nickc@redhat.com>
-
- * configure.in: Increase version number to 2.10.91.
- * configure: Regenerate.
- * aclocal.m4: Regenerate.
- * config.in: Regenerate.
- * po/bfd.pot: Regenerate.
-
-2000-09-02 Daniel Berlin <dberlin@redhat.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Add
- .gnu.linkobce.wi. to the list of debug section names.
-
-2000-09-02 Nick Clifton <nickc@redhat.com>
-
- * dwarf2.c (find_debug_info): New function: Locate a section
- containing dwarf2 debug information.
- (bfd_dwarf2_find_nearest_line): Find all sections containing
- debug information and include them in the stash.
-
-2000-09-01 Niibe Yutaka <gniibe@m17n.org>, Kaz Kojima <kkojima@rr.iij4u.or.jp>, Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT,
- R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): New.
- (sh_reloc_map): Add new relocs.
- (sh_elf_check_relocs, sh_elf_link_hash_newfunc,
- sh_elf_link_hash_table_create, sh_elf_adjust_dynamic_symbol,
- sh_elf_size_dynamic_sections, sh_elf_finish_dynamic_symbol,
- sh_elf_finishe_dynamic_sections, sh_elf_discard_copies): New
- functions.
- (ELF_DYNAMIC_INTERPRETER, PLT_ENTRY_SIZE): Define.
- (elf_sh_plt0_entry_be, elf_sh_plt0_entry_le,
- elf_sh_plt_entry_be, elf_sh_plt_entry_le,
- elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le):
- New array constants.
- (elf_sh_plt0_entry, elf_sh_plt_entry, elf_sh_pic_plt_entry):
- New variables.
- (elf_sh_sizeof_plt, elf_sh_plt_plt0_offset,
- elf_sh_plt0_linker_offset, elf_sh_plt0_gotid_offset,
- elf_sh_plt_temp_offset, elf_sh_plt_symbol_offset,
- elf_sh_plt_reloc_offset): Define.
- (elf_sh_pcrel_relocs_copied, elf_sh_link_hash_entry,
- elf_sh_link_hash_table): New structs.
- (sh_elf_link_hash_traverse, sh_elf_hash_table): New macros.
- (sh_elf_relocate_section, sh_elf_check_relocs): Handle new
- relocation types.
- (elf_backend_create_dynamic_sections,
- bfd_elf32_bfd_link_hash_table_create,
- elf_backend_adjust_dynamic_symbol,
- elf_backend_size_dynamic_sections,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
- elf_backend_plt_readonly, elf_backend_want_plt_sym,
- elf_backend_got_header_size, elf_backend_plt_header_size):
- Define.
- * reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
- BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE, BFD_RELOC_SH_GOTPC):
- New relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-2000-09-01 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-i386.c (elf_i386_finish_dynamic_symbol): Revert 2000-08-27
- change.
-
-2000-08-31 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_merge_private_data): If ibfd's elf header flags
- not initialized, set them to indicate the SH1 instruction set.
-
-2000-08-31 Alexandre Oliva <aoliva@redhat.com>
-
- * acinclude.m4: Include libtool and gettext macros from the
- top level.
- * aclocal.m4, configure: Rebuilt.
-
-2000-08-29 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c: Eliminate references to __sparcv9 macro; replace with
- autoconf variables HAVE_PSINFO32_T etc.
- * configure.in: Auto-configure HAVE_PSINFO_32_T, HAVE_PRPSINFO32_T,
- HAVE_PSTATUS32_T, HAVE_PRSTATUS32_T, HAVE_PRSTATUS32_T_PR_WHO.
- * config.in: Ditto.
- * acinclude.m4 (BFD_HAVE_SYS_PROCFS_TYPE) define _SYSCALL32 so it can
- detect the above typedefs. (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Ditto.
- * aclocal.m4: Ditto.
- * configure: Regenerate.
-
-2000-08-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-i386.c (elf_i386_check_relocs): Keep info on relocs copied
- for any shared link, not just shared -Bsymbolic.
- (elf_i386_size_dynamic_sections): Call elf_i386_discard_copies on
- any shared link, and pass link info to it.
- (elf_i386_size_dynamic_sections): Update comment.
- (elf_i386_discard_copies): Modify to discard relocs for symbols
- that have been forced local.
- (elf_i386_finish_dynamic_symbol): Don't copy relocs for symbols
- that have been forced local.
-
-2000-08-24 Denis Chertykov <denisc@overta.ru> & Nick Clifton <nickc@redhat.com>
-
- * elflink.h (elf_link_add_object_symbols): Allow common
- symbols to have an alignment of 1 if explicitly requested, and
- not overridden by other definitions.
-
-2000-08-22 Doug Kwan <dkwan@transmeta.com>
-
- * coff-w65.c (CREATE_LITTLE_COFF_TARGET): Fix typo.
- * coffcode.h (coff_set_flags): Add detection of w65 architecture.
-
-2000-08-22 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (elf_link_hash_table): Add runpath.
-
- * bfd-in.h (bfd_elf_get_runpath_list): New prototype.
- * bfd-in2.h: Rebuilt.
-
- * elf.c (_bfd_elf_link_hash_table_init): Initialize the
- "runpath" field to NULL.
- (bfd_elf_get_runpath_list): New function.
-
- * elflink.h (elf_link_add_object_symbols): Record DT_RPATH and
- DT_RUNPATH entries.
-
-2000-08-22 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_relocate_section) [R_SH_IND12W,
- R_SH_DIR8WPN, R_SH_DIR8WPZ, R_SH_DIR8WPL]: Handle them
- explicitly. Improve validation of r_type.
-
-2000-08-21 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_size_dynamic_sections): Zero out the
- dynamic allocated content space. Add a comment to remind us that
- one day this ought to be fixed.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
- * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
-
-2000-08-21 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_pc16): Just write the immediate
- field with the newly relocated value instead of adding it to the
- existing immediate field.
- (elf32_i860_relocate_splitn): Likewise.
- (elf32_i860_relocate_highadj): Likewise.
-
-2000-08-16 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_pc16): Implemented function (it
- was previously just a stub).
-
-2000-08-16 Alexandre Oliva <aoliva@redhat.com>
-
- * elflink.c (_bfd_elf_create_got_section): Don't abort().
- Formatting fixes.
- (_bfd_elf_create_dynamic_sections): Likewise.
-
-2000-08-16 Andrew Macleod <amacleod@cygnus.com>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Set relocation address
- for undefined symbols to be the beginning of the section.
-
- * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Don't allocate
- four extra entries at the beginning of the .rela.plt section.
- (sparc64_elf_finish_dynamic_symbol): Adjust the offset in the .rela.plt
- section to account for the four reserved entries in the .plt section.
-
-2000-08-15 Geoffrey Keating <geoffk@cygnus.com>
-
- * xcofflink.c (_bfd_ppc_xcoff_relocate_section): Add ori r0,r0,0
- to the list of NOPs we recognize after a branch-and-link.
- Use the ori NOP when one is needed.
-
- * coff-rs6000.c (_bfd_xcoff_slurp_armap): Finish implementation
- for large archives.
-
-2000-08-14 Jim Wilson <wilson@cygnus.com>
-
- * elf64-ia64.c (elf64_ia64_merge_private_bfd_data): Handle
- EF_IA_64_REDUCEDFP, EF_IA_64_CONS_GP, and EF_IA_64_NOFUNCDESC_CONS_GP.
- (elf64_ia64_print_private_bfd_data): Likewise. Also handle
- EF_IA_64_ABSOLUTE.
-
-2000-08-11 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_set_mach_from_flags): Make it static.
-
-2000-08-10 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_section): New function.
- (i860_final_link_relocate): New function.
- (elf32_i860_relocate_splitn): New function.
- (elf32_i860_relocate_pc16): New function.
- (elf32_i860_relocate_highadj): New function.
- (elf32_i860_howto): Minor adjustments to some relocations.
- (elf_info_to_howto_rel): Define.
- (elf_backend_relocate_section): Define.
-
-2000-08-10 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h: Fix formatting.
-
-2000-08-10 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_reloc_loop): Make LAST_SYMBOL_SECTION static.
-
-2000-08-08 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_howto_table): Updated some fields.
-
-2000-08-07 Kazu Hirata <kazu@hxi.com>
-
- * ieee.c (ieee_write_debug_part): Rewrite a comment.
- * elf64-ia64.c: Fix a typo.
-
-2000-08-05 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_howto_table): New structure.
- (lookup_howto): New function.
- (elf32_i860_reloc_type_lookup): New function.
- (elf32_i860_info_to_howto_rela): New function.
- (elf_code_to_howto_index): New structure.
- (elf_info_to_howto): Re-define as elf32_i860_info_to_howto_rela.
- (bfd_elf32_bfd_reloc_type_lookup): Re-define as
- elf32_i860_reloc_type_lookup.
-
-2000-08-04 Rodney Brown <RodneyBrown@pmsc.com>
-
- * som.c (struct fixup_format): Constify `format'.
- (som_hppa_howto_table): Use SOM_HOWTO macro.
- (try_prev_fixup, hppa_som_reloc): Decorate unused parameter.
- (som_bfd_reloc_type_lookup): Likewise.
- (compare_subspaces): Remove unused `count1', `count2'.
- (som_begin_writing): Remove unused `total_reloc_size'.
- (som_bfd_derive_misc_symbol_info): Decorate unused parameter.
- (som_print_symbol, som_bfd_is_local_label_name): Likewise.
- (som_set_reloc_info): Constify `cp'. Remove unused `addend'.
- (som_find_nearest_line): Decorate unused parameter(s).
- (som_sizeof_headers, som_get_symbol_info, som_write_armap): Likewise.
- (som_bfd_link_split_section): Likewise.
-
-2000-08-03 Nick Clifton <nickc@cygnus.com>
-
- * section.c: Restore backed out code.
- * elf.c: Restore backed out code.
- (copy_private_bfd_data): Fix bug preventing stipped dynamic
- binaries from working.
- * bfd-in2.h: Regenerate.
-
-2000-08-03 H.J. Lu <hjl@gnu.org>
-
- * section.c: Back out the change made by Nick Clifton
- <nickc@cygnus.com> on 2000-07-31. It breaks stripping dynamic
- binaries.
- * bfd-in2.h: Likewise.
- * elf.c: Likewise.
-
-2000-08-03 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_reloc_loop): Warning removal.
-
-2000-07-31 Jason Eckhardt <jle@cygnus.com>
-
- * reloc.c (BFD_RELOC_860_*): New bfd relocs for i860.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2000-07-31 Nick Clifton <nickc@cygnus.com>
-
- * section.c (struct sec): Add new boolean field 'segment_mark'.
- (STD_SECTION): Initialise new field to zero.
-
- * bfd-in2.h: Regenerate.
-
- * elf.c (copy_private_bfd_data): Reorganise section to segment
- mapping to cope with moved sections requiring new segments,
- and overlapping segments.
- (SEGMENT_END): New macro: Return the end address of a segment.
- (IS_CONTAINED_BY_VMA): New macro: Determine if a segment
- contains a section by comparing their VMA addresses.
- (IS_CONTAINED_BY_LMA): New macro: Determine if a segment
- contains a section by comparing their LMA addresses.
- (INCLUDE_SECTION_IN_SEGMENT): New macro: Determine if a
- section should be included in a segment.
- (SEGMENT_AFTER_SEGMENT): New macro: Determine if one segment
- follows another in memory.
- (SEGMENT_OVERLAPS_SEGMENT): New macro: Determine if two
- segments overlap.
-
-2000-07-22 Jason Eckhardt <jle@cygnus.com>
-
- * cpu-i860.c: Added comments.
-
- * elf32-i860.c (TARGET_LITTLE_SYM): Defined to
- bfd_elf32_i860_little_vec.
- (TARGET_LITTLE_NAME): Defined to "elf32-i860-little".
- (ELF_MAXPAGESIZE): Changed to 4096.
-
- * targets.c (bfd_elf32_i860_little_vec): Declaration of
- new target.
- (bfd_target_vector): Added bfd_elf32_i860_little_vec.
-
- * config.bfd (i860-stardent-sysv4*, i860-stardent-elf*): Added
- config for little endian elf32 i860.
- (targ_defvec): Define for the new config above
- as "bfd_elf32_i860_little_vec".
- (targ_selvecs): Define for the new config above
- as "bfd_elf32_i860_vec bfd_elf32_i860_little_vec"
-
- * configure.in (bfd_elf32_i860_little_vec): Added recognition
- of new target vec.
-
- * configure: Regenerated.
-
-2000-07-27 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_merge_symbol): Take one more argument,
- dt_needed, to indicate if the symbol comes from a DT_NEEDED
- entry. Don't overide the existing weak definition if dt_needed
- is true.
- (elf_link_add_object_symbols): Pass dt_needed to
- elf_merge_symbol ().
-
-2000-07-27 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (elf_link_size_reloc_section): Zeroes the section's
- allocated contents.
-
-2000-07-25 Geoffrey Keating <geoffk@cygnus.com>
-
- * configure.host (*-*-aix*): AIX has 'long long' always.
-
- * coff-rs6000.c (xcoff_write_one_armap_big): New procedure.
- (xcoff_write_armap_big): Write both 32-bit and 64-bit armaps.
- (xcoff_write_archive_contents_big): Don't update the offset
- of the symbol table, xcoff_write_armap will do it.
-
-2000-07-23 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c (_bfd_mips_elf_check_relocs): Use abfd instead
- of dynobj for SGI_COMPAT checks.
-
-2000-07-21 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): New function.
- * bfd-in.h (bfd_m68k_coff_create_embedded_relocs): Add declaration.
- * bfd-in2.h: Regenerate.
-
-2000-07-21 Nick Clifton <nickc@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_check_relocs): Detect out of
- range symbol indices in relocs and issue an error message.
-
-2000-07-20 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Don't check
- info->new_dtags when setting DT_FLAGS_1. It will only be set
- by the new linker options. It shouldn't break anything.
-
-2000-07-20 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set DT_FLAGS_1
- only if info->new_dtags is true.
-
-2000-07-20 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set
- DT_RUNPATH and DT_FLAGS only if info->new_dtags is true.
-
-2000-07-20 Hans-Peter Nilsson <hp@axis.com>
-
- * Makefile.am (ALL_MACHINES): Add cpu-cris.lo.
- (ALL_MACHINES_CFILES): Add cpu-cris.c.
- (BFD32_BACKENDS): Add aout-cris.lo and elf32-cris.lo.
- (BFD32_BACKENDS_CFILES): Add aout-cris.c and elf32-cris.c.
- (cpu-cris.lo, aout-cris.lo, elf32-cris.lo): New rules.
- * Makefile.in: Rebuild.
- * aclocal.m4: Rebuild.
- * aoutx.h (NAME(aout,machine_type)): Add case for bfd_arch_cris.
- * archures.c (enum bfd_architecture): Add bfd_arch_cris.
- (bfd_cris_arch): Declare.
- (bfd_archures_list): Add bfd_cris_arch.
- * bfd-in2.h: Rebuild.
- * config.bfd: (cris-*-*): New target.
- * configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vectors.
- * configure: Rebuild.
- * elf.c (prep_headers): Add bfd_arch_cris.
- * libbfd.h: Rebuild.
- * libaout.h (enum machine_type): Add M_CRIS.
- * reloc.c: Add CRIS relocations.
- * targets.c (bfd_elf32_cris_vec, cris_aout_vec): Declare.
- (bfd_target_vect): Add bfd_elf32_cris_vec and cris_aout_vec.
- * cpu-cris.c, aout-cris.c, elf32-cris.c: New files.
- * po/POTFILES.in, po/bfd.pot: Regenerate.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf32-arm.h (elf32_arm_size_dynamic_sections): Also set
- DF_TEXTREL if DT_TEXTREL is set.
- * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
- * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
- * elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise.
- * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also
- set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if
- DT_RPATH is set.
- Set the DT_FLAGS and DT_FLAGS_1 entries if necessary.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * bfd-in.h (bfd_elf_set_dt_needed_soname): New.
- * bfd-in2.h: Rebuild.
-
- * elf-bfd.h (elf_obj_tdata): Add dt_soname.
- (elf_dt_soname): New.
-
- * elf.c (bfd_elf_set_dt_needed_soname): New.
-
- * elflink.h (elf_link_add_object_symbols): Add the DT_NEEDED
- entry if the shared object loaded by DT_NEEDED is used to
- resolve the reference in a regular object.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_CONFIG,
- DT_DEPAUDIT and DT_AUDIT as strings.
-
-2000-07-19 Nick Clifton <nickc@cygnus.com>
-
- * format.c: Fix formatting.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_print_private_bfd_data): Fix DT_CHECKSUM.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_BIND_NOW,
- DT_INIT_ARRAY, DT_FINI_ARRAY, DT_INIT_ARRAYSZ, DT_FINI_ARRAYSZ,
- DT_RUNPATH, DT_FLAGS, DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ,
- DT_PLTPADSZ, DT_MOVEENT, DT_MOVESZ, DT_FEATURE, DT_POSFLAG_1,
- DT_SYMINSZ, DT_SYMINENT, DT_CONFIG, DT_DEPAUDIT, DT_AUDIT,
- DT_PLTPAD, DT_MOVETAB, DT_SYMINFO, DT_RELACOUNT, DT_RELCOUNT,
- DT_FLAGS_1, DT_USED and DT_CHECKSUM.
-
-2000-07-18 Andrew Cagney <cagney@b1.cygnus.com>
-
- * elf.c (bfd_elf_get_sign_extend_vma, bfd_elf_get_arch_size): Move
- renamed functions from here...
- (assign_section_numbers): Use renamed functions.
- (prep_headers): Use renamed functions.
-
- * bfd.c (bfd_get_sign_extend_vma, bfd_get_arch_size): ...To here.
- * bfd-in.h (bfd_get_sign_extend_vma, bfd_get_arch_size): Update.
- * bfd-in2.h: Regenerate.
-
-2000-07-18 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Add
- parenthesis in if statement.
-
-2000-07-17 Koundinya K <kk@ddeorg.soft.net>
-
- Enable the support for Traditional MIPS.
- * elf32-mips.c (IRIX_COMPAT): Recognize bfd_elf32_tradbigmips_vecand
- return ict_none appropriately for traditional mips targets.
- (STUB_LW): Change 0x8f998000 to 0x8f998010 for traditional mips.
- (STUB_MOVE): Conditionalize for traditonal mips.
- (STUB_LI16): Likewise.
- (_bfd_mips_elf_modify_segment_map): Conditionalize to avoid making
- room for RTPROC header.
- (_bfd_mips_elf_modify_segment_map): For a normal mips executable set
- the permission for the PT_DYNAMIC as read, write and execute.
- (mips_elf_calculate_relocation): Check for the symbol _DYNAMIC_LINKING
- for traditonal mips.
- (_bfd_mips_elf_create_dynamic_sections): Add the symbol
- _DYNAMIC_LINKING for traditonal mips.
- (_bfd_mips_elf_create_dynamic_sections): Add the symbol __RLD_MAP
- in case of traditonal mips.
- (_bfd_mips_elf_adjust_dynamic_symbol): Create a stub only if a PLT
- entry is required. For a function if PLT is not required then set the
- corresponding hash table entry to 0.
- (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG entry for
- traditonal mips.
- (_bfd_mips_elf_finish_dynamic_symbol): for a undefined symbol in a
- shared object set the value to 0.
- (_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol
- _DYNAMIC_LINKING for traditonal mips.
- (_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol __RLD_MAP
- for traditonal mips.
-
-2000-07-15 H.J. Lu <hjl@gnu.org>
-
- * aoutx.h (translate_to_native_sym_flags): Handle BSF_LOCAL.
-
-2000-07-12 Charles Wilson <cwilson@ece.gatech.edu>
-
- * libbfd.c (bfd_seek): fix 'seek beyond EOF' error when writing
- out a structure that is BFD_IN_MEMORY.
-
-2000-07-11 Alan Modra <alan@linuxcare.com.au>
-
- * elf64-hppa.c (get_dyn_name): Pass in section pointer instead of
- bfd pointer. Print section id instead of bfd pointer for local
- syms. Prefix addend with `+' for global syms as well as local.
- Correct calculation of name component lengths.
- (elf64_hppa_check_relocs): Update call to get_dyn_name.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf-hppa.h (elf_hppa_relocate_section): Update calls here too.
- * elf64-hppa.c (elf64_hppa_check_relocs): Fix some warnings.
- (elf64_hppa_modify_segment_map): Likewise.
-
-2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
-
- * elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA
- addresses to be "naturally" sign extended. Return -1 if unknown.
- * bfd-in.h (bfd_elf_get_sign_extend_vma): Add declaration.
- * bfd-in2.h: Regenerate.
-
-2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
-
- * ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32
- and ECOF_SIGNED_64 to list ways to extract an offset.
- (ecoff_swap_fdr_in, ecoff_swap_fdr_out, ecoff_swap_pdr_in,
- ecoff_swap_pdr_out, ecoff_swap_ext_in, ecoff_swap_ext_out):
- Update.
- * elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64.
- * elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32.
-
-2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
-
- * elfcode.h (elf_object_p): Use bfd_set_start_address and not
- bfd_get_start_address.
- (elf_swap_ehdr_in): Sign extend e_entry when applicable.
- (elf_swap_ehdr_out): Ditto.
-
-2000-07-10 Alexander Aganichev <AAganichev@hypercom.com>
-
- * archures.c (bfd_default_scan): Add set of bfd_mach_ cases for
- compatibility with older binutils.
-
-2000-07-10 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_make_section_anyway): Start section_id at 0x10.
- (STD_SECTION): Avoid negative ids, instead use 0 to 3.
-
- From Ryan Bradetich <rbradetich@uswest.net>
- * dwarf1.c (parse_die): Cure signed/unsigned char warnings.
- (parse_line_table): Ditto.
- (_bfd_dwarf1_find_nearest_line): Ditto.
- * syms.c (cmpindexentry): Remove extra `*' from params.
-
-2000-07-09 Koundinya K <kk@ddeorg.soft.net>
-
- * elf32-mips.c (sort_dynamic_relocs): New Function.
- (_bfd_mips_elf_finish_dynamic_sections): Call sort_dynamic_relocs
- via qsort to sort the dynamic relocations in increasing r_symndx
- value.
-
-2000-07-09 Alan Modra <alan@linuxcare.com.au>
-
- * elf64-hppa.c (elf64_hppa_dyn_hash_table_init): Add
- ATTRIBUTE_UNUSED to unused args.
- (get_opd): Likewise.
- (get_plt): Likewise.
- (get_dlt): Likewise.
- (get_stub): Likewise.
- (elf64_hppa_adjust_dynamic_symbol): Likewise.
- (elf64_hppa_link_output_symbol_hook): Likewise.
- (elf64_hppa_check_relocs): Delete unused var.
- (elf64_hppa_size_dynamic_sections): Likewise.
- (elf64_hppa_finalize_opd): Likewise.
- (elf64_hppa_finalize_dynreloc): Likewise.
- (elf64_hppa_modify_segment_map): Likewise.
- (elf64_hppa_finish_dynamic_sections): Likewise.
-
- * elf-hppa.h (elf_hppa_final_write_processing): Add
- ATTRIBUTE_UNUSED to unused args.
- (elf_hppa_final_link_relocate): Likewise.
- (elf_hppa_record_segment_addrs): Add paretheses.
- (elf_hppa_relocate_section): Constify dyn_name.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * config.bfd: Add hppa*64*-*-linux-gnu 64-bit target, and
- rearrange case statement so that it gets preferred to 32-bit ones.
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Use
- asection->id instead of address of asection structure.
- (elf32_hppa_size_stubs): Likewise.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Use just one stub section
- for .init* and .fini*.
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Mask pointers
- and addends used in stub names to 32 bits.
- (elf32_hppa_size_stubs): Likewise.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Don't sum addend
- twice for R_PARISC_GPREL64. Use bfd_put_32 for R_PARISC_PCREL32,
- not bfd_put_64. Fix minor comment typo and formatting.
-
- Changes to create multiple linker stubs, positioned immediately
- before the section where they are required.
- * elf32-hppa.c: Don't include hppa_stubs.h.
- (elf32_hppa_stub_hash_entry): Add a pointer to the stub section.
- (elf32_hppa_stub_hash_table): Delete.
- (elf32_hppa_link_hash_entry): Delete.
- (elf32_hppa_link_hash_table): Use plain bfd_hash_table for
- stub_hash_table, and store the struct here rather than a pointer.
- Delete output_symbol_count. Add offset array. Change
- global_value to a bfd_vma.
- (elf32_hppa_stub_hash_lookup): Use table instead of table->root.
- (elf32_hppa_stub_hash_traverse): Delete.
- (elf32_hppa_name_of_stub): Delete.
- (elf32_hppa_link_hash_lookup): Delete.
- (elf32_hppa_link_hash_traverse): Delete.
- (elf32_hppa_stub_hash_table_init): Delete.
- (elf32_hppa_size_of_stub): Pass input section and offset rather
- than location and calculate location here. Don't pass name as all
- stubs are now the same size.
- (elf32_hppa_stub_hash_newfunc): Init new fields.
- (elf32_hppa_link_hash_table_create): Likewise, and stub_hash_table
- too.
- (elf32_hppa_bfd_final_link_relocate): Cast enums to int before
- comparing against ints. Rewrite stub handling code.
- (elf32_hppa_relocate_section): Make r_type and r_symndx unsigned.
- Case enums to int before comparing against ints. Remove
- bfd_reloc_dangerous case.
- (elf32_hppa_build_one_stub): Rewrite.
- (elf32_hppa_size_one_stub): New function.
- (elf32_hppa_build_stubs): Rewrite.
- (elf32_hppa_size_stubs): Pass in linker call-back functions.
- Rewrite stub-handling specific code.
-
- * elf32-hppa.h (elf32_hppa_size_stubs): Update prototype.
-
- * elf64-hppa.c (elf64_hppa_dyn_hash_entry): Fix a comment typo.
-
- * hppa_stubs.h: Delete.
- * Makefile.am (SOURCE_HFILES): Remove hppa_stubs.h
- (elf32-hppa.lo): Remove hppa_stubs.h from dependencies.
- * Makefile.in: Regenerate.
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle e_nlsel and
- e_nlrsel.
-
- * libhppa.h (hppa_field_adjust): Correct e_nsel case.
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Mention the offset
- and section name for bfd_reloc_notsupported error message.
- (elf32_hppa_bfd_final_link_relocate): Print reasons for returning
- bfd_reloc_notsupported.
- (elf32_hppa_relocate_section): Add ATTRIBUTE_UNUSED to output_bfd.
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Handle
- undefined weak symbols for all relocs.
- (elf32_hppa_size_of_stub): Adjust calculation by 8 since branch
- offsets are relative to one past the delay slot.
- (elf32_hppa_size_stubs): Account for reloc addend when calculating
- branch destination. Put addend into stub name too.
- (elf32_hppa_bfd_final_link_relocate): Account for reloc addend and
- adjust by 8 when deciding whether a linker stub is needed. Put
- addend into stub name as for above.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Change signed/unsigned on
- various args and vars.
- (elf32_hppa_bfd_final_link_relocate): Here too.
- (elf32_hppa_size_stubs): Rename index -> indx. Use e_indx for
- inner block var to avoid shadowing.
-
- * elf32-hppa.h (_bfd_elf32_hppa_gen_reloc_type): Make `field' arg
- unsigned.
- * elf64-hppa.h (_bfd_elf64_hppa_gen_reloc_type): Ditto.
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Ditto.
- (elf_hppa_fake_sections): Rename local var to avoid shadowing.
-
- * libhppa.h: Change practically all unsigned ints to plain ints.
- Remove tests on gcc version. Instead use ATTRIBUTE_UNUSED for
- prototypes.
-
- From Ryan Bradetich <rbradetich@uswest.net>
- * libhppa.h (hppa_opcode_type): New enum to replace #define's.
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Modify to
- suit above.
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf-hppa.h (elf_hppa_relocate_insn): Update the opcode constants
- to the new OP_* ones.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Consolidate freeing on
- error exit. Bail out earlier on plabel relocs that we aren't
- interested in. Don't tell elf32_hppa_stub_hash_lookup to copy
- string, and then don't free our copy.
- (elf32_hppa_build_one_stub): Make insn unsigned int.
-
- * libhppa.h (bfd_hppa_insn2fmt): 22 bit branches are only
- available with BL, not BE and BLE.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Add some more example
- code for elf arg relocs.
- (elf32_hppa_bfd_final_link_relocate): Replace boolean is_local
- argument with elf_link_hash_entry h. Handle undefined weak
- symbols. Move $global$ lookup from here...
- (elf32_hppa_relocate_section): ...to here. Return correct error
- message for non-handled relocs.
- (elf32_hppa_size_of_stub): Correctly test branch range. Previous
- wrong test was -0x3ffff to +0x40000.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): R_PARISC_DIR17R,
- R_PARISC_DIR17F, and R_PARISC_DIR21L are for absolute branches;
- Handle them as such.
- (elf_hppa_relocate_insn): Fix a typo.
-
- * libhppa.h (GET_FIELD, GET_BIT, MASK, CATENATE, ELEVEN): Delete.
- (assemble_3, assemble_6, assemble_12, assemble_16, assemble_16a,
- assemble_17, assemble_21): Delete.
- Supply defines for all 64 possible opcodes.
- (bfd_hppa_insn2fmt): Add bfd argument, and use to select wide mode
- formats. Handle COMICLR.
- (hppa_rebuild_insn): Delete bfd argument. Handle formats 10, -11,
- -10, -16, 16, 22.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Complete rewrite.
- (elf32_hppa_bfd_final_link_relocate): Major rewrite.
- (elf32_hppa_build_one_stub): Modify hppa_elf_relocate_insn calls
- to suit.
- (elf32_hppa_size_stubs): Don't free stub_name twice. Read in all
- the local syms - did this code get deleted accidentally? Ignore
- undefined and undefweak syms.
-
- * elf-hppa.h (elf_hppa_final_link): Move hppa_info to outermost
- block. Use it instead of elf64_hppa_hash_table (info).
- (elf_hppa_final_link_relocate): Use hppa_info instead of
- elf64_hppa_hash_table (info).
-
- * libhppa.h (re_assemble_3, re_assemble_12, re_assemble_16,
- re_assemble_17, re_assemble_21, re_assemble_22): Don't mask insn.
- (hppa_rebuild_insn): Mask immediate bits here instead.
- * elf-hppa.h (elf_hppa_relocate_insn): Mask here too.
-
-2000-07-08 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (struct sec): Add id field. Tidy comment formatting.
- (bfd_make_section_anyway): Set id.
- (STD_SECTION): Init id too.
- Change CONST to const throughout.
- * archures.c (bfd_arch_info): Tidy comment.
- (bfd_arch_list): Change a CONST to const.
- * libbfd-in.h: Tidy comments and replace CONST with const.
- * elf-bfd.h: Likewise.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * libcoff.h: Regenerate.
-
-2000-07-07 DJ Delorie <dj@redhat.com>
-
- * archive.c (_bfd_write_archive_contents): Add an informative
- comment.
-
-2000-07-06 Kazu Hirata <kazu@hxi.com>
-
- * srec.c: Fix formatting.
-
-2000-06-05 DJ Delorie <dj@redhat.com>
-
- * MAINTAINERS: new
-
-2000-07-04 Alexandre Oliva <aoliva@redhat.com>
-
- * coff-arm.c (coff_arm_relocate_section): Do not ignore the symbol
- value of PC-relative offsets.
-
-2000-07-03 Jim Wilson <wilson@cygnus.com>
-
- * elf64-alpha.c (alpha_elf_size_info): New.
- (elf_backend_size_info): Define to alpha_elf_size_info.
- * elfcode.h (elf_size_info): Change hash bucket size to 4.
-
-2000-07-03 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c: Include elf32-target.h again for the traditional
- MIPS targets.
-
-2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
-
- * elf32-avr.c (bfd_elf32_bfd_reloc_type_lookup):
- Add ATTRIBUTE_UNUSED to unused arguments to avoid warnings.
- (avr_info_to_howto_rela): Likewise.
- (elf32_avr_gc_mark_hook): Likewise.
- (elf32_avr_gc_sweep_hook): Likewise.
- (elf32_avr_relocate_section): Likewise.
-
-2000-07-03 Mark Elbrecht <snowball3@bigfoot.com>
-
- * cofflink.c (_bfd_coff_write_global_sym): Turn a weak symbol into
- an external symbol for a non-shared, non-relocatable link.
-
-2000-07-03 Nick Clifton <nickc@redhat.com>
-
- * cofflink.c (IS_EXTERNAL): New macro: Return true if the symbol
- is an external symbol.
- (IS_WEAK_EXTERNAL): New macro: Return true if the symbol is a weak
- external symbol.
-
-2000-07-03 Kazu Hirata <kazu@hxi.com>
-
- * reloc16.c: Fix formatting.
-
-2000-07-01 Koundinya K <kk@ddeorg.soft.net>
-
- * config.bfd: Change targ_defvec and targ_selvecs for mips*-*-sysv4*
- to add a new target for traditional mips i.e
- bfd_elf32_tradbigmips_vec and bfd_elf32_tradlittlemips_vec.
- * configure.in: Likewise.
- * configure: Rebuild.
- * targets.c (bfd_elf32_tradbigmips_vec): Declare and put in
- bfd_target_vector.
- (bfd_elf32_tradlittlemips_vec): Likewise.
- * elfxx-target.h: Add macro INCLUDED_TARGET_FILE which is more a test
- to see that elfNN_bed does not get redefined even if the target file
- is included twice for a chip. See elf32-mips.c.
-
-2000-07-01 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.am (DEP): Fix 2000-06-22. grep after running dep.sed
- (CLEANFILES): Add DEPA.
- * Makefile.in: Regenerate.
-
-2000-06-30 DJ Delorie <dj@cygnus.com>
-
- * peicode.h (coff_swap_filehdr_in): can't use e_magic because we
- can't assume the PE header is at 0x80.
-
-2000-06-29 Mark Elbrecht <snowball3@bigfoot.com>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Use IS_ABSOLUTE_PATH.
-
-2000-06-28 Mark Elbrecht <snowball3@bigfoot.com>
-
- * go32stub.h: Update stub.
-
-2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
-
- * archures.c (bfd_mach_avr5): Define.
- * bfd-in2.h (bfd_mach_avr5): Define.
- * cpu-avr.c (arch_info_struct): Rename bfd_mach_avr4 to
- bfd_mach_avr5, add bfd_mach_avr4. Update comments.
- (compatible): Update comment. Add missing test.
- * elf32-avr.c (avr_final_link_relocate): Support 8K wrap
- for avr2 and avr4. Simplify 8K wrap code.
- (bfd_elf_avr_final_write_processing): Recognize bfd_mach_avr5.
- (elf32_avr_object_p): Recognize E_AVR_MACH_AVR5.
-
-2000-06-26 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c: Fix formatting.
- * cpu-h8300.c: Likewise.
-
-2000-06-24 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Print `(local)'
- for local symbols whose names are unknown.
-
-2000-06-22 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.am (DEP): grep for leading `/' in DEP1, and fail if we
- find one.
- * Makefile.in: Regenerate.
- * doc/Makefile.in: Regenerate.
-
-2000-06-20 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am: Rebuild dependency.
- * Makefile.in: Rebuild.
-
-2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): New function.
- (elf_backend_copy_indirect_symbol): Map to the new function.
-
-2000-06-20 Alan Modra <alan@linuxcare.com.au>
-
- * archive.c (normalize): Correct pointer comparison when checking
- for backslashes.
- (bfd_bsd_truncate_arname): Likewise.
- (bfd_gnu_truncate_arname): Likewise.
-
-2000-06-20 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf-bfd.h (struct elf_obj_tdata): Define per BFD Irix 5 virtual
- sections elf_{text,data}_{section,symbol}.
- * elf32-mips.c: mips_elf_{text,data}_{section,symbol}{,_ptr}: Remove.
- (_bfd_mips_elf_hide_symbol): New function.
- (elf_backend_hide_symbol): Map to the new function.
- (_bfd_mips_elf_add_symbol_hook): Change to use new per BFD
- definitions of mips_elf_{text,data}_{section,symbol}.
- (mips_elf_local_relocation_p): Try to find the direct symbol
- based on new check_forced argument.
- (mips_elf_calculate_relocation): Use new version of
- mips_elf_local_relocation_p.
- (mips_elf_relocate_section): Likewise.
- (_bfd_mips_elf_relocate_section): Likewise.
- (mips_elf_sort_hash_table): Only assert that have enough GOT
- space.
- (mips_elf_got16_entry): Match all 32 bits to the existing GOT
- entry if the relocation based on the new external argument.
- (mips_elf_create_dynamic_relocation): Assert that we have a
- section contents allocated where we can swap out the dynamic
- relocations.
- (mips_elf_calculate_relocation): Find the real hash-table entry
- correctly by using h->root.root.type. Only create a dynamic
- relocation entry if the symbol is defined in a shared library.
- Create an external GOT entry for the GOT16 relocation if the
- symbol was forced local.
- (_bfd_mips_elf_finish_dynamic_symbol): Don't assert there is a
- dynamic index if the symbol was forced local.
-
-2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c: Fix typos in comments.
-
-2000-06-19 Mark Kettenis <kettenis@gnu.org>
-
- * rs6000-core.c: Wrap definition of `union VmInfo' within #ifdef
- CORE_VERSION_1.
-
-2000-06-18 Stephane Carrez <stcarrez@worldnet.fr>
-
- * Makefile.in, bfd-in2.h, libbfd.h, configure: Rebuild.
- * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES, BFD32_BACKENDS,
- BFD32_BACKENDS_CFILES): Add 68hc12, 68hc11 files.
- * configure.in (bfd_elf32_m68hc12_vec): Recognize.
- (bfd_elf32_m68hc11_vec): Likewise.
- * config.bfd (targ_cpu): Recognize 68hc12 and 68hc11.
- Supports 68hc11 & 68hc12 at the same time.
- * targets.c (bfd_elf32_m68hc12_vec): Declare and put in
- bfd_target_vector.
- (bfd_elf32_m68hc11_vec): Likewise.
- * elf.c (prep_headers): Recognize bfd_arch_m68hc12 and 68hc11.
- * archures.c (bfd_m68hc12_arch): Define and register in global list
- (bfd_m68hc11_arch): Likewise.
- * reloc.c (BFD_RELOC_M68HC11_HI8, BFD_RELOC_M68HC11_LO8,
- BFD_RELOC_M68HC11_3B): Define.
- * cpu-m68hc12.c, elf32-m68hc12.c: New files for 68hc12 support.
- * cpu-m68hc11.c, elf32-m68hc11.c: New files for 68hc11 support.
-
-2000-06-18 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf_bfd.h (struct elf_backend_data): Add info argument to
- elf_backend_hide_symbol.
- (_bfd_elf_link_hash_hide_symbol): Likewise.
- * elf.c (_bfd_elf_link_hash_hide_symbol): Likewise.
- * elf64-ia64.c (elf64_ia64_hash_hide_symbol): Likewise.
- * elflink.h (elf_link_add_object_symbols): Likewise.
- (elf_link_assign_sym_version): Likewise.
-
-2000-06-18 H.J. Lu <hjl@gnu.org>
-
- * coff-i386.c (coff_i386_reloc): Don't return in case of
- output_bfd == (bfd *) NULL if COFF_WITH_PE is defined.
- Compensate PE relocations when linking with non-PE object
- files to generate a non-PE executable.
-
-2000-06-17 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Explicitly write
- GOT entries if we're doing a static link or -Bsymbolic link.
-
-2000-06-15 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elflink.h (elf_link_adjust_relocs): Check for and call backend
- specifific swap_reloc_{in,out} and swap_reloca_{in,out} if
- available.
- (elf_link_output_relocs): Likewise.
- (elf_reloc_link_order): Likewise.
-
-2000-06-16 Nicholas Duffek <nsd@redhat.com>
-
- * archures.c (enum bfd_architecture): #define constants for
- PowerPc and RS6000 machine numbers.
- * bfd-in2.h: Regenerate.
- * coffcode.h (coff_set_arch_mach_hook): #ifdef XCOFF64, set arch
- to bfd_arch_powerpc instead of bfd_arch_rs6000. Refer to PowerPc
- and RS6000 machine numbers using #defined constants from
- archures.c.
- * cpu-powerpc.c (arch_info_struct): Refer to PowerPc and RS6000
- machine numbers using #defined constants from archures.c. Add
- entries for EC603e, 630, A35, RS64II, RS64III, 7400. Specify
- 64-bit words in 620 entry.
- * cpu-rs6000.c (arch_info_struct): Create with entries for RS1,
- RSC, and RS2.
- (bfd_rs6000_arch): Change default machine to 0 (bfd_mach_rs6k).
-
-2000-06-16 Nicholas Duffek <nsd@cygnus.com>
-
- * coffcode.h (coff_mkobject_hook): Set xcoff_tdata.xcoff64.
- * libcoff-in.h (struct xcoff_tdata): Define xcoff64 field.
- * libcoff.h (struct xcoff_tdata): Define xcoff64 field.
-
-2000-06-16 Nicholas Duffek <nsd@redhat.com>
-
- * bfd-in.h (bfd_family_coff): Define.
- * bfd-in2.h: Regenerate.
- * coffgen.c (coff_count_linenumbers, coff_symbol_from,
- coff_find_nearest_line): Check COFFness using bfd_family_coff()
- instead of bfd_target_coff_flavour.
- * cofflink.c (_bfd_coff_final_link): Likewise.
- * cpu-ns32k.c (do_ns32k_reloc): Don't strcmp() target name to
- exclude XCOFF files.
- * reloc.c (bfd_perform_relocation, bfd_install_relocation):
- Likewise.
- * targets.c (enum bfd_flavour): Add bfd_target_xcoff_flavour.
- * xcoff-target.h (TARGET_SYM): Use bfd_target_xcoff_flavour.
- * xcofflink.c (XCOFF_XVECP): Delete.
- (bfd_xcoff_link_record_set, bfd_xcoff_import_symbol,
- bfd_xcoff_export_symbol, bfd_xcoff_link_count_reloc,
- bfd_xcoff_record_link_assignment,
- bfd_xcoff_size_dynamic_sections): Replace XCOFF_XVECP() with
- check for bfd_target_xcoff_flavour.
-
-2000-06-16 Nicholas Duffek <nsd@redhat.com>
-
- * rs6000-core.c: Support 64-bit core files, support pre-4.3 core
- files on AIX 4.3.
- (read_hdr): New function.
- (rs6000coff_core_p): Store mstsave or __context64 struct instead
- of trying to extract individual registers. Set abfd->arch_info
- to match the architecture that created the core file.
- (rs6000coff_get_section_contents): Delete.
- * xcoff-target.h (rs6000coff_get_section_contents): Delete.
-
-2000-06-14 H.J. Lu <hjl@gnu.org>
-
- * vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_rec)
- is NULL.
-
-2000-06-13 H.J. Lu <hjl@gnu.org>
-
- * configure: Regenerate.
-
-2000-06-13 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * peicode.h (pe_ILF_object_p): Use TARGET_LITTLE_SYM instead of
- armpei_little_vec.
-
-2000-06-08 David O'Brien <obrien@FreeBSD.org>
-
- * configure.in (VERSION): Update to show this is the CVS mainline.
-
-2000-06-07 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-d10v.c: Include elf/d10v.h
- (enum reloc_type): Delete.
- * elf32-d30v.c: Include elf/d30v.h
- (enum reloc_type): Delete.
-
- * Makefile.am: Run "make dep-am" to regenerate dependencies.
- * Makefile.in: Regenerate.
-
- * elf32-i386.c (elf_howto_table): Remove EMPTY_HOWTOs.
- (elf32_i386_vtinherit_howto, elf32_i386_vtentry_howto): Delete and
- move HOWTOs into elf_howto_table.
- (R_386_standard, R_386_ext_offset): Define.
- (R_386_ext, R_386_vt_offset, R_386_vt): Define.
- (elf_i386_reloc_type_lookup): Modify calculation of index into
- elf_howto_table since we've removed the padding.
- (elf_i386_info_to_howto_rel): Likewise.
- (elf_i386_relocate_section): Likewise.
-
-2000-06-06 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c (elf_grok_pr_status): Eliminate reference to prgregset_t.
-
-2000-06-05 H.J. Lu <hjl@gnu.org>
-
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
- an error when seeing an undefined symbol with hidden/internal
- attribute. It is handled in *_relocate_section ().
-
-2000-06-05 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_fix_symbol_flags): Follow the link for the
- indirect symbol for the ELF_LINK_NON_ELF bit.
- (elf_link_output_extsym): Don't output the indirect symbol even
- if the ELF_LINK_NON_ELF bit is set.
-
-2000-06-01 J.T. Conklin <jtc@redback.com>
-
- * config.bfd (i[3456]86-*-netbsdelf*): New target.
- (i[3456]86-*-netbsdaout*): New target.
- (i[3456]86-*-netbsd*): Add bfd_elf32_i386_vec to targ_selvecs.
- (i[3456]86-*-openbsd*): Likewise.
-
-2000-05-30 Andrew Cagney <cagney@b1.cygnus.com>
-
- * trad-core.c: From hpux-core.c, include <dirent.h> or
- <sys/ndir.h> when possible.
-
-2000-05-31 Ulrich Drepper <drepper@redhat.com>
-
- * elf.c (_bfd_elf_slurp_version_tables): Correct reading of version
- definitions. We must not assume they are sorted in the file
- according to their index numbers.
-
-2000-05-31 Alan Modra <alan@linuxcare.com.au>
-
- * elf-hppa.h: (elf_hppa_final_link_relocate): Use e_rsel field
- selector for R_PARISC_PCREL17R. R_PARISC_DIR17R and
- R_PARISC_DIR17F are for absolute branches; Handle them as such.
-
-2000-05-30 Nick Clifton <nickc@cygnus.com>
-
- * cpu-i960.c (scan_960_mach): Accept 80960KA, 80960KB,
- 80960CA, 80960MC as valid machine names.
-
-2000-05-30 H.J. Lu <hjl@gnu.org>
-
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Clear the
- visibility bits if the symbol is undefined. Correctly handle
- weak undefined symbols with hidden and internal attributes.
-
- * elflink.h (elf_link_add_object_symbols): Always turn the
- symbol into local if it has the hidden or internal attribute.
-
-2000-05-29 Philip Blundell <philb@gnu.org>
-
- * ppcboot.c: Add packed attribute if compiling with GCC.
-
-2000-05-29 Anatoly Vorobey <mellon@pobox.com>
-
- * elf.c (_bfd_elf_link_hash_table_init): Initialize dynlocal.
-
-2000-05-26 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c (elfcore_grok_prstatus, elfcore_grok_pstatus,
- elfcore_grok_psinfo): Add code to allow debugging a 32-bit
- corefile on a 64-bit (Sparc Solaris) host. Also clean up
- a few old comments.
-
-2000-05-26 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.am: Update dependencies with "make dep-am"
- * Makefile.in: Regenerate.
-
- * sysdep.h (gettext, dgettext, dcgettext, textdomain,
- bindtextdomain): Replace defines with those from intl/libgettext.h
- to quieten gcc warnings.
-
-2000-05-26 Eli Zaretskii <eliz@is.elta.co.il>
-
- * aoutx.h (find_nearest_line): Use IS_ABSOLUTE_PATH.
-
- * archive.c (normalize, bfd_bsd_truncate_arname,
- bfd_gnu_truncate_arname) [HAVE_DOS_BASED_FILE_SYSTEM]: Support
- file names with backslashes.
-
- * cache.c (bfd_open_file) [__MSDOS__]: Don't unlink the file
- before opening it.
-
- * sysdep.h: Include filenames.h.
-
-2000-05-26 Alan Modra <alan@linuxcare.com.au>
-
- * opncls.c (bfd_close_all_done): Mask file perms with 0777 not 0x777.
-
-2000-05-26 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c (sparc64_elf_relax_section): New.
- (sparc64_elf_relocate_section): Optimize tail call into branch always
- if possible.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- (elf32_sparc_relax_section): New.
-
-2000-05-26 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c: Add ATTRIBUTE_UNUSED to unused function parameters.
- Remove unusued variables.
- (sparc64_elf_relocate_section): Change r_symndx type to unsigned long.
- (sparc64_elf_merge_private_bfd_data): Fix shared library case from
- previous fix, so that shared libs really don't influence targets
- extension mask and memory model.
-
-2000-05-23 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Check
- h->root.other not h->other.
- * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Fix a typo.
-
-2000-05-23 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_relocate_section): Don't allow the
- undefined symbol with the non-default visibility attributes.
- * elf-hppa.h (elf_hppa_relocate_section): Likewise.
- * elf32-arm.h (elf32_arm_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-ia64.c (elf64_ia64_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2000-05-22 Richard Henderson <rth@cygnus.com>
-
- * elf64-ia64.c (ia64_howto_table): Add PCREL60B, PCREL21BI,
- PCREL22, PCREL64I. Zero size of special relocs.
- (elf64_ia64_reloc_type_lookup): Likewise.
- (USE_BRL, oor_brl, oor_ip): New.
- (elf64_ia64_relax_section): New.
- (elf64_ia64_check_relocs): Handle PCREL60B, PCREL22, PCREL64I.
- (elf64_ia64_install_value): Likewise, plus PCREL21BI.
- (elf64_ia64_relocate_section): Likewise.
- (bfd_elf64_bfd_relax_section): New.
- * reloc.c (BFD_RELOC_IA64_PCREL21BI): New.
- (BFD_RELOC_IA64_{PCREL22,PCREL60B,PCREL64I}): New.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2000-05-22 Nick Clifton <nickc@cygnus.com>
-
- * configure.in : Add peigen.lo to MIPS PE targets.
- * configure: Regenerate.
-
-2000-05-22 Momchil Velikov <velco@fadata.bg>
-
- * libbfd.c (_bfd_generic_verify_endian_match): Compare endianess
- only if it is known for both input and output bfds. Separate
- error message strings as in some languages, it may be necessary
- to change more than one place in the string to change between
- 'big' and 'little'.
-
- * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Remove inline
- endianess checks, call _bfd_generic_verify_endian_match() instead.
-
- * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
-
- * elf32-mcore.c (mcore_elf_merge_private_bfd_data): Likewise.
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Likewise. Verify
- endianess before checking bfd flavours.
-
-2000-05-22 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_output_extsym): Clear the visibility
- field for symbols not defined locally.
-
-2000-05-18 Alan Modra <alan@linuxcare.com.au>
-
- * libhppa.h (re_assemble_3, re_assemble_12, re_assemble_16,
- re_assemble_17, re_assemble_21, re_assemble_22): Don't mask insn.
- (hppa_rebuild_insn): Mask immediate bits here instead.
- * elf-hppa.h (elf_hppa_relocate_insn): Mask here too.
-
-2000-05-18 Momchil Velikov <velco@fadata.bg>
-
- * elflink.h (elf_bfd_final_link, elf_link_input_bfd): When emiting
- relocs for an executable, ensure that they are virtual addresses.
-
-2000-05-18 Jeffrey A Law (law@cygnus.com)
-
- * config.bfd (hppa*64*-*-hpux11*): New target triplet.
-
-2000-05-17 S. Bharadwaj Yadavalli <sby@scrugs.lkg.dec.com>
- Rick Gorton <gorton@scrugs.lkg.dec.com>
-
- * elflink.h: Add emitrelocations support: when enabled, relocation
- information and relocation sections are put into final output
- executables. If the emitrelocations flag is set, do the following:
- (elf_bfd_final_link): Emit relocation sections.
- (elf_link_input_bfd): Compute relocation section contents.
- (elf_gc_sections): Don't clean relocation sections.
-
-2000-05-16 Catherine Moore <clm@cygnus.com>
-
- * som.c (som_decode_symclass): Recognize weak symbols.
-
-2000-05-16 Szabolcs Szakacsits <szaka@F-Secure.com>
-
- * peigen.c (pe_print_idata): Undo part of 2000-05-12 change that
- read idata section only from dataoff.
- (pe_print_edata): Correctly check for valid eat_member.
-
-2000-05-16 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH8.
-
-2000-05-14 Philip Blundell <philb@gnu.org>
-
- * config.bfd (armeb-*-elf, arm*b-*-linux-gnu*): New targets.
-
-2000-05-12 Alan Modra <alan@linuxcare.com.au>
-
- * targets.c (bfd_target_vector): #ifdef BFD64 rs6000coff64_vec
-
- * peigen.c (pe_print_idata): Look for .idata section and print
- info even if data directory has zero entries. Read idata section
- starting from dataoff, and adjust all data offsets to suit. Cast
- all bfd_vma vars to unsigned long before passing to fprintf.
- * peigen.c (pe_print_edata): Similarly, look for .edata section
- and print info even if data directory has zero entries. Cast
- all bfd_vma vars to unsigned long before passing to fprintf.
-
- From Szabolcs Szakacsits <szaka@F-Secure.com>
- * peigen.c (pe_print_idata): Use bfd_section_size rather than data
- directory size which may be bogus.
- * peigen.c (pe_print_edata): Similarly.
-
-2000-05-09 Alan Modra <alan@linuxcare.com.au>
-
- * elf.c (bfd_section_from_shdr): Don't set use_rela_p if rela
- section is empty.
- (copy_private_bfd_data): Allow for space possibly taken up by elf
- headers when calculating segment physical address from lma.
-
-2000-05-08 Alan Modra <alan@linuxcare.com.au>
-
- * versados.c (versados_scan): Init stringlen and pass_2_done.
-
- * trad-core.c (trad_unix_core_file_p): Return
- bfd_error_wrong_format rather than bfd_error_file_truncated.
-
- * peigen.c (_bfd_pei_swap_aouthdr_out): Pass ImageBase to
- add_data_entry. DataDirectory virtual address is relative.
- (pe_print_idata): Account for relative DataDirectory virtual
- addresses. Don't trash datasize inside POWERPC_LE_PE code.
- (pe_print_edata): Similarly.
-
- From Szabolcs Szakacsits <szaka@F-Secure.com>
- * peigen.c (dir_names): Add Delay Import Directory.
- (pe_print_idata): Always search for bfd section containing
- idata address rather than looking up section name. Print this
- section name rather than .idata.
- (pe_print_edata): Similarly. Also print some fields as %08lx.
- (_bfd_pe_print_private_bfd_data_common): Print Reserved1 field as
- Win32Version.
-
-2000-05-05 Clinton Popetz <cpopetz@cygnus.com>
-
- * xcoff.h: Rename to xcoff-target.h
- * Makefile.am: Change all instances of xcoff.h to xcoff-target.h
- * coff-rs6000.c: Ditto.
- * coff64-rs6000.c: Ditto.
- * coff-pmac.c: Ditto.
- * Makefile.in: Regenerate.
-
-2000-05-05 Clinton Popetz <cpopetz@cygnus.com>
-
- * coffcode.h (coff_set_arch_mach_hook, coff_set_flags):
- Change U802TOC64MAGIC to U803XTOCMAGIC.
-
-2000-05-04 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c (bfd_elf_get_arch_size): New function, return 32 | 64 | -1.
- * bfd-in.h: Prototype bfd_elf_get_arch_size.
- * bfd-in2.h: Prototype bfd_elf_get_arch_size.
-
-2000-05-04 Alan Modra <alan@linuxcare.com.au>
-
- * libhppa.h (HPPA_R_CONSTANT): Cast argument to bfd_signed_vma.
-
-2000-05-03 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * elflink.h (elf_link_add_object_symbols): Reset dynindx for
- hidden and internal symbols.
- (elf_fix_symbol_flags): Clear NEEDS_PLT for symbols with
- visibility.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Do not
- assign a PLT or GOT entry to symbols with hidden and
- internal visibility.
-
-2000-05-03 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Add entry for
- the .bss section.
- * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
-
-2000-05-02 H.J. Lu <hjl@gnu.org>
-
- * elf.c (prep_headers): Use ELFOSABI_NONE instead of
- ELFOSABI_SYSV.
-
-2000-05-02 Alan Modra <alan@linuxcare.com.au>
-
- * targets.c (bfd_target_vector): Restore bfd_elf32_hppa_vec.
- * Makefile.am (BFD32_BACKENDS): Restore elf32-hppa.lo. Regenerate
- dependencies.
- * Makefile.in: Regenerate.
-
-2000-05-01 Jim Wilson <wilson@cygnus.com>
-
- * Makefile.am (BFD32_BACKENDS): Add efi-app-ia32.lo.
- (BFD32_BACKENDS_CFILES): Add efi-app-ia32.c.
- (BFD64_BACKENDS): Delete coff-ia64.lo. Add efi-app-ia64.lo.
- (BFD64_BACKENDS_CFILES): Delete coff-ia64.c. Add efi-app-ia64.c.
- * Makefile.in: Rebuild.
-
-2000-05-02 Alan Modra <alan@linuxcare.com.au>
-
- * config.bfd: Re-enable elf32-hppa. It now compiles, even if it
- doesn't work very well.
-
- * elf-hppa.h (elf_hppa_internal_shdr): Define.
- (elf_hppa_fake_sections): hdr is elf_hppa_internal_shdr.
- Set hdr->s_type to 1 if ARCH_SIZE == 32.
- (_bfd_elf_hppa_gen_reloc_type): Add prototype.
- (elf_hppa_info_to_howto): Likewise.
- (elf_hppa_info_to_howto_rel): Likewise.
- (elf_hppa_reloc_type_lookup): Likewise.
- (elf_hppa_is_local_label_name): Likewise.
- (elf_hppa_fake_sections): Likewise.
- (elf_hppa_final_write_processing): Likewise.
- (elf_hppa_howto_table): Fully initialise all entries.
- (_bfd_elf_hppa_gen_reloc_type): Add ATTRIBUTE_UNUSED to args.
- (elf_hppa_info_to_howto): Likewise.
- (elf_hppa_info_to_howto_rel): Likewise.
- (elf_hppa_reloc_type_lookup): Likewise.
- (elf_hppa_final_write_processing, elf_hppa_add_symbol_hook,
- elf_hppa_unmark_useless_dynamic_symbols,
- elf_hppa_remark_useless_dynamic_symbols,
- elf_hppa_record_segment_addrs, elf_hppa_final_link,
- elf_hppa_relocate_section, elf_hppa_final_link_relocate,
- elf_hppa_relocate_insn): Compile only if ARCH_SIZE == 64 until
- elf32-hppa.c mess is cleaned up.
- (elf_hppa_final_link_relocate): Make insn and r_type unsigned
- int. Delete r_field. In case R_PARISC_PCREL21L, don't set
- r_field then call hppa_field_adjust inline func with variable
- r_field arg, instead call hppa_field_adjust with fixed arg.
- In case R_PARISC_PCREL22F, don't set r_field.
- (elf_hppa_relocate_insn): Change args and return type to unsigned
- int. Call re_assemble_* funcs to do the work.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Don't assume 32 bit when
- sign extending.
-
- * libhppa.h (HPPA_R_CONSTANT): Don't assume 32 bit when sign
- extending.
- (sign_extend): Mask first before sign extending.
- (low_sign_extend): Rewrite without condition expression.
- (ones, dis_assemble_3, dis_assemble_12, dis_assemble_16,
- dis_assemble_17, dis_assemble_21, dis_assemble_22): Delete.
- (assemble_3, assemble_6, assemble_12, assemble_16, assemble_16a,
- assemble_17, assemble_21, sign_unext, low_sign_unext): Return
- result as function return value rather than through pointer arg.
- Accept unsigned int args, and return unsigned int.
- (re_assemble_3): New. Combines function of dis_assemble_3 with
- re-assembly of opcode and immediate.
- (re_assemble_12): Likewise.
- (re_assemble_16): Likewise.
- (re_assemble_17): Likewise.
- (re_assemble_21): Likewise.
- (re_assemble_22): Likewise.
- (hppa_field_adjust): Rewrite and document, paying attention to
- size of types and signed/unsigned issues.
- (get_opcode): Shift before masking.
- (FDLW): Rename to FLDW.
- (bfd_hppa_insn2fmt): Change arg to unsigned int. Delete fmt.
- (hppa_rebuild_insn): Change args and return value to unsigned
- int. Make use of re_assemble_*. Correct case 11.
-
- * dep-in.sed: Handle ../opcodes/.
- * Makefile.am (SOURCE_HFILES): Add elf-hppa.h, elf32-hppa.h,
- elf64-hppa.h, hppa_stubs.h, xcoff.h.
- (BFD32_BACKENDS_CFILES): Restore elf32-hppa.c.
- Remove elf64-hppa.lo, cpu-ia64.lo, elf64-ia64.lo, elfarm-oabi.lo,
- elfarm-nabi.lo dependencies outside of auto-dependency area.
- Regenerate dependencies.
- * Makefile.in: Regenerate.
-
- * configure.in (TRAD_HEADER): Test non-null before
- AC_DEFINE_UNQUOTED.
- * configure: Regenerate.
-
- * reloc.c: Fix mis-spelling in comment.
-
-2000-05-01 Alan Modra <alan@linuxcare.com.au>
-
- * coff-sh.c (bfd_coff_small_swap_table): Fix Fri Apr 28 change.
- * vms.c (vms_openr_next_archived_file): Return NULL.
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * coffcode.h Copy changes mistakenly done to libcoff.h in
- 4/24/2000 patch.
-
-2000-04-29 Andreas Jaeger <aj@suse.de>
-
- * libbfd-in.h: Correctly check GCC version.
- * bfd-in.h: Likewise.
- * libhppa.h: Likewise.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * Makefile.am (BFD64_BACKENDS, BFD64_BACKENDS_CFILES): Add
- coffdu-rs6000.{lo,c}.
- (coff-pmac.lo, coff-rs6000.lo, coff64-rs6000.lo): Add dependency
- on xcoff.h
- * Makefile.in: Regenerate.
- * xcoff.h: New file.
- * coff-pmac.c: Use xcoff.h instead of coff-rs6000.c.
- * coff-rs6000.c: Move all declarations and defines that are
- common to the xcoff backends into xcoff.h
- * coff64-rs6000.c: Ditto,
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * coff-mips.c (mips_ecoff_backend_data): Add initialization of
- _bfd_coff_force_symnames in strings and
- _bfd_coff_debug_string_prefix_length to their default values.
- * coff-sh.c: (bfd_coff_small_swap_table): Ditto.
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * coff-alpha.c (alpha_ecoff_backend_data): Add initialization of
- _bfd_coff_force_symnames in strings and
- _bfd_coff_debug_string_prefix_length to their default values.
-
-2000-04-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-m68k.c (elf_m68k_gc_sweep_hook): Return if dynobj NULL.
- Check local_got_refcounts before dereferencing.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Check splt != NULL
- before deciding we don't need R_PPC_PLT32 relocation.
- (ppc_elf_gc_sweep_hook): Check local_got_refcounts before
- dereferencing.
-
- * elflink.h (elf_gc_common_finalize_got_offsets): Fix comment.
-
- * elf32-i386.c (elf_i386_check_relocs): Reference count .got and
- .plt entries.
- (elf_i386_gc_sweep_hook): Garbage collect .got and .plt entries.
- (elf_i386_adjust_dynamic_symbol): Recognize unused .plt entries.
- (elf_i386_relocate_section): Allow for .plt to go missing.
- (elf_i386_finish_dynamic_symbol): Use same test to decide if we
- can use a relative reloc for got as elf_i386_relocate_section.
- (bfd_elf32_bfd_final_link): Define to use gc form of final link.
-
-2000-04-26 Clinton Popetz <cpopetz@cygnus.com>
-
- * config.bfd: Remove extraneous bfd_powerpc_64_arch.
-
-2000-04-24 Clinton Popetz <cpopetz@cygnus.com>
-
- * Makefile.am (coff64-rs6000.lo): New rule.
- * Makefile.in: Regenerate.
- * coff-rs6000.c (xcoff_mkobject, xcoff_copy_private_bfd_data,
- xcoff_is_local_label_name, xcoff_rtype2howto,
- xcoff_reloc_type_lookup, xcoff_slurp_armap, xcoff_archive_p,
- xcoff_read_ar_hdr, xcoff_openr_next_archived_file, xcoff_write_armap,
- xcoff_write_archive_contents): No longer static, and prefix with _bfd_.
- (NO_COFF_SYMBOLS): Define.
- (xcoff64_swap_sym_in, xcoff64_swap_sym_out, xcoff64_swap_aux_in,
- xcoff64_swap_aux_out): New functions; handle xcoff symbol tables
- internally.
- (MINUS_ONE): New macro.
- (xcoff_howto_tabl, xcoff_reloc_type_lookup): Add 64 bit POS
- relocation.
- (coff_SWAP_sym_in, coff_SWAP_sym_out, coff_SWAP_aux_in,
- coff_SWAP_aux_out): Map to the new functions.
- * coff64-rs6000.c: New file.
- * libcoff.h (bfd_coff_backend_data): Add new fields
- _bfd_coff_force_symnames_in_strings and
- _bfd_coff_debug_string_prefix_length.
- (bfd_coff_force_symnames_in_strings,
- bfd_coff_debug_string_prefix_length): New macros for above fields.
- * coffcode.h (coff_set_arch_mach_hook): Handle XCOFF64 magic.
- Set machine to 620 for XCOFF64. Use bfd_coff_swap_sym_in instead
- of using coff_swap_sym_in directly.
- (FORCE_SYMNAMES_IN_STRINGS): New macro, defined for XCOFF64.
- (coff_set_flags) Set magic for XCOFF64.
- (coff_compute_section_file_positions): Add symbol name length to
- string section length if bfd_coff_debug_string_prefix_length is
- true.
- (coff_write_object_contents): Don't do reloc overflow for XCOFF64.
- (coff_slurp_line_table): Use bfd_coff_swap_lineno_in instead of
- using coff_swap_lineno_in directly.
- (bfd_coff_backend_data): Add _bfd_coff_force_symnames_in_strings
- and _bfd_coff_debug_string_prefix_length fields.
- * coffgen.c (coff_fix_symbol_name, coff_write_symbols): Force
- symbol names into strings table when
- bfd_coff_force_symnames_in_strings is true.
- * coffswap.h (MAX_SCNHDR_NRELOC, MAX_SCNHDR_NLNNO, GET_RELOC_VADDR,
- SET_RELOC_VADDR): New macros.
- (coff_swap_reloc_in, coff_swap_reloc_out): Use above macros.
- (coff_swap_aux_in, coff_swap_aux_out): Remove RS6000COFF_C
- code.
- (coff_swap_aouthdr_in, coff_swap_aouthdr_out): Handle XCOFF64
- changes within RS6000COFF_C specific code.
- (coff_swap_scnhdr_out): Use PUT_SCNHDR_NLNNO, PUT_SCNHDR_NRELOC,
- MAX_SCNHDR_NRELOC, and MAX_SCNHDR_NLNNO.
- * reloc.c (bfd_perform_relocation, bfd_install_relocation):
- Extend existing hack on target name.
- * xcofflink.c (XCOFF_XVECP): Extend existing hack on
- target name.
- * coff-tic54x.c (ticof): Keep up to date with new fields
- in bfd_coff_backend_data.
- * config.bfd: Add bfd_powerpc_64_arch to targ_arch and define
- targ_selvecs to include rs6000coff64_vec for rs6000.
- * configure.in: Add rs6000coff64_vec case.
- * cpu-powerpc.c: New bfd_arch_info_type.
-
-2000-04-24 Jeffrey A Law (law@cygnus.com)
-
- * config.bfd: Only disable elf32-hppa vectors, not all of the
- BSD and OSF configuration support. Provide (disabled) clauses
- for PA64 support.
- * configure.in: Add clause for PA64 support.
- * configure: Rebuilt.
-
- * targets.c (bfd_target_vector): Add bfd_elf64_hppa_vec.
- (bfd_elf64_hppa_vec): Declare.
-
- * Makefile.am (BFD64_BACKENDS): Add elf64-hppa.lo
- (BFD64_BACKENDS_CFILES): Add elf64-hppa.c
- (elf64-hppa.lo): Add dependencies.
- * Makefile.in: Rebuilt.
-
- * elf64-hppa.c, elf64-hppa.h: New files with PA64 support.
-
-2000-04-24 Jason Eckhardt <jle@cygnus.com>
-
- * libhppa.h (dis_assemble_16): New function.
- (pa_arch): Added pa20w element.
-
-2000-04-24 Ulrich Drepper <drepper@cygnus.com>
-
- * elf-bfd.h: Add prototypes for bfd_elf32_write_relocs,
- bfd_elf32_slurp_reloc_table, bfd_elf64_write_relocs, and
- bfd_elf64_slurp_reloc_table.
-
- * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): New
- definitions to get external names.
- (elf_write_relocs): Renamed from write_relocs and make global.
- (elf_slurp_reloc_table): Make global.
- (_bfd_elf,size_info): Use elf_write_relocs instead of write_relocs.
-
- * archive.c (hpux_uid_gid_encode): New function.
- (bfd_ar_hdr_from_filesystem): Use it if HPUX_LARGE_AR_IDS is
- defined and the ID is greater than 99999.
- (bfd_generic_stat_arch_elt): If HPUX_LARGE_AR_IDS is defined decode
- special uid/gid fields into 32 bit values.
-
-2000-04-21 Matthew Green <mrg@cygnus.com>
-
- * config.bfd: Add NetBSD/sparc64 support.
-
-2000-04-21 Richard Henderson <rth@cygnus.com>
- David Mosberger <davidm@hpl.hp.com>
- Timothy Wall <twall@cygnus.com>
- Jim Wilson <wilson@cygnus.com>
-
- * Makefile.am (ALL_MACHINES): Add cpu-ia64.lo.
- (ALL_MACHINES_CFILES): Add cpu-ia64.c.
- (BFD64_BACKENDS): Add elf64-ia64.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-ia64.c.
- (cpu-ia64.lo, elf64-ia64.lo): New rules.
- * Makefile.in: Rebuild.
- * archures.c (enum bfd_architecture): Add bfd_arch_ia64.
- (bfd_ia64_arch): Declare.
- (bfd_archures_list): Add bfd_ia64_arch.
- * bfd-in2.h: Rebuild.
- * config.bfd: (ia64*-*-linux-gnu*, ia64*-*-elf*): New targets.
- * configure: Rebuild.
- * configure.host: (ia64-*-linux*): New host.
- * configure.in (bfd_elf64_ia64_little_vec, bfd_elf64_ia64_big_vec,
- bfd_efi_app_ia64_vec, bfd_efi_app_ia64_vec): New vectors.
- * elf.c (prep_headers): Add bfd_arch_ia64.
- * libbfd.h: Rebuild.
- * reloc.c: Add IA-64 relocations.
- * targets.c (bfd_elf64_ia64_little_vec, bfd_elf64_ia64_big_vec):
- Declare.
- (bfd_target_vect): Add bfd_elf64_ia64_little_vec.
- * cpu-ia64-opc.c, cpu-ia64.c, elf64-ia64.c: New files.
-
-2000-04-21 Richard Henderson <rth@cygnus.com>
-
- * elf32-d30v.c (bfd_elf_d30v_reloc): Don't modify section
- contents when performing a partial link.
- (bfd_elf_d30v_reloc_21): Likewise.
-
-2000-04-20 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_relocate_section): Restrict 1998-12-10
- patch to symbols defined by a shared object.
- * elf32-ppc.c (ppc_elf_relocate_section): Similarly.
-
-2000-04-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- K&R compiler fixes.
- * dwarf2.c (concat_filename): Avoid string literal concatenation.
- * ieee.c (ieee_get_symtab): Don't initialise union in struct.
-
-2000-04-11 David Mosberger <davidm@hpl.hp.com>
-
- * Makefile.am (BFD64_BACKENDS): Mention coff-ia64.lo.
- (BFD64_BACKENDS_CFILES): Mention coff-ia64.c
- (coff-ia64.lo): Add dependency.
- * Makefile.in: Regenerate.
- * coff-ia64.c: New file.
- * efi-app-ia32.c: Ditto.
- * efi-app-ia64.c: Ditto.
- * coffcode.h (coff_set_arch_mach_hook): Handle IA64MAGIC.
- (coff_set_flags): Ditto.
- (coff_write_object_contents) [IA64]: Set magic number to ZMAGIC.
- * config.bfd (i[3456]86-*-linux-gnu*): Mention bfd_efi_app_ia32_vec.
- * configure.in (elf): Handle bfd_efi_app_ia32 and bfd_efi_app_ia64_vec.
- * configure: Regenerate.
- * libpei.h (GET_OPTHDR_IMAGE_BASE): New macro.
- (PUT_OPTHDR_IMAGE_BASE): Ditto.
- (GET_OPTHDR_SIZE_OF_STACK_RESERVE): Ditto.
- (PUT_OPTHDR_SIZE_OF_STACK_RESERVE): Ditto.
- (GET_OPTHDR_SIZE_OF_STACK_COMMIT): Ditto.
- (PUT_OPTHDR_SIZE_OF_STACK_COMMIT): Ditto.
- (GET_OPTHDR_SIZE_OF_HEAP_RESERVE): Ditto.
- (PUT_OPTHDR_SIZE_OF_HEAP_RESERVE): Ditto.
- (GET_OPTHDR_SIZE_OF_HEAP_COMMIT): Ditto.
- (PUT_OPTHDR_SIZE_OF_HEAP_COMMIT): Ditto.
- (GET_PDATA_ENTRY): Ditto.
- * peigen.c (_bfd_pei_swap_aouthdr_in) [COFF_WITH_PEP64]: Don't read
- data_start. Use above macros to read fields that are 64 bit wide for
- COFF_WITH_PEP64. Don't truncate entry and text_start to 32 bits.
- (_bfd_pei_swap_aouthdr_out) [PEI_FORCE_MINIMUM_ALIGNMENT]: Force
- FileAlignment and SectionAlignment to minimum alignment if they
- are zero.
- (_bfd_pei_swap_aouthdr_out) [PEI_DEFAULT_TARGET_SUBSYSTEM]: Set
- Subsystem to default PEI_DEFAULT_TARGET_SUBSYSTEM.
- (_bfd_pei_swap_aouthdr_out) [COFF_WITH_PEP64]: Don't set data_start.
- Use above macros to write fields that are 64 bit wide for
- COFF_WITH_PEP64.
- (pe_print_pdata): Set PDATA_ROW_SIZE to 3*8 for COFF_WITH_PEP64,
- 5*4 otherwise. This should be right for IA-32 and IA-64, but may
- be wrong for platforms. Use PDATA_ROW_SIZE instead of hardcoded
- value of 20 bytes. Modify printing for COFF_WITH_PEP64 to print
- begin address, end address, and unwind info address only. Use
- GET_PDATA_ENTRY() to read .pdata entries. Use fprintf_vma() to
- print addresses.
- (tbl): Add SECTION, REL32, RESERVED1, MIPS_JMPADDR16, DIR64, and
- HIGH3ADJ relocation names.
- (_bfd_pe_print_private_bfd_data): Print Subsystem name in legible form.
- * targets.c: Declare bfd_efi_app_ia32_vec and
- bfd_efi_app_ia64_vec.
- (bfd_target_vector): Mention bfd_efi_app_ia32_vec and
- bfd_efi_app_ia64_vec.
-
-2000-04-17 Timothy Wall <twall@cygnus.com>
-
- * bfd-in2.h: Add prototypes for tic54x load page access.
- * bfd-in.h: Regenerate.
- * coff-tic54x.c: Add load page functions; allow bfd_arch_unknown
- in customized _set_arch_mach function.
- * coffcode.h (coff_set_alignment_hook): Set section load page if
- the appropriate macro is defined.
- (write_object_contents): Read section load page.
-
-2000-04-13 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.h: Update copyright date.
-
- * elf32-fr30.c (fr30_elf_i20_reloc): Don't use U suffix.
- * elf32-mips.c (_bfd_mips_elf_relocate_section): And here.
-
- * elf32-d30v.c (MAX32): Don't use LL suffix.
- (MIN32): Define in terms of MAX32.
- (bfd_elf_d30v_reloc): Make relocation a bfd_signed_vma.
-
- * coff-a29k.c (SIGN_EXTEND_HWORD): Replace with more concise
- expression.
-
- * peicode.h (pe_ILF_build_a_bfd): Remove UL from hex constants.
-
-2000-04-12 Alan Modra <alan@linuxcare.com.au>
-
- * dep-in.sed: Match space before file name, not after.
- * Makefile.am: Regenerate dependencies.
- * Makefile.in: Regenerate.
-
- * reloc.c (_bfd_relocate_contents): In complain_overflow_bitfield
- case, allow address wrap-around stupidly removed 2000-03-17. Sign
- extend without an if statement.
-
-2000-04-11 Alan Modra <alan@linuxcare.com.au>
-
- * coff-mips.c (mips_gprel_reloc): Test for 16 bit range using
- signed quantites.
- * elf32-mips.c (gprel16_with_gp): Likewise.
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Test range
- here using -0x40000, not (int)0xfffc0000.
- (elf32_hppa_size_of_stub): Likewise.
-
-2000-04-11 Timothy Wall <twall@cygnus.com>
-
- * coff-tic54x.c: Now builds with all targets.
- * Makefile.am: Add coff/tic54x.h to coff-tic54x.o dependencies.
- * Makefile.in: Regenerate.
- * coffcode.h (coff_set_arch_mach_hook): Eliminate warning on
- unitialized variable.
-
-2000-04-07 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure.in (WARN_CFLAGS): Set to -W -Wall by default. Add
- --enable-build-warnings option.
- * Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
- * Makefile.in, configure: Re-generate.
-
-2000-04-07 Nick Clifton <nickc@cygnus.com>
-
- * reloc.c: Add BFD_RELOC_ARM_PCREL_BLX and
- BFD_RELOC_THUMB_PCREL_BLX.
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Handle
- R_ARM_XPC25 and R_ARM_THM_PC22.
-
- * elfarm-nabi.c (elf32_arm_howto_): Fix definitions of
- R_ARM_XPC25 and R_ARM_THM_XPC22.
- (elf32_arm_reloc_map): Make BFD_RELOC_{ARM|THUMB}_PCREL_BLX to
- R_ARM_[XPC25|THM_XPC22].
-
- * elfarm-oabi.c: Define OLD_ARM_ABI and change include from
- elf/arm-oabi.h to elf/arm.h
-
- * Makefile.am: Fix dependency for elfarm-oabi.c
- * Makefile.in: Regenerate.
-
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
-2000-04-06 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elfcore.h (elf_core_file_p): preserve value of tdata at entry,
- and restore it on failure. Release newly allocated tdata on
- failure.
-
-2000-04-07 Jim Wilson <wilson@cygnus.com>
-
- * dwarf2.c (struct dwarf2_debug): New field dwarf_line_size.
- (decode_line_info): Set it. Report error if unit->line_offset is
- equal to or larger than it.
-
-2000-04-07 Timothy Wall <twall@cygnus.com>
-
- * targets.c: Added vecs for tic54x.
- * reloc.c: Added relocs for tic54x.
- * libbfd.h: Regenerated.
- * configure: Add TI COFF vecs for tic54x.
- * configure.in: Ditto.
- * config.bfd (targ_cpu): Recognize new tic54x target.
- * coffcode.h (coff_slurp_symbol_table): Additions for TI COFF handling.
- * bfd-in2.h: Add tic54x target and relocations.
- * Makefile.am, Makefile.in: Add tic54x target.
- * archures.c (bfd_archures_list): Add tic54x target.
- * coff-tic54x.c: New.
- * cpu-tic54x.c: New.
-
-2000-04-06 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elfcore.h (elf_core_file_p): call backend_object_p which
- thereby gets an opportunity to update the arch/machine type.
-
-2000-04-06 Timothy Wall <twall@cygnus.com>
-
- * coffcode.h (coff_slurp_symbol_table): Handle C_STATLAB storage
- class. Handle SEC_CLINK and SEC_BLOCK flags.
- * section.c: Add SEC_CLINK and SEC_BLOCK flags.
- * bfd-in2.h: Add SEC_CLINK and SEC_BLOCK flags.
-
-2000-04-06 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (elf32_arm_set_private_flags): Only check for
- EF_INTERWORK if this is an unknown EABI.
- (elf32_arm_merge_private_bfd_data): Check EABI version
- numbers. Only check EF_xxx flags if the EABI version number
- is unknown.
- (elf32_arm_check_private_bfd_data): Only check EF_xxx flags
- if the EABI version number is unknown.
- (elf32_arm_print_private_bfd_data): Only decode EF_xxx flags
- if the EABI version number is unknown.
-
-2000-04-05 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * reloc.c (_bfd_relocate_contents): Add BFD_RELOC_SH_LOOP_START and
- BFD_RELOC_SH_LOOP_END.
- * elf32-sh.c (sh_elf_howto_tab): Change special_func to
- sh_elf_ignore_reloc for all entries that sh_elf_reloc used to ignore.
- Add entries for R_SH_LOOP_START and R_SH_LOOP_END.
- (sh_elf_reloc_loop): New function.
- (sh_elf_reloc): No need to test for always-to-be-ignored relocs
- any more.
- (sh_rel): Add entries for BFD_RELOC_SH_LOOP_{START,END}.
- (sh_elf_relocate_section): Handle BFD_RELOC_SH_LOOP_{START,END}.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2000-04-04 Alan Modra <alan@linuxcare.com.au>
-
- * po/bfd.pot: Regenerate.
-
- * Makefile.am: Remove extraneous mkdep comment.
- (MKDEP): Use gcc -MM rather than mkdep.
- (DEP): Quote when passing vars to sub-make. Add warning
- message to end.
- (DEP1): Rewrite for "gcc -MM".
- (CLEANFILES): Add DEP2.
- Update dependencies.
- * Makefile.in: Regenerate.
-
-2000-04-03 Kevin Buettner <kevinb@redhat.com>
-
- * configure.in: Added corefile support for AIX 4.3. In particular,
- AIX_CORE_DUMPX_CORE will be defined in addition to AIX_CORE when
- compiling rs6000-core.c.
- * configure: Regenerated.
-
-2000-04-03 H.J. Lu <hjl@gnu.org>
-
- * cache.c (bfd_open_file): Unlink the output file only if
- it has non-zero size.
-
-2000-04-01 Ken Block USG <block@zk3.dec.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Don't emit
- relative relocations for non-loaded sections in shared objects.
- (elf64_alpha_check_relocs): Similarly.
-
-2000-04-03 Hans-Peter Nilsson <hp@axis.com>
-
- * aoutx.h (NAME(aout,reloc_type_lookup)): Add BFD_RELOC_8 and
- BFD_RELOC_16 to switch for extended relocs.
- (MY_swap_ext_reloc_in): New.
- (MY_swap_ext_reloc_out): New.
- (NAME(aout,slurp_reloc_table)): Use MY_swap_ext_reloc_in rather
- than NAME(aout,swap_ext_reloc_in) for extended relocs.
- (NAME(aout,squirt_out_relocs)): Similarly use
- MY_swap_ext_reloc_out.
- (aout_link_reloc_link_order): Use MY_put_ext_reloc if defined.
-
-2000-04-03 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Add bsr:16 -> bsr:8 to
- the R_PCRWORD_B case.
-
-2000-03-31 Thomas de Lellis <tdel@wrs.com>
-
- * srec.c : Set CHUNK size to 16 bytes to prevent download failures
- on some targets.
- * ihex.c : Ditto.
-
-2000-03-30 Donald Lindsay <dlindsay@cygnus.com>
-
- * elf32-m32r.c (m32r_elf_generic_reloc): new function. All
- HOWTO references to bfd_elf_generic_reloc, that have
- partial_inplace == true, now use the new function. The function
- is based on the recent rewrite of m32r_elf_lo16_reloc(), and
- extends its fixes to the R_M32R_{16,24,32} relocs.
- The new logic in m32r_elf_lo16_reloc() has been removed, and
- it instead calls the new routine to obtain that functionality.
-
-2000-03-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-avr.c (elf32_avr_gc_mark_hook, elf32_avr_gc_sweep_hook,
- elf32_avr_check_relocs, avr_final_link_relocate,
- elf32_avr_relocate_section, bfd_elf_avr_final_write_processing,
- elf32_avr_object_p): Add prototypes.
- (elf32_avr_gc_mark_hook): Add default for h->root.type.
- (bfd_elf_avr_final_write_processing): Make static.
-
-2000-03-27 Denis Chertykov <denisc@overta.ru>
-
- * cpu-avr.c: New file. BFD support routines for AVR architecture.
- * archures.c (bfd_architecture): Add AVR architecture.
- (bfd_archures_list): Add reference to AVR architecture info.
- * elf.c (prep_headers): Handle bfd_arch_avr.
- * reloc.c: Add various AVR relocation enums.
- * targets.c (bfd_elf32_avr_vec): Declare and add to target vector
- list.
- * Makefile.am: Add support for AVR elf.
- * configure.in: Likewise.
- * config.bfd: Likewise.
- * Makefile.in: Regenerate.
- * configure: This too.
- * bfd-in2.h: And this.
- * libbfd.h: And this.
-
-2000-03-24 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Add prototype.
- (elf64_alpha_find_reloc_at_ofs): Likewise.
-
-2000-03-17 Alan Modra <alan@linuxcare.com.au>
-
- * reloc.c (bfd_check_overflow): In case complain_overflow_bitfield,
- flag an overflow if the bitfield is outside -2**n to 2**n-1. The
- allowable range used to be -2**(n-1) to 2**n-1.
- * reloc.c (_bfd_relocate_contents): Same here. Also replace
- "boolean overflow" with "bfd_reloc_status_type flag".
-
-2000-03-14 Doug Evans <dje@casey.transmeta.com>
-
- * elf32-m32r.c (m32r_elf_lo16_reloc): Rewrite.
-
-2000-03-14 Kazu Hirata <kazu@hxi.com>
-
- * reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
- of shrinks properly, including the last reloc.
-
-2000-03-13 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Fix the sanity
- check for R_MOVL2.
-
-2000-03-11 Alan Modra <alan@linuxcare.com.au>
-
- * ieee.c (ieee_archive_p): Return bfd_error_wrong_format on
- a format mismatch rather than an "error" from bfd_read such as
- bfd_error_file_truncated.
-
-2000-03-10 Geoff Keating <geoffk@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_relocate_section): Do proper
- sign-extension and big-endian compensation for
- R_MIPS_64 even in ld -r.
-
-2000-03-10 Geoffrey Keating <geoffk@cygnus.com>
-
- * elf32-mips.c (mips_elf_next_relocation): Rename from
- mips_elf_next_lo16_relocation, and generalize to look
- for any relocation type.
- (elf_mips_howto_table): Make R_MIPS_PC16 pcrel_offset.
- (elf_mips_gnu_rel_hi16): Howto for R_MIPS_GNU_REL_HI16.
- (elf_mips_gnu_rel_lo16): Howto for R_MIPS_GNU_REL_LO16.
- (elf_mips_gnu_rel16_s2): Howto for R_MIPS_GNU_REL16_S2.
- (elf_mips_gnu_pcrel64): Howto for R_MIPS_PC64.
- (elf_mips_gnu_pcrel32): Howto for R_MIPS_PC32.
- (bfd_elf32_bfd_reloc_type_lookup): Add new relocs.
- (mips_rtype_to_howto): Likewise.
- (mips_elf_calculate_relocation): Handle new relocs.
- (_bfd_mips_elf_relocate_section): REL_HI16/REL_LO16 relocs
- are paired. The addend for R_MIPS_GNU_REL16_S2
- is shifted right two bits.
-
-2000-03-10 Alan Modra <alan@linuxcare.com.au>
-
- * reloc.c (bfd_perform_relocation): Undo emacs formatting of
- comment, and ensure it doesn't happen again.
- (bfd_install_relocation): Same here.
- (_bfd_relocate_contents): Don't bother assigning unused signmask
- shift result. Fix typos in comments.
- Remove trailing whitespace throughout file.
-
-2000-03-07 Doug Evans <dje@casey.transmeta.com>
-
- * reloc.c (reloc_howto_struct): Fix partial_inplace comment.
- * bfd-in2.h: Rebuild.
-
-2000-03-06 Nick Clifton <nickc@cygnus.com>
-
- * peicode.h (struct pe_ILF_vars): Add sym_ptr_table and
- sym_ptr_ptr fields.
- (SIZEOF_ILF_SYM_PTR_TABLE): Define.
- (SIZEOF_ILF_STRINGS): Redefine.
- (pe_ILF_make_a_symbol-reloc): New function. Creates a symbol
- relative reloc, as opposed to a section relative reloc.
- (pe_ILF_make_a_symbol): Set the class of local symbols to C_STAT
- not C_LABEL.
- Add length of symbol's prefix to string pointer.
- Store a pointer to the symbol in the symbol pointer table.
- (pe_ILF_build_a_bfd): Do not build .idata$2 or .idata$7.
- Initialise the symbol pointer table.
- Store the hint in the Hint/Name table.
- Make the jump reloc be symbol realtive, not section relative.
- Create an import symbol for imported code.
-
-2000-03-06 Catherine Moore <clm@cygnus.com>
-
- * elf.c (swap_out_syms): Check for null type_ptr.
-
-2000-03-01 Hans-Peter Nilsson <hp@axis.com>
-
- * aout-target.h (MY(write_object_contents)): Remove unused
- and unusable "#if CHOOSE_RELOC_SIZE".
- * pc532-mach.c (MY(write_object_contents)): Ditto.
- * netbsd.h (MY(write_object_contents)): Ditto.
- * hp300hpux.c (MY(write_object_contents)): Ditto.
- * freebsd.h (MY(write_object_contents)): Ditto.
- * aout-tic30.c (tic30_aout_write_object_contents): Ditto.
-
-2000-02-29 H.J. Lu <hjl@gnu.org>
-
- * peicode.h (jtab): Make it static.
-
- * coff-sh.c (sh_align_load_span): Declared if COFF_WITH_PE is
- defined and COFF_IMAGE_WITH_PE is not defined.
- (_bfd_sh_align_load_span): Defined as sh_align_load_span if
- COFF_WITH_PE is defined and COFF_IMAGE_WITH_PE is not defined.
-
-2000-03-01 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (bfd_arm_process_before_allocation): Make
- 'symndx' signed to prevent compile time warning.
-
- * coff-mcore.c: Remove unused prototype for pe_object_p.
-
- * coff-sh.c: Add "#ifndef COFF_IMAGE_WITH_PE" around static
- functions that are not used when COFF_IMAGE_WITH_PE is
- defined.
- (struct sh_opcode): Change type of 'flags' field to unsigned
- long so that it can hold the USESAS flag.
-
- * coffcode.h (styp_to_sec_flags): Initialise 'target_name'.
-
- * elf-m10300.c (mn10300_elf_relax_section): Initialise
- 'sym_sec'.
-
- * elf32-i370.c: Add ATTRIBUTE_UNUSED to unused function
- parameters.
- Remove unusued variables and code.
- (elf_backend_add_symbol_hook): Fix prototype.
-
- * elf32-m68k.c (elf_m68k_gc_sweep_hook): Initialise 'sgot' and
- 'srelgot'.
-
- * elf32-mcore.c (mcore_elf_relocate_section): Initialise
- 'oldinst'.
-
- * elf32-mips.c: Add ATTRIBUTE_UNUSED to unused function
- parameters.
- Remove unusued variables and code.
- (elf_backend_add_symbol_hook): Fix prototype.
-
- * elf32-sh.c (sh_elf_set_mach_from_flags): Use 'flags'.
-
- * elflink.h (elf_bfd_link_add_symbols): Add ATTRIBUTE_UNUSED
- to unused function parameter.
-
- * pe-mips.c: Add ATTRIBUTE_UNUSED to unused function
- parameters.
- Use EMPTY_HOWTO to initialise empty howto slots.
- Remove unused variables.
-
- * peicode.h (pe_ILF_build_a_bfd): Initialise id6.
-
-2000-03-01 H.J. Lu <hjl@gnu.org>
-
- * aoutx.h (aout_link_input_section_std): Pass "true" to
- the undefined_symbol callback.
- (aout_link_input_section_ext): Likewise.
- * bout.c (get_value): Likewise.
- * coff-a29k.c (coff_a29k_relocate_section): Likewise.
- * coff-alpha.c (alpha_ecoff_get_relocated_section_conten):
- Likewise.
- (alpha_relocate_section): Likewise.
- * coff-arm.c (coff_arm_relocate_section): Likewise.
- * coff-i960.c (coff_i960_relocate_section): Likewise.
- * coff-mcore.c (coff_mcore_relocate_section): Likewise.
- * coff-mips.c (mips_relocate_section): Likewise.
- * coff-ppc.c (coff_ppc_relocate_section): Likewise.
- * coff-sh.c (sh_relocate_section): Likewise.
- * coff-tic80.c (coff_tic80_relocate_section): Likewise.
- * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
- * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
- * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
- * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
- * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-v850.c (v850_elf_relocate_section): Likewise.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
- * elflink.h (elf_link_output_extsym): Likewise.
- * pe-mips.c (coff_pe_mips_relocate_section): Likewise.
- * reloc.c (bfd_generic_get_relocated_section_conten): Likewise.
- * reloc16.c (_bfd_ppc_xcoff_relocate_section): Likewise.
-
- * elf-hppa.h (elf_hppa_relocate_section): Pass "false" to the
- undefined_symbol callback when building shared library with
- -Bsymbolic and undefined symbols are allowed. Otherwise, pass
- "true".
- * elf32-arm.h (elf32_arm_relocate_section): Likewise.
- * elf32-i386.c (elf_i386_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
- (elf32_mips_get_relocated_section_content): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2000-02-28 Nick Clifton <nickc@cygnus.com>
-
- * Makefile.am: Add rules to build pe[i]-{sh|mips}.lo objects.
- * Makefile.in: Regenerate.
-
- * configure.in: Add support for mips and sh pe vectors.
- * configure: regenerate.
-
- * config.bfd: Add support for arm-wince, mips-pe and sh-pe
- targets.
-
- * targets.c: Add mips and sh pe vectors.
-
- * libpei.h (coff_final_link_postscript): Only define if not
- already defined.
-
- * coffcode.h: Add support for WinCE magic numbers.
-
- * peigen.c (pe_print_reloc): Update comment and rearrange
- appending of newline character.
-
- * peicode.h: Add support for Image Library Format.
- (pe_ILF_vars): Structure containing data used by ILF code.
- (pe_ILF_make_a_section): New function. Create a section based
- on ILF data.
- (pe_ILF_make_a_reloc): New function. Create a reloc based on
- ILF data.
- (pe_ILF_make_a_symbol): New function. Create a symbol based
- on ILF data.
- (pe_ILF_save_relocs): New function. Store the relocs created
- by pe_ILF_make_a_reloc in a section.
- (pe_ILF_build_a_bfd): New function. Create a BFD describing
- an ILF object.
- (pe_ILF_object_p): New function. Return a bfd_target pointer
- for an ILF object.
- (pe_bfd_object_p): If an ILF object is detected call
- pe_ILF_object_p on it.
-
- * coff-arm.c: Add support for WinCE relocs which are different
- from normal ARM COFF relocs.
- * pe-arm.c: Unset TARGET_UNDERSCORE for a WinCE target.
-
- * coff-sh.c: Add support for sh-pe target.
- * pe-sh.c: New file. Support code for sh-pe target.
- * pei-sh.c: New file. Support code for sh-pe target.
-
- * pe-mips.c: New file. Support code for mips-pe target.
- * pei-mips.c: New file. Support code for mips-pe target.
-
-2000-02-27 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Don't bump
- architecture if the object causing the bump is dynamic.
- * elf64-sparc.c (sparc64_elf_merge_private_bfd_data): Likewise,
- and also don't it for memory ordering.
- (sparc64_elf_write_relocs): Take src_rela out of the loop.
-
-2000-02-27 Ian Lance Taylor <ian@zembu.com>
-
- * dwarf2.c (read_abbrevs): Use _raw_size directly rather than
- calling bfd_get_section_size_before_reloc.
- (decode_line_info): Likewise.
- (_bfd_dwarf2_find_nearest_line): Likewise.
-
-2000-02-27 Eli Zaretskii <eliz@is.elta.co.il>
-
- * Makefile.am (stamp-lib): Use $(LIBTOOL) --config to get the
- name of the libtool directory.
- * Makefile.in: Rebuild.
-
-2000-02-25 Rodney Brown (RodneyBrown@pmsc.com)
-
- * som.c (SOM_HOWTO): Define.
- (som_hppa_howto_table): Use it.
-
-2000-02-25 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
-
- * config.bfd: Enable 64 bit support for GNU/Linux/sparc.
-
- * config.bfd: Enable 64 bit support for Solaris7+/sparc.
-
-2000-02-24 Catherine Moore <clm@cygnus.com>
-
- * som.c (som_misc_symbol_info): Add field
- secondary_def.
- (som_bfd_derive_misc_symbol_info): Initialize
- secondary_def.
- (som_build_and_write_symbol_table): Keep track
- of secondary_def field.
- (som_slurp_symbol_table): Set BSF_WEAK symbol flag
- if secondary_def field is set.
- (som_bfd_ar_write_symbol_stuff): Initialize
- secondary_def.
-
-2000-02-23 Stephane Carrez <stcarrez@worldnet.fr>
-
- * dwarf2.c (read_address): Read 16-bits addresses.
- (parse_comp_unit): Accept addr_size == 2.
-
-2000-02-23 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * bfd-in.h: Update copyright date.
-
-2000-02-23 Linas Vepstas <linas@linas.org>
-
- * cpu-i370.c: New file.
- * elf32-i370.c: New file.
- * archures.c (enum bfd_architecture): Add bfd_arch_i370.
- (bfd_i370_arch): New.
- (bfd_archures_list): Add bfd_i370_arch.
- * elf.c (prep_headers): Add bfd_arch_i370.
- * Makefile.am: Add support for IBM 370 elf.
- * config.bfd: Likewise.
- * configure.in: Likewise.
- * libbfd.h (bfd_reloc_code_real_names): Likewise.
- * reloc.c (bfd_reloc_code_type): Likewise.
- * targets.c: Likewise.
-
- * Makefile.in: Regenerate.
- * configure: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2000-02-22 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-i386.c (elf_i386_info_to_howto_rel): Give a warning for
- invalid relocation types, and change them to R_386_NONE.
-
-2000-02-22 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): If a version symbol is
- not defined, don't add a second ELF_VER_CHR.
-
- * elflink.h (elf_bfd_final_link): Call output_extsym for global
- symbols converted to local symbols even when stripping all
- symbols.
- (elf_link_output_extsym): Process global symbols converted to
- local symbols even if they are being stripped.
-
-2000-02-21 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * archures.c (bfd_octets_per_byte): Return unsigned int.
- (bfd_arch_mach_octets_per_byte): Ditto.
- * libbfd.c (bfd_read, bfd_seek): Quell signed vs. unsigned
- comparison warning.
- * section.c (bfd_get_section_size_before_reloc): Quell signed
- vs. unsigned comparison warning.
- (bfd_get_section_size_after_reloc): Same here. Fix parentheses too.
- * trad-core.c (trad_unix_core_file_p): Correct 2000-01-27
- change. What was I thinking?
- * bfd-in2.h: Regenerate.
-
- * elflink.h (elf_gc_sweep): Skip non-elf input bfds.
- (elf_gc_sections): Same here.
- (elf_gc_common_finalize_got_offsets): And here.
-
-2000-02-21 Ian Lance Taylor <ian@zembu.com>
-
- ELF HPPA doesn't work at present; remove it until it does.
- * config.bfd: Comment out setting targ_defvec to
- bfd_elf32_hppa_vec.
- * Makefile.am: Rebuild dependencies.
- (BFD32_BACKENDS): Remove elf32-hppa.lo.
- (BFD32_BACKENDS_CFILES): Remove elf32-hppa.c.
- (SOURCE_HFILES): Remove elf32-hppa.h and hppa_stubs.h.
- * Makefile.in: Rebuild.
- * targets.c (bfd_target_vector): Comment out bfd_elf32_hppa_vec.
-
-2000-02-18 Geoff Keating <geoffk@cygnus.com>
-
- * coffcode.h (coff_set_arch_mach_hook): Use free(), because there
- is no bfd_free(). Revert bfd_free part of previous change.
-
-2000-02-18 Geoff Keating <geoffk@cygnus.com>
-
- * coffcode.h (coff_set_arch_mach_hook): Don't use variable-size
- arrays.
- (coff_compute_section_file_positions): Use bfd_free to pair
- bfd_malloc.
- (coff_write_object_contents): Likewise.
-
- * coff-rs6000.c (xcoff_howto_table_16): New variable.
- (xcoff_rtype2howto): Handle 16-bit variants of 32-bit relocs.
-
-2000-02-18 Ulrich Drepper <drepper@cygnus.com>
-
- * coff-rs6000.c (XCOFFARMAGBIG): New macro.
- (xcoff_ar_file_hdr_big): New structure.
- (SIZEOF_AR_FILE_HDR_BIG): New macro.
- (xcoff_ar_hdr_big): New structure.
- (SIZEOF_AR_HDR_BIG): New macro.
- (xcoff_big_format_p): New macro.
- (xcoff_ardata_big): New macro.
- (arch_xhdr_big): New macro.
- (xcoff_slurp_armap): Handle large archives.
- (xcoff_archive_p): Detect large archives.
- (xcoff_read_ar_hdr): Handle large archives.
- (xcoff_openr_next_archived_file): Handle large archives.
- (xcoff_generic_stat_arch_elt): Handle large archives.
- (xcoff_write_armap_old): Rename from xcoff_write_armap.
- (xcoff_write_armap_big): New function.
- (xcoff_write_armap): New function, dispatch to _old or _big.
- (xcoff_write_archive_contents_old): Rename from
- xcoff_write_archive_contents.
- (xcoff_write_archive_contents_big): New function.
- (xcoff_write_archive_contents): New function, dispatch to _old or
- _big.
-
-2000-02-18 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_table): Remove copy_indirect
- and hide_symbol members.
- (elf_link_hash_copy_indirect): Remove.
- (elf_link_hash_hide_symbol): Remove.
- (struct elf_backend_data): Add elf_backend_copy_indirect_symbol
- and elf_backend_hide_symbol.
- (_bfd_elf_link_hash_copy_indirect): Declare.
- (_bfd_elf_link_hash_hide_symbol): Declare.
- * elf.c (_bfd_elf_link_hash_copy_indirect): Remove table argument.
- (_bfd_elf_link_hash_hide_symbol): Likewise.
- (_bfd_elf_link_hash_table_init): Don't init killed members.
- * elflink.h (elf_link_add_object_symbols): Use the bed function
- pointers not elf_link_hash_{copy_indirect,hide_symbol}.
- (elf_link_assign_sym_version): Likewise.
- * elfxx-target.h (elf_backend_copy_indirect_symbol): Default.
- (elf_backend_hide_symbol): Likewise.
- (elfNN_bed): Update for new members.
-
-2000-02-17 Kevin Buettner <kevinb@redhat.com>
-
- * rs6000-core.c (CORE_DATA_SIZE_FIELD, CORE_COMM_FIELD, SAVE_FIELD,
- STACK_END_ADDR): Define for new core file format.
- (LOADER_OFFSET_FIELD, LOADER_REGION_SIZE, CORE_DUMP): New defines
- for handling the vagaries of the various core file structures used
- by AIX over the years.
- (rs6000coff_core_p, rs6000coff_core_file_matches_executable,
- Rs6kCorData): Use above defines to adapt code to use AIX 4.3's
- core_dumpx structure.
-
-2000-02-17 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * archures.c (bfd_mach_sh2, bfd_mach_sh_dsp): New macros.
- (bfd_mach_sh3_dsp): Likewise.
- (bfd_mach_sh4): Reinstate.
- (bfd_default_scan): Recognize 7410, 7708, 7729 and 7750.
- * bfd-in2.h: Regenerate.
- * coff-sh.c (struct sh_opcode): flags is no longer short.
- (USESAS, USESAS_REG, USESR8, SETSAS, SETSAS_REG): New macros.
- (sh_opcode41, sh_opcode42): Integrate as sh_opcode41.
- (sh_opcode01, sh_opcode02, sh_opcode40): Add sh-dsp opcodes.
- (sh_opcode41, sh_opcode4, sh_opcode80): Likewise.
- (sh_opcodes): No longer const.
- (sh_dsp_opcodef0, sh_dsp_opcodef): New arrays.
- (sh_insn_uses_reg): Check for USESAS and USESR8.
- (sh_insn_sets_reg, sh_insns_conflict): Check for SETSAS.
- (_bfd_sh_align_load_span): Return early for SH4.
- Modify sh_opcodes lookup table for sh-dsp / sh3-dsp.
- Take into account that field b of a parallel processing insn
- could be mistaken for a separate insn.
- * cpu-sh.c (arch_info_struct): New array elements for
- sh2, sh-dsp and sh3-dsp.
- Reinstate element for sh4.
- (SH2_NEXT, SH_DSP_NEXT, SH3_DSP_NEXT): New macros.
- (SH4_NEXT): Reinstate.
- (SH3_NEXT, SH3E_NEXT): Adjust.
- * elf-bfd.h (_sh_elf_set_mach_from_flags): Declare.
- * elf32-sh.c (sh_elf_set_private_flags): New function.
- (sh_elf_copy_private_data, sh_elf_set_mach_from_flags): Likewise.
- (sh_elf_merge_private_data): New function.
- (elf_backend_object_p, bfd_elf32_bfd_set_private_bfd_flags): Define.
- (bfd_elf32_bfd_copy_private_bfd_data): Define.
- (bfd_elf32_bfd_merge_private_bfd_data): Change to
- sh_elf_merge_private_data.
-
-2000-02-13 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_table): Add copy_indirect and
- hide_symbol members.
- (elf_link_hash_copy_indirect): New.
- (elf_link_hash_hide_symbol): New.
- * elflink.h (elf_link_add_object_symbols): Break out copy from
- indirect new new symbol to elf.c.
- (elf_link_assign_sym_version): Break out privatization of
- non-exported symbol to elf.c.
- * elf.c (_bfd_elf_link_hash_copy_indirect): New.
- (_bfd_elf_link_hash_hide_symbol): New.
- (_bfd_elf_link_hash_table_init): Init copy_indirect and hide_symbol.
-
-2000-02-13 Ian Lance Taylor <ian@zembu.com>
-
- * section.c (_bfd_strip_section_from_output): Add info parameter.
- If it passed as non-NULL, use it to check whether any input BFD
- has an input section which uses this output section. Change all
- callers.
- * bfd-in2.h: Rebuild.
-
- * bfd-in.h: Move declarations of bfd_get_elf_phdr_upper_bound and
- bfd_get_elf_phdrs in from bfd-in2.h, correcting patch of
- 1999-11-29.
- * bfd-in2.h: Rebuild.
-
-2000-02-10 Timothy Wall <twall@cygnus.com>
-
- * coffswap.h (coff_swap_sym_in): Add hook SWAP_SYM_IN_POST to
- allow final modifications of swapped-in symbol.
- (coff_swap_sym_out): Ditto with SWAP_SYM_OUT_POST.
- * coffcode.h (coff_write_relocs): Use macro
- SECTION_RELATIVE_ABSOLUTE_SYMBOL_P if defined to determine whether
- symbol index should be set to -1.
-
-2000-02-10 Toshiyasu Morita (toshi.morita@sega.com)
-
- * coff-sh.c (USES1_REG, USES2_REG, SETS1_REG, SETS2_REG,
- USESF1_REG, USESF2_REG, SETSF1_REG, SETSF2_REG): New macros.
- * (sh_insn_sets_reg, sh_insn_sets_freg): New prototypes.
- * (sh_insn_sets_reg, sh_insn_uses_or_sets_reg, sh_insns_sets_freg,
- sh_insns_uses_or_sets_freg): New functions.
- * (sh_insn_uses_reg, sh_insn_uses_freg): Use new macros.
- * (sh_insns_conflict): Use new functions and new macros to
- detect conflicts when two instructions both set same integer registers,
- both set same fp register, and both set special register.
-
-2000-02-09 Timothy Wall <twall@cygnus.com>
-
- * coffgen.c (coff_real_object_p): Set arch/mach info prior to
- swapping in sections, so that the swapping routines have access to
- the arch/mach info.
-
-2000-02-08 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coff-go32.c: Update comment. Update copyright.
-
-2000-01-27 Thomas de Lellis <tdel@windriver.com>
-
- * syms.c (bfd_decode_symclass)
- Two new class characters were added - 'V' and 'v'. The
- meaning of 'W' is now restricted to just weak non-object
- symbols. This allows differentiation between, for example,
- weak functions vs weak objects. nm for example now dumps:
- 'W' = weak global
- 'w' = weak unresolved
- 'V' = weak global object
- 'v' = weak unresolved object
-
- (bfd_is_undefined_symclass): New function. Return true if the
- given symbol class represents and undefined/unresolved symbol.
-
- (bfd_symbol_info): Use bfd_is_undefined_symclass to check for
- unresolved symbols.
-
- * bfd-in2.h: Add prototype for bfd_is_undefined_symbol().
-
- * elf32-arm.h (elf32_arm_get_symbol_type): If a symbol has the
- STT_ARM_16BIT flag set, but it is not attached to a data object
- return STT_ARM_16BIT so that it will be treated as code by the
- disassembler.
-
-2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * coff-i386.c (i3coff_object_p): Remove prototype.
- Update copyright.
-
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Add const
- to name. Update copyright.
-
- * trad-core.c (trad_unix_core_file_p): Cast core_regsec
- assignment to avoid warning. Update copyright.
-
-2000-01-24 Robert Lipe (robertl@sco.com)
-
- * coffcode.h (coff_write_object_contents): Get buff via bfd_malloc
- instead of using GNU C extension.
-
-2000-01-21 Nick Clifton <nickc@cygnus.com>
-
- * libbfd.c (bfd_read): Do not attempt to get a negativly sized
- amount from a bfd_in_memory structure.
- (bfd_seek): Do not allow seeks past the end of a bfd_in_memory
- structure.
-
-2000-01-14 Nick Clifton <nickc@cygnus.com>
-
- * linker.c (default_indirect_link_order): oops - fix incorrectly
- applied patch from Tim Wall.
-
-2000-01-13 Timothy Wall (twall@tiac.net>
-
- * coffcode.h: Use bfd_coff_xxx instead of the macro XXX (where xxx
- = scnhsz, filhsz, relsz, aoutsz, etc)
-
- * coffswap.h: Ditto.
-
-2000-01-13 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (elf32_thumb_to_arm_stub): Fix offset in branch to
- interwork thumb to arm stub.
-
-2000-01-13 Timothy Wall (twall@tiac.net>
-
- * archures.c (bfd_octets_per_byte): New function: Return
- target byte size.
- (bfd_arch_mach_octets_per_byte): New function: Return target
- byte size.
-
- * section.c: Distinguish between octets and bytes for usage of
- _cooked_size, _raw_size, and output_offset. Clarify
- description of bfd_set_section_contents.
-
- * bfd-in2.h: Regenerate.
-
- * coffgen.c: Indicate that the offset parameter is in bytes, not
- octets.
-
- * cofflink.c (bfd_coff_link_input_bfd): Use bfd_octets_per_byte
- where appropriate to get the octet offset when calling
- bfd_set_section_contents.
- (bfd_coff_reloc_link_order): Ditto.
-
- * linker.c (bfd_generic_reloc_link_order): Ditto.
- (_bfd_default_link_order): Ditto.
-
- * reloc.c (bfd_perform_relocation): Distinguish between octets
- and bytes. Use octets when indexing into octet data; use bytes
- when calculating target addresses.
- (bfd_install_relocation): Ditto.
-
- * srec.c (srec_write_section): Ditto.
-
-2000-01-13 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (COFF_DEFAULT_SECTION_ALIGNMENT_POWER): Change from
- 3 to 2. This allows 4 byte sized sections, which is necessary for
- dlltool to build functioning DLLs.
-
-2000-01-10 Philip Blundell <pb@futuretv.com>
-
- * config.bfd (arm*-*-linux-gnu*): Match instead of arm*-*-linux-gnu.
- (arm*-*-conix*): New target.
-
-2000-01-10 Egor Duda <deo@logos-m.ru>
-
- * config.bfd: Include elf32_i386 vector to target list for cygwin
- and mingw.
-
- * config.in: Undefine HAVE_WIN32_PSTATUS_T.
- * configure.in: Test for structure win32_pstatus_t in
- <sys/procfs.h>
- * configure: Regenerate.
-
- * elf.c (elfcore_grok_win32pstatus): New function: process
- win32_pstatus_t notes in elf core file.
- (elfcore_grok_note): Detect win32_pstatus notes.
-
-2000-01-03 Martin v. Loewis <loewis@informatik.hu-berlin.de>
-
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Process symbol
- visibility.
- * elflink.h (elf_link_add_object_symbols): Combine visibilities.
- * elf.c (bfd_elf_print_symbol): Interpret st_other as visibility.
-
-For older changes see ChangeLog-9899
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/ChangeLog-0203 b/contrib/binutils/bfd/ChangeLog-0203
deleted file mode 100644
index f99029a..0000000
--- a/contrib/binutils/bfd/ChangeLog-0203
+++ /dev/null
@@ -1,11405 +0,0 @@
-2003-12-19 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
-
- Adfd m32r-linux and PIC support. Add new ABI that uses RELA.
- * config.bfd (m32r*-*-linux*, m32r*le-*-linux*, m32r*le-*-*): Added.
- * configure.in (bfd_elf32_m32rlin_vec, bfd_elf32_m32rlelin_vec,
- bfd_elf32_m32rle_vec): Added
- * configure: Regenerated.
- * elf32-m32r.c (m32r_info_to_howto, m32r_elf_adjust_dynamic_symbol,
- m32r_elf_size_dynamic_sections, m32r_elf_create_dynamic_sections,
- m32r_elf_finish_dynamic_sections, m32r_elf_finish_dynamic_symbol,
- allocate_dynrelocs, readonly_dynrelocs, m32r_elf_reloc_type_class,
- m32r_elf_fake_sections): Added.
- (m32r_elf_howto_table): Added
- R_M32R_16_RELA, R_M32R_32_RELA, R_M32R_24_RELA,
- R_M32R_10_PCREL_RELA, R_M32R_18_PCREL_RELA,
- R_M32R_26_PCREL_RELA, R_M32R_HI16_ULO_RELA,
- R_M32R_HI16_SLO_RELA, R_M32R_LO16_RELA,
- R_M32R_SDA16_RELA, R_M32R_RELA_GNU_VTINHERIT,
- R_M32R_RELA_GNU_VTENTRY, R_M32R_GOT24,
- R_M32R_26_PLTREL, R_M32R_COPY, R_M32R_GLOB_DAT,
- R_M32R_JMP_SLOT, R_M32R_RELATIVE, R_M32R_GOTOFF,
- R_M32R_GOTPC24, R_M32R_GOT16_HI_ULO,
- R_M32R_GOT16_HI_SLO, R_M32R_GOT16_LO,
- R_M32R_GOTPC_HI_ULO, R_M32R_GOTPC_HI_SLO,
- R_M32R_GOTPC_LO.
- (m32r_elf_relocate_section, m32r_elf_check_relocs): Changed for
- New ABI.
- * reloc.c: Add BFD_RELOC_M32R_GOT24, BFD_RELOC_M32R_26_PLTREL,
- BFD_RELOC_M32R_COPY, BFD_RELOC_M32R_GLOB_DAT,
- BFD_RELOC_M32R_JMP_SLOT, BFD_RELOC_M32R_RELATIVE,
- BFD_RELOC_M32R_GOTOFF, BFD_RELOC_M32R_GOTPC24,
- BFD_RELOC_M32R_GOT16_HI_ULO, BFD_RELOC_M32R_GOT16_HI_SLO,
- BFD_RELOC_M32R_GOT16_LO, BFD_RELOC_M32R_GOTPC_HI_ULO,
- BFD_RELOC_M32R_GOTPC_HI_SLO, BFD_RELOC_M32R_GOTPC_LO.
- * targets.c (bfd_elf32_m32rlin_vec, bfd_elf32_m32rlelin_vec,
- bfd_elf32_m32rle_vec): Added.
- * bfd-in2.h: Regenerated.
- * libbfd.h: Regenerated.
-
-2003-12-19 Danny Smith <dannysmith@users.sourceforge.net>
-
- * coffcode.h (styp_to_sec_flags): Don't treat .reloc section
- as SEC_DEBUGGING.
-
-2003-12-18 Richard Sandiford <rsandifo@redhat.com>
-
- * elf32-mips.c (elf_mips_howto_table_rel): Replace all uses of
- mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc. Use
- _bfd_mips_elf_hi16_reloc for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16,
- _bfd_mips_elf_lo16_reloc for R_MIPS_LO16 and R_MIPS_GNU_REL_LO16,
- and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16. Change rightshift
- to 16 for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16.
- (mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc)
- (mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete.
- (_bfd_mips_elf32_gprel16_reloc): Remove special case.
- (mips_elf_gprel32_reloc, mips32_64bit_reloc): Likewise.
-
- * elf64-mips.c (mips_elf64_howto_table_rel): Replace all uses of
- mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc. Use
- _bfd_mips_elf_hi16_reloc for R_MIPS_HI16, _bfd_mips_elf_lo16_reloc
- for R_MIPS_LO16 and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16.
- Change R_MIPS_HI16's rightshift to 16.
- (mips_elf64_howto_table_rela): Replace all uses of
- mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc.
- Use _bfd_mips_elf_generic_reloc for R_MIPS_GOT16 as well.
- (mips_elf64_hi16_reloc, mips_elf64_got16_reloc): Delete.
- (mips_elf64_shift6_reloc): Remove special case. Use
- _bfd_mips_elf_generic_reloc instead of returning bfd_reloc_continue.
-
- * elfn32-mips.c (prev_reloc_section): Delete.
- (prev_reloc_address, prev_reloc_addend): Delete.
- (elf_mips_howto_table_rel, elf_mips_howto_table_rela): As for
- elf64-mips.c
- (GET_RELOC_ADDEND, SET_RELOC_ADDEND): Delete.
- (mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc)
- (mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete.
- (mips_elf_gprel16_reloc): Delete use of GET_RELOC_ADDEND.
- (mips_elf_literal_reloc, mips_elf_gprel32_reloc): Likewise.
- (mips16_jump_reloc, mips16_gprel_reloc): Likewise.
- (mips_elf_shift6_reloc): Likewise. Delete use of SET_RELOC_ADDEND.
-
- * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Use
- _bfd_relocate_contents to install an in-place addend.
- (mips_hi16): New structure.
- (mips_hi16_list): Moved from elf32-mips.c.
- (_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_got16_reloc): New functions.
- (_bfd_mips_elf_lo16_reloc, _bfd_mips_elf_generic_reloc): New functions.
- (mips_elf_calculate_relocation): Assume addend is unshifted.
- (_bfd_mips_elf_relocate_section): Don't apply the howto rightshift
- on top of the usual high-part shift. Don't shift the addend right
- before calling mips_elf_calculate_relocation.
-
- * elfxx-mips.h (_bfd_mips_elf_hi16_reloc): Declare.
- (_bfd_mips_elf_got16_reloc, _bfd_mips_elf_lo16_reloc): Declare.
- (_bfd_mips_elf_generic_reloc): Declare.
-
-2003-12-16 Eric Youngdale <eric@mkssoftware.com>
- Nick Clifton <nickc@redhat.com>
-
- * peicode.h (pe_ILF_build_a_bfd): Only skip one instance of each
- prefix character, if they are present.
-
-2003-12-15 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
- Nick Clifton <nickc@redhat.com>
-
- * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Ensure that correct flags
- are set on known section types.
-
-2003-12-12 Nick Clifton <nickc@redhat.com>
-
- * po/ro.po: Updated translation.
-
-2003-12-12 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Check for
- NULL dyn_h.
-
-2003-12-11 Nick Clifton <nickc@redhat.com>
-
- * elf.c (INCLUDE_SECTION_IN_SEGMENT): Skip PT_GNU_STACK segments.
-
-2003-12-08 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.h, elfxx-mips.c, cpu-mips.c: Convert prototypes.
- Remove casts that were only needed for K&R compatibility.
-
-2003-12-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_backend_data): Remove "bfd *" and add
- "elflink_hash_entry *" param to elf_backend_link_output_symbol_hook.
- Add "elflink_hash_entry *" param to elf_backend_output_arch_syms.
- * elflink.h (elf_link_output_sym): Add "elflink_hash_entry *" param,
- and pass to output_symbol_hook.
- (elf_bfd_final_link): Adjust elf_link_output_sym calls.
- (elf_link_output_extsym): Likewise.
- (elf_link_input_bfd): Likewise.
- * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Adjust.
- * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
- * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
- * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
- * elf64-sparc.c (sparc64_elf_output_arch_syms): Likewise.
- * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
- Validate dynh->h against h.
- * elf64-ppc.c (struct ppc_link_hash_entry): Add adjust_done bitfield.
- (link_hash_newfunc): Init it.
- (adjust_opd_syms): New function.
- (ppc64_elf_edit_opd): Set adjust_done when global .opd sym adjusted.
- Set opd.adjust for all .opd relocs. Call adjust_opd_syms.
- (ppc64_elf_tls_optimize): Adjust possible .opd sym values here.
- (ppc64_elf_relocate_section): Also adjust syms not a multiple of 24.
- (ppc64_elf_output_symbol_hook): New function.
- (elf_backend_link_output_symbol_hook): Define.
-
-2003-12-07 Richard Sandiford <rsandifo@redhat.com>
-
- * elf32-mips.c, elfn32-mips.c, elf64-mips.c: Convert prototypes.
- Remove casts that were only needed for K&R compatibility.
-
-2003-12-05 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
-
- * coff-arm.c (aoutarm_std_reloc_howto [ARM_WINCE]): Set
- partial_inplace for these relocs to FALSE for comptability with
- the MS linker.
- Remap ARM_26D relocation from 5 to 0. This fixes "bad fixup" error
- generated by MS linker, and brings the relocation in line the MS
- PE documentation.
-
-2003-12-04 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf32-ppc.c (ppc_elf_relax_section): Don't check relax_finalizing.
-
-2003-12-04 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Use the
- need_relax_finalize field in link_info instead of
- relax_finalizing to check if the relax finalize pass is being
- done.
-
-2003-12-04 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
-
- * coff-arm.c (coff_arm_relocate_section, bfd_arm_process_before_allocation):
- Change ARM26* to ARM_26* in comments to match definitions.
- (coff_arm_adjust_symndx): Replace hard-coded constants with
- appropriate definitions (ARM_26*).
-
-2003-12-04 Alan Modra <amodra@bigpond.net.au>
-
- * coff-i860.c (coff_i860_reloc_nyi): Return bfd_reloc_not_supported.
- * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Warning fixes.
- (mn10300_elf_relax_section): Likewise.
- * nlm32-alpha.c (ONES): Define.
- (nlm32_alpha_howto_table): Use it to avoid warnings.
-
-2003-12-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_object_p): Delete.
- (elf_backend_object_p): Don't define.
- * elf32-s390.c (elf_s390_object_p): No need to alloc tdata here.
- * elf32-sh.c (sh_elf_object_p): Likewise.
- * elf32-sparc.c (elf32_sparc_object_p): Likewise.
- * elf64-alpha.c (elf64_alpha_object_p): Likewise.
- * elf64-s390.c (elf_s390_object_p): Likewise.
- * elf64-x86-64.c (elf64_x86_64_elf_object_p): Likewise.
-
-2003-12-03 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
-
- * archures.c (bfd_mach_m32r2): Add new machine type.
- * bfd-in2.h: Regenerate.
- * cpu-m32r.c : Add new machine type.
- * elf32-m32r.c (m32r_elf_object_p, m32r_elf_final_write_processing,
- m32r_elf_merge_private_bfd_data): Add support for new machine
- type.
-
-2003-12-03 Dave Airlie <airlied@linux.ie>
-
- * config.bfd: Add vax-linux-gnu target.
- * configure.in: Likewise.
- * configure: Regenerate.
-
-2003-12-03 Alan Modra <amodra@bigpond.net.au>
-
- * ecoff.c (ecoff_link_add_archive_symbols): Update for renamed
- bfd_link_hash_entry field "next" -> "und_next".
- * linker.c (_bfd_link_hash_newfunc): Likewise.
- (bfd_link_add_undef): Likewise.
- (_bfd_generic_link_add_archive_symbols): Likewise.
- (_bfd_generic_link_add_one_symbol): Likewise.
- * xcofflink.c (xcoff_link_add_symbols): Likewise.
-
-2003-12-02 Nick Clifton <nickc@redhat.com>
-
- * configure.in (ALL_LINGUAS): Add ro.
- * po/ro.po: New Romanian translation.
-
-2003-12-02 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
-
-2003-12-01 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
-
- * coffcode.h (coff_compute_section_file_positions): Set page_size
- to 1 instead of 0 in the case file alignment value is zero.
-
-2003-12-01 Kazu Hirata <kazu@cs.umass.edu>
-
- * coff-rs6000.c: Remove ARGSUSED and VARARGS.
- * coff64-rs6000.c: Likewise.
- * coffcode.h: Likewise.
- * elf32-vax.c: Likewise.
- * hash.c: Likewise.
- * hppabsd-core.c: Likewise.
- * hpux-core.c: Likewise.
- * ihex.c: Likewise.
- * netbsd-core.c: Likewise.
- * osf-core.c: Likewise.
- * pdp11.c: Likewise.
- * ptrace-core.c: Likewise.
- * sco5-core.c: Likewise.
- * section.c: Likewise.
- * sunos.c: Likewise.
- * trad-core.c: Likewise.
-
-2003-12-01 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg.
- * elf.c (_bfd_elf_merge_sections): Adjust to suit.
- (_bfd_elf_link_just_syms): Likewise.
- (bfd_elf_get_needed_list): Likewise.
- (bfd_elf_get_runpath_list): Likewise.
- (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens.
- * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab
- creator flavour.
- (elf32_hppa_set_gp): Look up output sections rather than using htab.
- * elf32-i960.c: Comment fix. Formatting.
- * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table
- rather than testing creator flavour.
- * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
- * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
- * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for
- is_elf_hash_table change. Remove redundant test.
- (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than
- testing creator flavour.
- (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table.
- (_bfd_elf_fix_symbol_flags): Likewise.
- (_bfd_elf_adjust_dynamic_symbol): Likewise.
- * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant
- checks. Use is_elf_hash_table rather than testing creator flavour.
- Use hash_table throughout in place of info->hash.
- (elf_add_dynamic_entry): Adjust for is_elf_hash_table change.
- (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant
- check.
- (elf_bfd_final_link): Adjust for is_elf_hash_table change.
- (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than
- testing creator flavour.
- (elf_gc_sections): Add is_elf_hash_table check.
- (elf_gc_common_finalize_got_offsets): Likewise.
- (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove
- redundant check.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table
- rather than testing creator flavour.
-
-2003-11-28 Christian Groessler <chris@groessler.org>
-
- * cpu-z8k.c: Convert to ISO C90.
- * coff-z8k.c: Likewise.
-
-2003-11-27 Alexandre Oliva <aoliva@redhat.com>
-
- * elf-bfd.h (elf_backend_data::elf_backend_modify_segment_map):
- Add link info argument.
- * elf32-i370.c (elf_backend_modify_segment_map): Likewise.
- * elf32-ppc.c (ppc_elf_modify_segment_map): Likewise.
- * elf32-xtensa.c (elf_xtensa_modify_segment_map): Likewise.
- * elf64-hppa.c (elf64_hppa_modify_segment_map): Likewise.
- * elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_modify_segment_map): Likewise.
- * elf.c (assign_file_positions_except_relocs,
- assign_file_positions_for_segments): Likewise. Adjust calls.
-
-2003-11-27 Mark Kettenis <kettenis@gnu.org>
-
- * elf.c (elfcore_grok_netbsd_procinfo): Make a pseudosection out
- of the note.
-
-2003-11-26 Daniel Jacobowitz <drow@mvista.com>
- Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (mips_elf_set_global_got_offset): Don't set no_fn_stub.
- (mips_elf_set_no_stub): New function.
- (mips_elf_multi_got): Call it.
- (_bfd_mips_elf_finish_dynamic_symbol): If a relocation is needed for
- a secondary GOT entry, create an R_MIPS_32 or R_MIPS_64 relocation and
- use mips_elf_create_dynamic_relocation to deal with any compatibility
- issues. Store the adjusted addend in the GOT slot.
-
-2003-11-25 Mattias Engdegård <mattias@virtutech.se>
-
- * stabs.c (_bfd_link_section_stabs): Skip N_EXCL stabs when
- procesing N_BINCL stabs.
-
-2003-11-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_type_of_stub): Disallow stubs other than
- ppc_stub_plt_call to symbols defined in shared libs.
-
-2003-11-22 Jakub Jelinek <jakub@redhat.com>
-
- * elf-bfd.h (ELF_LINK_POINTER_EQUALITY_NEEDED): Define new flag.
- * elf.c (_bfd_elf_link_hash_copy_indirect): Copy it.
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
- (elf_i386_check_relocs): Set it.
- (elf_i386_finish_dynamic_symbol): If it is not set,
- clear st_value of SHN_UNDEF symbol.
-
-2003-11-20 Jim Blandy <jimb@redhat.com>
-
- * cpu-powerpc.c (powerpc_compatible): Any ISA in the PowerPC
- family is a superset of <bfd_arch_rs6000,bfd_mach_rs6k>.
-
-2003-11-20 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390.c (elf_s390_relocate_section): Don't recalculate symbol
- section for reloc output and subtract the output section's address
- from the addend when converting a relocation into one against a
- section symbol.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
-
-2003-11-18 James E Wilson <wilson@specifixinc.com>
-
- * elfxx-ia64.c (get_fptr): For fptr_rel, use dynobj not abfd.
- (elfNN_ia64_size_dynamic_sections): When stripping sections, check
- for ia64_info->rel_fptr_sec.
-
-2003-11-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (toc_adjusting_stub_needed): Exit early if section
- size is zero.
-
-2003-11-17 Daniel Jacobowitz <drow@mvista.com>
-
- * elf.c (_bfd_elf_link_hash_copy_indirect): Copy
- ELF_LINK_HASH_NEEDS_PLT. Fix formatting.
- * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
- * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Likewise.
- * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
- * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
- * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
- * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise.
- * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
- * elf32-xtensa.c (elf_xtensa_copy_indirect_symbol): Remove.
- (elf_backend_copy_indirect_symbol): Don't define.
-
-2003-11-14 Daniel Jacobowitz <drow@mvista.com>
-
- * elfxx-mips.c (mips_elf_merge_gots): Weaken assert for local
- GOT entries.
-
-2003-11-13 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390.c (elf_s390_relocate_section): Only convert R_390_32
- to R_390_RELATIVE. Convert the other relocations against local
- symbols to relocations against the start of the section.
- * elf64-s390.c (elf_s390_relocate_section): Only convert R_390_64
- to R_390_RELATIVE. Convert the other relocations against local
- symbols to relocations against the start of the section.
-
-2003-11-11 Nick Clifton <nickc@redhat.com>
-
- * elf-m10300.c (bfd_mn10300_elf_size_dynamic_sections): Use
- info->executable not info->shared to decide if a .interp section
- should be present.
- * elf32-arm.h (elf32_arm_size_dynamic_sections): Likewise.
- * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
- * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
- * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
- * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
- * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
- * elfxx-mips.c (_bfd_mips_size_dynamic_sections): Likewise.
- * elflink.h (size_dynamic_sections): Likewise.
-
-2003-11-10 Jonathan Wilson <jonwil@tpgi.com.au>
-
- * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Swap out tls pointer.
- (_bfd_XXi_final_link_postscript): Look for __tks_used symbol. If
- found initialise the tls data directory entry.
-
-2003-11-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_install_value): Delete.
- (shared_stub_entry, stub_entry): Make them arrays of ints.
- Remove initial branch.
- (ppc_elf_relax_section): Write one branch around all trampolines
- instead. Correct bogus R_PPC_PLTREL24 handling. Correct
- branch range check. Only use shared_stub_entry when shared.
- Test that branches can reach stubs. Write trampolines out at
- end so that just one realloc is used. Handle little-endian
- mode. Move relevant code from ppc_elf_install_value to here.
- (ppc_elf_relocate_section): Move code handling RELAX32 from
- ppc_elf_install_value to here.
-
-2003-11-06 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_howto_raw); Add entry for R_PPC_RELAX32PC.
- (ppc_elf_install_value): Handle R_PPC_RELAX32PC. Merge duplicate
- cases.
- (shared_stub_entry): Correct opcode.
- (ppc_elf_relax_section): Generate R_PPC_RELAX32PC relocs.
- (ppc_elf_relocate_section): Handle them.
-
-2003-11-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_rela_local_sym): Accept asection **, and return
- updated section in case of merged section.
- * elf-bfd.h (_bfd_elf_rela_local_sym): Update declaration.
- * elf-hppa.h (elf_hppa_relocate_section): Adjust call.
- * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
- * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
- * elf32-arm.h (elf32_arm_relocate_section): Likewise.
- * elf32-avr.c (elf32_avr_relocate_section): Likewise.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
- * elf32-frv.c (elf32_frv_relocate_section): Likewise.
- * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-i860.c (elf32_i860_relocate_section): Likewise.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
- * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf32-v850.c (v850_elf_relocate_section) Likewise.
- * elf32-vax.c (elf_vax_relocate_section): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
- * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
-
- * elf32-cris.c (cris_elf_relocate_section): Don't recalculate symbol
- section for reloc output.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf32-vax.c (elf_vax_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Don't recalculate everything
- for R_PPC_RELAX32 reloc. Don't bother checking ppc_elf_install_value
- return value.
- * elf64-ppc.c (ppc64_elf_relocate_section <R_PPC64_TOC>): Sanity check
- sec->id.
-
-2003-11-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-d10v.c (extract_rel_addend, insert_rel_addend): New functions.
- (elf32_d10v_relocate_section): Use them to handle -r reloc
- adjustments, and in place of _bfd_elf_rela_local_sym.
-
- * cpu-iq2000.c (arch_info_struct): Warning fix.
-
-2003-11-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (ELIMINATE_COPY_RELOCS): Define.
- (elf32_hppa_copy_indirect_symbol): Don't copy NON_GOT_REF on
- weakdefs.
- (elf32_hppa_check_relocs): Use ELIMINATE_COPY_RELOCS.
- (elf32_hppa_adjust_dynamic_symbol): Likewise. Copy weakdef
- NON_GOT_REF.
- (allocate_dynrelocs): Use ELIMINATE_COPY_RELOCS and
- SYMBOL_CALLS_LOCAL. Discard relocs for undef weak syms with
- non-default visibility.
- (elf32_hppa_relocate_section): Use ELIMINATE_COPY_RELOCS and
- SYMBOL_CALLS_LOCAL.
-
-2003-11-04 Alan Modra <amodra@bigpond.net.au>
-
- * aout-target.h, aoutf1.h, bfdio.c, bfdwin.c: Update copyright date.
- * coff-apollo.c, coff-sparc.c, coff-w65.c, coff-we32k.c: Ditto.
- * coff-z8k.c, coffgen.c, cpu-frv.c, cpu-h8500.c, cpu-hppa.c: Ditto.
- * cpu-ia64-opc.c, cpu-m10300.c, cpu-mips.c, cpu-msp430.c: Ditto.
- * cpu-rs6000.c, cpu-z8k.c, efi-app-ia32.c, elf32-am33lin.c: Ditto.
- * gen-aout.c, hash.c, hp300hpux.c, init.c, mach-o.c: Ditto.
- * nlm-target.h, nlm.c, som.h, stabs.c, sysdep.h, xsym.h: Ditto.
-
- * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Fix
- "dereferencing type-punned pointer" warnings.
-
- * aout-adobe.c (aout_adobe_set_section_contents): Constify location.
- * aoutx.h (NAME(aout,set_section_contents)): Ditto.
- * bfd-in2.h: Regenerate.
- * binary.c (binary_set_section_contents): Ditto.
- * bout.c (b_out_set_section_contents): Ditto.
- * coff-tic54x.c (tic54x_set_section_contents): Ditto.
- * coffcode.h (coff_set_section_contents): Ditto.
- * ecoff.c (_bfd_ecoff_set_section_contents): Ditto.
- * elf-bfd.h (_bfd_elf_set_section_contents): Ditto.
- * elf.c (_bfd_elf_set_section_contents): Ditto.
- * elfxx-mips.c (_bfd_mips_elf_set_section_contents): Ditto.
- * elfxx-mips.h (_bfd_mips_elf_set_section_contents): Ditto.
- * i386msdos.c (msdos_set_section_contents): Ditto.
- * ieee.c (ieee_set_section_contents): Ditto.
- * ihex.c (ihex_set_section_contents): Ditto.
- * libaout.h (NAME(aout,set_section_contents)): Ditto.
- * libbfd-in.h (_bfd_nowrite_set_section_contents): Ditto.
- (_bfd_generic_set_section_contents): Ditto.
- * libbfd.h: Regenerate.
- * libbfd.c (_bfd_generic_set_section_contents): Ditto.
- * libecoff.h (_bfd_ecoff_set_section_contents): Ditto.
- * libnlm.h (nlmNAME(set_section_contents)): Ditto.
- (struct nlm_backend_data <nlm_mangle_relocs>): Ditto.
- * mmo.c (mmo_set_section_contents): Ditto.
- * nlm32-alpha.c (nlm_alpha_mangle_relocs): Ditto.
- * nlm32-i386.c (nlm_i386_mangle_relocs): Ditto.
- * nlm32-ppc.c (nlm_powerpc_mangle_relocs): Ditto.
- * nlm32-sparc.c (nlm_sparc_mangle_relocs): Ditto.
- * nlmcode.h (nlm_set_section_contents): Ditto.
- * oasys.c (oasys_set_section_contents): Ditto.
- * pdp11.c (NAME(aout,set_section_contents)): Ditto.
- * ppcboot.c (ppcboot_set_section_contents): Ditto.
- * srec.c (srec_set_section_contents): Ditto.
- * targets.c (BFD_JUMP_TABLE_WRITE <_bfd_set_section_contents>): Ditto.
- * tekhex.c (tekhex_set_section_contents): Ditto.
- (move_section_contents): Ditto.
- * versados.c (versados_set_section_contents): Ditto.
- * vms-misc.c (_bfd_save_vms_section): Ditto.
- * vms.c (vms_set_section_contents): Ditto.
- * vms.h (_bfd_save_vms_section): Ditto.
-
-2003-11-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_size_one_stub): Size relbrlt. Accept info arg
- rather than htab.
- (ppc64_elf_size_stubs): Adjust ppc_size_one_stub traversal. Zero
- relbrlt size.
- (ppc64_elf_build_stubs): Allocate space for relbrlt.
-
-2003-11-04 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in.h (_bfd_elf_tls_setup): Declare.
- * bfd-in2.h: Regenerate.
- * elf-bfd.h (struct elf_link_tls_segment): Delete.
- (struct elf_link_hash_table): Add tls_sec and tls_size.
- * elf.c (_bfd_elf_link_hash_table_init): Init tls_sec and tls_size.
- * elflink.c (_bfd_elf_tls_setup): New function.
- * elflink.h (struct elf_final_link_info): Remove first_tls_sec.
- (elf_bfd_final_link): Don't set first_tls_sec here. Update code
- saving tls segment info, round segment size up.
- (elf_link_output_extsym): Adjust code using tls segment info.
- (elf_link_input_bfd): Likewise.
- * elf32-i386.c (dtpoff_base, tpoff): Likewise.
- * elf32-s390.c (dtpoff_base, tpoff): Likewise.
- * elf32-sh.c (dtpoff_base, tpoff): Likewise.
- * elf32-sparc.c (dtpoff_base, tpoff): Likewise.
- * elf64-s390.c (dtpoff_base, tpoff): Likewise.
- * elf64-x86-64.c (dtpoff_base, tpoff): Likewise.
- * elfxx-ia64.c (elfNN_ia64_tprel_base): Likewise.
- (elfNN_ia64_dtprel_base): Likewise.
- * elf64-alpha.c (alpha_get_dtprel_base): Likewise.
- (alpha_get_tprel_base): Likewise.
- (struct alpha_relax_info): Remove tls_segment.
- (elf64_alpha_relax_got_load): Adjust invocation of
- alpha_get_dtprel_base and alpha_get_tprel_base.
- (elf64_alpha_relax_tls_get_addr): Likewise.
- (elf64_alpha_relax_section): Likewise.
- (elf64_alpha_relocate_section): Likewise.
- (elf64_alpha_relax_find_tls_segment): Delete.
- * elf32-ppc.c (struct ppc_elf_link_hash_table): Remove tls_sec.
- (ppc_elf_tls_setup): Call _bfd_elf_tls_setup. Return section.
- (ppc_elf_relocate_section): Adjust to use elf.tls_sec.
- * elf32-ppc.h (ppc_elf_tls_setup): Update.
- * elf64-ppc.c (struct ppc_link_hash_table): Remove tls_sec.
- (ppc64_elf_tls_setup): Call _bfd_elf_tls_setup. Return section.
- (ppc64_elf_tls_optimize): Adjust to use elf.tls_sec.
- (ppc64_elf_relocate_section): Likewise.
- * elf64-ppc.h (ppc64_elf_tls_setup): Update.
-
-2003-11-03 Daniel Jacobowitz <drow@mvista.com>
-
- * elf-bfd.h (struct elf_backend_data): Remove plt_header_size.
- * elf-m10300.c (elf_backend_plt_header_size): Don't define.
- * elf32-arm.h (elf_backend_plt_header_size): Don't define.
- * elf32-cris.c (elf_backend_plt_header_size): Don't define.
- * elf32-i386.c (elf_backend_plt_header_size): Don't define.
- * elf32-mips.c (elf_backend_plt_header_size): Don't define.
- * elf32-ppc.c (elf_backend_plt_header_size): Don't define.
- * elf32-s390.c (elf_backend_plt_header_size): Don't define.
- * elf32-sh.c (elf_backend_plt_header_size): Don't define.
- * elf32-sparc.c (elf_backend_plt_header_size): Don't define.
- * elf64-alpha.c (elf_backend_plt_header_size): Don't define.
- * elf64-hppa.c (elf_backend_plt_header_size): Don't define.
- * elf64-mips.c (elf_backend_plt_header_size): Don't define.
- * elf64-ppc.c (elf_backend_plt_header_size): Don't define.
- * elf64-s390.c (elf_backend_plt_header_size): Don't define.
- * elf64-sh64.c (elf_backend_plt_header_size): Don't define.
- * elf64-sparc.c (elf_backend_plt_header_size): Don't define.
- * elf64-x86-64.c (elf_backend_plt_header_size): Don't define.
- * elfn32-mips.c (elf_backend_plt_header_size): Don't define.
- * elfxx-ia64.c (elf_backend_plt_header_size): Don't define.
- * elfxx-target.h (elf_backend_plt_header_size): Don't define
- or include in target initializer.
-
-2003-11-03 Andrew Cagney <cagney@redhat.com>
-
- * section.c (bfd_set_section_contents): Make the "location" buffer
- constant.
- * bfd-in2.h: Re-generate.
-
-2003-10-30 Andrew Cagney <cagney@redhat.com>
-
- * syms.c: Replace "struct symbol_cache_entry" with "struct
- bfd_symbol".
- * vms.h, targets.c, section.c, reloc.c, peicode.h: Ditto.
- * mipsbsd.c, elf.c, linker.c, elf-bfd.h, ecoff.c: Ditto.
- * cpu-z8k.c, cpu-ns32k.c, cpu-h8500.c, bfd.c, bfd-in.h: Ditto.
- * bfd-in2.h: Re-generate.
-
-2003-10-30 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c: Include objalloc.h, hashtab.h.
- (struct elfNN_ia64_local_hash_entry): Remove root. Add id and r_sym
- fields.
- (struct elfNN_ia64_local_hash_table): Remove.
- (struct elfNN_ia64_link_hash_table): Change loc_hash_table's type
- to htab_t. Add loc_hash_memory field.
- (elfNN_ia64_local_hash_table_init, elfNN_ia64_new_loc_hash_entry):
- Removed.
- (elfNN_ia64_local_htab_hash, elfNN_ia64_local_htab_eq): New
- functions.
- (elfNN_ia64_hash_table_create): Use hashtab.h hashtable for
- loc_hash_table. Initialize loc_hash_memory.
- (elfNN_ia64_hash_table_free): New function.
- (elfNN_ia64_local_hash_lookup): Remove.
- (elfNN_ia64_local_dyn_sym_thunk): Change into htab_traverse
- callback.
- (elfNN_ia64_dyn_sym_traverse): Use htab_traverse.
- (get_local_sym_hash): Use hashtab.h hashtable for loc_hash_table.
- (bfd_elfNN_bfd_link_hash_table_free): Define.
-
-2003-10-30 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Modify versioned
- symbol string in place.
-
-2003-10-30 Jim Blandy <jimb@redhat.com>
-
- * cpu-rs6000.c (rs6000_compatible): Check the correct arch_info
- object's mach field: all PowerPC machines are supersets of the
- original rs6000, but not later rs6000 machines.
-
-2003-10-30 Alan Modra <amodra@bigpond.net.au>
-
- * dwarf2.c (struct attribute): Delete "unsnd", "snd" and "addr".
- Add "val" and "sval" fields.
- (DW_STRING, DW_UNSND, DW_BLOCK, DW_SND, DW_ADDR): Delete.
- (read_attribute_value): Expand and adjust DW_* occurrences.
- (scan_unit_for_functions, parse_comp_unit): Likewise.
-
-2003-10-30 Phil Edwards <phil@codesourcery.com>
-
- * config.bfd (arm-*-vxworks): Remove separate stanza; merge with
- other common ELF triples.
- (i[3-7]86-*-vxworks): Change to ELF format.
- (mips*-*-windiss): New triple, add to common MIPS/ELF stanza.
- (sh-*-vxworks): New stanza.
-
-2003-10-30 Lars Knoll <lars@trolltech.com>
- Michael Matz <matz@suse.de>
- Jakub Jelinek <jakub@redhat.com>
- Alan Modra <amodra@bigpond.net.au>
-
- * merge.c (struct sec_merge_sec_info): Update comment.
- (struct sec_merge_hash_entry): Remove entsize.
- (sec_merge_hash_lookup): Only adjust alignment when creating.
- (sec_merge_emit): Remove register keyword.
- (cmplengthentry, last4_eq, last_eq): Delete.
- (strrevcmp, strrevcmp_align, is_suffix): New.
- (merge_strings): Use them to implement fast suffix merging.
- * elf-strtab.c (struct elf_strtab_hash_entry): Update comments.
- Make "len" signed.
- (_bfd_elf_strtab_add): Lose on >2G strings.
- (_bfd_elf_strtab_emit): Don't emit strings with len < 0.
- (cmplengthentry, last4_eq): Delete.
- (strrevcmp, is_suffix): New.
- (_bfd_elf_strtab_finalize): Rework to implement fast suffix merging.
-
-2003-10-29 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Move check for
- SEC_ALLOC.
-
-2003-10-29 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_plt0_entry, elf32_arm_plt_entry): New
- code sequence.
- (PLT_HEADER_SIZE): New.
- (struct elf32_arm_pcrel_relocs_copied): Rename to ...
- (struct elf32_arm_relocs_copied): ... this. Count both
- pcrel and non-pcrel relocs. All uses updated.
- (struct elf32_arm_link_hash_table): Add pointers to dynamic linker
- sections and symbol/section mapping cache.
- (create_got_section): New.
- (elf32_arm_create_dynamic_sections): New.
- (elf_backend_create_dynamic_sections): Use it.
- (elf32_arm_final_link_relocate): Support garbage collection of relocs.
- (elf32_arm_check_relocs): Likewise.
- (elf32_arm_adjust_dynamic_symbol): Likewise.
- (elf32_arm_copy_indirect_symbol): New.
- (elf32_arm_link_hash_table_create): Initialise new fields.
- (elf32_arm_gc_sweep_hook): Implement.
- (elf32_arm_discard_copies): Delete.
- (elf32_arm_finish_dynamic_symbol): Use new PLT code.
- (elf32_arm_finish_dynamic_sections): Likewise.
- (elf_backend_can_refcount): Define.
- (elf_backend_copy_indirect_symbol): Likewise.
- (elf_backend_plt_header_size): Set to PLT_HEADER_SIZE.
-
-2003-10-29 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (elf_backend_grok_prstatus): Define.
- (elf_backend_grok_psinfo): Define.
- (ppc64_elf_grok_prstatus, ppc64_elf_grok_psinfo): New functions.
-
- * elf.c (_bfd_elfcore_make_pseudosection): Allow multiple
- sections with the same name.
- (elfcore_grok_lwpstatus): Likewise.
- (elfcore_grok_win32pstatus): Likewise.
- (elfcore_grok_note): Likewise.
- (elfcore_grok_nto_status): Likewise.
- (elfcore_grok_nto_gregs): Likewise.
-
-2003-10-27 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Never skip dynamic
- objects.
-
-2003-10-14 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (mips_elf_create_got_section): Initialize global_gotno.
-
-2003-10-24 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Look up
- hash table for real symbols.
-
-2003-10-23 Michael Snyder <msnyder@redhat.com>
-
- * section.c (asection): Fix typo in comment.
-
-2003-10-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (get_tls_mask): Add toc_symndx param, save toc
- reloc symbol index to it. Don't allow gd syms in shared libs
- to be optimized.
- (ppc64_elf_tls_optimize): Adjust get_tls_mask call.
- (ppc64_elf_size_stubs): Likewise.
- (ppc64_elf_relocate_section): Check that tls relocs are only used
- with tls syms, and similarly for non-tls. Correct symbol used
- when optimizing toc tls code.
-
-2003-10-22 Nick Clifton <nickc@redhat.com>
-
- * peicode.h (coff_swap_scnhdr_in): Only remove padding when
- processing an executable.
-
-2003-10-22 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.c (_bfd_elf_export_symbol): Adjust for globals and locals
- field changes.
- (_bfd_elf_link_assign_sym_version): Likewise.
- * elflink.h (size_dynamic_sections): Likewise.
-
-2003-10-21 Alexandre Oliva <aoliva@redhat.com>,
- Michael Snyder <msnyder@redhat.com>
-
- * archures.c (bfd_mach_sh4a, bfd_mach_sh4al_dsp, bfd_mach_sh4_nofpu,
- bfd_mach_sh4a_nofpu): New machine types.
- * bfd-in2.h: Rebuilt.
- * cpu-sh.c (compatible): Remove unused function.
- (SH4A_NEXT, SH4AL_DSP_NEXT, SH4_NOFPU_NEXT, SH4A_NOFPU_NEXT): New.
- (arch_info_struct): Add sh4a, sh4al_dsp, sh4-nofpu and sh4a-nofpu.
- * elf32-sh.c (sh_elf_set_mach_from_flags): Handle them.
-
-2003-10-21 Wouter van Heyst <wouter@vidicode.nl>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Correct text
- describing mismatched formats involving the Maverick FP type.
-
-2003-10-21 Anil Paranjpe <anilp1@KPITCummins.com>
-
- * binary.c (binary_object_p): Pass machine flag along with
- architecture.
-
-2003-10-21 Thorsten Brehm <brehm@gmx.net>
-
- * archures.c (bfd_default_scan): Add support for mcf528x.
- * ieee.c (ieee_write_processor): Likewise.
-
-2003-10-21 Peter Barada <pbarada@mail.wm.sps.mot.com>
- Bernardo Innocenti <bernie@develer.com>
-
- * archures.c: Add MCF528x (MCFv4) support.
- * bfd/cpu-m68k.c (arch_info_struct): Likewise.
- * bfd-in2.h: Regenerate.
-
-2003-10-20 Andrew Cagney <cagney@redhat.com>
-
- * targets.c: Replace "struct sec" with "struct bfd_section"
- * syms.c, sparclynx.c, section.c, opncls.c: Ditto.
- * libcoff-in.h, libbfd-in.h, elfxx-target.h: Ditto.
- * elf.c, coffgen.c, bfd.c, bfd-in.h, aoutf1.h: Ditto.
- * aout-tic30.c, aout-target.h:
- * bfd-in2.h, libcoff.h, libbfd.h: Regenerate.
-
-2003-10-18 Hans-Peter Nilsson <hp@bitrange.com>
-
- Support linker relaxation of new R_MMIX_PUSHJ_STUBBABLE relocs.
- * elf64-mmix.c (MAX_PUSHJ_STUB_SIZE): New macro.
- (struct _mmix_elf_section_data): New member pjs.
- (mmix_set_relaxable_size, mmix_elf_get_section_contents): New
- functions.
- (elf_mmix_howto_table): New entry for R_MMIX_PUSHJ_STUBBABLE.
- (mmix_reloc_map): Ditto.
- (mmix_elf_relocate_section): Handle R_MMIX_PUSHJ_STUBBABLE.
- (mmix_final_link_relocate, mmix_elf_check_common_relocs): Ditto.
- (mmix_elf_perform_relocation): Ditto. Don't mark parameter addr
- unused.
- (mmix_elf_check_relocs): Move early return to after
- mmix_elf_check_common_relocs call.
- (mmix_elf_symbol_processing): Fix cut-and-pasto in head comment.
- (_bfd_mmix_before_linker_allocation): Rename from
- _bfd_mmix_prepare_linker_allocated_gregs. All referers changed.
- Arrange to set the initial relaxable size of sections.
- (_bfd_mmix_after_linker_allocation): Rename from
- _bfd_mmix_finalize_linker_allocated_gregs.
- (mmix_elf_relax_section): Relax a R_MMIX_PUSHJ_STUBBABLE reloc.
- (bfd_elf64_get_section_contents): Define.
- * reloc.c: Add ENUMX for BFD_RELOC_MMIX_PUSHJ_STUBBABLE.
- * libbfd.h, bfd-in2.h: Regenerate.
-
- * reloc.c (bfd_generic_relax_section): Default-set
- section->_cooked_size here.
- (bfd_generic_get_relocated_section_contents): Don't set it here.
- Explain why.
-
-2003-10-17 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Skip relocation if
- output section has been discarded.
-
-2003-10-17 Shrinivas Atre <shrinivasa@KPITCummins.com>
-
- * coff-h8300.c (funcvec_hash_newfunc): Handle normal mode.
- (h8300_reloc16_extra_cases): Likewise.
- (h8300_bfd_link_add_symbols): Likewise.
-
-2003-10-17 Dhananjay Deshpande <dhananjayd@kpitcummins.com>
-
- * cpu-h8300.c (h8300sxn_info_struct): Correct address size.
- (h8300sn_info_struct): Likewise.
- (h8300hn_info_struct): Likewise.
-
-2003-10-16 Pavel Roskin <proski@gnu.org>
-
- * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't calculate image size
- for sections which lack size info.
-
-2003-10-17 Danny Smith <dannysmith@users.sourceforge.net>
-
- * configure.host: Add __USE_MINGW_FSEEK to HDEFINES for
- mingw32.
-
-2003-10-16 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also warn
- undefined patterns with '*'.
-
-2003-10-16 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't
- use the last CIE from a different section.
- (_bfd_elf_write_section_eh_frame): Don't pad beyond the raw
- size of the output section.
-
-2003-10-07 Roland McGrath <roland@redhat.com>
-
- * elf.c (_bfd_elf_make_section_from_phdr): Set alignment_power of
- new section from p_align header field.
-
-2003-10-16 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf32-xtensa.c (xtensa_read_table_entries): The external size
- of entry is 8 bytes.
-
-2003-10-15 Andrew Cagney <cagney@redhat.com>
-
- * targets.c (BFD_JUMP_TABLE_SYMBOLS): Replace NAME##_get_symtab
- with NAME##_canonicalize_symtab.
- * libcoff-in.h (coff_canonicalize_symtab): Update.
- * xsym.h (bfd_sym_canonicalize_symtab): Update.
- * elf-bfd.h (_bfd_elf_canonicalize_symtab): Update.
- * coffgen.c (coff_canonicalize_symtab): Update.
- * libbfd-in.h (_bfd_nosymbols_canonicalize_symtab): Update.
- * libnlm.h (nlmNAME(canonicalize_symtab)): Update.
- * ieee.c (ieee_vec): Update comment.
- * libecoff.h (_bfd_ecoff_canonicalize_symtab): Update.
- * mmo.c (mmo_canonicalize_symtab): Update.
- * nlm-target.h (nlm_canonicalize_symtab): Update.
- * nlmcode.h (nlm_canonicalize_symtab): Update.
- * i386msdos.c (msdos_canonicalize_symtab): Update.
- * hp300hpux.c (MY (canonicalize_symtab)): Update.
- * oasys.c (oasys_canonicalize_symtab): Update.
- * som.c (som_canonicalize_symtab): Update.
- * pef.c (bfd_pef_canonicalize_symtab): Update.
- * nlmcode.h (nlm_canonicalize_symtab): Update.
- * xsym.c (bfd_sym_canonicalize_symtab): Update.
- * vms.c (vms_canonicalize_symtab): Update.
- * versados.c (versados_canonicalize_symtab): Update.
- * mach-o.c (bfd_mach_o_canonicalize_symtab): Update.
- * ieee.c (ieee_canonicalize_symtab): Update.
- * pdp11.c (NAME(aout,canonicalize_symtab)): Update.
- * reloc.c: Update comment.
- * libaout.h (NAME(aout,canonicalize_symtab)): Update.
- * coff64-rs6000.c (aix5coff64_vec): Update.
- * coff64-rs6000.c (bfd_xcoff_aix5_backend_data): Update.
- * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update.
- * aoutx.h (NAME(aout,canonicalize_symtab)): Update.
- * elfxx-target.h (bfd_elfNN_canonicalize_symtab): Update.
- * hp300hpux.c (MY_canonicalize_symtab): Update.
- * ecoff.c (_bfd_ecoff_canonicalize_symtab): Update.
- * aout-tic30.c (MY_canonicalize_symtab): Update.
- * aout-target.h (MY_canonicalize_symtab): Update.
- * ppcboot.c (ppcboot_canonicalize_symtab): Update.
- * elf.c (_bfd_elf_canonicalize_symtab): Update.
- * elfcode.h (elf_canonicalize_symtab): Update.
- * ihex.c (ihex_canonicalize_symtab): Update.
- * tekhex.c (tekhex_canonicalize_symtab): Update.
- * binary.c (binary_canonicalize_symtab): Update.
- * srec.c (srec_canonicalize_symtab): Update.
-
-2003-10-15 Kazu Hirata <kazu@cs.umass.edu>
-
- * elf32-h8300.c (elf_reloc_map): Fix a comment typo.
-
-2003-10-15 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_relocate_section): Handle R_SH_IMM_*_PCREL
- relocations.
- (sh_elf_check_relocs): Likewise.
-
- * elf32-sh64.c (elf_backend_merge_symbol_attribute): Define.
- (sh64_elf_merge_symbol_attribute): New.
- * elf64-sh64.c (elf_backend_merge_symbol_attribute): Define.
- (sh64_elf64_merge_symbol_attribute): New.
-
-2003-10-14 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf-bfd.h (struct elf_backend_data): New function pointer member
- elf_backend_merge_symbol_attribute.
- * elflink.h (elf_link_add_object_symbols): Adjust call to
- elf_backend_merge_symbol_attribute if the backend defined it.
- * elfxx-target.h (elf_backend_merge_symbol_attribute): New macro.
- (elfNN_bed): Add that to the initializer.
-
-2003-10-14 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (get_is_linkonce_section): Delete.
- (xtensa_is_property_section, xtensa_is_littable_section): Use
- XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Do not recognize
- linkonce sections containing ".xt.insn" and ".xt.lit" substrings.
- (xtensa_get_property_section_name): Check section name instead of
- calling get_is_linkonce_section. Remove unused bfd parameter. Use
- XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Never generate
- linkonce section names by appending ".xt.insn" or ".xt.lit".
- (xtensa_read_table_entries): Remove bfd argument in call to
- xtensa_get_property_section_name. Free section name when done.
- (elf_xtensa_combine_prop_entries): Free leaking table.
-
-2003-10-13 Richard Sandiford <rsandifo@redht.com>
-
- * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add
- DT_MIPS_LIBLIST or DT_MIPS_CONFLICT entries.
- (_bfd_mips_elf_finish_dynamic_symbol): Don't handle them. Don't
- handle DT_MIPS_MSYM. Set DT_RELSZ based on the number of relocations
- that were needed.
- (_bfd_mips_elf_modify_segment_map): Fix placement of PT_MIPS_OPTIONS.
- (_bfd_mips_elf_merge_private_bfd_data): Ignore EF_MIPS_UCODE.
-
-2003-10-13 H.J. Lu <hongjiu.lu@intel.com>
-
- * bfd-in.h (bfd_elf32_ia64_after_parse): New prototype.
- (bfd_elf64_ia64_after_parse): Likewise.
- * bfd-in2.h: Regenerated.
-
- * elfxx-ia64.c (oor_ip): New.
- (oor_branch_size): Likewise.
- (bfd_elfNN_ia64_after_parse): Likewise.
- (elfNN_ia64_relax_section): Use oor_ip if oor_branch_size
- equals sizeof (oor_ip).
-
-2003-10-12 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf64-sh64.c (sh_elf64_relocate_section): Tidy up for the
- renumbering of some relocation numbers.
-
-2003-10-11 Alan Modra <amodra@bigpond.net.au>
-
- * coff-sh.c: Move definition of MAP and guard more code with
- COFF_IMAGE_WITH_PE.
-
- * section.c (bfd_get_section_size_before_reloc): Ignore reloc_done.
- * bfd-in2.h: Regenerate.
-
-2003-10-10 H.J. Lu <hongjiu.lu@intel.com>
-
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
- * doc/Makefile.in: Likewise.
-
-2003-10-09 H.J. Lu <hongjiu.lu@intel.com>
-
- * cofflink.c: Include "safe-ctype.h".
- (coff_link_add_symbols): Use ISDIGIT instead of isdigit.
-
-2003-10-08 Dave Brolley <brolley@redhat.com>
- On behalf of Michael Snyder <msnyder@redhat.com>
-
- * archures.c: Add FRV fr550 machine.
- * cpu-frv.c: Ditto.
- * elf32-frv.c: Ditto.
- * bfd-in2.h: Regenerate.
-
-2003-10-08 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (STUB_MOVE,STUB_LI16): Fix stub code
- for non-SGI N64 ABI. Improve code consitency.
-
-2003-10-07 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-frv.c (elf32_frv_howto_table): Set R_FRV_LABEL16's
- rightshift to 2.
-
-2003-10-07 Nathan Sidwell <nathan@codesourcery.com>
-
- * libbfd-in.h (_bfd_link_section_stabs): Add string offset
- parameter.
- * cofflink.c (coff_link_add_symbols): Deal with split stab
- sections.
- * elflink.h (elf_link_add_object_symbols): Deal with split stab
- sections.
- * stabs.c (_bfd_link_section_stabs): Add string offset parameter.
- * libbfd.h: Regenerated.
-
- * coffcode.h (coff_set_alignment_hook): With PE_COFF reloc
- overflow, set reloc start position to after the count
- reloc. Subtract one from num relocs. Give error on 0xffff relocs
- and no overflow.
- * cofflink.c (_bfd_coff_final_link): Deal with PE_COFF reloc
- overflow.
- * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Do overflow if >=
- 0xffff.
-
-2003-10-06 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Pad the
- last CIE/FDE if needed.
-
-2003-10-06 Nick Clifton <nickc@redhat.com>
-
- * targets.c (_bfd_target_vector): Include bfd_elf64_sparc_vec if
- BFD64 is enabled.
-
-2003-10-06 Matt Thomas <matt@3am-software.com>
-
- * config.bfd: Move the hppa*-*-netbsd* case to the hppa*-*-linux* case.
-
-2003-10-06 Robert Millan <robertmh@gnu.org>
-
- * configure.in: Match GNU/KNetBSD with new knetbsd*-gnu triplet.
- * config.bfd: Likewise.
- * configure: Regenerate.
-
-2003-10-04 Christian Groessler <chris@groessler.org>
-
- * coff-z8k.c (extra_case): Fix displacement length check for R_JR
- and R_CALLR.
-
-2003-10-04 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc1x.c: Update to ISO C90; replace PTR with void*.
- * elf32-m68hc11.c: Likewise.
- * elf32-m68hc12.c: Likewise.
- * elf32-m68hc1x.h: Likewise.
-
-2003-10-04 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Fix merge
- of flags between HC12 and HCS12.
-
-2003-10-04 Bryce McKinlay <bryce@mckinlay.net.nz>
-
- * merge.c (_bfd_merge_sections): Set SEC_EXCLUDE flag on sections
- which become empty after merging.
-
-2003-09-30 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c (ia64_howto_table): Fix size of R_IA64_TPREL64[LM]SB,
- R_IA64_DTPREL{32,64}[LM]SB and R_IA64_DTPMOD64[LM]SB.
-
-2003-09-30 Chris Demetriou <cgd@broadcom.com>
-
- * archures.c (bfd_mach_mipsisa64r2): New define.
- * bfd-in2.h: Regenerate.
- * aoutx.h (NAME(aout,machine_type)): Handle bfd_mach_mipsisa64r2.
- * cpu-mips.c (I_mipsisa64r2): New enum value.
- (arch_info_struct): Add entry for I_mipsisa64r2.
- * elfxx-mips.c (_bfd_elf_mips_mach)
- (_bfd_mips_elf_print_private_bfd_data): Handle E_MIPS_ARCH_64R2.
- (mips_set_isa_flags): Add bfd_mach_mipsisa64r2 case.
- (mips_mach_extensions): Add entry for bfd_mach_mipsisa64r2.
-
-2003-09-29 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_hpux_backend_symbol_processing): New.
- Handle SHN_IA_64_ANSI_COMMON.
- (elf_backend_section_from_bfd_section): Defined.
-
-2003-09-26 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.c (elf_link_read_relocs_from_section): Add an argument
- of a pointer to section. Check bad symbol index.
- (_bfd_elf_link_read_relocs): Modify calls to
- elf_link_read_relocs_from_section.
-
-2003-09-23 DJ Delorie <dj@redhat.com>
-
- * elf32-sh.c (sh_elf_howto_table): R_SH_SWITCH8,
- R_SH_GNU_VTINHERIT, R_SH_GNU_VTENTRY,
- R_SH_LOOP_START,R_SH_LOOP_END moved to "reserved" spaces,
- R_SH_DIR16, R_SH_DIR8, R_SH_DIR8UL, R_SH_DIR8UW, R_SH_DIR8U,
- R_SH_DIR8SW, R_SH_DIR8S, R_SH_DIR4UL, R_SH_DIR4UW, R_SH_DIR4U,
- R_SH_PSHA, R_SH_PSHL added.
- (sh_reloc_map): Add R_SH_DIR16 and R_SH_DIR8.
- (sh_elf_relocate_section): Support new relocs.
-
-2003-09-23 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (elf_xtensa_relocate_section): Fix typo that clobbered
- dynamic relocation offsets.
-
-2003-09-23 Alan Modra <amodra@bigpond.net.au>
-
- * simple.c (bfd_simple_get_relocated_section_contents): Free the
- hash table using _bfd_generic_link_hash_table_free.
-
-2003-09-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct bfd_elf_special_section): Remove "suffix". Change
- type of prefix_length and suffix_length to int. Rename "attributes"
- to "attr". Comment.
- (_bfd_elf_get_sec_type_attr): Update prototype.
- * elf.c (get_special_section): Rewrite.
- (_bfd_elf_get_sec_type_attr): Return struct rather than passing in
- attr and type pointers.
- (_bfd_elf_new_section_hook): Adjust for above.
- (special_sections): Merge suffix with prefix. Set
- prefix_length for all entries. Set suffix_length appropriately.
- * elf32-m32r.c (m32r_elf_special_sections): Likewise.
- * elf32-m68hc11.c (elf32_m68hc11_special_sections): Likewise.
- * elf32-m68hc12.c (elf32_m68hc12_special_sections): Likewise.
- * elf32-mcore.c (mcore_elf_special_sections): Likewise.
- * elf32-sh64.c (sh64_elf_special_sections): Likewise.
- * elf32-v850.c (v850_elf_special_sections): Likewise.
- * elf32-xtensa.c (elf_xtensa_special_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_special_sections): Likewise.
- * elf64-hppa.c (elf64_hppa_special_sections): Likewise.
- * elf64-ppc.c (ppc64_elf_special_sections): Likewise.
- * elf64-sh64.c (sh64_elf64_special_sections): Likewise.
- * elfxx-ia64.c (elfNN_ia64_special_sections): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_special_sections): Likewise.
- * elf32-ppc.c (ppc_elf_special_sections): Likewise. Fix .plt flags.
-
-2003-09-21 Daniel Jacobowitz <drow@mvista.com>
-
- * elf64-alpha.c (elf64_alpha_create_got_section): Initialize
- ->got if the section already exists.
-
-2003-09-19 Nathan Sidwell <nathan@codesourcery.com>
-
- * dwarf2.c (decode_line_info): Cope with an initially empty
- filename table.
-
-2003-09-18 H.J. Lu <hongjiu.lu@intel.com>
-
- * acinclude.m4: Include ../config/accross.m4.
- * aclocal.m4: Regenerated.
-
- * configure.host (HOST_64BIT_TYPE): Remove if it is set to long
- or long long.
- (HOST_U_64BIT_TYPE): Remove if it is set to unsigned long long.
- (host64): Remove if HOST_64BIT_TYPE is set to long.
-
- * configure.in (HOST_64BIT_TYPE): Set according to the size of
- long and long long.
- (HOST_U_64BIT_TYPE): Likewise.
- (host64): Likewise.
- * configure: Regenerated.
-
-2003-09-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (elfcore_write_note): Don't use sizeof(Elf_External_note)
- since some ABIs round up the size of the struct.
-
-2003-09-18 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.c (_bfd_elf_merge_symbol): Allow type change if
- the old symbol is undefined and the new symbol is defined.
-
-2003-09-18 Andreas Schwab <schwab@suse.de>
-
- * simple.c (bfd_simple_get_relocated_section_contents): Use
- _bfd_generic_link_hash_table_create instead of
- bfd_link_hash_table_create.
-
-2003-09-10 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_special_sections): Mark all sections
- started with ".sbss" or "".sdata" as SHF_IA_64_SHORT.
-
-2003-09-10 John David Anglin <dave.anglin@nrc-cnrc.nrc.ca>
- Randolph Chung <randolph@tausq.org>
-
- * elf32-hppa.c (struct elf32_hppa_link_hash_entry,
- hppa_link_hash_newfunc, hppa_build_one_stub,
- elf32_hppa_adjust_dynamic_symbol, mark_PIC_calls, allocate_plt_static,
- allocate_dynrelocs, elf32_hppa_size_dynamic_sections,
- elf32_hppa_finish_dynamic_symbol): Remove pic_call field and all code
- for generating import stubs for calls to statically linked PIC
- functions.
- (hppa_type_of_stub): Don't generate an import stub for calls to
- statically linked pic functions. Generate import stubs for calls
- in a shared object, to functions not in a regular file, and to
- defined weak functions. Add new argument INFO.
- (hppa_build_one_stub): Don't undef ADDIL_DP.
- (elf32_hppa_check_relocs): Don't set SEC_HAS_GOT_REF flag.
- (elf32_hppa_size_stubs): Pass info to hppa_type_of_stub.
- (final_link_relocate): Change all DLTIND relocs to DPREL relocs in a
- non-shared link. Convert instructions that use the the linkage table
- pointer, or a facsimile thereof, to use the global data pointer when
- the reloc has been changed.
-
-2003-09-08 Joel Brobecker <brobecker@gnat.com>
-
- * archures.c: Add new machine names for hppa.
- * bfd-in2.h: Regenerate.
- * cpu-hppa.c: Use the new machine names.
-
-2003-09-06 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc1x.h (struct m68hc11_elf_link_hash_table): Remove
- all_local_syms member.
- * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Use bfd_elf_get_elf_syms
- to get the local symbols.
-
-2003-09-06 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc12.c (elf32_m68hc12_special_sections): New for hc11.
- (elf_backend_special_sections): Define.a
-
- PR savannah/4950:
- * elf32-m68hc11.c (elf32_m68hc11_special_sections): The .vectors
- section is read-only.
-
-2003-09-04 Nick Clifton <nickc@redhat.com>
-
- * archures.c (bfd_mach_v850e1): Define.
- * bfd-in2.h: Regenerate.
- * cpu-v850.h (scan): Accept bfd_mach_v850e1.
- (arch_info_struct): Include an entry for bfd_mach_v850e1.
- * elf32-v850.c (v850_elf_object_p): Accept E_V850E1_ARCH flag.
- (v850_elf_final_write_processing): Accept bfd_mach_v850e1.
- (v850_elf_print_private_bfd_data): Interpret E_V850E1_ARCH flag.
- (v850_elf_merge_private_bfd_data): Allow v850e1 binaries to be
- linked with v850e binaries. Mark the output as v850e.
-
-2003-09-03 Nick Clifton <nickc@redhat.com>
-
- * cofflink.c (_bfd_coff_link_input_bfd): Do not skip section
- symbols that are used in relocs.
-
-2003-08-30 Robert Millan <robertmh@gnu.org>
-
- * configure.in: Match GNU/KFreeBSD with new kfreebsd*-gnu triplet.
- * config.bfd: Likewise.
- * configure: Regenerate.
-
-2003-08-31 Christian Groessler <chris@groessler.org>
-
- * elf32-i860.c (i860_howto_pc26_reloc): Finish relocation here
- instead of returning bfd_reloc_continue.
-
-2003-08-31 Andreas Jaeger <aj@suse.de>
-
- * merge.c: Update to ISO C90.
-
-2003-08-27 Ian Lance Taylor <ian@airs.com>
-
- * configure.in: Check for strtoull.
- * bfd.c (bfd_scan_vma): Use strtoull when available.
- * configure, config.in: Regenerate.
-
- * configure.in: Define and substitute BFD_HOST_LONG_LONG.
- * bfd-in.h: Define BFD_HOST_LONG_LONG. Test it rather than
- __GNUC__ when deciding whether to use long long for
- BFD_HOST_64_BIT.
- * configure, Makefile.in, doc/Makefile.in, bfd-in2.h: Regenerate.
-
-2003-08-27 Christian Groessler <chris@groessler.org>
-
- * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
- i860_howto_splitn_reloc, i860_howto_highadj_reloc): New
- functions.
- (elf32_i860_howto_table): Insert the new functions as
- 'special_function's in the proper reloc type entries.
-
-2003-08-27 Richard Sandiford <rsandifo@redhat.com>
-
- * elf32-frv.c (elf32_frv_relocate_section): Use
- _bfd_elf_rela_local_sym.
-
-2003-08-26 Michael Snyder <msnyder@redhat.com>
-
- * cpu-frv.c: Remove unused enum.
-
-2003-08-25 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * reloc.c: Fix documentation for MIPS ELF relocations.
- libbfd.h: Regenerate.
- bfd-in2.h: Regenerate.
-
-2003-08-24 Jason Eckhardt <jle@rice.edu>
-
- * coff-i860.c (CALC_ADDEND): Define to be a no-op.
-
-2003-08-24 Jason Eckhardt <jle@rice.edu>
-
- * elf32-i860.c (elf32_i860_relocate_pc16): Subtract 4 and
- shift by 2 before storing the relocated value.
-
-2003-08-23 Jason Eckhardt <jle@rice.edu>
-
- * coff-i860.c (coff_i860_reloc_nyi): New function.
- (howto_table): Add entries for relocations PAIR, HIGHADJ, HIGH,
- LOWn, SPLITn, and BRADDR.
- (RTYPE2HOWTO): Check that the r_type is within the howto_table
- before trying to access the entry.
- (coff_i860_rtype_to_howto): Likewise.
- (coff_i860_reloc_type_lookup): New function.
- (i860_reloc_processing): New function.
- (coff_bfd_reloc_type_lookup): Define macro.
- (RELOC_PROCESSING): Define macro.
- Minor formatting adjustments.
-
-2003-08-23 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_add_object_symbols): Don't crash on NULL owner.
-
-2003-08-22 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_create_dynamic_sections): Align the
- .got section at 8 bytes.
-
-2003-08-21 Nick Clifton <nickc@redhat.com>
-
- * cofflink.c: Update to ISO C90 and tidy up formatting.
-
-2003-08-21 Randolph Chung <tausq@debian.org>
-
- * elf32-hppa.c (elf32_hppa_object_p): For elf32-hppa-linux, objects
- can have OSABI=Linux or OSABI=SysV. Check for both.
- * elf64-hppa.c (elf64_hppa_object_p): Likewise.
-
-2003-08-21 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
-
-2003-08-20 Richard Sandiford <rsandifo@redhat.com>
-
- * elf64-mips.c (elf_backend_copy_indirect_symbol): Define.
-
-2003-08-20 Nick Clifton <nickc@redhat.com>
-
- * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): New macro used to
- replace some duplicated code in most elfxx-xxxx.c files. This
- version uses the new fields in bfd_link_info.
-
- * elf-m10300.c (mn10300_elf_relocate_section): Use new macro.
- * elf32-arm.h (elf32_arm_relocate_section): Likewise.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i386.c (elf_i386_relocate_section): Likewise.
- * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
- * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf32-vax.c (elf_vax_relocate_section): Likewise.
- * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
-
- * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols,
- elf_hppa_remark_useless_dynamic_symbols,
- elf_hppa_relocate_section): Use the new fields in
- bfd_link_info structure.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
- * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
- * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise.
- * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
-
- * elflink.h (elf_link_output_extsym): Fix test for reporting
- undefined symbols in shared libraries. Remove redundant test
- of shlib_undefined when reporting references to forced local
- symbols.
-
-2003-08-18 Andreas Schwab <schwab@suse.de>
-
- * libpei.h (bfd_pe_executable_p): Also recognize efi-app
- executables.
-
-2003-08-17 Hans-Peter Nilsson <hp@bitrange.com>
-
- * simple.c (bfd_simple_get_relocated_section_contents): Move
- reloc_done hack to before first bfd_section_size call. Change all
- returns to use new wrapper macro RETURN, restoring sec->reloc_done.
-
-2003-08-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c: Don't include elf/ppc.h.
-
-2003-08-14 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Fix PT_DYNAMIC
- code to work with 64-bit bfds.
-
-2003-08-14 Alan Modra <amodra@bigpond.net.au>
-
- * dep-in.sed: Remove libintl.h.
- * Makefile.am (SRC-POTFILES.in, BLD-POTFILES.in): Unset LC_COLLATE.
- (POTFILES.in): Remove target.
- * Makefile.in: Regenerate.
-
-2003-08-12 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_next_input_section): Update comment.
- (ppc64_elf_relocate_section): For zero sym R_PPC64_TOC relocs,
- use the function sym from the previous reloc.
-
-2003-08-11 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Make undefined symbols
- fatal if -pie.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- (ppc_elf_relocate_section) <case R_PPC_RELAX32>: Issue fatal error
- on undefined symbols if -pie.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
-
-2003-08-11 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Add special case for crt1.o
- branch to __libc_start_main.
-
-2003-08-08 Dmitry Diky <diwil@mail.ru>
-
- * archures.c: Add xW42 and xE42 parts. Sort MPU list according to
- gcc order.
- * cpu-msp430.c: Likewise.
- * elf32-msp430.c: Likewise.
- * bfd-in2.h: Regenerate.
-
-2003-08-07 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-target.h: Remove PTR cast.
- * targets.c (bfd_target): Make backend_data const void *.
- * elf-bfd.h: Constify all occurrences of struct elf_backend_data.
- * elf-m10300.c: Likewise.
- * elf.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-m68hc1x.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf32-sparc.c: Likewise.
- * elf32-xtensa.c: Likewise.
- * elf64-mips.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * elfcode.h: Likewise.
- * elfcore.h: Likewise.
- * elflink.c: Likewise.
- * elflink.h: Likewise.
- * elfxx-ia64.c: Likewise.
- * elfxx-mips.c: Likewise.
- * elfxx-mips.h: Likewise.
- * elf.c (prep_headers): Remove useless check for null backend_data.
- * bfd-in2.h: Regenerate.
-
- * elf-bfd.h: Remove PARAMS macro. Replace PTR with void *.
- (NAME): Use ## rather than CONCAT4 macro.
- * elfcode.h: Remove one remaining PARAMS macro.
- * elf-eh-frame.c: Convert to C90, remove unneeded casts and prototypes.
- * elf-strtab.c: Likewise.
- * elf-hppa.h: Likewise.
- * elf32-hppa.h: Likewise.
- * elf32-hppa.c: Likewise.
- (elf32_hppa_add_symbol_hook): Delete.
- (elf_backend_add_symbol_hook): Don't define.
- * libhppa.h: Convert to C90. Replace INLINE with inline.
-
-2003-08-06 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_stub_name): Tweak names for better readability.
- (ppc64_elf_adjust_dynamic_symbol): Allow copy relocs against
- function descriptors, but warn.
- (ppc_build_one_stub): Remove a couple of vars. Move code creating
- stub syms so that we can avoid a stub sym if we already have a
- plt sym. Do not redefine an existing symbol.
- (ppc64_elf_build_stubs): When --emit-stub-syms, print a symbol for
- glink.
-
-2003-08-06 Nick Clifton <nickc@redhat.com>
-
- * po/fr.po: Updated French translation.
-
-2003-08-06 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (_bfd_elf_create_dynamic_sections): Mark .dynbss with
- SEC_LINKER_CREATED.
-
-2003-08-05 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Use it.
-
-2003-08-03 Jeff Muizelaar <muizelaar@rogers.com>
-
- * coffcode.h (coff_slurp_line_table): Return with a warning
- message if the line number table could not be read.
-
-2003-08-04 Nick Clifton <nickc@redhat.com>
-
- * elflink.h (elf_link_add_object_symbols): Prepend "warning: "
- to messages produced for .gnu.warning.SYMBOL sections.
-
-2003-08-04 Alan Modra <amodra@bigpond.net.au>
-
- * elfcode.h: Convert to C90, remove unneeded casts and prototypes.
- * elfcore.h: Likewise.
- * elflink.c: Likewise.
- * elflink.h: Likewise.
- * elf.c (sym_is_global): Remove INLINE.
- (align_file_position): Replace INLINE with inline.
- * elfcode.h (elf_swap_dyn_in, elf_swap_dyn_out): Remove INLINE.
- (elf_file_p): Replace INLINE with inline.
-
-2003-08-02 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_check_relocs): Don't set DF_TEXTREL here.
-
-2003-08-01 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (get_got): Align the .got section at 8 bytes.
-
-2003-08-01 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Use
- ElfNN_External_Rela instead of Elf64_External_Rela.
-
-2003-08-01 Nick Clifton <nickc@redhat.com>
-
- * config.bfd: Add code to catch obsolete configurations and warn
- about them unless --enable-obsolete is used. Use this to mark
- vax-vms port as obsolete.
-
-2003-07-30 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_install_value): Tidy.
- (ppc_elf_relax_section): Remove dead code. Remove unnecessary casts.
- Formatting.
- * elfxx-target.h: Remove PARAMS macro. Formatting.
-
-2003-07-30 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (bfd_section_from_r_symndx): Test for SHN_UNDEF.
- * elf64-ppc.c (get_fdh): New function, split out from
- ppc64_elf_edit_opd.
- (ppc64_elf_check_relocs): Use get_fdh.
- (func_desc_adjust): Likewise. Tidy.
- (ppc64_elf_edit_opd): Tighten reloc checks. Free local_syms on error
- exit. Use get_fdh. Account for superfluous dynamic relocs.
- (ppc64_elf_relocate_section): Warning fix.
-
-2003-07-30 Jason Eckhardt <jle@rice.edu>
-
- * coff-i860.c: Convert to ISO C90. Remove superflous prototypes.
-
-2003-07-30 Jason Eckhardt <jle@rice.edu>
-
- * elf32-i860.c: Convert to ISO C90. Remove superflous prototypes.
-
-2003-07-30 Randolph Chung <tausq@debian.org>
-
- * elf-hppa.h (elf_hppa_relocate_section): Look up dyn_h for undefweak.
- * elf64-hppa.c (elf64_hppa_finalize_dlt): Check h->root.type.
-
-2003-07-30 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c: Convert to C90, remove unnecessary prototypes and casts.
- Replace PTR with void *. Formatting.
- (_bfd_elf_assign_file_position_for_section): Remove INLINE.
- (make_mapping): Likewise.
-
-2003-07-29 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (func_desc_adjust): Give linker created function
- descriptor symbols a size and type.
- (ppc64_elf_relocate_section): Correct lq insn test.
-
-2003-07-28 Eric Christopher <echristo@redhat.com>
-
- * elf32-ppc.c (R_PPC_RELAX32): New relocation.
- (ppc_elf_install_value): New function.
- (ppc_elf_sort_rela): Remove.
- (ppc_elf_relax_section): Rewrite. Remove old relaxation
- and replace with out of range branch stubs.
- (ppc_elf_relocate_section): Handle R_PPC_RELAX32.
-
-2003-07-29 Alexandre Oliva <aoliva@redhat.com>
-
- * elf-m10300.c (mn10300_elf_relax_section): Take symbol hash table
- from input_bfd.
-
-2003-07-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (special_sections): Set attributes for .got and .plt.
-
-2003-07-27 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Ensure no copy relocs
- on function descriptors.
- (ELIMINATE_COPY_RELOCS): Expand comment.
- (ppc64_elf_special_sections): Move. Don't include non-ppc64 sections.
- Do include ".toc1".
-
-2003-07-25 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf.c (_bfd_elf_new_section_hook): Set the default section
- type to SHT_NULL.
- (elf_fake_sections): Set the section type based on asect->flags
- if it is SHT_NULL. Don't abort on processor specific section
- types.
-
-2003-07-25 H.J. Lu <hongjiu.lu@intel.com>
-
- * bfd-in2.h: Regenerated.
-
-2003-07-25 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf-bfd.h (bfd_elf_special_section): New.
- (elf_backend_data): Add special_sections, a pointer to
- bfd_elf_special_section.
- (elf_section_type). New.
- (elf_section_flags): New.
- (_bfd_elf_get_sec_type_attr): New.
-
- * elf.c (_bfd_elf_make_section_from_shdr): Always use the
- real section type/flags.
- (special_sections): New.
- (get_special_section): New.
- (_bfd_elf_get_sec_type_attr): New.
- (_bfd_elf_new_section_hook): Check special_section to set
- elf_section_type and elf_section_flags.
- (elf_fake_sections): Don't use section name to set ELF section
- data.
-
- * elf32-m32r.c (m32r_elf_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf32-m68hc11.c (elf32_m68hc11_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf32-mcore.c (mcore_elf_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf32-ppc.c (ppc_elf_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf32-sh64.c (sh64_elf_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf32-v850.c (v850_elf_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf32-xtensa.c (elf_xtensa_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf64-alpha.c (elf64_alpha_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf64-hppa.c (elf64_hppa_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf64-ppc.c (ppc64_elf_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elf64-sh64.c (sh64_elf64_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elfxx-ia64.c (elfNN_ia64_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elfxx-mips.c (_bfd_mips_elf_special_sections): New.
-
- * elfxx-mips.h (_bfd_mips_elf_special_sections): New.
- (elf_backend_special_sections): Defined.
-
- * elfxx-target.h (elf_backend_special_sections): New. Default
- to NULL.
- (elfNN_bed): Initialize special_sections.
-
- * section.c (bfd_abs_section): Remove const.
- (bfd_und_section): Likewise.
- (bfd_com_section): Likewise.
- (bfd_ind_section): Likewise.
-
-2003-07-24 Nick Clifton <nickc@redhat.com>
-
- * coff-arm.c (EXTRA_S_FLAGS): Include SEC_CODE so that code
- sections are assigned the LOAD attribute.
-
-2003-07-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c: Convert to C90. Replace PTR with void *.
- * elf32-sh64-com.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf32-sh64.h: Likewise.
- * elf64-sh64.c: Likewise.
-
-2003-07-24 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
- (allocate_dynrelocs): Likewise.
- (sh_elf_relocate_section): Likewise. Use SYMBOL_REFERENCES_LOCAL.
- (sh_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.
-
-2003-07-24 Nick Clifton <nickc@redhat.com>
-
- * po/fr.po: Updated French translation.
-
-2003-07-23 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (xtensa_elf_dynamic_symbol_p): Make inline and move
- near the beginning of the file. Swap order of arguments. Call
- _bfd_elf_dynamic_symbol_p with "ignore_protected" set to 0.
- (elf_xtensa_fix_refcounts): Adjust xtensa_elf_dynamic_symbol_p call.
- (elf_xtensa_relocate_section): Likewise.
- (shrink_dynamic_reloc_sections): Likewise.
-
-2003-07-23 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (plt_reloc_count): Fix typo in comment.
- (elf_xtensa_size_dynamic_sections): Use elf_discarded_section.
- (elf_xtensa_combine_prop_entries): Avoid returning non-zero without
- first printing an error message.
- (elf_xtensa_finish_dynamic_sections): Likewise.
- (elf_xtensa_discard_info_for_section): Adjust size of .got.loc when
- discarding literal table entries.
- (elf_xtensa_merge_private_bfd_data): Remove newline from error message.
- (elf_xtensa_do_asm_simplify): Likewise.
-
-2003-07-23 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Avoid crash when
- we have a local symbol in common section.
-
-2003-07-22 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.c (_bfd_elf_dynamic_symbol_p): Don't return TRUE for
- weak symbols.
-
-2003-07-22 Nick Clifton <nickc@redhat.com>
-
- * coffcode.h (coff_slurp_symbol_table): Add C_TCSYM and C_ECOML to
- expected RS6000 storage classes.
-
-2003-07-21 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Mark
- output_bfd unused to silence gcc.
-
-2003-07-21 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
-
-2003-07-21 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Use..
- (_bfd_elf_symbol_refs_local_p): ..this. Declare.
- * elflink.c (_bfd_elf_symbol_refs_local_p): New function.
- * elf32-i386.c (elf_i386_relocate_section): Remove h NULL test
- now done in _bfd_elf_symbol_refs_local_p.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
-
-2003-07-18 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.c (_bfd_elf_dynamic_symbol_p): Undo the last change.
-
-2003-07-18 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf-bfd.h (SYMBOL_REFERENCES_LOCAL): Fix a typo.
- (SYMBOL_CALLS_LOCAL): Likewise.
-
- * elflink.c (_bfd_elf_dynamic_symbol_p): Return TRUE
- immediately if symbol isn't defined locally.
-
-2003-07-18 Richard Henderson <rth@redhat.com>
-
- * elflink.c (_bfd_elf_dynamic_symbol_p): New.
- * elf-bfd.h (_bfd_elf_dynamic_symbol_p): Declare it.
- (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Use it.
- * elf32-xtensa.c (xtensa_elf_dynamic_symbol_p): Likewise.
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise.
- * elf64-hppa.c (elf64_hppa_dynamic_symbol_p): Likewise.
- * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Likewise.
- Update all callers to provide the relocation being resolved.
-
-2003-07-17 Shaun Jackman <sjackman@pathwayconnect.com>
-
- * config.bfd (arm-wince-pe): Add -DARM_COFF_BUGFIX to
- targ_cflags.
-
-2003-07-17 Nick Clifton <nickc@redhat.com>
-
- * po/es.po: New Spanish translation.
- * po/sv.po: New Swedish translation.
- * po/opcodes.pot: Regenerate.
-
-2003-07-16 Richard Henderson <rth@redhat.com>
-
- * config.bfd, configure.host, configure.in: Remove ia64-aix support.
- * elfxx-ia64.c, targets.c: Likewise.
-
-2003-07-16 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Properly return false
- for symbols defined locally plus -Bsymbolic. Tidy logic.
-
-2003-07-15 Richard Sandiford <rsandifo@redhat.com>
-
- * archures.c (bfd_mach_mips7000): New.
- * bfd-in2.h: Regenerated.
- * cpu-mips.c (arch_info_struct): Add an entry for mips:7000.
- * elfxx-mips.c (mips_set_isa_flags): Handle bfd_mach_mips7000.
- (mips_mach_extensions): Add an entry for it.
-
-2003-07-14 Nick Clifton <nickc@redhat.com>
-
- * po/tr.po: Update with latest version.
- * po/SRC-POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
- * Makfile.in: Regenerate.
- * configure: Regenerate.
-
-2003-07-12 Jeff Baker <jbaker@qnx.com>
-
- * bfd/config.bfd (__QNXTARGET__): Define for Neutrino architectures.
- * bfd/elf32-arm.h (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
- * bfd/elf32-sh.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
- * bfd/elf32-ppc.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
-
-2003-07-12 Jeff Muizelaar <muizelaar@rogers.com>
-
- * coffcode.h (coff_set_section_contents): Set the
- IMAGE_FILE_32BIT_MACHINE flag for PE targets.
-
-2003-07-11 Richard Sandiford <rsandifo@redhat.com>
-
- * bfd-in.h (bfd_h8300_pad_address): Declare.
- * bfd-in2.h: Regenerate.
- * cpu-h8300.c (bfd_h8300_pad_address): New function.
- * coff-h8300.c (h8300_reloc16_estimate): Use it to canonicalize
- addresses before checking whether they can be relaxed.
- (h8300_reloc16_extra_cases): Likewise for the R_MOVL2 sanity check.
- Don't complain about overflows in general 8-bit relocations.
- * elf32-h8300.c (elf32_h8_relax_section): Use bfd_h8300_pad_address.
- Fix handling of R_H8_DIR24A8.
-
-2003-07-11 Richard Sandiford <rsandifo@redhat.com>
-
- * elf32-h8300.c: Convert function prototypes and definitions
- to C90 syntax.
- * coff-h8300.c: Likewise.
- * cpu-h8300.c: Likewise.
-
-2003-07-11 Alan Modra <amodra@bigpond.net.au>
-
- * po/SRC-POTFILES.in: Regenerate.
- * po/bfd.pot: Likewise.
-
-2003-07-10 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Create new
- .got.loc section. Do not set SEC_ALLOC or SEC_LOAD flags for the
- .xt.lit.plt section.
- (elf_xtensa_size_dynamic_sections): Set size of the .got.loc section
- and allocate memory for it.
- (elf_xtensa_combine_prop_entries): Copy contents of .xt.lit output
- section to the .got.loc section.
- (elf_xtensa_finish_dynamic_sections): Fix up call to
- elf_xtensa_combine_prop_entries and set DT_XTENSA_GOT_LOC_OFF to
- the address of .got.loc.
- (relax_property_section): Shrink .got.loc to match changes in any
- literal table section.
- (xtensa_is_property_section): Change to match
- xtensa_get_property_section_name.
- (xtensa_is_littable_section): New.
-
-2003-07-10 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (IA64_HOWTO): Set dst_mask to -1 instead of
- -1LL.
-
-2003-07-10 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-am33lin.lo.
- (BFD32_BACKENDS_CFILES): elf32-am33lin.c not elf32-am33lin.lo.
- Run "make dep-am".
- * Makefile.in: Regenerate.
-
-2003-07-10 Alexandre Oliva <aoliva@redhat.com>
-
- 2001-09-12 Alexandre Oliva <aoliva@redhat.com>
- * elf32-am33lin.c (ELF_MACHINE_CODE): Redefine to EM_MN10300.
- (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300.
- 2001-06-02 Nick Clifton <nickc@cambridge.redhat.com>
- * elf32-am33lin.c: Rename global functions.
- 2001-05-09 Alexandre Oliva <aoliva@redhat.com>
- * config.bfd (am33_2.0, am33_2.0-*-linux*): Added.
- * configure.in (bfd_elf32_am33lin_vec): Added.
- * Makefile.am (BFD32_BACKENDS): Added elf32-am33lin.lo.
- (elf32-am33lin.lo): List dependencies.
- * aclocal.m4, configure, Makefile.in: Rebuilt.
- * elf-m10300.c (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME,
- ELF_ARCH, ELF_MACHINE_CODE, ELF_MAXPAGESIZE): Define only if
- ELF_ARCH was not defined before.
- (elf_symbol_leading_char): Define if not defined.
- * elf32-am33lin.c: Override the definitions above.
- * targets.c (bfd_elf32_am33lin_vec): New.
-
-2003-07-09 Alexandre Oliva <aoliva@redhat.com>
-
- 2002-12-12 Alexandre Oliva <aoliva@redhat.com>
- * elf-m10300.c (elf32_mn10300_link_hash_newfunc): Initialize
- pcrel_relocs_copied.
- 2001-12-13 Alexandre Oliva <aoliva@redhat.com>
- * elf-m10300.c (ELF_DYNAMIC_INTERPRETER): Renamed from
- ld-linux.so.2 to ld.so.1.
- 2001-10-10 Alexandre Oliva <aoliva@redhat.com>
- * elf-m10300.c (elf_mn10300_sizeof_plt0): New macro.
- (_bfd_mn10300_elf_adjust_dynamic_symbol): Use it.
- (_bfd_mn10300_elf_finish_dynamic_symbol): Likewise.
- * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Allocate
- .rela.* section contents with bfd_zalloc.
- 2001-09-25 Alexandre Oliva <aoliva@redhat.com>
- * elf-m10300.c: Added declarations for functions missing them.
- Merge some shared-library changes from the i386 back-end. Use
- R_MN10300_RELATIVE instead of R_MN10300_PCREL32 and
- R_MN10300_GLOB_DAT instead of R_MN10300_32 where appropriate.
- (struct elf32_mn10300_link_hash_entry): Remove duplicates of
- members of elf_link_hash_entry. Adjusted references.
- (mn10300_elf_final_link_relocate): dynobj was already loaded
- into a local variable, use it.
- 2001-09-21 Nick Clifton <nickc@cambridge.redhat.com>
- * elf-m10300.c: Add missing function prototypes.
- 2001-08-24 Alexandre Oliva <aoliva@redhat.com>
- * elf-m10300.c (mn10300_elf_relocate_section): Don't compute
- relocation for dynamic relocations.
- 2001-05-16 Alexandre Oliva <aoliva@redhat.com>
- * reloc.c (BFD_RELOC_MN10300_GOTOFF24): New.
- * elf-m10300.c: Introduce GOTPC16, GOTOFF24, GOTOFF16 and
- PLT16, and rename GOTPC to GOTPC32 and GOTOFF to GOTOFF32.
- (_bfd_mn10300_elf_create_dynamic_sections): Move creation ot PLT...
- (_bfd_mn10300_elf_create_got_section): ... here, so that its
- adress is already known at the time we compute relaxations.
- (mn10300_elf_relax_section): Relax GOTPC32, GOTOFF32, GOT32
- and PLT32 to narrower relocations.
- * libbfd.h, bfd-in2.h: Rebuilt.
- 2001-04-12 Alexandre Oliva <aoliva@redhat.com>
- * reloc.c (BFD_RELOC_MN10300_GOT32, BFD_RELOC_MN10300_GOT24,
- BFD_RELOC_MN10300_GOT16, BFD_RELOC_MN10300_COPY,
- BFD_RELOC_MN10300_GLOB_DAT, BFD_RELOC_MN10300_JMP_SLOT,
- BFD_RELOC_MN10300_RELATIVE): New relocs.
- * libbfd.h, bfd-in2.h: Rebuilt.
- * elf-m10300.c (struct elf_mn10300_pcrel_relocs_copied): New.
- (struct elf32_mn10300_link_hash_entry): Added DSO-related
- fields.
- (elf_mn10300_howto): Defined new relocation types.
- (mn10300_reloc_map): Map them.
- (_bfd_mn10300_elf_create_got_section): New fn.
- (mn10300_elf_check_relocs): Handle PIC relocs.
- (mn10300_elf_final_link_relocate): Likewise.
- (mn10300_elf_relocate_section): Handle DSOs.
- (PLT0_ENTRY_SIZE, PLT_ENTRY_SIZE, PIC_PLT_ENTRY_SIZE): New macros.
- (elf_mn10300_plt0_entry, elf_mn10300_plt_entry,
- elf_mn10300_pic_plt_entry): New.
- (elf_mn10300_sizeof_plt, elf_mn10300_plt_plt0_offset,
- elf_mn10300_plt0_linker_offset, elf_mn10300_plt0_gotid_offset,
- elf_mn10300_plt_temp_offset, elf_mn10300_plt_symbol_offset,
- elf_mn10300_plt_reloc_offset: New macros.
- (ELF_DYNAMIC_INTERPRETER): Likewise.
- (_bfd_mn10300_elf_create_dynamic_sections): New function.
- (_bfd_mn10300_elf_adjust_dynamic_symbol): Likewise.
- (_bfd_mn10300_elf_discard_copies): Likewise.
- (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
- (_bfd_mn10300_elf_finish_dynamic_symbol): Likewise.
- (_bfd_mn10300_elf_finish_dynamic_sections): Likewise.
- (elf_backend_can_gc_sections,
- elf_backend_create_dynamic_sections,
- elf_backend_adjust_dynamic_sections,
- elf_backend_size_dynamic_sections,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
- elf_backend_plt_readonly, elf_backend_want_plt_sym,
- elf_backend_got_header_size, elf_backend_plt_header_size): New
- macros.
-
-2003-07-09 Alexandre Oliva <aoliva@redhat.com>
-
- 2001-05-06 Alexandre Oliva <aoliva@redhat.com>
- * elf-m10300.c (compute_function_info): Account for AM33
- registers in `movm' when computing stack space for `call' when
- linking for AM33/2.0 link.
- 2000-04-01 Alexandre Oliva <aoliva@cygnus.com>
- * archures.c (bfd_mach_am33_2): Renamed from bfd_mach_am332.
- * bfd-in2.h: Rebuilt.
- * cpu-m10300.c (bfd_am33_2_arch): Renamed from bfd_am332_arch.
- * elf-m10300.c: Updated.
- 2000-03-31 Alexandre Oliva <aoliva@cygnus.com>
- * archures.c (bfd_mach_am332): Defined.
- * bfd-in2.h: Rebuilt.
- * cpu-m10300.c (bfd_am332_arch): Defined.
- (bfd_am33_arch): Chained with am33-2.
- * elf-m10300.c (elf_mn10300_mach): Handle am332.
- (_bfd_mn10300_elf_final_write_processing): Likewise.
-
-2003-07-09 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (IA64_HOWTO): Set dst_mask to -1LL.
-
-2003-07-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (bfd_elf64_mkobject): Define.
- (struct ppc64_elf_obj_tdata): New.
- (ppc64_elf_tdata, ppc64_tlsld_got): Define.
- (ppc64_elf_mkobject): New function.
- (struct got_entry): Add "owner". Move "tls_type".
- (struct ppc_link_hash_table): Delete "relgot", "tlsld_got".
- (ppc64_elf_init_stub_bfd): New function.
- (create_got_section): Create header .got in dynobj. Create .got
- and .rela.got in each bfd. Stash pointers in ppc64_elf_obj_tdata.
- (ppc64_elf_create_dynamic_sections): Don't call create_got_section.
- Look for dynobj .got, and test it.
- (ppc64_elf_copy_indirect_symbol): Adjust for changed got.
- (update_local_sym_info): Likewise.
- (ppc64_elf_check_relocs): Likewise.
- (ppc64_elf_gc_sweep_hook): Likewise.
- (ppc64_elf_tls_optimize): Likewise.
- (allocate_dynrelocs): Likewise.
- (ppc64_elf_size_dynamic_sections): Likewise.
- (ppc64_elf_relocate_section): Likewise.
- (ppc64_elf_next_toc_section): Update comment.
- (toc_adjusting_stub_needed): Remove unneeded cast.
- (ppc64_elf_build_stubs): Check for stub sections in stub bfd by
- testing section flags.
- (ppc64_elf_build_stubs): Likewise.
- (ppc64_elf_size_stubs): Likewise. Remove stub_bfd param.
- (ppc64_elf_finish_dynamic_sections): Write out got sections.
- (func_desc_adjust): Copy over dynamic info for undef weaks.
- * elf64-ppc.h (ppc64_elf_init_stub_bfd): Declare.
- (ppc64_elf_size_stubs): Update prototype.
- * elflink.h (elf_link_sort_relocs): Use link_orders to find reldyn
- input sections rather than scanning dynobj.
-
-2003-07-09 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (mips_elf_link_hash_entry): Remove min_dyn_reloc_index.
- (bfd_mips_elf_swap_msym_in, bfd_mips_elf_swap_msym_out): Delete.
- (mips_elf_create_msym_section): Delete.
- (mips_elf_create_dynamic_relocation): Don't set min_dyn_reloc_index.
- (_bfd_mips_elf_copy_indirect_symbol): Likewise.
- (_bfd_mips_elf_create_dynamic_sections): Don't create .msym.
- (_bfd_mips_elf_size_dynamic_sections): Don't calculate its size.
- (_bfd_mips_elf_size_dynamic_sections): Don't add DT_MIPS_MSYM.
- (_bfd_mips_elf_finish_dynamic_symbol): Don't add symbols to .msym.
- (_bfd_mips_elf_finish_dynamic_sections): Likewise.
-
-2003-07-09 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (mips_elf_irix6_finish_dynamic_symbol): Make the
- symbols protected.
-
-2003-07-09 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Fix handling
- of relocations whose offset is -2.
-
-2003-07-09 Richard Sandiford <rsandifo@redhat.com>
-
- * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): Treat
- forced-local symbols like other locals. Don't create relocations
- against STN_UNDEF in irix objects.
-
-2003-07-09 Richard Sandiford <rsandifo@redhat.com>
-
- * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): In SGI-
- compatible objects, add the values of defined external symbols
- to the addend.
-
-2003-07-09 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Always
- initialize a GOT entry to the symbol's st_value.
-
-2003-07-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_obj_tdata): Move linker_section_pointers..
- * elf32-ppc.c (struct ppc_elf_obj_tdata): ..to here. New.
- (ppc_elf_tdata): Define.
- (elf_local_ptr_offsets): Adjust.
- (ppc_elf_mkobject): New function.
- (bfd_elf32_mkobject): Define.
-
- * elfcode.h (elf_object_p): Allocate tdata via _bfd_set_format.
- * elfcore.h (elf_core_file_p): Likewise.
- * section.c (bfd_section_init): Remove prototype.
-
-2003-07-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_link_hash_entry): Remove linker_section_pointer
- field.
- (enum elf_linker_section_enum): Delete.
- (struct elf_linker_section): Delete.
- (struct elf_linker_section_pointers): Delete.
- (struct elf_obj_tdata): Remove #if 0 chunk. Remove linker_section.
- Make linker_section_pointers a void**.
- (elf_local_ptr_offsets, elf_linker_section): Don't define.
- * elf32-ppc.c (enum elf_linker_section_enum): New, cut-down version
- of old item in elf-bfd.h.
- (struct elf_linker_section): Likewise.
- (struct elf_linker_section_pointers): Likewise.
- (elf_local_ptr_offsets): Define.
- (struct ppc_elf_link_hash_entry): Add linker_section_pointer.
- (ppc_elf_link_hash_newfunc): Init it.
- (struct ppc_elf_link_hash_table): Add sbss.
- (ppc_elf_link_hash_table_create): zmalloc rather than clearing
- individual fields.
- (elf_create_linker_section): Fold into..
- (ppc_elf_create_linker_section): ..here. Remove hole_size code.
- Make rela section here if shared.
- (elf_find_pointer_linker_section): Pass lsect rather than enum.
- (elf_create_pointer_linker_section): Adjust. zalloc rather than
- clearing in a loop.
- (elf_finish_pointer_linker_section): Adjust. Don't make rela
- section here.
- (ppc_elf_check_relocs): Adjust.
- (ppc_elf_add_symbol_hook): Tighten hash creator test. Remove code
- creating .sbss by hand.
- * elf.c (_bfd_elf_link_hash_newfunc): Adjust.
-
-2003-07-04 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-s390.c (elf_howto_table): Change R_390_GOT12 to
- complain_overflow_bitfield.
- * elf64-s390.c (elf_howto_table): Change R_390_GOT12 to
- complain_overflow_bitfield.
-
-2003-07-04 Jakub Jelinek <jakub@redhat.com>
-
- * elf-bfd.h (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Return
- true even if -pie.
-
-2003-07-04 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add rel_fptr_sec.
- (elfNN_ia64_dynamic_symbol_p): Change info->shared into
- !info->executable.
- (get_fptr): For -pie create .opd as writable section and create
- .rela.opd as well.
- (elfNN_ia64_check_relocs): Change info->shared into
- !info->executable.
- (allocate_fptr): Likewise.
- (allocate_dynrel_entries): Account for a relative reloc for -pie
- @fptr(). Don't account for a relative reloc if -pie want_ltoff_fptr
- for undefweak symbol. Account for an IPLT reloc in .rela.opd
- section if -pie.
- (set_got_entry): Don't create a relative reloc if -pie
- want_ltoff_fptr for undefweak symbol.
- (set_fptr_entry): Emit an IPLT reloc in .rela.opd for -pie.
- (elfNN_ia64_relocate_section): Emit a relative reloc for -pie
- @fptr().
-
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Issue undefined_symbol
- even if -pie.
- * elf32-i386.c (elf_i386_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
-
-2003-07-04 Paul Clarke <paulc@senet.com.au>
-
- * elf32-h8300.c (R_H8_DIR32A16): Fix name field.
- (elf32_h8_relax_section) <R_H8_DIR16A8>: Adjust position of relocation.
- <R_H8_DIR32A16>: Fix type of relocation.
-
-2003-07-04 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_create_dynamic_sections): Return if dynamic
- sections were created already. Remove unnecessary tests of
- the previous change.
-
-2003-07-04 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_create_dynamic_sections): Don't call
- bfd_make_section for existing sections.
-
-2003-07-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-sparc.c (elf32_sparc_check_relocs): Don't call
- create_got_section if we already have done so.
- * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
- (sh_elf_check_relocs): Likewise.
- (sh_elf_adjust_dynamic_symbol): Delete "dynobj" var. Use
- htab->root.dynobj instead.
- (sh_elf_check_relocs): Likewise.
- (sh_elf_finish_dynamic_sections): Likewise.
-
- * section.c (bfd_make_section): Return NULL for existing section.
-
-2003-07-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_create_dynamic_sections): Don't call
- ppc_elf_create_got if we've already done so.
-
- * elf-bfd.h (_bfd_elf_create_linker_section) Don't declare.
- (_bfd_elf_find_pointer_linker_section): Likewise.
- (bfd_elf32_create_pointer_linker_section): Likewise.
- (bfd_elf32_finish_pointer_linker_section): Likewise.
- (bfd_elf64_create_pointer_linker_section): Likewise.
- (bfd_elf64_finish_pointer_linker_section): Likewise.
- (_bfd_elf_make_linker_section_rela): Likewise.
- * elfcode.h (elf_create_pointer_linker_section): Don't define.
- (elf_finish_pointer_linker_section): Likewise.
- * elflink.c (_bfd_elf_make_linker_section_rela): Delete.
- (_bfd_elf_create_linker_section): Move this function..
- (_bfd_elf_find_pointer_linker_section): ..and this..
- * elflink.h (elf_create_pointer_linker_section): ..and this..
- (elf_finish_pointer_linker_section): ..and this..
- * elf32-ppc.c: ..to here, renaming to the following, and adjusting
- calls.
- (elf_create_linker_section): Convert to C90, tidy.
- (elf_find_pointer_linker_section): Likewise.
- (elf_create_pointer_linker_section): Likewise.
- (elf_finish_pointer_linker_section): Likewise.
- * elf32-i370.c: Delete #if 0 code.
-
-2003-07-02 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't allow _savef* and
- _restf* to be satisfied by shared libs, and always force them local.
- (toc_adjusting_stub_needed): Avoid scanning linker created sections.
- Correct test for "bl".
- (ppc64_elf_relocate_section <R_PPC64_TLS>): Correct test for
- primary opcode 31.
-
-2003-07-01 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390.c (s390_elf_ldisp_reloc): New prototype.
- (s390_tls_reloc): New function.
- (elf_howto_table): Add long displacement relocations R_390_20,
- R_390_GOT20, R_390_GOTPLT20 and R_390_TLS_GOTIE20.
- (elf_s390_reloc_type_lookup): Likewise.
- (elf_s390_check_relocs): Likewise.
- (elf_s390_gc_sweep_hook): Likewise.
- (elf_s390_relocate_section): Likewise.
- * elf64-s390.c: Same changes as for elf32-s390.c.
- * reloc.c: Add long displacement relocations BFD_RELOC_390_20,
- BFD_RELOC_390_GOT20, BFD_RELOC_390_GOTPLT20 and
- BFD_RELOC_390_TLS_GOTIE20.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Likewise.
-
-2003-06-30 Alan Modra <amodra@bigpond.net.au>
-
- * cpu-ia64-opc.c (ext_imms_scaled): Don't sign extend using shifts.
- (ins_imms, ins_immsm1u4): Likewise. Warning fix.
-
-2003-06-29 Alan Modra <amodra@bigpond.net.au>
-
- * archive.c: Convert to C90, remove unnecessary prototypes and casts.
- Replace PTR with void *. Formatting.
- * archive64.c: Likewise.
- * archures.c: Likewise.
- * bfd-in.h: Likewise.
- * bfd.c: Likewise.
- * bfdio.c: Likewise.
- * bfdwin.c: Likewise.
- * cache.c: Likewise.
- * corefile.c: Likewise.
- * format.c: Likewise.
- * init.c: Likewise.
- * libbfd-in.h: Likewise.
- * libbfd.c: Likewise.
- * linker.c: Likewise.
- * opncls.c: Likewise.
- * reloc.c: Likewise.
- * section.c: Likewise.
- * simple.c: Likewise.
- * syms.c: Likewise.
- * targets.c: Likewise.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
- * ecoff.c (bfd_debug_section): Add missing kept_section initialization.
- * libbfd-in.h (_bfd_sh_align_load_span): Don't declare if defined.
- * libbfd.c (COERCE32, EIGHT_GAZILLION): Simplify.
- (bfd_getb64): Rewrite without parens.
- (bfd_getl64, bfd_getb_signed_64, bfd_getl_signed_64): Likewise.
- * cache.c (insert, snip): Remove INLINE.
- * linker.c (bfd_link_add_undef): Likewise.
-
-2003-06-29 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c: Convert to ISO C90 prototypes, remove
- unnecessary prototypes. Replace PTR with void *.
- (elf64_x86_64_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL to
- trim plt entries. Move undefweak non-default visibility test ...
- (allocate_dynrelocs): ... from here.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
- Change all callers.
- (allocate_dynrelocs): Use SYMBOL_CALLS_LOCAL. Use
- SYMBOL_REFERENCES_LOCAL for dynreloc check.
- (elf64_x86_64_relocate_section): Use SYMBOL_CALLS_LOCAL for
- dynreloc and .got relocs.
- (elf64_x86_64_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL
- for .got relocs.
-
-2003-06-29 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c: Allow lazy binding for R_MIPS_JALR.
-
-2003-06-27 Nick Clifton <nickc@redhat.com>
-
- * opncls.c (bfd_add_gnu_debuglink_section): Rename to
- bfd_add_gnu_debuglink_section and only create the section, do not
- fill in its contents.
- (bfd_fill_in_gnu_debuglink_section): New function. Fill in the
- contents of a .gnu-debuglink section.
- * bfd-in2.h: Regenerate.
-
-2003-06-27 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c: Revert .got alignment to 2**4.
-
-2003-06-27 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c: Fix addend for _gp_disp special symbol.
-
-2003-06-27 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (_bfd_mips_elf_fake_sections): Remove non-default
- relocation header setup.
-
-2003-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_howto_table): Remove unnecessary cast.
- (ppc_elf_reloc_type_lookup): Modify comment.
- (ppc_elf_info_to_howto): Ditto.
- (ppc_elf_relocate_section): Ditto.
- (ppc_elf_check_relocs): Call ppc_elf_howto_init.
-
-2003-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * aout-ns32k.c: Correct spelling of "relocatable".
- * aoutx.h: Likewise.
- * bfd-in.h: Likewise.
- * bfd.c: Likewise.
- * bout.c: Likewise.
- * coff-a29k.c: Likewise.
- * coff-alpha.c: Likewise.
- * coff-arm.c: Likewise.
- * coff-i386.c: Likewise.
- * coff-i860.c: Likewise.
- * coff-i960.c: Likewise.
- * coff-m68k.c: Likewise.
- * coff-m88k.c: Likewise.
- * coff-mcore.c: Likewise.
- * coff-mips.c: Likewise.
- * coff-or32.c: Likewise.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * coff-sh.c: Likewise.
- * coff-tic80.c: Likewise.
- * coff64-rs6000.c: Likewise.
- * cofflink.c: Likewise.
- * cpu-ns32k.c: Likewise.
- * ecoff.c: Likewise.
- * ecofflink.c: Likewise.
- * elf-bfd.h: Likewise.
- * elf-eh-frame.c: Likewise.
- * elf-hppa.h: Likewise.
- * elf-m10200.c: Likewise.
- * elf-m10300.c: Likewise.
- * elf.c: Likewise.
- * elf32-arm.h: Likewise.
- * elf32-avr.c: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-d10v.c: Likewise.
- * elf32-dlx.c: Likewise.
- * elf32-fr30.c: Likewise.
- * elf32-frv.c: Likewise.
- * elf32-h8300.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-i860.c: Likewise.
- * elf32-i960.c: Likewise.
- * elf32-ip2k.c: Likewise.
- * elf32-iq2000.c: Likewise.
- * elf32-m32r.c: Likewise.
- * elf32-m68hc11.c: Likewise.
- * elf32-m68hc1x.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-mips.c: Likewise.
- * elf32-msp430.c: Likewise.
- * elf32-openrisc.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf32-sparc.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf32-vax.c: Likewise.
- * elf32-xstormy16.c: Likewise.
- * elf32-xtensa.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-hppa.c: Likewise.
- * elf64-mips.c: Likewise.
- * elf64-mmix.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * elfcode.h: Likewise.
- * elflink.h: Likewise.
- * elfn32-mips.c: Likewise.
- * elfxx-ia64.c: Likewise.
- * elfxx-mips.c: Likewise.
- * i386linux.c: Likewise.
- * ieee.c: Likewise.
- * libcoff-in.h: Likewise.
- * linker.c: Likewise.
- * m68klinux.c: Likewise.
- * pdp11.c: Likewise.
- * pe-mips.c: Likewise.
- * peXXigen.c: Likewise.
- * reloc.c: Likewise.
- * reloc16.c: Likewise.
- * sparclinux.c: Likewise.
- * sunos.c: Likewise.
- * syms.c: Likewise.
- * versados.c: Likewise.
- * vms.c: Likewise.
- * xcofflink.c: Likewise.
- * bfd-in2.h: Regenerate.
- * libcoff.h: Regenerate.
- * libbfd.h: Regenerate.
-
-2003-06-24 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_check_relocs): Report plt reloc against
- local sym errors.
-
- * elf32-i386.c: Convert to C90 function definitions, remove unnecessary
- prototypes and casts. Replace PTR with void *. Formatting.
- * elf32-ppc.c: Likewise. Break long strings too.
- (ppc_elf_relax_section): Use enum elf_ppc_reloc_type for r_type.
- (ppc_elf_unhandled_reloc): Internationalize error message.
- * elf32-ppc.h: Remove PARAMS.
-
-2003-06-23 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-ppc.c (ppc_elf_begin_write_processing): Use bytes to count
- APUinfo slots.
- (ppc_elf_final_write_processing): Likewise.
-
-2003-06-23 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.h (elf_link_input_bfd): Check raw size when using
- kept_section to preserve debug information discarded by
- linkonce.
-
-2003-06-20 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (struct ppc_link_hash_table): Add top_id.
- (ppc64_elf_setup_section_lists): Set it.
- (ppc64_elf_relocate_section): Check sym section id against top_id.
- (ppc_build_one_stub): Comment on top_id.
-
-2003-06-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
-
- * config.bfd: Add tic4x-*-rtems*.
-
-2003-06-20 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c: Convert to C90 function definitions, remove unnecessary
- prototypes and casts. Replace PTR with void *. Format copyright.
- Mention ABI links.
- (struct ppc_link_hash_table): Rename sgot, srelgot, splt, srelplt,
- sdynbss, srelbss, sglink, sbrlt and srelbrlt to got, relgot .. relbrlt.
- (ppc_type_of_stub): Make r_type an enum.
- (ppc64_elf_size_stubs): Likewise.
- * elf64-ppc.h: Remove PARAMS macro.
-
-2003-06-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_link_hash_table_create): Reinstate init of
- elf hash tab fields.
-
- * elf64-ppc.c (ppc64_elf_reloc_type_lookup): Tidy prototype.
- (ppc64_elf_info_to_howto): Likewise.
- (ppc64_elf_build_stubs): Add "stats" param, and print statistics.
- * elf64-ppc.h (ppc64_elf_build_stubs): Adjust prototype.
-
-2003-06-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Ignore R_SPARC_DISP32
- reloc overflow on discarded eh_frame entries.
-
-2003-06-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (toc_adjusting_stub_needed): New function.
- (ppc64_elf_next_input_section): Use it here to set has_gp_reloc.
- Return error condition.
- (ppc64_elf_size_stubs): Restrict toc adjusting stubs to sections
- that have has_gp_reloc set.
- (struct ppc_link_hash_table): Add stub_count.
- (ppc_build_one_stub): Increment it.
- (ppc64_elf_link_hash_table_create): zmalloc rather than clearing
- individual fields.
- * elf64-ppc.h (ppc64_elf_next_input_section): Update prototype.
-
-2003-06-18 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_gc_record_vtentry): Revert last change. Correct
- size calculation from addend. Round size up.
-
-2003-06-18 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section) <case
- R_CRIS_32_GOTREL>: When linking a program, don't complain about a
- symbol from a normal object or an undefined weak symbol.
-
-2003-06-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Accept a symbol on
- R_PPC64_TOC relocs.
-
-2003-06-17 H.J. Lu <hongjiu.lu@intel.com>
-
- * section.c (struct sec): Put back kept_section.
- (STD_SECTION): Put back kept_section initialization.
- * bfd-in2.h: Regenerate.
-
- * elflink.h (elf_link_input_bfd): Also check discarded linkonce
- sections for relocateable output. Use kept_section to preserve
- debug information discarded by linkonce.
-
-2003-06-17 Roland McGrath <roland@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Support
- segment-relative relocation between different segments.
-
-2003-06-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Do unaligned reloc
- optimizations earlier.
-
- * elf64-ppc.c (struct ppc_link_hash_table): Reinstate top_index.
- Restore previous input_list type.
- (ppc64_elf_link_hash_table_create): Undo last change.
- (ppc64_elf_setup_section_lists): Reinstate code setting up input lists
- per output section, but don't bother with bfd_abs_section marker.
- (ppc64_elf_next_input_section): Adjust for multiple input section
- lists.
- (group_sections): Likewise.
-
-2003-06-17 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-ppc.c (ppc64_elf_relocation_section): Ensure
- *r_offset == r_addend for RELATIVE relocs against .got.
-
-2003-06-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Optimize unaligned relocs.
-
-2003-06-17 Nick Clifton <nickc@redhat.com>
-
- * elflink.h (elf_gc_record_vtentry): Allocate an extra element
- in the vtable_entries_used array to allow for the accessing
- the largest element.
-
-2003-06-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (struct ppc_link_hash_table): Remove top_index. Modify
- input_list.
- (ppc64_elf_link_hash_table_create): Init input_list here.
- (ppc64_elf_setup_section_lists): Remove code setting up input lists
- per output section. Set toc_off for abs and other standard sections.
- (ppc64_elf_reinit_toc): Don't set elf_gp on input bfds lacking a toc.
- (ppc64_elf_next_input_section): Adjust for single input section list.
- Don't set toc_curr from input bfds that haven't set elf_gp.
- (group_sections): Adjust for single input section list.
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Correct pcrel section zero.
-
-2003-06-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): When optimizing toctprel
- tls, check that a TOC16_DS or TOC16_LO_DS reloc isn't pointing to a
- dtprel entry. Ensure TLS_LD DTPMOD reloc has a zero addend. Write
- got section for RELATIVE relocs. Fix wrong comment. Change condition
- under which dynamic relocs update the section contents.
-
-2003-06-13 Robert Millan <zeratul2@wanadoo.es>
-
- * config.bfd: Add i386-netbsd-gnu target.
-
-2003-06-12 Nick Clifton <nickc@redhat.com>
-
- * opncls.c (calc_crc32): Rename to
- bfd_calc_gnu_debuglink_crc32 and export.
- (GNU_DEBUGLINK): Define and use to replace occurrences of
- hard-coded ".gnu_debuglink" in the code.
- (get_debug_link_info): Prevent aborts by replacing call to
- xmalloc with a call to malloc.
- (find_separate_debug_file): Prevent aborts by replacing calls
- to xmalloc and xstrdup with calls to malloc and strdup.
- (bfd_add_gnu_debuglink): New function. Add a .gnu_debuglink
- section to a bfd.
- * bfd-in2.h: Regenerate.
-
-2003-06-12 Federico G. Schwindt <fgsch@lodoss.net>
-
- * config.bfd (i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3]):
- New target (was i[3-7]86-*-openbsd* before).
- (i[3-7]86-*-openbsd*): Change to use bfd_elf32_i386_vec.
- (vax-*-openbsd*): New target.
-
-2003-06-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (MIPS_ELF_OPTIONS_SECTION_NAME): Use .MIPS.options
- for n32, too.
- (MIPS_ELF_STUB_SECTION_NAME): Use .MIPS.stubs for n32, too.
- (mips_elf_rel_dyn_section): Use appropriate section alignment.
- (mips_elf_create_got_section): Likewise.
- (_bfd_mips_elf_create_dynamic_sections): Likewise.
-
-2003-06-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (mips_elf_generic_reloc): New Function.
- (elf_mips_howto_table_rel): Use it.
- (gprel32_with_gp): Move prototype.
- (mips_elf_hi16_reloc): Check for ! BSF_LOCAL instead of zero addend.
- Use mips_elf_generic_reloc.
- (mips_elf_got16_reloc): Check for ! BSF_LOCAL instead of zero addend.
- Code cleanup.
- (_bfd_mips_elf32_gprel16_reloc): Check for ! BSF_LOCAL instead of
- zero addend.
- (mips_elf_gprel32_reloc): Likewise. Use the same GP assignment logic
- as in the other *_gprel*_reloc functions.
- (gprel32_with_gp): Handle partial_inplace properly.
- (mips32_64bit_reloc): Use mips_elf_generic_reloc.
- (mips16_gprel_reloc): Check for ! BSF_LOCAL instead of zero addend.
- Do addend handling directly instead of calling
- _bfd_mips_elf_gprel16_with_gp. Handle partial_inplace properly.
- * elf64-mips.c (mips_elf64_hi16_reloc): Check for ! BSF_LOCAL instead
- of zero addend. Handle partial_inplace properly.
- (mips_elf64_got16_reloc): Check for ! BSF_LOCAL instead of zero
- addend.
- (mips_elf64_gprel16_reloc): Likewise.
- (mips_elf64_literal_reloc): Likewise.
- (mips_elf64_gprel32_reloc): Likewise. Use the same GP assignment
- logic as in the other *_gprel*_reloc functions. Handle
- partial_inplace properly.
- (mips_elf64_shift6_reloc): Check for ! BSF_LOCAL instead of zero
- addend. Handle partial_inplace properly.
- (mips16_gprel_reloc): Likewise. Do addend handling directly instead
- of calling _bfd_mips_elf_gprel16_with_gp.
- * elfn32-mips.c (mips_elf_got16_reloc): Check for BSF_LOCAL.
- (mips_elf_gprel32_reloc): Check for ! BSF_LOCAL instead
- of zero addend.
- (mips_elf_shift6_reloc): Handle partial_inplace properly.
- (mips16_gprel_reloc): Likewise. Do addend handling directly instead
- of calling _bfd_mips_elf_gprel16_with_gp.
- * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Handle
- partial_inplace properly. Fix wrong addend handling. Fix overflow
- check.
- (_bfd_mips_elf_sign_extend): Renamed from mips_elf_sign_extend and
- exported.
- (mips_elf_calculate_relocation): Use _bfd_mips_elf_sign_extend.
- (_bfd_mips_elf_relocate_section): Likewise.
- (mips_elf_create_dynamic_relocation): Update sec_info_type access.
- * elfxx-mips.h (_bfd_mips_relax_section): Fix prototype declaration.
- (_bfd_mips_elf_sign_extend): New prototype.
-
-2003-06-11 Federico G. Schwindt <fgsch@lodoss.net>
-
- * config.bfd (sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1]):
- New target (was sparc-*-openbsd* before).
- (sparc-*-openbsd*): Change to use bfd_elf32_sparc_vec.
-
- * configure.in (vax-*-openbsd*): Set COREFILE to netbsd-core.lo.
- * configure: Regenerate.
-
-2003-06-11 H.J. Lu <hongjiu.lu@intel.com>
-
- * po/Make-in (DESTDIR): New.
- (install-data-yes): Support $(DESTDIR).
- (uninstall): Likewise.
-
-2003-06-11 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (config.status): Depend on version.h.
- Run "make dep-am".
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2003-06-10 Alan Modra <amodra@bigpond.net.au>
- Gary Hade <garyhade@us.ibm.com>
-
- * elf64-ppc.c (ppc64_elf_relocate_section <*_DS>): Special case lq.
-
-2003-06-10 Richard Sandiford <rsandifo@redhat.com>
-
- * archures.c (bfd_mach_h8300sxn): New architecture.
- * bfd-in2.h: Regenerate.
- * cpu-h8300.c (h8300_scan): Check for 'sxn'.
- (h8300sxn_info_struct): New.
- (h8300sx_info_struct): Link to it.
- * elf32-h8300.c (elf32_h8_mach): Add h8300sxn case.
- (elf32_h8_final_write_processing): Likewise.
-
-2003-06-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c: Move TARGET_LITTLE_SYM and other macros used by
- elfxx-target.h so that we can use elf_backend_got_header_size.
- (ELF_MACHINE_ALT1, ELF_MACHINE_ALT2): Delete.
- (GLINK_CALL_STUB_SIZE): Modify. Define new glink call stub and
- associated macros.
- (ppc64_elf_howto_raw <GOT_TPREL16_DS, GOT_TPREL16_LO_DS>): Correct
- dst_mask.
- (enum ppc_stub_type): Add ppc_stub_long_branch_r2off and
- ppc_stub_plt_branch_r2off.
- (struct ppc_stub_hash_entry): Reorganize.
- (struct ppc_link_hash_table): Add no_multi_toc, multi_toc_needed,
- toc_curr, toc_off and emit_stub_syms.
- (ppc64_elf_link_hash_table_create): Init them.
- (ppc_stub_name): Correct string size.
- (ppc64_elf_check_relocs): Set has_gp_reloc on GOT and TOC relocs.
- (ppc64_elf_size_dynamic_sections): Set no_multi_toc if GOT entries
- used.
- (ppc_type_of_stub): Tweak root.type test.
- (build_plt_stub): Remove glink code. Adjust for insn macro changes.
- (ppc_size_one_stub): Handle ppc_stub_long_branch_r2off and
- ppc_stub_plt_branch_r2off.
- (ppc_build_one_stub): Likewise. Fix var shadowing. Correct addis,addi
- range test. Use toc_off to calculte r2 values. Handle emit_stub_syms.
- (ppc64_elf_setup_section_lists): Remove htab creator flavour test.
- Initialize elf_gp and toc_curr.
- (ppc64_elf_next_toc_section, ppc64_elf_reinit_toc): New functions.
- (ppc64_elf_next_input_section): Set toc_off.
- (group_sections): Ensure groups have the same TOC.
- (ppc64_elf_size_stubs): Check whether we need a TOC adjusting stub.
- (ppc64_elf_build_stubs): Add emit_stub_syms param, and stash in htab.
- Build new glink stub.
- (ppc64_elf_relocate_section): Handle multiple TOCs. Fix comments.
- (ppc64_elf_finish_dynamic_sections): Adjust DT_PPC64_GLINK.
- * elf64-ppc.h (ppc64_elf_build_stubs): Update prototype.
- (ppc64_elf_next_toc_section, ppc64_elf_reinit_toc): Declare.
- * section.c (struct sec): Rename flag12 to has_gp_reloc.
- (STD_SECTION): Update.
- * ecoff.c (bfd_debug_section): Update comment.
- * bfd-in2.h: Regenerate.
-
-2003-06-05 Daniel Jacobowitz <drow@mvista.com>
-
- * elfcode.h (elf_slurp_reloc_table_from_section): Don't dereference
- NULL function pointers.
-
-2003-06-05 Daniel Jacobowitz <drow@mvista.com>
-
- * simple.c (bfd_simple_get_relocated_section_contents): Call
- _bfd_generic_link_add_symbols instead of bfd_link_add_symbols.
-
-2003-06-04 Svein E. Seldal <Svein.Seldal@solidas.com>
-
- * coff-tic54x.c: Removed the ticoff0_bad_format_hook() and
- ticoff1_bad_format_hook() functions. Removed the coff0 and coff1
- swaptables.
- * coff-tic4x.c: Ditto
- * coffcode.h: Added extra arguments to CREATE_BIG_COFF_TARGET_VEC
- and CREATE_LITTLE_COFF_TARGET_VEC. Created the macro
- CREATE_BIGHDR_COFF_TARGET_VEC. Created the ticoff0_bad_format_hook(),
- ticoff1_bad_format_hook() functions. Created the coff0 and coff1
- swap tables.
- * coff-tic4x.c: Adopted new CREATE_xxx_COFF_TARGET_VEC macros.
- * coff-a29k.c: Append COFF_SWAP_TABLE argument
- * coff-apollo.c: Ditto
- * coff-arm.c: Ditto
- * coff-h8300.c: Ditto
- * coff-h8500.c: Ditto
- * coff-i960.c: Ditto
- * coff-m68k.c: Ditto
- * coff-m88k.c: Ditto
- * coff-mcore.c: Ditto
- * coff-sh.c: Ditto
- * coff-sparc.c: Ditto
- * coff-tic80.c: Ditto
- * coff-we32k.c: Ditto
- * coff-z8k.c: Ditto
- * coff-w65.c: Ditto
-
-2003-06-04 Svein E. Seldal <Svein.Seldal@solidas.com>
-
- * coff-tic4x.c (ticoff0_swap_table, ticoff1_swap_table): Fixed
- initialization bug
-
-2003-06-03 Jakub Jelinek <jakub@redhat.com>
-
- * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_STACK.
- (bfd_section_from_phdr): Likewise.
- (map_sections_to_segments): Create PT_GNU_STACK segment header.
- (get_program_header_size): Count with PT_GNU_STACK.
- * elf-bfd.h (struct elf_obj_tdata): Add stack_flags.
- * elflink.h (bfd_elfNN_size_dynamic_sections): Set stack_flags.
-
-2003-06-03 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.h (elf_link_input_bfd): Call linker error_handler
- for discarded definitions.
-
-2003-06-03 Elias Athanasopoulos <elathan@phys.uoa.gr>
-
- * syms.c (decode_section_type): Return 'n' if section flags are
- SEC_HAS_CONTENTS && SEC_READONLY.
-
-2003-06-03 Nick Clifton <nickc@redhat.com>
-
- * elf32-v850.c (v850_elf_howto_t): Rename R_V850_32to
- R_V850_ABS32. Add entry for R_V850_REL32.
- (v850_elf_reloc_map): Likewise.
- (v850_elf_check_relocs): Likewise.
- (v850_elf_perform_relocation): Likewise.
- (v850_elf_final_link_relocate): Likewise. Include computation
- to make R_V850_REl32 pc-relative.
-
-2003-06-03 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_size_dynamic_sections): Create .interp section
- and DT_DEBUG dynamic tag even for position independent executables.
- * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewize.
-
-2003-06-02 Daniel Jacobowitz <drow@mvista.com>
-
- * config.bfd: Move obsolete entries out of the range of the
- targmatch sed script.
-
-2003-06-02 Daniel Jacobowitz <drow@mvista.com>
-
- * config.bfd (mips*-dec-bsd*, mips*-*-pe*): Mark as obsolete.
-
-2003-05-31 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-ppc.c (allocate_dynrelocs): Use single slot for first 8192
- plt entries, not just 8191.
-
-2003-05-30 Daniel Jacobowitz <drow@mvista.com>
-
- * elfxx-mips.c (_bfd_mips_elf_discard_info): Correct loop index.
- Reported by Ken Faiczak <kfaiczak@SANDVINE.com>.
-
-2003-05-30 Ulrich Drepper <drepper@redhat.com>
- Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_link_add_object_symbols): Use !info->executable
- instead of info->shared where appropriate.
- (bfd_elfNN_size_dynamic_sections, elf_link_output_extsym): Likewise.
- * elflink.c (_bfd_elf_create_got_section): Likewise.
- (_bfd_elf_link_create_dynamic_sections): Likewise.
- (_bfd_elf_link_assign_sym_version): Likewise.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Create .interp section
- and DT_DEBUG dynamic tag even for position independent executables.
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
- * elf32-s390.c (elf_s390_size_dynamic_sections: Likewise.
- * elf64-ppc.c (ppc64_elf_size_dynamic_sections: Likewise.
- * elf64-s390.c (elf_s390_size_dynamic_sections: Likewise.
- * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections: Likewise.
- * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections: Likewise.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections: Likewise.
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections: Likewise.
- * elf64-sparc.c (sparc64_elf_size_dynamic_sections: Likewise.
-
-2003-05-30 Kris Warkentin <kewarken@qnx.com>
-
- * elf.c (elfcore_grok_nto_status): Only set lwpid for the active or
- signalled thread.
- (elfcore_grok_nto_gregs): Only make .reg section for the active thread.
-
-2003-05-29 Nick Clifton <nickc@redhat.com>
-
- * pef.c: Include "safe-ctype.h" instead of <ctype.h>.
- Tidy up formatting.
- * Makefile.am: Add dependency on safe-ctype.h.
- * Makefile.in: Regenerate.
-
-2003-05-29 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c: Don't force symbols local unconditionally.
-
-2003-05-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Delete bogus
- undefined_symbol call.
-
-2003-05-27 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c (mips_elf_hash_sort_data): Fix formattting.
- (mips_elf_link_hash_table): Likewise.
-
-2003-05-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf64-mips.c (elf_mips_gnu_rel16_s2): Add internally used
- R_MIPS_GNU_REL16_S2 support.
- (bfd_elf64_bfd_reloc_type_lookup): Use it.
- (mips_elf64_rtype_to_howto): Use it.
- * elfn32-mips.c (elf_mips_gnu_rel16_s2): Add internally used
- R_MIPS_GNU_REL16_S2 support.
- (bfd_elf32_bfd_reloc_type_lookup): Use it.
- (mips_elf_n32_rtype_to_howto): Use it.
-
-2003-05-21 Stuart F. Downing <sdowning@fame.com>
-
- * som.h: Define PA_2_0 before including a.out.h
-
-2003-05-07 Eric Christopher <echristo@redhat.com>
- Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Adjust
- pic tests, change to warning.
- (_bfd_mips_elf_final_link): Remove EF_MIPS_CPIC flag setting.
-
-2003-05-21 Marcus Comstedt <marcus@mc.pp.se>
-
- * config.bfd: Check for a target triplet of shl-...-netbsdelf as
- well as shle-...-netbsdelf. Remove duplicate entry.
-
-2003-05-21 Nick Clifton <nickc@redhat.com>
-
- * elf32-xstormy16.c (xstormy16_elf_howto_table): Fix dst_mask
- for X_STORMY16_REL_12 reloc.
-
- * elf.c (bfd_elf_get_needed_list): Use is_elf_hash_table to check
- the type of the hash table in the bfd_link_info structure.
- (bfd_elf_get_runpath_list): Likewise.
-
-2003-05-19 Roland McGrath <roland@redhat.com>
-
- * elf.c (bfd_elf_bfd_from_remote_memory): New function.
- * bfd-in.h: Declare it.
- * bfd-in2.h: Regenerated.
- * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New function.
- * elf-bfd.h (struct elf_backend_data): New function pointer member
- elf_backend_bfd_from_remote_memory.
- (_bfd_elf32_bfd_from_remote_memory, _bfd_elf64_bfd_from_remote_memory):
- Declare them.
- * elfxx-target.h (elf_backend_bfd_from_remote_memory): New macro.
- (elfNN_bed): Add that to the initializer.
-
-2003-05-15 Roland McGrath <roland@redhat.com>
-
- * elf.c (elfcore_grok_note): Grok NT_AUXV note, make ".auxv" section.
-
-2003-05-20 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_link_output_extsym): Only issue error about !=
- STV_DEFAULT symbols if they are bfd_link_hash_undefined.
-
-2003-05-20 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.c (_bfd_elf_merge_symbol): Check ELF_LINK_DYNAMIC_DEF
- when removing the old definition for symbols with non-default
- visibility.
-
-2003-05-18 Jason Eckhardt <jle@rice.edu>
-
- * elf32-i860.c (elf32_i860_relocate_highadj): Simplify calculation.
-
-2003-05-17 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (elf_m68k_check_relocs): Cache reloc section in
- elf_section_data during processing of pc-relative and absolute
- relocations.
- (elf_m68k_relocate_section): Use the cached reloc section instead
- of computing it again. Fix handling of visibility. Don't modify
- addend when copying over a relocation into the output.
-
-2003-05-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
- to trim plt entries. Move undefweak non-default visibility test..
- (allocate_dynrelocs): ..from here.
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't test
- dynamic_sections_created here. Update comment. Move undefweak
- non-default visibility test..
- (allocate_dynrelocs): ..from here. Fix comment.
- * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
- to trim plt entries. Move undefweak non-default visibility test..
- (allocate_dynrelocs): ..from here. Fix comment.
- * elflink.h (elf_link_output_extsym): Compare ELF_ST_VISIBILITY with
- STV_DEFAULT rather than comparing with zero.
- * elflink.c (_bfd_elf_merge_symbol): Likewise.
- (_bfd_elf_fix_symbol_flags): Likewise. Format comment.
-
-2003-05-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * bfd.c (_bfd_get_gp_value): Prevent illegal access for abfd null
- pointers.
- (_bfd_set_gp_value): Likewise.
-
-2003-05-16 Michael Snyder <msnyder@redhat.com>
- From Bernd Schmidt <bernds@redhat.com>
- * archures.c (bfd_mach_h8300sx): New.
- * bfd-in2.h: Regenerate.
- * cpu-h8300.c (h8300_scan)): Add support for h8300sx.
- (h8300sx_info_struct): New.
- (h8300s_info_struct): Link to it.
- * elf32-h8300.c (elf32_h8_mach): Add support for h8300sx.
- (elf32_h8_final_write_processing): Likewise.
- (elf32_h8_relax_section): Likewise.
-
-2003-05-16 Kelley Cook <kelleycook@wideopenwest.com>
-
- * config.bfd: Accept i[3-7]86 variants.
- * configure.host: Likewise.
- * configure.in: Likewise.
- * configure: Regenerate.
-
-2003-05-15 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.c (_bfd_elf_fix_symbol_flags): Also hide protected
- symbol.
-
-2003-05-15 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.h (elf_link_check_versioned_symbol): Also allow
- the base version.
-
-2003-05-15 Alan Modra <amodra@bigpond.net.au>
- H.J. Lu <hongjiu.lu@intel.com>
-
- * elf32-i386.c (allocate_dynrelocs): Use SYMBOL_CALLS_LOCAL.
- (elf_i386_relocate_section): Likewise.
- * elf32-ppc.c (allocate_dynrelocs): Likewise.
- (ppc_elf_relocate_section): Likewise.
- * elf64-ppc.c (allocate_dynrelocs): Likewise.
- (ppc64_elf_relocate_section): Likewise.
-
-2003-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (gprel32_with_gp): Remove useless N64 ABI case.
-
-2003-05-13 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Check for
- processor capability, allow merge of HC12 and HCS12 in some cases.
- (m68hc11_elf_hash_table_create): Use bfd_malloc instead of bfd_zalloc.
- * cpu-m68hc12.c (bfd_m68hc12s_arch): New struct.
- (bfd_m68hc12_arch): Link it.
- (scan_mach): New function.
-
-2003-05-13 Andrew Haley <aph@redhat.com>
-
- * elf.c (bfd_elf_hash): Mask lower 32 bits of hash.
-
-2003-05-13 Alan Modra <amodra@bigpond.net.au>
- H.J. Lu <hongjiu.lu@intel.com>
-
- * elf-bfd.h (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Move from
- elf32-ppc.c. Add ELF_LINK_FORCED_LOCAL check.
- * elf32-ppc.c: (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Delete.
- (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL for dynreloc check.
- (ppc_elf_relocate_section): Likewise.
- * elf64-ppc.c (allocate_dynrelocs): Likewise.
- (ppc64_elf_relocate_section): Likewise. Use for .got relocs too.
- (ppc64_elf_adjust_dynamic_symbol): Don't assume symbols with .plt
- relocs need no other types.
- * elf32-i386.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL for
- dynreloc check.
- (elf_i386_relocate_section): Likewise. Use for .got relocs too.
- (elf_i386_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL for
- .got relocs.
-
-2003-05-13 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_adjust_dynamic_symbol): For weak symbols,
- copy ELF_LINK_NON_GOT_REF from weakdef.
- (allocate_dynrelocs): For undef weak syms with non-default
- visibility, a) don't allocate plt entries, b) don't allocate
- .got relocs, c) discard dyn rel space
- (sh_elf_relocate_section): d) don't generate .got relocs, e)
- don't generate dynamic relocs.
- (sh_elf_copy_indirect_symbol): Don't copy ELF_LINK_NON_GOT_REF
- for weakdefs when symbol already adjusted.
-
-2003-05-12 Nick Clifton <nickc@redhat.com>
-
- * elf32-xstormy16.c (xstormy16_elf_howto_table): use 'bitfield'
- overflow detection for R_XSTORMY16_16 reloc.
-
-2003-05-12 Paul Clarke <paulc@senet.com.au>
-
- * elf32-h8300.c: Fix typo in name of R_H8_DIR8 reloc.
-
-2003-05-11 Jason Eckhardt <jle@rice.edu>
-
- * elf32-i860.c (elf32_i860_relocate_highadj): Properly
- adjust upper bits.
- (elf32_i860_relocate_splitn): Obtain upper 5 bits from the
- proper place.
- (elf32_i860_relocate_pc16): Obtain upper 5 bits from the
- proper place.
-
-2003-05-11 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (elf_m68k_relocate_section): Replace ugly
- complicated tests for unresolvable relocs with a simple direct
- scheme using "unresolved_reloc" var. Report some detail on
- bfd_reloc_outofrange and similar errors.
-
-2003-05-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390.c (allocate_dynrelocs, elf_s390_relocate_section):
- Fix WILL_CALL_FINISH_DYNAMIC_SYMBOL call.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
- * elf64-s390.c: Likewise.
-
-2003-05-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390.c (ELIMINATE_COPY_RELOCS): Define as one.
- (elf_s390_adjust_dynamic_symbol): For weak symbols, copy
- ELF_LINK_NON_GOT_REF from weakdef.
- (elf_s390_copy_indirect_symbol): Test whether the weakdef sym has
- already been adjusted before treating it specially.
- * el64-s390.c: Likwise.
-
-2003-05-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-s390.c (allocate_dynrelocs): For undef weak syms with
- non-default visibility, a) don't make them dynamic, b) discard
- space for dynamic relocs.
- (elf_s390_relocate_section): Initialize the GOT entries and skip
- R_390_{8,16,32}/R_390_PC{16,16DBL,32DBL,32} for weak undefined
- symbols with non-default visibility.
- * elf64-s390.c: Likewise.
-
-2003-05-09 Alan Modra <amodra@bigpond.net.au>
-
- * cpu-arm.c (arm_check_note): Warning fix.
- * elf32-iq2000.c (iq2000_elf_check_relocs): Warning fixes. Arrange
- to keep relocs if edited.
- (iq2000_elf_print_private_bfd_data): Return TRUE.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Use ELFNN_R_SYM, not
- ELF64_R_SYM.
- (elfNN_ia64_relax_ldxmov): Warning fix.
- * xtensa-isa.c (xtensa_add_isa): Warning fix.
- * xtensa-modules.c (get_num_opcodes): Warning fix.
-
-2003-05-09 Andrey Petrov <petrov@netbsd.org>
-
- * elf.c (elf_fake_sections): Use correct cast for sh_name.
-
-2003-05-09 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (_bfd_elf_link_create_dynamic_sections): Move from
- elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align.
- (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align.
- (bfd_elf_record_link_assignment): Move from elflink.h.
- (_bfd_elf_merge_symbol): Likewise.
- (_bfd_elf_add_default_symbol): Likewise.
- (_bfd_elf_export_symbol): Likewise.
- (_bfd_elf_link_find_version_dependencies): Likewise.
- (_bfd_elf_link_assign_sym_version): Likewise.
- (_bfd_elf_link_read_relocs): Likewise.
- (_bfd_elf_link_size_reloc_section): Likewise.
- (_bfd_elf_fix_symbol_flags): Likewise.
- (_bfd_elf_adjust_dynamic_symbol): Likewise.
- (_bfd_elf_link_sec_merge_syms): Likewise.
- (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel
- and bed->s->sizeof_rela.
- (_bfd_elf_link_output_relocs): Likewise.
- * elf-bfd.h (struct elf_size_info): Rename file_align to
- log_file_align.
- (struct elf_info_failed): Move from elflink.h.
- (struct elf_assign_sym_version_info): Likewise.
- (struct elf_find_verdep_info): Likewise.
- (_bfd_elf_create_dynamic_sections): Delete duplicate declaration.
- (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol,
- _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies,
- _bfd_elf_link_assign_sym_version,
- _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs,
- _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs,
- _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol,
- _bfd_elf_link_sec_merge_syms): Declare.
- (bfd_elf32_link_create_dynamic_sections): Don't declare.
- (_bfd_elf32_link_read_relocs): Likewise.
- (bfd_elf64_link_create_dynamic_sections): Likewise.
- (_bfd_elf64_link_read_relocs): Likewise.
- * elflink.h: Move lots o' stuff elsewhere.
- * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare.
- (bfd_elf64_record_link_assignment): Likewise.
- (bfd_elf_record_link_assignment): Declare.
- * bfd-in2.h: Regenerate.
- * elfcode.h (elf_link_create_dynamic_sections): Don't declare.
- (NAME(_bfd_elf,size_info)): Adjust for log_file_align.
- * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align.
- (assign_file_positions_for_segments): Likewise.
- (assign_file_positions_except_relocs): Likewise.
- (swap_out_syms, elfcore_write_note): Likewise.
- * elf-m10200.c: Adjust for changed function names.
- * elf-m10300.c: Likewise.
- * elf32-arm.h: Likewise.
- * elf32-h8300.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-ip2k.c: Likewise.
- * elf32-m32r.c: Likewise.
- * elf32-m68hc11.c: Likewise.
- * elf32-m68hc1x.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mips.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf32-xtensa.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-hppa.c: Likewise.
- * elf64-mmix.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elfxx-ia64.c: Likewise.
- * elfxx-mips.c: Likewise.
- (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align.
- * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align.
- * elf64-hppa.c (hppa64_elf_size_info): Likewise.
- * elf64-mips.c (mips_elf64_size_info): Likewise.
- * elf64-s390.c (s390_elf64_size_info): Likewise.
- * elf64-sparc.c (sparc64_elf_size_info): Likewise.
-
-2003-05-08 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.h (elf_add_default_symbol): After skipping the
- unversioned symbol, go to non-default one.
-
-2003-05-07 H.J. Lu <hongjiu.lu@intel.com>
-
- * elfxx-ia64.c (_bfd_elf_link_hash_hide_symbol): Also clear the
- want_plt field.
- (elfNN_ia64_relocate_section): Don't do dynamic symbol lookup
- for symbols with non-default visibility.
-
-2003-05-07 H.J. Lu <hongjiu.lu@intel.com>
-
- * elflink.h (elf_link_check_versioned_symbol): Also handle the
- case that a DSO references a hidden symbol which may be
- satisfied by a versioned symbol in another DSO.
- (elf_link_output_extsym): Check versioned definition for hidden
- symbol referenced by a DSO.
-
-2003-05-07 Nick Clifton <nickc@redhat.com>
-
- * elf32-xstormy16.c (xstormy16_elf_howto_table): Reset
- R_XSTORMY16_16 reloc to ignore overflows.
-
-2003-05-06 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Improve
- error message for mixing different-endian files. Check for ABI
- compatibility of input files with the selected emulation.
-
-2003-05-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (allocate_dynrelocs): For undef weak syms with
- non-default visibility, a) don't make them dynamic, b) discard
- space for dynamic relocs.
- * elf64-x86-64.c (allocate_dynrelocs): Likewise.
-
- * elf32-ppc.c (allocate_dynrelocs): For undef weak syms with
- non-default visibility, a) don't allocate plt entries, b) don't
- allocate .got relocs, c) discard dyn rel space,
- (ppc_elf_relocate_section): d) don't generate .got relocs, e)
- don't generate dynamic relocs.
- * elf64-ppc.c (allocate_dynrelocs): As above.
- (ppc64_elf_relocate_section): As above.
-
-2003-05-05 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (allocate_dynrelocs): Don't allocate dynamic
- relocation entries for weak undefined symbols with non-default
- visibility.
- (elf64_x86_64_relocate_section): Initialize the GOT entries and
- skip R_386_32/R_386_PC32 for weak undefined symbols with
- non-default visibility.
-
-2003-05-04 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (allocate_dynrelocs): Don't allocate dynamic
- relocation entries for weak undefined symbols with non-default
- visibility.
- (elf_i386_relocate_section): Initialize the GOT entries and
- skip R_386_32/R_386_PC32 for weak undefined symbols with
- non-default visibility.
-
- * elfxx-ia64.c (allocate_fptr): Don't allocate function
- descriptors for weak undefined symbols with non-default
- visibility.
- (allocate_dynrel_entries): Don't allocate relocation entries
- for symbols resolved to 0.
- (set_got_entry): Don't install dynamic relocation for weak
- undefined symbols with non-default visibility.
- (set_pltoff_entry): Likewise.
-
- * elflink.h (elf_fix_symbol_flags): Hide weak undefined symbols
- with non-default visibility.
- (elf_link_output_extsym): Don't make weak undefined symbols
- with non-default visibility dynamic.
-
-2003-05-04 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_merge_symbol): Correctly handle weak definition.
-
-2003-05-04 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_merge_symbol): Don't record a hidden/internal
- symbol dynamic. Check indirection when removing the old
- definition for symbols with non-default visibility.
- (elf_add_default_symbol): Skip when told by elf_merge_symbol.
-
-2003-05-02 Nick Clifton <nickc@redhat.com>
-
- * elf32-xstormy16.c (xstormy16_elf_howto_table): Make the
- R_XSTORMY16_8 and R_XSTORMY16_16 relocs detect and complain about
- unsigned overflow.
-
-2003-05-02 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf_x86_64_copy_indirect_symbol): Don't copy
- ELF_LINK_NON_GOT_REF for weakdefs when symbol already adjusted.
- (ELIMINATE_COPY_RELOCS): Define as one. Use throughout.
- (elf_x86_64_adjust_dynamic_symbol): For weak symbols, copy
- ELF_LINK_NON_GOT_REF from weakdef.
-
-2003-05-02 Charles Lepple <clepple@ghz.cc>
- Nick Clifton <nickc@redhat.com>
-
- * acinclude.m4: Fix name of --enable-install-libbfd switch.
- * aclocal.m4: Regenerate.
- * configure: Regenerate.
- * Makefile.in: Regenerate.
-
-2003-05-01 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Test whether the
- weakdef sym has already been adjusted before treating it specially.
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Don't copy
- ELF_LINK_NON_GOT_REF for weakdefs when symbol already adjusted.
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
- (ppc64_elf_check_relocs): Set ELF_LINK_NON_GOT_REF.
-
-2003-04-28 H.J. Lu <hjl@gnu.org>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Relax ldxmov during
- the relax finalize pass.
-
- * section.c (struct sec): Add need_finalize_relax and remove
- flag11.
- (STD_SECTION): Update struct sec initializer.
- * bfd-in2.h: Regenerated.
-
-2003-04-28 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_merge_symbol): Call elf_backend_copy_indirect_symbol
- to copy any information related to dynamic linking when we flip
- the indirection.
-
-2003-04-27 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (ELF_LINK_DYNAMIC_DEF): New.
- (ELF_LINK_DYNAMIC_WEAK): New.
-
- * elflink.h (elf_merge_symbol): Add one argument to indicate if
- a symbol should be skipped. Ignore definitions in dynamic
- objects for symbols with non-default visibility.
- (elf_add_default_symbol): Adjusted.
- (elf_link_add_object_symbols): Check if a symbol should be
- skipped. Don't merge the visibility field with the one from
- a dynamic object.
- (elf_link_check_versioned_symbol): Use undef_bfd.
- (elf_link_output_extsym): Warn if a forced local symbol is
- referenced from dynamic objects. Make non-weak undefined symbol
- with non-default visibility a fatal error.
-
-2003-04-27 Daniel Jacobowitz <drow@mvista.com>
-
- * configure.in: Bump version on HEAD to 2.14.90.
- * configure: Regenerated.
-
-2003-04-26 Stephane Carrez <stcarrez@nerim.fr>
-
- PR savannah/3331:
- * elf32-m68hc11.c (m68hc11_elf_relax_section): Clear prev_insn_group
- when we couldn't relax something.
-
-2003-04-25 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_merge_symbol): When we find a regular definition
- for an indirect symbol, flip the indirection so that the old
- direct symbol now points to the new definition.
-
-2003-04-24 Roland McGrath <roland@redhat.com>
-
- * elf.c (bfd_section_from_phdr): Map PT_GNU_EH_FRAME to "eh_frame_hdr".
-
-2003-04-24 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c: Formatting and comment fixes.
- (ELIMINATE_COPY_RELOCS): Move before ppc_elf_copy_indirect_symbol.
- (ppc_elf_copy_indirect_symbol): Copy flags here for weakdefs.
-
-2003-04-24 Dhananjay Deshpande <dhananjayd@kpitcummins.com>
-
- * archures.c (bfd_mach_h8300hn, bfd_mach_h8300sn): Added.
- * bfd-in2.h: Rebuilt.
- * coff-h8300.c (BADMAG): Add check for H8300HNBADMAG & H8300SNBADMAG.
- * coffcode.h (coff_set_arch_mach_hook): Add case for H8300HNMAGIC
- & H8300SNMAGIC.
- (coff_set_flags): Add case for bfd_mach_h8300hn & bfd_mach_h8300sn.
- * cpu-h8300.c (h8300_scan): Handle h8300hn, h8300sn.
- (h8300sn_info_struct, h8300hn_info_struct): New.
- * elf32-h8300.c (elf32_h8_mach): Handle case for h8300hn & h8300sn
- (elf32_h8_final_write_processing): Likewise.
-
-2003-04-23 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (tpoff): New.
- (struct elf_sh_dyn_relocs): Remove tls_tpoff32.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
- (allocate_dynrelocs): Don't make unnecessary dynamic TLS
- relocations. Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses.
- (sh_elf_relocate_section): Likewise. Remove unnecessary tests.
- (dtpoff_base): Fix wrong indentation.
- (sh_elf_check_relocs): Don't set DF_STATIC_TLS flag with non-TLS
- relocations. Don't set tls_tpoff32 flag. Don't make unnecessary
- R_SH_TLS_TPOFF32 relocations.
-
-2003-04-23 J"orn Rennecke <joern.rennecke@superh.com>
-
- * archures.c (enum bfd_architecture): Amend comment to refer to SuperH.
- * cpu-sh.c: Likewise.
- * elf32-sh.c: Likewise.
- * reloc.c (bfd_reloc_code_real): Likewise.
- * elf32-sh64-com.c: Change comment to refer to SuperH.
- * elf32-sh64.c: Likewise.
- * elf64-sh64.c: Likewise.
- * bfd-in2.h (enum bfd_architecture): Regenerate.
-
-2003-04-23 Alan Modra <amodra@bigpond.net.au>
-
- From Julien LEMOINE <speedblue@debian.org>
- * elf32-i386.c (elf_i386_info_to_howto): Delete.
- (elf_info_to_howto): Define as elf_i386_info_to_howto_rel.
-
-2003-04-22 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
-
- * archures.c: Replace references to Mitsubishi M32R with references
- to Renesas M32R.
- * relocs.c: Likewise.
- * bfd-in2.h: Regenerate.
-
-2003-04-21 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Return false for an
- executable when a symbol is defined both regular and dynamic.
-
-2003-04-21 Stephane Carrez <stcarrez@nerim.fr>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-m68hc1x.lo.
- (elf32-m68hc1x.lo): Update dependencies
- * configure.in: Add elf32-m68hc1x.lo.
- * configure: Rebuild.
- * Makefile.in: Rebuild.
-
-2003-04-21 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc1x.c: New file (from elf32-m68hc11.c and elf32-m68hc12.c)
- (m68hc11_elf_hash_table_create): New function.
- (elf32_m68hc11_link_hash_table_free): New function.
- (stub_hash_newfunc): New function.
- (m68hc11_add_stub): New function.
- (elf32_m68hc11_add_symbol_hook): New function.
- (elf32_m68hc11_setup_section_lists): New function.
- (elf32_m68hc11_next_input_section): New function.
- (elf32_m68hc11_size_stubs): New function.
- (elf32_m68hc11_build_stubs): New function.
- (m68hc11_get_relocation_value): New function.
- (elf32_m68hc11_relocate_section): Call the above to redirect
- some relocations to the trampoline code.
- (m68hc11_elf_export_one_stub): New function.
- (m68hc11_elf_set_symbol): New function.
- (elf32_m68hc11_build_stubs): Call it via bfd_hash_traverse.
- (m68hc11_elf_get_bank_parameters): Get parameters only when the info
- is not yet initialized.
-
- * elf32-m68hc1x.h: New file (from elf32-m68hc11.c and elf32-m68hc12.c)
- (elf32_m68hc11_stub_hash_entry): New struct.
- (m68hc11_page_info): Add trampoline handler address.
- (m68hc11_elf_link_hash_table): Add stubs generation members.
- (elf32_m68hc11_add_symbol_hook): Declare.
- (elf32_m68hc11_setup_section_lists): Declare.
- (elf32_m68hc11_size_stubs): Declare.
- (elf32_m68hc11_build_stubs): Declare.
-
- * elf32-m68hc11.c (m68hc11_elf_ignore_reloc): Move to elf32-m68hc1x.c.
- (elf32_m68hc11_gc_mark_hook, elf32_m68hc11_gc_sweep_hook): Likewise.
- (elf32_m68hc11_check_relocs, elf32_m68hc11_relocate_section): Ditto.
- (_bfd_m68hc11_elf_set_private_flags): Ditto.
- (_bfd_m68hc11_elf_merge_private_bfd_data): Ditto.
- (_bfd_m68hc11_elf_print_private_bfd_data): Ditto.
- (bfd_elf32_bfd_link_hash_table_create): Define.
- (elf_backend_add_symbol_hook): Define.
- (m68hc11_elf_bfd_link_hash_table_create): New function.
- (m68hc11_elf_build_one_stub): New function.
- (m68hc11_elf_size_one_stub): New function.
- (m68hc11_elf_bfd_link_hash_table_create): Install the above.
- (bfd_elf32_bfd_link_hash_table_create): Define.
-
- * elf32-m68hc12.c (m68hc11_elf_ignore_reloc): Remove.
- (m68hc12_addr_is_banked): Remove, use m68hc11_addr_is_banked.
- (m68hc12_phys_addr): Ditto.
- (m68hc12_phys_page): Ditto.
- (m68hc12_elf_special_reloc): Move to elf32-m68hc1x.c.
- (elf32_m68hc11_gc_mark_hook): Likewise.
- (elf32_m68hc11_gc_sweep_hook): Likewise.
- (elf32_m68hc11_check_relocs): Likewise.
- (elf32_m68hc11_relocate_section): Likewise.
- (_bfd_m68hc12_elf_set_private_flags): Likewise.
- (_bfd_m68hc12_elf_merge_private_bfd_data): Likewise.
- (_bfd_m68hc12_elf_print_private_bfd_data): Likewise.
- (m68hc12_elf_build_one_stub): New function.
- (m68hc12_elf_size_one_stub): New function.
- (m68hc12_elf_bfd_link_hash_table_create): New function, use the above.
- (elf_backend_add_symbol_hook): Define.
- (elf_m68hc11_howto_table): Use TRUE for pcrel relocs; fix masks.
-
-2003-04-18 Nick Clifton <nickc@redhat.com>
-
- * format.c (bfd_check_format_matches): Only check associated
- vector if the matching_vector has been created.
-
-2003-04-15 Alexandre Oliva <aoliva@redhat.com>
-
- * dwarf2.c (_bfd_dwarf2_find_nearest_line): Fix typo in
- 2003-04-09's change.
-
-2003-04-15 Brian Ford <ford@vss.fsi.com>
-
- * peicode.h (coff_swap_scnhdr_in): If a section holds
- uninitialized data and is from an object file or from an
- executable image that has not initialized the s_size field, or if
- the physical size is padded, use the virtual size (stored in
- s_paddr) instead.
-
-2003-04-15 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Properly report
- filename for alignment reduction.
-
-2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com>
-
- * archures.c: Replace occurrances of 'Hitachi' with 'Renesas'.
- * reloc.c: Likewise.
- * coff-h8300.c: Likewise.
- * coff-h8500.c: Likewise.
- * coff-sh.c: Likewise.
- * cpu-h8300.c: Likewise.
- * cpu-sh.c: Likewise.
- * elf32-h8300.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sh64-com.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf64-sh64.c: Likewise.
- * bfd-in2.h: Regenerate.
-
-2003-04-14 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Maintain maximum
- alignment for common symbols. Warn reducing alignment for
- common symbols. Report old filename when symbol size changes.
-
-2003-04-12 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_calculate_relocation): Adjust two other
- occurrences of the same test changed in the previous patch.
- Optimize.
-
-2003-04-11 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_get_global_gotsym_index): New.
- (mips_elf_calculate_relocation): Decay GOT_PAGE/GOT_OFST to
- GOT_DISP/addend only if the symbol got a global GOT entry.
-
-2003-04-10 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_calculate_relocation): Decay
- GOT_PAGE/GOT_OFST referencing overridable symbol to
- GOT_DISP/addend.
- (_bfd_mips_elf_check_relocs): Handle GOT_PAGE referencing
- global symbol as GOT_DISP.
-
-2003-04-10 Bob Wilson <bob.wilson@acm.org>
-
- * elf32-xtensa.c (elf_xtensa_relocate_section): Don't continue to the
- next relocation on an undefined symbol.
-
-2003-04-09 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section) <R_ALPHA_GPREL32>:
- Ignore relocations against r_symndx == 0.
-
-2003-04-09 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Don't return
- FALSE for undefined symbols.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
-
-2003-04-09 Alexandre Oliva <aoliva@redhat.com>
-
- * dwarf2.c (_bfd_dwarf2_find_nearest_line): Try DWARF3-standard
- and IRIX-specific shift-to-64-bit 4-byte lengths before following
- addr_size.
-
-2003-04-08 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): Detect (ctor)
- pointer size from ABI, not arch_bits_per_address.
-
-2003-04-07 Kevin Buettner <kevinb@redhat.com>
-
- * elfn32-mips.c (elf32_mips_grok_prstatus): Adjust core file related
- constants for n32 ABI.
-
-2003-04-06 Andrew Cagney <cagney@redhat.com>
-
- * simple.c (bfd_simple_get_relocated_section_contents): Disable
- free that leads to GDB vs BFD memory corruption.
-
-2003-04-04 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc11.c (m68hc11_elf_relax_delete_bytes): Also adjust
- symbols that mark the end of the section.
- (m68hc11_elf_relax_section): Use R_M68HC11_PCREL_8 relocs when
- converting to a relative branch so that the offset is computed after
- the relaxation; also relocate a jsr into a bsr if possible but don't
- relax them if they are to a far symbol as we need to call the
- trampoline code.
- (elf_m68hc11_howto_table): Set pcrel_offset to true.
-
-2003-04-04 Svein E. Seldal <Svein.Seldal@solidas.com>
-
- * archures.c: Namespace cleanup. Rename bfd_mach_c3x to
- bfd_mach_tic3x and bfd_mach_c4x to bfd_mach_tic4x
- * bfd-in2.h: Regenerate
- * coff-tic4x.c: Namespace cleanup. Replace s/c4x/tic4x/
- * cpu-tic4x.c: Ditto
-
-2003-04-03 Nick Clifton <nickc@redhat.com>
-
- * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Compute ps and ss
- differently for object files and executables.
- * peicode.h (coff_swap_scnhdr_in): Only set the s_size field
- for object files or for executables who have not already
- initialised the field.
- * libpei.h (bfd_pe_executable_p): New macro. Return true if
- the PE format bfd is an executable.
-
-2003-04-03 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_check_relocs): Don't use SYMBOL_REFERENCES_LOCAL
- here as it's too early to reliably determine locality.
- (ppc_elf_gc_sweep_hook): Likewise.
- (SYMBOL_REFERENCES_LOCAL): Expand comment.
-
-2003-04-02 Bob Wilson <bob.wilson@acm.org>
-
- * xtensa-modules.c: Remove comment indicating that this is a
- generated file.
-
-2003-04-02 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Test for NULL dynobj.
-
-2003-04-01 Bob Wilson <bob.wilson@acm.org>
-
- * Makefile.am (ALL_MACHINES): Add cpu-xtensa.lo.
- (ALL_MACHINES_CFILES): Add cpu-xtensa.c.
- (BFD32_BACKENDS): Add elf32-xtensa.lo, xtensa-isa.lo, and
- xtensa-modules.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-xtensa.c, xtensa-isa.c, and
- xtensa-modules.c.
- (cpu-xtensa.lo): New target.
- (elf32-xtensa.lo): Likewise.
- (xtensa-isa.lo): Likewise.
- (xtensa-modules.lo): Likewise.
- * Makefile.in: Regenerate.
- * archures.c (bfd_architecture): Add bfd_{arch,mach}_xtensa.
- (bfd_archures_list): Add bfd_xtensa_arch.
- * config.bfd: Handle xtensa-*-*.
- * configure.in: Handle bfd_elf32_xtensa_{le,be}_vec.
- * configure: Regenerate.
- * reloc.c: Add BFD_RELOC_XTENSA_{RTLD,GLOB_DAT,JMP_SLOT,RELATIVE,
- PLT,OP0,OP1,OP2,ASM_EXPAND,ASM_SIMPLIFY}.
- * targets.c (bfd_elf32_xtensa_be_vec): Declare.
- (bfd_elf32_xtensa_le_vec): Likewise.
- (bfd_target_vector): Add bfd_elf32_xtensa_{be,le}_vec.
- * cpu-xtensa.c: New file.
- * elf32-xtensa.c: Likewise.
- * xtensa-isa.c: Likewise.
- * xtensa-modules.c: Likewise.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Likewise.
-
-2003-04-01 Nick Clifton <nickc@redhat.com>
-
- * archures.c (bfd_mach_arm_unknown): Define.
- * bfd-in.h (bfd_arm_merge_machines, bfd_arm+update_notes,
- bfd_arm_get_mach_from_notes): Prototype.
- * bfd-in2.h: Regenerate.
- * coff-arm.c (coff_arm_merge_private_bfd_data): Call
- bfd_arm_merge_machines.
- (coff_arm_final_link_postscript): Call bfd_arm_update_notes.
- * coffcode.h (coff_set_arch_mach_hook): Call
- bfd_arm_get_mach_from_notes.
- * coffgen.c (coff_real_object_p): Revert previous delta.
- * cpu_arm.c (arm_check_note): New function. Examine a note in a
- .note section.
- (bfd_arm_merge_machines): New function: Handle the merging of ARM
- binaries compiled for different architectures..
- (bfd_arm_update_notes): New function: Update an ARM note section.
- (bfd_arm_get_mach_from_notes): New function: Extract a bfd machine
- number from an ARM note section.
- * elf32-arm.h (elf32_arm_object_p): Use
- bfd_arm_get_mach_from_notes.
- (elf32_arm_merge_private_bfd_data): Use bfd_arm_merge_machines.
- (elf32_arm_final_write_processing): Use bfd_arm_update_notes.
-
-2003-04-01 Ben Elliston <bje@wasabisystems.com>
-
- * dwarf2.c (read_attribute_value): Correct typo in comment.
-
-2003-04-01 Nick Clifton <nickc@redhat.com>
-
- * dwarf2.c (concat_filename): Use bfd_malloc() and strdup()
- instead of concat().
- (decode_line_info): Only free filename if it is not NULL.
- (add_line_info): Make a copy of the filename when storing it into
- the info structure.
-
-2003-03-31 Andreas Schwab <schwab@suse.de>
- Daniel Jacobowitz <drow@mvista.com>
-
- * simple.c (bfd_simple_get_relocated_section_contents): Add
- parameter symbol_table. Optionally use it instead of the symbol
- table from the bfd. Save and restore output offsets and output
- sections around bfd_get_relocated_section_contents. Fix a memory
- leak.
- (simple_save_output_info, simple_restore_output_info): New
- functions.
- * bfd-in2.h: Regenerate.
- * dwarf2.c (read_abbrevs): Use
- bfd_simple_get_relocated_section_contents instead of
- bfd_get_section_contents.
- (decode_line_info): Likewise.
- (_bfd_dwarf2_find_nearest_line): Likewise. Don't call
- find_rela_addend.
- (find_rela_addend): Remove.
- * elfxx-ia64.c (elfNN_ia64_reloc): Weaken sanity check for
- debugging sections.
- (elfNN_ia64_hash_table_create): Create the hash table with malloc,
- not bfd_zalloc.
-
-2003-03-31 David Heine <dlheine@suif.stanford.edu>
-
- * aoutx.h (aout_link_hash_table_create): Use bfd_malloc instead of
- bfd_alloc.
- * dwarf2.c (concat_filename): Always allocate space for the
- returned filename.
- (decode_line_info): Free the allocated filename returned by
- concat_filename.
- * elf-eh-frame.c (bfd_elf_write_section_eh_frame): Fix memory leaks.
- * elf.c (copy_private_bfd_data): Likewise.
- (_bfd_elf_slurp_version_tables): Fix bug freeing contents pointer.
- * elflink.h (elf_link_sort_relocs): Fix memory leak.
- * format.c (bfd_check_format_matches): Likewise.
- * linker.c (bfd_generic_final_link): Likewise.
- * opncls.c (find_separate_debug_info): Likewise.
- * simple.c (bfd_simple_get_relocated_section_contents): Likewise.
-
-2003-03-28 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Correctly combine
- visibilities.
-
-2003-03-27 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Reset self_dtpmod_offset
- to -1 before recomputing got offsets.
-
-2003-03-26 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (elf_m68k_relocate_section): Use it to correctly handle symbols
- forced to be local.
- (elf_m68k_finish_dynamic_symbol): Emit RELATIVE reloc for got
- entries for symbols that are forced to be local.
-
-2003-03-25 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (_bfd_mips_relax_section): New function.
- * elfxx-mips.h (_bfd_mips_relax_section): Declare.
- * elfn32-mips.c, elf64-mips.c: Use it.
-
-2003-03-25 Stan Cox <scox@redhat.com>
- Nick Clifton <nickc@redhat.com>
-
- Contribute support for Intel's iWMMXt chip - an ARM variant:
-
- * archures.c: Add bfd_mach_arm_iWMMXt.
- * reloc.c: Add BFD_RELOC_ARM_CP_OFF_IMM_S2.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * coff-arm.c (coff_arm_merge_private_bfd_data): Allow iWMMXt
- object files to be linked with XScale ones.
- (coff_arm_final_link_postscript): Update note section.
- * coffcode.h (coff_set_arch_mach_hook): Handle note section.
- * coffgen.c (coff_real_object_p): Call bfd_coff_set_arch_mach_hook
- after identifying a coff binary.
- * cpu-arm.c (processors): Add iWMMXt.
- (arch_inf): Likewise.
- * elf32-arm.h (arm_object_p): Handle note section.
- (elf32_arm_merge_private_bfd_data): Allow iWMMXt object files to
- be linked with XScale ones.
- (elf32_arm_section_flags): New function: Set flags on note section.
- (elf32_arm_final_write_processing): Handle note section.
-
-2003-03-21 DJ Delorie <dj@redhat.com>
-
- * elf32-xstormy16.c (elf32_xstormy16_relocate_section): Call
- _bfd_elf_rela_local_sym.
-
-2003-03-20 H.J. Lu <hjl@gnu.org>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Don't try relax for
- non-ELF outputs.
-
-2003-03-20 Nick Clifton <nickc@redhat.com>
-
- * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Initialise $idata2 and
- $idata5 in case bfd_coff_final_link is not called.
-
-2003-03-19 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c (struct sparc64_elf_section_data): Add reloc_count
- field.
- (canon_reloc_count): Define.
- (sparc64_elf_slurp_one_reloc_table, sparc64_elf_slurp_reloc_table,
- sparc64_elf_canonicalize_dynamic_reloc): Use it instead of
- reloc_count.
- (sparc64_elf_canonicalize_reloc): New routine.
- (bfd_elf64_canonicalize_reloc): Define.
-
-2003-03-18 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Handle relaxation
- againt mergeable sections. Take r_addend into account when caching
- trampolines.
-
-2003-03-18 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (get_dyn_sym_info): Return NULL gracefully for
- local symbols that have no dyninfo.
-
-2003-03-14 Gene Smith <gene.smith@siemens.com>
-
- * ieee.c (ieee_write_expression): Handle the case where symbol is
- NULL.
- General formatting improvements.
-
-2003-03-13 Nick Clifton <nickc@redhat.com>
-
- * configure.in (LINGUAS): Add zh_CN.
- * configure: Regenerate.
- * po/zh_CN.po: New file.
-
-2003-03-13 Elias Athanasopoulos <elathan@phys.uoa.gr>
-
- * aout-cris.c (BYTES_IN_WORD): Don't define.
- aout-encap.c: Likewise.
- aout-ns32k.c: Likewise.
- aout-tic30.c: Likewise.
- hp300bsd.c: Likewise.
- i386aout.c: Likewise.
- i386dynix.c: Likewise.
- i386linux.c: Likewise.
- i386lynx.c: Likewise.
- i386mach3.c: Likewise.
- m68k4knetbsd.c: Likewise.
- m68klinux.c: Likewise.
- m68klynx.c: Likewise.
- m68knetbsd.c: Likewise.
- m88kmach3.c: Likewise.
- mipsbsd.c: Likewise.
- newsos3.c: Likewise.
- sparclinux.c: Likewise.
- sparclynx.c: Likewise.
- sparcnetbsd.c: Likewise.
- vaxbsd.c: Likewise. Fix comment formatting.
-
-2003-03-12 Alexandre Oliva <aoliva@redhat.com>
-
- * Reverted 2003-03-02's patch.
-
- * elfxx-target.h (bfd_elfNN_canonicalize_reloc): Make it
- overridable.
- * elf64-mips.c (mips_elf64_canonicalize_reloc,
- mips_elf64_get_dynamic_reloc_upper_bound,
- mips_elf64_canonicalize_dynamic_reloc): New, adapted from elf.c.
- (bfd_elf64_get_canonicalize_reloc,
- bfd_elf64_get_dynamic_reloc_upper_bound,
- bfd_elf64_canonicalize_dynamic_reloc): Define.
- (mips_elf64_slurp_reloc_table): Support dynamic.
- (mips_elf64_slurp_one_reloc_table): Adjust.
-
-2003-03-12 Nick Clifton <nickc@redhat.com>
-
- * xsym.c (bfd_sym_fetch_type_information_table_entry): Change
- 'index' to 'offset' in test for zero value.
-
-2003-03-11 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Do not create
- dynamic relocations pointing to local or section symbols, use the
- NULL symbol instead. Document the choice to not emit an
- additional R_MIPS_64 relocation.
-
-2003-03-11 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Subtract tls seg vma from
- zero index dynamic tls relocs generated for the GOT. Tidy code.
- Set "relocation" to 1 on DTPMOD32 relocs. Optimize HA adjustment.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
-
-2003-03-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Don't look for a nop after
- a tls_get_addr call.
-
- * elf32-ppc.c (ELIMINATE_COPY_RELOCS): Define as one.
- (ppc_elf_adjust_dynamic_symbol): For weak symbols, copy
- ELF_LINK_NON_GOT_REF from weakdef.
- * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define as one.
- (ppc64_elf_adjust_dynamic_symbol): For weak symbols, copy
- ELF_LINK_NON_GOT_REF from weakdef.
- * elf32-i386.c (ELIMINATE_COPY_RELOCS): Define as one. Use throughout.
- (elf_i386_adjust_dynamic_symbol): For weak symbols, copy
- ELF_LINK_NON_GOT_REF from weakdef.
-
-2003-03-06 Jakub Jelinek <jakub@redhat.com>
- Andrew Haley <aph@redhat.com>
-
- * elflink.h (elf_bfd_discard_info): Don't process eh frames if
- output is relocateable.
-
-2003-03-06 Steven Konopa <skonopa@kgo.csc.com>
-
- * som.c (som_fixup_formats): Correct formats for R_AUX_UNWIND and
- R_COMMENT.
-
-2003-03-06 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_create_linker_section): Don't capitalize
- error messages.
- (ELIMINATE_COPY_RELOCS): Define to zero.
- (ppc_elf_relocate_section): Don't deref htab->tls_sec when calculating
- TLSLD relocs. Report reloc types on a number of errors. Optimize
- LOCAL24PC check for non-local syms. Don't capitalize error messages.
- * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define to zero.
- (ppc64_elf_relocate_section): Don't deref htab->tls_sec when
- calculating TLSLD relocs. Report reloc types on a number of errors.
- Don't capitalize error messages.
-
-2003-03-03 H.J. Lu <hjl@gnu.org>
-
- * elfxx-ia64.c (USE_BRL): Removed.
- (oor_ip): Removed.
-
-2003-03-03 J"orn Rennecke <joern.rennecke@superh.com>
-
- * elf32-sh.c (sh_elf_howto_tab): Make R_SH_IND12W into an ordinary
- relocation (no special function), and make it non-partial_inplace.
- (sh_elf_relax_section): When creating a bsr, use a consistent value
- no matter if the symbol is extern or not; set addend to -4.
- Don't swap load / non-load instructions for SH4.
- (sh_elf_relax_delete_bytes): In R_SH_IND12W case, check the offset
- rather than if the symbol is external to determine if adjusting the
- offset makes sense. Adjust the addend too if appropriate.
- (sh_elf_relocate_section): In R_SH_IND12W, don't fiddle with the
- relocation.
-
-2003-03-03 Nick Clifton <nickc@redhat.com>
-
- * po/da.po: Installed latest translation.
-
-2003-03-02 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (elf_mips_howto_table_rel): Change definition of
- R_MIPS_PC16 to rightshift 2.
- (elf_reloc_map mips_reloc_map): Map to rightshifted BFD reloc.
- (bfd_elf32_bfd_reloc_type_lookup): Support
- BFD_RELOC_MIPSEMB_16_PCREL_S2.
- * elf64-mips.c (mips_elf64_howto_table_rel): Change definition of
- R_MIPS_PC16 to rightshift 2.
- (mips_elf64_howto_table_rela): Likewise.
- (mips_reloc_map): Map to rightshifted BFD reloc.
- * elfn32-mips.c: The same as in elf64-mips.c.
- * elfxx-mips.c (mips_elf_got_for_ibfd): Typo in comment.
- (mips_elf_calculate_relocation): Handle rightshifted addends for
- R_MIPS_PC16.
- * reloc.c (BFD_RELOC_MIPSEMB_16_PCREL_S2): New BFD relocation for
- MIPS Embedded PIC. Remove superfluous empty COMMENT.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2003-02-28 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Correct bounds
- for ltoff22x relaxation.
-
-2003-03-01 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in.h (_bfd): Don't define.
- * bfd.c: Rename occurrences of "struct _bfd" to "struct bfd".
- * syms.c: Likewise.
- * bfd-in2.h: Regenerate.
-
-2003-02-27 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add want_gotx;
- (elfNN_ia64_check_relocs): Set it.
- (allocate_global_data_got): Check it.
- (allocate_local_got): Likewise.
- (allocate_dynrel_entries): Likewise.
- (elfNN_ia64_relax_ldxmov): New.
- (elfNN_ia64_relax_section): Handle LTOFF22X, LDXMOV.
- (elfNN_ia64_choose_gp): Split out from ...
- (elfNN_ia64_final_link): ... here.
-
-2003-02-27 Andrew Cagney <cagney@redhat.com>
-
- * bfd.c (struct bfd): Rename "struct _bfd".
- * bfd-in.h: Update copyright.
- (struct bfd): Rename "struct _bfd".
- (_bfd): Define for backward compatibility.
- * bfd-in2.h: Regenerate.
-
-2003-02-25 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_bfd_final_link): Apportion reloc counts to rel_hdr
- and rel_hdr2 when initially counting input relocs rather than after
- creating output reloc sections.
- (elf_link_read_relocs_from_section): Don't abort with wrong reloc
- sizes.
-
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
-
-2003-02-24 Kris Warkentin <kewarken@qnx.com>
-
- * elf.c (elfcore_read_notes): Add check for QNX style core file.
- (elfcore_grog_nto_note): New function.
- (elfcore_grog_nto_gregs): New function.
- (elfcore_grog_nto_status): New function.
-
-2003-02-24 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (_bfd_elf_create_got_section): Check existing .got
- section flags before concluding that we've already been called.
- Don't use register keyword.
- (_bfd_elf_create_dynamic_sections): Don't use register keyword.
- (_bfd_elf_create_linker_section): Formatting.
-
-2003-02-20 jmc <jmc@prioris.mini.pw.edu.pl>
-
- * coff-h8300.c: Fix typo: intial -> initial.
- * coff-ppc.c: Likewise.
-
-2003-02-20 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c: Formatting.
- (allocate_dynrelocs): LD and GD relocs against the same sym need
- separate GOT entries.
- (ppc_elf_relocate_section): Correct GOT handling for multiple GOT
- entries per symbol.
-
-2003-02-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Simplify dynamic reloc
- removal. Localize vars. Remove unnecessary dynobj test.
- * elf32-i386 (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead
- of INFO.
- (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
- and optimize.
- (elf_i386_relocate_section): Likewise.
- (elf_i386_gc_sweep_hook): Simplify dyn reloc removal. Localize vars.
- * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
- * elf32-sh.c (sh_elf_gc_sweep_hook): Likewise.
- * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
- * elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
- * elf32-sparc.c (elf32_sparc_gc_sweep_hook): Likewise. Remove
- local_dynrel for section too. Don't touch HIPLT22, LOPLT10, PCPLT32
- or PCPLT10 relocs. Don't subtract twice on PLT32 relocs.
- Formatting.
-
- * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define.
- (ppc64_elf_check_relocs): Use it. Correct comment. Move SEC_ALLOC
- test.
- (ppc64_elf_adjust_dynamic_symbol): Use ELIMINATE_COPY_RELOCS.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
- (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
- and optimize. Use ELIMINATE_COPY_RELOCS.
- (ppc64_elf_relocate_section): Likewise.
-
- * elf32-ppc.c (struct ppc_elf_dyn_relocs): Add pc_count field.
- (ppc_elf_copy_indirect_symbol): Copy pc_count field.
- (ELIMINATE_COPY_RELOCS): Define.
- (ppc_elf_adjust_dynamic_symbol): Convert copy relocs to dynamic.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
- (MUST_BE_DYN_RELOC): Define.
- (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
- and optimize. Trim dyn_relocs.
- (ppc_elf_check_relocs): Don't generate dyn_relocs when we know they'll
- not be used. Do generate dyn_relocs for copy reloc avoidance. Keep
- track of pc_rel dyn relocs.
- (ppc_elf_relocate_section): Remove "will_become_local". Adjust
- WILL_CALL_FINISH_DYNAMIC_SYMBOL use. Trim dyn relocs as per
- allocate_dynrelocs. Don't recalculate "sec".
-
-2003-02-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Remove unnecessary test.
- * elf64-ppc.c (ppc64_elf_tls_optimize): Decrement tlsld_got.refcount
- on invalid LD relocs.
- (allocate_dynrelocs): Invalid LD relocs don't use tlsld_got entry.
- (ppc64_elf_relocate_section): Unify new handling of LD relocs and
- tlsld_got entry. Use IS_PPC64_TLS_RELOC.
-
- * elf32-ppc.h: New file.
- * elf32-ppc.c: Include elf32-ppc.h.
- (NOP, CROR_151515, CROR_313131, TP_OFFSET, DTP_OFFSET): Define.
- (struct ppc_elf_link_hash_entry): Rename "root" to "elf". Adjust uses.
- Add "tls_mask" field.
- (TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL, TLS_TLS, TLS_TPRELGD): Define.
- (struct ppc_elf_link_hash_table): Rename "root" to "elf". Adjust uses.
- Add got, relgot, plt, relplt, dynbss, relbss, dynsbss, relsbss,
- sdata, sdata2, tls_sec, tls_get_addr, tlsld_got fields.
- Make use of htab shortcuts throughout file.
- (ppc_elf_link_hash_newfunc): Init tls_mask field.
- (ppc_elf_link_hash_table_create): Init new fields.
- (ppc_elf_copy_indirect_symbol): Copy tls_mask.
- (ppc_elf_howto_raw): Add tls relocs.
- (ppc_elf_reloc_type_lookup): Handle them.
- (ppc_elf_unhandled_reloc): New function.
- (ppc_elf_create_got): Stash got section pointer in hash table,
- return status. Make .rela.got too.
- (ppc_elf_create_dynamic_sections): Stash section pointers in htab.
- (ppc_elf_adjust_dynamic_symbol): Only set up copy relocs when
- NON_GOT_REF set. Don't allocate space in .plt here..
- (allocate_dynrelocs): ..do so here instead, properly ref-counting and
- not allocating plt entries unnecessarily. Allocate got entries here.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (ppc_elf_size_dynamic_sections): Allocate local got entries. Pass
- "info" during allocate_dynrelocs hash traversal. Use htab section
- shortcuts rather than searching for named sections. Get rid of
- "plt" and "strip" booleans.
- (update_local_sym_info, bad_shared_reloc): New functions.
- (ppc_elf_check_relocs): Handle TLS relocs. Move .rela.got creation to
- ppc_elf_create_got. Don't mark got or plt reloc syms dynamic, do so
- in allocate_dynreloc. Use update_local_sym_info and bad_shared_reloc.
- Disallow R_PPC_EMB_RELSDA, R_PPC_EMB_NADDR32, R_PPC_EMB_NADDR16,
- R_PPC_EMB_NADDR16_LO, R_PPC_EMB_NADDR16_HI and R_PPC_EMB_NADDR16_HA
- in shared libs. R_PPC_PLTREL32 is a plt reloc too. Refcount all
- relocs that might use a plt entry. Set NON_GOT_REF too.
- Enumerate all do-nothing relocs.
- (ppc_elf_gc_sweep_hook): Simplify removal of dynrelocs. Handle
- tls relocs and all plt relocs.
- (ppc_elf_tls_setup, ppc_elf_tls_optimize): New functions.
- (ppc_elf_finish_dynamic_symbol): Don't build got entries here.
- (ppc_elf_finish_dynamic_sections): Rewrite tag code using htab
- shortcuts.
- (ppc_elf_relocate_section): Tidy. Handle TLS relocs. Use
- bfd_elf_local_sym_name. Simplify unresolved reloc code. Build got
- entries and got relocs here. Warn on non-zero got reloc addend.
- Split out branch taken/not taken reloc code into a separate switch
- and correct offset calculation. Allow BRTAKEN/BRNTAKEN dynamic relocs.
- Split out HA reloc adjustments to separate switch statement. Don't
- warn on reloc overflow if we've already warned about undefined.
- Don't rebuild sym name when reporting errors. Report all possible
- errors from _bfd_final_link_relocate.
- (bfd_elf32_bfd_final_link): Don't define.
-
-2003-02-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Don't init "r". Don't
- rebuild sym name when reporting errors.
-
-2003-02-17 Nick Clifton <nickc@redhat.com>
-
- * elflink.h (elf_link_output_extsym): Only check
- allow_shlib_undefined for shared libraries.
- * elf32-i386.c (elf_i386_relocate_section): Remove bogus check
- of allow_shlib_undefined.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf32-vax.c (elf_vax_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise.
-
-2003-02-17 Nick Clifton <nickc@redhat.com>
-
- * elf.c (SEGMENT_AFTER_SEGMENT): Add third parameter - the
- address field to use in the comparison.
- (SEGMENT_OVERLAPS): Check that LMAs overlap as well.
-
-2003-02-14 Bob Wilson <bob.wilson@acm.org>
-
- * elfcore.h (elf_core_file_p): Compare alternate machine codes for ELF
- backends when checking if the generic ELF target should be used.
-
- * syms.c (_bfd_stab_section_find_nearest_line): For line number stabs
- outside of functions, treat values as absolute addresses.
-
- * bfd.c: Change embedded documentation to use consistent indentation
- and to split up long lines. Change informal style of description
- for functions lacking real documentation.
- * coffcode.h: Break up long lines in embedded documentation.
- * format.c: Likewise.
- * targets.c: Likewise.
- * libcoff.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2003-02-14 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_link_hash_table_create): Init tls_get_addr.
- (ppc64_elf_copy_indirect_symbol): Merge tls_mask too.
- (ppc64_elf_gc_sweep_hook): Simplify removal of dyn_relocs.
- (allocate_dynrelocs): Don't treat undefined and undefweak specially.
- (ppc_size_one_stub): Fix warning, and tighten plt entry check.
- (group_sections): Don't share a stub section if stubs are for a large
- section. Adjust comment.
- (ppc64_elf_size_stubs): Roughly double the size left for stubs if
- !stubs_always_before_branch.
- (ppc64_elf_relocate_section): Initialize tlsld GOT entry once. Don't
- treat undefined and undefweak specially when processing dyn relocs.
-
-2003-02-13 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO.
-
-2003-02-13 Nick Clifton <nickc@redhat.com>
-
- * elf32-arm.h (elf32_thumb_to_arm_stub): Include section VMAs
- in computation of offset to insert into BL instruction.
-
-2003-02-11 Uwe Stieber <uwe@wwws.de>
-
- * config.bfd: Add support for kaOS as cross build target system.
-
-2003-02-11 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_check_relocs): Match versioned
- .__tls_get_addr too.
- (ppc64_elf_tls_setup): Ensure cached tls_get_addr is not indirect.
-
-2003-02-10 Kaz kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (elf_sh_dyn_relocs): Add tls_tpoff32 field.
- (elf_sh_link_hash_entry): Remove tls_tpoff32 field.
- (sh_elf_link_hash_newfunc): Remove the initialization of
- tls_tpoff32 field.
- (allocate_dynrelocs): Keep dyn_relocs if it includes the entry
- for which tls_tpoff32 flag is set.
- (sh_elf_relocate_section): Covert to LE only if the dyn_relocs
- of the symbol includes the entry matched with the input_section
- and having tls_tpoff32 flag on. When linking statically, set
- symbol index of R_SH_TLS_TPOFF32 relocation to zero if the symbol
- is defined in this executable.
- (sh_elf_check_relocs): Set tls_tpoff32 flag appropriately.
-
-2003-02-10 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-s390.c (elf_s390_size_dynamic_sections): Set relocs to TRUE
- even if there is just non-empty .rela.plt.
-
-2003-02-10 Nick Clifton <nickc@redhat.com>
-
- * archures.c (bfd_mach_arm_ep9312): Define.
- * bfd-in2.h: Regenerate.
- * cpu-arm.c (processors[]): Add ep9312.
- (bfd_arm_arch): Add ep9312.
- * elf32-arm.h (elf32_arm_merge_private_data): Update error
- messages and add test for Maverick floating point support.
- (elf32_arm_print_private_bfd_data): Handle
- EF_ARM_MAVERICK_FLOAT flag.
- (elf32_arm_object_p): New function.
- (elf_backend_object_p): Define.
-
-2003-02-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c: Rename assorted occurrences of tls_type and similar
- variables, structure fields or function params to tls_mask or
- similar to better reflect usage.
- (struct got_entry): Comment.
- (struct ppc_link_hash_entry): Expand comment, and renumber TLS_*.
- (get_tls_mask): Rename from get_tls_type.
-
-2003-02-09 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (TLS_GD_LD): Don't define..
- (TLS_GD): ..define this instead and update all uses.
- (TLS_TPRELGD): Define.
- (ppc64_elf_link_hash_table_create): Tweak initialization of
- init_refcount and init_offset.
- (ppc64_elf_check_relocs): Add one extra element to t_symndx array.
- Mark second slot of GD or LD toc entries.
- (get_tls_type): Return an int. Distinguish toc GD and LD entries
- from other tls types.
- (ppc64_elf_tls_setup): New function, split out from..
- (ppc64_elf_tls_optimize): ..here. Don't optimize when symbols are
- defined in a dynamic object. Fix LD optimization. Don't set TLS_TPREL
- on GD->IE optimization, use TLS_TPRELGD instead. Use get_tls_type
- return value to properly decide whether toc GD and LD entries can
- optimize away __tls_get_addr call. Check next reloc after DTPMOD64
- to determine GD or LD rather than looking at TLS_LD flag. Don't
- attempt to adjust got entry tls_type here..
- (allocate_dynrelocs): ..instead, adjust got entry tls_type here, and
- look for possible merges.
- (ppc64_elf_size_dynamic_sections): Adjust local got entries for
- optimization.
- (ppc64_elf_size_stubs): Tweak __tls_get_addr fudge.
- (ppc64_elf_relocate_section): Rename some vars to better reflect usage.
- Make use of return value from get_tls_type to properly detect GD and
- LD optimizations. Split tlsld/gd hi/ha from lo/ds case. Don't
- handle tls_get_addr removal when looking at REL24 relocs, do it when
- looking at the previous reloc. Check reloc after DTPMOD64 to determine
- GD or LD.
- * elf64-ppc.h (ppc64_elf_tls_setup): Declare.
-
-2003-02-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (group_sections): Don't share a stub section if
- stubs are for a large section.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Double the size left for
- stubs if !stubs_always_before_branch.
-
-2003-02-07 Nick Clifton <nickc@redhat.com>
-
- * elf.c (swap_out_syms): Generate an error message if an
- equivalent output section cannot be found for a symbol.
-
-2003-02-07 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Don't crash if
- local_got_entries is NULL.
-
-2003-02-06 Andreas Schwab <schwab@suse.de>
-
- * elf-eh-frame.c (get_DW_EH_PE_signed): Define.
- (read_value): Add parameter is_signed, use signed extraction if
- the value is signed.
- (_bfd_elf_write_section_eh_frame): Pass signed flag of the
- encoding to read_value.
-
-2003-02-06 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy got and
- plt info when called to transfer weak sym info.
-
-2003-02-05 Alan Modra <amodra@bigpond.net.au>
-
- * reloc.c: Add PPC and PPC64 TLS relocs.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * elf64-ppc.c (TP_OFFSET, DTP_OFFSET): Declare.
- (ppc64_elf_howto_raw): Add TLS howto's. Adjust R_PPC64_NONE to be
- against a 32 bit field.
- (ppc64_elf_reloc_type_lookup): Handle TLS relocs.
- (_ppc64_elf_section_data): Add t_symndx and comments.
- (ppc64_elf_section_data): Use elf_section_data macro.
- (ppc64_elf_new_section_hook): American spelling.
- (struct got_entry, struct plt_entry): New.
- (MUST_BE_DYN_RELOC): Rename from IS_ABSOLUTE_RELOC.
- (struct ppc_stub_hash_entry): Add "addend" field.
- (struct ppc_link_hash_entry): Add "tls_type".
- (TLS_TLS, TLS_GD_LD, TLS_LD, TLS_TPREL, TLS_DTPREL,
- TLS_EXPLICIT): Define.
- (struct ppc_link_hash_table): Add tls_sec, tls_get_addr, tlsld_got.
- (link_hash_newfunc): Init new fields.
- (ppc64_elf_link_hash_table_create): Likewise. Set init_refcount and
- init_offset to NULL.
- (ppc64_elf_copy_indirect_symbol): Copy got and plt info. Don't call
- _bfd_elf_link_hash_copy_indirect, rather insert relevant code from
- there.
- (update_local_sym_info, update_plt_info): New functions.
- (ppc64_elf_check_relocs): Use them. Handle TLS relocs. Adjust GOT
- handling to use got.glist rather than got.refcount. Likewise for PLT.
- (ppc64_elf_gc_sweep_hook): Handle TLS relocs, new GOT and PLT lists.
- (func_desc_adjust): Adjust for new PLT list.
- (ppc64_elf_adjust_dynamic_symbol): Likewise.
- (get_sym_h, get_tls_type): New functions.
- (ppc64_elf_edit_opd): Remove unused variable. Use get_sym_h.
- (ppc64_elf_tls_optimize): New function.
- (allocate_dynrelocs): Adjust for new PLT and GOT lists. Allocate
- TLS relocs.
- (ppc64_elf_size_dynamic_sections): Likewise.
- (ppc_type_of_stub): Adjust for new PLT list.
- (ppc_build_one_stub): Likewise.
- (ppc64_elf_size_stubs): Likewise. Use get_sym_h. Treat __tls_get_addr
- calls specially.
- (ppc64_elf_relocate_section): Adjust for new GOT and PLT lists. Handle
- TLS relocs. Report local syms using bfd_elf_local_sym_name. Don't
- init GOT entries that have a reloc. Generate GOT relocs here..
- (ppc64_elf_finish_dynamic_symbol): ..not here. Adjust for PLT list.
- * elf64-ppc.h (ppc64_elf_tls_optimize): Declare.
-
-2003-02-04 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (elf_m68k_hash_entry): Define.
- (elf_m68k_link_hash_traverse): Remove.
- (elf_m68k_link_hash_newfunc): Use struct bfd_hash_entry and
- elf_m68k_hash_entry instead of struct elf_m68k_link_hash_entry to
- reduce casting.
- (elf_m68k_check_relocs): Use elf_m68k_hash_entry instead of
- casting.
- (elf_m68k_size_dynamic_sections): Use elf_link_hash_traverse
- instead of elf_m68k_link_hash_traverse.
- (elf_m68k_discard_copies): Change first parameter to pointer to
- struct elf_link_hash_entry and use elf_m68k_hash_entry when struct
- elf_m68k_link_hash_entry is needed.
-
-2003-02-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct got_entry, struct plt_entry): Forward declare.
- (struct elf_link_hash_entry): Add "glist" and "plist" fields to
- "got" union, and declare as gotplt_union. Use gotplt_uinion for
- "plt" field.
- (struct elf_link_hash_table): Make "init_refcount" a gotplt_union.
- Add "init_offset" field.
- (struct elf_obj_tdata <local_got>): Add "struct got_entry **" to union.
- (elf_local_got_ents): Declare.
- * elf.c (_bfd_elf_link_hash_newfunc): Adjust initialization of "got"
- and "plt".
- (_bfd_elf_link_hash_hide_symbol): Use "init_offset".
- (_bfd_elf_link_hash_table_init): Set "init_offset".
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set init_refcount
- from init_offset.
- (elf_adjust_dynamic_symbol): Set plt and got offsets using init_offset.
-
- * elf.c (bfd_elf_local_sym_name): Split out from..
- (group_signature): ..here.
- * elf-bfd.h (bfd_elf_local_sym_name): Declare.
-
-2003-02-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (enum elf_link_info_type): Remove.
- (struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
- to struct sec. Remove linkonce_p field.
- (elf_linkonce_p): Delete.
- (elf_discarded_section): Update for sec_info_type change.
- * section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
- flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
- (ELF_INFO_TYPE_NONE): Define.
- (ELF_INFO_TYPE_STABS): Define.
- (ELF_INFO_TYPE_MERGE): Define.
- (ELF_INFO_TYPE_EH_FRAME): Define.
- (ELF_INFO_TYPE_JUST_SYMS): Define.
- (STD_SECTION): Update struct sec initializer.
- * ecoff.c (bfd_debug_section): Likewise.
- * elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
- * elflink.h: Likewise.
- * elf-eh-frame.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elfxx-ia64.c: Likewise.
- * elfxx-mips.c: Likewise.
- * bfd-in2.h: Regenerate.
-
- * elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
- referring to used_by_bfd.
- * elf64-sparc.c (sec_do_relax): Likewise.
- * elf64-mmix.c (mmix_elf_section_data): Likewise.
- * elfxx-mips.c (mips_elf_section_data): Likewise.
- * ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
- (ieee_get_section_contents): Likewise.
- (ieee_new_section_hook): Formatting.
- (ieee_canonicalize_reloc): Remove commented out code.
- * mmo.c (mmo_section_data): Define. Use throughout file.
- * oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
-
-2003-01-31 Graydon Hoare <graydon@redhat.com>
-
- * Makefile.am (opncls.lo): Add dependency upon libiberty.h.
- * Makefile.in: Regenerate.
- * opncls.c (calc_crc32, get_debug_link_info,
- seperate_debug_file_exists, find_seperate_debug_file): New
- internal functions.
- (bfd_follow_gnu_debuglink): New function. Follow the pointer
- contained inside a .gnu_debuglink section.
- * bfd-in2.h: Regenerate.
-
-2003-01-29 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_got_entry_hash): Don't dereference
- entry->abfd when it's NULL.
-
-2003-01-27 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Handle
- _bfd_elf_section_offset returning -2 the same way as -1.
-
- * elfxx-mips.c (mips_elf_multi_got): New function.
- (struct mips_got_entry): Make symndx and gotidx signed. Moved
- addend into union along with address and link hash entry.
- (struct mips_got_info): Added bfd2got and next.
- (struct mips_elf_hash_sort_data): Added max_unref_got_dynindx.
- (mips_elf_got_section, mips_elf_create_got_section): Use
- SEC_EXCLUDE bit to tell whether we really need the got
- section. Take boolean arguments to disregard an excluded
- section, or to create it as excluded. Adjust all callers.
- Use mips_elf_got_section all over.
- (mips_elf_local_got_index, mips_elf_got_page,
- mips_elf_got16_entry): Take input bfd as argument, and pass it
- on to mips_elf_create_local_got_entry.
- (mips_elf_global_got_index, mips_elf_create_local_got_entry):
- Take input bfd as argument, and manage entries in the
- appropriate GOT.
- (mips_elf_got_offset_from_index): Take input bfd as argument,
- and use it to adjust the GP offset of the bfd.
- (mips_elf_sort_hash_table, mips_elf_sort_hash_table_f): Move
- unreferenced GOT entries of global symbols to the end.
- (mips_elf_record_global_got_symbol): Take input bfd as
- argument. Add entries to the master GOT hash table.
- (struct mips_elf_bfd2got_hash): New.
- (struct mips_elf_got_per_bfd_arg): New.
- (struct mips_elf_set_global_got_offset_arg): New.
- (mips_elf_hash_bfd_vma, mips_elf_multi_got_entry_hash,
- mips_elf_multi_got_entry_eq, mips_elf_bfd2got_entry_hash,
- mips_elf_bfd2got_entry_eq, mips_elf_make_got_per_bfd,
- mips_elf_merge_gots, mips_elf_set_global_got_offset,
- mips_elf_resolve_final_got_entry,
- mips_elf_resolve_final_got_entries, mips_elf_adjust_gp,
- mips_elf_got_for_ibfd): New functions.
- (ELF_MIPS_GP_OFFSET): Don't depend on SGI_COMPAT.
- (MIPS_ELF_GOT_MAX_SIZE): New macro.
- (STUB_LW): Generate 64-bit stub regardless of SGI_COMPAT.
- (mips_elf_got_entry_hash): Take new fields into account. Use
- mips_elf_hash_bfd_vma.
- (mips_elf_got_entry_eq): Take new fields into account.
- (mips_elf_create_got_section): Initialize new fields.
- (mips_elf_calculate_relocation): Pass input_bfd to functions
- that now take it. Adjust gp for the input_bfd.
- (mips_elf_allocate_dynamic_relocation,
- mips_elf_create_dynamic_relocation,
- _bfd_mips_elf_create_dynamic_sections): Use...
- (mips_elf_rel_dyn_section): New function. Borrow code from...
- (_bfd_mips_elf_check_relocs): Pass input_bfd to functions that
- now take it. Create the got section if needed, even if
- excluded, before recording a global got symbol. Move some
- code to...
- (mips_elf_record_local_got_symbol): New fn.
- (_bfd_mips_elf_size_dynamic_sections): Disable combreloc.
- Compute multi-got global entries offsets. Move GOT code to...
- (_bfd_mips_elf_always_size_sections): Call mips_elf_multi_got
- if the GOT is too big.
- (_bfd_mips_elf_finish_dynamic_symbol): Set got entry of
- undefweak symbol to zero. Generate dynamic relocations for
- non-primary GOT entries for global symbols.
- (_bfd_mips_elf_finish_dynamic_sections): Handle multi-got
- case. Generate dynamic relocations for local got entries.
- Sort dynamic relocations on N64 too, using...
- (sort_dynamic_relocs_64): New fns.
- (_bfd_mips_elf_hide_symbol): Adjust multi-got counters.
- (_bfd_mips_elf_merge_private_bfd_data): Ignore EF_MIPS_XGOT.
-
-2003-01-27 Alexandre Oliva <aoliva@redhat.com>
-
- * bfd.c (struct _bfd): Added id field.
- * opncls.c (_bfd_id_counter): New static variable.
- (_bfd_new_bfd): Use it.
- * bfd-in2.h: Rebuilt.
-
-2003-01-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-sparc.c (bfd_elf32_new_section_hook): Define.
-
-2003-01-25 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
- (elf32_sparc_rev32_howto): New variable.
- (sparc_reloc_map): Add TLS relocs.
- (elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
- Handle REV32.
- (sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
- New functions.
- (struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
- struct elf32_sparc_link_hash_table):
- New structures.
- (elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
- elf32_sparc_hash_table): Define.
- (link_hash_newfunc, elf32_sparc_link_hash_table_create,
- create_got_section, elf32_sparc_create_dynamic_sections,
- elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
- functions.
- (elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc
- reference counting.
- (elf32_sparc_gc_sweep_hook): Likewise.
- (elf32_sparc_adjust_dynamic_symbol): Likewise.
- (elf32_sparc_size_dynamic_sections): Likewise.
- (elf32_sparc_relocate_section): Likewise.
- (allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
- New functions.
- (elf32_sparc_object_p): Allocate backend private object data.
- (bfd_elf32_bfd_link_hash_table_create,
- elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
- elf_backend_can_refcount): Define.
- (elf_backend_create_dynamic_sections): Define to
- elf32_sparc_create_dynamic_sections.
- * reloc.c: Add SPARC TLS relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
- * elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
- (sparc_reloc_map): Likewise.
-
-2003-01-24 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * bfd-in2.h: Regenerate.
- * elf32-s390.c (elf_s390_mkobject, elf_s390_tls_transition,
- s390_tls_reloc, dtpoff_base, tpoff, invalid_tls_insn): New functions.
- (elf_howto_table): Add TLS relocs.
- (elf_s390_reloc_type_lookup): Likewise.
- (elf_s390_link_hash_entry): Add tls_type.
- (elf_s390_hash_entry, elf_s390_obj_tdata, elf_s390_local_got_tls_type):
- New macros.
- (elf_s390_link_hash_table): Add tls_ldm_got.
- (link_hash_newfunc): Initialize tls_type.
- (elf_s390_link_hash_table_create): Initialize refcount of tls_ldm_got.
- (elf_s390_copy_indirect_symbol): Copy tls_type information.
- (elf_s390_check_relocs): Support TLS relocs.
- (elf_s390_gc_sweep_hook): Likewise.
- (allocate_dynrelocs): Likewise.
- (elf_s390_size_dynamic_sections): Likewise.
- (elf_s390_relocate_section): Likewise.
- (elf_s390_finish_dynamic_symbol): Likewise.
- (bfd_elf32_mkobject): Define for TLS.
- * elf64-s390.c: Same changes as for elf32-s390.c.
- * libbfd.h: Regenerate.
- * reloc.c: Add s390 TLS relocations.
-
-2003-01-24 Charles Lepple <clepple@ghz.cc>
-
- * aclocal.m4: Fix name of --enable-install-libbfd switch.
-
-2003-01-23 Nick Clifton <nickc@redhat.com>
-
- * Add sh2e support:
- 2002-04-02 Elena Zannoni <ezannoni@redhat.com>
- * archures.c (bfd_mach_sh2e): Added.
- * bfd-in2.h: Rebuilt.
- * cpu-sh.c (arch_info_struct): Added SH2e.
- * elf32-sh.c (sh_elf_set_mach_from_flags): Handle EF_SH2E.
-
-2003-01-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct bfd_elf_section_data): Remove tdata. Change
- dynindx to an int. Rearrange for better packing.
- * elf.c (_bfd_elf_new_section_hook): Don't alloc if already done.
- * elf32-mips.c (bfd_elf32_new_section_hook): Define.
- * elf32-sh64.h: New. Split out from include/elf/sh.h.
- (struct _sh64_elf_section_data): New struct.
- (sh64_elf_section_data): Don't dereference sh64_info (was tdata).
- * elf32-sh64-com.c: Include elf32-sh64.h.
- * elf32-sh64.c: Likewise.
- (sh64_elf_new_section_hook): New function.
- (bfd_elf32_new_section_hook): Define.
- (sh64_elf_fake_sections): Adjust for sh64_elf_section_data change.
- (sh64_bfd_elf_copy_private_section_data): Likewise.
- (sh64_elf_final_write_processing): Likewise.
- * elf32-sparc.c (struct elf32_sparc_section_data): New.
- (elf32_sparc_new_section_hook): New function.
- (SET_SEC_DO_RELAX, SEC_DO_RELAX): Delete.
- (sec_do_relax): Define.
- (elf32_sparc_relax_section): Adjust to use sec_do_relax.
- (elf32_sparc_relocate_section): Likewise.
- * elf64-mips.c (bfd_elf64_new_section_hook): Define.
- * elf64-mmix.c (struct _mmix_elf_section_data): New.
- (mmix_elf_section_data): Define. Use throughout file.
- (mmix_elf_new_section_hook): New function.
- (bfd_elf64_new_section_hook): Define.
- * elf64-ppc.c (struct _ppc64_elf_section_data): New.
- (ppc64_elf_section_data): Define. Use throughout.
- (ppc64_elf_new_section_hook): New function.
- (bfd_elf64_new_section_hook): Define.
- * elf64-sparc.c (struct sparc64_elf_section_data): New.
- (sparc64_elf_new_section_hook): New function.
- (SET_SEC_DO_RELAX, SEC_DO_RELAX): Delete.
- (sec_do_relax): Define.
- (sparc64_elf_relax_section): Adjust to use sec_do_relax.
- (sparc64_elf_relocate_section): Likewise.
- (bfd_elf64_new_section_hook): Define.
- * elfn32-mips.c (bfd_elf32_new_section_hook): Define.
- * elfxx-mips.c (struct _mips_elf_section_data): New.
- (mips_elf_section_data): Define. Use throughout.
- (_bfd_mips_elf_new_section_hook): New function.
- (mips_elf_create_got_section): Don't alloc used_by_bfd.
- * elfxx-mips.h (_bfd_mips_elf_new_section_hook): Declare.
- * elfxx-target.h (bfd_elfNN_new_section_hook): Add #ifndef.
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
-
-2003-01-21 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (ALPHA_ELF_LINK_HASH_PLT_LOC): New.
- (struct alpha_elf_link_hash_entry): Add plt_old_section, plt_old_value.
- (elf64_alpha_adjust_dynamic_symbol): Set them.
- (elf64_alpha_size_plt_section_1): Reset them when plt entry removed.
- (elf64_alpha_relax_tls_get_addr): Handle LDM relocs. Frob the
- symbol index when relaxing LDM to TPREL.
- (elf64_alpha_relax_section): Likewise. Allow relaxation of GD
- relocs, even if the target isn't locally defined.
- (elf64_alpha_check_relocs): Frob LDM reloc symndx to zero.
- (elf64_alpha_relocate_section): Likewise. Force TP-relative
- relocs vs symndx 0 to the tp base.
-
-2003-01-21 Fabio Alemagna <falemagn@aros.org>
-
- * config.bfd: Handle i[3456]86-*-aros*.
-
-2003-01-21 Andreas Schwab <schwab@suse.de>
-
- * elf32-ppc.c (struct ppc_elf_dyn_relocs): Define.
- (struct ppc_elf_link_hash_entry): Define.
- (ppc_elf_hash_entry): New function.
- (struct ppc_elf_link_hash_table): Define.
- (ppc_elf_hash_table): New function.
- (ppc_elf_link_hash_newfunc): New function.
- (ppc_elf_link_hash_table_create): New function.
- (ppc_elf_copy_indirect_symbol): New function.
- (allocate_dynrelocs): New function.
- (readonly_dynrelocs): New function.
- (ppc_elf_size_dynamic_sections): Allocate space for dynamic
- relocs and determine DT_TEXTREL.
- (ppc_elf_check_relocs): Don't do that here, just count the
- dynamic relocs.
- (ppc_elf_gc_sweep_hook): Discard any dynamic relocs against the
- removed section.
- (bfd_elf32_bfd_link_hash_table_create): Define.
- (elf_backend_copy_indirect_symbol): Define.
-
-2003-01-21 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (alpha_dynamic_entries_for_reloc): GOTTPREL and
- TPREL also get a reloc if shared. Remove SREL support.
- (elf64_alpha_emit_dynrel): New.
- (elf64_alpha_relocate_section): Use it. Resolve dynamic TPREL
- and GOTTPREL relocs to local symbols against the tp base.
- (elf64_alpha_finish_dynamic_symbol): Use elf64_alpha_emit_dynrel.
-
- * elf64-alpha.c (elf64_alpha_relax_got_load): Decrement got
- use count before clobbering r_type.
- (elf64_alpha_relax_tls_get_addr): Don't use pos[1] if insn
- ordering would mean dataflow inspection is necessary.
-
-2003-01-20 Svein E. Seldal <Svein.Seldal@solidas.com>
-
- * coffcode.h (coff_set_flags): Added get/set arch hooks.
-
-2003-01-20 Fabio Alemagna <falemagn@aros.org>
-
- * elf32-sh.c: Treat elfNN_bed like other macros defined in
- elfxx-target.h and #undef it before #define'ing it.
- * elf32-i386.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-sh64.c: Likewise.
-
-2003-01-20 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * bfd-in2.h: Regenerate.
- * elf32-s390.c (elf_s390_adjust_gotplt): New prototype.
- (elf_howto_table): Rename R_390_GOTOFF to R_390_GOTOFF32. Add
- R_390_GOTOFF16, R_390_GOTOFF64, R_390_GOTPLT12, R_390_GOTPLT16,
- R_390_GOTPLT32, R_390_GOTPLT64, R_390_GOTPLTENT, R_390_PLTOFF16,
- R_390_PLTOFF32 and R_390_PLTOFF64.
- (elf_s390_reloc_type_lookup): Likewise.
- (struct elf_s390_link_hash_entry): Add gotplt_refcount to keep track
- of GOTPLT references to a function.
- (link_hash_newfunc): Initialize gotplt_refcount.
- (elf_s390_check_relocs): Move allocation of local_got_refcounts array
- and creation of the got section out of the main switch. Add support
- for the gotoff, gotplt and pltoff relocations.
- (elf_s390_gc_sweep_hook): Add reference counting for gotoff, gotplt
- and pltoff.
- (elf_s390_adjust_gotplt): New function.
- (elf_s390_adjust_dynamic_symbol): Adjust gotplt refcount for removed
- plt entries.
- (allocate_dynrelocs): Add comment.
- (elf_s390_relocate_section): Change r_type to unsigned. Add support
- for gotoff, gotplt and pltoff relocations.
- * elf64-s390.c: Same changes as for elf32-s390.c.
- * libbfd.h: Regenerate.
- * reloc.c: Add BFD_RELOC_390_GOTOFF64, BFD_RELOC_390_GOTPLT12,
- BFD_RELOC_390_GOTPLT16, BFD_RELOC_390_GOTPLT32, BFD_RELOC_390_GOTPLT64,
- BFD_RELOC_390_GOTPLTENT, BFD_RELOC_390_PLTOFF16, BFD_RELOC_390_PLTOFF32
- and BFD_RELOC_390_PLTOFF64.
-
-2003-01-18 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Handle
- R_IA64_TPREL64[LM]SB against non-global symbol properly.
-
-2003-01-16 Jakub Jelinek <jakub@redhat.com>
-
- * elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add
- self_dtpmod_done and self_dtpmod_offset.
- (allocate_global_data_got): Only use one got entry for all
- dtpmod relocs against local symbols.
- (allocate_dynrel_entries): Only need .rela.got entry for
- dtpmod against global symbol.
- (elfNN_ia64_size_dynamic_sections): Initialize self_dtpmod_offset.
- Reserve space in .rela.got for the local dtpmod entry.
- (set_got_entry): Initialize the common local dtpmod .got entry.
- (elfNN_ia64_relocate_section): Handle R_IA_64_DTPREL64LSB
- and R_IA_64_DTPREL64MSB.
-
-2003-01-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c: Include elf/ppc64.h rather than elf/ppc.h.
- (R_PPC_*): Rename all occurrences to R_PPC64_*.
- (R_PPC64_ADDR30): Rename all occurrences to R_PPC64_REL30.
- (enum elf_ppc_reloc_type): Ditto to enum elf_ppc64_reloc_type.
- (ppc64_elf_gc_sweep_hook): Handle R_PPC64_REL30 along with other
- relative relocs, not with absolute ones.
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2003-01-15 Andreas Schwab <schwab@suse.de>
-
- * elf32-ppc.c (ppc_elf_check_relocs): Don't set DF_TEXTREL for a
- relocation against a non-allocated readonly section.
-
-2003-01-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Adjust addend for GOT16_HA.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. PLTGOT16_HA too.
-
-2002-01-08 Klee Dienes <kdienes@apple.com>
-
- * Makefile.am (ALL_MACHINES): Use cpu-msp430.lo, not cpu-msp430.c.
- (BFD32_BACKENDS): Use elf32-msp430.lo, not elf32-msp430.c.
- * Makefile.in: Regenerate.
-
-2003-01-08 Alexandre Oliva <aoliva@redhat.com>
-
- * elfn32-mips.c (prev_reloc_section): New.
- (GET_RELOC_ADDEND): Use it. Parenthesize macro arguments.
- (SET_RELOC_ADDEND): Parenthesize macro argument.
-
-2003-01-07 John David Anglin <dave.anglin@nrc.gc.ca>
-
- * elf32-hppa.c (final_link_relocate): For all DP relative relocations,
- adjust addil instructions if the symbol has no section.
-
-2003-01-07 DJ Delorie <dj@redhat.com>
-
- * elf32-xstormy16.c (xstormy16_elf_howto_table): Make REL_12 not
- partial_inplace.
-
-2003-01-07 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (elf_m68k_check_relocs): Don't set DF_TEXTREL for
- PC relative relocations.
- (elf_m68k_discard_copies): Set it here instead.
-
-2002-01-02 Ben Elliston <bje@redhat.com>
- Jeff Johnston <jjohnstn@redhat.com>
-
- * Makefile.am (ALL_MACHINES): Add cpu-iq2000.lo.
- (ALL_MACHINES_CFILES): Add cpu-iq2000.c.
- (BFD32_BACKENDS): Add elf32-iq2000.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-iq2000.c.
- (cpu-iq2000.lo): New target.
- * Makefile.in: Regenerate.
- * config.bfd: Handle iq2000-*-elf.
- * archures.c (bfd_architecture): Add bfd_{arch,mach}_iq2000.
- (bfd_archures_list): Add bfd_iq2000_arch.
- * configure.in: Handle bfd_elf32_iq2000_vec.
- * configure: Regenerate.
- * reloc.c: Add BFD_RELOC_IQ2000_OFFSET_16, BFD_RELOC_IQ2000_OFFSET_21,
- and BFD_RELOC_IQ2000_UHI16.
- * targets.c (bfd_elf32_iq2000_vec): Declare.
- (bfd_target_vector): Add bfd_elf32_iq2000_vec.
- * elf.c (prep_headers): Set e_machine to EM_IQ2000.
- * cpu-iq2000.c: New file.
- * elf32-iq2000.c: Likewise.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Likewise.
-
-2003-01-02 Richard Sandiford <rsandifo@redhat.com>
-
- * elfxx-mips.c: Include libiberty.h.
- (elf_mips_isa, _bfd_mips_elf_mach_extends_p): Remove.
- (mips_set_isa_flags): New function, split out from...
- (_bfd_mips_elf_final_write_processing): ...here. Only call
- mips_set_isa_flags if the EF_MIPS_MACH bits are clear.
- (mips_mach_extensions): New array.
- (mips_32bit_flags_p): New function.
- (_bfd_mips_elf_merge_private_bfd_data): Rework architecture checks.
- Use mips_32bit_flags_p to check if one binary is 32-bit and the
- other is 64-bit. When adopting IBFD's architecture, adopt the
- bfd_mach as well as the flags.
-
-2003-01-02 Nick Kelsey <nickk@ubicom.com>
-
- * elf32-ip2k.c: Re-work of linker relaxation code for the ip2k to
- fix internal errors, fix bad code generation, fix incorrect stabs
- information, and improve ability to eliminate redundant page
- instructions. Added code to ip2k_final_link_relocate to self-verify
- the linker relaxation. Fix formatting problems.
-
-2002-12-30 Chris Demetriou <cgd@broadcom.com>
-
- * aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mipsisa32r2 case.
- * archures.c (bfd_mach_mipsisa32r2): New define.
- * bfd-in2.h: Regenerate.
- * cpu-mips.c (I_mipsisa32r2): New enum value.
- (arch_info_struct): Add entry for I_mipsisa32r2.
- * elfxx-mips.c (elf_mips_isa, _bfd_elf_mips_mach)
- (_bfd_mips_elf_print_private_bfd_data): Handle E_MIPS_ARCH_32R2.
- (_bfd_mips_elf_final_write_processing): Add
- bfd_mach_mipsisa32r2 case.
- (_bfd_mips_elf_merge_private_bfd_data): Handle merging of
- binaries marked as using MIPS32 Release 2.
-
-2002-12-30 Dmitry Diky <diwil@mail.ru>
-
- * Makefile.am: Add msp430 target.
- * configure.in: Likewise.
- * Makefile.in: Regenerate.
- * configure: Regenerate.
- * archures.c: Add msp430 architecture vector.
- * config.bfd: Likewise.
- * reloc.c: Add msp430 relocs.
- * targets.c: Add msp320 target.
- * cpu-msp430.c: New file: msp430 cpu detection.
- * elf32-msp430.c: New file: msp430 reloc processing.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
-2002-12-28 Jakub Jelinek <jakub@redhat.com>
-
- * elf.c (elf_sort_sections): Don't reorder .tbss.
- (assign_file_positions_for_segments): Only adjust off/voff
- for increased alignment in PT_LOAD or PT_NOTE segment,
- but adjust p_filesz for .tbss too. in PT_LOAD consider
- .tbss to have zero memory size.
- (copy_private_bfd_data) [SECTION_SIZE]: Define.
- [IS_CONTAINED_BY_VMA, IS_CONTAINED_BY_LMA]: Use it.
- [INCLUDE_SECTION_IN_SEGMENT]: Only put SHF_TLS sections
- into PT_TLS segment. Never put SHF_TLS sections in
- segments other than PT_TLS or PT_LOAD.
-
- * elf64-alpha.c (elf64_alpha_finish_dynamic_sections): Clear .plt
- sh_entsize.
-
-2002-12-23 DJ Delorie <dj@redhat.com>
-
- * coff64-rs6000.c (xcoff64_ppc_relocate_section): Fix logic reversal.
-
-2002-12-23 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_output_extsym): Heed strip_discarded.
-
-2002-12-23 Nick Clifton <nickc@redhat.com>
-
- * archures.c (bfd_arch_get_compatible): Add third parameter
- 'accept_unknowns'. Only accept unknown format BFDs if
- accept_unknowns is true, or if the format is "binary".
- * bfd-in2.h: Regenerate.
-
-2002-12-21 Nick Clifton <nickc@redhat.com>
-
- * coff-arm.c (coff_arm_relocate_section): Disable WINCE workaround
- that subtracted 8 from pc relative relocations.
-
-2002-12-20 Kazu Hirata <kazu@cs.umass.edu>
-
- * coff-h8300.c: Fix comment typos.
- * coffcode.h: Likewise.
- * cpu-cris.c: Likewise.
- * elf32-vax.c: Likewise.
- * genlink.h: Likewise.
- * linker.c: Likewise.
- * som.c: Likewise.
- * tekhex.c: Likewise.
- * vms-misc.c: Likewise.
-
-2002-12-20 DJ Delorie <dj@redhat.com>
-
- * reloc.c: Add BFD_RELOC_XSTORMY16_12.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * elf32-xstormy16.c (xstormy16_elf_howto): Add R_XSTORMY16_12.
- (xstormy16_reloc_map): Add R_XSTORMY16_12.
-
-2002-12-19 Kazu Hirata <kazu@cs.umass.edu>
-
- * doc/bfdint.texi: Fix typos.
-
-2002-12-20 Paul Eggert <eggert@twinsun.com>
-
- Port to POSIX 1003.1-2001.
- * acinclude.m4 (AM_INSTALL_LIBBFD): Do not rely on "test -o".
- * configure.in (build-warnings): Likewise.
- (Horrible hacks to build DLLs on Windows): Do not rely on "tail -1".
- * aclocal.m4: Regenerate.
- * config.in: Regenerate.
- * configure: Regenerate.
-
-2002-12-19 Alan Modra <amodra@bigpond.net.au>
-
- * coff-h8300.c: Include libiberty.h.
- (h8300_reloc16_extra_cases): Check the hash table creator before
- referencing h8300 specific fields. Stash the hash table pointer
- in a local var. Comment typo fixes.
- (h8300_bfd_link_add_symbols): Likewise.
-
- * reloc.c (struct reloc_howto_struct): Revise src_mask and
- dst_mask comments.
- * bfd-in2.h: Regenerate.
-
-2002-12-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Reorganize dynamic reloc
- code a little. Comment on dynamic relocs against section symbols.
-
-2002-12-17 Roger Sayle <roger@eyesopen.com>
-
- * configure.host (ia64-*-hpux*): Support 64 bit targets using
- the HP compiler's "long long".
-
-2002-12-16 Andrew MacLeod <amacleod@redhat.com>
-
- * elf32-xstormy16.c (xstormy16_elf_howto): Add R_XSTORMY16_LO16
- and R_XSTORMY16_HI16) howto entries.
- (xstormy16_reloc_map): Map R_XSTORMY16_{LO,HI}16 to BFD_RELOC_{LO,HI}16.
- (xstormy16_info_to_howto_rela): Use R_XSTORMY16_GNU_VTINHERIT to
- determine the start of the second reloc table.
-
-2002-12-16 Nathan Tallent <eraxxon@alumni.rice.edu>
-
- * ecofflink.c: Fix the reading of the debugging information
- of Tru64/Alpha binaries that are produced by recent Compaq
- compilers.
- (mk_fdrtab): Fix error in creating the FDR (file descriptor)
- table.
- (lookup_line): Because of the strange information sometimes
- generated by Compaq's recent compilers, change how the FDR
- table is searched so that PDRs (procedure descriptors) are
- correctly found. Note that this change is really more of a hack;
- however, I have included extensive documentation as to why
- this is the best solution short of an extensive rewrite or
- another hack.
- (fdrtab_lookup): Add comments to explain the algorithm.
-
-2002-12-12 Alexandre Oliva <aoliva@redhat.com>
-
- * elf-m10300.c (elf32_mn10300_link_hash_newfunc): Reorder
- initializers to match struct declaration.
-
-2002-12-12 Alan Modra <amodra@bigpond.net.au>
-
- * dwarf2.c (comp_unit_contains_address): Comment typo fix.
- * elf.c (get_program_header_size): Likewise.
- * elf32-m32r.c (m32r_elf_lo16_reloc): Likewise.
- (m32r_elf_generic_reloc): Likewise.
- * elf32-ppc.c (ppc_elf_howto_init): Likewise.
- * elflink.h (elf_bfd_discard_info): Likewise.
-
-2002-12-12 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_finish_dynamic_sections): Add output_offset
- to DT_JMPREL. Use srelplt input section size for DT_PLTRELSZ and
- DT_RELSZ adjustment, not output section. Avoid writing tags when
- unchanged. Don't assume linker script is sane, adjust DT_REL too.
- * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Just use raw
- size of srelplt for DT_PLTRELSZ. Use srelplt input section size for
- DT_RELASZ adjustment, not output section. Avoid writing tags when
- unchanged. Adjust DT_RELA.
- * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Tweaks for better
- formatting. Avoid writing tags when unchanged. Adjust DT_RELA.
-
-2002-12-12 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_calculate_relocation): Don't divide
- addend by 4.
-
-2002-12-12 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (struct mips_got_entry): New.
- (struct mips_got_info): Added got_entries field.
- (mips_elf_got_entry_hash, mips_elf_got_entry_eq): New functions.
- (mips_elf_local_got_index, mips_elf_got_page,
- mips_elf_got16_entry): Re-implement in terms of new...
- (mips_elf_create_local_got_entry): Rewrite to use got_entries.
- Change return type.
- (mips_elf_highest): Warning clean-up.
- (mips_elf_create_got_section): Initialize got_entries.
- (_bfd_mips_elf_check_relocs): Use got_entries to estimate
- local got size.
- (_bfd_mips_elf_size_dynamic_sections): Do not account for
- GOT_PAGE entries, since we now reuse GOT16 entries.
-
-2002-12-10 Jason Thorpe <thorpej@wasabisystems.com>
-
- * aoutx.h (set_section_contents): Allow an otherwise unrepresentable
- read-only section that lies after .text and before .data to be
- written into the output file and included in a_text.
- (translate_to_native_sym_flags): If an otherwise unrepresentable
- section was merged with .text, convert its symbols to N_TEXT
- symbols.
- * libaout.h (aout_section_merge_with_text_p): New macro.
-
-2002-12-08 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in.h: Comment typo fix. Formatting.
- * bfd-in2.h: Regenerate.
- * coff64-rs6000.c (xcoff64_openr_next_archived_file): Warning fix.
- * elf32-m68hc12.c (m68hc12_elf_set_mach_from_flags): Prototype.
- * elf64-mmix.c (mmix_dump_bpo_gregs): Warning fix.
-
-2002-12-05 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Handle PCREL21BI.
- Only send PCREL21B though the plt. Fix installed reloc type.
- (elfNN_ia64_relocate_section): Give error for dynamic reloc
- against PCREL22 or PCREL64I; clean up error messages for
- branch relocs.
-
-2002-12-04 Kevin Buettner <kevinb@redhat.com>
-
- * elf64-mips.c (elf64_mips_grok_prstatus, elf64_mips_grok_psinfo):
- New functions.
- (elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define.
-
-2002-12-04 David Mosberger <davidm@hpl.hp.com>
-
- * cpu-ia64-opc.c: Add operand constant "ar.csd".
-
-2002-12-04 H.J. Lu <hjl@gnu.org>
-
- * elfxx-ia64.c (get_local_sym_hash): Use section ID instead of
- BFD address when constructing local name.
-
-2002-12-04 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (struct elf_m68k_link_hash_table): Add sym_sec
- member.
- (elf_m68k_link_hash_table_create): Initialize it.
- (elf_m68k_check_relocs): Handle symbols that are forced to be
- local due to visibility changes.
- (elf_m68k_adjust_dynamic_symbol): Likewise.
- (elf_m68k_size_dynamic_sections): Likewise.
- (elf_m68k_discard_copies): Likewise.
- (elf_m68k_relocate_section): Likewise.
-
-2002-12-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_edit_opd): Correct typo.
-
-2002-12-04 Alan Modra <amodra@bigpond.net.au>
-
- * srec.c (srec_write_symbols): Restore '$' prefix to address
- accidentally removed in 2002-04-04 change.
- (srec_get_symtab): Use 0 instead of `(long) FALSE'.
-
-2002-12-03 Nick Clifton <nickc@redhat.com>
-
- * elf32-ppc.c (apuinfo_list_init): New function.
- (apuinfo_list_add): New function: Add a value to the list.
- (apuinfo_list_length): New function: Return the number of
- values on the list.
- (apuinfo_list_element): New function: Return a value on the
- list.
- (apuinfo_list_finish): New function: Free the resources used
- by the list.
- (ppc_elf_begin_write_processing): New function. Scan the
- input bfds for apuinfo sections.
- (ppc_elf_write_section): New function: Delay the creation of
- the contents of an apuinfo section in an output bfd.
- (ppc_elf_final_write_processing): New function. Create the
- contents of an apuinfo section in an output bfd.
- (elf_backend_begin_write_processing): Define.
- (elf_backend_final_write_processing): Define.
- (elf_backend_write_section): Define.
-
-2002-12-03 Richard Henderson <rth@redhat.com>
-
- * cpu-ia64-opc.c (elf64_ia64_operands): Add ldxmov entry.
-
-2002-12-01 Stephane Carrez <stcarrez@nerim.fr>
-
- Fix PR savannah/1417:
- * elf32-m68hc11.c (m68hc11_elf_relax_delete_bytes): Don't adjust
- branch if it goes to the start of the deleted region.
-
-2002-12-01 Stephane Carrez <stcarrez@nerim.fr>
-
- * bfd-in2.h (bfd_mach_m6812): Rebuild.
- * archures.c (bfd_mach_m6812_default, bfd_mach_m6812,
- bfd_mach_m6812s): Declare.
-
- * elf32-m68hc12.c (m68hc12_elf_set_mach_from_flags): New function.
- (_bfd_m68hc12_elf_set_private_flags): Call it.
- (_bfd_m68hc12_elf_print_private_bfd_data): Report processor version.
- (_bfd_m68hc12_elf_merge_private_bfd_data): Merge the flags and
- report microcontroller incompatibilities (HC12 vs HCS12).
- (elf_backend_object_p): Update.
-
-2002-11-30 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in.h (TRUE_FALSE_ALREADY_DEFINED, BFD_TRUE_FALSE): Delete.
- (enum bfd_boolean, boolean): Delete.
- (bfd_boolean): Typedef to an int.
- (FALSE, TRUE): Define.
- * aix386-core.c, aix5ppc-core.c, aout-adobe.c, aout-arm.c, aout-cris.c,
- aout-encap.c, aout-ns32k.c, aout-target.h, aout-tic30.c, aoutf1.h,
- aoutx.h, archive.c, archive64.c, archures.c, bfd-in.h, bfd.c, bfdwin.c,
- binary.c, bout.c, cache.c, cisco-core.c, coff-a29k.c, coff-alpha.c,
- coff-apollo.c, coff-arm.c, coff-aux.c, coff-h8300.c, coff-h8500.c,
- coff-i386.c, coff-i860.c, coff-i960.c, coff-ia64.c, coff-m68k.c,
- coff-m88k.c, coff-mcore.c, coff-mips.c, coff-or32.c, coff-ppc.c,
- coff-rs6000.c, coff-sh.c, coff-sparc.c, coff-stgo32.c, coff-tic30.c,
- coff-tic4x.c, coff-tic54x.c, coff-tic80.c, coff-w65.c, coff-we32k.c,
- coff-z8k.c, coff64-rs6000.c, coffcode.h, coffgen.c, cofflink.c,
- corefile.c, cpu-a29k.c, cpu-alpha.c, cpu-arc.c, cpu-arm.c, cpu-avr.c,
- cpu-cris.c, cpu-d10v.c, cpu-d30v.c, cpu-dlx.c, cpu-fr30.c, cpu-frv.c,
- cpu-h8300.c, cpu-h8500.c, cpu-hppa.c, cpu-i370.c, cpu-i386.c,
- cpu-i860.c, cpu-i960.c, cpu-ia64.c, cpu-ip2k.c, cpu-m10200.c,
- cpu-m10300.c, cpu-m32r.c, cpu-m68hc11.c, cpu-m68hc12.c, cpu-m68k.c,
- cpu-m88k.c, cpu-mcore.c, cpu-mips.c, cpu-mmix.c, cpu-ns32k.c,
- cpu-openrisc.c, cpu-or32.c, cpu-pdp11.c, cpu-pj.c, cpu-powerpc.c,
- cpu-rs6000.c, cpu-s390.c, cpu-sh.c, cpu-sparc.c, cpu-tic30.c,
- cpu-tic4x.c, cpu-tic54x.c, cpu-tic80.c, cpu-v850.c, cpu-vax.c,
- cpu-w65.c, cpu-we32k.c, cpu-xstormy16.c, cpu-z8k.c, dwarf1.c,
- dwarf2.c, ecoff.c, ecofflink.c, efi-app-ia32.c, efi-app-ia64.c,
- elf-bfd.h, elf-eh-frame.c, elf-hppa.h, elf-m10200.c, elf-m10300.c,
- elf-strtab.c, elf.c, elf32-arc.c, elf32-arm.h, elf32-avr.c,
- elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c,
- elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-hppa.h,
- elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
- elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
- elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
- elf32-pj.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-sh64-com.c,
- elf32-sh64.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c,
- elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
- elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-ppc.h, elf64-s390.c,
- elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c,
- elfarm-oabi.c, elfcode.h, elfcore.h, elflink.c, elflink.h,
- elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c, elfxx-mips.h,
- elfxx-target.h, format.c, freebsd.h, genlink.h, hash.c, hp300hpux.c,
- hppabsd-core.c, hpux-core.c, i386aout.c, i386linux.c, i386lynx.c,
- i386mach3.c, i386msdos.c, i386os9k.c, ieee.c, ihex.c, irix-core.c,
- libaout.h, libbfd-in.h, libbfd.c, libcoff-in.h, libecoff.h, libieee.h,
- libnlm.h, liboasys.h, libpei.h, libxcoff.h, linker.c, lynx-core.c,
- m68klinux.c, m68klynx.c, mach-o.c, mach-o.h, merge.c, mipsbsd.c,
- mmo.c, netbsd-core.c, netbsd.h, nlm.c, nlm32-alpha.c, nlm32-i386.c,
- nlm32-ppc.c, nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
- pc532-mach.c, pdp11.c, pe-arm.c, pe-i386.c, pe-mcore.c, pe-mips.c,
- pe-sh.c, peXXigen.c, pef.c, pei-arm.c, pei-i386.c, pei-mcore.c,
- pei-mips.c, pei-sh.c, peicode.h, ppcboot.c, ptrace-core.c, reloc.c,
- reloc16.c, riscix.c, rs6000-core.c, sco5-core.c, section.c, simple.c,
- som.c, som.h, sparclinux.c, sparclynx.c, srec.c, stabs.c, sunos.c,
- syms.c, targets.c, tekhex.c, ticoff.h, trad-core.c, versados.c,
- vms-gsd.c, vms-hdr.c, vms-misc.c, vms-tir.c, vms.c, vms.h,
- xcoff-target.h, xcofflink.c, xsym.c, xsym.h: Replace boolean with
- bfd_boolean, true with TRUE, false with FALSE. Simplify comparisons
- of bfd_boolean vars with TRUE/FALSE. Formatting.
- * bfd-in2.h, libbfd.h, libcoff.h: Regenerate
-
-2002-11-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h: Replace occurrences of Elf32_Internal_* and
- Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel
- with Elf_Internal_Rela.
- * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h,
- elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c,
- elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c,
- elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
- elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
- elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
- elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c,
- elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
- elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
- elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c,
- elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto.
- * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr
- throughout instead.
- * elf.c (_bfd_elf_no_info_to_howto_rel): Delete.
- * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *.
- Remove INLINE keyword.
- (elf_swap_reloc_in): Likewise. Also clear r_addend.
- (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand
- as a bfd_byte *.
- (elf_write_relocs): Consolidate REL and RELA code.
- (elf_slurp_reloc_table_from_section): Simplify REL code.
- (NAME(_bfd_elf,size_info)): Populate reloc swap entries.
- * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define.
- * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and
- RELA code.
- (elf_link_adjust_relocs): Likewise. Don't malloc space for temp
- reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL.
- (elf_link_output_relocs): Likewise.
- (elf_reloc_link_order): Likewise.
- (elf_finish_pointer_linker_section): Likewise.
- (struct elf_link_sort_rela): Remove union.
- (elf_link_sort_cmp1): Update to suit.
- (elf_link_sort_cmp2): Here too.
- (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory
- over-allocation for int_rels_per_ext_rel != 1 case.
- * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls.
- * elf32-i386.c: Likewise.
- * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out.
- * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c,
- elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise.
- * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out.
- * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
- elf64-sparc.c, elf64-x86-64.c: Likewise.
- * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out.
- * elfxx-mips.c (sort_dynamic_relocs): Likewise for
- bfd_elf32_swap_reloc_in.
-
- * elf32-arm.h: Update elf32_arm_info_to_howto calls.
- * elf32-mips.c: Likewise for mips_info_to_howto_rel.
- (mips_elf64_swap_reloc_in): Zero r_addend.
- (mips_elf64_be_swap_reloc_in): Likewise.
- (mips_elf64_slurp_one_reloc_table): Simplify.
-
- * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries.
- * elf64-hppa.c (hppa64_elf_size_info): Likewise.
- * elf64-sparc.c (sparc64_elf_size_info): Likewise.
-
-2002-11-28 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_relocate_section): Don't complain about
- unresolved debugging relocs in dynamic applications.
- * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
-
-2002-11-26 Alan Modra <amodra@bigpond.net.au>
-
- * elf-eh-frame.c (ENSURE_NO_RELOCS): Disregard R_*_NONE relocs.
- (_bfd_elf_discard_section_eh_frame): Don't discard duplicate CIEs
- on a relocatable link. Comment typos.
- * elf.c (_bfd_elf_link_hash_newfunc): Assign elements of structure
- in the order they are declared. Clear elf_hash_value too.
- (_bfd_elf_link_hash_table_init): Likewise assign in order. Clear
- eh_info and tls_segment.
- * elflink.h (elf_link_input_bfd <emit_relocs>): Keep reloc offsets
- sorted when discarding relocs by turning them into R_*_NONE.
-
- * libbfd.c (warn_deprecated): Comment spelling.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-11-21 Richard Henderson <rth@redhat.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't overwrite the
- arch's st_other bits when merging visibilities.
- (elf_link_output_extsym): Tidy clearing of visibility field.
-
-2002-11-21 Alan Modra <amodra@bigpond.net.au>
-
- * coff-mcore.c (SWAP_IN_RELOC_OFFSET): Define.
- (SWAP_OUT_RELOC_OFFSET): Define.
-
-2002-11-20 Alexandre Oliva <aoliva@redhat.com>
-
- * elf.c (_bfd_elf_link_hash_table_init): Make sure
- can_refcount is properly extended to the type of
- init_refcount.
-
-2002-11-19 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (MIPS_RELOC_RELA_P): New macro.
- (_bfd_mips_elf_relocate_section): Use it.
-
- * elfxx-mips.c (MNAME): New macro.
- (_bfd_mips_elf_check_relocs): Use it.
- (_bfd_mips_elf_discard_info): Likewise.
- (_bfd_mips_elf_final_link): Likewise.
-
-2002-11-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_edit_opd): When deleting relocs, adjust
- rel_hdr.sh_size too.
-
-2002-11-18 Klee Dienes <kdienes@apple.com>
-
- * Makefile.am (BFD32_LIBS): Add bfdwin.lo, bfdio.lo.
- (BFD32_LIBS_CFILES): Add bfdwin.c, bfdio.c.
- (BFD_H_FILES): Add bfdwin.c, bfdio.c.
- (LIBBFD_H_FILES): Add bfdwin.c, bfdio.c.
- Add dependencies for bfdwin.c, bfdio.c.
- * bfd.c: Remove bfd_get_mtime, bfd_get_size.
- * libbfd.c: Remove real_read, bfd_bread, _bfd_window_internal,
- bfd_init_window, bfd_free_window, bfd_get_file_window, bfd_bwrite,
- bfd_tell, bfd_flush, bfd_stat, bfd_seek.
- * bfdio.c: New file. Contains real_read, bfd_bread, bfd_write,
- bfd_tell, bfd_flush, bfd_stat, bfd_seek, bfd_ge_mtime,
- bfd_get_size (moved from libbfd.c and bfd.c).
- * bfdwin.c New file. Contains _bfd_window_internal,
- bfd_init_window, bfd_free_window, bfd_get_file_window (moved from
- libbfd.c and bfd.c).
- * po/SRC-POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * aclocal.m4: Regenerate.
- * Makefile.in: Regenerate.
- * configure: Regenerate.
-
-2002-11-18 Klee Dienes <kdienes@apple.com>
-
- * bfd.c (bfd_preserve_save): Don't zero BFD_IN_MEMORY.
-
-2002-11-15 Kazu Hirata <kazu@cs.umass.edu>
-
- * coff-h8300.c (h8300_reloc16_estimate): Do not optimize away
- jsr after a short jump.
- * elf32-h8300.c (elf32_h8_relax_section): Likewise.
-
-2002-11-15 Klee Dienes <kdienes@apple.com>
-
- * pef.c (bfd_pef_convert_architecture): Move declaration of
- ARCH_POWERPC and ARCH_M68K to the start of the function.
-
-2002-11-14 Svein E. Seldal <Svein.Seldal@solidas.com>
-
- * coff-tic4x.c (tic4x_howto_table): Formatting fixup
-
-2002-11-14 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs):
- For bpo_gregs_section->contents, allocate _raw_size, not
- _cooked_size.
-
-2002-11-13 Klee Dienes <kdienes@apple.com>
-
- * config.bfd: Add entries for powerpc-*-darwin and cousins.
-
-2002-11-13 H.J. Lu <hjl@gnu.org>
-
- * elfcode.h (elf_object_p): Don't restore abfd->arch_info.
-
-2002-11-13 Klee Dienes <kdienes@apple.com>
- Alan Modra <amodra@bigpond.net.au>
-
- * bfd.c (struct bfd_preserve): New.
- (bfd_preserve_save): New function.
- (bfd_preserve_restore): Ditto.
- (bfd_preserve_finish): Ditto.
- * bfd-in2.h: Regenerate.
- * mach-o.c: Formatting.
- (bfd_mach_o_scan_read_symtab_symbol): Make "value" unsigned.
- (bfd_mach_o_object_p): Use bfd_preserve_save/restore/finish.
- (bfd_mach_o_core_p): Ditto.
- (bfd_mach_o_scan): Pass in mdata.
- * mach-o.h (bfd_mach_o_scan): Update prototype.
- * pef.c: Formatting.
- (bfd_pef_object_p): Use bfd_preserve_save/restore/finish.
- (bfd_pef_xlib_object_p): Ditto.
- (bfd_pef_scan): Pass in mdata. Move version check to bfd_pef_object_p.
- * pef.h (bfd_pef_scan): Update prototype.
- * xsym.c: Formatting, K&R fixes.
- (bfd_sym_object_p): Use bfd_preserve_save/restore/finish.
- (bfd_sym_scan): New function split out from bfd_sym_object_p.
- * xsym.h (bfd_sym_scan): Declare.
- * elfcode.h (elf_object_p): Use bfd_preserve_save/restore/finish.
- * elfcore.h (elf_core_file_p): Likewise.
- * targets.c (_bfd_target_vector): Revert 2002-11-08 change.
-
-2002-11-12 Nick Clifton <nickc@redhat.com>
-
- * po/da.po: Updated Danish translation.
-
-2002-11-12 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_add_object_symbols): Optimize stabs for
- relocatable link too.
- (elf_link_input_bfd): When emitting relocs, adjust offsets for
- eh_frame and stab sections. Zap deleted relocs.
- (elf_reloc_symbol_deleted_p): Return true for zero r_symndx.
- (elf_bfd_discard_info): Run for relocatable link too.
- * elf64-ppc.c (ppc64_elf_edit_opd): Rename from edit_opd. Make global.
- Handle ld -r case.
- (ppc64_elf_size_dynamic_sections): Don't call edit_opd from here.
- * elf64-ppc.h (ppc64_elf_edit_opd): Declare.
-
- * elf-bfd.h (struct cie_header): Move from elf_eh-frame.c.
- (struct cie, struct eh_cie_fde, struct eh_frame_sec_info): Likewise.
- (struct eh_frame_array_ent, struct eh_frame_hdr_info): Likewise.
- (enum elf_link_info_type): Remove ELF_INFO_TYPE_EH_FRAME_HDR.
- (struct eh_frame_hdr_info): Add "hdr_sec", remove "split".
- (struct elf_link_hash_table): Add eh_info.
- (struct elf_obj_tdata): Change eh_frame_hdr to an asection *.
- (_bfd_elf_discard_section_eh_frame): Update prototype.
- (_bfd_elf_discard_section_eh_frame_hdr): Likewise.
- (_bfd_elf_write_section_eh_frame): Likewise.
- (_bfd_elf_write_section_eh_frame_hdr): Likewise.
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Remove "ehdrsec"
- param. Get "hdr_info" from link hash table.
- (_bfd_elf_discard_section_eh_frame_hdr): Remove "sec" param. Get
- header section from link hash table. Save header section to elf_tdata.
- (_bfd_elf_maybe_strip_eh_frame_hdr): Remove local "sec". Use
- header section from link hash table. Don't alloc hdr_info. Clear
- hdr_sec instead of setting "strip".
- (_bfd_elf_eh_frame_section_offset): Formatting.
- (_bfd_elf_write_section_eh_frame): Remove "ehdrsec", add "info" param.
- Get header section from link hash table.
- (_bfd_elf_write_section_eh_frame_hdr): Remove "sec", add "info" param.
- Get header section from link hash table.
- * elf.c (map_sections_to_segments): Use cached eh_frame_hdr.
- (get_program_header_size): Likewise.
- (_bfd_elf_section_offset): Formatting.
- * elflink.h (elf_link_create_dynamic_sections): Stash eh frame header
- section pointer in link hash table.
- (elf_bfd_final_link): Adjust _bfd_elf_write_section_eh_frame_hdr
- and _bfd_elf_write_section_eh_frame calls. Update comment about
- eh_frame entries.
- (elf_bfd_discard_info): Adjust _bfd_elf_discard_section_eh_frame and
- _bfd_elf_discard_section_eh_frame_hdr calls. Remove "ehdr".
-
- * po/SRC-POTFILES.in: Regenerate.
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't zero
- relocs for discarded FDEs. Remove dead code.
- (_bfd_elf_write_section_eh_frame_hdr): Remove dead code.
- * elflink.h (elf_bfd_discard_info): Don't save edited relocs.
- Tidy conditions under which stabs are edited. Formatting.
- * elf64-sparc.c (sparc64_elf_relocate_section): Ignore overflows
- from discarded relocs.
- * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Add reloc output
- section adjustments after testing magic values.
-
-2002-11-12 Thomas Moestl <tmm@FreeBSD.org>
-
- * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Correct
- references to large plt symbols.
-
-2002-11-12 Klee Dienes <kdienes@apple.com>
-
- * mach-o.c (bfd_mach_o_scan_read_thread): Don't re-use 'i' when
- looking for an unused section name.
-
-2002-11-11 Kazu Hirata <kazu@cs.umass.edu>
-
- * coff-h8300.c: Fix formatting.
- * elf32-h8300.c: Likewise.
- * reloc16.c: Likewise.
-
-2002-11-09 Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
-
- * elf32-arm.h (elf32_arm_size_dynamic_sections): Don't strip output
- section when dynamic section unused; _bfd_strip_section_from_output
- instead.
-
-2002-11-08 Alan Modra <amodra@bigpond.net.au>
-
- * targets.c (_bfd_target_vector): Disable pef_vec, pef_xlib_vec
- and sym_vec.
-
- * dwarf2.c: Revert last change.
-
-2002-11-07 Michal Ludvig <mludvig@suse.cz>
-
- * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
- _bfd_dwarf2_find_nearest_line): Use
- bfd_simple_get_relocated_section_contents() instead of
- bfd_get_section_contents().
- * reloc.c (bfd_perform_relocation): Add sanity check.
- * simple.c (simple_get_relocated_section_contents): If the section
- does not have any relocs associated with it, just return the
- unadjusted contents.
-
-2002-11-07 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_16_GOT,
- case R_CRIS_32_GOT>: Correct test for filling in constant .got
- contents, enabling for a non-DSO, for symbols defined in the
- program with --export-dynamic.
-
-2002-11-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c: Comment typo fixes.
- (ppc64_elf_merge_private_bfd_data): Allow BFD_ENDIAN_UNKNOWN input.
-
-2002-11-07 Nick Clifton <nickc@redhat.com>
-
- * po/da.po: Updated Danish translation.
-
-2002-11-06 Alexandre Oliva <aoliva@redhat.com>
-
- * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Generate
- exactly three internal relocs per external reloc. Set reloc_count
- to the external reloc count.
-
-2002-11-06 Klee Dienes <kdienes@apple.com>
-
- * coff-stgo32.c (stub_bytes): Mark as const.
- Fix comment formatting.
-
-2002-11-06 Klee Dienes <kdienes@apple.com>
-
- * Makefile.am (BFD32_BACKENDS): Add mach-o.lo, pef.lo, and
- xsym.lo.
- (BFD32_BACKENDS_CFILES): Add mach-o.c, pef.c, and xsym.c.
- (SOURCE_HFILES): Add mach-o.h, pef.h, pef-traceback.h, xsym.h
- * archures.c (enum bfd_architecture): Add bfd_arch_m98k.
- * bfd.c (struct bfd): Add private data for mach-o, pef, and sym.
- * targets.c (enum bfd_flavour): Add flavours for mach-o, pef, and
- sym.
- (_bfd_target_vector): Add target vectors for mach-o, pef, and sym.
- * Makefile.in: Regenerate.
- * doc/Makefile.in: Regenerate.
- * bfd-in2.h: Regenerate.
- * xsym.c: New file. Contains support for the Apple/Metrowerks
- xSYM debugging format.
- * xsym.h: New file.
- * pef.c: New file. Contains support for the Apple Code Fragment
- Manager Preferred Executable Format
- * pef.h: New file.
- * pef-traceback.h: New file. Contains support for parsing PowerPC
- traceback tables as used by PEF executables (and perhaps other
- systems as well).
- * mach-o.c: New file. Contains support for the Mach-O object file
- format.
- * mach-o.h: New file.
- * mach-o-target.c: New file. Declares the mach-o targets
- themselves. Included three times by mach-o.c; each time with a
- different set of macros set.
-
-2002-11-06 Graeme Peterson <gp@qnx.com>
-
- * Makefile.am: Remove entries for elf32-qnx.[ch].
- * Makefile.in: Regenerate.
- * config.bfd: Change arm-nto to use bfd_elf32_{big|little}arm_vec,
- ppc-nto to use bfd_elf32_powerpc{le}_vec, sh-nto to use
- bfd_elf32_sh{l}_vec, and i386-nto to use bfd_elf32_i386_vec.
- * configure.in: Remove support for bfd_elf32_sh{l}qnx_vec,
- bfd_elf32_powerpc{le}qnx_vec, bfd_elf32_{big|little}armqnx_vec,
- and bfd_elf32_i386qnx_vec, and removed elf32-qnx.lo from other targets.
- bfd_elf32_sh{l}_vec, and i386-nto to use bfd_elf32_i386_vec.
- * configure: Regenerate.
- * elf32-qnx.c: Remove.
- * elf32-qnx.h: Remove.
- * elf.c: Remove calls to QNX specific set_nonloadable_filepos,
- is_contained_by_filepos, and copy_private_bfd_data_p.
- * elf-bfd.h (struct elf_backend_data): Remove set_nonloadable_filepos,
- is_contained_by_filepos, and copy_private_bfd_data_p.
- * elf32-i386.c: Remove QNX extended bfd support.
- * elf32-ppc.c: Remove QNX extended bfd support.
- * elf32-sh.c: Remove QNX extended bfd support.
- * elfarm-nabi.c: Remove QNX extended bfd support.
- * targets.c: Remove qnx vectors.
- * elfxx-target.h (elf_backend_set_nonloadable_filepos): Remove
- (elf_backend_is_contained_by_filepos): Remove.
- (elf_backend_copy_private_bfd_data_p): Remove.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-11-06 David O'Brien <obrien@FreeBSD.org>
- Alan Modra <amodra@bigpond.net.au>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of
- dynamic relocs against section symbols for the output section vma.
-
-2002-11-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-arm.h (t2a1_push_insn, t2a2_ldr_insn, t2a3_mov_insn,
- t2a4_bx_insn, t2a5_pop_insn, t2a6_bx_insn): Remove.
-
-2002-11-05 Kaz Kojima <kkojima@rr.iij4u.or.jp>
- Alan Modra <amodra@bigpond.net.au>
-
- * config.bfd (sh-*-linux*): Use bfd_elf*_sh64*lin_vec as sh64
- vectors in target_selvecs.
- (shle-*-netbsdelf*): Use bfd_elf*_sh64*nbsd_vec as sh64 vectors
- in target_selvecs.
- (sh-*-netbsdelf*): Likewise.
- * configure.in (assocvecs): New variable. Handle assocvecs like
- selvecs.
- * configure: Regenerate.
- * format.c (bfd_check_format_matches): Store bfd_target pointers
- in matching_vector instead of target names. Select first target
- from bfd_associated_vector that matches a list of ambiguous targets.
- * targets.c (_bfd_associated_vector): New array.
- (bfd_associated_vector): New variable.
- (_bfd_target_vector): Add bfd_elf*_sh64*lin_vec.
- * libbfd-in.h (bfd_associated_vector): Declare.
- * libbfd.h: Regenerate.
-
-2002-11-05 Elias Athanasopoulos <eathan@otenet.gr>
-
- * vms-gsd.c (_bfd_vms_write_gsd): Check that symbol->udata.p is
- non-NULL before dereferencing.
-
-2002-11-04 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * vms.c (vms_object_p): Restore the start address when returning
- NULL.
-
-2002-11-04 Alan Modra <amodra@bigpond.net.au>
- Hans-Peter Nilsson <hp@axis.com>
-
- * elflink.h (struct elf_final_link_info): Add shndxbuf_size.
- (elf_bfd_final_link): Don't bother zeroing symtab_hdr fields.
- Set up a larger symshndxbuf, and write it out. Free it on
- exit rather than freeing symbuf twice. Correct section index
- on output section symbol loop.
- (elf_link_output_sym): Accumulate symbol extension section
- indices, reallocating symshndxbuf rather than writing it out.
- (elf_link_flush_output_syms): Don't flush symshndxbuf.
- * elf.c (assign_section_numbers): Init i_shdrp to all zero.
- Use bfd_zalloc to clear i_shdrp[0] too.
-
-2002-11-03 Stephen Clarke <stephen.clarke@earthling.net>
-
- * elf32-sh64-com.c (sh64_address_in_cranges): Use
- _raw_size of cranges section if _cooked_size not yet set.
-
-2002-11-03 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-v850.c (v850_elf_relax_delete_bytes): Correct parameters
- for bfd_elf32_swap_symbol_out.
-
-2002-10-31 David O'Brien <obrien@FreeBSD.org>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't mix
- signed and unsigned in comparison.
-
-2002-10-30 Daniel Jacobowitz <drow@mvista.com>
-
- * coffcode.h: Remove extraneous '\'.
-
-2002-10-28 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am (targets.lo): Depend on Makefile instead of
- config.status.
- (archures.lo): Likewise.
- * Makefile.in: Regenerated.
-
-2002-10-25 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Add
- bfd_elf64_bigmips_vec and bfd_elf64_littlemips_vec to
- targ_selvecs.
-
-2002-10-25 Jim Wilson <wilson@redhat.com>
-
- * elf64-sh64.c (sh_elf64_relocate_section): Call
- _bfd_elf_rela_local_sym. Handle relocs against STT_SECTION symbol
- of SHF_MERGE section.
-
-2002-10-25 Hans-Peter Nilsson <hp@axis.com>
-
- * simple.c: Correct placement of ATTRIBUTE_UNUSED.
-
-2002-10-24 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
- unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
- unsigned int.
- (NAME(aout,final_link)): Cast enum used in assignment.
- (aout_link_write_symbols): Cast enums in comparisons, int values to
- boolean, enums in assignments to int.
- (aout_link_input_section_std): Cast rel->r_index to unsigned int.
- (aout_link_input_section_ext): Likewise. Cast enums used in
- comparisons with unsigned ints.
- (aout_link_reloc_link_order): Cast enum to int in assignment.
- * archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
- calls to char *.
- * bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
- assignment.
- * bfd-in2.h (bfd_set_section_vma): Likewise.
- * bfd.c (bfd_record_phdr): Cast enums in assignments.
- * binary.c (bfd_alloc): Cast enum to long.
- * coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
- * dwarf2.c (read_abbrevs): Add casts to enum types.
- (read_attribute_value): Likewise.
- (arange_add): Cast result of bfd_zalloc call.
- (comp_unit_contains_address): Return true and false.
- (comp_unit_find_nearest_line): Cast return to boolean.
- * format.c (bfd_check_format_matches, bfd_set_format): Likewise.
- * gen-aout.c: define macro '_' if not defined.
- * libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
- (bfd_bwrite): Cast bfd_realloc to bfd_byte *.
- (bfd_write_bigendian_4byte_int): Cast return to boolean.
- (bfd_seek): Cast bfd_realloc to bfd_byte *.
- (bfd_generic_is_local_label_name): Cast return to boolean.
- * libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
- * linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
- struct bfd_hash_entry *.
- (_bfd_generic_link_hash_newfunc): likewise.
- (_bfd_generic_final_link): Cast enum to unsigned int.
- * merge.c (sec_merge_emit): Cast return to boolean.
- (merge_strings): Add casts to const unsigned char *.
- * reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
- (bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
- * section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result
- to struct bfd_hash_entry *.
- (bfd_set_section_content): Add cast to PTR in comparison.
- * simple.c (simple_dummy_warning, simple_dummy_undefined_symbol,
- simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous,
- simple_dummy_unattached_reloc,
- bfd_simple_get_relocated_section_contents): Add K&R declarations and
- function definitions.
- * srec.c (S3Forced): Initialize to false.
- (srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
- * stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
- (_bfd_discard_section_stabs): Likewise. Also cast return to boolean.
- * syms.c (bfd_is_undefined_symclass): Cast return to boolean.
- (_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
- comparisons.
-
-2002-10-23 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Only put maybe_dynamic
- relocs into shared lib non-allocated reloc sections.
-
-2002-10-23 Nathan Tallent <eraxxon@alumni.rice.edu>
-
- * dwarf2.c (add_line_info): Ensure that the line_info_table is
- sorted even when given an out-of-order line sequence.
- (lookup_address_in_line_info_table): When an exact VMA match is
- not found, return line information with the closest VMA.
-
-2002-10-23 Ross Alexander <ross.alexander@uk.neceur.com>
-
- * elf64-hppa.c: Force DT_FLAGS to always be set. Required by
- HPUX 11.00 patch PHSS_26559.
-
-2002-10-22 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Don't move
- the options section into a separate section unless IRIX 6
- compatibility is enabled.
-
-2002-10-22 Alexandre Oliva <aoliva@redhat.com>
-
- * elflink.h (struct elf_link_sort_rela): Turn rel and rela
- into arrays.
- (elf_link_sort_cmp1, elf_link_sort_cmp2): Adjust.
- (elf_link_sort_relocs): Likewise. Take int_rels_per_ext_rel
- into account.
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Compose
- R_MIPS_REL32 with R_MIPS64 if ABI_64_P.
-
-2002-10-21 Graeme Peterson <gp@qnx.com>
-
- * targets.c (_bfd_target_vector): Add missing qnx vectors.
-
-2002-10-21 Alan Modra <amodra@bigpond.net.au>
-
- * targets.c (bfd_target_list): Don't return the default target twice.
-
-2002-10-21 Elias Athanasopoulos <eathan@otenet.gr>
-
- * archive.c (_bfd_archive_bsd_update_armap_timestamp): Replace
- perror with bfd_perror.
-
-2002-10-19 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Correctly handle
- DT_RPATH and DT_RUNPATH.
-
-2002-10-19 Mark Kettenis <kettenis@gnu.org>
-
- * elf.c (elfcore_grok_note): Fix recognition on NT_PRXFPREG notes.
-
-2002-10-17 Denis Chertykov <denisc@overta.ru>
-
- * elf32-ip2k.c (ELF_MACHINE_ALT1): Define alternate machine code
- for ip2k port.
-
-2002-10-17 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-target.h (USE_REL): Don't define as 1.
- * elf32-arm.h (USE_REL): Provide a default define of 0.
- Use #if rather than #ifdef when testing USE_REL.
- * elf32-m32r.c: Likewise.
-
- * elf32-arc.c (USE_REL): Define as 1.
- * elf32-d10v.c (USE_REL): Likewise.
- * elf32-m32r.c (USE_REL): Likewise.
- * elf32-m68hc11.c (USE_REL): Likewise.
- * elf32-m68hc12.c (USE_REL): Likewise.
- * elf32-or32.c (USE_REL): Likewise.
- * elfarm-nabi.c (USE_REL): Likewise.
-
-2002-10-16 Jakub Jelinek <jakub@redhat.com>
-
- * config.bfd (s390-*-linux*): Add targ64_selvecs.
- (s390x-*-linux*): Add targ_selvecs.
-
-2002-10-16 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (BFD32_BACKENDS): Remove elfarmqnx-nabi.lo,
- elf32-i386-fbsd.lo, elf32-i386qnx.lo, elf32-ppcqnx.lo,
- elf32-sh-lin.lo, elf32-sh64-lin.lo, elf32-sh-nbsd.lo,
- elf32-sh64-nbsd.lo, elf32-shqnx.lo. Add elf32-qnx.lo.
- (BFD32_BACKENDS_CFILES): Likewise for corresponding C files.
- (BFD64_BACKENDS): Remove elf64-sh64-lin.lo, elf64-sh64-nbsd.lo.
- (BFD64_BACKENDS_CFILES): Likewise for corresponding C files.
- (SOURCE_HFILES): Add elf32-qnx.h.
- (BUILD_HFILES): Add bfdver.h.
- Run "make dep-am".
- * Makefile.in: Regenerate.
- * configure.in Update bfd vector dependencies.
- * configure: Regenerate.
- * elf32-i386-fbsd.c: Delete. Move code to elf32-i386.c.
- * elf32-i386qnx.c: Likewise.
- * elf32-ppcqnx.c: Delete. Move code to elf32-ppc.c.
- * elf32-sh-nbsd.c: Delete. Move code to elf32-sh.c.
- * elf32-sh-lin.c: Likewise.
- * elf32-shqnx.c: Likewise.
- * elf32-sh64-lin.c: Delete. Move code to elf32-sh64.c.
- * elf32-sh64-nbsd.c: Likewise.
- * elf64-sh64-lin.c: Delete. Move code to elf64-sh64.c.
- * elf64-sh64-nbsd.c: Likewise.
- * elfarmqnx-nabi.c: Delete. Move code to elfarm-nabi.c.
- * elf32-arm.h (ELF_MAXPAGESIZE): Always define.
- * elf32-i386.c: Remove ELF_ARCH and ELF32_I386_C_INCLUDED tests.
- * elf32-ppc.c: Remove ELF32_PPC_C_INCLUDED tests.
- * elf32-qnx.h (elf_backend_set_nonloadable_filepos): Always define.
- (elf_backend_is_contained_by_filepos): Likewise.
- (elf_backend_copy_private_bfd_data_p): Likewise.
- Globalize and move functions to..
- * elf32-qnx.c: ..here. New file.
- * elf32-sh.c: Remove ELF_ARCH and ELF32_SH_C_INCLUDED tests. Don't
- emit target vectors when INCLUDE_SHMEDIA.
- * elf32-sh64.c: Remove ELF_ARCH test. Move TARGET_* etc. defines to
- end of file.
- * elf64-sh64.c: Remove ELF_ARCH test.
- * elfarm-nabi.c: Remove ELFARM_NABI_C_INCLUDED test.
- * po/BLD-POTFILES.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-10-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_add_object_symbols): Error out on dynamic objects
- loaded with --just-symbols.
-
- * elf32-i386qnx.c (TARGET_LITTLE_NAME): Define.
- * elf32-ppcqnx.c (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Define.
- * elf32-shqnx.c (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Define.
- * elfarmqnx-nabi.c (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Define.
-
-2002-10-15 Richard Henderson <rth@redhat.com>
-
- * Makefile.am (BFD64_BACKENDS): Remove elf64-alpha-fbsd.
- (BFD64_BACKENDS_CFILES): Likewise.
- * configure.in (bfd_elf64_alpha_freebsd_vec): Use elf64-alpha.
- * elf64-alpha-fbsd.c: Remove file, move code ...
- * elf64-alpha.c: ... here.
- * Makefile.in, configure: Rebuild.
-
-2002-10-14 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: Increment
- VALUE, not ADDEND.
-
-2002-10-14 Stephen Clarke <stephen.clarke@superh.com>
-
- * elf32-sh.c (elf_sh_link_hash_entry): Replace
- datalabel_got_offset with union of datalabel_got
- offset and refcount.
- (sh_elf_link_hash_newfunc): Initialize datalabel_got.refcount.
- (allocate_dynrelocs): Delete unnecessary code for
- STT_DATALABEL type. Create entry in got for
- datalabel version of symbol if datalabel_got.refcount > 0.
- (sh_elf_relocate_section): Use datalabel_got union.
- (sh_elf_gc_sweep_hook): Pull common code to initialize
- h and eh out of switch statement. Declare seen_stt_datalabel.
- Initialize it. Decrement datalabel_got.refcount for
- got relocs when seen_stt_datalabel is true.
- Decrement local_got_refcounts entry for datalabel got relocs
- of local symbols.
- (sh_elf_copy_indirect_symbol): Copy datalabel_got field over.
- (sh_elf_check_relocs): Declare seen_stt_datalabel.
- Initialize it. When seen_stt_datalabel is true, increment
- datalabel_got refcount rather than got.refcount.
- (sh_elf_finish_dynamic_symbol): Create relocs to
- initialize got entry for datalabel version of symbol.
-
-2002-10-14 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Run "make dep-am".
- (BFD_H_FILES): Remove version.h.
- * bfd-in.h (BFD_VERSION, BFD_VERSION_DATE, BFD_VERSION_STRING): Move..
- * version.h: ..to here.
- * configure.in (bfd_version_date): Remove.
- (AC_OUTPUT): Make bfdver.h from version.h.
- * bfd.c: #include "bfdver.h".
- * vms-hdr.c: Likewise.
- * Makefile.in: Regenerate.
- * bfd-in2.h: Regenerate.
- * configure: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-10-14 Alan Modra <amodra@bigpond.net.au>
-
- * archures.c (bfd_mach_i386_i386, bfd_mach_i386_i8086,
- bfd_mach_i386_i386_intel_syntax, bfd_mach_x86_64,
- bfd_mach_x86_64_intel_syntax bfd_mach_ppc, bfd_mach_ppc64,
- bfd_mach_rs6k, bfd_mach_d10v, bfd_mach_sh, bfd_mach_v850,
- bfd_mach_arc_5, bfd_mach_arc_6, bfd_mach_arc_7, bfd_mach_arc_8,
- bfd_mach_m32r, bfd_mach_frv, bfd_mach_frvsimple,
- bfd_mach_ia64_elf64, bfd_mach_ia64_elf32,
- bfd_mach_ip2022, bfd_mach_ip2022ext,
- bfd_mach_s390_31, bfd_mach_s390_64, bfd_mach_xstormy16): Renumber.
- * bfd-in2.h: Regenerate.
-
-2002-10-14 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * config.bfd (sh*eb-*-linux*, sh*-*-linux*): Add the alternative
- endian vector to targ_selvecs.
-
-2002-10-13 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_calculate_relocation): Take
- save_addend argument. Don't apply the 32-bit mask to a
- GPREL32 value if it's to be used in another relocation. Don't
- use forced-check computation of local_p to decide whether to
- add gp0 to GPREL16 value. Don't use only the lowest 16 bits
- of the addend of a non-in-place GPREL16 relocation.
- (_bfd_mips_elf_relocate_section): Pass use_saved_addend_p to
- mips_elf_calculate_relocation().
-
-2002-10-12 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc11.c (m68hc11_elf_relax_section): Don't treat relocs
- with symbols in other sections if we relaxed something; the sections
- output offsets must be re-computed before.
-
-2002-10-12 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc11.c (m68hc11_elf_relax_section): Update symbols
- handling to use Elf_Internal_Sym.
- (m68hc11_elf_relax_delete_bytes): Likewise.
-
-2002-10-11 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_optimized_tls_reloc, sh_elf_mkobject,
- sh_elf_object_p, dtpoff_base): New functions.
- (sh_elf_howto_table): Add TLS relocs.
- (sh_reloc_map): Likewise.
- (sh_elf_info_to_howto): Support TLS relocs.
- (elf_sh_link_hash_entry): Add tls_type and tls_tpoff32.
- (sh_elf_hash_entry, sh_elf_tdata, sh_elf_local_got_tls_type):
- New macros.
- (sh_elf_obj_tdata): New.
- (elf_sh_link_hash_table): Add tls_ldm_got.
- (sh_elf_link_hash_table_create): Clear refcount of tls_ldm_got.
- (allocate_dynrelocs): Support TLS relocs.
- (sh_elf_size_dynamic_sections): Likewise.
- (sh_elf_relocate_section): Support TLS relocs. Don't try to find
- .rela.got section when found already. Return false after printing
- error about unresolvable relocation.
- (sh_elf_gc_sweep_hook): Support TLS relocs.
- (sh_elf_check_relocs): Likewise.
- (sh_elf_finish_dynamic_symbol): Likewise.
- (bfd_elf32_mkobject, elf_backend_object_p): Define for TLS case.
- * reloc.c: Add SH TLS relocs.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2002-10-11 Daniel Jacobowitz <drow@mvista.com>
-
- * Makefile.in: Regenerated.
-
-2002-10-11 Daniel Jacobowitz <drow@mvista.com>
-
- * Makefile.am: Run dep-am.
- (BFD_H_DEP): Add simple.c and linker.c.
- (BFD32_LIBS): Add simple.lo.
- (BFD32_LIBS_CFILES): Add simple.c.
- * Makefile.in: Regenerated.
- * bfd-in2.h: Regenerated.
- * simple.c: New file.
-
-2002-10-11 Alan Modra <amodra@bigpond.net.au>
-
- * coff-arm.c (record_arm_to_thumb_glue): Avoid type-punned pointers.
- (record_thumb_to_arm_glue): Likewise.
- * ecoff.c (ecoff_link_add_externals): Likewise.
- * elf32-arm.h (record_arm_to_thumb_glue): Likewise.
- (record_thumb_to_arm_glue): Likewise.
- * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
- * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
- * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
- * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise.
- * elf64-ppc.c (func_desc_adjust): Likewise.
- * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
- (sh64_elf64_create_dynamic_sections): Likewise.
- * elflink.c (_bfd_elf_create_got_section): Likewise.
- (_bfd_elf_create_dynamic_sections): Likewise.
- (_bfd_elf_create_linker_section): Likewise.
- * elflink.h (elf_add_default_symbol): Likewise.
- (elf_link_create_dynamic_sections): Likewise.
- (NAME(bfd_elf,size_dynamic_sections)): Likewise.
- * elfxx-ia64.c (elfNN_ia64_aix_add_symbol_hook): Likewise.
- * elfxx-mips.c (mips_elf_create_got_section): Likewise.
- (_bfd_mips_elf_add_symbol_hook): Likewise.
- (_bfd_mips_elf_create_dynamic_sections): Likewise.
- * linker.c (generic_link_add_symbol_list): Likewise.
- * xcofflink.c (xcoff_link_add_symbols): Likewise.
-
- * elfxx-ia64.c (oor_brl, oor_ip): Conditionally define.
-
- * elf64-ppc.c (edit_opd): Only zero opd syms when function is
- completely removed. Correct local sym adjustment.
-
-2002-10-10 Stephen Clarke <stephen.clarke@superh.com>
-
- * elf32-sh.c (elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le):
- Correct mistake in calculation of address of .got.
- * elf64-sh64.c (elf_sh64_pic_plt_entry_be,
- elf_sh64_pic_plt_entry_le): Likewise.
-
-2002-10-09 Richard Shann <richard.shann@superh.com>
- Stephen Clarke <stephen.clarke@superh.com>
-
- * Makefile.am: Add entries for elf32-sh64-lin.c and
- elf64-sh64-lin.c. Regenerate.
- * Makefile.in: Regenerate.
- * config.bfd: Change sh64eb-*-linux* and sh64-*-linux*
- to use sh64 vectors rather than sh vectors.
- * configure.in: Add bfd_elf32_sh64lin_vec, bfd_elf32_sh64blin_vec,
- bfd_elf64_sh64lin_vec, bfd_elf64_sh64blin_vec.
- * configure: Regenerate.
- * elf32-sh64-lin.c: New file.
- * elf64-sh64-lin.c: New file.
- * targets.c: Add bfd_elf32_sh64lin_vec, bfd_elf32_sh64blin_vec,
- bfd_elf64_sh64lin_vec, bfd_elf64_sh64blin_vec.
-
-2002-10-08 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_relocate_section): Re-arrange the
- IE->LE transition for R_386_TLS_IE.
-
-2002-10-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (edit_opd): Correct test for discarded sections.
-
-2002-10-07 Mark Elbrecht <snowball3@softhome.net>
-
- * cofflink.c (mark_relocs): Don't mark relocations in excluded
- sections.
-
-2002-10-07 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd): Remove BFD_VERSION_DATE dependent
- code.
-
- * elf64-ppc.c (ppc64_elf_build_stubs): Increment .glink indx.
-
-2002-10-06 Alan Modra <amodra@bigpond.net.au>
-
- * opncls.c: Formatting.
- (_bfd_new_bfd): Use a smaller section hash table.
-
-2002-10-05 Alexandre Oliva <aoliva@redhat.com>
-
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Set the type
- of the other two relocations packed with a REL32 to NONE.
-
-2002-10-02 Stephen Clarke <stephen.clarke@superh.com>
-
- * elf32-sh.c (elf_sh_link_hash_entry): Add gotplt_refcount.
- (sh_elf_link_hash_newfunc): Initialize it.
- (allocate_dynrelocs): Transfer gotplt refs from plt.refcount
- to got.refcount for symbols that are forced local or when
- we have direct got refs.
- (sh_elf_gc_sweep_hook): Adjust gotplt_refcount. Use it
- to correctly adjust got.refcount and plt.refcount.
- (sh_elf_copy_indirect_symbol): Copy gotplt_refcount across.
- (sh_elf_check_relocs): Increment gotplt_refcount.
-
-2002-10-01 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Fix
- movl foo@indntpoff, %eax IE->LE transition.
-
-2002-10-01 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Change TLSGD
- sequence and its transitions.
-
-2002-10-01 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Resolve R_386_TLS_LDO_32
- to st_value + addend in non-code sections.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Resolve
- R_X86_64_DTPOFF32 to st_value + addend in non-code sections.
-
-2002-09-30 Gavin Romig-Koch <gavin@redhat.com>
- Ken Raeburn <raeburn@cygnus.com>
- Aldy Hernandez <aldyh@redhat.com>
- Eric Christopher <echristo@redhat.com>
- Richard Sandiford <rsandifo@redhat.com>
-
- * archures.c (bfd_mach_mips4120, bfd_mach_mips5400): New.
- (bfd_mach_mips5500): New.
- * cpu-mips.c (I_mips4120, I_mips5400, I_mips5500): New.
- (arch_info_struct): Add corresponding entries here.
- * elfxx-mips.c (_bfd_elf_mips_mach): Handle E_MIPS_MACH_4120,
- E_MIPS_MACH_5400 and E_MIPS_MACH_5500.
- (_bfd_mips_elf_final_write_processing): Handle bfd_mach_mips4120,
- bfd_mach_mips5400 and bfd_mach_mips5500.
- (_bfd_mips_elf_mach_extends_p): New function.
- (_bfd_mips_elf_merge_private_bfd_data): Use it to help merge
- the EF_MIPS_MACH flags.
- * bfd-in2.h: Regenerate.
-
-2002-09-28 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elf32-vax.c (elf_vax_size_dynamic_section): Don't strip
- .got sections.
-
-2002-09-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (map_sections_to_segments): Correct test for start of
- writable section in the same page as end of read-only section.
-
-2002-09-27 Matt Thomas <matt@3am-software.com>
-
- * elf32-vax.c (elf_vax_check_relocs): Remove unused
- local_got_refcounts usage. Remove allocation of got slot.
- (elf_vax_gc_sweep_hook): Remove unused local_got_refcounts usage.
- Remove de-allocation of got slot.
- (elf_vax_size_dynamic_section): Fix some indentation. Add hash
- traversal for elf_vax_instantiate_got_entries. Allow empty .got
- sections to be GC'ed.
- (elf_vax_instantiate_got_entries): New function.
- (elf_vax_relocate_section): Simplify R_VAX_GOT32 handling. Remove
- tests that are now handled by elf_vax_instantiate_got_entries.
- Assert GOT entry falls within .got section size. Remove redundant
- comparisions. Fix comments.
-
-2002-09-27 Jakub Jelinek <jakub@redhat.com>
-
- * reloc.c: Add x86-64 TLS relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
- * elf64-x86-64.c (x86_64_elf_howto): Fix size fields for 32-bit
- relocs. Add TLS relocs.
- (x86_64_reloc_map): Add TLS relocs.
- (elf64_x86_64_info_to_howto): Adjust for added TLS relocs.
- (struct elf64_x86_64_link_hash_entry): Add tls_type field.
- (GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE): Define.
- (elf64_x86_64_hash_entry): Define.
- (struct elf64_x86_64_obj_tdata): New.
- (elf64_x86_64_tdata, elf64_x86_64_local_got_tls_type): Define.
- (struct elf64_x86_64_link_hash_table): Add tls_ld_got.
- (link_hash_newfunc): Initialize tls_type.
- (elf64_x86_64_link_hash_table_create): Initialize tls_ld_got.
- (elf64_x86_64_copy_indirect_symbol): Swap tls_type if necessary.
- (elf64_x86_64_mkobject): New.
- (elf64_x86_64_elf_object_p): Allocate struct elf64_x86_64_obj_tdata.
- (elf64_x86_64_tls_transition): New.
- (elf64_x86_64_check_relocs): Add r_type variable and use it.
- Handle TLS relocs.
- (elf64_x86_64_gc_sweep_hook): Handle TLS relocs.
- (allocate_dynrelocs): Allocate GOT space for TLS relocs.
- (elf64_x86_64_size_dynamic_sections): Likewise.
- (dtpoff_base, tpoff): New.
- (elf64_x86_64_relocate_section): Handle TLS relocs.
- (elf64_x86_64_finish_dynamic_symbol): Only handle non-TLS GOT
- entries.
- (bfd_elf64_mkobject): Define.
-
- * elf32-i386.c (elf_i386_check_relocs) [R_386_TLS_LE]: Set
- DF_STATIC_TLS if shared.
-
-2002-09-26 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (_bfd_mips_elf_fake_sections): Don't emit unneeded
- empty relocation sections.
-
-2002-09-26 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_build_one_stub): Don't build glink stubs here.
- (ppc64_elf_build_stubs): Build them here instead.
-
-2002-09-24 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE
- addend into r_addend, not *r_offset.
- (elf32_sparc_finish_dynamic_symbol): Likewise.
- * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at
- R_SPARC_RELATIVE's r_offset.
-
-2002-09-23 Nathan Tallent <eraxxon@alumni.rice.edu>
-
- * dwarf2.c (decode_line_info): Update to correctly decode
- the (non-standard DWARF2) out-of-order address sequences
- generated by the Intel C++ 6.0 compiler for ia64-Linux.
-
-2002-09-23 Mark Elbrecht <snowball3@softhome.net>
-
- * config.bfd: For DJGPP targets, match with any cpu and any machine.
-
-2002-09-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
- for discarded FDEs. Remove redundant assignment.
- * elflink.h (elf_bfd_discard_info): Save edited relocs.
-
-2002-09-22 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Don't merge
- the relocation count between different .reloc sections.
-
-2002-09-21 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Allow ".sbss.*" and
- ".sdata.*" for R_PPC_SDAREL16, ".sbss2*" and ".sdata2*" for
- R_PPC_EMB_SDA2REL. Similarly for R_PPC_EMB_SDA21 and
- R_PPC_EMB_RELSDA.
-
- * elfcode.h (elf_slurp_reloc_table_from_section): Make "symcount"
- unsigned. Move "symcount" assignment out of loop.
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
- * configure: Regenerate.
- * po/SRC-POTFILES.in: Regnerate.
-
-2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu>
-
- * dwarf2.c (_bfd_dwarf2_find_nearest_line): If address length is
- zero, set it to 8 for (non-standard) 64-bit DWARF2 formats
- (e.g. IRIX64).
-
-2002-09-19 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Clear .got word
- even if generating R_PPC_RELATIVE reloc.
- (ppc_elf_relocate_section): Make sure relocation is performed
- if skip == -2. Clear memory at r_offset when creating dynamic
- relocation.
-
-2002-09-19 Jakub Jelinek <jakub@redhat.com>
-
- * reloc.c (BFD_RELOC_386_TLS_TPOFF, BFD_RELOC_386_TLS_IE,
- BFD_RELOC_386_TLS_GOTIE): Add.
- * bfd-in2.h, libbfd.h: Rebuilt.
- * elf32-i386.c (elf_howto_table): Add R_386_TLS_TPOFF, R_386_TLS_IE
- and R_386_TLS_GOTIE.
- (elf_i386_reloc_type_lookup): Handle it.
- (struct elf_i386_link_hash_entry): Change tls_type type to unsigned
- char instead of enum, change GOT_* into defines.
- (GOT_TLS_IE_POS, GOT_TLS_IE_NEG, GOT_TLS_IE_BOTH): Define.
- (elf_i386_tls_transition): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
- (elf_i386_check_relocs): Likewise. Avoid crash if local symbol is
- accessed both as normal and TLS symbol. Move R_386_TLS_LDM and
- R_386_PLT32 cases so that R_386_TLS_IE can fall through.
- Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
- (elf_i386_gc_sweep_hook): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
- Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
- (allocate_dynrelocs): Allocate 2 .got and 2 .rel.got entries if
- tls_type is GOT_TLS_IE_BOTH.
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
- Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
- (elf_i386_finish_dynamic_symbol): Use tls_type & GOT_TLS_IE to catch
- all 4 GOT_TLS_* TLS types.
-
-2002-09-19 Nick Clifton <nickc@redhat.com>
-
- * elflink.h (elf_fix_symbol_flags): When examining weak symbols,
- follow indirect links.
-
-2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu>
-
- * ecoffswap.h (ecoff_swap_pdr_in) <isym, iline>: Update to
- correctly sign-extend 32-bit ECOFF null values (0xffffffff, -1)
- on 64 bit machines.
- (ecoff_swap_sym_in) <iss>: Likewise.
- * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Fix error reading
- ECOFF information: 'ioptMax' refers to the actual *size*
- of the optimization symtab, not the number of entries.
-
-2002-09-19 Daniel Jacobowitz <drow@mvista.com>
-
- * elf32-arm.h (elf32_arm_adjust_dynamic_symbol): Update
- ELF_LINK_HASH_NEEDS_PLT logic.
-
-2002-09-18 Daniel Jacobowitz <drow@mvista.com>
-
- * elfcode.h (elf_slurp_reloc_table_from_section): Check
- correct relocation count.
-
-2002-09-17 Daniel Jacobowitz <drow@mvista.com>
-
- * bfd-in.h (bfd_get_dynamic_symcount): Define.
- * bfd.c (struct _bfd): Add dynsymcount.
- * bfd-in2.h: Regenerated.
- * elf.c (_bfd_elf_canonicalize_dynamic_symtab): Set
- abfd->dynsymcount.
- * elfcode.h (elf_slurp_reloc_table_from_section): Check
- for overflow.
-
-2002-09-17 Stan Cox <scox@redhat.com>
-
- * elf64-mips.c (mips_elf64_be_swap_reloca_out): Handle type2 and type3.
- (mips_elf64_final_gp): Don't make up gp value.
- * elfn32-mips.c (mips_elf_final_gp): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_final_link): Always create
- .MIPS.options/.options section.
-
-2002-09-17 David O'Brien <obrien@FreeBSD.org>
-
- * elf32-i386-fbsd.c: Always label using the EI_OSABI method.
- It is benign for FreeBSD < 4.1. Minor reformatting.
- * elf64-alpha-fbsd.c: Likewise.
-
-2002-09-17 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-i386.c (elf_i386_relocate_section) [R_386_TLS_TPOFF32]: Negate
- addend.
-
-2002-09-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-alpha.c (alpha_elf_size_info): Make static.
-
-2002-09-17 Svein E. Seldal <Svein.Seldal@solidas.com>
-
- * coff-tic4x.c: Add function declarations and ATTRIBUTE_UNUSED.
- * cpu-tic4x.c: Ditto.
-
-2002-09-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf64-mips.c (define elf_backend_ignore_discarded_relocs): Remove
- duplicate define.
-
-2002-09-16 Bruno Haible <bruno@clisp.org>
-
- * elf32-i386.c: Don't defined ELF_ARCH etc. if this file is included
- by a target variant implementation.
- * elf64-alpha.c: Likewise.
- * elf32-i386-fbsd.c: New file.
- * elf64-alpha-fbsd.c: New file.
- * targets.c: Support bfd_elf32_i386_freebsd_vec and
- bfd_elf64_alpha_freebsd_vec.
- * configure.in: Accept the vectors bfd_elf32_i386_freebsd_vec,
- bfd_elf64_alpha_freebsd_vec.
- * Makefile.am (BFD32_BACKENDS): Add elf32-i386-fbsd.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-i386-fbsd.c.
- (BFD64_BACKENDS): Add elf64-alpha-fbsd.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-alpha-fbsd.c.
- (elf32-i386-fbsd.lo, elf64-alpha-fbsd.lo): Add dependencies.
- * config.bfd: For FreeBSD targets, set targ_defvec to a FreeBSD
- specific targets. Define OLD_FREEBSD_ABI_LABEL if appropriate.
-
-2002-09-12 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-i386.c (dtpoff_base, tpoff): Don't crash if tls_segment is
- NULL.
- (elf_i386_relocate_section): Return false after printing error about
- unresolvable relocation.
-
-2002-09-12 Nick Clifton <nickc@redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Fix handling of
- R_ARM_THM_PC11.
-
-2002-09-11 Jeffrey Law <law@redhat.com>
-
- * elf32-h8300.c (elf32_h8_relax_section): Fix typo.
-
-2002-09-11 Andrew Haley <aph@cambridge.redhat.com>
-
- * elf.c (_bfd_elf_find_nearest_line): Check functionname_ptr and
- line_ptr before deciding we've found a symbol.
-
-2002-09-11 Nick Clifton <nickc@redhat.com>
-
- * po/da.po: New Danish translation file.
- * configure.in (LINGUAS): Add 'da'.
- * configure: Regenerate.
-
-2002-09-10 Michael Snyder <msnyder@redhat.com>
-
- * irix-core.c (do_sections, do_sections64): New functions.
- (irix_core_core_file_p): Call new functions do_sections,
- do_sections64, depending on corefile (32-bit or 64-bit).
-
-2002-09-09 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_relax_section): Handle PCREL21M
- and PCREL21F like PCREL21B.
-
-2002-09-04 Kevin Buettner <kevinb@redhat.com>
-
- * config.bfd (mips*-*-irix6*): Add new ABI vectors. Make n32 default
- vector.
-
-2002-09-02 Nick Clifton <nickc@redhat.com>
-
- * elf32-v850.c (v850_elf_final_link_relocate): Use helpful
- names instead of cryptically overloaded bfd_reloc error
- codes.
- (v850_elf_relocate_section): Likewise.
- (v850_elf_relax_section): Replace caching of external symbols
- with caching of internal symbols obtained from calling
- bfd_elf_get_elf_syms().
- Fixup problems with freeing cached allocated memory blocks.
-
-2002-09-02 Alan Modra <amodra@bigpond.net.au>
-
- * cpu-pj.c (scan_mach, compatible, arch_info_struct): Remove.
- (bfd_pj_arch): Use bfd_default_scan.
- * cpu-v850.c (scan): Remove.
- (N): Use bfd_default_scan.
- * cpu-z8k.c (scan_mach): Remove.
- (arch_info_struct, bfd_z8k_arch): Reorganize so that the default is
- first. Use bfd_default_scan.
-
- * ecoff.c (_bfd_ecoff_set_arch_mach_hook): Don't use hard-coded
- bfd_mach constants.
- (ecoff_get_magic): Likewise.
- * elf32-v850.c (v850_elf_object_p): Likewise.
- (v850_elf_final_write_processing): Likewise.
- * mipsbsd.c (MY(set_arch_mach)): Likewise.
- (MY(write_object_contents)): Likewise.
- * coff64-rs6000.c (xcoff64_write_object_contents): Likewise.
- * coffcode.h (coff_write_object_contents): Likewise.
- (coff_set_arch_mach_hook): Add comment describing machine == 0.
- Remove unnecessary "machine" assignments.
- (coff_write_relocs): Test for the absolute section sym by testing
- section and flags.
-
- * aoutx.h (NAME(aout,machine_type)): Recognize bfd_mach_i386_i386
- and bfd_mach_i386_i386_intel_syntax.
- * pdp11.c (NAME(aout,machine_type)): Likewise.
-
-2002-08-30 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * bfd-in.h (align_power): Cast constants to bfd_vma type.
- * bfd-in2.h (align_power): Likewise.
-
-2002-08-30 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
-
- * cpu-avr.c (compatible): Don't use hard-coded mach constants.
- * cpu-powerpc.c (powerpc_compatible): Likewise.
- * cpu-rs6000.c (rs6000_compatible): Likewise.
-
-2002-08-28 Catherine Moore <clm@redhat.com>
-
- * elf32-v850.c (v850_elf_reloc_map): Add new relocs.
- (v850-elf-reloc): Don't resolve pc relative relocs.
- (v850_elf_ignore_reloc): New routine.
- (v850_elf_final_link_relocate): Handle new relocs.
- (v850_elf_relax_delete_bytes ): New routine.
- (v850_elf_relax_section): New routine.
- (bfd_elf32_bfd_relax_section): Define.
- (HOWTO): New entries for new relocs.
- * reloc.c (BFD_RELOC_V850_LONGCALL): New reloc.
- (BFD_RELOC_V850_LONGJUMP): New reloc.
- (BFD_RELOC_V850_ALIGN): New reloc.
- * archures.c: Remove redundant v850ea architecture.
- * cpu-v850.c: Remove redundant v850ea support.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerated.
-
-2002-08-28 Svein E. Seldal <Svein.Seldal@solidas.com>
-
- * config.bfd: Add tic4x-*-*coff* and c4x-*-*coff* target.
- * configure.in: Add tic4x_coff vector files.
- * configure: Regenerate.
- * Makefile.am: Add tic4x target.
- * Makefile.in: Regenerate.
-
-2002-08-27 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
-
- * archures.c: Add the BFD arch type tic4x.
- * bfd-in.h: Add BFD_IN_MEMORY flag.
- * coff-tic4x.c: New file.
- * coffswap.h (coff_swap_sym_out): Add preadjuster.
- * cpu-tic4x.c: New file.
- * targets.c: Added tic4x- in list of xvecs.
- * ticoff.h: New file.
- * bfd-in2.h: Regenerate.
-
-2002-08-27 Adam Nemet <anemet@lnxw.com>
-
- * elf32-arm.h (elf32_arm_finish_dynamic_sections): Set the last
- bit of DT_INIT and DT_FINI for Thumb functions.
-
-2002-08-26 Alan Modra <amodra@bigpond.net.au>
-
- * coffcode.h (coff_set_arch_mach_hook): Handle W65MAGIC.
-
-2002-08-26 Alan Modra <amodra@bigpond.net.au>
-
- * aoutx.h (NAME(aout,reloc_type_lookup)): Handle BFD_RELOC_8.
-
-2002-08-24 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf32-sh.c (sh_elf_copy_indirect_symbol): New.
- (create_got_section, allocate_dynrelocs, readonly_dynrelocs):
- Likewise.
- (struct elf_sh_pcrel_relocs_copied): Removed.
- (struct elf_sh_dyn_relocs): New.
- (struct elf_sh_link_hash_entry): Replace pcrel_relocs_copied
- field with dyn_relocs.
- (struct elf_sh_link_hash_table): Add short-cuts to get dynamic
- sections and sym_sec.
- (sh_elf_link_hash_newfunc): Clear dyn_relocs.
- (sh_elf_link_hash_table_create): Clear shorts-cuts and sym_sec.
- (sh_elf_create_dynamic_sections): Use create_got_section instead
- of _bfd_elf_create_got_section.
- (sh_elf_check_relocs): Likewise.
- (sh_elf_create_dynamic_sections): Use short-cuts to the dynamic
- sections.
- (sh_elf_adjust_dynamic_symbol, sh_elf_size_dynamic_sections,
- sh_elf_relocate_section, sh_elf_check_relocs,
- sh_elf_finish_dynamic_symbol, sh_elf_finish_dynamic_sections):
- Likewise.
- (sh_elf_adjust_dynamic_symbol): Handle nocopyreloc. Keep the
- dynamic relocations and avoiding the copy relocation when we
- didn't find any dynamic relocations in the section which has
- contents or is read-only.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
- (sh_elf_size_dynamic_sections): Don't reset the size of
- .rela.got section even if dynamic_sections_created flag is off.
- Don't use sh_elf_discard_copies. Scan all input bfd and use
- allocate_dynrelocs. Call readonly_dynrelocs to determine
- whether we need DT_TEXTREL.
- (sh_elf_adjust_dynamic_symbol): Use plt.refcount to determine
- whether the symbol was never referred to.
- (sh_elf_relocate_section): Use WILL_CALL_FINISH_DYNAMIC_SYMBOL.
- (sh_elf_gc_sweep_hook): Fill with the real sweep function.
- (sh_elf_check_relocs): Call create_got_section if the short-cut
- to .got is null. Increment reference counters only instead of
- allocating space on dynamic sections here. Don't conditionalize
- uninitialized got.offset value when marking the symbol as a
- global offset table entry. Keep relocations for symbols satisfied
- by a dynamic library to avoid copy relocations for the symbol.
- Set dynobj field of an elf hash table if needed.
- (sh_elf_finish_dynamic_sections): Handle null section pointer
- correctly.
- (elf_backend_copy_indirect_symbol): Defined.
- (elf_backend_can_refcount): Defined.
-
-2002-08-23 Nick Clifton <nickc@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Undo
- previous change. Add comment explaining why.
-
-2002-08-23 Stephen Clarke <stephen.clarke@superh.com>
-
- * elf32-sh.c (elf_sh_plt0_entry_be, elf_sh_plt0_entry_le): Copy
- contents of .got.plt[2] to tr0, not address of .got.plt.
- (sh_elf_finish_dynamic_symbol): Do not apply GOT_BIAS when
- patching absolute plt entry. For shmedia plt entry, set bottom bit
- of branch to plt0 as this is a branch to an shmedia instruction.
- * elf64-sh64.c (elf_sh64_plt0_entry_be, elf_sh64_plt0_entry_le):
- Copy contents of .got.plt[2] to tr0, not address of .got.plt.
- (elf_sh64_plt_entry_be, elf_sh64_plt_entry_le): Use ptrel to
- branch to plt0.
- (sh64_elf64_finish_dynamic_symbol): Do not apply GOT_BIAS when
- patching absolute plt entry. For shmedia plt entry, branch to
- plt0 is now ptrel, so use relative offset. Set bottom bit of
- branch target as it is a branch to an shmedia instruction.
-
-2002-08-23 Stephen Clarke <stephen.clarke@superh.com>,
- Richard Shann <richard.shann@superh.com>
-
- * elf32-sh.c (sh_elf_finish_dynamic_sections): Set LSB of DT_INIT
- value if .init is an SHmedia function. Similarly for DT_FINI.
- * elf64-sh64.c (sh64_elf64_finish_dynamic_sections): Likewise.
-
-2002-08-23 Stephen Clarke <stephen.clarke@superh.com>
-
- * elf32-sh.c (sh_elf_size_dynamic_sections): Zero initialize
- dynamic section.
- * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
-
-2002-08-22 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Use a simple
- byte read when reading the return address register column.
-
-2002-08-22 Nick Clifton <nickc@redhat.com>
-
- * config.bfd: Add powepc64-*-*bsd* target.
-
-2002-08-22 Graeme Peterson <gp@qnx.com>
-
- * Makefile.am: Add entries for elf32-shqnx.c
- * Makefile.in: Regenerate.
- * config.bfd: Add support sh-*-nto* target.
- * configure.in: Add support for bfd_elf32_sh{l}qnx_vec.
- * configure: Regenerate.
- * elf32-qnx.h: Changed typo "elf_i386qnx_*" to "elf_qnx_*" .
- * elf32-sh.c: Do not include elf32-target.h if
- ELF32_SH_C_INCLUDED is defined.
- * elf32-shqnx.c: New file: Support for QNX.
- * targets.c: Add bfd_elf32_sh{l}qnx_vec.
-
-2002-08-22 Nick Clifton <nickc@redhat.com>
-
- * po/tr.po: Updated Turkish translation.
-
- * syms.c (_bfd_generic_read_minisymbols): Set bfd_error if the
- symbols are not read.
-
-2002-08-22 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-m68hc11.c: Formatting fixes.
- (elf32_m68hc11_gc_mark_hook): Correct params. Remove unnecessary test.
- * elf32-m68hc12.c: Formatting fixes.
- (elf32_m68hc11_gc_mark_hook): Correct params. Remove unnecessary test.
-
-2002-08-22 Alan Modra <amodra@bigpond.net.au>
-
- * coff-rs6000.c (rs6000coff_vec <object_flags>): Add SEC_CODE and
- SEC_DATA.
- (pmac_xcoff_vec): Likewise.
- * coff64-rs6000.c (rs6000coff64_vec): Likewise.
- (aix5coff64_vec): Likewise.
-
-2002-08-22 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_backend_data): Add struct elf_backend_data
- param to elf_backend_copy_indirect_symbol.
- (_bfd_elf_link_hash_copy_indirect): Likewise.
- * elflink.h (elf_add_default_symbol, elf_fix_symbol_flags): Adjust
- calls to copy_indirect_symbol.
- * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
- * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
- * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
- * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise.
- * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_copy_indirect_symbol): Likewise.
- * elf.c (_bfd_elf_link_hash_copy_indirect): Likewise. Properly
- test refcounts for "used" values.
-
-2002-08-21 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Add PARAMS to
- argument declaration.
-
-2002-08-19 Elena Zannoni <ezannoni@redhat.com>
-
- * archures.c (bfd_mach_ppc_e500): Added.
- * bfd-in2.h: Rebuilt.
- * cpu-powerpc.c (bfd_powerpc_archs): Added e500.
-
-2002-08-19 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-m68hc12.c (elf_backend_can_gc_sections): False.
-
-2002-08-17 Andrew Cagney <ac131313@redhat.com>
-
- * elf.c (bfd_elf_get_elf_syms): Change type of `esym' to
- `bfd_byte'.
-
-2002-08-17 Stan Cox <scox@redhat.com>
-
- * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Use the
- IRIX 6 segment layout for NEWABI.
-
-2002-08-16 Stephen Clarke <stephen.clarke@superh.com>
-
- * elf32-sh.c (sh_elf_gc_mark_hook): For sh64, skip indirect
- symbols when looking for section referred to by a relocation.
- * elf64-sh.c (sh_elf64_gc_mark_hook): Likewise.
-
-2002-08-15 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i370.c: Move reloc enum to include/elf/i370.h.
-
-2002-08-15 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Add
- missing check for whether the symbol is referenced by DSO before
- unexporting it as an unneeded dynamic symbol.
-
-2002-08-14 H.J. Lu <hjl@gnu.org>
-
- * libbfd.h: Regenerate.
-
-2002-08-14 H.J. Lu <hjl@gnu.org>
-
- * config.bfd: Always add 64bit vectors to 32bit Linux/mips.
-
-2002-08-14 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc11.c (m68hc11_relax_group): New to relax group of
- instructions.
- (m68hc11_direct_relax): New to define table of relaxable instructions.
- (find_relaxable_insn): New, find a relaxable insn.
- (compare_reloc): New to compare two relocs.
- (m68hc11_elf_relax_section): New, relax text sections.
- (m68hc11_elf_relax_delete_bytes): New, delete bytes and adjust branchs.
- (elf32_m68hc11_check_relocs): New function for GC support.
- (elf32_m68hc11_relocate_section): New function for GC support.
- (bfd_elf32_bfd_relax_section): Define to support linker relaxation.
- (elf_backend_check_relocs): Likewise.
- (elf_backend_relocate_section): Likewise.
-
-2002-08-13 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections): Don't count
- definitions in shared objects when checking symbol with
- undefined version.
-
-2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc11.c (elf32_m68hc11_gc_mark_hook): New for section GC.
- (elf32_m68hc11_gc_sweep_hook): Likewise.
- (elf_backend_gc_mark_hook): Define for GC section support.
- (elf_backend_gc_sweep_hook): Likewise.
- (elf_backend_can_gc_sections): Likewise.
-
- * elf32-m68hc12.c: Likewise.
-
-2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc11.c (_bfd_m68hc11_elf_print_private_bfd_data): New.
- (_bfd_m68hc11_elf_merge_private_bfd_data): New function.
- (_bfd_m68hc11_elf_set_private_flags): New function.
- Use them to set/check/print ELF flags specific to 68HC11.
-
- * elf32-m68hc12.c (_bfd_m68hc12_elf_print_private_bfd_data): New.
- (_bfd_m68hc12_elf_merge_private_bfd_data): New function.
- (_bfd_m68hc12_elf_set_private_flags): New function.
- Use them to set/check/print ELF flags specific to 68HC12.
-
-2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
-
- * elf32-m68hc11.c (elf_m68hc11_howto_table): Add the new relocs;
- fix masks for PC-rel relocs.
- (m68hc11_elf_ignore_reloc): New function.
-
- * elf32-m68hc12.c (m68hc12_elf_special_reloc): New to handle specific
- 68HC12 banked addressing relocs.
- (m68hc12_phys_addr): New to compute physical address of banked memory.
- (m68hc12_phys_page): Likewise for page.
- (m68hc12_addr_is_banked): New to see if address is in banked area.
- (elf_m68hc12_howto_table): Add new relocs and rename to xx12.
-
-2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
-
- * reloc.c (BFD_RELOC_M68HC11_RL_JUMP, BFD_RELOC_M68HC11_RL_GROUP,
- BFD_RELOC_M68HC11_LO16, BFD_RELOC_M68HC11_PAGE,
- BFD_RELOC_M68HC11_24): New relocs for 68HC11/68HC12.
- * bfd-in2.h: Regenerate.
-
-2002-08-12 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_add_default_symbol): Preserve section across
- elf_merge_symbol.
-
-2002-08-09 Graeme Peterson <gp@qnx.com>
-
- * Makefile.am: Add entries for elf32-ppcqnx.c, and add
- elf32-qnx.h dependency to elfarmqnx-nabi.c and elf32-i386qnx.c.
- * Makefile.in: Regenerate.
- * config.bfd: Add support for powerpc{le}-*-nto targets.
- * configure.in: Add support for bfd_elf32_powerpc{le}qnx_vec.
- * configure: Regenerate.
- * elf32-i386qnx.c: Moved backend functions into a QNX specific
- common file "elf32-qnx.h", and now include that file.
- * elf32-qnx.h: New file: QNX specific common elf backend.
- * elf32-ppc.c: Do not include elf32-target.h if
- ELF32_PPC_C_INCLUDED is defined.
- * elf32-ppcqnx.c: New file: Support for QNX.
- * elfarmqnx-nabi.c: Include elf32-qnx.h for qnx elf backend.
- * targets.c: Add bfd_elf32_powerpc{le}qnx_vec.
-
-2002-08-09 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
-
-2002-08-09 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (mips_elf_global_got_index): Avoid segfault if
- g->global_gotsym is NULL.
-
-2002-08-08 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_add_default_symbol): Don't warn if a definition
- overrides an indirect versioned symbol.
-
-2002-08-08 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Fill in proper addend
- for R_386_TLS_TPOFF32 relocs against symndx 0.
-
-2002-08-07 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Check symbol
- with undefined version if needed.
- (elf_link_assign_sym_version): Match a default symbol with a
- version without definition. No need to hide the default
- definition separately.
-
-2002-08-08 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_output_extsym): Don't output symbols from
- SEC_EXCLUDE sections.
-
- * aoutx.h (aout_link_write_symbols): Correct handling of warning syms.
-
-2002-08-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (edit_opd): Arrange to drop symbols for discarded .opd
- entries.
-
-2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Cast signedness
- mismatch.
-
-2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (ABI_64_P): Remove superfluous check.
-
-2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c (mips_reloc_map): Fix typo.
-
-2002-08-06 Alan Modra <amodra@bigpond.net.au>
-
- * xcofflink.c (xcoff_write_global_symbol): Set n_scnum for abs_section.
-
-2002-08-06 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_howto_raw): Zero all src_mask entries.
-
-2002-08-06 Alan Modra <amodra@bigpond.net.au>
-
- * libxcoff.h: Use PARAMS on function declarations.
- * coff-rs6000.c (xcoff_generate_rtinit): Simplify size calc.
- * coff64-rs6000.c (xcoff64_generate_rtinit): Likewise.
-
- * coff-rs6000.c: (xcoff_rtype2howto): Don't place reloc address in
- addend.
- * coff64-rs6000.c: (xcoff64_rtype2howto): Likewise.
-
-2002-08-06 Alan Modra <amodra@bigpond.net.au>
-
- * coff-rs6000.c: Formatting fixes.
- (xcoff_calculate_relocation): Use PARAMS in declaration.
- (xcoff_complain_overflow): Likewise.
- (xcoff_ppc_relocate_section): Use old-style function pointer call.
- (bfd_xcoff_backend_data): Remove useless comments.
- (rs6000coff_vec): Likewise.
- (bfd_pmac_xcoff_backend_data): Likewise.
- (pmac_xcoff_vec): Likewise.
-
- * coff64-rs6000.c: Formatting fixes.
- (xcoff64_calculate_relocation): Use PARAMS in declaration.
- (xcoff64_ppc_relocate_section): Use old-style function pointer call.
- (bfd_xcoff_backend_data): Remove useless comments.
- (rs6000coff64_vec): Likewise.
- (bfd_xcoff_aix5_backend_data): Likewise.
- (aix5coff64_vec): Likewise.
-
-2002-08-06 Alan Modra <amodra@bigpond.net.au>
-
- * coff-rs6000.c (xcoff_howto_table): Revert some of last change to
- mask entries. Use complain_overflow_dont for R_REF.
- (xcoff_reloc_type_ba): Revert last change.
- (xcoff_reloc_type_br): Likewise.
- (xcoff_reloc_type_crel): Likewise.
- (xcoff_ppc_relocate_section): Likewise.
- * coff64-rs6000.c (xcoff64_reloc_type_br): Likewise.
- (xcoff64_ppc_relocate_section): Likewise.
- (xcoff64_howto_table): Revert some of last change to mask entries.
- Use complain_overflow_dont for R_REF.
-
- * coff-rs6000.c (xcoff_howto_table): Fix src_mask entries. Make all
- relocs with bitsize == 16 have size = 1.
- (xcoff_reloc_type_ba): Correct src_mask and dst_mask adjustment.
- (xcoff_reloc_type_br): Likewise.
- (xcoff_reloc_type_crel): Likewise.
- (xcoff_ppc_relocate_section): Set up src_mask and dst_mask correctly.
- * coff64-rs6000.c (xcoff64_reloc_type_br): Correct src_mask and
- dst_mask adjustment.
- (xcoff64_ppc_relocate_section): Set up src_mask and dst_mask correctly.
- (xcoff64_howto_table): Fix src_mask entries. Make all relocs with
- bitsize == 16 have size = 1.
-
-2002-08-01 Denis Chertykov <denisc@overta.ru>
-
- * elf32-ip2k.c: Processor manufacturer changed to Ubicom.
- (struct misc): New field isymbuf. All free_* fields removed.
- (symbol_value): Pass in internal syms. No need to swap syms in.
- (ip2k_elf_relax_section): Use bfd_elf_get_elf_syms. Properly free
- possibly cached info.
- (tidyup_after_error): Removed.
- (ip2k_elf_relax_section_pass1): Don't use removed fields of struct
- misc. Use new field.
- (adjust_all_relocations): Use internal syms. No need to swap syms
- in and out.
- (add_page_insn): Don't use removed fields of struct misc.
-
-2002-08-01 Nick Clifton <nickc@redhat.com>
-
- * elf32-arm.h: Revert previous delta.
-
-2002-08-01 Nick Clifton <nickc@redhat.com>
-
- * configure.in (AM_INIT_AUTOMAKE): Bump version number.
- * configure: Regenerate.
-
-2002-07-31 H.J. Lu <hjl@gnu.org>
-
- * config.bfd: Add x86-64 vector to Linux/i386 if 64bit BFD is
- selected.
-
-2002-07-31 H.J. Lu <hjl@gnu.org>
-
- * config.bfd: Add n32 vectors to 32bit Linux/mips if 64bit BFD
- is selected.
-
-2002-07-31 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Swap tls_type
- if _bfd_elf_link_hash_copy_indirect will swap got.refcount.
-
-2002-07-31 Ian Dall <ian@sibyl.beware.dropbear.id.au>
-
- * cpu-ns32k.c (_bfd_ns32k_put_immdeiate, _bfd_ns32k_get_immediate):
- There is no 8 byte relocation type for this architecture.
- (do_ns32k_reloc): Use bfd_vma instead of native types.
- (bfd_ns32k_put_immediate, _bfd_ns32k_relocate_contents) put_data
- returns void.
- (_bfd_ns32k_put_displacement): Don't check for overflow. We can
- rely on generic code to do that.
- * aout-ns32k.c (howto_table): Add appropriate overflow detection
- to all table entries.
- (_bfd_ns32k_relocate_contents): put_data returns void.
- * ns32k.h: (_bfd_ns32k_put_displacement, _bfd_ns32k_put_immediate)
- (_bfd_do_ns32k_reloc_contents): Fix prototypes. put data functions
- return void.
-
-2002-07-31 Ian Dall <ian@sibyl.beware.dropbear.id.au>
-
- * aoutx.h (aout_link_check_ar_symbols): Whether to include an
- archive object is target dependant.
-
-2002-07-31 Adam Nemet <anemet@lnxw.com>
-
- * elf32-arm.h (ARM_PLT_ENTRY_SIZE): Rename PLT_ENTRY_SIZE.
- (THUMB_PLT_ENTRY_SIZE): New macro.
- (PLT_ENTRY_SIZE): Return the appropriate *_PLT_ENTRY_SIZE.
- (elf32_arm_plt0_entry): Rename PLT_ENTRY_SIZE to
- ARM_PLT_ENTRY_SIZE.
- (elf32_arm_plt_entry): Likewise.
- (elf_backend_plt_header_size): Likewise.
- (elf32_thumb_plt0_entry): New global.
- (elf32_arm_finish_dynamic_sections): Use it. Put Thumb entries
- into .plt.thumb.
- (elf32_thumb_plt_entry): New global.
- (elf32_arm_finish_dynamic_symbol): Use it. Use .thumb.plt for
- Thumb entries. Set the bottom bit of the corresponding GOT entry
- for a Thumb PLT entry.
- (struct elf32_arm_plt_entry_info): New structure.
- (struct elf32_arm_link_hash_entry, plt_info): New member of this
- type.
- (elf32_arm_link_hash_newfunc): Initialize new member.
- (elf32_arm_final_link_relocate, R_ARM_THM_PC22 case): Handle
- relocations against the PLT.
- (elf32_arm_check_relocs, case R_ARM_PLT32 case): Set
- first_rel_type if this is the first time we encounter the symbol.
- (elf32_arm_check_relocs, case R_ARM_THM_PC22 case): New case.
- Determine if relocation needs a PLT entry. Set first_rel_type if
- this is the first time we encounter the symbol
- (elf32_arm_adjust_dynamic_symbol): Create PLT entries for Thumb
- functions as well.
- (elf32_arm_size_dynamic_sections): Handle .plt.thumb like .plt.
- (elf32_arm_create_dynamic_sections): New function. Create the
- .plt.thumb section.
- (elf_backend_create_dynamic_sections): Call it.
-
-2002-07-31 Nick Clifton <nickc@redhat.com>
-
- * bfd.c (bfd_alt_mach_code): Rename parameter 'index' to
- 'alternative' in order to avoid shadowing global symbol of the
- same name.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * libcoff.h: Regenerate.
-
-2002-07-31 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * Makefile.am: Add n32 ABI support.
- * Makefile.in: Regenerate.
- * config.bfd: Add n32 vectors to mips64*-*-linux* targets. Treat 64
- bit vectors for mips*-*-linux targets as optional.
- * configure.in: Add n32 ABI vectors.
- * configure: Regenerate.
- * elf32-mips.c (mips_elf32_object_p): Reject n32 ABI files.
- * elfn32-mips.c: New file, n32 ABI support.
- * targets.c: Add n32 ABI vectors.
-
-2002-07-30 Graeme Peterson <gp@qnx.com>
-
- * elfarmqnx-nabi.c: New file: Support for QNX.
- * config.bfd: Add support for arm-*-nto target.
- * configure.in: Add support for bfd_elf32_{big|little}armqnx_vec.
- * configure: Regenerate.
- * Makefile.am: Add entries for elfarmqnx-nabi.c.
- * Makefile.in: Regenerate.
- * elf32-arm.h (ELF_MAXPAGESIZE): Do not define if already defined.
- Do not define global function if ELFARM_NABI_C_INCLUDED is defined.
- * elfarm-nabi.c: Do not include elf32-arm.h if
- ELFARM_NABI_C_INCLUDED is defined.
- * targets.c: Add bfd_elf32_{big|little}armqnx_vec.
-
-2002-07-30 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
-
-2002-07-30 Jakub Jelinek <jakub@redhat.com>
-
- * elf.c (elf_fake_sections): Fix up .tbss sh_size and sh_type.
-
-2002-07-30 Alan Modra <amodra@bigpond.net.au>
-
- * aoutx.h (some_aout_object_p): Clean up tdata properly on error.
- * archive.c (bfd_generic_archive_p): Likewise.
- * coff-rs6000.c (_bfd_xcoff_archive_p): Likewise.
- (_bfd_xcoff_archive_p): Use bfd_scan_vma in place of strtol.
- * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
- (xcoff64_archive_p): Likewise.
- (xcoff64_openr_next_archived_file): Likewise.
- (xcoff64_archive_p): Clean up tdata properly on error.
- * coffgen.c (coff_real_object_p): Likewise.
- (coff_object_p): Release filehdr and opthdr.
- * ecoff.c (_bfd_ecoff_archive_p): Clean up tdata properly on error.
- * ieee.c (ieee_archive_p): Likewise.
- * ihex.c (ihex_object_p): Likewise.
- (ihex_mkobject): Always allocate tdata.
- * peicode.h (pe_ILF_object_p): Release bfd_alloc'd buffer on error.
- * srec.c (srec_mkobject): Always allocate tdata.
- (srec_object_p): Clean up tdata properly on error.
- (symbolsrec_object_p): Likewise.
- * versados.c (versados_object_p): Likewise.
- * vms-misc.c (_bfd_vms_get_record): Use bfd_malloc instead of malloc,
- and bfd_realloc instead of realloc.
- (add_new_contents): Use bfd_alloc instead of bfd_malloc for sections.
- * vms.c (vms_initialize): Always allocate tdata. Use bfd_alloc in
- place of bfd_malloc, simplifying error freeing. Free hash table too.
- (vms_object_p): Clean up tdata on error.
- (vms_mkobject): Don't complain on stderr if vms_initialize fails.
- (vms_close_and_cleanup): Adjust for bfd_alloc use.
-
-2002-07-30 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-ia64.c (elfNN_ia64_final_write_processing): Set e_flags.
-
-2002-07-26 Chris Demetriou <cgd@broadcom.com>
-
- * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Merge ASE
- flags into resulting BFD.
-
-2002-07-26 Alan Modra <amodra@bigpond.net.au>
-
- From John Reiser <jreiser@BitWagon.com>
- * elf32-i386.c (elf_i386_link_hash_table_create): Clear
- tls_ldm_got.refcount.
-
-2002-07-25 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf64-mips.c: Update TODO comment.
- (mips_elf64_higher_reloc,mips_elf64_highest_reloc,
- mips_elf64_gprel16_reloca): Remove prototypes.
- (mips16_jump_reloc,mips16_gprel_reloc): Add functions.
- (UNUSED_RELOC): Replace by EMPTY_RELOC.
- (mips_elf64_howto_table_rel): Use special R_MIPS_HI16 handling. Remove
- wrong comments. Remove disfunctional support of R_MIPS_HIGHER and
- R_MIPS_HIGHEST.
- (mips_elf64_howto_table_rela): Fix handling of R_MIPS_GPREL16 and
- R_MIPS_GOT16. Remove wrong comments.
- (elf_mips16_jump_howto,elf_mips16_gprel_howto,
- elf_mips_gnu_vtinherit_howto,elf_mips_gnu_vtentry_howto): New, code
- from elf32-mips.c.
- (mips_elf64_hi16_reloc): Fix formatting.
- (mips_elf64_higher_reloc,mips_elf64_highest_reloc): Remove.
- (mips_elf64_got16_reloc): Fix formatting. Remove superfluous code.
- Better comment. Fall back to R_MIPS_GOT_DISP instead of abort().
- (mips_elf64_gprel16_reloc): Make static. Add check for
- partial_inplace.
- (mips_elf64_gprel16_reloca): Remove.
- (mips_elf64_literal_reloc): New function.
- (mips_elf64_gprel32_reloc): Fix formatting.
- (mips_elf64_shift6_reloc): Fix comment. Make static.
- (mips16_jump_reloc,mips16_gprel_reloc): New functions, code from
- elf32-mips.c.
- (elf_reloc_map,mips_reloc_map): New mapping table, similiar as in
- elf32-mips.c
- (bfd_elf64_bfd_reloc_type_lookup): Use the mapping table. Enable GNU
- specific relocations.
- (mips_elf64_rtype_to_howto): Enable GNU specific relocations.
- (mips_elf64_object_p): Invert logic to check for SGI-ish ABI.
- (ELF_MAXPAGESIZE): Add comment.
-
-2002-07-25 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
- * po/es.po: Updated Spanish translation.
- * po/fr.po: Updated French translation.
-
-2002-07-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (_bfd_elf32_link_record_local_dynamic_symbol): Define
- as elf_link_record_local_dynamic_symbol.
- (_bfd_elf64_link_record_local_dynamic_symbol): Likewise.
- (elf_link_record_local_dynamic_symbol): Declare. Now returns int.
- * elflink.h (elf_link_record_local_dynamic_symbol): Move to..
- * elflink.c: .. here. Use bfd_elf_get_elf_syms. Check whether an
- attempt is made to record a symbol in a discarded section, and
- return `2' in that case.
-
-2002-07-24 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
- * po/es.po: Updated Spanish translation.
-
-2002-07-23 Alan Modra <amodra@bigpond.net.au>
-
- * po/SRC-POTFILES.in: Regenerate.
-
- * elf-hppa.h (elf_hppa_relocate_section): If relocatable, return
- immediately. Remove code handling relocatable linking.
- * elf32-avr.c (elf32_avr_relocate_section): Likewise.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-fr30.c (elf32_frv_relocate_section): Likewise.
- * elf32-frv.c (elf32_frv_relocate_section): Likewise.
- * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf32-v850.c (v850_elf_relocate_section): Likewise.
- * elf32-vax.c (elf_vax_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf32-avr.c (elf_backend_rela_normal): Define.
- * elf32-cris.c: Likewise.
- * elf32-fr30.c: Likewise.
- * elf32-frv.c: Likewise.
- * elf32-h8300.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-ip2k.c: Likewise.
- * elf32-sparc.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf32-vax.c: Likewise.
- * elf64-hppa.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elf32-fr30.c (elf32_frv_relocate_section): Edit comment.
- * elf32-frv.c (elf32_frv_relocate_section): Likewise.
- * elf32-i860.c (elf32_i860_relocate_section): Likewise.
- * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
- * elf-m10200.c (USE_RELA): Don't define.
- * elf-m10300.c: Likewise.
- * elfarm-oabi.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf32-ip2k.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-vax.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * elfxx-ia64.c: Likewise.
- * elf32-avr.c (USE_REL): Don't undef.
- * elf32-ip2k.c: Likewise.
-
-2002-07-23 Nick Clifton <nickc@redhat.com>
-
- * elf-bfd.h (struct elf_backend_data): Add new bitfield
- 'want_p_paddr_set_to_zero'.
- * elfxx-target.h: Set default value for want_p_paddr_set_to_zero
- to false;
- * elfxx-ia64.c: Set want_p_paddr_set_zero for HPUX target.
- * elf.c (copy_private_bfd_data): Test want_p_paddr_set_zero.
-
-2002-07-23 Gabor Keresztfalvi <keresztg@mail.com>
-
- * nlmcode.h (nlm_swap_auxiliary_headers_out): Swapped the order of
- the MeSsAgEs and CoPyRiGhT tags to make >=NW4.x NLM loaders to
- show the Copyright string.
- Minor formatting tidy ups.
-
-2002-07-23 Nick Clifton <nickc@redhat.com>
-
- * po/fr.po: Updated French translation.
- * po/sv.po: Updated Swedish translation.
-
-2002-07-23 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd): Don't change internal symbols
- when outputting relocs.
-
-2002-07-20 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only insert
- DT_PLTGOT into the dynamic section if there is a PLT.
-
-2002-07-19 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (_bfd_mips_elf_discard_info): New function, code from
- elf32-mips.c.
- (_bfd_mips_elf_write_section): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_discard_info): New prototype.
- (_bfd_mips_elf_write_section): Likewise.
- * elf32-mips.c (elf32_mips_discard_info): Move to elfxx-mips.c.
- (elf32_mips_write_section): Likewise.
- * elf64-mips.c (_bfd_mips_elf_ignore_discarded_relocs): Use it.
- (_bfd_mips_elf_write_section): Likewise.
-
-2002-07-19 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-ia64.c: (elfNN_ia64_modify_segment_map): Properly scan
- PT_IA_64_UNWIND segments for a given section.
-
-2002-07-17 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am: Fix a typo.
- * Makefile.in: Regenerate.
-
-2002-07-15 Denis Chertykov <denisc@overta.ru>
- Frank Ch. Eigler <fche@redhat.com>
- Ben Elliston <bje@redhat.com>
- Alan Lehotsky <alehotsky@cygnus.com>
- John Healy <jhealy@redhat.com>
- Graham Stott <grahams@redhat.com>
- Jeff Johnston <jjohnstn@redhat.com>
-
- * Makefile.am: Add support for ip2k.
- * Makefile.in: Regenerate.
- * doc/Makefile.in: Regenerate.
- * archures.c: Add support for ip2k.
- * config.bfd: Add support for ip2k.
- * configure.in: Add support for ip2k.
- * configure: Regenerate.
- * reloc.c: Add support for ip2k.
- * targets.c: Add support for ip2k.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * cpu-ip2k.c: New file.
- * elf32-ip2k.c: New file.
-
-2002-07-17 Ian Rickards <irickard@arm.com>
-
- * dwarf2.c (concat_filename): If we can't establish the directory
- just return the filename.
-
-2002-07-16 Moritz Jodeit <moritz@jodeit.org>
-
- * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Correct order of memset args.
-
-2002-07-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h: Formatting fixes, tidy prototypes.
- (elf_link_assign_sym_version): Move common code out of loop.
-
-2002-07-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd): Don't call reloc_emitter when
- reloc section size is zero. Correct reloc output location.
-
-2002-07-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-hppa.h (elf_hppa_reloc_final_type): Use R_PARISC_PCREL16F as
- the final type for the e_fsel selector when generating PA2.0W code.
- (elf_hppa_relocate_insn): Provide support for PA2.0W 16-bit format 1
- relocations.
-
-2002-07-14 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_assign_sym_version): Hide the default
- definition if there is a hidden versioned definition.
-
-2002-07-12 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section): Drop nonsensical
- dynamic reference test in assertion when initializing GOT with
- static contents. Just assert that there are either no dynamic
- sections, the symbol is defined in the regular objects or that the
- symbol is undef weak. Tweak comment.
- (elf_cris_finish_dynamic_symbol): Emit .got reloc for a program
- only if the symbol isn't defined in the program and isn't undef
- weak.
- (elf_cris_adjust_dynamic_symbol): Simplify condition for getting
- rid of PLT entry: only do it if the symbol isn't defined in a DSO.
- When doing so, clear ELF_LINK_HASH_NEEDS_PLT. Tweak comments.
- (elf_cris_discard_excess_program_dynamics): Don't consider
- ELF_LINK_HASH_REF_DYNAMIC when omitting .got runtime relocs.
-
-2002-07-11 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_relocate_section): Don't complain about
- unresolved debugging relocs in dynamic applications.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
-
-2002-07-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ONES): Define.
- (ppc64_elf_howto_table): Use ONES here to avoid warnings. Fill in
- missing src_mask fields. Tweak R_PPC64_NONE, R_PPC64_COPY. Fill
- in missing dst_mask fields on R_PPC64_PLT32, R_PPC64_PLTREL32.
-
- * elf64-ppc.c (ppc64_elf_get_symbol_info): Delete.
- (ppc64_elf_set_private_flags): Delete.
- (ppc64_elf_section_from_shdr): Delete.
- (ppc64_elf_merge_private_bfd_data): Remove flag checking/merging code.
- (ppc64_elf_fake_sections): Delete.
- (bfd_elf64_bfd_set_private_flags): Don't define.
- (bfd_elf64_get_symbol_info): Likewise.
- (elf_backend_section_from_shdr): Likewise.
- (elf_backend_fake_sections): Likewise.
-
-2002-07-10 Marco Walther <Marco.Walther@sun.com>
-
- * elf.c: (assign_section_numbers) Set sh_entsize for .stab only
- when not already set.
- * elf64-sparc.c: (sparc64_elf_fake_sections): New function.
- (elf_backend_fake_sections): Define.
-
-2002-07-10 Alan Modra <amodra@bigpond.net.au>
-
- * merge.c (_bfd_merge_section): Remove redundant output_section check.
- Formatting.
- (_bfd_merge_sections): Don't set SEC_EXCLUDE on unused sections.
-
-2002-07-09 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section): Move sanity-check for
- NULL sym_hashes to just before use.
- <case R_CRIS_32_GOTREL>: In test for local symbol, accept also
- symbol with non-default visibility.
- <case R_CRIS_32_GOTREL, case R_CRIS_32_PLT_GOTREL>: Ditto.
- <case R_CRIS_8_PCREL, case R_CRIS_16_PCREL, case R_CRIS_32_PCREL>:
- Ditto.
- (cris_elf_gc_sweep_hook): Only decrease h->plt.refcount for
- symbol with non-default visibility.
- (cris_elf_check_relocs): At tests for local symbol before
- increasing h->plt.refcount, also check for non-default
- visibility. Ditto when checking for local symbol to eliminate
- pc-relative runtime relocs.
-
-2002-07-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c: Formatting.
- (IS_SOLARIS_PT_INTERP): Add p_paddr and p_memsz checks.
- (INCLUDE_SECTION_IN_SEGMENT): Remove IS_SOLARIS_PT_INTERP.
- (copy_private_bfd_data): Set p_vaddr on broken Solaris PT_INTERP
- segments.
-
-2002-07-07 Mark Mitchell <mark@codesourcery.com>
- Alan Modra <amodra@bigpond.net.au>
-
- * cofflink.c (_bfd_coff_final_link): On PE COFF systems, take into
- account the impact of relocation count overflow when computing
- section offsets.
- * coffcode.h (coff_write_relocs): Use obj_pe when deciding whether
- or not to apply the PE COFF reloc overflow handling. Fix a
- fencepost error in deciding whether or not to use that technique.
-
-2002-07-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_reloc_cookie): Remove locsym_shndx,
- change type of locsyms.
- (bfd_elf_get_elf_syms): Declare.
- * elf.c (bfd_elf_get_elf_syms): New function.
- (group_signature): Use bfd_elf_get_elf_syms.
- (bfd_section_from_r_symndx): Likewise.
- * elfcode.h (elf_slurp_symbol_table): Likewise.
- * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
- (elf_link_add_object_symbols): Likewise. Reorganise to increase
- locality of various data structures. Properly free internal relocs.
- (elf_bfd_final_link): Properly free internal relocs.
- (elf_link_check_versioned_symbol): Use bfd_elf_get_elf_syms.
- (elf_link_input_bfd): Likewise.
- (elf_gc_mark): Likewise. Properly free internal relocs.
- (elf_gc_sweep): Properly free internal relocs.
- (elf_reloc_symbol_deleted_p): No need to swap syms in.
- (elf_bfd_discard_info): Use bfd_elf_get_elf_syms. Properly free
- internal relocs.
- * elf-m10200.c (mn10200_elf_relax_section): Use bfd_elf_get_elf_syms.
- Properly free possibly cached info.
- (mn10200_elf_relax_delete_bytes): Remove symbol swapping code.
- (mn10200_elf_symbol_address_p): Pass in internal syms. Remove
- symbol swapping code.
- (mn10200_elf_get_relocated_section_contents): Use bfd_elf_get_elf_syms.
- Properly free possibly cached info.
- * elf-m10300.c (mn10300_elf_relax_section): As above for elf-m10200.c.
- (mn10300_elf_relax_delete_bytes): Likewise.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): As above for elf-m10200.c.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- * elf32-m32r.c (m32r_elf_relax_section): As above for elf-m10200.c.
- (m32r_elf_relax_delete_bytes): Likewise.
- (m32r_elf_get_relocated_section_contents): Likewise.
- * elf32-sh.c (sh_elf_reloc_loop): Free section contents using
- elf_section_data to determine whether cached.
- (sh_elf_relax_section): As above for elf-m10200.c.
- (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_get_relocated_section_contents): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relax_section): As above.
- * elf64-alpha.c (elf64_alpha_relax_section): As above. Also delay
- reading of local syms.
- * elf64-mmix.c (mmix_elf_relax_section): Likewise.
- * elf64-sh64.c (sh_elf64_get_relocated_section_contents): As above.
- * elfxx-ia64.c (elfNN_ia64_relax_section): As above.
- * elfxx-mips.c (_bfd_mips_elf_check_relocs): Properly free internal
- relocs.
- * elf32-arm.h (bfd_elf32_arm_process_before_allocation): Properly
- free internal relocs and section contents. Don't read symbols.
- * elf32-hppa.c (get_local_syms): Use bfd_elf_get_elf_syms.
- (elf32_hppa_size_stubs): Don't free local syms.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Delay
- reading of local syms. Use bfd_elf_get_elf_syms. Properly free
- possibly cached info.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
- * elf64-hppa.c (elf64_hppa_check_relocs): Use bfd_elf_get_elf_syms.
- * elf64-ppc.c (struct ppc_link_hash_table): Delete bfd_count and
- all_local_syms.
- (get_local_syms): Delete function.
- (edit_opd): Use bfd_elf_get_elf_syms. Free on error exit. Cache
- on exit.
- (ppc64_elf_size_stubs): Use bfd_elf_get_elf_syms. Free/cache on exit.
-
-2002-07-05 Jim Wilson <wilson@redhat.com>
-
- * syms.c (decode_section_type): New.
- (bfd_decode_symclass): Call decode_section_type.
-
-2002-07-04 Jakub Jelinek <jakub@redhat.com>
-
- * merge.c (_bfd_merged_section_offset): Avoid accessing byte before
- section content start.
- Reported by Michael Schumacher <mike@hightec-rt.com>.
-
-2002-07-04 Alan Modra <amodra@bigpond.net.au>
-
- * section.c (_bfd_strip_section_from_output): Remove unnecessary
- link order code. Don't actually remove the output section here;
- Just set a flag for the linker to do so.
- * elflink.c (_bfd_elf_link_renumber_dynsyms): Test for removed
- sections when setting up output section dynsyms.
-
-2002-07-04 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_add_object_symbols): Revert 1999-09-02 hpux
- fudge.
- * elf.c (bfd_section_from_shdr): Work around broken hpux shared
- libs here instead.
-
-2002-07-02 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf64-s390.c (create_got_section): Set .got section alignment to
- 8 bytes.
- (elf_s390_check_relocs): Set .rela.dyn section alignment to 8 bytes.
-
-2002-07-02 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_reloc_type_class): Fix comment grammar.
-
-2002-07-01 Matt Thomas <matt@3am-software.com>
-
- * elf32-vax.c (elf32_vax_print_private_bfd_data): Change EF_*
- to EF_VAX_*.
-
-2002-07-01 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (ABI_64_P): Fix comment.
- (MIPS_ELF_OPTIONS_SECTION_NAME,MIPS_ELF_STUB_SECTION_NAME): Use the
- new section names for N64 ABI.
- (mips_elf_output_extsym): No special _gp_disp handling for NewABI.
- (mips_elf_calculate_relocation): Code formatting.
- (mips_elf_create_dynamic_relocation): Likewise.
- (_bfd_mips_elf_fake_sections): IRIX6 needs this hack, too.
- (_bfd_mips_elf_size_dynamic_sections): Handle GOT_PAGE for any NewABI.
- (_bfd_mips_elf_relocate_section): No special handling for R_MIPS_64
- in any NewABI.
- (_bfd_mips_elf_finish_dynamic_symbol): No special _gp_disp handling
- for NewABI.
- (_bfd_mips_elf_modify_segment_map): Handle any N64 ABI.
- (_bfd_mips_elf_gc_sweep_hook): NewABI GOT relocs should be handled
- here, too.
-
-2002-07-01 Andreas Schwab <schwab@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Only convert
- R_X86_64_64 to R_X86_64_RELATIVE.
-
-2002-07-01 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * vaxbsd.c: New BFD backend for VAX BSD and Ultrix.
- * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add new backend.
- Run "make dep-am".
- * config.bfd (vax-*-bsd* | vax-*-ultrix*): Use vaxbsd_vec instead of
- host_aout_vec.
- * configure.in (vaxbsd_vec): Add.
- * targets.c (vaxbsd_vec): Add.
- * Makefile.in: Rebuild.
- * configure: Rebuild.
- * po/SRC-POTFILES.in: Rebuild.
-
-2002-07-01 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_gc_mark): Pass in the section whose relocs we are
- examining to gc_mark_hook, rather than the bfd.
- (elf_gc_sections): Adjust.
- * elf-bfd.h (struct elf_backend_data <gc_mark_hook>): Likewise.
- * elf-m10300.c (mn10300_elf_gc_mark_hook): Likewise.
- * elf32-arm.h (elf32_arm_gc_mark_hook): Likewise.
- * elf32-avr.c (elf32_avr_gc_mark_hook): Likewise.
- * elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
- * elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
- * elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
- * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
- * elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
- * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
- * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
- * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
- * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Likewise.
- * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
- * elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
- * elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
- * elf32-sparc.c (elf32_sparc_gc_mark_hook): Likewise.
- * elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
- * elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
- * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
- * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
- * elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
- * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_gc_mark_hook): Likewise.
- * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
- * elf32-frv.c (elf32_frv_gc_mark_hook): Likewise. Also remove
- redundant local sym tests.
- * elf64-ppc.c (struct ppc_link_hash_entry): Add is_entry.
- (link_hash_newfunc): Init is_entry.
- (ppc64_elf_copy_indirect_symbol): Copy is_entry.
- (ppc64_elf_link_hash_table_create): Init all_local_syms.
- (create_linkage_sections): Use bfd_make_section_anyway rather than
- bfd_make_section.
- (ppc64_elf_mark_entry_syms): New function.
- (ppc64_elf_check_relocs): Don't bother testing elf_bad_symtab. Set
- up opd entry to function section map.
- (ppc64_elf_gc_mark_hook): Special case opd section relocs, and
- relocs that reference the opd section.
- (edit_opd): New function.
- (ppc64_elf_size_dynamic_sections): Call get_local_syms and edit_opd.
- (ppc64_elf_setup_section_lists): Don't calculate htab->bfd_count here.
- (get_local_syms): Do so here. Exit if we already have local syms.
- Remove bogus comment imported from elf32-hppa.c. Don't attempt to
- read local syms on non-ELF input.
- (ppc64_elf_size_stubs): Call _bfd_elf64_link_read_relocs rather
- than duplicating it's function here. Adjust free of internal
- relocs to suit.
- (ppc64_elf_relocate_section): Adjust local syms in opd section.
- * elf64-ppc.h (ppc64_elf_mark_entry_syms): Declare.
- * elf32-hppa.c (elf32_hppa_size_stubs): Call
- _bfd_elf32_link_read_relocs rather than duplicating it's function
- here. Adjust free of internal relocs to suit.
-
-2002-07-01 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Certain relocations
- are not allowed in shared libs code, enforce -fPIC.
-
-2002-06-29 Hans-Peter Nilsson <hp@bitrange.com>
-
- * mmo.c (mmo_write_loc_chunk): Don't eliminate leading and
- trailing zero-sequences when there's previous left-over data.
-
-2002-06-27 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf64-hppa.c (elf64_hppa_reloc_type_class): New function.
- (elf64_hppa_finish_dynamic_sections): Check other_rel_sec, dlt_rel_sec
- and opd_rel_sec in order for starting rela section. Check _raw_size.
- (elf_backend_reloc_type_class): Define.
-
-2002-06-27 Kevin Buettner <kevinb@redhat.com>
-
- * dwarf2.c (decode_line_info): Handle older, non-standard, 64-bit
- DWARF2 formats.
-
-2002-06-27 Alan Modra <amodra@bigpond.net.au>
-
- * cpu-powerpc.c: Comment on ordering of arch_info.
- * elf32-ppc.c (ppc_elf_object_p): New function.
- (elf_backend_object_p): Define.
- * elf64-ppc.c (ppc64_elf_object_p): New function.
- (elf_backend_object_p): Define.
-
-2002-06-26 Jason Thorpe <thorpej@wasabisystems.com>
-
- * configure.in (vax-*-netbsd*): Set COREFILE to netbsd-core.lo.
- * configure: Regenerate.
-
-2002-06-25 Jason Eckhardt <jle@rice.edu>
-
- * dwarf2.c (decode_line_info): Check unit->addr_size
- to read in the proper number of prologue bytes.
-
-2002-06-25 Nick Clifton <nickc@cambridge.redhat.com>
-
- * config.bfd (powerpc-*-aix5*): Only create a selvecs for
- aix5coff64_vec if 64-bit bfd support has been enabled.
- (powerpc64-*-aix5*): Only define if 64-bit bfd support has
- been enabled.
-
- * targets.c (_bfd_target_vector[]): Only include
- aix5coff64_vec if 64-bit bfd support has been enabled.
-
-2002-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_add_stub): Replace strcpy/strncpy with memcpy.
- * elf32-hppa.c (hppa_add_stub): Likewise.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
- * elflink.h (elf_add_default_symbol): Fix comment typo.
- (elf_add_default_symbol): Replace strcpy and strncpy with memcpy.
- (elf_link_add_object_symbols): Likewise.
- (elf_link_assign_sym_version): Likewise.
- * hash.c (bfd_hash_lookup): Likewise.
- * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
- * section.c (bfd_get_unique_section_name): Likewise.
- * syms.c (_bfd_stab_section_find_nearest_line): Likewise.
- * elf.c (_bfd_elf_make_section_from_phdr): Likewise.
- (assign_section_numbers): Likewise.
- (_bfd_elfcore_make_pseudosection): Likewise.
- (elfcore_grok_lwpstatus): Likewise.
- (elfcore_grok_win32pstatus): Likewise.
- (elfcore_write_note): Constify input params. Use PTR instead of
- void *. Include terminating NUL in namesz. Correct padding.
- Support NULL "name" param. Use memcpy instead of strcpy.
- (elfcore_write_prpsinfo): Constify input params.
- (elfcore_write_prstatus): Likewise. Use PTR instead of void *.
- (elfcore_write_lwpstatus): Likewise.
- (elfcore_write_pstatus): Likewise.
- (elfcore_write_prfpreg): Likewise.
- (elfcore_write_prxfpreg): Likewise.
- * elf-bfd.h (elfcore_write_note): Update declaration.
- (elfcore_write_prpsinfo): Likewise.
- (elfcore_write_prstatus): Likewise.
- (elfcore_write_pstatus): Likewise.
- (elfcore_write_prfpreg): Likewise.
- (elfcore_write_prxfpreg): Likewise.
- (elfcore_write_lwpstatus): Likewise.
-
-2002-06-25 Jason Eckhardt <jle@rice.edu>
-
- * ecoff.c (ecoff_set_symbol_info): Set BSF_FUNCTION for
- symbols of type stProc and stStaticProc.
-
-2002-06-25 Nick Clifton <nickc@redhat.com>
-
- * ecoff.c: VArious formatting fixes.
-
-2002-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * coff-rs6000.c (xcoff_generate_rtinit): Fix typo.
-
-2002-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * aout-adobe.c: Don't compare against "true" or "false.
- * aout-target.h: Likewise.
- * aoutx.h: Likewise.
- * archive.c: Likewise.
- * bout.c: Likewise.
- * cache.c: Likewise.
- * coff-a29k.c: Likewise.
- * coff-alpha.c: Likewise.
- * coff-i386.c: Likewise.
- * coff-mips.c: Likewise.
- * coff-or32.c: Likewise.
- * coff64-rs6000.c: Likewise.
- * coffcode.h: Likewise.
- * coffgen.c: Likewise.
- * cpu-ns32k.c: Likewise.
- * ecoff.c: Likewise.
- * ecofflink.c: Likewise.
- * elf.c: Likewise.
- * elf32-arm.h: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-d30v.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elfcode.h: Likewise.
- * elfcore.h: Likewise.
- * elflink.h: Likewise.
- * elfxx-mips.c: Likewise.
- * i386os9k.c: Likewise.
- * ieee.c: Likewise.
- * libbfd.c: Likewise.
- * linker.c: Likewise.
- * mmo.c: Likewise.
- * nlm32-alpha.c: Likewise.
- * nlm32-i386.c: Likewise.
- * nlm32-ppc.c: Likewise.
- * nlm32-sparc.c: Likewise.
- * nlmcode.h: Likewise.
- * oasys.c: Likewise.
- * pdp11.c: Likewise.
- * peicode.h: Likewise.
- * reloc.c: Likewise.
- * som.c: Likewise.
- * srec.c: Likewise.
- * tekhex.c: Likewise.
- * vms.c: Likewise.
- * xcofflink.c: Likewise.
- * elf64-sparc.c: Edit comment to not use "== false".
-
- * aoutf1.h: Don't use "? true : false".
- * ecoff.c: Likewise.
- * format.c: Likewise.
- * ieee.c: Likewise.
- * linker.c: Likewise.
- * mmo.c: Likewise.
- * oasys.c: Likewise.
-
-2002-06-23 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_archive_symbols): For the default
- version, check references with only one `@' first.
-
-2002-06-23 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf64-hppa.c (elf64_hppa_mark_milli_and_exported_functions): New
- function.
- (allocate_global_data_dlt): Don't add millicode symbols to dynamic
- symbol table.
- (allocate_global_data_opd, allocate_dynrel_entries): Likewise.
- (elf64_hppa_size_dynamic_sections): Revise to use
- elf64_hppa_mark_milli_and_exported_functions.
- (elf64_hppa_finish_dynamic_symbol): Remove code to keep millicode
- symbols out of dynamic symbol table.
-
-2002-06-23 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * configure: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
- * elflink.h: Comment typo fixes.
-
-2002-06-23 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (elf_link_loaded_list): New structure.
- (elf_link_hash_table): Add "loaded".
- * elf.c (_bfd_elf_link_hash_table_init): Initialize "loaded".
- * elflink.h (elf_link_check_versioned_symbol): New function.
- (elf_link_output_extsym): Call elf_link_check_versioned_symbol.
-
-2002-06-19 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elflink.h (size_dynamic_sections): If the target does not
- support an ELF style hash table, return true, indicating that
- nothing needed to be done, rather than false, indicating that the
- section's size could not be computed.
-
-2002-06-18 Dave Brolley <brolley@redhat.com>
-
- From Catherine Moore, Michael Meissner, Dave Brolley:
- * po/SRC-POTFILES.in: Add cpu-frv.c and elf32-frv.c
- * targets.c: Support bfd_elf32_frv_vec.
- * reloc.c: Add FRV relocs.
- * configure.in: Add support for bfd-elf32-frv-vec.
- * config.bfd (targ_cpu): Add support for frv-*-elf.
- * archures.c: Add frv arch and machines.
- * Makefile.am (ALL_MACHINES): Add cpu-frv.lo.
- (ALL_MACHINES_CFILES): Add cpu-frv.c.
- (BFD32_BACKENDS): Add elf32-frv.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-frv.c
- (cpu-frv.lo): New target.
- (elf32-frv.lo): New target.
- * cpu-frv.c: New file.
- * elf32-frv.c: New file.
-
-2002-06-18 Jakub Jelinek <jakub@redhat.com>
-
- * elfcode.h (elf_object_p): Sanity check eh_shoff == 0 implies
- e_shnum == 0.
- Only read the first section header if e_shoff is non-zero.
- Don't consider e_shstrndx if there are no sections.
-
-2002-06-17 Tom Rix <trix@redhat.com>
-
- * elf32-d10v.c (elf_d10v_howto_table): Change R_D10V_10_PCREL_R,
- R_D10V_10_PCREL_L and R_D10V_18_PCREL to use
- complain_overflow_bitfield.
-
-2002-06-17 Alan Modra <amodra@bigpond.net.au>
-
- * opncls.c (bfd_openr): Remove redundant bfd_set_error.
- (bfd_fdopenr): Likewise.
- (bfd_openstreamr): Likewise.
- (bfd_openw): Likewise.
-
- * targets.c: Sort target vecs.
- (_bfd_target_vector): Add aix5coff64_vec, bfd_elf32_sh64_vec,
- bfd_elf32_sh64l_vec, bfd_elf32_sh64lnbsd_vec,
- bfd_elf32_sh64nbsd_vec, bfd_elf64_sh64_vec, bfd_elf64_sh64l_vec,
- bfd_elf64_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec.
- * configure.in: Sort target vecs. Add m88kmach3_vec.
- * configure: Regenerate.
-
-2002-06-16 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf64-mmix.c (bpo_reloc_request_sort_fn): Use member
- bpo_reloc_no to break sort order ties, not address of items.
-
-2002-06-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-hppa.h (elf_hppa_final_link): Fix formatting in comment.
- Skip excluded sections in determing __gp value.
- (elf_hppa_final_link_relocate): Use the symbol's address in
- R_PARISC_FPTR64 relocations that don't need an opd entry.
- * elf64-hppa.c (allocate_dynrel_entries): Simplify code.
- (elf64_hppa_finalize_dynreloc): Likewise.
- (elf64_hppa_size_dynamic_sections): Move comments and fix typo.
- (elf64_hppa_finish_dynamic_symbol): Break up assert.
-
-2002-06-14 Sergey Grigoriev <serge@leopold.Physik.Uni-Augsburg.DE>
-
- * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte
- alignment for .bss, .data and .text sections so that sse and sse2
- code will work.
- * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
-
-2002-06013 J"orn Rennecke <joern.rennecke@superh.com>
-
- config.bfd: Add support for sh[1234]l*-*-elf* | sh3el*-*-elf*,
- sh[1234]*-elf*.
-
-2002-06-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elflink.h (elf_bfd_final_link): Improve error handling for missing
- dynamic sections.
-
- * elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry
- for a symbol that has no output section.
- (allocate_dynrel_entries): Correct comment.
- (elf64_hppa_finalize_dynreloc): Likewise. Don't create an opd entry
- unless we want one.
- (elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL.
- (elf64_hppa_finalize_dlt): Likewise. Prevent segfault for symbols
- with no section. Remove unnecessary parentheses.
-
-2002-06-11 Tom Rix <trix@redhat.com>
-
- * coffcode.h (coff_compute_section_file_positions): Add data
- section to AIX loader alignment check.
-
- * coff-rs6000.c (_bfd_xcoff_mkobject): Set default text section
- alignment to 4 bytes.
- (_bfd_xcoff_copy_private_bfd_data): Use text and data alignment
- power accessor macro.
- (do_shared_object_padding): Remove invalid assertion.
-
-2002-06-10 Richard Sandiford <rsandifo@redhat.com>
-
- * section.c (_bfd_strip_section_from_output): Set SEC_EXCLUDE
- for removed output sections.
-
-2002-06-10 Geoffrey Keating <geoffk@redhat.com>
-
- * merge.c (merge_strings): Use htab_create_alloc with calloc, not
- htab_alloc.
- * elf-strtab.c (_bfd_elf_strtab_finalize): Likewise.
-
-2002-06-08 H.J. Lu <hjl@gnu.org>
-
- * elf.c (copy_private_bfd_data): Don't cast to bfd_size_type to
- work around a long long bug in gcc 2.96 on mips.
-
-2002-06-08 Jason Thorpe <thorpej@wasabisystems.com>
-
- * Makefile.am (BFD32_BACKENDS): Add vax1knetbsd.lo.
- (BFD32_BACKENDS_CFILES): Add vax1knetbsd.c.
- Regenerate dependency lists.
- * Makefile.in: Regenerate.
- * config.bfd (vax-*-netbsdelf*, vax-*-netbsdaout*): Add
- vax1knetbsd_vec to targ_selvecs.
- * configure.in: Add vax1knetbsd_vec.
- * configure: Regenerate.
- * targets.c (_bfd_target_vector): Add vax1knetbsd_vec.
- * vax1knetbsd.c: New file.
- * vaxnetbsd.c: Update copyright years.
- (TARGET_PAGE_SIZE): Set to 0x1000.
- (DEFAULT_MID): Set to M_VAX4K_NETBSD.
-
-2002-06-08 Matt Thomas <matt@3am-software.com>
-
- * libaout.h (enum machine_type): Add M_VAX4K_NETBSD.
-
-2002-06-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Make static.
-
-2002-06-08 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
-
- * armnetbsd.c: Replace CONST with const.
- * corefile.c: Likewise.
- * elf32-dlx.c: Likewise.
- * elf64-mips.c: Likewise.
- * mmo.c: Likewise.
- * ns32knetbsd.c: Likewise.
-
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Check the hash
- table is elf64-sparc.
-
-2002-06-08 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (_bfd_mips_elf_relocate_section): Simplify code.
- Fix RELA addends to get not shifted in the result. Don't do special
- handling of R_MIPS_64 for NewABI.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * aoutx.h (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
- (NAME(aout,slurp_reloc_table)): Likewise.
- * coff-mips.c (mips_relax_section): Use bfd_zalloc.
- * coff-rs6000.c (xcoff_write_armap_big): Use bfd_zmalloc.
- (xcoff_write_archive_contents_big): Likewise.
- (xcoff_generate_rtinit): Likewise.
- (xcoff_generate_rtinit): Likewise, and check error return.
- * coff64-rs6000.c (xcoff64_generate_rtinit): Likewise.
- * coffgen.c (coff_section_symbol): Use bfd_zalloc.
- (coff_get_normalized_symtab): Likewise.
- (coff_make_empty_symbol): Likewise.
- (bfd_coff_set_symbol_class): Likewise.
- * cofflink.c (coff_link_add_symbols): Likewise.
- * ecoff.c (_bfd_ecoff_make_empty_symbol): Likewise.
- * ecofflink.c (ecoff_write_shuffle): Use bfd_zmalloc.
- (bfd_ecoff_write_accumulated_debug): Likewise.
- * elf64-alpha.c (get_got_entry): Use bfd_zalloc.
- * i386linux.c (bfd_i386linux_size_dynamic_sections): Likewise.
- * i386lynx.c (NAME(lynx,slurp_reloc_table)): Use bfd_zmalloc.
- * ieee.c (do_with_relocs): Use bfd_zalloc.
- * m68klinux.c (bfd_m68klinux_size_dynamic_sections): Likewise.
- * pdp11.c (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
- (NAME(aout,slurp_reloc_table)): Likewise.
- (NAME(aout,squirt_out_relocs)): Don't memset when zalloc'd.
- * reloc16.c (bfd_coff_reloc16_relax_section): Use bfd_zmalloc.
- * som.c (som_build_and_write_symbol_table): Likewise.
- (som_slurp_string_table): Likewise.
- (som_slurp_symbol_table): Likewise.
- (som_bfd_ar_write_symbol_stuff): Likewise.
- * sparclinux.c (bfd_sparclinux_size_dynamic_sections): Use bfd_zalloc.
- * sunos.c (bfd_sunos_size_dynamic_sections): Likewise.
- * tekhex.c (find_chunk): Likewise. Get rid of unused "sname".
- * vms-gsd.c (_bfd_vms_slurp_gsd): Use bfd_zmalloc.
- * xcofflink.c (xcoff_link_add_symbols): Use bfd_zalloc/bfd_zmalloc.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct bfd_elf_section_data <group_name>): Replace with
- "group" union.
- (elf_group_name): Update.
- (elf_group_id): Define.
- (bfd_elf_set_group_contents): Declare.
- * elf.c (elf_fake_sections): Qualify use of elf_group_name.
- (set_group_contents): Rename to bfd_elf_set_group_contents. Remove
- ATTRIBUTE_UNUSED from failedptrarg. If elf_group_id is set, use
- that sym for the signature.
- (_bfd_elf_compute_section_file_positions): Don't call
- set_group_contents for "ld -r" case.
- (swap_out_syms): Use bfd_zalloc.
- * elflink.h (elf_link_add_archive_symbols): Likewise.
- (NAME(bfd_elf,size_dynamic_sections)): Likewise.
- (elf_bfd_final_link): Call bfd_elf_set_group_contents.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved
- relocs in opd for non-shared too.
-
-2002-06-06 Jeffrey Law <law@redhat.com>
-
- * elf32-h8300.c (elf32_h8_relax_section): Ignore uninteresting
- relocations.
-
-2002-06-06 Nick Clifton <nickc@cambridge.redhat.com>
-
- * merge.c: Include libiberty.h.
- * elf-strtab.c: Include libiberty.h.
-
-2002-06-06 Elias Athanasopoulos <eathan@otenet.gr>
-
- * peXXigen.c (pe_print_idata): Remove unused variable.
-
-2002-06-06 David Heine <dlheine@tensilica.com>
-
- * elf.c (assign_file_positions_for_segments): Remove unallocated
- sections from the section to segment mapping for PT_LOAD segments.
- Update comment about empty loadable segments.
-
-2002-06-06 Richard Sandiford <rsandifo@redhat.com>
-
- * stabs.c (_bfd_link_section_stabs): Check that the symbol offset
- is within the .stabstr section.
-
-2002-06-06 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_size_info <swap_symbol_in>): Function args
- are "const PTR", not "const PTR *".
- (bfd_elf32_swap_symbol_in): Likewise.
- (bfd_elf64_swap_symbol_in): Likewise.
- * elfcode.h (elf_swap_symbol_in): Change input args to const PTR.
- (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
- * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
- (elf_link_add_object_symbols): Likewise.
- (elf_link_record_local_dynamic_symbol): Likewise.
- (elf_link_input_bfd): Likewise.
- (elf_gc_mark): Likewise.
- (elf_reloc_symbol_deleted_p): Likewise.
- * elf-m10200.c (mn10200_elf_relax_section): Likewise.
- (mn10200_elf_relax_delete_bytes): Likewise.
- (mn10200_elf_symbol_address_p): Likewise.
- (mn10200_elf_get_relocated_section_contents): Likewise.
- * elf-m10300.c (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_delete_bytes): Likewise.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): Likewise.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- * elf32-hppa.c (get_local_syms): Likewise.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
- * elf32-sh.c (sh_elf_relax_section): Likewise.
- (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_get_relocated_section_contents): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
- * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
- * elf64-mmix.c (mmix_elf_relax_section): Likewise.
- * elf64-ppc.c (get_local_syms): Likewise.
- * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
-
-2002-06-05 J"orn Rennecke <joern.rennecke@superh.com>
-
- * config.bfd (sh64l*-*-elf*, shl*-*-elf*): New configurations.
-
-2002-06-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (group_signature): Swap in the whole symbol, and handle
- extracting section symbol names.
- (setup_group): Add comment.
- (set_group_contents): When called from objcopy or ld, arrange for
- section contents to be written. Write group member output section
- indices to allow objcopy to reorganize sections.
- (_bfd_elf_copy_private_section_data): Copy group info.
-
- * elf-bfd.h (struct elf_size_info): Add swap_symbol_in field.
- (bfd_elf32_swap_symbol_in): Update prototype.
- (bfd_elf64_swap_symbol_in): Likewise.
- * elfcode.h (elf_swap_symbol_in): Change input args to const PTR *.
- (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
- * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
- (elf_link_add_object_symbols): Likewise.
- (elf_link_record_local_dynamic_symbol): Likewise.
- (elf_link_input_bfd): Likewise.
- (elf_gc_mark): Likewise.
- (elf_reloc_symbol_deleted_p): Likewise.
- * elf-m10200.c (mn10200_elf_relax_section): Likewise.
- (mn10200_elf_relax_delete_bytes): Likewise.
- (mn10200_elf_symbol_address_p): Likewise.
- (mn10200_elf_get_relocated_section_contents): Likewise.
- * elf-m10300.c (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_delete_bytes): Likewise.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): Likewise.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- * elf32-hppa.c (get_local_syms): Likewise.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
- * elf32-sh.c (sh_elf_relax_section): Likewise.
- (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_get_relocated_section_contents): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
- * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
- * elf64-mmix.c (mmix_elf_relax_section): Likewise.
- * elf64-ppc.c (get_local_syms): Likewise.
- * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
- * elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser.
- * elf64-alpha.c (alpha_elf_size_info): Likewise.
- * elf64-hppa.c (hppa64_elf_size_info): Likewise.
- * elf64-mips.c (mips_elf64_size_info): Likewise.
- * elf64-s390.c (s390_elf64_size_info): Likewise.
- * elf64-sparc.c (sparc64_elf_size_info): Likewise.
-
-2002-06-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to...
- elfxx-mips.c (_bfd_mips_elf_ignore_discarded_relocs): ... here.
- elf64-mips.c (elf_backend_ignore_discarded_relocs): Use
- _bfd_mips_elf_ignore_discarded_relocs.
- elfxx-mips.h (_bfd_mips_elf_ignore_discarded_relocs): Declare.
-
-2002-06-05 H.J. Lu <hjl@gnu.org>
-
- * elfxx-mips.c (mips_elf_calculate_relocation): Call
- _bfd_elf_rel_local_sym for STT_SECTION relocations against
- the SEC_MERGE section.
-
-2002-06-05 Alan Modra <amodra@bigpond.net.au>
-
- * coff-alpha.c: Update copyright date.
- * coff-mips.c: Likewise.
- * xcoff-target.h: Likewise.
-
- * bfd-in.h: Remove "taken from the source" comment.
- * libbfd-in.h: Likewise.
- * libcoff-in.h: Likewise.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * libcoff.h: Regenerate.
-
- * elf.c (bfd_elf_discard_group): Return true.
- * elf-bfd.h (bfd_elf_discard_group): Declare.
- * bfd-in.h (bfd_elf_discard_group): Don't declare here.
- * section.c (bfd_discard_group): Rename to bfd_generic_discard_group.
- * bfd.c (bfd_discard_group): Define.
- * targets.c (struct bfd_target): Add _bfd_discard_group.
- (BFD_JUMP_TABLE_LINK): Here too.
- * libbfd-in.h (_bfd_nolink_bfd_discard_group): Define.
- * aout-adobe.c (aout_32_bfd_discard_group): Define.
- * aout-target.h (MY_bfd_discard_group): Define.
- * aout-tic30.c (MY_bfd_discard_group): Define.
- * binary.c (binary_bfd_discard_group): Define.
- * bout.c (b_out_bfd_discard_group): Define.
- * coff-alpha.c (_bfd_ecoff_bfd_discard_group): Define.
- * coffcode.h (coff_bfd_discard_group): Define.
- * coff-mips.c (_bfd_ecoff_bfd_discard_group): Define.
- * elfxx-target.h (bfd_elfNN_bfd_discard_group): Define.
- * i386msdos.c (msdos_bfd_discard_group): Define.
- * i386os9k.c (os9k_bfd_discard_group): Define.
- * ieee.c (ieee_bfd_discard_group): Define.
- * ihex.c (ihex_bfd_discard_group): Define.
- * mmo.c (mmo_bfd_discard_group): Define.
- * nlm-target.h (nlm_bfd_discard_group): Define.
- * oasys.c (oasys_bfd_discard_group): Define.
- * ppcboot.c (ppcboot_bfd_discard_group): Define.
- * som.c (som_bfd_discard_group): Define.
- * srec.c (srec_bfd_discard_group): Define.
- * tekhex.c (tekhex_bfd_discard_group): Define.
- * versados.c (versados_bfd_discard_group): Define.
- * vms.c (vms_bfd_discard_group): Define.
- * xcoff-target.h (_bfd_xcoff_bfd_discard_group): Define.
- * coff64-rs6000.c (rs6000coff64_vec): Update initialiser.
- (aix5coff64_vec): Likewise.
- * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Likewise.
-
-2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-com.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh64-com.c.
- (elf32-sh64-com.lo): New dependency list.
- * Makefile.in: Regenerate.
- * configure.in (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec)
- (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec): Add
- elf32-sh64-com.lo.
- * configure: Regenerate.
- * elf32-sh64.c (sh64_address_in_cranges)
- (sh64_get_contents_type, sh64_address_is_shmedia): Move to...
- (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb):
- (crange_bsearch_cmpl): Prepend _bfd_sh64_ to name and move to...
- * elf32-sh64-com.c: ...here. New file.
-
-2002-06-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Remove
- ATTRIBUTE_UNUSED on used params.
- * elf32-vax.c (elf_vax_gc_mark_hook): Remove unnecessary checks
- before calling bfd_section_from_elf_index on local syms.
- * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise.
-
-2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-nbsd.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh64-nbsd.c.
- (BFD64_BACKENDS): Add elf64-sh64-nbsd.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-sh64-nbsd.c.
- (elf32-sh64-nbsd.lo, elf64-sh64-nbsd.lo): New rules.
- * Makefile.in: Regenerate.
- * config.bfd (sh5le-*-netbsd*, sh5-*-netbsd*, sh64le-*-netbsd*)
- (sh64-*-netbsd*): New targets.
- * configure.in: Add bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec,
- bfd_elf64_sh64nbsd_vec, and bfd_elf64_sh64lnbsd_vec.
- * configure: Regenerate.
- * elf32-sh64-nbsd.c: New file.
- * elf64-sh64-nbsd.c: New file.
- * targets.c: Add extern decls for bfd_elf32_sh64nbsd_vec,
- bfd_elf32_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec, and
- bfd_elf64_sh64lnbsd_vec.
-
-2002-06-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (setup_group): Set SEC_LINK_ONCE on GRP_COMDAT groups.
- (bfd_section_from_shdr): Likewise. Set section name of group
- sections from signature.
- (group_signature): Split out from setup_group. Ensure symbol table
- is available.
- (bfd_elf_discard_group): New function.
- (_bfd_elf_make_section_from_shdr): Don't set SEC_LINK_ONCE on
- .gnu.linkonce* sections if they are members of a group.
- (set_group_contents): Set GRP_COMDAT flag.
- * section.c (bfd_discard_group): New function.
- * bfd-in.h (bfd_elf_discard_group): Declare.
- * bfd-in2.h: Regenerate.
- * elf-bfd.h (struct bfd_elf_section_data): Add linkonce_p field.
- (elf_linkonce_p): Define.
-
-2002-06-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (bfd_section_from_shdr): Make "name" const.
- * elf-bfd.h (elf_backend_section_from_shdr): Likewise.
- * elf32-i370.c (i370_elf_section_from_shdr): Likewise.
- * elf32-ppc.c (ppc_elf_section_from_shdr): Likewise.
- * elf32-sh64.c (sh64_backend_section_from_shdr): Likewise.
- * elf32-v850.c (v850_elf_section_from_shdr): Likewise.
- * elf64-alpha.c (elf64_alpha_section_from_shdr): Likewise.
- * elf64-hppa.c (elf64_hppa_section_from_shdr): Likewise.
- * elf64-ppc.c (ppc64_elf_section_from_shdr): Likewise.
- * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_section_from_shdr): Likewise.
-
-2002-06-03 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elfxx-mips.c (ABI_64_P): Use backend's data to determine the
- ABI.
-
-2002-06-02 Kazu Hirata <kazu@cs.umass.edu>
-
- * elf32-arc.c: Fix formatting.
- * elf32-arm.h: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-dlx.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-i386qnx.c: Likewise.
- * elf32-or32.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf32-vax.c: Likewise.
- * elf32-xstormy16.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-mmix.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elf64-x86-64.c: Likewise.
-
-2002-06-02 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference
- null when there are no got entries for a symbol.
- (elf64_alpha_relax_find_tls_segment): Rearrange to avoid
- uninitialized variable warning.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_with_lituse): Don't test for
- undefined symbols here.
- (elf64_alpha_relax_section): Do it here. Also test for not
- defined in the current module.
- (elf64_alpha_relocate_section_r): Split out of ...
- (elf64_alpha_relocate_section): ... here. Don't dereference
- NULL when looking up local got entries.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_with_lituse): Reject undefined
- symbols from JSR relaxation.
- (elf64_alpha_size_plt_section_1): New.
- (elf64_alpha_calc_dynrel_sizes): Split out .rela.got bits ...
- (elf64_alpha_size_rela_got_1): ... here.
- (elf64_alpha_size_dynamic_sections): Split out .rela.got bits ...
- (elf64_alpha_size_rela_got_section): ... here.
- (elf64_alpha_size_plt_section): New.
- (elf64_alpha_relax_section): Call them.
- (elf64_alpha_size_got_sections): Remove output_bfd arg.
- (elf64_alpha_finish_dynamic_symbol): Check gotent use_count.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (alpha_get_dtprel_base, alpha_get_tprel_base): New.
- (elf64_alpha_relocate_section): Use them. Reject LE TLS relocs
- in shared libraries. Fix DTPRELHI and TPRELHI value.
- (INSN_ADDQ, INSN_RDUNIQ): New.
- (struct alpha_relax_info): Add symtab_hdr, tls_segment, first_gotent.
- (elf64_alpha_relax_with_lituse): Return boolean. Remove irelend
- argument. Reject dynamic symbols. Use LITUSE symbolic constants.
- (elf64_alpha_relax_got_load): Rename from relax_without_lituse.
- Handle GOTDTPREL and GOTTPREL relocations.
- (elf64_alpha_relax_gprelhilo): New.
- (elf64_alpha_relax_tls_get_addr): New.
- (elf64_alpha_relax_find_tls_segment): New.
- (elf64_alpha_relax_section): Handle TLS relocations.
- (ALPHA_ELF_LINK_HASH_TLS_IE): New.
- (elf64_alpha_check_relocs): Set it.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Don't store computed gp.
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Fix typo on maybe_dynamic
- check; don't suppress dynamic relocs for non-allocated sections.
-
- * elf64-alpha.c: Remove dead code.
-
-2002-05-31 Alan Modra <amodra@bigpond.net.au>
-
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
- * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
- space for bss .plt.
-
-2002-05-31 Graeme Peterson <gp@qnx.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-i386qnx.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-i386qnx.c.
- Run "make dep-am".
- * Makefile.in: Regenerate.
- * config.bfd: Add i[3456]86-*-nto-qnx* support.
- * configure.in: Add bfd_elf32_i386qnx_vec support.
- * configure: Regenerate.
- * elf-bfd.h (struct elf_backend_data): Add set_nonloadable_filepos,
- is_contained_by_filepos, and copy_private_bfd_data_p.
- * elf.c (assign_file_positions_for_segments): Call backend
- set_nonloadable_filepos. Fix non-K&R call to _bfd_error_handler.
- (IS_CONTAINED_BY_FILEPOS): Define.
- (INCLUDE_SECTION_IN_SEGMENT): Also test IS_CONTAINED_BY_FILEPOS.
- (copy_private_bfd_data): Use IS_CONTAINED_BY_FILEPOS. Typo fix.
- Fix non-K&R call to _bfd_error_handler.
- (_bfd_elf_copy_private_section_data): Use backend
- copy_private_bfd_data_p.
- * elf32-i386.c: Don't include elfxx-target.h when
- ELF32_I386_C_INCLUDED is defined.
- * elf32-i386qnx.c: New QNX elf backend file.
- * elfxx-target.h: Add elf_backend_set_nonloadable_filepos,
- elf_backend_is_contained_by_filepos, and
- elf_backend_do_copy_private_bfd_data.
- * targets.c: Add bfd_target bfd_elf32_i386qnx_vec.
-
-2002-05-31 Alan Modra <amodra@bigpond.net.au>
-
- * elfarm-oabi.c (bfd_elf32_arm_add_glue_sections_to_bfd): Define.
- Move other similar defines to start of file.
-
-2002-05-30 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (xcoff_rtype2howto): Handle 16 bit R_RBA.
- * coff64-rs6000.c (xcoff64_rtype2howto): Same.
-
-2002-05-30 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (ALPHA_ELF_LINK_HASH_LU_TLSGD,
- ALPHA_ELF_LINK_HASH_LU_TLSLDM, ALPHA_ELF_LINK_HASH_LU_FUNC): New.
- (ALPHA_ELF_GOT_ENTRY_RELOCS_DONE): Remove.
- (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Remove.
- (struct alpha_elf_got_entry): Add reloc_type, reloc_done, reloc_xlated.
- (struct alpha_elf_obj_tdata): Rename total_got_entries and
- n_local_got_entries to total_got_size and local_got_size.
- (elf64_alpha_howto, elf64_alpha_reloc_map): Update for TLS relocs.
- (alpha_got_entry_size): New.
- (elf64_alpha_relax_with_lituse): Use it.
- (elf64_alpha_relax_without_lituse): Likewise.
- (MAX_GOT_SIZE): Rename from MAX_GOT_ENTRIES.
- (get_got_entry): New.
- (elf64_alpha_check_relocs): Handle TLS relocs. Reorganize.
- (elf64_alpha_adjust_dynamic_symbol): Test LU_FUNC as a mask.
- (elf64_alpha_merge_ind_symbols): Check gotent->reloc_type.
- (elf64_alpha_can_merge_gots, elf64_alpha_merge_gots): Likewise.
- (elf64_alpha_calc_got_offsets_for_symbol): Use alpha_got_entry_size.
- (elf64_alpha_calc_got_offsets): Likewise.
- (alpha_dynamic_entries_for_reloc): New.
- (elf64_alpha_calc_dynrel_sizes): Use it.
- (elf64_alpha_size_dynamic_sections): Likewise.
- (elf64_alpha_relocate_section): Handle TLS relocations.
- * reloc.c: Add Alpha TLS relocations.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
-
- * peXXigen.c (pe_print_idata): Remove double printed
- import table lines; add Bound-To comment.
-
-2002-05-29 Matt Thomas <matt@3am-software.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-vax.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-vax.c.
- (elf32-vax.lo): New rule.
- * Makefile.in: Regenerate.
- * configure.in (bfd_elf32_vax_vec)
- (vaxnetbsd_vec): New vectors.
- * configure: Regenerate.
- * config.bfd (vax-*-netbsdelf*)
- (vax-*-netbsdaout*)
- (vax-*-netbsd*): New targets.
- * elf32-vax.c: New file.
- * reloc.c: Add VAX relocations.
- * bfd-in2.h: Regenerate.
- * targets.c (_bfd_target_vector): Add bfd_elf32_vax_vec.
-
-2002-05-29 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (arm-*-netbsd*): Add bfd_elf32_littlearm_vec
- and bfd_elf32_bigarm_vec to targ_selvecs.
-
-2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
-
- * peXXigen.c (pe_print_idata): Fix seg faults on printing import tables
- with auto-imported symbols.
-
-2002-05-29 Adam Nemet <anemet@lnxw.com>
-
- * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Don't add glue
- sections only record bfd.
- (bfd_elf32_arm_add_glue_sections_to_bfd): New function.
- * bfd-in.h (bfd_elf32_arm_add_glue_sections_to_bfd): Declare it.
- * bfd-in2.h: Regenerate.
-
-2002-05-28 Nick Clifton <nickc@cambridge.redhat.com>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Move
- declaration and initialisation of saw_line and saw_func out of
- for loop.
-
-2002-05-29 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_get_symbol_info): New function.
- (bfd_elf64_get_symbol_info): Define.
- * elfxx-target.h (bfd_elfNN_get_symbol_info): Only define if undef.
-
-2002-05-29 Andrey Volkov <avolkov@transas.com>
-
- * cpu-h8300.c: Make default h8300 machine first in machine list.
-
-2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net>
-
- * config.bfd: Added DLX configuraton.
- * Makefile.am: Added DLX configuraton.
- * configure.in: Added DLX configuraton.
- * archures.c: Add DLX architecture.
- * reloc.c: Add DLX relocs.
- * targets.c: Added DLX target vector.
- * configure: Regenerate.
- * Makefile.in: Regenreate.
- * bfd-in2.h: Regenreate.
- * elf32-dlx.c: New file: Support DLX target.
- * cpu-dlx.c: New file: Support DLX target.
-
-2002-05-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Formatting.
-
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Revert last change.
- (ppc64_elf_check_relocs): Don't set up function descriptor symbol
- strings to point inside function code sym string.
- (func_desc_adjust): Likewise.
- (ppc64_elf_hide_symbol): Rewrite code to look up function code sym.
-
-2002-05-24 Michal Ludvig <mludvig@suse.cz>
-
- * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Added.
- (elf64_x86_64_grok_psinfo): Added.
-
-2002-05-24 TAMURA Kent <kent@netbsd.org>
-
- * config.bfd: Add a target for i386-netbsdpe.
-
-2002-05-24 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy is_func
- and is_func_descriptor.
- (func_desc_adjust): Hide function code sym in shared libs unless
- there is a matching exported function descriptor sym.
-
-2002-05-23 Jakub Jelinek <jakub@redhat.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
- for symbols from SHF_TLS section.
- (_bfd_elf_print_private_bfd_data): Add PT_TLS.
- (elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
- (map_sections_to_segments): Build PT_TLS segment if necessary.
- (assign_file_positions_for_segments): Likewise.
- (get_program_header_size): Account for PT_TLS segment.
- (swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
- SEC_THREAD_LOCAL sections to STT_TLS.
- * reloc.c: Add 386 and IA-64 TLS relocs.
- * section.c (SEC_THREAD_LOCAL): Define.
- (SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
- Remove.
- * elflink.h (elf_link_add_object_symbols): Support .tcommon.
- (size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
- unconditionally.
- (struct elf_final_link_info): Add first_tls_sec.
- (elf_bfd_final_link): Set first_tls_sec.
- Compute elf_hash_table (info)->tls_segment.
- (elf_link_output_extsym): Handle STT_TLS symbols.
- (elf_link_input_bfd): Likewise.
- * syms.c (BSF_THREAD_LOCAL): Define.
- * bfd-in2.h: Rebuilt.
- * libbfd.h: Rebuilt.
- * elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
- elf_i386_mkobject, elf_i386_object_p): New functions.
- (elf_howto_table): Add TLS relocs.
- (elf_i386_reloc_type_lookup): Support TLS relocs.
- (elf_i386_info_to_howto_rel): Likewise.
- (struct elf_i386_link_hash_entry): Add tls_type.
- (struct elf_i386_obj_tdata): New.
- (elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
- New macros.
- (struct elf_i386_link_hash_table): Add tls_ldm_got.
- (link_hash_newfunc): Clear tls_type.
- (elf_i386_check_relocs): Support TLS relocs.
- (elf_i386_gc_sweep_hook): Likewise.
- (allocate_dynrelocs): Likewise.
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Likewise.
- (elf_i386_finish_dynamic_symbol): Likewise.
- (bfd_elf32_mkobject, elf_backend_object_p): Define.
- * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
- dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
- want_tprel, want_dtpmod, want_dtprel.
- (elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
- (ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
- R_IA64_LTOFF_TPREL22.
- (elf_code_to_howto_index): Add TLS relocs.
- (elfNN_ia64_check_relocs): Support TLS relocs.
- (allocate_global_data_got): Account for TLS .got data.
- (allocate_dynrel_entries): Account for TLS dynamic relocations.
- (elfNN_ia64_install_value): Supprt TLS relocs.
- (set_got_entry): Support TLS relocs.
- (elfNN_ia64_relocate_section): Likewise.
-
-2002-05-23 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): For the Thumb
- BLX reloc round the relocation up rather than down.
- * coff-arm.c (coff_arm_relocate_section): Likewise.
-
-2002-05-21 H.J. Lu (hjl@gnu.org)
-
- * linker.c (_bfd_generic_link_add_one_symbol): Allow multiple
- definition.
-
-2002-05-22 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_size_stubs): Don't strip .branch_lt.
- (ppc64_elf_relocate_section): Handle unresolved relocs in opd.
-
-2002-05-22 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Return false for
- unresolved relocs.
- (ppc64_elf_size_dynamic_sections): Check for splt NULL.
-
-2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * bfd.c (bfd_get_arch_size): Remove bfd_set_error call for
- non-ELF targets.
-
-2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf-bfd.h (elf_backend_emit_relocs): Change prototype to return
- an error value.
- * elflink.h (elf_link_output_relocs): Likewise. Improve error message.
- return with false on error.
- (elf_link_input_bfd): Check reloc_emitter return value.
-
-2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (armeb-*-netbsdelf*): New target.
-
-2002-05-20 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_build_one_stub): Point undefined function syms
- at the plt call stub.
-
-2002-05-19 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * cpu-mips.c (mips_compatible): Don't try to check machine
- compatibility.
-
-2002-05-18 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (_bfd_xcoff64_swap_aux_out): Fix C_FILE auxent.
-
-2002-05-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_info_to_howto): Formatting.
- (ppc64_elf_relocate_section): Don't warn about reloc overflow when
- we've already warned about an undefined symbol. Report more
- detail on reloc errors.
-
-2002-05-17 Alan Modra <amodra@bigpond.net.au>
-
- * acinclude.m4 (AM_INSTALL_LIBBFD): New.
- * configure.in: Invoke AM_INSTALL_LIBBFD.
- * Makefile.am (install-data-local): Revert 2002-05-13. Move to..
- (install_libbfd): .. New target.
- (uninstall_libbfd): Likewise.
- (install-bfdlibLTLIBRARIES): Likewise.
- (uninstall-bfdlibLTLIBRARIES): Likewise.
- (bfdlibdir): New.
- (bfdincludedir): New.
- (lib_LTLIBRARIES): Rename to bfdlib_LTLIBRARIES.
- * aclocal.m4: Regenerate.
- * configure: Regenerate.
- * Makefile.in: Regenerate.
-
-2002-05-17 Stuart Balfour <sbalfour@cisco.com>
-
- * hash.c (bfd_hash_lookup): Remove computation of len from inside
- hash loop.
-
-2002-05-16 Nick Clifton <nickc@cambridge.redhat.com>
-
- * config.bfd: Add targets for sh64-linux (little endian and
- big endian).
-
-2002-05-15 Laurent Pinchart <laurent.pinchart@skynet.be>
-
- * peXXigen.c (pe_print_idata): Do not assume that the first thunk
- is located in the same section as the import table. Instead
- check, and if necessary load the section containing the thunk.
-
-2002-05-15 Nick Clifton <nickc@cambridge.redhat.com>
-
- * aix5ppc-core.c (xcoff64_core_p): Replace bfd_read with
- bfd_bread.
- (xcoff64_core_file_matches_executable_p): Replace bfd_read
- with bfd_bread.
-
-2002-05-15 Alan Modra <amodra@bigpond.net.au>
-
- * aix5ppc-core.c: Warning fixes.
- * aout-adobe.c (aout_32_bfd_link_just_syms): Define.
- * aout-target.h (MY_bfd_link_just_syms): Define.
- * aout-tic30.c (MY_bfd_link_just_syms): Define.
- * bfd.c (bfd_link_just_syms): Define.
- * binary.c (binary_bfd_link_just_syms): Define.
- * bout.c (b_out_bfd_link_just_syms): Define.
- * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer.
- * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise.
- * coffcode.h (coff_bfd_link_just_syms): Define.
- * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS.
- (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS.
- (_bfd_elf_link_just_syms): Declare.
- * elf.c (_bfd_elf_link_just_syms): New function.
- * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that
- sections haven't already been discarded by the linker.
- * elflink.h (elf_link_add_object_symbols): Likewise for stab
- sections and SEC_MERGE sections.
- (elf_bfd_discard_info): Similarly here.
- * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define.
- * i386msdos.c (msdos_bfd_link_just_syms): Define.
- * i386os9k.c (os9k_bfd_link_just_syms): Define.
- * ieee.c (ieee_bfd_link_just_syms): Define.
- * ihex.c (ihex_bfd_link_just_syms): Define.
- * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define.
- (_bfd_generic_link_just_syms): Declare.
- * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define.
- * linker.c (_bfd_generic_link_just_syms): New function.
- * mmo.c (mmo_bfd_link_just_syms): Define.
- * nlm-target.h (nlm_bfd_link_just_syms): Define.
- * oasys.c (oasys_bfd_link_just_syms): Define.
- * ppcboot.c (ppcboot_bfd_link_just_syms): Define.
- * som.c (som_bfd_link_just_syms): Define.
- * srec.c (srec_bfd_link_just_syms): Define.
- * targets.c (struct bfd_target): Add _bfd_link_just_syms.
- (BFD_JUMP_TABLE_LINK): And here.
- * tekhex.c (tekhex_bfd_link_just_syms): Define.
- * versados.c (versados_bfd_link_just_syms): Define.
- * vms.c (vms_bfd_link_just_syms): Define.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c: Remove superfluous definitions copied from
- elfxx-mips.c.
- (bfd_elf32_bigmips_vec,bfd_elf32_littlemips_vec): Use the
- SGIish vectors to check the special case.
- (mips_elf_hi16_reloc): Fix comment.
- (mips_elf_got16_reloc): Likewise.
- (_bfd_mips_elf32_gprel16_reloc): Likewise.
- (elf_reloc_map): Code cleanup.
- (mips_reloc_map): Add comment.
- (bfd_elf23_bfd_reloc_type_lookup): Code cleanup.
- (mips_elf32_rtype_to_howto): Likewise.
- (mips_elf32_discard_info): Likewise.
- (elf32_mips_irix_compat): Invert logic: Only SGIish vectors
- lead to IRIX compatibility now.
-
-2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c: Call it IRIX, not Irix in comments.
-
-2002-05-13 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (shle-*-netbsdelf*): Add target which includes
- sh64 support.
-
-2002-05-13 David Edelsohn <edelsohn@gnu.org>
-
- * configure.in: Revert 2002-04-07. Instead, auto-configure
- HAVE_ST_C_IMPL.
- * configure: Regenerate.
- * config.in: Regenerate.
- * rs6000-core.c (CNEW_IMPL): Guard use of c_impl with HAVE_ST_C_IMPL
- or AIX_5_CORE.
-
-2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
-
- * configure.in (sparc*-*-openbsd*): Support sparc64-openbsd
- corefiles as well.2
- * configure: Regenerate.
-
-2002-05-13 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (install-data-local): Install headers to
- $(exec_prefix)/include.
- * Makefile.in: Regenerate.
-
-2002-05-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
- Daniel Jacobowitz <drow@mvista.com>
-
- * coff-sh.c (sh_reloc_map): Map to R_SH_IMM32 for non-PE. Don't
- map BFD_RELOC_RVA.
-
-2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
-
- * config.bfd (alpha*-*-openbsd*, sparc64*-*-openbsd*,
- hppa*-*-openbsd*): New targets.
- * configure.in (alpha*-*-openbsd*): Set COREFILE.
- * configure: Regenerate.
-
-2002-05-10 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (xcoff64_reloc_type_br): New function for
- xcoff64_ppc_relocate_section.
- * coff-rs6000.c : Extern common xcoff_reloc_type functions.
- * libxcoff.h: Common xcoff_reloc_type function declaration.
-
-2002-05-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_relocate_section): Remove overflow checks
- added in 2002-05-09 commit.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Revert part of 2002-05-04,
- don't look for stubs on all undefined syms.
-
-2002-05-09 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (RA_REGISTER_MASK, RA_REGISTER_SHIFT): Delete.
- (ppc64_elf_howto_raw <R_PPC64_RELATIVE>): Not pc_relative or
- pcrel_offset.
-
- * elf32-i386.c (elf_howto_table): Comments.
- (elf_i386_relocate_section): Handle more relocs for relocatable
- linking and against SEC_MERGE sections.
-
-2002-05-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_create_got): New function.
- (ppc_elf_create_dynamic_sections): Call ppc_elf_create_got before
- _bfd_elf_create_dynamic_sections. Correct .plt flags.
- (ppc_elf_check_relocs): Use ppc_elf_create_got in place of
- _bfd_elf_create_got_section.
-
-2002-05-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_backend_data): Add rela_normal.
- * elfxx-target.h (elf_backend_rela_normal): Define.
- (elfNN_bed): Init rela_normal.
- * elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment
- for section symbols here if rela_normal. Simplify abs section test.
- * elf-m10200.c (mn10200_elf_relocate_section): If relocatable,
- return immediately. Remove code handling relocatable linking.
- * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
- * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-i860.c (elf32_i860_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
- * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf-m10200.c (elf_backend_rela_normal): Define.
- * elf-m10300.c (elf_backend_rela_normal): Define.
- * elf32-fr30.c (elf_backend_rela_normal): Define.
- * elf32-i370.c (elf_backend_rela_normal): Define.
- * elf32-i860.c (elf_backend_rela_normal): Define.
- * elf32-m68k.c (elf_backend_rela_normal): Define.
- * elf32-mcore.c (elf_backend_rela_normal): Define.
- * elf32-openrisc.c (elf_backend_rela_normal): Define.
- * elf32-ppc.c (elf_backend_rela_normal): Define.
- * elf32-s390.c (elf_backend_rela_normal): Define.
- * elf32-xstormy16.c (elf_backend_rela_normal): Define.
- * elf64-ppc.c (elf_backend_rela_normal): Define.
- * elf64-s390.c (elf_backend_rela_normal): Define.
- * elf64-x86-64.c (elf_backend_rela_normal): Define.
- * elfxx-ia64.c (elf_backend_rela_normal): Define.
- * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL.
- * elf32-m32r.c (elf_backend_rela_normal): Likewise.
-
-2002-05-06 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Convert
- 'reloc_signed_max' and 'reloc_signed_min' into half-word offsets.
-
-2002-05-06 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd <emit_relocs>): Adjust r_offset
- when not relocatable. Fix reloc_emitter call for K&R.
-
-2002-05-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Reinstate code
- reloading local sym addend mistakenly removed in 2002-05-01 change.
-
- * dwarf2.c (struct line_head): Make prologue_length a bfd_vma.
- (read_abbrevs): Change "offset" param to bfd_vma.
- (parse_comp_unit): Change "version" and addr_size to unsigned ints.
- Change "abbrev_offset" to bfd_vma.
- (read_indirect_string): Use correct conversion chars in error
- message format string, cast bfd_vma's to unsigned long.
- (read_abbrevs): Likewise.
- (read_attribute_value): Likewise.
- (decode_line_info): Likewise.
- (scan_unit_for_functions): Likewise.
- (parse_comp_unit): Likewise.
-
-2002-05-04 Tom Rix <trix@redhat.com>
-
- * coffswap.h (coff_swap_reloc_in): Remove XCOFF support.
- (coff_swap_reloc_out): Same.
- * coff-rs6000.c: (xcoff_swap_reloc_in): Moved from coffswap.h.
- (xcoff_swap_reloc_out): Same.
- (xcoff_rtype2howto): Renamed from _bfd_xcoff_rtype2howto. Special
- case some 16 bit relocs. Add reloc value to output.
- (xcoff_howto_table): Remove 64 bit R_POS, add 16 bit
- R_RBR. Improve names.
- (_bfd_xcoff_reloc_type_lookup): Adjust for removal of 64 bit R_POS.
- (bfd_xcoff_backend_data): Update with new reloc swap names.
- (bfd_pmac_xcoff_backend_data) : Same.
- * coff64-rs6000.c: (xcoff64_swap_reloc_in): Moved from coffswap.h.
- (xcoff64_swap_reloc_out): Same.
- (xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit
- R_POS. Add reloc value to output.
- (xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16
- bit R_RBR. Improve names, masks.
- (xcoff64_reloc_type_lookup): Adjust for move of 64 bit R_POS.
- (bfd_xcoff_backend_data): Update with new reloc swap names.
- (bfd_xcoff_aix5_backend_data) : Same.
-
-2002-05-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (struct elf32_hppa_link_hash_table): Add
- bfd_count top_index, input_list, all_local_syms.
- (elf32_hppa_setup_section_lists): New function, split from
- elf32_hppa_size_stubs.
- (elf32_hppa_next_input_section): Likewise.
- (group_sections): Likewise.
- (get_local_syms): Likewise.
- (elf32_hppa_size_stubs): Adjust for split out functions. Look for
- stubs on undefined syms too.
- (elf32_hppa_set_gp): Use bfd_link_hash* instead of elf_link_hash*.
- Only access htab elf fields when we have an elf hash table.
- * elf32-hppa.h (elf32_hppa_setup_section_lists): Declare.
- (elf32_hppa_next_input_section): Declare.
-
-2002-05-04 Bob Byrnes <byrnes@curl.com>
-
- * opncls.c (_bfd_new_bfd_contained_in): Check return value of
- _bfd_new_bfd.
-
-2002-05-03 H.J. Lu (hjl@gnu.org)
-
- * elfxx-mips.c (mips_elf_link_hash_entry): Add forced_local.
- (mips_elf_link_hash_newfunc): Initialize forced_local to false.
- (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol
- to hide a global symbol.
- (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set
- forced_local to true.
-
-2002-05-02 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Force relative relocs
- vs SHN_UNDEF to zero.
-
-2002-05-02 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_SECTOFF>): Change to a
- 16 bit reloc.
- <R_PPC64_SECTOFF_DS>: Likewise.
- (ppc64_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to
- SECTOFF reloc.
- * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_SECTOFF>): Correct.
- (ppc_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to
- SECTOFF reloc.
-
- * elf64-ppc.c (ppc64_elf_addr16_ha_reloc): Delete.
- (ppc64_elf_ha_reloc): New function.
- (ppc64_elf_brtaken_reloc): New function.
- (ppc64_elf_sectoff_reloc): New function.
- (ppc64_elf_sectoff_ha_reloc): New function.
- (ppc64_elf_toc_reloc): New function.
- (ppc64_elf_toc_ha_reloc): New function.
- (ppc64_elf_toc64_reloc): New function.
- (ppc64_elf_unhandled_reloc): New function.
- (ppc64_elf_howto_raw): Use the above.
- <R_PPC64_RELATIVE>: Mark pc_relative, pcrel_offset.
- <R_PPC64_SECTOFF>: Not pc_relative or pcrel_offset. Fix dst_mask.
- <R_PPC64_SECTOFF_DS>: Likewise.
- (IS_ABSOLUTE_RELOC): Update.
- (struct ppc_link_hash_table): Add have_undefweak.
- (ppc64_elf_link_hash_table_create): Init.
- (func_desc_adjust): Set have_undefweak.
- (ppc64_elf_func_desc_adjust): Call func_desc_adjust earlier. Only
- add the .sfpr blr when have_undefweak.
- (ppc64_elf_setup_section_lists): Check hash table flavour.
- (ppc64_elf_next_input_section): Move output_section->owner test to
- ppc64elf.em.
- (ppc64_elf_set_toc): Rename to ppc64_elf_toc, remove info param
- and relocatable test. Return TOCstart and don't set elf_gp.
- (ppc64_elf_relocate_section): Correct BRTAKEN/BRNTAKEN branch
- offset calculation. Add assert on weak sym branch tweaks.
- * elf64-ppc.h (ppc64_elf_set_toc): Delete.
- (ppc64_elf_toc): Declare.
- (ppc64_elf_next_input_section): Update.
-
-2002-05-01 Alan Modra <amodra@bigpond.net.au>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Don't bomb on NULL
- file_name.
-
-2002-05-01 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (CROR_151515, CROR_313131): Define.
- (ppc64_elf_relocate_section): Use them. Don't look for plt calls
- on R_PPC64_ADDR24 relocs. Require a nop or no link reg on plt
- call branches. Correct undefined weak destination.
- (ppc64_elf_func_desc_adjust): Always create at least one blr in
- .sfpr, and correct case where either only savef* or restf* is
- needed.
-
- Long branch stubs, multiple stub sections.
- * elf64-ppc.h (ppc64_elf_setup_section_lists): Declare.
- (ppc64_elf_next_input_section): Declare.
- * elf64-ppc.c: Move linker-only prototypes.
- (STUB_SUFFIX): Define.
- (enum ppc_stub_type): New.
- (struct ppc_stub_hash_entry): New.
- (struct ppc_branch_hash_entry): New.
- (struct ppc_link_hash_entry): Add stub_cache, oh.
- (struct ppc_link_hash_table): Add stub_hash_table etc. Remove
- sstub. Add sbrlt, srelbrlt, has_14bit_branch, stub_iteration.
- Rename plt_overflow to stub_error.
- (ppc_stub_hash_lookup): Define.
- (ppc_branch_hash_lookup): Define.
- (stub_hash_newfunc): New function.
- (branch_hash_newfunc): New function.
- (link_hash_newfunc): Init new fields.
- (ppc64_elf_link_hash_table_create): Likewise.
- (ppc64_elf_link_hash_table_free): New function.
- (ppc_stub_name): New function.
- (ppc_get_stub_entry): New function.
- (ppc_add_stub): New function.
- (create_linkage_sections): Use bfd_make_section_anyway. Create
- .branch_lt and .rela.branch_lt sections. Don't create .stub.
- (ppc64_elf_check_relocs): Set has_14bit_branch on R_PPC64_REL14*,
- and set up for plt call stubs. Link func and func desc syms.
- (ppc64_elf_gc_sweep_hook): Handle REL14* as per REL24.
- (func_desc_adjust): Avoid hash lookup when func desc sym available
- via shortcut, and set links when processing.
- (ppc64_elf_hide_symbol): Likewise.
- (allocate_dynrelocs): Don't allocate stub section here.
- (ppc64_elf_size_dynamic_sections): Handle sbrlt and srelbrlt.
- Remove sstub code.
- (ppc_type_of_stub): New function.
- (build_one_stub): Delete.
- (ppc_build_one_stub): New function.
- (ppc_size_one_stub): New function.
- (ppc64_elf_setup_section_lists): New function.
- (ppc64_elf_next_input_section): New function.
- (group_sections): New function.
- (get_local_syms): New function.
- (ppc64_elf_size_stubs): Rewrite.
- (ppc64_elf_build_stubs): Rewrite.
- (ppc64_elf_relocate_section): Look up stub entry for REL24
- relocs. Don't propagate REL14* to dynamic objects. Look for long
- branch stubs if REL14* or REL24 relocs won't reach.
- (bfd_elf64_bfd_link_hash_table_free): Define.
-
-2002-04-30 Mark Mitchell <mark@codesourcery.com>
-
- * config.bfd: Add support for powerpc-*-windiss.
-
-2002-04-30 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Always copy undef C_EXT
- symbol names into the hash table.
-
-2002-04-28 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (xcoff_calculate_relocation) : Function table for
- calulating relocations.
- (xcoff_complain_overflow) : Function table for relocation errors.
- (xcoff_ppc_relocate_section): Use relocation and complain function
- tables.
- (xcoff_complain_overflow_unsigned_func): New complain function.
- (xcoff_complain_overflow_signed_func): Same.
- (xcoff_complain_overflow_bitfield_func): Same.
- (xcoff_complain_overflow_dont_func): Same.
- (xcoff_reloc_type_crel): New recot function.
- (xcoff_reloc_type_br): Same.
- (xcoff_reloc_type_ba): Same.
- (xcoff_reloc_type_toc): Same.
- (xcoff_reloc_type_rel): Same.
- (xcoff_reloc_type_neg): Same.
- (xcoff_reloc_type_pos): Same.
- (xcoff_reloc_type_fail): Same.
- (xcoff_reloc_type_noop): Same.
- * libxcoff.h : Declare common parts for xcoff64.
- * coff64-rs6000.c (xcoff64_ppc_relocate_section): Use relocation
- and complain function tables.
-
-2002-04-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-x86-64.c (struct elf64_x86_64_dyn_relocs): Comment typo.
- * elf32-hppa.c (elf32_hppa_final_link): Formatting.
-
-2002-04-26 Alan Modra <amodra@bigpond.net.au>
-
- * opncls.c (bfd_make_readable): Call bfd_section_list_clear.
- * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
-
- * elflink.h (elf_bfd_final_link): Ensure input bfd class is the
- same as the output before calling elf_link_input_bfd.
-
- * coffcode.h (coff_compute_section_file_positions): Set
- section_tail after shuffling section list.
-
-2002-04-24 Christian Groessler <chris@groessler.org>
-
- * coff-z8k.c (extra_case): Fix R_IMM32 relocations: The
- addresses are 23bit with a special layout, not plain 32bit
- values. Prevent relocation of immediate values.
-
-2002-04-24 Chris G. Demetriou <cgd@broadcom.com>
-
- * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): If MDMX or
- MIPS-16 ASE flags are set, print something to indicate that.
-
-2002-04-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition
- under which a plt call stub is used.
- (final_link_relocate): Similarly.
- (allocate_plt_static): Clear h-plabel except when plt entry is
- exclusively used for a plabel.
- (allocate_dynrelocs): Use the above to simplify plt sizing.
- (struct elf32_hppa_link_hash_table): Add has_22bit_branch.
- (elf32_hppa_link_hash_table_create): Init.
- (BL22_RP): Define.
- (hppa_build_one_stub): Use BL22_RP if has_22bit_branch.
- (elf32_hppa_check_relocs): Set has_22bit_branch.
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Remove debug message.
- (final_link_relocate): Likewise.
-
-2002-04-22 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't build
- search table if some FDE is DW_EH_PE_aligned encoded either.
- (_bfd_elf_write_section_eh_frame): Handle terminating FDE specially.
-
-2002-04-22 Richard Smith <richard@ex-parrot.com>
- Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (struct eh_cie_fde): Add per_encoding_relative.
- (_bfd_elf_discard_section_eh_frame): Set it for CIEs with pcrel
- encoded personality.
- (_bfd_elf_write_section_eh_frame): Adjust pcrel encoded personality
- for CIE/FDE removal.
-
-2002-04-20 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Fix C_FILE auxent.
-
-2002-04-20 Alan Modra <amodra@bigpond.net.au>
-
- * archures.c (bfd_lookup_arch): Move the list order comment..
- (struct bfd_arch_info): ..to where it belongs.
- * bfd-in2.h: Regenerate.
-
- * archures.c (bfd_lookup_arch): Add comment on list order.
- (bfd_default_set_arch_mach): Use bfd_lookup_arch.
- * cpu-powerpc.c (bfd_powerpc_archs): Re-order so that the default
- is always at head of list.
-
-2002-04-18 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-arm.c (coff_thumb_pcrel_12, coff_thumb_pcrel_9,
- insert_thumb_branch, record_thumb_to_arm_glue): Suppress
- definition of these functions for ARM_WINCE builds as they are
- not used.
- (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define
- for ARM_WINCE builds.
-
-2002-04-18 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-arm.c (bfd_arm_process_before_allocation):
-
-2002-04-17 J"orn Rennecke <joern.rennecke@superh.com>
-
- * cpu-sh.c (scan_mach): Delete.
- (arch_info_struct): Replace scan_mach with bfd_default_scan.
- (bfd_sh_arch): Likewise.
-
-2002-04-16 Nick Clifton <nickc@cambridge.redhat.com>
-
- * ihex.c (ihex_write_object_contents): Fix check for records
- crossing 64K boundaries.
-
-2002-04-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-m32r.c (m32r_elf_add_symbol_hook): Check the hash table
- type rather than just assuming entries are ELF.
- * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
- * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Likewise.
- * elf64-mmix.c (mmix_elf_add_symbol_hook): Use bfd_link_hash_entry
- rather than elf_link_hash_entry.
-
-2002-04-15 Richard Henderson <rth@redhat.com>
-
- * elf32-mips.c (mips_elf32_object_p): Revert 0404 fragment: allow
- n32 binaries.
-
-2002-04-15 Michael Snyder <msnyder@redhat.com>
-
- * opncls.c (bfd_close): Write contents if writeable.
- Minor formatting tidy-ups.
-
-2002-04-15 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Check the hash table type.
-
-2002-04-12 Michael Snyder <msnyder@redhat.com>
-
- * bfd-in.h (bfd_get_section_lma): New access macro.
- Minor white-space fix-up.
-
-2002-04-12 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (prep_headers): Don't zero EI_OSABI, EI_ABIVERSION or
- header pad.
-
-2002-04-09 DJ Delorie <dj@redhat.com>
-
- * elfarm-nabi.c (elf32_arm_howto_table): Fix ABS16 masks.
-
-2002-04-09 Casper S. Hornstrup <chorns@users.sourceforge.net>
-
- * coffcode.h (coff_read_word): New.
- (coff_compute_checksum): New.
- (coff_apply_checksum): New.
- (coff_write_object_contents): Call coff_apply_checksum () to
- apply checksum to PE image.
-
-2002-04-08 Randolph Chung <tausq@debian.org>
-
- * elf32-hppa.c (hppa_unwind_entry_compare): Move to elf-hppa.h.
- (elf32_hppa_final_link): Split out sorting logic to..
- * elf-hppa.h (elf_hppa_sort_unwind): ..here.
- (elf_hppa_final_link): Call elf_hppa_sort_unwind.
-
-2002-04-07 Andrew Cagney <ac131313@redhat.com>
-
- * configure.in: Add missing ``|'' to powerpc-*-aix4.[4-9]*
- pattern.
- * configure: Re-generate.
-
-2002-04-07 Andrew Cagney <ac131313@redhat.com>
-
- * configure.in: Only define AIX_CORE_DUMPX_CORE when AIX version
- is greater or equal to 4.3.3.
- * configure: Regenerate.
- Fix PR gdb/344.
-
-2002-04-05 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_howto_table) <R_CRIS_16_PCREL,
- R_CRIS_32_PCREL>: Fix typo in name.
- (cris_elf_check_relocs): Always create .rela.got here when
- R_CRIS_16_GOTPLT or R_CRIS_32_GOTPLT is seen.
- (elf_cris_adjust_gotplt_to_got): Don't create .rela.got here;
- assume it's created.
-
-2002-04-04 Daniel Jacobowitz <drow@mvista.com>
-
- * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define.
- * aout-target.h (MY_bfd_link_hash_table_free): Conditionally
- define.
- * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise.
- * bfd.c (bfd_link_hash_table_free): Define.
- * binary.c (binary_bfd_link_hash_table_free): Define.
- * bout.c (b_out_bfd_link_hash_table_free): Define.
- * coff-rs6000.c (rs6000coff_vec): Include
- _bfd_generic_link_hash_table_free.
- (pmac_xcoff_vec): Likewise.
- * coff64-rs6000.c (rs6000coff64_vec): Likewise.
- (aix5coff64_vec): Likewise.
- * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define.
- * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function.
- (bfd_elf32_bfd_link_hash_table_free): Define.
- * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function.
- (bfd_elf32_bfd_link_hash_table_free): Define.
- * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally
- define.
- * i386msdos.c (msdos_bfd_link_hash_table_free): Define.
- * i386os9k.c (os9k_bfd_link_hash_table_free): Define.
- * ieee.c (ieee_bfd_link_hash_table_free): Define.
- * ihex.c (ihex_bfd_link_hash_table_free): Define.
- * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define.
- (_bfd_generic_link_hash_table_free): Add prototype.
- * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype.
- * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define.
- * linker.c (_bfd_generic_link_hash_table_free): New function.
- * mmo.c (mmo_bfd_link_hash_table_free): Define.
- * nlm-target.h (nlm_bfd_link_hash_table_free): Define.
- * oasys.c (oasys_bfd_link_hash_table_free): Define.
- * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define.
- * som.c (som_bfd_link_hash_table_free): Define.
- * srec.c (srec_bfd_link_hash_table_free): Define.
- * tekhex.c (tekhex_bfd_link_hash_table_free): Define.
- * versados.c (versados_bfd_link_hash_table_free): Define.
- * vms.c (vms_bfd_link_hash_table_free): New function.
- * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function.
-
- * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc
- instead of bfd_alloc.
- * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise.
- * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise.
- * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise.
- * cofflink.c (_bfd_coff_link_hash_table_create): Likewise.
- * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
- * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise.
- * elf.c (_bfd_elf_link_hash_table_create): Likewise.
- * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise.
- * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
- * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise.
- * elf32-i386.c (elf_i386_link_hash_table_create): Likewise.
- * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
- * elf32-s390.c (elf_s390_link_hash_table_create): Likewise.
- * elf32-sh.c (sh_elf_link_hash_table_create): Likewise.
- * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise.
- * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise.
- * elf64-s390.c (elf_s390_link_hash_table_create): Likewise.
- * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise.
- * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise.
- * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise.
- * linker.c (_bfd_generic_link_hash_table_create): Likewise.
- * m68klinux.c (linux_link_hash_table_create): Likewise.
- * sparclinux.c (linux_link_hash_table_create): Likewise.
- * sunos.c (sunos_link_hash_table_create): Likewise.
- * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise.
-
- * targets.c: Add _bfd_link_hash_table_free to xvec.
-
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * libcoff.h: Regenerate.
-
-2002-04-04 Alan Modra <amodra@bigpond.net.au>
-
- * dep-in.sed: Cope with absolute paths.
- * Makefile.am (dep.sed): Subst TOPDIR, and not INCDIR.
- Run "make dep-am".
- * Makefile.in: Regenerate.
- * coff-arm.c: Fix copyright date.
- * cpu-h8300.c: Likewise.
- * cpu-i370.c: Likewise.
- * cpu-s390.c: Likewise.
- * cpu-mips.c: Likewise.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-04-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * Makefile.am: Add elfxx-mips.c to the known backends.
- (elf32-mips.lo): remove dependency to coff/external.h.
- * Makefile.in: Regenerate.
- * configure.in: Add elfxx-mips.lo to all vectors using elf32-mips.lo
- Remove elf32-mips.lo from 64 bit vectors. Update dependencies
- accordingly.
- * configure: Regenerate.
- * elf-bfd.h: Move all MIPS ELF specific prototypes to elfxx-mips.h.
- (irix_compat_t): IRIX compatibility level, moved from elf32-mips.c.
- (elf_backend_mips_irix_compat, elf_backend_mips_rtype_to_howto): New
- MIPS specific backend functions.
- * elf32-mips.c: Moved most code to elfxx-mips.c.
- (mips_elf_hi16_reloc): Rename from _bfd_mips_elf_hi16_reloc and make
- static.
- (mips_elf_lo16_reloc): Likewise, was _bfd_mips_elf_lo16_reloc.
- (mips_elf_got16_reloc): Likewise, was _bfd_mips_elf_got16_reloc.
- (mips_elf_gprel32_reloc): Likewise, was _bfd_mips_elf_gprel32_reloc.
- (mips_elf32_rtype_to_howto): Rename from mips_rtype_to_howto. Changed
- interface to allow selection of the right REL or RELA howto table.
- (mips_elf32_object_p): Rename from _bfd_mips_elf_object_p and made
- static. Let it refuse n32 objects.
- (elf32_mips_grok_prstatus): Rename from _bfd_elf32_mips_grok_prstatus.
- (elf32_mips_grok_psinfo): Rename from _bfd_elf32_mips_grok_psinfo.
- (elf32_mips_discard_info): Rename from _bfd_elf32_mips_discard_info.
- (elf32_mips_ignore_discarded_relocs): Rename from
- _bfd_elf32_mips_ignore_discarded_relocs.
- (elf32_mips_write_section): Rename from _bfd_elf32_mips_write_section.
- (elf32_mips_irix_compat): New function, replaces IRIX_COMPAT.
- (elf_mips_howto_table_rela): Remove.
- * elf64-mips.c: Moved most code to elfxx-mips.c.
- (bfd_elf64_bfd_reloc_type_lookup): Make static.
- (mips_elf64_rtype_to_howto): New function.
- (mips_elf64_object_p): Likewise.
- (elf64_mips_irix_compat): Likewise.
- * elfxx-mips.c: New file containing common code merged together from
- elf32-mips.c and elf64-mips.c.
- * elfxx-mips.h: New file containing MIPS specific prototypes from
- elf-bfd.h.
- * elfxx-target.h: Add handling for elf_backend_mips_irix_compat and
- elf_backend_mips_rtype_to_howto.
-
-2002-04-04 Alan Modra <amodra@bigpond.net.au>
-
- * srec.c (MAXCHUNK, Chunk): Revise comments.
- (srec_write_record): Correct buffer size.
- (srec_write_header): Do without intermediate buffer.
- (srec_write_section): Validate Chunk.
- (srec_write_terminator): Pass NULL instead of dummy buffer.
- (srec_write_symbols): Pass file and symbol names directly to
- bfd_bwrite so sprintf won't overflow buffer.
-
-2002-04-03 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic
- PC relative relocs against hidden symbols.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2002-04-03 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_make_section_from_shdr): When setting section
- LMAs, loop over segments until p_vaddr and p_memsz specify an
- extent enclosing the section.
-
-2002-04-02 Nick Clifton <nickc@cambridge.redhat.com>
-
- * ihex.c (ihex_write_object_contents): Do not allow records to
- cross a 64K boundary - wrap if necessary.
-
-2002-04-01 Nathan Williams <nathanw@wasabisystems.com>
-
- * elf.c (elfcore_netbsd_get_lwpid): Fix off-by-one error
- which caused the returned LWP ID to always be 0.
-
-2002-04-01 Richard Henderson <rth@redhat.com>
-
- * elf32-sparc.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
- (elf32_sparc_relocate_section): Use it to figure out when to
- initialize .got entries.
- * elf64-sparc.c: Similarly.
-
-2002-03-28 Alan Modra <amodra@bigpond.net.au>
-
- * linker.c (link_action): Ignore duplicate warning syms.
- (_bfd_generic_link_write_global_symbol): Follow warning symbol link.
- * elflink.h (elf_adjust_dynstr_offsets): Likewise.
- (elf_adjust_dynamic_symbol): Likewise.
- (elf_export_symbol): Likewise.
- (elf_link_find_version_dependencies): Likewise.
- (elf_link_assign_sym_version): Likewise.
- (elf_link_sec_merge_syms): Likewise.
- (elf_link_output_extsym): Likewise.
- (elf_gc_sweep_symbol): Likewise.
- (elf_gc_propagate_vtable_entries_used): Likewise.
- (elf_gc_smash_unused_vtentry_relocs): Likewise.
- (elf_gc_allocate_got_offsets): Likewise.
- (elf_collect_hash_codes): Likewise.
- * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise.
- * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise.
- (elf_hppa_remark_useless_dynamic_symbols): Likewise.
- * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
- * elf32-arm.h (elf32_arm_discard_copies): Likewise.
- * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise.
- (elf_cris_discard_excess_dso_dynamics): Likewise.
- * elf32-hppa.c (clobber_millicode_symbols): Likewise.
- (mark_PIC_calls): Likewise.
- (allocate_plt_static): Likewise.
- (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf32-i386.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
- * elf32-m68k.c (elf_m68k_discard_copies): Likewise.
- * elf32-mips.c (mips_elf_output_extsym): Likewise.
- (mips_elf_sort_hash_table_f): Likewise.
- (mips_elf_check_mips16_stubs): Likewise.
- * elf32-s390.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf32-sh.c (sh_elf_discard_copies): Likewise.
- * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise.
- (xstormy16_relax_plt_realloc): Likewise.
- * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
- (elf64_alpha_output_extsym): Likewise.
- * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise.
- * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise.
- (mips_elf64_check_mips16_stubs): Likewise.
- (mips_elf64_output_extsym): Likewise.
- * elf64-ppc.c (func_desc_adjust): Likewise.
- (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf64-s390.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
- * elf64-x86-64.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise.
- * aoutx.h (aout_link_write_other_symbol): Likewise.
- * cofflink.c (_bfd_coff_write_task_globals): Likewise.
- (_bfd_coff_write_global_sym): Likewise.
- * i386linux.c (linux_tally_symbols): Likewise.
- * m68klinux.c (linux_tally_symbols): Likewise.
- * sparclinux.c (linux_tally_symbols): Likewise.
- * pdp11.c (aout_link_write_other_symbol): Likewise.
- * sunos.c (sunos_scan_dynamic_symbol): Likewise.
- * xcofflink.c (xcoff_build_ldsyms): Likewise.
- (xcoff_write_global_symbol): Likewise.
-
- * cofflink.c (_bfd_coff_final_link): Formatting.
- * cpu-mips.c (mips_compatible): Make static, prototype.
- * elf32-i386.c (elf_i386_check_relocs): Formatting.
- * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
- * elf64-mips.c (mips_elf64_sort_hash_table): Likewise.
- (mips_elf64_final_link): Likewise.
- * elflink.h (elf_link_find_version_dependencies): Remove duplicate
- prototype.
-
-2002-03-27 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-arm.c (SWAP_IN_RELOC_OFFSET): Define.
- (SWAP_OUT_RELOC_OFFSET): Define.
-
-2002-03-27 Gregory Steuck <greg@nest.cx>
-
- * elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for
- terminating NULL if empty symbol table.
- (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
-
-2002-03-26 H.J. Lu (hjl@gnu.org)
-
- * elflink.h (elf_link_input_bfd): Revert the last change since
- the gcc exception handling isn't fixed yet.
-
-2002-03-26 H.J. Lu (hjl@gnu.org)
-
- * elflink.h (elf_link_input_bfd): Complain about relocations
- against local symbols in discarded sections.
-
-2002-03-26 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_gc_mark): Don't recurse into non-ELF sections.
-
-2002-03-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
- section file offset for !SEC_LOAD sections.
-
-2002-03-21 Richard Earnshaw <rearnsha@arm.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate <case R_ARM_GOTOFF>,
- <case R_ARM_GOT>): Handle relocations to Thumb functions.
-
-2002-03-21 Alan Modra <amodra@bigpond.net.au>
-
- * coff64-rs6000.c (_bfd_xcoff64_put_symbol_name): Prototype.
- Whitespace changes.
- * archive.c: Update copyright date.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * Makefile.am: Run "make dep-am"
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-03-20 Daniel Jacobowitz <drow@mvista.com>
-
- * dwarf2.c (struct funcinfo): Move up.
- (lookup_address_in_function_table): New argument function_ptr.
- Set it.
- (lookup_address_in_line_table): New argument function. If function
- is non-NULL, use it to handle ``addr'' before the first line note of
- the function.
- (comp_unit_find_nearest_line): Update and swap calls to
- lookup_address_in_function_table and lookup_address_in_line_table.
- * syms.c (_bfd_stab_section_find_nearest_line): Use the first
- N_SLINE encountered if we see an N_FUN before any N_SLINE.
-
-2002-03-20 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
- _bfd_xcoff_generic_stat_arch_elt. Fix format check.
- * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt.
-
-2002-03-19 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through all
- dynamic objects in archives.
-
-2002-03-19 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elflink.h (NAME(bfd_elf,record_link_assignment)): Don't set
- STT_NOTYPE symbols to STT_OBJECT.
-
-2002-03-18 Jan Hubicka <jh@suse.cz>
-
- * cpu-i386.c (bfd_x86_64_arch): Rename to "i386:x86-64"
-
-2002-03-18 Tom Rix <trix@redhat.com>
-
- * aix5ppc.core.c : New file for AIX 5 64 bit core support.
- * bfd-in.h : Add bfd_xcoff_ar_archive_set_magic declaration.
- * coff-rs6000 (do_pad) : New function for archive padding.
- (do_copy) : New function for object file copying in archives.
- (do_shared_object_padding) : New function for padding shared
- objects to their text section alignment in archives.
- (bfd_xcoff_ar_achive_set_magic) : Stub.
- (xcoff_write_armap_big) : Use do_copy and do_pad.
- (xcoff_write_archive_contents_big) : Use do_shared_object_padding,
- do_copy and do_pad.
- * coff64-rs6000.c (xcoff64_write_ojbect_contents) : Use
- bfd_xcoff_magic_number.
- (xcoff64_bad_format_hook) : New function for _bfd_bad_format_hook
- fop.
- (xcoff_backend_data_r) : Use xcoff64_bad_format_hook.
- (bfd_xcoff_aix5_backend_data) : New Aix 5 backend data.
- (aix5coff64_vec) : New Aix 5 target aix5coff64-rs6000.
- * rs6000-core.c : Update copyright date.
- * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL
- csectpp.
- * coffcode.h (coff_new_section_hook) : Use new accessor macros.
- (coff_set_arch_mach_hook) : Add Aix 5 U64_TOCMAGIC magic #.
- (coff_set_flags) : Use bfd_xcoff_magic_number.
- * libxcoff.h (bfd_xcoff_is_xcoff64): Add U64_TOCMAGIC.
- * configure.in : Add powerpc-*-aix5 and rs6000-*-aix5 support.
- * Makefile.am : Same.
- * config.bfd : Same.
- * targets.c : Same.
- * configure : Regnerate.
- * Makefile.in : Same.
- * bfd-in2.h : Same.
-
-2002-03-18 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/fr.po: Updated version.
-
-2002-03-18 Alan Modra <amodra@bigpond.net.au>
-
- * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
- * libbfd.h: Regenerate.
- * archive.c (coff_write_armap): Pass on failures from
- bfd_write_bigendian_4byte_int.
-
-2002-03-14 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the BFD
- error to bfd_error_nonrepresentable_section for reinit_array
- section in DSO.
-
-2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coffcode.h (coff_slurp_symbol_table): When adding BSF_WEAK flag,
- OR it in rather than replacing previously selected flags.
-
- * elfxx-target.h (TARGET_BIG_SYM): Set ar_max_namelen to 15.
- (TARGET_LITTLE_SYM): Set ar_max_namelen to 15.
-
-2002-03-14 Alan Modra <amodra@bigpond.net.au>
-
- * cpu-mips.c (mips_compatible): New. Don't check bits_per_word.
- (N): Use the above.
- * elflink.h (elf_bfd_final_link): Revert last change. Instead,
- ensure reloc size matches before calling elf_link_input_bfd.
- Add an assert to check reloc size when counting output relocs.
-
-2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * mmo.c (mmo_get_loc): Return NULL rather than false.
-
-2002-03-13 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/fr.po: Updated version.
-
-2002-03-13 Alan Modra <amodra@bigpond.net.au>
-
- * archures.c (bfd_default_compatible): Test bits_per_word.
- * cpu-i386.c (i386_compatible): Remove. Replace occurrences with
- bfd_default_compatible.
- * cpu-i370.c (i370_compatible): Likewise.
- * cpu-sparc.c (sparc_compatible): Likewise.
- * cpu-h8300.c (compatible): Test in->arch == out->arch.
-
- * elflink.h: Formatting fixes.
- (elf_link_output_extsym): Merge undefined and undef weak cases.
-
- * elflink.h (elf_bfd_final_link): Only call elf_link_input_bfd
- when word size of input matches output word size.
-
-2002-03-12 Andreas Jaeger <aj@suse.de>
-
- * cpu-i386.c (i386_compatible): New. Use it instead of
- bfd_default_compatible.
-
-2002-03-07 H.J. Lu (hjl@gnu.org)
-
- * coff-sh.c (shcoff_reloc_map): Use bfd_reloc_code_real_type
- as the type for bfd_reloc_val.
-
-2002-03-05 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-hppa.h (elf_hppa_is_dynamic_loader_symbol): New function.
- (elf_hppa_relocate_section): Ignore undefined dynamic loader symbols.
- (elf_hppa_final_link_relocate): Correct relocations for indirect
- references to local data through the DLT. Fix .opd creation for
- local symbols using R_PARISC_LTOFF_FPTR32 and R_PARISC_FPTR64
- relocations. Use e_lsel selector for R_PARISC_DLTIND21L,
- R_PARISC_LTOFF_FPTR21L and R_PARISC_LTOFF_TP21L as per
- "Processor-Specific ELF for PA_RISC, Version 1.43" document.
- Similarly, use e_rsel for DLT and LTOFF 'R' relocations.
- * elf32-hppa.c (final_link_relocate): Revise relocation selectors
- as per "Processor-Specific ELF for PA_RISC, Version 1.43" document.
-
-2002-03-05 Jakub Jelinek <jakub@redhat.com>
-
- * merge.c (_bfd_merge_sections): Don't segfault if there
- is nothing to merge due to GC.
-
-2002-03-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (clobber_millicode_symbols): Remove hack to keep
- symbols that have been forced local.
-
- * elflink.h (elf_bfd_final_link): Call elf_link_output_extsym
- to output forced local syms for non-shared link.
- (elf_link_output_extsym): Tweak condition for calling backend
- adjust_dynamic_symbol so that previous behaviour is kept.
- Whitespace changes throughout file.
-
-2002-03-04 H.J. Lu <hjl@gnu.org>
-
- * elf.c (bfd_section_from_shdr): Handle special sections,
- .init_array, .fini_array and .preinit_array.
- (elf_fake_sections): Likewise.
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Create the
- DT entry only if the section is in output for .init_array,
- .fini_array and .preinit_array. Complain about .preinit_array
- section in DSO.
- (elf_bfd_final_link): Warn zero size for .init_array,
- .fini_array and .preinit_array sections.
-
- * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Remove
- SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY.
- (elfNN_ia64_fake_sections): Remove .init_array, .fini_array and
- .preinit_array.
-
-2002-03-04 Alan Modra <amodra@bigpond.net.au>
-
- * configure.in (WIN32LIBADD): Don't eval PICFLAG assignment.
- * configure: Regenerate.
-
-2002-03-02 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (xcoff64_howto_table): Replace howto types with
- symbolic equiv.
- * coff-rs6000.c (xcoff_howto_table): Same.
-
-2002-03-01 David Mosberger <davidm@hpl.hp.com>
-
- * elflink.h (size_dynamic_sections): If section named
- ".preinit_array" exists, create DT_PREINIT_ARRAY and
- DT_PREINIT_ARRAYSZ entries in dynamic table. Analogously for
- ".init_array" and ".fini_array".
- (elf_bfd_final_link): Handle DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ,
- DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY, DT_INIT_ARRAY, and
- DT_FINI_ARRAY.
-
-2002-02-26 Andrew Macleod <amacleod@cygnus.com>
-
- * elflink.h (elf_bfd_final_link): Don't crash on SHN_UNDEF local
- dynsyms.
-
-2002-02-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-hppa.h: Update copyright date.
-
- * elf64-ppc.c (ppc64_elf_check_relocs): Warning fix.
- (ppc64_elf_relocate_section): Don't generate power4 style branch
- hints for *_BRTAKEN and *_BRNTAKEN relocs.
-
-2002-02-22 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sh64.c (sh_elf64_relocate_section): Fix a typo from my
- last patch.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
-
-2002-02-21 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c: Major rework that introduces all recent changes
- to the x86-64 backend. Get a closer match to elf32-i386.
- (struct elf64_x86_64_dyn_relocs): Rename from
- elf64_x86_64_pcrel_relocs_copied, add additional fields. Change
- all users.
- (struct elf64_x86_64_link_hash_table): Add short cuts to some
- sections.
- (link_hash_newfunc): Rename from elf64_x86_64_link_hash_newfunc,
- remove casts, initialize new hash members.
- (create_got_section): New.
- (elf64_x86_64_create_dynamic_sections): New.
- (elf64_x86_64_copy_indirect_symbol): New.
- (elf64_x86_64_check_relocs): Don't allocate space for dynamic
- relocs, .got or .relgot here but do it in allocate_dynrelocs.
- Reference count possible .plt and .got entries. Don't test input
- section SEC_READONLY here to try to avoid copy relocs, and keep
- dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set
- DF_TEXTREL here. Delay setting of variables until needed. Cache
- pointer to "sreloc" section in elf_section_data. Tweak condition
- under which .got created. Report files with bad relocation
- section names.
- (elf64_x86_64_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
- Reference count possible .plt entries. Don't deallocate .got and
- .relgot space here.
- (elf64_x86_64_adjust_dynamic_symbol): Handle nocopyreloc. Don't
- do copy reloc processing for weakdefs. Remove redundant casts and
- aborts. Delay setting of vars until needed. Move creation of
- dynamic symbols and allocation of .plt and .rela.plt to
- allocate_dynrelocs. Replace BFD_ASSERT with abort.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
- (allocate_dynrelocs): New.
- (readonly_dynrelocs): New.
- (elf64_x86_64_size_dynamic_sections): Call readonly_dynrelocs.
- Allocate space for dyn relocs. Replace BFD_ASSERT with abort.
- Zero out the dynamic allocated content space.
- (elf64_x86_64_discard_copies): Removed.
- (elf64_x86_64_relocate_section): Make use of dynamic section
- short-cuts. Localise vars, and delay setting. Better error
- reporting, replace BFD_ASSERT with abort. Check
- ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the
- regular object file and tread the weak definition as the normal
- one. Don't discard relocs for undefweak or undefined symbols and
- check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy
- relocs.
- (elf64_x86_64_finish_dynamic_symbol): Don't copy relocs for
- symbols that have been forced local. Use same test to decide if
- we can use a relative reloc for got as relocate_section. Expand
- SHN_UNDEF comment. Move expressions out of function calls.
- Replace BFD_ASSERT with abort.
- (bfd_elf64_bfd_final_link): Removed.
- (elf_backend_copy_indirect_symbol): Define.
-
-2002-02-20 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (xcoff_howto_table): Add 16 bit R_BA.
- (_bfd_xcoff_reloc_type_lookup): Use it.
- * coff64-rs6000.c (xcoff64_howto_table): Same.
- (xcoff64_reloc_type_lookup): Same.
-
-2002-02-20 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
-
- * osf-core.c (osf_core_vec): OSF/1 (Digital Unix) core files are
- little endian.
-
-2002-02-19 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * archures.c (bfd_mach_s390_esa): Rename to bfd_mach_s390_31.
- (bfd_mach_s390_esame): Rename to bfd_mach_s390_64.
- * bfd-in2.h: Regenerate.
- * cpu-s390.c (arch_info_struct): Use renamed architecture defines.
- Replace architecture name "s390" with "s390:31-bit" and "s390:esame"
- with "s390:64-bit".
- * elf32-s390.c (elf_howto_table): Add 32 bit pc relative relocations.
- (elf_s390_reloc_type_lookup): Likewise.
- (elf_s390_check_relocs): Likewise.
- (elf_s390_gc_sweep_hook): Likewise.
- (elf_s390_relocate_section): Likewise.
- (elf_s390_object_p): Use renamed architecture define.
- * elf64-s390.c (elf_s390_object_p): Use renamed architecture define.
-
-2002-02-19 Frank Ch. Eigler <fche@redhat.com>
-
- * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping.
-
-2002-02-19 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable
- absptr -> pcrel optimization for shared libs.
- Only create minimal .eh_frame_hdr if absptr FDE encoding in shared
- library cannot be converted to pcrel.
- (_bfd_elf_eh_frame_section_offset): Return -2 if making absptr
- relative.
- * elf32-i386.c (elf_i386_relocate_section): If
- _bfd_elf_section_offset returned -2, skip, but make sure the
- relocation is installed.
- * elf32-arm.h (elf32_arm_final_link_relocate): Likewise.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Handle
- _bfd_elf_section_offset returning -2 the same way as -1.
- * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
- * elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME
- and BFD_ASSERT.
- * elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.
-
-2002-02-18 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (bfd_xcoff_link_gernate_rtinit): Add -brtl support.
- (bfd_xcoff_size_dynamic_sections): Same.
- * bfd-in.h (bfd_xcoff_link_generate_rtinit): Same.
- (bfd_xcoff_size_dynamic_sections): Same.
- * coff-rs6000.c (xcoff_generate_rtinit): Same.
- * coff-rs646000.c (xcoff64_generate_rtinit): Same.
- * libxcoff.h (struct xcoff_backend_data_rec): Same.
- * xcofflink.c (xcoff_build_ldsyms, xcoff_link_add_symbols): Clean.
- * bfd-in2.h: Regenerate.
-
-2002-02-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (STFD_FR0_0R1, LFD_FR0_0R1, BLR): Define.
- (struct ppc_link_hash_table): Add sfpr.
- (ppc64_elf_link_hash_table_create): Init it.
- (ppc64_elf_create_dynamic_sections): Split creation of .stub and
- .glink out to..
- (create_linkage_sections): ..here. Make .sfpr too.
- (ppc64_elf_check_relocs): Call create_linkage_sections, and set
- dynobj early.
- (MIN_SAVE_FPR, MAX_SAVE_FPR): Define.
- (ppc64_elf_func_desc_adjust): Look for missing ._savef* and
- ._restf* functions, and create as needed.
- (func_desc_adjust): Only force_local for shared libs.
-
-2002-02-18 David O'Brien <obrien@FreeBSD.org>
-
- * configure.in: Bump version number post 2.12 branching.
- * configure: Regenerate.
-
-2002-02-17 Hans-Peter Nilsson <hp@bitrange.com>
-
- * mmo.c: Correct and improve comments.
- (mmo_write_chunk): Store trailing byte in bfd buffer; don't
- zero-pad. Use input to fill up non-empty bfd buffer.
- (mmo_flush_chunk): New function.
- (mmo_write_loc_chunk): Add parameter last_vmap, all callers
- changed. Don't emit location specifier if VMA is same as
- *LAST_VMAP after omitting leading zero contents. Call
- mmo_flush_chunk before emitting location specifier.
- (mmo_write_loc_chunk_list): Call mmo_flush_chunk when finished
- with mmo_write_loc_chunk calls.
- (mmo_internal_write_section): Call mmo_flush_chunk after
- mmo_write_chunk.
- (mmo_write_symbols_and_terminator): Move :Main to first position
- in symbol array. Add faked one if it does not exist if there are
- other symbols. Don't add it if there are no symbols at all. Move
- out test for value of :Main from symbol loop. Rename table
- fakemain to maintable and variable mainsym to fakemain.
-
-2002-02-15 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: A target
- section with no got matches any got. Simplify error generaion.
-
-2002-02-15 Alan Modra <amodra@bigpond.net.au>
-
- Support arbitrary length fill patterns.
- * linker.c (bfd_new_link_order): Zero all fields with bfd_zalloc.
- (_bfd_default_link_order): Remove bfd_fill_link_order code.
- Call default_data_link_order.
- (default_fill_link_order): Delete.
- (default_data_link_order): New function.
- * elf32-mips.c (_bfd_mips_elf_final_link): Replace occurrences
- of bfd_fill_link_order with bfd_data_link_order.
- * elf64-alpha.c (elf64_alpha_final_link): Likewise.
- * elf64-mips.c (mips_elf64_final_link): Likewise.
-
- * bfd.c (bfd_scan_vma): Clamp overflows to max bfd_vma value.
- Correct value returned in "end" for "0x<non-hex>".
-
-2002-02-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * cpu-arm.c (processors): Replace 'arch' field with 'mach'.
- (scan): Test against 'mach' field in info structure.
-
-2002-02-14 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (elf_fake_sections): Use SHT_NOBITS when SEC_NEVER_LOAD.
-
-2002-02-14 Matt Fredette <fredette@netbsd.org>
-
- * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Recognize
- EF_M68000.
-
-2002-02-13 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Do not insist on
- non-zero physical addresses when adjusting the LMAs of new
- sections.
-
-2002-02-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-hppa.h (elf_hppa_reloc_final_type): New function stripped
- from _bfd_elf_hppa_gen_reloc_type.
- (_bfd_elf_hppa_gen_reloc_type): Remove duplicate prototype.
- * elf32-hppa.h (elf32_hppa_reloc_final_type): Add protptype.
- * elf32-hppa.c: Include elf32-hppa.h before elf-hppa.h.
- * elf64-hppa.h (elf64_hppa_reloc_final_type): Add protptype.
-
-2002-02-12 Alexandre Oliva <aoliva@redhat.com>
-
- * elf-m10300.c (mn10300_elf_relax_section): Skip section before
- loading its contents if there's nothing to do in it.
-
-2002-02-12 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_size_stubs): Correct test for crossing
- 64k boundary.
-
- * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Add dynamic
- DT_PPC64_OPD and DT_PPC64_OPDSZ tags.
- (ppc64_elf_finish_dynamic_sections): Set values for them.
-
-2002-02-11 Michael Snyder <msnyder@redhat.com>
-
- * elf-bfd.h (elfcore_write_lwpstatus): Add prototype.
- * elf.c (elfcore_grok_pstatus): Add prototype.
- (elfcore_grok_lwpstatus): Add prototype.
- (elfcore_write_lwpstatus): New function.
- (elfcore_write_pstatus): Fix typo, eliminate unnecessary memcpy.
-
-2002-02-11 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c: Added missing prototypes.
- * elf32-sh64.c: Likewise.
- (sh_elf_align_loads): Mark unused args as such.
- * elf64-sh64.c: Added missing prototypes.
- (struct elf_sh64_link_hash_entry): Fix typo.
- (sh_elf64_relocate_section): Fix info argument passed to
- _bfd_elf_section_offset.
-
-2002-02-11 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: "make dep-am".
- * Makefile.in: Regenerate.
- * aclocal.m4: Regenerate.
- * config.in: Regenerate.
- * configure: Regenerate.
-
-2002-02-10 Daniel Jacobowitz <drow@mvista.com>
-
- * coff-rs6000.c (xcoff_generate_rtinit): Silence uninitialized
- variable warnings.
- * elf32-sh.c (sh_elf_relax_section): Silence signed/unsigned
- comparison warning.
- * trad-core.c (trad_unix_core_file_p): Silence pointer/integer
- cast warnings for the common case.
-
-2002-02-10 Hans-Peter Nilsson <hp@bitrange.com>
-
- * config.bfd (sh-*-linux*, sh-*-elf* | sh-*-rtemself*): Add sh64
- vectors.
- (sh-*-netbsdelf*): New, to trump sh*-*-netbsdelf* and add sh64
- vectors.
-
-2002-02-09 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_howto): Add R_ALPHA_BRSGP.
- (elf64_alpha_reloc_map, elf64_alpha_check_relocs): Likewise.
- (elf64_alpha_relocate_section): Likewise.
- * reloc.c (BFD_RELOC_ALPHA_BRSGP): New.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-2002-02-09 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs): Check
- that base-plus-offset reloc accounting is consistent.
- (mmix_elf_relax_section): Keep base-plus-offset reloc accounting
- up to date for undefined symbols.
-
-2002-02-08 Eric Christopher <echristo@redhat.com>
-
- From Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * elf32-mips.c (_bfd_mips_elf_fake_sections): Don't create .rela
- sections for the O32 ABI.
-
-2002-02-08 Chris Demetriou <cgd@broadcom.com>
-
- * elf32-arm.h: Fix formatting of _("...").
- * elf32-d10v.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mips.c: Likewise.
-
-2002-02-08 Ivan Guzvinec <ivang@opencores.org>
-
- * coff-or32.c: Fix compile time warning messages.
-
-2002-02-08 Alexandre Oliva <aoliva@redhat.com>
-
- Contribute sh64-elf.
- 2002-01-23 Alexandre Oliva <aoliva@redhat.com>
- * reloc.c (R_SH_GOTPLT32, R_SH_GOT_LOW16, R_SH_GOT_MEDLOW16,
- R_SH_GOT_MEDHI16, R_SH_GOT_HI16, R_SH_GOTPLT_LOW16,
- R_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_HI16,
- R_SH_PLT_LOW16, R_SH_PLT_MEDLOW16, R_SH_PLT_MEDHI16,
- R_SH_PLT_HI16, R_SH_GOTOFF_LOW16, R_SH_GOTOFF_MEDLOW16,
- R_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_HI16, R_SH_GOTPC_LOW16,
- R_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDHI16, R_SH_GOTPC_HI16,
- R_SH_GOT10BY4, R_SH_GOTPLT10BY4, R_SH_GOT10BY8, R_SH_GOTPLT10BY8,
- R_SH_COPY64, R_SH_GLOB_DAT64, R_SH_JMP_SLOT64, R_SH_RELATIVE64):
- New relocs.
- * libbfd.h, bfd-in2.h: Rebuilt.
- * elf32-sh.c (sh_elf_howto_table): Define new relocs.
- (sh_reloc_map): Map them.
- (PLT_ENTRY_SIZE, elf_sh_plt0_entry_be, elf_sh_plt0_entry_le,
- elf_sh_plt_entry_be, elf_sh_plt_entry_le, elf_sh_pic_plt_entry_be,
- elf_sh_pic_plt_entry_le, elf_sh_plt0_entry, elf_sh_plt_entry,
- elf_sh_pic_plt_entry, elf_sh_sizeof_plt, elf_sh_plt_plt0_offset,
- elf_sh_plt0_gotplt_offset, elf_sh_plt_temp_offset,
- elf_sh_plt_symbol_offset, elf_sh_plt_reloc_offset,
- movi_shori_putval) [INCLUDE_SHMEDIA]: New.
- (elf_sh_link_hash_entry) [INCLUDE_SHMEDIA]: Add
- datalabel_got_offset.
- (sh_elf_link_hash_newfunc): Initialize it.
- (sh_elf_relocate_section): Augment the scope of
- seen_stt_datalabel. Introduce GOTPLT support. Extend GOTPC, PLT,
- GOT and GOTOFF handling to new SHmedia relocation types. Support
- GOT_BIAS.
- (sh_elf_check_relocs): Likewise.
- (sh_elf_finish_dynamic_symbol) [TARGET_SHMEDIA]: Set up values in
- PLT entries using movi_shori_putval. Support GOT_BIAS.
- (sh_elf_finish_dynamic_sections): Likewise.
- * elf32-sh64.c (shmedia_prepare_reloc): Do not add addend to
- relocation, it's now done by the caller.
- (GOT_BIAS): New.
- * elf64-sh64.c (GOT_BIAS, PLT_ENTRY_SIZE, elf_sh64_sizeof_plt,
- elf_sh64_plt_plt0_offset, elf_sh64_plt0_gotplt_offset,
- elf_sh64_plt_temp_offset, elf_sh64_plt_symbol_offset,
- elf_sh64_plt_reloc_offset, ELF_DYNAMIC_INTERPRETER,
- elf_sh64_pcrel_relocs_copied, elf_sh64_link_hash_entry,
- elf_sh64_link_hash_table, sh64_elf64_link_hash_traverse,
- sh64_elf64_hash_table): New.
- (sh_elf64_howto_table): Introduce new relocs.
- (sh_elf64_info_to_howto): Accept new PIC relocs.
- (sh_elf64_relocate_section): Augment the scope of
- seen_stt_datalabel. Support new PIC relocs.
- (sh_elf64_check_relocs): Support new PIC relocs.
- (elf_sh64_plt0_entry_be, elf_sh64_plt0_entry_le,
- elf_sh64_plt_entry_be, elf_sh64_plt_entry_le,
- elf_sh64_pic_plt_entry_be, elf_sh64_pic_plt_entry_le,
- elf_sh64_plt0_entry, elf_sh64_plt_entry, elf_sh64_pic_plt_entry,
- sh64_elf64_link_hash_newfunc, sh64_elf64_link_hash_table_create,
- movi_shori_putval, movi_3shori_putval,
- sh64_elf64_create_dynamic_sections,
- sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies,
- sh64_elf64_size_dynamic_sections,
- sh64_elf64_finish_dynamic_symbol,
- sh64_elf64_finish_dynamic_sections): New.
- (elf_backend_create_dynamic-sections,
- bfd_elf64_bfd_link_hash_table_create,
- elf_backend_adjust_dynamic_symbol,
- elf_backend_size_dynamic_sections,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
- elf_backend_plt_readonly, elf_backend_want_plt_sym,
- elf_backend_got_header_size, elf_backend_plt_header_size):
- Define.
- 2001-05-16 Alexandre Oliva <aoliva@redhat.com>
- * elf32-sh.c: Renumbered and renamed some SH5 relocations to
- match official numbers and names; moved unmaching ones to the
- range 0xf2-0xff.
- * elf32-sh64.c, elf64-sh64.c: Likewise.
- 2001-03-12 DJ Delorie <dj@redhat.com>
- * elf32-sh.c (sh_elf_relax_section): Don't relax SHmedia
- sections.
- 2001-03-12 DJ Delorie <dj@redhat.com>
- * elf32-sh64.c (shmedia_prepare_reloc): Validate relocs that must
- be aligned.
- * elf64-sh64.c (sh_elf64_relocate_section): Ditto.
- 2001-01-14 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c (bfd_elf32_bfd_copy_private_section_data): Define.
- (sh64_elf_fake_sections): Set type to SHT_SH5_CR_SORTED for a
- .cranges section with SEC_SORT_ENTRIES set.
- (sh64_backend_section_from_shdr): Set SEC_SORT_ENTRIES on an
- incoming sorted .cranges section.
- (sh64_bfd_elf_copy_private_section_data): New.
- (sh64_elf_final_write_processing): Only sort .cranges and modify
- start address if called by linker.
- 2001-01-08 Ben Elliston <bje@redhat.com>
- * elf32-sh64.c (sh64_elf_final_write_processing): Activate
- Hans-Peter Nilsson's set bit 0 patch from 2001-01-06.
- * elf64-sh64.c (sh64_elf64_final_write_processing): Ditto.
- 2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf64-sh64.c (sh_elf64_howto_table): No open brace at start of
- line. Add comments before all entries.
- <R_SH_PT_16, R_SH_SHMEDIA_CODE>: Correct and clarify describing
- comment.
- (sh_elf64_reloc): Correct head comment.
- (sh_elf64_relocate_section): Correct spacing.
- <relocating for a local symbol>: Do not honour STO_SH5_ISA32;
- instead call reloc_dangerous callback.
- <case R_SH_SHMEDIA_CODE>: New case.
- (sh_elf64_gc_mark_hook): Correct spacing.
- (sh_elf64_check_relocs): Ditto.
- * elf32-sh64.c (shmedia_prepare_reloc) <case R_SH_SHMEDIA_CODE>:
- New case.
- * elf32-sh.c: Correct #endif comments for #ifndef-wrapped
- functions.
- (sh_elf_howto_table) <R_SH_PT_16, R_SH_SHMEDIA_CODE>: Correct,
- clarify describing comment. Add comments before all entries.
- (sh_elf_relocate_section) <relocating for a local symbol>: Do not
- honour STO_SH5_ISA32; instead call reloc_dangerous callback.
- 2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
- Sort .cranges section in final link. Prepare to set bit 0 on
- entry address.
- * elf32-sh64.c (struct sh64_find_section_vma_data): New.
- (sh64_elf_link_output_symbol_hook): Fix typo in prototype.
- (sh64_elf_set_mach_from_flags): Set SEC_DEBUGGING on incoming
- .cranges section.
- (sh64_backend_section_from_shdr): New, to recognize
- SHT_SH5_CR_SORTED on incoming .cranges section.
- (elf_backend_section_from_shdr): Define.
- (sh64_elf_final_write_processing): Sort outgoing .cranges
- section. (New, temporarily disabled:) Set bit 0 on entry address
- according to ISA type.
- (sh64_find_section_for_address): New.
- (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb,
- crange_bsearch_cmpl): Move here from opcodes/sh64-dis.c.
- (sh64_address_in_cranges): Move here from opcodes/sh64-dis.c. Use
- bfd_malloc, not xmalloc.
- (sh64_get_contents_type): Move here from opcodes/sh64-dis.c. Make
- global.
- * elf32-sh64.c (sh64_elf64_final_write_processing): New, (but
- temporarily disabled) setting bit 0 on entry address.
- (elf_backend_final_write_processing): Define.
- 2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh.c (sh_elf_howto_table) <R_SH_PT_16>: Adjust fields to
- be a proper relocation for PTA and PTB rather than a marker.
- <R_SH_IMMU5, R_SH_IMMS6, R_SH_IMMU6, R_SH_IMMS10, R_SH_IMMS10BY2,
- R_SH_IMMS10BY4, R_SH_IMMS10BY8, R_SH_IMMS16, R_SH_IMMU16,
- R_SH_IMM_LOW16, R_SH_IMM_LOW16_PCREL, R_SH_IMM_MEDLOW16,
- R_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDHI16, R_SH_IMM_MEDHI16_PCREL,
- R_SH_IMM_HI16, R_SH_IMM_HI16_PCREL, R_SH_64, R_SH_64_PCREL>:
- Zero src_mask.
- * elf64-sh64.c: Ditto.
- (sh_elf64_relocate_section) <case R_SH_PT_16>: New case.
- * elf32-sh64.c: Include opcodes/sh64-opc.h
- (shmedia_prepare_reloc): Take a bfd_link_info pointer as first
- argument. Drop const qualifiers from "bfd *" and "bfd_byte *"
- parameters. No unused parameters. Caller changed.
- <case R_SH_PT_16>: New case.
- * Makefile.am (elf32-sh64.lo): Add dependency on sh64-opc.h.
- * Makefile.in: Regenerate.
- 2000-12-30 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf64-sh64.c (sh64_elf64_fake_sections): Set SHF_SH5_ISA32 for
- all code sections.
- (sh_elf64_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
- (sh64_elf_merge_private_data): Ditto.
- * elf32-sh64.c (sh64_elf_fake_sections): Use sh64_elf_section_data
- to access stored section flags.
- (sh64_elf_final_write_processing): Return immediately unless
- called by linker. Use sh64_elf_section_data (cranges) to get size
- of linker-generated cranges entries.
- (sh64_elf_copy_private_data): Add missing "return true".
- (sh64_elf_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
- (sh_elf64_merge_private_data): Ditto.
- 2000-12-19 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf64-sh64.c (sh64_elf64_fake_sections): New, copy of
- elf64-sh64.c:sh64_elf_fake_sections.
- (elf_backend_fake_sections): Define as sh64_elf64_fake_sections.
- 2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c (sh64_elf_copy_private_data_internal): Delete.
- (sh64_elf_final_write_processing): New.
- (elf_backend_final_write_processing): Define.
- (sh64_elf_fake_sections): Get header flags from tdata field.
- (sh64_elf_copy_private_data): Do not call
- sh64_elf_copy_private_data_internal, just copy e_flags field.
- (sh64_elf_merge_private_data): Do not call
- sh64_elf_copy_private_data_internal.
- 2000-12-12 Hans-Peter Nilsson <hpn@cygnus.com>
- Remove EF_SH64_ABI64, let ELF size make difference.
- Remove SH64-specific BFD section flag.
- * elf32-sh64.c (sh64_elf_fake_sections): Recognize section as
- containing SHmedia through elf_section_data (asect)->tdata
- non-zero, not using a BFD section flag.
- (sh64_elf_set_mach_from_flags): Don't recognize EF_SH64_ABI64.
- (sh64_elf_merge_private_data): Similar.
- (elf_backend_section_flags): Don't define.
- (sh64_elf_backend_section_flags): Delete.
- * elf64-sh64.c (sh_elf64_set_mach_from_flags): Recognize EF_SH64,
- not EF_SH64_ABI64.
- (sh_elf64_merge_private_data): Similar.
- * section.c (Section flags definitions): Don't define
- SEC_SH_ISA_SHMEDIA.
- (bfd-in2.h): Regenerate.
- 2000-12-09 Hans-Peter Nilsson <hpn@cygnus.com>
- Make DataLabel references work with partial linking.
- * elf32-sh64.c: Fix formatting.
- (sh64_elf_link_output_symbol_hook): New.
- (elf_backend_link_output_symbol_hook): Define to
- sh64_elf_link_output_symbol_hook.
- (sh64_elf_add_symbol_hook): Make DataLabel symbol just global
- undefined if partial linking. Adjust sanity check.
- * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): New.
- (elf_backend_link_output_symbol_hook): Define to
- sh64_elf64_link_output_symbol_hook.
- (sh64_elf64_add_symbol_hook): Make DataLabel symbol just global
- undefined if partial linking. Adjust sanity check.
- 2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com>
- Implement semantics for inter-file DataLabel references.
- * elf64-sh64.c (DATALABEL_SUFFIX): Define.
- (sh64_elf64_add_symbol_hook): New.
- (sh_elf64_relocate_section): If passing an indirect symbol with
- st_type STT_DATALABEL on the way to a symbol with st_other
- STO_SH5_ISA32, do not bitor 1 to the relocation.
- (elf_backend_add_symbol_hook): Define to
- sh64_elf64_add_symbol_hook.
- * elf64-sh32.c: Tweak comments.
- (DATALABEL_SUFFIX): Define.
- (sh64_elf_add_symbol_hook): New.
- (elf_backend_add_symbol_hook): Define to sh64_elf_add_symbol_hook.
- * elf32-sh.c (sh_elf_relocate_section): If passing an indirect
- symbol with st_type STT_DATALABEL on the way to a symbol with
- st_other STO_SH5_ISA32, do not bitor 1 to the relocation.
- 2000-12-05 Hans-Peter Nilsson <hpn@cygnus.com>
- Pass through STT_DATALABEL.
- * elf32-sh64.c (sh64_elf_get_symbol_type): New.
- (elf_backend_get_symbol_type): Define.
- * elf64-sh64.c (sh64_elf64_get_symbol_type): New.
- (elf_backend_get_symbol_type): Define.
- 2000-11-30 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c: Tweak comments.
- (sh64_elf_copy_private_data_internal): Add prototype.
- (bfd_elf32_bfd_set_private_flags): Define.
- (sh64_elf_copy_private_data_internal): Compare machine name, not
- textual BFD target name, to check whether to copy section flag
- SHF_SH5_ISA32.
- (sh64_elf_merge_private_data): Validize bfd_get_arch_size.
- Tweak section-contents-type-mismatch message.
- (shmedia_prepare_reloc): Add ATTRIBUTE_UNUSED markers.
- Validize reloc-types.
- * elf64-sh64.c: New file.
- * targets.c (bfd_elf64_sh64_vec, bfd_elf64_sh64l_vec): Declare.
- * Makefile.am (BFD64_BACKENDS): Add elf64-sh64.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-sh64.c.
- Regenerate dependencies.
- * Makefile.in: Regenerate.
- * config.bfd (sh64-*-elf*): Add bfd_elf64_sh64_vec and
- bfd_elf64_sh64l_vec.
- * configure.in: Handle bfd_elf64_sh64_vec and
- bfd_elf64_sh64l_vec.
- * configure: Regenerate.
- * po/POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
- 2000-11-29 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c (sh64_elf_set_mach_from_flags): Do not recognize
- anything else but EF_SH64 and EF_SH64_ABI64.
- (sh64_elf_merge_private_data): Emit error for anything else but
- EF_SH64 and EF_SH64_ABI64.
- * config.bfd: Remove bfd_elf32_shblin_vec and bfd_elf32_shlin_vec
- from targ_selvecs.
- * configure.in: Add cofflink.lo to bfd_elf32_sh64_vec and
- bfd_elf32_sh64l_vec as a temporary measure.
- * configure: Regenerate.
- 2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com>
- * cpu-sh.c (arch_info_struct): Include sh5 item
- unconditionalized.
- * config.bfd (sh64-*-elf*): Do not set targ_cflags.
- Add targ_selvecs bfd_elf32_sh_vec, bfd_elf32_shl_vec,
- bfd_elf32_shblin_vec and bfd_elf32_shlin_vec.
- * elf32-sh64.c: Tweak comments.
- (sh64_elf_set_mach_from_flags): Recognize all machine flags that
- are proper subsets of SH64 as bfd_mach_sh5. Add EF_SH64_ABI64.
- (sh64_elf_copy_private_data_internal): Wrap long line.
- (sh64_elf_merge_private_data): Rewrite to allow objects from
- SH64 subsets to be linked together.
- (INCLUDE_SHMEDIA): Define.
- * elf32-sh.c (sh_elf_relocate_section) <local symbol>:
- Parenthesize plus-expression inside or-expression.
- <global symbol>: Ditto.
- (sh_elf_set_mach_from_flags): Remove code refusing
- deleted EF_SH64_32BIT_ABI flag.
- 2000-11-26 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh.c (sh_elf_howto_table) <R_SH_IMM_LOW16_PCREL,
- R_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDHI16_PCREL,
- R_SH_IMM_HI16_PCREL, R_SH_64_PCREL>: Set pcrel_offset to true.
- (sh_elf_relocate_section) <local symbol>: Or 1 in
- calculation of relocation if sym->st_other & STO_SH5_ISA32.
- <global symbol>: Ditto if h->other & STO_SH5_ISA32.
- * elf32-sh64.c (shmedia_prepare_reloc): Add rel->r_addend to
- relocation.
- 2000-11-24 Hans-Peter Nilsson <hpn@cygnus.com>
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh64.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh64.c.
- Regenerate dependencies.
- * Makefile.in: Regenerate.
- * archures.c: Add bfd_mach_sh5.
- * config.bfd: Map targ_cpu sh* to bfd_sh_arch.
- Handle sh64-*-elf*. Set targ_cflags to -DINCLUDE_SHMEDIA.
- * configure.in: Handle bfd_elf32_sh64_vec and bfd_elf32_sh64l_vec.
- * configure: Regenerate.
- * reloc.c (BFD_RELOC_SH_SHMEDIA_CODE, BFD_RELOC_SH_IMMU5,
- BFD_RELOC_SH_IMMS6, BFD_RELOC_SH_IMMS6BY32, BFD_RELOC_SH_IMMU6,
- BFD_RELOC_SH_IMMS10, BFD_RELOC_SH_IMMS10BY2,
- BFD_RELOC_SH_IMMS10BY4, BFD_RELOC_SH_IMMS10BY8,
- BFD_RELOC_SH_IMMS16, BFD_RELOC_SH_IMMU16, BFD_RELOC_SH_IMM_LOW16,
- BFD_RELOC_SH_IMM_LOW16_PCREL, BFD_RELOC_SH_IMM_MEDLOW16,
- BFD_RELOC_SH_IMM_MEDLOW16_PCREL, BFD_RELOC_SH_IMM_MEDHI16,
- BFD_RELOC_SH_IMM_MEDHI16_PCREL, BFD_RELOC_SH_IMM_HI16,
- BFD_RELOC_SH_IMM_HI16_PCREL, BFD_RELOC_SH_PT_16): New relocations.
- * cpu-sh.c [INCLUDE_SHMEDIA] (arch_info_struct): Define and link
- in item for SH5.
- * elf32-sh.c [INCLUDE_SHMEDIA] (sh_elf_howto_table): Add howto items
- for SHmedia relocs.
- [INCLUDE_SHMEDIA] (sh_rel): Add mappings for SHmedia relocs.
- [INCLUDE_SHMEDIA] (sh_elf_relocate_section) [default]: Call
- shmedia_prepare_reloc, goto final_link_relocate if it returns
- non-zero, else fail as before.
- (sh_elf_set_mach_from_flags): Provide function only if not defined
- as macro. Do not recognize objects with EF_SH64_32BIT_ABI set.
- (sh_elf_set_private_flags): Provide function only if not defined
- as a macro.
- (sh_elf_copy_private_data): Similar.
- (sh_elf_merge_private_data): Similar.
- * section.c (SEC_SH_ISA_SHMEDIA): New.
- * targets.c (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec): Declare.
- * elf32-sh64.c: New file.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * po/POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
-2002-02-07 Daniel Jacobowitz <drow@mvista.com>
-
- * bfd-in.h: Update <stdbool.h> check to only see if <stdbool.h> has
- been included, not drag it in.
- * bfd-in2.h: Regenerate.
-
-2002-02-06 H.J. Lu (hjl@gnu.org)
-
- * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Update
- the mach and ISA fields if necessary.
-
-2002-02-06 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coffcode.h (coff_set_arch_mach_hook): Select the highest known
- ARM architecture when an F_ARM_5 flag is detected, since we cannot
- be sure exactly which architecture this represents.
-
-2002-02-05 Nick Clifton <nickc@redhat.com>
-
- * po/tr.po: Updated translation.
-
-2002-02-05 Alan Modra <amodra@bigpond.net.au>
-
- From Jimi X <jimix@watson.ibm.com>
- * archures (bfd_mach_ppc64): Define.
- (bfd_powerpc_arch): Rename to bfd_powerpc_archs.
- (bfd_powerpc_arch): Define.
- * bfd-in2.h: Regenerate.
- * cpu-powerpc.c (arch_info_struct): Rename to bfd_powerpc_archs.
- (bfd_powerpc_arch): Move to tail of bfd_powerpc_archs.
- (bfd_powerpc_archs): Add default powerpc64 arch.
-
-2002-02-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Check for relocs
- against section syms in readonly sections. Don't do the global
- sym check if we find one.
- * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
- * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
- * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
- (elf_s390_grok_prstatus): Add missing prototype.
-
-2002-02-04 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf64-mmix.c (mmix_dump_bpo_gregs): New function.
- (mmix_elf_check_common_relocs) <case R_MMIX_BASE_PLUS_OFFSET>:
- Call bfd_get_section_by_name only once. Initialize
- bpodata->n_bpo_relocs_this_section.
- (_bfd_mmix_prepare_linker_allocated_gregs): Remove comment
- referring to DSOs.
- (bpo_reloc_request_sort_fn): Don't use difference of values as
- return-value.
-
-2002-02-02 David O'Brien <obrien@FreeBSD>
-
- * configure.in: Tweak the FreeBSD 4.x recognition more. Only treat
- version 4.5 and later the same as 5-CURRENT.
- * configure: Re-generate.
-
-2002-02-02 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (hppa*-*-netbsd*): New target.
-
-2002-01-31 Philipp Thomas <pthomas@suse.de>
-
- * coff-arm.c (coff_arm_merge_private_bfd_data): Move ERROR
- to front of message. Unify messages with elf32-arm.h. Use
- commas where neccessary.
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Use all upcase
- ERROR in messages. Unify messages with coff-arm.c. Correct
- VFP/FPA error message.
- (elf32_arm_print_private_bfd_data): Don't mark APCS-26 and
- APCS-32 for translation.
-
-2002-02-01 Hans-Peter Nilsson <hp@bitrange.com>
-
- Perform on-demand global register allocation from
- R_MMIX_BASE_PLUS_OFFSET relocs.
- * elf64-mmix.c (struct bpo_reloc_section_info, struct
- bpo_reloc_request, struct bpo_greg_section_info): New.
- (mmix_elf_check_common_relocs, mmix_elf_gc_sweep_hook,
- bpo_reloc_request_sort_fn, mmix_elf_relax_section,
- _bfd_mmix_check_all_relocs,
- _bfd_mmix_prepare_linker_allocated_gregs,
- _bfd_mmix_finalize_linker_allocated_gregs): New functions.
- (elf_mmix_howto_table): Correct src_mask for most relocs.
- (mmix_elf_perform_relocation) <case R_MMIX_BASE_PLUS_OFFSET>: New
- case.
- (mmix_final_link_relocate) <case R_MMIX_BASE_PLUS_OFFSET>: New
- case. Fix typo in comment. New label do_mmix_reloc.
- (mmix_elf_check_relocs): Abuse bfd_link_info member base_file to
- store first object file with a base-plus-offset reloc. Call
- mmix_elf_check_common_relocs for the part common with mmo.
- (mmix_elf_final_link): Write out linker-allocated register
- contents section.
- (elf_backend_gc_sweep_hook): Define.
- (bfd_elf64_bfd_relax_section): Define.
-
- * mmo.c: Don't include <ctype.h>
- (mmo_init): Correct init-once logic.
-
-2002-02-01 Tom Rix <trix@redhat.com>
-
- * config.bfd: Conditionally support <aiaff> for pre AIX 4.3.
-
-2002-02-01 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Run "make dep-am"
- * Makefile.in: Regenerate.
-
-2002-01-31 David O'Brien <obrien@FreeBSD>
-
- * configure.in: Recognize the differences in core files from FreeBSD
- 4.{0,1} and later versions of 4.x. This treats 4.2+ the same as
- 5-CURRENT.
- * configure: Regenerate.
-
-2002-01-31 Ivan Guzvinec <ivang@opencores.org>
-
- * coff-or32.c: New file.
- * cpu-or32.c: New file.
- * elf32-or32.c: New file.
- * archures.c: Add support for or32.
- * targets.c: Add support for or32.
- * bfd-in2.h: Regenerate.
- * coffcode.h (coff_set_arch_mach_hook, coff_set_flags,
- coff_write_object_contents): Add support for or32.
- * config.bfd: Add target.
- * configure.in: Add support for or32.
- * configure: Regenerate.
- * Makefile.am: Add support for or32.
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Add or32 files.
- * po/bfd.pot: Regenerate.
-
-2002-01-31 Nick Clifton <nickc@cambridge.redhat.com>
- Don Lindsay <lindsayd@cisco.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Replace 'return
- false' with a return of a bfd_reloc_ error code.
-
-2002-01-31 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Don't
- unexport unreferenced symbols when --export-dynamic. Call
- _bfd_elf_strtab_delref when unexporting.
-
-2002-01-30 Daniel Jacobowitz <drow@mvista.com>
-
- * bfd-in.h: Include <stdbool.h> if it is available.
- * bfd-in2.h: Regenerated.
-
-2002-01-31 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (func_desc_adjust): STV_PROTECTED functions should
- not go via the plt.
-
-2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
-
- * archures.c: Tidy up formatting of embedded comments.
- * bfd.c: Tidy up formatting of embedded comments.
- * bfd-in.h: Fix formatting of comments.
- * reloc.c: Tidy up formatting of ordinary & embedded comments.
- * section.c: Tidy up formatting of embedded comments.
- * syms.c: Tidy up formatting of embedded comments.
- * targets.c: Tidy up formatting of embedded comments.
-
- * bfd-in2.h: Regenerate.
-
-2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
-
- * vms-tir.c (cmd_name): New function.
- (tir_cmd_name): New function.
- (etir_sta, etir_sto, etir_opr, etir_stc): Use cmd_name().
- (tir_opr, tir_ctl, tir_cmd): use tir_cmd_name().
- Fix formatting.
-
- * peXXigen.c (pe_print_idata): Rearrange message to aid in
- translation.
- (pe_print_pdata): Rearrange message to aid in translation.
-
- * libbfd.c (warn_deprecated): Rearrange error message to aid in
- translation.
-
- * ihex.c (ihex_write_object_contents): Fix spelling typo.
-
- * ieee.c (ieee_slurp_external_symbols): Remove spurious space.
-
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Rearrange error
- message to aid in translation.
-
- * elf64-mmix.c (mmix_final_link_relocate): Rearrange error message
- to aid in translation.
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix typo.
-
-2002-01-30 Philipp Thomas <pthomas@suse.de>
-
- * coff-arm.c, elf32-elf.h: Unify messages.
-
-2002-01-30 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated translation.
-
-2002-01-30 Philipp Thomas <pthomas@suse.de>
-
- * dwarf2.c (read_abbrev): Use full section name in error message.
- (decode_line_info): Likewise.
-
- * elf.c (_bfd_elf_symbol_from_bfd_symbol): Don't translate debugging
- message.
-
-2002-01-30 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (func_desc_adjust): Only provide missing function
- descriptor symbols for undefined function code syms. Clear
- ELF_LINK_NON_ELF so that they can stay weak.
-
-2002-01-29 Chris Demetriou <cgd@broadcom.com>
- Mitch Lichtenberg <mpl@broadcom.com>
-
- * bfd-in.h (bfd_mips_elf32_create_embedded_relocs): New prototype.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): New function
- to handle 32-bit ELF embedded reloc (ld --embedded-relocs)
- generation.
- * bfd-in2.h: Regenerate.
-
-2002-01-29 Chris Demetriou <cgd@broadcom.com>
-
- * elf32-mips.c: Add additional comments about HI16 relocation
- processing.
- (_bfd_mips_elf_hi16_reloc): Don't subtract address here for
- pc-relative relocations. (Reverts change made on 2001-10-31.)
- (_bfd_mips_elf_lo16_reloc): Subtract address of LO16 part here
- for pc-relative relocations.
- (mips_elf_calculate_relocation): Add a comment about a kludge
- in the R_MIPS_GNU_REL_HI16 handling.
- (_bfd_mips_elf_relocate_section): Implement that kludge;
- adjust pc-relative HI16 relocation for difference in HI16 and
- LO16 addresses, since it can't easily be done in
- mips_elf_calculate_relocation.
-
-2002-01-29 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-i386 (elf_i386_adjust_dynamic_symbol): Do not replace PLT32
- relocations with PC32 relocations for undefined or weak symbols.
- * elf32-s390 (elf_i386_adjust_dynamic_symbol): Likewise.
- * elf64-s390x (elf_i386_adjust_dynamic_symbol): Likewise.
-
-2002-01-28 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elfcore.h (elf_core_file_p): Improve comment for last change.
-
-2002-01-27 Daniel Jacobowitz <drow@mvista.com>
-
- * configure: Regenerated.
-
-2002-01-27 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elfcore.h (elf_core_file_p): Set the machine architecture
- before processing the program headers.
-
-2002-01-26 Hans-Peter Nilsson <hp@bitrange.com>
-
- * configure.in <64-bit configuration>: If using gcc, check and
- emit error for egcs-1.1.2.
- * configure: Regenerate.
-
-2002-01-26 Egor Duda <deo@logos-m.ru>
-
- * elf.c (elfcore_grok_win32pstatus): Copy only as much information
- as possible to avoid stack corruption.
-
-2002-01-26 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Don't set reltext
- for non-allocated sections.
-
-2002-01-25 Mark Kettenis <kettenis@gnu.org>
-
- * elf.c (elfcore_write_prstatus): Make sure we pass the address of
- prstat.pr_reg even if it is a struct.
-
-2002-01-25 Steve Ellcey <sje@cup.hp.com>
-
- * elfxx-ia64.c: Reset AIX vector function overrides for HP-UX.
-
-2002-01-25 Philipp Thomas <pthomas@suse.de>
-
- * coffgen.c (coff_print_symbol): Don't mark info message
- for translation.
-
-2002-01-25 Nick Clifton <nickc@redhat.com>
-
- * po/fr.po: Updated translation.
- * po/es.po: Updated translation.
-
-2002-01-25 Philipp Thomas <pthomas@suse.de>
-
- * coff-alpha.c (alpha_relocate_section): Unify warning message
- for GP relative relocations without GP defined.
- * coff-mips.c (mips_relocate_section): Likewise.
-
-2002-01-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Avoid
- unsigned overflow when new_offset < old_offset.
-
-2002-01-24 Philipp Thomas <pthomas@suse.de>
-
- * bfd.c (_bfd_abort): Fix typo.
-
-2002-01-23 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't suppress
- plt entries for undefweak symbols.
-
-2002-01-23 Steve Ellcey <sje@cup.hp.com>
-
- * targets.c (bfd_elf32_ia64_hpux_big_vec): Add to DEFAULT_VECTOR.
- (bfd_elf64_ia64_hpux_big_vec): Ditto.
- (bfd_elf32_h8300_vec): Ditto.
-
-2002-01-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c: Remove stale part of ABI comment.
- (NO_OPD_RELOCS): Define.
- (ppc64_elf_check_relocs): Use it.
- (ppc64_elf_relocate_section): Here too.
- (build_one_stub): Don't point function syms at the stub. Instead,
- hijack plt.offset.
- (ppc64_elf_relocate_section): Check whether REL24 relocs should
- really go to the stub. Make all dynamic relocs in opd against
- locals.
- (ppc64_elf_finish_dynamic_symbol): Allow for non-standard use of
- plt.offset.
-
-2002-01-22 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (INSN_UNOP): Encode with RB as $sp.
-
-2002-01-22 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Correct sign of
- TOC_BASE_OFF adjustment.
-
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-01-22 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * configure.host (hppa*64*-*-hpux*, hppa*64*-*-linux*): Add new
- host defines.
-
-2002-01-21 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GOTREL>:
- Check for and emit error if sgot is NULL at this point.
-
-2002-01-21 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (ia64*-*-netbsd*): New target.
-
-2002-01-21 Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
-
- * som.c (som_write_space_strings): Comment typo fix.
-
-2002-01-21 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (struct ppc_link_hash_entry): Add is_func and
- is_func_descriptor fields.
- (link_hash_newfunc): Init them.
- (ppc64_elf_check_relocs): Only R_PPC24_REL24 syms starting with a
- dot are candidates for plt entries. When processing .opd relocs,
- set function descriptor strings to point inside function code
- string, and set new ppc_link_hash_entry fields.
- (ppc64_elf_gc_sweep_hook): Don't sweep R_PPC64_REL24 relocs.
- (ppc64_elf_adjust_dynamic_symbol): Remove most code dealing with
- function descriptors. It's now done in..
- (func_desc_adjust): New.
- (ppc64_elf_func_desc_adjust): New.
- (define elf_backend_always_size_sections): Define.
- (ppc64_elf_hide_symbol): New.
- (define elf_backend_hide_symbol): Define.
- (allocate_dynrelocs): Remove code looking up function descriptors
- as that has been done earlier.
- (ppc64_elf_size_dynamic_sections): Use htab shortcut to elf hash
- table.
- (ppc64_elf_finish_dynamic_symbol): Likewise. Remove code looking
- up function descriptor.
- (build_one_stub): Look up the function code sym. Check for
- invalid plt offsets.
- (ppc64_elf_relocate_section): Tweak calls to undefined weak syms.
- Convert R_PPC64_TOC relocs to R_PPC64_RELATIVE in shared libs.
-
- * elf-bfd.h (elf_backend_data <elf_backend_hide_symbol>): Add
- boolean param.
- (_bfd_elf_link_hash_hide_symbol): Likewise.
- * elflink.h (elf_link_add_object_symbols): Adjust call to
- elf_backend_hide_symbol.
- (elf_fix_symbol_flags): Likewise.
- (elf_link_assign_sym_version): Likewise. Use bfd_malloc rather
- than bfd_alloc.
- * elf.c (_bfd_elf_link_hash_hide_symbol): Add "force_local" param.
- Set ELF_LINK_FORCED_LOCAL and call _bfd_elf_strtab_delref.
- * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
- (clobber_millicode_symbols): Adjust to suit new hide_symbol.
- * elf32-cris.c (elf_cris_hide_symbol): Add "force_local" param
- and adjust to suit.
- * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise, and call
- _bfd_elf_link_hash_hide_symbol rather than duplicating code.
- * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
-
-2002-01-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Test for a
- dynamic function descriptor symbol, not the associated function
- symbol.
-
-2002-01-17 Eric Christopher <echristo@redhat.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Fix typo.
-
-2002-01-17 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/bfd.pot: Regenerate.
- * po/fr.po: Regenerate.
-
-2002-01-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (elf_backend_data <elf_backend_section_from_bfd_section>):
- Remove "Elf_Internal_Shdr *" param.
- (_bfd_mips_elf_section_from_bfd_section): Ditto.
- * elf32-mips.c (_bfd_mips_elf_section_from_bfd_section): Ditto.
- * elf32-m32r.c (_bfd_m32r_elf_section_from_bfd_section): Ditto.
- * elf32-v850.c (v850_elf_section_from_bfd_section): Ditto.
- * elf64-mmix.c (mmix_elf_section_from_bfd_section): Ditto.
- * elfxx-ia64.c (elfNN_hpux_backend_section_from_bfd_section): Ditto.
- * elf.c (_bfd_elf_section_from_bfd_section): Allow backend
- function to override special sections. Remove hdr arg from
- backend call, and don't loop.
-
-2002-01-16 Eric Christopher <echristo@redhat.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Set require_jalxp
- on R_MIPS_26 and target is 16bit. Add R_MIPS16_GPREL to list of
- relocations requiring gp0 and gp.
-
-2002-01-16 Richard Earnshaw <rearnsha@arm.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Handle
- EF_ARM_VFP_FLOAT.
- (elf32_arm_print_private_bfd_data): Likewise.
-
-2002-01-16 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/tr.po: Import new version.
-
-2002-01-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_howto_raw): Remove stale FIXMEs.
- (ppc64_elf_reloc_type_lookup): Use proper CTOR reloc.
- (ORI_R0_R0_0): Correct.
-
-2002-01-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (_bfd_elf_create_dynamic_sections): Don't set SEC_CODE
- when plt_not_loaded.
- * elf64-ppc.c (ppc64_elf_create_dynamic_sections): No need to
- clear .plt SEC_CODE here. Create .stub and correct .glink flags.
- (PLT_INITIAL_ENTRY_SIZE): Set to 24.
- (ppc64_elf_glink_code): Delete.
- (PPC64_ELF_GLINK_SIZE): Delete.
- (ADDIS_R12_R2, STD_R2_40R1, LD_R11_0R12, LD_R2_0R12, MTCTR_R11,
- BCTR, ADDIS_R12_R12_1, LD_R2_40R1, NOP, LI_R0_0, B_DOT, LIS_R0_0,
- ORI_R0_R0_0): Define.
- (PLT_CALL_STUB_SIZE, GLINK_CALL_STUB_SIZE): Define.
- (struct ppc_link_hash_table): Add sstub and plt_overflow.
- (ppc64_elf_link_hash_table_create): Init them.
- (ppc64_elf_check_relocs <R_PPC64_REL24>): Refcount .plt entry.
- Don't copy to shared lib.
- (ppc64_elf_check_relocs): Call bfd_set_error on errors.
- (ppc64_elf_gc_sweep_hook <R_PPC64_REL24>): Sweep plt refcount.
- (allocate_dynrelocs <plt>): Don't change function sym here. Make
- room for .stub and .glink code.
- (ppc64_elf_size_dynamic_sections): Handle .stub. Make entry for
- DT_PPC64_GLINK.
- (ppc64_elf_final_link): Rename to ppc64_elf_set_toc. Don't call
- bfd_elf64_bfd_final_link.
- (bfd_elf64_bfd_final_link): Don't define.
- (ppc64_elf_size_stubs): New.
- (build_plt_stub): New.
- (build_one_stub): New.
- (ppc64_elf_build_stubs): New.
- (ppc64_elf_relocate_section <toc relocs>): Remove assert.
- (ppc64_elf_relocate_section): Don't copy R_PPC64_REL24 relocs.
- (ppc64_elf_finish_dynamic_symbol): Don't build stubs here. Set
- DT_PPC64_GLINK entry. Tweak DT_PLTGOT, DT_JMPREL, DT_PLTRELSZ in
- case output sections not separate. Adjust DT_RELASZ to not
- include plt relocs. Set reserved got entry. Set got and plt
- entry size.
- (elf_backend_got_header_size): Set to 8.
- * elf64-ppc.h: New file.
-
-2002-01-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-arm.h (elf32_arm_size_dynamic_sections): When removing
- sections, use bfd_section_list_remove.
- * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
- * elflink.h (elf_link_add_object_symbols): When removing all
- sections, use bfd_section_list_clear.
-
-2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/sv.po: New file: Swedish translation.
- * configure.in (ALL_LINGUAS): Add sv.
- * configure: Regenerate.
-
-2002-01-15 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.
- * elf.c (merge_sections_remove_hook): New function.
- (_bfd_elf_merge_sections): Pass it as 3rd argument to
- _bfd_merge_sections.
- * libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
- * libbfd.h: Rebuilt.
- * merge.c (_bfd_merge_sections): Add remove_hook argument.
- Call remove_hook if a SEC_EXCLUDE section is encountered.
-
-2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-xstormy16.c (xstormy16_reloc_map): Add new field 'table'.
- (xstormy16_reloc_map): Initialise new field with correct howto
- table.
- (xstormy16_reloc_type_lookup): Use 'table' field to locate correct
- howto entry.
-
-2002-01-10 Michael Snyder <msnyder@redhat.com>
-
- * elf.c (elfcore_write_prstatus): Use long instead of pid_t;
- (elfcore_write_pstatus): Use long instead of pid_t;
- * elf-bfd.h: Change prototypes to use long instead of pid_t;
-
-2002-01-09 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elf.c: Update copyright years.
- (elfcore_grok_netbsd_note): Use NT_NETBSDCORE_PROCINFO
- and NT_NETBSDCORE_FIRSTMACH. Improve a comment.
-
-2002-01-08 Michael Snyder <msnyder@redhat.com>
-
- Add capability to write corefile note sections, for gdb.
- * elf.c (elfcore_write_note): New function.
- (elfcore_write_prpsinfo): New function.
- (elfcore_write_prstatus): New function.
- (elfcore_write_pstatus): New function.
- (elfcore_write_prfpreg): New function.
- (elfcore_write_prxfpreg): New function.
- * elf-bfd.h: Add prototypes for above functions.
-
-2002-01-08 Alexandre Oliva <aoliva@redhat.com>
-
- * elf.c (elf_fake_sections): Propagate errors from
- elf_backend_fake_section.
-
-2002-01-07 Jason Thorpe <thorpej@wasabisystems.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh-nbsd.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh-nbsd.c.
- (elf32-sh-nbsd.lo): New rule.
- * Makefile.in: Regenerate.
- * config.bfd (sh*le-*-netbsdelf*): New target.
- (sh*-*-netbsdelf*): New target.
- * configure.in: Include netbsd-core.lo for native sh*-*-netbsd*.
- (bfd_elf32_shnbsd_vec): New vector.
- (bfd_elf32_shlnbsd_vec): New vector.
- * configure: Regenerate.
- * elf32-sh-nbsd.c: New file.
- * targets.c: Update copyright years.
- (_bfd_target_vector): Add bfd_elf32_shlnbsd_vec and
- bfd_elf32_shnbsd_vec.
-
-2002-01-07 Aldy Hernandez <aldyh@redhat.com>
-
- * coff-rs6000.c (READ20): Use bfd_scan_vma.
-
-2002-01-07 Geoffrey Keating <geoffk@redhat.com>
-
- * elflink.h (elf_link_input_bfd): Don't ask for the merged offset
- of a symbol in a section that will be deleted.
-
-2002-01-07 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/es.po: New file: Spanish translation.
- * configure.in (ALL_LINGUAS): Add es.
- * configure: Regenerate.
-
-2002-01-06 Steve Ellcey <sje@cup.hp.com>
-
- * elfxx-ia64.c (is_unwind_section_name): Add target vector as
- argument so we can handle HP-UX specially.
- (elfNN_ia64_hpux_vec): New for use in is_unwind_section_name.
- (elfNN_hpux_backend_section_from_bfd_section): New for support
- of SHN_IA_64_ANSI_COMMON.
- (elfNN_ia64_relax_section): Add support for SHN_IA_64_ANSI_COMMON.
- (is_unwind_section_name): Add special HP-UX support.
- (elfNN_ia64_section_from_shdr): Add support for more sections.
- (elfNN_ia64_fake_sections): Modify is_unwind_section_name call and
- add support for more sections.
- (elfNN_ia64_additional_program_headers): Modify
- is_unwind_section_name call.
- (elfNN_ia64_modify_segment_map): Remove assumption that there is
- only one unwind section in segment.
-
-2002-01-06 Alan Modra <amodra@bigpond.net.au>
-
- * syms.c (_bfd_generic_make_empty_symbol): New function.
- * libbfd-in.h (_bfd_nosymbols_make_empty_symbol): Define as
- _bfd_generic_make_empty_symbol.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * hppabsd-core.c (hppabsd_core_make_empty_symbol): Delete function.
- (hppabsd_core_get_symtab_upper_bound): Don't define.
- (hppabsd_core_get_symtab): Likewise.
- (hppabsd_core_print_symbol): Likewise.
- (hppabsd_core_get_symbol_info): Likewise.
- (hppabsd_core_bfd_is_local_label_name): Likewise.
- (hppabsd_core_get_lineno): Likewise.
- (hppabsd_core_find_nearest_line): Likewise.
- (hppabsd_core_bfd_make_debug_symbol): Likewise.
- (hppabsd_core_read_minisymbols): Likewise.
- (hppabsd_core_minisymbol_to_symbol): Likewise.
- (hppabsd_core_vec): Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols).
- Formatting fixes.
- * hpux-core.c: Similarly.
- * irix-core.c: Similarly.
- * osf-core.c: Similarly.
- * sco5-core.c: Similarly.
- * binary.c (binary_make_empty_symbol): Remove function, define as
- _bfd_generic_make_empty_symbol.
- * ihex.c (ihex_make_empty_symbol): Likewise.
- * mmo.c (mmo_make_empty_symbol): Likewise.
- * ppcboot.c (ppcboot_make_empty_symbol): Likewise.
- * srec.c (srec_make_empty_symbol): Likewise.
- * versados.c (versados_make_empty_symbol): Likewise.
- * vms.c (_bfd_vms_make_empty_symbol): Remove.
- (vms_make_empty_symbol): Define as _bfd_generic_make_empty_symbol.
- * vms-gsd.c (_bfd_vms_slurp_gsd): Call bfd_make_empty_symbol
- rather than _bfd_vms_make_empty_symbol.
- * vms-misc.c (new_symbol): Likewise.
-
-2002-01-05 Alan Modra <amodra@bigpond.net.au>
-
- * section.c (bfd_section_init): Remove unnecessary initialisations.
- (bfd_section_list_clear): New function.
- (bfd_section_list_remove, bfd_section_list_insert): New macros.
- (_bfd_strip_section_from_output): Use them.
- * coffcode.h (coff_set_alignment_hook): Likewise.
- * elf32-mips.c (_bfd_mips_elf_final_link): Likewise.
- * elf64-mips.c (mips_elf64_final_link): Likewise.
- * elf64-mmix.c (mmix_elf_final_link): Likewise.
- * sunos.c (sunos_add_dynamic_symbols): Likewise.
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise.
- * bfd-in2.h: Regenerate.
-
- * netbsd-core.c (netbsd_core_file_p): Use bfd_make_section_anyway
- rather than doing our own section handling. Clean up after errors
- with bfd_release and bfd_section_list_clear. Handle unexpected
- flags.
- * aoutf1.h (sunos4_core_file_p): Likewise.
- * aix386-core.c (aix386_core_file_p): Likewise.
- * cisco-core.c (cisco_core_file_validate): Likewise.
- * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
- * trad-core.c (trad_unix_core_file_p): Likewise.
-
- * hppabsd-core.c (hppabsd_core_core_file_p): Clean up after errors
- with bfd_release and bfd_section_list_clear.
- * hpux-core.c (hpux_core_core_file_p): Likewise.
- * irix-core.c (irix_core_core_file_p): Likewise.
- * lynx-core.c (lynx_core_file_p): Likewise.
- * osf-core.c (osf_core_core_file_p): Likewise.
- * rs6000-core.c (rs6000coff_core_p): Likewise.
- * sco5-core.c (sco5_core_file_p): Likewise.
-
- * elf32-mips.c (_bfd_mips_elf_lo16_reloc): Simplify, and perform
- sign extension adjustments without conditionals.
-
-2002-01-04 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Don't crash if
- CIE at .eh_frame start is removed due to no FDEs referencing it.
-
-2002-01-04 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (x86_64-*-netbsd*): New target.
- * configure.in (x86_64-*-netbsd*): Set COREFILE
- to netbsd-core.lo.
- * configure: Regenerated.
-
-2002-01-03 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Update .pad section ordering
- for recent bfd_make_section_anyway change.
-
-2002-01-03 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Handle
- R_ARM_THM_PC11 reloc.
-
-2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
-
- * configure.in (LINGUAS): Add ja.
- * configure: Regenerate.
- * po/ja.po: Import from translation project's web site.
-
-2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Reformat error
- messages to ease translation into other languages.
-
-For older changes see ChangeLog-0001
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/ChangeLog-9193 b/contrib/binutils/bfd/ChangeLog-9193
deleted file mode 100644
index 01863de..0000000
--- a/contrib/binutils/bfd/ChangeLog-9193
+++ /dev/null
@@ -1,7848 +0,0 @@
-Fri Dec 31 16:23:43 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Minor cleanups suggested by CodeCenter.
- * aoutx.h, coffgen.c, ecoff.c, ecofflink.c, elf.c, libbfd.c,
- linker.c, reloc.c, section.c, srec.c: Added /*ARGSUSED*/ as
- appropriate.
- * aoutx.h (struct external_exec): Removed unnecessary declaration.
- (NAME(aout,some_aout_object_p)): Set some tdata pointers to NULL.
- (adjust_z_magic): Removed useless variable data_vma.
- (stringtab_init): Initialize hash_zero.
- (add_to_stringtab): Removed unused fourth argument.
- (NAME(aout,swap_std_reloc_out)): Removed useless variable
- r_addend.
- (aout_link_input_section): Added some casts.
- * archive.c (get_extended_arelt_filename, do_slurp_coff_armap,
- bfd_ar_hdr_from_filesystem, bsd_write_armap, coff_write_armap):
- Minor code rewriting to make it more C like.
- (do_slurp_bsd_armap): Added some casts.
- * ecoff.c (ecoff_write_object_contents): Removed useless variable
- scn_base.
- (ecoff_write_armap): Added some casts. Use "" rather than "\0".
- * ecofflink.c (bfd_ecoff_write_debug): Added a cast.
- * libaout.h (struct internal_exec): Removed unnecessary
- declaration.
- * linker.c (_bfd_generic_indirect_link_order): Added a cast.
- * opncls.c (new_bfd): Removed a cast.
- * reloc.c (bfd_generic_get_relocated_section_contents): Added
- some casts.
- * srec.c (internal_srec_write_object_contents): Removed useless
- variable bytes_written.
-
-Fri Dec 31 11:46:13 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * i386mach3.c (N_TXTADDR): Don't define after all.
- (TEXT_START_ADDR): Don't include exec header size in value.
-
-Thu Dec 30 15:47:54 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * i386mach3.c (N_TXTADDR): Define.
-
-Thu Dec 30 13:37:24 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Extensive changes to move the bulk of the linker into BFD so that
- more efficient backend code can be written for specific object
- files. Only existing efficient backend is a.out.
- * seclet.c, seclet.h: Removed.
- * hash.c, linker.c, genlink.h: New files.
- * bfd-in.h: Removed bfd_error_vector. Declared hash table
- structures and functions.
- (JUMP_TABLE): Removed bfd_seclet_link, added
- bfd_link_hash_table_create, bfd_link_add_symbols and
- bfd_final_link.
- * All backends: Changed accordingly.
- * bfd-in2.h: Rebuilt.
- * bfd.c (struct _bfd): Added link_next and archive_pass fields.
- Removed ld_symbols field.
- (bfd_nonrepresentable_section, bfd_undefined_symbol,
- bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
- bfd_error_vector): Removed.
- (bfd_default_error_trap, bfd_error_trap,
- bfd_error_nonrepresentabltrap): Removed.
- (bfd_get_relocated_section_contents): Pass link_info. Pass
- link_order instead of seclet. Pass symbols.
- (bfd_relax_section): Pass link_info.
- (bfd_seclet_link): Removed.
- (bfd_link_hash_table_create, bfd_link_add_symbols,
- bfd_final_link): New macros.
- * libbfd-in.h: If __GNUC__ is defined and alloca is not, define
- alloca as __builtin_alloca. Declare internal linking functions.
- * libbfd.h: Rebuilt.
- * libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
- for months.
- * reloc.c (reloc_howto_type): Added error_message argument to
- special_function field. Changed all callers and all definitions.
- (bfd_get_reloc_size): Make argument a const pointer.
- (bfd_perform_relocation): Add error_message argument to hold
- string set if return value if bfd_reloc_dangerous. Changed all
- callers.
- (_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
- * section.c (asection): Renamed seclets_head and seclets_tail to
- link_order_head and link_order_tail.
- * targets.c (bfd_target): Replaced seclet argument with link_info
- and link_order and symbols arguments in
- bfd_get_relocated_section_contents. Added symbols argument to
- bfd_relax_section. Removed bfd_seclet_link. Added
- bfd_link_hash_table_create, bfd_link_add_symbols and
- bfd_final_link.
- * libaout.h (struct aoutdata): Added external_syms,
- external_sym_count, external_strings, sym_hashes fields.
- (obj_aout_external_syms, obj_aout_external_sym_count,
- obj_aout_external_strings, obj_aout_sym_hashes): New accessor
- macros.
- (WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
- * aoutx.h: Wrote new back end linker routines.
- (translate_to_native_sym_flags): Return boolean value. Don't use
- bfd_error_vector.
- (NAME(aout,write_syms)): Return boolean value. Check return value
- of translate_to_native_sym_flags and bfd_write.
- * aout-target.h (final_link_callback): New function.
- (MY_bfd_final_link): New function.
- * aout-adobe.c (aout_adobe_write_object_contents): Check return
- value of aout_32_write_syms.
- * hp300hpux.c (MY(write_object_contents)): Likewise.
- * i386lynx.c (WRITE_HEADERS): Likewise.
- * libaout.h (WRITE_HEADERS): Likewise.
- * bout.c: Changed functions to use link_info->callbacks rather
- than bfd_error_vector, and link_orders rather than seclets.
- * coff-alpha.c: Likewise.
- * coff-h8300.c: Likewise.
- * coff-h8500.c: Likewise.
- * coff-sh.c: Likewise.
- * coff-z8k.c: Likewise.
- * elf32-hppa.c: Likewise.
- * reloc16.c: Likewise.
- * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
- up _gp in the hash table rather than in outsymbols.
- * coff-a29k.c (a29k_reloc): Pass errors back in new error_message
- argument rather than printing them.
- * coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
- link_order arguments rather than seclet. Changed all uses and
- definitions.
- (bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
- all uses and definitions.
- * libcoff.h: Rebuilt.
- * ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
- not by ECOFF, make it scAbs.
- (ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
- rewritten.
- * elf32-mips.c (mips_elf_final_link): Renamed from
- mips_elf_seclet_link and rewritten.
- * elf32-hppa.c (elf32_hppa_stub_description): Added link_info
- field.
- (new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
- hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
- Added link_info arguments. Changed all callers.
- * elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
- not NULL.
- * oasys.c (oasys_write_sections): Return boolean value rather than
- using bfd_error_vector.
- (oasys_write_object_contents): Check return value of
- oasys_write_sections.
- * hosts/std-host.h: Don't declare qsort or strtol.
- * Makefile.in: Rebuild dependencies.
- (BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
- (CFILES): Removed seclet.c. Added hash.c and linker.c.
- (HFILES): Removed seclet.h. Added genlink.h.
-
-Thu Dec 30 07:41:36 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * section.c (bfd_get_section_contents): Return zero filled buffer
- if section has no contents.
-
-Tue Dec 28 12:43:54 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf.c (bfd_elf_generic_reloc): If this is not an inplace reloc,
- then skip bfd_perform_relocation even if the addend is non-zero.
-
-Tue Dec 21 09:22:19 1993 Ken Raeburn (raeburn@rtl.cygnus.com)
-
- * coffcode.h (coff_write_relocs) [SWAP_OUT_RELOC_OFFSET]: Copy
- addend to r_offset field.
-
- * Makefile.in (CFILES): Added coff-sparc.c. Rebuild dependencies.
-
- * coff-sparc.c (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET,
- CALC_ADDEND): Define.
-
- * aix386-core.c (aix386_core_file_p): Use cd_regs[0] for computing
- the offsetof because AIX /bin/cc does not like to take the address
- of an array. (From Minh Tran-Le.)
-
-Thu Dec 16 13:06:32 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * Thu Dec 16 15:41:06 1993 Peter Hoogenboom (hoogen@cs.utah.edu)
-
- * elf32-hppa.c (hppa_elf_build_arg_reloc_stub): Make sure to copy
- the return pointer into %r2 if no jump-in-call-delay-slot
- optimization was done.
-
- * hosts/hp300bsd.h: Correctly identify 4.3BSD vs 4.4BSD.
-
-Wed Dec 15 08:04:16 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * hosts/std-host.h: (time): Don't declare; conflicts on Mach3.
-
- * hosts/i386mach3.h (HOST_PAGE_SIZE): Set to 1 to avoid padding.
- (HOST_SEGMENT_SIZE): Set to 0 for same reason.
-
- * i386mach3.c (PAGE_SIZE, SEGMENT_SIZE): Same changes as above.
- (TEXT_START_ADDR): Correct.
- (MY_backend_data): Define.
-
- * aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic):
- New functions; code moved from aout_<size>_adjust_sizes_and_vmas.
-
-Tue Dec 14 21:48:33 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_begin_writing): Fix thinkos in auxiliary header
- support.
- (bfd_som_attach_aux_hdr): Likewise.
-
-Mon Dec 13 23:34:48 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (hppa_elf_gen_reloc_type): Handle 'T' field
- selectors for PIC code.
-
- * som.c (hppa_som_gen_reloc_type): Handle 'T' field selectors.
- (som_write_fixups): Handle R_DLT_REL, R_FSEL, R_RSEL, R_LSEL
- relocations needed by PIC.
-
-Tue Dec 7 15:47:51 1993 Stu Grossman (grossman at cygnus.com)
-
- * nlmcode.h: Fixes to avoid compiler warnings...
-
-Tue Dec 7 15:10:54 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * libnlm.h (nlm_backend_data): Removed macro definition.
- (nlm_alpha_backend_data): Adjusted accordingly.
-
-Sun Dec 5 19:32:08 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_begin_writing): Flesh out code for handling simple
- auxiliary headers.
- (bfd_som_attach_aux_hdr): New function.
-
- * som.h (struct somdata): Add fields for attaching version and
- copyright headers. Add accessor macros.
-
- * som.c (R_DLT_REL, R_AUX_UNWIND, R_SEC_STMT): Add protected
- definitions for old versions of HPUX which fail to define them.
- (som_hppa_howto_talbe): Add R_DLT_REL, R_AUX_UNWIND, and R_SEC_STMT
- now that they're safe. Delete bogus R_STATEMENT relocations.
-
- * som.c (som_hppa_howto_table): Add missing R_END_TRY. Delete
- extra R_DATA_OVERRIDE.
- (hppa_som_gen_reloc_type): Generate a relocation for the rounding
- mode selector if needed.
- (som_write_fixups): Handle requests for a change in the default
- rounding mode. Rounding modes do not consume input bytes, but
- are just markers much like R_ENTRY and R_EXIT.
-
-Sat Dec 4 19:40:32 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- Fri Dec 3 09:55:17 1993 Pete Hoogenboom (hoogen@cs.utah.edu)
-
- * elf32-hppa.c: (hppa_elf_reloc): Do not do code reordering when
- the branch instruction as originally been nullified.
- hppa_elf_reloc): Avoid useless call to bfd_put_32 () in the
- case of no code reordering due to an LDO instruction in the
- delay slot of the branch. Make sure to relocate the correct
- instruction. Do not perform instruction reordering for millicode
- calls.
- (hppa_elf_build_arg_reloc_stub): Change the relocation type
- to R_HPPA_STUB_CALL_17 when special processing might be needed.
- (hppa_elf_build_long_branch_stub): Prevent code reordering on
- a call from a linker stub to another linker stub and for millicode
- calls. Do not trash the return register for calls from one linker
- stub to a second linker stub.
-
- * elf32-hppa.c: (elf_hppa_howto_table): PLABEL and DLT
- relocations are not pc-relative.
-
- * hppa_stubs.h: (BLE_N_XXX_0_31): New instruction used in
- linker stub code.
- (COPY_2_31): Likewise.
-
-Fri Dec 3 18:40:58 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * config/solaris2.mh (HDEFINES): Remove -Dconst=
- * hosts/solaris.h: If not __GNUC__, define const as empty.
-
-Thu Dec 2 15:43:32 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c: Added various casts for 32/64 bit cross targeting.
- (ecoff_mkobject_hook): Set SEC_SHARED_LIBRARY for the .reginfo
- section so that the linker ignores it.
- * ecofflink.c: Added various casts for 32/64 bit cross targeting.
- (ecoff_add_bytes): Changed need argument to size_t.
- (bfd_ecoff_debug_link_other): Check return value of
- ecoff_add_string.
-
- * libbfd-in.h (new_bfd): Use void rather than an empty parameter
- list.
- * libbfd.h: Rebuilt.
-
- * libnlm.h (struct nlm_obj_tdata): New field backend_data.
- (nlm_backend_data, nlm_alpha_backend_data): New accessor macros.
- (struct nlm_backend_data): New field no_uninitialized_data.
- (nlm_no_uninitialized_data): New accessor macro.
- * nlmcode.h (nlm_compute_section_file_positions): Handle
- no_uninitialized_data.
- (nlm_external_reloc_compare): Sort relocs by address for a
- particular symbol, to make the sort more stable.
- (nlm_write_object_contents): Cast the arguments to qsort. Get the
- value of a debugging symbol the same way we get the value of a
- normal symbol.
- * nlm32-alpha.c: Various changes. Write out GP and .lita relocs.
- Set no_uninitialized_data to true.
- * nlm32-i386.c (nlm32_i386_backend), nlm32-sparc.c
- (nlm32_sparc_backend): Set no_uninitialized_data field false.
- * nlmswap.h (nlm_swap_fixed_header_out): Zero out destination
- before filling it in.
-
-Wed Dec 1 21:47:58 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_section_type, som_decode_symcalss): New functions.
- (som_get_symbol_info): Use them.
- (som_slurp_symbol_table): Set the section of common and undefined
- symbols correctly.
-
-Wed Dec 1 14:15:10 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * elfcode.h (write_relocs): Initialize local var LAST_SYM_IDX, to
- make gcc happy.
-
- * mipsbsd.c: Changes from Ralph Campbell:
- (mips_howto_table_ext): MIPS_RELOC_LO16 should use
- complain_overflow_dont.
- (aout_mips_*_vec): Make name use "a.out" instead of "aout", to
- make gdb happy.
-
- * bfd.c (bfd_errmsgs): Reword invalid-target message.
-
- * config.bfd: For sparc*-*-coff, use sparc-coff.
- * configure.in: Handle sparccoff_vec.
- * targets.c (sparccoff_vec): Declare.
-
- * reloc.c (bfd_get_reloc_size): New function.
- (struct reloc_howto_type): Update documentation of size field.
-
-Wed Dec 1 14:39:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * nlm32-alpha.c: New file; preliminary Alpha NetWare support.
- * config.bfd (alpha-*-netware*): New target; use alpha-nlm.
- * config/alpha-nlm.mt: New file.
- * configure.in (nlm32_alpha_vec): New vector; use nlm32-alpha.o,
- nlm32.o, and nlm.o.
- * Makefile.in (BFD32_BACKENDS): Added nlm32-alpha.o.
- (CFILES): Added nlm32-alpha.c.
- Rebuilt dependencies.
- * targets.c (nlm32_alpha_vec): Declare.
-
- * libnlm.h (struct nlm_backend_data): New fields
- optional_prefix_size, nlm_backend_object_p, nlm_write_prefix,
- nlm_set_public_section, nlm_get_public_offset. Removed unused
- nlm_write_reloc field. Changed nlm_write_import to remove
- unnecessary symbol argument. Renamed nlm_write_externals to
- nlm_write_external, and changed cound argument from bfd_vma to
- bfd_size_type.
- (nlm_optional_prefix_size, nlm_backend_object_p_func,
- nlm_write_prefix_func, nlm_set_public_section_func,
- nlm_get_public_offset_func): New accessor macros.
- (nlm_write_reloc_func): Removed.
- (nlm_write_external_func): Adjusted for field renaming.
- * nlm32-i386.c (nlm_i386_write_import): Renamed from
- nlm_i386_write_reloc. Removed old nlm_i386_write_import which
- just called old nlm_i386_write_reloc.
- (nlm_i386_write_external): Renamed from nlm_i386_write_externals.
- Declared. Changed second argument from bfd_vma to bfd_size_type.
- (nlm32_i386_backend): Adjusted for changes to fields and names.
- * nlm32-sparc.c (nlm_sparc_mangle_relocs): Removed unused,
- ifdeffed out code.
- (nlm_sparc_write_import): Removed second argument.
- (nlm_sparc_write_external): Renamed from
- nlm_sparc_write_externals. Changed second argument from bfd_vma
- to bfd_size_type.
- (nlm32_sparc_backend): Adjusted for changes to fields and names.
- * nlmcode.h: Removed some unused code.
- (nlm_object_p): Don't destroy tdata pointer. Call
- backend_object_p function if it exists.
- (nlm_slurp_symbol_table): Removed unused variable rcount. Call
- set_public_section_func if it exists instead of checking
- NLM_HIBIT.
- (nlm_compute_section_file_positions): Account for
- optional_prefix_size.
- (nlm_write_object_contents): Account for optional_prefix_size.
- Removed useless variable write_reloc_func. Changed declaration
- and call of write_import_func. Call write_prefix_func if it
- exists. Removed unused variables len and temp. Call
- get_public_offset_func if it exists rather than setting NLM_HIBIT.
- * nlmswap.h: Declare functions.
-
- * bfd-in.h (uint64_typeLOW, uint64_typeHIGH): Fully parenthesize
- for clarity.
- (fprintf_vma, sprintf_vma): Use %lx, not %x.
- * bfd-in2.h: Rebuilt.
- * hosts/alphaosf.h (uint64_typeLOW, uint64_typeHIGH): Cast results
- to unsigned long.
-
- * config.bfd: Don't set target64 here, as the setting is ignored.
- * configure.in (ecoffalpha_little_vec): Set target64.
-
- * config/alphaosf.mt (TDEFINES): Removed; setting host parameters
- in TDEFINES is wrong.
-
- * coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
- Remove unused variable output_section.
-
-Tue Nov 30 16:45:23 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * irix-core.c: New file for Irix 4 and Irix 5 core support.
- Functions taken out of coff-mips.c. Handle vmap type VMAPFILE.
- * coff-mips.c: Irix 4 core file support moved to irix-core.c.
- * targets.c: If IRIX_CORE defined, include irix_core_vec in
- target_vector.
- * config/irix4.mh (HDEFINES): Add -DIRIX_CORE.
- (HDEPFILES): Define to be irix-core.o.
- * config/irix5.mh (HDEFINES): Define to be -DIRIX_CORE.
- (HDEPFILES): Define to be irix-core.o.
- * Makefile.in (OPTIONAL_BACKENDS): Added irix-core.o. Removed
- sco5-core.o, which no longer exists.
- (CFILES): Added all *-core.c files.
- Rebuilt dependencies.
-
-Wed Nov 24 02:02:41 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (map_program_segments): Restore check of file_size !=
- mem_size, but only if SHT_PROGBITS.
-
- * ecofflink.c: New file to hold ECOFF debug information linking
- routines.
- * ecoff.c (ecoff_clear_output_flags, ecoff_rel, ecoff_dump_seclet,
- ecoff_add_string, ecoff_get_debug): Removed. Functionality now in
- ecofflink.c.
- (ecoff_get_extr, ecoff_set_index): New functions.
- (ecoff_slurp_symbolic_info): Don't save raw_size.
- (ecoff_bfd_seclet_link): Rewrote to use ecofflink.c functions.
- (ecoff_compute_section_file_positions): Don't set EXEC_P just
- because there is a start address.
- (ecoff_write_object_contents): Handle external symbols here. Use
- ecofflink.c functions to write out debugging information.
- * elf32-mips.c (mips_elf_read_ecoff_info, mips_elf_get_extr,
- mips_elf_set_index): New functions.
- (mips_elf_seclet_link): Discard empty sections, the .options
- section and .gptab sections. Handle linking .mdebug section.
- * libecoff.h (ecoff_data_type): Removed raw_size and ifdbase.
- * libelf.h (elf_symbol_type): Added mips_extr to tc_data union.
- * bfd-in.h: Added prototypes for routines in ecofflink.c (some are
- called by gas, so they are public).
- * bfd-in2.h: Rebuilt.
- * Makefile.in (BFD_LIBS): Added ecofflink.o.
- (CFILES): Added ecofflink.c.
- (ecofflink.o): New target. Rebuilt dependencies.
-
-Mon Nov 22 22:26:42 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (hppa_object_p): Also recognize SHARED_MAGIC_CNX as
- a valid magic number if it's been defined.
-
-Mon Nov 22 14:17:36 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_mkobject): Don't create .scommon section; linker
- no longer requires it.
- (ecoff_bfd_seclet_link, ecoff_sizeof_headers,
- ecoff_write_object_contents): Don't treat .scommon section
- specially.
-
-Mon Nov 22 10:54:27 1993 Fred Fish (fnf@cygnus.com)
-
- Merged changes from kev@spuds.geg.mot.com (Kevin A. Buettner):
- * config/delta88.mh (HDEFINES): Define this to be -DPTRACE_CORE.
- * config/delta88.mh (HDEPFILES): Defined to be ptrace-core.o.
- * ptrace-core.c: New file for dealing with core files with
- start with the ptrace_user structure found on BCS compliant systems.
- * targets.c (ptrace_core_vec): New vector.
-
-Mon Nov 22 02:33:12 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * Minimal support for reading SOM fixup streams. Allows
- objdump -r to do something reasonable.
- * som.c (som_get_reloc_upper_bound): Implement.
- (som_canonicalize_reloc): Implement.
- (som_set_reloc_info, som_slurp_reloc_table): New functions.
-
-Sun Nov 21 13:46:55 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * hosts/lynx.h (FPRINTF_ALREADY_DECLARED): Define.
- * hosts/sparclynx.h: Include lynx.h instead of duplicating it.
-
-Fri Nov 19 14:34:04 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-a29k.c (a29k_reloc): For R_IREL, don't left shift
- signed_value before sign extending it. Don't subtract out
- reloc_entry->address. This makes it compatible with what gas is
- generating.
-
- * elfcode.h (elf_fake_sections): Accept .sbss as the name for a
- SHT_NOBITS sections.
- (map_program_segments): Don't leave the loop after the first
- SHT_NOBITS section.
- (assign_file_positions_except_relocs): Only force sh_offset and
- sh_addr to match modulo maxpagesize for a section which is not
- SHT_NOBITS. Changed the method used to force page alignment after
- a SHT_NOBITS section to only do it for the last such consecutive
- section, and to really force page alignment.
-
-Fri Nov 19 04:02:01 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * coffcode.h (coff_slurp_symbol_table): Print more verbose message
- in the case of an unknown (or unhandled) storage class.
-
- * config/i386-lynx.mt (TDEFINES): FPRINTF_ALREADY_DECLARED should
- not be defined here, since it is a host attribute, not a target
- one.
- * config/m68k-lynx.mt, config/sparc-lynx.mt: Ditto.
-
- * coffcode.h (coff_bfd_reloc_type_lookup): Don't define if already
- defined.
-
- * coff-sparc.c: Define some relocations, based on ELF relocations.
- (enum reloc_type, bfd_coff_generic_reloc, coff_sparc_howto_table,
- struct coff_reloc_map, sparc_reloc_map,
- coff_sparc_reloc_type_lookup): Borrowed from elf32-sparc.c and
- elf.c, renamed.
- (coff_bfd_reloc_type_lookup): Define to be coff_sparc_reloc_....
- (rtype2howto): Index into coff_sparc_howto_table using
- dst->r_type.
-
-Thu Nov 18 11:45:39 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * config.bfd (mips*-*-irix5*): New target; use mipsbelf.
- * configure.host (mips-sgi-irix5*) New host; use irix5 (no
- hosts/irix5.h created; just use std-host.h).
- * config/irix5.mh: New file; like irix4.mh, but don't use -G or
- -lmalloc.
- * Makefile.in: Rebuilt dependencies.
-
- * ecoffswap.h: Changed type of internal pointers for swap out
- functions to const *.
-
- * elf32-mips.c (mips_elf_got16_reloc): New function. Handle GOT16
- correctly for assembler, but linker support not implemented.
- (elf_mips_howto_table): Use mips_elf_got16_reloc for GOT16.
- (mips_elf_sym_is_global): New function; at least on Irix 5, all
- non section symbols are considered global.
- (elf_backend_sym_is_global): Define.
- (mips_elf_final_write_processing): New function. Set the MIPS
- architecture level correctly.
- (elf_backend_final_write_processing): Define.
- (mips_elf_section_from_shdr): Handle SHT_MIPS_OPTIONS.
- (mips_elf_fake_sections): Set entsize of .mdebug or .reginfo
- section to 1. Handle .options section.
- (mips_elf_acom_section, mips_elf_acom_symbol,
- mips_elf_acom_symbol_ptr): New static variables, used to build a
- generic .acommon section to hold SHN_MIPS_ACOMMON symbols.
- (mips_elf_symbol_processing): Handle SHN_MIPS_ACOMMON symbols by
- putting them all in a global .acommon section.
-
- * elfcode.h (bfd_section_from_shdr): Don't dump core if target
- section has no ELF section data.
- (elf_make_sections): Set addralign of reloc section to 4.
- (elf_fake_sections): Likewise.
- (map_program_segments): Don't consider section 0.
- (assign_file_positions_except_relocs): Don't consider section 0.
- In the main loop, skip the symtab and strtab sections, since their
- positions are set elsewhere.
- (swap_out_syms): Set addralign of symtab section to 4. Set
- addralign of strtab sections to 1.
- (assign_file_positions_for_relocs): Don't consider section 0.
- (write_object_contents): Don't write out section 0.
-
- * libelf.h (struct elf_backend_data): Added fields
- elf_backend_sym_is_global and elf_backend_final_write_processing.
- * elf32-target.h (elf32_bed): Added corresponding initializers.
- * elf64-target.h (elf64_bed): Likewise.
- * elfcode.h (sym_is_global): Take abfd argument. Call
- elf_backend_sym_is_global if it is not NULL.
- (elf_map_symbols): Pass abfd to sym_is_global.
- (write_object_contents): Call elf_backend_final_write_processing
- if it is defined.
-
-Wed Nov 17 18:43:28 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libecoff.h: Include coff/ecoff.h.
- (struct ecoff_backend_data): Move external debugging information
- fields into a single field pointing to an ecoff_debug_swap
- structure.
- (ecoff_data_type): Move debugging information fields into a single
- field pointing to an ecoff_debug_info structure.
- * coff-alpha.c, coff-mips.c, ecoff.c: Corresponding changes.
-
-Wed Nov 17 17:38:58 1993 Sean Eric Fagan (sef@cygnus.com)
-
- * nlmswap.h: New file to swap fixed header. Included by NLM
- backends.
- * libnlm.h (struct reloc_and_sec): Define.
- (struct nlm_backend_data): Add fields fixed_header_size,
- nlm_read_import, nlm_write_import, nlm_swap_fhdr_in,
- nlm_swap_fhdr_out.
- (nlm_fixed_header_size, nlm_read_import_func,
- nlm_write_import_func, nlm_swap_fixed_header_in_func,
- nlm_swap_fixed_header_out_func, nlm_write_external_func): New
- accessor macros.
- * nlmcode.h: Use new functions.
- * nlm32-i386.c: Provide new functions.
- * nlm32-sparc.c: New file; SPARC NLM backend.
-
-Wed Nov 17 13:56:10 1993 Stan Shebs (shebs@rtl.cygnus.com)
-
- * i386lynx.c (swap_std_reloc_in, swap_ext_reloc_in): Ignore
- garbage bits appearing in the upper end of symbolnums.
-
- * config/sparc-lynx.mt (TDEFINES): Add -DFPRINTF_ALREADY_DECLARED.
-
-Tue Nov 16 17:03:41 1993 Stu Grossman (grossman at cygnus.com)
-
- * lynx-core.c (lynx_core_file_p): Change bfd_zalloc to bfd_alloc.
- * m68klynx.c: Define core file macros.
- * hosts/i386lynx.h, hosts/m68klynx.h, hosts/lynx.h: Move all
- non-architecture specific stuff into lynx.h.
-
-Tue Nov 16 15:45:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * i386linux.c: Define new macro ZMAGIC_DISK_BLOCK_SIZE to 1024, and
- change PAGE_SIZE to 4096.
-
-Mon Nov 15 11:48:08 1993 Ken Raeburn (raeburn@rtl.cygnus.com)
-
- * Makefile.in (diststuff): New target.
-
- * VERSION: Updated.
-
-Sun Nov 14 23:33:01 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_object_setup): Do not create dummy ".text", ".data",
- and ".bss" sections.
- (setup_sections): Do not set SEC_HAS_CONTENTS if a section's size
- is zero. Recognize BSS type sections and turn off SEC_LOAD and
- SEC_DATA (so binutils/size works). Set the correct value for
- a section's _raw_size.
- (som_slurp_symbol_table): Program entry points, and millicode are
- also functions. Mark them as such. Also mark L$* symbols as
- debugging symbols.
-
- * bfd-in2.h: Rebuilt.
-
-Sat Nov 13 15:27:15 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_reloc_type_lookup): Add missing prototype. Returns
- a pointer to constant data. Delete bogus #define which made the
- function useless.
-
- * som.c (som_prep_for_fixups): New function.
- (som_write_fixups): New function.
- (som_write_space_strings): New function.
- (som_write_symbol_strings): New function.
- (som_begin_writing): New function.
-
-Fri Nov 12 15:29:36 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_write_object_contents): Do not abort. Flesh out.
- (som_set_section_contents): Do not abort. Flesh out.
-
- * som.c (som_write_headers): New function.
- (som_prep_headers): New function.
- (som_build_and_write_symbol_table): New function.
-
- * som.c (som_sizeof_headers): Add missing prototype.
- (som_set_arch_mach): Do not abort.
-
- * som.c (som_count_spaces): New function.
- (som_count_subspaces): New function.
- (compare_syms): New function.
- (som_compute_checksum): New function.
-
- * som.c (hppa_som_gen_reloc_type): New function.
- (som_bfd_reloc_type_lookup): New function.
-
- * som.c (try_prev_fixup): New function.
- (som_reloc_skip): New function.
- (som_reloc_addend): New function.
- (som_reloc_call): New function.
-
- * som.c (som_initialize_reloc_queue): New function.
- (som_reloc_queue_insert): Likewise.
- (som_reloc_queue_fix): Likewise.
- (som_reloc_queue_find): Likewise.
-
- * som.c (som_hppa_howto_table): SOM howto relocation table.
- (hppa_som_reloc): New function.
-
- * som.c (struct reloc_queue): New structure to keep track of
- the last four multibyte relocations emitted.
- (enum pa_symbol_type): Type to fully describe the symbol types
- associated with .import/.export assembler directives.
-
- * som.c: Include libhppa.h
-
- * som.c (bfd_som_set_section_attributes): New function.
- (bfd_som_set_subsection_attributes): Likewise.
- (bfd_som_set_symboL_type): Likewise.
- (bfd_som_attach_unwind_info): Likewise.
- * som.h: Declare new exported functions.
-
- * som.h (struct som_symbol): Add new fields to hold additional
- information needed to build/write symbol tables and fixup streams.
- (struct som_section_data_struct): Add new fields to hold additional
- information needed to build/write space and subspace headers.
- (som_symbol_data): New accessor macro for SOM symbol information.
- (R_HPPA_*): Basic relocation types to be used by the assembler.
-
-Fri Nov 12 11:00:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * trad-core.c (trad_unix_core_file_p): If new hook
- TRAD_CORE_ALLOW_ANY_EXTRA_SIZE defined, then skip the check for the
- corefile being too big.
- * hosts/i386sco.h: Define it.
-
-Thu Nov 11 15:16:28 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * bfd.c (struct _bfd): Add hppabsd_core_data.
- * targets.c (target_vector): Add hppabsd_core_vec.
- * hpux-core.c (hpux_core_core_file_p): Fail if an unknown core
- section is encountered during core section scanning.
- * hppabsd-core.c: New file.
- * config/hppabsd.mh: Enable HPPA BSD core files.
-
- * elf32-hppa.c (hppa_elf_reloc): Remove DEFUN crud. Remove code
- which is either commented out or ifdef'd out. Add, update and
- clean comments. Fix various indention and spacing problems. Handle
- problems related to using "ble" to jump to a stub rather than "bl"
- (%r31 is trashed by "ble", but not by "bl").
- (NEW_INSTRUCTION): Put inside curly braces.
- (CURRENT_STUB_OFFSET): Fix indention problems.
- (hppa_elf_build_arg_reloc_stub): Fix indention and spacing problems.
- Add, update and clean comments. Handle "ble" %r31 lossage problems.
- (hppa_elf_build_long_branch_stub): Likewise.
- (hppa_look_for_stubs_in_section): Likewise.
- (hppa_elf_stub_check): Remove obsolete function.
-
- * hppa_stubs.h: Add new instructions to deal with %r31 lossage
- problems. Delete unused instructions.
-
-Tue Nov 9 11:40:27 1993 Stan Shebs (shebs@rtl.cygnus.com)
-
- * m68klynx.c (TARGET_IS_BIG_ENDIAN_P): Define.
-
-Tue Nov 9 11:26:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (elf_object_p): Rather than looking through an array
- of architectures, get the ELF EM_xxx code from the backend
- information. Let the generic ELF target match any EM_xxx code not
- matched by another ELF target. Call elf_backend_object_p to let
- the backend do more checks and set global information.
- * libelf.h (struct elf_backend_data): Added elf_machine_code and
- elf_backend_object_p fields.
- (struct bfd_elf_arch_map): Removed.
- (bfd_elf_arch_map, bfd_elf_arch_map_size): Don't declare.
- * elf32-target.h, elf64-target.h: Initialize elf_machine_code
- field with ELF_MACHINE_CODE. Initialize elf_backend_object_p
- field with elf_backend_object_p (if it is defined).
- * elf32-gen.c, elf32-hppa.c, elf32-i386.c, elf32-i860.c,
- elf32-m68k.c, elf32-m88k.c, elf32-mips.c, elf32-sparc.c,
- elf64-gen.c (ELF_MACHINE_CODE): Defined.
- * elf32-mips.c: Include ecoffswap.h to get ECOFF swapping
- routines.
- (mips_elf_object_p): Set the right machine number.
- (mips_elf_ecoff_debug_swap): Defined.
- (elf_backend_object_p): Defined to be mips_elf_object_p.
- (elf_backend_ecoff_debug_swap): Defined to be
- mips_elf_ecoff_debug_swap.
- * elf.c (bfd_elf_arch_map, bfd_elf_arch_map_size): Removed.
-
- * libbfd-in.h (target_vector, default_vector): Declare.
- * libbfd.h: Rebuilt.
- * format.c (target_vector, default_vector): Don't declare.
-
- * elf32-mips.c (elf_mips_howto_table): Don't complain on overflow
- for R_MIPS_26. Correct overflow detection requires matching the
- upper four bits of the destination against the PC. From Ted Lemon
- <mellon@pepper.ncd.com>.
-
- * bout.c (b_out_reloc_type_lookup): Return type should point to
- const data.
- * coff-i960.c (coff_i960_reloc_type_lookup): Likewise.
- * elf32-hppa.c (elf_hppa_reloc_type_lookup): Likewise.
- * mipsbsd.c (MY(reloc_howto_type_lookup)): Likewise.
- * coff-i386.c (coff_i386_reloc): Made howto const.
- * oasys.c (oasys_write_data): Made how const.
-
- * libelf.h: Added some comments.
- (struct elf_backend_data): Added elf_backend_ecoff_debug_swap
- field. Removed unused write_relocs field.
- * elf32-target.h: Adjusted elf_backend_data initialization
- accordingly.
- * elf64-target.h: Corrected elf_backend_data initialization to
- fill in all fields and to set elf_64_p to 1.
-
-Mon Nov 8 18:13:14 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (bfd_section_from_shdr): Remove duplicate assignment
- to filepos in SHT_STRTAB case.
- (assign_file_position_for_section): Set BFD section filepos as
- well as ELF section sh_offset.
-
- * reloc.c: Use const instead of CONST.
- (bfd_perform_relocation): Make variable howto a const pointer.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-Mon Nov 8 12:19:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * Makefile.in (realclean): Don't remove generated headers. Reverts
- change of 2 Jul 1993.
-
-Mon Nov 8 06:08:31 1993 D. V. Henkel-Wallace (gumby@cirdan.cygnus.com)
-
- * configure.bfd: make unixware equivalent to sysv4.
-
- * config/i386-nlm.mt: bring in elf config; make it the default.
-
-Sun Nov 7 20:21:38 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * libbfd.c (bfd_put_8): Add parens around reference to "val"
- argument.
-
-Fri Nov 5 21:45:09 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * hosts/i386mach3.h (HOST_SEGMENT_SIZE),
- i386mach3.c (SEGMENT_SIZE, TEXT_START_ADDR): Correct values (?).
-
-Fri Nov 5 15:17:57 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coffcode.h (coff_write_object_contents): Zero out internal_a.
-
-Fri Nov 5 10:41:07 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h, archive.c, archures.c, bfd.c, cache.c, coffcode.h,
- core.c, ctor.c, format.c, init.c, libbfd.c, opncls.c, reloc.c,
- section.c, syms.c, targets.c:
- Doc cleanup (spelling, punctuation, grammar, formatting).
- * bfd-in2.h, libbfd.h: Rebuild.
-
-Thu Nov 4 14:46:14 1993 John Gilmore (gnu@rtl.cygnus.com)
-
- * bfd-in.h (bfd_get_cacheable, bfd_set_cacheable): New accessors.
- * bfd.c, opncls.c: Improve comments on file descriptor cacheing.
-
-Thu Nov 4 08:54:30 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * From Pete Hoogenboom (hoogen@cs.utah.edu)
- * elf32-hppa.c (hppa_elf_get_section_contents): Fix logic error
- in last change. Always rebuild symbol extension section the first
- time though if output sections exist (fixes ld -r problems).
-
-Thu Nov 04 08:08:46 1993 Jeffrey Wheat (cassidy@cygnus.com)
-
- * Makefile.in: Add .PHONY for check and installcheck rules.
-
-Tue Nov 2 14:42:27 1993 Bill Cox (bill@tarkas.cygnus.com)
-
- * libbfd-in.h (artdata): Use long, not time_t for portability, at
- least to HPUX. File below is a derived file.
-
-Tue Nov 2 14:42:27 1993 Bill Cox (bill@tarkas.cygnus.com)
-
- * libbfd.h (artdata): Use long, not time_t for portability, at
- least to HPUX.
-
-Tue Nov 2 09:32:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.bfd: Use bigmips for mips*-*-bsd*.
-
-Mon Nov 1 14:30:09 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (elf_slurp_reloca_table, elf_slurp_reloc_table):
- Handle symbol number of zero.
-
- * reloc.c (enum bfd_reloc_code_real): Added
- BFD_RELOC_MIPS_LITERAL, BFD_RELOC_MIPS_GOT16,
- BFD_RELOC_MIPS_CALL16, BFD_RELOC_MIPS_GPREL32.
- * bfd-in2.h: Rebuilt.
- * coff-mips.c (mips_bfd_reloc_type_lookup): Handle
- BFD_RELOC_MIPS_LITERAL.
- * elf32-mips.c (mips_reloc_map): Handle new relocs.
- (mips_elf_hi16_reloc, mips_elf_lo16_reloc): Rearrange _gp_disp
- checks slightly.
-
- * aout-target.h (MY_bfd_debug_info_start, MY_bfd_debug_info_end,
- MY_bfd_debug_info_accumulat [sic]): Remove unused definitions.
- (MY_bfd_get_relocated_section_contents, MY_bfd_relax_section,
- MY_bfd_seclet_link): Define.
- (MY_bfd_reloc_type_lookup): Rename from
- MY_reloc_howto_type_lookup.
- (MY_bfd_make_debug_symbol): Rename from MY_make_debug_symbol.
- (MY(vec)): Use JUMP_TABLE rather than listing functions.
- * hp300hpux.c (MY_get_symtab, MY_get_symtab_upper_bound,
- MY_canonicalize_reloc, MY_write_object_contents): Don't define in
- terms of MY, because that causes a recusive invocation of CAT when
- expanded within JUMP_TABLE, and ANSI compilers don't expand
- recursive macros.
- * mipsbsd.c (MY_bfd_reloc_type_lookup): Rename from
- MY_reloc_howto_type_lookup, and don't define in terms of MY.
- (MY_canonicalize_reloc): Don't define in terms of MY.
- (aout_mips_little_vec, aout_mips_big_vec): Use JUMP_TABLE rather
- than listing functions.
-
-Mon Nov 1 09:12:25 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.bfd: Use m68k-elf for m68*-*-sysv4*.
-
-Sun Oct 31 09:35:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * targets.c: Move enum target_flavour outside of struct and change
- the name to enum bfd_flavour. This means bfd clients can use it.
- * bfd-in.h: Add macro bfd_get_flavour.
- * bfd-in2.h: Rebuilt.
-
- * som.c: Add comment about how abort() on corrupt executable is evil.
-
-Sat Oct 30 12:27:09 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h (aout,slurp_reloc_table): Avoid a goto.
-
-Fri Oct 29 16:04:33 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * gen-aout.c, libbfd.c: exit(1) instead of exit(-1).
-
-Fri Oct 29 13:17:21 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd-in.h: Added commands for object file flag values.
- * bfd-in2.h: Rebuilt.
- * elfcode.h (elf_object_p): If type is ET_DYN, set DYNAMIC flag,
- not EXEC_P.
- * bout.c, coff-h8300.c, coff-sh.c: Add BFD_IS_RELAXABLE to
- object_flags field for target vector.
- * aix386-core.c, aout-adobe.c, aout-target.h, bout.c, coff-a29k.c,
- coff-alpha.c, coff-apollo.c, coff-h8300.c, coff-h8500.c,
- coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c, coff-mips.c,
- coff-rs6000.c, coff-sh.c, coff-we32k.c, coff-z8k.c, hpux-core.c,
- ieee.c, mipsbsd.c, nlm-target.h, oasys.c, osf-core.c, som.c,
- srec.c, tekhex.c, trad-core.c: Remove DYNAMIC from object_flags
- field for target vector.
-
-Thu Oct 28 20:02:31 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * hosts/std-host.h: Don't declare time; causes error on mach3.
- * configure.in (i386mach3_vec): Require aout32.o stab-syms.o.
-
-Thu Oct 28 16:33:26 1993 Stan Shebs (shebs@rtl.cygnus.com)
-
- LynxOS and Sparc LynxOS changes:
- * config.bfd: Recognize sparc-*-lynxos*.
- * configure.host: Recognize sparc-*-lynxos*.
- * configure.in: Recognize Sparc Lynx vectors.
- * targets.c (sparclynx_aout_vec): Declare.
- (sparclynx_coff_vec): Declare.
- (target_vector): Add them.
- * cf-i386lynx.c: New file, renamed from i386lynx-cf.c.
- * cf-m68klynx.c: New file, renamed from m68klynx-cf.c.
- * cf-sparclynx.c: New file, support for coff in Sparc LynxOS.
- * coff-sparc.c: New file, basic Sparc coff support.
- * sparclynx.c: New file, support for a.out in Sparc LynxOS.
- * Makefile.in: Change filenames appropriately, add Sparc rules.
- * coffcode.h (coff_set_arch_mach_hook): Recognize Sparc magic
- number.
- (coff_set_flags): Use LynxOS magic number for i386, m68k, and
- Sparc LynxOS, set Sparc magic number for Sparcs.
- * config/m68k-lynx.mt (SELECT_VECS): Remove redundant vector.
- * config/sparc-lynx.mt: New file.
- * hosts/i386lynx.h: Cosmetic improvements.
- * hosts/m68klynx.h: Add ifdefs, #define of cfree.
- * hosts/sparclynx.h: New file.
-
-Thu Oct 28 16:23:40 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- gcc -Wall lint:
- * coff-h8300.c (h8300_reloc16_estimate): Declare return type.
- Remove useless statement probably left by code copy.
- * cpu-i960.c (compatible): Fully bracket matrix initializer.
- * elf32-hppa.c (hppa_elf_build_arg_reloc_stub): Use bfd_xmalloc
- rather than xmalloc. Use realloc and check the return value
- rather than xrealloc.
- (hppa_elf_get_section_contents): Add some casts.
- * elf32-i386.c (elf_i386_reloc_type_lookup): Remove unused
- variable. Add default case to switch.
- * hp300hpux.c: Declare aout_32_write_syms.
- * i386bsd.c, i386linux.c, netbsd386.c (N_SHARED_LIB): Define as 0
- (definition from aout/aout64.h is always 0 anyhow).
- * i386lynx.c (swap_std_reloc_in): Remove unused variable.
- * ieee.c (ieee_write_id): length can never be negative.
- (read_id): Likewise.
- (ieee_archive_p): Remove unused variable.
- * libcoff-in.h (bfd_perform_slip): Declare.
- * libcoff.h: Rebuilt.
- * oasys.c (oasys_write_sections): Remove zero initialization of
- static structure.
- * reloc16.c: Indentation change.
-
-Wed Oct 27 16:51:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * configure.in, config/i386-mach3.mt: Update for new configuration
- (--with-targets and so on).
- * hosts/i386mach3.h: Declare errno.
- * targets.c: Declare i386mach3_vec.
-
-Wed Oct 27 12:18:07 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * nlmcode.h (nlm_swap_auxiliary_headers_in,
- nlm_swap_auxiliary_headers_out): Handle sharedDebugRecordOffset
- and sharedDebugRecordCount fields.
-
-Tue Oct 26 16:21:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * targets.c (target_vector): Remove SCO_CORE. On Sep 11 1993,
- we started using trad-core.c for SCO instead.
-
- * targets.c (target_vector): Re-enable generic ELF and NLM targets.
-
-Tue Oct 26 16:53:12 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (assign_file_position_for_section): Align sh_offset to
- sh_addralign (this is what UnixWare does, and it shouldn't hurt).
-
-Tue Oct 26 10:16:54 1993 Ken Raeburn (raeburn@cygnus.com)
-
- From Jeff Law and Pete Hoogenboom at Utah:
-
- * elf32-hppa.h (hppa_elf_stub_finish): Add prototype.
- (ELF32_HPPA_R_ARG_RELOC): Renamed without the ELF32 prefix
- and moved into libhppa.h. All references changed.
- (ELF32_HPPA_R_CONSTANT, ELF32_HPPA_R_ADDEND): Likewise.
- (get_opcode and opcode defines): Move into libhppa.h
- * elf32-hppa.c (hppa_elf_insn2fmt): Rename and move info
- libhppa.h.
- * libhppa.h (HPPA_R_*): Moved here. Reformatted slightly to make
- for easier reading.
- (get_opcode): Moved here. FIXME! this really should be a C function
- inside the opcode library!
- (bfd_hppa_insn2fmt): Likewise.
-
- * targets.c (target_vector): Enable elf32-hppa vector.
-
- * elf32-hppa.c (hppa_elf_get_section_contents): Add new comments
- and clarify existing comments. Do not use DEFUN to declare this
- function. Fix numerous indention problems. Correctly handle cases
- where symbol extension section may need to be read from disk,
- read from memory, or built then read from memory.
-
- * elf32-hppa.h: Reformat with gnu-indent and hand fix numerous
- formatting and indention problems gnu-indent can not handle.
- Clarify some comments about relocation types. Comment basic
- relocation "classes". Group PARAM declarations together.
- (HPPA_SXT_{NULL, SYMNDX, RG_RELOC}): Make members of a new
- enumerated type rather than #defines.
-
-Tue Oct 26 02:40:46 1993 Stu Grossman (grossman at cygnus.com)
-
- * som.c (hppa_object_setup): Set SEC_CODE for .text section so
- that GDB can figure out text_start and text_end.
-
-Mon Oct 25 16:05:23 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Fix up warnings from gcc -Wall:
- * coffgen.c (coff_print_symbol): Use %lx and cast n_value to
- unsigned long. Use %ld for tagndx. Use %lx for offset + vma and
- cast it to unsigned long.
- * ecoff.c (ecoff_emit_aggregate): Use %ld.
- (ecoff_print_symbol): Use %ld, and cast indx and sym_base to long.
- * coffcode.h (dummy_reloc16_estimate): Specify return type.
-
- * libbfd.c (bfd_write): If not everything is written out, set
- bfd_error to system_call_error. If the return value is
- non-negative, set errno to ENOSPC (if ENOSPC is defined).
- (bfd_seek): If the seek fails, set bfd_error to system_call_error.
- (bfd_generic_set_section_contents): For a bad offset + count, set
- bfd_error to bad_value.
- * seclet.c (rel): Don't abort. Instead, return false.
-
-Mon Oct 25 09:59:37 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * aoutx.h (reloc_type_lookup): Handle BFD_RELOC_SPARC_WDISP22.
-
-Fri Oct 22 20:35:54 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * config.bfd: handle mips*-* instead of mips-*, use mips*el
- instead of mips-*-*l
-
-Fri Oct 22 14:03:33 1993 Mark Eichin (eichin@cygnus.com)
-
- * m68k-lynx.mt, i386-lynx.mt (TDEFINES): set
- FPRINTF_ALREADY_DECLARED because the objdump.c declaration of
- fprintf collides with the native one.
-
-Fri Oct 22 11:50:25 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * targets.c (target_vector): Enable MIPS ELF vectors.
-
-Fri Oct 22 07:51:51 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.bfd: Use bigmips for mips-sony-bsd*.
-
- * configure.host, config.bfd: Add * to end of all OS names.
-
-Thu Oct 21 12:16:26 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * elfcode.h (FILE_ALIGN): Renamed from EALIGN, to avoid conflict
- with Ultrix header files.
-
- * som.h (struct som_section_data_struct): Renamed from
- som_section_data to avoid conflict with macro by that name.
-
- Changes from Jeff Law and Peter Hoogenboom at Utah:
-
- * elf32-hppa.c (hppa_elf_reloc): Target register for a 'jump
- in delay slot' optimization in combination with a long call
- stub should always be r31.
-
- * elf32-hppa.c: (hppa_elf_relocate_insn): To be consistent
- across all relocation types, retrieve instruction addends from
- the relocation entry rather than from the instruction itself.
-
- * elf32-hppa.c: (hppa_elf_relocate_insn): Fix a relocation
- error that only occurred when the addend of an 'addil' or
- 'ldil' was larger than 21 bits and very close to a 2K byte
- boundary.
-
- * elf32-hppa.c: (hppa_elf_reloc): Handle the optimization in
- which a jump is placed in the delay slot of a function call.
- The jump was being accomplished via an adjustment to the
- return pointer. This optimization would break the long call
- stub code, if there was any.
-
- * elf32-hppa.c: (hppa_elf_build_long_branch_stub): Corrections
- to long branch stubs to avoid use of general register 2.
-
- * hppa_stubs.h: New stub instructions.
-
- * elfcode.h: Declare bfd_elf_find_section.
-
- * som.h (som_section_data): Add new "subspace_index" field.
-
- * som.c (setup_sections): Save the original SOM subspace index
- in the BFD section associated with that subspace.
- (som_get_symtab_upper_bound): Implement.
- (som_get_symtab): Implement.
- (som_print_symbol): Implement.
- (som_slurp_string_table): New function to read a string table
- from a SOM object file.
- (som_section_from_subspace_index): New function to return the
- section which corresponds to a SOM subspace index.
- (som_slurp_symbol_table): New function to read the symbol
- table from a SOM object file.
- (som_make_empty_symbol): Check for errors from bfd_zalloc.
- (som_new_section_hook): Initialize subspace_index field to
- -1 instead of 0.
-
- * som.c (som_object_setup): Fix polarity of test to set HAS_RELOC.
- Set EXEC_P for executables.
- (setup_sections): Correctly identify when a section has
- relocations.
- (log2): New function.
- (setup_sections): Correctly convert between SOM alignments and BFD
- alignments.
-
- * som.c (setup_sections): Do not set SEC_ALLOC or SEC_LOAD
- for sections which correspond to SOM spaces, doing so confuses
- many utilities. Set assorted SEC_* flags for SOM subspaces
- which correspond to BFD sections.
-
- * elf32-hppa.c: (elf32_hppa_backend_fake_sections): The stab
- string table should have sh_type == SHT_STRTAB. Add
- processing to make it so.
-
- * elfcode.h: (bfd_section_from_shdr): String tables (other
- than .strtab) were not getting the file offsets recorded, so
- they could not be read from disk.
-
- * elfcode.h: (elf_make_sections): Leave the sh_addr field of
- the section header and the vma field of a section at 0 if the
- section is not part of the program execution image. (e.g.,
- .stab)
-
- * som.[hc]: Change target vector prefix from "hppa" to "som".
- Consistently use obj_som prefix to access fields in backend data
- structures. Fix all callers/references.
-
- * som.h: Do not include files only needed for core file reading here.
- Include a.out for both HOST_HPPAHPUX and HOST_HPPABSD. Delete
- forward structure declarations, they are unnecessary.
- (struct somdata): Delete aux_hdr, and hp_symbol_entry_size fields.
- Change "symbols" to "symtab". Add "stringtab" and "reloc_filepos"
- fields for future use. Change obj_som_* macros as appropriate.
- (som_section_data): New structure to keep SOM specific information
- about BFD sections (for future use).
-
- * som.c: Provide PARAMS declarations for all functions currently
- in this file.
- (struct container): Delete unwanted structure definition.
- (som_object_setup): Add comments. Use som_mkobject to allocate
- SOM specific information in the BFD; use information from the
- file and (possibly empty) auxiliary headers to initialize this
- information. Delete redundant bfd_get_symcount (abfd) "calls".
- (setup_sections): Return type is now boolean, fix return statements.
- "Fix" handling of BSS like subspaces in the computation of the
- containing space's size. If the subspace has relocations, set the
- appropriate BFD section flags and record the index into and the
- size of the fixup stream. Always return a value.
- (som_object_p): Set bfd_error appropriately if errors are detected
- from bfd_{read,seek} functions. Handle EXECLIBMAGIC type files.
- Do not try to read a non-existant auxiliary header.
- (som_mkobject): Flesh out.
- (som_section_hook): Allocate space to hold SOM specific information
- about sections.
-
-Thu Oct 21 12:41:34 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- gcc -Wall lint:
- * coff-h8300.c, coffcode.h: Change shrink parameter
- in *_reloc16_estimate to unsigned to match prototype.
- * archive.c: Avoid "/*" in comment.
-
-Thu Oct 21 13:05:16 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * dep-in.sed: Create our own line breaks for a more aesthetic
- Makefile.
- * Makefile.in: Rebuilt dependencies.
-
- * elf32-mips.c: Include "seclet.h".
- (mips_elf_fake_sections): Force size of .reginfo section to sizeof
- Elf32_External_RegInfo.
- (mips_elf_seclet_link): New function. Link the .reginfo section
- specially, and pass everything else to the generic routine.
- (bfd_elf32_bfd_seclet_link): Define macro.
- * elf32-target.h: If bfd_elf32_bfd_seclet_link is already defined,
- don't override it.
-
-Wed Oct 20 12:22:37 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libnlm.h (nlm_backend_data): Added signature field.
- (nlm_signature): New macro.
- * nlmcode.h (nlm_object_p, nlm_write_object_contents): Use the NLM
- signature from the backend rather than the constant NLM_SIGNATURE.
- * nlm32-i386.c (nlm32_i386_backend): Initialize signature field.
-
- * aoutf1.h (MACHTYPE_OK): Accept M_UNKNOWN.
- (NAME(sunos,set_arch_mach)): Treat M_UNKNOWN as 68000, not 68020.
-
-Wed Oct 20 10:28:27 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/i386bsd.h [__bsdi__]: Define HOST_DATA_START_ADDR.
-
-Wed Oct 20 10:10:07 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * Makefile.in (HFILES): New variable, for use in "make dep".
- (.dep): Depend on $(CFILES) and $(HFILES). Delete .dep1 and
- remake it, so that "$?" is complete.
- (.dep1): Don't need to remove .dep1 first.
- (dep.sed): Depend on config.status, not Makefile.
- (CFILES): Add nlm.c.
-
-Tue Oct 19 15:26:26 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-alpha.c: Implemented reloc handling for the linker, made
- various other related changes.
- * libecoff.h (ecoff_backend_data): Added rdata_in_text field.
- Renamed finish_reloc to adjust_reloc_in. Added adjust_reloc_out
- field.
- (ecoff_bfd_get_relocated_section_contents): Don't define.
- * ecoff.c (ecoff_sec_to_styp_flags, ecoff_styp_to_sec_flags):
- Handle .lita section.
- (ecoff_slurp_reloc_table): Handle RELOC_SECTION_FINI.
- finish_reloc backend field renamed to adjust_reloc_in.
- (ecoff_bfd_seclet_link): Adjust number of aux entries to
- debug_align boundary.
- (ecoff_compute_section_file_positions): If rdata_in_text put
- .rdata section in text segment, not data segment. Put .pdata
- section in text segment.
- (ecoff_write_object_contents): Likewise. Also, call
- adjust_reloc_out, and handle .lita, .xdata, .pdata, .fini and
- absolute sections when writing out relocs.
- * coffswap.h (coff_swap_aouthdr_out): For ALPHAECOFF, output 2 for
- bldrev field, as on Alpha OSF/1. Padding field is now 2 bytes.
- * coff-mips.c (mips_ecoff_swap_reloc_out): Added assertion.
- (mips_adjust_reloc_in): Renamed from mips_finish_reloc.
- (mips_adjust_reloc_out): New function (does nothing).
- (mips_ecoff_backend_data): Initialize new fields.
- (ecoff_bfd_get_relocation_section_contents): Define to be
- bfd_generic_get_relocated_section_contents.
-
- * reloc.c (bfd_perform_relocation): Added casts to avoid Alpha
- OSF/1 cc bug.
-
-Thu Oct 14 01:10:35 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * reloc.c (bfd_perform_relocation): Add comments attempting to
- explain PC relative relocations.
-
- * coffcode.h (styp_to_sec_flags): Don't set SEC_DEBUGGING until it
- is made to work.
- (coff_compute_section_file_positions): Remove check for
- USE_DISCARDED_SECTIONS_COUNT.
- * coff-i386.c: Don't define USE_DISCARDED_SECTIONS_COUNT. Basing
- it on host defines is wrong.
-
- * ecoff.c (ecoff_bfd_seclet_link): Don't link a .reginfo section.
- (ecoff_write_object_contents): Don't require the .reginfo section
- to be a particular size.
-
-Wed Oct 13 18:39:03 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * Makefile.in (dep-in): New rule, for editing dependencies into
- Makefile.in in $(srcdir). Use move-if-change.
- (.dep1, dep): Use move-if-change.
- (CFILES): Add coff-apollo.c.
-
- Sun Oct 10 18:02:56 1993 Troy Rollo (troy@cbme.unsw.EDU.AU)
-
- * Makefile.in: Recognise new file, coff-apollo.o
-
- * coff-apollo.c: New file
-
- * coffcode.h: Recognise apollo magic numbers and writable text
-
- * coffswap.h: Swap Apollo optional header entries
-
- * config.bfd: Add line for Apollo
-
- * configure.host: Replace apollo68b and apollo68v with Apollo
-
- * configure.in: Recognise apollocoff_vec
-
- * targets.c: Likewise
-
- * config/apollo.mh, config/apollo.mt: New files
-
- * hosts/apollo68.h: Remove inclusion of strings.h
-
-Wed Oct 13 14:28:17 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * coff-i386.c (i3coff_object_p): Now static.
-
- * Makefile.in: Updated dependencies.
- (.dep, .dep1, dep.sed): New targets, to make "make dep" work
- better.
- * dep-in.sed: New file.
-
- * m68klynx-cf.c (ONLY_DECLARE_RELOCS): Define, to avoid name
- conflicts when "--with-targets=all".
- * coff-m68k.c (m68kcoff_howto_table, m68k_rtype2howto,
- m68k_howto2rtype): Rename via macros to keep namespace clean.
- * configure.in: For m68klynx_coff_vec, include coff-m68k.o for
- now.
-
-Tue Oct 12 17:03:27 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf32-mips.c: Extensive additions to do relocations and to
- handle MIPS specific sections.
- * libelf.h (elf_backend_data): Pass fourth argument to
- elf_backend_section_from_bfd_section to permit it to control the
- section index to use.
- (elf_obj_tdata): Add gp and gp_size fields.
- (elf_gp, elf_gp_size): New accessor macros.
- * elfcode.h: Removed a number of unused local variables.
- (elf_fake_sections): Clear section header before calling
- elf_backend_fake_sections, not after.
- (prep_headers): Return true at end.
- (elf_section_from_bfd_section): Pass retval argument to
- elf_backend_section_from_bfd_section.
- * elf32-hppa.c (elf32_hppa_backend_section_from_bfd_section):
- Accept and ignore new retval argument.
- * bfd.c: Include libelf.h.
- (bfd_set_gp_size): Handle ELF targets.
- * Makefile.in (bfd.o): Depends upon libelf.h.
- (elf32-mips.o): Depends upon $(INCDIR)/elf/mips.h.
-
-Mon Oct 11 17:25:18 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_mkobject): Check bfd_make_section return value.
- (ecoff_mkobject_hook): New function.
- (ecoff_new_section_hook, ecoff_sizeof_headers,
- ecoff_compute_section_file_positions, ecoff_set_section_contents,
- ecoff_write_object_contents): Handle dummy REGINFO section.
- (ecoff_get_section_contents): New function to handle reading
- REGINFO section.
- * libecoff.h (ecoff_get_section_contents): Change from macro
- definition to function prototype.
- (ecoff_mkobject_hook): New prototype.
- * coff-alpha.c (alpha_ecoff_mkobject_hook): Removed.
- (alpha_ecoff_backend_data): Use ecoff_mkobject_hook.
- * coff-mips.c (mips_ecoff_mkobject_hook): Removed.
- (mips_ecoff_backend_data): Use ecoff_mkobject_hook.
-
-Fri Oct 8 15:25:33 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * libbfd.c (bfd_get*32, bfd_get*64): Prevent ANSI sign extension
- by casting the most significant byte to bfd_vma.
-
-Fri Oct 8 02:34:21 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * configure.in: Do not define SELECT_VECS, SELECT_ARCHITECTURES
- if configuring --with-targets=all.
-
-Thu Oct 7 17:34:07 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * aoutx.h (howto_table_std): Correct the "size" field in some
- entries.
-
- * reloc.c (reloc_howto_type): Change documentation to dispel any
- notion that the "size" field is a power-of-two indicator.
-
-Thu Oct 7 10:50:38 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * coffswap.h: (bfd_swap_reloc_in): a symndx is signed.
-
- Make support for relaxing more generic.
- * reloc16.c: Add new target entry - bfd_coff_reloc16_estimate,
- fix bit rot.
- * libcoff.h, libcoff-in.h: declarations. Prototypes
- * coffcode.h (bfd_coff_std_swap_table): Add calls to
- coff_reloc_16_extra_cases and coff_reloc16_estimate.
- (dummy_reloc16_estimate): New function.
- * coff-h8300.c (h8300_reloc16_estimate): New function
-
-Thu Oct 7 14:24:13 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elfcode.h (EALIGN): Define, dependent on ARCH_SIZE.
- (align_file_position): New function.
- (elf_locate_sh): Disabled function deleted.
- (assign_file_positions_for_symtab_and_strtabs): Align position,
- then place symtab, then do other sections.
- (map_program_segments): Align program header.
- (assign_file_positions_except_relocs): Align section headers.
- (assign_file_positions_for_relocs): Align relocation sections.
-
-Tue Oct 5 10:44:32 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * configure.host: Recognize hppa*-*-hiux* (currently synonym for hpux).
- Change other hppa entries to use -*- not -hp-.
- * config.bfd: Recognize hppa*-*-hiux* (currently synonym for hpux).
-
- * coff-rs6000.c, cpu-rs6000.c, rs6000-core.c: Change non-ASCII
- characters in comment to octal escapes.
-
-Sun Oct 3 12:35:15 1993 Stan Shebs (shebs@rtl.cygnus.com)
-
- * coff-i386lynx.c: Removed, name too long.
- * i386lynx-cf.c: New file, was coff-i386lynx.c.
- * configure.in: Reflect file name changes.
- * Makefile.in: Mention Lynx-related files.
-
- * i386lynx.c (lynx_32_swap_ext_reloc_in): get reloc bits in i386
- Lynx-specific way.
-
- * m68klynx-cf.c: New file, defines coff format for M68K LynxOS.
- * m68klynx.c: Remove coff vector definition, now in m68klynx-cf.c.
-
- * coffcode.h (sec_to_styp_flags): Set section flag to STYP_INFO
- for .stab, .stabstr and .debug sections, and set SEC_DEBUGGING for
- sections of type STYP_INFO. (from Minh Tran-Le)
- (coff_compute_section_file_positions): Add discarded_sections_count
- to abfd->section_count, which helps `strip' keep the size
- of the executable header constant.
- * coff-i386.c (discarded_sections_count): New variable, initialized
- to zero. For use by `strip'. Currently being used only in aix386
- coff, but may be useful for other coff systems. (from Minh Tran-Le)
-
- * coffswap.h (coff_swap_filehdr_out): Added a missing cast.
-
- * archive.c: Cosmetic improvements.
- * opncls.c: Cosmetic improvements.
- (new_bfd): Removed redundant structure slot init.
-
-Sat Oct 2 18:48:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config/news-mips.mh, hosts/news-mips.h: New files.
- * configure.host: Use news-mips for mips-sony-bsd*.
-
-Fri Oct 1 13:14:17 1993 Stan Shebs (shebs@rtl.cygnus.com)
-
- * configure.in: i386lynx_coff_vec requires coff-i386lynx.o.
- * coff-i386lynx.c: New file, defines Lynx target vector and name,
- includes coff-i386.c.
- * coff-i386.c (i386coff_vec): Allow redefinition of target vector
- symbol and name, if TARGET_SYM and/or TARGET_NAME are defined.
- * i386lynx.c: Remove coff vector definition entirely.
- (lynx_32_swap_ext_reloc_in): Define.
- (lynx_32_swap_std_reloc_in): Define, get reloc bits in i386
- Lynx-specific way.
- (lynx_32_swap_ext_reloc_out): Define.
- (lynx_32_swap_std_reloc_out): Define.
- (lynx_32_slurp_reloc_table): Define, call Lynx swapping fns.
- (lynx_32_squirt_out_relocs): Define, call Lynx swapping fns.
- (lynx_32_canonicalize_reloc): Define, call Lynx swapping fns.
- (WRITE_HEADERS): Define, call Lynx swapping fns.
-
- * config/i386-lynx.mt (SELECT_VECS): Remove redundant vector.
-
-Thu Sep 30 17:50:52 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * reloc.c (bfd_reloc_code_type): Add linkage-table relative
- relocations of size 8, 16, 32. Sort generic relocs by type rather
- than size. Added a little documentation too.
-
- * aoutx.h (howto_table_std): Add BASE16 and BASE32 relocs.
- (TABLE_SIZE): New macro.
- (reloc_type_lookup): Handle BFD_RELOC_{16,32}_BASEREL for std
- relocs.
- (swap_std_reloc_out): Write baserel relocs correctly.
- (swap_std_reloc_in): Handle r_baserel field. Assert that
- r_jmptable and r_relative fields are clear, and that the computed
- index does refer to a defined entry of the howto table.
-
-Tue Sep 28 14:47:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * section.c (bfd_make_section_anyway): New function.
- * section.c: Change comments to say several sections can have
- the same name.
- * bfd-in2.h: Re-generate to reflect above change.
- * coffgen.c (make_a_section_from_file): Call bfd_make_section_anyway
- if still no section after the bfd_coff_make_section_hook.
- * coffcode.h: Add comment about TWO_DATA_SECS.
-
-Tue Sep 28 03:22:24 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * ecoff.c (ecoff_slurp_symbolic_info): Always determine raw_size
- explicitly.
- * ecoff.c (ecoff_sec_to_styp_flags, ecoff_styp_to_sec_flags): Handle
- .fini section.
-
-Mon Sep 27 18:29:18 1993 Stan Shebs (shebs@rtl.cygnus.com)
-
- * config.bfd configure.host: Match on *-lynxos* for LynxOS,
- add m68*-*-lynxos*.
- * configure.in : Replaced i386lynx_vec with i386lynx_aout_vec
- and i386lynx_coff_vec.
- Added m68klynx_aout_vec and m68klynx_coff_vec.
- * targets.c (target_vector): Removed i386lynx_vec, added
- {i386,m68k}lynx_{aout,coff}_vec.
- * i386lynx.c: Added copy of i386coff.c, renamed bfd target to
- i386lynx_coff_vec.
- * m68klynx.c: New file.
- * config/i386-lynx.mt: Replaced i386lynx_vec with i386lynx_aout_vec
- and i386lynx_coff_vec.
- * config/m68k-lynx.mt: New file.
- * hosts/i386lynx.h: Added definition of cfree as free (from Eichin).
- * hosts/m68klynx.h: New file.
-
-Mon Sep 27 18:00:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * archive.c: Define offsetof here.
- * hosts/*.h: Don't define it here.
-
-Mon Sep 27 19:09:27 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (bfd_section_from_shdr): Set filepos for SHT_STRTAB
- section.
-
-Fri Sep 24 15:47:40 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hpux-core.c: Add comment about hpux version 7.
-
-Fri Sep 24 16:50:26 1993 Stu Grossman (grossman at cygnus.com)
-
- * lynx-core.c (lynx_core_file_p): Change per-thread register
- section names from .regXXX to .reg/XXX to avoid parsing ambiguity
- in gdb/corelow.c. Create alias .reg section for the currently
- running thread.
-
-Fri Sep 24 13:22:32 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libecoff.h (ecoff_backend_data): Removed big_magic and
- little_magic fields.
- * coff-alpha.c (alpha_ecoff_backend_data): Removed initialization
- of big_magic and little_magic.
- * coff-mips.c (mips_ecoff_bad_format_hook): Make sure magic number
- matches endianess of bfd.
- (mips_ecoff_backend_data): Removed initialization of big_magic and
- little_magic.
- * ecoff.c (ecoff_set_arch_mach_hook): Set MIPS machine number
- based on magic number. Support r4000 magic numbers.
- (ecoff_get_magic): New function.
- (ecoff_write_object_contents): Use ecoff_get_magic, not fields in
- the backend structure.
- * cpu-mips.c (arch_info_struct): Added case for r6000.
-
- For MIPS configurations put both big and little endian versions in
- the list of targets; the code is getting compiled in anyhow.
- * bigmips.mt (SELECT_VECS): Define to be ecoff_little_vec.
- * decstation.mt (SELECT_VECS): Define to be ecoff_big_vec.
- * mipsbelf.mt (SELECT_VECS): Define to be bfd_elf32_littlemips_vec.
- * mipslelf.mt (SELECT_VECS): Define to be bfd_elf32_bitmips_vec.
- * riscos.mt (SELECT_VECS): Define to be ecoff_little_vec.
-
-Fri Sep 24 00:42:23 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * osf-core.c: New file for OSF/1 core file support.
- * config/alphaosf.mh (HDEFINES): Add -DOSF_CORE.
- (HDEPFILES): Set to osf-core.o.
- * bfd-in2.h (union tdata): Add osf_core_data member.
- * targets.c: If OSF_CORE is defined, add osf_core_vec to target list.
- * Makefile.in (OPTIONAL_BACKENDS): Add osf-core.o.
- (osf-core.o): New dependency.
-
-Thu Sep 23 21:04:53 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * TODO: Remove note about making --with-bfd-targets use canonical
- target configuration name (already done); reword item about
- separating reading and writing stuff to not refer to a
- non-existent item.
-
- * ecoff.h (ecoff_set_arch_mach_hook): Accept MIPS_MAGIC_LITTLE2
- and MIPS_MAGIC_BIG2.
-
-Thu Sep 23 11:06:34 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * gen-aout.c (main): Output newline after end of comment, not
- before. (Reported by Jonathan Stone,
- jonathan@oscar.stanford.edu).
-
-Thu Sep 23 10:48:27 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * archive.c (compute_and_write_armap): Put weak symbols in the
- armap.
-
- * elfcode.h (fix_up_strtabs): Set sh_entsize for the .stab
- section, not the .stabstr section. Set the type of the .stabstr
- section to SHT_STRTAB.
- (elf_section_from_bfd_section): Handle SHT_STRTAB sections.
-
- * section.c (SEC_DEBUGGING): New section flag.
- * elfcode.h (bfd_section_from_shdr): If section is SHT_PROGBITS,
- and the name starts with .debug, .line or .stab, set
- SEC_DEBUGGING. If SHT_STRTAB, check for .debug and .stab.
- * elf32-target.h (TARGET_BIG_SYM, TARGET_LITTLE_SYM): Added
- SEC_DEBUGGING to section_flags.
- * elf64-target.h (TARGET_BIG_SYM, TARGET_LITTLE_SYM): Added
- SEC_DEBUGGING and SEC_CODE to section_flags.
- * bfd-in2.h: Updated.
-
-Wed Sep 22 16:34:14 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd.c (tdata): Add lynx_core_data.
-
- * ecoff.c (ecoff_compute_section_file_positions): Set filepos for
- sections with SEC_LOAD set, even if SEC_HAS_CONTENTS is clear.
- (ecoff_write_object_contents): Don't set scnptr to zero just
- because size of section is zero. Needed for Irix 4.0.5F.
-
-Wed Sep 22 09:49:32 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.bfd: Use i960-bout, not i960-coff for i960-*-nindy*.
-
-Wed Sep 22 07:34:09 1993 Stu Grossman (grossman at cygnus.com)
-
- * Makefile.in (OPTIONAL_BACKENDS): Add lynx-core.o.
- * bfd-in2.h (tdata): Add lynx_core_data;
- * config.bfd configure.host: Get rid of superfluous netbsd and
- lynxos entries.
- * configure.in: Add lynx-core.o to Lynx config.
- * i386lynx.c: Add defs for core file support.
- * lynx-core.c: New file with Lynx core file support.
- * hosts/i386lynx.h: Move lots of host specific includes to here.
- Add def of HOST_LYNX. Remove unnecessary defs.
-
-Mon Sep 20 19:18:10 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (bfd_section_from_shdr): Only set SEC_DATA for a
- SHF_PROGBITS or SHT_STRTAB section if SEC_ALLOC is set. Never set
- SEC_DATA for a SHF_NOBITS section.
-
- * nlm32-i386.c (nlm_i386_mangle_relocs): Check SEC_LOAD rather
- than SEC_CODE | SEC_DATA. Add some casts to avoid warnings.
- * nlmcode.h: Add some casts to avoid warnings.
- (nlm_write_object_contents): Ignore relocs for sections that are
- neither code nor data. Just use the symbol value for debugging
- symbols; don't offset by the section vma.
-
-Fri Sep 17 18:08:55 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * reloc.c (bfd_perform_relocation): Don't return an error when
- performing a reloc against an undefined weak symbol.
- * syms.c (bfd_print_symbol_vandf): Show value of BSF_WEAK rather
- than obsolete BSF_EXPORT.
-
-Fri Sep 17 02:04:31 1993 John Gilmore (gnu@cygnus.com)
-
- * hosts/{alphaosf.h, amix.h, apollo68.h, apollov68.h,
- decstation.h, delta88.h, dgux.h, dose.h, go32.h, harris.h,
- hp300.h, hp300bsd.h, hppabsd.h, hppahpux.h, i386aix.h, i386bsd.h,
- i386linux.h, i386lynx.h, i386v.h, i386v4.h, irix3.h, irix4.h,
- mipsbsd.h, ncr3000.h, rs6000.h, rtbsd.h, solaris2.h, sparc-ll.h,
- std-host.h, stratus.h, sun3.h, sysv4.h, tahoe.h, ultra3.h,
- vaxult.h, vaxult2.h, we32k.h}: Make sure that "offsetof" is
- defined on all hosts, now that archive.c uses it.
-
-Thu Sep 16 18:20:30 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (elf_map_symbols): Create section symbols for all
- sections, not just allocated sections; debugging sections can have
- relocs.
- (elf_symbol_from_bfd_symbol): If there is an output section, use
- the section index from that rather than the input section.
-
-Thu Sep 16 12:20:50 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * libbfd-in.h (bfd_flush, bfd_stat): Reflect John's changes to
- libbfd.h, which is regenerated from this file.
-
- * bfd-in.h (symtype): Deleted typedef.
-
-Wed Sep 15 11:48:37 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libbfd.c (COERCExx): Cast x to bfd_signed_vma before doing the
- xor and subtract. Otherwise it will not sign extend if the type
- of bfd_vma is larger than int.
-
- * ecoffswap.h (ecoff_swap_pdr_in): Get regoffset, iopt, fregoffset
- and frameoffset as signed numbers. From Peter Schauer.
-
-Tue Sep 14 18:20:36 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf32-i386.c (elf_howto_table): Add bfd_elf_generic_reloc
- special function for all reloc entries.
- * elf32-target.h (TARGET_LITTLE_SYM): Add SEC_CODE to
- section_flags.
- * libelf.h (elf_symbol_type): Remove desc, type and other fields.
- * Makefile.in (elf32-*.o): These depend upon elf32-target.h.
-
-Tue Sep 14 14:34:45 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * libbfd-in.h (struct artdata): Add armap_timestamp and
- armap_datepos here too.
-
-Mon Sep 13 21:03:18 1993 John Gilmore (gnu@cacophony.cygnus.com)
-
- Improve timestamp support in BSD archive files to avoid linker
- warnings.
-
- * libbfd.h (struct artdata): Add armap_timestamp and armap_datepos.
- (bfd_flush, bfd_stat): Add prototypes.
- * libbfd.c (bfd_flush): Add, does fflush on a BFD.
- (bfd_stat): Add, does fstat on a BFD.
-
- * archive.c (_bfd_write_archive_contents): At end of file writing,
- verify and possibly update the timestamp in the armap, if a BSD
- archive. FIXME! Kludge recognizes BSD archive, rather than
- vectoring properly. Should add to xvec.
- (compute_and_write_armap): Move prototype to top, avoid PROTO.
- (bsd_write_armap): Save timestamp and file location thereof, when
- writing the armap in a BSD file.
- (bsd_update_armap_timestamp): New function to check and
- rewrite the timestamp.
-
- * hosts/std-host.h (offsetof): Define, if not already, for archive.c.
-
-Sat Sep 11 18:13:42 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)
-
- * hosts/i386sco.h: Define a bunch of stuff for core files.
- * sco-core.c: Remove, replace by trad-core.c.
- * trad-core.c: If HOST_STACK_START_ADDR is defined, use it.
- * config/i386sco.mh: Use trad-core not sco-core.
- * hosts/i386isc.h, config/i386isc.mh: Remove.
- * configure.host: Use i386sco for isc.
- * config/i386-sco.mt: Remove, identical to i386-coff.mt.
- * config.bfd: Use i386-coff not i386-sco.
-
- * config.bfd: Recognize i[34]86-*-solaris2* specifically rather
- than using *-*-solaris2* (i486-unknown-solaris2 is i386-elf, not
- i486-elf which doesn't exist).
-
-Fri Sep 10 12:56:36 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coffswap.h (coff_swap_aouthdr_out): For ALPHAECOFF, force
- padding field to zero.
-
- * config.bfd (i[34]86-*-netbsd*): New target; use i386-netbsd.
- * configure.in: Remove bogus netbsd386 handling.
-
- * coff-mips.c: Don't warn about overflow for MIPS_R_JMPADDR reloc.
- Correct overflow detection requires matching the upper four bits
- of the destination against the PC.
-
-Thu Sep 9 16:57:46 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * configure.in: Make 64-bit stuff work with "--with-targets=all".
-
-Tue Sep 7 14:17:02 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libbfd-in.h: Removed swapping routines declarations.
- * bfd-in.h: Added swapping routine declarations, and renamed them
- from _do_* to bfd_*.
- * libbfd.c: Renamed swapping routines from _do_* to _bfd_*.
- * Changed all callers.
- * libbfd.h, bfd-in2.h: Rebuilt.
-
-Mon Sep 6 15:28:07 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf32-i386.c (elf_howto_table): Set pcrel_offset to true for
- R_386_PC32.
-
-Fri Sep 3 13:06:12 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * configure.in: Reorganized setting of makefile variables so
- 64-bit stuff works again.
-
- * libbfd-in.h (_do_get*, _do_put*): Renamed via macros to clean up
- namespace.
-
- * libelf.h (elf32_symbol_type, elf64_symbol_type): Deleted
- "native_elf_sym" field, merged to make new type "elf_symbol_type".
- (struct elf_obj_tdata): Field symbols is now elf_symbol_type*.
- Deleted field raw_syms.
- (obj_symbols): Remove cast.
- (obj_raw_syms): Deleted.
- * elfcode.h (elf_slurp_symbol_table): Don't set raw_syms or
- native_elf_sym fields.
- * elf32-hppa.c: Changed uses of elf32_symbol_type to
- elf_symbol_type.
-
- From Pete Hoogenboom and Jeff Law:
-
- * elf32-hppa.c (ELF_MAXPAGESIZE): Define.
-
- * elf32-hppa.c (elf_hppa_tc_symbol): If the argument relocation
- bits are zero (e.g., they specify no relocations), then do not
- even bother adding their entries to the symextn section.
-
- * elf32-hppa.c (elf_hppa_tc_symbol): Any function, regardless
- of scope can have an argument relocation stub.
-
- * elf32-hppa.c: (Elf32_hppa_Stub_description): Rename this
- structure and type to elf32_hppa_stub_description. This makes
- it consistent with the GNU coding conventions.
- (elf32_hppa_stub_description): Added a 'next' field to allow
- linking of stub description structures.
- (elf32_hppa_stub_description): Added a 'stub_listP' field to
- keep track of individual stubs.
- (Elf32_hppa_Stub_list, Elf32_hppa_Stub_list_struct): Removed.
- Combined with the elf32_hppa_stub_description structure.
- (elf32_hppa_stub_name_list): New type to keep track of
- individual stubs.
- (add_stub): Removed.
- (add_stub_by_name): New function.
- (find_stub_by_name): New function.
- (hppa_elf_build_arg_reloc_stub): Allow reusing stubs that
- already exist.
- (hppa_elf_build_long_branch_stub): Allow reusing stubs that
- already exist.
-
- * elf32-hppa.c: (retval_mismatches): The direction of argument
- relocation was reversed.
- (hppa_elf_build_arg_reloc_stub): Return address was not being
- restored.
- (hppa_elf_arg_reloc_needed_p): Add argument containing caller
- argument relocation bits so this function can be used in the check
- for plabel stubs.
- (hppa_elf_stub_check): Pass caller argument relocation bits into
- hppa_elf_arg_reloc_needed_p().
- (hppa_look_for_stubs_in_section): Add check for plabel stubs and
- pass caller argument relocation bits into
- hppa_elf_arg_reloc_needed_p().
-
-Thu Sep 2 00:59:55 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * libhppa.h (hppa_field_adjust): Remove unused `init_value' variable.
-
- * hosts/delta88v4.h: New for SVR4.
- * configure.host: Use it.
-
-Wed Sep 1 14:23:32 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * libaout.h, netbsd386.c: Change M_I386 to M_386_NETBSD. M_I386
- is an SCO pre-define.
-
-Tue Aug 31 12:50:19 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * nlmcode.h (nlm_object_p): Set HAS_SYMS if there are external
- references.
- (nlm_swap_auxiliary_headers_{in,out}): The copyright length is
- only one byte.
- (nlm_get_symtab_upper_bound): Include debugging symbols in symbol
- count.
- (nlm_slurp_symbol_table): Make symlength unsigned. Read debugging
- symbols as BFD local symbols.
- (nlm_write_object_contents): Don't bother writing out exported
- symbols more than once; they now appear in the symbol table more
- than once (with and without a prefix) if necessary. Set offset
- values to be non-zero as NLMLINK does.
-
-Tue Aug 31 12:07:43 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * libhppa.h: Restore #undefs of e_fsel and other e_* symbols.
-
-Fri Aug 27 16:43:35 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * section.c (struct sec): Move position of user_set_vma, and
- document it.
- (SEC_BALIGN): Disable for now. I don't think it's currently used.
-
- * elf32-hppa.c (elf_hppa_howto_table): Now static.
- (symext_rootP, symext_lastP, global_value, GOT_value,
- global_symbol, global_sym_defined, symextn_contents,
- symextn_contents_real_size, elf_hppa_stub_rootP,
- elf32_hppa_symextn_map, elf32_hppa_symextn_map_size): Rely on
- default initialization.
- (hppa_elf_gen_reloc_type): Macro "UNDEFINED" doesn't need a
- trailing semicolon.
- (hppa_look_for_stubs_in_section): Introduce temporaries to make
- code more readable in 80 columns.
-
- * libhppa.h (all functions): Now inline under GNU C.
-
- More patches from Jeff Law:
-
- * elf32-hppa.c (AR_WARN): Give argument which caused the
- invalid argument relocation.
- (AR_UNIMP): Delete unused macro.
- (hppa_elf_set_section_contents): Always return a value.
- (elf32_hppa_backend_table_processing): Likewise.
- (elf32_hppa_backend_section_processing: Likewise.
-
- * som.c: New file containing SOM specific code extracted
- from hppa.c
-
- * som.h: New file containing SOM specific code extracted
- from libhppa.h
-
- * hppa.c: Deleted.
-
- * libhppa.h: Delete SOM specific code. Add generic PA
- code which can be shared by both SOM and ELF backends.
-
- * Makefile.in: Replace hppa.c with som.c. elf32-hppa.o
- depends on libhppa.h now.
-
- * configure.in (hppa_vec): Needs som.o module instead of
- hppa.o.
-
- * elf32-hppa.c: Include libhppa.h. Do not define
- BYTES_IN_WORD.
-
- * elf32-hppa.h (hppa_reloc_field_selector_type): Delete
- now lives in libhppa.h.
- (hppa_reloc_field_selector_type_alt): Likewise.
-
- * hosts/hppabsd.h: Include <stdlib.h> and <unistd.h>. Do not
- define malloc or free.
-
- * config/hppa-elf.mt (SELECT_ARCHITECTURES): Don't define
- SELECT_VECS.
-
- * elf32-hppa.c (hppa_elf_relocate_unwind_table): Delete unused
- variables.
- (elf_hppa_reloc_type_lookup): Likewise.
- (elf_hppa_tc_make_sections): Likewise.
- (hppa_elf_arg_reloc_needed_p): Likewise.
- (hppa_elf_build_long_branch_stub): Likewise.
- (elf_reloc_map): Delete, no longer used.
- (elf_hppa_reloc_map): Likewise.
- (elf32_hppa_symextn_map_max_size): Likewise.
- (elf32_hppa_get_sym_extn): Abort if type is bogus.
-
- * elf32-hppa.c (elf32_hppa_backend_fake_sections): Add processing
- of the .hppa_unwind section.
-
-Wed Aug 25 16:13:49 1993 K. Richard Pixley (rich@sendai.cygnus.com)
-
- * config.bfd: recognize m88110.
-
-Tue Aug 24 16:32:35 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- Merged changes from Jeff Law and Pete Hoogenboom at Utah:
-
- * elfcode.h (elf_section_from_bfd_section): Add detection of
- SHT_NOTE sections.
-
- * elf32-hppa.c:
- (hppa_elf_build_long_branch_stub,hppa_elf_long_branch_needed_p):
- New functions for support of long branch stubs.
- (hppa_elf_stub_check,hppa_look_for_stubs_in_section): Add
- check for long branch stubs.
- (hppa_look_for_stubs): Unused function. Removed.
- (hppa_elf_set_section_contents): Implement a PA/ELF-specific
- version of bfd_set_section_contents.
- (hppa_elf_long_branch_needed_p): Only output debugging diagnostics
- when BFD is configured for debugging.
-
- * elf32-hppa.c: (elf32_hppa_get_symextn_chain): New function
- to return a list of symbols that have non-zero argument
- relocation bits.
- (hppa_elf_stub_finish): Make sure stub generation is done only
- once.
-
- * elf32-hppa.c: (hppa_elf_stub_reloc): New function for
- generation relocation entries within a stub.
- (hppa_elf_build_arg_reloc_stub): Corrections to argument
- relocation stubs.
-
- * elf32-hppa.c: New #define's for argument relocation types.
- (mismatches, retval_mismatches): Updated to reflect new
- argument relocation types.
- (CURRENT_STUB_OFFSET): New macro.
-
- * elfcode.h (map_program_segments): Set the PF_X bit for data
- segments.
-
- * elf32-hppa.c: (elf_hppa_howto_table): Add
- R_HPPA_STUB_CALL_17 for support of linker stub generation.
- (hppa_elf_reloc): Add support of R_HPPA_STUB_CALL_17
- relocation type.
-
- * elf32-hppa.h: (elf32_hppa_reloc_type): Add
- R_HPPA_STUB_CALL_17 for support of linker stub generation.
-
- * hppa_stubs.h: Add new instructions that are used in linker
- stub generation.
-
- * elf32-hppa.c (hppa_elf_relocate_unwind_table): The offsets in an
- unwind descriptor were incorrect.
-
- * libelf.h (bfd_elf_find_section): Declare.
-
- * elf32-hppa.c: (elf32_hppa_backend_symbol_processing): New
- function in place of global_sym field in elf_backend_data
- structure.
- (elf32_hppa_backend_symbol_table_processing,
- elf32_hppa_backend_section_processing,
- elf32_hppa_backend_fake_sections,
- elf32_hppa_backend_section_from_shdr,
- elf32_hppa_backend_section_from_bfd_section): New functions to
- provide support of symbol extension sections and argument
- relocation stubs.
- (elf_info_to_howto): Remove call to abort().
-
- * elf32-target.h: Support for special processing by the backend.
- (struct elf_backend_data): Added elf_backend_symbol_processing,
- elf_backend_symbol_table_processing,
- elf_backend_section_processing, elf_backend_section_from_shdr,
- elf_backend_fake_sections, and
- elf_backend_section_from_bfd_section fields.
- * elfcode.h: (bfd_section_from_shdr): Add a check for
- processor-specific section types.
- (elf_fake_sections): Add a check for processor-specific
- section types.
- (bfd_elf32_write_object_contents): Add a check to see if
- there is any final section processing to be done by the
- backend.
- (elf_section_from_bfd_section): Add a check for
- processor-specific section types.
- (elf_slurp_symbol_table): Remove reference to global_sym in the
- elf_backend_data structure. Replace it with a call to
- elf_backend_symbol_processing.
- * libelf.h: Remove global_sym field in the elf_backend_data
- structure. Replace it with a series of backend-specific
- functions.
-
- * elf32-hppa.c (hppa_elf_stub_branch_reloc): The formal argument
- stub_sym should be called target_sym.
- (hppa_elf_build_arg_reloc_stub): Refer to the stub bfd (abfd)
- rather than the output bfd (output_bfd).
- (hppa_elf_reloc): Get rid of references to the global_sym field in
- the elf_backend_data structure.
-
- * elfcode.h (elf_fake_sections): Check the correct condition for
- .bss. Also, detect the existence of a .note section.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): r_format argument should
- have been r_field.
-
- * hosts/hppabsd.h (HOST_MACHINE_ARCH): Reference to bfd_arch_m68k
- should be a reference to bfd_arch_hppa.
-
- * hppa.c (hppa_vec): Replace bfd_false with _bfd_dummy_target in
- the bfd_check_format structure to avoid a type mismatch.
-
-Mon Aug 23 1993 Sean Fagan (sef@cygnus.com)
- and Jim Kingdon (kingdon@cygnus.com)
-
- Add NetBSD support:
- * netbsd386.c: New file.
- * aoutx.h: Make sym_is_debugger_info true for N_FN.
- * Makefile.in, aout-target.h, config.bfd, configure.host, configure.in,
- libaout.h, targets.c: Other changes.
-
-Fri Aug 20 17:04:59 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config/m88k-elf.mt: New file.
- * config.bfd: Use it for m88*-*-sysv4*.
-
-Fri Aug 20 15:16:58 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elfcode.h (elf_build_phdrs): Unused function deleted.
- (bfd_shdr_from_section): Ditto.
- (write_relocs): Don't change section contents for addend.
- (elf_locate_sh): Return type is now always elf_internal_shdr,
- since the other types were really aliases for this type anyways.
- Don't compile this function, since it is static and doesn't appear
- to be used in this file.
- (sym_is_global): Return non-zero for weak symbols. Abort if
- section pointer is null.
- (swap_out_syms): Reorder tests so function symbols can be weak.
- (elf_slurp_symbol_table): Don't use BSF_EXPORT.
- (elf_slurp_reloca_table): Make RELOC_PROCESSING section smaller by
- extracting out some common code. Abort if BFD section symbol has
- null name.
- (elf_slurp_reloc_table): Translate ELF section symbols into BFD
- section symbols. Don't read section contents to fill in addend
- field.
-
- * elf32-i386.c (elf_howto_table): All partial_inplace fields
- should be "true".
-
- * Merged from OSF:
-
- Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
-
- * libelf.h (struct Elf_Sym_Extra): New structure to contain ELF
- specific information for a symbol. Put in elf_sym_num, which
- gives the external symbol number in the elf object file, since
- local symbols must come before global symbols.
- (elf_sym_extra): New macro.
- (elf_symtab_map): Delete, in favor of using Elf_Sym_Extra.
- * elfcode.h (elf_map_symbols): Use Elf_Sym_Extra to map internal
- symbol number to external number. Store the address of the
- Elf_Sym_Extra field for the symbol in the udata field.
- (elf_write_object_contents): Use Elf_Sym_Extra to map out symbols.
-
- Sun Jun 20 16:30:11 1993 Michael Meissner (meissner@osf.org)
-
- * elfcode.h (elf_obj_tdata): Add field to count the size of the
- array of pointers to section symbols.
- (elf_map_symbols): Bump the max index of the section symbols so
- that we don't overwrite memory. Store the max index into the
- elf_obj_tdata field.
-
- Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
-
- * elfcode.h (elf_obj_tdata): Add pointer to an array of pointers
- to the section symbols we created. Remove unused field
- internal_syms.
- (elf_map_symbols): Fill in array of pointers to section symbols.
- Only create section symbols for sections that have SEC_ALLOC set,
- and have non-zero size.
- (elf_symbol_from_bfd_symbol): If udata is NULL, and this is a
- section symbol, look up the section in the list of section
- symbols, and set the udata pointer appropriately. Otherwise, if
- udata is still NULL, fail an assertion, and use 0, instead of
- dropping core.
-
-Fri Aug 20 12:18:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * config.bfd (mips-*-elfl*, mips-*-elf*): New targets, using
- mipslelf and mipsbelf respectively.
- * config/mipslelf.mt, config/mipsbelf.mt: New files.
- * elf32-mips.c: Added some reloc information.
- * configure.in: Fixed error message.
-
- * ecoff.c (ECOFF_LONG_SIZE): Removed. Just use constants.
-
-Thu Aug 19 09:45:51 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * Makefile.in (BFD_LIBS, ALL_MACHINES, BFD32_BACKENDS, BFD64_BACKENDS,
- OPTIONAL_BACKENDS): Alphabetize entries and add a few missing ones.
- * archures.c: Alphabetize decls.
-
- * configure.in, targets.c: Add missing vectors to the tables.
- * targets.c (target_vector) [!SELECT_VECS]: Add DEFAULT_VECTOR.
- Remove hp300bsd_vec due to clash with sunos_big_vec.
-
-Tue Aug 17 18:12:32 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/i386{mach3,osf1mk}.h: New files, for Mach hosting.
- * hosts/i386mach.h: removed, replaced by i386osf1mk.h.
- * config/i386mach3.mt, i386mach3.c: New files, for Mach a.out format.
- * Makefile.in, configure.host, config.bfd: Corresponding changes.
- * hosts/decstation.h: Include <sys/param.h> not <machine/param.h>.
-
-Tue Aug 17 15:19:41 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coffgen.c (coff_section_symbol): If section's output_section is
- not yet set, point to itself. This is needed because this is
- called on the output file, not the input file.
-
- * coff-rs6000.c (dummy_reloc, RTYPE2HOWTO): Set howto field to a
- dummy value, rather than leaving it NULL.
-
- * archures.c (bfd_default_set_arch_mach): Set bfd_error on
- failure.
- * aoutx.h (NAME(aout,set_arch_mach)): Check return value of
- bfd_default_set_arch_mach.
-
-Tue Aug 17 09:42:16 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * config.bfd (cpu): Extract from canonical name with sed.
- * configure.in: Don't pass it.
-
-Sun Aug 15 20:45:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * bfd-in.h: Remove {BYTE,WORD,LONG}_SIZE; they are pointless and
- BYTE_SIZE conflicts with a Mach header.
- * ecoff.c: Change LONG_SIZE to ECOFF_LONG_SIZE and define it.
-
- * configure.host: Make sure all OS fields end in *.
-
-Fri Aug 13 16:33:33 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_slurp_reloc_table): Use bfd_abs_section for
- RELOC_SECTION_NONE and RELOC_SECTION_ABS. If a reloc section
- doesn't exist, don't try to create it.
-
- * nlmcode.h (nlm_write_object_contents): procedure offsets are
- from start of code segment, not start of file.
- * config/i386-nlm.mt (DEFAULT_VECTOR): It's nlm32_i386_vec, not
- bfd_nlm32_i386_vec.
- * configure.in (SELECT_VECS switch): Likewise.
-
-Thu Aug 12 10:32:47 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * format.c (bfd_check_format): If the target matches the default
- target, set match_count to 1, to ignore any previous matches.
-
- * Makefile.in (BFD32_BACKENDS): Remove srec.o, add reloc16.o.
-
- * configure.in: Add reloc16.o when we add
- coff-h8300.o, coff-h8500.o, coff-sh.o, coff-z8k.o.
- Makefile.in (BFD_LIBS): Remove reloc16.o.
-
- * config/u68k-coff.mt: Fix typo, DEFAULT_TARGET for
- DEFAULT_VECTOR.
-
- * config/h8300-coff.mt, h8500-coff.mt, sh-coff.mt, st2000.mt,
- z8k-coff.mt (DEFAULT_VECTOR): Define. Don't explicitly add
- S-records via SELECT_VECS.
-
- * targets.c (target_vector), Makefile.in (BFD_LIBS): Always
- support S-records, for convenience.
-
-Thu Aug 12 08:30:05 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-alpha.c (alpha_howto_table, alpha_finish_reloc,
- alpha_ecoff_swap_reloc_{in,out}, alpha_bfd_reloc_type_lookup):
- Read and write Alpha relocs. Can't process them yet.
- * ecoff.c (ecoff_slurp_reloc_table): Recognize new reloc sections.
- If the section does not already exist, create it.
-
- * ecoffswap.h (ecoff_swap_pdr_{in,out}): Handle new fields defined
- on the Alpha.
-
- * libecoff.h (ecoff_backend_data): Added constructor_reloc and
- finish_reloc fields.
- * ecoff.c: Move MIPS reloc support from here...
- * coff-mips.c: to here.
- * ecoff.c (ecoff_set_symbol_info): Get constructor reloc howto
- from backend.
- (ecoff_slurp_reloc_table): Removed MIPS specific stuff. Call
- finish_reloc backend function.
- (ecoff_write_object_contents): Removed MIPS specific assertions.
- * coff-mips.c (mips_finish_reloc): New function.
- (mips_ecoff_backend_data): Fill in new fields.
- * coff-alpha.c (alpha_ecoff_backend_data): Use NULL for new
- fields.
- * targets.c: Added extern for ecoffalpha_little_vec.
-
- * bfd.c (_bfd_host_big_endian): Removed.
- * bfd-in.h (HOST_BYTE_ORDER_BIG_P, bfd_header_twiddle_required):
- Removed.
- * bfd-in2.h: Regenerated.
-
-Wed Aug 11 12:11:23 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * config.bfd: New file, broken out of configure.in.
- * configure.in: Use it, and use standard target names for
- --with-targets, replacing --with-bfd-targets.
-
- * archures.c (archures_init_table): Add bfd_sh_arch.
-
- * configure.in: Include coff-m68k.o for m68kcoffun_vec.
- Include nlm32.o and nlm.o for bfd_nlm32_i386_vec.
- Fix error in error message.
-
- * oasys.c: Make bfd_error_vector extern.
-
- * configure.in: Include stab-syms.o for a.out/b.out targets
- and hp300{bsd,hpux}.
-
-Wed Aug 11 06:40:51 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * nlmcode.h (nlm_compute_section_file_positions): Add the .bss
- section before setting output_has_begun.
- (nlm_set_section_contents): Remove argument names from
- mangle_relocs_func prototype.
- (nlm_write_object_contents): Remove shadowing local variable.
- Don't write out debugging symbols if debugInfoOffset is -1. Add
- the codeImageOffset to the start, exit, and check procedure
- offsets.
- * nlm32-i386.c (nlm_i386_write_reloc, nlm_i386_mangle_relocs):
- Don't check partial_inplace field; its value is irrelevant.
-
- * Base use of sco-core on host, not target.
- * configure.host (i[34]86-*-sco*): Use i386sco rather than i386v.
- * config/i386-sco.mt (TDEFINES): Removed.
- * config/i386sco.mh: New file to use sco-core.
- * hosts/i386sco.h: New file; just includes hosts/i386v.h.
-
- * ecoffswap.h (ecoff_swap_{hdr,ext}_{in,out}): Use signed
- conversions for some fields.
-
-Tue Aug 10 13:32:23 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_gprel_reloc): If _gp is not defined, give an
- error rather than aborting.
-
- * libnlm.h (struct nlm_backend_data): Added mach field.
- (nlm_machine): New accessor macro.
- * nlm.c (nlm_mkobject): Set architecture and machine from backend
- information.
- * nlm32-i386.c (nlm32_i386_backend): Initialize new mach field.
-
-Tue Aug 10 09:31:18 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * configure.in: Replace calls to sort with shell code
- to uniq the lists.
-
-Tue Aug 10 06:23:16 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * configure.in: Include aout32.o for any a.out/b.out formats.
-
-Mon Aug 9 09:37:18 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * config/i386-linux.mt (SELECT_VECS): Support bfd_elf32_i386_vec.
- * config/m68k-elf.mt (SELECT_VECS): Support m68kcoff_vec.
- * config/i386-elf.mt (SELECT_VECS): Support i386coff_vec.
- * config/hppa-elf.mt (SELECT_VECS): Support hppa_vec.
- * config/sparc-elf.mt (SELECT_VECS): Support sunos_big_vec.
- * config/i386-sco.mt (SELECT_VECS): Don't define; Ian says it was
- just a hack.
-
-Mon Aug 9 13:15:00 1993 K. Richard Pixley (rich@sendai.cygnus.com)
-
- * config/m88k-coff.mt (DEFAULT_VEC -> DEFAULT_VECTOR): renamed.
-
-Mon Aug 9 14:26:45 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * syms.c (BSF_EXPORT): Now same as BSF_GLOBAL.
-
- * bfd.c (bfd_scan_vma): New function.
-
-Mon Aug 9 11:29:53 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * bfd-in.h (bfd_get_architecture, bfd_get_machine): Removed
- obsolete macros.
- * bfd-in2.h: Updated.
-
- * ecoff.c (ecoff_slurp_armap): Correct bug in initialization of
- stringbase.
-
-Sun Aug 8 12:21:13 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * configure.in: Remove unneeded test.
-
-Sun Aug 8 12:41:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * Makefile.in ({dist,real}clean): Use $(MAKE), not make.
-
-Sat Aug 7 09:14:21 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * config/st2000.mt (TDEFINES): Don't define MRI; not used.
-
- * PORTING, TODO, config/README: Update to reflect below changes.
-
- * configure.in: Replace MINIMIZE and --with-minimal-bfd with
- --with-bfd-targets="target1,target2,..." and the special target
- "all" to get the previous default behavior.
- Figure out which architecture and backend .o files are needed from
- DEFAULT_VECTOR, SELECT_VECS, and SELECT_ARCHITECTURES as set in
- the .mt files. Define TDEFAULTS based on them, also.
-
- * Makefile.in: Remove references to MINIMIZE.
- * archures.c, targets.c: Ditto.
-
- * config/*.mt: Define DEFAULT_VECTOR, SELECT_VECS, and
- SELECT_ARCHITECTURES as variables rather than as -D arguments to
- TDEFAULTS.
-
- * config/a29k-coff.mt,alphaosf.mt, i386-sco.mt, i960-bout.mt,
- i960-coff.mt (TDEFAULTS): Don't put the default vector in
- SELECT_VECS manually; it's automatic now.
-
- * config/i386-sco.mt (TDEFAULTS): Don't put &sco_core_vec in
- SELECT_VECS manually; -DSCO_CORE does it automatically now.
-
- * config/h8300-coff.mt, config/h8500-coff.mt, config/sh-coff.mt,
- config/st2000.mt, config/z8k-coff.mt (TDEFAULTS): Don't define
- BFD; not used.
-
- * config/hppaosf.mh (HDEFINES): Don't define SELECT_ARCHITECTURES;
- this is a host, not a target.
-
-Sat Aug 7 05:28:03 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * elfcode.h (elf_object_p): Add comment about what this function
- does and to watch out for side effects. Add FIXME for memory leaks.
- Fix comment about checking for matching byte order. Preserve
- pointer to old tdata (if any), and restore it if we don't match
- file with target vector. If we are going to use goto's, use them
- consistently and maintainably.
- * nlmcode.h (nlm_object_p): Expand comments about leaked memory
- to note that the problem is even more serious than just leaked
- memory. Replace goto with more traditional return.
-
-Fri Aug 6 12:00:03 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- Fix incorrect or useless makefile variable definitions:
- * config/news.mt, config/u68k-coff.mt (TDEFAULTS): Use this to
- define DEFAULT_VECTOR, instead of TDEFINES.
- * config/i386aix.mh (MINIMIZE): Don't define.
- * config/hppaosf.mh (MINIMIZE): Don't conditionalize.
- * config/rs6000.mh (ALLOCA),
- * config/i386v.mh (ALLOCA),
- * config/i386linux.mh (ALLOCA),
- * config/i386isc.mh (ALLOCA),
- * config/go32.mh (EXTRALIBS): Don't define; not used.
- * config/solaris2.mh (HDEFINES): Renamed from H_DEFINES.
- * config/alphaosf.mt (TDEFINES): Set it, not HDEFINES.
- * config/z8k-coff.mt (CC): Don't define. It's a target, not a host.
-
- * config/README: New file, explaining the variables.
-
- * targets.c (target_vector): Add hp300_bsd_vec.
- * Makefile.in (BFD32_BACKENDS, CFILES): Add hp300bsd.
- (hp300bsd.o): New rule.
-
-Fri Aug 6 15:13:22 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * libelf.h (NAME): Provide a default definition, that's neither
- for 32 bits nor for 64.
-
- Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
-
- * libelf.h (elf_hash): Change declaration to bfd_elf_hash, since
- that is what is in elf.c.
-
-Fri Aug 6 12:28:38 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_set_symbol_info): Removed special handling for
- scBss and scSBss symbols, since it was wrong.
-
- * Makefile.in (coff-mips.o, coff-alpha.o): Don't depend on
- coffcode.h.
-
- * coffcode.h (sec_to_styp_flags): Inspired by mb@tti.COM (Michael
- Bloom): Only set STYP_BSS for SEC_ALLOC sections.
-
- * ecoff.c (ecoff_slurp_armap): From Arne Henrik Juul
- <arnej@kari.fm.unit.no>: Handle a COFF style armap.
-
-Fri Aug 6 09:59:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hpux-core.c: Cast return value from bfd_zalloc.
-
-Thu Aug 5 13:22:44 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * aoutx.h (log2): Delete i387-specific code.
-
- * Makefile.in (BFD_LIBS): Always include elf.o.
- (BFD32_BACKENDS): Don't include elf.o here.
- (ofiles): Delete references to ofiles2 and ofiles3.
- (do_clean): Delete ofiles.
- (BFDIN_H): Changed references to $(srcdir)/bfd-in2.h.
- (stmp-bfd.h): Use bfd.h-new as temporary name, not bfd.h2.
- (headers): Use bfd-in2.h-new as temporary name, not bfd.h-new.
-
- * bfd-in.h: Reworded comment to make it clear that bfd-in2.h is a
- generated file.
-
- * reloc.c (enum bfd_reloc_code_real): Added i386-elf reloc types
- (from Meissner's additions to bfd-in2.h).
-
- * elf32-i386.c (ELF_MAXPAGESIZE): Define.
-
- Merged:
-
- Wed Jun 23 06:05:58 1993 Michael Meissner (meissner@osf.org)
-
- * elfcode.h (elf_write_object_contents): Don't drop core if
- elf_symbol_from returns a NULL pointer when processing a non-elf
- symbol, use a 0 size instead.
-
- Tue Jun 15 14:38:32 1993 Michael Meissner (meissner@osf.org)
-
- * elfcode.h (elf_hash): Delete macro mapping elf_hash to
- bfd_elf32_hash, since the hash table is independent of the 32/64
- bit system.
-
- * libelf.h (elf_hash): Change declaration to bfd_elf_hash, since
- that is what is in elf.c.
-
- Sat Jun 19 10:12:27 1993 Michael Meissner (meissner@osf.org)
-
- * elf32-i386.h (reloc_type): Reformat spacing.
- (elf_howto_table): Add the rest of the 386/ELF relocations.
- (elf_i386_reloc_type_lookup): Ditto.
- (elf_i386_info_to_howto): Ditto.
- (elf_i386_info_to_howto_rel): Ditto.
-
-Thu Aug 5 10:07:43 1993 Fred Fish (fnf@cygnus.com)
-
- * nlmcode.h (nlm_get_reloc_upper_bound): Test return value
- of nlm_slurp_symbol_table as boolean, not pointer.
- * nlmcode.h (nlm_canonicalize_reloc): Test return value
- of nlm_slurp_reloc_fixups as boolean, not pointer.
-
-Wed Aug 4 16:22:55 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * config/go32.mh: remove HDEFINES; since __MSDOS__ and __GO32__
- are now predefined by GCC
-
-Wed Aug 4 16:06:29 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * coffgen.c (coff_print_symbol): Add the section offset to the
- line number address, so it's printed the same way as the function
- address. Only showed up for line numbers that aren't in the first
- section (.text).
-
-Wed Aug 4 08:33:55 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * libnlm.h (nlm_backend_data): Added nlm_mangle_relocs.
- (nlm_mangle_relocs_func): New macro.
- * nlm32-i386.c (nlm_i386_write_reloc): Rewrote correctly.
- (nlm_i386_mangle_relocs): New function.
- * nlmcode.h (nlm_compute_section_file_positions): Move all common
- symbols into the .bss section.
- (nlm_set_section_contents): Call the mangle_relocs function.
- (nlm_write_object_contents): Treat a reloc against any defined
- symbol as an internal reloc. Fix bug in external reloc counting.
- Get the offset and debugging type right for .bss symbols. Only
- output debugging symbols for defined symbols.
-
- * coff-h8500.c (rtype2howto): Do an fprintf to stderr rather than
- using printf.
- * coff-z8k.c (rtype2howto): Likewise.
- * coffcode.h (dummy_reloc16_extra_cases): Likewise.
- * elf32-i386.c (TRACE): Likewise.
- * hp300hpux.c (convert_sym_type, swap_std_reloc_in): Likewise.
- * rs6000-core.c (rs6000coff_get_section_contents): Likewise.
- * coffgen.c (coff_print_symbol): Do an fprintf to the file
- argument rather than using printf.
-
-Tue Aug 3 18:17:25 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coffswap.h: Added macros used when accessing several fields;
- default is the same as before.
- (coff_swap_aouthdr_{in,out}): Handle the Alpha ECOFF fields.
- * coff-alpha.c: Defined macros to use the right sizes in
- coffswap.h.
- * libecoff.h: Backend information is now in target vector, not
- BFD. Start of backend information is COFF backend information.
- * coff-alpha.c, coff-mips.c: Changed accordingly.
- * ecoff.c (ecoff_mkobject): New function.
- (ARMAP_START): Changed into backend information, since Alpha uses
- a different name.
- (ecoff_slurp_armap): Don't overlay archive header.
- * bfd.c: Include libcoff.h.
-
-Tue Aug 3 16:33:11 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * Makefile.in (install): Fix sh syntax error.
-
- * aoutf1.h: Make bfd_error_trap extern; it's defined in bfd.c.
-
-Tue Aug 3 15:19:09 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * nlmcode.h (nlm_slurp_symbol_table): Don't use '&' on arrays.
-
-Tue Aug 3 11:06:28 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * ecoff.c: New file for generic ECOFF functions.
- * ecoffswap.h: New file for ECOFF swapping functions which differ
- only slightly for different targets.
- * libecoff.h: Added prototypes for ecoff.c functions.
- (ecoff_backend_data): New structure.
- (ecoff_tdata): Added backend_data field. Changed external data
- pointers to be PTR rather than to a particular struct.
- (ecoff_symbol_struct): Moved in from coff-mips.c.
- * coff-alpha.c, coff-mips.c: Moved common functions into ecoff.c.
- Added ECOFF backend structures. Include ecoffswap.h.
- * coff-msym.c: Removed; superseded by ecoffswap.h.
- * bfd.c: Include coff/internal.h.
- * Makefile.in (BFD_LIBS): Removed coff-mips.o and coff-msym.o.
- Added ecoff.o.
- (BFD64_BACKENDS): Added coff-alpha.o.
- (CFILES): Removed coff-msym.c. Added ecoff.c.
- (bfd.o): Added dependency on $(INCDIR)/coff/sym.h.
- (coff-mips.o): Added dependency on ecoffswap.h and coff/ecoff.h.
- (ecoff.o, coff-alpha.o): New targets.
- (coff-msym.o): Removed target.
-
-Mon Aug 2 23:33:38 1993 John Gilmore (gnu@cygnus.com)
-
- * elf32-hppa.h, hosts/*: Remove (one more time) all occurrances
- of EXFUN in the BFD sources. Heave ho!
-
-Mon Aug 2 16:45:57 1993 Stu Grossman (grossman at cygnus.com)
-
- * coffcode.h (coff_set_arch_mach_hook): Add check for I386LYNXMAGIC.
-
-Mon Aug 2 12:18:03 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * hosts/sun3.h: remove some more conflicting decls
-
-Mon Aug 2 11:48:23 1993 Stu Grossman (grossman at cygnus.com)
-
- * i386lynx.c: Remove unnecessary def of N_HEADER_IN_TEXT,
- redefine TEXT_START_ADDR to be 0.
-
-Sun Aug 1 22:54:08 1993 Stu Grossman (grossman at cygnus.com)
-
- * configure.host, configure.in, hosts/i386lynx.h: Lynx/386
- host and target info.
-
-Fri Jul 30 18:08:27 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * nlm32-i386.c: New file. First cut at i386 NLM code.
- * libnlm.h: Added some more prototypes.
- (struct nlm_relent): New structure.
- (nlmNAME(symbol_type)): Added rcnt and relocs fields.
- (struct nlm_obj_tdata): Added new fields: nlm_symbols,
- nlm_text_low, nlm_data_low, nlm_reloc_fixups,
- nlm_reloc_fixup_secs.
- (struct nlm_backend_data): New structure, with accessor macros.
- * nlmcode.h: Use NLM_HIBIT rather than MSB.
- (nlm_object_p): Set SEC_RELOC for .text and .data. Don't set
- SEC_DATA for .bss. Set HAS_RELOC and HAS_SYMS for abfd. Set the
- architecture.
- (nlm_swap_fixed_header_out, nlm_swap_variable_header_out,
- find_nonzero, nlm_swap_auxiliary_headers_out): New outbound
- swapping functions.
- (nlm_get_symtab_upper_bound, nlm_slurp_symbol_table): Include
- external references in symbol table as undefined symbols.
- (nlm_get_symtab, nlm_slurp_symbol_table): Fill in alocation
- argument in get_symtab rather than in slurp_symbol_table.
- (nlm_slurp_symbol_table): Save symbol information in tdata.
- (nlm_print_symbol): New function.
- (nlm_slurp_reloc_fixups, nlm_get_reloc_upper_bound,
- nlm_canonicalize_reloc): New functions to read relocs.
- (nlm_compute_section_file_positions, nlm_set_section_contents,
- nlm_external_reloc_compare, nlm_write_object_contents): New
- functions to create NLM files.
- * nlm-target.h: Define all the nlm functions here either as
- default values or in terms of nlmNAME. Use JUMP_TABLE(nlm). Set
- the backend_data field to TARGET_BACKEND_DATA.
- * nlm32-gen.c, nlm64-gen.c: Don't define function macros here;
- they are now in nlm-target.h.
- (TARGET_BACKEND_DATA): Define as NULL.
- * nlm.c (nlm_mkobject): Do allocate the tdata field.
- (nlm_set_arch_mach): New function.
- * targets.c: Added nlm32_i386_vec.
- * Makefile.in (BFD32_BACKENDS): Added nlm32-i386.o.
- (CFILES): Added nlm32-i386.c.
- (nlm32-gen.o, nlm64-gen.o): Depend on nlm-target.h.
- (nlm32-i386.o): New target.
-
-Thu Jul 29 20:20:39 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * hosts/sun3.h: remove some function decls that conflict w/ ANSI
- C, and aren't needed anyway (return int)
-
-Wed Jul 28 15:46:38 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elfcode.h: Use casts with bfd_alloc and alloca.
-
-Tue Jul 27 12:51:43 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * nlm{32,64}-gen.c (JUMP_TABLE_PREFIX): Delete.
- * nlm{32,64}-gen.c (JUMP_TABLE_INIT): New macro that works with
- older cpp's, that don't do additional replacement on the JUMP_TABLE
- macro's argument.
- * nlm-target.h (JUMP_TABLE_INIT): Use new macro in place of
- JUMP_TABLE macro.
-
-Mon Jul 26 17:39:01 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- Yet another trad-core variant:
- * config/esix.mh, hosts/esix.h: New files.
- * configure.host: Use them.
-
-Mon Jul 26 13:22:15 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * reloc.c (bfd_perform_relocation): Handle the case of
- complain_overflow_bitfield, rightshift > bitpos, and a negative
- number.
-
-Mon Jul 26 14:40:10 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elfcode.h: Reimplement segment writing.
- (elf_write_phdrs): Use precomputed e_phoff rather than making
- assumptions.
- (elf_build_phdrs): Disabled, for now.
- (assign_file_position_for_section): Don't change file offset for
- SHT_NOBITS.
- (assign_file_positions_for_symtab_and_strtabs): New function.
- (struct seg_info): New type.
- (map_program_segments): New function.
- (assign_file_positions_except_relocs): For executables, leave
- section headers &c for last, and properly align all sections with
- flag SHF_ALLOC set.
- (prep_headers): No longer abort when EXEC_P is set.
- (write_shdrs_and_ehdr): Deleted all code relating to program
- segments.
-
- * elfcode.h (various): Deleted some unused code, and debugging
- "malloc(0)" calls.
- (write_relocs): Cache value of last symbol looked up, to save
- time if the symbol is referred to repeatedly.
- (elf_fake_sections): Check only SEC_RELOC flag, not number of
- relocs.
- (assign_section_numbers): Likewise.
-
- * Makefile.in (ofiles): Stars in wildcards belong outside quotes.
-
- * libelf.h (struct elf_backend_data): New field, maxpagesize.
- (struct elf_obj_tdata): New field, phdr.
- * elf32-target.h (elf32_bed): Initialize maxpagesize from
- ELF_MAXPAGESIZE.
- (ELF_MAXPAGESIZE): Default to 1.
- * elf64-target.h (elf64_bed, ELF_MAXPAGESIZE): Likewise.
- * elf32-sparc.c (ELF_MAXPAGESIZE): Define.
- (elf_sparc_howto_table): All relocs should have pcrel_offset=true.
- Most should have length field of `2'.
-
- * reloc.c (bfd_perform_relocation): Handle 64-bit relocs.
-
- * config/sparc-aout.mt (TARGET_BACKENDS): Define.
-
-Mon Jul 26 08:56:16 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * configure.in: Don't look in ${srcdir} for ${target_makefile_frag};
- the top level script has already adjusted for it.
-
-Mon Jul 26 08:09:19 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * srec.c (srec_write_symbols): Get CR LF in the right order.
-
-Mon Jul 26 02:08:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/vaxbsd.h: Include std-host.h. Don't include <machine/param.h>.
-
-Sat Jul 24 16:13:01 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * reloc.c (bfd_perform_relocation): Handle case of rightshift !=
- bitpos when overflow checking.
-
-Fri Jul 23 10:20:27 1993 Doug Evans (dje@canuck.cygnus.com)
-
- * bfd.c (bfd_nonrepresentable_section, bfd_undefined_symbol,
- bfd_reloc_value_truncated, bfd_reloc_is_dangerous, bfd_assert):
- Send error messages to stderr.
-
-Thu Jul 22 15:57:29 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * nlm{32,64}-target.h: Remove.
- * nlm-target.h: New file, merged from nlm{32,64}-target.h
- * libnlm.h (NLM_ARCH_SIZE): Define to ARCH_SIZE.
- * nlm.c (ARCH_SIZE): Remove define to zero.
- * nlm32-gen.c (ARCH_SIZE): Define to 32.
- * nlm32-gen.c (JUMP_TABLE_PREFIX): Define to nlm32.
- * nlm{32,64}-gen.c (nlm-target.h): Include.
- * targets.c, libnlm.h, nlm.c, nlm{32,64}-gen.c, nlm{32,64}.c,
- nlmcode.h: Convert prefixes from bfd_nlm<size> to just
- nlm<size>, and use macros select size.
-
-Thu Jul 22 15:40:14 1993 K. Richard Pixley (rich@sendai.cygnus.com)
-
- * Makefile.in (Makefile): add configure.in, drop redundant
- $(srcdir), drop redundant ./
-
-Thu Jul 22 13:34:57 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * hpux-core.c: New file; backend for HP/UX style core files.
- * bfd.c (struct _bfd): Renamed hppa_core_data field to
- hpux_core_data.
- * bfd-in2.h: Updated.
- * hppa.c (make_bfd_asection, hppa_core_file_p,
- hppa_core_file_failing_command, hppa_core_file_failing_signal,
- hppa_core_file_matches_executable_p): Moved into hpux-core.c.
- Removed from target vector.
- * libhppa.h (struct hppa_core_struct and accessor macros): Moved
- into hpux-core.c.
- * targets.c: If HPUX_CORE is defined, add hpux_core_vec to
- target list.
- * config/hp300.mh (HDEFINES): Set to -DHPUX_CORE.
- (HDEPFILES): Set to hpux-core.o.
- * config/hppabsd.mh, config/hppahpux.mh: Likewise.
- * hosts/hp300.h (HOST_HP300HPUX): Define.
- * Makefile.in (OPTIONAL_BACKENDS): Added sco-core.o,
- aix386-core.o, hpux-core.o.
- (sco-core.o, aix386-core.o, hpux-core.o): New dependencies.
-
- * reloc.c (enum complain_overflow): New enumeration with the
- various flavours of overflow checking.
- (srtuct reloc_howto_struct): Changed complain_on_overflow field
- from boolean to emum complain_overflow. Removed obsolete absolute
- field.
- (HOWTO): Removed absolute argument.
- (bfd_perform_relocation): Do overflow checking on all types of
- fields.
- * bfd-in2.h: Updated accordingly.
- * all targets: Updated initialization of reloc howto tables.
-
-Wed Jul 21 20:34:34 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * opncls.c (bfd_create): Don't use C++ keyword "template" as a C
- variable name.
-
-Tue Jul 20 15:02:23 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * coff-m68k.c (m68k_howto2rtype): Make arg CONST to match callers.
-
- * elfcode.h: Fix several illegal pointer combination warnings for
- usages of bfd_alloc and alloca.
-
- * libnlm.h (nlm_obj_tdata): Rename hidden struct members to avoid
- apparent Sun C preprocessor recursion. Fix access macros.
- * nlmcode.h: Remove spurious '&' before several array references.
-
-Tue Jul 20 14:36:27 1993 Jim Kingdon (kingdon@deneb.cygnus.com)
-
- * Rename for DOS uniqueness: coff-m68k-un.c -> coff-u68k.c
- config/m68k-coffun.mt -> u68k-coff.mt.
- * Makefile.in, configure.in: Corresponding changes.
-
-Tue Jul 20 16:21:52 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elf32-sparc.c (elf_sparc_howto_table): Don't use "&" before
- function name; it's valid without, and some compilers give
- warnings with it there.
-
-Tue Jul 20 08:21:15 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * bfd-in.h: Apply some of the changes that were made to bfd-in2.h.
- * bfd.c (union tdata): Add nlm_obj_data;
- * targets.c (enum target_flavour): Add bfd_target_nlm_flavour.
-
-Mon Jul 19 20:46:18 1993 Fred Fish (fnf@deneb.cygnus.com)
-
- * configure.in (*-*-netware, i[34]86-*-netware): New configs.
- * Makefile.in (BFD32_BACKENDS): Add nlm.o, nlm32.o, nlm32-gen.o.
- * Makefile.in (BFD64_BACKENDS): Add nlm64.o, nlm64-gen.o.
- * Makefile.in (CFILES): Add nlm{32,64}.c, nlm{32,64}-gen.c.
- * Makefile.in (nlm.o, nlm{32,64}.o, nlm{32,64}-gen.o: New targets.
- * bfd-in2.h (INLINE): Defines moved here.
- * {aoutx.h, elf.c, elfcode.h}: Move INLINE defines to bfd-in2.h.
- * libelf.h (CAT4): Move define to bfd-in2.h.
- * bfd-in2.h (CAT4): Merge CAT4 macro with other CAT macros.
- * bfd-in2.h (union tdata): Add nlm_obj_data.
- * bfd-in2.h (enum target_flavour): Add bfd_target_nlm_flavour.
- * targets.c (bfd_nlm{32,64}_{big,little}_vec): Add prototypes.
- * targets.c (target_vector): Add bfd_nlm{32,64}_{big,little}_vec.
- * (libnlm.h, nlm.c, nlmcode.h, nlm{32,64}-gen.c,
- nlm{32,64}-target.h, nlm{32,64}.c, config/i386-nlm.mt): New files
- for NLM support.
-
-Mon Jul 19 15:09:01 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * configure.{hosts,in}: add i[34]86-*-lynxos* support
-
-Mon Jul 19 14:53:30 1993 Ken Raeburn (raeburn@rtl.cygnus.com)
-
- * elf.c, elfcode.h, libelf.h: Serious reorganization.
- Deleted `thunk' structure, merged into tdata, duplicate data
- eliminated.
- Rearranged functions, grouping by functionality.
- Broke up many functions in elfcode.h, re-ordered many parts of
- file writing to handle unpredictable state of section relocation
- table as provided by various applications.
- Still needs cleanup: Merge functions back together, split out
- data structure with only data that is used only when writing out
- object file.
-
- * elf.c (bfd_elf_generic_reloc): New function, taken from
- coff-mips.c.
- * elf32-sparc.c (elf_sparc_howto_table): Use it, to work around
- bfd_perform_relocation lossage.
-
- * Makefile.in (BFD_LIBS): Include coff-mips.o and coff-msym.o, so
- that gdb will link.
- (ofiles): Don't use sort or uniq; do it with sh constructs.
-
-Sun Jul 18 19:42:14 1993 Jim Kingdon (kingdon@rtl.cygnus.com)
-
- * coffcode.h: Recognize I386PTXMAGIC.
- * aoutf1.h, libaout.h: Add M_386_DYNIX.
- * trad-core.c (TRAD_CORE_USER_OFFSET, TRAD_CORE_STACK_FILEPOS):
- New macros; use it if defined.
- * config/symmetry.mh, hosts/symmetry.h: New files.
-
-Fri Jul 16 14:56:31 1993 Jim Kingdon (kingdon@rtl.cygnus.com)
-
- * Rename elf{32,64}-generic.c to *-gen.c for 14 char filenames.
- * Makefile.in: Change accordingly.
- (CFILES): Add elf64-gen.c.
-
-Fri Jul 16 09:53:23 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c: Use MIPS_AOUT_{OZ}MAGIC rather than {OZ}MAGIC.
-
-Thu Jul 15 16:02:07 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-m88k.c (howto_table): Corrected bitsize for R_PCR26L from
- 16 to 26.
-
-Wed Jul 14 15:29:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hppa.c [HOST_HPPABSD]: Use hpux-style core files.
- * libhppa.h [HOST_HPPABSD]: Include hpux version of core.h
-
-Wed Jul 14 09:30:48 1993 Doug Evans (dje@canuck.cygnus.com)
-
- * configure.in: Recognize h8300h-*-*.
-
-Tue Jul 13 12:03:00 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * coff-h8500.c (reloc_processing, rtype2howto): New relocation
- type R_H8500_HIGH_16.
- * coff-sh.c (r_imm32): Get the width of the reloc right.
-
-Tue Jul 13 16:48:56 1993 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr)
-
- * configure.in: Add new target m68k-coffun to the dpx/2.
- * config/m68k-coffun.mt: New file, renamed from config/dpx2.mt.
-
-Mon Jul 12 10:42:49 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
-
- * reloc.c (enum bfd_reloc_code_real): Move SPARC_BASE13 reloc into
- sparc-aout-specific list.
-
- * libelf.h (struct elf_obj_tdata): Add field `thunk'.
-
- * config/sparc-elf.mt (TARGET_BACKENDS): New make variable.
-
-Thu Jul 1 14:52:47 1993 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr)
- and Jim Kingdon (kingdon@cygnus.com)
-
- * elfcode.h: Use memset not bzero.
- * trad-core.c: Don't include <sys/file.h>.
- * i386linux.h: Include <sys/file.h>.
- * coff-m68k-un.c: new file to handle names with underscores on
- svr3 machines.
- * coff-m68k.c (m68k_rtype2howto): added #ifdef ONLY_DECLARE_RELOCS
- to not duplicate the function in the executable.
- (TARGET_SYM, TARGET_NAME, NAMES_HAVE_UNDERSCORE): new macros needed
- by coff-m68k-un.c.
- * coffcode.h (MC68KBCSMAGIC): case added.
- * targets.c: Add m68kcoffun_vec.
- * configure.host: added support for Bull dpx/2.
- * config/dpx2.mh, hosts/dpx2.h: new files.
- * Makefile.in: added target coff-m68k-un.
-
-Fri Jul 9 00:43:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * aoutf1.h: Add definition of MACHTYPE_OK.
-
-Thu Jul 8 14:37:44 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * reloc.c (bfd_perform_relocation): Don't subtract the addend
- again for coff.
-
- * syms.c, bfd-in2.h: Doc fix.
-
- * coffcode.h (CALC_ADDEND): Check for common section using the
- section flag as well as the symbol flag.
-
-Thu Jul 8 13:43:52 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/i386bsd.h: Conditionalize HOST_STACK_END_ADDR on __bsdi__.
- i386bsd.c: Remove defines of N_TXT*; the versions in aout64.h should
- be sufficient. Define TEXT_START_ADDR.
-
-Wed Jul 7 10:56:21 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * aoutx.h (translate_from_native_sym_flags): Removed statep
- argument. Just let an indirect symbol point to the next symbol
- without forcing the next symbol to be undefined. Changed all
- callers.
- * hp300hpux.c (slurp_symbol_table): Changed call to
- translate_from_native_sym_flags.
- * targets.c: Added hp300hpux_vec.
- * Makefile.in (hp300hpux.o): Added dependencies.
-
-Tue Jul 6 13:24:55 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * reloc.c (enum bfd_reloc_code_real): Put simple power-of-two
- relocs together, and add 64-bit versions.
- (bfd_generic_get_relocated_section_contents): Argument to alloca
- is size_t.
-
- * libbfd.c (bfd_xmalloc_by_size_t): New function.
- * opncls.c (bfd_cache_init, bfd_open_file): Add prototypes to
- declarations.
- (obstack_chunk_alloc): Use bfd_xmalloc_by_size_t.
- (new_bfd): Prototype-style definition, using DEFUN.
- (bfd_alloc_grow, bfd_alloc, bfd_zalloc, bfd_realloc): Size
- argument is type size_t, not bfd_size_type.
- * ieee.c (obstack_chunk_alloc): Use bfd_xmalloc_by_size_t.
- * bfd.c (bfd_default_error_trap, bfd_error_trap,
- bfd_error_nonrepresentabltrap): Prototypes.
- * libbfd-in.h (bfd_alloc, bfd_zalloc, bfd_realloc,
- bfd_alloc_grow): Adjusted prototypes for arg type change.
- * archive.c (get_elt_at_filepos, do_slurp_bsd_armap, normalize,
- do_slurp_coff_armap, bfd_construct_extended_name_table):
- Prototypes.
- * elfcode.h (elf_string_from_elf_strtab): Prototypes.
- * libelf.h (elf_string_from_elf_section, elf_get_str_section):
- Prototypes.
-
- * Makefile.in (ALL_MACHINES): Renamed from BFD_MACHINES.
- (ofiles): New target. Build a list of unique file names, in case
- any got duplicated.
- (TARGETLIB): Use list of files from ofiles.
- * configure.in: Set BFD_MACHINES and BFD_BACKENDS depending on
- minimal-bfd flag and target makefile frag contents.
-
- * elfcode.h (elf_read): Delete static declaration, since function
- has moved.
- (elf_map_symbols): Write out section symbols for all sections, for
- now.
- (elf_symbol_from_bfd_symbol): Allow match if both symbols are
- section symbols for the same section.
- (elf_find_nearest_line): Don't print message, just return false.
-
- * libelf.h (bfd_elf_locate_sh): Declaration deleted.
-
-Mon Jul 5 16:48:11 1993 Doug Evans (dje@canuck.cygnus.com)
-
- * cpu-h8300.c (h8300_scan): Fix parsing of architecture string.
-
-Fri Jul 2 18:27:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * Makefile.in (clean): Remove bfd.h and stmp-bfd.h.
- (realclean): Remove generated headers.
-
-Fri Jul 2 14:51:51 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * section.c (bfd_set_section_content): Deny if file is not opened with
- the proper mode, set output_has_begun if file is openened for update.
- * aoutx.h (aout_*_set_section_content): Remove checks that are now
- done in bfd_set_section_content.
-
-Fri Jul 2 09:25:20 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * hosts/std-host.h: Removed declarations of printf, fprintf,
- fcntl, fread and fwrite. They are all error prone for one reason
- or another. Changed declaration of memchr from char * to PTR.
-
- * configure.in (mips-*-riscos*): New target; use riscos.
- * configure.host (mips-*-riscos*): New host; use riscos.
- * config/riscos.mh (HDEFINES): Add -G 4.
-
- * libaout.h (GET_SWORD): Use the bfd_h_get_signed entry points
- rather than casting the result of bfd_h_get.
-
-Fri Jul 2 10:13:48 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * configure.in, hosts/delta68.h, config/delta68.mh: Add stuff for
- Motorola Delta 68.
-
-Wed Jun 30 06:02:43 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * targets.c (bfd_elf64_{big,little}_generic_vec): Declare, and
- include in search list if BFD64 is defined.
-
- * libelf.h (CAT4): Added a version for Saber-C, ANSI mode.
- (bfd_elf64_*): Declarations for 64-bit versions of many routines.
-
-Tue Jun 29 22:50:59 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elf64-target.h, elf64-generic.c: New files.
- * Makefile.in (BFD64_BACKENDS): Include elf64-generic.o.
- (elf64-generic.o): List dependencies.
-
- * Makefile.in: List target `all' explicitly before host/target
- makefile fragments are included, in case they define any new
- targets.
-
- * elfcode.h (ELF_R_INFO, ELF_R_SYM): Define as 32- or 64-bit
- versions as appropriate. Uses updated.
- (elf_debug_section): Declare before use.
- (elf_debug_file): New function.
- (bfd_section_from_shdr, bfd_shdr_from_section, elf_fake_sections):
- Alignment value in section header is n_bytes, not log2.
- (new_section_hook): Do nothing for now.
- (bfd_section_from_shdr): Use Elf_External_Rel[a], not 32-bit
- version explicitly.
- (elf_core_file_p): Simplify check for correct class (word size).
- (elf_make_sections, elf_fake_sections, elf_write_object_contents):
- Initialize all fields when creating data structures.
- (elf_locate_sh): Renamed from bfd_elfXX_locate_sh, made static.
- (elf_compute_section_file_positions): Set correct class in output
- file.
- (elf_write_object_contents): Section symbols have empty names in
- output file.
-
- * libbfd.c (bfd_xmalloc, zalloc): Be sure to cast malloc, memset
- args to size_t before call.
- (bfd_add_to_string_table): Cast zalloc arg to bfd_size_type.
-
-Tue Jun 29 10:49:42 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_find_nearest_line): If procedure has no line
- number information, return 0 for line number.
-
-Mon Jun 28 10:45:02 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * aoutx.h (some_aout_object_p): If *oldrawptr is non-NULL, copy it
- into *rawptr.
-
-Sun Jun 27 09:05:19 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/riscos.h: Define NBPG and UPAGES.
-
-Sun Jun 27 16:28:26 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * elfcode.h (elf_slurp_symbol_table): Don't use obj_raw_syms as
- lvalue; it contains a cast.
-
-Fri Jun 25 17:09:55 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h (hash, compare, struct stringtab_entry, add_to_stringtab):
- Use unsigned hash values for better hashing.
- (hash): Hash in the string length for long strings.
-
-Thu Jun 24 15:47:51 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h (compare): Replace 3 if's with a subtraction.
- (translate_to_native_sym_flags, add_to_stringtab): Reorder tests
- in decreasing order of success, as an optimization.
- (hash): Take a length arg; ignore chars after #25, for speed.
- (add_to_stringtab): Pass length to hash.
-
-Thu Jun 24 17:25:51 1993 Ken Raeburn (raeburn@poseidon.cygnus.com)
-
- * elf32-sparc.c (sparc_reloc_map): Add SPARC_WDISP22 reloc.
-
- * elfcode.h (elf_new_section_hook): Do nothing for now.
- (elf_write_object_contents): Output common symbols the way ELF
- wants them.
-
-Wed Jun 23 16:20:07 1993 Ken Raeburn (raeburn@poseidon.cygnus.com)
-
- * libelf.h (struct elf_obj_tdata and associated macros): Moved
- here from elfcode.h. A couple of size-specific structure pointers
- were changed to PTR; uses fixed appropriately.
- (elf32_symbol_type, elf64_symbol_type): Separated definitions.
- (bfd_elf_mkobject): Renamed from bfd_elf32_mkobject.
- (bfd_elf32_mkobject, bfd_elf64_mkobject, elf_mkobject): New
- temporary macros to ease name change.
- * elf.c (elf_read, elf_mkobject, elf_get_str_section,
- elf_string_from_elf_section, bfd_elf_find_section): Moved here
- from elfcode.h.
- * doc/Makefile.in (libbfd.h): Process elf.c too.
- * Makefile.in (elf.o): Note new dependencies.
-
- * elfcode.h: Lots of stuff moved elsewhere. Deleted some unused
- code, tweaked some debug hooks.
- (elf_slurp_reloca_table): Translate ELF section symbols into BFD
- section symbols.
-
-Wed Jun 23 11:34:21 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * hosts/riscos.h: New file.
-
-Tue Jun 22 14:35:20 1993 Ken Raeburn (raeburn@poseidon.cygnus.com)
-
- * elfcode.h (bfd_section_from_shdr, case SHT_PROGBITS): Even if
- section already exists, use its pointer to fill in rawdata slot.
-
-Tue Jun 22 16:36:51 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/std-host.h: Return value of puts and fputs is int not void.
-
-Tue Jun 22 14:25:58 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h (howto_table_ext): Comment the field names.
- * reloc.c (bfd_perform_relocation): Fix max and min values.
-
-Mon Jun 21 18:19:14 1993 Ken Raeburn (raeburn@poseidon.cygnus.com)
-
- * elf32-target.h, elf32-hppa.c, elfcode.h: Use new
- size-independent elf internal data structures.
- * elfcode.h (put_word, get_word): Define as appropriate for
- architecture word size. Structure swapping functions changed to
- use them as appropriate.
-
- * configure.in: If compiling 64-bit back ends, do them before
- 32-bit ones.
-
- * libelf.h: Use new size-independent versions of elf internal data
- structures.
- (symbol_type): Reordered to put any fields dependent on target
- size at the end.
- (elf_backend_data): Renamed from elf##_backend_data and made
- size-independent.
- (elf_sect_thunk): Now size-independent.
-
- * libbfd.c (bfd_log2): Now returns unsigned int.
-
-Mon Jun 21 12:30:47 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * Rename config/m88k-aout.mt to config/noop.mt.
- configure.in: Use it for mips-*-bsd*.
-
-Sun Jun 20 20:32:19 1993 Ken Raeburn (raeburn@poseidon.cygnus.com)
-
- * cpu-m68k.c (arch_info_struct): Eliminate "partially bracketed
- initializer" warning from gcc.
- * cpu-h8500.c (arch_info_struct): Likewise.
- * cpu-sh.c (arch_info_struct): Likewise.
-
- * cpu-h8300.c (local_bfd_reloc_type_lookup, howto*_callback,
- howto_*): Unused functions and variables commented out.
- * cpu-z8k.c (local_bfd_reloc_type_lookup, howto*_callback,
- howto_*): Likewise.
- * cpu-h8500.c (compatible): Likewise.
- * cpu-sh.c (compatible): Likewise.
-
- * hp300hpux.c (swap_std_reloc_in): Delete unused variables.
- Always set a valid length value, even for invalid input.
-
- * srec.c (srec_write_symbols): Use sprintf_vma.
-
- * bfd-in.h (uint64_typeLOW, uint64_typeHIGH, int64_type,
- uint64_type): Provide default definitions.
- * hosts/std-host.h (int64 stuff): Remove them from here.
-
- * bfd-in.h (sprintf_vma): Define parallel to fprintf_vma.
-
- * elf32-i386.c (elf_i386_reloc_type_lookup): Delete unused
- variable. Added default case to switch.
-
- * aoutx.h (translate_from_native_sym_flags): Before casting
- pointers to integers, make sure the integer type is wide enough.
- * coff-mips.c (ecoff_set_symbol_info): Ditto.
-
- * section.c (bfd_get_section_contents): Since `count' is unsigned,
- don't bother comparing for less-than-zero.
- (bfd_set_section_contents): Ditto.
-
- * elfcode.h (bfd_add_to_strtab): Now static.
- (sym_is_global): New function.
- (elf_map_symbols): Call it. Now returns void. Removed unused
- local variable.
- (bfd_section_from_shdr): Mark string tables other than for section
- and symbol names as normal sections having contents.
- (fix_up_strtabs): New function; fixes up ELF header fields for
- stab sections with string tables associated.
- (elf_write_object_contents): Map fix_up_strtabs over all BFD
- sections. Reordered condition tests for symbol flags; default to
- local-object value instead of global-object.
- (elf_symbol_from_bfd_symbol): Hid conditionally-used variable
- inside condition test.
- (elf_print_symbol): Use fprintf_vma.
- (elf_idx_of_sym, bfd_shdr_from_section): Unused functions
- commented out.
-
- * bfd-in.h (int64_type, uint64_type): Define these if we fall
- back to "long long" for HOST_64_BIT.
-
- * libelf.h (elfNAME, ElfNAME): New versions to get desired results
- without using invalid ANSI C preprocessing tokens.
-
- * elf32-target.h (bfd_elf32_new_section_hook): Delete macro.
- * libelf.h (bfd_elf32_new_section_hook): Declare.
- * elfcode.h (new_section_hook): Define here.
-
- * hosts/sparc.h, hosts/std-host.h, hosts/i386bsd.h: Protect
- against multiple inclusions.
-
- * hosts/news.h: Include hosts/std-host.h, not plain std-host.h.
-
- * Makefile.in (bfd.h): Generate into current directory by grabbing
- 64-bit definition (if any) from sysdep.h.
- * bfd-in.h: Put in marker for sysdep.h inclusion.
-
-Fri Jun 18 19:57:23 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * reloc.c (bfd_perform_relocation): Check for overflow on
- pc-relative relocations if the howto asked for it.
-
-Fri Jun 18 16:00:20 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * Makefile.in (stmp-bfd.h): Ignore nonzero exit status from grep.
-
-Fri Jun 18 16:54:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config/riscos.m{h,t}: New files.
- * configure.{host,in}: Use them.
-
-Fri Jun 18 12:55:10 1993 K. Richard Pixley (rich@cygnus.com)
-
- * elf32-mips.c: comment change. This is a mips file, not 88k.
-
-Mon Jun 14 14:02:41 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * cache.c (bfd_cache_init): Increment open_files and call close_one
- if necessary.
- (bfd_open_file): Don't increment open_files here.
-
-Fri Jun 18 10:00:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config/delta88.mh: Don't set CC.
-
- * Makefile.in: Add elf32-{mips,m88k,generic}.
- elf32-{mips,m88k,generic}.c: New files.
- targets.c (target_vector): Include bfd_elf32_{mips,m88k,generic}_vec.
- elfcode.h (elf_object_p): Match elf32-generic for all machines which
- don't match a different target.
-
-Fri Jun 18 03:12:12 1993 John Gilmore (gnu@cygnus.com)
-
- Eliminate "int8_type", "int16_type", "int32_type", and their
- variants from the BFD universe. Leave the 64-bit types for now,
- since they are in flux.
-
- * aoutx.h, hp300hpux.c: Eliminate needless (int32_type) casts.
- * libaout.h (GET_SWORD): Convert (int32_type) to (int).
- * ieee.c: Convert uint8e_type => unsigned char.
- * oasys.c: Extensive changes to eliminate obsolete types.
- These depend on changes in ../include/oasys.h as well.
- * hosts/*.h: Remove declarations of all these types.
-
-Mon Jun 14 14:02:41 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * hosts/delta88.h: #if 0 out some declarations which conflict with
- system headers.
-
-Mon Jun 14 17:08:18 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com)
-
- * Makefile.in (install): remove parentdir cruft
-
-Mon Jun 14 19:04:09 1993 Stu Grossman (grossman@cygnus.com)
-
- * hppa.c (hppa_get_symbol_info): Remove redundant copy.
- * Expurgate random DEFUNs that have crept in.
-
-Mon Jun 14 10:23:53 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_set_symbol_info): Constructor sections should
- only be aligned to a 4 byte boundary.
-
-Sat Jun 12 16:13:17 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * hosts/std-host.h (struct int64e_struct): Remove needless typedef
- keyword.
-
-Fri Jun 11 14:25:34 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * aoutf1.h (sunos4_write_object_contents): set flags to 1, breaking
- 1927 but fixing some other important things.
-
-Thu Jun 10 20:36:22 1993 Doug Evans (dje@canuck.cygnus.com)
-
- * hosts/std-host.h (int64e_type): Fix definition.
-
-Thu Jun 10 11:48:28 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_sec_to_styp_flags): Use STYP_MIPS_INIT for
- section named _INIT. Don't set STYP_TEXT unless SEC_CODE is set.
- (ecoff_styp_to_sec_flags): Treat a STYP_MIPS_INIT section like
- a STYP_TEXT section.
-
-Wed Jun 9 16:48:13 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in (install, headers): don't put comments after a tab
- in the actions section of a rule
-
-Wed Jun 9 15:00:01 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_mkobject_hook): Mark ZMAGIC files as D_PAGED.
- (ecoff_write_object_contents): If not D_PAGED, don't add the
- section headers to text_size. If not D_PAGED, set the magic
- number to OMAGIC rather than ZMAGIC. If creating a D_PAGED
- executable, the executable must fully occupy an even number of
- pages.
- (ecoff_set_symbol_info, make_bfd_asection, ecoff_little_vec,
- ecoff_big_vec): Consistently set section alignment power to 4,
- since ECOFF sections should be multiples of 16 bytes.
- (ecoff_little_vec, ecoff_big_vec): Added D_PAGED to object_flags.
- Made ar_pad_char and ar_max_namelen agree for both.
-
-Tue Jun 8 20:28:02 1993 Mark Eichin (eichin at tweedledumber)
-
- * elfcode.h (elf_slurp_symbol_table): subtract section vma from
- symbol value, since bfd symbols are section relative, but ELF
- symbols aren't.
-
-Tue Jun 8 12:08:27 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * cpu-i960.c, cpu-h8300.c (compatible): Make static.
-
-Tue Jun 8 14:27:56 1993 Jim Kingdon (kingdon@rtl.cygnus.com)
-
- * hosts/news.h, config/news.mh: New files.
-
-Tue Jun 8 12:08:27 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * bfd-in2.h, archures.c (bfd_mach_h8300[h]): new defines.
- * coff-h8300.c: More addressing modes.
- * coffcode.h (coff_set_arch_mach_hook): Cope with H8300 magic
- number.
- * cpu-h8300.c: Removed disassemble stuff. (h8300_scan): Recognise
- H8/300H name. (compatible): New function.
- * reloc16.c (bfd_coff_reloc16_get_relocated_sec): Cope with more
- addressing modes.
-
-Tue Jun 8 10:30:13 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_compute_section_file_positions,
- ecoff_write_object_contents): Only round to page boundaries if
- D_PAGED flag is set for the output BFD.
-
-Fri Jun 4 15:47:52 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * coffcode.h (get_index, coff_slurp_symbol_table): Fix pointer
- casts to work on machine where sizeof(long) != sizeof(int) !=
- sizeof(char *).
- * coffgen.c (coff_get_normalized_symtab): Ditto.
- * cpu-h8300.c coff-h8300.c: Support for H8/300-H.
-
-Fri Jun 4 15:24:27 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * coffgen.c (coff_write_symbols): For empty string table, write
- out 4 in correct byte order. (from minyard@bnr.ca)
-
- * elf32-hppa.c: Don't include libhppa.h for now; define
- BYTES_IN_WORD instead, until Utah sends a better fix.
- (hppa_elf_build_arg_reloc_stub): Use xmalloc and xrealloc instead
- of malloc and realloc.
-
-Fri Jun 4 07:49:01 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * configure.in (mips-*-ecoffl*): New target; use decstation.
- (mips-*-ecoff*): Added trailing '*'.
-
- * coff-mips.c (ecoff_get_debug): Get the offset from the first PDR
- for the FDR, not from the first PDR in the file.
-
-Thu Jun 3 16:41:10 1993 Stu Grossman (grossman@cygnus.com)
-
- * hppa.c (hppa_get_symbol_info): New func needed for JUMP_TABLE.
-
-Thu Jun 3 15:33:57 1993 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * hppa.c (hppa_get_symbol_info): New function.
-
-Thu Jun 3 13:07:42 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elfcode.h (elf_map_symbols): Don't crash if no symbols have been
- allocated yet.
-
- From Peter Hoogenboom (hoogen@schafer.cs.utah.edu):
- * libhppa.h (MAXCOMLEN): Define unconditionally.
- (_PA_RISC_ID): Only define if not already defined.
- * elf32-hppa.c: Include libhppa.h.
-
- From Ralph Campbell:
- * hosts/mipsbsd.h (HOST_DATA_START_ADDR): Delete definition.
-
- * elf32-hppa.h (symext_rootP, symext_lastP): Delete decls.
-
-Thu Jun 3 00:23:53 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * config/go32.mh: define EXTRALIBES to -lm (for binutils), also
- remove defines of __MSDOS__ and __GO32__ (these are in the
- compiler now).
-
-Wed Jun 2 17:57:13 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- From Utah:
- * hosts/hppabsd.h: Eliminate use of obsolete EXFUN.
- * config/hppabsd.mh: Don't use ranlib.
-
-Tue Jun 1 04:15:57 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * elf.c: New file, for word-size independent code.
- * elfcode.h (elf_hash): Moved to there, renamed bfd_elf_hash.
- * Makefile.in: Include elf.o in standard objects.
-
- * bfd-in.h (CAT3): Define here.
- * libaout.h, libelf.h: Not here.
-
- * libelf.h (struct strtab): Define here.
- (bfd_elf_locate_sh): Declare here.
- * elfcode.h (struct strtab): Definition deleted.
-
- * reloc.c (enum bfd_reloc_code_real): Added HPPA_PCREL_CALL_12.
-
- * Makefile.in: Make "all", not "bfd.h", be the default target.
- (stmp-bfd.h): New target; prevents rebuilding world if bfd.h
- hasn't really changed.
-
- Tue May 25 12:15:15 1993 Michael Meissner (meissner@osf.org)
-
- * elfcode.h (elf_hash): Provide elf standard hash function.
- (various): Key off of the machines use_rela_p field to determine
- whether to use REL or RELA relocations.
- (elf_swap_reloc_out, elf_swap_reloc_in): New functions.
- (elf_make_sections): Allocate a pointer to hold all data for a
- given section, and copy each fragment into the data region.
- Update the section's pointer with the REL implicit addends if the
- machine uses REL relocation.
-
- * elf32-i386.c (elf_bfd_reloc_type_lookup): Rename to
- elf_i386_bfd_reloc_type_lookup, and use cpp to map the name back
- into was elf32-target.h expects.
- (elf_info_to_howto): Rename to elf_i386_info_to_howto.
- (elf_i386_bfd_reloc_type_lookup): Add relocation support.
- (elf_i386_info_to_howto): Add minimal relocation support.
-
- * libelf.h (elf_backend_data): Add use_rela_p, elf_64_p,
- elf_info_to_howto_rel fields.
-
- * elf32-target.h (elf_bed): Add support for new fields in
- elf_backend_data.
-
- Sun May 30 16:38:24 1993 Peter Hoogenboom (hoogen@fast.cs.utah.edu)
-
- * elf32-hppa.c: Add symbol extension section support, fix
- relocation howto table, add stub generation support.
-
- * elf32-hppa.h: Add symbol extension section support, fix
- relocation howto table, add stub generation support.
-
- * elfcode.h (bfd_elf_locate_sh): New function to locate ELF
- section header.
-
- * elfcode.h (bfd_add_to_strtab): Made non-static due to a call
- from elf32-hppa.c.
-
- * elfcode.h (elf_idx_of_sym): Return STN_UNDEF instead of 0 when
- the symbol is not found.
-
- * elfcode.h (elf_compute_section_file_positions): Not all section
- file positions were computed.
-
- * elfcode.h (elf_get_sect_thunk): New function.
-
- * hppa.c (sign_ext): Reimplement.
-
- * hppa.c (round_down,round,round_up,L,R,LS,RS,LD,RD,LR,RR): Make
- these functions static.
-
-Tue Jun 1 14:40:41 1993 Per Bothner (bothner@rtl.cygnus.com)
-
- * Makefile.in (bfd.h): Move closer to headers - and after 'all'!
-
- * aoutx.h (translate_from_native_sym_flags): Don't set
- BSF_DEBUGGING for constructor symbols, only BSF_CONSTRUCTOR.
- * aoutx.h (translate_to_native_sym_flags): Translate
- constructor symbols properly.
-
-Thu May 27 16:09:04 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
-
- * archures.c (bfd_default_arch_struct): use 4 byte alignment as a
- minimum.
- * aout-target.h (minimum_alignment): 8 byte alignment is right.
- (fix ld/2680)
-
-Thu May 27 13:38:47 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * configure.in, Makefile.in: Build bfd-in2.h in source directory,
- from bfd-in.h and .c files. Build bfd.h in build directory,
- substituting in requested target word size. Insert word size into
- makefile, and maybe enable 64-bit targets.
-
- * bfd-in.h, libbfd.c, demo64.c, targets.c: Define BFD64 if 64 bits
- are available. Conditionalize on this. Assume HOST_64_BIT
- will be defined if needed, so 64-bit targets are conditionalized
- only in the Makefile.
-
-Tue May 25 14:03:56 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * libbfd.c (COERCE64): Rewrite to avoid out-of-range values.
-
- * coff-sh.c (rtype2howto): Put error message on stderr.
- (extra_case): Delete unused variable.
-
- * coff-mips.c (ecoff_print_symbol): Cast bfd_vma values to long
- before calling printf.
-
- * elfcode.h: New file, almost completely derived from old elf32.c.
- * elf32.c: Now just define ARCH_SIZE and include elfcode.h.
- * Makefile.in (elf64.o): List dependencies, don't build by
- default.
- (elf64.c): Add to list of sources.
- (elf32.o): Update dependencies.
- * elf32-*.c: Updated type/macro/structure names. Cleaned up
- namespace pollution; rename vectors.
- * targets.c, config/*-elf.mt: Updated.
- * All uses of 32-bit versions of structures, routines, and macros
- renamed.
-
- * Makefile.in (archures.o, targets.o): Depend on Makefile.
-
-Mon May 24 15:53:13 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * elf32-i386.c (enum reloc_type): No comma after last enumerator.
-
- * elf32.c (elf_string_from_elf_section): Handle index of zero
- specially.
- (bfd_section_from_shdr, elf_slurp_symbol_table): Don't need to do
- so here.
- (elf_write_object_contents): Deleted one unused variable and
- initialized another to avoid gcc warnings.
- (elf_set_section_contents): Delete unused variable.
-
-Fri May 21 19:04:21 1993 Stu Grossman (grossman@cygnus.com)
-
- * i386lynx.c: New module for Lynx variant of a.out.
- * Makefile.in (BFD_BACKENDS CFILES depends): Add i386lynx.c.
- * gen-aout.c: Get rid of defunct endian stuff, print out true
- pagesize.
- * targets.c (target_vector): Add i386lynx_vec.
-
-Fri May 21 17:02:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * configure.in: Use i386-sco.mt for i[36]86-*-isc*.
-
-Fri May 21 13:44:18 1993 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * aix386-core.c, aout-target.h, aoutx.h, coff-alpha.c,
- coff-mips.c, coffgen.c, elf32.c, ieee.c, libaout.h, libcoff-in.h,
- libelf.h, mipsbsd.c, oasys.c, sco-core.c, srec.c, tekhex.c,
- trad-core.c: Define a TARGET_get_symbol_info function or macro.
- Remove the bfd_print_symbol_nm case from TARGET_print_symbol.
-
- * bfd-in.h: Don't define bfd_print_symbol_nm.
- Define symbol_info type.
- (JUMP_TABLE): Set _get_symbol_info element.
-
- * syms.c (coff_section_type, bfd_symbol_info): New functions.
- (bfd_decode_symclass): Use coff_section_type.
-
- * targets.c: Add bfd_get_symbol_info call.
-
-Wed May 19 15:30:52 1993 Stu Grossman (grossman@cygnus.com)
-
- * coff-i386.c (coff_i386_reloc): Use unsigned char to avoid
- complaints from ancient gcc's.
-
-Wed May 19 15:51:19 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * trad-core.c: Check macro TRAD_CORE_EXTRA_SIZE_ALLOWED.
- hosts/i386linux.h: Define it.
-
-Mon May 17 15:00:33 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
-
- * VERSION, bfd-in.h: Bump version number to 2.2.
-
- * hppa.c (assemble_3, dis_assemble_3, assemble_12,
- dis_assemble_12, assemble_17, dis_assemble_17, assemble_21,
- dis_assemble_21, sign_ext, ones, sign_unext, low_sign_ext,
- low_sign_unext, round_down, round, round_up, L, R, LS, RS, LD, RD,
- LR, RR, hppa_field_adjust): New functions.
-
-Mon May 17 10:04:16 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_set_symbol_info): Added support for indirect
- stabs symbols, including new indirect_ptr_ptr argument.
- (ecoff_slurp_symbol_table): Pass new argument in calls to
- ecoff_set_symbol_info.
-
-Fri May 14 00:05:06 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * configure.in: For m68k sysv systems, use m68k-coff.
-
- * config/hppa-elf.mt (TDEFINES): Don't define DEFAULT_VECTOR here.
- (TDEFAULTS): Define it here. Use the new name.
-
- * elf32-hppa.c (elf_hppa_backend_data): Delete; rely on default
- values instead.
-
- * reloc.c (bfd_reloc_code_real_type): Add some HPPA reloc types.
-
- * aix386-core.c (NO_GETS): Fix PROTO invocation to have correct
- number of arguments.
- (aix386_core_file_p): Initialize core_size to correct value.
-
-Wed May 12 14:39:59 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in (CC_FOR_BUILD): New variable, set to $(CC).
- (FLAGS_TO_PASS): Pass down CC_FOR_BUILD.
-
- * bout.c (aout32_slurp_extended_name_table): Define to be
- _bfd_slurp_extended_name_table rather than bfd_true.
-
- * coff-mips.c: Include libaout.h and aout/aout64.h to get
- definitions for N_SET[ATDB].
- (ecoff_howto_table): Moved near top of file.
- (ecoff_set_symbol_info): If a STABS symbol of type N_SET[ATDB] is
- seen, cook up a constructor section of the same name and put in a
- reloc pointing to the symbol. This lets the GNU linker build
- global constructors and destructors without using collect.
-
-Tue May 11 00:33:31 1993 John Gilmore (gnu@cygnus.com)
-
- * coff-m88k.c (m88kbcs_vec): Symbols have underbars.
-
-Mon May 10 05:55:45 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * hosts/miniframe.h: New file.
- * configure.host: Use it.
-
-Sun May 9 16:36:59 1993 Fred Fish (fnf@cygnus.com)
-
- * configure.in (hppa*-*-bsd): Change to hppa*-*-bsd*
- * configure.in (hppa*-*-hpux): Change to hppa*-*-hpux*
- * configure.in (m68*-hp-bsd): Change to m68*-hp-bsd*
- * configure.in (m68*-*-hpux): Change to m68*-*-hpux*
- * configure.in (*-*-bsd): Change to *-*-bsd*
-
-Wed May 5 16:08:32 1993 Per Bothner (bothner@cygnus.com)
-
- * elf32-hppa.c (elf_hppa_reloc_type_lookup): Cast enums to
- int, for the sake of the old Portable C Compiler.
-
-Mon May 3 14:37:01 1993 Stu Grossman (grossman@cygnus.com)
-
- * Makefile.in (CFILES): Add cpu-sh.c and coff-sh.c.
-
-Mon May 3 14:03:21 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
-
- * configure.in: Get target name right for m68*-*-hpux.
-
-Sun May 2 11:39:44 1993 Fred Fish (fnf@cygnus.com)
-
- * trad-core.c (NO_SIGNED_GET): New macro.
- * trad-core.c (trad_core_vec): Use new NO_SIGNED_GET instead of
- signed NO_GET, where appropriate.
-
- * configure.in (i[34]86-*-linux*): Add; bfd_target = i386-linux.
- * configure.in (*-*-linux*): Remove until linux port for a
- non-i386/i486 system is actually available.
-
-Fri Apr 30 20:04:10 1993 Stu Grossman (grossman@cygnus.com)
-
- * libhppa.h: #undef e_* symbols which come from <machine/som.h>
- when compiling under HPUX.
-
-Fri Apr 30 17:25:23 1993 Stu Grossman (grossman@cygnus.com)
-
- * The following patches are from Jeffrey Law <law@cs.utah.edu>.
- * hppa.c (hppa_core_file_p): Provide a temporary dummy routine
- for HOST_HPPABSD.
- * hosts/hppabsd.h: Fix declarations of malloc and free.
- * libhppa.h: Include sysdep here. Conditionalize
- includes based on HOST_HPPAHPUX or HOST_HPPABSD.
- Provide definitions for MAXCOMLEN and _PA_RISC_ID suitable
- for BSD.
-
-Fri Apr 30 17:34:11 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elf32-hppa.c: Don't include a.out.h. Apparently not even the
- GNU version is needed.
-
-Fri Apr 30 09:38:59 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * coffcode.h: use dummy_reloc16_extra_cases rather than casting abort.
-
-Thu Apr 29 11:30:32 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
-
- * Makefile.in: Build elf32-hppa.o.
-
- * syms.c (BSF_FUNCTION): New symbol flag.
-
- * elf32-hppa.c: Fixed to work with elf32-target.h.
-
- * hp300hpux.c (NAME, NAME_swap_exec_header_in): Fix for
- traditional C.
- * libaout.h (NAME): Don't define if already defined.
-
- * libelf.h: Protect against multiple inclusions.
- (elf_symbol_type): Moved here, added new fields.
- (struct elf_backend_data): New field `global_sym'; I suspect this
- may be misplaced.
- * elf32.c (elf_symbol_type): Deleted from here.
- (struct elf_obj_tdata): New fields raw_syms and internal_syms, to
- point to backend versions of symbols.
- (obj_symbols, obj_raw_syms, obj_internal_syms): New macros.
- (elf_swap_phdr_out, elf_build_phdrs, elf_write_phdrs): New
- functions.
- (elf_write_object_contents): Write program headers if appropriate.
- (bfd_section_from_shdr): Unnamed sections get empty string for
- name, not "unnamed". Handle SHT_NOBITS separately from
- SHT_PROGBITS, and set some different flags.
- (elf_file_p): New routine.
- (elf_object_p, elf_core_file_p): Call it.
- (elf_object_p): Handle EM_HPPA.
- (elf_symbol_from, elf_idx_of_sym): New functions.
- (elf_make_sections): Get symbol number right for relocations. Set
- SHF_ALLOC, SHF_WRITE, SHF_EXECINSTR when appropriate.
- (elf_fake_sections): BSS section should be SHT_NOBITS, not
- SHT_PROGBITS. Always generate symtab and strtab, not only if
- relocations are needed. Set SHF_* flags as appropriate.
- (elf_compute_section_file_positions): Handle bfd_arch_hppa.
- (elf_write_object_contents): Fix off-by-one error in symbol count.
- Store a correct value for the symbol; write the size field
- properly; make some guesses about the type field. Set section
- type correctly for string tables.
- (section_from_elf_index): Check for absolute and common sections
- first.
- (elf_section_from_bfd_section): Ditto.
- (elf_slurp_symbol_table): Use elf_symbol_type instead of asymbol.
- Use empty string instead of "unnamed" for nameless symbols.
- Handle STTY_FUNC type, and weirdness with "$global$" symbol for
- HPPA (only?). Don't free raw symbols; keep the pointer around for
- later.
- (elf_set_arch_mach): Handle bfd_arch_hppa.
- (elf_find_nearest_line): Just return false.
- (elf_write_object_contents, elf_set_section_contents): Set
- output_has_begun field after computing file positions.
- (elf_set_section_contents): Write section contents immediately,
- rather than caching the whole file and writing it at close time.
-
- * libhppa.h (enum hppa_reloc_field_selector_type, enum
- hppa_reloc_field_selector_typ_alt, enum hppa_reloc_expr_type, enum
- hppa_reloc_expr_type_alt): New enumerator types.
-
- * config/hppa-elf.mt,. config/hppaosf.mh: HP PA/OSF support.
- * configure.in, configure.host: Use them.
-
-Wed Apr 28 23:21:01 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elf32-target.h: Allow overrides of armap defaults.
-
- * elf32-hppa.c, elf32-hppa.h: New files.
-
- * config/hp300hpux.mt: New file.
-
-Tue Apr 27 05:39:40 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * aix386-core.c (NO_GETS): New macro; NO_GET for signed values.
- (aix386_core_vec): Update for new fields.
-
- * archive.c (bfd_generic_archive_p): Call target-specific
- slurp_armap code, instead of bfd_slurp_armap.
- (bfd_slurp_bsd_armap_f2): New function.
- * libbfd-in.h (bfd_slurp_bsd_armap_f2): Declare it.
- * aout-target.h (AR_PAD_CHAR): Define it if not already defined.
- (vec): Use it.
- * libaout.h (struct aoutdata): New field for subformat, for
- differentiating between highly similar a.out formats.
- * aoutx.h (NAME_swap_exec_header_in): New macro, defaults to local
- version of function.
- (swap_exec_header_in): Don't define if NAME_swap_exec_header_in is
- already defined.
- * hp300hpux.c: New file.
- * Makefile.in: Include it.
-
-Mon Apr 26 13:24:43 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * Makefile.in, archures.c, coffcode.h, targets.c: Support for
- Hitachi SH.
-
-Mon Apr 26 13:55:42 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * trad-core.c (trad_unix_core_file_p): Check the file size.
-
-Mon Apr 26 13:24:43 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-alpha.c: Remove duplicate function and add warnings.
-
-Mon Apr 26 11:25:58 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * sco-core.c (sco_core_vec): Add initializers for new target
- fields.
-
-Sat Apr 24 21:33:45 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * coffcode.h [_LIT]: Recognize .lit section.
-
-Fri Apr 23 19:00:36 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-alpha.c, cpu-alpha.c, config/alphaosf.mt,
- config/alphaosf.mt, hosts/alphaosf.h: New files.
-
-Fri Apr 23 16:48:46 1993 Stu Grossman (grossman@cygnus.com)
-
- * Merge in HPPA/BSD changes from Utah.
- * hppa.c: Use this for both HPUX & BSD.
- * targets.c: Enable hppa_vec for both HPUX & BSD.
- * config/hppabsd.mt: TDEFINES => TDEFAULTS.
- * hosts/hppabsd.h: #define HOST_HPPABSD.
-
-Wed Apr 21 01:50:10 1993 John Gilmore (gnu@cygnus.com)
-
- * libbfd.c: Whitespace changes around byteswap macros.
- * libbfd-in.h: Whitespace changes around byteswap declarations.
-
-Tue Apr 20 15:59:07 1993 Stu Grossman (grossman@cygnus.com)
-
- * aoutf1.h (sunos4_core_file_p): Don't default bfd_error to
- system_error anymore. It confuses bfd_check_format().
-
-Mon Apr 19 23:03:08 1993 Stu Grossman (grossman@cygnus.com)
-
- * bfd.c: Add sgi_core_data to tdata union.
- * coff-mips.c: Add Irix 4.x core file support.
- * hosts/irix4.h: #define HOST_IRIX4.
-
-Mon Apr 19 18:52:52 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
-
- * aoutx.h (translate_from_native_sym_flags): Check that the
- symbol's section does get set.
- (slurp_symbol_table): Zero index means null-string name.
-
- * aoutx.h (struct stringtab_entry, struct stringtab_data): New
- data structures.
- (hash, stringtab_init, add_to_stringtab, emit_strtab, compare):
- New functions.
- (write_syms): Use them, to reduce string table size.
-
-Mon Apr 19 16:45:12 1993 Fred Fish (fnf@cygnus.com)
-
- * trad-core.c (trad_core_vec): Add 6 new initializers to match
- new signed get/put fields. Minor reformatting to label
- some fields.
-
-Mon Apr 19 06:09:41 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * bfd-in.h: Insert comment about SVR3 compiler warnings.
-
- * hosts/{hp300,i386isc,i386v}.h: Remove unused #defines of {r,}index
- (bfd uses strchr and the broken SVR3.2 cpp loses with the defines).
-
- * libbfd.c: bfd_put*: Remove casts to bfd_vma.
-
-Fri Apr 16 17:49:27 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * aoutf1.h (internal_sunos_core): Make c_stacktop a bfd_vma.
- (swapcore_sparc): Make sp a bfd_vma.
-
-Thu Apr 15 09:09:18 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * libbfd.c: Add signed versions of bfd_{h_,}{get,put}_signed_<size>.
- libbfd.c, libbfd-in.h: Add _do*signed*.
- targets.c, all targets: Add bfd*signed*.
- bfd-in.h: Add bfd_signed_vma. Add comments.
-
- * bfd-in.h (bfd_error), bfd.c (bfd_errmsgs): Add file_truncated.
-
- * format.c (bfd_check_error): Check error return from
- _bfd_check_format routines.
-
-Wed Apr 14 23:48:25 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * rs6000-core.c (rs6000coff_core_p): Improve error checking and
- recognize .data section if present.
-
-Thu Apr 15 01:00:29 1993 John Gilmore (gnu@cygnus.com)
-
- * aoutx.h (aout_*_adjust_sizes_and_vmas): Avoid `sanity'
- check for the case where the user sets the address of the BSS
- section (and the file header can't specify this). Let the user
- set it wherever they want, regardless of what goes in the header.
-
- * ieee.c (ieee_slurp_sections): Pass all ieee section names
- straight through into BFD sections. Add comments.
-
-Wed Apr 14 20:34:54 1993 John Gilmore (gnu@cygnus.com)
-
- Cleanup in preparation for better 64-bit host support.
-
- * bfd-in.h (bfd_64_type): Remove.
- * libbfd.c (_do_getb64, _do_putb64): Use bfd_vma, not bfd_64_type.
-
- * bfd-in.h (bfd_size): Remove.
-
- * bfd-in.h (bfd_offset): Remove, after fixing ld/ldlang.[ch].
-
- * bfd-in.h (bfd_word): Remove.
- * reloc.c (reloc_howto_type): Replace bfd_word with bfd_vma.
-
- * bfd-in.h (rawdata_offset): Remove.
- * reloc.c (arelent): Replace rawdata_offset with bfd_size_type.
- (bfd_perform_relocation): Lint.
- (enum bfd_reloc_status): Comment cleanup.
-
- * aout-adobe.c, cpu-h8300.c, mipsbsd.c, srec.c: lint -Wall.
-
-Tue Apr 13 11:19:52 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * aoutf1.h (swapcore_sparc): Guess the right value of USRSTACK.
-
-Mon Apr 12 14:18:00 1993 John Gilmore (gnu@cygnus.com)
-
- * elf32.c: Clean up old comments.
-
-Fri Apr 9 10:43:20 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * config/sun3.h: String argument to fprintf is const.
-
- * coff-mips.c: Renamed PAGE_SIZE to ROUND_SIZE, to avoid confusion
- on systems which define PAGE_SIZE in <limits.h>.
-
-Thu Apr 8 10:28:00 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * trad-core.c (trad_unix_core_file_failing_signal): Use new macro
- TRAD_UNIX_CORE_FILE_FAILING_SIGNAL to allow host files to specify
- the core file failing signal.
- * hosts/decstation.h (TRAD_UNIX_CORE_FILE_FAILING_SIGNAL): Define
- to supply the core file failing signal.
-
-Thu Apr 8 09:17:35 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coffcode.h (styp_to_sec_flags): Only set SEC_SHARED_LIBRARY for
- a STYP_NOLOAD | STYP_BSS section if BSS_NOLOAD_IS_SHARED_LIBRARY
- is defined. On many COFF targets STYP_BSS is always STYP_NOLOAD.
- * coff-i386.h (BSS_NOLOAD_IS_SHARED_LIBRARY): Define.
-
-Wed Apr 7 11:33:06 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (PAGESIZE): Correct value.
-
-Tue Apr 6 12:05:44 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_find_nearest_line): Address of first PDR is
- an offset (patch from Jean-Daniel Fekete <jdf@lri.lri.fr>).
-
-Mon Apr 5 12:07:12 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coffcode.h (styp_to_sec_flags): Set SEC_SHARED_LIBRARY for a
- STYP_NOLOAD | STYP_BSS section. Don't set SEC_NEVER_LOAD for a
- STYP_INFO section.
- (coff_compute_section_file_positions): Force vma and lma of _LIB
- section to be zero.
- (coff_set_section_contents): Count number of entries in new lma
- field, not in vma.
- * coffgen.c (make_a_section_from_file): Force lineno_count of
- SEC_SHARED_LIBRARY section to be zero, since it is non-zero on the
- SCO 3.2v4 shared library.
- * seclet.c (rel): Copy over any section with contents, not just
- loadable sections.
-
- * coff-mips.c (ecoff_make_empty_symbol): Zero out newly allocated
- symbol.
-
- * coff-i386.c (coff_i386_reloc): New function, to generate
- relocateable output correctly.
- (howto_table): Use coff_i386_reloc for all reloc types.
- (CALC_ADDEND): Use a more efficient hack to get the correct addend
- for a common symbol.
- (i386comm_value): Removed; no longer needed.
-
-Sun Apr 4 15:08:48 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coffcode.h (coff_set_section_contents): Don't write out
- sections without a filepos.
-
-Fri Apr 2 14:35:05 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * seclet.c (seclet_dump_seclet): Correct SEC_HAS_CONTENTS test.
-
-Wed Mar 31 17:41:05 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * reloc.c (bfd_reloc_code_real_type): Added BFD_RELOC_MIPS_GPREL.
- * libecoff.h (ecoff_data_type): Added gp_size field.
- * coff-mips.c (ecoff_mkobject_hook): Initialize gp_size to 8.
- (ecoff_set_symbol_info): Compare against gp_size, not hardcoded 8.
- Set flags to 0 for large common symbols.
- (ecoff_gprel_reloc): Handle non-zero addend for external symbols,
- which can occur for gas-generated relocs.
- (ecoff_bfd_reloc_type_lookup): Added BFD_RELOC_MIPS_GPREL case.
- * bfd.c (bfd_get_gp_size, bfd_set_gp_size): New functions.
- * Makefile.in (bfd.o): Now depends on coff/sym.h and libecoff.h.
-
-Tue Mar 30 09:33:16 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * srec.c (srec_set_section_contents): Use lma field for load
- address.
- * section.c: Add declaration of lma field to section structure.
- * coffcode.h (coff_write_object_contents): Use lma field for load
- address.
- * bfd-in.h (bfd_set_section_vma): Set lma along with vma.
-
- * aoutx.h (translate_from_native_sym_flags): Now handles indirect
- symbols in a better way. (translate_to_native_sym_flag): Set the
- N_INDR bit when necessary. (aout<>slurp_symbol_table): Maintain
- indirect state.
- * section.c: Added BFD_IND_SECTION_NAME and bfd_ind_section.
- (bfd_make_section): Cope with new builtin section.
- * syms.c (bfd_decode_symclass): Can now print indirect section
- info.
-
-Wed Mar 24 13:36:33 1993 Per Bothner (bothner@rtl.cygnus.com)
-
- * aout-target.h (MY(object_p)): Fail if MACHTYPE_OK is
- defined, and yields false.
- * aout-mipsbsd.c, i386bsd.c: Define MACHTYPE_OK appropriately.
-
- * archive.c (snarf_ar_hdr): Add support for reading (only,
- so far) BSD-4.4-style extended headers.
- * archive.c: Some more comments.
-
-Wed Mar 24 02:05:10 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
-
- * Makefile.in: fix rule for dvi and info, so that the recursive
- makes does the right thing, instead of always info
-
-Wed Mar 24 02:56:44 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * libbfd.c (bfd_seek): Disable optimized handling for archives and
- archive members; they need more special reatment. For now, verify
- that computed and actual file positions correspond.
-
-Tue Mar 23 08:45:33 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * mipsbsd.c: Renamed from aout-mipsbsd.c.
- (set_arch_mach): Delete non-MIPS code.
- (reloc_howto_type_lookup): Ditto.
- * Makefile.in: Adjusted.
-
- * libbfd.c (bfd_tell): Update `where' field.
- (bfd_seek): Don't do anything if we're not changing the file
- position. If FILE_OFFSET_IS_CHAR_INDEX is defined, check `where'
- field against a SEEK_SET request. Call bfd_tell to re-update
- `where' field when done.
- (bfd_read, bfd_write) [FILE_OFFSET_IS_CHAR_INDEX]: Maintain
- `where' field.
- * hosts/sparc.h: Define FILE_OFFSET_IS_CHAR_INDEX.
-
-Mon Mar 22 23:18:10 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: added installcheck target
-
-Mon Mar 22 14:57:18 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_set_symbol_info): Relocate encapsulated stabs
- if the type is not stNil.
-
-Tue Mar 16 10:35:27 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * elf32.c (elf_little_vec, elf_big_vec): Delete now-invalid
- forward declarations.
-
- * elf32-sparc.c (elf_sparc_howto_table): Don't use CONST here,
- it's implied by the type.
-
-Fri Mar 12 18:58:08 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * configure.host: recognize sparc-sun-solaris2* instead of sparc-sun-solaris*
-
-Tue Mar 9 09:23:12 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * rs6000-core.c: Add .ldinfo section.
-
-Fri Mar 12 11:57:52 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in (MAKEOVERRIDES): Define to be empty.
-
-Fri Mar 12 08:32:11 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * section.c (bfd_set_section_contents): whitespace
- * seclet.c (seclet_dump_seclet): Don't try and fill sections with
- no contents.
-
-Thu Mar 11 19:26:15 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * hosts/go32.h: don't define POSIX_UTIME
-
-Tue Mar 9 10:52:01 1993 Fred Fish (fnf@cygnus.com)
-
- * elf32.c (elf_object_p): Use ELF_ARCH stored in xvec to match
- against machine architecture stored in the ELF header, to resolve
- ambiguities.
- * elf32.c (bfd_section_from_shdr): Bfd_make_section can return
- NULL, so only use results when non-NULL.
- * targets.c (elf32_m68k_vec, elf32_i860_vec): Add extern decls
- and add to vector of targets.
-
-Mon Mar 8 15:13:44 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_set_symbol_info): Encapsulated STABS symbols
- are always just debugging symbols.
-
- * coff-mips.c (ecoff_[gs]et_sym_index): Moved macros from here...
- libecoff.h (ecoff_[gs]et_sym_index): ...to here.
-
-Mon Mar 8 14:55:13 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * hppa.c (_PA_RISC_ID): Defined if not already defined (e.g., for
- hpux 7). Patch from friedman@gnu.ai.mit.edu.
- (hppa_object_p): Only check for DL_MAGIC and SHL_MAGIC if they're
- defined, which they aren't in hpux 7.0.
-
- * aix386-core.c: Include uinfo.h and coredump.h. Patch from Minh
- Tran-Le, tranle@intellicorp.com.
-
-Fri Mar 5 14:54:21 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_generic_reloc): If the addend is non-zero, go
- ahead and do the relocation.
- (ecoff_refhi_reloc): Don't to the relocation here, just remember
- what needs to be done.
- (ecoff_reflo_reloc): Do the REFHI relocation here.
-
-Thu Mar 4 14:44:01 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_bfd_reloc_type_lookup): New function.
- (ecoff_write_object_contents): Added BFD_ASSERT calls to ensure
- relocs are reasonable.
- * coff-msym.c: Eliminated uses of DEFUN.
- (ecoff_swap_tir_out): New function.
-
-Tue Mar 2 17:52:58 1993 Fred Fish (fnf@cygnus.com)
-
- (Ultrix 2.2 support from Michael Rendell <michael@mercury.cs.mun.ca>)
- * configure.host (vax-*-ultrix2*): Add triplet.
- * hosts/vaxult2.h: New file.
- * config/vaxult2.mh: New file.
-
- * aoutx.h (string.h): Include for strchr and friends.
- * archive.c (string.h): Include for memchr and friends.
- * elf32.c (string.h): Include for strrchr and friends.
-
-Sat Feb 27 00:44:24 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * aoutf1.c (sunos4_reloc_type_lookup): Unused; deleted.
- (MY_set_sizes): Use sunos4_set_sizes.
-
- * elf32.c: Renamed from elf.c. Several CPU-specific functions
- deleted, as well as elf-big and elf-little targets.
- * libelf.h: New file.
- * elf32-sparc.c, elf32-i386.c, elf32-i860.c, elf32-m68k.c: New
- files, new targets.
- * Makefile.in, config/*-elf.mt, targets.c: Adjusted.
-
- * i386linux.c (TARGETNAME): Use hyphens instead of parentheses.
-
- * coffcode.h (coff_compute_section_file_positions): Don't need
- variable "old_sofar" if compiling for i960.
-
- * reloc.c (bfd_default_reloc_type_lookup): First argument is now a
- bfd pointer.
- * libbfd.h: Updated.
-
- * ieee.c (exten, envi): "static" belongs first in declaration.
-
-Fri Feb 26 17:37:34 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * srec.c: add support for symbolsrec, srecords with symbols in
- them.
-
-Thu Feb 25 11:43:30 1993 John Gilmore (gnu@cacophony.cygnus.com)
-
- * ieee.c: cast all arguments of ieee_write_byte to bfd_byte
- to avoid lint complaints.
-
-Thu Feb 25 02:15:52 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elf.c (elf_write_object_contents): Section ".shstrtab" should be
- type SHT_STRTAB. Don't alter file offset for section 0.
- (reloc_type_names): Now an array instead of a macro. Still inside
- "#if 0", since it's used only in debugging code also in "#if 0".
- (struct elf_reloc_map_elt, struct elf_reloc_map): New types.
- (sort_reloc_map): New function.
- (sparc_reloc_map): New variable.
- (elf_bfd_reloc_type_lookup): New function.
-
-Tue Feb 23 12:17:16 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * bfd-in.h (JUMP_TABLE): Added bfd_reloc_type_lookup and
- bfd_make_debug_symbol; they were already in the target structure.
- * Adjusted all uses of JUMP_TABLE.
- * coffgen.c, libcoff-in.h (coff_bfd_make_debug_symbol): Renamed
- from coff_make_debug_symbol.
- * libcoff.h: Updated accordingly.
-
- * Minor cleanups provoked by gcc warnings:
- * aoutx.h (NAME(aout, reloc_type_lookup)),
- cpu-h8300.c (local_bfd_reloc_type_lookup),
- cpu-z8k.c (local_bfd_reloc_type_lookup): Added default case to
- switches.
- * archive.c (do_slurp_bsd_armap, do_slurp_coff_armap),
- ieee.c (ieee_slurp_section_data),
- elf.c (elf_make_sections, elf_fake_sections,
- elf_compute_section_file_positions, elf_write_object_contents):
- Removed unused variables.
- * archures.c: Removed /* from within comment.
- * bout.c (b_out_squirt_out_relocs): Initialize r_extern.
- * oasys.c (oasys_write_data): Initialize i.
-
-Mon Feb 22 18:40:06 1993 Per Bothner (bothner@rtl.cygnus.com)
-
- * libcoff.h (obj_raw_syment_coun): New macro.
- * coffgen.c (coff_get_normalized_symtab): Initialize
- raw_syment_count.
- * coffgen.c (coff_find_nearest_line): Numerous little fixes.
-
-Mon Feb 22 15:03:07 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (ecoff_set_symbol_info): stBlock symbols are always
- debugging symbols.
- (ecoff_get_debug): Offset the fdr adr by the adr of the first pdr,
- for compatibility with tools from MIPS.
-
- * config/bigmips.mt: New file; default vector is ecoff_big_vec.
- * config/irix3.mt, config/irix4.mt: Removed.
- * configure.in (mips-*-ecoff): New target; uses bigmips.mt.
- (mips-sgi-*, mips-big-*): Use bigmips rather than irix3.
-
-Wed Feb 17 23:40:41 1993 John Gilmore (gnu@cygnus.com)
-
- * hosts/hp300bsd.h: Add gross hack to determine whether we
- are running on BSD 4.3 or BSD 4.4, and use appropriate include
- files (and set other parameters) to match.
-
-Wed Feb 17 12:28:13 1993 K. Richard Pixley (rich@cygnus.com)
-
- * trad-core.c (trad_unix_make_empty_symbol): wrap PARAMS around an
- ansi definition which otherwise confuses non-ansi compilers.
-
- * aout-adobe.c (aout_adobe_object_p): eliminate a warning from vax
- ultrix cc by forward declaring getenv as is done in
- bfd_find_target.
-
-Tue Feb 16 17:56:58 1993 K. Richard Pixley (rich@cygnus.com)
-
- * elf.c (elf_info_to_howto): cast an enum into unsigned char
- avoiding a fatal error in vax ultrix 4.2 cc.
-
-Tue Feb 16 00:44:54 1993 John Gilmore (gnu@cygnus.com)
-
- * bfd-in.h, VERSION: Roll to version 2.1.
-
-Mon Feb 15 20:43:51 1993 John Gilmore (gnu@cygnus.com)
-
- * oasys.c (oasys_write_object_contents): Lint.
- * srec.c: Whitespace cleanup.
-
-Fri Feb 12 14:23:07 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coffgen.c (coff_print_symbol): Print correct tagndx value;
- cleaned up output formatting a bit.
-
-Fri Feb 12 08:28:56 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coffcode.h (coff_set_arch_mach_hook): *FIXME* the H8/300 is always
- relaxable. Should be moved somewhere else.
-
-Thu Feb 11 14:09:42 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * aout-mipsbsd.c: Eliminated uses of DEFUN.
- (aout_mips_*_vec): Added seclet_link element.
-
- * Makefile.in (BFD_BACKENDS, CFILES, aout-mipsbsd.o): Added
- support for aout-mipsbsd target.
-
- * bout.c (get_value): Don't truncate 32-bit addend to 16 bits.
-
-Fri Feb 5 08:08:43 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * cpu-h8500.c (scan_mach): return false if it's not an H8/500
-
-Thu Feb 4 12:52:40 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- Add support for the H8/500
-
- * coff-h8500.c, cpu-h8500.c, archures.c, coffcode.h, targets.c
-
-Thu Feb 4 12:35:02 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * libecoff.h: New file. Defines ECOFF backend data for gdb.
- * coff-mips.c: Now includes libecoff.h.
- (ecoff_data_type): Moved to libecoff.h.
- (ecoff_slurp_symbolic_info): Made globally visible so that gdb can
- call it. If there is ever another ECOFF target, this and the
- swapping functions should be accessed via an ECOFF specific target
- vector.
- * Makefile.in (coff-mips.o): Depends on libecoff.h.
-
-Wed Feb 3 09:14:36 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coffcode.h: Removed MIPS specific information, since coff-mips.c
- no longer includes this file.
-
- * coff-msym.c (ecoff_swap_fdr_in, ecoff_swap_ext_in): Set reserved
- bits to 0 to make comparison test useful.
-
- * config/irix3.mh, config/irix4.mh (HDEFINES): Set to -G 4 to
- avoid overflowing GP accessible sections in binutils/objdump.
-
-Tue Feb 2 15:36:55 1993 Per Bothner (bothner@cygnus.com)
-
- * aoutx.h (NAME(aout,slurp_symbol_table)): Made symbol
- reading more robust: Fail if string index is out of string
- table range.
-
-Tue Feb 2 11:43:25 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bout.c (b_out_get_relocated_section_contents, cases PCREL24 and
- PCREL13): Don't take dst_address into account; the input file has
- already taken care of that.
-
-Tue Feb 2 11:41:06 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c: Completed support for linker and binutils.
-
-Mon Feb 1 14:45:38 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bout.c (b_out_get_relocated_section_contents, case ABS32): Keep
- original addend from section contents.
-
-Thu Jan 28 21:01:37 1993 John Gilmore (gnu@cygnus.com)
-
- Fix minor bugs reported by Carl Greco, <cgreco@parrot.creighton.edu>:
- * hosts/delta88.h (strtol): Fix prototype.
- * config/m88k-coff.mt (SELECT_ARCHITECTURES): Fix name.
-
-Wed Jan 27 17:16:51 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elf.c: Get rid of "#ifdef sparc".
- (RELOC_TYPE_NAMES): Never used (currently), so don't include it.
- (elf_sparc_howto_table): Renamed from elf_howto_table, and always
- used.
- (elf_info_to_howto): Use runtime conditionals on CPU type, not
- compile type conditionals on host CPU.
- (elf_little_vec, elf_big_vec): Use bfd_default_reloc_type_lookup,
- not null pointer.
- (reloc_type, RELOC_TYPE_NAMES): Include i386 values.
-
-Tue Jan 26 11:43:14 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * section.c (SEC_IS_COMMON): New section flag, needed for MIPS
- ECOFF which has two common sections.
- (bfd_com_section): Set SEC_IS_COMMON flag.
- * bfd-in.h (bfd_is_com_section): New macro to test SEC_IS_COMMON.
- * aoutx.h, archive.c, bout.c, coff-a29k.c, coff-m88k.c,
- coff-mips.c, coffgen.c, ieee.c, oasys.c, reloc.c, syms.c: Use
- bfd_is_com_section macro rather than checking for equality to
- bfd_com_section.
-
-Mon Jan 25 15:27:36 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * coffcode.h (_bfd_coff_mkobject_hook): Pass aouthdr argument.
- (coff_mkobject_hook): Accept aouthdr argument.
- * coffgen.c (coff_real_object_p): Pass aouthdr to mkobject_hook.
- Handle NULL aouthdr argument.
- (coff_object_p): If there is no aouthdr, pass it as NULL to
- coff_real_object_p.
- * libcoff.h: Rebuilt for mkobject_hook changes.
-
- * coffswap.h (coff_swap_aouthdr_in, coff_swap_aouthdr_in): Swap
- additional MIPS ECOFF fields.
-
-Sat Jan 23 18:36:20 PST 1993 Ralph Campbell (ralphc@pyramid.com)
-
- * configure.host: added mips-dec-bsd*
- * configure.in: added mips-dec-bsd*
- * aout-mipsbsd.c: new file for mips-dec-bsd*
- * aout-target.h: don't define '' if 'MY_BFD_TARGET' is defined.
- * aoutx.h: added mips support.
- * archures.c: added mips support to bfd_default_scan().
- * cpu-mips.c: added support for R4000 (untested).
- * libaout.h: added MIPS1 & MIPS2 magic numbers.
- * reloc.c: fix typo's in comments. Added BFD_RELOC entries which I
- hope will make it into include/bfd.h.
- * targets.c: added aout_mips_*_vec.
-
-Wed Jan 20 17:15:52 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * config/decstation.mt: Set DEFAULT_VECTOR to ecoff_little_vec.
-
-Tue Jan 19 09:06:14 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * bfd-in.h (bfd_asymbol_value): Add needed parentheses.
-
- * libcoff-in.h: Update prototype for coff_count_linenumbers.
-
-Fri Jan 15 18:13:17 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-msym.c (ecoff_swap_hdr_out, ecoff_swap_fdr_out,
- ecoff_swap_pdr_out, ecoff_swap_sym_out, ecoff_swap_ext_out,
- ecoff_swap_rndx_out, ecoff_swap_rfd_out, ecoff_swap_opt_in,
- ecoff_swap_opt_out, ecoff_swap_dnr_in, ecoff_swap_dnr_out): New
- functions.
- * coffswap.h: If NO_COFF_RELOCS is defined, don't define
- bfd_swap_reloc_in or coff_swap_reloc_out.
- * coff-mips.c: Added code to link and write out symbolic debugging
- information, and to swap relocs in and out.
-
-Thu Jan 14 15:51:58 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * libcoff.h, coffgen.c (coff_count_linenumbers), coffcode.h
- (coff_write_object_contents): coff_count_linenumbers returns the
- number of line number records it found.
-
- * coffgen.c (coff_write_linenumbers): only write out line numbers
- in the section they belong to.
-
-Mon Jan 11 18:32:22 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * targets.c (bfd_target): Added relocateable argument to
- _bfd_get_relocated_section_contents. Added _bfd_seclet_link
- target vector for linker use.
- * bfd.c (bfd_seclet_link): New macro.
- * bfd-in.h (JUMP_TABLE): Added _bfd_seclet_link.
- * seclet.c (rel, seclet_dump_seclet): Added relocateable argument
- and boolean return value. Made static.
- (bfd_generic_seclet_link): Renamed from seclet_dump. Added
- relocateable argument.
- * reloc.c (bfd_generic_get_relocated_section_contents): Added
- relocateable argument (if relocateable, saves relocs).
- * bout.c (b_out_get_relocated_section_contents),
- reloc16.c (bfd_coff_reloc16_get_relocated_section_contents): Added
- relocateable argument (if relocateable, just calls
- bfd_generic_get_relocated_section_contents).
- * libcoff-in.h (bfd_coff_reloc16_get_value): Added relocateable
- argument to prototype.
- * All targets: Set new _bfd_seclet_link vector to
- bfd_generic_seclet_link.
-
-Sat Jan 9 21:29:32 1993 Stu Grossman (grossman at cygnus.com)
-
- * coffgen.c: #include seclet.h.
-
-Sat Jan 9 19:48:14 1993 Stu Grossman (grossman at cygnus.com)
-
- * hppa.c (hppa_object_setup): Get rid of all knowledge of stabs
- debug info. Setup info about linker symbols only, and use
- standard bfd fields to hold the info.
- * (hppa_object_p): Remove unneeded decls.
- * (hppa_new_section_hook): Get rid of most of this.
- * libhppa.h (struct hppadata): Remove ten pounds of useless ugly
- fat. Remove all knowledge of stabs, remove redundant knowledge of
- linker symbols.
- * Remove macros for accessing fields which are now gone.
-
-Fri Jan 8 15:20:00 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coffcode.h (sec_to_styp_flags): allow SEC_NEVER_LOAD to turn on
- STYP_NOLOAD bit.
- * coff-z8k.c: delete unused reloc functions
-
-Fri Jan 8 15:47:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd.c (struct _bfd): Added ecoff_tdata to tdata union.
- * targets.c (enum target_flavour): Added bfd_target_ecoff_flavour.
- * coff-msym.c: Use DEFUN for function definitons.
- * coff-mips.c: Added code to read and print symbols, and to find
- line numbers.
-
- * coffcode.h: Moved many generic functions into coffgen.c. Moved
- swapping functions into coffswap.h for ECOFF use. Moved
- relocation functions, only used by h8300 and z8k, into reloc16.c.
- Added hooks for coffgen.c functions to backend data structure, and
- added hook functions. Still more could be done.
- * coffswap.h: New file to hold COFF swapping routines.
- * coffgen.c: New file to hold generic COFF functions.
- * reloc16.c: New file to hold h8300 and z8k specific relocation
- functions.
- * libcoff-in.h: Added declarations for functions in coffgen.c.
- * libcoff.h: Rebuilt to incorporate changes.
- * coff-h8300.c: Function name changes.
- * coff-z8k.c: Function name changes. Use coff_reloc16_extra_cases
- hook rather than defining EXTRA_CASES.
- * Makefile.in: Build new files coffgen and reloc16. Added
- dependencies of coff-*.o on coffswap.h and seclet.h.
-
-Thu Jan 7 16:16:26 1993 Per Bothner (bothner@cygnus.com)
-
- * ieee.c (ieee_slurp_sections): Add cast to avoid warning
- about discarding const.
-
-Wed Jan 6 00:16:49 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * archive.c, seclet.c, elf.c use bfd_xmalloc instead of malloc
-
-Tue Jan 5 09:35:57 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * configure.in (post-target): If --with-minimal-bfd is specified,
- set MINIMIZE=1.
-
-Mon Jan 4 07:20:01 1993 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * srec.c (srec_write_records): one of my boards wants a CR between
- records.
-
-Wed Dec 30 12:46:30 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * archive.c (do_slurp_coff_armap): set symdef_count correctly
- (it broke a couple of weeks ago).
-
-Tue Dec 29 21:41:05 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * elf.c (bfd_elf_find_section): Switch back to "struct ..." for
- return type, so libbfd.h doesn't reference undefined typedefnames.
-
-Tue Dec 29 13:54:35 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * coffcode.h (coff_real_object_p): use name I386AIXMAGIC rather
- than I386SVMAGIC.
- (coff_pointerize_aux): don't pointerize a negative tagndx
- (sometimes generated by SCO 3.2v4 cc).
-
- * bout.c (calljx_callback, callj_callback,
- b_out_get_relocated_section_contents): warn if relocating against
- an undefined symbol.
-
-Mon Dec 28 14:30:55 1992 Stu Grossman (grossman at cygnus.com)
-
- * hppa.c: Get rid of DEFUN, use more conventional prolog stuff.
- Make a bunch more routines be static.
- * hppa.c (fill_spaces): Get rid of this, replace with much better
- written setup_sections().
- * (setup_sections): New routine to create BFD sections for each
- space and subspace in SOM files.
- * (hppa_object_setup): Use BFD sections created by
- setup_sections() to locate GDB symbol table info.
- * (make_unique_section): New routine to create a BFD section. It
- ensures that the given name is unique, and will generate a unique
- one if necessary.
- * (hppa_object_p): Become much more paranoid about file header.
- * (make_bfd_asection): Call bfd_make_section to do the dirty
- work. Simplify code somewhat.
- * (hppa_core_file_p): Use proper name for stack section.
- * libhppa.h: Remove millicode_start, millicode_end decls.
-
-Mon Dec 28 11:03:22 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * Makefile.in (coff-we32k.o, coff-z8k.o): Note dependencies.
-
- * reloc.c (bfd_perform_relocation): For normal 2- or 4-byte
- relocs, don't bother doing the adjustment if the value to add is
- zero.
-
-Sun Dec 27 17:45:05 1992 Fred Fish (fnf@cygnus.com)
-
- * bfd.c (bfd_get_size): New function that gets an upper bound
- on the possible size of any object in a bfd.
- * elf.c (bfd_elf_find_section, elf_get_str_section,
- elf_get_symtab_upper_bound): Rewrite to avoid NULL pointer
- dereferences.
- * elf.c (elf_big_vec, elf_little_vec): Document last three
- members initialized to NULL.
-
-Thu Dec 24 17:49:09 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * hppa.c: change a 'const' to 'CONST', or else HP C compiler dies
-
-Mon Dec 21 16:33:34 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * hosts/std-host.h: New file. Attempt at a generic/default
- set of definitions, to discourage porting to new hosts by copying.
- * hosts/news.h: Removed.
- * hosts/sparc.h: Use std-host.h.
- * bfd-in.h: New macros bfd_asymbol_bfd and bfd_asymbol_flavour;
- perhaps we can later remove the the_bfd field from each symbol.
- * syms.c (struct symbol_cache_entry): Remove unused field
- app_data. Add comment noting that the_bfd is almost redundant,
- but not quite.
- * aoutx.h, coff-a29k.c, coff-i386.c, coff-i960.c, coffcode.h:
- Use new macros bfd_asymbol_bfd and bfd_asymbol_flavour.
- * hppa.c (fill_spaces): Make slightly more rebust.
- * configure.in: Allow std-host as the "default" host.
-
-Mon Dec 21 17:24:13 1992 Stu Grossman (grossman at cygnus.com)
-
- * bfd.c: Add struct hppa_core_data to tdata union.
- * hppa.c: Conditionalize on HOST_HPPAHPUX instead of hp9000s800.
- Get rid of HPPA/BSD specific code. That will go somewhere else
- someday.
- * (fill_spaces): Don't spin forever and die if you don't find
- $MILLICODE$ subspace.
- * (hppa_object_p): Make sure that we have a real honest-to-cthulu
- exec file!
- * (hppa_core_file_failing_signal, hppa_core_file_failing_command):
- Make these work for HPUX.
- * (make_bfd_asection): New routine to make section creation a
- little easier.
- * (hppa_core_file_p): Completely rewrite, leave out bugs.
- * libhppa.h: #include the right system files. Redefine all of
- the structs/macros for hacking core files to use more sensible
- HPUX core file structures.
- * targets.c (target_vector): Conditionalize hppa_vec on
- HOST_HPPAHPUX, not hp9000s800.
- * hosts/hppahpux.h: #include stdlib.h to get correct decls for
- malloc and realloc. #define HOST_HPPAHPUX.
-
-Mon Dec 21 12:40:10 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Patches from Minh Tran-le <mtranle@paris.intellicorp.com>.
- * configure.in (i386-*-isc*, i386-*-aix*): New targets.
- * configure.host (i386-*-isc*, i386-*-aix*): New hosts.
- * hosts/i386isc.h, config/i386isc.mh: New files for Interactive
- Unix.
- * hosts/i386aix.h, config/i386aix.mh: New files for AIX on PS/2.
- * aix386-core.c: New file for handling core files on AIX on PS/2.
- * targets.c: if AIX386_CORE, use aix386_core_vec.
- * coffcode.h (coff_real_object_p): check for I386SVMAGIC as well
- as I386MAGIC.
-
-Fri Dec 18 10:20:27 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * aoutf1.h (sunos4_write_object_contents): set flags to 0, fixing
- 1927.
-
-Thu Dec 17 19:35:32 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: added dvi target
-
-Thu Dec 17 00:36:24 1992 John Gilmore (gnu@cygnus.com)
-
- * bfd.c: Use right name for tekhex tdata struct.
- * tekhex.c: Insert leading_char (0) into bfd_target struct. Style.
- * libcoff.h: Updated to get spacing change from coffcode.h.
- * trad-core.c: leading_char is 0 (no symbols!), not '_'.
-
-Tue Dec 15 15:40:30 1992 Per Bothner (bothner@cygnus.com)
-
- * archive.c (do_slurp_bsd_armap, do_slurp_coff_armap): New
- functions, with the "guts" of the old bfd_slurp_bsd_armap
- and bfd_slurp_coff_armap, but assuming we've already checked
- if the armap is present or not.
- Also, rewrite a bit to avoid keeping around obstack data
- that we don't need.
- * archive.c (snarf_ar_header, _bfd_slurp_extended_name_table):
- Various fixes to correctly handle COFF_style archives names.
- (Note that because these have a trailing '/', the names can
- have embedded spaces.)
- * archive.c (bfd_slurp_armap): New function, replaces old
- bfd_slurp_bsd_armap and bfd_slurp_coff_armap. Recognizes
- _either_ format, and calls do_slurp_bsd_armap or
- do_slurp_coff_armap if either form of map is seen.
- * libbfd-in.h: Changed bfd_slurp_bsd_armap and
- bfd_slurp_coff_armap into macro synonyms for bfd_slurp_armap.
- * elf.c (elf_slurp_armap, elf_write_armap): Fix.
- * Makefile.in (AR_FLAGS): Use rc instead of non-standard qc.
-
-Mon Dec 14 17:08:08 1992 Stu Grossman (grossman at cygnus.com)
-
- * hppa.c: #include "sysdep.h", not <sysdep.h>.
- * libhppa.h: Make millicode_start and millicode_end be unsigned
- int to be same type as CORE_ADDR in GDB. Why are these here?
-
-Sat Dec 12 15:54:36 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-i386.c (CALC_ADDEND): if reloc is PC relative, add the
- vaddr of the section to the addend.
- * targets.c: if MINIMIZE is 1, and SCO_CORE is defined, add
- SCO_CORE to SELECT_VECS.
- (target_vector): add sco_core_vec.
- * sco-core.c (sco_core_vec): add leading underscore initializer.
- * configure.in (i[34]86-*-sco*): use target i386-sco.
- * config/i386-sco.mt: new file; define SCO_CORE.
-
-Thu Dec 10 02:13:15 1992 John Gilmore (gnu@cygnus.com)
-
- * aout-adobe.c (aout_adobe_object_p): Fix !strcmp thinko.
-
-Fri Dec 4 14:02:49 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * coffcode.h (bfd_coff_std_swap_table): Now static and const.
-
-Thu Dec 3 16:54:58 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * hosts/i386linux.h: Include unistd.h.
-
- * aoutx.h (print_symbol): aout_stab_name returns a constant
- string.
- * libaout.h (aout_stab_name): Fix prototype.
- * stab-syms.c (aout_stab_names): Array is now const.
- (aout_stab_name): Return value is now pointer to const.
-
- * aoutx.h, archive.c, archures.c, coffcode.h, ctor.c, reloc.c,
- syms.c: Doc fixes.
-
- * syms.c (asymbol): Added new field "app_data", for data
- particular to the application. Some of the linker flags ought to
- get moved to this field someday.
-
- * archures.c (bfd_default_scan): Recognize a few more numbers:
- 80486, 80960, and 960.
-
- * bfd-in.h (COFF_SWAP_TABLE): New is just address of
- bfd_coff_std_swap_table, cast to PTR.
- * bfd.c (bfd_coff_swap_*): Deleted macros.
- * targets.c (struct bfd_target): Deleted COFF-specific swapping
- routine pointers.
- * coffcode.h (type bfd_coff_backend_data): New structure type,
- contains pointers to the COFF-specific swapping routines.
- (bfd_coff_std_swap_table): New data structure, to be used when
- NO_COFF_SYMBOLS and NO_COFF_LINENOS are not defined.
- (bfd_coff_swap_*): New macros.
- * coff-mips.c (mips_coff_swap_table): New data structure.
- (ecoff_big_vec): Use it.
- * All COFF targets: Moved COFF_SWAP_TABLE to target-specific data.
- * All other targets: Deleted coff-specific vector entries.
-
- * trad-core.c: Fixed some `PARAMS' uses that were missing
- parentheses.
-
-Sun Nov 29 08:37:13 1992 Fred Fish (fnf@cygnus.com)
-
- * aoutx.h (some_aout_object_p): Protect arg prototype in
- callback_to_real_object_p with PARAMS macro for non-ANSI compilers.
-
-Sat Nov 28 04:01:21 1992 John Gilmore (gnu@cygnus.com)
-
- * aout-target.h, aoutf1.h, trad-core.c, coffcode.h, libaout.h,
- libbfd-in.h, bfd-in.h: Eliminate all PROTO calls, replace with
- PARAMS for readability.
-
- * aoutx.h: Add type to callback parameter.
- * coff-mips.c: Don't call trad-core.h, not needed.
- * trad-core.c: Incorporate trad-core.h declarations. Fix comments.
- * trad-core.h: Eliminate, unused.
-
-Wed Nov 18 13:16:17 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * format.c (bfd_check_format): if default target isn't found
- then look through the entire list rather than return early.
-
-Mon Nov 16 14:33:03 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * config/i960-coff.mt: reorder vec to match bfd_check_format (from Per)
-
-Thu Nov 12 17:01:41 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: pass down prefix and exec_prefix in FLAGS_TO_PASS
-
-Thu Nov 12 09:46:47 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-z8k.c: checkpoint, more addressing modes handled
- * coffcode.h (get_value): don't truncate reloc->addend field, it's
- a long now.
-
-Wed Nov 11 23:57:55 1992 Brendan Kehoe (brendan@cygnus.com)
-
- * we32k.mt (TDEFAULTS): Use we32kcoff_vec, not i386coff_vec.
-
-Tue Nov 10 14:04:38 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: minor tweaks to make $(CC) command lines more consistent
-
-Mon Nov 9 23:58:17 1992 John Gilmore (gnu@cygnus.com)
-
- * opncls.c (bfd_fdopenr, bfd_close): Add doc about cacheing
- and about when file descriptors are closed.
-
-Sat Nov 7 00:42:20 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bout.c (b_out_squirt_out_relocs): Make sure alignment relocs get
- written out correctly.
-
-Thu Nov 5 15:34:19 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * section.c: New section bit SEC_SHARED_LIBRARY.
- coffcode.h (styp_to_sec_flags): if STYP_NOLOAD && (STYP_TEXT ||
- STYP_DATA), set SEC_SHARED_LIBRARY. This seems to be correct for
- i386-sysv.
-
-Thu Nov 5 04:43:09 1992 John Gilmore (gnu@cygnus.com)
-
- * targets.c (struct bfd_target): Eliminate the SDEF and SDEF_FMT
- macros; use PARAMS to declare the function pointers involved.
-
- * bfd-in.h, bfd.c, libbfd.h, reloc.c, seclet.h, section.c,
- targets.c: Rename struct bfd_seclet_struct to struct bfd_seclet.
-
-Thu Nov 5 02:59:09 1992 John Gilmore (gnu@cygnus.com)
-
- Cleanup: Replace all uses of EXFUN in the BFD sources, with PARAMS.
-
- * archures.c, reloc.c, section.c, tekhex.c: Use PARAMS in
- declaring pointers to functions.
- * cache.c, elf.c: Move static function decls to top, use PARAMS.
- * seclet.h: Declare external function with PARAMS.
-
- * doc/chew.c (exfunstuff): Eliminate.
- (paramstuff): Replace exfunstuff with function to generate PARAMS.
- * doc/proto.str: Use paramstuff rather than exfunstuff.
-
- * libbfd.h: Update, based on changes in source code and chew.
-
-Wed Nov 4 22:47:29 1992 John Gilmore (gnu@cygnus.com)
-
- * libieee.h: Add FIXME about removing limit on number of sections.
- * bfd-in.h: Improve comments to make it clear that bfd.h is
- the wrong place to edit this file.
- * Makefile.in (install): Install ansidecl.h and obstack.h in the
- same places where we install bfd.h.
-
-Wed Nov 4 13:40:23 1992 Sean Eric Fagan (sef@cygnus.com)
-
- * coffcode.h (coff_swap_aux_out, coff_swap_aux_in): check for
- symbol type before blindly modifying the auxent. Specifically,
- only modify the endndx fields for types that need it, and don't
- set the array information for non-arrays.
-
-Wed Nov 4 09:30:50 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * aoutx.h (some_aout_object_p): Section list should be set up
- correctly anyways; don't have to set up "next" pointers manually.
-
-Mon Nov 2 12:36:14 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * config/delta88.mh, config/hp300.mh, config/hppahpux.mh,
- config/i386v.mh: removed -DUSG from HDEFINES.
- hosts/delta88.h, hosts/hp300.h, hosts/hppahpux.h, hosts/i386v.h:
- defined USE_UTIME.
- hosts/i386v.h: don't define POSIX_UTIME.
-
-Fri Oct 30 16:13:52 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * ieee.c (ieee_slurp_sections): make a private copy of the
- section's name before truncating it.
-
-Thu Oct 29 08:30:50 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * hppa.c: add symbol_leading_char entry in transfer vec
-
-,Wed Oct 28 16:11:57 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * ieee.c (get_symbol): can now cope when two symbols of a
- different class, but the same index number occur consecutively.
- (get_section_entry): nicer name for sections being forward
- referenced. (ieee_archive_p): don't free the filename string,
- since it was never malloced.
-
-Wed Oct 28 13:42:09 1992 John Gilmore (gnu@cygnus.com)
-
- * coffcode.h (coff_write_object_contents): Zero timestamp field.
-
-Tue Oct 27 12:24:34 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * coffcode.h (coff_swap_aux_out): set the fcnary info before
- optionally setting the dimen info, since they are in the same
- memory locations. Also zero out external auxent.
- (coff_write_symbol): don't zero external auxent; now done in
- coff_swap_aux_out.
-
-Fri Oct 23 13:55:35 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Check fclose return value for errors.
- libbfd.h: bfd_cache_close now returns a boolean.
- cache.c (bfd_cache_delete): return fclose success value.
- (bfd_cache_close): return bfd_cache_delete return value.
- opncls.c (bfd_close, bfd_close_all_done): return result of
- bfd_cache_close.
-
-Fri Oct 23 10:32:36 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * seclet.c (rel): don't load sections without the SEC_LOAD bit.
-
-Thu Oct 15 10:16:35 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-m68k.c (m68k_howto2type, SELECT_RELOC): new function to
- work out a coff relocation type from a howto's attributes rather
- than using the input r_type field. This fixes PR1677 and allows
- conversion of a.out relocs to coff relocs.
-
- * coffcode.h (coff_write_relocs): if supplied a relocation
- relative to an absolute symbol, use the right symbol index.
-
- * reloc.c (bfd_perform_relocation): do a partial link for coff
- relocs right.
-
-Fri Oct 23 08:15:56 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * changes to support i386-sysv with shared libraries:
- * coffcode.h (sec_to_styp_flags): if TWO_DATA_SECS is defined,
- check for .data2; if _LIB is defined, check for it; map
- SEC_NEVER_LOAD to STYP_NOLOAD.
- (styp_to_sec_flags): map STYP_NOLOAD to SEC_NEVER_LOAD.
- (make_a_section_from_file): if TWO_DATA_SECS, accept .data2.
- (coff_write_object_contents): force vaddr of .lib to 0; set scnptr
- if section has contents, not just if it is loadable; if
- TWO_DATA_SECS, check for .data2
- (coff_set_section_contents): set vma of .lib section to number of
- .lib sections.
- * coff-i386.c: define TWO_DATA_SECS; use a special CALC_ADDEND;
- don't define coff_write_armap to bsd_write_armap.
- * hosts/i386v.h: don't include <utime.h>, since it is not provided
- by SVR3.2.
-
-Thu Oct 22 22:40:20 1992 Brendan Kehoe (brendan@lisa.cygnus.com)
-
- * solaris2.h: Get the definition of alloca from alloca.h if we
- aren't using gcc.
-
-Thu Oct 22 03:07:28 1992 John Gilmore (gnu@cygnus.com)
-
- * configure.in (i960-*-{aout,bout}): Support these.
-
-Wed Oct 21 03:46:34 1992 John Gilmore (gnu@cygnus.com)
-
- * config/a29k-aout.mt (DEFAULT_TARGET): Set to one that exists.
-
-Thu Oct 15 15:05:39 1992 Per Bothner (bothner@cygnus.com)
-
- * apollo68.h, apollov68.h, hp300.h, i386v.h, irix3.h: Remove
- no-longer-used definitions of L_SET and L_INCR.
- * i386linux.h: Tweaks to smooth Linux build.
-
-Thu Oct 15 01:32:22 1992 John Gilmore (gnu@cygnus.com)
-
- * seclet.h: Add enum tag to bfd_seclet_enum_type.
-
- * bfd-in.h (file_ptr): Update comments, make FIXME re off_t.
-
- * aout-adobe.c, aoutf1.h, archive.c, bout.c, coff-rs6000.c,
- coffcode.h, elf.c, ieee.c, libaout.h, libbfd.c, oasys.c,
- sco-core.c: Lint: Second argument of bfd_seek is always file_ptr.
- Third argument is SEEK_SET or SEEK_CUR. Result is always 0 or -1.
-
- * aout-adobe.c, aoutf1.h, aoutx.h, bout.c coff-m68k.c, coff-z8k.c,
- coffcode.h, elf.c, libaout.h, libbfd-in.h, srec.c: Lint.
-
-Fri Oct 9 03:46:37 1992 John Gilmore (gnu@cygnus.com)
-
- * configure.host: New file, contains mapping of host configs
- to host support file names for bfd, binutils, opcodes.
- * configure.in: Use it.
- * i386aout.c: Cleanup, dump TARGET_IS_LITTLE_ENDIAN_P.
- * i386bsd.c: Cleanup, reformat.
- * config/i386-bsd.mt: Comment changes.
- * config/i386bsd.mh: New file for core file support.
- * hosts/i386bsd.h: Merge changes from Peter Schauer.
- * bout.c (ALIGN): Rename to ALIGNER, since system header files
- on BSD 4.4 define ALIGN (sigh!).
-
-Thu Oct 8 22:18:10 1992 Mark Eichin (eichin at tweedledumber.cygnus.com)
-
- * libaout.h (aout_backend_data): added exec_header_not_counted
- field. For ZMAGIC files only, when text_includes_header is set, by
- default the length of the exec header is counted in the text
- section size. For go32, exec header is mapped in but does *not*
- contribute to the size of section.
- * aoutx.h (aout_adjust_sizes_and_vmas): if exec_header_not_counted
- is not set, but ztih is, add the size of the exec header to the
- recorded size of the text section.
- * aoutf1.h (sunos4_aout_backend): clear exec_header_not_counted.
- * i386aout.c (i386aout_backend_data): set exec_header_not_counted.
- Also set text_includes_header.
- * aout-target.h (*_backend_data): cleare exec_header_not_counted
- by default in MY(backend_data).
-
-Thu Oct 8 18:12:49 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * aout-target.h (callback): Don't define this function if it won't be
- used.
-
- * aoutx.h (some_aout_object_p): Restore old aout_data value if this
- type doesn't match. Don't lose if file sections have already been
- created.
- (set_arch_mach): Set reloc_entry_size.
- (slurp_symbol_table): Use bfd_h_get_{16,8} for reaeding symbol data.
-
- * hosts/i386bsd.h: New file.
- * configure.in: Recognize i[34]86-*-bsd host.
-
- * aout-target.h (callback, write_object_contents): Delete unused
- variables.
-
- * aoutx.h (reloc_type_lookup): New function.
- * aout-target.h (MY_reloc_howto_type_lookup): Use it as default.
- * aoutf1.h (sunos4_reloc_type_lookup): Deleted.
- (MY_reloc_howto_type_lookup): Don't define it.
-
- * aoutx.h (adjust_sizes_and_vmas): Don't bother with padding for
- OMAGIC files.
- (slurp_symbol_table): Use header byte order, not target byte
- order, for reading symbol data.
-
-Thu Oct 8 17:33:39 1992 John Gilmore (gnu@cygnus.com)
-
- * configure.in: Undo some brain damage in the host section.
- * configure.in: Reformat the target section, test many configs.
- * Makefile.in (make): Remove obsolete `make make'.
- * aoutx.h (some_aout_object_p): Make defines line up.
-
-Thu Oct 8 08:52:48 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- Now a bfd knows whether underscores are normally prepended
- to symbols in its file format.
-
- * aout-adobe.c, aout-target.h, bout.c, coff-a29k.c, coff-h8300.c,
- coff-z8k.c: targets set so they have leading underscore
- * coff-i386.c, coff-i960.c, coff-m68k.c, coff-mips.c, coff-m88k.c,
- coff-rs6000.c, coff-we32k.c, elf.c, ieee.c, srec.c: targets set
- without leading underscore flag
- * targets.c: add symbol leading char to xvec description
- * bfd-in.h (bfd_get_symbol_leading_char): new macro.
-
-Mon Oct 5 14:32:55 1992 Per Bothner (bothner@cygnus.com)
-
- * archive.c: Make errno global.
- * archive.c (_bfd_write_archive_contents): If read fails (and
- errno!=0) set bfd_error to malformed_archive (since this probably
- indicates a truncated archive), rather than system_call_error.
-
-Mon Oct 5 03:33:39 1992 Mark Eichin (eichin at tweedledumber.cygnus.com)
-
- * Makefile.in: added rules for i386bsd.c
- * i386bsd.c: new file, supporting 386bsd.
- * configure.in: recognize i386-*-bsd target.
- * config/i386-bsd.mt: new file - 386bsd target configuration.
-
-Thu Oct 1 17:51:07 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * configure.in: re-arrange host section to use *-*-* notation,
- clean up some of the target section as well
-
- * seclet.c: cast result of bfd_get_relocated_section_contents to
- avoid compiler warnings
-
-Tue Sep 29 13:24:09 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * coffcode.h (coff_section_symbol): Create section if it doesn't
- already exist.
-
- * bout.c: Removed some unused variables.
-
-Tue Sep 29 08:30:21 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Portability fixes from p3:
- coffcode.h (coff_write_relocs): removed sanity check until it
- works on all targets (per advice from sac).
- config/hp9000.mh: new file to define USG.
- hppa.c: #undef hppa before the JUMP_TABLE.
- hosts/hppahpux.h: #define NATIVE_HPPAHPUX_COMPILER if not
- __STDC__.
- targets.c (bfd_target_list): if NATIVE_HPPAHPUX_COMPILER, make
- local variable target volatile to avoid mysterious bug in
- HP9000/700 cc.
-
-Sat Sep 26 03:58:49 1992 John Gilmore (gnu@cygnus.com)
-
- * config/hppabsd.mh, config.hppahpux.mh: Remove various bogosity.
- * hosts/hppahpux.h: Remove bcopy and index circumventions.
-
-Fri Sep 25 22:36:52 1992 John Gilmore (gnu@cygnus.com)
-
- * coff-z8k.c (func_da, func_jr): Lint.
- * coffcode.h: Use memset rather than bzero.
- * elf.c: Use memcpy rather than bcopy.
- * tekhex.c: Use memset rather than bzero.
-
-Fri Sep 25 19:14:48 1992 John Gilmore (gnu@cygnus.com)
-
- Add Adobe a.out support.
-
- * aout-adobe.c: New file. So far, only reads a.out.adobe. FIXME.
- * config/adobe.mt: Add.
- * configure.in (*-adobe-* target): Add.
- * targets.c (a_out_adobe_vec): Add.
- * Makefile.in: add aout-adobe.c.
-
- * configure.in: Put two dashes in all entries to be matched.
- Add comments to remind people to do this.
- Reorder all entries that match manufacturer names, to occur
- last, so they will only be matched if no more specific match
- occurs. Remove manufacturers `aout', `bout', `coff', and `elf'.
-
-Fri Sep 25 15:03:22 1992 Brendan Kehoe (brendan@rtl.cygnus.com)
-
- * elf.c (section_from_elf_index): Return bfd_abs_section, not 0,
- since we should never have a NULL section.
- (elf_slurp_symbol_table): If st_shndx doesn't match any of our
- tests, set the section to bfd_abs_section.
-
-Fri Sep 25 11:11:57 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-z8k.c: getting closer
- * coffcode.h (coff_get_relocated_section_contents): allow
- EXTRA_CASES hooks for different arches to provide different reloc
- types.
- * seclet.h: #ifndef around it to allow multiple inclusion
- * srec.c: minor doc fix
-
-Mon Sep 21 14:33:58 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * hosts/hp9000.h, hosts/irix3.h: changes from WRS.
-
-Sun Sep 20 08:48:25 1992 Fred Fish (fnf@cygnus.com)
-
- * configure.in: Use i386-elf for all i386/i486 sysv4 hosts, not
- just ncr.
-
-Thu Sep 17 06:40:46 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bout.c (b_out_slurp_reloc_table): Clear howto field before
- filling in reloc, in case immediately following code doesn't set
- it.
-
-Fri Sep 11 15:37:06 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * coffcode.h (coff_renumber_symbols): set the last renumbered
- symbol pointer to NULL, as expected by coff_write_linenumbers.
- (coff_write_relocs): apparently a non-zero addend is OK for reloc
- type R_IHCONST used on the 29k.
-
-Thu Sep 10 13:28:24 1992 John Gilmore (gnu@cygnus.com)
-
- * opncls.c (bfd_fdopenr): Determine whether to fdopen for
- update, based on how the underlying file was opened. Obsoletes
- FASCIST_FDOPEN.
- * hosts/rs6000.h, hosts/tahoe.h, hosts/vaxbsd.h: Remove
- all FASCIST_FDOPEN config defines.
-
-Tue Sep 8 21:37:58 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * sparc-opc.c: Moved to opcodes library, now that we have one.
- * Makefile: Don't compile it.
-
-Tue Sep 8 10:10:34 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * aoutx.h: adjust_sizes_and_vmas did not return anything.
-
-Thu Sep 3 19:29:04 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * section.c (bfd_set_section_flags): Remove a sanity check.
- It is unfortunately broken, and prevents strip from working.
-
-Thu Sep 3 16:14:40 1992 Jim Wilson (wilson@sphagnum.cygnus.com)
-
- * sparc-opc.c (condr): Remove extraneous, but harmless, backlash
- created by last change.
-
-Thu Sep 3 13:52:38 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * reloc.c (reloc_howto_struct): Make size field be unsigned.
- * bfd-in.h: Bump to version 2.0.
-
-Thu Sep 3 09:05:37 1992 Stu Grossman (grossman at cygnus.com)
-
- * bout.c, cpu-z8k.c: Use enums when initializing structs to keep
- braindamaged HP/Apollo compiler happy.
-
-Wed Sep 2 02:53:29 1992 John Gilmore (gnu@cygnus.com)
-
- * format.c: Fix description of search for matching target.
- * aoutx.h (some_aout_object_p): Set SEC_CODE and SEC_DATA.
- * targets.c: Update description of search for matching target.
- * Makefile.in (do_clean, clean): Fix infant mortality typo.
- (docdir): Set to ./doc, not ${srcdir}/doc, which has no makefile.
- (z8k and we32k files): `*.o: *.c': avoid Sun Make bug.
-
-Wed Sep 2 00:26:32 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * Makefile.in: Added mostlyclean/clean/distclean rules.
-
-Tue Sep 1 13:38:40 1992 Per Bothner (bothner@cygnus.com)
-
- * targets.c (target_vector): Take out oasys (unless that is
- the default): Because there is no magic number in archives,
- there can be annoying target mis-matches.
-
-Mon Aug 31 10:11:37 1992 Jim Wilson (wilson@sphagnum.cygnus.com)
-
- * sparc-opc.c: Rigorously updated to match architecture manual.
-
-Mon Aug 31 08:07:58 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * aoutx.h (aout<n>swap_ext_reloc_out), bout.c
- (b_out_squirt_out_relocs): fix bug 1506 where abs symbols attached
- to the built-in abs_section were not written out correctly.
-
-Fri Aug 28 16:29:15 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * archive.c (bfd_slurp_bsd_armap): if the symdef_count is too
- large, assume we're using a swapped byte order and fail with
- wrong_format rather than dumping core.
-
-Thu Aug 27 13:05:28 1992 Brendan Kehoe (brendan@cygnus.com)
-
- Add preliminary support for the we32k:
-
- * Makefile.in, archures.c, coffocode.h, configure.in, targets.c:
- Minor edits.
- * coff-we32k.c, cpu-we32k.c, config/we32k.mt, hosts/we32k.h: New files.
-
-Wed Aug 26 14:20:16 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * bout.c: added support for relaxable alignment relocs.
-
- * seclet.c (rel, seclet_dump_seclet, seclet_dump): get the app to
- pass down pointer to play area rather than use alloca
-
- * cpu-z8k.c (compatible): made static to reduce name space
- polution.
-
-Tue Aug 25 08:39:10 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- Add basic support for the z8k:
-
- * Makefile.in, archures.c, coffcode.h, configure.in, reloc.c,
- section.c, targets.c,
-
- * syms.c: move mis-inserted patch.
-
-Fri Aug 14 15:39:29 PDT 1992 Howard Chu (hyc@hanauma.jpl.nasa.gov)
-
- Documentation fixes:
- * ctor.c, format.c, section.c, reloc.c: append " -" to item tags.
- * reloc.c, section.c, syms.c, targets.c: add DOCDD before @node
- comments.
- * reloc.c: break out addend item from surrounding text.
-
- * doc.str (DOCDD): Defined. Adds text to output.
- (bodytext): Put bulletize before kill_bogus_lines.
- * chew.c (bulletize): End itemization after a blank line, to
- prevent following text from being swallowed up in an item.
-
-Mon Aug 24 20:50:22 1992 Stu Grossman (grossman at cygnus.com)
-
- * configure.in: Add sparclite as a target.
-
-Mon Aug 24 12:06:31 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * ieee.c (ieee_get_symtab): always null terminate the symbol list,
- lint.
-
- * coffcode.h (coff_add_missing_symbols): if symbols don't come
- from a coff file (csym is null), dont deref them
-
- * ieee.c (parse_expression): get the answer right when adding an
- abs+(sec+off), (ieee_generic_stat_arch_elt): call ieee_object_p
- on elts so that filename is filled in.
-
-Thu Aug 20 19:05:48 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * bout.c (howto_align_table): New set of relocs, with enough
- data for "objdump -r" to work.
- (b_out_reloc_type_lookup): Recognize alignment relocs.
-
-Tue Aug 18 12:57:45 1992 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in: added FLAGS_TO_PASS, and used it for all recursive
- invocations of make. Also, always create installation
- directories.
-
- * config/apollov68.mh: removed -g from CC definition.
-
-Mon Aug 17 13:40:08 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * config/decstation.mh (HDEFINES): Specify "-G 4" to avoid
- overflowing gp-offset range.
-
-Mon Aug 17 11:44:28 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * srec.c (srec_set_section_contents): don't write out sections
- without the LOAD and ALLOC attributes
-
-Mon Aug 17 11:55:07 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * archures.c, cpu-m68k.c, cpu-sparc.c: Undo 16 June changes.
- * libaout.h (struct aout_backend_data): New callback "set_sizes".
- * aout-target.h (callback): Don't set page/seg sizes.
- (mkobject): Ditto.
- (set_sizes): New routine.
- (backend_data): Point to it.
- * aoutf1.h (sunos4_set_sizes): Heed architecture when setting sizes.
- (sunos4_aout_backend): Point to it.
- * aoutx.h (set_arch_mach): Call set_sizes callback.
-
-Fri Aug 14 19:22:18 1992 Per Bothner (bothner@cygnus.com)
-
- * aout-target.h: Make _bfd_slurp_extended_name_table be
- the default. Given that we *write* the suckers (for long
- archive member names), we really ought to be able to read them!
- * trad-core.c: Don't include <machine/reg.h>. It doesn't
- seem to be needed, and many machines don't have it.
-
-Thu Aug 13 09:53:39 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-m68k.c (vector): read and write archives in coff format.
-
-Tue Aug 11 12:19:42 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * opc-sparc.c: New file.
-
-Sat Aug 8 23:15:35 1992 Fred Fish (fnf@cygnus.com)
-
- * bout.c (bfd_reloc_status_type, callj_callback): Cast void*
- pointers to bfd_byte* before performing arithmetic on them. Such
- use with bare void* pointers is a gcc extension.
- * cache.c (bfd_cache_delete): Forward decl with prototype form.
- * archive.c (normalize): Add to CONST to match actual usages with
- CONST.
-
-Mon Aug 3 00:35:29 1992 Fred Fish (fnf@cygnus.com)
-
- * configure.in: Recognize i486 host cpu, and use i386-elf
- for i486-ncr-sysv4.
-
-Sat Aug 1 13:49:59 1992 Fred Fish (fnf@cygnus.com)
-
- * config/stratus.mt (CC): Remove definition.
- * elf.c (bfd_section_from_shdr): Test for the possibility that
- section_from_elf_index returns NULL and don't dereference it.
-
-Mon Jul 20 02:46:09 1992 D. V. Henkel-Wallace (gumby@cygnus.com)
-
- * add hppa_data to bfd tdata (indirectly via sef).
-
- * config/hppahpux.mh: hpux is -DUSG (patch by sef)
-
-Sat Jul 18 15:50:11 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * configure.in: error messages to stderr, not stdout
-
-Fri Jul 17 18:32:46 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * bfd.c, cache.c, coff-a29k.c, coff-i386.c, coff-i960.c,
- coff-m68k.c, coff-m88k.c, demo64.c, libaout.h, libbfd.c,
- oasys.c, opncls.c, sunos.c, targets.c: removed rcsid's.
-
-Fri Jul 17 17:06:56 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * configure.in: recognize hppa* instead of hppa
-
-Thu Jul 16 16:39:25 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-m68k.c: added R_RELLONG_NEG reloc type, and changed
- RTYPE2HOWTO to cope with same.
- * reloc.c (bfd_perform_relocation): added support for size of -2
- (subtract a word reloc type). Updated doc.
-
-Thu Jul 16 16:28:09 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: merged changes from progressive, removed rcsid.
-
- * archures.c, archive.c, Makefile.dos: removed rcsid.
-
-Thu Jul 16 08:08:25 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * bfd-in.h : add BFD_IS_RELAXABLE flag
- * bout.c (bout_swap_exec_header_[in_out]): new field in exec
- header e_relaxable, major hackery in callbacks
- * libaout.h : add space for a_relaxable.
- * seclet.c (rel): don't relax empty sections
-
-
-Wed Jul 15 07:57:46 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * section.c (STD_SECTION): add some casts to the initializers for
- dumb compilers
-
-Tue Jul 14 14:06:28 1992 Stu Grossman (grossman at cygnus.com)
-
- * rs6000-core.c (rs6000coff_core_p): Greatly simplify expression,
- and add appropriate casts to keep (picayune) aix-cc happy.
-
-Mon Jul 13 05:06:51 1992 John Gilmore (gnu at cygnus.com)
-
- * elf.c (elf_slurp_symbol_table): Now 2nd arg is where to write
- symbol pointers. Punt expensive & useless bfd_realloc. Use
- malloc for raw symbols, and free it before returning.
- (bfd_section_from_shdr): Do not slurp symbol table until politely
- asked. Do not even slurp string tables.
- (elf_get_symtab_upper_bound): Count 'em without reading them.
- (elf_get_symtab): This is how to politely ask. Schlurp!
- This should probably just *become* elf_slurp_symbol_table, FIXME.
-
-Wed Jul 8 16:24:33 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * archive.c (bsd_write_armap): write the timestamp of the
- archive header to be just a little bit later than the timestamp of
- the file, otherwise the linker will complain that the index is
- out of date.
-
-Tue Jul 7 00:23:23 1992 Fred Fish (fnf@cygnus.com)
-
- * configure.in: Add m68k-ericsson-*.
-
-Sat Jul 4 03:29:41 1992 John Gilmore (gnu at cygnus.com)
-
- * syms.c: Define BSF_FILE, update BSF_SECTION_SYM desc.
- * elf.c: Remove unconditional debug printf's.
- (elf_write_object_contents, elf_slurp_symbol_table): Handle
- BSF_SECTION_SYM <=> STT_SECTION, BSF_FILE <=> STT_FILE.
- (elf_slurp_symbol_table): Hand out symbols in forward, not
- reverse order. Simplify duplicate code.
-
-Fri Jul 3 20:23:34 1992 Fred Fish (fnf@cygnus.com)
-
- * elf.c: Remove "(void)" casts from function calls where the
- return value is ignored, in accordance with GNU coding standards.
-
-Tue Jun 30 16:49:12 1992 Fred Fish (fnf@cygnus.com)
-
- * hppa.c: Apply John's standard fix to avoid "empty translation
- unit" warnings from some ANSI-C compilers.
-
-Thu Jun 25 04:39:25 1992 John Gilmore (gnu at cygnus.com)
-
- * hosts/solaris2.h: Configure same as sysv4.
-
-Tue Jun 23 21:54:44 1992 Fred Fish (fnf@cygnus.com)
-
- * libbfd.h, libbfd-in.h (bfd_seek): Make prototype match definition.
- * reloc.c (bfd_default_reloc_type_lookup): Make cast on return
- type match actual return type.
- * section.c (elf_print_symbol): Make CONST.
-
-Mon Jun 22 17:35:24 1992 Per Bothner (bothner@cygnus.com)
-
- * i386linux.c, hosts/i386linux.h, config/i386-linux.mt:
- New files, for Linux (a free Unix clone for 386 machines).
- * Makefile.in, configure.in, targets.c: Update accordingly.
-
-Fri Jun 19 20:23:21 1992 Steve Chamberlain (sac@thepub.cygnus.com)
- Lints for bfd_reloc_code_type->bfd_reloc_code_real_type, and
- correct calling of howto special functions and fixes from Raeburn
- for gas<>bfdness
- * archures.c: nuke bfd_reloc_code_type
- * bout.c, cpu-h8300.c, coff-i960.c, coff-m88k.c: special function lint
- * coffcode.h (styp_to_sec_flags): STYP_INFO is marked as
- SEC_NEVER_LOAD, various other bfdgas newness
- * reloc.c->libbfd.h: change protype of bfd_default_reloc_type_lookup
- * targets.c: change jump table vector to above
-
-
-Fri Jun 19 19:00:45 1992 John Gilmore (gnu at cygnus.com)
-
- * elf.c (bfd_elf_find_section): Mark as INTERNAL_FUNCTION so
- its prototype will be included in libbfd.h. Change result type
- to struct * (rather than equivalent typedef) so it can be used in
- the prototype, where they typedef won't be known.
- * libbfd.h: Updated version.
-
-Fri Jun 19 15:21:56 1992 Stu Grossman (grossman at cygnus.com)
-
- * Makefile.in, archures.c, configure.in, cpu-hppa.c, hppa.c, libhppa.h,
- targets.c: HPPA merge.
-
-Fri Jun 19 12:21:38 1992 John Gilmore (gnu at cygnus.com)
-
- * configure.in: Separate Solaris2 from SYSV4 on SPARC.
- * config/solaris2.mh: Kludge around Sun compiler bug.
-
-Wed Jun 17 14:02:46 1992 Stu Grossman (grossman at cygnus.com)
-
- * libaout.h (aout_backend_data): Change defs of two bitfields to
- be unsigned chars instead to get around rs6000 compiler problem.
-
-Wed Jun 17 13:55:31 1992 Fred Fish (fnf@cygnus.com)
-
- * elf.c (bfd_section_from_shdr, elf_slurp_symbol_table):
- Correct misconception that there can be only one symbol table.
- Only call elf_slurp_symbol_table on the full symbol table, not
- the dynamic one which is only a subset of the full one.
-
-Wed Jun 17 15:54:57 1992 Ken Raeburn (Raeburn@Cygnus.COM)
-
- * coffcode.h (coff_compute_section_file_positions): For I960,
- don't align sections in file.
-
-Tue Jun 16 06:28:21 1992 Ken Raeburn (Raeburn@Cygnus.COM)
-
- * targets.c (struct bfd_target): Added field for target-specific
- (but not file-specific) data, for distinguishing minor
- characteristics between (e.g.) a.out formats.
-
- * section.c (struct sec): New field user_set_vma indicates vma
- field should be heeded, not assumed to be unset.
- (STD_SECTION): Initialize that field of standard sections to zero.
- * bfd-in.h (bfd_set_section_vma): Set user_set_vma to true.
-
- * coffcode.h (coff_write_relocs): Write out swapped reloc, not
- pre-swapped version.
-
- * archures.c (struct bfd_arch_info): Fixed order of comment and
- field decl. New fields indicate size of page and segment for
- architecture.
- * cpu-m68k.c (N): Fill in values.
- * cpu-sparc.c (arch_info_struct): Ditto.
-
- * libaout.h (struct aout_backend_data): Various bits of data (not
- all used currently) with characteristics of a.out implementation.
- Important field for now is text_includes_header, indicating that
- the text section starts immediately after the file header, which
- gets mapped in with it.
- (struct aout_data): New fields indicate whether vma has been
- adjusted yet (not yet used), and what magic number will be used in
- the output file (should go away in favor of vma_adjusted).
- (WRITE_HEADERS): Code for dealing with section sizes and related
- header fields replaced with call to adjust_sizes_and_vmas.
- * aoutx.h (some_aout_object_p): Fill in magic number field.
- Set WP_TEXT flag for ZMAGIC as well as NMAGIC files.
- (set_arch_mach): Set page size and segment size once CPU
- type is known.
- (adjust_sizes_and_vmas): New function; has much code moved
- from set_section_contents and WRITE_HEADERS. Sets or adjusts vma
- and size parameters, as well as many header fields, after deciding
- on magic number for output file. Checks to ensure that this
- adjustment has only been done once.
- (set_section_contents): Call adjust_sizes_and_vmas instead of
- doing much of the work here.
-
- * aout-target.h (MY_make_debug_symbol, MY_backend_data): Provide
- default (null) values of these fields.
- * aoutf1.h (sunos4_write_object_contents): Don't override a_text
- value in exec header.
- (sunos4_aout_backend, MY_backend_data): Define backend data
- indicating file header is included in text section.
-
- * aoutf1.h (MY_reloc_howto_type_lookup): Fix typo.
-
- * hosts/sparc.h (abort, exit): Hide these names if compiling with
- gcc version 2, to avoid warnings.
-
-Mon Jun 15 12:26:56 1992 Fred Fish (fnf@cygnus.com)
-
- * config/ncr3000.mh (INSTALL, RANLIB): Don't use /usr/ucb/install,
- it's broken on ncr 3000's. Use simple "true" for RANLIB.
-
-Sat Jun 13 09:16:43 1992 Michael Tiemann (tiemann@rtl.cygnus.com)
-
- * configure.in (m680[01234]0-wrs-*): Fix typo in match pattern.
-
-Fri Jun 12 19:48:34 1992 John Gilmore (gnu at cygnus.com)
-
- * section.c (STD_SECTION): Remove extra semicolon in declarations.
- * configure.in: Rewrite target parsing to use simple format.
- Handle sparc-sun-solaris2 configuration.
- * aout64.h: Avoid ANSI C brain death warning.
- * elf.c: Avoid trigraph (???) or /* in comments.
-
-Fri Jun 12 14:51:14 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * config/sysv4.mh: new file, RANLIB=echo
-
- * configure.in: handle Solaris2 as -sysv4 or -solaris2
-
-Thu Jun 11 00:52:03 1992 John Gilmore (gnu at cygnus.com)
-
- * elf.c (elf_obj_tdata): Merge elf_obj_tdata_struct and
- elf_core_tdata_struct into a single common struct. Core files
- wouldn't have worked at all without this.
- (bfd_elf_find_section): New function for GDB's undercover use
- to find string sections that BFD hides from it.
- (elf_get_str_section): Avoid multiple alloc&reads for same data;
- lint.
- (elf_object_p, elf_core_file_p): Allocate internal file header
- storage dynamically.
- * bfd.c (union {...} tdata): Remove elf_core_tdata_struct.
- * demo64.c: Prevent "empty translation unit" warnings from idiots.
-
-Tue Jun 9 17:15:26 1992 Fred Fish (fnf at cygnus.com)
-
- * config/{i386v4.mh, ncr3000.mh}: Update RANLIB, add INSTALL.
-
-Sat Jun 6 17:02:51 1992 John Gilmore (gnu at cygnus.com)
-
- * configure.in: Handle Solaris2 as *-sun-sysv4 or as *-sun-sunos5.
-
-Sun May 31 05:45:00 1992 david d `zoo' zuhn (zoo@cygnus.com)
-
- * configure.in: handle m680[01234]0 as aliases for m68k
-
-Tue May 26 16:50:59 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-a29k.c: do byte relocs correctly
- * coffcode.h (styp_to_sec_flags): never load INFO sections
- * seclet.c (rel): don't relocate INFO sections
-
-Wed May 20 08:18:18 1992 Ken Raeburn (Raeburn@Cygnus.COM)
-
- * section.c (bfd_*_symbol, bfd_*_section): Initialize statically.
- Make the symbols unmodifiable.
- (bfd_section_init): Deleted.
- * init.c (bfd_init): Don't call bfd_section_init.
-
- * section.c (bfd_set_section_contents): Ensure that range to be
- written is within section boundaries.
- (bfd_get_section_contents): Likewise. Don't bother dispatching if
- size is zero.
-
- * libbfd.c (bfd_xmalloc): Text of error message should be const.
-
- * coff-i960.c (howto_table): Deleted.
- (howto_rellong, howto_iprmed, howto_optcall): New vars;
- interesting entries from old howto_table.
- (RTYPE2HOWTO): Adjusted to use switch.
- (coff_i960_reloc_type_lookup): New function.
-
- * coffcode.h (coff_new_section_hook): Allocate storage for aux
- records for section symbol.
- (make_abs_section): Unused; deleted.
- (renumber_symbols): Re-order symbols so undefined symbols come
- last, as COFF format desires.
- (coff_write_symbol): Put C_FILE symbols in debug section always.
- (coff_section_symbol): New function; creates a symbol with the
- same name as a section, and sets up aux records for it.
- (coff_add_missing_symbols): New function; adds section symbols to
- symbol table if they aren't there already. Should someday also
- add a dummy C_FILE symbol if none is present.
- (coff_write_object_contents): Add missing symbols before preparing
- symbol table to be written.
- (coff_slurp_reloc_table): Verify that symbol indices read in are
- in a reasonable range.
- * libcoff-in.h (struct coff_tdata): New field conv_table_size.
- (obj_conv_table_size): Accessor macro.
-
- * bout.c (b_out_reloc_type_lookup): New function. Handles three
- reloc types on i960.
-
- * bfd-in.h (bfd_get_section_name): New macro. Like
- bfd_section_name, but returns rvalue, not lvalue.
- (bfd_get_section_vma, bfd_get_section_alignment): Similar.
- (bfd_get_section_flags): Now returns rvalue.
-
- * reloc.c (enum bfd_reloc_code_real): Add several new values, some
- general, some specific to sparc or i960.
-
- * aoutx.h (set_section_contents): Set VMA for each section based
- on previous section. If text section VMA doesn't appear to have
- been set, make a best guess from the type of file.
-
- * aout-target.h (MY_reloc_howto_type_lookup): Define as zero if
- not defined.
- (MY(vec)): Initialize reloc_type_lookup field.
-
- * aoutx.h (howto_table_*): Export as aout_#_*_howto_table.
- (bfd_error_trap, bfd_error_vector): Extern, not common.
-
- * aoutf1.h (sunos4_reloc_type_lookup): New function. Handles a
- few types of relocs for sparc; will need enhancement.
-
- * bout.c (callj_callback): Use DEFUN macro in definition.
- * coff-i960.c (optcall_callback): Likewise.
-
- * targets.c (bfd_target): Added fields reloc_type_lookup and
- _bfd_make_debug_symbol. Also minor comment changes.
- * syms.c (bfd_make_debug_symbol): New dispatching macro.
- * reloc.c (bfd_reloc_type_lookup): Take a BFD ptr as arg rather
- than arch info, and dispatch with BFD_SEND. Callers changed.
- * archures.c (struct bfd_arch_info): Deleted field
- reloc_type_lookup.
- * cpu-*.c: Don't initialize that field.
-
- * bfd-in.h (enum bfd_error): Add new value "bad_value".
- * bfd.c (bfd_errmsgs): Now const; added entry for bad_value.
- (bfd_errmsg): Now returns ptr to const.
- * bfd-in.h (bfd_errmsg): Fix prototype.
-
- * cache.c (BFD_CACHE_MAX_OPEN): Fix typo in doc.
- * reloc.c (bfd_generic_relax_section): Ditto.
-
- * section.c (Section Output doc): Improve description of use of
- output_section and output_offset.
-
-Tue May 19 23:42:10 1992 D. V. Henkel-Wallace (gumby@cygnus.com)
-
- * sco-core.c: new file from net.
- * aoutx.h (translate_to_native_sym_flags): bugfix from net:
- Now we have the hairy linker, it's possible to move symbols from
- one section into another. Actually make that work!
-
-Sat May 16 17:57:59 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * hosts/sun3.h: fix declaration of free.
-
-Tue May 12 14:08:59 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-a29k.c (perform_reloc): fix bug in jmp/call evaluation
- * coff-h8300.c (reloc_processing): all relocs are relative to
- section start.
- * opncls.c: don't use fdopen on DOS systems
-
- short patches from Glenn Kasten (glenn@ready.com)
- * targets.c: enabled oasys support
- * oasys.c: Insert . when UNDERSCORE_HACK is enabled,
- fix problem where a relocation which crossed a modification byte
- boundary did not work. Fix problem where a relocation near the end
- of a data record did not work.
-
-
-Tue May 5 18:11:25 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * archive.c (bfd_slurp_coff_armap): old versions of BFD wrote
- archvie header string counts the endian way, this heuristic sees
- how big an archive string to read by trying it one way and if the
- string table is unreasonably big, trying it the other. *FIXME*.
- * opncls.c (bfd_fdopenr): can't do fdopens on VMS
-
-Tue May 5 14:18:24 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * bfd-in.h: Increase version number to 1.97, for consistency
- with ../binutils.
- * Makefile.in: docdir is ./doc, not ${srcdir}/doc.
-
-Mon May 4 11:49:15 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * bfd-in.h: bump version to 1.96
- Major change; changed calling convention for
- bfd_get_relocated_section_contents so that caller allocates
- memory for section data.
- * coffcode.h (bfd_coff_get_relocated_section_contents), reloc.c,
- seclet.c, targets.c, bfd.c: reflect new convention.
- * coffcode.h (styp_to_sec_flags): if styp_flags is not a special
- case, then use reasonable default values for SEC_* flags.
-
-Fri May 1 12:58:34 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coffcode.h (coff_write_object_contents): use RELSZ to work out
- size of output reloc struct.
- * targets.c, Makefile.in: comment out tekhex for the moment.
- * ieee.c: if some places where null pointers were used instead of &bfd_abs_section.
- * configure.in: tandem target is st2000
- * coff-m68k.c: rename static howto_table to global
- m68kcoff_howto_table.
- * bout.c: remove unnecessary abort
- * coff-a29k.c: various changes to the way relocations work to cope
- with the "new order" and latent bugs.
- * coffcode.h: lint
-
-Wed Apr 29 12:37:07 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * aoutx.h (aout_swap_ext_reloc_out, aout_swap_std_reloc_out)
- bout.c (b_out_squirt_out_relocs): treat abs sumbols the right way.
- * reloc.c (bfd_perform-relocation): don't relocate refs to
- absolute symbols if doing a partial link.
-
-Fri Apr 24 07:35:26 1992 Stu Grossman (grossman at cygnus.com)
-
- * configure.in: Add a29k-amd-udi.
-
-Thu Apr 23 18:37:55 1992 Fred Fish (fnf@cygnus.com)
-
- * aoutx.h (aout_<bits>_swap_exec_header_in): Zero out the
- internal_exec structure before initializing the fields that
- are used, so that the unused fields are in a known state.
-
-Wed Apr 22 09:36:08 1992 Fred Fish (fnf@cygnus.com)
-
- * tekhex.c (struct data_struct): Convert from typedef that
- typedefs nothing to a normal structure declaration.
- * tekhex.c (pass_over): Prototype args for function that
- second arg points to.
-
-Mon Apr 20 22:22:51 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: remove old style staging. Do not print recursion
- lines.
-
- * Makefile.in: rework CFLAGS so that CFLAGS can be passed from the
- Makefile command line. Remove MINUS_G. Default CFLAGS to -g.
- Pass CFLAGS.
-
-Fri Apr 17 09:15:31 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * bfd.c, Makefile.in: added tekhex
- * aoutx.h (set_section_contents): pages should be padded to the
- size of a page, not the size of a segment.
- * configure.in: added go32 host and i386-aout target.
- * i386aout.c, libaout.h: now works for go32 target
- * ieee.c: fix bit rot.
- * seclet.c: support for padding seclet type.
-
-Wed Apr 15 18:11:58 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: added .NOEXPORT:
-
-Tue Apr 14 14:34:42 1992 Fred Fish (fnf@cygnus.com)
-
- * elf.c (bfd_add_strtab, bfd_add_2_to_strtab): CONST spreads
- like ooze.
- * elf.c (elf_compute_section_file_positions,
- elf_write_object_contents): Return boolean, not NULL (which
- can be void *).
- * elf.c (bfd_section_from_shdr): Ifdef-out debugging code.
- Also ifdef-out code that aborts on unhandled section types.
-
-Fri Apr 10 22:29:18 1992 Fred Fish (fnf@cygnus.com)
-
- * configure.in: Recognize ncr3000 config
- * Makefile.in (MINUS_G): Pass on to recursive makes.
- * hosts/ncr3000.h, config/ncr3000.mh: Add host config files.
-
-Thu Apr 2 17:42:45 1992 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: Now that we have sym.h and symconst.h, compile
- coff-msym.c on all systems.
- * config/{decstation.mh, irix3.mh, irix4.mh}: Remove coff-msym.o dep.
- * coff-msym.c: Update include files and comments; add weakext bit.
-
-Wed Apr 1 23:16:38 1992 John Gilmore (gnu at cygnus.com)
-
- * archive.c, bfd.c, bout.c, coffcode.h, init.c, reloc.c,
- section.c, srec.c, syms.c, coff-h8300.c: Lint.
-
-Sun Mar 29 09:37:59 1992 John Gilmore (gnu at cygnus.com)
-
- * bout.c, coff-a29k.c, coff-i960.c: Lint.
- * configure.in: Add new host and target configs.
- * elf.c (bfd_prstatus, bfd_fpregset): Avoid typename of register
- structs, which vary; just use member name.
- (elf_object_p, elf_core_file_p): Lint, fix comments.
- * config/sparc-elf.mt, hosts/sysv4.h: New config files.
-
-Sat Mar 28 13:07:02 1992 Fred Fish (fnf@cygnus.com)
-
- * elf.c (elf_object_p, elf_core_file_p): Fix to use only a single
- local, disposable, copy of the external form of section header
- table and program header table entries.
-
-Thu Mar 26 16:59:58 1992 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: Set MINIMIZE back to 0 for a real release.
-
-Tue Mar 24 15:57:03 1992 K. Richard Pixley (rich@cygnus.com)
-
- * configure.in: config/irix4.m[ht], hosts/irix4.h: add support for
- irix4.
-
-Mon Mar 23 22:37:34 1992 Stu Grossman (grossman at cygnus.com)
-
- * coff-msym.c (ecoff_swap_rfd_in): remove & for array ref.
-
-Tue Mar 17 14:12:25 1992 Per Bothner (bothner@rtl.cygnus.com)
-
- * bout.c (b_out_slurp_reloc_table): Use BFD_ASSERT macro,
- not internal bfd_assert function (twice).
-
-Tue Mar 17 10:45:12 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * aout-target.h: change ar_max_namelen to 15 (the right value)
- * coff-a29k.c, coffcode.h: more hangovers from the bfd_abs_section
- change
-
-Mon Mar 16 14:57:22 1992 Steve Chamberlain (sac@rtl.cygnus.com)
-
- * archive.c (bfd_generic_archive_p): check for bout archives too.
- * bout.c: make it work again.
-
-Sat Mar 14 17:30:40 1992 Fred Fish (fnf@cygnus.com)
-
- * elf.c (elf_corefile_note): Call bfd_xmalloc() instead of bare
- malloc().
- * reloc.c (bfd_generic_get_relocated_section_contents): Call
- bfd_xmalloc() instead of bare malloc().
-
-Fri Mar 13 15:44:37 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in: pass down MAKEINFO on info.
-
-Fri Mar 13 07:41:13 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * config/mt-<foo> now <foo>.mt, config/mh-<foo> now <foo>.mh.
- host/h-<foo> now just <foo>.
- * configure.in: reflect changes
-
-Thu Mar 12 11:15:02 1992 Per Bothner (bothner@cygnus.com)
-
- * libbfd-in.h (set_tdata): Make change of Feb 27 in the
- actual source file, not just the generated libbfd.h.
-
-Sat Mar 7 10:33:41 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * coff-i960.c (icoff_little_vec): add COFF_SWAP_TABLE so we can run
- gdb on little-endian 960 code.
- * archive.c (compute_and_write_armap): indirect symbols should go
- into the archive header too.
-
-Fri Mar 6 21:55:16 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in: added check target.
-
-Thu Mar 5 23:51:42 1992 John Gilmore (gnu at cygnus.com)
-
- * coff-msym.c: Move this file from gdb/ecoff.c. It
- handles byte-swapping for ECOFF (MIPS symbol) files.
- * config/mh-decstation, config/mh-irix3: Add coff-msym.o
- to the files built on MIPS-based hosts.
- * Makefile.in: Add rule for coff-msym.
-
-Thu Mar 5 21:36:05 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in: added clean-info target. MINIMIZE=1.
-
-Sun Mar 1 22:32:58 1992 Per Bothner (bothner@cygnus.com)
-
- * coff-rs6000.c: Move core file functions into separate
- new file rs6000-core.c. This is needed because reading
- core files depends on native include files that conflict
- with ../include/coff/rs6000.h.
- * config/mh-rs6000: Add rs6000-core.o to HDEPFILES.
-
-Thu Feb 27 22:19:55 1992 Per Bothner (bothner@cygnus.com)
-
- * aoutx.h (NAME(aout,print_symbol)): Don't print
- symbol addresss for undefined symbols.
- * coff-rs6000.c: Various updates (due to target-
- independent changes).
- * libbfd.h: Ditto (tdata field is now a union).
- * hosts/h-sparc.h: Removed prototype for bogus function
- 'emset' (presumably should have been 'memset' - which is there).
-
-Thu Feb 27 11:46:33 1992 John Gilmore (gnu at cygnus.com)
-
- * configure.in (mips-big-* target): Same is Iris.
-
-Thu Feb 27 09:24:56 1992 Steve Chamberlain (sac at thepub.cygnus.com)
-
- * aoutx.h (translate_from_native_sym_flags): when creating an
- alias symbol, fill in the section as undefined, rather than
- leaving it blank. If an output section can't be found for a
- symbol, then don't core dump.
-
-Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in, configure.in: removed traces of namesubdir,
- -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
- copyrights to '92, changed some from Cygnus to FSF.
-
-Wed Feb 26 19:40:59 1992 Steve Chamberlain (sac at thepub.cygnus.com)
-
- * bfd.c: lint
- * coff-h8300.c: fix stupid reloc subtraction bug
- * coffcode.h (coff_swap_aux_out): only swap a tvndx by 2 bytes,
- since that's how wide it is. (coff_slurp_symbol_table): always zero out
- the symbol.flags and done_lineno fields.
-
-Tue Feb 25 14:29:24 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * coffcode.h (coff_write_symbol): write out the correct number of
- auxents.
- * cpu-h8300.c: fix disassembly bug
-
-Fri Feb 21 21:39:56 1992 John Gilmore (gnu at cygnus.com)
-
- * bfd-in.h (bfd_errmsg), coffcode.h (coff_swap_aux_in,
- section_from_bfd_index), cpu-h8300.c (howto*_callback),
- reloc.c, section.c (bfd_map_over_sections), targets.c
- (bfd_target_list): Protolint.
- * libbfd.h: Update to match a libbfd-in.h from a month ago.
-
-Fri Feb 21 10:57:54 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * coffcode.h (coff_swap_aux_in): lint, (coff_print_symbol): prints
- out tagndx too.
- * aoutx.h (swap_std_reloc_out, swap_ext_reloc_out): use the output
- section of a symbol rather than the section of a reffed symbol to
- determine the r_index of an emmitted reloc.
-
-Thu Feb 20 18:10:34 1992 Per Bothner (bothner at cygnus.com)
-
- * PORTING: New (preliminary) porting guide.
-
-Wed Feb 19 21:39:37 1992 John Gilmore (gnu at cygnus.com)
-
- * bout.c (callj_callback), coff-a29k.c (a29k_reloc), coff-m88k.c
- (howto_hvrt16): lint.
-
-Mon Feb 17 12:02:17 1992 Per Bothner (bothner at cygnus.com)
-
- * hp300bsd.c (new), config/mt-hp300bsd: Make hp300bsd
- a full configuration (with possible cross-development),
- instead of using host-aout.c.
-
-Sun Feb 16 13:01:49 1992 Per Bothner (bothner at cygnus.com)
-
- * aout-target.h (MY(write_object_contents):
- Set obj_reloc_entry_size (abfd).
- * gen-aout.c: Change to emit a .c files, not a .h file.
-
-Thu Feb 13 20:11:47 1992 Fred Fish (fnf at cygnus.com)
-
- * elf.c (elf_slurp_symbol_table): Remove obsolete use of
- BSF_ABSOLUTE and replace with bfd_abs_section reference.
-
-Thu Feb 13 17:22:44 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * coffcode.h (get_normalized_symtab): fixed bug where symbols
- with more than one auxent can cause nasty core dumps.
-
- * coffcode.h, libcoff.c: added new fielded to coff_symbol_struct
- "done_lineno" so that a symbol which appears twice in the symbol
- table only gets it's linenumbers relocated once. Modifed
- (coff_write_native_symbol) and (coff_make_empty_symbol) to make
- use of it.
-
-Tue Feb 4 15:39:55 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * aoutx.h: (translate_from_native_sym_flags): fix constructor
- stuff to use the New Order.
-
-Fri Jan 31 01:34:45 1992 Stu Grossman (grossman at cygnus.com)
-
- * ieee.c: Change type of envi[] to unsigned char.
-
- * configure.in: fix vax ultrix configuration.
-
- * elf.c (bfd_section_from_shdr): Deal with null return from
- bfd_make_section(). (elf_object_p): Select endianess properly.
-
-Fri Jan 31 01:19:55 1992 John Gilmore (gnu at cygnus.com)
-
- * hosts/h-tahoe.h, h-vaxbsd.h: Fix stack in core files.
-
-Thu Jan 30 23:51:07 1992 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: host-aout.c doesn't depend on aout-params.h.
- * aout-target.h: Use TARGET_BIG_ENDIAN_P to set up vector.
- * host-aout.c: Don't use aout-params.h; configure these systems
- in their xm files, not in a randomly generated file.
- * hosts/h-hp300bsd.h, h-tahoe.h, h-vaxbsd.h, h-vaxult.h:
- Specify byte order.
- * hosts/h-vaxbsd.h: Define the form of exec and core files.
-
-Thu Jan 30 13:02:41 1992 Per Bothner (bothner at cygnus.com)
-
- * config/mt-tahoe, config/mt-vax: Change DEFAULT_VECTOR to
- host_aout_vec here as well.
-
-Thu Jan 30 11:41:45 1992 Stu Grossman (grossman at cygnus.com)
-
- * host-aout.c: Change TARGETNAME to "a.out" to be compatible with
- gdb. config/mt-hp300bsd: Change DEFAULT_VECTOR to host_aout_vec
- to prevent undefined symbol.
-
-Thu Jan 30 07:26:53 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- Various lints found on PersSony
- * aoutx.h: cast an enum
- * coff-a29k.c: many ints in reloc structure turned to enum
- * coffcode.h: more enums
- * cpu-h8300.c: more enums
- * opncls.c: more enums
-
-Thu Jan 30 01:19:56 1992 John Gilmore (gnu at cygnus.com)
-
- * configure.in: Make Tahoe configuration work again.
- * bfd-in.h: Remove trailing comma from enum declaration.
- * ieee.c: Can't put byte values >0x7F into a signed char.
-
-Tue Jan 28 21:10:51 1992 Fred Fish (fnf at cygnus.com)
-
- * Makefile.in: Add dependencies for various coff-*.o files.
-
- * elf.c: Remove extraneous paren from core_prpsinfo and
- core_prpstatus macros, rename core_prpstatus to core_prstatus.
- Replace references to old section "size" member with new
- "_raw_size" member. Implement elf_make_empty_symbol, which
- is now used.
-
-Tue Jan 28 14:51:40 1992 Stu Grossman (grossman at cygnus.com)
-
- * trad-core.c, bfd.c, ../include/bfd.h: Various fixes for PMAX
- core reading.
-
-Tue Jan 28 10:46:32 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * coffcode.h (bfd_coff_relax_section): now static.
- (bfd_coff_get_relocated_section_contents): various type lints.
-
-Mon Jan 27 19:44:08 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- New entry point in the transfer vector - bfd_relax_section.
-
- * aout-target.h: add to vector, call generic_relax
- * bfd-in.h: add to vector
- * bfd.c: add #define for vector
- * bout.c: add to vector, call generic_relax
- * coffcode.h: add to vector, also now has coff specific relax code
- for the relaxable H8/300 relocs. Also clean up abs section cruft.
- * elf.c: call generic_relax
- * ieee.c: call new vector, clean up some bugs due to the creation
- of bfd_abs_section
- * libbfd.h: add bfd_generic_relax_section EXFUN
- * oasys.c: call generic_relax
- * reloc.c: implement generic_relax
- * seclet.c: moved much of this into coffcode.h
- * srec.c: call generic_relax
- * targets.c: define new transfer vector
-
-Fri Jan 24 14:40:17 1992 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * everything: now modified to use smaller reloc type. Self hosts
- on sun3 & sun4.
-
-Sat Jan 18 17:00:16 1992 Fred Fish (fnf at cygnus.com)
-
- * config/mh-stratus, config/mt-i860-elf, hosts/h-stratus:
- New files for stratus.
-
- * configure.in: Add configuration fragments for stratus.
-
-Wed Jan 15 10:02:43 1992 Fred Fish (fnf at cygnus.com)
-
- * aoutx.h (NAME(aout,find_nearest_line)): Declare various filename
- variables as CONST since they are set to point to a const char
- string. Fixes compiler complaints.
-
-Fri Jan 10 17:44:53 1992 Fred Fish (fnf at cygnus.com)
-
- * hosts/h-amix.h hosts/h-i386v4.h: Change abort() to a function
- returning void.
-
-Fri Jan 10 14:33:32 1992 Per Bothner (bothner at cygnus.com)
-
- * aoutx.h (NAME(aout,find_nearest_line)): Recognize N_SOL
- symbols, so that we can emit the correct file name even
- if it's an include file.
-
-Thu Jan 2 16:43:34 1992 John Gilmore (gnu at cygnus.com)
-
- * coff-i960.c: Add COFF_SWAP_TABLE to little_vec as well as big_vec.
- (Reported by john@labtam.labtam.oz.au (John Carey)).
-
-Wed Jan 1 04:23:06 1992 Fred Fish (fnf at cygnus.com)
-
- * elf.c: Change all '#if HAVE_PROCFS' to '#ifdef HAVE_PROCFS'.
-
- * config/mh-amix, config/mh-i386v4: Remove HDEFINES that was
- being used to -DHAVE_PROCFS.
-
- * hosts/h-amix, hosts/h-i386v4: Add '#define HAVE_PROCFS'. Move
- '#include "fopen-same.h"' to end of file to match other h-* files.
-
-Fri Dec 20 12:06:17 1991 Fred Fish (fnf at cygnus.com)
-
- * configure.in: Change svr4 references to sysv4. Add case
- "unknown" for target vendor and infer some targets based
- on the specified operating system.
-
-Wed Dec 18 17:17:59 1991 Stu Grossman (grossman at cygnus.com)
-
- * bfd-in.h, libaout.h: ANSIfy enums.
-
-Wed Dec 18 16:12:25 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * archive.c (normalize): created version for VMS which removes the
- VMS directory crap from the front and end of a filename, eg turn
- [-.foo]bar.obj;123 into bar.obj
- (bfd_construct_extended_name_table): now writes index into an
- extended name table in decimal - the same base used to read an
- extended name table.
-
-Wed Dec 18 14:40:39 1991 Per Bothner (bothner at cygnus.com)
-
- * aout-encap.c: Fix to use aout-target.h.
- * aoutf1.h: Use standard MY_object_p and MY_callback
- in aout-target.h. Remove target-specific versions.
- * host-aout.c: Re-write to use aout-target.h.
- * gen-aout.c: New files use with host-aout.c to generate
- host-specific a.out-related parameters.
- * Makefile.in: host-aout.o depends on aout-params.h, which is
- generated by gen-aout.
- * aout-target.h: Make a little more flexible.
- * libaout.h, aout-target.h: Removed WORK_OUT_FILE_POSTIONS
- macro. Instead, inline it in aout-target.h.
- * newsos3.c: Define N_SHARED_LIB(x) as 0 to avoid
- a gcc -Wall warning.
- * archive.c: Add missing commas in DEFUN macro (2 places).
- * elf.c, coffcode.h, aoutf1.h: Use ANSI functions instead of
- Berkeley ones, now that libiberty has them:
- bcopy->memcpy, bzero->memset, bcmp->memcmp.
- * aoutx.h: Various touch-ups: Re-formatting, fix a cast,
- remove unused variable.
-
-Tue Dec 17 19:48:59 1991 Fred Fish (fnf at cygnus.com)
-
- * elf.c (elf_core_file_matches_executable_p): Enclose corename
- and execname inside HAVE_PROCFS ifdef since they are unused
- when it is not defined.
-
-Mon Dec 16 12:00:10 1991 Fred Fish (fnf at cygnus.com)
-
- * elf.c: Flag all sections as either code or data. We can't
- be sure what they are anyway, since ELF doesn't fit the
- traditional model of text+data+bss very well. Add new local
- function elf_read() to simplify code. Record entry point in
- the bfd structure.
-
-Thu Dec 12 21:01:22 1991 John Gilmore (gnu at cygnus.com)
-
- * hosts/h-*.h: Configure fopen using ../include/fopen-*.h
- rather than N copies of the same lines.
-
-Wed Dec 11 16:39:45 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * cpu-h8300.c: disassemble branch displacements correctly
- * coff-h8300.c: put reloc offsets out in 32bits
-
- * makefile.dos, configdj.bat: New files from DJ
- * cache.c: fopen with new macros is needed for DOS.
- * ieee.c: environ renamed to envi to stop an include file
- conflict.
- * opncls.c, coff-rs6000.c: more fopens with macros.
-
-Tue Dec 10 04:07:24 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: infodir belongs in datadir.
-
-Sat Dec 7 16:39:23 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * Makefile.in: fix where docdir lives
-
- * aoutx.h, archive.c, archures.c, bfd.c, cache.c, coff-m88k.c,
- coffcode.h, core.c, ctor.c, elf.c, format.c, ieee.c, init.c,
- libbfd.c, libbfd.h, libcoff.h, opncls.c, reloc.c, section.c,
- srec.c, syms.c, targets.c : all new documentation and lint
- removal.
-
-
-Sat Dec 7 07:22:09 1991 John Gilmore (gnu at cygnus.com)
-
- * coffcode.h, srec.c: Lint.
-
-Fri Dec 6 22:58:48 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: install using INSTALL_DATA, added standards.text
- support.
-
- * configure.in: mark directory as target dependent. configure
- nows works in objdir always so make file existence checks
- against ${srcdir}.
-
-Thu Dec 5 22:46:19 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: idestdir and ddestdir go away. Added copyrights
- and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
- and mandir now keyed off datadir by default.
-
-Wed Dec 4 10:14:17 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * aoutf1.h (sunos_<size>_object_p, sunos4_callback): moved the
- computation of arch and machine type so it's worked out before
- some_aout_object_p is called.
- * aoutx.h: (some_aout_object_p): don't set arch and mach to
- unknown.
- * archures.c: add extra field 'section_align_power' to hold
- default section alignment in object files.
- * cpu-a29k.c, cpu-h8300.c, cpu-i386.c, cpu-i960.c, cpu-m68k.c,
- cpu-m88k.c, cpu-mips.c, cpu-rs6000.c, cpu-sparc.c, cpu-vax.c:
- initialize the new field.
- * bout.c (b_out_callback): replace the text size, since aout
- fries them.
- * aoutx.h: Documentation in the new style
-
-Wed Dec 4 02:00:30 1991 John Gilmore (gnu at cygnus.com)
-
- * bfd.c (bfd_get_mtime): Don't cache mtime any more; only
- use the saved value if mtime_set is already set (intended
- for archive files, though apparently not used yet).
-
-Tue Dec 3 22:54:50 1991 John Gilmore (gnu at cygnus.com)
-
- * targets.c: Revise comments about how to configure the target
- vector, to match reality. Remove mention of obsolete methods.
- Remove long lists of capitalized macros that turn into the same
- thing in lowercase. Normal vector simply lists all known
- lowercase xvec names; all other cases are handled by SELECT_VECS.
-
- * config/mt-i386-coff: Set DEFAULT_VECTOR to real identifier,
- not macro name.
-
- * config/mt-i960-{coff,bout}: Use SELECT_VECS to make a short
- list of supported targets.
-
-Tue Dec 3 14:06:15 1991 Per Bothner (bothner at cygnus.com)
-
- * archive.c (bsd_write_armap): The pad byte sometimes added to
- the string table in a __.SYMDEF member is now
- counted as part of the size of the string table.
- This is compatible with the old ranlib, as well as Sun's.
-
-Tue Dec 3 10:53:30 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * srec.c: Rewrote to fix many bugs; now gets the record type
- right, doesn't choke on input, sets the start address in an S9 and
- fills in the filename on an S0.
-
-Sat Nov 30 21:19:15 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * cpu-h8300.c: Add support for MEMIND addressing mode
-
- * coff-a29k.c: defined RELOC_PROCESSING to take the #ifdef out of
- coffcode.h
- * coffcode.h: use the new macro if available
-
- * elf.c (elf_corefile_note): cast malloc to avoid warning.
- * Makefile.in: Fixed dependencies due to file rename
-
- * aout-encap.c, aoutf1.h, aoutx.h, archive.c, bout.c, coff-a29k.c,
- coff-h8300.c, coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c,
- coff-mips.c, coff-rs6000.c, cpu-h300.c, elf.c, i386aout.c,
- newsos3.c, stab-syms.c, syms.c: All these files have had their
- #includes altered to point to the new places.
-
-Fri Nov 29 20:04:49 1991 Fred Fish (fnf at cygnus.com)
-
- * config/mh-i386v4, config/mh-i386-elf, hosts/h-i386v4.h: New files.
-
- * configure.in: Add vendor "ncr" as supported per-target vendor.
- Add svr4 case for i386 per-host case.
-
- * elf.c (elf_object_p, elf_core_file_p): Add missing "break" to
- ELFDATA2LSB cases.
-
-Fri Nov 29 12:16:51 1991 Per Bothner (bothner at cygnus.com)
-
- * syms.c (bfd_decode_symclass): Return 'A'
- for symbols that are both absolute and global.
- * archive.c (bfd_special_undocumented_glue): Return NULL
- if bfd_ar_hdr_from_filesystem returns NULL.
-
-Tue Nov 26 09:10:55 1991 Steve Chamberlain (sac at cygnus.com)
-
- * Makefile.in: added coff-h8300
- * configure.in: now h8 is a coff target
- * cpu-h8300.c: fix various disassembly problems
- * libcoff.h: took out some code which has been #0ed for a long
- time.
- * targets.c: added h8 coff
- * coff-a29k.c, coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c
- added new macro RTYPE2HOWTO to take a load of #ifdefs out of
- coffcode.h
- * coffcode.h: Started to change the way machine dependencies are
- handled, from the nest of #ifdefs to macros defined in the
- including coff-<foo>.c
-
-Fri Nov 22 08:11:42 1991 John Gilmore (gnu at cygnus.com)
-
- * aoutx.h (some_aout_object_p): Set the `executable' bit
- if the entry point is contained in the text segment, even if the
- text segment is at location 0.
-
- * coff-mips.c, coffcode.h: Peter Schauer's patch to kludge in
- nonstandard MIPS sections (.rdata, .sdata, etc).
-
- * aoutx.h, bfd.c, coffcode.h, ieee.c, oasys.c, targets.c: CONST lint.
- * libbfd-in.h, libbfd.h, aoutx.h, coffcode.h, elf.c, libaout.h:
- Rename ALIGN to BFD_ALIGN to avoid conflict with BSD <sys/param.h>.
- * libbfd.c: Lint.
- * host-aout.c, trad-core.c: Fix write_armap prototypes. Lint.
-
-Thu Nov 21 19:56:40 1991 Per Bothner (bothner at cygnus.com)
-
- * stab-syms.c, syms.c: Moved bfd_stab_name() and bfd_stab_names[]
- from syms.c to new file stab-syms.c. Also, since GNU extended
- type codes such as N_SETT are no longer in ../include/stab.def,
- include them manually.
- * stab-syms.c, aoutx.h: Renamed bfd_stab_name() and
- bfd_stab_names[] to aout_stab_name() and aout_stab_names[].
- * libaout.h: Added prototype for aout_stab_name().
- * Makefile.in: Update Makefile for new stab-syms.[co].
-
-Thu Nov 21 11:50:49 1991 John Gilmore (gnu at cygnus.com)
-
- * libaout.h (WORK_OUT_FILE_POSITIONS): One more try at this
- rather complicated seeming problem. Eliminate LOGICAL_ versions,
- just make N_XXX work by excluding the header from the text segment.
- * aoutx.h: Fix comments to match.
-
-Tue Nov 19 18:49:01 1991 Per Bothner (bothner at cygnus.com)
-
- * libaout.h (WORK_OUT_FILE_POSITIONS): Use new LOGICAL_TXTADDR,
- LOGICAL_TXTOFF, LOGICAL_TXTSIZE macros to figure out numbers
- for the "logical" text segment (i.e. never consider the exec
- header to be part of the text segment). This change is
- needed for consistency with various other parts of bfd and ld.
- * aoutx.h (NAME(aout,soe_aout_object_p)): Fix comment,
- and move calculation of obj_textsec(abfd)->size to libaout.h.
- * bfd-in.h: Removed bogus ';'.
-
- * Makefile.in: Add MINIMIZE flag to select lean
- or bloated target_vector.
- * targets.c: Use new MINIMIZE macro, and add trad_core if needed.
- * newsos3.c: Fixes to ../include/aout64.h remove need
- for special N_TXTOFF macro, but require N_HEADER_IN_TEXT.
-
-Mon Nov 18 12:00:59 1991 Per Bothner (bothner at cygnus.com)
-
- * aout-target.h, aoutf1.h, newsos3.c: Make aout-target.h
- handle both little and big-endian targets, with little
- the default unless TARGET_IS_BIG_ENDIAN_P is defined.
- * host-aout.c: Add FIXME note.
-
-Sun Nov 17 13:29:39 1991 Per Bothner (bothner at cygnus.com)
-
- * targets.c: Make the default target_vector contain
- just &DEFAULT_VECTOR. This makes executables a lot smaller.
- Old behavior can be gotten by defining ALL_TARGETS.
- * aoutf1.h, demo64.c, i386aout.c, newsos3.c, sunos.c:
- Factored out common code into new file aout-target.h.
- Saves a lot of duplicate code for a.out variants.
-
-Fri Nov 15 13:00:43 1991 Per Bothner (bothner at cygnus.com)
-
- Get 'make headers' to work when configured with +subdirs.
- * Makefile.in: Add $(subdir) to docdir path.
- * doc/Makefile.in (protos): Add $(srcdir) prefix
- to name of sed scripts.
-
-Thu Nov 14 19:49:10 1991 Per Bothner (bothner at cygnus.com)
-
- * aoutx.h (NAME(aout,print_symbol)): Fix thinko.
- * syms.c (bfd_stab_names): Turn on new GNU_EXTRA_STABS macro
- to include names of N_SETT etc.
-
-Thu Nov 14 19:11:13 1991 Fred Fish (fnf at cygnus.com)
-
- * elf.c: Add minimal support for ELF symbol tables. Generates
- canonical bfd symbol tables from ELF symbol tables. Change the
- name of some functions from bfd_<name> to elf_<name>.
-
- * syms.c: Trivial fix to comment to remove a redundant "to".
-
-Wed Nov 13 17:02:01 1991 John Gilmore (gnu at cygnus.com)
-
- * coff-{i386,m68k,m88k}.c: Change name of file format to standard
- form that GDB recognizes as COFF.
-
-Wed Nov 13 09:09:41 1991 Steve Chamberlain (sac at cygnus.com)
-
- * ieee.c (ieee_object_p): cast NULL correctly.
- * configure.in: added harris host
-
- * coff-a29k.c: Lots of changes, most from David Wood.
-
-Tue Nov 12 07:21:41 1991 John Gilmore (gnu at cygnus.com)
-
- * coff-m88k.c (coff_write_armap): Just #undef it.
-
-Mon Nov 11 20:30:18 1991 Steve Chamberlain (sac at cygnus.com)
-
- * Makefile.in: standardize on MINUS_G to disable debugging
- * coff-m88k.c: create coff armaps instead of bsd ones.
- * opncls.c (bfd_close_all_done), (bfd_close): Mask out random bits
- when calling chmod.
-
-Mon Nov 11 19:07:32 1991 Fred Fish (fnf at cygnus.com)
-
- * elf.c: Additions to support ELF format core files.
- * config/mh-amix: Add -DHAVE_PROCFS to HDEFINES, since host
- has support for /proc (all the include files in particular).
-
-Mon Nov 11 18:36:47 1991 Per Bothner (bothner at cygnus.com)
-
- * aoutx.h (NAME(aout,find_nearest_line)): Handle the case
- of two N_SO stabs, one for directory, and one for filename.
-
- * bfd-in.h (print_vma): Factor out duplicate definition.
-
- Exit a little more gracefully when malloc returns NULL.
- * libbfd.c: New function bfd_xmalloc (malloc wrapper).
- * opncls.c, syms.c, bout.c, aoutx.h: Replace malloc by bfd_xmalloc.
- * libbfd.h: Rre-generated due to libbfd.c update.
-
-Sat Nov 9 13:45:01 1991 Fred Fish (fnf at cygnus.com)
-
- * config/mt-m68k-elf: Define DEFAULT_VECTOR as elf_big_vec.
-
- * elf.c (elf_object_p): Don't try to create a bfd section for
- the first ELF section header. It is just a placeholder.
-
-Sat Nov 9 03:04:26 1991 John Gilmore (gnu at cygnus.com)
-
- * coff-rs6000.c, config/mh-rs6000: Make it work on archive and
- core files, when compiling native.
- * hosts/h-rs6000.h: Define FASCIST_FDOPEN for bfd_fdopenr.
-
- FIXME: The aoutf1.h change below needs to be reversed back
- to the way it was.
-
-Thu Nov 7 11:03:55 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * coffcode.h: Defined new macros [PUT|GET]LINENO_LNNO for
- manipulation of lnno fields in lineno structs in a coff-<f>.h
- independent way. Override it in coff-<f>.h to your favourite
- number if you don't have a 16bit lnno field. (coff_swap_lineno_in)
- (coff_swap_lineno_out): modified to use the new macros.
-
-Mon Nov 4 11:38:33 1991 Steve Chamberlain (sac at cygnus.com)
-
- * aoutf1.h (sunos4_callback): Now defaults to 68020 rather than
- unknown arch when the magic number doesn't specify the
- architecture, since some OSs (eg old sun3s) don't set the number, and
- 020 is probably the right answer anyway.
-
-Sun Nov 3 12:07:08 1991 Per Bothner (bothner at cygnus.com)
-
- * hosts/h-news.h, hosts/h-rtbsd.h:
- Get rid of MISSING_VFPRINTF, since libiberty provides one.
- * bfd-in.h (bfd_print_symbol_type_hopw enum): Add new option
- bfd_print_symbol_nm, for use by nm.
- * aoutx.h (NAME(aout,print_symbol)): Add code for new
- bfd_print_symbol_nm option, to print in nm format.
- * coffcode.h (coff_print_symbol), ieee.c (ieee_print_symbol)
- oasys.c (oasys_print_symbol): Provide stub implementations
- for bfd_print_symbol_nm.
- * syms.c: New function bfd_decode_symclass, used by nm printer.
- New function bfd_stab_name to look up string name of stab code.
-
-Sat Nov 2 14:26:03 1991 Steve Chamberlain (steve at cygnus.com)
-
- * Makefile.in: Added ctor.c
- * archures.c (bfd_default_arch_struct) added
- bfd_default_reloc_type_lookup.
- * coffcode.h: removed a load of #if 0ed code.
- (coff_compute_file_section_positions): now works out the section
- alignment and size correctly in all cases.
- (coff_get_symtab): looks for constructor symbols and calls the
- right function when they're found. (coff_canonicalize_reloc):
- knows when a section is full of constructors and does the right
- thing.
- * cpu-m88k.c: Added default_reloc_type lookup to the architecture
- description.
- * libbfd-in.h: (bfd_default_reloc_type_lookup) defun added.
- * libcoff.h: removed #if 0ed code
- * reloc.c: (bfd_reloc_code_real_type) added BFD_RELOC_CTOR for
- arch independent constructor relocation type.
- (bfd_reloc_type_lookup): removed the comment "this will go away"
- since it won't. (bfd_howto_32): stolen from 88k, this is a 32bit
- reloc which is used when BFD_RELOC_CTOR falls through to give a
- default 32bit reloc for constructors.
- (bfd_default_reloc_type_lookup): added.
- * aoutf1.h: fixed SEGMENT_SIZE typo.
-
-Thu Oct 31 18:23:06 1991 John Gilmore (gnu at cygnus.com)
-
- * coff-rs6000.c: Change name to "aixcoff-rs6000", to avoid
- matching prefix "coff".
- * coffcode.h (coff_swap_aux_in, coff_swap_aux_out): Handle
- rs/6000 csect records.
-
-Sun Oct 27 16:56:58 1991 Steve Chamberlain (steve at cygnus.com)
-
- * coff-m88k.c, targets.c: change name of m88k_bcs to m88kbcs
- * configure.in: add motorola delta88 cases
- * libbfd.h, libbfd-in.h, archive.c, ieee.c, elf.c, srec.c: fix
- write_armap prototype
- * libbfd.c: add doc on bfd_write_bigendian_4byte_int
-
-Fri Oct 25 02:48:19 1991 John Gilmore (gnu at cygnus.com)
-
- * Rename COFF-related files in `coff-ARCH.c' form.
- coff-a29k.c, coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c,
- coff-mips.c, coff-rs6000.c to be exact.
-
- * Makefile.in: Only supply TARGET_DEFAULTS to targets.c, reducing
- make output clutter.
- * config/mt-*: Ditto.
-
-Thu Oct 24 22:40:07 1991 John Gilmore (gnu at cygnus.com)
-
- RS/6000 support, by Metin G. Ozisik, Mimi Phûông-Thåo Võ, and
- John Gilmore. Archive support from Damon A. Permezel.
-
- * Makefile.in: Add cpu-rs6000.c and rs6000coff.c.
- * configure.in: Add rs6000 case.
- * targets.c: Add rs6000 vector.
- * archures.c: Add rs6000, fix comment on romp.
- * bfd-in.h (enum bfd_error): Add no_debug_section error.
- * libcoff-in.h (struct coff_tdata): Remove unused string_table.
- * bfd.c (bfd_errmsgs): Add no_debug_section error message.
- * section.c (bfd_make_section): Return NULL on attempt to create
- a section twice.
- * coffcode.h (bfd_swap_reloc_in): Handle r_type and r_size.
- (bfd_swap_aouthdr_in): Handle lots more members.
- (make_a_section_from_file): If section has already been seen,
- just return false rather than overwriting it.
- (coff_real_object_p): Understand incoming magic numbers.
- (coff_set_flags): Understand outgoing magic numbers.
- (coff_compute_section_file_positions): outgoing aouthdr magic #.
- (build_debug_section): Add fn for reading debug string section.
- (get_normalized_symtab): Handle symbol names in debug string section.
- Remove unused obj_string_table.
- (coff_slurp_symbol_table): Handle rs6000-specific storage classes.
- * aoutx.h (translate_from_native_sym_flags, N_SET*): Check for
- existing section before making one.
- * cpu-rs6000.c: New file.
- * rs6000coff.c: New file.
-
-Thu Oct 24 02:03:24 1991 Fred Fish (fnf at cygnus.com)
-
- * elf.c: Add partial support for ELF format corefiles. Still needs
- support for extracting registers from corefiles.
-
- * config/t-m68k-elf: Set DEFAULT_VECTOR to elf_big_vec.
-
- * config/{h-amix,h-dgux,h-irix3,h-ultra3}: For systems where
- RANLIB is defined as echo, send the output to /dev/null to help
- reduce clutter in the output from doing a make.
-
-Mon Oct 21 17:48:48 1991 John Gilmore (gnu at cygnus.com)
-
- * hosts/h-vaxult.h: Remove malloc/free decls covered in stdlib.h.
- Fix HOST_PAGE_SIZE and HOST_SEGMENT_SIZE. From David Taylor.
-
-Mon Oct 21 09:34:11 1991 Steve Chamberlain (steve at rtl.cygnus.com)
-
- * coffcode.h (coff_compute_section_file_positions): make it pad
- section size out if there are alignment restrictions so that the
- image will be ok on a system where section positions are worked
- out by accumulating sizes rather than from the section headers.
- * targets.c (proto write_armap). Changed orl_count to unsigned.
- * opncls.c (bfd_close_all_done). Added so that generative
- programs like gas can close a bfd without causing bfd confusion.
- * libbfd.h (changed becuase of protos)
- * amdcoff.c: messed with the way that jmp displacements are
- calcualated. This may not yet be totally correct.
- * archive.c (coff_write_armap): rewrote the way that ranlibs are
- written out.
- * coffcode.h (fixup_symbol_value): now doesn't core dump if a non
- abs symbol has no section (like a register symbol).
- (coff_write_symbol) now zeros auxent before filling it up to help
- with sensitive applications.
- * libbfd.c (bfd_write_bigendian_4byte_int): added.
-
-Wed Oct 16 22:58:45 1991 John Gilmore (gnu at cygnus.com)
-
- * bfd.c: Make sure we don't get a macro strerror().
- * opncls.c (bfd_fdopenr): If FASCIST_FDOPEN, use "r", not "r+".
- * trad-core.c (trad_unix_core_file_failing_command): Suppress
- attempt to recover command, ifdef NO_CORE_COMMAND.
- * hosts/h-tahoe.h: Add FASCIST_FDOPEN and NO_CORE_COMMAND;
- revamp HOST_*, etc.
- * hosts/h-i386v.h: Use <utime.h>, not <sys/utime.h>, unlike POSIX.
-
-Wed Oct 16 12:43:49 1991 Per Bothner (bothner at cygnus.com)
-
- * archive.c (bsd_write_argmap): The size of the ranlib structures
- should not include the size field itself.
- * aoutx.h, libaout.h (NAME(aout, sizeof_headers)): Use
- adata(abfd)->exec_bytes_size field instead of constant macro,
- because aoutx.h compiles to a simple .o file shared by
- all 32-bits a.out targets.
-
-Wed Oct 16 11:11:05 1991 John Gilmore (gnu at cygnus.com)
-
- * configure.in: Allow i386-sco-sysv.
- * bout.c: Remove unused i960_align; lint dummy core file handlers.
- * cpu-h8300.c: lint.
-
- * host-aout.c: New strategy. We use common code, include files,
- and data structures to handle the file, but set a few parameters
- from the host's config file (page size, text start addr, etc).
- * libaout.h: Define HP BSD machine types.
- * aoutf1.h: Handle reading a.outs with these types.
-
- * trad-core.c: Pass the u.u_ar0 value as the negative of the
- virtual-memory-address of the .reg section. We can't just make a
- section for "all the regs and nothing else" because only GDB knows
- exactly where the regs are (scattered around the upage and stack).
- Clean up memory allocation. Remove big- and little-endian
- vectors, replace with single vector; this only runs on the host,
- in host byte order. Replace byteswap routines with aborts in case
- anyone calls them.
- * targets.c: There's only one trad_core_vec now.
- * aoutf1.h (sunos_core_file_p): VMA of .reg* now needs to be 0.
-
-Tue Oct 15 08:29:03 1991 John Gilmore (gnu at cygnus.com)
-
- * hosts/h-amix.h (free): Fix prototype.
-
- * aoutx.h: Don't use NULL as an integer, for braindead systems
- that declare it as (void *)0. (From Peter Schauer.)
-
-Mon Oct 14 17:20:47 1991 Per Bothner (bothner at cygnus.com)
-
- * opncls.c (bfd_fdopenr): Add parentheses to avoid reported
- problem with bad Ultrix system headers.
- * aoutx.h (NAME(aout,set_section_contents)): Try to handle the
- various kinds of alignments for the various kinds of
- magic numbers.
-
-Mon Oct 14 14:23:10 1991 John Gilmore (gnu at cygnus.com)
-
- * doc/Makefile: Don't assume . is on the path (from James Clark).
-
-Fri Oct 11 22:45:14 1991 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in: Avoid Sun Make VPATH bugs.
- * targets.c: Declare trad_core vectors extern.
-
-Fri Oct 11 13:03:02 1991 Per Bothner (bothner at cygnus.com)
-
- * coffcode.h: Moved ALIGN macro to libbfd.h. Removed i960_align.
- * libbfd.h: Moved ALIGN macro here.
- * bout.c (b_out_callback): Replace i960_align by align_power.
-
- * libaout.h (struct aoutdata): Added fields page_size,
- segment_size and exec_bytes_size. These help generic code
- (in aoutx.h and libaout.h) to figure out where to align
- the various segments in a demand paged file.
- * libaout.h (WRITE_HEADER): Use new (struct aoutdata) fields
- to decide if the exec header counts in a_text (text segment size).
- Also, assume D_PAGED flag is set; don't set it here.
- * bout.c (b_out_callback): Add initialization of
- adata fields page_size, segment_size, and exec_bytes_size.
- * host-aout.c (NAME(host_aout, callback) and
- NAME(host_aout,mkobject): Ditto.
- * i386aout.c (aout386_callback) and new aout386_mkobject): Ditto.
- * newsos3.c (newsos3_callback) and new newsos_mkobject): Ditto.
- * aoutf1.c (sunos4_callback) and new sunos_mkobject): Ditto.
- * aoutx.h (NAME(aout,some_aout_object_p)): Don't subtract
- EXEC_BYTES_SIZE from the a_test size; this is only appropriate
- for some systems (mainly sunos), so do it in the callback instead.
- Same routine: Add stuff to the THIS_IS_ONLY_DOCUMENTATION comment.
- * aoutx.h (NAME(aout,set_section_contents): Change the way
- filepos and size of sections are carried out to support
- older styles of demand paged executables.
-
-
-Fri Oct 11 12:33:36 1991 Steve Chamberlain (steve at cygnus.com)
-
- * bfd-in.h: Added more macros to COFF_SWAP_TABLE.
- * bfd.c: Added macros to enable gas to swap coff records.
- * coffcode.h: Make the coff_swap_*_out routines return the number
- of bytes swapped, and cleaned up their prototypes.
- * configure.in: Added ebmon/coff support
- * ecoff.c: Changed null definitions of coff_swap_*_out to conform
- to new prototypes
- * targets.c: Added new entry points for coff swapping
-
-Fri Oct 11 03:01:52 1991 John Gilmore (gnu at cygnus.com)
-
- Restructure configuration scheme for bfd, binutils, ld.
-
- * include/sys/h-*.h: Move to bfd/hosts/h-*.h.
- * configure.in: Revise to symlink sysdep.h to hosts/h-xxx.h.
- Change some config names to match other dirs.
- * *.c: Include bfd.h before sysdep.h, so ansidecl and PROTO()
- get defined first.
- * Makefile.in: Use -I. to get sysdep.h. Remove refs to
- ../include/sysdep.h.
- * cpu-i960.c: Strncmp needed a length arg.
- * ecoff.c: Don't ever call trad_unix_core_file_p from here.
- * i386aout.c: Remove dead N_TXTOFF override.
- * trad-core.c: Don't disable the whole file if SUN4_SYS.
- * config/: Rename some config files to match up h-*.h names.
- Remove all the HOST_SYS definitions from the config files.
- * hosts/h-amix.h, h-i386v.h: Define POSIX_UTIME, not USG.
- * hosts/h-hp9000.h: Remove USG comment.
- * hosts/h-rs6000.h: Include <stdlib.h> for malloc.
- * hosts/h-news.h, h-sparc-64.h: New config files that had
- previously been kludged in the <sysdep.h> file.
-
-Thu Oct 10 17:54:08 1991 John Gilmore (gnu at cygnus.com)
-
- * config/*: trad-core support is HOST dependent, not target
- dependent. Target config files only set DEFAULT_VECTOR and/or
- other vector elements. Exception: when host-aout.c is in use,
- in which case we're forced to assume we're native (hp, vax,
- tahoe). Rename XDEPFILES to HDEPFILES.
- * Makefile.in: Rename XDEPFILES.
- * config/h-sun*: Don't force static linking.
- * trad-core.c: Document how to use it nowadays.
- * i386aout.c, newsos3.c: Clean up.
- * i386coff.c: Allow 386 coff files to be used as core files too
- (for reading core files from embedded systems).
-
-Tue Oct 8 15:30:39 1991 John Gilmore (gnu at cygnus.com)
-
- * Add i386aout.c for a.out support on the i386.
-
-Tue Oct 8 12:18:54 1991 Roland H. Pesch (pesch at cygnus.com)
-
- * reloc.c, section.c, syms.c, targets.c: correct info-node
- structure in *doc* comments.
- doc/Makefile: stop hiding complaints from makeinfo.
-
-Sun Oct 6 19:10:06 1991 John Gilmore (gnu at cygnus.com)
-
- * aoutx.h (...some_aout_object_p): Take a third parameter,
- the internal_exec struct, and avoid ever looking at an
- external_exec. All callers changed to read the entire
- external_exec struct, swap and check its magic number,
- swap in the whole structure, and pass the swapped-in version to
- some_aout_object_p.
- * bout.c: Bring into modern era. Use single _object_p routine
- for big- aand little-endian. Provide internal and external
- exec header structs. Use separate swap-in and swap-out routines.
-
- * libaout.h: Move struct internal_exec from ../include/aout64.h
- to here. Add obj_symbol_entry_size to struct aoutdata.
- * aoutx.h (...some_aout_object_p): Set obj_symbol_entry_size.
-
- * ../include/aout64.h: Change EXTERNAL_LIST_SIZE to
- EXTERNAL_NLIST_SIZE. Callers changed.
-
-Fri Oct 4 18:18:46 1991 John Gilmore (gnu at cygnus.com)
-
- * bfd.c: Remove strerror() to libiberty.
-
- * elf.c: Remove elf_set_section_contents, use generic one. Lint.
- * libbfd-in.h, libbfd.c: Add bfd_generic_set_section_contents.
- * libbfd.c (bfd_generic_{get,set}_section_contents): Check that
- last byte of transfer, not first byte, is within the section.
-
- * host-aout.c: Remove `BSD' archive support. Lint.
-
- * archures.c: Rename `struct bfd_arch_info_struct' to `struct
- bfd_arch_info'. Rename `typedef bfd_arch_info_struct_type' to
- `bfd_arch_info_type'. All uses changed.
- * reloc.c: Rename `bfd_reloc_status_enum_type' to
- `bfd_reloc_status_type'. Rename `bfd_reloc_code_enum_real_type'
- to `bfd_reloc_code_real_type'. (This seems to be a misnomer,
- it needs a better name.) All uses changed.
- * targets.c: Rename `enum target_flavour_enum' to `enum
- target_flavour', and remove the `_enum' from all of the enum
- values themselves. All uses changed.
-
- * configure.in, config/h-i386mach: i386 mach host.
- * config/t-i386-aout: Use host-aout.c.
-
- * trad-core.c: Give it its own xvec's to make it independent
- of other file formats.
- * ecoff.c, host-aout.c: Remove refs to trad-core.
- * config/t-dec3100, t-hp300bsd, t-tahoe, t-vax: Define TRAD_CORE.
- * targets.c: #ifdef TRAD_CORE, include it in the vector.
-
-Fri Oct 4 17:38:03 1991 Steve Chamberlain (steve at cygnus.com)
-
- * reloc.c: Extended NEWHOWTO macro
- * ieee.c: Changed the way 8bit pcrel is done
- * cpu-h8300.c: got the registers in the right order
-
-Thu Oct 3 19:39:55 1991 John Gilmore (gnu at cygnus.com)
-
- * bfd-in.h: enum boolean => enum bfd_boolean for SVR4. Gumby's
- prediction is vindicated!
-
- * bfd-in.h, libbfd-in.h, doc/Makefile, doc/tolibbfd, doc/intobfd:
- Remove refs to howto.c, since Steve forgot.
-
-Thu Oct 3 07:49:21 1991 Steve Chamberlain (steve at cygnus.com)
-
- * elf.c: took the abort out of set_arch_mach so that objdump -i will
- still work. Now allows any architecture/machine to be set.
-
-Wed Oct 2 13:50:35 1991 Steve Chamberlain (steve at cygnus.com)
-
- * howto.c deleted and moved code to reloc.c
-
- * libbfd.h, libbfd-in.h removed $id stuff for real
-
- * cpu-h8300.c Made it match various different spellings of h8300.
-
- * archures.c: Took out the first char filter which made it only
- look for a cpu/arch match when the first chars of supplied and
- tested names were the same.
-
- * targets.c removed oasys stuff, pending someone to fix the bugs
- in it.
-
-
-Tue Oct 1 12:29:44 1991 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in, configure.in, targets.c, elf.c: Add preliminary
- ELF support good enough for GDB.
- * configure.in, config/h-amix, config/t-m68k-elf: Handle
- m68k-cbm-svr4 host and target.
- * config/t-m68k-coff, t-m88k-coff, t-m88k-aout: Make files nonempty
- so `diff' and `patch' can cope.
-
-Tue Oct 1 11:24:31 1991 Steve Chamberlain (steve at cygnus.com)
-
- * archures.c: removed texinfo error
-
- * init.c: added texinfo hooks, and removed initialization error
- message.
-
- * libcoff-in.h, libbfd-in.h removed $id field so cvs can merge
- without complaints.
-
-Tue Oct 1 05:02:53 1991 John Gilmore (gnu at cygnus.com)
-
- * cpu-i960.c: Avoid numerical count of initializers.
-
- Vax Ultrix changes from David Taylor <taylor@think.com>:
- * host-aout.c: Make little-endian vector really little-endian.
- * configure.in: Separate vax and tahoe cases, handle ultrix.
- * config/t-vax: Add trad-core.o.
- * config/h-vaxult: New host system.
-
-Mon Sep 30 15:13:46 1991 Steve Chamberlain (steve at cygnus.com)
-
- * bfd-in.h VERSION, change version number to 0.18, this makes a
- gap, but now is the same as the linker version number.
-
- * cpu-a29k.c, cpu-i386.c, cpu-m68k.c, cpu-mips.c, cpu-vax.c,
- cpu-h8300.c, cpu-i960.c, cpu-m88k.c, cpu-sparc.c: added. These
- files will eventually contain processor specific bits for bfd,
- like strange relocation information and dis/assembly. So far only
- the H8 has been even partially done. This work also ties in with
- the change in handling architectures.
-
- * amdcoff.c: (a29k_reloc) fix error message.
-
- * aout-f1.h: (choose_reloc_size) now calls bfd_get_arch to
- discover the architecture of the bfd. (sunos4_callback) calls the
- function bfd_set_arch_mach rather than stuffing stuff directly
- into the bfd. (sunos4_write_object_contents), changed names of
- accessor functions.
-
- * aoutx.h: (set_arch_mach) now calls bfd_default_set_arch_mach to
- setup the environment.
-
- * archive.c: (bfd_slurp_coff_armap) coff archives always have the
- headers in big endian format, regardless of the endianess of the
- host or target.
-
- * archures.c: totally changed. Now an architecture is represented
- with a pointer to an info structure rather than an enumerated type
- and a long. The old info is available as two elements in the
- structure. Future enhancements to architecure support will
- involve pointers to methods being placed into the info structure.
-
- * bfd.c: changed the definition of the bfd structure for the new
- architecture stuff.
-
- * bout.c: (b_out_set_arch_mach) changed to use the new
- architecture mechanism.
-
- * coffcode.h: (coff_set_arch_mach, coff_set_flags) changed to use
- the new architecture mechanism.
-
- * configure.in: added h8 stuff.
-
- * ieee.c: too many changes to note. Now ieee files written with
- bfd gas and ld can be read by gld and ieee only linkers and
- simulators.
-
- * libbfd.c, libbfd.h: changed prototype of bfd_write.
-
- * newsos3.c: (newos3_callback) now calls bfd_set_arch_mach rather
- than fixing the structure directly.
-
- * oasys.c: (oasys_object_p) now calls bfd_default_set_arch_mach rather
- than fixing the structure directly.
-
- * opncls.c: (new_bfd) makes sure that bfd_init has been called
- before opening a bfd.
-
- * srec.c: (srec_set_arch_mach) now calls bfd_default_set_arch_mach
- rather than fixing the structure directly.
-
- * targets.c: (target_vector) now by defining SELECT_VECS (perhaps
- in the t/hmake file) a user can select which backends they want
- linked with bfd without changing the source.
-
- * init.c: new, looks after initializing modules.
-
- * howto.c: for future use, will allow an application to work out
- what cookie to use as a handle on a relcoatio howto.
-
-Mon Sep 30 13:31:15 1991 John Gilmore (gnu at cygnus.com)
-
- * srec.c: Better error checking, partly from Peter Schauer.
- (srec_object_p): Avoid assuming any file that starts with 'S' is
- an S-record file! (Check for 3 uppercase-hex digits after it.)
- (ISHEX): Define new macro for checking supposedly hex characters.
- (pass_over): Treat as EOF any S-record line that:
- * doesn't have hex in either size character
- * produces a size larger than 0x7F
- * has an unrecognized type number
-
-Thu Sep 26 15:27:29 1991 John Gilmore (gnu at cygnus.com)
-
- * aoutf1.h, aoutx.h, bout.c, coffcode.h, host-aout.c, oasys.c,
- opncls.c: Lint (saber actually).
-
-Thu Sep 26 11:24:24 1991 Per Bothner (bothner at cygnus.com)
-
- * libaout.h (WRITE_HEADERS): Set header's a_text field always.
- * newsos3.c: Fixed two types: newos3 -> newsos3.
- * reloc.c (bfd_perform_relocation): Fix pc-relative relocation
- to use correct segment.
-
-Mon Sep 23 18:24:34 1991 Per Bothner (bothner at cygnus.com)
-
- * aoutx.h (print_symbol): Handle missing symbol->name.
-
-Fri Sep 20 12:26:01 1991 Stu Grossman (grossman at cygnus.com)
-
- * aoutf1.h (swapcore_sparc): Change name of USRSTACK, fix comment
- at top of routine.
-
-Tue Sep 17 17:23:49 1991 Stu Grossman (grossman at cygnus.com)
-
- * oasys.c, configure.in, config/h-irix3, config/t-irix3:
- add sgi/irix support.
-
-Thu Sep 12 14:29:09 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- Changes for the AMD 29000 Ultracomputer port from David Wood.
- (wood@nyu.edu).
-
- * opncls.c (bfd_fdopenr): Handle NO_FCNTL.
-
- * Makefile.in: Make subdirs work by using $(INCDIR) in the
- crude dependencies.
-
- * coffcode.h (coff_real_object_p): Pass information about the
- current file's coff symbol format to BFD via the coff_data struct.
- (coff_find_nearest_line): obj_icof => coff_data.
- (coff_swap_sym_{in,out}): Check that SYMNMLEN == E_SYMNMLEN.
- (coff_swap_aux_{in,out}): Check that FILNMLEN == E_FILNMLEN
- and DIMNUM == E_DIMNUM.
- * configure.in: Handle a29k-*-* hosts, and targets
- a29k-*-coff, a29k-*-aout, and a29k-*-sym1.
- * libcoff-in.h: Add local_n_btmask, local_n_btshft,
- local_n_tmask, local_n_tshift, local_symesz, local_auxesz,
- local_linesz to `coff_data' (tdata) struct.
- (coff_data, coff_data_type, coff_tdata): Rename struct icofdata.
- * config/h-ultra3: Handle a29k-*-* hosts as Ultracomputers.
-
-Thu Sep 12 14:07:22 1991 Roland H. Pesch (pesch at cygint.cygnus.com)
-
- * Makefile.in: $(MAKE) for make, $(docdir) for doc
- * doc/Makefile: redundant dependencies for Sun-make VPATH bug
-
-Tue Sep 10 20:34:12 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * aoutf1.h (sunos4_core_file_p): Release the right storage in
- error case.
- (sunos4_core_file_matches_executable_p): Fix header comparison.
- * aoutx.h: Avoid shifts of 32 bits, undefined in C. Lint.
- * bout.c, icoff.c, ieee.c, libbfd.c, oasys.c: gcc -O -W lint.
-
-Wed Sep 4 00:44:52 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- Allow GDB to patch object files.
-
- * aoutf1.h (sunos_core_file_p): Set SEC_HAS_CONTENTS on all sections.
- * trad-core.h (trad_unix_core_file_p): Ditto.
- * aoutx.h (aout_set_section_contents): On first output, check
- abfd->direction and complain if erroneous.
-
- * Makefile.in: Add crude dependencies.
-
-Tue Sep 3 13:46:19 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * config/* aoutx.h configure* shortened all the h/tmake-xxxx
- to h/t-xxxx files so that everything will work on System V.
-
-Fri Aug 23 13:51:06 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * aoutx.h: Add information on host-aout.c and how to configure
- to use it, to the manual.
- * configure.in: Tix typo.
- * ecoff.c: If compiling for DEC3100, use trad_unix core files,
- else dummy out the core file support.
- * trad-core.c (trad_unix_core_file_p): If HOST_DATA_START_ADDR is
- specified, use it to locate the data section.
- * coffcode.h (coff_write_symbols): Declare buffer as bfd_bytes
- rather than as chars (lint).
-
-Thu Aug 22 22:20:19 1991 Stu Grossman (grossman at cygint.cygnus.com)
-
- * aoutx.h, coffcode.h: saberized.
-
-Thu Aug 22 11:27:06 1991 Roland H. Pesch (pesch at cygint.cygnus.com)
-
- * bfd.texinfo: some cleanup, reincorporated more intro matter from
- bfd.doc
- bfd.c, targets.c: minor rewording of doc segments
-
-
-Wed Aug 21 19:13:22 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * trad-core.c (trad_unix_core_file_p): Use HOST_TEXT_START_ADDR,
- etc, rather than TEXT_START_ADDR.
- * host-aout.c: Remove #if 0 around whole thing.
- Update to modern (32/64-bit) a.out naming conventions.
- Include a large chunk of ../include/a.out.gnu.h to get macros that
- are not defined by the system include files.
- (host_aout_{32,64}_write_object_contents): Use the WRITE_HEADERS
- macro used by the other a.out implementations.
- * Makefile.in: Give dependencies to OPTIONAL_BACKENDS.
-
-Wed Aug 21 14:33:06 1991 Roland H. Pesch (pesch at cygint.cygnus.com)
-
- * Makefile.in: use targets "bfd.dvi" and "bfd.ps" instead of
- texdoc and psdoc; make these depend on generated .texi's
-
- * scanit, (new) unPROTO: turn PROTO macros into ANSI declarations in
- doc
-
- * bfd.c, reloc.c, syms.c: minor spelling/wording fixes in doc
- portions
-
- * Makefile.in, awkscan-ip, awkscan-p, doc/intobfd,
- libbfd.h, libcoff.h, tolibcoff; new bfd-in.h, libbfd-in.h,
- libcoff-in.h: (a) use separate files for invariant parts of bfd.h,
- libbfd.h, and libcoff.h; (b) in generated parts of same, use less
- obtrusive marks indicating .c origins.
-
- * bfd.texinfo: generalize most references to linker
-
-Tue Aug 20 15:18:02 1991 Roland H. Pesch (pesch at cygint.cygnus.com)
-
- * Makefile.in: include core.p in PROTOS (building better bfd.h)
- * archures.c: remove empty foo() definition (crept in at vn1.9)
-
-Mon Aug 19 13:48:22 1991 Roland H. Pesch (pesch at cygint.cygnus.com)
-
- * bfd.texinfo: use @setchapternewpage on instead of lots of
- @page's; minor rephrasing in Introduction.
-
- * aoutx.h, archive.c, archures.c, bfd.c, bfd.texinfo, cache.c,
- coffcode.h, core.c, format.c, ieee.c, libbfd.c, libbfd.h, libcoff.h,
- oasys.c, opncls.c, reloc.c, section.c, syms.c, targets.c (documentation
- segments): used BFD (caps) more consistently as a name in
- discourse, fixed a few other minor typos and uses of fonts
-
-
-Thu Aug 8 16:47:43 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * coffcode.h: fixed bug where string table size wasn't being swapped.
-
-Thu Aug 1 16:35:28 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * section.c: added SEC_CONSTRUCTOR_TEXT|DATA|BSS flags
-
- * syms.c: added BSF_CONSTRUCTOR, BSF_WARNING and BSF_INDIRECT
- flags. (bfd_print_symbol_vandf) now knows what to do with the
- above flags.
-
- * aoutx.h: made translate_from_native_sym_flags and
- translate_to_native_sym_flags produce the above flags.
-
-
-Wed Jul 31 09:53:52 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * all files: update copyright notices for GPL version 2.
- Install header comments and attribute most modules to their
- authors. BFD's name is now officially "Binary File Descriptor",
- so remove any conflicting pejoratives.
- archures.h: Consists solely of comments; remove it.
-
-Fri Jul 26 18:11:34 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * Makefile.in, bfd.c: Made it compile again.
-
-Fri Jul 19 08:17:09 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * newsos3.c, targets.c, coffcode.h: new patches from David Wood
-
-
-Mon Jul 15 16:27:42 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * aoutf1.h archive.c bfd.c coffcode.h core.c ecoff.c ieee.c
- bfd.texinfo oasys.c opncls.c reloc.c srec.c: More documentation on
- lint fixes.
-
- * amdcoff.c bfd.texinfo Makefile.in : Folded in changes for amd
- 29k coff by David Wood (wood@lab.ultra.nyu.edu).
-
-Thu Jul 4 09:53:16 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * core.c: New file.
- * format.c: New file.
- * reloc.c: New file.
- * section.c: New file.
- * syms.c: New filew.
- Cleaned up the rest of the files a bit, and added some
- documentation.
-
-Mon Jul 1 13:29:47 1991 David Wood (wood at david.ultra.nya.edu)
-
- * opncls.c, ../include/sys/h-sun3.h ../include/sys/h-sun4.h: fcntl
- really takes 3 arguments, patched code and ammended prototypes.
-
-Fri Jun 14 13:19:40 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * ../include/bfd.h (struct bfd_target): Added new field
- "align_power_min" which contains the minimum alignment for a
- section. This is used in coff_new_section_hook. The field
- insertion necessitates an update of all backends..
-
- * aoutf1.h jump table field inserted
-
- * archive.c(snarf_ar_hdr)(bfd_slurp_coff_armap) can now parse dgux style extended
- filenames too.
-
- * bout.c(b_out_squirt_out_relocs) fix to assertion tests. Jump
- table field inserted.
-
- * coffcode.h(just about everything) Now patches up symbol tables
- using a different mechanism. The Intel major bug has been fixed,
- and the linker can self host on the Aviion and be debugged with
- gdb.
-
- * ecoff.c: new include and jump table patch, i386coff.c: new
- include and jump table patch, icoff.c: new include and jump table
- patch, ieee.c: can now read archives containing ieee modules.,
- libcoff.h: added (combined_entry_type), libieee.h: uped max
- sections to 20, m68kcoff.c: new include and jump table patch,
- m88kbcs.c: new include and jump table patch, oasys.c: various bugs
- fixed. opncls.c: added bfd_alloc_grow and bfd_alloc_finish.
- srec.c: jump table patch. trad-code.c fixed #IF typeo
-
-Fri Jun 7 12:35:46 1991 Sean Fagan (sef at cygint.cygnus.com)
-
- * coffcode.h (coff_swap_aux_in): added else case to deal with
- filenames less than 9 characters.
-
-
-Thu Jun 6 18:27:38 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * oasys.c (oasys_archive_p): fixed so it works
-
- * srec.c: now allows any number of sections to be created in a
- file. Outputs addresses of the right length.
-
-Thu May 30 15:30:10 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * bfd.c (bfd_check_format): Fixed problem where when a defaulted
- target didn't match, the format got set to the attempted match,
- breaking a future test.
-
- *../include/i386coff.h : fixed typo in type field with size
-
- * i386coff.c icoff.c m88k-bcs.c ecoff.c ../include/bfd.h : Added
- support in the jump table for the swapping routines exported to
- gdb. Now gdb works with the 386.
-
-Tue May 28 17:21:43 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * Merge in changes from gdb-3.95 release.
- Makefile.in: Allow hmake and tmake files to add OFILES.
- aoutf1.h:
- bfd.c: support specific targets as well as searching. When
- searching, take default target in preference to others.
- bfd.doc: typos
- ieee.c, oasys.c: Avoid using the "tdata" macros left of assignment.
- liba.out.h: Don't hard-code file offsets; use N_ macros for them.
- libbfd.h: Support specific targets as well as searching.
- opncls.c: Support specific targets as well as searching.
- targets.c: Search is short-circuited if default target matches.
- liboasys.c, libieee.c: Undo bothner changes that make macros
- work to the left of assignment, but which depend on the
- representations of different pointer types being the same.
-
-Fri May 24 18:56:52 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * i386coff.c: created.
- * coffcode.h: added support for 386.
- * Makefile.in: added support for 386.
- * ../include/i386coff.h: created
-
-Wed May 22 07:26:38 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * coffcode.h: removed all put_x_<sizes>
- * libbfd.c: Changed #ifdef __GNUC__ to #ifdef HOST_64_BIT, Added
- DEFUNS
-
-
-Tue May 21 08:58:58 1991 Steve Chamberlain (steve at cygint.cygnus.com)
- (bothner)
- * opncls.c: Changed obstack_chunk_alloc use xmalloc
-
-Mon May 20 17:12:17 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * everything: Removed sysdep.h from bfd.h and put back into files
- from which it was split out. Now 64 bit version is built with a
- -DHOST_64_BIT="long long" on the compile line.
-
-Fri May 17 19:35:26 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- Changed all the [get|put][name] routines to use [get|put]_[size
- in bytes].
-
- Put in support for 64 bit work. Now two versions of bfd may be
- generated, according to the state of TARGET_64_BIT, one which is
- 32 bit only, and one which is 64/32 bits.
- Created new back end 'demo64' to test 64 bit functionality.
-
- Renamed some files to work on DOS.
-
- * archive.c: lint * bfd.c: prototypes and lint. * ecoff.c: added
- 64bit transfer * icoff.c: added 64bit transfer * ieee.c: name
- chage, 64 bit transfer. * liba.out.h: Split out common code from
- sunos and newsos into liba.out. Name changes and prototype mods. *
- libbfd.c: lint and prototypes, extra 64bit swaps. * libbfd.h:
- prototypes for new functions. * libcoff.h: lint * libieee.h: make
- work on DOS * liboasys.h: make work on DOS * m88k-bcs.c: Name
- change and 64bit stuff.* newsos3.c: common code removed, new jump
- table. * oasys.c: Name change * opncls.c: Portability fixes *
- srec.c: Name changes * sunos.c: Removed comon code. * targets.c:
- Added demo * aout32, aout64.c include aoutx.h * bout.c: used to
- be called b.out.c * coffcode.h: used to be called coff-code.h, now
- 64bit ized. * demo64.c: 64 bit a.out back end
-
-Thu May 16 16:02:07 1991 Steve Chamberlain (steve at cygint.cygnus.com)
- from bothner
- * libieee.h: Make ieee_data and ieee_ar_data macros usable
- on LHS of assignment, even when using old compilers.
- * liboasys.h: Ditto for oasys_data and oasys_ar_data.
- * m68kcoff.c: Add enum-to-int casts to accomodate old compilers.
- * newsos3.c: Fix definitions of SEGMENT_SIZE and TEXT_START_ADDR.
- * opncls.c: Define S_IXUSR, S_IXGRP, S_IXOTH if undefined.
- * targets.c: Add declaration of newsos3_vec.
-
-Mon May 13 10:03:29 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * aout.c: fixxed some of the problems with filepos calculation.
- (swap_ext_reloc): fixed problem with creation of relocs.
- (aout_set_section_contents): fixed filepos problem
-
- * coff-code.h: (swap_filehdr_in, swap_filehdr_out) add.
- (swap_filehdr) delete. Changed all the usage of bfd_h_put_x.
- (swap_aouthdr_in, swap_aouthdr_out) add. (swap_aouthdr) delete.
- (coff_real_object_p) cleaned up, added MIPS. (coff_object_p)
- cleaned up. (coff_write_object_contents) cleaned up.
-
- * ecoff.c: Totally different. Now supports ecoff fully.
-
- * icoff.c: fixed problems in relocation callout.
-
- * libcoff.h: (struct icofdata) removed hdr structure from tdata.
-
- * m68kcoff.c: updated target vector.
-
- * sunos.c: (choose_reloc_size) added: (sunos4_callback) calls
- choose_reloc_size. (sunos4_write_object_contents) now calls
- choose_reloc_size so outputs relocs correctly, also calculates the
- size of the sections correctly.
-
-
-
-Fri May 10 16:58:53 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- Merge Per Bothner's changes to modularize BFD a.out a bit.
-
- * libbfd.h, libbfd.c (bfd_generic_get_section_contents): Add.
- * ieee.c: Cast enums to int before comparing them, for brain-
- dead compilers.
- * coff-code.h: Remove coff_get_section_contents, and use the
- generic one instead.
-
- * aout.c: Derive new module from sunos.c, containing generic
- support code for all kinds of a.out files.
-
- * sunos.c: Remove all code that goes in aout.c. Split out
- machine dependent followup in sunos4_object_p into
- sunos4_callback. Use JUMP_TABLE(aout) for the transver vector,
- and redefine only the names we CHANGE, not all the names. Drop
- the little-endian vector, and rename the vector as sunos4 rather
- than generic.
-
- * b.out.c: Use aout.c routines for most of the work. Slight
- changes for the new regime. Remove close_and_cleanup and
- get_section_contents in favor of generics. New transfer vector
- regime.
-
- * newsos3.c: New support for Sony NEWS, another a.out format.
-
- * ecoff.c: Remove close_and_cleanup. New tvec regime.
- * icoff.c, m88k-bcs.c: Add write_contents to tvec.
- * ieee.c, oasys.c: Remove close_and_cleanup, add write_contents
- to tvec.
- * opncls.c (bfd_close): Call format-dependent write_contents
- routine, if writing, before calling target-dependent
- close_and_cleanup routine (which is now always generic, I think).
- * srec.c: Use bfd_alloc instead of malloc. Remove
- close_and_cleanup and move code from it to
- srec_write_object_contents. Add write_contents to tvec.
- * targets.c: Remove a.out little vector, replace a.out big
- vector with SunOS vector. FIXME: Need Vax support again now.
-
- * libbfd.h: Add write_contents format-dependent-vector to the
- bfd_target vector. Supply a generic close_and_cleanup routine.
- * liba.out.h: Handle the new aout.c split. Add prototypes for
- all routines defined in aout.c. Rename "sunos" things to "aout"
- things. Add a few fields where needed for various formats.
- * Makefile.in: Add aout.c and newsos3.c.
-
- * archive.c, ieee.c, oasys.c: Lint.
-
-Fri May 10 12:34:48 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * ../include/bfd.h
- changed forward declaration struct stat; to reduce warnings. Changed
- comment on bfd_h_<x>_x.
-
- * ../include/m68kcoff.h, ../include/intel-coff.h,
- ../include/m88k-bcs.h
- Now there are two incarnations of relocs, linenos and syments. One for
- internal digestion, and one full of char arrays for I/O. The original
- names have gone to detect errors.
-
- * Makefile.in, m68kcoff.c, targets.c
- Test new structure code with a 68k coff implementaion
-
- * coff-code.h, icoff.c, coffswap.c, libcoff.h
- Fixed all the places where there were problems with the size and
- alignments of structures on disk and structures in memory. #ifed out
- all the code in coffswap.c, since it should be done using the target
- swap routines now.
-
-Thu May 9 11:00:45 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * ieee.c (do_one, ieee_slurp_section_data): now supports the load
- multiple reloc command.
-
- * sunos.c (sunos4_set_section_contents): Made it so that sections
- are always padded to their alignment size.
-
-Sat May 4 15:49:43 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * archive.c, bfd.c, coff-code.h, opncls.c, sunos.c, trad-core.c:
- Clean up types and such (saber C problems).
- * ecoff.c: Clean up types and such. Remove routines that are
- not used. Fix up reading and swapping of shorts from files.
-
- Notes on bfd-0.5.2-patch1a, from Per Bothner:
-
- * a.out.vax.c: Remove two bogus "static" from prototypes.
-
- * ecoff.c: Got rid of lots of non-working junk (that had
- been copied directly from coff-code.h).
- Updated to be consistent with updates to icoff.c and coff-code.h.
-
- * libbfd.h: Added definitions for S_IXUSR, S_IXGRP, and S_IXOTH
- if they're missing (as they are in (BDS-4.3-based) NewsOS-3).
-
- * sunos.c (n_txtoff): (Re-)Add support for sony. This is a kludge,
- but until the target_vector is automatically generated,
- it's as good as any. Note that the text offset is the only
- difference between NewsOS and SunOs (including magic numbers).
- (Most of the sunos_* routines should to renamed bsd_*
- and move to a bsd.c file. Then (and when the target_vector
- is automatically generated) it might make sense to create
- a separate Sony target.)
-
- * sysdep.h: Don't declare fread and fwrite. Causes trouble
- on some systems, and doesn't help on others.
- Similarly, only define X_OK if not already defined.
-
- * trad-core.c: Don't include sys/stat.h - at least
- on NewsOS 3, it has already been included.
-
-Tue Mar 5 01:47:57 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * coff-code.h (bfd_coff_swap_sym, bfd_coff_swap_aux,
- bfd_coff_swap_lineno): Export the routines that byte-swap COFF
- symbol tables if necessary when reading them in, so gdb can use
- them. Add "bfd_coff_" to the names so they won't conflict with
- names in calling programs. FIXME-soon: if coff-code.h is
- included in two BFD modules, this will cause duplicate
- definitions; the routines should be exported to a separate,
- common, module (probably along with a mess of other ones).
-
-Sat Mar 2 12:11:26 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- Improve modtime support.
-
- * bfd.h: Add boolean mtime_set, and declare bfd_get_mtime.
- Remove #define for bfd_get_mtime. Remove gratuitous comment.
- * bfd.c (bfd_get_mtime): New fn, caches mtime, gets if not cached.
- BUG: archive members still do not get correct mod times.
-
- Improve floating point support for core files.
-
- * sunos.c (struct core): Change void *fpa_dummy to double fp_stuff.
- (sunos4_core_file_p): Create a second registers section in the
- core file, called ".reg2", for the float registers.
-
-Thu Feb 14 15:49:06 1991 Gumby Vinayak Wallace (gumby at cygint.cygnus.com)
-
- * many changes to improve archive handling; found a logic flaw in
- bfd_check_format which only just happened to work by cooncidence.
-
-Thu Feb 14 07:53:16 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * bfd.c (bfd_perform_relocation): fixed to use output_offsets
- correctly.
-
- * bfd.h: changed type of udata in asymbol to void *, like it
- should be. Added bfd_reloc_dangerous enum member.
-
- * coff-code.h: Fixed it so that internally generated symbols get
- their values relocated correctly in all cases. Removed calls to
- xmalloc.
-
- * icoff.c: Not understanding the destination symbol of a reloc is
- not a failure any more, just 'dangerous'. This allows linking of
- b.out and coff images.
-
- * sunos.c: Cleaned up the way that ZMAGIC section sizes are
- calculated.
-
-
-Tue Feb 12 13:25:46 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * sunos.c (translate_to_native_sym_flags): fixed
- sym_pointer->n_value so that symbols on the way out get their
- section relative values calculated correctly.
-
- * coff-code.h (mangle_symbols): fixed problem where tags were not
- being relocated for structs, enums, unions. Also various lints.
-
-Mon Feb 11 19:52:26 1991 Gumby Vinayak Wallace (gumby at cygint.cygnus.com)
-
- * archive.c (get_elt_at_filepos): system_call_error returned
- incorrectly.
-
-Sun Feb 10 23:18:40 1991 Gumby Vinayak Wallace (gumby at cygint.cygnus.com)
-
- * Resolve the use of no_error and system_call_error.
- The bfd library itself now will never set bfd_error to
- no_error.
-
- The code still needs to be combed to make sure all the error
- codes are correct. I suspect they are not always set correctly.
-
- * The names of all the messages have _ prepended because the sun
- bundled compiler can't distinguish from a macro which takes an
- argument and the same identifier in a non-macro context.
-
- * The reason for the above being that entry points which used to
- be trampoline functions are now just macros which expand to a
- direct call through the bfd's xfer vector.
-
- * (../include/intel-coff.h) F_AR32WR: fix this constant. Why
- must gas have its own version of everything (the gas version
- had the correct value)
-
-Tue Feb 5 11:46:53 1991 Steve Chamberlain (steve at cygint.cygnus.com)
-
- * b.out.c: Added patches supplied by chrisb@mipon2.intel.com to
- properly support i960 architecture and output correct reloc stuff.
-
- * bfd.h: added prototype for bfd_printable_arch_mach, added
- BFD_FAIL
-
- * coff-code.h: Applied patches from chrisb to support i960
- architecture, zero relocs and swap them correcly and conditionally
- compiled the timestamp.
-
- * sunos.c: Made the default section alignment 2^3 so that doubles
- are done properly. Fixed the same reloc bug that was in b.out.c
-
- * sysdep.h: Now compiles on a Posix box
-
-Wed Jan 30 21:36:26 1991 John Gilmore (gnu at cygint.cygnus.com)
-
- * icoff.c: Fix comment on big-endian version.
- * coff-code.h: Make HAS_RELOC really work (it's backwards from
- F_RELFLG). Set F_AR32WR in output files if little endian
- architecture.
-
-Tue Jan 29 20:56:10 PST 1991 steve@cygnus.com
-
- * archures.c fixed =/== typo
-
- * sunos.c added architecture stuff for output. Fixed
- bug where files where vma(data) != size(text)
- were processed wrong.
-
- * coff-code.h added a lint cast
-
- * (../include/a.out.sun4.h) fixed it so zmagic
- worked
-
-Mon Jan 28 19:15:29 PST 1991 steve@cygnus.com
-
- * archive.c removed loads of includes, and fixed bug where string
- table didn't have a null at the end.
-
- * bfd.c fixed includes, added symbols argument to
- canonicalize_reloc entry point.
-
- * libbfd.c fixed includes and added some lint patches.
-
- * targets.c added both sorts of intel coff.
-
- * b.out.c fixed included, changed was the canonical
- relocs were done.
-
- * icoff.c added support for callj and big and little
- enidian tables.
-
- * opncls.c added chmod+xing for files with EXEC_P set.
-
- * sunos.c fixed includes. Changed default section
- alignement to words. Fixed relocation stuff to work with
- new scheme
-
- * bfd.h various new types added, prototype for new
- reloc calls, changed bfd->iostream to a void *
- to including files don't need stdio.h.
-
- * libcoff.h added conversion table to tie relocs to
- canonical symbols
-
- * sysdep.h created
-
- * coff-code.h fixed includes. Added code to support
- big and little endian formats. Various lints. Better
- processing of symbols. Changed reloc stuff to new
- order
-
- * libbfd.h fixed includes
-
-
-Mon Jan 21 11:53:51 PST 1991 steve@cygnus.com
-
- * bfd.h: changed name of alignment entry in sec_struct to
- alignment_power, because of conflicting uses within bfd.
- Now it should be obvious that it's a 2**n alignment
- specifier. Removed start_pad, end_alignment, block, minsize,
- output_file_alignment, subsection_alignment and original_vma fields.
- Added align_power() macro. Fixed bfd_section_alignment
- acessor macros. Added bfd_symbol_same_target macro.
-
- * b.out.c (b_out_write_object_contents): fixed to use
- new alignment member. Fixed (callj_callback) to use section
- relative symbols properly.
-
- * sunos.c (sunos4_object_p): fixed to use new alignment_power.
- Fixed (translate_from_native_sym_flags) to correctly make
- symbols section relative.
-
- * bfd.c (bfd_errmsg): fixed various enum cast problems.
- (bfd_make_section): took out initialization of obsolete members.
- (bfd_print_symbol_vandf): added
-
- * opncls.c (bfd_create): created.
-
- * coff-code.h (coff_new_section_hook): took away refs
- to obsolete members. (make_a_section_from_file) added
- conversion between alignment types. (coff_symbol_from)
- added. (coff_count_linenumbers) only counts linenumbers
- if symbol is of coff-type. (coff_mangle_symbols) only
- heavily mangles symbols if symbol is coff-type.
- (coff_write_symbols) various lints. (coff_write_object_contents)
- various lints and modification for alignment conversion.
- (coff_slurp_relocs) fixed for use with new asection shape.
-
-Sat Jan 19 16:10:42 PST 1991 steve@cygnus.com
-
- * archive.c> lots of lint.
-
- * b.out.c: added callj relocation support, upgrated reloc howto.
- Fixed so that asymbol and reloc records are output
- correctly.
-
- * bfd.c: lots of lint, support for new bfd entry point
- bfd_print_symbol.
-
- * bfd.h: changed definition of asymbol to contain pointer to
- owning bfd, removed target dependencies.
-
- * cache.c: took out print statements, put in BFD_ASSERT calls.
-
- * coff-code.h: various lints, corrected linenumber output
- functionality. Added support for new style asymbols and
- bfd_print_symbol. Fixed so that asymbol and
- reloc records are handled correctly. Added timestamp.
-
- * icoff.c: Added support for new howto shape.
-
- * liba.out.h: Added support for new asymbol shape
-
- * libbfd.c: various lints
-
- * libbfd.h: various lints
-
- * libcoff.h: added support for new asymbol shape.
-
- * sunos.c: various lints. Added support for new asymbol shape
- and bfd_print_symbol.
-
-Wed Jan 16 21:38:09 PST 1991 steve@cygnus.com
-
- * b.out.c removed prototype of sunos4_ennativate_symtab, lots of
- pointer lint. Added support for callj relocation. Fixed bug where
- the last 32 bytes of the text section were overwritten by data. Fixed bug
- where archives of b.out didn't work due bfd_slurp_extended_name_table
- returning false.
-
- * sunos.c added support for n_other field. Braced the howto table so
- that it won't be affected by any lengthing of the howto struct typedef.
- Various lints
-
- * bfd.h added support for n_other field, added special_function
- reloc type, modified bfd_perform_relocation prototype. Added bfd_h_get_x
- macros.
-
- * bfd.c upgraded bfd_perform_relocation, various lints.
-
-Wed Jan 16 01:55:53 1991 John Gilmore (gnu at rtl)
-
- * ChangeLog: Started ChangeLog for BFD.
- * TODO: Create file for suggestions.
-
- * Makefile: Support easy loading into Saber C.
- Add dependencies for icoff.o and bcs88kcoff.o.
- Rename coff.c to coff-code.h. Change callers.
-
- * bfd.c (bfd_check_format): Allow the check_format routines
- to return the desired target vector, rather than just a Boolean.
- bfd.h (bfd_check_format): Change function pointer return type.
- archive.c (bfd_generic_archive_p): change callee.
- b.out.c (b_out_little_object_p, b_out_big_object_p,
- b_out_real_object_p): change callee.
- libbfd.c (_bfd_dummy_target): Dummy routine replacing bfd_false
- in check_format transfer vectors that need a filler.
- libbfd.h (bfd_generic_archive_p, _bfd_dummy_target): Fix decls.
- bcs88kcoff.c: change callee.
- coff-code.h (coff_real_object_p, coff_big_object_p): change callee.
- icoff.c: change callee.
- sunos.c (sunos4_object_p, sunos4_core_file_p): change callee.
-
- * libbfd.c (zalloc): It should actually zero the storage!
- This was commented out for some reason.
-
- * libbfd.h: Add malloc, xmalloc, memcpy, and fatal decls.
- This is so callers can avoid <stdlib.h> which doesn't exist
- on older systems.
-
- * bfd.c (map_over_sections): Add debugging code, since I
- noticed the section count for sunos core files was bad, but only
- GDB had detected the problem.
- (bfd_set_section_lineno_size, bfd_set_section_linenos,
- bfd_get_section_linenos): Remove obsolete functions.
- (bfd_apply_relocations): Use longs, not ints, for the math.
-
- * bfd.h: Declare enum boolean and struct bfd_target as well
- as typedefs for them. Remove obsolete
- bfd_get_section_lineno_size.
-
- * cache.c: Make the "fdopen" support work. Keep better track
- of how many files are open. Centralize the opening of files
- and be sure bfd_open[rw] actually try to open the file. Evade
- linked list initialization problems.
-
- * b.out.c, coff-code.h, opncls.c, sunos.c: lint.
-
- * coff-code.h (coff_slurp_symbol_table): Null-terminate symtab names.
-
- * cplus-dem.c: Delete file, since it is not part of BFD.
-
- * opncls.c (bfd_openr): Eliminate misplaced #if 0 code.
- (bfd_openr, bfd_openw): Actually open the file, give error now.
-
- * sunos.c (sunos4_core_file_p): Set section count.
- (sunos4_set_section_linenos, stab_names, fprint_name): Eliminiate
- obsolete definitions.
- (_write_symbol_table): Initialize <idx> counter.
- (foop): Eliminate debugging code.
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/ChangeLog-9495 b/contrib/binutils/bfd/ChangeLog-9495
deleted file mode 100644
index a208f42..0000000
--- a/contrib/binutils/bfd/ChangeLog-9495
+++ /dev/null
@@ -1,10043 +0,0 @@
-Thu Dec 21 12:43:49 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_howto_raw): Add a phony reloc to handle the
- old style TOC16 references without using R_PPC_GOT.
- (ppc_reloc_type): Ditto.
- (ppc_elf_reloc_type_lookup): Add support for TOC16.
- (ppc_elf_toc16_inner): Renamed from ppc_elf_got16_inner.
- (ppc_elf_toc16_reloc): Renamed from ppc_elf_toc16_reloc.
- (ppc_elf_got16_{inner,reloc}): Stubs for real GOT support.
- (ppc_elf_check_relocs): New function for GOT/PLT support that is
- work in progress.
- (ppc_elf_adjust_dynamic_symbol): Ditto.
- (ppc_elf_adjust_dynindx): Ditto.
- (ppc_elf_size_dynamic_sections): Ditto.
- (ppc_elf_finish_dynamic_symbol): Ditto.
- (ppc_elf_finish_dynamic_sections): Ditto.
- (ELF_DYNAMIC_INTERPRETER): Define.
-
-Wed Dec 20 19:14:18 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * elf.c (copy_private_bfd_data): When attaching sections to
- segments ignore sections that won't be allocated. Patch from
- Andreas Schwab.
-
-Tue Dec 19 20:01:43 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * config.bfd: Match on m68k-cbm-* only if OS doesn't match
- anything else.
-
-Tue Dec 19 16:38:59 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i960.c (CALC_ADDEND): Define.
- (coff_i960_relocate_section): Add the input section VMA to the
- addend for PC relative relocs.
-
-Sun Dec 17 20:11:55 1995 Kim Knuttila <krk@cygnus.com>
-
- * peicode.h (pe_print_pdata): Must test the entire entry for zero
- to correctly terminate.
-
-Fri Dec 15 12:05:57 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * targets.c (enum bfd_endian): Define.
- (bfd_target): Rename byteorder_big_p to byteorder, and change it
- from boolean to enum bfd_endian. Change header_byteorder_big_p
- correspondingly.
- * bfd-in.h (bfd_big_endian, bfd_little_endian): New macros.
- (bfd_header_big_endian, bfd_header_little_endian): New macros.
- * bfd-in2.h: Rebuild.
- * All targets: Change initialization of byteorder and
- header_byteorder to use enum bfd_endian values rather than
- booleans.
- * All files: Change all references to byteorder_big_p and
- header_byteorder_big_p to use new bfd_*_endian macros.
-
- * coffgen.c (make_a_section_from_file): Set lma to s_paddr, not
- s_vaddr.
- * coffcode.h (coff_write_object_contents): Set s_paddr to lma, not
- vma.
- * ecoff.c (_bfd_ecoff_write_object_contents): Likewise.
-
-Fri Dec 15 07:32:09 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * pe[i]-i386.c (TARGET_UNDERSCORE): Define to '_'.
-
-Thu Dec 14 13:45:37 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c: Lots of minor cleanups. Make many functions return
- errors rather than calling abort. Also:
- (ieee_write_twobyte): Remove; change callers to call existing
- ieee_write_2bytes function.
- (ieee_write_expression): Don't output the section twice when
- outputting a local symbol. Don't emit an extraneous zero if there
- is only one term.
- (ieee_slurp_sections): Set the lma as well as the vma.
- (ieee_archive_p): Use bfd_alloc_grow rather than an obstack.
-
- * ihex.c (ihex_set_arch_mach): Don't accept any architecture, just
- a recognized one or bfd_arch_unknown.
- (ihex_get_symtab_upper_bound): Define as bfd_0l, to permit objcopy
- to succeed.
- (ihex_get_symtab): Likewise.
-
-Wed Dec 13 15:44:06 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h: Include <ctype.h>.
- (struct aout_link_includes_table): Define.
- (struct aout_link_includes_totals): Define.
- (struct aout_link_includes_entry): Define.
- (aout_link_includes_lookup): Define macro.
- (struct aout_final_link_info): Add includes field.
- (aout_link_includes_newfunc): New static function.
- (NAME(aout,final_link)): Initialize includes hash table.
- (aout_link_write_symbols): Eliminate duplicate N_BINCL entries.
-
-Wed Dec 13 10:52:14 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-config.in: Match on mips-*-* instead of mips-idt-ecoff.
-
-Wed Dec 13 11:07:45 1995 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (coff_ppc_relocate_section): removed debugging code.
-
-Tue Dec 12 17:42:06 1995 Kim Knuttila <krk@cygnus.com>
-
- * peicode.h (pe_print_reloc): New function to dump the .reloc section.
- (pe_print_private_bfd_data): call pe_print_reloc.
- * coffcode.h (coff_set_alignment_hook): .reloc section alignment.
- * coff-ppc.c (in_reloc_p): Added missing non-eligible relocs. Spiffed
- up some debugging as well.
-
-Tue Dec 12 11:34:23 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * config.bfd: Handle sparc-*-elf*. From Ronald F. Guilmette
- <rfg@monkeys.com>.
-
-Fri Dec 8 17:47:07 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Set section_count to 0
- when setting sections to NULL.
-
-Wed Dec 6 17:05:37 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (struct xcoff_loader_info): Add export_defineds
- field.
- (bfd_xcoff_size_dynamic_sections): Add export_defineds parameter.
- (xcoff_build_ldsyms): If export_defineds is set, set XCOFF_EXPORT
- for all symbols.
- * bfd-in.h (bfd_xcoff_size_dynamic_sections): Update declaration.
- * bfd-in2.h: Rebuild.
-
-Mon Dec 4 16:40:47 1995 Kim Knuttila <krk@cygnus.com>
-
- * coffcode.h (coff_set_alignment_hook): Removed some debugging printf's
-
-Mon Dec 4 11:25:39 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * ihex.c (ihex_scan): Handle record types 4 and 5.
- (ihex_object_p): Permit types 4 and 5.
- (ihex_set_section_contents): Remove check for out of range
- addresses.
- (ihex_write_object_contents): Generate types 4 and 5.
-
- * elflink.h (elf_link_output_extsym): Just ignore warning and
- indirect references to symbols which don't really exist.
-
-Sun Dec 3 19:00:27 1995 Kim Knuttila <krk@cygnus.com>
-
- * peicode.h (pe_print_idata): Minor format fixes
- (pe_print_edata): New function. Under private printing, this formats
- the edata section of a PE file.
- (pe_print_private_bfd_data): Added call to pe_print_edata.
-
-Sun Dec 3 16:46:54 1995 Richard Earnshaw (rearnsha@armltd.co.uk)
-
- * aout-arm.c (MY_swap_std_reloc_out): Use KEEPIT to get the symbol
- index, don't call stoi.
-
-Fri Dec 1 14:46:51 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * srec.c (srec_scan): Set lma as well as vma.
-
- * ihex.c: New file; support for Intel Hex format.
- * targets.c (enum bfd_flavour): Add bfd_target_ihex_flavour.
- (ihex_vec): Declare.
- (bfd_target_vector): Always include ihex_vec.
- * bfd.c (struct _bfd): Add ihex_data field to tdata union.
- * Makefile.in: Rebuild dependencies.
- (BFD_LIBS): Add ihex.o
- (BFD_LIBS_CFILES): Add ihex.c.
- * bfd-in2.h: Rebuild.
-
- * elf.c (assign_file_positions_for_segments): Sort the sections in
- each segment.
- (get_program_header_size): Return the right size if segment_map is
- not NULL.
- (copy_private_bfd_data): Don't bother to sort the sections.
-
- * bfd.c (bfd_record_phdr): New function.
- * bfd-in.h (bfd_record_phdr): Declare.
- * bfd-in2.h: Rebuild.
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Remove bogus
- BFD_ASSERT.
-
- * libbfd.c (bfd_malloc, bfd_realloc): New functions.
- (bfd_zmalloc): Return PTR, not char *. Take size_t, not
- bfd_size_type.
- * libbfd-in.h (bfd_malloc, bfd_realloc): Declare.
- (bfd_zmalloc): Change declaration.
- * libbfd.h: Rebuild.
- * Many files: Use bfd_malloc and bfd_realloc rather than malloc
- and realloc. Don't set bfd_error_no_memory if they fail.
-
-Thu Nov 30 19:32:26 1995 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c: Added macros to tidy up toc cell treatment. Numerous
- uses as well. Added a new howto to deal with TOCREL16 relocs that
- are TOCDEFN as well.
- (coff_ppc_relocate_section): Expanded treatment of ADDR32NB relocs
- to handle RVA relocs from dlltool.
- (ppc_coff_rtype2howto): TOCDEFN reloc addition.
- (coff_ppc_rtype_to_howto): TOCDEFN reloc addition.
- (ppc_coff_reloc_type_lookup): TOCDEFN reloc addition.
-
- * coffcode.h (coff_set_alignment_hook): check idata$X sections
- to get the right section alignment.
-
-Thu Nov 30 16:48:18 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
- p_paddr if p_paddr is zero.
- (make_mapping): Set includes_filehdr and includes_phdrs for first
- PT_LOAD segment.
- (map_sections_to_segments): Set includes_phdrs for PT_PHDR
- segment.
- (assign_file_positions_for_segments): Handle includes_filehdr and
- includes_phdrs. Remove special handling of PT_PHDR and first
- PT_LOAD segments.
- (copy_private_bfd_data): Set includes_filehdr and includes_phdr
- when appropriate. Remove special handling of PT_PHDR segment.
- Use a more complex condition for when a section is included in a
- segment to handle Solaris linker oddities.
-
-Thu Nov 30 11:17:33 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de>
-
- * coff-m88k.c (howto_table): Reformatted for easier reading;
- special_function now points to new function m88k_special_reloc.
- (howto_hvrt16): Function previously used for handling HVRT16 relocs
- removed.
- (rtype2howto): Do not add reloc's r_offset to the addend, this will
- be done correctly by m88k_special_reloc.
- (reloc_processing): New function to be used by RELOC_PROCESSING.
- (RELOC_PROCESSING): Define to call reloc_processing.
-
-Wed Nov 29 12:42:36 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (pe_print_idata): Call malloc rather than xmalloc.
- (pe_print_pdata): Likewise.
-
- * opncls.c (bfd_alloc_by_size_t): Set bfd_error_no_memory if
- obstack_alloc fails.
- (bfd_alloc_finish): Set bfd_error_no_memory if obstack_finish
- fails.
- * libbfd.c (bfd_zmalloc): Set bfd_error_no_memory if malloc fails.
- * Many files: don't set bfd_error_no_memory if one of the above
- routines fails.
-
- * elf.c (assign_file_positions_for_segments): Don't adjust p_paddr
- if p_paddr_valid is set.
- (copy_private_bfd_data): New static function.
- (_bfd_elf_copy_private_section_data): Call copy_private_bfd_data.
-
- * elf.c (assign_file_positions_for_segments): Fix case where extra
- program headers were allocated.
-
- * elf.c (_bfd_elf_print_private_bfd_data): New function.
- * elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare.
- * elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to
- _bfd_elf_print_private_bfd_data.
-
- * coff-alpha.c (alpha_ecoff_swap_reloc_in): Don't abort if
- r_symndx is RELOC_SECTION_NONE for an ALPHA_R_IGNORE reloc.
- Change a RELOC_SECTION_LITA symndx to RELOC_SECTION_ABS.
- (alpha_ecoff_swap_reloc_out): Change RELOC_SECTION_ABS to
- RELOC_SECTION_LITA for ALPHA_R_IGNORE.
- (alpha_adjust_reloc_out): For ALPHA_R_IGNORE, don't change
- RELOC_SECTION_ABS to RELOC_SECTION_NONE.
-
-Tue Nov 28 16:59:50 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf-bfd.h (struct elf_obj_tdata): Add segment_map field.
- * elf.c (make_mapping): New static function.
- (map_sections_to_segments): New static function.
- (elf_sort_sections): New static function.
- (assign_file_positions_for_segments): New static function.
- (map_program_segments): Remove.
- (get_program_header_size): Remove sorted_hdrs, count, and
- maxpagesize parameters. Simplify.
- (assign_file_positions_except_relocs): When generating an
- executable, use assign_file_positions_for_segments.
- (elf_sort_hdrs): Remove.
- (_bfd_elf_sizeof_headers): Remove eliminated parameters from call
- to get_program_header_size.
-
-Mon Nov 27 12:27:46 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * hp300hpux.c (MY(callback)): Set lma as well as vma.
-
- * configure, config.in: Regenerate with autoconf 2.7.
-
- * elf32-i386.c (elf_backend_plt_readonly): Set correctly, to 1.
- * elf32-sparc.c (elf_backend_plt_readonly): Set correctly, to 0.
-
-Wed Nov 22 12:02:09 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (_bfd_ecoff_new_section_hook): Handle .rconst section.
- (ecoff_sec_to_styp_flags): Likewise.
- (_bfd_ecoff_styp_to_sec_flags): Handle STYP_RCONST.
- (ecoff_set_symbol_info): Handle scRConst.
- (ecoff_slurp_reloc_table): Handle RELOC_SECTION_RCONST.
- (ecoff_compute_section_file_positions): Handle .rconst section.
- (_bfd_ecoff_write_object_contents): Likewise.
- (ecoff_link_check_archive_element): Handle scRConst.
- (ecoff_link_add_externals): Likewise.
- (ecoff_link_write_external): Handle .rconst section.
- (ecoff_reloc_link_order): Likewise.
- * ecofflink.c (bfd_ecoff_debug_accumulate): Handle scRConst.
- * coff-alpha.c (alpha_convert_external_reloc): Handle .rconst
- section.
- (alpha_relocate_section): Handle RELOC_SECTION_RCONST.
-
- * sunos.c (sunos_scan_dynamic_symbol): Only set written if the
- DEF_DYNAMIC flag is set.
-
-Tue Nov 21 13:25:29 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * host-aout.c: If TRAD_HEADER is defined, include it.
-
-Tue Nov 21 13:03:57 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aclocal.m4 (AC_PROG_CC): Remove local definition.
- (BFD_BINARY_FOPEN): Require AC_CANONICAL_SYSTEM.
- (BFD_NEED_DECLARATION): New function.
- * configure.in: Use BFD_NEED_DECLARATION.
- * acconfig.h: Put NEED_DECLARATION_* in @TOP@ section.
- * configure, config.in: Rebuild with autoconf 2.6.
-
- * xcofflink.c (bfd_xcoff_size_dynamic_sections): Clear
- special_sections before returning when called with a non XCOFF
- BFD.
-
- * coffgen.c (coff_renumber_symbols): Sort common symbols with
- global symbols.
-
- * coffcode.h (coff_compute_section_file_positions): Only pad the
- previous section to force file alignment when creating an
- executable.
-
-Mon Nov 20 14:54:09 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_compute_section_file_positions): If
- RS6000COFF_C, set up the .debug section.
-
- * xcofflink.c (xcoff_link_input_bfd): Adjust the TOC anchor value
- if it is not large enough to accomodate the entire TOC area with
- signed 16 bit offsets.
- (xcoff_write_global_symbol): Handle negative TOC offsets in global
- linkage code.
- (_bfd_ppc_xcoff_relocate_section): Adjust relocations against a
- TOC anchor to use the TOC value used in the output file.
-
-Sat Nov 18 18:01:41 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffgen.c (_bfd_coff_get_external_symbols): Cast malloc return.
- (_bfd_coff_read_string_table): Likewise.
-
-Sat Nov 18 19:43:04 1995 Richard Earnshaw (rearnsha@armltd.co.uk)
-
- * pe-arm.c: Fix typos.
- * coff-arm.c: Likewise.
-
-Fri Nov 17 16:22:04 1995 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (list_ele): Added "cat"egory member.
- (record_toc): New category parameter (priv or pub).
- (ppc_record_toc_entry): Check to see if toc bounds exceeded.
- (ppc_process_before_allocation): Removed embrionic data-in-toc from
- the mainline. It addes extra toc cells in error.
- (ppc_coff_swap_sym_in_hook): Added some documentation.
- (dump_toc): Can now diagnose "virtual toc" chicanery.
-
-Fri Nov 17 10:41:25 1995 Philippe De Muyter <phdm@info.ucl.ac.be>
-
- * elf-bfd.h (struct elf_link_hash_table): Change type of
- dynsymcount and bucketcount fields from size_t to bfd_size_type.
-
-Fri Nov 17 10:02:58 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_pointerize_aux_hook): I960 version: don't
- pointerize C_LEAFSTAT or C_LEAFEXT entries.
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Only create
- DT_INIT and DT_FINI entries if the _init or _fini symbol is
- defined or mentioned in a regular file.
-
-Thu Nov 16 15:16:42 1995 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (ppc_record_data_in_toc_entry): new function
- (coff_ppc_relocate_section): Handle TOCDEFN attribute
- (coff_ppc_relocate_section): Correct REL24 handling
- (ppc_process_before_allocation): Correct TOCDEFN handling
-
- * peicode.h (dir_names): Added name descriptions
-
-Thu Nov 16 03:38:03 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * VERSION: Updated to cygnus-2.6.
-
-Wed Nov 15 19:30:07 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * targets.c (m68k4knetbsd_vec): Declare.
-
-Wed Nov 15 18:05:52 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * targets.c (bfd_target): Change type of second argument to
- _bfd_print_private_bfd_data from void * to PTR.
- * libbfd-in.h (_bfd_generic_bfd_print_private_bfd_data): Cast
- using PTR rather than void *.
- * bfd-in2.h, libbfd.h: Rebuild.
- * peicode.h (pe_print_private_bfd_data): Change vfile from void *
- to PTR.
- * elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define as
- _bfd_generic_bfd_print_private_bfd_data rather than casting
- bfd_true.
-
-Wed Nov 15 04:09:14 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * Makefile.in (.dep1): Fix stupid typo in last change. Remove any
- "DO NOT DELETE" lines or blank lines that mkdep writes on some
- systems.
- (BFD_LIBS_CFILES, ALL_MACHINES_CFILES, BFD32_BACKENDS_CFILES,
- BFD64_BACKENDS_CFILES): New variables.
- (CFILES): Use them.
-
-Tue Nov 14 11:52:23 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (coff_swap_aouthdr_out): For PPC PE, start isize at 0,
- not at the file position of the first section.
- * coffcode.h (coff_compute_section_file_positions): Avoid using
- unportable #elif.
- (coff_write_object_contents): When generating a PPC PE executable
- with no symbols, round up the file size to a COFF_PAGE_SIZE
- boundary.
- * cofflink.c (_bfd_coff_final_link): If there are no symbols,
- don't write out a string table.
-
- * elf.c (bfd_section_from_shdr): When using a different section
- header, pass the new one to _bfd_elf_make_section_from_shdr.
- (elf_fake_sections): Don't set sh_info and sh_entsize fields.
- (elf_map_symbols): Add section VMA to symbol value when comparing
- against 0.
- (_bfd_elf_compute_section_file_positions): Only build symbol table
- if there are some symbols. Set file offset of symtab and strtab
- sections.
- (assign_file_positions_except_relocs): Remove dosyms parameter.
- Change all callers. Never set file offset of symtab and strtab
- sections.
- (_bfd_elf_copy_private_section_data): New function.
- (MAP_ONESYMTAB, MAP_DYNSYMTAB, MAP_STRTAB, MAP_SHSTRTAB): Define.
- (_bfd_elf_copy_private_symbol_data): New function.
- (swap_out_syms): Check for special mapping of st_shndx created by
- copy_private_symbol_data.
- * elfxx-target.h: Use new copy routines.
- * elf-bfd.h (_bfd_elf_copy_private_symbol_data): Declare.
- (_bfd_elf_copy_private_section_data): Declare.
-
- * config.bfd (sh-*-*): Set targ_defvec to shcoff_vec.
-
- * coffcode.h (coff_slurp_symbol_table): If COFF_WITH_PE, handle
- C_NT_WEAK.
-
- * coff-sh.c (shlcoff_vec): Use _bfd_generic_archive_p, not
- _bfd_dummy_target, matching the recent change to archive
- recognition.
-
-Mon Nov 13 13:24:38 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd.c (bfd_get_file_window): Use casts to avoid doing
- arithmetic on PTR types.
-
- * aout-target.h (MY(callback)): Set the lma of the sections.
-
- * ecoff.c (ecoff_reloc_link_order): Turn a reloc against a defined
- symbol into a reloc against the section.
-
-Mon Nov 13 07:31:35 1995 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (ppc_coff_link_hash_entry): added support for inline
- glue for the relocs: IMGLUE and IFGLUE.
- (record_toc): new function - tracks toc contents
- (ppc_mark_symbol_as_glue): new function - supports the IMGLUE reloc
- (coff_ppc_relocate_section): Added support and fixes for IMGLUE/IFGLUE
- (ppc_coff_rtype2howto): removed invalid IMGLUE hack
- (coff_ppc_rtype_to_howto): removed invalid IMGLUE hack
- (ppc_record_toc_entry): Removed a debug define (duh)
-
- * peicode.h (coff_swap_scnhdr_out): Fixed invalid strcmp for ".reldata"
- (pe_print_idata): New function - formats the idata section data
- (pe_print_pdata): New function - formats the pdata section data
- (pe_print_private_bfd_data): calls to above
-
-Sun Nov 12 12:23:24 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * Makefile.in (bfd_libs_here, etc): Provide empty definitions.
- * coff-rs6000.c (rs6000coff_vec): Add conditional defines
- TARGET_SYM and TARGET_NAME for vector and BFD name.
- * coff-pmac.c (pmac_xcoff_vec): Remove.
- (TARGET_SYM, TARGET_NAME): Define.
- * coffcode.h (coff_set_arch_mach_hook) [POWERMAC]: Set the
- machine to 0, not all PowerMacs are 601s.
-
-Fri Nov 10 12:10:14 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_object_p): Read in any program headers.
- * elf.c (_bfd_elf_make_section_from_shdr): Adjust section lma
- based on the program headers, if any.
- (elf_fake_sections): Set sh_addr from the vma, not the lma.
- (map_program_segments): Set p_paddr of program headers based on
- the lma.
-
-Thu Nov 9 13:01:31 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * archive.c (bfd_generic_archive_p): Preserve tdata in case of
- failure.
-
- * aoutx.h (NAME(aout,final_link)): Report a reasonable error when
- trying to do a relocateable link with a non-a.out object file.
-
- * archive.c (bfd_generic_archive_p): Check the first object file
- in an archive even if target_defaulted is set. If the object file
- has the wrong xvec, reject it.
-
- * aoutx.h (NAME(aout,set_section_contents)): If a section can not
- be represented, report the name via _bfd_error_handler.
- (translate_to_native_sym_flags): Likewise.
- * elf32-mips.c (mips_elf_final_link): Likewise.
- * oasys.c (oasys_write_sections): Likewise.
-
- * coffcode.h (coff_set_alignment_hook): Write RS6000COFF_C version
- which checks for STYP_OVRFLO sections.
- (coff_compute_section_file_positions): If RS6000COFF_C, handle
- reloc and lineno count overflows.
- (coff_write_object_contents): Call coff_count_linenumbers before
- coff_compute_section_file_positions. If RS6000COFF_C, handle
- reloc and lineno count overflows.
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Count line numbers and
- relocs before dealing with .pad sections. Count overflow section
- headers when handling .pad sections.
-
- * coffcode.h (coff_write_object_contents): Set a.out vstamp to 1
- if RS6000COFF_C.
-
- * xcofflink.c (XCOFF_DESCRIPTOR): Define.
- (struct xcoff_link_hash_table): Add descriptor_section and
- special_sections fields.
- (_bfd_xcoff_bfd_link_hash_table_create): Initialize new fields.
- (xcoff_link_add_symbols): Set linkage section alignment. Create
- descriptor section. Check for magic symbol names (_text, etc.),
- and record them in special_sections if found. Set
- XCOFF_DESCRIPTOR flag for a function descriptor, and set its
- descriptor field to point back to the function code symbol.
- (xcoff_sweep): Always mark the special descriptor_section.
- (bfd_xcoff_export_symbol): Check whether the symbol might be a
- function descriptor, and mark it if it is.
- (bfd_xcoff_size_dynamic_sections): Add new special_sections
- parameter, and fill it in. Allocate space for the descriptor
- section.
- (xcoff_build_ldsyms): Set XCOFF_DEF_REGULAR flag when defining
- global linkage code. If an undefined function descriptor is
- exported, arrange to define it. Warn about any other undefined
- exported symbol.
- (_bfd_xcoff_bfd_final_link): Write out the descriptor section.
- (xcoff_write_global_symbol): Create a function descriptor when
- necessary.
- * bfd-in.h (bfd_xcoff_size_dynamic_sections): Update declaration.
- * bfd-in2.h: Rebuild.
-
-Thu Nov 9 08:40:23 1995 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (ppc_coff_link_hash_entry): new types for hashing
- (ppc_coff_link_hash_table): new types for hashing
- (ppc_coff_link_hash_newfunc): hash entry constructor
- (ppc_coff_link_hash_table_init): hash table initializer
- (ppc_coff_link_hash_table_create): hash table constructor
- (ppc_record_toc_entry): changed references to hash table
- (coff_ppc_relocate_section): changed references to hash table
-
- * libcoff-in.h (coff_link_hash_entry): removed toc_offset
- * libcoff.h: Rebuild
-
- * cofflink.c (_bfd_coff_link_hash_newfunc): removed toc_offset init
- (coff_link_add_symbols): removed toc_offset init
-
-Thu Nov 9 04:00:38 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * Makefile.in (.dep1): Make sure the file mkdep is to write exists
- first.
-
- * configure.in: Added new option --with[out]-mmap. Set USE_MMAP
- if it is given and mmep is available.
- * acconfig.h: Undef USE_MMAP.
- * configure, config.in: Regenerated.
- * aoutx.h: If USE_MMAP is not defined, do all symbol and string
- table handling the old way.
- (aout_get_external_symbols): Don't complain if last byte of string
- table is nonzero.
- * libbfd.c [HAVE_MADVISE]: Include sys/types.h and sys/mman.h.
- (bfd_free_window) [! USE_MMAP]: Don't define.
- (bfd_get_file_window,
- _bfd_generic_get_section_contents_in_window) [! USE_MMAP]: Abort.
-
-Wed Nov 8 20:03:44 1995 Eric Freudenthal <freudenthal@nyu.edu>
-
- * coff-a29k.c (SIGN_EXTEND_HWORD): Use ~0xffff rather than
- 0xffff0000.
-
-Wed Nov 8 11:31:11 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-a29k.c (a29k_reloc): Change handling of R_IREL reloc to be
- compatible with AMD generated COFF files. Try to support both AMD
- and GNU formats simultaneously.
- (coff_a29k_relocate_section): Likewise.
-
- * libbfd.c (bfd_get_file_window): Change writable parameter from
- int to boolean; update all callers. Pass MAP_SHARED if not
- writable--it's required on Solaris. Cast fprintf argument to
- avoid warning.
- * bfd-in.h (bfd_get_file_window): Update declaration.
- * bfd-in2.h: Rebuild.
- * aoutx.h: Update calls to bfd_get_file_window.
-
- * xcofflink.c (XCOFF_DEF_DYNAMIC): Rename from XCOFF_REF_DYNAMIC.
- Change all uses.
- (xcoff_swap_ldhdr_in): New static function.
- (xcoff_swap_ldsym_in): New static function.
- (xcoff_find_reloc): Handle the case of a single reloc correctly.
- (xcoff_link_add_symbols): If we just created a descriptor, pass it
- to _bfd_generic_link_add_one_symbol, to save a hash lookup.
- Handle XTY_ER/XMC_XO symbols correctly.
- (xcoff_link_add_dynamic_symbols): Rewrite to read .loader symbols
- rather than normal symbol table.
- (bfd_xcoff_import_symbol): It's not an error if the symbol is
- already defined with the same absolute value.
- (xcoff_mark): When considering called symbols, check whether the
- descriptor is from a dynamic object, rather than the symbol
- itself.
- (xcoff_build_ldsyms): Likewise.
-
- * libbfd.c (bfd_get_file_window): Change return type to boolean.
- Cast realloc and malloc return values. If malloc or realloc fail,
- set bfd_error_no_memory.
- * bfd-in.h (bfd_get_file_window): Change type to boolean.
- * bfd-in2.h: Rebuild.
-
-Tue Nov 7 11:53:48 1995 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (ppc_record_toc_entry): new function.
- (in_reloc_p): changed return value.
- (coff_ppc_relocate_section): much rework.
- (ppc_allocate_toc_section): new function.
- (ppc_process_before_allocation): new function.
- (ppc_coff_swap_sym_in_hook): new function.
-
- * cofflink.c (_bfd_coff_link_hash_newfunc): initialize toc_offset.
- (coff_link_add_symbols): initialize toc_offset.
-
- * peicode.h (coff_swap_sym_in): Added coff_swap_sym_in_hook
- (coff_swap_aouthdr_out): Added more sections to the data
- dictionary for the pe file header. Also changed linker version
- number on the ppc side.
- (dir_names): small improvements to the dictionary printing.
- (pe_mkobject_hook): save the file level flags.
-
- * libcoff-in.h (coff_link_hash_entry): added toc_offset field
- (pe_tdata): added real_flags field
- (coff_tdata): added local_toc_sym_map and access macro
-
- * libcoff.h (coff_link_hash_entry): added toc_offset field
- (pe_tdata): added real_flags field
- (coff_tdata): added local_toc_sym_map and access macro
-
- * coffcode.h (coff_set_alignment_hook): added hook for PE.
- (coff_mkobject): init for local_toc_sym_map
- (coff_write_object_contents): set the internal_a.magic to
- IMAGE_NT_OPTIONAL_HDR_MAGIC which appears to be what other
- ppc compilers use.
-
-Tue Nov 7 13:48:58 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * ecofflink.c (_bfd_ecoff_locate_line): Keep looking through stabs
- entries until both the line number address and the function name
- address are too large.
-
- * configure.in: Call AC_CHECK_PROG to find and cache AR.
- * configure: Rebuilt.
-
- * aclocal.m4 (BFD_CC_FOR_BUILD): Don't define CC_FOR_BUILD if it
- is defined in the environment.
-
-Tue Nov 7 10:57:24 1995 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_get_section_contents_in_window): Define to use
- generic version.
-
-Mon Nov 6 17:13:15 1995 Harry Dolan <dolan@ssd.intel.com>
-
- * coff-i860.c: New file, based on coff-i386.c.
- * cpu-i860.c: New file, based on cpu-i386.c.
- * hosts/i860mach3.h: New file, based on hosts/i386mach3.h.
- * config.bfd (i860-*-mach3*, i860-*-osf1*, i860-*-coff*): New
- targets, using i860coff_vec.
- * configure.in (i860-*-mach3*, i860-*-osf1*): New hosts, using
- trad-core.o and hosts/i860mach3.h.
- (i860coff_vec): Use coff-i860.o and cofflink.o.
- * configure: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (ALL_MACHINES): Add cpu-i860.o.
- (BFD32_BACKENDS): Add coff-i860.o.
- (CFILES): Add cpu-i860.c and coff-i860.c.
- * targets.c (i860coff_vec): Declare.
- (bfd_target_vector): Add &i860coff_vec.
- * archures.c (bfd_i860_arch): Declare.
- (bfd_archures_list): Add &bfd_i860_arch.
- * coffcode.h (coff_set_arch_mach_hook): Handle I860 magic number.
- (coff_set_flags): Handle bfd_arch_i860.
- (coff_write_object_contents): Handle I860 a.out magic number.
-
-Mon Nov 6 14:34:07 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Set the alignment power of
- the created .tc section to 2.
- (xcoff_mark): Don't keep a .loader reloc for a call to an
- undefined symbol when creating a shared library.
- (xcoff_build_ldsyms): When creating a shared library, generate
- global linkage code for a call to an undefined symbol.
-
-Sun Nov 5 21:44:13 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * Makefile.in (CFILES): Rebuild list from BFD_LIBS, ALL_MACHINES,
- BFD32_BACKENDS, BFD64_BACKENDS.
- (.dep1): Put mkdep output in a separate file.
- Rebuilt dependencies.
-
- * ecoff.c (_bfd_ecoff_slurp_armap): Cast _bfd_read_ar_hdr return
- value.
-
- Permit use of mmap when available:
-
- * configure.in: Check for mmap, madvise, mprotect.
- * config.in, configure: Regenerated.
-
- * libbfd.c (struct _bfd_window_internal): Define type.
- (bfd_init_window, bfd_free_window, bfd_get_file_window): New
- functions.
- (ok_to_map): New static variable for debugging.
- (_bfd_generic_get_section_contents_in_window): New function.
- * bfd-in.h (bfd_window_internal): Declare type.
- (bfd_window): Define type.
- (bfd_init_window, bfd_free_window, bfd_get_file_window): Declare.
- * libbfd-in.h (_bfd_generic_get_section_contents_in_window):
- Declare.
-
- * libaout.h (struct aoutdata): Add two window fields.
- (obj_aout_sym_window, obj_aout_string_window): New macros.
- * aoutx.h (some_aout_object_p): Initialize windows.
- (aout_get_external_symbols): Get symbol data and strings in
- windows instead of explicitly allocated buffers.
- (slurp_symbol_table): Free window instead of memory.
- (bfd_free_cached_info): Release windows instead of freeing storage
- directly.
- (aout_link_free_symbols): Ditto.
-
- * targets.c (bfd_target): Add new field for
- get_section_contents_in_window.
- (BFD_JUMP_TABLE_GENERIC): Updated.
- * aout-adobe.c, aout-target.h, binary.c, bout.c, coff-alpha.c,
- coff-mips.c, elfxx-target.h, i386msdos.c, i386os9k.c, ieee.c,
- libcoff-in.h, oasys.c, srec.c, tekhex.c, versados.c: Added new
- macros for get_section_contents_in_window field.
-
-Sat Nov 4 12:23:26 1995 Fred Fish <fnf@cygnus.com>
-
- * core.c: Renamed to corefile.c
- * makefile.dos (OBJS): Change core.o to corefile.o
- * Makefile.in (CFILES, BFD_LIBS): Use corefile.c instead of core.c
-
-Fri Nov 3 15:54:59 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Rename local variable sub
- to o. Clobber and restore the list of new csects around the call
- to _bfd_generic_link_add_one_symbol, in case it wants to report a
- linker error and the linker wants to read the symbol table. Reset
- the line number count of a real section even if it has no relocs.
- (_bfd_xcoff_bfd_final_link): If shared, set the DYNAMIC flag.
-
- * coffgen.c (_bfd_coff_read_string_table): Warn if the string size
- is too small.
-
-Thu Nov 2 23:16:39 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (_bfd_ppc_xcoff_relocate_section): Don't warn about
- an undefined symbol in a shared link.
-
- * linker.c (_bfd_generic_link_add_one_symbol): Correct type of
- oldtype from bfd_link_order_type to bfd_link_hash_type. From
- phdm@info.ucl.ac.be (Philippe De Muyter).
-
-Wed Nov 1 14:26:02 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de>
-
- * coff-m88k.c (rtype2howto): New static function.
- (RTYPE2HOWTO): Use it rather than a macro definition.
-
- * coffcode.h (coff_write_object_contents): set internal_a.magic
- to PAGEMAGICPEXECPAGED #if defined (M68) && !defined (LYNXOS).
-
- * configure.in: m68*-motorola-sysv* does not use ptrace-core.o;
- define TRAD_HEADER to new file hosts/delta68.h.
- m88*-motorola-sysv*, however, does use ptrace-core.o.
- * hosts/delta68.h: New file.
-
- * ptrace-core.c (ptrace_unix_core_file_p): change bfd_zmalloc to
- bfd_zalloc; provide proper parm abfd to calls to bfd_zalloc.
-
-Wed Nov 1 13:51:54 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * i386linux.c (MY(vec)): Declare before use.
-
-Wed Nov 1 11:45:07 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * reloc16.c (bfd_coff_reloc16_get_relocated_section_contents):
- Pass input_bfd, not in_bfd, to bfd_coff_reloc16_extra_cases.
-
- * elf.c (bfd_elf_set_dt_needed_name): Don't do anything if the
- BFD is not of the right type.
- (bfd_elf_get_needed_list): Likewise.
- * i386linux.c (bfd_linux_size_dynamic_sections): Likewise.
- * sunos.c (bfd_sunos_get_needed_list): Likewise.
- * xcofflink.c (XCOFF_XVECP): Define.
- (bfd_xcoff_link_record_set): Don't do anything if the BFD is not
- of the right type.
- (bfd_xcoff_import_symbol): Likewise.
- (bfd_xcoff_export_symbol): Likewise.
- (bfd_xcoff_link_count_reloc): Likewise.
- (bfd_xcoff_record_link_assignment): Likewise.
- (bfd_xcoff_size_dynamic_sections): Likewise.
-
- * sunos.c (sunos_scan_ext_relocs): Only check the reloc symbol
- table index against the number of symbols for a base relative
- reloc.
-
- * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Change from macro to
- static function.
- * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Set
- full_aouthdr flag here...
- (_bfd_xcoff_bfd_final_link): ...not here.
-
-Tue Oct 31 12:52:02 1995 Fred Fish <fnf@cygnus.com>
-
- * libelf.h: Rename to elf-bfd.h to avoid conflict with
- systems that have a system <libelf.h>.
- * Makefile.in: Globally replace libelf.h with elf-bfd.h.
- * bfd.c, elf.c, elf32-arc.c, elf32-gen.c, elf32-hppa.c,
- elf32-hppa.h, elf32-i386.c, elf32-i860.c, elf32-m68k.c,
- elf32-m88k.c, elf32-mips.c, elf32-ppc.c, elf32-sparc.c,
- elf64-gen.c, elf64-sparc.c, elfcode.h, elflink.c,
- elfxx-target.h: Include elf-bfd.h rather than libelf.h.
- * elfxx-target.h: Change libelf.h reference to elf-bfd.h.
-
-Tue Oct 31 15:30:07 1995 David Mosberger-Tang <davidm@azstarnet.com>
-
- * ecoff.c (ecoff_set_symbol_info): Add new parameter weak. If
- set, set BSF_WEAK in symbol. Change all callers.
- (ecoff_get_extr): Set weakext based on BSF_WEAK.
- (ecoff_link_add_externals): If weakext is set, pass BSF_WEAK to
- _bfd_generic_link_add_one_symbol.
- (ecoff_indirect_link_order): Check that the section tdata relocs
- are not NULL before using them.
-
- * configure.in (alpha*-*-linux*): Set COREFILE to trad-core.o and
- define TRAD_HEADER as hosts/alphalinux.h.
- * configure: Rebuild.
- * hosts/alphalinux.h: New file.
- * trad-core.c (trad_unix_core_file_p): Cast u.u_ar0 to bfd_vma,
- not int.
-
-Tue Oct 31 12:34:11 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_slurp_symbol_table): Accept C_BCOMM and
- C_ECOMM storage classes.
-
- * xcofflink.c (xcoff_mark_symbol): New static function, broken out
- of xcoff_mark.
- (xcoff_mark): Call xcoff_mark_symbol.
- (bfd_xcoff_export_symbol): Call xcoff_mark_symbol.
- (bfd_xcoff_link_count_reloc): Call xcoff_mark_symbol rather than
- doing it by hand.
- (xcoff_build_ldsyms): Build a .loader symbol for an export symbol.
-
-Mon Oct 30 14:53:48 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (struct xcoff_final_link_info): Add new line_filepos
- field.
- (xcoff_find_reloc): New static function.
- (xcoff_link_add_symbols): Use it.
- (_bfd_xcoff_bfd_final_link): Set finfo.line_filepos.
- (xcoff_link_input_bfd): Handle C_BINCL and C_EINCL. Don't
- relocate the value of C_DECL.
-
- * elf.c (elf_fake_sections): Remove bogus BFD_ASSERT.
-
-Sat Oct 28 01:25:34 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Make
- callback decide what goes in .relocs.
- * pe[i]-i386.c (TARGET_UNDERSCORE): Define.
- * peicode.h (pe_mkobject_hook): Only copy aouthdr if
- there is one.
-
-Sat Oct 28 01:51:02 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Handle csects in the
- absolute section.
-
-Fri Oct 27 18:14:39 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c: More improvements, mostly to fix handling of
- constructors and a few other special cases.
- * coff-rs6000.c (rs6000coff_vec): Set symbol_leading_char back to
- zero, reverting yesterday's change.
- * bfd-in.h (bfd_xcoff_link_record_set): Declare.
- (bfd_xcoff_link_count_reloc): Declare.
- (bfd_xcoff_record_link_assignment): Declare.
- * bfd-in2.h: Rebuild.
-
-Fri Oct 27 14:42:15 1995 Niklas Hallqvist <niklas@appli.se>
-
- * PORTING, aout-arm.c, aout-encap.c, aout-target.h,
- aoutx.h, gen-aout.c, host-aout.c, hp300bsd.c, i386aout.c
- i386bsd.c, i386dynix.c, i386linux.c, i386lynx.c, i386mach3.c,
- i386netbsd.c, m68klynx.c, m88kmach3.c, mipsbsd.c, newsos3.c,
- ns32knetbsd.c, pc532-mach.c, riscix.c, sparclynx.c, sparcnetbsd.c:
- Change PAGE_SIZE to TARGET_PAGE_SIZE.
-
- * m68knetbsd.c: Ditto as well as add support for the m68k4k object
- format.
-
- * netbsd.h: Double ditto (incl. m68k4k support). NetBSD's text
- segments includes the a.out header. See to that the magic number
- *always* is big-endian.
-
- * config.bfd: Add m68*-hp*-netbsd* case. Cross-pollinate m68k and
- m68k4k NetBSD configurations.
-
- * configure.in, configure: Separate i386 & mips NetBSD
- configurations from other BSD ones. Don't assume DEC is the only
- thing NetBSD/mips run on. Add {m68k,ns32k,sparc}-*-netbsd*
- configurations. Add support for m68k4k NetBSD object format.
-
- * libaout.h: Added M_68K4K_NETBSD magic.
-
- * m68k4knetbsd.c: New file.
-
- * hosts/{m68k,sparc}nbsd.h: Don't define HOST_BIG_ENDIAN_P.
-
- * hosts/nbsd.h: Define HOST_BIG_ENDIAN_P according to
- <machine/endian.h>.
-
- * hosts/mipsnbsd.h: New file.
-
-Thu Oct 26 14:16:47 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c: Numerous changes to get closer to a working XCOFF
- linker.
- * libcoff-in.h (struct xcoff_tdata): Add full_aouthdr,
- toc_section, and entry_section fields.
- (struct xcoff_section_tdata): Remove ldrel_count field.
- * libcoff.h: Rebuild.
- * coffcode.h (coff_mkobject_hook): Initialize new xcoff_data
- fields.
- (coff_compute_section_file_positions): If RS6000COFF_C, generate
- full a.out header if full_aouthdr is set in xcoff_data.
- (coff_write_object_contents): Likewise. Set o_snentry and o_sntoc
- based on sections stored in xcoff_data.
- * coff-rs6000.c (xcoff_copy_private_bfd_data): Copy new xcoff_data
- fields.
- (xcoff_reloc_type_lookup): Handle BFD_RELOC_CTOR.
- (rs6000coff_vec): Set symbol_leading_char to '.'.
- * coffgen.c (coff_get_symbol_info): If fix_value is set, fix the
- value stored in ret rather than returning a pointer value.
-
-Wed Oct 25 23:10:39 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * config.bfd (powerpc{,le}-{elf,sysv4,eabi,solaris2}): Remove MAC
- format for now.
-
-Wed Oct 25 16:19:27 1995 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_slurp_string_table): Allocate the strings with malloc
- since they're free'd by free_cached_info.
- (som_slurp_symbol_table): Similarly for the symbol table.
-
-Wed Oct 25 14:59:22 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Makefile.in (diststuff): Don't make headers.
-
-Wed Oct 25 11:32:54 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in: Rebuild dependencies.
-
- * sunos.c (bfd_sunos_record_link_assignment): Don't do anything if
- output_bfd is not SunOS.
- (bfd_sunos_size_dynamic_sections): Likewise. Don't scan relocs of
- non-SunOS input files.
-
- * xcofflink.c: Extensive changes to support linking shared objects
- and generating a .loader section.
- * libcoff-in.h (struct xcoff_tdata): Add import_file_id field.
- (struct xcoff_section_tdata): Add lineno_count, first_symndx,
- last_symndx, and ldrel_count fields.
- * libcoff.h: Rebuild.
- * coff-rs6000.c (xcoff_howto_table): Correct reloc names.
- * coffcode.h (styp_to_sec_flags): Don't set any flags if STYP_PAD
- is set.
- * bfd-in.h (bfd_xcoff_import_symbol): Declare.
- (bfd_xcoff_export_symbol): Declare.
- (bfd_xcoff_size_dynamic_sections): Declare.
- * bfd-in2.h: Rebuild.
-
-Tue Oct 24 17:44:20 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * configure.in: Add xcofflink.o to pmac_xcoff_vec.
- * configure: Rebuild.
- * mpw-config.in: Add xcofflink.c.o to powerpc-apple-macos.
- * coff-pmac.c: Include coff-rs6000.c instead of duplicating its
- contents.
- (pmac_xcoff_vec): Update to use new xcoff support.
- * coff-rs6000.c (xcoff_generic_stat_arch_elt): Make static.
- (xcoff_write_armap): Declare buf as unsigned char.
- * xcofflink.c (xcoff_link_add_symbols): Declare a local as PTR.
-
- * mpw-make.sed: Generalize subdir_do edit.
-
-Tue Oct 24 10:25:01 1995 Jeffrey A Law (law@cygnus.com)
-
- * hppabsd-core.c (make_bfd_asection): Initialize asect->filepos
- correctly. Don't initialize asect->vma.
-
-Fri Oct 20 13:23:48 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * opncls.c (_bfd_new_bfd): If _bfd_chunksize wasn't preset, use
- something a little less than the page size.
-
-Thu Oct 19 13:06:09 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i960.c (coff_i960_adjust_symndx): Clear *adjustedp.
-
-Wed Oct 18 16:20:08 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * coff-i386.c (coff_i386_reloc_type_lookup): New.
- * coffcode.h (coff_write_object_contents): If .bss is before
- .data us that as data_start.
- * cofflink.c (_bfd_coff_generic_relocate_section): Get reloc
- calc correct.
- * peicode.h (add_data_entry): Use _cooked_size of data directory.
- (coff_swap_outhdr_out): Hardwire in version number.
-
-Wed Oct 18 16:50:54 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * sunos.c (sunos_add_dynamic_symbols): Rename local variables
- major and minor to *_vno, since the former are also macros in
- SunOS header files. Cast result of bfd_alloc to appropriate
- type.
-
- * coffgen.c (coff_find_nearest_line): Cast used_by_bfd value
- before assigning to sec_data.
-
-Wed Oct 18 13:25:17 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (_bfd_ecoff_find_nearest_line): The offset argument is
- now relative to the section, not absolute.
- * ecofflink.c (_bfd_ecoff_locate_line): Use the right symbol to
- get the file name when there is a N_SO directory name. When
- handling stabs, remember that section->vma was added to the
- offset.
-
-Tue Oct 17 18:24:54 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (struct sunos_link_hash_table): Add needed field.
- (sunos_link_hash_table_create): Call bfd_release, not free.
- (sunos_link_hash_table_create): Initialize needed field.
- (sunos_add_dynamic_symbols): Record needed objects.
- (bfd_sunos_get_needed_list): New function.
- * bfd-in.h (bfd_sunos_get_needed_list): Declare.
- * bfd-in2.h: Rebuild.
-
-Mon Oct 16 14:43:59 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * libcoff-in.h (pe_data_type.in_reloc_p): New.
-
-Mon Oct 16 10:52:50 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd-in.h (struct bfd_link_needed_list): Rename from
- bfd_elf_link_needed_list.
- * bfd-in2.h: Rebuild.
- * elf.c, elflink.h, libelf.h: Corresponding changes.
-
- Add start at AIX linker support; no shared libraries yet.
- * xcofflink.c: New file.
- * configure.in (rs600coff_vec): Use xcofflink.o.
- * configure: Rebuild.
- * libcoff-in.h (struct xcoff_tdata): Add csects and debug_indices
- fields.
- (struct xcoff_section_tdata): Define.
- (xcoff_section_data): Define macro.
- (_bfd_xcoff_bfd_link_hash_table_create): Declare.
- (_bfd_xcoff_bfd_link_add_symbols): Declare.
- (_bfd_xcoff_bfd_final_link): Declare.
- (_bfd_ppc_xcoff_relocate_section): Declare.
- * libcoff.h: Rebuild.
- * coff-rs6000.c: Clean up a bit.
- (xcoff_mkobject): Default modtype to 1L, not RE. Initialize
- cputype, csects, and debug_indices.
- (xcoff_copy_private_bfd_data): Copy cputype.
- (xcoff_howto_table): Rename from rs6000coff_howto_table.
- (xcoff_rtype2howto): Rename from rs6000coff_rtype2howto.
- (xcoff_reloc_type_lookup): Rename from
- rs6000coff_reloc_type_lookup.
- (coff_relocate_section): Define.
- (_bfd_xcoff_sizeof_headers): Define.
- (_bfd_xcoff_bfd_get_relocated_section_contents): Define.
- (_bfd_xcoff_bfd_relax_section): Define.
- (_bfd_xcoff_bfd_link_split_section): Define.
- (rs6000coff_vec): For BFD_JUMP_TABLE_LINK, use _bfd_xcoff, not
- coff.
- * coffcode.h (coff_compute_section_file_positions): If AIX,
- increment sofar by SMALL_AOUTSZ if not executable.
- (coff_write_object_contents): If AIX, always output an a.out
- header; if not executable, header size of SMALL_AOUTSZ.
- * hash.c (struct bfd_strtab_hash): Add xcoff field.
- (_bfd_stringtab_init): Initialize xcoff field.
- (_bfd_xcoff_stringtab_init): New function.
- (_bfd_stringtab_add): In XCOFF mode, leave two bytes for length.
- (_bfd_stringtab_emit): In XCOFF mode, write out length.
- * libbfd-in.h (_bfd_xcoff_stringtab_init): Declare.
- * libbfd.h: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add xcofflink.o.
- (CFILES): Add xcofflink.c.
-
- * elf32-mips.c (mips_elf_symbol_processing): Set SEC_ALLOC, not
- SEC_NO_FLAGS, for .acommon section. From Peter Schauer
- <Peter.Schauer@Regent.E-Technik.TU-Muenchen.DE>.
-
-Sat Oct 14 21:36:02 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * coff-ppc.c (in_reloc_p): Add, clone from coff-i386.c.
-
-Fri Oct 13 17:48:43 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * acconfig.h (HAVE_SYS_PROCFS_H): Undef, with comment.
- * config.in: Regenerated.
-
- * opncls.c (getpagesize) [!HAVE_GETPAGESIZE]: Define as 2048.
- (_bfd_chunksize): New variable.
- (_bfd_new_bfd): Set it to getpagesize() if negative, and use it
- for obstack chunk size.
- * configure.in: Check for getpagesize.
- * configure: Regenerated.
-
- Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * trad-core.c (rawptr): Make it a local variable of
- ptrace_unix_core_file_p.
-
-Fri Oct 13 11:22:01 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * coff-arm.c (in_reloc_p): New.
- * coff-i386.c (in_reloc_p): New.
- * coffcode.h: Allways include peicode.h if COFF_WITH_PE.
- (coff_write_object_contents): Only set has_reloc_section
- if PE_IMAGE.
- * cofflink.c (_bfd_coff_generic_relocate_section): Call
- in_reloc_p to decide if reloc should be emitted.
- * libcoff.h (pe_data_type.in_reloc_p): New.
- * peicode.h (pe_mkobject): Initialize in_reloc_p.
-
-Wed Oct 11 00:49:29 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_internal_syment_name): Move to coffgen.c.
- (_bfd_coff_read_internal_relocs): Likewise.
- * coffgen.c (_bfd_coff_internal_syment_name): Copy from coffgen.c.
- (_bfd_coff_read_internal_relocs): Likewise.
-
- * elflink.h (elf_link_add_object_symbols): Correct conditions
- under which type and size change warnings are issued.
-
-Tue Oct 10 18:32:46 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffgen.c (coff_count_linenumbers): Don't count line numbers for
- a symbol which is not in a real section.
- (coff_write_native_symbol): Corresponding change.
-
- * cofflink.c (_bfd_coff_link_hash_newfunc): Rename from
- coff_link_hash_newfunc and make non-static.
- (_bfd_coff_link_hash_table_init): New function, broken out of
- _bfd_coff_link_hash_table_create.
- (_bfd_coff_link_hash_table_create): Use it.
- (process_embedded_commands): Make static.
- * libcoff-in.h ((_bfd_coff_link_hash_newfunc): Declare.
- (_bfd_coff_link_hash_table_init): Declare.
- * libcoff.h: Rebuild.
-
- * coffcode.h (coff_mkobject_hook): If RS6000COFF_C, set cputype
- field in XCOFF tdata.
- (coff_set_arch_mach_hook): Check ifdef RS6000COFF_C, not ifdef
- U802ROMAGIC, for clarity. Try to set arch and machine correctly
- based on cputype stored in a.out header, or in n_type of initial
- .file symbol.
- (coff_write_object_contents): Set cputype correctly in a.out
- header.
- (coff_slurp_symbol_table): Add casts to file_ptr to avoid
- warnings.
- * coffswap.h (coff_swap_aouthdr_in): Swap in cputype field.
- (coff_swap_aouthdr_out): Swap out cputype field. Don't clear
- old resv1 field.
- * libcoff-in.h (struct xcoff_tdata): Add cputype field.
- * libcoff.h: Rebuild.
-
- * cpu-rs6000.c (rs6000_compatible): New static function.
- (bfd_rs6000_arch): Use it.
- * cpu-powerpc.c (powerpc_compatible): New static function.
- (arch_info_struct): Define various flavours of PowerPC.
- (bfd_powerpc_arch): Use powerpc_compatible. Point at
- arch_info_struct.
-
-Tue Oct 10 10:50:46 1995 Fred Fish <fnf@cygnus.com>
-
- * Makefile.in (FLAGS_TO_PASS): Remove BISON.
-
-Tue Oct 10 01:28:29 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't warn about
- changing the size or type if the old definition was weak.
-
-Mon Oct 9 11:24:08 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (combined_entry_type): Add fix_line field.
- (coff_slurp_line_table): Warn if we try to set the lineno field of
- a symbol twice.
- (coff_slurp_symbol_table): If RS6000COFF_C, handle C_BINCL and
- C_EINCL by setting fix_line. Fix C_BSTAT symbol value.
- * coffgen.c (coff_mangle_symbols): Handle fix_line.
- (coff_write_symbol): Only use N_DEBUG if the symbol is in the
- absolute section.
- (coff_print_symbol): Print fix_value symbols in a useful fashion.
- * libcoff.h: Rebuild.
-
- * libcoff-in.h (struct xcoff_tdata): Define.
- (xcoff_data): Define.
- * bfd.c (struct _bfd): Add xcoff_obj_data field to tdata union.
- * bfd-in2.h, libcoff.h: Rebuild.
- * coff-rs6000.c (xcoff_mkobject): New static function.
- (coff_mkobject): Define.
- (xcoff_copy_private_bfd_data): New static function.
- (coff_bfd_copy_private_bfd_data): Define.
- (rs6000coff_howto_table): Change R_TOC complain_on_overflow from
- signed to bitfield.
- (rs6000coff_vec): Add DYNAMIC to object_flags.
- * coffcode.h (sec_to_styp_flags): If RS6000COFF_C, handle .pad and
- .loader sections specially.
- (coff_new_section_hook): If RS6000COFF_C, get the .text and .data
- section alignment from the XCOFF tdata information.
- (coff_mkobject_hook): If RS6000COFF_C, set DYNAMIC based on
- F_SHROBJ, and copy the extra a.out header information into the
- XCOFF tdata structure.
- (coff_write_object_contents): If RS6000COFF_C, set F_SHROBJ,
- F_DYNLOAD and the extra a.out header information.
- (coff_slurp_symbol_table): Set BSF_NOT_AT_END for a C_EXT or
- C_HIDEXT symbol with attached csect information.
- * coffswap.h (coff_swap_aouthdr_in): If RS6000COFF_C, swap
- in the o_maxdata field.
- (coff_swap_aouthdr_out): If RS6000COFF_C, swap extra XCOFF fields.
- * coffgen.c (coff_renumber_symbols): Don't move any symbol to the
- end if BSF_NOT_AT_END is set.
-
- * targets.c (bfd_target): Rename _bfd_read_ar_hdr field to
- _bfd_read_ar_hdr_fn.
- * libbfd-in.h (_bfd_read_ar_hdr): Update accordingly.
- * bfd-in2.h, libbfd.h: Rebuild.
- * archive.c (_bfd_get_elt_at_filepos): Cast _bfd_read_ar_hdr
- return value.
- (do_slurp_bsd_armap, do_slurp_coff_armap): Likewise.
- (bfd_slurp_bsd_armap_f2): Likewise.
- (_bfd_slurp_extended_name_table): Likewise.
-
-Fri Oct 6 16:18:35 1995 Ken Raeburn <raeburn@cygnus.com>
-
- Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * archive.c (bfd_get_next_mapent): Return BFD_NO_MORE_SYMBOLS
- when the symbol table is empty.
-
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Don't reserve
- space for section symbols, since we don't output them either.
- (elf_m68k_adjust_dynindx): Removed.
-
- * ptrace-core.c (rawptr): Make it a local variable of
- ptrace_unix_core_file_p.
-
-Fri Oct 6 12:24:47 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * coff-rs6000.c (xcoff_write_archive_contents): Return false, not
- NULL.
-
- * config.bfd (powerpc{,le}-{elf,sysv4,eabi,solaris2}): Add NT, and
- Mac object file formats.
-
-Fri Oct 6 12:04:02 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffgen.c (coff_fix_symbol_name): Don't try to set up file
- auxent if there isn't one.
- (coff_write_symbols): If there is no file auxent, use SYMNMLEN
- rather than FILNMLEN as the maximum name length.
-
- * coffcode.h (bfd_coff_backend_data): Add new field
- _bfd_coff_print_aux.
- (bfd_coff_print_aux): New static function.
- (coff_pointerize_aux_hook (RS6000COFF_C version)): Pointerize the
- scnlen field of an XTY_LD csect aux entry.
- (coff_print_aux): New static function.
- (coff_slurp_symbol_table): Don't pointerize scnlen field; now done
- in coff_pointerize_aux_hook.
- (bfd_coff_std_swap_table): Initialize new field.
- * coffgen.c (coff_print_symbol): Call bfd_coff_print_aux.
- * libcoff.h: Rebuild.
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
-
- * coffcode.h (coff_write_object_contents): On AIX, clear F_RELFLG
- if there are symbols, for native AIX ld compatibility.
-
- * coffcode.h (bfd_coff_backend_data): Add new field
- _bfd_coff_pointerize_aux_hook.
- (coff_pointerize_aux_hook): Define as a function if RS6000COFF_C
- or I960, and as 0 otherwise.
- (bfd_coff_std_swap_table): Initialize new field.
- * libcoff.h: Rebuild.
- * coffgen.c (coff_pointerize_aux): Change parameters to take
- symbol pointer instead of type and class, and to take aux index.
- Call _bfd_coff_pointerize_aux_hook if it is defined.
- (coff_get_normalized_symtab): Always call coff_pointerize_aux.
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize all fields.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
-
- * coff-rs6000.c: Add full support for AIX archives. Rewrite old
- read-only/host-only support.
-
- * coffcode.h (coff_slurp_symbol_table): Set C_HIDEXT symbols to be
- BSF_LOCAL.
- (OTHER_GLOBAL_CLASS): Do not define to be C_HIDEXT if
- RS6000COFF_C.
-
- * targets.c (bfd_target): Add _bfd_read_ar_hdr field. Modify
- BFD_JUMP_TABLE_ARCHIVE accordingly.
- * libbfd-in.h (_bfd_snarf_ar_hdr): Don't declare.
- (_bfd_compute_and_write_armap): Declare.
- (_bfd_generic_read_ar_hdr): Declare.
- (_bfd_read_ar_hdr): Define.
- (_bfd_noarchive_read_ar_hdr): Define.
- (_bfd_archive_bsd_read_ar_hdr): Define.
- (_bfd_archive_coff_read_ar_hdr): Define.
- * archive.c: Change all callers of _bfd_snarf_ar_hdr to call
- _bfd_read_ar_hdr instead.
- (_bfd_generic_read_ar_hdr): Rename from _bfd_snarf_ar_hdr.
- (_bfd_compute_and_write_armap): Rename from
- compute_and_write_armap. Make non-static. Change all callers.
- * ecoff.c (_bfd_ecoff_slurp_armap): Call _bfd_read_ar_hdr rather
- than _bfd_snarf_ar_hdr.
- * aout-target.h (MY_read_ar_hdr): Define if not defined.
- * ieee.c (ieee_read_ar_hdr): Define.
- * libecoff.h (_bfd_ecoff_read_ar_hdr): Define.
- * oasys.c (oasys_read_ar_hdr): Define.
- * som.c (som_read_ar_hdr): Define.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-Thu Oct 5 14:04:07 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * peicode.c (coff_swap_filehdr_in): If symptr is
- zero, there aren't any symbols, even if nsyms is set.
-
-Thu Oct 5 11:45:02 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * libecoff.h (struct ecoff_backend_data): Add adjust_headers
- field.
- * ecoff.c (ecoff_sec_to_styp_flags): Check for various Alpha
- sections, and set styp correctly for them: .got, .hash, .dynamic,
- .liblist, .rel.dyn, .conflic, .dynstr, .dynsym, .comment.
- (_bfd_ecoff_styp_to_sec_flags): Check for various Alpha section
- types.
- (ecoff_sort_hdrs): New static function.
- (ecoff_compute_section_file_positions): Return boolean, not void.
- Sort the sections by VMA before looking through them. Put the
- first non SEC_ALLOC section on a new page. Put every SEC_ALLOC
- section on an appropriate boundary within the page.
- (ecoff_compute_reloc_file_positions): Check return value of
- ecoff_compute_section_file_positions.
- (_bfd_ecoff_set_section_contents): Likewise.
- (_bfd_ecoff_write_object_contents): Check for various Alpha
- section types when incrementing text_size and data_size. Call
- adjust_headers backend function if it exists.
- * coff-alpha.c (alpha_adjust_headers): New static function.
- (alpha_ecoff_backend_data): Initialize adjust_headers field.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
-
- * hosts/i386bsd.h: Restore file incorrectly deleted on Sep 6.
-
-Wed Oct 4 18:15:02 1995 Jeff Law (law@hurl.cygnus.com)
-
- * rs6000-core.c (CORE_VERSION_1): Use CORE_VERSION_1 instead
- of ALTERNATE_AIX_CORE_FORMAT.
- * configure.in (aix4): No longer need CORE_FLAGS.
- * configure: Updated.
-
-Wed Oct 4 15:36:36 1995 Ken Raeburn <raeburn@cygnus.com>
-
- NS32k changes from Ian Dall:
- * aoutx.h (MY_final_link_relocate, MY_relocate_contents): New
- macros.
- (aout_link_input_section_std, aout_link_input_section_ext,
- aout_link_reloc_link_order): Call them instead of _bfd_*
- versions.
- * aout-target.h (MY_exec_header_not_counted): New macro, defaults
- to zero.
- (backend_data): Use it instead of hardcoded zero.
-
- * aout-ns32k.c (CTOR_TABLE_RELOC_HOWTO): New macro.
- (MY_swap_std_reloc_out): Use udata.i for KEEPIT, don't call stoi.
-
- * ns32knetbsd.c: Include bfd.h.
- (MY_text_includes_header, MY_bfd_reloc_type_lookup): New macros.
- (MY_bfd_reloc_type_lookup): Declare function too.
- * pc532-mach.c (set_sizes): Don't declare.
- (MY_text_includes_header, MY_exec_header_not_counted): Define.
- (backend_data, MY_backend_data): Don't define.
-
- * config.bfd: Treat ns32k-pc532-ux* like ns32k-pc532-mach*, and
- ns32k-*-lites* like ns32k-*-netbsd*.
-
- * hosts/nbsd.h: Swap order of sys/vmparam.h and sys/param.h, to
- compile on lites.
-
-Wed Oct 4 14:15:52 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_write_object_contents): Restore setting
- f_timdat to 0, deleted on August 22.
-
-Tue Oct 3 16:28:32 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * coffcode.h (coff_bfd_copy_private_symbol_data,
- coff_bfd_copy_private_section_data,
- coff_bfd_copy_private_bfd_data): ifdef to allow overrides.
- * peicode.h (coff_bfd_copy_private_bfd_data): New
- (pe_bfd_copy_private_bfd_data): New.
- (coff_swap_scnhdr_in): Swap bss size into the right place.
- (pe_print_private_bfd_data): Add some newlines.
-
-Tue Oct 3 11:53:04 1995 Jeff Law (law@hurl.cygnus.com)
-
- * som.c (setup_sections): Don't die if a space has no subspaces.
-
-Mon Oct 2 14:08:55 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't let a weak
- dynamic symbol override a common symbol. Don't change the size or
- type if they have been set and the new symbol is not a definition.
- Warn if the size or type changes.
-
-Sun Oct 1 01:34:41 1995 Jeff Law (law@hurl.cygnus.com)
-
- * som.c (som_begin_writing): Don't write the symbol table or
- symbol strings.
- (som_finish_writing): Write them here. Place them after the
- subspace data, but before the relocs.
-
-Fri Sep 29 11:01:55 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_add_one_symbol): Just pass false, not
- info->shared_library, to sunos_create_dynamic_sections.
- (sunos_scan_ext_relocs): Don't warn about a reloc in the .text
- section.
- (sunos_check_dynamic_reloc): Remove .text section assertion.
-
-Thu Sep 28 18:48:47 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * config.bfd: Add powerpc-*-macos*, powerpc-*-mpw*.
- * configure, configure.in: Add pmac_xcoff_vec case.
- * Makefile.in (BFD32_BACKENDS): Add coff-pmac.o.
- * coff-pmac.c: New file, PowerMac XCOFF support.
- * coffcode.h (coff_set_arch_mach_hook): Add PowerMac case.
- * targets.c (pmac_xcoff_vec): Declare.
-
- * mpw-config.in: Various changes to be compatible with the
- autoconf-based configury.
- * mpw-make.sed: New file, sed commands to translate Unix
- makefile into MPW syntax.
- * mpw-make.in: Remove.
- * hosts/mpw.h: Remove.
- * bfd-in.h, bfd-in2.h: If MPW, include the file that defines
- true and false as enums, then define TRUE_FALSE_ALREADY_DEFINED.
-
-Thu Sep 28 17:06:23 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * binary.c (binary_get_symtab): Return an empty string on error.
- * opncls.c (bfd_fdpenr): Change WIN32 restriction to WINGDB.
-
-Thu Sep 28 15:30:44 1995 Kim Knuttila <krk@nellie>
-
- * coff-ppc.c: Reformatted according to gnu conventions
- Removed irrelevant "if 0" code
-
-Thu Sep 28 11:19:53 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * hp300hpux.c (convert_sym_type): Treat secondary symbols as weak
- symbols rather than as indirect symbols.
- (MY(slurp_symbol_table)): Don't do anything special about
- secondary symbols.
-
- * coffcode.h (coff_new_section_hook): Make sure that the alignment
- of .ctors and .dtors sections is no larger than 2.
-
- * sunos.c (sunos_add_one_symbol): Don't change
- bfd_link_hash_common to bfd_link_hash_new, since it may be on the
- undef list.
- (bfd_sunos_record_link_assignment): Don't put __DYNAMIC in the
- dynamic symbols when creating a shared library.
- (sunos_scan_ext_relocs): Handle relocs correctly when creating a
- shared library.
- (sunos_scan_dynamic_symbol): Don't mark the __DYNAMIC symbol as
- written even if it is not defined in a regular object.
- (sunos_write_dynamic_symbol): Use plt_offset for the address of
- the jump table reloc. Add an assertion. Use RELOC_JMP_SLOT
- rather than the constant 22.
- (sunos_check_dynamic_reloc): Handle creating a shared library.
- (sunos_finish_dynamic_link): Set the first entry in the GOT to
- zero when creating a shared library.
- * aoutx.h (NAME(aout,final_link)): If there is a symbol __DYNAMIC,
- write it out at the start of the symbol table.
-
- * Makefile.in (BFD32_BACKENDS): Add coff-arm.o.
-
-Thu Sep 28 00:58:05 1995 Doug Evans <dje@deneb.cygnus.com>
-
- * config.bfd: Add arm-*-coff.
- * configure.in, configure: Add armcoff_{little,big}_vec.
- * targets.c (armcoff_{little,big}_vec): Declare.
- (bfd_target_vector): Add armcoff_{little,big}_vec.
- * coff-arm.c (armcoff_{little,big}_vec): Always define.
-
-Wed Sep 27 10:37:14 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * targets.c (bfd_find_target): Remove debugging code.
-
-Wed Sep 27 07:23:39 1995 Kim Knuttila <krk@nellie>
-
- * coff-ppc.c, pe-ppc.c, pei-ppc.c: Initial bfd for coff/PE
- support on powerpc.
- * Makefile.in: added *-ppc files
- * coffcode.h: ppc MAGIC, and use peicode.h rather than coffswap.h to
- allow pe based .o's to be shared with other tools on ppc/NT
- * config.bfd: added powerpc[le]-[pe|winnt] config support
- * configure, configure.in: added bfd_powerpc[le]_pe[i]_vec
- * peicode.h: Added more section flags for PE on ppc
- Added coff_swap_filehdr_out to allow peicode.h to be
- used for non-image PE files on ppc.
- Check for image, or not, before copying pe_opthdr
- * targets.c: Added new bfd's
- * targets.c: Removed two inactive bfds that shouldn't have made it this
- far.
-
-Tue Sep 26 14:06:41 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_reloc_type): Rename from reloc_type, and use
- explicit values to initialize all relocs. Change all users.
- (ppc_elf_brtaken_inner): New function to handle branch predicition
- relocs.
- (ppc_elf_brtaken_reloc): Ditto.
- (ppc_elf_howto_raw): Use new functions. Make sure all unsupported
- relocs use ppc_elf_unsupported_reloc.
- (ppc_elf_merge_private_bfd_data): Keep track of whether an error
- needs to be reported.
- (ppc_elf_relocate_section): Support branch prediction relocs.
-
-Tue Sep 26 12:48:05 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd.c (bfd_assert): Remove \n from string passed to
- _bfd_error_handler.
-
- * coff-i386.c: (TWO_DATA_SECS): Don't define.
- * coffcode.h (bfd_coff_backend_data): Remove _bfd_make_section_hook.
- (bfd_coff_make_section_hook): Don't define.
- (coff_make_section_hook): Remove.
- (sec_to_styp_flags): Remove TWO_DATA_SECS case.
- (styp_to_sec_flags): Likewise.
- (coff_write_object_contents): Likewise.
- (bfd_coff_std_swap_table): Don't initialize make_section_hook
- field.
- * libcoff.h: Rebuild.
- * coffgen.c (make_a_section_from_file): Just call
- bfd_make_section_anyway, not bfd_make_section or
- bfd_coff_make_section_hook.
- * ecoff.c (_bfd_ecoff_make_section_hook): Remove.
- * libecoff.h (_bfd_ecoff_make_section_hook): Don't declare.
- * coff-alpha.c (alpha_ecoff_backend_data): Don't initialize
- make_section_hook field.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
-
- * aoutx.h (translate_from_native_sym_flags): Don't try to stuff
- pointers into value field for warning and indirect symbols; just
- leave the value field alone.
- * linker.c (generic_link_add_symbol_list): Use next symbol for
- warning and indirect symbols, rather than looking in symbol value.
- * ecoff.c (ecoff_set_symbol_info): Remove indirect_ptr_ptr
- parameter. Change all callers. Remove support for indirect
- symbols; it didn't work anyhow.
- (_bfd_ecoff_slurp_symbol_table): Remove indirect_ptr variable.
- * syms.c: Change comments about BSF_WARNING and BSF_INDIRECT.
- * bfd-in2.h: Rebuild.
-
-Mon Sep 25 16:04:09 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_howto_raw): For all 14-bit branch relocs,
- go back to telling the tools this reloc operates on 32 bits.
-
-Mon Sep 25 11:48:02 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aout-adobe.c (aout_adobe_callback): Use _bfd_error_handler
- rather than a direct fprintf.
- * archive.c (_bfd_write_archive_contents): Likewise.
- * coffcode.h (coff_slurp_symbol_table): Likewise.
- * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Likewise.
- (ppc_elf_unsupported_reloc): Likewise.
- (ppc_elf_relocate_section): Likewise.
- * i386linux.c (linux_tally_symbols): Likewise.
- (linux_finish_dynamic_link): Likewise.
- * osf-core.c (osf_core_core_file_p): Likewise.
- * rs6000-core.c (rs6000coff_get_section_contents): Likewise.
- * som.c (som_sizeof_headers): Likewise.
- * srec.c (srec_bad_byte): Likewise.
- * bfd.c (bfd_assert): Likewise. Also change file to be const.
- * libbfd-in.h (bfd_assert): Declare first parameter const.
- * libbfd.h: Rebuild.
- * coff-a29k.c (a29k_reloc): Don't bother to fprintf; returning
- bfd_reloc_overflow is enough.
- * coff-h8300.c (rtype2howto): Don't bother to fprintf; just abort.
- * coff-h8500.c (rtype2howto): Likewise.
- * coff-z8k.c (rtype2howto): Likewise.
- * coffcode.h (dummy_reloc16_extra_cases): Likewise.
- * elf.c (_bfd_elf_get_lineno): Likewise.
- (_bfd_elf_no_info_to_howto): Likewise.
- (_bfd_elf_no_info_to_howto_rel): Likewise.
- * hp300hpux.c (convert_sym_type): Likewise.
- (MY(swap_std_reloc_in)): Likewise.
- * elf.c (bfd_section_from_shdr): Remove #if 0 sections.
-
- * libaout.h (struct aoutdata): Add line_buf field.
- * aoutx.h (NAME(aout,find_nearest_line)): Remove statics buffer
- and filename_buffer. Instead, use a malloc buffer stored in the
- new line_buf field. Remove length restrictions.
-
- * coffgen.c (string_size): Remove static variable.
- (debug_string_size, debug_string_section): Likewise.
- (coff_fix_symbol_name): Add string_size_p, debug_string_section_p,
- and debug_string_size_p parameters. Use them instead of the
- global variables. Change all callers.
- (coff_write_symbol): Likewise.
- (coff_write_alien_symbol, coff_write_native_symbol): Likewise.
- (coff_write_symbols): Add local variables to replace removed
- global variables.
-
- * libcoff-in.h (struct coff_section_tdata): Add offset, i,
- function, and line_base fields.
- * libcoff.h: Rebuild.
- * coffgen.c (coff_find_nearest_line): Use section tdata to cache
- information, rather than using static variables.
-
- * sunos.c (sunos_read_dynamic_info): Adjust offsets in an NMAGIC
- file. From Peter DeWolf <pld@amt.tay1.dec.com>.
-
- * init.c (initialized): Remove static variable.
- (bfd_init): Don't bother setting initialized.
- (bfd_check_init): Remove.
- * opncls.c (_bfd_new_bfd): Don't call bfd_check_init.
- * libbfd.h: Rebuild.
-
-Sat Sep 23 01:22:23 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * rs6000-core.c (rs6000coff_core_p): Don't check the core file
- size for full core dumps. Copy core file header to private data.
- (rs6000coff_core_file_failing_command,
- rs6000coff_core_file_failing_signal): New functions to extract
- the file name and terminating signal from the core file.
- * coff-rs6000.c: Use them.
-
-Fri Sep 22 17:44:47 1995 Ian Lance Taylor <ian@cygnus.com>
-
- Change arch info to be const, initialized at compile time.
- * archures.c: Reindent many functions. Change CONST to const.
- (bfd_arch_info_type): Make arch_name const. Remove disassemble;
- nothing set it anyhow. Make next const.
- (bfd_arch_info_list): Remove.
- (bfd_archures_list): Rename from archures_init_table. Change from
- a table of function pointers to a table of bfd_arch_info_type
- structure addresses.
- (bfd_scan_arch): Rewrite accordingly. Return a const pointer.
- (bfd_lookup_arch): Likewise.
- (bfd_set_arch_info): Rewrite accordingly. Change argument to be a
- const pointer.
- (bfd_default_arch_struct): Make const.
- (bfd_arch_init, bfd_arch_linkin): Remove.
- (bfd_get_arch_info): Return a const pointer.
- * init.c (bfd_init): Don't call bfd_arch_init.
- * bfd.c (struct _bfd): Make arch_info const.
- * bfd-in2.h: Rebuild.
- * libbfd.h: Rebuild.
- * configure.in: Put & before everything in $selarchs.
- * configure: Rebuild.
- * cpu-*.c: Change bfd_*_arch from a function which calls
- bfd_arch_linkin to a const structure.
- * ieee.c (ieee_object_p): Make arch const.
-
-Fri Sep 22 16:23:18 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * reloc.c (bfd_reloc_code_type): Add relocations to support all of
- PowerPC V.4.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
- * elf32-ppc.c (reloc_type): Update names to match current draft.
- (ppc_elf_howto_raw): Mark 14 bit relocs as short sized and PC
- relative. Update names to current V.4 draft.
- (ppc_elf_reloc_type_lookup): Add support for more relocations.
- (ppc_elf_relocate_section): Rename relocations to match draft.
-
-Thu Sep 21 21:53:18 1995 Michael Meissner <meissner@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Allow modules
- compiled with -mrelocatable-lib to be linked with either normal
- modules or -mrelocatable modules.
-
-Wed Sep 20 12:03:26 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_write_object_contents): Clear the vstamp field
- in the a.out header.
-
- * aoutx.h (NAME(aout,swap_ext_reloc_out)): Don't set r_extern for
- a reloc against a local symbol, even if it's not a section.
-
-Tue Sep 19 17:02:26 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * targets.c (bfd_target): Remove unused align_power_min field.
- * bfd-in2.h: Rebuild.
- * All backends: Remove initialization of align_power_min.
-
-Tue Sep 19 14:02:21 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * peicode.h (coff_swap_scnhdr_out): Get sizes for BSS right.
-
-Mon Sep 18 14:35:01 1995 Arne H. Juul <arnej@pvv.unit.no>
-
- * config.bfd (mips-dec-netbsd*): New target.
- * configure.host (mips-dec-netbsd*): New host.
- * configure.in (mips-dec-netbsd*): New native.
- * configure: Rebuild.
-
-Fri Sep 15 10:24:36 1995 Ian Lance Taylor <ian@cygnus.com>
-
- Make the COFF backend linker merge common types:
- * cofflink.c (struct coff_debug_merge_element): Define.
- (struct coff_debug_merge_type): Define.
- (struct coff_debug_merge_hash_entry): Define.
- (struct coff_debug_merge_hash_table): Define.
- (coff_debug_merge_hash_table_init): Define.
- (coff_debug_merge_hash_table_free): Define.
- (coff_debug_merge_hash_lookup): Define.
- (struct coff_final_link_info): Add debug_merge field.
- (coff_debug_merge_hash_newfunc): New static function.
- (_bfd_coff_final_link): Allocate and free debug_merge table.
- (coff_link_input_bfd): Merge identical enum, struct and union
- types.
-
-Thu Sep 14 14:53:58 1995 Ian Lance Taylor <ian@cygnus.com>
-
- Convert i960 COFF to use COFF backend linker.
- * coff-i960.c (coff_i960_relocate): Use a coff_section_data
- structure to store the symbol being used.
- (coff_i960_start_final_link): New static function.
- (coff_i960_relocate_section): New static function.
- (coff_i960_adjust_symndx): New static function.
- (coff_start_final_link): Define.
- (coff_relocate_section): Define.
- (coff_adjust_symndx): Define.
- * coffcode.h (bfd_coff_backend_data): Add new callback function
- _bfd_coff_start_final_link.
- (bfd_coff_start_final_link): Define.
- (coff_start_final_link): Define if not defined.
- (bfd_coff_std_swap_table): Add coff_start_final_link.
- * cofflink.c (_bfd_coff_internal_syment_name): Make globally
- visible.
- (_bfd_coff_final_link): Call bfd_coff_start_final_link if the
- function callback is not NULL.
- * libcoff-in.h (struct coff_section_tdata): Add tdata field.
- (_bfd_coff_internal_syment_name): Declare.
- * libcoff.h: Rebuild.
- * configure.in (icoff_big_vec): Add cofflink.o.
- (icoff_little_vec): Likewise.
- * configure: Rebuild.
-
-Wed Sep 13 17:38:23 1995 Fred Fish <fnf@rtl.cygnus.com>
-
- * Makefile.in (clean-info): Remove extraneous tab from line
- following action.
-
-Wed Sep 13 13:27:53 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (coff_link_input_bfd): Fail if a section with no
- contents has relocs.
-
-Thu Sep 12 12:45:34 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * coffcode.h (coff_compute_section_file_positions): Keep the
- raw size safe.
- (coff_write_object_contents): Remember if it's a relocatable
- file.
- * libcoff-in.h (pe_data_type): New member 'has_reloc_section'
- * peicode.h (coff_swap_filehdr_out): Clear not-reloc flag
- if relocatable file. Swap out saved raw size.
-
-Tue Sep 12 12:14:33 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (do_maintainer_clean): Rename from do_realclean.
- (maintainer-clean): Rename from realclean, passing
- maintainer-clean down to subdirectories, but leave realclean as a
- synonym.
-
- * linker.c (_bfd_generic_link_add_one_symbol): Pass symbol name to
- warning callback.
-
- * dep-in.sed: Remove config.h from generated dependencies.
-
- * sunos.c (sunos_slurp_dynamic_symtab): New static function,
- broken out of sunos_canonicalize_dynamic_symtab.
- (sunos_canonicalize_dynamic_symtab): Call new function
- sunos_slurp_dynamic_symtab.
- (sunos_add_dynamic_symbols): Add three new parameters. Return the
- dynamic symbol table to the caller.
- * aoutx.h (aout_link_add_symbols): Permit add_dynamic_symbols
- callback to override the symbols being read.
- * libaout.h (struct aout_backend_data): Add three new parameters
- to add_dynamic_symbols callback.
-
- Extensive minor changes to avoid various gcc warnings. Also:
- * Makefile.in (BFD32_BACKENDS): Remove coff-arm.o.
- * archures.c (bfd_arch_info_type): Change mach field from long to
- unsigned long.
- (bfd_lookup_arch): Change machine parameter from long to unsigned
- long.
-
-Mon Sep 11 10:55:47 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_scan_std_relocs): Fix BFD_ASSERT: it's OK to find
- a symbol with a non-zero plt_offset.
-
-Fri Sep 8 11:47:24 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (align_file_position): Remove; not used.
-
- * configure.in: Only check for <sys/procfs.h> on a native system,
- and make sure it defines prstatus_t.
- * configure: Rebuild.
-
-Thu Sep 7 12:48:01 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_write_dynamic_symbol): Correct m68k abort test.
-
- * config.in: Rename from config.h.in.
- * configure.in: Call AC_CONFIG_HEADER with config.h:config.in.
- Check for config.h:config.in when creating stamp-h.
- * configure: Rebuild.
- * Makefile.in (stamp-h): Depend upon config.in rather than
- config.h.in. Set CONFIG_HEADERS to config.h:config.in when
- calling config.status.
-
- * Makefile.in (do_distclean): Remove config.h and stamp-h.
- (Makefile): Just rebuild Makefile.
- (config.h, stamp-h): New targets.
- * configure.in: Create stamp-h when rebuilding config.h.
- * configure: Rebuild.
-
-Wed Sep 6 15:00:33 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Call AC_CONFIG_HEADER. Substitute
- HOST_64BIT_LONG. Check that various header files exist. Check
- that fcntl exists. Call BFD_BINARY_FOPEN. Check whether malloc
- and/or free need to be declared. Don't make a link to sysdep.h.
- Define TRAD_HEADER for various hosts.
- * configure: Rebuild.
- * configure.host: Don't set my_host. Add definitions taken from
- host header files for various entries. Remove entries which now
- do nothing.
- * acconfig.h: New file.
- * config.h.in: New file, built by autoheader.
- * sysdep.h: New file.
- * Makefile.in (do_distclean): Don't remove sysdep.h.
- (RECONFIG): Remove.
- (LOCAL_H_DEPS): New variable.
- ($(BFD_LIBS)): Use $(LOCAL_H_DEPS) rather than libbfd.h and
- $(RECONFIG).
- ($(BFD_MACHINES), $(BFD_BACKENDS)): Likewise.
- ($(OPTIONAL_BACKENDS)): Likewise.
- (stmp-bfd.h): Just substitute for BFD_HOST_64BIT_LONG, rather than
- looking through sysdep.h.
- * bfd-in.h (BFD_HOST_64BIT_LONG): Define; set by Makefile.
- (BFD_HOST_64_BIT): Define based on BFD_HOST_64BIT_LONG.
- (fprintf_vma, sprintf_vma): Likewise.
- (int64_type, uint64_type): Don't define.
- * bfd-in2.h: Rebuild.
- * archures.c, bfd.c, srec.c: Include <ctype.h>.
- * elfcore.h: Check HAVE_SYS_PROCFS_H rather than HAVE_PROCFS.
- * lynx-core.c: Include stuff from old hosts/lynx.h.
- * opncls.c (bfd_fdopenr): Check HAVE_FNCTL and defined (F_GETFL),
- rather than NO_FCNTL.
- * targets.c (bfd_target_list): Check HOST_HPPAHPUX and ! __STDC__
- rather than NATIVE_HPPAHPUX_COMPILER.
- * trad-core.c: Don't include <errno.h>. Include TRAD_HEADER if it
- is defined.
- * hosts/*.h: Remove all header files which merely include,
- declare, and define things. Leave header files which define
- information needed by trad-core.c.
-
- * aclocal.m4 (BFD_BINARY_FOPEN): Define.
- (BFD_CC_FOR_BUILD): Define.
- * configure.in: Use BFD_CC_FOR_BUILD.
- * configure: Rebuild.
-
-Tue Sep 5 19:35:28 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aclocal.m4: Don't try to grep ../Makefile if it doesn't exist.
- * configure: Rebuild.
-
- * coff-sparc.c (CALC_ADDEND): Don't set the addend to the value of
- a global symbol.
-
-Tue Sep 5 12:48:26 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * config.bfd: i386pe_ve -> i386pe_vec.
-
-Mon Sep 4 14:02:43 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Incorporate host Makefile fragments by setting
- shell variables.
- * configure.in: Call AC_PROG_CC. Substitute CFLAGS, HDEFINES and
- AR. Call AC_PROG_INSTALL. Substitute CC_FOR_BUILD, choosing a
- value based on whether the code is being compiled by a cross
- compiler. Don't substitute host_makefile_frag or frags.
- * aclocal.m4: New file to define local AC_PROG_CC.
- * configure: Rebuild.
- * Makefile.in (INSTALL): Set to @INSTALL@.
- (INSTALL_PROGRAM): Set to @INSTALL_PROGRAM@.
- (INSTALL_DATA): Set to @INSTALL_DATA@.
- (AR): Set to @AR@.
- (CC): Define as @CC@.
- (CFLAGS): Set to @CFLAGS@.
- (CC_FOR_BUILD): Set to @CC_FOR_BUILD@.
- (@host_makefile_frag@): Remove.
- (ALL_CFLAGS): Change $(HDEFINES) to @HDEFINES@. Move $(CFLAGS)
- after other options.
- (config.status): Remove dependency upon @frags@.
- * config/*.mh, config/README: Remove.
-
- * config.bfd: Rewrite to incorporate the contents of the Makefile
- fragments by setting shell variables, rather than merely returning
- the name of a Makefile fragment.
- * configure.in: Use shell variables set by config.bfd rather than
- looking at the target Makefile fragment files. Don't substitute
- target_makefile_frag. Do substitute TDEFINES.
- * configure: Rebuild.
- * Makefile.in (@target_makefile_frag@): Remove.
- (ALL_CFLAGS): Change $(TDEFINES) to @TDEFINES@.
- * config/*.mt: Remove.
-
-Mon Sep 4 03:13:28 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * configure.in: Put changequote lines around "i[345]86" patterns
- section of core file support.
-
-Sun Sep 3 11:31:58 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_print_private_bfd_data): Define to use the
- generic version.
-
-Fri Sep 1 17:08:40 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * peicode.h (coff_swap_aouthdr_in): Add ImageBase to
- entry, text_start and data_start.
-
-Fri Sep 1 18:06:28 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (OFILES): Remove $(TDEPFILES).
- * config/apollo.mt (TDEPFILES): Remove.
- * config/README: Update.
-
- * configure.in: For a native configuration, set COREFILE and
- COREFLAG based on the canonical host name.
- * configure: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (ALL_CFLAGS): Add @COREFLAG@.
- (OFILES): Replace $(HDEPFILES) with @COREFILE@.
- * coff-rs6000.c: Check AIX_CORE rather than HOST_AIX for core file
- support routines. Check LYNX_CORE rather than HOST_LYNX.
- * lynx-core.c: Check LYNX_CORE rather than HOST_LYNX.
- * i386lynx.c: Likewise.
- * m68klynx.c: Likewise.
- * sparclynx.c: Likewise.
- * rs6000-core.c: Check AIX_CORE rather than HOST_AIX.
- * *-core.c: Comment changes.
- * config/decstation.mh (HDEPFILES): Remove.
- (HDEFINES): Remove -DTRAD_CORE.
- * config/irix3.mh (RANLIB): Remove.
- * config/irix4.mh (HDEPFILES, RANLIB): Remove.
- (HDEFINES): Remove -DIRIX_CORE.
- * config/riscos.mh (RANLIB, HDEPFILES): Remove.
- (HDEFINES): Remove -DTRAD_CORE.
- * config/ncr3000.mh (AR_FLAGS, RANLIB): Remove.
- * config/ultra3.mh (RANLIB): Remove.
- * config/aix4.mh, config/alphaosf.mh, config/amix.mh: Remove.
- * config/apollo.mh, config/delta68.mh, config/delta88.mh: Remove.
- * config/dpx2.mh, config/esix.mh, config/harris.mh: Remove.
- * config/hp300.mh, config/hp300bsd.mh, config/hppabsd.mh: Remove.
- * config/hppahpux.mh, config/hppaosf.mh: Remove.
- * config/i386aix.mh, config/i386bsd.mh: Remove.
- * config/i386linux.mh, config/i386mach3.mh: Remove.
- * config/i386sco.mh, config/i386v.mh, config/i386v4.mh: Remove.
- * config/irix5.mh, config/m88kmach3.mh, config/mipsbsd.mh: Remove.
- * config/mipsmach3.mh, config/news-mips.mh: Remove.
- * config/news.mh, config/pc532mach.mh, config/riscix.mh: Remove.
- * config/rs600.mh, config/rs6000lynx.mh: Remove.
- * config/solaris2.mh, config/stratus.mh: Remove.
- * config/symmetry.mh, config/sysv4.mh, config/tahoe.mh: Remove.
- * config/vaxbsd.mh, config/vaxult.mh, config/vaxult2.mh: Remove.
-
-Fri Sep 1 15:18:50 1995 Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>
-
- * elflink.h (elf_bfd_final_link): Don't change a DT_INIT or
- DT_FINI entry if the appropriate symbol is not in the hash table.
-
- * libelf.h (struct elf_backend_data): Add create_program_headers
- and want_hdr_in_seg fields.
- * elfxx-target.h (elf_backend_want_hdr_in_seg): Define if not
- defined.
- (elf_backend_create_program_headers): Likewise.
- (elfNN_bed): Initialize create_program_headers and
- want_hdr_in_seg.
- * elf.c (get_program_header_size): Call create_program_headers
- backend routine.
- (map_program_segments): Check want_hdr_in_seg backend field. Call
- create_program_headers backend routine.
-
- * elf.c (assign_file_positions_except_relocs): Align non allocated
- sections when creating an executable.
-
- * elfcode.h (elf_swap_phdr_in): Make non static.
- (elf_swap_phdr_out): Make non static.
- * libelf.h (bfd_elf32_swap_phdr_in): Declare.
- (bfd_elf32_swap_phdr_out): Declare.
- (bfd_elf64_swap_phdr_in): Declare.
- (bfd_elf64_swap_phdr_out): Declare.
-
- * ecofflink.c (ecoff_collect_shuffle): New static function.
- (_bfd_ecoff_get_accumulated_pdr): New function.
- (_bfd_ecoff_get_accumulated_sym): New function.
- (_bfd_ecoff_get_accumulated_ss): New function.
- * libbfd-in.h (_bfd_ecoff_get_accumulated_pdr): Declare.
- (_bfd_ecoff_get_accumulated_sym): Declare.
- (_bfd_ecoff_get_accumulated_ss): Declare.
- * libbfd.h: Rebuild.
-
-Fri Sep 1 13:20:25 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * libecoff.h (_bfd_ecoff_bfd_print_private_bfd_data): Fix typo.
-
- * elflink.h (elf_link_add_object_symbols): Handle indirect and
- warning symbols. If any section is named .gnu.warning.XXX, treat
- the contents as a warning to be issued if the symbol XXX is
- referenced.
- (elf_link_output_extsym): For an indirect or warning symbol, just
- output the symbol it points to.
-
- * linker.c (_bfd_link_hash_newfunc): Don't bother to set bfd_error
- if bfd_hash_allocate fails, since it will already be set.
- (generic_link_hash_newfunc): Likewise.
- (archive_hash_newfunc): Likewise.
- (hash_entry_bfd): New static function.
- (_bfd_generic_link_add_one_symbol): Pass new arguments to warning
- callback. Allocate a new warning using the hash table newfunc.
- Use bfd_hash_replace to update the entry in the hash table, rather
- than assuming we can copy the fields with structure assignment.
-
- * hash.c (bfd_hash_replace): New function.
- * bfd-in.h (bfd_hash_replace): Declare.
- * bfd-in2.h: Rebuild.
-
-Fri Sep 1 08:12:50 1995 James G. Smith <jsmith@beauty.cygnus.com>
-
- * config.bfd: Add mips*vr4300-*-elf* target.
- * config/mipsbvr4300.mt: Added.
-
-Thu Aug 31 16:00:53 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * Makefile.in: Update dependencies.
- * aout-target.h (MY_bfd_print_private_bfd_data): New.
- * bfd-in.h (PE STUFF): Deleted.
- * bfd.c (tdata->pe_obj_data): New.
- (bfd_print_private_bfd_data): New.
- * coff-i386.c, coff-arm.c (coff_*-rtype_to_howto): Get image base from
- new place.
- * libcoff.h, libbfd.h, bfd-in2.h: Rebuilt.
- * coffcode.h (pe_value): Delete
- (coff_mkobject, coff_mkobject_hook): Conditionally build.
- (coff_compute_section_file_positions): Look in new place.
- (add_data_entry, fill_pe_header_info): Deleted.
- (coff_write_object_contents): Remove PE stuff.
- (coff_bfd_print_private_bfd_data): New.
- * coffswap.h: Remove PE stuff.
- * elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): New.
- * libbfd-in.h (_bfd_generic_bfd_print_private_bfd_data): New.
- * libcoff-in.h (pe_data_type): New.
- * libecoff.h (_bfd_ecoff_bfd_print_private_bfd_data): New.
- * targets.c (_bfd_print_private_bfd_data): New.
- * peicode.h: New file.
-
-Thu Aug 31 11:49:21 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd-in.h: Add extern "C" if __cplusplus.
- * bfd-in2.h: Rebuild.
-
- * coff-mips.c (mips_relocate_section): Don't convert a reloc
- against an absolute symbol into a reloc against a section.
-
-Thu Aug 31 08:00:14 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * coff-arm.c (coff_arm_reloc): Fix common size problem.
- (i3coff_object_p): Delete.
-
-Wed Aug 30 20:41:27 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * coff-arm.c (deletemeacoff_arm_reloc): Deleted.
- (arm26): Not partial inplace.
- * coffcode.h (coff_compute_section_file_positions): Don't
- do page aligning if COFF_PAGE_SIZE isn't defined.
- * coffswap.h (coff_swap_scnhdr_in): Update image base correctly.
-
-Tue Aug 29 13:50:21 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * coffcode.h (coff_compute_section_file_positions):
- Compile even if COFF_PAGE_SIZE isn't defined.
- * cofflink.c (_bfd_coff_generate_reloc_section): Write
- base file info as rvas.
- * coff-arm.c (coff_rtype_to_howto): Deal with reloc 11.
- * coffcode.h (coff_write_object_contents): Remove #if0ed code
- Only remove empty sections in PE inmage files.
- * libbfd.h, bfd-in2.h: regenerated.
- * coff-arm.c (aoutarm_std_relo): New entry at 11.
- (arm_reloc_type_lookup) : Understand type 11.
- * coff-i386.c (howto_table): fix name of rva type.
- (coff-i386_rtype_to_howto): Understand R_IMAGEBASE type.
- * coffcode.h (sec_to_styp_flags): .edata is data.
- (coff_compute_section_file_positions): Get page size right for PE.
- Pagesize info is only valid in PE image files.
- (fill_pe_header_info): Fix fields.
- (coff_write_object_contents): Remove end_of_image calc.
- (_bfd_coff_generate_reloc_section): Remove orphaned comment.
- * coffswap.h (coff_swap_scnhdr_in): Don't always add IMAGE_BASE.
- Swap in PE header.
- (coff_swap_scnhdr_out): Setup PE flags correctly.
- * reloc.c (BFD_RELOC_RVA): New field.
-
-Thu Aug 24 17:49:59 1995 Ian Lance Taylor (ian@cygnus.com)
-
- * cofflink.c (coff_link_input_bfd): Don't include line numbers for
- a section if its output section has no contents.
-
-Wed Aug 23 16:48:52 1995 Ian Lance Taylor (ian@cygnus.com)
-
- * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Add parentheses to FIX
- expression to avoid compiler bug on HP-UX 9.01.
-
-Wed Aug 23 09:49:39 1995 Steve Chamberlain <sac@rtl.cygnus.com>
-
- * coffcode.h (pe_value): Unansify.
-
-Mon Aug 21 17:49:28 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * bfd-in.h (bfd_link_subsystem): Turn enum into #defines.
- (bfd_link_pe_info_dval): New
- (bfd_link_stack_heap): Renamed and massaged into bfd_link_pe_info.
- * bfd-in2.h: rebuilt.
- * bfd.c (NT_subsystem, NT_stack_heap): Deleted.
- * coffcode.h (pe_value): New function.
- (fill_pe_header_info): New function.
- (coff_write_object_contents): Use new function.
- (coff_write_object_contents): Initialze link_data if not set.
- * cofflink.c (coff_final_link_info): Remove pe randomness.
- (dores_com): Update info in bfd_link_pe_info_dval.
- (process_embedded_commands): Use the bfd_link_pe_info_dval.
- (_bfd_coff_final_link): Remove PE stuff, initialize
- coff_data->link_info.
- * coffswap.h (coff_swap_[aout|filehdr]_out): Use indirect PE pointer.
- (coff_swap_scnhdr_out): Use real imagebase.
- * libcoff-in.h (coff_data_type.link_info): New field.
-
-Mon Aug 21 11:10:32 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * linker.c (link_action): If an undefined reference follows an
- undefined weak reference, change the type to undefined.
- * elflink.h (elf_link_add_archive_symbols): Don't record an
- undefined weak reference as defined, in case it turns into a real
- undefined reference later in the same archive.
-
-Thu Aug 17 16:29:09 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
-
- * coff-sh.c (sh_relax_section): Cast value for used_by_bfd field
- to PTR, not coff_section_tdata pointer, since PTR is the real type
- of the field.
- * cofflink.c (_bfd_coff_read_internal_relocs): Ditto.
-
-Thu Aug 17 14:44:26 1995 Ian Lance Taylor <ian@cygnus.com>
-
- Add support for linking SPARC SunOS PIC compiled code.
- * sunos.c (SPARC_PLT_PIC_WORD0): Define.
- (SPARC_PLT_PIC_WORD1, SPARC_PLT_PIC_WORD2): Define.
- (struct sunos_link_hash_entry): Add got_offset and plt_offset
- fields.
- (struct sunos_link_hash_table): Add dynamic_sections_created and
- dynamic_sections_needed fields.
- (sunos_link_hash_newfunc): Initialize new fields.
- (sunos_link_hash_table_create): Initialize new fields.
- (sunos_create_dynamic_sections): New static function, broken out
- of sunos_add_dynamic_symbols.
- (sunos_add_dynamic_symbols): Call sunos_create_dynamic_sections.
- (sunos_add_one_symbol): Call sunos_create_dynamic_sections.
- (bfd_sunos_size_dynamic_sections): Call sunos_scan_relocs before
- checking whether we need to set up the dynamic link information.
- Define __GLOBAL_OFFSET_TABLE if anything referred to it.
- (sunos_scan_std_relocs): Call sunos_create_dynamic_sections. Use
- plt_offset field; only put symbol in .plt if it is not defined by
- a regular object.
- (sunos_scan_ext_relocs): Likewise. Handle base relative relocs.
- (sunos_scan_dynamic_symbol): Store dynobj in local variable.
- (sunos_write_dynamic_symbol): Check plt_offset rather than
- checking whether symbol is in .plt section. If symbol is defined
- in a regular object file, use SPARC_PLT_PIC_WORD[012], and don't
- add a JMP_TBL reloc.
- (sunos_check_dynamic_reloc): Add contents and relocationp fields.
- If plt_offset is set, redirect relocation to PLT. If this is a
- base relative reloc, redirect relocation to GOT. Check
- dynamic_sections_needed field rather than whether dynobj is set.
- (sunos_finish_dynamic_link): Check dynamic_sections_needed field
- rather than whether dynobj is set. Don't die if .need and .rules
- sections were not created.
- * aoutx.h (howto_table_ext): Mark PC10, PC22, and JMP_TBL entries
- PC relative. Mark PC10 complain_overflow_dont. Mark PC22 and
- JMP_TBL complain_overflow_signed.
- (NAME(aout,final_link)): If info->shared is set, set DYNAMIC.
- (aout_link_input_section_std): Call check_dynamic_reloc for all
- relocs. Pass contents and &relocation. Don't warn about an
- undefined symbol until check_dynamic_reloc has been called. Don't
- warn about an undefined symbol for a base relative reloc.
- (aout_link_input_section_ext): Likewise. For a base relative
- reloc, always treat r_index as an index into the symbol table.
- * libaout.h (struct aout_backend_data): Add contents and
- relocation argument to check_dynamic_reloc entry point.
- (struct aoutdata): Add local_got_offsets field.
-
-Wed Aug 16 01:03:07 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-i386.c (elf_i386_check_relocs): Fix bug in last change.
-
-Mon Aug 14 11:39:24 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,machine_type)): Handle a machine of
- bfd_mach_sparc or bfd_mach_sparc64.
-
- * elflink.h (elf_link_add_object_symbols): If a symbol is a weak
- definition, add it to the dynamic symbol table if any dynamic
- object mentions it. If we do add it, make sure we add the
- corresponding real symbol.
- (elf_adjust_dynamic_symbol): Adjust a weak defined symbol which we
- put in the dynamic symbol table, even if no regular object refers
- to it.
- * elf32-i386.c (elf_i386_check_relocs): When creating a shared
- library, don't allocate space for a PC relative reloc against a
- local symbol.
- * elf32-m68k.c (elf_m68k_check_relocs): Likewise.
- * elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Change assertion
- to accept symbol with weakdef set.
- * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): When creating a shared
- libary, don't copy over a PC relative reloc against a local
- symbol.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
-Sun Aug 13 00:40:58 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.h (R_HPPA_BEGIN_BRTAB): Define.
- (R_HPPA_END_BRTAB): Likewise.
- * som.c (som_write_fixups): Handle R_BEGIN_BRTAB and R_END_BRTAB.
-
-Thu Aug 10 15:53:29 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffswap.h (coff_swap_aux_in): Swap the array dimensions
- whenever x_fcnary is not being used for something else, rather
- than only for an array.
- (coff_swap_aux_out): Likewise.
-
-Tue Aug 8 16:34:57 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Remove most
- of special case stuff for PE. Now handled by relocs.
- * coff-i386.c (coff_i386_reloc): Special case of PE type 7s.
- (howto_table): Type 7 is dir32-rva.
-
-Tue Aug 8 10:15:43 1995 Jeffrey A. Law <law@rtl.cygnus.com>
-
- * configure.host: Recognize aix4 explicitly.
- * rs6000-core.c (CORE_DATA_SIZE_FIELD): New macro to get a the size
- of a core dump's data section. Provide alternate definition for aix4.
- (SAVE_FIELD): Similarly for save state field (register info).
- (STACK_END_ADDR): Provide definition suitable for aix4.
- * config/{aix4.mh,aix4.mt}: New configuration files.
- * hosts/aix4.h: Likewise.
-
-Mon Aug 7 23:03:21 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * som.c (som_bfd_copy_private_symbol_data): Cast initializations
- to avoid warnings.
-
-Mon Aug 7 14:51:08 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_decode_symclass): Handle absolute symbols by checking
- the SOM type (since they will rarely if ever be in the absolute
- section).
-
-Wed Aug 6 09:12:50 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * archures.c (bfd_mach_sparc, bfd_mach_sparc64): Define.
- * bfd-in2.h: Regenerated.
- * cpu-sparc.c (sparc_arch_info): Renamed from arch_info_struct.
- (sparc64_arch_info): New static variable.
- (bfd_sparc_arch): Link in sparc64_arch_info.
- * elf64-sparc.c (sparc64_elf_xxx): Renamed from elf64_xxx.
- (sparc64_elf_object_p): New static function.
- (elf_backend_object_p): Define.
- * config/sparc64-elf.mt (SELECT_VECS): Add bfd_elf32_sparc_vec.
-
-Sat Aug 5 00:04:08 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_get_reloc_upper_bound): Return -1 on error. Compute
- return value with sizeof (arelent *), not sizeof (arelent).
-
-Wed Aug 2 12:32:21 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (bfd_section_from_shdr): If the section pointed to by the
- sh_link field of a reloc section is not a symbol table, and the
- file contains a single symbol table, clobber the sh_link field of
- the reloc section to point to the symbol table.
-
-Tue Aug 1 10:09:01 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * coff-arm.c (howto reloc ARM26): Change size from 3 to 2.
- (howto reloc ARM26D): Likewise.
-
-Mon Jul 24 14:17:50 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,find_nearest_line)): Use the line just before
- the offset, not the one just after. Break out of the loop after
- finding a function past the offset, not merely when finding a
- function with a line defined.
-
- * ecofflink.c (_bfd_ecoff_locate_line): When handling stabs:
- correct setting of sym_ptr_end to consider symbols skipped when
- setting sym_ptr; don't leave loop early unless an N_FUN is found
- with a larger value.
-
- * coff-sh.c (sh_coff_howtos): Mark R_SH_PCDISP8BY2 and R_SH_PCDISP
- as PC relative. Describe R_SH_IMM16. Add entries for
- R_SH_SWITCH16, R_SH_SWITCH32, R_SH_USES, R_SH_COUNT, and
- R_SH_ALIGN.
- (SWAP_IN_RELOC_OFFSET): Define.
- (SWAP_OUT_RELOC_OFFSET): Define.
- (CALC_ADDEND): Define.
- (sh_reloc): Change sym_value and addr to type bfd_vma. Skip reloc
- types other than R_SH_IMM32 and R_SH_PCDISP on an external symbol.
- (coff_bfd_relax_section): Define.
- (coff_bfd_get_relocated_section_contents): Define.
- (sh_relax_section): New static function.
- (sh_relax_delete_bytes): New static function.
- (sh_relocate_section): Handle R_SH_PCDISP on an external symbol.
- (sh_coff_get_relocated_section_contents): New static function.
-
- * cofflink.c (coff_link_add_object_symbols): Call
- _bfd_coff_get_external_symbols, not coff_link_get_symbols. Call
- _bfd_coff_free_symbols, not coff_link_free_symbols. Call
- _bfd_coff_read_string_table, not coff_read_string_table.
- (coff_link_check_archive_element): Likewise.
- (coff_link_input_bfd): Likewise.
- (coff_link_get_symbols): Move to coffgen.c.
- (coff_read_string_table): Likewise.
- (coff_link_free_symbols): Likewise.
- (_bfd_coff_internal_syment_name): New static function.
- (coff_link_check_ar_symbols): Use _bfd_coff_internal_syment_name.
- (coff_link_add_symbols): Likewise.
- (coff_link_input_bfd): Likewise.
- (_bfd_coff_generic_relocate_section): Likewise.
- (_bfd_coff_read_internal_relocs): New function.
- (coff_link_input_bfd): Use cached section contents if available.
- Use _bfd_coff_read_internal_relocs.
- * coffcode.h (coff_slurp_symbol_table): Don't call bfd_seek.
- (coff_bfd_get_relocated_section_contents): Only define if not
- already defined.
- (coff_bfd_relax_section): Likewise.
- * coffgen.c (build_string_table): Remove.
- (_bfd_coff_get_external_symbols): New function, moved in from old
- coff_link_get_symbols in cofflink.c.
- (_bfd_coff_read_string_table): New function, moved in from old
- coff_read_string_table in cofflink.c.
- (_bfd_coff_free_symbols): New function, moved in frmo old
- coff_link_free_symbols in cofflink.c.
- (coff_get_normalized_symtab): Use _bfd_coff_get_external_symbols
- rather than reading the symbols directly. To free them, call
- _bfd_coff_free_symbols. Use _bfd_coff_read_string_table rather
- than build_string_table.
- * libcoff-in.h (obj_coff_keep_syms): Define.
- (obj_coff_keep_strings): Define.
- (coff_data_type): Add fields keep_syms and keep_strings.
- (coff_section_tdata): Define new structure.
- (coff_section_data): Define.
- (_bfd_coff_get_external_symbols): Declare.
- (_bfd_coff_read_string_table): Declare.
- (_bfd_coff_free_symbols): Declare.
- (_bfd_coff_read_internal_relocs): Declare.
- * libcoff.h: Rebuild.
-
-Fri Jul 21 22:32:54 1995 Michael Meissner <meissner@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_howto_raw): Add support for R_PPC_SDAREL
- relocation.
- (ppc_elf_reloc_type_lookup): Ditto.
- (ppc_elf_got16_inner): Ditto.
- (ppc_elf_relocate_section): Ditto.
-
-Thu Jul 20 19:19:06 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (hppa_elf_gen_reloc_type): Add new (ignored)
- argument.
- * elf32-hppa.h: Corresponding change.
-
-Thu Jul 20 19:01:07 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * libaout.h (set_aout_section_data): New macro.
- * sunos.c (sunos_scan_relocs): Use it.
-
- * aout-ns32k.c (MY_swap_std_reloc_out): Undef KEEPIT before
- defining it.
-
-Thu Jul 20 13:48:00 1995 Fred Fish <fnf@cygnus.com>
-
- * hosts/i386v4.h (getgid, getuid): Change prototypes to be
- compatible with Unixware 1.x and Unixware 2.x, and probably other
- i386 svr4 versions as well.
-
-Thu Jul 20 13:41:21 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * targets.c (bfd_target_vector): Since armpe and armpei have been
- split into big- and little-endian variants, list all of them,
- instead of the now-nonexistant armpe[i]_vec.
-
-Thu Jul 20 00:06:39 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (bfd_section_from_phdr): Set lma based on p_paddr.
- (elf_fake_sections): Set sh_addr based on lma, not vma.
-
-Wed Jul 19 15:52:01 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * coff-arm.c (TARGET_LITTLE_SYM, TARGET_BIG_SYM): Replaces TARGET_SYM.
- * configure.in (armpe_vec, armpei_vec): Add bi-endian support.
- * configure: "regenerated".
- * pe-arm.c (TARGET_LITTLE_SYM, TARGET_BIG_SYM): Replaces TARGET_SYM.
- (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Replaces TARGET_NAME.
- * pei-arm.c (TARGET_LITTLE_SYM, TARGET_BIG_SYM): Replaces TARGET_SYM.
- (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Replaces TARGET_NAME.
- * targets.c (armpe_vec, armpei_vec): Deleted.
- (armpe_little_vec, armpe_big_vec, armpei_little_vec, armpei_big_vec):
- Added.
- * config/arm-pe.mt (DEFAULT_VECTOR): Default is armpe_little_vec.
- (SELECT_VECS): Add bi-endian support.
-
-Wed Jul 19 10:47:25 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c: Clean up and comment.
- (r_imm32): Remove.
- (sh_coff_howtos): New static array.
- (SH_COFF_HOWTO_COUNT): Define.
- (get_symbol_value): Make relocation bfd_vma rather than long.
- (RTYPE2HOWTO): Rewrite to use sh_coff_howtos.
- (coff_relocate_section): Define to sh_relocate_section.
- (sh_relocate_section): New static function.
-
-Sat Jul 15 01:02:53 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * configure.host: Add support for generic m68k SVR4 host.
-
-Fri Jul 14 13:13:55 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (KEEPIT): Change definition to udata.i.
- (KEEPITTYPE): Remove.
- (NAME(aout,reloc_type_lookup)): Add cases to the
- extended reloc type switch: SPARC_GOT10, SPARC_GOT13, SPARC_GOT22,
- SPARC_PC10, SPARC_PC22, SPARC_WPLT30.
- (NAME(aout,swap_std_reloc_out)): Don't bother to use stoi when
- retrieving KEEPIT value.
- (NAME(aout,swap_ext_reloc_out)): Likewise. Also, only add in
- output section VMA for section symbols, and check BSF_SECTION_SYM
- to control whether to set r_extern to 1.
-
- * syms.c: Fix comments so that `make info' works.
-
- * elf32-mips.c (mips_elf_find_nearest_line): Set SEC_HAS_CONTENTS
- in .mdebug section, in case backend linker has cleared it.
-
-Fri Jul 14 11:58:34 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_addr16_ha_inner): Rewrite to take just one
- argument, the final relocated address.
- (ppc_elf_addr16_ha_inner): Adjust ppc_elf_addr16_ha_inner caller.
- (ppc_elf_relocate_section): Ditto.
-
-Thu Jul 13 17:22:03 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (hppa_som_gen_reloc_type): Choose a reasonable field
- selector relocation for the difference of two symbols.
-
-Thu Jul 13 10:33:25 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,slurp_reloc_table)): Cast argument to size_t
- for malloc.
- * coff-mips.c (mips_relocate_section): Likewise, for memmove.
- (mips_relax_section): Likewise, for malloc.
- * cofflink.c (process_embedded_commands): Likewise.
- (_bfd_coff_final_link): Likewise.
- * ecoff.c (_bfd_ecoff_write_object_contents): Likewise.
- (ecoff_final_link_debug_accumulate): Likewise.
- (ecoff_indirect_link_order): Likewise, for memcpy and malloc.
- (ecoff_reloc_link_order): Likewise, for malloc.
- * ecofflink.c (ecoff_align_debug): Likewise, for memset.
- (ecoff_write_symhdr): Likewise, for malloc.
- * elf32-hppa.c (elf32_hppa_read_symext_info): Likewise.
- * elf.c (assign_file_positions_except_relocs): Likewise, for
- qsort.
- * elf32-mips.c (mips_elf_read_ecoff_info): Likewise, for malloc.
- * elfcode.h (elf_slurp_reloc_table): Likewise.
- * elfcore.h (elf_corefile_note): Likewise.
- * elflink.h (elf_link_add_object_symbols): Likewise.
- (elf_link_read_relocs): Likewise.
- (NAME(bfd_elf,size_dynamic_sections)): Likewise, for memset.
- * i386linux.c (bfd_linux_size_dynamic_sections): Likewise.
- * ieee.c (do_with_relocs): Likewise.
- * linker.c (default_indirect_link_order): Likewise, for malloc.
- * nlmcode.h (nlm_object_p): Likewise.
- (nlm_write_object_contents): Likewise.
- * oasys.c (oasys_set_section_contents): Likewise, for memcpy.
- * reloc.c (bfd_generic_get_relocated_section_contents): Likewise,
- for malloc.
- * section.c (bfd_get_section_contents): Likewise, for memcpy.
- * srec.c (srec_get_section_contents): Likewise.
- (srec_set_section_contents): Likewise.
- * sunos.c (bfd_sunos_size_dynamic_sections): Likewise, for
- realloc and memset.
- (sunos_scan_relocs): Likewise, for malloc.
- (sunos_scan_dynamic_symbol): Likewise, for realloc.
- * syms.c (_bfd_generic_read_minisymbols): Likewise, for malloc.
- * versados.c (versados_get_section_contents): Likewise, for
- memcpy.
-
- * libbfd.c (real_read): Add prototype. Change argument types from
- int to size_t.
- (bfd_read): Cast real_read argument to size_t, not int.
- (bfd_write): Cast fwrite argument to size_t, not int.
-
- * elf64-gen.c (elf_info_to_howto): Fix definition for recent elf.c
- changes.
-
- * configure.in: Fix typo: change {$enableval} to ${enableval}.
- * configure: Rebuild.
-
- * Makefile.in (BFD32_BACKENDS): Add elflink.o.
-
- * targets.c (bfd_target): Add fields _read_minisymbols and
- _minisymbol_to_symbol.
- (BFD_JUMP_TABLE_SYMBOLS): Add _read_minisymbols and
- _minisymbol_to_symbol.
- (bfd_read_minisymbols): Define.
- (bfd_minisymbol_to_symbol): Define.
- * syms.c (_bfd_generic_read_minisymbols): Define.
- (_bfd_generic_minisymbol_to_symbol): Define.
- * libbfd-in.h (_bfd_nosymbols_read_minisymbols): Define.
- (_bfd_nosymbols_minisymbol_to_symbol): Define.
- (_bfd_generic_read_minisymbols): Declare.
- (_bfd_generic_minisymbol_to_symbol): Declare.
- * bfd-in2.h: Rebuild.
- * libbfd.h: Rebuild.
- * aoutx.h (MINISYM_THRESHOLD): Define.
- (NAME(aout,read_minisymbols)): New function.
- (NAME(aout,minisymbol_to_symbol)): New function.
- * libaout.h (NAME(aout,read_minisymbols)): Declare.
- (NAME(aout,minisymbol_to_symbol)): Declare.
- * aout-target.h (MY_read_minisymbols): Define.
- (MY_minisymbol_to_symbol): Define.
- * All targets: Define read_minisymbols and minisymbol_to_symbol.
-
-Wed Jul 12 17:55:55 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Cast return value from
- bfd_alloc.
-
- * elfcode.h (size_info): Don't use "&" before function names.
-
-Wed Jul 12 00:16:48 1995 Ken Raeburn <raeburn@kr-pc.cygnus.com>
-
- * libelf.h (elf_backend_data): Use unsigned, not unsigned char,
- for bitfields.
-
-Tue Jul 11 15:19:53 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (bfd_section_from_shdr): In case SHT_REL[A], only get the
- BFD section for the sh_link section if it is a SYMTAB section.
-
- * aoutx.h (NAME(aout,link_add_symbols)): Don't bother to check
- that archives hold a.out objects.
- * cf-i386lynx.c (coff_bfd_link_add_symbols): Don't define.
- (lynx_link_add_symbols): Remove.
- * cf-m68klynx.c (coff_bfd_link_add_symbols): Don't define.
- (lynx_link_add_symbols): Remove.
- * elflink.h (elf_bfd_link_add_symbols): Don't bother to check that
- archives hold ELF objects.
-
- * archive.c (bfd_generic_archive_p): If the archive has a map, and
- the target was defaulted, but the first object in the archive can
- not be matched with that target, then return a bad format error.
-
- * elf64-sparc.c (elf_sparc_howto_table): Set howto for WDISP16 to
- elf64_wdisp16_reloc.
- (elf64_wdisp16_reloc): New static function.
- (elf64_sparc_relocate_section): New static function.
- (elf_backend_relocate_section): Define.
-
- * libelf.h (struct elf_size_info): Change type of last argument to
- swap_symbol_out from char * to PTR.
- (bfd_elf32_swap_symbol_out): Update declaration.
- (bfd_elf64_swap_symbol_out): Likewise.
- * elfcode.h (elf_swap_symbol_out): Change type of cdst from char *
- to PTR.
- * elf.c (swap_out_syms): Cast to PTR, not char *, when calling
- swap_symbol_out routine.
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Likewise.
- (elf_link_output_sym): Likewise.
- (elf_link_output_extsym): Likewise.
- * elf32-sparc.c (elf32_sparc_finish_dynamic_sections): Likewise.
-
-Tue Jul 11 12:29:49 1995 Rick Sladkey <jrs@world.std.com>
-
- * elf.c (_bfd_elf_find_nearest_line): Handle the simple case where
- there is no debugging information.
-
-Mon Jul 10 11:45:55 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * makefile.dos (OBJS): Add binary.o and tekhex.o. From DJ
- Delorie.
-
-Mon Jul 10 11:09:58 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * linker.c (set_symbol_from_hash): bfd_link_hash_new case: Don't
- abort; it can happen for constructor symbols when not building
- constructors.
-
- * coff-i960.c (coff_i960_relocate): Correct typo: use ! on strcmp,
- not on string.
- * cofflink.c (_bfd_coff_generic_relocate_section): Remove unused
- local i.
- * coff-arm.c (coff_arm_rtype_to_howto): Don't declare.
- (PCRELOFFSET): Define if not already defined.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add coff-arm.o
- (CFILES): Add coff-arm.c, pe-arm.c, pei-arm.c.
-
- * aoutx.h (NAME(aout,link_hash_table_create)): Allocate hash table
- using bfd_alloc, not malloc.
- * cofflink.c (_bfd_coff_link_hash_table_create): Likewise.
- * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
- * i386linux.c (linux_link_hash_table_create): Likewise.
- * linker.c (_bfd_generic_link_hash_table_create): Likewise.
- * sunos.c (sunos_link_hash_table_create): Likewise.
-
- Based on patches from Eric Youngdale <eric@aib.com>:
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): If -Bsymbolic,
- output a DT_SYMBOLIC dynamic entry.
- (elf_adjust_dynamic_symbol): If -Bsymbolic, don't require a PLT
- entry for a locally defined symbol.
- * elf32-i386.c (elf_i386_relocate_section): If -Bsymbolic, do warn
- about undefined symbols, and fill in the GOT entry for a symbol
- defined in a regular object file.
- (elf_i386_finish_dynamic_symbol): If -Bsymbolic, output a RELATIVE
- reloc rather than a GLOB_DAT reloc for a symbol defined in a
- regular object file.
- * elf32-m68k.c (elf_m68k_relocate_section): If -Bsymbolic, do warn
- about undefined symbols, and fill in the GOT entry for a symbol
- defined in a regular object file.
- (elf_m68k_finish_dynamic_symbol): If -Bsymbolic, output a RELATIVE
- reloc rather than a GLOB_DAT reloc for a symbol defined in a
- regular object file.
- * elf32-sparc.c (elf32_sparc_relocate_section): If -Bsymbolic, do
- warn about undefined symbols, and fill in the GOT entry for a
- symbol defined in a regular object file.
- (elf32_sparc_finish_dynamic_symbol): If -Bsymbolic, output a
- RELATIVE reloc rather than a GLOB_DAT reloc for a symbol defined
- in a regular object file.
-
- * config/m68k-coff.mt (SELECT_VECS): Rename from SELECT_VECTORS.
- Correct elements to be actual BFD vector names.
-
- * Makefile.in (Makefile): Don't depend upon @frags@.
- (config.status): Depend upon @frags@.
-
-Fri Jul 7 17:36:44 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffgen.c (coff_renumber_symbols): Sort defined symbols that are
- neither BSF_FUNCTION not BSF_NOT_AT_END just before undefined
- symbols.
- * coffcode.h (coff_slurp_symbol_table): Set BSF_FUNCTION as well
- as BSF_NOT_AT_END.
-
-Fri Jul 7 17:16:15 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * Makefile.in (do_mostlyclean): Remove config.log.
- (do_distclean): Remove config.cache.
-
-Thu Jul 6 14:37:43 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Revert May 24 patch.
- Don't copy PC32 reloc against section into shared object.
-
- * Makefile.in: Rebuild dependencies.
- (CFILES): Added elflink.c.
- (Makefile): Depend upon config.status, not configure.in.
- (config.status): New target; depend upon configure configure.host
- and config.bfd.
-
-Wed Jul 5 20:17:14 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * elfcore.h, elflink.h, elfcode.h, elf.c, elflink.c: Moved some
- primarily size-independent code from elfcode.h to elf.c and new
- file elflink.c; moved out other core- or linker-related routines
- into other new .h files for clarity. Renamed many routines to
- start with bfd_elf or _bfd_elf. Added a structure of
- size-dependent but target-independent info to elfcode.h.
- * Makefile.in: Build elflink.o. Update dependencies.
- * libelf.h: Updated some declarations. Added a definition for the
- new structure in elfcode.h. Added more fields to elf backend data
- structure.
- * elfxx-target.h: Refer to the appropriate size-dependent info.
- * elf32-*.c: Changed some function names. Moved common
- create_dynamic_sections code from m68k, sparc, and i386 support
- into elflink.c. Define some new macros to fill in new fields of
- back end data. Also clean up some "gcc -Wall" warnings regarding
- unused or uninitialized variables.
-
- * Makefile.in (BFD_LIBS): No, don't put elflink.o here.
- * configure.in: Include it here whenever elf.o is specified.
-
-Wed Jul 5 10:31:47 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_object_p): Unconditionally set
- elf_bad_symtab, since sometimes the symbol table is messed up and
- the last symbol is global.
-
- * ecoff.c (_bfd_ecoff_bfd_is_local_label): New function.
- * libecoff.h (_bfd_ecoff_bfd_is_local_label): Declare.
- * elf32-mips.c (mips_elf_is_local_label): New static function.
- (bfd_elf32_bfd_is_local_label): Define.
-
- * configure.in: Use $ac_config_sub, not $configsub.
- * configure: Likewise.
-
- Permit --enable-targets=ieee:
- * config.bfd (*-*-ieee*): New target.
- * config/ieee.mt: New file.
-
-Wed Jul 5 04:16:35 1995 Ken Raeburn <raeburn@kr-pc.cygnus.com>
-
- * config/i386aix.mh (HDEFINES): Remove -DFASCIST_FDOPEN.
-
- Autoconfiscation:
- * configure.in, Makefile.in, doc/Makefile.in: Switch from Cygnus
- configure to autoconf ways of processing --enable arguments,
- setting up symlinks, incorporating makefile fragments, printing
- messages at configuration time, setting variables in Makefile.
- Deleted some unused variables. Check for ranlib via autoconf.
- For now, configure script removes doc/config.status.
- * configure: New file.
- * dep-in.sed: Use @SRCDIR@ instead of @srcdir@, so Makefile.in
- line doesn't get broken by configure.
- * doc/configure.in: Removed.
-
-Tue Jul 4 12:22:21 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * archive.c (_bfd_construct_extended_name_table): If
- BFD_TRADITIONAL_FORMAT is set, limit the length of all file names
- to ar_max_namelen.
- (bfd_dont_truncate_arname): If BFD_TRADITIONAL_FORMAT is set, call
- bfd_bsd_truncate_arname.
- (_bfd_write_archive_contents): Revert June 1 change.
-
- * elfcode.h (NAME(bfd_elf,record_link_assignment)): Add provide
- argument.
- * bfd-in.h (bfd_elf32_record_link_assignment): Update prototype.
- (bfd_elf64_record_link_assignment): Likewise.
- * bfd-in2.h: Rebuild.
-
- * libelf.h (struct elf_link_hash_table): Add needed field. Remove
- saw_needed field.
- * elfcode.h (elf_link_add_object_symbols): If elf_dt_needed_name
- is an empty string, don't make a DT_NEEDED entry in the output
- file. Record all DT_NEEDED entries found in input dynamic
- objects.
- (elf_link_output_extsym): Don't check saw_needed when issuing
- warnings.
- * elf.c (_bfd_elf_link_hash_table_init): Initialize needed, not
- saw_needed.
- (bfd_elf_get_needed_list): New function.
- * bfd-in.h (struct bfd_elf_link_needed_list): Define.
- (bfd_elf_get_needed_list): Define.
- * bfd-in2.h: Rebuild.
-
- * ecoff.c (_bfd_ecoff_find_nearest_line): Also initialize
- find_buffer and fdrtab_len fields of newly allocated
- find_line_info structure.
-
-Mon Jul 3 17:03:52 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (hppa_som_gen_reloc_type): New argument "sym_diff",
- nonzero when we're generating relocations for an expression
- using the difference of two symbols. All callers changed.
- Handle difference of symbols for both R_HPPA and R_COMPLEX
- cases.
- (som_write_fixups): Handle R_COMP1, R_COMP2 and R_CODE_EXPR
- fixups.
-
-Mon Jul 3 13:55:18 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * config.bfd (win32): New configuration.
- * configure.host (pe): Changed to i386win32.
- * config/i386pe.mh: Deleted.
- * config/i386win32.mh: New file.
-
-Mon Jul 3 11:30:45 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (_bfd_ecoff_find_nearest_line): If we allocate
- find_line_info, clear the fdrtab field.
-
- * targets.c (enum bfd_flavour): Add bfd_target_msdos_flavour here,
- rather than in bfd-in2.h.
-
- * bfd.c (enum bfd_error): Define bfd_error_no_armap.
- (bfd_errmsgs): Add string for bfd_error_no_armap.
- * bfd-in2.h: Rebuild.
- * ecoff.c (ecoff_link_add_archive_symbols): If an archive has no
- armap, set bfd_error_no_armap rather than bfd_error_no_symbols.
- * elfcode.h (elf_link_add_archive_symbols): Likewise.
- * linker.c (_bfd_generic_link_add_archive_symbols): Likewise.
-
- * elfcode.h (elf_link_add_object_symbols): Permit common and
- indirect symbols in weakdefs BFD_ASSERT.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Simplify
- BFD_ASSERT to permit some legal, but odd, cases.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
- * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
-
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add versados.o.
- (CFILES): Add pe-i386.c, pei-i386.c, and versados.c.
-
-Sun Jul 2 17:49:32 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Cast base_file
- to FILE * before using it.
- * stab-syms.c: Revert yesterday's patch.
-
-Sat Jul 1 12:10:42 1995 Fred Fish <fnf@cygnus.com>
-
- * stab-syms.c (stdio.h): Include prior to libaout.h, which
- includes bfdlink.h, which now uses FILE.
-
-Sat Jul 1 00:11:08 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * elfxx-target.h: New file.
-
- * libelf.h (struct elf_backend_data): Remove elf_64_p field.
- * elfxx-target.h (elfNN_bed): Don't set it.
-
- * elf32-target.h, elf64-target.h: Deleted.
- * Makefile.in (elf32-target.h, elf64-target.h): Build them from
- elfxx-target.h.
-
-Fri Jun 30 16:07:18 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Compare
- the full text of .reloc or .edata section names.
-
-Fri Jun 30 15:47:37 1995 Fred Fish <fnf@cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section):
- Remove extra '+'.
-
-Thu Jun 29 17:24:52 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * coff-h8300.c (COFF_LONG_FILENAMES): Define.
-
-Wed Jun 28 18:04:42 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * Makefile.in: versados.o is now conditionally built.
- * coffcode.h (add_data_entry): New function.
- (coff_write_object_contents): Clean up. Calculate
- data entries.
- * cofflink.c (_bfd_coff_generic_relocate_section):
- .reloc and .edata sections are IMAGE_BASED too.
- If there's a base_file then write out base information.
- * configure.host (i386-*-pe): New.
- * syms.c (coff_section_type): Only scan prefixes.
- * targets.c (bfd_target_vector): Versados is now conditionally
- built.
- * config/m68k-coff.mt: Build versados.o
- * hosts/i386pe.h: New file.
-
-Mon Jun 26 13:53:49 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hpa.c (elf32_hppa_relocate_section): Close comment before
- R_PARISC_DPREL21L handling.
-
-Thu Jun 22 19:28:36 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- Sun May 7 11:53:41 MDT 1995 Bryan Ford <baford@cs.utah.edu>
-
- * config/i386-moss.mt: created.
-
-Thu Jun 22 08:56:10 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * reloc.c (bfd_perform_relocation): Add case for -ve words.
-
-Wed Jun 21 13:13:49 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Don't try to apply a
- relocation against an undefined symbols.
-
-Wed Jun 21 10:16:10 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * versados.c: Second pass/rewrite.
-
-Mon Jun 19 08:40:45 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * syms.c (coff_section_type): Compare only the front part
- of a section name.
-
-Sat Jun 17 09:40:44 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Set the size of the stub
- section if we get an error.
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Don't mess
- with the operands of an R_PARISC_DPREL21L relocation if the insn
- is not "addil <symbol>,%r27".
-
-Fri Jun 16 15:04:47 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * bfd-in.h (NT_subsystem, NT_stack_heap): Declare but don't
- define.
- * bfd-in2.h: Rebuilt.
- * bfd.c (NT_subsystem, NT_stack_heap): Define.
-
-Fri Jun 16 00:07:25 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_bfd_link_link_relocate): Use the right
- type field (there are two!) when checking to see if $global$ is
- defined.
-
-Thu Jun 15 14:03:47 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * bfd-in.h, bfd-in2.h (bfd_boolean): Rename bfd_true, bfd_false
- to bfd_tttrue, bfd_fffalse so as not to conflict with functions.
- * coffswap.h (coff_swap_scnhdr_out): Remove version that was
- hacked for MPW C.
- * mpw-config.in: Set shell vars instead of pasting to makefile
- for each configuration, edit coffswap.h to make MPW C not choke.
- (i386-unknown-coff, sh-hitachi-hms): Recognize.
- * mpw-make.in (BFD_LIBS): Add versados.c.o.
-
- * versados.c (versados_scan): Properly cast results from bfd_alloc.
-
-Wed Jun 14 15:27:32 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * cofflink.c (process_embedded_commands): New function
- reads and handles .drectve sections for PE.
- (coff_link_input_bfd): Call new function if PE.
-
-Mon Jun 12 12:09:39 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * bfd-in.h (bfd_set_section_vma): Case true to a boolean.
- (bfd_set_cacheable): Likewise.
- * bfd-in2.h: Rebuilt.
-
-Fri Jun 9 12:20:28 1995 Steve Chamberlain <sac@rtl.cygnus.com>
-
- * elfcode.h (elf_sort_hdrs): Rewrite to be symmetrical.
-
-Fri Jun 9 12:49:00 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * targets.c: Add copy_private_symbol_data and link_split_section
- to the target vector.
- * libbfd-in.h (_bfd_generic_bfd_copy_private_symbol_data): Define.
- (_bfd_nolink_bfd_link_split_section): Likewise.
- (bfd_generic_link_split_section): Declare.
- * syms.c (bfd_copy_private_symbol_data): Define.
- * linker.c (bf_link_split_section): Likewise.
- * som.c (som_bfd_copy_private_symbol_data): New function
- (som_bfd_link_split_section): Likewise.
- * All other targets updated with default versions of new routines.
-
- * Take out my braindamaged bfd_true/bfd_false changes from earlier
- today. Replace with just:
- * bfd-in.h: (TRUE_FALSE_ALREADY_DEFINED): Define this if
- compiling with g++-2.6 or later.
- * bfd-in2.h: Rebuilt.
-
-Fri Jun 9 07:54:29 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * versados.c (struct esd, get_4): Lint; use unsigned chars.
-
- * coff-i960.c (coff_i960_relocate): Compare output section names
- when converting for vxworks.
-
-Wed Jun 7 19:01:30 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * elfcode.h (elf_fake_sections): Permit .scommon or COMMON
- sections as random SHT_NOBITS sections, in case a linker script is
- strange.
-
-Tue Jun 6 17:29:32 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * bfd-in.h (NT_subsystem, NT_stack_heap): Moved from pe.h
- * coff-i386.c (coff_i386_rtype_to_howto): Get PE relocs right.
- * coffcode.h (coff_mkobject): Set pe tdata bit when using PE.
- * cofflink.c (COFF_WITH_PE code): Test on obj_pe bit rather
- than conditional compile.
- * configure.in: Fix PE dependencies.
- * libcoff-in.h (obj_pe): New.
- (coff_tdata): Added pe entry.
- * libcoff.h: Regenerated.
-
-Mon Jun 5 09:07:13 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * coff-a29k.c (coff_a29k_adjust_symndx): Completely parenthesize
- macro.
-
-Mon Jun 5 02:15:20 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
-
- Linker support for m68k-elf from Andreas Schwab
- <schwab@issan.informatik.uni-dortmund.de>:
- * elfcode.h (elf_link_add_object_symbols): Check for NULL when
- looping through the symbol hashes.
- (elf_bfd_final_link): When looking for _init and _fini don't use
- the symbol if it is imported from another object.
- * elf32-m68k.c: Relocation type changed from REL to RELA. Regular
- and dynamic linking support functions added, similar to other elf
- targets.
-
- * config.bfd (i[345]86-*-gnu*): Use ELF configuration.
-
-Fri Jun 2 18:54:59 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * versados.c: New file.
- * bfd-in2.h (struct _bfd): New field.
- * bfd.c (struct _bfd): New field.
- * configure.in (versados_vec): New field.
- * targets.c (bfd_flavor): Added versados.
-
-Thu Jun 1 13:51:49 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * coffcode.h (sec_to_styp_flags, styp_to_sec_flags,
- coff_new_section_hook): Any section that starts ".stab"
- is now marked as debugging.
-
-Thu Jun 1 16:15:16 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * archive.c (_bfd_write_archive_contents): Disable extended name
- table until it can be made optional, so that native AR has half a
- chance on SunOS and HP/UX.
-
- * linker.c (_bfd_generic_link_output_symbols, case
- bfd_link_hash_indirect): Add cast to correct pointer types.
-
-Sat May 27 21:37:31 1995 J.T. Conklin <jtc@rtl.cygnus.com>
-
- * config.bfd (m68k-bull-sysv*): Added strip_underscore=yes.
- (m68k-est-coff): Removed. target does not effect object format.
-
-Wed May 24 10:52:01 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * linker.c (_bfd_generic_link_output_symbols): Cope with
- indirect symbols.
-
- * elf32-i386.c (elf_i386_relocate_section): Give error
- message when linking to a shared reloc which isn't there.
-
-Wed May 24 10:40:00 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- Support for ARM-PE.
-
- * Makefile.in, coffcode.h, config.bfd, configure.in, pe-arm.c,
- pei-arm.c, coff-arm.c, reloc.c, targets.c, config/arm-pe.mt:
- Support for ARM COFF/PE.
-
-Tue May 23 19:24:58 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * bfd.c (bfd_get_relocated_section_contents): Now a function,
- tries calling routine from input bfd target vector for
- bfd_indirect_link_order. Put a declaration into the header file.
- * bfd-in2.h: Regenerated.
- * elf32-mips.c (gprel16_with_gp): New function, split out from
- mips_elf_gprel16_reloc.
- (mips_elf_gprel16_reloc): Call it. If output bfd target vector
- isn't elf flavoured, abort, since it's assumed to be elf in some
- of this code, including the code that looks up the gp value.
- (elf32_mips_get_relocated_section_contents): New function,
- modified from bfd_generic_get_relocated_section_contents to deal
- with passing gp to gprel16_with_gp.
- (bfd_elf32_bfd_get_relocated_section_contents): New macro.
- * elf32-target.h (bfd_elf32_bfd_get_relocated_section_contents):
- Don't define if already defined.
-
-Tue May 23 15:58:15 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * Makefile.in: Install bfdlink.h too.
-
-Sun May 21 22:25:09 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Handle undefined and
- notsupported return codes from final_link_relocate (used when
- $global$ is undefined or nonexistant).
- (elf32_hppa_bfd_link_link_relocate): If $global$ exists, but is
- not defined,then return bfd_reloc_undefined.
-
-Fri May 19 10:00:14 1995 Steve Chamberlain <sac@rtl.cygnus.com>
-
- * coffswap.h: (IMAGE_BASE): Define to 0 if not.
-
-Thu May 18 04:24:01 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
-
- Wed May 10 14:28:16 1995 Richard Earnshaw (rearnsha@armltd.co.uk)
-
- * aoutx.h (aout_link_input_section_standard): If defined, call
- MY_relocatable_reloc before doing a partial relocation.
-
- * aout-arm.c: (WRITE_HEADERS): Delete.
- (NAME): Define version to override default in aoutx.h
- (MY(howto_table)): Reformat. Alter some entries slightly.
- (RELOC_ARM_BITS_NEG_{BIG,LITTLE}): Define.
- (MY(reloc_howto), MY(put_reloc), MY(relocatable_reloc)): New functions.
- (MY_reloc_howto, MY_put_reloc, MY_relocatable_reloc): Define.
- (MY(fix_pcrel_26)): Renamed from aoutarm_fix_pcrel_26, return
- bfd_reloc_ok not bfd_reloc_continue.
- (MY(fix_pcrel_26_done)): Likewise.
- (MY(bfd_reloc_type_lookup)): Renamed from aoutarm_reloc_type_lookup.
- (MY_bfd_link_hash_table_create, MY_bfd_link_add_symbols,
- MY_bfd_final_link): Delete.
- (MY_swap_std_reloc_in, MY_swap_std_reloc_out, MY_get_section_contents):
- Define.
- (aoutx.h): Include it.
- (MY(swap_std_reloc_{in,out})): New functions.
- Use RELOC_ARM_BITS_NEG_{BIG,LITTLE} to extract negative reloc bit.
- (aoutarm_squirt_out_relocs): Delete.
-
- From: David Taylor (dtaylor@armltd.co.uk)
- * config/arm[lb]-aout.mt: New files.
- * aout-arm.c: New file.
- * config.bfd: Handle arm{,e[lb]}-*-aout
- * configure.in: Add vetor for aout_arm_{big,little}_vec.
- * reloc.c: New relocation types for the ARM.
- * targets.c (aout_arm_{big,little}_vec): declare.
-
-Tue May 16 10:29:51 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
-
- * libbfd.c (bfd_stat): If bfd_cache_lookup returns an error,
- return an error to the caller. Call bfd_set_error on errors.
-
-Tue May 16 14:44:45 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * libcoff-in.h (coff_renumber_symbols): Modified prototypes in
- accordance with 11 May libcoff.h change.
-
-Thu May 11 16:43:14 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- tekhex.c (first_phase): Understand type 0 symbols.
- (tekhex_write_object_contents): Fix typo in final record.
-
-Thu May 11 16:43:14 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * coff-i960.c (optcall_callback): don't try and optimize
- undefined refs.
- (coff_write_relocs): Search for broken relocs on the way
- out and fix them up.
- (coff_renumber_symbols): Calculate and return index of
- first undefined symbol.
- (coff_write_object_contents): Call coff_renumber_symbols
- and coff_write_relocs with the new args.
- * libcoff.h: (coff_renumber_symbols, coff_renumber_symbols):
- Modified prototypes.
-
-Thu May 11 16:43:14 1995 Steve Chamberlain <sac@slash.cygnus.com>
- Tom Griest <griest@cs.yale.edu>
-
- Initial support for PE format.
-
- * Makefile.in, targets.c, configure.in, config.bfd:
- Add support for i386-*-winnt and i386-*-pe.
- * archive.c (do_slurp_coff_armap): Understand NTPE format
- archives.
- (_bfd_slurp_extended_name_table): Turn \ in a filename
- into /.
- * bfd-in.h (bfd_link_subsystem, _bfd_link_stack_heap): New.
- * coff-i386.c (howto_table): Conditionalize PCRELOFFSET.
- * coffcode.h (IMAGE_BASE): New.
- (coff_compute_section_file_positions): Throw away .junk
- sections for PE, align symbols.
- (coff_write_object_contents): Throw away .junk sections
- for PE. Remember info on .idata and .rsrc sections.
- Fill in the PE header.
- (coff_slurp_symbol_table): PE uses C_SECTION class.
- * cofflink.c (_bfd_coff_final_link): Keep PE info up to date.
- (_bfd_coff_generic_relocate_section): Cope with PE relocs.
- * coffswap.h (coff_swap_{aout/file/scn/sym}hdr_{in/out}):
- New code for PE headers.
-
-Tue May 9 17:01:38 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * config.bfd: Add little endian PowerPC support.
- * configure.in: Ditto.
- * targets.c: Ditto.
- * config/ppcle-elf.mt: New file, for little endian PowerPC
- support.
- * config/ppc-elf.mt: Add little endian powerpc to the BFD
- selection vectors.
- * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Complain if
- linking a different endian object than we expect.
- (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Define, to provide little
- endian support.
-
-Tue May 2 16:32:24 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * config.bfd (hppa*-*-lites*): Treat just like hppa*-*-*elf*.
-
-Tue Apr 25 19:38:43 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * coffgen.c (make_a_section_from_file): Initialize lma same as
- vma.
-
-Tue Apr 25 11:03:21 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * hosts/std-host.h: #include ansidecl.h 'cause PTR is used in
- std-host.h.
-
-Mon Apr 24 23:56:44 1995 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * hosts/i386linux.h (HAVE_PROCFS): Don't define it. Added lengthy
- comment explaining why.
-
-Mon Apr 24 10:34:02 1995 Michael Meissner <meissner@cygnus.com>
-
- * hosts/i386linux.h (HAVE_PROCFS): If NO_PROCFS is defined, don't
- define HAVE_PROCFS.
-
-Mon Apr 24 08:33:12 1995 Michael Meissner <meissner@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Do not continue
- processing unknown symbols to prevent a cascade of errors.
-
-Fri Apr 21 12:48:48 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- Patches from H.J. Lu for Linux ELF core file support.
- * elfcode.h (elf_core_file_matches_executable_p) [HAVE_PROCFS]:
- Use prpsinfo_t instead of struct prpsinfo, for consistency.
- * hosts/i386linux.h (HAVE_PROCFS): Define.
-
-Thu Apr 20 09:07:39 1995 Steve Chamberlain <sac@slash.cygnus.com>
-
- * linker.c (link_action): Do the right thing when a undefined
- strong symbol appears after an undefined weak symbol.
-
-Fri Apr 14 16:51:17 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_relocate_section): New function to relocate
- a whole section for the linker, bypassing bfd_perform_relocation.
- (ppc_elf_reloc_type_lookup): New function to map the BFD
- enumeration code into a howto structure.
- (ppc_elf_howto_raw): Rename from ppc_elf_howto_table.
- (ppc_elf_howto_table): New array that maps PowerPC relocation
- numbers to howto structures without a linear search. Change from
- using bfd_elf_generic_reloc to use ppc_elf_std_reloc.
- (ppc_elf_howto_init): Initialize ppc_elf_howto_table from
- ppc_elf_howto_raw.
- (ppc_elf_reloc_type_lookup): Use a case statement instead of a
- loop.
- (ppc_elf_std_reloc): Replacement for bfd_elf_generic_reloc.
- (ppc_elf_unsupported_reloc): Print a real error message, instead
- of calling abort.
- (ppc_elf_addr16_ha_inner): Abstract getting adjustment from
- ppc_elf_addr16_ha_reloc, so ppc_elf_relocate_section can use it
- too.
- (ppc_elf_addr16_ha_reloc): Call it.
- (ppc_elf_got16_inner): Abstract getting adjustment from
- ppc_elf_got16_reloc, so ppc_elf_relocate_section can use it too.
- (ppc_elf_got16_reloc): Call it.
- (ppc_elf_info_to_howto): Rename from powerpc_info_to_howto.
-
- * elfcode.h (elf_symbol_from_bfd_symbol): Omit space in debugging
- output.
- (elf_symbol_flags): Add debug function to decode flags so that
- defining DEBUG to be 4 will compile again.
- (elf_debug_section): Fix typo in debug output.
-
-Fri Apr 14 16:03:04 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * config.bfd: Add m68*-*-elf*.
- * elf32-m68k.c: Filled out implementation, except for dynamic
- linking support.
- * reloc.c (enum bfd_reloc_code_real): Added *_GOT_PCREL, *_GOTOFF,
- *_PLT_PCREL, *_PLTOFF, *_68K_* relocations for ELF.
- * libbfd.h, bfd-in2.h: Regenerated.
-
-Thu Apr 13 14:28:04 1995 Torbjorn Granlund <tege@adder.cygnus.com>
-
- * coff-m68k.c (COFF_DEFAULT_SECTION_ALIGNMENT_POWER): Change from
- 1 to 2.
- (bfd_target): Change minimum section alignment from 1 to 2.
-
-Wed Apr 12 12:40:04 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * aoutx.h (machine_type, case bfd_arch_mips): Treat R8000 like
- R6000 and R4000 for now.
-
-Tue Apr 4 12:28:25 1995 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-config.in: New file, MPW version of configure.in.
- * mpw-make.in: New file, MPW version of Makefile.in.
- * hosts/mpw.h: New file, MPW host definitions.
- * ecoffswap.h (ecoff_swap_pdr_in, ecoff_swap_pdr_in) [MPW_C]:
- Alternate versions without ECOFF_64 that chokes MPW C.
- * coffswap.h (coff_swap_scnhdr_out): Add alternative version with
- partly-expanded macros.
-
-Thu Mar 30 14:56:21 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * reloc.c (bfd_perform_relocation): Don't bother to check for
- overflow if the symbol is undefined.
-
-Thu Mar 30 14:32:26 1995 H.J. Lu (hjl@nynexst.com)
-
- * config.bfd: Change linux to default to elf. Using
- i[345]86-*-linuxaout will build a library which defaults to a.out.
- * config/i386-laout.mt: Rename from old config/i386-linux.mt.
- * config/i386-linux.mt: Rename from old config/i386-lelf.mt.
- Comment out EXTRALIBS.
- * config/i386-lelf.mt: Remove.
-
-Wed Mar 29 12:01:30 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i960.c (coff_i960_relocate): Cache the section symbol in
- the used_by_bfd field of the section, to avoid looping for each
- reloc.
-
- * cpu-h8500.c (arch_info_struct): Change name from "H8/300" to
- "h8300" for consistency with other cpu-* files.
-
-Tue Mar 28 15:14:11 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * bout.c (b_out_canonicalize_reloc): Handle SEC_CONSTRUCTOR
- sections.
- (b_out_get_reloc_upper_bound): Likewise.
-
- * linker.c (generic_link_add_symbol_list): Skip constructor
- symbols which the main linker code did not do anything with.
- (_bfd_generic_link_output_symbols): Use udata.p if it is set,
- rather than looking the symbol up in the hash table. Just pass
- through constructor symbols for which udata.p is not set. If the
- linker defined the symbol, clear the constructor flag.
-
-Tue Mar 21 10:50:32 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_set_reloc_info): Sign extend constants from
- R_DATA_OVERRIDE fixups.
- * libhppa.h (sign_extend): Renamed from sign_ext. Fix.
- (low_sign_extend): Likewise.
-
-Mon Mar 20 22:39:10 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_slurp_symbol_table): Tighten test to determine
- what symbols are section symbols.
-
-Sat Mar 18 01:54:45 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_bfd_link_add_symbols): An empty archive is OK.
-
-Fri Mar 17 16:29:02 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_copy_private_section_data): Just return true when
- either the input or output section isn't attached to a SOM BFD.
- (som_bfd_copy_private_bfd_data): Similarly for BFD private data.
-
-Fri Mar 17 11:50:34 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_link_add_object_symbols): Check whether a dynamic
- object has already been included, and ignore it the second time.
-
-Wed Mar 15 11:56:40 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-sparc.c (elf_sparc_howto_table): Change R_SPARC_GOT13 from
- complain_overflow_bitfield to complain_overflow_signed.
-
- * libelf.h (bfd_elf32__write_relocs): Don't declare.
- (bfd_elf64__write_relocs): Don't declare.
-
-Tue Mar 14 05:54:33 1995 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * stab-syms.c (aout_stab_name): Moved aout_stab_names to be local
- to this function. Recoded function to stop using table, to
- improve performance (on i486-netbsd host). Left old version
- intact under "#if 0" for further performance testing.
-
-Mon Mar 13 13:48:49 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (write_relocs): Make static. Use PTR argument as a
- pointer to a boolean variable set to true if something fails.
- Cast to PTR rather than void *.
- (sym_is_global): Rewrite for clarity.
- (map_program_segments): If the program header size is too small,
- call _bfd_error_handler and return failure rather than aborting.
- (NAME(bfd_elf,write_object_contents)): Pass boolean variable when
- calling write_relocs.
- (elf_symbol_from_bfd_symbol): Use BFD_ASSERT rather than abort.
- (struct elf_info_failed): Define.
- (NAME(bfd_elf,size_dynamic_sections)): Declare variables in inner
- blocks. Pass elf_info_failed structure when calling
- elf_export_symbol and elf_adjust_dynamic_symbol.
- (elf_export_symbol): Treat data argument as elf_info_failed rather
- than bfd_link_info. Set failed field on error.
- (elf_adjust_dynamic_symbol): Likewise.
- (struct elf_finfo_failed): Define.
- (elf_bfd_final_link): Pass elf_finfo_failed structure when calling
- elf_link_output_extsym. Use BFD_ASSERT rather than abort.
- (elf_link_output_extsym): Treat data argument as elf_finfo_failed
- rather than elf_final_link_info. Set failed field on error.
- (elf_link_input_bfd): Use BFD_ASSERT rather than abort.
- (elf_reloc_link_order): Likewise.
-
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Only write
- out PLTRELSZ, PLTREL and JMPREL relocs if there is a .rela.plt
- section. Solaris 2.4 apparently does not handle empty reloc
- information correctly.
-
- * archive.c (bsd_write_armap): Cast getuid and getgid results to
- long, and print with %ld.
-
-Fri Mar 10 16:41:05 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (translate_to_native_sym_flags): Always use the output
- section if it is not NULL.
-
-Thu Mar 9 15:06:25 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffswap.h (coff_swap_scnhdr_out): If the line number count or
- the reloc count does not fit, print an error and return 0.
- * coffcode.h (coff_write_object_contents): Check return value of
- coff_swap_scnhdr_out.
- * ecoff.c (_bfd_ecoff_write_object_contents): Check return value
- of bfd_coff_swap_scnhdr_out.
-
- * bfd.c: Include <stdarg.h> or <varargs.h>, depending upon
- ANSI_PROTOTYPES.
- (bfd_error_handler_type): New global type.
- (_bfd_error_program_name): New static variable.
- (_bfd_default_error_handler): New static function.
- (_bfd_error_handler): New BFD private global variable.
- (bfd_set_error_handler): New globally visible function.
- (bfd_set_error_program_name): New globally visible function.
- * libbfd-in.h (_bfd_error_handler): Declare.
- * bfd-in2.h, libbfd.h: Rebuild.
-
- * aoutx.h (NAME(aout,swap_ext_reloc_in)): Add symcount parameter,
- and use it instead of bfd_get_symcount. Check r_index after
- setting r_extern based on whether this is a base relative reloc.
- (NAME(aout,swap_std_reloc_IN)): Add symcount parameter, and use it
- instead of bfd_get_symcount.
- (NAME(aout,slurp_reloc_table)): Pass bfd_get_symcount to reloc
- swap routines.
- * libaout.h (NAME(aout,swap_ext_reloc_in)): Add symcount parameter
- to declaration.
- (NAME(aout,swap_std_reloc_in)): Likewise.
- * sunos.c (sunos_canonicalize_dynamic_reloc): Pass
- info->dynsym_count to reloc swap routines.
- * aout-ns32k.c (MY_swap_std_reloc_in): Add symcount parameter.
- * hp300hpux.c (MY(swap_std_reloc_in)): Likewise.
- (MY(slurp_reloc_table)): Pass bfd_get_symcount to reloc swap
- routine.
- * i386lynx.c (NAME(lynx,swap_ext_reloc_in)): Add symcount
- parameter.
- (NAME(lynx,swap_std_reloc_in)): Likewise.
- (NAME(lynx,slurp_reloc_table)): Pass bfd_get_symcount to reloc
- swap routines.
-
-Thu Mar 9 12:04:05 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * bfd.c (bfd_merge_private_bfd_data): New function vector to be
- called by the linker to merge any private bfd data of the input
- files and the output file. Used by the PowerPC ELF support to
- check whether -mrelocatable is used for all modules.
- (bfd_set_private_flags): New function vector to be called by the
- assembler to set private flags. Used by the PowerPC ELF support
- to set that a particular object file was assembled with the
- -mrelocatable option.
-
- * targets.c (BFD_JUMP_TABLE_COPY): Add intiialization of the
- bfd_merge_private_bfd_data and bfd_set_private_flags function
- vectors.
-
- * bfd-in2.h, libbfd-in.h: Rebuild with bfd.c and targets.c
- changes.
-
- * elf32-ppc.c (ppc_elf_set_private_flags): New function to set the
- ELF e_flags field.
- (ppc_elf_copy_private_bfd_data): Copy the e_flags field from the
- input file to the output file.
- (ppc_elf_merge_private_bfd_data): Check for a mismatch between the
- e_flags field of all of the linker input files.
-
- * libelf.h (elf_obj_tdata): Add ppc_flags_init field so that the
- PowerPC support can check if compataible e_flags are present.
-
- * aout-target.h: Add NOP for the bfd_merge_private_bfd_data
- and bfd_set_private_flags function vectors.
- * coffcode.h: Ditto.
- * elf32-target.h: Ditto.
- * elf64-target.h: Ditto.
- * libbfd.h: Ditto.
- * libecoff.h: Ditto.
- * som.c: Ditto.
-
-Wed Mar 8 00:53:54 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * cpu-mips.c (arch_info_struct): Add mips:8000 entry.
-
- * elfcode.h (swap_out_syms): Mark an undefined BSF_WEAK symbol as
- STB_WEAK rather than STB_GLOBAL.
-
-Tue Mar 7 12:23:47 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (bfd_coff_backend_data): Add new field
- _bfd_coff_adjust_symndx.
- (bfd_coff_adjust_symndx): Define.
- (coff_adjust_symndx): Define as NULL if not already defined.
- (bfd_coff_std_swap_table): Initialize new field to
- coff_adjust_symndx.
- * cofflink.c (coff_link_input_bfd): Call coff_adjust_symndx if it
- is defined.
- * coff-a29k.c (coff_a29k_adjust_symndx): New static function.
- (coff_adjust_symndx): Define before including coffcode.h.
- * libcoff.h: Rebuild.
-
- * format.c (bfd_check_format_matches): Skip binary_vec when
- searching through bfd_target_vector.
-
- * elfcode.h (elf_sort_hdrs): Check SHT_NOBITS before checking
- sh_size.
-
-Mon Mar 6 23:31:36 1995 Doug Evans <dje@chestnut.cygnus.com>
-
- * elfcode.h (elf_sort_hdrs): Keep SHT_NOBITS sections after
- !SHT_NOBITS ones.
-
-Mon Mar 6 09:53:08 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * cpu-hppa.c (arch_info_struct): Support both PA1.0 and PA1.1
- machine types.
- (bfd_hppa_arch): Link in both PA1.0 and PA1.1 architecture info
- structures.
- * libhppa.h (enum pa_arch): New enumeration to describe the
- different variants of the PA architecture.
- * som.c (som_object_setup): Use new enumeration to set machine
- type.
- (som_finish_writing): If the machine type is PA1.1, then use the
- PA1.1 machine identifier in the output file.
-
-Thu Mar 2 15:58:24 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,swap_ext_reloc_in)): Treat the index of a
- base relative reloc as an index into the symbol table, regardless
- of the setting of r_extern.
- (NAME(aout,swap_std_reloc_in)): Likewise.
-
- * aoutx.h (NAME(aout,set_section_contents)): Double check that the
- caller is writing to a valid section.
-
-Thu Mar 2 14:37:57 1995 Bryan Ford <baford@cs.utah.edu>
-
- * binary.c: Add support for reading binary files. Loads the raw
- contents of the file into a data section and wraps some symbols
- around it. The symbols `_binary_<filename>_start' and
- `_binary_<filename>_end' indicate the start and end of the data,
- while `_binary_<filename>_size' is an absolute symbol whose value
- is the size of the data. <filename> is the name of the binary
- input file, with all non-alphanumeric characters converted to
- underscores.
-
- * archures.c (bfd_arch_get_compatible): Assume users knows what
- they're doing if one of the architectures is bfd_arch_unknown.
-
-Wed Mar 1 17:30:46 1995 Michael Meissner <meissner@cygnus.com>
-
- * elf32-ppc.c (elf_powerpc_howto_table): For relocation
- R_PPC_GOT16, change complain_on_overflow to be
- complain_overflow_signed.
-
-Wed Mar 1 11:52:55 1995 Jason Molenda <crash@phydeaux.cygnus.com>
-
- * configure.host: Recognize powerpc-*-aix*.
-
-Wed Mar 1 11:57:39 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i960.c (COFF_PAGE_SIZE): Define.
-
- * configure.in: Rewrite output of TDEFAULTS to avoid relying on
- semantics of single quotes in parameter substitution.
-
-Tue Feb 28 12:53:09 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_sort_hdrs): Sort empty sections before non-empty
- sections, if they have the same VMA.
-
- * config.bfd (i[345]86-*-linuxelf*): New target. Use i386-lelf.
- (i[345]86-*-gnuelf*): New target. Use i386-gelf.
- * config/i386-lelf.mt: New file.
- * config/i386-gelf.mt: New file.
-
-Mon Feb 27 12:58:25 1995 Kung Hsu <kung@mexican.cygnus.com>
-
- * config.bfd: add a29k-*-vxworks configuration.
-
-Wed Feb 22 14:40:26 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * libaout.h (NAME(aout,slurp_reloc_table)): Change declaration to
- use reloc_howto_type rather than const struct reloc_howto_struct.
-
-Tue Feb 21 18:19:22 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * bout.c (b_out_slurp_reloc_table): Don't return an error if asked
- for relocations for the .bss section.
-
-Tue Feb 21 15:13:05 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_ar_write_symbol_stuff): Handle objects with odd
- lengths.
-
-Fri Feb 17 12:34:36 1995 Michael Meissner <meissner@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_got16_reloc): Make GOT style relocs add
- 32768, so the GOT pointer can point to 16384 pointers, instead of
- 8192.
-
-Fri Feb 17 11:45:38 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * hosts/sysv4.h: Include <unistd.h>, <stdlib.h>, and <time.h>.
- Only define SEEK_SET and SEEK_CUR if they are not already defined.
- Remove all external function declarations.
-
- * syms.c (bfd_decode_symclass): Return 'W' for a weak symbol.
-
- * coffgen.c (coff_real_object_p): Set start address and flags
- before calling coff_mkobject_hook. Restore them on failure.
- * ecoff.c (_bfd_ecoff_mkobject_hook): If not ECOFF_AOUT_ZMAGIC,
- clear D_PAGED.
-
- * coffgen.c: Reindented.
-
-Thu Feb 16 14:37:23 1995 Doug Evans <dje@cygnus.com>
-
- * reloc.c (bfd_perform_relocation): Don't use bitpos in overflow
- calculations.
- (bfd_install_relocation): Likewise.
-
-Thu Feb 16 13:22:29 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * hosts/std-host.h: Remove all function declarations which return
- int or void, except the one for free.
-
-Wed Feb 15 14:54:18 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (elf_powerpc_howto_table): Use a destination mask of
- 0xffffffff for R_PPC_REL32, not 0.
- (powerpc_reloc_map): Add low 16 bit, high 16 bit, and high 16 bit
- adjusted relocations.
-
-Tue Feb 14 17:47:17 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (struct mips_elf_find_line): Define.
- (mips_elf_find_nearest_line): New static function.
- (bfd_elf32_find_nearest_line): Define.
- * libelf.h (struct elf_obj_tdata): Add find_line_info field.
-
- * ecoff.c (_bfd_ecoff_swap_tir_in): Move to ecofflink.c.
- (_bfd_ecoff_swap_tir_out): Likewise.
- (_bfd_ecoff_swap_rndx_in): Likewise.
- (_bfd_ecoff_swap_rndx_out): Likewise.
- (cmp_fdrtab_entry): Likewise.
- (mk_fdrtab): Likewise.
- (lookup): Likewise.
- (_bfd_ecoff_find_nearest_line): Just call _bfd_ecoff_locate_line
- to do most of the work. Allocate find_line_info if necessary.
- * ecofflink.c: Include "aout/stab_gnu.h".
- (_bfd_ecoff_swap_tir_in): Move in from ecoff.c.
- (_bfd_ecoff_swap_tir_out): Likewise.
- (_bfd_ecoff_swap_rndx_in): Likewise.
- (_bfd_ecoff_swap_rndx_out): Likewise.
- (cmp_fdrtab_entry): Likewise. Use PTR instead of void *.
- (mk_fdrtab): Move in from ecoff.c. Add debug_info, debug_swap,
- and line_info arguments, and use them instead of ecoff_data.
- (fdrtab_lookup): Move in from lookup in ecoff.c. Remove abfd
- argument, add line_info argument. Use it instead of ecoff_data.
- (_bfd_ecoff_locate_line): New function, mostly from the old
- _bfd_ecoff_find_nearest_line in ecoff.c.
- * libecoff.h (ecoff_data_type): Remove find_buffer, fdrtab_len and
- fdrtab fields, replacing them find_line_info field.
- (_bfd_ecoff_swap_tir_in): Declare.
- (_bfd_ecoff_swap_tir_out): Declare.
- (_bfd_ecoff_swap_rndx_in): Declare.
- (_bfd_ecoff_swap_rndx_out): Declare.
- * libbfd-in.h (_bfd_ecoff_locate_line): Declare.
- * libbfd.h: Rebuild.
- * configure.in: Don't use ecoff.o for bfd_elf32_bigmips_vec or
- bfd_elf32_littlemips_vec.
- * Makefile.in: Rebuild dependencies.
-
-Tue Feb 14 14:04:22 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * libelf.h (elf_backend_data): Add fields elf_machine_alt1 and
- elf_machine_alt2 which provide alternate versions of the machine
- code.
-
- * elf32-ppc.c (ELF_MACHINE_ALT1, ELF_MACHINE_ALT2): Define to
- recognize old versions of the PowerPC machine code.
-
- * elf32-target.h (elf32_bed): Initialize alternate machine code
- fields defined by ELF_MACHINE_ALT1 and ELF_MACHINE_ALT2.
-
- * elf64-target.h (elf64_bed): Initialize alternate machine code
- fields defined by ELF_MACHINE_ALT1 and ELF_MACHINE_ALT2.
-
- * elfcode.h (elf_object_p, elf_core_file_p): In addition to the
- main machine code field, check the two alternate machine code
- fields.
-
-Tue Feb 14 12:46:48 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutf1.h (MACHTYPE_OK): Don't define if already defined. Don't
- accept M_SPARC if bfd_arch_sparc is not in the list of supported
- architectures, and don't accept a 680x0 machine type if
- bfd_arch_m68k is not in the list of supported architectures.
- * aout0.c (MACHTYPE_OK): Define.
-
-Mon Feb 13 23:25:38 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,swap_ext_reloc_in)): Don't return a pointer
- to garbage if the symbol index is out of range.
- (NAME(aout,swap_std_reloc_in)): Likewise.
-
-Thu Feb 9 18:36:52 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * Makefile.in (BFD32_BACKENDS): Add i386msdos.o.
-
-Thu Feb 9 12:02:35 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * i386linux.c (NEEDS_SHRLIB): Define.
- (linux_tally_symbols): Crash if a NEEDS_SHRLIB symbol is
- undefined. From hjl@nynexst.com (H.J. Lu).
-
-Wed Feb 8 17:26:00 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * linker.c (generic_link_check_archive_element): Allocate common
- symbol information structure. Don't bother to check for common
- symbol size overflow.
- (_bfd_generic_link_add_one_symbol): Likewise.
- * aoutx.h (aout_link_check_ar_symbols): Likewise.
- * linker.c (generic_link_check_archive_element): Adjust references
- to common symbol information for new structure.
- (_bfd_generic_link_add_one_symbol): Likewise.
- * aoutx.h (aout_link_check_ar_symbols): Likewise.
- (aout_link_add_symbols): Likewise.
- * ecoff.c (ecoff_link_add_externals): Likewise.
- * elfcode.h (elf_link_add_object_symbols): Likewise.
- (elf_link_output_extsym): Likewise.
- * sunos.c (sunos_add_one_symbol): Likewise.
-
-Wed Feb 8 09:53:42 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * elfcode.h (elf_sort_hdrs): Put SHT_NOBITS sections after !SHT_NOBITS.
-
-Tue Feb 7 16:27:33 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_find_nearest_line): Just return false, don't
- abort.
-
-Tue Feb 7 14:43:33 1995 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * ecoff.c: Reformatted some comments and brace constructs in
- recent changes to GNU style.
- (cmp_fdrtab_entry, mk_fdrtab, lookup): Use old-style function
- definitions.
-
-Tue Feb 7 14:21:28 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoffswap.h (ecoff_swap_pdr_in): Zero out intern before setting
- any of the fields.
-
-Mon Feb 6 20:01:24 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- Sat Feb 4 14:20:24 1995 David Mosberger-Tang <davidm@piston.cs.arizona.edu>
-
- * ecoffswap.h (ecoff_swap_pdr_in, ecoff_swap_pdr_out): added
- internalizing/externalizing new "prof" field.
-
- * libecoff.h (ecoff_tdata): added fdrtab.
-
- * ecoff.c (_bfd_ecoff_find_nearest_line): Fixed.
-
-Mon Feb 6 14:25:24 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * libelf.h (struct elf_link_hash_table): Add saw_needed field.
- * elfcode.h (elf_link_add_object_symbols): Set saw_needed if
- DT_NEEDED seen in .dynamic section.
- (elf_link_output_extsym): Warn if an undefined symbol is
- only referenced from a dynamic object, and not making a shared
- object, and saw_needed is false.
- * elf.c (_bfd_elf_link_hash_table_init): Initialize saw_needed.
-
- * libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Don't define.
- * elfcode.h (elf_link_add_object_symbols): Don't clear or set
- ELF_LINK_HASH_DEFINED_WEAK.
- (elf_link_output_extsym): Don't check ELF_LINK_HASH_DEFINED_WEAK.
-
- Distinguish a weak defined symbol from a regular defined symbol.
- * linker.c (enum link_action): Add DEFW.
- (link_action): Add bfd_link_hash_defweak column.
- (_bfd_generic_link_add_one_symbol): Add DEFW case. Handle
- bfd_link_hash_defweak in a few other cases.
- * Many files (bfd_link_hash_undefweak): Renamed from
- bfd_link_hash_weak.
- * aoutx.h (aout_link_write_symbols): Handle bfd_link_hash_defweak.
- (aout_link_write_other_symbol): Likewise.
- (aout_link_input_section_std): Likewise.
- (aout_link_input_section_ext): Likewise.
- * bout.c (get_value): Likewise.
- * coff-a29k.c (coff_a29k_relocate_section): Likewise.
- * coff-alpha.c (alpha_convert_external_reloc): Likewise.
- (alpha_relocate_section): Likewise.
- * coff-mips.c (mips_relocate_section): Likewise.
- (mips_relax_section): Likewise.
- (bfd_mips_ecoff_create_embedded_relocs): Likewise.
- * cofflink.c (coff_write_global_sym): Likewise.
- (_bfd_coff_generic_relocate_section): Likewise.
- * ecoff.c (ecoff_link_add_externals): Likewise.
- (ecoff_link_write_external): LIkewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- (elf32_hppa_size_stubs): Likewise.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise.
- (elf_i386_relocate_section): Likewise.
- (elf_i386_finish_dynamic_symbol): Likewise.
- * elf32-mips.c (mips_elf_output_extsym): Likewise.
- (mips_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
- (elf32_sparc_relocate_section): Likewise.
- * elfcode.h (elf_link_add_object_symbols): Likewise.
- (elf_adjust_dynamic_symbol): Likewise.
- (elf_bfd_final_link): Likewise.
- (elf_link_output_extsym): Likewise.
- * i386linux.c (linux_add_one_symbol): Likewise.
- (linux_tally_symbols): Likewise.
- (linux_finish_dynamic_link): Likewise.
- * linker.c (_bfd_generic_link_output_symbols): Likewise.
- (set_symbol_from_hash): Likewise.
- * reloc16.c (bfd_coff_reloc16_get_value): Likewise.
- (bfd_perform_slip): Likewise.
- * sunos.c (sunos_add_one_symbol): Likewise.
- (sunos_scan_std_relocs): Likewise.
- (sunos_scan_ext_relocs): Likewise.
- (sunos_scan_dynamic_symbol): Likewise.
- (sunos_write_dynamic_symbol): Likewise.
-
-Mon Feb 6 03:20:17 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- Changes from Bryan Ford, baford@schirf.cs.utah.edu:
- * config.bfd (i[345]86-*-msdos*): New target.
- * configure.in (i386msdos_vec): Handle it.
- * i386msdos.c: New file.
- * config/i386-msdos.mt: New file.
- * bfd.c (enum bfd_error): Added new value bfd_error_file_too_big.
- (bfd_errmsgs): Added string to table.
- * libaout.h (reloc_type-lookup): Declare it.
- * targets.c (enum bfd_flavour): Added bfd_target_msdos_flavour.
- (i386msdos_vec): Declare.
- (bfd_target_vector): Add it to the list.
- * bfd-in2.h: Regenerated.
-
-Wed Feb 1 01:32:14 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_set_reloc_info, case R_DATA_ONE_SYMBOL): If there's
- nothing in R_DATA_OVERRIDE, then try to find the addend in the
- section's contents.
- (som_write_fixups): Ignore the addend in a R_DATA_ONE_SYMBOL fixup.
-
- * som.c (som_object_setup): More heruistics to detect the
- braindamaged HP OSF1 linker.
- (setup_sections): Don't forget to free subspace_sections if we get
- an error.
- (som_slurp_string_table): Allocate strings on this bfd's obstack
- rather than directly out of the heap.
- (som_slurp_symbol_table): Likewise for the saved copy of the
- canonical symbols.
- (som_slurp_reloc_table): Likewise for the saved copy of the
- canonical relocations. Free the native relocations when we're
- done with them.
-
-Tue Jan 31 21:53:28 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * libelf.h (struct elf_obj_tdata): New member program_header_size.
- * elfcode.h (get_program_header_size): New parameters sorted_hdrs,
- count, and maxpagesize. All callers updated.
- If sorted_hdrs is non-NULL, use it to compute the number of segments.
- Save result in case called again.
- (assign_file_positions_except_relocs): Sort headers before calling
- get_program_header_size.
-
-Tue Jan 31 15:27:53 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (map_program_segments): Add sorted_hdrs parameter.
- Search through it rather than through unsorted section headers.
- (assign_file_positions_except_relocs): Pass sorted_hdrs to
- map_program_segments.
-
-Mon Jan 30 22:04:53 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * ecoff.c (_bfd_ecoff_find_nearest_line): Fix problems in range
- checking. Expect argument OFFSET to be section-relative. From
- David Mosberger-Tang, davidm@piston.cs.arizona.edu.
-
-Mon Jan 30 11:22:11 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (NAME(bfd_elf,record_link_assignment)): Don't do
- anything if we are not linking an ELF file.
- (NAME(bfd_elf,size_dynamic_sections)): Likewise.
-
-Sat Jan 28 12:48:57 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (compare_subspaces): New function to sort subspaces by
- their location in the object file.
- (setup_sections): When computing the index for each subspace,
- handle case where setup_sections reads the subspaces in a
- different order that they appear in the object file.
- (som_is_space): Also examine the output section for the containing
- section.
- (som_is_subspace, som_is_container): Likewise.
- (som_begin_writing): Don't prepare or write fixups here. When
- writing the symbol strings, use the unsorted symbol table.
- (som_write_object_contents): Don't write the symbol table here.
- (som_finish_writing): Prepare and write the fixups here. Likewise
- for the symbol table.
- (som_bfd_derive_misc_symbol_info): Undefined symbols always have
- type SS_UNSAT regardless of BSF_EXPORT.
- (som_set_reloc_info): Unpack and attach argument location
- information for R_PCREL_CALL and R_ABS_CALL relocations.
-
- * som.c (som_object_setup): New heuristic to determine if the
- entry and flags fields are switched in the exec header.
-
-Sat Jan 28 00:16:01 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_link_add_object_symbols): Use *sym_hash instead
- of h if we might not be doing an ELF link.
-
-Fri Jan 27 16:13:42 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_final_link): If the size of an input
- .reginfo section is zero, force it to the correct size, since the
- linker emulation code may have clobbered it.
-
- * elfcode.h (elf_sort_hdrs): Correct SHF_ALLOC test.
- (assign_file_positions_except_relocs): Free sorted_hdrs.
-
-Thu Jan 26 09:00:12 1995 Steve Chamberlain <sac@splat>
-
- * srec.c (srec_set_section_contents): Fix off by
- one end address calculation.
-
- * config.bfd: (m68*-est-coff): New configuration.
-
-Thu Jan 26 11:39:21 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_link_add_object_symbols): Only examine weakdef if
- we are using an ELF hash table.
-
- * aoutx.h (NAME(aout,some_aout_object_p)): Always set EXEC_P if
- the start address is in the .text section, even if STAT_FOR_EXEC
- is set. Just use STAT_FOR_EXEC as an additional test.
-
-Thu Jan 26 11:12:54 1995 Michael Meissner <meissner@cygnus.com>
-
- * elfcode.h (prep_headers): Use EM_PPC instead of
- EM_CYGNUS_POWERPC.
-
- * elf32-ppc.c (reloc_type): Add all System V.4 and eABI
- relocations currently defined.
- (powerpc_reloc_map): Adjust to new relocation names.
- (elf_powerpc_howto_table): Add most of the new relocations.
- (ELF_MACHINE_CODE): Use EM_PPC instead of EM_CYGNUS_POWERPC.
-
- * config.bfd: Add support for powerpc-*-eabi.
-
- * config/ppc-elf.mt: Add rs6000 architecture support to the
- PowerPC. Also add XCOFF support.
-
-Wed Jan 25 23:26:13 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (CALC_ADDEND): Don't define.
- (coff_sh_relocate_section): Remove.
- (coff_relocate_section): Use _bfd_coff_generic_relocate_section.
-
-Tue Jan 24 14:22:47 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elf32-mips.c (mips_elf_output_extsym): Set the value of the
- ECOFF symbol from the hash table entry.
-
-Mon Jan 23 14:53:35 1995 Steve Chamberlain <sac@splat>
-
- * coff-sh.c (coff_sh_relocate_section): Don't subtract
- vma twice.
-
-Mon Jan 23 13:33:18 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * coff-sh.c (sh_reloc): Don't ignore the previous contents of an
- R_SH_IMM32 reloc.
-
- * config.bfd (i[345]86-*-gnu*): Set bfd_name to i386-gnu.
- * config/i386-gnu.mt: New file. Include ELF support.
-
- * opncls.c (bfd_openstreamr): Call bfd_cache_init.
-
-Fri Jan 20 11:44:45 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * sunos.c (sunos_add_one_symbol): Only set the sunos specific
- fields if we are doing a sunos link.
-
-Wed Jan 18 12:28:17 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * cpu-h8300.c (h8300_info_struct): Change name from "H8/300" to
- "h8300" for consistency with other cpu-* files.
- (h8300h_info_struct): Change name from "H8/300H" to "h8300h".
- * coff-h8300.c (special): Remove unused variable diff.
-
-Tue Jan 17 10:52:32 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * bfd-in.h (bfd_byte, reloc_howto_type): Define here, not...
- * reloc.c (bfd_byte, reloc_howto_type): here.
- * Changed all occurrences of ``const struct reloc_howto_struct''
- to be ``reloc_howto_type'' instead.
- * bfd-in2.h, libbfd.h, libcoff.h: Rebuilt.
-
- * opncls.c (bfd_openstreamr): New function.
- * bfd-in2.h: Rebuilt.
-
- * elf32-mips.c (enum reloc_type): Define new relocs used on Irix.
- (elf_mips_howto_table): Add entries for new relocs.
- (mips_elf_section_from_shdr): Handle SHT_MIPS_MSYM,
- SHT_MIPS_DWARF, and SHT_MIPS_EVENTS.
- (mips_elf_fake_sections): Handle sections named .msym, .debug_*
- and .MIPS.events.*.
-
- * srec.c (srec_init): Remove unused local variable i.
-
-Sat Jan 14 19:09:48 1995 Steve Chamberlain <sac@jonny>
-
- * archures.c, Makefile.in, targets.c, bfd-in2.h, coffcode.h,
- config.bfd, configure.in, config/w65.mt: Initial support for the W65.
-
-Sun Jan 15 13:57:45 1995 Steve Chamberlain <sac@splat>
-
- * opncls.c (bfd_fdopenr): Configure for WIN32.
-
-Thu Jan 12 16:30:47 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * Makefile.in (diststuff): Include `headers'.
-
- * sunos.c (m68k_plt_first_entry, sparc_plt_first_entry): Now
- const.
- * tekhex.c (digs): Ditto.
- * elf32-i386.c (elf_i386_plt0_entry, elf_i386_plt_entry): Ditto.
-
- * srec.c, tekhex.c: Include libiberty.h. Delete static array
- hex_value and replace references to it with references to
- hex_init, hex_p, and hex_value.
- * Makefile.in: Updated dependencies.
-
- * archures.c (archures_init_table): Now const.
- (bfd_arch_init): Adjusted type of local var `ptable'.
-
-Thu Jan 12 09:33:24 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * hosts/symmetry.h: Redefine `shared' to enable compilation
- with the native Dynix cc compiler.
- * i386dynix.c: Include aoutx.h instead of using routines
- from aout32.c.
-
-Wed Jan 11 21:31:41 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * reloc.c (reloc_howto_type): Make typedef include `const'.
- * aout-ns32k.c, aoutx.h, bout.c, cf-m68klynx.c, coff-i386.c,
- coff-i960.c, coff-m68k.c, cofflink.c, cpu-ns32k.c, ecoff.c,
- elf32-hppa.c, elf32-i386.c, elf32-mips.c, elf32-sparc.c,
- elfcode.h, libbfd-in.h, linker.c, mipsbsd.c, nlm32-ppc.c, oasys.c,
- reloc.c, som.c: Don't use `const' in combination with
- `reloc_howto_type'.
- * bfd-in2.h, libbfd.h: Regenerated.
-
- * ecoff.c (ecoff_type_to_string): Local variable `buffer1' doesn't
- need to be static.
-
-Wed Jan 11 14:36:41 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * sunos.c (sunos_add_one_symbol): Don't core dump if a multiple
- definition of an absolute symbol is encountered.
-
- * linker.c (_bfd_generic_link_add_one_symbol): Ignore
- redefinitions of an absolute symbol to the same value.
-
-Mon Jan 9 15:51:32 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (elf_link_add_object_symbols): It's reasonable for no
- flags to be set, so don't insist otherwise.
-
-Fri Jan 6 16:39:40 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (elf_slurp_symbol_table): Don't set BSF_GLOBAL for an
- undefined or common symbol.
- (elf_link_add_object_symbols): Likewise.
-
-Wed Jan 4 14:14:05 1995 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (bfd_section_from_som_symbol): Only return sections which
- correspond to subspaces.
-
- * som.c (som_begin_writing): Don't forget to bump the
- total_subspaces when writing the unloadable subspaces.
-
-Wed Dec 28 20:54:47 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_write_fixups): Use SEC_HAS_CONTENTS to identify
- bss-like sections.
- (som_get_section_contents): Likewise.
- (som_set_section_contents): Likewise.
-
-Tue Dec 27 14:03:47 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (setup_sections): Turn off SEC_HAS_CONTENTS for bss-like
- sections.
-
-Tue Dec 20 15:30:12 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * coffgen.c (bfd_debug_section): Deleted.
- (coff_section_from_bfd_index): Return absolute section for debug
- symbol.
- (coff_write_symbol): Set BSF_DEBUGGING for C_FILE symbols. If
- BSF_DEBUGGING is set, set section to N_DEBUG.
- (coff_bfd_make_debug_symbol): Use absolute section.
-
- * elfcode.h (assign_file_positions_except_relocs): In assertion,
- force all values to the same type.
-
-Tue Dec 20 11:11:58 1994 Steve Chamberlain (sac@jonny.cygnus.com)
-
- * coff-h8300.c (howto_table): All relocs get a special function.
- (special): Never do anything when linking -r.
-
-Tue Dec 20 13:58:01 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * i386linux.c (linux_add_one_symbol): Don't do anything Linux
- specific if this is not a Linux hash table. From Eric Youngdale
- <eric@aib.com>.
-
- Patches from kkojima@mix.or.jp (Kazumoto Kojima):
- * mipsbsd.c (mips_howto_table_ext): Change sizes of memory relocs
- apply to from two bytes to four bytes.
- * MY(reloc_howto_type_lookup): Handle BFD_RELOC_CTOR.
-
- * elf32-i386.c (elf_i386_relocate_section): Correct and expand the
- list of cases for which relocation need not be computed.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
-Mon Dec 19 23:09:16 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_read_symext_info): Delete do_locals and
- do_globals arguments, always read symbol extension information for
- globals and locals. All callers changed.
- (elf32_hppa_size_stubs): Rework to only read symbol extension
- information once for each input bfd. 10% improvement in linker
- performance.
-
-Fri Dec 16 12:28:46 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (elf_section_from_bfd_section): Check
- bfd_is_abs_section, etc., only after checking for the section in
- the BFD and after calling the backend routine.
-
-Wed Dec 14 20:21:58 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (elf_map_symbols): Only use section symbols whose
- value is the start of the section, checking output_offset when
- using output_section. When creating a new symbol, set the value
- to 0, since BFD symbol values are section relative.
-
-Tue Dec 13 13:31:06 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * cpu-z8k.c (arch_info_struct): Make z8002 the default
- architecture.
-
-Fri Dec 9 12:43:05 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (elf_bfd_link_add_symbols): If the first object in the
- archive is not an ELF object, pass the archive to the add_symbols
- entry point appropriate for the first object. From Eric Youngdale
- <eric@aib.com>.
- * aoutx.h (NAME(aout,link_add_symbols)): Similar change if the
- first object is not an a.out object.
-
- * elf32-i386.c (elf_i386_relocate_section): Don't compute
- relocation in cases where we won't use it.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
-Thu Dec 8 14:19:41 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * pc532-mach.c (NAME): Define to use ns32kaout prefix.
- * ns32knetbsd.c (NAME): Ditto.
- (ns32kaout_32_get_section_contents): Define to standard aout-32
- version.
-
-Fri Dec 2 13:56:49 1994 Ian Lance Taylor <ian@rtl.cygnus.com>
-
- * coff-mips.c (mips_read_relocs): New static function, broken out
- of mips_relax_section.
- (mips_relax_section): Call mips_read_relocs.
- (bfd_mips_ecoff_create_embedded_relocs): New function.
- * bfd-in.h (bfd_mnips_ecoff_create_embedded_relocs): Declare.
- * bfd-in2.h: Rebuild.
-
-Wed Nov 30 14:12:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-sh.c: Use _bfd_dummy_target instead of no_archive.
-
-Tue Nov 29 14:00:19 1994 J.T. Conklin <jtc@.rtl.cygnus.com>
-
- * config.bfd (i[345]86-*-freebsd*): Use i386-bsd as bfd_name.
- * configure.host (i[345]86-*-freebsd*): Use i386bsd as my_host.
-
-Mon Nov 28 15:36:04 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
-
- * config/m68k-nbsd.mt (DEFAULT_VECTOR): set to m68knetbsd_vec.
- * Makefile.in: Rebuilt dependancies.
- (CFILES): Added m68knetbsd.c.
- (HFILES): Added netbsd.h.
-
-Wed Nov 23 19:21:41 1994 Steve Chamberlain (sac@jonny.cygnus.com)
-
- * coff-sh.c (shlcoff_vec): New target vector.
- (no_archive): New function.
- * coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Handle
- little endian SH.
- * configure.in: Handle shl.
- * targets.c (bfd_target_vector): Add shlcoff_vec.
- * config/sh-coff.mt (SELECT_VECS): Handle shl_coff_vec.
-
-Wed Nov 23 10:50:13 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elfcode.h (write_relocs): Do not subtract the section's vma from
- the reloc's offset when writing .o's. Instead add the section's
- vma to the reloc's offset when writing an executable or shared
- library.
-
-Tue Nov 22 23:34:37 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Do not add
- input_section->vma to the relocation's offset.
-
-Mon Nov 21 12:37:25 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * srec.c (srec_get_reloc_upper_bound): Define.
- (srec_canonicalize_reloc): Define.
- (srec_bfd_reloc_type_lookup): Define.
- (srec_vec, symbolsrec_vec): Use BFD_JUMP_TABLE_RELOCS (srec).
-
-Sat Nov 19 03:10:51 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * configure.host (i[345]86-*-solaris*): Use solaris2 to
- enable extraction of procfs info from core file for GDB.
-
-Thu Nov 17 17:37:39 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * reloc.c (bfd_reloc_code_type): Add new value BFD_RELOC_12_PCREL.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-Thu Nov 17 13:12:08 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocated): Use the
- vma from the output_section containing $global$ when computing
- global_vlaue.
-
-Thu Nov 17 14:29:13 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * archive.c (_bfd_write_archive_contents): Round up the archive
- header size of the extended name table to an even number.
-
-Wed Nov 16 16:08:06 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * coff-sh.c: Deleted some code that was commented out or inside
- "#if 0".
- (COFF_LONG_FILENAMES): Define.
-
- * cpu-sh.c (arch_info_struct): Convert name to lowercase, for
- consistency with other architectures.
-
-Sat Nov 12 23:50:10 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (elf_export_symbol): Also export symbols which are
- referenced by a regular file.
-
-Fri Nov 11 14:29:31 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add
- export_dynamic argument, and handle it.
- (elf_export_symbol): New function.
- * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration.
- (bfd_elf64_size_dynamic_sections): Update declaration.
- * bfd-in2.h: Rebuild.
-
-Fri Nov 11 10:35:33 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * hpux-core.c (hpux_core_struct): Delete handles for the
- data, reg and stack sections. They're never used. Delete
- accessor macros.
- (make_bfd_asection): Use bfd_make_section_anyway since debugging
- cores from dynamic executables may have several sections with the
- same logical name.
- (hpux_core_core_file_p): Don't save handles to data, reg and
- stack sections. Handle CORE_TEXT, CORE_MMF and CORE_SHM.
-
-Tue Nov 8 13:03:30 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * bout.c (callj_callback): Add new argument shrinking. Change all
- callers. Handle relocs against section symbols correctly. If not
- shrinking, don't subtract out dstidx; the subtraction is already
- in the object file.
-
-Sun Nov 6 12:52:00 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.h: Conditionally include <shl.h> and <dl.h>.
-
-Thu Nov 3 18:19:13 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * Makefile.in (ALL_MACHINES): Include m68knetbsd.o.
-
- * config/i386linux.mh (EXTRALIBS): Include -lm.
-
- Patches from DJ Delorie:
- * coff-go32.c: Replacement file, uses coff-i386.c with minor
- changes.
- * coff-i386.c (TARGET_UNDERSCORE): allow other files to override
- underscore also
- * makefile.dos: del ctor.o, add cofflink.o and elf32.o
-
- * aoutx.h (adjust_o_magic): If user set data section vma, use it
- to determine the default bss vma. Patch from Takada Hiroaki,
- hiro@is.s.u-tokyo.ac.jp.
- (machine_type, case bfd_arch_vax): Set *unknown to false. Patch
- from John David Anglin <dave@hiauly1.hia.nrc.ca>.
-
- * configure.in (tb): Rename ns32knetbsd_vec to pc532netbsd_vec,
- since that's what it's called.
-
-Wed Nov 2 15:24:51 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * archive.c (normalize): Change to take a BFD as an argument.
- Change VMS version to use bfd_alloc rather than malloc, so that we
- don't lose the memory forever.
- (_bfd_construct_extended_name_table): Check the name of an archive
- entry which is not being extended, and correct it if it is wrong.
- This is necessary in case the archive was constructed by another
- program which put an entry in the extended name table which we
- don't plan to put in ourselves. From jjc@jclark.com (James
- Clark).
- (bfd_dont_truncate_arname): Check return value of normalize.
-
-Mon Oct 31 14:19:08 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elf32-hppa.c (ELF32_PARISC_SX_SIZE): Define.
- (ELF32_PARISC_SX_GET, ELF32_PARISC_SX_PUT): Define.
- (symextn_entry): Don't define.
- (symext_chain_size): Change type to bfd_size_type.
- (symextn_contents): Change type to bfd_byte *.
- (elf32_hppa_backend_begin_write_processing): Use
- ELF32_PARISC_SX_SIZE instead of sizeof (symext_entryS).
- (elf32_hppa_size_symext): Likewise. Also, change type of sizep to
- bfd_size_type *.
- (elf_hppa_tc_make_sections): Cast symextn_contents assignment to
- bfd_byte *. Use ELF32_PARISC_SX_PUT instead of direct assignment.
- (elf32_hppa_backend_symbol_table_processing): Use
- ELF32_PARISC_SX_SIZE instead of sizeof (symext_entryS). Use
- ELF32_PARISC_SX_GET insetad of direct assignment.
- (elf32_hppa_read_symext_info): Change type of contents, and its
- assignment cast, to bfd_byte *. Use ELF32_PARISC_SX_SIZE instead
- of sizeof (symextn_entry). Use symext_entryS instead of
- symextn_entry. Use ELF32_PARISC_SX_GET instead of direct
- assignment.
-
- * archive.c (bfd_dont_truncate_arname): Add the ar padding
- character, if there is room for it, even if the name is the
- maximum length.
-
- * elfcode.h (assign_file_positions_except_relocs): Sort the ELF
- headers by section address when assigning file positions.
- (elf_sort_hdrs): New static function.
-
-Sun Oct 30 18:56:58 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Create DT_INIT
- and DT_FINI dynamic entries based on the existence of _init and
- _fini symbols, not on the .init and .fini sections. This is
- compatible with some SVR4 linkers.
- (elf_bfd_final_link): Corresponding change.
-
-Sat Oct 29 12:18:10 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't move a
- symbol with a PLT entry into the .plt section if it is defined in
- a regular file.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
-
- * linker.c (_bfd_generic_link_add_archive_symbols): It's not an
- error if an empty archive has no symbol table.
- * ecoff.c (ecoff_link_add_archive_symbols): Likewise.
- * elfcode.h (elf_link_add_archive_symbols): Likewise.
-
-Fri Oct 28 10:08:41 1994 J.T. Conklin (jtc@rtl.cygnus.com)
-
- NetBSD/m68k support, based on work by mikeb@snow.datametrics.com:
- * config.bfd (m68*-*-netbsd*): Use m68k-nbsd as bfd_name.
- * configure.in (m68knetbsd_vec): Added.
- * targets.c (bfd_m68knetbsd_vec): Added.
- * hosts/m68knbsd.h, config/m68k-nbsd.mt, m68knetbsd.c: New files.
- * Makefile.in (BFD32_BACKENDS, CFILES): Add m68knetbsd.c.
-
- miscellaneous cleanup required by all netbsd targets, based on work
- by Andrew Cagney <cagney@highland.com.au>:
- * netbsd.h (N_MAGIC, N_SET_MAGIC, N_GETMAGIC, N_GETMAGIC2, N_TXTADDR,
- N_TXTOFF, N_ALIGN, N_DATADDR, N_DATOFF): Removed. Generic a.out
- definitions work.
- * i386nbsd.c, ns32knbsd.c, sparcnbsd.c (__LDPGSZ): Removed.
- (MY(write_object_contents)): Use NetBSD's magic numbers
-
-Thu Oct 27 16:59:52 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * libelf.h (struct bfd_elf_section_data): Add field dynindx.
- * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Don't finalize
- the .dynsym, .dynstr or .hash sections until after the backend
- size_dynamic_sections routine, so that it can add dynamic symbols
- if it wants to.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't define the
- symbol to be in the .plt section when generating a shared library
- if it is a defined symbol.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
- (elf32_sparc_size_dynamic_sections): When generating a shared
- library, allocate space for a dynamic symbol for each output
- section, storing the index in the dynindx field of the ELF section
- data. Adjust the other dynindx fields to account for this.
- (elf32_sparc_adjust_dynindx): New static function.
- (elf32_sparc_relocate_section): When copying a reloc into a shared
- library, use the original addend as appropriate. Convert an
- R_SPARC_32 reloc into an R_SPARC_RELATIVE reloc. Use the dynamic
- symbol index of the output section, not the normal symbol index.
- (elf32_sparc_finish_dynamic_sections): Don't die if a section does
- not exist when setting the value of the dynamic tags. Write out
- a dynamic symbol for each output section.
-
-Wed Oct 26 01:15:51 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (aout_link_input_section): Don't bother to read or write
- the relocs if there aren't any.
-
-Tue Oct 25 11:44:38 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * Makefile.in (ALL_MACHINES): Add tekhex.o.
- * targets.c (bfd_target_vector): If SELECT_VECS is not defined,
- include tekhex_vec.
- * tekhex.c (NIBBLE, ISHEX): Cast array arguments to unsigned char.
- (getvalue, getsym, out): Likewise.
- (find_chunk): Remove unused variable s.
- (first_phase): Remove unused variable s.
- (pass_over): Remove unused variable address.
- (tekhex_object_p): Remove unused variable section.
- (move_section_contents): Change return type from boolean to void.
- (tekhex_write_object_contents): Remove unused variables tdata and
- list.
-
- * linker.c (enum link_action): Add CIND.
- (link_action): Change COMMON_ROW\indr from MDEF to CREF. Change
- INDR_ROW\common from MDEF to CIND.
- (_bfd_generic_link_add_one_symbol): In CREF case, handle an
- existing symbol which is indirect rather than defined. Add new
- CIND case.
-
-Mon Oct 24 15:33:16 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- Change S-record backend to use multiple sections to handle gaps in
- file.
- * srec.c (srec_data_list_struct): Move field next from last place
- to first. Change type of data to bfd_byte *.
- (struct srec_symbol): Define.
- (tdata_type): Remove done_symbol_read, count, strings, symbol_idx,
- string_size, string_idx. Change type of symbols to struct
- srec_symbol *. Add symtail and csymbols.
- (low, high): Remove.
- (size_symbols, fillup_symbols, size_srec, fillup): Remove.
- (white, skipwhite, pass_over, object_p): Remove.
- (srec_mkobject): Call srec_init. Adjust tdata initialization for
- field changes.
- (srec_get_byte, srec_bad_byte): New static functions.
- (srec_new_symbol, srec_scan): New static functions.
- (srec_object_p): Change type of b to bfd_byte. Explicitly set
- wrong_format error. Call srec_mkobject and srec_scan instead of
- object_p.
- (symbolsrec_object_p): Likewise. Also, change b to be only two
- bytes.
- (srec_read_section): New static function.
- (srec_get_section_contents): Call srec_read_section rather than
- pass_over. Handle zero length section correctly.
- (set_set_arch_mach): Change from function to macro.
- (srec_set_section_contents): Change data to bfd_byte *.
- (srec_write_record): Change data, end and src to bfd_byte *.
- (srec_write_header): Change buffer and dst to bfd_byte *.
- (srec_write_section): Change location to bfd_byte *.
- (srec_write_terminator): Change buffer to bfd_byte *.
- (srec_get_symtab_upper_bound): Don't call
- srec_get_section_contents.
- (srec_get_symtab): Rewrite.
-
- * ecoff.c (ecoff_set_symbol_info): Set udata.i to 0, not NULL.
-
-Fri Oct 21 16:43:13 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
-
- * libaout.h (machine_type): added M_68K_NETBSD and M_SPARC_NETBSD.
- * i386netbsd.c, ns32knetbsd.c, sparcnetbsd.c: removed RCS Id's.
- changed how PAGE_SIZE and SEGMENT_SIZE are defined so they are
- consistant with each other.
- * netbsd.h (N_HEADER_IN_TEXT, TEXT_START_ADDR): NetBSD fits its
- header into the start of its text segment.
-
-Fri Oct 21 17:13:07 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add case for
- _construct_extended_name_table.
- (bfd_target): Add _bfd_construct_extended_name_table.
- * archive.c (_bfd_archive_bsd_construct_extended_name_table): New
- function.
- (_bfd_archive_coff_construct_extended_name_table): New function.
- (_bfd_construct_extended_name_table): Renamed by adding a leading
- underscore, and made externally visible. Added trailing_slash
- argument, and used it instead of elf_style. Changed type of
- tablen to bfd_size_type *.
- (_bfd_write_archive_contents): Use BFD_SEND to call
- construct_extended_name_table. Use the returned name.
- * libbfd-in.h (_bfd_construct_extended_name_table): Declare.
- (_bfd_noarchive_construct_extended_name_table): Define.
- (_bfd_archive_bsd_construct_extended_name_table): Declare.
- (_bfd_archive_coff_construct_extended_name_table): Declare.
- * bfd-in2.h: Rebuild.
- * libbfd.h: Rebuild.
- * som.c (som_construct_extended_name_table): New static function.
- * aout-target.h (MY_construct_extended_name_table): Define.
- * coff-rs6000.c (rs6000coff_construct_extended_name_table):
- Define.
- * ieee.c (ieee_construct_extended_name_table): Define.
- * libecoff.h (_bfd_ecoff_construct_extended_name_table): Define.
- * oasys.c (oasys_construct_extended_name_table): Define.
-
- Fix the ELF linker to not require an interpreter if no dynamic
- objects were seen, even when linking PIC code.
- * libelf.h (ELF_LINK_HASH_NEEDS_PLT): Define.
- (struct elf_link_hash_table): Add field dynamic_sections_created.
- * elfcode.h (elf_link_record_dynamic_symbol): Create dynstr if it
- doesn't already exist.
- (elf_link_add_object_symbols): Create dynamic sections based on
- dynamic_sections_created field, not dynobj field. Don't bother to
- set dynobj.
- (elf_link_create_dynamic_sections): If dynamic sections were
- already created, don't do anything. If dynobj is already set, use
- it; otherwise, set it to the bfd argument. Don't initialize
- dynsymcount. Only create dynstr if it does not exist. Set
- dynamic_sections_created to true.
- (NAME(bfd_elf,size_dynamic_sections)): Skip most of this function
- if no dynamic objects were seen.
- (elf_adjust_dynamic_symbol): If a symbol has the
- ELF_LINK_HASH_NEEDS_PLT flag set, let the backend adjust it.
- (elf_bfd_final_link): Change most decisions based on dynobj to
- check dynamic_sections_created instead.
- (elf_link_output_extsym): Only handle dynamic symbols if a dynamic
- object was seen.
- * elf.c (_bfd_elf_link_hash_table_init): Initialize new field
- dynamic_sections_created. Set dynsymcount to 1, not 0.
- * elf32-i386.c (elf_i386_create_dynamic_sections): Call
- elf_i386_create_got_section rather than creating the .got and
- .got.plt sections.
- (elf_i386_create_got_section): New static function.
- (elf_i386_check_relocs): Just call elf_i386_create_got_section if
- a GOT table is needed, not bfd_elf32_link_create_dynamic_sections.
- Only create the .rel.got section, and only make space for a reloc,
- for a global symbol or when generating a shared object. For a
- R_386_PLT32 reloc, just set the ELF_LINK_HASH_NEEDS_PLT flag.
- (elf_i386_adjust_dynamic_symbol): Rework initial assertion to
- permit ELF_LINK_HASH_NEEDS_PLT non dynamic symbols. Create a
- procedure linkage table entry for such symbols. But, if no
- dynamic objects were seen, never create a PLT entry.
- (elf_i386_size_dynamic_sections): If no dynamic objects were seen,
- skip most of this function, and force the size of the .rel.got
- section to zero.
- (elf_i386_relocate_section): For a R_386_GOT32 reloc against a global
- symbol when no dynamic object was seen, initialize the contents of
- the .got section. For a R_386_GOT32 against a local symbol, only
- create a R_386_RELATIVE reloc when generating a shared object.
- Treat a R_386_PLT32 reloc against a symbol for which we did not
- create a PLT entry as a R_386_PC32 reloc.
- (elf_i386_finish_dynamic_sections): Only fiddle with the dynamic
- entries and the PLT if we saw a dynamic object.
- * elf32-sparc.c (elf_sparc_howto_table): Fix R_SPARC_PC22 by
- setting rightshift to 10. Fix R_SPARC_WPLT20 by setting
- rightshift to 2, size to 2, bitsize to 30, and dst_mask to
- 0x3fffffff.
- (elf32_sparc_create_dynamic_sections): Don't set the size of the
- .plt section. Call elf32_sparc_create_got_section rather than
- creating the .got section.
- (elf32_sparc_check_relocs): Call elf32_sparc_create_got_section if
- a GOT table is needed, not bfd_elf32_link_create_dynamic_sections.
- Only create the .rela.got section, and only make space for a
- reloc, for a global symbol or when generating a shared object.
- Set the alignment of the .rela.got section to 2. For a
- R_SPARC_WPLT30 reloc, just set the ELF_LINK_HASH_NEEDS_PLT flag.
- (elf32_sparc_adjust_dynamic_symbol): Rework initial assertion to
- permit ELF_LINK_HASH_NEDS_PLT non dynamic symbols. Create a
- procedure linkage table for such symbols. But, if no dynamic
- objects were seen, never create a PLT entry. Initialize the size
- of the .plt section.
- (elf32_sparc_size_dynamic_sections): If no dynamic objects were
- seen, skip most of this function, and force the size of the
- .rela.got section to zero. Strip empty reloc sections, and strip
- an empty .plt section.
- (elf32_sparc_relocate_section): For a GOT reloc against a global
- symbol when no dynamic object was seen, initialize the contents of
- the .got section. For a GOT reloc against a local symbol, only
- create a R_SPARC_RELATIVE reloc when generating a shared object.
- Treat a R_SPARC_WPLT30 reloc against a symbol for which we did not
- create a PLT entry as a R_SPARC_WDISP30 reloc.
- (elf32_sparc_finish_dynamic_sections): Only fiddle with the
- dynamic entries and the PLT if we saw a dynamic object.
-
-Thu Oct 20 13:28:45 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (elf_map_symbols): Don't worry about section symbols
- in a section not owned by any BFD.
- (elf_section_from_bfd_section): Separate out loop which calls
- backend routine. Check bfd_section and call the backend routine
- even for a section not owned by any BFD.
- * elf32-mips.c (mips_elf_section_from_bfd_section): Handle
- .acommon section.
-
-Wed Oct 19 13:28:29 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * coffgen.c (coff_print_symbol): Make names for section number and
- storage class slightly more verbose. It's not clear how many
- characters I can justify using up, but before this change they
- both were abbreviated "sc" which is (IMHO) clearly unacceptable.
-
-Wed Oct 19 01:26:39 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * binary.c (binary_set_section_contents): Set the base file
- position from the lowest section VMA, not the start address.
-
- * aoutx.h (NAME(aout,slurp_symbol_table)): Don't return an error
- if there are no symbols.
- * coffgen.c (coff_get_normalized_symtab): Likewise.
- * hp300hpux.c (MY(slurp_symbol_table)): Likewise.
-
-Tue Oct 18 12:56:43 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * aout-target.h (MY_bfd_copy_private_section_data): Only copy
- subformat to another bfd_target_aout_flavour file.
-
- * binary.c: New file for raw binary output format.
- * Makefile.in (BFD_LIBS): Add binary.o.
- (CFILES): Add binary.c.
- * targets.c (binary_vec): Declare.
- (bfd_target_vector): Include binary_vec.
-
- * srec.c (tdata_type): Add field tail.
- (srec_mkobject): Initialize tail.
- (srec_set_section_contents): Sort S record list by address.
-
-Mon Oct 17 11:38:16 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (elf_map_symbols): Sort the symbols into a new array,
- rather than messing with Elf_Sym_Extra. Store the symbol index in
- the udata.i field.
- (swap_out_syms): Use outbound_syms as a pointer rather than as an
- array. Don't worry about elf_sym_num.
- * libelf.h (struct elf_sym_extra): Don't define.
- (Elf_Sym_Extra): Don't define.
- (struct elf_obj_tdata): Remove sym_extra field.
- (elf_sym_extra): Don't define.
- * elf32-hppa.c (elf32_hppa_backend_final_write_processing): Use
- udata.i rather than elf_sym_extra array.
-
- * syms.c (asymbol): Change udata field into a union.
- * bfd-in2.h: Rebuild.
- * aoutx.h (NAME(aout,translate_symbol_table)): Use udata.p rather
- than just udata.
- * bout.c (perform_slip): Likewise.
- * hp300hpux.c (MY(slurp_symbol_table)): Likewise.
- * ieee.c (ieee_slurp_external_symbols): Likewise.
- * linker.c (generic_link_add_symbol_list): Likewise.
- (default_indirect_link_order): Likewise.
- * oasys.c (oasys_slurp_symbol_table): Likewise.
- * reloc16.c (bfd_perform_slip): Likewise.
- * srec.c (fillup_symbols): Likewise.
- * coffcode.h (get_index): Use udata.i rather than just udata.
- (coff_slurp_symbol_table): Likewise.
- * coffgen.c (set_index): Likewise.
- * ecoff.c (ecoff_set_symbol_info): Likewise.
- * elfcode.h (elf_symbol_from_bfd_symbol): Likewise.
- * libecoff.h (ecoff_get_sym_index, ecoff_set_sym_index): Likewise.
- * som.c (compare_syms): Likewise.
- (som_prep_for_fixups): Likewise.
- (som_write_fixups): Likewise.
-
- Use a hash table when writing out ELF symbol names.
- * elfcode.h (elf_stringtab_init): New static function.
- (bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove.
- Change all callers to use elf_stringtab_init or
- _bfd_stringtab_add, and get stringtab lengths using
- _bfd_stringtab_size.
- (elf_fake_sections): Change ignored argument to pointer to
- boolean, and set the boolean to true if an error occurs. If an
- error has already occurred, don't do anything.
- (assign_section_numbers): Just set sh_size, not contents.
- (elf_compute_section_file_positions): Pass the address of a
- boolean to elf_fake_sections. Pass the address of a
- bfd_strtab_hash to swap_out_syms. Write out the .strtab section.
- (prep_headers): Change shstrtab to bfd_strtab_hash.
- (swap_out_syms): Take a pointer to a bfd_strtab_hash as an
- argument. Set it to the symbol names.
- (NAME(bfd_elf,write_object_contents)): Write out the section
- header names using _bfd_stringtab_emit.
- (elf_debug_section): Remove first argument; get the section name
- via the bfd_section pointer. Change caller.
- (elf_bfd_final_link): Write out the symbol names using
- _bfd_stringtab_emit. Likewise for the .dynstr section contents.
- Free the symbol names at the end of the function.
- (elf_link_input_bfd): Remove the last argument, output_names,
- from relocate_section. Save the old symbol contents before
- calling elf_link_output_sym, and restore them afterward.
- * libelf.h (struct elf_link_hash_table): Change dynstr field to
- struct bfd_strtab_hash.
- (struct elf_backend_data): Remove last argument, output_names,
- from elf_backend_relocate_section field.
- (struct strtab): Don't define.
- (struct elf_obj_tdata): Change strtab_ptr field to struct
- bfd_strtab_hash.
- * elf32-hppa.c (elf32_hppa_relocate_section): Remove last
- argument, output_names.
- * elf32-i386.c (elf_i386_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
- * libbfd-in.h (DEFAULT_STRING_SPACE_SIZE): Don't define.
- (bfd_add_to_string_table): Don't declare.
- * libbfd.h: Rebuild.
- * libbfd.c (bfd_add_to_string_table): Remove.
-
- * elfcode.h (elf_swap_shdr_in): Use bfd_section, not rawdata.
- Clear contents field.
- (bfd_section_from_shdr): In SHT_STRTAB case, check bfd_section,
- not rawdata. Don't set rawdata if e_shstrndx. Use bfd_section
- rather than rawdata in commented out code. In SHT_REL[A] case,
- don't bother to check elf_section_data of section returned by
- section_from_elf_index.
- (elf_fake_sections): Set bfd_section, not rawdata. Don't set
- size.
- (elf_map_symbols): Don't set elf_num_section_syms. Don't create
- section symbols that already exist.
- (assign_file_position_for_section): Use bfd_section, not rawdata.
- (section_from_elf_index): Just check bfd_section field.
- (elf_section_from_bfd_section): Likewise.
- (elf_debug_section): Don't print rawdata, contents, or size.
- (elf_link_add_object_symbols): Don't error out if
- section_from_elf_index returns NULL.
- (elf_bfd_final_link): Check return value from
- section_from_elf_index against NULL, not bfd_is_abs_section.
- (elf_link_input_bfd): Don't check section_from_elf_index return
- value.
- * libelf.h (struct elf_obj_tdata): Remove num_section_syms field.
- (elf_num_section_syms): Don't define.
- * elf.c (elf_get_str_section): Store section contents in contents
- field rather than rawdata field.
- (elf_string_from_elf_section): Likewise.
- (_bfd_elf_make_section_from_shdr): Store BFD section pointer in
- bfd_section field rather than rawdata field.
- * elf32-hppa.c (elf32_hppa_read_symext_info): Use bfd_section
- rather than rawdata.
- (elf32_hppa_size_stubs): Likewise.
- (elf32_hppa_backend_symbol_table_processing): Don't set
- symextn_hdr->size; just use sh_size.
- * elf32-mips.c (mips_elf_final_write_processing): Use bfd_section
- rathern than rawdata.
- (mips_elf_section_from_shdr): Likewise.
- (mips_elf_section_processing): Likewise.
- (mips_elf_section_from_bfd_section): Remove rawdata check.
-
- * srec.c (pass_over): Set the start address for S7, S8 or S9.
-
-Fri Oct 14 19:15:46 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * VERSION: Updated to 2.5.
-
-Fri Oct 14 11:07:50 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * bfd.c (bfd_scan_vma): Cast end to be non const before passing it
- to strtoul.
-
-Thu Oct 13 14:40:41 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * bfd.c (bfd_scan_vma): Pass end argument on to strtoul.
-
-Wed Oct 12 16:46:43 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * opncls.c (bfd_realloc): Deleted, since it's broken and fixing it
- would make it slow. Besides, it isn't used much.
- * elfcode.h (elf_map_symbols): Always allocate new storage for the
- symbol table.
-
-Wed Oct 12 11:54:37 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * ecoff.c (ecoff_set_symbol_info): Mark local stProc, stLabel or
- stabs symbols as BSF_DEBUGGING.
-
- * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Make
- str1 and str2 const pointers.
-
- * Makefile.in (INSTALL): Use top level install.sh script.
- * config/README (INSTALL): Remove.
- * config/delta88.mh (INSTALL): Remove.
- * config/i386v4.mh (INSTALL): Remove.
- * config/irix4.mh (INSTALL): Remove.
- * config/irix5.mh (INSTALL): Remove.
- * config/ncrt3000.mh (INSTALL): Remove.
-
-Tue Oct 11 13:57:56 1994 Eric Youngdale (eric@andante.aib.com)
-
- * elf32-i386.c (elf_i386_check_relocs): Make sure that a symbol
- with a global offset table entry or a procedure linkage table
- entry is added to the dynamic symbol table.
- * elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): If a symbol has
- already gotten a procedure linkage table entry, change the
- definition to the PLT entry.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
-
-Tue Oct 11 17:12:00 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * lynx-core.c (lynx_core_file_p): SPARC Lynx appears to start
- dumping the .data section in a core file at a page boundary.
-
-Mon Oct 10 16:24:44 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * cofflink.c (_bfd_coff_final_link): Cast argument to bfd_h_put_32
- to correct type.
- (coff_read_string_table): Cast argument to bfd_h_get_32 to correct
- type.
- * elfcode.h (elf_link_output_extsym): Cast argument to
- bfd_elf_hash to correct type.
-
- * elf32-sparc.c (elf_sparc_howto_table): The PC10, PC22, and
- WPLT30 relocations are PC-relative.
-
-Thu Oct 6 12:57:26 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-
- * aoutx.h (adjust_o_magic): Correctly initialize vma if the vma of
- the text section was user-defined.
-
-Wed Oct 5 14:42:12 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * archive.c (bfd_construct_extended_name_table): SVR4 uses slash
- newline at the end of the file name, not just newline.
-
-Tue Oct 4 11:23:12 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * ecoff.c (_bfd_ecoff_new_section_hook): Default section alignment
- power to 4, rather than using align_power_min.
-
- * coffcode.h (coff_new_section_hook): Don't use align_power_min;
- use COFF_DEFAULT_SECTION_ALIGNMENT_POWER instead. Force the .stab
- and .stabstr sections to be aligned to no more than 2. Remove
- COFF_SPARC special cases.
- * coff-a29k.c: Define COFF_DEFAULT_SECTION_ALIGNMENT_POWER.
- * coff-apollo.c, coff-go32.c, coff-h8300.c: Likewise.
- * coff-h8500.c, coff-i386.c, coff-i960.c, coff-m68k.c: Likewise.
- * coff-m88k.c, coff-rs6000.c, coff-sh.c, coff-sparc.c: Likewise.
- * coff-we32k.c, coff-z8k.c: Likewise.
-
- * configure.in: Use ${config_shell} when running config.bfd.
-
- * cofflink.c (coff_link_input_bfd): Don't try to convert a long
- filename if the offset field is zero.
-
- * elfcode.h (swap_out_syms): If the alignment of a common symbol
- was not set, use a sensible default rather than zero.
-
-Mon Oct 3 16:04:29 1994 H.J. Lu (hjl@nynexst.com)
-
- * opncls.c (bfd_close): Honor umask when setting execution bits.
- (bfd_close_all_done): Likewise.
-
-Mon Oct 3 04:41:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * rs6000-core.c (rs6000coff_core_p): Set SEC_HAS_CONTENTS flag
- for .stack and .ldinfo sections. Cast coredata.c_tab to a
- file_ptr to avoid warnings from gcc.
-
-Fri Sep 30 13:11:38 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * elfcode.h (elf_bfd_final_link): Remove assertion when a non
- SEC_IN_MEMORY section is found in dynobj. This can happen when
- linking PIC compiled code.
-
-Thu Sep 29 15:21:44 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * reloc.c (bfd_install_relocation): Change type of "data" to
- bfd_byte *, to go along with yesterday's change.
-
- * elf.c (bfd_elf_print_symbol): Moved here from elf_print_symbol
- in elfcode.h. (case bfd_print_symbol_all): Print symbol's size
- field, except for common symbols; print their alignment.
- * elfcode.h (elf_print_symbol): Deleted.
- * libelf.h (bfd_elf_print_symbol): Declare.
- (bfd_elf{32,64}_print_symbol): Replace declarations with macros.
-
- * syms.c (bfd_print_symbol_vandf): Show BSF_LOCAL and BSF_GLOBAL
- in one column. Use the column freed up to show BSF_FUNCTION and
- BSF_FILE.
-
-Thu Sep 29 12:29:01 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * syms.c (stt): Add .rdata and .rodata.
-
-Wed Sep 28 13:35:05 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * reloc.c (bfd_install_relocation): Cast data_start to bfd_byte *
- before trying to add values to it.
-
-Tue Sep 27 16:47:58 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
-
- * elf32-hppa.c (elf32_hppa_backend_final_write_processing): Cast
- return value from elf_sym_extra.
- (elf32_hppa_build_stubs): Cast return value from bfd_zalloc.
- (elf32_hppa_size_stubs): Cast return value from malloc.
-
- * gen-aout.c (main): Declare and initialize "arch".
-
- * cofflink.c (coff_link_add_symbols): Cast return value of
- bfd_hash_allocate.
-
- * riscix.c (riscix_callback): Use PARAMS macro in prototype.
-
- * reloc.c (bfd_install_relocation): New function, mostly copied
- from bfd_perform_relocation, adjusted for the assembler's needs.
- * bfd-in2.h: Regenerated.
-
-Mon Sep 26 11:00:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elfcode.h (assign_file_positions_except_relocs): Align the
- section VMA and the file position even if D_PAGED is not set.
-
- * bfd-in.h (bfd_seek): Change declaration to not mark fp const.
- * bfd-in2.h: Rebuild.
- * libbfd.c (bfd_seek): Don't mark parameters const, to avoid
- conflicts with declaration.
-
-Fri Sep 23 15:15:31 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elfcode.h (map_program_segments): Don't abort if we allocated
- too much space for the program header, only if we allocated too
- little.
- (assign_file_positions_except_relocs): Similar change.
-
-Tue Sep 20 13:17:07 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
-
- * libaout.h: Fix comment.
- * ns32knbsd.h: Changed M_NS32K_NETBSD to M_532_NETBSD to match
- libaout.h.
-
-Tue Sep 20 15:23:21 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * Makefile.in: Rebuilt dependencies.
- (BFD32_BACKENDS): Add sparcnetbsd.o.
- (CFILES): Add ns32knetbsd.c and sparcnetbsd.c.
- * targets.c: ns32knetbsd_vec was renamed to pc532netbsd_vec.
-
- * coff-sh.c (rtype2howto): Remove; unused.
- (coff_sh_relocate_section): Remove unused local variable rstat.
- (reloc_processing): Comment out; unused.
-
-Fri Sep 16 12:12:27 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * aoutx.h (aout_link_write_other_symbol): If h->indx is -2, then
- always write it out even if it would normally be stripped.
- (aout_link_input_section_std): If we find a reloc against a
- stripped global symbol, force it to be written out rather than
- merely calling unattached_reloc.
- (aout_link_input_section_ext): Likewise.
- (aout_link_reloc_link_order): Likewise.
-
-Wed Sep 14 15:37:19 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.h (struct somdata): New field sorted_syms.
- (obj_som_sorted_syms): Accessor macro.
- * som.c (som_object_setup): Initialize sorted_syms to NULL.
- (som_prep_for_fixups): Sort a copy of the BFD's symbol table;
- store the sorted symbol table in sorted_syms.
- (som_write_fixups): Initalize tmp_reloc to NULL to make GCC happy.
- (som_begin_writing): Similarly for exec_header. Pass the sorted
- symbol table to som_write_symbol_strings.
- (som_build_and_write_symbol_table): Use the sorted symbols rather
- than the canonical symbol table.
-
- * som.h (som_symbol_type): Add "stringtab_offset" field.
- * som.c (som_write_symbol_strings): Use "stringtab_offset"
- rather than destroying the "name" field in the BFD symbol.
- (som_build_and_write_symbol_table): Likewise.
-
-Wed Sep 14 15:06:55 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * aoutx.h (aout_link_write_symbols): Rename skip_indirect to
- skip_next. If we find an N_WARNING symbol which has already been
- written out, set skip_next.
-
- * libecoff.h (struct ecoff_tdata): Add field find_buffer.
- * ecoff.c: Include aout/stab_gnu.h.
- (ecoff_find_nearest_line): Handle stabs debugging information.
-
- * elfcode.h (elf_link_output_extsym): Keep a symbol marked as weak
- even if it is referenced by another object.
-
-Tue Sep 13 17:57:00 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_fixup_formats): Case R_ENTRY (0xb3), set both
- 'T' and 'U' to grab all the unwind information.
- (som_set_reloc_info): Make 'U' unwind bits persist across
- multiple SOM relocations. Set the addend field of an R_ENTRY
- relocation to the value in 'T'; set the addend field on an
- R_EXIT relocation to the value in 'U'.
-
- * som.h (som_symbol_type): Delete unwind field.
-
- * som.c (som_write_fixups): For R_ENTRY fixups, get 32bits of
- unwind information from the addend field of the R_ENTRY, get the
- other 32bits from the addend field of the R_EXIT.
- (bfd_som_attach_unwind_info): Delete function and all references.
-
- * som.h (som_symbol_type): Delete unused a.out-related fields.
-
- * som.c (bfd_section_from_som_symbol): Use bfd_abs_section_ptr
- instead of &bfd_abs_section.
-
- * som.c (som_object_setup): Handle exec_entry and exec_flags being
- switched in executables created by the OSF1 linker.
- (som_write_fixups): Handle R_EXIT just like the R_{F,L,R}SEL
- fixups. Support R_ALT_ENTRY (handle just like R_EXIT).
-
-Tue Sep 13 16:04:07 1994 Steve Chamberlain (sac@jonny.cygnus.com)
-
- * cofflink.c (coff_link_input_bfd): syment_base is unsigned
- so can't compare -ve numbers with it.
-
-Mon Sep 12 20:31:17 1994 Steve Chamberlain (sac@jonny.cygnus.com)
-
- * configure.in (shcoff_vec): Use cofflink.o now.
- * coff-sh.c: Rewritten to use new fast coff backend.
-
-Tue Sep 13 16:23:57 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * aoutx.h (NAME(aout,final_link)): Don't assume that all the input
- files are a.out.
-
-Tue Sep 13 11:09:39 1994 J.T. Conklin (jtc@rtl.cygnus.com)
-
- * configure.host (sparc-*-netbsd): use sparcnbsd.
- (ns32k-*-netbsd): use ns32knbsd.
-
- * hosts/{nbsd,i386nbsd,ns32knbsd,sparcnbsd}.h: New files, NetBSD
- host support.
-
- * sparcnetbsd.c: New file, adds support for NetBSD/sparc.
- * config/sparc-nbsd.mt: Likewise.
-
- * netbsd.h: New file, definitions common to all netbsd ports.
- * i386netbsd.c: Use it.
- * ns32knetbsd.c: Use it.
-
- * Makefile.in, configure.in, targets.c, config/i386-nbsd.mt,
- config/ns32k-nbsd.mt: canonicalize netbsd targets to conform to
- file/variable naming conventions.
- * i386netbsd.c: New file, renamed from netbsd386.c.
- * ns32knetbsd.c: New file, renamed from netbsd532.c.
-
-Mon Sep 12 21:56:20 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_reloc_skip): Correct off-by-one error for 4-byte
- R_NO_RELOCATION fixups.
- (bfd_section_from_som_symbol): Return the absolute section if the
- symbol isn't contained in any section in the output file.
- (som_slurp_symbol_table): ST_PRI_PROG and ST_SEC_PROG symbols are
- not function symbols (they are magic code labels which *can* be the
- targets of cross space branches). $START$ is not a section symbol.
-
-Mon Sep 12 11:43:08 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coff-alpha.c (ecoffalpha_little_vec): Add SEC_CODE and SEC_DATA
- to section_flags.
- * coff-mips.c (ecoff_little_vec, ecoff_big_vec): Likewise.
-
- * elfcode.h (swap_out_syms): Set the type of an undefined symbol
- to STT_FUNC if the BSF_FUNCTION flag is set.
-
- * cofflink.c (coff_link_input_bfd): If r_symndx is -1, don't
- change it.
- (_bfd_coff_generic_relocate_section): If r_symndx is -1, it is an
- absolute reloc. Don't dump core using r_symndx as an array index.
- * cf-m68klynx.c (coff_bfd_link_add_symbols): Define.
- (lynx_link_add_symbols): New static function (copy of function in
- coff-i386.c).
- (coff_m68k_lynxrtype_to_howto): sym argument may be NULL.
- * coff-i386.c (coff_i386_rtype_to_howto): Likewise.
- * coff-a29k.c (coff_a29k_relocate_section): Handle an r_symndx
- value of -1, meaning an absolute reloc.
-
- * ctor.c: Remove; obsolete.
- * Makefile.in: Rebuild dependencies.
- (BFD_LIBS): Remove ctor.o.
- (CFILES): Remove ctor.c.
- * libbfd.h: Rebuild.
-
-Mon Sep 12 01:58:47 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (elf32_hppa_relocate_section): If there was a link
- error of some sort (for example, undefined symbols), then do not
- apply any relocs, just notify the user of the errors.
- (elf32_hppa_backend_begin_write_processing): Do not build a symbol
- extension section for an executable (it's useless).
- (elf32_hppa_link_output_symbol_hook): Do nothing if there was a
- link error of some sort (for example, undefined symbols).
- (elf32_hppa_read_symext_info): Kludge. Turn off SEC_HAS_CONTENTS
- for all the input symbol extension sections to keep the generic
- BFD code happy. Temporarily turn it on to read the contents of
- the symbol extension section.
-
-Sun Sep 11 21:58:59 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * config/hppaosf.mh (RANLIB): Do not set.
- * config/hppabsd.mh (RANLIB): Likewise.
-
-Sun Sep 11 22:50:49 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * cf-i386lynx.c: Remove #if 0 code.
- (i386_lynxos_coff_object_p): Remove unused function.
- (coff_bfd_link_add_symbols): Define.
- (lynx_link_add_symbols): New static function.
- * coffcode.h (coff_bfd_link_hash_table_create): If
- coff_relocate_section is defined, only define this if not already
- defined.
- (coff_bfd_link_add_symbols, coff_bfd_final_link): Likewise.
-
- * linker.c (_bfd_generic_final_link): Handle
- bfd_indirect_link_order explicitly, rather than via
- _bfd_default_link_order.
- (set_symbol_from_hash): New static function, broken out of
- _bfd_generic_link_write_global_symbol.
- (_bfd_generic_link_write_global_symbol): Symbol setting code moved
- to set_symbol_from_hash; call it.
- (default_indirect_link_order): Add generic_linker argument.
- Change all callers. If false, set the generic symbols based on
- the hash table entries.
-
-Fri Sep 9 11:51:49 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coffgen.c (coff_get_symtab): Reindented. Removed commented out
- call to bfd_constructor_entry.
-
- Convert m68k COFF to use new COFF backend linker.
- * coff-m68k.c (coff_relocate_section): Define.
- * cf-m68klynx.c (coff_rtype_to_howto): Define.
- (coff_m68k_lynx_rtype_to_howto): New static function.
- * configure.in (m68kcoff_vec): Build cofflink.o.
- (m68kcoffun_vec, m68klynx_coff_vec): Likewise.
-
-Thu Sep 8 16:20:38 1994 Steve Chamberlain (sac@jonny.cygnus.com)
-
- * coff-h8300.c (h8300_reloc16_extra_cases, case RELBYTE): Flag
- overflows correctly.
-
-Wed Sep 7 19:01:42 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * libelf.h (struct elf_backend_data): Change second argument of
- elf_backend_final_write_processing hook to boolean.
- (struct elf_obj_tdata): Add linker field.
- * elfcode.h (NAME(bfd_elf,write_object_contents)): Pass value of
- tdata linker field to final_write_processing, rather than NULL.
- (elf_bfd_final_link): Don't call final_write_processing hook. Set
- tdata linker field to true.
- * elf32-mips.c (mips_elf_final_write_processing): Change type of
- second argument to boolean.
- * elf32-hppa.c (elf32_hppa_backend_final_write_processing):
- Likewise.
-
- * coff-go32.c (RTYPE2HOWTO): Fully parenthesize arguments.
- * coff-i960.c (RTYPE2HOWTO): Likewise.
- * coff-m88k.c (RTYPE2HOWTO): Likewise.
- * coff-we32k.c (RTYPE2HOWTO): Likewise.
-
- Make i386 COFF use new COFF backend linker.
- * coff-i386.c (RTYPE2HOWTO): Fully parenthesize arguments.
- (coff_relocate_section): Define.
- (coff_i386_rtype_to_howto): New function.
- * configure.in (i386coff_vec): Use cofflink.o.
- (i386lynx_coff_vec): Likewise.
-
- * coffcode.h (bfd_coff_backend_data): Add new field
- _bfd_coff_rtype_to_howto.
- (bfd_coff_rtype_to_howto): Define.
- (coff_rtype_to_howto): Define to use RTYPE2HOWTO, if not already
- defined.
- (bfd_coff_std_swap_table): Initialize new field.
- * cofflink.c (_bfd_coff_final_link): Allocate section_count + 1
- section_info structures, since the target_index is 1 based.
- (coff_link_input_bfd): Set *secpp to bfd_com_section_ptr for a
- common symbol. Adjust rel_hash by the output reloc count.
- (_bfd_coff_generic_relocate_section): New function.
- * libcoff-in.h (_bfd_coff_generic_relocate_section): Declare.
- * libcoff.h: Rebuild.
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
-
-Tue Sep 6 23:28:52 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_derive_misc_symbol_info): Treat undefined code
- symbols and undefined symbols which no type in the same manner
- if the associated BFD symbol has BSF_FUNCTION set. For a defined
- symbol which no type, select a SOM type based on the flags of the
- section containing the symbol.
- (som_slurp_symbol_type): Set BSF_FUNCTION for undefined ST_STUB
- or ST_CODE symbols (importing a non-function code symbol is
- meaningless in SOM).
- (som_set_reloc_info): Don't set "offset" to the section's vma; it
- should always start at zero.
-
-Tue Sep 6 14:51:11 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- Add new style linker support to COFF backend. a29k only for now.
- * cofflink.c: New file.
- * libcoff-in.h: Include bfdlink.h.
- (obj_coff_external_syms, obj_coff_strings): Define accessor macro.
- (obj_coff_sym_hashes): Define accessor macro.
- (struct coff_tdata): Add fields external_syms, strings, and
- sym_hashes.
- (struct coff_link_hash_entry): Define.
- (struct coff_link_hash_table): Define.
- (coff_link_hash_lookup, coff_link_hash_traverse): Define.
- (coff_hash_table): Define.
- (_bfd_coff_link_hash_table_create): Declare.
- (_bfd_coff_link_add_symbols, _bfd_coff_final_link): Declare.
- * coffcode.h (bfd_coff_backend_data): Add fields _bfd_relsz,
- _bfd_coff_swap_reloc_in, _bfd_coff_sym_is_global,
- _bfd_coff_compute_section_file_positions,
- _bfd_coff_relocate_section.
- (bfd_coff_relsz, bfd_coff_swap_reloc_in): Define.
- (bfd_coff_sym_is_global): Define.
- (bfd_coff_compute_section_file_positions): Define.
- (bfd_coff_relocate_section): Define.
- (coff_mkobject_hook): Initialize obj_raw_syment_count and
- obj_conv_table_size.
- (coff_compute_section_file_positions): Set target_index of all
- sections. Set output_has_begun field.
- (coff_write_object_contents): Don't set target_index; now done by
- coff_compute_section_file_positions. Remove obsolete handling of
- scn_base and data_base. Don't bother to check that target_index
- is positive, since it always is. Remove use of pad, which is
- always zero. Check obj_raw_syment_count, not bfd_get_symcount,
- for the number of symbols, but only write them out if
- bfd_get_symcount is non-zero. Don't check obj_raw_syment_count
- until after coff_write_symbols is called.
- (coff_slurp_symbol_table): Use obj_raw_syment_count, not
- bfd_get_symcount for the number of symbols. Don't set
- obj_conv_table_size.
- (coff_sym_is_global): New static function or macro.
- (coff_slurp_reloc_table): Call coff_swap_reloc_in, not
- bfd_swap_reloc_in.
- (coff_bfd_link_hash_table_create): If coff_relocate_section is
- defined, define as _bfd_coff_link_hash_table_create.
- (coff_bfd_link_add_symbols): Similar change.
- (coff_bfd_final_link): Similar change.
- (coff_relocate_section): Define as NULL if not defined.
- (bfd_coff_std_swap_table): Initialize new fields.
- * coffgen.c (coff_real_object_p): Don't set obj_raw_syment_count
- and obj_conv_table_size here.
- (coff_count_linenumbers): Reindent. If bfd_get_symcount is zero,
- add up the line numbers from the sections.
- (coff_write_symbols): Set obj_raw_syment_count, not
- bfd_get_symcount.
- (coff_pointerize_aux): Don't pointerize a nonpositive x_endndx
- field.
- (coff_get_normalized_symtab): Use obj_raw_syment_count, not
- bfd_get_symcount.
- (coff_print_symbol): If auxp->fix_end, print x_endndx value.
- * coffswap.h (coff_swap_reloc_in): Rename from bfd_swap_reloc_in.
- Reindent. Change argument type to PTR.
- * coff-a29k.c (coff_a29k_relocate_section): New static function.
- (coff_relocate_section): Define.
- * configure.in (a29kcoff_big_vec): Compile cofflink.o.
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize new fields.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
- * libcoff.h: Rebuilt.
- * Makefile.in: Rebuilt dependencies.
- (BFD32_BACKENDS): Add cofflink.o.
- (CFILES): Add cofflink.c.
-
-Tue Sep 6 14:00:45 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * coffgen.c (coff_print_symbol, case bfd_symbol_print_all): Check
- for section symbol, and print its aux fields with appropriate
- labels.
-
- * Makefile.in (ALL_MACHINES): Added cpu-arm.o.
-
-Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-
- * aoutx.h (NAME(aout,machine_type)): Recognize the ARM processor.
- * archures.c, config.bfd, configure.host, libaout.h, reloc.c,
- targets.c: Add support for the ARM.
- * cpu-arm.c, riscix.c, config/riscix.mh, config/riscix.mt: New files.
-
- * aoutx.h (add_to_stringtable): Check that str isn't a NULL pointer.
-
-Fri Sep 2 14:10:30 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * reloc.c (enum bfd_reloc_code_real): Rewrote definition to use
- new "chew" commands for simultaneous definition of enumerator and
- enumerator name table.
- (bfd_get_reloc_code_name): New function, for retrieving a symbolic
- name associated with an enumerator.
- * libbfd.h, bfd-in2.h: Regenerated.
-
-Tue Aug 30 21:24:54 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_write_fixups, case R_ENTRY): Handle case where no
- unwind descriptor information is available.
-
-Tue Aug 30 11:43:30 1994 Eric Youngdale (ericy@cais.cais.com)
-
- * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add soname
- argument, and use it to set DT_SONAME dynamic entry.
- * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
- (bfd_elf64_size_dynamic_sections): Update prototype.
- * bfd-in2.h: Rebuilt.
-
-Fri Aug 26 15:47:57 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coffgen.c (coff_real_object_p): Set obj_raw_syment_count.
- (coff_get_normalized_symtab): Verify obj_raw_syment_count, rather
- than setting it.
-
-Thu Aug 25 10:44:53 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * archive.c (bsd_write_armap): Remove host dependencies.
-
- * aoutx.h (add_to_stringtab): Check for _bfd_stringtab_add error
- before adding BYTES_IN_WORD.
-
- * coffgen.c (coff_find_nearest_line): Look for the best C_FILE,
- not merely the first.
-
- * coffgen.c (coff_write_alien_symbol): If we are not using the
- symbol, clear the name so that it is not put in the string table.
- From Antti.Miettinen@ntc.nokia.com.
-
-Wed Aug 24 11:49:19 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coffgen.c (coff_print_symbol): Cast pointer different to long
- and use %ld to print it.
- * osf-core.c (osf_core_core_file_p): Remove unused variable
- dseccnt.
- * ecoffswap.h (ecoff_swap_ext_out): If ECOFF_64, clear remaining
- bytes in bits2.
-
- * configure.host, config.bfd: Change i[34]86 to i[345]86.
- * coffgen.c (coff_real_object_p): Set obj_conv_table_size here,
- rather than waiting until coff_slurp_symbol_table.
- (coff_write_alien_symbol): Just ignore BSF_DEBUGGING symbols.
- From Antti.Miettinen@ntc.nokia.com.
-
- * section.c (bfd_make_section_anyway): Fix failure check of
- bfd_make_empty_symbol. From Antti.Miettinen@ntc.nokia.com.
-
- * aoutx.h (translate_to_native_sym_flags): Use the output_section
- (and output_offset) if there is one.
-
- * aoutx.h (aout_link_check_archive_element): Discard the symbols
- if the archive element was not needed.
-
- * aoutx.h (aout_get_external_symbols): Ensure that a zero string
- index yields an empty string.
- (aout_link_write_symbols): If info->keep_memory is false, use name
- from original hash table entry, not from entry in *sym_hash.
-
- * aoutx.h (struct aout_final_link_info): Add fields contents,
- relocs, symbol_map and output_syms.
- (NAME(aout,final_link)): Work out the largest section size, reloc
- size, and number of symbols. Use them to preallocate buffers that
- are large enough for all cases.
- (aout_link_input_bfd): Use preallocated symbol_map.
- (aout_link_write_symbols): Remove symbol_map argument; use
- preallocated symbol_map instead. Change all callers. Use
- preallocated output_syms.
- (aout_link_input_section): Remove symbol_map argument. Change all
- callers. Use preallocated contents and relocs.
- (aout_link_input_section_std): Remove symbol_map argument; use
- preallocated symbol_map instead. Change all callers.
- (aout_link_input_section_ext): Likewise.
-
-Tue Aug 23 10:51:09 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * archive.c (_bfd_write_archive_contents): Don't update the
- symbol map timestamp if there is no symbol map. From
- schwab@issan.informatik.uni-dortmund.de (Andreas Schwab).
-
-Mon Aug 22 12:26:42 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add _update_armap_timestamp.
- (bfd_target): Add field _bfd_update_armap_timestamp.
- * bfd.c (bfd_update_armap_timestamp): Define.
- * bfd-in2.h: Rebuilt.
- * libbfd-in.h (_bfd_noarchive_update_armap_timestamp): Define.
- (_bfd_archive_bsd_update_armap_timestamp): Declare.
- (_bfd_archive_coff_update_armap_timestamp): Define.
- * libbfd.h: Rebuilt.
- * archive.c (_bfd_write_archive_contents): Call
- bfd_update_armap_timestamp instead of checking for a BSD archive
- and calling bsd_update_armap_timestamp.
- (_bfd_archive_bsd_update_armap_timestamp): Rename from
- _bsd_update_armap_timestamp. Don't assume that armap_datepos is
- already set.
- * aout-target.h (MY_update_armap_timestamp): Define if not already
- defined.
- * coff-rs6000.c (rs6000coff_update_armap_timestamp): Define.
- * ieee.c (ieee_update_armap_timestamp): Define.
- * libecoff.h (_bfd_ecoff_update_armap_timestamp): Define.
- * oasys.c (oasys_update_armap_timestamp): Define.
- * som.c (som_update_armap_timestamp): Define.
-
- * hash.c: Copy string hash functions from aoutx.h.
- * aoutx.h: String hash functions moved to hash.c. Retain
- simplified versions of add_to_stringtab and emit_stringtab.
- Change all callers to use new function and structure names.
- * libbfd-in.h (_bfd_stringtab_init, _bfd_stringtab_free): Declare.
- (_bfd_stringtab_size, _bfd_stringtab_add): Declare.
- (_bfd_stringtab_emit): Declare.
- * libbfd.h: Rebuilt.
-
-Mon Aug 22 10:49:37 1994 Eric Youngdale (ericy@cais.cais.com)
-
- * i386linux.c (linux_add_one_symbol): Create a fixup for any
- defined absolute symbol, not just GOT or PLT symbols.
- (linux_tally_symbols): Correct handling of references to defined
- symbols.
-
-Thu Aug 18 16:29:57 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- Get ld -x -r to handle a.out set symbols correctly.
- * aoutx.h (adjust_o_magic): If the .bss VMA was set outside of
- BFD, pad the .data section up to the VMA of the .bss section.
- (aout_link_add_symbols): If a set symbol does not get modified,
- treat it as a local symbol.
- (aout_link_write_symbols): Set the value of set symbols
- correctly. Don't discard set symbols even if discarding local
- symbols.
- (aout_link_write_other_symbol): Don't abort on bfd_link_hash_new,
- since it can now happen for set symbols.
-
- * elfcode.h (elf_fake_sections): Just check for ".rela" and
- ".rel", not ".rela." and ".rel."; make this work by checking
- use_rela_p.
- * elf32-i386.c (elf_i386_check_relocs): Just check for ".rel", not
- ".rel."
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_check_relocs): Just check for
- ".rela", not ".rela."
- (elf32_sparc_size_dynamic_sections): Likewise.
- (elf32_sparc_relocate_section): Likewise.
-
-Wed Aug 17 16:54:18 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * linker.c (_bfd_generic_link_add_archive_symbols): Initialize
- PASS to the old value + 1.
-
- * coffgen.c (coff_get_normalized_symtab): If a C_FILE symbol has
- no aux entries, use the symbol name as the file name.
- (coff_find_nearest_line): Look for the right C_FILE symbol, rather
- than always using the first one. If there is a debugging symbol
- after a function symbol, skip it. Add the section VMA to the line
- offset, since it was subtracted out in coff_slurp_line_table.
-
-Tue Aug 16 16:53:00 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_prep_headers): If writing some form of an executable,
- allocate and attach an exec header to the BFD private data.
- (som_begin_writing): Don't fill fields of the exec header based
- on BFD private data here (like the exec flags). Do not write
- the exec header here.
- (som_write_headers): Instead do it here.
- * som.h (struct somdata): New field "exec_hdr" for the executable
- file header.
- (obj_som_exec_hdr): New accessor macro.
-
-Tue Aug 16 00:12:31 1994 Eric Youngdale (ericy@cais.cais.com)
-
- * i386linux.c (linux_link_create_dynamic_sections): Create section
- named .linux-dynamic, not .dynamic.
- (linux_add_one_symbol): Use .linux-dynamic, not .dynamic.
- (bfd_linux_size_dynamic_sections): Likewise.
- (linux_finish_dynamic_link): Likewise.
-
-Mon Aug 15 12:16:56 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coffgen.c (STRING_SIZE_SIZE): Define.
- (coff_fix_symbol_name): Use STRING_SIZE_SIZE, not 4.
- (coff_write_symbols, build_string_table): Likewise.
- (coff_get_normalized_symtab): Likewise.
-
- * libcoff-in.h (obj_symbol_slew): Don't define.
- (struct coff_tdata): Remove unused fields index_slew, raw_linenos,
- and flags.
- * libcoff.h: Rebuilt.
- * coffcode.h (coff_mkobject): Don't initialize raw_linenos.
- (coff_mkobject_hook): Don't initialize flags.
-
- * aout-target.h (MY_zmagic_contiguous): Define as 0 if not already
- defined.
- (MY(backend_data)): Use MY_zmagic_contiguous, not hardcoded 0.
- * i386linux.c (MY_zmagic_contiguous): Define.
-
- * elfcode.h (bfd_section_from_shdr): If a SHT_SYMTAB section in a
- shared object has SHF_ALLOC set, create a BFD section for it.
- (elf_section_from_bfd_section): There may be a BFD section for a
- SHT_SYMTAB section.
-
- * coffcode.h (styp_to_sec_flags): Add name argument. If no flags
- are recognized, chose section flags based on the name.
- (bfd_coff_backend_data): _bfd_styp_to_sec_flags_hook field: Add
- name argument.
- (bfd_coff_styp_to_sec_flags_hook): Add name argument.
- (coff_compute_section_file_positions): Don't adjust the section
- position by COFF_PAGE_SIZE unless SEC_ALLOC is set.
- * libcoff.h: Rebuilt.
- * coffgen.c (make_a_section_from_file): Pass section name to
- bfd_coff_styp_to_sec_flags_hook.
- * ecoff.c (_bfd_ecoff_styp_to_sec_flags): Add unused name
- argument.
- * libecoff.h (_bfd_ecoff_styp_to_sec_flags): Add name argument to
- prototype.
-
-Fri Aug 12 11:22:40 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elfcode.h (section_from_elf_index): Correct check for invalid
- section index.
-
- * elfcode.h (elf_link_add_object_symbols): If there is no symbol
- table, try using the dynamic symbol table. From Eric Youngdale
- <ericy@cais.cais.com>.
-
- * configure.host (sparc-*-solaris2*): Use solaris2, not sysv4.
- The linker depends upon configuring for solaris2.
- * hosts/solaris2.h: New file; include hosts/sysv4.h.
- * config/solaris2.mh: New file; copy of config/sysv4.mh.
-
-Wed Aug 10 13:09:38 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * aoutx.h (adjust_z_magic): Make sure data section is padded to
- page boundary when the VMA is set by the calling program. From
- Eric Youngdale <ericy@cais.cais.com>.
-
-Mon Aug 8 17:18:49 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- Update to ns32k support, from Ian Dall (dall@hfrd.dsto.gov.au).
- * aout-ns32k.c: Add declarations that were in aout-ns32k.h, change
- declarations to traditional form.
- (MY_reloc_howto, MY_put_reloc): Change from macro to function.
- (ns32k_relocate_contents): New function.
- * aout-ns32k.h: Remove.
- * cpu-ns32k.c: Add declarations that were in aout-ns32k.h, change
- declarations to traditional form.
- (ns32k_final_link_relocate): Call ns32k_relocate_contents.
- * netbsd532.c: Reformat to standards, add copyright notice.
- (ARCH): Don't define.
- (aout-ns32k.h): Don't include.
- * pc532-mach.c: Ditto.
-
-Mon Aug 8 17:55:52 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coff-i960.c (coff_i960_relocate): Don't try to convert relocs
- against common symbols.
-
-Sat Aug 6 22:27:30 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * irix-core.c (irix_core_core_file_p): Ignore sections that
- are not contained in the core file.
-
-Thu Aug 4 11:32:23 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coff-m68k.c (m68k_reloc_type_lookup): New function.
- (coff_bfd_reloc_type_lookup): Define.
- * cf-m68klynx.c (_bfd_m68kcoff_reloc_type_lookup): Define.
-
- * elfcode.h (elf_bfd_final_link): Force the vma of sections which
- do not have SEC_ALLOC set to be 0. This is needed to handle
- relocs against debugging sections.
-
-Wed Aug 3 16:45:41 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coff-i960.c (coff_i960_relocate): Rewrote to change relocs
- against locally defined symbols into relocs against section
- symbols, for VxWorks 5.1.
-
-Wed Aug 3 10:34:37 1994 Eric Youngdale (ericy@cais.cais.com)
-
- * i386linux.c (linux_add_one_symbol): Only handle
- SHARABLE_CONFLICTS specially if BSF_CONSTRUCTOR is set. Set hashp
- for a GOT or PLT symbol. Set jump field of fixup for a PLT symbol.
- (linux_tally_symbols): Check section of real symbol. When looking
- for a builtin fixup, check builtin and jump flags. Create no more
- than one fixup, and always create one if the real symbol is in the
- absolute section. Only strip absolute symbols.
-
-Wed Aug 3 05:08:24 1994 D. V. Henkel-Wallace (gumby@cygnus.com)
-
- * coffcode.h (coff_write_object_contents): set internal_a.magic to
- LYNXCOFFMAGIC whenever 68k, SPARC or i386 LynxOS
- (yes, they have the same magic number!)
-
-Tue Aug 2 10:43:21 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * hp300hpux.c (BMAGIC): Define as HPUX_DOT_O_MAGIC, to make test
- in aoutx.h work correctly.
-
- * coff-i960.c (coff_i960_relocate): New function.
- (howto_rellong, howto_iprmed): Use it as special_function.
-
- * libbfd-in.h: Move declarations of bfd_read, bfd_write, bfd_seek,
- bfd_tell, bfd_flush, and bfd_stat from here...
- * bfd-in.h: ...to here, to make them visible to programs which
- know more about the object file format than BFD does.
- * libbfd.h, bfd-in2.h: Rebuilt.
-
-Mon Aug 1 17:55:53 1994 Fred Fish (fnf@cygnus.com)
-
- * ptrace-core.c (ptrace_unix_core_file_p): Convert zalloc usage
- to bfd_zalloc.
-
-Mon Aug 1 12:04:40 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elf64-sparc.c (ELF_MAXPAGESIZE): Define.
-
- ELF linker patches from Eric Youngdale <ericy@cais.cais.com>.
- * elfcode.h (elf_link_create_dynamic_sections): Set type of
- _DYNAMIC to STT_OBJECT.
- (NAME(bfd_elf,record_link_assignment)): Always create hash table
- entry. Set type to STT_OBJECT.
- (elf_link_output_extsym): Don't set type of weak defined symbol to
- STB_WEAK if symbol was referenced.
- (map_program_segments): Check DYNAMIC as well as EXEC_P.
- (assign_file_positions_except_relocs): Likewise.
- * elf32-i386.c (elf_i386_create_dynamic_sections): Set type of
- _GLOBAL_OFFSET_TABLE to STT_OBJECT.
- (elf_i386_check_relocs): Ignore local PLT32 relocs.
- (elf_i386_relocate_section): Treat local PLT32 relocs as PC32.
-
- * elfcode.h (elf_adjust_dynamic_symbol): Correct weak symbol
- handling again.
-
- * elfcode.h (elf_slurp_reloc_table): Don't try to read the relocs
- if there aren't any.
-
- * configure.host (sparc-*-solaris2*): Use sysv4, not solaris2.
- * hosts/solaris2.h: Remove.
- * config/solaris2.mh: Remove.
-
-Sun Jul 31 14:27:04 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c, elf32-hppa.h: Update comment reflecting which
- HPPA ELF spec the code implements.
-
-Tue Jul 26 17:38:01 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * cpu-i960.c (MAX_ARCH): New macro.
- (compatible): Use it in computing array bounds. Put comma after
- last entry in array, for regularity.
- (arch_info_struct): Adjust spacing for easier reading.
-
- * coff-i960.c (howto_rellong, howto_iprmed, howto_optcall): Use
- HOWTO macro.
-
- * cpu-i960.c (JX): Define as bfd_mach_i960_jx.
- (scan_960_mach): Recognize jx machine.
- (MAX_ARCH): Define to be JX.
- (compatible): Add JX row to array.
- (arch_info_struct): Add JX entry.
-
- * archures.c (bfd_mach_i960_jx): New macro.
- * bfd-in2.h: Regenerated.
-
- * coffcode.h (coff_set_arch_mach_hook): For F_I960JX, set machine
- to bfd_mach_i960_jx.
- (coff_set_flags): For bfd_mach_i960_jx, set F_I960JX.
-
-Tue Jul 26 11:04:00 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elfcode.h (elf_adjust_dynamic_symbol): When handling a weak
- symbol, correct check to see whether the equivalent normal symbol
- was referenced.
-
- Add support for creating shared libraries under i386 ELF and SPARC
- ELF. Based on patches by Eric Youngdale <ericy@cais.cais.com>.
- * libelf.h (struct elf_link_hash_entry): Remove copy_offset field.
- Add got_offset and plt_offset fields.
- (ELF_LINK_HASH_REF_DYNAMIC_MULTIPLE): Don't define.
- (ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE): Don't define.
- (ELF_LINK_HASH_NEEDS_COPY): Define.
- (struct elf_backend_data): Add check_relocs field.
- (struct bfd_elf_section_data): Change relocs from PTR to
- Elf_Internal_Rela *.
- (struct elf_obj_tdata): Add local_got_offsets field.
- (elf_local_got_offsets): Define accessor macro.
- (bfd_elf32_link_create_dynamic_sections): Declare.
- (bfd_elf32_link_record_dynamic_symbol): Declare.
- (bfd_elf64_link_create_dynamic_sections): Declare.
- (bfd_elf64_link_record_dynamic_symbol): Declare.
- * elfcode.h (elf_slurp_reloc_table): Don't use the section data
- relocs field.
- (elf_link_record_dynamic_symbol): Make globally visible. Use
- macro to rename to NAME(bfd_elf,link_record_dynamic_symbol).
- (elf_link_add_object_symbols): If creating a shared library, put
- make all local symbols dynamic. Don't bother with the
- DYNAMIC_MULTIPLE flags. Call the check_relocs backend function if
- it is defined.
- (elf_link_create_dynamic_sections): Make globally visible. Use
- macro to rename to NAME(bfd_elf,link_create_dynamic_sections). If
- creating a shared library, make sure that _DYNAMIC is added as a
- dynamic symbol.
- (elf_link_read_relocs): New function.
- (NAME(bfd_elf,record_link_assignment)): If creating a shared
- library, always create symbols, and always make them dynamic.
- (elf_bfd_final_link): Permit creation of shared libraries.
- (elf_link_input_bfd): Use elf_link_read_relocs to get the relocs.
- * elf.c (_bfd_elf_link_hash_newfunc): Don't initialize
- copy_offset. Initialize got_offset and plt_offset.
- * elf32-target.h (elf_backend_check_relocs): Define as 0 if not
- defined.
- (elf32_bed): Initialize check_relocs field.
- * elf64-target.h (elf_backend_check_relocs): Define as 0 if not
- defined.
- (elf64_bed): Initialize check_relocs field.
- * elf32-i386.c (elf_howto_table): Change R_386_PLT32 and
- R_386_GOTPC to be pc_relative and pcrel_offset.
- (elf_i386_pic_plt0_entry): Define.
- (elf_i386_pic_plt_entry): Define.
- (elf_i386_create_dynamic_sections): Create a .got.plt section, and
- define _GLOBAL_OFFSET_TABLE_ at the start of it. If creating a
- shared library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
- dynamic symbol. Don't create .rel.bss if creating a shared
- library.
- (elf_i386_check_relocs): New function.
- (elf_i386_adjust_dynamic_symbol): Don't make a PLT entry if the
- symbol already has one. When making a PLT entry, set plt_offset.
- Don't create a copy reloc when creating a shared library. Don't
- set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
- (elf_i386_allocate_dynamic_section): Remove.
- (elf_i386_size_dynamic_sections): Look through all the sections
- rather than assuming we know their names. Remove any empty reloc
- or plt sections. Only add a DT_DEBUG entry if not creating a
- shared library. Only add a DT_PLTGOT entry if there is a PLT.
- Add a DT_TEXTREL entry if required.
- (elf_i386_relocate_section): Permit undefined symbols when
- creating a shared library. Handle the special relocation types
- specially.
- (elf_i386_finish_dynamic_symbol): Create a PLT entry if plt_offset
- is set. If creating a shared library, produce a PIC PLT entry.
- Only mark a PLT symbol as undefined if it was not defined by a
- regular object file. Create a GOT entry if got_offset is set.
- Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
- (elf_i386_finish_dynamic_sections): Change the handling of
- DT_RELSZ to simply subtract out the size of .rel.plt. If creating
- a shared library, produce PIC PLT code.
- (elf_backend_check_relocs): Define.
- * elf32-sparc.c (elf_sparc_howto_table): Change R_SPARC_GOT10,
- R_SPARC_GOT22, and R_SPARC_PC10 to not warn about reloc overflow.
- (elf32_sparc_create_dynamic_sections): If creating a shared
- library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
- dynamic symbol, and set the type to STT_OBJECT. Likewise for
- _PROCEDURE_LINKAGE_TABLE_. Don't create .rel.bss if creating a
- shared library.
- (elf32_sparc_check_relocs): New function.
- (elf32_sparc_adjust_dynamic_symbol): Don't make a PLT entry if the
- symbol already has one. When making a PLT entry, set plt_offset.
- Don't create a copy reloc when creating a shared library. Don't
- set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
- (elf32_sparc_allocate_dynamic_section): Remove.
- (elf32_sparc_size_dynamic_sections): Look through all the sections
- rather than assuming we know their names. Only add a DT_DEBUG
- entry if not creating a shared library. Add a DT_TEXTREL entry if
- required.
- (elf32_sparc_relocate_section): Permit undefined symbols when
- creating a shared library. Handle the special relocation types
- specially.
- (elf32_sparc_finish_dynamic_symbol): Create a PLT entry if plt_offset
- is set. Only mark a PLT symbol as undefined if it was not defined
- by a regular object file. Create a GOT entry if got_offset is
- set. Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
- (elf32_sparc_finish_dynamic_sections): Store dynobj in a local
- variable.
- (elf_backend_check_relocs): Define.
-
-Mon Jul 25 12:21:07 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * configure.in (pc532mach_vec): Change to pc532machaout_vec.
- * config.bfd (ns32k-*-netbsd*): Use ns32k-nbsd as bfd_name.
- * Makefile.in (ALL_MACHINES): Add cpu-ns32k.o.
- (BFD32_BACKENDS): Add aout-ns32k.o, netbsd532.o, m88kmach3.o,
- pc532-mach.o.
- * targets.c (pc532machaout_vec): Use instead of pc532mach_vec.
- * config/pc532-mach.mt (DEFAULT_VECTOR): Ditto.
- (SELECT_VECS): Remove.
- * config/ns32k-nbsd.mt: New file, was ns32k-netbsd.mt.
- * config/ns32k-netbsd.mt: Remove, name too long.
-
-Fri Jul 22 11:07:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * linker.c (generic_link_check_archive_element): When changing a
- symbol to common, set the alignment.
- (_bfd_generic_link_add_one_symbol): When creating a common symbol,
- set the alignment.
- * aoutx.h (aout_link_check_ar_symbols): When changing a symbol to
- common, set the alignment.
- (aout_link_add_symbols): Restrict the alignment of a common symbol
- to the alignment power given by the architecture.
- * libelf.h (struct elf_link_hash_entry): Remove align field. Add
- copy_offset field.
- * elfcode.h (elf_link_add_object_symbols): Store alignment in
- new bfd_link_hash_entry field, not in elf_link_hash_entry field.
- (elf_link_output_extsym): Similar change when getting alignment.
- * elf.c (_bfd_elf_link_hash_newfunc): Don't initialize align. Do
- initialize copy_offset.
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use copy_offset
- field rather than align field. Get alignment using bfd_log2
- rather than switch.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
- * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use copy_offset,
- not align.
- * elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Likewise.
-
- * aoutx.h (NAME(aout,some_aout_object_p)): Just check
- STAT_FOR_EXEC, don't check MACH.
- * m88kmach3.c (MACH): Don't define.
- * config/i386-mach3.mt (TDEFINES): Define STAT_FOR_EXEC.
- * config/m88k-mach3.mt (TDEFINES): Likewise.
- * config/mips-mach3.mt (TDEFINES): Likewise.
-
-Thu Jul 21 17:24:31 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * i386mach3.c: Reverted to version from before Jul 5 1994 changes.
-
-Thu Jul 21 12:26:01 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * reloc.c (struct reloc_howto_struct): Remove special_function1.
- It's the wrong way to do things.
- (HOWTO): Change accordingly.
- (HOWTO2): Remove.
- (_bfd_final_link_relocate): Remove references to
- special_function1.
- * bfd-in2.h: Rebuilt.
- * aoutx.h (aout_link_input_section_std): Remove references to
- special_function1.
- (aout_link_reloc_link_order): Likewise.
-
-Wed Jul 20 15:46:44 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add rpath
- argument. If it is not NULL, use it to set DT_RPATH.
- * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
- (bfd_elf64_size_dynamic_sections): Likewise.
- * bfd-in2.h: Rebuilt.
-
-Sat Jul 16 21:10:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elfcode.h (elf_get_dynamic_symtab_upper_bound): If there is no
- dynamic symtab, return error.
-
- * libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Define.
- * elfcode.h (elf_link_add_object_symbols): If symbol is defined as
- weak, set ELF_LINK_HASH_DEFINED_WEAK.
- (elf_link_output_extsym): If symbol is defined as weak, mark it
- STB_WEAK.
-
- * libelf.h (struct bfd_elf_section_data): Add relocs field.
- (shdr_name): Remove; unused.
- * elfcode.h (elf_slurp_reloc_table): Rewrote to handle both REL
- and RELA relocs. Free up the unswapped relocs. Permit the relocs
- to be cached in the section_data. Correct the reloc address.
- (elf_slurp_reloca_table): Remove.
- (elf_canonicalize_reloc): Rewrote.
- (elf_link_input_bfd): Permit the relocs to be cached in the
- section data.
-
-Sat Jul 16 13:55:38 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * config.bfd (m88*-harris-cxux*): Recognize.
- * hosts/harris.h (POSIX_UTIME, HAVE_PROCFS): Define.
-
- * configure.host (m68*-atari-sysv4*): New host.
- (m68*-cbm-sysv4*): Use m68kv4 instead of amix.
- * hosts/amix.h: Remove.
- * hosts/m68kv4.h: New file, was amix.h.
-
-Thu Jul 14 15:12:24 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * reloc.c (enum bfd_reloc_code_real, bfd_type, struct
- reloc_howto_struct, reloc_howto_type, HOWTO, HOWTO2): Copied
- changes over from bfd-in2.h so they get generated properly next
- time someone runs "make headers".
- * bfd-in2.h: Rebuilt.
-
- * targets.c (netbsd532_vec, pc532mach_vec): Declare const.
- (m88kmach3_vec): Restore deleted declaration.
-
- * configure.in: Alphabetize target vector names.
-
- * config/pc532mach.mh: New file.
- (HDEPFILES, HDEFINES): Define here.
- * config/pc532-mach.mt (HDEPFILES, HDEFINES): Deleted.
- * config/ns32k-netbsd.mt (HDEPFILES, HDEFINES): Deleted.
-
- Sun Jul 10 00:04:20 1994 Ian Dall (dall@hfrd.dsto.gov.au)
-
- * pc532-mach.c: New File. pc532-mach a.out format.
-
- * netbsd532.c: New file. pc532-netbsd532 a.out format.
-
- * hosts/pc532mach.h: New file. pc532-mach host support.
-
- * cpu-ns32k.c: New file. ns32k support cpu specific code rather
- than format specific code.
-
- * config/pc532-mach.mt: New file. Support for pc532-mach target.
-
- * config/ns32k-netbsd.mt: New file. Support for netbsd532 target.
-
- * aout-ns32k.c, aout-ns32k.h: New files supporting aout format for
- ns32k series.
-
- * targets.c: Add netbsd532_vec and pc532machaout_vec into
- bfd_target_vector array. Move netbsd386_vec to alphabetic order
- location.
-
- * reloc.c (_bfd_final_link_relocate) Add support for
- special_function1 in howto.
-
- * libaout.h: add M_NS32032, M_NS32532, M_532_NETBSD entries in
- machine_type enum.
-
- * configure.in: add pc532mach_vec and netbsd532_vec entries.
-
- * config.bfd: add pc532mach host entries. Use for both
- ns32k-pc532-mach and ns32k-pc532-netbsd.
-
- * config.bfd: it doesn't work to use i386-mach3 for ns32k*-*-mach.
- add ns32k-pc532-mach* and ns32k-*-netbsd* entries.
-
- * bfd-in2.h: Add ns32k specific relocations to bfd_reloc_code_real
- enum.
-
- * bfd-in2.h: Add special_function1 to struct howto. Change HOWTO
- and NEWHOWTO macros to make special_function1 NULL. Neww HOWTO2
- macro.
-
- * bfd-in2.h: Split definition of struct reloc_howto_struct
- and corresponding typedef into two statements.
-
- * bfd-in2.h: Add entry bfd_arch_ns32k to bfd_architecture enum.
-
- * archures.c: Add bfd_ns32k_arch prototype, and entry in
- archures_init_table.
-
- * aoutx.h (aout_link_reloc_link_order): Allow for target dependent
- MY_put_reloc macro. Allow for target dependent special_function1
- to apply the relocation.
-
- * aoutx.h (aout_link_input_section_std): Allow for target
- dependent determination of reloc howto. Allow for target dependent
- special_function1 to apply the relocation.
-
- * aoutx.h (get_reloc_upper_bound): Detect bss and return 0.
-
- * aoutx.h (slurp_reloc_table): Detect bss and succesfully read
- zero reloc entries.
-
- * aoutx.h (machine_type): Add bfd_arch_ns32k case.
-
- * aoutx.h: Stat to determine executable status if STAT_FOR_EXEC
- is defined (not just MACH). Use fstat instead of stat and check
- for fstat error.
-
- * aoutx.h: Allow target dependent swap_std_reloc_{in,out}.
-
- * aoutx.h: Allow CTORS reloc info to be in target dependent reloc
- table.
-
- * aout-target.h: Apply SWAP_MAGIC (if defined) after
- swap_exec_header_in, otherwise we have magic in the wrong order.
-
-Thu Jul 14 11:47:27 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * coff-sparc.c (sparccoff_vec): Have leading underscores.
-
-Tue Jul 12 12:08:10 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * aix386-core.c, aoutf1.h, cisco-core.c, elfcode.h, hppabsd-core.c,
- hpux-core.c, irix-core.c, lynx-core.c, osf-core.c, ptrace-core.c,
- rs6000-core.c, trad-core.c: Remove SEC_ALLOC flag from .reg
- sections, .reg sections are not allocated and contain debug
- information only.
- * osf-core.c (make_bfd_asection, osf_core_core_file_p): Use
- bfd_make_section_anyway instead of building unique section names.
-
-Tue Jul 12 11:41:22 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * libelf.h (bfd_elf32_swap_symbol_in): Declare.
- (bfd_elf32_swap_symbol_out): Declare.
- (bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out): Declare.
- * elf32-hppa.c (elf32_hppa_args_hash_table_init): Correct cast.
-
- * aout-encap.c (ARCH): Don't define. Obsolete.
- * aout0.c, aoutx.h, gen-aout.c, hp300bsd.c, hp300hpux.c: Likewise.
- * i386aout.c, i386bsd.c, i386dynix.c, i386linux.c: Likewise.
- * i386lynx.c, m68klynx.c, mipsbsd.c, netbsd386.c: Likewise.
- * newsos3.c, sparclynx.c, sunos.c: Likewise.
-
-Mon Jul 11 20:08:23 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * section.c (STD_SECTION): Make the sixth argument boolean, not
- the seventh. From gary@tuva.pacsemi.oz.au (gary kopff).
-
-Sun Jul 10 09:12:02 1994 D. V. Henkel-Wallace (gumby@cygnus.com)
-
- * aoutx.h (bfd_free_cached_info): Change name of FREE to BFCI_FREE
- in order not to collide with LynxOS's definition of FREE in
- /usr/include/sys/proc.h
-
-Thu Jul 7 14:18:06 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * reloc.c (bfd_perform_relocation): Don't clobber the relocation
- value for coff-Intel-little or coff-Intel-big. Hack upon hack.
-
-Thu Jul 7 10:10:34 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * aoutx.h (howto_table_std): Add entry for GOT relocations
- which are present in sun3 shared libraries, to avoid assertions
- when reading the dynamic relocations.
-
-Thu Jul 7 10:19:20 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.h (R_HPPA_COMPLEX): Fix dumb typo.
-
-Wed Jul 6 19:21:57 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * hosts/sysv4.h (qsort, strtol): Don't declare.
-
- * elfcode.h (elf_link_output_sym): Don't call output_symbol_hook
- if it is NULL.
-
- * elf32-mips.c (mips_elf_final_write_processing): Add ignored info
- argument to correspond to recent libelf.h change.
-
-Wed Jul 6 00:48:57 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * coff-alpha.c (alpha_ecoff_mkobject_hook): New hook to
- additionally copy object type information from the alpha file
- header to the BFD flags.
- (alpha_ecoff_backend_data): Use it.
- (ecoffalpha_little_vec): Add DYNAMIC to object_flags.
- * aout64.c: Fix typo in conditional QMAGIC definition.
-
-Wed Jul 6 00:13:17 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * hppabsd-core.c (hppabsd_core_core_file_p): Sanity check the
- value of clicksz to help weed out non HPPA BSD core files.
-
-Tue Jul 5 13:26:02 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- Mach 3 support.
- * config.bfd (m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*):
- New targets.
- * configure.host (i[34]86-*-mach3*, ns32k-*-mach3*): Recognize
- "mach3" instead of "mach".
- (m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*): New hosts.
- * targets.c (m88kmach3_vec): New target vector.
- (bfd_target_vector): Add i386mach3_vec and m88kmach3_vec, but
- inside #if 0.
- * aoutx.h (some_aout_object_p) [MACH]: Recognize executables by
- checking for execute permission, instead of looking at entry
- point.
- * i386mach3.c: Update, define MACH, N_TXTOFF, N_TXTADDR,
- N_SHARED_LIB, don't include aout/*.h files, etc.
- * m88kmach3.c: New file, m88k Mach 3 target.
- * config/m88k-mach3.mt, config/mips-mach3.mt: New files, target
- makefile fragments.
- * config/i386mach3.mh, config/m88kmach3.mh, config/mipsmach3.mh:
- New files, host makefile fragments.
- * hosts/m88kmach3.h, hosts/mipsmach3.h: New files, host definitions.
-
-Tue Jul 5 13:56:52 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * elfcode.h (swap_out_syms): Get alignment of common symbol from
- st_value field of saved ELF symbol information, if there is any.
-
-Mon Jul 4 19:13:32 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.h (R_HPPA_COMPLEX): Define.
- * elf32-hppa.h (R_HPPA_COMPLEX): Define.
- (elf32_hppa_reloc_type): Delete R_PARISC_STUB_CALL_17.
-
-Fri Jul 1 12:07:41 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * Support code for enabling the new style linker for PA ELF.
- * elfcode.h (swap_symbol_in, swap_symbol_out): Externalize.
- (elf_compute_section_file_positions): Pass link_info to
- the begin_write_processing hook.
- (bfd_elf_write_object_contents): Pass NULL for new link_info
- argument to final_write_processing hook.
- (elf_link_output_sym): Accept new "input_section" argument for
- the symbols's input section. All callers changed. Call the
- link_output_symbol_hook if it's defined.
- (elf_bfd_final_link): Call the final_write_processing hook if
- it's defined.
- * libelf.h (elf_backend_link_output_symbol_hook): Declare.
- (elf_backend_begin_write_processing): Add new "info" argument.
- (elf_backend_final_write_processing): Likewise.
- * elf32-target.h (elf_backend_link_output_symbol_hook): Provide
- a default definition.
- (elf32_bed): Add elf_backend_link_output_symbol_hook.
- * elf64-target.h: Likewise.
-
- * Major rework of the PA ELF code. Uses the new style BFD
- linker, major cleanups.
- * hppa_stubs.h: Rewrite from scratch. Much smaller and simpler.
- * elf32-hppa.h: Delete all symbol extension related code.
- (hppa_look_for_stubs_in_section): Delete decl.
- (elf32_hppa_size_stubs, elf32_hppa_build_stubs): New decls.
- * elf32-hppa.c: Symbol extension stuff moved form elf32-hppa.h
- into elf32-hppa.c. Do not include aout64.h.
- (typdef hppa_stub_type): Delete.
- (elf32_hppa_stub_name_list_struct): Delete.
- (elf32_hppa_stub_description_struct): Delete.
- (arg_reloc_type): Use simpler enumerations. All references changed.
- (arg_location, arg_reloc_relocation): Likewise.
- (elf32_hppa_symextn_map_struct): Delete.
- (get_symbol_value): Delete.
- (elf32_hppa_get_sym_extn): Delete.
- (find_stubs, new_stubs, type_of_mismatch): Delete.
- (find_stub_by_name, add_stub_by_name): Delete.
- (hppa_elf_stub_finish, hppa_elf_stub_reloc): Delete.
- (hppa_elf_arg_reloc_needed): Renamed. Simplify.
- (hppa_elf_build_linker_stub, hppa_elf_create_stub_sec): Delete.
- (hppa_elf_long_branch_needed_p): Delete.
- (hppa_look_for_stubs_in_section): Delete.
- (hppa_elf_get_section_contents): Delete.
- (elf32_hppa_backend_symbol_processing): Delete.
- (elf32_hppa_backend_section_processing): Delete.
- (elf32_hppa_backend_section_from_shdr): Delete.
- (elf32_hppa_backend_fake_sections): Delete.
- (elf32_hppa_backend_section_from_bfd_section): Delete.
- (NEW_INSTRUCTION): Delete.
- (CURRENT_STUB_OFFSET): Delete.
- (elf32_hppa_relocate_section): New function.
- (elf32_hppa_bfd_final_link_relocate): New function.
- (elf32_hppa_size_symext): New function.
- (elf32_hppa_link_output_symbol_hook): New function.
- (elf32_hppa_read_symext_info): New function.
- (elf32_hppa_add_symbol_hook): New function.
- (elf32_hppa_name_of_stub): New function.
- (elf32_hppa_size_of_stub): New function.
- (elf32_hppa_build_one_sub): New function.
- (elf32_hppa_build_stubs): New function.
- (elf32_hppa_size_stubs): New function.
- (linker, stub and argument hash tables): Add appropriate
- structures, definitions and functions to implement all three
- hash tables.
- (hppa_elf_relocate_insn): Don't need argument location information
- in this function.
- (add_entry_to_symext_chain): Accept a symbol's argument location
- information rather than the symbol itself. All callers changed.
- (hppa_elf_gen_reloc_type): Simplify.
- (hppa_elf_set_section_contents): Stub section is no longer special.
- (hppa_elf_reloc): Greatly simplify.
- (elf32_hppa_begin_write_processing): Accept link_info argument.
- Handle being called from the BFD backend linker.
- (elf32_hppa_final_write_processing): Likewise.
- (elf_hppa_tc_make_sections): No longer call stub_finish.
-
-Mon Jun 27 18:07:06 1994 Steve Chamberlain (sac@cirdan.cygnus.com)
-
- * section.c (bfd_get_section_contents): Put in parens to get
- precedence right.
-
-Sun Jun 26 18:08:29 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * libelf.h (relocate_section): New argument "output_names" added
- to prototype.
- * elfcode.h (elf_link_input_bfd): New argument "output_names"
- added to prototype of relocate_section. Pass the output symbol
- names to relocate_section.
- * elf32-i386.c (elf_i386_relocate_section): Use "output_names" to
- determine the name of a local symbol.
- * elf32-mips.c (mips_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
-Fri Jun 24 08:15:42 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- Add Solaris BCP (the part of Solaris which allows it to run
- SunOS4 a.out files) core file handling.
- * aoutf1.h (external_solaris_bcp_core, swapcore_solaris_bcp):
- New structure and its swap in function.
- (internal_sunos_core): New member c_data_addr, to receive the
- start address of the data section in the core file.
- (swapcore_sun3, swapcore_sparc, sunos4_core_file_p): Use it.
- (sunos4_core_file_p): Recognize Solaris BCP core file.
- (sunos4_core_file_matches_executable_p): Always indicate match
- for Solaris BCP core files.
-
-Thu Jun 23 15:31:28 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- Preliminary support for generating shared libraries, from Eric
- Youngdale <ericy@cais.cais.com>.
- * elfcode.h (prep_headers): If DYNAMIC, set e_type to ET_DYN.
- (elf_link_add_object_symbols): If generating a shared library,
- create dynamic sections for first input BFD with the right format.
- (elf_link_create_dynamic_sections): Don't create .interp section
- if creating a shared library.
- (elf_link_input_bfd): Skip dynamic sections in input file.
- (elf_bfd_final_link): If creating a shared library, it's OK for
- dynobj to have sections which are not SEC_IN_MEMORY.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Only set .interp
- section if not creating a shared library.
- * elf32-sparc.c (elf_sparc_size_dynamic_sections): Likewise.
-
- * elfcode.h (elf_object_p): Don't set DYNAMIC just because there
- is an SHT_DYNAMIC section.
-
- * cf-i386lynx.c (i386coff_vec): Don't include DYNAMIC in
- object_flags.
- * coff-sparc.c (sparccoff_vec): Likewise.
- * hppabsd-core.c (hppabsd_core_vec): Likewise.
-
- * aoutx.h (NAME(aout,some_aout_object_p)): Don't set SEC_RELOC
- just because DYNAMIC is set.
-
-Thu Jun 23 12:53:41 1994 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * configure.in: Change --with-targets to --enable-targets and
- --with-64-bit-bfd to --enable-64-bit-bfd.
- * Makefile.in, mpw-make.in, targets.c: Change comments.
-
-Wed Jun 22 17:59:59 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * config.bfd (powerpc-*-elf*): New target, just like
- powerpc-*-sysv4*.
-
- * linker.c (FAIL): Undefine macro before defining as enum.
-
-Wed Jun 22 10:52:47 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * linker.c (_bfd_generic_link_add_archive_symbols): Initialize
- pass from abfd->archive_pass, and save it there as well.
-
- * hash.c (bfd_hash_allocate): Don't call bfd_set_error if
- obstack_alloc returns NULL unless the size is non-zero.
-
- * linker.c (archive_hash_allocate): Define.
- (_bfd_generic_link_add_archive_symbols): Use archive_hash_allocate
- rather than obstack_alloc, for clarity.
-
- * elfcode.h (elf_get_reloc_upper_bound): Correct.
-
- * aout64.c (BMAGIC, QMAGIC): Define if not already defined. From
- Peter Schauer <pes@regent.e-technik.tu-muenchen.de>.
-
- Linux ZMAGIC support from Eric Youngdale <ericy@cais.cais.com>.
- * libaout.h (struct aoutdata): Add field zmagic_disk_block_size.
- * aout-target.h (MY(callback)): Only set alignment according to
- architecture if the section sizes are aligned to that alignment,
- for backward compatibility.
- (MY(set_sizes)): Initialize zmagic_disk_block_size field.
- * aoutx.h (adjust_z_magic): Set ztih if using q_magic_format. Set
- text section filepos to zmagic_disk_block_size if not ztih. Use a
- different padding algorithm if not ztih.
- * i386linux.c (MY_text_includes_header): Don't define.
-
- * aoutx.h (aout_link_check_ar_symbols): Just skip N_STAB and N_FN
- symbols; don't look them up in the hash table. From
- ralphc@pyramid.com (Ralph Campbell).
-
-Tue Jun 21 11:47:20 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * coff-go32.c (go32coff_archive_p): Remove unused function.
-
- * section.c (bfd_abs_section): Make const.
- (bfd_abs_section_ptr, bfd_is_abs_section): Define.
- (bfd_und_section): Make const.
- (bfd_und_section_ptr, bfd_is_und_section): Define.
- (bfd_com_section): Make const.
- (bfd_com_section_ptr): Define.
- (bfd_ind_section): Make const.
- (bfd_ind_section_ptr, bfd_is_ind_section): Define.
- (bfd_abs_symbol, bfd_com_symbol): Make const.
- (bfd_und_symbol, bfd_ind_symbol): Likewise.
- (global_syms): Cast initialization of section field.
- (STD_SECTION): Define as const, and cast initializations.
- * bfd-in2.h: Rebuilt.
- * Many files: Change uses of bfd_abs_section, etc., to use
- bfd_abs_section_ptr or bfd_is_abs_section, etc.
-
-Mon Jun 20 11:06:27 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * Many files: change all bfd_target vectors to be const. Change
- all uses of bfd_target * to be const bfd_target *. Change
- bfd_target_vector and bfd_default_vector arrays to be const
- bfd_target * const *.
-
- * ecoff.c, libecoff.h, ecoffswap.h, coff-alpha.c, coff-mips.c,
- elf32-mips.c: Renamed all externally visible ECOFF routines which
- are local to BFD to start with _bfd_ecoff instead of just ecoff.
-
- * ecoff.c (ecoff_swap_tir_in): Change input argument to const.
- (ecoff_swap_tir_out): Likewise.
- (ecoff_swap_rndx_in, ecoff_swap_rndx_out): Likewise.
- (ecoff_slurp_symbolic_info): Add new arguments to correspond to
- read_debug_info entry point in ecoff_debug_swap structure.
- Change all calls.
- * libecoff.h (ecoff_slurp_symbolic_info): Change declaration.
- * ecoffswap.h (ecoff_swap_tir_in, ecoff_swap_tir_out): Declare.
- (ecoff_swap_rndx_in, ecoff_swap_rndx_out): Declare.
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize new
- ecoff_debug_swap fields.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
- * elf32-mips.c (mips_elf_read_ecoff_info): Undefine READ.
- (mips_elf_ecoff_debug_swap): Initialize new ecoff_debug_swap
- fields.
- * configure.in (bfd_elf32_bigmips_vec): Use ecoff.o and
- ecofflink.o.
- (bfd_elf32_littlemips_vec): Likewise.
- (ecoff_big_vec, ecoff_little_vec): Likewise.
- (ecoffalpha_little_vec): Likewise.
- * Makefile.in (BFD_LIBS): Remove ecoff.o and ecofflink.o.
- (BFD32_BACKENDS): Add ecoff.o and ecofflink.o.
-
- * aoutx.h (NAME(aout,final_link)): Check flavour of sub, not abfd,
- when computing reloc sizes. From Eric Youngdale
- <ericy@cais.cais.com>.
- * elfcode.h (elf_bfd_final_link): Don't try to compute maximum
- reloc count or size for a non-ELF file.
-
- * mipsbsd.c (MY_final_link_callback): Define to avoid warning.
-
- * hp300hpux.c (MY_final_link_callback): Define to avoid warning.
- (BMAGIC, QMAGIC): Define; used by aoutx.h.
- (MY(slurp_symbol_table)): Change translate_from_native_sym_flags
- calls to use new parameters.
-
-Fri Jun 17 14:45:32 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aout-target.h (MY(callback)): Set the alignments of the text,
- data and bss sections after determining the architecture.
-
- * sunos.c (sunos_add_one_symbol): Treat a common symbol from a
- dynamic object as being in the .bss section of the object, rather
- than as being undefined.
-
-Fri Jun 17 11:16:50 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * libhppa.h (bfd_hppa_insn2fmt, hppa_rebuild_insn): Make INLINE.
-
- * elf32-hppa.h (elf_hppa_final_processing): Delete decl.
-
-Thu Jun 16 23:36:23 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elfcode.h (elf_link_input_bfd): Don't try to read local symbols
- if there aren't any in the input file.
-
-Thu Jun 16 14:25:22 1994 Eric Youngdale (ericy@cais.cais.com)
-
- * i386linux.c: Many new functions and definitions for linker
- support for Linux shared libraries.
- * bfd-in.h (bfd_linux_size_dynamic_sections): Declare.
- * bfd-in2.h: Rebuild.
-
-Thu Jun 16 14:23:46 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * config.bfd: If second argument is ``_'', then, instead of
- echoing config file name, echo whether target uses leading
- underscores on symbol names. Add appropriate settings to
- different cases. Used by binutils/configure.in to set default for
- c++filt.
-
- * elfcode.h (elf_bfd_final_link): If trying to generate a shared
- object, warn and return false.
-
- * aoutx.h (NAME(aout,some_aout_object_p)): Accept BMAGIC objects
- and treat them as OMAGIC.
-
-Wed Jun 15 18:02:21 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- Enable sparc v9 support for release. Note that this is still a
- work in progress, pending release of an ABI specification.
- * config.bfd, configure.in: Include sparc v9 elf config.
- * elfcode.h (prep_headers): Handle sparc v9 (64 bit).
- * reloc.c (bfd_reloc_code_real): New reloc types.
- * elf64-sparc.c: Implement elf64-sparc target.
- * Makefile.in, targets.c: Updated.
-
-Wed Jun 15 01:34:07 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libelf.h (struct elf_obj_tdata): New field dt_needed_name.
- (elf_dt_needed_name): New accessor macro.
- * elfcode.h (elf_link_add_object_symbols): If elf_dt_needed_name
- is set, use that instead of the filename for the DT_NEEDED dynamic
- entry.
- * elf.c (bfd_elf_set_dt_needed_name): New function.
- * bfd-in.h (bfd_elf_set_dt_needed_name): Declare.
- * bfd-in2.h: Rebuilt.
-
- * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add sinterpptr
- argument, and set it to the .interp section.
- * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
- (bfd_elf64_size_dynamic_sections): Likewise.
- * bfd-in2.h: Rebuilt.
-
- * coff-sparc.c (SWAP_OUT_RELOC_EXTRA): Define to clear the r_spare
- field of the reloc rather than letting it be garbage.
-
- * archive.c (bfd_slurp_armap): Recognize __.SYMDEF/ as well as
- __.SYMDEF; the former was used in old Linux archives. From
- jrs@world.std.com (Rick Sladkey).
-
- * i386linux.c (i386linux_write_object_contents): Define; like
- MY(write_object_contents) in aout-target.h, but set MACHTYPE to
- M_386. From jrs@world.std.com (Rick Sladkey).
- (MY_write_object_contents): Define.
-
- * aoutx.h (translate_from_native_sym_flags): Treat N_SETV symbols
- as N_DATA symbols.
- (aout_link_add_symbols): Likewise.
-
- * aoutx.h: Rewrite symbol duplicate elimination to use BFD hash
- tables.
- (struct stringtab_entry, struct stringtab_data): Remove.
- (HASHMAXLEN, HASH_CHAR, hash, compare, log2, emit_strtab): Remove.
- (struct strtab_hash_entry, struct strtab_hash): Define.
- (strtab_hash_newfunc, strtab_hash_lookup): Define.
- (stringtab_free, emit_stringtab): Define.
- (stringtab_init, add_to_stringtab): Rewrite.
- (NAME(aout,write_syms)): Use new stringtab code.
- (struct aout_final_link_info, NAME(aout,final_link)): Likewise.
- (aout_link_write_symbols, aout_link_write_other_symbol): Likewise.
-
- * bfd-in.h (BFD_TRADITIONAL_FORMAT): Define new BFD flag to
- request BFD to write object in the traditional format, whatever
- that means for the particular backend.
- * bfd-in2.h: Rebuilt.
-
- * hash.c (bfd_hash_allocate): If obstack_alloc fails, set
- bfd_error_no_memory.
-
-Tue Jun 14 13:00:04 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libaout.h (struct aoutdata): Add q_magic_format to subformat
- enum.
- * aout-target.h (MY_bfd_copy_private_bfd_data): Define as function
- if not already defined. Copy subformat information.
- (MY_text_includes_header): Define as 0 if not already defined.
- (MY(backend_data)): Use MY_text_includes_header rather than 0.
- (MY_final_link_callback): Rename from final_link_callback, and
- define only if MY_final_link_callback is not already defined.
- (MY_bfd_final_link): Rename use of final_link_callback to
- MY_final_link_callback.
- * aoutx.h (NAME(aout,some_aout_object_p)): Handle QMAGIC like
- ZMAGIC, but set the subformat to q_magic_format. Abort if the
- magic number if not recognized.
- (adjust_z_magic): Use QMAGIC if q_magic_format.
- * i386linux.c (MY_text_includes_header): Define as 1.
- (i386linux_bfd_final_link): New static function.
- (MY_bfd_final_link): Define as i386linux_bfd_final_link.
-
- * aoutx.h (translate_to_native_sym_flags): Check both section and
- output_section against sections of abfd.
-
- * libecoff.h (struct ecoff_link_hash_entry): Change type of
- written from boolean to char. Add new field small.
- * ecoff.c (ecoff_link_hash_newfunc): Initialize written to 0
- rather than false. Initialize small to 0.
- (ecoff_link_add_externals): If ECOFF type is scSUndefined, set
- small. If small is set, and hash table type is common, force the
- symbol into a section named SCOMMON and change the ECOFF type from
- scCommon to scSCommon.
- (ecoff_link_write_external): Set written to 1 rather than true.
- * coff-mips.c (mips_relocate_section): Correct JMPADDR reloc
- overflow check to consider section VMA of input file.
-
-Mon Jun 13 14:20:07 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutf1.h (aout_32_sunos4_write_object_contents): Handle a
- machine type of 68000.
- * aoutx.h (NAME(aout,machine_type)): Add new argument unknown.
- Set *unknown to true if machine type is really unknown, as opposed
- to M_UNKNOWN for the 68000.
- (NAME(aout,set_arch_mach)): Change NAME(aout,machine_type) call
- accordingly.
- * libaout.h (NAME(aout,machine_type)): Add new argument to
- prototype.
-
-Sun Jun 12 20:21:03 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (EXEC_AUX_ID): Define based on availablity of HPUX_AUX_ID
- or HIUX_AUX_ID.
- (som_begin_writing): Use EXEC_AUX_ID instead of HPUX_AUX_ID.
- (som_write_armap): Use CPU_PA_RISC1_0 as the magic number. Note
- som.c is careful to always define CPU_PA_RISC1_0.
-
-Sat Jun 11 16:32:30 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Add weak symbols as an extension to a.out.
- * aoutx.h (sym_in_text_section): Don't define.
- (sym_in_data_section, sym_in_bss_section): Likewise.
- (sym_is_undefined, sym_is_global_defn): Likewise.
- (sym_is_debugger_info, sym_is_fortrancommon): Likewise.
- (sym_is_absolute, sym_is_indirect): Likewise.
- (translate_from_native_sym_flags): Rewrite for clarity. Rearrange
- arguments and change caller. Handle weak symbols.
- (translate_to_native_sym_flags): Likewise.
- (aout_link_check_ar_symbols): Don't ignore weak symbols. Pull
- object in from archive if a weak defintion is found for an
- existing undefined symbol.
- (aout_link_add_symbols): Put all cases in switch. Set flags of an
- undefined symbol to 0. Handle weak symbols.
- (aout_link_write_symbols): Handle weak symbols.
- (aout_link_write_other_symbol): Likewise.
- (aout_link_input_section_std): Likewise.
- (aout_link_input_section_ext): Likewise.
- * sunos.c (sunos_write_dynamic_symbol): Likewise.
-
-Fri Jun 10 13:25:13 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (NAME(aout,canonicalize_reloc)): Handle .bss section.
- (NAME(aout,get_reloc_upper_bound)): Likewise.
-
- * coff-i960.c (coff_i960_reloc_type_lookup): Add BFD_RELOC_CTOR.
- * linker.c (_bfd_generic_link_write_global_symbol): Don't assume
- the section of a common symbol is not NULL.
-
-Wed Jun 8 23:15:53 1994 Stu Grossman (grossman@cygnus.com)
-
- * nlmcode.h (nlm_object_p): Set EXEC_P and start address for GDB.
-
-Wed Jun 8 23:57:34 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (aout_get_external_symbols): Don't try to read the
- strings if there are no symbols.
- (aout_link_write_other_symbol): Use the output section when
- working out the type.
-
-Tue Jun 7 13:25:08 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (assign_section_numbers): Put shstrtab, symtab and
- strtab sections at end of file. Avoids bug in some versions of
- SVR4 strip. From Eric Youngdale <eric@tantalus.nrl.navy.mil>.
-
- * coffcode.h (styp_to_sec_flags): If COFF_PAGE_SIZE is defined,
- set SEC_DEBUGGING for STYP_INFO sections.
- (coff_compute_section_file_positions): If COFF_PAGE_SIZE is
- defined, and D_PAGED is set, set the file position equal to the
- section VMA modulo COFF_PAGE_SIZE.
- * coffgen.c (coff_real_object_p): If F_EXEC is set, set D_PAGED.
- * coff-i386.c: Set D_PAGED in BFD target.
- (COFF_PAGE_SIZE): Define.
- * coff-m68k.c, coff-sparc.c: Likewise.
-
-Mon Jun 6 10:57:28 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (bfd_section_from_shdr): Don't turn a reloc section
- into a BFD section just because SHF_ALLOC is set; require that it
- not use the normal symbol table.
- (elf_section_from_bfd_section): Corresponding change.
-
- Better indirect and warning symbol handling inspired by Stuart
- Quick <stuck@cs.man.ac.uk>.
- * linker.c (enum link_action): Add REF, MIND, CWARN, REFC.
- (link_action): Change UNDEF_ROW/def and UNDEFW_ROW/def from NOACT
- to REF. Change UNDEF_ROW/indr and UNDEFW_ROW/indr from CYCLE to
- REFC. Change DEF_ROW/indr and COMMON_ROW/indr from CYCLE to MDEF.
- Change DEFW_ROW/indr from CYCLE to NOACT. Change INDR_ROW/indr
- from MDEF to MIND. Change INDR_ROW/warn from WARNC to CYCLE.
- Change WARN_ROW/def and WARN_ROW/indr from MWARN to CWARN. Change
- WARN_ROW/com from MWARN to WARN. Change WARN_ROW/warn from NOACT
- to CYCLE. Change SET_ROW/warn from WARNC to CYCLE>
- (_bfd_generic_link_add_one_symbol): Handle REF, MIND, CWARN and
- REFC. If a new indirect symbol has been referenced, push the
- reference down to the symbol it points to. FIx handling of WARN.
- * aoutx.h (translate_from_native_sym_flags): If N_WARNING, don't
- clobber e_type of next symbol.
- (translate_to_native_sym_flags): Likewise.
- (aout_link_write_symbols): Loop on bfd_link_hash_warning as well
- as bfd_link_hash_indirect.
-
- * libaout.h (struct aout_link_hash_entry): New field written.
- * aoutx.h (NAME(aout,link_hash_newfunc)): Initialize written.
- (aout_link_write_symbols): Use written, not root.written.
- (aout_link_write_other_symbol): Likewise.
- * sunos.c (sunos_scan_dynamic_symbol): Likewise.
- * libecoff.h (struct ecoff_link_hash_entry): New field written.
- * ecoff.c (ecoff_link_hash_newfunc): Initialize written.
- (ecoff_link_write_external): use written, not root.written.
- * genlink.h (struct generic_link_hash_entry): New field written.
- * linker.c (_bfd_link_hash_newfunc): Don't initialize written.
- (generic_link_hash_newfunc): Initialize written.
- (_bfd_generic_link_output_symbols): Use written, not root.written.
- (_bfd_generic_link_write_global_symbol): Likewise.
- (_bfd_generic_reloc_link_order): Likewise.
-
- * libecoff.h (ecoff_data_type): Add linker field.
- * ecoff.c (ecoff_write_object_contents): Check new tdata linker
- field, rather than outsymbols being non-NULL, to decide whether to
- output the symbols and relocs.
- (ecoff_bfd_final_link): Set new tdata linker field to true.
-
- * ecoff.c (ecoff_bfd_copy_private_bfd_data): Don't try to copy
- data to a non-ECOFF file.
-
- * libbfd-in.h: Add warning that libbfd.h is a generated file.
- * libbfd.h: Rebuilt.
-
-Sun Jun 5 15:02:30 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Changes to support ELF strip and objcopy on dynamically linked
- files.
- * elfcode.h (elf_fake_sections): Add prototype.
- (bfd_section_from_shdr): Make a BFD section from an SHT_HASH
- section, and from an SHT_DYNSYM section, and from the dynamic
- string table section.
- (elf_object_p): Set D_PAGED if there is a program header.
- (elf_make_sections): Remove.
- (fix_up_strtabs): Remove.
- (elf_fake_sections): Rewrite. Now sets sh_entsize.
- (assign_section_numbers): Rewrite. Now sets sh_link and sh_info
- for all sections.
- (elf_compute_section_file_positions): Don't call obsolete
- functions elf_make_sections or fix_up_strtabs.
- (swap_out_syms): Set sh_addralign to FILE_ALIGN rather than 4.
- (NAME(bfd_elf,write_object_contents)): Permit writing DYNAMIC
- objects.
- (elf_section_from_bfd_section): Treat SHT_DYNSYM like other normal
- sections. If an SHT_REL or SHT_RELA section is allocated or uses
- an unusual symbol table, permit a BFD section to map to it.
- Permit most SHT_STRTAB sections to have a BFD section mapped to
- them.
- (elf_bfd_final_link): Don't set sh_link, sh_info or sh_entsize
- fields of dynamic sections here; do it in assign_section_numbers.
- * elf32-target.h, elf64-target.h: Add D_PAGED to permitted object
- flags.
-
- * elf.c (_bfd_elf_make_section_from_shdr): Only set SEC_DATA if
- SEC_LOAD is set, rather than checking SEC_ALLOC.
-
- * libbfd-in.h (bfd_realloc): Change last arg to "size_t size".
-
-Fri Jun 3 10:58:02 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_write_object_contents): Don't compute the file header's
- checksum here.
- (som_write_headers): Instead do it here.
-
- * libbfd.h (bfd_realloc): Change last arg to "size_t size".
-
-Thu Jun 2 17:39:22 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * hosts/sun3.h: Include <stdlib.h>. Don't declare free, exit or
- getenv.
-
- Add linker support for SunOS shared libraries.
- * sunos.c: Include bfdlink.h. Add many new functions and
- definitions for SunOS shared library support.
- * bfd-in.h (bfd_sunos_record_link_assignment): Declare.
- (bfd_sunos_size_dynamic_sections): Declare.
- * bfd-in2.h: Rebuilt.
- * aoutx.h (struct aout_link_hash_entry): Move to libaout.h.
- (struct aout_link_hash_table): Likewise.
- (aout_link_hash_lookup, aout_link_hash_traverse): Likewise.
- (aout_hash_table): Likewise.
- (NAME(aout,link_hash_newfunc)): Rename from aout_link_hash_newfunc
- and make externally visible.
- (NAME(aout,link_hash_table_init)): New function.
- (NAME(aout,link_hash_table_create)): Call
- NAME(aout,link_hash_table_init), not _bfd_link_hash_table_init.
- (aout_link_add_symbols): Don't fail if no symbols. If it exists,
- call add_dynamic_symbols backend entry point for dynamic objects.
- Use add_one_symbol backend entry point if it exists.
- (NAME(aout,final_link)): Call finish_dynamic_link backend entry
- point, if it exists.
- (aout_link_input_bfd): For a dynamic object, call
- link_dynamic_object backend entry point, if it exists.
- (aout_link_write_other_symbol): Call write_dynamic_symbol backend
- entry point, if it exists.
- (aout_link_input_section): Don't read the relocs if they have
- already been read.
- (aout_link_input_section_std): When doing a final link, for a
- reloc against an external symbol, call check_dynamic_reloc backend
- entry point, if it exists.
- (aout_link_input_section_ext): Likewise.
- * libaout.h: Protect against multiple inclusion. Include
- bfdlink.h.
- (struct aout_link_hash_entry): Move in from aoutx.h.
- (struct aout_link_hash_table): Likewise.
- (aout_link_hash_lookup, aout_link_hash_traverse): Likewise.
- (aout_hash_table): Likewise.
- (struct aout_backend_data): Add fields add_dynamic_symbols,
- add_one_symbol, link_dynamic_object, write_dynamic_symbol,
- check_dynamic_reloc, and finish_dynamic_link.
- (struct aout_section_data_struct): Define new structure.
- (aout_section_data): Define new accessor macro.
- (NAME(aout,link_hash_newfunc)): Declare.
- (NAME(aout,link_hash_table_init)): Declare.
- * aoutf1.h (sunos4_aout_backend): Initialize new aout_backend_data
- fields.
- * aout-target.h (MY(backend_data)): Likewise.
- * i386aout.c (MY(backend_data)): Likewise.
- * i386mach3.c (MY(backend_data)): Likewise.
- * mipsbsd.c (MY(backend_data)): Likewise.
- * sparclynx.c (sparclynx_aout_backend): Likewise.
-
- * aoutx.h (NAME(aout,slurp_symbol_table)): Don't zero out cached
- until we know it is non-NULL.
- (aout_link_write_symbols): Don't skip a warning symbol even if it
- has already been written out. If skipping an indirect symbol,
- skip the next symbol as well.
-
-Wed Jun 1 14:37:50 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * hosts/sun3.h: Don't declare qsort, malloc or realloc.
-
-Thu May 26 13:56:03 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * nlmcode.h (nlm_swap_auxiliary_headers_in): Cast bfd_byte pointer
- to char pointer to avoid compiler warnings.
-
- * dep-in.sed: Remove spaces before colons.
-
- Merged changes back in from FSF gas release 2.3:
-
- * Makefile.in (stmp-bfd.h): Wrap `if' block around grep
- invocation, to avoid a bug in BSD 4.4 make.
-
- From Ralph Campbell:
- * mipsbsd.c (mips_fix_jmp_addr): If symbol is undefined, return an
- error.
- (mips_fix_hi16_s): Ditto.
-
- Fri May 13 21:21:00 1994 DJ Delorie (dj@ctron.com)
-
- * makefile.dos: define a default target, or archives won't work
- due to multiple matches.
-
- Wed May 11 22:32:00 1994 DJ Delorie (dj@ctron.com)
-
- * configure.bat: update for latest files
- * makefile.dos: update for correct targets and sources
- * coff-go32.c: [new] go32's COFF format (i386coff with underscores)
- * targets.c: add go32coff target
- * makefile.in: add coff-go32.c support
-
-Thu May 26 10:10:21 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_prep_headers): Do not set the system_id here, private
- bfd data has not been copied yet.
- (som_write_headers): Instead do it here.
-
-Tue May 24 16:17:18 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Make MIPS ELF use new ELF backend linker. No shared library
- support yet.
- * elf32-mips.c (bfd_mips_elf32_swap_gptab_in): New function.
- (bfd_mips_elf32_swap_gptab_out): New function.
- (mips_elf_object_p): If last symbol is LOCAL, set elf_bad_symtab.
- (mips_elf_final_write_processing): Set sh_info field for .gptab.*
- sections.
- (mips_elf_fake_sections): Set sh_entsize for .gptab.* sections.
- (mips_elf_read_ecoff_info): Read and free external symbols last,
- not first, for clarity.
- (struct mips_elf_link_hash_entry): Define new structure.
- (struct mips_elf_link_hash_table): Define new structure.
- (mips_elf_link_hash_lookup): Define new macro.
- (mips_elf_link_hash_traverse): Define new macro.
- (mips_elf_hash_table): Define new macro.
- (mips_elf_link_hash_newfunc): New static function.
- (mips_elf_link_hash_table_create): New static function.
- (mips_elf_add_symbol_hook): New static function.
- (struct extsym_info): Define new structure.
- (mips_elf_get_extr, mips_elf_set_index): Remove.
- (mips_elf_output_extsym): New static function.
- (gptab_compare): New static function.
- (mips_elf_final_link): Rewrite to use ELF backend linker, and to
- merge gptab information in input files.
- (mips_elf_relocate_hi16): New static function.
- (mips_elf_relocate_section): New static function.
- (bfd_elf32_bfd_link_hash_table_create): Define as macro before
- including elf32-target.h.
- (elf_backend_relocate_section): Likewise.
- (elf_backend_add_symbol_hook): Likewise.
- * elf.c (_bfd_elf_link_hash_newfunc): Rename from
- elf_link_hash_newfunc and make globally visible. Change caller.
- (_bfd_elf_link_hash_table_init): New function, broken out of
- _bfd_elf_link_hash_table_create.
- (_bfd_elf_link_hash_table_create): Use
- _bfd_elf_link_hash_table_init.
- * libelf.h (struct elf_obj_tdata): Add new field bad_symtab.
- (elf_bad_symtab): Define new accessor macro.
- (_bfd_elf_link_hash_newfunc): Declare.
- (_bfd_elf_link_hash_table_init): Declare.
- * elfcode.h (elf_object_p): Call backend object_p hook after
- swapping in all the section headers.
- (map_program_segments): Correct typo: Internal for External.
- (elf_link_add_object_symbols): If elf_bad_symtab is set, read all
- the symbols. Skip STB_LOCAL symbols rather than giving an error.
- (elf_bfd_final_link): If elf_bad_symtab is set, allocate space for
- all symbols, not just locals.
- (elf_link_output_extsym): Only skip a symbol not mentioned by a
- regular file if it is mentioned by a dynamic object.
- (elf_link_input_bfd): If elf_bad_symtab is set, read all the
- symbols.
-
-Fri May 20 13:38:23 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * som.c (som_set_reloc_info): Do not set any relocation info
- for SOM fixups which are never passed to BFD.
-
-Fri May 20 11:57:05 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-mips.c (mips_relocate_section): Add MIPS_R_JMPADDR overflow
- checking.
-
- * elf32-i386.c (elf_i386_size_dynamic_sections): Add DT_DEBUG to
- the dynamic linking information for the benefit of the debugger.
- From Peter Schauer.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
-
- * elf.c (_bfd_elf_make_section_from_shdr): New function, based on
- code repeated three times in bfd_section_from_shdr in elfcode.h.
- * libelf.h (_bfd_elf_make_section_from_shdr): Declare.
- * elfcode.h (bfd_section_from_shdr): Use new function
- _bfd_elf_make_section_from_shdr to create BFD sections. If a
- reloc section does not use the main symbol table, or it is part of
- the process image, treat it as a normal section, not relocs.
- * elf32-mips.c (mips_elf_section_from_shdr): Use new function
- _bfd_elf_make_section_from_shdr.
-
-Thu May 19 11:37:11 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf32-target.h, elf64-target.h: Change ar_max_namelen value from
- 15 to 14 to match SVR4 ar.
-
- Add support for ELF shared libraries. Loosely based on work by
- Eric Youngdale <ericy@cais.com>.
- * libelf.h (struct elf_backend_data): Add new fields for dynamic
- linking: elf_backend_create_dynamic_sections,
- elf_backend_adjust_dynamic_symbol,
- elf_backend_size_dynamic_sections,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections.
- (struct elf_link_hash_entry): Change type of align field to
- bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
- elf_link_hash_flags.
- (struct elf_link_hash_table): Add fields dynobj, dynsymcount,
- dynstr, bucketcount.
- (bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
- (bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
- (bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
- (bfd_elf32_add_dynamic_entry): Declare.
- (bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
- (bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
- (bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
- (bfd_elf64_add_dynamic_entry): Declare.
- * elfcode.h (Elf_External_Dyn): Define.
- (elf_swap_reloc_in): Define as macro using NAME. Make externally
- visible.
- (elf_swap_reloc_out): Likewise.
- (elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
- (elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
- and as new externally visible function.
- (elf_fake_sections): Set section type of dynamic sections based on
- section names.
- (elf_write_phdrs): Remove.
- (assign_file_position_for_section): Add new align argument.
- Change all callers.
- (get_program_header_size): New static function.
- (struct seg_info): Remove.
- (map_program_segments): Completely rewrite.
- (assign_file_positions_except_relocs): Completely rewrite.
- (assign_file_positions_for_relocs): Don't set a file position for
- sections which already have one. Don't bother to align the file
- position here.
- (section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
- section types.
- (elf_section_from_bfd_section): Likewise.
- (elf_slurp_symbol_table): If section_from_elf_index fails, just
- use bfd_abs_section rather than returning an error.
- (elf_sizeof_headers): Make useful.
- (elf_link_record_dynamic_symbol): New static function.
- (elf_link_add_object_symbols): Handle dynamic objects.
- (elf_link_create_dynamic_sections): New static function.
- (elf_add_dynamic_entry): Define as macro using NAME and as new
- externally visible function.
- (NAME(bfd_elf,record_link_assignment)): New function.
- (elf_buckets): New static variable.
- (NAME(bfd_elf,size_dynamic_sections)): New function.
- (struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
- (elf_bfd_final_link): Handle dynamic linking. Create a section
- symbol for all ELF sections, not all BFD sections. Store section
- symbol index in target_index field, not index field. Traverse
- over global symbols even if stripping.
- (elf_link_output_extsym): Output dynamic symbols. Mark symbols
- defined by dynamic objects as undefined.
- (elf_link_input_bfd): Ignore dynamic objects. Use target_index
- field for section relocs, and make sure it is set.
- (elf_reloc_link_order): Use target_index field for section relocs,
- and make sure it is set.
- * elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
- weakdef and elf_link_hash_flags fields.
- (_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
- dynstr and bucketcount fields.
- * elf32-target.h: Initialize new dynamic linking fields.
- * elf64-target.h: Likewise.
- * elf32-i386.c: New functions for dynamic linking support.
- * elf32-sparc.c: Likewise.
- * bfd-in.h (bfd_elf32_record_link_assignment): Declare.
- (bfd_elf64_record_link_assignment): Declare.
- (bfd_elf32_size_dynamic_sections): Declare.
- (bfd_elf64_size_dynamic_sections): Declare.
- * bfd-in2.h: Rebuilt.
-
-Wed May 18 08:29:04 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * som.c: Don't include <sys/dir.h> or <sys/user.h>.
- (som_reloc_queue_find): Call memcmp instead of bcmp.
- (som_bfd_reloc_type_lookup): Change first argument to bfd *.
- (compare_syms): Change types of arguments to const void *.
- (bfd_section_from_som_symbol): Removed unused local found.
- (som_write_armap): Add elength, map, orl_count and int arguments.
- (som_write_armap): Use %ld and cast to long for getuid result.
-
-Wed May 18 09:09:32 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.h (R_HPPA_ABS_CALL): Define.
- * elf32-hppa.c (hppa_elf_gen_reloc_type): Handle absolute calls.
-
- * som.h (R_HPPA_ABS_CALL): Define.
- * som.c (hppa_som_gen_reloc_type): Delete complex relocation types.
-
-Tue May 17 19:33:12 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * coff-i960.c (icoff_little_vec, icoff_big_vec): Indicate leading
- underscore, for compatibility with Intel tool chain (gnu960v2).
-
-Mon May 16 10:09:22 1994 Jeff Law (law@snake.cs.utah.edu)
-
- * bfd-in2.h: Rebuilt.
-
- * elf32-hppa.c: Change .hppa_linker_stubs to .PARISC.stubs,
- likewise for other PA specific sections.
- (hppa_elf_relocate_unwind_table): Delete unused
- function.
- (elf_hppa_howto_table): Completely new table based on 94-02-02
- draft PA ELF spec. Change relocation tags appropriately
- throughout elf32-hppa.c
- (hppa_elf_gen_reloc_type): Rewrite and simplify based on 94-02-02
- spec.
- (hppa_elf_reloc): Likewise.
- (hppa_look_for_stubs_in_section): Likewise
- (ELF_MACHINE_CODE): Change to EM_PARISC.
- * elf32-hppa.h: Include "elf/hppa.h". Change relocation tags
- appropriately throughout elf32-hppa.h.
- (elf32_hppa_reloc_type): New table based on 94-02-02 draft PA ELF
- spec.
- (R_HPPA_ABS_CALL, R_HPPA_COMPLEX*, R_HPPA_UNWIND): Delete definitions.
- * elfcode.h (prep_headers): Use EM_PARISC instead of EM_HPPA.
- * reloc.c (bfd_reloc_code_real): Delete unused HPPA relocations.
- * som.h (R_HPPA_ABS_CALL, R_HPPA_COMPLEX): Delete definitions.
-
- * libhppa.h (hppa_field_adjust): Avoid adding constant_value into
- the final value twice for LR and RR field selectors.
-
-Sat May 14 09:09:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * aoutx.h (add_to_stringtab): Use BFD_ASSERT not assert. This
- avoids __eprintf troubles.
-
-Fri May 13 10:51:21 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bout.c (b_out_bfd_reloc_type_lookup): Handle BFD_RELOC_CTOR.
-
- * config/mipsbelf.mt (SELECT_VECS): Add ecoff_big_vec and
- ecoff_little_vec since Irix 5 supports ECOFF executables.
-
-Wed May 11 00:31:57 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_find_nearest_line): Handle fdr.adr != pdr.adr
- correctly.
-
- * Makefile.in (stmp-bfd.h): Use || instead of ; to force SunOS
- make to invoke the shell.
-
-Tue May 10 14:23:43 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * section.c (SEC_COFF_SHARED_LIBRARY): Renamed from
- SEC_SHARED_LIBRARY for clarity. Changed all uses.
- * bfd-in2.h: Rebuilt.
- * coffcode.h (sec_to_styp_flags): If SEC_COFF_SHARED_LIBRARY is
- set, set STYP_NOLOAD.
- * coffgen.c (coff_section_from_bfd_index): Don't get an assertion
- failure because of a bad shared library.
-
-Mon May 9 18:53:40 1994 Bill Cox (bill@rtl.cygnus.com)
-
- * linker.c: Add missing comment terminator.
-
-Mon May 9 11:53:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * linker.c (_bfd_generic_link_add_one_symbol): If hashp and *hashp
- are not NULL, assume the caller has already looked up the symbol
- in the hash table and has stored the entry in *hashp.
- (generic_link_add_symbol_list): Set h to NULL before calling
- _bfd_generic_link_add_one_symbol.
- * ecoff.c (ecoff_link_add_externals): Likewise.
-
- * elfcode.h (assign_file_positions_except_relocs): Don't require
- page shared between .data and .bss segments to contain zeroes.
-
- * elfcode.h: Include bfdlink.h. Added several new functions to do
- linking.
- (ELF_R_TYPE): Define.
- (bfd_add_to_strtab): Return unsigned long. Change check for
- realloc failure.
- (elf_fake_sections): Check return value of bfd_add_to_strtab.
- (elf_compute_section_file_positions): Add link_info argument.
- Call elf_backend_begin_write_processing hook and prep_headers
- here. Only call swap_out_syms if link_info is NULL. Set up
- .shstrtab section here. Pass dosyms argument to
- assign_file_positions_except_relocs. Set output_has_begun flag.
- (assign_file_positions_for_symtab_and_strtabs): Add dosyms
- argument, and use it to control setting .symtab and .strtab file
- positions.
- (assign_file_positions_except_relocs): Add dosyms argument, and
- pass it on.
- (prep_headers): Check return value of bfd_add_to_strtab.
- (swap_out_syms): Likewise. Also, don't set up .shstrtab here.
- (NAME(bfd_elf,write_object_contents)): Some calls moved into
- elf_compute_section_file_positions.
- (elf_set_section_contents): Likewise.
- (elf_slurp_symbol_table): SHN_LORESERV corrected to SHN_LORESERVE.
- * libelf.h: Include bfdlink.h.
- (struct elf_backend_data): Add fields collect,
- elf_add_symbol_hook, elf_backend_relocate_section.
- (struct bfd_elf_section_data): Add field rel_hashes.
- (struct elf_obj_tdata): Remove fields internal_syms and symbols.
- Add field sym_hashes.
- (obj_symbols, obj_internal_syms): Remove definitions.
- (elf_sym_hashes): Define.
- (struct elf_link_hash_entry): Define.
- (struct elf_link_hash_table): Define.
- (elf_link_hash_lookup): Define.
- (elf_link_hash_traverse): Define.
- (elf_hash_table): Define.
- (_bfd_elf_link_hash_table_create): Declare.
- (bfd_elf32_bfd_link_add_symbols): Declare.
- (bfd_elf32_bfd_final_link): Declare.
- (bfd_elf64_bfd_link_add_symbols): Declare.
- (bfd_elf64_bfd_final_link): Declare.
- * elf.c: Include bfdlink.h.
- (elf_link_hash_newfunc): New function.
- (_bfd_elf_link_hash_table_create): New function.
- * elf32-target.h (elf_backend_relocate_section): If not defined,
- define as 0 and use generic linker. Otherwise, use ELF backend
- linker.
- (elf_backend_collect): If not defined, define as false.
- (elf_backend_add_symbol_hook): If not defined, define as 0.
- (elf32_bed): Initialize new fields.
- * elf64-target.h: Same changes as elf32-target.h.
- * elf32-i386.c: Include bfdlink.h.
- (elf_i386_relocate_section): New function.
- (elf_backend_relocate_section): Define.
- * elf32-sparc.c: Include bfdlink.h.
- (elf_info_to_howto): Change type of dst from Elf32_Internal_Rela
- to Elf_Internal_Rela (they're the same type anyhow).
- (elf_sparc_relocate_section): New function.
- (elf_backend_relocate_section): Define.
- * elf32-mips.c (elf_backend_collect): Define.
-
- * Makefile.in (stmp-bfd.h): Avoid useless make error message in a
- different way; touch takes a numeric argument on some systems.
-
-Fri May 6 13:34:14 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * nlmcode.h (nlm_swap_auxiliary_headers_in): Rework custom header
- handling for latest suggested format.
- (nlm_swap_auxiliary_headers_out): Likewise.
- (nlm_compute_section_file_positions): Likewise.
-
-Fri May 6 11:11:50 1994 D. V. Henkel-Wallace (gumby@rtl.cygnus.com)
-
- * config.bfd: handle erricsson config (for OSE).
-
-Thu May 5 15:40:47 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- Patches from Ralph Campbell:
- * mipsbsd.c (mips_fix_jmp_addr): New function.
- (mips_fix_hi16_s): Use bfd_is_com_section.
- (mips_howto_table_ext): Call mips_fix_jmp_addr for MIPS_RELOC_JMP.
-
-Fri May 6 11:48:55 1994 Steve Chamberlain (sac@cygnus.com)
-
- * config/go32.mh: XX support.
-
- From bill
- * Makefile.in: Build sysdep.h without causing worrying but
- harmless error message.
-
-Wed May 4 11:09:53 1994 Ian Lance Taylor (ian@cygnus.com)
-
- Changed m68k-aout to set flags to 0; m68k-sunos still uses 1.
- * aout0.c: New file.
- * targets.c (aout0_big_vec): Declare.
- (bfd_target_vector): Add aout0_big_vec.
- * config.bfd (m68*-*-aout*): Use m68k-0aout, not m68k-aout.
- * config/m68k-aout.mt (SELECT_VECS): Removed.
- * config/m68k-0aout.mt: New file.
- * configure.in (aout0_big_vec): New target vector: use aout0.o,
- aout32.o and stab-syms.o.
- * Makefile.in: Rebuilt dependencies.
- (BFD32_BACKENDS): Add aout0.o.
- (CFILES): Add aout0.c.
-
- * libaout.h (struct aout_backend_data): Add field exec_hdr_flags.
- * aout-target.h (MY_exec_hdr_flags): If not defined, define as 0.
- MY(backend_data): Initialize exec_hdr_flags field.
- * aoutf1.h (sunos_32_set_arch_mach): Make static.
- (aout32_sunos4_write_object_contents): Set flags from backend
- info.
- (MY_exec_hdr_flags): If not defined, define as 1.
- (sunos4_aout_backend): Initialize exec_hdr_flags field.
- * aout-encap.c (encap_write_object_contents): Set flags from
- backend info.
- (MY_exec_hdr_flags): Define as N_FLAGS_COFF_ENCAPSULATE.
- * hp300hpux.c (MY_exec_hdr_flags): Define as 0x2.
- (MY(write_object_contents)): Set flags from backend info.
- * i386aout.c (MY(backend_data)): Initialize exec_hdr_flags field.
- * i386mach3.c (MY(backend_data)): Likewise.
- * mipsbsd.c (MY(backend_data)): Likewise.
- * sparclynx.c (NAME(aout,sparclynx_write_object_contents)): Set
- flags from backend info.
- (sparclynx_aout_backend): Initialize exec_hdr_flags field.
-
-Wed May 4 02:56:00 1994 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * config.bfd (i386-*-gnu*): Treat like i386-*-mach*.
- (m68*-apollo-*): Treat all Apollo configs the same, don't handle
- BSD specially.
-
-Tue May 3 19:43:21 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * cache.c: Rewrote to work correctly.
- * libbfd.h: Rebuilt.
- * opncls.c (bfd_cache_init, bfd_open_file): Don't declare.
- (bfd_fdopenr): Check return value of bfd_cache_init.
-
-Fri Apr 29 15:08:23 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * cf-m68klynx.c (CALC_ADDEND): Check for PC relative relocs by
- enumerating them, since the reloc type can not serve as an index
- into the m68k COFF howto_table.
-
-Fri Apr 29 09:42:39 1994 Steve Chamberlain (sac@cygnus.com)
-
- * config.bfd (*-go32): Changed to coff.
- * coff-h8300.c (JMPL1): Get HOWTO right for 24bit branches.
- * srec.c (srec_write_symbols): Write out the correct number of
- symbols and don't stick in extra nulls.
-
-Tue Apr 26 15:07:24 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * cf-sparclynx.c (LYNXOS, COFF_LONG_FILENAMES): Define.
- * coff-sparc.c (BADMAG): Recognize LYNXCOFFMAGIC.
- (COFF_SPARC): Define.
- * coffcode.h (coff_new_section_hook): If COFF_SPARC, set alignment
- power of data and bss sections to 3.
- * hosts/lynx.h (__LYNXOS): Define.
-
-Tue Apr 26 15:04:26 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (hppa_elf_reloc): Adjust the addend of relocations
- against section symbols to avoid losing during ld -r.
-
-Tue Apr 26 12:16:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (shstrtab_length_fixed): Remove useless static
- variable.
- (struct elf_sect_data): Remove unused structure.
- (elf_object_p): Free memory if error occurs. Check return value
- of bfd_default_set_arch_mach. If elf_get_str_section fails,
- preserve error code rather than setting wrong_format.
- (null_shdr): Remove static variable.
- (assign_section_numbers): Remove shstrtab_length_fixed assignment.
- Allocate first section header on BFD obstack rather than using
- null_shdr.
- (bfd_prpsinfo): Remove unused local variable newsect.
-
-Mon Apr 25 15:31:04 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (write_relocs): Undo patch of Apr 10; breaks Solaris.
-
- * elfcode.h (bfd_section_from_shdr): Use bfd_make_section_anyway
- to create sections. Check return value of recursive calls.
- (bfd_section_from_phdr): Check return value of bfd_make_section.
- (elf_symbol_from_bfd_symbol): Likewise.
- (elf_object_p): Check return value of bfd_section_from_shdr.
- (section_from_elf_index): Likewise.
- (elf_slurp_symbol_table): Check return value of
- section_from_elf_index.
- (bfd_prstatus): Return boolean value. Check return value of
- bfd_make_section.
- (bfd_fpregset): Likewise.
- (bfd_prpsinfo): Return boolean value.
- (elf_corefile_note): Check return values of bfd_prstatus,
- bfd_fpregset, and bfd_prpsinfo.
- (elf_core_file_p): Check return value of elf_corefile_note.
-
-Fri Apr 22 11:08:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Get rid of the ECOFF .reginfo section hack.
- * ecoff.c (ecoff_mkobject_hook): Don't create a .reginfo section.
- (ecoff_new_section_hook): Don't handle the .reginfo section.
- (ecoff_sizeof_headers): Likewise.
- (ecoff_get_section_contents): Likewise.
- (ecoff_compute_section_file_positions): Likewise.
- (ecoff_compute_reloc_file_positions): Likewise.
- (ecoff_set_section_contents): Likewise.
- (ecoff_write_object_contents): Likewise.
- (ecoff_bfd_final_link): Likewise.
- (ecoff_bfd_copy_private_bfd_data): Copy the GP value and the
- register masks.
- (bfd_ecoff_get_gp_value): New function.
- (bfd_ecoff_set_gp_value): New function.
- (bfd_ecoff_set_regmasks): New function.
- * bfd-in.h (bfd_ecoff_get_gp_value): Declare.
- (bfd_ecoff_set_gp_value): Declare.
- (bfd_ecoff_set_regmasks): Declare.
- * bfd-in2.h: Rebuilt.
-
- Fix ECOFF objcopy to actually copy debugging information.
- * ecoff.c (ecoff_bfd_copy_private_bfd_data): New function.
- (ecoff_get_extr): Assume that any ECOFF symbol with local clear is
- an external symbol, rather than checking the symbol flags. Only
- check the flags for non-ECOFF symbols.
- * ecofflink.c (bfd_ecoff_debug_externals): Don't crash if the
- output_section field of the symbol section is NULL.
- * libecoff.h (ecoff_bfd_copy_private_bfd_data): Declare as
- function rather than defining as macro.
-
- * ieee.c (ieee_object_p): Set bfd_error_got_wrong_format if
- appropriate.
-
- * targets.c (bfd_target_vector): Add bfd_elf32_powerpc_vec.
-
- * aout-adobe.c (aout_adobe_set_arch_mach): Check return value of
- bfd_default_set_arch_mach. Accept bfd_arch_m68k as well as
- bfd_arch_unknown.
- * coffcode.h (coff_set_arch_mach): Check return value of
- bfd_default_set_arch_mach.
- * elfcode.h (elf_set_arch_mach): Don't check a list of ELF
- architectures, just see if the desired architecture matches what
- the ELF backend permits.
-
- * coffcode.h (coff_set_arch_mach_hook): Rename SHMAGIC to
- SH_ARCH_MAGIC to match change in coff/sh.h.
- (coff_set_flags): Likewise.
-
- Follow convention in which each NLM header has an 8 byte stamp
- followed by a four byte length.
- * libnlm.h (struct nlm_obj_tdata): Rename nlm_cygnus_section_hdr
- to nlm_cygnus_ext_header, and change type to
- Nlm_Internal_Cygnus_Ext_Header.
- (nlm_cygnus_ext_header): Rename from nlm_cygnus_section_header.
- * nlmcode.h (nlm_swap_auxiliary_headers_in): Use CyGnUsEx instead
- of CyGnUsSeCs. Rename from cygnus_section to cygnus_ext. Require
- length word to be 8.
- (nlm_swap_auxiliary_headers_out): Rename from cygnus_section to
- cygnus_ext. Set length word to 8.
- (nlm_compute_section_file_positions): Rename from cygnus_section
- to cygnus_ext.
-
-Thu Apr 21 22:54:22 1994 Stu Grossman (grossman at cygnus.com)
-
- * nlmcode.h (nlm_swap_auxiliary_headers_in): Keep section table
- (from CyGnUsSeCs) in more permanent memory to keep section names
- from getting trashed.
-
-Thu Apr 21 09:29:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * libelf.h (elf_obj_tdata): Add members for dynamic symbol table
- handling.
- * elfcode.h (bfd_section_from_shdr): Handle dynamic symbol table.
- * elfcode.h (elf_slurp_symbol_table): Take additional parameter
- to select static or dynamic symbol table and return number of
- symbols slurped or -1 on error.
- * elfcode.h (elf_get_symtab): Set bfd symcount from
- elf_slurp_symbol_table result.
- * elfcode.h (elf_get_dynamic_symtab_upper_bound,
- elf_canonicalize_dynamic_symtab): New functions to handle dynamic
- symbol table.
- * elf32-target.h, elf64-target.h (BFD_JUMP_TABLE_DYNAMIC):
- Change to handle dynamic symbol table, provide default definitions
- for dynamic relocs.
- * aoutx.h (howto_table_std, NAME(aout,swap_std_reloc_out),
- NAME(aout,swap_std_reloc_in), aout_link_input_section_std,
- aout_link_reloc_link_order): Handle r_jmptable and r_relative
- relocations.
-
-Thu Apr 21 11:58:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Clean up uses of _bfd_dummy_target (from Peter Schauer).
- * libbfd.c (_bfd_dummy_target): Set bfd_error_wrong_format.
- * nlm-target.h (nlm_core_file_p): Define as _bfd_dummy_target, not
- NULL.
- * srec.c (srec_vec): Use _bfd_dummy_target, not NULL, in
- _bfd_check_format.
- (symbolsrec_vec): Likewise.
- * tekhex.c (tekhex_vec): Likewise.
-
- * libnlm.h (struct nlm_obj_tdata): Add nlm_cygnus_section_hdr
- field.
- (nlm_cygnus_section_header): New accessor macro.
- * nlmcode.h (nlm_object_p): Free new tdata structure if failure.
- Add fixed sections before swapping in auxiliary headers. After
- adding sections, treat errors as real, not as wrong format.
- (nlm_swap_auxiliary_headers_in): Swap in the sections header; add
- sections to the BFD for each section it describes.
- (nlm_swap_auxiliary_headers_out): Swap out the sections header.
- (nlm_compute_section_file_positions): Account for the size of the
- sections header.
-
-Wed Apr 20 16:45:51 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * coff-sparc.c (sparccoff_vec): Change minimum alignment power to
- 2, so that stab sections can be multiples of 4 bytes only.
-
- * hosts/i386aix.h: Changes to avoid prototypes conflicts with the
- ones defined in stdlib.h. (From Minh Tran-Le.)
-
-Wed Apr 20 14:15:21 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * nlm32-ppc.c: Complete rewrite for new version of PowerPC
- NetWare. Old code still present, but ifdeffed out.
-
- * nlmcode.h (nlm_swap_auxiliary_headers_in): Don't assume a
- particular format for the customer header. Allocate a block of
- memory and read it into that.
- (nlm_swap_auxiliary_headers_out): Write out the block of memory.
- (nlm_compute_section_file_positions): Include length of customer
- header when computing its size.
-
-Mon Apr 18 14:27:17 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_prep_headers): Get the space's number from the
- backend private section data rather than target_index.
- (bfd_som_set_section_attributes): Store the space's number
- in the backend private section data rather than target_index.
-
- * som.h (som_copyable_section_data_struct): Add space_number.
-
-Fri Apr 15 12:22:07 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-a29k.c (reloc_processing): Always set the address of a
- R_IHCONST reloc to that of the immediately preceding R_IHIHALF.
- gas does this anyhow, but some other assemblers seem to leave
- garbage in the R_IHCONST address field.
-
- * archive.c: Consistently use ARFMAG; from
- schwab@issan.informatik.uni-dortmund.de (Andreas Schwab).
- (_bfd_write_archive_contents): Use ARFMAG rather than '`' and
- '\012'.
- (bsd_write_armap): Likewise.
- (coff_write_armap): Likewise.
-
- * coff-mips.c (mips_relocate_section): When relaxing, adjust local
- relocs against the .text section as required.
- * ecofflink.c (bfd_ecoff_debug_accumulate): When relaxing, adjust
- PDR addresses as required.
-
- * ecoff.c (ecoff_emit_aggregate): Take fdr argument. Map fdr
- index through rfd map if it exists. Check for a couple of cases
- which gdb handles specially. Change all callers.
- (ecoff_type_to_string): Take fdr argument rather than aux_ptr and
- bigendian argument. Change all callers.
- (ecoff_print_symbol): Handle stStruct, stUnion and stEnum.
-
-Thu Apr 14 13:05:10 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-mips.c (mips_howto_table): Add dummy entries to account for
- numbering changes in include/coff/mips.h. Add entries for
- MIPS_R_RELHI and MIPS_R_RELLO.
- (mips_ecoff_swap_reloc_in): Handle an extra bit for the reloc type
- when little endian. Treat internal MIPS_R_RELLO or MIPS_R_RELHI
- relocs like MIPS_R_SWITCH, and convert r_offset from 24 to 32
- bits.
- (mips_ecoff_swap_reloc_out): Likewise.
- (mips_adjust_reloc_in): Handle internal MIPS_R_RELLO or
- MIPS_R_RELHI relocs like MIPS_R_SWITCH.
- (mips_adjust_reloc_out): Likewise.
- (mips_relhi_addr, mips_relhi_addend): New static variables.
- (mips_relhi_reloc, mips_rello_reloc): New functions.
- (mips_bfd_reloc_type_lookup): Turn BFD_RELOC_PCREL_HI16_S into
- MIPS_R_RELHI and turn BFD_RELOC_PCREL_LO16 into MIPS_R_RELLO.
- (mips_relocate_hi): Rename from mips_relocate_refhi, and add pcrel
- argument. Changed all callers.
- (mips_relocate_section): Rename got_reflo to got_lo and
- reflo_int_rel to lo_int_rel. Handle MIPS_R_RELLO and MIPS_R_RELHI
- relocs.
- (mips_relax_section): Adjust MIPS_R_RELHI/MIPS_R_RELLO pairs when
- expanding a PC relative call.
-
- * reloc.c (bfd_reloc_code_real_type): Add BFD_RELOC_PCREL_HI16_S
- and BFD_RELOC_PCREL_LO16.
- * bfd-in2.h: Rebuilt.
-
-Wed Apr 13 11:50:07 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * coff-sparc.c (sparccoff_vec): Set minimum alignment power to 3.
-
-Tue Apr 12 13:36:20 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_write_fixups): Always emit at least
- one relocation for any non-bss section.
-
-Mon Apr 11 14:41:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (assign_file_positions_except_relocs): Don't require
- the file alignment to correspond to the page size when linking
- with -N.
-
-Sun Apr 10 01:02:24 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elfcode.h (write_relocs): For rela relocations, adjust the
- addend for relocations involving section symbols to account
- for the lossage of 1:1 mapping from input section symbols to
- output section symbols.
-
-Fri Apr 8 12:22:02 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (NAME(aout,make_sections)): New function.
- (NAME(aout,some_aout_object_p)): Call NAME(aout,make_sections)
- rather than making sections inline.
- (NAME(aout,mkobject)): Don't make any sections.
- (NAME(aout,adjust_sizes_and_vmas)): Call NAME(aout,make_sections).
- (NAME(aout,final_link)): Don't dereference obj_textsec (abfd) or
- obj_datasec (abfd) if they are NULL.
- * libaout.h (NAME(aout,make_sections)): Declare.
- * bout.c (b_out_mkobject): Don't make any sections.
- (b_out_write_object_contents): Call aout_32_make_sections.
- (b_out_set_section_contents): Likewise.
- * i386os9k.c (os9k_mkobject): Don't make any sections.
- (os9k_write_object_contents): Call aout_32_make_sections.
- (os9k_set_section_contents): Likewise.
-
- * aoutx.h (NAME(aout,new_section_hook)): Don't set N_EXT in target
- index.
-
-Wed Apr 6 20:44:56 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * config.bfd, configure.host: Add mips-*-sysv4* support.
-
-Thu Apr 7 14:23:05 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-mips.c (mips_howto_table): Add entry for MIPS_R_SWITCH.
- (mips_ecoff_swap_reloc_in): For MIPS_R_SWTICH, copy r_symndx into
- r_offset and set r_symndx to RELOC_SECTION_TEXT.
- (mips_ecoff_swap_reloc_out): For MIPS_R_SWITCH, get the r_symndx
- value from the r_offset field.
- (mips_adjust_reloc_in): Maximum r_type value is now MIPS_R_SWITCH.
- For MIPS_R_SWITCH, copy the r_offset field into the addend field.
- (mips_adjust_reloc_out): For MIPS_R_SWITCH, copy the addend field
- into the r_offset field.
- (mips_switch_reloc): New function.
- (mips_bfd_reloc_type_lookup): Translate BFD_RELOC_GPREL32 into
- MIPS_R_SWITCH.
- (mips_relocate_section): Handle MIPS_R_SWITCH.
- (mips_relax_section): Adjust MIPS_R_SWITCH offset if necessary.
-
-Thu Apr 7 11:10:51 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elfcode.h (elf_set_section_contents): Support calling the backend
- function elf_backend_begin_write_processing when just beginning to
- write an object file.
-
- * libelf.h (elf_backend_begin_write_processing): Declare.
-
- * elf{32,64}-target.h (elf_backend_begin_write_processing): Provide
- a default definition.
- (elf{32,64}_bed): Add elf_backend_begin_write_processing.
-
- * elf32-hppa.h (elf_hppa_tc_symbol): Delete extern declaration.
- (elf_hppa_tc_make_sections): Likewise.
-
- * elf32-hppa.c (symext_chain_built): Delete.
- (symext_chain_size): Renamed from symextn_contents_real_size.
- (elf32_hppa_backend_{begin,final}_write_processing): New functions.
- (add_entry_to_symext_chain): New function.
- (hppa_elf_set_section_contents): Ignore writes to the symbol extension
- section until it's been rebuilt internally.
- (hppa_elf_get_section_contents): Symbol extension section is no
- longer special.
- (elf_backend_{begin,final}_write_processing): Define.
- (elf_hppa_tc_make_sections): Simplify now that much code has
- migrated into elf32_hppa_backend_{being,final}_write_processing.
-
-Wed Apr 6 17:24:14 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Add new target vectors to read the dynamic symbols and dynamic
- relocs. Change a.out to use these rather than reading the dynamic
- symbols and relocs along with the normal symbols and relocs.
- * targets.c (bfd_target): Add fields
- _bfd_get_dynamic_symtab_upper_bound,
- _bfd_canonicalize_dynamic_symtab,
- _bfd_get_dynamic_reloc_upper_bound,
- _bfd_canonicalize_dynamic_reloc.
- (BFD_JUMP_TABLE_DYNAMIC): Define.
- * libbfd-in.h (_bfd_nodynamic_get_dynamic_symtab_upper_bound):
- Define.
- (_bfd_nodynamic_canonicalize_dynamic_symtab): Define.
- (_bfd_nodynamic_get_dynamic_reloc_upper_bound): Define.
- (_bfd_nodynamic_canonicalize_dynamic_reloc): Define.
- * bfd.c (bfd_get_dynamic_symtab_upper_bound): Define.
- (bfd_canonicalize_dynamic_symtab): Define.
- (bfd_get_dynamic_reloc_upper_bound): Define.
- (bfd_canonicalize_dynamic_reloc): Define.
- * sunos.c (MY_read_dynamic_symbols): Don't define.
- (MY_read_dynamic_relocs): Don't define.
- (MY_get_dynamic_symtab_upper_bound): Define.
- (MY_canonicalize_dynamic_symtab): Define.
- (MY_get_dynamic_reloc_upper_bound): Define.
- (MY_canonicalize_dynamic_reloc): Define.
- (struct sunos_dynamic_info): Change type of dynsym_count and
- dynrel_count to long. Add fields canonical_dynsym and
- canonical_dynrel.
- (sunos_read_dynamic_info): Check that BFD had DYNAMIC flag set.
- Clear info->canonical_dynsym and info->canonical_dynrel.
- (MY(read_dynamic_symbols)): Removed.
- (MY(read_dynamic_relocs)): Removed.
- (sunos_get_dynamic_symtab_upper_bound): New function.
- (sunos_canonicalize_dynamic_symtab): New function.
- (sunos_get_dynamic_reloc_upper_bound): New function.
- (sunos_canonicalize_dynamic_reloc): New function.
- * libaout.h: Declare struct reloc_ext_external and
- reloc_std_external to avoid prototype problems.
- (struct aout_backend_data): Remove fields read_dynamic_symbols and
- read_dynamic_relocs.
- (NAME(aout,translate_symbol_table)): Declare.
- (NAME(aout,swap_ext_reloc_in)): Declare.
- (NAME(aout,swap_std_reloc_in)): Declare.
- * aoutx.h (NAME(aout,translate_symbol_table)): Renamed from
- translate_symbol_table and made non-static. Changed all callers.
- (NAME(aout,slurp_symbol_table)): Don't read dynamic symbols.
- (NAME(aout,slurp_reloc_table)): Don't read dynamic relocs.
- (NAME(aout,get_reloc_upper_bound)): Don't count dynamic relocs.
- * aoutf1.h (aout_32_sunos4_write_object_contents): Don't bother to
- remove dynamic symbols and relocs. They will no longer be
- present.
- (MY_read_dynamic_symbols): Don't define.
- (MY_read_dynamic_relocs): Don't define.
- (sunos4_aout_backend): Don't initialize dynamic entry points.
- * aout-target.h (MY_read_dynamic_symbols): Don't define.
- (MY_read_dynamic_relocs): Don't define.
- (MY(backend_data)): Don't initialize dynamic entry points.
- (MY_get_dynamic_symtab_upper_bound): If not defined, define to
- _bfd_nodynamic version.
- (MY_canonicalize_dynamic_symtab): Likewise.
- (MY_get_dynamic_reloc_upper_bound): Likewise.
- (MY_canonicalize_dynamic_reloc): Likewise.
- * All backends: Added BFD_JUMP_TABLE_DYNAMIC to target vector.
- * bfd-in2.h: Rebuilt.
- * libbfd.h: Rebuilt.
-
- * cf-m68klynx.c: Include sysdep.h.
-
- * hp300hpux.c: Removed some spaces in uses of NAME to avoid
- problems with traditional C compilers.
-
- * targets.c (bfd_target): Rearranged fields in target vector.
- Removed _bfd_debug_info_start, _bfd_debug_info_end and
- _bfd_debug_info_accumulate, which were never used.
- (BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
- (BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
- (BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
- (BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
- * All backends: Changed to use the new BFD_JUMP_TABLE_* macros
- rather than the single JUMP_TABLE macro. Removed many of the
- weird macro definitions needed to support the monolithic
- JUMP_TABLE.
- * bfd-in.h (JUMP_TABLE): Removed.
- * libbfd-in.h: Define a bunch of macros, and declare a few
- functions, for use with the new BFD_JUMP_TABLE_* macros.
- * libbfd.c (_bfd_dummy_new_section_hook): Removed.
- (bfd_false): Set bfd_error_invalid_operation.
- (bfd_nullvoidptr): Likewise.
- (bfd_n1): New function.
- (_bfd_nocore_core_file_matches_executable_p): Renamed from
- _bfd_dummy_core_file_matches_executable_p.
- (_bfd_nocore_core_file_failing_command): Similar rename. Set
- bfd_error_invalid_operation.
- (_bfd_nocore_core_file_failing_signal): Likewise.
- (_bfd_generic_get_section_contents): Renamed from
- bfd_generic_get_section_contents. Changed all callers.
- (_bfd_generic_set_section_contents): Similar rename.
- * ieee.c: #if 0 out ieee_bfd_debug_info_start,
- ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
- were never called.
- * bfd-in2.h: Rebuilt.
- * libbfd.h: Rebuilt.
-
-Tue Apr 5 22:10:04 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * Crude support for examining dynamic libraries.
- * som.c (som_object_setup): Set DYNAMIC flag for SHL_MAGIC and
- DL_MAGIC objects.
- (som_prep_headers): Preserve the system_id for DYNAMIC objects.
- Use SHL_MAGIC as the magic number of the DYNAMIC flag is set.
- Write exec headers for DYNAMIC objects.
- (som_begin_writing): DYNAMIC objects have the same alignment
- restrictions as D_PAGED objects.
- (bfd_section_from_som_symbol): Treat DYNAMIC objects like EXEC_P
- objects.
- (object_flags): Add DYNAMIC.
-
-Tue Apr 5 17:48:52 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * i386lynx.c, sparclynx.c (NAME): Remove embedded whitespace in
- macro uses, confuses some non-ANSI compilers.
-
-Tue Apr 5 15:50:01 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_free_cached_info): Add missing PARAMS decl.
- Don't free anything if we don't have a bfd_object.
- (som_close_and_cleanup): Call som_bfd_free_cached_info.
-
-Tue Apr 5 11:22:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf32-mips.c (mips_elf_final_link): Don't remove empty sections.
- It turns out not to be required on Irix 5, and it causes problems
- if the sections happen to contain symbols.
-
- * elfcode.h (write_shdrs_and_ehdr): Correct bfd_write check.
-
- * aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out if
- section->relocation is NULL; malloc might have returned NULL when
- given a zero size if there were no relocations.
- * bout.c (b_out_canonicalize_reloc): Likewise.
- * coffcode.h (coff_canonicalize_reloc): Likewise.
- * ecoff.c (ecoff_canonicalize_reloc): Likewise.
- * elfcode.h (elf_canonicalize_reloc): Likewise.
- * mipsbsd.c (MY(canonicalize_reloc)): Likewise.
- * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
- * nlmcode.h (nlm_canonicalize_reloc): Likewise.
- * som.c (som_canonicalize_reloc): Likewise.
- * hp300hpux.c (MY(slurp_reloc_table)): Likewise. Also, if malloc
- returns NULL, don't report an error if we asked for zero bytes.
- * i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns
- NULL, don't report an error if we asked for zero bytes.
- * nlmcode.h (nlm_slurp_reloc_fixups): Likewise.
-
-Mon Apr 4 15:30:49 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (NAME(aout,bfd_free_cached_info)): Don't free anything
- if we don't have a bfd_object.
-
- Made sure that every call to bfd_read, bfd_write, and bfd_seek
- checks the return value and handled bfd_error correctly. These
- changes are not itemised. Also:
- * aoutx.h (emit_strtab): Change return type to boolean, and return
- errors.
- (NAME(aout,write_syms)): Check emit_strtab return value.
- (NAME(aout,final_link)): Likewise.
- * coffcode.h (coff_write_relocs): Change return type to boolean,
- and return errors.
- (coff_write_object_contents): Check coff_write_relocs return
- value.
- * i386os9k.c (os9k_swap_exec_header_in): Change return type to
- boolean.
- (os9k_object_p): Check os9k_swap_exec_header_in return value.
- * oasys.c (oasys_read_record): Change return type to boolean.
- (oasys_slurp_symbol_table: Check oasys_read_record return value.
- (oasys_object_p, oasys_slurp_section_data): Likewise.
- (oasys_write_record): Change return type to boolean.
- (oasys_write_syms): Likewise. Also, check oasys_write_record
- return value.
- (oasys_write_sections): Check oasys_write_record return value.
- (oasys_write_header): Change return type to boolean. Check
- oasys_write_record return value.
- (oasys_write_end, oasys_write_data): Likewise.
- (oasys_write_object_contents): Check return values of
- oasys_write_header, oasys_write_syms, oasys_write_data, and
- oasys_write_end.
- * srec.c (srec_write_record): Change return type to boolean.
- (srec_write_header): Likewise. Also, check srec_write_record
- return value.
- (srec_write_section, srec_write_terminator): Likewise.
- (srec_write_symbols): Change return type to boolean.
- (internal_srec_write_object_contents): Check return value of
- srec_write_symbols, srec_write_header, srec_write_section, and
- srec_write_terminator.
-
- * Makefile.in: Rebuilt dependencies.
-
-Mon Apr 4 10:56:45 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * aix386-core.c (aix386_bfd_is_local_label): Correct cast from
- asection to asymbol.
- * ptrace-core.c (ptrace_unix_bfd_is_local_label): Correct cast from
- bfd to asymbol.
- * trad-core.c (trad_unix_bfd_is_local_label): Correct cast from
- asection to asymbol.
-
-Sun Apr 3 18:27:29 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_slurp_string_table): Use malloc to allocate space
- for the cached copy of the native string table.
- (som_slurp_symbol_table): Likewise for the native symbol table.
- (som_slurp_reloc_table): Likewise for the native and generic
- relocation tables.
- (som_bfd_free_cached_info): Free the cached native strings,
- symbols, and relocations. Also free the canonical cached
- relocations.
-
-Fri Apr 1 12:40:58 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (aout_link_write_symbols): If keep_memory is false, make
- sure the symbol name is stored in permanent memory before adding
- it to the string table.
-
- * archive.c (_bfd_write_archive_contents): Once we've found an
- object, don't bother to look for more when deciding whether to
- build a map.
- (compute_and_write_armap): After adding the symbols for a BFD,
- call bfd_free_cached_info on it.
-
- Add bfd_free_cached_info support to a.out backends.
- * aoutx.h (aout_get_external_symbols): Renamed from
- aout_link_get_symbols. Read strings even if symbols have been
- read. Store string size in obj_aout_string_size.
- (NAME(aout,slurp_symbol_table)): Call aout_get_external_symbols to
- read the symbols. Allocate the cached symbols with malloc, not
- bfd_alloc.
- (NAME(aout,slurp_reloc_table)): Allocate the cached relocs with
- malloc, not bfd_alloc.
- (NAME(aout,bfd_free_cached_info)): New function; free cached
- symbols and relocs.
- * libaout.h (struct aoutdata): Add external_string_size field.
- (obj_aout_external_string_size): New accessor macro.
- (NAME(aout,close_and_cleanup)): Don't declare.
- (NAME(aout,bfd_free_cached_info)): Declare.
- (aout_32_close_and_cleanup): Don't define.
- (aout_64_close_and_cleanup): Don't define.
- * aout-target.h (MY_bfd_free_cached_info): If not already defined,
- define as NAME(aout,free_cached_info).
- (MY_close_and_cleanup): If not already defined, define as
- MY_bfd_free_cached_info.
- * aout-adobe.c (aout_32_close_and_cleanup): Define.
- (aout_32_bfd_free_cached_info): Don't define.
- * bout.c (aout_32_close_and_cleanup): Define.
- (aout_32_bfd_free_cached_info): Don't define.
- * hp300hpux.c (MY_bfd_free_cached_info): Define as bfd_true.
- (MY_close_and_cleanup): Don't define.
- * i386lynx.c (NAME(lynx,slurp_reloc_table)): Allocate the cached
- relocs with malloc, not bfd_alloc.
- * i386os9k.c (aout_32_close_and_cleanup): Define.
- (aout_32_bfd_free_cached_info): Don't define.
-
- Add a new entry point to free memory cached by a BFD.
- * targets.c (bfd_target): Add _bfd_free_cached_info field.
- * bfd.c (bfd_free_cached_info): Define.
- * bfd-in.h (JUMP_TABLE): Add _bfd_free_cached_info.
- * bfd-in2.h: Rebuilt.
- * All backends: Initialize bfd_free_cached_info entry point to
- bfd_true.
-
- * elf32-hppa.c (elf_hppa_reloc_type_lookup): Correct type of
- first, unused, argument.
- (hppa_elf_is_local_label): Declare instead of
- som_bfd_is_local_label.
-
- * coff-a29k.c (a29k_reloc): Add reloc_entry->address to value of
- absolute R_IREL reloc.
-
-Thu Mar 31 11:52:15 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Added some support for Irix 4 shared libraries.
- * ecoff.c (ecoff_new_section_hook): Set SEC_SHARED_LIBRARY for a
- .lib section.
- (ecoff_sec_to_styp_flags): Set SEC_SHARED_LIBRARY if
- STYP_ECOFF_LIB bit is set.
- (ecoff_compute_section_file_positions): Round the contents of a
- .lib section up to the next page boundary.
- (ecoff_set_section_contents): If we see a .lib section, increment
- the vma by one to count the number of shared libraries we have.
- (ecoff_write_object_contents): Don't crash if we see a
- STYP_ECOFF_LIB section, and don't adjust text_start or data_start
- or bss_size either.
-
- * coffcode.h (CALC_ADDEND): Change to fetch original symbol value
- from original BFD, rather than using value of current BFD symbol.
- Needed for new linker.
- * coff-sparc.c (CALC_ADDEND): Likewise.
-
- * ecoff.c (ecoff_write_object_contents): Set the text_start and
- data_start entries in the optional header correctly even if a text
- or data section starts at location zero.
-
- * reloc.c (bfd_reloc_code_real_type): Added BFD_RELOC_26 (from sef
- and raeburn).
- * bfd-in2.h: Rebuilt.
-
- * nlm32-i386.c (nlm_i386_read_import): Null terminate the symbol
- name.
- * nlm32-alpha.c (nlm_alpha_read_import): Likewise.
- * nlm32-sparc.c (nlm_sparc_read_import): Likewise.
-
- * coffgen.c (coff_write_symbol): Reindented. Changed to return
- boolean, and changed written to unsigned int *. Check error
- returns from called functions.
- (coff_write_alien_symbol): Likewise.
- (coff_write_native_symbol): Likewise.
- (coff_write_symbols): Likewise. Reworked checks on whether to
- write symbol name to string table for clarity and to avoid core
- dumping when given a non COFF symbol.
- * libcoff-in.h (coff_write_symbols): Declare as returning boolean.
- * libcoff.h: Rebuilt.
- * coffcode.h (coff_write_object_contents): Check return value of
- coff_write_symbols.
-
-Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Changes to let BFD return an error indication from
- get_symtab_upper_bound, bfd_canonicalize_symtab,
- bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
- return long instead of unsigned int, and use -1 to indicate an
- error. Along the way, rename get_symtab_upper_bound to
- bfd_get_symtab_upper_bound.
- * bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
- errors.
- (bfd_canonicalize_reloc): Likewise.
- * syms.c (bfd_get_symtab_upper_bound): Renamed from
- get_symtab_upper_bound.
- * targets.c (bfd_target): Renamed _get_symtab_upper_bound to
- _bfd_get_symtab_upper_bound, and changed it and
- _bfd_canonicalize_symtab and _get_reloc_upper_bound and
- _bfd_canonicalize_reloc to all return long.
- * aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
- (NAME(aout,canonicalize_reloc)): Likewise.
- (NAME(aout,get_reloc_upper_bound)): Likewise.
- (NAME(aout,get_symtab_upper_bound)): Likewise.
- * bout.c (b_out_canonicalize_reloc): Likewise.
- (b_out_get_reloc_upper_bound): Likewise.
- * coffcode.h (coff_canonicalize_reloc): Likewise.
- * coffgen.c (coff_get_symtab_upper_bound): Likewise.
- (coff_get_symtab): Likewise.
- (coff_get_reloc_upper_bound): Likewise.
- * ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
- (ecoff_get_symtab): Likewise.
- (ecoff_canonicalize_reloc): Likewise.
- * elfcode.h (elf_get_symtab_upper_bound): Likewise.
- (elf_get_reloc_upper_bound): Likewise.
- (elf_canonicalize_reloc): Likewise.
- (elf_get_symtab): Likewise.
- * hp300hpux.c (MY(get_symtab)): Likewise.
- (MY(get_symtab_upper_bound)): Likewise.
- (MY(canonicalize_reloc)): Likewise.
- * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
- * ieee.c (ieee_slurp_external_symbols): Change return type to
- boolean. Check for errors from get_symbol.
- (ieee_slurp_symbol_table): Change return type to boolean. Check
- for errors from ieee_slurp_external_symbols.
- (ieee_get_symtab_upper_bound): Return long, and -1 on errors.
- (ieee_get_symtab): Likewise.
- (ieee_get_reloc_upper_bound): Likewise.
- (ieee_canonicalize_reloc): Likewise.
- * mipsbsd.c (MY(canonicalize_reloc)): Likewise.
- * nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
- (nlm_get_symtab): Likewise.
- (nlm_get_reloc_upper_bound): Likewise.
- (nlm_canonicalize_reloc): Likewise.
- * oasys.c (oasys_get_symtab_upper_bound): Likewise.
- (oasys_get_symtab): Likewise.
- (oasys_get_reloc_upper_bound): Likewise.
- (oasys_canonicalize_reloc): Likewise.
- * som.c (som_get_symtab_upper_bound): Likewise.
- (som_get_symtab): Likewise.
- (som_get_reloc_upper_bound): Likewise.
- (som_canonicalize_reloc): Likewise.
- * srec.c (srec_get_symtab_upper_bound): Likewise.
- (srec_get_symtab): Likewise.
- (srec_get_reloc_upper_bound): Define as bfd_0l.
- (srec_canonicalize_reloc): Likewise.
- * tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
- (tekhex_get_symtab_upper_bound): Likewise.
- (tekhex_get_reloc_upper_bound): Define as bfd_0l.
- (tekhex_canonicalize_reloc): Likewise.
- * libaout.h (NAME(aout,get_symtab_upper_bound)): Change
- declaration to return long.
- (NAME(aout,get_symtab)): Likewise.
- (NAME(aout,canonicalize_reloc)): Likewise.
- (NAME(aout,get_reloc_upper_bound)): Likewise.
- * libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
- (coff_get_symtab): Likewise.
- (coff_get_reloc_upper_bound): Likewise.
- * libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
- (ecoff_get_symtab): Likewise.
- (ecoff_canonicalize_reloc): Likewise.
- * libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
- (bfd_elf32_get_symtab): Likewise.
- (bfd_elf32_get_reloc_upper_bound): Likewise.
- (bfd_elf32_canonicalize_reloc): Likewise.
- (bfd_elf64_get_symtab_upper_bound): Likewise.
- (bfd_elf64_get_symtab): Likewise.
- (bfd_elf64_get_reloc_upper_bound): Likewise.
- (bfd_elf64_canonicalize_reloc): Likewise.
- * libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
- (nlmNAME(get_symtab)): Likewise.
- (nlmNAME(get_reloc_upper_bound)): Likewise.
- (nlmNAME(canonicalize_reloc)): Likewise.
- * archive.c (compute_and_write_armap): Use error_return and
- no_memory_return labels rather than freeing information in various
- places. Change storage, symcount and src_count to long. Check
- errors from bfd_get_symtab_upper_bound and
- bfd_canonicalize_symtab.
- * bout.c (b_out_relax_section): Change reloc_size to long. Check
- for errors from bfd_get_reloc_upper_bound and
- bfd_canonicalize_reloc.
- (b_out_get_relocated_section_contents): Likewise.
- * coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
- Likewise.
- * elf32-mips.c: Likewise.
- * elf32-hppa.c (hppa_elf_stub_finish): Likewise.
- (hppa_look_for_stubs_in_section): Check for errors from
- bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
- bfd_canonicalize_reloc.
- * ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
- from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
- * linker.c (generic_link_read_symbols): Likewise.
- (_bfd_generic_final_link): Check for errors from
- bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
- * reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
- * reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
- (bfd_coff_reloc16_get_relocated_section_contents): Likewise.
- * libbfd.c (bfd_0l): New function.
- * libbfd-in.h (bfd_0l): Declare.
- * aix386-core.c: Change get_symtab_upper_bound, get_symtab,
- get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
- than bfd_0u.
- * cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
- * irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
- * bfd-in2.h: Rebuilt.
- * libbfd.h: Rebuilt.
- * libcoff.h: Rebuilt.
-
- * nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
- temp and name.
-
-Wed Mar 30 08:33:04 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/dpx2.h: Define POSIX_UTIME.
-
-Wed Mar 30 00:31:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * i386dynix.c, config/i386-dynix.mt: New files, handling Dynix
- variant of a.out.
- * configure.in, config.bfd: Use them for Dynix.
- * Makefile.in: Add dependencies for i386dynix.o.
- * targets.c: Add definition for i386dynix_vec.
- * hosts/symmetry.h: Do not define TRAD_CORE_USER_OFFSET for Dynix.
- Define HOST_DATA_START_ADDR and TRAD_UNIX_CORE_FILE_FAILING_SIGNAL
- for Dynix. Remove inclusion of dynix3.h, Dynix bfd is now handled by
- i386dynix.c
-
-Mon Mar 28 12:53:27 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * Makefile.in (BFD32_BACKENDS): Add coff-sparc.o.
-
- * coffcode.h (coff_set_flags): Handle bfd_arch_powerpc like
- bfd_arch_rs6000.
-
- * config.bfd (powerpc-*-aix*): New target; use rs6000.mt.
- * config/rs6000.mt (SELECT_ARCHITECTURES): Add bfd_powerpc_arch.
-
- * aoutx.h (translate_from_native_sym_flags): Set SEC_RELOC flag
- for generated constructor section.
-
-Sun Mar 27 16:25:22 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_begin_writing): New approach at dealing with holes
- in executables left by the HP linker. Does not rely on subspace
- alignments as subspaces are *NOT* guaranteed to be properly
- aligned in an executable (can you believe that!).
-
-Sat Mar 26 10:25:43 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_get_section_contents): New function. Do not try
- to actually read data from a section that doesn't have either
- SEC_LOAD or SEC_DEBUGGING set (eg $BSS$) just return true.
-
- * libbfd.c (bfd_read): Set bfd_error as appropriate for a short
- read. (bfd_error_system_call or bfd_error_file_truncated).
-
- * som.c: Do not blindly set bfd_error_system_call after a
- failing bfd_read, bfd_write, or bfd_seek. In a few places
- (like som_object_p) override the error status set by bfd_read.
-
- * aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
- * coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
- * elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
- * nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.
-
- * som.c: Check return values from several bfd_{seek,read,write}
- calls that we just assumed were not failing.
-
-Fri Mar 25 11:44:06 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * hosts/sysv4.h (HAVE_PROCFS): Add comments about ptx4.
- * config/sysv4.mh: Add comment.
- * config/symmetry.mh: Change comment.
- * configure.host: Use sysv4, not symmetry, for i[34]86-sequent-sysv4*.
-
-Fri Mar 25 17:10:45 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Changes to support linker relaxing of embedded MIPS PIC code to
- use a five instruction sequence for function calls which are out of
- range of the bal instruction.
- * libecoff.h (struct ecoff_section_tdata): Define.
- (ecoff_section_data): Define.
- (ecoff_bfd_relax_section): Don't define.
- * ecoff.c (ecoff_final_link_debug_accumulate): Don't read or free
- the debugging information if it has already been read.
- (ecoff_indirect_link_order): Handle _cooked_size being different
- from _raw_size. Don't reread the contents or the relocs if they
- have already been read in.
- * coff-mips.c (mips_howto_table): Change bitsize of PCREL16 from
- 18 to 16.
- (PCREL16_EXPANSION_ADJUSTMENT): Define.
- (mips_relocate_refhi): Take adjust argument.
- (mips_relocate_section): Handle reloc offsets stored in section
- used_by_bfd field. Call mips_relax_pcrel16 to handle details of
- expanding an out of range PCREL16. Keep trace of adjustments
- required by expansions. Set s and unset h when converting a reloc
- from undefined to section. Change handling of PC relative relocs:
- if against a section, they are correct in the object file, if
- against an external symbol they are pcrel_offset.
- (mips_relax_section): New function.
- (mips_relax_pcrel16): New function.
- (ecoff_bfd_relax_section): Define.
- * coff-alpha.c (ecoff_bfd_relax_section): Define.
- * ecofflink.c (bfd_ecoff_debug_accumulate): Handle adjustments
- built by mips_relax_section when writing out addresses.
- * elf32-mips.c (mips_elf_read_ecoff_info): Clear adjust field.
-
- * aoutx.h (NAME(aout,find_nearest_line)): The caller expects
- functionname_ptr to be set to a symbol name, so prepend
- symbol_leading_char.
-
-Thu Mar 24 11:33:46 1994 Steve Chamberlain (sac@jonny.cygnus.com)
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Add relaxing info
- for 16bit relative branches.
- * coff-h8500.c (r_high8, r_low16, r_high16): Don't complain on
- overflow.
-
-Thu Mar 24 09:21:13 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_prep_for_ar_write): Ignore non-SOM objects.
- (som_bfd_ar_write_symbol_stuff, som_write_armap): Likewise.
-
-Wed Mar 23 14:29:31 1994 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * netbsd386.c (N_SET_FLAGS): Delete the old definition.
-
-Wed Mar 23 14:58:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Clean up the relaxing code for the new linker.
- * targets.c (_bfd_relax_section): Take boolean *again argument
- rather than asymbol list.
- * bfd.c (bfd_relax_section): Change name of fourth argument from
- symbols to again.
- * reloc.c (bfd_generic_relax_section): Take boolean *again
- argument rather than asymbol list. Always return true.
- * bout.c: Include genlink.h.
- (aligncode, perform_slip): Declare.
- (perform_slip): Take BFD argument rather than asymbol list.
- Changed all callers. Get the symbols from the BFD. Change the
- hash table entry value as well as the symbol value.
- (abs32code): Take BFD argument rather than asymbol list. Changed
- all callers.
- (aligncode): Likewise.
- (b_out_relax_section): Take boolean *again argument rather than
- asymbol list. Only return false if an error occurred. Set *again
- to false. Get symbols from BFD.
- * reloc16.c: Include genlink.h.
- (bfd_perform_slip): Take BFD argument rather than asymbol list.
- Get the symbols from the BFD. Change the hash table entry value
- as well as the symbol value.
- (bfd_coff_reloc16_relax_section): Take boolean *again argument
- rather than asymbol list. Only return false if an error occurred.
- Set *again to false. Get symbols from BFD.
- * coffcode.h (bfd_coff_backend_data): Change
- _bfd_coff_reloc16_estimate to take BFD argument rather than
- asymbol list.
- (bfd_coff_reloc16_estimate): Corresponding change.
- (dummy_reloc16_estimate): Corresponding change.
- * libcoff-in.h (bfd_coff_reloc16_relax_section): Change
- declaration to take boolean * rather than asymbol list.
- (bfd_perform_slip): Change declaration to take BFD rather than
- asymbol list.
- * coff-h8300.c (h300_reloc16_estimate): Take BFD argument rather
- than asymbol list. Changed calls to bfd_perform_slip.
- * bfd-in2.h: Rebuilt.
- * libbfd.h: Rebuilt.
- * libcoff.h: Rebuilt.
- * Makefile.in: Rebuilt dependencies.
-
- * genlink.h (_bfd_generic_link_get_symbols): Define.
- (_bfd_generic_link_get_symcount): Define.
- * linker.c (generic_link_read_symbols): New function.
- (generic_link_add_object_symbols): Use it. Use
- _bfd_generic_link_get_symbols and _bfd_generic_link_get_symcount
- to get the symbols from the BFD.
- (generic_link_check_archive_element): Likewise.
- (_bfd_generic_final_link): Likewise.
- (_bfd_generic_link_output_symbols): Likewise.
- (default_indirect_link_order): Likewise.
- (generic_link_add_symbol_list): Store pointer to hash table entry
- in asymbol udata field.
-
-Tue Mar 22 13:09:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-mips.c (mips_howto_table): Add entry for new MIPS_R_PCREL16
- reloc, used in embedded PIC code.
- (mips_adjust_reloc_in): Change sanity check to permit new reloc.
- (mips_bfd_reloc_type_lookup): Turn BFD_RELOC_16_PCREL_S2 into
- MIPS_R_PCREL16.
-
- * elf32-mips.c (mips_elf_final_link): Account for link_order
- relocs when allocating space for relocations. Set SEC_RELOC flag
- for any section which has relocs. Handle link_order relocs in
- link_order loop. Use _bfd_generic_link_add_symbols_collect for
- add_symbls entry point.
-
- * linker.c (_bfd_generic_final_link): Set reloc_count to 0 before
- counting relocs. Set SEC_RELOC flag for any section which has
- relocs.
-
- * linker.c (_bfd_default_link_order): Handle bfd_data_link_order.
-
- * linker.c (_bfd_generic_link_add_symbols): Just call
- generic_link_add_symbols.
- (_bfd_generic_link_add_symbols_collect): New function, like
- _bfd_generic_link_add_symbols but also collect constructors and
- destructors by name as collect2 does.
- (generic_link_add_symbols): New function, like old
- _bfd_generic_link_add_symbols but with collect argument.
- (generic_link_add_object_symbols): Take collect argument.
- (generic_link_check_archive_element_no_collect): New function.
- (generic_link_check_archive_element_collect): New function.
- (generic_link_check_archive_element): Take collect argument.
- (generic_link_add_symbol_list): Take collect argument.
- (_bfd_generic_link_add_one_symbol): Rename constructor argument to
- collect.
- * libbfd-in.h (_bfd_generic_link_add_symbols_collect): Declare.
- * libbfd.h: Rebuilt.
-
-Tue Mar 22 10:04:00 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * archive.c (bfd_construct_extended_name_table): Use ar_padchar
- for first character in an extended name.
- (_bfd_write_archive_contents): If ar_padchar == '/', then use
- "//" as the name of the special archive member holding the
- extended name table.
-
-Mon Mar 21 12:28:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Support for link_order types which generate relocs in order to
- support -Ur in the linker.
- * linker.c (generic_link_add_symbol_list): Remove bitsize argument
- from call to _bfd_generic_link_add_one_symbol.
- (_bfd_generic_link_add_one_symbol): Remove bitsize argument.
- Don't pass bitsize to constructor call back. Pass BFD_RELOC_CTOR
- instead of bitsize to add_to_set call back.
- (_bfd_generic_final_link): Account for link_order relocs when
- allocating space for relocations. Handle them in link_order loop.
- (_bfd_generic_reloc_link_order): New function.
- (_bfd_default_link_order): If a reloc_link_order is seen here,
- abort.
- (_bfd_count_link_order_relocs): New function.
- * libbfd-in.h (_bfd_generic_link_add_one_symbol): Remove bitsize
- argument from declaration.
- (_bfd_generic_reloc_link_order): Declare.
- (_bfd_count_link_order_relocs): Declare.
- * libbfd.h: Rebuilt.
- * aoutx.h (aout_link_add_symbols): Remove bitsize argument from
- call to _bfd_generic_link_add_one_symbol.
- (NAME(aout,final_link)): Account for link_order relocs when
- allocating space for relocations. Handle them after handling all
- input BFDs.
- (aout_link_reloc_link_order): New function.
- * ecoff.c (ecoff_link_add_externals): Remove bitsize argument from
- call to _bfd_generic_link_add_one_symbol.
- (ecoff_bfd_final_link): Account for link_order relocs when
- allocating space for relocations. Handle them in link_order loop.
- (ecoff_link_write_external): Set the storage class of a defined
- linker created symbol based on the section it is in. Correct
- bfd_link_hash_weak case to use .sc rather than .st.
- (ecoff_reloc_link_order): New function.
- * coff-alpha.c (alpha_bfd_reloc_type_lookup): Handle
- BFD_RELOC_CTOR.
- * coff-mips.c (mips_bfd_reloc_type_lookup): Likewise.
-
- * sunos.c (sunos_read_dynamic_info): Remove unused locals dynsym
- and buf.
-
- * cisco-core.c (cisco_core_file_p): Only pass one argument to
- bfd_zmalloc. Free a pointer, not a union.
- (cisco_bfd_is_local_label): Correct cast from asection to asymbol.
-
-Sun Mar 20 09:24:36 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_begin_writing): Fix thinko (off by one error).
-
- * som.c (bfd_section_from_som_symbol): Only to do the value
- comparison for function symbols within executables.
-
- * som.c (bfd_section_from_som_symbol): Renamed from
- som_section_from_subspace_index. Pass in a native SOM symbol.
- For executables, iterate through the sections to find out
- which contains the symbol's address rather than using the
- symbol_info field. (symbol_info has a different meaning for
- dynamicly linked executables.)
-
- * trad-core.c (trad_unix_core_file_p): Don't pass abfd to
- bfd_zmalloc.
-
- * som.c (som_begin_writing): Fix braino (one call to align
- space/subspace data was done unconditionally rather than
- just for executables.)
-
- * som.c (som_begin_writing): Align text in all executables to
- make HPUX kernel happy. Fixes strip/objcopy for shared
- executables.
-
-Sat Mar 19 07:06:59 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_begin_writing): Account for alignment needs of
- subspaces too when writing executables. Never request a negative
- bss size. Fixes some problems with demand paged executables,
- still having problems with pure executables and shared executables.
-
-Fri Mar 18 19:12:47 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * trad-core.c (trad_unix_core_file_p): Call bfd_zmalloc not
- bfd_zalloc for rawptr, because later on we may call free, not
- bfd_release, on it.
-
- * bfd.c (struct _bfd): Add cisco_core_struct to tdata union.
- * libbfd.c (bfd_read, bfd_seek): Add comments regarding errors.
- * cisco-core.c: New file.
- * Makefile.in: Change accordingly.
- * configure.in: Recognize cisco_core_vec.
- * config/m68k-aout.mt (SELECT_VECS): Add cisco_core_vec.
- * targets.c: Add cisco_core_vec.
- * bfd-in2.h: Rebuilt.
-
-Fri Mar 18 18:13:49 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.h (som_copyable_section_data_struct): New structure
- containing all the private section information which needs
- to be copied from input section to output section during
- objcopy or strip.
- (som_section_data_struct): Remove several fields now in
- som_copyable_section_data_struct. Make the space and
- subspace dictionaries be pointers (to save space when
- only reading objects).
-
- * som.c (bfd_som_set_section_attributes): Now returns a boolean;
- some references changed. Allocate a copyable data stucture if
- none exists. Store info into the copyable data structure.
- (bfd_som_set_subsection_attributes): Likewise.
- (som_is_space, som_is_subspace, som_is_container): New functions.
- Use these instead of directly accessing private data.
- (som_prep_headers): Allocate space and subspace headers here.
- Fill in some fields in the space/subspace headers from the
- copyable data.
- (som_bfd_copy_private_section_data): Only copy the stuff
- that we really need to make objcopy and strip work. Allocate
- the copy_data structure for the output bfd before copying.
-
- * som.h (struct som_exec_data): New structure to hold exec
- info that must be preserved when running objcopy/strip.
- (struct somdata): Add new "exec_data" field and accessor
- macro. Add some comments on how the various fields are used.
- (som_section_data_struct): Make is_space and is_subspace bitfields.
- Delete unused subspace_index. All references now use the
- target_index field within the section structure itself.
-
- * som.c (make_unique_section): Delete unused declaration.
- (som_bfd_copy_private_bfd_data): New function.
- (som_object_setup): Allocate space for and save exec information
- that needs to be copied during objcopy/strip.
- (som_mkobject): Do not allocate space for a file header here.
- It is not used when only reading SOM objects.
- (som_prep_headers): Allocate space for and attach a file header
- to the output bfd. For executables, use the saved system_id
- value rather than trying to guess the right value. Do not abort
- wwhen setting file_hdr->entry* for executables.
- (som_begin_writing): For executables, set the exec_entry and
- exec_flags fields.
- (som_copy_private_backend_section_data): Always return a value.
-
- * libhppa.h (PA_PAGESIZE): Define.
-
- * som.c (SOM_ALIGN): Define.
- (som_begin_writing): If writing an executable, initialize all
- fields in the exec header to zero. Update fields in the exec
- header as sizes of loadable subspaces are computed. Carefully
- preserve alignments when building executables. Actually write the
- exec after all the fields are filled in.
-
- * Better long-filename handling. Reads SOM ABI compliant extended
- names, but doesn't quite write compliant extended names yet.
- * som.c (som_slurp_extended_name_table): Delete function. The
- generic code will handle things correctly.
- (som_slurp_armap): Seek to the beginning of the next member.
- (normalize): New function.
- (som_bfd_ar_write_symbol_stuff): Take the size of the extended
- name table into account when computing the file offsets in the
- SOM dictionary. Make sure to align to an even boundary.
- (som_write_armap): Initialize the checksum to zero.
- (ar_maxchars): Fix. Opps.
-
-Fri Mar 18 20:35:24 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * aoutx.h (reloc_type_lookup): Handle BFD_RELOC_CTOR on a 64-bit
- machine. Handle BFD_RELOC_SPARC13 and BFD_RELOC_SPARC_BASE13.
-
-Thu Mar 17 18:26:46 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * bfd-in.h (BFD_VERSION): Use @VERSION@.
- * Makefile.in (bfd.h): Replace it with contents of VERSION file.
- * bfd-in2.h: Regenerated.
-
- * trad-core.c (trad_unix_bfd_is_local_label): Fixed typo where
- this was also named trad_unix_bfd_copy_private_bfd_data.
-
-Thu Mar 17 10:37:07 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * aoutx.h, elfcode.h, coff-alpha.c, bout.c, ecoff.c, ecofflink.c,
- elf32-hppa.c, elf32-mips.c, linker.c, som.c, sunos.c: If malloc(0)
- returns NULL, it is not an error. It's possible that some of
- these checks are not necessary (because the size can never be
- zero), but putting in the checks is the conservative thing to do
- in light of the fact that some of these malloc calls replaced
- unchecked alloca calls, in which a zero argument would work fine.
-
-Thu Mar 17 11:44:45 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * osf-core.c (osf_core_bfd_copy_private_bfd_data): Remove
- duplicate definition.
- (osf_core_bfd_is_local_label): Define.
-
- * reloc.c (bfd_generic_get_relocated_section_contents): Don't fail
- if malloc (0) fails. bfd_canonicalize_reloc returning 0 is not a
- failure indication, it merely means there are no relocs.
-
- * elfcode.h (NAME(bfd_elf,write_object_contents)): Don't use space
- after NAME, since SunOS /bin/cc can't handle it.
-
-Wed Mar 16 16:43:33 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * netbsd386.c (N_SET_FLAGS): Don't nuke the machine id field.
- From sukes@glue.umd.edu (Tasuki Hirata).
-
-Wed Mar 16 07:55:54 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * aoutf1.h (4 places): Use a simple #if on ARCH_SIZE, rather than
- all that convoluted stuff with NAME, CAT3, etc. The convoluted
- stuff broke for SunOS4 /bin/cc (due to DEFUN elimination, I guess).
-
-Wed Mar 16 00:02:05 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_prep_for_fixups): Detect section symbols based
- on either the lack of private data or the symbol flags. Do not
- munge section symbol names anymore -- they no longer confuse GDB.
- (som_begin_writing): Leave space for an exec header if writing
- an executable.
- (som_slurp_symbol_table): Recognize both forms of section symbol
- names "L$0\002" and "$<FOO>$". Change the name of "L$0\002"
- section symbols to be the name of the section they represent.
- Debugging symbols begin with "L$0\001", not just "L$".
-
-Tue Mar 15 22:58:28 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * bfd-in2.h, libbfd.h, libcoff.h: Rebuilt.
-
- * bfd-in.h (JUMP_TABLE): Add new entries to the jump table
- for bfd_copy_private_section_data, bfd_copy_private_bfd_data,
- and bfd_is_local_label.
-
- * targets.c: Add new entries to the bfd_target structure.
-
- * bfd.c (bfd_copy_private_bfd_data): New definition.
-
- * section.c (bfd_copy_private_section_data): New definition.
-
- * syms.c (bfd_is_local_label): New definition.
-
- * libbfd-in.h (bfd_generic_is_local_label): Declare.
-
- * libbfd.c (bfd_generic_is_local_label): New function.
-
- * *-core.c: Provide default definitions for new functions in
- the target vector which all point to bfd_false.
-
- * aout-target.h, coffcode.h, elf32-target.h elf64-target.h, ieee.c
- libaout.h, libecoff.h, nlm-target.h, oasys.c, srec.c, tekhex.c
- Default new vectors for copying private backend data to bfd_true.
- Default new vector for determining if a symbol is a local label
- to bfd_generic_is_local_label.
-
- * som.c (som_bfd_copy_private_section_data): New function.
- (som_bfd_is_local_label): New function.
- (som_bfd_copy_private_bfd_data): For now default to bfd_true.
-
- * elf32-hppa.c (hppa_elf_is_local_label): New function.
-
-Tue Mar 15 23:55:47 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * cf-m68klynx.c (CALC_ADDEND): Use _bfd_m68klynx_howto_table.
-
-Tue Mar 15 04:41:13 1994 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * Most files:
- Replace DEFUN and DEFUN_VOID with K&R-style function definition.
- Indent some of them to GNU standards.
-
- * aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
- cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
- elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
- libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
- Update copyright years.
-
-Mon Mar 14 11:41:23 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_prep_for_fixups): A relocation involving the section
- symbol for the *ABS* section is really a relocation involving
- no symbol.
- (som_slurp_symbol_table): Do not set BSF_GLOBAL or BSF_EXPORT for
- undefined symbols. Correctly distinguish between debugger symbols
- and section symbols.
-
- * som.c (setup_sections): Set SEC_DEBUGGING and the section attributes
- for spaces and subspaces.
-
- * som.c (som_bfd_count_ar_symbols): Fix typo.
-
- * som.c (som_object_setup): Set EXEC_P, D_PAGED, WP_TEXT, and
- HAS_RELOC based on the object's magic number.
- (make_unique_section): Delete function. BFD and its users are
- prepared to handle multiple sections with the same name.
- (setup_sections): Allocate space on the BFD's obstack to hold
- section names. Use bfd_make_setion_anyway rather than the
- obsolete make_unique_section.
- (som_prep_headers): Choose the correct SOM magic number based
- on the BFD's flags.
- (som_bfd_fill_in_ar_symbols): Return false, not NULL on error.
-
-Sat Mar 12 09:46:09 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * elf32-ppc.c: Renamed from elf32-powerpc.c.
- * nlm32-ppc.c: Renamed from nlm32-powerpc.c.
- * Makefile.in, configure.in: Corresponding changes.
-
-Fri Mar 11 22:27:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elf32-powerpc.c: Extensive changes to update to preliminary ABI.
-
-Fri Mar 11 00:34:59 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * sunos.c (sunos_read_dynamic_info): Assume that dynamic info
- is always located at the start of the data section to allow
- recovery of the dynamic info from a stripped executable.
- * ecoff.c (ecoff_styp_to_sec_flags): Handle STYP_PDATA, STYP_XDATA
- and STYP_COMMENT.
-
-Wed Mar 9 17:17:53 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * libbfd-in.h: Remove alloca cruft. It was missing some necessary
- cruft (like the #pragma alloca for AIX).
- In addition to that problem, the C alloca calls xmalloc, which
- means checking for being out of memory can't work right. The
- following changes remove all uses of alloca from BFD.
- * hosts/solaris2.h: Remove alloca cruft.
- * som.c: Replace alloca with a fixed size auto array.
- * aoutx.h, elfcode.h, nlmcode.h, bout.c, coff-alpha.c, ecoff.c,
- ecofflink.c, elf32-hppa.c, elf32-mips.c, linker.c, reloc.c, som.c,
- sunos.c: Replace alloca with malloc and appropriate error checking and
- freeing.
- * linker.c: Replace alloca with obstack_alloc.
- * libbfd.h: Rebuilt.
-
-Tue Mar 8 12:10:38 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * coff-mips.c (mips_relocate_section): Handle MIPS_R_LITERAL like
- MIPS_R_GPREL.
-
-Sat Mar 5 14:08:54 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * elf32-hppa.h, elfcode.h: Replace uses of Elf*_Half, Elf*_Word,
- Elf*_Off typedefs by their expansion, the typedefs have been
- removed from include/elf/internal.h.
- * elfcode.h (bfd_section_from_shdr): Handle SHT_DYNAMIC section like
- SHT_PROGBITS section.
-
-Thu Mar 3 20:03:39 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.h (_PA_RISC_ID): Treat HOST_HPPAOSF just like HOST_HPPABSD.
-
-Wed Mar 2 13:28:06 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
-
- * configure.host: Recognize i[34]86-sequent-*.
-
- * trad-core.c (trad_unix_core_file_p): A non-zero, not zero,
- return from bfd_seek indicates an error.
- New macro TRAD_CORE_DSIZE_INCLUDES_TSIZE to replace
- TRAD_CORE_STACK_OFFSET.
- * hosts/symmetry.h: Define TRAD_CORE_DSIZE_INCLUDES_TSIZE and
- TRAD_CORE_USER_OFFSET but not HOST_STACK_OFFSET.
-
-Wed Mar 2 11:57:03 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.[ch]: Do not include libhppa.h in som.c, instead include
- it in som.h.
-
- * elf32-hppa.[ch]: Do not include libhppa.h in elf32-hppa.c, instead
- include it in elf32-hppa.h.
-
- * som.c (log2): Return -1 on error rather than aborting.
- (setup_sections): Bubble up an error from log2.
-
- * Changes to make HP C compiler happy in both traditional
- and ANSI mode.
- * som.c (hppa_som_gen_reloc_type): Use correct enum type for
- field parameter.
- (bfd_som_set_section_attributes): Use unsigned int rather than
- unsigned char to avoid GNU-C extensions.
- (bfd_som_attach_aux_hdr): Return a boolean to indicate success
- or failure rather than aborting on failure.
-
- * som.h (bfd_som_set_section_attributes): Fix prototype to match
- som.c changes.
- (bfd_som_attach_aux_hdr): Add prototype.
- (hppa_som-gen_reloc_type): Likewise.
-
- * elf32-hppa.c: Add a couple casts to make HP compiler happy.
- (hppa_look_for_stubs_in_section): Do not return false on failure
- until rest of code is ready to handle it. Abort for now.
-
-Tue Mar 1 18:33:59 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
-
- * bfd-in2.h: Rebuilt.
-
-Tue Mar 1 13:06:53 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * i386os9k.c: use new functions bfd_set_error and bfd_get_error.
- * Makefile.in: delete an extra blank.
- * configure.in : Add i396os9k_vec.
-
-Mon Feb 28 15:41:01 1994 Kung Hsu (kung@mexican.cygnus.com)
-
- * config.bfd : Add i386-os9k.
- * config/i386-os9k.mt : Newly add os9k target makefile.
-
- * i386os9k.c : new file to handle os9k format bfd.
- * Makefile.in : Handle new file i386os9k.c
- * targets.c : Add bfd_target_os9k_flavour and i386os9k_vec.
- * cache.c : Initialize cache_sentinel to 0.
-
-Sun Feb 27 16:30:55 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c (mismatches, retval_mismatches): Fix mismatch
- action in case where caller specified no argument relocation.
- (hppa_elf_build_linker_stub): Try again to get the sym_ptr_ptr
- right in the original relocation and the stub's relocation.
-
- * elf32-hppa.h (hppa_look_for_stub_in_section): Fix typo. Delete
- unused symbols argument.
-
- * elf32-hppa.c (hppa_elf_stub_reloc): Accept asymbol ** rather
- than asymbol * for original target symbol. All callers changed.
- Set reloc->sym_ptr_ptr appropriately.
- (hppa_elf_build_linker_stub): Set reloc->sym_ptr_ptr correctly.
- (hppa_elf_look_for_stubs_in_section): No longer need symbols
- argument. Use the output symbols when canonicalizing the relocs,
- creating them if necessary.
-
- * linker.c (_bfd_generic_link_output_symbols): Do not
- rebuild/clobber the output symbols if they already exist.
-
-Sun Feb 27 15:22:36 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * targets.c (BFD_SEND, BFD_SEND_FMT): Add debugging versions that
- check all the pointer dereferences. Enabled via DEBUG_BFD_SEND.
- * bfd-in2.h: Rebuilt.
-
- * srec.c (hex_value): Always set to a size of 256 bytes.
- (srec_init): Cosmetic changes.
-
-Sun Feb 27 11:18:47 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elf32-hppa.c: Second half of major cleanup. More comments,
- PARAMize and staticize rest of functions. Delete unused
- functions. Delete unused/unnecessary arguments to some functions.
- Group static vars together. Abort for bad errors until we have
- error code propogation working. Work on spacing and indention.
- Add FIXMEs for unresolved problems. Use enums rather than
- #defines for lots of things. Merge two functions which build
- linker stubs into a single function (so they can easily share a
- ton of common code).
-
-Sat Feb 26 10:00:45 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * reloc.c (_bfd_relocate_contents): Adjust handling of overflow to
- avoid depending upon right shifts of signed numbers, and to
- correct handling of src_mask with lower bits zero.
-
- * aoutx.h, archive.c: Add casts to avoid warnings from SVR4 cc.
- * ecoff.c, ecofflink.c, ecoffswap.h, srec.c: Likewise.
- * elf32-i386.c: Likewise.
- * elfcode.h (bfd_section_from_shdr): Make i unsigned; remove old
- #if 0 code.
- (elf_write_phdrs): Make i unsigned.
- (map_program_segments): Make i and n_left unsigned.
- (assign_file_positions_except_relocs): Make i unsigned.
- (write_shdrs_and_ehdr): Make count unsigned.
- (assign_file_positions_for_relocs): Make i unsigned.
- (NAME(bfd,elf_write_object_contents)): Make count unsigned.
- (section_from_elf_index): Make index argument unsigned.
-
-Fri Feb 25 21:34:58 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * elfcode.h: Don't include assert.h.
- (swap_out_syms): Use BFD_ASSERT rather than assert.
-
- * linker.c (_bfd_generic_link_write_global_symbol): Add missing
- break in switch.
-
- * hosts/i386v4.h (qsort, strtol): Remove incorrect and useless
- declarations.
-
-Fri Feb 25 16:35:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * libhppa.h (hppa_rebuild_insn): Moved here from elf32-hppa.c.
-
- * elf32-hppa.h (elf_hppa_tc_symbol): Add new arguments.
- (elf_hppa_tc_make_sections): Likewise.
- (elf_hppa_final_processing): Add extern decl.
-
- * elf32-hppa.c: First half of major cleanup. Add/cleanup lots of
- comments. PARAMize some static functions. Delete unused functions.
- Delete unused/unnecessary arguments to many functions. Group
- static vars together. Collapse common case statements together
- in many places. Use default case when possible instead of listing
- each case separately. Abort for bad errors until we get error
- code propogation working. Work on spacing and indention problems.
- Add FIXMEs for some unresolved problems. Delete hopelessly broken
- COMPLEX relocation support (it's never used anyway).
- (hppa_elf_rebuild_insn): Delete. Moved into libhppa.h.
- (elf_hppa_tc_symbol): Accept and use new arguments (symext chains).
- (elf_hppa_tc_make_sections): Likewise.
-
- * format.c (bfd_check_format_matches): Initialize matching_vector
- to keep gcc -Wall quiet.
-
- * elfcode.h (elf_slurp_reloca_table): Fix typo.
-
- * som.c (som_get_symtab_upper_bound): Use "sizeof (asymbol *)"
- not "sizeof (som_symbol_type *)".
-
- * elfcode.h (elf_get_symtab_upper_bound): Use "sizeof (asymbol *)"
- not "sizeof (asymbol"). Opps.
-
-Fri Feb 25 13:19:04 1994 Ted Lemon (mellon@pepper.ncd.com)
-
- * bfd.c (bfd_get_gp_size): Can't return gp value on an archive.
- (bfd_set_gp_size): Can't set gp value on an archive.
-
-Fri Feb 25 12:57:00 1994 Steve Chamberlain (sac@jonny.cygnus.com)
-
- * srec.c (pass_over): Don't skip too many characters when
- end of line seen.
-
-Fri Feb 25 11:41:57 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * ecoff.c (ecoff_sizeof_headers): Align result to 16 byte
- boundary.
-
-Thu Feb 24 07:13:22 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_derive_misc_symbol_info): Derive symbol_info
- field for absolute symbols in the same manner as undefined
- and common symbols.
-
-Thu Feb 24 04:29:19 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * elfcode.h (elf_core_file_p): Check for core file e_machine match
- like in elf_object_p.
-
-Wed Feb 23 18:28:37 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elfcode.h (alloca): Delete declaration.
-
- * som.c (som_prep_headers): Use CPU_PA_RISC1_0 for magic
- number rather than HP9000S800_ID. Note som.c is careful
- to make sure CPU_PA_RISC1_0 is always defined.
-
-Mon Feb 21 10:12:02 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * Makefile.in (targets.o, archures.o): Use ALL_CFLAGS to supply
- flags to explicit compile actions.
-
-Mon Feb 21 09:50:06 1994 Ian Lance Taylor (ian@lisa.cygnus.com)
-
- * ecofflink.c (ecoff_write_symhdr): Set symhdr->magic here.
- * ecoff.c (ecoff_write_object_contents): Make sure .bss section
- ends on a page boundary if there is no symbol table.
- (ecoff_bfd_final_link): Don't set symhdr->magic here.
-
- * hosts/hp300.h: Include <stdlib.h>; don't declare free.
-
- * som.c (som_bfd_count_ar_symbols): Use a pointer and alloca
- rather than an array of variable size.
- (som_bfd_fill_in_ar_symbols): Likewise.
- (som_bfd_ar_write_symbol_stuff): Likewise.
-
- * coff-alpha.c (alpha_relocate_section): Rewrite mask and shift
- operation to avoid OSF 1.3 cc bug.
- * ecoff.c (ecoff_write_object_contents): Make text_size, data_size
- and bss_size bfd_size_type instead of unsigned long. Make
- text_start and data_start bfd_vma instead of unsigned long.
- * ecofflink.c (ecoff_add_string): Remove incorrect cast of return
- value.
-
-Sun Feb 20 16:06:54 1994 Ian Lance Taylor (ian@lisa.cygnus.com)
-
- * linker.c (_bfd_generic_link_add_archive_symbols): Consider
- symbols in the order they appear in the archive map.
-
-Sat Feb 19 03:17:32 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * coff-alpha.c (reloc_nil): Add forward declaration, add missing
- error_message argument.
- * coff-sparc.c (bfd_coff_generic_reloc): Add forward declaration,
- add missing error_message argument.
- * mipsbsd.c (mips_fix_hi16_s): Add forward declaration, add missing
- error_message argument.
-
-Fri Feb 18 11:41:58 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Support for PowerPC NetWare.
- * nlm32-powerpc.c: New file.
- * config.bfd (powerpc-*-netware*): New target; use ppc-nlm.
- * config/ppc-nlm.mt: New file.
- * configure.in (nlm32_powerpc_vec): New target vector; use
- nlm32-powerpc.o, nlm32.o, nlm.o.
- * targets.c (nlm32_powerpc_vec): Declare.
- * Makefile.in (BFD32_BACKENDS): Add nlm32-powerpc.o.
- (CFILES): Add nlm32-powerpc.c.
-
- Initial support for PowerPC ELF. Done without an ABI, and
- probably to be changed when I get an ABI.
- * config.bfd (powerpc-*-sysv4*): New target; use ppc-elf.
- * config/ppc-elf.mt: New file.
- * configure.in (bfd_elf32_powerpc_vec): New target vector; use
- elf32-powerpc.o, elf32.o, elf.o.
- * elf32-powerpc.c: New file.
- * elfcode.h (prep_headers): Add bfd_arch_powerpc case.
- (elf_set_arch_mach): Likewise.
- * targets.c (bfd_elf32_powerpc_vec): Declare.
- * Makefile.in (BFD32_BACKENDS): Add elf32-powerpc.o.
- (CFILES): Add elf32-powerpc.c.
- Rebuilt dependencies.
-
-Thu Feb 17 15:29:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coffgen.c (coff_write_linenumbers): Always return a value.
-
- * elfcode.h (elf_slurp_symbol_table): Handle zero symbols
- reasonably. Allocate x_symp using alloca.
-
- * elfcode.h (map_program_segments): ELF program header entries
- must be sorted by load address. This used to generate the entries
- in reverse order.
-
- * section.c (SEC_IN_MEMORY): Define.
- (asection): Rename unused field otheruserdata to contents, and
- make it char *.
- (bfd_make_section_anyway): Initialize contents field to NULL.
- (bfd_get_section_contents): If SEC_IN_MEMORY is set, get section
- contents from contents field rather than from file.
- * bfd-in2.h: Rebuilt.
-
-Thu Feb 17 08:30:53 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * bfd.c (bfd_get_error, bfd_set_error): New functions.
- (bfd_error): Make static.
- (bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
- all values.
- * bfd-in2.h: Regenerated.
- * aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
- aoutf1.h, aoutx.h, archive.c, archures.c,
- bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
- coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
- ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
- elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
- i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
- lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
- nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
- ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
- srec.c, sunos.c, syms.c, targets.c, tekhex.c,
- trad-core.c: Change callers.
-
-Tue Feb 15 22:27:27 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c: Remove FIXMEs for things which have been dealt with.
-
-Tue Feb 15 19:39:24 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * section.c (bfd_get_section_contents): Since this function reads
- unrelocated contents, the section's raw size is always the one to
- use for bounds checking.
-
- * linker.c (default_indirect_link_order): In assertion, compare
- link_order size field against cooked size, not raw size, of input
- section.
-
- * bout.c (b_out_get_reloc_upper_bound): For BSS section, just
- return 0.
- (aligncode): When shrinking, the addend should be set to the
- current offset in the section plus the number of bytes of padding
- that will actually be retained.
- (b_out_relax_section): If a section contains no relocations, don't
- bother processing them.
- (b_out_get_relocated_section_contents): Set reloc_done. Assert
- that bfd_get_section_contents returns true. Check that relocs are
- properly ordered.
- (b_out_get_relocated_section_contents, case ALIGNDONE): Assert
- that reloc->addend falls between the current source offset and the
- raw size of the input section.
-
- * config.bfd: Support i960 vxworks versions > 5.0 with coff, not
- bout. Default with no version number is still bout. Support
- explicit i960-coff target too.
-
- * bout.c: Changed some indentation, deleted trailing whitespace,
- fixed some comments, removed some "#if 1" lines.
- (output_addr): New macro.
- (calljx_callback, callj_callback, get_value, abs32code, aligncode,
- b_out_get_relocated_section_contents): Use it for readability.
-
-Tue Feb 15 09:00:16 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_bfd_prep_for_ar_write): Iterate through the SOM
- symbols, not the BFD symbols.
- (som_bfd_ar_write_symbol_stuff): Likewise.
-
-Mon Feb 14 22:55:20 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_slurp_symbol_table): Do not die if a BFD doesn't
- have any symbols.
-
- * Finish basic read-write support for SOM archive libraries. Bugs
- surely remain as this hasn't been tested all that much.
- * som.c (SOM_LST_HASH_SIZE, SOM_LST_MODULE_LIMIT): Define.
- (struct som_misc_symbol_info): New structure to hold info necessary
- to build both normal and library symbol tables.
- (som_derive_misc_symbol_info): New function to derive info necessary
- to build both normal and library symbol tables.
- (som_build_and_write_symbol_table): Use new function to derive misc
- symbol information.
- (som_slurp_symbol_table): Update backend private data for symbols
- appropriately.
- (som_bfd_prep_for_ar_write): New function.
- (som_bfd_ar_symbol_hash): New function.
- (som_bfd_ar_write_symbol_stuff): New function.
- (som_write_armap): Flesh out.
- (som_vec): Fix ar padding character.
-
- * som.c: Consistently use memset rather than bzero.
-
-Mon Feb 14 17:02:28 1994 Stu Grossman (grossman at cygnus.com)
-
- * coff-rs6000.c: Add Lynx core file support, use HOST_AIX, where
- appropriate.
- * rs6000-core.c: Use HOST_AIX instead of COREFILES_PLEASE.
- * config/rs6000.mh: Remove defs of ARCHIVES_PLEASE and
- COREFILES_PLEASE.
- * config/rs6000lynx.mh: Turn on Lynx core file support.
- * hosts/rs6000.h: #define HOST_AIX.
- * hosts/rs6000lynx.h: Create this to enable Lynx host support.
-
-Sun Feb 13 14:30:00 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.h (som_symbol_data): Safely access backend private data
- for BFD symbols. All callers changed.
-
- * Read-only SOM archive support.
- * som.c (som_bfd_count_ar_symbols): New helper function.
- (som_bfd_fill_in_ar_symbols): New helper function.
- (som_slurp_armap): New function to read a SOM LST.
-
- * som.h: Include <lst.h> and <ar.h>.
-
-Sat Feb 12 22:34:14 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * elfcode.h (elf_map_symbols): Fix typo.
- (write_object_contents): Check return values from prep_headers and
- elf_compute_section_file_positions.
- (set_section_contents): Likewise.
-
-Fri Feb 11 16:56:50 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * archive.c (normalize) [VMS]: Call malloc, not bfd_xmalloc.
- (bfd_construct_extended_name_table): Check result of normalize.
-
-Tue Feb 8 08:57:31 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- Make all callers of malloc or realloc (including via obstacks)
- check the result for NULL. Most set bfd_error to no_memory and
- return in that case; a few are harder to fix, and are marked
- with "FIXME <return type>".
-
- * elf32-hppa.c (hppa_elf_build_arg_reloc_stub
- hppa_elf_build_long_branch_stub): Check bfd_make_empty_symbol return.
- * linker.c (_bfd_generic_link_output_symbols
- _bfd_generic_link_write_global_symbol): Ditto
- * section.c (bfd_make_section_anyway): Ditto.
-
- * tekhex.c (find_chunk tekhex_mkobject): Check bfd_alloc.
- (first_phase): Ditto. FIXME void
- (tekhex_make_empty_symbol): Check bfd_zalloc.
-
- * sunos.c (sunos_read_dynamic_info): Check bfd_zalloc.
- (MY(read_dynamic_symbols) MY(read_dynamic_relocs)): Check bfd_alloc.
-
- * stringhash.c (_bfd_stringtab_hash_newfunc): Check bfd_hash_allocate.
-
- * srec.c: Indent.
- (fillup_symbols): Check bfd_alloc. FIXME void
- (srec_mkobject srec_get_section_contents
- srec_set_section_contents): Check bfd_alloc.
- (srec_make_empty_symbol): Check bfd_zalloc.
-
- * som.c (hppa_som_gen_reloc_type): Check bfd_alloc_by_size_t.
- (make_unique_section): Check bfd_alloc.
- (som_new_section_hook): Check bfd_zalloc.
- (bfd_som_attach_aux_hdr): Ditto. FIXME void
-
- * rs6000-core.c (rs6000coff_core_p): Check bfd_zalloc.
-
- * osf-core.c (osf_core_make_empty_symbol): Check bfd_zalloc.
- (osf_core_core_file_p): Check bfd_alloc.
-
- * oasys.c (oasys_slurp_symbol_table oasys_archive_p
- oasys_mkobject oasys_object_p oasys_new_section_hook
- oasys_set_section_contents): Check bfd_alloc.
- (oasys_slurp_section_data): Check bfd_zalloc and bfd_alloc.
- (oasys_make_empty_symbol): Check bfd_zalloc.
-
- * nlmcode.h (nlm_make_empty_symbol): Check bfd_zalloc.
- (nlm_slurp_symbol_table): Check bfd_zalloc and bfd_alloc.
-
- * nlm32-sparc.c (nlm_sparc_read_import): Check bfd_alloc.
-
- * nlm32-i386.c (nlm_i386_read_import): Check bfd_alloc.
-
- * nlm32-alpha.c (nlm_alpha_read_import): Check bfd_alloc.
-
- * linker.c (_bfd_link_hash_newfunc
- (generic_link_hash_newfunc
- (archive_hash_newfunc
- (_bfd_generic_link_add_one_symbol): Check bfd_hash_allocate.
- (_bfd_generic_final_link
- (_bfd_generic_link_output_symbols
- (default_indirect_link_order): Check bfd_alloc.
- (bfd_new_link_order): Check bfd_alloc_by_size_t.
-
- * irix-core.c (irix_core_make_empty_symbol): Check bfd_zalloc.
-
- * ieee.c: Indent.
- (read_id get_symbol get_section_entry ieee_archive_p ieee_object_p
- ieee_slurp_section_data ieee_new_section_hook): Check bfd_alloc.
- (do_one): Check bfd_alloc. Return a boolean.
- (ieee_slurp_section_data): Check it.
- (init_for_output): Check bfd_alloc. Return a boolean.
- (ieee_set_section_contents): Check it.
- (do_with_relocs): Check bfd_alloc. Return a boolean.
- (ieee_bfd_debug_info_accumulate): Ditto. FIXME void.
- (ieee_mkobject): Check bfd_zalloc.
- (ieee_make_empty_symbol): Check bfd_zmalloc.
-
- * hpux-core.c (hpux_core_make_empty_symbol): Check
- bfd_zalloc.
-
- * hppabsd-core.c (hppabsd_core_make_empty_symbol): Check
- bfd_zalloc.
- (hppabsd_core_core_file_p): Check bfd_zalloc.
-
- * hp300hpux.c (MY(slurp_symbol_table)): Check bfd_alloc.
-
- * elfcode.h (elf_new_section_hook): Check bfd_alloc.
- (bfd_section_from_phdr): Ditto.
- (write_relocs): Ditto. FIXME void
- (elf_map_symbols assign_section_numbers map_program_segments):
- Ditto. Return a boolean.
- (swap_out_syms): Ditto. Check elf_map_symbols.
- (elf_slurp_symbol_table): Check bfd_zalloc.
- (elf_slurp_reloca_table): Check bfd_alloc.
- (elf_slurp_reloc_table): Ditto.
- (elf_compute_section_file_positions): Check assign_section_numbers.
- (assign_file_positions_except_relocs): Return a boolean.
- Check map_program_segments.
- (elf_compute_section_file_positions): Check it.
-
- * elf32-mips.c (mips_elf_final_link): Check bfd_alloc.
-
- * elf32-hppa.c (hppa_elf_stub_branch_reloc): Check bfd_zmalloc and
- realloc.
- (hppa_elf_stub_reloc): Ditto.
- (hppa_elf_build_arg_reloc_stub): Check bfd_zalloc.
- (hppa_elf_build_long_branch_stub): Ditto.
- (elf32_hppa_backend_symbol_table_processing): Ditto.
-
- * ecoff.c (ecoff_set_symbol_info): Check bfd_alloc. Return a boolean.
- (ecoff_slurp_symbol_table): Check it.
- (ecoff_slurp_armap): Check bfd_alloc.
- (ecoff_write_armap): Check bfd_zalloc.
- (ecoff_link_hash_newfunc): Check bfd_hash_allocate and
- _bfd_link_hash_newfunc.
- (ecoff_link_add_externals): Check bfd_alloc.
-
- * ctor.c (bfd_constructor_entry): Check bfd_alloc.
-
- * coffgen.c (coff_real_object_p): Check bfd_alloc.
- (coff_renumber_symbols): Check bfd_alloc_by_size_t. Return a boolean.
- (coff_write_symbol): Check bfd_alloc. FIXME int
- (coff_write_linenumbers): Check bfd_alloc. Return a boolean.
- (coff_section_symbol): Check bfd_alloc_by_size_t.
- (coff_get_normalized_symtab): Check bfd_alloc.
- (coff_bfd_make_debug_symbol): Check bfd_zalloc.
- * libcoff-in.h: Change decls of coff_renumber_symbols,
- coff_write_linenumbers.
- * libcoff.h: Rebuilt.
- * coffcode.h (coff_write_object_contents): Check
- coff_renumber_symbols, coff_write_linenumbers.
-
- * coffcode.h: Indent.
- (coff_add_missing_symbols): Check bfd_alloc_by_size_t. Return a
- boolean.
- (coff_write_object_contents): Check it.
-
- * coff-alpha.c (alpha_relocate_section): Check bfd_alloc.
- * coff-mips.c (mips_relocate_section): Ditto.
-
- * archive.c (bfd_slurp_bsd_armap_f2): Check bfd_alloc value.
- (do_slurp_bsd_armap): Ditto.
- (compute_and_write_armap): Check bfd_realloc value.
-
- * aoutx.h (translate_from_native_sym_flags): Check bfd_alloc
- return value. Return boolean value.
- (NAME(aout,make_empty_symbol)): Check bfd_zalloc return value.
- (NAME(aout,slurp_symbol_table)): Check bf_alloc and bfd_zalloc
- return value.
- (add_to_stringtab): Ditto. FIXME void
- (aout_link_hash_newfunc): Check bfd_hash_allocate return value.
- (aout_link_add_symbols): Check bfd_alloc value.
- (translate_symbol_table): Check translate_from_native_sym_flags.
- * hp300hpux.c (MY(slurp_symbol_table)): Ditto.
- * aoutx.h (aout_link_hash_newfunc): Check _bfd_link_hash_newfunc.
-
- * opncls.c (bfd_zalloc bfd_realloc): Check result of bfd_alloc.
-
- * opncls.c (obstack_chunk_alloc): Define as malloc, not
- bfd_xmalloc_by_size_t.
- (_bfd_new_bfd): Check obstack_begin for 0 return.
-
- * ieee.c (obstack_chunk_alloc): Define as malloc, not
- bfd_xmalloc_by_size_t.
- (ieee_archive_p): Check obstack_begin for 0 return and
- obstack_finish for NULL return.
-
- * hash.c (obstack_chunk_alloc): Define as malloc, not
- bfd_xmalloc_by_size_t.
- (bfd_hash_table_init_n): Check obstack_begin for 0 return and
- obstack_finish for NULL return.
- (bfd_hash_lookup): Check obstack_alloc for NULL return.
-
- * ecofflink.c (obstack_chunk_alloc): Define as malloc, not
- bfd_xmalloc_by_size_t.
- bfd_ecoff_debug_accumulate
- bfd_ecoff_debug_accumulate_other): Check obstack_alloc.
- (add_file_shuffle add_memory_shuffle): Check obstack_alloc for
- NULL return. Return boolean, not void.
- (bfd_ecoff_debug_init): Check obstack_begin for 0 return.
- (bfd_ecoff_debug_accumulate): Check add_file_shuffle
- and add_memory_shuffle return.
- (string_hash_newfunc): Check bfd_hash_allocate and bfd_hash_newfunc.
- (bfd_ecoff_debug_accumulate): Check bfd_alloc.
- (ecoff_add_string): Check add_memory_shuffle return.
-
- * libbfd-in.h (xmalloc, bfd_xmalloc, bfd_xmalloc_by_size_t):
- Remove decls.
- * libbfd.h: Rebuilt.
-
-Fri Feb 11 15:35:32 1994 Stu Grossman (grossman at cygnus.com)
-
- * configure.host: Add Lynx/rs6000 support.
- * config/i386-nlm.mt: Enable a.out file support.
- * config/rs6000lynx.mh: Lynx/rs6000 host support.
-
-Fri Feb 11 17:25:58 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * archive.c (compute_and_write_armap): Rewrite somewhat to improve
- memory usage.
-
-Fri Feb 11 13:10:42 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * archive.c: Change all references to '\n' in archive magic
- to '\012', for greater portability.
- * ecoff.c (ecoff_write_armap): Ditto.
-
-Thu Feb 10 12:58:48 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (aout_link_write_other_symbol): Check strip settings to
- see whether symbol should be output.
- * genlink.h (struct generic_write_global_symbol_info): Added info
- field.
- * linker.c (_bfd_generic_final_link): Initialize wginfo.info.
- (_bfd_generic_link_write_global_symbol): Check strip settings to
- see whether symbol should be output.
- * elf32-mips.c (mips_elf_final_link): Initialize wginfo.info.
-
-Wed Feb 9 21:34:58 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_reloc_queue_find): Do not examine a NULL queue entry.
-
- * som.c: Cast return values from BFD memory allocation routines to
- avoid warnings from the HP compiler.
-
-Wed Feb 9 12:55:02 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-alpha.c (alpha_relocate_section): Accept a LITERAL
- reloc on an "ldl" instruction too.
-
- * archive.c (bfd_ar_hdr_from_filesystem): Cast status elements
- when passing them to sprintf. Use %ld instead of %d.
-
- * coff-rs6000.c (rs6000coff_mkarchive): Return false.
- (rs6000_coff_snarf_ar_hdr): Don't declare errno; it's not used.
- Also removed unused variable namelen.
- (rs6000coff_write_armap): Declare orl_count and stridx parameters.
-
-Tue Feb 8 18:00:34 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * libbfd-in.h (xmalloc): Don't declare parameter type, to avoid
- conflicts.
- * libbfd.h: Rebuilt.
-
-Tue Feb 8 15:55:50 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * coff-alpha.c (reloc_nil): New function.
- (alpha_howto_table): Use it as special_function to prevent certain
- relocs from being adjusted by bfd_perform_relocation. IGNORE
- reloc should be partial_inplace.
- (alpha_ecoff_get_relocated_section_contents): Accept a LITERAL
- reloc on an "ldl" instruction too.
-
-Tue Feb 8 00:32:28 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * elf32-hppa.c (CURRENT_STUB_OFFSET, hppa_elf_build_arg_reloc_stub,
- hppa_elf_build_long_branch_stub): Cast to char * instead of int
- before performing pointer arithmetic.
-
-Mon Feb 7 20:56:27 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * config.bfd (hppa*-*-osf*): Use bfd_name hppaosf for this
- configuration.
- (hppa*-*-*elf*): This configuration used hppa-elf now.
-
- * som.c: This file is also used for HOST_HPPAOSF.
-
- * targets.c (bfd_target_vector): Enable som_vec for HOST_HPPAOSF.
-
- * hosts/hppaosf.h: New host configuration file.
-
- * config/hppabsd.mt (SELECT_VECS): Add bfd_elf32_hppa_vec as
- BSD handles both SOM and ELF object files.
-
- * config/hppaosf.mh (HDEFINES): Delete. No longer needed.
- (RANLIB): Doesn't do anything, define it to be "echo".
-
- * config/hppaosf.mt: New target makefile fragment for a PA running
- OSF1.
-
-Mon Feb 7 15:02:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * archures.c (enum bfd_architecture): Added bfd_arch_powerpc.
- (archures_init_table): If SELECT_ARCHITECTURES is not defined,
- added bfd_powerpc_arch.
- * bfd-in2.h: Rebuilt.
- * cpu-powerpc.c: New file.
- * Makefile.in (ALL_MACHINES, CFILES): Added cpu-powerpc.c.
- Rebuilt dependencies.
-
- * elfcode.h (bfd_section_from_shdr): Get vma and alignment_power
- of an SHT_STRTAB section from sh_addr and sh_addralign, rather
- than just setting them to zero.
-
-Sun Feb 6 20:04:10 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * elfcode.h (prep_headers, swap_out_syms): Check for NULL return
- from bfd_new_strtab.
- (elf_compute_section_file_positions): Check for false return from
- swap_out_syms.
-
- * linker.c (default_indirect_link_order): Check for NULL return
- from bfd_get_relocated_section_contents.
-
- * syms.c: Make example application in doc call xmalloc, not
- bfd_xmalloc.
-
- * aoutx.h (NAME(aout,slurp_symbol_table),
- aout_link_get_symbols, NAME(aout,link_hash_table_create)):
- * bout.c (b_out_slurp_reloc_table, b_out_squirt_out_relocs):
- * ecoff.c (ecoff_bfd_link_hash_table_create):
- * ecofflink.c (bfd_ecoff_debug_init):
- * format.c (bfd_check_format_matches):
- * linker.c (_bfd_generic_link_hash_table_create):
- (_bfd_generic_final_link):
- * reloc16.c (bfd_coff_reloc16_relax_section):
- (bfd_coff_reloc16_get_relocated_section_contents):
- * elf32-hppa.c (hppa_elf_build_arg_reloc_stub):
- * elf32-mips.c (mips_elf_final_link):
- * elfcode.h (bfd_new_strtab):
- (bfd_add_2_to_strtab):
- (elf_slurp_symbol_table):
- (elf_corefile_note):
- * libbfd.c (bfd_zmalloc):
- Use malloc and check the result, instead of bfd_xmalloc.
-
-Sat Feb 5 12:39:28 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.bfd: Put m68*-*-sysv* line after m68*-*-sysv4*.
-
-Sat Feb 5 05:32:44 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * srec.c (srec_write_record): Put CONST keyword for "src" before
- "unsigned", some compilers don't like it after "unsigned".
- * libcoff.h, libcoff-in.h (bfd_perform_slip): Rename "value" to
- "val" in prototype declaration because some compilers don't like
- arguments whose names are the same as types.
-
-Sat Feb 5 01:14:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (aout_link_check_ar_symbols): Correct test for whether
- object file defines symbol. Also, if skipping a symbol, skip the
- second symbol of a N_WARNING or N_INDR symbol as well.
-
-Fri Feb 4 23:55:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- Add basic support for writing RS/6000 XCOFF files.
- * coff-rs6000.c (dummy_reloc): Removed.
- (rs6000coff_howto_table): Defined XCOFF relocs.
- (RTYPE2HOWTO): Defined to use rs6000coff_rtype2howto.
- (rs6000coff_rtype2howto): New function.
- (coff_bfd_reloc_type_lookup): Defined to use
- rs6000coff_reloc_type_lookup.
- (rs6000coff_reloc_type_lookup): New function.
- (SELECT_RELOC): Defined to set r_type and r_size fields.
- (COFF_LONG_FILENAMES): Defined.
- * coffcode.h (combined_entry_type): Changed fix_tag and fix_end
- fields to bitfields. Added fields fix_value and fix_scnlen.
- (sec_to_styp_flags): If STYP_DEBUG is defined, use it rather than
- STYP_INFO for the type of a section named .debug.
- (coff_add_missing_symbols): Don't define if RS6000COFF_C.
- (coff_write_object_contents): If RS6000COFF_C, don't call
- coff_add_missing_symbols.
- (coff_slurp_symbol_table): If RS6000COFF_C, then if the last aux
- entry has type STY_LD change the x_scnlen into a pointer to a
- symbol and set fix_scnlen. Also, for a C_BSTAT symbol, change the
- value into a pointer to a symbol and set fix_value.
- * libcoff.h: Rebuilt.
- * coffgen.c (coff_mangle_symbols): Reindent. If fix_value is set,
- get the symbol offset. Likewise for fix_scnlen.
- (string_size): Change type to bfd_size_type.
- (debug_string_size, debug_string_section): New static variables.
- (coff_fix_symbol_name): If bfd_coff_symname_in_debug returns true,
- write the symbol name into the .debug section; assume that the
- section has already been created with the right size.
- (coff_write_symbols): Initialize debug_string_size to 0. If
- bfd_coff_symname_in_debug returns true, don't put symbol name in
- usual string table. After writing out all symbols, if
- debug_string_size is not 0, check that it matches the size of the
- .debug section.
- (coff_get_normalized_symtab): Clear new fix_value and fix_scnlen
- fields. If the string offset is 0, always use an empty string as
- the name.
- (coff_make_empty_symbol): Zero out the symbol structure.
- * reloc.c (bfd_perform_relocation): Work around one gross hack
- with another: actually look at the target name to avoid the broken
- COFF check.
- (bfd_reloc_code_real_type): Add BFD_RELOC_PPC_B26,
- BFD_RELOC_PPC_BA26 and BFD_RELOC_PPC_TOC16.
- * bfd-in2.h: Rebuilt.
-
-Fri Feb 4 17:28:32 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * libbfd.c (bfd_zmalloc): Call bfd_xmalloc instead of malloc.
- (bfd_xmalloc, bfd_xmalloc_by_size_t): Functions deleted.
- * libbfd-in.h: Define them as macros calling xmalloc and declare
- xmalloc.
- * libbfd.h: Rebuilt.
-
-Thu Feb 3 16:49:35 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecofflink.c (bfd_ecoff_debug_externals): If a small undefined
- symbol has a value in the ECOFF symbol but not in the BFD symbol,
- keep the value in the ECOFF symbol. This helps gas.
-
- * linker.c (_bfd_generic_link_output_symbols,
- _bfd_generic_link_write_global_symbol): Don't require that all
- references to a common symbol be themselves common symbols.
-
- * aoutx.h (aout_reloc_index_to_section): Handle N_UNDF.
-
-Wed Feb 2 20:37:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * libbfd.c, bfd-in.h, hosts/alphaosf.h, hosts/sparc-ll.h, aoutf1.h,
- sparclynx.c, Makefile.in: Change HOST_64_BIT to BFD_HOST_64_BIT.
- * bfd-in2.h: Rebuilt.
-
-Wed Feb 2 12:30:13 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coffswap.h (coff_swap_reloc_out): If RS6000COFF_C, handle type
- and size correctly.
- (coff_swap_aux_in): If RS6000COFF_C, change x_csect.x_scnlen to
- x_csect.x_scnlen.l to match change in coff/internal.h.
- (coff_swap_aux_out): Likewise.
-
- * coff-mips.c (mips_ecoff_backend_data), coff-alpha.c
- (alpha_ecoff_backend_data): Change casts of aux_in and aux_out
- fields to match yesterday's changes.
-
- * coffcode.h (coff_write_relocs): If SELECT_RELOC is defined, pass
- in the internal_reloc itself, not the type.
- * coff-apollo.c, coff-h8300.c, coff-h8500.c, coff-i386.c,
- coff-m68k.c, coff-sh.c, coff-we32k.c, coff-z8k.c: Changed
- definition of SELECT_RELOC accordingly.
-
-Tue Feb 1 12:05:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coffcode.h (bfd_coff_backend_data): Added new arguments to
- _bfd_coff_swap_aux_in and _bfd_coff_swap_aux_out: aux index number
- and number of aux entries.
- (bfd_coff_swap_aux_in, bfd_coff_swap_aux_out): Changed
- accordingly.
- * libcoff.h: Rebuilt.
- * coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Accept new
- arguments. If RS6000COFF_C, only treat C_EXT and C_HIDEXT
- specially if this is the last aux entry.
- * coffgen.c (coff_write_symbol, coff_get_normalized_symtab): Pass
- new arguments to swap_aux functions.
-
-Sun Jan 30 15:14:36 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * gen-aout.c (main): Set DEFAULT_ARCH based on preprocessor macros
- (only testing for m68k and vax at the moment); do verify that the
- preprocessor didn't trash the arch name inside the string version.
- Don't print out "pagesize =" line that prevents output from
- compiling. Derive BYTES_IN_WORD and ARCH values from sizeof
- results.
- * Makefile.in (aout-params.h): Pass gen-aout a dummy target name.
- (check, installcheck): Identify directory in "no testsuites"
- message.
-
-Sun Jan 30 13:25:28 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (aout_link_write_symbols): Write out correct value for
- object file symbol.
-
-Fri Jan 28 18:34:05 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * hosts/vaxbsd.h (HOST_STACK_END_ADDR): Vax BSD doesn't define
- KERNBASE, so hard-code 0x80000000 instead.
-
-Thu Jan 27 13:54:08 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * linker.c (generic_link_add_symbol_list): If symbol is common,
- set the BSF_OLD_COMMON flag.
-
-Wed Jan 26 13:47:15 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * format.c (bfd_check_format_matches): Put the new entry in the
- correct element of matching_vector.
-
-Tue Jan 25 11:43:28 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * som.c, som.h (bfd_som_set_section_attributes,
- bfd_som_set_subsection_attributes): Change parameters from char
- to int. Following a prototype with an old-style function definition
- in the presence of widened parameters is a GCC-ism not supported
- by the HP compiler in ANSI mode.
-
-Tue Jan 25 11:46:46 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * reloc.c (bfd_get_reloc_size): Size of type -2 is 4 bytes, not 2.
-
- * hp300hpux.c (MY(write_object_contents)): Write out the symbols
- before writing out the relocs, so that the right symbol indices
- are used.
-
- * archive.c (do_slurp_bsd_armap, bfd_slurp_bsd_armap_f2): Do not
- try to overlay the internal carsyms on the external symdefs. That
- can not work if the size of a host pointer is larger than 4 bytes.
-
- * format.c (bfd_check_format_matches): Cast result of
- bfd_xmalloc_by_size_t.
- * opncls.c (_bfd_new_bfd): Avoid ANSI C prototype.
-
- * archive.c: Reindented to GNU standards.
-
-Mon Jan 24 14:41:23 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * opncls.c (_bfd_new_bfd, _bfd_new_bfd_contained_in): Add
- "_bfd_" to function names.
- * archive.c (_bfd_create_empty_archive_element_shell),
- libbfd-in.h: Change callers.
-
- * libbfd.c (bfd_zmalloc): Renamed from zalloc.
- * libbfd.c (bfd_add_to_string_table),
- trad-core.c (trad_unix_core_file_p),
- targets.c (bfd_target_list),
- ptrace-core.c (ptrace_unix_core_file_p),
- opncls.c (new_bfd), libbfd-in.h,
- ieee.c (ieee_make_empty_symbol),
- elf32-hppa.c (hppa_elf_stub_branch_reloc),
- (hppa_elf_stub_reloc): Change callers.
- * libbfd.h: Regenerated.
-
- * archive.c (_bfd_look_for_bfd_in_cache): Add "_bfd_" to name.
- (_bfd_get_elt_at_filepos),
- coff-rs6000.c (rs6000coff_get_elt_at_filepos), libbfd-in.h:
- Change callers.
-
- * format.c (bfd_check_format_matches), libbfd-in.h, targets.c,
- elfcode.h (elf_object_p): Rename target_vector to bfd_target_vector
- and default_vector to bfd_default_vector.
- * libbfd.h: Regenerated.
-
- * format.c (bfd_check_format_matches): New function.
- (bfd_check_format): Call it.
- (bfd_matching_formats): Function removed.
- * targets.c: Replace the vector added on Jan 21 with a count of
- entries in default_vector.
- * bfd-in2.h: Regenerated.
-
-Mon Jan 24 12:38:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * coff-alpha.c (alpha_ecoff_object_p): New function. Set size of
- .pdata section based on lnnoptr field, not section header.
- (alpha_relocate_section): Don't bother to check if r_symndx >= 0,
- since it is unsigned.
- (ecoffalpha_little_vec): Use alpha_ecoff_object_p rather than
- coff_object_p.
- * ecoff.c (ecoff_new_section_hook): Set alignment_power field of
- .pdata section to 3.
- (ecoff_compute_section_file_positions): Save the size of the
- .pdata section in the line_filepos field, and actually align the
- .pdata section to an alignment power of 4.
- (ecoff_compute_reloc_file_positions): Set output_has_begun after
- calling ecoff_compute_section_file_positions.
- (ecoff_write_object_contents): Set s_lnnoptr for the .pdata
- section from the line_filepos field. Set vstamp for the optional
- header from the vstamp of the symbolic header.
- (ecoff_bfd_final_link): Set vstamp of the symbolic header to the
- vstamp used by the first object file in the link.
-
- * ecofflink.c (ecoff_align_debug): Align RFDs to debug_align.
-
- * linker.c (generic_link_check_achive_element): Set SEC_ALLOC flag
- for a created common section.
- (_bfd_generic_link_add_one_symbol): Likewise.
-
- * elfcode.h (swap_out_syms): Use elf_section_from_bfd_section to
- get the index of a common section, rather than always using
- SHN_COMMON (MIPS has multiple common sections).
-
- * elf32-hppa.c (hppa_elf_gen_reloc_type): Typo (== for =).
-
- * aoutx.h (aout_link_input_section_std,
- aout_link_input_section_ext): Pass additional arguments to
- reloc_overflow callback.
- * coff-alpha.c (alpha_ecoff_get_relocated_section_contents,
- alpha_relocat_section): Likewise.
- * coff-h8300.c (h8300_reloc16_extra_cases): Likewise.
- * coff-h8500.c (extra_case): Likewise.
- * coff-mips.c (mips_relocate_section): Likewise.
- * coff-z8k.c (extra_case): Likewise.
- * elf32-hppa.c (hppa_elf_stub_finish): Likewise.
- * reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
-
- * bout.c (calljx_callback, callj_callback): Use get_value to get
- the symbol value and check for undefined symbols.
- (get_value): If the symbol is undefined, look it up in the linker
- hash table.
- (b_out_get_relocated_section_contents): For PCREL24 and PCREL13
- use get_value to get the symbol value and check for undefined
- symbols.
- * reloc16.c (bfd_coff_reloc16_get_value): If the symbol is
- undefined, look it up in the linker hash table.
-
- * aoutx.h (translate_symbol_table): The string index 0 has a
- special meaning for normal symbols, but not for dynamic symbols.
-
-Sat Jan 22 12:26:01 1994 Stu Grossman (grossman at cygnus.com)
-
- * sparclynx.c: Setup appropriate macros to enable core file
- support.
-
-Fri Jan 21 16:25:35 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * targets.c: Add a vector of matching format names.
- * format.c (bfd_matching_formats): New function to return it.
- (bfd_check_format): Set it.
- * bfd-in2.h: Regenerated.
-
- * bfd-in.h: Remove decls of bfd_ec type and error printing functions.
- Remove decl of type symclass; wasn't used.
- * bfd.c: Document error handling, including code fragments
- containing the error decls that were in bfd-in.h.
- Remove DEFUNs.
- * bfd-in2.h: Regenerated.
-
-Fri Jan 21 14:11:16 1994 Sean Fagan (sef@cygnus.com)
-
- * nlmcode.h, liblnm.h, nlm32-alpha.c nlm32-i386.c nlm32-sparc.c:
- The sparc (and possibly other?) NLM format requires a different
- way to write exports, so add a write_export field to the backend
- data (and set it to NULL for everything but the sparc).
-
-Fri Jan 21 14:11:16 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * sunos.c (MY(read_dynamic_relocs)): Compare info->dynrel with NULL,
- not (struct external_nlist *) NULL. info->dynrel is a PTR, not
- a struct external_nlist *.
-
-Fri Jan 21 09:29:01 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * bfd.c: Remove error strings for errors removed below.
- * aoutx.h (translate_to_native_sym_flags), bfd-in.h (bfd_ec),
- oasys.c (oasys_write_sections): Rename
- bfd_error_nonrepresentable_section to nonrepresentable_section.
- None of the other bfd error names start with "bfd_error".
- Remove errors symbol_not_found and no_relocation_info, which seem
- to be unused.
- * bfd-in2.h: Regenerated.
-
-Fri Jan 21 01:11:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd.c (bfd_get_gp_size): Added support for ELF.
-
- * syms.c (BSF_DYNAMIC): New symbol flag.
- (bfd_print_symbol_vandf): Print it.
- * bfd-in2.h: Rebuilt.
- * libaout.h (struct aout_backend_data): New read_dynamic_symbols
- and read_dynamic_relocs fields.
- (struct aoutdata): New dynamic_info field.
- (obj_aout_dynamic_info): New accessor macro.
- * sunos.c (struct sunos_dynamic_info): New structure.
- (sunos_read_dynamic_info, MY(read_dynamic_symbols),
- MY(read_dynamic_relocs)): New functions to read dynamic symbols
- and relocs.
- * aoutx.h (NAME(aout,some_aout_object_p)): If the object is
- dynamically linked, set SEC_RELOC for both the .text and .data
- sections.
- (translate_from_native_sym_flags): Don't set BSF_LOCAL for an
- undefined symbol.
- (translate_symbol_table): New function, split out of
- slurp_symbol_table; set the BSF_DYNAMIC flag appropriately.
- (NAME(aout,slurp_symbol_table)): Read dynamic symbols, if any.
- (NAME(aout,slurp_reloc_table)): Read dynamic relocs, if any.
- (NAME(aout,get_reloc_upper_bound)): Include dynamic reloc count in
- return value.
- * aoutf1.h (NAME(aout,sunos4_write_object_contents)): Don't write
- out dynamic symbols or relocs against reloc symbols, since they
- are already in the .text section and we wouldn't know where to
- write them anyhow.
- (sunos4_aout_backend): Initialize read_dynamic_symbols and
- read_dynamic_relocs fields.
- * aout-target.h (MY(backend_data)): Initialize
- read_dynamic_symbols and read_dynamic_relocs fields.
-
-Thu Jan 20 20:57:27 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * hosts/alphaosf.h (uint64e_type, uint64_type, int64_type): Delete
- typedefs, since HOST_64_BIT will take care of defining them in
- bfd.h.
-
-Wed Jan 19 17:28:59 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * config/alphaosf.mh (HDEFINES): Don't define HOST_64_BIT here;
- that's dealt with elsewhere.
- * hosts/alphaosf.h (sprintf_vma, fprintf_vma): New macros.
- (uint64_typeHIGH, uint64_typeLOW): Comment with HOST_64_BIT so
- they get copied to bfd.h.
-
- * reloc.c (enum bfd_reloc_code_real): Add some Alpha relocation
- types. Reorganized some of the existing ones.
- * coff-alpha.c (alpha_howto_table): Construct 64-bit negative one
- values in case of compilation on a 32-bit machine. Fix pcrel
- fields of some reloc types.
- (alpha_bfd_reloc_type_lookup): Handle more relocation types.
-
- * bfd-in.h (uint64_typeHIGH, uint64_typeLOW): Supply default
- definitions when not defined, regardless of whether uint64_type is
- a defined macro or not.
- (fprintf_vma, sprintf_vma): Define only if fprintf_vma is not
- already defined.
-
-Wed Jan 19 00:02:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (translate_to_native_sym_flags): Set the type of a
- BSF_WARNING symbol to N_WARNING.
-
-Tue Jan 18 16:43:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (aout_link_add_symbols): Increment sym_hash as well as p
- for an indirect or warning symbol.
- (aout_link_write_symbols): Update sym_hash with the target of an
- indirect or warning symbol. If an indirect symbol is defined,
- output the calculated value and don't output the target symbol.
-
-Tue Jan 18 03:54:59 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h (translate_from_native_sym_flags): Give warning symbols
- an (unused) nonzero section value, needed for check below.
-
-Mon Jan 17 15:12:07 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h (translate_from_native_sym_flags,
- aout_link_add_symbols): Treat N_SET[ABDT] | N_EXT like
- N_SET[ABDT].
-
-Fri Jan 14 16:45:43 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * elfcode.h (elf_object_p): If there is a SHT_DYNAMIC section, set
- the DYNAMIC flag for the BFD.
- (NAME(bfd_elf,write_object_contents)): Don't try to write out a
- BFD with the DYNAMIC flag set, since we don't generate the program
- header table correctly.
-
-Fri Jan 14 01:04:36 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * elfcode.h (elf_slurp_symbol_table): Free x_symp at the end
- of the function to avoid storage leak.
-
-Thu Jan 13 23:07:32 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_link_write_external): An ifd can be -1.
-
-Thu Jan 13 12:33:27 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (som_set_reloc_info): Provide a default symbol for
- relocations which don't actually have an associated symbol.
-
- * som.c (hppa_som_reloc): Add new "error message" argument.
-
-Wed Jan 12 13:36:43 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- Enable gdb to write to core files on more core file readers.
- * libbfd.c (bfd_generic_set_section_contents): Remove range check
- for section size, it is already done in bfd_set_section_contents
- with bfd_get_section_size_now.
- * aix386-core.c, hppabsd-core.c, hpux-core.c, irix-core.c,
- osf-core.c, ptrace-core.c, trad-core.c (*_set_section_contents):
- Use bfd_generic_set_section_contents instead of bfd_false.
-
-Wed Jan 12 15:31:57 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * linker.c: Added initial documentation.
-
- * linker.c (default_indirect_link_order): Don't expect space for
- output relocations if there aren't any input relocations.
-
-Tue Jan 11 14:37:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * aoutx.h (NAME(aout,final_link)): Set a_entry before computing
- file offsets.
-
- * elfcode.h (swap_out_syms): A common symbol is STT_OBJECT, not
- STT_NOTYPE.
-
-Tue Jan 11 09:10:56 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * config.bfd: Use ELF, not COFF for m88*-*-dgux*.
- Combine m88k-*-* and m88110-*-* cases into m88*-*-*.
-
-Tue Jan 11 00:07:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecofflink.c: Extensive changes to compress and merge debugging
- information, and to write some of out directly rather than saving
- it in memory. Several new functions and structures, and new
- arguments to existing functions.
- * ecoff.c (ecoff_compute_reloc_file_positions): Compute
- sym_filepos as well.
- (ecoff_get_extr): Use ifdmap instead of ifdbase.
- (ecoff_write_object_contents): Don't compute sym_filepos here.
- Only output symbols if outsymbols is not NULL.
- (ecoff_bfd_final_link): Adjust for changes in ecoff_debug_info and
- bfd_ecoff_debug functions. Write out debugging information here.
- (ecoff_final_link_debug_accumulate): Adjust for changes in
- bfd_ecoff_debug functions.
- (ecoff_link_write_external): Use ifdmap rather than ifdbase.
- * elf32-mips.c (mips_elf_read_ecoff_info): Read external symbols
- first, to put them in the first memory buffer. Clear fdr field.
- (mips_elf_get_extr): Use pointer to unswapped external symbol.
- (mips_elf_final_link): Adjust for changes in bfd_ecoff functions.
- Preserve .text, .data and .bss even if they are empty. Save
- pointer to unswapped external symbol rather than copying it.
- Don't free up the external symbols.
- * libelf.h (elf_symbol_type): Change mips_extr to PTR.
- * bfd-in.h (bfd_ecoff_debug_init, bfd_ecoff_debug_free): Declare.
- (bfd_ecoff_debug_accumulate): Update declaration.
- (bfd_ecoff_debug_accumulate_other): Rename declaration from
- bfd_ecoff_debug_link_other and update.
- (bfd_ecoff_write_accumulated_debug): Declare.
- * bfd-in2.h: Rebuilt.
- * Makefile.in: Rebuilt dependencies.
-
-Mon Jan 10 20:46:53 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * Makefile.in (install): Remove "@" which follows a backslash. In
- this position it just causes errors, not suppresses echoes.
-
-Mon Jan 10 09:06:21 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
-
- * som.c (hppa_som_gen_reloc_type): Fix handling of LT and RT
- field selectors.
-
-Sun Jan 9 04:32:25 1994 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * config/i386-netbsd.mt (SELECT_VECS): Include i386bsd_vec.
-
-Fri Jan 7 10:27:27 1994 David J. Mackenzie (djm@rtl.cygnus.com)
-
- * aoutx.h (adjust_z_magic): Don't merge the start of bss with the
- end of data if they are not contiguous.
-
- * aoutf1.h (sunos4_aout_backend): Comment the fields' meanings.
-
-Fri Jan 7 15:40:16 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_mkobject_hook): Don't set SEC_SHARED_LIBRARY flag
- for .reginfo section here.
- (ecoff_new_section_hook): Set it here instead.
-
-Fri Jan 7 10:29:27 1994 Stan Shebs (shebs@andros.cygnus.com)
-
- * bfd-in.h: (bfd_boolean): Add workaround for systems that also
- define true and false as enums.
- (ALMOST_STDC): Add as alternative to __STDC__.
- * bfd-in2.h: Rebuilt.
- * syms.c (bfd_print_symbol_vandf): Convert a PTR to FILE*.
-
-Thu Jan 6 14:24:44 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aoutx.h (translate_to_native_sym_flags): Catch the case where
- there is no output section.
-
-Thu Jan 6 14:37:42 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * nlmcode.h (nlm_object_p): If we can't read the fixed header,
- count it as a wrong format error, not a system call error, since
- the object file might simply be too small.
-
- * targets.c (target_vector): Added nlm32_alpha_vec inside #ifdef
- BFD64.
- * Makefile.in (BFD32_BACKENDS): Remove nlm32-alpha.o.
- (BFD64_BACKENDS): Add nlm32-alpha.o. It depends on 64 bit
- support, even though it is for an Alpha in 32 bit mode.
- * configure.in (nlm32_alpha_vec): Set target64 to true.
-
- * nlm32-gen.c, nlm64-gen.c: Removed. All nlm targets are
- different, so there is no point to providing a generic one.
- * libnlm.h: Don't bother to check for nlm_backend(bfd) being NULL
- in the backend accessor macros; that should no longer be possible.
- * targets.c (target_vector): Removed nlm32_big_generic_vec,
- nlm64_big_generic_vec, nlm64_little_generic_vec.
- * configure.in (nlm32_big_generic_vec, nlm32_little_generic_vec,
- nlm64_big_generic_vec, nlm64_little_generic_vec): Removed.
- * Makefile.in: Rebuilt dependencies, and
- (BFD32_BACKENDS): Removed nlm32-gen.o.
- (BFD64_BACKENDS): Removed nlm64-gen.o.
- (CFILES): Removed nlm32-gen.c and nlm64-gen.c.
-
- * hp300hpux.c (ARCH_SIZE): Define before including aoutx.h.
-
- * linker.c (_bfd_generic_link_add_one_symbol): Add constructor and
- bitsize arguments. Changed all callers (aoutx.h).
- * libbfd-in.h (_bfd_generic_link_add_one_symbol): Add constructor
- and bitsize arguments to declaration.
- * libbfd.h: Rebuilt.
-
- * ecoff.c: First cut at new style of linker backend for
- ECOFF--added a bunch of functions. Also:
- (ecoff_sec_to_styp_flags): Set flags for .pdata and .xdata.
- (ecoff_slurp_symbolic_header): New function.
- (ecoff_slurp_symbolic_info): Call ecoff_slurp_symbolic_header.
- (ecoff_compute_reloc_file_positions): New function.
- (ecoff_set_section_contents): Get out quickly if count is zero.
- Check errors better.
- (ecoff_write_object_contents): Put .xdata section in data segment.
- Call ecoff_compute_reloc_file_positions. Don't output relocs or
- external symbols if outsymbols is NULL.
- (ecoff_bfd_final_link): Completely rewritten.
- * libecoff.h: Include bfdlink.h.
- (struct ecoff_backend_data): Add relocate_section field.
- (ecoff_data_type): Add sym_hashes and symndx_to_section fields.
- (struct ecoff_link_hash_entry): Define.
- (struct ecoff_link_hash_table): Define.
- (ecoff_bfd_link_add_symbols): Declare as function, not macro.
- (ecoff_bfd_link_hash_table_create): Likewise.
- * ecofflink.c (bfd_ecoff_debug_one_external): New function.
- (bfd_ecoff_debug_externals): Call bfd_ecoff_debug_one_external.
- * bfd-in.h (bfd_ecoff_debug_one_external): Declare.
- * bfd-in2.h: Rebuilt.
- * coff-alpha.c (alpha_howto_table): Mark BRADDR as
- partial_inplace, and set the src_mask to 0x1fffff.
- (alpha_ecoff_get_relocated_section_contents): Remove unused
- variable gp_warned.
- (alpha_convert_external_reloc): New static function.
- (alpha_relocate_section): New static function.
- (alpha_ecoff_backend_data): Initialize relocate_section field.
- * coff-mips.c (mips_relocate_refhi): New static function.
- (mips_relocate_section): New static function.
- (mips_ecoff_backend_data): Initialize relocate_section field.
-
- * reloc.c (_bfd_relocate_contents): Corrected signed overflow
- checking when there is an addend.
-
- * aoutx.h (NAME(aout,final_link)): Don't abort when trying to link
- a non a.out file, just pass it to _bfd_default_link_order.
- (aout_link_input_section_std): When doing a final PC relative link
- against a section symbol, subtract the VMA of the input section.
- (aout_link_input_section_ext): Likewise.
-
- * linker.c (default_indirect_link_order): Renamed from
- _bfd_generic_indirect_link_order and made static.
- (_bfd_generic_final_link): Don't switch on link_order type, just
- call _bfd_default_link_order.
- (_bfd_default_link_order): Handle bfd_indirect_link_order type.
- * genlink.h: Removed declaration of
- _bfd_generic_indirect_link_order.
- * elf32-mips.c (mips_elf_final_link): Don't switch on link_order
- type, just call _bfd_default_link_order.
-
-Tue Jan 4 21:23:37 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * linker.c (generic_link_check_archive_element): Base the name of
- the created common section on the name of the section the symbol
- came from.
- (_bfd_generic_link_add_one_symbol): (case BIG): A common symbol
- must have a section, so don't bother to create one.
-
-Mon Jan 3 15:32:16 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * aout-target.h (MY(vec)): Add DYNAMIC to mask of object flags.
- * aoutf1.h (NAME(aout,sunos4_write_object_contents)):
- If the DYNAMIC flag is set, set it in the exec header.
- * aoutx.h (NAME(aout,some_aout_object_p)): If the object is
- dynamically linked, set the DYNAMIC flag in the BFD.
- * libaout.h (N_SET_DYNAMIC): New macro.
- (N_DYNAMIC): Add missing 0 in mask.
-
-Mon Jan 3 11:41:45 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * ecoff.c (ecoff_get_extr): Don't output section symbols as
- external symbols.
-
- * bfd-in.h, hash.c: Change bfd_hash_allocate argument from size_t
- to unsigned int, because size_t may not be defined in bfd.h.
- * bfd-in2.h: Rebuilt.
-
- * bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
- be a const pointer.
- * bfd-in2.h: Rebuilt.
- * libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
- be a const pointer.
- * targets.c (bfd_target): Change swap function pointers
- accordingly.
- * archive.c (do_slurp_coff_armap): Change swap accordingly.
- * aix386-core.c: Change NO_GET and NO_GETS accordingly.
- * hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
- ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
- accordingly.
-
- * libbfd-in.h (struct artdata): Added tdata field.
- (_bfd_add_bfd_to_archive_cache): Declare.
- (_bfd_get_elt_at_filepos): Declare.
- (_bfd_snarf_ar_hdr): Renamed from snarf_ar_hdr.
- * libbfd.h: Rebuilt.
- * archive.c: Cleaned up some more.
- (_bfd_generic_mkarchive, bfd_generic_archive_p): Initialize
- pointer elements of artdata.
- (_bfd_add_bfd_to_archive_cache): Renamed from add_bfd_to_cache.
- (_bfd_snarf_ar_hdr): Renamed from snarf_ar_hdr.
- (_bfd_get_elt_at_filepos): Renamed from get_elt_at_filepos.
- (get_extended_arelt_filename, bfd_construct_extended_name_table,
- bfd_ar_hdr_from_filesystem, compute_and_write_armap): Made static.
- * ecoff.c: Some comment changes.
- (ecoff_slurp_armap): Handle rename of snarf_ar_hdr. Set
- ardata->tdata to raw_armap.
- (ecoff_archive_p): Initialize pointer elements of artdata.
- * coff-rs6000.c (rs6000coff_get_elt_at_filepos): Handle rename of
- add_bfd_to_cache.
-
- * hash.c: Added some documentation.
-
-Mon Jan 3 11:09:28 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
-
- * aout-target.h, netbsd386.c: Replace NO_SWAP_MAGIC with SWAP_MAGIC,
- and do the swapping here rather than calling ntohl from the N_*
- macros. This cleans up assumptions about the size of a host long,
- the existence to ntohl, etc.
-
-Sat Jan 1 13:50:05 1994 Rob Savoye (rob@darkstar.cygnus.com)
-
- * config.bfd: Add support for VSTa micro-kernel. It currently uses
- i386-aout.
-
-Sat Jan 1 10:18:54 1994 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * hosts/i386mach3.h (HOST_SEGMENT_SIZE): Fix value.
- * i386mach3.c (SEGMENT_SIZE): Fix value.
-
-For older changes see ChangeLog-9193
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/ChangeLog-9697 b/contrib/binutils/bfd/ChangeLog-9697
deleted file mode 100644
index e9a5c1d..0000000
--- a/contrib/binutils/bfd/ChangeLog-9697
+++ /dev/null
@@ -1,6729 +0,0 @@
-Tue Dec 30 12:45:18 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_check_relocs): If -Bsymbolic, don't
- allocate space for a PC relative reloc against a symbol which is
- defined in a regular file.
- (elf32_sparc_relocate_section): If -Bsymbolic, don't copy a PC
- relative reloc against a symbol which is defined in a regular
- file.
-
-Mon Dec 29 18:02:28 1997 Ian Lance Taylor <ian@cygnus.com>
-
- From Jonathan Stone <jonathan@DSG.Stanford.EDU>:
- * config.bfd (mips-dec-netbsd*): Add ECOFF vectors to
- targ_selvecs.
- (mips*el-*-netbsd*): Like mips-dec-netbsd*.
- (mips*-*-netbsd*): New target.
-
-Mon Dec 29 17:13:28 1997 H.J. Lu (hjl@gnu.org)
-
- * elflink.h (elf_link_assign_sym_version): Change error message
- from "undefined version name" to "undefined versioned symbol
- name".
-
-Mon Dec 29 11:41:16 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (coff_arm_relocate_section): Fix typo from previous
- delta.
-
-Tue Dec 23 17:01:10 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Declare.
- * libbfd.h: Rebuild.
-
- * peicode.h (coff_swap_scnhdr_out): Set .reloc section to be
- shared. Set stab* sections to be shared and read. Set .rsrc
- section to be read and shared.
-
-Mon Dec 22 13:20:57 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: Rebuild dependencies.
- (ALL_MACHINES_CFILES): Add dwarf2.lo.
- (ALL_MACHINES_CFILES): Add dwarf2.c.
- * Makefile.in: Rebuild.
-
- * coff-arm.c: Don't include obstack.h.
-
-Mon Dec 22 13:04:33 1997 Joel Sherrill <joel@oarcorp.com>
-
- * config.bfd (i[3456]86*-go32-rtems*): Fix to be the same as
- i[3456]86-go32.
-
-Thu Dec 18 16:01:25 1997 Doug Evans <devans@canuck.cygnus.com>
-
- * configure: Regenerate to get @SHELL@ substituted.
-
-Wed Dec 17 09:45:09 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (coff_arm_relocate_section): Only look at section
- owner if there is one.
-
- * elf.c (assign_file_positions_for_segments): Fail if there is not
- enough room for the program headers.
-
-Tue Dec 16 08:09:56 1997 Gavin Koch <gavin@cygnus.com>
-
- * elf.c (_bfd_elf_find_nearest_line): Call
- _bfd_dwarf2_find_nearest_line first.
- * elf32-mips.c (_bfd_mips_elf_find_nearest_line): Same.
- * dwarf2.c: New file; implement _bfd_dwarf2_find_nearest_line.
-
-Mon Dec 15 16:08:52 1997 Nick Clifton <nickc@cygnus.com>
-
- * archures.c: Add bfd_mach_m32r.
-
-Mon Dec 15 16:11:22 1997 Fred Fish <fnf@cygnus.com>
-
- * coffcode.h (ALIGN_SECTIONS_IN_FILE): Define if I960 not defined.
- (coff_compute_section_file_positions): Use ALIGN_SECTIONS_IN_FILE
- to decide when to align the file sections for paging.
- * coffcode.h (ALIGN_SECTIONS_IN_FILE): Undefine for TIC80COFF.
-
-Mon Dec 15 15:01:15 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-m32r.c (m32r_elf_object_p): New Function.
- (m32r_elf_final_write_processing): New Function.
- (m32r_elf_set_private_flags): New Function.
- (m32r_elf_copy_private_bfd_data): New Function.
- (m32r_elf_merge_private_bfd_data): New Function.
- (m32r_elf_print_private_bfd_data): New Function.
- (elf_backend_object_p): Point to m32r_object_p.
- (elf_backend_final_write_processing): Point to
- m32r_elf_final_write_processing.
- (bfd_elf32_bfd_copy_private_bfd_data): Point to
- m32r_elf_copy_private_bfd_data.
- (bfd_elf32_bfd_merge_private_bfd_data): Point to
- m32r_elf_merge_private_bfd_data.
- (bfd_elf32_bfd_set_private_flags): Point to
- m32r_elf_set_private_bfd_data.
- (bfd_elf32_bfd_print_private_bfd_data): Point to
- m32r_elf_print_private_bfd_data.
-
-
- * bfd-in2.h (bfd_mach_m32r): Add identifier for M32R architecture
- machines.
-
-Fri Dec 12 11:30:28 1997 Brendan Kehoe <brendan@canuck.cygnus.com>
-
- * configure: Only build libbfd shared if --enable-shared's value
- was `yes', or was set to `*bfd*'.
- * aclocal.m4: Likewise.
- * NOTE: this really needs to be fixed in libtool/libtool.m4, the
- original source of this bit of code. It's not clear what the best fix
- would be, though.
-
-Thu Dec 11 17:48:11 1997 Richard Henderson <rth@cygnus.com>
-
- * linker.c (generic_link_add_symbol_list): Always init udata.p so
- that the generic relaxation code can function when input and output
- file formats are mismatched.
-
-Thu Dec 11 01:02:18 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (bfd_coff_small_swap_table): Initialize new fields.
-
- * elf.c (assign_file_positions_for_segments): For a loadable
- section, make sure that the load address is correct relative to
- the load address of the segment plus the size of the segment so
- far.
-
- * coffcode.h (_coff_link_output_has_begun): Make static.
- (_coff_final_link_postscript): Likewise.
-
-Wed Dec 10 23:37:11 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_input_bfd): Handle a relocateable link in
- which a relocation refers to an indirect or warning symbol.
-
-Wed Dec 10 11:15:55 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (bfd_arm_coff_final_link): Function deleted.
- (coff_arm_final_link_postscript): New function.
- (coff_arm_link_output_has_begun): New function.
-
- * libcoff.h (struct bfd_coff_backend_data): Add new fields:
- _bfd_coff_link_output_has_begun and
- _bfd_coff_final_link_postscript. Add new macros:
- bfd_coff_link_output_has_begun() and
- bfd_coff_final_link_postscript().
-
- * cofflink.c (_bfd_coff_final_link): Insert calls to
- bfd_coff_link_output_has_begun() and
- bfd_coff_final_link_postscript().
-
- * coffcode.h: Add two new fields to bfd_coff_backend_data
- structure: _bfd_coff_link_output_has_begun and
- _bfd_coff_final_link_postscript. Add default initialisers for
- these fields. Add overridable aliases for the coff swap functions
- in the backend data structure.
-
- * elf32-v850.c: Update with patches from the branch to fix
- HI16_S/LO16 reloc pairs.
-
-Wed Dec 10 14:06:48 1997 Michael Meissner <meissner@cygnus.com>
-
- * elf32-d30v.c (d30v_info_to_howto_rela): New function to support
- RELA relocations.
- (USE_REL): Don't define any more, switch to using RELA
- relocations.
- (elf_info_to_howto): Define as d30v_info_to_howto_rela.
-
-Tue Dec 9 11:37:53 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * archures.c (bfd_mach_mips*): Define.
- (bfd_default_scan): For 3000 and 4000 replace magic constant with
- macro.
-
- * cpu-mips.c (N): Define.
- (bfd_mips_arch, arch_info_struct): Re-write using macro N, replace
- numbers with bfd_mach_mips* macros.
-
-Fri Dec 5 11:13:46 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_reloc, v850_elf_store_addend_in_insn,
- v850_elf_relocate_section): Fix reloc addend handling.
- (v850_elf_section_from_bfd_section, v850_elf_symbol_processing,
- v850_elf_add_symbol_hook, v850_elf_link_output_symbol_hook,
- v850_elf_section_from_shdr, v850_elf_fake_sections): New functions
- to create and handle special common sections.
- (v850_elf_final_link_relocate): Fix HI16 and HI16_S relocations
- which have data stored in the instructions.
-
-Tue Dec 2 10:26:16 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (TARGET_UNDERSCORE): Revert back to '_'
- (USER_LABEL_PREFIX): Revert back to '_'
-
- * config.bfd (targ_cpu): Add support for Thumb target.
-
-Mon Dec 1 20:24:18 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * coff-sh.c (sh_coff_howtos): Add R_SH_SWITCH8 entry.
- (get_symbol_value): Handle R_SH_SWITCH8.
- (sh_relax_delete_bytes): Likewise.
-
-Wed Nov 26 14:13:34 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (TARGET_UNDERSCORE): Changed to match definition in
- gcc/config/arm/semi.h
-
- * coffcode.h (coff_slurp_symbol_table): Add ARM and Thumb symbol
- classes.
-
-Sun Nov 23 16:02:58 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * freebsd.h (SWAP_MAGIC): Read magic number little and not big
- endian.
-
-Wed Nov 26 09:30:37 1997 Nick Clifton <nickc@cygnus.com>
-
- * coffcode.h (coff_mkobject_hook): Only set private flags for non
- PE ARM ports.
-
-Tue Nov 25 15:33:23 1997 Richard Henderson <rth@cygnus.com>
-
- * binary.c (binary_set_section_contents): Also ignore NEVER_LOAD
- sections.
-
-Tue Nov 25 10:55:36 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (coff_arm_bfd_merge_private_bfd_data): Do not
- complain if inout and output formats differ.
-
-Tue Nov 25 11:26:27 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (BFD32_BACKENDS): Remove tekhex.lo.
- (BFD32_BACKENDS_CFILES): Remove tekhex.c.
- * Makefile.in: Rebuild.
- * aclocal.m4, configure, Makefile.in: Rebuild with current
- automake and autoconf.
-
- * coff-arm.c (arm_allocate_interworking_sections): Fix typo
- (COFF_WITH_PR to COFF_WITH_PE).
-
-Mon Nov 24 15:47:49 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c: Make variables and some functions static, so that
- this file can be included in multiple object files.
- (coff_arm_bfd_final_link): Fix minor bug.
-
-Sat Nov 22 15:16:00 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c: Add support for PIC and APCS-FLOAT type binaries.
-
- * coffcode.h: Add support for PIC and APCS-FLOAT type binaries.
-
-Sat Nov 22 16:06:56 1997 Klaus Kaempf <kkaempf@progis.de>
-
- * evax-emh.c (_bfd_evax_write_emh): Use alloca instead of strdup.
-
-Sat Nov 22 12:29:30 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_add_one_symbol): When overriding a defined
- symbol, set it to undefined, not new.
-
- * elf32-sh.c (sh_elf_relax_delete_bytes): Don't kill LABEL
- relocs.
-
-Fri Nov 21 14:14:22 1997 Richard Henderson <rth@cygnus.com>
-
- * coff-sh.c (sh_relax_section): Force sign extention of USES r_offset.
- (sh_relax_delete_bytes): Don't kill LABEL relocs.
-
-Mon Nov 17 15:08:38 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Fix typo.
- (mn10300_elf_relax_section): Likewise.
-
-Sat Nov 15 15:36:07 1997 Fred Fish <fnf@cygnus.com>
-
- * peicode.h (coff_swap_aouthdr_in): Cast second arg of
- bfd_h_get_* calls to "bfd_byte *".
-
-Tue Nov 11 10:37:23 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf-m10300.c (elf32_mn10300_link_hash_entry): Add new field
- "movm_stack_size".
- (mn10300_elf_relax_section): Include stack space for register saves
- in the imm8 field of a "call" instruction.
- (compute_function_info): Determine how much stack is allocated by
- the movm instruction. Fix typo.
- (elf32_mn10300_link_hash_newfunc): Initialize movm_stack_size.
-
-Mon Nov 10 14:32:40 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Don't crash if
- a version dependency could not be found.
-
-Tue Nov 4 12:05:56 1997 Klaus K"ampf <kkaempf@progis.de>
-
- * configure.com: Get version info from configure.in
-
-Fri Oct 24 11:15:58 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz>
-
- * elf64-sparc.c (sparc64_elf_merge_private_bfd_data):
- New function. Avoid mixing US1 and HAL R1 code.
- Set resulting memory ordering to the strongest one used.
- (sparc64_elf_object_p): Set bfd_mach correctly.
-
-Thu Oct 23 14:09:33 1997 Richard Henderson <rth@cygnus.com>
-
- * elf64-sparc.c (sparc64_elf_howto_table): Add UA64 & UA16.
- (sparc64_elf_check_relocs): Handle them.
- (sparc64_elf_relocate_section): Likewise. Before emitting a dyn reloc,
- check alignment and transmute R_SPARC_x<->R_SPARC_UAx.
-
-Thu Oct 23 00:53:14 1997 Richard Henderson <rth@dot.cygnus.com>
-
- * configure.in (sparc*-*-linux*): Use trad-core and ...
- * hosts/sparclinux.h: New file.
-
-Thu Oct 23 00:25:29 1997 Richard Henderson <rth@dot.cygnus.com>
-
- * config.bfd (sparc64-*-linux*): New target.
-
- * elf-bfd.h (struct elf_backend_data): Add plt_alignment member.
- * elflink.c (_bfd_elf_create_got_section): Set .got alignment based
- on arch_size.
- (_bfd_elf_create_dynamic_sections): Likewise for .rel* sections.
- Set .plt alignment from new plt_alignment.
- * elflink.h (elf_link_create_dynamic_sections): Set version section
- alignment to LOG_FILE_ALIGN.
- * elfxx-target.h (elf_backend_plt_alignment): Provide default.
- (elfXX_bed): Init plt_alignment.
-
- * elf64-sparc.c (sparc64_elf_check_relocs,
- sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections,
- sparc64_elf_adjust_dynindx, sparc64_elf_finish_dynamic_symbol,
- sparc64_elf_finish_dynamic_sections): New functions.
- (sparc64_elf_howto_table): Fix a few name strings.
- (ELF_DYNAMIC_INTERPRETER): New definition.
- (sparc64_elf_relocate_section): Handle shared libraries.
-
- * elf64-sparc.c (struct plt_template, plt_*_header, plt_*_entry,
- sparc64_elf_build_plt_entry, sparc64_elf_finish_dynamic_symbol):
- PLT definitions sparc64-linux originally choose. These will go
- away soon in favour of the official abi definitions.
-
-Wed Oct 22 16:08:45 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (coff_small_object_p): New static function.
- (coff_small_new_section_hook): New static function.
- (bfd_coff_small_swap_table): New static const structure.
- (coff_small_close_and_cleanup): Define.
- (coff_small_bfd_free_cached_info): Define.
- (coff_small_get_section_contents): Define.
- (coff_small_get_section_contents_in_window): Define.
- (shcoff_small_vec): New static structure.
- (shlcoff_small_vec): New static structure.
- * targets.c (bfd_target_vector): Add shcoff_small_vec and
- shlcoff_small_vec.
- * config.bfd (sh-*-elf*): Add shcoff_small_vec and
- shlcoff_small_vec to targ_selvecs.
- (sh-*-*): Likewise.
- * configure.in: Add shcoff_small_vec and shlcoff_small_vec cases.
- * configure: Rebuild.
-
-Mon Oct 20 15:01:27 1997 Klaus K"ampf <kkaempf@progis.de>
-
- * evax-egsd.c: Weak symbols are global.
-
- * evax-emh.c: Use proper casts.
-
- * evax-egsd.c (_bfd_evax_write_egsd): Remove unneeded uname.
-
- * evax-egsd.c: Section names and symbols have different
- length restrictions. Add length parameter to
- _bfd_evax_length_hash_symbol.
- * evax-etir.c: Likewise.
- * evax-misc.c (_bfd_evax_length_hash_symbol): Add length
- parameter.
- * evax.h (EOBJ_S_C_SECSIZ): Define.
-
- * evax-alpha.c: Remove duplicate test.
-
- * evax-emh.c: SYS$ functions are upper-case.
-
- * evax-egsd.c: Create separate sections for common symbols.
- * evax-etir.c: Don't output common section.
- * evax.h: Bump up section count.
-
- * configure.com: Use 64bit integers with DEC C.
-
- * evax-egsd.c: Make section flags dec c compatible.
-
-Mon Oct 20 09:38:31 1997 Jeffrey A Law (law@cygnus.com)
-
- * som.c (normalize): Delete function.
- (som_bfd_ar_write_symbol_stuff): New parameter elength. All callers
- changed. Use passed in elength to determine size of the extended
- name table instead of computing it again.
-
-Sun Oct 19 23:36:21 1997 Jim Wilson <wilson@cygnus.com>
-
- * peicode.h (coff_swap_scnhdr_out): Use |= not = to set
- IMAGE_SCN_MEM_READ for an unrecognized section.
-
-Sun Oct 19 21:04:56 1997 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_bfd_ar_write_symbol_stuff): Account for trailing
- '/' in the extended name table.
-
-Fri Oct 17 00:04:13 1997 Richard Henderson <rth@cygnus.com>
-
- * elflink.h (elf_link_assign_sym_version): For explicitly versioned
- symbols, check globals list before matching on locals.
-
-Thu Oct 16 08:17:06 1997 Michael Meissner <meissner@cygnus.com>
-
- * peicode.h (coff_swap_scnhdr_out,pe_print_idata): Fix mangled
- patch.
-
-Wed Oct 15 13:45:10 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (pe_mkobject_hook): Set DLL flag.
- (pe_bfd_copy_private_bfd_data): Copy DLL flag.
-
- * peicode.h (coff_swap_scnhdr_out): Set IMAGE_SCN_MEM_DISCARDABLE
- for .stab* sections. Replace strlen of constant strings with
- number.
-
-Tue Oct 14 15:42:45 1997 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_merge_ind_symbols): New function to
- merge got and reloc entries from ind syms to their target.
- (elf64_alpha_always_size_sections): Call it.
- (elf64_alpha_check_relocs): Operate on the target of indirect symbols.
- (elf64_alpha_can_merge_gots): Likewise.
- (elf64_alpha_merge_gots): Likewise.
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Back out HJ's change,
- as it is insufficient to handle the relocation changes as well.
-
-Mon Oct 13 23:10:08 1997 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_calc_dynrel_sizes): Allow for RELATIVE
- relocs for symbols in shlibs that have been forced local.
- (elf64_alpha_relocate_section): Output RELATIVEs in .got for same.
-
-Mon Oct 13 21:24:04 1997 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Use the
- got_enties of the default symbol for the default versioned
- symbol. Patch from hjl@gnu.ai.mit.edu, modified not to use
- alloca in the loop.
-
-Mon Oct 13 17:37:37 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_final_link_relocate): Only use the bottom
- 24 bits of the PC when computing a PC relative relocation.
-
-Fri Oct 10 16:01:30 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_reloc, v850_elf_final_link_relocate):
- Correct value for maximum positive 22 bit PC relative relocation.
- (v850_elf_final_link_relocate): Prevent overflow from HI16_S and
- HI_16 relocations. Correct bit adjustment in TDA offsets.
-
-Thu Oct 9 16:43:39 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * elf64-sparc.c (sparc_elf_{hix22,lox10}_reloc): New functions.
- (sparc64_elf_howto_table): Use them for HIX22,LOX10 relocs.
-
-Wed Oct 8 11:38:45 1997 Richard Henderson <rth@cygnus.com>
-
- * elfcore.h (bfd_prstatus): Pedanticly, alignment_power should
- be LOG_FILE_ALIGN.
-
-Wed Oct 8 11:36:00 1997 Richard Henderson <rth@cygnus.com>
-
- * config.bfd: Missed one alpha* change.
-
-Tue Oct 7 13:00:17 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): Remove BFD64 support.
- * elf64-sparc.c (SPARC64_OLD_RELOCS): Undef.
- (MINUS_ONE): New macro.
- (sparc_elf_notsup_reloc): New function.
- (sparc64_elf_howto_table): Add entries for DISP64,PLT64,HIX22,LOX10,
- H44,M44,L44,REGISTER.
- (sparc_reloc_map): Likewise. Map BFD_RELOC_CTOR to R_SPARC_64.
- (init_insn_reloc): New function.
- (sparc_elf_wdisp16_reloc): Use it.
- (sparc64_elf_relocate_section): Add entries for OLO10,HIX22,LOX10.
-
-Tue Oct 7 11:40:37 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * som.c (som_construct_extended_name_table): Remove static
- function, and define as macro instead.
-
-Fri Oct 3 14:02:17 1997 Richard Henderson <rth@cygnus.com>
-
- * config.bfd: Change alpha-*-* to alpha*-*-*; config.guess now
- recognizes alphaev5 etc.
- * configure.host: Likewise.
-
-Fri Oct 3 11:23:47 1997 Ian Lance Taylor <ian@cygnus.com>
-
- Make ld -s work on AIX:
- * xcofflink.c (xcoff_link_add_symbols): Don't create the .debug
- section if we are stripping.
- (bfd_xcoff_size_dynamic_sections): Don't set the .debug section
- size if we are stripping.
- (_bfd_xcoff_bfd_final_link): Don't set SEC_RELOC or rel_filepos,
- and don't write out relocs, if we are stripping.
- (xcoff_link_input_bfd): Don't set up reloc if we are stripping.
- (xcoff_write_global_symbol): Don't write out symbol or reloc if we
- are stripping.
-
- * configure.in: Don't include elf.lo again for ELF targets; it's
- always in the library anyhow.
- * configure: Rebuild.
-
- * bfd-in2.h: Rebuild.
-
- * elf32-sparc.c (sparc_elf_wdisp16_reloc): Cast to bfd_byte *, not
- char *, when calling bfd_get_32 and bfd_put_32.
- * sunos.c (sunos_scan_dynamic_symbol): Cast contents to char *
- when calling strcpy.
-
-Thu Oct 2 16:15:50 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * reloc.c (bfd_check_overflow): New function.
- (bfd_perform_relocation, bfd_install_relocation): Use it.
- (BFD_RELOC_SPARC_{DISP64,PLT64}): New relocs.
- (BFD_RELOC_SPARC_{HIX22,LOX10,H44,M44,L44,REGISTER}): New relocs.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
-Thu Oct 2 13:17:18 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (coff_swap_scnhdr_out): Set IMAGE_SCN_MEM_READ for an
- unrecognized section. From Jon Thackray <jont@harlequin.co.uk>.
-
-Wed Oct 1 14:03:44 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am ($(BFD_H)): Change stmp-bfd.h to stmp-bfd-h.
- (stmp-bfd-h): Rename from stmp-bfd.h.
- (BFD_H_FILES, LIBBFD_H_FILES, LIBCOFF_H_FILES): New variables.
- ($(srcdir)/bfd-in2.h): Just depend upon stmp-bin2-h.
- (stmp-bin2-h): New target.
- ($(srcdir)/libbfd.h): Just depend upon stmp-lbfd-h.
- (stmp-lbfd-h): New target.
- ($(srcdir)/libcoff.h): Just depend upon stmp-lcoff-h.
- (stmp-lcoff-h): New target.
- (CLEANFILES): Change stmp-bfd.h to stmp-bfd-h. Add stmp-bin2.h,
- stmp-lbfd-h, and stmp-lcoff-h.
- * Makefile.in: Rebuild.
-
- * configure.in: Use a diversion to set enable_shared before the
- arguments are parsed.
- * configure: Rebuild.
-
-Tue Sep 30 14:18:32 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): R_SPARC_GLOB_JMP
- renamed to R_SPARC_UNUSED_42.
- (sparc_reloc_map): Delete R_SPARC_GLOB_JMP entry.
- * elf64-sparc.c (_bfd_sparc_elf_howto_table): R_SPARC_GLOB_JMP
- renamed to R_SPARC_UNUSED_42.
- (sparc_reloc_map): Delete R_SPARC_GLOB_JMP entry.
- * reloc.c (BFD_RELOC_SPARC_GLOB_JMP): Delete.
- * bfd-in2.h: Regenerated.
- * libbfd.h: Regenerated.
-
-Thu Sep 25 12:15:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_merge_symbol): Don't check the hash creator until
- after we have set *sym_hash.
-
-Wed Sep 24 16:52:28 1997 Joel Sherrill <joel@oarcorp.com>
-
- * config.bfd (sh*-*-rtems*): New target, like sh-*-*elf*.
-
-Wed Sep 24 11:27:23 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (libbfd_a_SOURCES): Define.
- * Makefile.in: Rebuild.
-
- * configure.in: Call AC_CHECK_TOOL before AM_PROG_LIBTOOL.
- * aclocal.m4: Rebuild with new libtool.
- * configure: Rebuild.
-
-Tue Sep 23 19:03:13 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (map_sections_to_segments): Even if we are not demand
- paged, don't put a loadable section after a nonloadable section.
- (assign_file_positions_for_segments): Increment the file offset
- for a section with contents, even if it is not loadable.
-
-Sun Sep 21 11:03:24 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_final_link_relocate): Add return code
- indicating that __ctbp could not be found.
-
-Thu Sep 18 15:04:57 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_check_relocs): Improve error message.
-
-Wed Sep 17 09:54:51 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_final_link_relocate, v850_elf_reloc,
- v850_elf_check_relocs, v850_elf_reloc_map, v850_elf_howto_table):
- Add support for the CALLT relocs.
-
- * reloc.c (COMMENT): Add BFD_RELOC_V850_CALLT_6_7_OFFSET and
- BFD_RELOC_V850_CALLT_16_16_OFFSET.
-
- * elf32-v850.c (v850_elf_final_link_relocate): Add checks to catch
- relocations against non-existant symbols.
-
-Tue Sep 16 14:20:27 1997 Nick Clifton <nickc@cygnus.com>
-
- * reloc.c: Add BFR_RELOC_V850_TDA_16_16_OFFSET.
-
- * elf32-v850.c (v850_elf_reloc, v850_elf_final_link_relocate,
- v850_elf_howto_table, v850_elf_reloc_map): Add support for a 16
- bit reloc in the tiny data area.
-
-Mon Sep 15 11:27:36 1997 Ken Raeburn <raeburn@cygnus.com>
-
- Merged changes from Martin Hunt:
-
- * elf32-d30v.c (bfd_elf_d30v_reloc): Change pc-relative relocs
- over 2^32 bytes to be absolute. Needed because D30V PC doesn't
- necessarily wrap.
-
- * reloc.c, elf32-d30v.c (BFD_RELOC_D30V_9_PCREL,
- BFD_RELOC_D30V_9_PCREL_R): New relocs.
-
- * elf32-d30v.c (bfd_elf_d30v_reloc_21): New function.
- Do 15 and 21 bit pc-relative relocations.
- * reloc.c (BFD_RELOC_D30V_15_PCREL_R, BFD_RELOC_D30V_21_PCREL_R):
- New relocations.
-
- * elf32-d30v.c (bfd_elf_d30v_reloc): Addend needs to be
- added to the relocation, not or'd.
-
-Wed Sep 10 15:17:25 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_reloc): Remove spurious error message.
-
-Wed Sep 10 11:17:50 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * archures.c (bfd_default_scan): Use strcasecmp.
- (bfd_default_scan): Test for match with arch_name + ":" +
- printable_name.
- (bfd_default_scan): Test for match with printable_name - ":".
- (bfd_default_scan): Delete w65, h8300, h8500, z8k, i960 special
- cases. Each implements their own scan function.
- (bfd_default_scan): Delete 386, 2900, 860, mips 2000, mips 4400
- special cases. Since info->mach == 0. The test mach == number
- fails.
- (bfd_arch_list): New function, return name of all the supported
- architectures.
-
-Tue Sep 9 10:21:56 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_print_private_bfd_data): Break after
- decoding architecture.
- (v850_elf_reloc): Do not complain if a R_V850_LO16 reloc has bit
- 15 set.
-
-Sun Sep 7 12:25:22 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
-
- * elf64-alpha.c (reloc_howto_type): Fix the howto table.
-
-Thu Sep 4 09:44:10 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: Rebuild dependencies.
- (ALL_MACHINES_CFILES): Add cpu-v850.c.
- (ALL_MACHINES_CFILES): Add elf32-v850.c.
- * Makefile.in: Rebuild.
-
- * reloc.c: Remove extraneous commas from relocation entries.
- Remove BFD_RELOC_V850_16_PCREL.
- * bfd-in2.h: Rebuild.
-
- * xcofflink.c (xcoff_link_add_symbols): Put XTY_CM/XMC_TD symbols
- in sections named .tocbss rather than .bss.
-
-Wed Sep 3 11:23:23 1997 Nick Clifton <nickc@cygnus.com>
-
- * libbfd.h, bfd-in2.h, elf32-v850.c: Removed
- BFD_RELOC_V850_16_PCREL.
-
-Tue Sep 2 20:44:10 1997 Fred Fish <fnf@cygnus.com>
-
- * cofflink.c (coff_link_check_ar_symbols): Handle C_SYSTEM syms
- the same as C_EXT syms.
- (coff_link_add_symbols): Ditto.
- (_bfd_coff_link_input_bfd): Ditto.
- (_bfd_coff_write_task_globals): Add save_global_to_static. Use
- it to preserve and restore state of global_to_static flag.
-
-Tue Sep 2 17:45:22 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_object_p): Set machine number based on
- bits in e_flags field rather than magic numbers.
- (v850_elf_final_write_processing, v850_elf_set_private_flags,
- v850_elf_copy_private_bfd_data, v850_elf_merge_private_bfd_data,
- v850_elf_print_private_bfd_data): New functions.
-
-Tue Sep 2 17:43:49 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (prep_headers): Remove V850E magic number.
- * elf.c (prep_headers): Remove V850EA magic number.
-
-Tue Sep 2 17:35:05 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * cpu-arc.c (arc_get_mach): Properly scan defined mach entries.
-
-Tue Sep 2 18:29:37 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf-m10200.c (mn10200_elf_final_link_relocate): PC relative
- instructions are relative to the next instruction, not the
- current instruction.
- (mn10200_elf_relax_section): Similarly.
-
-Tue Sep 2 15:45:45 1997 Nick Clifton <nickc@cygnus.com>
-
- * cpu-v850.c: Use a macro to construct bfd_arch_info_type
- entries.
-
- * reloc.c, libbfd.h, bfd-in2.h, elf32-v850.c: Replace
- BFD_RELOC_V850_{SDA/TDA/ZDA}_OFFSET relocs with new bit pattern
- specific versions: BFD_RELOC_V850_{area}_{bits}_OFFSET.
-
-Thu Aug 28 17:01:09 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * cpu-v850.c: Remove "plain" from v850 printable name.
- (scan): Use strcasecmp.
-
- * archures.c (bfd_mach_v850): Define.
-
- * cpu-sh.c (scan_mach): Compare with table instead of hardwired to
- just sh/SH, use strcasecmp.
- (arch_info_struct): Add entries for sh3 et.al.
-
- * archures.c (bfd_mach_sh, ...): Define.
-
-Wed Aug 27 17:33:07 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * archures.c (bfd_archures_list): Always NULL terminate the list.
-
-Tue Aug 26 17:26:51 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: Rebuild dependencies.
- (ALL_MACHINES_CFILES): Add cpu-arc.c.
- (ALL_MACHINES_CFILES): Add elf32-arc.c.
- (elf32-arc.lo): Remove explicit dependency.
- * Makefile.in: Rebuild.
-
- * acinclude.m4 (BFD_CC_FOR_BUILD): Set EXEEXT_FOR_BUILD.
- * doc/Makefile.am (MKDOC): Use EXEEXT_FOR_BUILD, not EXEEXT.
- * aclocal.m4: Rebuild.
- * configure: Rebuild.
- * Makefile.in: Rebuild.
- * doc/Makefile.in: Rebuild.
-
-Mon Aug 25 16:14:34 1997 Christopher Provenzano <proven@cygnus.com>
-
- * configure: Rebuild with latest devo autoconf for NT support
-
-Mon Aug 25 16:11:04 1997 Nick Clifton <nickc@cygnus.com>
-
- * cpu-arm.c (compatible): If B is a default type, return A.
-
-Mon Aug 25 15:35:46 1997 Nick Clifton <nickc@cygnus.com>
-
- * cpu-v850.c (scan): New function.
- (arch_info_struct): New structure.
- (bfd_v850_arch): Add link into arch_info_structure.
-
- * config.bfd (targ_cpu): All v850 variants use the bfd_arch_v850
- architecture.
-
- * elf32-v850.c (v850_elf_object_p): New function.
-
- * archures.c (bfd_mach_v850e): Machine value for v850e.
-
- * bfd-in2.h (bfd_mach_v850e): Machine value for v850e.
-
- * elf32-v850.c (ELF_MACHINE_CODE): Default to v850e machine
- number.
-
- * elf.c (prep_headers): Add support for v850e machine number.
-
- * archures.c (bfd_mach_v850ea): Machine value for v850ea.
-
- * bfd-in2.h (bfd_mach_v850ea): Machine value for v850ea.
-
- * elf32-v850.c (ELF_MACHINE_CODE): Default to v850ea machine
- number.
-
- * elf.c (prep_headers): Add support for v850ea machine number.
-
-Mon Aug 25 14:07:33 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Clear the
- cached_stab field if the offset prevents us from using the cache.
-
-Mon Aug 25 12:08:13 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * aout-target.h (MY(vec)): Add SEC_CODE and SEC_DATA to section
- flags.
- * aout-arm.c (aout_arm_little_vec): Likewise.
- (aout_arm_big_vec): Likewise.
- * bout.c (b_out_vec_big_host): Likewise.
- (b_out_vec_little_host): Likewise.
- * mipsbsd.c (aout_mips_little_vec): Likewise.
- (aout_mips_big_vec): Likewise.
-
-Tue Aug 19 10:09:10 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-tic80.c (COFF_ALIGN_IN_SFLAGS): Define to 1.
- * coffcode.h (styp_to_sec_flags): Ignore incoming STYP_INFO
- bit in s_flags if COFF_ALIGN_IN_S_FLAGS is defined.
-
-Tue Aug 19 08:47:17 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-i960.c (COFF_ALIGN_IN_SECTION_HEADER): Define to 1.
- (GET_SCNHDR_ALIGN, PUT_SCNHDR_ALIGN): Define.
- * coff-m88k.c (GET_SCNHDR_NRELOC, GET_SCNHDR_NLNNO): Define.
- * coffcode.h (coff_set_alignment_hook): Conditionally compile in if
- COFF_ALIGN_IN_SECTION_HEADER is defined. Convert alignment to power
- of two for I960 only.
- * coffswap.h (GET_SCNHDR_NRELOC, PUT_SCNHDR_NRELOC, GET_SCNDHR_NLNNO,
- PUT_SCNHDR_NLNNO, GET_SCNHDR_FLAGS, PUT_SCNHDR_FLAGS): Provide
- default definitions.
- (coff_swap_scnhdr_in): Use GET_SCNHDR_FLAGS, GET_SCNHDR_NRELOC,
- GET_SCNHDR_NLNNO, and GET_SCNHDR_ALIGN.
- (coff_swap_scnhdr_out): Use PUT_SCNHDR_FLAGS, PUT_SCNHDR_ALIGN.
- * Makefile.in (coff-tic80.o): Depends upon coffswap.h.
- * coff-tic80.c (COFF_ALIGN_IN_SECTION_HEADER): Define to 1.
- (GET_SCNHDR_FLAGS, PUT_SCNHDR_FLAGS): Define
- * coffcode.h (coff_write_object_contents): Set alignment field in
- section header for TIC80COFF files.
-
-Mon Aug 18 11:36:19 1997 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_howto_table, v850_elf_reloc_map,
- v850_elf_check_relocs, v850_elf_reloc,
- v850_elf_final_link_relocate): Add support for
- BFD_RELOC_V850_16_PCREL relocation.
-
- * reloc.c (COMMENT): Add suuport for BFD_RELOC_V850_16_PCREL
- relocation.
-
- * libbfd.h: Add support for BFD_RELOC_V850_16_PCREL relocation.
-
- * bfd-in2.h: Add support for BFD_RELOC_V850_16_PCREL relocation.
-
-Mon Aug 18 11:33:56 1997 Nick Clifton <nickc@cygnus.com>
-
- * cpu-v850e: New file.
-
- * elf.c (prep_headers): Add support for v850e target.
-
- * bfd-in2.h (bfd_architecture): Add support for v850e target.
-
- * config.bfd: Add support for v850e target.
-
- * archures.c: Add support for v850e target.
-
-Mon Aug 18 11:33:56 1997 Nick Clifton <nickc@cygnus.com>
-
- * cpu-v850ea: New file.
-
- * elf.c (prep_headers): Add support for v850ea target.
-
- * bfd-in2.h (bfd_architecture): Add support for v850ea target.
-
- * config.bfd: Add support for v850ea target.
-
- * archures.c: Add support for v850ea target.
-
-Fri Aug 15 12:01:28 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coffgen.c (coff_find_nearest_line): Correctly handle the offset
- argument as section relative, rather than an absolute address.
- From Jan Hoogenraad <hoogenrd@natlab.research.philips.com>.
-
-Fri Aug 15 04:58:02 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * config.bfd (arc-*-elf*): Add.
- * configure.in (bfd_elf32_{little,big}arc_vec): Add.
- * configure: Rebuild.
- * Makefile.am (ALL_MACHINES): Add cpu-arc.lo.
- (BFD32_BACKENDS): Add elf32-arc.lo.
- (cpu-arc.lo,elf32-arc.lo): Add rules for.
- * Makefile.in: Rebuild.
- * archures.c (architecture list): Add bfd_arch_arc.
- (bfd_archures_list): Add bfd_arc_arch.
- (bfd_mach_arc_base): Define.
- * reloc.c (BFD_RELOC_ARC_B22_PCREL,BFD_RELOC_ARC_B26): Add.
- * targets.c (bfd_elf32_{little,big}arc_vec): Declare.
- (bfd_target_vect): Add them.
- * bfd-in2.h, libbfd.h: Rebuild.
- * cpu-arc.c, elf32-arc.c: New files.
- * elf.c (pre_headers): Recognize bfd_arch_arc.
-
-Tue Aug 12 11:45:18 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,final_link)): If no symbols, make sure the
- data section is correctly rounded to a page in the file.
-
-Mon Aug 11 12:45:43 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,final_link)): Don't emit the string table if
- there are no symbols.
-
-Sun Aug 10 14:45:56 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-stgo32.c: Rename from coff-stubgo32.c to avoid old System V
- file system 14 character limit.
- * Makefile.am: Corresponding changes.
- * configure.in: Corresponding changes.
- * Makefile.in: Rebuild.
- * configure: Rebuild.
-
-Fri Aug 8 18:34:36 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: (ALL_MACHINES_CFILES): Add elf32-d10v.c.
- Rebuild dependencies.
- * Makefile.in: Rebuild.
-
-Wed Aug 6 18:56:51 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (docdir): Define.
- * Makefile.in: Rebuild.
-
-Tue Aug 5 23:05:03 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * configure: Rebuild with autoconf 2.12.1.
-
-Mon Aug 4 12:00:35 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * aclocal.m4, configure: Rebuild with new automake patches.
-
-Sun Aug 3 08:15:12 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * rs6000-core.c (make_bfd_asection): New function to add a section
- to the core file bfd.
- (rs6000coff_core_p): Use make_bfd_asection to add the core file
- sections.
- Use BFD routines to seek, read and stat the core file.
- Handle .data sections from loaded objects and anonymously mmapped
- regions, these are available in AIX 4 core files.
-
-Fri Aug 1 12:58:32 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Set enable_shared before AM_PROG_LIBTOOL.
- * acinclude.m4: Move acmacros.m4 in here. Remove AM_PROG_LIBTOOL
- copy; use a patches libtool instead.
- * acmacros.m4: Remove.
- * Makefile.in: Rebuild.
- * aclocal.m4: Rebuild.
- * configure: Rebuild.
-
-Thu Jul 31 19:55:36 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: New file, based on old Makefile.in.
- * acmacros.m4: New file, copied from old aclocal.m4.
- * acinclude.m4: New file.
- * configure.in: Call AM_PROG_LIBTOOL. Remove shared library
- handling; now handled by libtool. Replace AC_CONFIG_HEADER with
- AM_CONFIG_HEADER. Replace AC_PROG_INSTALL with AM_PROG_INSTALL.
- Call AM_MAINTAINER_MODE, AM_CYGWIN32, and AM_EXEEXT. Change all
- .o files to .lo. Remove stamp-h handling in AC_OUTPUT.
- * acconfig.h: Mention PACKAGE and VERSION.
- * stamp-h.in: New file.
- * dep-in.sed: Change .o to .lo.
- * Makefile.in: Now built with automake.
- * aclocal.m4: Now built with aclocal.
- * config.in, configure: Rebuild.
- * VERSION: Remove.
-
-Thu Jul 31 12:09:20 1997 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Don't set TEXTREL
- if there is only a relocation to a read-only but not allocatable
- section (like .stab).
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-mips.c (mips_elf_size_dynamic_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
-
- * elf32-ppc.c (ppc_elf_howto_raw): Correct various comments.
- (ppc_elf_create_linker_section): These sections are not
- created by the linker (that is, they are created by the user
- putting data in them). In particular, they can be the source
- and target of relocations.
- (ppc_elf_adjust_dynamic_symbol): Check postcondition of
- bfd_elf32_link_record_dynamic_symbol. Align 16-byte common
- objects (for instance, 'long double') to 16-byte boundaries.
- (ppc_elf_size_dynamic_sections): Make the code that generates
- section symbols exactly the same as for sparc, reducing the
- number of section symbols output.
- (ppc_elf_check_relocs): Check postcondition of
- bfd_elf32_link_record_dynamic_symbol. Make default case the
- same as corresponding code for sparc, fixing bug involving
- .rela.stabs.
- (ppc_elf_finish_dynamic_symbol): Fix case involving GOT symbols
- forced to be local because of versioning (by replicating
- corresponding change in sparc). Treat R_PPC_RELATIVE RELA relocs
- as usual in ELF, not as pseudo-REL relocs (as the sparc linker
- does).
- (ppc_elf_relocate_section): Add handy debugging code for when
- assertion fails. Add some more 'symbol made local because of
- versioning' cases.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Cope with addend when
- processing a GOT relocation as required by ABI.
-
-Wed Jul 30 21:30:35 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elflink.h (NAME(bfd_elf,record_link_assignment)): Remove any
- version info if this symbol came from a dynamic object.
- (elf_link_add_object_symbols): Set the version info of a symbol
- only if the object actually contains version definitions and
- defines this symbol.
-
-Mon Jul 28 18:07:43 1997 Rob Savoye <rob@chinadoll.cygnus.com>
-
- * aclocal.m4: Add CYGWIN and EXEEXT autoconf macros.
- * configure.in: Use CYGWIN and EXEEXT autoconf macro to look for
- win32 dependencies.
- * configure: Regenerated with autoconf 2.12.
- * doc/Makefile.in: Add $(EXEEXT) to chew executable.
-
-Mon Jul 28 02:50:29 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * rs6000-core.c (rs6000coff_core_p): If CORE_TRUNC is set, print
- a warning rather than returning an error.
-
-Sun Jul 27 19:54:14 1997 Felix Lee <flee@cygnus.com>
-
- * coffswap.h (coff_swap_aux_in): add semicolon to make MSVC happy.
-
-Fri Jul 25 14:50:08 1997 Felix Lee <flee@cygnus.com>
-
- * cisco-core.c: define signals for wingdb.
-
-Fri Jul 25 16:27:07 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * ecofflink.c (bfd_ecoff_debug_accumulate): Only merge files with
- the same number of aux entries.
-
-Fri Jul 25 08:22:15 1997 Jeffrey A Law (law@cygnus.com)
-
- * som.c (hppa_som_gen_reloc_type): Use R_DATA_EXPR for the
- difference of two symbols if the relocation size is 32 bits.
- (som_write_fixups): Handle R_DATA_EXPR.
-
-Wed Jul 23 16:08:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i386.c (coff_i386_reloc): Don't offset a common symbol by
- its value if COFF_WITH_PE is defined.
-
-Tue Jul 22 17:19:45 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
-
- * coff-stubgo32.c: New file.
- * go32stub.h: New file.
- * coff-i386.c: If COFF_GO32_EXE, include coff/go32exe.h.
- * coffswap.h (coff_swap_filehdr_in): Invoke
- COFF_ADJUST_FILEHDR_IN_PRE and COFF_ADJUST_FILEHDR_IN_POST if they
- are defined.
- (coff_swap_filehdr_out): Invoke COFF_ADJUST_FILEHDR_OUT_PRE and
- COFF_ADJUST_FILEHDR_OUT_POST if they are defined.
- (coff_swap_aux_in): Invoke COFF_ADJUST_AUX_IN_PRE and
- COFF_ADJUST_AUX_IN_POST if they are defined.
- (coff_swap_aux_out): Invoke COFF_ADJUST_AUX_OUT_PRE and
- COFF_ADJUST_AUX_OUT_POST if they are defined.
- (coff_swap_scnhdr_in): Invoke COFF_ADJUST_SCNHDR_IN_PRE and
- COFF_ADJUST_SCNHDR_IN_POST if they are defined.
- (coff_swap_scnhdr_out): Invoke COFF_ADJUST_SCNHDR_OUT_PRE and
- COFF_ADJUST_SCNHDR_OUT_POST if they are defined.
- * targets.c (go32stubbedcoff_vec): Declare.
- (bfd_target_vector): Add go32stubbedcoff_vec.
- * configure.in (go32coff_vec): New target vector.
- (go32stubbedcoff_vec): Likewise.
- * config.bfd (i[3456]86-*-msdosdjgpp*): New target.
- (i[3456]86-*-go32*): Change to be like new msdosdjgpp*.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add coff-stubgo32.o.
- (BFD32_BACKENDS_CFILES): Add coff-stubgo32.c.
- (HFILES): Add go32stub.h.
-
-Tue Jul 22 15:09:12 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Check for fdopen.
- * configure, config.in: Rebuild.
- * opncls.c (bfd_fdopenr): Check HAVE_FDOPEN rather than VMS or
- __GO32__. Reindent a bit.
-
-Sun Jul 20 20:05:20 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_create_dynamic_sections): Set SEC_LINKER_CREATED
- flag for newly created sections.
- (sunos_add_dynamic_symbols): Don't discard newly created sections
- if shared library is dynobj.
-
-Mon Jul 14 15:33:55 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (map_sections_to_segments): When checking whether
- including a section in a segment would force us to skip a page,
- align the address of the next segment to avoid wraparound
- problems.
-
-Tue Jul 8 12:11:29 1997 Fred Fish <fnf@cygnus.com>
-
- * coffcode.h (coff_write_object_contents): Initialize
- target id field to TIC80_TARGET_ID.
- * coffswap.h (coff_swap_filehdr_out): Swap out target id field
- if used.
- (coff_swap_filehdr_in): Swap in target id field if used.
-
-Mon Jul 7 16:41:20 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i386.c (coff_i386_is_local_label_name): New static function
- if TARGET_UNDERSCORE.
- (coff_bfd_is_local_label_name): Define if TARGET_UNDERSCORE.
- (i386coff_vec): Add SEC_CODE and SEC_DATA to section_flags.
-
-Mon Jun 30 14:29:26 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-m68k.c (howto_table): Use complain_overflow_bitfield, not
- complain_overflow_signed, for 32 bit PC relative relocations.
-
-Thu Jun 26 01:26:31 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): When a version
- indirection symbol is overridden, make the original symbol point
- at the real overriding symbol.
-
- * elf.c (bfd_elf_string_from_elf_section): Check for an invalid
- string index.
-
- * elflink.h (elf_link_output_extsym): Use the right section for a
- common symbol.
- * elf32-mips.c (mips_elf_link_output_symbol_hook): If a common
- symbol was in .scommon, mark it as SHN_MIPS_SCOMMON.
-
-Wed Jun 25 12:43:10 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
-
- * elflink.h (elf_merge_symbols): Resolve indirect and warning
- symbols before checking for new symbols.
-
- * elfcore.h (elf_corefile_note): Move out of HAVE_SYS_PROCFS_H.
-
-Tue Jun 24 11:20:43 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coffgen.c (coff_object_p): Read the f_opthdr bytes from the
- file, not aoutsz bytes (they are different in XCOFF .o files).
-
- * xcofflink.c (xcoff_link_add_symbols): Permit symbols to be
- redefined by objects included from archives.
-
-Mon Jun 23 18:03:27 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_merge_symbol): In the case of a new defined
- symbol overriding an old defined symbol, return the hash table
- entry which we modify, even if it is the target of an
- indirection.
- (elf_link_add_object_symbols): If the real name of the symbol gets
- overridden, convert the versioned symbol into an indirect symbol
- to the real symbol.
-
- * elflink.h (elf_merge_symbol): New static function, broken out of
- elf_link_add_object_symbols.
- (elf_link_add_object_symbols): Call it.
-
-Sun Jun 22 19:40:57 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i386.c (i3coff_object_p): If COFF_IMAGE_WITH_PE, hack to
- handle case where COFF filehdr does not immediately follow PE
- header.
- * coffgen.c (coff_object_p): Remove useless seek to current
- location.
-
-Wed Jun 18 19:03:38 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * linker.c (link_action): Change COMMON_ROW/indr to from CREF to
- REFC.
-
-Tue Jun 17 11:55:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_link_input_bfd): If stripping debugging
- symbols, skip N_ABS symbols with debugging storage classes.
-
-Mon Jun 16 18:56:27 1997 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Don't emit R_PPC_REL*
- relocs in shared libraries which refer to local symbols. Cope
- with addend when processing a GOT relocation.
-
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Only create symbols
- for sections that the linker didn't create.
- (ppc_elf_finish_dynamic_sections): Only try to write out a section
- symbol if it was created in ppc_elf_size_dynamic_sections.
- (ppc_elf_relocate_section): Complain if we have to generate a reloc
- relative to a section for which we didn't output a symbol.
-
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Clean up. PLT
- relocs are 'rela' relocs, like everything else. .rela.plt is not
- a read-only section, so we don't have to special-case it.
-
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Entries in the
- .rela.bss section are (of course) 'rela' relocs not 'rel' relocs.
-
- * elf32-ppc.c (ppc_elf_check_relocs): Initialise srelgot.
- (ppc_elf_relocate_section): @got offsets are 4 from start of the
- actual .got section.
- * elflink.c (_bfd_elf_create_got_section): The three reserved
- words start from the symbol '_GLOBAL_OFFSET_TABLE_'.
-
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): '.rela' is 5
- characters, not 4.
-
- * elf32-ppc.c (ppc_elf_check_relocs): Use
- _bfd_elf_create_got_section to create the GOT rather than
- ppc_elf_create_linker_section. Create the '.rela.got' section
- ourselves.
- (ppc_elf_finish_dynamic_symbol): Set up GOT relocations when a
- symbol has a GOT entry.
- (ppc_elf_relocate_section): Record when a symbol is used through
- the GOT, and allocate space in the GOT for each such symbol.
- (ppc_elf_adjust_dynamic_symbol): Delete unused .got.plt stuff.
- (ppc_elf_create_linker_section): Delete unused LINKER_SECTION_GOT
- stuff.
-
- * elf32-ppc.c (ppc_elf_howto_raw): GOT16_HA relocs should be
- treated in a similar way to ADDR16_HA relocs.
- (ppc_elf_relocate_section): PLTREL24 relocs do not get copied into
- shared objects; the linker must deal with them.
- (ppc_elf_create_linker_section): Stop setting
- _GLOBAL_OFFSET_TABLE_ to the wrong value; delete unused
- LINKER_SECTION_PLT stuff.
- (ppc_elf_check_relocs): Delete unused LINKER_SECTION_PLT stuff.
- (ppc_elf_finish_dynamic_sections): Use BFD calls to get GOT
- section, not ELF-specific calls.
- (elf_backend_plt_not_loaded): Set to 1.
- (elf_backend_got_symbol_offset): Set to 4.
- * elf-bfd.h (elf_backend_data): Add 'plt_not_loaded' member
- for when ld.so fills in the PLT; and 'got_symbol_offset' member.
- * elflink.c (_bfd_elf_create_dynamic_sections): Apply
- plt_not_loaded member.
- (_bfd_elf_create_got_section): Apply got_symbol_offset.
- * elfxx-target.h (elf_backend_plt_not_loaded): Set default to
- 'loaded'.
- (elf_backend_G_O_T_offset): Set default to 0.
- (elfNN_bed): Set added fields.
-
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Was setting
- DT_RELENT in shared objects; should be DT_RELAENT.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Propagate
- R_PPC_ADDR16_HA relocs to shared objects. Cope with case where
- such a reloc (in a non-shared object) refers to a symbol that's
- not defined.
-
-Mon Jun 16 14:42:14 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
-
- * elfcode.h (put_signed_word): Define.
- (get_signed_word): Define.
- (elf_swap_reloca_in): Use get_signed_word for the r_addend field.
- (elf_swap_reloca_out): Use put_signed_word for the r_addend
- field.
- * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Use
- bfd_get_signed_32 to set the r_addend field.
- * elf64-mips.c (mips_elf64_swap_reloca_in): Use
- bfd_h_get_signed_64 to set the r_addend field.
-
-Mon Jun 16 12:31:29 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-i386.c (elf_i386_relocate_section): When generating a
- shared library, do the relocation if the input section is not
- allocated in memory.
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Call
- elf_link_assign_sym_version before elf_adjust_dynamic_symbol.
- (elf_fix_symbol_flags): New static function, broken out of
- elf_adjust_dynamic_symbol.
- (elf_adjust_dynamic_symbol): Call elf_fix_symbol_flags.
- (elf_link_assign_sym_version): Likewise. Permit a symbol to be
- forced local even if NEEDS_PLT is set. When forcing a symbol to
- be local, clear NEEDS_PLT.
- (elf_link_output_extsym): Remove unused local bed.
-
-Wed Jun 11 22:44:20 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c (elf32_mn10300_link_hash_entry): New structure
- for derived elf linker hash table entries. References to
- elf_link_hash_entry changed appropriately.
- (elf32_mn10300_link_hash_table): New structure for derived elf
- linker hash table.
- (elf32_mn10300_hash_table): Define.
- (elf32_mn10300_link_hash_traverse): Likewise.
- (elf32_mn10300_link_hash_newfunc): New function.
- (elf32_mn10300_link_hash_table_create): Likewise.
- (elf32_mn10300_finish_hash_table_entry): Likewise.
- (mn10300_elf_relax_section): Handle "call" -> "calls", removal
- of prologue code, and call:32->call:16 relaxing.
- (compute_function_info: New function.
- (bfd_elf32_bfd_ilink_hash_table_create): Define.
-
-Wed Jun 11 00:00:07 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_output_extsym): Call finish_dynamic_symbol
- for a symbol which is being forced to be local.
- * elf32-i386.c (elf_i386_relocate_section): Write out the
- relocation value for a GOT reloc for a symbol which is turning
- into a local symbol.
- (elf_i386_finish_dynamic_symbol): If a symbol is turning into a
- local symbol, write out a RELATIVE reloc rather than a GLOB_DAT
- reloc.
- * elf32-m68k.c, elf32-sparc.c: Corresponding changes.
-
- * elf32-i386.c (elf_i386_relocate_section): Get the relocation
- value if the symbol is turning into a local symbol.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
-1997-06-10 22:58 Ulrich Drepper <drepper@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Also read verneed
- information by calling `_bfd_elf_slurp_version_tables'.
- (elf_link_add_object_symbols): For undefined symbols look for
- version information in the verneed records.
- (elf_link_add_object_symbols): Use soname of shared object
- for verneed record if it is available.
-
-Tue Jun 10 11:13:03 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
-
- * cpu-arm.c: Add prototypes for compatible and scan.
- * cofflink.c: Add prototype for mark_relocs.
-
- * archive.c (bfd_special_undocumented_glue): Change filename to
- const pointer. Add prototype.
-
-Mon Jun 9 12:34:21 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elflink.h (elf_link_add_object_symbols): Ignore relocations of
- sections that will be discarded.
-
-1997-06-06 22:58 Ulrich Drepper <drepper@cygnus.com>
-
- * elflink.h (elf_link_find_version_dependencies): When searching
- for known version symbol skip non-matching verdef records, not
- matching records.
-
-Thu Jun 5 15:52:45 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Write a long,
- not a bfd_vma, to the base file, to match how dlltool reads it.
-
-Tue Jun 3 16:57:45 1997 Nick Clifton <nickc@cygnus.com>
-
- * reloc.c: Add thumb relocations.
-
- * bfd-in2.h: Add Thumb relocations.
-
- * libbfd.h: Add Thumb relocations.
-
-Mon Jun 2 10:41:52 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * cpu-m68k.c (arch_info_struct): Fix 68060 cpu name.
-
-Fri May 30 12:46:27 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Set dynindx
- for a section even if it is not loaded.
-
- * cofflink.c (coff_link_add_symbols): If PE file, don't subtract
- section VMA.
- (_bfd_coff_link_input_bfd): Separate section VMA handling for
- input and output files.
- (_bfd_coff_generic_relocate_section): Check whether input file,
- not output file, is a PE file.
-
-Wed May 28 15:48:43 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c: (coff_arm_bfd_set_private_flags): Make static.
-
-Wed May 28 16:16:04 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i386.c (coff_i386_reloc): Don't just exit if we see an
- R_IMAGEBASE reloc.
-
-Wed May 28 09:48:43 1997 Nick Clifton <nickc@cygnus.com>
-
- * cpu-arm.c (compatible): Add test for supersets of ARM
- architectures.
-
-Tue May 27 19:42:03 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * cofflink.c (_bfd_coff_final_link): Initialize global_to_static
- member.
-
-Tue May 27 14:34:08 1997 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (coff_arm_bfd_set_private_flags): Make global. It is
- called directly by gas/config/tc-arm.c.
-
-Tue May 27 15:58:53 1997 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c (PLT_ENTRY_*): Use a new thread-safe format.
- (elf64_alpha_finish_dynamic_symbol): Fill it in properly.
-
-Mon May 26 14:05:13 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-ppc.c (coff_ppc_relocate_section): If PE file, don't add
- section VMA.
-
-Mon May 26 10:57:48 1997 Fred Fish <fnf@cygnus.com>
-
- * peicode.h (coff_bfd_print_private_bfd_data): #undef before #define.
- (coff_bfd_copy_private_bfd_data): Ditto.
- * coff-arm.c (coff_arm_bfd_merge_private_bfd_data): Make static.
- (coff_arm_bfd_print_private_bfd_data): Ditto.
- (coff_arm_bfd_set_private_flags): Ditto.
- (coff_arm_bfd_copy_private_bfd_data): Ditto.
-
-Fri May 23 15:14:58 1997 Fred Fish <fnf@cygnus.com>
-
- * libcoff-in.h (struct coff_final_link_info): Add boolean
- global_to_static member for support of task linking.
- (_bfd_coff_write_task_globals): Add prototype.
- * libcoff.h: Regenerate.
- * coffcode.h (coff_write_object_contents): Use #ifdef to
- check RS6000COFF_C, to be consistent with all other uses
- in this file.
- * cofflink.c (_bfd_coff_final_link): If doing task linking,
- call _bfd_coff_write_task_globals.
- (_bfd_coff_link_input_bfd): If doing task linking, convert
- global functions to static.
- (_bfd_coff_write_global_sym): If doing task linking, convert
- global variables to static.
- (_bfd_coff_write_task_globals): New function.
- * coff-tic80.c (TIC80COFF): Define this instead of just TIC80.
- (C_AUTOARG): #undef since it clashes with C_UEXT.
- (C_LASTENT): #undef since it clashes with C_STATLAB.
- * coffcode.h (coff_write_object_contents): Use TIC80COFF
- rather than TIC80.
- (coff_slurp_symbol_table): Use C_SYSTEM. Hide C_AUTOARG use
- when TIC80COFF defined (clashes with C_UEXT). Explicitly
- recognize C_UEXT, C_STATLAB, and C_EXTLAB as unsupported.
-
-Fri May 23 12:38:24 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-tic80.c (tic80_howto_table): Change overflow check for most
- PP relocations to complain_overflow_dont.
-
-Thu May 22 20:22:14 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-tic80.c (tic80_howto_table): Add PP relocations. Change
- name of R_RELLONG to "RELLONG". Set rightshift and complain for
- M_PPCR.
- (ppbase_reloc, glob15_reloc): New static functions.
- (glob16_reloc, local16_reloc): New static functions.
- (rtype2howto): Handle all relocation types.
- (coff_tic80_relocate_section): New static function.
- (coff_relocate_section): Define to coff_tic80_relocate_section.
- * Makefile.in (coff-tic80.o): Depends upon include/coff/tic80.h.
-
-Wed May 21 17:15:50 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_slurp_symbol_table): If COFF_WITH_PE or
- COFF_IMAGE_WITH_PE, don't subtract the section VMA from the symbol
- value.
- * coffgen.c (fixup_symbol_value): Add abfd parameter. Change all
- callers. If PE file, don't add section VMA.
- (coff_write_alien_symbol): If PE file, don't add section VMA.
- * cofflink.c (_bfd_coff_link_input_bfd): Likewise.
- (_bfd_coff_write_global_sym): Likewise.
- (_bfd_coff_generic_relocate_section): Likewise.
-
- * peicode.h: Add & 0xffffffff when using ImageBase in case bfd_vma
- is 64 bits.
-
-Wed May 21 09:58:10 1997 Nick Clifton <nickc@cygnus.com>
-
- * cofflink.c (mark_relocs): Add new function to mark symbols which
- are used by relocations.
- (_bfd_coff_link_input_bfd): Add call to mark_relocs() and code to
- suppress the skipping of symbols that have thus been marked.
-
-Tue May 20 18:45:26 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (sh_merge_private_data): New static function.
- (coff_bfd_merge_private_bfd_data): Define.
-
-Mon May 19 14:46:00 1997 Mark Alexander <marka@cygnus.com>
-
- * coff-tic80.c: Remove unnecessary #ifdefs.
- * config.bfd: Set targ_underscore to yes for tic80.
-
-Mon May 19 14:26:36 1997 Mark Alexander <marka@cygnus.com>
-
- * coff-tic80.c (NAMES_HAVE_UNDERSCORE): Define (fixes problem
- with unresolved external symbols in GDB).
-
-Fri May 16 10:23:03 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf-m10300.c (elf32_mn10300_relax_section): Read in all
- the symbols associated with each BFD.
- (mn10300_elf_relax_delete_bytes): Don't adjust the same symbol
- more than once.
- * elf-m10200.c: Likewise.
- * elf32-m32r.c: Likewise.
- * elf32-sh.c: Likewise.
-
-Fri May 16 12:10:52 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't decrease the
- alignment of a common symbol. If two symbols that look like
- common symbols are found in two shared libraries, and the size is
- different, use the larger size, and warn if --warn-common. If a
- common symbol overrides a definition in a shared library, set the
- size to the larger size, and warn if --warn-common.
-
-Thu May 15 14:31:28 1997 Nick Clifton <nickc@cygnus.com>
-
- * cpu-arm.c (compatible): Allow default machine to be polymorphed
- into any other machine type.
-
- * coffcode.h (coff_set_flags): Initialise flags variable to 0.
-
- * coff-arm.c (coff_arm_bfd_merge_private_bfd_data): When merging
- data into an unitialised destination set its machine type as well.
-
-Thu May 15 16:40:20 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Force ELF symbol size
- to common symbol size. Consistently treat uninitialized symbols
- in shared objects as common symbols.
-
-Fri May 9 10:15:27 1997 Nick Clifton <nickc@cygnus.com>
-
- * archures.c (constants): Added new constants to identify the
- type of the ARM architecture: bfd_mach_arm_2, bfd_mach_arm_2a,
- bfd_mach_arm_3, bfd_mach_arm_3M, bfd_mach_arm_4 and bfd_mach_arm_4T.
-
- * bfd-in2.h (constants): Added new constants to identify
- the type of the ARM architecture: bfd_mach_arm_2, bfd_mach_arm_2a,
- bfd_mach_arm_3, bfd_mach_arm_3M, bfd_mach_arm_4 and
- bfd_mach_arm_4T. This file is auto-magically generated from the
- archures.c file. This update is just to save work.
-
- * coff-arm.c (coff_arm_bfd_merge_private_bfd_data,
- coff_arm_bfd_print_private_bfd_data,
- coff_arm_bfd_set_private_flags,
- coff_arm_bfd_copy_private_bfd_data): Added these new functions.
- (global): Macro redefinitions set up to use these new functions.
-
- * coffcode.h (coff_mkobject_hook): Added call to
- coff_arm_bfd_set_private_flags().
- (coff_set_arch_mach_hook): Added code to set machine type based on
- bits stored in internal flags.
- (coff_set_flags): Added code to set the new bits in the flags
- field based on the machine number.
- (function definition macros): Made all function definition macros
- conditional so that they can be overridden by target specific
- files.
-
- * cpu-arm.c (compatible): Added this function. (arch_info_struct):
- Structure extended to include new types, one each for ARMv2,
- ARMv2a, ARMv3, ARMv3M, ARMv4 and ARMv4T.
-
- * libcoff-in.h (struct coff_tdata): Added flags field.
-
-Fri May 9 17:40:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * config.bfd (i[3456]86-*-gnu*): Don't include Mach support.
-
- * config.bfd: Change #if 0 around uses of host_aout_vec to #if
- HAVE_host_aout_vec.
-
-Mon May 5 13:57:32 1997 Mike Meissner <meissner@cygnus.com>
-
- * coffgen.c (coff_find_nearest_line): If there are no syments,
- just return false.
-
-Mon May 5 18:18:45 1997 Philip Blundell <pjb27@cam.ac.uk>
-
- * config.bfd: cope with '*-*-linux-gnuaout' targets.
-
-Thu May 1 11:31:12 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * targmatch.sed: Add explicit \n characters to work around bug in
- HP/UX 10.20 sed program.
-
-Wed Apr 30 12:27:03 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (copy_private_bfd_data): Cast csecs to avoid sign
- extension problems.
-
-Tue Apr 22 12:06:08 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (do_maintainer_clean): Don't remove bfd-in2.h.
-
-Mon Apr 21 11:21:31 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf32-m68k.c: Follow the last changes in elf32-i386.c:
- (struct elf_m68k_pcrel_relocs_copied, struct
- elf_m68k_link_hash_entry, struct elf_m68k_link_hash_table,
- elf_m68k_link_hash_traverse, elf_m68k_hash_table,
- elf_m68k_link_hash_newfunc, elf_m68k_link_hash_table_create,
- elf_m68k_discard_copies, bfd_elf32_bfd_link_hash_table_create):
- New definitions.
- (elf_m68k_check_relocs): If linking with -Bsymbolic, don't copy
- PC relative relocs for a global symbol defined in a regular
- object, and count the number of PC relative relocs copied for any
- global symbol.
- (elf_m68k_size_dynamic_sections): If linking with -Bsymbolic,
- traverse with elf_m68k_discard_copies.
-
-Sat Apr 19 22:50:14 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-i386.c (elf_i386_check_relocs): Only count PC relative
- relocs. From Jamie Lokier <jamie@rebellion.co.uk>.
-
- * coffcode.h (coff_compute_section_file_positions): Force the
- potential last byte in the file to be written out when
- COFF_IMAGE_WITH_PE.
-
-Thu Apr 17 13:46:56 1997 Per Fogelstrom <pefo@openbsd.org>
-
- * configure.host (mips*-*-openbsd*): New host.
-
-Thu Apr 17 11:10:54 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Only subtract the
- section VMA from the symbol value if this is a fully linked file.
-
- * elf32-i386.c (struct elf_i386_pcrel_relocs_copied): Define.
- (struct elf_i386_link_hash_entry): Define.
- (struct elf_i386_link_hash_table): Define.
- (elf_i386_link_hash_traverse): Define.
- (elf_i386_hash_table): Define.
- (elf_i386_link_hash_newfunc): New static function.
- (elf_i386_link_hash_table_create): New static function.
- (elf_i386_check_relocs): If linking with -Bsymbolic, don't copy
- PC relative relocs for a global symbol defined in a regular
- object, and count the number of PC relative relocs copied for any
- global symbol.
- (elf_i386_size_dynamic_sections): If linking with -Bsymbolic,
- traverse with elf_i386_discard_copies.
- (elf_i386_discard_copies): New static function.
- (bfd_elf32_bfd_link_hash_table_create): Define.
-
- From Gordon W. Ross <gwr@mc.com>:
- * aoutf1.h (MY_entry_is_text_address): Define if not defined.
- (sunos4_aout_backend): Use MY_entry_is_text_address.
-
-Wed Apr 16 12:43:32 1997 Martin Hunt <hunt@cygnus.com>
-
- * elf32-d30v.c (elf_d30v_howto_table): Changed size of
- R_D30V_32_NORMAL to 2 (4 bytes).
-
-Wed Apr 16 14:02:29 1997 Ian Lance Taylor <ian@cygnus.com>
-
- From Gordon W. Ross <gwr@mc.com>:
- * netbsd.h (N_SHARED_LIB): Define.
- (SEGMENT_SIZE): Don't define.
- * m68knetbsd.c (SEGMENT_SIZE): Don't define (revert change of
- April 11).
- * sparcnetbsd.c (TARGET_PAGE_SIZE): Define as 0x2000.
- (SEGMENT_SIZE): Don't define.
-
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Set .rela.bss size
- to sizeof Rela structure, not sizeof Rel structure. From Gary
- Thomas <g.thomas@opengroup.org>.
-
-Tue Apr 15 11:50:37 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * aout-target.h (MY(callback)): If entry_is_text_address, adjust
- whenever entry is larger than text address, but only by whole
- pages. From Gordon W. Ross <gwr@mc.com>.
-
- * Makefile.in (install): Depend upon installdirs. Use
- mkinstalldirs to build $(oldincludedir).
- (installdirs): New target.
-
- * elflink.h (elf_link_add_object_symbols): Don't call check_relocs
- if this is a debugging section which we are stripping.
-
-Mon Apr 14 12:39:30 1997 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c (elf64_alpha_object_p): Allocate the
- alpha-specific target data struct.
-
-Mon Apr 14 11:45:46 1997 Ian Lance Taylor <ian@cygnus.com>
-
- From Thomas Graichen <graichen@rzpd.de>:
- * Makefile.in: Always use $(SHELL) when running move-if-change.
- * configure.in: Use ${CONFIG_SHELL} when running $ac_config_sub.
- * configure: Rebuild.
-
-Fri Apr 11 15:43:24 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_slurp_symbol_table): Only subtract the section
- VMA if this is an executable file or a shared object.
-
- * targets.c (netbsd_core_vec): Declare. From Gordon W. Ross
- <gwr@mc.com>.
-
- * libaout.h (struct aout_backend_data): Add entry_is_text_address
- field.
- * aout-target.h (SEGMENT_SIZE): Define to TARGET_PAGE_SIZE at the
- start of the file. Remove uses later on which switch using
- ifdef.
- (MY(callback)): Handle entry_is_text_address.
- (MY_entry_is_text_address): Define if not defined.
- (MY(backend_data)): Initialize new field.
- * aoutf1.h (sunos4_aout_backend): Likewise.
- * i386aout.c (MY(backend_data)): Likewise.
- * i386mach3.c (MY(backend_data)): Likewise.
- * mipsbsd.c (MY(backend_data)): Likewise.
- * sparclynx.c (sparclynx_aout_backend): Likewise.
- * netbsd.h (SEGMENT_SIZE): Define if not defined.
- (MY_entry_is_text_address): Define.
- * m68knetbsd.c (SEGMENT_SIZE): Define as 0x20000.
-
- * xcofflink.c (bfd_xcoff_import_symbol): Handle importing a symbol
- whose name starts with `.'.
-
-Fri Apr 11 11:57:15 1997 Niklas Hallqvist <niklas@appli.se>
-
- * config.bfd: (i[3456]86-*-openbsd*, m68*-*-openbsd*,
- mips*el*-*-openbsd*, mips*-*-openbsd*, ns32k-*-openbsd*,
- powerpc-*-*bsd*, sparc-*-openbsd*): New targets.
- * configure.in (i[3456]86-*-openbsd*, mips*-*-openbsd*,
- m68*-*-openbsd*, ns32k-*-openbsd*, powerpc-*-*bsd*,
- sparc-*-openbsd*): New targets.
- * configure: Rebuild.
-
-Tue Apr 8 18:09:29 1997 Jamie Lokier <jamie@rebellion.co.uk>
-
- * stabs.c (struct stab_section_info): New field
- `cumulative_skips'.
- (_bfd_link_section_stabs): Fill the above array.
- (_bfd_stab_section_offset): Use `cumulative_skips' to
- speed up offset calculation.
-
-Tue Apr 8 00:01:31 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf-mn10300.c (mn10300_elf_relax_section): Don't forget the
- addend for non pc-relative relocations.
-
- * elf-m10300.c (bfd_elf32_mn10300_reloc): Remove prototype
- for non-existent function.
-
- * elf-m10300.c (mn10300_elf_relax_section): New function.
- (mn10300_elf_relax_delete_bytes): Likewise.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- (bfd_elf32_bfd_relax_section): Define.
- (bfd_elf32_bfd_get_relocated_section_contents): Likewise.
-
-Mon Apr 7 16:47:09 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Set SHLIB_LIBS.
- * configure.in: Substitute SHLIB_LIBS.
- * configure: Rebuild.
- * Makefile.in (SHLIB_LIBS): New variable.
- ($(SHLIB)): Use $(SHLIB_LIBS).
-
-Mon Apr 7 10:53:52 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
-
- * bfd-in.h bfd-in2.h: add bfd_section_lma macro to correspond
- with bfd_section_vma.
-
-Fri Apr 4 11:37:15 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Update file names for bfd_elf32_mn10[23]00_vec.
- Correct CPU file names for mn10[23]00.
- * configure: Rebuild.
-
- * bfd.c (bfd_record_phdr): Cast count to size_t before
- subtraction.
-
- * coff-ppc.c (dump_toc): Add cast to avoid warning from SunOS cc.
- * coff-rs6000.c (xcoff_read_ar_hdr): Likewise.
- (xcoff_write_archive_contents): LIkewise.
- * elf32-mips.c (_bfd_mips_elf_set_section_contents): Likewise.
- (mips_elf_create_procedure_table): Likewise.
- * peicode.h (pe_print_idata): Likewise.
- (pe_print_edata, pe_print_pdata, pe_print_reloc): Likewise.
- * xcofflink.c (xcoff_get_section_contents): Likewise.
- (_bfd_xcoff_canonicalize_dynamic_symtab): Likewise.
- (xcoff_link_add_symbols): Likewise.
- (xcoff_link_add_symbols): Likewise.
-
- * ppcboot.c (ppcboot_set_arch_mach): Make static.
- (ppcboot_bfd_print_private_bfd_data): Likewise.
-
- * elf32-mips.c (elf_mips_ctor64_howto): Set complain_on_overflow
- to complain_overflow_signed.
-
-Thu Apr 3 11:51:54 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * VERSION: Set to 2.8.1.
-
- * Branched binutils 2.8.
-
- * elf32-ppc.c (ppc_elf_check_relocs): Don't check SEC_ALLOC when
- deciding whether to copy a reloc into a shared object.
- (ppc_elf_relocate_section): Likewise. Relocate R_PPC_RELATIVE
- relocs in unallocated sections.
- * elf32-sparc.c (elf32_sparc_relocate_section): Relocate
- R_SPARC_RELATIVE relocs in unallocated sections.
-
-Wed Apr 2 16:19:41 1997 Mike Meissner <meissner@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_check_relocs): Undo March 26 change and
- always create got section so that the _GLOBAL_OFFSET_TABLE_ label
- is always created.
-
-Wed Apr 2 10:49:07 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Let a common symbol
- override an uninitialized symbol from a shared library with a
- smaller size.
-
- * elf-m10200.c: Rename from elf32-mn10200.c.
- * elf-m10300.c: Rename from elf32-mn10300.c.
- * cpu-m10200.c: Rename from cpu-mn10200.c
- * cpu-m10300.c: Rename from cpu-mn10300.c
- * Makefile.in: Update accordingly.
-
- * elf32-mips.c (elf_mips_ctor64_howto): New static variable.
- (elf_mips_isa): Move to earlier in file.
- (mips_reloc_map): Remove BFD_RELOC_CTOR entry.
- (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_CTOR
- specially.
-
- * elf32-mips.c (mips16_jump_reloc): Print a warning rather than
- calling abort.
-
-Tue Apr 1 16:18:05 1997 Klaus Kaempf <kkaempf@progis.de>
-
- * configure.com: New file.
- * config.h-vms: Remove file.
- * makefile.vms: Update for new configure scheme.
-
-Mon Mar 31 23:28:39 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
-
- * libcoff-in.h (ppc_allocate_toc_section): Declare.
- (ppc_process_before_allocation): Declare.
- * libcoff.h: Rebuild.
-
- * coffcode.h (coff_mkobject_hook): Declare if not a macro.
-
-Mon Mar 31 16:29:50 1997 Joel Sherrill <joel@oarcorp.com>
-
- * config.bfd (hppa*-*-rtems*): New target, like hppa-*-*elf*.
-
-Mon Mar 31 16:11:35 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-a29k.c (coff_a29k_relocate_section): Don't use symndx as a
- symbol index for a R_IHCONST reloc.
-
-Mon Mar 31 15:40:59 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
-
- * targmatch.sed: Do not use \(\) recursively.
-
-Fri Mar 28 14:44:08 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
-
- * m68klinux.c (MACHTYPE_OK): Define.
- * i386linux.c (MACHTYPE_OK): Define.
-
-Fri Mar 28 11:56:15 1997 Ian Lance Taylor <ian@cygnus.com>
-
- From David S. Miller <davem@caip.rutgers.edu> and H.J. Lu
- <hjl@gnu.ai.mit.edu>:
- * sparclinux.c: New file.
- * bfd-in.h (bfd_sparclinux_size_dynamic_sections): Declare.
- * bfd-in2.h: Rebuild.
- * config.bfd (sparc-*-linuxaout*, sparc-*-linux*): New targets.
- * configure.in (sparclinux_vec): Add to list of vectors.
- * configure: Rebuild.
- * targets.c (sparclinux_vec): Declare.
- (bfd_target_vector): Add sparclinux_vec.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add sparclinux.o.
- (BFD32_BACKENDS_CFILES): Add sparclinux.c.
-
- * coff-mips.c (mips_ecoff_backend_data): Initialize new
- bfd_coff_backend_data field.
- * coff-alpha.c (alpha_ecoff_backend_data): Likewise.
-
- * config.bfd: Add bfd_elf64_{big,little}mips_vec to targ_selvecs
- for mips*el*-*-linux* and mips*-*-linux*. From H.J. Lu
- <hjl@lucon.org> and Ralf Baechle <ralf@gnu.ai.mit.edu>.
-
- * bfd.c: Include "libiberty.h".
- (strerror): Don't declare.
- (bfd_errmsg): Call xstrerror rather than strerror.
-
-Thu Mar 27 12:55:42 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Generate a COPY
- reloc even if the symbol is in the .bss section.
- * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
-
- * coffcode.h (bfd_coff_backend_data): Add new field
- _bfd_coff_default_section_alignment_power.
- (bfd_coff_default_section_alignment_power): Define.
- (bfd_coff_std_swap_table): Initialize new field.
- * libcoff.h: Rebuild.
- * cofflink.c (coff_link_add_symbols): Limit alignment of a common
- symbol to the default section alignment.
-
- * COPYING: Update FSF address.
-
-Thu Mar 27 00:45:57 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * elf32-d30v.c (elf_d30v_howto_table): Fix a typo in the
- 21-bit absolute that made it act as a relative.
-
-Wed Mar 26 14:50:20 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.c (_bfd_elf_create_linker_section): Don't set
- bss_section and rel_section from existing sections.
-
- * elf32-ppc.c (ppc_elf_check_relocs): Only create the got section
- if it is needed.
-
-Tue Mar 25 22:26:56 1997 Stu Grossman (grossman@critters.cygnus.com)
-
- * aoutx.h (some_aout_object_p): Change executable test to fix
- problems with embedded a.out systems.
-
-Tue Mar 25 14:35:37 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * stabs.c (_bfd_stab_section_offset): New function.
- * libbfd-in.h (_bfd_stab_section_offset): Declare.
- * libbfd.h: Rebuild.
- * elf32-i386.c (elf_i386_relocate_section): Adjust the offset of a
- stab reloc.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
-
- * stabs.c (_bfd_link_section_stabs): Copy over the first header
- symbol. Check for memory allocation failure of *psinfo.
- (_bfd_write_section_stabs): Add psinfo parameter. Change all
- callers. Set the value of the header symbol.
- * libbfd-in.h (_bfd_write_section_stabs): Update declaration.
- * libbfd.h: Rebuild.
-
-Mon Mar 24 20:07:29 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-tic80.c (tic80_howto_table): Add R_ABS entry.
- (rtype2howto): Handle R_ABS reloc type. Also abort on unhandled
- reloc types, rather than silently failing to generate an output file.
-
-Mon Mar 24 13:41:00 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * targmatch.sed: Use the hold space to put the #ifdef around the
- the string constant.
- * targets.c (UNSUPPORTED_TARGET): Don't define.
- (find_target): Don't check for UNSUPPORTED_TARGET.
- (bfd_set_default_target): Don't try to optimize by checking for
- default.
-
- * Makefile.in: Rebuild dependencies.
- (ALL_MACHINES_CFILES): Add cpu-m32r.c.
- (BFD32_BACKENDS_CFILES): Add elf32-m32r.c.
- (elf32-m32r.o): Remove explicit target.
-
- * config.bfd: Don't set targ_underscore for i[3456]86-*-gnu* or
- i[3456]86-*-linux*.
-
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Don't
- count section symbols for sections that were created by the
- linker, or are not allocatable or not loadable.
- (elf32_sparc_finish_dynamic_sections): Output output section
- symbols for section for which we made space for them.
-
-Fri Mar 21 13:08:26 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): If there is
- no .rela.plt section, don't output a DT_PLTGOT dynamic entry.
-
-Fri Mar 21 12:36:46 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * elf32-m32r.c (m32r_elf_howto_table): Use special function for LO16.
- (m32r_hi16_list): New static local.
- (m32r_elf_hi16_reloc): Don't perform reloc, just queue it up.
- (m32r_elf_do_hi16_reloc): Delete.
- (m32r_elf_relocate_hi16): New function.
- (m32r_elf_lo16_reloc): New function.
- (m32r_elf_relocate_section): For HI16 relocs, scan for corresponding
- LO16 reloc.
-
- Mon Mar 10 16:03:31 1997 Doug Evans <dje@seba.cygnus.com>
-
- * elf32-m32r.c (m32r_elf_create_linker_section): Delete.
- (m32r_elf_add_symbol_hook): Rewrite _SDA_BASE_ support.
- (m32r_elf_final_sda_base): New function.
- (m32r_elf_relocate_section): Rewrite sdata support.
- (m32r_elf_finish_dynamic_sections): Delete.
-
-Thu Mar 20 12:39:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- Based on patches from Philippe De Muyter <phdm@info.ucl.ac.be>.
- * coff-svm68k.c: New file. Just defines some macros and includes
- coff-m68k.c.
- * coff-m68k.c: Add functions to handle common addends, moved in
- from cf-m68klynx.c. Control them using COFF_COMMON_ADDEND macro.
- Control whether relocs are visible using STATIC_RELOCS.
- * cf-m68klynx.c: Simplify greatly: just define macros to control
- coff-m68k.c.
- * coff-aux.c: Likewise. Just leave add_one_symbol routine.
- * targets.c (m68ksysvcoff_vec): Declare.
- (bfd_target_vector): Add m68ksysvcoff_vec.
- * config.bfd (m68*-motorola-sysv*): New target.
- * configure.in (m68ksysvcoff_vec): New vector.
- * configure: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add coff-svm68k.o.
- (BFD32_BACKENDS_CFILES): Add coff-svm68k.c.
-
- * binary.c (binary_set_section_contents): Don't get misled if the
- first section is not loadable. From Matthew L. Martin
- <mlm@xedia.com>.
-
- * elflink.h (elf_bfd_final_link): Set the value of a section
- symbol to the section address unless doing a relocateable link.
-
-Tue Mar 18 23:03:17 1997 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't create
- .plt entry if we've taken the function's address.
- (elf64_alpha_merge_gots): Merge collected flags info as well.
-
-Tue Mar 18 22:40:09 1997 H.J. Lu <hjl@lucon.org>
-
- * Many files: Add function prototypes.
- * cpu-m68k.c (bfd_default_scan_num_mach): Don't declare.
- * ecofflink.c: Include "libcoff.h" and "libecoff.h".
- * elf32-ppc.c (ppc_elf_fake_sections): Make static.
- * opncls.c (bfd_openstreamr): Change stream parameter to PTR.
- * peicode.h: Change several void * parameters to PTR.
- * srec.c (srec_get_symbol_info): Make static.
- * syms.c (bfd_symbol_is_absolute): Remove.
- * Makefile.in: Rebuild dependencies.
-
-Tue Mar 18 12:58:08 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-m32r.c (m32r_elf_is_local_label_name): Remove.
- (bfd_elf32_bfd_is_local_label): Don't define.
-
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Call bfd_malloc rather
- than malloc.
-
-Mon Mar 17 11:32:53 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd-in.h: Don't include obstack.h.
- (struct bfd_hash_table): Change memory field to PTR.
- * bfd.c (struct _bfd): Change memory field to PTR.
- * bfd-in2.h: Rebuild.
- * libbfd-in.h (bfd_release): Declare as function, don't define as
- macro.
- * libbfd.h: Rebuild.
- * opncls.c: Include "objalloc.h" rather than "obstack.h". Use
- objalloc routines rather than obstack routines.
- (obstack_chunk_alloc, obstack_chunk_free): Don't define.
- (getpagesize): Don't define.
- (_bfd_new_bfd): Don't set _bfd_chunksize.
- (bfd_openr): Free new bfd and objalloc on failure.
- (bfd_fdopenr, bfd_openstreamr, bfd_openw): Likewise.
- (bfd_alloc_size): Remove.
- (bfd_release): New function.
- * hash.c: Include "objalloc.h" rather than "obstack.h". Use
- objalloc routines rather than obstack routines.
- (obstack_chunk_alloc, obstack_chunk_free): Don't define.
- * ecofflink.c: Include "objalloc.h" rather than "obstack.h". Use
- objalloc routines rather than obstack routines.
- (obstack_chunk_alloc, obstack_chunk_free): Don't define.
- (struct accumulate): Change memory to struct objalloc *.
- * liboasys.h (oasys_data_type): Remove oasys_obstack field.
- * dep-in.sed: Don't remove obstack.h from dependency list.
- * Makefile.in: Rebuild dependencies.
- (BFD_H_DEPS): Remove obstack.h.
- (install): Don't install obstack.h.
- * Many files: Don't include "obstack.h".
- * VERSION: Bump.
-
- * opncls.c (bfd_alloc_grow, bfd_alloc_finish): Remove.
- * libbfd-in.h (bfd_alloc_grow, bfd_alloc_finish): Don't declare.
- * libbfd.h: Rebuild.
- * ieee.c (ieee_archive_p): Rewrite to not use bfd_alloc_grow.
- * sunos.c (sunos_add_dynamic_symbols): Likewise.
- * srec.c (srec_scan): Rewrite to not use obstack_1grow.
-
- * opncls.c (bfd_alloc): Rename from bfd_alloc_by_size_t. Remove
- old version of bfd_alloc.
- * libbfd-in.h (bfd_alloc_by_size_t): Don't declare.
- * libbfd.h: Rebuild.
- * Several files: Call bfd_alloc rather than bfd_alloc_by_size_t.
-
-Sat Mar 15 15:24:18 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_is_local_label_name): Accept the generic
- ELF local label syntax as well.
-
-Sat Mar 15 10:16:42 1997 Fred Fish <fnf@cygnus.com>
-
- * config.bfd (powerpc-*-beos*): New target.
- * configure.in (powerpc-*-beos*): Add case that explicitly
- does not set COREFILE for now. A future BeOS version is
- expected to support core files.
- * configure: Regenerate with autoconf.
-
-Fri Mar 14 16:43:22 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_check_relocs): Give an error if CALL16 is
- seen with a local symbol, rather than crashing.
-
- * elfcode.h (elf_slurp_symbol_table): Don't try to read the
- version symbols if there aren't any.
-
-Thu Mar 13 16:38:30 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-tic80.c (coff_rtype_to_howto): Define
- (coff_tic80_rtype_to_howto): Clone generic coff version and
- add code to handle the funky TI "internal relocations".
-
-Thu Mar 13 14:08:53 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't warn about type
- or size changes because of a weak symbol.
-
- * cisco-core.c (SIGEMT): Define if not defined.
-
-Wed Mar 12 21:36:05 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Use extsymoff when
- setting ever. Sanity check the version number. Sort out copying
- flags and other information when adding an indirect symbol.
- (NAME(bfd_elf,size_dynamic_sections)): Preserve any dynamic
- symbols added by the backend. Clear the entire contents of the
- versym section.
- (elf_export_symbol): Ignore indirect symbols.
- (elf_link_output_extsym): Accept a section without an owner in an
- assert.
- * elfcode.h (elf_slurp_symbol_table): Add a sanity check on the
- version count. Correct the allocation of x_versymp.
-
- * elf32-mips.c (mips_elf_add_symbol_hook): Don't set the owner of
- the magic sections used for SHN_MIPS_TEXT and SHN_MIPS_DATA.
- Don't return bfd_und_section_ptr when info->shared.
- (mips_elf_final_link): Set the alignment of .rtproc to 4, not 12.
- (mips_elf_create_dynamic_sections): Correct type: ^= for &=.
- (mips_elf_check_relocs): Resolve an indirect symbol in
- sym_hashes.
- (mips_elf_finish_dynamic_symbol): Don't change SHN_ABS into
- SHN_MIPS_TEXT or SHN_MIPS_DATA.
-
- * elf.c (bfd_elf_print_symbol): Tweak version output slightly.
-
-Tue Mar 11 01:38:36 1997 Ian Lance Taylor <ian@cygnus.com>
-
- From Eric Youngdale <eric@andante.jic.com>:
- * elf-bfd.h (ELF_LINK_FORCED_LOCAL): Define.
- * elf.c (bfd_elf_print_symbol): Correct errors in last change.
- * elflink.h (elf_link_add_object_symbols): Handle cases in which a
- versioned symbol appears in both a regular and a shared object.
- (elf_link_assign_sym_version): Set ELF_LINK_FORCED_LOCAL when
- appropriate. Improve error message.
- (struct elf_outext_info): Rename from elf_finfo_failed. Change
- all uses. Add localsyms field.
- (elf_bfd_final_link): When generating a shared library, call
- elf_link_output_extsym to output all local symbols.
- (elf_link_output_extsym): Handle symbols which were forced to
- become local.
-
-Sun Mar 9 23:08:49 1997 Ian Lance Taylor <ian@cygnus.com>
-
- From Eric Youngdale <eric@andante.jic.com>:
- * elf-bfd.h (elf_symbol_type): Add version field.
- * elfcode.h (elf_slurp_symbol_table): Set version field.
- * elflink.h (elf_link_add_object_symbols): When creating an
- indirect symbol for a default version symbol, set DEF_DYNAMIC if
- appropriate. Set up an indirection from the nondefault version of
- the symbol as well.
- (NAME(bfd_elf,size_dynamic_sections)): Call
- elf_link_assign_sym_version before checking whether there are any
- versions. Always record the version name as a dynamic symbol.
- Initialize counters.
- (elf_link_assign_sym_version): After finding a version, see if a
- symbol should be forced to local scope. Create a new version
- definition if appropriate.
- (elf_link_output_extsym): Correct indirect symbol handling.
- * elf.c (bfd_elf_print_symbol): Print version information.
- (bfd_section_from_shdr): Turn version sections into BFD sections.
- (elf_fake_sections): Only copy cverdefs and cverrefs into sh_info
- if sh_info is not already set.
- (_bfd_elf_copy_private_section_data): Copy sh_info for version
- sections.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Tell
- _bfd_stringtab_add to copy the name into permanent memory if
- appropriate.
-
-Fri Mar 7 11:55:31 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
-
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Fully parenthesize.
-
-Fri Mar 7 10:37:30 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (bfd_coff_backend_data): Change
- _bfd_coff_compute_section_file_positions to return a boolean
- value. Change all callers.
- (coff_compute_section_file_positions): Change return type to
- boolean. If the size of the last section changed, then output a
- zero byte at the end of the file.
- * libcoff.h: Rebuild.
-
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Always allocate space
- for at least 6 output symbols.
- (xcoff_write_global_symbol): When emitting TOC entry relocs, also
- emit a TC csect to represent the space they take up. For an XO
- symbol, just emit a reference, not a csect.
-
- * Makefile.in ($(SHLINK)): Just use ln -s, not ln -sf, since
- Solaris doesn't like the combined options, and the -f is
- unnecessary.
- (stamp-tshlink, install): Likewise.
-
- * elf32-mips.c (mips_elf_relocate_section): Correct R_MIPS16_26
- handling when little endian.
-
-Thu Mar 6 13:51:51 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c (mn10300_elf_final_link_relocate): New function.
- (mn10300_elf_relocate_section): Likewise.
- (elf_backend_relocate_section): Define.
-
- * elf32-mn10300.c (reloc_type): Remove PCREL{8,16,32}_{1,2}BYTE
- relocs. Replace them with generic PCREL_{8,16,32} relocs.
- (elf32_mn10300_howto_table): Likewise.
- (elf32_mn10300_reloc_map): Likewise.
- (bfd_elf32_mn10300_reloc): Delete unused function.
-
-Thu Mar 6 12:19:59 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-tic80.c (rtype2howto): If passed a relocation type we don't
- understand, just set the howto field to NULL, and the caller will
- print an appropriate error message.
- * coffcode.h (coff_slurp_reloc_table): Pull duplicate declarations and
- code fragment out of both legs of #ifdef RELOC_PROCESSING ... #endif
- block. Use NULL for initializations of "ptr" rather than bare 0.
- * coff-h8300.c: Fix typo in comment.
- * coff-h8500.c: Ditto.
- * coff-w65.c: Ditto
- * coff-z8k.c: Ditto.
-
-Wed Mar 5 13:59:09 1997 Doug Evans <dje@seba.cygnus.com>
-
- * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc): Fix overflow calc.
- (m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
- m32r_elf_get_relocated_section_contents): First pass at relax support.
-
-Mon Mar 3 13:27:09 1997 Ulrich Drepper <drepper@rtl.cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Use correct sh_size
- entry for reading verdef records.
- Use correct braces for computing increments of extverdaux and
- exteverdef record pointers.
-
-Sun Mar 2 22:47:54 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-tic80.c (COFF_DEFAULT_SECTION_ALIGNMENT_POWER): Set this to 2
- instead of 4.
-
-Sun Mar 2 16:25:35 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_find_version_dependencies): Check that
- DEF_REGULAR is not set as well as checking that DEF_DYNAMIC is
- set.
-
-Fri Feb 28 16:52:40 1997 Fred Fish <fnf@cygnus.com>
-
- * coffcode.h (coff_set_flags): Add case for TIC80_ARCH_MAGIC.
-
-Fri Feb 28 15:06:45 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * targets.c (bfd_default_vector): Make non-const.
- (find_target): New static function, broken out of
- bfd_find_target.
- (bfd_set_default_target): New function.
- (bfd_find_target): Call find_target. When defaulting, use
- bfd_default_vector[0] if it is not NULL.
- * libbfd-in.h (bfd_default_vector): Adjust declaration.
- * bfd-in2.h, libbfd.h: Rebuild.
-
- * syms.c (bfd_is_local_label): Return false if the symbol has no
- name.
- * coff-i960.c (coff_i960_is_local_label_name): New function.
- (coff_bfd_is_local_label_name): Define.
- * coff-m68k.c (m68k_coff_is_local_label_name): New function.
- (coff_bfd_is_local_label_name): Define.
- * coff-rs6000.c (xcoff_is_local_label_name): New function.
- (coff_bfd_is_local_label_name): Define.
- * elf.c (_bfd_elf_is_local_label_name): Treat symbols beginning
- with .. or _.L_ as local.
- * elf32-i386.c (elf_i386_is_local_label_name): New function.
- (bfd_elf32_bfd_is_local_label_name): Define.
- * evax-alpha.c (evax_bfd_is_local_label_name): Treat symbols
- beginning with $ as local.
-
-Thu Feb 27 18:36:23 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (aout_link_write_symbols): Use bfd_is_local_label_name
- rather than comparing against info->lprefix.
- * cofflink.c (_bfd_coff_link_input_bfd): Likewise.
- * elflink.h (elf_link_input_bfd): Likewise.
- * linker.c (_bfd_generic_link_output_symbols): Likewise.
- * xcofflink.c (xcoff_link_input_bfd): Likewise.
-
- * elfxx-target.h (bfd_elfNN_bfd_is_local_label_name): Define as
- _bfd_elf_is_local_label_name if not already defined.
- * elf.c (_bfd_elf_is_local_label_name): New function.
- * elf-bfd.h (_bfd_elf_is_local_label_name): Declare.
-
- * coff-m88k.c (coff_bfd_is_local_label_name): Define.
- (m88k_is_local_label_name): New static function.
-
- * coffcode.h (coff_bfd_is_local_label_name): Define as
- _bfd_coff_is_local_label_name if not already defined.
- * coffgen.c (_bfd_coff_is_local_label_name): New function.
- * libcoff-in.h (_bfd_coff_is_local_label_name): Declare.
- * libcoff.h: Rebuild.
-
- * targets.c (BFD_JUMP_TABLE_SYMBOLS): Change _bfd_is_local_label
- to _bfd_is_local_label_name.
- (bfd_target): Likewise.
- * syms.c (bfd_is_local_label): Define as function, not macro.
- (bfd_is_local_name): Define.
- * libbfd.c (bfd_generic_is_local_label_name): Rename from
- bfd_generic_is_local_label, and take a string rather than a
- symbol.
- * libbfd-in.h (_bfd_nosymbols_bfd_is_local_label): Don't define.
- (_bfd_nosymbols_bfd_is_local_label_name): Define.
- (bfd_generic_is_local_label): Don't declare.
- (bfd_generic_is_local_label_name): Declare.
- * bfd-in2.h, libbfd.h: Rebuild.
- * All backends: Change local_label to local_label_name.
-
- * elf32-mips.c (struct mips_got_info): Add assigned_gotno field.
- (mips_elf_relocate_got_local): Change return type to boolean.
- Don't assume that the first zero entry is unassigned; instead, use
- assigned_gotno.
- (mips_elf_relocate_section): Check return value of
- mips_elf_relocate_got_local.
- (mips_elf_create_got_section): Initialize assigned_gotno field.
-
-Wed Feb 26 15:19:51 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * elf32-d30v.c (bfd_elf_d30v_reloc): Add code to do 32-bit
- relocations.
-
-Wed Feb 26 13:33:03 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_input_bfd): Don't skip symbols from sections
- that have no contents merely because linker_mark is not set.
-
-Tue Feb 25 18:51:35 1997 Stan Shebs <shebs@andros.cygnus.com>
-
- * config.bfd (mips*-*-lnews*): New target.
- * coff-mips.c (mips_relocate_section): Make assert compare
- content byteorder instead of header byteorder.
- (ecoff_biglittle_vec): New BFD, big-endian headers, little-endian
- data.
- * targets.c (bfd_target_vector): Add ecoff_biglittle_vec.
- * configure.in (ecoff_biglittle_vec): Add case.
- * configure: Update.
-
-Tue Feb 25 00:32:49 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (elf_fake_sections): Use SHT_NOTE for any section whose
- name begins with ".note".
- (map_sections_to_segments): Add a PT_NOTE segment for any loadable
- section whose name begins with ".note".
- (get_program_header_size): Corresponding change.
-
- * elf32-mips.c (mips_elf_relocate_section): Check for misaligned
- jal and for jal overflow.
-
-Mon Feb 24 17:53:14 1997 Ian Lance Taylor <ian@cygnus.com>
-
- From Eric Youngdale <eric@andante.jic.com>:
- * elflink.h (elf_link_add_archive_symbols): If a default symbol is
- not found, try looking it up again without the version name.
- (elf_link_add_object_symbols): Always link against the dynamic
- symbol table of a dynamic object. When linking against a dynamic
- object, include version strings in symbol names, and set up
- version information. Add indirect symbols for default versions.
- (elf_link_create_dynamic_sections): Add special version sections.
- (struct elf_assign_sym_version_info): Define.
- (struct elf_find_verdep_info): Define.
- (NAME(bfd_elf,size_dynamic_sections)): Add verdefs parameter. Set
- up version sections.
- (elf_adjust_dynamic_symbol): Ignore indirect symbols.
- (elf_link_find_version_dependencies): New static function.
- (elf_link_assign_sym_version): New static function.
- (elf_link_renumber_dynsyms): New static function.
- (struct elf_final_link_info): Add symver_sec field.
- (elf_bfd_final_link): Initialize finfo.symver_sec. Don't count
- local symbols of a dynamic object. Handle DT_VER* constants.
- (elf_link_output_extsym): Simplify BFD_ASSERT checking for a
- dynamic object. Skip indirect symbols from ELF objects. Remove
- the version name before choosing a hash bucket. Write out the
- version information if appropriate.
- (elf_link_input_bfd): Check for DYNAMIC, not ET_DYN.
- * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration.
- (bfd_elf64_size_dynamic_sections): Likewise.
- * bfd-in2.h: Rebuild.
- * elf-bfd.h (struct elf_link_hash_entry): Add verinfo field.
- Change elf_link_hash_flags to unsigned short.
- (ELF_LINK_HIDDEN): Define.
- (struct elf_obj_tdata): Add fields dynversym_hdr, dynverref_hdr,
- dynverdef_hdr, dynversym_section, dynverdef_section,
- dynverref_section, cverdefs, cverrefs, verdef, verref.
- (elf_dynversym, elf_dynverdef, elf_dynverref): Define.
- (_bfd_elf_swap_verdef_in, _bfd_elf_swap_verdef_out): Declare.
- (_bfd_elf_swap_verdaux_in, _bfd_elf_swap_verdaux_out): Declare.
- (_bfd_elf_swap_verneed_in, _bfd_elf_swap_verneed_out): Declare.
- (_bfd_elf_swap_vernaux_in, _bfd_elf_swap_vernaux_out): Declare.
- (_bfd_elf_swap_versym_in, _bfd_elf_swap_versym_out): Declare.
- (_bfd_elf_slurp_version_tables): Declare.
- * elf.c (_bfd_elf_swap_verdef_in): New function.
- (_bfd_elf_swap_verdef_out): Likewise.
- (_bfd_elf_swap_verdaux_in, _bfd_elf_swap_verdaux_out): Likewise.
- (_bfd_elf_swap_verneed_in, _bfd_elf_swap_verneed_out): Likewise.
- (_bfd_elf_swap_vernaux_in, _bfd_elf_swap_vernaux_out): Likewise.
- (_bfd_elf_swap_versym_in, _bfd_elf_swap_versym_out): Likewise.
- (_bfd_elf_print_private_bfd_data): Add DT_VER* constants. Print
- version information if there is any.
- (_bfd_elf_link_hash_newfunc): Initialize verinfo field.
- (bfd_section_from_shdr): Handle SHT_GNU_ver* section types.
- (elf_fake_sections): Handle .gnu.version* section names.
- (assign_section_numbers): Handle SHT_GNU_ver* section types.
- (_bfd_elf_slurp_version_tables): New function.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't include
- version name in string entered in dynamic hash table.
- * elfcode.h: Include fnmatch.h.
- * elf32-i386.c (elf_i386_relocate_section): Handle a dynamic
- symbol which was forced to become local.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise.
-
-Fri Feb 21 16:15:18 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10200.c (mn10200_elf_final_link_relocate): Simplify
- somewhat.
- (mn10200_elf_relax_section): Correctly compute a symbol's value
- when the symbol is local, but not in the same section as we are
- relaxing. Implement abs24 -> abs16, imm24 -> imm16 and d24 -> d16
- relaxing.
-
-Fri Feb 21 13:55:14 1997 Doug Evans <dje@seba.cygnus.com>
-
- * elf32-m32r.c: Rewrite to use ELF backend linker.
- Store lower 16 bits of addend in R_M32R_HI16_[SU]LO insns.
- Add small data area support (R_M32R_SDA16).
- * reloc.c: Document BFD_RELOC_M32R_SDA16.
- * bfd-in2.h, libbfd.h: Regenerated.
-
-Thu Feb 20 23:50:31 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10200.c (mn10200_elf_relax_section): New function.
- (mn10200_elf_relax_delete_bytes): Likewise.
- (mn10200_elf_symbol_address_p): Likewise.
- (mn10200_elf_get_relocated_section_contents): Likewise.
- (bfd_elf32_bfd_relax_section): Define.
- (bfd_elf32_bfd_get_relocated_section_contents): Likewise.
-
- * elf32-mn10200.c (mn10200_elf_final_link_relocate): New function.
- (mn10200_elf_relocate_section): Likewise.
- (elf_backend_relocate_section): Define.
-
-Tue Feb 18 17:22:59 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * Makefile.in: New target, elf-*-D30V.
- * archures.c: New target, elf-*-D30V.
- * config.bfd: New target, elf-*-D30V.
- * configure.in: New target, elf-*-D30V.
- * elf.c: New target, elf-*-D30V.
- * reloc.c: New target, elf-*-D30V.
- * targets.c: New target, elf-*-D30V.
- * bfd-in2.h: Rebuilt.
- * configure: Rebuilt.
- * libbfd.h: Rebuilt.
- * cpu-d30v.c: New files.
- * elf32-d30v.c: New files.
-
-Tue Feb 18 15:31:48 1997 Fred Fish <fnf@cygnus.com>
-
- * reloc.c (struct reloc_howto_struct): Fix typo in comment.
- * bfd-in2.h: Regenerated.
- * coff-tic80.c (RTYPE2HOWTO): Replace abort with real function.
- (rtype2howto): Add function.
- (tic80_howto_table): Add.
-
-Tue Feb 18 11:41:00 1997 Dawn Perchik <dawn@cygnus.com>
-
- * sysdep.h: Don't define errno in MSVC if error.h is included.
-
-Tue Feb 18 10:04:13 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (v850_elf_relocate_section): Make sure r_symndx
- is initialized before it is used.
-
-Mon Feb 17 11:28:40 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * hp300hpux.c (convert_sym_type): Don't convert a secondary common
- symbol into a weak undefined symbol; leave it as a common symbol.
-
-Fri Feb 14 19:08:03 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't issue a warning
- about a symbol defined in a dynamic object if it has already been
- defined in a regular object.
-
-Thu Feb 13 20:53:22 1997 Klaus Kaempf (kkaempf@progis.de)
-
- * makefile.vms: Add gcc flags to allow compiling with current gcc
- snapshot
- (targmatch.h): New dependency.
-
- * reloc.c (BFD_RELOC_ALPHA_CODEADDR): New relocation for
- openVMS/Alpha.
- * evax.h (ALPHA_R_CODEADDR): New relocation.
- * evax-alpha.c (ALPHA_R_CODEADDR): 64 bit procedure relocation for
- openVMS/Alpha.
- * evax-etir.c (ALPHA_R_CODEADDR): Output object code for this
- relocation.
- * bfd-in2.h, libbfd.h: Rebuild.
-
- Restrict symbol length to 64 bytes, case preserving:
- * evax-emh.c (_bfd_evax_write_emh): Remove case hacking.
- * evax-misc.c (_bfd_evax_case_hack_symbol): Remove.
- (_bfd_evax_length_hash_symbol): Added.
- * evax-etir.c (_bfd_evax_write_etir): Call
- _bfd_evax_length_hash_symbol before output of symbol.
- * evax-egsd.c (_bfd_evax_write_egsd): Likewise.
- * evax.h (flag_hash_long_names, flag_show_after_trunc): Remove.
-
- * evax-emh.c: Output filename to object file without path.
-
- * evax-egsd.c: New sections for local and global commons.
-
- * evax-alpha.c, evax-emh.c, evax-egsd.c, evax-etir.c,
- evax-misc.c, evax.h: Remove 8 bit characters from copyright
- notices. Replace AXP with Alpha.
-
-Wed Feb 12 18:10:30 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_create_dynamic_sections): We need the dynamic
- sections if we are creating a shared library.
-
-Tue Feb 11 15:45:43 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * configure.host (i386-windows): Don't set host64=true.
-
-Tue Feb 11 15:27:32 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (reloc_type): Add R_MIPS16_GPREL.
- (elf_mips16_gprel_howto): New static variable.
- (mips16_gprel_reloc): New static function.
- (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_MIPS16_GPREL.
- (mips_info_to_howto_rel): Handle R_MIPS16_GPREL.
- (mips_elf_relocate_section): Handle R_MIPS16_GPREL.
- * reloc.c (BFD_RELOC_MIPS16_GPREL): Define.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-Mon Feb 10 23:25:00 1997 Doug Evans <dje@seba.cygnus.com>
-
- * elf32-m32r.c (elf_m32r_howto_table): Change partial_inplace to true
- for R_M32R_{16,32,24,HI16_ULO,HI16_SLO,LO16}.
-
-Fri Feb 7 12:39:11 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_input_bfd): If we've discarded a section,
- the output section will be the absolute section; don't print an
- assertion message for that case when doing a relocateable link.
-
-Thu Feb 6 16:55:43 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (FN_STUB, CALL_STUB, CALL_FP_STUB): Define.
- (struct mips_elf_link_hash_entry): Add new fields fn_stub,
- need_fn_sub, call_stub, and call_fp_stub.
- (struct mips_elf_link_hash_table): Add field mips16_stubs_seen.
- (mips_elf_link_hash_newfunc): Initialize new fields.
- (mips_elf_link_hash_table_create): Likewise.
- (mips_elf_relocate_section): Redirect relocations to use mips16
- stubs when appropriate.
- (mips_elf_check_relocs): Attach stub sections to the appropriate
- symbol. Set need_fn_stub when appropriate.
- (mips_elf_always_size_sections): New static function.
- (mips_elf_check_mips16_stubs): New static function.
- (elf_backend_always_size_sections): Define.
- * elf-bfd.h (struct elf_obj_tdata): Add local_stubs field.
-
- * elflink.h (elf_link_input_bfd): Discard local symbols that are
- attached to sections which are not being included in the link.
-
-Wed Feb 5 13:20:17 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Ignore the
- symbol value when computing the addend for a pc_relative
- pcrel_offset reloc.
-
-Mon Feb 3 11:54:06 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): If doing a
- relocateable link, just skip pc_relative pcrel_offset relocs.
- * coff-arm.c (coff_arm_rtype_to_howto): Return a different howto
- structure for an ARM26 reloc which can be resolved.
- (coff_arm_adjust_symndx): Only convert ARM26 to ARM26D if the
- reloc can be resolved.
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Correct off by one
- error in overflow check for R_RELBYTE.
-
-Fri Jan 31 14:07:27 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_slurp_section_data): Pick up the start address.
- From Mark Rasin <mark.rasin@telrad.co.il>.
-
- * aoutx.h (aout_link_write_symbols): Don't apply discard_l to
- debugging symbols.
-
-Wed Jan 29 00:00:49 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10200.c (reloc_type): Add 16bit pc-relative reloc.
- (elf_mn10200_howto_table): Likewise.
- (mn10200_reloc_map): Likewise.
-
-Mon Jan 27 12:07:35 1997 Doug Evans <dje@seba.cygnus.com>
-
- * reloc.c: Add relocs BFD_RELOC_M32R_{HI16_[US]LO,LO16}.
- * bfd-in2.h, libbfd.h: Regenerated.
- * elf32-m32r.c: Add support for them.
-
-Mon Jan 27 12:25:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * aout-arm.c (MY_swap_std_reloc_in): Remove unused r_length.
- * elf32-ppc.c (ppc_elf_check_relocs): Remove unused plt.
- * elf32-v850.c (v850_elf_final_link_relocate): Remove used
- r_format and r_pcrel. Always return a value.
- * riscix.c (MY_final_link_callback): Define to dummy value.
-
- * elf32-i386.c (elf_i386_size_dynamic_sections): When checking for
- relocations against the text segment, look up the output name of
- the reloc section.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-mips.c (mips_elf_size_dynamic_sections): Likewise.
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
-
-Wed Jan 22 15:40:28 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-tic80.c (tic80coff_vec): Use correct data put/get
- routines for little endian data.
- * coffcode.h (coff_write_object_contents): Set magic to
- TIC80_ARCH_MAGIC for TIc80.
-
-Tue Jan 21 12:32:43 1997 Fred Fish <fnf@cygnus.com>
-
- * coff-tic80.c (tic80coff_vec): Change to little endian data
- as the default.
-
-Thu Jan 16 17:45:57 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Change type of
- auxiliary_filters parameter to be const char * const *. Accept a
- NULL terminated array.
- * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration.
- (bfd_elf32_size_dynamic_sections): Update declaration.
- * bfd-in2.h: Rebuild.
-
-Wed Jan 15 11:21:32 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Treat a
- NOTYPE symbol in a text section as a FUNC symbol.
-
- * coffcode.h (coff_compute_section_file_positions): Force
- relocbase to be aligned to COFF_DEFAULT_SECTION_ALIGNMENT_POWER.
-
-Tue Jan 14 08:46:33 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * libaout.h (machine_type): Reserve several values for sparclet.
-
-Mon Jan 13 22:39:08 1997 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * config.bfd (tic80-*-*): Don't require 'coff'.
-
-Mon Jan 13 19:36:25 1997 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-v850.c (v850_elf_howto_table): Set the special_function
- table to v850_elf_reloc for all non-standard relocations.
- (v850_elf_check_relocs): Add check for h being non-null.
- (v850_elf_reloc): Add R_V850_ZDA_OFFSET support. Use switch
- statement instead of multiple ifs.
- (v850_elf_relocate_section): Fix up error message, don't just call
- abort.
-
-Mon Jan 6 13:28:35 1997 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10200.c (elf_mn10200_howto): Don't ever set partial-inplace.
- Use bfd_elf_generic_reloc as special function for all relocs.
- (bfd_elf32_mn10200_reloc): Remove unnecessary function.
-
- * elf32-mn10200.c (elf_mn10200_howto): Set pcrel_offset for
- 24bit pc-relative reloc.
-
-Fri Jan 3 16:33:00 1997 Fred Fish <fnf@cygnus.com>
-
- * Makefile.in (coff-tic80.o): Add coffcode.h to dependency list.
- * coff-tic80.c (tic80coff_vec): Data byte order is big endian and
- header byte order is little endian. Use correct bfd_get and
- bfd_put routines for little endian headers.
- * coffcode.h (coff_set_arch_mach_hook): Set arch to
- bfd_arch_tic80 for TIC80_ARCH_MAGIC number.
-
-Fri Jan 3 16:54:08 1997 Jeffrey A Law (law@cygnus.com)
-
- * reloc.c: Add BFD_RELOC_24.
- * elf32-mn10200.c (enum reloc_type): Add 24bit and pcrel relocs.
- (elf_mn10200_howto, mn10200_reloc_map): Corresponding changes.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-Fri Jan 3 16:58:31 1997 Richard Henderson <rth@tamu.edu>
-
- elf64-alpha multiple .got rewrite:
-
- * elf-bfd.h (struct elf_backend_data): Add always_size_sections entry.
- (bfd_elf*_mkobject): Don't define here ...
- * elfxx-target.h: ... but rather here. Default always_size_sections
- hook to NULL.
- * elf.c (elf_mkobject): Rename to bfd_elf_mkobject, since that was
- what the #defines in elf-bfd.h transmuted it to anyway.
-
- * section.c: Add SEC_LINKER_CREATED flag.
- * bfd-in2.h: Rebuild.
- * elf32-i386.c (elf_i386_check_relocs): Add SEC_LINKER_CREATED to
- relocation section flags.
- (elf_i386_size_dynamic_sections): Use SEC_LINKER_CREATED instead of
- SEC_IN_MEMORY to recognize generated bits.
- * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_size_dynamic_sections):
- Likewise.
- * elf32-mips.c (mips_elf_final_link, mips_elf_create_dynamic_sections,
- mips_elf_create_compact_rel_section, mips_elf_create_got_section,
- mips_elf_check_relocs, mips_elf_size_dynamic_sections): Likewise.
- * elf32-ppc.c (ppc_elf_create_linker_section,
- ppc_elf_size_dynamic_sections): Likewise.
- * elf32-sparc.c (elf32_sparc_check_relocs,
- elf32_sparc_size_dynamic_sections): Likewise.
- * elflink.c (_bfd_elf_create_got_section): Add SEC_LINKER_CREATED to
- section flags.
- (_bfd_elf_create_dynamic_sections): Likewise.
- (_bfd_elf_make_linker_section_rela): Likewise.
- * elflink.h (elf_link_create_dynamic_sections): Likewise.
- (bfd_elf,size_dynamic_sections): Call the always_size_sections hook.
- (elf_bfd_final_link): Use SEC_LINKER_CREATED instead of SEC_IN_MEMORY
- to identify generated bits.
- (elf_link_input_bfd): Likewise.
-
- * elf64-alpha.c: Rewrite everything touching relocations.
-
-Fri Jan 3 11:42:53 1997 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-v850.c (all functions and static variables): Go through
- and regularize names to be of the form v850_elf_<xxx>.
- (toplevel): Include <elf/v850.h>.
- (enum reloc_type): Move to include/elf/v850.h.
- (v850_elf_check_relocs): For common variables, if the variable is
- referenced by a R_V850_{SDA,ZDA,TDA} relocation, put the variable
- into the appropriate section.
- (elf_backend_check_relocs): Define.
-
-Tue Dec 31 15:15:28 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-v850.c (elf_v850_howto_table): Fix some spacing.
-
-Tue Dec 31 14:44:50 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * config.bfd (mips*el-*-linux*): New target.
- (mips*-*-linux*): New target.
-
- * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Clean up.
- Return a useful value.
-
- * Makefile.in (ALL_CFLAGS): Add -D_GNU_SOURCE.
-
- * configure.in: Check ac_cv_func_mmap_fixed_mapped, not
- ac_cv_func_mmap.
- * configure: Rebuild.
- * configure.host: Use ac_cv_func_mmap_fixed_mapped instead of
- ac_cv_func_mmap in bfd/configure.host.
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Add
- filter_shlib and auxiliary_filter_shlib parameters.
- * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_AUXILIARY and
- DT_FILTER.
- * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration.
- (bfd_elf64_size_dynamic_sections): Likewise.
- * bfd-in2.h: Rebuild.
-
-Mon Dec 30 18:48:52 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_build_ldsyms): When exporting all defined
- symbols, don't export a symbol which is defined by an object in an
- archive which contains shared objects.
-
-Mon Dec 30 16:12:58 1996 Fred Fish <fnf@cygnus.com>
-
- * archures.c (enum bfd_architecture): Add bfd_arch_tic80
- for TI TMS320c80 (MVP).
- (bfd_archures_list): Add bfd_tic80_arch.
- * bfd-in2.h: Regenerate by running "make headers".
-
-Sun Dec 29 16:18:52 1996 Fred Fish <fnf@cygnus.com>
-
- * cpu-tic80.c (bfd_tic80_arch): Add struct.
- * configure.in (case $vec): Correct typo, "tb" not "tp".
- Also add cofflink.o for tic80coff_vec.
- * configure: Regenerate with autoconf.
-
-Mon Dec 30 11:54:56 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd.c: Patch up the mmap code so that it is only built if BFD
- is configured with --with-mmap.
-
-Sun Dec 29 10:48:57 1996 Fred Fish <fnf@cygnus.com>
-
- * Makefile.in (BFD32_BACKENDS): Add coff-tic80.o
- (ALL_MACHINES): Add cpu-tic80.o
- (cpu-tic80.o, coff-tic80.o): Add dependencies.
- * coff-tic80.c: Add skeleton, cloned from another coff config.
- * coffcode.h (coff_write_object_contents): Set magic to TIC80MAGIC
- for TIc80.
-
-Fri Dec 27 20:56:41 1996 Fred Fish <fnf@cygnus.com>
-
- * TODO: Correct a misspelling.
- * coff-tic80.c: New file for TI TMS320C80 (MVP).
- * cpu-tic80.c: New file for TI TMS320C80 (MVP).
- * configure.in (case $vec): Add tic80coff_vec entry.
- * configure: Regenerate with autoconf.
- * archures.c (bfd_tic80_arch): Declare.
- * bfd-in2.h (enum bfd_architecture): Add bfd_arch_tic80.
- * config.bfd (case ${targ}): Add tic80*-*-coff* target.
- * targets.c (tic80coff_vec): Add decl as extern bfd_target.
- (bfd_target_vector): Add tic80coff_vec entry.
-
-Fri Dec 27 11:48:12 1996 H.J. Lu <hjl@lucon.org>
-
- * elflink.h (elf_buckets): Add some more values for larger
- binaries.
-
-Thu Dec 26 18:36:54 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (install): Move subdir_do out of conditional. From
- Fred Fish <fnf@cygnus.com>.
-
-Wed Dec 18 10:04:30 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10200.c (enum reloc_type): Enable basic 8, 16, and
- 32 bit relocs.
- (elf_mn10200_howto_table): Likewise.
- (mn10200_reloc_map): Likewise.
-
-Tue Dec 17 11:09:36 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_add_symbol_hook): Add 1 to the value of a
- mips16 symbol during the link.
- (mips_elf_finish_dynamic_symbol): Subtract 1 from the value of a
- mips16 symbol.
- (mips_elf_link_output_symbol_hook): New static function.
- (elf_backend_link_output_symbol_hook): Define.
-
- * elf.c (bfd_elf_print_symbol): Print the st_other field if it is
- not zero.
-
-Mon Dec 16 14:38:39 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (bfd_section_from_shdr): Don't check for reloc sections
- against SEC_DEBUGGING sections here (revert patch of December 5).
- * elfcode.h (elf_object_p): Check for them here, instead.
-
-Sun Dec 15 14:46:06 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcode.h (elf_slurp_reloc_table): Add dynamic parameter.
- * elf.c (_bfd_elf_canonicalize_reloc): Pass new argument to
- slurp_reloc_table.
- (_bfd_elf_get_dynamic_reloc_upper_bound): New function.
- (_bfd_elf_canonicalize_dynamic_reloc): New function.
- * elf-bfd.h (struct elf_size_info): Update declaration of
- slurp_reloc_table.
- (_bfd_elf_get_dynamic_reloc_upper_bound): Declare.
- (_bfd_elf_canonicalize_dynamic_reloc): Declare.
- * elfxx-target.h: Use new dynamic reloc routines by default.
- * elf64-mips.c (mips_elf64_slurp_reloc_table): Add dynamic
- parameter.
-
-Fri Dec 13 13:18:49 1996 Dan Wilder <dan@gasboy.com>
-
- * coffcode.h (coff_set_flags): Use MC68KBCSMAGIC for bfd_arch_m68k
- if NAMES_HAVE_UNDERSCORE is defined.
-
-Fri Dec 13 11:13:23 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * libaout.h (enum machine_type): Change M_SPARCLET from 142 to 131.
-
-Thu Dec 12 15:07:20 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_check_relocs): Move R_PPC_PLTREL24 into the
- supported relocs.
-
-Thu Dec 12 14:55:41 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Only add a weak
- symbol if the real definition is in the dynamic symbol table.
- After finding the real definition, then, if it is dynamic, add the
- weak symbol to the dynamic symbol table.
-
- * coff-aux.c (coff_m68k_aux_link_add_one_symbol): Make static.
-
- * ppcboot.c (ppcboot_set_arch_mach): Don't define; it's a
- function.
- (ppcboot_bfd_print_private_bfd_data): Don't take the address of an
- array.
-
-Tue Dec 10 23:23:52 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c (reloc_type): Remove big endian mn10300 reloc
- variants.
- (elf32_mn10300_howto_table, mn10300_reloc_map): Likewise.
- (bfd_elf32_mn10300_reloc): Write data in little endian format.
- * reloc.c: Remove mn10300 big endian relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
- * elf32-mn10200.c: Update from elf32-mn10300.c.
-
-Fri Dec 6 15:18:05 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c (elf_symbol_leading_char): Define.
-
- * elf32-mn10300.c: Add some comments.
-
-Fri Dec 6 17:16:43 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ihex.c (ihex_scan): Always initialize buf before jumping to
- error_return.
- (ihex_read_section): Likewise.
-
-Thu Dec 5 22:29:18 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c (elf_mn10300_howto_table): Don't set partial-
- inplace for most relocs.
-
-Thu Dec 5 13:24:46 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Calling check_relocs
- even if SEC_ALLOC is not set.
- * elf32-i386.c (elf_i386_check_relocs): Don't check SEC_ALLOC
- when deciding whether to copy a reloc into a shared object.
- (elf_i386_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
- (elf32_sparc_relocate_section): Likewise.
- * elf32-i386.c (elf_i386_check_relocs): Don't set SEC_ALLOC in a
- reloc section if it is not set in the source section.
- * elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
- * elf.c (bfd_section_from_shdr): Mark a reloc section associated
- with a SEC_DEBUGGING section as SEC_DEBUGGING.
-
-Wed Dec 4 14:18:13 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): #if 0 code that
- expects a .got.plt until we actually create it.
-
-Mon Dec 2 12:13:51 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Print an error
- message for bfd_reloc_outofrange, rather than aborting. From
- Philippe De Muyter <phdm@info.ucl.ac.be>.
-
- * cofflink.c (_bfd_coff_final_link): If there aren't any relocs in
- a relocateable link, don't try to process them. From Heinz Wrobel
- <wrobel@lpr.e-technik.tu-muenchen.de>.
-
-Mon Dec 2 00:39:24 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c (mn10300_info_howto): Renamed from
- mn10300_info_howto_rel. Tweak reloc argument to be an
- Elf32_Internal_Rela.
- (USE_RELA): Define instead of USE_REL.
- (elf_info_to_howto, elf_info_howto_rel): Corresponding changes.
-
-Sun Dec 1 00:18:59 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * configure.in, configure: Handle mips*-sgi-irix6*.
- * irix-core.c (irix_core_core_file_p): Accept CORE_MAGICN32
- core files.
-
-Wed Nov 27 12:10:25 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Warn about a
- relocation against a symbol defined in a section with no output
- section.
-
-Tue Nov 26 11:07:31 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aclocal.m4 (BFD_CC_FOR_BUILD): Don't require AC_C_CROSS.
- * configure, config.in: Rebuild with autoconf 2.12.
-
- * elf-bfd.h (struct elf_link_hash_entry): Add other field.
- * elf.c (_bfd_elf_link_hash_newfunc): Initialize other field.
- (swap_out_syms): Set st_other from existing st_other field.
- * elflink.h (elf_link_add_object_symbols): Store st_other in hash
- table other field.
- (elf_link_output_extsym): Set the other field from the global hash
- table entry.
- * elf32-mips.c (enum reloc_type): Add R_MIPS16_26.
- (elf_mips16_jump_howto): New static variable.
- (mips16_jump_reloc): New static function.
- (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_MIPS16_JMP.
- (mips_info_to_howto_rel): Handle R_MIPS16_26.
- (mips_elf_relocate_section): Handle R_MIPS16_26. Handle R_MIPS_26
- to a mips16 symbol.
- * reloc.c (BFD_RELOC_MIPS16_JMP): Add to list of relocs.
- * bfd-in2.h, libbfd.h: Rebuild.
- * cpu-mips.c (arch_info_struct): Add mips:16 entry.
-
-Mon Nov 25 11:23:32 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Use long long for mips-sgi-irix6*.
-
- * coffswap.h (coff_swap_scnhdr_out): Make line number overflow
- only a warning. From Philippe De Muyter <phdemuyt@ulb.ac.be>.
-
-Mon Nov 25 08:52:29 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c (bfd_elf32_mn10300_reloc): New function.
- (enum reloc_type): Add more reloc types.
- (elf32_mn10300_howto_table): Update for new reloc types.
- (elf32_mn10300_reloc_map): Update for new reloc types.
- * reloc.c: Add some new relocs for the mn10300 series.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-Sat Nov 23 13:26:18 1996 Jeffrey A Law (law@cygnus.com)
-
- * som.c (setup_sections): Don't lose for a space which has
- no data, but some symbols.
-
-Fri Nov 22 11:32:13 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (struct sunos_link_hash_table): Add got_needed field.
- (sunos_link_hash_table_create): Initialize got_needed.
- (sunos_create_dynamic_sections): Only set .got section size if it
- is not already set. Set got_needed.
- (bfd_sunos_size_dynamic_sections): Check got_needed. Only set
- sdynptr, and only handle dynamic sections, if dynamic sections are
- needed.
- (sunos_scan_std_relocs): Pass false to create_dynamic_sections.
- Initialize .got section.
- (sunos_scan_ext_relocs): Likewise.
- (sunos_write_dynamic_symbol): Set up PLT entry even if this is not
- a dynamic symbol.
- (sunos_finish_dynamic_link): Check got_needed. Only set up
- dynamic linking information if needed.
-
-Thu Nov 21 10:31:31 1996 Rob Savoye (rob@cygnus.com)
-
- * config.bfd: Added VersaDOS format to the Ericsson configuration.
-
-Wed Nov 20 16:31:31 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mn10300.c: Rough cut at relocs for the mn10300.
-
-Wed Nov 13 08:12:38 1996 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (elf32-d10v.o): Don't depend on elf/d10v.h
- anymore.
-
-Tue Nov 12 13:30:00 1996 Dawn Perchik <dawn@cygnus.com>
-
- * filemode.c: Include sysdep.h.
- * ihex.c: Add casts to eliminate compiler warnings.
- * sunos.c: Add casts to eliminate compiler warnings.
-
-Mon Nov 11 10:37:02 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Create .got.plt
- section.
- (ppc_elf_check_relocs): Add support for R_PPC_LOCAL24PC. Make
- appropriate relocations in the .so file if shared.
- (ppc_elf_relocate_section): Ditto.
-
-Tue Oct 29 15:03:02 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * elf32-m32r.c (elf_m32r_howto_table, R_M32R_24): Use
- complain_overflow_unsigned.
-
-Tue Oct 29 12:53:46 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * elf32-d10v.c (elf_d10v_howto_table): Don't complain on
- overflows for R_D10V_16 and R_D10V_18.
-
-Tue Oct 29 13:23:53 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_write_section_part): Use LMA rather than VMA.
- (do_with_relocs): Likewise.
- (do_as_repeat): Likewise.
- (copy_expression): Likewise.
-
-Fri Oct 25 16:56:40 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_write_external_part): Correctly record whether
- there is an external part.
-
-Thu Oct 24 14:32:52 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (elf32_v850_bfd_final_link_relocate): Correctly
- handle tda offsets for sld.w and sst.w instructions.
- Fix alignment check in sld.w and sst.w tda reloc handling.
-
-Thu Oct 24 09:08:47 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * aclocal.m4, configure: Set USE_BINARY_FOPEN for *-*-windows.
-
-Wed Oct 23 00:53:16 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c: Add comments about assumptions about
- char, short & long sizes.
- (elf32_v850_bfd_final_link_relocate): Fix sign extension
- problems for several relocs.
-
- * elf32-v850.c (elf32_v850_howto_table): Fix typo in
- R_V850_SDA_OFFSET entry.
-
-Wed Oct 23 00:20:34 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (bfd_xcoff_import_symbol): Don't allocate ldsym.
- Store import file index in ldindx.
- (xcoff_build_ldsyms): Assume that ldsym was not previously
- allocated. For an imported symbol, copy ldindx into l_ifile.
-
-Tue Oct 22 19:20:38 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (elf_v850_howto_table): Fix ordering of
- R_V850_ZDA_OFFSET and R_V850_TDA_OFFSET. Fix various
- fields in R_V850_TDA_OFFSET.
- (elf32_v850_bfd_final_link_relocate): Tweak pc-relative
- relocs to work more like other relocs. Handle R_V850_TDA_OFFSET
- relocations.
-
- * elf32-v850.c: Include bfdlink.h.
- (bfd_elf32_v850_reloc): Return an error if we get a reloc
- we can't handle.
- (elf32_v850_bfd_final_link_relocate): New function.
- (v850_elf_relocation_section): Likewise.
- (elf_backend_relocate_section): Define.
-
-Tue Oct 22 17:22:43 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * binary.c (binary_set_section_contents): Ignore sections which
- don't have SEC_LOAD and SEC_ALLOC set.
-
-Mon Oct 21 12:13:05 1996 Jeffrey A Law (law@cygnus.com)
-
- * linker.c (_bfd_generic_final_link): Avoid losing static
- symbols in the .bss section.
-
-Mon Oct 21 10:54:58 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (elf_mips_howto_table): Describe R_MIPS_64.
- (mips32_64bit_reloc): New static function.
- (mips_reloc_map): Add entry for BFD_RELOC_64.
- (mips_elf_relocate_section): Handle R_MIPS_64.
-
- * linker.c (default_indirect_link_order): Print an error message
- when attempting to do a relocateable link with different object
- file formats, rather than calling abort.
-
-Thu Oct 17 10:43:29 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * reloc.c (m32r relocs): Rename them.
- * bfd-in2.h, libbfd.h: Regenerated.
- * elf32-m32r.c: Update.
- (m32r_elf_10_pcrel_reloc): New function.
- (elf_m32r_howto_table, R_M32R_10_PCREL entry): Use it.
- (elf_m32r_howto_table, R_M32R_24 entry): Fix {src,dst}_masks.
-
-Wed Oct 16 11:24:35 1996 Jeffrey A Law (law@cygnus.com)
-
- * linker.c (_bfd_generic_final_link): Set "linker_mark" for
- all sections that will be included in the output file.
- (_bfd_generic_link_output_symbols): Discard symbols in sections
- which are being discarded.
- * elf32-v850.c (enum reloc_type): Add R_V850_SDA_OFFSET,
- R_V850_TDA_OFFSET and R_V850_ZDA_OFFSET.
- (elf_v850_howto_table): Corresponding changes.
- (elf_v850_reloc_map): Corresponding changes.
- * reloc.c: Add additional V850 relocations.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
- * elf32-v850.c (bfd_elf32_v850_reloc): Mask out bits we
- no longer want in pc-relative relocs.
-
-Tue Oct 15 22:17:37 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (bfd_elf32_v850_reloc): Don't silently
- accept a reloc against an undefined sybmol!
-
-Tue Oct 15 16:17:28 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * elf32-v850.c: Define elf_symbol_leading_char to be '_'.
-
-Tue Oct 15 12:40:41 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * VERSION: Bump for new relocation.
-
- * hosts/i386bsd.h: If NBPG is not defined, define it as
- PAGE_SIZE, for recent versions of FreeBSD.
-
-Mon Oct 14 12:37:26 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Use `long long' as the 64 bit type on a Solaris
- host, since both gcc and the SunPRO compilers support it.
-
-Mon Oct 14 11:17:24 1996 Richard Henderson <rth@tamu.edu>
-
- * reloc.c: Create a new BFD_RELOC_ALPHA_ELF_LITERAL. It was a
- mistake to have reused the ECOFF LITERAL for ELF since they have
- different semantics.
- * elf64-alpha.c (elf_reloc_map): Map from ELF_LITERAL.
- * bfd-in2.h, libbfd.h: Rebuild.
-
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Trap .got
- section overflow.
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Do not emit a
- dynamic relocation for an undefweak symbol when we are building
- a static executable.
-
-Thu Oct 10 11:15:06 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.sed (config.bfd, targmatch.sed): Edit references to
- point explicitly to srcdir.
- (targmatch.h): Edit references to point explicitly to objdir.
-
-Thu Oct 10 14:14:23 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * config.bfd: When setting targ_cpu, don't get confused by
- linux-gnu.
-
-Tue Oct 8 08:51:19 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * configure.host: Add support for windows host (a build done
- under the Microsoft build environment).
-
-Tue Oct 8 11:40:16 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): If a symbol is a weak
- definition in a dynamic object, add it to the dynamic symbol table
- if any dynamic object mentions it. Reverts part of last patch.
-
- * sunos.c (struct sunos_link_hash_table): Add got_base field.
- (sunos_link_hash_table_create): Initialize got_base.
- (bfd_sunos_size_dynamic_sections): If the .got section is more
- than 0x1000 bytes, set __GLOBAL_OFFSET_TABLE_ and got_base to
- 0x1000.
- (sunos_check_dynamic_reloc): Subtract got_base from a base
- relative relocation.
-
- * elf32-mips.c (elf_mips_isa): New static function.
- (_bfd_mips_elf_merge_private_bfd_data): Don't warn about linking
- -mips1 and -mips2 code together, or -mips3 and -mips4 code.
-
-Mon Oct 7 11:44:17 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * archive.c (do_slurp_coff_armap): Only treat archive as little
- endian for i960 COFF.
-
-Fri Oct 4 13:49:01 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_compute_section_file_positions): Adjust sofar
- by the change in size of the section when EXEC_P is not set.
-
- * coff-m68k.c (coff_rtype_to_howto): Define if not defined.
- (m68kcoff_rtype_to_howto): New static function.
- * cf-m68klynx.c (coff_m68k_lynx_rtype_to_howto): Add the section
- VMA to the addend for a PC relative reloc.
-
- * dep-in.sed: Rework backslash loop a bit to avoid bug in sed on
- HP/UX 10.20.
- * Makefile.in: Rebuild dependencies.
-
- * dep-in.sed: Remove ../bfd/sysdep.h, since it will appear when
- som.h is included.
-
-Fri Oct 4 11:41:39 1996 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in: Remove explicit dependencies for mn10200 and
- mn10300 files.
- (ALL_MACHINE_CFILES): Add cpu-mn10200.c and cpu-mn10300.c.
- (BFD32_BACKENDS_CFILES): Add elf32-mn10200.c and elf32-mn10300.c
- (dependencies): Rebuilt.
-
-Thu Oct 3 16:57:51 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (coff_link_add_symbols): Set obj_coff_keep_syms
- during this function.
-
- * elflink.c (_bfd_elf_create_linker_section): Only use an existing
- section if the flags are compatible.
-
- * configure.in: Add havevecs, and put it in tdefaults.
- * mpw-config.in: Likewise.
- * configure: Rebuild.
- * targmatch.sed: New file; a sed script to build targmatch.h from
- config.bfd.
- * config.bfd: Add #if, #endif, and comments for targmatch.h.
- * targets.c: Include "fnmatch.h".
- (struct targmatch): Define.
- (bfd_target_match): Define by including targmatch.h.
- (bfd_find_target): If the target is not found by name, search for
- it as a configuration triplet.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add aout-arm.o, aout-sparcle.o, hp300bsd.o,
- i386dynix.o, m68k4knetbsd.o, and riscix.o.
- (BFD32_BACKENDS_CFILES): Add aout-arm.c, aout-sparcle.c,
- hp300bsd.c, i386dynix.c, m68k4knetbsd.c, and riscix.c.
- (HFILES): Add targmatch.h. Also, alphabetize and reindent.
- (CFILES): Remove i386dynix.c and hp300bsd.c.
- (targmatch.h): New target.
- (do_clean): Remove targmatch.h.
-
- * configure.in: Add BFD_NEED_DECLARATION(getenv).
- * acconfig.h: Add NEED_DECLARATION_GETENV.
- * configure, config.in: Rebuild.
- * sysdep.h: If NEED_DECLARATION_GETENV, declare getenv.
- * aout-adobe.c (aout_adobe_object_p): Don't declare getenv.
-
-Thu Oct 3 09:29:09 1996 Jeffrey A Law (law@cygnus.com)
-
- * cpu-mn10x00.c, elf32-mn10x00: Removed.
- * cpu-mn10200.c, cpu-mn10300.c: New files.
- * elf32-mn10200.c, elf32-mn10300.c: New files.
- * Makefile.in: Break mn10x00 support into two separate
- configurations, mn10200 and mn10300.
- * archures.c, config.bfd, configure.in, elf.c, targets.c: Likewise.
- * bfd-in2.h, configure: Rebuilt.
-
-Thu Oct 3 15:38:19 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
-
- * Makefile.in (do_clean): Move config.log to do_distclean.
-
-Wed Oct 2 21:40:55 1996 Jeffrey A Law (law@cygnus.com)
-
- * cpu-mn10x00.c, elf32-mn10x00.c: New files.
- * Makefile.in (ALL_MACHINES): Add cpu-mn10x00.o.
- (BFD32_BACKENDS): Similarly for elf32-mn10x00.o.
- (elf32-mn10x00.o): Add dependencies.
- * archures.c (enum bfd_architecture): Add bfd_arch_mn10x00.
- (bfd_mn10x00_arch): Declare.
- (bfd_archures_list): Add bfd_mn10x00_arch.
- * config.bfd: Add mn10x00-*-*.
- * configure.in: Add bfd_elf32_mn10x00_vec.
- * elf.c (prep_headers): Handle bfd_arch_mn10x00.
- * targets.c (bfd_elf32_mn10x00_vec): Declare.
- (bfd_target_vector): Add bfd_elf32_mn10x00_vec.
- * bfd-in2.h, configure: Rebuilt.
-
-Wed Oct 2 15:46:45 1996 Klaus Kaempf <kkaempf@progis.de>
-
- openVMS/Alpha: Provide filename and case_hack flags via
- symbol table from gas.
- Add case_hack code for symbol output from vax/vms.
- * evax-alpha.c (evax_initialize): Remove filename handling,
- filename is provided via symbol table.
- (evax_get_symtab): Use local symbol count when setting up table.
- * evax-egsd.c (_bfd_evax_slurp_egsd): Print correct name when
- debugging.
- (_bfd_evax_write_egsd): Skip file name symbol.
- * evax-emh.c (get_vms_time_string): Local function now.
- (_bfd_evax_write_emh): Extract source filename and case_hack flags
- from symbol table.
- (_bfd_evax_write_etir): Pass all symbol names through
- _bfd_evax_case_hack_symbol.
- * evax-misc.c (hash_string, _bfd_evax_case_hack_symbol): New
- functions.
- (_bfd_evax_basename): Removed.
- (_bfd_get_vms_time_string): Moved to evax-emh.c.
- * evax.h (evax_private_data_struct): Remove filename.
- (flag_hash_long_names, flag_show_after_trunc,
- flag_no_hash_mixed_case, vms_name_mapping): New flags for
- vms_case_hack.
-
-Wed Oct 2 12:02:02 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * freebsd.h (N_GET_MAGIC_NET): Don't use ntohl.
- (N_GETMID_NET, N_GETFLAG_NET): Likewise.
- (NO_SWAP_MAGIC): Don't define.
- (SWAP_MAGIC): Define.
-
- * cofflink.c (_bfd_coff_link_input_bfd): Don't crash if there is
- no hash table entry for a global symbol.
-
-Tue Oct 1 16:14:22 1996 Joel Sherrill <joel@oarcorp.com>
-
- * config.bfd (mips*-*-rtems*): New target, like mips*-*-elf*.
-
-Tue Oct 1 12:31:39 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (coff_link_add_symbols): Don't override a meaningful
- symbol type with T_NULL. Warn if symbol type changes. Based on
- patch from Philippe De Muyter <phdm@info.ucl.ac.be>.
-
- * elflink.h (elf_link_add_object_symbols): Only put a symbol from
- a dynamic object in the dynamic symbol table if it is referenced
- or defined by a regular object.
-
-Fri Sep 27 18:41:07 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * elf32-v850.c (bfd_elf32_v850_is_local_label): New function to
- remove dwarf local labels. Shrinks binaries by a factor of 3!
-
-Mon Sep 23 13:33:00 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Create the .sbss section
- by hand, rather than by calling bfd_make_section.
-
-Mon Sep 23 09:23:41 1996 Doug Evans <dje@seba.cygnus.com>
-
- * reloc.c: Rename m32r relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
- * elf32-m32r.c: Update.
-
-Fri Sep 20 11:43:43 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (aout_link_input_section_ext): When doing a relocateable
- link, adjust the symbol index of a base relative reloc. Don't
- change the addend of a PC relative reloc if pcrel_offset is set.
- * sunos.c (bfd_sunos_size_dynamic_sections): Don't do anything for
- a relocateable link.
-
- * reloc.c (bfd_perform_relocation): Apply the relocation even if
- it is zero, in case src_mask matters.
- (bfd_install_relocation): Likewise.
-
-Thu Sep 19 11:03:06 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Always initialize
- keep_syms.
- (_bfd_xcoff_bfd_final_link): Don't set target_index
- to an uninitialized value.
-
-Tue Sep 17 14:18:31 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_slurp_line_table): Warn about illegal symbol
- indices, rather than crashing.
- (coff_slurp_reloc_table): Likewise. Check whether the howto field
- is NULL.
- * coff-sh.c (sh_relocate_section): Check for an illegal symbol
- index.
-
-Mon Sep 16 12:39:36 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-arm.c (aoutarm_std_reloc_howto): Change dst_mask for ARM26D
- reloc to 0.
- (coff_arm_adjust_symndx): New static function.
- (coff_adjust_symndx): Define.
-
- * srec.c (srec_scan): Accept multiple symbols on a single line.
- From Pascal Martin <pmartin@alsys.com>.
-
- * README: New file.
-
-Fri Sep 13 14:32:42 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * aoutf1.h (MY_bfd_merge_private_bfd_data): Define.
- (sunos_merge_private_bfd_data): New function.
-
-Fri Sep 13 15:50:57 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd.c (bfd_copy_private_bfd_data): Switch on output BFD rather
- than input BFD.
- (bfd_merge_private_bfd_data): Likewise.
- * section.c (bfd_copy_private_section_data): Likewise.
- * syms.c (bfd_copy_private_symbol_data): Likewise.
- * bfd-in2.h: Rebuild.
- * aout-target.h (MY_bfd_copy_private_section_data): Check that
- both BFD's are the right flavour.
- * ecoff.c (_bfd_ecoff_bfd_copy_private_bfd_data): Likewise.
- * elf.c (_bfd_elf_copy_private_symbol_data): Likewise.
- * elf32-mips.c (_bfd_mips_elf_copy_private_bfd_data): Likewise.
- (_bfd_mips_elf_merge_private_bfd_data): Likewise.
- * elf32-ppc.c (ppc_elf_copy_private_bfd_data): Likewise.
- (ppc_elf_merge_private_bfd_data): Likewise.
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Likewise.
- * peicode.h (pe_bfd_copy_private_section_data): Likewise.
-
- * elf32-hppa.c (elf_hppa_howto_table): Fill in some fields for
- R_PARISC_DIR32, so that _bfd_stab_section_find_nearest_line passes
- its sanity check.
-
-Thu Sep 12 11:45:57 1996 Doug Evans <dje@seba.cygnus.com>
-
- * reloc.c: Add m32r relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
- * cpu-m32r.c, elf32-m32r.c: New files.
-
-Thu Sep 12 11:10:05 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_vec): Set symbol_leading_char field to '_'.
-
-Wed Sep 11 11:57:56 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * tekhex.c (first_phase): Change type parameter from char to int.
- (out): Likewise.
- (pass_over): Change func to expect int, not char.
-
- * elf.c (assign_file_positions_for_segments): Test SEC_ALLOC
- rather than SEC_LOAD when aligning the file offset for the first
- section in a segment.
-
-Tue Sep 10 16:18:30 1996 Fred Fish <fnf@cygnus.com>
-
- * syms.c (coff_section_type): Make arg const.
- * irix-core.c (irix_core_core_file_p): Remove extraneous extra arg
- to make_bfd_asection().
- * elf-bfd.h (bfd_section_from_phdr): Add prototype.
- * elfcode.h (bfd_section_from_phdr): Remove prototype.
- (_bfd_elf_stringtab_init): Remove prototype.
-
- * netbsd-core.c (swap_abort): Add prototype.
- * aix386-core.c (swap_abort): Ditto & make static
- * hpux-core.c (swap_abort): Ditto & make static.
- * irix-core.c (swap_abort): Ditto & make static.
- * ptrace-core.c (swap_abort): Ditto & make static.
- * trad-core.c (swap_abort): Ditto & make static.
- * coffswap.h (coff_swap_reloc_in): Ditto.
- (coff_swap_reloc_out): Ditto.
- (coff_swap_filehdr_in): Ditto.
- (coff_swap_filehdr_out): Ditto.
- (coff_swap_sym_in): Ditto.
- (coff_swap_sym_out): Ditto.
- (coff_swap_aux_in): Ditto.
- (coff_swap_aux_out): Ditto.
- (coff_swap_lineno_in): Ditto.
- (coff_swap_lineno_out): Ditto.
- (coff_swap_aouthdr_in): Ditto.
- (coff_swap_aouthdr_out): Ditto.
- (coff_swap_scnhdr_in): Ditto.
- (coff_swap_scnhdr_out): Ditto.
- * ihex.c (ihex_sizeof_headers): Ditto.
- * tekhex.c (getsym): Ditto.
- (find_chunk): Ditto & make static.
- (insert_byte): Ditto.
- (first_phase): Ditto.
- (pass_over): Ditto.
- (tekhex_get_symtab): Ditto & make static.
- (tekhex_get_symtab_upper_bound): Ditto & make static.
- (tekhex_mkobject): Ditto.
- (tekhex_object_p): Ditto.
- (move_section_contents): Ditto.
- (tekhex_get_section_contents): Ditto.
- (tekhex_set_arch_mach): Ditto & make static.
- (tekhex_set_section_contents): Ditto.
- (writevalue): Ditto.
- (writesym): Ditto.
- (out): Ditto.
- (tekhex_write_object_contents): Ditto.
- (tekhex_sizeof_headers): Ditto.
- (tekhex_make_empty_symbol): Ditto.
- (tekhex_get_symbol_info): Ditto.
- (tekhex_print_symbol): Ditto.
- * irix-core.c (make_bfd_asection): Ditto.
- (irix_core_core_file_p): Ditto.
- (irix_core_core_file_failing_command): Ditto.
- (irix_core_core_file_failing_signal): Ditto.
- (irix_core_core_file_matches_executable_p): Ditto.
- (irix_core_make_empty_symbol): Ditto.
- * coff-mips.c (mips_bfd_reloc_type_lookup): Ditto.
- * srec.c (srec_new_symbol): Ditto.
- (srec_get_section_contents): Ditto.
- (srec_set_arch_mach): Ditto.
- (srec_set_section_contents): Ditto.
- (internal_srec_write_object_contents): Ditto.
- (srec_write_object_contents): Ditto.
- (symbolsrec_write_object_contents): Ditto.
- (srec_sizeof_headers): Ditto.
- (srec_make_empty_symbol): Ditto.
- (srec_get_symtab_upper_bound): Ditto.
- (srec_get_symtab): Ditto.
- (srec_print_symbol): Ditto and make static.
- * elf.c (elf_read): Ditto
- (assign_section_numbers): Ditto.
- (elf_fake_sections): Ditto.
- (sym_is_global): Ditto.
- (elf_map_symbols): Ditto.
- (get_program_header_size): Ditto.
- * coffgen.c (make_a_section_from_file): Ditto.
- (coff_real_object_p): Ditto.
- (fixup_symbol_value): Ditto.
- (build_debug_section): Ditto.
- (copy_name): Ditto.
- * syms.c (coff_section_type): Ditto.
-
-Mon Sep 9 22:36:01 1996 Jeffrey A Law (law@cygnus.com)
-
- * bfd-in2.h: Rebuilt after m32r changes.
-
-Mon Sep 9 12:31:22 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * config.bfd: Add m32r support.
- * configure.in: Likewise.
- * configure: Likewise.
- * Makefile.in: Likewise.
- * archures.c: Likewise.
- * elf.c: Likewise.
- * targets.c: Likewise.
- * config.bfd: Keep target list alphabetically sorted.
-
-Mon Sep 9 11:48:41 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (bfd_elf32_v850_reloc, case R_V850_HI16): Don't forget
- to add in the constant part found in the instruction itself.
- (case R_V850_HI16_S): Likewise.
-
-Fri Sep 6 17:04:39 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * elf32-d10v.c (elf_d10v_howto_table): Modify the size of R_D10V_16
- and R_D10V_18 to be 1 (word).
-
-Thu Sep 5 15:23:08 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * stabs.c (_bfd_link_section_stabs): If the output_section field
- of either section is bfd_abs_section, then the linker is
- discarding the section and we should not optimize it.
-
-Tue Sep 3 12:16:20 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (aout-sparcle.o): New target.
- * aoutf1.h (TARGET_IS_BIG_ENDIAN_P): Don't define if little endian.
- * config.bfd (sparclet-*-aout*): Add case.
- * configure.in (sparcle_aout_vec): Add case.
- * configure: Regenerated.
- * targets.c (sparcle_aout_vec): Declare.
- (bfd_target_vector): Add sparcle_aout_vec.
- * aout-sparcle.c: New file.
-
-Tue Sep 3 00:57:02 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (bfd_elf32_v850_reloc): Fix handling of
- low order sign bit propogation for R_V850_HI16_S.
-
- * elf32-v850.c (bfd_elf32_v850_reloc): New function for
- handling V850 specific relocs.
- (elf_v850_howto_table): Use the new function for some
- relocations. Twiddle masks & shifts for some relocs.
- Set partial_inplace where needed.
-
-Mon Sep 2 12:12:34 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cpu-mips.c: Add an explicit mips:3000 entry, and change the
- default architecture to a machine number of 0.
- * elf32-mips.c (_bfd_mips_elf_object_p): Set the machine number
- for E_MIPS_ARCH_1.
- (_bfd_mips_elf_merge_private_bfd_data): If the machine number of
- the output BFD is the default, set it from the first input BFD.
-
-Sun Sep 1 18:38:01 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (elf_v850_howto_table): All the 16bit relocs
- insert at bitpos zero. The HI16 relocs are shifted right
- by 16 bits. Fix src_mask for all relocs.
- (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Define. The V850 is
- little endian!
- (TARGET_BIG_SYM, TARGET_BIG_NAME): Remove. The V850 is little
- endian!
-
-Sun Sep 1 15:41:08 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * rs6000-core.c (rs6000coff_core_file_matches_executable_p):
- Rewrite to use BFD file read routines and to avoid using a fixed
- length for the file name.
-
-Sat Aug 31 10:22:25 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (enum reloc_type): Add R_V850_{32,16,8}.
- (elf_v850_howto_table): Add support for R_V850_{32,16,8}.
- (v850_reloc_map): Add translation from BFD_RELOC_{32,16,8}
- to R_V850_{32,16,8}.
-
-Fri Aug 30 18:06:04 1996 J.T. Conklin <jtc@hippo.cygnus.com>
-
- * elf32-v850.c (reloc_type): Add R_V850_HI16_S.
- (elf_v850_howto_table): Add info for HI16_S reloc.
- (v850_reloc_map): Add HI_16_S reloc.
- * reloc.c: Define BFD_RELOC_V850_* relocs.
-
-Fri Aug 30 11:49:19 1996 Ian Lance Taylor <ian@cygnus.com>
-
- Add SH ELF support.
- * elf32-sh.c: New file.
- * elf.c (prep_headers): Handle bfd_arch_sh.
- * elfcode.h (write_relocs): Handle absolute symbol.
- * elf-bfd.h (_bfd_elf32_link_read_relocs): Declare.
- (_bfd_elf64_link_read_relocs): Declare.
- * elflink.h (NAME(_bfd_elf,link_read_relocs)): Rename from
- elf_link_read_relocs. Make globally visible. Change all
- callers.
- (elf_link_input_bfd): Get external symbols from cache in
- symtab_hdr->contents. Get contents from cache in
- elf_section_data.
- * elfxx-target.h (bfD_elfNN_bfd_relax_section): Only define if not
- already defined.
- * reloc.c: Define BFD_RELOC_SH_* relocs.
- * libbfd-in.h (_bfd_sh_align_load_span): Declare.
- * coff-sh.c (sh_insns_conflict): Fix a return value.
- (_bfd_sh_align_load_span): New globally visible function, broken
- out of sh_align_load.
- (sh_align_load): Call _bfd_sh_align_load_span.
- (sh_swap_insns): Change relocs parameter to PTR.
- * bfd-in2.h, libbfd.h: Rebuild.
- * targets.c (bfd_elf32_sh_vec): Declare.
- (bfd_elf32_shl_vec): Declare.
- * config.bfd (sh-*-elf*): New target.
- * configure.in (bfd_elf32_sh_vec): New target vector.
- (bfd_elf32_shl_vec): New target vector.
- * configure: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add elf32-sh.o.
- (BFD32_BACKENDS_CFILES): Add elf32-sh.c.
-
- * elf.c (map_sections_to_segments): Check that LMA does not skip a
- page before checking D_PAGED.
-
- * ihex.c (ihex_scan): Removed unnecessary extbase variable.
- (ihex_write_object_contents): Remove extbase; always use segbase
- instead.
-
-Thu Aug 29 16:52:17 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * configure.in (i[345]86-*-*): Recognize i686 for pentium pro.
- * configure.host (i[345]86-*-*): Ditto.
- * config.bfd (i[345]86-*-*): Ditto.
- * configure: Regenerate.
-
- * config.bfd (i[3456]86-*-dgux*): Recognize as a synonym for x86
- elf.
-
-Tue Aug 27 09:18:18 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-hppa.c (hppa_elf_gen_reloc_type): Add new argument.
- * elf32-hppa.h (hppa_elf_gen_reloc_type): Update prototype.
- * som.c (hppa_som_gen_reloc_type): Add new argument. If
- we encounter an R_DATA_ONE_SYMBOL reloc against a symbol that
- will have an ST_CODE type, change the symbol's type to ST_DATA.
- * som.c (hppa_som_gen_reloc_type): Update prototype.
-
-Tue Aug 27 00:12:22 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_check_relocs): Set dynobj if needed for
- R_MIPS_32 and R_MIPS_REL32. Set sgot and g as soon as possible.
- (mips_elf_size_dynamic_sections): Don't require .got to exist.
- (mips_elf_finish_dynamic_sections): Likewise.
-
-Thu Aug 22 10:54:38 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host (HLDENV): New variable to set. Set it for
- *-*-sysv4*, since those linkers may not support -R but they always
- support LD_RUN_PATH.
-
- * libieee.h (NSECTIONS): Don't define.
- (ieee_data_struct): Change section_table to asection **. Add
- section_table_size.
- * ieee.c (get_section_entry): If the table isn't big enough, make
- it bigger.
- (ieee_slurp_sections): Remove assertion about number of sections.
- (ieee_object_p): Adjust initialization of ieee to match changes to
- the structure.
-
- * xcofflink.c (xcoff_mark): Don't copy relocs for undefined
- symbols merely because we are generating a shared library.
- (xcoff_build_ldsyms): Don't set up global linkage code for an
- undefined symbol merely because we are generating a shared
- library.
-
-Tue Aug 20 15:06:05 1996 J.T. Conklin <jtc@hippo.cygnus.com>
-
- * Makefile.in (ALL_MACHINES): Add cpu-v850.o.
- (BFD32_BACKENDS) Add elf32-v850.o.
- * archures.c: Add bfd_v850_arch.
- * bfd-in2.h: Add bfd_v850_arch.
- * config.bfd (v850-*-*): New target.
- * configure: (bfd_elf32_v850_vec) New vector.
- * configure.in: (bfd_elf32_v850_vec) New vector.
- * cpu-v850.c: New file.
- * elf.c (prep_headers): Added case bfd_arch_v850.
- * elf32-v850.c: New file.
- * targets.c (bfd_elf32_v850_vec): New vector.
-
-Fri Aug 16 16:25:35 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_dynamic_symbols): Create and define
- a function code symbol for an XMC_XO symbol.
-
-Thu Aug 15 12:33:29 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-config.in: Update editing of autoconf vars to reflect
- Jul 18 configure.in change.
- * mpw-make.sed: Update editing of include pathnames to be
- more general, add @DASH_C_FLAG@ to explicit compile rule edit.
-
-Thu Aug 15 10:35:13 1996 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c (elf64_alpha_output_extsym): The section from
- which to offset to get the .plt entry address is ".plt".
-
-Thu Aug 15 16:40:30 1996 James G. Smith <jsmith@cygnus.co.uk>
-
- * reloc.c: (BFD_RELOC_ARM_THUMB_ADD, BFD_RELOC_ARM_THUMB_IMM,
- BFD_RELOC_ARM_THUMB_SHIFT, BFD_RELOC_ARM_THUMB_OFFSET):
- Added, for internal use by the ARM gas.
- * libbfd.h: Rebuilt
- * bfd-in2.h: Rebuilt
-
-Wed Aug 14 17:02:09 1996 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Correct typo
- in section dynidx start.
-
-Tue Aug 13 14:35:38 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Treat sections whose
- name begins with .gnu.linkonce as SEC_LINK_ONCE. This is an
- optimization for g++.
-
-Tue Aug 13 17:04:40 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_merge_private_bfd_data): If one module has
- the -mrelocatable-lib bit set and the other doesn't, clear the
- -mrelocatable-lib bit in the header.
-
-Sat Aug 10 22:59:17 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Do not resolve a common
- symbol against a STT_FUNC symbol in a shared library.
-
-Fri Aug 9 12:44:57 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_dynamic_symbols): If a descriptor
- symbol is found, automatically define the corresponding function
- code.
-
- * cofflink.c (coff_link_add_symbols): Only set (*sym_hash)->numaux
- if sym.n_numaux is not zero.
- (_bfd_coff_link_input_bfd): Permit the symbol and the hash table
- entry to disagree about the number of aux entries if the symbol
- has zero.
-
- * elf32-mips.c (mips_elf_check_relocs): Create the .rel.dyn
- section if it might be needed, not just if info->shared.
- (mips_elf_adjust_dynamic_symbol): Make room for a null element at
- the start of .rel.dyn if we are going to use it.
- (mips_elf_finish_dynamic_sections): Only clear the first element
- of .rel.dyn if the size is greater than zero.
-
-Thu Aug 8 16:24:55 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_input_bfd): If we already called the
- undefined_symbol callback for a symbol, then don't issue any more
- warnings about loader relocs.
- (_bfd_ppc_xcoff_relocate_section): Don't do any further processing
- after calling the undefined_symbol callback.
-
- * xcofflink.c (XCOFF_MULTIPLY_DEFINED): Define.
- (xcoff_link_add_symbols): Permit multiple definitions of a symbol
- as the AIX linker seems to do.
-
-Thu Aug 8 12:21:56 1996 Klaus Kaempf <kkaempf@progis.de>
-
- * evax-alpha.c (evax_alpha_vec): Corrected flags, cleanup.
- (evax_initialize): Remove evax_reloc_table.
- (evax_close_and_cleanup): Ditto.
- (reloc_nil): Ditto.
- (alpha_howto_table): Remove ALPHA_R_SWREL32 and ALPHA_R_SWREL64
- entries.
- (evax_bfd_reloc_type_lookup): Ditto.
- * evax-egsd.c (_bfd_evax_slurp_egsd): Add a few casts; set
- cooked_size == raw_size.
- * evax-emh.c (_bfd_evax_register_filename): Remove.
- * evax-etir.c (etir_stc): Allow ETIR_S_C_STC_xx commands.
- * evax-misc.c (add_new_contents): Malloc section at full size.
- (_bfd_save_evax_section): Memcpy section contents directly.
- * evax.h (ALPHA_R_SWREL32, ALPHA_R_SWREL64): Remove.
- (evax_reloc_table): Remove.
-
- * hosts/alphavms.h (O_ACCMODE): Define if needed.
-
- * makefile.vms: Add better support for DEC C compilation
- Add evax.h dependencies
-
- * reloc.c (bfd_get_reloc_size): Add case for 16 byte reloc.
- (BFD_RELOC_SWREL32,BFD_RELOC_SWREL64): Remove.
- (BFD_RELOC_ALPHA_BASEREG): Remove.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-Thu Aug 8 08:17:32 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * archive.c (bsd_write_armap): Ifdef around calls to getuid and
- getgid if _WIN32 is defined.
- * opncls.c (bfd_fdopenr): Remove unnecessary WINGDB ifdef.
-
-Wed Aug 7 23:19:00 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * aoutx.h bfd-in.h bfd-in2.h opncls.c riscix.c som.c targets.c:
- Change NO_FLAGS to BFD_NO_FLAGS to avoid conflict with an HPUX
- include file.
- * libbfd.c: Create dummy getpagesize() macro if HAVE_GETPAGESIZE
- isn't defined.
-
-Wed Aug 7 14:11:44 1996 Philippe De Muyter <phdm@info.ucl.ac.be>
-
- * configure.in: Call BFD_NEEDED_DECLARATION on strstr and
- realloc.
- * acconfig.h (NEED_DECLARATION_STRSTR): New macro.
- (NEED_DECLARATION_REALLOC): New macro.
- * configure, config.in: Rebuild.
- * sysdep.h (strstr): Declare if NEED_DECLARATION_STRSTR.
- (realloc): Declare if NEED_DECLARATION_REALLOC.
-
- * aclocal.m4 (BFD_NEED_DECLARATION): Include <string.h> or
- <strings.h> if they exist.
-
- * ieee.c (ieee_set_section_contents): Cast bfd_alloc return.
-
-Wed Aug 7 12:12:03 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cpu-i386.c (i8086_arch): Architecture info for the i8086.
-
- Based on patches from Eric Valette <valette@crf.canon.fr>:
- * elf32-i386.c (enum reloc_type): Add FIRST_INVALID_RELOC,
- LAST_INVALID_RELOC, R_386_16, R_386_PC16, R_386_8, R_386_PC8.
- (elf_howto_table): Add entries for new relocs.
- (elf_i386_reloc_type_lookup): Handle new relocs.
- (elf_i386_info_to_howto): Just call abort.
- (elf_i386_info_to_howto_rel): Check that the reloc type is valid.
- (elf_i386_relocate_section): Likewise.
-
-Tue Aug 6 12:54:56 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * elf32-d10v.c (elf_d10v_howto_table): Added R_D10V_32.
-
-Mon Aug 5 13:42:41 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): For a loadable section,
- only get the LMA from the phdr if they are in the same part of the
- file.
-
- * elf.c (map_sections_to_segments): Rewrite tests for starting a
- new segment to make them more comprehensible. If the relationship
- between the LMA and the VMA changed, start a new segment. Don't
- check dynsec when deciding whether to start a new segment for a
- writeable section; -N will now handle this.
-
-Thu Aug 1 22:43:08 1996 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h: Remove "esel" changes. Not the right approach.
- * som.c: Corresponding changes.
- (som_bfd_derive_misc_symbol_info): Use ST_DATA for symbols
- which don't have a SOM symbol type associated with them.
- Reverses a 1994 change.
-
-Wed Jul 31 15:50:55 1996 Ian Lance Taylor <ian@cygnus.com>
-
- Make ld -N more reasonable for ELF:
- * elf.c (map_sections_to_segments): If D_PAGED is not set, set
- phdr_in_section to false, and always use a single load segment.
- (elf_sort_sections): Sort sections by LMA after VMA.
- (assign_file_positions_for_segments): If D_PAGED is not set, don't
- align to maxpagesize.
- (assign_file_positions_except_relocs): Likewise.
- * elfcode.h (elf_object_p): If a section is loaded but not page
- aligned, clear D_PAGED.
-
-Wed Jul 31 15:00:12 1996 James G. Smith <jsmith@cygnus.co.uk>
-
- * reloc.c: (BFD_RELOC_ARM_OFFSETIMM8, BFD_RELOC_ARM_HWLITERAL):
- Added, for internal use by the ARM gas.
- * libbfd.h: Rebuilt
- * bfd-in2.h: Rebuilt
-
-Tue Jul 30 14:14:57 1996 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h (R_HPPA_ESEL): New field selector.
- (e_esel): Similarly.
- * som.c (hppa_som_gen_reloc_type): If we encounter an e_esel,
- then generate R_COMP2 (PUSH_SYM), R_DATA_EXPR fixup stream.
- (som_write_fixups): Handle R_DATA_EXPR just like R_CODE_EXPR.
-
-Tue Jul 30 13:31:27 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Do the regular
- archive search before looking for stripped dynamic objects.
-
-Fri Jul 26 17:51:39 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_build_ldsyms): Make exporting an undefined
- symbol a warning rather than an error.
-
-Wed Jul 24 12:02:53 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): Track the virtual
- memory position separately from the file position, and use it to
- compute the alignment adjustment.
-
-Tue Jul 23 10:43:31 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * elf32-d10v.c (elf_d10v_howto_table): Changed all relocs to "long"
- and fixed mask on R_D10V_10_PCREL_L.
-
-Mon Jul 22 15:30:30 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf64-mips.c: Include "aout/ar.h".
- (mips_elf64_slurp_armap): New static function.
- (mips_elf64_write_armap): New static function.
- (bfd_elf64_archive_*): Define.
- * elfxx-target.h (bfd_elfNN_archive_p): Define if not defined.
- Use instead of bfd_generic_archive_p.
- (bfd_elfNN_write_archive_contents): Define if not defined. Use
- instead of _bfd_write_archive_contents.
- (bfd_elfNN_mkdarchive): Define if not defined. Use instead of
- _bfd_generic_mkarchive.
- (TARGET_BIG_SYM): If bfd_elfNN_archive_functions is defined, use
- bfd_elfNN_archive in BFD_JUMP_TABLE_ARCHIVE rather than
- _bfd_archive_coff.
- (TARGET_LITTLE_SYM): Likewise.
- * archive.c (bfd_slurp_armap): Check for and reject an archive map
- name of /SYM64/.
- * Makefile.in: Rebuild dependencies.
-
- * elf32-mips.c (_bfd_mips_elf_final_write_processing): Handle
- SHT_MIPS_LIBLIST, SHT_MIPS_CONTENT, SHT_MIPS_SYMBOL_LIB, and
- SHT_MIPS_EVENTS sections.
- (_bfd_mips_elf_section_from_shdr): Handle SHT_MIPS_IFACE,
- SHT_MIPS_CONTENT, SHT_MIPS_SYMBOL_LIB, and SHT_MIPS_EVENTS
- sections.
- (_bfd_mips_elf_fake_sections): Likewise.
-
- * libecoff.h (ecoff_data_type): Add rdata_in_text field.
- * ecoff.c (ecoff_compute_section_file_positions): Copy
- rdata_in_text from backend info to tdata. Clear it if any data
- section comes before .rdata.
- (_bfd_ecoff_write_object_contents): Use rdata_in_text field in
- tdata rather than backend info.
-
-Fri Jul 19 18:15:51 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Fix test for whether a compiler has a 64 bit
- type. From Jim Wilson <wilson@cygnus.com>.
-
-Thu Jul 18 15:39:10 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host (mips-sgi-irix6*): New host.
-
- * configure.in: Set and substitute VERSION, BFD_HOST_64BIT_LONG
- (replacing HOST_64BITLONG), BFD_HOST_64_BIT_DEFINED,
- BFD_HOST_64_BIT, and BFD_HOST_U_64_BIT. Add bfd-in2.h:bfd-in2.h
- to AC_OUTPUT call.
- * configure: Rebuild.
- * bfd-in.h (BFD_ARCH_SIZE): Define as @wordsize@, not @WORDSIZE@.
- (BFD_HOST_64_BIT): Define conditionally.
- (BFD_HOST_U_64_BIT): Define when BFD_HOST_64_BIT is defined.
- (bfd_vma): Typedef as BFD_HOST_U_64_BIT.
- (symvalue, bfd_size_type): Likewise.
- * bfd-in2.h: Rebuild.
- * Makefile.in (do_clean): Remove bfd-tmp.h.
- (do_distclean): Remove bfd-in3.h.
- (stmp-bfd.h): Just do copy-if-change bfd-in3.h bfd.h.
- (bfd-in3.h): New target.
-
- * config.bfd (sparc-*-sysv4*): Don't build sunos_big_vec. From
- Andrew Gierth <ANDREWG@microlise.co.uk>.
-
- * configure.host: Set INSTALL_SHLIB.
- * configure.in: Call AC_SUBST (INSTALL_SHLIB).
- * configure: Rebuild.
- * Makefile.in (install): Use @INSTALL_SHLIB@.
-
- * config.bfd (mips*-*-irix6*): New target.
- * configure.host: Handle Irix 6 shared library like Irix 5.
-
- * xcofflink.c (xcoff_link_add_symbols): Don't check an XMC_TD
- symbol for a magic name.
- (xcoff_link_input_bfd): Don't change the reloc symbol for an
- XMC_TD symbol.
- (_bfd_ppc_xcoff_relocate_section): Don't get the TOC offset for an
- XMC_TD symbol.
-
-Thu Jul 18 11:36:31 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-config.in: Add ELF support to mips config, create the
- elf32-target.h file in the object dir.
- * mpw-make.sed: Edit elfXX-target.h refs at beginnings of lines.
-
-Wed Jul 17 18:02:32 1996 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c: Redid debug scheme - numerous fprintf's gone.
- Also removed most abort calls, in favor of using bfd reporting.
-
-Wed Jul 17 14:51:52 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
-
- * Makefile.in (ALL_MACHINES): Add cpu-d10v.o.
- (BFD32_BACKENDS) Add elf32-d10v.o.
- * archures.c: Add bfd_d10v_arch.
- * bfd-in2.h: Add bfd_d10v_arch.
- * config.bfd (d10v-*-*): New target.
- * configure: (bfd_elf32_d10v_vec) New vector.
- * configure.in: (bfd_elf32_d10v_vec) New vector.
- * cpu-d10v.c: New file.
- * elf.c (prep_headers): Added case bfd_arch_d10v.
- * elf32-d10v.c: New file.
- * libbfd.h: Rebuild.
- * reloc.c (BFD_RELOC_D10V_10_PCREL_R, BFD_RELOC_D10V_10_PCREL_L,
- BFD_RELOC_D10V_18, BFD_RELOC_D10V_18_PCREL): Define.
- * targets.c (bfd_elf32_d10v_vec): New vector.
-
-Wed Jul 17 10:58:55 1996 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (coff_ppc_relocate_section): Removed bogus fprintf
-
-Tue Jul 16 23:49:02 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * archures.c bfd-in2.h: Add bfd_mach_i386_i386 and
- bfd_mach_i386_i8086 machine types.
-
-Wed Jul 10 12:42:56 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (_bfd_ecoff_new_section_hook): Set SEC_CODE for _INIT
- and _FINI sections.
-
-Wed Jul 10 11:18:21 1996 Richard Henderson <rth@tamu.edu>
-
- * coffcode.h (coff_set_section_contents): A/UX does not require
- special handling of the _LIB section.
-
-Tue Jul 9 15:52:20 1996 Jeffrey A Law (law@cygnus.com)
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Use the correct
- value for R_RELBYTE.
-
- * reloc16.c (bfd_coff_reloc16_relax_section): Only "shrinks"
- array if one was allocated.
-
-Tue Jul 9 12:21:54 1996 Ian Lance Taylor <ian@cygnus.com>
-
- From Kazumoto Kojima <kkojima@kk.info.kanagawa-u.ac.jp>:
- * elf32-mips.c (struct mips_elf_link_hash_table): Add new fields
- use_rld_obj_head and rld_value.
- (mips_elf_link_hash_table_create): Initialize new fields.
- (mips_elf_add_symbol_hook): Mark __rld_obj_head symbol as
- dynamic.
- (mips_elf_create_dynamic_sections): Create .rld_map section. If
- __rld_obj_head symbol not seen, create an __rld_map symbol.
- (mips_elf_size_dynamic_sections): Make space in .rld_map section.
- Create a DT_MIPS_RLD_MAP entry rather than a DT_DEBUG entry.
- (mips_elf_finish_dynamic_symbol): Save value of __rld_map or
- __rld_obj_head symbol.
- (mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP.
-
-Mon Jul 8 16:18:03 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_reloc_map): Remove BFD_RELOC_32_PCREL entry.
-
- * elf32-ppc.c (ppc_elf_howto_raw): For R_PPC_ADDR16_HA, use
- ppc_elf_addr16_ha_reloc.
- (ppc_elf_addr16_ha_reloc): New static function.
-
- * coff-mips.c (struct mips_hi): Define.
- (mips_refhi_list): New static variable.
- (mips_refhi_addr, mips_refhi_addend): Remove.
- (mips_refhi_reloc): Maintain a list of unmatched REFHI relocs.
- (mips_reflo_reloc): Process mips_refhi_list.
- (mips_relhi_list): New static variable.
- (mips_relhi_addr, mips_relhi_addend): Remove.
- (mips_relhi_reloc): Maintain a list of unmatched RELHI relocs.
- (mips_rello_reloc): Process mips_relhi_list.
- (mips_relocate_section): Permit an arbitrary number of REFHI or
- RELHI relocs before the associated REFLO or RELLO reloc.
-
-Fri Jul 5 19:27:49 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aout-target.h (MY(callback)): Set reloc_count fields.
-
-Thu Jul 4 12:00:37 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_add_dynamic_symbols): Don't create dynamic
- sections unless this is a SunOS link.
-
- * VERSION: Set to 2.7.1.
-
- * Released binutils 2.7.
-
-Wed Jul 3 14:59:47 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * i386aout.c: Include "aout/aout64.h".
- (i386aout_write_object_contents): New static function.
- (MY_write_object_contents): Define.
-
- * netbsd.h (MY(write_object_contents)): Make sure that
- adjust_sizes_and_vmas is called before fiddling with the magic
- number.
-
-Tue Jul 2 23:30:39 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * stabs.c (_bfd_link_section_stabs): Fix casts of psinfo.
-
-Sun Jun 30 13:34:33 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd-in.h (itos, stoi): Don't define.
- * libbfd.h: Rebuild.
- * i386lynx.c (KEEPIT): Define as udata.i.
- (NAME(lynx,swap_std_reloc_out)): Don't use stoi.
- (NAME(lynx,swap_ext_reloc_out)): Likewise.
- * riscix.c (riscix_swap_std_reloc_out): Use udata.i rather than
- flags. Don't use stoi.
-
- * elf32-mips.c (ELF_MAGPAGESIZE): Change definition to 0x1000.
-
- * elf.c (map_sections_to_segments): Don't start a new segment for
- a writable section if it's on the same page as the previous
- segment. Reset the writable variable for a readonly section.
-
-Sat Jun 29 16:18:51 1996 Kim Knuttila <krk@cygnus.com>
-
- * peicode.h (coff_swap_aouthdr_in): Missing initializations of
- first_thunk_address, thunk_size, and import_table_size.
- * peicode.h: Improved some diagnostics regarding edata sections.
-
- * coff-ppc.c (coff_ppc_relocate_section): Earlier error check
- on IMGLUE relocs.
- (coff_ppc_relocate_section): Improved diagnostic for large TOCDEFN's.
- (TARGET_LITTLE_SYM): Added missing D_PAGED.
-
-Fri Jun 28 13:48:45 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_check_ar_symbols): An undefined symbol
- with XCOFF_DEF_DYNAMIC set is really defined.
- (xcoff_link_check_dynamic_ar_symbols): Likewise.
- (xcoff_link_add_symbols): Only create special sections if using an
- XCOFF hash table.
-
- * reloc.c (bfd_perform_relocation): Handle xcoff-powermac like
- aixcoff-rs6000.
- (bfd_install_relocation): Likewise.
-
-Fri Jun 28 11:17:00 1996 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c (struct alpha_elf_link_hash_entry): Add flags
- field.
- (ALPHA_ELF_LINK_HASH_LU_ADDR): Define.
- (ALPHA_ELF_LINK_HASH_LU_MEM): Define.
- (ALPHA_ELF_LINK_HASH_LU_FUNC): Define.
- (elf64_alpha_link_hash_newfunc): Initialize flags field.
- (elf64_alpha_check_relocs): Record types of LITUSE entries that
- are found for LITERAL relocs.
- (elf64_alpha_adjust_dynamic_symbol): If a symbol has its address
- taken, we cannot generate a .plt entry for the symbol.
-
-Thu Jun 27 11:24:29 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Add AC_ISC_POSIX, and check for setitimer and
- sysconf functions (for gprof).
- * configure, config.in: Rebuild.
-
-Wed Jun 26 16:29:02 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (_bfd_ecoff_archive_p): Check the first object file in
- an archive if it has a map. If the object file has the wrong
- xvec, reject it.
-
- * coff-alpha.c (alpha_adjust_reloc_in): Set the addend for a
- BRADDR, SREL16, SREL32, or SREL64 reloc against an external
- symbol.
- (alpha_relocate_section): Likewise.
-
- * coffswap.h (coff_swap_reloc_out): Use RELSZ, not sizeof.
- (coff_swap_filehdr_out): Use FILHSZ, not sizeof.
- (coff_swap_sym_out): Use SYMESZ, not sizeof.
- (coff_swap_aux_out): Use AUXESZ, not sizeof.
- (coff_swap_lineno_out): Use LINESZ, not sizeof.
- (coff_swap_aouthdr_out): Use AOUTSZ, not sizeof.
- (coff_swap_scnhdr_out): Use SCNHSZ, not sizeof.
- * peicode.h: Corresponding changes.
-
-Tue Jun 25 15:28:34 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elflink.h (elf_create_pointer_linker_section): Comment out code
- dealing with making GOT pointers negative of the GOT symbol for
- now.
-
-Tue Jun 25 11:41:24 1996 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't
- increment the .rela.plt size until after we're done creating the
- .plt entry.
- (elf64_alpha_finish_dynamic_symbol): Change .plt entry to load the
- .rela.plt offset directly rather than calculating it.
-
-Mon Jun 24 17:15:10 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
-
- * Makefile.in (bindir, libdir, datadir, mandir, infodir, includedir):
- Use autoconf-set values.
- * doc/Makefile.in (bindir, libdir, datadir, mandir, infodir,
- includedir, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Use autoconf-set
- values.
- (docdir): Deleted.
- * configure.in (AC_PREREQ): autoconf v2.5 or higher.
- * configure: Rebuilt.
-
-Mon Jun 24 22:50:35 1996 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_write_fixups): Fix typo in R_END_TRY for exception
- handling code > 1k away.
-
-Mon Jun 24 18:41:06 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elflink.h (elf_create_pointer_linker_section): If DEBUG is
- defined, output whenever the symbol is updated.
-
-Mon Jun 24 17:58:12 1996 Jouke Numan <jnuman@bazis.nl>
-
- * elf.c (elf_fake_sections): Don't set sh_addr of a non SEC_ALLOC
- section to 0 if user_set_vma is set.
- * elflink.h (elf_bfd_final_link): Likewise.
-
-Sun Jun 23 20:42:51 1996 Doug Evans <dje@canuck.cygnus.com>
-
- Partially undo patch of Jun 20.
- * coffcode.h (coff_set_alignment_hook): Use COFF_IMAGE_WITH_PE.
- (coff_compute_section_file_positions): Likewise.
- (coff_write_object_contents): Likewise. Re-add deleted code, but
- use #ifdef COFF_WITH_PE, not COFF_OBJ_WITH_PE.
- * peicode.h (pe_bfd_copy_private_bfd_data): Re-add #ifdef.
-
-Fri Jun 21 17:38:15 1996 Joel Sherrill <joel@merlin.gcs.redstone.army.mil>
-
- * config.bfd: Add support for *-*-rtems* configurations.
-
-Fri Jun 21 15:19:59 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (prep_headers): Add bfd_arch_alpha case.
-
-Fri Jun 21 12:35:27 1996 Richard Henderson <rth@tamu.edu>
-
- * elf64-alpha.c: New file.
- * config.bfd (alpha-*-linuxecoff*): New target.
- (alpha-*-linux*, alpha-*-elf*): New targets.
- * configure.in (bfd_elf64_alpha_vec): New vector.
- * configure: Rebuild.
- * targets.c (bfd_elf64_alpha_vec): Declare.
- (bfd_target_vector): Add bfd_elf64_alpha_vec if BFD64.
- * reloc.c (BFD_RELOC_ALPHA_GPDISP): Define.
- * bfd-in2.h, libbfd.h: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (BFD64_BACKENDS): Add elf64-alpha.o.
- (BFD64_BACKENDS_CFILES): Add elf64-alpha.c.
-
-Thu Jun 20 18:14:25 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (ecoff_armap_hash): If hlog is 0, just return 0, rather
- than relying on a right shift of 32.
-
-Thu Jun 20 11:00:57 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * coffcode.h (coff_set_alignment_hook): Change COFF_IMAGE_WITH_PE
- ifdef to COFF_WITH_PE.
- (coff_compute_section_file_positions): Likewise.
- (coff_write_object_contents): Likewise. Delete COFF_OBJ_WITH_PE.
- * pe-{arm,i386,ppc}.c (COFF_OBJ_WITH_PE): Delete.
- * peicode.h (pe_bfd_copy_private_bfd_data): Delete ifdef
- COFF_IMAGE_WITH_PE, always include.
-
- * peicode.h (coff_swap_scnhdr_out): ".drectve" doesn't have trailing 0.
-
-Wed Jun 19 11:37:52 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (map_sections_to_segments): Fix up the test for -Ttext to
- approximate the correct answer if SIZEOF_HEADERS was not used.
-
- * binary.c (binary_set_section_contents): Set section file
- position based on LMA rather than VMA.
-
-Wed Jun 19 11:19:25 1996 Manfred Hollstein KS/EIC5 60/3/142 #40283 <manfred@lts.sel.alcatel.de>
-
- * linker.c (_bfd_generic_link_output_symbols): Don't output any
- symbols if info->strip == strip_all.
-
-Tue Jun 18 15:17:36 1996 Jeffrey A. Law <law@rtl.cygnus.com>
-
- * coff-h8300.c: Remove #if 0 code.
- (compatable): Don't allow mixing/matching of different architectures.
-
- * archures.c (bfd_mach_h8300s): Add.
- * bfd-in2.h: Rebuilt.
- * coff-h8300.c (funcvec_hash_newfunc): Handle H8/S too.
- (BADMAG): Likewise.
- (h8300_reloc16_estimate): Likewise.
- (h8300_reloc16_extra_cases): Likewise.
- (h8300_bfd_link_add_symbols): Likewise.
- * coffcode.h (coff_set_arch_mach_hook): Likewise.
- (coff_set_flags): Likewise.
- * cpu-h8300.c (h8300_scan): Likewise.
- Add H8/S to bfd_h8300_arch list.
-
-Tue Jun 18 14:42:58 1996 Klaus Kaempf <kkaempf@progis.de>
-
- Added support for Alpha OpenVMS:
- * evax.h, evax-alpha.c, evax-egsd.c, evax-emh.c: New files.
- * evax-etir.c, evax-misc.c, hosts/alphavms.h: New files.
- * config.h-vms, makefile.vms: New files.
- * config.bfd (alpha-*-*vms*): New target.
- * configure.in (evax_alpha_vec): New target vector.
- * configure: Rebuild.
- * reloc.c (BFD_RELOC_SWREL32, BFD_RELOC_SWREL64): Define.
- (BFD_RELOC_ALPHA_LINKAGE, BFD_RELOC_ALPHA_BASEREG): Define.
- * targets.c (bfd_target_evax_flavour): Define.
- (evax_alpha_vec): Declare.
- (bfd_target_vector): Add ecoffalpha_little_vec and evax_alpha_vec
- if BFD64 is defined.
- * bfd-in2.h, libbfd.h: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (BFD64_BACKENDS): Add evax-alpha.o, evax-egsd.o, evax-etir.o,
- evax-emh.o, and evax-misc.o.
- (BFD64_BACKENDS_CFILES): Add evax-alpha.c, evax-egsd.c,
- evax-etir.c, evax-emh.c, and evax-misc.c.
- (HFILES): Add evax.h.
-
-Tue Jun 18 13:54:18 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Make name a const
- pointer.
- (h8300_bfd_link_add_symbols): Likewise.
-
-Mon Jun 17 10:06:50 1996 Jeffrey A. Law <law@rtl.cygnus.com>
-
- * som.h (R_HPPA_BEGIN_TRY, R_HPPA_END_TRY): Define.
- * som.c (som_write_fixups): Handle R_BEGIN_TRY and R_END_TRY.
-
-Mon Jun 17 12:49:11 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_relocate_section): Don't create a reloc
- for R_MIPS_REL32 and R_MIPS_32 relocs if no dynamic sections were
- created.
- (mips_elf_check_relocs): Only create .rel.dyn for R_MIPS_REL32 and
- R_MIPS_32 relocs if creating a shared library.
-
-Thu Jun 13 20:14:51 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * peicode.h (add_data_entry): Use pei_section_data rather than
- _cooked_size. Corresponds to May 13 change in coffcode.h.
-
-Thu Jun 13 10:23:40 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_final_link): Handle long section names.
- * coffcode.h (coff_write_object_contents): If there are long
- section names, always set the f_symptr field, even if there are no
- symbols.
- * peicode.h (coff_swap_filehdr_in): Don't clear the f_symptr field
- if there are no symbols.
-
- * coffgen.c (make_a_section_from_file): Check return value of
- _bfd_coff_read_string_table.
- (coff_real_object_p): Check return value of
- make_a_section_from_file.
- (_bfd_coff_read_string_table): Check that there are some symbols
- before trying to read the string table size.
-
-Wed Jun 12 11:16:37 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_symbols): When considering whether
- to replace a symbol in a dynamic object with a symbol from another
- dynamic object, do the replacement if the existing symbol is
- global linkage code.
-
- * xcofflink.c (_bfd_ppc_xcoff_relocate_section): Check explicitly
- for _ptrgl, and treat it as global linkage code.
-
- * aoutx.h (NAME(aout,find_nearest_line)): Notice if we find a
- filename or N_SO symbol past the offset, and use it to indicate
- that there is no line number or function when appropriate.
-
-Tue Jun 11 15:24:48 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_build_ldsyms): Set XCOFF_DEF_REGULAR for a
- common symbol defined by the linker. Don't export function code
- even if export_defineds is set.
-
-Mon Jun 10 11:57:27 1996 Jeffrey A Law (law@cygnus.com)
-
- * coff-h8300.c (howto_table): Add new entries for R_BCC_INV
- and R_JMP_DEL.
- (rtype2howto): Handle R_BCC_INV and R_JMP_DEL.
- (h8300_symbol_address_p): New function.
- (h8300_reloc16_estimate): Eliminate jumps made unnecessary by
- relaxing.
-
-Sun Jun 9 16:30:20 1996 Jeffrey A Law (law@cygnus.com)
-
- * coff-h8300.c (h8300_reloc16_estimate): Fix many minor spacing
- problems.
- (h8300_reloc16_estimate, cases R_JMP1, R_JMP2): Adjust "dot"
- correctly for the two variants. Allow relaxing if the target
- is 128 bytes away since after relaxation it'll be 126 bytes away.
- (h8300_reloc16_estimate, case R_PCRWORD): Correctly adjust
- "dot" and "value". Allow relaxing if the target is 128 bytes
- away since after relaxation it'll be 126 bytes away.
- * reloc16.c (bfd_coff_reloc16_relax_section): Keep relaxing
- the given section until nothing changes.
-
-Thu Jun 6 15:24:45 1996 Richard Henderson <rth@tamu.edu>
-
- * ecoff.c (_bfd_ecoff_new_section_hook): Remove the _PDATA
- alignment hack--we can get the lnnoptr info another way without
- suddenly increasing the alignment requirements. Set the flags for
- the _PDATA section.
- (ecoff_compute_section_file_positions): Do so.
-
-Thu Jun 6 11:24:37 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_write_object_contents): Put a timestamp in the file
- to keep the HP emulator database happy.
-
- * config.bfd: Recognize powerpc-*-linux* and powerpcle-*-linux*.
- From Kevin Buettner <kev@primenet.com>.
-
-Wed Jun 5 15:16:04 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (translate_to_native_sym_flags): Don't try to print the
- name of a NULL section.
-
-Tue Jun 4 18:53:58 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * linker.c (_bfd_generic_link_add_one_symbol): If notice_all is
- set, always call the notice callback.
-
- * VERSION: Increment for bfdlink.h change.
-
-Mon Jun 3 11:01:53 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (COFF_DEFAULT_SECTION_ALIGNMENT_POWER): Set to 4.
- (sh_relax_delete_bytes): Correct handling of differently sized
- trailing alignment reloc.
-
- * bfd-in.h: Use #error if BFD_HOST_64_BIT can not be defined.
- * bfd-in2.h: Rebuild.
- * configure.in: Warn if there is no known 64 bit type.
- * configure: Rebuild.
-
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add ppcboot.o.
- (BFD32_BACKENDS_CFILES): Add ppcboot.c.
-
- * elf32-mips.c (mips_elf_size_dynamic_sections): Initialize c.
- From Per Fogelstrom <per.fogelstrom@mailbox200.swipnet.se>.
-
-Sat Jun 1 21:49:58 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf64-mips.c (bfd_mips_elf64_swap_reginfo_in)
- (bfd_mips_elf64_swap_reginfo_out): Move from here...
- * elf32-mips.c (bfd_mips_elf64_swap_reginfo_in)
- (bfd_mips_elf64_swap_reginfo_out): ...to here.
-
-Fri May 31 13:51:28 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf64-mips.c: Improve reloc special_functions and handling of
- SHT_MIPS_OPTIONS section.
- * elf32-mips.c (_bfd_mips_elf_hi16_reloc): Rename from
- mips_elf_hi16_reloc and make globally visible.
- (_bfd_mips_elf_lo16_reloc): Rename from mips_elf_lo16_reloc and
- make globally visible.
- (_bfd_mips_elf_got16_reloc): Rename from mips_elf_got16_reloc and
- make globally visible.
- (_bfd_mips_elf_gprel16_reloc): Rename from mips_elf_gprel16_reloc
- and make globally visible.
- (gprel16_with_gp): Check howto->src_mask before using value in
- insn.
- (_bfd_mips_elf_gprel32_reloc): Rename from mips_elf_gprel32_reloc
- and make globally visible.
- (gprel32_with_gp): Check howto->src_mask before fetching value.
- (bfd_mips_elf_swap_options_in): New function.
- (bfd_mips_elf_swap_options_out): New function.
- (_bfd_mips_elf_set_private_flags): Rename from
- mips_elf_set_private_flags and make globally visible.
- (_bfd_mips_elf_copy_private_bfd_data): Rename from
- mips_elf_copy_private_bfd_data and make globally visible.
- (_bfd_mips_elf_merge_private_bfd_data): Rename from
- mips_elf_merge_private_bfd_data and make globally visible.
- (_bfd_mips_elf_section_from_shdr): Accept .MIPS.options as a name
- for a SHT_MIPS_OPTIONS section.
- (mips_elf32_section_from_shdr): Handle SHT_MIPS_OPTIONS section.
- (_bfd_mips_elf_fake_sections): Consider .MIPS.options to be the
- name of a SHT_MIPS_OPTIONS section.
- (_bfd_mips_elf_set_section_contents): New function.
- (mips_elf32_section_processing): Set the GP value in a
- SHT_MIPS_OPTIONS section.
- (_bfd_mips_elf_find_nearest_line): Rename from
- mips_elf_find_nearest_line and make globally visible.
- (bfd_elf32_set_section_contents): Define.
- * elf-bfd.h (_bfd_mips_elf_hi16_reloc): Declare.
- (_bfd_mips_elf_lo16_reloc): Declare.
- (_bfd_mips_elf_gprel16_reloc): Declare.
- (_bfd_mips_elf_got16_reloc): Declare.
- (_bfd_mips_elf_gprel32_reloc): Declare.
- (_bfd_mips_elf_set_private_flags): Declare.
- (_bfd_mips_elf_copy_private_bfd_data): Declare.
- (_bfd_mips_elf_merge_private_bfd_data): Declare.
- (_bfd_mips_elf_find_nearest_line): Declare.
- (_bfd_mips_elf_set_section_contents): Declare.
-
- * elf32-hppa.c (elf32_hppa_info_to_howto): Rename from
- elf_info_to_howto.
- (elf_info_to_howto): Define.
- * elf32-sparc.c (elf32_sparc_info_to_howto): Rename from
- elf_info_to_howto.
- (elf_info_to_howto): Define.
- * elf64-sparc.c (sparc64_elf_info_to_howto): Rename from
- elf_info_to_howto.
- (elf_info_to_howto): Define.
-
- * coff-w65.c (h8300_reloc16_estimate): Rename R_MOVB[12] to
- R_MOV16B[12], to match change in coff/internal.h.
-
-Thu May 30 12:38:49 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf64-mips.c: Extensive additions to provide better support for
- writing files and for gas.
- * elf32-mips.c (_bfd_mips_elf_object_p): New function, broken out
- of mips_elf_object_p.
- (mips_elf32_object_p): Rename from mips_elf_object_p; call
- _bfd_mips_elf_object_p.
- (_bfd_mips_elf_final_write_processing): Rename from
- mips_elf_final_write_processing and make globally visible.
- (_bfd_mips_elf_fake_sections): Rename from
- mips_elf_fake_sections and make globally visible.
- (_bfd_mips_elf_section_from_bfd_section): Rename from
- mips_elf_section_from_bfd_section and make globally visible.
- (_bfd_mips_elf_section_processing): New function, broken out of
- mips_elf_section_processing.
- (mips_elf32_section_processing): Rename from
- mips_elf_section_processing; call
- _bfd_mips_elf_section_processing.
- (_bfd_mips_elf_symbol_processing): Rename from
- mips_elf_symbol_processing and make globally visible.
- (_bfd_mips_elf_read_ecoff_info): Rename from
- mips_elf_read_ecoff_info and make globally visible.
- (mips_elf32_ecoff_debug_swap): Rename from
- mips_elf_ecoff_debug_swap.
- * elf.c (_bfd_elf_symbol_from_bfd_symbol): Use asymbol rather than
- struct symbol_cache_entry.
- (_bfd_elf_validate_reloc): New function, moved in from
- elfcode.h:validate_reloc.
- * elfcode.h (validate_reloc): Remove; moved into elf.c and renamed
- to _bfd_elf_validate_reloc. Change all callers.
- * elf-bfd.h (bfd_section_from_shdr): Declare.
- (_bfd_elf_symbol_from_bfd_symbol): Declare.
- (_bfd_elf_validate_reloc): Declare.
- (_bfd_mips_elf_object_p): Declare.
- (_bfd_mips_elf_fake_sections): Declare.
- (_bfd_mips_elf_section_from_bfd_section): Declare.
- (_bfd_mips_elf_section_processing): Declare.
- (_bfd_mips_elf_symbol_processing): Declare.
- (_bfd_mips_elf_read_ecoff_info): Declare.
- (_bfd_mips_elf_final_write_processing): Declare.
- * elfxx-target.h (bfd_elfNN_get_reloc_upper_bound): Don't define
- if already defined.
-
- * elf32-mips.c (mips_elf_object_p): Handle E_MIPS_ARCH_4.
- (mips_elf_final_write_processing): Likewise.
-
-Wed May 29 16:15:29 1996 Ian Lance Taylor <ian@cygnus.com>
-
- 64-bit MIPS ELF ABI objdump support:
- * elf64-mips.c: New file.
- * Makefile.in: Rebuild dependencies.
- (BFD64_BACKENDS): Add elf64-mips.o.
- (BFD64_BACKENDS_CFILES): Add elf64-mips.c.
- * config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
- bfd_elf64_littlemips_vec to targ_selvecs.
- (mips*-*-elf*): Likewise.
- * configure.in: Add bfd_elf64_bigmips_vec and
- bfd_elf64_littlemips_vec to vector switch.
- * configure: Rebuild.
- * elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
- broken out of mips_elf_section_from_shdr.
- (mips_elf32_section_from_shdr): Rename from
- mips_elf_section_from_shdr. Call new function.
- (elf_backend_section_from_shdr): Update name of renamed function.
- * elf-bfd.h (struct elf_size_info): Change second parameter of
- write_out_phdrs to be const. Likewise for second parameter of
- swap_symbol_out.
- (struct bfd_elf_section_data): Add rel_hdr2 field.
- (bfd_elf32_swap_symbol_in): Change second parameter to be const.
- (bfd_elf32_swap_symbol_out): Likewise.
- (bfd_elf32_swap_reloc_in): Likewise.
- (bfd_elf32_swap_reloc_out): Likewise.
- (bfd_elf32_swap_reloca_in): Likewise.
- (bfd_elf32_swap_reloca_out): Likewise.
- (bfd_elf32_swap_phdr_in): Likewise.
- (bfd_elf32_swap_phdr_out): Likewise.
- (bfd_elf32_swap_dyn_in): Likewise.
- (bfd_elf32_swap_dyn_out): Likewise.
- (bfd_elf32_slurp_symbol_table): Declare.
- (bfd_elf32_write_shdrs_and_ehdr): Declare.
- (bfd_elf32_write_out_phdrs): Declare.
- (bfd_elf64_swap_symbol_in): Change second parameter to be const.
- (bfd_elf64_swap_symbol_out): Likewise.
- (bfd_elf64_swap_reloc_in): Likewise.
- (bfd_elf64_swap_reloc_out): Likewise.
- (bfd_elf64_swap_reloca_in): Likewise.
- (bfd_elf64_swap_reloca_out): Likewise.
- (bfd_elf64_swap_phdr_in): Likewise.
- (bfd_elf64_swap_phdr_out): Likewise.
- (bfd_elf64_swap_dyn_in): Likewise.
- (bfd_elf64_swap_dyn_out): Likewise.
- (bfd_elf64_slurp_symbol_table): Declare.
- (bfd_elf64_write_shdrs_and_ehdr): Declare.
- (bfd_elf64_write_out_phdrs): Declare.
- (_bfd_mips_elf_section_from_shdr): Declare.
- * elf.c (bfd_section_from_shdr): Remove assertion requiring
- SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc
- section for the section, add the new one to rel_hdr2. Increment
- reloc_count rather than setting it.
- * elfcode.h (elf_slurp_symbol_table): Define name as macro.
- Remove static declaration.
- (elf_write_shdrs_and_ehdr): Define name as macro.
- (elf_write_out_phdrs): Likewise.
- (elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
- (elf_swap_shdr_in, elf_swap_shdr_out): Declare.
- (elf_swap_symbol_in): Change second parameter to be const.
- (elf_swap_symbol_out): Likewise.
- (elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
- (elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
- (elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
- (elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
- (elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
- (elf_write_out_phdrs): Rename from write_out_phdrs. Change second
- parameter to be const. Make non-static.
- (elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
- Make non-static.
- (elf_slurp_symbol_table): Make non-static.
- (NAME(_bfd_elf,size_info)): Update names of renamed functions.
- * elfxx-target.h (elf_info_to_howto): Define if not defined.
- (elf_backend_size_info): Likewise.
- (elfNN_bed): Use elf_backend_size_info.
- * targets.c (bfd_elf64_bigmips_vec): Declare.
- (bfd_elf64_littlemips_vec): Declare.
- (bfd_target_vector): Add bfd_elf64_bigmips_vec and
- bfd_elf64_littlemips_vec if BFD64 is defined.
-
- * libbfd.c (bfd_get_file_window): Add cast to fprintf argument.
-
-Tue May 28 11:42:08 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (sh_relax_delete_bytes): Insert nop instructions, not
- zeroes, in alignment holes.
-
- * configure: Rebuild with autoconf 2.10.
-
- * aoutx.h (NAME(aout,find_nearest_line)): Make room for the
- potential leading underscore in the allocated buffer.
-
-Fri May 24 14:28:38 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Do not put small common
- symbols into .sbss if this is a relocatable link.
-
-Thu May 23 12:26:24 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (_bfd_ppc_xcoff_relocate_section): Warn about
- undefined symbols when creating a shared library.
-
-Fri May 17 13:54:15 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c: Add a bunch of new code and static const arrays to
- support aligning loads and stores on four byte memory boundaries.
- Also:
- (sh_coff_howtos): Add entries for R_SH_CODE, R_SH_DATA and
- R_SH_LABEL.
- (sh_relax_section): Look for R_SH_CODE relocs. If we find one,
- call sh_align_loads.
- (sh_relax_delete_bytes): Don't mark R_SH_CODE or R_SH_DATA relocs
- as unused.
-
-Thu May 16 16:34:13 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cache.c (bfd_open_file): Unlink the file before opening it for
- write. From Marty Leisner <leisner@sdsp.mc.xerox.com>.
-
- * opncls.c (bfd_fdopenr): Set opened_once.
-
-Tue May 14 12:35:32 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * som.c (som_slurp_reloc_table): Clear external_relocs cache after
- freeing it.
-
- * libbfd.c: Remove #ifdef FILE_OFFSET_IS_CHAR_INDEX, and compile
- the code unconditionally.
-
-Mon May 13 19:51:37 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * libcoff-in.h (struct pei_section_tdata): Define structure.
- (pei_section_data): Define macro.
- * libcoff.h: Rebuild.
- * coffcode.h (coff_set_alignment_hook): If COFF_IMAGE_WITH_PE,
- store s_paddr field in pei_section_data.
- (coff_compute_section_file_positions): Use pei_section_data rather
- than _cooked_size, and don't overwrite an existing value.
- (coff_write_object_contents): If COFF_OBJ_WITH_PE, set s_paddr to
- 0. If COFF_IMAGE_WITH_PE, set s_paddr to pei_section_data.
- * peicode.h (coff_bfd_copy_private_section_data): Define if
- COFF_IMAGE_WITH_PE.
- (pe_bfd_copy_private_section_data): New static function if
- COFF_IMAGE_WITH_PE.
-
-Wed May 8 16:10:38 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * srec.c (srec_set_arch_mach): Write as a function rather than a
- macro definition.
-
- * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): If an archive has
- no map, just check each member in turn to see whether it is
- required.
-
-Wed May 8 09:17:34 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * ppcboot.c (ppcboot_object_p): Check for type 0x41 in partition
- table. Call BFD_ASSERT to validate header size, instead of
- calling fatal.
- (ppcboot_bfd_print_private_bfd_data): Put quotes around partition
- name.
-
-Tue May 7 16:10:19 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * ppcboot.c: New target for looking at PPCbug boot records.
-
- * config{ure.in,.bfd}: Add support for ppcboot target.
- * targets.c: Ditto.
- * configure: Regenerate.
-
-Tue May 7 11:15:19 1996 Jeffrey A Law (law@cygnus.com)
-
- * coff-h8300.c (howto_table): Update names to match recent
- changes to include/coff/internal.h. Fix minor errors in the
- existing relocs. Add R_MOVL1 and R_MOVL2.
- (rtype2howto): Similarly.
- (h8300_reloc16_estimate): Rewrite to simplify, fix bugs in the
- existing relaxing code and peform more relaxing.
- (h8300_reloc16_extra_cases): Likewise.
-
-Mon May 6 18:24:09 1996 Jeffrey A Law (law@cygnus.com)
-
- * reloc16.c (bfd_coff_reloc16_get_value): Handle common
- symbols correctly.
-
-Sat May 4 05:08:45 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * elfcode.h (elf_object_p): Reject generic ELF target if
- e_machine matches an alternate machine code in a specific backend.
-
- * netbsd-core.c (netbsd_core_vec): Remove initializer for
- obsolete align_power_min field.
-
-Fri May 3 13:07:35 1996 Jeffrey A Law (law@cygnus.com)
-
- * coff-h8300.c (reloc_howto_type): Add howto entry for
- R_PCRWORD_B.
- (rtype2howto): Handle R_PCRWORD_B.
- (h8300_reloc16_extra_cases): Handle R_PCRWORD_B.
- (h8300_reloc_16_estimate): Likewise. Try to turn a 16bit
- pc-relative branch (R_PCRWORD) into an 8bit pc-relative
- branch (R_PCWORD_B).
-
-Fri May 3 10:47:41 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (translate_from_native_sym_flags): Set the section for
- BSF_CONSTRUCTOR symbols.
-
- * cofflink.c (_bfd_coff_link_input_bfd): Correct setting of
- last_bf_index.
-
-Wed May 1 18:39:32 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * coffcode.h (coff_write_object_contents): In comdat section lookup,
- stop looking when section is found.
-
-Wed May 1 14:17:57 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (STRING_SIZE_SIZE): Define.
- (styp_to_sec_flags): Handle long symbol names when looking for the
- section symbol.
- (bfd_coff_backend_data): Add _bfd_coff_long_section_names field.
- (bfd_coff_long_section_names): Define.
- (coff_write_object_contents): Handle long section names.
- (bfd_coff_std_swap_table): Initialize new field.
- * libcoff.h: Rebuild.
- * coffgen.c (make_a_section_from_file): Handle long section
- names.
- (coff_write_symbols): Handle long section names.
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
- * pe-arm.c (COFF_LONG_SECTION_NAMES): Define.
- * pei-arm.c (COFF_LONG_SECTION_NAMES): Define.
- * pe-i386.c (COFF_LONG_SECTION_NAMES): Define.
- * pei-i386.c (COFF_LONG_SECTION_NAMES): Define.
- * pe-ppc.c (COFF_LONG_SECTION_NAMES): Define.
- * pei-ppc.c (COFF_LONG_SECTION_NAMES): Define.
-
- * bout.c (b_out_callback): Set lma of sections.
- (b_out_bfd_get_relocated_section_contents): Rename in_abfd
- parameter to output_bfd. Used input_bfd instead of output_bfd in
- several places.
-
-Tue Apr 30 17:56:39 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (translate_from_native_sym_flags): Don't create
- SEC_CONSTRUCTOR sections.
- * ecoff.c (ecoff_set_symbol_info): Likewise.
-
- * elf32-mips.c (mips_elf_copy_private_bfd_data): Copy elf_gp.
- From Don Bowman <bowman@waterloo.hp.com>.
-
-Tue Apr 30 17:06:32 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * coff-arm.c (armcoff_little_vec): If COFF_WITH_PE is defined, add
- SEC_LINK_ONCE and SEC_LINK_DUPLICATES to section_flags.
-
-Mon Apr 29 13:15:17 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (struct mips_elf_link_hash_entry): Add
- mips_32_relocs field.
- (mips_elf_link_hash_newfunc): Initialize mips_32_relocs field.
- (mips_elf_relocate_section): Copy R_MIPS_REL32 and R_MIPS_32
- relocs against a global symbol which is not defined in a regular
- file.
- (mips_elf_check_relocs): For a R_MIPS_REL32 or R_MIPS_32 reloc
- against a global symbol, increment mips_32_relocs.
- (mips_elf_adjust_dynamic_symbol): If mips_32_relocs is set, and
- the symbol is not defined in a regular file, make room in the
- .rel.dyn section.
-
-Fri Apr 26 18:00:37 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (ecoff_compute_section_file_positions): Track the real
- file position and the virtual file position separately. Set
- filepos information bsaed on the real file position.
- (_bfd_ecoff_set_section_contents): Handle .lib sections like the
- Jan 23 change to coffcode.h.
-
- * som.c (som_slurp_symbol_table): Set the symbol count to the
- number of BFD symbols created.
-
-Fri Apr 26 12:34:29 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_check_relocs): Forward relocations to the
- output file if linking shared objects. Loop to check all relocs,
- rather than returning false on first error.
-
-Thu Apr 25 13:25:12 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_create_linker_section): Add PLT case.
- (ppc_elf_additional_program_headers): If .interp section, bump #
- of program headers by 1.
- (ppc_elf_adjust_dynamic_symbol): Flesh out support.
- (ppc_elf_size_dynamic_sections): Add support for .plt section.
- (ppc_elf_check_relocs): Print out filename in debug code. Enable
- PLT support.
- (ppc_elf_finish_dynamic_symbol): Add support for PLT's, beef up
- debug output.
- (ppc_elf_relocate_section): If the output section isn't defined,
- don't abort, just give an error message.
-
- * elflink.c (_bfd_elf_create_dynamic_sections): If the section
- being created is .sdata or .sdata2, don't make the symbol dynamic.
-
-Wed Apr 24 14:04:07 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through the
- members of an archive for dynamic objects with no symbols, and
- pass them directly to check_archive_element.
- (xcoff_link_check_ar_symbols): Pass dynamic objects to
- xcoff_link_check_dynamic_ar_symbols.
- (xcoff_link_check_dynamic_ar_symbols): New static function.
-
- * coff-rs6000.c (rs6000coff_vec): Change BFD_JUMP_TABLE_DYNAMIC
- from _bfd_nodynamic to _bfd_xcoff.
- * libcoff-in.h (_bfd_xcoff_get_dynamic_symtab_upper_bound):
- Declare.
- (_bfd_xcoff_canonicalize_dynamic_symtab): Declare.
- (_bfd_xcoff_get_dynamic_reloc_upper_bound): Declare.
- (_bfd_xcoff_canonicalize_dynamic_reloc): Declare.
- * libcoff.h: Rebuild.
- * xcofflink.c (xcoff_swap_ldrel_in): New static function.
- (xcoff_get_section_contents): New static function.
- (_bfd_xcoff_get_dynamic_symtab_upper_bound): New function.
- (_bfd_xcoff_canonicalize_dynamic_symtab): New function.
- (_bfd_xcoff_get_dynamic_reloc_upper_bound): New function.
- (xcoff_dynamic_reloc): New static variable.
- (_bfd_xcoff_canonicalize_dynamic_reloc): New function.
- (xcoff_link_add_dynamic_symbols): Use xcoff_get_section_contents.
-
-Tue Apr 23 12:48:42 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sparc.c (bfd_coff_generic_reloc): Return bfd_reloc_ok even
- if reloc_entry->addend is not 0.
- (CALC_ADDEND): Just set the addend to reloc.r_offset.
-
-Mon Apr 22 18:29:01 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): Fix spelling of
- R_SPARC_GLOB_JMP.
- * elf64-sparc.c (sparc64_elf_howto_table): Likewise.
- Add entries for R_SPARC_[56].
- (sparc_reloc_map): Add entries for R_SPARC_[56].
-
-Mon Apr 22 15:07:24 1996 Ian Lance Taylor <ian@cygnus.com>
-
- Optimize linking of stabs in sections as used in ELF and COFF.
- * stabs.c: New file.
- * libbfd-in.h (_bfd_link_section_stabs): Declare.
- (_bfd_write_section_stabs): Declare.
- (_bfd_write_stab_strings): Declare.
- * libbfd.h: Rebuild.
- * libcoff-in.h (struct coff_section_tdata): Add stab_info field.
- (struct coff_link_hash_table): Add stab_info field.
- * libcoff.h: Rebuild.
- * cofflink.c (_bfd_coff_link_hash_table_init): Initialize
- stab_info field.
- (coff_link_add_symbols): Call _bfd_link_section_stabs if
- appropriate.
- (_bfd_coff_final_link): Write out stab strings hash table.
- (_bfd_coff_link_input_bfd): Handle optimized stabs sections.
- * coff-ppc.c (ppc_bfd_coff_final_link): Write out stab strings
- hash table.
- * elf-bfd.h (struct elf_link_hash_table): Add stab_info field.
- (struct bfd_elf_section_data): Add stab_info field.
- * elf.c (_bfd_elf_link_hash_table_init): Initialize stab_info
- field.
- * elflink.h (elf_link_add_object_symbols): If appropriate, call
- _bfd_link_section_stabs.
- (elf_bfd_final_link): Write out stab strings hash table.
- (elf_link_input_bfd): Handle optimized stabs sections.
- * reloc.c (_bfd_final_link_relocate): Check address against
- _raw_size rather than _cooked_size.
- * Makefile.in: Rebuild dependencies.
- (BFD_LIBS): Add stabs.o
- (BFD_LIBS_CFILES): Add stabs.c.
-
- * VERSION: Increment for bfdlink.h change.
-
- * coffgen.c (coff_renumber_symbols): Correct handling of
- BSF_NOT_AT_END common symbols.
-
-Fri Apr 19 19:21:56 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-ppc.c (record_toc): Add cast to avoid warning.
- (ppc_allocate_toc_section): Likewise.
- (coff_ppc_relocate_section): Remove ANSI C string concatenation.
- (ppc_coff_reloc_type_lookup): Remove unreached code.
- * coffcode.h (coff_write_object_contents): Don't take the address
- of an array.
- * peicode.h (pe_print_idata): Add casts to avoid warning.
- (pe_print_edata): Likewise.
- (pe_print_reloc): Remove ANSI C string concatenation.
-
-Thu Apr 18 18:51:18 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * libcoff-in.h (struct coff_final_link_info): Add last_bf_index
- and last_bf fields.
- * libcoff.h: Rebuild.
- * coffswap.h (coff_swap_aux_in): Swap endndx field for C_FCN
- symbols.
- (coff_swap_aux_out): Likewise.
- * peicode.h (coff_swap_aux_in): Likewise.
- (coff_swap_aux_out): Likewise.
- * coffgen.c (coff_pointerize_aux): Check endndx field for C_FCN
- symbols.
- * cofflink.c (_bfd_coff_final_link): Initialize last_bf_index
- field.
- (_bfd_coff_link_input_bfd): Check endndx field for C_FCN symbols.
- Fix up .bf endndx link fields.
- * coff-ppc.c (ppc_bfd_coff_final_link): Initialize last_bf_index
- field.
- * xcofflink.c (xcoff_link_input_bfd): Check endndx field for C_FCN
- symbols.
-
-Wed Apr 17 12:08:24 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * pe{,i}-ppc.c (PPC_PE): Define instead of PPC, so that compiling
- on Solaris PowerPC systems doesn't get confused.
-
- * coffcode.h (coff_write_object_contents): Use #ifdef PPC_PE, not
- #ifdef PPC.
-
- * elfcore.h (bfd_prstatus, bfd_fpregset): Add thread argument.
- (elf_corefile_note): If HAVE_SYS_PROCFS_H is not defined, don't
- update did_reg and did_reg2.
-
-Wed Apr 17 13:07:37 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_input_bfd): Check for TOC overflow.
-
- * linker.c (_bfd_generic_link_add_one_symbol): When calling the
- callback routines, pass h->root.string rather than name, in case
- copy is true and name is transient.
-
-Tue Apr 16 16:36:38 1996 Stu Grossman (grossman@lisa.cygnus.com)
-
- * elfcore.h: Add support for core files with multiple threads.
- (Primarily for Solaris.)
-
-Tue Apr 16 13:44:08 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (NAME(aout,squirt_out_relocs)): Don't do anything if
- section->orelocation is NULL.
-
- * coffgen.c (bfd_coff_get_syment): New function.
- (bfd_coff_get_auxent): New function.
- * bfd-in.h (bfd_coff_get_syment): Declare.
- (bfd_coff_get_auxent): Declare.
- * bfd-in2.h: Rebuild.
-
-Mon Apr 15 19:06:59 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (struct mips_hi16): Define.
- (mips_hi16_addr, mips_hi16_addend): Remove.
- (mips_hi16_list): New static variable.
- (mips_elf_hi16_reloc): Maintain a list of unmatched HI16 relocs.
- (mips_elf_lo16_reloc): Process mips_hi16_list.
- (mips_elf_relocate_section): Permit an arbitrary number of HI16
- relocs before the associated LO16 reloc.
-
-Wed Apr 10 00:23:53 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * versados.c (versados_scan): Check bfd_alloc return value.
- (versados_object_p): Check all bfd_read return values. Require
- that lang field be less than 10, to avoid confusion with Intel Hex
- files.
-
- * libaout.h (WRITE_HEADERS): Write out the relocs even if there
- aren't any symbols.
- * aoutx.h (NAME(aout,swap_std_reloc_out)): Set r_index to N_ABS,
- not 0, for an absolute symbol.
- (NAME(aout,swap_ext_reloc_out)): Likewise.
-
- * ihex.c (ihex_scan): Accept a length of 4 for record type 5.
- (ihex_write_object_contents): For a large start address, output
- the full 32 bit address in record type 5.
-
- * ieee.c (ieee_write_byte): Change second parameter from bfd_byte
- to int to avoid promotion problems in prototype.
-
-Tue Apr 9 11:44:21 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Use ${srcdir} when looking for picfrag.
-
- * configure.host: Switch on ${libdir}, not $(libdir). From
- alan@spri.levels.unisa.edu.au (Alan Modra).
-
- * aoutx.h (aout_link_add_symbols): Always call add_dynamic_symbols
- entry point, not just for DYNAMIC objects.
- * sunos.c (sunos_add_dynamic_symbols): Always call
- sunos_create_dynamic_sections. If called with a non DYNAMIC
- object, don't do anything else.
- (sunos_add_one_symbol): Don't call sunos_create_dynamic_sections.
-
-Mon Apr 8 12:09:36 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Permit --enable-shared to specify a list of
- directories.
- * configure: Rebuild.
-
- * configure.host: Set HLDFLAGS and SHLIB_CFLAGS for *-dec-osf*
- host when configuring with --enable-shard.
-
-Fri Apr 5 12:24:13 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * config.bfd: Add i[345]86-*-freebsdelf* target; from John Polstra
- <jdp@polstra.com>.
-
- * linker.c (link_action): For WARN_ROW/warn, use MWARN, not CYCLE,
- to avoid crashing in bfd_hash_replace.
-
- * sysdep.h: Use #ifdef, not #if.
-
-Thu Apr 4 23:32:23 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * config.in: Rebuild.
-
-Thu Apr 4 18:49:09 1996 Fred Fish <fnf@cygnus.com>
-
- * configure.in (mips-sony-bsd*): Fix typo in AC_DEFINE.
- (AC_CHECK_HEADERS): Check for sys/time.h
- (AC_HEADER_TIME): Add macro.
- * configure: Rebuild.
- * sysdep.h: Use TIME_WITH_SYS_TIME and HAVE_SYS_TIME_H
- to control what combination of <time> and <sys/time.h>
- get included.
-
-Tue Apr 2 13:11:53 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * aoutf1.h (sunos_32_set_arch_mach): Handle M_SPARCLET.
- (aout_32_sunos4_write_object_contents): Likewise.
- * aoutx.h (NAME(aout,machine_type)): Handle
- bfd_mach_sparc_{sparclet,sparclite}.
- * archures.c (bfd_mach_sparc_{sparclet,sparclite}): Define.
- (bfd_mach_sparc_v9_p): Update.
- * cpu-sparc.c (arch_info_struct): Add entries for sparclet,sparclite.
- * libaout.h (enum machine_type): Add M_SPARCLET.
- * sunos.c (MACHTYPE_OK): Define.
- * bfd-in2.h: Regenerated.
-
-Tue Apr 2 00:33:18 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_table): Add hgot field.
- * elf.c (_bfd_elf_link_hash_table_init): Initialize hgot field.
- * elflink.c (_bfd_elf_create_got_section): Store the
- _GLOBAL_OFFSET_TABLE_ hash table entry in the hgot field.
- * elf32-sparc.c (elf32_sparc_check_relocs): If the size of the
- global offset table goes over 0x1000, set the value of
- _GLOBAL_OFFSET_TABLE_ to 0x1000 into the section.
- (elf32_sparc_relocate_section): Subtract the offset of
- _GLOBAL_OFFSET_TABLE_ when handling GOT relocations.
-
- * elfcode.h: Don't include <string.h>.
-
-Mon Apr 1 10:39:24 1996 Jeffrey A Law (law@cygnus.com)
-
- * linker.c (_bfd_generic_link_hash_newfunc): Renamed from
- generic_link_hash_newfunc. All references changed.
- * genlink.h (_bfd_generic_link_hash_newfunc): Declaration
- moved here from libbfd-in.h.
- * libbfd-in.h: Corresponding changes.
- * libbfd.h: Regenerated.
-
-Mon Apr 1 12:35:36 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (aout_link_input_section_std): When reporting an
- overflow error, use the name of the symbol in the hash table if
- available.
- (aout_link_input_section_ext): Likewise.
-
- * elflink.h (elf_adjust_dynamic_symbol): If a common symbol got
- defined in a regular file, set ELF_LINK_HASH_DEF_REGULAR.
-
-Sun Mar 31 01:58:41 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * peicode.h (coff_swap_aouthdr_out): Delete test for .junk.
- * coffcode.h (coff_compute_section_file_positions): Likewise.
- (coff_write_object_contents): Likewise.
-
-Fri Mar 29 12:44:36 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * section.c (SEC_LINK_ONCE): Define.
- (SEC_LINK_DUPLICATES): Define.
- (SEC_LINK_DUPLICATES_DISCARD): Define.
- (SEC_LINK_DUPLICATES_ONE_ONLY): Define.
- (SEC_LINK_DUPLICATES_SAME_SIZE): Define.
- (SEC_LINK_DUPLICATES_SAME_CONTENTS): Define.
- * bfd-in2.h: Rebuild.
- * coffcode.h (sec_to_styp_flags): If COFF_WITH_PE, turn
- SEC_LINK_ONCE into IMAGE_SCN_LNK_COMDAT.
- (styp_to_sec_flags): If COFF_WITH_PE, turn IMAGE_SCN_LNK_REMOVE
- into SEC_EXCLUDE. If IMAGE_SCN_LNK_COMDAT is set, set
- SEC_LINK_ONCE, and look through the symbol table for the setting
- for SEC_LINK_DUPLICATES.
- (coff_write_object_contents): If COFF_WITH_PE, if SEC_LINK_ONCE is
- set for a section, find the section symbol in the symbol table,
- and set the aux entry based on SEC_LINK_DUPLICATES.
- * coffgen.c (coff_print_symbol): Add a space before "checksum".
- * coff-arm.c (armcoff_big_vec): If COFF_WITH_PE is defined, add
- SEC_LINK_ONCE and SEC_LINK_DUPLICATES to section_flags.
- * coff-i386.c (i386coff_vec): Likewise.
- * coff-ppc.c (TARGET_LITTLE_SYM, TARGET_BIG_SYM): Likewise.
-
- * VERSION: Bump to 2.6.1.
- * Makefile.in (stamp-h): Depend upon VERSION.
-
-Thu Mar 28 23:48:49 1996 Jeffrey A Law (law@cygnus.com)
-
- * libbfd-in.h (generic_link_hash_newfunc): Add declaration.
- * libbfd.h: Rebuilt.
- * linker.c (generic_link_hash_newfunc): No longer static.
- * coffcode.h (coff_bfd_link_hash_create): Allow specific targets
- to override.
- * coff-h8300.c: Add two derived hash tables and their associated
- funtions and #defines for use by the h8300 linker.
- (h8300_reloc16_extra_cases, case R_MEM_INDIRECT): Create entries in
- the function vector as needed. Place the address of the function
- vector entry in the location specified by the R_MEM_INDIRECT reloc.
- Rewrite the vectors section contents as necessary.
- (h8300_bfd_link_add_symbols): New function for the h8300 linker.
- (coff_bfd_link_add_symbols): Define to use h8300 specific version.
- (coff_bfd_link_hash_table_create): Likewise.
-
-Thu Mar 28 17:44:08 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * libhppa.h: If gcc 2.7 or higher, declare all the functions with
- __attribute__ ((__unused__)) so that -Wall doesn't warn about
- them.
- (hppa_rebuild_insn): Pass pointer to correct type to
- low_sign_unext and dis_assemble_21.
-
-Thu Mar 28 11:00:36 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * config.bfd (sparc64-{sysv4*,solaris2*}): Delete.
- Stick with sparc-*-{sysv4*,solaris2*}.
-
-Wed Mar 27 10:43:34 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (coff_swap_aux_in): Swap in extra PE x_scn fields.
- (coff_swap_aux_out): Swap out extra PE x_scn fields.
- * coffswap.h (coff_swap_aux_in): Zero out extra PE x_scn fields.
- * coffgen.c (coff_print_symbol): If any of the extra PE x_scn
- fields is non-zero, print them.
-
- * coff-ppc.c (ppc_record_toc_entry): Put inside COFF_IMAGE_WITH_PE
- ifdef. Remove unused variables.
- (ppc_record_data_in_toc_entry): Ifdef out. Removed unused
- variables.
- (ppc_mark_symbol_as_glue): Put inside COFF_IMAGE_WITH_PE ifdef.
- (get_symbol_value): Ifdef out.
- (pe_ppc_reloc): Ifdef out. Remove unused variables.
- (coff_ppc_relocate_section): Remove unused variables. Make
- fprintf strings and argument types correspond. Put before_addr in
- DEBUG_RELOC ifdef.
- (dump_toc): Make fprintf strings and argument types correspond.
- (ppc_process_before_allocation): Remove unused variables. Always
- return a value.
- (ppc_reflo_reloc): Ifdef out.
- (ppc_addr32nb_reloc): Ifdef out.
- (ppc_coff_rtype2howto): Make fprintf strings and argument types
- correspond.
- (coff_ppc_rtype_to_howto): Likewise.
- (ppc_coff_swap_sym_in_hook): Remove unused variables.
-
- * peicode.h (pe_print_idata): Move otherwise unused variables into
- the #ifdef where they are used. Always return a value.
- (pe_print_edata): Make fprintf strings and argument types
- correspond. Always return a value.
- (pe_print_pdata): Removed unused variable addr_value. Always
- return a value.
- (pe_print_reloc): Remove unused variable onaline. Make fprintf
- strings and argument types correspond. Always return a value.
-
- * elf32-ppc.c (ppc_elf_fake_sections): Return true.
- (ppc_elf_finish_dynamic_symbol): Move definition of unused
- variable rela inside #if 0 section where it is used.
-
- * ns32k.h: New file.
- * cpu-ns32k.h: Include ns32k.h. Rename externally visible
- functions to start with _bfd_.
- * aout-ns32k.c: Include ns32k.h. Change references to renamed
- functions in cpu-ns32k.h.
- * Makefile.in: Rebuild dependencies.
- (HFILES): Add ns32k.h.
-
- * section.c (struct sec): Add linker_mark field. Change
- user_set_vma and reloc_done to be single bit fields.
- (STD_SECTION): Update accordingly.
- * bfd-in2.h: Rebuild.
- * aoutx.h (NAME(aout,final_link)): Mark sections included in the
- link.
- (aout_link_input_bfd): Don't link unmarked sections.
- * cofflink.c (_bfd_coff_final_link): Mark sections included in the
- link.
- (_bfd_coff_link_input_bfd): Don't link unmarked sections.
- * coff-ppc.c (ppc_bfd_coff_final_link): Mark sections included in
- the link.
- * elflink.h (elf_bfd_final_link): Mark sections included in the
- link.
- (elf_link_input_bfd): Don't link unmarked sections.
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Mark sections included
- in the link.
- (xcoff_link_input_bfd): Don't link unmarked sections.
-
- * coffswap.h (coff_swap_scnhdr_out): Include section name in
- overflow error messages.
-
-Tue Mar 26 15:46:18 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd.c (_bfd_default_error_handler): If _bfd_error_program_name
- is not set, print "BFD: " before the error message.
-
- * configure.in: Use AC_CHECK_TOOL to find ar and ranlib. From
- Miles Bader <miles@gnu.ai.mit.edu>.
- * configure: Rebuild.
-
-Fri Mar 22 12:17:00 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_input_bfd): Fix scan for C_BINCL/C_EINCL
- symbols.
-
- * config.bfd: Add ieee_vec to targ_selvecs for i960 targets and
- m68k-aout, m68k-coff, and m68k-elf targets.
-
-Fri Mar 22 11:33:44 1996 Martin Anantharaman <martin@goofy.imech.uni-duisburg.de>
-
- * ieee.c: Changed #ifdef KEEPMINUSPCININST to #if KEEPMINUSPCININST.
- (ieee_generic_stat_arch_elt): Restructured to prevent
- ieee_object_p from being called repeatedly.
-
-Thu Mar 21 11:00:47 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * coffcode.h (coff_write_object_contents): Allocate
- buffers large enough for any FILEHDR or AOUTHDR.
-
-Thu Mar 21 16:28:17 1996 David Mosberger-Tang <davidm@azstarnet.com>
-
- * ecofflink.c (lookup_line): New static function, renamed and
- slighly changed from old _bfd_ecoff_locate_line.
- (_bfd_ecoff_locate_line): Cache line number information. Use
- lookup_line for actual lookup.
-
-Thu Mar 21 14:59:11 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * peicode.h (pe_print_pdata): Warn if the .pdata section is not a
- multiple of 20 bytes.
-
-Thu Mar 21 13:54:40 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ecoff.c (_bfd_ecoff_find_nearest_line): Use bfd_zalloc to
- allocate ecoff_find_line, and don't initialize by hand.
- * elf32-mips.c (mips_elf_find_nearest_line): Use bfd_zalloc for
- mips_elf_find_line, and don't call memset.
-
- * coffcode.h (coff_compute_section_file_positions): If not
- producing a final executable, don't consider sofar when aligning
- the section to the correct size.
-
-Wed Mar 20 16:53:12 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_add_missing_symbols): Ifdef out.
- (coff_write_object_contents): Don't call coff_add_missing_symbols.
- * coffgen.c (coff_section_symbol): Ifdef out.
-
-Mon Mar 18 12:54:41 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_gprel32_reloc): Initialize gp if
- output_bfd is not NULL.
-
-Thu Mar 14 17:12:06 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * coffgen.c (coff_get_normalized_symtab): Call bfd_zalloc instead
- of bfd_alloc (fixes fix_line not being initialized).
- Delete zeroing of fix_{value,tag,end,scnlen} fields.
-
-Thu Mar 14 16:06:06 1996 Jeffrey A Law (law@cygnus.com)
-
- * coffcode.h: Allow specific backends to override the
- bfd_link_add_symbols routine.
-
- * coff-h8300.c: Include genlink.h.
- (howto_table): Add R_MEM_INDIRECT.
- (rtype2howto): Support R_MEM_INDIRECT.
- (h8300_reloc16_extra_cases): Handle R_MEM_INDIRECT like R_RELBYTE
- for now.
-
-Tue Mar 12 12:41:17 1996 David Mosberger-Tang <davidm@koala.azstarnet.com>
-
- * coff-alpha.c (alpha_relocate_section): Use
- info->callbacks_warning, rather than _bfd_error_handler, for
- "multiple gp" warning.
-
-Tue Mar 12 12:10:55 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * linker.c (bfd_wrapped_link_hash_lookup): New function.
- (_bfd_generic_link_add_one_symbol): Remove BFD_ASSERT on hash
- table string. Use bfd_wrapped_link_hash_lookup.
- (_bfd_generic_link_write_global_symbol): Remove BFD_ASSERT on hash
- table string.
- * aoutx.h (aout_link_write_symbols): Use the name from the hash
- table, if any, when writing out symbols.
- (aout_link_input_section_std): Use the name from the hash table,
- if any, when reporting undefined symbols.
- (aout_link_input_section_ext): Likewise.
- (aout_link_reloc_link_order): Use bfd_wrapped_link_hash_lookup.
- * bout.c (get_value): Likewise.
- * cofflink.c (_bfd_coff_reloc_link_order): Likewise.
- * ecoff.c (ecoff_reloc_link_order): Likewise.
- * elflink.h (elf_link_add_object_symbols): Likewise.
- (elf_reloc_link_order): Likewise.
- * linker.c (_bfd_generic_link_output_symbols): Likewise.
- (_bfd_generic_reloc_link_order): Likewise.
- (default_indirect_link_order): Likewise.
- * reloc16.c (bfd_coff_reloc16_get_value): Likewise.
- * sunos.c (sunos_add_one_symbol): Likewise.
- * xcofflink.c (xcoff_link_add_symbols): Likewise.
- (bfd_xcoff_link_count_reloc): Likewise.
- (xcoff_reloc_link_order): Likewise.
-
- * ecoffswap.h (ecoff_swap_fdr_in): If ECOFF_64, turn 0xffffffff
- into -1 for intern->rss.
-
- * configure: Rebuild with autoconf 2.8.
-
-Mon Mar 11 12:28:31 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * stab-syms.c (__define_stab_duplicate): Define.
- (bfd_get_stab_name): Rename from aout_stab_name. Rewrite to use a
- switch.
- * bfd-in.h (bfd_get_stab_name): Declare.
- * bfd-in2.h: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (BFD_LIBS): Add stab-syms.o.
- (BFD_LIBS_CFILES): Add stab-syms.c.
- (BFD32_BACKENDS): Remove stab-syms.o.
- (BFD32_BACKENDS_CFILES): Remove stab-syms.c.
- * configure.in: Don't list stab-syms.o in bfd_backends.
- * configure: Rebuild.
- * libaout.h (aout_stab_name): Don't declare.
- * aoutx.h (NAME(aout,get_symbol_info)): Call bfd_get_stab_name,
- not aout_stab_name.
-
-Fri Mar 8 11:26:20 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): Adjust file offset
- for section alignment even if SEC_LOAD is not set.
-
-Tue Mar 5 12:02:23 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Don't set SHLIB or SHLINK to an empty string,
- since they appear as targets in Makefile.in.
- * configure: Rebuild.
-
- * sunos.c (sunos_scan_ext_relocs): If not making a shared library,
- don't fiddle with a symbol which is not defined anywhere.
-
-Mon Mar 4 12:49:16 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_mark): Treat undefined imported symbols as
- though they are defined in a shared library.
- (xcoff_build_ldsyms): Likewise.
-
- * coffgen.c (coff_find_nearest_line): Don't look at the line
- numbers for the section if section->lineno is NULL.
-
- * elf.c (_bfd_elf_symbol_from_bfd_symbol): Print a useful error
- message rather than calling BFD_ASSERT.
- * elfcode.h (write_relocs): Check return value of
- _bfd_elf_symbol_from_bfd_symbol.
-
-Fri Mar 1 09:42:59 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Don't set SEC_LOAD flag
- for .sbss section.
-
-Wed Feb 28 11:25:47 1996 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h (hppa_reloc_field_selector_type): Add R_HPPA_NLSEL
- and R_HPPA_NLRSEL.
- (e_nsel, e_nlsel, e_nlrsel): Undefine. Add to
- hppa_reloc_field_selector_type_alt.
- (hppa_field_adjust): Handle e_nlsel, e_nlrsel. Fix e_nsel handling.
- * som.c (hppa_som_gen_reloc_type): Handle N', NL' NLR' field
- selectors.
- (som_write_fixups): Finish handling of R_N0SEL and R_N1SEL.
-
-Wed Feb 28 11:00:24 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): Adjust the segment
- memory size for the alignment of a SEC_ALLOC section, not just a
- SEC_LOAD section.
-
-Tue Feb 27 14:17:31 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * m68klinux.c: New file.
- * hosts/m68klinux.h: New file.
- * config.bfd (m68*-*-linuxaout*, m68*-*-linux*): New targets.
- * configure.in (m68*-*-linux*): New native host.
- (m68klinux_vec): New vector.
- * configure: Rebuild.
- * targets.c (m68klinux_vec): Declare.
- * i386linux.c (bfd_i386linux_size_dynamic_sections): Renamed from
- bfd_linux_size_dynmic_sections to avoid clash with m68klinux.c.
- * bfd-in.h (bfd_i386linux_size_dynamic_sections): Rename
- declaration from bfd_linux_size_dynamic_sections.
- (bfd_m68klinux_size_dynamic_sections): Declare.
- * bfd-in2.h: Rebuild.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add m68klinux.o.
- (BFD32_BACKENDS_CFILES): Add m68klinux.c.
-
-Tue Feb 27 11:31:34 1996 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h (pa_arch): Add pa20.
- (hppa_reloc_field_selector_type): Add R_HPPA_NSEL.
- (e_nsel): Undefine. Add to hppa_reloc_field_selector_type_alt.
- (hppa_field_adjust): Handle e_nsel.
- * som.c: Provide default definitions for many new relocs found only
- in hpux10 include files.
- (som_fixup_formats): Add several new relocs from hpux10.
- (som_hppa_howto_table): Add hpux10 relocs.
- (som_write_fixups): Handle R_N0SEL and R_N1SEL hpux10 relocs.
-
-Mon Feb 26 12:52:48 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.sed: Edit out recent shared library support, and
- rules to rebuild .h files using doc/chew.
-
-Mon Feb 26 14:48:39 1996 David Mosberger-Tang <davidm@AZStarNet.com>
-
- * ecoff.c (ecoff_compute_section_file_positions): Adjust the file
- size even of sections with no contents.
-
-Mon Feb 26 14:01:13 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_link_input_bfd): When merging, skip names
- starting with '$' the way we skip names starting with '.'. When
- updating x_endndx, don't be fooled by an index which has been
- merged.
-
- * cofflink.c (_bfd_coff_link_input_bfd): Don't try to optimize a
- struct/union/enum type with no elements.
-
-Sat Feb 24 11:38:58 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd.c (bfd_errmsg): Handle a NULL return from strerror.
-
- * archive.c (bfd_generic_archive_p): If the first file in the
- archive can not be recognized as an object, don't assume that this
- is the wrong format.
-
- * elf.c (bfd_elf_set_dt_needed_name): Don't do anything if the
- format is not bfd_object.
- (bfd_elf_get_dt_soname): Likewise.
-
-Wed Feb 21 13:58:04 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (sh_relax_delete_bytes): Correct range of R_SH_USES
- reloc.
-
-Tue Feb 20 16:22:44 1996 J.T. Conklin <jtc@rtl.cygnus.com>
-
- * bfd.c (tdata): Add netbsd_core_data.
- * bfd-in2.h: Regenerated.
-
-Tue Feb 20 16:50:02 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (SUNOS_CONSTRUCTOR): Define.
- (sunos_add_one_symbol): Don't let a symbol from a dynamic object
- override a constructor symbol. Set SUNOS_CONSTRUCTOR when
- appropriate.
-
- * bout.c (b_out_squirt_out_relocs): Use udata.i rather than flags
- to get the symbol index, matching 14 Jul 95 change.
-
-Tue Feb 20 08:26:27 1996 Fred Fish <fnf@phydeaux.cygnus.com>
-
- * coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
- Remove duplicate definition of gp.
-
-Mon Feb 19 12:37:41 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Don't
- assume that we can set the GP value and then get the same value,
- since it won't be true if the output file is neither ELF nor
- ECOFF.
- * coff-mips.c (mips_adjust_reloc_in): Don't bother to use
- _bfd_get_gp_value here.
- (mips_gprel_reloc): Don't assume we can set and get the GP value.
- * elf32-mips.c (mips_elf_hi16_reloc): Get gp value from
- mips_elf_final_gp.
- (mips_elf_lo16_reloc): Likewise.
- (mips_elf_final_gp): Add pgp parameter. Set it to the GP value.
- Don't require that the BFD be ELF.
- (mips_elf_gprel16_reloc): Get gp value from mips_elf_final_gp.
- (mips_elf_gprel32_reloc): Likewise.
- (mips_elf_relocate_section): Don't assume we can set and get the
- GP value.
- (mips_elf_finish_dynamic_symbol): Don't bother to use
- _bfd_get_gp_value here.
-
- * elf32-mips.c (mips_elf_create_procedure_table): Initialize sv.
- Don't change epdr between malloc and free. Be careful not to free
- NULL pointers. Zero out the first RPDR.
-
- * configure.host: On Linux, only pass -rpath option if $(libdir)
- is neither /lib nor /usr/lib. From Alan Modra
- <alan@mullet.Levels.UniSA.Edu.Au>.
-
- * elf-bfd.h (struct elf_obj_tdata): Rename dt_needed_name to
- dt_name.
- (elf_dt_name): Rename from elf_dt_needed_name.
- * elf.c (bfd_elf_set_dt_needed_name): Use elf_dt_name, not
- elf_dt_needed_name.
- (bfd_elf_get_dt_soname): New function.
- * elflink.h (elf_link_add_object_symbols): Use elf_dt_name, not
- elf_dt_needed_name. Save the SONAME back in elf_dt_name.
- * bfd-in.h (bfd_elf_get_dt_soname): Declare.
- * bfd-in2.h: Rebuild.
-
-Mon Feb 19 02:50:23 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_reloc_type_lookup): Renamed from
- _bfd_sparc_elf_reloc_type_lookup.
- (bfd_elf32_bfd_reloc_type_lookup): Update.
- * elf64-sparc.c (SPARC64_OLD_RELOCS): Define.
- (sparc64_elf_howto_table): Define.
- (sparc_reloc_map): Define.
- (sparc64_elf_reloc_type_lookup): New function.
- (sparc_elf_wdisp16_reloc): New function.
- (elf_info_to_howto): Use sparc64_elf_howto_table.
- (sparc64_elf_relocate_section): Likewise.
- (bfd_elf64_bfd_reloc_type_lookup): Update.
-
-Sun Feb 18 15:02:25 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Check for 'do not mix' from native linker before
- trying to use -rpath.
-
-Fri Feb 16 12:46:18 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd.c (_bfd_get_gp_value): New function.
- (_bfd_set_gp_value): New function.
- * libbfd-in.h (_bfd_get_gp_value): Declare.
- (_bfd_set_gp_value): Declare.
- * libbfd.h: Rebuild.
- * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Use
- _bfd_get_gp_value and _bfd_set_gp_value rather than referring
- directly to the fields in the tdata information.
- (alpha_relocate_section): Likewise.
- * coff-mips.c (mips_adjust_reloc_in): Likewise.
- (mips_gprel_reloc): Likewise.
- (mips_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_hi16_reloc): Likewise.
- (mips_elf_lo16_reloc): Likewise.
- (mips_elf_final_gp): Likewise.
- (mips_elf_gprel16_reloc): Likewise.
- (mips_elf_gprel32_reloc): Likewise.
- (mips_elf_relocate_section): Likewise.
- (mips_elf_finish_dynamic_symbol): Likewise.
-
- * bout.c (b_out_set_arch_mach): Recognize bfd_mach_i960_jx.
-
-Thu Feb 15 11:29:13 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Call AC_PROG_CC before configure.host.
- * configure: Rebuild.
- * configure.host: Don't set information which autoconf should
- figure out, namely CC, CFLAGS, LDFLAGS, AR, and RANLIB.
-
- * configure.host: Remove go32 and win32 host information, since it
- should no longer be needed.
-
- * elf.c (map_sections_to_segments): If we have a .dynamic section,
- then start a new segment rather than put a writable section in a
- readonly segment.
-
- * configure.host: Set RPATH_ENVVAR.
-
- * Makefile.in: Rebuild dependencies.
-
- * elflink.c (_bfd_elf_create_linker_section): Remove unused
- zero_section variable.
-
-Thu Feb 15 10:39:17 1996 H.J. Lu <hjl@zoom.com>
-
- * Makefile.in ($(srcdir)/bfd-in2.h): Rename target from bfd-in2.h.
- ($(srcdir)/libbfd.h): Rename from libbfd.h.
- ($(srcdir)/libcoff.h): Rename from libcoff.h.
-
-Wed Feb 14 16:29:07 1996 Martin Anantharaman <martin@mail.imech.uni-duisburg.de>
-
- * ieee.c (ieee_write_expression): Only use an R variable for a
- local symbol. Don't output a zero offset. Handle a zero address.
- (SRC_MASK, PCREL_OFFSET): Define based on KEEPMINUSPCININST.
- (rel32_howto, rel16_howto, rel8_howto): Use SRC_MASK and
- PCREL_OFFSET.
- (parse_expression): Don't try to handle multiple occurrences of a
- P variable. Handle I variables differently from X variables. Fix
- the order of minus expressions.
- (ieee_slurp_external_symbols): Generate an I variable for an NN
- record. Fix handling of ATI and ATX records.
- (ieee_slurp_sections): Only set minimal section attributes.
- Adjust them later, based on the section contents.
- (ieee_object_p): Read in the file until just after the ME record.
- Call ieee_slurp_section_data to set the section flags.
- (do_one): Add iterations parameter. Only repeat the first load
- item. Set the section and file reloc flags.
- (ieee_slurp_section_data): Set section flags. Pass iterations to
- do_one.
- (ieee_canonicalize_reloc): Handle I variables.
- (do_with_relocs): Only emit relocation size when necessary.
- Increase MAXRUN to 127. Change ov to be assigned, and take
- src_mask and pcrel_offset into account.
- (ieee_write_data_part): Skip sections that are not loaded.
- (ieee_write_external_part): Don't output optional last entry of WX
- records.
- (ieee_write_me_part): Make setting of me_record neater.
- (ieee_generic_stat_arch_elt): Get the size of an archive element.
-
- * syms.c (stt): Add entries for zerovars, vars, and code.
-
- * elfcode.h (validate_reloc): New static function.
- (write_relocs): Call validate_reloc for non ELF relocs.
-
- * elfxx-target.h (elf_symbol_leading_char): Define if not defined.
- (TARGET_BIG_SYM): Use elf_symbol_leading_char.
- (TARGET_LITTLE_SYM): Likewise.
-
- * config.bfd (m68*-*-psos*): New target.
-
-Tue Feb 13 15:56:22 1996 Bryan Ford <baford@snake.cs.utah.edu>
-
- * i386msdos.c: Remove some #if 0 code.
- (msdos_write_object_contents): Don't include empty sections in the
- size computation, regardless of their address.
-
-Tue Feb 13 15:36:37 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Don't segfault if dynboj
- is NULL, ie, the -r switch is used.
-
-Tue Feb 13 14:35:15 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * reloc.c (BFD_RELOC_MIPS_GOT_HI16): Define.
- (BFD_RELOC_MIPS_GOT_LO16): Define.
- (BFD_RELOC_MIPS_CALL_HI16, BFD_RELOC_MIPS_CALL_LO16): Define.
- * bfd-in2.h, libbfd.h: Rebuild.
- * elf32-mips.c (mips_reloc_map): Map new relocs.
-
- * configure.host: Set HDLFLAGS for *-*-hpux with --enable-shared.
-
- * Makefile.in ($(SHLINK)): Check ts against $(SHLIB), not
- $(SHLINK).
-
- * ieee.c (get_symbol): Set the section to bfd_abs_section.
- (do_with_relocs): If EXEC_P is set and there are no relocs, use a
- simple number for the section address, rather than an expression.
- Limit the number of bytes between relocs to MAXRUN.
- (ieee_write_me_part): Set me_record to the file offset after the
- start address.
- (ieee_write_processor): New static function.
- (ieee_write_object_contents): Use ieee_write_processor.
-
-Fri Feb 9 10:53:00 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Use ${CC-gcc} when testing for -rpath on SunOS.
-
- * coff-aux.c: Change include of aux.h to aux-coff.h.
-
-Thu Feb 8 14:01:03 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf32-m68k.c (elf_m68k_relocate_section): For a R_68K_RELATIVE
- relocation put the addend both in the reloc entry and the data.
- (elf_m68k_finish_dynamic_symbol): Likewise. Mask out marker in
- GOT offset value.
-
- * elf32-m68k.c (elf_m68k_relocate_section): If -Bsymbolic, resolve
- a R_68K_PCxx reloc against a defined global symbol directly.
- (elf_m68k_check_relocs): Don't count such a reloc.
-
- * elf32-m68k.c (elf_m68k_check_relocs): Don't record a symbol with
- a PLTxx reloc as dynamic. Disallow PLTxxO reloc against a local
- symbol for now, otherwise always record the symbol as dynamic.
- (elf_m68k_adjust_dynamic_symbol): If a symbol with a PLTxx reloc
- is not referenced by a dynamic object, and we are not making a
- shared object, then don't make a PLT entry. If we do make a PLT
- entry, make sure the symbol has been recorded as dynamic.
-
-Wed Feb 7 13:56:06 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: When making a shared library, set HLDFLAGS to
- pass an appropriate -rpath option. Use the make variable SONAME
- as the shared library soname, rather than computing it here. On
- SunOS, build stamp-tshlink in place of $(SHLINK).
- * Makefile.in (SONAME): New variable.
- ($(SHLINK)): Make a link to the transformed name, as well.
- (stamp-tshlink): New target.
- (install): Skip stamp-tshlink during install.
-
-Wed Feb 7 13:37:39 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Do not assume that the
- linker sections have been set up yet.
-
- * elf.c (make_mapping): Add an additional argument to suppress
- making the first section include the program headers.
- (map_sections_to_segments): If the user used -Ttext such that the
- program headers are on a different page, do not set the flags
- saying that this section includes the program headers.
-
-Tue Feb 6 14:04:49 1996 J.T. Conklin <jtc@rtl.cygnus.com>
-
- * configure.in (*-*-netbsd*): Set COREFILE to netbsd-core.c.
- don't define TRAD_HEADER.
- * configure: Rebuild.
-
- * netbsd-core.c: New file, support for NetBSD core files.
- * hosts/*nbsd.h: Removed.
-
-Tue Feb 6 11:47:49 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * reloc.c (BFD_RELOC_SPARC_[567]): New reloc types.
- (BFD_RELOC_SPARC_LO7 reloc type): Deleted.
- * libbfd.h, bfd-in2.h: Regenerated.
- * elf32-sparc.c (_bfd_sparc_elf_reloc_type_lookup): Renamed from
- bfd_elf32_bfd_reloc_type_lookup.
- (reloc_type{,_names}): Deleted.
- (_bfd_sparc_elf_howto_table): Renamed from elf_sparc_howto_table.
- Add sparc64 relocs.
- (sparc_reloc_map): Add sparc64 relocs.
- (sparc_elf_notsupported_reloc): New static function.
- (sparc_elf_wdisp16_reloc): New static function.
- (elf32_sparc_check_relocs): Handle R_SPARC_WDISP{16,19}.
- (elf32_sparc_relocate_section): Likewise.
- (bfd_elf32_bfd_reloc_type_lookup): Define.
- * elf64-sparc.c (sparc64_elf_wdisp16_reloc): Deleted.
- (reloc_type{,_names}): Deleted.
- (elf_sparc_howto_table): Deleted.
- (sparc_reloc_map): Deleted.
- (_bfd_sparc_elf_howto_table): Renamed from elf_sparc_howto_table.
- (bfd_elf64_bfd_reloc_type_lookup): Change from function to #define.
-
-Tue Feb 6 12:12:22 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.host: Make SHLIB_CFLAGS include $(PICFLAG) on a
- *-*-hpux* host.
-
- * Makefile.in (program_transform_name): New variable.
- (install): Transform library name before installing it.
-
-Mon Feb 5 10:38:27 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * archures.c (bfd_mach_i960_hx): Define.
- * bfd-in2.h: Rebuild.
- * cpu-i960.c (scan_960_mach): Accept machine "hx".
- (MATRIX): Expand entries for HX.
- (arch_info_struct): Add i960:hx entry.
- * bout.c (b_out_set_arch_mach): Handle bfd_mach_i960_hx.
- * coffcode.h (coff_set_arch_mach_hook): Handle F_I960HX.
- (coff_set_flags): Handle bfd_mach_i960_hx.
-
- Support for building as a shared library, based on patches from
- Alan Modra <alan@spri.levels.unisa.edu.au>:
- * configure.in: Add AC_ARG_ENABLE for shared and commonbfdlib.
- New substitutions: ALLLIBS, PICFLAG, SHLIB, SHLIB_CC,
- SHLIB_CFLAGS, COMMON_SHLIB, PICLIST, SHLINK.
- * configure: Rebuild.
- * configure.host: If --enable-shared, adjust shared library stuff
- based on the host. If the host is SunOS, and the linker supports
- -rpath, set HLDFLAGS to use it.
- * Makefile.in (ALLLIBS): New variable.
- (PICFLAG, SHLIB, SHLIB_CC, SHLIB_CFLAGS): New variables.
- (COMMON_SHLIB, SHLINK): New variables.
- (.c.o): If PICFLAG is set, compile twice, once PIC, once normal.
- (STAGESTUFF): Remove variable.
- (all): Depend upon $(ALLLIBS) and @PICLIST@ rather than
- $(TARGETLIB).
- (stamp-ofiles): New target, like old ofiles target, but build
- using a temporary file and move-if-change, and touch stamp-ofiles
- when done.
- (ofiles): Just depend upon stamp-ofiles.
- (stamp-piclist, piclist): New targets.
- ($(SHLIB), $(SHLINK)): New targets.
- (targets.o, archures.o): Build twice if PICFLAG is set.
- (do_mostlyclean): Remove pic/*.o.
- (do_clean): Remove stamp-ofiles, $(SHLIB), $(SHLINK), piclist, and
- stamp-piclist.
- (do_distclean): Remove pic and stamp-picdir.
- (install): Install shared libraries.
- ($(OFILES)): Depend upon stamp-picdir.
- (stamp-picdir): New target.
-
- * libcoff-in.h: Add comment reminding people that libcoff.h is a
- generated file.
- * libcoff.h: Rebuild.
-
- * elflink.h (elf_adjust_dynamic_symbol): Don't try to get the
- flavour of a section with no owner.
-
- * elf32-mips.c (mips_elf_create_dynamic_sections): Clear
- ELF_LINK_NON_ELF flag.
- (mips_elf_create_got_section): Likewise.
-
- * elf.c: Revert last change, since it breaks dynamic linking.
- * elf-bfd.h (struct elf_backend_data): Remove want_hdr_in_seg
- field.
- * elf32-mips.c (elf_backend_want_hdr_in_seg): Don't define.
- * elfxx-target.h (elf_backend_want_hdr_in_seg): Don't define.
- (elfNN_bed): Don't initialize want_hdr_in_seg field.
-
-Sun Feb 4 20:45:13 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): If the backend does
- not want the elf header or the program headers in the address
- space, do not include them in the calculations.
-
- * elf32-ppc.c (ppc_elf_additional_program_headers): New hook
- function to determine if we need additional program headers.
- (ppc_elf_modify_segment_map): Define as a NOP function for now.
- (ppc_elf_create_linker_section): .sdata2 is a read-only section.
-
-Sat Feb 3 23:00:03 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h: Move today's libcoff.h change into coffcode.h.
-
-Sat Feb 3 15:43:44 1996 Fred Fish <fnf@cygnus.com>
-
- * libcoff.h (bfd_coff_link_add_one_symbol): Combine macro args
- back into one line. Some compilers (sunos 4.1.3 for example)
- won't accept args split across more than one line.
-
-Fri Feb 2 11:42:15 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * aclocal.m4 (BFD_BINARY_FOPEN): Understand cygwin32.
- * configure: Regenerate.
-
-Fri Feb 2 12:12:16 1996 Jeffrey A Law (law@cygnus.com)
-
- * elf32-hppa.c (elf32_hppa_backend_symbol_table_processing): Don't
- try to do arithmetic on a void *, cast it to a unsigned char * first.
-
-Thu Feb 1 16:04:06 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf-bfd.h (ELF_LINK_NON_ELF): Define.
- * elf.c (_bfd_elf_link_hash_newfunc): Set elf_link_hash_flags to
- ELF_LINK_NON_ELF.
- * elflink.h (elf_link_add_object_symbols): Reset ELF_LINK_NON_ELF
- flag for a newly defined symbol.
- (NAME(bfd_elf,record_link_assignment)): Likewise.
- (elf_adjust_dynamic_symbol): If ELF_LINK_NON_ELF is set, try to
- set the DEF or REF_REGULAR flags correctly.
-
- * Makefile.in (bfd-in2.h): Make bfd.h, not protos, in docdir.
- (libbfd.h, libcoff.h): Corresponding change.
-
- * elf32-i386.c (elf_i386_check_relocs): Don't record a symbol with
- a PLT32 reloc as dynamic.
- (elf_i386_adjust_dynamic_symbol): If a symbol with a PLT32 reloc
- is not referenced by a dynamic object, and we are not making a
- shared object, then don't make a PLT entry. If we do make a PLT
- entry, make sure the symbol has been recorded as dynamic.
-
-Wed Jan 31 17:23:32 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * coff-i386.c (coff_i386_reloc_type_lookup): Add BFD_RELOC_32_PCREL.
- * config.bfd (i[345]86-*-win32): Becomes i[345]86-*-cygwin32.
- (powerpcle-*-cygwin32): New.
- * peicode.h (add_data_entry): Get address from vma.
-
-Wed Jan 31 16:23:57 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elflink.c (_bfd_elf_create_linker_section): If the symbol
- attached to the section has already been created as an undefined
- symbol, treat it as if it hasn't been created yet.
-
-Wed Jan 31 16:16:53 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_bfd_final_link): Don't output initial dummy
- symbol or section symbols if stripping all symbols and this is not
- a relocateable link. Don't output the symbol string table if
- there are no symbols.
- (elf_link_flush_output_syms): Don't do anything if there are no
- symbols to flush.
-
-Wed Jan 31 12:55:49 1996 Richard Henderson <rth@tamu.edu>
-
- * coff-aux.c: New file.
- * hosts/m68kaux.h: New file.
- * config.bfd (m68*-apple-aux*): New target.
- * configure.in (m68*-apple-aux*): New native host.
- (m68kaux_coff_vec): New vector.
- * configure: Rebuild.
- * targets.c (m68kaux_coff_vec): Declare.
- * coffcode.h (bfd_coff_backend_data): Add field
- _bfd_coff_link_add_one_symbol.
- (bfd_coff_link_add_one_symbol): Define.
- (compare_arelent_ptr): New static function if TARG_AUX.
- (coff_write_relocs): If TARG_AUX, sort the relocs.
- (coff_write_object_contents): Set A/UX aouthdr magic number.
- (coff_link_add_one_symbol): Define if not defined.
- (bfd_coff_std_swap_table): Initialize new field.
- * libcoff.h: Rebuild.
- * cofflink.c (coff_link_add_symbols): Call
- bfd_coff_link_add_one_symbol rather than
- _bfd_generic_link_add_one_symbol.
- * coff-m68k.c (COFF_PAGE_SIZE): Don't define if already defined.
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
- * Makefile.in: Rebuild dependencies.
- (BFD32_BACKENDS): Add coff-aux.o.
- (BFD32_BACKENDS_CFILES): Add coff-aux.c.
-
-Wed Jan 31 11:37:46 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf32-m68k.c (elf_m68k_relocate_section): Fix R_68K_GOT*
- relocation; ignore addend with R_68K_{GOT,PLT}*O relocation.
-
-Tue Jan 30 12:09:04 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (do_maintainer_clean): Remove $(srcdir)/bfd-in2.h,
- $(srcdir)/libbfd.h and $(srcdir)/libcoff.h.
- (maintainer-clean): Warn about deleting special files.
- (bfd-in2.h, libbfd.h, libcoff.h): New targets.
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Handle indirect and
- warning symbols correctly.
- * elf32-i386.c (elf_i386_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
- * syms.c (_bfd_stab_section_find_nearest_line): Add casts to avoid
- warnings.
-
-Mon Jan 29 14:27:24 1996 Kim Knuttila <krk@cygnus.com>
-
- * libcoff-in.h: aligned newly exported names with bfd naming
- conventions. Removed an erroneous define of POWERPC_LE_PE.
- * libcoff.h: Rebuild.
- * cofflink.c, coff-ppc.c: the above function name changes
-
-Mon Jan 29 13:06:28 1996 Ian Lance Taylor <ian@cygnus.com>
-
- From Basim Kadhim <kadhim@spock.cs.colorado.edu>:
- * ecoff.c (struct extsym_info): Define.
- (_bfd_ecoff_bfd_final_link): Pass a pointer to struct extsym_info
- to ecoff_link_write_external.
- (ecoff_link_write_external): Accept a struct extsym_info pointer.
- Strip symbols when appropriate.
-
- Based on patches from Ronald F. Guilmette <rfg@monkeys.com>:
- * syms.c (BSF_OBJECT): Define.
- (bfd_print_symbol_vandf): Print 'O' for BSF_OBJECT.
- * bfd-in2.h: Rebuild.
- * elfcode.h (elf_slurp_symbol_table): Set BSF_OBJECT for an
- STT_OBJECT symbol.
- * elf.c (swap_out_syms): Only set type to STT_OBJECT if BSF_OBJECT
- is set.
-
- * elf32-i386.c (elf_i386_relocate_section): If -Bsymbolic, when
- copying relocs into a shared object, treat a defined global symbol
- as a local symbol.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
- * elflink.h (elf_link_add_object_symbols): Only set weakdef to a
- real defined symbol, not to a weak defined symbol.
-
-Mon Jan 29 11:34:36 1996 Kim Knuttila <krk@cygnus.com>
-
- * cofflink.c: removed the POWERPC_LE_PE hack, promoted some types
- and made a few static functions externs.
-
- * coff-ppc.c (ppc_bfd_coff_final_link): new function, replaces the
- POWERPC_LE_PE hack in cofflink.
-
- * libcoff-in.h: promoted the following from cofflink.c to allow
- _bfd_coff_final_link to be overridden - STRING_SIZE_SIZE,
- coff_debug_merge_element, struct coff_debug_merge_type,
- coff_debug_merge_hash_entry, coff_debug_merge_hash_table,
- coff_debug_merge_hash_table_init, coff_debug_merge_hash_table_free,
- coff_debug_merge_hash_lookup, coff_link_section_info,
- coff_final_link_info, coff_debug_merge_hash_newfunc,
- coff_write_global_sym, coff_link_input_bfd, coff_reloc_link_order.
-
- * libcoff.h: re-gen'd
-
-Fri Jan 26 18:33:35 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * syms.c: Include "bfdlink.h".
- (struct stab_find_info): Define.
- (_bfd_stab_section_find_nearest_line): New function.
- * libbfd-in.h (_bfd_stab_section_find_nearest_line): Declare.
- * libbfd.h: Rebuild.
- * elf-bfd.h (struct elf_obj_tdata): Add line_info field.
- * elf.c (_bfd_elf_find_nearest_line): Try calling
- _bfd_stab_section_find_nearest_line before searching the ELF
- symbol table. Find the closest STT_FUNC symbol, not the last one.
- * libcoff-in.h (coff_data_type): Add line_info field.
- * libcoff.h: Rebuild.
- * coffgen.c (coff_find_nearest_line): Try calling
- _bfd_stab_section_find_nearest_line before searching the COFF
- symbol table.
- * Makefile.in: Rebuild dependencies.
-
-Fri Jan 26 16:11:19 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (R_PPC_EMB_SDA21 relocations): Make relocation size
- 4 bytes, so we get the correct value when updating the register
- field in little endian mode.
-
-Thu Jan 25 12:14:16 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * libcoff-in.h (struct xcoff_tdata): Remove toc_section and
- entry_section fields. Add sntoc and snentry fields.
- * libcoff.h: Rebuild.
- * coffcode.h (coff_mkobject_hook): Initialize sntoc and snentry,
- not toc_section and entry_section (the COFF file does not have any
- sections at this point).
- (coff_write_object_contents): Set o_snentry and o_sntoc from
- snentry and sntoc rather than entry_section and toc_section.
- * coff-rs6000.c (xcoff_copy_private_bfd_data): Copy sntoc and
- snentry, not toc_section and entry_section.
- * xcofflink.c (bfd_xcoff_size_dynamic_sections): Don't set
- entry_section from hentry.
- (xcoff_link_input_bfd): If a defined symbol has XCOFF_ENTRY set,
- set snenty.
- (xcoff_link_input_bfd): Set sntoc, not toc_section.
- (xcoff_write_global_symbol): Get toc_section from sntoc, rather
- than using toc_section directly.
-
- * archures.c: Add missing `.' in enum bfd_architecture.
- * bfd-in2.h: Rebuild.
-
- * config.bfd (i[345]86-*-sco*elf*): Use bfd_elf32_i386_vec. From
- Robert Lipe <robertl@arnet.com>.
-
-Thu Jan 25 12:08:51 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Add .rela.sdata{,2}
- to sections we allocate. Use bfd_zalloc to allocate initialial
- sections, not bfd_alloc.
- (ppc_elf_check_relocs): Remove BFD_ASSERTs for !shared from
- SDA{,2}I16 relocations.
- (ppc_elf_add_symbol_hook): Use the value of -G nn to determine
- whether to put something in .sbss or not.
- (ppc_elf_relocate_section): Add support for more relocations. Add
- in sec->output_offset where appropriate. Make error messages
- include the symbol name.
-
- * elflink.c (_bfd_elf_create_linker_section): Lookup symbol before
- trying to add it to the symbol table, so _GLOBAL_OFFSET_TABLE_
- doesn't get redefined messages if -shared.
-
- * elflink.h (elf_create_pointer_linker_section) Only bump RELA
- section if the rel_section field has been set up.
-
-Wed Jan 24 20:40:26 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Fix typo in eabi
- relocations.
-
-Wed Jan 24 10:38:34 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Delete checking
- of flags, only flags used are controlled by mach number. Bump up
- output file mach number to highest of input file mach numbers.
- (elf32_sparc_object_p): Watch for EF_SPARC_SUN_US1.
- (elf32_sparc_final_write_processing): Set EF_SPARC_SUN_US1 if v8plusa.
-
- * config.bfd (sparc64-*-{sysv4*,solaris2*}): Comment out
- bfd_elf64_sparc_vec support.
-
-Tue Jan 23 14:33:05 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_copy_private_bfd_data): Don't complain if
- the embedded bit is set on some objects and not on others. Just
- or it together.
- (ppc_elf_relocate_section): Implement R_PPC_EMB_{SDA21,RELSDA}
- relocations.
-
-Tue Jan 23 14:22:45 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_new_section_hook): Don't try to align the
- .stabstr section.
-
- * coffcode.h (coff_set_section_contents): Fix the handling of the
- .lib section to work even if the entire section contents are
- written at once. From Gvran Uddeborg <gvran@uddeborg.pp.se> and
- Robert Lipe <robertl@arnet.com>.
-
-Mon Jan 22 18:45:51 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elflink.h (elf_finish_pointer_linker_section): Don't allocate
- memory here for contents.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Bump up _SDA_BASE_ and
- _SDA2_BASE_ by 32768.
- (ppc_elf_size_dynamic_sections): #if out PLT code which we haven't
- started using. Allocate contents for .sdata and .sdata2 sections
- also.
- (ppc_elf_check_relocs): Use bfd_get_section_name in debug message,
- rather than _name.
- (ppc_elf_finish_dynamic_symbol): Remove code that attempted to
- size _SDA{,2}_BASE_.
- (ppc_elf_relocate_section): Change how sdata{,2} relocations are
- done.
-
-Mon Jan 22 08:52:04 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * elflink.h (elf_finish_pointer_linker_section): Fix typo.
-
- * archures.c (bfd_mach_sparc_v9): Renamed from bfd_mach_sparc64.
- (bfd_mach_sparc_{v8plus,v8plusa}): Define.
- (bfd_mach_sparc_v9a): Define.
- (bfd_mach_sparc_v9_p): Define.
- * bfd-in2.h: Regenerated.
- * aoutx.h (aout,machine_type): bfd_mach_sparc64 renamed to
- bfd_mach_sparc_v9.
- * elf64-sparc.c (sparc64_elf_object_p): Likewise.
- * config.bfd (sparc64-*-sysv4*,sparc64-*-solaris2*): Set targ_defvec
- to bfd_elf32_sparc_vec.
- * cpu-sparc.c (arch_info_struct): Renamed from sparc_arch_info.
- Add v8plus{,a} support.
- Add v9a support.
- (sparc_compatible): New function.
- * elf32-sparc.h: #include "elf/sparc.h".
- (elf32_sparc_merge_private_bfd_data, elf32_sparc_object_p,
- elf32_sparc_final_write_processing): New functions.
- (bfd_elf32_bfd_merge_private_bfd_data, elf_backend_object_p,
- elf_backend_final_write_processing): Define.
-
-Mon Jan 22 11:21:51 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_entry): Add
- linker_section_pointer field.
- (enum elf_linker_section_enum): Enumeration for new way of
- creating linker dynamic sections and symbols.
- (elf_linker_section{,_pointers}): New structures for creating
- dynamic sections and symbols.
- (elf_obj_tdata): Add linker_section_pointers and linker_section
- fields.
- (elf_local_ptr_offsets,elf_linker_section): New accessor macros.
- (_bfd_elf_create_linker_section): New declarations.
- (_bfd_elf_find_pointer_linker_section): Ditto.
- (bfd_elf{32,64}_{create,finish}_pointer_linker_section): Ditto.
- (_bfd_elf_make_linker_section_rela): Ditto.
-
- * elf.c (_bfd_elf_link_hash_newfunc): Initialize new fields.
-
- * elf32-ppc.c (ppc_elf_create_dynamic_sections): Delete.
- (ppc_elf_create_linker_section): New function to create the
- sections .got, .sdata, and .sdata2.
- (ppc_elf_size_dynamic_sections): Zap .rela.{sdata,sdata2} if
- needed.
- (ppc_elf_check_relocs): Support more of the eabi relocations.
- (ppc_elf_relocate_section): Ditto.
- (ppc_elf_finish_dynamic_symbols): Adjust _SDA{,2}_BASE_ by 32768
- if the .sdata{,2} + .sbss{,2} section size is > 32k.
-
- * elflink.h (elf_create_pointer_linker_section): New function to
- create initialized pointers in dynamic linker sections.
- (elf_finish_pointer_linker_section): Actually intialize the
- pointers created above.
-
- * elfcode.h (bfd_elf{32,64}_create_pointer_linker_section): New
- macros to provide both 32 and 64 bit versions of
- elf_create_pointer_linker_section.
- (bfd_elf{32,64}_finish_pointer_linker_section): New macros to
- provide both 32 and 64 bit versions of
- elf_finish_pointer_linker_section.
-
- * elflink.c (_bfd_elf_create_linker_section): New function to
- create a linker section.
- (_bfd_elf_find_pointer_linker_section): Find a unique pointer to a
- given address in the linker pointer offsets created for a given
- symbol.
- (_bfd_elf_make_linker_section_rela): Make a RELA section
- corresponding to the generated linker section.
-
-Sat Jan 20 08:36:10 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * elf32-sparc.c (ELF_MACHINE_ALT1): Define.
-
-Thu Jan 18 18:25:34 1996 Kim Knuttila <krk@cygnus.com>
-
- * coff-ppc.c (coff_ppc_relocate_section): changed TOCDEFN relocs.
- (coff_ppc_relocate_section): Handle special values for gcc built dlls.
- (dump_toc): fix diagnosing code to identify out-of-toc-bounds entries.
- Also begin the toc at 4 as an eye catcher ('31313131' marks the first
- toc entry in an objdump) for now.
- (ppc_do_last, ppc_get_last): New function - needed to save processing
- the toc owner to the end.
- (ppc_coff_swap_sym_in_hook): Removed an incorrect hack for doing the
- toc owner last.
-
- * cofflink.c (_bfd_coff_final_link): Added a new hack to keep the
- toc owner from being done till last. Must define POWERPC_LE_PC
- to enable it.
-
- * coffcode.h (coff_set_alignment_hook): alignment setting for .stab
-
- * peicode.h (coff_swap_scnhdr_out): set section flags for stab/str
- to INFO.
- (coff_swap_aouthdr_out): Removed a non-working hack for computing the
- SizeOfImage for PowerPC. Ignore the size of the .junk section.
-
-Thu Jan 18 17:42:12 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elfcore.h: Include <signal.h> before <sys/procfs.h>.
-
-Wed Jan 17 12:40:14 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * cpu-powerpc.c (arch_info_struct): Change last entry to not point
- back to first.
- (bfd_powerpc_arch): Point at first entry in arch_info_struct.
-
-Tue Jan 16 15:10:49 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): Don't increment file
- offset for a segment which contains no loadable sections.
-
-Mon Jan 15 17:46:27 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * reloc.c: Add new PowerPC relocations.
- * {bfd-in2,libbfd}.h: Regenerate.
-
- * elf32-ppc.c (ppc_elf_howto_raw): Add more PPC relocations.
- (ppc_elf_reloc_type_lookup): Lookup new relocations.
-
-Mon Jan 15 14:29:44 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (howto_table_ext): Fix RELOC_BASE10 and RELOC_BASE22
- entries.
-
- * sunos.c (sunos_scan_ext_relocs): Don't fail assert if
- info->shared.
-
- * coffgen.c (coff_find_nearest_line): Don't try to cache
- information in sections that are not owned by a BFD. From Richard
- Henderson <richard@atheist.tamu.edu>.
-
- * elf32-mips.c: Numerous changes to dynamic linking code, mostly
- from Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
- * elflink.h (elf_link_output_extsym): Remove special check for
- _rld_new_interface.
-
- * ecoffswap.h: Add prototypes for static functions.
-
-Sun Jan 14 21:36:08 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_{unsupported,std}_reloc): Remove functions.
- (ppc_elf_howto_raw): Remove ppc_elf_{unsupported,std}_reloc
- references.
- (ppc_elf_relocate_section): No longer allow .sdata/.sbss sections
- to satisfy a TOC16 relocation. Rewrite unsupported relocation
- support. Begin support for R_PPC_SDA{2,}REL.
-
-Sat Jan 13 09:36:52 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_create_dynamic_sections): New function to
- create the .got and .got.neg sections.
- (ppc_elf_size_dynamic_sections): Call it.
- (ppc_elf_check_relocs): Call it.
- (ppc_elf_size_dynamic_sections): Support .got.neg, just like .got.
- (ppc_elf_check_relocs): Add error messages for relocations we
- don't yet support. Do not include R_PPC_SDAREL16 like a GOT
- relocation.
-
-Fri Jan 12 15:27:59 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_fake_sections): Define, and handle the new
- section flags for V.4 and eabi.
-
-Fri Jan 12 13:59:16 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): If a segment
- contains no sections, don't mark it as readable.
-
- * elf-bfd.h (_bfd_elf_section_from_bfd_section): Declare.
- * elfcode.h (_bfd_elf_section_from_bfd_section): Don't declare.
-
- * elf.c (_bfd_elf_print_private_bfd_data): Dump contents of
- dynamic section, if there is one.
- * elf-bfd.h (struct elf_size_info): Add swap_dyn_in field.
- (bfd_elf32_swap_dyn_in): Change type of second parameter to PTR.
- (bfd_elf64_swap_dyn_in): Likewise.
- * elfcode.h (elf_swap_dyn_in): Change type of second parameter to
- PTR.
- (NAME(_bfd_elf,size_info)): Initialize swap_dyn_in field.
-
- * elf32-i386.c (elf_i386_size_dynamic_sections): Don't create a
- DT_TEXTREL entry because of .rel.plt. From Martin Pirker
- <pirker@eiunix.tuwien.ac.at>.
-
-Thu Jan 11 17:06:14 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * section.c (SEC_{EXCLUDE,SORT_ENTRIES}): New section flags for
- PowerPC V.4 and eabi.
- * bfd-in2.h: Regenerate.
- * libfd.h: Regenerate.
-
- * elfxx-target.h (TARGET_{BIG,LITTLE}_SYM): Add new flags.
-
- * elf32-ppc.c (ppc_elf_section_from_shdr): Support SHT_ORDERED
- section type and SHF_EXCLUDE section flag, turning them into the
- appropriate bfd section flag.
-
-Thu Jan 11 11:23:30 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Create the special
- sections if we see a DYNAMIC object, in case that is the only
- XCOFF input object we see.
-
- * elf32-mips.c: Extensive changes for a start at dynamic linking
- support, from Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
-
- * elf-bfd.h (struct elf_backend_data): Add type_change_ok field.
- (struct elf_backend_data): Remove
- elf_backend_create_program_headers field. Add
- elf_backend_additional_program_headers and
- elf_backend_modify_segment_map fields.
- * elfxx-target.h (elf_backend_type_change_ok): Define if not
- defined.
- (elf_backend_additional_program_headers): Likewise.
- (elf_backend_modify_segment_map): Likewise.
- (elf_backend_create_program_headers): Don't define.
- (elfNN_bed): Change to account for field changes.
- * elf.c (assign_file_positions_for_segments): Call new
- modify_segment_map backend function. Don't call old
- create_program_headers backend function.
- (get_program_header_size): Call additional_program_headers rather
- than create_program_headers.
- * elflink.h (elf_link_add_object_symbols): Initialize
- type_change_ok from new backend field.
- (elf_link_output_extsym): Don't warn if _rld_new_interface is
- defined.
- (elf_reloc_link_order): Treat a reloc against a defined symbol as
- a reloc against the appropriate section.
-
- * elf-bfd.h (struct bfd_elf_section_data): Add tdata field.
- (struct elf_obj_tdata): Rename ppc_flags_init field to flags_init.
- (elf_flags_init): Rename from elf_ppc_flags_init.
- * elf32-ppc.c (ppc_elf_set_private_flags): Use elf_flags_init, not
- elf_ppc_flags_init.
- (ppc_elf_copy_private_bfd_data): Likewise.
- (ppc_elf_merge_private_bfd_data): Likewise.
-
- * elf32-m68k.c (howto_table): Change src_mask to 0 for all
- relocation entries.
-
-Tue Jan 9 15:22:53 1996 David Mosberger-Tang <davidm@azstarnet.com>
-
- * coff-alpha.c (alpha_relocate_section): During final link, allow
- output .lita section to be bigger than 64k by adjusting gp value
- on a per-input section basis.
- * libecoff.h (struct ecoff_tdata): Add issued_multiple_gp_warning
- field.
- (struct ecoff_section_tdata): Add gp field.
-
-Tue Jan 9 12:00:36 1996 Ian Lance Taylor <ian@cygnus.com>
-
- Handle Alpha ECOFF changes in OSF/1 3.2.
- * libecoff.h (struct ecoff_backend_data): Add get_elt_at_filepos
- field.
- * coff-alpha.c: Include "aout/ar.h".
- (alpha_ecoff_get_relocated_section_contents): Don't require an
- ALPHA_R_IGNORE reloc after an ALPHA_R_GPDISP reloc, since OSF/1
- 3.2 doesn't generate one.
- (alpha_relocate_section): Likewise.
- (alpha_ecoff_slurp_armap): Define.
- (alpha_ecoff_slurp_extended_name_table): Define.
- (alpha_ecoff_construct_extended_name_table): Define.
- (alpha_ecoff_truncate_arname): Define.
- (alpha_ecoff_write_armap): Define.
- (alpha_ecoff_generic_stat_arch_elt): Define.
- (alpha_ecoff_update_armap_timestamp): Define.
- (ARFZMAG): Define.
- (alpha_ecoff_read_ar_hdr): New static function.
- (alpha_ecoff_get_elt_at_filepos): New static function.
- (alpha_ecoff_openr_next_archived_file): New static function.
- (alpha_ecoff_get_elt_at_index): New static function.
- (alpha_ecoff_backend_data): Initialize get_elt_at_filepos field.
- (ecoffalpha_little_vec): Change BFD_JUMP_TABLE_ARCHIVE from
- _bfd_ecoff to alpha_ecoff.
- * ecoff.c (ecoff_link_add_archive_symbols): Use get_elt_at_filepos
- field from backend structure, rather than always calling
- _bfd_get_elt_at_filepos.
- * coff-mips.c (mips_ecoff_backend_data): Initialize
- get_elt_at_filepos field.
- * archive.c (_bfd_generic_read_ar_hdr_mag): New function, copied
- from _bfd_generic_read_ar_hdr with minor changes.
- (_bfd_generic_read_ar_hdr): Use _bfd_generic_read_ar_hdr_mag.
- * libbfd-in.h (_bfd_generic_read_ar_hdr_mag): Declare.
- * libbfd.h: Rebuild.
-
- * bfd-in.h (BFD_IN_MEMORY): Define.
- * libbfd-in.h (struct bfd_in_memory): Define.
- * libbfd.c (bfd_read): Handle BFD_IN_MEMORY flag.
- (bfd_get_file_window): Don't try to map a BFD_IN_MEMORY file.
- (bfd_write, bfd_stat): Abort if BFD_IN_MEMORY is set.
- (bfd_tell, bfd_flush, bfd_seek): Handle BFD_IN_MEMORY flag.
- * bfd.c (struct _bfd): Change iostream field from char * to PTR.
- (bfd_get_size): Handle BFD_IN_MEMORY flag.
- * cache.c (bfd_cache_close): Ignore BFD_IN_MEMORY files.
- (bfd_open_file): Cast to PTR, not char *, when setting iostream.
- (bfd_cache_lookup_worker): Abort if BFD_IN_MEMORY is set.
- * opncls.c (bfd_fdopenr): Cast to PTR, not char *, when setting
- iostream.
- (bfd_openstreamr): Likewise.
- * aoutx.h (NAME(aout,some_aout_object_p)): Only fstat iostream if
- BFD_IN_MEMORY is not set.
- * riscix.c (riscix_some_aout_object_p): Likewise.
- * bfd-in2.h, libbfd.h: Rebuild.
-
- * targets.c (bfd_target): Add _bfd_get_elt_at_index field.
- (BFD_JUMP_TABLE_ARCHIVE): Add _get_elt_at_index.
- (bfd_get_elt_at_index): Define.
- * archive.c (_bfd_generic_get_elt_at_index): Rename from
- bfd_get_elt_at_index. Change index parameter from int to
- symindex.
- * libbfd-in.h (_bfd_generic_get_elt_at_index): Declare.
- (_bfd_noarchive_get_elt_at_index): Define.
- (_bfd_archive_bsd_get_elt_at_index): Define.
- (_bfd_archive_coff_get_elt_at_index): Define.
- * bfd-in2.h, libbfd.h: Rebuild.
- * aout-target.h (MY_get_elt_at_index): Define if not defined.
- * coff-rs6000.c (xcoff_get_elt_at_index): Define.
- * ieee.c (ieee_get_elt_at_index): Define.
- * libecoff.h (_bfd_ecoff_get_elt_at_index): Define.
- * oasys.c (oasys_get_elt_at_index): Define.
- * som.c (som_get_elt_at_index): Define.
-
- * ecoff.c (_bfd_ecoff_find_nearest_line): Don't restrict line
- numbers to the .text section.
-
-Mon Jan 8 17:00:57 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_write_debug_part): Change return type to boolean.
- If there is a SEC_DEBUGGING section, get the contents of the debug
- information part from it.
- (ieee_set_section_contents): Store the contents of a SEC_DEBUGGING
- section in memory.
- (ieee_write_object_contents): Check ieee_write_debug_part return.
-
-Thu Jan 4 17:12:37 1996 Fred Fish <fnf@cygnus.com>
-
- * config.bfd (i[345]86-*-freebsd*): Add target.
- * configure.in (i386freebsd_vec): Add vec.
- * configure: Regenerate.
- * Makefile.in (BFD32_BACKENDS): Add i386freebsd.o.
- (BFD32_BACKENDS_CFILES): Add i386freebsd.c.
- Rebuild dependencies..
- * freebsd.h: New file.
- * i386freebsd.c: New file.
- * targets.c (i386freebsd_vec): Declare.
- (bfd_target_vector): Add i386freebsd_vec.
- * i386linux.c (SEGMENT_SIZE): Define as TARGET_PAGE_SIZE
- * i386netbsd.c (SEGMENT_SIZE): Define as TARGET_PAGE_SIZE
-
-Thu Jan 4 16:27:46 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_slurp_debug): New static function.
- (ieee_object_p): Call it.
- (ieee_slurp_section_data): Skip debugging sections.
- (ieee_get_reloc_upper_bound): Likewise.
- (ieee_get_section_contents): Likewise.
- (ieee_canonicalize_reloc): Likewise.
- (ieee_write_section_part): Likewise.
- (ieee_write_debug_part): Likewise.
- (ieee_write_data_part): Likewise.
- (init_for_output): Likewise.
-
-Wed Jan 3 19:42:47 1996 Michael Meissner <meissner@wogglebug.tiac.net>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Make @GOT relocations
- work.
- (ppc_elf_howto_raw): Just use bfd_elf_generic_reloc for all howto
- relocs, since ppc_elf_relocate_section handles the linker case.
- (ppc_elf_{addr16_ha,got16,toc16,brtaken}_reloc): Delete, no longer
- used.
- (ppc_elf_{addr16_ha,got16,toc16,brtaken}_inner): Merge these into
- ppc_elf_relocate_section since that is now the only caller.
- (ppc_elf_relocate_section): Ditto.
-
-Wed Jan 3 15:11:30 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_write_object_contents): If we don't know the
- section of the entry point for an XCOFF executable, always set the
- entry address to -1.
-
-Tue Jan 2 14:17:15 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * elf.c (bfd_section_from_shdr): Add support for note sections.
-
-Tue Jan 2 13:10:25 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd-in.h (struct _symbol_info): Add stab_type field.
- * bfd-in2.h: Rebuild.
- * aoutx.h (NAME(aout,get_symbol_info)): Set stab_type.
-
- * elf32-ppc.c: Remove trailing newline from calls to
- _bfd_error_handler.
- (ppc_elf_merge_private_bfd_data): Only warn about endianness
- difference if target endianness is known.
-
-For older changes see ChangeLog-9495
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/ChangeLog-9899 b/contrib/binutils/bfd/ChangeLog-9899
deleted file mode 100644
index 6d7f5cd..0000000
--- a/contrib/binutils/bfd/ChangeLog-9899
+++ /dev/null
@@ -1,5599 +0,0 @@
-1999-12-29 Richard Henderson <rth@cygnus.com>
-
- * elflink.h (bfd_elf,size_dynamic_sections): Don't export all
- if no dynamic sections created.
-
-1999-12-27 Nick Clifton <nickc@cygnus.com>
-
- * peicode.h (pe_bfd_object_p): Only define for PE format
- targets.
-
-1999-12-17 Nick Clifton <nickc@cygnus.com>
-
- * coff-i386.c (i3coff_object_p): Delete.
- (i386coff_vec): Replace reference to i3coff_object_p with a
- reference to coff_object_p.
-
- * coff-mcore.c (pe_object_p): Delete.
-
- * peicode.h (pe_bfd_object_p): New function: Detect the
- presence of a PE format COFF object file. Also detect and
- warn about the presence of LINK6 format Image Library Format
- object files.
-
-1999-12-16 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (NUM_ELEM): New macro.
- (NUM_RELOCS): New macro: The number of known ARM relocs.
- (RTYPE2HOWTO): Return NULL if the reloc type is out of range.
- (coff_arm_rtype_to_howto): Return NULL if the reloc type is out
- of range.
- (bfd_arm_process_before_allocation): Produce a warning message if
- an out of range symbol index is encountered.
-
-1999-12-14 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (is_global_symbol_definition): New Function: Return
- true iff the symbol is being given a global definition in this
- bfd.
- (elf_link_is_defined_archive_symbol): Do not bother processing
- symbols for an archive element that has already been included
- in the link.
- Use is_global_symbol_definition().
-
-1999-12-09 Andrew Cagney <cagney@cygnus.com>
-
- * config.bfd: Add support for sparc-*-netbsdelf* and
- sparc-*-netbsdaout*.
-
-1999-12-13 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (elf_link_is_defined_archive_symbol): Check to see
- if the symbol is in the common section.
-
-1999-12-10 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (elf_link_is_defined_archive_symbol): New
- function: Decide if a symbol, in an archive map is there
- because it is defined in the archive element, or because it is
- just another common declaration of it.
- (elf_link_add_archive_symbols): Use
- elf_link_is_defined_archive_symbol to decide if an archive
- element contain a reference to a common symbol should be
- linked in or not.
-
-1999-12-10 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h: Revert previous patch.
- * targets.c: Revert previous patch.
- * libbfd-in2.h: Revert previous patch.
- * libbfd.h: Revert previous patch.
- * elfxx-target.h: Revert previous patch.
- * archive.c: Revert previous patch.
- * aout-target.h: Revert previous patch.
- * aout-tic30.h: Revert previous patch.
- * bfd.c: Revert previous patch.
- * coff-alpha.c: Revert previous patch.
- * coff-rs6000.c: Revert previous patch.
- * elf64-mips.c: Revert previous patch.
- * ieee.c: Revert previous patch.
- * libecoff.h: Revert previous patch.
- * oasys.c: Revert previous patch.
- * som.c: Revert previous patch.
- * vms.c: Revert previous patch.
-
-1999-12-09 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (elf_link_add_archive_symbols): Add an archive
- element even if contains a symbol which is currently only
- considered to be a common.
-
- * targets.c (struct bfd_target): Add new field
- _bfd_allow_commons_in_armap.
- * bfd-in2.h:Regenerate.
-
- * libbfd-in2.h (_bfd_noarchive_allow_commons_in_armap):
- Define.
- (_bfd_archive_bsd_allow_commons_in_armap): Define.
- * libbfd.h: Regenerate.
-
- * elfxx-target.h: If using COFF archive map, override
- definition of allow_commons_in_armap and replace with
- bfd_false.
-
- * archive.c (bfd_compute_and_write_armap): Do not place common
- symbols into the archive map unless _bfd_allow_commons_in_armap
- returns true.
-
- * aout-target.h (MY_allow_commons_in_armap): Define.
- * aout-tic30.h (MY_allow_commons_in_armap): Define.
- * bfd.c (bfd_allow_commons_in_armap): Define.
- * coff-alpha.h (alpha_ecoff_allow_commons_in_armap): Define.
- * coff-rs6000.h (xcoff_allow_commons_in_armap): Define.
- * elf64-mips.c (bfd_elf64_allow_commons_in_armap): Define.
- * ieee.c (ieee_ecoff_allow_commons_in_armap): Define.
- * libecoff.h (_bfd_ecoff_allow_commons_in_armap): Define.
- * oasys.c (oasys_allow_commons_in_armap): Define.
- * som.c (som_allow_commons_in_armap): Define.
- * vms.c (vms_allow_commons_in_armap): Define.
-
-1999-12-07 Jim Blandy <jimb@cygnus.com>
-
- Add support for SSE registers in ELF core files.
- * elf.c (elfcore_make_note_pseudosection): New function.
- (elfcore_grok_prfpreg): Use it.
- (elfcore_grok_prxfpreg): New function.
- (elfcore_grok_note): Recognize Linux NT_PRXFPREG notes.
-
-1999-12-03 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Divide R_MIPS_PC16
- value by 4 before storing it back in the field. From
- Koundinya. K <kk@ddeorg.soft.net>.
-
-Tue Nov 30 22:41:14 1999 Jeffrey A Law (law@cygnus.com)
-
- * archures.c (bfd_mach_am33): Define.
- * bfd-in2.h: Rebuilt.
- * cpu-m10300.c (bfd_am33_arch): Add to the mn103 architecture list
- * elf-m10300.c (mn10300_elf_relax_section): Handle am33 instructions.
- (compute_function_info): Handle additional registers saved by
- movm on the am33.
- (elf_mn10300_mach): Handle E_MN10300_MACH_AM33.
- (_bfd_mn10300_elf_final_write_processing): Handle bfd_mach_am33.
-
-1999-11-29 Jim Blandy <jimb@cygnus.com>
-
- * elf.c (bfd_get_elf_phdrs, bfd_get_elf_phdr_upper_bound): New
- functions.
- * bfd-in2.h (bfd_get_elf_phdrs, bfd_get_elf_phdr_upper_bound): New
- declarations.
-
-1999-11-27 Michael Meissner <meissner@cygnus.com>
-
- * reloc.c (BFD_RELOC_ALPHA_USER_LITERAL): New relocation for
- internal use within gas for alpha explicit relocations.
- (BFD_RELOC_ALPHA_USER_LITUSE_BASE): Ditto.
- (BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF): Ditto.
- (BFD_RELOC_ALPHA_USER_LITUSE_JSR): Ditto.
- (BFD_RELOC_ALPHA_USER_GPDISP): Ditto.
- (BFD_RELOC_ALPHA_USER_GPRELHIGH): Ditto.
- (BFD_RELOC_ALPHA_USER_GPRELLOW): Ditto.
-
- * elf64-alpha.c (elf64_alpha_reloc_map): Add mappings for
- BFD_RELOC_ALPHA_USER_*.
-
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
-1999-11-26 Fred Fish <fnf@cygnus.com>
-
- * elf.c (elfcore_read_notes): Add prototype for static function.
- (_bfd_elf_make_section_from_phdr): Renamed from bfd_section_from_phdr.
- (bfd_section_from_phdr): Replacement function that calls
- _bfd_elf_make_section_from_phdr for generic segment types and
- backend fucntion pointed to by elf_backend_section_from_phdr for
- backend specific segment types.
- (_bfd_elfcore_section_from_phdr): Remove call to elfcore_read_notes,
- now called by _bfd_elf_make_section_from_phdr. Note that this func
- is now just a stub between the caller and bfd_section_from_phdr.
-
- * elf-bfd.h (struct elf_backend_data): Add new function pointer
- elf_backend_section_from_phdr.
- (elf_backend_section_from_phdr): Add prototype.
-
- * elfxx-target.h (elf_backend_section_from_phdr): Define default.
- (elfNN_bed): Add elf_backend_section_from_phdr.
-
-1999-11-25 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (bfd_arm_get_bfd_for_interworking): Add
- SEC_CODE and SEC_READONLY flags to glue sections.
-
- * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Add
- SEC_CODE and SEC_READONLY flags to glue sections.
-
-1999-11-20 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (coff_mcore_relocate_section): Fix typo in previous
- delta.
-
-1999-11-19 Catherine Moore <clm@cygnus.com>
-
- * elf32-m68k.c (elf_cpu32_plt0_entry): Fix encoding.
- (elf_cpu32_plt_entry): Likewise.
-
-1999-11-18 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (coff_mcore_rtype_to_howto): Special case handling
- for RVA relocs.
- (coff_mcore_relocate_section): Initialise addend to 0.
- Special case processing of RVA reloc.
-
-1999-11-17 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_backend_data): Reorder collect and
- type_change_ok; add sign_extend_vma.
- * elf32-mips.c (elf_backend_sign_extend_vma): Define.
- * elfcode.h (elf_swap_symbol_in): Mind be->sign_extend_vma.
- (elf_swap_shdr_in, elf_swap_phdr_in): Likewise.
- * elfxx-target.h (elf_backend_sign_extend_vma): Default.
- (elfNN_bed): Follow struture changes.
-
-1999-11-09 Ian Lance Taylor <ian@zembu.com>
-
- * libbfd.c (bfd_read): Check result of read against desired result
- using !=, not <.
- (_bfd_generic_get_section_contents): Set bfd_error if the seek is
- invalid compared to the section size.
-
- * ieee.c (ieee_slurp_debug): Get the length of the debug
- information right if there is no data part.
-
-Tue Nov 2 01:44:41 1999 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_fixup_formats): Improve handling of R_AUX_UNWIND,
- R_LINETAB, R_LINETAB_ESC, and R_COMMENT.
-
-1999-10-28 Ian Lance Taylor <ian@zembu.com>
-
- * elflink.h (elf_bfd_final_link): Make last_local signed.
-
-1999-10-27 Ian Lance Taylor <ian@zembu.com>
-
- * stabs.c (_bfd_link_section_stabs): Make sure .stabstr section
- starts with a zero.
-
-Sat Oct 23 17:36:12 1999 Andrew Cagney <cagney@b1.cygnus.com>
-
- * archures.c: Add definitions bfd_mach_d10v, bfd_mach_d10v_ts2 and
- bfd_mach_d10v_ts3.
- * cpu-d10v.c (d10v_ts3_info, d10v_ts2_info): Add.
- * bfd-in2.h: Regenerate.
-
-1999-10-15 Andrew Haley <aph@cygnus.com>
-
- * dwarf1.c (parse_die): Fail to parse a die if its length is zero.
-
-Sun Oct 17 17:19:00 1999 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h (bfd_hppa_insn2fmt): Change to return an int.
-
-1999-10-08 Ian Lance Taylor <ian@zembu.com>
-
- * elflink.h (elf_merge_symbol): When overriding a weak symbol with
- a defined symbol in a shared library, clear the DEF_DYNAMIC flag
- too.
-
-Fri Oct 8 13:03:45 1999 Geoffrey Keating <geoffk@cygnus.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): R_MIPS_LITERAL
- relocs also need the GP value.
- (_bfd_mips_elf_relocate_section): Handle unpaired LO16 relocs
- properly. Handle sign-extension for R_MIPS_64 correctly. Correct
- the GP value for R_MIPS_LITERAL relocs too. Handle
- R_MIPS_64 relocs properly on big-endian MIPS.
- (mips_elf_sign_extend): Behave properly with 'long long'.
- (mips_elf_highest): Correct typo.
-
-Mon Oct 4 17:49:45 1999 Nick Clifton <nickc@cygnus.com>
-
- * cpu-m32r.c (arch_info_struct): New static global.
- (bfd_m32r_arch): Refer to it.
- * elf32-m32r.c (m32r_elf_object_p): Recognize E_M32RX_ARCH.
- (m32r_elf_print_private_bfd_data): Ditto.
- (m32r_elf_final_write_processing): Handle bfd_mach_m32rx.
- * archures.c (bfd_mach_m32rx): Define it.
- * bfd-in2.h: Rebuild.
-
-1999-09-28 Fred Fish <fnf@cygnus.com>
-
- * targets.c (cisco_core_vec): Replaced with two new vecs ...
- (cisco_core_big_vec): Add new bigendian vec.
- (cisco_core_little_vec): Add new little endian vec.
-
- * cisco-core.c (CRASH_INFO): Fixed offset replaced with ...
- (crash_info_locs): Add array of possible offsets.
- (MASK_ADDR): Mask to apply to crash info offset.
- (crashinfo_external): Add textbase, database, bssbase and
- turn into a typedef.
- (cisco_core_file_validate): Renamed from cisco_core_file_p.
- Many small changes to account for additional hardware versions.
- Pick a reasonable size for ".reg" section. Add a ".crash"
- section to allow access to crashinfo_external struct.
- (cisco_core_file_p): New version of this function that
- iterates over crash_info_locs, calling cisco_core_file_validate.
- (cisco_core_vec): Old big endian only vec replaced with ...
- (cisco_core_big_vec): Add big endian version.
- (cisco_core_little_vec): Add little endian version.
-
- * configure.in (cisco_core_vec): Split to two new vectors ...
- (cisco_core_big_vec): New target vector.
- (cisco_core_little_vec): New target vector.
- * configure: Regenerate.
- * config.bfd (targ): For m68*-*-aout* targ, change cisco_core_vec
- to cisco_core_big_vec in targ_selvecs.
-
-1999-09-28 Geoffrey Keating <geoffk@cygnus.com>
-
- * elf32-mips.c (mips_elf_relocate_hi16): Unused, delete.
- (mips_elf_relocate_got_local): Unused, delete.
- (mips_elf_relocate_global_got): Unused, delete.
-
-1999-09-24 Fred Fish <fnf@cygnus.com>
-
- * elf.c (bfd_section_from_phdr): Add typename variable. Use p_type
- to initialize it to something meaningful. Then use it to generate
- more useful segment names.
-
-Sun Sep 19 12:16:47 1999 Jeffrey A Law (law@cygnus.com)
-
- * som.c (NO_PCREL_MODES): Define if the system does not define
- R_SHORT_PCREL_MODE.
- (hppa_som_gen_reloc_type): Handle both short and long pcrel branches.
- (som_write_fixups): Eliminate redundant pcrel mode relocs. Handle
- R_LONG_PCREL_MODE and R_SHORT_PCREL_MODE
- * libhppa.h (dis_assemble_22): New function.
- (bfd_hppa_insn2fmt): Handle long branch.
-
- * libhppa.h (bfd_hppa_insn2fmt): Decode and handle formats found
- in PA2.0.
-
-1999-09-17 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * coff-i386.c (coff_i386_reloc_type_lookup): Support BFD_RELOC_16,
- BFD_RELOC_16_PCREL, BFD_RELOC_8, BFD_RELOC_8_PCREL relocs.
- (reloc_howto_type howto_table): Tidy comments and whitespace.
-
-1999-09-17 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Undo
- previous delta. Set sec->gc_mark instead.
-
-Thu Sep 16 11:21:13 1999 Catherine Moore <clm@cygnus.com>
-
- * elf32-m68k.c (elf_cpu32_plt0_entry): Use a1 instead of a0.
- (elf_cpu32_plt_entry): Likewise.
-
-Thu Sep 16 10:48:17 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_final_write_processing): Turn on TRAPNIL.
-
- * elf-hppa.h (elf_hppa_final_link): If unable to find __gp in the
- symbol table, then just compute a suitable value (but do not
- create a __gp symbol).
-
- * elf-hppa.h (elf_hppa_relocate_section): Allow undefined
- symbols when building shared libraries.
- (elf_hppa_final_link_relocate): Correct handling of PCREL
- relocations against undefined symbols.
-
-1999-09-16 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Mark
- interworking sections as linker created so that they will not
- be removed by garbage collection.
-
-Wed Sep 15 02:31:57 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_final_link): Revamp __gp handling.
- (elf_hppa_final_link_relocate): Consistently create an absolute
- address, then subtract out the value of __gp.
-
-1999-09-14 Michael Meissner <meissner@cygnus.com>
-
- * configure.in (Canonicalization of target names): Remove adding
- ${CONFIG_SHELL} in front of $ac_config_sub, since autoconfig 2.14
- generates $ac_config_sub with a ${CONFIG_SHELL} already.
- * configure: Regenerate.
-
-1999-09-14 Nick Clifton <nickc@cygnus.com>
-
- * elf32-m32r.c (ELF_MAXPAGESIZE): Change to 0x1 (at request of
- Mitsubishi).
-
-Mon Sep 13 20:01:47 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_record_segment_addrs): New function.
- (elf_hppa_final_link): Initialize text_segment_base and
- data_segment_base.
- (elf_hppa_final_link_relocate): Handle SEGREL relocations.
-
- * elf-hppa.h (elf_hppa_final_link): Remove unused variables.
- (elf_hppa_final_link_relocate): Likewise.
- (elf_hppa_relocate_insn): Likewise.
- (elf_hppa_relocate_section): Initialize HOWTO.
-
-1999-09-13 Donn Terry <donn@interix.com>
-
- * coffcode.h (styp_to_sec_flags): Further refinement of COMDAT
- handling to support both GNU and MS objects.
-
- * coffcode.h (coff_write_object_contents): Don't check reloc_count
- when determining whether to set F_RELFLG.
-
-1999-09-13 Philip Blundell <pb@nexus.co.uk>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Don't range-check
- PC24 relocs if the target is an undefined weak symbol.
- (arm_add_to_rel): Fix compiler warning.
- (elf32_arm_plt0_entry): Correct comments.
-
-1999-09-13 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * elfcode.h (write_relocs): Check for the_bfd NULL when handling
- an absolute symbol in REL relocs.
-
-Sun Sep 12 23:47:58 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle SECREL32.
- Stub SEGREL32. Return an error for any relocation not handled.
-
-1999-09-12 Ian Lance Taylor <ian@zembu.com>
-
- * cofflink.c (coff_link_add_symbols): Look for special MSVC string
- constant symbols, and avoid multiple definition errors on them.
-
-1999-09-12 Donn Terry <donn@interix.com>
-
- * libbfd.c (bfd_log2): Rewrite to avoid infinite loop if most
- significant bit is set.
-
-1999-09-11 Ian Lance Taylor <ian@zembu.com>
-
- * coff-ppc.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
-
- * elfcode.h (write_relocs): Handle an absolute symbol in REL
- relocs as we do for RELA relocs.
-
-1999-09-11 Donn Terry <donn@interix.com>
-
- * libpei.h (_bfd_pei_final_link_postscript): Declare.
- (coff_final_link_postscript): Define.
- * peigen.c (_bfd_pei_swap_aouthdr_out): Don't set value for data
- directory entries here.
- (_bfd_pei_final_link_postscript): New function.
-
- * peigen.c (_bfd_pei_swap_scnhdr_out): Remove code which sets
- section flags based on the section name.
-
- * peicode.h (coff_swap_scnhdr_in): If COFF_IMAGE_WITH_PE, the
- get the overflow of the s_nlnno field from the s_nreloc field.
- * peigen.c (_bfd_pei_swap_scnhdr_out): If doing a final link, swap
- the s_nlnno overflow of the .text section into the s_nreloc
- field.
-
- * peigen.c (add_data_entry): Declare.
- (pei_swap_aouthdr_out): Get image size right. Set linker version
- more intuitively.
- (pei_swap_scnhdr_out): Test for UNINIT section, not .bss.
- (pe_print_idata): Code cleanup, print more info, get rid of (now)
- extraneous ImageBase.
- (pe_print_edata): Likewise.
- (pe_print_pdata): Likewise. Print exception entries.
- (pe_print_reloc): Likewise. Print MIPS_JMPADDR.
- (tbl): Make const, add "UNKNOWN".
- (_bfd_pe_print_private_bfd_data_common): Print timestamp.
- (_bfd_pe_bfd_copy_private_bfd_data_common): Don't copy deleted
- section data directory.
- (_bfd_pe_bfd_copy_private_section_data): Copy pe_flags.
-
- * libpei.h (_bfd_pe_bfd_get_symbol_info): Declare.
- * peigen.c (_bfd_pe_bfd_get_symbol_info): New function.
- * peicode.h (coff_get_symbol_info): Define.
-
- * config.bfd (i[3456]86-*-interix*): Set targ_cflags to
- -DSTRICT_PE_FORMAT.
- * coffcode.h (styp_to_sec_flags): Check STRICT_PE_FORMAT rather
- than __INTERIX.
- (coff_classify_symbol): Re-revert 1999-08-08 patch if
- STRICT_PE_FORMAT.
-
- * libpei.h: New file, broken out of peicode.h.
- * peigen.c: New file, broken out of peicode.h.
- * peicode.h: A bunch of code moved out to libpei.h and peigen.c.
- * configure.in: Add peigen.lo to list of files required for each
- PE target.
- * Makefile.am: Rebuild dependencies.
- (BFD32_BACKENDS): Add peigen.lo.
- (BFD32_BACKENDS_CFILES): Add peigen.c.
- (SOURCE_HFILES): Add libpei.h.
- * configure, Makefile.in: Rebuild.
-
- * peicode.h (coff_swap_scnhdr_in): Don't check for a special
- section name of _BSS; check IMAGE_SCN_CNT_UNINITIALIZED_DATA
- instead. Don't clear the s_paddr field for an uninitialized data
- section.
-
- * coffcode.h (coff_mkobject_hook): Set timestamp field in
- coff_data_type to f_timdat.
- * peicode.h (pe_mkobject_hook): Likewise.
-
- * peicode.h (coff_swap_filehdr_in): Check the NT executable magic
- number if COFF_IMAGE_WITH_PE.
-
- * coffcode.h (coff_mkobject_hook): If COFF_WITH_PE, set HAS_DEBUG
- to the reverse of IMAGE_FILE_DEBUG_STRIPPED.
- (coff_write_object_contents): Set IMAGE_FILE_DEBUG_STRIPPED if
- there is no SEC_DEBUGGING section.
- * peicode.h (pe_mkobject_hook): Set HAS_DEBUG to the reverse of
- IMAGE_FILE_DEBUG_STRIPPED.
-
- * pe-i386.c (COFF_LONG_FILENAMES): Define.
- (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
- * pei-i386.c (COFF_LONG_FILENAMES): Define.
- (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
-
- * coffswap.h (IMAGE_BASE): Don't define.
- * pei-arm.c (IMAGE_BASE): Don't define.
- * pei-i386.c (IMAGE_BASE): Don't define.
- * pei-mcore.c (IMAGE_BASE): Don't define.
- * pei-ppc.c (IMAGE_BASE): Don't define.
-
- * cofflink.c (_bfd_coff_link_input_bfd): When writing out a
- symbol, switch on the class when determining whether to modify the
- value. For PE, don't modify the value of a C_FCN symbol not named
- .bf.
-
- * libbfd-in.h (_bfd_abort): Declare.
- (abort): Define.
- * bfd.c (_bfd_abort): New function.
- * libbfd.h: Rebuild.
-
- * coffcode.h (coff_set_alignment_hook): Delete POWERPC_LE_PE
- special handling.
-
- * cofflink.c (_bfd_coff_link_input_bfd): If a symbol is stripped,
- don't write out the associated line numbers.
-
- * cofflink.c (_bfd_coff_write_global_sym): Handle section symbol
- aux entries.
-
- * cofflink.c (coff_link_add_symbols): Don't warn about symbol type
- changes when the base type is unknown.
-
- * coffgen.c (coff_print_symbol): Fix printing of aux record for
- function symbols.
-
- * syms.c (BSF_DEBUGGING_RELOC): Define.
- * coffcode.h (coff_slurp_symbol_table): If PE, set BSF_DEBUGGING
- for C_FCN/C_EFCN symbols, and set BSF_DEBUGGING_RELOC for such
- symbols named .bf.
- * coffgen.c (fixup_symbol_value): Relocate a symbol which has
- BSF_DEBUGGING_RELOC set.
- * bfd-in2.h: Rebuild.
-
-1999-09-10 Ian Lance Taylor <ian@zembu.com>
-
- * ecoff.c (bfd_debug_section): Update initialization for new
- comdat_info field.
- (_bfd_ecoff_styp_to_sec_flags): Add section parameter.
- * libecoff.h (_bfd_ecoff_styp_to_sec_flags): Update declaration.
-
-1999-09-10 H.J. Lu <hjl@gnu.org>
-
- * coff-alpha.c (alpha_ecoff_backend_data): Initialize the new
- _bfd_filnmlen field.
- * coff-mips.c (mips_ecoff_backend_data): Likewise.
-
-Fri Sep 10 00:35:14 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Create .opd entries
- for FPTR relocs involving local symbols.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Get the right
- value for the stub address in a call through a stub.
- Install the value for a local symbol directly into the DLT
- instead of generating a reloc. Correctly handle FPTR64 relocs.
-
- * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): New function.
- (elf_hppa_remark_useless_dynamic_symbols): Similarly.
- (elf_hppa_final_link): Call them.
-
-1999-09-10 Ian Lance Taylor <ian@zembu.com>
-
- * elflink.h (elf_fix_symbol_flags): Move weakdef handling here...
- (elf_adjust_dynamic_symbol): ...from here.
-
-Wed Sep 8 17:56:11 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_howto_table); There is no DIR64WR, DIR64DR
- relocation, remove them. SECREL64->LTOFF16WF.
- (elf_hppa_final_link_relocate): Handle LTOFF* relocations. Handle
- DIR* relocations.
- (elf_hppa_relocate_insn): Similarly.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle PLTOFF* relocs.
- (elf_hppa_relocate_insn): Similarly.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle DPREL* and
- GPREL* relocations.
- (elf_hppa_relocate_insn): Similarly.
-
- * elf-hppa.h (elf_hppa_link_final_relocate): Fix typos.
- Handle LTOFF_TP* relocs.
- (elf_hppa_relocate_insn): Similarly.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle PCREL* relocs.
- Consistently deal with addends. Handle DLTIND14F and DLTREL14F.
- (elf_hppa_relocate_insn): Handle PCREL* relocs.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle LT_OFF_FPTR*,
- DIR32, DIR64 and FPTR64 relocations.
- (elf_hppa_relocate_insn): Similarly.
-
- * elf-hppa.h (elf_hppa_final_link): Set the value of __gp to the
- address of the .PARISC.global section.
- (elf_hppa_relocate_section): Lookup and pass the PA64 hash
- table entry elf_hppa_final_link_relocate. Do not give a warning
- for a reloc against an external symbol if it has a PA64 hash
- table entry.
- (elf_hppa_final_link_relocate): Significantly rework. Handle
- DLTIND relocations. Compute the final value of the relocation
- before passing the value of elf_hppa_relocate_insn.
- (elf_hppa_relocate_insn): Revamp to handle just bit tiwiddling
- relocation support. Handle DLTIND relocation requests just like
- DLTREL relocation requests. Simplify branch handling.
-
-1999-09-08 Ulrich Drepper <drepper@cygnus.com>
-
- * elf-hppa.h (elf_hppa_relocate_section): Catch problems with
- non-allocated section as done in i386 version.
- (elf_hppa_final_link_relocate): Uncomment R_PARISC_14F in switch
- statement since this is no know relocation.
-
-Tue Sep 7 17:25:12 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14F
- relocs.
- (elf_hppa_relocate_insn): Similarly.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14WR and
- DLTREL14WD relocs.
- (elf_hppa_relocate_insn): Similarly.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14R and
- DLTREL21L relocs. Pass the output bfd to elf_hppa_relocate_insn.
- Pass the relocate type rather than the insn format to
- elf_hppa_relocate_insn.
- (elf_hppa_relocate_insn): Make switch dependent on relocation type
- rather than the opcode. Handle DLTREL21L and DLTREL14R relocs.
-
-1999-09-07 Ian Lance Taylor <ian@zembu.com>
-
- * coffcode.h (bfd_coff_backend_data): Add _bfd_filnmlen field.
- (bfd_coff_filnmlen): Define.
- (bfd_coff_std_swap_table): Initialize new field.
- * coffgen.c (coff_fix_symbol_name): Use bfd_coff_filnmlen rather
- than FILNMLEN.
- (coff_write_symbols): Likewise.
- (coff_get_normalized_symtab): Likewise.
- * coff-sh.c (bfd_coff_small_swap_table): Initialize new field.
- * libcoff.h: Rebuild.
-
-1999-09-06 Donn Terry <donn@interix.com>
-
- * coffcode.h (sort_by_secaddr): New static function if
- COFF_IMAGE_WITH_PE.
- (coff_compute_section_file_positions): If COFF_IMAGE_WITH_PE, sort
- sections by VMA when assigning target_index values. Always set
- virt_size.
-
- * libcoff-in.h (struct pei_section_tdata): Add pe_flags field.
- * coffcode.h (coff_set_alignment_hook) [COFF_WITH_PE version]: Set
- pe_flags field.
- * libcoff.h: Rebuild.
-
- * coffcode.h (coff_set_custom_section_alignment): Add const to
- declaration to match definition.
- (coff_write_object_contents): Don't set F_AR32W(R)? if
- COFF_WITH_PE.
-
- * coff-i386.c (in_reloc_p): Add declaration.
- (i386coff_vec): Simplify initialization of
- application_section_flags.
-
- * coffcode.h (sec_to_styp_flags): Write separate COFF_WITH_PE
- version. Move COFF_WITH_PE specific code to new version.
- (stype_to_sec_flags): Likewise. Add section parameter.
- * coffgen.c (make_a_section_from_file): Set target_index before
- calling styp_to_sec_flags. Pass section to styp_to_sec_flags.
- * libcoff.h: Rebuild.
-
- * syms.c (stt): Add some PE/PEI section names.
- (bfd_decode_symclass): Return 'w', not 'U', for a weak undefined
- symbol.
- (bfd_symbol_info): Check for 'w'.
-
- * section.c (struct bfd_comdat_info): Define.
- (asection): Add comdat field.
- (STD_SECTION): Initialize comdat field.
- (bfd_make_section_anyway): Likewise.
- * bfd-in2.h: Rebuild.
-
-1999-09-06 Andreas Schwab <schwab@suse.de>
-
- * elflink.h (elf_link_add_object_symbols): Copy NON_GOT_REF flag
- to version symbols.
-
-1999-09-06 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (elf_gc_record_vtentry): Use bfd_zmalloc and
- bfd_realloc instead of calloc and realloc.
-
-1999-09-04 Steve Chamberlain <sac@pobox.com>
-
- * cpu-pj.c: New file.
- * elf32-pj.c: New file.
- * config.bfd (pj*): New cpu.
- (pj-*-*, pjl-*-*): New targets.
- * configure.in (bfd_elf32_pj_vec): New target vector.
- (bfd_elf32_pjl_vec): New target vector.
- * archures.c (bfd_arch_pj): Define.
- * elf.c (prep_headers): Handle bfd_arch_pj.
- * reloc.c: Define BFD_RELOC_PJ_* relocations.
- * targets.c (bfd_elf32_pj_vec, bfd_elf32_pjl_vec): Declare and add
- to target vector list.
- * Makefile.am: Rebuild dependencies.
- (ALL_MACHINES): Add cpu-pj.lo.
- (ALL_MACHINES_CFILES): Add cpu-pj.c.
- (BFD32_BACKENDS): Add elf32-pj.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-pj.c.
- * configure, Makefile.in, bfd-in2.h, libbfd.h: Rebuild.
-
-1999-09-04 Ian Lance Taylor <ian@zembu.com>
-
- * elf-bfd.h (ELF_LINK_NON_GOT_REF): Define.
- * elflink.h (elf_adjust_dynamic_symbol): Copy REF_REGULAR_NONWEAK
- and NON_GOT_REF from weak defined symbol to real symbol.
- * elf32-i386.c (elf_i386_check_relocs): Set NON_GOT_REF.
- (elf_i386_adjust_dynamic_symbol): If NON_GOT_REF is not set, don't
- create a COPY reloc.
- * elf32-sparc.c (elf32_sparc_check_relocs): Set NON_GOT_REF.
- (elf32_sparc_adjust_dynamic_symbol): If NON_GOT_REF is not set,
- don't create a COPY reloc.
-
-1999-09-03 Ian Lance Taylor <ian@zembu.com>
-
- * elflink.h (elf_bfd_final_link): When counting relocations, don't
- count those in sections we are not including in the link.
-
-Thu Sep 2 17:41:20 1999 Jeffrey A Law (law@cygnus.com)
-
- * elflink.h (elf_link_add_object_symbols): Work around bogus SH_LINK
- field in hpux11 shared libraries.
-
-1999-09-02 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (elf_gc_record_vtentry): Fix memory leak.
-
-Wed Sep 1 13:34:29 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_add_symbol_hook): New function.
- (elf_hppa_final_link, elf_hppa_relocate_section): Likewise.
- (elf_hppa_final_link_relocate, elf_hppa_relocate_insn): Likewise.
-
-1999-08-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * elflink.h (record_link_assignment): When possible, keep the
- original type of the symbol.
-
-Mon Aug 30 15:26:48 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Allow both
- R_PARISC_DIR32 and R_PARISC_DIR64 regardless of how the
- tools were configured.
- * elf32-hppa.h (_bfd_elf32_hppa_gen_reloc_type): Declare.
-
-1999-08-26 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_check_relocs): Don't allocate local
- GOT entries for GOT16 relocations; they're not required.
-
-1999-08-24 Nick Clifton <nickc@cygnus.com>
-
- From a patch submitted by Roland McGrath <roland@baalperazim.frob.com>
-
- * config.bfd (arm-*-netbsd*): New target.
- * configure.in (armnetbsd_vec): New target vector.
- * configure: Regenerate
- * targets.c (bfd_target_vector): Add &armnetbsd_vec.
-
- * Makefile.am (BFD32_BACKENDS): Add armnetbsd.lo.
- (ALL_MACHINES_CFILES): Add armnetbsd.c.
- (armnetbsd.lo): New rule with deps.
- * Makefile.in: Regenerate.
-
- * armnetbsd.c: New file: Definitions specific to arm-netbsd
- target.
-
-Tue Aug 24 00:25:58 1999 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_slurp_symbol_table): Fix typo in comment.
-
-Fri Aug 20 17:01:23 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_fake_sections): Compute section indices
- here instead of using elf_section_data...
-
-1999-08-19 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (mcore_emit_base_file_entry): New function: Emit
- relocations into the base file.
- (coff_mcore_relocate_section): Call mcore_emit_base_file_entry if
- we are building a base file.
-
-1999-08-19 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (arm_add_to_rel): New function. Add a value to
- a REL style reloc.
- (elf32_arm_relocate_section): Use arm_add_to_rel to increment
- REL relocs when performing a partial relocation.
-
-1999-08-18 Donn Terry <donn@interix.com>
-
- * cofflink.c: Move definitions of N_TMASK, et. al., out of
- _bfd_coff_link_input_bfd into top level.
-
- * coff-i386.c (coff_i386_reloc): Handle R_IMAGEBASE.
- (RTYPE2HOWTO): Return NULL if reloc type is out of range.
- (coff_i386_rtype_to_howto): Likewise.
- * coffcode.h (coff_slurp_symbol_table): Change a -2 to N_DEBUG.
- Completely ignore symbols which are all zero.
- (dummy_reloc16_estimate): Add return 0.
- * cofflink.c (_bfd_coff_link_input_bfd): Rename inner scope
- variable copy to name_copy to avoid shadowing outer scope
- variable.
- * libcoff-in.h (coff_data_type): Change raw_syment_count field
- from unsigned int to unsigned long. Add timestamp field.
- * libcoff.h: Rebuild.
-
-1999-08-17 H.J. Lu <hjl@gnu.org>
-
- * elf32-hppa.c (bfd_elf32_bfd_is_local_label_name): Fix typo in
- macro definition.
-
-1999-08-17 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-mips.c (_bfd_mips_elf_add_symbol_hook): Set BSF_DYNAMIC
- for special section symbols.
- * elflink.h (elf_merge_symbol): If we have no old BFD, check
- BSF_DYNAMIC on the section symbol to see whether the old BFD is
- dynamic.
-
-1999-08-15 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Fix unfortunate
- coincidence of variable names between old and new code.
-
-1999-08-12 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (elf32_arm_to_thumb_stub): Make 'offset' parameter
- into a bfd_vma and 'addend' parameter a 'bfd_signed_vma'.
- (elf32_thumb_to_arm_stub): Make 'offset' parameter into a bfd_vma
- and 'addend' parameter a 'bfd_signed_vma'.
- (elf32_arm_final_link_relocate): Do not involve stubs in
- R_ARM_THM_PC22 relocs relative to section symbols, they are long
- jumps, not function calls.
-
-1999-08-11 Robin Farine <advanc@dial.eunet.ch>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Check for overflow
- in R_ARM_PC24 relocs.
-
-Tue Aug 10 12:48:09 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (elf_hppa_fake_sections): New function.
- * elf32-hppa.c (elf_backend_fake_sections): Define.
-
- * elf-hppa.h (elf_hppa_final_write_processing): Update for
- recent changes to the arch_info structure.
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle
- R_HPPA_SEGBASE and R_HPPA_SEGREL32.
- * cpu-hppa.c (bfd_hppa20w_arch): New entry in architecture info
- list.
-
-Tue Aug 10 00:34:29 1999 Mark P. Mitchell <mark@codesourcery.com>
- Ralf Baechle <ralf@uni-koblenz.de>
-
- * elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Always
- output DT_MIPS_GOTSYM.
- (_bfd_mips_elf_finish_dynamic_sections): Use the same value as
- DT_MIPS_SYMTABNO if there are no global GOT symbols.
-
-Tue Aug 10 00:21:08 1999 Mark P. Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_create_dynamic_relocation): Change
- prototype. Handle local symbols. Add commentary.
- (mips_elf_calculate_relocation): Adjust accordingly.
- (_bfd_mips_elf_check_relocs): Handle local symbols in R_MIPS_32
- relocations.
-
- * elflink.h (elf_bfd_final_link): Tweak last change.
-
-1999-08-09 Mark Mitchell <mark@codesourcery.com>
-
- * elflink.h (elf_link_size_reloc_section): Use the counts in the
- elf-section data to allocate just the right amount of relocation
- space. Don't allocate the hash space twice.
- (elf_bfd_final_link): Calculate the amount of space to allocate in
- each relocation section.
-
-Mon Aug 9 17:37:30 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type, case 32): When in
- 64bit mode, generate a section relative relocation for a 32bit
- wide relocation.
- (elf_hppa_is_local_label_name): New function.
- * elf32-hppa.c (elf_hppa_is_local_label_name): Deleted. To be
- shared between 32bit and 64bit port.
-
-1999-08-09 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (elf_mips_howto_table): Fix src_mask for
- R_MIPS_GOT16 and R_MIPS_CALL16.
- (mips_elf_got16_entry): Use mips_elf_high to calculate the value
- to use when looking for a preexisting GOT entry.
-
-1999-08-09 Jakub Jelinek <jj@ultra.linux.cz>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Back out part of
- the Sep. 4th, 1998 change. glibc 2.0.x dynamic linker had bug,
- not binutils.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
-
-1999-08-09 Geoff Keating <geoffk@cygnus.com>
-
- * elflink.h (elf_link_output_extsym): Don't output a weak
- reference to an undefined symbol just because it was defined weak
- in a shared object.
-
-1999-08-09 Eli Zaretskii <eliz@is.elta.co.il>
-
- * coffgen.c (coff_find_nearest_line): When looking for file, use
- last best match rather than first. If address is beyond last line
- number record, don't return the last line as the correct value.
-
-1999-08-08 Ian Lance Taylor <ian@zembu.com>
-
- * section.c (SEC_SMALL_DATA): Rename from SEC_SHORT.
- * bfd-in2.h: Rebuild.
-
-1999-08-08 Mark Elbrecht <snowball3@bigfoot.com>
-
- * libcoff-in.h (struct coff_section_alignment_entry): Define.
- * coffcode.h (coff_set_custom_section_alignment): New static
- function.
- (coff_section_alignment_table): New static array.
- (coff_new_section_hook): Use coff_set_customer_section_alignment.
- * coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
- * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define.
- * libcoff.h: Rebuild.
-
-1999-08-08 Ian Lance Taylor <ian@zembu.com>
-
- * Makefile.am: Rename .dep* files to DEP*. Change DEP variable to
- MKDEP.
- * Makefile.in: Rebuild.
-
-1999-08-08 Mumit Khan <khan@xraylith.wisc.edu>
-
- * section.c (SEC_SHARED): Define.
- * coffcode.h (sec_to_styp_flags): Handle SEC_SHARED.
- (styp_to_sec_flags): Likewise.
- * peicode.h (coff_swap_scnhdr_out): Likewise.
- * bfd-in2.h: Rebuild.
-
-1999-08-08 Ian Lance Taylor <ian@zembu.com>
-
- * coffcode.h (coff_classify_symbol): Comment out part of
- 1999-08-05 change which breaks cygwin DLLs.
-
- * acinclude.m4 (BFD_BINARY_FOPEN): Change -windows to -windows*.
- * aclocal.m4, configure: Rebuild.
-
-1999-08-06 Ian Lance Taylor <ian@zembu.com>
-
- * section.c (global_syms): Only initialize union field if
- __STDC__.
-
-1999-08-04 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_got16_entry): Don't multiply GOT index by
- the size of a GOT entry here.
- (mips_elf_calculate_relocation): Don't create a local GOT entry
- for the symbol in a GOT16 relocation; just for it's high-order bit
- (_bfd_mips_elf_relocate_section): Fix thinko.
-
-1999-08-05 Ian Lance Taylor <ian@zembu.com>
-
- Based on patches from Donn Terry <donn@interix.com>:
- * coffcode.h (enum coff_symbol_classification): Define.
- (bfd_coff_backend_data): Rename _bfd_coff_sym_is_global to
- _bfd_coff_classify_symbol. Change return type.
- (bfd_coff_classify_symbol): Rename from bfd_coff_sym_is_global.
- (coff_slurp_symbol_table): Use coff_classify_symbol.
- (coff_classify_symbol): New static function.
- (coff_sym_is_global): Never define.
- (bfd_coff_std_swap_table): Initialize with coff_classify_symbol.
- * cofflink.c (coff_link_check_ar_symbols): Use
- bfd_coff_classify_symbol rather than bfd_coff_sym_is_global.
- (coff_link_add_symbols): Likewise.
- (_bfd_coff_link_input_bfd): Likewise.
- * coff-sh.c (bfd_coff_small_swap_table): Initialize with
- coff_classify_symbol.
- * libcoff.h: Rebuild.
-
-Wed Aug 4 18:08:07 1999 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h (R_HPPA_LTPSEL, R_HPPA_RTPSEL): New field selectors
- (e_ltpsel, e_rtpsel): Similarly.
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle 21bit e_ltpsel
- and 14bit ertpsel. Handle 64bit psel.
-
-1999-08-04 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_relocate_section): Tweak HI16/LO16
- handling for REL relocations. And only left-shift R_MIPS26
- relocation addends where necessary.
-
-1999-08-03 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_next_lo16_addend): Rename to ...
- (mips_elf_next_lo16_relocation): Don't compute the addend here.
- Just return the relocation found.
- (mips_elf_relocate_section): Pull the LO16 addend out of the
- section itself when using REL relocations.
-
- * elf32-mips.c (mips_elf_calculate_relocation): Restore
- _DYNAMIC_LINK handling and handling of undefined symbols in shared
- libraries.
-
-1999-08-03 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Don't use the relocation
- value of a symbol in a SEC_DEBUGGING section. Warn when doing a
- relocation against a symbol in an input section with no output
- section. From Daniel Jacobowitz <drow@false.org>.
-
- * coff-stgo32.c (go32_stubbed_coff_object_p): Remove; not used.
-
- * acinclude.m4 (BFD_CC_FOR_BUILD): Change to use conftest, and to
- look for generated file correctly.
- * aclocal.m4, configure: Rebuild.
-
-1999-08-02 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_relocate_section): Handle R_MIPS_26
- and R_MIPS16_26 relocations correctly when relocating.
- (_bfd_mips_elf_check_relocs): Don't assume that R_MIPS_CALL_HI16
- and R_MIPS_CALL_LO16 are for global symbols.
-
-1999-08-02 Jakub Jelinek <jj@ultra.linux.cz>
-
- * elflink.h (elf_bfd_final_link): Copy the whole isym, not just
- some fields.
- * elf64-sparc.c (sparc64_elf_output_arch_syms): Declare used
- variables and initialize them.
-
-1999-08-01 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_final_link): Handle the case where
- there are no global symbols requiring GOT entries.
- (_bfd_mips_elf_size_dynamic_sections): Likewise.
- (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
- (_bfd_mips_elf_finish_dynamic_sections): Likewise.
-
- * elf32-mips.c (mips_elf_calculate_relocation): Undefined weak
- symbols are considered to have the value zero.
- (_bfd_mips_elf_relocate_section): Don't try to perform a
- relocation for an undefined symbol.
- (_bfd_mips_elf_check_relocs): Allocate locate GOT space for local
- GOT16 relocations.
-
-1999-07-30 Jakub Jelinek <jj@ultra.linux.cz>
-
- * elf64-sparc.c (sparc64_elf_build_plt): Cosmetic change - ABI
- wants ba,a,pt %xcc instead of %icc.
- Emit correct .PLT0-(.PLTN+4) initial value into the pointer slots
- of large PLT entries.
- (sparc64_elf_plt_ptr_offset): Fix calculation.
- (sparc64_elf_finish_dynamic_symbol): Negative value of R_SPARC_JMP_SLOT
- addend should be relative to load address, not .plt section start.
- (sparc64_elf_size_info): Sparc64 uses 32bit .hash entries.
-
-1999-07-30 Jakub Jelinek <jj@ultra.linux.cz>
-
- * elf-bfd.h (struct elf_backend_data): Add
- print_symbol_all and output_arch_syms backend methods.
- * elfxx-target.h: Likewise.
- * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create,
- sparc64_elf_add_symbol_hook, sparc64_elf_output_arch_syms,
- sparc64_elf_get_symbol_type, sparc64_elf_symbol_processing): New
- functions.
- (sparc64_elf_size_dynamic_sections): Leave space for STT_REGISTER
- symbols in .dynsym, add their names into .dynstr. Put those symbols
- into dynlocal.
- (sparc64_elf_finish_dynamic_sections): Fix up DT_SPARC_REGISTER
- pointers to STT_REGISTER symbols in dynsym section.
- (sparc64_elf_print_symbol_all): New function.
- * elf.c (bfd_elf_print_symbol): Allow special backend symbol
- printing using the print_symbol_all hook.
-
-1999-07-30 Catherine Moore <clm@cygnus.com>
-
- * elf32-arm.h (elf32_arm_check_relocs): Use r_offset for
- R_ARM_GNU_VTENTRY.
-
-1999-07-29 Richard Henderson <rth@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_final_link): Only re-sort dynsyms if
- dynamic_sections_created.
-
-1999-07-29 Richard Henderson <rth@cygnus.com>
-
- * elf32-mips.c (mips_info_to_howto_rel): Split out switch to ...
- (mips_rtype_to_howto): ... new function.
- (_bfd_mips_elf_relocate_section): Use it.
-
-1999-07-28 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_relocate_section): Fix typo.
-
-1999-07-27 Nick Clifton <nickc@cygnus.com>
-
- Patch generated by Bernd Schmidt. <bernds@cygnus.co.uk>
-
- * coff-arm.c (coff_arm_is_local_label_name): Change to strip
- out only symbols that start with LOCAL_LABEL_PREFIX followed by 'L'.
-
-1999-07-23 Donn Terry <donn@interix.com>
-
- * libcoff-in.h (coff_link_hash_entry): Add coff_link_hash_flags
- field, and define COFF_LINK_HASH_PE_SECTION_SYMBOL.
- * cofflink.c (coff_link_add_symbols): If PE, handle section
- symbols specially.
- * libcoff.h: Rebuild.
-
- * config.bfd (i[3456]86-*-interix*): New target.
-
-1999-07-21 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coffcode.h (styp_to_sec_flags): If COFF_LONG_SECTION_NAMES and
- COFF_SUPPORT_GNU_LINKONCE, mark sections whose names begin with
- .gnu.linkonce with SEC_LINKONCE and SEC_LINK_DUPLICATES_DISCARD.
- * coff-go32.c: (COFF_LONG_SECTION_NAMES): Define.
- (COFF_SUPPORT_GNU_LINKONCE): Define.
- * coff-stgo32.c: (COFF_LONG_SECTION_NAMES): Define.
- (COFF_SUPPORT_GNU_LINKONCE): Define.
-
-1999-07-21 Ian Lance Taylor <ian@zembu.com>
-
- From Mark Elbrecht:
- * makefile.dos: Remove; obsolete.
- * configure.bat: Remove; obsolete.
-
-1999-07-21 H.J. Lu <hjl@gnu.org>
-
- * config.bfd (i[3456]86-*-vxworks*): Add targ_underscore=yes.
-
-1999-07-21 Philippe De Muyter <phdm@macqel.be>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Issue an error
- message and fail if a symbol index is out of range.
-
-1999-07-21 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Get the GP value
- when looking at a R_MIPS_GOT16 relocation.
-
-1999-07-20 Nick Clifton <nickc@cygnus.com>
-
- * coff-m88k.c: Use CREATE_BIG_COFF_TARGET_VEC.
-
-Mon Jul 19 14:03:44 1999 Mark P. Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_final_link): Restore setting of GP
- removed in previous change.
- (_bfd_mips_elf_relocate_section): Adjust GP relative relocations
- in relocateable output.
-
-1999-07-19 Ian Lance Taylor <ian@zembu.com>
-
- * coff-m88k.c (m88kbcs_vec): Initialize new field of bfd_target
- structure.
-
- * elflink.h (elf_merge_symbol): Do merge symbols from the same BFD
- if they appear to be specially created by the linker.
-
-1999-07-19 Nick Clifton <nickc@cygnus.com>
-
- * targets.c (alternative_target): New field in bfd_target
- structure.
- (bfd_search_for_target): New function: Find a target that
- satisifies a search function.
- * bfd-in2.h: Regenerate.
-
- * elfxx-target.h: Initialise the alternative_target field of
- the bfd_target structures to point to the other target (if
- defined).
- * nlm-target.h: Initialise the alternative_target field of
- the bfd_target structures to point to the other target (if
- defined).
-
- * coffcode.h (CREATE_BIG_COFF_TARGET_VEC): New macro.
- (CREATE_LITTLE_COFF_TARGET_VEC): New macro.
-
- * aix386-core.c: Initialise new field of bfd_target structure.
- * aout-adobe.c: Initialise new field of bfd_target structure.
- * aout-arm.c: Initialise new field of bfd_target structure.
- * aout-target.h: Initialise new field of bfd_target structure.
- * aout-tic30.c: Initialise new field of bfd_target structure.
- * binary.c: Initialise new field of bfd_target structure.
- * bout.c: Initialise new field of bfd_target structure.
- * cisco-core.c: Initialise new field of bfd_target structure.
- * coff-a29k.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * coff-alpha.c: Initialise new field of bfd_target structure.
- * coff-apollo.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * coff-arm.c: Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
- * coff-h8300.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * coff-h8500.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * coff-i386.c: Initialise new field of bfd_target structure.
- * coff-i860.c: Initialise new field of bfd_target structure.
- * coff-i960.c: Use CREATE_LITTLE_COFF_TARGET_VEC.
- * coff-m68k.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * coff-mcore.c: Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
- * coff-mips.c: Initialise new field of bfd_target structure.
- * coff-ppc.c: Initialise new field of bfd_target structure.
- * coff-rs6000.c: Initialise new field of bfd_target structure.
- * coff-sh.c: Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
- * coff-sparc.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * coff-tic30.c: Initialise new field of bfd_target structure.
- * coff-tic80.c: Use CREATE_LITTLE_COFF_TARGET_VEC.
- * coff-w65.c: Use CREATE_LITTLE_COFF_TARGET_VEC.
- * coff-we32k.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * coff-z8k.c: Use CREATE_BIG_COFF_TARGET_VEC.
- * hppabsd-core.c: Initialise new field of bfd_target structure.
- * hpux-core.c: Initialise new field of bfd_target structure.
- * i386msdos.c: Initialise new field of bfd_target structure.
- * i386os9k.c: Initialise new field of bfd_target structure.
- * ieee.c: Initialise new field of bfd_target structure.
- * ihex.c: Initialise new field of bfd_target structure.
- * irix-core.c: Initialise new field of bfd_target structure.
- * mipsbsd.c: Initialise new field of bfd_target structure.
- * netbsd-core.c: Initialise new field of bfd_target structure.
- * oasys.c: Initialise new field of bfd_target structure.
- * osf-core.c: Initialise new field of bfd_target structure.
- * ppcboot.c: Initialise new field of bfd_target structure.
- * ptrace-core.c: Initialise new field of bfd_target structure.
- * sco5-core.c: Initialise new field of bfd_target structure.
- * som.c: Initialise new field of bfd_target structure.
- * srec.c: Initialise new field of bfd_target structure.
- * tekhex.c: Initialise new field of bfd_target structure.
- * trad-core.c: Initialise new field of bfd_target structure.
- * versados.c: Initialise new field of bfd_target structure.
- * vms.c: Initialise new field of bfd_target structure.
-
-1999-07-19 Andreas Schwab <schwab@suse.de>
-
- * elflink.h (elf_bfd_final_link): Remove unused variables rel_hash
- and rel_hdr.
-
-Sat Jul 17 02:28:28 1999 Mark P. Mitchell <mark@codesourcery.com>
-
- * elflink.h (elf_link_adjust_relocs): New function.
- (elf_bfd_final_link): Use it.
- (elf_link_input_bfd): Deal with the fact that there can be
- two relocation sections for a single section.
- (elf_reloc_link_order): Likewise.
-
- * elf32-mips.c (_bfd_mips_elf_final_link): Don't set GP for
- a relocateable object.
- (_bfd_mips_elf_relocate_section): Handle relocateable links.
-
-1999-07-16 Jakub Jelinek <jj@ultra.linux.cz>
-
- * elf64-sparc.c (sparc64_elf_info_to_howto): Use ELF64_R_TYPE_ID.
- (sparc64_elf_get_reloc_upper_bound,
- sparc64_elf_get_dynamic_reloc_upper_bound,
- sparc64_elf_slurp_one_reloc_table, sparc64_elf_slurp_reloc_table,
- sparc64_elf_canonicalize_dynamic_reloc, sparc64_elf_write_relocs):
- New functions.
- (sparc64_elf_check_relocs, sparc64_elf_relocate_section): Use
- ELF64_R_TYPE_ID/DATA where appropriate.
-
-1999-07-16 Jakub Jelinek <jj@ultra.linux.cz>
-
- * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Remove
- DT_SPARC_PLTFMT.
-
-1999-07-16 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-mips.c (mips_elf_local_relocation_p): New static
- function.
- (mips_elf_next_lo16_addend): Call bfd_set_error on failure.
- (mips_elf_calculate_relocation): Use mips_elf_local_relocation_p.
- Always set *require_jalxp.
- (mips_elf_stub_section_p): Mark abfd parameter as unused.
- (_bfd_mips_elf_relocate_section): Only look for LO16 following
- GOT16 if the GOT16 is against a local symbol. Don't return false
- for an undefined symbol. If there is an overflow, assert that we
- have a name.
-
-1999-07-16 Andreas Schwab <schwab@suse.de>
-
- * elflink.h (elf_link_record_local_dynamic_symbol): Remove unused
- variables `link' and `elfsec'.
- (elf_bfd_final_link): Remove unused variable `os'.
-
-Thu Jul 15 17:55:31 1999 Mark P. Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_modify_segment_map): Don't require
- a PT_PHDR program headers.
- (_bfd_mips_elf_final_link): Don't assume there are going to be
- section symbols when we're not building a shared object.
- (_bfd_mips_elf_check_relocs): Make sure we have a GOT when
- we need one.
-
-1999-07-15 J.T. Conklin <jtc@redback.com>
-
- * config.bfd (i[3456]86-*-vxworks*): New target.
-
-1999-07-15 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_stub_section_p): New function.
- (mips_elf_calculate_relocation): Handle MIPS16 stub functions.
- (mips_elf_relocate_section): Adjust calling sequence for
- mips_elf_calculate_relocation and mips_elf_perform_relocation.
- (mips_elf_perform_relocation): Turn `jal' into `jalx' where
- required.
-
-1999-07-15 Ian Lance Taylor <ian@zembu.com>
-
- * configure.in: Bump version number to 2.9.5.
- * configure: Rebuild.
-
-Thu Jul 15 02:56:15 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type, case R_HPPA): Handle
- 64bit format.
- (_bfd_elf_hppa_gen_reloc_type, case R_GOTOFF): Use base reloc type
- to derive final type instead of hardwiring a selection.
-
-1999-07-14 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_obtain_contents): Swap 16-bit halves of
- things relocated by R_MIPS16_GPREL.
- (mips_elf_perform_relocation): Likewise.
-
-Wed Jul 14 15:23:19 1999 Jim Wilson <wilson@cygnus.com>
-
- * elfxx-target.h (elfNN_bed): Add elf_backend_want_dynbss.
-
-1999-07-14 Richard Henderson <rth@cygnus.com>
-
- * elf32-mips.c (struct mips_got_info): Add global_gotno.
- (_bfd_mips_elf_size_dynamic_sections): Set it.
- (_bfd_mips_elf_final_link): Re-sort; verify the got did not grow.
- (mips_elf_sort_hash_table): Set max_non_got_dynindex based off
- new argument max_local.
-
-1999-07-14 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_obtain_contents): Swap the 16-bit
- subwords when handling an R_MIPS16_26 relocation.
- (mips_elf_perform_relocation): Don't be paranoid abour right-shift
- semantics.
-
- * elf32-mips.c (elf_mips16_gprel_howto): Adjust src_mask and
- dst_mask to match reality.
- (_bfd_mips_elf_calculate_relocation): Handle R_MIPS16_GPREL.
- (mips_elf_obtain_contents): Use bfd_get.
- (mips_elf_perform_relocation): Handle R_MIPS16_GPREL.
- (mips_elf_relocate_section): Likewise.
-
-1999-07-13 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Handle R_MIPS16_26.
- (mips_elf_relocate_section): Adjust calling sequence for
- mips_elf_perform_relocation.
- (mips_elf_perform_relocation): Take additional argument. Handle
- R_MIPS16_26. Use bfd_put for convenience.
-
-1999-07-13 Richard Henderson <rth@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): Thinko last change.
- Always overwrite p_flags.
-
-1999-07-13 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_backend_data): Add want_dynbss.
- * elflink.c (_bfd_elf_create_dynamic_sections): Only create
- .dynbss and .rel[a].bss if want_dynbss.
- * elfxx-target.h (elf_backend_want_dynbss): Provide default.
-
-1999-07-13 Richard Henderson <rth@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): Don't overwrite p_flags.
-
-1999-07-13 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_link_local_dynamic_entry): New.
- (struct elf_link_hash_table): Add dynlocal.
- (_bfd_elf_link_lookup_local_dynindx): Prototype.
- (_bfd_elf_link_adjust_dynindx): Delete.
- (_bfd_elf_link_renumber_dynsyms): Prototype.
- (_bfd_elf,link_record_local_dynamic_symbol): Prototype.
- * elfcode.h (elf_link_record_local_dynamic_symbol): New alias.
- * elflink.c (_bfd_elf_link_adjust_dynindx): Delete.
- (_bfd_elf_link_lookup_local_dynindx): New function.
- (elf_link_renumber_hash_table_dynsyms): New function.
- (_bfd_elf_link_renumber_dynsyms): New function.
- * elflink.h (elf_link_record_local_dynamic_symbol): New function.
- (struct elf_assign_sym_version_info): Delete removed_dynamic.
- (bfd_elf,size_dynamic_sections): Use _bfd_strip_section_from_output
- instead of elf_link_remove_section_and_adjust_dynindices.
- Remove removed_dynamic code. Use _bfd_elf_link_renumber_dynsyms.
- (elf_link_assign_sym_version): Remove removed_dynamic code.
- (elf_link_renumber_dynsyms): Delete.
- (elf_bfd_final_link): Install section and local symbols into .dynsym.
-
- * elf32-m68k.c (elf_m68k_adjust_dynindx): Delete.
- (elf_m68k_size_dynamic_sections): Don't set section dynindicies.
- (elf_m68k_finish_dynamic_sections): Don't write section dynsyms.
- * elf32-mips.c: Similarly.
- * elf32-ppc.c: Similarly.
- * elf32-sparc.c: Similarly.
- * elf64-alpha.c: Similarly.
- * elf64-sparc.c: Similarly.
-
-1999-07-13 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Do not complain
- when _gp_disp is undefined. Do not check R_MIPS_LO16 for overflow
- when the relocation is against _gp_disp.
-
-1999-07-12 Mark Mitchell <mark@codesourcery.com>
-
- * dwarf2.c (read_attribute): Support DW_FORM_ref8.
- * elf32-mips.c (mips_elf_link_hash_entry): Change mips_32_relocs
- to possibly_dynamic_relocs. Adjust usage throughout code.
- (elf_mips_howto_table): Handle R_MIPS_64 correctly.
- (elf_mips_ctor64_howto): Likewise.
- (mips_elf_calculate_relocation): Handle R_MIPS_64 like R_MIPS_32.
- Adjust indentation.
- (mips_elf_relocate_section): Handle R_MIPS_64 in 32-bit mode.
- (_bfd_mips_elf_check_relocs): Handle R_MIPS_64 like R_MIPS_32.
- Use MIPS_ELF_GOT_SIZE to calculate the size of GOT entries.
- * elf64-mips.c (elf_backend_may_use_rel_p): Define.
-
-1999-07-12 Ian Lance Taylor <ian@zembu.com>
-
- * Makefile.am: Rebuild dependencies.
- * Makefile.in: Rebuild.
-
- * bfd-in.h: Remove tests of COFF_IMAGE_WITH_PE.
- * bfd-in2.h: Rebuild.
-
- * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
- as appropriate. Use EMPTY_HOWTO as appropriate. Fill in
- structure initializations. Add casts.
- * reloc.c (EMPTY_HOWTO): Define.
- * bfd-in2.h: Rebuild.
- * coff-h8300.c (h8300_reloc16_extra_cases): Remove useless
- comparisons against 0.
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Change
- previous_ibfd_e_flags to unsigned long.
- * vms.h (struct vms_private_data_struct): Change section_count to
- unsigned.
- * vms-gsd.c (_bfd_vms_slurp_gsd): Change psect_idx to unsigned.
- (_bfd_vms_write_gsd): Change symnum to unsigned.
- * vms-hdr.c (_bfd_vms_write_hdr): Change symnum to unsigned.
- * vms-tir.c (etir_sta): Change psect to unsigned.
- (alloc_section): Change idx to unsigned.
- (tir_sta, tir_ctl): Change psect to unsigned.
- (_bfd_vms_write_tir): Change len and before to bfd_size_type.
- * vms.c (priv_section_count): Change to unsigned.
-
-1999-07-12 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c: Add some ATTRIBUTE_UNUSED.
- * m68klinux.c: Likewise.
-
-1999-07-12 Ian Lance Taylor <ian@zembu.com>
-
- * Many files: Changes to avoid gcc warnings: Remove unused local
- variables. Add default case to enum switches.
- * coff-arm.c (bfd_arm_allocate_interworking_sections): Only
- compile if not COFF_IMAGE_WITH_PE.
- (record_arm_to_thumb_glue, record_thumb_to_arm_glue): Likewise.
- (bfd_arm_get_bfd_for_interworking): Likewise.
- (bfd_arm_process_before_allocation): Likewise.
- * epoc-pei-arm.c: Don't rename bfd_arm functions.
- * pei-arm.c: Likewise.
- * elf32-mips.c (mips_elf_link_hash_table_create): Don't declare.
- (MIPS_ELF_ADD_DYNAMIC_ENTRY): Correct last change.
- (mips_elf_got16_entry): Put parens around & in body of ==.
- (mips_elf_calculate_relocation): Correct test for empty string.
- * vms-gsd.c: Use _bfd_error_handler rather than fprintf to
- stderr.
- * vms-misc.c (_bfd_vms_length_hash_symbol): Correct sprintf
- format.
-
-1999-07-11 Ian Lance Taylor <ian@zembu.com>
-
- * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
- as appropriate. Fill in structure initializations. Add variable
- initializations. Add casts.
- * dwarf1.c (parse_line_table): Change eachLine to unsigned long.
- (dwarf1_unit_find_nearest_line): Change i to unsigned long.
-
- * elf.c (bfd_elf_hash): Change parameter from unsigned char * to
- char *.
- * elf-bfd.h (bfd_elf_hash): Update declaration.
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Remove casts
- when calling bfd_elf_hash.
-
-1999-07-11 Mark Mitchell <mark@codesourcery.com>
-
- * libbfd.c (bfd_put_8): Make it of type `void'.
- * bfd-in2.h: Regenerated.
- * elf32-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Conditionalize
- for 32-bit hosts.
- (_bfd_mips_elf_final_link): Likewise.
-
- * elflink.h (elf_link_read_relocs_from_section): Be type-correct.
-
-Thu Jul 8 12:32:23 1999 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * config.bfd (hppa*-*-linux-gnu*): New target
-
-1999-07-07 Mark Mitchell <mark@codesourcery.com>
-
- * elf-bfd.h (_bfd_mips_elf_section_from_shdr): Constify.
- (_bfd_mips_elf_create_dynamic_sections): New function.
- (_bfd_mips_elf_add_symbol_hook): Likewise.
- (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
- (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
- (_bfd_mips_elf_finish_dynamic_sections): Likewise.
- (_bfd_mips_elf_gc_mark_hook): Likewise.
- (_bfd_mips_elf_gc_sweep_hook): Likewise.
- (_bfd_mips_elf_always_size_sections): Likewise.
- (_bfd_mips_elf_size_dynamic_sections): Likewise.
- (_bfd_mips_elf_check_relocs): Likewise.
- (_bfd_mips_elf_link_hash_table_create): Likewise.
- (_bfd_mips_elf_print_private_data): Likewise.
- (_bfd_mips_elf_link_output_symbol_hook): Likewise.
- (_bfd_mips_elf_final_link): Likewise.
- (_bfd_mips_elf_additional_program_headers): Likewise.
- (_bfd_mips_elf_modify_segment_map): Likewise.
- (_bfd_mips_elf_relocate_section): Likewise.
- * elf32-mips.c (mips_elf32_object_p): Move contents into
- _bfd_mips_elf_object_p.
- (mips_elf_additional_program_headers): Rename to
- _bfd_mips_elf_additional_program_headers.
- (mips_elf_modify_segment_map): Rename to
- _bfd_mips_elf_modify_segment_map.
- (elf_mips_abi_name): Change prototype.
- (mips_elf32_section_from_shdr): Merge into
- _bfd_mips_elf_section_from_shdr.
- (mips_elf32_section_processing): Merge into
- _bfd_mips_elf_section_processing.
- (mips_elf_final_link): Rename to _bfd_mips_elf_final_link. Invoke
- the right back-end ELF linker.
- (mips_elf_relocate_section): Rename to
- _bfd_mips_elf_relocate_section. Clean up. Adjust for 64-bit code.
- (mips_elf_link_output_symbol_hook): Rename to
- _bfd_mips_elf_link_output_symbol_hook.
- (mips_elf_create_dynamic_section): Rename to
- _bfd_mips_elf_create_dynamic_section.
- (mips_elf_check_relocs): Rename to _bfd_mips_elf_check_relocs.
- Adjust for 64-bit code. Use mips_elf_got_section.
- (mips_elf_adjust_dynamic_symbol): Rename to
- _bfd_mips_elf_adjust_dynamic_symbol. Use
- mips_elf_allocate_dynamic_relocations.
- (mips_elf_finish_dynamic_symbol): Rename to
- _bfd_mips_elf_finish_dynamic_symbol. Use mips_elf_got_section.
- Adjust for 64-bit code.
- (mips_elf_finish_dynamic_sections): Rename to
- _bfd_mips_elf_finish_dynamic_sections. Adjust for 64-bit code.
- (mips_elf_always_size_sections): Rename to
- _bfd_mips_elf_always_size_sections.
- (mips_elf_add_symbol_hook): Rename to
- _bfd_mips_elf_add_symbol_hook.
- (mips_elf_next_lo16_addend): Constify.
- (mips_elf_calculate_relocation): Likewise.
- (mips_elf_obtain_contents): Likewise.
- (mips_elf_perform_relocation): Likewise.
- (mips_elf_create_dynamic_relocation): Likewise.
- (mips_elf_allocate_dynamic_relocations): New function.
- (MIPS_ELF_REL_DYN_SECTION_NAME): New macro.
- (MIPS_ELF_REL_SIZE): Likewise.
- (MIPS_ELF_DYN_SIZE): Likewise.
- (MIPS_ELF_GOT_SIZE): Likewise.
- (MIPS_ELF_SYM_SIZE): Likewise.
- (MIPS_ELF_LOG_FILE_ALIGN): Likewise.
- (MIPS_ELF_GET_WORD): Likewise.
- (MIPS_ELF_PUT_WORD): Likewise.
- (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise.
- (STUB_LW): Conditionalize for 64-bit value.
- (elf_mips_howto_table): Add R_MIPS_HIGHER and R_MIPS_HIGHEST
- entries.
- (_bfd_mips_elf_merge_private_bfd_data): Merge e_ident[EI_CLASS].
- Check it for inconsistency.
- (_bfd_mips_elf_print_private_bfd_data): Print ABI=64 for 64-bit
- ABI.
- (_bfd_mips_elf_fake_sections): Remove duplicate handling of
- .msym.
- (mips_elf_global_got_index): Use MIPS_ELF_GOT_SIZE.
- (mips_elf_got_offset_from_index): Use misp_elf_got_section.
- (mips_elf_create_local_got_entry): Use MIPS_ELF_GOT_SIZE.
- (mips_elf_local_got_index): Likewise.
- (mips_elf_got_page): Likewise.
- (mips_elf_got_info): Likewise.
- (mips_elf_create_dynamic_relocation): Handle 32-bit/64-bit split.
- (ELF_DYNAMIC_INTERPRETER): Handle 64-bit code.
- (mips_elf_create_dynamic_sections): Use MIPS_ELF_LOG_FILE_ALIGN,
- instead of constant `2'.
- (mips_elf_create_got_section): Tidy. Use MIPS_ELF_GOT_SIZE.
- (mips_elf_create_msym_section): Use MIPS_ELF_LOG_FILE_ALIGN.
- (mips_elf_size_dynamic_sections): Use
- MIPS_ELF_REL_DYN_SECTION_NAME, MIPS_ELF_GOT_SIZE,
- MIPS_ELF_ADD_DYNAMIC_ENTRY. Remove #if 0'd code.
- Adjust all releveant entries in elf backend table.
- * elf64-mips.c (mips_elf64_section_from_shdr): Remove.
- (mips_elf64_section_processing): Likewise.
- Adjust elf backend entries to use _bfd_mips_elf variants now
- publicly available.
-
- * elflink.h (elf_link_create_dynamic_sections): Handle non-standard
- hash-entry sizes.
- (size_dynamic_sections): Likewise.
- (elf_link_output_extsym): Likewise.
- * elf.c: (elf_fake_sections): Likewise.
- * libbfd.c (bfd_get): New macro.
- (bfd_put): Likewise.
- * bfd-in2.h: Regenerated.
-
-1999-07-07 Mark Mitchell <mark@codesourcery.com>
-
- * elf-bfd.h (elf_size_info): Add hash_entry_size,
- int_rels_per_ext_rel, swap_dyn_out, swap_reloc_in, swap_reloc_out,
- wap_reloca_in, and swap_reloca_out.
- * elflink.h (elf_link_read_relocs_from_section): Adjust to handle
- multiple internal relocations per external relocation.
- (link_read_relocs): Likewise.
- (elf_bfd_final_link): Likewise.
- (elf_link_input_bfd): Likewise.
- (elf_gc_mark): Likewise.
- (elf_gc_smash_unused_vtentry_relocs): Likewise.
- * elfcode.h (elf_swap_dyn_out): Adjust type to match
- elf_swap_dyn_in.
- (size_info): Add entries for new fields.
- * elf64-mips.c (mips_elf64_swap_reloc_out): Enable.
- (mips_elf64_be_swap_reloc_in): New function.
- (mips_elf64_be_swap_reloc_out): Likewise.
- (mips_elf64_be_swap_reloca_in): Likewise.
- (mips_elf64_be_swap_reloca_out): Likewise.
- (mips_elf64_size_info): Add entries for new fields.
-
-1999-07-07 Ian Lance Taylor <ian@zembu.com>
-
- * elflink.h (elf_bfd_final_link): Assert that section reloc_count
- field equals the new rel_count field.
- (elf_link_input_bfd): When doing a relocateable link, use the new
- rel_count field rather than the reloc_count field.
- (elf_reloc_link_order): Likewise.
- (elf_finish_pointer_linker_section): Likewise.
-
- Based on patch from H.J. Lu <hjl@gnu.org>:
- * elflink.h (elf_merge_symbol): Permit a non-weak definition in a
- shared library to override a weak definition in a regular object.
-
-Tue Jul 6 10:23:39 1999 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h: Revert July 2, 1999 patch.
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): T mode selectors
- need to generate DLTIND relocations, not DLTREL relocations.
-
-1999-07-05 Nick Clifton <nickc@cygnus.com>
-
- * coffcode.h (coff_set_arch_mach_hook): Recognise arm 5
- architectures.
- (coff_set_flags): Recognise arm 5 architectures.
-
- * cpu-arm.c: Add support for strongarm and arm9 cpus.
- Add support for armv5 architecture.
-
- * archures.c: Add bfd_mach_arm_5 and bfd_mach_arm_5T.
-
- * reloc.c: Add new, assembler only, ARM reloc:
- BFD_RELOC_ARM_ADRL_IMMEDIATE.
-
- * bfd-in2.h: Regenerate.
-
-1999-07-02 Mark Mitchell <mark@codesourcery.com>
-
- * dwarf2.c (parse_comp_unit): Add ABBREV_LENGTH parameter.
- (_bfd_dwarf2_find_nearest_line): Add ADDR_SIZE parameter.
- * elf.c (_bfd_elf_find_nearest_line): Pass it.
- * elf32-arm.h (elf32_arm_find_nearest_line): Likewise.
- * elf32-mips.c (ABI_64_P): New macro.
- (IRIX_COMPAT): We are IRIX6-compatible if ABI_64_P.
- (_bfd_mips_elf_find_nearest_line): Adjust call to
- _bfd_dwarf2_find_nearest_line.
- * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
- * libbfd.h: Regenerated.
-
-1999-07-02 Ian Lance Taylor <ian@zembu.com>
-
- * config.bfd: Add * at the end of i[3456]86-*-unixware.
-
-Fri Jul 2 12:21:10 1999 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h (HPPA_R_ARG_RELOC): Delete.
- (HPPA_R_CONSTANT, HPPA_R_ADDEND): Likewise.
-
-1999-07-01 Mark Mitchell <mark@codesourcery.com>
-
- * elf-bfd.h (bfd_elf_section_data): Add rel_count and rel_count2
- fields.
- (_bfd_elf_init_reloc_shdr): New function.
- * elf.c (_bfd_elf_new_section_hook): Use bfd_zalloc, rather than
- bfd_alloc followed by memset.
- (_bfd_elf_init_reloc_shdr): New function, split out from ...
- (elf_fake_sections): Here.
- (assign_section_numbers): Assign section numbers for the second
- relocation section, if required.
- * elflink.h (elf_link_output_relocs): New function.
- (elf_link_size_reloc_section): Likewise.
- (elf_bfd_final_link): Use elf_link_size_reloc_section.
- (elf_link_input_bfd): Use elf_link_output_relocs.
-
- * elf32-mips.c (_bfd_mips_elf_fake_sections): Use
- _bfd_elf_init_reloc_shdr to initialize rel_hdr2.
-
-Thu Jul 1 13:58:48 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle R_PCREL_CALL
- with 22bit format.
-
-1999-06-28 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_got_info): Move declaration before
- prototypes. Change global_gotsym to be a pointer to a hash entry,
- rather than a number index.
- (mips_elf_link_hash_entry): Move declaration before prototypes.
- (mips_elf_irix6_finish_dynamic_symbol): New function.
- (mips_elf_sign_extend): Likewise.
- (mips_elf_high): Likewise.
- (mips_elf_higher): Likewise.
- (mips_elf_highest): Likewise.
- (mips_elf_global_got_index): Likewise.
- (mips_elf_local_got_index): Likewise.
- (mips_elf_got_offset_from_index): Likeiwse.
- (mips_elf_record_global_got_symbol): Likewise.
- (mips_elf_got_page): Likewise.
- (mips_elf_next_lo16_addend): Likewise.
- (mips_elf_calculate_relocation): Likewise.
- (mips_elf_obtain_contents): Likewise.
- (mips_elf_perform_relocation): Likewise.
- (mips_elf_assign_gp): Likewise.
- (mips_elf_sort_hash_table_f): Likewise.
- (mips_elf_sort_hash_table): Likewise.
- (mips_elf_got_section): Likewise.
- (mips_elf_got_info): Likewise.
- (mips_elf_create_local_got_entry): Likewise.
- (mips_elf_got16_entry): Likewise.
- (mips_elf_create_dynamic_relocation): Likewise.
- (elf_mips_howto_table): Add description of R_MIPS_SCN_DISP.
- (mips_elf_final_gp): Use mips_elf_assign_gp.
- (_bfd_mips_elf_symbol_processing): Don't move SHN_COMMON symbols
- into SHN_SCOMMON automatically on IRIX6.
- (mips_elf_add_symbol_hook): Likewise.
- (mips_elf_relocate_section): Rewrite, using
- mips_elf_calculate_relocation and mips_elf_perform_relocation.
- (mips_elf_create_dynamic_section): Use MIPS_ELF_STUB_SECTION_NAME.
- Don't deal with .rld_map on IRIX6.
- (mips_elf_create_got_section): Adjust use of global_gotsym. Set
- section flags appropriately for .got.
- (mips_elf_check_relocs): Handle IRIX6 relocations making use of
- the got. Call mips_elf_record_global_got_symbol and allocate
- local got space appropriately.
- (mips_elf_size_dynamic_sections): Use bfd_byte *, not unsigned
- char *. Rework calculation of GOT size. Sort dynamic symbol
- table entries so entries that do not require GOT entries appear at
- the beginning. Don't use DT_MIPS_HIPAGENO on IRIX6. Remove dead
- code dealing with DT_INIT and DT_FINI. Remove fiddling with
- global_gotsym.
- (mips_elf_finish_dynamic_symbol): Adjust creation of global GOT
- entries.
- (mips_elf_finish_dynamic_symbol): Use
- mips_elf_irix6_finish_dynamic_symbol.
- (mips_elf_finish_dynamic_sections): Correct off-by-one error
- setting DT_MIPS_UNREFEXTNO. Adjust setting of DT_MIPS_GOTSYM for
- change to global_gotsym. Set DT_MIPS_OPTIONS on IRIX6.
-
-1999-06-30 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-mips.c (mips_elf_final_link): Don't set CPIC when doing a
- relocateable link. From Ralf Baechle <ralf@uni-koblenz.de>.
-
-1999-06-04 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf_backend_got_header_size): Define.
- (elf_backend_plt_header_size): Likewise.
-
-1999-06-28 Jim Pick <jim@jimpick.com>
-
- * elf32-arm.h (elf32_arm_relocate_section): Mind no_undefined
-
-Tue Jun 29 02:25:03 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.c (elf_hppa_howto_table): Use bfd_elf_generic_reloc as
- relocation function.
- * elf32-hppa.c (hppa_elf_reloc): Kill unused/unwanted function.
-
-1999-06-27 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (MIPS_ELF_SRDATA_SECTION_NAME): New macro.
- (MIPS_ELF_OPTIONS_SECTION_NAME): Likewise.
- (MIPS_ELF_STUB_SECTION_NAME): Likewise.
- (_bfd_mips_elf_section_from_shdr): Use them.
- (_bfd_mips_elf_fake_sections): Likewise. Add .srdata to the list
- of GP-relative sections.
- (_bfd_mips_elf_set_section_contents): Use them.
- (_bfd_mips_elf_section_processing): Share code between .sdata and
- .lit4/.lit8 sections. Set appropriate flags for .srdata.
- (mips_elf_additional_program_headers): Add handling for
- PT_MIPS_OPTIONS segment on IRIX6.
- (mips_elf_modify_segment_map): Likeiwse.
- (mips_elf_final_link): Set EF_MIPS_CPIC when required by the ABI.
- Include the options sections on IRIX6. Don't look for GP-relative
- sections by name; use SHF_MIPS_GPREL instead.
- (ELF_DYNAMIC_INTERPRETER): Adjust to use /usr/lib32/libc.so.1 for
- the N32 ABI.
- (mips_elf_create_dynamic_sections): Don't muck about with section
- alignments and such on IRIX6.
- (mips_elf_adjust_dynamic_symbol): Use MIPS_ELF_STUB_SECTION_NAME.
- (mips_elf_size_dynamic_sections): Likewise. Adjust to handle the
- fact that ELF_DYNAMIC_INTERPRETER is no longer a constant. Use
- bfd_zalloc rather than bfd_alloc and memset.
- (mips_elf_finish_dynamic_symbol): Use MIPS_ELF_STUB_SECTION_NAME.
- Don't assert the existence of .rld_map on IRIX6.
- (mips_elf_finish_dynamic_sections): Use MIPS_ELF_STUB_SECTION_NAME.
-
- * elf32-mips.c (mips_elf_adjust_dynindx): Remove.
- (mips_elf_size_dynamic_sections): Use _bfd_elf_link_adjust_dynindx
- instead.
-
-1999-06-26 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (mips_elf_swap_msym_in): New function.
- (mips_elf_swap_msym_out): New function.
- (mips_elf_create_msym_section): Likewise.
- (MIPS_ELF_MSYM_SECTION_NAME): New macro.
- (_bfd_mips_elf_final_write_processing): Set sh_link for .msym.
- (_bfd_mips_elf_section_from_shdr): Reject an SHT_MIPS_MSYM
- section not named .msym.
- (_bfd_mips_elf_fake_sections): Use MIPS_ELF_MSYM_SECTION_NAME, not
- .msym directly. Set appropriate attributes for the .msym
- section.
- (mips_elf_link_hash_entry): Add min_dyn_reloc_index field.
- (mips_elf_link_hash_newfunc): Clear it.
- (mips_elf_create_dynamic_sections): Create the .msym section
- on IRIX6.
- (mips_elf_size_dynamic_sections): Allocate space for the
- .msym section. Add a DT_MIPS_MSYM entry.
- (mips_elf_finish_dynamic_symbol): Write out a .msym entry for
- the symbol.
- (mips_elf_finish_dynamic_sections): Assign a value for
- DT_MIPS_MSYM. Add .msym entries for the section symbols as well.
-
- * elf32-mips.c (irix_compat_t): New enumeration.
- (ABI_N32_P): New macro.
- (IRIX_COMPAT): Likewise.
- (SGI_COMPAT): Implement in terms of IRIX_COMPAT.
- (mips_elf_relocate_section): Fix typo.
-
-1999-06-26 Mumit Khan <khan@xraylith.wisc.edu>
-
- * peicode.h (coff_swap_scnhdr_out): Mark non readonly BFD sections
- as writable PE sections.
-
-1999-06-26 David Mosberger <davidm@hpl.hp.com>
-
- * dwarf2.c (struct arange): New type.
- (struct comp_unit): Replace LOW and HIGH by member ARANGE.
- (arange_add): New function.
- (decode_line_info): Keep track of address ranges that a compilation
- unit covers.
- (comp_unit_contains_address): Return true if address is contained
- in _any_ of the address ranges associated with a compilation unit.
- (_bfd_dwarf2_find_nearest_line): Call comp_unit_find_nearest_line
- on the first comp_unit that contains the address.
-
-1999-06-26 David Mosberger <davidm@hpl.hp.com>
-
- * dwarf2.c (struct dwarf2_debug): Add member dwarf_line_buffer.
- (decode_line_info): Add variable STASH and initialize it to point
- to the per-bfd dwarf2_debug info. Remove static variable
- dwarf_line_buffer and use stash->dwarf_line_buffer in its place.
-
-1999-06-26 Ian Lance Taylor <ian@zembu.com>
-
- * elflink.h (elf_link_output_extsym): It's OK for a -Bsymbolic
- shared library to have an undefined symbol.
-
- From Franz Sirl <Franz.Sirl-kernel@lauterbach.com>:
- * elf32-ppc.c (ppc_elf_relocate_section): Fix last patch.
-
-Thu Jun 24 20:59:11 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.c (elf_hppa_final_write_processing): New function.
- * elf32-hppa.c: Remove everything related to symbol extension
- sections & records. Use the common elf_hppa_final_write_processing.
-
-1999-06-22 Mark Mitchell <mark@codesourcery.com>
-
- * elflink.h (size_dynamic_sections): Use user-specified init/fini
- functions instead of _init/_fini if requested.
-
-1999-06-23 Ian Lance Taylor <ian@zembu.com>
-
- * elf.c (bfd_section_from_shdr): Avoid crashing on a bogus sh_link
- field.
-
-1999-06-22 Ian Lance Taylor <ian@zembu.com>
-
- From Franz Sirl <Franz.Sirl-kernel@lauterbach.com>:
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Set unused dynindx
- field to 0, not -1.
- (ppc_elf_finish_dynamic_sections): Check for positive section
- dynindx field, rather than comparing against -1.
- (ppc_elf_relocate_section): Only return false if undefined_symbol
- or reloc_overflow fail, not always upon encountering an error.
-
-1999-06-22 Mark Mitchell <mark@codesourcery.com>
-
- * elflink.h (link_read_relocs): Explicitly cast external_relocs to
- bfd_byte * before performing pointer arithmetic.
-
-Tue Jun 22 13:06:25 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf-hppa.h: New file. Common stuff for elf32 and elf64 PA
- support.
- * elf32-hppa.c: Include elf-hppa.h.
- (ARCH_SIZE): Define.
- (elf_hppa_reloc_type_lookup): Delete. Found in the common code
- now.
- (elf32_hppa_info_to_howto): Similarly.
- (elf_hppa_howto_table): Similarly.
- (elf_hppa_reloc_type_lookup): Similarly.
- (hppa_elf_gen_reloc_type): Similarly.
- * elf32-hppa.h (ELF_HOWTO_TALBE, N_PARISC_RELOCS): Delete.
-
-1999-06-22 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_final_link_relocate): Catch overflow
- handling R_V850_22_PCREL relocation.
-
-1999-06-21 Ian Lance Taylor <ian@zembu.com>
-
- * coff-arm.c (arm_emit_base_file_entry): Explicitly declare return
- type.
-
-Sun Jun 20 14:13:57 1999 Richard Henderson <rth@cygnus.com>
-
- * section.c (_bfd_strip_section_from_output): Ignore sections
- DISCARDed by the link script.
-
-1999-06-19 Ian Lance Taylor <ian@zembu.com>
-
- * elflink.h (elf_link_remove_section_and_adjust_dynindices):
- Remove unused local variable spp.
-
- * xcofflink.c (bfd_xcoff_size_dynamic_sections): Don't crash if
- the entry symbol is not set.
-
-Fri Jun 18 04:24:57 1999 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Don't adjust
- GPDISP or LITUSE in a relocatable link.
-
-Thu Jun 17 21:24:43 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * dwarf1.c (alloc_dwarf1_unit): Allocate using bfd_zalloc.
- * (alloc_dwarf1_func): Likewise.
-
-Wed Jun 16 03:09:57 1999 Jeffrey A Law (law@cygnus.com)
-
- * libhppa.h: Fix various formatting errors.
- (assemble_3); Rewrite using CATENATE.
- (assemble_17): Fix various bugs.
-
-1999-06-16 Nick Clifton <nickc@cygnus.com>
-
- * elf32-mcore.c (R_MCORE_RAW): Fix definition.
-
-1999-06-15 Richard Henderson <rth@cygnus.com>
-
- * section.c (SEC_SHORT): Define.
- * bfd-in2.h: Rebuild.
-
-1999-06-13 Mark Mitchell <mark@codesourcery.com>
-
- * elflink.h (elf_link_remove_section_and_adjust_dynindices):
- Remove abfd parameter. Use _bfd_strip_section_from_output.
- (bfd_elf_size_dynamic_sections): Adjust callers accordingly.
-
- * elf-bfd.h (_bfd_elf_link_adjust_dynindx): New function.
- * elflink.c (_bfd_elf_link_adjust_dynindx): Define it.
- * elflink.h (elf_link_remove_section_and_adjust_dynindices): New
- function.
- (bfd_elf_size_dynamic_sections): Use it.
-
-1999-06-13 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * elf32-i386.c (elf_howto_table): Change R_386_PC8 from
- complain_overflow_bitfield to complain_overflow_signed.
-
-1999-06-13 Mark Mitchell <mark@codesourcery.com>
-
- * elflink.h (elf_link_read_relocs_from_section): New function,
- split out from ...
- (elf_link_read_relocs): Here. Use it for both relocation
- sections.
-
-1999-06-12 Mark Mitchell <mark@codesourcery.com>
-
- * elfcode.h (elf_slurp_reloc_table_from_section): Don't assume
- asect->reloc_count is valid.
-
-1999-06-12 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-mips.c (mips_elf32_section_processing): Permit a
- SHT_MIPS_REGINFO section to have a size of 0.
-
-1999-06-12 David O'Brien <obrien@freebsd.org>
-
- * config.bfd (alpha*-*-freebsd*): New target.
- (i[3456]86-*-freebsd*): Now defaults to ELF.
-
-1999-06-11 Ian Lance Taylor <ian@zembu.com>
-
- * reloc.c (_bfd_relocate_contents): Permit bitfield relocations to
- wrap if the relocation covers the high bit of an address.
-
- * dwarf2.c (decode_line_info): Remove unused variable first_time.
-
-1999-06-10 Jakub Jelinek <jj@ultra.linux.cz>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Use R_SPARC_max_std
- instead of R_SPARC_max.
- (sparc64_elf_info_to_howto): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- (elf32_sparc_info_to_howto): Likewise; handle vtable relocations.
-
-1999-06-07 Richard Henderson <rth@cygnus.com>
-
- * section.c (_bfd_strip_section_from_output): Remove output
- sections with no initial link_order.
-
-1999-06-07 Nick Clifton <nickc@cygnus.com>
-
- * elf32-m88k.c (ELF_MAXPAGESIZE): Define.
-
-Mon Jun 7 11:49:43 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * Makefile.am (SOURCE_HFILES): Add missing headers.
- * Makefile.in: Regenerated.
-
-1999-06-06 Mark Mitchell <mark@codesourcery.com>
-
- * elf32-mips.c (_bfd_mips_elf_print_private_data): Recognize
- the N32 ABI.
-
-1999-06-04 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Don't barf on out of
- range undefweak symbols.
- * hash.c: Add missing comma after @xref{}
- * linker.c: Likewise.
-
-1999-06-04 Nick Clifton <nickc@cygnus.com>
-
- * elfxx-target.h (ELF_MAXPAGESIZE): Produce an error message
- if not defined.
- * elf32-gen.c (ELF_MAXPAGESIZE): Define.
- * elf32-i860.c (ELF_MAXPAGESIZE): Define.
- * elf32-i960.c (ELF_MAXPAGESIZE): Define.
- * elf64-gen.c (ELF_MAXPAGESIZE): Define.
-
-1999-06-04 Ian Lance Taylor <ian@zembu.com>
-
- * Makefile.am: Rebuild dependencies.
- (BFD32_BACKENDS): Add dwarf1.lo.
- (BFD32_BACKENDS_CFILES): Add dwarf1.c.
- * Makefile.in: Rebuild.
-
-1999-06-04 Nick Clifton <nickc@cygnus.com>
-
- * Makefile.am: Add epoc-arm-pe target.
- * Makefile.in: Regenerate.
- * pe-arm.c: Only redefine interworking function names if they have
- not already been redefined.
- * pei-arm.c: Only redefine interworking function names if they have
- not already been redefined.
- * epoc-pe-arm.c: Redefine interworking function names to avoid a
- name space clash.
- * epoc-pei-arm.c: Redefine interworking function names to avoid a
- name space clash.
-
-1999-06-03 Nick Clifton <nickc@cygnus.com>
-
- * elfxx-target.h (ELF_MAXPAGESIZE): Default to 0x1000 not 1.
-
-Fri Jun 4 10:05:11 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * elf.c (elf_fake_sections): Undo change of 1999-05-10.
-
-Fri Jun 4 03:10:49 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_relax_delete_bytes): Fix setting of
- start / stop for recalculating of r_addend of R_SH_SWITCH*.
-
-Fri Jun 4 02:53:13 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH32
- in other text sections.
-
-Fri Jun 4 02:29:34 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * libbfd.c (_bfd_generic_verify_endian_match): New function.
- * libbfd-in.h (_bfd_generic_verify_endian_match): Declare.
- * libbfd.h: Regenerate.
- * coff-sh.c (sh_merge_private_data): Delete.
- (coff_bfd_merge_private_bfd_data): Change to
- _bfd_generic_verify_endian_match.
- (elf32-sh.c): bfd_elf32_bfd_merge_private_bfd_data: Define.
-
-1999-06-03 Ulrich Drepper <drepper@cygnus.com>
-
- * elf32-arm.h: Fix typo: change ELF_MAXPAGE_SIZE to ELF_MAXPAGESIZE.
-
-1999-06-03 Ian Lance Taylor <ian@zembu.com>
-
- * bfd-in.h (bfd_elf32_arm_allocate_interworking_sections): Correct
- prototype.
- (bfd_elf32_arm_process_before_allocation): Likewise.
- * bfd-in2.h: Rebuild.
-
-1999-06-03 David Mosberger <davidm@hpl.hp.com>
-
- * dwarf2.c (struct line_info): Add member END_SEQUENCE to keep
- track of end_sequence markers.
- (add_line_info): Add END_SEQUENCE arg.
- (decode_line_info): Don't try to infer lo_pc and hi_pc from the
- debug-line info---it doesn't work right if a compilation unit
- consists of multiple discontiguous code-sequences. It would be
- worthwhile to optimize for the common case where a compilation
- unit results in a contiguous set of code sequences, but this is
- quite tricky to get right for arbitrary DWARF2 files.
- (lookup_address_in_line_info_table): Don't use the last line entry
- for a compilation unit for anything with an address higher than
- this line entry. Also, check for end_sequence markers to
- correctly handle discontinuities.
- (_bfd_dwarf2_find_nearest_line): When checking previously loaded
- compilation units, check all compilation units with each->high==0
- just like when reading compilation units.
-
- * dwarf2.c (decode_line_info): Initialize table->files and
- table->last_line to NULL to avoid segfaults due to random
- values in these members.
- (concat_filename): Check for out-of-range file number before
- indexing filename table. Segfaults suck.
-
- * dwarf2.c (decode_line_info): Don't truncate address to least
- significant 32 bits (breaks 64 bit targets).
- (lookup_address_in_function_table): Ditto.
- (comp_unit_contains_address): Ditto.
-
-1999-06-02 Mark Mitchell <Mark Mitchell <mark@codesourcery.com>>
-
- * elf32-mips.c (elf_mips_howto_table): Add R_MIPS_JALR.
- * elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
- (mips_elf64_howto_table_rela): Likewise.
-
- * elfcode.h (elf_slurp_reloc_table_from_section): New function,
- split out from ...
- (elf_slurp_reloc_table): Here. Use it to handle the case where a
- single section has two associated relocation sections.
-
-1999-06-02 Mark Salter <msalter@cygnus.com>
-
- * coffcode.h (coff_set_alignment_hook): Set lma from s_vaddr if
- COFF_WITH_PE defined.
-
-1999-06-02 Nick Clifton <nickc@cygnus.com>
-
- * pe-arm.c: Rename global arm interworking functions to avoid name
- collision when all targets BFD is built.
- * pei-arm.c: Ditto.
-
-1999-05-31 Mark Mitchell <mark@codesourcery.com>
-
- * elf-bfd.h (elf_backend_data): Remove use_rela_p. Add
- may_use_rel_p, may_use_rela_p, default_use_rela_p.
- (bfd_elf_section_data): Add use_rela_p.
- * elf.c (bfd_section_from_shdr): Set use_rela_p appropriately.
- (_bfd_elf_new_section_hook): Likewise.
- (elf_fake_sections): Use may_use_rela_p, etc., instead of
- use_rela_p.
- (_bfd_elf_copy_private_section_data): Copy use_rela_p.
- * elfcode.h (write_relocs): Determine whether or not use rela
- relocs based on the relocation section header.
- * elflink.c (_bfd_elf_create_dynamic_sections): Use default_use_rela_p
- instead of use_rela_p.
- * elfxx-target.h (elf_backend_may_use_relp): New macro.
- (elf_backend_may_use_rela_p): Likewise.
- (elf_backend_default_use_rela_p): Likewise.
- (elfNN_bed): Use them.
-
-Wed Jun 2 12:38:49 1999 Miodrag Vallat <miodrag@multimania.com>
-
- * hosts/alphalinux.h (TRAD_CORE_EXTRA_SIZE_ALLOWED): Expand to 4096.
-
-Tue Jun 1 17:57:58 1999 Mark P. Mitchell <mitchell@n02.acl.lanl.gov>
-
- * reloc.c (BFD_RELOC_MIPS_SUB): New relocation.
- (BFD_RELOC_MIPS_GOT_PAGE): Likewise.
- (BFD_RELOC_MIPS_GOT_OFST): Likewise.
- (BFD_RELOC_MIPS_GOT_DISP): Likewise.
- * bfd-in2.h: Regenerated.
- * libbfd.h: Likewise.
- * elf32-mips.c (mips_info_to_howto_rela): New function.
- (USE_REL): Adjust for new conventions.
- (MINUS_ONE): New macro.
- (elf_mips_howto_table): Add R_MIPS_SUB.
- (mips_r): Add entries for MIPS_SUB, MIPS_GOT_PAGE, MIPS_GOT_OFST,
- and MIPS_GOT_DISP.
- (mips_elf_final_write_processing): Set sh_link, not sh_info, for a
- .MIPS.content section.
- (_bfd_mips_elf_fake_sections): Treat all sections that begin
- with .MIPS.content as .MIPS.content sections. Set
- SHF_MNIPS_NOSTRIP for such section.
- (elf_info_to_howto): Define to mips_info_to_howto_rela.
- * elf64-mips.c (mips_r): Add entries for MIPS_SUB, MIPS_GOT_PAGE,
- MIPS_GOT_OFST, and MIPS_GOT_DISP.
-
-Wed Jun 2 11:51:12 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * vms-misc.c (_bfd_vms_hash_newfunc): Fix use of uninitialized
- variable.
-
- * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Avoid ambigous
- `else'.
-
-1999-05-30 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_relocate_section): Reinstate change of
- 1993-03-25 (!!). Take into account the bitmasks for the reloc so
- the addend does not overflow into the rest of the word.
-
-1999-05-29 Nick Clifton <nickc@cygnus.com>
-
- * bfd-in.h: Amend prototype for
- bfd_elf32_arm_process_before_allocation .
- * bfd-in.h: Regenerate.
-
- * elfarm-oabi.c (NUM_ELEM): New macro: Compute the number of
- elements in a fixed sized array.
- (ARM_ELF_ABI_VERSION): Define.
- (ARM_ELF_OS_ABI_VERSION): Define.
- (R_ARM_THM_ABS5): Fix rightshift and size.
- (R_ARM_THM_PC22): Fix size.
- (R_ARM_PLT32): Define Howto.
- (find_howto): New function: Locate a howto based on a reloc
- number.
- (elf32_arm_info_to_howto): Use find_howto if necessary.
- (elf32_arm_reloc_map): Change type of field bfd_reloc_val to
- bfd_reloc_code_real_type.
- (elf32_arm_reloc_map[]): Add entries for BFD_RELOC_VTABLE_INHERIT
- and BFD_RELOC_VTABLE_ENTRY.
- (elf32_arm_reloc_type_lookup): Use find_howto if necessary.
-
- * elfarm-nabi.c (NUM_ELEM): New macro: Compute the number of
- elements in a fixed sized array.
- (ARM_ELF_ABI_VERSION): Define.
- (ARM_ELF_OS_ABI_VERSION): Define.
- (R_ARM_THM_ABS5): Fix rightshift and size.
- (R_ARM_THM_PC22): Fix size.
- (elf32_arm_info_to_howto_rel): Rename to elf32_arm_info_to_howto.
- (elf32_arm_reloc_map): Change type of field bfd_reloc_val to
- bfd_reloc_code_real_type.
-
- * elf32-arm.h (struct elf32_arm_link_hash_table): Add new field:
- no_pipeline_knowledge.
- (elf32_arm_link_hash_create): Initialise new field to zero.
- (bfd_elf32_arm_process_before_allocation): Add new paraemter:
- no_pipeline_knowledge. Use this parameter to initialise the field
- in the globals data structure.
- (elf32_arm_final_link_relocate): Only add in pipeline offset if
- no_pipeline_knowledge is false and the binary is from an old
- toolchain.
- (elf32_arm_merge_private_data): Generate an error if an attempt is
- made to link together big endian and little endian code.
- (elf32_arm_post_process_headers): New function: Initialise the
- EI_OSABI and EI_ABIVERSION fields of the newly created ELF program
- header.
- (elf_backend_post_process_headers): Define.
-
-1999-05-28 Nick Clifton <nickc@cygnus.com>
-
- * elf-bfd.h (struct elf_backend_data): Add new field:
- elf_backend_post_process_headers.
-
- * elfxx-target.h (elf_backend_post_process_headers): Define to
- NULL if not already defined.
- (elfNN_bed): Initialise elf_backend_post_process_headers field.
-
- * elf.c (prep_headers): Set the EI_OSABI and EI_ABIVERSION fields
- to zero.
- (_bfd_elf_compute_section_file_positions): Call
- elf_backend_post_process_headers if defined.
-
-1999-05-28 Ian Lance Taylor <ian@zembu.com>
-
- * configure.in: Check whether getuid and getgid exist.
- * archive.c: Define getuid and getgid as macros if HAVE_GETUID or
- HAVE_GETGID are not defined, respectively.
- (bfd_write_armap): Don't special case on _WIN32 for getuid and
- getgid.
- * configure.host: Set ac_cv_func_get{ug}id for *-*-windows*.
- * configure, config.in: Rebuild.
-
-1999-05-28 Martin Dorey <mdorey@madge.com>
-
- * elf32-i960.c: New file.
- * elf.c (prep_headers): Handle bfd_arch_i960.
- * targets.c (bfd_target_vector): Add &bfd_elf32_i960_vec.
- * config.bfd (i960-*-elf*): New target.
- * configure.in (bfd_elf32_i960_vec): New target vector.
- * Makefile.am (BFD32_BACKENDS): Add elf32-i960.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-i960.c.
- * Makefile.in, aclocal.m4, configure: Rebuild.
-
-1999-05-27 Nick Clifton <nickc@cygnus.com>
-
- * elfarm-oabi.c (elf32_arm_howto_table): Add entry for
- R_ARM_PLT32.
- (find_howto): New function: Find entries in the
- elf32_arm_howto_table.
- (elf32_arm_info_to_howto): Use find_howto if the entry cannot be
- computed simply.
- (elf32_arm_reloc_type_lookup): Add lookup for
- BFD_RELOC_ARM_PLT32.
-
-1999-05-25 Philip Blundell <pb@nexus.co.uk>
-
- * elf32-arm.h (elf32_arm_link_hash_newfunc): New function.
- (elf32_arm_link_hash_table_create): Use above function as the
- constructor for hash table entries.
- (elf32_arm_relocate_section): Avoid crash when there is no output
- section.
- (elf32_arm_final_link_relocate): New parameter h.
- (elf32_arm_relocate_section): Pass symbol hash entry to above
- routine.
- (elf32_arm_gc_sweep_hook, elf32_arm_check relocs): Correct
- comments.
-
-1999-05-25 Catherine Moore <clm@cygnus.com>
-
- * coff-arm.c (coff_arm_relocate_section): Don't emit
- base file entries for pc-relative values.
-
-1999-05-25 DJ Delorie <dj@cygnus.com>
-
- * peicode.h (coff_swap_sym_in): When we create the actual section
- to reflect the not-there section C_SECTION symbols refer to,
- change the symbol class to C_STAT as the section is now really
- there.
-
-1999-05-24 Philip Blundell <pb@nexus.co.uk>
-
- * elf32-arm.h (elf32_arm_relocate_section): Undo change of
- 1999-03-25.
-
-Mon May 17 13:35:35 1999 Stan Cox <scox@cygnus.com>
-
- * coff-arm.c (_bfd_coff_arm_set_private_flags): Changed
- F_PIC_INT to F_PIC.
- * coffcode.h (coff_set_arch_mach_hook): Added F_ARM_2a, and
- F_ARM_3M labels. Changed F_PIC_INT to F_PIC.
-
-1999-05-16 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (in_reloc_p): Reinstate.
-
-1999-05-15 Nick Clifton <nickc@cygnus.com>
-
- * reloc.c (BFD_RELOC_MCORE_RVA): Define.
- * bfd-in2.h: Regenerate.
- * coff-mcore.c (in_reloc_p): Remove defintion.
- (mcore_coff_howto): Add IMAGE_REL_MCORE_RVA.
- (mcore_coff_reloc_type_lookup): Map BFD_RELOC_RVA to
- IMAGE_REL_MCORE_RVA.
- (coff_mcore_rtype_to_howto): Add special processing for
- IMAGE_REL_MCORE_RVA.
- (coff_mcore_relocate_section): Add support for
- IMAGE_REL_MCORE_RVA.
- * elf32-mcore.c (mcore_elf_howto_): Add R_MCORE_RELATIVE.
- (mcore_elf_reloc_type_lookup): Map BFD_RELOC_RVA to
- R_MCORE_RELATIVE.
- (mcore_elf_relocate_section): Delete redundant case labels.
-
-Fri May 14 10:59:55 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * elf32-arm.h (elf32_arm_relocate_section): Fix operator
- precedence between bit-and and comparison.
-
-Thu May 13 09:45:23 1999 Joel Sherrill (joel@OARcorp.com)
-
- * config.bfd (i[3456]86*-*-rtems*, m68k*-*-rtems*): Added to
- list of target formats (targ_selvecs).
- (i[3456]86*-*-rtemself*, mips*el-*-rtems*): New targets.
- (powerpcle*-*rtems*, sh-*-rtemself*): New targets.
-
-1999-05-10 DJ Delorie <dj@cygnus.com>
-
- * ecoff.c (_bfd_ecoff_write_armap): give the symtab element a
- reasonable mode until "ar x" is smart enough to skip it (fixes
- gcc/libgcc.a builds on mips-ecoff targets
-
- * coffcode.h (styp_to_sec_flags): Explain how COMDATs are supposed
- to work. Hack to support MS import libraries, which use different
- COMDAT types than GNU.
- (coff_slurp_symbol_table): C_SECTION symbols are local; they refer
- to implied zero-length sections (see peicode below)
- * coffgen.c (coff_get_normalized_symtab): Properly read long MS
- filename symbols, which use one *or more* auxents.
- * coffswap.h (coff_swap_aux_in): ditto
- * peicode.h (coff_swap_sym_in): Build the implied zero-length
- sections
-
-Tue May 11 15:51:58 1999 Jeffrey A Law (law@cygnus.com)
-
- * elf32-v850.c (v850_elf_howto_table): Make partial_inplace false
- for all relocations.
-
-1999-05-10 Catherine Moore <clm@cygnus.com>
-
- * bfd-in.h (bfd_arm_allocate_interworking_sections): Static
- if COFF_IMAGE_WITH_PE.
- (bfd_arm_process_before_allocation): Likewise.
- (bfd_arm_get_bfd_for_interworking): Likewise.
- * coff-arm.c: Likewise.
- * bfd-in2.h: Regenerate.
- * configure.in (armpe_little_vec): Remove coff-arm.lo.
- (armpe_big_vec): Likewise.
- * configure: Rebuild.
-
-1999-05-10 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (elf_fake_sections): Check for .rel. as start of rel
- section, not just .rel. Same for .rela.
-
-1999-05-07 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (coff_mcore_relocate_section): Replace assert about
- endianism with an error message.
-
-Thu May 6 17:09:09 1999 Fred Fish <fnf@be.com>
-
- * dwarf2.c (read_abbrevs): Change cast of dwarf_abbrev_buffer
- assignment from "unsigned char *" to "char *".
- (decode_line_info): Likewise for dwarf_line_buffer assignment.
-
-1999-05-05 Catherine Moore <clm@cygnus.com>
-
- * coff-arm.c (coff_arm_relocate_section): Add one to
- address of ARM_RVA32 thumb functions.
-
-1999-05-05 Catherine Moore <clm@cygnus.com>
-
- * elf32-m68k.c (elf32_m68k_set_private_flags): New.
- (elf32_m68k_copy_private_bfd_data): New.
- (elf32_m68k_merge_private_bfd_data): New.
- (elf32_m68k_print_private_bfd_data): New.
- (CPU32_FLAG): Define.
- (PLT_CPU32_ENTRY_SIZE): Define.
- (elf_cpu32_plt0_entry): Declare.
- (elf_cpu32_plt_entry): Declare.
- (elf_m68k_adjust_dynamic_symbol): Generate cpu32 plt entries.
- (elf_m68k_finish_dynamic_symbol): Likewise.
- (elf_m68k_finish_dynamic_sections): Likewise.
- (elf_backend_plt_header_size): Remove definition.
- (bfd_elf32_bfd_copy_private_bfd_data): Define.
- (bfd_elf32_bfd_merge_private_bfd_data): Define.
- (bfd_elf32_bfd_set_private_flags): Define.
- (bfd_elf32_bfd_print_private_bfd_data): Define.
-
-Mon May 3 09:24:49 1999 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_fixup_formats): Fix comments for R_SHORT_PCREL_MODE
- and R_LONG_PCREL_MODE.
-
-1999-04-29 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (coff_mcore_relocate_section): Fix typos.
-
-Fri Apr 28 16:36:19 1999 Stan Cox <scox@cygnus.com>
-
- * elf32-sh.c (sh_elf_relocate_section): Include relocation addend
- in relocation calculation.
-
-1999-04-26 Tom Tromey <tromey@cygnus.com>
-
- * aclocal.m4, configure: Updated for new version of libtool.
-
-1999-04-21 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c: Add support for mcore relocs.
-
-1999-04-20 Gavin Romig-Koch <gavin@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_print_private_bfd_data): Scrap the
- incorrect use EF_MIPS_xxBITPTRS.
-
-1999-04-18 Ian Lance Taylor <ian@zembu.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Remove unused local
- variable insn.
-
- * bfd-in2.h: Rebuild.
- * libbfd.h: Rebuild.
-
-Sat Apr 17 20:55:15 1999 Catherine Moore <clm@cygnus.com>
-
- * coff-arm.c (coff_arm_rtype_to_howto): Remove ARM26D transform.
- (coff_arm_relocate_section): Add ARM26D transform. Only
- change to ARM26D for relocateable links.
-
-1999-04-16 Gavin Romig-Koch <gavin@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_print_private_bfd_data): New.
- (bfd_elf32_bfd_print_private_bfd_data): New.
-
-1999-04-15 Doug Evans <devans@casey.cygnus.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): For R_ARM_THM_ABS5,
- refetch addend if USE_REL, add many comments regarding current state.
- For R_ARM_THM_PC22, refetch addend if USE_REL, simplify.
- * elfarm-nabi.c (elf32_arm_howto_table): For R_ARM_THM_ABS5, fix
- size and rightshift. For R_ARM_THM_PC22, fix bitsize.
- * elfarm-oabi.c (elf32_arm_howto_table): Ditto.
-
-Wed Apr 14 14:33:08 1999 Richard Henderson <rth@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_read_ecoff_info): Zero `debug'.
- * elf64-alpha.c (elf64_alpha_read_ecoff_info): Likewise.
-
-1999-04-13 David Mosberger <davidm@hpl.hp.com>
-
- * dwarf2.c (decode_line_info): Don't truncate address to least
- significant 32 bits (breaks 64 bit targets).
- (lookup_address_in_function_table): Ditto.
- (comp_unit_contains_address): Ditto.
-
-Tue Apr 13 21:27:19 1999 Catherine Moore <clm@cygnus.com>
-
- * coff-arm.c (arm_emit_base_file_entry): New routine.
- (A2T3_OFFSET): Define.
- (T2A3_OFFSET): Define.
- (coff_arm_relocate_section): Emit base file entries for interworking
- stubs.
-
-1999-04-13 Philip Blundell <philb@gnu.org>
-
- * elfarm-nabi.c (elf32_arm_howto_table): Add dummy entries for
- relocs 17 through 19.
-
-Sun Apr 11 01:25:17 1999 Richard Henderson <rth@cygnus.com>
-
- * elfcode.h: Remove fnmatch.h.
- * elflink.h (elf_link_assign_sym_version): Call back to ld
- instead of calling fnmatch.
-
- * config.bfd (i?86-*-beoself): Include pe vecs.
-
-Sun Apr 11 01:14:06 1999 Richard Henderson <rth@cygnus.com>
-
- * elf32-i386.c (elf_i386_finish_dynamic_sections): Allow .plt
- to go missing.
-
-1999-04-10 Richard Henderson <rth@cygnus.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Mind no_undefined
- when trying to resolve dynamic symbol references.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elflink.h (elf_link_output_extsym): Likewise.
-
-Sat Apr 10 15:12:09 1999 Richard Henderson <rth@cygnus.com>
-
- * section.c (_bfd_strip_section_from_output): New function moved from
- * elf64-alpha.c (elf64_alpha_strip_section_from_output): ... here.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Use it.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-mips.c (mips_elf_size_dynamic_sections): Likewise.
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
- * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
- * bfd-in2.h: Update.
-
-1999-04-09 Ian Lance Taylor <ian@zembu.com>
-
- * elf64-sparc.c: Fix incorrect calls to bfd_check_overflow.
-
-1999-04-08 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c: New File: Support for mcore-pe targets.
- * cpu-mcore.c: New File: Support for mcore targets.
- * elf32-mcore.c: New File: Support for mcore-elf target.
- * pe-mcore.c: New File: Definitions for mcore-pe target.
- * pei-mcore.c: New File: Definitions for mcore-pei target.
- * Makefile.am: Add support for MCore targets.
- * Makefile.in: Regenerate.
- * config.bfd: Add support for MCore targets.
- * configure.in: Add support for MCore targets.
- * configure: Regenerate.
- * archures.c: Add support for MCore architecture.
- * bfd-in2.h: Regenerate.
- * coffcode.h: Add support for mcore-pe targets.
- * elf.c: Add support for mcore-elf target.
- * reloc.c: Add support for MCore relocs.
- * targets.c: Add support for MCore targets.
-
-1999-04-07 Nick Clifton <nickc@cygnus.com>
-
- * elfarm-nabi.c (elf32_arm_howto_table): Add entries for
- R_ARM_XPC25 and R_ARM_THM_XPC22.
- (elf32_arm_reloc_map): Remove redundant entries.
-
-1999-04-06 Ian Lance Taylor <ian@zembu.com>
-
- * sysdep.h (LC_MESSAGES): Never define.
-
-1999-04-06 Chris Torek <torek@bsdi.com>
-
- * reloc.c (bfd_check_overflow): Add addrsize parameter. Change
- all callers. Rewrite completely.
- (_bfd_relocate_contents): Rewrite overflow checking.
- * bfd-in2.h: Rebuild.
-
-1999-04-05 Ian Lance Taylor <ian@zembu.com>
-
- From Gabriel Paubert <paubert@iram.es>:
- * elf32-ppc.c (ppc_elf_howto_raw): Set R_PPC_GOT16_LO,
- R_PPC_PLT16_LO and R_PPC_SECTOFF_LO to be complain_overflow_dont.
- Set R_PPC_PLT16_HA, R_PPC_SECTOFF_HA and R_PPC_EMB_NADDR16_HA to
- have a rightshift of 16 and use ppc_elf_addr16_ha_reloc.
- * ppcboot.c (ppcboot_vec): Use little endian routines for
- headers.
-
- * elf.c (elfcore_strndup): Only define if it will be used.
- * elf32-ppc.c (ppc_elf_relax_section): Remove unused locals irel
- and irelend.
- (ppc_elf_check_relocs): Remove unused local i.
- (ppc_elf_gc_mark_hook): Add default case to switch.
-
- From Bernd Nitzler <nitzler@kagcpd01.ag01.kodak.COM>:
- * srec.c (srec_scan): Accept \r in symbol definitions.
- (srec_object_p): Set HAS_SYMS if we saw any symbols.
- (symbolsrec_object_p): Likewise.
-
-1999-04-04 Don Bowman <don@pixsci.com>
-
- * config.bfd: Add mips*el-*-vxworks* and mips*-*-vxworks*.
-
-1999-04-04 Ian Lance Taylor <ian@zembu.com>
-
- * dwarf1.c (parse_line_table): Remove unused locals last_pc and
- last_line.
- * elf-bfd.h (_bfd_elfcore_section_from_phdr): Declare.
- * elf32-i386.c (elf_i386_gc_mark_hook): Add default case to
- switch.
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Remove unused
- local i.
- * syms.c (_bfd_stab_section_find_nearest_line): Remove unused
- local val.
-
-1999-03-31 Nick Clifton <nickc@cygnus.com>
-
- * config.bfd: Add support for arm-epoc-pe target.
- * configure.in: Add support for arm-epoc-pe target.
- * configure: Regenerate.
- * targets.c: Add support for arm-epoc-pe target.
- * coff-arm.c: Allow header files to override definition of
- TARGET_UNDERSCORE and USER_LABEL_PREFIX.
- * pe-arm.c: Allow previous header files to override definition of
- TARGET_LITTLE_SYM and TARGET_BIG_SYM.
- * pei-arm.c: Allow previous header files to override definition of
- TARGET_LITTLE_SYM and TARGET_BIG_SYM.
- * epoc-pe-arm.c: New file. Support arm-epoc-pe target.
- * epoc-pei-arm.c: New file. Support arm-epoc-pei target.
-
-1999-03-30 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (elf_map_symbols): Handle the case where section
- symbols are generated for content-less sections which are
- not mapped to the output file.
-
- * linker.c: Replace direct references to fields in BFD structure
- with accessor macros.
-
- * elflink.h: Replace direct references to fields in BFD structure
- with accessor macros.
-
-1999-03-25 Philip Blundell <pb@nexus.co.uk>
-
- * config.bfd: Eliminate redundancy in checks for Linux/ARM.
-
- * elf32-arm.h (elf32_arm_relocate_section): Take the rightshift into
- account when adjusting section symbols during a partial link.
-
-1999-03-24 Nick Clifton <nickc@cygnus.com>
-
- * coff-sparc.c (struct coff_reloc_map): Change type of field
- 'bfd_reloc_val' to bfd_reloc_code_real_type.
- * elf-m10200.c (struct mn10200_reloc_map): Ditto.
- * elf-m10300.c (struct mn10300_reloc_map): Ditto.
- * elf32-arc.c (struct arc_reloc_map): Ditto.
- * elf32-d10v.c (struct d10v_reloc_map): Ditto.
- * elf32-d30v.c (struct d30v_reloc_map): Ditto.
- * elf32-fr30.c (struct fr30_reloc_map): Ditto.
- * elf32-m32r.c (struct m32r_reloc_map): Ditto.
- * elf32-sh.c (struct elf_reloc_map): Ditto.
- * elf32-sparc.c (struct elf_reloc_map): Ditto.
- * elf32-v850.c (struct v850_reloc_map): Ditto.
- * elf64-sparc.c (struct elf_reloc_map): Ditto.
- * elfarm-nabi.c (struct elf32_arm_reloc_map): Ditto.
- * elfarm-oabi.c (struct elf32_arm_reloc_map): Ditto.
-
-1999-03-17 Martin Hunt <hunt@cygnus.com>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Changed this
- function so source-level assembly works. If multiple N_SOs
- are seen without and N_FUNs, create an indextable entry with
- a NULL function name.
-
-1999-03-16 Gavin Romig-Koch <gavin@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data) Allow merging
- of certian similar cpus.
-
-1999-03-16 Gavin Romig-Koch <gavin@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_final_write_processing):
- Add the 5000. Change the architecture for the 5400 to mips4.
- (elf_mips_mach): Add r5000.
-
-1999-03-11 Doug Evans <devans@casey.cygnus.com>
-
- * cpu-i960.c (scan_i960_mach): Recognize i960:ka_sa and i960:kb_sb.
-
-1999-03-11 Nick Clifton <nickc@cygnus.com>
-
- * binary.c (binary_set_section_contents): Generate warning about
- huge file offsets for any section that will occupy file space, not
- just those that are loadable.
-
-1999-02-24 Jim Blandy <jimb@zwingli.cygnus.com>
-
- * libbfd.h: Regenerate after Nick Clifton's Feb 17 changes.
-
-1999-02-22 Jim Lemke <jlemke@cygnus.com>
-
- * elf32-ppc.c: Add ppc_elf_relax_section() for the ld option mpc860c0.
-
-Mon Feb 22 18:26:51 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * elf-bfd.h (ELF_LINK_HASH_REF_REGULAR_NONWEAK): Define.
- * elflink.h: Revert all changes since Feb 16. Instead:
- (elf_link_add_object_symbols): Set REF_REGULAR_NONWEAK flag if
- appropriate. Copy it to version symbols.
- (elf_fix_symbol_flags): Set REF_REGULAR_NONWEAK for non ELF
- symbols if appropriate.
- (elf_adjust_dynamic_symbol): Set REF_REGULAR_NONWEAK for weakdef
- symbol if appropriate.
- (elf_link_output_extsym): If symbol is marked as undefined, and
- has no nonweak references, mark it as weak undefined.
-
-Fri Feb 19 16:01:12 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_merge_symbol): When overriding a dynamic
- definition with a weak undefined symbol, set NEEDS_PLT if it is a
- function.
- (elf_link_add_object_symbols): Don't copy the other field if we
- are overridding.
-
-Thu Feb 18 18:07:43 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_merge_symbol): Do not merge any symbol from a
- shared object with a weak undefined symbol.
-
-1999-02-18 Nick Clifton <nickc@cygnus.com>
-
- * elfarm-nabi.c: Set partial_inplace back to false.
-
-1999-02-17 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (TARGET_UNDERSCORE): Re-enable.
- (USER_LABEL_PREFIX): Set to "_".
-
- The following patches are from: Scott Bambrough
- <scottb@corelcomputer.com>
-
- * libaout.h (M_ARM6_NETBSD): Set to 143.
-
- * reloc.c: Add ARM PIC relocs: BFD_RELOC_ARM_GOT12,
- BFD_RELOC_ARM_GOT32, BFD_RELOC_ARM_JUMP_SLOT, BFD_RELOC_ARM_COPY,
- BFD_RELOC_ARM_GLOB_DAT, BFD_RELOC_ARM_PLT32,
- BFD_RELOC_ARM_RELATIVE, BFD_RELOC_ARM_GOTOFF, BFD_RELOC_ARM_GOTPC.
- * bfd-in2.h: Regenerate.
-
- * elfarm-nabi.c (elf32_arm_howto_table): Set partial_inplace to
- 'true' as REL relocs are now being used. Add new PIC relocs:
- R_ARM_COPY, R_ARM_GLOB_DAT, R_ARM_JUMP_SLOT, R_ARM_RELATIVE,
- R_ARM_GOTOFF, R_ARM_GOTPC, R_ARM_GOT32, R_ARM_PLT32.
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Check byte order
- of targets.
- (elf32_arm_final_link_relocate): Change parameters so that entire
- reloc is passed. Add support for PIC relocs.
- (elf32_arm_relocate_section): Pass entire reloc to
- elf32_arm_final_link_relocate.
- (elf32_arm_check_relocs): Handle new PIC relocs.
- (elf32_arm_adjust_dynamic_symbol): New function.
- (elf32_arm_size_dynamic_sections): New function.
- (elf32_arm_discard_copies): New function.
- (elf32_arm_finish_dynamic_symbol): New function.
- (elf32_arm_finish_dynamic_sections): New function.
- (ELF_MAXPAGE_SIZE): Define.
- (bfd_elf32_bfd_reloc_type_lookup): Define.
- (elf_backend_relocate_section): Define.
- (elf_backend_adjust_dynamic_symbol): Define.
- (elf_backend_create_dynamic_sections): Define.
- (elf_backend_finish_dynamic_symbol): Define.
- (elf_backend_finish_dynamic_sections): Define.
- (elf_backend_size_dynamic_sections): Define.
- (elf_backend_plt_readonly): Define.
- (elf_backend_want_got_plt): Define.
- (elf_backend_want_plt_sym): Define.
-
-Wed Feb 17 12:02:26 1999 Stan Cox <scox@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_section_from_shdr): Make reginfo
- sections SEC_LINK_ONCE and SEC_LINK_DUPLICATES_SAME_SIZE.
- (_bfd_mips_elf_fake_sections): Likewise.
-
-Wed Feb 17 12:07:23 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * elfarm-oabi.c (bfd_elf32_arm_allocate_interworking_sections,
- bfd_elf32_arm_get_bfd_for_interworking,
- bfd_elf32_arm_process_before_allocation): Define to avoid clash
- with elfarm-nabi.c.
-
- * elf32-arm.h: Don't declare elf32_arm_info_to_howto.
- (elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub,
- elf32_arm_find_nearest_line): Make them static.
-
-Tue Feb 16 22:44:37 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_merge_symbol): Add pflags parameter. Change all
- callers. Do not merge a definition from a shared object with a
- weak undefined symbol.
- (elf_link_add_object_symbols): Do not change the symbol type or
- size if the old symbol overrides the new one.
-
-1999-02-08 Nick Clifton <nickc@cygnus.com>
-
- * config.bfd: Add support for strongarm target.
-
-Mon Feb 8 11:18:14 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * elf32-m68k.c (reloc_map): Use the correct types for the struct
- fields instead of unsigned char.
-
-Fri Feb 5 00:22:36 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: Rebuild dependencies.
- * Makefile.in: Rebuild.
-
-Thu Feb 4 22:30:13 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Change AC_PREREQ to 2.13. Remove AM_CYGWIN32.
- Change AM_EXEEXT to AC_EXEEXT and AM_PROG_INSTALL to
- AC_PROG_INSTALL. Add comments to uses of AC_DEFINE.
- * acinclude.m4: Add comments to uses of AC_DEFINE.
- * acconfig.h: Remove.
- * configure: Rebuild with current autoconf/automake.
- * aclocal.m4: Likewise.
- * config.in: Likewise.
- * Makefile.in: Likewise.
-
-1999-02-04 DJ Delorie <dj@cygnus.com>
-
- * libbfd.c (real_read): don't call fread for zero bytes. This
- covers up a bug (or misuse of bfd) that's exposed by Solaris.
-
-Thu Feb 4 12:38:10 1999 Stan Cox <scox@cygnus.com>
-
- * elf32-mips.c (mips_elf_relocate_section): Insure that the target
- of a jump is in the current 256 MB region.
-
-Thu Feb 4 12:15:38 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * format.c (bfd_check_format_matches): Change last patch to only
- take effect for the binary target.
-
-Wed Feb 3 19:40:12 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-i386.c (elf_i386_reloc_type_lookup): Add BFD_RELOC_CTOR.
-
-Wed Feb 3 15:02:44 1999 Catherine Moore <clm@cygnus.com>
-
- * elf32-fr30.c (fr30_elf_check_relocs): New routine.
-
-Tue Feb 2 21:38:28 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * format.c (bfd_check_format_matches): If the target was
- previously specified, don't check other targets when checking for
- an archive file.
-
-Tue Feb 2 18:16:43 1999 Catherine Moore <clm@cygnus.com>
-
- * elf32-arm.h (elf32_arm_reloc_map): Removed.
- (elf32_arm_reloc_type_lookup): Removed
- * elfarm-nabi.c (elf32_arm_reloc_map): New.
- (elf32_arm_reloc_type_lookup): New.
- * elfarm-oabi.c (elf32_arm_reloc_map): New.
- (elf32_arm_reloc_type_lookup): New.
-
-Mon Feb 1 19:49:21 1999 Catherine Moore <clm@cygnus.com>
-
- * elfarm-nabi.c: Renamed from elf32-arm-newabi.c.
- * elfarm-oabi.c: Renamed from elf32-arm-oldabi.c
- * Makefile.am: Use new files.
- * Makefile.in: Regenerate.
- * configure.in: Use new files.
- * configure: Regenerate.
-
-1999-02-01 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_elf_gc_mark_hook): New function.
- (fr30_elf_gc_sweep_hook): New function.
- (elf_backend_can_gc_sections): Define.
-
-Mon Feb 1 12:21:47 1999 Catherine Moore <clm@cygnus.com>
-
- * targets.c (bfd_target_vector): Add bfd_elf32_littlearm_oabi_vec
- and bfd_elf32_bigarm_oabi_vec.
-
-Mon Feb 1 11:46:31 1999 Catherine Moore <clm@cygnus.com>
-
- * Makefile.am (elf32-arm-oldabi.lo): New.
- (elf32-arm-newabi.lo): New.
- * Makefile.in: Regenerate.
- * config.bfd (thumb-*-elf): Remove definition of targ_underscore.
- (arm-*-elf): Likewise.
- (arm-*-oabi): New.
- (thumb-*-oabi): New.
- * configure: Regenerate.
- * configure.in (bfd_elf32_littlearm_oabi_vec): New.
- (bfd_elf32_bigarm_oabi_vec): New.
- * elf32-arm-newabi.c: New.
- * elf32-arm-oldabi.c: New.
- * elf32-arm.c: Removed.
- * elf32-arm.h: New.
-
-Mon Feb 1 11:52:12 1999 Frank Ch. Eigler <fche@cygnus.com>
-
- * binary.c (binary_set_section_contents): Omit warnings for
- unloadable sections.
-
-1999-01-31 Michael Meissner <meissner@cygnus.com>
-
- * config.bfd (powerpc{,le}-*-vxworks*): Add aliases to
- powerpc{,le}-*-eabi.
-
-1999-01-29 Nick Clifton <nickc@cygnus.com>
-
- * dwarf2.c (read_unsigned_leb128): Remove unused variables.
- * dwarf2.c (read_signed_leb128): Remove unused variables.
-
-Fri Jan 29 00:47:21 1999 H.J. Lu <hjl@gnu.org>
-
- * elf.c (assign_file_positions_for_segments): Only adjust
- p_align when needed.
-
-Thu Jan 28 20:05:22 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * binary.c (binary_set_section_contents): Don't return early for a
- non-loadable section, in case the first section is non-loadable.
- Don't set the low lma for a SEC_NEVER_LOAD section. From Maciej
- W. Rozycki <macro@ds2.pg.gda.pl>.
-
-1999-01-28 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_reloc_map): Add R_FR30_GNU_VTINHERIT and
- R_FR30_GNU_VTENTRY relocs.
-
-Thu Jan 28 11:08:16 1999 Catherine Moore <clm@cygnus.com>
-
- * elflink.h (elf_link_output_sym): Zero syms which are
- part of sections which have been excluded.
-
-Wed Jan 27 13:35:35 1999 Stan Cox <scox@cygnus.com>
-
- * coff-arm.c (_bfd_coff_arm_set_private_flags): Changed F_PIC
- to F_PIC_INT.
- * coffcode.h (coff_set_arch_mach_hook): Removed F_ARM_2a and
- F_ARM_3M labels. Changed F_PIC to F_PIC_INT.
-
-1999-01-27 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_elf_howto_table): Fix name of R_FR30_48
- relocation.
- (fr30_final_link_relocate): Use computed value as result of
- relocation.
-
-1999-01-26 Frank Ch. Eigler <fche@cygnus.com>
-
- * binary.c (binary_set_section_contents): Emit warning for
- huge file offsets due to widely-dispersed section LMAs.
-
-Mon Jan 18 03:35:35 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): If not D_PAGED,
- align first section to largest section alignment, not first
- section alignment.
-
-1999-01-04 Jason Molenda (jsm@bugshack.cygnus.com)
-
- * configure.in: Require autoconf 2.12.1 or higher.
-
-Tue Dec 22 15:21:41 1998 Catherine Moore <clm@cygnus.com>
-
- * archures.c (bfd_mach_i386_i386_intel_syntax): Define.
- * bfd-in2.h: Likewise.
- * cpu-i386.c (bfd_i386_arch_intel_syntax): New.
-
-1998-12-16 Gavin Romig-Koch <gavin@cygnus.com>
-
- * archures.c (bfd_mach_mips4111): New.
- * bfd-in2.h: Regenerate.
- * cpu-mips.c: Add support for and independent 4111.
- * elf32-mips.c (elf_mips_mach): E_MIPS_MACH_4111 -> bfd_mach_mips4111.
- (_bfd_mips_elf_final_write_processing):
- bfd_mach_mips4111 -> E_MIPS_ARCH_3 | E_MIPS_MACH_4111.
-
-1998-12-15 Gavin Romig-Koch <gavin@cygnus.com>
-
- * elf32-mips.c (elf_mips_abi_name): New.
- (_bfd_mips_elf_merge_private_bfd_data): Compare EF_MIPS_ABI flags.
-
-1998-12-12 Gavin Romig-Koch <gavin@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_final_write_processing):
- Handle bfd_mach_mips4300.
-
-1998-12-11 Ulrich Drepper <drepper@cygnus.com>
-
- * elf32-i386.c: Remove leaked development code from patch
- 1998-12-10 by Richard Henderson.
-
-1998-12-10 Richard Henderson <rth@cygnus.com>
-
- * elf32-i386.c (elf_i386_relocate_section): Don't fail relocations
- in debug sections for symbol defined externally.
-
-Thu Dec 10 10:58:38 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * targets.c (bfd_target_vector): Remove duplicate entry for
- tekhex_vec.
-
-1998-12-09 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_elf_howto_table): Set src_mask fields to 0
- since we are using RELAs.
-
-Tue Dec 8 22:15:48 1998 Ian Lance Taylor <ian@cygnus.com>
-
- SCO Open Server Release 5 core file support, from Jouke Numan
- <jnuman@hiscom.nl>:
- * sco5-core.c: New file.
- * configure.in (i[3456]86-*-sco3.2v5*): Use sco5-core.lo.
- (sco5-core.lo): Define SCO5_CORE in COREFLAG.
- * Makefile.am: Rebuild dependencies.
- (OPTIONAL_BACKENDS): Add sco5-core.lo.
- (OPTIONAL_BACKENDS_CFILES): Add sco5-core.c.
- * bfd.c (struct _bfd): Add sco5_core_data field to tdata.
- * targets.c (sco5_core_vec): Add to target list if SCO5_CORE.
- * bfd-in2.h, configure, Makefile.in: Rebuild.
-
-Tue Dec 8 19:38:42 1998 Mark Klein <mklein@dis.com>
-
- * config.bfd (hppa*-*-mpeix*): New target.
- * configure.in: Add AC_HEADER_DIRENT.
- (hppa*-*-mpeix*): New target.
- * configure.host (hppa*-*-mpeix*): New host.
- * hpux-core.c: Check HOST_HPPAMPEIX. Use HAVE_DIRENT_H and
- friends rather than just including <sys/dir.h>.
- * som.h (struct som_symbol): Add hppa_priv_level and apto
- tc_data. Change all users.
- (struct somdata): Add comp_unit field.
- (obj_som_compilation_unit): Define.
- (bfd_som_attach_compilation_unix): Declare.
- * som.c: Check HOST_HPPAMPEIX.
- (struct som_misc_symbol_info): Add new field priv_level.
- (som_object_setup): Add current_offset parameter. Change all
- callers.
- (setup_sections): Likewise.
- (som_object_p): For EXECLIBMAGIC, read the lst header.
- (som_write_symbol_strings): Add compilation_unit parameter.
- Change all callers.
- (som_finish_writing): Write out compilation_unit.
- (som_bfd_derive_misc_symbol_info): Set priv_level.
- (som_build_and_write_symbol_table): Set xleast field to 3.
- (som_slurp_symbol_table): Set symbol priv_level.
- (bfd_som_attach_compilation_unit): New function.
- (som_bfd_ar_write_symbol_stuff): Set xleast field to 3. Set
- priv_level into symbol_value.
- * configure, config.in: Rebuild.
-
-Tue Dec 8 16:21:35 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * hpux-core.c (hpux_core_core_file_p): Change call to nonexistent
- warning function to call _bfd_error_handler instead.
-
- * libbfd.c (COERCE32): Cast through unsigned long and long to
- avoid bug in old version of gcc.
-
- * elf64-alpha.c (elf64_alpha_additional_program_headers): Remove.
- (elf_backend_additional_program_headers): Don't define.
-
-1998-12-08 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_final_link_relocate): Fix PC relative
- relocations to include offset of 2 included in the insns, and the
- offset of the relocs within the section.
-
-Wed Dec 2 15:03:59 1998 David Taylor <taylor@texas.cygnus.com>
-
- The following changes were made by David Taylor
- <taylor@texas.cygnus.com>, Edith Epstein
- <eepstein@sophia.cygnus.com>, Jim Blandy
- <jimb@zwingli.cygnus.com>, and Elena Zannoni
- <ezannoni@kwikemart.cygnus.com> as part of the project to merge in
- changes originally made by HP; HP did not create ChangeLog
- entries.
-
- * aclocal.m4, configure, Makefile.in: Rebuilt using latest
- automake macro library.
-
- * hpux-core.c (hpux_core_core_file_p): this function now
- understands HPUX 10.30 thread info. Yes, the thread stacks can be
- found in the corefile! Also, in hpux_core_core_file_p, if we
- encounter a section with an unknown type, don't punt. Instead,
- just skip it. Also, count the number of sections of known type
- that we encounter. If we encounter at least one good one, then
- we'll declare that the file is a core file. If we encounter any
- unknown ones but some known ones, then we'll issue a warning (but
- still declare it to be a core file). Also, correctly decide when a
- file is not a core.
- (PROC_INFO_HAS_THREAD_ID): define if CORE_ANON_SHMEM defined.
- (CORE_ANON_SHMEM): define if not defined.
- (hpux_core_struct): add members lwpid and user_tid.
- (core_kernel_thread_id, core_user_thread_id): new macros.
- (make_bfd_asection): use bfd_alloc to allocate room for a copy of
- the name before storing it in the bfd.
- (hpux_core_core_file_p): handle threads.
-
- * libhppa.h (GET_FIELD): protect against redefinition.
- (HPPA_WIDE): define.
- (GET_FIELD): define.
- (GET_BIT): define.
- (MASK): define.
- (CATENATE): define.
- (ELEVEN): define.
- (sign_extend): redefine.
- (assemble_6): define.
- (assemble_12): rewrite.
- (assemble_16): define.
- (assemble_16a): define.
- (assemble_17): rewrite.
- (assemble_22): define.
-
-1998-12-07 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_final_link_relocate): Using signed
- relocations for signed values.
-
-Sun Dec 6 16:30:33 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * mipsbsd.c (MY(set_arch_mach)): Make static.
- * aoutx.h (NAME(aout,machine_type)): For bfd_arch_mips, use
- bfd_mach_mips* macros rather than simple numbers.
-
- COFF weak symbol support, based on patches from Mark Elbrecht
- <snowball3@usa.net>:
- * coffcode.h (coff_slurp_symbol_table): Handle C_WEAKEXT.
- * coffgen.c (coff_renumber_symbols): Handle weak symbols.
- (coff_write_alien_symbol): Likewise.
- * cofflink.c (coff_link_check_ar_symbols): Likewise.
- (coff_link_add_symbols): Likewise.
- (_bfd_coff_link_input_bfd): Likewise.
- (_bfd_coff_write_global_sym): Likewise.
-
- * elf.c (copy_private_bfd_data): Always initialize the
- includes_phdrs field.
-
- * elflink.h (elf_fix_symbol_flags): Check for case where a non-ELF
- file defines a symbol first mentioned in an ELF file.
-
- * bfd-in.h: Always define BFD_HOST_64_BIT and BFD_HOST_U_64_BIT if
- possible, rather than only if BFD64.
- * elflink.h (compute_bucket_count): Just check BFD_HOST_U_64_BIT,
- not __GNUC__.
- * bfd-in2.h: Rebuild.
-
- * srec.c (srec_set_section_contents): Correct test to avoid
- switching to 4 byte addresses after seeing a second section which
- requires 3 byte addresses. From Joel Schantz
- <joel.schantz@argosys.boeing.com>.
-
- * config.bfd (m68*-*-gnu*): New target. From Aymeric Vincent
- <aymeric.vincent@emi.u-bordeaux.fr>.
-
-1998-12-04 Jim Blandy <jimb@zwingli.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Fix logic to
- decide whether the output file is -mrelocatable-lib,
- -mrelocatable, or neither. (gdb.base/nodebug.exp)
-
-1998-12-03 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c: Add support for R_FR30_48 reloc.
- * reloc.c: Add BFD_RELOC_FR30_48 relocation.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate
-
-Wed Dec 2 00:58:37 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_adjust_dynamic_symbol): Warn on an attempt to
- link against a dynamic symbol with no type or size.
-
-1998-12-01 Ulrich Drepper <drepper@cygnus.com>
-
- * elf32-i386.c (i386_check_relocs) [R_386_32]: Don't emit
- relocation for section which does not get loaded.
- (elf_i386_relocate_section) [R_386_32]: Likewise.
-
-Tue Dec 1 11:33:33 1998 Jim Wilson <wilson@cygnus.com>
-
- * coff-h8300.c (h8300_bfd_link_add_symbols): Make reloc_size,
- reloc_count and i long instead of unsigned long. Handle error
- return from bfd_canonicalize_reloc.
-
-1998-12-01 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_relocate_section): Detect the absence of
- a hash table.
-
-Mon Nov 30 15:28:09 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf32-sh.c (elf/sh.h): Include.
- sh_reloc_type: Delete. Changed all references to elf_sh_reloc_type.
- (sh_elf_howto_tab): Add HOWTO for R_SH_SWITCH8.
- (sh_reloc_map): Map BFD_RELOC_8_PCREL to R_SH_SWITCH8.
- (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH8.
- * Makefile.in: Add dependency of elf32-sh.lo on $(INCDIR)/elf/sh.h.
-
-Fri Nov 27 17:51:38 1998 Geoff Keating <geoffk@ozemail.com.au>
-
- * elflink.h (compute_bucket_count): Don't allow minsize==0, it
- causes division by zero later on.
-
-Thu Nov 26 11:19:35 1998 Dave Brolley <brolley@cygnus.com>
-
- * elf32-fr30.c (fr30_elf_pc9_reloc,fr30_elf_pc12_reloc): Not
- needed.
-
-1998-11-25 DJ Delorie <dj@cygnus.com>
-
- * coff-i386.c (i3coff_object_p): Remove hack. Use new emulation
- hook now.
-
-Tue Nov 24 10:25:27 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_elf_relocate_section): Call
- fr30_final_link_relocate.
- (fr30_final_link_relocate): New function: Handle I20 and I32
- relocs.
- (fr30_elf_i32_reloc): New function: Handle I32 relocs.
- (fr30_elf_pc9_reloc): New function: Handle 9_PCREL relocs.
- (fr30_elf_pc12_reloc): New function: Handle 12_PCREL relocs.
-
- * elf32-v850.c (v850_elf_relocate_section): Reset hi16s reloc
- chain to empty.
-
- The following changes are based on a patch submitted by Gianluca
- Moro <glctr@abc.it>:
-
- (v850_elf_perform_relocation): Only update a hi16s reloc if it has
- not already been updated.
- (find_remembered_hi16s_reloc): New parameter 'already_found'
- returns state of remembered hi16s reloc.
- (remember_hi16s_reloc): Set 'found' field to false.
- (hi16s_location): Add 'found' field.
-
-1998-11-23 DJ Delorie <dj@cygnus.com>
-
- * coff-i386.c (bfd_pe_dll_not_recognized_hack): the linker wants
- to see .DLL files as unrecognized.
- (i3coff_object_p): Sorry, had to hack it to not recognize these
- files (pei-i386) on request.
-
-1998-11-23 DJ Delorie <dj@cygnus.com>
-
- * opncls.c (bfd_make_readable): need more cleanup for symbols and
- relents. Call bfd_check_format to reinitialize.
-
-Fri Nov 20 14:21:36 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_elf_relocate_section): Remove spurious
- warnings.
-
-Thu Nov 19 14:42:15 1998 Geoffrey Noer <noer@cygnus.com>
-
- * aclocal.m4: regenerate
- * configure: regenerate
-
-Tue Nov 17 20:23:35 1998 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_entry): Add vtable_entries_size.
- * elf.c (_bfd_elf_link_hash_newfunc): Clear it.
- * elflink.h (elf_gc_propagate_vtable_entries_used): Copy it, and
- respect it as an upper bound on what memory to reference.
- (elf_gc_smash_unused_vtentry_relocs): Likewise.
- (elf_gc_record_vtentry): Handle as-yet undefined vtables. Set and
- update vtable_entries_size appropriately.
-
-Tue Nov 17 15:28:31 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-fr30.c (fr30_reloc_type_lookup): Used integers to hold
- reloc number.
-
-Mon Nov 16 22:19:21 1998 DJ Delorie <dj@cygnus.com>
-
- * archive.c (bfd_ar_hdr_from_filesystem): support BFD_IN_MEMORY
- bfds; they have no "file" so we fake it.
- * bfd-in2.h: add bfd_make_writable and bfd_make_readable (regen)
- * libbfd.c (bfd_write): Allow writing to BFD_IN_MEMORY bfds by
- resizing the memory buffer.
- * opncls.c (bfd_make_writable): New function; lets you write a
- bfd_create'd bfd to an in-memory buffer.
- (bfd_make_readable): New function; lets you read back that buffer
- as if it were from bfd_openr. Used to build generated archive
- members (winsup's ld's dlltool)
-
-Mon Nov 16 19:15:19 1998 Dave Brolley <brolley@cygnus.com>
-
- * po/bfd.pot: Regenerated.
-
-Mon Nov 16 10:57:06 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (hi16s_location): Replaced fixed size array with
- linked list.
-
-Sun Nov 15 20:28:25 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Search for the proper
- element of the gotentry list for local symbols too.
- (elf64_alpha_relocate_section): Unify local and global handling.
- Assert that gotent->use_count > 0.
-
-Sat Nov 14 15:16:01 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in (vms_alpha_vec): Rename from evax_alpha_vec, and
- update for file name changes of July 2, 1998.
- (vms_vax_vec): New.
- * configure: Rebuild.
-
-Thu Nov 12 19:19:54 1998 Dave Brolley <brolley@cygnus.com>
-
- * po/bfd.pot: Regenerated.
-
-Tue Nov 10 16:17:06 1998 Geoffrey Noer <noer@cygnus.com>
-
- * acinclude.m4, config.bfd: detect cygwin* instead of cygwin32*.
- * aclocal.m4, configure: regenerate
-
-Tue Nov 10 15:13:59 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (prep_headers): Add support for bfd_arch_fr30.
-
-Tue Nov 10 13:37:36 1998 Felix Lee <flee@cygnus.com>
-
- * acinclude.m4 (BFD_HAVE_SYS_PROCFS_TYPE,
- BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): didn't define macro when value
- was cached.
- * aclocal.m4, configure: regenerated.
-
-Tue Nov 10 14:31:01 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-d10v.c (reloc_type): Add R_D10V_GNU_VTINHERIT and
- R_D10V_GNU_VTENTRY relocs.
- (elf_d10v_howto_table): Likewise.
- (d10v_reloc_map d10v_reloc_map): Likewise.
- (elf32_d10v_gc_mark_hook): New.
- (elf32_d10v_gc_sweep_hook): New.
- (elf32_d10v_check_relocs): New.
- (elf32_d10v_relocate_section): New.
- (elf_backend_relocate_section): Define.
- (elf_backend_can_gc_sections): Define.
-
-Sat Nov 7 18:07:51 1998 Peter Schauer <peter.schauer@regent.e-technik.tu-muenchen.de>
-
- * Makefile.am (BFD32_BACKENDS): Move vms files here...
- (BFD64_BACKENDS): ...from here.
- (BFD32_BACKENDS_CFILES): Move vms files here...
- (BFD64_BACKENDS_CFILES): ...from here.
- * Makefile.in: Rebuild.
-
-Wed Nov 4 15:58:48 1998 Nick Clifton <nickc@cygnus.com>
-
- * Makefile.am: Add FR30 target.
- * Makefile.in: Add FR30 target.
- * archures.c: Add support for FR30.
- * config.bfd: Add support for FR30.
- * configure.in: Add support for FR30.
- * reloc.c: Add support for FR30 relocations.
- * targets.c: Add support for FR30 relocations.
- * bfd-in2.h: Regenerate.
- * configure: Regenerate.
- * libbfd.h: Regenerate.
- * cpu-fr30.c: New file.
- * elf32-fr30.c: New file.
-
-Mon Nov 2 14:59:33 1998 Geoffrey Noer <noer@cygnus.com>
-
- * configure.in: detect cygwin* instead of cygwin32*
- * configure: regenerate
-
-Sun Nov 1 19:32:28 1998 Jeffrey A Law (law@cygnus.com)
-
- * elf-m10300.c (mn10300_elf_relax_section): Do not use alloca,
- use bfd_malloc and free instead and check return value from bfd_malloc.
-
-Sun Nov 1 16:20:35 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd-in.h (_bfd_dwarf1_find_nearest_line): Declare.
- * libbfd.h: Rebuild.
-
- * elf32-mips.c (mips_elf_dynsym_sec_names): Comment out.
- (SIZEOF_MIPS_DYNSYM_SECNAMES): Likewise.
- (MIPS_TEXT_DYNSYM_SECN): Likewise.
- (_bfd_mips_elf_fake_sections): Don't set sh_info field of a .hash
- section.
- (struct mips_elf_link_hash_table): Remove dynsym_sec_strindex
- field.
- (mips_elf_link_hash_table_create): Don't initialize
- dynsym_sec_strindex.
- (mips_elf_gc_mark_hook): Add default case to avoid warning.
- (mips_elf_size_dynamic_sections): Generate a section symbol for
- every output section.
- (mips_elf_finish_dynamic_sections): Count all sections for
- DT_MIPS_UNREFEXTNO.
- (mips_elf_finish_dynamic_sections): Use dynamic symbols for all
- output sections.
-
-Sun Nov 1 12:46:53 1998 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Allocate two slots
- for later PLT entries in large PLTs.
- (ppc_elf_finish_dynamic_symbol): Allow for the extra slots.
-
-Sat Oct 31 20:10:09 1998 Jeffrey A Law (law@cygnus.com)
-
- * elf32-ppc.c (ppc_elf_reload_section): Fix typo.
-
-1998-10-26 15:58 Ulrich Drepper <drepper@cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_entry): Add new field elf_hash_value.
- * elflink.h (elf_collect_hash_codes): New function. This function is
- called for each exported symbol and we compute the ELF hash value for
- it.
- (compute_bucket_value): New function. It is called from
- size_dynamic_sections to determine the hash table size. When we are
- optimizing a better, but slower, algorithm is used.
- (size_dynamic_sections): Call compute_bucket_value.
-
- * elf.c (bfd_elf_hash): Optimize the hash function a bit.
-
-Mon Oct 19 20:03:21 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-sh.c: Add HOWTO entries for R_SH_GNU_VTINHERIT and
- R_SH_GNU_VTENTRY.
- (sh_elf_gc_mark_hook): New.
- (sh_elf_gc_sweep_hook): New.
- (sh_elf_check_relocs): New.
- (elf_backend_can_gc_sections): Define.
-
-Mon Oct 19 16:57:05 1998 Felix Lee <flee@cygnus.com>
-
- * acinclude.m4: undo previous gettext change
- * aclocal.m4: rebuild with right version of aclocal.
-
-Mon Oct 19 01:47:21 1998 Felix Lee <flee@cygnus.com>
-
- * acinclude.m4, aclocal.m4: move gettext-related fragments from
- aclocal.m4 to acinclude.m4, so they don't get lost.
-
- * elfcore.h: rewrite for better corefile support.
- * elf.c (elfcore_*): new functions.
- * elf-bfd.h (elf_obj_tdata): new structure members.
- * acconfig.h, acinclude.m4, configure.in: add feature-tests for
- flavor of procfs.
- * aclocal.m4, config.in, configure, Makefile.in: regenerated.
-
-Fri Oct 16 14:07:45 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-m32r.c: Add HOWTO entries for R_M32R_GNU_VTINHERIT
- and R_M32R_GNU_VTENTRY.
- (elf_backend_can_gc_sections): Define.
- (m32r_elf_check_relocs): New.
- (m32r_elf_gc_mark_hook): New.
- (m32r_elf_gc_sweep_hook): New.
- (m32r_elf_relocate_section): Handle VT relocs.
-
-Mon Oct 12 14:18:40 1998 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (arm_relocate_section): Remove redundant test.
-
- * bfd-in2.h (struct reloc_howto_struct): Improve comment to make
- cleat that the 'bitsize' field is the size of the bitfield AFTER
- relocation not before.
-
- * elf32-m32r.c (R_M32R_18_PCREL): Fix size of bitfield.
-
- * coff-mips.c (mips_relocate_hi): Cope with missing refhi or reflo
- relocs.
-
-Tue Oct 6 09:20:44 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-sparc.c: Add HOWTO entries for R_SPARC_GNU_VTINHERIT and
- R_SPARC_GNU_VTENTRY.
- (elf32_sparc_check_relocs): Handle them.
- (elf32_sparc_reloc_type_lookup): Likewise.
- (elf32_sparc_relocate_section): Likewise.
- (elf32_sparc_gc_mark_hook): New.
- (elf32_sparc_gc_sweep_hook): New.
-
-Mon Oct 5 14:55:30 1998 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_finish_writing): Perform some sanity checks when
- writing an executable or shared library.
-
-Mon Oct 5 12:02:31 1998 Gavin Romig-Koch <gavin@cygnus.com>
-
- * dwarf1.c : New file. Adds _bfd_dwarf1_find_nearest_line.
- * configure.in (elf): Add dwarf1.lo.
- * elf-bfd.h (elf_ob_tdata): Add dwarf1_find_line_info.
- * elf.c (_bfd_elf_find_nearest_line): Add call to
- _bfd_dwarf1_find_nearest_line.
- * elf32-mips.c (_bfd_mips_elf_find_nearest_line):
- Add call to _bfd_dwarf1_find_nearest_line.
- * configure: Rebuilt.
-
-Mon Oct 5 10:06:22 1998 Catherine Moore <clm@cygnus.com>
-
- * elflink.h (elf_gc_sections): Do not allow garbage
- collection if dynamic sections have been created.
-
-Mon Oct 5 09:07:37 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-v850.c: Add HOWTO entries for R_V850_GNU_VTINHERIT and
- R_V850_GNU_VTENTRY.
- (v850_elf_check_relocs): Handle VTINHERIT and VTENTRY relocs.
- (v850_elf_perform_relocation): Likewise.
- (v850_elf_final_link_relocate): Likewise.
- (v850_elf_relocate_section): Likewise.
- (v850_elf_gc_sweep_hook): New routine.
- (v850_elf_gc_mark_hook): New routine.
- (elf_backend_can_gc_sections): Define.
-
-Mon Oct 5 09:04:25 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-m68k.c (elf_m68k_gc_sweep_hook): Don't assume
- that dynobj exists.
-
-Sun Oct 4 23:29:34 1998 David Edelsohn <edelsohn@mhpcc.edu>
-
- * rs6000-core.c (rs6000coff_core_file_matches_executable_p):
- Declare size as bfd_size_type.
- (rs6000coff_get_section_contents): Declare count as bfd_size_type.
-
-Sun Oct 4 20:38:29 1998 Jeffrey A Law (law@cygnus.com)
-
- * cpu-hppa.c (bfd_hppa20_arch): Define. Link it into the bfd_hppa_arch
- structure.
- * som.c (CPU_PA_RISC2_0): Define.
- (_PA_RISC2_0_ID): Likewise.
- (som_finish_writing): Use CPU_PA_RISC2_0 for the system_id as needed.
-
-Sun Oct 4 21:19:09 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): When a versioned symbol
- has a base which is already defined, only add the referenced
- symbol to the dynamic symbol table if it is defined or referenced
- by a regular file.
-
- * elf32-i386.c (elf_i386_info_to_howto_rel): Handle vtable relocs
- correctly.
-
-1998-09-27 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elflink.h (elf_link_add_object_symbols): Undo last change.
-
-Wed Sep 23 16:09:31 1998 Richard Henderson <rth@cygnus.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't record a dynamic
- symbol for the indirect alias to a versioned symbol.
-
-Mon Sep 21 12:15:22 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-i386.c (elf32_i386_vtinherit_howto): New.
- (elf32_i386_vtentry_howto): New.
- (elf_i386_reloc_type_lookup): Return elf32_i386_vtentry_howto
- or elf32_i386_vtinherit_howto on lookup.
-
-Sun Sep 20 00:48:07 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf32-m68k.c: Include "elf/m68k.h". Remove definition of enum
- reloc_type. Rename R_68K__max to R_68K_max.
- (howto_table): Use _bfd_elf_rel_vtable_reloc_fn for a VTENTRY
- reloc.
-
-Sun Sep 20 00:09:25 1998 Chris Torek <torek@bsdi.com>
-
- * libbfd.c (bfd_getb32): Rewrite expression to get better code.
- (bfd_getl32, bfd_getb_signed_32, bfd_getl_signed_32): Likewise.
-
- * libbfd.c (bfd_log2): Cast to bfd_vma before shifting, not
- after.
-
-Sat Sep 19 22:42:23 1998 Doug Rabson <dfr@nlsystems.com>
-
- * elflink.h (elf_link_add_object_symbols): Ensure that the warning
- message has a null byte terminator.
-
-Fri Sep 18 14:35:29 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_perform_relocation): Ignore contents of
- word subject to R_V850_32 relocation.
-
-Thu Sep 17 17:20:36 1998 Nick Clifton <nickc@cygnus.com>
-
- * dwarf2.c: Add comment describing problem computing line numbers
- for undefined symbols at link time.
-
-Thu Sep 17 16:03:28 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't
- transform a defweak into a plt entry.
- (elf64_alpha_calc_dynrel_sizes): Allow room for secondary
- plt entry references to receive a RELATIVE reloc.
- (elf64_alpha_finish_dynamic_symbol): Fill them in.
- (elf64_alpha_relocate_section): Assert we don't overrun
- the allocated relocation space.
-
-Wed Sep 16 18:03:13 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (swap_out_syms): Always treat section symbols as
- special, even if they are attached to a common section.
-
-Wed Sep 16 10:34:13 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_symbol_processing): Move symbols in
- sections with v850 common section attributes into named v850
- common sections.
- (v850_elf_add_symbol_hook): Move symbols in sections with v850
- common section attributes into named v850 common sections.
-
-Wed Sep 16 11:26:49 CDT 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-arm.c (elf32_arm_gc_mark_hook): Remove print
- statement.
-
-1998-09-15 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Reverse output_offset
- part of Vladimir's change of 1998-08-19. Make a R_PPC_SDAREL16
- reloc to the wrong section a warning, not an error. .dynsbss
- is not an output section, so there is no need to check for it.
-
-Tue Sep 15 12:40:05 1998 Catherine Moore <clm@cygnus.com>
-
- * elf-bfd.h: Add argument to elf_backend_get_symbol_type.
-
-Tue Sep 15 08:34:40 1998 Catherine Moore <clm@cygnus.com>
-
- * elf.c (swap_out_syms): Pass type to elf_backend_get_symbol_type.
- * elf32-arm.c: Add HOWTO entries for R_ARM_GNU_VTINHERIT and
- R_ARM_GNU_VTENTRY.
- (elf32_arm_gc_mark_hook): New.
- (elf32_arm_gc_sweep_hook): New.
- (elf32_arm_check_relocs): New.
- (elf32_arm_final_link_relocate): Handle VTINHERIT and VTENTRY
- relocations.
- (elf32_arm_relocate_section): Handle VTINHERIT and VTENTRY
- relocations.
-
-1998-09-10 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): If dynobj is NULL,
- assume there is no PLT or GOT.
-
-Wed Sep 9 14:24:12 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.c (elf32_arm_find_nearest_line): New function: just
- like _elf_bfd_find_nearest_line() except that STT_ARM_TFUNC is
- also accepted as a function symbol type.
-
-Mon Sep 7 13:24:03 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
-
- * rs6000-core.c (_LONG_LONG): Define for AIX 4.x only.
-
-Sat Sep 5 20:40:18 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd-in.h (_bfd_nolink_bfd_gc_sections): Correct definition to
- match definition of _bfd_gc_sections field.
- * libbfd.h: Rebuild.
-
-Fri Sep 4 13:54:23 1998 David Miller <davem@dm.cobaltmicro.com>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Properly adjust
- the addend of a dynamic relocation referencing a section.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- (sparc64_elf_finish_dynamic_symbol): Fix the PLT relocation offset.
-
-Thu Sep 3 17:28:50 1998 Richard Henderson <rth@cygnus.com>
-
- * elflink.h (bfd_elfNN_size_dynamic_sections): Verify that the
- bed has a size_dynamic_sections routine before trying to use it.
-
-Mon Aug 31 14:49:22 1998 Richard Henderson <rth@cygnus.com>
-
- * elf32-mips.c (elf_mips_gnu_vtentry_howto): Use
- _bfd_elf_rel_vtable_reloc_fn.
-
-Mon Aug 31 10:23:40 1998 Catherine Moore <clm@cygnus.com>
-
- * Makefile.am: Add elf32-arm.c.
- * Makefile.in: Rebuild.
- * elf-bfd.h: Add elf_backend_get_symbol_type.
- * elf.c (swap_out_syms): If defined, call
- elf_backend_get_symbol_type.
- * elf32-arm.c: Define elf_backend_get_symbol_type.
- (elf32_arm_get_symbol-type): New routine.
- (record_thumb_to_arm_glue): Change to use STT_ARM_TFUNC.
- (bfd_elf32_arm_process_before_allocation): Change to
- check for STT_ARM_TFUNC.
- (elf32_arm_final_link_relocate): Likewise.
- * elfxx-target.h: Add elf_backend_get_symbol_type.
-
-Fri Aug 28 19:44:07 1998 Richard Henderson <rth@cygnus.com>
-
- * archures.c (bfd_mach_alpha_ev[456]): New.
- * cpu-alpha.c: Rework to match these types.
- * bfd-in2.h: Rebuild.
-
-Fri Aug 28 19:38:53 1998 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (_bfd_elf_rel_vtable_reloc_fn): Declare.
- * elf.c (_bfd_elf_rel_vtable_reloc_fn): New.
-
- * elf32-i386.c (elf_howto_table): Add vtable relocs.
- (elf_i386_reloc_type_lookup): Recognize them.
- (elf_i386_check_relocs): Pass them off to generic code.
- (elf_i386_relocate_section): Ignore them.
- (elf_i386_gc_mark_hook, elf_i386_gc_sweep_hook): New.
- (elf_backend_can_gc_sections): True.
-
-Thu Aug 20 15:03:45 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.c (elf32_thumb_to_arm_stub): Check sym_sec is not NULL
- before looking at owner field.
- (elf32_arm_to_thumb_stub): Ditto.
- (elf32_arm_relocate_section): Compute name before calling
- elf32_arm_final_link_relocate().
-
-Thu Aug 20 11:30:17 1998 Michael Snyder <msnyder@cleaver.cygnus.com>
-
- * elf.c: comment and formatting cleanups.
- * elfcore.h: ditto.
-
-Wed Aug 19 15:43:26 1998 Michael Snyder <msnyder@cleaver.cygnus.com>
-
- * elfcode.h (elf_object_p): Reject files of header type ET_CORE
- (core files are treated differently than object files).
- * elf-bfd.h (_bfd_elf_write_corefile_contents,
- bfd_elf_mkcorefile): declare.
- * elfxx-target.h (_bfd_elf_write_corefile_contents,
- bfd_elf_mkcorefile): add to bfd_target vector.
- * elfcore.h (elf_core_file_p): save the program header table,
- and set the bfd architecture from the elf file header.
- * elf.c (bfd_elf_mkcorefile): new function.
- (_bfd_elf_write_corefile_contents): new function.
- (assign_file_positions_for_segments): add cases for handling
- PT_NOTE segments. (assign_file_positions_except_relocs):
- core files should be handled the same as exec files.
- (prep_headers): identify core files as type ET_CORE.
- (copy_private_bfd_data): identify the sections belonging to
- the PT_NOTE segment.
-
- * elf32-sparc.c (elf32_sparc_final_write_processing):
- add break statement to default case.
-
-1998-08-19 Vladimir N. Makarov <vmakarov@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_relocate_section): Check that output
- section (not input) will be in sections ".sbss", ".sbss2",
- ".sdata", and ".sdata" for R_PPC_SDAREL16, R_PPC_EMB_SDA2REL,
- R_PPC_EMB_SDA21, R_PPC_EMB_RELSDA. In all these cases also ignore
- output_offset for correct evaluation of addend.
-
-Tue Aug 18 11:48:12 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-arm.c: Add prefix bfd_ to elf32_arm_get_bfd_for_interworking,
- elf32_arm_allocate_interworking_sections and
- elf32_arm_process_before_allocation.
-
-Tue Aug 18 11:46:00 1998 Nick Clifton <nickc@cygnus.com>
-
- * bfd-in.h: Ammend prototype for
- elf32_arm_process_before_allocation to remove surplus third
- argument.
-
- * bfd-in2.h: Regenerate.
-
-Sat Aug 15 20:55:08 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Handle indirect symbols.
-
-Fri Aug 14 09:12:28 1998 Stan Cox <scox@cygnus.com>
-
- * aoutx.h (aout_link_input_section_ext): Use the relocation already
- calculated for RELOC_SPARC_REV32 case.
-
-Thu Aug 13 14:02:02 1998 Catherine Moore <clm@cygnus.com>
-
- * bfd-in.h: Add prototypes for elf32_arm_get_bfd_for_interworking,
- elf32_arm_allocate_interworking_sections and
- elf32_arm_process_before_allocation.
- * bfd-in2.h: Regenerated.
- * elf32-arm.c Define elf32_arm_link_hash_table.
- (insert_thumb_branch): New routine.
- (find_thumb_glue): New routine.
- (find_arm_glue): New routine.
- (record_arm_to_thumb_glue): New routine.
- (record_thumb_to_arm_glue): New routine.
- (elf32_arm_link_hash_table_create): New routine.
- (elf32_arm_get_bfd_for_interworking): New routine.
- (elf32_arm_allocate_interworking_sections) New routine.
- (elf32_arm_process_before_allocation) New routine.
- (elf32_thumb_to_arm_stub): New routine.
- (elf32_arm_to_thumb_stub): New routine.
- (elf32_print_private_bfd_data): Fix typo.
- (elf32_arm_final_link_relocate): Add argument sym_sec.
- Check for branches to thumb symbols in case R_ARM_PC24.
- Check for branches to arm symbols in case R_ARM_THM_PC22.
- (elf32_arm_relocate_section): Pass symbol section to
- elf32_arm_final_link_relocate.
-
-Wed Aug 12 19:00:39 1998 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Generate PLT
- entries unless the symbol is defined in the executable; in
- particular, undefined weak symbols get a PLT entry.
-
-Wed Aug 12 14:48:33 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * libaout.h: Remove nested comment to avoid warning.
-
-Wed Aug 12 08:10:11 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-arm.c (elf32_arm_final_link_relocate): Rework
- R_ARM_PC24 relocation.
-
-Tue Aug 11 14:42:26 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-arm.c (elf32_arm_final_link_relocate): Remove unused
- argument is_local. Add argument sym_flags. Check sym_flags
- in R_ARM_ABS32 case. Include addend for R_ARM_THM_PC22 case.
- (elf32_arm_relocate_section): Don't pass local sym and pass
- sym_flags to elf32_arm_final_link_relocate.
-
-Mon Aug 10 20:38:39 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_calc_dynrel_sizes): Correct last change
- to not count too few relocs for dynamicly linked executables.
-
-Mon Aug 10 15:35:34 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Never consider
- symbols without a dynamic index dynamic. Consider all weak
- symbols dynamic.
- (elf64_alpha_strip_section_from_output): Don't assume 1-1
- correspondance between input and output sections.
-
-Mon Aug 10 15:31:39 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elflink.h (elf_gc_common_finalize_got_offsets): For backends
- that use a .got.plt section start the got offset at zero.
-
-Mon Aug 10 17:31:21 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_write_processor): Correct the processor ID written
- out for bfd_arch_m68k, accommodating change of March 25.
-
-Sun Aug 9 20:55:44 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-arm.c (elf32_arm_final_link_relocate): Rework
- R_ARM_THM_RPC22 relocations.
-
-Sat Aug 8 15:15:30 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Undef weak symbols
- are always dynamic.
- (elf64_alpha_calc_dynrel_sizes): Allow enough room for RELATIVE
- .got relocs in -Bsymbolic shared objects.
-
-Wed Aug 5 15:48:08 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.c: Add private flags to ELF header.
- (elf32_arm_print_private_bfd_data): New Function.
- (elf32_arm_set_private_flags): New Function.
- (elf32_arm_copy_private_flags): New Function.
- (elf32_arm_merge_private_bfd_data): New Function.
-
-Mon Aug 3 17:10:15 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_check_relocs): Permit WPLT30 against
- a local symbol.
- (elf32_sparc_relocate_section): Likewise.
-
-Sun Aug 2 03:19:23 1998 Richard Henderson <rth@cygnus.com>
-
- * elf32-ppc.c (ppc_elf_check_relocs): Init sgot to NULL. Create the
- .got if any relocation referrs to _GLOBAL_OFFSET_TABLE_.
- (ppc_elf_relocate_section): Pull sgot and splt search to the start
- of the function. Recognize no .plt as static linking.
-
-1998-08-01 Ulrich Drepper <drepper@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_section_from_shdr): Don't pass
- ".liblist" string through gettext.
-
-Fri Jul 31 16:38:14 1998 Catherine Moore <clm@cygnus.com>
-
- * Makefile.am: Add support for elf32-arm.lo.
- * Makefile.in: Rebuild.
- * config.bfd (arm-*-elf): Define targ_defvec and targ_selvecs.
- (thumb-*-elf): Define targ_defvec and targ_selvecs.
- * configure.in: Handle bfd_elf32_littlearm_vec and bfd_elf32_bigarm_vec.
- * configure: Regenerate.
- * elf.c: (prep_headers): Support arch_type of EM_ARM.
- * targets.c: Support new targets bfd_elf32_bigarm_vec and
- bfd_target bfd_elf32_littlearm_vec.
- * elf32-arm.c: New file.
-
-Tue Jun 28 19:05:28 1998 Stan Cox <scox@cygnus.com>
-
- * libaout.h (M_SPARCLITE_LE): New machine.
- * sunos.c (MACHTYPE_OK): Add machine M_SPARCLITE_LE.
- * aoutf1.h (sunos_set_arch_mach): Add machine M_SPARCLITE_LE.
- (sunos_write_object_contents): Add machine bfd_mach_sparc_sparclite_le
- * aoutx.h (howto_table_ext): Add relocation R_SPARC_REV32.
- (NAME(aout,machine_type)) Add machine bfd_mach_sparc_sparclite_le
- (aout_link_input_section_ext): Add RELOC_SPARC_REV32 support.
- * elf32-sparc.c (_bfd_sparc_elf_howto_table, sparc_reloc_map,
- elf32_sparc_relocate_section): Rename R_SPARC_32LE to be R_SPARC_REV32
- * libbfd.h (bfd_reloc_code_real_names): Rename BFD_RELOC_SPARC_32LE to
- be BFD_RELOC_SPARC_REV32.
- * reloc.c: Ditto.
- * config.bfd (sparc86x-*-aout): New
-
-Fri Jul 24 13:54:19 1998 Nick Clifton <nickc@cygnus.com>
-
- * linker.c (_bfd_generic_final_link): Allocate NULL symbol before
- actually mapping the output sections.
-
-Fri Jul 24 11:24:29 1998 Jeffrey A Law (law@cygnus.com)
-
-
- * elf-m10300.c (mn10300_elf_howto): Add R_MN10300_24 entry.
- (mn10300_elf_reloc_map): Similarly.
- (mn10300_elf_final_link_relocate): Handle R_MN10300_24.
-
-Fri Jul 24 12:36:04 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (elf_mips_howto_table): Add reloc types used on
- Irix 6.
- (bfd_elf32_bfd_reloc_type_lookup): Add default case.
- * elf64-mips.c: Replace all uses of mips_elf64_reloc_type with
- elf_mips_reloc_type defined in elf/mips.h.
-
-1998-07-24 Ulrich Drepper <drepper@cygnus.com>
-
- * elf64-mips.c: Remove reloc_type definition completely. It's now
- in elf/mips.h.
-
-Thu Jul 23 13:33:19 1998 Doug Evans <devans@canuck.cygnus.com>
-
- * elf64-mips.c (mips_elf64_reloc_type): #if 0 out more relocations
- as they are defined in elf/mips.h now.
-
-Thu Jul 23 11:29:43 1998 Jeffrey A Law (law@cygnus.com)
-
-
- * Re-add lost change:
- * elf-m10300.c (elf32_mn10300_link_hash_entry): Add new field
- "movm_stack_size".
- (mn10300_elf_relax_section): Include stack space for register saves
- in the imm8 field of a "call" instruction.
- (compute_function_info): Determine how much stack is allocated by
- the movm instruction. Fix typo.
- (elf32_mn10300_link_hash_newfunc): Initialize movm_stack_size.
-
-Thu Jul 23 11:38:05 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-sparc.c (elf_backend_got_header_size): Define as 4.
- * elf64-sparc.c (elf_backend_got_header_size): Define as 8.
-
-1998-07-22 Ulrich Drepper <drepper@cygnus.com>
-
- * elf32-ppc.c: Change use of pp_reloc_type to elf_ppc_reloc_type.
-
-Wed Jul 22 16:27:18 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-hppa.h: Let ELF header define the enum containing the
- external reloc numbers.
- * elf32-i386.h: Likewise.
-
-1998-07-22 14:57 Ulrich Drepper <drepper@cygnus.com>
-
- * elf-m10300.c: Let ELF header now define the macros to get the enum.
- * elf32-mips.c: Likewise.
- * elf32-ppc.c: Likewise.
-
-Wed Jul 22 13:53:52 1998 Nick Clifton <nickc@cygnus.com>
-
- * bfd-in2.h: Change type of 'class' parameter to 'unsigned int' in
- bfd_coff_set_symbol_class(), in order to avoid K&R compatability
- prblems.
- * bfd-in.h: Regenerate.
- * coffgen.c (bfd_coff_set_symbol_class): Change type of 'class'
- parameter to 'unsigned int' to avoid K&R compatability problems.
-
-Wed Jul 22 16:43:24 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_find_nearest_line): Change filename_ptr and
- functionname_ptr to be const. Change line_ptr to be unsigned.
-
- * coffcode.h (coff_link_output_has_begun): Simplify handling when
- macro is not defined. Change second parameter from bfd_link_info
- to coff_final_link_info. Add prototype.
- (coff_final_link_postscript): Simplify handling when macro is not
- defined. Add prototype.
-
-1998-07-22 13:08 Ulrich Drepper <drepper@cygnus.com>
-
- * elf-mn10300.c: Before include system specific ELF header define
- START_RELOC_NUMBERS, RELOC_NUMBER, and END_RELOC_NUMBERS.
- * elf32-mips.c: Likewise.
- * elf32-ppc.c: Likewise.
-
-Wed Jul 22 13:46:51 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf64-mips.c (mips_elf64_reloc_type): Copy Ulrich's elf32-mips.c
- temporary patch over to elf64-mips.c as well.
-
-1998-07-21 Ulrich Drepper <drepper@cygnus.com>
-
- * elf32-mips.c (reloc_type): Temporarily disable definition of
- standard relocation since they are now defined in elf/mips.h.
-
-Tue Jul 21 09:47:00 1998 Catherine Moore <clm@cygnus.com>
-
- * elf-m10200.c (mn10200_elf_final_link_relocate):
- Modify range test for case R_MN10200_8.
-
- * elf-m10300.c (mn10300_elf_final_link_relocate):
- Modify range test for case R_MN10300_8.
-
-Mon Jul 20 18:50:54 1998 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_backend_data): Add got_ & plt_header_size.
- * elf32-i386.c (elf_backend_got_header_size): Define.
- (elf_backend_plt_header_size): Define.
- * elf32-m68k.c, elf32-mips.c, elf32-ppc.c: Likewise.
- * elf32-sparc.c, elf64-alpha.c, elf64-sparc.c: Likewise.
- * elfxx-target.h: Provide a default of zero.
- * elflink.c (_bfd_elf_create_got_section): Use got_header_size.
- * elflink.h (elf_gc_common_finalize_got_offsets): Likewise.
-
- * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't remove a PLT
- entry from an executable, even if the plt refcount goes to 0.
-
-Mon Jul 20 12:47:26 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * aoutx.h (NAME(aout,find_nearest_line)): Also remember the
- directory name at the line number.
-
- * elf.c (_bfd_elf_find_nearest_line): Also consider symbols
- with an unspecified type.
-
-Wed Jul 15 11:20:01 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c: Add undef of valid to avoid problem on SunOS.
-
-Tue Jul 14 15:30:59 1998 Richard Henderson <rth@cygnus.com>
-
- * config.bfd (i?86-pc-beos{pe,elf,}*): Recognize.
-
-Tue Jul 14 11:22:21 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf32-m68k.c (elf_m68k_check_relocs): Also reference count
- R_68K_PCxx and R_68K_xx relocations. Make sure that
- ELF_LINK_HASH_NEEDS_PLT is always set for a PLT reloc reference.
- (elf_m68k_gc_sweep_hook): Also reference count R_68K_PCxx and
- R_68K_xx relocations.
- (elf_m68k_adjust_dynamic_symbol): Reset the plt offset of a symbol
- that has no plt entry.
- (elf_m68k_relocate_section): Ignore the plt offset in a static
- link.
- * elflink.h (elf_adjust_dynamic_symbol): Reset the plt offset for
- an ignored symbol.
- (elf_gc_common_finalize_got_offsets): Set the got offsets also in
- a static link.
-
- * elf32-m68k.c (R_68K_GNU_VTINHERIT, R_68K_GNU_VTENTRY): New reloc
- types.
- (howto_table, reloc_map): Add entries for them.
- (elf_m68k_check_relocs): Handle them. Implement reference
- counting for got and plt entries.
- (elf_m68k_gc_mark_hook, elf_m68k_gc_sweep_hook): New functions.
- (elf_m68k_adjust_dynamic_symbol): Handle unreferenced plt
- symbols.
- (rtype_to_howto_rel, elf_info_to_howto_rel): Delete.
- (elf_m68k_relocate_section): Handle the new reloc types.
- (bfd_elf32_bfd_final_link, elf_backend_gc_mark_hook,
- elf_backend_gc_sweep_hook, elf_backend_can_gc_sections): Define.
- * elflink.h (elf_link_add_object_symbols): When creating an
- indirect reference for symbol versioning also copy the plt
- offset.
- (elf_fix_symbol_flags): When clearing the ELF_LINK_HASH_NEEDS_PLT
- flag also reset the plt offset.
- (elf_link_assign_sym_version): Likewise.
- (elf_gc_common_finalize_got_offsets): Increment the got offset by
- the size of the entry in bytes.
- (elf_gc_allocate_got_offsets): Likewise.
-
-Tue Jul 14 11:18:14 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_gc_sections): Return true rather than falling off
- the bottom.
-
- * coffgen.c (bfd_coff_set_symbol_class): Call bfd_alloc, not
- xmalloc.
-
-Mon Jul 13 11:06:31 1998 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c: Supress definition of TARGET_UNDERSCORE and add a
- comment describing when it should be enabled.
- Changed definition of USER_LABEL_PREFIX to "", to fall into line
- with GCC sources.
-
-Mon Jul 13 13:06:54 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_slurp_external_symbols): Handle call optimization
- information ATN records.
-
-Fri Jul 10 16:31:06 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * ieee.c (ieee_slurp_external_symbols): Select an appropriate
- section for an absolute symbol in a fully linked file. Based on
- patch from Christian Holland <CHolland@de.lucent.com>.
-
-Wed Jul 8 11:29:56 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * coff-m88k.c (m88k_special_reloc): Don't lose the information
- that a symbol is undefined.
-
-Tue Jul 7 21:47:02 1998 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_bfd_gc_sections): Define.
-
-Mon Jul 6 11:35:50 1998 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (aoutarm_std_reloc_howto): Do not complain about
- overflows in ARM_26D patches, since they have already been
- implmented. Patch submitted by Dr. R.J. Black <rjb@dcs.gla.ac.uk>
-
-Sat Jul 4 12:25:36 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_write_object_contents): If we have any long
- section names, call coff_write_symbols even if there are no
- symbols.
-
-Fri Jul 3 13:11:35 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (copy_private_bfd_data): Only set phdr_included once for a
- PT_LOAD segment, rather than only setting it once for the entire
- file.
-
- * elf.c (_bfd_elf_make_section_from_shdr): When setting the LMA,
- rather than ignoring every phdr with a p_paddr of 0, ignore all
- the phdrs if they all have a p_paddr of 0.
-
- * stabs.c (_bfd_write_stab_strings): Check whether the .stabstr
- section was discarded from the link.
-
-Fri Jul 3 14:39:05 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * coff-sh.c (sh_insn_uses_freg): Ignore lowest bit of register number.
-
-Fri Jul 3 14:35:48 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * coff-sh.c (sh_insns_conflict): Load of fpscr conflicts with
- floating point operations.
-
-Thu Jul 2 18:37:25 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * cofflink.c (_bfd_coff_link_input_bfd): Skip undefined global
- function symbols.
-
-Thu Jul 2 14:59:42 1998 Klaus Kaempf <kkaempf@rmi.de>
-
- Merge of vax/vms (read-only) support
- * configure.com: Support Vax target.
- * makefile.vms: Support Vax target.
- * vms.h: Renamed from evax.h, merged vax/vms (read-only) support.
- * vms.c: Renamed from evax-alpha.c, merged vax/vms (read-only)
- support.
- * vms-hdr.c: Renamed from evax-emh.c, merged vax/vms (read-only)
- support.
- * vms-gsd.c: Renamed from evax-egsd.c, merged vax/vms (read-only)
- support.
- * vms-tir.c: Renamed from evax-etir.c, merged vax/vms (read-only)
- support.
- * vms-misc.c: Renamed from evax-misc.c, merged vax/vms (read-only)
- support.
- * libbfd.c (real_read): Use unbuffered read on VMS/Vax.
- * targets.c (bfd_target_ovax_flavour): New flavour.
- (vms_alpha_vec): Renamed from evax_alpha_vec.
- (vms_vax_vec): New.
- (target_vector): Update accordingly.
- * config.bfd (alpha*-*-*vms*): Use vms_alpha_vec, not
- evax_alpha_vec.
- (vax*-*-*vms*): New target.
- * Makefile.am: Update for renamed files. Rebuild dependencies.
- * bfd-in2.h: Rebuild.
- * configure.in, Makefile.in, aclocal.m4: Rebuild.
-
-Thu Jul 2 13:31:55 1998 Ian Lance Taylor <ian@cygnus.com>
-
- Based on patch from Matt Semersky <matts@scd.hp.com>:
- * linker.c (_bfd_generic_final_link): Force a trailing NULL
- pointer on abfd->outsymbols.
- (generic_add_output_symbol): Handle NULL sym parameter.
-
-Wed Jul 1 17:05:53 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (copy_private_bfd_data): Add support for changing VMA or
- LMA of sections.
-
-Wed Jul 1 16:58:50 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-sh.c (sh_relax_delete_bytes): Correct address comparisons
- when handling 32 bit immediate relocs.
- * elf32-sh.c (sh_elf_relax_delete_bytes): Likewise.
-
-Tue Jun 30 09:55:03 1998 Jeffrey A Law (law@cygnus.com)
-
- * section.c (STD_SECTION): Account for recently added gc_mark
- field in struct asection.
-
- * elf-m10300.c (bfd_mn10300_elf_merge_private_bfd_data): New function.
- (bfd_elf32_bfd_merge_private_bfd_data): Define.
-
-Thu Jun 25 18:31:41 1998 Richard Henderson <rth@cygnus.com>
-
- ELF Section-level Garbage Collection:
- * bfd.c (bfd_gc_sections): New.
- * aout-adobe.c: Hook to default implementation.
- * aout-target.h, aout-tic30.c, binary.c, bout.c: Likewise.
- * coff-alpha.c, coff-mips.c, coff-rs6000.c, coffcode.h: Likewise.
- * evax-alpha.c: Likewise.
- * i386msdos.c: Likewise.
- * i386os9k.c: Likewise.
- * ieee.c: Likewise.
- * ihex.c, nlm-target.h, oasys.c, ppcboot.c, srec.c: Likewise.
- * tekhex.c, versados.c: Likewise.
- * libbfd-in.h (_bfd_nolink_bfd_gc_sections): New.
- * targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_gc_sections.
-
- * reloc.c (BFD_RELOC_VTABLE_INHERIT, BFD_RELOC_VTABLE_ENTRY): New.
- (bfd_generic_gc_sections): New.
- * section.c (SEC_KEEP): New.
- (asection): Add gc_mark member.
-
- * elfcode.h (elf_gc*): New name remappings.
- * elflink.h (elf_link_input_bfd): Don't set contents on stabs
- sections to be excluded.
- (elf_gc_mark, elf_gc_sweep, elf_gc_sweep_symbol): New.
- (elf_gc_propogate_vtable_entries_used): New.
- (elf_gc_smash_unused_vtentry_relocs): New.
- (elf_gc_sections, elf_gc_record_vtinherit, elf_gc_record_vtentry): New.
- (elf_gc_common_finalize_got_offsets): New.
- (elf_gc_allocate_got_offsets, elf_gc_common_final_link): New.
- * elfxx-target.h: Add and default gc hooks.
-
- * elf-bfd.h (struct elf_link_hash_entry): Swap got_offset/plt_offset
- for unions.
- (struct elf_obj_tdata): Likewise for local_got_offsets.
- * elf.c, elf-i386.c, elf32-m68k.c, elf32-mips.c: Update all uses.
- * elf32-ppc.c, elf32-sparc.c, elf64-alpha.c: Likewise.
- * elf64-sparc.c, elflink.h: Likewise.
-
- * elf-bfd.h (struct elf_link_hash_entry): Add vtable members.
- (ELF_LINK_HASH_MARK): Define.
- (struct elf_backend_data): Add GC hooks.
- * elf.c (_bfd_elf_link_hash_newfunc): Zero vtable members.
-
- * elf-m10300.c (mn10300_elf_check_relocs): New.
- (mn10300_elf_gc_mark_hook): New.
- (R_MN10300_GNU_VTINHERIT, R_MN10300_GNU_VTENTRY): New.
- (elf_mn10300_howto, mn10300_reloc_map): Handle them.
- (mn10300_elf_final_link_relocate): Likewise.
- (mn10300_elf_relocate_section): Likewise.
- (elf_backend_can_gc_sections): Define.
- * elf32-mips.c (R_MIPS_GNU_VTINHERIT, R_MIPS_GNU_VTENTRY): New.
- (elf_mips_gnu_vtinherit_howto, elf_mips_gnu_vtentry_howto): New.
- (bfd_elf32_bfd_reloc_type_lookup): Handle them.
- (mips_info_to_howto_rel): Likewise.
- (mips_elf_relocate_section): Likewise.
- (mips_elf_check_relocs): Likewise.
- (mips_elf_gc_mark_hook, mips_elf_gc_sweep_hook): New.
- (elf_backend_can_gc_sections): Define.
- * elf32-ppc.c (R_PPC_GNU_VTINHERIT, R_PPC_GNU_VTENTRY): New.
- (ppc_elf_howto_raw): Handle them.
- (ppc_elf_reloc_type_lookup): Likewise.
- (ppc_elf_relocate_section): Likewise.
- (ppc_elf_check_relocs): Reference count .got and .plt entries.
- Handle new vtable relocs.
- (ppc_elf_adjust_dynamic_symbol): Recognize unused .plt entries.
- (ppc_elf_gc_mark_hook, ppc_elf_gc_sweep_hook): New.
- (elf_backend_can_gc_sections): Define.
-
-Fri Jun 26 10:48:23 1998 Jeffrey A Law (law@cygnus.com)
-
- * archures.c (bfd_mach_mn10300): Define.
- * elf-m10300.c: Include elf/mn10300.h
- (elf_mn10300_mach): New function.
- (_bfd_mn10300_elf_final_write_processing): Likewise.
- (_bfd_mn10300_elf_object_p): Likewise.
- (elf_backendfinal_write_processing): Define.
- (elf_backend_object_p): Likewise.
-
-Thu Jun 25 18:31:08 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_perform_relocation): Fix HI16_S
- relocation.
-
-Wed Jun 24 17:17:57 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_bfd_final_link): Loop over input_bfds using the
- link_next field, not the next field.
-
-Sun Jun 21 19:38:39 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (map_sections_to_segments): Check the section address
- against the phdr size both with and without a modulo of
- maxpagesize.
-
-Fri Jun 19 17:08:18 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_size_dynamic_sections): Only strip a
- linker created empty input section if the output section has the
- same name.
-
- * elflink.h (elf_link_output_extsym): Print an error message if
- _bfd_elf_section_from_bfd_section fails.
-
- * elf.c (_bfd_elf_section_from_bfd_section): Call bfd_set_error on
- failure.
-
-Tue Jun 16 11:55:55 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (copy_private_bfd_data): Improve handling of Solaris
- native linker output. Avoid putting an empty section in more than
- one segment.
-
-Fri Jun 12 13:30:17 1998 Tom Tromey <tromey@cygnus.com>
-
- * po/Make-in (all-yes): If maintainer mode, depend on .pot file.
- ($(PACKAGE).pot): Unconditionally depend on POTFILES.
-
-Fri Jun 12 13:34:02 1998 Doug Evans <devans@canuck.cygnus.com>
-
- * elf.c (swap_out_syms): New arg relocatable_p.
- Don't add section VMA to symbols for relocatable output.
- (_bfd_elf_compute_section_file_positions): Update call to
- swap_out_syms.
-
-Mon Jun 8 15:20:57 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_perform_relocation): Make comparisons
- against 'addend' be signed rather than unsigned.
-
-Sat Jun 6 00:31:21 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-m32r.c: Add prototyps for static functions.
-
- * coff-arm.c: Add prototypes for static functions.
-
-Fri Jun 5 17:21:51 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (elf_sort_sections): Sort by LMA first then VMA, since the
- LMA is used to order sections in a segment.
-
- * elf32-v850.c: Add prototypes for static functions.
- Change type of addend parameter to bfd_vma in various functions.
-
-Fri Jun 5 18:09:58 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutx.h (howto_table_ext): Change RELOC_BASE13 to use
- complain_overflow_signed instead of complain_overflow_bitfield.
-
-Fri Jun 5 15:11:11 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf.c (elf_map_symbols): Don't add section VMA to symbol value
- when comparing against 0.
-
-Wed Jun 3 17:52:49 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (config.status): New target.
- * Makefile.in: Rebuild.
-
-Wed Jun 3 12:18:24 1998 Stan Cox <scox@equinox.cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Give an
- error if previous object endianness doesn't match current object.
-
-Tue Jun 2 17:50:59 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_print_private_bfd_data): Call
- _bfd_elf_print_private)bfd_data ().
-
-Tue Jun 2 15:29:35 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elflink.h (elf_merge_symbol): Don't always set type_change_ok
- and size_change_ok.
- (elf_link_add_object_symbols): Set type_change_ok and
- size_change_ok before calling elf_merge_symbol.
-
- * elf32-mips.c (mips_elf_relocate_section): If we issue an
- undefined symbol error, don't also issue an overflow error.
-
-Tue Jun 2 13:51:00 1998 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_relocate_section): The target of an
- R_PPC_LOCAL24PC relocation should be local; if not, print an error
- message instead of crashing.
-
-Mon Jun 1 18:23:12 1998 Yuli Barcohen <yuli.barcohen@telrad.co.il>
-
- * archures.c (bfd_mach_cpu32): Define.
- (bfd_default_scan): Add case for 68060. Fix 68332 case to use
- bfd_mach_cpu32.
- * cpu-m68k.c (arch_info_struct): Add m68k:cpu32.
- * ieee.c: Include <ctype.h>.
- (ieee_object_p): Parse out process ID string to make it more
- likely to be acceptable for bfd_scan_arch.
- * bfd-in2.h: Rebuild.
-
-Mon Jun 1 11:12:02 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-m32r.c (m32r_elf_print_private_bfd_data): Also call
- _bfd_elf_print_private_bfd_data() so that the program header will
- be displayed.
-
-Mon Jun 1 12:14:28 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (coff_swap_sym_in): Check for C_SECTION rather than
- 0x68. Reindent. Add some comments.
-
-Fri May 29 09:58:08 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf.c (copy_private_bfd_data): Adjust physical address of
- segment in output BFD to contain LMAs of its sections.
-
-Tue May 26 19:37:47 1998 Stan Cox <scox@equinox.cygnus.com>
-
- * elf32-sparc.c (_bfd_sparc_elf_howto_table, sparc_reloc_map,
- elf32_sparc_relocate_section): Added R_SPARC_32LE for little
- endian data 32 bit relocations.
- (elf32_sparc_merge_private_bfd_data): Check if linking little
- endian objects with big endian objects.
- (elf32_sparc_object_p): Set bfd_mach_sparc_sparclite_le.
- (elf32_sparc_final_write_processing): Set EF_SPARC_LEDATA in e_flags.
- * libbfd.h (bfd_reloc_code_real_names): Added BFD_RELOC_SPARC_32LE.
- * reloc.c: Same.
- * cpu-sparc.c (arch_info_struct): Added sparc:sparclite_le
- * archures.c (bfd_mach_sparc_sparclite_le): New.
- * bfd-in2.h (BFD_RELOC_SPARC_32LE, bfd_mach_sparc_sparclite_le): New.
-
-Thu May 21 16:59:28 1998 Nick Clifton <nickc@cygnus.com>
-
- * peicode.h (add_data_entry): Fix precedence of operators in if ()
- statement.
-
-Tue May 19 18:41:19 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd-in.h: Move over patch to bfd-in2.h.
-
- * reloc.c (bfd_check_overflow): Add casts before shifts which may
- not fit in 32 bits.
- (_bfd_relocate_contents): Likewise.
-
-Mon May 18 14:44:15 1998 Nick Clifton <nickc@cygnus.com>
-
- * peicode.h (add_data_entry): If the section has no private data
- then do not create a Data Dictionary entry for it.
-
-Mon May 18 00:09:28 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Set again on changes.
- (elf64_alpha_can_merge_gots, elf64_alpha_merge_gots,
- elf64_alpha_size_got_sections): Rewrite, handling multiple got
- subsections during relaxation more correctly.
-
-Thu May 14 14:22:58 1998 Nick Clifton <nickc@cygnus.com>
-
- * bfd-in2.h: Add new prototype: bfd_coff_set_symbol_class ().
- Add extra argument to bfd_arm_process_before_allocation ().
- * bfd-in.h: Reflect changes made in bfd-in2.h.
- * coffgen.c (bfd_coff_set_symbol_class): New function. Set the
- coff class of a BFD symbol.
- * coff-arm.c: Add support for interworking between Thumb code and
- non-interworking aware ARM code.
-
-Sun May 10 22:33:59 1998 Jeffrey A Law (law@cygnus.com)
-
- * po/Make-in (install-info): New target.
-
-Thu May 7 17:40:56 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * filemode.c: Remove; not used.
-
- If sysdep.h includes a header file, don't include it again:
- * aix386-core.c: Don't include <stdio.h>, <stddef.h>, or
- <errno.h>.
- * aoutx.h: Don't include <string.h>. Use "sysdep.h" rather than
- <sysdep.h>.
- * archive.c: Don't include <string.h> or <errno.h>.
- * evax-alpha.c: Don't include <stdio.h>.
- * evax-egsd.c: Likewise.
- * evax-etir.c: Likewise.
- * evax-misc.c: Likewise.
- * evax-emh.c: Likewise. Also, don't include <sys/types.h>.
- * hppabsd-core.c: Don't include <stdio.h>, <sys/types.h>, or
- <errno.h>.
- * hpux-core.c: Likewise.
- * netbsd-core.c: Likewise.
- * som.c: Likewise.
- * libbfd.c: Don't include <sys/types.h>.
- * nlmcode.h: Don't include <string.h>.
- * osf-core.c: Don't include <string.h> or <stdio.h>.
- * ptrace-core.c: Don't include <stdio.h>, <sys/types.h>,
- <errno.h>, or <unistd.h>.
- * trad-core.c: Don't include <stdio.h> or <sys/types.h>.
-
-Thu May 7 13:12:50 1998 Klaus Kaempf <kkaempf@progis.de>
-
- * configure.com: If the version number can not be found in
- configure.in, set it to "unknown" rather than "2.8.1".
-
-Wed May 6 09:46:05 1998 Gavin Koch <gavin@cygnus.com>
-
- * elf32-mips.c (elf_mips_mach): New.
- (_bfd_mips_elf_object_p): Use elf_mips_mach.
- (_bfd_mips_elf_final_write_processing): Use the names
- of machines, rather than the numbers. Set both the ARCH
- and MACH in e_flags. Handle a few more specific machines.
- (_bfd_mips_elf_merge_private_bfd_data): Merge both
- EF_MIPS_ARCH and EF_MIPS_MACH.
-
-Tue May 5 21:01:53 1998 Richard Henderson <rth@cygnus.com>
-
- * syms.c (bfd_is_local_label): Revert last change.
- * srec.c (srec_write_symbols): Discard debugging symbols.
-
-Tue May 5 23:36:06 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * som.c: Include <ctype.h>.
- * som.h: Don't include sysdep.h.
-
-Tue May 5 18:29:24 1998 Tom Tromey <tromey@cygnus.com>
-
- * libbfd.h: Rebuilt.
- * libbfd-in.h: Removed gettext includes and defines.
- * sysdep.h: Moved gettext-related includes and defines here.
-
-Tue May 5 16:47:54 1998 Richard Henderson <rth@cygnus.com>
-
- * srec.c (srec_write_symbols): Use bfd_is_local_label rather than
- an ad-hoc test. Kill bogus #if 0 code.
- * syms.c (bfd_is_local_label): Consider BSF_DEBUGGING symbols local.
-
-Mon May 4 16:10:33 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * sunos.c (sunos_check_dynamic_reloc): Don't use the PLT address
- when generating a normal executable for a symbol defined in a
- regular file. When copying a reloc into the output file, adjust
- the addend for a PC relative reloc against a global symbol.
-
-Mon May 4 10:08:18 1998 Tom Tromey <tromey@cygnus.com>
-
- * libbfd.h: Rebuilt.
- * libbfd-in.h (_): Define as dgettext.
-
-Mon May 4 11:02:23 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-arm.c (coff_arm_relocate_section): Cast to bfd_signed_vma,
- not signed.
- * peicode.h (pe_saved_coff_bfd_print_private_bfd_data): Use PARAMS
- when declaring parameter types.
- (pe_saved_coff_bfd_copy_private_bfd_data): Likewise.
-
-Wed Apr 29 15:35:03 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * config.bfd: If we include any ELF targets in targ_defvec and/or
- targ_selvecs, then add the generic ELF targets to targ_selvecs.
- * elf32-gen.c (dummy): New static const variable.
- (elf_generic_info_to_howto): New static function.
- (elf_generic_info_to_howto_rel): New static function.
- (elf_info_to_howto): Define as elf_generic_info_to_howto.
- (elf_info_to_howto_rel): Define as elf_generic_info_to_howto_rel.
- * elf64-gen.c: Same changes as elf32-gen.c.
- * elfcode.h (elf_object_p): For the generic target, ignore a
- failure of bfd_default_set_arch_mach. Fix indentation a bit.
-
-Tue Apr 28 20:05:52 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in (WIN32LIBADD): Add -lintl on cygwin32.
- * configure: Rebuild.
-
-Tue Apr 28 12:16:57 1998 Jason Molenda (crash@bugshack.cygnus.com)
-
- * config.bfd: Update OSR5/Unixware patterns.
-
-Mon Apr 27 18:02:24 1998 Richard Henderson <rth@cygnus.com>
-
- * elf.c (assign_file_positions_for_segments): Allow for holes
- between sections added by a link script.
-
-Mon Apr 27 11:49:55 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Change version number to 2.9.4
- * configure: Rebuild.
-
- Based on patch from H.J. Lu <hjl@gnu.org>:
- * elf.c (bfd_elf_get_bfd_needed_list): New function.
- * bfd-in.h (bfd_elf_get_bfd_needed_list): Declare.
- * bfd-in2.h: Rebuild.
-
-Sat Apr 25 20:07:53 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (struct alpha_relax_info): Replace elfsym with other.
- Change all users.
-
-Sat Apr 25 18:29:07 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (struct alpha_relax_info): Add tsec & elfsym members.
- (elf64_alpha_relax_section): Fill them in.
- (elf64_alpha_relax_opt_call): Implement more than a stub.
- (elf64_alpha_add_symbol_hook): Don't set SEC_LOAD or default
- alignment on .scommon.
- (elf64_alpha_merge_gots): Merge use counts as well.
-
-Sat Apr 25 14:07:29 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Use the proper section
- for calculating a local symbol's address.
- (elf64_alpha_calc_got_offsets): Skip entries with 0 use count.
- Set the .got's cooked size as well as the raw size.
-
-Fri Apr 24 09:16:00 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_print_private_bfd_data): Add
- internationalisation of printed information.
-
- * coff-arm.c (coff_arm_print_private_bfd_data): Add
- internationalisation of printed information.
-
-Fri Apr 24 12:09:18 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * syms.c (struct indexentry): Change directory_name, file_name,
- and function_name fields to char *.
- (struct stab_find_info): Change cached_file_name field to char *.
-
-Thu Apr 23 08:13:04 1998 Nick Clifton <nickc@cygnus.com>
-
- * peicode.h (dir_names): Add missing N_() macros to dir_names array.
-
-Wed Apr 22 13:06:15 1998 Tom Tromey <tromey@cygnus.com>
-
- * po/Make-in (MKINSTALLDIRS): Don't look in $(top_srcdir).
-
-Wed Apr 22 17:48:48 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (install-data-local): Make $(includedir).
- * Makefile.in: Rebuild.
-
-Wed Apr 22 13:06:15 1998 Tom Tromey <tromey@cygnus.com>
-
- * libbfd-in.h: Use `gettext' and not `dgettext' for now.
-
-Wed Apr 22 12:53:40 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (INCLUDES): Add -I$(srcdir)/../intl -I../intl.
- * Makefile.in: Rebuild.
-
- * bfd-in2.h: Rebuild for Nick's changes.
-
-Tue Apr 21 23:11:51 1998 Richard Henderson <rth@cygnus.com>
-
- * archive.c (_bfd_generic_read_ar_hdr_mag): Fix lossage in last
- change wrt length == max_namelen.
-
-Tue Apr 21 21:19:36 1998 Tom Tromey <tromey@scribbles.cygnus.com>
-
- * Many files: Added gettext invocations around user-visible
- strings.
- * libbfd-in.h: Added gettext includes and defines.
- * acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
- HAVE_LC_MESSAGES): Define.
- * configure.in: Call CY_GNU_GETTEXT. Create po/Makefile.in and
- po/Makefile.
- * Makefile.am (SUBDIRS): Added po.
- (POTFILES): New macro.
- (po/POTFILES.in): New target.
- (SOURCE_HFILES): New macro.
- (HFILES): Use it.
- * po/Make-in, po/POTFILES.in, po/bfd.pot: New files.
-
-Tue Apr 21 13:38:18 1998 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
-
- * elfcore.h (bfd_prstatus): Copy core_prstatus from the first
- NT_PRSTATUS note section encountered, it contains the status of
- the currently executing thread when the core file was written.
-
-Tue Apr 21 10:00:12 1998 Nick Clifton <nickc@cygnus.com>
-
- * libcoff.h: Add extra parameter to
- bfd_coff_link_output_has_begun overrideable function.
- * cofflink.c: Pass extra parameter to
- bfd_coff_link_output_has_begun function.
- * bfd-in.h: Add prototypes for exported ARM interworking
- functions.
- * peicode.h: ARM specific code reorganised to conform to BFD
- coding conventions.
- * coffcode.h: ARM specific code reorganised to conform to BFD
- coding conventions.
- * coff-arm.c: Code reorganised to conform to the BFD coding
- conventions. Global variables have been moved into an ARM
- specific hash table structure and a new function:
- bfd_arm_get_bfd_for_interworking() has been created which is
- called from the linker scripts.
-
-Tue Apr 21 00:11:51 1998 Richard Henderson <rth@cygnus.com>
-
- * archive.c (_bfd_generic_read_ar_hdr_mag): Simplify end-of-name test.
-
- * elf64-alpha.c (elf64_alpha_find_reloc_at_ofs): Renamed from
- elf64_alpha_relax_find_reloc_ofs. Changed all callers.
- (elf64_alpha_add_symbol_hook): Put small commons in .scommon not .sbss.
- (elf64_alpha_size_got_sections): Don't merge .got sections twice.
-
-Sat Apr 18 01:21:04 1998 Stan Cox <scox@cygnus.com>
-
- * config.bfd: Added sparc86x support.
-
-Fri Apr 17 22:29:04 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf32-mips.c (mips_elf_relocate_section): Do not complain about
- an out of range pc-relative jump/call to an undefined weak symbol.
-
-Thu Apr 16 13:49:00 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c (elf64_alpha_do_reloc_gpdisp): Do all gpdisp
- comparisons signed.
-
-Thu Apr 16 11:43:33 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * archive.c (bfd_generic_archive_p): If a slurp subroutine returns
- an error other than bfd_error_system_call, set the error to
- bfd_error_wrong_format.
-
- * targets.c (bfd_target_vector) [SELECT_VECS not defined]: Add
- bfd_elf32_powerpcle_vec.
-
- * elf.c (copy_private_bfd_data): If all the p_paddr fields in the
- program segments are zero, don't set p_paddr_valid.
-
-Wed Apr 15 22:15:16 1998 Richard Henderson <rth@cygnus.com>
-
- * elf64-alpha.c: Initial implementation of relaxation --
- (struct alpha_elf_link_hash_entry): Add use_count member.
- (elf64_alpha_check_relocs): Initialize and increment it.
- (elf64_alpha_can_merge_gots): Check it when considering merging.
- (elf64_alpha_merge_gots): Drop entries with zero use.
- (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
- (elf64_alpha_always_size_sections): Split out got sizing ...
- (elf64_alpha_size_got_sections): ... here. New function.
- (elf64_alpha_relax_find_reloc_ofs): New function.
- (elf64_alpha_relax_with_lituse): Likewise.
- (elf64_alpha_relax_without_lituse): Likewise.
- (elf64_alpha_relax_opt_call): Likewise.
- (elf64_alpha_relax_section): Likewise.
- (elf64_alpha_add_symbol_hook): Likewise.
- (elf64_alpha_howto_table): Implement GPRELHIGH/LOW & IMMED_GP_16.
- (elf64_alpha_relocate_section): Likewise.
- (bfd_elf64_bfd_relax_section): Define.
- (elf_backend_add_symbol_hook): Likewise.
-
-Wed Apr 15 16:08:46 1998 Richard Henderson <rth@cygnus.com>
-
- * elf.c (prep_headers): Use new EM_SPARCV9 symbol.
- * elf64-sparc.c (ELF_MACHINE_CODE): Likewise.
- (ELF_MACHINE_ALT1): New. Set to EM_OLD_SPARC64.
-
-Wed Apr 15 11:34:33 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Add -lkernel32 to WIN32LIBADD on cygwin32.
- * configure: Rebuild.
-
-Mon Apr 13 16:46:27 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (libbfd_la_LIBADD): Add @WIN32LIBADD@.
- (libbfd_la_LDFLAGS): Add @WIN32LDFLAGS@.
- * configure.in: Define and substitute WIN32LDFLAGS and
- WIN32LIBADD.
- * aclocal.m4: Rebuild with new libtool.
- * configure, Makefile.in: Rebuild.
-
-Fri Apr 10 13:44:27 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_write_object_contents): Move a PE COMDAT symbol
- before any other symbols in the same section.
-
-Wed Apr 8 14:50:23 1998 Michael Meissner <meissner@cygnus.com>
-
- * config.bfd (powerpc*-*-*): Remove PowerPC NT support from ELF
- systems.
-
-Tue Apr 7 16:25:31 1998 Gavin Romig-Koch <gavin@cygnus.com>
-
- * dwarf2.c (comp_unit): Move it earlier in the source. Add
- addr_size.
- (read_address): Replace 'bdf*' argument with 'comp_unit*' argument.
- Use addr_size for address size, rather than sizeof(bfd_vma).
- (read_attribute): Replace bdf* argument with 'comp_unit*' argument.
- Fix call to read_address.
- (decode_line_info): Replace bdf* argument with 'comp_unit*' argument.
- Scrap other unneeded arguments. Fix call to read_address.
- (scan_unit_for_functions): Fix call to read_attribute.
- (parse_comp_unit): We now handle more values for addr_size.
- Set addr_size in unit. Fix call to read_attribute and
- decode_line_info.
-
-Tue Apr 7 15:44:47 1998 Gavin Romig-Koch <gavin@cygnus.com>
-
- * dwarf2.c (parse_comp_unit): Drop use of unit->name when it is null.
-
-Tue Apr 7 12:35:18 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * archures.c (bfd_default_scan): Add m68k cases back to default
- switch, reverting patch of March 25, since IEEE support depends
- upon them.
-
-Mon Apr 6 14:06:40 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (diststuff): New target.
- * Makefile.in: Rebuild.
-
-Sun Apr 5 16:21:44 1998 Jeffrey A Law (law@cygnus.com)
-
- * som.c (som_bfd_ar_write_symbol_stuff): Fix computation of
- som_offset when we have an extended name table.
-
-Sun Apr 5 16:04:39 1998 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am (stamp-lib): Check that .libs/libbfd.a exists before
- trying to copy it.
- * Makefile.in: Rebuild.
-
-Fri Apr 3 11:09:42 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Generate section
- symbols when creating a shared library.
- (elf_m68k_adjust_dynindx): New function, used by above code.
- (elf_m68k_finish_dynamic_sections): Initialize the section
- symbols.
- (elf_m68k_relocate_section): Change abort to BFD_ASSERT.
-
-Wed Apr 1 16:04:02 1998 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (in_reloc_p): Use ARM_RVA32 in place of constant
- value 11.
-
-Wed Apr 1 13:36:58 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * elf32-m68k.c (elf_m68k_relocate_section, case R_68K_PLT*O): Fix
- assertion.
-
-Tue Mar 31 00:12:12 1998 Jeffrey A Law (law@cygnus.com)
-
- * elf-m10300.c (mn10300_elf_relax_section): Correctly handle
- absolute symbols.
-
-Mon Mar 30 12:46:15 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Set version to 2.9.1.
- * configure: Rebuild.
-
- * Branched binutils 2.9.
-
-Mon Mar 30 12:20:50 1998 Brent Baccala <baccala@freesoft.org>
-
- * syms.c (ENABLE_CACHING): Define.
- (struct indexentry): Define.
- (struct stab_cache): Remove.
- (cmpindexentry): New static function.
- (struct stab_find_info): Add new fields: indextable,
- indextablesize, cached_indexentry, cached_offset, cached_stab, and
- cached_file_name. Remove fields: file_cache, function_cache, and
- line_cache.
- (_bfd_stab_section_find_nearest_line): Rewrite to build a sorted
- index table and search it.
-
-Mon Mar 30 10:39:34 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (_bfd_elf_copy_private_section_data): Call
- copy_private_bfd_data once we've seen the last SEC_ALLOC section.
-
- * cpu-mips.c: Remove trailing comma at end of enumeration list.
-
-Sat Mar 28 16:33:02 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-arm.c: Define all globally visible variables and functions
- only when COFF_WITH_PE is not defined.
- * configure.in (armpe_little_vec, armpe_big_vec): Add
- coff-arm.lo.
- * configure: Rebuild.
-
-Fri Mar 27 16:06:02 1998 Ian Lance Taylor <ian@cygnus.com>
-
- Fix some gcc -Wall warnings:
- * aout-arm.c (MY(fix_pcrel_26)): Add casts to avoid warnings.
- * archive.c (_bfd_generic_read_ar_hdr_mag): Likewise.
- * archures.c (bfd_default_scan): Likewise.
- * bfd.c (bfd_scan_vma): Likewise.
- * binary.c (mangle_name): Likewise
- * coff-arm.c (aoutarm_fix_pcrel_26): Likewise.
- * coff-sh.c (sh_relocate_section): Likewise.
- * coff-stgo32.c (create_go32_stub): Likewise.
- * coffcode.h (coff_slurp_line_table): Likewise.
- * ecoff.c (_bfd_ecoff_write_armap): Likewise.
- * elf.c (_bfd_elf_make_section_from_shdr): Likewise.
- (assign_file_positions_for_segments): Likewise.
- * elf32-mips.c (mips_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
- * oasys.c (oasys_write_sections): Likewise.
- * ppcboot.c (ppcboot_object_p): Likewise.
- (mangle_name): Likewise.
- * riscix.c (riscix_fix_pcrel_26): Likewise.
- * srec.c (srec_scan): Likewise.
- * stabs.c (_bfd_write_section_stabs): Likewise.
- * sunos.c (sunos_add_dynamic_symbols): Likewise.
- * aout-ns32k.c (_bfd_ns32k_relocate_contents): Add default case to
- switch. Declare parameters for function pointers.
- * archures.c (bfd_default_scan): Add braces to avoid ambiguous if
- warning.
- * elf.c (elf_sort_sections): Likewise.
- * coff-arm.c (coff_thumb_pcrel_common): Initialize relocation.
- Add default cases to switches.
- (coff_arm_relocate_section): Remove unused local variables.
- Always set rstat.
- (coff_arm_bfd_set_private_flags): Change flag variable to type
- flagword.
- * coff-mips.c (mips_relocate_section): Initialize use_lo.
- * coff-ppc.c (ppc_record_toc_entry): Change i to unsigned int.
- (dump_toc): Change cat to const, and initialize it.
- * coff-sh.c (sh_relax_delete_bytes): Initialize start and voff.
- * elf32-sh.c (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_relocate_section): Initialize r_symndx.
- * coffcode.h (coff_compute_section_file_positions): Only declare
- old_sofar if ALIGN_SECTIONS_IN_FILE.
- (coff_write_object_contents): Initialize csym.
- * coffgen.c (coff_pointerize_aux): Make type and class unsigned.
- * cpu-ns32k.c (_bfd_ns32k_get_displacement): Add default case to
- switch.
- * dwarf2.c: Include libiberty.h.
- (read_2_signed_bytes, read_4_signed_bytes): Comment out.
- (decode_line_info): Remove unused local variables.
- * elf32-m32r.c (m32r_elf_sda16_reloc): Likewise.
- (m32r_elf_relocate_section): Likewise.
- * elf32-v850.c (v850_elf_store_addend_in_insn): Likewise.
- (v850_elf_reloc): Likewise.
- * elf-bfd.h (elf_linker_section_t): Make alignment unsigned.
- (struct elf_obj_tdata): Make cverdefs and cverrefs unsigned.
- * elf.c (assign_file_positions_for_segments): Always set adjust.
- * elf32-d30v.c (bfd_elf_d30v_reloc): Initialize tmp_addr. Fully
- parenthesize expression.
- * elf32-m32r.c (m32r_elf_relocate_section): Always initialize h.
- (m32r_elf_object_p): Return a value.
- (m32r_elf_print_private_bfd_data): Change fprintf format string.
- * elf32-mips.c (mips_elf_final_link): Initialize last.
- (mips_elf_finish_dynamic_sections): Initialize last and dindx.
- * elf32-v850.c (v850_elf_object_p): Return a value.
- (v850_elf_print_private_bfd_data): Change fprintf format string.
- * elfcode.h (elf_slurp_symbol_table): Change symcount and i to
- unsigned long.
- * elflink.h (elf_link_add_object_symbols): Change vernum to
- unsigned int, and initialize it. Change fprintf format string.
- (NAME(bfd_elf,size_dynamic_sections)): Cast -1 to bfd_size_type
- when setting or comparing to soname_indx.
- (elf_create_pointer_linker_section): Change num_symbols to
- unsigned int.
- * libcoff-in.h (coff_data_type): Change flags to flagword.
- * peicode.h (pe_print_idata): Initialize idx. Change j to
- bfd_size_type. Initialize hint_member. Remove useless test to
- time_stamp.
- (pe_print_edata): Change num_functions and num_names in struct
- EDT_type to unsigned long. Remove cast. Change fprintf format
- string.
- * ppcboot.c (ppcboot_object_p): Change i to size_t.
- * reloc.c (bfd_get_reloc_size): Change return type to unsigned
- int.
- * reloc16.c (bfd_coff_reloc16_relax_section): Change shrinks to
- int *. Update uses. Change j to long.
- * bfd-in2.h, libcoff.h: Rebuild.
-
-Fri Mar 27 10:10:46 1998 Catherine Moore <clm@cygnus.com>
-
- * elf32-v850.c Remove definition of USE_REL.
- (v850_elf_info_to_howto_rela): New function.
- (v850_elf_perform_relocation): Renamed from
- v850_elf_store_addend_in_insn. Removed replace argument.
- (v850_elf_reloc): store the relocation in the addend field instead
- of the insn.
- (v850_elf_final_link_relocate): Now calls
- v850_elf_perform_relocation.
- (v850_elf_relocate_section): Remove code to generate REL
- relocations.
-
-Thu Mar 26 13:32:17 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coffcode.h (coff_new_section_hook): Set the type and storage
- class in the native symbol information allocated for a new section
- symbol.
-
-Thu Mar 26 10:13:41 1998 Nick Clifton <nickc@cygnus.com>
-
- * peicode.h: Chain together calls to
- coff_bfd_copy_private_bfd_data and
- coff_bfd_print_private_bfd_data.
-
- * coff-arm.c: Add prototypes for
- coff_arm_bfd_print_private_bfd_data and
- coff_arm_bfd_copy_private_bfd_data.
-
-Wed Mar 25 15:45:55 1998 Nick Clifton <nickc@cygnus.com>
-
- * coffcode.h (coff_mkobject_hook): Set private falgs even for a PE
- build.
-
- * peicode.h: Call arm-coff private data functions after handling
- pe private data.
-
- * coff-arm.c: Turn statics into globals so that they can be shared
- both pe and pei backends.
-
-Wed Mar 25 15:19:38 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * aoutf1.h (sunos_set_arch_mach): Use bfd_mach_m68* rather than
- plain numbers.
- (sunos_write_object_contents): Likewise.
- * aoutx.h (NAME(aout,machine_type)): Likewise.
- * coffcode.h (coff_set_arch_mach_hook): Likewise.
-
-Wed Mar 25 13:59:24 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * archures.c (bfd_mach_m68*): Add definitions for various m68k
- variants.
- (bfd_default_scan): Remove m68k special cases.
- * bfd-in2.h: Rebuild.
- * mipsbsd.c (MY(write_object_contents)): Use bfd_mach_m68* rather
- than plain numbers.
- * sparclynx.c (NAME(lynx,set_arch_mach)): Likewise.
- * cpu-m68k.c (arch_info_struct): Likewise. Add entry for
- m68k:68000.
- (bfd_m68k_arch): Set mach field to zero to signal no explicit
- selection, change printable_name to just "m68k" and make that the
- default instead of m68k:68020.
-
- * aout-tic30.c (NAME): Define this to avoid multiple definitions
- from aoutx.h.
- (MY_get_section_contents): Define as aout_32_get_section_contents
- rather than NAME(aout,get_section_contents).
-
- * elf-m10300.c (elf32_mn10300_link_hash_table_create): Fix cast.
-
- * evax-alpha.c (evax_set_arch_mach): Only accept bfd_arch_alpha
- and call bfd_default_set_arch_mach to do the real work.
-
-Wed Mar 25 10:41:35 1998 Richard Henderson <rth@cygnus.com>
-
- * bout.c (BALX): Include return register g14 as part of the insn.
- (BALX_MASK): New.
- (calljx_callback): Use it.
-
-Wed Mar 25 11:19:28 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd-in.h (BFD_ALIGN): Cast this parameter to bfd_vma.
- * libbfd.h: Rebuild.
-
- * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Change
- byte_count to unsigned int.
- (mn10300_elf_relax_section): Initialize internal_relocs. Remove
- unused local variables.
-
- * evax-alpha.c (evax_close_and_cleanup): Remove unused local
- variables er and er1.
-
- * cpu-v850.c: Include <ctype.h>.
- (scan): Case isdigit argument to unsigned char.
-
- From Yan Meroth <YAN.MEROTH@st.com>:
- * ihex.c (ihex_scan): Add extbase variable so that getting an
- extended linear address record does not ignore any previous
- extended address.
- (ihex_write_object_contents): When writing out an extended linear
- address record, zero out any previous extended address.
-
-Tue Mar 24 16:09:43 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * ieee.c (do_one): Check section before dereferencing it.
- (ieee_canonicalize_reloc): Likewise with src->relent.sym_ptr_ptr.
- (ieee_generic_stat_arch_elt): Likewise with abfd->my_archive.
-
-Mon Mar 23 18:51:47 1998 Joel Sherrill <joel@OARcorp.com>
-
- * config.bfd: (sh*-*-rtems*): Switched from ELF to COFF.
-
-Mon Mar 23 14:23:36 1998 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c: Add interworking functions to pe backends.
-
-Fri Mar 20 18:47:20 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Use AM_DISABLE_SHARED.
- * aclocal.m4, configure: Rebuild with libtool 1.2.
-
-Fri Mar 20 11:25:41 1998 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (coff_arm_relocate_section): Better error messages
- when interowrking conflucts occur. Courtesy of Jonathan Walton
- and Tony Thompson.
- (aoutarm_std_reloc_howto): Fixed bitsize fields of rightshifted
- relocations. Patch courtesy of Jonathan Walton and Tony
- Thompson.
-
-Fri Mar 20 02:26:43 1998 Richard Henderson <rth@cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Revert
- part of Feb 22 change controling when to override the existing
- symbol with the .plt entry.
-
-Wed Mar 18 09:26:25 1998 Nick Clifton <nickc@cygnus.com>
-
- * config.bfd (targ_cpu): Add thumb-pe target.
-
- * coffcode.h (OTHER_GLOBAL_CLASS): Support thumb external
- functions in PE build.
-
-Sun Mar 8 23:37:26 1998 Stan Cox <scox@equinox.cygnus.com>
-
- * config.bfd (sparclite-*-elf*): Added.
-
-Mon Feb 23 19:31:19 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Add elf.lo to elf shell variable.
- * Makefile.am (BFD_LIBS): Remove elf.lo.
- (BFD_LIBS_CFILES): Remove elf.c.
- (BFD32_BACKENDS): Add elf.lo.
- (BFD32_BACKENDS_CFILES): Add elf.c.
- * configure, Makefile.in: Rebuild.
-
-1998-02-23 15:53 Richard Henderson <rth@cygnus.com>
-
- * elf32-i386.c (elf_i386_relocate_section): A pc-relative
- relocation against a non-local symbol should not have a dynamic
- relocation.
-
-Mon Feb 23 16:17:08 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (coff_swap_filehdr_in): Don't set BFD flag HAS_SYMS in
- COFF filehdr flags.
- (pe_print_private_bfd_data): Print PE flags. From Mikey
- <jeffdb@netzone.com>.
-
-Sun Feb 22 20:39:00 1998 Richard Henderson <rth@cygnus.com>
-
- * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Don't create
- a plt entry when we can determine that we authoritatively define
- the symbol.
-
-Sun Feb 22 20:33:05 1998 Richard Henderson <rth@cygnus.com>
-
- * configure.in (COREFILE selection): Remove sparc-*-linux*. They
- don't actually use trad-core, but a SunOS-style core file handled
- by gdb directly.
- * hosts/sparclinux.h: Remove.
-
-Wed Feb 18 15:31:06 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (pe_print_idata): If there is no .idata section, look
- for the import tables in some other section. Make the initial
- label line up better with the data. Print the import address
- table even if there is no import name table. If the import
- address table holds actual addresses, print them.
-
-Tue Feb 17 12:58:34 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * libbfd.c (bfd_seek): If fseek fails, save errno around call to
- bfd_tell. If errno is EINVAL, set bfd_error_file_truncated, not
- bfd_error_system_call.
-
-Fri Feb 13 13:11:33 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (AUTOMAKE_OPTIONS): Define.
- * configure, Makefile.in, aclocal.m4: Rebuild with automake 1.2e.
-
- From H.J. Lu <hjl@gnu.org>:
- * Makefile.am (libbfd_la_LDFLAGS): Define.
- * Makefile.in: Rebuild.
-
-Thu Feb 12 17:31:11 1998 Ian Lance Taylor <ian@cygnus.com>
-
- NetBSD patches from Gordon W. Ross <gwr@mc.com>:
- * netbsd.h (MACHTYPE_OK): Define.
- (MY(write_object_contents)): Use DEFAULT_ARCH and DEFAULT_MID when
- calling N_SET_MACHTYPE, rather than having a switch.
- * libaout.h (enum machine_type): Add M_PMAX_NETBSD, M_VAX_NETBSD,
- and M_ALPHA_NETBSD.
- * i386netbsd.c (MACHTYPE_OK): Don't define.
- (DEFAULT_MID): Define.
- * m68k4knetbsd.c (SEGMENT_SIZE): Don't define.
- (MACHTYPE_OK): Don't define.
- (DEFAULT_MID): Define.
- * m68knetbsd.c: (MACHTYPE_OK): Don't define.
- (DEFAULT_MID): Define.
- * ns32knetbsd.c (MACHTYPE_OK): Don't define.
- (DEFAULT_MID): Define.
- * sparcnetbsd.c (MACHTYPE_OK): Don't define.
- (DEFAULT_MID): Define.
-
- NetBSD patches from Gordon W. Ross <gwr@mc.com>:
- * vaxnetbsd.c: New file.
- * netbsd-core.c: Clean up. Remove unused macros. Use netbsd
- rather than netbsd_core.
- * targets.c (vaxnetbsd_vec): Declare.
- (bfd_target_vector): Add vaxnetbsd_vec. If NETBSD_CORE is
- defined, add netbsd_core_vec.
- * configure.in: Set COREFILE for alpha*-*-netbsd* and
- powerpc-*-netbsd* to netbsd-core.lo. If COREFILE is
- netbsd-core.lo, set COREFLAG to -DNETBSD_CORE.
- * config.bfd (alpha*-*-netbsd*): New target.
- * Makefile.am: Rebuild dependencies.
- (BFD32_BACKENDS): Add vaxnetbsd.lo.
- (BFD32_BACKENDS_CFILES): Add vaxnetbsd.c.
- * configure, Makefile.in: Rebuild.
-
- * configure.host: Remove the old shared library build stuff. We
- now use libtool instead.
-
-Wed Feb 11 17:13:09 1998 Richard Henderson <rth@cygnus.com>
-
- * tekhex.c (tekhex_write_object_contents): Call tekhex_init.
-
-Tue Feb 10 19:23:28 1998 H.J. Lu <hjl@gnu.org>
-
- * configure.in: Take stab-syms.lo out of sparclinux_vec list.
- * configure: Rebuild.
-
-Tue Feb 10 15:16:38 1998 Nick Clifton <nickc@cygnus.com>
- * elf32-v850.c (remember_hi16s_reloc): New function.
- (find_remembered_hi16s_reloc): New function.
- (v850_elf_store_addend_in_insn): Use the above new functions to
- match up HI6S relocs with LO16 relocs.
-
-Tue Feb 10 15:01:39 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Change -linux* to -linux-gnu*.
- * config.bfd, configure.host: Likewise.
- * configure: Rebuild.
-
-Mon Feb 9 19:40:59 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_store_addend_in_insn): Fix another
- LO16/HI16S bug and improve comments about what is going on.
-
-Sat Feb 7 15:27:03 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure, aclocal.m4: Rebuild with new libtool.
-
-Fri Feb 6 14:48:20 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_merge_private_bfd_data): Do not complain
- when merging v850 code into v850e/v850ea code. Do not initialise
- output flags if the input is the default architecture.
-
-Fri Feb 6 11:50:22 1998 Jeffrey A Law (law@cygnus.com)
-
- * elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): For BFD_RELOC_CTOR
- get the size from bfd_arch_bits_per_address instead of directly
- from the isa.
-
-Thu Feb 5 14:21:34 1998 Michael Meissner <meissner@cygnus.com>
-
- * libbfd-in.h (BFD_ALIGN): If rounding up would cause the address
- to wrap, just return all 1's bits instead.
- * libbfd.h: Regenerate.
-
-Thu Feb 5 11:51:05 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i386.c (coff_pe_i386_relocate_section): New static function
- if COFF_WITH_PE.
- (coff_relocate_section): If COFF_WITH_PE, define as
- coff_pe_i386_relocate_section.
- * coffcode.h (coff_write_object_contents): If COFF_IMAGE_WITH_PE,
- skip empty sections, to match coff_write_object_contents.
-
- * elf64-mips.c (mips_elf64_swap_reloca_out): Swap out r_addend,
- rather than swapping out r_offset twice. From Luke Deller
- <luked@cse.unsw.edu.au>.
-
-Wed Feb 4 19:11:28 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Set libtool_enable_shared rather than
- libtool_shared. Remove diversion hack.
- * configure, Makefile.in, doc/Makefile.in, aclocal.m4: Rebuild
- with new libtool.
-
-Wed Feb 4 16:10:21 1998 Brent Baccala <baccala@freesoft.org>
-
- * syms.c (struct stab_cache): Define.
- (struct stab_find_info): Remove cached_offset, cached_stab,
- cached_str, and cached_stroff fields. Add file_cache,
- function_cache, and line_cache fields.
- (_bfd_stab_section_find_nearest_line): Use extensive caching to
- speed up searches.
-
-Wed Feb 4 13:34:22 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * peicode.h (pe_print_idata): Check for import of ordinal rather
- than name.
- (pe_print_edata): If there is no .edata section, look for the
- export data in some other section.
-
-Mon Feb 2 20:05:42 1998 Jason Molenda (crash@bugshack.cygnus.com)
-
- * configure.in: Change version to 2.8.4.
- * configure: Regenerated.
-
-Mon Feb 2 17:39:39 1998 Steve Haworth <steve@pm.cse.rmit.EDU.AU>
-
- Add tms320c30 support:
- * cpu-tic30.c: New file.
- * aout-tic30.c: New file.
- * coff-tic30.c: New file.
- * archures.c (bfd_arch_tic30): Define.
- (bfd_tic30_arch): Declare.
- (bfd_archures_list): Add bfd_tic30_arch.
- * targets.c (bfd_target_vector): Add tic30_aout_vec and
- tic30_coff_vec.
- * reloc.c (BFD_RELOC_TIC30_LDP): Define.
- * coffcode.h (coff_set_arch_mach_hook): Add tic30 case.
- (coff_set_flags): Likewise.
- * config.bfd (tic30-*-*aout*, tic30-*-*coff*): New targets.
- * configure.in (tic30_aout_vec, tic30_coff_vec): New vectors.
- * Makefile.am: Rebuild dependencies.
- (ALL_MACHINES): Add cpu-tic30.lo.
- (ALL_MACHINES_CFILES): Add cpu-tic30.c.
- (BFD32_BACKENDS): Add aout-tic30.lo and coff-tic30.lo.
- (BFD32_BACKENDS_CFILES): Add aout-tic30.c and coff-tic30.c.
- * configure, Makefile.in, bfd-in2.h, libbfd.h: Rebuild.
-
-Mon Feb 2 12:25:12 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-v850.c (v850_elf_store_addend_in_insn): Allow HI16_S reloc
- to lag behind LO16 reloc by a couple of instructions.
-
-Mon Feb 2 14:09:46 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am ($(srcdir)/bfd-in2.h): Add dummy command to force
- make to reexamine the file timestamp.
- ($(srcdir)/libbfd.h, $(srcddir)/libcoff.h): Likewise.
-
- * elf64-alpha.c (ELF_MAXPAGESIZE): Change to 0x10000 from
- 0x100000.
-
-Fri Jan 30 19:07:07 1998 Geoff Keating <geoffk@ozemail.com.au>
-
- * elf32-ppc.c (ppc_elf_create_dynamic_sections): New procedure
- to create .dynsbss and .rela.sbss sections.
- (ppc_elf_adjust_dynamic_symbol): Put space for small data to be
- copied from dynamic objects into .sbss.
- (ppc_elf_size_dynamic_sections): Strip .rela.sbss if we don't
- use it. Correct typo of .rela.sdata2.
- (ppc_elf_finish_dynamic_symbol): Generate reloc to where we
- put the data, which may now be in .sbss.
- (ppc_elf_relocate_section): A SDAREL16 reloc can be in dynsbss.
- (elf_backend_create_dynamic_sections): Define as
- ppc_elf_create_dynamic_sections.
-
- * elf32-ppc.c (ppc_elf_check_relocs): Don't emit R_PPC_REL* relocs
- against _GLOBAL_OFFSET_TABLE_.
- (ppc_elf_relocate_section): Don't emit R_PPC_REL32 relocs in
- shared libraries which refer to local symbols. Make sure that the
- test for allocating space for a reloc in a shared object is the
- same as the test for emitting a reloc.
-
-Thu Jan 29 15:55:35 1998 J.J. van der Heijden <J.J.vanderHeijden@student.utwente.nl>
-
- * config.bfd (i[3456]-*-mingw32*): New target.
- * acinclude.m4 (BFD_BINARY_OPEN): Check for mingw32.
- * aclocal.m4, configure: Rebuild.
-
-Wed Jan 28 13:41:26 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * elf.c (_bfd_elf_close_and_cleanup): Only check the strtab if we
- have a bfd_object.
-
-Tue Jan 27 21:43:55 1998 Richard Henderson <rth@cygnus.com>
-
- Sparc v9 ABI compliant PLT:
- * elf64-sparc.c (PLT_HEADER_SIZE): V9 ABI uses 4 entries.
- (plt_templates, sparc64_elf_build_plt_entry): Delete.
- (LARGE_PLT_THRESHOLD): New define.
- (GOT_RESERVED_ENTRIES): V9 ABI only uses 1.
- (sparc64_elf_build_plt): New function.
- (sparc64_elf_plt_entry_offset): Likewise.
- (sparc64_elf_plt_ptr_offset): Likewise.
- (sparc64_elf_adjust_dynamic_symbol): Change h->plt_offset to
- contain the index for convenience. Skip the initial entries
- in .rela.plt.
- (sparc64_elf_size_dynamic_sections): Zero the allocated contents
- memory for the benefit of .rela.plt.
- (sparc64_elf_relocate_section): Call sparc64_elf_plt_entry_offset.
- (sparc64_elf_finish_dynamic_symbol): Kill template stuff. Use
- sparc64_elf_plt_entry_offset & sparc64_elf_plt_ptr_offset for reloc.
- (sparc64_elf_finish_dynamic_sections): DT_PLTGOT points to .plt.
- Call sparc64_elf_build_plt.
- (elf_backend_want_got_plt): No.
- (elf_backend_plt_readonly): No.
- (elf_backend_plt_alignment): 8.
-
- * elf.c (_bfd_elf_close_and_cleanup): New function; free the shstrtab.
- * elf-bfd.h (_bfd_elf_close_and_cleanup): Declare it.
- * elfxx-target.h (bfd_elfNN_close_and_cleanup): Arrange for it
- to be called.
-
-Tue Jan 27 21:45:15 1998 Jeffrey A Law (law@cygnus.com)
-
- * archures.c (bfd_mach_mips*): Add definitions for various MIPS
- processors.
- * cpu-mips.c (arch_info_struct): Add mips variants.
- * bfd-in2.h: Rebuilt.
-
-Tue Jan 27 15:06:04 1998 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (coff_arm_relocate_section): Preserve the contents of
- t2a3_b_insn.
-
-Tue Jan 27 12:47:27 1998 Robert Lipe <robertl@dgii.com>
-
- * config.bfd (i[3456]86-sco3.2v5*): ELF now the default.
- (i[3456]86sco3.2v5*coff): New target.
-
-Mon Jan 26 15:41:30 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * bfd-in2.h: Rebuild with changes to chew--tab expansion.
-
-Thu Jan 22 21:26:48 1998 Richard Henderson <rth@cygnus.com>
-
- * bfd.c (bfd_get_error_handler): Add orthogonal function.
- * bfd-in2.h: Regenerate.
-
-Thu Jan 22 21:13:39 1998 Richard Henderson <rth@cygnus.com>
-
- * tekhex.c (tekhex_write_object_contents): Check for no symbols.
-
-Wed Jan 21 21:19:03 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * coff-i386.c (coff_i386_rtype_to_howto): If COFF_WITH_PE, don't
- adjust addend for an output common symbol (from Jimmy Blair
- <jimmyb@wrs.com>). If COFF_WITH_PE, adjust addend for PC relative
- defined symbol to counteract adjustment made in generic relocation
- code.
-
- * dwarf2.c: Include sysdep.h, not stdio.h and stdlib.h.
-
-Wed Jan 21 21:16:06 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * coff-m88k.c (GET_SCNDHR_NRELOC): Fix typo in macro name.
- (GET_SCNDHR_NLNNO): Likewise.
-
-Mon Jan 19 12:49:52 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * cpu-sh.c (arch_info_struct): Correct next field of sh3e.
-
-Wed Jan 14 17:23:27 1998 Nick Clifton <nickc@cygnus.com>
-
- * elf32-m32r.c: Add macros to handle NOP insertion.
-
-Wed Jan 14 16:15:22 1998 Richard Henderson <rth@cygnus.com>
-
- * xcofflink.c (xcoff_mark_symbol): Don't mark the absolute section.
- (xcoff_mark): Likewise.
- (xcoff_build_ldsyms): Mark absolute symbols.
-
-Wed Jan 14 16:03:11 1998 Richard Henderson <rth@cygnus.com>
-
- * bout.c (b_out_write_object_contents): Sort symbols before output
- to keep {CALL,BAL}NAME symbols adjacent.
- (b_out_symbol_cmp): New function.
-
-For older changes see ChangeLog-9697
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/MAINTAINERS b/contrib/binutils/bfd/MAINTAINERS
deleted file mode 100644
index d59a3bd..0000000
--- a/contrib/binutils/bfd/MAINTAINERS
+++ /dev/null
@@ -1 +0,0 @@
-See ../binutils/MAINTAINERS
diff --git a/contrib/binutils/bfd/Makefile.am b/contrib/binutils/bfd/Makefile.am
deleted file mode 100644
index de811af..0000000
--- a/contrib/binutils/bfd/Makefile.am
+++ /dev/null
@@ -1,1632 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AUTOMAKE_OPTIONS = cygnus
-
-INCDIR = $(srcdir)/../include
-CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
-MKDEP = gcc -MM
-
-SUBDIRS = doc po
-
-docdir = doc
-bfdlibdir = @bfdlibdir@
-bfdincludedir = @bfdincludedir@
-
-bfdlib_LTLIBRARIES = libbfd.la
-
-WARN_CFLAGS = @WARN_CFLAGS@
-AM_CFLAGS = $(WARN_CFLAGS)
-
-# bfd.h goes here, for now
-BFD_H = bfd.h
-
-# Jim Kingdon notes:
-# Writing S-records should be included in all (or at least most)
-# *-*-coff, *-*-aout, etc., configurations, because people will want to
-# be able to use objcopy to create S-records. (S-records are not useful
-# for the debugger, so if you are downloading things as S-records you
-# need two copies of the executable, one to download and one for the
-# debugger).
-BFD32_LIBS = \
- archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
- cache.lo coffgen.lo corefile.lo \
- format.lo init.lo libbfd.lo opncls.lo reloc.lo \
- section.lo syms.lo targets.lo hash.lo linker.lo \
- srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
- merge.lo dwarf2.lo simple.lo
-
-BFD64_LIBS = archive64.lo
-
-BFD32_LIBS_CFILES = \
- archive.c archures.c bfd.c bfdio.c bfdwin.c \
- cache.c coffgen.c corefile.c \
- format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c \
- srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- merge.c dwarf2.c simple.c
-
-BFD64_LIBS_CFILES = archive64.c
-
-# This list is alphabetized to make it easier to keep in sync
-# with the decls and initializer in archures.c.
-ALL_MACHINES = \
- cpu-a29k.lo \
- cpu-alpha.lo \
- cpu-arc.lo \
- cpu-arm.lo \
- cpu-avr.lo \
- cpu-cris.lo \
- cpu-d10v.lo \
- cpu-d30v.lo \
- cpu-dlx.lo \
- cpu-fr30.lo \
- cpu-frv.lo \
- cpu-h8300.lo \
- cpu-h8500.lo \
- cpu-hppa.lo \
- cpu-ia64.lo \
- cpu-i370.lo \
- cpu-i386.lo \
- cpu-i860.lo \
- cpu-i960.lo \
- cpu-ip2k.lo \
- cpu-iq2000.lo \
- cpu-m32r.lo \
- cpu-m68hc11.lo \
- cpu-m68hc12.lo \
- cpu-m68k.lo \
- cpu-m88k.lo \
- cpu-m10200.lo \
- cpu-m10300.lo \
- cpu-mcore.lo \
- cpu-mips.lo \
- cpu-mmix.lo \
- cpu-msp430.lo \
- cpu-or32.lo \
- cpu-ns32k.lo \
- cpu-openrisc.lo \
- cpu-pdp11.lo \
- cpu-pj.lo \
- cpu-powerpc.lo \
- cpu-rs6000.lo \
- cpu-s390.lo \
- cpu-sh.lo \
- cpu-sparc.lo \
- cpu-tic30.lo \
- cpu-tic4x.lo \
- cpu-tic54x.lo \
- cpu-tic80.lo \
- cpu-v850.lo \
- cpu-vax.lo \
- cpu-we32k.lo \
- cpu-w65.lo \
- cpu-xstormy16.lo \
- cpu-xtensa.lo \
- cpu-z8k.lo
-
-ALL_MACHINES_CFILES = \
- cpu-a29k.c \
- cpu-alpha.c \
- cpu-arc.c \
- cpu-arm.c \
- cpu-avr.c \
- cpu-cris.c \
- cpu-d10v.c \
- cpu-d30v.c \
- cpu-dlx.c \
- cpu-fr30.c \
- cpu-frv.c \
- cpu-h8300.c \
- cpu-h8500.c \
- cpu-hppa.c \
- cpu-ia64.c \
- cpu-i370.c \
- cpu-i386.c \
- cpu-i860.c \
- cpu-i960.c \
- cpu-ip2k.c \
- cpu-iq2000.c \
- cpu-m32r.c \
- cpu-m68hc11.c \
- cpu-m68hc12.c \
- cpu-m68k.c \
- cpu-m88k.c \
- cpu-m10200.c \
- cpu-m10300.c \
- cpu-mcore.c \
- cpu-mips.c \
- cpu-mmix.c \
- cpu-msp430.c \
- cpu-or32.c \
- cpu-ns32k.c \
- cpu-openrisc.c \
- cpu-pdp11.c \
- cpu-pj.c \
- cpu-powerpc.c \
- cpu-rs6000.c \
- cpu-s390.c \
- cpu-sh.c \
- cpu-sparc.c \
- cpu-tic30.c \
- cpu-tic4x.c \
- cpu-tic54x.c \
- cpu-tic80.c \
- cpu-v850.c \
- cpu-vax.c \
- cpu-we32k.c \
- cpu-w65.c \
- cpu-xstormy16.c \
- cpu-xtensa.c \
- cpu-z8k.c
-
-# The .o files needed by all of the 32 bit vectors that are configured into
-# target_vector in targets.c if configured with --enable-targets=all.
-BFD32_BACKENDS = \
- aout-adobe.lo \
- aout-arm.lo \
- aout-cris.lo \
- aout-ns32k.lo \
- aout-sparcle.lo \
- aout-tic30.lo \
- aout0.lo \
- aout32.lo \
- armnetbsd.lo \
- bout.lo \
- cf-i386lynx.lo \
- cf-m68klynx.lo \
- cf-sparclynx.lo \
- coff-a29k.lo \
- coff-apollo.lo \
- coff-arm.lo \
- coff-aux.lo \
- coff-h8300.lo \
- coff-h8500.lo \
- coff-i386.lo \
- coff-go32.lo \
- coff-i860.lo \
- coff-i960.lo \
- coff-m68k.lo \
- coff-m88k.lo \
- coff-mips.lo \
- coff-or32.lo \
- coff-rs6000.lo \
- coff-sh.lo \
- coff-sparc.lo \
- coff-stgo32.lo \
- coff-svm68k.lo \
- coff-tic30.lo \
- coff-tic4x.lo \
- coff-tic54x.lo \
- coff-tic80.lo \
- coff-u68k.lo \
- coff-we32k.lo \
- coff-w65.lo \
- coff-z8k.lo \
- cofflink.lo \
- dwarf1.lo \
- ecoff.lo \
- ecofflink.lo \
- efi-app-ia32.lo \
- elf.lo \
- elf32-am33lin.lo \
- elf32-arc.lo \
- elfarm-oabi.lo \
- elfarm-nabi.lo \
- elf32-avr.lo \
- elf32-cris.lo \
- elf32-d10v.lo \
- elf32-d30v.lo \
- elf32-dlx.lo \
- elf32-fr30.lo \
- elf32-frv.lo \
- elf32-gen.lo \
- elf32-h8300.lo \
- elf32-hppa.lo \
- elf32-i370.lo \
- elf32-i386.lo \
- elf32-i860.lo \
- elf32-i960.lo \
- elf32-ia64.lo \
- elf32-ip2k.lo \
- elf32-iq2000.lo \
- elf32-m32r.lo \
- elf32-m68hc11.lo \
- elf32-m68hc12.lo \
- elf32-m68hc1x.lo \
- elf32-m68k.lo \
- elf32-m88k.lo \
- elf-m10200.lo \
- elf-m10300.lo \
- elf32-mcore.lo \
- elfxx-mips.lo \
- elf32-mips.lo \
- elf32-msp430.lo \
- elf32-openrisc.lo \
- elf32-or32.lo \
- elf32-pj.lo \
- elf32-ppc.lo \
- elf32-s390.lo \
- elf32-sh.lo \
- elf32-sh64.lo \
- elf32-sh64-com.lo \
- elf32-sparc.lo \
- elf32-v850.lo \
- elf32-vax.lo \
- elf32-xstormy16.lo \
- elf32-xtensa.lo \
- elf32.lo \
- elflink.lo \
- elf-strtab.lo \
- elf-eh-frame.lo \
- epoc-pe-arm.lo \
- epoc-pei-arm.lo \
- hp300bsd.lo \
- hp300hpux.lo \
- som.lo \
- i386aout.lo \
- i386bsd.lo \
- i386dynix.lo \
- i386freebsd.lo \
- i386linux.lo \
- i386lynx.lo \
- i386msdos.lo \
- i386netbsd.lo \
- i386mach3.lo \
- i386os9k.lo \
- ieee.lo \
- m68k4knetbsd.lo \
- m68klinux.lo \
- m68klynx.lo \
- m68knetbsd.lo \
- m88kmach3.lo \
- mach-o.lo \
- mipsbsd.lo \
- newsos3.lo \
- nlm.lo \
- nlm32-i386.lo \
- nlm32-sparc.lo \
- nlm32-ppc.lo \
- nlm32.lo \
- ns32knetbsd.lo \
- oasys.lo \
- pc532-mach.lo \
- pdp11.lo \
- pef.lo \
- pe-arm.lo \
- pei-arm.lo \
- pe-i386.lo \
- pei-i386.lo \
- pe-mcore.lo \
- pei-mcore.lo \
- pe-ppc.lo \
- pei-ppc.lo \
- pe-sh.lo \
- pei-sh.lo \
- pe-mips.lo \
- pei-mips.lo \
- peigen.lo \
- ppcboot.lo \
- reloc16.lo \
- riscix.lo \
- sparclinux.lo \
- sparclynx.lo \
- sparcnetbsd.lo \
- sunos.lo \
- vaxnetbsd.lo \
- vax1knetbsd.lo \
- vaxbsd.lo \
- versados.lo \
- vms.lo \
- vms-gsd.lo \
- vms-hdr.lo \
- vms-misc.lo \
- vms-tir.lo \
- xcofflink.lo \
- xsym.lo \
- xtensa-isa.lo \
- xtensa-modules.lo
-
-BFD32_BACKENDS_CFILES = \
- aout-adobe.c \
- aout-arm.c \
- aout-cris.c \
- aout-ns32k.c \
- aout-sparcle.c \
- aout-tic30.c \
- aout0.c \
- aout32.c \
- armnetbsd.c \
- bout.c \
- cf-i386lynx.c \
- cf-m68klynx.c \
- cf-sparclynx.c \
- coff-a29k.c \
- coff-apollo.c \
- coff-arm.c \
- coff-aux.c \
- coff-h8300.c \
- coff-h8500.c \
- coff-i386.c \
- coff-i860.c \
- coff-go32.c \
- coff-i960.c \
- coff-m68k.c \
- coff-m88k.c \
- coff-mips.c \
- coff-or32.c \
- coff-rs6000.c \
- coff-sh.c \
- coff-sparc.c \
- coff-stgo32.c \
- coff-svm68k.c \
- coff-tic30.c \
- coff-tic4x.c \
- coff-tic54x.c \
- coff-tic80.c \
- coff-u68k.c \
- coff-we32k.c \
- coff-w65.c \
- coff-z8k.c \
- cofflink.c \
- dwarf1.c \
- ecoff.c \
- ecofflink.c \
- efi-app-ia32.c \
- elf.c \
- elf32-am33lin.c \
- elf32-arc.c \
- elfarm-oabi.c \
- elfarm-nabi.c \
- elf32-avr.c \
- elf32-cris.c \
- elf32-d10v.c \
- elf32-d30v.c \
- elf32-dlx.c \
- elf32-fr30.c \
- elf32-frv.c \
- elf32-gen.c \
- elf32-h8300.c \
- elf32-hppa.c \
- elf32-i370.c \
- elf32-i386.c \
- elf32-i860.c \
- elf32-i960.c \
- elf32-ip2k.c \
- elf32-iq2000.c \
- elf32-m32r.c \
- elf32-m68k.c \
- elf32-m68hc11.c \
- elf32-m68hc12.c \
- elf32-m68hc1x.c \
- elf32-m88k.c \
- elf-m10200.c \
- elf-m10300.c \
- elf32-mcore.c \
- elfxx-mips.c \
- elf32-mips.c \
- elf32-msp430.c \
- elf32-openrisc.c \
- elf32-or32.c \
- elf32-pj.c \
- elf32-ppc.c \
- elf32-sh64.c \
- elf32-sh64-com.c \
- elf32-s390.c \
- elf32-sh.c \
- elf32-sparc.c \
- elf32-v850.c \
- elf32-vax.c \
- elf32-xstormy16.c \
- elf32-xtensa.c \
- elf32.c \
- elflink.c \
- elf-strtab.c \
- elf-eh-frame.c \
- epoc-pe-arm.c \
- epoc-pei-arm.c \
- hp300bsd.c \
- hp300hpux.c \
- som.c \
- i386aout.c \
- i386bsd.c \
- i386dynix.c \
- i386freebsd.c \
- i386linux.c \
- i386lynx.c \
- i386msdos.c \
- i386netbsd.c \
- i386mach3.c \
- i386os9k.c \
- ieee.c \
- m68k4knetbsd.c \
- m68klinux.c \
- m68klynx.c \
- m68knetbsd.c \
- m88kmach3.c \
- mach-o.c \
- mipsbsd.c \
- newsos3.c \
- nlm.c \
- nlm32-i386.c \
- nlm32-sparc.c \
- nlm32-ppc.c \
- nlm32.c \
- ns32knetbsd.c \
- oasys.c \
- pc532-mach.c \
- pdp11.c \
- pef.c \
- pe-arm.c \
- pei-arm.c \
- pe-i386.c \
- pei-i386.c \
- pe-mcore.c \
- pei-mcore.c \
- pe-ppc.c \
- pei-ppc.c \
- pe-sh.c \
- pei-sh.c \
- pe-mips.c \
- pei-mips.c \
- ppcboot.c \
- reloc16.c \
- riscix.c \
- sparclinux.c \
- sparclynx.c \
- sparcnetbsd.c \
- sunos.c \
- vaxnetbsd.c \
- vax1knetbsd.c \
- vaxbsd.c \
- versados.c \
- vms.c \
- vms-gsd.c \
- vms-hdr.c \
- vms-misc.c \
- vms-tir.c \
- xcofflink.c \
- xsym.c \
- xtensa-isa.c \
- xtensa-modules.c
-
-# The .o files needed by all of the 64 bit vectors that are configured into
-# target_vector in targets.c if configured with --enable-targets=all
-# and --enable-64-bit-bfd.
-BFD64_BACKENDS = \
- aix5ppc-core.lo \
- aout64.lo \
- coff-alpha.lo \
- coff64-rs6000.lo \
- demo64.lo \
- efi-app-ia64.lo \
- elf64-x86-64.lo \
- elf64-alpha.lo \
- elf64-hppa.lo \
- elf64-ia64.lo \
- elf64-gen.lo \
- elfn32-mips.lo \
- elf64-mips.lo \
- elf64-mmix.lo \
- elf64-sh64.lo \
- elf64-ppc.lo \
- elf64-s390.lo \
- elf64-sparc.lo \
- elf64.lo \
- mmo.lo \
- nlm32-alpha.lo \
- nlm64.lo \
- pepigen.lo
-
-BFD64_BACKENDS_CFILES = \
- aix5ppc-core.c \
- aout64.c \
- coff-alpha.c \
- coff64-rs6000.c \
- demo64.c \
- efi-app-ia64.c \
- elf64-x86-64.c \
- elf64-alpha.c \
- elf64-hppa.c \
- elf64-gen.c \
- elfn32-mips.c \
- elf64-mips.c \
- elf64-mmix.c \
- elf64-ppc.c \
- elf64-s390.c \
- elf64-sh64.c \
- elf64-sparc.c \
- elf64.c \
- mmo.c \
- nlm32-alpha.c \
- nlm64.c
-
-OPTIONAL_BACKENDS = \
- aix386-core.lo \
- hpux-core.lo \
- irix-core.lo \
- lynx-core.lo \
- osf-core.lo \
- sco5-core.lo \
- trad-core.lo \
- cisco-core.lo
-
-OPTIONAL_BACKENDS_CFILES = \
- aix386-core.c \
- hpux-core.c \
- irix-core.c \
- lynx-core.c \
- osf-core.c \
- sco5-core.c \
- trad-core.c \
- cisco-core.c
-
-# These are defined by configure.in:
-WORDSIZE = @wordsize@
-ALL_BACKENDS = @all_backends@
-BFD_BACKENDS = @bfd_backends@
-BFD_LIBS = @bfd_libs@
-BFD_MACHINES = @bfd_machines@
-TDEFAULTS = @tdefaults@
-
-INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl
-
-# C source files that correspond to .o's.
-SOURCE_CFILES = \
- $(BFD32_LIBS_CFILES) \
- $(BFD64_LIBS_CFILES) \
- $(ALL_MACHINES_CFILES) \
- $(BFD32_BACKENDS_CFILES) \
- $(BFD64_BACKENDS_CFILES) \
- $(OPTIONAL_BACKENDS_CFILES)
-
-BUILD_CFILES = \
- elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
-
-CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
-
-## This is a list of all .h files which are in the source tree.
-SOURCE_HFILES = \
- aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
- elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \
- elf64-hppa.h elfcode.h elfcore.h \
- freebsd.h genlink.h go32stub.h \
- libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
- libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
- netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
- pef.h pef-traceback.h peicode.h som.h version.h \
- vms.h xcoff-target.h xsym.h
-
-## ... and all .h files which are in the build tree.
-BUILD_HFILES = \
- bfdver.h elf32-target.h elf64-target.h targmatch.h
-
-HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
-
-SRC_POTFILES = $(SOURCE_CFILES) $(SOURCE_HFILES)
-BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
-
-po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
- for file in $(SRC_POTFILES); do echo $$file; done \
- | LC_COLLATE= sort > tmp.src \
- && mv tmp.src $(srcdir)/po/SRC-POTFILES.in
-
-po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
- for file in $(BLD_POTFILES); do echo $$file; done \
- | LC_COLLATE= sort > tmp.bld \
- && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
-
-diststuff: info
-
-# Various kinds of .o files to put in libbfd.a:
-# BFD_BACKENDS Routines the configured targets need.
-# BFD_MACHINES Architecture-specific routines the configured targets need.
-# COREFILE Core file routines for a native configuration
-OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@
-
-stamp-ofiles: Makefile
- rm -f tofiles
- f=""; \
- for i in $(OFILES) ; do \
- case " $$f " in \
- *" $$i "*) ;; \
- *) f="$$f $$i" ;; \
- esac ; \
- done ; \
- echo $$f > tofiles
- $(SHELL) $(srcdir)/../move-if-change tofiles ofiles
- touch stamp-ofiles
-
-ofiles: stamp-ofiles ; @true
-
-libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
-libbfd_la_DEPENDENCIES = $(OFILES) ofiles
-libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
-libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
-
-# libtool will build .libs/libbfd.a. We create libbfd.a in the build
-# directory so that we don't have to convert all the programs that use
-# libbfd.a simultaneously. This is a hack which should be removed if
-# everything else starts using libtool. FIXME.
-
-noinst_LIBRARIES = libbfd.a
-libbfd_a_SOURCES =
-
-stamp-lib: libbfd.la
- libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
- if [ -f $$libtooldir/libbfd.a ]; then \
- cp $$libtooldir/libbfd.a libbfd.tmp; \
- $(RANLIB) libbfd.tmp; \
- $(SHELL) $(srcdir)/../move-if-change libbfd.tmp libbfd.a; \
- else true; fi
- touch stamp-lib
-
-libbfd.a: stamp-lib ; @true
-
-# This file holds an array associating configuration triplets and
-# vector names. It is built from config.bfd. It is not compiled by
-# itself, but is included by targets.c.
-targmatch.h: config.bfd targmatch.sed
- rm -f targmatch.h
- sed -f $(srcdir)/targmatch.sed < $(srcdir)/config.bfd > targmatch.new
- mv -f targmatch.new targmatch.h
-
-# When compiling archures.c and targets.c, supply the default target
-# info from configure.
-
-targets.lo: targets.c Makefile
- $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/targets.c
-
-archures.lo: archures.c Makefile
- $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
-
-elf32-target.h : elfxx-target.h
- rm -f elf32-target.h
- sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
- mv -f elf32-target.new elf32-target.h
-
-elf64-target.h : elfxx-target.h
- rm -f elf64-target.h
- sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
- mv -f elf64-target.new elf64-target.h
-
-elf32-ia64.c : elfxx-ia64.c
- rm -f elf32-ia64.c
- sed -e s/NN/32/g < $(srcdir)/elfxx-ia64.c > elf32-ia64.new
- mv -f elf32-ia64.new elf32-ia64.c
-
-elf64-ia64.c : elfxx-ia64.c
- rm -f elf64-ia64.c
- sed -e s/NN/64/g < $(srcdir)/elfxx-ia64.c > elf64-ia64.new
- mv -f elf64-ia64.new elf64-ia64.c
-
-peigen.c : peXXigen.c
- rm -f peigen.c
- sed -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
- mv -f peigen.new peigen.c
-
-pepigen.c : peXXigen.c
- rm -f pepigen.c
- sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
- mv -f pepigen.new pepigen.c
-
-BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
-LOCAL_H_DEPS= libbfd.h sysdep.h config.h
-$(BFD32_LIBS) \
- $(BFD64_LIBS) \
- $(ALL_MACHINES) \
- $(BFD32_BACKENDS) \
- $(BFD64_BACKENDS) \
- $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-
-install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd
- @$(NORMAL_INSTALL)
-
-uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd
- @$(NORMAL_UNINSTALL)
-
-.PHONY: install_libbfd uninstall_libbfd
-install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H)
- $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
- $(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
- @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
- $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
- else :; fi; \
- done
- $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h
- $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h
- $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h
- $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h
-
-uninstall_libbfd:
- list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
- done
- rm -f $(DESTDIR)$(bfdincludedir)/bfd.h
- rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h
- rm -f $(DESTDIR)$(bfdincludedir)/symcat.h
- rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h
-
-Makefile: $(srcdir)/configure.in
-
-# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
-DEP: dep.sed $(CFILES) $(HFILES) bfd.h
- rm -f DEP1
- $(MAKE) MKDEP="$(MKDEP)" DEP1
- sed -f dep.sed < DEP1 > DEPA
- echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
- if grep ' /' DEPA > /dev/null 2> /dev/null; then \
- echo 'make DEP failed!'; exit 1; \
- else \
- mv -f DEPA $@; \
- fi
-
-DEP1: $(CFILES)
- echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
- echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
- $(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
- mv -f DEP2 $@
-
-dep.sed: dep-in.sed config.status
- sed <$(srcdir)/dep-in.sed >dep.sed \
- -e 's!@BFD_H@!$(BFD_H)!' \
- -e 's!@SRCDIR@!$(srcdir)!' \
- -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/bfd$$,,`'!'
-
-dep: DEP
- sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
- cat DEP >> tmp-Makefile
- $(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
-
-dep-in: DEP
- sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
- cat DEP >> tmp-Makefile.in
- $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
-
-dep-am: DEP
- sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
- cat DEP >> tmp-Makefile.am
- $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
-
-host-aout.lo: Makefile
-
-# The following program can be used to generate a simple config file
-# which can be folded into an h-XXX file for a new host, with some editing.
-aout-params.h: gen-aout
- ./gen-aout host > aout-params.h
-gen-aout: $(srcdir)/gen-aout.c Makefile
- $(CC) -o gen-aout $(CFLAGS) $(LFLAGS) $(srcdir)/gen-aout.c
-
-$(BFD_H): stmp-bfd-h ; @true
-
-stmp-bfd-h: bfd-in3.h
- rm -f bfd-tmp.h
- cp bfd-in3.h bfd-tmp.h
- $(SHELL) $(srcdir)/../move-if-change bfd-tmp.h $(BFD_H)
- rm -f bfd-tmp.h
- touch stmp-bfd-h
-
-BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
- reloc.c syms.c bfd.c bfdio.c bfdwin.c \
- archive.c corefile.c targets.c format.c
-BFD64_H_FILES = archive64.c
-LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c bfdio.c bfdwin.c \
- cache.c reloc.c archures.c elf.c
-LIBCOFF_H_FILES = libcoff-in.h coffcode.h
-
-# Could really use a "copy-if-change"...
-headers:
- (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS))
- cp $(docdir)/bfd.h bfd-in2.h-new
- $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
- cp $(docdir)/libbfd.h libbfd.h-new
- $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
- cp $(docdir)/libcoff.h libcoff.h-new
- $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
-
-# We only rebuild the header files automatically if we have been
-# configured with --enable-maintainer-mode.
-
-$(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true
-stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES)
- (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
- cp $(docdir)/bfd.h bfd-in2.h-new
- $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
- touch stmp-bin2-h
-
-$(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true
-stmp-lbfd-h: $(LIBBFD_H_FILES)
- (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h)
- cp $(docdir)/libbfd.h libbfd.h-new
- $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
- touch stmp-lbfd-h
-
-$(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true
-stmp-lcoff-h: $(LIBCOFF_H_FILES)
- (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h)
- cp $(docdir)/libcoff.h libcoff.h-new
- $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
- touch stmp-lcoff-h
-
-MOSTLYCLEANFILES = ofiles stamp-ofiles
-
-CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
- stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
-
-DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
-
-# We want to rerun configure if config.bfd, configure.host or version.h change.
-config.status: $(srcdir)/configure $(srcdir)/config.bfd \
- $(srcdir)/configure.host $(srcdir)/version.h
- $(SHELL) ./config.status --recheck
-
-# What appears below is generated by a hacked mkdep using gcc -MM.
-
-# DO NOT DELETE THIS LINE -- mkdep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
- $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h
-archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
-bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h
-bfdio.lo: bfdio.c $(INCDIR)/filenames.h
-bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h
-cache.lo: cache.c $(INCDIR)/filenames.h
-coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h
-corefile.lo: corefile.c $(INCDIR)/filenames.h
-format.lo: format.c $(INCDIR)/filenames.h
-init.lo: init.c $(INCDIR)/filenames.h
-libbfd.lo: libbfd.c $(INCDIR)/filenames.h
-opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
- $(INCDIR)/libiberty.h
-reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
-targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \
- targmatch.h
-hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
-linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h
-srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h
-binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
-tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h
-stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
-stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
-merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
- $(INCDIR)/libiberty.h
-dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
-simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h
-cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h
-cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h
-cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
-cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
-cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
-cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
-cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
-cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
-cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
-cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h
-cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h
-cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h
-cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h
-cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h cpu-ia64-opc.c \
- $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h
-cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h
-cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h
-cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h
-cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h
-cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h
-cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h
-cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h
-cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h
-cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h
-cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h
-cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h
-cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h
-cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h
-cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h
-cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h
-cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h
-cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h
-cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h
-cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h
-cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h
-cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h
-cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h
-cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h
-cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h
-cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h
-cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h
-cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h
-cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h
-cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h
-cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h
-cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h
-cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
-cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h
-cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h
-cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
-cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
-cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
-cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
-aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
- $(INCDIR)/bfdlink.h
-aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \
- ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h
-aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \
- libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \
- $(INCDIR)/safe-ctype.h
-aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
- libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/bout.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def libaout.h
-cf-i386lynx.lo: cf-i386lynx.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-cf-m68klynx.lo: cf-m68klynx.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-cf-sparclynx.lo: cf-sparclynx.c coff-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-a29k.lo: coff-a29k.c $(INCDIR)/filenames.h $(INCDIR)/coff/a29k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-apollo.lo: coff-apollo.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/coff/arm.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \
- coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- coffswap.h
-coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/libiberty.h \
- coffcode.h coffswap.h
-coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/coff/i860.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-go32.lo: coff-go32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/coff/i960.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m68k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m88k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
- libcoff.h libecoff.h coffswap.h ecoffswap.h
-coff-or32.lo: coff-or32.c $(INCDIR)/filenames.h $(INCDIR)/coff/or32.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
- $(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h \
- coffswap.h
-coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
-coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/coff/sparc.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-stgo32.lo: coff-stgo32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/go32exe.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h go32stub.h
-coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
-coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \
- $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/coff/we32k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/safe-ctype.h
-dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h
-ecoff.lo: ecoff.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h
-ecofflink.lo: ecofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/objalloc.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h
-efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
-elf32-am33lin.lo: elf32-am33lin.c elf-m10300.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h elf32-target.h
-elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- elf32-arm.h elf32-target.h
-elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- elf32-arm.h elf32-target.h
-elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/hashtab.h elf32-target.h
-elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-target.h
-elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
- libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
-elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/iq2000.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
- $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/m68hc11.h elf32-target.h
-elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
- $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/m68hc11.h elf32-target.h
-elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
- $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/m68hc11.h
-elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-target.h
-elf-m10200.lo: elf-m10200.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-target.h
-elf-m10300.lo: elf-m10300.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
- $(INCDIR)/coff/external.h $(INCDIR)/hashtab.h
-elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
- $(INCDIR)/coff/external.h ecoffswap.h elf32-target.h
-elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
- $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- elf32-target.h
-elf32-or32.lo: elf32-or32.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h elf32-target.h
-elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
- elf32-ppc.h elf32-target.h
-elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
- elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h elf32-sh64.h $(srcdir)/../opcodes/sh64-opc.h
-elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \
- elf32-target.h
-elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h elf32-target.h
-elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- elf32-target.h
-elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \
- $(INCDIR)/xtensa-config.h elf32-target.h
-elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
- $(INCDIR)/safe-ctype.h
-elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
-elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
-elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
-epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \
- aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h
-i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \
- $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
-i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386linux.lo: i386linux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-i386lynx.lo: i386lynx.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386msdos.lo: i386msdos.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h
-i386netbsd.lo: i386netbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/os9k.h
-ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \
- libieee.h $(INCDIR)/safe-ctype.h
-m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-m68klinux.lo: m68klinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-m68klynx.lo: m68klynx.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
- $(INCDIR)/libiberty.h mach-o-target.c
-mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-nlm.lo: nlm.c $(INCDIR)/filenames.h libnlm.h $(INCDIR)/nlm/common.h \
- $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
-nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/nlm/i386-ext.h \
- libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
- $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h
-nlm32-sparc.lo: nlm32-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/nlm/sparc32-ext.h libnlm.h $(INCDIR)/nlm/common.h \
- $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \
- nlm-target.h
-nlm32-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/nlm/ppc-ext.h \
- libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
- $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h
-nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
- $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
-ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/oasys.h liboasys.h
-pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \
- aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
-pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \
- $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- coffcode.h peicode.h libpei.h
-pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \
- $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \
- libpei.h
-pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/coff/mipspe.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
- $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h
-reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/coff/internal.h libcoff.h
-riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-sparclynx.lo: sparclynx.c $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
- libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-sparcnetbsd.lo: sparcnetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \
- $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h vms.h
-vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
- libxcoff.h
-xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
-xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
- $(INCDIR)/xtensa-isa-internal.h
-xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
- $(INCDIR)/xtensa-isa-internal.h
-aix5ppc-core.lo: aix5ppc-core.c
-aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
- libcoff.h libecoff.h coffswap.h ecoffswap.h
-coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
- $(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h \
- coffswap.h
-demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \
- $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \
- $(INCDIR)/elf/reloc-macros.h elf64-target.h
-elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
- $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
- libecoff.h ecoffswap.h elf64-target.h
-elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
- $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h libhppa.h \
- elf64-hppa.h elf-hppa.h elf64-target.h
-elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf64-target.h
-elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
- ecoffswap.h elf32-target.h
-elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
- $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \
- elf64-target.h
-elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/mmix.h elf64-target.h
-elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc64.h $(INCDIR)/elf/reloc-macros.h \
- elf64-ppc.h elf64-target.h
-elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
-elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
-elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
- $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
-elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
- $(INCDIR)/safe-ctype.h
-mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
-nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
- $(INCDIR)/nlm/alpha-ext.h libnlm.h $(INCDIR)/nlm/common.h \
- $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \
- nlm-target.h
-nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
- $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
-aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h
-hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h
-irix-core.lo: irix-core.c $(INCDIR)/filenames.h
-lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h
-osf-core.lo: osf-core.c $(INCDIR)/filenames.h
-sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h
-trad-core.lo: trad-core.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h
-cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h
-elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \
- elf32-target.h
-elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \
- elf64-target.h
-peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h libpei.h
-pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h libpei.h
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/contrib/binutils/bfd/Makefile.in b/contrib/binutils/bfd/Makefile.in
deleted file mode 100644
index a6685f2..0000000
--- a/contrib/binutils/bfd/Makefile.in
+++ /dev/null
@@ -1,2173 +0,0 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = .
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_alias = @build_alias@
-build_triplet = @build@
-host_alias = @host_alias@
-host_triplet = @host@
-target_alias = @target_alias@
-target_triplet = @target@
-AR = @AR@
-AS = @AS@
-BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
-BFD_HOST_64_BIT = @BFD_HOST_64_BIT@
-BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@
-BFD_HOST_LONG_LONG = @BFD_HOST_LONG_LONG@
-BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
-CC = @CC@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-COREFILE = @COREFILE@
-COREFLAG = @COREFLAG@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-DATADIRNAME = @DATADIRNAME@
-DLLTOOL = @DLLTOOL@
-EXEEXT = @EXEEXT@
-EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
-GMOFILES = @GMOFILES@
-GMSGFMT = @GMSGFMT@
-GT_NO = @GT_NO@
-GT_YES = @GT_YES@
-HDEFINES = @HDEFINES@
-INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
-INSTOBJEXT = @INSTOBJEXT@
-INTLDEPS = @INTLDEPS@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-MSGFMT = @MSGFMT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-POFILES = @POFILES@
-POSUB = @POSUB@
-RANLIB = @RANLIB@
-STRIP = @STRIP@
-TDEFINES = @TDEFINES@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-WIN32LDFLAGS = @WIN32LDFLAGS@
-WIN32LIBADD = @WIN32LIBADD@
-all_backends = @all_backends@
-bfd_backends = @bfd_backends@
-bfd_default_target_size = @bfd_default_target_size@
-bfd_file_ptr = @bfd_file_ptr@
-bfd_libs = @bfd_libs@
-bfd_machines = @bfd_machines@
-bfd_ufile_ptr = @bfd_ufile_ptr@
-bfd_version = @bfd_version@
-bfd_version_string = @bfd_version_string@
-l = @l@
-tdefaults = @tdefaults@
-wordsize = @wordsize@
-
-AUTOMAKE_OPTIONS = cygnus
-
-INCDIR = $(srcdir)/../include
-CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
-MKDEP = gcc -MM
-
-SUBDIRS = doc po
-
-docdir = doc
-bfdlibdir = @bfdlibdir@
-bfdincludedir = @bfdincludedir@
-
-bfdlib_LTLIBRARIES = libbfd.la
-
-WARN_CFLAGS = @WARN_CFLAGS@
-AM_CFLAGS = $(WARN_CFLAGS)
-
-# bfd.h goes here, for now
-BFD_H = bfd.h
-
-# Jim Kingdon notes:
-# Writing S-records should be included in all (or at least most)
-# *-*-coff, *-*-aout, etc., configurations, because people will want to
-# be able to use objcopy to create S-records. (S-records are not useful
-# for the debugger, so if you are downloading things as S-records you
-# need two copies of the executable, one to download and one for the
-# debugger).
-BFD32_LIBS = \
- archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
- cache.lo coffgen.lo corefile.lo \
- format.lo init.lo libbfd.lo opncls.lo reloc.lo \
- section.lo syms.lo targets.lo hash.lo linker.lo \
- srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
- merge.lo dwarf2.lo simple.lo
-
-
-BFD64_LIBS = archive64.lo
-
-BFD32_LIBS_CFILES = \
- archive.c archures.c bfd.c bfdio.c bfdwin.c \
- cache.c coffgen.c corefile.c \
- format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c \
- srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- merge.c dwarf2.c simple.c
-
-
-BFD64_LIBS_CFILES = archive64.c
-
-# This list is alphabetized to make it easier to keep in sync
-# with the decls and initializer in archures.c.
-ALL_MACHINES = \
- cpu-a29k.lo \
- cpu-alpha.lo \
- cpu-arc.lo \
- cpu-arm.lo \
- cpu-avr.lo \
- cpu-cris.lo \
- cpu-d10v.lo \
- cpu-d30v.lo \
- cpu-dlx.lo \
- cpu-fr30.lo \
- cpu-frv.lo \
- cpu-h8300.lo \
- cpu-h8500.lo \
- cpu-hppa.lo \
- cpu-ia64.lo \
- cpu-i370.lo \
- cpu-i386.lo \
- cpu-i860.lo \
- cpu-i960.lo \
- cpu-ip2k.lo \
- cpu-iq2000.lo \
- cpu-m32r.lo \
- cpu-m68hc11.lo \
- cpu-m68hc12.lo \
- cpu-m68k.lo \
- cpu-m88k.lo \
- cpu-m10200.lo \
- cpu-m10300.lo \
- cpu-mcore.lo \
- cpu-mips.lo \
- cpu-mmix.lo \
- cpu-msp430.lo \
- cpu-or32.lo \
- cpu-ns32k.lo \
- cpu-openrisc.lo \
- cpu-pdp11.lo \
- cpu-pj.lo \
- cpu-powerpc.lo \
- cpu-rs6000.lo \
- cpu-s390.lo \
- cpu-sh.lo \
- cpu-sparc.lo \
- cpu-tic30.lo \
- cpu-tic4x.lo \
- cpu-tic54x.lo \
- cpu-tic80.lo \
- cpu-v850.lo \
- cpu-vax.lo \
- cpu-we32k.lo \
- cpu-w65.lo \
- cpu-xstormy16.lo \
- cpu-xtensa.lo \
- cpu-z8k.lo
-
-
-ALL_MACHINES_CFILES = \
- cpu-a29k.c \
- cpu-alpha.c \
- cpu-arc.c \
- cpu-arm.c \
- cpu-avr.c \
- cpu-cris.c \
- cpu-d10v.c \
- cpu-d30v.c \
- cpu-dlx.c \
- cpu-fr30.c \
- cpu-frv.c \
- cpu-h8300.c \
- cpu-h8500.c \
- cpu-hppa.c \
- cpu-ia64.c \
- cpu-i370.c \
- cpu-i386.c \
- cpu-i860.c \
- cpu-i960.c \
- cpu-ip2k.c \
- cpu-iq2000.c \
- cpu-m32r.c \
- cpu-m68hc11.c \
- cpu-m68hc12.c \
- cpu-m68k.c \
- cpu-m88k.c \
- cpu-m10200.c \
- cpu-m10300.c \
- cpu-mcore.c \
- cpu-mips.c \
- cpu-mmix.c \
- cpu-msp430.c \
- cpu-or32.c \
- cpu-ns32k.c \
- cpu-openrisc.c \
- cpu-pdp11.c \
- cpu-pj.c \
- cpu-powerpc.c \
- cpu-rs6000.c \
- cpu-s390.c \
- cpu-sh.c \
- cpu-sparc.c \
- cpu-tic30.c \
- cpu-tic4x.c \
- cpu-tic54x.c \
- cpu-tic80.c \
- cpu-v850.c \
- cpu-vax.c \
- cpu-we32k.c \
- cpu-w65.c \
- cpu-xstormy16.c \
- cpu-xtensa.c \
- cpu-z8k.c
-
-
-# The .o files needed by all of the 32 bit vectors that are configured into
-# target_vector in targets.c if configured with --enable-targets=all.
-BFD32_BACKENDS = \
- aout-adobe.lo \
- aout-arm.lo \
- aout-cris.lo \
- aout-ns32k.lo \
- aout-sparcle.lo \
- aout-tic30.lo \
- aout0.lo \
- aout32.lo \
- armnetbsd.lo \
- bout.lo \
- cf-i386lynx.lo \
- cf-m68klynx.lo \
- cf-sparclynx.lo \
- coff-a29k.lo \
- coff-apollo.lo \
- coff-arm.lo \
- coff-aux.lo \
- coff-h8300.lo \
- coff-h8500.lo \
- coff-i386.lo \
- coff-go32.lo \
- coff-i860.lo \
- coff-i960.lo \
- coff-m68k.lo \
- coff-m88k.lo \
- coff-mips.lo \
- coff-or32.lo \
- coff-rs6000.lo \
- coff-sh.lo \
- coff-sparc.lo \
- coff-stgo32.lo \
- coff-svm68k.lo \
- coff-tic30.lo \
- coff-tic4x.lo \
- coff-tic54x.lo \
- coff-tic80.lo \
- coff-u68k.lo \
- coff-we32k.lo \
- coff-w65.lo \
- coff-z8k.lo \
- cofflink.lo \
- dwarf1.lo \
- ecoff.lo \
- ecofflink.lo \
- efi-app-ia32.lo \
- elf.lo \
- elf32-am33lin.lo \
- elf32-arc.lo \
- elfarm-oabi.lo \
- elfarm-nabi.lo \
- elf32-avr.lo \
- elf32-cris.lo \
- elf32-d10v.lo \
- elf32-d30v.lo \
- elf32-dlx.lo \
- elf32-fr30.lo \
- elf32-frv.lo \
- elf32-gen.lo \
- elf32-h8300.lo \
- elf32-hppa.lo \
- elf32-i370.lo \
- elf32-i386.lo \
- elf32-i860.lo \
- elf32-i960.lo \
- elf32-ia64.lo \
- elf32-ip2k.lo \
- elf32-iq2000.lo \
- elf32-m32r.lo \
- elf32-m68hc11.lo \
- elf32-m68hc12.lo \
- elf32-m68hc1x.lo \
- elf32-m68k.lo \
- elf32-m88k.lo \
- elf-m10200.lo \
- elf-m10300.lo \
- elf32-mcore.lo \
- elfxx-mips.lo \
- elf32-mips.lo \
- elf32-msp430.lo \
- elf32-openrisc.lo \
- elf32-or32.lo \
- elf32-pj.lo \
- elf32-ppc.lo \
- elf32-s390.lo \
- elf32-sh.lo \
- elf32-sh64.lo \
- elf32-sh64-com.lo \
- elf32-sparc.lo \
- elf32-v850.lo \
- elf32-vax.lo \
- elf32-xstormy16.lo \
- elf32-xtensa.lo \
- elf32.lo \
- elflink.lo \
- elf-strtab.lo \
- elf-eh-frame.lo \
- epoc-pe-arm.lo \
- epoc-pei-arm.lo \
- hp300bsd.lo \
- hp300hpux.lo \
- som.lo \
- i386aout.lo \
- i386bsd.lo \
- i386dynix.lo \
- i386freebsd.lo \
- i386linux.lo \
- i386lynx.lo \
- i386msdos.lo \
- i386netbsd.lo \
- i386mach3.lo \
- i386os9k.lo \
- ieee.lo \
- m68k4knetbsd.lo \
- m68klinux.lo \
- m68klynx.lo \
- m68knetbsd.lo \
- m88kmach3.lo \
- mach-o.lo \
- mipsbsd.lo \
- newsos3.lo \
- nlm.lo \
- nlm32-i386.lo \
- nlm32-sparc.lo \
- nlm32-ppc.lo \
- nlm32.lo \
- ns32knetbsd.lo \
- oasys.lo \
- pc532-mach.lo \
- pdp11.lo \
- pef.lo \
- pe-arm.lo \
- pei-arm.lo \
- pe-i386.lo \
- pei-i386.lo \
- pe-mcore.lo \
- pei-mcore.lo \
- pe-ppc.lo \
- pei-ppc.lo \
- pe-sh.lo \
- pei-sh.lo \
- pe-mips.lo \
- pei-mips.lo \
- peigen.lo \
- ppcboot.lo \
- reloc16.lo \
- riscix.lo \
- sparclinux.lo \
- sparclynx.lo \
- sparcnetbsd.lo \
- sunos.lo \
- vaxnetbsd.lo \
- vax1knetbsd.lo \
- vaxbsd.lo \
- versados.lo \
- vms.lo \
- vms-gsd.lo \
- vms-hdr.lo \
- vms-misc.lo \
- vms-tir.lo \
- xcofflink.lo \
- xsym.lo \
- xtensa-isa.lo \
- xtensa-modules.lo
-
-
-BFD32_BACKENDS_CFILES = \
- aout-adobe.c \
- aout-arm.c \
- aout-cris.c \
- aout-ns32k.c \
- aout-sparcle.c \
- aout-tic30.c \
- aout0.c \
- aout32.c \
- armnetbsd.c \
- bout.c \
- cf-i386lynx.c \
- cf-m68klynx.c \
- cf-sparclynx.c \
- coff-a29k.c \
- coff-apollo.c \
- coff-arm.c \
- coff-aux.c \
- coff-h8300.c \
- coff-h8500.c \
- coff-i386.c \
- coff-i860.c \
- coff-go32.c \
- coff-i960.c \
- coff-m68k.c \
- coff-m88k.c \
- coff-mips.c \
- coff-or32.c \
- coff-rs6000.c \
- coff-sh.c \
- coff-sparc.c \
- coff-stgo32.c \
- coff-svm68k.c \
- coff-tic30.c \
- coff-tic4x.c \
- coff-tic54x.c \
- coff-tic80.c \
- coff-u68k.c \
- coff-we32k.c \
- coff-w65.c \
- coff-z8k.c \
- cofflink.c \
- dwarf1.c \
- ecoff.c \
- ecofflink.c \
- efi-app-ia32.c \
- elf.c \
- elf32-am33lin.c \
- elf32-arc.c \
- elfarm-oabi.c \
- elfarm-nabi.c \
- elf32-avr.c \
- elf32-cris.c \
- elf32-d10v.c \
- elf32-d30v.c \
- elf32-dlx.c \
- elf32-fr30.c \
- elf32-frv.c \
- elf32-gen.c \
- elf32-h8300.c \
- elf32-hppa.c \
- elf32-i370.c \
- elf32-i386.c \
- elf32-i860.c \
- elf32-i960.c \
- elf32-ip2k.c \
- elf32-iq2000.c \
- elf32-m32r.c \
- elf32-m68k.c \
- elf32-m68hc11.c \
- elf32-m68hc12.c \
- elf32-m68hc1x.c \
- elf32-m88k.c \
- elf-m10200.c \
- elf-m10300.c \
- elf32-mcore.c \
- elfxx-mips.c \
- elf32-mips.c \
- elf32-msp430.c \
- elf32-openrisc.c \
- elf32-or32.c \
- elf32-pj.c \
- elf32-ppc.c \
- elf32-sh64.c \
- elf32-sh64-com.c \
- elf32-s390.c \
- elf32-sh.c \
- elf32-sparc.c \
- elf32-v850.c \
- elf32-vax.c \
- elf32-xstormy16.c \
- elf32-xtensa.c \
- elf32.c \
- elflink.c \
- elf-strtab.c \
- elf-eh-frame.c \
- epoc-pe-arm.c \
- epoc-pei-arm.c \
- hp300bsd.c \
- hp300hpux.c \
- som.c \
- i386aout.c \
- i386bsd.c \
- i386dynix.c \
- i386freebsd.c \
- i386linux.c \
- i386lynx.c \
- i386msdos.c \
- i386netbsd.c \
- i386mach3.c \
- i386os9k.c \
- ieee.c \
- m68k4knetbsd.c \
- m68klinux.c \
- m68klynx.c \
- m68knetbsd.c \
- m88kmach3.c \
- mach-o.c \
- mipsbsd.c \
- newsos3.c \
- nlm.c \
- nlm32-i386.c \
- nlm32-sparc.c \
- nlm32-ppc.c \
- nlm32.c \
- ns32knetbsd.c \
- oasys.c \
- pc532-mach.c \
- pdp11.c \
- pef.c \
- pe-arm.c \
- pei-arm.c \
- pe-i386.c \
- pei-i386.c \
- pe-mcore.c \
- pei-mcore.c \
- pe-ppc.c \
- pei-ppc.c \
- pe-sh.c \
- pei-sh.c \
- pe-mips.c \
- pei-mips.c \
- ppcboot.c \
- reloc16.c \
- riscix.c \
- sparclinux.c \
- sparclynx.c \
- sparcnetbsd.c \
- sunos.c \
- vaxnetbsd.c \
- vax1knetbsd.c \
- vaxbsd.c \
- versados.c \
- vms.c \
- vms-gsd.c \
- vms-hdr.c \
- vms-misc.c \
- vms-tir.c \
- xcofflink.c \
- xsym.c \
- xtensa-isa.c \
- xtensa-modules.c
-
-
-# The .o files needed by all of the 64 bit vectors that are configured into
-# target_vector in targets.c if configured with --enable-targets=all
-# and --enable-64-bit-bfd.
-BFD64_BACKENDS = \
- aix5ppc-core.lo \
- aout64.lo \
- coff-alpha.lo \
- coff64-rs6000.lo \
- demo64.lo \
- efi-app-ia64.lo \
- elf64-x86-64.lo \
- elf64-alpha.lo \
- elf64-hppa.lo \
- elf64-ia64.lo \
- elf64-gen.lo \
- elfn32-mips.lo \
- elf64-mips.lo \
- elf64-mmix.lo \
- elf64-sh64.lo \
- elf64-ppc.lo \
- elf64-s390.lo \
- elf64-sparc.lo \
- elf64.lo \
- mmo.lo \
- nlm32-alpha.lo \
- nlm64.lo \
- pepigen.lo
-
-
-BFD64_BACKENDS_CFILES = \
- aix5ppc-core.c \
- aout64.c \
- coff-alpha.c \
- coff64-rs6000.c \
- demo64.c \
- efi-app-ia64.c \
- elf64-x86-64.c \
- elf64-alpha.c \
- elf64-hppa.c \
- elf64-gen.c \
- elfn32-mips.c \
- elf64-mips.c \
- elf64-mmix.c \
- elf64-ppc.c \
- elf64-s390.c \
- elf64-sh64.c \
- elf64-sparc.c \
- elf64.c \
- mmo.c \
- nlm32-alpha.c \
- nlm64.c
-
-
-OPTIONAL_BACKENDS = \
- aix386-core.lo \
- hpux-core.lo \
- irix-core.lo \
- lynx-core.lo \
- osf-core.lo \
- sco5-core.lo \
- trad-core.lo \
- cisco-core.lo
-
-
-OPTIONAL_BACKENDS_CFILES = \
- aix386-core.c \
- hpux-core.c \
- irix-core.c \
- lynx-core.c \
- osf-core.c \
- sco5-core.c \
- trad-core.c \
- cisco-core.c
-
-
-# These are defined by configure.in:
-WORDSIZE = @wordsize@
-ALL_BACKENDS = @all_backends@
-BFD_BACKENDS = @bfd_backends@
-BFD_LIBS = @bfd_libs@
-BFD_MACHINES = @bfd_machines@
-TDEFAULTS = @tdefaults@
-
-INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl
-
-# C source files that correspond to .o's.
-SOURCE_CFILES = \
- $(BFD32_LIBS_CFILES) \
- $(BFD64_LIBS_CFILES) \
- $(ALL_MACHINES_CFILES) \
- $(BFD32_BACKENDS_CFILES) \
- $(BFD64_BACKENDS_CFILES) \
- $(OPTIONAL_BACKENDS_CFILES)
-
-
-BUILD_CFILES = \
- elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
-
-
-CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
-
-SOURCE_HFILES = \
- aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
- elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \
- elf64-hppa.h elfcode.h elfcore.h \
- freebsd.h genlink.h go32stub.h \
- libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
- libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
- netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
- pef.h pef-traceback.h peicode.h som.h version.h \
- vms.h xcoff-target.h xsym.h
-
-
-BUILD_HFILES = \
- bfdver.h elf32-target.h elf64-target.h targmatch.h
-
-
-HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
-
-SRC_POTFILES = $(SOURCE_CFILES) $(SOURCE_HFILES)
-BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
-
-# Various kinds of .o files to put in libbfd.a:
-# BFD_BACKENDS Routines the configured targets need.
-# BFD_MACHINES Architecture-specific routines the configured targets need.
-# COREFILE Core file routines for a native configuration
-OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@
-
-libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
-libbfd_la_DEPENDENCIES = $(OFILES) ofiles
-libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
-libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
-
-# libtool will build .libs/libbfd.a. We create libbfd.a in the build
-# directory so that we don't have to convert all the programs that use
-# libbfd.a simultaneously. This is a hack which should be removed if
-# everything else starts using libtool. FIXME.
-
-noinst_LIBRARIES = libbfd.a
-libbfd_a_SOURCES =
-
-BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
-LOCAL_H_DEPS = libbfd.h sysdep.h config.h
-
-BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
- reloc.c syms.c bfd.c bfdio.c bfdwin.c \
- archive.c corefile.c targets.c format.c
-
-BFD64_H_FILES = archive64.c
-LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c bfdio.c bfdwin.c \
- cache.c reloc.c archures.c elf.c
-
-LIBCOFF_H_FILES = libcoff-in.h coffcode.h
-
-MOSTLYCLEANFILES = ofiles stamp-ofiles
-
-CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
- stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
-
-
-DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
-CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = bfd-in3.h bfdver.h
-LIBRARIES = $(noinst_LIBRARIES)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I.
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-libbfd_a_LIBADD =
-libbfd_a_OBJECTS =
-LTLIBRARIES = $(bfdlib_LTLIBRARIES)
-
-libbfd_la_OBJECTS = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
-cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo \
-reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo \
-binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo \
-simple.lo archive64.lo
-CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON = README ./stamp-h.in COPYING ChangeLog Makefile.am \
-Makefile.in TODO acinclude.m4 aclocal.m4 bfd-in2.h config.in configure \
-configure.in version.h
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP_ENV = --best
-SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
-OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
-
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .S .c .lo .o .obj .s
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
- cd $(srcdir) && $(ACLOCAL)
-$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
- cd $(srcdir) && $(AUTOCONF)
-
-config.h: stamp-h
- @if test ! -f $@; then \
- rm -f stamp-h; \
- $(MAKE) stamp-h; \
- else :; fi
-stamp-h: $(srcdir)/config.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES= CONFIG_HEADERS=config.h:config.in \
- $(SHELL) ./config.status
- @echo timestamp > stamp-h 2> /dev/null
-$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
- @if test ! -f $@; then \
- rm -f $(srcdir)/stamp-h.in; \
- $(MAKE) $(srcdir)/stamp-h.in; \
- else :; fi
-$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOHEADER)
- @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
-
-mostlyclean-hdr:
-
-clean-hdr:
-
-distclean-hdr:
- -rm -f config.h
-
-maintainer-clean-hdr:
-bfd-in3.h: $(top_builddir)/config.status bfd-in2.h
- cd $(top_builddir) && CONFIG_FILES=$@:bfd-in2.h CONFIG_HEADERS= $(SHELL) ./config.status
-bfdver.h: $(top_builddir)/config.status version.h
- cd $(top_builddir) && CONFIG_FILES=$@:version.h CONFIG_HEADERS= $(SHELL) ./config.status
-
-mostlyclean-noinstLIBRARIES:
-
-clean-noinstLIBRARIES:
- -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-
-distclean-noinstLIBRARIES:
-
-maintainer-clean-noinstLIBRARIES:
-
-.c.o:
- $(COMPILE) -c $<
-
-# FIXME: We should only use cygpath when building on Windows,
-# and only if it is available.
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.o:
- $(COMPILE) -c $<
-
-mostlyclean-compile:
- -rm -f *.o core *.core
- -rm -f *.$(OBJEXT)
-
-clean-compile:
-
-distclean-compile:
- -rm -f *.tab.c
-
-maintainer-clean-compile:
-
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.s.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.S.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-distclean-libtool:
-
-maintainer-clean-libtool:
-
-mostlyclean-bfdlibLTLIBRARIES:
-
-clean-bfdlibLTLIBRARIES:
- -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES)
-
-distclean-bfdlibLTLIBRARIES:
-
-maintainer-clean-bfdlibLTLIBRARIES:
-
-libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
- $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-
-@SET_MAKE@
-
-all-recursive install-data-recursive install-exec-recursive \
-installdirs-recursive install-recursive uninstall-recursive install-info-recursive \
-check-recursive installcheck-recursive info-recursive dvi-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- dot_seen=no; \
- rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
- rev="$$subdir $$rev"; \
- test "$$subdir" != "." || dot_seen=yes; \
- done; \
- test "$$dot_seen" = "no" && rev=". $$rev"; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
- fi; \
- done; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)config.in$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.in $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-
-# This target untars the dist file and tries a VPATH configuration. Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
- -rm -rf $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
- mkdir $(distdir)/=build
- mkdir $(distdir)/=inst
- dc_install_base=`cd $(distdir)/=inst && pwd`; \
- cd $(distdir)/=build \
- && ../configure --srcdir=.. --prefix=$$dc_install_base \
- && $(MAKE) $(AM_MAKEFLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) dvi \
- && $(MAKE) $(AM_MAKEFLAGS) check \
- && $(MAKE) $(AM_MAKEFLAGS) install \
- && $(MAKE) $(AM_MAKEFLAGS) installcheck \
- && $(MAKE) $(AM_MAKEFLAGS) dist
- -rm -rf $(distdir)
- @banner="$(distdir).tar.gz is ready for distribution"; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"
-dist: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
-dist-all: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
-distdir: $(DISTFILES)
- -rm -rf $(distdir)
- mkdir $(distdir)
- -chmod 777 $(distdir)
- @for file in $(DISTFILES); do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
- for subdir in $(SUBDIRS); do \
- if test "$$subdir" = .; then :; else \
- test -d $(distdir)/$$subdir \
- || mkdir $(distdir)/$$subdir \
- || exit 1; \
- chmod 777 $(distdir)/$$subdir; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
- || exit 1; \
- fi; \
- done
-info-am:
-info: info-recursive
-dvi-am:
-dvi: dvi-recursive
-check-am:
-check: check-recursive
-installcheck-am:
-installcheck: installcheck-recursive
-install-info-am:
-install-info: install-info-recursive
-all-recursive-am: config.h
- $(MAKE) $(AM_MAKEFLAGS) all-recursive
-
-install-exec-am:
-install-exec: install-exec-recursive
-
-install-data-am: install-bfdlibLTLIBRARIES
-install-data: install-data-recursive
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-recursive
-uninstall-am: uninstall-bfdlibLTLIBRARIES
-uninstall: uninstall-recursive
-all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
-all-redirect: all-recursive-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs: installdirs-recursive
-installdirs-am:
- $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
-
-
-mostlyclean-generic:
- -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
- -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
-
-maintainer-clean-generic:
-mostlyclean-am: mostlyclean-hdr mostlyclean-noinstLIBRARIES \
- mostlyclean-compile mostlyclean-libtool \
- mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \
- mostlyclean-generic
-
-mostlyclean: mostlyclean-recursive
-
-clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \
- clean-bfdlibLTLIBRARIES clean-tags clean-generic \
- mostlyclean-am
-
-clean: clean-recursive
-
-distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \
- distclean-libtool distclean-bfdlibLTLIBRARIES \
- distclean-tags distclean-generic clean-am
- -rm -f libtool
-
-distclean: distclean-recursive
- -rm -f config.status
-
-maintainer-clean-am: maintainer-clean-hdr \
- maintainer-clean-noinstLIBRARIES \
- maintainer-clean-compile maintainer-clean-libtool \
- maintainer-clean-bfdlibLTLIBRARIES \
- maintainer-clean-tags maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-recursive
- -rm -f config.status
-
-.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
-mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
-clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile mostlyclean-libtool distclean-libtool \
-clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \
-distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \
-maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \
-install-bfdlibLTLIBRARIES install-data-recursive \
-uninstall-data-recursive install-exec-recursive \
-uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
-all-recursive check-recursive installcheck-recursive info-recursive \
-dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
-maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
-dvi-am dvi check check-am installcheck-am installcheck install-info-am \
-install-info all-recursive-am install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
- for file in $(SRC_POTFILES); do echo $$file; done \
- | LC_COLLATE= sort > tmp.src \
- && mv tmp.src $(srcdir)/po/SRC-POTFILES.in
-
-po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
- for file in $(BLD_POTFILES); do echo $$file; done \
- | LC_COLLATE= sort > tmp.bld \
- && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
-
-diststuff: info
-
-stamp-ofiles: Makefile
- rm -f tofiles
- f=""; \
- for i in $(OFILES) ; do \
- case " $$f " in \
- *" $$i "*) ;; \
- *) f="$$f $$i" ;; \
- esac ; \
- done ; \
- echo $$f > tofiles
- $(SHELL) $(srcdir)/../move-if-change tofiles ofiles
- touch stamp-ofiles
-
-ofiles: stamp-ofiles ; @true
-
-stamp-lib: libbfd.la
- libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
- if [ -f $$libtooldir/libbfd.a ]; then \
- cp $$libtooldir/libbfd.a libbfd.tmp; \
- $(RANLIB) libbfd.tmp; \
- $(SHELL) $(srcdir)/../move-if-change libbfd.tmp libbfd.a; \
- else true; fi
- touch stamp-lib
-
-libbfd.a: stamp-lib ; @true
-
-# This file holds an array associating configuration triplets and
-# vector names. It is built from config.bfd. It is not compiled by
-# itself, but is included by targets.c.
-targmatch.h: config.bfd targmatch.sed
- rm -f targmatch.h
- sed -f $(srcdir)/targmatch.sed < $(srcdir)/config.bfd > targmatch.new
- mv -f targmatch.new targmatch.h
-
-# When compiling archures.c and targets.c, supply the default target
-# info from configure.
-
-targets.lo: targets.c Makefile
- $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/targets.c
-
-archures.lo: archures.c Makefile
- $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
-
-elf32-target.h : elfxx-target.h
- rm -f elf32-target.h
- sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
- mv -f elf32-target.new elf32-target.h
-
-elf64-target.h : elfxx-target.h
- rm -f elf64-target.h
- sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
- mv -f elf64-target.new elf64-target.h
-
-elf32-ia64.c : elfxx-ia64.c
- rm -f elf32-ia64.c
- sed -e s/NN/32/g < $(srcdir)/elfxx-ia64.c > elf32-ia64.new
- mv -f elf32-ia64.new elf32-ia64.c
-
-elf64-ia64.c : elfxx-ia64.c
- rm -f elf64-ia64.c
- sed -e s/NN/64/g < $(srcdir)/elfxx-ia64.c > elf64-ia64.new
- mv -f elf64-ia64.new elf64-ia64.c
-
-peigen.c : peXXigen.c
- rm -f peigen.c
- sed -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
- mv -f peigen.new peigen.c
-
-pepigen.c : peXXigen.c
- rm -f pepigen.c
- sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
- mv -f pepigen.new pepigen.c
-$(BFD32_LIBS) \
- $(BFD64_LIBS) \
- $(ALL_MACHINES) \
- $(BFD32_BACKENDS) \
- $(BFD64_BACKENDS) \
- $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-
-install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd
- @$(NORMAL_INSTALL)
-
-uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd
- @$(NORMAL_UNINSTALL)
-
-.PHONY: install_libbfd uninstall_libbfd
-install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H)
- $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
- $(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
- @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
- $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
- else :; fi; \
- done
- $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h
- $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h
- $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h
- $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h
-
-uninstall_libbfd:
- list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
- done
- rm -f $(DESTDIR)$(bfdincludedir)/bfd.h
- rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h
- rm -f $(DESTDIR)$(bfdincludedir)/symcat.h
- rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h
-
-Makefile: $(srcdir)/configure.in
-
-# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
-DEP: dep.sed $(CFILES) $(HFILES) bfd.h
- rm -f DEP1
- $(MAKE) MKDEP="$(MKDEP)" DEP1
- sed -f dep.sed < DEP1 > DEPA
- echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
- if grep ' /' DEPA > /dev/null 2> /dev/null; then \
- echo 'make DEP failed!'; exit 1; \
- else \
- mv -f DEPA $@; \
- fi
-
-DEP1: $(CFILES)
- echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
- echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
- $(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
- mv -f DEP2 $@
-
-dep.sed: dep-in.sed config.status
- sed <$(srcdir)/dep-in.sed >dep.sed \
- -e 's!@BFD_H@!$(BFD_H)!' \
- -e 's!@SRCDIR@!$(srcdir)!' \
- -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/bfd$$,,`'!'
-
-dep: DEP
- sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
- cat DEP >> tmp-Makefile
- $(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
-
-dep-in: DEP
- sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
- cat DEP >> tmp-Makefile.in
- $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
-
-dep-am: DEP
- sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
- cat DEP >> tmp-Makefile.am
- $(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
-
-host-aout.lo: Makefile
-
-# The following program can be used to generate a simple config file
-# which can be folded into an h-XXX file for a new host, with some editing.
-aout-params.h: gen-aout
- ./gen-aout host > aout-params.h
-gen-aout: $(srcdir)/gen-aout.c Makefile
- $(CC) -o gen-aout $(CFLAGS) $(LFLAGS) $(srcdir)/gen-aout.c
-
-$(BFD_H): stmp-bfd-h ; @true
-
-stmp-bfd-h: bfd-in3.h
- rm -f bfd-tmp.h
- cp bfd-in3.h bfd-tmp.h
- $(SHELL) $(srcdir)/../move-if-change bfd-tmp.h $(BFD_H)
- rm -f bfd-tmp.h
- touch stmp-bfd-h
-
-# Could really use a "copy-if-change"...
-headers:
- (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS))
- cp $(docdir)/bfd.h bfd-in2.h-new
- $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
- cp $(docdir)/libbfd.h libbfd.h-new
- $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
- cp $(docdir)/libcoff.h libcoff.h-new
- $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
-
-# We only rebuild the header files automatically if we have been
-# configured with --enable-maintainer-mode.
-
-$(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true
-stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES)
- (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
- cp $(docdir)/bfd.h bfd-in2.h-new
- $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
- touch stmp-bin2-h
-
-$(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true
-stmp-lbfd-h: $(LIBBFD_H_FILES)
- (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h)
- cp $(docdir)/libbfd.h libbfd.h-new
- $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
- touch stmp-lbfd-h
-
-$(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true
-stmp-lcoff-h: $(LIBCOFF_H_FILES)
- (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h)
- cp $(docdir)/libcoff.h libcoff.h-new
- $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
- touch stmp-lcoff-h
-
-# We want to rerun configure if config.bfd, configure.host or version.h change.
-config.status: $(srcdir)/configure $(srcdir)/config.bfd \
- $(srcdir)/configure.host $(srcdir)/version.h
- $(SHELL) ./config.status --recheck
-
-# What appears below is generated by a hacked mkdep using gcc -MM.
-
-# DO NOT DELETE THIS LINE -- mkdep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
- $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h
-archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
-bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h
-bfdio.lo: bfdio.c $(INCDIR)/filenames.h
-bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h
-cache.lo: cache.c $(INCDIR)/filenames.h
-coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h
-corefile.lo: corefile.c $(INCDIR)/filenames.h
-format.lo: format.c $(INCDIR)/filenames.h
-init.lo: init.c $(INCDIR)/filenames.h
-libbfd.lo: libbfd.c $(INCDIR)/filenames.h
-opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
- $(INCDIR)/libiberty.h
-reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
-targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \
- targmatch.h
-hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
-linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h
-srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h
-binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
-tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h
-stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
-stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
-merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
- $(INCDIR)/libiberty.h
-dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
-simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h
-cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h
-cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h
-cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
-cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
-cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
-cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
-cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
-cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
-cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
-cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h
-cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h
-cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h
-cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h
-cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h cpu-ia64-opc.c \
- $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h
-cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h
-cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h
-cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h
-cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h
-cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h
-cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h
-cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h
-cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h
-cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h
-cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h
-cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h
-cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h
-cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h
-cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h
-cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h
-cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h
-cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h
-cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h
-cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h
-cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h
-cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h
-cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h
-cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h
-cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h
-cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h
-cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h
-cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h
-cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h
-cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h
-cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h
-cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h
-cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
-cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h
-cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h
-cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
-cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
-cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
-cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
-aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
- $(INCDIR)/bfdlink.h
-aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \
- ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h
-aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \
- libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \
- $(INCDIR)/safe-ctype.h
-aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
- libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/bout.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def libaout.h
-cf-i386lynx.lo: cf-i386lynx.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-cf-m68klynx.lo: cf-m68klynx.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-cf-sparclynx.lo: cf-sparclynx.c coff-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-a29k.lo: coff-a29k.c $(INCDIR)/filenames.h $(INCDIR)/coff/a29k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-apollo.lo: coff-apollo.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/coff/arm.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \
- coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- coffswap.h
-coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/libiberty.h \
- coffcode.h coffswap.h
-coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/coff/i860.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-go32.lo: coff-go32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/coff/i960.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m68k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m88k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
- libcoff.h libecoff.h coffswap.h ecoffswap.h
-coff-or32.lo: coff-or32.c $(INCDIR)/filenames.h $(INCDIR)/coff/or32.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
- $(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h \
- coffswap.h
-coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
-coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/coff/sparc.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-stgo32.lo: coff-stgo32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/go32exe.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h go32stub.h
-coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
- $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
-coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \
- $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/coff/we32k.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
-coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
-cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/safe-ctype.h
-dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h
-ecoff.lo: ecoff.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h
-ecofflink.lo: ecofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/objalloc.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h
-efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
-elf32-am33lin.lo: elf32-am33lin.c elf-m10300.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h elf32-target.h
-elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- elf32-arm.h elf32-target.h
-elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- elf32-arm.h elf32-target.h
-elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/elf/dwarf2.h $(INCDIR)/hashtab.h elf32-target.h
-elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-target.h
-elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
- libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
-elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/iq2000.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
- $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/m68hc11.h elf32-target.h
-elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
- $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/m68hc11.h elf32-target.h
-elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
- $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/m68hc11.h
-elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-target.h
-elf-m10200.lo: elf-m10200.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-target.h
-elf-m10300.lo: elf-m10300.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
- $(INCDIR)/coff/external.h $(INCDIR)/hashtab.h
-elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
- $(INCDIR)/coff/external.h ecoffswap.h elf32-target.h
-elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
- $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- elf32-target.h
-elf32-or32.lo: elf32-or32.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h elf32-target.h
-elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
- elf32-ppc.h elf32-target.h
-elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
- elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h elf32-sh64.h $(srcdir)/../opcodes/sh64-opc.h
-elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \
- elf32-target.h
-elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h elf32-target.h
-elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- elf32-target.h
-elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \
- $(INCDIR)/xtensa-config.h elf32-target.h
-elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
- $(INCDIR)/safe-ctype.h
-elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
-elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
-elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
-epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \
- aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h
-i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \
- $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
-i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386linux.lo: i386linux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-i386lynx.lo: i386lynx.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386msdos.lo: i386msdos.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h
-i386netbsd.lo: i386netbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/os9k.h
-ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \
- libieee.h $(INCDIR)/safe-ctype.h
-m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-m68klinux.lo: m68klinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-m68klynx.lo: m68klynx.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
- $(INCDIR)/libiberty.h mach-o-target.c
-mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-nlm.lo: nlm.c $(INCDIR)/filenames.h libnlm.h $(INCDIR)/nlm/common.h \
- $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
-nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/nlm/i386-ext.h \
- libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
- $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h
-nlm32-sparc.lo: nlm32-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/nlm/sparc32-ext.h libnlm.h $(INCDIR)/nlm/common.h \
- $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \
- nlm-target.h
-nlm32-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/nlm/ppc-ext.h \
- libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
- $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h
-nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
- $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
-ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/oasys.h liboasys.h
-pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \
- aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
-pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \
- $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- coffcode.h peicode.h libpei.h
-pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \
- $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \
- libpei.h
-pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/coff/mipspe.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
- $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h
-reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/coff/internal.h libcoff.h
-riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h
-sparclynx.lo: sparclynx.c $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
- libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-sparcnetbsd.lo: sparcnetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \
- $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
-vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \
- libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h vms.h
-vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
-xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
- libxcoff.h
-xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
-xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
- $(INCDIR)/xtensa-isa-internal.h
-xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
- $(INCDIR)/xtensa-isa-internal.h
-aix5ppc-core.lo: aix5ppc-core.c
-aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
- libcoff.h libecoff.h coffswap.h ecoffswap.h
-coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
- $(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h \
- coffswap.h
-demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \
- $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
-efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \
- $(INCDIR)/elf/reloc-macros.h elf64-target.h
-elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
- $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
- libecoff.h ecoffswap.h elf64-target.h
-elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
- $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h libhppa.h \
- elf64-hppa.h elf-hppa.h elf64-target.h
-elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf64-target.h
-elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
- ecoffswap.h elf32-target.h
-elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
- $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \
- elf64-target.h
-elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/opcode/mmix.h elf64-target.h
-elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc64.h $(INCDIR)/elf/reloc-macros.h \
- elf64-ppc.h elf64-target.h
-elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
-elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
-elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
- $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
-elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
- $(INCDIR)/safe-ctype.h
-mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
-nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
- $(INCDIR)/nlm/alpha-ext.h libnlm.h $(INCDIR)/nlm/common.h \
- $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \
- nlm-target.h
-nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
- $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
-aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h
-hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h
-irix-core.lo: irix-core.c $(INCDIR)/filenames.h
-lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h
-osf-core.lo: osf-core.c $(INCDIR)/filenames.h
-sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h
-trad-core.lo: trad-core.c $(INCDIR)/filenames.h libaout.h \
- $(INCDIR)/bfdlink.h
-cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h
-elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \
- elf32-target.h
-elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \
- elf64-target.h
-peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h libpei.h
-pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h libpei.h
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/contrib/binutils/bfd/PORTING b/contrib/binutils/bfd/PORTING
deleted file mode 100644
index c8bfd77..0000000
--- a/contrib/binutils/bfd/PORTING
+++ /dev/null
@@ -1,83 +0,0 @@
- Preliminary Notes on Porting BFD
- --------------------------------
-
-The 'host' is the system a tool runs *on*.
-The 'target' is the system a tool runs *for*, i.e.
-a tool can read/write the binaries of the target.
-
-Porting to a new host
----------------------
-Pick a name for your host. Call that <host>.
-(<host> might be sun4, ...)
-Create a file hosts/<host>.mh.
-
-Porting to a new target
------------------------
-Pick a name for your target. Call that <target>.
-Call the name for your CPU architecture <cpu>.
-You need to create <target>.c and config/<target>.mt,
-and add a case for it to a case statements in bfd/configure.host and
-bfd/config.bfd, which associates each canonical host type with a BFD
-host type (used as the base of the makefile fragment names), and to the
-table in bfd/configure.in which associates each target vector with
-the .o files it uses.
-
-config/<target>.mt is a Makefile fragment.
-The following is usually enough:
-DEFAULT_VECTOR=<target>_vec
-SELECT_ARCHITECTURES=bfd_<cpu>_arch
-
-See the list of cpu types in archures.c, or "ls cpu-*.c".
-If your architecture is new, you need to add it to the tables
-in bfd/archures.c, opcodes/configure.in, and binutils/objdump.c.
-
-For more information about .mt and .mh files, see config/README.
-
-The file <target>.c is the hard part. It implements the
-bfd_target <target>_vec, which includes pointers to
-functions that do the actual <target>-specific methods.
-
-Porting to a <target> that uses the a.out binary format
--------------------------------------------------------
-
-In this case, the include file aout-target.h probaby does most
-of what you need. The program gen-aout generates <target>.c for
-you automatically for many a.out systems. Do:
- make gen-aout
- ./gen-aout <target> > <target>.c
-(This only works if you are building on the target ("native").
-If you must make a cross-port from scratch, copy the most
-similar existing file that includes aout-target.h, and fix what is wrong.)
-
-Check the parameters in <target>.c, and fix anything that is wrong.
-(Also let us know about it; perhaps we can improve gen-aout.c.)
-
-TARGET_IS_BIG_ENDIAN_P
- Should be defined if <target> is big-endian.
-
-N_HEADER_IN_TEXT(x)
- See discussion in ../include/aout/aout64.h.
-
-BYTES_IN_WORD
- Number of bytes per word. (Usually 4 but can be 8.)
-
-ARCH
- Number of bits per word. (Usually 32, but can be 64.)
-
-ENTRY_CAN_BE_ZERO
- Define if the extry point (start address of an
- executable program) can be 0x0.
-
-TEXT_START_ADDR
- The address of the start of the text segemnt in
- virtual memory. Normally, the same as the entry point.
-
-TARGET_PAGE_SIZE
-
-SEGMENT_SIZE
- Usually, the same as the TARGET_PAGE_SIZE.
- Alignment needed for the data segment.
-
-TARGETNAME
- The name of the target, for run-time lookups.
- Usually "a.out-<target>"
diff --git a/contrib/binutils/bfd/README b/contrib/binutils/bfd/README
deleted file mode 100644
index fe6b6f3..0000000
--- a/contrib/binutils/bfd/README
+++ /dev/null
@@ -1,49 +0,0 @@
-BFD is an object file library. It permits applications to use the
-same routines to process object files regardless of their format.
-
-BFD is used by the GNU debugger, assembler, linker, and the binary
-utilities.
-
-The documentation on using BFD is scanty and may be occasionally
-incorrect. Pointers to documentation problems, or an entirely
-rewritten manual, would be appreciated.
-
-There is some BFD internals documentation in doc/bfdint.texi which may
-help programmers who want to modify BFD.
-
-BFD is normally built as part of another package. See the build
-instructions for that package, probably in a README file in the
-appropriate directory.
-
-BFD supports the following configure options:
-
- --target=TARGET
- The default target for which to build the library. TARGET is
- a configuration target triplet, such as sparc-sun-solaris.
- --enable-targets=TARGET,TARGET,TARGET...
- Additional targets the library should support. To include
- support for all known targets, use --enable-targets=all.
- --enable-64-bit-bfd
- Include support for 64 bit targets. This is automatically
- turned on if you explicitly request a 64 bit target, but not
- for --enable-targets=all. This requires a compiler with a 64
- bit integer type, such as gcc.
- --enable-shared
- Build BFD as a shared library.
- --with-mmap
- Use mmap when accessing files. This is faster on some hosts,
- but slower on others. It may not work on all hosts.
-
-Report bugs with BFD to bug-binutils@gnu.org.
-
-Patches are encouraged. When sending patches, always send the output
-of diff -u or diff -c from the original file to the new file. Do not
-send default diff output. Do not make the diff from the new file to
-the original file. Remember that any patch must not break other
-systems. Remember that BFD must support cross compilation from any
-host to any target, so patches which use ``#ifdef HOST'' are not
-acceptable. Please also read the ``Reporting Bugs'' section of the
-gcc manual.
-
-Bug reports without patches will be remembered, but they may never get
-fixed until somebody volunteers to fix them.
diff --git a/contrib/binutils/bfd/TODO b/contrib/binutils/bfd/TODO
deleted file mode 100644
index 7a12735..0000000
--- a/contrib/binutils/bfd/TODO
+++ /dev/null
@@ -1,25 +0,0 @@
-Things that still need to be done: -*- Text -*-
-
- o - A source of space lossage is that all the target-dependent code
- is in a single bfd_target structure. Hence all the code for
- *writing* object files is still pulled into all the applications
- that only care about *reading* (gdb, nm, objdump), while gas has
- to carry along all the unneeded baggage for reading objects. And
- so on. This would be a substantial change, and the payoff would
- not all that great (essentially none if bfd is used as a shared
- library).
-
- o - The storage needed by BFD data structures is also larger than strictly
- needed. This may be difficult to do much about.
-
- o - implement bfd_abort, which should close the bfd but not alter the
- filesystem.
-
- o - update the bfd doc; write a how-to-write-a-backend doc, take out
- the stupid quips and fill in all the blanks.
-
- o - upgrade the reloc handling as per Steve's suggestion.
-
-
-
-
diff --git a/contrib/binutils/bfd/acinclude.m4 b/contrib/binutils/bfd/acinclude.m4
deleted file mode 100644
index 63b4bf9..0000000
--- a/contrib/binutils/bfd/acinclude.m4
+++ /dev/null
@@ -1,151 +0,0 @@
-sinclude(../config/accross.m4)
-
-dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
-AC_DEFUN([BFD_BINARY_FOPEN],
-[AC_REQUIRE([AC_CANONICAL_SYSTEM])
-case "${host}" in
-changequote(,)dnl
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-changequote([,])dnl
- AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
-esac])dnl
-
-dnl Get a default for CC_FOR_BUILD to put into Makefile.
-AC_DEFUN([BFD_CC_FOR_BUILD],
-[# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test -z "$CC_FOR_BUILD"; then
- if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
- else
- CC_FOR_BUILD=gcc
- fi
-fi
-AC_SUBST(CC_FOR_BUILD)
-# Also set EXEEXT_FOR_BUILD.
-if test "x$cross_compiling" = "xno"; then
- EXEEXT_FOR_BUILD='$(EXEEXT)'
-else
- AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
- [rm -f conftest*
- echo 'int main () { return 0; }' > conftest.c
- bfd_cv_build_exeext=
- ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
- *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- rm -f conftest*
- test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
- EXEEXT_FOR_BUILD=""
- test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
-fi
-AC_SUBST(EXEEXT_FOR_BUILD)])dnl
-
-dnl See whether we need a declaration for a function.
-AC_DEFUN([BFD_NEED_DECLARATION],
-[AC_MSG_CHECKING([whether $1 must be declared])
-AC_CACHE_VAL(bfd_cv_decl_needed_$1,
-[AC_TRY_COMPILE([
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif],
-[char *(*pfn) = (char *(*)) $1],
-bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
-AC_MSG_RESULT($bfd_cv_decl_needed_$1)
-if test $bfd_cv_decl_needed_$1 = yes; then
- AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
- [Define if $1 is not declared in system header files.])
-fi
-])dnl
-
-dnl Check for existence of a type $1 in sys/procfs.h
-
-AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
-[AC_MSG_CHECKING([for $1 in sys/procfs.h])
- AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
- [AC_TRY_COMPILE([
-#define _SYSCALL32
-#include <sys/procfs.h>],
- [$1 avar],
- bfd_cv_have_sys_procfs_type_$1=yes,
- bfd_cv_have_sys_procfs_type_$1=no
- )])
- if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
- AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
- [Define if <sys/procfs.h> has $1.])
- fi
- AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
-])
-
-
-dnl Check for existence of member $2 in type $1 in sys/procfs.h
-
-AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER],
-[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
- AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
- [AC_TRY_COMPILE([
-#define _SYSCALL32
-#include <sys/procfs.h>],
- [$1 avar; void* aref = (void*) &avar.$2],
- bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
- bfd_cv_have_sys_procfs_type_member_$1_$2=no
- )])
- if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
- AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
- [Define if <sys/procfs.h> has $1.$2.])
- fi
- AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
-])
-
-sinclude(../libtool.m4)
-dnl The lines below arrange for aclocal not to bring libtool.m4
-dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
-dnl to add a definition of LIBTOOL to Makefile.in.
-ifelse(yes,no,[
-AC_DEFUN([AM_PROG_LIBTOOL],)
-AC_DEFUN([AM_DISABLE_SHARED],)
-AC_SUBST(LIBTOOL)
-])
-
-sinclude(../gettext.m4)
-ifelse(yes,no,[
-AC_DEFUN([CY_WITH_NLS],)
-AC_SUBST(INTLLIBS)
-])
-
-AC_DEFUN([AM_INSTALL_LIBBFD],
-[AC_MSG_CHECKING([whether to install libbfd])
- AC_ARG_ENABLE(install-libbfd,
-[ --enable-install-libbfd controls installation of libbfd and related headers],
- install_libbfd_p=$enableval,
- if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
- install_libbfd_p=yes
- else
- install_libbfd_p=no
- fi)
- AC_MSG_RESULT($install_libbfd_p)
- AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
- # libbfd.a is a host library containing target dependent code
- bfdlibdir='$(libdir)'
- bfdincludedir='$(includedir)'
- if test "${host}" != "${target}"; then
- bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
- bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
- fi
- AC_SUBST(bfdlibdir)
- AC_SUBST(bfdincludedir)
-]
-)
diff --git a/contrib/binutils/bfd/aclocal.m4 b/contrib/binutils/bfd/aclocal.m4
deleted file mode 100644
index 9d27670..0000000
--- a/contrib/binutils/bfd/aclocal.m4
+++ /dev/null
@@ -1,369 +0,0 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4-p6
-
-dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-dnl PARTICULAR PURPOSE.
-
-sinclude(../config/accross.m4)
-
-dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
-AC_DEFUN(BFD_BINARY_FOPEN,
-[AC_REQUIRE([AC_CANONICAL_SYSTEM])
-case "${host}" in
-changequote(,)dnl
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-changequote([,])dnl
- AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
-esac])dnl
-
-dnl Get a default for CC_FOR_BUILD to put into Makefile.
-AC_DEFUN(BFD_CC_FOR_BUILD,
-[# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test -z "$CC_FOR_BUILD"; then
- if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
- else
- CC_FOR_BUILD=gcc
- fi
-fi
-AC_SUBST(CC_FOR_BUILD)
-# Also set EXEEXT_FOR_BUILD.
-if test "x$cross_compiling" = "xno"; then
- EXEEXT_FOR_BUILD='$(EXEEXT)'
-else
- AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
- [rm -f conftest*
- echo 'int main () { return 0; }' > conftest.c
- bfd_cv_build_exeext=
- ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
- *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- rm -f conftest*
- test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
- EXEEXT_FOR_BUILD=""
- test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
-fi
-AC_SUBST(EXEEXT_FOR_BUILD)])dnl
-
-dnl See whether we need a declaration for a function.
-AC_DEFUN(BFD_NEED_DECLARATION,
-[AC_MSG_CHECKING([whether $1 must be declared])
-AC_CACHE_VAL(bfd_cv_decl_needed_$1,
-[AC_TRY_COMPILE([
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif],
-[char *(*pfn) = (char *(*)) $1],
-bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
-AC_MSG_RESULT($bfd_cv_decl_needed_$1)
-if test $bfd_cv_decl_needed_$1 = yes; then
- AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
- [Define if $1 is not declared in system header files.])
-fi
-])dnl
-
-dnl Check for existence of a type $1 in sys/procfs.h
-
-AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
-[AC_MSG_CHECKING([for $1 in sys/procfs.h])
- AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
- [AC_TRY_COMPILE([
-#define _SYSCALL32
-#include <sys/procfs.h>],
- [$1 avar],
- bfd_cv_have_sys_procfs_type_$1=yes,
- bfd_cv_have_sys_procfs_type_$1=no
- )])
- if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
- AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
- [Define if <sys/procfs.h> has $1.])
- fi
- AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
-])
-
-
-dnl Check for existence of member $2 in type $1 in sys/procfs.h
-
-AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
-[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
- AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
- [AC_TRY_COMPILE([
-#define _SYSCALL32
-#include <sys/procfs.h>],
- [$1 avar; void* aref = (void*) &avar.$2],
- bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
- bfd_cv_have_sys_procfs_type_member_$1_$2=no
- )])
- if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
- AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
- [Define if <sys/procfs.h> has $1.$2.])
- fi
- AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
-])
-
-sinclude(../libtool.m4)
-dnl The lines below arrange for aclocal not to bring libtool.m4
-dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
-dnl to add a definition of LIBTOOL to Makefile.in.
-ifelse(yes,no,[
-AC_DEFUN([AM_PROG_LIBTOOL],)
-AC_DEFUN([AM_DISABLE_SHARED],)
-AC_SUBST(LIBTOOL)
-])
-
-sinclude(../gettext.m4)
-ifelse(yes,no,[
-AC_DEFUN([CY_WITH_NLS],)
-AC_SUBST(INTLLIBS)
-])
-
-AC_DEFUN([AM_INSTALL_LIBBFD],
-[AC_MSG_CHECKING([whether to install libbfd])
- AC_ARG_ENABLE(install-libbfd,
-[ --enable-install-libbfd controls installation of libbfd and related headers],
- install_libbfd_p=$enableval,
- if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
- install_libbfd_p=yes
- else
- install_libbfd_p=no
- fi)
- AC_MSG_RESULT($install_libbfd_p)
- AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
- # libbfd.a is a host library containing target dependent code
- bfdlibdir='$(libdir)'
- bfdincludedir='$(includedir)'
- if test "${host}" != "${target}"; then
- bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
- bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
- fi
- AC_SUBST(bfdlibdir)
- AC_SUBST(bfdincludedir)
-]
-)
-
-# Define a conditional.
-
-AC_DEFUN([AM_CONDITIONAL],
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
-if $2; then
- $1_TRUE=
- $1_FALSE='#'
-else
- $1_TRUE='#'
- $1_FALSE=
-fi])
-
-# isc-posix.m4 serial 2 (gettext-0.11.2)
-dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
-
-# This test replaces the one in autoconf.
-# Currently this macro should have the same name as the autoconf macro
-# because gettext's gettext.m4 (distributed in the automake package)
-# still uses it. Otherwise, the use in gettext.m4 makes autoheader
-# give these diagnostics:
-# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
-# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
-
-undefine([AC_ISC_POSIX])
-
-AC_DEFUN([AC_ISC_POSIX],
- [
- dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
- AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
- ]
-)
-
-# Do all the work for Automake. This macro actually does too much --
-# some checks are only needed if your package does certain things.
-# But this isn't really a big deal.
-
-# serial 1
-
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-
-AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])
-PACKAGE=[$1]
-AC_SUBST(PACKAGE)
-VERSION=[$2]
-AC_SUBST(VERSION)
-dnl test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-fi
-ifelse([$3],,
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
-AC_REQUIRE([AM_SANITY_CHECK])
-AC_REQUIRE([AC_ARG_PROGRAM])
-dnl FIXME This is truly gross.
-missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
-AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
-AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
-AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
-AC_REQUIRE([AC_PROG_MAKE_SET])])
-
-# Copyright 2002 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-
-# AM_AUTOMAKE_VERSION(VERSION)
-# ----------------------------
-# Automake X.Y traces this macro to ensure aclocal.m4 has been
-# generated from the m4 files accompanying Automake X.Y.
-AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
-
-# AM_SET_CURRENT_AUTOMAKE_VERSION
-# -------------------------------
-# Call AM_AUTOMAKE_VERSION so it can be traced.
-# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
-AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([1.4-p6])])
-
-#
-# Check to make sure that the build environment is sane.
-#
-
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "[$]*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
- test "[$]2" = conftestfile
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-rm -f conftest*
-AC_MSG_RESULT(yes)])
-
-dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
-dnl The program must properly implement --version.
-AC_DEFUN([AM_MISSING_PROG],
-[AC_MSG_CHECKING(for working $2)
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if ($2 --version) < /dev/null > /dev/null 2>&1; then
- $1=$2
- AC_MSG_RESULT(found)
-else
- $1="$3/missing $2"
- AC_MSG_RESULT(missing)
-fi
-AC_SUBST($1)])
-
-# Like AC_CONFIG_HEADER, but automatically create stamp file.
-
-AC_DEFUN([AM_CONFIG_HEADER],
-[AC_PREREQ([2.12])
-AC_CONFIG_HEADER([$1])
-dnl When config.status generates a header, we must update the stamp-h file.
-dnl This file resides in the same directory as the config header
-dnl that is generated. We must strip everything past the first ":",
-dnl and everything past the last "/".
-AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
-ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
-<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
-<<am_indx=1
-for am_file in <<$1>>; do
- case " <<$>>CONFIG_HEADERS " in
- *" <<$>>am_file "*<<)>>
- echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
- ;;
- esac
- am_indx=`expr "<<$>>am_indx" + 1`
-done<<>>dnl>>)
-changequote([,]))])
-
-# Add --enable-maintainer-mode option to configure.
-# From Jim Meyering
-
-# serial 1
-
-AC_DEFUN([AM_MAINTAINER_MODE],
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
- dnl maintainer-mode is disabled by default
- AC_ARG_ENABLE(maintainer-mode,
-[ --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- USE_MAINTAINER_MODE=$enableval,
- USE_MAINTAINER_MODE=no)
- AC_MSG_RESULT($USE_MAINTAINER_MODE)
- AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
- MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST(MAINT)dnl
-]
-)
-
diff --git a/contrib/binutils/bfd/aout-arm.c b/contrib/binutils/bfd/aout-arm.c
deleted file mode 100644
index 38ecfab..0000000
--- a/contrib/binutils/bfd/aout-arm.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* BFD back-end for raw ARM a.out binaries.
- Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-/* Avoid multiple definitions from aoutx if supporting standard a.out
- as well as our own. */
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define NAME(x,y) CONCAT3 (aoutarm,_32_,y)
-
-#define N_TXTADDR(x) \
- ((N_MAGIC (x) == NMAGIC) \
- ? (bfd_vma) 0x8000 \
- : ((N_MAGIC (x) != ZMAGIC) \
- ? (bfd_vma) 0 \
- : ((N_SHARED_LIB (x)) \
- ? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \
- : (bfd_vma) TEXT_START_ADDR)))
-
-#define TEXT_START_ADDR 0x8000
-#define TARGET_PAGE_SIZE 0x8000
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define DEFAULT_ARCH bfd_arch_arm
-
-#define MY(OP) CONCAT2 (aoutarm_,OP)
-#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \
- (((x).a_info & ~006000) != OMAGIC) && \
- ((x).a_info != NMAGIC))
-#define N_MAGIC(x) ((x).a_info & ~07200)
-
-#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
-
-#include "libaout.h"
-#include "aout/aout64.h"
-
-static bfd_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)[] =
- {
- /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl
- readmask setmask pcdone. */
- HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE,
- 0x000000ff, 0x000000ff, FALSE),
- HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE,
- 0x0000ffff, 0x0000ffff, FALSE),
- HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE,
- 0xffffffff, 0xffffffff, FALSE),
- HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY(fix_pcrel_26),
- "ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE),
- HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE,
- 0x000000ff, 0x000000ff, TRUE),
- HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE,
- 0x0000ffff, 0x0000ffff, TRUE),
- HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE,
- 0xffffffff, 0xffffffff, TRUE),
- HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed,
- MY(fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0,
- FALSE),
- EMPTY_HOWTO (-1),
- HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE,
- 0x0000ffff, 0x0000ffff, FALSE),
- HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE,
- 0xffffffff, 0xffffffff, FALSE)
- };
-
-#define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08)
-#define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10)
-
-reloc_howto_type *
-MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
- bfd *abfd;
- struct reloc_std_external *rel;
- int *r_index;
- int *r_extern;
- int *r_pcrel;
-{
- unsigned int r_length;
- unsigned int r_pcrel_done;
- unsigned int r_neg;
- int index;
-
- *r_pcrel = 0;
- if (bfd_header_big_endian (abfd))
- {
- *r_index = ((rel->r_index[0] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[2]);
- *r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
- r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
- r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_BIG));
- r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
- >> RELOC_STD_BITS_LENGTH_SH_BIG);
- }
- else
- {
- *r_index = ((rel->r_index[2] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[0]);
- *r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
- r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
- r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_LITTLE));
- r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
- >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
- }
- index = r_length + 4 * r_pcrel_done + 8 * r_neg;
- if (index == 3)
- *r_pcrel = 1;
-
- return MY(howto_table) + index;
-}
-
-#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;
- bfd_vma value;
- reloc_howto_type *howto;
- struct reloc_std_external *reloc;
-{
- unsigned int r_length;
- int r_pcrel;
- int r_neg;
-
- PUT_WORD (abfd, value, reloc->r_address);
- /* Size as a power of two. */
- r_length = howto->size;
-
- /* Special case for branch relocations. */
- if (howto->type == 3 || howto->type == 7)
- r_length = 3;
-
- r_pcrel = howto->type & 4; /* PC Relative done? */
- r_neg = howto->type & 8; /* Negative relocation. */
-
- if (bfd_header_big_endian (abfd))
- {
- reloc->r_index[0] = r_index >> 16;
- reloc->r_index[1] = r_index >> 8;
- reloc->r_index[2] = r_index;
- reloc->r_type[0] =
- ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0)
- | (r_neg ? RELOC_ARM_BITS_NEG_BIG : 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
- }
- else
- {
- reloc->r_index[2] = r_index >> 16;
- reloc->r_index[1] = r_index >> 8;
- reloc->r_index[0] = r_index;
- reloc->r_type[0] =
- ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0)
- | (r_neg ? RELOC_ARM_BITS_NEG_LITTLE : 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
- }
-}
-
-#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
- MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
-
-void
-MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
- reloc_howto_type *howto;
- bfd *abfd;
- struct reloc_std_external *reloc;
- bfd_vma *amount;
- bfd_vma r_addr;
-{
- if (howto->type == 3)
- {
- if (reloc->r_type[0]
- & (bfd_header_big_endian (abfd)
- ? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE))
- {
- /* The reloc is still external, so don't modify anything. */
- *amount = 0;
- }
- else
- {
- *amount -= r_addr;
- /* Change the r_pcrel value -- on the ARM, this bit is set once the
- relocation is done. */
- if (bfd_header_big_endian (abfd))
- reloc->r_type[0] |= RELOC_STD_BITS_PCREL_BIG;
- else
- reloc->r_type[0] |= RELOC_STD_BITS_PCREL_LITTLE;
- }
- }
- else if (howto->type == 7)
- *amount = 0;
-}
-
-#define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \
- MY(relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR)
-
-static bfd_reloc_status_type
-MY(fix_pcrel_26_done) (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
-{
- /* This is dead simple at present. */
- return bfd_reloc_ok;
-}
-
-static bfd_reloc_status_type
-MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_size_type addr = reloc_entry->address;
- 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. */
- if (symbol->section == &bfd_und_section
- && (symbol->flags & BSF_WEAK) == 0)
- return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
-
- /* If the sections are different, and we are doing a partial relocation,
- just ignore it for now. */
- if (symbol->section->name != input_section->name
- && output_bfd != (bfd *)NULL)
- return bfd_reloc_ok;
-
- relocation = (target & 0x00ffffff) << 2;
- relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend. */
- relocation += symbol->value;
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
- relocation -= input_section->output_section->vma;
- relocation -= input_section->output_offset;
- relocation -= addr;
- if (relocation & 3)
- return bfd_reloc_overflow;
-
- /* Check for overflow. */
- if (relocation & 0x02000000)
- {
- if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
- flag = bfd_reloc_overflow;
- }
- else if (relocation & ~ (bfd_vma) 0x03ffffff)
- flag = bfd_reloc_overflow;
-
- target &= ~ (bfd_vma) 0x00ffffff;
- target |= (relocation >> 2) & 0x00ffffff;
- bfd_put_32 (abfd, 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. */
- reloc_entry->howto = &MY(howto_table)[7];
-
- return flag;
-}
-
-reloc_howto_type *
-MY(bfd_reloc_type_lookup) (abfd,code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
-{
-#define ASTD(i,j) case i: return &MY(howto_table)[j]
- if (code == BFD_RELOC_CTOR)
- switch (bfd_get_arch_info (abfd)->bits_per_address)
- {
- case 32:
- code = BFD_RELOC_32;
- break;
- default:
- return (const struct reloc_howto_struct *) 0;
- }
-
- switch (code)
- {
- ASTD (BFD_RELOC_16, 1);
- ASTD (BFD_RELOC_32, 2);
- ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3);
- ASTD (BFD_RELOC_8_PCREL, 4);
- ASTD (BFD_RELOC_16_PCREL, 5);
- ASTD (BFD_RELOC_32_PCREL, 6);
- default:
- return (const struct reloc_howto_struct *) 0;
- }
-}
-
-#define MY_swap_std_reloc_in MY(swap_std_reloc_in)
-#define MY_swap_std_reloc_out MY(swap_std_reloc_out)
-#define MY_get_section_contents _bfd_generic_get_section_contents
-/* #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create */
-/* #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols */
-/* #define MY_bfd_final_link _bfd_generic_final_link */
-
-#include "aoutx.h"
-
-static void
-MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
- bfd *abfd;
- struct reloc_std_external *bytes;
- arelent *cache_ptr;
- asymbol **symbols;
- bfd_size_type symcount ATTRIBUTE_UNUSED;
-{
- int r_index;
- int r_extern;
- int r_pcrel;
- struct aoutdata *su = &(abfd->tdata.aout_data->a);
-
- cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
-
- cache_ptr->howto = MY_reloc_howto (abfd, bytes, r_index, r_extern, r_pcrel);
-
- MOVE_ADDRESS (0);
-}
-
-void
-MY_swap_std_reloc_out (abfd, g, natptr)
- bfd *abfd;
- arelent *g;
- struct reloc_std_external *natptr;
-{
- int r_index;
- asymbol *sym = *(g->sym_ptr_ptr);
- int r_extern;
- int r_length;
- int r_pcrel;
- int r_neg = 0; /* Negative relocs use the BASEREL bit. */
- asection *output_section = sym->section->output_section;
-
- PUT_WORD(abfd, g->address, natptr->r_address);
-
- r_length = g->howto->size ; /* Size as a power of two */
- if (r_length < 0)
- {
- r_length = -r_length;
- r_neg = 1;
- }
-
- r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
-
- /* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
- relocation has been done already (Only for the 26-bit one I think)???!!!
- */
-
- if (g->howto->type == 3)
- {
- r_length = 3;
- r_pcrel = 0;
- }
- else if (g->howto->type == 7)
- {
- r_length = 3;
- r_pcrel = 1;
- }
-
-#if 0
- /* For a standard reloc, the addend is in the object file. */
- r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
-#endif
-
- /* name was clobbered by aout_write_syms to be symbol index */
-
- /* If this relocation is relative to a symbol then set the
- r_index to the symbols index, and the r_extern bit.
-
- Absolute symbols can come in in two ways, either as an offset
- from the abs section, or as a symbol which has an abs value.
- check for that here
- */
-
- if (bfd_is_com_section (output_section)
- || output_section == &bfd_abs_section
- || output_section == &bfd_und_section)
- {
- if (bfd_abs_section.symbol == sym)
- {
- /* Whoops, looked like an abs symbol, but is really an offset
- from the abs section. */
- r_index = 0;
- r_extern = 0;
- }
- else
- {
- /* Fill in symbol. */
- r_extern = 1;
- r_index = (*(g->sym_ptr_ptr))->KEEPIT;
- }
- }
- else
- {
- /* Just an ordinary section. */
- r_extern = 0;
- r_index = output_section->target_index;
- }
-
- /* Now the fun stuff. */
- if (bfd_header_big_endian (abfd))
- {
- natptr->r_index[0] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[2] = r_index;
- natptr->r_type[0] =
- ( (r_extern ? RELOC_STD_BITS_EXTERN_BIG: 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG: 0)
- | (r_neg ? RELOC_ARM_BITS_NEG_BIG: 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
- }
- else
- {
- natptr->r_index[2] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[0] = r_index;
- natptr->r_type[0] =
- ( (r_extern ? RELOC_STD_BITS_EXTERN_LITTLE: 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE: 0)
- | (r_neg ? RELOC_ARM_BITS_NEG_LITTLE: 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
- }
-}
-
-#define MY_BFD_TARGET
-
-#include "aout-target.h"
-
-extern const bfd_target aout_arm_big_vec;
-
-const bfd_target aout_arm_little_vec =
- {
- "a.out-arm-little", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order (little) */
- BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (MY),
-
- & aout_arm_big_vec,
-
- (PTR) MY_backend_data,
- };
-
-const bfd_target aout_arm_big_vec =
- {
- "a.out-arm-big", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_BIG, /* target byte order (big) */
- BFD_ENDIAN_BIG, /* target headers byte order (big) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (MY),
-
- & aout_arm_little_vec,
-
- (PTR) MY_backend_data,
- };
diff --git a/contrib/binutils/bfd/aout-encap.c b/contrib/binutils/bfd/aout-encap.c
deleted file mode 100644
index 96c7082..0000000
--- a/contrib/binutils/bfd/aout-encap.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* BFD back-end for a.out files encapsulated with COFF headers.
- Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* THIS MODULE IS NOT FINISHED. IT PROBABLY DOESN'T EVEN COMPILE. */
-
-#if 0
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define TEXT_START_ADDR 0
-#endif
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-const bfd_target *encap_real_callback ();
-
-const bfd_target *
-encap_object_p (abfd)
- bfd *abfd;
-{
- unsigned char magicbuf[4]; /* Raw bytes of magic number from file */
- unsigned long magic; /* Swapped magic number */
- short coff_magic;
- struct external_exec exec_bytes;
- struct internal_exec exec;
- bfd_size_type amt = 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 = H_GET_16 (abfd, magicbuf);
- if (coff_magic != COFF_MAGIC)
- return 0; /* Not an encap coff file */
-
- magic = H_GET_32 (abfd, magicbuf);
-
- 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);
-}
-
-/* Finish up the reading of an encapsulated-coff a.out file header. */
-const bfd_target *
-encap_real_callback (abfd)
- bfd *abfd;
-{
- struct internal_exec *execp = exec_hdr (abfd);
-
- MY(callback) (abfd, execp);
-
- /* If we have a coff header, it can give us better values for
- 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));
- }
-
- /* Determine the architecture and machine type of the object file. */
- bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); /* FIXME */
-
- return abfd->xvec;
-}
-
-/* Write an object file in Encapsulated COFF format.
- Section contents have already been written. We write the
- file header, symbols, and relocation. */
-
-bfd_boolean
-encap_write_object_contents (abfd)
- bfd *abfd;
-{
- bfd_size_type data_pad = 0;
- 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;
-
- /* Determine whether to count the header as part of
- the text size, and initialize the text size accordingly.
- This depends on the kind of system and on the output format selected. */
-
- N_SET_MAGIC (outheader, magic);
-#ifdef INITIALIZE_HEADER
- INITIALIZE_HEADER;
-#endif
-
- text_size = sizeof (struct exec);
-#ifdef COFF_ENCAPSULATE
- if (relocatable_output == 0 && file_table[0].just_syms_flag == 0)
- {
- need_coff_header = 1;
- /* set this flag now, since it will change the values of N_TXTOFF, etc */
- N_SET_FLAGS (outheader, aout_backend_info (abfd)->exec_hdr_flags);
- text_size += sizeof (struct coffheader);
- }
-#endif
-
-#ifdef COFF_ENCAPSULATE
- if (need_coff_header)
- {
- /* We are encapsulating BSD format within COFF format. */
- struct coffscn *tp, *dp, *bp;
-
- tp = &coffheader.scns[0];
- dp = &coffheader.scns[1];
- bp = &coffheader.scns[2];
-
- strcpy (tp->s_name, ".text");
- tp->s_paddr = text_start;
- tp->s_vaddr = text_start;
- tp->s_size = text_size;
- tp->s_scnptr = sizeof (struct coffheader) + sizeof (struct exec);
- tp->s_relptr = 0;
- tp->s_lnnoptr = 0;
- tp->s_nreloc = 0;
- tp->s_nlnno = 0;
- tp->s_flags = 0x20;
- strcpy (dp->s_name, ".data");
- dp->s_paddr = data_start;
- dp->s_vaddr = data_start;
- dp->s_size = data_size;
- dp->s_scnptr = tp->s_scnptr + tp->s_size;
- dp->s_relptr = 0;
- dp->s_lnnoptr = 0;
- dp->s_nreloc = 0;
- dp->s_nlnno = 0;
- dp->s_flags = 0x40;
- strcpy (bp->s_name, ".bss");
- bp->s_paddr = dp->s_vaddr + dp->s_size;
- bp->s_vaddr = bp->s_paddr;
- bp->s_size = bss_size;
- bp->s_scnptr = 0;
- bp->s_relptr = 0;
- bp->s_lnnoptr = 0;
- bp->s_nreloc = 0;
- bp->s_nlnno = 0;
- bp->s_flags = 0x80;
-
- coffheader.f_magic = COFF_MAGIC;
- coffheader.f_nscns = 3;
- /* store an unlikely time so programs can
- * tell that there is a bsd header
- */
- coffheader.f_timdat = 1;
- coffheader.f_symptr = 0;
- coffheader.f_nsyms = 0;
- coffheader.f_opthdr = 28;
- coffheader.f_flags = 0x103;
- /* aouthdr */
- coffheader.magic = ZMAGIC;
- coffheader.vstamp = 0;
- coffheader.tsize = tp->s_size;
- coffheader.dsize = dp->s_size;
- coffheader.bsize = bp->s_size;
- coffheader.entry = outheader.a_entry;
- coffheader.text_start = tp->s_vaddr;
- coffheader.data_start = dp->s_vaddr;
- }
-#endif
-
-#ifdef COFF_ENCAPSULATE
- if (need_coff_header)
- mywrite (&coffheader, sizeof coffheader, 1, outdesc);
-#endif
-
-#ifndef COFF_ENCAPSULATE
- padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc);
-#endif
-
- text_size -= N_TXTOFF (outheader);
- WRITE_HEADERS(abfd, execp);
- return TRUE;
-}
-
-#define MY_write_object_content encap_write_object_contents
-#define MY_object_p encap_object_p
-#define MY_exec_hdr_flags N_FLAGS_COFF_ENCAPSULATE
-
-#include "aout-target.h"
diff --git a/contrib/binutils/bfd/aout-sparcle.c b/contrib/binutils/bfd/aout-sparcle.c
deleted file mode 100644
index 7772c29..0000000
--- a/contrib/binutils/bfd/aout-sparcle.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* BFD backend for sparc little-endian aout binaries.
- Copyright 1996, 2001 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGETNAME "a.out-sparc-little"
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparcle_aout_,OP)
-
-#include "bfd.h"
-#include "bfdlink.h"
-#include "libaout.h"
-
-#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_SPARCLET)
-
-/* Include the usual a.out support. */
-#define TARGET_IS_LITTLE_ENDIAN_P
-#include "aoutf1.h"
diff --git a/contrib/binutils/bfd/aout-target.h b/contrib/binutils/bfd/aout-target.h
deleted file mode 100644
index d8cad54..0000000
--- a/contrib/binutils/bfd/aout-target.h
+++ /dev/null
@@ -1,662 +0,0 @@
-/* Define a target vector and some small routines for a variant of a.out.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-/*#include "libaout.h"*/
-
-#ifndef SEGMENT_SIZE
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#endif
-
-extern reloc_howto_type * NAME(aout,reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-/* Set parameters about this a.out file that are machine-dependent.
- This routine is called from some_aout_object_p just before it returns. */
-#ifndef MY_callback
-
-static const bfd_target *MY(callback) PARAMS ((bfd *));
-
-static const bfd_target *
-MY(callback) (abfd)
- bfd *abfd;
-{
- struct internal_exec *execp = exec_hdr (abfd);
- unsigned int arch_align_power;
- unsigned long arch_align;
-
- /* Calculate the file positions of the parts of a newly read aout header */
- obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp);
-
- /* The virtual memory addresses of the sections */
- obj_textsec (abfd)->vma = N_TXTADDR(*execp);
- obj_datasec (abfd)->vma = N_DATADDR(*execp);
- obj_bsssec (abfd)->vma = N_BSSADDR(*execp);
-
- /* For some targets, if the entry point is not in the same page
- as the start of the text, then adjust the VMA so that it is.
- FIXME: Do this with a macro like SET_ARCH_MACH instead? */
- if (aout_backend_info (abfd)->entry_is_text_address
- && execp->a_entry > obj_textsec (abfd)->vma)
- {
- bfd_vma adjust;
-
- adjust = execp->a_entry - obj_textsec (abfd)->vma;
- /* Adjust only by whole pages. */
- adjust &= ~(TARGET_PAGE_SIZE - 1);
- obj_textsec (abfd)->vma += adjust;
- obj_datasec (abfd)->vma += adjust;
- obj_bsssec (abfd)->vma += adjust;
- }
-
- /* Set the load addresses to be the same as the virtual addresses. */
- obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
- obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
- obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
-
- /* The file offsets of the sections */
- obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
- obj_datasec (abfd)->filepos = N_DATOFF (*execp);
-
- /* The file offsets of the relocation info */
- obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp);
- obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp);
-
- /* The file offsets of the string table and symbol table. */
- obj_sym_filepos (abfd) = N_SYMOFF (*execp);
- obj_str_filepos (abfd) = N_STROFF (*execp);
-
- /* Determine the architecture and machine type of the object file. */
-#ifdef SET_ARCH_MACH
- SET_ARCH_MACH (abfd, *execp);
-#else
- bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
-#endif
-
- /* The number of relocation records. This must be called after
- SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set
- obj_reloc_entry_size correctly, if the reloc size is not
- RELOC_STD_SIZE. */
- obj_textsec (abfd)->reloc_count =
- execp->a_trsize / obj_reloc_entry_size (abfd);
- obj_datasec (abfd)->reloc_count =
- execp->a_drsize / obj_reloc_entry_size (abfd);
-
- /* Now that we know the architecture, set the alignments of the
- sections. This is normally done by NAME(aout,new_section_hook),
- but when the initial sections were created the architecture had
- not yet been set. However, for backward compatibility, we don't
- set the alignment power any higher than as required by the size
- of the section. */
- arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
- arch_align = 1 << arch_align_power;
- if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align)
- == obj_textsec (abfd)->_raw_size)
- && (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align)
- == obj_datasec (abfd)->_raw_size)
- && (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align)
- == obj_bsssec (abfd)->_raw_size))
- {
- obj_textsec (abfd)->alignment_power = arch_align_power;
- obj_datasec (abfd)->alignment_power = arch_align_power;
- obj_bsssec (abfd)->alignment_power = arch_align_power;
- }
-
- /* Don't set sizes now -- can't be sure until we know arch & mach.
- Sizes get set in set_sizes callback, later. */
-#if 0
- adata(abfd).page_size = TARGET_PAGE_SIZE;
- adata(abfd).segment_size = SEGMENT_SIZE;
- adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
-#endif
-
- return abfd->xvec;
-}
-#endif
-
-#ifndef MY_object_p
-/* Finish up the reading of an a.out file header */
-
-static const bfd_target *MY(object_p) PARAMS ((bfd *));
-
-static const bfd_target *
-MY(object_p) (abfd)
- bfd *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_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);
-#else
- exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
-#endif /* SWAP_MAGIC */
-
- if (N_BADMAG (exec)) return 0;
-#ifdef MACHTYPE_OK
- if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
-#endif
-
- NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
-
-#ifdef SWAP_MAGIC
- /* swap_exec_header_in read in a_info with the wrong byte order */
- exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
-#endif /* SWAP_MAGIC */
-
- target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
-
-#ifdef ENTRY_CAN_BE_ZERO
- /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
- * means that it isn't obvious if EXEC_P should be set.
- * All of the following must be true for an executable:
- * There must be no relocations, the bfd can be neither an
- * archive nor an archive element, and the file must be executable. */
-
- if (exec.a_trsize + exec.a_drsize == 0
- && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
- {
- struct stat buf;
-#ifndef S_IXUSR
-#define S_IXUSR 0100 /* Execute by owner. */
-#endif
- if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
- abfd->flags |= EXEC_P;
- }
-#endif /* ENTRY_CAN_BE_ZERO */
-
- return target;
-}
-#define MY_object_p MY(object_p)
-#endif
-
-#ifndef MY_mkobject
-
-static bfd_boolean MY(mkobject) PARAMS ((bfd *));
-
-static bfd_boolean
-MY(mkobject) (abfd)
- bfd *abfd;
-{
- if (! NAME(aout,mkobject) (abfd))
- return FALSE;
-#if 0 /* Sizes get set in set_sizes callback, later, after we know
- the architecture and machine. */
- adata(abfd).page_size = TARGET_PAGE_SIZE;
- adata(abfd).segment_size = SEGMENT_SIZE;
- adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
-#endif
- return TRUE;
-}
-#define MY_mkobject MY(mkobject)
-#endif
-
-#ifndef MY_bfd_copy_private_section_data
-
-/* Copy private section data. This actually does nothing with the
- sections. It copies the subformat field. We copy it here, because
- we need to know whether this is a QMAGIC file before we set the
- section contents, and copy_private_bfd_data is not called until
- after the section contents have been set. */
-
-static bfd_boolean MY_bfd_copy_private_section_data
- PARAMS ((bfd *, asection *, bfd *, asection *));
-
-static bfd_boolean
-MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
- bfd *ibfd;
- asection *isec ATTRIBUTE_UNUSED;
- bfd *obfd;
- asection *osec ATTRIBUTE_UNUSED;
-{
- if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
- && bfd_get_flavour (obfd) == bfd_target_aout_flavour)
- obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
- return TRUE;
-}
-
-#endif
-
-/* Write an object file.
- Section contents have already been written. We write the
- file header, symbols, and relocation. */
-
-#ifndef MY_write_object_contents
-static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
-
-static bfd_boolean
-MY(write_object_contents) (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- WRITE_HEADERS(abfd, execp);
-
- return TRUE;
-}
-#define MY_write_object_contents MY(write_object_contents)
-#endif
-
-#ifndef MY_set_sizes
-
-static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
-
-static bfd_boolean
-MY(set_sizes) (abfd)
- bfd *abfd;
-{
- adata(abfd).page_size = TARGET_PAGE_SIZE;
- adata(abfd).segment_size = SEGMENT_SIZE;
-
-#ifdef ZMAGIC_DISK_BLOCK_SIZE
- adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
-#else
- adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
-#endif
-
- adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return TRUE;
-}
-#define MY_set_sizes MY(set_sizes)
-#endif
-
-#ifndef MY_exec_hdr_flags
-#define MY_exec_hdr_flags 0
-#endif
-
-#ifndef MY_backend_data
-
-#ifndef MY_zmagic_contiguous
-#define MY_zmagic_contiguous 0
-#endif
-#ifndef MY_text_includes_header
-#define MY_text_includes_header 0
-#endif
-#ifndef MY_entry_is_text_address
-#define MY_entry_is_text_address 0
-#endif
-#ifndef MY_exec_header_not_counted
-#define MY_exec_header_not_counted 0
-#endif
-#ifndef MY_add_dynamic_symbols
-#define MY_add_dynamic_symbols 0
-#endif
-#ifndef MY_add_one_symbol
-#define MY_add_one_symbol 0
-#endif
-#ifndef MY_link_dynamic_object
-#define MY_link_dynamic_object 0
-#endif
-#ifndef MY_write_dynamic_symbol
-#define MY_write_dynamic_symbol 0
-#endif
-#ifndef MY_check_dynamic_reloc
-#define MY_check_dynamic_reloc 0
-#endif
-#ifndef MY_finish_dynamic_link
-#define MY_finish_dynamic_link 0
-#endif
-
-static const struct aout_backend_data MY(backend_data) = {
- MY_zmagic_contiguous,
- MY_text_includes_header,
- MY_entry_is_text_address,
- MY_exec_hdr_flags,
- 0, /* text vma? */
- MY_set_sizes,
- MY_exec_header_not_counted,
- MY_add_dynamic_symbols,
- MY_add_one_symbol,
- MY_link_dynamic_object,
- MY_write_dynamic_symbol,
- MY_check_dynamic_reloc,
- MY_finish_dynamic_link
-};
-#define MY_backend_data &MY(backend_data)
-#endif
-
-#ifndef MY_final_link_callback
-
-/* Callback for the final_link routine to set the section offsets. */
-
-static void MY_final_link_callback
- PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
-
-static void
-MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
- bfd *abfd;
- file_ptr *ptreloff;
- file_ptr *pdreloff;
- file_ptr *psymoff;
-{
- struct internal_exec *execp = exec_hdr (abfd);
-
- *ptreloff = N_TRELOFF (*execp);
- *pdreloff = N_DRELOFF (*execp);
- *psymoff = N_SYMOFF (*execp);
-}
-
-#endif
-
-#ifndef MY_bfd_final_link
-
-/* Final link routine. We need to use a call back to get the correct
- offsets in the output file. */
-
-static bfd_boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
-
-static bfd_boolean
-MY_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
-}
-
-#endif
-
-/* We assume BFD generic archive files. */
-#ifndef MY_openr_next_archived_file
-#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file
-#endif
-#ifndef MY_get_elt_at_index
-#define MY_get_elt_at_index _bfd_generic_get_elt_at_index
-#endif
-#ifndef MY_generic_stat_arch_elt
-#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt
-#endif
-#ifndef MY_slurp_armap
-#define MY_slurp_armap bfd_slurp_bsd_armap
-#endif
-#ifndef MY_slurp_extended_name_table
-#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table
-#endif
-#ifndef MY_construct_extended_name_table
-#define MY_construct_extended_name_table \
- _bfd_archive_bsd_construct_extended_name_table
-#endif
-#ifndef MY_write_armap
-#define MY_write_armap bsd_write_armap
-#endif
-#ifndef MY_read_ar_hdr
-#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
-#endif
-#ifndef MY_truncate_arname
-#define MY_truncate_arname bfd_bsd_truncate_arname
-#endif
-#ifndef MY_update_armap_timestamp
-#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
-#endif
-
-/* No core file defined here -- configure in trad-core.c separately. */
-#ifndef MY_core_file_failing_command
-#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
-#endif
-#ifndef MY_core_file_failing_signal
-#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal
-#endif
-#ifndef MY_core_file_matches_executable_p
-#define MY_core_file_matches_executable_p \
- _bfd_nocore_core_file_matches_executable_p
-#endif
-#ifndef MY_core_file_p
-#define MY_core_file_p _bfd_dummy_target
-#endif
-
-#ifndef MY_bfd_debug_info_start
-#define MY_bfd_debug_info_start bfd_void
-#endif
-#ifndef MY_bfd_debug_info_end
-#define MY_bfd_debug_info_end bfd_void
-#endif
-#ifndef MY_bfd_debug_info_accumulate
-#define MY_bfd_debug_info_accumulate \
- (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
-#endif
-
-#ifndef MY_core_file_failing_command
-#define MY_core_file_failing_command NAME(aout,core_file_failing_command)
-#endif
-#ifndef MY_core_file_failing_signal
-#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
-#endif
-#ifndef MY_core_file_matches_executable_p
-#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
-#endif
-#ifndef MY_set_section_contents
-#define MY_set_section_contents NAME(aout,set_section_contents)
-#endif
-#ifndef MY_get_section_contents
-#define MY_get_section_contents NAME(aout,get_section_contents)
-#endif
-#ifndef MY_get_section_contents_in_window
-#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
-#endif
-#ifndef MY_new_section_hook
-#define MY_new_section_hook NAME(aout,new_section_hook)
-#endif
-#ifndef MY_get_symtab_upper_bound
-#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
-#endif
-#ifndef MY_canonicalize_symtab
-#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab)
-#endif
-#ifndef MY_get_reloc_upper_bound
-#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
-#endif
-#ifndef MY_canonicalize_reloc
-#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
-#endif
-#ifndef MY_make_empty_symbol
-#define MY_make_empty_symbol NAME(aout,make_empty_symbol)
-#endif
-#ifndef MY_print_symbol
-#define MY_print_symbol NAME(aout,print_symbol)
-#endif
-#ifndef MY_get_symbol_info
-#define MY_get_symbol_info NAME(aout,get_symbol_info)
-#endif
-#ifndef MY_get_lineno
-#define MY_get_lineno NAME(aout,get_lineno)
-#endif
-#ifndef MY_set_arch_mach
-#define MY_set_arch_mach NAME(aout,set_arch_mach)
-#endif
-#ifndef MY_find_nearest_line
-#define MY_find_nearest_line NAME(aout,find_nearest_line)
-#endif
-#ifndef MY_sizeof_headers
-#define MY_sizeof_headers NAME(aout,sizeof_headers)
-#endif
-#ifndef MY_bfd_get_relocated_section_contents
-#define MY_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#endif
-#ifndef MY_bfd_relax_section
-#define MY_bfd_relax_section bfd_generic_relax_section
-#endif
-#ifndef MY_bfd_gc_sections
-#define MY_bfd_gc_sections bfd_generic_gc_sections
-#endif
-#ifndef MY_bfd_merge_sections
-#define MY_bfd_merge_sections bfd_generic_merge_sections
-#endif
-#ifndef MY_bfd_discard_group
-#define MY_bfd_discard_group bfd_generic_discard_group
-#endif
-#ifndef MY_bfd_reloc_type_lookup
-#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
-#endif
-#ifndef MY_bfd_make_debug_symbol
-#define MY_bfd_make_debug_symbol 0
-#endif
-#ifndef MY_read_minisymbols
-#define MY_read_minisymbols NAME(aout,read_minisymbols)
-#endif
-#ifndef MY_minisymbol_to_symbol
-#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)
-#endif
-#ifndef MY_bfd_link_hash_table_create
-#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
-#endif
-#ifndef MY_bfd_link_hash_table_free
-#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#endif
-#ifndef MY_bfd_link_add_symbols
-#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
-#endif
-#ifndef MY_bfd_link_just_syms
-#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
-#endif
-#ifndef MY_bfd_link_split_section
-#define MY_bfd_link_split_section _bfd_generic_link_split_section
-#endif
-
-#ifndef MY_bfd_copy_private_bfd_data
-#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
-#endif
-
-#ifndef MY_bfd_merge_private_bfd_data
-#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
-#endif
-
-#ifndef MY_bfd_copy_private_symbol_data
-#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
-#endif
-
-#ifndef MY_bfd_print_private_bfd_data
-#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
-#endif
-
-#ifndef MY_bfd_set_private_flags
-#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
-#endif
-
-#ifndef MY_bfd_is_local_label_name
-#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
-#endif
-
-#ifndef MY_bfd_free_cached_info
-#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
-#endif
-
-#ifndef MY_close_and_cleanup
-#define MY_close_and_cleanup MY_bfd_free_cached_info
-#endif
-
-#ifndef MY_get_dynamic_symtab_upper_bound
-#define MY_get_dynamic_symtab_upper_bound \
- _bfd_nodynamic_get_dynamic_symtab_upper_bound
-#endif
-#ifndef MY_canonicalize_dynamic_symtab
-#define MY_canonicalize_dynamic_symtab \
- _bfd_nodynamic_canonicalize_dynamic_symtab
-#endif
-#ifndef MY_get_dynamic_reloc_upper_bound
-#define MY_get_dynamic_reloc_upper_bound \
- _bfd_nodynamic_get_dynamic_reloc_upper_bound
-#endif
-#ifndef MY_canonicalize_dynamic_reloc
-#define MY_canonicalize_dynamic_reloc \
- _bfd_nodynamic_canonicalize_dynamic_reloc
-#endif
-
-/* Aout symbols normally have leading underscores */
-#ifndef MY_symbol_leading_char
-#define MY_symbol_leading_char '_'
-#endif
-
-/* Aout archives normally use spaces for padding */
-#ifndef AR_PAD_CHAR
-#define AR_PAD_CHAR ' '
-#endif
-
-#ifndef MY_BFD_TARGET
-const bfd_target MY(vec) =
-{
- TARGETNAME, /* name */
- bfd_target_aout_flavour,
-#ifdef TARGET_IS_BIG_ENDIAN_P
- BFD_ENDIAN_BIG, /* target byte order (big) */
- BFD_ENDIAN_BIG, /* target headers byte order (big) */
-#else
- BFD_ENDIAN_LITTLE, /* target byte order (little) */
- BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
-#endif
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
-#ifdef TARGET_IS_BIG_ENDIAN_P
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-#else
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-#endif
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (MY),
-
- /* Alternative_target */
- NULL,
-
- (PTR) MY_backend_data
-};
-#endif /* MY_BFD_TARGET */
diff --git a/contrib/binutils/bfd/aout0.c b/contrib/binutils/bfd/aout0.c
deleted file mode 100644
index 731d476..0000000
--- a/contrib/binutils/bfd/aout0.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* BFD backend for SunOS style a.out with flags set to 0
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGETNAME "a.out-zero-big"
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (aout0_big_,OP)
-
-#include "bfd.h"
-
-#define MY_exec_hdr_flags 0
-
-#define MACHTYPE_OK(mtype) \
- ((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020)
-
-/* Include the usual a.out support. */
-#include "aoutf1.h"
diff --git a/contrib/binutils/bfd/aout32.c b/contrib/binutils/bfd/aout32.c
deleted file mode 100644
index afe7fa2..0000000
--- a/contrib/binutils/bfd/aout32.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* BFD back-end for 32-bit a.out files.
- Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define ARCH_SIZE 32
-
-#include "aoutx.h"
diff --git a/contrib/binutils/bfd/aout64.c b/contrib/binutils/bfd/aout64.c
deleted file mode 100644
index 0f31dab..0000000
--- a/contrib/binutils/bfd/aout64.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* BFD back-end for 64-bit a.out files.
- Copyright 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define ARCH_SIZE 64
-
-/* aoutx.h requires definitions for BMAGIC and QMAGIC. */
-#ifndef BMAGIC
-#define BMAGIC 0
-#endif
-#ifndef QMAGIC
-#define QMAGIC 0
-#endif
-
-#include "aoutx.h"
diff --git a/contrib/binutils/bfd/aoutf1.h b/contrib/binutils/bfd/aoutf1.h
deleted file mode 100644
index 352dadf..0000000
--- a/contrib/binutils/bfd/aoutf1.h
+++ /dev/null
@@ -1,846 +0,0 @@
-/* A.out "format 1" file handling code for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#include "aout/sun4.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-
-/* This is needed to reject a NewsOS file, e.g. in
- gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
- I needed to add M_UNKNOWN to recognize a 68000 object, so this will
- probably no longer reject a NewsOS object. <ian@cygnus.com>. */
-#ifndef MACHTYPE_OK
-#define MACHTYPE_OK(mtype) \
- (((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \
- || (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \
- && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
-#endif
-
-/*
-The file @code{aoutf1.h} contains the code for BFD's
-a.out back end. Control over the generated back end is given by these
-two preprocessor names:
-@table @code
-@item ARCH_SIZE
-This value should be either 32 or 64, depending upon the size of an
-int in the target format. It changes the sizes of the structs which
-perform the memory/disk mapping of structures.
-
-The 64 bit backend may only be used if the host compiler supports 64
-ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
-With this name defined, @emph{all} bfd operations are performed with 64bit
-arithmetic, not just those to a 64bit target.
-
-@item TARGETNAME
-The name put into the target vector.
-@item
-@end table
-
-*/
-
-/*SUPPRESS558*/
-/*SUPPRESS529*/
-
-#if ARCH_SIZE == 64
-#define sunos_set_arch_mach sunos_64_set_arch_mach
-#define sunos_write_object_contents aout_64_sunos4_write_object_contents
-#else
-#define sunos_set_arch_mach sunos_32_set_arch_mach
-#define sunos_write_object_contents aout_32_sunos4_write_object_contents
-#endif
-
-static bfd_boolean sunos_merge_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static void sunos_set_arch_mach
- PARAMS ((bfd *, enum machine_type));
-static void choose_reloc_size
- PARAMS ((bfd *));
-static bfd_boolean sunos_write_object_contents
- PARAMS ((bfd *));
-static const bfd_target *sunos4_core_file_p
- PARAMS ((bfd *));
-static char *sunos4_core_file_failing_command
- PARAMS ((bfd *));
-static int sunos4_core_file_failing_signal
- PARAMS ((bfd *));
-static bfd_boolean sunos4_core_file_matches_executable_p
- PARAMS ((bfd *, bfd *));
-static bfd_boolean sunos4_set_sizes
- PARAMS ((bfd *));
-
-/* Merge backend data into the output file.
- This is necessary on sparclet-aout where we want the resultant machine
- number to be M_SPARCLET if any input file is M_SPARCLET. */
-
-#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
-
-static bfd_boolean
-sunos_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd, *obfd;
-{
- if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
- || bfd_get_flavour (obfd) != bfd_target_aout_flavour)
- return TRUE;
-
- if (bfd_get_arch (obfd) == bfd_arch_sparc)
- {
- if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
- bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
- }
-
- return TRUE;
-}
-
-/* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach,
- depending upon ARCH_SIZE. */
-
-static void
-sunos_set_arch_mach (abfd, machtype)
- bfd *abfd;
- enum machine_type machtype;
-{
- /* Determine the architecture and machine type of the object file. */
- enum bfd_architecture arch;
- unsigned long machine;
- switch (machtype)
- {
-
- case M_UNKNOWN:
- /* Some Sun3s make magic numbers without cpu types in them, so
- we'll default to the 68000. */
- arch = bfd_arch_m68k;
- machine = bfd_mach_m68000;
- break;
-
- case M_68010:
- case M_HP200:
- arch = bfd_arch_m68k;
- machine = bfd_mach_m68010;
- break;
-
- case M_68020:
- case M_HP300:
- arch = bfd_arch_m68k;
- machine = bfd_mach_m68020;
- break;
-
- case M_SPARC:
- arch = bfd_arch_sparc;
- machine = 0;
- break;
-
- case M_SPARCLET:
- arch = bfd_arch_sparc;
- machine = bfd_mach_sparc_sparclet;
- break;
-
- case M_SPARCLITE_LE:
- arch = bfd_arch_sparc;
- machine = bfd_mach_sparc_sparclite_le;
- break;
-
- case M_386:
- case M_386_DYNIX:
- arch = bfd_arch_i386;
- machine = 0;
- break;
-
- case M_29K:
- arch = bfd_arch_a29k;
- machine = 0;
- break;
-
- case M_HPUX:
- arch = bfd_arch_m68k;
- machine = 0;
- break;
-
- default:
- arch = bfd_arch_obscure;
- machine = 0;
- break;
- }
- bfd_set_arch_mach (abfd, arch, machine);
-}
-
-#define SET_ARCH_MACH(ABFD, EXEC) \
- NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
- choose_reloc_size(ABFD);
-
-/* Determine the size of a relocation entry, based on the architecture */
-static void
-choose_reloc_size (abfd)
- bfd *abfd;
-{
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_sparc:
- case bfd_arch_a29k:
- obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
- break;
- default:
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- break;
- }
-}
-
-/* Write an object file in SunOS format. Section contents have
- already been written. We write the file header, symbols, and
- relocation. The real name of this function is either
- aout_64_sunos4_write_object_contents or
- aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
-
-static bfd_boolean
-sunos_write_object_contents (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- /* Magic number, maestro, please! */
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_m68k:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_m68000:
- N_SET_MACHTYPE (*execp, M_UNKNOWN);
- break;
- case bfd_mach_m68010:
- N_SET_MACHTYPE (*execp, M_68010);
- break;
- default:
- case bfd_mach_m68020:
- N_SET_MACHTYPE (*execp, M_68020);
- break;
- }
- break;
- case bfd_arch_sparc:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_sparc_sparclet:
- N_SET_MACHTYPE (*execp, M_SPARCLET);
- break;
- case bfd_mach_sparc_sparclite_le:
- N_SET_MACHTYPE (*execp, M_SPARCLITE_LE);
- break;
- default:
- N_SET_MACHTYPE (*execp, M_SPARC);
- break;
- }
- break;
- case bfd_arch_i386:
- N_SET_MACHTYPE (*execp, M_386);
- break;
- case bfd_arch_a29k:
- N_SET_MACHTYPE (*execp, M_29K);
- break;
- default:
- N_SET_MACHTYPE (*execp, M_UNKNOWN);
- }
-
- choose_reloc_size (abfd);
-
- N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
-
- N_SET_DYNAMIC (*execp, (long)(bfd_get_file_flags (abfd) & DYNAMIC));
-
- WRITE_HEADERS (abfd, execp);
-
- return TRUE;
-}
-
-/* core files */
-
-#define CORE_MAGIC 0x080456
-#define CORE_NAMELEN 16
-
-/* The core structure is taken from the Sun documentation.
- Unfortunately, they don't document the FPA structure, or at least I
- can't find it easily. Fortunately the core header contains its own
- length. So this shouldn't cause problems, except for c_ucode, which
- so far we don't use but is easy to find with a little arithmetic. */
-
-/* But the reg structure can be gotten from the SPARC processor handbook.
- This really should be in a GNU include file though so that gdb can use
- the same info. */
-struct regs
-{
- int r_psr;
- int r_pc;
- int r_npc;
- int r_y;
- int r_g1;
- int r_g2;
- int r_g3;
- int r_g4;
- int r_g5;
- int r_g6;
- int r_g7;
- int r_o0;
- int r_o1;
- int r_o2;
- int r_o3;
- int r_o4;
- int r_o5;
- int r_o6;
- int r_o7;
-};
-
-/* Taken from Sun documentation: */
-
-/* FIXME: It's worse than we expect. This struct contains TWO substructs
- neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't
- even portably access the stuff in between! */
-
-struct external_sparc_core
- {
- int c_magic; /* Corefile magic number */
- int c_len; /* Sizeof (struct core) */
-#define SPARC_CORE_LEN 432
- int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
- struct external_exec c_aouthdr; /* A.out header */
- int c_signo; /* Killing signal, if any */
- int c_tsize; /* Text size (bytes) */
- int c_dsize; /* Data size (bytes) */
- int c_ssize; /* Stack size (bytes) */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
- double fp_stuff[1]; /* external FPU state (size unknown by us) */
- /* The type "double" is critical here, for alignment.
- SunOS declares a struct here, but the struct's alignment
- is double since it contains doubles. */
- int c_ucode; /* Exception no. from u_code */
- /* (this member is not accessible by name since we don't
- portably know the size of fp_stuff.) */
- };
-
-/* Core files generated by the BCP (the part of Solaris which allows
- it to run SunOS4 a.out files). */
-struct external_solaris_bcp_core
- {
- int c_magic; /* Corefile magic number */
- int c_len; /* Sizeof (struct core) */
-#define SOLARIS_BCP_CORE_LEN 456
- int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
- int c_exdata_vp; /* exdata structure */
- int c_exdata_tsize;
- int c_exdata_dsize;
- int c_exdata_bsize;
- int c_exdata_lsize;
- int c_exdata_nshlibs;
- short c_exdata_mach;
- short c_exdata_mag;
- int c_exdata_toffset;
- int c_exdata_doffset;
- int c_exdata_loffset;
- int c_exdata_txtorg;
- int c_exdata_datorg;
- int c_exdata_entloc;
- int c_signo; /* Killing signal, if any */
- int c_tsize; /* Text size (bytes) */
- int c_dsize; /* Data size (bytes) */
- int c_ssize; /* Stack size (bytes) */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
- double fp_stuff[1]; /* external FPU state (size unknown by us) */
- /* The type "double" is critical here, for alignment.
- SunOS declares a struct here, but the struct's alignment
- is double since it contains doubles. */
- int c_ucode; /* Exception no. from u_code */
- /* (this member is not accessible by name since we don't
- portably know the size of fp_stuff.) */
- };
-
-struct external_sun3_core
- {
- int c_magic; /* Corefile magic number */
- int c_len; /* Sizeof (struct core) */
-#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1 */
- int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */
- struct external_exec c_aouthdr; /* A.out header */
- int c_signo; /* Killing signal, if any */
- int c_tsize; /* Text size (bytes) */
- int c_dsize; /* Data size (bytes) */
- int c_ssize; /* Stack size (bytes) */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
- double fp_stuff[1]; /* external FPU state (size unknown by us) */
- /* The type "double" is critical here, for alignment.
- SunOS declares a struct here, but the struct's alignment
- is double since it contains doubles. */
- int c_ucode; /* Exception no. from u_code */
- /* (this member is not accessible by name since we don't
- portably know the size of fp_stuff.) */
- };
-
-struct internal_sunos_core
- {
- int c_magic; /* Corefile magic number */
- int c_len; /* Sizeof (struct core) */
- long c_regs_pos; /* file offset of General purpose registers */
- int c_regs_size; /* size of General purpose registers */
- struct internal_exec c_aouthdr; /* A.out header */
- int c_signo; /* Killing signal, if any */
- int c_tsize; /* Text size (bytes) */
- int c_dsize; /* Data size (bytes) */
- bfd_vma c_data_addr; /* Data start (address) */
- int c_ssize; /* Stack size (bytes) */
- bfd_vma c_stacktop; /* Stack top (address) */
- char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
- long fp_stuff_pos; /* file offset of external FPU state (regs) */
- int fp_stuff_size; /* Size of it */
- int c_ucode; /* Exception no. from u_code */
- };
-
-static void swapcore_sun3
- PARAMS ((bfd *, char *, struct internal_sunos_core *));
-static void swapcore_sparc
- PARAMS ((bfd *, char *, struct internal_sunos_core *));
-static void swapcore_solaris_bcp
- PARAMS ((bfd *, char *, struct internal_sunos_core *));
-
-/* byte-swap in the Sun-3 core structure */
-static void
-swapcore_sun3 (abfd, ext, intcore)
- bfd *abfd;
- char *ext;
- struct internal_sunos_core *intcore;
-{
- struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
-
- 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
- aout_64_swap_exec_header_in
-#else
- aout_32_swap_exec_header_in
-#endif
- (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
- 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 = 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 = H_GET_32 (abfd,
- (intcore->c_len
- - sizeof (extcore->c_ucode)
- + (unsigned char *) extcore));
- intcore->c_stacktop = 0x0E000000; /* By experimentation */
-}
-
-/* byte-swap in the Sparc core structure */
-static void
-swapcore_sparc (abfd, ext, intcore)
- bfd *abfd;
- char *ext;
- struct internal_sunos_core *intcore;
-{
- struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
-
- 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
- aout_64_swap_exec_header_in
-#else
- aout_32_swap_exec_header_in
-#endif
- (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
- 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 = 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 = 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. */
- /* Now sun has provided us with another challenge. The value is different
- for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
- the other based on the current value of the stack pointer. This
- loses (a) if the stack pointer has been clobbered, or (b) if the stack
- is larger than 128 megabytes.
-
- It's times like these you're glad they're switching to ELF.
-
- Note that using include files or nlist on /vmunix would be wrong,
- because we want the value for this core file, no matter what kind of
- machine we were compiled on or are running on. */
-#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
-#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
- {
- 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
- intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
- }
-}
-
-/* byte-swap in the Solaris BCP core structure */
-static void
-swapcore_solaris_bcp (abfd, ext, intcore)
- bfd *abfd;
- char *ext;
- struct internal_sunos_core *intcore;
-{
- struct external_solaris_bcp_core *extcore =
- (struct external_solaris_bcp_core *) ext;
-
- 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);
-
- /* The Solaris BCP exdata structure does not contain an a_syms field,
- so we are unable to synthesize an internal exec header.
- Luckily we are able to figure out the start address of the data section,
- which is the only thing needed from the internal exec header,
- from the exdata structure.
-
- As of Solaris 2.3, BCP core files for statically linked executables
- are buggy. The exdata structure is not properly filled in, and
- 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 = 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);
- /* 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_solaris_bcp_core *) 0)->fp_stuff);
- /* Ucode is the last thing in the struct -- just before the end */
- 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. */
- /* Now sun has provided us with another challenge. The value is different
- for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
- the other based on the current value of the stack pointer. This
- loses (a) if the stack pointer has been clobbered, or (b) if the stack
- is larger than 128 megabytes.
-
- It's times like these you're glad they're switching to ELF.
-
- Note that using include files or nlist on /vmunix would be wrong,
- because we want the value for this core file, no matter what kind of
- machine we were compiled on or are running on. */
-#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
-#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
- {
- 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
- intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
- }
-}
-
-/* need this cast because ptr is really void * */
-#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
-#define core_datasec(bfd) (core_hdr(bfd)->data_section)
-#define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
-#define core_regsec(bfd) (core_hdr(bfd)->reg_section)
-#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section)
-
-/* These are stored in the bfd's tdata */
-struct sun_core_struct
-{
- struct internal_sunos_core *hdr; /* core file header */
- asection *data_section;
- asection *stack_section;
- asection *reg_section;
- asection *reg2_section;
-};
-
-static const bfd_target *
-sunos4_core_file_p (abfd)
- bfd *abfd;
-{
- unsigned char longbuf[4]; /* Raw bytes of various header fields */
- bfd_size_type core_size, amt;
- unsigned long core_mag;
- struct internal_sunos_core *core;
- char *extcore;
- struct mergem
- {
- struct sun_core_struct suncoredata;
- struct internal_sunos_core internal_sunos_core;
- char external_core[1];
- } *mergem;
-
- if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
- != sizeof (longbuf))
- return 0;
- 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_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
- != sizeof (longbuf))
- return 0;
- 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)
- return 0;
-
- amt = core_size + sizeof (struct mergem);
- mergem = (struct mergem *) bfd_zalloc (abfd, amt);
- if (mergem == NULL)
- return 0;
-
- extcore = mergem->external_core;
-
- if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size)
- {
- loser:
- bfd_release (abfd, (char *) mergem);
- abfd->tdata.any = NULL;
- bfd_section_list_clear (abfd);
- return 0;
- }
-
- /* Validate that it's a core file we know how to handle, due to sun
- botching the positioning of registers and other fields in a machine
- dependent way. */
- core = &mergem->internal_sunos_core;
- switch (core_size)
- {
- case SPARC_CORE_LEN:
- swapcore_sparc (abfd, extcore, core);
- break;
- case SUN3_CORE_LEN:
- swapcore_sun3 (abfd, extcore, core);
- break;
- case SOLARIS_BCP_CORE_LEN:
- swapcore_solaris_bcp (abfd, extcore, core);
- break;
- default:
- bfd_set_error (bfd_error_system_call); /* FIXME */
- goto loser;
- }
-
- abfd->tdata.sun_core_data = &mergem->suncoredata;
- abfd->tdata.sun_core_data->hdr = core;
-
- /* Create the sections. */
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
- if (core_stacksec (abfd) == NULL)
- /* bfd_release frees everything allocated after it's arg. */
- goto loser;
-
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
- if (core_datasec (abfd) == NULL)
- goto loser;
-
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
- if (core_regsec (abfd) == NULL)
- goto loser;
-
- core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
- if (core_reg2sec (abfd) == NULL)
- goto loser;
-
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
- core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
-
- core_stacksec (abfd)->_raw_size = core->c_ssize;
- core_datasec (abfd)->_raw_size = core->c_dsize;
- core_regsec (abfd)->_raw_size = core->c_regs_size;
- core_reg2sec (abfd)->_raw_size = core->fp_stuff_size;
-
- core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
- core_datasec (abfd)->vma = core->c_data_addr;
- core_regsec (abfd)->vma = 0;
- core_reg2sec (abfd)->vma = 0;
-
- core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
- core_datasec (abfd)->filepos = core->c_len;
- /* We'll access the regs afresh in the core file, like any section: */
- core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos;
- core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos;
-
- /* Align to word at least */
- core_stacksec (abfd)->alignment_power = 2;
- core_datasec (abfd)->alignment_power = 2;
- core_regsec (abfd)->alignment_power = 2;
- core_reg2sec (abfd)->alignment_power = 2;
-
- return abfd->xvec;
-}
-
-static char *
-sunos4_core_file_failing_command (abfd)
- bfd *abfd;
-{
- return core_hdr (abfd)->hdr->c_cmdname;
-}
-
-static int
-sunos4_core_file_failing_signal (abfd)
- bfd *abfd;
-{
- return core_hdr (abfd)->hdr->c_signo;
-}
-
-static bfd_boolean
-sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd;
- bfd *exec_bfd;
-{
- if (core_bfd->xvec != exec_bfd->xvec)
- {
- bfd_set_error (bfd_error_system_call);
- return FALSE;
- }
-
- /* Solaris core files do not include an aouthdr. */
- if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
- return TRUE;
-
- return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
- (char *) exec_hdr (exec_bfd),
- sizeof (struct internal_exec)) == 0);
-}
-
-#define MY_set_sizes sunos4_set_sizes
-static bfd_boolean
-sunos4_set_sizes (abfd)
- bfd *abfd;
-{
- switch (bfd_get_arch (abfd))
- {
- default:
- return FALSE;
- case bfd_arch_sparc:
- adata (abfd).page_size = 0x2000;
- adata (abfd).segment_size = 0x2000;
- adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return TRUE;
- case bfd_arch_m68k:
- adata (abfd).page_size = 0x2000;
- adata (abfd).segment_size = 0x20000;
- adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return TRUE;
- }
-}
-
-/* We default to setting the toolversion field to 1, as is required by
- SunOS. */
-#ifndef MY_exec_hdr_flags
-#define MY_exec_hdr_flags 1
-#endif
-
-#ifndef MY_entry_is_text_address
-#define MY_entry_is_text_address 0
-#endif
-#ifndef MY_add_dynamic_symbols
-#define MY_add_dynamic_symbols 0
-#endif
-#ifndef MY_add_one_symbol
-#define MY_add_one_symbol 0
-#endif
-#ifndef MY_link_dynamic_object
-#define MY_link_dynamic_object 0
-#endif
-#ifndef MY_write_dynamic_symbol
-#define MY_write_dynamic_symbol 0
-#endif
-#ifndef MY_check_dynamic_reloc
-#define MY_check_dynamic_reloc 0
-#endif
-#ifndef MY_finish_dynamic_link
-#define MY_finish_dynamic_link 0
-#endif
-
-static const struct aout_backend_data sunos4_aout_backend =
-{
- 0, /* zmagic files are not contiguous */
- 1, /* text includes header */
- MY_entry_is_text_address,
- MY_exec_hdr_flags,
- 0, /* default text vma */
- sunos4_set_sizes,
- 0, /* header is counted in zmagic text */
- MY_add_dynamic_symbols,
- MY_add_one_symbol,
- MY_link_dynamic_object,
- MY_write_dynamic_symbol,
- MY_check_dynamic_reloc,
- MY_finish_dynamic_link
-};
-
-#define MY_core_file_failing_command sunos4_core_file_failing_command
-#define MY_core_file_failing_signal sunos4_core_file_failing_signal
-#define MY_core_file_matches_executable_p sunos4_core_file_matches_executable_p
-
-#define MY_bfd_debug_info_start bfd_void
-#define MY_bfd_debug_info_end bfd_void
-#define MY_bfd_debug_info_accumulate \
- (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void
-#define MY_core_file_p sunos4_core_file_p
-#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
-#define MY_backend_data &sunos4_aout_backend
-
-#ifndef TARGET_IS_LITTLE_ENDIAN_P
-#define TARGET_IS_BIG_ENDIAN_P
-#endif
-
-#include "aout-target.h"
diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h
deleted file mode 100644
index 3282f87..0000000
--- a/contrib/binutils/bfd/aoutx.h
+++ /dev/null
@@ -1,5821 +0,0 @@
-/* BFD semi-generic back-end for a.out binaries.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- a.out backends
-
-DESCRIPTION
-
- BFD supports a number of different flavours of a.out format,
- though the major differences are only the sizes of the
- structures on disk, and the shape of the relocation
- information.
-
- The support is split into a basic support file @file{aoutx.h}
- and other files which derive functions from the base. One
- derivation file is @file{aoutf1.h} (for a.out flavour 1), and
- adds to the basic a.out functions support for sun3, sun4, 386
- and 29k a.out files, to create a target jump vector for a
- specific target.
-
- This information is further split out into more specific files
- for each machine, including @file{sunos.c} for sun3 and sun4,
- @file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a
- demonstration of a 64 bit a.out format.
-
- The base file @file{aoutx.h} defines general mechanisms for
- reading and writing records to and from disk and various
- other methods which BFD requires. It is included by
- @file{aout32.c} and @file{aout64.c} to form the names
- <<aout_32_swap_exec_header_in>>, <<aout_64_swap_exec_header_in>>, etc.
-
- As an example, this is what goes on to make the back end for a
- sun4, from @file{aout32.c}:
-
-| #define ARCH_SIZE 32
-| #include "aoutx.h"
-
- Which exports names:
-
-| ...
-| aout_32_canonicalize_reloc
-| aout_32_find_nearest_line
-| aout_32_get_lineno
-| aout_32_get_reloc_upper_bound
-| ...
-
- from @file{sunos.c}:
-
-| #define TARGET_NAME "a.out-sunos-big"
-| #define VECNAME sunos_big_vec
-| #include "aoutf1.h"
-
- requires all the names from @file{aout32.c}, and produces the jump vector
-
-| sunos_big_vec
-
- The file @file{host-aout.c} is a special case. It is for a large set
- of hosts that use ``more or less standard'' a.out files, and
- for which cross-debugging is not interesting. It uses the
- standard 32-bit a.out support routines, but determines the
- file offsets and addresses of the text, data, and BSS
- sections, the machine architecture and machine type, and the
- entry point address, in a host-dependent manner. Once these
- values have been determined, generic code is used to handle
- the object file.
-
- When porting it to run on a new system, you must supply:
-
-| HOST_PAGE_SIZE
-| HOST_SEGMENT_SIZE
-| HOST_MACHINE_ARCH (optional)
-| HOST_MACHINE_MACHINE (optional)
-| HOST_TEXT_START_ADDR
-| HOST_STACK_END_ADDR
-
- in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These
- values, plus the structures and macros defined in @file{a.out.h} on
- your host system, will produce a BFD target that will access
- ordinary a.out files on your host. To configure a new machine
- to use @file{host-aout.c}, specify:
-
-| TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
-| TDEPFILES= host-aout.o trad-core.o
-
- in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
- to use the
- @file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your
- configuration is selected. */
-
-/* Some assumptions:
- * Any BFD with D_PAGED set is ZMAGIC, and vice versa.
- Doesn't matter what the setting of WP_TEXT is on output, but it'll
- get set on input.
- * Any BFD with D_PAGED clear and WP_TEXT set is NMAGIC.
- * Any BFD with both flags clear is OMAGIC.
- (Just want to make these explicit, so the conditions tested in this
- file make sense if you're more familiar with a.out than with BFD.) */
-
-#define KEEPIT udata.i
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "safe-ctype.h"
-#include "bfdlink.h"
-
-#include "libaout.h"
-#include "libbfd.h"
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-
-static bfd_boolean aout_get_external_symbols
- PARAMS ((bfd *));
-static bfd_boolean translate_from_native_sym_flags
- PARAMS ((bfd *, aout_symbol_type *));
-static bfd_boolean translate_to_native_sym_flags
- PARAMS ((bfd *, asymbol *, struct external_nlist *));
-static void adjust_o_magic
- PARAMS ((bfd *, struct internal_exec *));
-static void adjust_z_magic
- PARAMS ((bfd *, struct internal_exec *));
-static void adjust_n_magic
- PARAMS ((bfd *, struct internal_exec *));
-reloc_howto_type * NAME(aout,reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-/*
-SUBSECTION
- Relocations
-
-DESCRIPTION
- The file @file{aoutx.h} provides for both the @emph{standard}
- and @emph{extended} forms of a.out relocation records.
-
- The standard records contain only an
- address, a symbol index, and a type field. The extended records
- (used on 29ks and sparcs) also have a full integer for an
- addend. */
-
-#ifndef CTOR_TABLE_RELOC_HOWTO
-#define CTOR_TABLE_RELOC_IDX 2
-#define CTOR_TABLE_RELOC_HOWTO(BFD) \
- ((obj_reloc_entry_size (BFD) == RELOC_EXT_SIZE \
- ? howto_table_ext : howto_table_std) \
- + CTOR_TABLE_RELOC_IDX)
-#endif
-
-#ifndef MY_swap_std_reloc_in
-#define MY_swap_std_reloc_in NAME(aout,swap_std_reloc_in)
-#endif
-
-#ifndef MY_swap_ext_reloc_in
-#define MY_swap_ext_reloc_in NAME(aout,swap_ext_reloc_in)
-#endif
-
-#ifndef MY_swap_std_reloc_out
-#define MY_swap_std_reloc_out NAME(aout,swap_std_reloc_out)
-#endif
-
-#ifndef MY_swap_ext_reloc_out
-#define MY_swap_ext_reloc_out NAME(aout,swap_ext_reloc_out)
-#endif
-
-#ifndef MY_final_link_relocate
-#define MY_final_link_relocate _bfd_final_link_relocate
-#endif
-
-#ifndef MY_relocate_contents
-#define MY_relocate_contents _bfd_relocate_contents
-#endif
-
-#define howto_table_ext NAME(aout,ext_howto_table)
-#define howto_table_std NAME(aout,std_howto_table)
-
-reloc_howto_type howto_table_ext[] =
-{
- /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */
- HOWTO(RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", FALSE, 0,0x000000ff, FALSE),
- HOWTO(RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(RELOC_DISP8, 0, 0, 8, TRUE, 0, complain_overflow_signed,0,"DISP8", FALSE, 0,0x000000ff, FALSE),
- HOWTO(RELOC_DISP16, 0, 1, 16, TRUE, 0, complain_overflow_signed,0,"DISP16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(RELOC_DISP32, 0, 2, 32, TRUE, 0, complain_overflow_signed,0,"DISP32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(RELOC_WDISP30,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"WDISP30", FALSE, 0,0x3fffffff, FALSE),
- HOWTO(RELOC_WDISP22,2, 2, 22, TRUE, 0, complain_overflow_signed,0,"WDISP22", FALSE, 0,0x003fffff, FALSE),
- HOWTO(RELOC_HI22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"HI22", FALSE, 0,0x003fffff, FALSE),
- HOWTO(RELOC_22, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"22", FALSE, 0,0x003fffff, FALSE),
- HOWTO(RELOC_13, 0, 2, 13, FALSE, 0, complain_overflow_bitfield,0,"13", FALSE, 0,0x00001fff, FALSE),
- HOWTO(RELOC_LO10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"LO10", FALSE, 0,0x000003ff, FALSE),
- HOWTO(RELOC_SFA_BASE,0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_BASE", FALSE, 0,0xffffffff, FALSE),
- HOWTO(RELOC_SFA_OFF13,0,2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_OFF13",FALSE, 0,0xffffffff, FALSE),
- HOWTO(RELOC_BASE10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"BASE10", FALSE, 0,0x000003ff, FALSE),
- HOWTO(RELOC_BASE13, 0, 2, 13, FALSE, 0, complain_overflow_signed,0,"BASE13", FALSE, 0,0x00001fff, FALSE),
- HOWTO(RELOC_BASE22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"BASE22", FALSE, 0,0x003fffff, FALSE),
- HOWTO(RELOC_PC10, 0, 2, 10, TRUE, 0, complain_overflow_dont,0,"PC10", FALSE, 0,0x000003ff, TRUE),
- HOWTO(RELOC_PC22, 10, 2, 22, TRUE, 0, complain_overflow_signed,0,"PC22", FALSE, 0,0x003fffff, TRUE),
- HOWTO(RELOC_JMP_TBL,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"JMP_TBL", FALSE, 0,0x3fffffff, FALSE),
- HOWTO(RELOC_SEGOFF16,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"SEGOFF16", FALSE, 0,0x00000000, FALSE),
- HOWTO(RELOC_GLOB_DAT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GLOB_DAT", FALSE, 0,0x00000000, FALSE),
- HOWTO(RELOC_JMP_SLOT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_SLOT", FALSE, 0,0x00000000, FALSE),
- HOWTO(RELOC_RELATIVE,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE),
- HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
-#define RELOC_SPARC_REV32 RELOC_WDISP19
- HOWTO(RELOC_SPARC_REV32, 0, 2, 32, FALSE, 0, complain_overflow_dont,0,"R_SPARC_REV32", FALSE, 0,0xffffffff, FALSE),
-};
-
-/* Convert standard reloc records to "arelent" format (incl byte swap). */
-
-reloc_howto_type howto_table_std[] =
-{
- /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */
-HOWTO ( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE),
-HOWTO ( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
-HOWTO ( 2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", TRUE, 0xffffffff,0xffffffff, FALSE),
-HOWTO ( 3, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,0,"64", TRUE, 0xdeaddead,0xdeaddead, FALSE),
-HOWTO ( 4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,"DISP8", TRUE, 0x000000ff,0x000000ff, FALSE),
-HOWTO ( 5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,"DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
-HOWTO ( 6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,"DISP32", TRUE, 0xffffffff,0xffffffff, FALSE),
-HOWTO ( 7, 0, 4, 64, TRUE, 0, complain_overflow_signed, 0,"DISP64", TRUE, 0xfeedface,0xfeedface, FALSE),
-HOWTO ( 8, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GOT_REL", FALSE, 0,0x00000000, FALSE),
-HOWTO ( 9, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"BASE16", FALSE,0xffffffff,0xffffffff, FALSE),
-HOWTO (10, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"BASE32", FALSE,0xffffffff,0xffffffff, FALSE),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
- HOWTO (16, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_TABLE", FALSE, 0,0x00000000, FALSE),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
- HOWTO (32, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
-EMPTY_HOWTO (-1),
- HOWTO (40, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"BASEREL", FALSE, 0,0x00000000, FALSE),
-};
-
-#define TABLE_SIZE(TABLE) (sizeof (TABLE) / sizeof (TABLE[0]))
-
-reloc_howto_type *
-NAME(aout,reloc_type_lookup) (abfd,code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
-{
-#define EXT(i, j) case i: return &howto_table_ext[j]
-#define STD(i, j) case i: return &howto_table_std[j]
- int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE;
-
- if (code == BFD_RELOC_CTOR)
- switch (bfd_get_arch_info (abfd)->bits_per_address)
- {
- case 32:
- code = BFD_RELOC_32;
- break;
- case 64:
- code = BFD_RELOC_64;
- break;
- }
-
- if (ext)
- switch (code)
- {
- EXT (BFD_RELOC_8, 0);
- EXT (BFD_RELOC_16, 1);
- EXT (BFD_RELOC_32, 2);
- EXT (BFD_RELOC_HI22, 8);
- EXT (BFD_RELOC_LO10, 11);
- EXT (BFD_RELOC_32_PCREL_S2, 6);
- EXT (BFD_RELOC_SPARC_WDISP22, 7);
- EXT (BFD_RELOC_SPARC13, 10);
- EXT (BFD_RELOC_SPARC_GOT10, 14);
- EXT (BFD_RELOC_SPARC_BASE13, 15);
- EXT (BFD_RELOC_SPARC_GOT13, 15);
- EXT (BFD_RELOC_SPARC_GOT22, 16);
- EXT (BFD_RELOC_SPARC_PC10, 17);
- EXT (BFD_RELOC_SPARC_PC22, 18);
- EXT (BFD_RELOC_SPARC_WPLT30, 19);
- EXT (BFD_RELOC_SPARC_REV32, 26);
- default: return (reloc_howto_type *) NULL;
- }
- else
- /* std relocs. */
- switch (code)
- {
- STD (BFD_RELOC_8, 0);
- STD (BFD_RELOC_16, 1);
- STD (BFD_RELOC_32, 2);
- STD (BFD_RELOC_8_PCREL, 4);
- STD (BFD_RELOC_16_PCREL, 5);
- STD (BFD_RELOC_32_PCREL, 6);
- STD (BFD_RELOC_16_BASEREL, 9);
- STD (BFD_RELOC_32_BASEREL, 10);
- default: return (reloc_howto_type *) NULL;
- }
-}
-
-/*
-SUBSECTION
- Internal entry points
-
-DESCRIPTION
- @file{aoutx.h} exports several routines for accessing the
- contents of an a.out file, which are gathered and exported in
- turn by various format specific files (eg sunos.c).
-
-*/
-
-/*
-FUNCTION
- aout_@var{size}_swap_exec_header_in
-
-SYNOPSIS
- void aout_@var{size}_swap_exec_header_in,
- (bfd *abfd,
- struct external_exec *raw_bytes,
- struct internal_exec *execp);
-
-DESCRIPTION
- Swap the information in an executable header @var{raw_bytes} taken
- from a raw byte stream memory image into the internal exec header
- structure @var{execp}.
-*/
-
-#ifndef NAME_swap_exec_header_in
-void
-NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp)
- bfd *abfd;
- struct external_exec *raw_bytes;
- struct internal_exec *execp;
-{
- struct external_exec *bytes = (struct external_exec *)raw_bytes;
-
- /* The internal_exec structure has some fields that are unused in this
- configuration (IE for i960), so ensure that all such uninitialized
- fields are zero'd out. There are places where two of these structs
- are memcmp'd, and thus the contents do matter. */
- memset ((PTR) execp, 0, sizeof (struct internal_exec));
- /* Now fill in fields in the execp, from the bytes in the raw data. */
- 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);
- execp->a_syms = GET_WORD (abfd, bytes->e_syms);
- execp->a_entry = GET_WORD (abfd, bytes->e_entry);
- execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
- execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
-}
-#define NAME_swap_exec_header_in NAME(aout,swap_exec_header_in)
-#endif
-
-/*
-FUNCTION
- aout_@var{size}_swap_exec_header_out
-
-SYNOPSIS
- void aout_@var{size}_swap_exec_header_out
- (bfd *abfd,
- struct internal_exec *execp,
- struct external_exec *raw_bytes);
-
-DESCRIPTION
- Swap the information in an internal exec header structure
- @var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
-*/
-void
-NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
- bfd *abfd;
- struct internal_exec *execp;
- struct external_exec *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. */
- 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);
- PUT_WORD (abfd, execp->a_syms , bytes->e_syms);
- PUT_WORD (abfd, execp->a_entry , bytes->e_entry);
- PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
- PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
-}
-
-/* Make all the section for an a.out file. */
-
-bfd_boolean
-NAME(aout,make_sections) (abfd)
- bfd *abfd;
-{
- if (obj_textsec (abfd) == (asection *) NULL
- && bfd_make_section (abfd, ".text") == (asection *) NULL)
- return FALSE;
- if (obj_datasec (abfd) == (asection *) NULL
- && bfd_make_section (abfd, ".data") == (asection *) NULL)
- return FALSE;
- if (obj_bsssec (abfd) == (asection *) NULL
- && bfd_make_section (abfd, ".bss") == (asection *) NULL)
- return FALSE;
- return TRUE;
-}
-
-/*
-FUNCTION
- aout_@var{size}_some_aout_object_p
-
-SYNOPSIS
- const bfd_target *aout_@var{size}_some_aout_object_p
- (bfd *abfd,
- const bfd_target *(*callback_to_real_object_p) ());
-
-DESCRIPTION
- Some a.out variant thinks that the file open in @var{abfd}
- checking is an a.out file. Do some more checking, and set up
- for access if it really is. Call back to the calling
- environment's "finish up" function just before returning, to
- handle any last-minute setup.
-*/
-
-const bfd_target *
-NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
- bfd *abfd;
- struct internal_exec *execp;
- const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *));
-{
- 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, amt);
- if (rawptr == NULL)
- return 0;
-
- oldrawptr = abfd->tdata.aout_data;
- abfd->tdata.aout_data = rawptr;
-
- /* Copy the contents of the old tdata struct.
- In particular, we want the subformat, since for hpux it was set in
- hp300hpux.c:swap_exec_header_in and will be used in
- hp300hpux.c:callback. */
- if (oldrawptr != NULL)
- *abfd->tdata.aout_data = *oldrawptr;
-
- abfd->tdata.aout_data->a.hdr = &rawptr->e;
- /* Copy in the internal_exec struct. */
- *(abfd->tdata.aout_data->a.hdr) = *execp;
- execp = abfd->tdata.aout_data->a.hdr;
-
- /* Set the file flags. */
- abfd->flags = BFD_NO_FLAGS;
- if (execp->a_drsize || execp->a_trsize)
- abfd->flags |= HAS_RELOC;
- /* Setting of EXEC_P has been deferred to the bottom of this function. */
- if (execp->a_syms)
- abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
- if (N_DYNAMIC (*execp))
- abfd->flags |= DYNAMIC;
-
- if (N_MAGIC (*execp) == ZMAGIC)
- {
- abfd->flags |= D_PAGED | WP_TEXT;
- adata (abfd).magic = z_magic;
- }
- else if (N_MAGIC (*execp) == QMAGIC)
- {
- abfd->flags |= D_PAGED | WP_TEXT;
- adata (abfd).magic = z_magic;
- adata (abfd).subformat = q_magic_format;
- }
- else if (N_MAGIC (*execp) == NMAGIC)
- {
- abfd->flags |= WP_TEXT;
- adata (abfd).magic = n_magic;
- }
- else if (N_MAGIC (*execp) == OMAGIC
- || N_MAGIC (*execp) == BMAGIC)
- adata (abfd).magic = o_magic;
- else
- {
- /* Should have been checked with N_BADMAG before this routine
- was called. */
- abort ();
- }
-
- bfd_get_start_address (abfd) = execp->a_entry;
-
- obj_aout_symbols (abfd) = (aout_symbol_type *)NULL;
- bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist);
-
- /* The default relocation entry size is that of traditional V7 Unix. */
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- /* The default symbol entry size is that of traditional Unix. */
- obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
-
-#ifdef USE_MMAP
- bfd_init_window (&obj_aout_sym_window (abfd));
- bfd_init_window (&obj_aout_string_window (abfd));
-#endif
- obj_aout_external_syms (abfd) = NULL;
- obj_aout_external_strings (abfd) = NULL;
- obj_aout_sym_hashes (abfd) = NULL;
-
- if (! NAME(aout,make_sections) (abfd))
- goto error_ret;
-
- obj_datasec (abfd)->_raw_size = execp->a_data;
- obj_bsssec (abfd)->_raw_size = execp->a_bss;
-
- obj_textsec (abfd)->flags =
- (execp->a_trsize != 0
- ? (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_RELOC)
- : (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS));
- obj_datasec (abfd)->flags =
- (execp->a_drsize != 0
- ? (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS | SEC_RELOC)
- : (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS));
- obj_bsssec (abfd)->flags = SEC_ALLOC;
-
-#ifdef THIS_IS_ONLY_DOCUMENTATION
- /* The common code can't fill in these things because they depend
- on either the start address of the text segment, the rounding
- up of virtual addresses between segments, or the starting file
- position of the text segment -- all of which varies among different
- versions of a.out. */
-
- /* Call back to the format-dependent code to fill in the rest of the
- fields and do any further cleanup. Things that should be filled
- in by the callback: */
-
- struct exec *execp = exec_hdr (abfd);
-
- obj_textsec (abfd)->size = N_TXTSIZE (*execp);
- obj_textsec (abfd)->raw_size = N_TXTSIZE (*execp);
- /* Data and bss are already filled in since they're so standard. */
-
- /* The virtual memory addresses of the sections. */
- obj_textsec (abfd)->vma = N_TXTADDR (*execp);
- obj_datasec (abfd)->vma = N_DATADDR (*execp);
- obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
-
- /* The file offsets of the sections. */
- obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
- obj_datasec (abfd)->filepos = N_DATOFF (*execp);
-
- /* The file offsets of the relocation info. */
- obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
- obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
-
- /* The file offsets of the string table and symbol table. */
- obj_str_filepos (abfd) = N_STROFF (*execp);
- obj_sym_filepos (abfd) = N_SYMOFF (*execp);
-
- /* Determine the architecture and machine type of the object file. */
- switch (N_MACHTYPE (*exec_hdr (abfd)))
- {
- default:
- abfd->obj_arch = bfd_arch_obscure;
- break;
- }
-
- adata (abfd)->page_size = TARGET_PAGE_SIZE;
- adata (abfd)->segment_size = SEGMENT_SIZE;
- adata (abfd)->exec_bytes_size = EXEC_BYTES_SIZE;
-
- return abfd->xvec;
-
- /* The architecture is encoded in various ways in various a.out variants,
- or is not encoded at all in some of them. The relocation size depends
- on the architecture and the a.out variant. Finally, the return value
- is the bfd_target vector in use. If an error occurs, return zero and
- set bfd_error to the appropriate error code.
-
- Formats such as b.out, which have additional fields in the a.out
- header, should cope with them in this callback as well. */
-#endif /* DOCUMENTATION */
-
- result = (*callback_to_real_object_p) (abfd);
-
- /* Now that the segment addresses have been worked out, take a better
- guess at whether the file is executable. If the entry point
- is within the text segment, assume it is. (This makes files
- executable even if their entry point address is 0, as long as
- their text starts at zero.).
-
- This test had to be changed to deal with systems where the text segment
- runs at a different location than the default. The problem is that the
- entry address can appear to be outside the text segment, thus causing an
- erroneous conclusion that the file isn't executable.
-
- To fix this, we now accept any non-zero entry point as an indication of
- executability. This will work most of the time, since only the linker
- sets the entry point, and that is likely to be non-zero for most systems. */
-
- if (execp->a_entry != 0
- || (execp->a_entry >= obj_textsec (abfd)->vma
- && execp->a_entry < (obj_textsec (abfd)->vma
- + obj_textsec (abfd)->_raw_size)))
- abfd->flags |= EXEC_P;
-#ifdef STAT_FOR_EXEC
- else
- {
- struct stat stat_buf;
-
- /* The original heuristic doesn't work in some important cases.
- The a.out file has no information about the text start
- address. For files (like kernels) linked to non-standard
- addresses (ld -Ttext nnn) the entry point may not be between
- the default text start (obj_textsec(abfd)->vma) and
- (obj_textsec(abfd)->vma) + text size. This is not just a mach
- issue. Many kernels are loaded at non standard addresses. */
- if (abfd->iostream != NULL
- && (abfd->flags & BFD_IN_MEMORY) == 0
- && (fstat (fileno ((FILE *) (abfd->iostream)), &stat_buf) == 0)
- && ((stat_buf.st_mode & 0111) != 0))
- abfd->flags |= EXEC_P;
- }
-#endif /* STAT_FOR_EXEC */
-
- if (result)
- {
-#if 0 /* These should be set correctly anyways. */
- abfd->sections = obj_textsec (abfd);
- obj_textsec (abfd)->next = obj_datasec (abfd);
- obj_datasec (abfd)->next = obj_bsssec (abfd);
-#endif
- return result;
- }
-
- error_ret:
- bfd_release (abfd, rawptr);
- abfd->tdata.aout_data = oldrawptr;
- return NULL;
-}
-
-/*
-FUNCTION
- aout_@var{size}_mkobject
-
-SYNOPSIS
- bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
-
-DESCRIPTION
- Initialize BFD @var{abfd} for use with a.out files.
-*/
-
-bfd_boolean
-NAME(aout,mkobject) (abfd)
- bfd *abfd;
-{
- struct aout_data_struct *rawptr;
- bfd_size_type amt = sizeof (struct aout_data_struct);
-
- bfd_set_error (bfd_error_system_call);
-
- 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;
-
- return TRUE;
-}
-
-/*
-FUNCTION
- aout_@var{size}_machine_type
-
-SYNOPSIS
- enum machine_type aout_@var{size}_machine_type
- (enum bfd_architecture arch,
- unsigned long machine));
-
-DESCRIPTION
- Keep track of machine architecture and machine type for
- a.out's. Return the <<machine_type>> for a particular
- architecture and machine, or <<M_UNKNOWN>> if that exact architecture
- and machine can't be represented in a.out format.
-
- If the architecture is understood, machine type 0 (default)
- is always understood.
-*/
-
-enum machine_type
-NAME(aout,machine_type) (arch, machine, unknown)
- enum bfd_architecture arch;
- unsigned long machine;
- bfd_boolean *unknown;
-{
- enum machine_type arch_flags;
-
- arch_flags = M_UNKNOWN;
- *unknown = TRUE;
-
- switch (arch)
- {
- case bfd_arch_sparc:
- if (machine == 0
- || machine == bfd_mach_sparc
- || machine == bfd_mach_sparc_sparclite
- || machine == bfd_mach_sparc_sparclite_le
- || machine == bfd_mach_sparc_v9)
- arch_flags = M_SPARC;
- else if (machine == bfd_mach_sparc_sparclet)
- arch_flags = M_SPARCLET;
- break;
-
- case bfd_arch_m68k:
- switch (machine)
- {
- case 0: arch_flags = M_68010; break;
- case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = FALSE; break;
- case bfd_mach_m68010: arch_flags = M_68010; break;
- case bfd_mach_m68020: arch_flags = M_68020; break;
- default: arch_flags = M_UNKNOWN; break;
- }
- break;
-
- case bfd_arch_i386:
- if (machine == 0
- || machine == bfd_mach_i386_i386
- || machine == bfd_mach_i386_i386_intel_syntax)
- arch_flags = M_386;
- break;
-
- case bfd_arch_a29k:
- if (machine == 0)
- arch_flags = M_29K;
- break;
-
- case bfd_arch_arm:
- if (machine == 0)
- arch_flags = M_ARM;
- break;
-
- case bfd_arch_mips:
- switch (machine)
- {
- case 0:
- case bfd_mach_mips3000:
- case bfd_mach_mips3900:
- arch_flags = M_MIPS1;
- break;
- case bfd_mach_mips6000:
- arch_flags = M_MIPS2;
- break;
- case bfd_mach_mips4000:
- case bfd_mach_mips4010:
- case bfd_mach_mips4100:
- case bfd_mach_mips4300:
- case bfd_mach_mips4400:
- case bfd_mach_mips4600:
- case bfd_mach_mips4650:
- case bfd_mach_mips8000:
- case bfd_mach_mips10000:
- case bfd_mach_mips12000:
- case bfd_mach_mips16:
- case bfd_mach_mipsisa32:
- case bfd_mach_mipsisa32r2:
- case bfd_mach_mips5:
- case bfd_mach_mipsisa64:
- case bfd_mach_mipsisa64r2:
- case bfd_mach_mips_sb1:
- /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */
- arch_flags = M_MIPS2;
- break;
- default:
- arch_flags = M_UNKNOWN;
- break;
- }
- break;
-
- case bfd_arch_ns32k:
- switch (machine)
- {
- case 0: arch_flags = M_NS32532; break;
- case 32032: arch_flags = M_NS32032; break;
- case 32532: arch_flags = M_NS32532; break;
- default: arch_flags = M_UNKNOWN; break;
- }
- break;
-
- case bfd_arch_vax:
- *unknown = FALSE;
- break;
-
- case bfd_arch_cris:
- if (machine == 0 || machine == 255)
- arch_flags = M_CRIS;
- break;
-
- default:
- arch_flags = M_UNKNOWN;
- }
-
- if (arch_flags != M_UNKNOWN)
- *unknown = FALSE;
-
- return arch_flags;
-}
-
-/*
-FUNCTION
- aout_@var{size}_set_arch_mach
-
-SYNOPSIS
- bfd_boolean aout_@var{size}_set_arch_mach,
- (bfd *,
- enum bfd_architecture arch,
- unsigned long machine));
-
-DESCRIPTION
- Set the architecture and the machine of the BFD @var{abfd} to the
- values @var{arch} and @var{machine}. Verify that @var{abfd}'s format
- can support the architecture required.
-*/
-
-bfd_boolean
-NAME(aout,set_arch_mach) (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
-{
- if (! bfd_default_set_arch_mach (abfd, arch, machine))
- return FALSE;
-
- if (arch != bfd_arch_unknown)
- {
- bfd_boolean unknown;
-
- NAME(aout,machine_type) (arch, machine, &unknown);
- if (unknown)
- return FALSE;
- }
-
- /* Determine the size of a relocation entry. */
- switch (arch)
- {
- case bfd_arch_sparc:
- case bfd_arch_a29k:
- case bfd_arch_mips:
- obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
- break;
- default:
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- break;
- }
-
- return (*aout_backend_info (abfd)->set_sizes) (abfd);
-}
-
-static void
-adjust_o_magic (abfd, execp)
- bfd *abfd;
- struct internal_exec *execp;
-{
- file_ptr pos = adata (abfd).exec_bytes_size;
- bfd_vma vma = 0;
- int pad = 0;
-
- /* Text. */
- obj_textsec (abfd)->filepos = pos;
- if (!obj_textsec (abfd)->user_set_vma)
- obj_textsec (abfd)->vma = vma;
- else
- vma = obj_textsec (abfd)->vma;
-
- pos += obj_textsec (abfd)->_raw_size;
- vma += obj_textsec (abfd)->_raw_size;
-
- /* Data. */
- if (!obj_datasec (abfd)->user_set_vma)
- {
-#if 0 /* ?? Does alignment in the file image really matter? */
- pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma;
-#endif
- obj_textsec (abfd)->_raw_size += pad;
- pos += pad;
- vma += pad;
- obj_datasec (abfd)->vma = vma;
- }
- else
- vma = obj_datasec (abfd)->vma;
- obj_datasec (abfd)->filepos = pos;
- pos += obj_datasec (abfd)->_raw_size;
- vma += obj_datasec (abfd)->_raw_size;
-
- /* BSS. */
- if (!obj_bsssec (abfd)->user_set_vma)
- {
-#if 0
- pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
-#endif
- obj_datasec (abfd)->_raw_size += pad;
- pos += pad;
- vma += pad;
- obj_bsssec (abfd)->vma = vma;
- }
- else
- {
- /* The VMA of the .bss section is set by the VMA of the
- .data section plus the size of the .data section. We may
- need to add padding bytes to make this true. */
- pad = obj_bsssec (abfd)->vma - vma;
- if (pad > 0)
- {
- obj_datasec (abfd)->_raw_size += pad;
- pos += pad;
- }
- }
- obj_bsssec (abfd)->filepos = pos;
-
- /* Fix up the exec header. */
- execp->a_text = obj_textsec (abfd)->_raw_size;
- execp->a_data = obj_datasec (abfd)->_raw_size;
- execp->a_bss = obj_bsssec (abfd)->_raw_size;
- N_SET_MAGIC (*execp, OMAGIC);
-}
-
-static void
-adjust_z_magic (abfd, execp)
- bfd *abfd;
- struct internal_exec *execp;
-{
- bfd_size_type data_pad, text_pad;
- file_ptr text_end;
- const struct aout_backend_data *abdp;
- int ztih; /* Nonzero if text includes exec header. */
-
- abdp = aout_backend_info (abfd);
-
- /* Text. */
- ztih = (abdp != NULL
- && (abdp->text_includes_header
- || obj_aout_subformat (abfd) == q_magic_format));
- obj_textsec (abfd)->filepos = (ztih
- ? adata (abfd).exec_bytes_size
- : adata (abfd).zmagic_disk_block_size);
- if (! obj_textsec (abfd)->user_set_vma)
- {
- /* ?? Do we really need to check for relocs here? */
- obj_textsec (abfd)->vma = ((abfd->flags & HAS_RELOC)
- ? 0
- : (ztih
- ? (abdp->default_text_vma
- + adata (abfd).exec_bytes_size)
- : abdp->default_text_vma));
- text_pad = 0;
- }
- else
- {
- /* The .text section is being loaded at an unusual address. We
- may need to pad it such that the .data section starts at a page
- boundary. */
- if (ztih)
- text_pad = ((obj_textsec (abfd)->filepos - obj_textsec (abfd)->vma)
- & (adata (abfd).page_size - 1));
- else
- text_pad = ((- obj_textsec (abfd)->vma)
- & (adata (abfd).page_size - 1));
- }
-
- /* Find start of data. */
- if (ztih)
- {
- text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->_raw_size;
- text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
- }
- else
- {
- /* Note that if page_size == zmagic_disk_block_size, then
- filepos == page_size, and this case is the same as the ztih
- case. */
- text_end = obj_textsec (abfd)->_raw_size;
- text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
- text_end += obj_textsec (abfd)->filepos;
- }
- obj_textsec (abfd)->_raw_size += text_pad;
- text_end += text_pad;
-
- /* Data. */
- if (!obj_datasec (abfd)->user_set_vma)
- {
- bfd_vma vma;
- vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->_raw_size;
- obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
- }
- if (abdp && abdp->zmagic_mapped_contiguous)
- {
- asection * text = obj_textsec (abfd);
- asection * data = obj_datasec (abfd);
-
- text_pad = data->vma - (text->vma + text->_raw_size);
- /* Only pad the text section if the data
- section is going to be placed after it. */
- if (text_pad > 0)
- text->_raw_size += text_pad;
- }
- obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos
- + obj_textsec (abfd)->_raw_size);
-
- /* Fix up exec header while we're at it. */
- execp->a_text = obj_textsec (abfd)->_raw_size;
- if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
- execp->a_text += adata (abfd).exec_bytes_size;
- if (obj_aout_subformat (abfd) == q_magic_format)
- N_SET_MAGIC (*execp, QMAGIC);
- else
- N_SET_MAGIC (*execp, ZMAGIC);
-
- /* Spec says data section should be rounded up to page boundary. */
- obj_datasec (abfd)->_raw_size
- = align_power (obj_datasec (abfd)->_raw_size,
- obj_bsssec (abfd)->alignment_power);
- execp->a_data = BFD_ALIGN (obj_datasec (abfd)->_raw_size,
- adata (abfd).page_size);
- data_pad = execp->a_data - obj_datasec (abfd)->_raw_size;
-
- /* BSS. */
- if (!obj_bsssec (abfd)->user_set_vma)
- obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma
- + obj_datasec (abfd)->_raw_size);
- /* If the BSS immediately follows the data section and extra space
- in the page is left after the data section, fudge data
- in the header so that the bss section looks smaller by that
- amount. We'll start the bss section there, and lie to the OS.
- (Note that a linker script, as well as the above assignment,
- could have explicitly set the BSS vma to immediately follow
- the data section.) */
- if (align_power (obj_bsssec (abfd)->vma, obj_bsssec (abfd)->alignment_power)
- == obj_datasec (abfd)->vma + obj_datasec (abfd)->_raw_size)
- execp->a_bss = (data_pad > obj_bsssec (abfd)->_raw_size
- ? 0 : obj_bsssec (abfd)->_raw_size - data_pad);
- else
- execp->a_bss = obj_bsssec (abfd)->_raw_size;
-}
-
-static void
-adjust_n_magic (abfd, execp)
- bfd *abfd;
- struct internal_exec *execp;
-{
- file_ptr pos = adata (abfd).exec_bytes_size;
- bfd_vma vma = 0;
- int pad;
-
- /* Text. */
- obj_textsec (abfd)->filepos = pos;
- if (!obj_textsec (abfd)->user_set_vma)
- obj_textsec (abfd)->vma = vma;
- else
- vma = obj_textsec (abfd)->vma;
- pos += obj_textsec (abfd)->_raw_size;
- vma += obj_textsec (abfd)->_raw_size;
-
- /* Data. */
- obj_datasec (abfd)->filepos = pos;
- if (!obj_datasec (abfd)->user_set_vma)
- obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
- vma = obj_datasec (abfd)->vma;
-
- /* Since BSS follows data immediately, see if it needs alignment. */
- vma += obj_datasec (abfd)->_raw_size;
- pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
- obj_datasec (abfd)->_raw_size += pad;
- pos += obj_datasec (abfd)->_raw_size;
-
- /* BSS. */
- if (!obj_bsssec (abfd)->user_set_vma)
- obj_bsssec (abfd)->vma = vma;
- else
- vma = obj_bsssec (abfd)->vma;
-
- /* Fix up exec header. */
- execp->a_text = obj_textsec (abfd)->_raw_size;
- execp->a_data = obj_datasec (abfd)->_raw_size;
- execp->a_bss = obj_bsssec (abfd)->_raw_size;
- N_SET_MAGIC (*execp, NMAGIC);
-}
-
-bfd_boolean
-NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
- bfd *abfd;
- bfd_size_type *text_size;
- file_ptr *text_end ATTRIBUTE_UNUSED;
-{
- struct internal_exec *execp = exec_hdr (abfd);
-
- if (! NAME(aout,make_sections) (abfd))
- return FALSE;
-
- if (adata (abfd).magic != undecided_magic)
- return TRUE;
-
- obj_textsec (abfd)->_raw_size =
- align_power (obj_textsec (abfd)->_raw_size,
- obj_textsec (abfd)->alignment_power);
-
- *text_size = obj_textsec (abfd)->_raw_size;
- /* Rule (heuristic) for when to pad to a new page. Note that there
- are (at least) two ways demand-paged (ZMAGIC) files have been
- handled. Most Berkeley-based systems start the text segment at
- (TARGET_PAGE_SIZE). However, newer versions of SUNOS start the text
- segment right after the exec header; the latter is counted in the
- text segment size, and is paged in by the kernel with the rest of
- the text. */
-
- /* This perhaps isn't the right way to do this, but made it simpler for me
- to understand enough to implement it. Better would probably be to go
- right from BFD flags to alignment/positioning characteristics. But the
- old code was sloppy enough about handling the flags, and had enough
- other magic, that it was a little hard for me to understand. I think
- I understand it better now, but I haven't time to do the cleanup this
- minute. */
-
- if (abfd->flags & D_PAGED)
- /* Whether or not WP_TEXT is set -- let D_PAGED override. */
- adata (abfd).magic = z_magic;
- else if (abfd->flags & WP_TEXT)
- adata (abfd).magic = n_magic;
- else
- adata (abfd).magic = o_magic;
-
-#ifdef BFD_AOUT_DEBUG /* requires gcc2 */
-#if __GNUC__ >= 2
- fprintf (stderr, "%s text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x,%x>\n",
- ({ char *str;
- switch (adata (abfd).magic)
- {
- case n_magic: str = "NMAGIC"; break;
- case o_magic: str = "OMAGIC"; break;
- case z_magic: str = "ZMAGIC"; break;
- default: abort ();
- }
- str;
- }),
- obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size,
- obj_textsec (abfd)->alignment_power,
- obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size,
- obj_datasec (abfd)->alignment_power,
- obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size,
- obj_bsssec (abfd)->alignment_power);
-#endif
-#endif
-
- switch (adata (abfd).magic)
- {
- case o_magic:
- adjust_o_magic (abfd, execp);
- break;
- case z_magic:
- adjust_z_magic (abfd, execp);
- break;
- case n_magic:
- adjust_n_magic (abfd, execp);
- break;
- default:
- abort ();
- }
-
-#ifdef BFD_AOUT_DEBUG
- fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n",
- obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size,
- obj_textsec (abfd)->filepos,
- obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size,
- obj_datasec (abfd)->filepos,
- obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size);
-#endif
-
- return TRUE;
-}
-
-/*
-FUNCTION
- aout_@var{size}_new_section_hook
-
-SYNOPSIS
- bfd_boolean aout_@var{size}_new_section_hook,
- (bfd *abfd,
- asection *newsect));
-
-DESCRIPTION
- Called by the BFD in response to a @code{bfd_make_section}
- request.
-*/
-bfd_boolean
-NAME(aout,new_section_hook) (abfd, newsect)
- bfd *abfd;
- asection *newsect;
-{
- /* Align to double at least. */
- newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power;
-
- if (bfd_get_format (abfd) == bfd_object)
- {
- if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text"))
- {
- obj_textsec (abfd)= newsect;
- newsect->target_index = N_TEXT;
- return TRUE;
- }
-
- if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
- {
- obj_datasec (abfd) = newsect;
- newsect->target_index = N_DATA;
- return TRUE;
- }
-
- if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss"))
- {
- obj_bsssec (abfd) = newsect;
- newsect->target_index = N_BSS;
- return TRUE;
- }
- }
-
- /* We allow more than three sections internally. */
- return TRUE;
-}
-
-bfd_boolean
-NAME(aout,set_section_contents) (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- file_ptr text_end;
- bfd_size_type text_size;
-
- if (! abfd->output_has_begun)
- {
- if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end))
- return FALSE;
- }
-
- if (section == obj_bsssec (abfd))
- {
- bfd_set_error (bfd_error_no_contents);
- return FALSE;
- }
-
- if (section != obj_textsec (abfd)
- && section != obj_datasec (abfd))
- {
- if (aout_section_merge_with_text_p (abfd, section))
- section->filepos = obj_textsec (abfd)->filepos +
- (section->vma - obj_textsec (abfd)->vma);
- else
- {
- (*_bfd_error_handler)
- (_("%s: can not represent section `%s' in a.out object file format"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
- }
-
- if (count != 0)
- {
- if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Read the external symbols from an a.out file. */
-
-static bfd_boolean
-aout_get_external_symbols (abfd)
- bfd *abfd;
-{
- if (obj_aout_external_syms (abfd) == (struct external_nlist *) NULL)
- {
- bfd_size_type count;
- struct external_nlist *syms;
- bfd_size_type amt;
-
- count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
-
-#ifdef USE_MMAP
- if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
- exec_hdr (abfd)->a_syms,
- &obj_aout_sym_window (abfd), TRUE))
- return FALSE;
- syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
-#else
- /* We allocate using malloc to make the values easy to free
- later on. If we put them on the objalloc it might not be
- possible to free them. */
- syms = ((struct external_nlist *)
- bfd_malloc (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_bread (syms, amt, abfd) != amt)
- {
- free (syms);
- return FALSE;
- }
-#endif
-
- obj_aout_external_syms (abfd) = syms;
- obj_aout_external_sym_count (abfd) = count;
- }
-
- if (obj_aout_external_strings (abfd) == NULL
- && exec_hdr (abfd)->a_syms != 0)
- {
- 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_bread ((PTR) string_chars, amt, abfd) != amt)
- return FALSE;
- stringsize = GET_WORD (abfd, string_chars);
-
-#ifdef USE_MMAP
- if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
- &obj_aout_string_window (abfd), TRUE))
- return FALSE;
- strings = (char *) obj_aout_string_window (abfd).data;
-#else
- 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. */
- amt = stringsize - BYTES_IN_WORD;
- if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt)
- {
- free (strings);
- return FALSE;
- }
-#endif
-
- /* Ensure that a zero index yields an empty string. */
- strings[0] = '\0';
-
- strings[stringsize - 1] = 0;
-
- obj_aout_external_strings (abfd) = strings;
- obj_aout_external_string_size (abfd) = stringsize;
- }
-
- return TRUE;
-}
-
-/* Translate an a.out symbol into a BFD symbol. The desc, other, type
- and symbol->value fields of CACHE_PTR will be set from the a.out
- nlist structure. This function is responsible for setting
- symbol->flags and symbol->section, and adjusting symbol->value. */
-
-static bfd_boolean
-translate_from_native_sym_flags (abfd, cache_ptr)
- bfd *abfd;
- aout_symbol_type *cache_ptr;
-{
- flagword visible;
-
- if ((cache_ptr->type & N_STAB) != 0
- || cache_ptr->type == N_FN)
- {
- asection *sec;
-
- /* This is a debugging symbol. */
- cache_ptr->symbol.flags = BSF_DEBUGGING;
-
- /* Work out the symbol section. */
- switch (cache_ptr->type & N_TYPE)
- {
- case N_TEXT:
- case N_FN:
- sec = obj_textsec (abfd);
- break;
- case N_DATA:
- sec = obj_datasec (abfd);
- break;
- case N_BSS:
- sec = obj_bsssec (abfd);
- break;
- default:
- case N_ABS:
- sec = bfd_abs_section_ptr;
- break;
- }
-
- cache_ptr->symbol.section = sec;
- cache_ptr->symbol.value -= sec->vma;
-
- return TRUE;
- }
-
- /* Get the default visibility. This does not apply to all types, so
- we just hold it in a local variable to use if wanted. */
- if ((cache_ptr->type & N_EXT) == 0)
- visible = BSF_LOCAL;
- else
- visible = BSF_GLOBAL;
-
- switch (cache_ptr->type)
- {
- default:
- case N_ABS: case N_ABS | N_EXT:
- cache_ptr->symbol.section = bfd_abs_section_ptr;
- cache_ptr->symbol.flags = visible;
- break;
-
- case N_UNDF | N_EXT:
- if (cache_ptr->symbol.value != 0)
- {
- /* This is a common symbol. */
- cache_ptr->symbol.flags = BSF_GLOBAL;
- cache_ptr->symbol.section = bfd_com_section_ptr;
- }
- else
- {
- cache_ptr->symbol.flags = 0;
- cache_ptr->symbol.section = bfd_und_section_ptr;
- }
- break;
-
- case N_TEXT: case N_TEXT | N_EXT:
- cache_ptr->symbol.section = obj_textsec (abfd);
- cache_ptr->symbol.value -= cache_ptr->symbol.section->vma;
- cache_ptr->symbol.flags = visible;
- break;
-
- /* N_SETV symbols used to represent set vectors placed in the
- data section. They are no longer generated. Theoretically,
- it was possible to extract the entries and combine them with
- new ones, although I don't know if that was ever actually
- done. Unless that feature is restored, treat them as data
- symbols. */
- case N_SETV: case N_SETV | N_EXT:
- case N_DATA: case N_DATA | N_EXT:
- cache_ptr->symbol.section = obj_datasec (abfd);
- cache_ptr->symbol.value -= cache_ptr->symbol.section->vma;
- cache_ptr->symbol.flags = visible;
- break;
-
- case N_BSS: case N_BSS | N_EXT:
- cache_ptr->symbol.section = obj_bsssec (abfd);
- cache_ptr->symbol.value -= cache_ptr->symbol.section->vma;
- cache_ptr->symbol.flags = visible;
- break;
-
- case N_SETA: case N_SETA | N_EXT:
- case N_SETT: case N_SETT | N_EXT:
- case N_SETD: case N_SETD | N_EXT:
- case N_SETB: case N_SETB | N_EXT:
- {
- /* This code is no longer needed. It used to be used to make
- the linker handle set symbols, but they are now handled in
- the add_symbols routine instead. */
-#if 0
- 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
- is the value to add to the set. We create a section with
- the same name as the symbol, and add a reloc to insert the
- appropriate value into the section.
-
- This action is actually obsolete; it used to make the
- linker do the right thing, but the linker no longer uses
- this function. */
-
- section = bfd_get_section_by_name (abfd, cache_ptr->symbol.name);
- if (section == NULL)
- {
- char *copy;
-
- amt = strlen (cache_ptr->symbol.name) + 1;
- copy = bfd_alloc (abfd, amt);
- if (copy == NULL)
- return FALSE;
-
- strcpy (copy, cache_ptr->symbol.name);
- section = bfd_make_section (abfd, copy);
- if (section == NULL)
- return FALSE;
- }
-
- amt = sizeof (arelent_chain);
- reloc = (arelent_chain *) bfd_alloc (abfd, amt);
- if (reloc == NULL)
- return FALSE;
-
- /* Build a relocation entry for the constructor. */
- switch (cache_ptr->type & N_TYPE)
- {
- case N_SETA:
- into_section = bfd_abs_section_ptr;
- cache_ptr->type = N_ABS;
- break;
- case N_SETT:
- into_section = obj_textsec (abfd);
- cache_ptr->type = N_TEXT;
- break;
- case N_SETD:
- into_section = obj_datasec (abfd);
- cache_ptr->type = N_DATA;
- break;
- case N_SETB:
- into_section = obj_bsssec (abfd);
- cache_ptr->type = N_BSS;
- break;
- }
-
- /* Build a relocation pointing into the constructor section
- pointing at the symbol in the set vector specified. */
- reloc->relent.addend = cache_ptr->symbol.value;
- cache_ptr->symbol.section = into_section;
- reloc->relent.sym_ptr_ptr = into_section->symbol_ptr_ptr;
-
- /* We modify the symbol to belong to a section depending upon
- the name of the symbol, and add to the size of the section
- to contain a pointer to the symbol. Build a reloc entry to
- relocate to this symbol attached to this section. */
- section->flags = SEC_CONSTRUCTOR | SEC_RELOC;
-
- section->reloc_count++;
- section->alignment_power = 2;
-
- reloc->next = section->constructor_chain;
- section->constructor_chain = reloc;
- reloc->relent.address = section->_raw_size;
- section->_raw_size += BYTES_IN_WORD;
-
- reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd);
-
-#endif /* 0 */
-
- switch (cache_ptr->type & N_TYPE)
- {
- case N_SETA:
- cache_ptr->symbol.section = bfd_abs_section_ptr;
- break;
- case N_SETT:
- cache_ptr->symbol.section = obj_textsec (abfd);
- break;
- case N_SETD:
- cache_ptr->symbol.section = obj_datasec (abfd);
- break;
- case N_SETB:
- cache_ptr->symbol.section = obj_bsssec (abfd);
- break;
- }
-
- cache_ptr->symbol.flags |= BSF_CONSTRUCTOR;
- }
- break;
-
- case N_WARNING:
- /* This symbol is the text of a warning message. The next
- symbol is the symbol to associate the warning with. If a
- reference is made to that symbol, a warning is issued. */
- cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING;
- cache_ptr->symbol.section = bfd_abs_section_ptr;
- break;
-
- case N_INDR: case N_INDR | N_EXT:
- /* An indirect symbol. This consists of two symbols in a row.
- The first symbol is the name of the indirection. The second
- symbol is the name of the target. A reference to the first
- symbol becomes a reference to the second. */
- cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_INDIRECT | visible;
- cache_ptr->symbol.section = bfd_ind_section_ptr;
- break;
-
- case N_WEAKU:
- cache_ptr->symbol.section = bfd_und_section_ptr;
- cache_ptr->symbol.flags = BSF_WEAK;
- break;
-
- case N_WEAKA:
- cache_ptr->symbol.section = bfd_abs_section_ptr;
- cache_ptr->symbol.flags = BSF_WEAK;
- break;
-
- case N_WEAKT:
- cache_ptr->symbol.section = obj_textsec (abfd);
- cache_ptr->symbol.value -= cache_ptr->symbol.section->vma;
- cache_ptr->symbol.flags = BSF_WEAK;
- break;
-
- case N_WEAKD:
- cache_ptr->symbol.section = obj_datasec (abfd);
- cache_ptr->symbol.value -= cache_ptr->symbol.section->vma;
- cache_ptr->symbol.flags = BSF_WEAK;
- break;
-
- case N_WEAKB:
- cache_ptr->symbol.section = obj_bsssec (abfd);
- cache_ptr->symbol.value -= cache_ptr->symbol.section->vma;
- cache_ptr->symbol.flags = BSF_WEAK;
- break;
- }
-
- return TRUE;
-}
-
-/* Set the fields of SYM_POINTER according to CACHE_PTR. */
-
-static bfd_boolean
-translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
- bfd *abfd;
- asymbol *cache_ptr;
- struct external_nlist *sym_pointer;
-{
- bfd_vma value = cache_ptr->value;
- asection *sec;
- bfd_vma off;
-
- /* Mask out any existing type bits in case copying from one section
- to another. */
- sym_pointer->e_type[0] &= ~N_TYPE;
-
- sec = bfd_get_section (cache_ptr);
- off = 0;
-
- if (sec == NULL)
- {
- /* This case occurs, e.g., for the *DEBUG* section of a COFF
- file. */
- (*_bfd_error_handler)
- (_("%s: can not represent section for symbol `%s' in a.out object file format"),
- bfd_get_filename (abfd),
- cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*"));
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
-
- if (sec->output_section != NULL)
- {
- off = sec->output_offset;
- sec = sec->output_section;
- }
-
- if (bfd_is_abs_section (sec))
- sym_pointer->e_type[0] |= N_ABS;
- else if (sec == obj_textsec (abfd))
- sym_pointer->e_type[0] |= N_TEXT;
- else if (sec == obj_datasec (abfd))
- sym_pointer->e_type[0] |= N_DATA;
- else if (sec == obj_bsssec (abfd))
- sym_pointer->e_type[0] |= N_BSS;
- else if (bfd_is_und_section (sec))
- sym_pointer->e_type[0] = N_UNDF | N_EXT;
- else if (bfd_is_ind_section (sec))
- sym_pointer->e_type[0] = N_INDR;
- else if (bfd_is_com_section (sec))
- sym_pointer->e_type[0] = N_UNDF | N_EXT;
- else
- {
- if (aout_section_merge_with_text_p (abfd, sec))
- sym_pointer->e_type[0] |= N_TEXT;
- else
- {
- (*_bfd_error_handler)
- (_("%s: can not represent section `%s' in a.out object file format"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
- }
-
- /* Turn the symbol from section relative to absolute again. */
- value += sec->vma + off;
-
- if ((cache_ptr->flags & BSF_WARNING) != 0)
- sym_pointer->e_type[0] = N_WARNING;
-
- if ((cache_ptr->flags & BSF_DEBUGGING) != 0)
- sym_pointer->e_type[0] = ((aout_symbol_type *) cache_ptr)->type;
- else if ((cache_ptr->flags & BSF_GLOBAL) != 0)
- sym_pointer->e_type[0] |= N_EXT;
- else if ((cache_ptr->flags & BSF_LOCAL) != 0)
- sym_pointer->e_type[0] &= ~N_EXT;
-
- if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0)
- {
- int type = ((aout_symbol_type *) cache_ptr)->type;
-
- switch (type)
- {
- case N_ABS: type = N_SETA; break;
- case N_TEXT: type = N_SETT; break;
- case N_DATA: type = N_SETD; break;
- case N_BSS: type = N_SETB; break;
- }
- sym_pointer->e_type[0] = type;
- }
-
- if ((cache_ptr->flags & BSF_WEAK) != 0)
- {
- int type;
-
- switch (sym_pointer->e_type[0] & N_TYPE)
- {
- default:
- case N_ABS: type = N_WEAKA; break;
- case N_TEXT: type = N_WEAKT; break;
- case N_DATA: type = N_WEAKD; break;
- case N_BSS: type = N_WEAKB; break;
- case N_UNDF: type = N_WEAKU; break;
- }
- sym_pointer->e_type[0] = type;
- }
-
- PUT_WORD (abfd, value, sym_pointer->e_value);
-
- return TRUE;
-}
-
-/* Native-level interface to symbols. */
-
-asymbol *
-NAME(aout,make_empty_symbol) (abfd)
- bfd *abfd;
-{
- 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;
-
- return &new->symbol;
-}
-
-/* Translate a set of internal symbols into external symbols. */
-
-bfd_boolean
-NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
- bfd *abfd;
- aout_symbol_type *in;
- struct external_nlist *ext;
- bfd_size_type count;
- char *str;
- bfd_size_type strsize;
- bfd_boolean dynamic;
-{
- struct external_nlist *ext_end;
-
- ext_end = ext + count;
- for (; ext < ext_end; ext++, in++)
- {
- bfd_vma x;
-
- x = GET_WORD (abfd, ext->e_strx);
- in->symbol.the_bfd = abfd;
-
- /* For the normal symbols, the zero index points at the number
- of bytes in the string table but is to be interpreted as the
- null string. For the dynamic symbols, the number of bytes in
- the string table is stored in the __DYNAMIC structure and the
- zero index points at an actual string. */
- if (x == 0 && ! dynamic)
- in->symbol.name = "";
- else if (x < strsize)
- in->symbol.name = str + x;
- else
- return FALSE;
-
- in->symbol.value = GET_SWORD (abfd, ext->e_value);
- 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))
- return FALSE;
-
- if (dynamic)
- in->symbol.flags |= BSF_DYNAMIC;
- }
-
- return TRUE;
-}
-
-/* We read the symbols into a buffer, which is discarded when this
- function exits. We read the strings into a buffer large enough to
- hold them all plus all the cached symbol entries. */
-
-bfd_boolean
-NAME(aout,slurp_symbol_table) (abfd)
- bfd *abfd;
-{
- struct external_nlist *old_external_syms;
- aout_symbol_type *cached;
- 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)
- return TRUE;
-
- old_external_syms = obj_aout_external_syms (abfd);
-
- if (! aout_get_external_symbols (abfd))
- return FALSE;
-
- cached_size = obj_aout_external_sym_count (abfd);
- cached_size *= sizeof (aout_symbol_type);
- cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
- if (cached == NULL && cached_size != 0)
- return FALSE;
-
- /* Convert from external symbol information to internal. */
- if (! (NAME(aout,translate_symbol_table)
- (abfd, cached,
- obj_aout_external_syms (abfd),
- obj_aout_external_sym_count (abfd),
- obj_aout_external_strings (abfd),
- obj_aout_external_string_size (abfd),
- FALSE)))
- {
- free (cached);
- return FALSE;
- }
-
- bfd_get_symcount (abfd) = obj_aout_external_sym_count (abfd);
-
- obj_aout_symbols (abfd) = cached;
-
- /* It is very likely that anybody who calls this function will not
- want the external symbol information, so if it was allocated
- because of our call to aout_get_external_symbols, we free it up
- right away to save space. */
- if (old_external_syms == (struct external_nlist *) NULL
- && obj_aout_external_syms (abfd) != (struct external_nlist *) NULL)
- {
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_sym_window (abfd));
-#else
- free (obj_aout_external_syms (abfd));
-#endif
- obj_aout_external_syms (abfd) = NULL;
- }
-
- return TRUE;
-}
-
-/* We use a hash table when writing out symbols so that we only write
- out a particular string once. This helps particularly when the
- linker writes out stabs debugging entries, because each different
- contributing object file tends to have many duplicate stabs
- strings.
-
- This hash table code breaks dbx on SunOS 4.1.3, so we don't do it
- if BFD_TRADITIONAL_FORMAT is set. */
-
-static bfd_size_type add_to_stringtab
- PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, bfd_boolean));
-static bfd_boolean emit_stringtab
- PARAMS ((bfd *, struct bfd_strtab_hash *));
-
-/* Get the index of a string in a strtab, adding it if it is not
- already present. */
-
-static INLINE bfd_size_type
-add_to_stringtab (abfd, tab, str, copy)
- bfd *abfd;
- struct bfd_strtab_hash *tab;
- const char *str;
- bfd_boolean copy;
-{
- bfd_boolean hash;
- bfd_size_type index;
-
- /* An index of 0 always means the empty string. */
- if (str == 0 || *str == '\0')
- return 0;
-
- /* Don't hash if BFD_TRADITIONAL_FORMAT is set, because SunOS dbx
- doesn't understand a hashed string table. */
- hash = TRUE;
- if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = FALSE;
-
- index = _bfd_stringtab_add (tab, str, hash, copy);
-
- if (index != (bfd_size_type) -1)
- {
- /* Add BYTES_IN_WORD to the return value to account for the
- space taken up by the string table size. */
- index += BYTES_IN_WORD;
- }
-
- return index;
-}
-
-/* Write out a strtab. ABFD is already at the right location in the
- file. */
-
-static bfd_boolean
-emit_stringtab (abfd, tab)
- register bfd *abfd;
- 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_bwrite ((PTR) buffer, amt, abfd) != amt)
- return FALSE;
-
- return _bfd_stringtab_emit (abfd, tab);
-}
-
-bfd_boolean
-NAME(aout,write_syms) (abfd)
- bfd *abfd;
-{
- unsigned int count ;
- asymbol **generic = bfd_get_outsymbols (abfd);
- struct bfd_strtab_hash *strtab;
-
- strtab = _bfd_stringtab_init ();
- if (strtab == NULL)
- return FALSE;
-
- for (count = 0; count < bfd_get_symcount (abfd); count++)
- {
- asymbol *g = generic[count];
- bfd_size_type indx;
- struct external_nlist nsp;
- bfd_size_type amt;
-
- indx = add_to_stringtab (abfd, strtab, g->name, FALSE);
- if (indx == (bfd_size_type) -1)
- goto error_return;
- PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx);
-
- if (bfd_asymbol_flavour (g) == abfd->xvec->flavour)
- {
- 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
- {
- 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;
-
- 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
- here, at the end. */
- g->KEEPIT = count;
- }
-
- if (! emit_stringtab (abfd, strtab))
- goto error_return;
-
- _bfd_stringtab_free (strtab);
-
- return TRUE;
-
-error_return:
- _bfd_stringtab_free (strtab);
- return FALSE;
-}
-
-long
-NAME(aout,canonicalize_symtab) (abfd, location)
- bfd *abfd;
- asymbol **location;
-{
- unsigned int counter = 0;
- aout_symbol_type *symbase;
-
- if (!NAME(aout,slurp_symbol_table) (abfd))
- return -1;
-
- for (symbase = obj_aout_symbols (abfd);
- counter++ < bfd_get_symcount (abfd);
- )
- *(location++) = (asymbol *) (symbase++);
- *location++ =0;
- return bfd_get_symcount (abfd);
-}
-
-/* Standard reloc stuff. */
-/* Output standard relocation information to a file in target byte order. */
-
-extern void NAME(aout,swap_std_reloc_out)
- PARAMS ((bfd *, arelent *, struct reloc_std_external *));
-
-void
-NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
- bfd *abfd;
- arelent *g;
- struct reloc_std_external *natptr;
-{
- int r_index;
- asymbol *sym = *(g->sym_ptr_ptr);
- int r_extern;
- unsigned int r_length;
- int r_pcrel;
- int r_baserel, r_jmptable, r_relative;
- asection *output_section = sym->section->output_section;
-
- PUT_WORD (abfd, g->address, natptr->r_address);
-
- r_length = g->howto->size ; /* Size as a power of two. */
- r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
- /* XXX This relies on relocs coming from a.out files. */
- r_baserel = (g->howto->type & 8) != 0;
- r_jmptable = (g->howto->type & 16) != 0;
- r_relative = (g->howto->type & 32) != 0;
-
-#if 0
- /* For a standard reloc, the addend is in the object file. */
- r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
-#endif
-
- /* Name was clobbered by aout_write_syms to be symbol index. */
-
- /* If this relocation is relative to a symbol then set the
- r_index to the symbols index, and the r_extern bit.
-
- Absolute symbols can come in in two ways, either as an offset
- from the abs section, or as a symbol which has an abs value.
- check for that here. */
-
- if (bfd_is_com_section (output_section)
- || bfd_is_abs_section (output_section)
- || bfd_is_und_section (output_section))
- {
- if (bfd_abs_section_ptr->symbol == sym)
- {
- /* Whoops, looked like an abs symbol, but is
- really an offset from the abs section. */
- r_index = N_ABS;
- r_extern = 0;
- }
- else
- {
- /* Fill in symbol. */
- r_extern = 1;
- r_index = (*(g->sym_ptr_ptr))->KEEPIT;
- }
- }
- else
- {
- /* Just an ordinary section. */
- r_extern = 0;
- r_index = output_section->target_index;
- }
-
- /* Now the fun stuff. */
- if (bfd_header_big_endian (abfd))
- {
- natptr->r_index[0] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[2] = r_index;
- natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0)
- | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0)
- | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0)
- | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
- }
- else
- {
- natptr->r_index[2] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[0] = r_index;
- natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0)
- | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0)
- | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0)
- | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
- }
-}
-
-/* Extended stuff. */
-/* Output extended relocation information to a file in target byte order. */
-
-extern void NAME(aout,swap_ext_reloc_out)
- PARAMS ((bfd *, arelent *, struct reloc_ext_external *));
-
-void
-NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
- bfd *abfd;
- arelent *g;
- register struct reloc_ext_external *natptr;
-{
- int r_index;
- int r_extern;
- unsigned int r_type;
- bfd_vma r_addend;
- asymbol *sym = *(g->sym_ptr_ptr);
- asection *output_section = sym->section->output_section;
-
- PUT_WORD (abfd, g->address, natptr->r_address);
-
- r_type = (unsigned int) g->howto->type;
-
- r_addend = g->addend;
- if ((sym->flags & BSF_SECTION_SYM) != 0)
- r_addend += (*(g->sym_ptr_ptr))->section->output_section->vma;
-
- /* If this relocation is relative to a symbol then set the
- r_index to the symbols index, and the r_extern bit.
-
- Absolute symbols can come in in two ways, either as an offset
- from the abs section, or as a symbol which has an abs value.
- check for that here. */
- if (bfd_is_abs_section (bfd_get_section (sym)))
- {
- r_extern = 0;
- r_index = N_ABS;
- }
- else if ((sym->flags & BSF_SECTION_SYM) == 0)
- {
- if (bfd_is_und_section (bfd_get_section (sym))
- || (sym->flags & BSF_GLOBAL) != 0)
- r_extern = 1;
- else
- r_extern = 0;
- r_index = (*(g->sym_ptr_ptr))->KEEPIT;
- }
- else
- {
- /* Just an ordinary section. */
- r_extern = 0;
- r_index = output_section->target_index;
- }
-
- /* Now the fun stuff. */
- if (bfd_header_big_endian (abfd))
- {
- natptr->r_index[0] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[2] = r_index;
- natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0)
- | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG));
- }
- else
- {
- natptr->r_index[2] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[0] = r_index;
- natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0)
- | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE));
- }
-
- PUT_WORD (abfd, r_addend, natptr->r_addend);
-}
-
-/* BFD deals internally with all things based from the section they're
- in. so, something in 10 bytes into a text section with a base of
- 50 would have a symbol (.text+10) and know .text vma was 50.
-
- Aout keeps all it's symbols based from zero, so the symbol would
- contain 60. This macro subs the base of each section from the value
- to give the true offset from the section. */
-
-#define MOVE_ADDRESS(ad) \
- if (r_extern) \
- { \
- /* Undefined symbol. */ \
- cache_ptr->sym_ptr_ptr = symbols + r_index; \
- cache_ptr->addend = ad; \
- } \
- else \
- { \
- /* Defined, section relative. Replace symbol with pointer to \
- symbol which points to section. */ \
- switch (r_index) \
- { \
- case N_TEXT: \
- case N_TEXT | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->textsec->vma; \
- break; \
- case N_DATA: \
- case N_DATA | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->datasec->vma; \
- break; \
- case N_BSS: \
- case N_BSS | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->bsssec->vma; \
- break; \
- default: \
- case N_ABS: \
- case N_ABS | N_EXT: \
- cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \
- cache_ptr->addend = ad; \
- break; \
- } \
- }
-
-void
-NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
- bfd *abfd;
- struct reloc_ext_external *bytes;
- arelent *cache_ptr;
- asymbol **symbols;
- bfd_size_type symcount;
-{
- unsigned int r_index;
- int r_extern;
- unsigned int r_type;
- struct aoutdata *su = &(abfd->tdata.aout_data->a);
-
- cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
-
- /* Now the fun stuff. */
- if (bfd_header_big_endian (abfd))
- {
- r_index = (((unsigned int) bytes->r_index[0] << 16)
- | ((unsigned int) bytes->r_index[1] << 8)
- | bytes->r_index[2]);
- r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
- r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
- >> RELOC_EXT_BITS_TYPE_SH_BIG);
- }
- else
- {
- r_index = (((unsigned int) bytes->r_index[2] << 16)
- | ((unsigned int) bytes->r_index[1] << 8)
- | bytes->r_index[0]);
- r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
- r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
- >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
- }
-
- cache_ptr->howto = howto_table_ext + r_type;
-
- /* Base relative relocs are always against the symbol table,
- regardless of the setting of r_extern. r_extern just reflects
- whether the symbol the reloc is against is local or global. */
- if (r_type == (unsigned int) RELOC_BASE10
- || r_type == (unsigned int) RELOC_BASE13
- || r_type == (unsigned int) RELOC_BASE22)
- r_extern = 1;
-
- if (r_extern && r_index > symcount)
- {
- /* We could arrange to return an error, but it might be useful
- to see the file even if it is bad. */
- r_extern = 0;
- r_index = N_ABS;
- }
-
- MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend));
-}
-
-void
-NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
- bfd *abfd;
- struct reloc_std_external *bytes;
- arelent *cache_ptr;
- asymbol **symbols;
- bfd_size_type symcount;
-{
- unsigned int r_index;
- int r_extern;
- unsigned int r_length;
- int r_pcrel;
- int r_baserel, r_jmptable, r_relative;
- struct aoutdata *su = &(abfd->tdata.aout_data->a);
- unsigned int howto_idx;
-
- cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
-
- /* Now the fun stuff. */
- if (bfd_header_big_endian (abfd))
- {
- r_index = (((unsigned int) bytes->r_index[0] << 16)
- | ((unsigned int) bytes->r_index[1] << 8)
- | bytes->r_index[2]);
- r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
- r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
- r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
- r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG));
- r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG));
- r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
- >> RELOC_STD_BITS_LENGTH_SH_BIG);
- }
- else
- {
- r_index = (((unsigned int) bytes->r_index[2] << 16)
- | ((unsigned int) bytes->r_index[1] << 8)
- | bytes->r_index[0]);
- r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
- r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
- r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE));
- r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE));
- r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE));
- r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
- >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
- }
-
- howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel
- + 16 * r_jmptable + 32 * r_relative);
- BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std));
- cache_ptr->howto = howto_table_std + howto_idx;
- BFD_ASSERT (cache_ptr->howto->type != (unsigned int) -1);
-
- /* Base relative relocs are always against the symbol table,
- regardless of the setting of r_extern. r_extern just reflects
- whether the symbol the reloc is against is local or global. */
- if (r_baserel)
- r_extern = 1;
-
- if (r_extern && r_index > symcount)
- {
- /* We could arrange to return an error, but it might be useful
- to see the file even if it is bad. */
- r_extern = 0;
- r_index = N_ABS;
- }
-
- MOVE_ADDRESS (0);
-}
-
-/* Read and swap the relocs for a section. */
-
-bfd_boolean
-NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
- bfd *abfd;
- sec_ptr asect;
- asymbol **symbols;
-{
- 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;
-
- if (asect->flags & SEC_CONSTRUCTOR)
- return TRUE;
-
- if (asect == obj_datasec (abfd))
- reloc_size = exec_hdr (abfd)->a_drsize;
- else if (asect == obj_textsec (abfd))
- reloc_size = exec_hdr (abfd)->a_trsize;
- else if (asect == obj_bsssec (abfd))
- reloc_size = 0;
- else
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
- return FALSE;
-
- each_size = obj_reloc_entry_size (abfd);
-
- count = reloc_size / each_size;
-
- amt = count * sizeof (arelent);
- reloc_cache = (arelent *) bfd_zmalloc (amt);
- if (reloc_cache == NULL && count != 0)
- return FALSE;
-
- relocs = bfd_malloc (reloc_size);
- if (relocs == NULL && reloc_size != 0)
- {
- free (reloc_cache);
- return FALSE;
- }
-
- if (bfd_bread (relocs, reloc_size, abfd) != reloc_size)
- {
- free (relocs);
- free (reloc_cache);
- return FALSE;
- }
-
- cache_ptr = reloc_cache;
- if (each_size == RELOC_EXT_SIZE)
- {
- 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_size_type) bfd_get_symcount (abfd));
- }
- else
- {
- 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_size_type) bfd_get_symcount (abfd));
- }
-
- free (relocs);
-
- asect->relocation = reloc_cache;
- asect->reloc_count = cache_ptr - reloc_cache;
-
- return TRUE;
-}
-
-/* Write out a relocation section into an object file. */
-
-bfd_boolean
-NAME(aout,squirt_out_relocs) (abfd, section)
- bfd *abfd;
- asection *section;
-{
- arelent **generic;
- unsigned char *native, *natptr;
- size_t each_size;
-
- unsigned int count = section->reloc_count;
- bfd_size_type natsize;
-
- if (count == 0 || section->orelocation == NULL)
- return TRUE;
-
- each_size = obj_reloc_entry_size (abfd);
- natsize = (bfd_size_type) each_size * count;
- native = (unsigned char *) bfd_zalloc (abfd, natsize);
- if (!native)
- return FALSE;
-
- generic = section->orelocation;
-
- if (each_size == RELOC_EXT_SIZE)
- {
- for (natptr = native;
- count != 0;
- --count, natptr += each_size, ++generic)
- MY_swap_ext_reloc_out (abfd, *generic,
- (struct reloc_ext_external *) natptr);
- }
- else
- {
- for (natptr = native;
- count != 0;
- --count, natptr += each_size, ++generic)
- MY_swap_std_reloc_out (abfd, *generic,
- (struct reloc_std_external *) natptr);
- }
-
- if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
- {
- bfd_release (abfd, native);
- return FALSE;
- }
- bfd_release (abfd, native);
-
- return TRUE;
-}
-
-/* This is stupid. This function should be a boolean predicate. */
-
-long
-NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
-{
- arelent *tblptr = section->relocation;
- unsigned int count;
-
- if (section == obj_bsssec (abfd))
- {
- *relptr = NULL;
- return 0;
- }
-
- if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols)))
- return -1;
-
- if (section->flags & SEC_CONSTRUCTOR)
- {
- arelent_chain *chain = section->constructor_chain;
- for (count = 0; count < section->reloc_count; count ++)
- {
- *relptr ++ = &chain->relent;
- chain = chain->next;
- }
- }
- else
- {
- tblptr = section->relocation;
-
- for (count = 0; count++ < section->reloc_count; )
- {
- *relptr++ = tblptr++;
- }
- }
- *relptr = 0;
-
- return section->reloc_count;
-}
-
-long
-NAME(aout,get_reloc_upper_bound) (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
-{
- if (bfd_get_format (abfd) != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- if (asect->flags & SEC_CONSTRUCTOR)
- return (sizeof (arelent *) * (asect->reloc_count+1));
-
- if (asect == obj_datasec (abfd))
- return (sizeof (arelent *)
- * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd))
- + 1));
-
- if (asect == obj_textsec (abfd))
- return (sizeof (arelent *)
- * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd))
- + 1));
-
- if (asect == obj_bsssec (abfd))
- return sizeof (arelent *);
-
- if (asect == obj_bsssec (abfd))
- return 0;
-
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
-}
-
-long
-NAME(aout,get_symtab_upper_bound) (abfd)
- bfd *abfd;
-{
- if (!NAME(aout,slurp_symbol_table) (abfd))
- return -1;
-
- return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
-}
-
-alent *
-NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *ignore_symbol ATTRIBUTE_UNUSED;
-{
- return (alent *)NULL;
-}
-
-void
-NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
-
- if (ret->type == '?')
- {
- int type_code = aout_symbol (symbol)->type & 0xff;
- const char *stab_name = bfd_get_stab_name (type_code);
- static char buf[10];
-
- if (stab_name == NULL)
- {
- sprintf (buf, "(%d)", type_code);
- stab_name = buf;
- }
- ret->type = '-';
- ret->stab_type = type_code;
- ret->stab_other = (unsigned) (aout_symbol (symbol)->other & 0xff);
- ret->stab_desc = (unsigned) (aout_symbol (symbol)->desc & 0xffff);
- ret->stab_name = stab_name;
- }
-}
-
-void
-NAME(aout,print_symbol) (abfd, afile, symbol, how)
- bfd *abfd;
- PTR afile;
- asymbol *symbol;
- bfd_print_symbol_type how;
-{
- FILE *file = (FILE *)afile;
-
- switch (how)
- {
- case bfd_print_symbol_name:
- if (symbol->name)
- fprintf (file,"%s", symbol->name);
- break;
- case bfd_print_symbol_more:
- fprintf (file,"%4x %2x %2x",
- (unsigned) (aout_symbol (symbol)->desc & 0xffff),
- (unsigned) (aout_symbol (symbol)->other & 0xff),
- (unsigned) (aout_symbol (symbol)->type));
- break;
- case bfd_print_symbol_all:
- {
- const char *section_name = symbol->section->name;
-
- bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
-
- fprintf (file," %-5s %04x %02x %02x",
- section_name,
- (unsigned) (aout_symbol (symbol)->desc & 0xffff),
- (unsigned) (aout_symbol (symbol)->other & 0xff),
- (unsigned) (aout_symbol (symbol)->type & 0xff));
- if (symbol->name)
- fprintf (file," %s", symbol->name);
- }
- break;
- }
-}
-
-/* If we don't have to allocate more than 1MB to hold the generic
- symbols, we use the generic minisymbol methord: it's faster, since
- it only translates the symbols once, not multiple times. */
-#define MINISYM_THRESHOLD (1000000 / sizeof (asymbol))
-
-/* Read minisymbols. For minisymbols, we use the unmodified a.out
- symbols. The minisymbol_to_symbol function translates these into
- BFD asymbol structures. */
-
-long
-NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
- bfd *abfd;
- bfd_boolean dynamic;
- PTR *minisymsp;
- unsigned int *sizep;
-{
- if (dynamic)
- {
- /* We could handle the dynamic symbols here as well, but it's
- easier to hand them off. */
- return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
- }
-
- if (! aout_get_external_symbols (abfd))
- return -1;
-
- if (obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD)
- return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
-
- *minisymsp = (PTR) obj_aout_external_syms (abfd);
-
- /* By passing the external symbols back from this routine, we are
- giving up control over the memory block. Clear
- obj_aout_external_syms, so that we do not try to free it
- ourselves. */
- obj_aout_external_syms (abfd) = NULL;
-
- *sizep = EXTERNAL_NLIST_SIZE;
- return obj_aout_external_sym_count (abfd);
-}
-
-/* Convert a minisymbol to a BFD asymbol. A minisymbol is just an
- unmodified a.out symbol. The SYM argument is a structure returned
- by bfd_make_empty_symbol, which we fill in here. */
-
-asymbol *
-NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
- bfd *abfd;
- bfd_boolean dynamic;
- const PTR minisym;
- asymbol *sym;
-{
- if (dynamic
- || obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD)
- return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym);
-
- memset (sym, 0, sizeof (aout_symbol_type));
-
- /* We call translate_symbol_table to translate a single symbol. */
- if (! (NAME(aout,translate_symbol_table)
- (abfd,
- (aout_symbol_type *) sym,
- (struct external_nlist *) minisym,
- (bfd_size_type) 1,
- obj_aout_external_strings (abfd),
- obj_aout_external_string_size (abfd),
- FALSE)))
- return NULL;
-
- return sym;
-}
-
-/* Provided a BFD, a section and an offset into the section, calculate
- and return the name of the source file and the line nearest to the
- wanted location. */
-
-bfd_boolean
-NAME(aout,find_nearest_line)
- (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *line_ptr;
-{
- /* 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. */
- bfd_vma low_line_vma = 0;
- bfd_vma low_func_vma = 0;
- asymbol *func = 0;
- bfd_size_type filelen, funclen;
- char *buf;
-
- *filename_ptr = abfd->filename;
- *functionname_ptr = 0;
- *line_ptr = 0;
-
- if (symbols != (asymbol **)NULL)
- {
- for (p = symbols; *p; p++)
- {
- aout_symbol_type *q = (aout_symbol_type *) (*p);
- next:
- switch (q->type)
- {
- case N_TEXT:
- /* If this looks like a file name symbol, and it comes after
- the line number we have found so far, but before the
- offset, then we have probably not found the right line
- number. */
- if (q->symbol.value <= offset
- && ((q->symbol.value > low_line_vma
- && (line_file_name != NULL
- || *line_ptr != 0))
- || (q->symbol.value > low_func_vma
- && func != NULL)))
- {
- const char *symname;
-
- symname = q->symbol.name;
- if (strcmp (symname + strlen (symname) - 2, ".o") == 0)
- {
- if (q->symbol.value > low_line_vma)
- {
- *line_ptr = 0;
- line_file_name = NULL;
- }
- if (q->symbol.value > low_func_vma)
- func = NULL;
- }
- }
- break;
-
- case N_SO:
- /* If this symbol is less than the offset, but greater than
- the line number we have found so far, then we have not
- found the right line number. */
- if (q->symbol.value <= offset)
- {
- if (q->symbol.value > low_line_vma)
- {
- *line_ptr = 0;
- line_file_name = NULL;
- }
- if (q->symbol.value > low_func_vma)
- func = NULL;
- }
-
- main_file_name = current_file_name = q->symbol.name;
- /* Look ahead to next symbol to check if that too is an N_SO. */
- p++;
- if (*p == NULL)
- break;
- q = (aout_symbol_type *) (*p);
- if (q->type != (int)N_SO)
- goto next;
-
- /* Found a second N_SO First is directory; second is filename. */
- directory_name = current_file_name;
- main_file_name = current_file_name = q->symbol.name;
- if (obj_textsec (abfd) != section)
- goto done;
- break;
- case N_SOL:
- current_file_name = q->symbol.name;
- break;
-
- case N_SLINE:
-
- case N_DSLINE:
- case N_BSLINE:
- /* We'll keep this if it resolves nearer than the one we have
- already. */
- if (q->symbol.value >= low_line_vma
- && q->symbol.value <= offset)
- {
- *line_ptr = q->desc;
- low_line_vma = q->symbol.value;
- line_file_name = current_file_name;
- line_directory_name = directory_name;
- }
- break;
- case N_FUN:
- {
- /* We'll keep this if it is nearer than the one we have already. */
- if (q->symbol.value >= low_func_vma &&
- q->symbol.value <= offset)
- {
- low_func_vma = q->symbol.value;
- func = (asymbol *)q;
- }
- else if (q->symbol.value > offset)
- goto done;
- }
- break;
- }
- }
- }
-
- done:
- if (*line_ptr != 0)
- {
- main_file_name = line_file_name;
- directory_name = line_directory_name;
- }
-
- if (main_file_name == NULL
- || IS_ABSOLUTE_PATH (main_file_name)
- || directory_name == NULL)
- filelen = 0;
- else
- filelen = strlen (directory_name) + strlen (main_file_name);
-
- if (func == NULL)
- funclen = 0;
- else
- funclen = strlen (bfd_asymbol_name (func));
-
- if (adata (abfd).line_buf != NULL)
- free (adata (abfd).line_buf);
-
- if (filelen + funclen == 0)
- adata (abfd).line_buf = buf = NULL;
- else
- {
- buf = (char *) bfd_malloc (filelen + funclen + 3);
- adata (abfd).line_buf = buf;
- if (buf == NULL)
- return FALSE;
- }
-
- if (main_file_name != NULL)
- {
- if (IS_ABSOLUTE_PATH (main_file_name) || directory_name == NULL)
- *filename_ptr = main_file_name;
- else
- {
- sprintf (buf, "%s%s", directory_name, main_file_name);
- *filename_ptr = buf;
- buf += filelen + 1;
- }
- }
-
- if (func)
- {
- const char *function = func->name;
- char *colon;
-
- /* The caller expects a symbol name. We actually have a
- function name, without the leading underscore. Put the
- underscore back in, so that the caller gets a symbol name. */
- if (bfd_get_symbol_leading_char (abfd) == '\0')
- strcpy (buf, function);
- else
- {
- buf[0] = bfd_get_symbol_leading_char (abfd);
- strcpy (buf + 1, function);
- }
- /* Have to remove : stuff. */
- colon = strchr (buf, ':');
- if (colon != NULL)
- *colon = '\0';
- *functionname_ptr = buf;
- }
-
- return TRUE;
-}
-
-int
-NAME(aout,sizeof_headers) (abfd, execable)
- bfd *abfd;
- bfd_boolean execable ATTRIBUTE_UNUSED;
-{
- return adata (abfd).exec_bytes_size;
-}
-
-/* Free all information we have cached for this BFD. We can always
- read it again later if we need it. */
-
-bfd_boolean
-NAME(aout,bfd_free_cached_info) (abfd)
- bfd *abfd;
-{
- asection *o;
-
- if (bfd_get_format (abfd) != bfd_object
- || abfd->tdata.aout_data == NULL)
- return TRUE;
-
-#define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; }
- BFCI_FREE (obj_aout_symbols (abfd));
-#ifdef USE_MMAP
- obj_aout_external_syms (abfd) = 0;
- bfd_free_window (&obj_aout_sym_window (abfd));
- bfd_free_window (&obj_aout_string_window (abfd));
- obj_aout_external_strings (abfd) = 0;
-#else
- BFCI_FREE (obj_aout_external_syms (abfd));
- BFCI_FREE (obj_aout_external_strings (abfd));
-#endif
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- BFCI_FREE (o->relocation);
-#undef BFCI_FREE
-
- return TRUE;
-}
-
-/* a.out link code. */
-
-static bfd_boolean aout_link_add_object_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean aout_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *));
-static bfd_boolean aout_link_free_symbols
- PARAMS ((bfd *));
-static bfd_boolean aout_link_check_ar_symbols
- PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
-static bfd_boolean aout_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-
-/* Routine to create an entry in an a.out link hash table. */
-
-struct bfd_hash_entry *
-NAME(aout,link_hash_newfunc) (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct aout_link_hash_entry *ret = (struct aout_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct aout_link_hash_entry *) NULL)
- ret = ((struct aout_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct aout_link_hash_entry)));
- if (ret == (struct aout_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct aout_link_hash_entry *)
- _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret)
- {
- /* Set local fields. */
- ret->written = FALSE;
- ret->indx = -1;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Initialize an a.out link hash table. */
-
-bfd_boolean
-NAME(aout,link_hash_table_init) (table, abfd, newfunc)
- struct aout_link_hash_table *table;
- bfd *abfd;
- struct bfd_hash_entry *(*newfunc)
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- const char *));
-{
- return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
-}
-
-/* Create an a.out link hash table. */
-
-struct bfd_link_hash_table *
-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_malloc (amt);
- if (ret == NULL)
- return (struct bfd_link_hash_table *) NULL;
-
- if (! NAME(aout,link_hash_table_init) (ret, abfd,
- NAME(aout,link_hash_newfunc)))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
- return &ret->root;
-}
-
-/* Given an a.out BFD, add symbols to the global hash table as
- appropriate. */
-
-bfd_boolean
-NAME(aout,link_add_symbols) (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
- return aout_link_add_object_symbols (abfd, info);
- case bfd_archive:
- return _bfd_generic_link_add_archive_symbols
- (abfd, info, aout_link_check_archive_element);
- default:
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-}
-
-/* Add symbols from an a.out object file. */
-
-static bfd_boolean
-aout_link_add_object_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- if (! aout_get_external_symbols (abfd))
- return FALSE;
- if (! aout_link_add_symbols (abfd, info))
- return FALSE;
- if (! info->keep_memory)
- {
- if (! aout_link_free_symbols (abfd))
- return FALSE;
- }
- return TRUE;
-}
-
-/* Check a single archive element to see if we need to include it in
- the link. *PNEEDED is set according to whether this element is
- needed in the link or not. This is called from
- _bfd_generic_link_add_archive_symbols. */
-
-static bfd_boolean
-aout_link_check_archive_element (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean *pneeded;
-{
- if (! aout_get_external_symbols (abfd))
- return FALSE;
-
- if (! aout_link_check_ar_symbols (abfd, info, pneeded))
- return FALSE;
-
- if (*pneeded)
- {
- if (! aout_link_add_symbols (abfd, info))
- return FALSE;
- }
-
- if (! info->keep_memory || ! *pneeded)
- {
- if (! aout_link_free_symbols (abfd))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Free up the internal symbols read from an a.out file. */
-
-static bfd_boolean
-aout_link_free_symbols (abfd)
- bfd *abfd;
-{
- if (obj_aout_external_syms (abfd) != (struct external_nlist *) NULL)
- {
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_sym_window (abfd));
-#else
- free ((PTR) obj_aout_external_syms (abfd));
-#endif
- obj_aout_external_syms (abfd) = (struct external_nlist *) NULL;
- }
- if (obj_aout_external_strings (abfd) != (char *) NULL)
- {
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_string_window (abfd));
-#else
- free ((PTR) obj_aout_external_strings (abfd));
-#endif
- obj_aout_external_strings (abfd) = (char *) NULL;
- }
- return TRUE;
-}
-
-/* Look through the internal symbols to see if this object file should
- be included in the link. We should include this object file if it
- defines any symbols which are currently undefined. If this object
- file defines a common symbol, then we may adjust the size of the
- known symbol but we do not include the object file in the link
- (unless there is some other reason to include it). */
-
-static bfd_boolean
-aout_link_check_ar_symbols (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean *pneeded;
-{
- register struct external_nlist *p;
- struct external_nlist *pend;
- char *strings;
-
- *pneeded = FALSE;
-
- /* Look through all the symbols. */
- p = obj_aout_external_syms (abfd);
- pend = p + obj_aout_external_sym_count (abfd);
- strings = obj_aout_external_strings (abfd);
- for (; p < pend; p++)
- {
- int type = H_GET_8 (abfd, p->e_type);
- const char *name;
- struct bfd_link_hash_entry *h;
-
- /* Ignore symbols that are not externally visible. This is an
- optimization only, as we check the type more thoroughly
- below. */
- if (((type & N_EXT) == 0
- || (type & N_STAB) != 0
- || type == N_FN)
- && type != N_WEAKA
- && type != N_WEAKT
- && type != N_WEAKD
- && type != N_WEAKB)
- {
- if (type == N_WARNING
- || type == N_INDR)
- ++p;
- continue;
- }
-
- name = strings + GET_WORD (abfd, p->e_strx);
- h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
-
- /* We are only interested in symbols that are currently
- undefined or common. */
- if (h == (struct bfd_link_hash_entry *) NULL
- || (h->type != bfd_link_hash_undefined
- && h->type != bfd_link_hash_common))
- {
- if (type == (N_INDR | N_EXT))
- ++p;
- continue;
- }
-
- if (type == (N_TEXT | N_EXT)
- || type == (N_DATA | N_EXT)
- || type == (N_BSS | N_EXT)
- || type == (N_ABS | N_EXT)
- || type == (N_INDR | N_EXT))
- {
- /* This object file defines this symbol. We must link it
- in. This is true regardless of whether the current
- definition of the symbol is undefined or common.
-
- If the current definition is common, we have a case in
- which we have already seen an object file including:
- int a;
- and this object file from the archive includes:
- int a = 5;
- In such a case, whether to include this object is target
- dependant for backward compatibility.
-
- FIXME: The SunOS 4.1.3 linker will pull in the archive
- element if the symbol is defined in the .data section,
- but not if it is defined in the .text section. That
- seems a bit crazy to me, and it has not been implemented
- yet. However, it might be correct. */
- if (h->type == bfd_link_hash_common)
- {
- int skip = 0;
-
- switch (info->common_skip_ar_aymbols)
- {
- case bfd_link_common_skip_text:
- skip = (type == (N_TEXT | N_EXT));
- break;
- case bfd_link_common_skip_data:
- skip = (type == (N_DATA | N_EXT));
- break;
- default:
- case bfd_link_common_skip_all:
- skip = 1;
- break;
- }
-
- if (skip)
- continue;
- }
-
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
-
- if (type == (N_UNDF | N_EXT))
- {
- bfd_vma value;
-
- value = GET_WORD (abfd, p->e_value);
- if (value != 0)
- {
- /* This symbol is common in the object from the archive
- file. */
- if (h->type == bfd_link_hash_undefined)
- {
- bfd *symbfd;
- unsigned int power;
-
- symbfd = h->u.undef.abfd;
- if (symbfd == (bfd *) NULL)
- {
- /* This symbol was created as undefined from
- outside BFD. We assume that we should link
- in the object file. This is done for the -u
- option in the linker. */
- if (! (*info->callbacks->add_archive_element) (info,
- abfd,
- name))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
- /* Turn the current link symbol into a common
- symbol. It is already on the undefs list. */
- h->type = bfd_link_hash_common;
- h->u.c.p = ((struct bfd_link_hash_common_entry *)
- bfd_hash_allocate (&info->hash->table,
- sizeof (struct bfd_link_hash_common_entry)));
- if (h->u.c.p == NULL)
- return FALSE;
-
- h->u.c.size = value;
-
- /* FIXME: This isn't quite right. The maximum
- alignment of a common symbol should be set by the
- architecture of the output file, not of the input
- file. */
- power = bfd_log2 (value);
- if (power > bfd_get_arch_info (abfd)->section_align_power)
- power = bfd_get_arch_info (abfd)->section_align_power;
- h->u.c.p->alignment_power = power;
-
- h->u.c.p->section = bfd_make_section_old_way (symbfd,
- "COMMON");
- }
- else
- {
- /* Adjust the size of the common symbol if
- necessary. */
- if (value > h->u.c.size)
- h->u.c.size = value;
- }
- }
- }
-
- if (type == N_WEAKA
- || type == N_WEAKT
- || type == N_WEAKD
- || type == N_WEAKB)
- {
- /* This symbol is weak but defined. We must pull it in if
- the current link symbol is undefined, but we don't want
- it if the current link symbol is common. */
- if (h->type == bfd_link_hash_undefined)
- {
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
- }
- }
-
- /* We do not need this object file. */
- return TRUE;
-}
-
-/* Add all symbols from an object file to the hash table. */
-
-static bfd_boolean
-aout_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- bfd_boolean (*add_one_symbol)
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
- struct external_nlist *syms;
- bfd_size_type sym_count;
- char *strings;
- bfd_boolean copy;
- 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);
- strings = obj_aout_external_strings (abfd);
- if (info->keep_memory)
- copy = FALSE;
- else
- copy = TRUE;
-
- if (aout_backend_info (abfd)->add_dynamic_symbols != NULL)
- {
- if (! ((*aout_backend_info (abfd)->add_dynamic_symbols)
- (abfd, info, &syms, &sym_count, &strings)))
- return FALSE;
- }
-
- /* We keep a list of the linker hash table entries that correspond
- 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. */
- 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;
-
- add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
- if (add_one_symbol == NULL)
- add_one_symbol = _bfd_generic_link_add_one_symbol;
-
- p = syms;
- pend = p + sym_count;
- for (; p < pend; p++, sym_hash++)
- {
- int type;
- const char *name;
- bfd_vma value;
- asection *section;
- flagword flags;
- const char *string;
-
- *sym_hash = NULL;
-
- type = H_GET_8 (abfd, p->e_type);
-
- /* Ignore debugging symbols. */
- if ((type & N_STAB) != 0)
- continue;
-
- name = strings + GET_WORD (abfd, p->e_strx);
- value = GET_WORD (abfd, p->e_value);
- flags = BSF_GLOBAL;
- string = NULL;
- switch (type)
- {
- default:
- abort ();
-
- case N_UNDF:
- case N_ABS:
- case N_TEXT:
- case N_DATA:
- case N_BSS:
- case N_FN_SEQ:
- case N_COMM:
- case N_SETV:
- case N_FN:
- /* Ignore symbols that are not externally visible. */
- continue;
- case N_INDR:
- /* Ignore local indirect symbol. */
- ++p;
- ++sym_hash;
- continue;
-
- case N_UNDF | N_EXT:
- if (value == 0)
- {
- section = bfd_und_section_ptr;
- flags = 0;
- }
- else
- section = bfd_com_section_ptr;
- break;
- case N_ABS | N_EXT:
- section = bfd_abs_section_ptr;
- break;
- case N_TEXT | N_EXT:
- section = obj_textsec (abfd);
- value -= bfd_get_section_vma (abfd, section);
- break;
- case N_DATA | N_EXT:
- case N_SETV | N_EXT:
- /* Treat N_SETV symbols as N_DATA symbol; see comment in
- translate_from_native_sym_flags. */
- section = obj_datasec (abfd);
- value -= bfd_get_section_vma (abfd, section);
- break;
- case N_BSS | N_EXT:
- section = obj_bsssec (abfd);
- value -= bfd_get_section_vma (abfd, section);
- break;
- case N_INDR | N_EXT:
- /* An indirect symbol. The next symbol is the symbol
- which this one really is. */
- BFD_ASSERT (p + 1 < pend);
- ++p;
- string = strings + GET_WORD (abfd, p->e_strx);
- section = bfd_ind_section_ptr;
- flags |= BSF_INDIRECT;
- break;
- case N_COMM | N_EXT:
- section = bfd_com_section_ptr;
- break;
- case N_SETA: case N_SETA | N_EXT:
- section = bfd_abs_section_ptr;
- flags |= BSF_CONSTRUCTOR;
- break;
- case N_SETT: case N_SETT | N_EXT:
- section = obj_textsec (abfd);
- flags |= BSF_CONSTRUCTOR;
- value -= bfd_get_section_vma (abfd, section);
- break;
- case N_SETD: case N_SETD | N_EXT:
- section = obj_datasec (abfd);
- flags |= BSF_CONSTRUCTOR;
- value -= bfd_get_section_vma (abfd, section);
- break;
- case N_SETB: case N_SETB | N_EXT:
- section = obj_bsssec (abfd);
- flags |= BSF_CONSTRUCTOR;
- value -= bfd_get_section_vma (abfd, section);
- break;
- case N_WARNING:
- /* A warning symbol. The next symbol is the one to warn
- about. */
- BFD_ASSERT (p + 1 < pend);
- ++p;
- string = name;
- name = strings + GET_WORD (abfd, p->e_strx);
- section = bfd_und_section_ptr;
- flags |= BSF_WARNING;
- break;
- case N_WEAKU:
- section = bfd_und_section_ptr;
- flags = BSF_WEAK;
- break;
- case N_WEAKA:
- section = bfd_abs_section_ptr;
- flags = BSF_WEAK;
- break;
- case N_WEAKT:
- section = obj_textsec (abfd);
- value -= bfd_get_section_vma (abfd, section);
- flags = BSF_WEAK;
- break;
- case N_WEAKD:
- section = obj_datasec (abfd);
- value -= bfd_get_section_vma (abfd, section);
- flags = BSF_WEAK;
- break;
- case N_WEAKB:
- section = obj_bsssec (abfd);
- value -= bfd_get_section_vma (abfd, section);
- flags = BSF_WEAK;
- break;
- }
-
- if (! ((*add_one_symbol)
- (info, abfd, name, flags, section, value, string, copy, FALSE,
- (struct bfd_link_hash_entry **) sym_hash)))
- return FALSE;
-
- /* Restrict the maximum alignment of a common symbol based on
- the architecture, since a.out has no way to represent
- alignment requirements of a section in a .o file. FIXME:
- This isn't quite right: it should use the architecture of the
- output file, not the input files. */
- if ((*sym_hash)->root.type == bfd_link_hash_common
- && ((*sym_hash)->root.u.c.p->alignment_power >
- bfd_get_arch_info (abfd)->section_align_power))
- (*sym_hash)->root.u.c.p->alignment_power =
- bfd_get_arch_info (abfd)->section_align_power;
-
- /* If this is a set symbol, and we are not building sets, then
- it is possible for the hash entry to not have been set. In
- such a case, treat the symbol as not globally defined. */
- if ((*sym_hash)->root.type == bfd_link_hash_new)
- {
- BFD_ASSERT ((flags & BSF_CONSTRUCTOR) != 0);
- *sym_hash = NULL;
- }
-
- if (type == (N_INDR | N_EXT) || type == N_WARNING)
- ++sym_hash;
- }
-
- return TRUE;
-}
-
-/* A hash table used for header files with N_BINCL entries. */
-
-struct aout_link_includes_table
-{
- struct bfd_hash_table root;
-};
-
-/* A linked list of totals that we have found for a particular header
- file. */
-
-struct aout_link_includes_totals
-{
- struct aout_link_includes_totals *next;
- bfd_vma total;
-};
-
-/* An entry in the header file hash table. */
-
-struct aout_link_includes_entry
-{
- struct bfd_hash_entry root;
- /* List of totals we have found for this file. */
- struct aout_link_includes_totals *totals;
-};
-
-/* Look up an entry in an the header file hash table. */
-
-#define aout_link_includes_lookup(table, string, create, copy) \
- ((struct aout_link_includes_entry *) \
- bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
-
-/* During the final link step we need to pass around a bunch of
- information, so we do it in an instance of this structure. */
-
-struct aout_final_link_info
-{
- /* General link information. */
- struct bfd_link_info *info;
- /* Output bfd. */
- bfd *output_bfd;
- /* Reloc file positions. */
- file_ptr treloff, dreloff;
- /* File position of symbols. */
- file_ptr symoff;
- /* String table. */
- struct bfd_strtab_hash *strtab;
- /* Header file hash table. */
- struct aout_link_includes_table includes;
- /* A buffer large enough to hold the contents of any section. */
- bfd_byte *contents;
- /* A buffer large enough to hold the relocs of any section. */
- PTR relocs;
- /* A buffer large enough to hold the symbol map of any input BFD. */
- int *symbol_map;
- /* A buffer large enough to hold output symbols of any input BFD. */
- struct external_nlist *output_syms;
-};
-
-static struct bfd_hash_entry *aout_link_includes_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static bfd_boolean aout_link_input_bfd
- PARAMS ((struct aout_final_link_info *, bfd *input_bfd));
-static bfd_boolean aout_link_write_symbols
- PARAMS ((struct aout_final_link_info *, bfd *input_bfd));
-static bfd_boolean aout_link_write_other_symbol
- PARAMS ((struct aout_link_hash_entry *, PTR));
-static bfd_boolean aout_link_input_section
- PARAMS ((struct aout_final_link_info *, bfd *input_bfd,
- asection *input_section, file_ptr *reloff_ptr,
- bfd_size_type rel_size));
-static bfd_boolean aout_link_input_section_std
- PARAMS ((struct aout_final_link_info *, bfd *input_bfd,
- asection *input_section, struct reloc_std_external *,
- bfd_size_type rel_size, bfd_byte *contents));
-static bfd_boolean aout_link_input_section_ext
- PARAMS ((struct aout_final_link_info *, bfd *input_bfd,
- asection *input_section, struct reloc_ext_external *,
- bfd_size_type rel_size, bfd_byte *contents));
-static INLINE asection *aout_reloc_index_to_section
- PARAMS ((bfd *, int));
-static bfd_boolean aout_link_reloc_link_order
- PARAMS ((struct aout_final_link_info *, asection *,
- struct bfd_link_order *));
-
-/* The function to create a new entry in the header file hash table. */
-
-static struct bfd_hash_entry *
-aout_link_includes_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct aout_link_includes_entry *ret =
- (struct aout_link_includes_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct aout_link_includes_entry *) NULL)
- ret = ((struct aout_link_includes_entry *)
- bfd_hash_allocate (table,
- sizeof (struct aout_link_includes_entry)));
- if (ret == (struct aout_link_includes_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct aout_link_includes_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
- if (ret)
- {
- /* Set local fields. */
- ret->totals = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Do the final link step. This is called on the output BFD. The
- INFO structure should point to a list of BFDs linked through the
- link_next field which can be used to find each BFD which takes part
- in the output. Also, each section in ABFD should point to a list
- of bfd_link_order structures which list all the input sections for
- the output section. */
-
-bfd_boolean
-NAME(aout,final_link) (abfd, info, callback)
- bfd *abfd;
- struct bfd_link_info *info;
- void (*callback) PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
-{
- struct aout_final_link_info aout_info;
- bfd_boolean includes_hash_initialized = FALSE;
- register bfd *sub;
- bfd_size_type trsize, drsize;
- 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;
- asection *o;
- bfd_boolean have_link_order_relocs;
-
- if (info->shared)
- abfd->flags |= DYNAMIC;
-
- aout_info.info = info;
- aout_info.output_bfd = abfd;
- aout_info.contents = NULL;
- aout_info.relocs = NULL;
- aout_info.symbol_map = NULL;
- aout_info.output_syms = NULL;
-
- if (! bfd_hash_table_init_n (&aout_info.includes.root,
- aout_link_includes_newfunc,
- 251))
- goto error_return;
- includes_hash_initialized = TRUE;
-
- /* Figure out the largest section size. Also, if generating
- relocatable output, count the relocs. */
- trsize = 0;
- drsize = 0;
- max_contents_size = 0;
- max_relocs_size = 0;
- max_sym_count = 0;
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- bfd_size_type sz;
-
- if (info->relocatable)
- {
- if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
- {
- trsize += exec_hdr (sub)->a_trsize;
- drsize += exec_hdr (sub)->a_drsize;
- }
- else
- {
- /* FIXME: We need to identify the .text and .data sections
- and call get_reloc_upper_bound and canonicalize_reloc to
- work out the number of relocs needed, and then multiply
- by the reloc size. */
- (*_bfd_error_handler)
- (_("%s: relocatable link from %s to %s not supported"),
- bfd_get_filename (abfd),
- sub->xvec->name, abfd->xvec->name);
- bfd_set_error (bfd_error_invalid_operation);
- goto error_return;
- }
- }
-
- if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
- {
- sz = bfd_section_size (sub, obj_textsec (sub));
- if (sz > max_contents_size)
- max_contents_size = sz;
- sz = bfd_section_size (sub, obj_datasec (sub));
- if (sz > max_contents_size)
- max_contents_size = sz;
-
- sz = exec_hdr (sub)->a_trsize;
- if (sz > max_relocs_size)
- max_relocs_size = sz;
- sz = exec_hdr (sub)->a_drsize;
- if (sz > max_relocs_size)
- max_relocs_size = sz;
-
- sz = obj_aout_external_sym_count (sub);
- if (sz > max_sym_count)
- max_sym_count = sz;
- }
- }
-
- if (info->relocatable)
- {
- if (obj_textsec (abfd) != (asection *) NULL)
- trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
- ->link_order_head)
- * obj_reloc_entry_size (abfd));
- if (obj_datasec (abfd) != (asection *) NULL)
- drsize += (_bfd_count_link_order_relocs (obj_datasec (abfd)
- ->link_order_head)
- * obj_reloc_entry_size (abfd));
- }
-
- exec_hdr (abfd)->a_trsize = trsize;
- exec_hdr (abfd)->a_drsize = drsize;
-
- exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
-
- /* Adjust the section sizes and vmas according to the magic number.
- This sets a_text, a_data and a_bss in the exec_hdr and sets the
- filepos for each section. */
- if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end))
- goto error_return;
-
- /* The relocation and symbol file positions differ among a.out
- targets. We are passed a callback routine from the backend
- specific code to handle this.
- FIXME: At this point we do not know how much space the symbol
- table will require. This will not work for any (nonstandard)
- a.out target that needs to know the symbol table size before it
- can compute the relocation file positions. This may or may not
- be the case for the hp300hpux target, for example. */
- (*callback) (abfd, &aout_info.treloff, &aout_info.dreloff,
- &aout_info.symoff);
- obj_textsec (abfd)->rel_filepos = aout_info.treloff;
- obj_datasec (abfd)->rel_filepos = aout_info.dreloff;
- obj_sym_filepos (abfd) = aout_info.symoff;
-
- /* We keep a count of the symbols as we output them. */
- obj_aout_external_sym_count (abfd) = 0;
-
- /* We accumulate the string table as we write out the symbols. */
- aout_info.strtab = _bfd_stringtab_init ();
- if (aout_info.strtab == NULL)
- goto error_return;
-
- /* Allocate buffers to hold section contents and relocs. */
- aout_info.contents = (bfd_byte *) bfd_malloc (max_contents_size);
- aout_info.relocs = (PTR) bfd_malloc (max_relocs_size);
- aout_info.symbol_map = (int *) bfd_malloc (max_sym_count * sizeof (int *));
- aout_info.output_syms = ((struct external_nlist *)
- bfd_malloc ((max_sym_count + 1)
- * sizeof (struct external_nlist)));
- if ((aout_info.contents == NULL && max_contents_size != 0)
- || (aout_info.relocs == NULL && max_relocs_size != 0)
- || (aout_info.symbol_map == NULL && max_sym_count != 0)
- || aout_info.output_syms == NULL)
- goto error_return;
-
- /* If we have a symbol named __DYNAMIC, force it out now. This is
- required by SunOS. Doing this here rather than in sunos.c is a
- hack, but it's easier than exporting everything which would be
- needed. */
- {
- struct aout_link_hash_entry *h;
-
- h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC",
- FALSE, FALSE, FALSE);
- if (h != NULL)
- aout_link_write_other_symbol (h, &aout_info);
- }
-
- /* The most time efficient way to do the link would be to read all
- the input object files into memory and then sort out the
- information into the output file. Unfortunately, that will
- probably use too much memory. Another method would be to step
- through everything that composes the text section and write it
- out, and then everything that composes the data section and write
- it out, and then write out the relocs, and then write out the
- symbols. Unfortunately, that requires reading stuff from each
- input file several times, and we will not be able to keep all the
- input files open simultaneously, and reopening them will be slow.
-
- What we do is basically process one input file at a time. We do
- everything we need to do with an input file once--copy over the
- section contents, handle the relocation information, and write
- out the symbols--and then we throw away the information we read
- from it. This approach requires a lot of lseeks of the output
- file, which is unfortunate but still faster than reopening a lot
- of files.
-
- We use the output_has_begun field of the input BFDs to see
- whether we have already handled it. */
- for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next)
- sub->output_has_begun = FALSE;
-
- /* Mark all sections which are to be included in the link. This
- will normally be every section. We need to do this so that we
- can identify any sections which the linker has decided to not
- include. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- if (p->type == bfd_indirect_link_order)
- p->u.indirect.section->linker_mark = TRUE;
- }
-
- have_link_order_relocs = FALSE;
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- {
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- {
- if (p->type == bfd_indirect_link_order
- && (bfd_get_flavour (p->u.indirect.section->owner)
- == bfd_target_aout_flavour))
- {
- bfd *input_bfd;
-
- input_bfd = p->u.indirect.section->owner;
- if (! input_bfd->output_has_begun)
- {
- if (! aout_link_input_bfd (&aout_info, input_bfd))
- goto error_return;
- input_bfd->output_has_begun = TRUE;
- }
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- /* These are handled below. */
- have_link_order_relocs = TRUE;
- }
- else
- {
- if (! _bfd_default_link_order (abfd, info, o, p))
- goto error_return;
- }
- }
- }
-
- /* Write out any symbols that we have not already written out. */
- aout_link_hash_traverse (aout_hash_table (info),
- aout_link_write_other_symbol,
- (PTR) &aout_info);
-
- /* Now handle any relocs we were asked to create by the linker.
- These did not come from any input file. We must do these after
- we have written out all the symbols, so that we know the symbol
- indices to use. */
- if (have_link_order_relocs)
- {
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- {
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- {
- if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- if (! aout_link_reloc_link_order (&aout_info, o, p))
- goto error_return;
- }
- }
- }
- }
-
- if (aout_info.contents != NULL)
- {
- free (aout_info.contents);
- aout_info.contents = NULL;
- }
- if (aout_info.relocs != NULL)
- {
- free (aout_info.relocs);
- aout_info.relocs = NULL;
- }
- if (aout_info.symbol_map != NULL)
- {
- free (aout_info.symbol_map);
- aout_info.symbol_map = NULL;
- }
- if (aout_info.output_syms != NULL)
- {
- free (aout_info.output_syms);
- aout_info.output_syms = NULL;
- }
- if (includes_hash_initialized)
- {
- bfd_hash_table_free (&aout_info.includes.root);
- includes_hash_initialized = FALSE;
- }
-
- /* Finish up any dynamic linking we may be doing. */
- if (aout_backend_info (abfd)->finish_dynamic_link != NULL)
- {
- if (! (*aout_backend_info (abfd)->finish_dynamic_link) (abfd, info))
- goto error_return;
- }
-
- /* Update the header information. */
- abfd->symcount = obj_aout_external_sym_count (abfd);
- exec_hdr (abfd)->a_syms = abfd->symcount * EXTERNAL_NLIST_SIZE;
- obj_str_filepos (abfd) = obj_sym_filepos (abfd) + exec_hdr (abfd)->a_syms;
- obj_textsec (abfd)->reloc_count =
- exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd);
- obj_datasec (abfd)->reloc_count =
- exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd);
-
- /* Write out the string table, unless there are no symbols. */
- if (abfd->symcount > 0)
- {
- if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
- || ! emit_stringtab (abfd, aout_info.strtab))
- goto error_return;
- }
- else if (obj_textsec (abfd)->reloc_count == 0
- && obj_datasec (abfd)->reloc_count == 0)
- {
- bfd_byte b;
- file_ptr pos;
-
- b = 0;
- 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;
- }
-
- return TRUE;
-
- error_return:
- if (aout_info.contents != NULL)
- free (aout_info.contents);
- if (aout_info.relocs != NULL)
- free (aout_info.relocs);
- if (aout_info.symbol_map != NULL)
- free (aout_info.symbol_map);
- if (aout_info.output_syms != NULL)
- free (aout_info.output_syms);
- if (includes_hash_initialized)
- bfd_hash_table_free (&aout_info.includes.root);
- return FALSE;
-}
-
-/* Link an a.out input BFD into the output file. */
-
-static bfd_boolean
-aout_link_input_bfd (finfo, input_bfd)
- struct aout_final_link_info *finfo;
- bfd *input_bfd;
-{
- bfd_size_type sym_count;
-
- BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object);
-
- /* If this is a dynamic object, it may need special handling. */
- if ((input_bfd->flags & DYNAMIC) != 0
- && aout_backend_info (input_bfd)->link_dynamic_object != NULL)
- {
- return ((*aout_backend_info (input_bfd)->link_dynamic_object)
- (finfo->info, input_bfd));
- }
-
- /* Get the symbols. We probably have them already, unless
- finfo->info->keep_memory is FALSE. */
- if (! aout_get_external_symbols (input_bfd))
- return FALSE;
-
- sym_count = obj_aout_external_sym_count (input_bfd);
-
- /* Write out the symbols and get a map of the new indices. The map
- is placed into finfo->symbol_map. */
- if (! aout_link_write_symbols (finfo, input_bfd))
- return FALSE;
-
- /* Relocate and write out the sections. These functions use the
- symbol map created by aout_link_write_symbols. The linker_mark
- field will be set if these sections are to be included in the
- link, which will normally be the case. */
- if (obj_textsec (input_bfd)->linker_mark)
- {
- if (! aout_link_input_section (finfo, input_bfd,
- obj_textsec (input_bfd),
- &finfo->treloff,
- exec_hdr (input_bfd)->a_trsize))
- return FALSE;
- }
- if (obj_datasec (input_bfd)->linker_mark)
- {
- if (! aout_link_input_section (finfo, input_bfd,
- obj_datasec (input_bfd),
- &finfo->dreloff,
- exec_hdr (input_bfd)->a_drsize))
- return FALSE;
- }
-
- /* If we are not keeping memory, we don't need the symbols any
- longer. We still need them if we are keeping memory, because the
- strings in the hash table point into them. */
- if (! finfo->info->keep_memory)
- {
- if (! aout_link_free_symbols (input_bfd))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Adjust and write out the symbols for an a.out file. Set the new
- symbol indices into a symbol_map. */
-
-static bfd_boolean
-aout_link_write_symbols (finfo, input_bfd)
- struct aout_final_link_info *finfo;
- bfd *input_bfd;
-{
- bfd *output_bfd;
- bfd_size_type sym_count;
- char *strings;
- enum bfd_link_strip strip;
- enum bfd_link_discard discard;
- struct external_nlist *outsym;
- bfd_size_type strtab_index;
- register struct external_nlist *sym;
- struct external_nlist *sym_end;
- struct aout_link_hash_entry **sym_hash;
- int *symbol_map;
- bfd_boolean pass;
- bfd_boolean skip_next;
-
- output_bfd = finfo->output_bfd;
- sym_count = obj_aout_external_sym_count (input_bfd);
- strings = obj_aout_external_strings (input_bfd);
- strip = finfo->info->strip;
- discard = finfo->info->discard;
- outsym = finfo->output_syms;
-
- /* First write out a symbol for this object file, unless we are
- discarding such symbols. */
- if (strip != strip_all
- && (strip != strip_some
- || bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename,
- FALSE, FALSE) != NULL)
- && discard != discard_all)
- {
- 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)
- return FALSE;
- PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
- PUT_WORD (output_bfd,
- (bfd_get_section_vma (output_bfd,
- obj_textsec (input_bfd)->output_section)
- + obj_textsec (input_bfd)->output_offset),
- outsym->e_value);
- ++obj_aout_external_sym_count (output_bfd);
- ++outsym;
- }
-
- pass = FALSE;
- skip_next = FALSE;
- sym = obj_aout_external_syms (input_bfd);
- sym_end = sym + sym_count;
- sym_hash = obj_aout_sym_hashes (input_bfd);
- symbol_map = finfo->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;
- int type;
- struct aout_link_hash_entry *h;
- bfd_boolean skip;
- asection *symsec;
- bfd_vma val = 0;
- bfd_boolean copy;
-
- /* We set *symbol_map to 0 above for all symbols. If it has
- already been set to -1 for this symbol, it means that we are
- discarding it because it appears in a duplicate header file.
- See the N_BINCL code below. */
- if (*symbol_map == -1)
- continue;
-
- /* Initialize *symbol_map to -1, which means that the symbol was
- not copied into the output file. We will change it later if
- we do copy the symbol over. */
- *symbol_map = -1;
-
- type = H_GET_8 (input_bfd, sym->e_type);
- name = strings + GET_WORD (input_bfd, sym->e_strx);
-
- h = NULL;
-
- if (pass)
- {
- /* Pass this symbol through. It is the target of an
- indirect or warning symbol. */
- val = GET_WORD (input_bfd, sym->e_value);
- pass = FALSE;
- }
- else if (skip_next)
- {
- /* Skip this symbol, which is the target of an indirect
- symbol that we have changed to no longer be an indirect
- symbol. */
- skip_next = FALSE;
- continue;
- }
- else
- {
- struct aout_link_hash_entry *hresolve;
-
- /* We have saved the hash table entry for this symbol, if
- there is one. Note that we could just look it up again
- in the hash table, provided we first check that it is an
- external symbol. */
- h = *sym_hash;
-
- /* Use the name from the hash table, in case the symbol was
- wrapped. */
- if (h != NULL
- && h->root.type != bfd_link_hash_warning)
- name = h->root.root.string;
-
- /* If this is an indirect or warning symbol, then change
- hresolve to the base symbol. We also change *sym_hash so
- that the relocation routines relocate against the real
- symbol. */
- hresolve = h;
- if (h != (struct aout_link_hash_entry *) NULL
- && (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning))
- {
- hresolve = (struct aout_link_hash_entry *) h->root.u.i.link;
- while (hresolve->root.type == bfd_link_hash_indirect
- || hresolve->root.type == bfd_link_hash_warning)
- hresolve = ((struct aout_link_hash_entry *)
- hresolve->root.u.i.link);
- *sym_hash = hresolve;
- }
-
- /* If the symbol has already been written out, skip it. */
- if (h != (struct aout_link_hash_entry *) NULL
- && h->written)
- {
- if ((type & N_TYPE) == N_INDR
- || type == N_WARNING)
- skip_next = TRUE;
- *symbol_map = h->indx;
- continue;
- }
-
- /* See if we are stripping this symbol. */
- skip = FALSE;
- switch (strip)
- {
- case strip_none:
- break;
- case strip_debugger:
- if ((type & N_STAB) != 0)
- skip = TRUE;
- break;
- case strip_some:
- if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
- == NULL)
- skip = TRUE;
- break;
- case strip_all:
- skip = TRUE;
- break;
- }
- if (skip)
- {
- if (h != (struct aout_link_hash_entry *) NULL)
- h->written = TRUE;
- continue;
- }
-
- /* Get the value of the symbol. */
- if ((type & N_TYPE) == N_TEXT
- || type == N_WEAKT)
- symsec = obj_textsec (input_bfd);
- else if ((type & N_TYPE) == N_DATA
- || type == N_WEAKD)
- symsec = obj_datasec (input_bfd);
- else if ((type & N_TYPE) == N_BSS
- || type == N_WEAKB)
- symsec = obj_bsssec (input_bfd);
- else if ((type & N_TYPE) == N_ABS
- || type == N_WEAKA)
- symsec = bfd_abs_section_ptr;
- else if (((type & N_TYPE) == N_INDR
- && (hresolve == (struct aout_link_hash_entry *) NULL
- || (hresolve->root.type != bfd_link_hash_defined
- && hresolve->root.type != bfd_link_hash_defweak
- && hresolve->root.type != bfd_link_hash_common)))
- || type == N_WARNING)
- {
- /* Pass the next symbol through unchanged. The
- condition above for indirect symbols is so that if
- the indirect symbol was defined, we output it with
- the correct definition so the debugger will
- understand it. */
- pass = TRUE;
- val = GET_WORD (input_bfd, sym->e_value);
- symsec = NULL;
- }
- else if ((type & N_STAB) != 0)
- {
- val = GET_WORD (input_bfd, sym->e_value);
- symsec = NULL;
- }
- else
- {
- /* If we get here with an indirect symbol, it means that
- we are outputting it with a real definition. In such
- a case we do not want to output the next symbol,
- which is the target of the indirection. */
- if ((type & N_TYPE) == N_INDR)
- skip_next = TRUE;
-
- symsec = NULL;
-
- /* We need to get the value from the hash table. We use
- hresolve so that if we have defined an indirect
- symbol we output the final definition. */
- if (h == (struct aout_link_hash_entry *) NULL)
- {
- switch (type & N_TYPE)
- {
- case N_SETT:
- symsec = obj_textsec (input_bfd);
- break;
- case N_SETD:
- symsec = obj_datasec (input_bfd);
- break;
- case N_SETB:
- symsec = obj_bsssec (input_bfd);
- break;
- case N_SETA:
- symsec = bfd_abs_section_ptr;
- break;
- default:
- val = 0;
- break;
- }
- }
- else if (hresolve->root.type == bfd_link_hash_defined
- || hresolve->root.type == bfd_link_hash_defweak)
- {
- asection *input_section;
- asection *output_section;
-
- /* This case usually means a common symbol which was
- turned into a defined symbol. */
- input_section = hresolve->root.u.def.section;
- output_section = input_section->output_section;
- BFD_ASSERT (bfd_is_abs_section (output_section)
- || output_section->owner == output_bfd);
- val = (hresolve->root.u.def.value
- + bfd_get_section_vma (output_bfd, output_section)
- + input_section->output_offset);
-
- /* Get the correct type based on the section. If
- this is a constructed set, force it to be
- globally visible. */
- if (type == N_SETT
- || type == N_SETD
- || type == N_SETB
- || type == N_SETA)
- type |= N_EXT;
-
- type &=~ N_TYPE;
-
- if (output_section == obj_textsec (output_bfd))
- type |= (hresolve->root.type == bfd_link_hash_defined
- ? N_TEXT
- : N_WEAKT);
- else if (output_section == obj_datasec (output_bfd))
- type |= (hresolve->root.type == bfd_link_hash_defined
- ? N_DATA
- : N_WEAKD);
- else if (output_section == obj_bsssec (output_bfd))
- type |= (hresolve->root.type == bfd_link_hash_defined
- ? N_BSS
- : N_WEAKB);
- else
- type |= (hresolve->root.type == bfd_link_hash_defined
- ? N_ABS
- : N_WEAKA);
- }
- else if (hresolve->root.type == bfd_link_hash_common)
- val = hresolve->root.u.c.size;
- else if (hresolve->root.type == bfd_link_hash_undefweak)
- {
- val = 0;
- type = N_WEAKU;
- }
- else
- val = 0;
- }
- if (symsec != (asection *) NULL)
- val = (symsec->output_section->vma
- + symsec->output_offset
- + (GET_WORD (input_bfd, sym->e_value)
- - symsec->vma));
-
- /* If this is a global symbol set the written flag, and if
- it is a local symbol see if we should discard it. */
- if (h != (struct aout_link_hash_entry *) NULL)
- {
- h->written = TRUE;
- h->indx = obj_aout_external_sym_count (output_bfd);
- }
- else if ((type & N_TYPE) != N_SETT
- && (type & N_TYPE) != N_SETD
- && (type & N_TYPE) != N_SETB
- && (type & N_TYPE) != N_SETA)
- {
- switch (discard)
- {
- case discard_none:
- case discard_sec_merge:
- break;
- case discard_l:
- if ((type & N_STAB) == 0
- && bfd_is_local_label_name (input_bfd, name))
- skip = TRUE;
- break;
- case discard_all:
- skip = TRUE;
- break;
- }
- if (skip)
- {
- pass = FALSE;
- continue;
- }
- }
-
- /* An N_BINCL symbol indicates the start of the stabs
- entries for a header file. We need to scan ahead to the
- next N_EINCL symbol, ignoring nesting, adding up all the
- characters in the symbol names, not including the file
- numbers in types (the first number after an open
- parenthesis). */
- if (type == (int) N_BINCL)
- {
- struct external_nlist *incl_sym;
- int nest;
- struct aout_link_includes_entry *incl_entry;
- struct aout_link_includes_totals *t;
-
- val = 0;
- nest = 0;
- for (incl_sym = sym + 1; incl_sym < sym_end; incl_sym++)
- {
- int incl_type;
-
- incl_type = H_GET_8 (input_bfd, incl_sym->e_type);
- if (incl_type == (int) N_EINCL)
- {
- if (nest == 0)
- break;
- --nest;
- }
- else if (incl_type == (int) N_BINCL)
- ++nest;
- else if (nest == 0)
- {
- const char *s;
-
- s = strings + GET_WORD (input_bfd, incl_sym->e_strx);
- for (; *s != '\0'; s++)
- {
- val += *s;
- if (*s == '(')
- {
- /* Skip the file number. */
- ++s;
- while (ISDIGIT (*s))
- ++s;
- --s;
- }
- }
- }
- }
-
- /* If we have already included a header file with the
- same value, then replace this one with an N_EXCL
- symbol. */
- copy = (bfd_boolean) (! finfo->info->keep_memory);
- incl_entry = aout_link_includes_lookup (&finfo->includes,
- name, TRUE, copy);
- if (incl_entry == NULL)
- return FALSE;
- for (t = incl_entry->totals; t != NULL; t = t->next)
- if (t->total == val)
- break;
- if (t == NULL)
- {
- /* This is the first time we have seen this header
- file with this set of stabs strings. */
- t = ((struct aout_link_includes_totals *)
- bfd_hash_allocate (&finfo->includes.root,
- sizeof *t));
- if (t == NULL)
- return FALSE;
- t->total = val;
- t->next = incl_entry->totals;
- incl_entry->totals = t;
- }
- else
- {
- int *incl_map;
-
- /* This is a duplicate header file. We must change
- it to be an N_EXCL entry, and mark all the
- included symbols to prevent outputting them. */
- type = (int) N_EXCL;
-
- nest = 0;
- for (incl_sym = sym + 1, incl_map = symbol_map + 1;
- incl_sym < sym_end;
- incl_sym++, incl_map++)
- {
- int incl_type;
-
- incl_type = H_GET_8 (input_bfd, incl_sym->e_type);
- if (incl_type == (int) N_EINCL)
- {
- if (nest == 0)
- {
- *incl_map = -1;
- break;
- }
- --nest;
- }
- else if (incl_type == (int) N_BINCL)
- ++nest;
- else if (nest == 0)
- *incl_map = -1;
- }
- }
- }
- }
-
- /* Copy this symbol into the list of symbols we are going to
- write out. */
- 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)
- {
- /* name points into a string table which we are going to
- free. If there is a hash table entry, use that string.
- Otherwise, copy name into memory. */
- if (h != (struct aout_link_hash_entry *) NULL)
- name = h->root.root.string;
- else
- copy = TRUE;
- }
- strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
- name, copy);
- if (strtab_index == (bfd_size_type) -1)
- return FALSE;
- PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
- PUT_WORD (output_bfd, val, outsym->e_value);
- *symbol_map = obj_aout_external_sym_count (output_bfd);
- ++obj_aout_external_sym_count (output_bfd);
- ++outsym;
- }
-
- /* Write out the output symbols we have just constructed. */
- if (outsym > finfo->output_syms)
- {
- bfd_size_type outsym_size;
-
- if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0)
- return FALSE;
- 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_size;
- }
-
- return TRUE;
-}
-
-/* Write out a symbol that was not associated with an a.out input
- object. */
-
-static bfd_boolean
-aout_link_write_other_symbol (h, data)
- struct aout_link_hash_entry *h;
- PTR data;
-{
- struct aout_final_link_info *finfo = (struct aout_final_link_info *) data;
- bfd *output_bfd;
- int type;
- bfd_vma val;
- struct external_nlist outsym;
- bfd_size_type indx;
- bfd_size_type amt;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h = (struct aout_link_hash_entry *) h->root.u.i.link;
- if (h->root.type == bfd_link_hash_new)
- return TRUE;
- }
-
- output_bfd = finfo->output_bfd;
-
- if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL)
- {
- if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol)
- (output_bfd, finfo->info, h)))
- {
- /* FIXME: No way to handle errors. */
- abort ();
- }
- }
-
- if (h->written)
- return TRUE;
-
- h->written = TRUE;
-
- /* An indx of -2 means the symbol must be written. */
- if (h->indx != -2
- && (finfo->info->strip == strip_all
- || (finfo->info->strip == strip_some
- && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
- FALSE, FALSE) == NULL)))
- return TRUE;
-
- switch (h->root.type)
- {
- default:
- case bfd_link_hash_warning:
- abort ();
- /* Avoid variable not initialized warnings. */
- return TRUE;
- case bfd_link_hash_new:
- /* This can happen for set symbols when sets are not being
- built. */
- return TRUE;
- case bfd_link_hash_undefined:
- type = N_UNDF | N_EXT;
- val = 0;
- break;
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- {
- asection *sec;
-
- sec = h->root.u.def.section->output_section;
- BFD_ASSERT (bfd_is_abs_section (sec)
- || sec->owner == output_bfd);
- if (sec == obj_textsec (output_bfd))
- type = h->root.type == bfd_link_hash_defined ? N_TEXT : N_WEAKT;
- else if (sec == obj_datasec (output_bfd))
- type = h->root.type == bfd_link_hash_defined ? N_DATA : N_WEAKD;
- else if (sec == obj_bsssec (output_bfd))
- type = h->root.type == bfd_link_hash_defined ? N_BSS : N_WEAKB;
- else
- type = h->root.type == bfd_link_hash_defined ? N_ABS : N_WEAKA;
- type |= N_EXT;
- val = (h->root.u.def.value
- + sec->vma
- + h->root.u.def.section->output_offset);
- }
- break;
- case bfd_link_hash_common:
- type = N_UNDF | N_EXT;
- val = h->root.u.c.size;
- break;
- case bfd_link_hash_undefweak:
- type = N_WEAKU;
- val = 0;
- case bfd_link_hash_indirect:
- /* We ignore these symbols, since the indirected symbol is
- already in the hash table. */
- return TRUE;
- }
-
- 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)
- {
- /* FIXME: No way to handle errors. */
- abort ();
- }
- 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_bwrite ((PTR) &outsym, amt, output_bfd) != amt)
- {
- /* FIXME: No way to handle errors. */
- abort ();
- }
-
- finfo->symoff += EXTERNAL_NLIST_SIZE;
- h->indx = obj_aout_external_sym_count (output_bfd);
- ++obj_aout_external_sym_count (output_bfd);
-
- return TRUE;
-}
-
-/* Link an a.out section into the output file. */
-
-static bfd_boolean
-aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
- rel_size)
- struct aout_final_link_info *finfo;
- bfd *input_bfd;
- asection *input_section;
- file_ptr *reloff_ptr;
- bfd_size_type rel_size;
-{
- bfd_size_type input_size;
- PTR relocs;
-
- /* Get the section contents. */
- input_size = bfd_section_size (input_bfd, input_section);
- if (! bfd_get_section_contents (input_bfd, input_section,
- (PTR) finfo->contents,
- (file_ptr) 0, input_size))
- return FALSE;
-
- /* Read in the relocs if we haven't already done it. */
- if (aout_section_data (input_section) != NULL
- && aout_section_data (input_section)->relocs != NULL)
- relocs = aout_section_data (input_section)->relocs;
- else
- {
- relocs = finfo->relocs;
- if (rel_size > 0)
- {
- if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
- || bfd_bread (relocs, rel_size, input_bfd) != rel_size)
- return FALSE;
- }
- }
-
- /* Relocate the section contents. */
- if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE)
- {
- if (! aout_link_input_section_std (finfo, input_bfd, input_section,
- (struct reloc_std_external *) relocs,
- rel_size, finfo->contents))
- return FALSE;
- }
- else
- {
- if (! aout_link_input_section_ext (finfo, input_bfd, input_section,
- (struct reloc_ext_external *) relocs,
- rel_size, finfo->contents))
- return FALSE;
- }
-
- /* Write out the section contents. */
- if (! bfd_set_section_contents (finfo->output_bfd,
- input_section->output_section,
- (PTR) finfo->contents,
- (file_ptr) input_section->output_offset,
- input_size))
- return FALSE;
-
- /* If we are producing relocatable output, the relocs were
- modified, and we now write them out. */
- if (finfo->info->relocatable && rel_size > 0)
- {
- if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
- return FALSE;
- if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size)
- return FALSE;
- *reloff_ptr += rel_size;
-
- /* Assert that the relocs have not run into the symbols, and
- that if these are the text relocs they have not run into the
- data relocs. */
- BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
- && (reloff_ptr != &finfo->treloff
- || (*reloff_ptr
- <= obj_datasec (finfo->output_bfd)->rel_filepos)));
- }
-
- return TRUE;
-}
-
-/* Get the section corresponding to a reloc index. */
-
-static INLINE asection *
-aout_reloc_index_to_section (abfd, indx)
- bfd *abfd;
- int indx;
-{
- switch (indx & N_TYPE)
- {
- case N_TEXT:
- return obj_textsec (abfd);
- case N_DATA:
- return obj_datasec (abfd);
- case N_BSS:
- return obj_bsssec (abfd);
- case N_ABS:
- case N_UNDF:
- return bfd_abs_section_ptr;
- default:
- abort ();
- }
- /*NOTREACHED*/
- return NULL;
-}
-
-/* Relocate an a.out section using standard a.out relocs. */
-
-static bfd_boolean
-aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
- rel_size, contents)
- struct aout_final_link_info *finfo;
- bfd *input_bfd;
- asection *input_section;
- struct reloc_std_external *relocs;
- bfd_size_type rel_size;
- bfd_byte *contents;
-{
- bfd_boolean (*check_dynamic_reloc)
- PARAMS ((struct bfd_link_info *, bfd *, asection *,
- struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
- bfd_vma *));
- bfd *output_bfd;
- bfd_boolean relocatable;
- struct external_nlist *syms;
- char *strings;
- struct aout_link_hash_entry **sym_hashes;
- int *symbol_map;
- bfd_size_type reloc_count;
- register struct reloc_std_external *rel;
- struct reloc_std_external *rel_end;
-
- output_bfd = finfo->output_bfd;
- check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc;
-
- BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE);
- BFD_ASSERT (input_bfd->xvec->header_byteorder
- == output_bfd->xvec->header_byteorder);
-
- relocatable = finfo->info->relocatable;
- syms = obj_aout_external_syms (input_bfd);
- strings = obj_aout_external_strings (input_bfd);
- sym_hashes = obj_aout_sym_hashes (input_bfd);
- symbol_map = finfo->symbol_map;
-
- reloc_count = rel_size / RELOC_STD_SIZE;
- rel = relocs;
- rel_end = rel + reloc_count;
- for (; rel < rel_end; rel++)
- {
- bfd_vma r_addr;
- int r_index;
- int r_extern;
- int r_pcrel;
- int r_baserel = 0;
- reloc_howto_type *howto;
- struct aout_link_hash_entry *h = NULL;
- bfd_vma relocation;
- bfd_reloc_status_type r;
-
- r_addr = GET_SWORD (input_bfd, rel->r_address);
-
-#ifdef MY_reloc_howto
- howto = MY_reloc_howto (input_bfd, rel, r_index, r_extern, r_pcrel);
-#else
- {
- int r_jmptable;
- int r_relative;
- int r_length;
- unsigned int howto_idx;
-
- if (bfd_header_big_endian (input_bfd))
- {
- r_index = (((unsigned int) rel->r_index[0] << 16)
- | ((unsigned int) rel->r_index[1] << 8)
- | rel->r_index[2]);
- r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
- r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
- r_baserel = (0 != (rel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
- r_jmptable= (0 != (rel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG));
- r_relative= (0 != (rel->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG));
- r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
- >> RELOC_STD_BITS_LENGTH_SH_BIG);
- }
- else
- {
- r_index = (((unsigned int) rel->r_index[2] << 16)
- | ((unsigned int) rel->r_index[1] << 8)
- | rel->r_index[0]);
- r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
- r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
- r_baserel = (0 != (rel->r_type[0]
- & RELOC_STD_BITS_BASEREL_LITTLE));
- r_jmptable= (0 != (rel->r_type[0]
- & RELOC_STD_BITS_JMPTABLE_LITTLE));
- r_relative= (0 != (rel->r_type[0]
- & RELOC_STD_BITS_RELATIVE_LITTLE));
- r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
- >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
- }
-
- howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel
- + 16 * r_jmptable + 32 * r_relative);
- BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std));
- howto = howto_table_std + howto_idx;
- }
-#endif
-
- if (relocatable)
- {
- /* We are generating a relocatable output file, and must
- modify the reloc accordingly. */
- if (r_extern)
- {
- /* If we know the symbol this relocation is against,
- convert it into a relocation against a section. This
- is what the native linker does. */
- h = sym_hashes[r_index];
- if (h != (struct aout_link_hash_entry *) NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- asection *output_section;
-
- /* Change the r_extern value. */
- if (bfd_header_big_endian (output_bfd))
- rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_BIG;
- else
- rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_LITTLE;
-
- /* Compute a new r_index. */
- output_section = h->root.u.def.section->output_section;
- if (output_section == obj_textsec (output_bfd))
- r_index = N_TEXT;
- else if (output_section == obj_datasec (output_bfd))
- r_index = N_DATA;
- else if (output_section == obj_bsssec (output_bfd))
- r_index = N_BSS;
- else
- r_index = N_ABS;
-
- /* Add the symbol value and the section VMA to the
- addend stored in the contents. */
- relocation = (h->root.u.def.value
- + output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else
- {
- /* We must change r_index according to the symbol
- map. */
- r_index = symbol_map[r_index];
-
- if (r_index == -1)
- {
- if (h != NULL)
- {
- /* We decided to strip this symbol, but it
- turns out that we can't. Note that we
- lose the other and desc information here.
- I don't think that will ever matter for a
- global symbol. */
- if (h->indx < 0)
- {
- h->indx = -2;
- h->written = FALSE;
- if (! aout_link_write_other_symbol (h,
- (PTR) finfo))
- return FALSE;
- }
- r_index = h->indx;
- }
- else
- {
- const char *name;
-
- name = strings + GET_WORD (input_bfd,
- syms[r_index].e_strx);
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, name, input_bfd, input_section,
- r_addr)))
- return FALSE;
- r_index = 0;
- }
- }
-
- relocation = 0;
- }
-
- /* Write out the new r_index value. */
- if (bfd_header_big_endian (output_bfd))
- {
- rel->r_index[0] = r_index >> 16;
- rel->r_index[1] = r_index >> 8;
- rel->r_index[2] = r_index;
- }
- else
- {
- rel->r_index[2] = r_index >> 16;
- rel->r_index[1] = r_index >> 8;
- rel->r_index[0] = r_index;
- }
- }
- else
- {
- asection *section;
-
- /* This is a relocation against a section. We must
- adjust by the amount that the section moved. */
- section = aout_reloc_index_to_section (input_bfd, r_index);
- relocation = (section->output_section->vma
- + section->output_offset
- - section->vma);
- }
-
- /* Change the address of the relocation. */
- PUT_WORD (output_bfd,
- r_addr + input_section->output_offset,
- rel->r_address);
-
- /* Adjust a PC relative relocation by removing the reference
- to the original address in the section and including the
- reference to the new address. */
- if (r_pcrel)
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma);
-
-#ifdef MY_relocatable_reloc
- MY_relocatable_reloc (howto, output_bfd, rel, relocation, r_addr);
-#endif
-
- if (relocation == 0)
- r = bfd_reloc_ok;
- else
- r = MY_relocate_contents (howto,
- input_bfd, relocation,
- contents + r_addr);
- }
- else
- {
- bfd_boolean hundef;
-
- /* We are generating an executable, and must do a full
- relocation. */
- hundef = FALSE;
-
- if (r_extern)
- {
- h = sym_hashes[r_index];
-
- if (h != (struct aout_link_hash_entry *) NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- relocation = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else if (h != (struct aout_link_hash_entry *) NULL
- && h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else
- {
- hundef = TRUE;
- relocation = 0;
- }
- }
- else
- {
- asection *section;
-
- section = aout_reloc_index_to_section (input_bfd, r_index);
- relocation = (section->output_section->vma
- + section->output_offset
- - section->vma);
- if (r_pcrel)
- relocation += input_section->vma;
- }
-
- if (check_dynamic_reloc != NULL)
- {
- bfd_boolean skip;
-
- if (! ((*check_dynamic_reloc)
- (finfo->info, input_bfd, input_section, h,
- (PTR) rel, contents, &skip, &relocation)))
- return FALSE;
- if (skip)
- continue;
- }
-
- /* Now warn if a global symbol is undefined. We could not
- do this earlier, because check_dynamic_reloc might want
- to skip this reloc. */
- if (hundef && ! finfo->info->shared && ! r_baserel)
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
- if (! ((*finfo->info->callbacks->undefined_symbol)
- (finfo->info, name, input_bfd, input_section,
- r_addr, TRUE)))
- return FALSE;
- }
-
- r = MY_final_link_relocate (howto,
- input_bfd, input_section,
- contents, r_addr, relocation,
- (bfd_vma) 0);
- }
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else if (r_extern)
- name = strings + GET_WORD (input_bfd,
- syms[r_index].e_strx);
- else
- {
- asection *s;
-
- s = aout_reloc_index_to_section (input_bfd, r_index);
- name = bfd_section_name (input_bfd, s);
- }
- if (! ((*finfo->info->callbacks->reloc_overflow)
- (finfo->info, name, howto->name,
- (bfd_vma) 0, input_bfd, input_section, r_addr)))
- return FALSE;
- }
- break;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Relocate an a.out section using extended a.out relocs. */
-
-static bfd_boolean
-aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
- rel_size, contents)
- struct aout_final_link_info *finfo;
- bfd *input_bfd;
- asection *input_section;
- struct reloc_ext_external *relocs;
- bfd_size_type rel_size;
- bfd_byte *contents;
-{
- bfd_boolean (*check_dynamic_reloc)
- PARAMS ((struct bfd_link_info *, bfd *, asection *,
- struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
- bfd_vma *));
- bfd *output_bfd;
- bfd_boolean relocatable;
- struct external_nlist *syms;
- char *strings;
- struct aout_link_hash_entry **sym_hashes;
- int *symbol_map;
- bfd_size_type reloc_count;
- register struct reloc_ext_external *rel;
- struct reloc_ext_external *rel_end;
-
- output_bfd = finfo->output_bfd;
- check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc;
-
- BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_EXT_SIZE);
- BFD_ASSERT (input_bfd->xvec->header_byteorder
- == output_bfd->xvec->header_byteorder);
-
- relocatable = finfo->info->relocatable;
- syms = obj_aout_external_syms (input_bfd);
- strings = obj_aout_external_strings (input_bfd);
- sym_hashes = obj_aout_sym_hashes (input_bfd);
- symbol_map = finfo->symbol_map;
-
- reloc_count = rel_size / RELOC_EXT_SIZE;
- rel = relocs;
- rel_end = rel + reloc_count;
- for (; rel < rel_end; rel++)
- {
- bfd_vma r_addr;
- int r_index;
- int r_extern;
- unsigned int r_type;
- bfd_vma r_addend;
- struct aout_link_hash_entry *h = NULL;
- asection *r_section = NULL;
- bfd_vma relocation;
-
- r_addr = GET_SWORD (input_bfd, rel->r_address);
-
- if (bfd_header_big_endian (input_bfd))
- {
- r_index = (((unsigned int) rel->r_index[0] << 16)
- | ((unsigned int) rel->r_index[1] << 8)
- | rel->r_index[2]);
- r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
- r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
- >> RELOC_EXT_BITS_TYPE_SH_BIG);
- }
- else
- {
- r_index = (((unsigned int) rel->r_index[2] << 16)
- | ((unsigned int) rel->r_index[1] << 8)
- | rel->r_index[0]);
- r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
- r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
- >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
- }
-
- r_addend = GET_SWORD (input_bfd, rel->r_addend);
-
- BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext));
-
- if (relocatable)
- {
- /* We are generating a relocatable output file, and must
- modify the reloc accordingly. */
- if (r_extern
- || r_type == (unsigned int) RELOC_BASE10
- || r_type == (unsigned int) RELOC_BASE13
- || r_type == (unsigned int) RELOC_BASE22)
- {
- /* If we know the symbol this relocation is against,
- convert it into a relocation against a section. This
- is what the native linker does. */
- if (r_type == (unsigned int) RELOC_BASE10
- || r_type == (unsigned int) RELOC_BASE13
- || r_type == (unsigned int) RELOC_BASE22)
- h = NULL;
- else
- h = sym_hashes[r_index];
- if (h != (struct aout_link_hash_entry *) NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- asection *output_section;
-
- /* Change the r_extern value. */
- if (bfd_header_big_endian (output_bfd))
- rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_BIG;
- else
- rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_LITTLE;
-
- /* Compute a new r_index. */
- output_section = h->root.u.def.section->output_section;
- if (output_section == obj_textsec (output_bfd))
- r_index = N_TEXT;
- else if (output_section == obj_datasec (output_bfd))
- r_index = N_DATA;
- else if (output_section == obj_bsssec (output_bfd))
- r_index = N_BSS;
- else
- r_index = N_ABS;
-
- /* Add the symbol value and the section VMA to the
- addend. */
- relocation = (h->root.u.def.value
- + output_section->vma
- + h->root.u.def.section->output_offset);
-
- /* Now RELOCATION is the VMA of the final
- destination. If this is a PC relative reloc,
- then ADDEND is the negative of the source VMA.
- We want to set ADDEND to the difference between
- the destination VMA and the source VMA, which
- means we must adjust RELOCATION by the change in
- the source VMA. This is done below. */
- }
- else
- {
- /* We must change r_index according to the symbol
- map. */
- r_index = symbol_map[r_index];
-
- if (r_index == -1)
- {
- if (h != NULL)
- {
- /* We decided to strip this symbol, but it
- turns out that we can't. Note that we
- lose the other and desc information here.
- I don't think that will ever matter for a
- global symbol. */
- if (h->indx < 0)
- {
- h->indx = -2;
- h->written = FALSE;
- if (! aout_link_write_other_symbol (h,
- (PTR) finfo))
- return FALSE;
- }
- r_index = h->indx;
- }
- else
- {
- const char *name;
-
- name = strings + GET_WORD (input_bfd,
- syms[r_index].e_strx);
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, name, input_bfd, input_section,
- r_addr)))
- return FALSE;
- r_index = 0;
- }
- }
-
- relocation = 0;
-
- /* If this is a PC relative reloc, then the addend
- is the negative of the source VMA. We must
- adjust it by the change in the source VMA. This
- is done below. */
- }
-
- /* Write out the new r_index value. */
- if (bfd_header_big_endian (output_bfd))
- {
- rel->r_index[0] = r_index >> 16;
- rel->r_index[1] = r_index >> 8;
- rel->r_index[2] = r_index;
- }
- else
- {
- rel->r_index[2] = r_index >> 16;
- rel->r_index[1] = r_index >> 8;
- rel->r_index[0] = r_index;
- }
- }
- else
- {
- /* This is a relocation against a section. We must
- adjust by the amount that the section moved. */
- r_section = aout_reloc_index_to_section (input_bfd, r_index);
- relocation = (r_section->output_section->vma
- + r_section->output_offset
- - r_section->vma);
-
- /* If this is a PC relative reloc, then the addend is
- the difference in VMA between the destination and the
- source. We have just adjusted for the change in VMA
- of the destination, so we must also adjust by the
- change in VMA of the source. This is done below. */
- }
-
- /* As described above, we must always adjust a PC relative
- reloc by the change in VMA of the source. However, if
- pcrel_offset is set, then the addend does not include the
- location within the section, in which case we don't need
- to adjust anything. */
- if (howto_table_ext[r_type].pc_relative
- && ! howto_table_ext[r_type].pcrel_offset)
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma);
-
- /* Change the addend if necessary. */
- if (relocation != 0)
- PUT_WORD (output_bfd, r_addend + relocation, rel->r_addend);
-
- /* Change the address of the relocation. */
- PUT_WORD (output_bfd,
- r_addr + input_section->output_offset,
- rel->r_address);
- }
- else
- {
- bfd_boolean hundef;
- bfd_reloc_status_type r;
-
- /* We are generating an executable, and must do a full
- relocation. */
- hundef = FALSE;
-
- if (r_extern)
- {
- h = sym_hashes[r_index];
-
- if (h != (struct aout_link_hash_entry *) NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- relocation = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else if (h != (struct aout_link_hash_entry *) NULL
- && h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else
- {
- hundef = TRUE;
- relocation = 0;
- }
- }
- else if (r_type == (unsigned int) RELOC_BASE10
- || r_type == (unsigned int) RELOC_BASE13
- || r_type == (unsigned int) RELOC_BASE22)
- {
- struct external_nlist *sym;
- int type;
-
- /* 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 = H_GET_8 (input_bfd, sym->e_type);
- if ((type & N_TYPE) == N_TEXT
- || type == N_WEAKT)
- r_section = obj_textsec (input_bfd);
- else if ((type & N_TYPE) == N_DATA
- || type == N_WEAKD)
- r_section = obj_datasec (input_bfd);
- else if ((type & N_TYPE) == N_BSS
- || type == N_WEAKB)
- r_section = obj_bsssec (input_bfd);
- else if ((type & N_TYPE) == N_ABS
- || type == N_WEAKA)
- r_section = bfd_abs_section_ptr;
- else
- abort ();
- relocation = (r_section->output_section->vma
- + r_section->output_offset
- + (GET_WORD (input_bfd, sym->e_value)
- - r_section->vma));
- }
- else
- {
- r_section = aout_reloc_index_to_section (input_bfd, r_index);
-
- /* If this is a PC relative reloc, then R_ADDEND is the
- difference between the two vmas, or
- old_dest_sec + old_dest_off - (old_src_sec + old_src_off)
- where
- old_dest_sec == section->vma
- and
- old_src_sec == input_section->vma
- and
- old_src_off == r_addr
-
- _bfd_final_link_relocate expects RELOCATION +
- R_ADDEND to be the VMA of the destination minus
- r_addr (the minus r_addr is because this relocation
- is not pcrel_offset, which is a bit confusing and
- should, perhaps, be changed), or
- new_dest_sec
- where
- new_dest_sec == output_section->vma + output_offset
- We arrange for this to happen by setting RELOCATION to
- new_dest_sec + old_src_sec - old_dest_sec
-
- If this is not a PC relative reloc, then R_ADDEND is
- simply the VMA of the destination, so we set
- RELOCATION to the change in the destination VMA, or
- new_dest_sec - old_dest_sec
- */
- relocation = (r_section->output_section->vma
- + r_section->output_offset
- - r_section->vma);
- if (howto_table_ext[r_type].pc_relative)
- relocation += input_section->vma;
- }
-
- if (check_dynamic_reloc != NULL)
- {
- bfd_boolean skip;
-
- if (! ((*check_dynamic_reloc)
- (finfo->info, input_bfd, input_section, h,
- (PTR) rel, contents, &skip, &relocation)))
- return FALSE;
- if (skip)
- continue;
- }
-
- /* Now warn if a global symbol is undefined. We could not
- do this earlier, because check_dynamic_reloc might want
- to skip this reloc. */
- if (hundef
- && ! finfo->info->shared
- && r_type != (unsigned int) RELOC_BASE10
- && r_type != (unsigned int) RELOC_BASE13
- && r_type != (unsigned int) RELOC_BASE22)
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
- if (! ((*finfo->info->callbacks->undefined_symbol)
- (finfo->info, name, input_bfd, input_section,
- r_addr, TRUE)))
- return FALSE;
- }
-
- if (r_type != (unsigned int) RELOC_SPARC_REV32)
- r = MY_final_link_relocate (howto_table_ext + r_type,
- input_bfd, input_section,
- contents, r_addr, relocation,
- r_addend);
- else
- {
- bfd_vma x;
-
- x = bfd_get_32 (input_bfd, contents + r_addr);
- x = x + relocation + r_addend;
- bfd_putl32 (/*input_bfd,*/ x, contents + r_addr);
- r = bfd_reloc_ok;
- }
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else if (r_extern
- || r_type == (unsigned int) RELOC_BASE10
- || r_type == (unsigned int) RELOC_BASE13
- || r_type == (unsigned int) RELOC_BASE22)
- name = strings + GET_WORD (input_bfd,
- syms[r_index].e_strx);
- else
- {
- asection *s;
-
- s = aout_reloc_index_to_section (input_bfd, r_index);
- name = bfd_section_name (input_bfd, s);
- }
- if (! ((*finfo->info->callbacks->reloc_overflow)
- (finfo->info, name, howto_table_ext[r_type].name,
- r_addend, input_bfd, input_section, r_addr)))
- return FALSE;
- }
- break;
- }
- }
- }
- }
-
- return TRUE;
-}
-
-/* Handle a link order which is supposed to generate a reloc. */
-
-static bfd_boolean
-aout_link_reloc_link_order (finfo, o, p)
- struct aout_final_link_info *finfo;
- asection *o;
- struct bfd_link_order *p;
-{
- struct bfd_link_order_reloc *pr;
- int r_index;
- int r_extern;
- reloc_howto_type *howto;
- file_ptr *reloff_ptr = NULL;
- struct reloc_std_external srel;
- struct reloc_ext_external erel;
- PTR rel_ptr;
- bfd_size_type amt;
-
- pr = p->u.reloc.p;
-
- if (p->type == bfd_section_reloc_link_order)
- {
- r_extern = 0;
- if (bfd_is_abs_section (pr->u.section))
- r_index = N_ABS | N_EXT;
- else
- {
- BFD_ASSERT (pr->u.section->owner == finfo->output_bfd);
- r_index = pr->u.section->target_index;
- }
- }
- else
- {
- struct aout_link_hash_entry *h;
-
- BFD_ASSERT (p->type == bfd_symbol_reloc_link_order);
- r_extern = 1;
- h = ((struct aout_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info,
- pr->u.name, FALSE, FALSE, TRUE));
- if (h != (struct aout_link_hash_entry *) NULL
- && h->indx >= 0)
- r_index = h->indx;
- else if (h != NULL)
- {
- /* We decided to strip this symbol, but it turns out that we
- can't. Note that we lose the other and desc information
- here. I don't think that will ever matter for a global
- symbol. */
- h->indx = -2;
- h->written = FALSE;
- if (! aout_link_write_other_symbol (h, (PTR) finfo))
- return FALSE;
- r_index = h->indx;
- }
- else
- {
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, pr->u.name, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- return FALSE;
- r_index = 0;
- }
- }
-
- howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc);
- if (howto == 0)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (o == obj_textsec (finfo->output_bfd))
- reloff_ptr = &finfo->treloff;
- else if (o == obj_datasec (finfo->output_bfd))
- reloff_ptr = &finfo->dreloff;
- else
- abort ();
-
- if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE)
- {
-#ifdef MY_put_reloc
- MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto,
- &srel);
-#else
- {
- int r_pcrel;
- int r_baserel;
- int r_jmptable;
- int r_relative;
- int r_length;
-
- r_pcrel = (int) howto->pc_relative;
- r_baserel = (howto->type & 8) != 0;
- r_jmptable = (howto->type & 16) != 0;
- r_relative = (howto->type & 32) != 0;
- r_length = howto->size;
-
- PUT_WORD (finfo->output_bfd, p->offset, srel.r_address);
- if (bfd_header_big_endian (finfo->output_bfd))
- {
- srel.r_index[0] = r_index >> 16;
- srel.r_index[1] = r_index >> 8;
- srel.r_index[2] = r_index;
- srel.r_type[0] =
- ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0)
- | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0)
- | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0)
- | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
- }
- else
- {
- srel.r_index[2] = r_index >> 16;
- srel.r_index[1] = r_index >> 8;
- srel.r_index[0] = r_index;
- srel.r_type[0] =
- ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0)
- | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0)
- | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0)
- | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0)
- | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
- }
- }
-#endif
- rel_ptr = (PTR) &srel;
-
- /* We have to write the addend into the object file, since
- standard a.out relocs are in place. It would be more
- reliable if we had the current contents of the file here,
- rather than assuming zeroes, but we can't read the file since
- it was opened using bfd_openw. */
- if (pr->addend != 0)
- {
- bfd_size_type size;
- bfd_reloc_status_type r;
- bfd_byte *buf;
- bfd_boolean ok;
-
- size = bfd_get_reloc_size (howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
- if (buf == (bfd_byte *) NULL)
- return FALSE;
- r = MY_relocate_contents (howto, finfo->output_bfd,
- (bfd_vma) pr->addend, buf);
- switch (r)
- {
- case bfd_reloc_ok:
- break;
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- if (! ((*finfo->info->callbacks->reloc_overflow)
- (finfo->info,
- (p->type == bfd_section_reloc_link_order
- ? bfd_section_name (finfo->output_bfd,
- pr->u.section)
- : pr->u.name),
- howto->name, pr->addend, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- {
- free (buf);
- return FALSE;
- }
- break;
- }
- ok = bfd_set_section_contents (finfo->output_bfd, o, (PTR) buf,
- (file_ptr) p->offset, size);
- free (buf);
- if (! ok)
- return FALSE;
- }
- }
- else
- {
-#ifdef MY_put_ext_reloc
- MY_put_ext_reloc (finfo->output_bfd, r_extern, r_index, p->offset,
- howto, &erel, pr->addend);
-#else
- PUT_WORD (finfo->output_bfd, p->offset, erel.r_address);
-
- if (bfd_header_big_endian (finfo->output_bfd))
- {
- erel.r_index[0] = r_index >> 16;
- erel.r_index[1] = r_index >> 8;
- erel.r_index[2] = r_index;
- erel.r_type[0] =
- ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0)
- | (howto->type << RELOC_EXT_BITS_TYPE_SH_BIG));
- }
- else
- {
- erel.r_index[2] = r_index >> 16;
- erel.r_index[1] = r_index >> 8;
- erel.r_index[0] = r_index;
- erel.r_type[0] =
- (r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0)
- | (howto->type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
- }
-
- 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_bwrite (rel_ptr, amt, finfo->output_bfd) != amt)
- return FALSE;
-
- *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd);
-
- /* Assert that the relocs have not run into the symbols, and that n
- the text relocs have not run into the data relocs. */
- BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
- && (reloff_ptr != &finfo->treloff
- || (*reloff_ptr
- <= obj_datasec (finfo->output_bfd)->rel_filepos)));
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c
deleted file mode 100644
index ba6e684..0000000
--- a/contrib/binutils/bfd/archive.c
+++ /dev/null
@@ -1,2159 +0,0 @@
-/* BFD back-end for archive files (libraries).
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-@setfilename archive-info
-SECTION
- Archives
-
-DESCRIPTION
- An archive (or library) is just another BFD. It has a symbol
- table, although there's not much a user program will do with it.
-
- The big difference between an archive BFD and an ordinary BFD
- is that the archive doesn't have sections. Instead it has a
- chain of BFDs that are considered its contents. These BFDs can
- be manipulated like any other. The BFDs contained in an
- archive opened for reading will all be opened for reading. You
- may put either input or output BFDs into an archive opened for
- output; they will be handled correctly when the archive is closed.
-
- Use <<bfd_openr_next_archived_file>> to step through
- the contents of an archive opened for input. You don't
- have to read the entire archive if you don't want
- to! Read it until you find what you want.
-
- Archive contents of output BFDs are chained through the
- <<next>> pointer in a BFD. The first one is findable through
- the <<archive_head>> slot of the archive. Set it with
- <<bfd_set_archive_head>> (q.v.). A given BFD may be in only one
- open output archive at a time.
-
- As expected, the BFD archive code is more general than the
- archive code of any given environment. BFD archives may
- contain files of different formats (e.g., a.out and coff) and
- even different architectures. You may even place archives
- recursively into archives!
-
- This can cause unexpected confusion, since some archive
- formats are more expressive than others. For instance, Intel
- COFF archives can preserve long filenames; SunOS a.out archives
- cannot. If you move a file from the first to the second
- format and back again, the filename may be truncated.
- Likewise, different a.out environments have different
- conventions as to how they truncate filenames, whether they
- preserve directory names in filenames, etc. When
- interoperating with native tools, be sure your files are
- homogeneous.
-
- Beware: most of these formats do not react well to the
- presence of spaces in filenames. We do the best we can, but
- can't always handle this case due to restrictions in the format of
- archives. Many Unix utilities are braindead in regards to
- spaces and such in filenames anyway, so this shouldn't be much
- of a restriction.
-
- Archives are supported in BFD in <<archive.c>>.
-
-*/
-
-/* Assumes:
- o - all archive elements start on an even boundary, newline padded;
- o - all arch headers are char *;
- o - all arch headers are the same size (across architectures).
-*/
-
-/* Some formats provide a way to cram a long filename into the short
- (16 chars) space provided by a BSD archive. The trick is: make a
- special "file" in the front of the archive, sort of like the SYMDEF
- entry. If the filename is too long to fit, put it in the extended
- name table, and use its index as the filename. To prevent
- confusion prepend the index with a space. This means you can't
- have filenames that start with a space, but then again, many Unix
- utilities can't handle that anyway.
-
- This scheme unfortunately requires that you stand on your head in
- order to write an archive since you need to put a magic file at the
- front, and need to touch every entry to do so. C'est la vie.
-
- We support two variants of this idea:
- The SVR4 format (extended name table is named "//"),
- and an extended pseudo-BSD variant (extended name table is named
- "ARFILENAMES/"). The origin of the latter format is uncertain.
-
- BSD 4.4 uses a third scheme: It writes a long filename
- directly after the header. This allows 'ar q' to work.
- We currently can read BSD 4.4 archives, but not write them.
-*/
-
-/* Summary of archive member names:
-
- Symbol table (must be first):
- "__.SYMDEF " - Symbol table, Berkeley style, produced by ranlib.
- "/ " - Symbol table, system 5 style.
-
- Long name table (must be before regular file members):
- "// " - Long name table, System 5 R4 style.
- "ARFILENAMES/ " - Long name table, non-standard extended BSD (not BSD 4.4).
-
- Regular file members with short names:
- "filename.o/ " - Regular file, System 5 style (embedded spaces ok).
- "filename.o " - Regular file, Berkeley style (no embedded spaces).
-
- Regular files with long names (or embedded spaces, for BSD variants):
- "/18 " - SVR4 style, name at offset 18 in name table.
- "#1/23 " - Long name (or embedded paces) 23 characters long,
- BSD 4.4 style, full name follows header.
- Implemented for reading, not writing.
- " 18 " - Long name 18 characters long, extended pseudo-BSD.
- */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/ar.h"
-#include "aout/ranlib.h"
-#include "safe-ctype.h"
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef GNU960
-#define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB)
-#endif
-
-/* We keep a cache of archive filepointers to archive elements to
- speed up searching the archive by filepos. We only add an entry to
- the cache when we actually read one. We also don't sort the cache;
- it's generally short enough to search linearly.
- Note that the pointers here point to the front of the ar_hdr, not
- to the front of the contents! */
-struct ar_cache {
- file_ptr ptr;
- bfd *arelt;
- struct ar_cache *next;
-};
-
-#define ar_padchar(abfd) ((abfd)->xvec->ar_pad_char)
-#define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen)
-
-#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
-#define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata(bfd)->arch_header)
-
-
-bfd_boolean
-_bfd_generic_mkarchive (bfd *abfd)
-{
- bfd_size_type amt = sizeof (struct artdata);
-
- abfd->tdata.aout_ar_data = bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd) == NULL)
- return FALSE;
-
- bfd_ardata (abfd)->cache = NULL;
- bfd_ardata (abfd)->archive_head = NULL;
- bfd_ardata (abfd)->symdefs = NULL;
- bfd_ardata (abfd)->extended_names = NULL;
- bfd_ardata (abfd)->tdata = NULL;
-
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_get_next_mapent
-
-SYNOPSIS
- symindex bfd_get_next_mapent
- (bfd *abfd, symindex previous, carsym **sym);
-
-DESCRIPTION
- Step through archive @var{abfd}'s symbol table (if it
- has one). Successively update @var{sym} with the next symbol's
- information, returning that symbol's (internal) index into the
- symbol table.
-
- Supply <<BFD_NO_MORE_SYMBOLS>> as the @var{previous} entry to get
- the first one; returns <<BFD_NO_MORE_SYMBOLS>> when you've already
- got the last one.
-
- A <<carsym>> is a canonical archive symbol. The only
- user-visible element is its name, a null-terminated string.
-*/
-
-symindex
-bfd_get_next_mapent (bfd *abfd, symindex prev, carsym **entry)
-{
- if (!bfd_has_map (abfd))
- {
- bfd_set_error (bfd_error_invalid_operation);
- return BFD_NO_MORE_SYMBOLS;
- }
-
- if (prev == BFD_NO_MORE_SYMBOLS)
- prev = 0;
- else
- ++prev;
- if (prev >= bfd_ardata (abfd)->symdef_count)
- return BFD_NO_MORE_SYMBOLS;
-
- *entry = (bfd_ardata (abfd)->symdefs + prev);
- return prev;
-}
-
-/* To be called by backends only */
-
-bfd *
-_bfd_create_empty_archive_element_shell (bfd *obfd)
-{
- return _bfd_new_bfd_contained_in (obfd);
-}
-
-/*
-FUNCTION
- bfd_set_archive_head
-
-SYNOPSIS
- bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
-
-DESCRIPTION
- Set the head of the chain of
- BFDs contained in the archive @var{output} to @var{new_head}.
-*/
-
-bfd_boolean
-bfd_set_archive_head (bfd *output_archive, bfd *new_head)
-{
- output_archive->archive_head = new_head;
- return TRUE;
-}
-
-bfd *
-_bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos)
-{
- struct ar_cache *current;
-
- for (current = bfd_ardata (arch_bfd)->cache; current != NULL;
- current = current->next)
- if (current->ptr == filepos)
- return current->arelt;
-
- return NULL;
-}
-
-/* Kind of stupid to call cons for each one, but we don't do too many */
-bfd_boolean
-_bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt)
-{
- bfd_size_type amt = sizeof (struct ar_cache);
-
- struct ar_cache *new_cache = bfd_zalloc (arch_bfd, amt);
- if (new_cache == NULL)
- return FALSE;
-
- new_cache->ptr = filepos;
- new_cache->arelt = new_elt;
- new_cache->next = NULL;
- if (bfd_ardata (arch_bfd)->cache == NULL)
- bfd_ardata (arch_bfd)->cache = new_cache;
- else
- {
- struct ar_cache *current = bfd_ardata (arch_bfd)->cache;
-
- while (current->next != NULL)
- current = current->next;
- current->next = new_cache;
- }
-
- return TRUE;
-}
-
-/* The name begins with space. Hence the rest of the name is an index into
- the string table. */
-
-static char *
-get_extended_arelt_filename (bfd *arch, const char *name)
-{
- unsigned long index = 0;
-
- /* Should extract string so that I can guarantee not to overflow into
- the next region, but I'm too lazy. */
- errno = 0;
- /* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
- index = strtol (name + 1, NULL, 10);
- if (errno != 0)
- {
- bfd_set_error (bfd_error_malformed_archive);
- return NULL;
- }
-
- return bfd_ardata (arch)->extended_names + index;
-}
-
-/* This functions reads an arch header and returns an areltdata pointer, or
- NULL on error.
-
- Presumes the file pointer is already in the right place (ie pointing
- to the ar_hdr in the file). Moves the file pointer; on success it
- should be pointing to the front of the file contents; on failure it
- could have been moved arbitrarily.
-*/
-
-void *
-_bfd_generic_read_ar_hdr (bfd *abfd)
-{
- return _bfd_generic_read_ar_hdr_mag (abfd, NULL);
-}
-
-/* Alpha ECOFF uses an optional different ARFMAG value, so we have a
- variant of _bfd_generic_read_ar_hdr which accepts a magic string. */
-
-void *
-_bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
-{
- struct ar_hdr hdr;
- char *hdrp = (char *) &hdr;
- size_t parsed_size;
- struct areltdata *ared;
- char *filename = NULL;
- bfd_size_type namelen = 0;
- bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
- char *allocptr = 0;
-
- if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_no_more_archived_files);
- return NULL;
- }
- if (strncmp (hdr.ar_fmag, ARFMAG, 2) != 0
- && (mag == NULL
- || strncmp (hdr.ar_fmag, mag, 2) != 0))
- {
- bfd_set_error (bfd_error_malformed_archive);
- return NULL;
- }
-
- errno = 0;
- parsed_size = strtol (hdr.ar_size, NULL, 10);
- if (errno != 0)
- {
- bfd_set_error (bfd_error_malformed_archive);
- return NULL;
- }
-
- /* Extract the filename from the archive - there are two ways to
- specify an extended name table, either the first char of the
- name is a space, or it's a slash. */
- if ((hdr.ar_name[0] == '/'
- || (hdr.ar_name[0] == ' '
- && memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)) == NULL))
- && bfd_ardata (abfd)->extended_names != NULL)
- {
- filename = get_extended_arelt_filename (abfd, hdr.ar_name);
- if (filename == NULL)
- {
- bfd_set_error (bfd_error_malformed_archive);
- return NULL;
- }
- }
- /* BSD4.4-style long filename.
- Only implemented for reading, so far! */
- else if (hdr.ar_name[0] == '#'
- && hdr.ar_name[1] == '1'
- && hdr.ar_name[2] == '/'
- && ISDIGIT (hdr.ar_name[3]))
- {
- /* BSD-4.4 extended name */
- namelen = atoi (&hdr.ar_name[3]);
- allocsize += namelen + 1;
- parsed_size -= namelen;
-
- allocptr = bfd_zalloc (abfd, allocsize);
- if (allocptr == NULL)
- return NULL;
- filename = (allocptr
- + sizeof (struct areltdata)
- + sizeof (struct ar_hdr));
- if (bfd_bread (filename, namelen, abfd) != namelen)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_no_more_archived_files);
- return NULL;
- }
- filename[namelen] = '\0';
- }
- else
- {
- /* We judge the end of the name by looking for '/' or ' '.
- Note: The SYSV format (terminated by '/') allows embedded
- spaces, so only look for ' ' if we don't find '/'. */
-
- char *e;
- e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
- if (e == NULL)
- {
- e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
- if (e == NULL)
- e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
- }
-
- if (e != NULL)
- namelen = e - hdr.ar_name;
- else
- {
- /* If we didn't find a termination character, then the name
- must be the entire field. */
- namelen = ar_maxnamelen (abfd);
- }
-
- allocsize += namelen + 1;
- }
-
- if (!allocptr)
- {
- allocptr = bfd_zalloc (abfd, allocsize);
- if (allocptr == NULL)
- return NULL;
- }
-
- ared = (struct areltdata *) allocptr;
-
- ared->arch_header = allocptr + sizeof (struct areltdata);
- memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr));
- ared->parsed_size = parsed_size;
-
- if (filename != NULL)
- ared->filename = filename;
- else
- {
- ared->filename = allocptr + (sizeof (struct areltdata) +
- sizeof (struct ar_hdr));
- if (namelen)
- memcpy (ared->filename, hdr.ar_name, namelen);
- ared->filename[namelen] = '\0';
- }
-
- return ared;
-}
-
-/* This is an internal function; it's mainly used when indexing
- through the archive symbol table, but also used to get the next
- element, since it handles the bookkeeping so nicely for us. */
-
-bfd *
-_bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
-{
- struct areltdata *new_areldata;
- bfd *n_nfd;
-
- n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
- if (n_nfd)
- return n_nfd;
-
- if (0 > bfd_seek (archive, filepos, SEEK_SET))
- return NULL;
-
- if ((new_areldata = _bfd_read_ar_hdr (archive)) == NULL)
- return NULL;
-
- n_nfd = _bfd_create_empty_archive_element_shell (archive);
- if (n_nfd == NULL)
- {
- bfd_release (archive, new_areldata);
- return NULL;
- }
-
- n_nfd->origin = bfd_tell (archive);
- n_nfd->arelt_data = new_areldata;
- n_nfd->filename = new_areldata->filename;
-
- if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
- return n_nfd;
-
- /* Huh? */
- bfd_release (archive, n_nfd);
- bfd_release (archive, new_areldata);
- return NULL;
-}
-
-/* Return the BFD which is referenced by the symbol in ABFD indexed by
- INDEX. INDEX should have been returned by bfd_get_next_mapent. */
-
-bfd *
-_bfd_generic_get_elt_at_index (bfd *abfd, symindex index)
-{
- carsym *entry;
-
- entry = bfd_ardata (abfd)->symdefs + index;
- return _bfd_get_elt_at_filepos (abfd, entry->file_offset);
-}
-
-/*
-FUNCTION
- bfd_openr_next_archived_file
-
-SYNOPSIS
- bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-
-DESCRIPTION
- Provided a BFD, @var{archive}, containing an archive and NULL, open
- an input BFD on the first contained element and returns that.
- Subsequent calls should pass
- the archive and the previous return value to return a created
- BFD to the next contained element. NULL is returned when there
- are no more.
-*/
-
-bfd *
-bfd_openr_next_archived_file (bfd *archive, bfd *last_file)
-{
- if ((bfd_get_format (archive) != bfd_archive) ||
- (archive->direction == write_direction))
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- return BFD_SEND (archive,
- openr_next_archived_file, (archive, last_file));
-}
-
-bfd *
-bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
-{
- file_ptr filestart;
-
- if (!last_file)
- filestart = bfd_ardata (archive)->first_file_filepos;
- else
- {
- unsigned int size = arelt_size (last_file);
- /* Pad to an even boundary...
- Note that last_file->origin can be odd in the case of
- BSD-4.4-style element with a long odd size. */
- filestart = last_file->origin + size;
- filestart += filestart % 2;
- }
-
- return _bfd_get_elt_at_filepos (archive, filestart);
-}
-
-const bfd_target *
-bfd_generic_archive_p (bfd *abfd)
-{
- struct artdata *tdata_hold;
- char armag[SARMAG + 1];
- bfd_size_type amt;
-
- if (bfd_bread (armag, SARMAG, abfd) != SARMAG)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
-#ifdef GNU960
- if (strncmp (armag, BFD_GNU960_ARMAG (abfd), SARMAG) != 0)
- return 0;
-#else
- if (strncmp (armag, ARMAG, SARMAG) != 0 &&
- strncmp (armag, ARMAGB, SARMAG) != 0)
- return 0;
-#endif
-
- tdata_hold = bfd_ardata (abfd);
-
- amt = sizeof (struct artdata);
- bfd_ardata (abfd) = bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd) == NULL)
- {
- bfd_ardata (abfd) = tdata_hold;
- return NULL;
- }
-
- bfd_ardata (abfd)->first_file_filepos = SARMAG;
- bfd_ardata (abfd)->cache = NULL;
- bfd_ardata (abfd)->archive_head = NULL;
- bfd_ardata (abfd)->symdefs = NULL;
- bfd_ardata (abfd)->extended_names = NULL;
- bfd_ardata (abfd)->tdata = NULL;
-
- if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))
- || !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- bfd_release (abfd, bfd_ardata (abfd));
- bfd_ardata (abfd) = tdata_hold;
- return NULL;
- }
-
- if (bfd_has_map (abfd))
- {
- bfd *first;
-
- /* This archive has a map, so we may presume that the contents
- are object files. Make sure that if the first file in the
- archive can be recognized as an object file, it is for this
- target. If not, assume that this is the wrong format. If
- the first file is not an object file, somebody is doing
- something weird, and we permit it so that ar -t will work.
-
- This is done because any normal format will recognize any
- normal archive, regardless of the format of the object files.
- We do accept an empty archive. */
-
- first = bfd_openr_next_archived_file (abfd, NULL);
- if (first != NULL)
- {
- bfd_boolean fail;
-
- first->target_defaulted = FALSE;
- fail = FALSE;
- if (bfd_check_format (first, bfd_object)
- && first->xvec != abfd->xvec)
- {
-#if 0
- /* We ought to close `first' here, but we can't, because
- we have no way to remove it from the archive cache.
- It's close to impossible to figure out when we can
- release bfd_ardata. FIXME. */
- bfd_close (first);
- bfd_release (abfd, bfd_ardata (abfd));
-#endif
- bfd_set_error (bfd_error_wrong_object_format);
- bfd_ardata (abfd) = tdata_hold;
- return NULL;
- }
- /* And we ought to close `first' here too. */
- }
- }
-
- return abfd->xvec;
-}
-
-/* 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 H_GET_32 to H_GET_64. */
-
-/* The size of an external symdef structure. */
-#define BSD_SYMDEF_SIZE 8
-
-/* The offset from the start of a symdef structure to the file offset. */
-#define BSD_SYMDEF_OFFSET_SIZE 4
-
-/* The size of the symdef count. */
-#define BSD_SYMDEF_COUNT_SIZE 4
-
-/* The size of the string count. */
-#define BSD_STRING_COUNT_SIZE 4
-
-/* Returns FALSE on error, TRUE otherwise */
-
-static bfd_boolean
-do_slurp_bsd_armap (bfd *abfd)
-{
- struct areltdata *mapdata;
- unsigned int counter;
- bfd_byte *raw_armap, *rbase;
- struct artdata *ardata = bfd_ardata (abfd);
- char *stringbase;
- bfd_size_type parsed_size, amt;
- carsym *set;
-
- mapdata = _bfd_read_ar_hdr (abfd);
- if (mapdata == NULL)
- return FALSE;
- parsed_size = mapdata->parsed_size;
- bfd_release (abfd, mapdata); /* Don't need it any more. */
-
- raw_armap = bfd_zalloc (abfd, parsed_size);
- if (raw_armap == NULL)
- return FALSE;
-
- if (bfd_bread (raw_armap, parsed_size, abfd) != parsed_size)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- byebye:
- bfd_release (abfd, raw_armap);
- return FALSE;
- }
-
- 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)
- {
- /* Probably we're using the wrong byte ordering. */
- bfd_set_error (bfd_error_wrong_format);
- goto byebye;
- }
-
- ardata->cache = 0;
- rbase = raw_armap + BSD_SYMDEF_COUNT_SIZE;
- stringbase = ((char *) rbase
- + ardata->symdef_count * BSD_SYMDEF_SIZE
- + BSD_STRING_COUNT_SIZE);
- amt = ardata->symdef_count * sizeof (carsym);
- ardata->symdefs = bfd_alloc (abfd, amt);
- if (!ardata->symdefs)
- return FALSE;
-
- for (counter = 0, set = ardata->symdefs;
- counter < ardata->symdef_count;
- counter++, set++, rbase += BSD_SYMDEF_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);
- /* Pad to an even boundary if you have to. */
- ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
- /* FIXME, we should provide some way to free raw_ardata when
- we are done using the strings from it. For now, it seems
- to be allocated on an objalloc anyway... */
- bfd_has_map (abfd) = TRUE;
- return TRUE;
-}
-
-/* Returns FALSE on error, TRUE otherwise. */
-
-static bfd_boolean
-do_slurp_coff_armap (bfd *abfd)
-{
- struct areltdata *mapdata;
- int *raw_armap, *rawptr;
- struct artdata *ardata = bfd_ardata (abfd);
- char *stringbase;
- bfd_size_type stringsize;
- unsigned int parsed_size;
- carsym *carsyms;
- bfd_size_type nsymz; /* Number of symbols in armap. */
- bfd_vma (*swap) (const void *);
- char int_buf[sizeof (long)];
- bfd_size_type carsym_size, ptrsize;
- unsigned int i;
-
- mapdata = _bfd_read_ar_hdr (abfd);
- if (mapdata == NULL)
- return FALSE;
- parsed_size = mapdata->parsed_size;
- bfd_release (abfd, mapdata); /* Don't need it any more. */
-
- if (bfd_bread (int_buf, 4, abfd) != 4)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- return FALSE;
- }
- /* It seems that all numeric information in a coff archive is always
- in big endian format, nomatter the host or target. */
- swap = bfd_getb32;
- nsymz = bfd_getb32 (int_buf);
- stringsize = parsed_size - (4 * nsymz) - 4;
-
-#if 1
- /* ... except that some archive formats are broken, and it may be our
- fault - the i960 little endian coff sometimes has big and sometimes
- little, because our tools changed. Here's a horrible hack to clean
- up the crap. */
-
- if (stringsize > 0xfffff
- && bfd_get_arch (abfd) == bfd_arch_i960
- && bfd_get_flavour (abfd) == bfd_target_coff_flavour)
- {
- /* This looks dangerous, let's do it the other way around. */
- nsymz = bfd_getl32 (int_buf);
- stringsize = parsed_size - (4 * nsymz) - 4;
- swap = bfd_getl32;
- }
-#endif
-
- /* The coff armap must be read sequentially. So we construct a
- bsd-style one in core all at once, for simplicity. */
-
- carsym_size = (nsymz * sizeof (carsym));
- ptrsize = (4 * nsymz);
-
- ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1);
- if (ardata->symdefs == NULL)
- return FALSE;
- carsyms = ardata->symdefs;
- stringbase = ((char *) ardata->symdefs) + carsym_size;
-
- /* Allocate and read in the raw offsets. */
- raw_armap = bfd_alloc (abfd, ptrsize);
- if (raw_armap == NULL)
- goto release_symdefs;
- 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);
- goto release_raw_armap;
- }
-
- /* OK, build the carsyms. */
- for (i = 0; i < nsymz; i++)
- {
- rawptr = raw_armap + i;
- carsyms->file_offset = swap ((bfd_byte *) rawptr);
- carsyms->name = stringbase;
- stringbase += strlen (stringbase) + 1;
- carsyms++;
- }
- *stringbase = 0;
-
- ardata->symdef_count = nsymz;
- ardata->first_file_filepos = bfd_tell (abfd);
- /* Pad to an even boundary if you have to. */
- ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
-
- bfd_has_map (abfd) = TRUE;
- bfd_release (abfd, raw_armap);
-
- /* Check for a second archive header (as used by PE). */
- {
- struct areltdata *tmp;
-
- bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
- tmp = _bfd_read_ar_hdr (abfd);
- if (tmp != NULL)
- {
- if (tmp->arch_header[0] == '/'
- && tmp->arch_header[1] == ' ')
- {
- ardata->first_file_filepos +=
- (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1;
- }
- bfd_release (abfd, tmp);
- }
- }
-
- return TRUE;
-
-release_raw_armap:
- bfd_release (abfd, raw_armap);
-release_symdefs:
- bfd_release (abfd, (ardata)->symdefs);
- return FALSE;
-}
-
-/* This routine can handle either coff-style or bsd-style armaps.
- Returns FALSE on error, TRUE otherwise */
-
-bfd_boolean
-bfd_slurp_armap (bfd *abfd)
-{
- char nextname[17];
- int i = bfd_bread (nextname, 16, abfd);
-
- if (i == 0)
- return TRUE;
- if (i != 16)
- return FALSE;
-
- if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return FALSE;
-
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
- return do_slurp_bsd_armap (abfd);
- else if (!strncmp (nextname, "/ ", 16))
- return do_slurp_coff_armap (abfd);
- else if (!strncmp (nextname, "/SYM64/ ", 16))
- {
- /* 64bit ELF (Irix 6) archive. */
-#ifdef BFD64
- extern bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
- return bfd_elf64_archive_slurp_armap (abfd);
-#else
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
-#endif
- }
-
- bfd_has_map (abfd) = FALSE;
- return TRUE;
-}
-
-/* Returns FALSE on error, TRUE otherwise */
-/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
- header is in a slightly different order and the map name is '/'.
- This flavour is used by hp300hpux. */
-
-#define HPUX_SYMDEF_COUNT_SIZE 2
-
-bfd_boolean
-bfd_slurp_bsd_armap_f2 (bfd *abfd)
-{
- struct areltdata *mapdata;
- char nextname[17];
- unsigned int counter;
- bfd_byte *raw_armap, *rbase;
- struct artdata *ardata = bfd_ardata (abfd);
- char *stringbase;
- unsigned int stringsize;
- bfd_size_type amt;
- carsym *set;
- int i = bfd_bread (nextname, 16, abfd);
-
- if (i == 0)
- return TRUE;
- if (i != 16)
- return FALSE;
-
- /* The archive has at least 16 bytes in it. */
- if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return FALSE;
-
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
- return do_slurp_bsd_armap (abfd);
-
- if (strncmp (nextname, "/ ", 16))
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- mapdata = _bfd_read_ar_hdr (abfd);
- if (mapdata == NULL)
- return FALSE;
-
- amt = mapdata->parsed_size;
- raw_armap = bfd_zalloc (abfd, amt);
- if (raw_armap == NULL)
- {
- byebye:
- bfd_release (abfd, mapdata);
- return FALSE;
- }
-
- if (bfd_bread (raw_armap, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- byebyebye:
- bfd_release (abfd, raw_armap);
- goto byebye;
- }
-
- ardata->symdef_count = H_GET_16 (abfd, raw_armap);
-
- if (ardata->symdef_count * BSD_SYMDEF_SIZE
- > mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE)
- {
- /* Probably we're using the wrong byte ordering. */
- bfd_set_error (bfd_error_wrong_format);
- goto byebyebye;
- }
-
- ardata->cache = 0;
-
- 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;
- amt = ardata->symdef_count * BSD_SYMDEF_SIZE;
- ardata->symdefs = bfd_alloc (abfd, amt);
- if (!ardata->symdefs)
- return FALSE;
-
- for (counter = 0, set = ardata->symdefs;
- counter < ardata->symdef_count;
- counter++, set++, rbase += BSD_SYMDEF_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);
- /* Pad to an even boundary if you have to. */
- ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
- /* FIXME, we should provide some way to free raw_ardata when
- we are done using the strings from it. For now, it seems
- to be allocated on an objalloc anyway... */
- bfd_has_map (abfd) = TRUE;
- return TRUE;
-}
-
-/** Extended name table.
-
- Normally archives support only 14-character filenames.
-
- Intel has extended the format: longer names are stored in a special
- element (the first in the archive, or second if there is an armap);
- the name in the ar_hdr is replaced by <space><index into filename
- element>. Index is the P.R. of an int (decimal). Data General have
- extended the format by using the prefix // for the special element. */
-
-/* Returns FALSE on error, TRUE otherwise. */
-
-bfd_boolean
-_bfd_slurp_extended_name_table (bfd *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_bread (nextname, 16, abfd) == 16)
- {
- if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return FALSE;
-
- if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 &&
- strncmp (nextname, "// ", 16) != 0)
- {
- bfd_ardata (abfd)->extended_names = NULL;
- return TRUE;
- }
-
- namedata = _bfd_read_ar_hdr (abfd);
- if (namedata == NULL)
- return FALSE;
-
- amt = namedata->parsed_size;
- bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd)->extended_names == NULL)
- {
- byebye:
- bfd_release (abfd, namedata);
- return FALSE;
- }
-
- if (bfd_bread (bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- bfd_release (abfd, (bfd_ardata (abfd)->extended_names));
- bfd_ardata (abfd)->extended_names = NULL;
- goto byebye;
- }
-
- /* Since the archive is supposed to be printable if it contains
- text, the entries in the list are newline-padded, not null
- padded. In SVR4-style archives, the names also have a
- trailing '/'. DOS/NT created archive often have \ in them
- We'll fix all problems here.. */
- {
- char *temp = bfd_ardata (abfd)->extended_names;
- char *limit = temp + namedata->parsed_size;
- for (; temp < limit; ++temp)
- {
- if (*temp == '\012')
- temp[temp[-1] == '/' ? -1 : 0] = '\0';
- if (*temp == '\\')
- *temp = '/';
- }
- }
-
- /* Pad to an even boundary if you have to. */
- bfd_ardata (abfd)->first_file_filepos = bfd_tell (abfd);
- bfd_ardata (abfd)->first_file_filepos +=
- (bfd_ardata (abfd)->first_file_filepos) % 2;
-
- /* FIXME, we can't release namedata here because it was allocated
- below extended_names on the objalloc... */
-#if 0
- bfd_release (abfd, namedata);
-#endif
- }
- return TRUE;
-}
-
-#ifdef VMS
-
-/* Return a copy of the stuff in the filename between any :]> and a
- semicolon. */
-
-static const char *
-normalize (bfd *abfd, const char *file)
-{
- const char *first;
- const char *last;
- char *copy;
-
- first = file + strlen (file) - 1;
- last = first + 1;
-
- while (first != file)
- {
- if (*first == ';')
- last = first;
- if (*first == ':' || *first == ']' || *first == '>')
- {
- first++;
- break;
- }
- first--;
- }
-
- copy = bfd_alloc (abfd, last - first + 1);
- if (copy == NULL)
- return NULL;
-
- memcpy (copy, first, last - first);
- copy[last - first] = 0;
-
- return copy;
-}
-
-#else
-static const char *
-normalize (bfd *abfd ATTRIBUTE_UNUSED, const char *file)
-{
- const char *filename = strrchr (file, '/');
-
-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- {
- /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
- char *bslash = strrchr (file, '\\');
- if (filename == NULL || (bslash != NULL && bslash > filename))
- filename = bslash;
- if (filename == NULL && file[0] != '\0' && file[1] == ':')
- filename = file + 1;
- }
-#endif
- if (filename != NULL)
- filename++;
- else
- filename = file;
- return filename;
-}
-#endif
-
-/* Build a BFD style extended name table. */
-
-bfd_boolean
-_bfd_archive_bsd_construct_extended_name_table (bfd *abfd,
- char **tabloc,
- bfd_size_type *tablen,
- const char **name)
-{
- *name = "ARFILENAMES/";
- return _bfd_construct_extended_name_table (abfd, FALSE, tabloc, tablen);
-}
-
-/* Build an SVR4 style extended name table. */
-
-bfd_boolean
-_bfd_archive_coff_construct_extended_name_table (bfd *abfd,
- char **tabloc,
- bfd_size_type *tablen,
- const char **name)
-{
- *name = "//";
- return _bfd_construct_extended_name_table (abfd, TRUE, tabloc, tablen);
-}
-
-/* Follows archive_head and produces an extended name table if
- necessary. Returns (in tabloc) a pointer to an extended name
- table, and in tablen the length of the table. If it makes an entry
- it clobbers the filename so that the element may be written without
- further massage. Returns TRUE if it ran successfully, FALSE if
- something went wrong. A successful return may still involve a
- zero-length tablen! */
-
-bfd_boolean
-_bfd_construct_extended_name_table (bfd *abfd,
- bfd_boolean trailing_slash,
- char **tabloc,
- bfd_size_type *tablen)
-{
- unsigned int maxname = abfd->xvec->ar_max_namelen;
- bfd_size_type total_namelen = 0;
- bfd *current;
- char *strptr;
-
- *tablen = 0;
-
- /* Figure out how long the table should be. */
- for (current = abfd->archive_head; current != NULL; current = current->next)
- {
- const char *normal;
- unsigned int thislen;
-
- normal = normalize (current, current->filename);
- if (normal == NULL)
- return FALSE;
-
- thislen = strlen (normal);
-
- if (thislen > maxname
- && (bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0)
- thislen = maxname;
-
- if (thislen > maxname)
- {
- /* Add one to leave room for \n. */
- total_namelen += thislen + 1;
- if (trailing_slash)
- {
- /* Leave room for trailing slash. */
- ++total_namelen;
- }
- }
- else
- {
- struct ar_hdr *hdr = arch_hdr (current);
- if (strncmp (normal, hdr->ar_name, thislen) != 0
- || (thislen < sizeof hdr->ar_name
- && hdr->ar_name[thislen] != ar_padchar (current)))
- {
- /* Must have been using extended format even though it
- didn't need to. Fix it to use normal format. */
- memcpy (hdr->ar_name, normal, thislen);
- if (thislen < maxname
- || (thislen == maxname && thislen < sizeof hdr->ar_name))
- hdr->ar_name[thislen] = ar_padchar (current);
- }
- }
- }
-
- if (total_namelen == 0)
- return TRUE;
-
- *tabloc = bfd_zalloc (abfd, total_namelen);
- if (*tabloc == NULL)
- return FALSE;
-
- *tablen = total_namelen;
- strptr = *tabloc;
-
- for (current = abfd->archive_head; current != NULL; current =
- current->next)
- {
- const char *normal;
- unsigned int thislen;
-
- normal = normalize (current, current->filename);
- if (normal == NULL)
- return FALSE;
-
- thislen = strlen (normal);
- if (thislen > maxname)
- {
- /* Works for now; may need to be re-engineered if we
- encounter an oddball archive format and want to
- generalise this hack. */
- struct ar_hdr *hdr = arch_hdr (current);
- strcpy (strptr, normal);
- if (! trailing_slash)
- strptr[thislen] = '\012';
- else
- {
- strptr[thislen] = '/';
- strptr[thislen + 1] = '\012';
- }
- hdr->ar_name[0] = ar_padchar (current);
- /* We know there will always be enough room (one of the few
- cases where you may safely use sprintf). */
- sprintf ((hdr->ar_name) + 1, "%-d", (unsigned) (strptr - *tabloc));
- /* Kinda Kludgy. We should just use the returned value of
- sprintf but not all implementations get this right. */
- {
- char *temp = hdr->ar_name + 2;
- for (; temp < hdr->ar_name + maxname; temp++)
- if (*temp == '\0')
- *temp = ' ';
- }
- strptr += thislen + 1;
- if (trailing_slash)
- ++strptr;
- }
- }
-
- return TRUE;
-}
-
-/** A couple of functions for creating ar_hdrs */
-
-#ifdef HPUX_LARGE_AR_IDS
-/* Function to encode large UID/GID values according to HP. */
-
-static void
-hpux_uid_gid_encode (char str[6], long int id)
-{
- int cnt;
-
- str[5] = '@' + (id & 3);
- id >>= 2;
-
- for (cnt = 4; cnt >= 0; ++cnt, id >>= 6)
- str[cnt] = ' ' + (id & 0x3f);
-}
-#endif /* HPUX_LARGE_AR_IDS */
-
-#ifndef HAVE_GETUID
-#define getuid() 0
-#endif
-
-#ifndef HAVE_GETGID
-#define getgid() 0
-#endif
-
-/* Takes a filename, returns an arelt_data for it, or NULL if it can't
- make one. The filename must refer to a filename in the filesystem.
- The filename field of the ar_hdr will NOT be initialized. If member
- is set, and it's an in-memory bfd, we fake it. */
-
-static struct areltdata *
-bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
-{
- struct stat status;
- struct areltdata *ared;
- struct ar_hdr *hdr;
- char *temp, *temp1;
- bfd_size_type amt;
-
- if (member && (member->flags & BFD_IN_MEMORY) != 0)
- {
- /* Assume we just "made" the member, and fake it. */
- struct bfd_in_memory *bim = member->iostream;
- time (&status.st_mtime);
- status.st_uid = getuid ();
- status.st_gid = getgid ();
- status.st_mode = 0644;
- status.st_size = bim->size;
- }
- else if (stat (filename, &status) != 0)
- {
- bfd_set_error (bfd_error_system_call);
- return NULL;
- }
-
- amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
- ared = bfd_zalloc (abfd, amt);
- if (ared == NULL)
- return NULL;
- hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
-
- /* ar headers are space padded, not null padded! */
- memset (hdr, ' ', sizeof (struct ar_hdr));
-
- strncpy (hdr->ar_fmag, ARFMAG, 2);
-
- /* Goddamned sprintf doesn't permit MAXIMUM field lengths. */
- sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
-#ifdef HPUX_LARGE_AR_IDS
- /* HP has a very "special" way to handle UID/GID's with numeric values
- > 99999. */
- if (status.st_uid > 99999)
- hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_uid);
- else
-#endif
- sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid);
-#ifdef HPUX_LARGE_AR_IDS
- /* HP has a very "special" way to handle UID/GID's with numeric values
- > 99999. */
- if (status.st_gid > 99999)
- hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_gid);
- else
-#endif
- sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid);
- sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode);
- sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size);
- /* Correct for a lossage in sprintf whereby it null-terminates. I cannot
- understand how these C losers could design such a ramshackle bunch of
- IO operations. */
- temp = (char *) hdr;
- temp1 = temp + sizeof (struct ar_hdr) - 2;
- for (; temp < temp1; temp++)
- {
- if (*temp == '\0')
- *temp = ' ';
- }
- strncpy (hdr->ar_fmag, ARFMAG, 2);
- ared->parsed_size = status.st_size;
- ared->arch_header = (char *) hdr;
-
- return ared;
-}
-
-/* This is magic required by the "ar" program. Since it's
- undocumented, it's undocumented. You may think that it would take
- a strong stomach to write this, and it does, but it takes even a
- stronger stomach to try to code around such a thing! */
-
-struct ar_hdr *bfd_special_undocumented_glue (bfd *, const char *);
-
-struct ar_hdr *
-bfd_special_undocumented_glue (bfd *abfd, const char *filename)
-{
- struct areltdata *ar_elt = bfd_ar_hdr_from_filesystem (abfd, filename, 0);
- if (ar_elt == NULL)
- return NULL;
- return (struct ar_hdr *) ar_elt->arch_header;
-}
-
-/* Analogous to stat call. */
-
-int
-bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
-{
- struct ar_hdr *hdr;
- char *aloser;
-
- if (abfd->arelt_data == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- hdr = arch_hdr (abfd);
-
-#define foo(arelt, stelt, size) \
- buf->stelt = strtol (hdr->arelt, &aloser, size); \
- if (aloser == hdr->arelt) \
- return -1;
-
- /* Some platforms support special notations for large IDs. */
-#ifdef HPUX_LARGE_AR_IDS
-# define foo2(arelt, stelt, size) \
- if (hdr->arelt[5] == ' ') \
- { \
- foo (arelt, stelt, size); \
- } \
- else \
- { \
- int cnt; \
- for (buf->stelt = cnt = 0; cnt < 5; ++cnt) \
- { \
- if (hdr->arelt[cnt] < ' ' || hdr->arelt[cnt] > ' ' + 0x3f) \
- return -1; \
- buf->stelt <<= 6; \
- buf->stelt += hdr->arelt[cnt] - ' '; \
- } \
- if (hdr->arelt[5] < '@' || hdr->arelt[5] > '@' + 3) \
- return -1; \
- buf->stelt <<= 2; \
- buf->stelt += hdr->arelt[5] - '@'; \
- }
-#else
-# define foo2(arelt, stelt, size) foo (arelt, stelt, size)
-#endif
-
- foo (ar_date, st_mtime, 10);
- foo2 (ar_uid, st_uid, 10);
- foo2 (ar_gid, st_gid, 10);
- foo (ar_mode, st_mode, 8);
-
- buf->st_size = arch_eltdata (abfd)->parsed_size;
-
- return 0;
-}
-
-void
-bfd_dont_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
-{
- /* FIXME: This interacts unpleasantly with ar's quick-append option.
- Fortunately ic960 users will never use that option. Fixing this
- is very hard; fortunately I know how to do it and will do so once
- intel's release is out the door. */
-
- struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
- size_t length;
- const char *filename;
- size_t maxlen = ar_maxnamelen (abfd);
-
- if ((bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0)
- {
- bfd_bsd_truncate_arname (abfd, pathname, arhdr);
- return;
- }
-
- filename = normalize (abfd, pathname);
- if (filename == NULL)
- {
- /* FIXME */
- abort ();
- }
-
- length = strlen (filename);
-
- if (length <= maxlen)
- memcpy (hdr->ar_name, filename, length);
-
- /* Add the padding character if there is room for it. */
- if (length < maxlen
- || (length == maxlen && length < sizeof hdr->ar_name))
- (hdr->ar_name)[length] = ar_padchar (abfd);
-}
-
-void
-bfd_bsd_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
-{
- struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
- size_t length;
- const char *filename = strrchr (pathname, '/');
- size_t maxlen = ar_maxnamelen (abfd);
-
-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- {
- /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
- char *bslash = strrchr (pathname, '\\');
- if (filename == NULL || (bslash != NULL && bslash > filename))
- filename = bslash;
- if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
- filename = pathname + 1;
- }
-#endif
-
- if (filename == NULL)
- filename = pathname;
- else
- ++filename;
-
- length = strlen (filename);
-
- if (length <= maxlen)
- memcpy (hdr->ar_name, filename, length);
- else
- {
- /* pathname: meet procrustes */
- memcpy (hdr->ar_name, filename, maxlen);
- length = maxlen;
- }
-
- if (length < maxlen)
- (hdr->ar_name)[length] = ar_padchar (abfd);
-}
-
-/* Store name into ar header. Truncates the name to fit.
- 1> strip pathname to be just the basename.
- 2> if it's short enuf to fit, stuff it in.
- 3> If it doesn't end with .o, truncate it to fit
- 4> truncate it before the .o, append .o, stuff THAT in. */
-
-/* This is what gnu ar does. It's better but incompatible with the
- bsd ar. */
-
-void
-bfd_gnu_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
-{
- struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
- size_t length;
- const char *filename = strrchr (pathname, '/');
- size_t maxlen = ar_maxnamelen (abfd);
-
-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- {
- /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
- char *bslash = strrchr (pathname, '\\');
- if (filename == NULL || (bslash != NULL && bslash > filename))
- filename = bslash;
- if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
- filename = pathname + 1;
- }
-#endif
-
- if (filename == NULL)
- filename = pathname;
- else
- ++filename;
-
- length = strlen (filename);
-
- if (length <= maxlen)
- memcpy (hdr->ar_name, filename, length);
- else
- { /* pathname: meet procrustes */
- memcpy (hdr->ar_name, filename, maxlen);
- if ((filename[length - 2] == '.') && (filename[length - 1] == 'o'))
- {
- hdr->ar_name[maxlen - 2] = '.';
- hdr->ar_name[maxlen - 1] = 'o';
- }
- length = maxlen;
- }
-
- if (length < 16)
- (hdr->ar_name)[length] = ar_padchar (abfd);
-}
-
-/* The BFD is open for write and has its format set to bfd_archive. */
-
-bfd_boolean
-_bfd_write_archive_contents (bfd *arch)
-{
- bfd *current;
- char *etable = NULL;
- bfd_size_type elength = 0;
- const char *ename = NULL;
- bfd_boolean makemap = bfd_has_map (arch);
- /* If no .o's, don't bother to make a map. */
- bfd_boolean hasobjects = FALSE;
- bfd_size_type wrote;
- unsigned int i;
- int tries;
-
- /* Verify the viability of all entries; if any of them live in the
- filesystem (as opposed to living in an archive open for input)
- then construct a fresh ar_hdr for them. */
- for (current = arch->archive_head; current; current = current->next)
- {
- /* This check is checking the bfds for the objects we're reading
- from (which are usually either an object file or archive on
- disk), not the archive entries we're writing to. We don't
- actually create bfds for the archive members, we just copy
- them byte-wise when we write out the archive. */
- if (bfd_write_p (current))
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
- if (!current->arelt_data)
- {
- current->arelt_data =
- bfd_ar_hdr_from_filesystem (arch, current->filename, current);
- if (!current->arelt_data)
- return FALSE;
-
- /* Put in the file name. */
- BFD_SEND (arch, _bfd_truncate_arname,
- (arch, current->filename, (char *) arch_hdr (current)));
- }
-
- if (makemap && ! hasobjects)
- { /* Don't bother if we won't make a map! */
- if ((bfd_check_format (current, bfd_object))
-#if 0 /* FIXME -- these are not set correctly */
- && ((bfd_get_file_flags (current) & HAS_SYMS))
-#endif
- )
- hasobjects = TRUE;
- }
- }
-
- if (!BFD_SEND (arch, _bfd_construct_extended_name_table,
- (arch, &etable, &elength, &ename)))
- return FALSE;
-
- if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
-#ifdef GNU960
- wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), SARMAG, arch);
-#else
- wrote = bfd_bwrite (ARMAG, SARMAG, arch);
-#endif
- if (wrote != SARMAG)
- return FALSE;
-
- if (makemap && hasobjects)
- {
- if (! _bfd_compute_and_write_armap (arch, (unsigned int) elength))
- return FALSE;
- }
-
- if (elength != 0)
- {
- struct ar_hdr hdr;
-
- memset (&hdr, 0, sizeof (struct ar_hdr));
- strcpy (hdr.ar_name, ename);
- /* Round size up to even number in archive header. */
- sprintf (&(hdr.ar_size[0]), "%-10d",
- (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_bwrite (&hdr, sizeof (struct ar_hdr), arch)
- != sizeof (struct ar_hdr))
- || bfd_bwrite (etable, elength, arch) != elength)
- return FALSE;
- if ((elength % 2) == 1)
- {
- if (bfd_bwrite ("\012", 1, arch) != 1)
- return FALSE;
- }
- }
-
- for (current = arch->archive_head; current; current = current->next)
- {
- char buffer[DEFAULT_BUFFERSIZE];
- unsigned int remaining = arelt_size (current);
- struct ar_hdr *hdr = arch_hdr (current);
-
- /* Write ar header. */
- if (bfd_bwrite (hdr, sizeof (*hdr), arch)
- != sizeof (*hdr))
- return FALSE;
- if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
- while (remaining)
- {
- unsigned int amt = DEFAULT_BUFFERSIZE;
- if (amt > remaining)
- amt = remaining;
- errno = 0;
- if (bfd_bread (buffer, amt, current) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- return FALSE;
- }
- if (bfd_bwrite (buffer, amt, arch) != amt)
- return FALSE;
- remaining -= amt;
- }
- if ((arelt_size (current) % 2) == 1)
- {
- if (bfd_bwrite ("\012", 1, arch) != 1)
- return FALSE;
- }
- }
-
- if (makemap && hasobjects)
- {
- /* Verify the timestamp in the archive file. If it would not be
- accepted by the linker, rewrite it until it would be. If
- anything odd happens, break out and just return. (The
- Berkeley linker checks the timestamp and refuses to read the
- table-of-contents if it is >60 seconds less than the file's
- modified-time. That painful hack requires this painful hack. */
- tries = 1;
- do
- {
- if (bfd_update_armap_timestamp (arch))
- break;
- (*_bfd_error_handler)
- (_("Warning: writing archive was slow: rewriting timestamp\n"));
- }
- while (++tries < 6);
- }
-
- return TRUE;
-}
-
-/* Note that the namidx for the first symbol is 0. */
-
-bfd_boolean
-_bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
-{
- char *first_name = NULL;
- bfd *current;
- file_ptr elt_no = 0;
- struct orl *map = NULL;
- 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;
- bfd_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;
-
- amt = orl_max * sizeof (struct orl);
- map = 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);
- if (first_name == NULL)
- goto error_return;
-
- /* Drop all the files called __.SYMDEF, we're going to make our own. */
- while (arch->archive_head &&
- strcmp (arch->archive_head->filename, "__.SYMDEF") == 0)
- arch->archive_head = arch->archive_head->next;
-
- /* Map over each element. */
- for (current = arch->archive_head;
- current != NULL;
- current = current->next, elt_no++)
- {
- if (bfd_check_format (current, bfd_object)
- && (bfd_get_file_flags (current) & HAS_SYMS) != 0)
- {
- long storage;
- long symcount;
- long src_count;
-
- storage = bfd_get_symtab_upper_bound (current);
- if (storage < 0)
- goto error_return;
-
- if (storage != 0)
- {
- if (storage > syms_max)
- {
- if (syms_max > 0)
- free (syms);
- syms_max = storage;
- syms = bfd_malloc (syms_max);
- if (syms == NULL)
- goto error_return;
- }
- symcount = bfd_canonicalize_symtab (current, syms);
- if (symcount < 0)
- goto error_return;
-
- /* Now map over all the symbols, picking out the ones we
- want. */
- for (src_count = 0; src_count < symcount; src_count++)
- {
- flagword flags = (syms[src_count])->flags;
- asection *sec = syms[src_count]->section;
-
- if ((flags & BSF_GLOBAL ||
- flags & BSF_WEAK ||
- flags & BSF_INDIRECT ||
- bfd_is_com_section (sec))
- && ! bfd_is_und_section (sec))
- {
- bfd_size_type namelen;
- struct orl *new_map;
-
- /* This symbol will go into the archive header. */
- if (orl_count == orl_max)
- {
- orl_max *= 2;
- amt = orl_max * sizeof (struct orl);
- new_map = bfd_realloc (map, amt);
- if (new_map == NULL)
- goto error_return;
-
- map = new_map;
- }
-
- namelen = strlen (syms[src_count]->name);
- amt = sizeof (char *);
- map[orl_count].name = 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].u.abfd = current;
- map[orl_count].namidx = stridx;
-
- stridx += namelen + 1;
- ++orl_count;
- }
- }
- }
-
- /* Now ask the BFD to free up any cached information, so we
- don't fill all of memory with symbol tables. */
- if (! bfd_free_cached_info (current))
- goto error_return;
- }
- }
-
- /* OK, now we have collected all the data, let's write them out. */
- ret = BFD_SEND (arch, write_armap,
- (arch, elength, map, orl_count, stridx));
-
- if (syms_max > 0)
- free (syms);
- if (map != NULL)
- free (map);
- if (first_name != NULL)
- bfd_release (arch, first_name);
-
- return ret;
-
- error_return:
- if (syms_max > 0)
- free (syms);
- if (map != NULL)
- free (map);
- if (first_name != NULL)
- bfd_release (arch, first_name);
-
- return FALSE;
-}
-
-bfd_boolean
-bsd_write_armap (bfd *arch,
- unsigned int elength,
- struct orl *map,
- unsigned int orl_count,
- int stridx)
-{
- int padit = stridx & 1;
- unsigned int ranlibsize = orl_count * BSD_SYMDEF_SIZE;
- unsigned int stringsize = stridx + padit;
- /* Include 8 bytes to store ranlibsize and stringsize in output. */
- unsigned int mapsize = ranlibsize + stringsize + 8;
- file_ptr firstreal;
- bfd *current = arch->archive_head;
- bfd *last_elt = current; /* last element arch seen */
- bfd_byte temp[4];
- unsigned int count;
- struct ar_hdr hdr;
- struct stat statbuf;
- unsigned int i;
-
- firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
-
- stat (arch->filename, &statbuf);
- memset (&hdr, 0, sizeof (struct ar_hdr));
- sprintf (hdr.ar_name, RANLIBMAG);
- /* Remember the timestamp, to keep it holy. But fudge it a little. */
- bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET;
- bfd_ardata (arch)->armap_datepos = (SARMAG
- + offsetof (struct ar_hdr, ar_date[0]));
- sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
- sprintf (hdr.ar_uid, "%ld", (long) getuid ());
- sprintf (hdr.ar_gid, "%ld", (long) getgid ());
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
- 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_bwrite (&hdr, sizeof (struct ar_hdr), arch)
- != sizeof (struct ar_hdr))
- return FALSE;
- H_PUT_32 (arch, ranlibsize, temp);
- if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
- return FALSE;
-
- for (count = 0; count < orl_count; count++)
- {
- bfd_byte buf[BSD_SYMDEF_SIZE];
-
- if (map[count].u.abfd != last_elt)
- {
- do
- {
- firstreal += arelt_size (current) + sizeof (struct ar_hdr);
- firstreal += firstreal % 2;
- current = current->next;
- }
- while (current != map[count].u.abfd);
- } /* if new archive element */
-
- last_elt = current;
- H_PUT_32 (arch, map[count].namidx, buf);
- H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
- if (bfd_bwrite (buf, BSD_SYMDEF_SIZE, arch)
- != BSD_SYMDEF_SIZE)
- return FALSE;
- }
-
- /* Now write the strings themselves. */
- H_PUT_32 (arch, stringsize, temp);
- if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
- return FALSE;
- for (count = 0; count < orl_count; count++)
- {
- size_t len = strlen (*map[count].name) + 1;
-
- if (bfd_bwrite (*map[count].name, len, arch) != len)
- return FALSE;
- }
-
- /* The spec sez this should be a newline. But in order to be
- bug-compatible for sun's ar we use a null. */
- if (padit)
- {
- if (bfd_bwrite ("", 1, arch) != 1)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* At the end of archive file handling, update the timestamp in the
- file, so the linker will accept it.
-
- Return TRUE if the timestamp was OK, or an unusual problem happened.
- Return FALSE if we updated the timestamp. */
-
-bfd_boolean
-_bfd_archive_bsd_update_armap_timestamp (bfd *arch)
-{
- struct stat archstat;
- struct ar_hdr hdr;
- unsigned int i;
-
- /* Flush writes, get last-write timestamp from file, and compare it
- to the timestamp IN the file. */
- bfd_flush (arch);
- if (bfd_stat (arch, &archstat) == -1)
- {
- bfd_perror (_("Reading archive file mod timestamp"));
-
- /* Can't read mod time for some reason. */
- return TRUE;
- }
- if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
- /* OK by the linker's rules. */
- return TRUE;
-
- /* Update the timestamp. */
- bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET;
-
- /* Prepare an ASCII version suitable for writing. */
- memset (hdr.ar_date, 0, sizeof (hdr.ar_date));
- sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
- for (i = 0; i < sizeof (hdr.ar_date); i++)
- if (hdr.ar_date[i] == '\0')
- (hdr.ar_date)[i] = ' ';
-
- /* Write it into the file. */
- 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_bwrite (hdr.ar_date, sizeof (hdr.ar_date), arch)
- != sizeof (hdr.ar_date)))
- {
- bfd_perror (_("Writing updated armap timestamp"));
-
- /* Some error while writing. */
- return TRUE;
- }
-
- /* We updated the timestamp successfully. */
- return FALSE;
-}
-
-/* A coff armap looks like :
- lARMAG
- struct ar_hdr with name = '/'
- number of symbols
- offset of file for symbol 0
- offset of file for symbol 1
-
- offset of file for symbol n-1
- symbol name 0
- symbol name 1
-
- symbol name n-1
-*/
-
-bfd_boolean
-coff_write_armap (bfd *arch,
- unsigned int elength,
- struct orl *map,
- unsigned int symbol_count,
- int stridx)
-{
- /* The size of the ranlib is the number of exported symbols in the
- archive * the number of bytes in an int, + an int for the count. */
- unsigned int ranlibsize = (symbol_count * 4) + 4;
- unsigned int stringsize = stridx;
- unsigned int mapsize = stringsize + ranlibsize;
- unsigned int archive_member_file_ptr;
- bfd *current = arch->archive_head;
- unsigned int count;
- struct ar_hdr hdr;
- unsigned int i;
- int padit = mapsize & 1;
-
- if (padit)
- mapsize++;
-
- /* Work out where the first object file will go in the archive. */
- archive_member_file_ptr = (mapsize
- + elength
- + sizeof (struct ar_hdr)
- + SARMAG);
-
- memset (&hdr, 0, sizeof (struct ar_hdr));
- hdr.ar_name[0] = '/';
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
- sprintf (hdr.ar_date, "%ld", (long) time (NULL));
- /* This, at least, is what Intel coff sets the values to. */
- sprintf ((hdr.ar_uid), "%d", 0);
- sprintf ((hdr.ar_gid), "%d", 0);
- sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
- strncpy (hdr.ar_fmag, ARFMAG, 2);
-
- for (i = 0; i < sizeof (struct ar_hdr); i++)
- if (((char *) (&hdr))[i] == '\0')
- (((char *) (&hdr))[i]) = ' ';
-
- /* Write the ar header for this item and the number of symbols. */
-
- if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
- != sizeof (struct ar_hdr))
- return FALSE;
-
- if (!bfd_write_bigendian_4byte_int (arch, symbol_count))
- return FALSE;
-
- /* Two passes, first write the file offsets for each symbol -
- remembering that each offset is on a two byte boundary. */
-
- /* Write out the file offset for the file associated with each
- symbol, and remember to keep the offsets padded out. */
-
- current = arch->archive_head;
- count = 0;
- while (current != NULL && count < symbol_count)
- {
- /* For each symbol which is used defined in this object, write
- out the object file's address in the archive. */
-
- while (count < symbol_count && map[count].u.abfd == current)
- {
- if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
- return FALSE;
- count++;
- }
- /* Add size of this archive entry. */
- archive_member_file_ptr += arelt_size (current) + sizeof (struct ar_hdr);
- /* Remember aboout the even alignment. */
- archive_member_file_ptr += archive_member_file_ptr % 2;
- current = current->next;
- }
-
- /* Now write the strings themselves. */
- for (count = 0; count < symbol_count; count++)
- {
- size_t len = strlen (*map[count].name) + 1;
-
- if (bfd_bwrite (*map[count].name, len, arch) != len)
- return FALSE;
- }
-
- /* The spec sez this should be a newline. But in order to be
- bug-compatible for arc960 we use a null. */
- if (padit)
- {
- if (bfd_bwrite ("", 1, arch) != 1)
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/archive64.c b/contrib/binutils/bfd/archive64.c
deleted file mode 100644
index 1b9f5f3..0000000
--- a/contrib/binutils/bfd/archive64.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Ian Lance Taylor, Cygnus Support
- Linker support added by Mark Mitchell, CodeSourcery, LLC.
- <mark@codesourcery.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file supports the 64-bit (MIPS) ELF archives. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/ar.h"
-
-/* Irix 6 defines a 64bit archive map format, so that they can
- have archives more than 4 GB in size. */
-
-bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
-bfd_boolean bfd_elf64_archive_write_armap
- (bfd *, unsigned int, struct orl *, unsigned int, int);
-
-/* Read an Irix 6 armap. */
-
-bfd_boolean
-bfd_elf64_archive_slurp_armap (bfd *abfd)
-{
- struct artdata *ardata = bfd_ardata (abfd);
- char nextname[17];
- file_ptr arhdrpos;
- bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize;
- struct areltdata *mapdata;
- bfd_byte int_buf[8];
- 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_bread (nextname, 16, abfd);
- if (i == 0)
- return TRUE;
- if (i != 16)
- return FALSE;
-
- if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
- return FALSE;
-
- /* Archives with traditional armaps are still permitted. */
- if (strncmp (nextname, "/ ", 16) == 0)
- return bfd_slurp_armap (abfd);
-
- if (strncmp (nextname, "/SYM64/ ", 16) != 0)
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
- if (mapdata == NULL)
- return FALSE;
- parsed_size = mapdata->parsed_size;
- bfd_release (abfd, mapdata);
-
- if (bfd_bread (int_buf, 8, abfd) != 8)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- return FALSE;
- }
-
- nsymz = bfd_getb64 (int_buf);
- stringsize = parsed_size - 8 * nsymz - 8;
-
- carsym_size = nsymz * sizeof (carsym);
- ptrsize = 8 * nsymz;
-
- amt = carsym_size + stringsize + 1;
- ardata->symdefs = bfd_zalloc (abfd, amt);
- if (ardata->symdefs == NULL)
- return FALSE;
- carsyms = ardata->symdefs;
- stringbase = ((char *) ardata->symdefs) + carsym_size;
-
- raw_armap = bfd_alloc (abfd, ptrsize);
- if (raw_armap == NULL)
- goto release_symdefs;
-
- 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);
- goto release_raw_armap;
- }
-
- for (i = 0; i < nsymz; i++)
- {
- carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
- carsyms->name = stringbase;
- stringbase += strlen (stringbase) + 1;
- ++carsyms;
- }
- *stringbase = '\0';
-
- ardata->symdef_count = nsymz;
- ardata->first_file_filepos = bfd_tell (abfd);
- /* Pad to an even boundary if you have to. */
- ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
-
- bfd_has_map (abfd) = TRUE;
- bfd_release (abfd, raw_armap);
-
- return TRUE;
-
-release_raw_armap:
- bfd_release (abfd, raw_armap);
-release_symdefs:
- bfd_release (abfd, ardata->symdefs);
- return FALSE;
-}
-
-/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
- able to handle ordinary ELF armaps, but at least on Irix 6.2 the
- linker crashes. */
-
-bfd_boolean
-bfd_elf64_archive_write_armap (bfd *arch,
- unsigned int elength,
- struct orl *map,
- unsigned int symbol_count,
- int stridx)
-{
- unsigned int ranlibsize = (symbol_count * 8) + 8;
- unsigned int stringsize = stridx;
- unsigned int mapsize = stringsize + ranlibsize;
- file_ptr archive_member_file_ptr;
- bfd *current = arch->archive_head;
- unsigned int count;
- struct ar_hdr hdr;
- unsigned int i;
- int padding;
- bfd_byte buf[8];
-
- padding = BFD_ALIGN (mapsize, 8) - mapsize;
- mapsize += padding;
-
- /* work out where the first object file will go in the archive */
- archive_member_file_ptr = (mapsize
- + elength
- + sizeof (struct ar_hdr)
- + SARMAG);
-
- memset (&hdr, 0, sizeof (struct ar_hdr));
- strcpy (hdr.ar_name, "/SYM64/");
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
- sprintf (hdr.ar_date, "%ld", (long) time (NULL));
- /* This, at least, is what Intel coff sets the values to.: */
- sprintf ((hdr.ar_uid), "%d", 0);
- sprintf ((hdr.ar_gid), "%d", 0);
- sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
- strncpy (hdr.ar_fmag, ARFMAG, 2);
-
- for (i = 0; i < sizeof (struct ar_hdr); i++)
- if (((char *) (&hdr))[i] == '\0')
- (((char *) (&hdr))[i]) = ' ';
-
- /* Write the ar header for this item and the number of symbols */
-
- if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
- != sizeof (struct ar_hdr))
- return FALSE;
-
- bfd_putb64 ((bfd_vma) symbol_count, buf);
- if (bfd_bwrite (buf, 8, arch) != 8)
- return FALSE;
-
- /* Two passes, first write the file offsets for each symbol -
- remembering that each offset is on a two byte boundary. */
-
- /* Write out the file offset for the file associated with each
- symbol, and remember to keep the offsets padded out. */
-
- current = arch->archive_head;
- count = 0;
- while (current != NULL && count < symbol_count)
- {
- /* For each symbol which is used defined in this object, write out
- the object file's address in the archive */
-
- while (map[count].u.abfd == current)
- {
- bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
- if (bfd_bwrite (buf, 8, arch) != 8)
- return FALSE;
- count++;
- }
- /* Add size of this archive entry */
- archive_member_file_ptr += (arelt_size (current)
- + sizeof (struct ar_hdr));
- /* remember about the even alignment */
- archive_member_file_ptr += archive_member_file_ptr % 2;
- current = current->next;
- }
-
- /* now write the strings themselves */
- for (count = 0; count < symbol_count; count++)
- {
- size_t len = strlen (*map[count].name) + 1;
-
- if (bfd_bwrite (*map[count].name, len, arch) != len)
- return FALSE;
- }
-
- /* The spec says that this should be padded to an 8 byte boundary.
- However, the Irix 6.2 tools do not appear to do this. */
- while (padding != 0)
- {
- if (bfd_bwrite ("", 1, arch) != 1)
- return FALSE;
- --padding;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/archures.c b/contrib/binutils/bfd/archures.c
deleted file mode 100644
index f8aeeef..0000000
--- a/contrib/binutils/bfd/archures.c
+++ /dev/null
@@ -1,1144 +0,0 @@
-/* BFD library support routines for architectures.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "safe-ctype.h"
-
-/*
-
-SECTION
- Architectures
-
- BFD keeps one atom in a BFD describing the
- architecture of the data attached to the BFD: a pointer to a
- <<bfd_arch_info_type>>.
-
- Pointers to structures can be requested independently of a BFD
- so that an architecture's information can be interrogated
- without access to an open BFD.
-
- The architecture information is provided by each architecture package.
- The set of default architectures is selected by the macro
- <<SELECT_ARCHITECTURES>>. This is normally set up in the
- @file{config/@var{target}.mt} file of your choice. If the name is not
- defined, then all the architectures supported are included.
-
- When BFD starts up, all the architectures are called with an
- initialize method. It is up to the architecture back end to
- insert as many items into the list of architectures as it wants to;
- generally this would be one for each machine and one for the
- default case (an item with a machine field of 0).
-
- BFD's idea of an architecture is implemented in @file{archures.c}.
-*/
-
-/*
-
-SUBSECTION
- bfd_architecture
-
-DESCRIPTION
- This enum gives the object file's CPU architecture, in a
- global sense---i.e., what processor family does it belong to?
- Another field indicates which processor within
- the family is in use. The machine gives a number which
- distinguishes different versions of the architecture,
- containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
- and 68020 and 68030 for Motorola 68020 and 68030.
-
-.enum bfd_architecture
-.{
-. bfd_arch_unknown, {* File arch not known. *}
-. bfd_arch_obscure, {* Arch known, not one of these. *}
-. bfd_arch_m68k, {* Motorola 68xxx *}
-.#define bfd_mach_m68000 1
-.#define bfd_mach_m68008 2
-.#define bfd_mach_m68010 3
-.#define bfd_mach_m68020 4
-.#define bfd_mach_m68030 5
-.#define bfd_mach_m68040 6
-.#define bfd_mach_m68060 7
-.#define bfd_mach_cpu32 8
-.#define bfd_mach_mcf5200 9
-.#define bfd_mach_mcf5206e 10
-.#define bfd_mach_mcf5307 11
-.#define bfd_mach_mcf5407 12
-.#define bfd_mach_mcf528x 13
-. bfd_arch_vax, {* DEC Vax *}
-. bfd_arch_i960, {* Intel 960 *}
-. {* The order of the following is important.
-. lower number indicates a machine type that
-. only accepts a subset of the instructions
-. available to machines with higher numbers.
-. The exception is the "ca", which is
-. incompatible with all other machines except
-. "core". *}
-.
-.#define bfd_mach_i960_core 1
-.#define bfd_mach_i960_ka_sa 2
-.#define bfd_mach_i960_kb_sb 3
-.#define bfd_mach_i960_mc 4
-.#define bfd_mach_i960_xa 5
-.#define bfd_mach_i960_ca 6
-.#define bfd_mach_i960_jx 7
-.#define bfd_mach_i960_hx 8
-.
-. bfd_arch_or32, {* OpenRISC 32 *}
-.
-. bfd_arch_a29k, {* AMD 29000 *}
-. bfd_arch_sparc, {* SPARC *}
-.#define bfd_mach_sparc 1
-.{* The difference between v8plus and v9 is that v9 is a true 64 bit env. *}
-.#define bfd_mach_sparc_sparclet 2
-.#define bfd_mach_sparc_sparclite 3
-.#define bfd_mach_sparc_v8plus 4
-.#define bfd_mach_sparc_v8plusa 5 {* with ultrasparc add'ns. *}
-.#define bfd_mach_sparc_sparclite_le 6
-.#define bfd_mach_sparc_v9 7
-.#define bfd_mach_sparc_v9a 8 {* with ultrasparc add'ns. *}
-.#define bfd_mach_sparc_v8plusb 9 {* with cheetah add'ns. *}
-.#define bfd_mach_sparc_v9b 10 {* with cheetah add'ns. *}
-.{* Nonzero if MACH has the v9 instruction set. *}
-.#define bfd_mach_sparc_v9_p(mach) \
-. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
-. && (mach) != bfd_mach_sparc_sparclite_le)
-. bfd_arch_mips, {* MIPS Rxxxx *}
-.#define bfd_mach_mips3000 3000
-.#define bfd_mach_mips3900 3900
-.#define bfd_mach_mips4000 4000
-.#define bfd_mach_mips4010 4010
-.#define bfd_mach_mips4100 4100
-.#define bfd_mach_mips4111 4111
-.#define bfd_mach_mips4120 4120
-.#define bfd_mach_mips4300 4300
-.#define bfd_mach_mips4400 4400
-.#define bfd_mach_mips4600 4600
-.#define bfd_mach_mips4650 4650
-.#define bfd_mach_mips5000 5000
-.#define bfd_mach_mips5400 5400
-.#define bfd_mach_mips5500 5500
-.#define bfd_mach_mips6000 6000
-.#define bfd_mach_mips7000 7000
-.#define bfd_mach_mips8000 8000
-.#define bfd_mach_mips10000 10000
-.#define bfd_mach_mips12000 12000
-.#define bfd_mach_mips16 16
-.#define bfd_mach_mips5 5
-.#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *}
-.#define bfd_mach_mipsisa32 32
-.#define bfd_mach_mipsisa32r2 33
-.#define bfd_mach_mipsisa64 64
-.#define bfd_mach_mipsisa64r2 65
-. bfd_arch_i386, {* Intel 386 *}
-.#define bfd_mach_i386_i386 1
-.#define bfd_mach_i386_i8086 2
-.#define bfd_mach_i386_i386_intel_syntax 3
-.#define bfd_mach_x86_64 64
-.#define bfd_mach_x86_64_intel_syntax 65
-. bfd_arch_we32k, {* AT&T WE32xxx *}
-. bfd_arch_tahoe, {* CCI/Harris Tahoe *}
-. bfd_arch_i860, {* Intel 860 *}
-. bfd_arch_i370, {* IBM 360/370 Mainframes *}
-. bfd_arch_romp, {* IBM ROMP PC/RT *}
-. bfd_arch_alliant, {* Alliant *}
-. bfd_arch_convex, {* Convex *}
-. bfd_arch_m88k, {* Motorola 88xxx *}
-. bfd_arch_m98k, {* Motorola 98xxx *}
-. bfd_arch_pyramid, {* Pyramid Technology *}
-. bfd_arch_h8300, {* Renesas H8/300 (formerly Hitachi H8/300) *}
-.#define bfd_mach_h8300 1
-.#define bfd_mach_h8300h 2
-.#define bfd_mach_h8300s 3
-.#define bfd_mach_h8300hn 4
-.#define bfd_mach_h8300sn 5
-.#define bfd_mach_h8300sx 6
-.#define bfd_mach_h8300sxn 7
-. bfd_arch_pdp11, {* DEC PDP-11 *}
-. bfd_arch_powerpc, {* PowerPC *}
-.#define bfd_mach_ppc 32
-.#define bfd_mach_ppc64 64
-.#define bfd_mach_ppc_403 403
-.#define bfd_mach_ppc_403gc 4030
-.#define bfd_mach_ppc_505 505
-.#define bfd_mach_ppc_601 601
-.#define bfd_mach_ppc_602 602
-.#define bfd_mach_ppc_603 603
-.#define bfd_mach_ppc_ec603e 6031
-.#define bfd_mach_ppc_604 604
-.#define bfd_mach_ppc_620 620
-.#define bfd_mach_ppc_630 630
-.#define bfd_mach_ppc_750 750
-.#define bfd_mach_ppc_860 860
-.#define bfd_mach_ppc_a35 35
-.#define bfd_mach_ppc_rs64ii 642
-.#define bfd_mach_ppc_rs64iii 643
-.#define bfd_mach_ppc_7400 7400
-.#define bfd_mach_ppc_e500 500
-. bfd_arch_rs6000, {* IBM RS/6000 *}
-.#define bfd_mach_rs6k 6000
-.#define bfd_mach_rs6k_rs1 6001
-.#define bfd_mach_rs6k_rsc 6003
-.#define bfd_mach_rs6k_rs2 6002
-. bfd_arch_hppa, {* HP PA RISC *}
-.#define bfd_mach_hppa10 10
-.#define bfd_mach_hppa11 11
-.#define bfd_mach_hppa20 20
-.#define bfd_mach_hppa20w 25
-. bfd_arch_d10v, {* Mitsubishi D10V *}
-.#define bfd_mach_d10v 1
-.#define bfd_mach_d10v_ts2 2
-.#define bfd_mach_d10v_ts3 3
-. bfd_arch_d30v, {* Mitsubishi D30V *}
-. bfd_arch_dlx, {* DLX *}
-. bfd_arch_m68hc11, {* Motorola 68HC11 *}
-. bfd_arch_m68hc12, {* Motorola 68HC12 *}
-.#define bfd_mach_m6812_default 0
-.#define bfd_mach_m6812 1
-.#define bfd_mach_m6812s 2
-. bfd_arch_z8k, {* Zilog Z8000 *}
-.#define bfd_mach_z8001 1
-.#define bfd_mach_z8002 2
-. bfd_arch_h8500, {* Renesas H8/500 (formerly Hitachi H8/500) *}
-. bfd_arch_sh, {* Renesas / SuperH SH (formerly Hitachi SH) *}
-.#define bfd_mach_sh 1
-.#define bfd_mach_sh2 0x20
-.#define bfd_mach_sh_dsp 0x2d
-.#define bfd_mach_sh2e 0x2e
-.#define bfd_mach_sh3 0x30
-.#define bfd_mach_sh3_dsp 0x3d
-.#define bfd_mach_sh3e 0x3e
-.#define bfd_mach_sh4 0x40
-.#define bfd_mach_sh4_nofpu 0x41
-.#define bfd_mach_sh4a 0x4a
-.#define bfd_mach_sh4a_nofpu 0x4b
-.#define bfd_mach_sh4al_dsp 0x4d
-.#define bfd_mach_sh5 0x50
-. bfd_arch_alpha, {* Dec Alpha *}
-.#define bfd_mach_alpha_ev4 0x10
-.#define bfd_mach_alpha_ev5 0x20
-.#define bfd_mach_alpha_ev6 0x30
-. bfd_arch_arm, {* Advanced Risc Machines ARM. *}
-.#define bfd_mach_arm_unknown 0
-.#define bfd_mach_arm_2 1
-.#define bfd_mach_arm_2a 2
-.#define bfd_mach_arm_3 3
-.#define bfd_mach_arm_3M 4
-.#define bfd_mach_arm_4 5
-.#define bfd_mach_arm_4T 6
-.#define bfd_mach_arm_5 7
-.#define bfd_mach_arm_5T 8
-.#define bfd_mach_arm_5TE 9
-.#define bfd_mach_arm_XScale 10
-.#define bfd_mach_arm_ep9312 11
-.#define bfd_mach_arm_iWMMXt 12
-. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
-. bfd_arch_w65, {* WDC 65816 *}
-. bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
-. bfd_arch_tic4x, {* Texas Instruments TMS320C3X/4X *}
-.#define bfd_mach_tic3x 30
-.#define bfd_mach_tic4x 40
-. bfd_arch_tic54x, {* Texas Instruments TMS320C54X *}
-. bfd_arch_tic80, {* TI TMS320c80 (MVP) *}
-. bfd_arch_v850, {* NEC V850 *}
-.#define bfd_mach_v850 1
-.#define bfd_mach_v850e 'E'
-.#define bfd_mach_v850e1 '1'
-. bfd_arch_arc, {* ARC Cores *}
-.#define bfd_mach_arc_5 5
-.#define bfd_mach_arc_6 6
-.#define bfd_mach_arc_7 7
-.#define bfd_mach_arc_8 8
-. bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *}
-.#define bfd_mach_m32r 1 {* For backwards compatibility. *}
-.#define bfd_mach_m32rx 'x'
-.#define bfd_mach_m32r2 '2'
-. bfd_arch_mn10200, {* Matsushita MN10200 *}
-. bfd_arch_mn10300, {* Matsushita MN10300 *}
-.#define bfd_mach_mn10300 300
-.#define bfd_mach_am33 330
-.#define bfd_mach_am33_2 332
-. bfd_arch_fr30,
-.#define bfd_mach_fr30 0x46523330
-. bfd_arch_frv,
-.#define bfd_mach_frv 1
-.#define bfd_mach_frvsimple 2
-.#define bfd_mach_fr300 300
-.#define bfd_mach_fr400 400
-.#define bfd_mach_frvtomcat 499 {* fr500 prototype *}
-.#define bfd_mach_fr500 500
-.#define bfd_mach_fr550 550
-. bfd_arch_mcore,
-. bfd_arch_ia64, {* HP/Intel ia64 *}
-.#define bfd_mach_ia64_elf64 64
-.#define bfd_mach_ia64_elf32 32
-. bfd_arch_ip2k, {* Ubicom IP2K microcontrollers. *}
-.#define bfd_mach_ip2022 1
-.#define bfd_mach_ip2022ext 2
-. bfd_arch_iq2000, {* Vitesse IQ2000. *}
-.#define bfd_mach_iq2000 1
-.#define bfd_mach_iq10 2
-. bfd_arch_pj,
-. bfd_arch_avr, {* Atmel AVR microcontrollers. *}
-.#define bfd_mach_avr1 1
-.#define bfd_mach_avr2 2
-.#define bfd_mach_avr3 3
-.#define bfd_mach_avr4 4
-.#define bfd_mach_avr5 5
-. bfd_arch_cris, {* Axis CRIS *}
-. bfd_arch_s390, {* IBM s390 *}
-.#define bfd_mach_s390_31 31
-.#define bfd_mach_s390_64 64
-. bfd_arch_openrisc, {* OpenRISC *}
-. bfd_arch_mmix, {* Donald Knuth's educational processor. *}
-. bfd_arch_xstormy16,
-.#define bfd_mach_xstormy16 1
-. bfd_arch_msp430, {* Texas Instruments MSP430 architecture. *}
-.#define bfd_mach_msp11 11
-.#define bfd_mach_msp110 110
-.#define bfd_mach_msp12 12
-.#define bfd_mach_msp13 13
-.#define bfd_mach_msp14 14
-.#define bfd_mach_msp15 15
-.#define bfd_mach_msp16 16
-.#define bfd_mach_msp31 31
-.#define bfd_mach_msp32 32
-.#define bfd_mach_msp33 33
-.#define bfd_mach_msp41 41
-.#define bfd_mach_msp42 42
-.#define bfd_mach_msp43 43
-.#define bfd_mach_msp44 44
-. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
-.#define bfd_mach_xtensa 1
-. bfd_arch_last
-. };
-*/
-
-/*
-SUBSECTION
- bfd_arch_info
-
-DESCRIPTION
- This structure contains information on architectures for use
- within BFD.
-
-.
-.typedef struct bfd_arch_info
-.{
-. int bits_per_word;
-. int bits_per_address;
-. int bits_per_byte;
-. enum bfd_architecture arch;
-. unsigned long mach;
-. const char *arch_name;
-. const char *printable_name;
-. unsigned int section_align_power;
-. {* TRUE if this is the default machine for the architecture.
-. The default arch should be the first entry for an arch so that
-. all the entries for that arch can be accessed via <<next>>. *}
-. bfd_boolean the_default;
-. const struct bfd_arch_info * (*compatible)
-. (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
-.
-. bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
-.
-. const struct bfd_arch_info *next;
-.}
-.bfd_arch_info_type;
-.
-*/
-
-extern const bfd_arch_info_type bfd_a29k_arch;
-extern const bfd_arch_info_type bfd_alpha_arch;
-extern const bfd_arch_info_type bfd_arc_arch;
-extern const bfd_arch_info_type bfd_arm_arch;
-extern const bfd_arch_info_type bfd_avr_arch;
-extern const bfd_arch_info_type bfd_cris_arch;
-extern const bfd_arch_info_type bfd_d10v_arch;
-extern const bfd_arch_info_type bfd_d30v_arch;
-extern const bfd_arch_info_type bfd_dlx_arch;
-extern const bfd_arch_info_type bfd_fr30_arch;
-extern const bfd_arch_info_type bfd_frv_arch;
-extern const bfd_arch_info_type bfd_h8300_arch;
-extern const bfd_arch_info_type bfd_h8500_arch;
-extern const bfd_arch_info_type bfd_hppa_arch;
-extern const bfd_arch_info_type bfd_i370_arch;
-extern const bfd_arch_info_type bfd_i386_arch;
-extern const bfd_arch_info_type bfd_i860_arch;
-extern const bfd_arch_info_type bfd_i960_arch;
-extern const bfd_arch_info_type bfd_ia64_arch;
-extern const bfd_arch_info_type bfd_ip2k_arch;
-extern const bfd_arch_info_type bfd_iq2000_arch;
-extern const bfd_arch_info_type bfd_m32r_arch;
-extern const bfd_arch_info_type bfd_m68hc11_arch;
-extern const bfd_arch_info_type bfd_m68hc12_arch;
-extern const bfd_arch_info_type bfd_m68k_arch;
-extern const bfd_arch_info_type bfd_m88k_arch;
-extern const bfd_arch_info_type bfd_mcore_arch;
-extern const bfd_arch_info_type bfd_mips_arch;
-extern const bfd_arch_info_type bfd_mmix_arch;
-extern const bfd_arch_info_type bfd_mn10200_arch;
-extern const bfd_arch_info_type bfd_mn10300_arch;
-extern const bfd_arch_info_type bfd_msp430_arch;
-extern const bfd_arch_info_type bfd_ns32k_arch;
-extern const bfd_arch_info_type bfd_openrisc_arch;
-extern const bfd_arch_info_type bfd_or32_arch;
-extern const bfd_arch_info_type bfd_pdp11_arch;
-extern const bfd_arch_info_type bfd_pj_arch;
-extern const bfd_arch_info_type bfd_powerpc_archs[];
-#define bfd_powerpc_arch bfd_powerpc_archs[0]
-extern const bfd_arch_info_type bfd_rs6000_arch;
-extern const bfd_arch_info_type bfd_s390_arch;
-extern const bfd_arch_info_type bfd_sh_arch;
-extern const bfd_arch_info_type bfd_sparc_arch;
-extern const bfd_arch_info_type bfd_tic30_arch;
-extern const bfd_arch_info_type bfd_tic4x_arch;
-extern const bfd_arch_info_type bfd_tic54x_arch;
-extern const bfd_arch_info_type bfd_tic80_arch;
-extern const bfd_arch_info_type bfd_v850_arch;
-extern const bfd_arch_info_type bfd_vax_arch;
-extern const bfd_arch_info_type bfd_we32k_arch;
-extern const bfd_arch_info_type bfd_w65_arch;
-extern const bfd_arch_info_type bfd_xstormy16_arch;
-extern const bfd_arch_info_type bfd_xtensa_arch;
-extern const bfd_arch_info_type bfd_z8k_arch;
-
-static const bfd_arch_info_type * const bfd_archures_list[] =
- {
-#ifdef SELECT_ARCHITECTURES
- SELECT_ARCHITECTURES,
-#else
- &bfd_a29k_arch,
- &bfd_alpha_arch,
- &bfd_arc_arch,
- &bfd_arm_arch,
- &bfd_avr_arch,
- &bfd_cris_arch,
- &bfd_d10v_arch,
- &bfd_d30v_arch,
- &bfd_dlx_arch,
- &bfd_fr30_arch,
- &bfd_frv_arch,
- &bfd_h8300_arch,
- &bfd_h8500_arch,
- &bfd_hppa_arch,
- &bfd_i370_arch,
- &bfd_i386_arch,
- &bfd_i860_arch,
- &bfd_i960_arch,
- &bfd_ia64_arch,
- &bfd_ip2k_arch,
- &bfd_iq2000_arch,
- &bfd_m32r_arch,
- &bfd_m68hc11_arch,
- &bfd_m68hc12_arch,
- &bfd_m68k_arch,
- &bfd_m88k_arch,
- &bfd_mcore_arch,
- &bfd_mips_arch,
- &bfd_mmix_arch,
- &bfd_mn10200_arch,
- &bfd_mn10300_arch,
- &bfd_msp430_arch,
- &bfd_ns32k_arch,
- &bfd_openrisc_arch,
- &bfd_or32_arch,
- &bfd_pdp11_arch,
- &bfd_powerpc_arch,
- &bfd_rs6000_arch,
- &bfd_s390_arch,
- &bfd_sh_arch,
- &bfd_sparc_arch,
- &bfd_tic30_arch,
- &bfd_tic4x_arch,
- &bfd_tic54x_arch,
- &bfd_tic80_arch,
- &bfd_v850_arch,
- &bfd_vax_arch,
- &bfd_w65_arch,
- &bfd_we32k_arch,
- &bfd_xstormy16_arch,
- &bfd_xtensa_arch,
- &bfd_z8k_arch,
-#endif
- 0
-};
-
-/*
-FUNCTION
- bfd_printable_name
-
-SYNOPSIS
- const char *bfd_printable_name (bfd *abfd);
-
-DESCRIPTION
- Return a printable string representing the architecture and machine
- from the pointer to the architecture info structure.
-
-*/
-
-const char *
-bfd_printable_name (bfd *abfd)
-{
- return abfd->arch_info->printable_name;
-}
-
-/*
-FUNCTION
- bfd_scan_arch
-
-SYNOPSIS
- const bfd_arch_info_type *bfd_scan_arch (const char *string);
-
-DESCRIPTION
- Figure out if BFD supports any cpu which could be described with
- the name @var{string}. Return a pointer to an <<arch_info>>
- structure if a machine is found, otherwise NULL.
-*/
-
-const bfd_arch_info_type *
-bfd_scan_arch (const char *string)
-{
- const bfd_arch_info_type * const *app, *ap;
-
- /* Look through all the installed architectures. */
- for (app = bfd_archures_list; *app != NULL; app++)
- {
- for (ap = *app; ap != NULL; ap = ap->next)
- {
- if (ap->scan (ap, string))
- return ap;
- }
- }
-
- return NULL;
-}
-
-/*
-FUNCTION
- bfd_arch_list
-
-SYNOPSIS
- const char **bfd_arch_list (void);
-
-DESCRIPTION
- Return a freshly malloced NULL-terminated vector of the names
- of all the valid BFD architectures. Do not modify the names.
-*/
-
-const char **
-bfd_arch_list (void)
-{
- int vec_length = 0;
- 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;
- for (app = bfd_archures_list; *app != NULL; app++)
- {
- const bfd_arch_info_type *ap;
- for (ap = *app; ap != NULL; ap = ap->next)
- {
- vec_length++;
- }
- }
-
- amt = (vec_length + 1) * sizeof (char **);
- name_list = bfd_malloc (amt);
- if (name_list == NULL)
- return NULL;
-
- /* Point the list at each of the names. */
- name_ptr = name_list;
- for (app = bfd_archures_list; *app != NULL; app++)
- {
- const bfd_arch_info_type *ap;
- for (ap = *app; ap != NULL; ap = ap->next)
- {
- *name_ptr = ap->printable_name;
- name_ptr++;
- }
- }
- *name_ptr = NULL;
-
- return name_list;
-}
-
-/*
-FUNCTION
- bfd_arch_get_compatible
-
-SYNOPSIS
- const bfd_arch_info_type *bfd_arch_get_compatible
- (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
-
-DESCRIPTION
- Determine whether two BFDs' architectures and machine types
- are compatible. Calculates the lowest common denominator
- between the two architectures and machine types implied by
- the BFDs and returns a pointer to an <<arch_info>> structure
- describing the compatible machine.
-*/
-
-const bfd_arch_info_type *
-bfd_arch_get_compatible (const bfd *abfd,
- const bfd *bbfd,
- bfd_boolean accept_unknowns)
-{
- const bfd * ubfd = NULL;
-
- /* Look for an unknown architecture. */
- if (((ubfd = abfd) && ubfd->arch_info->arch == bfd_arch_unknown)
- || ((ubfd = bbfd) && ubfd->arch_info->arch == bfd_arch_unknown))
- {
- /* We can allow an unknown architecture if accept_unknowns
- is true, or if the target is the "binary" format, which
- has an unknown architecture. Since the binary format can
- only be set by explicit request from the user, it is safe
- to assume that they know what they are doing. */
- if (accept_unknowns
- || strcmp (bfd_get_target (ubfd), "binary") == 0)
- return ubfd->arch_info;
- return NULL;
- }
-
- /* Otherwise architecture-specific code has to decide. */
- return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
-}
-
-/*
-INTERNAL_DEFINITION
- bfd_default_arch_struct
-
-DESCRIPTION
- The <<bfd_default_arch_struct>> is an item of
- <<bfd_arch_info_type>> which has been initialized to a fairly
- generic state. A BFD starts life by pointing to this
- structure, until the correct back end has determined the real
- architecture of the file.
-
-.extern const bfd_arch_info_type bfd_default_arch_struct;
-*/
-
-const bfd_arch_info_type bfd_default_arch_struct = {
- 32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
- bfd_default_compatible,
- bfd_default_scan,
- 0,
-};
-
-/*
-FUNCTION
- bfd_set_arch_info
-
-SYNOPSIS
- void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
-
-DESCRIPTION
- Set the architecture info of @var{abfd} to @var{arg}.
-*/
-
-void
-bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg)
-{
- abfd->arch_info = arg;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_default_set_arch_mach
-
-SYNOPSIS
- bfd_boolean bfd_default_set_arch_mach
- (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
-
-DESCRIPTION
- Set the architecture and machine type in BFD @var{abfd}
- to @var{arch} and @var{mach}. Find the correct
- pointer to a structure and insert it into the <<arch_info>>
- pointer.
-*/
-
-bfd_boolean
-bfd_default_set_arch_mach (bfd *abfd,
- enum bfd_architecture arch,
- unsigned long mach)
-{
- abfd->arch_info = bfd_lookup_arch (arch, mach);
- if (abfd->arch_info != NULL)
- return TRUE;
-
- abfd->arch_info = &bfd_default_arch_struct;
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
-}
-
-/*
-FUNCTION
- bfd_get_arch
-
-SYNOPSIS
- enum bfd_architecture bfd_get_arch (bfd *abfd);
-
-DESCRIPTION
- Return the enumerated type which describes the BFD @var{abfd}'s
- architecture.
-*/
-
-enum bfd_architecture
-bfd_get_arch (bfd *abfd)
-{
- return abfd->arch_info->arch;
-}
-
-/*
-FUNCTION
- bfd_get_mach
-
-SYNOPSIS
- unsigned long bfd_get_mach (bfd *abfd);
-
-DESCRIPTION
- Return the long type which describes the BFD @var{abfd}'s
- machine.
-*/
-
-unsigned long
-bfd_get_mach (bfd *abfd)
-{
- return abfd->arch_info->mach;
-}
-
-/*
-FUNCTION
- bfd_arch_bits_per_byte
-
-SYNOPSIS
- unsigned int bfd_arch_bits_per_byte (bfd *abfd);
-
-DESCRIPTION
- Return the number of bits in one of the BFD @var{abfd}'s
- architecture's bytes.
-*/
-
-unsigned int
-bfd_arch_bits_per_byte (bfd *abfd)
-{
- return abfd->arch_info->bits_per_byte;
-}
-
-/*
-FUNCTION
- bfd_arch_bits_per_address
-
-SYNOPSIS
- unsigned int bfd_arch_bits_per_address (bfd *abfd);
-
-DESCRIPTION
- Return the number of bits in one of the BFD @var{abfd}'s
- architecture's addresses.
-*/
-
-unsigned int
-bfd_arch_bits_per_address (bfd *abfd)
-{
- return abfd->arch_info->bits_per_address;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_default_compatible
-
-SYNOPSIS
- const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-
-DESCRIPTION
- The default function for testing for compatibility.
-*/
-
-const bfd_arch_info_type *
-bfd_default_compatible (const bfd_arch_info_type *a,
- const bfd_arch_info_type *b)
-{
- if (a->arch != b->arch)
- return NULL;
-
- if (a->bits_per_word != b->bits_per_word)
- return NULL;
-
- if (a->mach > b->mach)
- return a;
-
- if (b->mach > a->mach)
- return b;
-
- return a;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_default_scan
-
-SYNOPSIS
- bfd_boolean bfd_default_scan
- (const struct bfd_arch_info *info, const char *string);
-
-DESCRIPTION
- The default function for working out whether this is an
- architecture hit and a machine hit.
-*/
-
-bfd_boolean
-bfd_default_scan (const bfd_arch_info_type *info, const char *string)
-{
- const char *ptr_src;
- const char *ptr_tst;
- unsigned long number;
- enum bfd_architecture arch;
- const char *printable_name_colon;
-
- /* Exact match of the architecture name (ARCH_NAME) and also the
- default architecture? */
- if (strcasecmp (string, info->arch_name) == 0
- && info->the_default)
- return TRUE;
-
- /* Exact match of the machine name (PRINTABLE_NAME)? */
- if (strcasecmp (string, info->printable_name) == 0)
- return TRUE;
-
- /* Given that printable_name contains no colon, attempt to match:
- ARCH_NAME [ ":" ] PRINTABLE_NAME? */
- printable_name_colon = strchr (info->printable_name, ':');
- if (printable_name_colon == NULL)
- {
- size_t strlen_arch_name = strlen (info->arch_name);
- if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
- {
- if (string[strlen_arch_name] == ':')
- {
- if (strcasecmp (string + strlen_arch_name + 1,
- info->printable_name) == 0)
- return TRUE;
- }
- else
- {
- if (strcasecmp (string + strlen_arch_name,
- info->printable_name) == 0)
- return TRUE;
- }
- }
- }
-
- /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
- Attempt to match: <arch> <mach>? */
- if (printable_name_colon != NULL)
- {
- 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)
- return TRUE;
- }
-
- /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
- attempt to match just <mach>, it could be ambiguous. This test
- is left until later. */
-
- /* NOTE: The below is retained for compatibility only. Please do
- not add to this code. */
-
- /* See how much of the supplied string matches with the
- architecture, eg the string m68k:68020 would match the 68k entry
- up to the :, then we get left with the machine number. */
-
- for (ptr_src = string, ptr_tst = info->arch_name;
- *ptr_src && *ptr_tst;
- ptr_src++, ptr_tst++)
- {
- if (*ptr_src != *ptr_tst)
- break;
- }
-
- /* Chewed up as much of the architecture as will match, skip any
- colons. */
- if (*ptr_src == ':')
- ptr_src++;
-
- if (*ptr_src == 0)
- {
- /* Nothing more, then only keep this one if it is the default
- machine for this architecture. */
- return info->the_default;
- }
-
- number = 0;
- while (ISDIGIT (*ptr_src))
- {
- number = number * 10 + *ptr_src - '0';
- ptr_src++;
- }
-
- /* NOTE: The below is retained for compatibility only.
- PLEASE DO NOT ADD TO THIS CODE. */
-
- switch (number)
- {
- /* FIXME: These are needed to parse IEEE objects. */
- /* The following seven case's are here only for compatibility with
- older binutils (at least IEEE objects from binutils 2.9.1 require
- them). */
- case bfd_mach_m68000:
- case bfd_mach_m68010:
- case bfd_mach_m68020:
- case bfd_mach_m68030:
- case bfd_mach_m68040:
- case bfd_mach_m68060:
- case bfd_mach_cpu32:
- arch = bfd_arch_m68k;
- break;
- case 68000:
- arch = bfd_arch_m68k;
- number = bfd_mach_m68000;
- break;
- case 68010:
- arch = bfd_arch_m68k;
- number = bfd_mach_m68010;
- break;
- case 68020:
- arch = bfd_arch_m68k;
- number = bfd_mach_m68020;
- break;
- case 68030:
- arch = bfd_arch_m68k;
- number = bfd_mach_m68030;
- break;
- case 68040:
- arch = bfd_arch_m68k;
- number = bfd_mach_m68040;
- break;
- case 68060:
- arch = bfd_arch_m68k;
- number = bfd_mach_m68060;
- break;
- case 68332:
- arch = bfd_arch_m68k;
- number = bfd_mach_cpu32;
- break;
- case 5200:
- arch = bfd_arch_m68k;
- number = bfd_mach_mcf5200;
- break;
- case 5206:
- arch = bfd_arch_m68k;
- number = bfd_mach_mcf5206e;
- break;
- case 5307:
- arch = bfd_arch_m68k;
- number = bfd_mach_mcf5307;
- break;
- case 5407:
- arch = bfd_arch_m68k;
- number = bfd_mach_mcf5407;
- break;
- case 5282:
- arch = bfd_arch_m68k;
- number = bfd_mach_mcf528x;
- break;
-
- case 32000:
- arch = bfd_arch_we32k;
- break;
-
- case 3000:
- arch = bfd_arch_mips;
- number = bfd_mach_mips3000;
- break;
-
- case 4000:
- arch = bfd_arch_mips;
- number = bfd_mach_mips4000;
- break;
-
- case 6000:
- arch = bfd_arch_rs6000;
- break;
-
- case 7410:
- arch = bfd_arch_sh;
- number = bfd_mach_sh_dsp;
- break;
-
- case 7708:
- arch = bfd_arch_sh;
- number = bfd_mach_sh3;
- break;
-
- case 7729:
- arch = bfd_arch_sh;
- number = bfd_mach_sh3_dsp;
- break;
-
- case 7750:
- arch = bfd_arch_sh;
- number = bfd_mach_sh4;
- break;
-
- default:
- return FALSE;
- }
-
- if (arch != info->arch)
- return FALSE;
-
- if (number != info->mach)
- return FALSE;
-
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_get_arch_info
-
-SYNOPSIS
- const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
-
-DESCRIPTION
- Return the architecture info struct in @var{abfd}.
-*/
-
-const bfd_arch_info_type *
-bfd_get_arch_info (bfd *abfd)
-{
- return abfd->arch_info;
-}
-
-/*
-FUNCTION
- bfd_lookup_arch
-
-SYNOPSIS
- const bfd_arch_info_type *bfd_lookup_arch
- (enum bfd_architecture arch, unsigned long machine);
-
-DESCRIPTION
- Look for the architecture info structure which matches the
- arguments @var{arch} and @var{machine}. A machine of 0 matches the
- machine/architecture structure which marks itself as the
- default.
-*/
-
-const bfd_arch_info_type *
-bfd_lookup_arch (enum bfd_architecture arch, unsigned long machine)
-{
- const bfd_arch_info_type * const *app, *ap;
-
- for (app = bfd_archures_list; *app != NULL; app++)
- {
- for (ap = *app; ap != NULL; ap = ap->next)
- {
- if (ap->arch == arch
- && (ap->mach == machine
- || (machine == 0 && ap->the_default)))
- return ap;
- }
- }
-
- return NULL;
-}
-
-/*
-FUNCTION
- bfd_printable_arch_mach
-
-SYNOPSIS
- const char *bfd_printable_arch_mach
- (enum bfd_architecture arch, unsigned long machine);
-
-DESCRIPTION
- Return a printable string representing the architecture and
- machine type.
-
- This routine is depreciated.
-*/
-
-const char *
-bfd_printable_arch_mach (enum bfd_architecture arch, unsigned long machine)
-{
- const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
-
- if (ap)
- return ap->printable_name;
- return "UNKNOWN!";
-}
-
-/*
-FUNCTION
- bfd_octets_per_byte
-
-SYNOPSIS
- unsigned int bfd_octets_per_byte (bfd *abfd);
-
-DESCRIPTION
- Return the number of octets (8-bit quantities) per target byte
- (minimum addressable unit). In most cases, this will be one, but some
- DSP targets have 16, 32, or even 48 bits per byte.
-*/
-
-unsigned int
-bfd_octets_per_byte (bfd *abfd)
-{
- return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
- bfd_get_mach (abfd));
-}
-
-/*
-FUNCTION
- bfd_arch_mach_octets_per_byte
-
-SYNOPSIS
- unsigned int bfd_arch_mach_octets_per_byte
- (enum bfd_architecture arch, unsigned long machine);
-
-DESCRIPTION
- See bfd_octets_per_byte.
-
- This routine is provided for those cases where a bfd * is not
- available
-*/
-
-unsigned int
-bfd_arch_mach_octets_per_byte (enum bfd_architecture arch,
- unsigned long mach)
-{
- const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
-
- if (ap)
- return ap->bits_per_byte / 8;
- return 1;
-}
diff --git a/contrib/binutils/bfd/armnetbsd.c b/contrib/binutils/bfd/armnetbsd.c
deleted file mode 100644
index d82e98f..0000000
--- a/contrib/binutils/bfd/armnetbsd.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* BFD back-end for NetBSD/ARM a.out-ish binaries.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define BYTES_IN_WORD 4
-#undef TARGET_IS_BIG_ENDIAN_P
-
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-
-#define DEFAULT_ARCH bfd_arch_arm
-#define DEFAULT_MID M_ARM6_NETBSD
-/*#define MACHTYPE_OK(mtype) ((mtype) == M_ARM6_NETBSD)*/
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (armnetbsd_, OP)
-
-/* This needs to start with a.out so GDB knows it is an a.out variant. */
-#define TARGETNAME "a.out-arm-netbsd"
-
-#if 0
-#define NAME(x,y) CONCAT3 (aoutarm,_32_,y)
-
-#define aoutarm_32_get_section_contents aout_32_get_section_contents
-
-#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
-
-#include "bfd.h" /* To ensure following declaration is OK */
-
-const struct reloc_howto_struct *
-MY_bfd_reloc_type_lookup
- PARAMS ((bfd * abfd AND
- bfd_reloc_code_real_type code));
-#endif
-
-#include "netbsd.h"
diff --git a/contrib/binutils/bfd/bfd-in.h b/contrib/binutils/bfd/bfd-in.h
deleted file mode 100644
index 1a5d1ea..0000000
--- a/contrib/binutils/bfd/bfd-in.h
+++ /dev/null
@@ -1,824 +0,0 @@
-/* Main header file for the bfd library -- portable access to object files.
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- Contributed by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef __BFD_H_SEEN__
-#define __BFD_H_SEEN__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "ansidecl.h"
-#include "symcat.h"
-#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-#ifndef SABER
-/* This hack is to avoid a problem with some strict ANSI C preprocessors.
- The problem is, "32_" is not a valid preprocessing token, and we don't
- want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will
- cause the inner CONCAT2 macros to be evaluated first, producing
- still-valid pp-tokens. Then the final concatenation can be done. */
-#undef CONCAT4
-#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
-#endif
-#endif
-
-/* The word size used by BFD on the host. This may be 64 with a 32
- bit target if the host is 64 bit, or if other 64 bit targets have
- been selected with --enable-targets, or if --enable-64-bit-bfd. */
-#define BFD_ARCH_SIZE @wordsize@
-
-/* The word size of the default bfd target. */
-#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
-
-#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
-#define BFD_HOST_LONG_LONG @BFD_HOST_LONG_LONG@
-#if @BFD_HOST_64_BIT_DEFINED@
-#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
-#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
-typedef BFD_HOST_64_BIT bfd_int64_t;
-typedef BFD_HOST_U_64_BIT bfd_uint64_t;
-#endif
-
-#if BFD_ARCH_SIZE >= 64
-#define BFD64
-#endif
-
-#ifndef INLINE
-#if __GNUC__ >= 2
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-#endif
-
-/* Forward declaration. */
-typedef struct bfd bfd;
-
-/* Boolean type used in bfd. Too many systems define their own
- versions of "boolean" for us to safely typedef a "boolean" of
- our own. Using an enum for "bfd_boolean" has its own set of
- problems, with strange looking casts required to avoid warnings
- on some older compilers. Thus we just use an int.
-
- General rule: Functions which are bfd_boolean return TRUE on
- success and FALSE on failure (unless they're a predicate). */
-
-typedef int bfd_boolean;
-#undef FALSE
-#undef TRUE
-#define FALSE 0
-#define TRUE 1
-
-#if 0
-/* Poison. */
-#undef false
-#undef true
-#define false dont_use_false_in_bfd
-#define true dont_use_true_in_bfd
-#endif
-
-#ifdef BFD64
-
-#ifndef BFD_HOST_64_BIT
- #error No 64 bit integer type available
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-typedef BFD_HOST_U_64_BIT bfd_vma;
-typedef BFD_HOST_64_BIT bfd_signed_vma;
-typedef BFD_HOST_U_64_BIT bfd_size_type;
-typedef BFD_HOST_U_64_BIT symvalue;
-
-#ifndef fprintf_vma
-#if BFD_HOST_64BIT_LONG
-#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
-#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
-#else
-#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
-#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
-#define fprintf_vma(s,x) \
- fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#define sprintf_vma(s,x) \
- sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#endif
-#endif
-
-#else /* not BFD64 */
-
-/* Represent a target address. Also used as a generic unsigned type
- which is guaranteed to be big enough to hold any arithmetic types
- we need to deal with. */
-typedef unsigned long bfd_vma;
-
-/* A generic signed type which is guaranteed to be big enough to hold any
- arithmetic types we need to deal with. Can be assumed to be compatible
- with bfd_vma in the same way that signed and unsigned ints are compatible
- (as parameters, in assignment, etc). */
-typedef long bfd_signed_vma;
-
-typedef unsigned long symvalue;
-typedef unsigned long bfd_size_type;
-
-/* Print a bfd_vma x on stream s. */
-#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
-
-#endif /* not BFD64 */
-
-#ifndef BFD_HOST_64_BIT
-/* Fall back on a 32 bit type. The idea is to make these types always
- available for function return types, but in the case that
- BFD_HOST_64_BIT is undefined such a function should abort or
- otherwise signal an error. */
-typedef bfd_signed_vma bfd_int64_t;
-typedef bfd_vma bfd_uint64_t;
-#endif
-
-/* An offset into a file. BFD always uses the largest possible offset
- based on the build time availability of fseek, fseeko, or fseeko64. */
-typedef @bfd_file_ptr@ file_ptr;
-typedef unsigned @bfd_file_ptr@ ufile_ptr;
-
-extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
-extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
-
-#define printf_vma(x) fprintf_vma(stdout,x)
-#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
-
-typedef unsigned int flagword; /* 32 bits of flags */
-typedef unsigned char bfd_byte;
-
-/* File formats. */
-
-typedef enum bfd_format
-{
- bfd_unknown = 0, /* File format is unknown. */
- bfd_object, /* Linker/assembler/compiler output. */
- bfd_archive, /* Object archive file. */
- bfd_core, /* Core dump. */
- bfd_type_end /* Marks the end; don't use it! */
-}
-bfd_format;
-
-/* Values that may appear in the flags field of a BFD. These also
- appear in the object_flags field of the bfd_target structure, where
- they indicate the set of flags used by that backend (not all flags
- are meaningful for all object file formats) (FIXME: at the moment,
- the object_flags values have mostly just been copied from backend
- to another, and are not necessarily correct). */
-
-/* No flags. */
-#define BFD_NO_FLAGS 0x00
-
-/* BFD contains relocation entries. */
-#define HAS_RELOC 0x01
-
-/* BFD is directly executable. */
-#define EXEC_P 0x02
-
-/* BFD has line number information (basically used for F_LNNO in a
- COFF header). */
-#define HAS_LINENO 0x04
-
-/* BFD has debugging information. */
-#define HAS_DEBUG 0x08
-
-/* BFD has symbols. */
-#define HAS_SYMS 0x10
-
-/* BFD has local symbols (basically used for F_LSYMS in a COFF
- header). */
-#define HAS_LOCALS 0x20
-
-/* BFD is a dynamic object. */
-#define DYNAMIC 0x40
-
-/* Text section is write protected (if D_PAGED is not set, this is
- like an a.out NMAGIC file) (the linker sets this by default, but
- clears it for -r or -N). */
-#define WP_TEXT 0x80
-
-/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
- linker sets this by default, but clears it for -r or -n or -N). */
-#define D_PAGED 0x100
-
-/* BFD is relaxable (this means that bfd_relax_section may be able to
- do something) (sometimes bfd_relax_section can do something even if
- this is not set). */
-#define BFD_IS_RELAXABLE 0x200
-
-/* This may be set before writing out a BFD to request using a
- traditional format. For example, this is used to request that when
- writing out an a.out object the symbols not be hashed to eliminate
- duplicates. */
-#define BFD_TRADITIONAL_FORMAT 0x400
-
-/* This flag indicates that the BFD contents are actually cached in
- memory. If this is set, iostream points to a bfd_in_memory struct. */
-#define BFD_IN_MEMORY 0x800
-
-/* The sections in this BFD specify a memory page. */
-#define HAS_LOAD_PAGE 0x1000
-
-/* Symbols and relocation. */
-
-/* A count of carsyms (canonical archive symbols). */
-typedef unsigned long symindex;
-
-/* How to perform a relocation. */
-typedef const struct reloc_howto_struct reloc_howto_type;
-
-#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-
-/* General purpose part of a symbol X;
- target specific parts are in libcoff.h, libaout.h, etc. */
-
-#define bfd_get_section(x) ((x)->section)
-#define bfd_get_output_section(x) ((x)->section->output_section)
-#define bfd_set_section(x,y) ((x)->section) = (y)
-#define bfd_asymbol_base(x) ((x)->section->vma)
-#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
-#define bfd_asymbol_name(x) ((x)->name)
-/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
-#define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
-
-/* A canonical archive symbol. */
-/* This is a type pun with struct ranlib on purpose! */
-typedef struct carsym
-{
- char *name;
- file_ptr file_offset; /* Look here to find the file. */
-}
-carsym; /* To make these you call a carsymogen. */
-
-/* Used in generating armaps (archive tables of contents).
- Perhaps just a forward definition would do? */
-struct orl /* Output ranlib. */
-{
- char **name; /* Symbol name. */
- union
- {
- file_ptr pos;
- bfd *abfd;
- } u; /* bfd* or file position. */
- int namidx; /* Index into string table. */
-};
-
-/* Linenumber stuff. */
-typedef struct lineno_cache_entry
-{
- unsigned int line_number; /* Linenumber from start of function. */
- union
- {
- struct bfd_symbol *sym; /* Function name. */
- bfd_vma offset; /* Offset into section. */
- } u;
-}
-alent;
-
-/* Object and core file sections. */
-
-#define align_power(addr, align) \
- (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
-
-typedef struct bfd_section *sec_ptr;
-
-#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
-#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
-#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
-#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
-#define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
-#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
-#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
-#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
-#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
-
-#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
-
-typedef struct stat stat_type;
-
-typedef enum bfd_print_symbol
-{
- bfd_print_symbol_name,
- bfd_print_symbol_more,
- bfd_print_symbol_all
-} bfd_print_symbol_type;
-
-/* Information about a symbol that nm needs. */
-
-typedef struct _symbol_info
-{
- symvalue value;
- char type;
- 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. */
-} symbol_info;
-
-/* Get the name of a stabs type code. */
-
-extern const char *bfd_get_stab_name (int);
-
-/* Hash table routines. There is no way to free up a hash table. */
-
-/* An element in the hash table. Most uses will actually use a larger
- structure, and an instance of this will be the first field. */
-
-struct bfd_hash_entry
-{
- /* Next entry for this hash code. */
- struct bfd_hash_entry *next;
- /* String being hashed. */
- const char *string;
- /* Hash code. This is the full hash code, not the index into the
- table. */
- unsigned long hash;
-};
-
-/* A hash table. */
-
-struct bfd_hash_table
-{
- /* The hash array. */
- struct bfd_hash_entry **table;
- /* The number of slots in the hash table. */
- unsigned int size;
- /* A function used to create new elements in the hash table. The
- first entry is itself a pointer to an element. When this
- function is first invoked, this pointer will be NULL. However,
- having the pointer permits a hierarchy of method functions to be
- built each of which calls the function in the superclass. Thus
- each function should be written to allocate a new block of memory
- only if the argument is NULL. */
- struct bfd_hash_entry *(*newfunc)
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
- /* An objalloc for this hash table. This is a struct objalloc *,
- but we use void * to avoid requiring the inclusion of objalloc.h. */
- void *memory;
-};
-
-/* Initialize a hash table. */
-extern bfd_boolean bfd_hash_table_init
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
-
-/* Initialize a hash table specifying a size. */
-extern bfd_boolean bfd_hash_table_init_n
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int size);
-
-/* Free up a hash table. */
-extern void bfd_hash_table_free
- (struct bfd_hash_table *);
-
-/* Look up a string in a hash table. If CREATE is TRUE, a new entry
- will be created for this string if one does not already exist. The
- COPY argument must be TRUE if this routine should copy the string
- into newly allocated memory when adding an entry. */
-extern struct bfd_hash_entry *bfd_hash_lookup
- (struct bfd_hash_table *, const char *, bfd_boolean create,
- bfd_boolean copy);
-
-/* Replace an entry in a hash table. */
-extern void bfd_hash_replace
- (struct bfd_hash_table *, struct bfd_hash_entry *old,
- struct bfd_hash_entry *nw);
-
-/* Base method for creating a hash table entry. */
-extern struct bfd_hash_entry *bfd_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-
-/* Grab some space for a hash table entry. */
-extern void *bfd_hash_allocate
- (struct bfd_hash_table *, unsigned int);
-
-/* Traverse a hash table in a random order, calling a function on each
- element. If the function returns FALSE, the traversal stops. The
- INFO argument is passed to the function. */
-extern void bfd_hash_traverse
- (struct bfd_hash_table *,
- bfd_boolean (*) (struct bfd_hash_entry *, void *),
- void *info);
-
-#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
-
-/* User program access to BFD facilities. */
-
-/* Direct I/O routines, for programs which know more about the object
- file than BFD does. Use higher level routines if possible. */
-
-extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
-extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
-extern int bfd_seek (bfd *, file_ptr, int);
-extern file_ptr bfd_tell (bfd *);
-extern int bfd_flush (bfd *);
-extern int bfd_stat (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 (const char *, const char *, int, const char *);
-
-/* Cast from const char * to char * so that caller can assign to
- a char * without a warning. */
-#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
-#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
-#define bfd_get_format(abfd) ((abfd)->format)
-#define bfd_get_target(abfd) ((abfd)->xvec->name)
-#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
-#define bfd_family_coff(abfd) \
- (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
- bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
-#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
-#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_header_big_endian(abfd) \
- ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
-#define bfd_header_little_endian(abfd) \
- ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_get_file_flags(abfd) ((abfd)->flags)
-#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
-#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
-#define bfd_my_archive(abfd) ((abfd)->my_archive)
-#define bfd_has_map(abfd) ((abfd)->has_armap)
-
-#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
-#define bfd_usrdata(abfd) ((abfd)->usrdata)
-
-#define bfd_get_start_address(abfd) ((abfd)->start_address)
-#define bfd_get_symcount(abfd) ((abfd)->symcount)
-#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
-#define bfd_count_sections(abfd) ((abfd)->section_count)
-
-#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
-
-#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
-
-extern bfd_boolean bfd_cache_close
- (bfd *abfd);
-/* NB: This declaration should match the autogenerated one in libbfd.h. */
-
-extern bfd_boolean bfd_record_phdr
- (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
- bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
-
-/* Byte swapping routines. */
-
-bfd_uint64_t bfd_getb64 (const void *);
-bfd_uint64_t bfd_getl64 (const void *);
-bfd_int64_t bfd_getb_signed_64 (const void *);
-bfd_int64_t bfd_getl_signed_64 (const void *);
-bfd_vma bfd_getb32 (const void *);
-bfd_vma bfd_getl32 (const void *);
-bfd_signed_vma bfd_getb_signed_32 (const void *);
-bfd_signed_vma bfd_getl_signed_32 (const void *);
-bfd_vma bfd_getb16 (const void *);
-bfd_vma bfd_getl16 (const void *);
-bfd_signed_vma bfd_getb_signed_16 (const void *);
-bfd_signed_vma bfd_getl_signed_16 (const void *);
-void bfd_putb64 (bfd_uint64_t, void *);
-void bfd_putl64 (bfd_uint64_t, void *);
-void bfd_putb32 (bfd_vma, void *);
-void bfd_putl32 (bfd_vma, void *);
-void bfd_putb16 (bfd_vma, void *);
-void bfd_putl16 (bfd_vma, void *);
-
-/* Byte swapping routines which take size and endiannes as arguments. */
-
-bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
-void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
-
-/* Externally visible ECOFF routines. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct bfd_symbol;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
-struct bfd_elf_version_tree;
-#endif
-extern bfd_vma bfd_ecoff_get_gp_value
- (bfd * abfd);
-extern bfd_boolean bfd_ecoff_set_gp_value
- (bfd *abfd, bfd_vma gp_value);
-extern bfd_boolean bfd_ecoff_set_regmasks
- (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
- unsigned long *cprmask);
-extern void *bfd_ecoff_debug_init
- (bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
-extern void bfd_ecoff_debug_free
- (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
-extern bfd_boolean bfd_ecoff_debug_accumulate
- (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
- struct ecoff_debug_info *input_debug,
- const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
-extern bfd_boolean bfd_ecoff_debug_accumulate_other
- (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
- struct bfd_link_info *);
-extern bfd_boolean bfd_ecoff_debug_externals
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
- bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
- void (*set_index) (struct bfd_symbol *, bfd_size_type));
-extern bfd_boolean bfd_ecoff_debug_one_external
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, const char *name,
- struct ecoff_extr *esym);
-extern bfd_size_type bfd_ecoff_debug_size
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap);
-extern bfd_boolean bfd_ecoff_write_debug
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, file_ptr where);
-extern bfd_boolean bfd_ecoff_write_accumulated_debug
- (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- struct bfd_link_info *info, file_ptr where);
-extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-
-/* Externally visible ELF routines. */
-
-struct bfd_link_needed_list
-{
- struct bfd_link_needed_list *next;
- bfd *by;
- const char *name;
-};
-
-enum dynamic_lib_link_class {
- DYN_NORMAL = 0,
- DYN_AS_NEEDED = 1,
- DYN_DT_NEEDED = 2
-};
-
-extern bfd_boolean bfd_elf_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *, bfd_boolean);
-extern struct bfd_link_needed_list *bfd_elf_get_needed_list
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_elf_get_bfd_needed_list
- (bfd *, struct bfd_link_needed_list **);
-extern bfd_boolean bfd_elf_size_dynamic_sections
- (bfd *, const char *, const char *, const char *, const char * const *,
- struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *);
-extern void bfd_elf_set_dt_needed_name
- (bfd *, const char *);
-extern const char *bfd_elf_get_dt_soname
- (bfd *);
-extern void bfd_elf_set_dyn_lib_class
- (bfd *, int);
-extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_elf_discard_info
- (bfd *, struct bfd_link_info *);
-
-/* Return an upper bound on the number of bytes required to store a
- copy of ABFD's program header table entries. Return -1 if an error
- occurs; bfd_get_error will return an appropriate code. */
-extern long bfd_get_elf_phdr_upper_bound
- (bfd *abfd);
-
-/* Copy ABFD's program header table entries to *PHDRS. The entries
- will be stored as an array of Elf_Internal_Phdr structures, as
- defined in include/elf/internal.h. To find out how large the
- buffer needs to be, call bfd_get_elf_phdr_upper_bound.
-
- Return the number of program header table entries read, or -1 if an
- error occurs; bfd_get_error will return an appropriate code. */
-extern int bfd_get_elf_phdrs
- (bfd *abfd, void *phdrs);
-
-/* Create a new BFD as if by bfd_openr. Rather than opening a file,
- reconstruct an ELF file by reading the segments out of remote memory
- based on the ELF file header at EHDR_VMA and the ELF program headers it
- points to. If not null, *LOADBASEP is filled in with the difference
- between the VMAs from which the segments were read, and the VMAs the
- file headers (and hence BFD's idea of each section's VMA) put them at.
-
- The function TARGET_READ_MEMORY is called to copy LEN bytes from the
- remote memory at target address VMA into the local buffer at MYADDR; it
- should return zero on success or an `errno' code on failure. TEMPL must
- be a BFD for an ELF target with the word size and byte order found in
- the remote memory. */
-extern bfd *bfd_elf_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
-
-/* Return the arch_size field of an elf bfd, or -1 if not elf. */
-extern int bfd_get_arch_size
- (bfd *);
-
-/* Return TRUE if address "naturally" sign extends, or -1 if not elf. */
-extern int bfd_get_sign_extend_vma
- (bfd *);
-
-extern struct bfd_section *_bfd_elf_tls_setup
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-extern bfd_boolean bfd_mips_elf32_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-
-/* SunOS shared library support routines for the linker. */
-
-extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_sunos_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *);
-extern bfd_boolean bfd_sunos_size_dynamic_sections
- (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **);
-
-/* Linux shared library support routines for the linker. */
-
-extern bfd_boolean bfd_i386linux_size_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_m68klinux_size_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_sparclinux_size_dynamic_sections
- (bfd *, struct bfd_link_info *);
-
-/* mmap hacks */
-
-struct _bfd_window_internal;
-typedef struct _bfd_window_internal bfd_window_internal;
-
-typedef struct _bfd_window
-{
- /* What the user asked for. */
- void *data;
- bfd_size_type size;
- /* The actual window used by BFD. Small user-requested read-only
- regions sharing a page may share a single window into the object
- file. Read-write versions shouldn't until I've fixed things to
- keep track of which portions have been claimed by the
- application; don't want to give the same region back when the
- application wants two writable copies! */
- struct _bfd_window_internal *i;
-}
-bfd_window;
-
-extern void bfd_init_window
- (bfd_window *);
-extern void bfd_free_window
- (bfd_window *);
-extern bfd_boolean bfd_get_file_window
- (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
-
-/* XCOFF support routines for the linker. */
-
-extern bfd_boolean bfd_xcoff_link_record_set
- (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
-extern bfd_boolean bfd_xcoff_import_symbol
- (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
- const char *, const char *, const char *, unsigned int);
-extern bfd_boolean bfd_xcoff_export_symbol
- (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
-extern bfd_boolean bfd_xcoff_link_count_reloc
- (bfd *, struct bfd_link_info *, const char *);
-extern bfd_boolean bfd_xcoff_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *);
-extern bfd_boolean bfd_xcoff_size_dynamic_sections
- (bfd *, struct bfd_link_info *, const char *, const char *,
- unsigned long, unsigned long, unsigned long, bfd_boolean,
- int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean);
-extern bfd_boolean bfd_xcoff_link_generate_rtinit
- (bfd *, const char *, const char *, bfd_boolean);
-
-/* XCOFF support routines for ar. */
-extern bfd_boolean bfd_xcoff_ar_archive_set_magic
- (bfd *, char *);
-
-/* Externally visible COFF routines. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct internal_syment;
-union internal_auxent;
-#endif
-
-extern bfd_boolean bfd_coff_get_syment
- (bfd *, struct bfd_symbol *, struct internal_syment *);
-
-extern bfd_boolean bfd_coff_get_auxent
- (bfd *, struct bfd_symbol *, int, union internal_auxent *);
-
-extern bfd_boolean bfd_coff_set_symbol_class
- (bfd *, struct bfd_symbol *, unsigned int);
-
-extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-
-/* ARM Interworking support. Called from linker. */
-extern bfd_boolean bfd_arm_allocate_interworking_sections
- (struct bfd_link_info *);
-
-extern bfd_boolean bfd_arm_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
-
-extern bfd_boolean bfd_arm_get_bfd_for_interworking
- (bfd *, struct bfd_link_info *);
-
-/* PE ARM Interworking support. Called from linker. */
-extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
- (struct bfd_link_info *);
-
-extern bfd_boolean bfd_arm_pe_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
-
-extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
- (bfd *, struct bfd_link_info *);
-
-/* ELF ARM Interworking support. Called from linker. */
-extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
- (struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf32_arm_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
-
-extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
- (bfd *, struct bfd_link_info *);
-
-/* ARM Note section processing. */
-extern bfd_boolean bfd_arm_merge_machines
- (bfd *, bfd *);
-
-extern bfd_boolean bfd_arm_update_notes
- (bfd *, const char *);
-
-extern unsigned int bfd_arm_get_mach_from_notes
- (bfd *, const char *);
-
-/* TI COFF load page support. */
-extern void bfd_ticoff_set_section_load_page
- (struct bfd_section *, int);
-
-extern int bfd_ticoff_get_section_load_page
- (struct bfd_section *);
-
-/* H8/300 functions. */
-extern bfd_vma bfd_h8300_pad_address
- (bfd *, bfd_vma);
-
-/* IA64 Itanium code generation. Called from linker. */
-extern void bfd_elf32_ia64_after_parse
- (int);
-
-extern void bfd_elf64_ia64_after_parse
- (int);
-
diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h
deleted file mode 100644
index 2464d27..0000000
--- a/contrib/binutils/bfd/bfd-in2.h
+++ /dev/null
@@ -1,4398 +0,0 @@
-/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
- generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
- "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
- "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
- "linker.c" and "simple.c".
- Run "make headers" in your build bfd/ to regenerate. */
-
-/* Main header file for the bfd library -- portable access to object files.
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- Contributed by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef __BFD_H_SEEN__
-#define __BFD_H_SEEN__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "ansidecl.h"
-#include "symcat.h"
-#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-#ifndef SABER
-/* This hack is to avoid a problem with some strict ANSI C preprocessors.
- The problem is, "32_" is not a valid preprocessing token, and we don't
- want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will
- cause the inner CONCAT2 macros to be evaluated first, producing
- still-valid pp-tokens. Then the final concatenation can be done. */
-#undef CONCAT4
-#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
-#endif
-#endif
-
-/* The word size used by BFD on the host. This may be 64 with a 32
- bit target if the host is 64 bit, or if other 64 bit targets have
- been selected with --enable-targets, or if --enable-64-bit-bfd. */
-#define BFD_ARCH_SIZE @wordsize@
-
-/* The word size of the default bfd target. */
-#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
-
-#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
-#define BFD_HOST_LONG_LONG @BFD_HOST_LONG_LONG@
-#if @BFD_HOST_64_BIT_DEFINED@
-#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
-#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
-typedef BFD_HOST_64_BIT bfd_int64_t;
-typedef BFD_HOST_U_64_BIT bfd_uint64_t;
-#endif
-
-#if BFD_ARCH_SIZE >= 64
-#define BFD64
-#endif
-
-#ifndef INLINE
-#if __GNUC__ >= 2
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-#endif
-
-/* Forward declaration. */
-typedef struct bfd bfd;
-
-/* Boolean type used in bfd. Too many systems define their own
- versions of "boolean" for us to safely typedef a "boolean" of
- our own. Using an enum for "bfd_boolean" has its own set of
- problems, with strange looking casts required to avoid warnings
- on some older compilers. Thus we just use an int.
-
- General rule: Functions which are bfd_boolean return TRUE on
- success and FALSE on failure (unless they're a predicate). */
-
-typedef int bfd_boolean;
-#undef FALSE
-#undef TRUE
-#define FALSE 0
-#define TRUE 1
-
-#if 0
-/* Poison. */
-#undef false
-#undef true
-#define false dont_use_false_in_bfd
-#define true dont_use_true_in_bfd
-#endif
-
-#ifdef BFD64
-
-#ifndef BFD_HOST_64_BIT
- #error No 64 bit integer type available
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-typedef BFD_HOST_U_64_BIT bfd_vma;
-typedef BFD_HOST_64_BIT bfd_signed_vma;
-typedef BFD_HOST_U_64_BIT bfd_size_type;
-typedef BFD_HOST_U_64_BIT symvalue;
-
-#ifndef fprintf_vma
-#if BFD_HOST_64BIT_LONG
-#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
-#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
-#else
-#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
-#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
-#define fprintf_vma(s,x) \
- fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#define sprintf_vma(s,x) \
- sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#endif
-#endif
-
-#else /* not BFD64 */
-
-/* Represent a target address. Also used as a generic unsigned type
- which is guaranteed to be big enough to hold any arithmetic types
- we need to deal with. */
-typedef unsigned long bfd_vma;
-
-/* A generic signed type which is guaranteed to be big enough to hold any
- arithmetic types we need to deal with. Can be assumed to be compatible
- with bfd_vma in the same way that signed and unsigned ints are compatible
- (as parameters, in assignment, etc). */
-typedef long bfd_signed_vma;
-
-typedef unsigned long symvalue;
-typedef unsigned long bfd_size_type;
-
-/* Print a bfd_vma x on stream s. */
-#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
-
-#endif /* not BFD64 */
-
-#ifndef BFD_HOST_64_BIT
-/* Fall back on a 32 bit type. The idea is to make these types always
- available for function return types, but in the case that
- BFD_HOST_64_BIT is undefined such a function should abort or
- otherwise signal an error. */
-typedef bfd_signed_vma bfd_int64_t;
-typedef bfd_vma bfd_uint64_t;
-#endif
-
-/* An offset into a file. BFD always uses the largest possible offset
- based on the build time availability of fseek, fseeko, or fseeko64. */
-typedef @bfd_file_ptr@ file_ptr;
-typedef unsigned @bfd_file_ptr@ ufile_ptr;
-
-extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
-extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
-
-#define printf_vma(x) fprintf_vma(stdout,x)
-#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
-
-typedef unsigned int flagword; /* 32 bits of flags */
-typedef unsigned char bfd_byte;
-
-/* File formats. */
-
-typedef enum bfd_format
-{
- bfd_unknown = 0, /* File format is unknown. */
- bfd_object, /* Linker/assembler/compiler output. */
- bfd_archive, /* Object archive file. */
- bfd_core, /* Core dump. */
- bfd_type_end /* Marks the end; don't use it! */
-}
-bfd_format;
-
-/* Values that may appear in the flags field of a BFD. These also
- appear in the object_flags field of the bfd_target structure, where
- they indicate the set of flags used by that backend (not all flags
- are meaningful for all object file formats) (FIXME: at the moment,
- the object_flags values have mostly just been copied from backend
- to another, and are not necessarily correct). */
-
-/* No flags. */
-#define BFD_NO_FLAGS 0x00
-
-/* BFD contains relocation entries. */
-#define HAS_RELOC 0x01
-
-/* BFD is directly executable. */
-#define EXEC_P 0x02
-
-/* BFD has line number information (basically used for F_LNNO in a
- COFF header). */
-#define HAS_LINENO 0x04
-
-/* BFD has debugging information. */
-#define HAS_DEBUG 0x08
-
-/* BFD has symbols. */
-#define HAS_SYMS 0x10
-
-/* BFD has local symbols (basically used for F_LSYMS in a COFF
- header). */
-#define HAS_LOCALS 0x20
-
-/* BFD is a dynamic object. */
-#define DYNAMIC 0x40
-
-/* Text section is write protected (if D_PAGED is not set, this is
- like an a.out NMAGIC file) (the linker sets this by default, but
- clears it for -r or -N). */
-#define WP_TEXT 0x80
-
-/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
- linker sets this by default, but clears it for -r or -n or -N). */
-#define D_PAGED 0x100
-
-/* BFD is relaxable (this means that bfd_relax_section may be able to
- do something) (sometimes bfd_relax_section can do something even if
- this is not set). */
-#define BFD_IS_RELAXABLE 0x200
-
-/* This may be set before writing out a BFD to request using a
- traditional format. For example, this is used to request that when
- writing out an a.out object the symbols not be hashed to eliminate
- duplicates. */
-#define BFD_TRADITIONAL_FORMAT 0x400
-
-/* This flag indicates that the BFD contents are actually cached in
- memory. If this is set, iostream points to a bfd_in_memory struct. */
-#define BFD_IN_MEMORY 0x800
-
-/* The sections in this BFD specify a memory page. */
-#define HAS_LOAD_PAGE 0x1000
-
-/* Symbols and relocation. */
-
-/* A count of carsyms (canonical archive symbols). */
-typedef unsigned long symindex;
-
-/* How to perform a relocation. */
-typedef const struct reloc_howto_struct reloc_howto_type;
-
-#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-
-/* General purpose part of a symbol X;
- target specific parts are in libcoff.h, libaout.h, etc. */
-
-#define bfd_get_section(x) ((x)->section)
-#define bfd_get_output_section(x) ((x)->section->output_section)
-#define bfd_set_section(x,y) ((x)->section) = (y)
-#define bfd_asymbol_base(x) ((x)->section->vma)
-#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
-#define bfd_asymbol_name(x) ((x)->name)
-/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
-#define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
-
-/* A canonical archive symbol. */
-/* This is a type pun with struct ranlib on purpose! */
-typedef struct carsym
-{
- char *name;
- file_ptr file_offset; /* Look here to find the file. */
-}
-carsym; /* To make these you call a carsymogen. */
-
-/* Used in generating armaps (archive tables of contents).
- Perhaps just a forward definition would do? */
-struct orl /* Output ranlib. */
-{
- char **name; /* Symbol name. */
- union
- {
- file_ptr pos;
- bfd *abfd;
- } u; /* bfd* or file position. */
- int namidx; /* Index into string table. */
-};
-
-/* Linenumber stuff. */
-typedef struct lineno_cache_entry
-{
- unsigned int line_number; /* Linenumber from start of function. */
- union
- {
- struct bfd_symbol *sym; /* Function name. */
- bfd_vma offset; /* Offset into section. */
- } u;
-}
-alent;
-
-/* Object and core file sections. */
-
-#define align_power(addr, align) \
- (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
-
-typedef struct bfd_section *sec_ptr;
-
-#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
-#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
-#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
-#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
-#define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
-#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
-#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
-#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
-#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
-
-#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
-
-typedef struct stat stat_type;
-
-typedef enum bfd_print_symbol
-{
- bfd_print_symbol_name,
- bfd_print_symbol_more,
- bfd_print_symbol_all
-} bfd_print_symbol_type;
-
-/* Information about a symbol that nm needs. */
-
-typedef struct _symbol_info
-{
- symvalue value;
- char type;
- 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. */
-} symbol_info;
-
-/* Get the name of a stabs type code. */
-
-extern const char *bfd_get_stab_name (int);
-
-/* Hash table routines. There is no way to free up a hash table. */
-
-/* An element in the hash table. Most uses will actually use a larger
- structure, and an instance of this will be the first field. */
-
-struct bfd_hash_entry
-{
- /* Next entry for this hash code. */
- struct bfd_hash_entry *next;
- /* String being hashed. */
- const char *string;
- /* Hash code. This is the full hash code, not the index into the
- table. */
- unsigned long hash;
-};
-
-/* A hash table. */
-
-struct bfd_hash_table
-{
- /* The hash array. */
- struct bfd_hash_entry **table;
- /* The number of slots in the hash table. */
- unsigned int size;
- /* A function used to create new elements in the hash table. The
- first entry is itself a pointer to an element. When this
- function is first invoked, this pointer will be NULL. However,
- having the pointer permits a hierarchy of method functions to be
- built each of which calls the function in the superclass. Thus
- each function should be written to allocate a new block of memory
- only if the argument is NULL. */
- struct bfd_hash_entry *(*newfunc)
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
- /* An objalloc for this hash table. This is a struct objalloc *,
- but we use void * to avoid requiring the inclusion of objalloc.h. */
- void *memory;
-};
-
-/* Initialize a hash table. */
-extern bfd_boolean bfd_hash_table_init
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
-
-/* Initialize a hash table specifying a size. */
-extern bfd_boolean bfd_hash_table_init_n
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int size);
-
-/* Free up a hash table. */
-extern void bfd_hash_table_free
- (struct bfd_hash_table *);
-
-/* Look up a string in a hash table. If CREATE is TRUE, a new entry
- will be created for this string if one does not already exist. The
- COPY argument must be TRUE if this routine should copy the string
- into newly allocated memory when adding an entry. */
-extern struct bfd_hash_entry *bfd_hash_lookup
- (struct bfd_hash_table *, const char *, bfd_boolean create,
- bfd_boolean copy);
-
-/* Replace an entry in a hash table. */
-extern void bfd_hash_replace
- (struct bfd_hash_table *, struct bfd_hash_entry *old,
- struct bfd_hash_entry *nw);
-
-/* Base method for creating a hash table entry. */
-extern struct bfd_hash_entry *bfd_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-
-/* Grab some space for a hash table entry. */
-extern void *bfd_hash_allocate
- (struct bfd_hash_table *, unsigned int);
-
-/* Traverse a hash table in a random order, calling a function on each
- element. If the function returns FALSE, the traversal stops. The
- INFO argument is passed to the function. */
-extern void bfd_hash_traverse
- (struct bfd_hash_table *,
- bfd_boolean (*) (struct bfd_hash_entry *, void *),
- void *info);
-
-#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
-
-/* User program access to BFD facilities. */
-
-/* Direct I/O routines, for programs which know more about the object
- file than BFD does. Use higher level routines if possible. */
-
-extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
-extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
-extern int bfd_seek (bfd *, file_ptr, int);
-extern file_ptr bfd_tell (bfd *);
-extern int bfd_flush (bfd *);
-extern int bfd_stat (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 (const char *, const char *, int, const char *);
-
-/* Cast from const char * to char * so that caller can assign to
- a char * without a warning. */
-#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
-#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
-#define bfd_get_format(abfd) ((abfd)->format)
-#define bfd_get_target(abfd) ((abfd)->xvec->name)
-#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
-#define bfd_family_coff(abfd) \
- (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
- bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
-#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
-#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_header_big_endian(abfd) \
- ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
-#define bfd_header_little_endian(abfd) \
- ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_get_file_flags(abfd) ((abfd)->flags)
-#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
-#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
-#define bfd_my_archive(abfd) ((abfd)->my_archive)
-#define bfd_has_map(abfd) ((abfd)->has_armap)
-
-#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
-#define bfd_usrdata(abfd) ((abfd)->usrdata)
-
-#define bfd_get_start_address(abfd) ((abfd)->start_address)
-#define bfd_get_symcount(abfd) ((abfd)->symcount)
-#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
-#define bfd_count_sections(abfd) ((abfd)->section_count)
-
-#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
-
-#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
-
-extern bfd_boolean bfd_cache_close
- (bfd *abfd);
-/* NB: This declaration should match the autogenerated one in libbfd.h. */
-
-extern bfd_boolean bfd_record_phdr
- (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
- bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
-
-/* Byte swapping routines. */
-
-bfd_uint64_t bfd_getb64 (const void *);
-bfd_uint64_t bfd_getl64 (const void *);
-bfd_int64_t bfd_getb_signed_64 (const void *);
-bfd_int64_t bfd_getl_signed_64 (const void *);
-bfd_vma bfd_getb32 (const void *);
-bfd_vma bfd_getl32 (const void *);
-bfd_signed_vma bfd_getb_signed_32 (const void *);
-bfd_signed_vma bfd_getl_signed_32 (const void *);
-bfd_vma bfd_getb16 (const void *);
-bfd_vma bfd_getl16 (const void *);
-bfd_signed_vma bfd_getb_signed_16 (const void *);
-bfd_signed_vma bfd_getl_signed_16 (const void *);
-void bfd_putb64 (bfd_uint64_t, void *);
-void bfd_putl64 (bfd_uint64_t, void *);
-void bfd_putb32 (bfd_vma, void *);
-void bfd_putl32 (bfd_vma, void *);
-void bfd_putb16 (bfd_vma, void *);
-void bfd_putl16 (bfd_vma, void *);
-
-/* Byte swapping routines which take size and endiannes as arguments. */
-
-bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
-void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
-
-/* Externally visible ECOFF routines. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct bfd_symbol;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
-struct bfd_elf_version_tree;
-#endif
-extern bfd_vma bfd_ecoff_get_gp_value
- (bfd * abfd);
-extern bfd_boolean bfd_ecoff_set_gp_value
- (bfd *abfd, bfd_vma gp_value);
-extern bfd_boolean bfd_ecoff_set_regmasks
- (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
- unsigned long *cprmask);
-extern void *bfd_ecoff_debug_init
- (bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
-extern void bfd_ecoff_debug_free
- (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
-extern bfd_boolean bfd_ecoff_debug_accumulate
- (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
- struct ecoff_debug_info *input_debug,
- const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
-extern bfd_boolean bfd_ecoff_debug_accumulate_other
- (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
- struct bfd_link_info *);
-extern bfd_boolean bfd_ecoff_debug_externals
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
- bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
- void (*set_index) (struct bfd_symbol *, bfd_size_type));
-extern bfd_boolean bfd_ecoff_debug_one_external
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, const char *name,
- struct ecoff_extr *esym);
-extern bfd_size_type bfd_ecoff_debug_size
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap);
-extern bfd_boolean bfd_ecoff_write_debug
- (bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, file_ptr where);
-extern bfd_boolean bfd_ecoff_write_accumulated_debug
- (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- struct bfd_link_info *info, file_ptr where);
-extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-
-/* Externally visible ELF routines. */
-
-struct bfd_link_needed_list
-{
- struct bfd_link_needed_list *next;
- bfd *by;
- const char *name;
-};
-
-enum dynamic_lib_link_class {
- DYN_NORMAL = 0,
- DYN_AS_NEEDED = 1,
- DYN_DT_NEEDED = 2
-};
-
-extern bfd_boolean bfd_elf_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *, bfd_boolean);
-extern struct bfd_link_needed_list *bfd_elf_get_needed_list
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_elf_get_bfd_needed_list
- (bfd *, struct bfd_link_needed_list **);
-extern bfd_boolean bfd_elf_size_dynamic_sections
- (bfd *, const char *, const char *, const char *, const char * const *,
- struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *);
-extern void bfd_elf_set_dt_needed_name
- (bfd *, const char *);
-extern const char *bfd_elf_get_dt_soname
- (bfd *);
-extern void bfd_elf_set_dyn_lib_class
- (bfd *, int);
-extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_elf_discard_info
- (bfd *, struct bfd_link_info *);
-
-/* Return an upper bound on the number of bytes required to store a
- copy of ABFD's program header table entries. Return -1 if an error
- occurs; bfd_get_error will return an appropriate code. */
-extern long bfd_get_elf_phdr_upper_bound
- (bfd *abfd);
-
-/* Copy ABFD's program header table entries to *PHDRS. The entries
- will be stored as an array of Elf_Internal_Phdr structures, as
- defined in include/elf/internal.h. To find out how large the
- buffer needs to be, call bfd_get_elf_phdr_upper_bound.
-
- Return the number of program header table entries read, or -1 if an
- error occurs; bfd_get_error will return an appropriate code. */
-extern int bfd_get_elf_phdrs
- (bfd *abfd, void *phdrs);
-
-/* Create a new BFD as if by bfd_openr. Rather than opening a file,
- reconstruct an ELF file by reading the segments out of remote memory
- based on the ELF file header at EHDR_VMA and the ELF program headers it
- points to. If not null, *LOADBASEP is filled in with the difference
- between the VMAs from which the segments were read, and the VMAs the
- file headers (and hence BFD's idea of each section's VMA) put them at.
-
- The function TARGET_READ_MEMORY is called to copy LEN bytes from the
- remote memory at target address VMA into the local buffer at MYADDR; it
- should return zero on success or an `errno' code on failure. TEMPL must
- be a BFD for an ELF target with the word size and byte order found in
- the remote memory. */
-extern bfd *bfd_elf_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
-
-/* Return the arch_size field of an elf bfd, or -1 if not elf. */
-extern int bfd_get_arch_size
- (bfd *);
-
-/* Return TRUE if address "naturally" sign extends, or -1 if not elf. */
-extern int bfd_get_sign_extend_vma
- (bfd *);
-
-extern struct bfd_section *_bfd_elf_tls_setup
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-extern bfd_boolean bfd_mips_elf32_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-
-/* SunOS shared library support routines for the linker. */
-
-extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_sunos_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *);
-extern bfd_boolean bfd_sunos_size_dynamic_sections
- (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **);
-
-/* Linux shared library support routines for the linker. */
-
-extern bfd_boolean bfd_i386linux_size_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_m68klinux_size_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_sparclinux_size_dynamic_sections
- (bfd *, struct bfd_link_info *);
-
-/* mmap hacks */
-
-struct _bfd_window_internal;
-typedef struct _bfd_window_internal bfd_window_internal;
-
-typedef struct _bfd_window
-{
- /* What the user asked for. */
- void *data;
- bfd_size_type size;
- /* The actual window used by BFD. Small user-requested read-only
- regions sharing a page may share a single window into the object
- file. Read-write versions shouldn't until I've fixed things to
- keep track of which portions have been claimed by the
- application; don't want to give the same region back when the
- application wants two writable copies! */
- struct _bfd_window_internal *i;
-}
-bfd_window;
-
-extern void bfd_init_window
- (bfd_window *);
-extern void bfd_free_window
- (bfd_window *);
-extern bfd_boolean bfd_get_file_window
- (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
-
-/* XCOFF support routines for the linker. */
-
-extern bfd_boolean bfd_xcoff_link_record_set
- (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
-extern bfd_boolean bfd_xcoff_import_symbol
- (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
- const char *, const char *, const char *, unsigned int);
-extern bfd_boolean bfd_xcoff_export_symbol
- (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
-extern bfd_boolean bfd_xcoff_link_count_reloc
- (bfd *, struct bfd_link_info *, const char *);
-extern bfd_boolean bfd_xcoff_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *);
-extern bfd_boolean bfd_xcoff_size_dynamic_sections
- (bfd *, struct bfd_link_info *, const char *, const char *,
- unsigned long, unsigned long, unsigned long, bfd_boolean,
- int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean);
-extern bfd_boolean bfd_xcoff_link_generate_rtinit
- (bfd *, const char *, const char *, bfd_boolean);
-
-/* XCOFF support routines for ar. */
-extern bfd_boolean bfd_xcoff_ar_archive_set_magic
- (bfd *, char *);
-
-/* Externally visible COFF routines. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct internal_syment;
-union internal_auxent;
-#endif
-
-extern bfd_boolean bfd_coff_get_syment
- (bfd *, struct bfd_symbol *, struct internal_syment *);
-
-extern bfd_boolean bfd_coff_get_auxent
- (bfd *, struct bfd_symbol *, int, union internal_auxent *);
-
-extern bfd_boolean bfd_coff_set_symbol_class
- (bfd *, struct bfd_symbol *, unsigned int);
-
-extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
- (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
-
-/* ARM Interworking support. Called from linker. */
-extern bfd_boolean bfd_arm_allocate_interworking_sections
- (struct bfd_link_info *);
-
-extern bfd_boolean bfd_arm_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
-
-extern bfd_boolean bfd_arm_get_bfd_for_interworking
- (bfd *, struct bfd_link_info *);
-
-/* PE ARM Interworking support. Called from linker. */
-extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
- (struct bfd_link_info *);
-
-extern bfd_boolean bfd_arm_pe_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
-
-extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
- (bfd *, struct bfd_link_info *);
-
-/* ELF ARM Interworking support. Called from linker. */
-extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
- (struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf32_arm_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
-
-extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
- (bfd *, struct bfd_link_info *);
-
-/* ARM Note section processing. */
-extern bfd_boolean bfd_arm_merge_machines
- (bfd *, bfd *);
-
-extern bfd_boolean bfd_arm_update_notes
- (bfd *, const char *);
-
-extern unsigned int bfd_arm_get_mach_from_notes
- (bfd *, const char *);
-
-/* TI COFF load page support. */
-extern void bfd_ticoff_set_section_load_page
- (struct bfd_section *, int);
-
-extern int bfd_ticoff_get_section_load_page
- (struct bfd_section *);
-
-/* H8/300 functions. */
-extern bfd_vma bfd_h8300_pad_address
- (bfd *, bfd_vma);
-
-/* IA64 Itanium code generation. Called from linker. */
-extern void bfd_elf32_ia64_after_parse
- (int);
-
-extern void bfd_elf64_ia64_after_parse
- (int);
-
-/* Extracted from init.c. */
-void bfd_init (void);
-
-/* Extracted from opncls.c. */
-bfd *bfd_openr (const char *filename, const char *target);
-
-bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
-
-bfd *bfd_openstreamr (const char *, const char *, void *);
-
-bfd *bfd_openw (const char *filename, const char *target);
-
-bfd_boolean bfd_close (bfd *abfd);
-
-bfd_boolean bfd_close_all_done (bfd *);
-
-bfd *bfd_create (const char *filename, bfd *templ);
-
-bfd_boolean bfd_make_writable (bfd *abfd);
-
-bfd_boolean bfd_make_readable (bfd *abfd);
-
-unsigned long bfd_calc_gnu_debuglink_crc32
- (unsigned long crc, const unsigned char *buf, bfd_size_type len);
-
-char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
-
-struct bfd_section *bfd_create_gnu_debuglink_section
- (bfd *abfd, const char *filename);
-
-bfd_boolean bfd_fill_in_gnu_debuglink_section
- (bfd *abfd, struct bfd_section *sect, const char *filename);
-
-/* Extracted from libbfd.c. */
-
-/* Byte swapping macros for user section data. */
-
-#define bfd_put_8(abfd, val, ptr) \
- ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
-#define bfd_put_signed_8 \
- bfd_put_8
-#define bfd_get_8(abfd, ptr) \
- (*(unsigned char *) (ptr) & 0xff)
-#define bfd_get_signed_8(abfd, ptr) \
- (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-
-#define bfd_put_16(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
-#define bfd_put_signed_16 \
- bfd_put_16
-#define bfd_get_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx16, (ptr))
-#define bfd_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
-#define bfd_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
-#define bfd_put_signed_32 \
- bfd_put_32
-#define bfd_get_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx32, (ptr))
-#define bfd_get_signed_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
-
-#define bfd_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
-#define bfd_put_signed_64 \
- bfd_put_64
-#define bfd_get_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx64, (ptr))
-#define bfd_get_signed_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
-
-#define bfd_get(bits, abfd, ptr) \
- ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
- : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
- : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
- : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
- : (abort (), (bfd_vma) - 1))
-
-#define bfd_put(bits, abfd, val, ptr) \
- ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
- : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
- : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
- : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
- : (abort (), (void) 0))
-
-
-/* Byte swapping macros for file header data. */
-
-#define bfd_h_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)
-#define bfd_h_get_8(abfd, ptr) \
- bfd_get_8 (abfd, ptr)
-#define bfd_h_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))
-#define bfd_h_put_signed_16 \
- bfd_h_put_16
-#define bfd_h_get_16(abfd, 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))
-
-#define bfd_h_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
-#define bfd_h_put_signed_32 \
- bfd_h_put_32
-#define bfd_h_get_32(abfd, 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))
-
-#define bfd_h_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
-#define bfd_h_put_signed_64 \
- bfd_h_put_64
-#define bfd_h_get_64(abfd, 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))
-
-/* Aliases for the above, which should eventually go away. */
-
-#define H_PUT_64 bfd_h_put_64
-#define H_PUT_32 bfd_h_put_32
-#define H_PUT_16 bfd_h_put_16
-#define H_PUT_8 bfd_h_put_8
-#define H_PUT_S64 bfd_h_put_signed_64
-#define H_PUT_S32 bfd_h_put_signed_32
-#define H_PUT_S16 bfd_h_put_signed_16
-#define H_PUT_S8 bfd_h_put_signed_8
-#define H_GET_64 bfd_h_get_64
-#define H_GET_32 bfd_h_get_32
-#define H_GET_16 bfd_h_get_16
-#define H_GET_8 bfd_h_get_8
-#define H_GET_S64 bfd_h_get_signed_64
-#define H_GET_S32 bfd_h_get_signed_32
-#define H_GET_S16 bfd_h_get_signed_16
-#define H_GET_S8 bfd_h_get_signed_8
-
-
-/* Extracted from bfdio.c. */
-long bfd_get_mtime (bfd *abfd);
-
-long bfd_get_size (bfd *abfd);
-
-/* Extracted from bfdwin.c. */
-/* Extracted from section.c. */
-/* This structure is used for a comdat section, as in PE. A comdat
- section is associated with a particular symbol. When the linker
- sees a comdat section, it keeps only one of the sections with a
- given name and associated with a given symbol. */
-
-struct bfd_comdat_info
-{
- /* The name of the symbol associated with a comdat section. */
- const char *name;
-
- /* The local symbol table index of the symbol associated with a
- comdat section. This is only meaningful to the object file format
- specific code; it is not an index into the list returned by
- bfd_canonicalize_symtab. */
- long symbol;
-};
-
-typedef struct bfd_section
-{
- /* The name of the section; the name isn't a copy, the pointer is
- the same as that passed to bfd_make_section. */
- const char *name;
-
- /* A unique sequence number. */
- int id;
-
- /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
- int index;
-
- /* The next section in the list belonging to the BFD, or NULL. */
- struct bfd_section *next;
-
- /* The field flags contains attributes of the section. Some
- flags are read in from the object file, and some are
- synthesized from other information. */
- flagword flags;
-
-#define SEC_NO_FLAGS 0x000
-
- /* Tells the OS to allocate space for this section when loading.
- This is clear for a section containing debug information only. */
-#define SEC_ALLOC 0x001
-
- /* Tells the OS to load the section from the file when loading.
- This is clear for a .bss section. */
-#define SEC_LOAD 0x002
-
- /* The section contains data still to be relocated, so there is
- some relocation information too. */
-#define SEC_RELOC 0x004
-
- /* ELF reserves 4 processor specific bits and 8 operating system
- specific bits in sh_flags; at present we can get away with just
- one in communicating between the assembler and BFD, but this
- isn't a good long-term solution. */
-#define SEC_ARCH_BIT_0 0x008
-
- /* A signal to the OS that the section contains read only data. */
-#define SEC_READONLY 0x010
-
- /* The section contains code only. */
-#define SEC_CODE 0x020
-
- /* The section contains data only. */
-#define SEC_DATA 0x040
-
- /* The section will reside in ROM. */
-#define SEC_ROM 0x080
-
- /* The section contains constructor information. This section
- type is used by the linker to create lists of constructors and
- destructors used by <<g++>>. When a back end sees a symbol
- which should be used in a constructor list, it creates a new
- section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
- the symbol to it, and builds a relocation. To build the lists
- of constructors, all the linker has to do is catenate all the
- sections called <<__CTOR_LIST__>> and relocate the data
- contained within - exactly the operations it would peform on
- standard data. */
-#define SEC_CONSTRUCTOR 0x100
-
- /* The section has contents - a data section could be
- <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
- <<SEC_HAS_CONTENTS>> */
-#define SEC_HAS_CONTENTS 0x200
-
- /* An instruction to the linker to not output the section
- even if it has information which would normally be written. */
-#define SEC_NEVER_LOAD 0x400
-
- /* The section is a COFF shared library section. This flag is
- only for the linker. If this type of section appears in
- the input file, the linker must copy it to the output file
- without changing the vma or size. FIXME: Although this
- was originally intended to be general, it really is COFF
- specific (and the flag was renamed to indicate this). It
- might be cleaner to have some more general mechanism to
- allow the back end to control what the linker does with
- sections. */
-#define SEC_COFF_SHARED_LIBRARY 0x800
-
- /* The section contains thread local data. */
-#define SEC_THREAD_LOCAL 0x1000
-
- /* The section has GOT references. This flag is only for the
- linker, and is currently only used by the elf32-hppa back end.
- It will be set if global offset table references were detected
- in this section, which indicate to the linker that the section
- contains PIC code, and must be handled specially when doing a
- static link. */
-#define SEC_HAS_GOT_REF 0x4000
-
- /* The section contains common symbols (symbols may be defined
- multiple times, the value of a symbol is the amount of
- space it requires, and the largest symbol value is the one
- used). Most targets have exactly one of these (which we
- translate to bfd_com_section_ptr), but ECOFF has two. */
-#define SEC_IS_COMMON 0x8000
-
- /* The section contains only debugging information. For
- example, this is set for ELF .debug and .stab sections.
- strip tests this flag to see if a section can be
- discarded. */
-#define SEC_DEBUGGING 0x10000
-
- /* The contents of this section are held in memory pointed to
- by the contents field. This is checked by bfd_get_section_contents,
- and the data is retrieved from memory if appropriate. */
-#define SEC_IN_MEMORY 0x20000
-
- /* The contents of this section are to be excluded by the
- linker for executable and shared objects unless those
- objects are to be further relocated. */
-#define SEC_EXCLUDE 0x40000
-
- /* The contents of this section are to be sorted based on the sum of
- the symbol and addend values specified by the associated relocation
- entries. Entries without associated relocation entries will be
- appended to the end of the section in an unspecified order. */
-#define SEC_SORT_ENTRIES 0x80000
-
- /* When linking, duplicate sections of the same name should be
- discarded, rather than being combined into a single section as
- is usually done. This is similar to how common symbols are
- handled. See SEC_LINK_DUPLICATES below. */
-#define SEC_LINK_ONCE 0x100000
-
- /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
- should handle duplicate sections. */
-#define SEC_LINK_DUPLICATES 0x600000
-
- /* This value for SEC_LINK_DUPLICATES means that duplicate
- sections with the same name should simply be discarded. */
-#define SEC_LINK_DUPLICATES_DISCARD 0x0
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if there are any duplicate sections, although
- it should still only link one copy. */
-#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections are a different size. */
-#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections contain different
- contents. */
-#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
-
- /* This section was created by the linker as part of dynamic
- relocation or other arcane processing. It is skipped when
- going through the first-pass output, trusting that someone
- else up the line will take care of it later. */
-#define SEC_LINKER_CREATED 0x800000
-
- /* This section should not be subject to garbage collection. */
-#define SEC_KEEP 0x1000000
-
- /* This section contains "short" data, and should be placed
- "near" the GP. */
-#define SEC_SMALL_DATA 0x2000000
-
- /* This section contains data which may be shared with other
- executables or shared objects. */
-#define SEC_SHARED 0x4000000
-
- /* When a section with this flag is being linked, then if the size of
- the input section is less than a page, it should not cross a page
- boundary. If the size of the input section is one page or more, it
- should be aligned on a page boundary. */
-#define SEC_BLOCK 0x8000000
-
- /* Conditionally link this section; do not link if there are no
- references found to any symbol in the section. */
-#define SEC_CLINK 0x10000000
-
- /* Attempt to merge identical entities in the section.
- Entity size is given in the entsize field. */
-#define SEC_MERGE 0x20000000
-
- /* If given with SEC_MERGE, entities to merge are zero terminated
- strings where entsize specifies character size instead of fixed
- size entries. */
-#define SEC_STRINGS 0x40000000
-
- /* This section contains data about section groups. */
-#define SEC_GROUP 0x80000000
-
- /* End of section flags. */
-
- /* Some internal packed boolean fields. */
-
- /* See the vma field. */
- unsigned int user_set_vma : 1;
-
- /* Whether relocations have been processed. */
- unsigned int reloc_done : 1;
-
- /* A mark flag used by some of the linker backends. */
- unsigned int linker_mark : 1;
-
- /* Another mark flag used by some of the linker backends. Set for
- output sections that have an input section. */
- unsigned int linker_has_input : 1;
-
- /* A mark flag used by some linker backends for garbage collection. */
- unsigned int gc_mark : 1;
-
- /* The following flags are used by the ELF linker. */
-
- /* Mark sections which have been allocated to segments. */
- unsigned int segment_mark : 1;
-
- /* Type of sec_info information. */
- unsigned int sec_info_type:3;
-#define ELF_INFO_TYPE_NONE 0
-#define ELF_INFO_TYPE_STABS 1
-#define ELF_INFO_TYPE_MERGE 2
-#define ELF_INFO_TYPE_EH_FRAME 3
-#define ELF_INFO_TYPE_JUST_SYMS 4
-
- /* Nonzero if this section uses RELA relocations, rather than REL. */
- unsigned int use_rela_p:1;
-
- /* Bits used by various backends. */
- unsigned int has_tls_reloc:1;
-
- /* Nonzero if this section needs the relax finalize pass. */
- unsigned int need_finalize_relax:1;
-
- /* Nonzero if this section has a gp reloc. */
- unsigned int has_gp_reloc:1;
-
- /* Unused bits. */
- unsigned int flag13:1;
- unsigned int flag14:1;
- unsigned int flag15:1;
- unsigned int flag16:4;
- unsigned int flag20:4;
- unsigned int flag24:8;
-
- /* End of internal packed boolean fields. */
-
- /* The virtual memory address of the section - where it will be
- at run time. The symbols are relocated against this. The
- user_set_vma flag is maintained by bfd; if it's not set, the
- backend can assign addresses (for example, in <<a.out>>, where
- the default address for <<.data>> is dependent on the specific
- target and various flags). */
- bfd_vma vma;
-
- /* The load address of the section - where it would be in a
- rom image; really only used for writing section header
- information. */
- bfd_vma lma;
-
- /* The size of the section in octets, as it will be output.
- Contains a value even if the section has no contents (e.g., the
- size of <<.bss>>). This will be filled in after relocation. */
- bfd_size_type _cooked_size;
-
- /* The original size on disk of the section, in octets. Normally this
- value is the same as the size, but if some relaxing has
- been done, then this value will be bigger. */
- bfd_size_type _raw_size;
-
- /* If this section is going to be output, then this value is the
- offset in *bytes* into the output section of the first byte in the
- input section (byte ==> smallest addressable unit on the
- target). In most cases, if this was going to start at the
- 100th octet (8-bit quantity) in the output section, this value
- would be 100. However, if the target byte size is 16 bits
- (bfd_octets_per_byte is "2"), this value would be 50. */
- bfd_vma output_offset;
-
- /* The output section through which to map on output. */
- struct bfd_section *output_section;
-
- /* The alignment requirement of the section, as an exponent of 2 -
- e.g., 3 aligns to 2^3 (or 8). */
- unsigned int alignment_power;
-
- /* If an input section, a pointer to a vector of relocation
- records for the data in this section. */
- struct reloc_cache_entry *relocation;
-
- /* If an output section, a pointer to a vector of pointers to
- relocation records for the data in this section. */
- struct reloc_cache_entry **orelocation;
-
- /* The number of relocation records in one of the above. */
- unsigned reloc_count;
-
- /* Information below is back end specific - and not always used
- or updated. */
-
- /* File position of section data. */
- file_ptr filepos;
-
- /* File position of relocation info. */
- file_ptr rel_filepos;
-
- /* File position of line data. */
- file_ptr line_filepos;
-
- /* Pointer to data for applications. */
- void *userdata;
-
- /* If the SEC_IN_MEMORY flag is set, this points to the actual
- contents. */
- unsigned char *contents;
-
- /* Attached line number information. */
- alent *lineno;
-
- /* Number of line number records. */
- unsigned int lineno_count;
-
- /* Entity size for merging purposes. */
- unsigned int entsize;
-
- /* Optional information about a COMDAT entry; NULL if not COMDAT. */
- struct bfd_comdat_info *comdat;
-
- /* Points to the kept section if this section is a link-once section,
- and is discarded. */
- struct bfd_section *kept_section;
-
- /* When a section is being output, this value changes as more
- linenumbers are written out. */
- file_ptr moving_line_filepos;
-
- /* What the section number is in the target world. */
- int target_index;
-
- void *used_by_bfd;
-
- /* If this is a constructor section then here is a list of the
- relocations created to relocate items within it. */
- struct relent_chain *constructor_chain;
-
- /* The BFD which owns the section. */
- bfd *owner;
-
- /* A symbol which points at this section only. */
- struct bfd_symbol *symbol;
- struct bfd_symbol **symbol_ptr_ptr;
-
- struct bfd_link_order *link_order_head;
- struct bfd_link_order *link_order_tail;
-} asection;
-
-/* These sections are global, and are managed by BFD. The application
- and target back end are not permitted to change the values in
- these sections. New code should use the section_ptr macros rather
- than referring directly to the const sections. The const sections
- may eventually vanish. */
-#define BFD_ABS_SECTION_NAME "*ABS*"
-#define BFD_UND_SECTION_NAME "*UND*"
-#define BFD_COM_SECTION_NAME "*COM*"
-#define BFD_IND_SECTION_NAME "*IND*"
-
-/* The absolute section. */
-extern asection bfd_abs_section;
-#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-/* Pointer to the undefined section. */
-extern asection bfd_und_section;
-#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-/* Pointer to the common section. */
-extern asection bfd_com_section;
-#define bfd_com_section_ptr ((asection *) &bfd_com_section)
-/* Pointer to the indirect section. */
-extern asection bfd_ind_section;
-#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
-#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
-#define bfd_is_const_section(SEC) \
- ( ((SEC) == bfd_abs_section_ptr) \
- || ((SEC) == bfd_und_section_ptr) \
- || ((SEC) == bfd_com_section_ptr) \
- || ((SEC) == bfd_ind_section_ptr))
-
-extern const struct bfd_symbol * const bfd_abs_symbol;
-extern const struct bfd_symbol * const bfd_com_symbol;
-extern const struct bfd_symbol * const bfd_und_symbol;
-extern const struct bfd_symbol * const bfd_ind_symbol;
-#define bfd_get_section_size_before_reloc(section) \
- ((section)->_raw_size)
-#define bfd_get_section_size_after_reloc(section) \
- ((section)->reloc_done ? (section)->_cooked_size \
- : (abort (), (bfd_size_type) 1))
-
-/* Macros to handle insertion and deletion of a bfd's sections. These
- only handle the list pointers, ie. do not adjust section_count,
- target_index etc. */
-#define bfd_section_list_remove(ABFD, PS) \
- do \
- { \
- asection **_ps = PS; \
- asection *_s = *_ps; \
- *_ps = _s->next; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = _ps; \
- } \
- while (0)
-#define bfd_section_list_insert(ABFD, PS, S) \
- do \
- { \
- asection **_ps = PS; \
- asection *_s = S; \
- _s->next = *_ps; \
- *_ps = _s; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = &_s->next; \
- } \
- while (0)
-
-void bfd_section_list_clear (bfd *);
-
-asection *bfd_get_section_by_name (bfd *abfd, const char *name);
-
-char *bfd_get_unique_section_name
- (bfd *abfd, const char *templat, int *count);
-
-asection *bfd_make_section_old_way (bfd *abfd, const char *name);
-
-asection *bfd_make_section_anyway (bfd *abfd, const char *name);
-
-asection *bfd_make_section (bfd *, const char *name);
-
-bfd_boolean bfd_set_section_flags
- (bfd *abfd, asection *sec, flagword flags);
-
-void bfd_map_over_sections
- (bfd *abfd,
- void (*func) (bfd *abfd, asection *sect, void *obj),
- void *obj);
-
-bfd_boolean bfd_set_section_size
- (bfd *abfd, asection *sec, bfd_size_type val);
-
-bfd_boolean bfd_set_section_contents
- (bfd *abfd, asection *section, const void *data,
- file_ptr offset, bfd_size_type count);
-
-bfd_boolean bfd_get_section_contents
- (bfd *abfd, asection *section, void *location, file_ptr offset,
- bfd_size_type count);
-
-bfd_boolean bfd_copy_private_section_data
- (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, \
- (ibfd, isection, obfd, osection))
-void _bfd_strip_section_from_output
- (struct bfd_link_info *info, asection *section);
-
-bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
-
-/* Extracted from archures.c. */
-enum bfd_architecture
-{
- bfd_arch_unknown, /* File arch not known. */
- bfd_arch_obscure, /* Arch known, not one of these. */
- bfd_arch_m68k, /* Motorola 68xxx */
-#define bfd_mach_m68000 1
-#define bfd_mach_m68008 2
-#define bfd_mach_m68010 3
-#define bfd_mach_m68020 4
-#define bfd_mach_m68030 5
-#define bfd_mach_m68040 6
-#define bfd_mach_m68060 7
-#define bfd_mach_cpu32 8
-#define bfd_mach_mcf5200 9
-#define bfd_mach_mcf5206e 10
-#define bfd_mach_mcf5307 11
-#define bfd_mach_mcf5407 12
-#define bfd_mach_mcf528x 13
- bfd_arch_vax, /* DEC Vax */
- bfd_arch_i960, /* Intel 960 */
- /* The order of the following is important.
- lower number indicates a machine type that
- only accepts a subset of the instructions
- available to machines with higher numbers.
- The exception is the "ca", which is
- incompatible with all other machines except
- "core". */
-
-#define bfd_mach_i960_core 1
-#define bfd_mach_i960_ka_sa 2
-#define bfd_mach_i960_kb_sb 3
-#define bfd_mach_i960_mc 4
-#define bfd_mach_i960_xa 5
-#define bfd_mach_i960_ca 6
-#define bfd_mach_i960_jx 7
-#define bfd_mach_i960_hx 8
-
- bfd_arch_or32, /* OpenRISC 32 */
-
- bfd_arch_a29k, /* AMD 29000 */
- bfd_arch_sparc, /* SPARC */
-#define bfd_mach_sparc 1
-/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
-#define bfd_mach_sparc_sparclet 2
-#define bfd_mach_sparc_sparclite 3
-#define bfd_mach_sparc_v8plus 4
-#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
-#define bfd_mach_sparc_sparclite_le 6
-#define bfd_mach_sparc_v9 7
-#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
-#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
-#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
-/* Nonzero if MACH has the v9 instruction set. */
-#define bfd_mach_sparc_v9_p(mach) \
- ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
- && (mach) != bfd_mach_sparc_sparclite_le)
- bfd_arch_mips, /* MIPS Rxxxx */
-#define bfd_mach_mips3000 3000
-#define bfd_mach_mips3900 3900
-#define bfd_mach_mips4000 4000
-#define bfd_mach_mips4010 4010
-#define bfd_mach_mips4100 4100
-#define bfd_mach_mips4111 4111
-#define bfd_mach_mips4120 4120
-#define bfd_mach_mips4300 4300
-#define bfd_mach_mips4400 4400
-#define bfd_mach_mips4600 4600
-#define bfd_mach_mips4650 4650
-#define bfd_mach_mips5000 5000
-#define bfd_mach_mips5400 5400
-#define bfd_mach_mips5500 5500
-#define bfd_mach_mips6000 6000
-#define bfd_mach_mips7000 7000
-#define bfd_mach_mips8000 8000
-#define bfd_mach_mips10000 10000
-#define bfd_mach_mips12000 12000
-#define bfd_mach_mips16 16
-#define bfd_mach_mips5 5
-#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
-#define bfd_mach_mipsisa32 32
-#define bfd_mach_mipsisa32r2 33
-#define bfd_mach_mipsisa64 64
-#define bfd_mach_mipsisa64r2 65
- bfd_arch_i386, /* Intel 386 */
-#define bfd_mach_i386_i386 1
-#define bfd_mach_i386_i8086 2
-#define bfd_mach_i386_i386_intel_syntax 3
-#define bfd_mach_x86_64 64
-#define bfd_mach_x86_64_intel_syntax 65
- bfd_arch_we32k, /* AT&T WE32xxx */
- bfd_arch_tahoe, /* CCI/Harris Tahoe */
- bfd_arch_i860, /* Intel 860 */
- bfd_arch_i370, /* IBM 360/370 Mainframes */
- bfd_arch_romp, /* IBM ROMP PC/RT */
- bfd_arch_alliant, /* Alliant */
- bfd_arch_convex, /* Convex */
- bfd_arch_m88k, /* Motorola 88xxx */
- bfd_arch_m98k, /* Motorola 98xxx */
- bfd_arch_pyramid, /* Pyramid Technology */
- bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
-#define bfd_mach_h8300 1
-#define bfd_mach_h8300h 2
-#define bfd_mach_h8300s 3
-#define bfd_mach_h8300hn 4
-#define bfd_mach_h8300sn 5
-#define bfd_mach_h8300sx 6
-#define bfd_mach_h8300sxn 7
- bfd_arch_pdp11, /* DEC PDP-11 */
- bfd_arch_powerpc, /* PowerPC */
-#define bfd_mach_ppc 32
-#define bfd_mach_ppc64 64
-#define bfd_mach_ppc_403 403
-#define bfd_mach_ppc_403gc 4030
-#define bfd_mach_ppc_505 505
-#define bfd_mach_ppc_601 601
-#define bfd_mach_ppc_602 602
-#define bfd_mach_ppc_603 603
-#define bfd_mach_ppc_ec603e 6031
-#define bfd_mach_ppc_604 604
-#define bfd_mach_ppc_620 620
-#define bfd_mach_ppc_630 630
-#define bfd_mach_ppc_750 750
-#define bfd_mach_ppc_860 860
-#define bfd_mach_ppc_a35 35
-#define bfd_mach_ppc_rs64ii 642
-#define bfd_mach_ppc_rs64iii 643
-#define bfd_mach_ppc_7400 7400
-#define bfd_mach_ppc_e500 500
- bfd_arch_rs6000, /* IBM RS/6000 */
-#define bfd_mach_rs6k 6000
-#define bfd_mach_rs6k_rs1 6001
-#define bfd_mach_rs6k_rsc 6003
-#define bfd_mach_rs6k_rs2 6002
- bfd_arch_hppa, /* HP PA RISC */
-#define bfd_mach_hppa10 10
-#define bfd_mach_hppa11 11
-#define bfd_mach_hppa20 20
-#define bfd_mach_hppa20w 25
- bfd_arch_d10v, /* Mitsubishi D10V */
-#define bfd_mach_d10v 1
-#define bfd_mach_d10v_ts2 2
-#define bfd_mach_d10v_ts3 3
- bfd_arch_d30v, /* Mitsubishi D30V */
- bfd_arch_dlx, /* DLX */
- bfd_arch_m68hc11, /* Motorola 68HC11 */
- bfd_arch_m68hc12, /* Motorola 68HC12 */
-#define bfd_mach_m6812_default 0
-#define bfd_mach_m6812 1
-#define bfd_mach_m6812s 2
- bfd_arch_z8k, /* Zilog Z8000 */
-#define bfd_mach_z8001 1
-#define bfd_mach_z8002 2
- bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
- bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
-#define bfd_mach_sh 1
-#define bfd_mach_sh2 0x20
-#define bfd_mach_sh_dsp 0x2d
-#define bfd_mach_sh2e 0x2e
-#define bfd_mach_sh3 0x30
-#define bfd_mach_sh3_dsp 0x3d
-#define bfd_mach_sh3e 0x3e
-#define bfd_mach_sh4 0x40
-#define bfd_mach_sh4_nofpu 0x41
-#define bfd_mach_sh4a 0x4a
-#define bfd_mach_sh4a_nofpu 0x4b
-#define bfd_mach_sh4al_dsp 0x4d
-#define bfd_mach_sh5 0x50
- bfd_arch_alpha, /* Dec Alpha */
-#define bfd_mach_alpha_ev4 0x10
-#define bfd_mach_alpha_ev5 0x20
-#define bfd_mach_alpha_ev6 0x30
- bfd_arch_arm, /* Advanced Risc Machines ARM. */
-#define bfd_mach_arm_unknown 0
-#define bfd_mach_arm_2 1
-#define bfd_mach_arm_2a 2
-#define bfd_mach_arm_3 3
-#define bfd_mach_arm_3M 4
-#define bfd_mach_arm_4 5
-#define bfd_mach_arm_4T 6
-#define bfd_mach_arm_5 7
-#define bfd_mach_arm_5T 8
-#define bfd_mach_arm_5TE 9
-#define bfd_mach_arm_XScale 10
-#define bfd_mach_arm_ep9312 11
-#define bfd_mach_arm_iWMMXt 12
- bfd_arch_ns32k, /* National Semiconductors ns32000 */
- bfd_arch_w65, /* WDC 65816 */
- bfd_arch_tic30, /* Texas Instruments TMS320C30 */
- bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
-#define bfd_mach_tic3x 30
-#define bfd_mach_tic4x 40
- bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
- bfd_arch_tic80, /* TI TMS320c80 (MVP) */
- bfd_arch_v850, /* NEC V850 */
-#define bfd_mach_v850 1
-#define bfd_mach_v850e 'E'
-#define bfd_mach_v850e1 '1'
- bfd_arch_arc, /* ARC Cores */
-#define bfd_mach_arc_5 5
-#define bfd_mach_arc_6 6
-#define bfd_mach_arc_7 7
-#define bfd_mach_arc_8 8
- bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
-#define bfd_mach_m32r 1 /* For backwards compatibility. */
-#define bfd_mach_m32rx 'x'
-#define bfd_mach_m32r2 '2'
- bfd_arch_mn10200, /* Matsushita MN10200 */
- bfd_arch_mn10300, /* Matsushita MN10300 */
-#define bfd_mach_mn10300 300
-#define bfd_mach_am33 330
-#define bfd_mach_am33_2 332
- bfd_arch_fr30,
-#define bfd_mach_fr30 0x46523330
- bfd_arch_frv,
-#define bfd_mach_frv 1
-#define bfd_mach_frvsimple 2
-#define bfd_mach_fr300 300
-#define bfd_mach_fr400 400
-#define bfd_mach_frvtomcat 499 /* fr500 prototype */
-#define bfd_mach_fr500 500
-#define bfd_mach_fr550 550
- bfd_arch_mcore,
- bfd_arch_ia64, /* HP/Intel ia64 */
-#define bfd_mach_ia64_elf64 64
-#define bfd_mach_ia64_elf32 32
- bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
-#define bfd_mach_ip2022 1
-#define bfd_mach_ip2022ext 2
- bfd_arch_iq2000, /* Vitesse IQ2000. */
-#define bfd_mach_iq2000 1
-#define bfd_mach_iq10 2
- bfd_arch_pj,
- bfd_arch_avr, /* Atmel AVR microcontrollers. */
-#define bfd_mach_avr1 1
-#define bfd_mach_avr2 2
-#define bfd_mach_avr3 3
-#define bfd_mach_avr4 4
-#define bfd_mach_avr5 5
- bfd_arch_cris, /* Axis CRIS */
- bfd_arch_s390, /* IBM s390 */
-#define bfd_mach_s390_31 31
-#define bfd_mach_s390_64 64
- bfd_arch_openrisc, /* OpenRISC */
- bfd_arch_mmix, /* Donald Knuth's educational processor. */
- bfd_arch_xstormy16,
-#define bfd_mach_xstormy16 1
- bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
-#define bfd_mach_msp11 11
-#define bfd_mach_msp110 110
-#define bfd_mach_msp12 12
-#define bfd_mach_msp13 13
-#define bfd_mach_msp14 14
-#define bfd_mach_msp15 15
-#define bfd_mach_msp16 16
-#define bfd_mach_msp31 31
-#define bfd_mach_msp32 32
-#define bfd_mach_msp33 33
-#define bfd_mach_msp41 41
-#define bfd_mach_msp42 42
-#define bfd_mach_msp43 43
-#define bfd_mach_msp44 44
- bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
-#define bfd_mach_xtensa 1
- bfd_arch_last
- };
-
-typedef struct bfd_arch_info
-{
- int bits_per_word;
- int bits_per_address;
- int bits_per_byte;
- enum bfd_architecture arch;
- unsigned long mach;
- const char *arch_name;
- const char *printable_name;
- unsigned int section_align_power;
- /* TRUE if this is the default machine for the architecture.
- The default arch should be the first entry for an arch so that
- all the entries for that arch can be accessed via <<next>>. */
- bfd_boolean the_default;
- const struct bfd_arch_info * (*compatible)
- (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
-
- bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
-
- const struct bfd_arch_info *next;
-}
-bfd_arch_info_type;
-
-const char *bfd_printable_name (bfd *abfd);
-
-const bfd_arch_info_type *bfd_scan_arch (const char *string);
-
-const char **bfd_arch_list (void);
-
-const bfd_arch_info_type *bfd_arch_get_compatible
- (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
-
-void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
-
-enum bfd_architecture bfd_get_arch (bfd *abfd);
-
-unsigned long bfd_get_mach (bfd *abfd);
-
-unsigned int bfd_arch_bits_per_byte (bfd *abfd);
-
-unsigned int bfd_arch_bits_per_address (bfd *abfd);
-
-const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
-
-const bfd_arch_info_type *bfd_lookup_arch
- (enum bfd_architecture arch, unsigned long machine);
-
-const char *bfd_printable_arch_mach
- (enum bfd_architecture arch, unsigned long machine);
-
-unsigned int bfd_octets_per_byte (bfd *abfd);
-
-unsigned int bfd_arch_mach_octets_per_byte
- (enum bfd_architecture arch, unsigned long machine);
-
-/* Extracted from reloc.c. */
-typedef enum bfd_reloc_status
-{
- /* No errors detected. */
- bfd_reloc_ok,
-
- /* The relocation was performed, but there was an overflow. */
- bfd_reloc_overflow,
-
- /* The address to relocate was not within the section supplied. */
- bfd_reloc_outofrange,
-
- /* Used by special functions. */
- bfd_reloc_continue,
-
- /* Unsupported relocation size requested. */
- bfd_reloc_notsupported,
-
- /* Unused. */
- bfd_reloc_other,
-
- /* 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. */
- bfd_reloc_dangerous
- }
- bfd_reloc_status_type;
-
-
-typedef struct reloc_cache_entry
-{
- /* A pointer into the canonical table of pointers. */
- struct bfd_symbol **sym_ptr_ptr;
-
- /* offset in section. */
- bfd_size_type address;
-
- /* addend for relocation value. */
- bfd_vma addend;
-
- /* Pointer to how to perform the required relocation. */
- reloc_howto_type *howto;
-
-}
-arelent;
-
-enum complain_overflow
-{
- /* Do not complain on overflow. */
- complain_overflow_dont,
-
- /* 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_overflow_signed,
-
- /* 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. */
- unsigned int type;
-
- /* 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. */
- int size;
-
- /* 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. */
- bfd_boolean pc_relative;
-
- /* 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. */
- 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 accommodated (e.g., i960 callj
- instructions). */
- bfd_reloc_status_type (*special_function)
- (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
- bfd *, char **);
-
- /* 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. */
- bfd_boolean partial_inplace;
-
- /* src_mask selects the part of the instruction (or data) to be used
- in the relocation sum. If the target relocations don't have an
- addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
- dst_mask to extract the addend from the section contents. If
- relocations do have an addend in the reloc, eg. ELF USE_RELA, this
- field should be zero. Non-zero values for ELF USE_RELA targets are
- bogus as in those cases the value in the dst_mask part of the
- section contents should be treated as garbage. */
- bfd_vma src_mask;
-
- /* dst_mask selects which parts of the instruction (or data) are
- replaced with a relocated value. */
- 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. */
- bfd_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 EMPTY_HOWTO(C) \
- HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
- NULL, FALSE, 0, 0, FALSE)
-
-#define HOWTO_PREPARE(relocation, symbol) \
- { \
- if (symbol != NULL) \
- { \
- if (bfd_is_com_section (symbol->section)) \
- { \
- relocation = 0; \
- } \
- else \
- { \
- relocation = symbol->value; \
- } \
- } \
- }
-
-unsigned int bfd_get_reloc_size (reloc_howto_type *);
-
-typedef struct relent_chain
-{
- arelent relent;
- struct relent_chain *next;
-}
-arelent_chain;
-
-bfd_reloc_status_type bfd_check_overflow
- (enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
- bfd_vma relocation);
-
-bfd_reloc_status_type bfd_perform_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message);
-
-bfd_reloc_status_type bfd_install_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data, bfd_vma data_start,
- asection *input_section,
- char **error_message);
-
-enum bfd_reloc_code_real {
- _dummy_first_bfd_reloc_code_real,
-
-
-/* Basic absolute relocations of N bits. */
- BFD_RELOC_64,
- BFD_RELOC_32,
- BFD_RELOC_26,
- BFD_RELOC_24,
- BFD_RELOC_16,
- BFD_RELOC_14,
- BFD_RELOC_8,
-
-/* PC-relative relocations. Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation. It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations. */
- BFD_RELOC_64_PCREL,
- BFD_RELOC_32_PCREL,
- BFD_RELOC_24_PCREL,
- BFD_RELOC_16_PCREL,
- BFD_RELOC_12_PCREL,
- BFD_RELOC_8_PCREL,
-
-/* For ELF. */
- BFD_RELOC_32_GOT_PCREL,
- BFD_RELOC_16_GOT_PCREL,
- BFD_RELOC_8_GOT_PCREL,
- BFD_RELOC_32_GOTOFF,
- BFD_RELOC_16_GOTOFF,
- BFD_RELOC_LO16_GOTOFF,
- BFD_RELOC_HI16_GOTOFF,
- BFD_RELOC_HI16_S_GOTOFF,
- BFD_RELOC_8_GOTOFF,
- BFD_RELOC_64_PLT_PCREL,
- BFD_RELOC_32_PLT_PCREL,
- BFD_RELOC_24_PLT_PCREL,
- BFD_RELOC_16_PLT_PCREL,
- BFD_RELOC_8_PLT_PCREL,
- BFD_RELOC_64_PLTOFF,
- BFD_RELOC_32_PLTOFF,
- BFD_RELOC_16_PLTOFF,
- BFD_RELOC_LO16_PLTOFF,
- BFD_RELOC_HI16_PLTOFF,
- BFD_RELOC_HI16_S_PLTOFF,
- BFD_RELOC_8_PLTOFF,
-
-/* Relocations used by 68K ELF. */
- BFD_RELOC_68K_GLOB_DAT,
- BFD_RELOC_68K_JMP_SLOT,
- BFD_RELOC_68K_RELATIVE,
-
-/* Linkage-table relative. */
- BFD_RELOC_32_BASEREL,
- BFD_RELOC_16_BASEREL,
- BFD_RELOC_LO16_BASEREL,
- BFD_RELOC_HI16_BASEREL,
- BFD_RELOC_HI16_S_BASEREL,
- BFD_RELOC_8_BASEREL,
- BFD_RELOC_RVA,
-
-/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
- BFD_RELOC_8_FFnn,
-
-/* These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits. The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha. */
- BFD_RELOC_32_PCREL_S2,
- BFD_RELOC_16_PCREL_S2,
- BFD_RELOC_23_PCREL_S2,
-
-/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word. These are used on the SPARC. */
- BFD_RELOC_HI22,
- BFD_RELOC_LO10,
-
-/* For systems that allocate a Global Pointer register, these are
-displacements off that register. These relocation types are
-handled specially, because the value the register will have is
-decided relatively late. */
- BFD_RELOC_GPREL16,
- BFD_RELOC_GPREL32,
-
-/* Reloc types used for i960/b.out. */
- BFD_RELOC_I960_CALLJ,
-
-/* SPARC ELF relocations. There is probably some overlap with other
-relocation types already defined. */
- BFD_RELOC_NONE,
- BFD_RELOC_SPARC_WDISP22,
- BFD_RELOC_SPARC22,
- BFD_RELOC_SPARC13,
- BFD_RELOC_SPARC_GOT10,
- BFD_RELOC_SPARC_GOT13,
- BFD_RELOC_SPARC_GOT22,
- BFD_RELOC_SPARC_PC10,
- BFD_RELOC_SPARC_PC22,
- BFD_RELOC_SPARC_WPLT30,
- BFD_RELOC_SPARC_COPY,
- BFD_RELOC_SPARC_GLOB_DAT,
- BFD_RELOC_SPARC_JMP_SLOT,
- BFD_RELOC_SPARC_RELATIVE,
- BFD_RELOC_SPARC_UA16,
- BFD_RELOC_SPARC_UA32,
- BFD_RELOC_SPARC_UA64,
-
-/* I think these are specific to SPARC a.out (e.g., Sun 4). */
- BFD_RELOC_SPARC_BASE13,
- BFD_RELOC_SPARC_BASE22,
-
-/* SPARC64 relocations */
-#define BFD_RELOC_SPARC_64 BFD_RELOC_64
- BFD_RELOC_SPARC_10,
- BFD_RELOC_SPARC_11,
- BFD_RELOC_SPARC_OLO10,
- BFD_RELOC_SPARC_HH22,
- BFD_RELOC_SPARC_HM10,
- BFD_RELOC_SPARC_LM22,
- BFD_RELOC_SPARC_PC_HH22,
- BFD_RELOC_SPARC_PC_HM10,
- BFD_RELOC_SPARC_PC_LM22,
- BFD_RELOC_SPARC_WDISP16,
- BFD_RELOC_SPARC_WDISP19,
- BFD_RELOC_SPARC_7,
- BFD_RELOC_SPARC_6,
- BFD_RELOC_SPARC_5,
-#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
- BFD_RELOC_SPARC_PLT32,
- BFD_RELOC_SPARC_PLT64,
- BFD_RELOC_SPARC_HIX22,
- BFD_RELOC_SPARC_LOX10,
- BFD_RELOC_SPARC_H44,
- BFD_RELOC_SPARC_M44,
- BFD_RELOC_SPARC_L44,
- BFD_RELOC_SPARC_REGISTER,
-
-/* SPARC little endian relocation */
- BFD_RELOC_SPARC_REV32,
-
-/* SPARC TLS relocations */
- BFD_RELOC_SPARC_TLS_GD_HI22,
- BFD_RELOC_SPARC_TLS_GD_LO10,
- BFD_RELOC_SPARC_TLS_GD_ADD,
- BFD_RELOC_SPARC_TLS_GD_CALL,
- BFD_RELOC_SPARC_TLS_LDM_HI22,
- BFD_RELOC_SPARC_TLS_LDM_LO10,
- BFD_RELOC_SPARC_TLS_LDM_ADD,
- BFD_RELOC_SPARC_TLS_LDM_CALL,
- BFD_RELOC_SPARC_TLS_LDO_HIX22,
- BFD_RELOC_SPARC_TLS_LDO_LOX10,
- BFD_RELOC_SPARC_TLS_LDO_ADD,
- BFD_RELOC_SPARC_TLS_IE_HI22,
- BFD_RELOC_SPARC_TLS_IE_LO10,
- BFD_RELOC_SPARC_TLS_IE_LD,
- BFD_RELOC_SPARC_TLS_IE_LDX,
- BFD_RELOC_SPARC_TLS_IE_ADD,
- BFD_RELOC_SPARC_TLS_LE_HIX22,
- BFD_RELOC_SPARC_TLS_LE_LOX10,
- BFD_RELOC_SPARC_TLS_DTPMOD32,
- BFD_RELOC_SPARC_TLS_DTPMOD64,
- BFD_RELOC_SPARC_TLS_DTPOFF32,
- BFD_RELOC_SPARC_TLS_DTPOFF64,
- BFD_RELOC_SPARC_TLS_TPOFF32,
- BFD_RELOC_SPARC_TLS_TPOFF64,
-
-/* Alpha ECOFF and ELF relocations. Some of these treat the symbol or
-"addend" in some special way.
-For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
-writing; when reading, it will be the absolute section symbol. The
-addend is the displacement in bytes of the "lda" instruction from
-the "ldah" instruction (which is at the address of this reloc). */
- BFD_RELOC_ALPHA_GPDISP_HI16,
-
-/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
-with GPDISP_HI16 relocs. The addend is ignored when writing the
-relocations out, and is filled in with the file's GP value on
-reading, for convenience. */
- BFD_RELOC_ALPHA_GPDISP_LO16,
-
-/* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
-relocation except that there is no accompanying GPDISP_LO16
-relocation. */
- BFD_RELOC_ALPHA_GPDISP,
-
-/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
-the assembler turns it into a LDQ instruction to load the address of
-the symbol, and then fills in a register in the real instruction.
-
-The LITERAL reloc, at the LDQ instruction, refers to the .lita
-section symbol. The addend is ignored when writing, but is filled
-in with the file's GP value on reading, for convenience, as with the
-GPDISP_LO16 reloc.
-
-The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
-It should refer to the symbol to be referenced, as with 16_GOTOFF,
-but it generates output not based on the position within the .got
-section, but relative to the GP value chosen for the file during the
-final link stage.
-
-The LITUSE reloc, on the instruction using the loaded address, gives
-information to the linker that it might be able to use to optimize
-away some literal section references. The symbol is ignored (read
-as the absolute section symbol), and the "addend" indicates the type
-of instruction using the register:
-1 - "memory" fmt insn
-2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch) */
- BFD_RELOC_ALPHA_LITERAL,
- BFD_RELOC_ALPHA_ELF_LITERAL,
- BFD_RELOC_ALPHA_LITUSE,
-
-/* The HINT relocation indicates a value that should be filled into the
-"hint" field of a jmp/jsr/ret instruction, for possible branch-
-prediction logic which may be provided on some processors. */
- BFD_RELOC_ALPHA_HINT,
-
-/* The LINKAGE relocation outputs a linkage pair in the object file,
-which is filled by the linker. */
- BFD_RELOC_ALPHA_LINKAGE,
-
-/* The CODEADDR relocation outputs a STO_CA in the object file,
-which is filled by the linker. */
- BFD_RELOC_ALPHA_CODEADDR,
-
-/* The GPREL_HI/LO relocations together form a 32-bit offset from the
-GP register. */
- BFD_RELOC_ALPHA_GPREL_HI16,
- BFD_RELOC_ALPHA_GPREL_LO16,
-
-/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
-share a common GP, and the target address is adjusted for
-STO_ALPHA_STD_GPLOAD. */
- BFD_RELOC_ALPHA_BRSGP,
-
-/* Alpha thread-local storage relocations. */
- BFD_RELOC_ALPHA_TLSGD,
- BFD_RELOC_ALPHA_TLSLDM,
- BFD_RELOC_ALPHA_DTPMOD64,
- BFD_RELOC_ALPHA_GOTDTPREL16,
- BFD_RELOC_ALPHA_DTPREL64,
- BFD_RELOC_ALPHA_DTPREL_HI16,
- BFD_RELOC_ALPHA_DTPREL_LO16,
- BFD_RELOC_ALPHA_DTPREL16,
- BFD_RELOC_ALPHA_GOTTPREL16,
- BFD_RELOC_ALPHA_TPREL64,
- BFD_RELOC_ALPHA_TPREL_HI16,
- BFD_RELOC_ALPHA_TPREL_LO16,
- BFD_RELOC_ALPHA_TPREL16,
-
-/* Bits 27..2 of the relocation address shifted right 2 bits;
-simple reloc otherwise. */
- BFD_RELOC_MIPS_JMP,
-
-/* The MIPS16 jump instruction. */
- BFD_RELOC_MIPS16_JMP,
-
-/* MIPS16 GP relative reloc. */
- BFD_RELOC_MIPS16_GPREL,
-
-/* High 16 bits of 32-bit value; simple reloc. */
- BFD_RELOC_HI16,
-
-/* High 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result. If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added. */
- BFD_RELOC_HI16_S,
-
-/* Low 16 bits. */
- BFD_RELOC_LO16,
-
-/* Like BFD_RELOC_HI16_S, but PC relative. */
- BFD_RELOC_PCREL_HI16_S,
-
-/* Like BFD_RELOC_LO16, but PC relative. */
- BFD_RELOC_PCREL_LO16,
-
-/* Relocation against a MIPS literal section. */
- BFD_RELOC_MIPS_LITERAL,
-
-/* MIPS ELF relocations. */
- BFD_RELOC_MIPS_GOT16,
- BFD_RELOC_MIPS_CALL16,
- BFD_RELOC_MIPS_GOT_HI16,
- BFD_RELOC_MIPS_GOT_LO16,
- BFD_RELOC_MIPS_CALL_HI16,
- BFD_RELOC_MIPS_CALL_LO16,
- BFD_RELOC_MIPS_SUB,
- BFD_RELOC_MIPS_GOT_PAGE,
- BFD_RELOC_MIPS_GOT_OFST,
- BFD_RELOC_MIPS_GOT_DISP,
- BFD_RELOC_MIPS_SHIFT5,
- BFD_RELOC_MIPS_SHIFT6,
- BFD_RELOC_MIPS_INSERT_A,
- BFD_RELOC_MIPS_INSERT_B,
- BFD_RELOC_MIPS_DELETE,
- BFD_RELOC_MIPS_HIGHEST,
- BFD_RELOC_MIPS_HIGHER,
- BFD_RELOC_MIPS_SCN_DISP,
- BFD_RELOC_MIPS_REL16,
- BFD_RELOC_MIPS_RELGOT,
- BFD_RELOC_MIPS_JALR,
-
-
-/* Fujitsu Frv Relocations. */
- BFD_RELOC_FRV_LABEL16,
- BFD_RELOC_FRV_LABEL24,
- BFD_RELOC_FRV_LO16,
- BFD_RELOC_FRV_HI16,
- BFD_RELOC_FRV_GPREL12,
- BFD_RELOC_FRV_GPRELU12,
- BFD_RELOC_FRV_GPREL32,
- BFD_RELOC_FRV_GPRELHI,
- BFD_RELOC_FRV_GPRELLO,
- BFD_RELOC_FRV_GOT12,
- BFD_RELOC_FRV_GOTHI,
- BFD_RELOC_FRV_GOTLO,
- BFD_RELOC_FRV_FUNCDESC,
- BFD_RELOC_FRV_FUNCDESC_GOT12,
- BFD_RELOC_FRV_FUNCDESC_GOTHI,
- BFD_RELOC_FRV_FUNCDESC_GOTLO,
- BFD_RELOC_FRV_FUNCDESC_VALUE,
- BFD_RELOC_FRV_FUNCDESC_GOTOFF12,
- BFD_RELOC_FRV_FUNCDESC_GOTOFFHI,
- BFD_RELOC_FRV_FUNCDESC_GOTOFFLO,
- BFD_RELOC_FRV_GOTOFF12,
- BFD_RELOC_FRV_GOTOFFHI,
- BFD_RELOC_FRV_GOTOFFLO,
-
-
-/* This is a 24bit GOT-relative reloc for the mn10300. */
- BFD_RELOC_MN10300_GOTOFF24,
-
-/* This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction. */
- BFD_RELOC_MN10300_GOT32,
-
-/* This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction. */
- BFD_RELOC_MN10300_GOT24,
-
-/* This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction. */
- BFD_RELOC_MN10300_GOT16,
-
-/* Copy symbol at runtime. */
- BFD_RELOC_MN10300_COPY,
-
-/* Create GOT entry. */
- BFD_RELOC_MN10300_GLOB_DAT,
-
-/* Create PLT entry. */
- BFD_RELOC_MN10300_JMP_SLOT,
-
-/* Adjust by program base. */
- BFD_RELOC_MN10300_RELATIVE,
-
-
-/* i386/elf relocations */
- BFD_RELOC_386_GOT32,
- BFD_RELOC_386_PLT32,
- BFD_RELOC_386_COPY,
- BFD_RELOC_386_GLOB_DAT,
- BFD_RELOC_386_JUMP_SLOT,
- BFD_RELOC_386_RELATIVE,
- BFD_RELOC_386_GOTOFF,
- BFD_RELOC_386_GOTPC,
- BFD_RELOC_386_TLS_TPOFF,
- BFD_RELOC_386_TLS_IE,
- BFD_RELOC_386_TLS_GOTIE,
- BFD_RELOC_386_TLS_LE,
- BFD_RELOC_386_TLS_GD,
- BFD_RELOC_386_TLS_LDM,
- BFD_RELOC_386_TLS_LDO_32,
- BFD_RELOC_386_TLS_IE_32,
- BFD_RELOC_386_TLS_LE_32,
- BFD_RELOC_386_TLS_DTPMOD32,
- BFD_RELOC_386_TLS_DTPOFF32,
- BFD_RELOC_386_TLS_TPOFF32,
-
-/* x86-64/elf relocations */
- BFD_RELOC_X86_64_GOT32,
- BFD_RELOC_X86_64_PLT32,
- BFD_RELOC_X86_64_COPY,
- BFD_RELOC_X86_64_GLOB_DAT,
- BFD_RELOC_X86_64_JUMP_SLOT,
- BFD_RELOC_X86_64_RELATIVE,
- BFD_RELOC_X86_64_GOTPCREL,
- BFD_RELOC_X86_64_32S,
- BFD_RELOC_X86_64_DTPMOD64,
- BFD_RELOC_X86_64_DTPOFF64,
- BFD_RELOC_X86_64_TPOFF64,
- BFD_RELOC_X86_64_TLSGD,
- BFD_RELOC_X86_64_TLSLD,
- BFD_RELOC_X86_64_DTPOFF32,
- BFD_RELOC_X86_64_GOTTPOFF,
- BFD_RELOC_X86_64_TPOFF32,
-
-/* ns32k relocations */
- BFD_RELOC_NS32K_IMM_8,
- BFD_RELOC_NS32K_IMM_16,
- BFD_RELOC_NS32K_IMM_32,
- BFD_RELOC_NS32K_IMM_8_PCREL,
- BFD_RELOC_NS32K_IMM_16_PCREL,
- BFD_RELOC_NS32K_IMM_32_PCREL,
- BFD_RELOC_NS32K_DISP_8,
- BFD_RELOC_NS32K_DISP_16,
- BFD_RELOC_NS32K_DISP_32,
- BFD_RELOC_NS32K_DISP_8_PCREL,
- BFD_RELOC_NS32K_DISP_16_PCREL,
- BFD_RELOC_NS32K_DISP_32_PCREL,
-
-/* PDP11 relocations */
- BFD_RELOC_PDP11_DISP_8_PCREL,
- BFD_RELOC_PDP11_DISP_6_PCREL,
-
-/* Picojava relocs. Not all of these appear in object files. */
- BFD_RELOC_PJ_CODE_HI16,
- BFD_RELOC_PJ_CODE_LO16,
- BFD_RELOC_PJ_CODE_DIR16,
- BFD_RELOC_PJ_CODE_DIR32,
- BFD_RELOC_PJ_CODE_REL16,
- BFD_RELOC_PJ_CODE_REL32,
-
-/* Power(rs6000) and PowerPC relocations. */
- BFD_RELOC_PPC_B26,
- BFD_RELOC_PPC_BA26,
- BFD_RELOC_PPC_TOC16,
- BFD_RELOC_PPC_B16,
- BFD_RELOC_PPC_B16_BRTAKEN,
- BFD_RELOC_PPC_B16_BRNTAKEN,
- BFD_RELOC_PPC_BA16,
- BFD_RELOC_PPC_BA16_BRTAKEN,
- BFD_RELOC_PPC_BA16_BRNTAKEN,
- BFD_RELOC_PPC_COPY,
- BFD_RELOC_PPC_GLOB_DAT,
- BFD_RELOC_PPC_JMP_SLOT,
- BFD_RELOC_PPC_RELATIVE,
- BFD_RELOC_PPC_LOCAL24PC,
- BFD_RELOC_PPC_EMB_NADDR32,
- BFD_RELOC_PPC_EMB_NADDR16,
- BFD_RELOC_PPC_EMB_NADDR16_LO,
- BFD_RELOC_PPC_EMB_NADDR16_HI,
- BFD_RELOC_PPC_EMB_NADDR16_HA,
- BFD_RELOC_PPC_EMB_SDAI16,
- BFD_RELOC_PPC_EMB_SDA2I16,
- BFD_RELOC_PPC_EMB_SDA2REL,
- BFD_RELOC_PPC_EMB_SDA21,
- BFD_RELOC_PPC_EMB_MRKREF,
- BFD_RELOC_PPC_EMB_RELSEC16,
- BFD_RELOC_PPC_EMB_RELST_LO,
- BFD_RELOC_PPC_EMB_RELST_HI,
- BFD_RELOC_PPC_EMB_RELST_HA,
- BFD_RELOC_PPC_EMB_BIT_FLD,
- BFD_RELOC_PPC_EMB_RELSDA,
- BFD_RELOC_PPC64_HIGHER,
- BFD_RELOC_PPC64_HIGHER_S,
- BFD_RELOC_PPC64_HIGHEST,
- BFD_RELOC_PPC64_HIGHEST_S,
- BFD_RELOC_PPC64_TOC16_LO,
- BFD_RELOC_PPC64_TOC16_HI,
- BFD_RELOC_PPC64_TOC16_HA,
- BFD_RELOC_PPC64_TOC,
- BFD_RELOC_PPC64_PLTGOT16,
- BFD_RELOC_PPC64_PLTGOT16_LO,
- BFD_RELOC_PPC64_PLTGOT16_HI,
- BFD_RELOC_PPC64_PLTGOT16_HA,
- BFD_RELOC_PPC64_ADDR16_DS,
- BFD_RELOC_PPC64_ADDR16_LO_DS,
- BFD_RELOC_PPC64_GOT16_DS,
- BFD_RELOC_PPC64_GOT16_LO_DS,
- BFD_RELOC_PPC64_PLT16_LO_DS,
- BFD_RELOC_PPC64_SECTOFF_DS,
- BFD_RELOC_PPC64_SECTOFF_LO_DS,
- BFD_RELOC_PPC64_TOC16_DS,
- BFD_RELOC_PPC64_TOC16_LO_DS,
- BFD_RELOC_PPC64_PLTGOT16_DS,
- BFD_RELOC_PPC64_PLTGOT16_LO_DS,
-
-/* PowerPC and PowerPC64 thread-local storage relocations. */
- BFD_RELOC_PPC_TLS,
- BFD_RELOC_PPC_DTPMOD,
- BFD_RELOC_PPC_TPREL16,
- BFD_RELOC_PPC_TPREL16_LO,
- BFD_RELOC_PPC_TPREL16_HI,
- BFD_RELOC_PPC_TPREL16_HA,
- BFD_RELOC_PPC_TPREL,
- BFD_RELOC_PPC_DTPREL16,
- BFD_RELOC_PPC_DTPREL16_LO,
- BFD_RELOC_PPC_DTPREL16_HI,
- BFD_RELOC_PPC_DTPREL16_HA,
- BFD_RELOC_PPC_DTPREL,
- BFD_RELOC_PPC_GOT_TLSGD16,
- BFD_RELOC_PPC_GOT_TLSGD16_LO,
- BFD_RELOC_PPC_GOT_TLSGD16_HI,
- BFD_RELOC_PPC_GOT_TLSGD16_HA,
- BFD_RELOC_PPC_GOT_TLSLD16,
- BFD_RELOC_PPC_GOT_TLSLD16_LO,
- BFD_RELOC_PPC_GOT_TLSLD16_HI,
- BFD_RELOC_PPC_GOT_TLSLD16_HA,
- BFD_RELOC_PPC_GOT_TPREL16,
- BFD_RELOC_PPC_GOT_TPREL16_LO,
- BFD_RELOC_PPC_GOT_TPREL16_HI,
- BFD_RELOC_PPC_GOT_TPREL16_HA,
- BFD_RELOC_PPC_GOT_DTPREL16,
- BFD_RELOC_PPC_GOT_DTPREL16_LO,
- BFD_RELOC_PPC_GOT_DTPREL16_HI,
- BFD_RELOC_PPC_GOT_DTPREL16_HA,
- BFD_RELOC_PPC64_TPREL16_DS,
- BFD_RELOC_PPC64_TPREL16_LO_DS,
- BFD_RELOC_PPC64_TPREL16_HIGHER,
- BFD_RELOC_PPC64_TPREL16_HIGHERA,
- BFD_RELOC_PPC64_TPREL16_HIGHEST,
- BFD_RELOC_PPC64_TPREL16_HIGHESTA,
- BFD_RELOC_PPC64_DTPREL16_DS,
- BFD_RELOC_PPC64_DTPREL16_LO_DS,
- BFD_RELOC_PPC64_DTPREL16_HIGHER,
- BFD_RELOC_PPC64_DTPREL16_HIGHERA,
- BFD_RELOC_PPC64_DTPREL16_HIGHEST,
- BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
-
-/* IBM 370/390 relocations */
- BFD_RELOC_I370_D12,
-
-/* The type of reloc used to build a constructor table - at the moment
-probably a 32 bit wide absolute relocation, but the target can choose.
-It generally does map to one of the other relocation types. */
- BFD_RELOC_CTOR,
-
-/* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
-not stored in the instruction. */
- BFD_RELOC_ARM_PCREL_BRANCH,
-
-/* ARM 26 bit pc-relative branch. The lowest bit must be zero and is
-not stored in the instruction. The 2nd lowest bit comes from a 1 bit
-field in the instruction. */
- BFD_RELOC_ARM_PCREL_BLX,
-
-/* Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
-not stored in the instruction. The 2nd lowest bit comes from a 1 bit
-field in the instruction. */
- BFD_RELOC_THUMB_PCREL_BLX,
-
-/* These relocs are only used within the ARM assembler. They are not
-(at present) written to any object files. */
- BFD_RELOC_ARM_IMMEDIATE,
- BFD_RELOC_ARM_ADRL_IMMEDIATE,
- BFD_RELOC_ARM_OFFSET_IMM,
- BFD_RELOC_ARM_SHIFT_IMM,
- BFD_RELOC_ARM_SWI,
- BFD_RELOC_ARM_MULTI,
- BFD_RELOC_ARM_CP_OFF_IMM,
- BFD_RELOC_ARM_CP_OFF_IMM_S2,
- BFD_RELOC_ARM_ADR_IMM,
- BFD_RELOC_ARM_LDR_IMM,
- BFD_RELOC_ARM_LITERAL,
- BFD_RELOC_ARM_IN_POOL,
- BFD_RELOC_ARM_OFFSET_IMM8,
- BFD_RELOC_ARM_HWLITERAL,
- BFD_RELOC_ARM_THUMB_ADD,
- BFD_RELOC_ARM_THUMB_IMM,
- BFD_RELOC_ARM_THUMB_SHIFT,
- BFD_RELOC_ARM_THUMB_OFFSET,
- BFD_RELOC_ARM_GOT12,
- BFD_RELOC_ARM_GOT32,
- BFD_RELOC_ARM_JUMP_SLOT,
- BFD_RELOC_ARM_COPY,
- BFD_RELOC_ARM_GLOB_DAT,
- BFD_RELOC_ARM_PLT32,
- BFD_RELOC_ARM_RELATIVE,
- BFD_RELOC_ARM_GOTOFF,
- BFD_RELOC_ARM_GOTPC,
-
-/* Renesas / SuperH SH relocs. Not all of these appear in object files. */
- BFD_RELOC_SH_PCDISP8BY2,
- BFD_RELOC_SH_PCDISP12BY2,
- BFD_RELOC_SH_IMM4,
- BFD_RELOC_SH_IMM4BY2,
- BFD_RELOC_SH_IMM4BY4,
- BFD_RELOC_SH_IMM8,
- BFD_RELOC_SH_IMM8BY2,
- BFD_RELOC_SH_IMM8BY4,
- BFD_RELOC_SH_PCRELIMM8BY2,
- BFD_RELOC_SH_PCRELIMM8BY4,
- BFD_RELOC_SH_SWITCH16,
- BFD_RELOC_SH_SWITCH32,
- BFD_RELOC_SH_USES,
- BFD_RELOC_SH_COUNT,
- BFD_RELOC_SH_ALIGN,
- BFD_RELOC_SH_CODE,
- BFD_RELOC_SH_DATA,
- BFD_RELOC_SH_LABEL,
- BFD_RELOC_SH_LOOP_START,
- BFD_RELOC_SH_LOOP_END,
- BFD_RELOC_SH_COPY,
- BFD_RELOC_SH_GLOB_DAT,
- BFD_RELOC_SH_JMP_SLOT,
- BFD_RELOC_SH_RELATIVE,
- BFD_RELOC_SH_GOTPC,
- BFD_RELOC_SH_GOT_LOW16,
- BFD_RELOC_SH_GOT_MEDLOW16,
- BFD_RELOC_SH_GOT_MEDHI16,
- BFD_RELOC_SH_GOT_HI16,
- BFD_RELOC_SH_GOTPLT_LOW16,
- BFD_RELOC_SH_GOTPLT_MEDLOW16,
- BFD_RELOC_SH_GOTPLT_MEDHI16,
- BFD_RELOC_SH_GOTPLT_HI16,
- BFD_RELOC_SH_PLT_LOW16,
- BFD_RELOC_SH_PLT_MEDLOW16,
- BFD_RELOC_SH_PLT_MEDHI16,
- BFD_RELOC_SH_PLT_HI16,
- BFD_RELOC_SH_GOTOFF_LOW16,
- BFD_RELOC_SH_GOTOFF_MEDLOW16,
- BFD_RELOC_SH_GOTOFF_MEDHI16,
- BFD_RELOC_SH_GOTOFF_HI16,
- BFD_RELOC_SH_GOTPC_LOW16,
- BFD_RELOC_SH_GOTPC_MEDLOW16,
- BFD_RELOC_SH_GOTPC_MEDHI16,
- BFD_RELOC_SH_GOTPC_HI16,
- BFD_RELOC_SH_COPY64,
- BFD_RELOC_SH_GLOB_DAT64,
- BFD_RELOC_SH_JMP_SLOT64,
- BFD_RELOC_SH_RELATIVE64,
- BFD_RELOC_SH_GOT10BY4,
- BFD_RELOC_SH_GOT10BY8,
- BFD_RELOC_SH_GOTPLT10BY4,
- BFD_RELOC_SH_GOTPLT10BY8,
- BFD_RELOC_SH_GOTPLT32,
- BFD_RELOC_SH_SHMEDIA_CODE,
- BFD_RELOC_SH_IMMU5,
- BFD_RELOC_SH_IMMS6,
- BFD_RELOC_SH_IMMS6BY32,
- BFD_RELOC_SH_IMMU6,
- BFD_RELOC_SH_IMMS10,
- BFD_RELOC_SH_IMMS10BY2,
- BFD_RELOC_SH_IMMS10BY4,
- BFD_RELOC_SH_IMMS10BY8,
- BFD_RELOC_SH_IMMS16,
- BFD_RELOC_SH_IMMU16,
- BFD_RELOC_SH_IMM_LOW16,
- BFD_RELOC_SH_IMM_LOW16_PCREL,
- BFD_RELOC_SH_IMM_MEDLOW16,
- BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
- BFD_RELOC_SH_IMM_MEDHI16,
- BFD_RELOC_SH_IMM_MEDHI16_PCREL,
- BFD_RELOC_SH_IMM_HI16,
- BFD_RELOC_SH_IMM_HI16_PCREL,
- BFD_RELOC_SH_PT_16,
- BFD_RELOC_SH_TLS_GD_32,
- BFD_RELOC_SH_TLS_LD_32,
- BFD_RELOC_SH_TLS_LDO_32,
- BFD_RELOC_SH_TLS_IE_32,
- BFD_RELOC_SH_TLS_LE_32,
- BFD_RELOC_SH_TLS_DTPMOD32,
- BFD_RELOC_SH_TLS_DTPOFF32,
- BFD_RELOC_SH_TLS_TPOFF32,
-
-/* Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must
-be zero and is not stored in the instruction. */
- BFD_RELOC_THUMB_PCREL_BRANCH9,
- BFD_RELOC_THUMB_PCREL_BRANCH12,
- BFD_RELOC_THUMB_PCREL_BRANCH23,
-
-/* ARC Cores relocs.
-ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
-not stored in the instruction. The high 20 bits are installed in bits 26
-through 7 of the instruction. */
- BFD_RELOC_ARC_B22_PCREL,
-
-/* ARC 26 bit absolute branch. The lowest two bits must be zero and are not
-stored in the instruction. The high 24 bits are installed in bits 23
-through 0. */
- BFD_RELOC_ARC_B26,
-
-/* Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0. */
- BFD_RELOC_D10V_10_PCREL_R,
-
-/* Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0. This is the same as the previous reloc
-except it is in the left container, i.e.,
-shifted left 15 bits. */
- BFD_RELOC_D10V_10_PCREL_L,
-
-/* This is an 18-bit reloc with the right 2 bits
-assumed to be 0. */
- BFD_RELOC_D10V_18,
-
-/* This is an 18-bit reloc with the right 2 bits
-assumed to be 0. */
- BFD_RELOC_D10V_18_PCREL,
-
-/* Mitsubishi D30V relocs.
-This is a 6-bit absolute reloc. */
- BFD_RELOC_D30V_6,
-
-/* This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0. */
- BFD_RELOC_D30V_9_PCREL,
-
-/* This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container. */
- BFD_RELOC_D30V_9_PCREL_R,
-
-/* This is a 12-bit absolute reloc with the
-right 3 bitsassumed to be 0. */
- BFD_RELOC_D30V_15,
-
-/* This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0. */
- BFD_RELOC_D30V_15_PCREL,
-
-/* This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container. */
- BFD_RELOC_D30V_15_PCREL_R,
-
-/* This is an 18-bit absolute reloc with
-the right 3 bits assumed to be 0. */
- BFD_RELOC_D30V_21,
-
-/* This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0. */
- BFD_RELOC_D30V_21_PCREL,
-
-/* This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container. */
- BFD_RELOC_D30V_21_PCREL_R,
-
-/* This is a 32-bit absolute reloc. */
- BFD_RELOC_D30V_32,
-
-/* This is a 32-bit pc-relative reloc. */
- BFD_RELOC_D30V_32_PCREL,
-
-/* DLX relocs */
- BFD_RELOC_DLX_HI16_S,
-
-/* DLX relocs */
- BFD_RELOC_DLX_LO16,
-
-/* DLX relocs */
- BFD_RELOC_DLX_JMP26,
-
-/* Renesas M32R (formerly Mitsubishi M32R) relocs.
-This is a 24 bit absolute address. */
- BFD_RELOC_M32R_24,
-
-/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. */
- BFD_RELOC_M32R_10_PCREL,
-
-/* This is an 18-bit reloc with the right 2 bits assumed to be 0. */
- BFD_RELOC_M32R_18_PCREL,
-
-/* This is a 26-bit reloc with the right 2 bits assumed to be 0. */
- BFD_RELOC_M32R_26_PCREL,
-
-/* This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as unsigned. */
- BFD_RELOC_M32R_HI16_ULO,
-
-/* This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as signed. */
- BFD_RELOC_M32R_HI16_SLO,
-
-/* This is a 16-bit reloc containing the lower 16 bits of an address. */
- BFD_RELOC_M32R_LO16,
-
-/* This is a 16-bit reloc containing the small data area offset for use in
-add3, load, and store instructions. */
- BFD_RELOC_M32R_SDA16,
-
-/* For PIC. */
- BFD_RELOC_M32R_GOT24,
- BFD_RELOC_M32R_26_PLTREL,
- BFD_RELOC_M32R_COPY,
- BFD_RELOC_M32R_GLOB_DAT,
- BFD_RELOC_M32R_JMP_SLOT,
- BFD_RELOC_M32R_RELATIVE,
- BFD_RELOC_M32R_GOTOFF,
- BFD_RELOC_M32R_GOTPC24,
- BFD_RELOC_M32R_GOT16_HI_ULO,
- BFD_RELOC_M32R_GOT16_HI_SLO,
- BFD_RELOC_M32R_GOT16_LO,
- BFD_RELOC_M32R_GOTPC_HI_ULO,
- BFD_RELOC_M32R_GOTPC_HI_SLO,
- BFD_RELOC_M32R_GOTPC_LO,
-
-/* This is a 9-bit reloc */
- BFD_RELOC_V850_9_PCREL,
-
-/* This is a 22-bit reloc */
- BFD_RELOC_V850_22_PCREL,
-
-/* This is a 16 bit offset from the short data area pointer. */
- BFD_RELOC_V850_SDA_16_16_OFFSET,
-
-/* This is a 16 bit offset (of which only 15 bits are used) from the
-short data area pointer. */
- BFD_RELOC_V850_SDA_15_16_OFFSET,
-
-/* This is a 16 bit offset from the zero data area pointer. */
- BFD_RELOC_V850_ZDA_16_16_OFFSET,
-
-/* This is a 16 bit offset (of which only 15 bits are used) from the
-zero data area pointer. */
- BFD_RELOC_V850_ZDA_15_16_OFFSET,
-
-/* This is an 8 bit offset (of which only 6 bits are used) from the
-tiny data area pointer. */
- BFD_RELOC_V850_TDA_6_8_OFFSET,
-
-/* This is an 8bit offset (of which only 7 bits are used) from the tiny
-data area pointer. */
- BFD_RELOC_V850_TDA_7_8_OFFSET,
-
-/* This is a 7 bit offset from the tiny data area pointer. */
- BFD_RELOC_V850_TDA_7_7_OFFSET,
-
-/* This is a 16 bit offset from the tiny data area pointer. */
- BFD_RELOC_V850_TDA_16_16_OFFSET,
-
-/* This is a 5 bit offset (of which only 4 bits are used) from the tiny
-data area pointer. */
- BFD_RELOC_V850_TDA_4_5_OFFSET,
-
-/* This is a 4 bit offset from the tiny data area pointer. */
- BFD_RELOC_V850_TDA_4_4_OFFSET,
-
-/* This is a 16 bit offset from the short data area pointer, with the
-bits placed non-contiguously in the instruction. */
- BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
-
-/* This is a 16 bit offset from the zero data area pointer, with the
-bits placed non-contiguously in the instruction. */
- BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
-
-/* This is a 6 bit offset from the call table base pointer. */
- BFD_RELOC_V850_CALLT_6_7_OFFSET,
-
-/* This is a 16 bit offset from the call table base pointer. */
- BFD_RELOC_V850_CALLT_16_16_OFFSET,
-
-/* Used for relaxing indirect function calls. */
- BFD_RELOC_V850_LONGCALL,
-
-/* Used for relaxing indirect jumps. */
- BFD_RELOC_V850_LONGJUMP,
-
-/* Used to maintain alignment whilst relaxing. */
- BFD_RELOC_V850_ALIGN,
-
-/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction. */
- BFD_RELOC_MN10300_32_PCREL,
-
-/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction. */
- BFD_RELOC_MN10300_16_PCREL,
-
-/* This is a 8bit DP reloc for the tms320c30, where the most
-significant 8 bits of a 24 bit word are placed into the least
-significant 8 bits of the opcode. */
- BFD_RELOC_TIC30_LDP,
-
-/* This is a 7bit reloc for the tms320c54x, where the least
-significant 7 bits of a 16 bit word are placed into the least
-significant 7 bits of the opcode. */
- BFD_RELOC_TIC54X_PARTLS7,
-
-/* This is a 9bit DP reloc for the tms320c54x, where the most
-significant 9 bits of a 16 bit word are placed into the least
-significant 9 bits of the opcode. */
- BFD_RELOC_TIC54X_PARTMS9,
-
-/* This is an extended address 23-bit reloc for the tms320c54x. */
- BFD_RELOC_TIC54X_23,
-
-/* This is a 16-bit reloc for the tms320c54x, where the least
-significant 16 bits of a 23-bit extended address are placed into
-the opcode. */
- BFD_RELOC_TIC54X_16_OF_23,
-
-/* This is a reloc for the tms320c54x, where the most
-significant 7 bits of a 23-bit extended address are placed into
-the opcode. */
- BFD_RELOC_TIC54X_MS7_OF_23,
-
-/* This is a 48 bit reloc for the FR30 that stores 32 bits. */
- BFD_RELOC_FR30_48,
-
-/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
-two sections. */
- BFD_RELOC_FR30_20,
-
-/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
-4 bits. */
- BFD_RELOC_FR30_6_IN_4,
-
-/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
-into 8 bits. */
- BFD_RELOC_FR30_8_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
-into 8 bits. */
- BFD_RELOC_FR30_9_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
-into 8 bits. */
- BFD_RELOC_FR30_10_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
-short offset into 8 bits. */
- BFD_RELOC_FR30_9_PCREL,
-
-/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
-short offset into 11 bits. */
- BFD_RELOC_FR30_12_PCREL,
-
-/* Motorola Mcore relocations. */
- BFD_RELOC_MCORE_PCREL_IMM8BY4,
- BFD_RELOC_MCORE_PCREL_IMM11BY2,
- BFD_RELOC_MCORE_PCREL_IMM4BY2,
- BFD_RELOC_MCORE_PCREL_32,
- BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
- BFD_RELOC_MCORE_RVA,
-
-/* These are relocations for the GETA instruction. */
- BFD_RELOC_MMIX_GETA,
- BFD_RELOC_MMIX_GETA_1,
- BFD_RELOC_MMIX_GETA_2,
- BFD_RELOC_MMIX_GETA_3,
-
-/* These are relocations for a conditional branch instruction. */
- BFD_RELOC_MMIX_CBRANCH,
- BFD_RELOC_MMIX_CBRANCH_J,
- BFD_RELOC_MMIX_CBRANCH_1,
- BFD_RELOC_MMIX_CBRANCH_2,
- BFD_RELOC_MMIX_CBRANCH_3,
-
-/* These are relocations for the PUSHJ instruction. */
- BFD_RELOC_MMIX_PUSHJ,
- BFD_RELOC_MMIX_PUSHJ_1,
- BFD_RELOC_MMIX_PUSHJ_2,
- BFD_RELOC_MMIX_PUSHJ_3,
- BFD_RELOC_MMIX_PUSHJ_STUBBABLE,
-
-/* These are relocations for the JMP instruction. */
- BFD_RELOC_MMIX_JMP,
- BFD_RELOC_MMIX_JMP_1,
- BFD_RELOC_MMIX_JMP_2,
- BFD_RELOC_MMIX_JMP_3,
-
-/* This is a relocation for a relative address as in a GETA instruction or
-a branch. */
- BFD_RELOC_MMIX_ADDR19,
-
-/* This is a relocation for a relative address as in a JMP instruction. */
- BFD_RELOC_MMIX_ADDR27,
-
-/* This is a relocation for an instruction field that may be a general
-register or a value 0..255. */
- BFD_RELOC_MMIX_REG_OR_BYTE,
-
-/* This is a relocation for an instruction field that may be a general
-register. */
- BFD_RELOC_MMIX_REG,
-
-/* This is a relocation for two instruction fields holding a register and
-an offset, the equivalent of the relocation. */
- BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
-
-/* This relocation is an assertion that the expression is not allocated as
-a global register. It does not modify contents. */
- BFD_RELOC_MMIX_LOCAL,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
-short offset into 7 bits. */
- BFD_RELOC_AVR_7_PCREL,
-
-/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
-short offset into 12 bits. */
- BFD_RELOC_AVR_13_PCREL,
-
-/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
-program memory address) into 16 bits. */
- BFD_RELOC_AVR_16_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-data memory address) into 8 bit immediate value of LDI insn. */
- BFD_RELOC_AVR_LO8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of data memory address) into 8 bit immediate value of LDI insn. */
- BFD_RELOC_AVR_HI8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of program memory address) into 8 bit immediate value of LDI insn. */
- BFD_RELOC_AVR_HH8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually data memory address) into 8 bit immediate value of SUBI insn. */
- BFD_RELOC_AVR_LO8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of data memory address) into 8 bit immediate value of
-SUBI insn. */
- BFD_RELOC_AVR_HI8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(most high 8 bit of program memory address) into 8 bit immediate value
-of LDI or SUBI insn. */
- BFD_RELOC_AVR_HH8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-command address) into 8 bit immediate value of LDI insn. */
- BFD_RELOC_AVR_LO8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of command address) into 8 bit immediate value of LDI insn. */
- BFD_RELOC_AVR_HI8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of command address) into 8 bit immediate value of LDI insn. */
- BFD_RELOC_AVR_HH8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually command address) into 8 bit immediate value of SUBI insn. */
- BFD_RELOC_AVR_LO8_LDI_PM_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of 16 bit command address) into 8 bit immediate value
-of SUBI insn. */
- BFD_RELOC_AVR_HI8_LDI_PM_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 6 bit of 22 bit command address) into 8 bit immediate
-value of SUBI insn. */
- BFD_RELOC_AVR_HH8_LDI_PM_NEG,
-
-/* This is a 32 bit reloc for the AVR that stores 23 bit value
-into 22 bits. */
- BFD_RELOC_AVR_CALL,
-
-/* Direct 12 bit. */
- BFD_RELOC_390_12,
-
-/* 12 bit GOT offset. */
- BFD_RELOC_390_GOT12,
-
-/* 32 bit PC relative PLT address. */
- BFD_RELOC_390_PLT32,
-
-/* Copy symbol at runtime. */
- BFD_RELOC_390_COPY,
-
-/* Create GOT entry. */
- BFD_RELOC_390_GLOB_DAT,
-
-/* Create PLT entry. */
- BFD_RELOC_390_JMP_SLOT,
-
-/* Adjust by program base. */
- BFD_RELOC_390_RELATIVE,
-
-/* 32 bit PC relative offset to GOT. */
- BFD_RELOC_390_GOTPC,
-
-/* 16 bit GOT offset. */
- BFD_RELOC_390_GOT16,
-
-/* PC relative 16 bit shifted by 1. */
- BFD_RELOC_390_PC16DBL,
-
-/* 16 bit PC rel. PLT shifted by 1. */
- BFD_RELOC_390_PLT16DBL,
-
-/* PC relative 32 bit shifted by 1. */
- BFD_RELOC_390_PC32DBL,
-
-/* 32 bit PC rel. PLT shifted by 1. */
- BFD_RELOC_390_PLT32DBL,
-
-/* 32 bit PC rel. GOT shifted by 1. */
- BFD_RELOC_390_GOTPCDBL,
-
-/* 64 bit GOT offset. */
- BFD_RELOC_390_GOT64,
-
-/* 64 bit PC relative PLT address. */
- BFD_RELOC_390_PLT64,
-
-/* 32 bit rel. offset to GOT entry. */
- BFD_RELOC_390_GOTENT,
-
-/* 64 bit offset to GOT. */
- BFD_RELOC_390_GOTOFF64,
-
-/* 12-bit offset to symbol-entry within GOT, with PLT handling. */
- BFD_RELOC_390_GOTPLT12,
-
-/* 16-bit offset to symbol-entry within GOT, with PLT handling. */
- BFD_RELOC_390_GOTPLT16,
-
-/* 32-bit offset to symbol-entry within GOT, with PLT handling. */
- BFD_RELOC_390_GOTPLT32,
-
-/* 64-bit offset to symbol-entry within GOT, with PLT handling. */
- BFD_RELOC_390_GOTPLT64,
-
-/* 32-bit rel. offset to symbol-entry within GOT, with PLT handling. */
- BFD_RELOC_390_GOTPLTENT,
-
-/* 16-bit rel. offset from the GOT to a PLT entry. */
- BFD_RELOC_390_PLTOFF16,
-
-/* 32-bit rel. offset from the GOT to a PLT entry. */
- BFD_RELOC_390_PLTOFF32,
-
-/* 64-bit rel. offset from the GOT to a PLT entry. */
- BFD_RELOC_390_PLTOFF64,
-
-/* s390 tls relocations. */
- BFD_RELOC_390_TLS_LOAD,
- BFD_RELOC_390_TLS_GDCALL,
- BFD_RELOC_390_TLS_LDCALL,
- BFD_RELOC_390_TLS_GD32,
- BFD_RELOC_390_TLS_GD64,
- BFD_RELOC_390_TLS_GOTIE12,
- BFD_RELOC_390_TLS_GOTIE32,
- BFD_RELOC_390_TLS_GOTIE64,
- BFD_RELOC_390_TLS_LDM32,
- BFD_RELOC_390_TLS_LDM64,
- BFD_RELOC_390_TLS_IE32,
- BFD_RELOC_390_TLS_IE64,
- BFD_RELOC_390_TLS_IEENT,
- BFD_RELOC_390_TLS_LE32,
- BFD_RELOC_390_TLS_LE64,
- BFD_RELOC_390_TLS_LDO32,
- BFD_RELOC_390_TLS_LDO64,
- BFD_RELOC_390_TLS_DTPMOD,
- BFD_RELOC_390_TLS_DTPOFF,
- BFD_RELOC_390_TLS_TPOFF,
-
-/* Long displacement extension. */
- BFD_RELOC_390_20,
- BFD_RELOC_390_GOT20,
- BFD_RELOC_390_GOTPLT20,
- BFD_RELOC_390_TLS_GOTIE20,
-
-/* Scenix IP2K - 9-bit register number / data address */
- BFD_RELOC_IP2K_FR9,
-
-/* Scenix IP2K - 4-bit register/data bank number */
- BFD_RELOC_IP2K_BANK,
-
-/* Scenix IP2K - low 13 bits of instruction word address */
- BFD_RELOC_IP2K_ADDR16CJP,
-
-/* Scenix IP2K - high 3 bits of instruction word address */
- BFD_RELOC_IP2K_PAGE3,
-
-/* Scenix IP2K - ext/low/high 8 bits of data address */
- BFD_RELOC_IP2K_LO8DATA,
- BFD_RELOC_IP2K_HI8DATA,
- BFD_RELOC_IP2K_EX8DATA,
-
-/* Scenix IP2K - low/high 8 bits of instruction word address */
- BFD_RELOC_IP2K_LO8INSN,
- BFD_RELOC_IP2K_HI8INSN,
-
-/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0 */
- BFD_RELOC_IP2K_PC_SKIP,
-
-/* Scenix IP2K - 16 bit word address in text section. */
- BFD_RELOC_IP2K_TEXT,
-
-/* Scenix IP2K - 7-bit sp or dp offset */
- BFD_RELOC_IP2K_FR_OFFSET,
-
-/* Scenix VPE4K coprocessor - data/insn-space addressing */
- BFD_RELOC_VPE4KMATH_DATA,
- BFD_RELOC_VPE4KMATH_INSN,
-
-/* These two relocations are used by the linker to determine which of
-the entries in a C++ virtual function table are actually used. When
-the --gc-sections option is given, the linker will zero out the entries
-that are not used, so that the code for those functions need not be
-included in the output.
-
-VTABLE_INHERIT is a zero-space relocation used to describe to the
-linker the inheritance tree of a C++ virtual function table. The
-relocation's symbol should be the parent class' vtable, and the
-relocation should be located at the child vtable.
-
-VTABLE_ENTRY is a zero-space relocation that describes the use of a
-virtual function table entry. The reloc's symbol should refer to the
-table of the class mentioned in the code. Off of that base, an offset
-describes the entry that is being used. For Rela hosts, this offset
-is stored in the reloc's addend. For Rel hosts, we are forced to put
-this offset in the reloc's section offset. */
- BFD_RELOC_VTABLE_INHERIT,
- BFD_RELOC_VTABLE_ENTRY,
-
-/* Intel IA64 Relocations. */
- BFD_RELOC_IA64_IMM14,
- BFD_RELOC_IA64_IMM22,
- BFD_RELOC_IA64_IMM64,
- BFD_RELOC_IA64_DIR32MSB,
- BFD_RELOC_IA64_DIR32LSB,
- BFD_RELOC_IA64_DIR64MSB,
- BFD_RELOC_IA64_DIR64LSB,
- BFD_RELOC_IA64_GPREL22,
- BFD_RELOC_IA64_GPREL64I,
- BFD_RELOC_IA64_GPREL32MSB,
- BFD_RELOC_IA64_GPREL32LSB,
- BFD_RELOC_IA64_GPREL64MSB,
- BFD_RELOC_IA64_GPREL64LSB,
- BFD_RELOC_IA64_LTOFF22,
- BFD_RELOC_IA64_LTOFF64I,
- BFD_RELOC_IA64_PLTOFF22,
- BFD_RELOC_IA64_PLTOFF64I,
- BFD_RELOC_IA64_PLTOFF64MSB,
- BFD_RELOC_IA64_PLTOFF64LSB,
- BFD_RELOC_IA64_FPTR64I,
- BFD_RELOC_IA64_FPTR32MSB,
- BFD_RELOC_IA64_FPTR32LSB,
- BFD_RELOC_IA64_FPTR64MSB,
- BFD_RELOC_IA64_FPTR64LSB,
- BFD_RELOC_IA64_PCREL21B,
- BFD_RELOC_IA64_PCREL21BI,
- BFD_RELOC_IA64_PCREL21M,
- BFD_RELOC_IA64_PCREL21F,
- BFD_RELOC_IA64_PCREL22,
- BFD_RELOC_IA64_PCREL60B,
- BFD_RELOC_IA64_PCREL64I,
- BFD_RELOC_IA64_PCREL32MSB,
- BFD_RELOC_IA64_PCREL32LSB,
- BFD_RELOC_IA64_PCREL64MSB,
- BFD_RELOC_IA64_PCREL64LSB,
- BFD_RELOC_IA64_LTOFF_FPTR22,
- BFD_RELOC_IA64_LTOFF_FPTR64I,
- BFD_RELOC_IA64_LTOFF_FPTR32MSB,
- BFD_RELOC_IA64_LTOFF_FPTR32LSB,
- BFD_RELOC_IA64_LTOFF_FPTR64MSB,
- BFD_RELOC_IA64_LTOFF_FPTR64LSB,
- BFD_RELOC_IA64_SEGREL32MSB,
- BFD_RELOC_IA64_SEGREL32LSB,
- BFD_RELOC_IA64_SEGREL64MSB,
- BFD_RELOC_IA64_SEGREL64LSB,
- BFD_RELOC_IA64_SECREL32MSB,
- BFD_RELOC_IA64_SECREL32LSB,
- BFD_RELOC_IA64_SECREL64MSB,
- BFD_RELOC_IA64_SECREL64LSB,
- BFD_RELOC_IA64_REL32MSB,
- BFD_RELOC_IA64_REL32LSB,
- BFD_RELOC_IA64_REL64MSB,
- BFD_RELOC_IA64_REL64LSB,
- BFD_RELOC_IA64_LTV32MSB,
- BFD_RELOC_IA64_LTV32LSB,
- BFD_RELOC_IA64_LTV64MSB,
- BFD_RELOC_IA64_LTV64LSB,
- BFD_RELOC_IA64_IPLTMSB,
- BFD_RELOC_IA64_IPLTLSB,
- BFD_RELOC_IA64_COPY,
- BFD_RELOC_IA64_LTOFF22X,
- BFD_RELOC_IA64_LDXMOV,
- BFD_RELOC_IA64_TPREL14,
- BFD_RELOC_IA64_TPREL22,
- BFD_RELOC_IA64_TPREL64I,
- BFD_RELOC_IA64_TPREL64MSB,
- BFD_RELOC_IA64_TPREL64LSB,
- BFD_RELOC_IA64_LTOFF_TPREL22,
- BFD_RELOC_IA64_DTPMOD64MSB,
- BFD_RELOC_IA64_DTPMOD64LSB,
- BFD_RELOC_IA64_LTOFF_DTPMOD22,
- BFD_RELOC_IA64_DTPREL14,
- BFD_RELOC_IA64_DTPREL22,
- BFD_RELOC_IA64_DTPREL64I,
- BFD_RELOC_IA64_DTPREL32MSB,
- BFD_RELOC_IA64_DTPREL32LSB,
- BFD_RELOC_IA64_DTPREL64MSB,
- BFD_RELOC_IA64_DTPREL64LSB,
- BFD_RELOC_IA64_LTOFF_DTPREL22,
-
-/* Motorola 68HC11 reloc.
-This is the 8 bit high part of an absolute address. */
- BFD_RELOC_M68HC11_HI8,
-
-/* Motorola 68HC11 reloc.
-This is the 8 bit low part of an absolute address. */
- BFD_RELOC_M68HC11_LO8,
-
-/* Motorola 68HC11 reloc.
-This is the 3 bit of a value. */
- BFD_RELOC_M68HC11_3B,
-
-/* Motorola 68HC11 reloc.
-This reloc marks the beginning of a jump/call instruction.
-It is used for linker relaxation to correctly identify beginning
-of instruction and change some branches to use PC-relative
-addressing mode. */
- BFD_RELOC_M68HC11_RL_JUMP,
-
-/* Motorola 68HC11 reloc.
-This reloc marks a group of several instructions that gcc generates
-and for which the linker relaxation pass can modify and/or remove
-some of them. */
- BFD_RELOC_M68HC11_RL_GROUP,
-
-/* Motorola 68HC11 reloc.
-This is the 16-bit lower part of an address. It is used for 'call'
-instruction to specify the symbol address without any special
-transformation (due to memory bank window). */
- BFD_RELOC_M68HC11_LO16,
-
-/* Motorola 68HC11 reloc.
-This is a 8-bit reloc that specifies the page number of an address.
-It is used by 'call' instruction to specify the page number of
-the symbol. */
- BFD_RELOC_M68HC11_PAGE,
-
-/* Motorola 68HC11 reloc.
-This is a 24-bit reloc that represents the address with a 16-bit
-value and a 8-bit page number. The symbol address is transformed
-to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */
- BFD_RELOC_M68HC11_24,
-
-/* Motorola 68HC12 reloc.
-This is the 5 bits of a value. */
- BFD_RELOC_M68HC12_5B,
-
-/* These relocs are only used within the CRIS assembler. They are not
-(at present) written to any object files. */
- BFD_RELOC_CRIS_BDISP8,
- BFD_RELOC_CRIS_UNSIGNED_5,
- BFD_RELOC_CRIS_SIGNED_6,
- BFD_RELOC_CRIS_UNSIGNED_6,
- BFD_RELOC_CRIS_UNSIGNED_4,
-
-/* Relocs used in ELF shared libraries for CRIS. */
- BFD_RELOC_CRIS_COPY,
- BFD_RELOC_CRIS_GLOB_DAT,
- BFD_RELOC_CRIS_JUMP_SLOT,
- BFD_RELOC_CRIS_RELATIVE,
-
-/* 32-bit offset to symbol-entry within GOT. */
- BFD_RELOC_CRIS_32_GOT,
-
-/* 16-bit offset to symbol-entry within GOT. */
- BFD_RELOC_CRIS_16_GOT,
-
-/* 32-bit offset to symbol-entry within GOT, with PLT handling. */
- BFD_RELOC_CRIS_32_GOTPLT,
-
-/* 16-bit offset to symbol-entry within GOT, with PLT handling. */
- BFD_RELOC_CRIS_16_GOTPLT,
-
-/* 32-bit offset to symbol, relative to GOT. */
- BFD_RELOC_CRIS_32_GOTREL,
-
-/* 32-bit offset to symbol with PLT entry, relative to GOT. */
- BFD_RELOC_CRIS_32_PLT_GOTREL,
-
-/* 32-bit offset to symbol with PLT entry, relative to this relocation. */
- BFD_RELOC_CRIS_32_PLT_PCREL,
-
-/* Intel i860 Relocations. */
- BFD_RELOC_860_COPY,
- BFD_RELOC_860_GLOB_DAT,
- BFD_RELOC_860_JUMP_SLOT,
- BFD_RELOC_860_RELATIVE,
- BFD_RELOC_860_PC26,
- BFD_RELOC_860_PLT26,
- BFD_RELOC_860_PC16,
- BFD_RELOC_860_LOW0,
- BFD_RELOC_860_SPLIT0,
- BFD_RELOC_860_LOW1,
- BFD_RELOC_860_SPLIT1,
- BFD_RELOC_860_LOW2,
- BFD_RELOC_860_SPLIT2,
- BFD_RELOC_860_LOW3,
- BFD_RELOC_860_LOGOT0,
- BFD_RELOC_860_SPGOT0,
- BFD_RELOC_860_LOGOT1,
- BFD_RELOC_860_SPGOT1,
- BFD_RELOC_860_LOGOTOFF0,
- BFD_RELOC_860_SPGOTOFF0,
- BFD_RELOC_860_LOGOTOFF1,
- BFD_RELOC_860_SPGOTOFF1,
- BFD_RELOC_860_LOGOTOFF2,
- BFD_RELOC_860_LOGOTOFF3,
- BFD_RELOC_860_LOPC,
- BFD_RELOC_860_HIGHADJ,
- BFD_RELOC_860_HAGOT,
- BFD_RELOC_860_HAGOTOFF,
- BFD_RELOC_860_HAPC,
- BFD_RELOC_860_HIGH,
- BFD_RELOC_860_HIGOT,
- BFD_RELOC_860_HIGOTOFF,
-
-/* OpenRISC Relocations. */
- BFD_RELOC_OPENRISC_ABS_26,
- BFD_RELOC_OPENRISC_REL_26,
-
-/* H8 elf Relocations. */
- BFD_RELOC_H8_DIR16A8,
- BFD_RELOC_H8_DIR16R8,
- BFD_RELOC_H8_DIR24A8,
- BFD_RELOC_H8_DIR24R8,
- BFD_RELOC_H8_DIR32A16,
-
-/* Sony Xstormy16 Relocations. */
- BFD_RELOC_XSTORMY16_REL_12,
- BFD_RELOC_XSTORMY16_12,
- BFD_RELOC_XSTORMY16_24,
- BFD_RELOC_XSTORMY16_FPTR16,
-
-/* Relocations used by VAX ELF. */
- BFD_RELOC_VAX_GLOB_DAT,
- BFD_RELOC_VAX_JMP_SLOT,
- BFD_RELOC_VAX_RELATIVE,
-
-/* msp430 specific relocation codes */
- BFD_RELOC_MSP430_10_PCREL,
- BFD_RELOC_MSP430_16_PCREL,
- BFD_RELOC_MSP430_16,
- BFD_RELOC_MSP430_16_PCREL_BYTE,
- BFD_RELOC_MSP430_16_BYTE,
-
-/* IQ2000 Relocations. */
- BFD_RELOC_IQ2000_OFFSET_16,
- BFD_RELOC_IQ2000_OFFSET_21,
- BFD_RELOC_IQ2000_UHI16,
-
-/* Special Xtensa relocation used only by PLT entries in ELF shared
-objects to indicate that the runtime linker should set the value
-to one of its own internal functions or data structures. */
- BFD_RELOC_XTENSA_RTLD,
-
-/* Xtensa relocations for ELF shared objects. */
- BFD_RELOC_XTENSA_GLOB_DAT,
- BFD_RELOC_XTENSA_JMP_SLOT,
- BFD_RELOC_XTENSA_RELATIVE,
-
-/* Xtensa relocation used in ELF object files for symbols that may require
-PLT entries. Otherwise, this is just a generic 32-bit relocation. */
- BFD_RELOC_XTENSA_PLT,
-
-/* Generic Xtensa relocations. Only the operand number is encoded
-in the relocation. The details are determined by extracting the
-instruction opcode. */
- BFD_RELOC_XTENSA_OP0,
- BFD_RELOC_XTENSA_OP1,
- BFD_RELOC_XTENSA_OP2,
-
-/* Xtensa relocation to mark that the assembler expanded the
-instructions from an original target. The expansion size is
-encoded in the reloc size. */
- BFD_RELOC_XTENSA_ASM_EXPAND,
-
-/* Xtensa relocation to mark that the linker should simplify
-assembler-expanded instructions. This is commonly used
-internally by the linker after analysis of a
-BFD_RELOC_XTENSA_ASM_EXPAND. */
- BFD_RELOC_XTENSA_ASM_SIMPLIFY,
- BFD_RELOC_UNUSED };
-typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-reloc_howto_type *bfd_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-
-const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
-
-/* Extracted from syms.c. */
-
-typedef struct bfd_symbol
-{
- /* A pointer to the BFD which owns the symbol. This information
- is necessary so that a back end can work out what additional
- information (invisible to the application writer) is carried
- with the symbol.
-
- This field is *almost* redundant, since you can use section->owner
- instead, except that some symbols point to the global sections
- bfd_{abs,com,und}_section. This could be fixed by making
- these globals be per-bfd (or per-target-flavor). FIXME. */
- struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
-
- /* The text of the symbol. The name is left alone, and not copied; the
- application may not alter it. */
- 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
- a pointer to another symbol is stored here. */
- symvalue value;
-
- /* Attributes of a symbol. */
-#define BSF_NO_FLAGS 0x00
-
- /* The symbol has local scope; <<static>> in <<C>>. The value
- is the offset into the section of the data. */
-#define BSF_LOCAL 0x01
-
- /* The symbol has global scope; initialized data in <<C>>. The
- value is the offset into the section of the data. */
-#define BSF_GLOBAL 0x02
-
- /* The symbol has global scope and is exported. The value is
- the offset into the section of the data. */
-#define BSF_EXPORT BSF_GLOBAL /* No real difference. */
-
- /* A normal C symbol would be one of:
- <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
- <<BSF_GLOBAL>>. */
-
- /* The symbol is a debugging record. The value has an arbitrary
- meaning, unless BSF_DEBUGGING_RELOC is also set. */
-#define BSF_DEBUGGING 0x08
-
- /* The symbol denotes a function entry point. Used in ELF,
- perhaps others someday. */
-#define BSF_FUNCTION 0x10
-
- /* Used by the linker. */
-#define BSF_KEEP 0x20
-#define BSF_KEEP_G 0x40
-
- /* A weak global symbol, overridable without warnings by
- a regular global symbol of the same name. */
-#define BSF_WEAK 0x80
-
- /* This symbol was created to point to a section, e.g. ELF's
- STT_SECTION symbols. */
-#define BSF_SECTION_SYM 0x100
-
- /* The symbol used to be a common symbol, but now it is
- allocated. */
-#define BSF_OLD_COMMON 0x200
-
- /* The default value for common data. */
-#define BFD_FORT_COMM_DEFAULT_VALUE 0
-
- /* In some files the type of a symbol sometimes alters its
- location in an output file - ie in coff a <<ISFCN>> symbol
- which is also <<C_EXT>> symbol appears where it was
- declared and not at the end of a section. This bit is set
- by the target BFD part to convey this information. */
-#define BSF_NOT_AT_END 0x400
-
- /* Signal that the symbol is the label of constructor section. */
-#define BSF_CONSTRUCTOR 0x800
-
- /* Signal that the symbol is a warning symbol. The name is a
- warning. The name of the next symbol is the one to warn about;
- if a reference is made to a symbol with the same name as the next
- symbol, a warning is issued by the linker. */
-#define BSF_WARNING 0x1000
-
- /* Signal that the symbol is indirect. This symbol is an indirect
- pointer to the symbol with the same name as the next symbol. */
-#define BSF_INDIRECT 0x2000
-
- /* BSF_FILE marks symbols that contain a file name. This is used
- for ELF STT_FILE symbols. */
-#define BSF_FILE 0x4000
-
- /* Symbol is from dynamic linking information. */
-#define BSF_DYNAMIC 0x8000
-
- /* The symbol denotes a data object. Used in ELF, and perhaps
- others someday. */
-#define BSF_OBJECT 0x10000
-
- /* This symbol is a debugging symbol. The value is the offset
- into the section of the data. BSF_DEBUGGING should be set
- as well. */
-#define BSF_DEBUGGING_RELOC 0x20000
-
- /* This symbol is thread local. Used in ELF. */
-#define BSF_THREAD_LOCAL 0x40000
-
- flagword flags;
-
- /* A pointer to the section to which this symbol is
- relative. This will always be non NULL, there are special
- sections for undefined and absolute symbols. */
- struct bfd_section *section;
-
- /* Back end special data. */
- union
- {
- void *p;
- bfd_vma i;
- }
- udata;
-}
-asymbol;
-
-#define bfd_get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
-
-bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
-
-#define bfd_is_local_label_name(abfd, name) \
- BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-#define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-
-bfd_boolean bfd_set_symtab
- (bfd *abfd, asymbol **location, unsigned int count);
-
-void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
-
-#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-asymbol *_bfd_generic_make_empty_symbol (bfd *);
-
-#define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-int bfd_decode_symclass (asymbol *symbol);
-
-bfd_boolean bfd_is_undefined_symclass (int symclass);
-
-void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-
-bfd_boolean bfd_copy_private_symbol_data
- (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
-
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
- (ibfd, isymbol, obfd, osymbol))
-
-/* Extracted from bfd.c. */
-struct bfd
-{
- /* A unique identifier of the BFD */
- unsigned int id;
-
- /* The filename the application opened the BFD with. */
- const char *filename;
-
- /* A pointer to the target jump table. */
- const struct bfd_target *xvec;
-
- /* To avoid dragging too many header files into every file that
- includes `<<bfd.h>>', IOSTREAM has been declared as a "char *",
- and MTIME as a "long". Their correct types, to which they
- are cast when used, are "FILE *" and "time_t". The iostream
- is the result of an fopen on the filename. However, if the
- BFD_IN_MEMORY flag is set, then iostream is actually a pointer
- to a bfd_in_memory struct. */
- void *iostream;
-
- /* Is the file descriptor being cached? That is, can it be closed as
- needed, and re-opened when accessed later? */
- bfd_boolean cacheable;
-
- /* Marks whether there was a default target specified when the
- BFD was opened. This is used to select which matching algorithm
- to use to choose the back end. */
- bfd_boolean target_defaulted;
-
- /* The caching routines use these to maintain a
- least-recently-used list of BFDs. */
- struct bfd *lru_prev, *lru_next;
-
- /* When a file is closed by the caching routines, BFD retains
- state information on the file here... */
- ufile_ptr where;
-
- /* ... and here: (``once'' means at least once). */
- bfd_boolean opened_once;
-
- /* Set if we have a locally maintained mtime value, rather than
- getting it from the file each time. */
- bfd_boolean mtime_set;
-
- /* File modified time, if mtime_set is TRUE. */
- long mtime;
-
- /* Reserved for an unimplemented file locking extension. */
- int ifd;
-
- /* The format which belongs to the BFD. (object, core, etc.) */
- bfd_format format;
-
- /* The direction with which the BFD was opened. */
- enum bfd_direction
- {
- no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3
- }
- direction;
-
- /* Format_specific flags. */
- flagword flags;
-
- /* Currently my_archive is tested before adding origin to
- anything. I believe that this can become always an add of
- origin, with origin set to 0 for non archive files. */
- ufile_ptr origin;
-
- /* Remember when output has begun, to stop strange things
- from happening. */
- bfd_boolean output_has_begun;
-
- /* A hash table for section names. */
- struct bfd_hash_table section_htab;
-
- /* Pointer to linked list of sections. */
- struct bfd_section *sections;
-
- /* The place where we add to the section list. */
- struct bfd_section **section_tail;
-
- /* The number of sections. */
- unsigned int section_count;
-
- /* Stuff only useful for object files:
- The start address. */
- bfd_vma start_address;
-
- /* Used for input and output. */
- unsigned int symcount;
-
- /* Symbol table for output BFD (with symcount entries). */
- struct bfd_symbol **outsymbols;
-
- /* Used for slurped dynamic symbol tables. */
- unsigned int dynsymcount;
-
- /* Pointer to structure which contains architecture information. */
- const struct bfd_arch_info *arch_info;
-
- /* Stuff only useful for archives. */
- void *arelt_data;
- struct bfd *my_archive; /* The containing archive BFD. */
- struct bfd *next; /* The next BFD in the archive. */
- struct bfd *archive_head; /* The first BFD in the archive. */
- bfd_boolean has_armap;
-
- /* A chain of BFD structures involved in a link. */
- struct bfd *link_next;
-
- /* A field used by _bfd_generic_link_add_archive_symbols. This will
- be used only for archive elements. */
- int archive_pass;
-
- /* Used by the back end to hold private data. */
- union
- {
- struct aout_data_struct *aout_data;
- struct artdata *aout_ar_data;
- struct _oasys_data *oasys_obj_data;
- struct _oasys_ar_data *oasys_ar_data;
- struct coff_tdata *coff_obj_data;
- struct pe_tdata *pe_obj_data;
- struct xcoff_tdata *xcoff_obj_data;
- struct ecoff_tdata *ecoff_obj_data;
- struct ieee_data_struct *ieee_data;
- struct ieee_ar_data_struct *ieee_ar_data;
- struct srec_data_struct *srec_data;
- struct ihex_data_struct *ihex_data;
- struct tekhex_data_struct *tekhex_data;
- struct elf_obj_tdata *elf_obj_data;
- struct nlm_obj_tdata *nlm_obj_data;
- struct bout_data_struct *bout_data;
- struct mmo_data_struct *mmo_data;
- struct sun_core_struct *sun_core_data;
- struct sco5_core_struct *sco5_core_data;
- struct trad_core_struct *trad_core_data;
- struct som_data_struct *som_data;
- struct hpux_core_struct *hpux_core_data;
- struct hppabsd_core_struct *hppabsd_core_data;
- struct sgi_core_struct *sgi_core_data;
- struct lynx_core_struct *lynx_core_data;
- struct osf_core_struct *osf_core_data;
- struct cisco_core_struct *cisco_core_data;
- struct versados_data_struct *versados_data;
- struct netbsd_core_struct *netbsd_core_data;
- struct mach_o_data_struct *mach_o_data;
- struct mach_o_fat_data_struct *mach_o_fat_data;
- struct bfd_pef_data_struct *pef_data;
- struct bfd_pef_xlib_data_struct *pef_xlib_data;
- struct bfd_sym_data_struct *sym_data;
- void *any;
- }
- tdata;
-
- /* Used by the application to hold private data. */
- void *usrdata;
-
- /* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use void * to avoid requiring the inclusion
- of objalloc.h. */
- void *memory;
-};
-
-typedef enum bfd_error
-{
- bfd_error_no_error = 0,
- bfd_error_system_call,
- bfd_error_invalid_target,
- bfd_error_wrong_format,
- bfd_error_wrong_object_format,
- bfd_error_invalid_operation,
- bfd_error_no_memory,
- bfd_error_no_symbols,
- bfd_error_no_armap,
- bfd_error_no_more_archived_files,
- bfd_error_malformed_archive,
- bfd_error_file_not_recognized,
- bfd_error_file_ambiguously_recognized,
- bfd_error_no_contents,
- bfd_error_nonrepresentable_section,
- bfd_error_no_debug_section,
- bfd_error_bad_value,
- bfd_error_file_truncated,
- bfd_error_file_too_big,
- bfd_error_invalid_error_code
-}
-bfd_error_type;
-
-bfd_error_type bfd_get_error (void);
-
-void bfd_set_error (bfd_error_type error_tag);
-
-const char *bfd_errmsg (bfd_error_type error_tag);
-
-void bfd_perror (const char *message);
-
-typedef void (*bfd_error_handler_type) (const char *, ...);
-
-bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-
-void bfd_set_error_program_name (const char *);
-
-bfd_error_handler_type bfd_get_error_handler (void);
-
-const char *bfd_archive_filename (bfd *);
-
-long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-
-long bfd_canonicalize_reloc
- (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-
-void bfd_set_reloc
- (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-
-bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
-
-int bfd_get_arch_size (bfd *abfd);
-
-int bfd_get_sign_extend_vma (bfd *abfd);
-
-bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
-
-unsigned int bfd_get_gp_size (bfd *abfd);
-
-void bfd_set_gp_size (bfd *abfd, unsigned int i);
-
-bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-
-bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
-
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
-bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
-
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
- (ibfd, obfd))
-bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
-
-#define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
- BFD_SEND (abfd, _bfd_find_nearest_line, \
- (abfd, sec, syms, off, file, func, line))
-
-#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-#define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
- BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
- BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_gc_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
-#define bfd_merge_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-
-#define bfd_discard_group(abfd, sec) \
- BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
-#define bfd_link_hash_table_create(abfd) \
- BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_hash_table_free(abfd, hash) \
- BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-
-#define bfd_link_add_symbols(abfd, info) \
- BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_link_just_syms(sec, info) \
- BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
-#define bfd_final_link(abfd, info) \
- BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
- BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
- BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
- bfd_boolean, asymbol **);
-
-bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
-
-struct bfd_preserve
-{
- void *marker;
- void *tdata;
- flagword flags;
- const struct bfd_arch_info *arch_info;
- struct bfd_section *sections;
- struct bfd_section **section_tail;
- unsigned int section_count;
- struct bfd_hash_table section_htab;
-};
-
-bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-
-void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-
-void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-
-/* Extracted from archive.c. */
-symindex bfd_get_next_mapent
- (bfd *abfd, symindex previous, carsym **sym);
-
-bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
-
-bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-
-/* Extracted from corefile.c. */
-const char *bfd_core_file_failing_command (bfd *abfd);
-
-int bfd_core_file_failing_signal (bfd *abfd);
-
-bfd_boolean core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
-
-/* Extracted from targets.c. */
-#define BFD_SEND(bfd, message, arglist) \
- ((*((bfd)->xvec->message)) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND
-#define BFD_SEND(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- ((*((bfd)->xvec->message)) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND_FMT
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-
-enum bfd_flavour
-{
- bfd_target_unknown_flavour,
- bfd_target_aout_flavour,
- bfd_target_coff_flavour,
- bfd_target_ecoff_flavour,
- bfd_target_xcoff_flavour,
- bfd_target_elf_flavour,
- bfd_target_ieee_flavour,
- bfd_target_nlm_flavour,
- bfd_target_oasys_flavour,
- bfd_target_tekhex_flavour,
- bfd_target_srec_flavour,
- bfd_target_ihex_flavour,
- bfd_target_som_flavour,
- bfd_target_os9k_flavour,
- bfd_target_versados_flavour,
- bfd_target_msdos_flavour,
- bfd_target_ovax_flavour,
- bfd_target_evax_flavour,
- bfd_target_mmo_flavour,
- bfd_target_mach_o_flavour,
- bfd_target_pef_flavour,
- bfd_target_pef_xlib_flavour,
- bfd_target_sym_flavour
-};
-
-enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-
-/* Forward declaration. */
-typedef struct bfd_link_info _bfd_link_info;
-
-typedef struct bfd_target
-{
- /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
- char *name;
-
- /* The "flavour" of a back end is a general indication about
- the contents of a file. */
- enum bfd_flavour flavour;
-
- /* The order of bytes within the data area of a file. */
- enum bfd_endian byteorder;
-
- /* The order of bytes within the header parts of a file. */
- enum bfd_endian header_byteorder;
-
- /* A mask of all the flags which an executable may have set -
- from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>. */
- flagword object_flags;
-
- /* A mask of all the flags which a section may have set - from
- the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>. */
- flagword section_flags;
-
- /* The character normally found at the front of a symbol.
- (if any), perhaps `_'. */
- char symbol_leading_char;
-
- /* The pad character for file names within an archive header. */
- char ar_pad_char;
-
- /* The maximum number of characters in an archive header. */
- unsigned short ar_max_namelen;
-
- /* Entries for byte swapping for data. These are different from the
- other entry points, since they don't take a BFD asthe first argument.
- Certain other handlers could do the same. */
- bfd_uint64_t (*bfd_getx64) (const void *);
- bfd_int64_t (*bfd_getx_signed_64) (const void *);
- void (*bfd_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_getx32) (const void *);
- bfd_signed_vma (*bfd_getx_signed_32) (const void *);
- void (*bfd_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_getx16) (const void *);
- bfd_signed_vma (*bfd_getx_signed_16) (const void *);
- void (*bfd_putx16) (bfd_vma, void *);
-
- /* Byte swapping for the headers. */
- bfd_uint64_t (*bfd_h_getx64) (const void *);
- bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
- void (*bfd_h_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_h_getx32) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
- void (*bfd_h_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_h_getx16) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
- void (*bfd_h_putx16) (bfd_vma, void *);
-
- /* Format dependent routines: these are vectors of entry points
- within the target vector structure, one for each format to check. */
-
- /* Check the format of a file being read. Return a <<bfd_target *>> or zero. */
- const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
-
- /* Set the format of a file being written. */
- bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
-
- /* Write cached information into a file being written, at <<bfd_close>>. */
- bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
-
-
- /* Generic entry points. */
-#define BFD_JUMP_TABLE_GENERIC(NAME) \
- NAME##_close_and_cleanup, \
- NAME##_bfd_free_cached_info, \
- NAME##_new_section_hook, \
- NAME##_get_section_contents, \
- NAME##_get_section_contents_in_window
-
- /* Called when the BFD is being closed to do any necessary cleanup. */
- bfd_boolean (*_close_and_cleanup) (bfd *);
- /* Ask the BFD to free all cached information. */
- bfd_boolean (*_bfd_free_cached_info) (bfd *);
- /* Called when a new section is created. */
- bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
- /* Read the contents of a section. */
- bfd_boolean (*_bfd_get_section_contents)
- (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
- bfd_boolean (*_bfd_get_section_contents_in_window)
- (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
-
- /* Entry points to copy private data. */
-#define BFD_JUMP_TABLE_COPY(NAME) \
- NAME##_bfd_copy_private_bfd_data, \
- NAME##_bfd_merge_private_bfd_data, \
- NAME##_bfd_copy_private_section_data, \
- NAME##_bfd_copy_private_symbol_data, \
- NAME##_bfd_set_private_flags, \
- NAME##_bfd_print_private_bfd_data
-
- /* Called to copy BFD general private data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
- /* Called to merge BFD general private data from one object file
- to a common output file when linking. */
- bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
- /* Called to copy BFD private section data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_section_data)
- (bfd *, sec_ptr, bfd *, sec_ptr);
- /* Called to copy BFD private symbol data from one symbol
- to another. */
- bfd_boolean (*_bfd_copy_private_symbol_data)
- (bfd *, asymbol *, bfd *, asymbol *);
- /* Called to set private backend flags. */
- bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
-
- /* Called to print private BFD data. */
- bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
-
- /* Core file entry points. */
-#define BFD_JUMP_TABLE_CORE(NAME) \
- NAME##_core_file_failing_command, \
- NAME##_core_file_failing_signal, \
- NAME##_core_file_matches_executable_p
-
- char * (*_core_file_failing_command) (bfd *);
- int (*_core_file_failing_signal) (bfd *);
- bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
-
- /* Archive entry points. */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
- NAME##_slurp_armap, \
- NAME##_slurp_extended_name_table, \
- NAME##_construct_extended_name_table, \
- NAME##_truncate_arname, \
- NAME##_write_armap, \
- NAME##_read_ar_hdr, \
- NAME##_openr_next_archived_file, \
- NAME##_get_elt_at_index, \
- NAME##_generic_stat_arch_elt, \
- NAME##_update_armap_timestamp
-
- bfd_boolean (*_bfd_slurp_armap) (bfd *);
- bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
- bfd_boolean (*_bfd_construct_extended_name_table)
- (bfd *, char **, bfd_size_type *, const char **);
- void (*_bfd_truncate_arname) (bfd *, const char *, char *);
- bfd_boolean (*write_armap)
- (bfd *, unsigned int, struct orl *, unsigned int, int);
- void * (*_bfd_read_ar_hdr_fn) (bfd *);
- bfd * (*openr_next_archived_file) (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) (bfd *, symindex);
- int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
- bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
-
- /* Entry points used for symbols. */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
- NAME##_get_symtab_upper_bound, \
- NAME##_canonicalize_symtab, \
- NAME##_make_empty_symbol, \
- NAME##_print_symbol, \
- NAME##_get_symbol_info, \
- NAME##_bfd_is_local_label_name, \
- NAME##_get_lineno, \
- NAME##_find_nearest_line, \
- NAME##_bfd_make_debug_symbol, \
- NAME##_read_minisymbols, \
- NAME##_minisymbol_to_symbol
-
- long (*_bfd_get_symtab_upper_bound) (bfd *);
- long (*_bfd_canonicalize_symtab)
- (bfd *, struct bfd_symbol **);
- struct bfd_symbol *
- (*_bfd_make_empty_symbol) (bfd *);
- void (*_bfd_print_symbol)
- (bfd *, void *, struct bfd_symbol *, 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)
- (bfd *, struct bfd_symbol *, symbol_info *);
-#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
- bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
-
- alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
- bfd_boolean (*_bfd_find_nearest_line)
- (bfd *, struct bfd_section *, struct bfd_symbol **, 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)
- (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)
- (bfd *, bfd_boolean, void **, 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)
- (bfd *, bfd_boolean, const void *, asymbol *);
-
- /* Routines for relocs. */
-#define BFD_JUMP_TABLE_RELOCS(NAME) \
- NAME##_get_reloc_upper_bound, \
- NAME##_canonicalize_reloc, \
- NAME##_bfd_reloc_type_lookup
-
- long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
- long (*_bfd_canonicalize_reloc)
- (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
- /* See documentation on reloc types. */
- reloc_howto_type *
- (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
-
- /* Routines used when writing an object file. */
-#define BFD_JUMP_TABLE_WRITE(NAME) \
- NAME##_set_arch_mach, \
- NAME##_set_section_contents
-
- bfd_boolean (*_bfd_set_arch_mach)
- (bfd *, enum bfd_architecture, unsigned long);
- bfd_boolean (*_bfd_set_section_contents)
- (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-
- /* Routines used by the linker. */
-#define BFD_JUMP_TABLE_LINK(NAME) \
- NAME##_sizeof_headers, \
- NAME##_bfd_get_relocated_section_contents, \
- NAME##_bfd_relax_section, \
- NAME##_bfd_link_hash_table_create, \
- NAME##_bfd_link_hash_table_free, \
- NAME##_bfd_link_add_symbols, \
- NAME##_bfd_link_just_syms, \
- NAME##_bfd_final_link, \
- NAME##_bfd_link_split_section, \
- NAME##_bfd_gc_sections, \
- NAME##_bfd_merge_sections, \
- NAME##_bfd_discard_group
-
- int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
- bfd_byte * (*_bfd_get_relocated_section_contents)
- (bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, struct bfd_symbol **);
-
- bfd_boolean (*_bfd_relax_section)
- (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_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) (bfd *);
-
- /* Release the memory associated with the linker hash table. */
- void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
-
- /* Add symbols from this object file into the hash table. */
- bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
-
- /* Indicate that we are only retrieving symbol values from this section. */
- void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
-
- /* Do a link based on the link_order structures attached to each
- section of the BFD. */
- bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
-
- /* Should this section be split up into smaller pieces during linking. */
- bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
-
- /* Remove sections that are not referenced from the output. */
- bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
-
- /* Attempt to merge SEC_MERGE sections. */
- bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
-
- /* Discard members of a group. */
- bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
-
- /* Routines to handle dynamic symbols and relocs. */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
- NAME##_get_dynamic_symtab_upper_bound, \
- NAME##_canonicalize_dynamic_symtab, \
- NAME##_get_dynamic_reloc_upper_bound, \
- NAME##_canonicalize_dynamic_reloc
-
- /* Get the amount of memory required to hold the dynamic symbols. */
- long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
- /* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
- (bfd *, struct bfd_symbol **);
- /* Get the amount of memory required to hold the dynamic relocs. */
- long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
- /* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
- (bfd *, arelent **, struct bfd_symbol **);
-
- /* Opposite endian version of this target. */
- const struct bfd_target * alternative_target;
-
- /* Data for use by back-end routines, which isn't
- generic enough to belong in this structure. */
- const void *backend_data;
-
-} bfd_target;
-
-bfd_boolean bfd_set_default_target (const char *name);
-
-const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
-
-const char ** bfd_target_list (void);
-
-const bfd_target *bfd_search_for_target
- (int (*search_func) (const bfd_target *, void *),
- void *);
-
-/* Extracted from format.c. */
-bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
-
-bfd_boolean bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
-
-bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
-
-const char *bfd_format_string (bfd_format format);
-
-/* Extracted from linker.c. */
-bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
-
-#define bfd_link_split_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-/* Extracted from simple.c. */
-bfd_byte *bfd_simple_get_relocated_section_contents
- (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/contrib/binutils/bfd/bfd.c b/contrib/binutils/bfd/bfd.c
deleted file mode 100644
index 59e22aa..0000000
--- a/contrib/binutils/bfd/bfd.c
+++ /dev/null
@@ -1,1392 +0,0 @@
-/* Generic BFD library interface and support routines.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- <<typedef bfd>>
-
- A BFD has type <<bfd>>; objects of this type are the
- cornerstone of any application using BFD. Using BFD
- consists of making references though the BFD and to data in the BFD.
-
- Here is the structure that defines the type <<bfd>>. It
- contains the major data about the file and pointers
- to the rest of the data.
-
-CODE_FRAGMENT
-.
-.struct bfd
-.{
-. {* A unique identifier of the BFD *}
-. unsigned int id;
-.
-. {* The filename the application opened the BFD with. *}
-. const char *filename;
-.
-. {* A pointer to the target jump table. *}
-. const struct bfd_target *xvec;
-.
-. {* To avoid dragging too many header files into every file that
-. includes `<<bfd.h>>', IOSTREAM has been declared as a "char *",
-. and MTIME as a "long". Their correct types, to which they
-. are cast when used, are "FILE *" and "time_t". The iostream
-. is the result of an fopen on the filename. However, if the
-. BFD_IN_MEMORY flag is set, then iostream is actually a pointer
-. to a bfd_in_memory struct. *}
-. void *iostream;
-.
-. {* Is the file descriptor being cached? That is, can it be closed as
-. needed, and re-opened when accessed later? *}
-. bfd_boolean cacheable;
-.
-. {* Marks whether there was a default target specified when the
-. BFD was opened. This is used to select which matching algorithm
-. to use to choose the back end. *}
-. bfd_boolean target_defaulted;
-.
-. {* The caching routines use these to maintain a
-. least-recently-used list of BFDs. *}
-. struct bfd *lru_prev, *lru_next;
-.
-. {* When a file is closed by the caching routines, BFD retains
-. state information on the file here... *}
-. ufile_ptr where;
-.
-. {* ... and here: (``once'' means at least once). *}
-. bfd_boolean opened_once;
-.
-. {* Set if we have a locally maintained mtime value, rather than
-. getting it from the file each time. *}
-. bfd_boolean mtime_set;
-.
-. {* File modified time, if mtime_set is TRUE. *}
-. long mtime;
-.
-. {* Reserved for an unimplemented file locking extension. *}
-. int ifd;
-.
-. {* The format which belongs to the BFD. (object, core, etc.) *}
-. bfd_format format;
-.
-. {* The direction with which the BFD was opened. *}
-. enum bfd_direction
-. {
-. no_direction = 0,
-. read_direction = 1,
-. write_direction = 2,
-. both_direction = 3
-. }
-. direction;
-.
-. {* Format_specific flags. *}
-. flagword flags;
-.
-. {* Currently my_archive is tested before adding origin to
-. anything. I believe that this can become always an add of
-. origin, with origin set to 0 for non archive files. *}
-. ufile_ptr origin;
-.
-. {* Remember when output has begun, to stop strange things
-. from happening. *}
-. bfd_boolean output_has_begun;
-.
-. {* A hash table for section names. *}
-. struct bfd_hash_table section_htab;
-.
-. {* Pointer to linked list of sections. *}
-. struct bfd_section *sections;
-.
-. {* The place where we add to the section list. *}
-. struct bfd_section **section_tail;
-.
-. {* The number of sections. *}
-. unsigned int section_count;
-.
-. {* Stuff only useful for object files:
-. The start address. *}
-. bfd_vma start_address;
-.
-. {* Used for input and output. *}
-. unsigned int symcount;
-.
-. {* Symbol table for output BFD (with symcount entries). *}
-. struct bfd_symbol **outsymbols;
-.
-. {* Used for slurped dynamic symbol tables. *}
-. unsigned int dynsymcount;
-.
-. {* Pointer to structure which contains architecture information. *}
-. const struct bfd_arch_info *arch_info;
-.
-. {* Stuff only useful for archives. *}
-. void *arelt_data;
-. struct bfd *my_archive; {* The containing archive BFD. *}
-. struct bfd *next; {* The next BFD in the archive. *}
-. struct bfd *archive_head; {* The first BFD in the archive. *}
-. bfd_boolean has_armap;
-.
-. {* A chain of BFD structures involved in a link. *}
-. struct bfd *link_next;
-.
-. {* A field used by _bfd_generic_link_add_archive_symbols. This will
-. be used only for archive elements. *}
-. int archive_pass;
-.
-. {* Used by the back end to hold private data. *}
-. union
-. {
-. struct aout_data_struct *aout_data;
-. struct artdata *aout_ar_data;
-. struct _oasys_data *oasys_obj_data;
-. struct _oasys_ar_data *oasys_ar_data;
-. struct coff_tdata *coff_obj_data;
-. struct pe_tdata *pe_obj_data;
-. struct xcoff_tdata *xcoff_obj_data;
-. struct ecoff_tdata *ecoff_obj_data;
-. struct ieee_data_struct *ieee_data;
-. struct ieee_ar_data_struct *ieee_ar_data;
-. struct srec_data_struct *srec_data;
-. struct ihex_data_struct *ihex_data;
-. struct tekhex_data_struct *tekhex_data;
-. struct elf_obj_tdata *elf_obj_data;
-. struct nlm_obj_tdata *nlm_obj_data;
-. struct bout_data_struct *bout_data;
-. struct mmo_data_struct *mmo_data;
-. struct sun_core_struct *sun_core_data;
-. struct sco5_core_struct *sco5_core_data;
-. struct trad_core_struct *trad_core_data;
-. struct som_data_struct *som_data;
-. struct hpux_core_struct *hpux_core_data;
-. struct hppabsd_core_struct *hppabsd_core_data;
-. struct sgi_core_struct *sgi_core_data;
-. struct lynx_core_struct *lynx_core_data;
-. struct osf_core_struct *osf_core_data;
-. struct cisco_core_struct *cisco_core_data;
-. struct versados_data_struct *versados_data;
-. struct netbsd_core_struct *netbsd_core_data;
-. struct mach_o_data_struct *mach_o_data;
-. struct mach_o_fat_data_struct *mach_o_fat_data;
-. struct bfd_pef_data_struct *pef_data;
-. struct bfd_pef_xlib_data_struct *pef_xlib_data;
-. struct bfd_sym_data_struct *sym_data;
-. void *any;
-. }
-. tdata;
-.
-. {* Used by the application to hold private data. *}
-. void *usrdata;
-.
-. {* Where all the allocated stuff under this BFD goes. This is a
-. struct objalloc *, but we use void * to avoid requiring the inclusion
-. of objalloc.h. *}
-. void *memory;
-.};
-.
-*/
-
-#include "bfd.h"
-#include "bfdver.h"
-#include "sysdep.h"
-#include <stdarg.h>
-#include "libiberty.h"
-#include "safe-ctype.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "coff/sym.h"
-#include "libcoff.h"
-#include "libecoff.h"
-#undef obj_symbols
-#include "elf-bfd.h"
-
-/* provide storage for subsystem, stack and heap data which may have been
- passed in on the command line. Ld puts this data into a bfd_link_info
- struct which ultimately gets passed in to the bfd. When it arrives, copy
- it to the following struct so that the data will be available in coffcode.h
- where it is needed. The typedef's used are defined in bfd.h */
-
-/*
-SECTION
- Error reporting
-
- Most BFD functions return nonzero on success (check their
- individual documentation for precise semantics). On an error,
- they call <<bfd_set_error>> to set an error condition that callers
- can check by calling <<bfd_get_error>>.
- If that returns <<bfd_error_system_call>>, then check
- <<errno>>.
-
- The easiest way to report a BFD error to the user is to
- use <<bfd_perror>>.
-
-SUBSECTION
- Type <<bfd_error_type>>
-
- The values returned by <<bfd_get_error>> are defined by the
- enumerated type <<bfd_error_type>>.
-
-CODE_FRAGMENT
-.
-.typedef enum bfd_error
-.{
-. bfd_error_no_error = 0,
-. bfd_error_system_call,
-. bfd_error_invalid_target,
-. bfd_error_wrong_format,
-. bfd_error_wrong_object_format,
-. bfd_error_invalid_operation,
-. bfd_error_no_memory,
-. bfd_error_no_symbols,
-. bfd_error_no_armap,
-. bfd_error_no_more_archived_files,
-. bfd_error_malformed_archive,
-. bfd_error_file_not_recognized,
-. bfd_error_file_ambiguously_recognized,
-. bfd_error_no_contents,
-. bfd_error_nonrepresentable_section,
-. bfd_error_no_debug_section,
-. bfd_error_bad_value,
-. bfd_error_file_truncated,
-. bfd_error_file_too_big,
-. bfd_error_invalid_error_code
-.}
-.bfd_error_type;
-.
-*/
-
-static bfd_error_type bfd_error = bfd_error_no_error;
-
-const char *const bfd_errmsgs[] =
-{
- N_("No error"),
- N_("System call error"),
- N_("Invalid bfd target"),
- N_("File in wrong format"),
- N_("Archive object file in wrong format"),
- N_("Invalid operation"),
- N_("Memory exhausted"),
- N_("No symbols"),
- N_("Archive has no index; run ranlib to add one"),
- N_("No more archived files"),
- N_("Malformed archive"),
- N_("File format not recognized"),
- N_("File format is ambiguous"),
- N_("Section has no contents"),
- N_("Nonrepresentable section on output"),
- N_("Symbol needs debug section which does not exist"),
- N_("Bad value"),
- N_("File truncated"),
- N_("File too big"),
- N_("#<Invalid error code>")
-};
-
-/*
-FUNCTION
- bfd_get_error
-
-SYNOPSIS
- bfd_error_type bfd_get_error (void);
-
-DESCRIPTION
- Return the current BFD error condition.
-*/
-
-bfd_error_type
-bfd_get_error (void)
-{
- return bfd_error;
-}
-
-/*
-FUNCTION
- bfd_set_error
-
-SYNOPSIS
- void bfd_set_error (bfd_error_type error_tag);
-
-DESCRIPTION
- Set the BFD error condition to be @var{error_tag}.
-*/
-
-void
-bfd_set_error (bfd_error_type error_tag)
-{
- bfd_error = error_tag;
-}
-
-/*
-FUNCTION
- bfd_errmsg
-
-SYNOPSIS
- const char *bfd_errmsg (bfd_error_type error_tag);
-
-DESCRIPTION
- Return a string describing the error @var{error_tag}, or
- the system error if @var{error_tag} is <<bfd_error_system_call>>.
-*/
-
-const char *
-bfd_errmsg (bfd_error_type error_tag)
-{
-#ifndef errno
- extern int errno;
-#endif
- if (error_tag == bfd_error_system_call)
- return xstrerror (errno);
-
- if (error_tag > bfd_error_invalid_error_code)
- error_tag = bfd_error_invalid_error_code; /* sanity check */
-
- return _(bfd_errmsgs [error_tag]);
-}
-
-/*
-FUNCTION
- bfd_perror
-
-SYNOPSIS
- void bfd_perror (const char *message);
-
-DESCRIPTION
- Print to the standard error stream a string describing the
- last BFD error that occurred, or the last system error if
- the last BFD error was a system call failure. If @var{message}
- is non-NULL and non-empty, the error string printed is preceded
- by @var{message}, a colon, and a space. It is followed by a newline.
-*/
-
-void
-bfd_perror (const char *message)
-{
- if (bfd_get_error () == bfd_error_system_call)
- /* Must be a system error then. */
- perror ((char *) message);
- else
- {
- if (message == NULL || *message == '\0')
- fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
- else
- fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
- }
-}
-
-/*
-SUBSECTION
- BFD error handler
-
- Some BFD functions want to print messages describing the
- problem. They call a BFD error handler function. This
- function may be overridden by the program.
-
- The BFD error handler acts like printf.
-
-CODE_FRAGMENT
-.
-.typedef void (*bfd_error_handler_type) (const char *, ...);
-.
-*/
-
-/* The program name used when printing BFD error messages. */
-
-static const char *_bfd_error_program_name;
-
-/* This is the default routine to handle BFD error messages. */
-
-static void
-_bfd_default_error_handler (const char *s, ...)
-{
- va_list p;
-
- if (_bfd_error_program_name != NULL)
- fprintf (stderr, "%s: ", _bfd_error_program_name);
- else
- fprintf (stderr, "BFD: ");
-
- va_start (p, s);
- vfprintf (stderr, s, p);
- va_end (p);
-
- fprintf (stderr, "\n");
-}
-
-/* This is a function pointer to the routine which should handle BFD
- error messages. It is called when a BFD routine encounters an
- error for which it wants to print a message. Going through a
- function pointer permits a program linked against BFD to intercept
- the messages and deal with them itself. */
-
-bfd_error_handler_type _bfd_error_handler = _bfd_default_error_handler;
-
-/*
-FUNCTION
- bfd_set_error_handler
-
-SYNOPSIS
- bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-
-DESCRIPTION
- Set the BFD error handler function. Returns the previous
- function.
-*/
-
-bfd_error_handler_type
-bfd_set_error_handler (bfd_error_handler_type pnew)
-{
- bfd_error_handler_type pold;
-
- pold = _bfd_error_handler;
- _bfd_error_handler = pnew;
- return pold;
-}
-
-/*
-FUNCTION
- bfd_set_error_program_name
-
-SYNOPSIS
- void bfd_set_error_program_name (const char *);
-
-DESCRIPTION
- Set the program name to use when printing a BFD error. This
- is printed before the error message followed by a colon and
- space. The string must not be changed after it is passed to
- this function.
-*/
-
-void
-bfd_set_error_program_name (const char *name)
-{
- _bfd_error_program_name = name;
-}
-
-/*
-FUNCTION
- bfd_get_error_handler
-
-SYNOPSIS
- bfd_error_handler_type bfd_get_error_handler (void);
-
-DESCRIPTION
- Return the BFD error handler function.
-*/
-
-bfd_error_handler_type
-bfd_get_error_handler (void)
-{
- return _bfd_error_handler;
-}
-
-/*
-FUNCTION
- bfd_archive_filename
-
-SYNOPSIS
- const char *bfd_archive_filename (bfd *);
-
-DESCRIPTION
- For a BFD that is a component of an archive, returns a string
- with both the archive name and file name. For other BFDs, just
- returns the file name.
-*/
-
-const char *
-bfd_archive_filename (bfd *abfd)
-{
- if (abfd == NULL)
- return _("<unknown>");
-
- if (abfd->my_archive)
- {
- static size_t curr = 0;
- static char *buf;
- size_t needed;
-
- needed = (strlen (bfd_get_filename (abfd->my_archive))
- + strlen (bfd_get_filename (abfd)) + 3);
- if (needed > curr)
- {
- if (curr)
- free (buf);
- curr = needed + (needed >> 1);
- buf = bfd_malloc (curr);
- /* If we can't malloc, fail safe by returning just the file
- name. This function is only used when building error
- messages. */
- if (!buf)
- {
- curr = 0;
- return bfd_get_filename (abfd);
- }
- }
- sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive),
- bfd_get_filename (abfd));
- return buf;
- }
- else
- return bfd_get_filename (abfd);
-}
-
-/*
-SECTION
- Symbols
-*/
-
-/*
-FUNCTION
- bfd_get_reloc_upper_bound
-
-SYNOPSIS
- long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-
-DESCRIPTION
- Return the number of bytes required to store the
- relocation information associated with section @var{sect}
- attached to bfd @var{abfd}. If an error occurs, return -1.
-
-*/
-
-long
-bfd_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
-{
- if (abfd->format != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect));
-}
-
-/*
-FUNCTION
- bfd_canonicalize_reloc
-
-SYNOPSIS
- long bfd_canonicalize_reloc
- (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-
-DESCRIPTION
- Call the back end associated with the open BFD
- @var{abfd} and translate the external form of the relocation
- information attached to @var{sec} into the internal canonical
- form. Place the table into memory at @var{loc}, which has
- been preallocated, usually by a call to
- <<bfd_get_reloc_upper_bound>>. Returns the number of relocs, or
- -1 on error.
-
- The @var{syms} table is also needed for horrible internal magic
- reasons.
-
-*/
-long
-bfd_canonicalize_reloc (bfd *abfd,
- sec_ptr asect,
- arelent **location,
- asymbol **symbols)
-{
- if (abfd->format != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- return BFD_SEND (abfd, _bfd_canonicalize_reloc,
- (abfd, asect, location, symbols));
-}
-
-/*
-FUNCTION
- bfd_set_reloc
-
-SYNOPSIS
- void bfd_set_reloc
- (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-
-DESCRIPTION
- Set the relocation pointer and count within
- section @var{sec} to the values @var{rel} and @var{count}.
- The argument @var{abfd} is ignored.
-
-*/
-
-void
-bfd_set_reloc (bfd *ignore_abfd ATTRIBUTE_UNUSED,
- sec_ptr asect,
- arelent **location,
- unsigned int count)
-{
- asect->orelocation = location;
- asect->reloc_count = count;
-}
-
-/*
-FUNCTION
- bfd_set_file_flags
-
-SYNOPSIS
- bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
-
-DESCRIPTION
- Set the flag word in the BFD @var{abfd} to the value @var{flags}.
-
- Possible errors are:
- o <<bfd_error_wrong_format>> - The target bfd was not of object format.
- o <<bfd_error_invalid_operation>> - The target bfd was open for reading.
- o <<bfd_error_invalid_operation>> -
- The flag word contained a bit which was not applicable to the
- type of file. E.g., an attempt was made to set the <<D_PAGED>> bit
- on a BFD format which does not support demand paging.
-
-*/
-
-bfd_boolean
-bfd_set_file_flags (bfd *abfd, flagword flags)
-{
- if (abfd->format != bfd_object)
- {
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- if (bfd_read_p (abfd))
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- bfd_get_file_flags (abfd) = flags;
- if ((flags & bfd_applicable_file_flags (abfd)) != flags)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-bfd_assert (const char *file, int line)
-{
- (*_bfd_error_handler) (_("BFD %s assertion fail %s:%d"),
- BFD_VERSION_STRING, file, line);
-}
-
-/* A more or less friendly abort message. In libbfd.h abort is
- defined to call this function. */
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif
-
-void
-_bfd_abort (const char *file, int line, const char *fn)
-{
- if (fn != NULL)
- (*_bfd_error_handler)
- (_("BFD %s internal error, aborting at %s line %d in %s\n"),
- BFD_VERSION_STRING, file, line, fn);
- else
- (*_bfd_error_handler)
- (_("BFD %s internal error, aborting at %s line %d\n"),
- BFD_VERSION_STRING, file, line);
- (*_bfd_error_handler) (_("Please report this bug.\n"));
- xexit (EXIT_FAILURE);
-}
-
-/*
-FUNCTION
- bfd_get_arch_size
-
-SYNOPSIS
- int bfd_get_arch_size (bfd *abfd);
-
-DESCRIPTION
- Returns the architecture address size, in bits, as determined
- by the object file's format. For ELF, this information is
- included in the header.
-
-RETURNS
- Returns the arch size in bits if known, <<-1>> otherwise.
-*/
-
-int
-bfd_get_arch_size (bfd *abfd)
-{
- if (abfd->xvec->flavour == bfd_target_elf_flavour)
- return get_elf_backend_data (abfd)->s->arch_size;
-
- return -1;
-}
-
-/*
-FUNCTION
- bfd_get_sign_extend_vma
-
-SYNOPSIS
- int bfd_get_sign_extend_vma (bfd *abfd);
-
-DESCRIPTION
- Indicates if the target architecture "naturally" sign extends
- an address. Some architectures implicitly sign extend address
- values when they are converted to types larger than the size
- of an address. For instance, bfd_get_start_address() will
- return an address sign extended to fill a bfd_vma when this is
- the case.
-
-RETURNS
- Returns <<1>> if the target architecture is known to sign
- extend addresses, <<0>> if the target architecture is known to
- not sign extend addresses, and <<-1>> otherwise.
-*/
-
-int
-bfd_get_sign_extend_vma (bfd *abfd)
-{
- char *name;
-
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
- return get_elf_backend_data (abfd)->sign_extend_vma;
-
- name = bfd_get_target (abfd);
-
- /* Return a proper value for DJGPP COFF (an x86 COFF variant).
- This function is required for DWARF2 support, but there is
- no place to store this information in the COFF back end.
- Should enough other COFF targets add support for DWARF2,
- a place will have to be found. Until then, this hack will do. */
- if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0)
- return 1;
-
- bfd_set_error (bfd_error_wrong_format);
- return -1;
-}
-
-/*
-FUNCTION
- bfd_set_start_address
-
-SYNOPSIS
- bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
-
-DESCRIPTION
- Make @var{vma} the entry point of output BFD @var{abfd}.
-
-RETURNS
- Returns <<TRUE>> on success, <<FALSE>> otherwise.
-*/
-
-bfd_boolean
-bfd_set_start_address (bfd *abfd, bfd_vma vma)
-{
- abfd->start_address = vma;
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_get_gp_size
-
-SYNOPSIS
- unsigned int bfd_get_gp_size (bfd *abfd);
-
-DESCRIPTION
- Return the maximum size of objects to be optimized using the GP
- register under MIPS ECOFF. This is typically set by the <<-G>>
- argument to the compiler, assembler or linker.
-*/
-
-unsigned int
-bfd_get_gp_size (bfd *abfd)
-{
- if (abfd->format == bfd_object)
- {
- if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
- return ecoff_data (abfd)->gp_size;
- else if (abfd->xvec->flavour == bfd_target_elf_flavour)
- return elf_gp_size (abfd);
- }
- return 0;
-}
-
-/*
-FUNCTION
- bfd_set_gp_size
-
-SYNOPSIS
- void bfd_set_gp_size (bfd *abfd, unsigned int i);
-
-DESCRIPTION
- Set the maximum size of objects to be optimized using the GP
- register under ECOFF or MIPS ELF. This is typically set by
- the <<-G>> argument to the compiler, assembler or linker.
-*/
-
-void
-bfd_set_gp_size (bfd *abfd, unsigned int i)
-{
- /* Don't try to set GP size on an archive or core file! */
- if (abfd->format != bfd_object)
- return;
-
- if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
- ecoff_data (abfd)->gp_size = i;
- else if (abfd->xvec->flavour == bfd_target_elf_flavour)
- elf_gp_size (abfd) = i;
-}
-
-/* Get the GP value. This is an internal function used by some of the
- relocation special_function routines on targets which support a GP
- register. */
-
-bfd_vma
-_bfd_get_gp_value (bfd *abfd)
-{
- if (! abfd)
- return 0;
- if (abfd->format != bfd_object)
- return 0;
-
- if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
- return ecoff_data (abfd)->gp;
- else if (abfd->xvec->flavour == bfd_target_elf_flavour)
- return elf_gp (abfd);
-
- return 0;
-}
-
-/* Set the GP value. */
-
-void
-_bfd_set_gp_value (bfd *abfd, bfd_vma v)
-{
- if (! abfd)
- BFD_FAIL ();
- if (abfd->format != bfd_object)
- return;
-
- if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
- ecoff_data (abfd)->gp = v;
- else if (abfd->xvec->flavour == bfd_target_elf_flavour)
- elf_gp (abfd) = v;
-}
-
-/*
-FUNCTION
- bfd_scan_vma
-
-SYNOPSIS
- bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-
-DESCRIPTION
- Convert, like <<strtoul>>, a numerical expression
- @var{string} into a <<bfd_vma>> integer, and return that integer.
- (Though without as many bells and whistles as <<strtoul>>.)
- The expression is assumed to be unsigned (i.e., positive).
- If given a @var{base}, it is used as the base for conversion.
- A base of 0 causes the function to interpret the string
- in hex if a leading "0x" or "0X" is found, otherwise
- in octal if a leading zero is found, otherwise in decimal.
-
- If the value would overflow, the maximum <<bfd_vma>> value is
- returned.
-*/
-
-bfd_vma
-bfd_scan_vma (const char *string, const char **end, int base)
-{
- bfd_vma value;
- bfd_vma cutoff;
- unsigned int cutlim;
- int overflow;
-
- /* Let the host do it if possible. */
- if (sizeof (bfd_vma) <= sizeof (unsigned long))
- return strtoul (string, (char **) end, base);
-
-#ifdef HAVE_STRTOULL
- if (sizeof (bfd_vma) <= sizeof (unsigned long long))
- return strtoull (string, (char **) end, base);
-#endif
-
- if (base == 0)
- {
- if (string[0] == '0')
- {
- if ((string[1] == 'x') || (string[1] == 'X'))
- base = 16;
- else
- base = 8;
- }
- }
-
- if ((base < 2) || (base > 36))
- base = 10;
-
- if (base == 16
- && string[0] == '0'
- && (string[1] == 'x' || string[1] == 'X')
- && ISXDIGIT (string[2]))
- {
- string += 2;
- }
-
- cutoff = (~ (bfd_vma) 0) / (bfd_vma) base;
- cutlim = (~ (bfd_vma) 0) % (bfd_vma) base;
- value = 0;
- overflow = 0;
- while (1)
- {
- unsigned int digit;
-
- digit = *string;
- if (ISDIGIT (digit))
- digit = digit - '0';
- else if (ISALPHA (digit))
- digit = TOUPPER (digit) - 'A' + 10;
- else
- break;
- if (digit >= (unsigned int) base)
- break;
- if (value > cutoff || (value == cutoff && digit > cutlim))
- overflow = 1;
- value = value * base + digit;
- ++string;
- }
-
- if (overflow)
- value = ~ (bfd_vma) 0;
-
- if (end != NULL)
- *end = string;
-
- return value;
-}
-
-/*
-FUNCTION
- bfd_copy_private_bfd_data
-
-SYNOPSIS
- bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
-
-DESCRIPTION
- Copy private BFD information from the BFD @var{ibfd} to the
- the BFD @var{obfd}. Return <<TRUE>> on success, <<FALSE>> on error.
- Possible error returns are:
-
- o <<bfd_error_no_memory>> -
- Not enough memory exists to create private data for @var{obfd}.
-
-.#define bfd_copy_private_bfd_data(ibfd, obfd) \
-. BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
-. (ibfd, obfd))
-
-*/
-
-/*
-FUNCTION
- bfd_merge_private_bfd_data
-
-SYNOPSIS
- bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
-
-DESCRIPTION
- Merge private BFD information from the BFD @var{ibfd} to the
- the output file BFD @var{obfd} when linking. Return <<TRUE>>
- on success, <<FALSE>> on error. Possible error returns are:
-
- o <<bfd_error_no_memory>> -
- Not enough memory exists to create private data for @var{obfd}.
-
-.#define bfd_merge_private_bfd_data(ibfd, obfd) \
-. BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
-. (ibfd, obfd))
-
-*/
-
-/*
-FUNCTION
- bfd_set_private_flags
-
-SYNOPSIS
- bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
-
-DESCRIPTION
- Set private BFD flag information in the BFD @var{abfd}.
- Return <<TRUE>> on success, <<FALSE>> on error. Possible error
- returns are:
-
- o <<bfd_error_no_memory>> -
- Not enough memory exists to create private data for @var{obfd}.
-
-.#define bfd_set_private_flags(abfd, flags) \
-. BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-
-*/
-
-/*
-FUNCTION
- Other functions
-
-DESCRIPTION
- The following functions exist but have not yet been documented.
-
-.#define bfd_sizeof_headers(abfd, reloc) \
-. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-.
-.#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
-. BFD_SEND (abfd, _bfd_find_nearest_line, \
-. (abfd, sec, syms, off, file, func, line))
-.
-.#define bfd_debug_info_start(abfd) \
-. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-.
-.#define bfd_debug_info_end(abfd) \
-. BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-.
-.#define bfd_debug_info_accumulate(abfd, section) \
-. BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-.
-.#define bfd_stat_arch_elt(abfd, stat) \
-. BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-.
-.#define bfd_update_armap_timestamp(abfd) \
-. BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-.
-.#define bfd_set_arch_mach(abfd, arch, mach)\
-. BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-.
-.#define bfd_relax_section(abfd, section, link_info, again) \
-. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-.
-.#define bfd_gc_sections(abfd, link_info) \
-. BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-.
-.#define bfd_merge_sections(abfd, link_info) \
-. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-.
-.#define bfd_discard_group(abfd, sec) \
-. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-.
-.#define bfd_link_hash_table_create(abfd) \
-. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-.
-.#define bfd_link_hash_table_free(abfd, hash) \
-. BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-.
-.#define bfd_link_add_symbols(abfd, info) \
-. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-.
-.#define bfd_link_just_syms(sec, info) \
-. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-.
-.#define bfd_final_link(abfd, info) \
-. BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-.
-.#define bfd_free_cached_info(abfd) \
-. BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-.
-.#define bfd_get_dynamic_symtab_upper_bound(abfd) \
-. BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-.
-.#define bfd_print_private_bfd_data(abfd, file)\
-. BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-.
-.#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
-. BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-.
-.#define bfd_get_dynamic_reloc_upper_bound(abfd) \
-. BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-.
-.#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
-. BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-.
-.extern bfd_byte *bfd_get_relocated_section_contents
-. (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
-. bfd_boolean, asymbol **);
-.
-
-*/
-
-bfd_byte *
-bfd_get_relocated_section_contents (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols)
-{
- bfd *abfd2;
- bfd_byte *(*fn) (bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, asymbol **);
-
- if (link_order->type == bfd_indirect_link_order)
- {
- abfd2 = link_order->u.indirect.section->owner;
- if (abfd2 == NULL)
- abfd2 = abfd;
- }
- else
- abfd2 = abfd;
-
- fn = abfd2->xvec->_bfd_get_relocated_section_contents;
-
- return (*fn) (abfd, link_info, link_order, data, relocatable, symbols);
-}
-
-/* Record information about an ELF program header. */
-
-bfd_boolean
-bfd_record_phdr (bfd *abfd,
- unsigned long type,
- bfd_boolean flags_valid,
- flagword flags,
- bfd_boolean at_valid,
- bfd_vma at,
- bfd_boolean includes_filehdr,
- bfd_boolean includes_phdrs,
- unsigned int count,
- asection **secs)
-{
- struct elf_segment_map *m, **pm;
- bfd_size_type amt;
-
- if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
- return TRUE;
-
- amt = sizeof (struct elf_segment_map);
- amt += ((bfd_size_type) count - 1) * sizeof (asection *);
- m = bfd_alloc (abfd, amt);
- if (m == NULL)
- return FALSE;
-
- m->next = NULL;
- m->p_type = type;
- m->p_flags = flags;
- m->p_paddr = at;
- m->p_flags_valid = flags_valid;
- m->p_paddr_valid = at_valid;
- m->includes_filehdr = includes_filehdr;
- m->includes_phdrs = includes_phdrs;
- m->count = count;
- if (count > 0)
- memcpy (m->sections, secs, count * sizeof (asection *));
-
- for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
- ;
- *pm = m;
-
- return TRUE;
-}
-
-void
-bfd_sprintf_vma (bfd *abfd, char *buf, bfd_vma value)
-{
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
- get_elf_backend_data (abfd)->elf_backend_sprintf_vma (abfd, buf, value);
- else
- sprintf_vma (buf, value);
-}
-
-void
-bfd_fprintf_vma (bfd *abfd, void *stream, bfd_vma value)
-{
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
- get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value);
- else
- fprintf_vma ((FILE *) stream, value);
-}
-
-/*
-FUNCTION
- bfd_alt_mach_code
-
-SYNOPSIS
- bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
-
-DESCRIPTION
-
- When more than one machine code number is available for the
- same machine type, this function can be used to switch between
- the preferred one (alternative == 0) and any others. Currently,
- only ELF supports this feature, with up to two alternate
- machine codes.
-*/
-
-bfd_boolean
-bfd_alt_mach_code (bfd *abfd, int alternative)
-{
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
- {
- int code;
-
- switch (alternative)
- {
- case 0:
- code = get_elf_backend_data (abfd)->elf_machine_code;
- break;
-
- case 1:
- code = get_elf_backend_data (abfd)->elf_machine_alt1;
- if (code == 0)
- return FALSE;
- break;
-
- case 2:
- code = get_elf_backend_data (abfd)->elf_machine_alt2;
- if (code == 0)
- return FALSE;
- break;
-
- default:
- return FALSE;
- }
-
- elf_elfheader (abfd)->e_machine = code;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
-CODE_FRAGMENT
-
-.struct bfd_preserve
-.{
-. void *marker;
-. void *tdata;
-. flagword flags;
-. const struct bfd_arch_info *arch_info;
-. struct bfd_section *sections;
-. struct bfd_section **section_tail;
-. unsigned int section_count;
-. struct bfd_hash_table section_htab;
-.};
-.
-*/
-
-/*
-FUNCTION
- bfd_preserve_save
-
-SYNOPSIS
- bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
- When testing an object for compatibility with a particular
- target back-end, the back-end object_p function needs to set
- up certain fields in the bfd on successfully recognizing the
- object. This typically happens in a piecemeal fashion, with
- failures possible at many points. On failure, the bfd is
- supposed to be restored to its initial state, which is
- virtually impossible. However, restoring a subset of the bfd
- state works in practice. This function stores the subset and
- reinitializes the bfd.
-
-*/
-
-bfd_boolean
-bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve)
-{
- preserve->tdata = abfd->tdata.any;
- preserve->arch_info = abfd->arch_info;
- preserve->flags = abfd->flags;
- preserve->sections = abfd->sections;
- preserve->section_tail = abfd->section_tail;
- preserve->section_count = abfd->section_count;
- preserve->section_htab = abfd->section_htab;
-
- if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
- return FALSE;
-
- abfd->tdata.any = NULL;
- abfd->arch_info = &bfd_default_arch_struct;
- abfd->flags &= BFD_IN_MEMORY;
- abfd->sections = NULL;
- abfd->section_tail = &abfd->sections;
- abfd->section_count = 0;
-
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_preserve_restore
-
-SYNOPSIS
- void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
- This function restores bfd state saved by bfd_preserve_save.
- If MARKER is non-NULL in struct bfd_preserve then that block
- and all subsequently bfd_alloc'd memory is freed.
-
-*/
-
-void
-bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
-{
- bfd_hash_table_free (&abfd->section_htab);
-
- abfd->tdata.any = preserve->tdata;
- abfd->arch_info = preserve->arch_info;
- abfd->flags = preserve->flags;
- abfd->section_htab = preserve->section_htab;
- abfd->sections = preserve->sections;
- abfd->section_tail = preserve->section_tail;
- abfd->section_count = preserve->section_count;
-
- /* bfd_release frees all memory more recently bfd_alloc'd than
- its arg, as well as its arg. */
- if (preserve->marker != NULL)
- {
- bfd_release (abfd, preserve->marker);
- preserve->marker = NULL;
- }
-}
-
-/*
-FUNCTION
- bfd_preserve_finish
-
-SYNOPSIS
- void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
- This function should be called when the bfd state saved by
- bfd_preserve_save is no longer needed. ie. when the back-end
- object_p function returns with success.
-
-*/
-
-void
-bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
-{
- /* It would be nice to be able to free more memory here, eg. old
- tdata, but that's not possible since these blocks are sitting
- inside bfd_alloc'd memory. The section hash is on a separate
- objalloc. */
- bfd_hash_table_free (&preserve->section_htab);
-}
diff --git a/contrib/binutils/bfd/bfdio.c b/contrib/binutils/bfd/bfdio.c
deleted file mode 100644
index a90cb33..0000000
--- a/contrib/binutils/bfd/bfdio.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* Low-level I/O routines for BFDs.
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "sysdep.h"
-
-#include "bfd.h"
-#include "libbfd.h"
-
-#include <limits.h>
-
-#ifndef S_IXUSR
-#define S_IXUSR 0100 /* Execute by owner. */
-#endif
-#ifndef S_IXGRP
-#define S_IXGRP 0010 /* Execute by group. */
-#endif
-#ifndef S_IXOTH
-#define S_IXOTH 0001 /* Execute by others. */
-#endif
-
-file_ptr
-real_ftell (FILE *file)
-{
-#if defined (HAVE_FTELLO64)
- return ftello64 (file);
-#elif defined (HAVE_FTELLO)
- return ftello (file);
-#else
- return ftell (file);
-#endif
-}
-
-int
-real_fseek (FILE *file, file_ptr offset, int whence)
-{
-#if defined (HAVE_FSEEKO64)
- return fseeko64 (file, offset, whence);
-#elif defined (HAVE_FSEEKO)
- return fseeko (file, offset, whence);
-#else
- return fseek (file, offset, whence);
-#endif
-}
-
-/* Note that archive entries don't have streams; they share their parent's.
- This allows someone to play with the iostream behind BFD's back.
-
- Also, note that the origin pointer points to the beginning of a file's
- contents (0 for non-archive elements). For archive entries this is the
- first octet in the file, NOT the beginning of the archive header. */
-
-static size_t
-real_read (void *where, size_t a, size_t b, FILE *file)
-{
- /* FIXME - this looks like an optimization, but it's really to cover
- up for a feature of some OSs (not solaris - sigh) that
- ld/pe-dll.c takes advantage of (apparently) when it creates BFDs
- internally and tries to link against them. BFD seems to be smart
- enough to realize there are no symbol records in the "file" that
- doesn't exist but attempts to read them anyway. On Solaris,
- attempting to read zero bytes from a NULL file results in a core
- dump, but on other platforms it just returns zero bytes read.
- This makes it to something reasonable. - DJ */
- if (a == 0 || b == 0)
- return 0;
-
-
-#if defined (__VAX) && defined (VMS)
- /* Apparently fread on Vax VMS does not keep the record length
- information. */
- return read (fileno (file), where, a * b);
-#else
- return fread (where, a, b, file);
-#endif
-}
-
-/* Return value is amount read. */
-
-bfd_size_type
-bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
-{
- size_t nread;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- {
- struct bfd_in_memory *bim;
- bfd_size_type get;
-
- bim = abfd->iostream;
- get = size;
- if (abfd->where + get > bim->size)
- {
- if (bim->size < (bfd_size_type) abfd->where)
- get = 0;
- else
- get = bim->size - abfd->where;
- bfd_set_error (bfd_error_file_truncated);
- }
- memcpy (ptr, bim->buffer + abfd->where, (size_t) get);
- abfd->where += get;
- return get;
- }
-
- nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
- if (nread != (size_t) -1)
- abfd->where += nread;
-
- /* Set bfd_error if we did not read as much data as we expected.
-
- If the read failed due to an error set the bfd_error_system_call,
- else set bfd_error_file_truncated.
-
- A BFD backend may wish to override bfd_error_file_truncated to
- provide something more useful (eg. no_symbols or wrong_format). */
- if (nread != size)
- {
- if (ferror (bfd_cache_lookup (abfd)))
- bfd_set_error (bfd_error_system_call);
- else
- bfd_set_error (bfd_error_file_truncated);
- }
-
- return nread;
-}
-
-bfd_size_type
-bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
-{
- size_t nwrote;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- {
- struct bfd_in_memory *bim = abfd->iostream;
- size = (size_t) size;
- if (abfd->where + size > bim->size)
- {
- bfd_size_type newsize, oldsize;
-
- oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
- bim->size = abfd->where + size;
- /* Round up to cut down on memory fragmentation */
- newsize = (bim->size + 127) & ~(bfd_size_type) 127;
- if (newsize > oldsize)
- {
- bim->buffer = bfd_realloc (bim->buffer, newsize);
- if (bim->buffer == 0)
- {
- bim->size = 0;
- return 0;
- }
- }
- }
- memcpy (bim->buffer + abfd->where, ptr, (size_t) size);
- abfd->where += size;
- return size;
- }
-
- nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
- if (nwrote != (size_t) -1)
- abfd->where += nwrote;
- if (nwrote != size)
- {
-#ifdef ENOSPC
- errno = ENOSPC;
-#endif
- bfd_set_error (bfd_error_system_call);
- }
- return nwrote;
-}
-
-file_ptr
-bfd_tell (bfd *abfd)
-{
- file_ptr ptr;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- return abfd->where;
-
- ptr = real_ftell (bfd_cache_lookup (abfd));
-
- if (abfd->my_archive)
- ptr -= abfd->origin;
- abfd->where = ptr;
- return ptr;
-}
-
-int
-bfd_flush (bfd *abfd)
-{
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- return 0;
- return fflush (bfd_cache_lookup(abfd));
-}
-
-/* Returns 0 for success, negative value for failure (in which case
- bfd_get_error can retrieve the error code). */
-int
-bfd_stat (bfd *abfd, struct stat *statbuf)
-{
- FILE *f;
- int result;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- abort ();
-
- f = bfd_cache_lookup (abfd);
- if (f == NULL)
- {
- bfd_set_error (bfd_error_system_call);
- return -1;
- }
- result = fstat (fileno (f), statbuf);
- if (result < 0)
- bfd_set_error (bfd_error_system_call);
- return result;
-}
-
-/* Returns 0 for success, nonzero for failure (in which case bfd_get_error
- can retrieve the error code). */
-
-int
-bfd_seek (bfd *abfd, file_ptr position, int direction)
-{
- int result;
- FILE *f;
- file_ptr file_position;
- /* For the time being, a BFD may not seek to it's end. The problem
- is that we don't easily have a way to recognize the end of an
- element in an archive. */
-
- BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR);
-
- if (direction == SEEK_CUR && position == 0)
- return 0;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- {
- struct bfd_in_memory *bim;
-
- bim = abfd->iostream;
-
- if (direction == SEEK_SET)
- abfd->where = position;
- else
- abfd->where += position;
-
- if (abfd->where > bim->size)
- {
- if ((abfd->direction == write_direction) ||
- (abfd->direction == both_direction))
- {
- bfd_size_type newsize, oldsize;
- oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
- bim->size = abfd->where;
- /* Round up to cut down on memory fragmentation */
- newsize = (bim->size + 127) & ~(bfd_size_type) 127;
- if (newsize > oldsize)
- {
- bim->buffer = bfd_realloc (bim->buffer, newsize);
- if (bim->buffer == 0)
- {
- bim->size = 0;
- return -1;
- }
- }
- }
- else
- {
- abfd->where = bim->size;
- bfd_set_error (bfd_error_file_truncated);
- return -1;
- }
- }
- return 0;
- }
-
- if (abfd->format != bfd_archive && abfd->my_archive == 0)
- {
-#if 0
- /* Explanation for this code: I'm only about 95+% sure that the above
- conditions are sufficient and that all i/o calls are properly
- adjusting the `where' field. So this is sort of an `assert'
- that the `where' field is correct. If we can go a while without
- tripping the abort, we can probably safely disable this code,
- so that the real optimizations happen. */
- file_ptr where_am_i_now;
- where_am_i_now = real_ftell (bfd_cache_lookup (abfd));
- if (abfd->my_archive)
- where_am_i_now -= abfd->origin;
- if (where_am_i_now != abfd->where)
- abort ();
-#endif
- if (direction == SEEK_SET && (bfd_vma) position == abfd->where)
- return 0;
- }
- else
- {
- /* We need something smarter to optimize access to archives.
- Currently, anything inside an archive is read via the file
- handle for the archive. Which means that a bfd_seek on one
- component affects the `current position' in the archive, as
- well as in any other component.
-
- It might be sufficient to put a spike through the cache
- abstraction, and look to the archive for the file position,
- but I think we should try for something cleaner.
-
- In the meantime, no optimization for archives. */
- }
-
- f = bfd_cache_lookup (abfd);
- file_position = position;
- if (direction == SEEK_SET && abfd->my_archive != NULL)
- file_position += abfd->origin;
-
- result = real_fseek (f, file_position, direction);
- if (result != 0)
- {
- int hold_errno = errno;
-
- /* Force redetermination of `where' field. */
- bfd_tell (abfd);
-
- /* An EINVAL error probably means that the file offset was
- absurd. */
- if (hold_errno == EINVAL)
- bfd_set_error (bfd_error_file_truncated);
- else
- {
- bfd_set_error (bfd_error_system_call);
- errno = hold_errno;
- }
- }
- else
- {
- /* Adjust `where' field. */
- if (direction == SEEK_SET)
- abfd->where = position;
- else
- abfd->where += position;
- }
- return result;
-}
-
-/*
-FUNCTION
- bfd_get_mtime
-
-SYNOPSIS
- long bfd_get_mtime (bfd *abfd);
-
-DESCRIPTION
- Return the file modification time (as read from the file system, or
- from the archive header for archive members).
-
-*/
-
-long
-bfd_get_mtime (bfd *abfd)
-{
- FILE *fp;
- struct stat buf;
-
- if (abfd->mtime_set)
- return abfd->mtime;
-
- fp = bfd_cache_lookup (abfd);
- if (0 != fstat (fileno (fp), &buf))
- return 0;
-
- abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */
- return buf.st_mtime;
-}
-
-/*
-FUNCTION
- bfd_get_size
-
-SYNOPSIS
- long bfd_get_size (bfd *abfd);
-
-DESCRIPTION
- Return the file size (as read from file system) for the file
- associated with BFD @var{abfd}.
-
- The initial motivation for, and use of, this routine is not
- so we can get the exact size of the object the BFD applies to, since
- that might not be generally possible (archive members for example).
- It would be ideal if someone could eventually modify
- it so that such results were guaranteed.
-
- Instead, we want to ask questions like "is this NNN byte sized
- object I'm about to try read from file offset YYY reasonable?"
- As as example of where we might do this, some object formats
- use string tables for which the first <<sizeof (long)>> bytes of the
- table contain the size of the table itself, including the size bytes.
- If an application tries to read what it thinks is one of these
- string tables, without some way to validate the size, and for
- some reason the size is wrong (byte swapping error, wrong location
- for the string table, etc.), the only clue is likely to be a read
- error when it tries to read the table, or a "virtual memory
- exhausted" error when it tries to allocate 15 bazillon bytes
- of space for the 15 bazillon byte table it is about to read.
- This function at least allows us to answer the question, "is the
- size reasonable?".
-*/
-
-long
-bfd_get_size (bfd *abfd)
-{
- FILE *fp;
- struct stat buf;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- return ((struct bfd_in_memory *) abfd->iostream)->size;
-
- fp = bfd_cache_lookup (abfd);
- if (0 != fstat (fileno (fp), & buf))
- return 0;
-
- return buf.st_size;
-}
diff --git a/contrib/binutils/bfd/bfdwin.c b/contrib/binutils/bfd/bfdwin.c
deleted file mode 100644
index fb7c967..0000000
--- a/contrib/binutils/bfd/bfdwin.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/* Support for memory-mapped windows into a BFD.
- Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "sysdep.h"
-
-#include "bfd.h"
-#include "libbfd.h"
-
-/* Currently, if USE_MMAP is undefined, none if the window stuff is
- used. Okay, so it's mis-named. At least the command-line option
- "--without-mmap" is more obvious than "--without-windows" or some
- such. */
-
-#ifdef USE_MMAP
-
-#undef HAVE_MPROTECT /* code's not tested yet */
-
-#if HAVE_MMAP || HAVE_MPROTECT || HAVE_MADVISE
-#include <sys/mman.h>
-#endif
-
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-
-static int debug_windows;
-
-/* The idea behind the next and refcount fields is that one mapped
- region can suffice for multiple read-only windows or multiple
- non-overlapping read-write windows. It's not implemented yet
- though. */
-
-/*
-INTERNAL_DEFINITION
-
-.struct _bfd_window_internal {
-. struct _bfd_window_internal *next;
-. void *data;
-. bfd_size_type size;
-. int refcount : 31; {* should be enough... *}
-. unsigned mapped : 1; {* 1 = mmap, 0 = malloc *}
-.};
-*/
-
-void
-bfd_init_window (bfd_window *windowp)
-{
- windowp->data = 0;
- windowp->i = 0;
- windowp->size = 0;
-}
-
-void
-bfd_free_window (bfd_window *windowp)
-{
- bfd_window_internal *i = windowp->i;
- windowp->i = 0;
- windowp->data = 0;
- if (i == 0)
- return;
- i->refcount--;
- if (debug_windows)
- fprintf (stderr, "freeing window @%p<%p,%lx,%p>\n",
- windowp, windowp->data, windowp->size, windowp->i);
- if (i->refcount != 0)
- return;
-
- if (i->mapped)
- {
-#ifdef HAVE_MMAP
- munmap (i->data, i->size);
- goto no_free;
-#else
- abort ();
-#endif
- }
-#ifdef HAVE_MPROTECT
- mprotect (i->data, i->size, PROT_READ | PROT_WRITE);
-#endif
- free (i->data);
-#ifdef HAVE_MMAP
- no_free:
-#endif
- i->data = 0;
- /* There should be no more references to i at this point. */
- free (i);
-}
-
-static int ok_to_map = 1;
-
-bfd_boolean
-bfd_get_file_window (bfd *abfd,
- file_ptr offset,
- bfd_size_type size,
- bfd_window *windowp,
- bfd_boolean writable)
-{
- static size_t pagesize;
- bfd_window_internal *i = windowp->i;
- bfd_size_type size_to_alloc = size;
-
- if (debug_windows)
- fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)",
- abfd, (long) offset, (long) size,
- windowp, windowp->data, (unsigned long) windowp->size,
- windowp->i, writable);
-
- /* Make sure we know the page size, so we can be friendly to mmap. */
- if (pagesize == 0)
- pagesize = getpagesize ();
- if (pagesize == 0)
- abort ();
-
- if (i == 0)
- {
- i = bfd_zmalloc (sizeof (bfd_window_internal));
- windowp->i = i;
- if (i == 0)
- return FALSE;
- i->data = 0;
- }
-#ifdef HAVE_MMAP
- if (ok_to_map
- && (i->data == 0 || i->mapped == 1)
- && (abfd->flags & BFD_IN_MEMORY) == 0)
- {
- file_ptr file_offset, offset2;
- size_t real_size;
- int fd;
- FILE *f;
-
- /* Find the real file and the real offset into it. */
- while (abfd->my_archive != NULL)
- {
- offset += abfd->origin;
- abfd = abfd->my_archive;
- }
- f = bfd_cache_lookup (abfd);
- fd = fileno (f);
-
- /* Compute offsets and size for mmap and for the user's data. */
- offset2 = offset % pagesize;
- if (offset2 < 0)
- abort ();
- file_offset = offset - offset2;
- real_size = offset + size - file_offset;
- real_size = real_size + pagesize - 1;
- real_size -= real_size % pagesize;
-
- /* If we're re-using a memory region, make sure it's big enough. */
- if (i->data && i->size < size)
- {
- munmap (i->data, i->size);
- i->data = 0;
- }
- i->data = mmap (i->data, real_size,
- writable ? PROT_WRITE | PROT_READ : PROT_READ,
- (writable
- ? MAP_FILE | MAP_PRIVATE
- : MAP_FILE | MAP_SHARED),
- fd, file_offset);
- if (i->data == (void *) -1)
- {
- /* An error happened. Report it, or try using malloc, or
- something. */
- bfd_set_error (bfd_error_system_call);
- i->data = 0;
- windowp->data = 0;
- if (debug_windows)
- fprintf (stderr, "\t\tmmap failed!\n");
- return FALSE;
- }
- if (debug_windows)
- fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n",
- (long) real_size, i->data, (long) offset2);
- i->size = real_size;
- windowp->data = (bfd_byte *) i->data + offset2;
- windowp->size = size;
- i->mapped = 1;
- return TRUE;
- }
- else if (debug_windows)
- {
- if (ok_to_map)
- fprintf (stderr, _("not mapping: data=%lx mapped=%d\n"),
- (unsigned long) i->data, (int) i->mapped);
- else
- fprintf (stderr, _("not mapping: env var not set\n"));
- }
-#else
- ok_to_map = 0;
-#endif
-
-#ifdef HAVE_MPROTECT
- if (!writable)
- {
- size_to_alloc += pagesize - 1;
- size_to_alloc -= size_to_alloc % pagesize;
- }
-#endif
- if (debug_windows)
- fprintf (stderr, "\n\t%s(%6ld)",
- i->data ? "realloc" : " malloc", (long) size_to_alloc);
- i->data = bfd_realloc (i->data, size_to_alloc);
- if (debug_windows)
- fprintf (stderr, "\t-> %p\n", i->data);
- i->refcount = 1;
- if (i->data == NULL)
- {
- if (size_to_alloc == 0)
- return TRUE;
- return FALSE;
- }
- if (bfd_seek (abfd, offset, SEEK_SET) != 0)
- return FALSE;
- i->size = bfd_bread (i->data, size, abfd);
- if (i->size != size)
- return FALSE;
- i->mapped = 0;
-#ifdef HAVE_MPROTECT
- if (!writable)
- {
- if (debug_windows)
- fprintf (stderr, "\tmprotect (%p, %ld, PROT_READ)\n", i->data,
- (long) i->size);
- mprotect (i->data, i->size, PROT_READ);
- }
-#endif
- windowp->data = i->data;
- windowp->size = i->size;
- return TRUE;
-}
-
-#endif /* USE_MMAP */
diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c
deleted file mode 100644
index 65f46af..0000000
--- a/contrib/binutils/bfd/binary.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* BFD back-end for binary objects.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This is a BFD backend which may be used to write binary objects.
- It may only be used for output, not input. The intention is that
- this may be used as an output format for objcopy in order to
- generate raw binary data.
-
- This is very simple. The only complication is that the real data
- will start at some address X, and in some cases we will not want to
- include X zeroes just to get to that point. Since the start
- address is not meaningful for this object file format, we use it
- instead to indicate the number of zeroes to skip at the start of
- the file. objcopy cooperates by specially setting the start
- address to zero by default. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "safe-ctype.h"
-#include "libbfd.h"
-
-/* Any bfd we create by reading a binary file has three symbols:
- a start symbol, an end symbol, and an absolute length symbol. */
-#define BIN_SYMS 3
-
-static bfd_boolean binary_mkobject PARAMS ((bfd *));
-static const bfd_target *binary_object_p PARAMS ((bfd *));
-static bfd_boolean binary_get_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static long binary_get_symtab_upper_bound PARAMS ((bfd *));
-static char *mangle_name PARAMS ((bfd *, char *));
-static long binary_canonicalize_symtab PARAMS ((bfd *, asymbol **));
-static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-static bfd_boolean binary_set_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static int binary_sizeof_headers PARAMS ((bfd *, bfd_boolean));
-
-/* Set by external programs - specifies the BFD architecture and
- machine number to be uses when creating binary BFDs. */
-enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
-unsigned long bfd_external_machine = 0;
-
-/* Create a binary object. Invoked via bfd_set_format. */
-
-static bfd_boolean
-binary_mkobject (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
-{
- return TRUE;
-}
-
-/* Any file may be considered to be a binary file, provided the target
- was not defaulted. That is, it must be explicitly specified as
- being binary. */
-
-static const bfd_target *
-binary_object_p (abfd)
- bfd *abfd;
-{
- struct stat statbuf;
- asection *sec;
-
- if (abfd->target_defaulted)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- abfd->symcount = BIN_SYMS;
-
- /* Find the file size. */
- if (bfd_stat (abfd, &statbuf) < 0)
- {
- bfd_set_error (bfd_error_system_call);
- return NULL;
- }
-
- /* One data section. */
- sec = bfd_make_section (abfd, ".data");
- if (sec == NULL)
- return NULL;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
- sec->vma = 0;
- sec->_raw_size = statbuf.st_size;
- sec->filepos = 0;
-
- abfd->tdata.any = (PTR) sec;
-
- if (bfd_get_arch_info (abfd) != NULL)
- {
- if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown)
- && (bfd_external_binary_architecture != bfd_arch_unknown))
- bfd_set_arch_info (abfd, bfd_lookup_arch
- (bfd_external_binary_architecture, bfd_external_machine));
- }
-
- return abfd->xvec;
-}
-
-#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
-#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define binary_new_section_hook _bfd_generic_new_section_hook
-
-/* Get contents of the only section. */
-
-static bfd_boolean
-binary_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section ATTRIBUTE_UNUSED;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || bfd_bread (location, count, abfd) != count)
- return FALSE;
- return TRUE;
-}
-
-/* Return the amount of memory needed to read the symbol table. */
-
-static long
-binary_get_symtab_upper_bound (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
-{
- return (BIN_SYMS + 1) * sizeof (asymbol *);
-}
-
-/* Create a symbol name based on the bfd's filename. */
-
-static char *
-mangle_name (abfd, suffix)
- bfd *abfd;
- char *suffix;
-{
- bfd_size_type size;
- char *buf;
- char *p;
-
- size = (strlen (bfd_get_filename (abfd))
- + strlen (suffix)
- + sizeof "_binary__");
-
- buf = (char *) bfd_alloc (abfd, size);
- if (buf == NULL)
- return "";
-
- sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix);
-
- /* Change any non-alphanumeric characters to underscores. */
- for (p = buf; *p; p++)
- if (! ISALNUM (*p))
- *p = '_';
-
- return buf;
-}
-
-/* Return the symbol table. */
-
-static long
-binary_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **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, amt);
- if (syms == NULL)
- return 0;
-
- /* Start symbol. */
- syms[0].the_bfd = abfd;
- syms[0].name = mangle_name (abfd, "start");
- syms[0].value = 0;
- syms[0].flags = BSF_GLOBAL;
- syms[0].section = sec;
- syms[0].udata.p = NULL;
-
- /* End symbol. */
- syms[1].the_bfd = abfd;
- syms[1].name = mangle_name (abfd, "end");
- syms[1].value = sec->_raw_size;
- syms[1].flags = BSF_GLOBAL;
- syms[1].section = sec;
- syms[1].udata.p = NULL;
-
- /* Size symbol. */
- syms[2].the_bfd = abfd;
- syms[2].name = mangle_name (abfd, "size");
- syms[2].value = sec->_raw_size;
- syms[2].flags = BSF_GLOBAL;
- syms[2].section = bfd_abs_section_ptr;
- syms[2].udata.p = NULL;
-
- for (i = 0; i < BIN_SYMS; i++)
- *alocation++ = syms++;
- *alocation = NULL;
-
- return BIN_SYMS;
-}
-
-#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
-#define binary_print_symbol _bfd_nosymbols_print_symbol
-
-/* Get information about a symbol. */
-
-static void
-binary_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
-}
-
-#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define binary_get_lineno _bfd_nosymbols_get_lineno
-#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define binary_read_minisymbols _bfd_generic_read_minisymbols
-#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define binary_get_reloc_upper_bound \
- ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
-#define binary_canonicalize_reloc \
- ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
-#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-
-/* Set the architecture of a binary file. */
-#define binary_set_arch_mach _bfd_generic_set_arch_mach
-
-/* Write section contents of a binary file. */
-
-static bfd_boolean
-binary_set_section_contents (abfd, sec, data, offset, size)
- bfd *abfd;
- asection *sec;
- const PTR data;
- file_ptr offset;
- bfd_size_type size;
-{
- if (size == 0)
- return TRUE;
-
- if (! abfd->output_has_begun)
- {
- bfd_boolean found_low;
- bfd_vma low;
- asection *s;
-
- /* The lowest section LMA sets the virtual address of the start
- of the file. We use this to set the file position of all the
- sections. */
- found_low = FALSE;
- low = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
- if (((s->flags
- & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
- == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
- && (s->_raw_size > 0)
- && (! found_low || s->lma < low))
- {
- low = s->lma;
- found_low = TRUE;
- }
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- s->filepos = s->lma - low;
-
- /* Skip following warning check for sections that will not
- occupy file space. */
- if ((s->flags
- & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
- != (SEC_HAS_CONTENTS | SEC_ALLOC)
- || (s->_raw_size == 0))
- continue;
-
- /* If attempting to generate a binary file from a bfd with
- LMA's all over the place, huge (sparse?) binary files may
- result. This condition attempts to detect this situation
- and print a warning. Better heuristics would be nice to
- have. */
-
- if (s->filepos < 0)
- (*_bfd_error_handler)
- (_("Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."),
- bfd_get_section_name (abfd, s),
- (unsigned long) s->filepos);
- }
-
- abfd->output_has_begun = TRUE;
- }
-
- /* We don't want to output anything for a section that is neither
- loaded nor allocated. The contents of such a section are not
- meaningful in the binary format. */
- if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
- return TRUE;
- if ((sec->flags & SEC_NEVER_LOAD) != 0)
- return TRUE;
-
- return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
-}
-
-/* No space is required for header information. */
-
-static int
-binary_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
-{
- return 0;
-}
-
-#define binary_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define binary_bfd_relax_section bfd_generic_relax_section
-#define binary_bfd_gc_sections bfd_generic_gc_sections
-#define binary_bfd_merge_sections bfd_generic_merge_sections
-#define binary_bfd_discard_group bfd_generic_discard_group
-#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
-#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define binary_bfd_final_link _bfd_generic_final_link
-#define binary_bfd_link_split_section _bfd_generic_link_split_section
-#define binary_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-const bfd_target binary_vec =
-{
- "binary", /* name */
- bfd_target_unknown_flavour, /* flavour */
- BFD_ENDIAN_UNKNOWN, /* byteorder */
- BFD_ENDIAN_UNKNOWN, /* header_byteorder */
- EXEC_P, /* object_flags */
- (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
- | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */
- 0, /* symbol_leading_char */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
- { /* bfd_check_format */
- _bfd_dummy_target,
- binary_object_p, /* bfd_check_format */
- _bfd_dummy_target,
- _bfd_dummy_target,
- },
- { /* bfd_set_format */
- bfd_false,
- binary_mkobject,
- bfd_false,
- bfd_false,
- },
- { /* bfd_write_contents */
- bfd_false,
- bfd_true,
- bfd_false,
- bfd_false,
- },
-
- BFD_JUMP_TABLE_GENERIC (binary),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (binary),
- BFD_JUMP_TABLE_RELOCS (binary),
- BFD_JUMP_TABLE_WRITE (binary),
- BFD_JUMP_TABLE_LINK (binary),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- NULL
-};
diff --git a/contrib/binutils/bfd/bout.c b/contrib/binutils/bfd/bout.c
deleted file mode 100644
index a39a9a3..0000000
--- a/contrib/binutils/bfd/bout.c
+++ /dev/null
@@ -1,1579 +0,0 @@
-/* BFD back-end for Intel 960 b.out binaries.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-#include "genlink.h"
-#include "bout.h"
-
-#include "aout/stab_gnu.h"
-#include "libaout.h" /* BFD a.out internal data structures. */
-
-static int aligncode
- PARAMS ((bfd *abfd, asection *input_section, arelent *r,
- unsigned int shrink));
-static void perform_slip
- PARAMS ((bfd *abfd, unsigned int slip, asection *input_section,
- bfd_vma value));
-static bfd_boolean b_out_squirt_out_relocs
- PARAMS ((bfd *abfd, asection *section));
-static const bfd_target *b_out_callback
- PARAMS ((bfd *));
-static bfd_reloc_status_type calljx_callback
- PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR src, PTR dst,
- asection *));
-static bfd_reloc_status_type callj_callback
- PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR data,
- unsigned int srcidx, unsigned int dstidx, asection *, bfd_boolean));
-static bfd_vma get_value
- PARAMS ((arelent *, struct bfd_link_info *, asection *));
-static int abs32code
- PARAMS ((bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *));
-static bfd_boolean b_out_bfd_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
-static bfd_byte *b_out_bfd_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
- bfd_boolean, asymbol **));
-static int b_out_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-static bfd_boolean b_out_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static bfd_boolean b_out_set_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static long b_out_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
-static long b_out_canonicalize_reloc
- PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-static bfd_boolean b_out_slurp_reloc_table
- PARAMS ((bfd *, sec_ptr, asymbol **));
-static reloc_howto_type *b_out_bfd_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static bfd_boolean b_out_write_object_contents
- PARAMS ((bfd *));
-static int b_out_symbol_cmp
- PARAMS ((const void *, const void *));
-static bfd_boolean b_out_mkobject
- PARAMS ((bfd *));
-static const bfd_target *b_out_object_p
- PARAMS ((bfd *));
-
-void bout_swap_exec_header_in
- PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
-void bout_swap_exec_header_out
- PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
-
-/* Swaps the information in an executable header taken from a raw byte
- stream memory image, into the internal exec_header structure. */
-
-void
-bout_swap_exec_header_in (abfd, raw_bytes, execp)
- bfd *abfd;
- struct external_exec *raw_bytes;
- struct internal_exec *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 = 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);
- execp->a_syms = GET_WORD (abfd, bytes->e_syms);
- execp->a_entry = GET_WORD (abfd, bytes->e_entry);
- execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
- execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
- execp->a_tload = GET_WORD (abfd, bytes->e_tload);
- execp->a_dload = GET_WORD (abfd, bytes->e_dload);
- execp->a_talign = bytes->e_talign[0];
- execp->a_dalign = bytes->e_dalign[0];
- execp->a_balign = bytes->e_balign[0];
- execp->a_relaxable = bytes->e_relaxable[0];
-}
-
-/* Swaps the information in an internal exec header structure into the
- supplied buffer ready for writing to disk. */
-
-void
-bout_swap_exec_header_out (abfd, execp, raw_bytes)
- bfd *abfd;
- struct internal_exec *execp;
- struct external_exec *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. */
- 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);
- PUT_WORD (abfd, execp->a_syms , bytes->e_syms);
- PUT_WORD (abfd, execp->a_entry , bytes->e_entry);
- PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
- PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
- PUT_WORD (abfd, execp->a_tload , bytes->e_tload);
- PUT_WORD (abfd, execp->a_dload , bytes->e_dload);
- bytes->e_talign[0] = execp->a_talign;
- bytes->e_dalign[0] = execp->a_dalign;
- bytes->e_balign[0] = execp->a_balign;
- bytes->e_relaxable[0] = execp->a_relaxable;
-}
-
-static const bfd_target *
-b_out_object_p (abfd)
- bfd *abfd;
-{
- struct internal_exec anexec;
- struct external_exec exec_bytes;
- bfd_size_type 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;
- }
-
- anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
-
- if (N_BADMAG (anexec))
- {
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- bout_swap_exec_header_in (abfd, &exec_bytes, &anexec);
- return aout_32_some_aout_object_p (abfd, &anexec, b_out_callback);
-}
-
-/* Finish up the opening of a b.out file for reading. Fill in all the
- fields that are not handled by common code. */
-
-static const bfd_target *
-b_out_callback (abfd)
- bfd *abfd;
-{
- struct internal_exec *execp = exec_hdr (abfd);
- unsigned long bss_start;
-
- /* Architecture and machine type. */
- bfd_set_arch_mach(abfd,
- bfd_arch_i960, /* B.out only used on i960 */
- bfd_mach_i960_core /* Default */
- );
-
- /* The positions of the string table and symbol table. */
- obj_str_filepos (abfd) = N_STROFF (*execp);
- obj_sym_filepos (abfd) = N_SYMOFF (*execp);
-
- /* The alignments of the sections. */
- obj_textsec (abfd)->alignment_power = execp->a_talign;
- obj_datasec (abfd)->alignment_power = execp->a_dalign;
- obj_bsssec (abfd)->alignment_power = execp->a_balign;
-
- /* The starting addresses of the sections. */
- obj_textsec (abfd)->vma = execp->a_tload;
- obj_datasec (abfd)->vma = execp->a_dload;
-
- obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
- obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
-
- /* And reload the sizes, since the aout module zaps them. */
- obj_textsec (abfd)->_raw_size = execp->a_text;
-
- bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section */
- obj_bsssec (abfd)->vma = align_power (bss_start, execp->a_balign);
-
- obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
-
- /* The file positions of the sections. */
- obj_textsec (abfd)->filepos = N_TXTOFF(*execp);
- obj_datasec (abfd)->filepos = N_DATOFF(*execp);
-
- /* The file positions of the relocation info. */
- obj_textsec (abfd)->rel_filepos = N_TROFF(*execp);
- obj_datasec (abfd)->rel_filepos = N_DROFF(*execp);
-
- adata(abfd).page_size = 1; /* Not applicable. */
- adata(abfd).segment_size = 1; /* Not applicable. */
- adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
-
- if (execp->a_relaxable)
- abfd->flags |= BFD_IS_RELAXABLE;
- return abfd->xvec;
-}
-
-struct bout_data_struct
- {
- struct aoutdata a;
- struct internal_exec e;
- };
-
-static bfd_boolean
-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, 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;
-
- return TRUE;
-}
-
-static int
-b_out_symbol_cmp (a_ptr, b_ptr)
- const void * a_ptr;
- const void * b_ptr;
-{
- struct aout_symbol ** a = (struct aout_symbol **) a_ptr;
- struct aout_symbol ** b = (struct aout_symbol **) b_ptr;
- asection *sec;
- bfd_vma av, bv;
-
- /* Primary key is address. */
- sec = bfd_get_section (&(*a)->symbol);
- av = sec->output_section->vma + sec->output_offset + (*a)->symbol.value;
- sec = bfd_get_section (&(*b)->symbol);
- bv = sec->output_section->vma + sec->output_offset + (*b)->symbol.value;
-
- if (av < bv)
- return -1;
- if (av > bv)
- return 1;
-
- /* Secondary key puts CALLNAME syms last and BALNAME syms first, so
- that they have the best chance of being contiguous. */
- if (IS_BALNAME ((*a)->other) || IS_CALLNAME ((*b)->other))
- return -1;
- if (IS_CALLNAME ((*a)->other) || IS_BALNAME ((*b)->other))
- return 1;
-
- return 0;
-}
-
-static bfd_boolean
-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;
-
- exec_hdr (abfd)->a_info = BMAGIC;
-
- exec_hdr (abfd)->a_text = obj_textsec (abfd)->_raw_size;
- exec_hdr (abfd)->a_data = obj_datasec (abfd)->_raw_size;
- exec_hdr (abfd)->a_bss = obj_bsssec (abfd)->_raw_size;
- exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) * sizeof (struct nlist);
- exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
- exec_hdr (abfd)->a_trsize = ((obj_textsec (abfd)->reloc_count) *
- sizeof (struct relocation_info));
- exec_hdr (abfd)->a_drsize = ((obj_datasec (abfd)->reloc_count) *
- sizeof (struct relocation_info));
-
- exec_hdr (abfd)->a_talign = obj_textsec (abfd)->alignment_power;
- exec_hdr (abfd)->a_dalign = obj_datasec (abfd)->alignment_power;
- exec_hdr (abfd)->a_balign = obj_bsssec (abfd)->alignment_power;
-
- exec_hdr (abfd)->a_tload = obj_textsec (abfd)->vma;
- exec_hdr (abfd)->a_dload = obj_datasec (abfd)->vma;
-
- 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_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt)
- return FALSE;
-
- /* Now write out reloc info, followed by syms and strings */
- if (bfd_get_symcount (abfd) != 0)
- {
- /* Make sure {CALL,BAL}NAME symbols remain adjacent on output
- by sorting. This is complicated by the fact that stabs are
- also ordered. Solve this by shifting all stabs to the end
- in order, then sorting the rest. */
-
- asymbol **outsyms, **p, **q;
-
- outsyms = bfd_get_outsymbols (abfd);
- p = outsyms + bfd_get_symcount (abfd);
-
- for (q = p--; p >= outsyms; p--)
- {
- if ((*p)->flags & BSF_DEBUGGING)
- {
- asymbol *t = *--q;
- *q = *p;
- *p = t;
- }
- }
-
- if (q > outsyms)
- 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)
- != 0)
- return FALSE;
-
- if (! aout_32_write_syms (abfd))
- return FALSE;
-
- if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET)
- != 0)
- return FALSE;
-
- if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd)))
- return FALSE;
- if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET)
- != 0)
- return FALSE;
-
- if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd)))
- return FALSE;
- }
- return TRUE;
-}
-
-/* Some reloc hackery. */
-
-#define CALLS 0x66003800 /* Template for 'calls' instruction */
-#define BAL 0x0b000000 /* Template for 'bal' instruction */
-#define BAL_MASK 0x00ffffff
-#define BALX 0x85f00000 /* Template for 'balx' instruction */
-#define BALX_MASK 0x0007ffff
-#define CALL 0x09000000
-#define PCREL13_MASK 0x1fff
-
-#define output_addr(sec) ((sec)->output_offset+(sec)->output_section->vma)
-
-/* Magic to turn callx into calljx. */
-
-static bfd_reloc_status_type
-calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section)
- bfd *abfd;
- struct bfd_link_info *link_info;
- arelent *reloc_entry;
- PTR src;
- PTR dst;
- asection *input_section;
-{
- int word = bfd_get_32 (abfd, src);
- asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr);
- aout_symbol_type *symbol = aout_symbol (symbol_in);
- bfd_vma value;
-
- value = get_value (reloc_entry, link_info, input_section);
-
- if (IS_CALLNAME (symbol->other))
- {
- aout_symbol_type *balsym = symbol+1;
- int inst = bfd_get_32 (abfd, (bfd_byte *) src-4);
- /* The next symbol should be an N_BALNAME. */
- BFD_ASSERT (IS_BALNAME (balsym->other));
- inst &= BALX_MASK;
- inst |= BALX;
- bfd_put_32 (abfd, (bfd_vma) inst, (bfd_byte *) dst-4);
- symbol = balsym;
- value = (symbol->symbol.value
- + output_addr (symbol->symbol.section));
- }
-
- word += value + reloc_entry->addend;
-
- bfd_put_32 (abfd, (bfd_vma) word, dst);
- return bfd_reloc_ok;
-}
-
-/* Magic to turn call into callj. */
-
-static bfd_reloc_status_type
-callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx,
- input_section, shrinking)
- bfd *abfd;
- struct bfd_link_info *link_info;
- arelent *reloc_entry;
- PTR data;
- unsigned int srcidx;
- unsigned int dstidx;
- asection *input_section;
- bfd_boolean shrinking;
-{
- int word = bfd_get_32 (abfd, (bfd_byte *) data + srcidx);
- asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr);
- aout_symbol_type *symbol = aout_symbol (symbol_in);
- bfd_vma value;
-
- value = get_value (reloc_entry, link_info, input_section);
-
- if (IS_OTHER(symbol->other))
- {
- /* Call to a system procedure - replace code with system
- procedure number. */
- word = CALLS | (symbol->other - 1);
- }
- else if (IS_CALLNAME(symbol->other))
- {
- aout_symbol_type *balsym = symbol+1;
-
- /* The next symbol should be an N_BALNAME. */
- BFD_ASSERT(IS_BALNAME(balsym->other));
-
- /* We are calling a leaf, so replace the call instruction with a
- bal. */
- word = BAL | ((word
- + output_addr (balsym->symbol.section)
- + balsym->symbol.value + reloc_entry->addend
- - dstidx
- - output_addr (input_section))
- & BAL_MASK);
- }
- else if ((symbol->symbol.flags & BSF_SECTION_SYM) != 0)
- {
- /* A callj against a symbol in the same section is a fully
- resolved relative call. We don't need to do anything here.
- If the symbol is not in the same section, I'm not sure what
- to do; fortunately, this case will probably never arise. */
- BFD_ASSERT (! shrinking);
- BFD_ASSERT (symbol->symbol.section == input_section);
- }
- else
- {
- word = CALL | (((word & BAL_MASK)
- + value
- + reloc_entry->addend
- - (shrinking ? dstidx : 0)
- - output_addr (input_section))
- & BAL_MASK);
- }
- bfd_put_32 (abfd, (bfd_vma) word, (bfd_byte *) data + dstidx);
- return bfd_reloc_ok;
-}
-
-/* type rshift size bitsize pcrel bitpos absolute overflow check*/
-
-#define ABS32CODE 0
-#define ABS32CODE_SHRUNK 1
-#define PCREL24 2
-#define CALLJ 3
-#define ABS32 4
-#define PCREL13 5
-#define ABS32_MAYBE_RELAXABLE 1
-#define ABS32_WAS_RELAXABLE 2
-
-#define ALIGNER 10
-#define ALIGNDONE 11
-static reloc_howto_type howto_reloc_callj =
-HOWTO(CALLJ, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
-static reloc_howto_type howto_reloc_abs32 =
-HOWTO(ABS32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"abs32", TRUE, 0xffffffff,0xffffffff,FALSE);
-static reloc_howto_type howto_reloc_pcrel24 =
-HOWTO(PCREL24, 0, 2, 24, TRUE, 0, complain_overflow_signed,0,"pcrel24", TRUE, 0x00ffffff,0x00ffffff,FALSE);
-
-static reloc_howto_type howto_reloc_pcrel13 =
-HOWTO(PCREL13, 0, 2, 13, TRUE, 0, complain_overflow_signed,0,"pcrel13", TRUE, 0x00001fff,0x00001fff,FALSE);
-
-static reloc_howto_type howto_reloc_abs32codeshrunk =
-HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callx->callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
-
-static reloc_howto_type howto_reloc_abs32code =
-HOWTO(ABS32CODE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"callx", TRUE, 0xffffffff,0xffffffff,FALSE);
-
-static reloc_howto_type howto_align_table[] = {
- HOWTO (ALIGNER, 0, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "align16", FALSE, 0, 0, FALSE),
- HOWTO (ALIGNER, 0, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "align32", FALSE, 0, 0, FALSE),
- HOWTO (ALIGNER, 0, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "align64", FALSE, 0, 0, FALSE),
- HOWTO (ALIGNER, 0, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "align128", FALSE, 0, 0, FALSE),
-};
-
-static reloc_howto_type howto_done_align_table[] = {
- HOWTO (ALIGNDONE, 0x1, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "donealign16", FALSE, 0, 0, FALSE),
- HOWTO (ALIGNDONE, 0x3, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "donealign32", FALSE, 0, 0, FALSE),
- HOWTO (ALIGNDONE, 0x7, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "donealign64", FALSE, 0, 0, FALSE),
- HOWTO (ALIGNDONE, 0xf, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "donealign128", FALSE, 0, 0, FALSE),
-};
-
-static reloc_howto_type *
-b_out_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- default:
- return 0;
- case BFD_RELOC_I960_CALLJ:
- return &howto_reloc_callj;
- case BFD_RELOC_32:
- case BFD_RELOC_CTOR:
- return &howto_reloc_abs32;
- case BFD_RELOC_24_PCREL:
- return &howto_reloc_pcrel24;
- }
-}
-
-/* Allocate enough room for all the reloc entries, plus pointers to them all. */
-
-static bfd_boolean
-b_out_slurp_reloc_table (abfd, asect, symbols)
- bfd *abfd;
- sec_ptr asect;
- asymbol **symbols;
-{
- register struct relocation_info *rptr;
- 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;
- bfd_size_type reloc_size, amt;
- struct relocation_info *relocs;
- arelent *reloc_cache;
-
- if (asect->relocation)
- return TRUE;
-
- if (!aout_32_slurp_symbol_table (abfd))
- return FALSE;
-
- if (asect == obj_datasec (abfd))
- {
- reloc_size = exec_hdr(abfd)->a_drsize;
- goto doit;
- }
-
- if (asect == obj_textsec (abfd))
- {
- reloc_size = exec_hdr(abfd)->a_trsize;
- goto doit;
- }
-
- if (asect == obj_bsssec (abfd))
- {
- reloc_size = 0;
- goto doit;
- }
-
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
-
- doit:
- if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
- return FALSE;
- count = reloc_size / sizeof (struct relocation_info);
-
- relocs = (struct relocation_info *) bfd_malloc (reloc_size);
- if (!relocs && reloc_size != 0)
- return FALSE;
-
- amt = ((bfd_size_type) count + 1) * sizeof (arelent);
- reloc_cache = (arelent *) bfd_malloc (amt);
- if (!reloc_cache)
- {
- if (relocs != NULL)
- free (relocs);
- return FALSE;
- }
-
- if (bfd_bread ((PTR) relocs, reloc_size, abfd) != reloc_size)
- {
- free (reloc_cache);
- if (relocs != NULL)
- free (relocs);
- return FALSE;
- }
-
- if (bfd_header_big_endian (abfd))
- {
- /* Big-endian bit field allocation order. */
- pcrel_mask = 0x80;
- extern_mask = 0x10;
- incode_mask = 0x08;
- callj_mask = 0x02;
- size_mask = 0x20;
- length_shift = 5;
- }
- else
- {
- /* Little-endian bit field allocation order. */
- pcrel_mask = 0x01;
- extern_mask = 0x08;
- incode_mask = 0x10;
- callj_mask = 0x40;
- size_mask = 0x02;
- length_shift = 1;
- }
-
- for (rptr = relocs, cache_ptr = reloc_cache, counter = 0;
- counter < count;
- counter++, rptr++, cache_ptr++)
- {
- unsigned char *raw = (unsigned char *)rptr;
- unsigned int symnum;
-
- cache_ptr->address = H_GET_32 (abfd, raw + 0);
- cache_ptr->howto = 0;
-
- if (bfd_header_big_endian (abfd))
- symnum = (raw[4] << 16) | (raw[5] << 8) | raw[6];
- else
- symnum = (raw[6] << 16) | (raw[5] << 8) | raw[4];
-
- if (raw[7] & extern_mask)
- {
- /* If this is set then the r_index is an index into the symbol table;
- if the bit is not set then r_index contains a section map.
- We either fill in the sym entry with a pointer to the symbol,
- or point to the correct section. */
- cache_ptr->sym_ptr_ptr = symbols + symnum;
- cache_ptr->addend = 0;
- }
- else
- {
- /* In a.out symbols are relative to the beginning of the
- file rather than sections ?
- (look in translate_from_native_sym_flags)
- The reloc entry addend has added to it the offset into the
- file of the data, so subtract the base to make the reloc
- section relative. */
- int s;
-
- /* Sign-extend symnum from 24 bits to whatever host uses. */
- s = symnum;
- if (s & (1 << 23))
- s |= (~0) << 24;
-
- cache_ptr->sym_ptr_ptr = (asymbol **)NULL;
- switch (s)
- {
- case N_TEXT:
- case N_TEXT | N_EXT:
- cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr;
- cache_ptr->addend = - obj_textsec (abfd)->vma;
- break;
- case N_DATA:
- case N_DATA | N_EXT:
- cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr;
- cache_ptr->addend = - obj_datasec (abfd)->vma;
- break;
- case N_BSS:
- case N_BSS | N_EXT:
- cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr;
- cache_ptr->addend = - obj_bsssec (abfd)->vma;
- break;
- case N_ABS:
- case N_ABS | N_EXT:
- cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr;
- cache_ptr->addend = 0;
- break;
- case -2: /* .align */
- if (raw[7] & pcrel_mask)
- {
- cache_ptr->howto = &howto_align_table[(raw[7] >> length_shift) & 3];
- cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- }
- else
- {
- /* .org? */
- abort ();
- }
- cache_ptr->addend = 0;
- break;
- default:
- BFD_ASSERT(0);
- break;
- }
- }
-
- /* The i960 only has a few relocation types:
- abs 32-bit and pcrel 24bit. except for callj's! */
- if (cache_ptr->howto != 0)
- ;
- else if (raw[7] & callj_mask)
- {
- cache_ptr->howto = &howto_reloc_callj;
- }
- else if ( raw[7] & pcrel_mask)
- {
- if (raw[7] & size_mask)
- cache_ptr->howto = &howto_reloc_pcrel13;
- else
- cache_ptr->howto = &howto_reloc_pcrel24;
- }
- else
- {
- if (raw[7] & incode_mask)
- cache_ptr->howto = &howto_reloc_abs32code;
- else
- cache_ptr->howto = &howto_reloc_abs32;
- }
-
- if (cache_ptr->address < prev_addr)
- {
- /* Ouch! this reloc is out of order, insert into the right place. */
- arelent tmp;
- arelent *cursor = cache_ptr-1;
- bfd_vma stop = cache_ptr->address;
-
- tmp = *cache_ptr;
- while (cursor->address > stop && cursor >= reloc_cache)
- {
- cursor[1] = cursor[0];
- cursor--;
- }
-
- cursor[1] = tmp;
- }
- else
- {
- prev_addr = cache_ptr->address;
- }
- }
-
- if (relocs != NULL)
- free (relocs);
- asect->relocation = reloc_cache;
- asect->reloc_count = count;
-
- return TRUE;
-}
-
-static bfd_boolean
-b_out_squirt_out_relocs (abfd, section)
- bfd *abfd;
- asection *section;
-{
- arelent **generic;
- int r_extern = 0;
- int r_idx;
- int incode_mask;
- int len_1;
- unsigned int count = section->reloc_count;
- struct relocation_info *native, *natptr;
- bfd_size_type natsize;
- int extern_mask, pcrel_mask, len_2, callj_mask;
-
- if (count == 0)
- return TRUE;
-
- 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;
-
- if (bfd_header_big_endian (abfd))
- {
- /* Big-endian bit field allocation order. */
- pcrel_mask = 0x80;
- extern_mask = 0x10;
- len_2 = 0x40;
- len_1 = 0x20;
- callj_mask = 0x02;
- incode_mask = 0x08;
- }
- else
- {
- /* Little-endian bit field allocation order. */
- pcrel_mask = 0x01;
- extern_mask = 0x08;
- len_2 = 0x04;
- len_1 = 0x02;
- callj_mask = 0x40;
- incode_mask = 0x10;
- }
-
- for (natptr = native; count > 0; --count, ++natptr, ++generic)
- {
- arelent *g = *generic;
- unsigned char *raw = (unsigned char *)natptr;
- asymbol *sym = *(g->sym_ptr_ptr);
- asection *output_section = sym->section->output_section;
-
- 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;
- /* FIXME: Need callj stuff here, and to check the howto entries to
- be sure they are real for this architecture. */
- if (g->howto== &howto_reloc_callj)
- raw[7] = callj_mask + pcrel_mask + len_2;
- else if (g->howto == &howto_reloc_pcrel24)
- raw[7] = pcrel_mask + len_2;
- else if (g->howto == &howto_reloc_pcrel13)
- raw[7] = pcrel_mask + len_1;
- else if (g->howto == &howto_reloc_abs32code)
- raw[7] = len_2 + incode_mask;
- else if (g->howto >= howto_align_table
- && g->howto <= (howto_align_table
- + sizeof (howto_align_table) / sizeof (howto_align_table[0])
- - 1))
- {
- /* symnum == -2; extern_mask not set, pcrel_mask set. */
- r_idx = -2;
- r_extern = 0;
- raw[7] = (pcrel_mask
- | ((g->howto - howto_align_table) << 1));
- }
- else
- raw[7] = len_2;
-
- if (r_idx != 0)
- /* Already mucked with r_extern, r_idx. */;
- else if (bfd_is_com_section (output_section)
- || bfd_is_abs_section (output_section)
- || bfd_is_und_section (output_section))
- {
- if (bfd_abs_section_ptr->symbol == sym)
- {
- /* Whoops, looked like an abs symbol, but is really an offset
- from the abs section. */
- r_idx = 0;
- r_extern = 0;
- }
- else
- {
- /* Fill in symbol. */
- r_extern = 1;
- r_idx = (*g->sym_ptr_ptr)->udata.i;
- }
- }
- else
- {
- /* Just an ordinary section. */
- r_extern = 0;
- r_idx = output_section->target_index;
- }
-
- if (bfd_header_big_endian (abfd))
- {
- raw[4] = (unsigned char) (r_idx >> 16);
- raw[5] = (unsigned char) (r_idx >> 8);
- raw[6] = (unsigned char) (r_idx );
- }
- else
- {
- raw[6] = (unsigned char) (r_idx >> 16);
- raw[5] = (unsigned char) (r_idx>> 8);
- raw[4] = (unsigned char) (r_idx );
- }
-
- if (r_extern)
- raw[7] |= extern_mask;
- }
-
- if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
- {
- free ((PTR)native);
- return FALSE;
- }
-
- free ((PTR)native);
-
- return TRUE;
-}
-
-/* This is stupid. This function should be a boolean predicate. */
-
-static long
-b_out_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
-{
- arelent *tblptr;
- unsigned int count;
-
- if ((section->flags & SEC_CONSTRUCTOR) != 0)
- {
- arelent_chain *chain = section->constructor_chain;
-
- for (count = 0; count < section->reloc_count; count++)
- {
- *relptr++ = &chain->relent;
- chain = chain->next;
- }
- }
- else
- {
- if (section->relocation == NULL
- && ! b_out_slurp_reloc_table (abfd, section, symbols))
- return -1;
-
- tblptr = section->relocation;
- for (count = 0; count++ < section->reloc_count;)
- *relptr++ = tblptr++;
- }
-
- *relptr = NULL;
-
- return section->reloc_count;
-}
-
-static long
-b_out_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
-{
- if (bfd_get_format (abfd) != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- if (asect->flags & SEC_CONSTRUCTOR)
- return sizeof (arelent *) * (asect->reloc_count + 1);
-
- if (asect == obj_datasec (abfd))
- return (sizeof (arelent *) *
- ((exec_hdr(abfd)->a_drsize / sizeof (struct relocation_info))
- +1));
-
- if (asect == obj_textsec (abfd))
- return (sizeof (arelent *) *
- ((exec_hdr(abfd)->a_trsize / sizeof (struct relocation_info))
- +1));
-
- if (asect == obj_bsssec (abfd))
- return 0;
-
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
-}
-
-
-static bfd_boolean
-b_out_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- if (! abfd->output_has_begun)
- {
- /* Set by bfd.c handler. */
- if (! aout_32_make_sections (abfd))
- return FALSE;
-
- obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
- obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos
- + obj_textsec (abfd)->_raw_size;
- }
-
- /* Regardless, once we know what we're doing, we might as well get going. */
- if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
- return FALSE;
-
- if (count == 0)
- return TRUE;
-
- return bfd_bwrite ((PTR) location, count, abfd) == count;
-}
-
-static bfd_boolean
-b_out_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
-{
- bfd_default_set_arch_mach(abfd, arch, machine);
-
- if (arch == bfd_arch_unknown) /* Unknown machine arch is OK. */
- return TRUE;
-
- if (arch == bfd_arch_i960) /* i960 default is OK. */
- switch (machine)
- {
- case bfd_mach_i960_core:
- case bfd_mach_i960_kb_sb:
- case bfd_mach_i960_mc:
- case bfd_mach_i960_xa:
- case bfd_mach_i960_ca:
- case bfd_mach_i960_ka_sa:
- case bfd_mach_i960_jx:
- case bfd_mach_i960_hx:
- case 0:
- return TRUE;
- default:
- return FALSE;
- }
-
- return FALSE;
-}
-
-static int
-b_out_sizeof_headers (ignore_abfd, ignore)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- bfd_boolean ignore ATTRIBUTE_UNUSED;
-{
- return sizeof (struct internal_exec);
-}
-
-
-static bfd_vma
-get_value (reloc, link_info, input_section)
- arelent *reloc;
- struct bfd_link_info *link_info;
- asection *input_section;
-{
- bfd_vma value;
- asymbol *symbol = *(reloc->sym_ptr_ptr);
-
- /* A symbol holds a pointer to a section, and an offset from the
- base of the section. To relocate, we find where the section will
- live in the output and add that in. */
- if (bfd_is_und_section (symbol->section))
- {
- struct bfd_link_hash_entry *h;
-
- /* The symbol is undefined in this BFD. Look it up in the
- global linker hash table. FIXME: This should be changed when
- we convert b.out to use a specific final_link function and
- change the interface to bfd_relax_section to not require the
- generic symbols. */
- h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info,
- bfd_asymbol_name (symbol),
- FALSE, FALSE, TRUE);
- if (h != (struct bfd_link_hash_entry *) NULL
- && (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_defweak))
- value = h->u.def.value + output_addr (h->u.def.section);
- else if (h != (struct bfd_link_hash_entry *) NULL
- && h->type == bfd_link_hash_common)
- value = h->u.c.size;
- else
- {
- if (! ((*link_info->callbacks->undefined_symbol)
- (link_info, bfd_asymbol_name (symbol),
- input_section->owner, input_section, reloc->address,
- TRUE)))
- abort ();
- value = 0;
- }
- }
- else
- {
- value = symbol->value + output_addr (symbol->section);
- }
-
- /* Add the value contained in the relocation. */
- value += reloc->addend;
-
- return value;
-}
-
-static void
-perform_slip (abfd, slip, input_section, value)
- bfd *abfd;
- unsigned int slip;
- asection *input_section;
- bfd_vma value;
-{
- asymbol **s;
-
- s = _bfd_generic_link_get_symbols (abfd);
- BFD_ASSERT (s != (asymbol **) NULL);
-
- /* Find all symbols past this point, and make them know
- what's happened. */
- while (*s)
- {
- asymbol *p = *s;
-
- if (p->section == input_section)
- {
- /* This was pointing into this section, so mangle it. */
- if (p->value > value)
- {
- p->value -=slip;
-
- if (p->udata.p != NULL)
- {
- struct generic_link_hash_entry *h;
-
- h = (struct generic_link_hash_entry *) p->udata.p;
- BFD_ASSERT (h->root.type == bfd_link_hash_defined);
- h->root.u.def.value -= slip;
- BFD_ASSERT (h->root.u.def.value == p->value);
- }
- }
- }
- s++;
- }
-}
-
-/* This routine works out if the thing we want to get to can be
- reached with a 24bit offset instead of a 32 bit one.
- If it can, then it changes the amode. */
-
-static int
-abs32code (abfd, input_section, r, shrink, link_info)
- bfd *abfd;
- asection *input_section;
- arelent *r;
- unsigned int shrink;
- struct bfd_link_info *link_info;
-{
- bfd_vma value = get_value (r, link_info, input_section);
- bfd_vma dot = output_addr (input_section) + r->address;
- bfd_vma gap;
-
- /* See if the address we're looking at within 2^23 bytes of where
- we are, if so then we can use a small branch rather than the
- jump we were going to. */
- gap = value - (dot - shrink);
-
- if (-1 << 23 < (long)gap && (long)gap < 1 << 23)
- {
- /* Change the reloc type from 32bitcode possible 24, to 24bit
- possible 32. */
- r->howto = &howto_reloc_abs32codeshrunk;
- /* The place to relc moves back by four bytes. */
- r->address -=4;
-
- /* This will be four bytes smaller in the long run. */
- shrink += 4 ;
- perform_slip (abfd, 4, input_section, r->address-shrink + 4);
- }
-
- return shrink;
-}
-
-static int
-aligncode (abfd, input_section, r, shrink)
- bfd *abfd;
- asection *input_section;
- arelent *r;
- unsigned int shrink;
-{
- bfd_vma dot = output_addr (input_section) + r->address;
- bfd_vma gap;
- bfd_vma old_end;
- bfd_vma new_end;
- unsigned int shrink_delta;
- int size = r->howto->size;
-
- /* Reduce the size of the alignment so that it's still aligned but
- smaller - the current size is already the same size as or bigger
- than the alignment required. */
-
- /* Calculate the first byte following the padding before we optimize. */
- old_end = ((dot + size ) & ~size) + size+1;
- /* Work out where the new end will be - remember that we're smaller
- than we used to be. */
- new_end = ((dot - shrink + size) & ~size);
-
- /* This is the new end. */
- gap = old_end - ((dot + size) & ~size);
-
- shrink_delta = (old_end - new_end) - shrink;
-
- if (shrink_delta)
- {
- /* Change the reloc so that it knows how far to align to. */
- r->howto = howto_done_align_table + (r->howto - howto_align_table);
-
- /* Encode the stuff into the addend - for future use we need to
- know how big the reloc used to be. */
- r->addend = old_end - dot + r->address;
-
- /* This will be N bytes smaller in the long run, adjust all the symbols. */
- perform_slip (abfd, shrink_delta, input_section, r->address - shrink);
- shrink += shrink_delta;
- }
-
- return shrink;
-}
-
-static bfd_boolean
-b_out_bfd_relax_section (abfd, i, link_info, again)
- bfd *abfd;
- asection *i;
- struct bfd_link_info *link_info;
- bfd_boolean *again;
-{
- /* Get enough memory to hold the stuff. */
- bfd *input_bfd = i->owner;
- asection *input_section = i;
- unsigned int shrink = 0 ;
- arelent **reloc_vector = NULL;
- long reloc_size = bfd_get_reloc_upper_bound (input_bfd,
- input_section);
-
- if (reloc_size < 0)
- return FALSE;
-
- /* We only run this relaxation once. It might work to run it
- multiple times, but it hasn't been tested. */
- *again = FALSE;
-
- if (reloc_size)
- {
- long reloc_count;
-
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
- if (reloc_vector == NULL && reloc_size != 0)
- goto error_return;
-
- /* Get the relocs and think about them. */
- reloc_count =
- bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
- _bfd_generic_link_get_symbols (input_bfd));
- if (reloc_count < 0)
- goto error_return;
- if (reloc_count > 0)
- {
- arelent **parent;
-
- for (parent = reloc_vector; *parent; parent++)
- {
- arelent *r = *parent;
-
- switch (r->howto->type)
- {
- case ALIGNER:
- /* An alignment reloc. */
- shrink = aligncode (abfd, input_section, r, shrink);
- break;
- case ABS32CODE:
- /* A 32bit reloc in an addressing mode. */
- shrink = abs32code (input_bfd, input_section, r, shrink,
- link_info);
- break;
- case ABS32CODE_SHRUNK:
- shrink += 4;
- break;
- }
- }
- }
- }
- input_section->_cooked_size = input_section->_raw_size - shrink;
-
- if (reloc_vector != NULL)
- free (reloc_vector);
- return TRUE;
- error_return:
- if (reloc_vector != NULL)
- free (reloc_vector);
- return FALSE;
-}
-
-static bfd_byte *
-b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
- data, relocatable, symbols)
- bfd *output_bfd;
- struct bfd_link_info *link_info;
- struct bfd_link_order *link_order;
- bfd_byte *data;
- bfd_boolean relocatable;
- asymbol **symbols;
-{
- /* Get enough memory to hold the stuff. */
- bfd *input_bfd = link_order->u.indirect.section->owner;
- asection *input_section = link_order->u.indirect.section;
- long reloc_size = bfd_get_reloc_upper_bound (input_bfd,
- input_section);
- arelent **reloc_vector = NULL;
- long reloc_count;
-
- if (reloc_size < 0)
- goto error_return;
-
- /* If producing relocatable output, don't bother to relax. */
- if (relocatable)
- return bfd_generic_get_relocated_section_contents (output_bfd, link_info,
- link_order,
- data, relocatable,
- symbols);
-
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
- if (reloc_vector == NULL && reloc_size != 0)
- goto error_return;
-
- input_section->reloc_done = 1;
-
- /* Read in the section. */
- BFD_ASSERT (bfd_get_section_contents (input_bfd,
- input_section,
- data,
- (bfd_vma) 0,
- input_section->_raw_size));
-
- reloc_count = bfd_canonicalize_reloc (input_bfd,
- input_section,
- reloc_vector,
- symbols);
- if (reloc_count < 0)
- goto error_return;
- if (reloc_count > 0)
- {
- arelent **parent = reloc_vector;
- arelent *reloc ;
- unsigned int dst_address = 0;
- unsigned int src_address = 0;
- unsigned int run;
- unsigned int idx;
-
- /* Find how long a run we can do. */
- while (dst_address < link_order->size)
- {
- reloc = *parent;
- if (reloc)
- {
- /* Note that the relaxing didn't tie up the addresses in the
- relocation, so we use the original address to work out the
- run of non-relocated data. */
- BFD_ASSERT (reloc->address >= src_address);
- run = reloc->address - src_address;
- parent++;
- }
- else
- {
- run = link_order->size - dst_address;
- }
-
- /* Copy the bytes. */
- for (idx = 0; idx < run; idx++)
- data[dst_address++] = data[src_address++];
-
- /* Now do the relocation. */
- if (reloc)
- {
- switch (reloc->howto->type)
- {
- case ABS32CODE:
- calljx_callback (input_bfd, link_info, reloc,
- src_address + data, dst_address + data,
- input_section);
- src_address += 4;
- dst_address += 4;
- break;
- case ABS32:
- bfd_put_32 (input_bfd,
- (bfd_get_32 (input_bfd, data + src_address)
- + get_value (reloc, link_info, input_section)),
- data + dst_address);
- src_address += 4;
- dst_address += 4;
- break;
- case CALLJ:
- callj_callback (input_bfd, link_info, reloc, data,
- src_address, dst_address, input_section,
- FALSE);
- src_address += 4;
- dst_address += 4;
- break;
- case ALIGNDONE:
- BFD_ASSERT (reloc->addend >= src_address);
- BFD_ASSERT ((bfd_vma) reloc->addend
- <= input_section->_raw_size);
- src_address = reloc->addend;
- dst_address = ((dst_address + reloc->howto->size)
- & ~reloc->howto->size);
- break;
- case ABS32CODE_SHRUNK:
- /* This used to be a callx, but we've found out that a
- callj will reach, so do the right thing. */
- callj_callback (input_bfd, link_info, reloc, data,
- src_address + 4, dst_address, input_section,
- TRUE);
- dst_address += 4;
- src_address += 8;
- break;
- case PCREL24:
- {
- long int word = bfd_get_32 (input_bfd,
- data + src_address);
- bfd_vma value;
-
- value = get_value (reloc, link_info, input_section);
- word = ((word & ~BAL_MASK)
- | (((word & BAL_MASK)
- + value
- - output_addr (input_section)
- + reloc->addend)
- & BAL_MASK));
-
- bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
- dst_address += 4;
- src_address += 4;
-
- }
- break;
- case PCREL13:
- {
- long int word = bfd_get_32 (input_bfd,
- data + src_address);
- bfd_vma value;
-
- value = get_value (reloc, link_info, input_section);
- word = ((word & ~PCREL13_MASK)
- | (((word & PCREL13_MASK)
- + value
- + reloc->addend
- - output_addr (input_section))
- & PCREL13_MASK));
-
- bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
- dst_address += 4;
- src_address += 4;
- }
- break;
-
- default:
- abort ();
- }
- }
- }
- }
- if (reloc_vector != NULL)
- free (reloc_vector);
- return data;
- error_return:
- if (reloc_vector != NULL)
- free (reloc_vector);
- return NULL;
-}
-
-
-/* Build the transfer vectors for Big and Little-Endian B.OUT files. */
-
-#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
-
-#define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms
-#define b_out_bfd_final_link _bfd_generic_final_link
-#define b_out_bfd_link_split_section _bfd_generic_link_split_section
-#define b_out_bfd_gc_sections bfd_generic_gc_sections
-#define b_out_bfd_merge_sections bfd_generic_merge_sections
-#define b_out_bfd_discard_group bfd_generic_discard_group
-
-#define aout_32_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-extern const bfd_target b_out_vec_little_host;
-
-const bfd_target b_out_vec_big_host =
-{
- "b.out.big", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_BIG, /* hdr byte order is big */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- '_', /* symbol leading char */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
-
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
- {_bfd_dummy_target, b_out_object_p, /* bfd_check_format */
- bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, b_out_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, b_out_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (aout_32),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
- BFD_JUMP_TABLE_SYMBOLS (aout_32),
- BFD_JUMP_TABLE_RELOCS (b_out),
- BFD_JUMP_TABLE_WRITE (b_out),
- BFD_JUMP_TABLE_LINK (b_out),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & b_out_vec_little_host,
-
- (PTR) 0,
-};
-
-const bfd_target b_out_vec_little_host =
-{
- "b.out.little", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- '_', /* symbol leading char */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
- {_bfd_dummy_target, b_out_object_p, /* bfd_check_format */
- bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, b_out_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, b_out_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (aout_32),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
- BFD_JUMP_TABLE_SYMBOLS (aout_32),
- BFD_JUMP_TABLE_RELOCS (b_out),
- BFD_JUMP_TABLE_WRITE (b_out),
- BFD_JUMP_TABLE_LINK (b_out),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & b_out_vec_big_host,
-
- (PTR) 0
-};
diff --git a/contrib/binutils/bfd/cache.c b/contrib/binutils/bfd/cache.c
deleted file mode 100644
index 7d056ea..0000000
--- a/contrib/binutils/bfd/cache.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* BFD library -- caching of file descriptors.
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
-
- Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- File caching
-
- The file caching mechanism is embedded within BFD and allows
- the application to open as many BFDs as it wants without
- regard to the underlying operating system's file descriptor
- limit (often as low as 20 open files). The module in
- <<cache.c>> maintains a least recently used list of
- <<BFD_CACHE_MAX_OPEN>> files, and exports the name
- <<bfd_cache_lookup>>, which runs around and makes sure that
- the required BFD is open. If not, then it chooses a file to
- close, closes it and opens the one wanted, returning its file
- handle.
-
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-static bfd_boolean bfd_cache_delete (bfd *);
-
-/*
-INTERNAL_FUNCTION
- BFD_CACHE_MAX_OPEN macro
-
-DESCRIPTION
- The maximum number of files which the cache will keep open at
- one time.
-
-.#define BFD_CACHE_MAX_OPEN 10
-
-*/
-
-/* The number of BFD files we have open. */
-
-static int open_files;
-
-/*
-INTERNAL_FUNCTION
- bfd_last_cache
-
-SYNOPSIS
- extern bfd *bfd_last_cache;
-
-DESCRIPTION
- Zero, or a pointer to the topmost BFD on the chain. This is
- used by the <<bfd_cache_lookup>> macro in @file{libbfd.h} to
- determine when it can avoid a function call.
-*/
-
-bfd *bfd_last_cache;
-
-/*
- INTERNAL_FUNCTION
- bfd_cache_lookup
-
- DESCRIPTION
- Check to see if the required BFD is the same as the last one
- looked up. If so, then it can use the stream in the BFD with
- impunity, since it can't have changed since the last lookup;
- otherwise, it has to perform the complicated lookup function.
-
- .#define bfd_cache_lookup(x) \
- . ((x)==bfd_last_cache? \
- . (FILE*) (bfd_last_cache->iostream): \
- . bfd_cache_lookup_worker(x))
-
- */
-
-/* Insert a BFD into the cache. */
-
-static void
-insert (bfd *abfd)
-{
- if (bfd_last_cache == NULL)
- {
- abfd->lru_next = abfd;
- abfd->lru_prev = abfd;
- }
- else
- {
- abfd->lru_next = bfd_last_cache;
- abfd->lru_prev = bfd_last_cache->lru_prev;
- abfd->lru_prev->lru_next = abfd;
- abfd->lru_next->lru_prev = abfd;
- }
- bfd_last_cache = abfd;
-}
-
-/* Remove a BFD from the cache. */
-
-static void
-snip (bfd *abfd)
-{
- abfd->lru_prev->lru_next = abfd->lru_next;
- abfd->lru_next->lru_prev = abfd->lru_prev;
- if (abfd == bfd_last_cache)
- {
- bfd_last_cache = abfd->lru_next;
- if (abfd == bfd_last_cache)
- bfd_last_cache = NULL;
- }
-}
-
-/* We need to open a new file, and the cache is full. Find the least
- recently used cacheable BFD and close it. */
-
-static bfd_boolean
-close_one (void)
-{
- register bfd *kill;
-
- if (bfd_last_cache == NULL)
- kill = NULL;
- else
- {
- for (kill = bfd_last_cache->lru_prev;
- ! kill->cacheable;
- kill = kill->lru_prev)
- {
- if (kill == bfd_last_cache)
- {
- kill = NULL;
- break;
- }
- }
- }
-
- if (kill == NULL)
- {
- /* There are no open cacheable BFD's. */
- return TRUE;
- }
-
- kill->where = real_ftell ((FILE *) kill->iostream);
-
- return bfd_cache_delete (kill);
-}
-
-/* Close a BFD and remove it from the cache. */
-
-static bfd_boolean
-bfd_cache_delete (bfd *abfd)
-{
- bfd_boolean ret;
-
- if (fclose ((FILE *) abfd->iostream) == 0)
- ret = TRUE;
- else
- {
- ret = FALSE;
- bfd_set_error (bfd_error_system_call);
- }
-
- snip (abfd);
-
- abfd->iostream = NULL;
- --open_files;
-
- return ret;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_cache_init
-
-SYNOPSIS
- bfd_boolean bfd_cache_init (bfd *abfd);
-
-DESCRIPTION
- Add a newly opened BFD to the cache.
-*/
-
-bfd_boolean
-bfd_cache_init (bfd *abfd)
-{
- BFD_ASSERT (abfd->iostream != NULL);
- if (open_files >= BFD_CACHE_MAX_OPEN)
- {
- if (! close_one ())
- return FALSE;
- }
- insert (abfd);
- ++open_files;
- return TRUE;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_cache_close
-
-SYNOPSIS
- bfd_boolean bfd_cache_close (bfd *abfd);
-
-DESCRIPTION
- Remove the BFD @var{abfd} from the cache. If the attached file is open,
- then close it too.
-
-RETURNS
- <<FALSE>> is returned if closing the file fails, <<TRUE>> is
- returned if all is well.
-*/
-
-bfd_boolean
-bfd_cache_close (bfd *abfd)
-{
- if (abfd->iostream == NULL
- || (abfd->flags & BFD_IN_MEMORY) != 0)
- return TRUE;
-
- return bfd_cache_delete (abfd);
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_open_file
-
-SYNOPSIS
- FILE* bfd_open_file (bfd *abfd);
-
-DESCRIPTION
- Call the OS to open a file for @var{abfd}. Return the <<FILE *>>
- (possibly <<NULL>>) that results from this operation. Set up the
- BFD so that future accesses know the file is open. If the <<FILE *>>
- returned is <<NULL>>, then it won't have been put in the
- cache, so it won't have to be removed from it.
-*/
-
-FILE *
-bfd_open_file (bfd *abfd)
-{
- abfd->cacheable = TRUE; /* Allow it to be closed later. */
-
- if (open_files >= BFD_CACHE_MAX_OPEN)
- {
- if (! close_one ())
- return NULL;
- }
-
- switch (abfd->direction)
- {
- case read_direction:
- case no_direction:
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RB);
- break;
- case both_direction:
- case write_direction:
- if (abfd->opened_once)
- {
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB);
- if (abfd->iostream == NULL)
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
- }
- else
- {
- /* Create the file.
-
- Some operating systems won't let us overwrite a running
- binary. For them, we want to unlink the file first.
-
- However, gcc 2.95 will create temporary files using
- O_EXCL and tight permissions to prevent other users from
- substituting other .o files during the compilation. gcc
- will then tell the assembler to use the newly created
- file as an output file. If we unlink the file here, we
- open a brief window when another user could still
- substitute a file.
-
- So we unlink the output file if and only if it has
- non-zero size. */
-#ifndef __MSDOS__
- /* Don't do this for MSDOS: it doesn't care about overwriting
- a running binary, but if this file is already open by
- another BFD, we will be in deep trouble if we delete an
- open file. In fact, objdump does just that if invoked with
- the --info option. */
- struct stat s;
-
- if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
- unlink (abfd->filename);
-#endif
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
- abfd->opened_once = TRUE;
- }
- break;
- }
-
- if (abfd->iostream != NULL)
- {
- if (! bfd_cache_init (abfd))
- return NULL;
- }
-
- return (FILE *) abfd->iostream;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_cache_lookup_worker
-
-SYNOPSIS
- FILE *bfd_cache_lookup_worker (bfd *abfd);
-
-DESCRIPTION
- Called when the macro <<bfd_cache_lookup>> fails to find a
- quick answer. Find a file descriptor for @var{abfd}. If
- necessary, it open it. If there are already more than
- <<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
- avoid running out of file descriptors.
-*/
-
-FILE *
-bfd_cache_lookup_worker (bfd *abfd)
-{
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- abort ();
-
- if (abfd->my_archive)
- abfd = abfd->my_archive;
-
- if (abfd->iostream != NULL)
- {
- /* Move the file to the start of the cache. */
- if (abfd != bfd_last_cache)
- {
- snip (abfd);
- insert (abfd);
- }
- }
- else
- {
- if (bfd_open_file (abfd) == NULL)
- return NULL;
- if (abfd->where != (unsigned long) abfd->where)
- return NULL;
- if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
- return NULL;
- }
-
- return (FILE *) abfd->iostream;
-}
diff --git a/contrib/binutils/bfd/coff-alpha.c b/contrib/binutils/bfd/coff-alpha.c
deleted file mode 100644
index e9dd416..0000000
--- a/contrib/binutils/bfd/coff-alpha.c
+++ /dev/null
@@ -1,2406 +0,0 @@
-/* BFD back-end for ALPHA Extended-Coff files.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
- Ian Lance Taylor <ian@cygnus.com>.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/ecoff.h"
-#include "coff/alpha.h"
-#include "aout/ar.h"
-#include "libcoff.h"
-#include "libecoff.h"
-
-/* Prototypes for static functions. */
-
-static const bfd_target *alpha_ecoff_object_p
- PARAMS ((bfd *));
-static bfd_boolean alpha_ecoff_bad_format_hook
- PARAMS ((bfd *abfd, PTR filehdr));
-static PTR alpha_ecoff_mkobject_hook
- PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
-static void alpha_ecoff_swap_reloc_in
- PARAMS ((bfd *, PTR, struct internal_reloc *));
-static void alpha_ecoff_swap_reloc_out
- PARAMS ((bfd *, const struct internal_reloc *, PTR));
-static void alpha_adjust_reloc_in
- PARAMS ((bfd *, const struct internal_reloc *, arelent *));
-static void alpha_adjust_reloc_out
- PARAMS ((bfd *, const arelent *, struct internal_reloc *));
-static reloc_howto_type *alpha_bfd_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static bfd_byte *alpha_ecoff_get_relocated_section_contents
- PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *data, bfd_boolean relocatable, asymbol **symbols));
-static bfd_vma alpha_convert_external_reloc
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *,
- struct ecoff_link_hash_entry *));
-static bfd_boolean alpha_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, PTR));
-static bfd_boolean alpha_adjust_headers
- PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));
-static PTR alpha_ecoff_read_ar_hdr
- PARAMS ((bfd *));
-static bfd *alpha_ecoff_get_elt_at_filepos
- PARAMS ((bfd *, file_ptr));
-static bfd *alpha_ecoff_openr_next_archived_file
- PARAMS ((bfd *, bfd *));
-static bfd *alpha_ecoff_get_elt_at_index
- PARAMS ((bfd *, symindex));
-
-/* ECOFF has COFF sections, but the debugging information is stored in
- a completely different format. ECOFF targets use some of the
- swapping routines from coffswap.h, and some of the generic COFF
- routines in coffgen.c, but, unlike the real COFF targets, do not
- use coffcode.h itself.
-
- Get the generic COFF swapping routines, except for the reloc,
- symbol, and lineno ones. Give them ecoff names. Define some
- accessor macros for the large sizes used for Alpha ECOFF. */
-
-#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
-
-#define NO_COFF_RELOCS
-#define NO_COFF_SYMBOLS
-#define NO_COFF_LINENOS
-#define coff_swap_filehdr_in alpha_ecoff_swap_filehdr_in
-#define coff_swap_filehdr_out alpha_ecoff_swap_filehdr_out
-#define coff_swap_aouthdr_in alpha_ecoff_swap_aouthdr_in
-#define coff_swap_aouthdr_out alpha_ecoff_swap_aouthdr_out
-#define coff_swap_scnhdr_in alpha_ecoff_swap_scnhdr_in
-#define coff_swap_scnhdr_out alpha_ecoff_swap_scnhdr_out
-#include "coffswap.h"
-
-/* Get the ECOFF swapping routines. */
-#define ECOFF_64
-#include "ecoffswap.h"
-
-/* How to process the various reloc types. */
-
-static bfd_reloc_status_type reloc_nil
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
-static bfd_reloc_status_type
-reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc ATTRIBUTE_UNUSED;
- asymbol *sym ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
-{
- return bfd_reloc_ok;
-}
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-static reloc_howto_type alpha_howto_table[] =
-{
- /* Reloc type 0 is ignored by itself. However, it appears after a
- GPDISP reloc to identify the location where the low order 16 bits
- of the gp register are loaded. */
- HOWTO (ALPHA_R_IGNORE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "IGNORE", /* name */
- TRUE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A 32 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "REFLONG", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 64 bit reference to a symbol. */
- HOWTO (ALPHA_R_REFQUAD, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "REFQUAD", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 32 bit GP relative offset. This is just like REFLONG except
- that when the value is used the value of the gp register will be
- added in. */
- HOWTO (ALPHA_R_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "GPREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used for an instruction that refers to memory off the GP
- register. The offset is 16 bits of the 32 bit instruction. This
- reloc always seems to be against the .lita section. */
- HOWTO (ALPHA_R_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* This reloc only appears immediately following a LITERAL reloc.
- It identifies a use of the literal. It seems that the linker can
- use this to eliminate a portion of the .lita section. The symbol
- index is special: 1 means the literal address is in the base
- register of a memory format instruction; 2 means the literal
- address is in the byte offset register of a byte-manipulation
- instruction; 3 means the literal address is in the target
- register of a jsr instruction. This does not actually do any
- relocation. */
- HOWTO (ALPHA_R_LITUSE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "LITUSE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Load the gp register. This is always used for a ldah instruction
- which loads the upper 16 bits of the gp register. The next reloc
- will be an IGNORE reloc which identifies the location of the lda
- instruction which loads the lower 16 bits. The symbol index of
- the GPDISP instruction appears to actually be the number of bytes
- between the ldah and lda instructions. This gives two different
- ways to determine where the lda instruction is; I don't know why
- both are used. The value to use for the relocation is the
- difference between the GP value and the current location; the
- load will always be done against a register holding the current
- address. */
- HOWTO (ALPHA_R_GPDISP, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- reloc_nil, /* special_function */
- "GPDISP", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A 21 bit branch. The native assembler generates these for
- branches within the text segment, and also fills in the PC
- relative offset in the instruction. */
- HOWTO (ALPHA_R_BRADDR, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 21, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "BRADDR", /* name */
- TRUE, /* partial_inplace */
- 0x1fffff, /* src_mask */
- 0x1fffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A hint for a jump to a register. */
- HOWTO (ALPHA_R_HINT, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 14, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "HINT", /* name */
- TRUE, /* partial_inplace */
- 0x3fff, /* src_mask */
- 0x3fff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 64 bit PC relative offset. */
- HOWTO (ALPHA_R_SREL64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Push a value on the reloc evaluation stack. */
- HOWTO (ALPHA_R_OP_PUSH, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_PUSH", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Store the value from the stack at the given address. Store it in
- a bitfield of size r_size starting at bit position r_offset. */
- HOWTO (ALPHA_R_OP_STORE, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_STORE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Subtract the reloc address from the value on the top of the
- relocation stack. */
- HOWTO (ALPHA_R_OP_PSUB, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_PSUB", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Shift the value on the top of the relocation stack right by the
- given value. */
- HOWTO (ALPHA_R_OP_PRSHIFT, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "OP_PRSHIFT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Adjust the GP value for a new range in the object file. */
- HOWTO (ALPHA_R_GPVALUE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "GPVALUE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE) /* pcrel_offset */
-};
-
-/* Recognize an Alpha ECOFF file. */
-
-static const bfd_target *
-alpha_ecoff_object_p (abfd)
- bfd *abfd;
-{
- static const bfd_target *ret;
-
- ret = coff_object_p (abfd);
-
- if (ret != NULL)
- {
- asection *sec;
-
- /* Alpha ECOFF has a .pdata section. The lnnoptr field of the
- .pdata section is the number of entries it contains. Each
- entry takes up 8 bytes. The number of entries is required
- since the section is aligned to a 16 byte boundary. When we
- link .pdata sections together, we do not want to include the
- alignment bytes. We handle this on input by faking the size
- of the .pdata section to remove the unwanted alignment bytes.
- On output we will set the lnnoptr field and force the
- alignment. */
- sec = bfd_get_section_by_name (abfd, _PDATA);
- if (sec != (asection *) NULL)
- {
- bfd_size_type size;
-
- size = sec->line_filepos * 8;
- BFD_ASSERT (size == bfd_section_size (abfd, sec)
- || size + 8 == bfd_section_size (abfd, sec));
- if (! bfd_set_section_size (abfd, sec, size))
- return NULL;
- }
- }
-
- return ret;
-}
-
-/* See whether the magic number matches. */
-
-static bfd_boolean
-alpha_ecoff_bad_format_hook (abfd, filehdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- if (ALPHA_ECOFF_BADMAG (*internal_f))
- return FALSE;
-
- return TRUE;
-}
-
-/* This is a hook called by coff_real_object_p to create any backend
- specific information. */
-
-static PTR
-alpha_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
- bfd *abfd;
- PTR filehdr;
- PTR aouthdr;
-{
- PTR ecoff;
-
- ecoff = _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr);
-
- if (ecoff != NULL)
- {
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- /* Set additional BFD flags according to the object type from the
- machine specific file header flags. */
- switch (internal_f->f_flags & F_ALPHA_OBJECT_TYPE_MASK)
- {
- case F_ALPHA_SHARABLE:
- abfd->flags |= DYNAMIC;
- break;
- case F_ALPHA_CALL_SHARED:
- /* Always executable if using shared libraries as the run time
- loader might resolve undefined references. */
- abfd->flags |= (DYNAMIC | EXEC_P);
- break;
- }
- }
- return ecoff;
-}
-
-/* Reloc handling. */
-
-/* Swap a reloc in. */
-
-static void
-alpha_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
- bfd *abfd;
- PTR ext_ptr;
- struct internal_reloc *intern;
-{
- const RELOC *ext = (RELOC *) ext_ptr;
-
- 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));
-
- intern->r_type = ((ext->r_bits[0] & RELOC_BITS0_TYPE_LITTLE)
- >> RELOC_BITS0_TYPE_SH_LITTLE);
- intern->r_extern = (ext->r_bits[1] & RELOC_BITS1_EXTERN_LITTLE) != 0;
- intern->r_offset = ((ext->r_bits[1] & RELOC_BITS1_OFFSET_LITTLE)
- >> RELOC_BITS1_OFFSET_SH_LITTLE);
- /* Ignored the reserved bits. */
- intern->r_size = ((ext->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
- >> RELOC_BITS3_SIZE_SH_LITTLE);
-
- if (intern->r_type == ALPHA_R_LITUSE
- || intern->r_type == ALPHA_R_GPDISP)
- {
- /* Handle the LITUSE and GPDISP relocs specially. Its symndx
- value is not actually a symbol index, but is instead a
- special code. We put the code in the r_size field, and
- clobber the symndx. */
- if (intern->r_size != 0)
- abort ();
- intern->r_size = intern->r_symndx;
- intern->r_symndx = RELOC_SECTION_NONE;
- }
- else if (intern->r_type == ALPHA_R_IGNORE)
- {
- /* The IGNORE reloc generally follows a GPDISP reloc, and is
- against the .lita section. The section is irrelevant. */
- if (! intern->r_extern &&
- intern->r_symndx == RELOC_SECTION_ABS)
- abort ();
- if (! intern->r_extern && intern->r_symndx == RELOC_SECTION_LITA)
- intern->r_symndx = RELOC_SECTION_ABS;
- }
-}
-
-/* Swap a reloc out. */
-
-static void
-alpha_ecoff_swap_reloc_out (abfd, intern, dst)
- bfd *abfd;
- const struct internal_reloc *intern;
- PTR dst;
-{
- RELOC *ext = (RELOC *) dst;
- long symndx;
- unsigned char size;
-
- /* Undo the hackery done in swap_reloc_in. */
- if (intern->r_type == ALPHA_R_LITUSE
- || intern->r_type == ALPHA_R_GPDISP)
- {
- symndx = intern->r_size;
- size = 0;
- }
- else if (intern->r_type == ALPHA_R_IGNORE
- && ! intern->r_extern
- && intern->r_symndx == RELOC_SECTION_ABS)
- {
- symndx = RELOC_SECTION_LITA;
- size = intern->r_size;
- }
- else
- {
- symndx = intern->r_symndx;
- size = intern->r_size;
- }
-
- BFD_ASSERT (intern->r_extern
- || (intern->r_symndx >= 0 && intern->r_symndx <= 14));
-
- 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));
-
- ext->r_bits[0] = ((intern->r_type << RELOC_BITS0_TYPE_SH_LITTLE)
- & RELOC_BITS0_TYPE_LITTLE);
- ext->r_bits[1] = ((intern->r_extern ? RELOC_BITS1_EXTERN_LITTLE : 0)
- | ((intern->r_offset << RELOC_BITS1_OFFSET_SH_LITTLE)
- & RELOC_BITS1_OFFSET_LITTLE));
- ext->r_bits[2] = 0;
- ext->r_bits[3] = ((size << RELOC_BITS3_SIZE_SH_LITTLE)
- & RELOC_BITS3_SIZE_LITTLE);
-}
-
-/* Finish canonicalizing a reloc. Part of this is generic to all
- ECOFF targets, and that part is in ecoff.c. The rest is done in
- this backend routine. It must fill in the howto field. */
-
-static void
-alpha_adjust_reloc_in (abfd, intern, rptr)
- bfd *abfd;
- const struct internal_reloc *intern;
- arelent *rptr;
-{
- if (intern->r_type > ALPHA_R_GPVALUE)
- abort ();
-
- switch (intern->r_type)
- {
- case ALPHA_R_BRADDR:
- case ALPHA_R_SREL16:
- case ALPHA_R_SREL32:
- case ALPHA_R_SREL64:
- /* This relocs appear to be fully resolved when they are against
- internal symbols. Against external symbols, BRADDR at least
- appears to be resolved against the next instruction. */
- if (! intern->r_extern)
- rptr->addend = 0;
- else
- rptr->addend = - (intern->r_vaddr + 4);
- break;
-
- case ALPHA_R_GPREL32:
- case ALPHA_R_LITERAL:
- /* Copy the gp value for this object file into the addend, to
- ensure that we are not confused by the linker. */
- if (! intern->r_extern)
- rptr->addend += ecoff_data (abfd)->gp;
- break;
-
- case ALPHA_R_LITUSE:
- case ALPHA_R_GPDISP:
- /* The LITUSE and GPDISP relocs do not use a symbol, or an
- addend, but they do use a special code. Put this code in the
- addend field. */
- rptr->addend = intern->r_size;
- break;
-
- case ALPHA_R_OP_STORE:
- /* The STORE reloc needs the size and offset fields. We store
- them in the addend. */
- BFD_ASSERT (intern->r_offset <= 256 && intern->r_size <= 256);
- rptr->addend = (intern->r_offset << 8) + intern->r_size;
- break;
-
- case ALPHA_R_OP_PUSH:
- case ALPHA_R_OP_PSUB:
- case ALPHA_R_OP_PRSHIFT:
- /* The PUSH, PSUB and PRSHIFT relocs do not actually use an
- address. I believe that the address supplied is really an
- addend. */
- rptr->addend = intern->r_vaddr;
- break;
-
- case ALPHA_R_GPVALUE:
- /* Set the addend field to the new GP value. */
- rptr->addend = intern->r_symndx + ecoff_data (abfd)->gp;
- break;
-
- case ALPHA_R_IGNORE:
- /* If the type is ALPHA_R_IGNORE, make sure this is a reference
- to the absolute section so that the reloc is ignored. For
- some reason the address of this reloc type is not adjusted by
- the section vma. We record the gp value for this object file
- here, for convenience when doing the GPDISP relocation. */
- rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- rptr->address = intern->r_vaddr;
- rptr->addend = ecoff_data (abfd)->gp;
- break;
-
- default:
- break;
- }
-
- rptr->howto = &alpha_howto_table[intern->r_type];
-}
-
-/* When writing out a reloc we need to pull some values back out of
- the addend field into the reloc. This is roughly the reverse of
- alpha_adjust_reloc_in, except that there are several changes we do
- not need to undo. */
-
-static void
-alpha_adjust_reloc_out (abfd, rel, intern)
- bfd *abfd ATTRIBUTE_UNUSED;
- const arelent *rel;
- struct internal_reloc *intern;
-{
- switch (intern->r_type)
- {
- case ALPHA_R_LITUSE:
- case ALPHA_R_GPDISP:
- intern->r_size = rel->addend;
- break;
-
- case ALPHA_R_OP_STORE:
- intern->r_size = rel->addend & 0xff;
- intern->r_offset = (rel->addend >> 8) & 0xff;
- break;
-
- case ALPHA_R_OP_PUSH:
- case ALPHA_R_OP_PSUB:
- case ALPHA_R_OP_PRSHIFT:
- intern->r_vaddr = rel->addend;
- break;
-
- case ALPHA_R_IGNORE:
- intern->r_vaddr = rel->address;
- break;
-
- default:
- break;
- }
-}
-
-/* The size of the stack for the relocation evaluator. */
-#define RELOC_STACKSIZE (10)
-
-/* Alpha ECOFF relocs have a built in expression evaluator as well as
- other interdependencies. Rather than use a bunch of special
- functions and global variables, we use a single routine to do all
- the relocation for a section. I haven't yet worked out how the
- assembler is going to handle this. */
-
-static bfd_byte *
-alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
- data, relocatable, symbols)
- bfd *abfd;
- struct bfd_link_info *link_info;
- struct bfd_link_order *link_order;
- bfd_byte *data;
- bfd_boolean relocatable;
- asymbol **symbols;
-{
- bfd *input_bfd = link_order->u.indirect.section->owner;
- asection *input_section = link_order->u.indirect.section;
- long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
- arelent **reloc_vector = NULL;
- long reloc_count;
- bfd *output_bfd = relocatable ? abfd : (bfd *) NULL;
- bfd_vma gp;
- bfd_boolean gp_undefined;
- bfd_vma stack[RELOC_STACKSIZE];
- int tos = 0;
-
- if (reloc_size < 0)
- goto error_return;
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
- if (reloc_vector == NULL && reloc_size != 0)
- goto error_return;
-
- if (! bfd_get_section_contents (input_bfd, input_section, data,
- (file_ptr) 0, input_section->_raw_size))
- goto error_return;
-
- /* The section size is not going to change. */
- input_section->_cooked_size = input_section->_raw_size;
- input_section->reloc_done = TRUE;
-
- reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
- reloc_vector, symbols);
- if (reloc_count < 0)
- goto error_return;
- if (reloc_count == 0)
- goto successful_return;
-
- /* Get the GP value for the output BFD. */
- gp_undefined = FALSE;
- gp = _bfd_get_gp_value (abfd);
- if (gp == 0)
- {
- if (relocatable)
- {
- asection *sec;
- bfd_vma lo;
-
- /* Make up a value. */
- lo = (bfd_vma) -1;
- for (sec = abfd->sections; sec != NULL; sec = sec->next)
- {
- if (sec->vma < lo
- && (strcmp (sec->name, ".sbss") == 0
- || strcmp (sec->name, ".sdata") == 0
- || strcmp (sec->name, ".lit4") == 0
- || strcmp (sec->name, ".lit8") == 0
- || strcmp (sec->name, ".lita") == 0))
- lo = sec->vma;
- }
- gp = lo + 0x8000;
- _bfd_set_gp_value (abfd, gp);
- }
- else
- {
- struct bfd_link_hash_entry *h;
-
- h = bfd_link_hash_lookup (link_info->hash, "_gp", FALSE, FALSE,
- TRUE);
- if (h == (struct bfd_link_hash_entry *) NULL
- || h->type != bfd_link_hash_defined)
- gp_undefined = TRUE;
- else
- {
- gp = (h->u.def.value
- + h->u.def.section->output_section->vma
- + h->u.def.section->output_offset);
- _bfd_set_gp_value (abfd, gp);
- }
- }
- }
-
- for (; *reloc_vector != (arelent *) NULL; reloc_vector++)
- {
- arelent *rel;
- bfd_reloc_status_type r;
- char *err;
-
- rel = *reloc_vector;
- r = bfd_reloc_ok;
- switch (rel->howto->type)
- {
- case ALPHA_R_IGNORE:
- rel->address += input_section->output_offset;
- break;
-
- case ALPHA_R_REFLONG:
- case ALPHA_R_REFQUAD:
- case ALPHA_R_BRADDR:
- case ALPHA_R_HINT:
- case ALPHA_R_SREL16:
- case ALPHA_R_SREL32:
- case ALPHA_R_SREL64:
- if (relocatable
- && ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)
- {
- rel->address += input_section->output_offset;
- break;
- }
- r = bfd_perform_relocation (input_bfd, rel, data, input_section,
- output_bfd, &err);
- break;
-
- case ALPHA_R_GPREL32:
- /* This relocation is used in a switch table. It is a 32
- bit offset from the current GP value. We must adjust it
- by the different between the original GP value and the
- current GP value. The original GP value is stored in the
- addend. We adjust the addend and let
- bfd_perform_relocation finish the job. */
- rel->addend -= gp;
- r = bfd_perform_relocation (input_bfd, rel, data, input_section,
- output_bfd, &err);
- if (r == bfd_reloc_ok && gp_undefined)
- {
- r = bfd_reloc_dangerous;
- err = (char *) _("GP relative relocation used when GP not defined");
- }
- break;
-
- case ALPHA_R_LITERAL:
- /* This is a reference to a literal value, generally
- (always?) in the .lita section. This is a 16 bit GP
- relative relocation. Sometimes the subsequent reloc is a
- LITUSE reloc, which indicates how this reloc is used.
- This sometimes permits rewriting the two instructions
- referred to by the LITERAL and the LITUSE into different
- instructions which do not refer to .lita. This can save
- a memory reference, and permits removing a value from
- .lita thus saving GP relative space.
-
- We do not these optimizations. To do them we would need
- to arrange to link the .lita section first, so that by
- the time we got here we would know the final values to
- use. This would not be particularly difficult, but it is
- not currently implemented. */
-
- {
- unsigned long insn;
-
- /* I believe that the LITERAL reloc will only apply to a
- ldq or ldl instruction, so check my assumption. */
- insn = bfd_get_32 (input_bfd, data + rel->address);
- BFD_ASSERT (((insn >> 26) & 0x3f) == 0x29
- || ((insn >> 26) & 0x3f) == 0x28);
-
- rel->addend -= gp;
- r = bfd_perform_relocation (input_bfd, rel, data, input_section,
- output_bfd, &err);
- if (r == bfd_reloc_ok && gp_undefined)
- {
- r = bfd_reloc_dangerous;
- err =
- (char *) _("GP relative relocation used when GP not defined");
- }
- }
- break;
-
- case ALPHA_R_LITUSE:
- /* See ALPHA_R_LITERAL above for the uses of this reloc. It
- does not cause anything to happen, itself. */
- rel->address += input_section->output_offset;
- break;
-
- case ALPHA_R_GPDISP:
- /* This marks the ldah of an ldah/lda pair which loads the
- gp register with the difference of the gp value and the
- current location. The second of the pair is r_size bytes
- ahead; it used to be marked with an ALPHA_R_IGNORE reloc,
- but that no longer happens in OSF/1 3.2. */
- {
- unsigned long insn1, insn2;
- bfd_vma addend;
-
- /* Get the two instructions. */
- insn1 = bfd_get_32 (input_bfd, data + rel->address);
- insn2 = bfd_get_32 (input_bfd, data + rel->address + rel->addend);
-
- BFD_ASSERT (((insn1 >> 26) & 0x3f) == 0x09); /* ldah */
- BFD_ASSERT (((insn2 >> 26) & 0x3f) == 0x08); /* lda */
-
- /* Get the existing addend. We must account for the sign
- extension done by lda and ldah. */
- addend = ((insn1 & 0xffff) << 16) + (insn2 & 0xffff);
- if (insn1 & 0x8000)
- {
- addend -= 0x80000000;
- addend -= 0x80000000;
- }
- if (insn2 & 0x8000)
- addend -= 0x10000;
-
- /* The existing addend includes the different between the
- gp of the input BFD and the address in the input BFD.
- Subtract this out. */
- addend -= (ecoff_data (input_bfd)->gp
- - (input_section->vma + rel->address));
-
- /* Now add in the final gp value, and subtract out the
- final address. */
- addend += (gp
- - (input_section->output_section->vma
- + input_section->output_offset
- + rel->address));
-
- /* Change the instructions, accounting for the sign
- extension, and write them out. */
- if (addend & 0x8000)
- addend += 0x10000;
- insn1 = (insn1 & 0xffff0000) | ((addend >> 16) & 0xffff);
- insn2 = (insn2 & 0xffff0000) | (addend & 0xffff);
-
- bfd_put_32 (input_bfd, (bfd_vma) insn1, data + rel->address);
- bfd_put_32 (input_bfd, (bfd_vma) insn2,
- data + rel->address + rel->addend);
-
- rel->address += input_section->output_offset;
- }
- break;
-
- case ALPHA_R_OP_PUSH:
- /* Push a value on the reloc evaluation stack. */
- {
- asymbol *symbol;
- bfd_vma relocation;
-
- if (relocatable)
- {
- rel->address += input_section->output_offset;
- break;
- }
-
- /* Figure out the relocation of this symbol. */
- symbol = *rel->sym_ptr_ptr;
-
- if (bfd_is_und_section (symbol->section))
- r = bfd_reloc_undefined;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += rel->addend;
-
- if (tos >= RELOC_STACKSIZE)
- abort ();
-
- stack[tos++] = relocation;
- }
- break;
-
- case ALPHA_R_OP_STORE:
- /* Store a value from the reloc stack into a bitfield. */
- {
- bfd_vma val;
- int offset, size;
-
- if (relocatable)
- {
- rel->address += input_section->output_offset;
- break;
- }
-
- if (tos == 0)
- abort ();
-
- /* The offset and size for this reloc are encoded into the
- addend field by alpha_adjust_reloc_in. */
- offset = (rel->addend >> 8) & 0xff;
- size = rel->addend & 0xff;
-
- val = bfd_get_64 (abfd, data + rel->address);
- val &=~ (((1 << size) - 1) << offset);
- val |= (stack[--tos] & ((1 << size) - 1)) << offset;
- bfd_put_64 (abfd, val, data + rel->address);
- }
- break;
-
- case ALPHA_R_OP_PSUB:
- /* Subtract a value from the top of the stack. */
- {
- asymbol *symbol;
- bfd_vma relocation;
-
- if (relocatable)
- {
- rel->address += input_section->output_offset;
- break;
- }
-
- /* Figure out the relocation of this symbol. */
- symbol = *rel->sym_ptr_ptr;
-
- if (bfd_is_und_section (symbol->section))
- r = bfd_reloc_undefined;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += rel->addend;
-
- if (tos == 0)
- abort ();
-
- stack[tos - 1] -= relocation;
- }
- break;
-
- case ALPHA_R_OP_PRSHIFT:
- /* Shift the value on the top of the stack. */
- {
- asymbol *symbol;
- bfd_vma relocation;
-
- if (relocatable)
- {
- rel->address += input_section->output_offset;
- break;
- }
-
- /* Figure out the relocation of this symbol. */
- symbol = *rel->sym_ptr_ptr;
-
- if (bfd_is_und_section (symbol->section))
- r = bfd_reloc_undefined;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += rel->addend;
-
- if (tos == 0)
- abort ();
-
- stack[tos - 1] >>= relocation;
- }
- break;
-
- case ALPHA_R_GPVALUE:
- /* I really don't know if this does the right thing. */
- gp = rel->addend;
- gp_undefined = FALSE;
- break;
-
- default:
- abort ();
- }
-
- if (relocatable)
- {
- asection *os = input_section->output_section;
-
- /* A partial link, so keep the relocs. */
- os->orelocation[os->reloc_count] = rel;
- os->reloc_count++;
- }
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- case bfd_reloc_undefined:
- if (! ((*link_info->callbacks->undefined_symbol)
- (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
- input_bfd, input_section, rel->address, TRUE)))
- goto error_return;
- break;
- case bfd_reloc_dangerous:
- if (! ((*link_info->callbacks->reloc_dangerous)
- (link_info, err, input_bfd, input_section,
- rel->address)))
- goto error_return;
- break;
- case bfd_reloc_overflow:
- if (! ((*link_info->callbacks->reloc_overflow)
- (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
- rel->howto->name, rel->addend, input_bfd,
- input_section, rel->address)))
- goto error_return;
- break;
- case bfd_reloc_outofrange:
- default:
- abort ();
- break;
- }
- }
- }
-
- if (tos != 0)
- abort ();
-
- successful_return:
- if (reloc_vector != NULL)
- free (reloc_vector);
- return data;
-
- error_return:
- if (reloc_vector != NULL)
- free (reloc_vector);
- return NULL;
-}
-
-/* Get the howto structure for a generic reloc type. */
-
-static reloc_howto_type *
-alpha_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- int alpha_type;
-
- switch (code)
- {
- case BFD_RELOC_32:
- alpha_type = ALPHA_R_REFLONG;
- break;
- case BFD_RELOC_64:
- case BFD_RELOC_CTOR:
- alpha_type = ALPHA_R_REFQUAD;
- break;
- case BFD_RELOC_GPREL32:
- alpha_type = ALPHA_R_GPREL32;
- break;
- case BFD_RELOC_ALPHA_LITERAL:
- alpha_type = ALPHA_R_LITERAL;
- break;
- case BFD_RELOC_ALPHA_LITUSE:
- alpha_type = ALPHA_R_LITUSE;
- break;
- case BFD_RELOC_ALPHA_GPDISP_HI16:
- alpha_type = ALPHA_R_GPDISP;
- break;
- case BFD_RELOC_ALPHA_GPDISP_LO16:
- alpha_type = ALPHA_R_IGNORE;
- break;
- case BFD_RELOC_23_PCREL_S2:
- alpha_type = ALPHA_R_BRADDR;
- break;
- case BFD_RELOC_ALPHA_HINT:
- alpha_type = ALPHA_R_HINT;
- break;
- case BFD_RELOC_16_PCREL:
- alpha_type = ALPHA_R_SREL16;
- break;
- case BFD_RELOC_32_PCREL:
- alpha_type = ALPHA_R_SREL32;
- break;
- case BFD_RELOC_64_PCREL:
- alpha_type = ALPHA_R_SREL64;
- break;
-#if 0
- case ???:
- alpha_type = ALPHA_R_OP_PUSH;
- break;
- case ???:
- alpha_type = ALPHA_R_OP_STORE;
- break;
- case ???:
- alpha_type = ALPHA_R_OP_PSUB;
- break;
- case ???:
- alpha_type = ALPHA_R_OP_PRSHIFT;
- break;
- case ???:
- alpha_type = ALPHA_R_GPVALUE;
- break;
-#endif
- default:
- return (reloc_howto_type *) NULL;
- }
-
- return &alpha_howto_table[alpha_type];
-}
-
-/* A helper routine for alpha_relocate_section which converts an
- external reloc when generating relocatable output. Returns the
- relocation amount. */
-
-static bfd_vma
-alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
- bfd *input_bfd;
- struct external_reloc *ext_rel;
- struct ecoff_link_hash_entry *h;
-{
- unsigned long r_symndx;
- bfd_vma relocation;
-
- BFD_ASSERT (info->relocatable);
-
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *hsec;
- const char *name;
-
- /* This symbol is defined in the output. Convert the reloc from
- being against the symbol to being against the section. */
-
- /* Clear the r_extern bit. */
- ext_rel->r_bits[1] &=~ RELOC_BITS1_EXTERN_LITTLE;
-
- /* Compute a new r_symndx value. */
- hsec = h->root.u.def.section;
- name = bfd_get_section_name (output_bfd, hsec->output_section);
-
- r_symndx = (unsigned long) -1;
- switch (name[1])
- {
- case 'A':
- if (strcmp (name, "*ABS*") == 0)
- r_symndx = RELOC_SECTION_ABS;
- break;
- case 'b':
- if (strcmp (name, ".bss") == 0)
- r_symndx = RELOC_SECTION_BSS;
- break;
- case 'd':
- if (strcmp (name, ".data") == 0)
- r_symndx = RELOC_SECTION_DATA;
- break;
- case 'f':
- if (strcmp (name, ".fini") == 0)
- r_symndx = RELOC_SECTION_FINI;
- break;
- case 'i':
- if (strcmp (name, ".init") == 0)
- r_symndx = RELOC_SECTION_INIT;
- break;
- case 'l':
- if (strcmp (name, ".lita") == 0)
- r_symndx = RELOC_SECTION_LITA;
- else if (strcmp (name, ".lit8") == 0)
- r_symndx = RELOC_SECTION_LIT8;
- else if (strcmp (name, ".lit4") == 0)
- r_symndx = RELOC_SECTION_LIT4;
- break;
- case 'p':
- if (strcmp (name, ".pdata") == 0)
- r_symndx = RELOC_SECTION_PDATA;
- break;
- case 'r':
- if (strcmp (name, ".rdata") == 0)
- r_symndx = RELOC_SECTION_RDATA;
- else if (strcmp (name, ".rconst") == 0)
- r_symndx = RELOC_SECTION_RCONST;
- break;
- case 's':
- if (strcmp (name, ".sdata") == 0)
- r_symndx = RELOC_SECTION_SDATA;
- else if (strcmp (name, ".sbss") == 0)
- r_symndx = RELOC_SECTION_SBSS;
- break;
- case 't':
- if (strcmp (name, ".text") == 0)
- r_symndx = RELOC_SECTION_TEXT;
- break;
- case 'x':
- if (strcmp (name, ".xdata") == 0)
- r_symndx = RELOC_SECTION_XDATA;
- break;
- }
-
- if (r_symndx == (unsigned long) -1)
- abort ();
-
- /* Add the section VMA and the symbol value. */
- relocation = (h->root.u.def.value
- + hsec->output_section->vma
- + hsec->output_offset);
- }
- else
- {
- /* Change the symndx value to the right one for
- the output BFD. */
- r_symndx = h->indx;
- if (r_symndx == (unsigned long) -1)
- {
- /* Caller must give an error. */
- r_symndx = 0;
- }
- relocation = 0;
- }
-
- /* Write out the new r_symndx value. */
- H_PUT_32 (input_bfd, r_symndx, ext_rel->r_symndx);
-
- return relocation;
-}
-
-/* Relocate a section while linking an Alpha ECOFF file. This is
- quite similar to get_relocated_section_contents. Perhaps they
- could be combined somehow. */
-
-static bfd_boolean
-alpha_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, external_relocs)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- PTR external_relocs;
-{
- asection **symndx_to_section, *lita_sec;
- struct ecoff_link_hash_entry **sym_hashes;
- bfd_vma gp;
- bfd_boolean gp_undefined;
- bfd_vma stack[RELOC_STACKSIZE];
- 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
- section by name each time. */
- symndx_to_section = ecoff_data (input_bfd)->symndx_to_section;
- if (symndx_to_section == (asection **) NULL)
- {
- amt = NUM_RELOC_SECTIONS * sizeof (asection *);
- symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
- if (!symndx_to_section)
- return FALSE;
-
- symndx_to_section[RELOC_SECTION_NONE] = NULL;
- symndx_to_section[RELOC_SECTION_TEXT] =
- bfd_get_section_by_name (input_bfd, ".text");
- symndx_to_section[RELOC_SECTION_RDATA] =
- bfd_get_section_by_name (input_bfd, ".rdata");
- symndx_to_section[RELOC_SECTION_DATA] =
- bfd_get_section_by_name (input_bfd, ".data");
- symndx_to_section[RELOC_SECTION_SDATA] =
- bfd_get_section_by_name (input_bfd, ".sdata");
- symndx_to_section[RELOC_SECTION_SBSS] =
- bfd_get_section_by_name (input_bfd, ".sbss");
- symndx_to_section[RELOC_SECTION_BSS] =
- bfd_get_section_by_name (input_bfd, ".bss");
- symndx_to_section[RELOC_SECTION_INIT] =
- bfd_get_section_by_name (input_bfd, ".init");
- symndx_to_section[RELOC_SECTION_LIT8] =
- bfd_get_section_by_name (input_bfd, ".lit8");
- symndx_to_section[RELOC_SECTION_LIT4] =
- bfd_get_section_by_name (input_bfd, ".lit4");
- symndx_to_section[RELOC_SECTION_XDATA] =
- bfd_get_section_by_name (input_bfd, ".xdata");
- symndx_to_section[RELOC_SECTION_PDATA] =
- bfd_get_section_by_name (input_bfd, ".pdata");
- symndx_to_section[RELOC_SECTION_FINI] =
- bfd_get_section_by_name (input_bfd, ".fini");
- symndx_to_section[RELOC_SECTION_LITA] =
- bfd_get_section_by_name (input_bfd, ".lita");
- symndx_to_section[RELOC_SECTION_ABS] = bfd_abs_section_ptr;
- symndx_to_section[RELOC_SECTION_RCONST] =
- bfd_get_section_by_name (input_bfd, ".rconst");
-
- ecoff_data (input_bfd)->symndx_to_section = symndx_to_section;
- }
-
- sym_hashes = ecoff_data (input_bfd)->sym_hashes;
-
- /* On the Alpha, the .lita section must be addressable by the global
- pointer. To support large programs, we need to allow multiple
- global pointers. This works as long as each input .lita section
- is <64KB big. This implies that when producing relocatable
- output, the .lita section is limited to 64KB. . */
-
- lita_sec = symndx_to_section[RELOC_SECTION_LITA];
- gp = _bfd_get_gp_value (output_bfd);
- if (! info->relocatable && lita_sec != NULL)
- {
- struct ecoff_section_tdata *lita_sec_data;
-
- /* Make sure we have a section data structure to which we can
- hang on to the gp value we pick for the 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, amt));
- ecoff_section_data (input_bfd, lita_sec) = lita_sec_data;
- }
-
- if (lita_sec_data->gp != 0)
- {
- /* If we already assigned a gp to this section, we better
- stick with that value. */
- gp = lita_sec_data->gp;
- }
- else
- {
- bfd_vma lita_vma;
- bfd_size_type lita_size;
-
- lita_vma = lita_sec->output_offset + lita_sec->output_section->vma;
- lita_size = lita_sec->_cooked_size;
- if (lita_size == 0)
- lita_size = lita_sec->_raw_size;
-
- if (gp == 0
- || lita_vma < gp - 0x8000
- || lita_vma + lita_size >= gp + 0x8000)
- {
- /* Either gp hasn't been set at all or the current gp
- cannot address this .lita section. In both cases we
- reset the gp to point into the "middle" of the
- current input .lita section. */
- if (gp && !ecoff_data (output_bfd)->issued_multiple_gp_warning)
- {
- (*info->callbacks->warning) (info,
- _("using multiple gp values"),
- (char *) NULL, output_bfd,
- (asection *) NULL, (bfd_vma) 0);
- ecoff_data (output_bfd)->issued_multiple_gp_warning = TRUE;
- }
- if (lita_vma < gp - 0x8000)
- gp = lita_vma + lita_size - 0x8000;
- else
- gp = lita_vma + 0x8000;
-
- }
-
- lita_sec_data->gp = gp;
- }
-
- _bfd_set_gp_value (output_bfd, gp);
- }
-
- gp_undefined = (gp == 0);
-
- BFD_ASSERT (bfd_header_little_endian (output_bfd));
- BFD_ASSERT (bfd_header_little_endian (input_bfd));
-
- ext_rel = (struct external_reloc *) external_relocs;
- ext_rel_end = ext_rel + input_section->reloc_count;
- for (; ext_rel < ext_rel_end; ext_rel++)
- {
- bfd_vma r_vaddr;
- unsigned long r_symndx;
- int r_type;
- int r_extern;
- int r_offset;
- int r_size;
- bfd_boolean relocatep;
- bfd_boolean adjust_addrp;
- bfd_boolean gp_usedp;
- bfd_vma addend;
-
- 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);
- r_extern = (ext_rel->r_bits[1] & RELOC_BITS1_EXTERN_LITTLE) != 0;
- r_offset = ((ext_rel->r_bits[1] & RELOC_BITS1_OFFSET_LITTLE)
- >> RELOC_BITS1_OFFSET_SH_LITTLE);
- /* Ignored the reserved bits. */
- r_size = ((ext_rel->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
- >> RELOC_BITS3_SIZE_SH_LITTLE);
-
- relocatep = FALSE;
- adjust_addrp = TRUE;
- gp_usedp = FALSE;
- addend = 0;
-
- switch (r_type)
- {
- default:
- abort ();
-
- case ALPHA_R_IGNORE:
- /* This reloc appears after a GPDISP reloc. On earlier
- versions of OSF/1, It marked the position of the second
- instruction to be altered by the GPDISP reloc, but it is
- not otherwise used for anything. For some reason, the
- address of the relocation does not appear to include the
- section VMA, unlike the other relocation types. */
- if (info->relocatable)
- H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
- ext_rel->r_vaddr);
- adjust_addrp = FALSE;
- break;
-
- case ALPHA_R_REFLONG:
- case ALPHA_R_REFQUAD:
- case ALPHA_R_HINT:
- relocatep = TRUE;
- break;
-
- case ALPHA_R_BRADDR:
- case ALPHA_R_SREL16:
- case ALPHA_R_SREL32:
- case ALPHA_R_SREL64:
- if (r_extern)
- addend += - (r_vaddr + 4);
- relocatep = TRUE;
- break;
-
- case ALPHA_R_GPREL32:
- /* This relocation is used in a switch table. It is a 32
- bit offset from the current GP value. We must adjust it
- by the different between the original GP value and the
- current GP value. */
- relocatep = TRUE;
- addend = ecoff_data (input_bfd)->gp - gp;
- gp_usedp = TRUE;
- break;
-
- case ALPHA_R_LITERAL:
- /* This is a reference to a literal value, generally
- (always?) in the .lita section. This is a 16 bit GP
- relative relocation. Sometimes the subsequent reloc is a
- LITUSE reloc, which indicates how this reloc is used.
- This sometimes permits rewriting the two instructions
- referred to by the LITERAL and the LITUSE into different
- instructions which do not refer to .lita. This can save
- a memory reference, and permits removing a value from
- .lita thus saving GP relative space.
-
- We do not these optimizations. To do them we would need
- to arrange to link the .lita section first, so that by
- the time we got here we would know the final values to
- use. This would not be particularly difficult, but it is
- not currently implemented. */
-
- /* I believe that the LITERAL reloc will only apply to a ldq
- or ldl instruction, so check my assumption. */
- {
- unsigned long insn;
-
- insn = bfd_get_32 (input_bfd,
- contents + r_vaddr - input_section->vma);
- BFD_ASSERT (((insn >> 26) & 0x3f) == 0x29
- || ((insn >> 26) & 0x3f) == 0x28);
- }
-
- relocatep = TRUE;
- addend = ecoff_data (input_bfd)->gp - gp;
- gp_usedp = TRUE;
- break;
-
- case ALPHA_R_LITUSE:
- /* See ALPHA_R_LITERAL above for the uses of this reloc. It
- does not cause anything to happen, itself. */
- break;
-
- case ALPHA_R_GPDISP:
- /* This marks the ldah of an ldah/lda pair which loads the
- gp register with the difference of the gp value and the
- current location. The second of the pair is r_symndx
- bytes ahead. It used to be marked with an ALPHA_R_IGNORE
- reloc, but OSF/1 3.2 no longer does that. */
- {
- unsigned long insn1, insn2;
-
- /* Get the two instructions. */
- insn1 = bfd_get_32 (input_bfd,
- contents + r_vaddr - input_section->vma);
- insn2 = bfd_get_32 (input_bfd,
- (contents
- + r_vaddr
- - input_section->vma
- + r_symndx));
-
- BFD_ASSERT (((insn1 >> 26) & 0x3f) == 0x09); /* ldah */
- BFD_ASSERT (((insn2 >> 26) & 0x3f) == 0x08); /* lda */
-
- /* Get the existing addend. We must account for the sign
- extension done by lda and ldah. */
- addend = ((insn1 & 0xffff) << 16) + (insn2 & 0xffff);
- if (insn1 & 0x8000)
- {
- /* This is addend -= 0x100000000 without causing an
- integer overflow on a 32 bit host. */
- addend -= 0x80000000;
- addend -= 0x80000000;
- }
- if (insn2 & 0x8000)
- addend -= 0x10000;
-
- /* The existing addend includes the difference between the
- gp of the input BFD and the address in the input BFD.
- We want to change this to the difference between the
- final GP and the final address. */
- addend += (gp
- - ecoff_data (input_bfd)->gp
- + input_section->vma
- - (input_section->output_section->vma
- + input_section->output_offset));
-
- /* Change the instructions, accounting for the sign
- extension, and write them out. */
- if (addend & 0x8000)
- addend += 0x10000;
- insn1 = (insn1 & 0xffff0000) | ((addend >> 16) & 0xffff);
- insn2 = (insn2 & 0xffff0000) | (addend & 0xffff);
-
- bfd_put_32 (input_bfd, (bfd_vma) insn1,
- contents + r_vaddr - input_section->vma);
- bfd_put_32 (input_bfd, (bfd_vma) insn2,
- contents + r_vaddr - input_section->vma + r_symndx);
-
- gp_usedp = TRUE;
- }
- break;
-
- case ALPHA_R_OP_PUSH:
- case ALPHA_R_OP_PSUB:
- case ALPHA_R_OP_PRSHIFT:
- /* Manipulate values on the reloc evaluation stack. The
- r_vaddr field is not an address in input_section, it is
- the current value (including any addend) of the object
- being used. */
- if (! r_extern)
- {
- asection *s;
-
- s = symndx_to_section[r_symndx];
- if (s == (asection *) NULL)
- abort ();
- addend = s->output_section->vma + s->output_offset - s->vma;
- }
- else
- {
- struct ecoff_link_hash_entry *h;
-
- h = sym_hashes[r_symndx];
- if (h == (struct ecoff_link_hash_entry *) NULL)
- abort ();
-
- if (! info->relocatable)
- {
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- else
- {
- /* Note that we pass the address as 0, since we
- do not have a meaningful number for the
- location within the section that is being
- relocated. */
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, (bfd_vma) 0, TRUE)))
- return FALSE;
- addend = 0;
- }
- }
- else
- {
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak
- && h->indx == -1)
- {
- /* This symbol is not being written out. Pass
- the address as 0, as with undefined_symbol,
- above. */
- if (! ((*info->callbacks->unattached_reloc)
- (info, h->root.root.string, input_bfd,
- input_section, (bfd_vma) 0)))
- return FALSE;
- }
-
- addend = alpha_convert_external_reloc (output_bfd, info,
- input_bfd,
- ext_rel, h);
- }
- }
-
- addend += r_vaddr;
-
- if (info->relocatable)
- {
- /* Adjust r_vaddr by the addend. */
- H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
- }
- else
- {
- switch (r_type)
- {
- case ALPHA_R_OP_PUSH:
- if (tos >= RELOC_STACKSIZE)
- abort ();
- stack[tos++] = addend;
- break;
-
- case ALPHA_R_OP_PSUB:
- if (tos == 0)
- abort ();
- stack[tos - 1] -= addend;
- break;
-
- case ALPHA_R_OP_PRSHIFT:
- if (tos == 0)
- abort ();
- stack[tos - 1] >>= addend;
- break;
- }
- }
-
- adjust_addrp = FALSE;
- break;
-
- case ALPHA_R_OP_STORE:
- /* Store a value from the reloc stack into a bitfield. If
- we are generating relocatable output, all we do is
- adjust the address of the reloc. */
- if (! info->relocatable)
- {
- bfd_vma mask;
- bfd_vma val;
-
- if (tos == 0)
- abort ();
-
- /* Get the relocation mask. The separate steps and the
- casts to bfd_vma are attempts to avoid a bug in the
- Alpha OSF 1.3 C compiler. See reloc.c for more
- details. */
- mask = 1;
- mask <<= (bfd_vma) r_size;
- mask -= 1;
-
- /* FIXME: I don't know what kind of overflow checking,
- if any, should be done here. */
- val = bfd_get_64 (input_bfd,
- contents + r_vaddr - input_section->vma);
- val &=~ mask << (bfd_vma) r_offset;
- val |= (stack[--tos] & mask) << (bfd_vma) r_offset;
- bfd_put_64 (input_bfd, val,
- contents + r_vaddr - input_section->vma);
- }
- break;
-
- case ALPHA_R_GPVALUE:
- /* I really don't know if this does the right thing. */
- gp = ecoff_data (input_bfd)->gp + r_symndx;
- gp_undefined = FALSE;
- break;
- }
-
- if (relocatep)
- {
- reloc_howto_type *howto;
- struct ecoff_link_hash_entry *h = NULL;
- asection *s = NULL;
- bfd_vma relocation;
- bfd_reloc_status_type r;
-
- /* Perform a relocation. */
-
- howto = &alpha_howto_table[r_type];
-
- if (r_extern)
- {
- h = sym_hashes[r_symndx];
- /* If h is NULL, that means that there is a reloc
- against an external symbol which we thought was just
- a debugging symbol. This should not happen. */
- if (h == (struct ecoff_link_hash_entry *) NULL)
- abort ();
- }
- else
- {
- if (r_symndx >= NUM_RELOC_SECTIONS)
- s = NULL;
- else
- s = symndx_to_section[r_symndx];
-
- if (s == (asection *) NULL)
- abort ();
- }
-
- if (info->relocatable)
- {
- /* We are generating relocatable output, and must
- convert the existing reloc. */
- if (r_extern)
- {
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak
- && h->indx == -1)
- {
- /* This symbol is not being written out. */
- if (! ((*info->callbacks->unattached_reloc)
- (info, h->root.root.string, input_bfd,
- input_section, r_vaddr - input_section->vma)))
- return FALSE;
- }
-
- relocation = alpha_convert_external_reloc (output_bfd,
- info,
- input_bfd,
- ext_rel,
- h);
- }
- else
- {
- /* This is a relocation against a section. Adjust
- the value by the amount the section moved. */
- relocation = (s->output_section->vma
- + s->output_offset
- - s->vma);
- }
-
- /* If this is PC relative, the existing object file
- appears to already have the reloc worked out. We
- must subtract out the old value and add in the new
- one. */
- if (howto->pc_relative)
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma);
-
- /* Put in any addend. */
- relocation += addend;
-
- /* Adjust the contents. */
- r = _bfd_relocate_contents (howto, input_bfd, relocation,
- (contents
- + r_vaddr
- - input_section->vma));
- }
- else
- {
- /* We are producing a final executable. */
- if (r_extern)
- {
- /* This is a reloc against a symbol. */
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *hsec;
-
- hsec = h->root.u.def.section;
- relocation = (h->root.u.def.value
- + hsec->output_section->vma
- + hsec->output_offset);
- }
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section,
- r_vaddr - input_section->vma, TRUE)))
- return FALSE;
- relocation = 0;
- }
- }
- else
- {
- /* This is a reloc against a section. */
- relocation = (s->output_section->vma
- + s->output_offset
- - s->vma);
-
- /* Adjust a PC relative relocation by removing the
- reference to the original source section. */
- if (howto->pc_relative)
- relocation += input_section->vma;
- }
-
- r = _bfd_final_link_relocate (howto,
- input_bfd,
- input_section,
- contents,
- r_vaddr - input_section->vma,
- relocation,
- addend);
- }
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *name;
-
- if (r_extern)
- name = sym_hashes[r_symndx]->root.root.string;
- else
- name = bfd_section_name (input_bfd,
- symndx_to_section[r_symndx]);
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, alpha_howto_table[r_type].name,
- (bfd_vma) 0, input_bfd, input_section,
- r_vaddr - input_section->vma)))
- return FALSE;
- }
- break;
- }
- }
- }
-
- if (info->relocatable && adjust_addrp)
- {
- /* Change the address of the relocation. */
- 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)
- {
- if (! ((*info->callbacks->reloc_dangerous)
- (info, _("GP relative relocation used when GP not defined"),
- input_bfd, input_section, r_vaddr - input_section->vma)))
- return FALSE;
- /* Only give the error once per link. */
- gp = 4;
- _bfd_set_gp_value (output_bfd, gp);
- gp_undefined = FALSE;
- }
- }
-
- if (tos != 0)
- abort ();
-
- return TRUE;
-}
-
-/* Do final adjustments to the filehdr and the aouthdr. This routine
- sets the dynamic bits in the file header. */
-
-static bfd_boolean
-alpha_adjust_headers (abfd, fhdr, ahdr)
- bfd *abfd;
- struct internal_filehdr *fhdr;
- struct internal_aouthdr *ahdr ATTRIBUTE_UNUSED;
-{
- if ((abfd->flags & (DYNAMIC | EXEC_P)) == (DYNAMIC | EXEC_P))
- fhdr->f_flags |= F_ALPHA_CALL_SHARED;
- else if ((abfd->flags & DYNAMIC) != 0)
- fhdr->f_flags |= F_ALPHA_SHARABLE;
- return TRUE;
-}
-
-/* Archive handling. In OSF/1 (or Digital Unix) v3.2, Digital
- introduced archive packing, in which the elements in an archive are
- optionally compressed using a simple dictionary scheme. We know
- how to read such archives, but we don't write them. */
-
-#define alpha_ecoff_slurp_armap _bfd_ecoff_slurp_armap
-#define alpha_ecoff_slurp_extended_name_table \
- _bfd_ecoff_slurp_extended_name_table
-#define alpha_ecoff_construct_extended_name_table \
- _bfd_ecoff_construct_extended_name_table
-#define alpha_ecoff_truncate_arname _bfd_ecoff_truncate_arname
-#define alpha_ecoff_write_armap _bfd_ecoff_write_armap
-#define alpha_ecoff_generic_stat_arch_elt _bfd_ecoff_generic_stat_arch_elt
-#define alpha_ecoff_update_armap_timestamp _bfd_ecoff_update_armap_timestamp
-
-/* A compressed file uses this instead of ARFMAG. */
-
-#define ARFZMAG "Z\012"
-
-/* Read an archive header. This is like the standard routine, but it
- also accepts ARFZMAG. */
-
-static PTR
-alpha_ecoff_read_ar_hdr (abfd)
- bfd *abfd;
-{
- struct areltdata *ret;
- struct ar_hdr *h;
-
- ret = (struct areltdata *) _bfd_generic_read_ar_hdr_mag (abfd, ARFZMAG);
- if (ret == NULL)
- return NULL;
-
- h = (struct ar_hdr *) ret->arch_header;
- if (strncmp (h->ar_fmag, ARFZMAG, 2) == 0)
- {
- bfd_byte ab[8];
-
- /* 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, (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 = H_GET_64 (abfd, ab);
- }
-
- return (PTR) ret;
-}
-
-/* Get an archive element at a specified file position. This is where
- we uncompress the archive element if necessary. */
-
-static bfd *
-alpha_ecoff_get_elt_at_filepos (archive, filepos)
- bfd *archive;
- file_ptr filepos;
-{
- bfd *nbfd = NULL;
- struct areltdata *tdata;
- struct ar_hdr *hdr;
- bfd_byte ab[8];
- bfd_size_type size;
- bfd_byte *buf, *p;
- struct bfd_in_memory *bim;
-
- nbfd = _bfd_get_elt_at_filepos (archive, filepos);
- if (nbfd == NULL)
- goto error_return;
-
- if ((nbfd->flags & BFD_IN_MEMORY) != 0)
- {
- /* We have already expanded this BFD. */
- return nbfd;
- }
-
- tdata = (struct areltdata *) nbfd->arelt_data;
- hdr = (struct ar_hdr *) tdata->arch_header;
- if (strncmp (hdr->ar_fmag, ARFZMAG, 2) != 0)
- return nbfd;
-
- /* We must uncompress this element. We do this by copying it into a
- 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, (file_ptr) FILHSZ, SEEK_SET) != 0)
- goto error_return;
-
- /* The next eight bytes are the real file size. */
- if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
- goto error_return;
- size = H_GET_64 (nbfd, ab);
-
- if (size == 0)
- buf = NULL;
- else
- {
- bfd_size_type left;
- bfd_byte dict[4096];
- unsigned int h;
- bfd_byte b;
-
- buf = (bfd_byte *) bfd_alloc (nbfd, size);
- if (buf == NULL)
- goto error_return;
- p = buf;
-
- left = size;
-
- /* I don't know what the next eight bytes are for. */
- if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
- goto error_return;
-
- /* This is the uncompression algorithm. It's a simple
- dictionary based scheme in which each character is predicted
- by a hash of the previous three characters. A control byte
- indicates whether the character is predicted or whether it
- appears in the input stream; each control byte manages the
- next eight bytes in the output stream. */
- memset (dict, 0, sizeof dict);
- h = 0;
- while (bfd_bread (&b, (bfd_size_type) 1, nbfd) == 1)
- {
- unsigned int i;
-
- for (i = 0; i < 8; i++, b >>= 1)
- {
- bfd_byte n;
-
- if ((b & 1) == 0)
- n = dict[h];
- else
- {
- if (! bfd_bread (&n, (bfd_size_type) 1, nbfd))
- goto error_return;
- dict[h] = n;
- }
-
- *p++ = n;
-
- --left;
- if (left == 0)
- break;
-
- h <<= 4;
- h ^= n;
- h &= sizeof dict - 1;
- }
-
- if (left == 0)
- break;
- }
- }
-
- /* Now the uncompressed file contents are in buf. */
- bim = ((struct bfd_in_memory *)
- bfd_alloc (nbfd, (bfd_size_type) sizeof (struct bfd_in_memory)));
- if (bim == NULL)
- goto error_return;
- bim->size = size;
- bim->buffer = buf;
-
- nbfd->mtime_set = TRUE;
- nbfd->mtime = strtol (hdr->ar_date, (char **) NULL, 10);
-
- nbfd->flags |= BFD_IN_MEMORY;
- nbfd->iostream = (PTR) bim;
- BFD_ASSERT (! nbfd->cacheable);
-
- return nbfd;
-
- error_return:
- if (nbfd != NULL)
- bfd_close (nbfd);
- return NULL;
-}
-
-/* Open the next archived file. */
-
-static bfd *
-alpha_ecoff_openr_next_archived_file (archive, last_file)
- bfd *archive;
- bfd *last_file;
-{
- file_ptr filestart;
-
- if (last_file == NULL)
- filestart = bfd_ardata (archive)->first_file_filepos;
- else
- {
- struct areltdata *t;
- struct ar_hdr *h;
- bfd_size_type size;
-
- /* We can't use arelt_size here, because that uses parsed_size,
- which is the uncompressed size. We need the compressed size. */
- t = (struct areltdata *) last_file->arelt_data;
- h = (struct ar_hdr *) t->arch_header;
- size = strtol (h->ar_size, (char **) NULL, 10);
-
- /* Pad to an even boundary...
- Note that last_file->origin can be odd in the case of
- BSD-4.4-style element with a long odd size. */
- filestart = last_file->origin + size;
- filestart += filestart % 2;
- }
-
- return alpha_ecoff_get_elt_at_filepos (archive, filestart);
-}
-
-/* Open the archive file given an index into the armap. */
-
-static bfd *
-alpha_ecoff_get_elt_at_index (abfd, index)
- bfd *abfd;
- symindex index;
-{
- carsym *entry;
-
- entry = bfd_ardata (abfd)->symdefs + index;
- return alpha_ecoff_get_elt_at_filepos (abfd, entry->file_offset);
-}
-
-/* This is the ECOFF backend structure. The backend field of the
- target vector points to this. */
-
-static const struct ecoff_backend_data alpha_ecoff_backend_data =
-{
- /* COFF backend structure. */
- {
- (void (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR))) bfd_void, /* aux_in */
- (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_in */
- (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_in */
- (unsigned (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR)))bfd_void,/*aux_out*/
- (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_out */
- (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_out */
- (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
- alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
- alpha_ecoff_swap_scnhdr_out,
- FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, FALSE, 4, FALSE, 2,
- alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
- alpha_ecoff_swap_scnhdr_in, NULL,
- alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
- alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
- _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL
- },
- /* Supported architecture. */
- bfd_arch_alpha,
- /* Initial portion of armap string. */
- "________64",
- /* The page boundary used to align sections in a demand-paged
- executable file. E.g., 0x1000. */
- 0x2000,
- /* TRUE if the .rdata section is part of the text segment, as on the
- Alpha. FALSE if .rdata is part of the data segment, as on the
- MIPS. */
- TRUE,
- /* Bitsize of constructor entries. */
- 64,
- /* Reloc to use for constructor entries. */
- &alpha_howto_table[ALPHA_R_REFQUAD],
- {
- /* Symbol table magic number. */
- magicSym2,
- /* Alignment of debugging information. E.g., 4. */
- 8,
- /* Sizes of external symbolic information. */
- sizeof (struct hdr_ext),
- sizeof (struct dnr_ext),
- sizeof (struct pdr_ext),
- sizeof (struct sym_ext),
- sizeof (struct opt_ext),
- sizeof (struct fdr_ext),
- sizeof (struct rfd_ext),
- sizeof (struct ext_ext),
- /* Functions to swap in external symbolic data. */
- ecoff_swap_hdr_in,
- ecoff_swap_dnr_in,
- ecoff_swap_pdr_in,
- ecoff_swap_sym_in,
- ecoff_swap_opt_in,
- ecoff_swap_fdr_in,
- ecoff_swap_rfd_in,
- ecoff_swap_ext_in,
- _bfd_ecoff_swap_tir_in,
- _bfd_ecoff_swap_rndx_in,
- /* Functions to swap out external symbolic data. */
- ecoff_swap_hdr_out,
- ecoff_swap_dnr_out,
- ecoff_swap_pdr_out,
- ecoff_swap_sym_out,
- ecoff_swap_opt_out,
- ecoff_swap_fdr_out,
- ecoff_swap_rfd_out,
- ecoff_swap_ext_out,
- _bfd_ecoff_swap_tir_out,
- _bfd_ecoff_swap_rndx_out,
- /* Function to read in symbolic data. */
- _bfd_ecoff_slurp_symbolic_info
- },
- /* External reloc size. */
- RELSZ,
- /* Reloc swapping functions. */
- alpha_ecoff_swap_reloc_in,
- alpha_ecoff_swap_reloc_out,
- /* Backend reloc tweaking. */
- alpha_adjust_reloc_in,
- alpha_adjust_reloc_out,
- /* Relocate section contents while linking. */
- alpha_relocate_section,
- /* Do final adjustments to filehdr and aouthdr. */
- alpha_adjust_headers,
- /* Read an element from an archive at a given file position. */
- alpha_ecoff_get_elt_at_filepos
-};
-
-/* Looking up a reloc type is Alpha specific. */
-#define _bfd_ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup
-
-/* So is getting relocated section contents. */
-#define _bfd_ecoff_bfd_get_relocated_section_contents \
- alpha_ecoff_get_relocated_section_contents
-
-/* Handling file windows is generic. */
-#define _bfd_ecoff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-/* Relaxing sections is generic. */
-#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
-#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
-#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
-#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
-
-const bfd_target ecoffalpha_little_vec =
-{
- "ecoff-littlealpha", /* name */
- bfd_target_ecoff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
-
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
- {_bfd_dummy_target, alpha_ecoff_object_p, /* bfd_check_format */
- _bfd_ecoff_archive_p, _bfd_dummy_target},
- {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (_bfd_ecoff),
- BFD_JUMP_TABLE_COPY (_bfd_ecoff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (alpha_ecoff),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff),
- BFD_JUMP_TABLE_RELOCS (_bfd_ecoff),
- BFD_JUMP_TABLE_WRITE (_bfd_ecoff),
- BFD_JUMP_TABLE_LINK (_bfd_ecoff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) &alpha_ecoff_backend_data
-};
diff --git a/contrib/binutils/bfd/coff-arm.c b/contrib/binutils/bfd/coff-arm.c
deleted file mode 100644
index e51d07d..0000000
--- a/contrib/binutils/bfd/coff-arm.c
+++ /dev/null
@@ -1,2636 +0,0 @@
-/* BFD back-end for ARM COFF files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#include "coff/arm.h"
-
-#include "coff/internal.h"
-
-#ifdef COFF_WITH_PE
-#include "coff/pe.h"
-#endif
-
-#include "libcoff.h"
-
-/* 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) \
- 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]))
-#endif
-
-typedef enum {bunknown, b9, b12, b23} thumb_pcrel_branchtype;
-/* some typedefs for holding instructions */
-typedef unsigned long int insn32;
-typedef unsigned short int insn16;
-
- /* Forward declarations for stupid compilers. */
-static bfd_boolean coff_arm_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-static bfd_reloc_status_type aoutarm_fix_pcrel_26_done
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type aoutarm_fix_pcrel_26
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-#ifndef ARM_WINCE
-static bfd_reloc_status_type coff_thumb_pcrel_23
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type coff_thumb_pcrel_9
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static insn32 insert_thumb_branch
- PARAMS ((insn32, int));
-#endif
-static bfd_reloc_status_type coff_thumb_pcrel_12
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type coff_arm_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_boolean coff_arm_adjust_symndx
- PARAMS ((bfd *, struct bfd_link_info *, bfd *,
- asection *, struct internal_reloc *, bfd_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 *));
-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
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static struct bfd_link_hash_table * coff_arm_link_hash_table_create
- PARAMS ((bfd *));
-static struct coff_link_hash_entry * find_thumb_glue
- 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 *));
-#ifndef COFF_IMAGE_WITH_PE
-static void record_arm_to_thumb_glue
- PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
-#ifndef ARM_WINCE
-static void record_thumb_to_arm_glue
- PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
-#endif
-#endif
-static bfd_boolean coff_arm_merge_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static bfd_boolean coff_arm_print_private_bfd_data
- PARAMS ((bfd *, PTR));
-static bfd_boolean _bfd_coff_arm_set_private_flags
- PARAMS ((bfd *, flagword));
-static bfd_boolean coff_arm_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static bfd_boolean coff_arm_is_local_label_name
- PARAMS ((bfd *, const char *));
-static bfd_boolean coff_arm_link_output_has_begun
- PARAMS ((bfd *, struct coff_final_link_info *));
-static bfd_boolean coff_arm_final_link_postscript
- PARAMS ((bfd *, struct coff_final_link_info *));
-static void arm_emit_base_file_entry
- PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma));
-
-/* The linker script knows the section names for placement.
- The entry_names are used to do simple name mangling on the stubs.
- Given a function name, and its type, the stub can be found. The
- name can be changed. The only requirement is the %s be present. */
-
-#define THUMB2ARM_GLUE_SECTION_NAME ".glue_7t"
-#define THUMB2ARM_GLUE_ENTRY_NAME "__%s_from_thumb"
-
-#define ARM2THUMB_GLUE_SECTION_NAME ".glue_7"
-#define ARM2THUMB_GLUE_ENTRY_NAME "__%s_from_arm"
-
-/* Used by the assembler. */
-
-static bfd_reloc_status_type
-coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- symvalue diff;
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- diff = reloc_entry->addend;
-
-#define DOIT(x) \
- x = ((x & ~howto->dst_mask) \
- | (((x & howto->src_mask) + diff) & howto->dst_mask))
-
- if (diff != 0)
- {
- reloc_howto_type *howto = reloc_entry->howto;
- unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-
- switch (howto->size)
- {
- case 0:
- {
- char x = bfd_get_8 (abfd, addr);
- DOIT (x);
- bfd_put_8 (abfd, x, addr);
- }
- break;
-
- case 1:
- {
- short x = bfd_get_16 (abfd, addr);
- DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- case 2:
- {
- long x = bfd_get_32 (abfd, addr);
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- default:
- abort ();
- }
- }
-
- /* Now let bfd_perform_relocation finish everything up. */
- return bfd_reloc_continue;
-}
-
-/* If USER_LABEL_PREFIX is defined as "_" (see coff_arm_is_local_label_name()
- in this file), then TARGET_UNDERSCORE should be defined, otherwise it
- should not. */
-#ifndef TARGET_UNDERSCORE
-#define TARGET_UNDERSCORE '_'
-#endif
-
-#ifndef PCRELOFFSET
-#define PCRELOFFSET TRUE
-#endif
-
-/* These most certainly belong somewhere else. Just had to get rid of
- the manifest constants in the code. */
-#define ARM_8 0
-#define ARM_16 1
-#define ARM_32 2
-#define ARM_26 3
-#define ARM_DISP8 4
-#define ARM_DISP16 5
-#define ARM_DISP32 6
-#define ARM_26D 7
-/* 8 is unused */
-#define ARM_NEG16 9
-#define ARM_NEG32 10
-#define ARM_RVA32 11
-#define ARM_THUMB9 12
-#define ARM_THUMB12 13
-#define ARM_THUMB23 14
-
-#ifdef ARM_WINCE
-#undef ARM_32
-#undef ARM_RVA32
-#undef ARM_26
-#undef ARM_THUMB12
-#undef ARM_26D
-
-#define ARM_26D 0
-#define ARM_32 1
-#define ARM_RVA32 2
-#define ARM_26 3
-#define ARM_THUMB12 4
-#define ARM_SECTION 14
-#define ARM_SECREL 15
-#endif
-
-static reloc_howto_type aoutarm_std_reloc_howto[] =
- {
-#ifdef ARM_WINCE
- HOWTO (ARM_26D,
- 2,
- 2,
- 24,
- TRUE,
- 0,
- complain_overflow_dont,
- aoutarm_fix_pcrel_26_done,
- "ARM_26D",
- FALSE,
- 0x00ffffff,
- 0x0,
- PCRELOFFSET),
- HOWTO (ARM_32,
- 0,
- 2,
- 32,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_32",
- FALSE,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO (ARM_RVA32,
- 0,
- 2,
- 32,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_RVA32",
- FALSE,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO (ARM_26,
- 2,
- 2,
- 24,
- TRUE,
- 0,
- complain_overflow_signed,
- aoutarm_fix_pcrel_26 ,
- "ARM_26",
- FALSE,
- 0x00ffffff,
- 0x00ffffff,
- PCRELOFFSET),
- HOWTO (ARM_THUMB12,
- 1,
- 1,
- 11,
- TRUE,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_12 ,
- "ARM_THUMB12",
- FALSE,
- 0x000007ff,
- 0x000007ff,
- PCRELOFFSET),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- HOWTO (ARM_SECTION,
- 0,
- 1,
- 16,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_SECTION",
- FALSE,
- 0x0000ffff,
- 0x0000ffff,
- PCRELOFFSET),
- HOWTO (ARM_SECREL,
- 0,
- 2,
- 32,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_SECREL",
- FALSE,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
-#else /* not ARM_WINCE */
- HOWTO (ARM_8, /* type */
- 0, /* rightshift */
- 0, /* size */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_arm_reloc, /* special_function */
- "ARM_8", /* name */
- TRUE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- PCRELOFFSET /* pcrel_offset */),
- HOWTO (ARM_16,
- 0,
- 1,
- 16,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_16",
- TRUE,
- 0x0000ffff,
- 0x0000ffff,
- PCRELOFFSET),
- HOWTO (ARM_32,
- 0,
- 2,
- 32,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_32",
- TRUE,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO (ARM_26,
- 2,
- 2,
- 24,
- TRUE,
- 0,
- complain_overflow_signed,
- aoutarm_fix_pcrel_26 ,
- "ARM_26",
- FALSE,
- 0x00ffffff,
- 0x00ffffff,
- PCRELOFFSET),
- HOWTO (ARM_DISP8,
- 0,
- 0,
- 8,
- TRUE,
- 0,
- complain_overflow_signed,
- coff_arm_reloc,
- "ARM_DISP8",
- TRUE,
- 0x000000ff,
- 0x000000ff,
- TRUE),
- HOWTO (ARM_DISP16,
- 0,
- 1,
- 16,
- TRUE,
- 0,
- complain_overflow_signed,
- coff_arm_reloc,
- "ARM_DISP16",
- TRUE,
- 0x0000ffff,
- 0x0000ffff,
- TRUE),
- HOWTO (ARM_DISP32,
- 0,
- 2,
- 32,
- TRUE,
- 0,
- complain_overflow_signed,
- coff_arm_reloc,
- "ARM_DISP32",
- TRUE,
- 0xffffffff,
- 0xffffffff,
- TRUE),
- HOWTO (ARM_26D,
- 2,
- 2,
- 24,
- FALSE,
- 0,
- complain_overflow_dont,
- aoutarm_fix_pcrel_26_done,
- "ARM_26D",
- TRUE,
- 0x00ffffff,
- 0x0,
- FALSE),
- /* 8 is unused */
- EMPTY_HOWTO (-1),
- HOWTO (ARM_NEG16,
- 0,
- -1,
- 16,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_NEG16",
- TRUE,
- 0x0000ffff,
- 0x0000ffff,
- FALSE),
- HOWTO (ARM_NEG32,
- 0,
- -2,
- 32,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_NEG32",
- TRUE,
- 0xffffffff,
- 0xffffffff,
- FALSE),
- HOWTO (ARM_RVA32,
- 0,
- 2,
- 32,
- FALSE,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_RVA32",
- TRUE,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO (ARM_THUMB9,
- 1,
- 1,
- 8,
- TRUE,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_9 ,
- "ARM_THUMB9",
- FALSE,
- 0x000000ff,
- 0x000000ff,
- PCRELOFFSET),
- HOWTO (ARM_THUMB12,
- 1,
- 1,
- 11,
- TRUE,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_12 ,
- "ARM_THUMB12",
- FALSE,
- 0x000007ff,
- 0x000007ff,
- PCRELOFFSET),
- HOWTO (ARM_THUMB23,
- 1,
- 2,
- 22,
- TRUE,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_23 ,
- "ARM_THUMB23",
- FALSE,
- 0x07ff07ff,
- 0x07ff07ff,
- PCRELOFFSET)
-#endif /* not ARM_WINCE */
- };
-
-#define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto)
-
-#ifdef COFF_WITH_PE
-static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
-/* Return TRUE if this relocation should
- appear in the output .reloc section. */
-
-static bfd_boolean
-in_reloc_p (abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type * howto;
-{
- return !howto->pc_relative && howto->type != ARM_RVA32;
-}
-#endif
-
-#define RTYPE2HOWTO(cache_ptr, dst) \
- (cache_ptr)->howto = \
- (dst)->r_type < NUM_RELOCS \
- ? aoutarm_std_reloc_howto + (dst)->r_type \
- : NULL
-
-#define coff_rtype_to_howto coff_arm_rtype_to_howto
-
-static reloc_howto_type *
-coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- bfd_vma *addendp;
-{
- reloc_howto_type * howto;
-
- if (rel->r_type >= NUM_RELOCS)
- return NULL;
-
- howto = aoutarm_std_reloc_howto + rel->r_type;
-
- if (rel->r_type == ARM_RVA32)
- *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
-
- return howto;
-}
-
-/* Used by the assembler. */
-
-static bfd_reloc_status_type
-aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
-{
- /* This is dead simple at present. */
- return bfd_reloc_ok;
-}
-
-/* Used by the assembler. */
-
-static bfd_reloc_status_type
-aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_size_type addr = reloc_entry->address;
- long 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. */
- if (symbol->section == &bfd_und_section
- && (symbol->flags & BSF_WEAK) == 0)
- return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
-
- /* If the sections are different, and we are doing a partial relocation,
- just ignore it for now. */
- if (symbol->section->name != input_section->name
- && output_bfd != (bfd *)NULL)
- return bfd_reloc_continue;
-
- relocation = (target & 0x00ffffff) << 2;
- relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend. */
- relocation += symbol->value;
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
- relocation -= input_section->output_section->vma;
- relocation -= input_section->output_offset;
- relocation -= addr;
-
- if (relocation & 3)
- return bfd_reloc_overflow;
-
- /* Check for overflow. */
- if (relocation & 0x02000000)
- {
- if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
- flag = bfd_reloc_overflow;
- }
- else if (relocation & ~(bfd_vma) 0x03ffffff)
- flag = bfd_reloc_overflow;
-
- target &= ~0x00ffffff;
- target |= (relocation >> 2) & 0x00ffffff;
- 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. */
- reloc_entry->howto = &aoutarm_std_reloc_howto[ARM_26D];
-
- return flag;
-}
-
-static bfd_reloc_status_type
-coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message, btype)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
- thumb_pcrel_branchtype btype;
-{
- bfd_vma relocation = 0;
- bfd_size_type addr = reloc_entry->address;
- long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
- bfd_reloc_status_type flag = bfd_reloc_ok;
- bfd_vma dstmsk;
- bfd_vma offmsk;
- bfd_vma signbit;
-
- /* NOTE: This routine is currently used by GAS, but not by the link
- phase. */
-
- switch (btype)
- {
- case b9:
- dstmsk = 0x000000ff;
- offmsk = 0x000001fe;
- signbit = 0x00000100;
- break;
-
- case b12:
- dstmsk = 0x000007ff;
- offmsk = 0x00000ffe;
- signbit = 0x00000800;
- break;
-
- case b23:
- dstmsk = 0x07ff07ff;
- offmsk = 0x007fffff;
- signbit = 0x00400000;
- break;
-
- default:
- abort ();
- }
-
- /* If this is an undefined symbol, return error. */
- if (symbol->section == &bfd_und_section
- && (symbol->flags & BSF_WEAK) == 0)
- return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
-
- /* If the sections are different, and we are doing a partial relocation,
- just ignore it for now. */
- if (symbol->section->name != input_section->name
- && output_bfd != (bfd *)NULL)
- return bfd_reloc_continue;
-
- switch (btype)
- {
- case b9:
- case b12:
- relocation = ((target & dstmsk) << 1);
- break;
-
- case b23:
- if (bfd_big_endian (abfd))
- relocation = ((target & 0x7ff) << 1) | ((target & 0x07ff0000) >> 4);
- else
- relocation = ((target & 0x7ff) << 12) | ((target & 0x07ff0000) >> 15);
- break;
-
- default:
- abort ();
- }
-
- relocation = (relocation ^ signbit) - signbit; /* Sign extend. */
- relocation += symbol->value;
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
- relocation -= input_section->output_section->vma;
- relocation -= input_section->output_offset;
- relocation -= addr;
-
- if (relocation & 1)
- return bfd_reloc_overflow;
-
- /* Check for overflow. */
- if (relocation & signbit)
- {
- if ((relocation & ~offmsk) != ~offmsk)
- flag = bfd_reloc_overflow;
- }
- else if (relocation & ~offmsk)
- flag = bfd_reloc_overflow;
-
- target &= ~dstmsk;
- switch (btype)
- {
- case b9:
- case b12:
- target |= (relocation >> 1);
- break;
-
- case b23:
- if (bfd_big_endian (abfd))
- target |= (((relocation & 0xfff) >> 1)
- | ((relocation << 4) & 0x07ff0000));
- else
- target |= (((relocation & 0xffe) << 15)
- | ((relocation >> 12) & 0x7ff));
- break;
-
- default:
- abort ();
- }
-
- 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. */
- reloc_entry->howto = & aoutarm_std_reloc_howto [ARM_26D];
-
- /* TODO: We should possibly have DONE entries for the THUMB PCREL relocations. */
- return flag;
-}
-
-#ifndef ARM_WINCE
-static bfd_reloc_status_type
-coff_thumb_pcrel_23 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message,
- b23);
-}
-
-static bfd_reloc_status_type
-coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message,
- b9);
-}
-#endif /* not ARM_WINCE */
-
-static bfd_reloc_status_type
-coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message,
- b12);
-}
-
-static const struct reloc_howto_struct *
-coff_arm_reloc_type_lookup (abfd, code)
- bfd * abfd;
- bfd_reloc_code_real_type code;
-{
-#define ASTD(i,j) case i: return aoutarm_std_reloc_howto + j
-
- if (code == BFD_RELOC_CTOR)
- switch (bfd_get_arch_info (abfd)->bits_per_address)
- {
- case 32:
- code = BFD_RELOC_32;
- break;
- default:
- return (const struct reloc_howto_struct *) 0;
- }
-
- switch (code)
- {
-#ifdef ARM_WINCE
- ASTD (BFD_RELOC_32, ARM_32);
- ASTD (BFD_RELOC_RVA, ARM_RVA32);
- ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26);
- ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12);
-#else
- ASTD (BFD_RELOC_8, ARM_8);
- ASTD (BFD_RELOC_16, ARM_16);
- ASTD (BFD_RELOC_32, ARM_32);
- ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26);
- ASTD (BFD_RELOC_ARM_PCREL_BLX, ARM_26);
- ASTD (BFD_RELOC_8_PCREL, ARM_DISP8);
- ASTD (BFD_RELOC_16_PCREL, ARM_DISP16);
- ASTD (BFD_RELOC_32_PCREL, ARM_DISP32);
- ASTD (BFD_RELOC_RVA, ARM_RVA32);
- ASTD (BFD_RELOC_THUMB_PCREL_BRANCH9, ARM_THUMB9);
- ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12);
- 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;
- }
-}
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
-#define COFF_PAGE_SIZE 0x1000
-/* Turn a howto into a reloc nunmber */
-
-#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
-#define BADMAG(x) ARMBADMAG(x)
-#define ARM 1 /* Customize coffcode.h */
-
-#ifndef ARM_WINCE
-/* Make sure that the 'r_offset' field is copied properly
- so that identical binaries will compare the same. */
-#define SWAP_IN_RELOC_OFFSET H_GET_32
-#define SWAP_OUT_RELOC_OFFSET H_PUT_32
-#endif
-
-/* Extend the coff_link_hash_table structure with a few ARM specific fields.
- This allows us to store global data here without actually creating any
- global variables, which is a no-no in the BFD world. */
-struct coff_arm_link_hash_table
- {
- /* The original coff_link_hash_table structure. MUST be first field. */
- struct coff_link_hash_table root;
-
- /* The size in bytes of the section containing the Thumb-to-ARM glue. */
- bfd_size_type thumb_glue_size;
-
- /* The size in bytes of the section containing the ARM-to-Thumb glue. */
- bfd_size_type arm_glue_size;
-
- /* An arbitrary input BFD chosen to hold the glue sections. */
- bfd * bfd_of_glue_owner;
-
- /* Support interworking with old, non-interworking aware ARM code. */
- int support_old_code;
-};
-
-/* Get the ARM coff linker hash table from a link_info structure. */
-#define coff_arm_hash_table(info) \
- ((struct coff_arm_link_hash_table *) ((info)->hash))
-
-/* Create an ARM coff linker hash table. */
-
-static struct bfd_link_hash_table *
-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_malloc (amt);
- if (ret == (struct coff_arm_link_hash_table *) NULL)
- return NULL;
-
- if (! _bfd_coff_link_hash_table_init
- (& ret->root, abfd, _bfd_coff_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
-
- ret->thumb_glue_size = 0;
- ret->arm_glue_size = 0;
- ret->bfd_of_glue_owner = NULL;
-
- return & ret->root.root;
-}
-
-static void
-arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
- struct bfd_link_info *info;
- bfd *output_bfd;
- asection *input_section;
- bfd_vma reloc_offset;
-{
- bfd_vma addr = reloc_offset
- - input_section->vma
- + input_section->output_offset
- + input_section->output_section->vma;
-
- if (coff_data (output_bfd)->pe)
- addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
- fwrite (& addr, 1, sizeof (addr), (FILE *) info->base_file);
-
-}
-
-#ifndef ARM_WINCE
-/* The thumb form of a long branch is a bit finicky, because the offset
- encoding is split over two fields, each in it's own instruction. They
- can occur in any order. So given a thumb form of long branch, and an
- offset, insert the offset into the thumb branch and return finished
- instruction.
-
- It takes two thumb instructions to encode the target address. Each has
- 11 bits to invest. The upper 11 bits are stored in one (identified by
- H-0.. see below), the lower 11 bits are stored in the other (identified
- by H-1).
-
- Combine together and shifted left by 1 (it's a half word address) and
- there you have it.
-
- Op: 1111 = F,
- H-0, upper address-0 = 000
- Op: 1111 = F,
- H-1, lower address-0 = 800
-
- They can be ordered either way, but the arm tools I've seen always put
- the lower one first. It probably doesn't matter. krk@cygnus.com
-
- XXX: Actually the order does matter. The second instruction (H-1)
- moves the computed address into the PC, so it must be the second one
- in the sequence. The problem, however is that whilst little endian code
- stores the instructions in HI then LOW order, big endian code does the
- reverse. nickc@cygnus.com. */
-
-#define LOW_HI_ORDER 0xF800F000
-#define HI_LOW_ORDER 0xF000F800
-
-static insn32
-insert_thumb_branch (br_insn, rel_off)
- insn32 br_insn;
- int rel_off;
-{
- unsigned int low_bits;
- unsigned int high_bits;
-
- BFD_ASSERT((rel_off & 1) != 1);
-
- rel_off >>= 1; /* half word aligned address */
- low_bits = rel_off & 0x000007FF; /* the bottom 11 bits */
- high_bits = (rel_off >> 11) & 0x000007FF; /* the top 11 bits */
-
- if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER)
- br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits;
- 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 except for internal errors
- - it should return an error status. */
- abort (); /* Error - not a valid branch instruction form. */
-
- return br_insn;
-}
-
-
-static struct coff_link_hash_entry *
-find_thumb_glue (info, name, input_bfd)
- struct bfd_link_info *info;
- const char *name;
- bfd *input_bfd;
-{
- 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 (amt);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
-
- myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
-
- if (myh == NULL)
- /* xgettext:c-format */
- _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
-
- free (tmp_name);
-
- return myh;
-}
-#endif /* not ARM_WINCE */
-
-static struct coff_link_hash_entry *
-find_arm_glue (info, name, input_bfd)
- struct bfd_link_info *info;
- const char *name;
- bfd *input_bfd;
-{
- 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 (amt);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
-
- myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
-
- if (myh == NULL)
- /* xgettext:c-format */
- _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
-
- free (tmp_name);
-
- return myh;
-}
-
-/*
- ARM->Thumb glue:
-
- .arm
- __func_from_arm:
- ldr r12, __func_addr
- bx r12
- __func_addr:
- .word func @ behave as if you saw a ARM_32 reloc
-*/
-
-#define ARM2THUMB_GLUE_SIZE 12
-static const insn32 a2t1_ldr_insn = 0xe59fc000;
-static const insn32 a2t2_bx_r12_insn = 0xe12fff1c;
-static const insn32 a2t3_func_addr_insn = 0x00000001;
-
-/*
- Thumb->ARM: Thumb->(non-interworking aware) ARM
-
- .thumb .thumb
- .align 2 .align 2
- __func_from_thumb: __func_from_thumb:
- bx pc push {r6, lr}
- nop ldr r6, __func_addr
- .arm mov lr, pc
- __func_change_to_arm: bx r6
- b func .arm
- __func_back_to_thumb:
- ldmia r13! {r6, lr}
- bx lr
- __func_addr:
- .word func
-*/
-
-#define THUMB2ARM_GLUE_SIZE (globals->support_old_code ? 20 : 8)
-static const insn16 t2a1_bx_pc_insn = 0x4778;
-static const insn16 t2a2_noop_insn = 0x46c0;
-static const insn32 t2a3_b_insn = 0xea000000;
-
-static const insn16 t2a1_push_insn = 0xb540;
-static const insn16 t2a2_ldr_insn = 0x4e03;
-static const insn16 t2a3_mov_insn = 0x46fe;
-static const insn16 t2a4_bx_insn = 0x4730;
-static const insn32 t2a5_pop_insn = 0xe8bd4040;
-static const insn32 t2a6_bx_insn = 0xe12fff1e;
-
-/* TODO:
- We should really create new local (static) symbols in destination
- object for each stub we create. We should also create local
- (static) symbols within the stubs when switching between ARM and
- Thumb code. This will ensure that the debugger and disassembler
- can present a better view of stubs.
-
- We can treat stubs like literal sections, and for the THUMB9 ones
- (short addressing range) we should be able to insert the stubs
- between sections. i.e. the simplest approach (since relocations
- are done on a section basis) is to dump the stubs at the end of
- processing a section. That way we can always try and minimise the
- offset to and from a stub. However, this does not map well onto
- the way that the linker/BFD does its work: mapping all input
- sections to output sections via the linker script before doing
- all the processing.
-
- Unfortunately it may be easier to just to disallow short range
- Thumb->ARM stubs (i.e. no conditional inter-working branches,
- only branch-and-link (BL) calls. This will simplify the processing
- since we can then put all of the stubs into their own section.
-
- TODO:
- On a different subject, rather than complaining when a
- branch cannot fit in the number of bits available for the
- instruction we should generate a trampoline stub (needed to
- address the complete 32bit address space). */
-
-/* The standard COFF backend linker does not cope with the special
- Thumb BRANCH23 relocation. The alternative would be to split the
- BRANCH23 into seperate HI23 and LO23 relocations. However, it is a
- bit simpler simply providing our own relocation driver. */
-
-/* The reloc processing routine for the ARM/Thumb COFF linker. NOTE:
- This code is a very slightly modified copy of
- _bfd_coff_generic_relocate_section. It would be a much more
- maintainable solution to have a MACRO that could be expanded within
- _bfd_coff_generic_relocate_section that would only be provided for
- ARM/Thumb builds. It is only the code marked THUMBEXTENSION that
- is different from the original. */
-
-static bfd_boolean
-coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, syms, sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
-{
- struct internal_reloc * rel;
- struct internal_reloc * relend;
-
- rel = relocs;
- relend = rel + input_section->reloc_count;
-
- for (; rel < relend; rel++)
- {
- int done = 0;
- long symndx;
- struct coff_link_hash_entry * h;
- struct internal_syment * sym;
- bfd_vma addend;
- bfd_vma val;
- reloc_howto_type * howto;
- bfd_reloc_status_type rstat;
- bfd_vma h_val;
-
- symndx = rel->r_symndx;
-
- if (symndx == -1)
- {
- h = NULL;
- sym = NULL;
- }
- else
- {
- h = obj_coff_sym_hashes (input_bfd)[symndx];
- sym = syms + symndx;
- }
-
- /* COFF treats common symbols in one of two ways. Either the
- size of the symbol is included in the section contents, or it
- is not. We assume that the size is not included, and force
- the rtype_to_howto function to adjust the addend as needed. */
-
- if (sym != NULL && sym->n_scnum != 0)
- addend = - sym->n_value;
- else
- addend = 0;
-
- howto = coff_rtype_to_howto (input_bfd, input_section, rel, h,
- sym, &addend);
- if (howto == NULL)
- return FALSE;
-
- /* The relocation_section function will skip pcrel_offset relocs
- when doing a relocatable link. However, we want to convert
- ARM_26 to ARM_26D relocs if possible. We return a fake howto in
- this case without pcrel_offset set, and adjust the addend to
- compensate. 'partial_inplace' is also set, since we want 'done'
- relocations to be reflected in section's data. */
- if (rel->r_type == ARM_26
- && h != NULL
- && info->relocatable
- && (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))
- {
- static reloc_howto_type fake_arm26_reloc =
- HOWTO (ARM_26,
- 2,
- 2,
- 24,
- TRUE,
- 0,
- complain_overflow_signed,
- aoutarm_fix_pcrel_26 ,
- "ARM_26",
- TRUE,
- 0x00ffffff,
- 0x00ffffff,
- FALSE);
-
- addend -= rel->r_vaddr - input_section->vma;
-#ifdef ARM_WINCE
- /* FIXME: I don't know why, but the hack is necessary for correct
- generation of bl's instruction offset. */
- addend -= 8;
-#endif
- howto = &fake_arm26_reloc;
- }
-
-#ifdef ARM_WINCE
- /* MS ARM-CE makes the reloc relative to the opcode's pc, not
- the next opcode's pc, so is off by one. */
-#if 0 /* This appears to have been true for WINCE 2.0, but it is not
- true for WINCE 3.0. */
- if (howto->pc_relative && !info->relocatable)
- addend -= 8;
-#endif
-#endif
-
- /* If we are doing a relocatable link, then we can just ignore
- a PC relative reloc that is pcrel_offset. It will already
- have the correct value. If this is not a relocatable link,
- then we should ignore the symbol value. */
- if (howto->pc_relative && howto->pcrel_offset)
- {
- if (info->relocatable)
- continue;
- /* FIXME - it is not clear which targets need this next test
- and which do not. It is known that it is needed for the
- VxWorks and EPOC-PE targets, but it is also known that it
- was suppressed for other ARM targets. This ought to be
- sorted out one day. */
-#ifdef ARM_COFF_BUGFIX
- /* We must not ignore the symbol value. If the symbol is
- within the same section, the relocation should have already
- been fixed, but if it is not, we'll be handed a reloc into
- the beginning of the symbol's section, so we must not cancel
- out the symbol's value, otherwise we'll be adding it in
- twice. */
- if (sym != NULL && sym->n_scnum != 0)
- addend += sym->n_value;
-#endif
- }
-
- val = 0;
-
- if (h == NULL)
- {
- asection *sec;
-
- if (symndx == -1)
- {
- sec = bfd_abs_section_ptr;
- val = 0;
- }
- else
- {
- sec = sections[symndx];
- val = (sec->output_section->vma
- + sec->output_offset
- + sym->n_value
- - sec->vma);
- }
- }
- else
- {
-#if 1 /* THUMBEXTENSION */
- /* We don't output the stubs if we are generating a
- relocatable output file, since we may as well leave the
- stub generation to the final linker pass. If we fail to
- verify that the name is defined, we'll try to build stubs
- for an undefined name... */
- if (! info->relocatable
- && ( h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- asection * h_sec = h->root.u.def.section;
- const char * name = h->root.root.string;
-
- /* h locates the symbol referenced in the reloc. */
- h_val = (h->root.u.def.value
- + h_sec->output_section->vma
- + h_sec->output_offset);
-
- if (howto->type == ARM_26)
- {
- if ( h->class == C_THUMBSTATFUNC
- || h->class == C_THUMBEXTFUNC)
- {
- /* Arm code calling a Thumb function. */
- unsigned long int tmp;
- bfd_vma my_offset;
- asection * s;
- long int ret_offset;
- struct coff_link_hash_entry * myh;
- struct coff_arm_link_hash_table * globals;
-
- myh = find_arm_glue (info, name, input_bfd);
- if (myh == NULL)
- return FALSE;
-
- globals = coff_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- my_offset = myh->root.u.def.value;
-
- s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
- ARM2THUMB_GLUE_SECTION_NAME);
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->contents != NULL);
- BFD_ASSERT (s->output_section != NULL);
-
- if ((my_offset & 0x01) == 0x01)
- {
- if (h_sec->owner != NULL
- && INTERWORK_SET (h_sec->owner)
- && ! INTERWORK_FLAG (h_sec->owner))
- {
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%s(%s): warning: interworking not enabled."),
- bfd_archive_filename (h_sec->owner), name);
- _bfd_error_handler
- /* xgettext:c-format */
- (_(" first occurrence: %s: arm call to thumb"),
- bfd_archive_filename (input_bfd));
- }
-
- --my_offset;
- myh->root.u.def.value = my_offset;
-
- bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn,
- s->contents + my_offset);
-
- 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. */
- bfd_put_32 (output_bfd, h_val | a2t3_func_addr_insn,
- s->contents + my_offset + 8);
-
- if (info->base_file)
- arm_emit_base_file_entry (info, output_bfd, s,
- my_offset + 8);
-
- }
-
- BFD_ASSERT (my_offset <= globals->arm_glue_size);
-
- tmp = bfd_get_32 (input_bfd, contents + rel->r_vaddr
- - input_section->vma);
-
- 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
- + rel->r_vaddr)
- - 8;
-
- tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF);
-
- bfd_put_32 (output_bfd, (bfd_vma) tmp,
- contents + rel->r_vaddr - input_section->vma);
- done = 1;
- }
- }
-
-#ifndef ARM_WINCE
- /* Note: We used to check for ARM_THUMB9 and ARM_THUMB12. */
- else if (howto->type == ARM_THUMB23)
- {
- if ( h->class == C_EXT
- || h->class == C_STAT
- || h->class == C_LABEL)
- {
- /* Thumb code calling an ARM function */
- asection * s = 0;
- bfd_vma my_offset;
- unsigned long int tmp;
- long int ret_offset;
- struct coff_link_hash_entry * myh;
- struct coff_arm_link_hash_table * globals;
-
- myh = find_thumb_glue (info, name, input_bfd);
- if (myh == NULL)
- return FALSE;
-
- globals = coff_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- my_offset = myh->root.u.def.value;
-
- s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
- THUMB2ARM_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->contents != NULL);
- BFD_ASSERT (s->output_section != NULL);
-
- if ((my_offset & 0x01) == 0x01)
- {
- if (h_sec->owner != NULL
- && INTERWORK_SET (h_sec->owner)
- && ! INTERWORK_FLAG (h_sec->owner)
- && ! globals->support_old_code)
- {
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%s(%s): warning: interworking not enabled."),
- bfd_archive_filename (h_sec->owner), name);
- _bfd_error_handler
- /* xgettext:c-format */
- (_(" first occurrence: %s: thumb call to arm"),
- bfd_archive_filename (input_bfd));
- _bfd_error_handler
- (_(" consider relinking with --support-old-code enabled"));
- }
-
- -- my_offset;
- myh->root.u.def.value = my_offset;
-
- if (globals->support_old_code)
- {
- bfd_put_16 (output_bfd, (bfd_vma) t2a1_push_insn,
- s->contents + my_offset);
-
- bfd_put_16 (output_bfd, (bfd_vma) t2a2_ldr_insn,
- s->contents + my_offset + 2);
-
- bfd_put_16 (output_bfd, (bfd_vma) t2a3_mov_insn,
- s->contents + my_offset + 4);
-
- bfd_put_16 (output_bfd, (bfd_vma) t2a4_bx_insn,
- s->contents + my_offset + 6);
-
- bfd_put_32 (output_bfd, (bfd_vma) t2a5_pop_insn,
- s->contents + my_offset + 8);
-
- 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. */
- bfd_put_32 (output_bfd, h_val,
- s->contents + my_offset + 16);
-
- if (info->base_file)
- arm_emit_base_file_entry (info, output_bfd, s,
- my_offset + 16);
- }
- else
- {
- bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn,
- s->contents + my_offset);
-
- bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn,
- s->contents + my_offset + 2);
-
- ret_offset =
- ((bfd_signed_vma) h_val) /* Address of destination of the stub. */
- - ((bfd_signed_vma)
- (s->output_offset /* Offset from the start of the current section to the start of the stubs. */
- + my_offset /* Offset of the start of this stub from the start of the stubs. */
- + s->output_section->vma) /* Address of the start of the current section. */
- + 4 /* The branch instruction is 4 bytes into the stub. */
- + 8); /* ARM branches work from the pc of the instruction + 8. */
-
- bfd_put_32 (output_bfd,
- (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
- s->contents + my_offset + 4);
-
- }
- }
-
- BFD_ASSERT (my_offset <= globals->thumb_glue_size);
-
- /* 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
- + rel->r_vaddr)
- -4;
-
- tmp = bfd_get_32 (input_bfd, contents + rel->r_vaddr
- - input_section->vma);
-
- bfd_put_32 (output_bfd,
- (bfd_vma) insert_thumb_branch (tmp,
- ret_offset),
- contents + rel->r_vaddr - input_section->vma);
-
- done = 1;
- }
- }
-#endif
- }
-
- /* If the relocation type and destination symbol does not
- fall into one of the above categories, then we can just
- perform a direct link. */
-
- if (done)
- rstat = bfd_reloc_ok;
- else
-#endif /* THUMBEXTENSION */
- if ( h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *sec;
-
- sec = h->root.u.def.section;
- val = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
-
- else if (! info->relocatable)
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, TRUE)))
- return FALSE;
- }
- }
-
- if (info->base_file)
- {
- /* 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);
- }
-
-#if 1 /* THUMBEXTENSION */
- if (done)
- rstat = bfd_reloc_ok;
-#ifndef ARM_WINCE
- /* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */
- else if (! info->relocatable
- && howto->type == ARM_THUMB23)
- {
- /* This is pretty much a copy of what the default
- _bfd_final_link_relocate and _bfd_relocate_contents
- routines do to perform a relocation, with special
- processing for the split addressing of the Thumb BL
- instruction. Again, it would probably be simpler adding a
- ThumbBRANCH23 specific macro expansion into the default
- code. */
-
- bfd_vma address = rel->r_vaddr - input_section->vma;
-
- if (address > input_section->_raw_size)
- rstat = bfd_reloc_outofrange;
- else
- {
- bfd_vma relocation = val + addend;
- int size = bfd_get_reloc_size (howto);
- bfd_boolean overflow = FALSE;
- bfd_byte *location = contents + address;
- bfd_vma x = bfd_get_32 (input_bfd, location);
- bfd_vma src_mask = 0x007FFFFE;
- bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
- bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
- bfd_vma check;
- bfd_signed_vma signed_check;
- bfd_vma add;
- bfd_signed_vma signed_add;
-
- BFD_ASSERT (size == 4);
-
- /* howto->pc_relative should be TRUE for type 14 BRANCH23. */
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
-
- /* howto->pcrel_offset should be TRUE for type 14 BRANCH23. */
- relocation -= address;
-
- /* No need to negate the relocation with BRANCH23. */
- /* howto->complain_on_overflow == complain_overflow_signed for BRANCH23. */
- /* howto->rightshift == 1 */
-
- /* Drop unwanted bits from the value we are relocating to. */
- check = relocation >> howto->rightshift;
-
- /* If this is a signed value, the rightshift just dropped
- leading 1 bits (assuming twos complement). */
- if ((bfd_signed_vma) relocation >= 0)
- signed_check = check;
- else
- signed_check = (check
- | ((bfd_vma) - 1
- & ~((bfd_vma) - 1 >> howto->rightshift)));
-
- /* Get the value from the object file. */
- if (bfd_big_endian (input_bfd))
- add = (((x) & 0x07ff0000) >> 4) | (((x) & 0x7ff) << 1);
- else
- add = ((((x) & 0x7ff) << 12) | (((x) & 0x07ff0000) >> 15));
-
- /* Get the value from the object file with an appropriate sign.
- The expression involving howto->src_mask isolates the upper
- bit of src_mask. If that bit is set in the value we are
- adding, it is negative, and we subtract out that number times
- two. If src_mask includes the highest possible bit, then we
- can not get the upper bit, but that does not matter since
- signed_add needs no adjustment to become negative in that
- case. */
- signed_add = add;
-
- if ((add & (((~ src_mask) >> 1) & src_mask)) != 0)
- signed_add -= (((~ src_mask) >> 1) & src_mask) << 1;
-
- /* howto->bitpos == 0 */
- /* Add the value from the object file, shifted so that it is a
- straight number. */
- signed_check += signed_add;
- relocation += signed_add;
-
- BFD_ASSERT (howto->complain_on_overflow == complain_overflow_signed);
-
- /* Assumes two's complement. */
- if ( signed_check > reloc_signed_max
- || signed_check < reloc_signed_min)
- overflow = TRUE;
-
- /* Put the relocation into the correct bits.
- For a BLX instruction, make sure that the relocation is rounded up
- to a word boundary. This follows the semantics of the instruction
- which specifies that bit 1 of the target address will come from bit
- 1 of the base address. */
- if (bfd_big_endian (input_bfd))
- {
- if ((x & 0x1800) == 0x0800 && (relocation & 0x02))
- relocation += 2;
- relocation = (((relocation & 0xffe) >> 1) | ((relocation << 4) & 0x07ff0000));
- }
- else
- {
- if ((x & 0x18000000) == 0x08000000 && (relocation & 0x02))
- relocation += 2;
- relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff));
- }
-
- /* Add the relocation to the correct bits of X. */
- x = ((x & ~howto->dst_mask) | relocation);
-
- /* Put the relocated value back in the object file. */
- bfd_put_32 (input_bfd, x, location);
-
- rstat = overflow ? bfd_reloc_overflow : bfd_reloc_ok;
- }
- }
-#endif
- else
-#endif /* THUMBEXTENSION */
- if (info->relocatable && ! howto->partial_inplace)
- rstat = bfd_reloc_ok;
- else
- rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents,
- rel->r_vaddr - input_section->vma,
- val, addend);
-#if 1 /* THUMBEXTENSION */
- /* FIXME:
- Is this the best way to fix up thumb addresses? krk@cygnus.com
- Probably not, but it works, and if it works it don't need fixing! nickc@cygnus.com */
- /* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */
- if (! info->relocatable
- && (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32))
- {
- /* Determine if we need to set the bottom bit of a relocated address
- because the address is the address of a Thumb code symbol. */
-
- int patchit = FALSE;
-
- if (h != NULL
- && ( h->class == C_THUMBSTATFUNC
- || h->class == C_THUMBEXTFUNC))
- {
- patchit = TRUE;
- }
- else if (sym != NULL
- && sym->n_scnum > N_UNDEF)
- {
- /* No hash entry - use the symbol instead. */
-
- if ( sym->n_sclass == C_THUMBSTATFUNC
- || sym->n_sclass == C_THUMBEXTFUNC)
- patchit = TRUE;
- }
-
- if (patchit)
- {
- bfd_byte * location = contents + rel->r_vaddr - input_section->vma;
- bfd_vma x = bfd_get_32 (input_bfd, location);
-
- bfd_put_32 (input_bfd, x | 1, location);
- }
- }
-#endif /* THUMBEXTENSION */
-
- switch (rstat)
- {
- default:
- abort ();
- case bfd_reloc_ok:
- break;
- case bfd_reloc_outofrange:
- (*_bfd_error_handler)
- (_("%s: bad reloc address 0x%lx in section `%s'"),
- bfd_archive_filename (input_bfd),
- (unsigned long) rel->r_vaddr,
- bfd_get_section_name (input_bfd, input_section));
- return FALSE;
- case bfd_reloc_overflow:
- {
- const char *name;
- char buf[SYMNMLEN + 1];
-
- if (symndx == -1)
- name = "*ABS*";
- else if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
- if (name == NULL)
- return FALSE;
- }
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-#ifndef COFF_IMAGE_WITH_PE
-
-bfd_boolean
-bfd_arm_allocate_interworking_sections (info)
- struct bfd_link_info * info;
-{
- asection * s;
- bfd_byte * foo;
- struct coff_arm_link_hash_table * globals;
-#if 0
- static char test_char = '1';
-#endif
-
- globals = coff_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
-
- if (globals->arm_glue_size != 0)
- {
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- 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);
-#if 0
- memset (foo, test_char, (size_t) globals->arm_glue_size);
-#endif
-
- s->_raw_size = s->_cooked_size = globals->arm_glue_size;
- s->contents = foo;
- }
-
- if (globals->thumb_glue_size != 0)
- {
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- s = bfd_get_section_by_name
- (globals->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
-
- foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
- globals->thumb_glue_size);
-#if 0
- memset (foo, test_char, (size_t) globals->thumb_glue_size);
-#endif
-
- s->_raw_size = s->_cooked_size = globals->thumb_glue_size;
- s->contents = foo;
- }
-
- return TRUE;
-}
-
-static void
-record_arm_to_thumb_glue (info, h)
- struct bfd_link_info * info;
- struct coff_link_hash_entry * h;
-{
- const char * name = h->root.root.string;
- register asection * s;
- char * tmp_name;
- struct coff_link_hash_entry * myh;
- struct bfd_link_hash_entry * bh;
- struct coff_arm_link_hash_table * globals;
- bfd_vma val;
- bfd_size_type amt;
-
- globals = coff_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- s = bfd_get_section_by_name
- (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
-
- amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
- tmp_name = (char *) bfd_malloc (amt);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
-
- myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
-
- if (myh != NULL)
- {
- free (tmp_name);
- return; /* we've already seen this guy */
- }
-
- /* The only trick here is using globals->arm_glue_size as the value. Even
- though the section isn't allocated yet, this is where we will be putting
- it. */
-
- bh = NULL;
- val = globals->arm_glue_size + 1;
- bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL, s, val, NULL, TRUE, FALSE, &bh);
-
- free (tmp_name);
-
- globals->arm_glue_size += ARM2THUMB_GLUE_SIZE;
-
- return;
-}
-
-#ifndef ARM_WINCE
-static void
-record_thumb_to_arm_glue (info, h)
- struct bfd_link_info * info;
- struct coff_link_hash_entry * h;
-{
- const char * name = h->root.root.string;
- register asection * s;
- char * tmp_name;
- struct coff_link_hash_entry * myh;
- struct bfd_link_hash_entry * bh;
- struct coff_arm_link_hash_table * globals;
- bfd_vma val;
- bfd_size_type amt;
-
- globals = coff_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- s = bfd_get_section_by_name
- (globals->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
-
- amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
- tmp_name = (char *) bfd_malloc (amt);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
-
- myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
-
- if (myh != NULL)
- {
- free (tmp_name);
- return; /* we've already seen this guy */
- }
-
- bh = NULL;
- val = globals->thumb_glue_size + 1;
- bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL, s, val, NULL, TRUE, FALSE, &bh);
-
- /* If we mark it 'thumb', the disassembler will do a better job. */
- myh = (struct coff_link_hash_entry *) bh;
- myh->class = C_THUMBEXTFUNC;
-
- free (tmp_name);
-
- /* Allocate another symbol to mark where we switch to arm mode. */
-
-#define CHANGE_TO_ARM "__%s_change_to_arm"
-#define BACK_FROM_ARM "__%s_back_from_arm"
-
- 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);
-
- bh = 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, val, NULL, TRUE, FALSE, &bh);
-
- free (tmp_name);
-
- globals->thumb_glue_size += THUMB2ARM_GLUE_SIZE;
-
- return;
-}
-#endif /* not ARM_WINCE */
-
-/* Select a BFD to be used to hold the sections used by the glue code.
- This function is called from the linker scripts in ld/emultempl/
- {armcoff/pe}.em */
-
-bfd_boolean
-bfd_arm_get_bfd_for_interworking (abfd, info)
- bfd * abfd;
- struct bfd_link_info * info;
-{
- struct coff_arm_link_hash_table * globals;
- flagword flags;
- asection * sec;
-
- /* If we are only performing a partial link do not bother
- getting a bfd to hold the glue. */
- if (info->relocatable)
- return TRUE;
-
- globals = coff_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
-
- if (globals->bfd_of_glue_owner != NULL)
- return TRUE;
-
- sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-
- if (sec == NULL)
- {
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-
- if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
- || ! bfd_set_section_alignment (abfd, sec, 2))
- return FALSE;
- }
-
- sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME);
-
- if (sec == NULL)
- {
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
-
- if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
- || ! bfd_set_section_alignment (abfd, sec, 2))
- return FALSE;
- }
-
- /* Save the bfd for later use. */
- globals->bfd_of_glue_owner = abfd;
-
- return TRUE;
-}
-
-bfd_boolean
-bfd_arm_process_before_allocation (abfd, info, support_old_code)
- bfd * abfd;
- struct bfd_link_info * info;
- int support_old_code;
-{
- asection * sec;
- struct coff_arm_link_hash_table * globals;
-
- /* If we are only performing a partial link do not bother
- to construct any glue. */
- if (info->relocatable)
- return TRUE;
-
- /* Here we have a bfd that is to be included on the link. We have a hook
- to do reloc rummaging, before section sizes are nailed down. */
-
- _bfd_coff_get_external_symbols (abfd);
-
- globals = coff_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- globals->support_old_code = support_old_code;
-
- /* Rummage around all the relocs and map the glue vectors. */
- sec = abfd->sections;
-
- if (sec == NULL)
- return TRUE;
-
- for (; sec != NULL; sec = sec->next)
- {
- struct internal_reloc * i;
- struct internal_reloc * rel;
-
- if (sec->reloc_count == 0)
- continue;
-
- /* Load the relocs. */
- /* FIXME: there may be a storage leak here. */
-
- i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0);
-
- BFD_ASSERT (i != 0);
-
- for (rel = i; rel < i + sec->reloc_count; ++rel)
- {
- unsigned short r_type = rel->r_type;
- long symndx;
- struct coff_link_hash_entry * h;
-
- symndx = rel->r_symndx;
-
- /* If the relocation is not against a symbol it cannot concern us. */
- if (symndx == -1)
- continue;
-
- /* If the index is outside of the range of our table, something has gone wrong. */
- if (symndx >= obj_conv_table_size (abfd))
- {
- _bfd_error_handler (_("%s: illegal symbol index in reloc: %d"),
- bfd_archive_filename (abfd), symndx);
- continue;
- }
-
- h = obj_coff_sym_hashes (abfd)[symndx];
-
- /* If the relocation is against a static symbol it must be within
- the current section and so cannot be a cross ARM/Thumb relocation. */
- if (h == NULL)
- continue;
-
- switch (r_type)
- {
- case ARM_26:
- /* This one is a call from arm code. We need to look up
- the target of the call. If it is a thumb target, we
- insert glue. */
-
- if (h->class == C_THUMBEXTFUNC)
- record_arm_to_thumb_glue (info, h);
- break;
-
-#ifndef ARM_WINCE
- case ARM_THUMB23:
- /* This one is a call from thumb code. We used to look
- for ARM_THUMB9 and ARM_THUMB12 as well. We need to look
- up the target of the call. If it is an arm target, we
- insert glue. If the symbol does not exist it will be
- given a class of C_EXT and so we will generate a stub
- for it. This is not really a problem, since the link
- is doomed anyway. */
-
- switch (h->class)
- {
- case C_EXT:
- case C_STAT:
- case C_LABEL:
- record_thumb_to_arm_glue (info, h);
- break;
- default:
- ;
- }
- break;
-#endif
-
- default:
- break;
- }
- }
- }
-
- return TRUE;
-}
-
-#endif /* ! defined (COFF_IMAGE_WITH_PE) */
-
-#define coff_bfd_reloc_type_lookup coff_arm_reloc_type_lookup
-#define coff_relocate_section coff_arm_relocate_section
-#define coff_bfd_is_local_label_name coff_arm_is_local_label_name
-#define coff_adjust_symndx coff_arm_adjust_symndx
-#define coff_link_output_has_begun coff_arm_link_output_has_begun
-#define coff_final_link_postscript coff_arm_final_link_postscript
-#define coff_bfd_merge_private_bfd_data coff_arm_merge_private_bfd_data
-#define coff_bfd_print_private_bfd_data coff_arm_print_private_bfd_data
-#define coff_bfd_set_private_flags _bfd_coff_arm_set_private_flags
-#define coff_bfd_copy_private_bfd_data coff_arm_copy_private_bfd_data
-#define coff_bfd_link_hash_table_create coff_arm_link_hash_table_create
-
-/* When doing a relocatable link, we want to convert ARM_26 relocs
- into ARM_26D relocs. */
-
-static bfd_boolean
-coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
- bfd *obfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- bfd *ibfd;
- asection *sec;
- struct internal_reloc *irel;
- bfd_boolean *adjustedp;
-{
- if (irel->r_type == ARM_26)
- {
- struct coff_link_hash_entry *h;
-
- h = obj_coff_sym_hashes (ibfd)[irel->r_symndx];
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section->output_section == sec->output_section)
- irel->r_type = ARM_26D;
- }
- *adjustedp = FALSE;
- return TRUE;
-}
-
-/* Called when merging the private data areas of two BFDs.
- This is important as it allows us to detect if we are
- attempting to merge binaries compiled for different ARM
- targets, eg different CPUs or different APCS's. */
-
-static bfd_boolean
-coff_arm_merge_private_bfd_data (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
-{
- BFD_ASSERT (ibfd != NULL && obfd != NULL);
-
- if (ibfd == obfd)
- return TRUE;
-
- /* If the two formats are different we cannot merge anything.
- This is not an error, since it is permissable to change the
- input and output formats. */
- if ( ibfd->xvec->flavour != bfd_target_coff_flavour
- || obfd->xvec->flavour != bfd_target_coff_flavour)
- return TRUE;
-
- /* Determine what should happen if the input ARM architecture
- does not match the output ARM architecture. */
- if (! bfd_arm_merge_machines (ibfd, obfd))
- return FALSE;
-
- /* Verify that the APCS is the same for the two BFDs. */
- if (APCS_SET (ibfd))
- {
- if (APCS_SET (obfd))
- {
- /* If the src and dest have different APCS flag bits set, fail. */
- if (APCS_26_FLAG (obfd) != APCS_26_FLAG (ibfd))
- {
- _bfd_error_handler
- /* xgettext: c-format */
- (_("ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d"),
- bfd_archive_filename (ibfd), APCS_26_FLAG (ibfd) ? 26 : 32,
- bfd_get_filename (obfd), APCS_26_FLAG (obfd) ? 26 : 32
- );
-
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- if (APCS_FLOAT_FLAG (obfd) != APCS_FLOAT_FLAG (ibfd))
- {
- const char *msg;
-
- if (APCS_FLOAT_FLAG (ibfd))
- /* xgettext: c-format */
- msg = _("ERROR: %s passes floats in float registers, whereas %s passes them in integer registers");
- else
- /* xgettext: c-format */
- msg = _("ERROR: %s passes floats in integer registers, whereas %s passes them in float registers");
-
- _bfd_error_handler (msg, bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
-
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- if (PIC_FLAG (obfd) != PIC_FLAG (ibfd))
- {
- const char * msg;
-
- if (PIC_FLAG (ibfd))
- /* xgettext: c-format */
- msg = _("ERROR: %s is compiled as position independent code, whereas target %s is absolute position");
- else
- /* xgettext: c-format */
- msg = _("ERROR: %s is compiled as absolute position code, whereas target %s is position independent");
- _bfd_error_handler (msg, bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
-
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
- }
- else
- {
- SET_APCS_FLAGS (obfd, APCS_26_FLAG (ibfd) | APCS_FLOAT_FLAG (ibfd) | PIC_FLAG (ibfd));
-
- /* Set up the arch and fields as well as these are probably wrong. */
- bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
- }
- }
-
- /* Check the interworking support. */
- if (INTERWORK_SET (ibfd))
- {
- if (INTERWORK_SET (obfd))
- {
- /* If the src and dest differ in their interworking issue a warning. */
- if (INTERWORK_FLAG (obfd) != INTERWORK_FLAG (ibfd))
- {
- const char * msg;
-
- if (INTERWORK_FLAG (ibfd))
- /* xgettext: c-format */
- msg = _("Warning: %s supports interworking, whereas %s does not");
- else
- /* xgettext: c-format */
- msg = _("Warning: %s does not support interworking, whereas %s does");
-
- _bfd_error_handler (msg, bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- }
- }
- else
- {
- SET_INTERWORK_FLAG (obfd, INTERWORK_FLAG (ibfd));
- }
- }
-
- return TRUE;
-}
-
-/* Display the flags field. */
-
-static bfd_boolean
-coff_arm_print_private_bfd_data (abfd, ptr)
- bfd * abfd;
- PTR ptr;
-{
- FILE * file = (FILE *) ptr;
-
- BFD_ASSERT (abfd != NULL && ptr != NULL);
-
- /* xgettext:c-format */
- fprintf (file, _("private flags = %x:"), coff_data (abfd)->flags);
-
- if (APCS_SET (abfd))
- {
- /* xgettext: APCS is ARM Procedure Call Standard, it should not be translated. */
- fprintf (file, " [APCS-%d]", APCS_26_FLAG (abfd) ? 26 : 32);
-
- if (APCS_FLOAT_FLAG (abfd))
- fprintf (file, _(" [floats passed in float registers]"));
- else
- fprintf (file, _(" [floats passed in integer registers]"));
-
- if (PIC_FLAG (abfd))
- fprintf (file, _(" [position independent]"));
- else
- fprintf (file, _(" [absolute position]"));
- }
-
- if (! INTERWORK_SET (abfd))
- fprintf (file, _(" [interworking flag not initialised]"));
- else if (INTERWORK_FLAG (abfd))
- fprintf (file, _(" [interworking supported]"));
- else
- fprintf (file, _(" [interworking not supported]"));
-
- fputc ('\n', file);
-
- return TRUE;
-}
-
-/* Copies the given flags into the coff_tdata.flags field.
- Typically these flags come from the f_flags[] field of
- the COFF filehdr structure, which contains important,
- target specific information.
- Note: Although this function is static, it is explicitly
- called from both coffcode.h and peicode.h. */
-
-static bfd_boolean
-_bfd_coff_arm_set_private_flags (abfd, flags)
- bfd * abfd;
- flagword flags;
-{
- flagword flag;
-
- BFD_ASSERT (abfd != NULL);
-
- flag = (flags & F_APCS26) ? F_APCS_26 : 0;
-
- /* Make sure that the APCS field has not been initialised to the opposite
- value. */
- if (APCS_SET (abfd)
- && ( (APCS_26_FLAG (abfd) != flag)
- || (APCS_FLOAT_FLAG (abfd) != (flags & F_APCS_FLOAT))
- || (PIC_FLAG (abfd) != (flags & F_PIC))
- ))
- return FALSE;
-
- flag |= (flags & (F_APCS_FLOAT | F_PIC));
-
- SET_APCS_FLAGS (abfd, flag);
-
- flag = (flags & F_INTERWORK);
-
- /* If the BFD has already had its interworking flag set, but it
- is different from the value that we have been asked to set,
- then assume that that merged code will not support interworking
- and set the flag accordingly. */
- if (INTERWORK_SET (abfd) && (INTERWORK_FLAG (abfd) != flag))
- {
- if (flag)
- /* xgettext: c-format */
- _bfd_error_handler (_("Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"),
- bfd_archive_filename (abfd));
- else
- /* xgettext: c-format */
- _bfd_error_handler (_("Warning: Clearing the interworking flag of %s due to outside request"),
- bfd_archive_filename (abfd));
- flag = 0;
- }
-
- SET_INTERWORK_FLAG (abfd, flag);
-
- return TRUE;
-}
-
-/* Copy the important parts of the target specific data
- from one instance of a BFD to another. */
-
-static bfd_boolean
-coff_arm_copy_private_bfd_data (src, dest)
- bfd * src;
- bfd * dest;
-{
- BFD_ASSERT (src != NULL && dest != NULL);
-
- if (src == dest)
- return TRUE;
-
- /* If the destination is not in the same format as the source, do not do
- the copy. */
- if (src->xvec != dest->xvec)
- return TRUE;
-
- /* copy the flags field */
- if (APCS_SET (src))
- {
- if (APCS_SET (dest))
- {
- /* If the src and dest have different APCS flag bits set, fail. */
- if (APCS_26_FLAG (dest) != APCS_26_FLAG (src))
- return FALSE;
-
- if (APCS_FLOAT_FLAG (dest) != APCS_FLOAT_FLAG (src))
- return FALSE;
-
- if (PIC_FLAG (dest) != PIC_FLAG (src))
- return FALSE;
- }
- else
- SET_APCS_FLAGS (dest, APCS_26_FLAG (src) | APCS_FLOAT_FLAG (src)
- | PIC_FLAG (src));
- }
-
- if (INTERWORK_SET (src))
- {
- if (INTERWORK_SET (dest))
- {
- /* If the src and dest have different interworking flags then turn
- off the interworking bit. */
- if (INTERWORK_FLAG (dest) != INTERWORK_FLAG (src))
- {
- if (INTERWORK_FLAG (dest))
- {
- /* xgettext:c-format */
- _bfd_error_handler (("\
-Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"),
- bfd_get_filename (dest),
- bfd_archive_filename (src));
- }
-
- SET_INTERWORK_FLAG (dest, 0);
- }
- }
- else
- {
- SET_INTERWORK_FLAG (dest, INTERWORK_FLAG (src));
- }
- }
-
- return TRUE;
-}
-
-/* Note: the definitions here of LOCAL_LABEL_PREFIX and USER_LABEL_PREIFX
- *must* match the definitions in gcc/config/arm/{coff|semi|aout}.h. */
-#define LOCAL_LABEL_PREFIX ""
-#ifndef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-#endif
-
-/* Like _bfd_coff_is_local_label_name, but
- a) test against USER_LABEL_PREFIX, to avoid stripping labels known to be
- non-local.
- b) Allow other prefixes than ".", e.g. an empty prefix would cause all
- labels of the form Lxxx to be stripped. */
-static bfd_boolean
-coff_arm_is_local_label_name (abfd, name)
- bfd * abfd ATTRIBUTE_UNUSED;
- const char * name;
-{
-#ifdef USER_LABEL_PREFIX
- if (USER_LABEL_PREFIX[0] != 0)
- {
- if (strncmp (name, USER_LABEL_PREFIX, strlen (USER_LABEL_PREFIX)) == 0)
- return FALSE;
- }
-#endif
-
-#ifdef LOCAL_LABEL_PREFIX
- /* If there is a prefix for local labels then look for this.
- If the prefix exists, but it is empty, then ignore the test. */
-
- if (LOCAL_LABEL_PREFIX[0] != 0)
- {
- size_t len = strlen (LOCAL_LABEL_PREFIX);
-
- if (strncmp (name, LOCAL_LABEL_PREFIX, len) != 0)
- return FALSE;
-
- /* Perform the checks below for the rest of the name. */
- name += len;
- }
-#endif
-
- return name[0] == 'L';
-}
-
-/* This piece of machinery exists only to guarantee that the bfd that holds
- the glue section is written last.
-
- This does depend on bfd_make_section attaching a new section to the
- end of the section list for the bfd.
-
- krk@cygnus.com */
-
-static bfd_boolean
-coff_arm_link_output_has_begun (sub, info)
- bfd * sub;
- struct coff_final_link_info * info;
-{
- return (sub->output_has_begun
- || sub == coff_arm_hash_table (info->info)->bfd_of_glue_owner);
-}
-
-static bfd_boolean
-coff_arm_final_link_postscript (abfd, pfinfo)
- bfd * abfd ATTRIBUTE_UNUSED;
- struct coff_final_link_info * pfinfo;
-{
- struct coff_arm_link_hash_table * globals;
-
- globals = coff_arm_hash_table (pfinfo->info);
-
- BFD_ASSERT (globals != NULL);
-
- if (globals->bfd_of_glue_owner != NULL)
- {
- if (! _bfd_coff_link_input_bfd (pfinfo, globals->bfd_of_glue_owner))
- return FALSE;
-
- globals->bfd_of_glue_owner->output_has_begun = TRUE;
- }
-
- return bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
-}
-
-#include "coffcode.h"
-
-#ifndef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM armcoff_little_vec
-#endif
-#ifndef TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME "coff-arm-little"
-#endif
-#ifndef TARGET_BIG_SYM
-#define TARGET_BIG_SYM armcoff_big_vec
-#endif
-#ifndef TARGET_BIG_NAME
-#define TARGET_BIG_NAME "coff-arm-big"
-#endif
-
-#ifndef TARGET_UNDERSCORE
-#define TARGET_UNDERSCORE 0
-#endif
-
-#ifndef EXTRA_S_FLAGS
-#ifdef COFF_WITH_PE
-#define EXTRA_S_FLAGS (SEC_CODE | SEC_LINK_ONCE | SEC_LINK_DUPLICATES)
-#else
-#define EXTRA_S_FLAGS SEC_CODE
-#endif
-#endif
-
-/* Forward declaration for use initialising alternative_target field. */
-extern const bfd_target TARGET_BIG_SYM ;
-
-/* Target vectors. */
-CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_BIG_SYM, COFF_SWAP_TABLE)
-CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_LITTLE_SYM, COFF_SWAP_TABLE)
diff --git a/contrib/binutils/bfd/coff-aux.c b/contrib/binutils/bfd/coff-aux.c
deleted file mode 100644
index 4d7cde5..0000000
--- a/contrib/binutils/bfd/coff-aux.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* BFD back-end for Apple M68K COFF A/UX 3.x files.
- Copyright 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
- Written by Richard Henderson <rth@tamu.edu>.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_SYM m68kaux_coff_vec
-#define TARGET_NAME "coff-m68k-aux"
-
-#ifndef TARG_AUX
-#define TARG_AUX
-#endif
-
-#define COFF_LONG_FILENAMES
-
-/* 4k pages */
-#define COFF_PAGE_SIZE 0x1000
-
-/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
-#define BSS_NOLOAD_IS_SHARED_LIBRARY
-
-#define STATIC_RELOCS
-
-#define COFF_COMMON_ADDEND
-
-#include "bfd.h"
-#include "sysdep.h"
-
-static bfd_boolean coff_m68k_aux_link_add_one_symbol
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
-
-#define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
-
-#include "coff/aux-coff.h" /* override coff/internal.h and coff/m68k.h */
-#include "coff-m68k.c"
-
-/* We need non-absolute symbols to override absolute symbols. This
- mirrors Apple's "solution" to let a static library symbol override
- a shared library symbol. On the whole not a good thing, given how
- shared libraries work here, but can work if you are careful with
- what you include in the shared object. */
-
-static bfd_boolean
-coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
- string, copy, collect, hashp)
- struct bfd_link_info *info;
- bfd *abfd;
- const char *name;
- flagword flags;
- asection *section;
- bfd_vma value;
- const char *string;
- bfd_boolean copy;
- bfd_boolean collect;
- struct bfd_link_hash_entry **hashp;
-{
- struct bfd_link_hash_entry *h;
-
- if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 &&
- !bfd_is_und_section (section) &&
- !bfd_is_com_section (section))
- {
- /* The new symbol is a definition or an indirect definition */
-
- /* This bit copied from linker.c */
- if (hashp != NULL && *hashp != NULL)
- {
- h = *hashp;
- BFD_ASSERT (strcmp (h->root.string, name) == 0);
- }
- else
- {
- h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
- if (h == NULL)
- {
- if (hashp != NULL)
- *hashp = NULL;
- return FALSE;
- }
- }
-
- if (info->notice_hash != (struct bfd_hash_table *) NULL
- && (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE)
- != (struct bfd_hash_entry *) NULL))
- {
- if (! (*info->callbacks->notice) (info, name, abfd, section, value))
- return FALSE;
- }
-
- if (hashp != (struct bfd_link_hash_entry **) NULL)
- *hashp = h;
- /* end duplication from linker.c */
-
- if (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_indirect)
- {
- asection *msec;
-
- if (h->type == bfd_link_hash_defined)
- msec = h->u.def.section;
- else
- msec = bfd_ind_section_ptr;
-
- if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section))
- {
- h->u.def.section = section;
- h->u.def.value = value;
- return TRUE;
- }
- else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec))
- return TRUE;
- }
- }
-
- /* If we didn't exit early, finish processing in the generic routine */
- return _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
- value, string, copy, collect,
- hashp);
-}
diff --git a/contrib/binutils/bfd/coff-i386.c b/contrib/binutils/bfd/coff-i386.c
deleted file mode 100644
index a24344a..0000000
--- a/contrib/binutils/bfd/coff-i386.c
+++ /dev/null
@@ -1,624 +0,0 @@
-/* BFD back-end for Intel 386 COFF files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#include "coff/i386.h"
-
-#include "coff/internal.h"
-
-#ifdef COFF_WITH_PE
-#include "coff/pe.h"
-#endif
-
-#ifdef COFF_GO32_EXE
-#include "coff/go32exe.h"
-#endif
-
-#include "libcoff.h"
-
-static bfd_reloc_status_type coff_i386_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static reloc_howto_type *coff_i386_rtype_to_howto
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-static reloc_howto_type *coff_i386_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
-/* The page size is a guess based on ELF. */
-
-#define COFF_PAGE_SIZE 0x1000
-
-/* For some reason when using i386 COFF the value stored in the .text
- section for a reference to a common symbol is the value itself plus
- any desired offset. Ian Taylor, Cygnus Support. */
-
-/* If we are producing relocatable output, we need to do some
- adjustments to the object file that are not done by the
- bfd_perform_relocation function. This function is called by every
- reloc type to make any required adjustments. */
-
-static bfd_reloc_status_type
-coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- symvalue diff;
-
-#ifndef COFF_WITH_PE
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-#endif
-
- if (bfd_is_com_section (symbol->section))
- {
-#ifndef COFF_WITH_PE
- /* We are relocating a common symbol. The current value in the
- object file is ORIG + OFFSET, where ORIG is the value of the
- common symbol as seen by the object file when it was compiled
- (this may be zero if the symbol was undefined) and OFFSET is
- the offset into the common symbol (normally zero, but may be
- non-zero when referring to a field in a common structure).
- ORIG is the negative of reloc_entry->addend, which is set by
- the CALC_ADDEND macro below. We want to replace the value in
- the object file with NEW + OFFSET, where NEW is the value of
- the common symbol which we are going to put in the final
- object file. NEW is symbol->value. */
- diff = symbol->value + reloc_entry->addend;
-#else
- /* In PE mode, we do not offset the common symbol. */
- diff = reloc_entry->addend;
-#endif
- }
- else
- {
- /* For some reason bfd_perform_relocation always effectively
- ignores the addend for a COFF target when producing
- relocatable output. This seems to be always wrong for 386
- COFF, so we handle the addend here instead. */
-#ifdef COFF_WITH_PE
- if (output_bfd == (bfd *) NULL)
- {
- reloc_howto_type *howto = reloc_entry->howto;
-
- /* Although PC relative relocations are very similar between
- PE and non-PE formats, but they are off by 1 << howto->size
- bytes. For the external relocation, PE is very different
- from others. See md_apply_fix3 () in gas/config/tc-i386.c.
- When we link PE and non-PE object files together to
- generate a non-PE executable, we have to compensate it
- here. */
- if (howto->pc_relative && howto->pcrel_offset)
- diff = -(1 << howto->size);
- else
- diff = -reloc_entry->addend;
- }
- else
-#endif
- diff = reloc_entry->addend;
- }
-
-#ifdef COFF_WITH_PE
- /* FIXME: How should this case be handled? */
- if (reloc_entry->howto->type == R_IMAGEBASE
- && output_bfd != NULL
- && bfd_get_flavour(output_bfd) == bfd_target_coff_flavour)
- diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
-#endif
-
-#define DOIT(x) \
- x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
-
- if (diff != 0)
- {
- reloc_howto_type *howto = reloc_entry->howto;
- unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-
- switch (howto->size)
- {
- case 0:
- {
- char x = bfd_get_8 (abfd, addr);
- DOIT (x);
- bfd_put_8 (abfd, x, addr);
- }
- break;
-
- case 1:
- {
- short x = bfd_get_16 (abfd, addr);
- DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- case 2:
- {
- long x = bfd_get_32 (abfd, addr);
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- default:
- abort ();
- }
- }
-
- /* Now let bfd_perform_relocation finish everything up. */
- return bfd_reloc_continue;
-}
-
-#ifdef COFF_WITH_PE
-/* Return TRUE if this relocation should appear in the output .reloc
- section. */
-
-static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
-
-static bfd_boolean in_reloc_p (abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type *howto;
-{
- return ! howto->pc_relative && howto->type != R_IMAGEBASE;
-}
-#endif /* COFF_WITH_PE */
-
-#ifndef PCRELOFFSET
-#define PCRELOFFSET FALSE
-#endif
-
-static reloc_howto_type howto_table[] =
-{
- EMPTY_HOWTO (0),
- EMPTY_HOWTO (1),
- EMPTY_HOWTO (2),
- EMPTY_HOWTO (3),
- EMPTY_HOWTO (4),
- EMPTY_HOWTO (5),
- HOWTO (R_DIR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "dir32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
- /* PE IMAGE_REL_I386_DIR32NB relocation (7). */
- HOWTO (R_IMAGEBASE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "rva32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
- EMPTY_HOWTO (010),
- EMPTY_HOWTO (011),
- EMPTY_HOWTO (012),
- EMPTY_HOWTO (013),
- EMPTY_HOWTO (014),
- EMPTY_HOWTO (015),
- EMPTY_HOWTO (016),
- /* Byte relocation (017). */
- HOWTO (R_RELBYTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "8", /* name */
- TRUE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- PCRELOFFSET), /* pcrel_offset */
- /* 16-bit word relocation (020). */
- HOWTO (R_RELWORD, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- PCRELOFFSET), /* pcrel_offset */
- /* 32-bit longword relocation (021). */
- HOWTO (R_RELLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- PCRELOFFSET), /* pcrel_offset */
- /* Byte PC relative relocation (022). */
- HOWTO (R_PCRBYTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "DISP8", /* name */
- TRUE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- PCRELOFFSET), /* pcrel_offset */
- /* 16-bit word PC relative relocation (023). */
- HOWTO (R_PCRWORD, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "DISP16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- PCRELOFFSET), /* pcrel_offset */
- /* 32-bit longword PC relative relocation (024). */
- HOWTO (R_PCRLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "DISP32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- PCRELOFFSET) /* pcrel_offset */
-};
-
-/* Turn a howto into a reloc nunmber */
-
-#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
-#define BADMAG(x) I386BADMAG(x)
-#define I386 1 /* Customize coffcode.h */
-
-#define RTYPE2HOWTO(cache_ptr, dst) \
- ((cache_ptr)->howto = \
- ((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0]) \
- ? howto_table + (dst)->r_type \
- : NULL))
-
-/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
- library. On some other COFF targets STYP_BSS is normally
- STYP_NOLOAD. */
-#define BSS_NOLOAD_IS_SHARED_LIBRARY
-
-/* Compute the addend of a reloc. If the reloc is to a common symbol,
- the object file contains the value of the common symbol. By the
- time this is called, the linker may be using a different symbol
- from a different object file with a different value. Therefore, we
- hack wildly to locate the original symbol from this file so that we
- can make the correct adjustment. This macro sets coffsym to the
- symbol from the original file, and uses it to set the addend value
- correctly. If this is not a common symbol, the usual addend
- calculation is done, except that an additional tweak is needed for
- PC relative relocs.
- FIXME: This macro refers to symbols and asect; these are from the
- calling function, not the macro arguments. */
-
-#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
- { \
- coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
- if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
- coffsym = (obj_symbols (abfd) \
- + (cache_ptr->sym_ptr_ptr - symbols)); \
- else if (ptr) \
- coffsym = coff_symbol_from (abfd, ptr); \
- if (coffsym != (coff_symbol_type *) NULL \
- && coffsym->native->u.syment.n_scnum == 0) \
- cache_ptr->addend = - coffsym->native->u.syment.n_value; \
- else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
- && ptr->section != (asection *) NULL) \
- cache_ptr->addend = - (ptr->section->vma + ptr->value); \
- else \
- cache_ptr->addend = 0; \
- if (ptr && howto_table[reloc.r_type].pc_relative) \
- cache_ptr->addend += asect->vma; \
- }
-
-/* We use the special COFF backend linker. For normal i386 COFF, we
- can use the generic relocate_section routine. For PE, we need our
- own routine. */
-
-#ifndef COFF_WITH_PE
-
-#define coff_relocate_section _bfd_coff_generic_relocate_section
-
-#else /* COFF_WITH_PE */
-
-/* The PE relocate section routine. The only difference between this
- and the regular routine is that we don't want to do anything for a
- relocatable link. */
-
-static bfd_boolean coff_pe_i386_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-static bfd_boolean
-coff_pe_i386_relocate_section (output_bfd, info, input_bfd,
- input_section, contents, relocs, syms,
- sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
-{
- if (info->relocatable)
- return TRUE;
-
- return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
- input_section, contents,
- relocs, syms, sections);
-}
-
-#define coff_relocate_section coff_pe_i386_relocate_section
-
-#endif /* COFF_WITH_PE */
-
-/* Convert an rtype to howto for the COFF backend linker. */
-
-static reloc_howto_type *
-coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma *addendp;
-{
- reloc_howto_type *howto;
-
- if (rel->r_type > sizeof (howto_table) / sizeof (howto_table[0]))
- {
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-
- howto = howto_table + rel->r_type;
-
-#ifdef COFF_WITH_PE
- /* Cancel out code in _bfd_coff_generic_relocate_section. */
- *addendp = 0;
-#endif
-
- if (howto->pc_relative)
- *addendp += sec->vma;
-
- if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
- {
- /* This is a common symbol. The section contents include the
- size (sym->n_value) as an addend. The relocate_section
- function will be adding in the final value of the symbol. We
- need to subtract out the current size in order to get the
- correct result. */
-
- BFD_ASSERT (h != NULL);
-
-#ifndef COFF_WITH_PE
- /* I think we *do* want to bypass this. If we don't, I have
- seen some data parameters get the wrong relocation address.
- If I link two versions with and without this section bypassed
- and then do a binary comparison, the addresses which are
- different can be looked up in the map. The case in which
- this section has been bypassed has addresses which correspond
- to values I can find in the map. */
- *addendp -= sym->n_value;
-#endif
- }
-
-#ifndef COFF_WITH_PE
- /* If the output symbol is common (in which case this must be a
- relocatable link), we need to add in the final size of the
- common symbol. */
- if (h != NULL && h->root.type == bfd_link_hash_common)
- *addendp += h->root.u.c.size;
-#endif
-
-#ifdef COFF_WITH_PE
- if (howto->pc_relative)
- {
- *addendp -= 4;
-
- /* If the symbol is defined, then the generic code is going to
- add back the symbol value in order to cancel out an
- adjustment it made to the addend. However, we set the addend
- to 0 at the start of this function. We need to adjust here,
- to avoid the adjustment the generic code will make. FIXME:
- This is getting a bit hackish. */
- if (sym != NULL && sym->n_scnum != 0)
- *addendp -= sym->n_value;
- }
-
- if (rel->r_type == R_IMAGEBASE
- && (bfd_get_flavour(sec->output_section->owner)
- == bfd_target_coff_flavour))
- {
- *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
- }
-#endif
-
- return howto;
-}
-
-#define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
-
-static reloc_howto_type *
-coff_i386_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- case BFD_RELOC_RVA:
- return howto_table + R_IMAGEBASE;
- case BFD_RELOC_32:
- return howto_table + R_DIR32;
- case BFD_RELOC_32_PCREL:
- return howto_table + R_PCRLONG;
- case BFD_RELOC_16:
- return howto_table + R_RELWORD;
- case BFD_RELOC_16_PCREL:
- return howto_table + R_PCRWORD;
- case BFD_RELOC_8:
- return howto_table + R_RELBYTE;
- case BFD_RELOC_8_PCREL:
- return howto_table + R_PCRBYTE;
- default:
- BFD_FAIL ();
- return 0;
- }
-}
-
-#define coff_rtype_to_howto coff_i386_rtype_to_howto
-
-#ifdef TARGET_UNDERSCORE
-
-/* If i386 gcc uses underscores for symbol names, then it does not use
- a leading dot for local labels, so if TARGET_UNDERSCORE is defined
- we treat all symbols starting with L as local. */
-
-static bfd_boolean coff_i386_is_local_label_name
- PARAMS ((bfd *, const char *));
-
-static bfd_boolean
-coff_i386_is_local_label_name (abfd, name)
- bfd *abfd;
- const char *name;
-{
- if (name[0] == 'L')
- return TRUE;
-
- return _bfd_coff_is_local_label_name (abfd, name);
-}
-
-#define coff_bfd_is_local_label_name coff_i386_is_local_label_name
-
-#endif /* TARGET_UNDERSCORE */
-
-#include "coffcode.h"
-
-const bfd_target
-#ifdef TARGET_SYM
- TARGET_SYM =
-#else
- i386coff_vec =
-#endif
-{
-#ifdef TARGET_NAME
- TARGET_NAME,
-#else
- "coff-i386", /* name */
-#endif
- bfd_target_coff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-#ifdef COFF_WITH_PE
- | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY
-#endif
- | SEC_CODE | SEC_DATA),
-
-#ifdef TARGET_UNDERSCORE
- TARGET_UNDERSCORE, /* leading underscore */
-#else
- 0, /* leading underscore */
-#endif
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
-
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- bfd_generic_archive_p, coff_object_p},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
- bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (coff),
- BFD_JUMP_TABLE_COPY (coff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
- BFD_JUMP_TABLE_SYMBOLS (coff),
- BFD_JUMP_TABLE_RELOCS (coff),
- BFD_JUMP_TABLE_WRITE (coff),
- BFD_JUMP_TABLE_LINK (coff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- COFF_SWAP_TABLE
-};
diff --git a/contrib/binutils/bfd/coff-ia64.c b/contrib/binutils/bfd/coff-ia64.c
deleted file mode 100644
index 2b5b557..0000000
--- a/contrib/binutils/bfd/coff-ia64.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* BFD back-end for HP/Intel IA-64 COFF files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- Contributed by David Mosberger <davidm@hpl.hp.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "coff/ia64.h"
-#include "coff/internal.h"
-#include "coff/pe.h"
-#include "libcoff.h"
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
-/* The page size is a guess based on ELF. */
-
-#define COFF_PAGE_SIZE 0x1000
-
-static reloc_howto_type howto_table[] =
-{
- EMPTY_HOWTO (0),
-};
-
-#define BADMAG(x) IA64BADMAG(x)
-#define IA64 1 /* Customize coffcode.h */
-
-#ifdef COFF_WITH_pep
-# undef AOUTSZ
-# define AOUTSZ PEPAOUTSZ
-# define PEAOUTHDR PEPAOUTHDR
-#endif
-
-#define RTYPE2HOWTO(cache_ptr, dst) \
- (cache_ptr)->howto = howto_table + (dst)->r_type;
-
-#ifdef COFF_WITH_PE
-/* Return TRUE if this relocation should
- appear in the output .reloc section. */
-
-static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
-
-static bfd_boolean
-in_reloc_p(abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type *howto ATTRIBUTE_UNUSED;
-{
- return FALSE; /* We don't do relocs for now... */
-}
-#endif
-
-#include "coffcode.h"
-
-static const bfd_target *ia64coff_object_p PARAMS ((bfd *));
-
-static const bfd_target *
-ia64coff_object_p (abfd)
- bfd *abfd;
-{
-#ifdef COFF_IMAGE_WITH_PE
- {
- struct external_PEI_DOS_hdr dos_hdr;
- struct external_PEI_IMAGE_hdr image_hdr;
- file_ptr offset;
-
- 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);
- return NULL;
- }
-
- /* There are really two magic numbers involved; the magic number
- that says this is a NT executable (PEI) and the magic number
- that determines the architecture. The former is DOSMAGIC,
- stored in the e_magic field. The latter is stored in the
- f_magic field. If the NT magic number isn't valid, the
- architecture magic number could be mimicked by some other
- field (specifically, the number of relocs in section 3). Since
- 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 (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- 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 (H_GET_32 (abfd, image_hdr.nt_signature)
- != 0x4550)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* 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, offset - sizeof (dos_hdr), SEEK_SET) != 0)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- }
-#endif
-
- return coff_object_p (abfd);
-}
-
-const bfd_target
-#ifdef TARGET_SYM
- TARGET_SYM =
-#else
- ia64coff_vec =
-#endif
-{
-#ifdef TARGET_NAME
- TARGET_NAME,
-#else
- "coff-ia64", /* name */
-#endif
- bfd_target_coff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-#ifndef COFF_WITH_PE
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
- | SEC_CODE | SEC_DATA),
-#else
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
- | SEC_CODE | SEC_DATA
- | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-#endif
-
-#ifdef TARGET_UNDERSCORE
- TARGET_UNDERSCORE, /* leading underscore */
-#else
- 0, /* leading underscore */
-#endif
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
-
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
- {_bfd_dummy_target, ia64coff_object_p, /* bfd_check_format */
- bfd_generic_archive_p, ia64coff_object_p},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
- bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (coff),
- BFD_JUMP_TABLE_COPY (coff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
- BFD_JUMP_TABLE_SYMBOLS (coff),
- BFD_JUMP_TABLE_RELOCS (coff),
- BFD_JUMP_TABLE_WRITE (coff),
- BFD_JUMP_TABLE_LINK (coff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- COFF_SWAP_TABLE
-};
diff --git a/contrib/binutils/bfd/coff-mips.c b/contrib/binutils/bfd/coff-mips.c
deleted file mode 100644
index d6d8218..0000000
--- a/contrib/binutils/bfd/coff-mips.c
+++ /dev/null
@@ -1,2701 +0,0 @@
-/* BFD back-end for MIPS Extended-Coff files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Original version by Per Bothner.
- Full support added by Ian Lance Taylor, ian@cygnus.com.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/ecoff.h"
-#include "coff/mips.h"
-#include "libcoff.h"
-#include "libecoff.h"
-
-/* Prototypes for static functions. */
-
-static bfd_boolean mips_ecoff_bad_format_hook
- PARAMS ((bfd *abfd, PTR filehdr));
-static void mips_ecoff_swap_reloc_in
- PARAMS ((bfd *, PTR, struct internal_reloc *));
-static void mips_ecoff_swap_reloc_out
- PARAMS ((bfd *, const struct internal_reloc *, PTR));
-static void mips_adjust_reloc_in
- PARAMS ((bfd *, const struct internal_reloc *, arelent *));
-static void mips_adjust_reloc_out
- PARAMS ((bfd *, const arelent *, struct internal_reloc *));
-static bfd_reloc_status_type mips_generic_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
- asection *section, bfd *output_bfd, char **error));
-static bfd_reloc_status_type mips_refhi_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
- asection *section, bfd *output_bfd, char **error));
-static bfd_reloc_status_type mips_reflo_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
- asection *section, bfd *output_bfd, char **error));
-static bfd_reloc_status_type mips_gprel_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
- asection *section, bfd *output_bfd, char **error));
-static bfd_reloc_status_type mips_relhi_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
- asection *section, bfd *output_bfd, char **error));
-static bfd_reloc_status_type mips_rello_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
- asection *section, bfd *output_bfd, char **error));
-static bfd_reloc_status_type mips_switch_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
- asection *section, bfd *output_bfd, char **error));
-static void mips_relocate_hi
- PARAMS ((struct internal_reloc *refhi, struct internal_reloc *reflo,
- bfd *input_bfd, asection *input_section, bfd_byte *contents,
- size_t adjust, bfd_vma relocation, bfd_boolean pcrel));
-static bfd_boolean mips_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, PTR));
-static bfd_boolean mips_read_relocs
- PARAMS ((bfd *, asection *));
-static bfd_boolean mips_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
-static bfd_boolean mips_relax_pcrel16
- PARAMS ((struct bfd_link_info *, bfd *, asection *,
- struct ecoff_link_hash_entry *, bfd_byte *, bfd_vma));
-static reloc_howto_type *mips_bfd_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-/* ECOFF has COFF sections, but the debugging information is stored in
- a completely different format. ECOFF targets use some of the
- swapping routines from coffswap.h, and some of the generic COFF
- routines in coffgen.c, but, unlike the real COFF targets, do not
- use coffcode.h itself.
-
- Get the generic COFF swapping routines, except for the reloc,
- symbol, and lineno ones. Give them ECOFF names. */
-#define MIPSECOFF
-#define NO_COFF_RELOCS
-#define NO_COFF_SYMBOLS
-#define NO_COFF_LINENOS
-#define coff_swap_filehdr_in mips_ecoff_swap_filehdr_in
-#define coff_swap_filehdr_out mips_ecoff_swap_filehdr_out
-#define coff_swap_aouthdr_in mips_ecoff_swap_aouthdr_in
-#define coff_swap_aouthdr_out mips_ecoff_swap_aouthdr_out
-#define coff_swap_scnhdr_in mips_ecoff_swap_scnhdr_in
-#define coff_swap_scnhdr_out mips_ecoff_swap_scnhdr_out
-#include "coffswap.h"
-
-/* Get the ECOFF swapping routines. */
-#define ECOFF_32
-#include "ecoffswap.h"
-
-/* How to process the various relocs types. */
-
-static reloc_howto_type mips_howto_table[] =
-{
- /* Reloc type 0 is ignored. The reloc reading code ensures that
- this is a reference to the .abs section, which will cause
- bfd_perform_relocation to do nothing. */
- HOWTO (MIPS_R_IGNORE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "IGNORE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit reference to a symbol, normally from a data section. */
- HOWTO (MIPS_R_REFHALF, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_generic_reloc, /* special_function */
- "REFHALF", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 32 bit reference to a symbol, normally from a data section. */
- HOWTO (MIPS_R_REFWORD, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_generic_reloc, /* special_function */
- "REFWORD", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 26 bit absolute jump address. */
- HOWTO (MIPS_R_JMPADDR, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC. */
- mips_generic_reloc, /* special_function */
- "JMPADDR", /* name */
- TRUE, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high 16 bits of a symbol value. Handled by the function
- mips_refhi_reloc. */
- HOWTO (MIPS_R_REFHI, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_refhi_reloc, /* special_function */
- "REFHI", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The low 16 bits of a symbol value. */
- HOWTO (MIPS_R_REFLO, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_reflo_reloc, /* special_function */
- "REFLO", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A reference to an offset from the gp register. Handled by the
- function mips_gprel_reloc. */
- HOWTO (MIPS_R_GPREL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_gprel_reloc, /* special_function */
- "GPREL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A reference to a literal using an offset from the gp register.
- Handled by the function mips_gprel_reloc. */
- HOWTO (MIPS_R_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_gprel_reloc, /* special_function */
- "LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (8),
- EMPTY_HOWTO (9),
- EMPTY_HOWTO (10),
- EMPTY_HOWTO (11),
-
- /* This reloc is a Cygnus extension used when generating position
- independent code for embedded systems. It represents a 16 bit PC
- relative reloc rightshifted twice as used in the MIPS branch
- instructions. */
- HOWTO (MIPS_R_PCREL16, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_generic_reloc, /* special_function */
- "PCREL16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* This reloc is a Cygnus extension used when generating position
- independent code for embedded systems. It represents the high 16
- bits of a PC relative reloc. The next reloc must be
- MIPS_R_RELLO, and the addend is formed from the addends of the
- two instructions, just as in MIPS_R_REFHI and MIPS_R_REFLO. The
- final value is actually PC relative to the location of the
- MIPS_R_RELLO reloc, not the MIPS_R_RELHI reloc. */
- HOWTO (MIPS_R_RELHI, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_relhi_reloc, /* special_function */
- "RELHI", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* This reloc is a Cygnus extension used when generating position
- independent code for embedded systems. It represents the low 16
- bits of a PC relative reloc. */
- HOWTO (MIPS_R_RELLO, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_rello_reloc, /* special_function */
- "RELLO", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- EMPTY_HOWTO (15),
- EMPTY_HOWTO (16),
- EMPTY_HOWTO (17),
- EMPTY_HOWTO (18),
- EMPTY_HOWTO (19),
- EMPTY_HOWTO (20),
- EMPTY_HOWTO (21),
-
- /* This reloc is a Cygnus extension used when generating position
- independent code for embedded systems. It represents an entry in
- a switch table, which is the difference between two symbols in
- the .text section. The symndx is actually the offset from the
- reloc address to the subtrahend. See include/coff/mips.h for
- more details. */
- HOWTO (MIPS_R_SWITCH, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_switch_reloc, /* special_function */
- "SWITCH", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE) /* pcrel_offset */
-};
-
-#define MIPS_HOWTO_COUNT \
- (sizeof mips_howto_table / sizeof mips_howto_table[0])
-
-/* When the linker is doing relaxing, it may change an external PCREL16
- reloc. This typically represents an instruction like
- bal foo
- We change it to
- .set noreorder
- bal $L1
- lui $at,%hi(foo - $L1)
- $L1:
- addiu $at,%lo(foo - $L1)
- addu $at,$at,$31
- jalr $at
- PCREL16_EXPANSION_ADJUSTMENT is the number of bytes this changes the
- instruction by. */
-
-#define PCREL16_EXPANSION_ADJUSTMENT (4 * 4)
-
-/* See whether the magic number matches. */
-
-static bfd_boolean
-mips_ecoff_bad_format_hook (abfd, filehdr)
- bfd *abfd;
- PTR filehdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- switch (internal_f->f_magic)
- {
- case MIPS_MAGIC_1:
- /* I don't know what endianness this implies. */
- return TRUE;
-
- case MIPS_MAGIC_BIG:
- case MIPS_MAGIC_BIG2:
- case MIPS_MAGIC_BIG3:
- return bfd_big_endian (abfd);
-
- case MIPS_MAGIC_LITTLE:
- case MIPS_MAGIC_LITTLE2:
- case MIPS_MAGIC_LITTLE3:
- return bfd_little_endian (abfd);
-
- default:
- return FALSE;
- }
-}
-
-/* Reloc handling. MIPS ECOFF relocs are packed into 8 bytes in
- external form. They use a bit which indicates whether the symbol
- is external. */
-
-/* Swap a reloc in. */
-
-static void
-mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
- bfd *abfd;
- PTR ext_ptr;
- struct internal_reloc *intern;
-{
- const RELOC *ext = (RELOC *) ext_ptr;
-
- intern->r_vaddr = H_GET_32 (abfd, ext->r_vaddr);
- if (bfd_header_big_endian (abfd))
- {
- intern->r_symndx = (((int) ext->r_bits[0]
- << RELOC_BITS0_SYMNDX_SH_LEFT_BIG)
- | ((int) ext->r_bits[1]
- << RELOC_BITS1_SYMNDX_SH_LEFT_BIG)
- | ((int) ext->r_bits[2]
- << RELOC_BITS2_SYMNDX_SH_LEFT_BIG));
- intern->r_type = ((ext->r_bits[3] & RELOC_BITS3_TYPE_BIG)
- >> RELOC_BITS3_TYPE_SH_BIG);
- intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_BIG) != 0;
- }
- else
- {
- intern->r_symndx = (((int) ext->r_bits[0]
- << RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE)
- | ((int) ext->r_bits[1]
- << RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE)
- | ((int) ext->r_bits[2]
- << RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE));
- intern->r_type = (((ext->r_bits[3] & RELOC_BITS3_TYPE_LITTLE)
- >> RELOC_BITS3_TYPE_SH_LITTLE)
- | ((ext->r_bits[3] & RELOC_BITS3_TYPEHI_LITTLE)
- << RELOC_BITS3_TYPEHI_SH_LITTLE));
- intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_LITTLE) != 0;
- }
-
- /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or
- MIPS_R_RELLO reloc, r_symndx is actually the offset from the
- reloc address to the base of the difference (see
- include/coff/mips.h for more details). We copy symndx into the
- r_offset field so as not to confuse ecoff_slurp_reloc_table in
- ecoff.c. In adjust_reloc_in we then copy r_offset into the reloc
- addend. */
- if (intern->r_type == MIPS_R_SWITCH
- || (! intern->r_extern
- && (intern->r_type == MIPS_R_RELLO
- || intern->r_type == MIPS_R_RELHI)))
- {
- BFD_ASSERT (! intern->r_extern);
- intern->r_offset = intern->r_symndx;
- if (intern->r_offset & 0x800000)
- intern->r_offset -= 0x1000000;
- intern->r_symndx = RELOC_SECTION_TEXT;
- }
-}
-
-/* Swap a reloc out. */
-
-static void
-mips_ecoff_swap_reloc_out (abfd, intern, dst)
- bfd *abfd;
- const struct internal_reloc *intern;
- PTR dst;
-{
- RELOC *ext = (RELOC *) dst;
- long r_symndx;
-
- BFD_ASSERT (intern->r_extern
- || (intern->r_symndx >= 0 && intern->r_symndx <= 12));
-
- /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELLO or
- MIPS_R_RELHI reloc, we actually want to write the contents of
- r_offset out as the symbol index. This undoes the change made by
- mips_ecoff_swap_reloc_in. */
- if (intern->r_type != MIPS_R_SWITCH
- && (intern->r_extern
- || (intern->r_type != MIPS_R_RELHI
- && intern->r_type != MIPS_R_RELLO)))
- r_symndx = intern->r_symndx;
- else
- {
- BFD_ASSERT (intern->r_symndx == RELOC_SECTION_TEXT);
- r_symndx = intern->r_offset & 0xffffff;
- }
-
- 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;
- ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_BIG;
- ext->r_bits[2] = r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_BIG;
- ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_BIG)
- & RELOC_BITS3_TYPE_BIG)
- | (intern->r_extern ? RELOC_BITS3_EXTERN_BIG : 0));
- }
- else
- {
- ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE;
- ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE;
- ext->r_bits[2] = r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE;
- ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_LITTLE)
- & RELOC_BITS3_TYPE_LITTLE)
- | ((intern->r_type >> RELOC_BITS3_TYPEHI_SH_LITTLE
- & RELOC_BITS3_TYPEHI_LITTLE))
- | (intern->r_extern ? RELOC_BITS3_EXTERN_LITTLE : 0));
- }
-}
-
-/* Finish canonicalizing a reloc. Part of this is generic to all
- ECOFF targets, and that part is in ecoff.c. The rest is done in
- this backend routine. It must fill in the howto field. */
-
-static void
-mips_adjust_reloc_in (abfd, intern, rptr)
- bfd *abfd;
- const struct internal_reloc *intern;
- arelent *rptr;
-{
- if (intern->r_type > MIPS_R_SWITCH)
- abort ();
-
- if (! intern->r_extern
- && (intern->r_type == MIPS_R_GPREL
- || intern->r_type == MIPS_R_LITERAL))
- rptr->addend += ecoff_data (abfd)->gp;
-
- /* If the type is MIPS_R_IGNORE, make sure this is a reference to
- the absolute section so that the reloc is ignored. */
- if (intern->r_type == MIPS_R_IGNORE)
- rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
-
- /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or
- MIPS_R_RELLO reloc, we want the addend field of the BFD relocto
- hold the value which was originally in the symndx field of the
- internal MIPS ECOFF reloc. This value was copied into
- intern->r_offset by mips_swap_reloc_in, and here we copy it into
- the addend field. */
- if (intern->r_type == MIPS_R_SWITCH
- || (! intern->r_extern
- && (intern->r_type == MIPS_R_RELHI
- || intern->r_type == MIPS_R_RELLO)))
- rptr->addend = intern->r_offset;
-
- rptr->howto = &mips_howto_table[intern->r_type];
-}
-
-/* Make any adjustments needed to a reloc before writing it out. None
- are needed for MIPS. */
-
-static void
-mips_adjust_reloc_out (abfd, rel, intern)
- bfd *abfd ATTRIBUTE_UNUSED;
- const arelent *rel;
- struct internal_reloc *intern;
-{
- /* For a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or
- MIPS_R_RELLO reloc, we must copy rel->addend into
- intern->r_offset. This will then be written out as the symbol
- index by mips_ecoff_swap_reloc_out. This operation parallels the
- action of mips_adjust_reloc_in. */
- if (intern->r_type == MIPS_R_SWITCH
- || (! intern->r_extern
- && (intern->r_type == MIPS_R_RELHI
- || intern->r_type == MIPS_R_RELLO)))
- intern->r_offset = rel->addend;
-}
-
-/* ECOFF relocs are either against external symbols, or against
- sections. If we are producing relocatable output, and the reloc
- is against an external symbol, and nothing has given us any
- additional addend, the resulting reloc will also be against the
- same symbol. In such a case, we don't want to change anything
- about the way the reloc is handled, since it will all be done at
- final link time. Rather than put special case code into
- bfd_perform_relocation, all the reloc types use this howto
- function. It just short circuits the reloc if producing
- relocatable output against an external symbol. */
-
-static bfd_reloc_status_type
-mips_generic_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && reloc_entry->addend == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- return bfd_reloc_continue;
-}
-
-/* Do a REFHI relocation. This has to be done in combination with a
- REFLO reloc, because there is a carry from the REFLO to the REFHI.
- Here we just save the information we need; we do the actual
- relocation when we see the REFLO. MIPS ECOFF requires that the
- REFLO immediately follow the REFHI. As a GNU extension, we permit
- an arbitrary number of HI relocs to be associated with a single LO
- reloc. This extension permits gcc to output the HI and LO relocs
- itself. */
-
-struct mips_hi
-{
- struct mips_hi *next;
- bfd_byte *addr;
- bfd_vma addend;
-};
-
-/* FIXME: This should not be a static variable. */
-
-static struct mips_hi *mips_refhi_list;
-
-static bfd_reloc_status_type
-mips_refhi_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_reloc_status_type ret;
- bfd_vma relocation;
- struct mips_hi *n;
-
- /* If we're relocating, and this an external symbol, we don't want
- to change anything. */
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && reloc_entry->addend == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- ret = bfd_reloc_ok;
- if (bfd_is_und_section (symbol->section)
- && output_bfd == (bfd *) NULL)
- ret = bfd_reloc_undefined;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- /* Save the information, and let REFLO do the actual relocation. */
- 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;
- n->addend = relocation;
- n->next = mips_refhi_list;
- mips_refhi_list = n;
-
- if (output_bfd != (bfd *) NULL)
- reloc_entry->address += input_section->output_offset;
-
- return ret;
-}
-
-/* Do a REFLO relocation. This is a straightforward 16 bit inplace
- relocation; this function exists in order to do the REFHI
- relocation described above. */
-
-static bfd_reloc_status_type
-mips_reflo_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- if (mips_refhi_list != NULL)
- {
- struct mips_hi *l;
-
- l = mips_refhi_list;
- while (l != NULL)
- {
- unsigned long insn;
- unsigned long val;
- unsigned long vallo;
- struct mips_hi *next;
-
- /* Do the REFHI relocation. Note that we actually don't
- need to know anything about the REFLO itself, except
- where to find the low 16 bits of the addend needed by the
- REFHI. */
- insn = bfd_get_32 (abfd, l->addr);
- vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
- & 0xffff);
- val = ((insn & 0xffff) << 16) + vallo;
- val += l->addend;
-
- /* The low order 16 bits are always treated as a signed
- value. Therefore, a negative value in the low order bits
- requires an adjustment in the high order bits. We need
- to make this adjustment in two ways: once for the bits we
- took from the data, and once for the bits we are putting
- back in to the data. */
- if ((vallo & 0x8000) != 0)
- val -= 0x10000;
- if ((val & 0x8000) != 0)
- val += 0x10000;
-
- insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
-
- next = l->next;
- free (l);
- l = next;
- }
-
- mips_refhi_list = NULL;
- }
-
- /* Now do the REFLO reloc in the usual way. */
- return mips_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-}
-
-/* Do a GPREL relocation. This is a 16 bit value which must become
- the offset from the gp register. */
-
-static bfd_reloc_status_type
-mips_gprel_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- bfd_boolean relocatable;
- bfd_vma gp;
- bfd_vma relocation;
- unsigned long val;
- unsigned long insn;
-
- /* If we're relocating, and this is an external symbol with no
- addend, we don't want to change anything. We will only have an
- addend if this is a newly created reloc, not read from an ECOFF
- file. */
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && reloc_entry->addend == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != (bfd *) NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- if (bfd_is_und_section (symbol->section) && ! relocatable)
- return bfd_reloc_undefined;
-
- /* We have to figure out the gp value, so that we can adjust the
- symbol value correctly. We look up the symbol _gp in the output
- BFD. If we can't find it, we're stuck. We cache it in the ECOFF
- target data. We don't need to adjust the symbol value for an
- external symbol if we are producing relocatable output. */
- gp = _bfd_get_gp_value (output_bfd);
- if (gp == 0
- && (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0))
- {
- if (relocatable)
- {
- /* Make up a value. */
- gp = symbol->section->output_section->vma + 0x4000;
- _bfd_set_gp_value (output_bfd, gp);
- }
- else
- {
- unsigned int count;
- asymbol **sym;
- unsigned int i;
-
- count = bfd_get_symcount (output_bfd);
- sym = bfd_get_outsymbols (output_bfd);
-
- if (sym == (asymbol **) NULL)
- i = count;
- else
- {
- for (i = 0; i < count; i++, sym++)
- {
- register const char *name;
-
- name = bfd_asymbol_name (*sym);
- if (*name == '_' && strcmp (name, "_gp") == 0)
- {
- gp = bfd_asymbol_value (*sym);
- _bfd_set_gp_value (output_bfd, gp);
- break;
- }
- }
- }
-
- if (i >= count)
- {
- /* Only get the error once. */
- gp = 4;
- _bfd_set_gp_value (output_bfd, gp);
- *error_message =
- (char *) _("GP relative relocation when _gp not defined");
- return bfd_reloc_dangerous;
- }
- }
- }
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
-
- /* Set val to the offset into the section or symbol. */
- val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff;
- if (val & 0x8000)
- val -= 0x10000;
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- insn = (insn &~ (unsigned) 0xffff) | (val & 0xffff);
- bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + reloc_entry->address);
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
-
- /* Make sure it fit in 16 bits. */
- if ((long) val >= 0x8000 || (long) val < -0x8000)
- return bfd_reloc_overflow;
-
- return bfd_reloc_ok;
-}
-
-/* Do a RELHI relocation. We do this in conjunction with a RELLO
- reloc, just as REFHI and REFLO are done together. RELHI and RELLO
- are Cygnus extensions used when generating position independent
- code for embedded systems. */
-
-/* FIXME: This should not be a static variable. */
-
-static struct mips_hi *mips_relhi_list;
-
-static bfd_reloc_status_type
-mips_relhi_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_reloc_status_type ret;
- bfd_vma relocation;
- struct mips_hi *n;
-
- /* If this is a reloc against a section symbol, then it is correct
- in the object file. The only time we want to change this case is
- when we are relaxing, and that is handled entirely by
- mips_relocate_section and never calls this function. */
- if ((symbol->flags & BSF_SECTION_SYM) != 0)
- {
- if (output_bfd != (bfd *) NULL)
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* This is an external symbol. If we're relocating, we don't want
- to change anything. */
- if (output_bfd != (bfd *) NULL)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- ret = bfd_reloc_ok;
- if (bfd_is_und_section (symbol->section)
- && output_bfd == (bfd *) NULL)
- ret = bfd_reloc_undefined;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- /* Save the information, and let RELLO do the actual relocation. */
- 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;
- n->addend = relocation;
- n->next = mips_relhi_list;
- mips_relhi_list = n;
-
- if (output_bfd != (bfd *) NULL)
- reloc_entry->address += input_section->output_offset;
-
- return ret;
-}
-
-/* Do a RELLO relocation. This is a straightforward 16 bit PC
- relative relocation; this function exists in order to do the RELHI
- relocation described above. */
-
-static bfd_reloc_status_type
-mips_rello_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- if (mips_relhi_list != NULL)
- {
- struct mips_hi *l;
-
- l = mips_relhi_list;
- while (l != NULL)
- {
- unsigned long insn;
- unsigned long val;
- unsigned long vallo;
- struct mips_hi *next;
-
- /* Do the RELHI relocation. Note that we actually don't
- need to know anything about the RELLO itself, except
- where to find the low 16 bits of the addend needed by the
- RELHI. */
- insn = bfd_get_32 (abfd, l->addr);
- vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
- & 0xffff);
- val = ((insn & 0xffff) << 16) + vallo;
- val += l->addend;
-
- /* If the symbol is defined, make val PC relative. If the
- symbol is not defined we don't want to do this, because
- we don't want the value in the object file to incorporate
- the address of the reloc. */
- if (! bfd_is_und_section (bfd_get_section (symbol))
- && ! bfd_is_com_section (bfd_get_section (symbol)))
- val -= (input_section->output_section->vma
- + input_section->output_offset
- + reloc_entry->address);
-
- /* The low order 16 bits are always treated as a signed
- value. Therefore, a negative value in the low order bits
- requires an adjustment in the high order bits. We need
- to make this adjustment in two ways: once for the bits we
- took from the data, and once for the bits we are putting
- back in to the data. */
- if ((vallo & 0x8000) != 0)
- val -= 0x10000;
- if ((val & 0x8000) != 0)
- val += 0x10000;
-
- insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
-
- next = l->next;
- free (l);
- l = next;
- }
-
- mips_relhi_list = NULL;
- }
-
- /* If this is a reloc against a section symbol, then it is correct
- in the object file. The only time we want to change this case is
- when we are relaxing, and that is handled entirely by
- mips_relocate_section and never calls this function. */
- if ((symbol->flags & BSF_SECTION_SYM) != 0)
- {
- if (output_bfd != (bfd *) NULL)
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* bfd_perform_relocation does not handle pcrel_offset relocations
- correctly when generating a relocatable file, so handle them
- directly here. */
- if (output_bfd != (bfd *) NULL)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* Now do the RELLO reloc in the usual way. */
- return mips_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-}
-
-/* This is the special function for the MIPS_R_SWITCH reloc. This
- special reloc is normally correct in the object file, and only
- requires special handling when relaxing. We don't want
- bfd_perform_relocation to tamper with it at all. */
-
-static bfd_reloc_status_type
-mips_switch_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
-{
- return bfd_reloc_ok;
-}
-
-/* Get the howto structure for a generic reloc type. */
-
-static reloc_howto_type *
-mips_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- int mips_type;
-
- switch (code)
- {
- case BFD_RELOC_16:
- mips_type = MIPS_R_REFHALF;
- break;
- case BFD_RELOC_32:
- case BFD_RELOC_CTOR:
- mips_type = MIPS_R_REFWORD;
- break;
- case BFD_RELOC_MIPS_JMP:
- mips_type = MIPS_R_JMPADDR;
- break;
- case BFD_RELOC_HI16_S:
- mips_type = MIPS_R_REFHI;
- break;
- case BFD_RELOC_LO16:
- mips_type = MIPS_R_REFLO;
- break;
- case BFD_RELOC_GPREL16:
- mips_type = MIPS_R_GPREL;
- break;
- case BFD_RELOC_MIPS_LITERAL:
- mips_type = MIPS_R_LITERAL;
- break;
- case BFD_RELOC_16_PCREL_S2:
- mips_type = MIPS_R_PCREL16;
- break;
- case BFD_RELOC_PCREL_HI16_S:
- mips_type = MIPS_R_RELHI;
- break;
- case BFD_RELOC_PCREL_LO16:
- mips_type = MIPS_R_RELLO;
- break;
- case BFD_RELOC_GPREL32:
- mips_type = MIPS_R_SWITCH;
- break;
- default:
- return (reloc_howto_type *) NULL;
- }
-
- return &mips_howto_table[mips_type];
-}
-
-/* A helper routine for mips_relocate_section which handles the REFHI
- and RELHI relocations. The REFHI relocation must be followed by a
- REFLO relocation (and RELHI by a RELLO), and the addend used is
- formed from the addends of both instructions. */
-
-static void
-mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
- relocation, pcrel)
- struct internal_reloc *refhi;
- struct internal_reloc *reflo;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- size_t adjust;
- bfd_vma relocation;
- bfd_boolean pcrel;
-{
- unsigned long insn;
- unsigned long val;
- unsigned long vallo;
-
- if (refhi == NULL)
- return;
-
- insn = bfd_get_32 (input_bfd,
- contents + adjust + refhi->r_vaddr - input_section->vma);
- if (reflo == NULL)
- vallo = 0;
- else
- vallo = (bfd_get_32 (input_bfd,
- contents + adjust + reflo->r_vaddr - input_section->vma)
- & 0xffff);
-
- val = ((insn & 0xffff) << 16) + vallo;
- val += relocation;
-
- /* The low order 16 bits are always treated as a signed value.
- Therefore, a negative value in the low order bits requires an
- adjustment in the high order bits. We need to make this
- adjustment in two ways: once for the bits we took from the data,
- and once for the bits we are putting back in to the data. */
- if ((vallo & 0x8000) != 0)
- val -= 0x10000;
-
- if (pcrel)
- val -= (input_section->output_section->vma
- + input_section->output_offset
- + (reflo->r_vaddr - input_section->vma + adjust));
-
- if ((val & 0x8000) != 0)
- val += 0x10000;
-
- insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (input_bfd, (bfd_vma) insn,
- contents + adjust + refhi->r_vaddr - input_section->vma);
-}
-
-/* Relocate a section while linking a MIPS ECOFF file. */
-
-static bfd_boolean
-mips_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, external_relocs)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- PTR external_relocs;
-{
- asection **symndx_to_section;
- struct ecoff_link_hash_entry **sym_hashes;
- bfd_vma gp;
- bfd_boolean gp_undefined;
- size_t adjust;
- long *offsets;
- struct external_reloc *ext_rel;
- struct external_reloc *ext_rel_end;
- unsigned int i;
- bfd_boolean got_lo;
- struct internal_reloc lo_int_rel;
- bfd_size_type amt;
-
- BFD_ASSERT (input_bfd->xvec->byteorder
- == output_bfd->xvec->byteorder);
-
- /* We keep a table mapping the symndx found in an internal reloc to
- the appropriate section. This is faster than looking up the
- section by name each time. */
- symndx_to_section = ecoff_data (input_bfd)->symndx_to_section;
- if (symndx_to_section == (asection **) NULL)
- {
- amt = NUM_RELOC_SECTIONS * sizeof (asection *);
- symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
- if (!symndx_to_section)
- return FALSE;
-
- symndx_to_section[RELOC_SECTION_NONE] = NULL;
- symndx_to_section[RELOC_SECTION_TEXT] =
- bfd_get_section_by_name (input_bfd, ".text");
- symndx_to_section[RELOC_SECTION_RDATA] =
- bfd_get_section_by_name (input_bfd, ".rdata");
- symndx_to_section[RELOC_SECTION_DATA] =
- bfd_get_section_by_name (input_bfd, ".data");
- symndx_to_section[RELOC_SECTION_SDATA] =
- bfd_get_section_by_name (input_bfd, ".sdata");
- symndx_to_section[RELOC_SECTION_SBSS] =
- bfd_get_section_by_name (input_bfd, ".sbss");
- symndx_to_section[RELOC_SECTION_BSS] =
- bfd_get_section_by_name (input_bfd, ".bss");
- symndx_to_section[RELOC_SECTION_INIT] =
- bfd_get_section_by_name (input_bfd, ".init");
- symndx_to_section[RELOC_SECTION_LIT8] =
- bfd_get_section_by_name (input_bfd, ".lit8");
- symndx_to_section[RELOC_SECTION_LIT4] =
- bfd_get_section_by_name (input_bfd, ".lit4");
- symndx_to_section[RELOC_SECTION_XDATA] = NULL;
- symndx_to_section[RELOC_SECTION_PDATA] = NULL;
- symndx_to_section[RELOC_SECTION_FINI] =
- bfd_get_section_by_name (input_bfd, ".fini");
- symndx_to_section[RELOC_SECTION_LITA] = NULL;
- symndx_to_section[RELOC_SECTION_ABS] = NULL;
-
- ecoff_data (input_bfd)->symndx_to_section = symndx_to_section;
- }
-
- sym_hashes = ecoff_data (input_bfd)->sym_hashes;
-
- gp = _bfd_get_gp_value (output_bfd);
- if (gp == 0)
- gp_undefined = TRUE;
- else
- gp_undefined = FALSE;
-
- got_lo = FALSE;
-
- adjust = 0;
-
- if (ecoff_section_data (input_bfd, input_section) == NULL)
- offsets = NULL;
- else
- offsets = ecoff_section_data (input_bfd, input_section)->offsets;
-
- ext_rel = (struct external_reloc *) external_relocs;
- ext_rel_end = ext_rel + input_section->reloc_count;
- for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++)
- {
- struct internal_reloc int_rel;
- bfd_boolean use_lo = FALSE;
- bfd_vma addend;
- reloc_howto_type *howto;
- struct ecoff_link_hash_entry *h = NULL;
- asection *s = NULL;
- bfd_vma relocation;
- bfd_reloc_status_type r;
-
- if (! got_lo)
- mips_ecoff_swap_reloc_in (input_bfd, (PTR) ext_rel, &int_rel);
- else
- {
- int_rel = lo_int_rel;
- got_lo = FALSE;
- }
-
- BFD_ASSERT (int_rel.r_type
- < sizeof mips_howto_table / sizeof mips_howto_table[0]);
-
- /* The REFHI and RELHI relocs requires special handling. they
- must be followed by a REFLO or RELLO reloc, respectively, and
- the addend is formed from both relocs. */
- if (int_rel.r_type == MIPS_R_REFHI
- || int_rel.r_type == MIPS_R_RELHI)
- {
- struct external_reloc *lo_ext_rel;
-
- /* As a GNU extension, permit an arbitrary number of REFHI
- or RELHI relocs before the REFLO or RELLO reloc. This
- permits gcc to emit the HI and LO relocs itself. */
- for (lo_ext_rel = ext_rel + 1;
- lo_ext_rel < ext_rel_end;
- lo_ext_rel++)
- {
- mips_ecoff_swap_reloc_in (input_bfd, (PTR) lo_ext_rel,
- &lo_int_rel);
- if (lo_int_rel.r_type != int_rel.r_type)
- break;
- }
-
- if (lo_ext_rel < ext_rel_end
- && (lo_int_rel.r_type
- == (int_rel.r_type == MIPS_R_REFHI
- ? MIPS_R_REFLO
- : MIPS_R_RELLO))
- && int_rel.r_extern == lo_int_rel.r_extern
- && int_rel.r_symndx == lo_int_rel.r_symndx)
- {
- use_lo = TRUE;
- if (lo_ext_rel == ext_rel + 1)
- got_lo = TRUE;
- }
- }
-
- howto = &mips_howto_table[int_rel.r_type];
-
- /* The SWITCH reloc must be handled specially. This reloc is
- marks the location of a difference between two portions of an
- object file. The symbol index does not reference a symbol,
- but is actually the offset from the reloc to the subtrahend
- of the difference. This reloc is correct in the object file,
- and needs no further adjustment, unless we are relaxing. If
- we are relaxing, we may have to add in an offset. Since no
- symbols are involved in this reloc, we handle it completely
- here. */
- if (int_rel.r_type == MIPS_R_SWITCH)
- {
- if (offsets != NULL
- && offsets[i] != 0)
- {
- r = _bfd_relocate_contents (howto, input_bfd,
- (bfd_vma) offsets[i],
- (contents
- + adjust
- + int_rel.r_vaddr
- - input_section->vma));
- BFD_ASSERT (r == bfd_reloc_ok);
- }
-
- continue;
- }
-
- if (int_rel.r_extern)
- {
- h = sym_hashes[int_rel.r_symndx];
- /* If h is NULL, that means that there is a reloc against an
- external symbol which we thought was just a debugging
- symbol. This should not happen. */
- if (h == (struct ecoff_link_hash_entry *) NULL)
- abort ();
- }
- else
- {
- if (int_rel.r_symndx < 0 || int_rel.r_symndx >= NUM_RELOC_SECTIONS)
- s = NULL;
- else
- s = symndx_to_section[int_rel.r_symndx];
-
- if (s == (asection *) NULL)
- abort ();
- }
-
- /* The GPREL reloc uses an addend: the difference in the GP
- values. */
- if (int_rel.r_type != MIPS_R_GPREL
- && int_rel.r_type != MIPS_R_LITERAL)
- addend = 0;
- else
- {
- if (gp_undefined)
- {
- if (! ((*info->callbacks->reloc_dangerous)
- (info, _("GP relative relocation used when GP not defined"),
- input_bfd, input_section,
- int_rel.r_vaddr - input_section->vma)))
- return FALSE;
- /* Only give the error once per link. */
- gp = 4;
- _bfd_set_gp_value (output_bfd, gp);
- gp_undefined = FALSE;
- }
- if (! int_rel.r_extern)
- {
- /* This is a relocation against a section. The current
- addend in the instruction is the difference between
- INPUT_SECTION->vma and the GP value of INPUT_BFD. We
- must change this to be the difference between the
- final definition (which will end up in RELOCATION)
- and the GP value of OUTPUT_BFD (which is in GP). */
- addend = ecoff_data (input_bfd)->gp - gp;
- }
- else if (! info->relocatable
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- /* This is a relocation against a defined symbol. The
- current addend in the instruction is simply the
- desired offset into the symbol (normally zero). We
- are going to change this into a relocation against a
- defined symbol, so we want the instruction to hold
- the difference between the final definition of the
- symbol (which will end up in RELOCATION) and the GP
- value of OUTPUT_BFD (which is in GP). */
- addend = - gp;
- }
- else
- {
- /* This is a relocation against an undefined or common
- symbol. The current addend in the instruction is
- simply the desired offset into the symbol (normally
- zero). We are generating relocatable output, and we
- aren't going to define this symbol, so we just leave
- the instruction alone. */
- addend = 0;
- }
- }
-
- /* If we are relaxing, mips_relax_section may have set
- offsets[i] to some value. A value of 1 means we must expand
- a PC relative branch into a multi-instruction of sequence,
- and any other value is an addend. */
- if (offsets != NULL
- && offsets[i] != 0)
- {
- BFD_ASSERT (! info->relocatable);
- BFD_ASSERT (int_rel.r_type == MIPS_R_PCREL16
- || int_rel.r_type == MIPS_R_RELHI
- || int_rel.r_type == MIPS_R_RELLO);
- if (offsets[i] != 1)
- addend += offsets[i];
- else
- {
- bfd_byte *here;
-
- BFD_ASSERT (int_rel.r_extern
- && int_rel.r_type == MIPS_R_PCREL16);
-
- /* Move the rest of the instructions up. */
- here = (contents
- + adjust
- + int_rel.r_vaddr
- - input_section->vma);
- memmove (here + PCREL16_EXPANSION_ADJUSTMENT, here,
- (size_t) (input_section->_raw_size
- - (int_rel.r_vaddr - input_section->vma)));
-
- /* Generate the new instructions. */
- if (! mips_relax_pcrel16 (info, input_bfd, input_section,
- h, here,
- (input_section->output_section->vma
- + input_section->output_offset
- + (int_rel.r_vaddr
- - input_section->vma)
- + adjust)))
- return FALSE;
-
- /* We must adjust everything else up a notch. */
- adjust += PCREL16_EXPANSION_ADJUSTMENT;
-
- /* mips_relax_pcrel16 handles all the details of this
- relocation. */
- continue;
- }
- }
-
- /* If we are relaxing, and this is a reloc against the .text
- segment, we may need to adjust it if some branches have been
- expanded. The reloc types which are likely to occur in the
- .text section are handled efficiently by mips_relax_section,
- and thus do not need to be handled here. */
- if (ecoff_data (input_bfd)->debug_info.adjust != NULL
- && ! int_rel.r_extern
- && int_rel.r_symndx == RELOC_SECTION_TEXT
- && (strcmp (bfd_get_section_name (input_bfd, input_section),
- ".text") != 0
- || (int_rel.r_type != MIPS_R_PCREL16
- && int_rel.r_type != MIPS_R_SWITCH
- && int_rel.r_type != MIPS_R_RELHI
- && int_rel.r_type != MIPS_R_RELLO)))
- {
- bfd_vma adr;
- struct ecoff_value_adjust *a;
-
- /* We need to get the addend so that we know whether we need
- to adjust the address. */
- BFD_ASSERT (int_rel.r_type == MIPS_R_REFWORD);
-
- adr = bfd_get_32 (input_bfd,
- (contents
- + adjust
- + int_rel.r_vaddr
- - input_section->vma));
-
- for (a = ecoff_data (input_bfd)->debug_info.adjust;
- a != (struct ecoff_value_adjust *) NULL;
- a = a->next)
- {
- if (adr >= a->start && adr < a->end)
- addend += a->adjust;
- }
- }
-
- if (info->relocatable)
- {
- /* We are generating relocatable output, and must convert
- the existing reloc. */
- if (int_rel.r_extern)
- {
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && ! bfd_is_abs_section (h->root.u.def.section))
- {
- const char *name;
-
- /* This symbol is defined in the output. Convert
- the reloc from being against the symbol to being
- against the section. */
-
- /* Clear the r_extern bit. */
- int_rel.r_extern = 0;
-
- /* Compute a new r_symndx value. */
- s = h->root.u.def.section;
- name = bfd_get_section_name (output_bfd,
- s->output_section);
-
- int_rel.r_symndx = -1;
- switch (name[1])
- {
- case 'b':
- if (strcmp (name, ".bss") == 0)
- int_rel.r_symndx = RELOC_SECTION_BSS;
- break;
- case 'd':
- if (strcmp (name, ".data") == 0)
- int_rel.r_symndx = RELOC_SECTION_DATA;
- break;
- case 'f':
- if (strcmp (name, ".fini") == 0)
- int_rel.r_symndx = RELOC_SECTION_FINI;
- break;
- case 'i':
- if (strcmp (name, ".init") == 0)
- int_rel.r_symndx = RELOC_SECTION_INIT;
- break;
- case 'l':
- if (strcmp (name, ".lit8") == 0)
- int_rel.r_symndx = RELOC_SECTION_LIT8;
- else if (strcmp (name, ".lit4") == 0)
- int_rel.r_symndx = RELOC_SECTION_LIT4;
- break;
- case 'r':
- if (strcmp (name, ".rdata") == 0)
- int_rel.r_symndx = RELOC_SECTION_RDATA;
- break;
- case 's':
- if (strcmp (name, ".sdata") == 0)
- int_rel.r_symndx = RELOC_SECTION_SDATA;
- else if (strcmp (name, ".sbss") == 0)
- int_rel.r_symndx = RELOC_SECTION_SBSS;
- break;
- case 't':
- if (strcmp (name, ".text") == 0)
- int_rel.r_symndx = RELOC_SECTION_TEXT;
- break;
- }
-
- if (int_rel.r_symndx == -1)
- abort ();
-
- /* Add the section VMA and the symbol value. */
- relocation = (h->root.u.def.value
- + s->output_section->vma
- + s->output_offset);
-
- /* For a PC relative relocation, the object file
- currently holds just the addend. We must adjust
- by the address to get the right value. */
- if (howto->pc_relative)
- {
- relocation -= int_rel.r_vaddr - input_section->vma;
-
- /* If we are converting a RELHI or RELLO reloc
- from being against an external symbol to
- being against a section, we must put a
- special value into the r_offset field. This
- value is the old addend. The r_offset for
- both the RELHI and RELLO relocs are the same,
- and we set both when we see RELHI. */
- if (int_rel.r_type == MIPS_R_RELHI)
- {
- long addhi, addlo;
-
- addhi = bfd_get_32 (input_bfd,
- (contents
- + adjust
- + int_rel.r_vaddr
- - input_section->vma));
- addhi &= 0xffff;
- if (addhi & 0x8000)
- addhi -= 0x10000;
- addhi <<= 16;
-
- if (! use_lo)
- addlo = 0;
- else
- {
- addlo = bfd_get_32 (input_bfd,
- (contents
- + adjust
- + lo_int_rel.r_vaddr
- - input_section->vma));
- addlo &= 0xffff;
- if (addlo & 0x8000)
- addlo -= 0x10000;
-
- lo_int_rel.r_offset = addhi + addlo;
- }
-
- int_rel.r_offset = addhi + addlo;
- }
- }
-
- h = NULL;
- }
- else
- {
- /* Change the symndx value to the right one for the
- output BFD. */
- int_rel.r_symndx = h->indx;
- if (int_rel.r_symndx == -1)
- {
- /* This symbol is not being written out. */
- if (! ((*info->callbacks->unattached_reloc)
- (info, h->root.root.string, input_bfd,
- input_section,
- int_rel.r_vaddr - input_section->vma)))
- return FALSE;
- int_rel.r_symndx = 0;
- }
- relocation = 0;
- }
- }
- else
- {
- /* This is a relocation against a section. Adjust the
- value by the amount the section moved. */
- relocation = (s->output_section->vma
- + s->output_offset
- - s->vma);
- }
-
- relocation += addend;
- addend = 0;
-
- /* Adjust a PC relative relocation by removing the reference
- to the original address in the section and including the
- reference to the new address. However, external RELHI
- and RELLO relocs are PC relative, but don't include any
- reference to the address. The addend is merely an
- addend. */
- if (howto->pc_relative
- && (! int_rel.r_extern
- || (int_rel.r_type != MIPS_R_RELHI
- && int_rel.r_type != MIPS_R_RELLO)))
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma);
-
- /* Adjust the contents. */
- if (relocation == 0)
- r = bfd_reloc_ok;
- else
- {
- if (int_rel.r_type != MIPS_R_REFHI
- && int_rel.r_type != MIPS_R_RELHI)
- r = _bfd_relocate_contents (howto, input_bfd, relocation,
- (contents
- + adjust
- + int_rel.r_vaddr
- - input_section->vma));
- else
- {
- mips_relocate_hi (&int_rel,
- use_lo ? &lo_int_rel : NULL,
- input_bfd, input_section, contents,
- adjust, relocation,
- int_rel.r_type == MIPS_R_RELHI);
- r = bfd_reloc_ok;
- }
- }
-
- /* Adjust the reloc address. */
- int_rel.r_vaddr += (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma);
-
- /* Save the changed reloc information. */
- mips_ecoff_swap_reloc_out (input_bfd, &int_rel, (PTR) ext_rel);
- }
- else
- {
- /* We are producing a final executable. */
- if (int_rel.r_extern)
- {
- /* This is a reloc against a symbol. */
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *hsec;
-
- hsec = h->root.u.def.section;
- relocation = (h->root.u.def.value
- + hsec->output_section->vma
- + hsec->output_offset);
- }
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section,
- int_rel.r_vaddr - input_section->vma, TRUE)))
- return FALSE;
- relocation = 0;
- }
- }
- else
- {
- /* This is a reloc against a section. */
- relocation = (s->output_section->vma
- + s->output_offset
- - s->vma);
-
- /* A PC relative reloc is already correct in the object
- file. Make it look like a pcrel_offset relocation by
- adding in the start address. */
- if (howto->pc_relative)
- {
- if (int_rel.r_type != MIPS_R_RELHI || ! use_lo)
- relocation += int_rel.r_vaddr + adjust;
- else
- relocation += lo_int_rel.r_vaddr + adjust;
- }
- }
-
- if (int_rel.r_type != MIPS_R_REFHI
- && int_rel.r_type != MIPS_R_RELHI)
- r = _bfd_final_link_relocate (howto,
- input_bfd,
- input_section,
- contents,
- (int_rel.r_vaddr
- - input_section->vma
- + adjust),
- relocation,
- addend);
- else
- {
- mips_relocate_hi (&int_rel,
- use_lo ? &lo_int_rel : NULL,
- input_bfd, input_section, contents, adjust,
- relocation,
- int_rel.r_type == MIPS_R_RELHI);
- r = bfd_reloc_ok;
- }
- }
-
- /* MIPS_R_JMPADDR requires peculiar overflow detection. The
- instruction provides a 28 bit address (the two lower bits are
- implicit zeroes) which is combined with the upper four bits
- of the instruction address. */
- if (r == bfd_reloc_ok
- && int_rel.r_type == MIPS_R_JMPADDR
- && (((relocation
- + addend
- + (int_rel.r_extern ? 0 : s->vma))
- & 0xf0000000)
- != ((input_section->output_section->vma
- + input_section->output_offset
- + (int_rel.r_vaddr - input_section->vma)
- + adjust)
- & 0xf0000000)))
- r = bfd_reloc_overflow;
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *name;
-
- if (int_rel.r_extern)
- name = h->root.root.string;
- else
- name = bfd_section_name (input_bfd, s);
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section,
- int_rel.r_vaddr - input_section->vma)))
- return FALSE;
- }
- break;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Read in the relocs for a section. */
-
-static bfd_boolean
-mips_read_relocs (abfd, sec)
- bfd *abfd;
- 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)
- {
- amt = sizeof (struct ecoff_section_tdata);
- sec->used_by_bfd = (PTR) bfd_alloc (abfd, amt);
- if (sec->used_by_bfd == NULL)
- return FALSE;
-
- section_tdata = ecoff_section_data (abfd, sec);
- section_tdata->external_relocs = NULL;
- section_tdata->contents = NULL;
- section_tdata->offsets = NULL;
- }
-
- if (section_tdata->external_relocs == NULL)
- {
- 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_bread (section_tdata->external_relocs, amt, abfd) != amt)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Relax a section when linking a MIPS ECOFF file. This is used for
- embedded PIC code, which always uses PC relative branches which
- only have an 18 bit range on MIPS. If a branch is not in range, we
- generate a long instruction sequence to compensate. Each time we
- find a branch to expand, we have to check all the others again to
- make sure they are still in range. This is slow, but it only has
- to be done when -relax is passed to the linker.
-
- This routine figures out which branches need to expand; the actual
- expansion is done in mips_relocate_section when the section
- contents are relocated. The information is stored in the offsets
- field of the ecoff_section_tdata structure. An offset of 1 means
- that the branch must be expanded into a multi-instruction PC
- relative branch (such an offset will only occur for a PC relative
- branch to an external symbol). Any other offset must be a multiple
- of four, and is the amount to change the branch by (such an offset
- will only occur for a PC relative branch within the same section).
-
- We do not modify the section relocs or contents themselves so that
- if memory usage becomes an issue we can discard them and read them
- again. The only information we must save in memory between this
- routine and the mips_relocate_section routine is the table of
- offsets. */
-
-static bfd_boolean
-mips_relax_section (abfd, sec, info, again)
- bfd *abfd;
- asection *sec;
- struct bfd_link_info *info;
- bfd_boolean *again;
-{
- struct ecoff_section_tdata *section_tdata;
- bfd_byte *contents = NULL;
- long *offsets;
- struct external_reloc *ext_rel;
- struct external_reloc *ext_rel_end;
- unsigned int i;
-
- /* Assume we are not going to need another pass. */
- *again = FALSE;
-
- /* If we are not generating an ECOFF file, this is much too
- confusing to deal with. */
- if (info->hash->creator->flavour != bfd_get_flavour (abfd))
- return TRUE;
-
- /* If there are no relocs, there is nothing to do. */
- if (sec->reloc_count == 0)
- return TRUE;
-
- /* We are only interested in PC relative relocs, and why would there
- ever be one from anything but the .text section? */
- if (strcmp (bfd_get_section_name (abfd, sec), ".text") != 0)
- return TRUE;
-
- /* Read in the relocs, if we haven't already got them. */
- section_tdata = ecoff_section_data (abfd, sec);
- if (section_tdata == (struct ecoff_section_tdata *) NULL
- || section_tdata->external_relocs == NULL)
- {
- if (! mips_read_relocs (abfd, sec))
- goto error_return;
- section_tdata = ecoff_section_data (abfd, sec);
- }
-
- if (sec->_cooked_size == 0)
- {
- /* We must initialize _cooked_size only the first time we are
- called. */
- sec->_cooked_size = sec->_raw_size;
- }
-
- contents = section_tdata->contents;
- offsets = section_tdata->offsets;
-
- /* Look for any external PC relative relocs. Internal PC relative
- relocs are already correct in the object file, so they certainly
- can not overflow. */
- ext_rel = (struct external_reloc *) section_tdata->external_relocs;
- ext_rel_end = ext_rel + sec->reloc_count;
- for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++)
- {
- struct internal_reloc int_rel;
- struct ecoff_link_hash_entry *h;
- asection *hsec;
- bfd_signed_vma relocation;
- struct external_reloc *adj_ext_rel;
- unsigned int adj_i;
- unsigned long ext_count;
- 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. */
- if (offsets != (long *) NULL && offsets[i] == 1)
- continue;
-
- /* Quickly check that this reloc is external PCREL16. */
- if (bfd_header_big_endian (abfd))
- {
- if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_BIG) == 0
- || (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_BIG)
- >> RELOC_BITS3_TYPE_SH_BIG)
- != MIPS_R_PCREL16))
- continue;
- }
- else
- {
- if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_LITTLE) == 0
- || (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_LITTLE)
- >> RELOC_BITS3_TYPE_SH_LITTLE)
- != MIPS_R_PCREL16))
- continue;
- }
-
- mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel);
-
- h = ecoff_data (abfd)->sym_hashes[int_rel.r_symndx];
- if (h == (struct ecoff_link_hash_entry *) NULL)
- abort ();
-
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- {
- /* Just ignore undefined symbols. These will presumably
- generate an error later in the link. */
- continue;
- }
-
- /* Get the value of the symbol. */
- hsec = h->root.u.def.section;
- relocation = (h->root.u.def.value
- + hsec->output_section->vma
- + hsec->output_offset);
-
- /* Subtract out the current address. */
- relocation -= (sec->output_section->vma
- + sec->output_offset
- + (int_rel.r_vaddr - sec->vma));
-
- /* The addend is stored in the object file. In the normal case
- of ``bal symbol'', the addend will be -4. It will only be
- different in the case of ``bal symbol+constant''. To avoid
- always reading in the section contents, we don't check the
- addend in the object file (we could easily check the contents
- if we happen to have already read them in, but I fear that
- this could be confusing). This means we will screw up if
- there is a branch to a symbol that is in range, but added to
- a constant which puts it out of range; in such a case the
- link will fail with a reloc overflow error. Since the
- compiler will never generate such code, it should be easy
- enough to work around it by changing the assembly code in the
- source file. */
- relocation -= 4;
-
- /* Now RELOCATION is the number we want to put in the object
- file. See whether it fits. */
- if (relocation >= -0x20000 && relocation < 0x20000)
- continue;
-
- /* Now that we know this reloc needs work, which will rarely
- happen, go ahead and grab the section contents. */
- if (contents == (bfd_byte *) NULL)
- {
- if (info->keep_memory)
- contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size);
- else
- 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,
- (file_ptr) 0, sec->_raw_size))
- goto error_return;
- if (info->keep_memory)
- section_tdata->contents = contents;
- }
-
- /* We only support changing the bal instruction. It would be
- possible to handle other PC relative branches, but some of
- them (the conditional branches) would require a different
- length instruction sequence which would complicate both this
- routine and mips_relax_pcrel16. It could be written if
- somebody felt it were important. Ignoring this reloc will
- presumably cause a reloc overflow error later on. */
- if (bfd_get_32 (abfd, contents + int_rel.r_vaddr - sec->vma)
- != 0x0411ffff) /* bgezal $0,. == bal . */
- continue;
-
- /* Bother. We need to expand this reloc, and we will need to
- make another relaxation pass since this change may put other
- relocs out of range. We need to examine the local branches
- and we need to allocate memory to hold the offsets we must
- add to them. We also need to adjust the values of all
- symbols in the object file following this location. */
-
- sec->_cooked_size += PCREL16_EXPANSION_ADJUSTMENT;
- *again = TRUE;
-
- if (offsets == (long *) NULL)
- {
- bfd_size_type size;
-
- size = (bfd_size_type) sec->reloc_count * sizeof (long);
- offsets = (long *) bfd_zalloc (abfd, size);
- if (offsets == (long *) NULL)
- goto error_return;
- section_tdata->offsets = offsets;
- }
-
- offsets[i] = 1;
-
- /* Now look for all PC relative references that cross this reloc
- and adjust their offsets. */
- adj_ext_rel = (struct external_reloc *) section_tdata->external_relocs;
- for (adj_i = 0; adj_ext_rel < ext_rel_end; adj_ext_rel++, adj_i++)
- {
- struct internal_reloc adj_int_rel;
- bfd_vma start, stop;
- int change;
-
- mips_ecoff_swap_reloc_in (abfd, (PTR) adj_ext_rel, &adj_int_rel);
-
- if (adj_int_rel.r_type == MIPS_R_PCREL16)
- {
- unsigned long insn;
-
- /* We only care about local references. External ones
- will be relocated correctly anyhow. */
- if (adj_int_rel.r_extern)
- continue;
-
- /* We are only interested in a PC relative reloc within
- this section. FIXME: Cross section PC relative
- relocs may not be handled correctly; does anybody
- care? */
- if (adj_int_rel.r_symndx != RELOC_SECTION_TEXT)
- continue;
-
- start = adj_int_rel.r_vaddr;
-
- insn = bfd_get_32 (abfd,
- contents + adj_int_rel.r_vaddr - sec->vma);
-
- stop = (insn & 0xffff) << 2;
- if ((stop & 0x20000) != 0)
- stop -= 0x40000;
- stop += adj_int_rel.r_vaddr + 4;
- }
- else if (adj_int_rel.r_type == MIPS_R_RELHI)
- {
- struct internal_reloc rello;
- long addhi, addlo;
-
- /* The next reloc must be MIPS_R_RELLO, and we handle
- them together. */
- BFD_ASSERT (adj_ext_rel + 1 < ext_rel_end);
-
- mips_ecoff_swap_reloc_in (abfd, (PTR) (adj_ext_rel + 1), &rello);
-
- BFD_ASSERT (rello.r_type == MIPS_R_RELLO);
-
- addhi = bfd_get_32 (abfd,
- contents + adj_int_rel.r_vaddr - sec->vma);
- addhi &= 0xffff;
- if (addhi & 0x8000)
- addhi -= 0x10000;
- addhi <<= 16;
-
- addlo = bfd_get_32 (abfd, contents + rello.r_vaddr - sec->vma);
- addlo &= 0xffff;
- if (addlo & 0x8000)
- addlo -= 0x10000;
-
- if (adj_int_rel.r_extern)
- {
- /* The value we want here is
- sym - RELLOaddr + addend
- which we can express as
- sym - (RELLOaddr - addend)
- Therefore if we are expanding the area between
- RELLOaddr and RELLOaddr - addend we must adjust
- the addend. This is admittedly ambiguous, since
- we might mean (sym + addend) - RELLOaddr, but in
- practice we don't, and there is no way to handle
- that case correctly since at this point we have
- no idea whether any reloc is being expanded
- between sym and sym + addend. */
- start = rello.r_vaddr - (addhi + addlo);
- stop = rello.r_vaddr;
- }
- else
- {
- /* An internal RELHI/RELLO pair represents the
- difference between two addresses, $LC0 - foo.
- The symndx value is actually the difference
- between the reloc address and $LC0. This lets us
- compute $LC0, and, by considering the addend,
- foo. If the reloc we are expanding falls between
- those two relocs, we must adjust the addend. At
- this point, the symndx value is actually in the
- r_offset field, where it was put by
- mips_ecoff_swap_reloc_in. */
- start = rello.r_vaddr - adj_int_rel.r_offset;
- stop = start + addhi + addlo;
- }
- }
- else if (adj_int_rel.r_type == MIPS_R_SWITCH)
- {
- /* A MIPS_R_SWITCH reloc represents a word of the form
- .word $L3-$LS12
- The value in the object file is correct, assuming the
- original value of $L3. The symndx value is actually
- the difference between the reloc address and $LS12.
- This lets us compute the original value of $LS12 as
- vaddr - symndx
- and the original value of $L3 as
- vaddr - symndx + addend
- where addend is the value from the object file. At
- this point, the symndx value is actually found in the
- r_offset field, since it was moved by
- mips_ecoff_swap_reloc_in. */
- start = adj_int_rel.r_vaddr - adj_int_rel.r_offset;
- stop = start + bfd_get_32 (abfd,
- (contents
- + adj_int_rel.r_vaddr
- - sec->vma));
- }
- else
- continue;
-
- /* If the range expressed by this reloc, which is the
- distance between START and STOP crosses the reloc we are
- expanding, we must adjust the offset. The sign of the
- adjustment depends upon the direction in which the range
- crosses the reloc being expanded. */
- if (start <= int_rel.r_vaddr && stop > int_rel.r_vaddr)
- change = PCREL16_EXPANSION_ADJUSTMENT;
- else if (start > int_rel.r_vaddr && stop <= int_rel.r_vaddr)
- change = - PCREL16_EXPANSION_ADJUSTMENT;
- else
- change = 0;
-
- offsets[adj_i] += change;
-
- if (adj_int_rel.r_type == MIPS_R_RELHI)
- {
- adj_ext_rel++;
- adj_i++;
- offsets[adj_i] += change;
- }
- }
-
- /* Find all symbols in this section defined by this object file
- and adjust their values. Note that we decide whether to
- adjust the value based on the value stored in the ECOFF EXTR
- structure, because the value stored in the hash table may
- have been changed by an earlier expanded reloc and thus may
- no longer correctly indicate whether the symbol is before or
- after the expanded reloc. */
- ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax;
- adj_h_ptr = ecoff_data (abfd)->sym_hashes;
- adj_h_ptr_end = adj_h_ptr + ext_count;
- for (; adj_h_ptr < adj_h_ptr_end; adj_h_ptr++)
- {
- struct ecoff_link_hash_entry *adj_h;
-
- adj_h = *adj_h_ptr;
- if (adj_h != (struct ecoff_link_hash_entry *) NULL
- && (adj_h->root.type == bfd_link_hash_defined
- || adj_h->root.type == bfd_link_hash_defweak)
- && adj_h->root.u.def.section == sec
- && adj_h->esym.asym.value > int_rel.r_vaddr)
- adj_h->root.u.def.value += PCREL16_EXPANSION_ADJUSTMENT;
- }
-
- /* 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. */
- 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;
-
- adjust->start = int_rel.r_vaddr;
- adjust->end = sec->vma + sec->_raw_size;
- adjust->adjust = PCREL16_EXPANSION_ADJUSTMENT;
-
- adjust->next = ecoff_data (abfd)->debug_info.adjust;
- ecoff_data (abfd)->debug_info.adjust = adjust;
- }
-
- if (contents != (bfd_byte *) NULL && ! info->keep_memory)
- free (contents);
-
- return TRUE;
-
- error_return:
- if (contents != (bfd_byte *) NULL && ! info->keep_memory)
- free (contents);
- return FALSE;
-}
-
-/* This routine is called from mips_relocate_section when a PC
- relative reloc must be expanded into the five instruction sequence.
- It handles all the details of the expansion, including resolving
- the reloc. */
-
-static bfd_boolean
-mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- bfd *input_bfd;
- asection *input_section ATTRIBUTE_UNUSED;
- struct ecoff_link_hash_entry *h;
- bfd_byte *location;
- bfd_vma address;
-{
- bfd_vma relocation;
-
- /* 0x0411ffff is bgezal $0,. == bal . */
- BFD_ASSERT (bfd_get_32 (input_bfd, location) == 0x0411ffff);
-
- /* We need to compute the distance between the symbol and the
- current address plus eight. */
- relocation = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- relocation -= address + 8;
-
- /* If the lower half is negative, increment the upper 16 half. */
- if ((relocation & 0x8000) != 0)
- relocation += 0x10000;
-
- 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,
- (bfd_vma) 0x003f0821, location + 12); /* addu $at,$at,$ra */
- bfd_put_32 (input_bfd,
- (bfd_vma) 0x0020f809, location + 16); /* jalr $at */
-
- return TRUE;
-}
-
-/* Given a .sdata section and a .rel.sdata in-memory section, store
- relocation information into the .rel.sdata section which can be
- used at runtime to relocate the section. This is called by the
- linker when the --embedded-relocs switch is used. This is called
- after the add_symbols entry point has been called for all the
- objects, and before the final_link entry point is called. This
- function presumes that the object was compiled using
- -membedded-pic. */
-
-bfd_boolean
-bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *datasec;
- asection *relsec;
- char **errmsg;
-{
- struct ecoff_link_hash_entry **sym_hashes;
- struct ecoff_section_tdata *section_tdata;
- struct external_reloc *ext_rel;
- struct external_reloc *ext_rel_end;
- bfd_byte *p;
- bfd_size_type amt;
-
- BFD_ASSERT (! info->relocatable);
-
- *errmsg = NULL;
-
- if (datasec->reloc_count == 0)
- return TRUE;
-
- sym_hashes = ecoff_data (abfd)->sym_hashes;
-
- if (! mips_read_relocs (abfd, datasec))
- return FALSE;
-
- amt = (bfd_size_type) datasec->reloc_count * 4;
- relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt);
- if (relsec->contents == NULL)
- return FALSE;
-
- p = relsec->contents;
-
- section_tdata = ecoff_section_data (abfd, datasec);
- ext_rel = (struct external_reloc *) section_tdata->external_relocs;
- ext_rel_end = ext_rel + datasec->reloc_count;
- for (; ext_rel < ext_rel_end; ext_rel++, p += 4)
- {
- struct internal_reloc int_rel;
- bfd_boolean text_relative;
-
- mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel);
-
- /* We are going to write a four byte word into the runtime reloc
- section. The word will be the address in the data section
- which must be relocated. This must be on a word boundary,
- which means the lower two bits must be zero. We use the
- least significant bit to indicate how the value in the data
- section must be relocated. A 0 means that the value is
- relative to the text section, while a 1 indicates that the
- value is relative to the data section. Given that we are
- assuming the code was compiled using -membedded-pic, there
- should not be any other possibilities. */
-
- /* We can only relocate REFWORD relocs at run time. */
- if (int_rel.r_type != MIPS_R_REFWORD)
- {
- *errmsg = _("unsupported reloc type");
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (int_rel.r_extern)
- {
- struct ecoff_link_hash_entry *h;
-
- h = sym_hashes[int_rel.r_symndx];
- /* If h is NULL, that means that there is a reloc against an
- external symbol which we thought was just a debugging
- symbol. This should not happen. */
- if (h == (struct ecoff_link_hash_entry *) NULL)
- abort ();
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->root.u.def.section->flags & SEC_CODE) != 0)
- text_relative = TRUE;
- else
- text_relative = FALSE;
- }
- else
- {
- switch (int_rel.r_symndx)
- {
- case RELOC_SECTION_TEXT:
- text_relative = TRUE;
- break;
- case RELOC_SECTION_SDATA:
- case RELOC_SECTION_SBSS:
- case RELOC_SECTION_LIT8:
- text_relative = FALSE;
- break;
- default:
- /* No other sections should appear in -membedded-pic
- code. */
- *errmsg = _("reloc against unsupported section");
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
-
- if ((int_rel.r_offset & 3) != 0)
- {
- *errmsg = _("reloc not properly aligned");
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- bfd_put_32 (abfd,
- (int_rel.r_vaddr - datasec->vma + datasec->output_offset
- + (text_relative ? 0 : 1)),
- p);
- }
-
- return TRUE;
-}
-
-/* This is the ECOFF backend structure. The backend field of the
- target vector points to this. */
-
-static const struct ecoff_backend_data mips_ecoff_backend_data =
-{
- /* COFF backend structure. */
- {
- (void (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR))) bfd_void, /* aux_in */
- (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_in */
- (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_in */
- (unsigned (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR)))bfd_void,/*aux_out*/
- (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_out */
- (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_out */
- (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
- mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
- mips_ecoff_swap_scnhdr_out,
- FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, FALSE, 4, FALSE, 2,
- mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
- mips_ecoff_swap_scnhdr_in, NULL,
- mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
- _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
- _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL
- },
- /* Supported architecture. */
- bfd_arch_mips,
- /* Initial portion of armap string. */
- "__________",
- /* The page boundary used to align sections in a demand-paged
- executable file. E.g., 0x1000. */
- 0x1000,
- /* TRUE if the .rdata section is part of the text segment, as on the
- Alpha. FALSE if .rdata is part of the data segment, as on the
- MIPS. */
- FALSE,
- /* Bitsize of constructor entries. */
- 32,
- /* Reloc to use for constructor entries. */
- &mips_howto_table[MIPS_R_REFWORD],
- {
- /* Symbol table magic number. */
- magicSym,
- /* Alignment of debugging information. E.g., 4. */
- 4,
- /* Sizes of external symbolic information. */
- sizeof (struct hdr_ext),
- sizeof (struct dnr_ext),
- sizeof (struct pdr_ext),
- sizeof (struct sym_ext),
- sizeof (struct opt_ext),
- sizeof (struct fdr_ext),
- sizeof (struct rfd_ext),
- sizeof (struct ext_ext),
- /* Functions to swap in external symbolic data. */
- ecoff_swap_hdr_in,
- ecoff_swap_dnr_in,
- ecoff_swap_pdr_in,
- ecoff_swap_sym_in,
- ecoff_swap_opt_in,
- ecoff_swap_fdr_in,
- ecoff_swap_rfd_in,
- ecoff_swap_ext_in,
- _bfd_ecoff_swap_tir_in,
- _bfd_ecoff_swap_rndx_in,
- /* Functions to swap out external symbolic data. */
- ecoff_swap_hdr_out,
- ecoff_swap_dnr_out,
- ecoff_swap_pdr_out,
- ecoff_swap_sym_out,
- ecoff_swap_opt_out,
- ecoff_swap_fdr_out,
- ecoff_swap_rfd_out,
- ecoff_swap_ext_out,
- _bfd_ecoff_swap_tir_out,
- _bfd_ecoff_swap_rndx_out,
- /* Function to read in symbolic data. */
- _bfd_ecoff_slurp_symbolic_info
- },
- /* External reloc size. */
- RELSZ,
- /* Reloc swapping functions. */
- mips_ecoff_swap_reloc_in,
- mips_ecoff_swap_reloc_out,
- /* Backend reloc tweaking. */
- mips_adjust_reloc_in,
- mips_adjust_reloc_out,
- /* Relocate section contents while linking. */
- mips_relocate_section,
- /* Do final adjustments to filehdr and aouthdr. */
- NULL,
- /* Read an element from an archive at a given file position. */
- _bfd_get_elt_at_filepos
-};
-
-/* Looking up a reloc type is MIPS specific. */
-#define _bfd_ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup
-
-/* Getting relocated section contents is generic. */
-#define _bfd_ecoff_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-
-/* Handling file windows is generic. */
-#define _bfd_ecoff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-/* Relaxing sections is MIPS specific. */
-#define _bfd_ecoff_bfd_relax_section mips_relax_section
-
-/* GC of sections is not done. */
-#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
-
-/* Merging of sections is not done. */
-#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
-
-#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
-
-extern const bfd_target ecoff_big_vec;
-
-const bfd_target ecoff_little_vec =
-{
- "ecoff-littlemips", /* name */
- bfd_target_ecoff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- _bfd_ecoff_archive_p, _bfd_dummy_target},
- {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (_bfd_ecoff),
- BFD_JUMP_TABLE_COPY (_bfd_ecoff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff),
- BFD_JUMP_TABLE_RELOCS (_bfd_ecoff),
- BFD_JUMP_TABLE_WRITE (_bfd_ecoff),
- BFD_JUMP_TABLE_LINK (_bfd_ecoff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & ecoff_big_vec,
-
- (PTR) &mips_ecoff_backend_data
-};
-
-const bfd_target ecoff_big_vec =
-{
- "ecoff-bigmips", /* name */
- bfd_target_ecoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- _bfd_ecoff_archive_p, _bfd_dummy_target},
- {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (_bfd_ecoff),
- BFD_JUMP_TABLE_COPY (_bfd_ecoff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff),
- BFD_JUMP_TABLE_RELOCS (_bfd_ecoff),
- BFD_JUMP_TABLE_WRITE (_bfd_ecoff),
- BFD_JUMP_TABLE_LINK (_bfd_ecoff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & ecoff_little_vec,
-
- (PTR) &mips_ecoff_backend_data
-};
-
-const bfd_target ecoff_biglittle_vec =
-{
- "ecoff-biglittlemips", /* name */
- bfd_target_ecoff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- _bfd_ecoff_archive_p, _bfd_dummy_target},
- {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (_bfd_ecoff),
- BFD_JUMP_TABLE_COPY (_bfd_ecoff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff),
- BFD_JUMP_TABLE_RELOCS (_bfd_ecoff),
- BFD_JUMP_TABLE_WRITE (_bfd_ecoff),
- BFD_JUMP_TABLE_LINK (_bfd_ecoff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) &mips_ecoff_backend_data
-};
diff --git a/contrib/binutils/bfd/coff-ppc.c b/contrib/binutils/bfd/coff-ppc.c
deleted file mode 100644
index c1c2c32..0000000
--- a/contrib/binutils/bfd/coff-ppc.c
+++ /dev/null
@@ -1,2869 +0,0 @@
-/* BFD back-end for PowerPC Microsoft Portable Executable files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
- Original version pieced together by Kim Knuttila (krk@cygnus.com)
-
- There is nothing new under the sun. This file draws a lot on other
- coff files, in particular, those for the rs/6000, alpha, mips, and
- intel backends, and the PE work for the arm.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* Current State:
- - objdump works
- - relocs generated by gas
- - ld will link files, but they do not run.
- - dlltool will not produce correct output in some .reloc cases, and will
- not produce the right glue code for dll function calls. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#include "libbfd.h"
-
-#include "coff/powerpc.h"
-#include "coff/internal.h"
-
-#include "coff/pe.h"
-
-#ifdef BADMAG
-#undef BADMAG
-#endif
-
-#define BADMAG(x) PPCBADMAG(x)
-
-#include "libcoff.h"
-
-/* This file is compiled more than once, but we only compile the
- final_link routine once. */
-extern bfd_boolean ppc_bfd_coff_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-extern void dump_toc PARAMS ((PTR));
-
-/* The toc is a set of bfd_vma fields. We use the fact that valid
- addresses are even (i.e. the bit representing "1" is off) to allow
- us to encode a little extra information in the field
- - Unallocated addresses are initialized to 1.
- - Allocated addresses are even numbers.
- The first time we actually write a reference to the toc in the bfd,
- we want to record that fact in a fixup file (if it is asked for), so
- we keep track of whether or not an address has been written by marking
- the low order bit with a "1" upon writing. */
-
-#define SET_UNALLOCATED(x) ((x) = 1)
-#define IS_UNALLOCATED(x) ((x) == 1)
-
-#define IS_WRITTEN(x) ((x) & 1)
-#define MARK_AS_WRITTEN(x) ((x) |= 1)
-#define MAKE_ADDR_AGAIN(x) ((x) &= ~1)
-
-/* Turn on this check if you suspect something amiss in the hash tables. */
-#ifdef DEBUG_HASH
-
-/* Need a 7 char string for an eye catcher. */
-#define EYE "krkjunk"
-
-#define HASH_CHECK_DCL char eye_catcher[8];
-#define HASH_CHECK_INIT(ret) strcpy(ret->eye_catcher, EYE)
-#define HASH_CHECK(addr) \
- if (strcmp(addr->eye_catcher, EYE) != 0) \
- { \
- fprintf (stderr,\
- _("File %s, line %d, Hash check failure, bad eye %8s\n"), \
- __FILE__, __LINE__, addr->eye_catcher); \
- abort (); \
- }
-
-#else
-
-#define HASH_CHECK_DCL
-#define HASH_CHECK_INIT(ret)
-#define HASH_CHECK(addr)
-
-#endif
-
-/* In order not to add an int to every hash table item for every coff
- linker, we define our own hash table, derived from the coff one. */
-
-/* PE linker hash table entries. */
-
-struct ppc_coff_link_hash_entry
-{
- struct coff_link_hash_entry root; /* First entry, as required. */
-
- /* As we wonder around the relocs, we'll keep the assigned toc_offset
- here. */
- bfd_vma toc_offset; /* Our addition, as required. */
- int symbol_is_glue;
- unsigned long int glue_insn;
-
- HASH_CHECK_DCL
-};
-
-/* PE linker hash table. */
-
-struct ppc_coff_link_hash_table
-{
- struct coff_link_hash_table root; /* First entry, as required. */
-};
-
-static struct bfd_hash_entry *ppc_coff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- const char *));
-static bfd_boolean ppc_coff_link_hash_table_init
- PARAMS ((struct ppc_coff_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
-static struct bfd_link_hash_table *ppc_coff_link_hash_table_create
- PARAMS ((bfd *));
-static bfd_boolean coff_ppc_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-static reloc_howto_type *coff_ppc_rtype_to_howto
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-
-/* Routine to create an entry in the link hash table. */
-
-static struct bfd_hash_entry *
-ppc_coff_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct ppc_coff_link_hash_entry *ret =
- (struct ppc_coff_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct ppc_coff_link_hash_entry *) NULL)
- ret = (struct ppc_coff_link_hash_entry *)
- bfd_hash_allocate (table,
- sizeof (struct ppc_coff_link_hash_entry));
-
- if (ret == (struct ppc_coff_link_hash_entry *) NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct ppc_coff_link_hash_entry *)
- _bfd_coff_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
-
- if (ret)
- {
- /* Initialize the local fields. */
- SET_UNALLOCATED (ret->toc_offset);
- ret->symbol_is_glue = 0;
- ret->glue_insn = 0;
-
- HASH_CHECK_INIT (ret);
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Initialize a PE linker hash table. */
-
-static bfd_boolean
-ppc_coff_link_hash_table_init (table, abfd, newfunc)
- struct ppc_coff_link_hash_table *table;
- bfd *abfd;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
-{
- return _bfd_coff_link_hash_table_init (&table->root, abfd, newfunc);
-}
-
-/* Create a PE linker hash table. */
-
-static struct bfd_link_hash_table *
-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_malloc (amt);
- if (ret == NULL)
- return NULL;
- if (! ppc_coff_link_hash_table_init (ret, abfd,
- ppc_coff_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
- return &ret->root.root;
-}
-
-/* Now, tailor coffcode.h to use our hash stuff. */
-
-#define coff_bfd_link_hash_table_create ppc_coff_link_hash_table_create
-
-/* The nt loader points the toc register to &toc + 32768, in order to
- use the complete range of a 16-bit displacement. We have to adjust
- for this when we fix up loads displaced off the toc reg. */
-#define TOC_LOAD_ADJUSTMENT (-32768)
-#define TOC_SECTION_NAME ".private.toc"
-
-/* The main body of code is in coffcode.h. */
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-/* These should definitely go in a header file somewhere... */
-
-/* NOP */
-#define IMAGE_REL_PPC_ABSOLUTE 0x0000
-
-/* 64-bit address */
-#define IMAGE_REL_PPC_ADDR64 0x0001
-
-/* 32-bit address */
-#define IMAGE_REL_PPC_ADDR32 0x0002
-
-/* 26-bit address, shifted left 2 (branch absolute) */
-#define IMAGE_REL_PPC_ADDR24 0x0003
-
-/* 16-bit address */
-#define IMAGE_REL_PPC_ADDR16 0x0004
-
-/* 16-bit address, shifted left 2 (load doubleword) */
-#define IMAGE_REL_PPC_ADDR14 0x0005
-
-/* 26-bit PC-relative offset, shifted left 2 (branch relative) */
-#define IMAGE_REL_PPC_REL24 0x0006
-
-/* 16-bit PC-relative offset, shifted left 2 (br cond relative) */
-#define IMAGE_REL_PPC_REL14 0x0007
-
-/* 16-bit offset from TOC base */
-#define IMAGE_REL_PPC_TOCREL16 0x0008
-
-/* 16-bit offset from TOC base, shifted left 2 (load doubleword) */
-#define IMAGE_REL_PPC_TOCREL14 0x0009
-
-/* 32-bit addr w/o image base */
-#define IMAGE_REL_PPC_ADDR32NB 0x000A
-
-/* va of containing section (as in an image sectionhdr) */
-#define IMAGE_REL_PPC_SECREL 0x000B
-
-/* sectionheader number */
-#define IMAGE_REL_PPC_SECTION 0x000C
-
-/* substitute TOC restore instruction iff symbol is glue code */
-#define IMAGE_REL_PPC_IFGLUE 0x000D
-
-/* symbol is glue code; virtual address is TOC restore instruction */
-#define IMAGE_REL_PPC_IMGLUE 0x000E
-
-/* va of containing section (limited to 16 bits) */
-#define IMAGE_REL_PPC_SECREL16 0x000F
-
-/* Stuff to handle immediate data when the number of bits in the
- data is greater than the number of bits in the immediate field
- We need to do (usually) 32 bit arithmetic on 16 bit chunks. */
-#define IMAGE_REL_PPC_REFHI 0x0010
-#define IMAGE_REL_PPC_REFLO 0x0011
-#define IMAGE_REL_PPC_PAIR 0x0012
-
-/* This is essentially the same as tocrel16, with TOCDEFN assumed. */
-#define IMAGE_REL_PPC_TOCREL16_DEFN 0x0013
-
-/* Flag bits in IMAGE_RELOCATION.TYPE. */
-
-/* Subtract reloc value rather than adding it. */
-#define IMAGE_REL_PPC_NEG 0x0100
-
-/* Fix branch prediction bit to predict branch taken. */
-#define IMAGE_REL_PPC_BRTAKEN 0x0200
-
-/* Fix branch prediction bit to predict branch not taken. */
-#define IMAGE_REL_PPC_BRNTAKEN 0x0400
-
-/* TOC slot defined in file (or, data in toc). */
-#define IMAGE_REL_PPC_TOCDEFN 0x0800
-
-/* Masks to isolate above values in IMAGE_RELOCATION.Type. */
-#define IMAGE_REL_PPC_TYPEMASK 0x00FF
-#define IMAGE_REL_PPC_FLAGMASK 0x0F00
-
-#define EXTRACT_TYPE(x) ((x) & IMAGE_REL_PPC_TYPEMASK)
-#define EXTRACT_FLAGS(x) ((x) & IMAGE_REL_PPC_FLAGMASK)
-#define EXTRACT_JUNK(x) \
- ((x) & ~(IMAGE_REL_PPC_TYPEMASK | IMAGE_REL_PPC_FLAGMASK))
-
-/* Static helper functions to make relocation work. */
-/* (Work In Progress) */
-
-static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-#if 0
-static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-#endif
-static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-
-static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-
-#if 0
-static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-#endif
-static bfd_reloc_status_type ppc_section_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-
-static bfd_reloc_status_type ppc_secrel_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-
-static bfd_reloc_status_type ppc_imglue_reloc PARAMS ((bfd *abfd,
- arelent *reloc,
- asymbol *symbol,
- PTR data,
- asection *section,
- bfd *output_bfd,
- char **error));
-
-static bfd_boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
-
-/* FIXME: It'll take a while to get through all of these. I only need a few to
- get us started, so those I'll make sure work. Those marked FIXME are either
- completely unverified or have a specific unknown marked in the comment. */
-
-/* Relocation entries for Windows/NT on PowerPC.
-
- From the document "" we find the following listed as used relocs:
-
- ABSOLUTE : The noop
- ADDR[64|32|16] : fields that hold addresses in data fields or the
- 16 bit displacement field on a load/store.
- ADDR[24|14] : fields that hold addresses in branch and cond
- branches. These represent [26|16] bit addresses.
- The low order 2 bits are preserved.
- REL[24|14] : branches relative to the Instruction Address
- register. These represent [26|16] bit addresses,
- as before. The instruction field will be zero, and
- the address of the SYM will be inserted at link time.
- TOCREL16 : 16 bit displacement field referring to a slot in
- toc.
- TOCREL14 : 16 bit displacement field, similar to REL14 or ADDR14.
- ADDR32NB : 32 bit address relative to the virtual origin.
- (On the alpha, this is always a linker generated thunk)
- (i.e. 32bit addr relative to the image base)
- SECREL : The value is relative to the start of the section
- containing the symbol.
- SECTION : access to the header containing the item. Supports the
- codeview debugger.
-
- In particular, note that the document does not indicate that the
- relocations listed in the header file are used. */
-
-
-static reloc_howto_type ppc_coff_howto_table[] =
-{
- /* IMAGE_REL_PPC_ABSOLUTE 0x0000 NOP */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_ABSOLUTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* dont complain_on_overflow */
- 0, /* special_function */
- "ABSOLUTE", /* name */
- FALSE, /* partial_inplace */
- 0x00, /* src_mask */
- 0x00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_ADDR64 0x0001 64-bit address */
- /* Unused: */
- HOWTO(IMAGE_REL_PPC_ADDR64, /* type */
- 0, /* rightshift */
- 3, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "ADDR64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_ADDR32 0x0002 32-bit address */
- /* Used: */
- HOWTO (IMAGE_REL_PPC_ADDR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "ADDR32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_ADDR24 0x0003 26-bit address, shifted left 2 (branch absolute) */
- /* the LI field is in bit 6 through bit 29 is 24 bits, + 2 for the shift */
- /* Of course, That's the IBM approved bit numbering, which is not what */
- /* anyone else uses.... The li field is in bit 2 thru 25 */
- /* Used: */
- HOWTO (IMAGE_REL_PPC_ADDR24, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "ADDR24", /* name */
- TRUE, /* partial_inplace */
- 0x07fffffc, /* src_mask */
- 0x07fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_ADDR16 0x0004 16-bit address */
- /* Used: */
- HOWTO (IMAGE_REL_PPC_ADDR16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "ADDR16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_ADDR14 0x0005 */
- /* 16-bit address, shifted left 2 (load doubleword) */
- /* FIXME: the mask is likely wrong, and the bit position may be as well */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_ADDR14, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "ADDR16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_REL24 0x0006 */
- /* 26-bit PC-relative offset, shifted left 2 (branch relative) */
- /* Used: */
- HOWTO (IMAGE_REL_PPC_REL24, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "REL24", /* name */
- TRUE, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_REL14 0x0007 */
- /* 16-bit PC-relative offset, shifted left 2 (br cond relative) */
- /* FIXME: the mask is likely wrong, and the bit position may be as well */
- /* FIXME: how does it know how far to shift? */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_ADDR14, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "ADDR16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_TOCREL16 0x0008 */
- /* 16-bit offset from TOC base */
- /* Used: */
- HOWTO (IMAGE_REL_PPC_TOCREL16,/* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_toc16_reloc, /* special_function */
- "TOCREL16", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_TOCREL14 0x0009 */
- /* 16-bit offset from TOC base, shifted left 2 (load doubleword) */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_TOCREL14,/* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "TOCREL14", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_ADDR32NB 0x000A */
- /* 32-bit addr w/ image base */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_ADDR32NB,/* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "ADDR32NB", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_SECREL 0x000B */
- /* va of containing section (as in an image sectionhdr) */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_SECREL,/* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_secrel_reloc, /* special_function */
- "SECREL", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_SECTION 0x000C */
- /* sectionheader number */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_SECTION,/* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_section_reloc, /* special_function */
- "SECTION", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_IFGLUE 0x000D */
- /* substitute TOC restore instruction iff symbol is glue code */
- /* Used: */
- HOWTO (IMAGE_REL_PPC_IFGLUE,/* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "IFGLUE", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_IMGLUE 0x000E */
- /* symbol is glue code; virtual address is TOC restore instruction */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_IMGLUE,/* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_imglue_reloc, /* special_function */
- "IMGLUE", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_SECREL16 0x000F */
- /* va of containing section (limited to 16 bits) */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_SECREL16,/* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SECREL16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_REFHI 0x0010 */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_REFHI, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_refhi_reloc, /* special_function */
- "REFHI", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_REFLO 0x0011 */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_REFLO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_refhi_reloc, /* special_function */
- "REFLO", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_PAIR 0x0012 */
- /* Unused: */
- HOWTO (IMAGE_REL_PPC_PAIR, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_pair_reloc, /* special_function */
- "PAIR", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* IMAGE_REL_PPC_TOCREL16_DEFN 0x0013 */
- /* 16-bit offset from TOC base, without causing a definition */
- /* Used: */
- HOWTO ( (IMAGE_REL_PPC_TOCREL16 | IMAGE_REL_PPC_TOCDEFN), /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "TOCREL16, TOCDEFN", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
-};
-
-/* Some really cheezy macros that can be turned on to test stderr :-) */
-
-#ifdef DEBUG_RELOC
-#define UN_IMPL(x) \
-{ \
- static int i; \
- if (i == 0) \
- { \
- i = 1; \
- fprintf (stderr,_("Unimplemented Relocation -- %s\n"),x); \
- } \
-}
-
-#define DUMP_RELOC(n,r) \
-{ \
- fprintf (stderr,"%s sym %d, addr %d, addend %d\n", \
- n, (*(r->sym_ptr_ptr))->name, \
- r->address, r->addend); \
-}
-
-/* Given a reloc name, n, and a pointer to an internal_reloc,
- dump out interesting information on the contents
-
-#define n_name _n._n_name
-#define n_zeroes _n._n_n._n_zeroes
-#define n_offset _n._n_n._n_offset */
-
-#define DUMP_RELOC2(n,r) \
-{ \
- fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
- n, r->r_symndx, r->r_vaddr, \
- (((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
- ?" ":" TOCDEFN" ); \
-}
-
-#else
-#define UN_IMPL(x)
-#define DUMP_RELOC(n,r)
-#define DUMP_RELOC2(n,r)
-#endif
-
-/* TOC construction and management routines. */
-
-/* This file is compiled twice, and these variables are defined in one
- of the compilations. FIXME: This is confusing and weird. Also,
- BFD should not use global variables. */
-extern bfd * bfd_of_toc_owner;
-extern long int global_toc_size;
-extern long int import_table_size;
-extern long int first_thunk_address;
-extern long int thunk_size;
-
-enum toc_type
-{
- default_toc,
- toc_32,
- toc_64
-};
-
-enum ref_category
-{
- priv,
- pub,
- tocdata
-};
-
-struct list_ele
-{
- struct list_ele *next;
- bfd_vma addr;
- enum ref_category cat;
- int offset;
- const char *name;
-};
-
-extern struct list_ele *head;
-extern struct list_ele *tail;
-
-static void record_toc
- PARAMS ((asection *, bfd_signed_vma, enum ref_category, const char *));
-
-static void
-record_toc (toc_section, our_toc_offset, cat, name)
- asection *toc_section;
- bfd_signed_vma our_toc_offset;
- enum ref_category cat;
- const char *name;
-{
- /* Add this entry to our toc addr-offset-name list. */
- 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;
- t->offset = our_toc_offset;
- t->name = name;
- t->cat = cat;
- t->addr = toc_section->output_offset + our_toc_offset;
-
- if (head == 0)
- {
- head = t;
- tail = t;
- }
- else
- {
- tail->next = t;
- tail = t;
- }
-}
-
-#ifdef COFF_IMAGE_WITH_PE
-
-static bfd_boolean ppc_record_toc_entry
- PARAMS ((bfd *, struct bfd_link_info *, asection *, int, enum toc_type));
-static void ppc_mark_symbol_as_glue
- PARAMS ((bfd *, int, struct internal_reloc *));
-
-/* Record a toc offset against a symbol. */
-static bfd_boolean
-ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- int sym;
- enum toc_type toc_kind ATTRIBUTE_UNUSED;
-{
- struct ppc_coff_link_hash_entry *h;
- const char *name;
-
- int *local_syms;
-
- h = 0;
-
- h = (struct ppc_coff_link_hash_entry *) (obj_coff_sym_hashes (abfd)[sym]);
- if (h != 0)
- {
- HASH_CHECK(h);
- }
-
- if (h == 0)
- {
- local_syms = obj_coff_local_toc_table(abfd);
-
- if (local_syms == 0)
- {
- unsigned int i;
- bfd_size_type amt;
-
- /* allocate a table */
- 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)
- {
- SET_UNALLOCATED (local_syms[i]);
- }
- }
-
- if (IS_UNALLOCATED(local_syms[sym]))
- {
- local_syms[sym] = global_toc_size;
- global_toc_size += 4;
-
- /* The size must fit in a 16-bit displacement. */
- if (global_toc_size > 65535)
- {
- (*_bfd_error_handler) (_("TOC overflow"));
- bfd_set_error (bfd_error_file_too_big);
- return FALSE;
- }
- }
- }
- else
- {
- name = h->root.root.root.string;
-
- /* Check to see if there's a toc slot allocated. If not, do it
- here. It will be used in relocate_section. */
- if (IS_UNALLOCATED(h->toc_offset))
- {
- h->toc_offset = global_toc_size;
- global_toc_size += 4;
-
- /* The size must fit in a 16-bit displacement. */
- if (global_toc_size >= 65535)
- {
- (*_bfd_error_handler) (_("TOC overflow"));
- bfd_set_error (bfd_error_file_too_big);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Record a toc offset against a symbol. */
-static void
-ppc_mark_symbol_as_glue(abfd, sym, rel)
- bfd *abfd;
- int sym;
- struct internal_reloc *rel;
-{
- struct ppc_coff_link_hash_entry *h;
-
- h = (struct ppc_coff_link_hash_entry *) (obj_coff_sym_hashes (abfd)[sym]);
-
- HASH_CHECK(h);
-
- h->symbol_is_glue = 1;
- h->glue_insn = bfd_get_32 (abfd, (bfd_byte *) &rel->r_vaddr);
-
- return;
-}
-
-#endif /* COFF_IMAGE_WITH_PE */
-
-/* Return TRUE if this relocation should
- appear in the output .reloc section. */
-
-static bfd_boolean in_reloc_p(abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type *howto;
-{
- return
- (! howto->pc_relative)
- && (howto->type != IMAGE_REL_PPC_ADDR32NB)
- && (howto->type != IMAGE_REL_PPC_TOCREL16)
- && (howto->type != IMAGE_REL_PPC_IMGLUE)
- && (howto->type != IMAGE_REL_PPC_IFGLUE)
- && (howto->type != IMAGE_REL_PPC_SECREL)
- && (howto->type != IMAGE_REL_PPC_SECTION)
- && (howto->type != IMAGE_REL_PPC_SECREL16)
- && (howto->type != IMAGE_REL_PPC_REFHI)
- && (howto->type != IMAGE_REL_PPC_REFLO)
- && (howto->type != IMAGE_REL_PPC_PAIR)
- && (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ;
-}
-
-#if 0
-
-/* This function is in charge of performing all the ppc PE relocations
- Don't yet know if we want to do this this particular way ... (krk). */
-/* FIXME: (it is not yet enabled). */
-
-static bfd_reloc_status_type
-pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol_in;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- /* The consth relocation comes in two parts, we have to remember
- the state between calls, in these variables. */
- static bfd_boolean part1_consth_active = FALSE;
- static unsigned long part1_consth_value;
-
- unsigned long sym_value;
- unsigned short r_type;
- unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
-
- r_type = reloc_entry->howto->type;
-
- if (output_bfd)
- {
- /* Partial linking - do nothing. */
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (symbol_in != NULL
- && bfd_is_und_section (symbol_in->section))
- {
- /* Keep the state machine happy in case we're called again. */
- if (r_type == IMAGE_REL_PPC_REFHI)
- {
- part1_consth_active = TRUE;
- part1_consth_value = 0;
- }
- return(bfd_reloc_undefined);
- }
-
- if ((part1_consth_active) && (r_type != IMAGE_REL_PPC_PAIR))
- {
- part1_consth_active = FALSE;
- *error_message = (char *) _("Missing PAIR");
- return(bfd_reloc_dangerous);
- }
-
- sym_value = get_symbol_value(symbol_in);
-
- return(bfd_reloc_ok);
-}
-
-#endif /* 0 */
-
-/* The reloc processing routine for the optimized COFF linker. */
-
-static bfd_boolean
-coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, syms, sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
-{
- struct internal_reloc *rel;
- struct internal_reloc *relend;
- bfd_boolean hihalf;
- bfd_vma hihalf_val;
- asection *toc_section = 0;
- bfd_vma relocation;
- reloc_howto_type *howto = 0;
-
- /* If we are performing a relocatable link, we don't need to do a
- thing. The caller will take care of adjusting the reloc
- addresses and symbol indices. */
- if (info->relocatable)
- return TRUE;
-
- hihalf = FALSE;
- hihalf_val = 0;
-
- rel = relocs;
- relend = rel + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- long symndx;
- struct ppc_coff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma val;
-
- asection *sec;
- bfd_reloc_status_type rstat;
- bfd_byte *loc;
-
- unsigned short r_type = EXTRACT_TYPE (rel->r_type);
- unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
-
- symndx = rel->r_symndx;
- loc = contents + rel->r_vaddr - input_section->vma;
-
- /* FIXME: check bounds on r_type */
- howto = ppc_coff_howto_table + r_type;
-
- if (symndx == -1)
- {
- h = NULL;
- sym = NULL;
- }
- else
- {
- h = (struct ppc_coff_link_hash_entry *)
- (obj_coff_sym_hashes (input_bfd)[symndx]);
- if (h != 0)
- {
- HASH_CHECK(h);
- }
-
- sym = syms + symndx;
- }
-
- if (r_type == IMAGE_REL_PPC_IMGLUE && h == 0)
- {
- /* An IMGLUE reloc must have a name. Something is very wrong. */
- abort ();
- }
-
- sec = NULL;
- val = 0;
-
- /* FIXME: PAIR unsupported in the following code. */
- if (h == NULL)
- {
- if (symndx == -1)
- sec = bfd_abs_section_ptr;
- else
- {
- sec = sections[symndx];
- val = (sec->output_section->vma
- + sec->output_offset
- + sym->n_value);
- if (! obj_pe (output_bfd))
- val -= sec->vma;
- }
- }
- else
- {
- HASH_CHECK(h);
-
- if (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- {
- sec = h->root.root.u.def.section;
- val = (h->root.root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, TRUE)))
- return FALSE;
- }
- }
-
- rstat = bfd_reloc_ok;
-
- /* Each case must do its own relocation, setting rstat appropriately. */
- switch (r_type)
- {
- default:
- (*_bfd_error_handler)
- (_("%s: unsupported relocation type 0x%02x"),
- bfd_archive_filename (input_bfd), r_type);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- case IMAGE_REL_PPC_TOCREL16:
- {
- bfd_signed_vma our_toc_offset;
- int fixit;
-
- DUMP_RELOC2(howto->name, rel);
-
- if (toc_section == 0)
- {
- toc_section = bfd_get_section_by_name (bfd_of_toc_owner,
- TOC_SECTION_NAME);
-
- if ( toc_section == NULL )
- {
- /* There is no toc section. Something is very wrong. */
- abort ();
- }
- }
-
- /* Amazing bit tricks present. As we may have seen earlier, we
- use the 1 bit to tell us whether or not a toc offset has been
- allocated. Now that they've all been allocated, we will use
- the 1 bit to tell us if we've written this particular toc
- entry out. */
- fixit = FALSE;
- if (h == 0)
- {
- /* It is a file local symbol. */
- int *local_toc_table;
- const char *name;
-
- sym = syms + symndx;
- name = sym->_n._n_name;
-
- local_toc_table = obj_coff_local_toc_table(input_bfd);
- our_toc_offset = local_toc_table[symndx];
-
- if (IS_WRITTEN(our_toc_offset))
- {
- /* If it has been written out, it is marked with the
- 1 bit. Fix up our offset, but do not write it out
- again. */
- MAKE_ADDR_AGAIN(our_toc_offset);
- }
- else
- {
- /* Write out the toc entry. */
- record_toc (toc_section, our_toc_offset, priv,
- strdup (name));
-
- bfd_put_32 (output_bfd, val,
- toc_section->contents + our_toc_offset);
-
- MARK_AS_WRITTEN(local_toc_table[symndx]);
- fixit = TRUE;
- }
- }
- else
- {
- const char *name = h->root.root.root.string;
- our_toc_offset = h->toc_offset;
-
- if ((r_flags & IMAGE_REL_PPC_TOCDEFN)
- == IMAGE_REL_PPC_TOCDEFN )
- {
- /* This is unbelievable cheese. Some knowledgable asm
- hacker has decided to use r2 as a base for loading
- a value. He/She does this by setting the tocdefn bit,
- and not supplying a toc definition. The behaviour is
- then to use the difference between the value of the
- symbol and the actual location of the toc as the toc
- index.
-
- In fact, what is usually happening is, because the
- Import Address Table is mapped immediately following
- the toc, some trippy library code trying for speed on
- dll linkage, takes advantage of that and considers
- 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);
-
- /* The size must still fit in a 16-bit displacement. */
- if ((bfd_vma) our_toc_offset >= 65535)
- {
- (*_bfd_error_handler)
- (_("%s: Relocation for %s of %lx exceeds Toc size limit"),
- bfd_archive_filename (input_bfd), name,
- (unsigned long) our_toc_offset);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- record_toc (toc_section, our_toc_offset, pub,
- strdup (name));
- }
- else if (IS_WRITTEN (our_toc_offset))
- {
- /* If it has been written out, it is marked with the
- 1 bit. Fix up our offset, but do not write it out
- again. */
- MAKE_ADDR_AGAIN(our_toc_offset);
- }
- else
- {
- record_toc(toc_section, our_toc_offset, pub,
- strdup (name));
-
- /* Write out the toc entry. */
- bfd_put_32 (output_bfd, val,
- toc_section->contents + our_toc_offset);
-
- MARK_AS_WRITTEN(h->toc_offset);
- /* The tricky part is that this is the address that
- needs a .reloc entry for it. */
- fixit = TRUE;
- }
- }
-
- if (fixit && info->base_file)
- {
- /* So if this is non pcrelative, and is referenced
- to a section or a common symbol, then it needs a reloc. */
-
- /* Relocation to a symbol in a section which
- 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);
-
- if (coff_data (output_bfd)->pe)
- addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
-
- fwrite (&addr, 1,4, (FILE *) info->base_file);
- }
-
- /* FIXME: this test is conservative. */
- 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 (%lx)"),
- bfd_archive_filename (input_bfd),
- (unsigned long) toc_section->_raw_size);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- /* Now we know the relocation for this toc reference. */
- relocation = our_toc_offset + TOC_LOAD_ADJUSTMENT;
- rstat = _bfd_relocate_contents (howto, input_bfd, relocation, loc);
- }
- break;
- case IMAGE_REL_PPC_IFGLUE:
- {
- /* To solve this, we need to know whether or not the symbol
- appearing on the call instruction is a glue function or not.
- A glue function must announce itself via a IMGLUE reloc, and
- the reloc contains the required toc restore instruction. */
- bfd_vma x;
- const char *my_name;
-
- DUMP_RELOC2 (howto->name, rel);
-
- if (h != 0)
- {
- my_name = h->root.root.root.string;
- if (h->symbol_is_glue == 1)
- {
- x = bfd_get_32 (input_bfd, loc);
- bfd_put_32 (input_bfd, (bfd_vma) h->glue_insn, loc);
- }
- }
- }
- break;
- case IMAGE_REL_PPC_SECREL:
- /* Unimplemented: codeview debugging information. */
- /* For fast access to the header of the section
- containing the item. */
- break;
- case IMAGE_REL_PPC_SECTION:
- /* Unimplemented: codeview debugging information. */
- /* Is used to indicate that the value should be relative
- to the beginning of the section that contains the
- symbol. */
- break;
- case IMAGE_REL_PPC_ABSOLUTE:
- {
- const char *my_name;
-
- if (h == 0)
- my_name = (syms+symndx)->_n._n_name;
- else
- my_name = h->root.root.root.string;
-
- fprintf (stderr,
- _("Warning: unsupported reloc %s <file %s, section %s>\n"),
- howto->name,
- bfd_archive_filename(input_bfd),
- input_section->name);
-
- fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
- rel->r_symndx, my_name, (long) rel->r_vaddr,
- (unsigned long) rel->r_vaddr);
- }
- break;
- case IMAGE_REL_PPC_IMGLUE:
- {
- /* There is nothing to do now. This reloc was noted in the first
- pass over the relocs, and the glue instruction extracted. */
- const char *my_name;
-
- if (h->symbol_is_glue == 1)
- break;
- my_name = h->root.root.root.string;
-
- (*_bfd_error_handler)
- (_("%s: Out of order IMGLUE reloc for %s"),
- bfd_archive_filename (input_bfd), my_name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- case IMAGE_REL_PPC_ADDR32NB:
- {
- const char *name = 0;
-
- DUMP_RELOC2 (howto->name, rel);
-
- if (strncmp(".idata$2",input_section->name,8) == 0 && first_thunk_address == 0)
- {
- /* Set magic values. */
- int idata5offset;
- struct coff_link_hash_entry *myh;
-
- myh = coff_link_hash_lookup (coff_hash_table (info),
- "__idata5_magic__",
- FALSE, FALSE, TRUE);
- first_thunk_address = myh->root.u.def.value +
- sec->output_section->vma +
- sec->output_offset -
- pe_data(output_bfd)->pe_opthdr.ImageBase;
-
- idata5offset = myh->root.u.def.value;
- myh = coff_link_hash_lookup (coff_hash_table (info),
- "__idata6_magic__",
- FALSE, FALSE, TRUE);
-
- thunk_size = myh->root.u.def.value - idata5offset;
- myh = coff_link_hash_lookup (coff_hash_table (info),
- "__idata4_magic__",
- FALSE, FALSE, TRUE);
- import_table_size = myh->root.u.def.value;
- }
-
- if (h == 0)
- {
- /* It is a file local symbol. */
- sym = syms + symndx;
- name = sym->_n._n_name;
- }
- else
- {
- char *target = 0;
-
- name = h->root.root.root.string;
- if (strcmp (".idata$2", name) == 0)
- target = "__idata2_magic__";
- else if (strcmp (".idata$4", name) == 0)
- target = "__idata4_magic__";
- else if (strcmp (".idata$5", name) == 0)
- target = "__idata5_magic__";
-
- if (target != 0)
- {
- struct coff_link_hash_entry *myh;
-
- myh = coff_link_hash_lookup (coff_hash_table (info),
- target,
- FALSE, FALSE, TRUE);
- if (myh == 0)
- {
- /* Missing magic cookies. Something is very wrong. */
- abort ();
- }
-
- val = myh->root.u.def.value +
- sec->output_section->vma + sec->output_offset;
- if (first_thunk_address == 0)
- {
- int idata5offset;
- myh = coff_link_hash_lookup (coff_hash_table (info),
- "__idata5_magic__",
- FALSE, FALSE, TRUE);
- first_thunk_address = myh->root.u.def.value +
- sec->output_section->vma +
- sec->output_offset -
- pe_data(output_bfd)->pe_opthdr.ImageBase;
-
- idata5offset = myh->root.u.def.value;
- myh = coff_link_hash_lookup (coff_hash_table (info),
- "__idata6_magic__",
- FALSE, FALSE, TRUE);
-
- thunk_size = myh->root.u.def.value - idata5offset;
- myh = coff_link_hash_lookup (coff_hash_table (info),
- "__idata4_magic__",
- FALSE, FALSE, TRUE);
- import_table_size = myh->root.u.def.value;
- }
- }
- }
-
- rstat = _bfd_relocate_contents (howto,
- input_bfd,
- val -
- pe_data (output_bfd)->pe_opthdr.ImageBase,
- loc);
- }
- break;
-
- case IMAGE_REL_PPC_REL24:
- DUMP_RELOC2(howto->name, rel);
- val -= (input_section->output_section->vma
- + input_section->output_offset);
-
- rstat = _bfd_relocate_contents (howto,
- input_bfd,
- val,
- loc);
- break;
- case IMAGE_REL_PPC_ADDR16:
- case IMAGE_REL_PPC_ADDR24:
- case IMAGE_REL_PPC_ADDR32:
- DUMP_RELOC2(howto->name, rel);
- rstat = _bfd_relocate_contents (howto,
- input_bfd,
- val,
- loc);
- break;
- }
-
- if (info->base_file)
- {
- /* So if this is non pcrelative, and is referenced
- to a section or a common symbol, then it needs a reloc. */
- if (sym && pe_data(output_bfd)->in_reloc_p (output_bfd, howto))
- {
- /* Relocation to a symbol in a section which
- isn't absolute - we output the address here
- to a file. */
- bfd_vma addr = rel->r_vaddr
- - input_section->vma
- + input_section->output_offset
- + input_section->output_section->vma;
-
- if (coff_data (output_bfd)->pe)
- addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
-
- fwrite (&addr, 1,4, (FILE *) info->base_file);
- }
- }
-
- switch (rstat)
- {
- default:
- abort ();
- case bfd_reloc_ok:
- break;
- case bfd_reloc_overflow:
- {
- const char *name;
- char buf[SYMNMLEN + 1];
-
- if (symndx == -1)
- name = "*ABS*";
- else if (h != NULL)
- name = h->root.root.root.string;
- else if (sym == NULL)
- name = "*unknown*";
- else if (sym->_n._n_n._n_zeroes == 0
- && sym->_n._n_n._n_offset != 0)
- name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
- else
- {
- strncpy (buf, sym->_n._n_name, SYMNMLEN);
- buf[SYMNMLEN] = '\0';
- name = buf;
- }
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name,
- (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-#ifdef COFF_IMAGE_WITH_PE
-
-/* FIXME: BFD should not use global variables. This file is compiled
- twice, and these variables are shared. This is confusing and
- weird. */
-
-long int global_toc_size = 4;
-
-bfd* bfd_of_toc_owner = 0;
-
-long int import_table_size;
-long int first_thunk_address;
-long int thunk_size;
-
-struct list_ele *head;
-struct list_ele *tail;
-
-static char *
-h1 = N_("\n\t\t\tTOC MAPPING\n\n");
-static char *
-h2 = N_(" TOC disassembly Comments Name\n");
-static char *
-h3 = N_(" Offset spelling (if present)\n");
-
-void
-dump_toc (vfile)
- PTR vfile;
-{
- FILE *file = (FILE *) vfile;
- struct list_ele *t;
-
- fprintf (file, _(h1));
- fprintf (file, _(h2));
- fprintf (file, _(h3));
-
- for (t = head; t != 0; t=t->next)
- {
- const char *cat = "";
-
- if (t->cat == priv)
- cat = _("private ");
- else if (t->cat == pub)
- cat = _("public ");
- else if (t->cat == tocdata)
- cat = _("data-in-toc ");
-
- if (t->offset > global_toc_size)
- {
- if (t->offset <= global_toc_size + thunk_size)
- cat = _("IAT reference ");
- else
- {
- fprintf (file,
- _("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"),
- global_toc_size, global_toc_size,
- thunk_size, thunk_size);
- cat = _("Out of bounds!");
- }
- }
-
- fprintf (file,
- " %04lx (%d)", (unsigned long) t->offset, t->offset - 32768);
- fprintf (file,
- " %s %s\n",
- cat, t->name);
-
- }
-
- fprintf (file, "\n");
-}
-
-bfd_boolean
-ppc_allocate_toc_section (info)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
-{
- 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? */
- return TRUE;
-
- if (bfd_of_toc_owner == 0)
- /* No toc owner? Something is very wrong. */
- abort ();
-
- s = bfd_get_section_by_name ( bfd_of_toc_owner , TOC_SECTION_NAME);
- if (s == NULL)
- /* No toc section? Something is very wrong. */
- abort ();
-
- 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;
-
- return TRUE;
-}
-
-bfd_boolean
-ppc_process_before_allocation (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- asection *sec;
- struct internal_reloc *i, *rel;
-
- /* Here we have a bfd that is to be included on the link. We have a hook
- to do reloc rummaging, before section sizes are nailed down. */
- _bfd_coff_get_external_symbols (abfd);
-
- /* Rummage around all the relocs and map the toc. */
- sec = abfd->sections;
-
- if (sec == 0)
- return TRUE;
-
- for (; sec != 0; sec = sec->next)
- {
- if (sec->reloc_count == 0)
- continue;
-
- /* load the relocs */
- /* FIXME: there may be a storage leak here */
- i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
-
- if (i == 0)
- abort ();
-
- for (rel = i; rel < i + sec->reloc_count; ++rel)
- {
- unsigned short r_type = EXTRACT_TYPE (rel->r_type);
- unsigned short r_flags = EXTRACT_FLAGS (rel->r_type);
- bfd_boolean ok = TRUE;
-
- DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, rel);
-
- switch(r_type)
- {
- case IMAGE_REL_PPC_TOCREL16:
- /* If TOCDEFN is on, ignore as someone else has allocated the
- toc entry. */
- if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN)
- ok = ppc_record_toc_entry(abfd, info, sec,
- rel->r_symndx, default_toc);
- if (!ok)
- return FALSE;
- break;
- case IMAGE_REL_PPC_IMGLUE:
- ppc_mark_symbol_as_glue (abfd, rel->r_symndx, rel);
- break;
- default:
- break;
- }
- }
- }
-
- return TRUE;
-}
-
-#endif
-
-static bfd_reloc_status_type
-ppc_refhi_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- UN_IMPL("REFHI");
- DUMP_RELOC("REFHI",reloc_entry);
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- return bfd_reloc_undefined;
-}
-
-#if 0
-
-static bfd_reloc_status_type
-ppc_reflo_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- UN_IMPL("REFLO");
- DUMP_RELOC("REFLO",reloc_entry);
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- return bfd_reloc_undefined;
-}
-
-#endif
-
-static bfd_reloc_status_type
-ppc_pair_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- UN_IMPL("PAIR");
- DUMP_RELOC("PAIR",reloc_entry);
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- return bfd_reloc_undefined;
-}
-
-static bfd_reloc_status_type
-ppc_toc16_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- UN_IMPL ("TOCREL16");
- DUMP_RELOC ("TOCREL16",reloc_entry);
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- return bfd_reloc_ok;
-}
-
-#if 0
-
-/* ADDR32NB : 32 bit address relative to the virtual origin.
- (On the alpha, this is always a linker generated thunk)
- (i.e. 32bit addr relative to the image base). */
-
-static bfd_reloc_status_type
-ppc_addr32nb_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- UN_IMPL("ADDR32NB");
- DUMP_RELOC("ADDR32NB",reloc_entry);
-
- return bfd_reloc_ok;
-}
-
-#endif
-
-static bfd_reloc_status_type
-ppc_secrel_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- UN_IMPL("SECREL");
- DUMP_RELOC("SECREL",reloc_entry);
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- return bfd_reloc_ok;
-}
-
-static bfd_reloc_status_type
-ppc_section_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- UN_IMPL("SECTION");
- DUMP_RELOC("SECTION",reloc_entry);
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- return bfd_reloc_ok;
-}
-
-static bfd_reloc_status_type
-ppc_imglue_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- UN_IMPL("IMGLUE");
- DUMP_RELOC("IMGLUE",reloc_entry);
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- return bfd_reloc_ok;
-}
-
-#define MAX_RELOC_INDEX \
- (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
-
-/* FIXME: There is a possibility that when we read in a reloc from a file,
- that there are some bits encoded in the upper portion of the
- type field. Not yet implemented. */
-static void ppc_coff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
-
-static void
-ppc_coff_rtype2howto (relent, internal)
- arelent *relent;
- struct internal_reloc *internal;
-{
- /* We can encode one of three things in the type field, aside from the
- type:
- 1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
- value, rather than an addition value
- 2. IMAGE_REL_PPC_BRTAKEN, IMAGE_REL_PPC_BRNTAKEN - indicates that
- the branch is expected to be taken or not.
- 3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
- For now, we just strip this stuff to find the type, and ignore it other
- than that. */
- reloc_howto_type *howto;
- unsigned short r_type = EXTRACT_TYPE (internal->r_type);
- unsigned short r_flags = EXTRACT_FLAGS(internal->r_type);
- unsigned short junk = EXTRACT_JUNK (internal->r_type);
-
- /* The masking process only slices off the bottom byte for r_type. */
- if ( r_type > MAX_RELOC_INDEX )
- abort ();
-
- /* Check for absolute crap. */
- if (junk != 0)
- abort ();
-
- switch(r_type)
- {
- case IMAGE_REL_PPC_ADDR16:
- case IMAGE_REL_PPC_REL24:
- case IMAGE_REL_PPC_ADDR24:
- case IMAGE_REL_PPC_ADDR32:
- case IMAGE_REL_PPC_IFGLUE:
- case IMAGE_REL_PPC_ADDR32NB:
- case IMAGE_REL_PPC_SECTION:
- case IMAGE_REL_PPC_SECREL:
- DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
- howto = ppc_coff_howto_table + r_type;
- break;
- case IMAGE_REL_PPC_IMGLUE:
- DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
- howto = ppc_coff_howto_table + r_type;
- break;
- case IMAGE_REL_PPC_TOCREL16:
- DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
- if (r_flags & IMAGE_REL_PPC_TOCDEFN)
- howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16_DEFN;
- else
- howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16;
- break;
- default:
- fprintf (stderr,
- _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
- ppc_coff_howto_table[r_type].name,
- r_type);
- howto = ppc_coff_howto_table + r_type;
- break;
- }
-
- relent->howto = howto;
-}
-
-static reloc_howto_type *
-coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- bfd_vma *addendp;
-{
- reloc_howto_type *howto;
-
- /* We can encode one of three things in the type field, aside from the
- type:
- 1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
- value, rather than an addition value
- 2. IMAGE_REL_PPC_BRTAKEN, IMAGE_REL_PPC_BRNTAKEN - indicates that
- the branch is expected to be taken or not.
- 3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
- For now, we just strip this stuff to find the type, and ignore it other
- than that. */
-
- unsigned short r_type = EXTRACT_TYPE (rel->r_type);
- unsigned short r_flags = EXTRACT_FLAGS (rel->r_type);
- unsigned short junk = EXTRACT_JUNK (rel->r_type);
-
- /* The masking process only slices off the bottom byte for r_type. */
- if (r_type > MAX_RELOC_INDEX)
- abort ();
-
- /* Check for absolute crap. */
- if (junk != 0)
- abort ();
-
- switch(r_type)
- {
- case IMAGE_REL_PPC_ADDR32NB:
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
- *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
- howto = ppc_coff_howto_table + r_type;
- break;
- case IMAGE_REL_PPC_TOCREL16:
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
- if (r_flags & IMAGE_REL_PPC_TOCDEFN)
- howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16_DEFN;
- else
- howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16;
- break;
- case IMAGE_REL_PPC_ADDR16:
- case IMAGE_REL_PPC_REL24:
- case IMAGE_REL_PPC_ADDR24:
- case IMAGE_REL_PPC_ADDR32:
- case IMAGE_REL_PPC_IFGLUE:
- case IMAGE_REL_PPC_SECTION:
- case IMAGE_REL_PPC_SECREL:
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
- howto = ppc_coff_howto_table + r_type;
- break;
- case IMAGE_REL_PPC_IMGLUE:
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
- howto = ppc_coff_howto_table + r_type;
- break;
- default:
- fprintf (stderr,
- _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
- ppc_coff_howto_table[r_type].name,
- r_type);
- howto = ppc_coff_howto_table + r_type;
- break;
- }
-
- return howto;
-}
-
-/* A cheesy little macro to make the code a little more readable. */
-#define HOW2MAP(bfd_rtype,ppc_rtype) \
- case bfd_rtype: return &ppc_coff_howto_table[ppc_rtype]
-
-static reloc_howto_type *ppc_coff_reloc_type_lookup
-PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-static reloc_howto_type *
-ppc_coff_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- HOW2MAP(BFD_RELOC_32_GOTOFF, IMAGE_REL_PPC_IMGLUE);
- HOW2MAP(BFD_RELOC_16_GOT_PCREL, IMAGE_REL_PPC_IFGLUE);
- HOW2MAP(BFD_RELOC_16, IMAGE_REL_PPC_ADDR16);
- HOW2MAP(BFD_RELOC_PPC_B26, IMAGE_REL_PPC_REL24);
- HOW2MAP(BFD_RELOC_PPC_BA26, IMAGE_REL_PPC_ADDR24);
- HOW2MAP(BFD_RELOC_PPC_TOC16, IMAGE_REL_PPC_TOCREL16);
- HOW2MAP(BFD_RELOC_16_GOTOFF, IMAGE_REL_PPC_TOCREL16_DEFN);
- HOW2MAP(BFD_RELOC_32, IMAGE_REL_PPC_ADDR32);
- HOW2MAP(BFD_RELOC_RVA, IMAGE_REL_PPC_ADDR32NB);
- default:
- return NULL;
- }
-}
-
-#undef HOW2MAP
-
-/* Tailor coffcode.h -- macro heaven. */
-
-#define RTYPE2HOWTO(cache_ptr, dst) ppc_coff_rtype2howto (cache_ptr, dst)
-
-/* We use the special COFF backend linker, with our own special touch. */
-
-#define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup
-#define coff_rtype_to_howto coff_ppc_rtype_to_howto
-#define coff_relocate_section coff_ppc_relocate_section
-#define coff_bfd_final_link ppc_bfd_coff_final_link
-
-#ifndef COFF_IMAGE_WITH_PE
-/* FIXME: This no longer works. */
-#if 0
-#define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook
-#endif
-#endif
-
-#define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;}
-
-#define COFF_PAGE_SIZE 0x1000
-
-/* FIXME: This controls some code that used to be in peicode.h and is
- now in peigen.c. It will not control the code in peigen.c. If
- anybody wants to get this working, you will need to fix that. */
-#define POWERPC_LE_PE
-
-#define COFF_SECTION_ALIGNMENT_ENTRIES \
-{ COFF_SECTION_NAME_EXACT_MATCH (".idata$2"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".idata$3"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".idata$4"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".idata$5"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".idata$6"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 1 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".reloc"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 1 }
-
-#include "coffcode.h"
-
-#ifndef COFF_IMAGE_WITH_PE
-/* FIXME: This no longer works. */
-#if 0
-/* FIXME:
- What we're trying to do here is allocate a toc section (early), and attach
- it to the last bfd to be processed. This avoids the problem of having a toc
- written out before all files have been processed. This code allocates
- a toc section for every file, and records the last one seen. There are
- at least two problems with this approach:
- 1. We allocate whole bunches of toc sections that are ignored, but at
- at least we will not allocate a toc if no .toc is present.
- 2. It's not clear to me that being the last bfd read necessarily means
- that you are the last bfd closed.
- 3. Doing it on a "swap in" hook depends on when the "swap in" is called,
- and how often, etc. It's not clear to me that there isn't a hole here. */
-static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
-
-static void
-ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1 ATTRIBUTE_UNUSED;
- PTR in1;
-{
- struct internal_syment * in = (struct internal_syment *)in1;
-
- if (bfd_of_toc_owner != 0) /* We already have a toc, so go home. */
- return;
-
- if (strcmp (in->_n._n_name, ".toc") == 0)
- {
- flagword flags;
- register asection *s;
-
- s = bfd_get_section_by_name (abfd, TOC_SECTION_NAME);
- if (s != NULL)
- return;
-
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ;
-
- s = bfd_make_section (abfd, TOC_SECTION_NAME);
-
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, flags)
- || !bfd_set_section_alignment (abfd, s, 2))
- /* FIXME: set appropriate bfd error. */
- abort ();
-
- /* Save the bfd for later allocation. */
- bfd_of_toc_owner = abfd;
- }
-
- return;
-}
-#endif
-#endif
-
-#ifndef COFF_IMAGE_WITH_PE
-
-static bfd_boolean ppc_do_last PARAMS ((bfd *));
-static bfd *ppc_get_last PARAMS ((void));
-
-static bfd_boolean
-ppc_do_last (abfd)
- bfd *abfd;
-{
- if (abfd == bfd_of_toc_owner)
- return TRUE;
- else
- return FALSE;
-}
-
-static bfd *
-ppc_get_last()
-{
- return bfd_of_toc_owner;
-}
-
-/* This piece of machinery exists only to guarantee that the bfd that holds
- the toc section is written last.
-
- This does depend on bfd_make_section attaching a new section to the
- end of the section list for the bfd.
-
- This is otherwise intended to be functionally the same as
- cofflink.c:_bfd_coff_final_link(). It is specifically different only
- where the POWERPC_LE_PE macro modifies the code. It is left in as a
- precise form of comment. krk@cygnus.com */
-
-/* Do the final link step. */
-
-bfd_boolean
-ppc_bfd_coff_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- bfd_size_type symesz;
- struct coff_final_link_info finfo;
- bfd_boolean debug_merge_allocated;
- asection *o;
- struct bfd_link_order *p;
- 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;
- unsigned int linesz;
- bfd *sub;
- bfd_byte *external_relocs = NULL;
- char strbuf[STRING_SIZE_SIZE];
- bfd_size_type amt;
-
- symesz = bfd_coff_symesz (abfd);
-
- finfo.info = info;
- finfo.output_bfd = abfd;
- finfo.strtab = NULL;
- finfo.section_info = NULL;
- finfo.last_file_index = -1;
- finfo.last_bf_index = -1;
- finfo.internal_syms = NULL;
- finfo.sec_ptrs = NULL;
- finfo.sym_indices = NULL;
- finfo.outsyms = NULL;
- finfo.linenos = NULL;
- finfo.contents = NULL;
- finfo.external_relocs = NULL;
- finfo.internal_relocs = NULL;
- debug_merge_allocated = FALSE;
-
- coff_data (abfd)->link_info = info;
-
- finfo.strtab = _bfd_stringtab_init ();
- if (finfo.strtab == NULL)
- goto error_return;
-
- if (! coff_debug_merge_hash_table_init (&finfo.debug_merge))
- goto error_return;
- debug_merge_allocated = TRUE;
-
- /* Compute the file positions for all the sections. */
- if (! abfd->output_has_begun)
- {
- if (! bfd_coff_compute_section_file_positions (abfd))
- return FALSE;
- }
-
- /* Count the line numbers and relocation entries required for the
- output file. Set the file positions for the relocs. */
- rel_filepos = obj_relocbase (abfd);
- relsz = bfd_coff_relsz (abfd);
- max_contents_size = 0;
- max_lineno_count = 0;
- max_reloc_count = 0;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- o->reloc_count = 0;
- o->lineno_count = 0;
-
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order)
- {
- asection *sec;
-
- sec = p->u.indirect.section;
-
- /* Mark all sections which are to be included in the
- link. This will normally be every section. We need
- to do this so that we can identify any sections which
- the linker has decided to not include. */
- sec->linker_mark = TRUE;
-
- if (info->strip == strip_none
- || info->strip == strip_some)
- o->lineno_count += sec->lineno_count;
-
- if (info->relocatable)
- o->reloc_count += sec->reloc_count;
-
- if (sec->_raw_size > max_contents_size)
- max_contents_size = sec->_raw_size;
- if (sec->lineno_count > max_lineno_count)
- max_lineno_count = sec->lineno_count;
- if (sec->reloc_count > max_reloc_count)
- max_reloc_count = sec->reloc_count;
- }
- else if (info->relocatable
- && (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order))
- ++o->reloc_count;
- }
- if (o->reloc_count == 0)
- o->rel_filepos = 0;
- else
- {
- o->flags |= SEC_RELOC;
- o->rel_filepos = rel_filepos;
- rel_filepos += o->reloc_count * relsz;
- }
- }
-
- /* If doing a relocatable link, allocate space for the pointers we
- need to keep. */
- if (info->relocatable)
- {
- unsigned int i;
-
- /* We use section_count + 1, rather than section_count, because
- the target_index fields are 1 based. */
- 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++)
- {
- finfo.section_info[i].relocs = NULL;
- finfo.section_info[i].rel_hashes = NULL;
- }
- }
-
- /* We now know the size of the relocs, so we can determine the file
- positions of the line numbers. */
- line_filepos = rel_filepos;
- linesz = bfd_coff_linesz (abfd);
- max_output_reloc_count = 0;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (o->lineno_count == 0)
- o->line_filepos = 0;
- else
- {
- o->line_filepos = line_filepos;
- line_filepos += o->lineno_count * linesz;
- }
-
- if (o->reloc_count != 0)
- {
- /* We don't know the indices of global symbols until we have
- written out all the local symbols. For each section in
- the output file, we keep an array of pointers to hash
- table entries. Each entry in the array corresponds to a
- reloc. When we find a reloc against a global symbol, we
- set the corresponding entry in this array so that we can
- fix up the symbol index after we have written out all the
- local symbols.
-
- Because of this problem, we also keep the relocs in
- memory until the end of the link. This wastes memory,
- but only when doing a relocatable link, which is not the
- common case. */
- BFD_ASSERT (info->relocatable);
- amt = o->reloc_count;
- amt *= sizeof (struct internal_reloc);
- finfo.section_info[o->target_index].relocs =
- (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 (amt);
- if (finfo.section_info[o->target_index].relocs == NULL
- || finfo.section_info[o->target_index].rel_hashes == NULL)
- goto error_return;
-
- if (o->reloc_count > max_output_reloc_count)
- max_output_reloc_count = o->reloc_count;
- }
-
- /* Reset the reloc and lineno counts, so that we can use them to
- count the number of entries we have output so far. */
- o->reloc_count = 0;
- o->lineno_count = 0;
- }
-
- obj_sym_filepos (abfd) = line_filepos;
-
- /* Figure out the largest number of symbols in an input BFD. Take
- the opportunity to clear the output_has_begun fields of all the
- input BFD's. */
- max_sym_count = 0;
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- bfd_size_type sz;
-
- sub->output_has_begun = FALSE;
- sz = obj_raw_syment_count (sub);
- if (sz > max_sym_count)
- max_sym_count = sz;
- }
-
- /* Allocate some buffers used while linking. */
- 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->relocatable)
- {
- 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)
- || finfo.outsyms == NULL
- || (finfo.linenos == NULL && max_lineno_count > 0)
- || (finfo.contents == NULL && max_contents_size > 0)
- || (finfo.external_relocs == NULL && max_reloc_count > 0)
- || (! info->relocatable
- && finfo.internal_relocs == NULL
- && max_reloc_count > 0))
- goto error_return;
-
- /* We now know the position of everything in the file, except that
- we don't know the size of the symbol table and therefore we don't
- know where the string table starts. We just build the string
- table in memory as we go along. We process all the relocations
- for a single input file at once. */
- obj_raw_syment_count (abfd) = 0;
-
- if (coff_backend_info (abfd)->_bfd_coff_start_final_link)
- {
- if (! bfd_coff_start_final_link (abfd, info))
- goto error_return;
- }
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order
- && (bfd_get_flavour (p->u.indirect.section->owner)
- == bfd_target_coff_flavour))
- {
- sub = p->u.indirect.section->owner;
-#ifdef POWERPC_LE_PE
- if (! sub->output_has_begun && !ppc_do_last(sub))
-#else
- if (! sub->output_has_begun)
-#endif
- {
- if (! _bfd_coff_link_input_bfd (&finfo, sub))
- goto error_return;
- sub->output_has_begun = TRUE;
- }
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- if (! _bfd_coff_reloc_link_order (abfd, &finfo, o, p))
- goto error_return;
- }
- else
- {
- if (! _bfd_default_link_order (abfd, info, o, p))
- goto error_return;
- }
- }
- }
-
-#ifdef POWERPC_LE_PE
- {
- bfd* last_one = ppc_get_last();
- if (last_one)
- {
- if (! _bfd_coff_link_input_bfd (&finfo, last_one))
- goto error_return;
- }
- last_one->output_has_begun = TRUE;
- }
-#endif
-
- /* Free up the buffers used by _bfd_coff_link_input_bfd. */
- coff_debug_merge_hash_table_free (&finfo.debug_merge);
- debug_merge_allocated = FALSE;
-
- if (finfo.internal_syms != NULL)
- {
- free (finfo.internal_syms);
- finfo.internal_syms = NULL;
- }
- if (finfo.sec_ptrs != NULL)
- {
- free (finfo.sec_ptrs);
- finfo.sec_ptrs = NULL;
- }
- if (finfo.sym_indices != NULL)
- {
- free (finfo.sym_indices);
- finfo.sym_indices = NULL;
- }
- if (finfo.linenos != NULL)
- {
- free (finfo.linenos);
- finfo.linenos = NULL;
- }
- if (finfo.contents != NULL)
- {
- free (finfo.contents);
- finfo.contents = NULL;
- }
- if (finfo.external_relocs != NULL)
- {
- free (finfo.external_relocs);
- finfo.external_relocs = NULL;
- }
- if (finfo.internal_relocs != NULL)
- {
- free (finfo.internal_relocs);
- finfo.internal_relocs = NULL;
- }
-
- /* The value of the last C_FILE symbol is supposed to be the symbol
- index of the first external symbol. Write it out again if
- necessary. */
- 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);
- 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;
- }
-
- /* Write out the global symbols. */
- finfo.failed = FALSE;
- coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_global_sym,
- (PTR) &finfo);
- if (finfo.failed)
- goto error_return;
-
- /* The outsyms buffer is used by _bfd_coff_write_global_sym. */
- if (finfo.outsyms != NULL)
- {
- free (finfo.outsyms);
- finfo.outsyms = NULL;
- }
-
- if (info->relocatable)
- {
- /* 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. */
- amt = max_output_reloc_count * relsz;
- external_relocs = (bfd_byte *) bfd_malloc (amt);
- if (external_relocs == NULL)
- goto error_return;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct internal_reloc *irel;
- struct internal_reloc *irelend;
- struct coff_link_hash_entry **rel_hash;
- bfd_byte *erel;
-
- if (o->reloc_count == 0)
- continue;
-
- irel = finfo.section_info[o->target_index].relocs;
- irelend = irel + o->reloc_count;
- rel_hash = finfo.section_info[o->target_index].rel_hashes;
- erel = external_relocs;
- for (; irel < irelend; irel++, rel_hash++, erel += relsz)
- {
- if (*rel_hash != NULL)
- {
- BFD_ASSERT ((*rel_hash)->indx >= 0);
- irel->r_symndx = (*rel_hash)->indx;
- }
- 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_bwrite ((PTR) external_relocs, amt, abfd) != amt)
- goto error_return;
- }
-
- free (external_relocs);
- external_relocs = NULL;
- }
-
- /* Free up the section information. */
- if (finfo.section_info != NULL)
- {
- unsigned int i;
-
- for (i = 0; i < abfd->section_count; i++)
- {
- if (finfo.section_info[i].relocs != NULL)
- free (finfo.section_info[i].relocs);
- if (finfo.section_info[i].rel_hashes != NULL)
- free (finfo.section_info[i].rel_hashes);
- }
- free (finfo.section_info);
- finfo.section_info = NULL;
- }
-
- /* If we have optimized stabs strings, output them. */
- if (coff_hash_table (info)->stab_info != NULL)
- {
- if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
- return FALSE;
- }
-
- /* Write out the string table. */
- if (obj_raw_syment_count (abfd) != 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
- H_PUT_32 (abfd,
- _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
- strbuf);
-#else
- #error Change H_PUT_32 above
-#endif
-
- if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
- != STRING_SIZE_SIZE)
- return FALSE;
-
- if (! _bfd_stringtab_emit (abfd, finfo.strtab))
- return FALSE;
- }
-
- _bfd_stringtab_free (finfo.strtab);
-
- /* Setting bfd_get_symcount to 0 will cause write_object_contents to
- not try to write out the symbols. */
- bfd_get_symcount (abfd) = 0;
-
- return TRUE;
-
- error_return:
- if (debug_merge_allocated)
- coff_debug_merge_hash_table_free (&finfo.debug_merge);
- if (finfo.strtab != NULL)
- _bfd_stringtab_free (finfo.strtab);
- if (finfo.section_info != NULL)
- {
- unsigned int i;
-
- for (i = 0; i < abfd->section_count; i++)
- {
- if (finfo.section_info[i].relocs != NULL)
- free (finfo.section_info[i].relocs);
- if (finfo.section_info[i].rel_hashes != NULL)
- free (finfo.section_info[i].rel_hashes);
- }
- free (finfo.section_info);
- }
- if (finfo.internal_syms != NULL)
- free (finfo.internal_syms);
- if (finfo.sec_ptrs != NULL)
- free (finfo.sec_ptrs);
- if (finfo.sym_indices != NULL)
- free (finfo.sym_indices);
- if (finfo.outsyms != NULL)
- free (finfo.outsyms);
- if (finfo.linenos != NULL)
- free (finfo.linenos);
- if (finfo.contents != NULL)
- free (finfo.contents);
- if (finfo.external_relocs != NULL)
- free (finfo.external_relocs);
- if (finfo.internal_relocs != NULL)
- free (finfo.internal_relocs);
- if (external_relocs != NULL)
- free (external_relocs);
- return FALSE;
-}
-#endif
-
-/* Forward declaration for use by alternative_target field. */
-#ifdef TARGET_BIG_SYM
-extern const bfd_target TARGET_BIG_SYM;
-#endif
-
-/* The transfer vectors that lead the outside world to all of the above. */
-
-#ifdef TARGET_LITTLE_SYM
-const bfd_target TARGET_LITTLE_SYM =
-{
- TARGET_LITTLE_NAME, /* name or coff-arm-little */
- bfd_target_coff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | EXEC_P | /* FIXME: object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-#ifndef COFF_WITH_PE
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-#else
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
- | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-#endif
-
- 0, /* leading char */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen??? FIXMEmgo */
-
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- bfd_generic_archive_p, /* _bfd_dummy_target */ coff_object_p },
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
- bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (coff),
- BFD_JUMP_TABLE_COPY (coff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
- BFD_JUMP_TABLE_SYMBOLS (coff),
- BFD_JUMP_TABLE_RELOCS (coff),
- BFD_JUMP_TABLE_WRITE (coff),
- BFD_JUMP_TABLE_LINK (coff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- /* Alternative_target. */
-#ifdef TARGET_BIG_SYM
- & TARGET_BIG_SYM,
-#else
- NULL,
-#endif
-
- COFF_SWAP_TABLE
-};
-#endif
-
-#ifdef TARGET_BIG_SYM
-const bfd_target TARGET_BIG_SYM =
-{
- TARGET_BIG_NAME,
- bfd_target_coff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | /* FIXME: object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-#ifndef COFF_WITH_PE
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-#else
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
- | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-#endif
-
- 0, /* leading char */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen??? FIXMEmgo */
-
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
-
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- bfd_generic_archive_p, /* _bfd_dummy_target */ coff_object_p },
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
- bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (coff),
- BFD_JUMP_TABLE_COPY (coff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
- BFD_JUMP_TABLE_SYMBOLS (coff),
- BFD_JUMP_TABLE_RELOCS (coff),
- BFD_JUMP_TABLE_WRITE (coff),
- BFD_JUMP_TABLE_LINK (coff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- /* Alternative_target. */
-#ifdef TARGET_LITTLE_SYM
- & TARGET_LITTLE_SYM,
-#else
- NULL,
-#endif
-
- COFF_SWAP_TABLE
-};
-
-#endif
diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c
deleted file mode 100644
index 56e34e2..0000000
--- a/contrib/binutils/bfd/coff-rs6000.c
+++ /dev/null
@@ -1,4453 +0,0 @@
-/* BFD back-end for IBM RS/6000 "XCOFF" files.
- Copyright 1990-1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- FIXME: Can someone provide a transliteration of this name into ASCII?
- Using the following chars caused a compiler warning on HIUX (so I replaced
- them with octal escapes), and isn't useful without an understanding of what
- character set it is.
- Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
- and John Gilmore.
- Archive support from Damon A. Permezel.
- Contributed by IBM Corporation and Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "coff/xcoff.h"
-#include "coff/rs6000.h"
-#include "libcoff.h"
-#include "libxcoff.h"
-
-extern bfd_boolean _bfd_xcoff_mkobject
- PARAMS ((bfd *));
-extern bfd_boolean _bfd_xcoff_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
-extern bfd_boolean _bfd_xcoff_is_local_label_name
- PARAMS ((bfd *, const char *));
-extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-extern bfd_boolean _bfd_xcoff_slurp_armap
- PARAMS ((bfd *));
-extern const bfd_target *_bfd_xcoff_archive_p
- PARAMS ((bfd *));
-extern PTR _bfd_xcoff_read_ar_hdr
- PARAMS ((bfd *));
-extern bfd *_bfd_xcoff_openr_next_archived_file
- PARAMS ((bfd *, bfd *));
-extern int _bfd_xcoff_stat_arch_elt
- PARAMS ((bfd *, struct stat *));
-extern bfd_boolean _bfd_xcoff_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-extern bfd_boolean _bfd_xcoff_write_archive_contents
- PARAMS ((bfd *));
-extern int _bfd_xcoff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-extern void _bfd_xcoff_swap_sym_in
- PARAMS ((bfd *, PTR, PTR));
-extern unsigned int _bfd_xcoff_swap_sym_out
- PARAMS ((bfd *, PTR, PTR));
-extern void _bfd_xcoff_swap_aux_in
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-extern unsigned int _bfd_xcoff_swap_aux_out
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static void xcoff_swap_reloc_in
- PARAMS ((bfd *, PTR, PTR));
-static unsigned int xcoff_swap_reloc_out
- PARAMS ((bfd *, PTR, PTR));
-
-/* Forward declare xcoff_rtype2howto for coffcode.h macro. */
-void xcoff_rtype2howto
- PARAMS ((arelent *, struct internal_reloc *));
-
-/* coffcode.h needs these to be defined. */
-#define RS6000COFF_C 1
-
-#define SELECT_RELOC(internal, howto) \
- { \
- internal.r_type = howto->type; \
- internal.r_size = \
- ((howto->complain_on_overflow == complain_overflow_signed \
- ? 0x80 \
- : 0) \
- | (howto->bitsize - 1)); \
- }
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
-#define COFF_LONG_FILENAMES
-#define NO_COFF_SYMBOLS
-#define RTYPE2HOWTO(cache_ptr, dst) xcoff_rtype2howto (cache_ptr, dst)
-#define coff_mkobject _bfd_xcoff_mkobject
-#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
-#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
-#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
-#ifdef AIX_CORE
-extern const bfd_target * rs6000coff_core_p
- PARAMS ((bfd *abfd));
-extern bfd_boolean rs6000coff_core_file_matches_executable_p
- PARAMS ((bfd *cbfd, bfd *ebfd));
-extern char *rs6000coff_core_file_failing_command
- PARAMS ((bfd *abfd));
-extern int rs6000coff_core_file_failing_signal
- PARAMS ((bfd *abfd));
-#define CORE_FILE_P rs6000coff_core_p
-#define coff_core_file_failing_command \
- rs6000coff_core_file_failing_command
-#define coff_core_file_failing_signal \
- rs6000coff_core_file_failing_signal
-#define coff_core_file_matches_executable_p \
- rs6000coff_core_file_matches_executable_p
-#else
-#define CORE_FILE_P _bfd_dummy_target
-#define coff_core_file_failing_command \
- _bfd_nocore_core_file_failing_command
-#define coff_core_file_failing_signal \
- _bfd_nocore_core_file_failing_signal
-#define coff_core_file_matches_executable_p \
- _bfd_nocore_core_file_matches_executable_p
-#endif
-#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
-#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
-#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
-#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
-#define coff_swap_reloc_in xcoff_swap_reloc_in
-#define coff_swap_reloc_out xcoff_swap_reloc_out
-#define NO_COFF_RELOCS
-
-#include "coffcode.h"
-
-/* The main body of code is in coffcode.h. */
-
-static const char *normalize_filename
- PARAMS ((bfd *));
-static bfd_boolean xcoff_write_armap_old
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-static bfd_boolean xcoff_write_armap_big
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-static bfd_boolean xcoff_write_archive_contents_old
- PARAMS ((bfd *));
-static bfd_boolean xcoff_write_archive_contents_big
- PARAMS ((bfd *));
-static void xcoff_swap_ldhdr_in
- PARAMS ((bfd *, const PTR, struct internal_ldhdr *));
-static void xcoff_swap_ldhdr_out
- PARAMS ((bfd *, const struct internal_ldhdr *, PTR));
-static void xcoff_swap_ldsym_in
- PARAMS ((bfd *, const PTR, struct internal_ldsym *));
-static void xcoff_swap_ldsym_out
- PARAMS ((bfd *, const struct internal_ldsym *, PTR));
-static void xcoff_swap_ldrel_in
- PARAMS ((bfd *, const PTR, struct internal_ldrel *));
-static void xcoff_swap_ldrel_out
- PARAMS ((bfd *, const struct internal_ldrel *, PTR));
-static bfd_boolean xcoff_ppc_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-static bfd_boolean _bfd_xcoff_put_ldsymbol_name
- PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
- const char *));
-static asection *xcoff_create_csect_from_smclas
- PARAMS ((bfd *, union internal_auxent *, const char *));
-static bfd_boolean xcoff_is_lineno_count_overflow
- PARAMS ((bfd *, bfd_vma));
-static bfd_boolean xcoff_is_reloc_count_overflow
- PARAMS ((bfd *, bfd_vma));
-static bfd_vma xcoff_loader_symbol_offset
- PARAMS ((bfd *, struct internal_ldhdr *));
-static bfd_vma xcoff_loader_reloc_offset
- PARAMS ((bfd *, struct internal_ldhdr *));
-static bfd_boolean xcoff_generate_rtinit
- PARAMS ((bfd *, const char *, const char *, bfd_boolean));
-static bfd_boolean do_pad
- PARAMS ((bfd *, unsigned int));
-static bfd_boolean do_copy
- PARAMS ((bfd *, bfd *));
-static bfd_boolean do_shared_object_padding
- PARAMS ((bfd *, bfd *, ufile_ptr *, int));
-
-/* Relocation functions */
-static bfd_boolean xcoff_reloc_type_br
- PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-
-static bfd_boolean xcoff_complain_overflow_dont_func
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-static bfd_boolean xcoff_complain_overflow_bitfield_func
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-static bfd_boolean xcoff_complain_overflow_signed_func
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-static bfd_boolean xcoff_complain_overflow_unsigned_func
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-
-bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
- PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)) =
-{
- xcoff_reloc_type_pos, /* R_POS (0x00) */
- xcoff_reloc_type_neg, /* R_NEG (0x01) */
- xcoff_reloc_type_rel, /* R_REL (0x02) */
- xcoff_reloc_type_toc, /* R_TOC (0x03) */
- xcoff_reloc_type_fail, /* R_RTB (0x04) */
- xcoff_reloc_type_toc, /* R_GL (0x05) */
- xcoff_reloc_type_toc, /* R_TCL (0x06) */
- xcoff_reloc_type_fail, /* (0x07) */
- xcoff_reloc_type_ba, /* R_BA (0x08) */
- xcoff_reloc_type_fail, /* (0x09) */
- xcoff_reloc_type_br, /* R_BR (0x0a) */
- xcoff_reloc_type_fail, /* (0x0b) */
- xcoff_reloc_type_pos, /* R_RL (0x0c) */
- xcoff_reloc_type_pos, /* R_RLA (0x0d) */
- xcoff_reloc_type_fail, /* (0x0e) */
- xcoff_reloc_type_noop, /* R_REF (0x0f) */
- xcoff_reloc_type_fail, /* (0x10) */
- xcoff_reloc_type_fail, /* (0x11) */
- xcoff_reloc_type_toc, /* R_TRL (0x12) */
- xcoff_reloc_type_toc, /* R_TRLA (0x13) */
- xcoff_reloc_type_fail, /* R_RRTBI (0x14) */
- xcoff_reloc_type_fail, /* R_RRTBA (0x15) */
- xcoff_reloc_type_ba, /* R_CAI (0x16) */
- xcoff_reloc_type_crel, /* R_CREL (0x17) */
- xcoff_reloc_type_ba, /* R_RBA (0x18) */
- xcoff_reloc_type_ba, /* R_RBAC (0x19) */
- xcoff_reloc_type_br, /* R_RBR (0x1a) */
- xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
-};
-
-bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS)) =
-{
- xcoff_complain_overflow_dont_func,
- xcoff_complain_overflow_bitfield_func,
- xcoff_complain_overflow_signed_func,
- xcoff_complain_overflow_unsigned_func,
-};
-
-/* We use our own tdata type. Its first field is the COFF tdata type,
- so the COFF routines are compatible. */
-
-bfd_boolean
-_bfd_xcoff_mkobject (abfd)
- bfd *abfd;
-{
- coff_data_type *coff;
- bfd_size_type amt = sizeof (struct xcoff_tdata);
-
- abfd->tdata.xcoff_obj_data = (struct xcoff_tdata *) bfd_zalloc (abfd, amt);
- if (abfd->tdata.xcoff_obj_data == NULL)
- return FALSE;
- coff = coff_data (abfd);
- coff->symbols = (coff_symbol_type *) NULL;
- coff->conversion_table = (unsigned int *) NULL;
- coff->raw_syments = (struct coff_ptr_struct *) NULL;
- coff->relocbase = 0;
-
- xcoff_data (abfd)->modtype = ('1' << 8) | 'L';
-
- /* We set cputype to -1 to indicate that it has not been
- initialized. */
- xcoff_data (abfd)->cputype = -1;
-
- xcoff_data (abfd)->csects = NULL;
- xcoff_data (abfd)->debug_indices = NULL;
-
- /* text section alignment is different than the default */
- bfd_xcoff_text_align_power (abfd) = 2;
-
- return TRUE;
-}
-
-/* Copy XCOFF data from one BFD to another. */
-
-bfd_boolean
-_bfd_xcoff_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
-{
- struct xcoff_tdata *ix, *ox;
- asection *sec;
-
- if (ibfd->xvec != obfd->xvec)
- return TRUE;
- ix = xcoff_data (ibfd);
- ox = xcoff_data (obfd);
- ox->full_aouthdr = ix->full_aouthdr;
- ox->toc = ix->toc;
- if (ix->sntoc == 0)
- ox->sntoc = 0;
- else
- {
- sec = coff_section_from_bfd_index (ibfd, ix->sntoc);
- if (sec == NULL)
- ox->sntoc = 0;
- else
- ox->sntoc = sec->output_section->target_index;
- }
- if (ix->snentry == 0)
- ox->snentry = 0;
- else
- {
- sec = coff_section_from_bfd_index (ibfd, ix->snentry);
- if (sec == NULL)
- ox->snentry = 0;
- else
- ox->snentry = sec->output_section->target_index;
- }
- bfd_xcoff_text_align_power (obfd) = bfd_xcoff_text_align_power (ibfd);
- bfd_xcoff_data_align_power (obfd) = bfd_xcoff_data_align_power (ibfd);
- ox->modtype = ix->modtype;
- ox->cputype = ix->cputype;
- ox->maxdata = ix->maxdata;
- ox->maxstack = ix->maxstack;
- return TRUE;
-}
-
-/* I don't think XCOFF really has a notion of local labels based on
- name. This will mean that ld -X doesn't actually strip anything.
- The AIX native linker does not have a -X option, and it ignores the
- -x option. */
-
-bfd_boolean
-_bfd_xcoff_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name ATTRIBUTE_UNUSED;
-{
- return FALSE;
-}
-
-void
-_bfd_xcoff_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
-{
- SYMENT *ext = (SYMENT *)ext1;
- struct internal_syment * in = (struct internal_syment *)in1;
-
- if (ext->e.e_name[0] != 0)
- {
- memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
- }
- else
- {
- in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset);
- }
-
- in->n_value = H_GET_32 (abfd, ext->e_value);
- in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
- in->n_type = H_GET_16 (abfd, ext->e_type);
- in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
- in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
-}
-
-unsigned int
-_bfd_xcoff_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
-{
- struct internal_syment *in = (struct internal_syment *)inp;
- SYMENT *ext =(SYMENT *)extp;
-
- if (in->_n._n_name[0] != 0)
- {
- memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
- }
- else
- {
- H_PUT_32 (abfd, 0, ext->e.e.e_zeroes);
- H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
- }
-
- H_PUT_32 (abfd, in->n_value, ext->e_value);
- H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
- H_PUT_16 (abfd, in->n_type, ext->e_type);
- H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
- H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
- return bfd_coff_symesz (abfd);
-}
-
-void
-_bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx;
- int numaux;
- PTR in1;
-{
- AUXENT * ext = (AUXENT *)ext1;
- union internal_auxent *in = (union internal_auxent *)in1;
-
- switch (class)
- {
- case C_FILE:
- if (ext->x_file.x_fname[0] == 0)
- {
- in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset =
- H_GET_32 (abfd, ext->x_file.x_n.x_offset);
- }
- else
- {
- if (numaux > 1)
- {
- if (indx == 0)
- memcpy (in->x_file.x_fname, ext->x_file.x_fname,
- numaux * sizeof (AUXENT));
- }
- else
- {
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- }
- }
- goto end;
-
- /* RS/6000 "csect" auxents */
- case C_EXT:
- case C_HIDEXT:
- if (indx + 1 == numaux)
- {
- in->x_csect.x_scnlen.l = H_GET_32 (abfd, ext->x_csect.x_scnlen);
- in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash);
- in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash);
- /* We don't have to hack bitfields in x_smtyp because it's
- defined by shifts-and-ands, which are equivalent on all
- byte orders. */
- in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp);
- in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas);
- in->x_csect.x_stab = H_GET_32 (abfd, ext->x_csect.x_stab);
- in->x_csect.x_snstab = H_GET_16 (abfd, ext->x_csect.x_snstab);
- goto end;
- }
- break;
-
- case C_STAT:
- case C_LEAFSTAT:
- case C_HIDDEN:
- if (type == T_NULL)
- {
- in->x_scn.x_scnlen = H_GET_32 (abfd, ext->x_scn.x_scnlen);
- in->x_scn.x_nreloc = H_GET_16 (abfd, ext->x_scn.x_nreloc);
- in->x_scn.x_nlinno = H_GET_16 (abfd, ext->x_scn.x_nlinno);
- /* PE defines some extra fields; we zero them out for
- safety. */
- in->x_scn.x_checksum = 0;
- in->x_scn.x_associated = 0;
- in->x_scn.x_comdat = 0;
-
- goto end;
- }
- break;
- }
-
- in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx);
- in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- in->x_sym.x_fcnary.x_fcn.x_lnnoptr =
- H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
- in->x_sym.x_fcnary.x_fcn.x_endndx.l =
- H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx);
- }
- else
- {
- in->x_sym.x_fcnary.x_ary.x_dimen[0] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- in->x_sym.x_fcnary.x_ary.x_dimen[1] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- in->x_sym.x_fcnary.x_ary.x_dimen[2] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- in->x_sym.x_fcnary.x_ary.x_dimen[3] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
- }
-
- if (ISFCN (type))
- {
- in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
- }
- else
- {
- in->x_sym.x_misc.x_lnsz.x_lnno =
- H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno);
- in->x_sym.x_misc.x_lnsz.x_size =
- H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size);
- }
-
- end: ;
- /* The semicolon is because MSVC doesn't like labels at
- end of block. */
-}
-
-
-unsigned int _bfd_xcoff_swap_aux_out
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-
-unsigned int
-_bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd * abfd;
- PTR inp;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR extp;
-{
- union internal_auxent *in = (union internal_auxent *)inp;
- AUXENT *ext = (AUXENT *)extp;
-
- memset ((PTR)ext, 0, bfd_coff_auxesz (abfd));
- switch (class)
- {
- case C_FILE:
- if (in->x_file.x_fname[0] == 0)
- {
- H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
- H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
- }
- else
- {
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
- }
- goto end;
-
- /* RS/6000 "csect" auxents */
- case C_EXT:
- case C_HIDEXT:
- if (indx + 1 == numaux)
- {
- H_PUT_32 (abfd, in->x_csect.x_scnlen.l, ext->x_csect.x_scnlen);
- H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash);
- H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash);
- /* We don't have to hack bitfields in x_smtyp because it's
- defined by shifts-and-ands, which are equivalent on all
- byte orders. */
- H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
- H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
- H_PUT_32 (abfd, in->x_csect.x_stab, ext->x_csect.x_stab);
- H_PUT_16 (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab);
- goto end;
- }
- break;
-
- case C_STAT:
- case C_LEAFSTAT:
- case C_HIDDEN:
- if (type == T_NULL)
- {
- H_PUT_32 (abfd, in->x_scn.x_scnlen, ext->x_scn.x_scnlen);
- H_PUT_16 (abfd, in->x_scn.x_nreloc, ext->x_scn.x_nreloc);
- H_PUT_16 (abfd, in->x_scn.x_nlinno, ext->x_scn.x_nlinno);
- goto end;
- }
- break;
- }
-
- H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx);
- H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
- ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
- H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
- ext->x_sym.x_fcnary.x_fcn.x_endndx);
- }
- else
- {
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
- ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
- ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
- ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
- ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
- }
-
- if (ISFCN (type))
- H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
- else
- {
- H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
- ext->x_sym.x_misc.x_lnsz.x_lnno);
- H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size,
- ext->x_sym.x_misc.x_lnsz.x_size);
- }
-
-end:
- return bfd_coff_auxesz (abfd);
-}
-
-
-
-/* The XCOFF reloc table. Actually, XCOFF relocations specify the
- bitsize and whether they are signed or not, along with a
- conventional type. This table is for the types, which are used for
- different algorithms for putting in the reloc. Many of these
- relocs need special_function entries, which I have not written. */
-
-
-reloc_howto_type xcoff_howto_table[] =
-{
- /* Standard 32 bit relocation. */
- HOWTO (R_POS, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit relocation, but store negative value. */
- HOWTO (R_NEG, /* type */
- 0, /* rightshift */
- -2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_NEG", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit PC relative relocation. */
- HOWTO (R_REL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit TOC relative relocation. */
- HOWTO (R_TOC, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TOC", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* I don't really know what this is. */
- HOWTO (R_RTB, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RTB", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* External TOC relative symbol. */
- HOWTO (R_GL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_GL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Local TOC relative symbol. */
- HOWTO (R_TCL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TCL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (7),
-
- /* Non modifiable absolute branch. */
- HOWTO (R_BA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA_26", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (9),
-
- /* Non modifiable relative branch. */
- HOWTO (R_BR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_BR", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (0xb),
-
- /* Indirect load. */
- HOWTO (R_RL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Load address. */
- HOWTO (R_RLA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RLA", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (0xe),
-
- /* Non-relocating reference. */
- HOWTO (R_REF, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "R_REF", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (0x10),
- EMPTY_HOWTO (0x11),
-
- /* TOC relative indirect load. */
- HOWTO (R_TRL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* TOC relative load address. */
- HOWTO (R_TRLA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRLA", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable relative branch. */
- HOWTO (R_RRTBI, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBI", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable absolute branch. */
- HOWTO (R_RRTBA, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBA", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable call absolute indirect. */
- HOWTO (R_CAI, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CAI", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable call relative. */
- HOWTO (R_CREL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CREL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch absolute. */
- HOWTO (R_RBA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch absolute. */
- HOWTO (R_RBAC, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBAC", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch relative. */
- HOWTO (R_RBR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR_26", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch absolute. */
- HOWTO (R_RBRC, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBRC", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit Non modifiable absolute branch. */
- HOWTO (R_BA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA_16", /* name */
- TRUE, /* partial_inplace */
- 0xfffc, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch relative. */
- HOWTO (R_RBR, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR_16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch relative. */
- HOWTO (R_RBA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA_16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
-};
-
-void
-xcoff_rtype2howto (relent, internal)
- arelent *relent;
- struct internal_reloc *internal;
-{
- if (internal->r_type > R_RBRC)
- abort ();
-
- /* Default howto layout works most of the time */
- relent->howto = &xcoff_howto_table[internal->r_type];
-
- /* Special case some 16 bit reloc */
- if (15 == (internal->r_size & 0x1f))
- {
- if (R_BA == internal->r_type)
- relent->howto = &xcoff_howto_table[0x1c];
- else if (R_RBR == internal->r_type)
- relent->howto = &xcoff_howto_table[0x1d];
- else if (R_RBA == internal->r_type)
- relent->howto = &xcoff_howto_table[0x1e];
- }
-
- /* The r_size field of an XCOFF reloc encodes the bitsize of the
- relocation, as well as indicating whether it is signed or not.
- Doublecheck that the relocation information gathered from the
- type matches this information. The bitsize is not significant
- for R_REF relocs. */
- if (relent->howto->dst_mask != 0
- && (relent->howto->bitsize
- != ((unsigned int) internal->r_size & 0x1f) + 1))
- abort ();
-}
-
-reloc_howto_type *
-_bfd_xcoff_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- case BFD_RELOC_PPC_B26:
- return &xcoff_howto_table[0xa];
- case BFD_RELOC_PPC_BA16:
- return &xcoff_howto_table[0x1c];
- case BFD_RELOC_PPC_BA26:
- return &xcoff_howto_table[8];
- case BFD_RELOC_PPC_TOC16:
- return &xcoff_howto_table[3];
- case BFD_RELOC_32:
- case BFD_RELOC_CTOR:
- return &xcoff_howto_table[0];
- default:
- return NULL;
- }
-}
-
-
-/* XCOFF archive support. The original version of this code was by
- Damon A. Permezel. It was enhanced to permit cross support, and
- writing archive files, by Ian Lance Taylor, Cygnus Support.
-
- XCOFF uses its own archive format. Everything is hooked together
- with file offset links, so it is possible to rapidly update an
- archive in place. Of course, we don't do that. An XCOFF archive
- has a real file header, not just an ARMAG string. The structure of
- the file header and of each archive header appear below.
-
- An XCOFF archive also has a member table, which is a list of
- elements in the archive (you can get that by looking through the
- linked list, but you have to read a lot more of the file). The
- member table has a normal archive header with an empty name. It is
- normally (and perhaps must be) the second to last entry in the
- archive. The member table data is almost printable ASCII. It
- starts with a 12 character decimal string which is the number of
- entries in the table. For each entry it has a 12 character decimal
- string which is the offset in the archive of that member. These
- entries are followed by a series of null terminated strings which
- are the member names for each entry.
-
- Finally, an XCOFF archive has a global symbol table, which is what
- we call the armap. The global symbol table has a normal archive
- header with an empty name. It is normally (and perhaps must be)
- the last entry in the archive. The contents start with a four byte
- binary number which is the number of entries. This is followed by
- a that many four byte binary numbers; each is the file offset of an
- entry in the archive. These numbers are followed by a series of
- null terminated strings, which are symbol names.
-
- AIX 4.3 introduced a new archive format which can handle larger
- files and also 32- and 64-bit objects in the same archive. The
- things said above remain true except that there is now more than
- one global symbol table. The one is used to index 32-bit objects,
- the other for 64-bit objects.
-
- The new archives (recognizable by the new ARMAG string) has larger
- field lengths so that we cannot really share any code. Also we have
- to take care that we are not generating the new form of archives
- on AIX 4.2 or earlier systems. */
-
-/* XCOFF archives use this as a magic string. Note that both strings
- have the same length. */
-
-/* Set the magic for archive. */
-
-bfd_boolean
-bfd_xcoff_ar_archive_set_magic (abfd, magic)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *magic ATTRIBUTE_UNUSED;
-{
- /* Not supported yet. */
- return FALSE;
- /* bfd_xcoff_archive_set_magic (abfd, magic); */
-}
-
-/* Read in the armap of an XCOFF archive. */
-
-bfd_boolean
-_bfd_xcoff_slurp_armap (abfd)
- bfd *abfd;
-{
- file_ptr off;
- size_t namlen;
- bfd_size_type sz;
- bfd_byte *contents, *cend;
- bfd_vma c, i;
- carsym *arsym;
- bfd_byte *p;
-
- if (xcoff_ardata (abfd) == NULL)
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- if (! xcoff_big_format_p (abfd))
- {
- /* This is for the old format. */
- struct xcoff_ar_hdr hdr;
-
- off = strtol (xcoff_ardata (abfd)->symoff, (char **) NULL, 10);
- if (off == 0)
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- if (bfd_seek (abfd, off, SEEK_SET) != 0)
- return FALSE;
-
- /* The symbol table starts with a normal archive header. */
- if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR)
- return FALSE;
-
- /* Skip the name (normally empty). */
- namlen = strtol (hdr.namlen, (char **) NULL, 10);
- off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
- if (bfd_seek (abfd, off, SEEK_CUR) != 0)
- return FALSE;
-
- sz = strtol (hdr.size, (char **) NULL, 10);
-
- /* Read in the entire symbol table. */
- contents = (bfd_byte *) bfd_alloc (abfd, sz);
- if (contents == NULL)
- return FALSE;
- if (bfd_bread ((PTR) contents, sz, abfd) != sz)
- return FALSE;
-
- /* The symbol table starts with a four byte count. */
- c = H_GET_32 (abfd, contents);
-
- if (c * 4 >= sz)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- bfd_ardata (abfd)->symdefs =
- ((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
- if (bfd_ardata (abfd)->symdefs == NULL)
- return FALSE;
-
- /* After the count comes a list of four byte file offsets. */
- for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
- i < c;
- ++i, ++arsym, p += 4)
- arsym->file_offset = H_GET_32 (abfd, p);
- }
- else
- {
- /* This is for the new format. */
- struct xcoff_ar_hdr_big hdr;
-
- off = strtol (xcoff_ardata_big (abfd)->symoff, (char **) NULL, 10);
- if (off == 0)
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- if (bfd_seek (abfd, off, SEEK_SET) != 0)
- return FALSE;
-
- /* The symbol table starts with a normal archive header. */
- if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
- != SIZEOF_AR_HDR_BIG)
- return FALSE;
-
- /* Skip the name (normally empty). */
- namlen = strtol (hdr.namlen, (char **) NULL, 10);
- off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
- if (bfd_seek (abfd, off, SEEK_CUR) != 0)
- return FALSE;
-
- /* XXX This actually has to be a call to strtoll (at least on 32-bit
- machines) since the field width is 20 and there numbers with more
- than 32 bits can be represented. */
- sz = strtol (hdr.size, (char **) NULL, 10);
-
- /* Read in the entire symbol table. */
- contents = (bfd_byte *) bfd_alloc (abfd, sz);
- if (contents == NULL)
- return FALSE;
- if (bfd_bread ((PTR) contents, sz, abfd) != sz)
- return FALSE;
-
- /* The symbol table starts with an eight byte count. */
- c = H_GET_64 (abfd, contents);
-
- if (c * 8 >= sz)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- bfd_ardata (abfd)->symdefs =
- ((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
- if (bfd_ardata (abfd)->symdefs == NULL)
- return FALSE;
-
- /* After the count comes a list of eight byte file offsets. */
- for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
- i < c;
- ++i, ++arsym, p += 8)
- arsym->file_offset = H_GET_64 (abfd, p);
- }
-
- /* After the file offsets come null terminated symbol names. */
- cend = contents + sz;
- for (i = 0, arsym = bfd_ardata (abfd)->symdefs;
- i < c;
- ++i, ++arsym, p += strlen ((char *) p) + 1)
- {
- if (p >= cend)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- arsym->name = (char *) p;
- }
-
- bfd_ardata (abfd)->symdef_count = c;
- bfd_has_map (abfd) = TRUE;
-
- return TRUE;
-}
-
-/* See if this is an XCOFF archive. */
-
-const bfd_target *
-_bfd_xcoff_archive_p (abfd)
- bfd *abfd;
-{
- struct artdata *tdata_hold;
- char magic[SXCOFFARMAG];
- bfd_size_type amt = SXCOFFARMAG;
-
- if (bfd_bread ((PTR) magic, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (strncmp (magic, XCOFFARMAG, SXCOFFARMAG) != 0
- && strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- tdata_hold = bfd_ardata (abfd);
-
- amt = sizeof (struct artdata);
- bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd) == (struct artdata *) NULL)
- goto error_ret_restore;
-
- bfd_ardata (abfd)->cache = NULL;
- bfd_ardata (abfd)->archive_head = NULL;
- bfd_ardata (abfd)->symdefs = NULL;
- bfd_ardata (abfd)->extended_names = NULL;
-
- /* Now handle the two formats. */
- if (magic[1] != 'b')
- {
- /* This is the old format. */
- struct xcoff_ar_file_hdr hdr;
-
- /* Copy over the magic string. */
- memcpy (hdr.magic, magic, SXCOFFARMAG);
-
- /* Now read the rest of the file header. */
- amt = SIZEOF_AR_FILE_HDR - SXCOFFARMAG;
- if (bfd_bread ((PTR) &hdr.memoff, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- goto error_ret;
- }
-
- bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
- (char **) NULL, 10);
-
- amt = SIZEOF_AR_FILE_HDR;
- bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd)->tdata == NULL)
- goto error_ret;
-
- memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR);
- }
- else
- {
- /* This is the new format. */
- struct xcoff_ar_file_hdr_big hdr;
-
- /* Copy over the magic string. */
- memcpy (hdr.magic, magic, SXCOFFARMAG);
-
- /* Now read the rest of the file header. */
- amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
- if (bfd_bread ((PTR) &hdr.memoff, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- goto error_ret;
- }
-
- bfd_ardata (abfd)->first_file_filepos = bfd_scan_vma (hdr.firstmemoff,
- (const char **) 0,
- 10);
-
- amt = SIZEOF_AR_FILE_HDR_BIG;
- bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd)->tdata == NULL)
- goto error_ret;
-
- memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG);
- }
-
- if (! _bfd_xcoff_slurp_armap (abfd))
- {
- error_ret:
- bfd_release (abfd, bfd_ardata (abfd));
- error_ret_restore:
- bfd_ardata (abfd) = tdata_hold;
- return NULL;
- }
-
- return abfd->xvec;
-}
-
-/* Read the archive header in an XCOFF archive. */
-
-PTR
-_bfd_xcoff_read_ar_hdr (abfd)
- bfd *abfd;
-{
- bfd_size_type namlen;
- struct areltdata *ret;
- bfd_size_type amt = sizeof (struct areltdata);
-
- ret = (struct areltdata *) bfd_alloc (abfd, amt);
- if (ret == NULL)
- return NULL;
-
- if (! xcoff_big_format_p (abfd))
- {
- struct xcoff_ar_hdr hdr;
- struct xcoff_ar_hdr *hdrp;
-
- if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR)
- {
- free (ret);
- return NULL;
- }
-
- namlen = strtol (hdr.namlen, (char **) NULL, 10);
- amt = SIZEOF_AR_HDR + namlen + 1;
- hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, amt);
- if (hdrp == NULL)
- {
- free (ret);
- return NULL;
- }
- memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
- if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
- {
- free (ret);
- return NULL;
- }
- ((char *) hdrp)[SIZEOF_AR_HDR + namlen] = '\0';
-
- ret->arch_header = (char *) hdrp;
- ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
- ret->filename = (char *) hdrp + SIZEOF_AR_HDR;
- }
- else
- {
- struct xcoff_ar_hdr_big hdr;
- struct xcoff_ar_hdr_big *hdrp;
-
- if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
- != SIZEOF_AR_HDR_BIG)
- {
- free (ret);
- return NULL;
- }
-
- namlen = strtol (hdr.namlen, (char **) NULL, 10);
- amt = SIZEOF_AR_HDR_BIG + namlen + 1;
- hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd, amt);
- if (hdrp == NULL)
- {
- free (ret);
- return NULL;
- }
- memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG);
- if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
- {
- free (ret);
- return NULL;
- }
- ((char *) hdrp)[SIZEOF_AR_HDR_BIG + namlen] = '\0';
-
- ret->arch_header = (char *) hdrp;
- /* XXX This actually has to be a call to strtoll (at least on 32-bit
- machines) since the field width is 20 and there numbers with more
- than 32 bits can be represented. */
- ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
- ret->filename = (char *) hdrp + SIZEOF_AR_HDR_BIG;
- }
-
- /* Skip over the XCOFFARFMAG at the end of the file name. */
- if (bfd_seek (abfd, (file_ptr) ((namlen & 1) + SXCOFFARFMAG), SEEK_CUR) != 0)
- return NULL;
-
- return (PTR) ret;
-}
-
-/* Open the next element in an XCOFF archive. */
-
-bfd *
-_bfd_xcoff_openr_next_archived_file (archive, last_file)
- bfd *archive;
- bfd *last_file;
-{
- file_ptr filestart;
-
- if (xcoff_ardata (archive) == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- if (! xcoff_big_format_p (archive))
- {
- if (last_file == NULL)
- filestart = bfd_ardata (archive)->first_file_filepos;
- else
- filestart = strtol (arch_xhdr (last_file)->nextoff, (char **) NULL,
- 10);
-
- if (filestart == 0
- || filestart == strtol (xcoff_ardata (archive)->memoff,
- (char **) NULL, 10)
- || filestart == strtol (xcoff_ardata (archive)->symoff,
- (char **) NULL, 10))
- {
- bfd_set_error (bfd_error_no_more_archived_files);
- return NULL;
- }
- }
- else
- {
- if (last_file == NULL)
- filestart = bfd_ardata (archive)->first_file_filepos;
- else
- /* XXX These actually have to be a calls to strtoll (at least
- on 32-bit machines) since the fields's width is 20 and
- there numbers with more than 32 bits can be represented. */
- filestart = strtol (arch_xhdr_big (last_file)->nextoff, (char **) NULL,
- 10);
-
- /* XXX These actually have to be calls to strtoll (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with more
- than 32 bits can be represented. */
- if (filestart == 0
- || filestart == strtol (xcoff_ardata_big (archive)->memoff,
- (char **) NULL, 10)
- || filestart == strtol (xcoff_ardata_big (archive)->symoff,
- (char **) NULL, 10))
- {
- bfd_set_error (bfd_error_no_more_archived_files);
- return NULL;
- }
- }
-
- return _bfd_get_elt_at_filepos (archive, filestart);
-}
-
-/* Stat an element in an XCOFF archive. */
-
-int
-_bfd_xcoff_stat_arch_elt (abfd, s)
- bfd *abfd;
- struct stat *s;
-{
- if (abfd->arelt_data == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- if (! xcoff_big_format_p (abfd->my_archive))
- {
- struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd);
-
- s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
- s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
- s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
- s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
- s->st_size = arch_eltdata (abfd)->parsed_size;
- }
- else
- {
- struct xcoff_ar_hdr_big *hdrp = arch_xhdr_big (abfd);
-
- s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
- s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
- s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
- s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
- s->st_size = arch_eltdata (abfd)->parsed_size;
- }
-
- return 0;
-}
-
-/* Normalize a file name for inclusion in an archive. */
-
-static const char *
-normalize_filename (abfd)
- bfd *abfd;
-{
- const char *file;
- const char *filename;
-
- file = bfd_get_filename (abfd);
- filename = strrchr (file, '/');
- if (filename != NULL)
- filename++;
- else
- filename = file;
- return filename;
-}
-
-/* Write out an XCOFF armap. */
-
-static bfd_boolean
-xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
- bfd *abfd;
- unsigned int elength ATTRIBUTE_UNUSED;
- struct orl *map;
- unsigned int orl_count;
- int stridx;
-{
- struct xcoff_ar_hdr hdr;
- char *p;
- unsigned char buf[4];
- bfd *sub;
- file_ptr fileoff;
- unsigned int i;
-
- memset (&hdr, 0, sizeof hdr);
- sprintf (hdr.size, "%ld", (long) (4 + orl_count * 4 + stridx));
- sprintf (hdr.nextoff, "%d", 0);
- memcpy (hdr.prevoff, xcoff_ardata (abfd)->memoff, XCOFFARMAG_ELEMENT_SIZE);
- sprintf (hdr.date, "%d", 0);
- sprintf (hdr.uid, "%d", 0);
- sprintf (hdr.gid, "%d", 0);
- sprintf (hdr.mode, "%d", 0);
- sprintf (hdr.namlen, "%d", 0);
-
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) &hdr; p < (char *) &hdr + SIZEOF_AR_HDR; p++)
- if (*p == '\0')
- *p = ' ';
-
- if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR
- || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
- != SXCOFFARFMAG))
- return FALSE;
-
- H_PUT_32 (abfd, orl_count, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
- return FALSE;
-
- sub = abfd->archive_head;
- fileoff = SIZEOF_AR_FILE_HDR;
- i = 0;
- while (sub != NULL && i < orl_count)
- {
- size_t namlen;
-
- while (map[i].u.abfd == sub)
- {
- H_PUT_32 (abfd, fileoff, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
- return FALSE;
- ++i;
- }
- namlen = strlen (normalize_filename (sub));
- namlen = (namlen + 1) &~ (size_t) 1;
- fileoff += (SIZEOF_AR_HDR
- + namlen
- + SXCOFFARFMAG
- + arelt_size (sub));
- fileoff = (fileoff + 1) &~ 1;
- sub = sub->next;
- }
-
- for (i = 0; i < orl_count; i++)
- {
- const char *name;
- size_t namlen;
-
- name = *map[i].name;
- namlen = strlen (name);
- if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1)
- return FALSE;
- }
-
- if ((stridx & 1) != 0)
- {
- char b;
-
- b = '\0';
- if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return FALSE;
- }
-
- return TRUE;
-}
-
-static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
-#define FMT20 "%-20lld"
-#define FMT12 "%-12d"
-#define FMT12_OCTAL "%-12o"
-#define FMT4 "%-4d"
-#define PRINT20(d, v) \
- sprintf (buff20, FMT20, (long long)(v)), \
- memcpy ((void *) (d), buff20, 20)
-
-#define PRINT12(d, v) \
- sprintf (buff20, FMT12, (int)(v)), \
- memcpy ((void *) (d), buff20, 12)
-
-#define PRINT12_OCTAL(d, v) \
- sprintf (buff20, FMT12_OCTAL, (unsigned int)(v)), \
- memcpy ((void *) (d), buff20, 12)
-
-#define PRINT4(d, v) \
- sprintf (buff20, FMT4, (int)(v)), \
- memcpy ((void *) (d), buff20, 4)
-
-#define READ20(d, v) \
- buff20[20] = 0, \
- memcpy (buff20, (d), 20), \
- (v) = bfd_scan_vma (buff20, (const char **) NULL, 10)
-
-static bfd_boolean
-do_pad (abfd, number)
- bfd *abfd;
- unsigned int number;
-{
- bfd_byte b = 0;
-
- /* Limit pad to <= 4096. */
- if (number > 4096)
- return FALSE;
-
- while (number--)
- if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return FALSE;
-
- return TRUE;
-}
-
-static bfd_boolean
-do_copy (out_bfd, in_bfd)
- bfd *out_bfd;
- bfd *in_bfd;
-{
- bfd_size_type remaining;
- bfd_byte buffer[DEFAULT_BUFFERSIZE];
-
- if (bfd_seek (in_bfd, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
-
- remaining = arelt_size (in_bfd);
-
- while (remaining >= DEFAULT_BUFFERSIZE)
- {
- if (bfd_bread (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE
- || bfd_bwrite (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE)
- return FALSE;
-
- remaining -= DEFAULT_BUFFERSIZE;
- }
-
- if (remaining)
- {
- if (bfd_bread (buffer, remaining, in_bfd) != remaining
- || bfd_bwrite (buffer, remaining, out_bfd) != remaining)
- return FALSE;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size)
- bfd *out_bfd;
- bfd *in_bfd;
- ufile_ptr *offset;
- int ar_header_size;
-{
- if (bfd_check_format (in_bfd, bfd_object)
- && bfd_get_flavour (in_bfd) == bfd_target_xcoff_flavour
- && (in_bfd->flags & DYNAMIC) != 0)
- {
- bfd_size_type pad = 0;
- int text_align_power;
-
- text_align_power = bfd_xcoff_text_align_power (in_bfd);
-
- pad = 1 << text_align_power;
- pad -= (*offset + ar_header_size) & (pad - 1);
-
- if (! do_pad (out_bfd, pad))
- return FALSE;
-
- *offset += pad;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
- bfd *abfd;
- unsigned int elength ATTRIBUTE_UNUSED;
- struct orl *map;
- unsigned int orl_count;
- int stridx;
-{
- struct xcoff_ar_file_hdr_big *fhdr;
- bfd_vma i, sym_32, sym_64, str_32, str_64;
- const bfd_arch_info_type *arch_info = NULL;
- bfd *current_bfd;
- size_t string_length;
- ufile_ptr nextoff, prevoff;
-
- /* First, we look through the symbols and work out which are
- from 32-bit objects and which from 64-bit ones. */
- sym_32 = sym_64 = str_32 = str_64 = 0;
-
- current_bfd = abfd->archive_head;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- i = 0;
- while (current_bfd != NULL && i < orl_count)
- {
- while (map[i].u.abfd == current_bfd)
- {
- string_length = strlen (*map[i].name) + 1;
-
- if (arch_info->bits_per_address == 64)
- {
- sym_64++;
- str_64 += string_length;
- }
- else
- {
- sym_32++;
- str_32 += string_length;
- }
- i++;
- }
- current_bfd = current_bfd->next;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- }
-
- /* A quick sanity check... */
- BFD_ASSERT (sym_64 + sym_32 == orl_count);
- /* Explicit cast to int for compiler. */
- BFD_ASSERT ((int)(str_64 + str_32) == stridx);
-
- fhdr = xcoff_ardata_big (abfd);
-
- /* xcoff_write_archive_contents_big passes nextoff in symoff. */
- READ20 (fhdr->memoff, prevoff);
- READ20 (fhdr->symoff, nextoff);
-
- BFD_ASSERT (nextoff == bfd_tell (abfd));
-
- /* Write out the symbol table.
- Layout :
-
- standard big archive header
- 0x0000 ar_size [0x14]
- 0x0014 ar_nxtmem [0x14]
- 0x0028 ar_prvmem [0x14]
- 0x003C ar_date [0x0C]
- 0x0048 ar_uid [0x0C]
- 0x0054 ar_gid [0x0C]
- 0x0060 ar_mod [0x0C]
- 0x006C ar_namelen[0x04]
- 0x0070 ar_fmag [SXCOFFARFMAG]
-
- Symbol table
- 0x0072 num_syms [0x08], binary
- 0x0078 offsets [0x08 * num_syms], binary
- 0x0086 + 0x08 * num_syms names [??]
- ?? pad to even bytes.
- */
-
- if (sym_32)
- {
- struct xcoff_ar_hdr_big *hdr;
- bfd_byte *symbol_table;
- bfd_byte *st;
- file_ptr fileoff;
-
- bfd_vma symbol_table_size =
- SIZEOF_AR_HDR_BIG
- + SXCOFFARFMAG
- + 8
- + 8 * sym_32
- + str_32 + (str_32 & 1);
-
- symbol_table = NULL;
- symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
- if (symbol_table == NULL)
- return FALSE;
-
- hdr = (struct xcoff_ar_hdr_big *) symbol_table;
-
- PRINT20 (hdr->size, 8 + 8 * sym_32 + str_32 + (str_32 & 1));
-
- if (sym_64)
- PRINT20 (hdr->nextoff, nextoff + symbol_table_size);
- else
- PRINT20 (hdr->nextoff, 0);
-
- PRINT20 (hdr->prevoff, prevoff);
- PRINT12 (hdr->date, 0);
- PRINT12 (hdr->uid, 0);
- PRINT12 (hdr->gid, 0);
- PRINT12 (hdr->mode, 0);
- PRINT4 (hdr->namlen, 0) ;
-
- st = symbol_table + SIZEOF_AR_HDR_BIG;
- memcpy (st, XCOFFARFMAG, SXCOFFARFMAG);
- st += SXCOFFARFMAG;
-
- bfd_h_put_64 (abfd, sym_32, st);
- st += 8;
-
- /* loop over the 32 bit offsets */
- current_bfd = abfd->archive_head;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- fileoff = SIZEOF_AR_FILE_HDR_BIG;
- i = 0;
- while (current_bfd != NULL && i < orl_count)
- {
- while (map[i].u.abfd == current_bfd)
- {
- if (arch_info->bits_per_address == 32)
- {
- bfd_h_put_64 (abfd, fileoff, st);
- st += 8;
- }
- i++;
- }
- string_length = strlen (normalize_filename (current_bfd));
- string_length += string_length & 1;
- fileoff += (SIZEOF_AR_HDR_BIG
- + string_length
- + SXCOFFARFMAG
- + arelt_size (current_bfd));
- fileoff += fileoff & 1;
- current_bfd = current_bfd->next;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- }
-
- /* loop over the 32 bit symbol names */
- current_bfd = abfd->archive_head;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- i = 0;
- while (current_bfd != NULL && i < orl_count)
- {
- while (map[i].u.abfd == current_bfd)
- {
- if (arch_info->bits_per_address == 32)
- {
- string_length = sprintf (st, "%s", *map[i].name);
- st += string_length + 1;
- }
- i++;
- }
- current_bfd = current_bfd->next;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- }
-
- bfd_bwrite (symbol_table, symbol_table_size, abfd);
-
- free (symbol_table);
- symbol_table = NULL;
-
- prevoff = nextoff;
- nextoff = nextoff + symbol_table_size;
- }
- else
- PRINT20 (fhdr->symoff, 0);
-
- if (sym_64)
- {
- struct xcoff_ar_hdr_big *hdr;
- bfd_byte *symbol_table;
- bfd_byte *st;
- file_ptr fileoff;
-
- bfd_vma symbol_table_size =
- SIZEOF_AR_HDR_BIG
- + SXCOFFARFMAG
- + 8
- + 8 * sym_64
- + str_64 + (str_64 & 1);
-
- symbol_table = NULL;
- symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
- if (symbol_table == NULL)
- return FALSE;
-
- hdr = (struct xcoff_ar_hdr_big *) symbol_table;
-
- PRINT20 (hdr->size, 8 + 8 * sym_64 + str_64 + (str_64 & 1));
- PRINT20 (hdr->nextoff, 0);
- PRINT20 (hdr->prevoff, prevoff);
- PRINT12 (hdr->date, 0);
- PRINT12 (hdr->uid, 0);
- PRINT12 (hdr->gid, 0);
- PRINT12 (hdr->mode, 0);
- PRINT4 (hdr->namlen, 0);
-
- st = symbol_table + SIZEOF_AR_HDR_BIG;
- memcpy (st, XCOFFARFMAG, SXCOFFARFMAG);
- st += SXCOFFARFMAG;
-
- bfd_h_put_64 (abfd, sym_64, st);
- st += 8;
-
- /* loop over the 64 bit offsets */
- current_bfd = abfd->archive_head;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- fileoff = SIZEOF_AR_FILE_HDR_BIG;
- i = 0;
- while (current_bfd != NULL && i < orl_count)
- {
- while (map[i].u.abfd == current_bfd)
- {
- if (arch_info->bits_per_address == 64)
- {
- bfd_h_put_64 (abfd, fileoff, st);
- st += 8;
- }
- i++;
- }
- string_length = strlen (normalize_filename (current_bfd));
- string_length += string_length & 1;
- fileoff += (SIZEOF_AR_HDR_BIG
- + string_length
- + SXCOFFARFMAG
- + arelt_size (current_bfd));
- fileoff += fileoff & 1;
- current_bfd = current_bfd->next;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- }
-
- /* loop over the 64 bit symbol names */
- current_bfd = abfd->archive_head;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- i = 0;
- while (current_bfd != NULL && i < orl_count)
- {
- while (map[i].u.abfd == current_bfd)
- {
- if (arch_info->bits_per_address == 64)
- {
- string_length = sprintf (st, "%s", *map[i].name);
- st += string_length + 1;
- }
- i++;
- }
- current_bfd = current_bfd->next;
- if (current_bfd != NULL)
- arch_info = bfd_get_arch_info (current_bfd);
- }
-
- bfd_bwrite (symbol_table, symbol_table_size, abfd);
-
- free (symbol_table);
- symbol_table = NULL;
-
- PRINT20 (fhdr->symoff64, nextoff);
- }
- else
- PRINT20 (fhdr->symoff64, 0);
-
- return TRUE;
-}
-
-bfd_boolean
-_bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx)
- bfd *abfd;
- unsigned int elength ATTRIBUTE_UNUSED;
- struct orl *map;
- unsigned int orl_count;
- int stridx;
-{
- if (! xcoff_big_format_p (abfd))
- return xcoff_write_armap_old (abfd, elength, map, orl_count, stridx);
- else
- return xcoff_write_armap_big (abfd, elength, map, orl_count, stridx);
-}
-
-/* Write out an XCOFF archive. We always write an entire archive,
- rather than fussing with the freelist and so forth. */
-
-static bfd_boolean
-xcoff_write_archive_contents_old (abfd)
- bfd *abfd;
-{
- struct xcoff_ar_file_hdr fhdr;
- bfd_size_type count;
- bfd_size_type total_namlen;
- file_ptr *offsets;
- bfd_boolean makemap;
- bfd_boolean hasobjects;
- ufile_ptr prevoff, nextoff;
- bfd *sub;
- size_t i;
- struct xcoff_ar_hdr ahdr;
- bfd_size_type size;
- char *p;
- char decbuf[XCOFFARMAG_ELEMENT_SIZE + 1];
-
- memset (&fhdr, 0, sizeof fhdr);
- strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG);
- sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR);
- sprintf (fhdr.freeoff, "%d", 0);
-
- count = 0;
- total_namlen = 0;
- for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
- {
- ++count;
- total_namlen += strlen (normalize_filename (sub)) + 1;
- }
- offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr));
- if (offsets == NULL)
- return FALSE;
-
- if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
- return FALSE;
-
- makemap = bfd_has_map (abfd);
- hasobjects = FALSE;
- prevoff = 0;
- nextoff = SIZEOF_AR_FILE_HDR;
- for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++)
- {
- const char *name;
- bfd_size_type namlen;
- struct xcoff_ar_hdr *ahdrp;
- bfd_size_type remaining;
-
- if (makemap && ! hasobjects)
- {
- if (bfd_check_format (sub, bfd_object))
- hasobjects = TRUE;
- }
-
- name = normalize_filename (sub);
- namlen = strlen (name);
-
- if (sub->arelt_data != NULL)
- ahdrp = arch_xhdr (sub);
- else
- ahdrp = NULL;
-
- if (ahdrp == NULL)
- {
- struct stat s;
-
- memset (&ahdr, 0, sizeof ahdr);
- ahdrp = &ahdr;
- if (stat (bfd_get_filename (sub), &s) != 0)
- {
- bfd_set_error (bfd_error_system_call);
- return FALSE;
- }
-
- sprintf (ahdrp->size, "%ld", (long) s.st_size);
- sprintf (ahdrp->date, "%ld", (long) s.st_mtime);
- sprintf (ahdrp->uid, "%ld", (long) s.st_uid);
- sprintf (ahdrp->gid, "%ld", (long) s.st_gid);
- sprintf (ahdrp->mode, "%o", (unsigned int) s.st_mode);
-
- if (sub->arelt_data == NULL)
- {
- size = sizeof (struct areltdata);
- sub->arelt_data = bfd_alloc (sub, size);
- if (sub->arelt_data == NULL)
- return FALSE;
- }
-
- arch_eltdata (sub)->parsed_size = s.st_size;
- }
-
- sprintf (ahdrp->prevoff, "%ld", (long) prevoff);
- sprintf (ahdrp->namlen, "%ld", (long) namlen);
-
- /* If the length of the name is odd, we write out the null byte
- after the name as well. */
- namlen = (namlen + 1) &~ (bfd_size_type) 1;
-
- remaining = arelt_size (sub);
- size = (SIZEOF_AR_HDR
- + namlen
- + SXCOFFARFMAG
- + remaining);
-
- BFD_ASSERT (nextoff == bfd_tell (abfd));
-
- offsets[i] = nextoff;
-
- prevoff = nextoff;
- nextoff += size + (size & 1);
-
- sprintf (ahdrp->nextoff, "%ld", (long) nextoff);
-
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) ahdrp; p < (char *) ahdrp + SIZEOF_AR_HDR; p++)
- if (*p == '\0')
- *p = ' ';
-
- if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR)
- || bfd_bwrite ((PTR) name, namlen, abfd) != namlen
- || bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG,
- abfd) != SXCOFFARFMAG)
- return FALSE;
-
- if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
-
- if (! do_copy (abfd, sub))
- return FALSE;
-
- if (! do_pad (abfd, size & 1))
- return FALSE;
- }
-
- sprintf (fhdr.lastmemoff, "%ld", (long) prevoff);
-
- /* Write out the member table. */
-
- BFD_ASSERT (nextoff == bfd_tell (abfd));
- sprintf (fhdr.memoff, "%ld", (long) nextoff);
-
- memset (&ahdr, 0, sizeof ahdr);
- sprintf (ahdr.size, "%ld", (long) (XCOFFARMAG_ELEMENT_SIZE
- + count * XCOFFARMAG_ELEMENT_SIZE
- + total_namlen));
- sprintf (ahdr.prevoff, "%ld", (long) prevoff);
- sprintf (ahdr.date, "%d", 0);
- sprintf (ahdr.uid, "%d", 0);
- sprintf (ahdr.gid, "%d", 0);
- sprintf (ahdr.mode, "%d", 0);
- sprintf (ahdr.namlen, "%d", 0);
-
- size = (SIZEOF_AR_HDR
- + XCOFFARMAG_ELEMENT_SIZE
- + count * XCOFFARMAG_ELEMENT_SIZE
- + total_namlen
- + SXCOFFARFMAG);
-
- prevoff = nextoff;
- nextoff += size + (size & 1);
-
- if (makemap && hasobjects)
- sprintf (ahdr.nextoff, "%ld", (long) nextoff);
- else
- sprintf (ahdr.nextoff, "%d", 0);
-
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) &ahdr; p < (char *) &ahdr + SIZEOF_AR_HDR; p++)
- if (*p == '\0')
- *p = ' ';
-
- if ((bfd_bwrite ((PTR) &ahdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR)
- || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
- != SXCOFFARFMAG))
- return FALSE;
-
- sprintf (decbuf, "%-12ld", (long) count);
- if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE, abfd)
- != XCOFFARMAG_ELEMENT_SIZE)
- return FALSE;
- for (i = 0; i < (size_t) count; i++)
- {
- sprintf (decbuf, "%-12ld", (long) offsets[i]);
- if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE,
- abfd) != XCOFFARMAG_ELEMENT_SIZE)
- return FALSE;
- }
- for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
- {
- const char *name;
- bfd_size_type namlen;
-
- name = normalize_filename (sub);
- namlen = strlen (name);
- if (bfd_bwrite ((PTR) name, namlen + 1, abfd) != namlen + 1)
- return FALSE;
- }
-
- if (! do_pad (abfd, size & 1))
- return FALSE;
-
- /* Write out the armap, if appropriate. */
- if (! makemap || ! hasobjects)
- sprintf (fhdr.symoff, "%d", 0);
- else
- {
- BFD_ASSERT (nextoff == bfd_tell (abfd));
- sprintf (fhdr.symoff, "%ld", (long) nextoff);
- bfd_ardata (abfd)->tdata = (PTR) &fhdr;
- if (! _bfd_compute_and_write_armap (abfd, 0))
- return FALSE;
- }
-
- /* Write out the archive file header. */
-
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) &fhdr; p < (char *) &fhdr + SIZEOF_AR_FILE_HDR; p++)
- if (*p == '\0')
- *p = ' ';
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR, abfd)
- != SIZEOF_AR_FILE_HDR))
- return FALSE;
-
- return TRUE;
-}
-
-static bfd_boolean
-xcoff_write_archive_contents_big (abfd)
- bfd *abfd;
-{
- struct xcoff_ar_file_hdr_big fhdr;
- bfd_size_type count;
- bfd_size_type total_namlen;
- file_ptr *offsets;
- bfd_boolean makemap;
- bfd_boolean hasobjects;
- ufile_ptr prevoff, nextoff;
- bfd *current_bfd;
- size_t i;
- struct xcoff_ar_hdr_big *hdr, ahdr;
- bfd_size_type size;
- bfd_byte *member_table, *mt;
- bfd_vma member_table_size;
-
- memset (&fhdr, 0, SIZEOF_AR_FILE_HDR_BIG);
- memcpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG);
-
- if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
- return FALSE;
-
- /* Calculate count and total_namlen. */
- makemap = bfd_has_map (abfd);
- hasobjects = FALSE;
- for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0;
- current_bfd != NULL;
- current_bfd = current_bfd->next, count++)
- {
- total_namlen += strlen (normalize_filename (current_bfd)) + 1;
-
- if (makemap
- && ! hasobjects
- && bfd_check_format (current_bfd, bfd_object))
- hasobjects = TRUE;
- }
-
- offsets = NULL;
- if (count)
- {
- offsets = (file_ptr *) bfd_malloc (count * sizeof (file_ptr));
- if (offsets == NULL)
- return FALSE;
- }
-
- prevoff = 0;
- nextoff = SIZEOF_AR_FILE_HDR_BIG;
- for (current_bfd = abfd->archive_head, i = 0;
- current_bfd != NULL;
- current_bfd = current_bfd->next, i++)
- {
- const char *name;
- bfd_size_type namlen;
- struct xcoff_ar_hdr_big *ahdrp;
- bfd_size_type remaining;
-
- name = normalize_filename (current_bfd);
- namlen = strlen (name);
-
- if (current_bfd->arelt_data != NULL)
- ahdrp = arch_xhdr_big (current_bfd);
- else
- ahdrp = NULL;
-
- if (ahdrp == NULL)
- {
- struct stat s;
-
- ahdrp = &ahdr;
- /* XXX This should actually be a call to stat64 (at least on
- 32-bit machines).
- XXX This call will fail if the original object is not found. */
- if (stat (bfd_get_filename (current_bfd), &s) != 0)
- {
- bfd_set_error (bfd_error_system_call);
- return FALSE;
- }
-
- PRINT20 (ahdrp->size, s.st_size);
- PRINT12 (ahdrp->date, s.st_mtime);
- PRINT12 (ahdrp->uid, s.st_uid);
- PRINT12 (ahdrp->gid, s.st_gid);
- PRINT12_OCTAL (ahdrp->mode, s.st_mode);
-
- if (current_bfd->arelt_data == NULL)
- {
- size = sizeof (struct areltdata);
- current_bfd->arelt_data = bfd_alloc (current_bfd, size);
- if (current_bfd->arelt_data == NULL)
- return FALSE;
- }
-
- arch_eltdata (current_bfd)->parsed_size = s.st_size;
- }
-
- PRINT20 (ahdrp->prevoff, prevoff);
- PRINT4 (ahdrp->namlen, namlen);
-
- /* If the length of the name is odd, we write out the null byte
- after the name as well. */
- namlen = (namlen + 1) &~ (bfd_size_type) 1;
-
- remaining = arelt_size (current_bfd);
- size = (SIZEOF_AR_HDR_BIG
- + namlen
- + SXCOFFARFMAG
- + remaining);
-
- BFD_ASSERT (nextoff == bfd_tell (abfd));
-
- /* Check for xcoff shared objects.
- Their text section needs to be aligned wrt the archive file position.
- This requires extra padding before the archive header. */
- if (! do_shared_object_padding (abfd, current_bfd, & nextoff,
- SIZEOF_AR_HDR_BIG + namlen
- + SXCOFFARFMAG))
- return FALSE;
-
- offsets[i] = nextoff;
-
- prevoff = nextoff;
- nextoff += size + (size & 1);
-
- PRINT20 (ahdrp->nextoff, nextoff);
-
- if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
- != SIZEOF_AR_HDR_BIG)
- || bfd_bwrite ((PTR) name, (bfd_size_type) namlen, abfd) != namlen
- || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG,
- abfd) != SXCOFFARFMAG))
- return FALSE;
-
- if (bfd_seek (current_bfd, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
-
- if (! do_copy (abfd, current_bfd))
- return FALSE;
-
- if (! do_pad (abfd, size & 1))
- return FALSE;
- }
-
- if (count)
- {
- PRINT20 (fhdr.firstmemoff, offsets[0]);
- PRINT20 (fhdr.lastmemoff, prevoff);
- }
-
- /* Write out the member table.
- Layout :
-
- standard big archive header
- 0x0000 ar_size [0x14]
- 0x0014 ar_nxtmem [0x14]
- 0x0028 ar_prvmem [0x14]
- 0x003C ar_date [0x0C]
- 0x0048 ar_uid [0x0C]
- 0x0054 ar_gid [0x0C]
- 0x0060 ar_mod [0x0C]
- 0x006C ar_namelen[0x04]
- 0x0070 ar_fmag [0x02]
-
- Member table
- 0x0072 count [0x14]
- 0x0086 offsets [0x14 * counts]
- 0x0086 + 0x14 * counts names [??]
- ?? pad to even bytes.
- */
-
- BFD_ASSERT (nextoff == bfd_tell (abfd));
-
- member_table_size = (SIZEOF_AR_HDR_BIG
- + SXCOFFARFMAG
- + XCOFFARMAGBIG_ELEMENT_SIZE
- + count * XCOFFARMAGBIG_ELEMENT_SIZE
- + total_namlen);
-
- member_table_size += member_table_size & 1;
- member_table = NULL;
- member_table = (bfd_byte *) bfd_zmalloc (member_table_size);
- if (member_table == NULL)
- return FALSE;
-
- hdr = (struct xcoff_ar_hdr_big *) member_table;
-
- PRINT20 (hdr->size, (XCOFFARMAGBIG_ELEMENT_SIZE
- + count * XCOFFARMAGBIG_ELEMENT_SIZE
- + total_namlen + (total_namlen & 1)));
- if (makemap && hasobjects)
- PRINT20 (hdr->nextoff, nextoff + member_table_size);
- else
- PRINT20 (hdr->nextoff, 0);
- PRINT20 (hdr->prevoff, prevoff);
- PRINT12 (hdr->date, 0);
- PRINT12 (hdr->uid, 0);
- PRINT12 (hdr->gid, 0);
- PRINT12 (hdr->mode, 0);
- PRINT4 (hdr->namlen, 0);
-
- mt = member_table + SIZEOF_AR_HDR_BIG;
- memcpy (mt, XCOFFARFMAG, SXCOFFARFMAG);
- mt += SXCOFFARFMAG;
-
- PRINT20 (mt, count);
- mt += XCOFFARMAGBIG_ELEMENT_SIZE;
- for (i = 0; i < (size_t) count; i++)
- {
- PRINT20 (mt, offsets[i]);
- mt += XCOFFARMAGBIG_ELEMENT_SIZE;
- }
-
- if (count)
- {
- free (offsets);
- offsets = NULL;
- }
-
- for (current_bfd = abfd->archive_head; current_bfd != NULL;
- current_bfd = current_bfd->next)
- {
- const char *name;
- size_t namlen;
-
- name = normalize_filename (current_bfd);
- namlen = sprintf (mt, "%s", name);
- mt += namlen + 1;
- }
-
- if (bfd_bwrite (member_table, member_table_size, abfd) != member_table_size)
- return FALSE;
-
- free (member_table);
- member_table = NULL;
-
- PRINT20 (fhdr.memoff, nextoff);
-
- prevoff = nextoff;
- nextoff += member_table_size;
-
- /* Write out the armap, if appropriate. */
-
- if (! makemap || ! hasobjects)
- PRINT20 (fhdr.symoff, 0);
- else
- {
- BFD_ASSERT (nextoff == bfd_tell (abfd));
-
- /* Save nextoff in fhdr.symoff so the armap routine can use it. */
- PRINT20 (fhdr.symoff, nextoff);
-
- bfd_ardata (abfd)->tdata = (PTR) &fhdr;
- if (! _bfd_compute_and_write_armap (abfd, 0))
- return FALSE;
- }
-
- /* Write out the archive file header. */
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR_BIG,
- abfd) != SIZEOF_AR_FILE_HDR_BIG))
- return FALSE;
-
- return TRUE;
-}
-
-bfd_boolean
-_bfd_xcoff_write_archive_contents (abfd)
- bfd *abfd;
-{
- if (! xcoff_big_format_p (abfd))
- return xcoff_write_archive_contents_old (abfd);
- else
- return xcoff_write_archive_contents_big (abfd);
-}
-
-/* We can't use the usual coff_sizeof_headers routine, because AIX
- always uses an a.out header. */
-
-int
-_bfd_xcoff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
-{
- int size;
-
- size = FILHSZ;
- if (xcoff_data (abfd)->full_aouthdr)
- size += AOUTSZ;
- else
- size += SMALL_AOUTSZ;
- size += abfd->section_count * SCNHSZ;
- return size;
-}
-
-/* Routines to swap information in the XCOFF .loader section. If we
- ever need to write an XCOFF loader, this stuff will need to be
- moved to another file shared by the linker (which XCOFF calls the
- ``binder'') and the loader. */
-
-/* Swap in the ldhdr structure. */
-
-static void
-xcoff_swap_ldhdr_in (abfd, s, dst)
- bfd *abfd;
- const PTR s;
- struct internal_ldhdr *dst;
-{
- const struct external_ldhdr *src = (const struct external_ldhdr *) s;
-
- dst->l_version = bfd_get_32 (abfd, src->l_version);
- dst->l_nsyms = bfd_get_32 (abfd, src->l_nsyms);
- dst->l_nreloc = bfd_get_32 (abfd, src->l_nreloc);
- dst->l_istlen = bfd_get_32 (abfd, src->l_istlen);
- dst->l_nimpid = bfd_get_32 (abfd, src->l_nimpid);
- dst->l_impoff = bfd_get_32 (abfd, src->l_impoff);
- dst->l_stlen = bfd_get_32 (abfd, src->l_stlen);
- dst->l_stoff = bfd_get_32 (abfd, src->l_stoff);
-}
-
-/* Swap out the ldhdr structure. */
-
-static void
-xcoff_swap_ldhdr_out (abfd, src, d)
- bfd *abfd;
- const struct internal_ldhdr *src;
- PTR d;
-{
- struct external_ldhdr *dst = (struct external_ldhdr *) d;
-
- bfd_put_32 (abfd, (bfd_vma) src->l_version, dst->l_version);
- bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms);
- bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc);
- bfd_put_32 (abfd, src->l_istlen, dst->l_istlen);
- bfd_put_32 (abfd, src->l_nimpid, dst->l_nimpid);
- bfd_put_32 (abfd, src->l_impoff, dst->l_impoff);
- bfd_put_32 (abfd, src->l_stlen, dst->l_stlen);
- bfd_put_32 (abfd, src->l_stoff, dst->l_stoff);
-}
-
-/* Swap in the ldsym structure. */
-
-static void
-xcoff_swap_ldsym_in (abfd, s, dst)
- bfd *abfd;
- const PTR s;
- struct internal_ldsym *dst;
-{
- const struct external_ldsym *src = (const struct external_ldsym *) s;
-
- if (bfd_get_32 (abfd, src->_l._l_l._l_zeroes) != 0) {
- memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN);
- } else {
- dst->_l._l_l._l_zeroes = 0;
- dst->_l._l_l._l_offset = bfd_get_32 (abfd, src->_l._l_l._l_offset);
- }
- dst->l_value = bfd_get_32 (abfd, src->l_value);
- dst->l_scnum = bfd_get_16 (abfd, src->l_scnum);
- dst->l_smtype = bfd_get_8 (abfd, src->l_smtype);
- dst->l_smclas = bfd_get_8 (abfd, src->l_smclas);
- dst->l_ifile = bfd_get_32 (abfd, src->l_ifile);
- dst->l_parm = bfd_get_32 (abfd, src->l_parm);
-}
-
-/* Swap out the ldsym structure. */
-
-static void
-xcoff_swap_ldsym_out (abfd, src, d)
- bfd *abfd;
- const struct internal_ldsym *src;
- PTR d;
-{
- struct external_ldsym *dst = (struct external_ldsym *) d;
-
- if (src->_l._l_l._l_zeroes != 0)
- memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN);
- else
- {
- bfd_put_32 (abfd, (bfd_vma) 0, dst->_l._l_l._l_zeroes);
- bfd_put_32 (abfd, (bfd_vma) src->_l._l_l._l_offset,
- dst->_l._l_l._l_offset);
- }
- bfd_put_32 (abfd, src->l_value, dst->l_value);
- bfd_put_16 (abfd, (bfd_vma) src->l_scnum, dst->l_scnum);
- bfd_put_8 (abfd, src->l_smtype, dst->l_smtype);
- bfd_put_8 (abfd, src->l_smclas, dst->l_smclas);
- bfd_put_32 (abfd, src->l_ifile, dst->l_ifile);
- bfd_put_32 (abfd, src->l_parm, dst->l_parm);
-}
-
-static void
-xcoff_swap_reloc_in (abfd, s, d)
- bfd *abfd;
- PTR s;
- PTR d;
-{
- struct external_reloc *src = (struct external_reloc *) s;
- struct internal_reloc *dst = (struct internal_reloc *) d;
-
- memset (dst, 0, sizeof (struct internal_reloc));
-
- dst->r_vaddr = bfd_get_32 (abfd, src->r_vaddr);
- dst->r_symndx = bfd_get_32 (abfd, src->r_symndx);
- dst->r_size = bfd_get_8 (abfd, src->r_size);
- dst->r_type = bfd_get_8 (abfd, src->r_type);
-}
-
-static unsigned int
-xcoff_swap_reloc_out (abfd, s, d)
- bfd *abfd;
- PTR s;
- PTR d;
-{
- struct internal_reloc *src = (struct internal_reloc *) s;
- struct external_reloc *dst = (struct external_reloc *) d;
-
- bfd_put_32 (abfd, src->r_vaddr, dst->r_vaddr);
- bfd_put_32 (abfd, src->r_symndx, dst->r_symndx);
- bfd_put_8 (abfd, src->r_type, dst->r_type);
- bfd_put_8 (abfd, src->r_size, dst->r_size);
-
- return bfd_coff_relsz (abfd);
-}
-
-/* Swap in the ldrel structure. */
-
-static void
-xcoff_swap_ldrel_in (abfd, s, dst)
- bfd *abfd;
- const PTR s;
- struct internal_ldrel *dst;
-{
- const struct external_ldrel *src = (const struct external_ldrel *) s;
-
- dst->l_vaddr = bfd_get_32 (abfd, src->l_vaddr);
- dst->l_symndx = bfd_get_32 (abfd, src->l_symndx);
- dst->l_rtype = bfd_get_16 (abfd, src->l_rtype);
- dst->l_rsecnm = bfd_get_16 (abfd, src->l_rsecnm);
-}
-
-/* Swap out the ldrel structure. */
-
-static void
-xcoff_swap_ldrel_out (abfd, src, d)
- bfd *abfd;
- const struct internal_ldrel *src;
- PTR d;
-{
- struct external_ldrel *dst = (struct external_ldrel *) d;
-
- bfd_put_32 (abfd, src->l_vaddr, dst->l_vaddr);
- bfd_put_32 (abfd, src->l_symndx, dst->l_symndx);
- bfd_put_16 (abfd, (bfd_vma) src->l_rtype, dst->l_rtype);
- bfd_put_16 (abfd, (bfd_vma) src->l_rsecnm, dst->l_rsecnm);
-}
-
-
-bfd_boolean
-xcoff_reloc_type_noop (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto ATTRIBUTE_UNUSED;
- bfd_vma val ATTRIBUTE_UNUSED;
- bfd_vma addend ATTRIBUTE_UNUSED;
- bfd_vma *relocation ATTRIBUTE_UNUSED;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- return TRUE;
-}
-
-bfd_boolean
-xcoff_reloc_type_fail (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto ATTRIBUTE_UNUSED;
- bfd_vma val ATTRIBUTE_UNUSED;
- bfd_vma addend ATTRIBUTE_UNUSED;
- bfd_vma *relocation ATTRIBUTE_UNUSED;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- (*_bfd_error_handler)
- (_("%s: unsupported relocation type 0x%02x"),
- bfd_get_filename (input_bfd), (unsigned int) rel->r_type);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
-}
-
-bfd_boolean
-xcoff_reloc_type_pos (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto ATTRIBUTE_UNUSED;
- bfd_vma val;
- bfd_vma addend;
- bfd_vma *relocation;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- *relocation = val + addend;
- return TRUE;
-}
-
-bfd_boolean
-xcoff_reloc_type_neg (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto ATTRIBUTE_UNUSED;
- bfd_vma val;
- bfd_vma addend;
- bfd_vma *relocation;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- *relocation = addend - val;
- return TRUE;
-}
-
-bfd_boolean
-xcoff_reloc_type_rel (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto;
- bfd_vma val;
- bfd_vma addend;
- bfd_vma *relocation;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- howto->pc_relative = TRUE;
-
- /* A PC relative reloc includes the section address. */
- addend += input_section->vma;
-
- *relocation = val + addend;
- *relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- return TRUE;
-}
-
-bfd_boolean
-xcoff_reloc_type_toc (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- struct internal_reloc *rel;
- struct internal_syment *sym;
- struct reloc_howto_struct *howto ATTRIBUTE_UNUSED;
- bfd_vma val;
- bfd_vma addend ATTRIBUTE_UNUSED;
- bfd_vma *relocation;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- struct xcoff_link_hash_entry *h;
-
- if (0 > rel->r_symndx)
- return FALSE;
-
- h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx];
-
- if (h != NULL && h->smclas != XMC_TD)
- {
- if (h->toc_section == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"),
- bfd_get_filename (input_bfd), rel->r_vaddr,
- h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0);
- val = (h->toc_section->output_section->vma
- + h->toc_section->output_offset);
- }
-
- *relocation = ((val - xcoff_data (output_bfd)->toc)
- - (sym->n_value - xcoff_data (input_bfd)->toc));
- return TRUE;
-}
-
-bfd_boolean
-xcoff_reloc_type_ba (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto;
- bfd_vma val;
- bfd_vma addend;
- bfd_vma *relocation;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- howto->src_mask &= ~3;
- howto->dst_mask = howto->src_mask;
-
- *relocation = val + addend;
-
- return TRUE;
-}
-
-static bfd_boolean
-xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd;
- asection *input_section;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto;
- bfd_vma val;
- bfd_vma addend;
- bfd_vma *relocation;
- bfd_byte *contents;
-{
- struct xcoff_link_hash_entry *h;
-
- if (0 > rel->r_symndx)
- return FALSE;
-
- h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx];
-
- /* If we see an R_BR or R_RBR reloc which is jumping to global
- linkage code, and it is followed by an appropriate cror nop
- instruction, we replace the cror with lwz r2,20(r1). This
- restores the TOC after the glink code. Contrariwise, if the
- call is followed by a lwz r2,20(r1), but the call is not
- going to global linkage code, we can replace the load with a
- cror. */
- if (NULL != h
- && bfd_link_hash_defined == h->root.type
- && (rel->r_vaddr - input_section->vma + 8
- <= input_section->_cooked_size))
- {
- bfd_byte *pnext;
- unsigned long next;
-
- pnext = contents + (rel->r_vaddr - input_section->vma) + 4;
- next = bfd_get_32 (input_bfd, pnext);
-
- /* The _ptrgl function is magic. It is used by the AIX
- compiler to call a function through a pointer. */
- if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0)
- {
- if (next == 0x4def7b82 /* cror 15,15,15 */
- || next == 0x4ffffb82 /* cror 31,31,31 */
- || next == 0x60000000) /* ori r0,r0,0 */
- bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */
-
- }
- else
- {
- if (next == 0x80410014) /* lwz r1,20(r1) */
- bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
- }
- }
- else if (NULL != h && bfd_link_hash_undefined == h->root.type)
- {
- /* Normally, this relocation is against a defined symbol. In the
- case where this is a partial link and the output section offset
- is greater than 2^25, the linker will return an invalid error
- message that the relocation has been truncated. Yes it has been
- truncated but no it not important. For this case, disable the
- overflow checking. */
-
- howto->complain_on_overflow = complain_overflow_dont;
- }
-
- howto->pc_relative = TRUE;
- howto->src_mask &= ~3;
- howto->dst_mask = howto->src_mask;
-
- /* A PC relative reloc includes the section address. */
- addend += input_section->vma;
-
- *relocation = val + addend;
- *relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- return TRUE;
-}
-
-bfd_boolean
-xcoff_reloc_type_crel (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto;
- bfd_vma val ATTRIBUTE_UNUSED;
- bfd_vma addend;
- bfd_vma *relocation;
- bfd_byte *contents ATTRIBUTE_UNUSED;
-{
- howto->pc_relative = TRUE;
- howto->src_mask &= ~3;
- howto->dst_mask = howto->src_mask;
-
- /* A PC relative reloc includes the section address. */
- addend += input_section->vma;
-
- *relocation = val + addend;
- *relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- return TRUE;
-}
-
-static bfd_boolean
-xcoff_complain_overflow_dont_func (input_bfd, val, relocation, howto)
- bfd *input_bfd ATTRIBUTE_UNUSED;
- bfd_vma val ATTRIBUTE_UNUSED;
- bfd_vma relocation ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto ATTRIBUTE_UNUSED;
-{
- return FALSE;
-}
-
-static bfd_boolean
-xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
- bfd *input_bfd;
- bfd_vma val;
- bfd_vma relocation;
- struct reloc_howto_struct *howto;
-{
- bfd_vma addrmask, fieldmask, signmask, ss;
- bfd_vma a, b, sum;
-
- /* Get the values to be added together. For signed and unsigned
- relocations, we assume that all values should be truncated to
- the size of an address. For bitfields, all the bits matter.
- See also bfd_check_overflow. */
- fieldmask = N_ONES (howto->bitsize);
- addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
- a = relocation;
- b = val & howto->src_mask;
-
- /* Much like unsigned, except no trimming with addrmask. In
- addition, the sum overflows if there is a carry out of
- the bfd_vma, i.e., the sum is less than either input
- operand. */
- a >>= howto->rightshift;
- b >>= howto->bitpos;
-
- /* Bitfields are sometimes used for signed numbers; for
- example, a 13-bit field sometimes represents values in
- 0..8191 and sometimes represents values in -4096..4095.
- If the field is signed and a is -4095 (0x1001) and b is
- -1 (0x1fff), the sum is -4096 (0x1000), but (0x1001 +
- 0x1fff is 0x3000). It's not clear how to handle this
- everywhere, since there is not way to know how many bits
- are significant in the relocation, but the original code
- assumed that it was fully sign extended, and we will keep
- that assumption. */
- signmask = (fieldmask >> 1) + 1;
-
- if ((a & ~ fieldmask) != 0)
- {
- /* Some bits out of the field are set. This might not
- be a problem: if this is a signed bitfield, it is OK
- iff all the high bits are set, including the sign
- bit. We'll try setting all but the most significant
- bit in the original relocation value: if this is all
- ones, we are OK, assuming a signed bitfield. */
- ss = (signmask << howto->rightshift) - 1;
- if ((ss | relocation) != ~ (bfd_vma) 0)
- return TRUE;
- a &= fieldmask;
- }
-
- /* We just assume (b & ~ fieldmask) == 0. */
-
- /* We explicitly permit wrap around if this relocation
- covers the high bit of an address. The Linux kernel
- relies on it, and it is the only way to write assembler
- code which can run when loaded at a location 0x80000000
- away from the location at which it is linked. */
- if (howto->bitsize + howto->rightshift
- == bfd_arch_bits_per_address (input_bfd))
- return FALSE;
-
- sum = a + b;
- if (sum < a || (sum & ~ fieldmask) != 0)
- {
- /* There was a carry out, or the field overflow. Test
- for signed operands again. Here is the overflow test
- is as for complain_overflow_signed. */
- if (((~ (a ^ b)) & (a ^ sum)) & signmask)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static bfd_boolean
-xcoff_complain_overflow_signed_func (input_bfd, val, relocation, howto)
- bfd *input_bfd;
- bfd_vma val;
- bfd_vma relocation;
- struct reloc_howto_struct *howto;
-{
- bfd_vma addrmask, fieldmask, signmask, ss;
- bfd_vma a, b, sum;
-
- /* Get the values to be added together. For signed and unsigned
- relocations, we assume that all values should be truncated to
- the size of an address. For bitfields, all the bits matter.
- See also bfd_check_overflow. */
- fieldmask = N_ONES (howto->bitsize);
- addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
- a = relocation;
- b = val & howto->src_mask;
-
- a = (a & addrmask) >> howto->rightshift;
-
- /* If any sign bits are set, all sign bits must be set.
- That is, A must be a valid negative address after
- shifting. */
- signmask = ~ (fieldmask >> 1);
- ss = a & signmask;
- if (ss != 0 && ss != ((addrmask >> howto->rightshift) & signmask))
- return TRUE;
-
- /* We only need this next bit of code if the sign bit of B
- is below the sign bit of A. This would only happen if
- SRC_MASK had fewer bits than BITSIZE. Note that if
- SRC_MASK has more bits than BITSIZE, we can get into
- trouble; we would need to verify that B is in range, as
- we do for A above. */
- signmask = ((~ howto->src_mask) >> 1) & howto->src_mask;
- if ((b & signmask) != 0)
- {
- /* Set all the bits above the sign bit. */
- b -= signmask <<= 1;
- }
-
- b = (b & addrmask) >> howto->bitpos;
-
- /* Now we can do the addition. */
- sum = a + b;
-
- /* See if the result has the correct sign. Bits above the
- sign bit are junk now; ignore them. If the sum is
- positive, make sure we did not have all negative inputs;
- if the sum is negative, make sure we did not have all
- positive inputs. The test below looks only at the sign
- bits, and it really just
- SIGN (A) == SIGN (B) && SIGN (A) != SIGN (SUM)
- */
- signmask = (fieldmask >> 1) + 1;
- if (((~ (a ^ b)) & (a ^ sum)) & signmask)
- return TRUE;
-
- return FALSE;
-}
-
-static bfd_boolean
-xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto)
- bfd *input_bfd;
- bfd_vma val;
- bfd_vma relocation;
- struct reloc_howto_struct *howto;
-{
- bfd_vma addrmask, fieldmask;
- bfd_vma a, b, sum;
-
- /* Get the values to be added together. For signed and unsigned
- relocations, we assume that all values should be truncated to
- the size of an address. For bitfields, all the bits matter.
- See also bfd_check_overflow. */
- fieldmask = N_ONES (howto->bitsize);
- addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
- a = relocation;
- b = val & howto->src_mask;
-
- /* Checking for an unsigned overflow is relatively easy:
- trim the addresses and add, and trim the result as well.
- Overflow is normally indicated when the result does not
- fit in the field. However, we also need to consider the
- case when, e.g., fieldmask is 0x7fffffff or smaller, an
- input is 0x80000000, and bfd_vma is only 32 bits; then we
- will get sum == 0, but there is an overflow, since the
- inputs did not fit in the field. Instead of doing a
- separate test, we can check for this by or-ing in the
- operands when testing for the sum overflowing its final
- field. */
- a = (a & addrmask) >> howto->rightshift;
- b = (b & addrmask) >> howto->bitpos;
- sum = (a + b) & addrmask;
- if ((a | b | sum) & ~ fieldmask)
- return TRUE;
-
- return FALSE;
-}
-
-/* This is the relocation function for the RS/6000/POWER/PowerPC.
- This is currently the only processor which uses XCOFF; I hope that
- will never change.
-
- I took the relocation type definitions from two documents:
- the PowerPC AIX Version 4 Application Binary Interface, First
- Edition (April 1992), and the PowerOpen ABI, Big-Endian
- 32-Bit Hardware Implementation (June 30, 1994). Differences
- between the documents are noted below.
-
- Unsupported r_type's
-
- R_RTB:
- R_RRTBI:
- R_RRTBA:
-
- These relocs are defined by the PowerPC ABI to be
- relative branches which use half of the difference
- between the symbol and the program counter. I can't
- quite figure out when this is useful. These relocs are
- not defined by the PowerOpen ABI.
-
- Supported r_type's
-
- R_POS:
- Simple positive relocation.
-
- R_NEG:
- Simple negative relocation.
-
- R_REL:
- Simple PC relative relocation.
-
- R_TOC:
- TOC relative relocation. The value in the instruction in
- the input file is the offset from the input file TOC to
- the desired location. We want the offset from the final
- TOC to the desired location. We have:
- isym = iTOC + in
- iinsn = in + o
- osym = oTOC + on
- oinsn = on + o
- so we must change insn by on - in.
-
- R_GL:
- GL linkage relocation. The value of this relocation
- is the address of the entry in the TOC section.
-
- R_TCL:
- Local object TOC address. I can't figure out the
- difference between this and case R_GL.
-
- R_TRL:
- TOC relative relocation. A TOC relative load instruction
- which may be changed to a load address instruction.
- FIXME: We don't currently implement this optimization.
-
- R_TRLA:
- TOC relative relocation. This is a TOC relative load
- address instruction which may be changed to a load
- instruction. FIXME: I don't know if this is the correct
- implementation.
-
- R_BA:
- Absolute branch. We don't want to mess with the lower
- two bits of the instruction.
-
- R_CAI:
- The PowerPC ABI defines this as an absolute call which
- may be modified to become a relative call. The PowerOpen
- ABI does not define this relocation type.
-
- R_RBA:
- Absolute branch which may be modified to become a
- relative branch.
-
- R_RBAC:
- The PowerPC ABI defines this as an absolute branch to a
- fixed address which may be modified to an absolute branch
- to a symbol. The PowerOpen ABI does not define this
- relocation type.
-
- R_RBRC:
- The PowerPC ABI defines this as an absolute branch to a
- fixed address which may be modified to a relative branch.
- The PowerOpen ABI does not define this relocation type.
-
- R_BR:
- Relative branch. We don't want to mess with the lower
- two bits of the instruction.
-
- R_CREL:
- The PowerPC ABI defines this as a relative call which may
- be modified to become an absolute call. The PowerOpen
- ABI does not define this relocation type.
-
- R_RBR:
- A relative branch which may be modified to become an
- absolute branch. FIXME: We don't implement this,
- although we should for symbols of storage mapping class
- XMC_XO.
-
- R_RL:
- The PowerPC AIX ABI describes this as a load which may be
- changed to a load address. The PowerOpen ABI says this
- is the same as case R_POS.
-
- R_RLA:
- The PowerPC AIX ABI describes this as a load address
- which may be changed to a load. The PowerOpen ABI says
- this is the same as R_POS.
-*/
-
-bfd_boolean
-xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
- input_section, contents, relocs, syms,
- sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
-{
- struct internal_reloc *rel;
- struct internal_reloc *relend;
-
- rel = relocs;
- relend = rel + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- long symndx;
- struct xcoff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma addend;
- bfd_vma val;
- struct reloc_howto_struct howto;
- bfd_vma relocation;
- bfd_vma value_to_relocate;
- bfd_vma address;
- bfd_byte *location;
-
- /* Relocation type R_REF is a special relocation type which is
- merely used to prevent garbage collection from occurring for
- the csect including the symbol which it references. */
- if (rel->r_type == R_REF)
- continue;
-
- /* howto */
- howto.type = rel->r_type;
- howto.rightshift = 0;
- howto.bitsize = (rel->r_size & 0x1f) + 1;
- howto.size = howto.bitsize > 16 ? 2 : 1;
- howto.pc_relative = FALSE;
- howto.bitpos = 0;
- howto.complain_on_overflow = (rel->r_size & 0x80
- ? complain_overflow_signed
- : complain_overflow_bitfield);
- howto.special_function = NULL;
- howto.name = "internal";
- howto.partial_inplace = TRUE;
- howto.src_mask = howto.dst_mask = N_ONES (howto.bitsize);
- howto.pcrel_offset = FALSE;
-
- /* symbol */
- val = 0;
- addend = 0;
- h = NULL;
- sym = NULL;
- symndx = rel->r_symndx;
-
- if (-1 != symndx)
- {
- asection *sec;
-
- h = obj_xcoff_sym_hashes (input_bfd)[symndx];
- sym = syms + symndx;
- addend = - sym->n_value;
-
- if (NULL == h)
- {
- sec = sections[symndx];
- /* Hack to make sure we use the right TOC anchor value
- if this reloc is against the TOC anchor. */
- if (sec->name[3] == '0'
- && strcmp (sec->name, ".tc0") == 0)
- val = xcoff_data (output_bfd)->toc;
- else
- val = (sec->output_section->vma
- + sec->output_offset
- + sym->n_value
- - sec->vma);
- }
- else
- {
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- val = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_common)
- {
- sec = h->root.u.c.p->section;
- val = (sec->output_section->vma
- + sec->output_offset);
-
- }
- else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT)))
- && ! info->relocatable)
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, TRUE)))
- return FALSE;
-
- /* Don't try to process the reloc. It can't help, and
- it may generate another error. */
- continue;
- }
- }
- }
-
- if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION
- || !((*xcoff_calculate_relocation[rel->r_type])
- (input_bfd, input_section, output_bfd, rel, sym, &howto, val,
- addend, &relocation, contents)))
- return FALSE;
-
- /* address */
- address = rel->r_vaddr - input_section->vma;
- location = contents + address;
-
- if (address > input_section->_raw_size)
- abort ();
-
- /* Get the value we are going to relocate. */
- if (1 == howto.size)
- value_to_relocate = bfd_get_16 (input_bfd, location);
- else
- value_to_relocate = bfd_get_32 (input_bfd, location);
-
- /* overflow.
-
- FIXME: We may drop bits during the addition
- which we don't check for. We must either check at every single
- operation, which would be tedious, or we must do the computations
- in a type larger than bfd_vma, which would be inefficient. */
-
- if ((unsigned int) howto.complain_on_overflow
- >= XCOFF_MAX_COMPLAIN_OVERFLOW)
- abort ();
-
- if (((*xcoff_complain_overflow[howto.complain_on_overflow])
- (input_bfd, value_to_relocate, relocation, &howto)))
- {
- const char *name;
- char buf[SYMNMLEN + 1];
- char reloc_type_name[10];
-
- if (symndx == -1)
- {
- name = "*ABS*";
- }
- else if (h != NULL)
- {
- name = h->root.root.string;
- }
- else
- {
- name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
- if (name == NULL)
- name = "UNKNOWN";
- }
- sprintf (reloc_type_name, "0x%02x", rel->r_type);
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, reloc_type_name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
- return FALSE;
- }
-
- /* Add RELOCATION to the right bits of VALUE_TO_RELOCATE. */
- value_to_relocate = ((value_to_relocate & ~howto.dst_mask)
- | (((value_to_relocate & howto.src_mask)
- + relocation) & howto.dst_mask));
-
- /* Put the value back in the object file. */
- if (1 == howto.size)
- bfd_put_16 (input_bfd, value_to_relocate, location);
- else
- bfd_put_32 (input_bfd, value_to_relocate, location);
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-_bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct xcoff_loader_info *ldinfo;
- struct internal_ldsym *ldsym;
- const char *name;
-{
- size_t len;
- len = strlen (name);
-
- if (len <= SYMNMLEN)
- strncpy (ldsym->_l._l_name, name, SYMNMLEN);
- else
- {
- if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
- {
- bfd_size_type newalc;
- bfd_byte *newstrings;
-
- newalc = ldinfo->string_alc * 2;
- if (newalc == 0)
- newalc = 32;
- while (ldinfo->string_size + len + 3 > newalc)
- newalc *= 2;
-
- newstrings = ((bfd_byte *)
- bfd_realloc ((PTR) ldinfo->strings, newalc));
- if (newstrings == NULL)
- {
- ldinfo->failed = TRUE;
- return FALSE;
- }
- ldinfo->string_alc = newalc;
- ldinfo->strings = newstrings;
- }
-
- bfd_put_16 (ldinfo->output_bfd, (bfd_vma) (len + 1),
- ldinfo->strings + ldinfo->string_size);
- strcpy (ldinfo->strings + ldinfo->string_size + 2, name);
- ldsym->_l._l_l._l_zeroes = 0;
- ldsym->_l._l_l._l_offset = ldinfo->string_size + 2;
- ldinfo->string_size += len + 3;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-_bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab,
- struct internal_syment *sym,
- const char *name)
-{
- if (strlen (name) <= SYMNMLEN)
- {
- strncpy (sym->_n._n_name, name, SYMNMLEN);
- }
- else
- {
- bfd_boolean hash;
- bfd_size_type indx;
-
- hash = TRUE;
- if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = FALSE;
- indx = _bfd_stringtab_add (strtab, name, hash, FALSE);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- sym->_n._n_n._n_zeroes = 0;
- sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx;
- }
- return TRUE;
-}
-
-static asection *
-xcoff_create_csect_from_smclas (abfd, aux, symbol_name)
- bfd *abfd;
- union internal_auxent *aux;
- const char *symbol_name;
-{
- asection *return_value = NULL;
-
- /* .sv64 = x_smclas == 17
- This is an invalid csect for 32 bit apps. */
- static const char *names[19] =
- {
- ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
- ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
- ".td", NULL, ".sv3264"
- };
-
- if ((19 >= aux->x_csect.x_smclas)
- && (NULL != names[aux->x_csect.x_smclas]))
- {
- return_value = bfd_make_section_anyway
- (abfd, names[aux->x_csect.x_smclas]);
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: symbol `%s' has unrecognized smclas %d"),
- bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
- bfd_set_error (bfd_error_bad_value);
- }
-
- return return_value;
-}
-
-static bfd_boolean
-xcoff_is_lineno_count_overflow (abfd, value)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_vma value;
-{
- if (0xffff <= value)
- return TRUE;
-
- return FALSE;
-}
-
-static bfd_boolean
-xcoff_is_reloc_count_overflow (abfd, value)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_vma value;
-{
- if (0xffff <= value)
- return TRUE;
-
- return FALSE;
-}
-
-static bfd_vma
-xcoff_loader_symbol_offset (abfd, ldhdr)
- bfd *abfd;
- struct internal_ldhdr *ldhdr ATTRIBUTE_UNUSED;
-{
- return bfd_xcoff_ldhdrsz (abfd);
-}
-
-static bfd_vma
-xcoff_loader_reloc_offset (abfd, ldhdr)
- bfd *abfd;
- struct internal_ldhdr *ldhdr;
-{
- return bfd_xcoff_ldhdrsz (abfd) + ldhdr->l_nsyms * bfd_xcoff_ldsymsz (abfd);
-}
-
-static bfd_boolean
-xcoff_generate_rtinit (abfd, init, fini, rtld)
- bfd *abfd;
- const char *init;
- const char *fini;
- bfd_boolean rtld;
-{
- bfd_byte filehdr_ext[FILHSZ];
- bfd_byte scnhdr_ext[SCNHSZ];
- bfd_byte syment_ext[SYMESZ * 10];
- bfd_byte reloc_ext[RELSZ * 3];
- bfd_byte *data_buffer;
- bfd_size_type data_buffer_size;
- bfd_byte *string_table = NULL, *st_tmp = NULL;
- bfd_size_type string_table_size;
- bfd_vma val;
- size_t initsz, finisz;
- struct internal_filehdr filehdr;
- struct internal_scnhdr scnhdr;
- struct internal_syment syment;
- union internal_auxent auxent;
- struct internal_reloc reloc;
-
- char *data_name = ".data";
- char *rtinit_name = "__rtinit";
- char *rtld_name = "__rtld";
-
- if (! bfd_xcoff_rtinit_size (abfd))
- return FALSE;
-
- initsz = (init == NULL ? 0 : 1 + strlen (init));
- finisz = (fini == NULL ? 0 : 1 + strlen (fini));
-
- /* file header */
- memset (filehdr_ext, 0, FILHSZ);
- memset (&filehdr, 0, sizeof (struct internal_filehdr));
- filehdr.f_magic = bfd_xcoff_magic_number (abfd);
- filehdr.f_nscns = 1;
- filehdr.f_timdat = 0;
- filehdr.f_nsyms = 0; /* at least 6, no more than 10 */
- filehdr.f_symptr = 0; /* set below */
- filehdr.f_opthdr = 0;
- filehdr.f_flags = 0;
-
- /* section header */
- memset (scnhdr_ext, 0, SCNHSZ);
- memset (&scnhdr, 0, sizeof (struct internal_scnhdr));
- memcpy (scnhdr.s_name, data_name, strlen (data_name));
- scnhdr.s_paddr = 0;
- scnhdr.s_vaddr = 0;
- scnhdr.s_size = 0; /* set below */
- scnhdr.s_scnptr = FILHSZ + SCNHSZ;
- scnhdr.s_relptr = 0; /* set below */
- scnhdr.s_lnnoptr = 0;
- scnhdr.s_nreloc = 0; /* either 1 or 2 */
- scnhdr.s_nlnno = 0;
- scnhdr.s_flags = STYP_DATA;
-
- /* .data
- 0x0000 0x00000000 : rtl
- 0x0004 0x00000010 : offset to init, or 0
- 0x0008 0x00000028 : offset to fini, or 0
- 0x000C 0x0000000C : size of descriptor
- 0x0010 0x00000000 : init, needs a reloc
- 0x0014 0x00000040 : offset to init name
- 0x0018 0x00000000 : flags, padded to a word
- 0x001C 0x00000000 : empty init
- 0x0020 0x00000000 :
- 0x0024 0x00000000 :
- 0x0028 0x00000000 : fini, needs a reloc
- 0x002C 0x00000??? : offset to fini name
- 0x0030 0x00000000 : flags, padded to a word
- 0x0034 0x00000000 : empty fini
- 0x0038 0x00000000 :
- 0x003C 0x00000000 :
- 0x0040 init name
- 0x0040 + initsz fini name */
-
- data_buffer_size = 0x0040 + initsz + finisz;
- data_buffer_size = (data_buffer_size + 7) &~ (bfd_size_type) 7;
- data_buffer = NULL;
- data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
- if (data_buffer == NULL)
- return FALSE;
-
- if (initsz)
- {
- val = 0x10;
- bfd_h_put_32 (abfd, val, &data_buffer[0x04]);
- val = 0x40;
- bfd_h_put_32 (abfd, val, &data_buffer[0x14]);
- memcpy (&data_buffer[val], init, initsz);
- }
-
- if (finisz)
- {
- val = 0x28;
- bfd_h_put_32 (abfd, val, &data_buffer[0x08]);
- val = 0x40 + initsz;
- bfd_h_put_32 (abfd, val, &data_buffer[0x2C]);
- memcpy (&data_buffer[val], fini, finisz);
- }
-
- val = 0x0C;
- bfd_h_put_32 (abfd, val, &data_buffer[0x0C]);
-
- scnhdr.s_size = data_buffer_size;
-
- /* string table */
- string_table_size = 0;
- if (initsz > 9)
- string_table_size += initsz;
- if (finisz > 9)
- string_table_size += finisz;
- if (string_table_size)
- {
- string_table_size += 4;
- string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
- if (string_table == NULL)
- return FALSE;
-
- val = string_table_size;
- bfd_h_put_32 (abfd, val, &string_table[0]);
- st_tmp = string_table + 4;
- }
-
- /* symbols
- 0. .data csect
- 2. __rtinit
- 4. init function
- 6. fini function
- 8. __rtld */
- memset (syment_ext, 0, 10 * SYMESZ);
- memset (reloc_ext, 0, 3 * RELSZ);
-
- /* .data csect */
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
- memcpy (syment._n._n_name, data_name, strlen (data_name));
- syment.n_scnum = 1;
- syment.n_sclass = C_HIDEXT;
- syment.n_numaux = 1;
- auxent.x_csect.x_scnlen.l = data_buffer_size;
- auxent.x_csect.x_smtyp = 3 << 3 | XTY_SD;
- auxent.x_csect.x_smclas = XMC_RW;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
- filehdr.f_nsyms += 2;
-
- /* __rtinit */
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
- memcpy (syment._n._n_name, rtinit_name, strlen (rtinit_name));
- syment.n_scnum = 1;
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- auxent.x_csect.x_smtyp = XTY_LD;
- auxent.x_csect.x_smclas = XMC_RW;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
- filehdr.f_nsyms += 2;
-
- /* init */
- if (initsz)
- {
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
-
- if (initsz > 9)
- {
- syment._n._n_n._n_offset = st_tmp - string_table;
- memcpy (st_tmp, init, initsz);
- st_tmp += initsz;
- }
- else
- memcpy (syment._n._n_name, init, initsz - 1);
-
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
-
- /* reloc */
- memset (&reloc, 0, sizeof (struct internal_reloc));
- reloc.r_vaddr = 0x0010;
- reloc.r_symndx = filehdr.f_nsyms;
- reloc.r_type = R_POS;
- reloc.r_size = 31;
- bfd_coff_swap_reloc_out (abfd, &reloc, &reloc_ext[0]);
-
- filehdr.f_nsyms += 2;
- scnhdr.s_nreloc += 1;
- }
-
- /* fini */
- if (finisz)
- {
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
-
- if (finisz > 9)
- {
- syment._n._n_n._n_offset = st_tmp - string_table;
- memcpy (st_tmp, fini, finisz);
- st_tmp += finisz;
- }
- else
- memcpy (syment._n._n_name, fini, finisz - 1);
-
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
-
- /* reloc */
- memset (&reloc, 0, sizeof (struct internal_reloc));
- reloc.r_vaddr = 0x0028;
- reloc.r_symndx = filehdr.f_nsyms;
- reloc.r_type = R_POS;
- reloc.r_size = 31;
- bfd_coff_swap_reloc_out (abfd, &reloc,
- &reloc_ext[scnhdr.s_nreloc * RELSZ]);
-
- filehdr.f_nsyms += 2;
- scnhdr.s_nreloc += 1;
- }
-
- if (rtld)
- {
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
- memcpy (syment._n._n_name, rtld_name, strlen (rtld_name));
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
-
- /* reloc */
- memset (&reloc, 0, sizeof (struct internal_reloc));
- reloc.r_vaddr = 0x0000;
- reloc.r_symndx = filehdr.f_nsyms;
- reloc.r_type = R_POS;
- reloc.r_size = 31;
- bfd_coff_swap_reloc_out (abfd, &reloc,
- &reloc_ext[scnhdr.s_nreloc * RELSZ]);
-
- filehdr.f_nsyms += 2;
- scnhdr.s_nreloc += 1;
- }
-
- scnhdr.s_relptr = scnhdr.s_scnptr + data_buffer_size;
- filehdr.f_symptr = scnhdr.s_relptr + scnhdr.s_nreloc * RELSZ;
-
- bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
- bfd_bwrite (filehdr_ext, FILHSZ, abfd);
- bfd_coff_swap_scnhdr_out (abfd, &scnhdr, scnhdr_ext);
- bfd_bwrite (scnhdr_ext, SCNHSZ, abfd);
- bfd_bwrite (data_buffer, data_buffer_size, abfd);
- bfd_bwrite (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd);
- bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
- bfd_bwrite (string_table, string_table_size, abfd);
-
- free (data_buffer);
- data_buffer = NULL;
-
- return TRUE;
-}
-
-
-static reloc_howto_type xcoff_dynamic_reloc =
-HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* glink
-
- The first word of global linkage code must be modified by filling in
- the correct TOC offset. */
-
-static unsigned long xcoff_glink_code[9] =
- {
- 0x81820000, /* lwz r12,0(r2) */
- 0x90410014, /* stw r2,20(r1) */
- 0x800c0000, /* lwz r0,0(r12) */
- 0x804c0004, /* lwz r2,4(r12) */
- 0x7c0903a6, /* mtctr r0 */
- 0x4e800420, /* bctr */
- 0x00000000, /* start of traceback table */
- 0x000c8000, /* traceback table */
- 0x00000000, /* traceback table */
- };
-
-
-static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
- {
- { /* COFF backend, defined in libcoff.h. */
- _bfd_xcoff_swap_aux_in,
- _bfd_xcoff_swap_sym_in,
- coff_swap_lineno_in,
- _bfd_xcoff_swap_aux_out,
- _bfd_xcoff_swap_sym_out,
- coff_swap_lineno_out,
- xcoff_swap_reloc_out,
- coff_swap_filehdr_out,
- coff_swap_aouthdr_out,
- coff_swap_scnhdr_out,
- FILHSZ,
- AOUTSZ,
- SCNHSZ,
- SYMESZ,
- AUXESZ,
- RELSZ,
- LINESZ,
- FILNMLEN,
- TRUE, /* _bfd_coff_long_filenames */
- FALSE, /* _bfd_coff_long_section_names */
- 3, /* _bfd_coff_default_section_alignment_power */
- FALSE, /* _bfd_coff_force_symnames_in_strings */
- 2, /* _bfd_coff_debug_string_prefix_length */
- coff_swap_filehdr_in,
- coff_swap_aouthdr_in,
- coff_swap_scnhdr_in,
- xcoff_swap_reloc_in,
- coff_bad_format_hook,
- coff_set_arch_mach_hook,
- coff_mkobject_hook,
- styp_to_sec_flags,
- coff_set_alignment_hook,
- coff_slurp_symbol_table,
- symname_in_debug_hook,
- coff_pointerize_aux_hook,
- coff_print_aux,
- dummy_reloc16_extra_cases,
- dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
- coff_compute_section_file_positions,
- NULL, /* _bfd_coff_start_final_link */
- xcoff_ppc_relocate_section,
- coff_rtype_to_howto,
- NULL, /* _bfd_coff_adjust_symndx */
- _bfd_generic_link_add_one_symbol,
- coff_link_output_has_begun,
- coff_final_link_postscript
- },
-
- 0x01DF, /* magic number */
- bfd_arch_rs6000,
- bfd_mach_rs6k,
-
- /* Function pointers to xcoff specific swap routines. */
- xcoff_swap_ldhdr_in,
- xcoff_swap_ldhdr_out,
- xcoff_swap_ldsym_in,
- xcoff_swap_ldsym_out,
- xcoff_swap_ldrel_in,
- xcoff_swap_ldrel_out,
-
- /* Sizes. */
- LDHDRSZ,
- LDSYMSZ,
- LDRELSZ,
- 12, /* _xcoff_function_descriptor_size */
- SMALL_AOUTSZ,
-
- /* Versions. */
- 1, /* _xcoff_ldhdr_version */
-
- _bfd_xcoff_put_symbol_name,
- _bfd_xcoff_put_ldsymbol_name,
- &xcoff_dynamic_reloc,
- xcoff_create_csect_from_smclas,
-
- /* Lineno and reloc count overflow. */
- xcoff_is_lineno_count_overflow,
- xcoff_is_reloc_count_overflow,
-
- xcoff_loader_symbol_offset,
- xcoff_loader_reloc_offset,
-
- /* glink. */
- &xcoff_glink_code[0],
- 36, /* _xcoff_glink_size */
-
- /* rtinit */
- 64, /* _xcoff_rtinit_size */
- xcoff_generate_rtinit,
- };
-
-/* The transfer vector that leads the outside world to all of the above. */
-const bfd_target rs6000coff_vec =
- {
- "aixcoff-rs6000",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
- | HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
- SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
- 0, /* leading char */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
-
- /* data */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- /* hdrs */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- _bfd_xcoff_archive_p,
- CORE_FILE_P
- },
-
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
-
- {/* bfd_write_contents */
- bfd_false,
- coff_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
-
- /* Generic */
- bfd_true,
- bfd_true,
- coff_new_section_hook,
- _bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
-
- /* Copy */
- _bfd_xcoff_copy_private_bfd_data,
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
- ((bfd_boolean (*) (bfd *, void * )) bfd_true),
-
- /* Core */
- coff_core_file_failing_command,
- coff_core_file_failing_signal,
- coff_core_file_matches_executable_p,
-
- /* Archive */
- _bfd_xcoff_slurp_armap,
- bfd_false,
- ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
- bfd_dont_truncate_arname,
- _bfd_xcoff_write_armap,
- _bfd_xcoff_read_ar_hdr,
- _bfd_xcoff_openr_next_archived_file,
- _bfd_generic_get_elt_at_index,
- _bfd_xcoff_stat_arch_elt,
- bfd_true,
-
- /* Symbols */
- coff_get_symtab_upper_bound,
- coff_canonicalize_symtab,
- coff_make_empty_symbol,
- coff_print_symbol,
- coff_get_symbol_info,
- _bfd_xcoff_is_local_label_name,
- coff_get_lineno,
- coff_find_nearest_line,
- coff_bfd_make_debug_symbol,
- _bfd_generic_read_minisymbols,
- _bfd_generic_minisymbol_to_symbol,
-
- /* Reloc */
- coff_get_reloc_upper_bound,
- coff_canonicalize_reloc,
- _bfd_xcoff_reloc_type_lookup,
-
- /* Write */
- coff_set_arch_mach,
- coff_set_section_contents,
-
- /* Link */
- _bfd_xcoff_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
- bfd_generic_relax_section,
- _bfd_xcoff_bfd_link_hash_table_create,
- _bfd_generic_link_hash_table_free,
- _bfd_xcoff_bfd_link_add_symbols,
- _bfd_generic_link_just_syms,
- _bfd_xcoff_bfd_final_link,
- _bfd_generic_link_split_section,
- bfd_generic_gc_sections,
- bfd_generic_merge_sections,
- bfd_generic_discard_group,
-
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_symtab,
- _bfd_xcoff_get_dynamic_reloc_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_reloc,
-
- /* Opposite endian version, none exists */
- NULL,
-
- (void *) &bfd_xcoff_backend_data,
- };
-
-/* xcoff-powermac target
- Old target.
- Only difference between this target and the rs6000 target is the
- the default architecture and machine type used in coffcode.h
-
- PowerPC Macs use the same magic numbers as RS/6000
- (because that's how they were bootstrapped originally),
- but they are always PowerPC architecture. */
-static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
- {
- { /* COFF backend, defined in libcoff.h. */
- _bfd_xcoff_swap_aux_in,
- _bfd_xcoff_swap_sym_in,
- coff_swap_lineno_in,
- _bfd_xcoff_swap_aux_out,
- _bfd_xcoff_swap_sym_out,
- coff_swap_lineno_out,
- xcoff_swap_reloc_out,
- coff_swap_filehdr_out,
- coff_swap_aouthdr_out,
- coff_swap_scnhdr_out,
- FILHSZ,
- AOUTSZ,
- SCNHSZ,
- SYMESZ,
- AUXESZ,
- RELSZ,
- LINESZ,
- FILNMLEN,
- TRUE, /* _bfd_coff_long_filenames */
- FALSE, /* _bfd_coff_long_section_names */
- 3, /* _bfd_coff_default_section_alignment_power */
- FALSE, /* _bfd_coff_force_symnames_in_strings */
- 2, /* _bfd_coff_debug_string_prefix_length */
- coff_swap_filehdr_in,
- coff_swap_aouthdr_in,
- coff_swap_scnhdr_in,
- xcoff_swap_reloc_in,
- coff_bad_format_hook,
- coff_set_arch_mach_hook,
- coff_mkobject_hook,
- styp_to_sec_flags,
- coff_set_alignment_hook,
- coff_slurp_symbol_table,
- symname_in_debug_hook,
- coff_pointerize_aux_hook,
- coff_print_aux,
- dummy_reloc16_extra_cases,
- dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
- coff_compute_section_file_positions,
- NULL, /* _bfd_coff_start_final_link */
- xcoff_ppc_relocate_section,
- coff_rtype_to_howto,
- NULL, /* _bfd_coff_adjust_symndx */
- _bfd_generic_link_add_one_symbol,
- coff_link_output_has_begun,
- coff_final_link_postscript
- },
-
- 0x01DF, /* magic number */
- bfd_arch_powerpc,
- bfd_mach_ppc,
-
- /* Function pointers to xcoff specific swap routines. */
- xcoff_swap_ldhdr_in,
- xcoff_swap_ldhdr_out,
- xcoff_swap_ldsym_in,
- xcoff_swap_ldsym_out,
- xcoff_swap_ldrel_in,
- xcoff_swap_ldrel_out,
-
- /* Sizes. */
- LDHDRSZ,
- LDSYMSZ,
- LDRELSZ,
- 12, /* _xcoff_function_descriptor_size */
- SMALL_AOUTSZ,
-
- /* Versions. */
- 1, /* _xcoff_ldhdr_version */
-
- _bfd_xcoff_put_symbol_name,
- _bfd_xcoff_put_ldsymbol_name,
- &xcoff_dynamic_reloc,
- xcoff_create_csect_from_smclas,
-
- /* Lineno and reloc count overflow. */
- xcoff_is_lineno_count_overflow,
- xcoff_is_reloc_count_overflow,
-
- xcoff_loader_symbol_offset,
- xcoff_loader_reloc_offset,
-
- /* glink. */
- &xcoff_glink_code[0],
- 36, /* _xcoff_glink_size */
-
- /* rtinit */
- 0, /* _xcoff_rtinit_size */
- xcoff_generate_rtinit,
- };
-
-/* The transfer vector that leads the outside world to all of the above. */
-const bfd_target pmac_xcoff_vec =
- {
- "xcoff-powermac",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
- | HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
- SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
- 0, /* leading char */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
-
- /* data */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- /* hdrs */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- _bfd_xcoff_archive_p,
- CORE_FILE_P
- },
-
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
-
- {/* bfd_write_contents */
- bfd_false,
- coff_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
-
- /* Generic */
- bfd_true,
- bfd_true,
- coff_new_section_hook,
- _bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
-
- /* Copy */
- _bfd_xcoff_copy_private_bfd_data,
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
- ((bfd_boolean (*) (bfd *, void * )) bfd_true),
-
- /* Core */
- coff_core_file_failing_command,
- coff_core_file_failing_signal,
- coff_core_file_matches_executable_p,
-
- /* Archive */
- _bfd_xcoff_slurp_armap,
- bfd_false,
- ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
- bfd_dont_truncate_arname,
- _bfd_xcoff_write_armap,
- _bfd_xcoff_read_ar_hdr,
- _bfd_xcoff_openr_next_archived_file,
- _bfd_generic_get_elt_at_index,
- _bfd_xcoff_stat_arch_elt,
- bfd_true,
-
- /* Symbols */
- coff_get_symtab_upper_bound,
- coff_canonicalize_symtab,
- coff_make_empty_symbol,
- coff_print_symbol,
- coff_get_symbol_info,
- _bfd_xcoff_is_local_label_name,
- coff_get_lineno,
- coff_find_nearest_line,
- coff_bfd_make_debug_symbol,
- _bfd_generic_read_minisymbols,
- _bfd_generic_minisymbol_to_symbol,
-
- /* Reloc */
- coff_get_reloc_upper_bound,
- coff_canonicalize_reloc,
- _bfd_xcoff_reloc_type_lookup,
-
- /* Write */
- coff_set_arch_mach,
- coff_set_section_contents,
-
- /* Link */
- _bfd_xcoff_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
- bfd_generic_relax_section,
- _bfd_xcoff_bfd_link_hash_table_create,
- _bfd_generic_link_hash_table_free,
- _bfd_xcoff_bfd_link_add_symbols,
- _bfd_generic_link_just_syms,
- _bfd_xcoff_bfd_final_link,
- _bfd_generic_link_split_section,
- bfd_generic_gc_sections,
- bfd_generic_merge_sections,
- bfd_generic_discard_group,
-
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_symtab,
- _bfd_xcoff_get_dynamic_reloc_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_reloc,
-
- /* Opposite endian version, none exists */
- NULL,
-
- (void *) &bfd_pmac_xcoff_backend_data,
- };
diff --git a/contrib/binutils/bfd/coff-sparc.c b/contrib/binutils/bfd/coff-sparc.c
deleted file mode 100644
index 372b1a7..0000000
--- a/contrib/binutils/bfd/coff-sparc.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/* BFD back-end for Sparc COFF files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "coff/sparc.h"
-#include "coff/internal.h"
-#include "libcoff.h"
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
-
-#define BADMAG(x) ((x).f_magic != SPARCMAGIC && (x).f_magic != LYNXCOFFMAGIC)
-
-/* The page size is a guess based on ELF. */
-#define COFF_PAGE_SIZE 0x10000
-
-
-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,
- R_SPARC_8, R_SPARC_16, R_SPARC_32,
- R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
- R_SPARC_WDISP30, R_SPARC_WDISP22,
- R_SPARC_HI22, R_SPARC_22,
- R_SPARC_13, R_SPARC_LO10,
- R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
- R_SPARC_PC10, R_SPARC_PC22,
- R_SPARC_WPLT30,
- R_SPARC_COPY,
- R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
- R_SPARC_RELATIVE,
- R_SPARC_UA32,
- R_SPARC_max
- };
-
-#if 0
-static const char *const reloc_type_names[] =
-{
- "R_SPARC_NONE",
- "R_SPARC_8", "R_SPARC_16", "R_SPARC_32",
- "R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32",
- "R_SPARC_WDISP30", "R_SPARC_WDISP22",
- "R_SPARC_HI22", "R_SPARC_22",
- "R_SPARC_13", "R_SPARC_LO10",
- "R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22",
- "R_SPARC_PC10", "R_SPARC_PC22",
- "R_SPARC_WPLT30",
- "R_SPARC_COPY",
- "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT",
- "R_SPARC_RELATIVE",
- "R_SPARC_UA32",
-};
-#endif
-
-/* This is stolen pretty directly from elf.c. */
-static bfd_reloc_status_type
-bfd_coff_generic_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR,
- asection *, bfd *, char **));
-
-static bfd_reloc_status_type
-bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- return bfd_reloc_continue;
-}
-
-static reloc_howto_type coff_sparc_howto_table[] =
-{
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP32", FALSE,0,0x00ffffff,TRUE),
- HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_PC10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_PC22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_WPLT30, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_WPLT30", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE),
-};
-
-struct coff_reloc_map {
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char coff_reloc_val;
-};
-
-static const struct coff_reloc_map sparc_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_SPARC_NONE, },
- { BFD_RELOC_16, R_SPARC_16, },
- { BFD_RELOC_8, R_SPARC_8 },
- { BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
- { BFD_RELOC_CTOR, R_SPARC_32 }, /* @@ Assumes 32 bits. */
- { BFD_RELOC_32, R_SPARC_32 },
- { BFD_RELOC_32_PCREL, R_SPARC_DISP32 },
- { BFD_RELOC_HI22, R_SPARC_HI22 },
- { BFD_RELOC_LO10, R_SPARC_LO10, },
- { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
- { BFD_RELOC_SPARC22, R_SPARC_22 },
- { BFD_RELOC_SPARC13, R_SPARC_13 },
- { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
- { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 },
- { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 },
- { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 },
- { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 },
- { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 },
- { BFD_RELOC_SPARC_COPY, R_SPARC_COPY },
- { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT },
- { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
- { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
- { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
- /* { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
-};
-
-static reloc_howto_type *
-coff_sparc_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- unsigned int i;
- for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct coff_reloc_map); i++)
- {
- if (sparc_reloc_map[i].bfd_reloc_val == code)
- return &coff_sparc_howto_table[(int) sparc_reloc_map[i].coff_reloc_val];
- }
- return 0;
-}
-#define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup
-
-static void
-rtype2howto (cache_ptr, dst)
- arelent *cache_ptr;
- struct internal_reloc *dst;
-{
- BFD_ASSERT (dst->r_type < (unsigned int) R_SPARC_max);
- cache_ptr->howto = &coff_sparc_howto_table[dst->r_type];
-}
-
-#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
-
-#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;
-
-/* Clear the r_spare field in relocs. */
-#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
- do { \
- dst->r_spare[0] = 0; \
- dst->r_spare[1] = 0; \
- } while (0)
-
-#define __A_MAGIC_SET__
-
-/* Enable Sparc-specific hacks in coffcode.h. */
-
-#define COFF_SPARC
-
-#include "coffcode.h"
-
-#ifndef TARGET_SYM
-#define TARGET_SYM sparccoff_vec
-#endif
-
-#ifndef TARGET_NAME
-#define TARGET_NAME "coff-sparc"
-#endif
-
-CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL, COFF_SWAP_TABLE)
diff --git a/contrib/binutils/bfd/coff64-rs6000.c b/contrib/binutils/bfd/coff64-rs6000.c
deleted file mode 100644
index ec9c695..0000000
--- a/contrib/binutils/bfd/coff64-rs6000.c
+++ /dev/null
@@ -1,2995 +0,0 @@
-/* BFD back-end for IBM RS/6000 "XCOFF64" files.
- Copyright 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written Clinton Popetz.
- Contributed by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "coff/xcoff.h"
-#include "coff/rs6k64.h"
-#include "libcoff.h"
-#include "libxcoff.h"
-
-#define GET_FILEHDR_SYMPTR H_GET_64
-#define PUT_FILEHDR_SYMPTR H_PUT_64
-#define GET_AOUTHDR_DATA_START H_GET_64
-#define PUT_AOUTHDR_DATA_START H_PUT_64
-#define GET_AOUTHDR_TEXT_START H_GET_64
-#define PUT_AOUTHDR_TEXT_START H_PUT_64
-#define GET_AOUTHDR_TSIZE H_GET_64
-#define PUT_AOUTHDR_TSIZE H_PUT_64
-#define GET_AOUTHDR_DSIZE H_GET_64
-#define PUT_AOUTHDR_DSIZE H_PUT_64
-#define GET_AOUTHDR_BSIZE H_GET_64
-#define PUT_AOUTHDR_BSIZE H_PUT_64
-#define GET_AOUTHDR_ENTRY H_GET_64
-#define PUT_AOUTHDR_ENTRY H_PUT_64
-#define GET_SCNHDR_PADDR H_GET_64
-#define PUT_SCNHDR_PADDR H_PUT_64
-#define GET_SCNHDR_VADDR H_GET_64
-#define PUT_SCNHDR_VADDR H_PUT_64
-#define GET_SCNHDR_SIZE H_GET_64
-#define PUT_SCNHDR_SIZE H_PUT_64
-#define GET_SCNHDR_SCNPTR H_GET_64
-#define PUT_SCNHDR_SCNPTR H_PUT_64
-#define GET_SCNHDR_RELPTR H_GET_64
-#define PUT_SCNHDR_RELPTR H_PUT_64
-#define GET_SCNHDR_LNNOPTR H_GET_64
-#define PUT_SCNHDR_LNNOPTR H_PUT_64
-#define GET_SCNHDR_NRELOC H_GET_32
-#define MAX_SCNHDR_NRELOC 0xffffffff
-#define PUT_SCNHDR_NRELOC H_PUT_32
-#define GET_SCNHDR_NLNNO H_GET_32
-#define MAX_SCNHDR_NLNNO 0xffffffff
-#define PUT_SCNHDR_NLNNO H_PUT_32
-#define GET_RELOC_VADDR H_GET_64
-#define PUT_RELOC_VADDR H_PUT_64
-
-#define COFF_FORCE_SYMBOLS_IN_STRINGS
-#define COFF_DEBUG_STRING_WIDE_PREFIX
-
-
-#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \
- do \
- { \
- memset (((SCNHDR *) EXT)->s_pad, 0, \
- sizeof (((SCNHDR *) EXT)->s_pad)); \
- } \
- while (0)
-
-#define NO_COFF_LINENOS
-
-#define coff_SWAP_lineno_in _bfd_xcoff64_swap_lineno_in
-#define coff_SWAP_lineno_out _bfd_xcoff64_swap_lineno_out
-
-static void _bfd_xcoff64_swap_lineno_in
- PARAMS ((bfd *, PTR, PTR));
-static unsigned int _bfd_xcoff64_swap_lineno_out
- PARAMS ((bfd *, PTR, PTR));
-static bfd_boolean _bfd_xcoff64_put_symbol_name
- PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *,
- const char *));
-static bfd_boolean _bfd_xcoff64_put_ldsymbol_name
- PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
- const char *));
-static void _bfd_xcoff64_swap_sym_in
- PARAMS ((bfd *, PTR, PTR));
-static unsigned int _bfd_xcoff64_swap_sym_out
- PARAMS ((bfd *, PTR, PTR));
-static void _bfd_xcoff64_swap_aux_in
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static unsigned int _bfd_xcoff64_swap_aux_out
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static void xcoff64_swap_reloc_in
- PARAMS ((bfd *, PTR, PTR));
-static unsigned int xcoff64_swap_reloc_out
- PARAMS ((bfd *, PTR, PTR));
-extern bfd_boolean _bfd_xcoff_mkobject
- PARAMS ((bfd *));
-extern bfd_boolean _bfd_xcoff_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
-extern bfd_boolean _bfd_xcoff_is_local_label_name
- PARAMS ((bfd *, const char *));
-extern void xcoff64_rtype2howto
- PARAMS ((arelent *, struct internal_reloc *));
-extern reloc_howto_type * xcoff64_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-extern bfd_boolean _bfd_xcoff_slurp_armap
- PARAMS ((bfd *));
-extern PTR _bfd_xcoff_read_ar_hdr
- PARAMS ((bfd *));
-extern bfd *_bfd_xcoff_openr_next_archived_file
- PARAMS ((bfd *, bfd *));
-extern int _bfd_xcoff_stat_arch_elt
- PARAMS ((bfd *, struct stat *));
-extern bfd_boolean _bfd_xcoff_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-extern bfd_boolean _bfd_xcoff_write_archive_contents
- PARAMS ((bfd *));
-extern int _bfd_xcoff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-extern void _bfd_xcoff_swap_sym_in
- PARAMS ((bfd *, PTR, PTR));
-extern unsigned int _bfd_xcoff_swap_sym_out
- PARAMS ((bfd *, PTR, PTR));
-extern void _bfd_xcoff_swap_aux_in
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-extern unsigned int _bfd_xcoff_swap_aux_out
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static void xcoff64_swap_ldhdr_in
- PARAMS ((bfd *, const PTR, struct internal_ldhdr *));
-static void xcoff64_swap_ldhdr_out
- PARAMS ((bfd *, const struct internal_ldhdr *, PTR d));
-static void xcoff64_swap_ldsym_in
- PARAMS ((bfd *, const PTR, struct internal_ldsym *));
-static void xcoff64_swap_ldsym_out
- PARAMS ((bfd *, const struct internal_ldsym *, PTR d));
-static void xcoff64_swap_ldrel_in
- PARAMS ((bfd *, const PTR, struct internal_ldrel *));
-static void xcoff64_swap_ldrel_out
- PARAMS ((bfd *, const struct internal_ldrel *, PTR d));
-static bfd_boolean xcoff64_write_object_contents
- PARAMS ((bfd *));
-static bfd_boolean xcoff64_ppc_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *,
- asection **));
-static bfd_boolean xcoff64_slurp_armap
- PARAMS ((bfd *));
-static const bfd_target *xcoff64_archive_p
- PARAMS ((bfd *));
-static bfd *xcoff64_openr_next_archived_file
- PARAMS ((bfd *, bfd *));
-static int xcoff64_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-static asection *xcoff64_create_csect_from_smclas
- PARAMS ((bfd *, union internal_auxent *, const char *));
-static bfd_boolean xcoff64_is_lineno_count_overflow
- PARAMS ((bfd *, bfd_vma));
-static bfd_boolean xcoff64_is_reloc_count_overflow
- PARAMS ((bfd *, bfd_vma));
-static bfd_vma xcoff64_loader_symbol_offset
- PARAMS ((bfd *, struct internal_ldhdr *));
-static bfd_vma xcoff64_loader_reloc_offset
- PARAMS ((bfd *, struct internal_ldhdr *));
-static bfd_boolean xcoff64_generate_rtinit
- PARAMS ((bfd *, const char *, const char *, bfd_boolean));
-static bfd_boolean xcoff64_bad_format_hook
- PARAMS ((bfd *, PTR ));
-
-/* Relocation functions */
-static bfd_boolean xcoff64_reloc_type_br
- PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-
-bfd_boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
- PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)) =
-{
- xcoff_reloc_type_pos, /* R_POS (0x00) */
- xcoff_reloc_type_neg, /* R_NEG (0x01) */
- xcoff_reloc_type_rel, /* R_REL (0x02) */
- xcoff_reloc_type_toc, /* R_TOC (0x03) */
- xcoff_reloc_type_fail, /* R_RTB (0x04) */
- xcoff_reloc_type_toc, /* R_GL (0x05) */
- xcoff_reloc_type_toc, /* R_TCL (0x06) */
- xcoff_reloc_type_fail, /* (0x07) */
- xcoff_reloc_type_ba, /* R_BA (0x08) */
- xcoff_reloc_type_fail, /* (0x09) */
- xcoff64_reloc_type_br, /* R_BR (0x0a) */
- xcoff_reloc_type_fail, /* (0x0b) */
- xcoff_reloc_type_pos, /* R_RL (0x0c) */
- xcoff_reloc_type_pos, /* R_RLA (0x0d) */
- xcoff_reloc_type_fail, /* (0x0e) */
- xcoff_reloc_type_noop, /* R_REF (0x0f) */
- xcoff_reloc_type_fail, /* (0x10) */
- xcoff_reloc_type_fail, /* (0x11) */
- xcoff_reloc_type_toc, /* R_TRL (0x12) */
- xcoff_reloc_type_toc, /* R_TRLA (0x13) */
- xcoff_reloc_type_fail, /* R_RRTBI (0x14) */
- xcoff_reloc_type_fail, /* R_RRTBA (0x15) */
- xcoff_reloc_type_ba, /* R_CAI (0x16) */
- xcoff_reloc_type_crel, /* R_CREL (0x17) */
- xcoff_reloc_type_ba, /* R_RBA (0x18) */
- xcoff_reloc_type_ba, /* R_RBAC (0x19) */
- xcoff64_reloc_type_br, /* R_RBR (0x1a) */
- xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
-};
-
-/* coffcode.h needs these to be defined. */
-/* Internalcoff.h and coffcode.h modify themselves based on these flags. */
-#define XCOFF64
-#define RS6000COFF_C 1
-
-#define SELECT_RELOC(internal, howto) \
- { \
- internal.r_type = howto->type; \
- internal.r_size = \
- ((howto->complain_on_overflow == complain_overflow_signed \
- ? 0x80 \
- : 0) \
- | (howto->bitsize - 1)); \
- }
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
-#define COFF_LONG_FILENAMES
-#define NO_COFF_SYMBOLS
-#define RTYPE2HOWTO(cache_ptr, dst) xcoff64_rtype2howto (cache_ptr, dst)
-#define coff_mkobject _bfd_xcoff_mkobject
-#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
-#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
-#define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup
-#ifdef AIX_CORE
-extern const bfd_target * rs6000coff_core_p
- PARAMS ((bfd *abfd));
-extern bfd_boolean rs6000coff_core_file_matches_executable_p
- PARAMS ((bfd *cbfd, bfd *ebfd));
-extern char *rs6000coff_core_file_failing_command
- PARAMS ((bfd *abfd));
-extern int rs6000coff_core_file_failing_signal
- PARAMS ((bfd *abfd));
-#define CORE_FILE_P rs6000coff_core_p
-#define coff_core_file_failing_command \
- rs6000coff_core_file_failing_command
-#define coff_core_file_failing_signal \
- rs6000coff_core_file_failing_signal
-#define coff_core_file_matches_executable_p \
- rs6000coff_core_file_matches_executable_p
-#else
-#define CORE_FILE_P _bfd_dummy_target
-#define coff_core_file_failing_command \
- _bfd_nocore_core_file_failing_command
-#define coff_core_file_failing_signal \
- _bfd_nocore_core_file_failing_signal
-#define coff_core_file_matches_executable_p \
- _bfd_nocore_core_file_matches_executable_p
-#endif
-#define coff_SWAP_sym_in _bfd_xcoff64_swap_sym_in
-#define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out
-#define coff_SWAP_aux_in _bfd_xcoff64_swap_aux_in
-#define coff_SWAP_aux_out _bfd_xcoff64_swap_aux_out
-#define coff_swap_reloc_in xcoff64_swap_reloc_in
-#define coff_swap_reloc_out xcoff64_swap_reloc_out
-#define NO_COFF_RELOCS
-
-#include "coffcode.h"
-
-/* For XCOFF64, the effective width of symndx changes depending on
- whether we are the first entry. Sigh. */
-static void
-_bfd_xcoff64_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
-{
- LINENO *ext = (LINENO *) ext1;
- struct internal_lineno *in = (struct internal_lineno *) in1;
-
- in->l_lnno = H_GET_32 (abfd, (ext->l_lnno));
- if (in->l_lnno == 0)
- in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx);
- else
- in->l_addr.l_paddr = H_GET_64 (abfd, ext->l_addr.l_paddr);
-}
-
-static unsigned int
-_bfd_xcoff64_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
-{
- struct internal_lineno *in = (struct internal_lineno *) inp;
- struct external_lineno *ext = (struct external_lineno *) outp;
-
- H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
- H_PUT_32 (abfd, in->l_lnno, (ext->l_lnno));
-
- if (in->l_lnno == 0)
- H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
- else
- H_PUT_64 (abfd, in->l_addr.l_paddr, ext->l_addr.l_paddr);
-
- return bfd_coff_linesz (abfd);
-}
-
-static void
-_bfd_xcoff64_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
-{
- struct external_syment *ext = (struct external_syment *) ext1;
- struct internal_syment *in = (struct internal_syment *) in1;
-
- in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e_offset);
- in->n_value = H_GET_64 (abfd, ext->e_value);
- in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
- in->n_type = H_GET_16 (abfd, ext->e_type);
- in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
- in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
-}
-
-static unsigned int
-_bfd_xcoff64_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
-{
- struct internal_syment *in = (struct internal_syment *) inp;
- struct external_syment *ext = (struct external_syment *) extp;
-
- H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e_offset);
- H_PUT_64 (abfd, in->n_value, ext->e_value);
- H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
- H_PUT_16 (abfd, in->n_type, ext->e_type);
- H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
- H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
- return bfd_coff_symesz (abfd);
-}
-
-static void
-_bfd_xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx;
- int numaux;
- PTR in1;
-{
- union external_auxent *ext = (union external_auxent *) ext1;
- union internal_auxent *in = (union internal_auxent *) in1;
-
- switch (class)
- {
- case C_FILE:
- if (ext->x_file.x_n.x_zeroes[0] == 0)
- {
- in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
- }
- else
- {
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- }
- goto end;
-
- /* RS/6000 "csect" auxents */
- case C_EXT:
- case C_HIDEXT:
- if (indx + 1 == numaux)
- {
- bfd_signed_vma h = 0;
- bfd_vma l = 0;
-
- h = H_GET_S32 (abfd, ext->x_csect.x_scnlen_hi);
- l = H_GET_32 (abfd, ext->x_csect.x_scnlen_lo);
-
- in->x_csect.x_scnlen.l = h << 32 | (l & 0xffffffff);
-
- in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash);
- in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash);
- /* We don't have to hack bitfields in x_smtyp because it's
- defined by shifts-and-ands, which are equivalent on all
- byte orders. */
- in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp);
- in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas);
- goto end;
- }
- break;
-
- case C_STAT:
- case C_LEAFSTAT:
- case C_HIDDEN:
- if (type == T_NULL)
- {
- /* PE defines some extra fields; we zero them out for
- safety. */
- in->x_scn.x_checksum = 0;
- in->x_scn.x_associated = 0;
- in->x_scn.x_comdat = 0;
-
- goto end;
- }
- break;
- }
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- in->x_sym.x_fcnary.x_fcn.x_lnnoptr
- = H_GET_64 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
- in->x_sym.x_fcnary.x_fcn.x_endndx.l
- = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx);
- }
- if (ISFCN (type))
- {
- in->x_sym.x_misc.x_fsize
- = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_fsize);
- }
- else
- {
- in->x_sym.x_misc.x_lnsz.x_lnno
- = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_lnno);
- in->x_sym.x_misc.x_lnsz.x_size
- = H_GET_16 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_size);
- }
-
- end: ;
-}
-
-static unsigned int
-_bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd *abfd;
- PTR inp;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR extp;
-{
- union internal_auxent *in = (union internal_auxent *) inp;
- union external_auxent *ext = (union external_auxent *) extp;
-
- memset ((PTR) ext, 0, bfd_coff_auxesz (abfd));
- switch (class)
- {
- case C_FILE:
- if (in->x_file.x_n.x_zeroes == 0)
- {
- H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
- H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
- }
- else
- {
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
- }
- H_PUT_8 (abfd, _AUX_FILE, ext->x_auxtype.x_auxtype);
- goto end;
-
- /* RS/6000 "csect" auxents */
- case C_EXT:
- case C_HIDEXT:
- if (indx + 1 == numaux)
- {
- bfd_vma temp;
-
- temp = in->x_csect.x_scnlen.l & 0xffffffff;
- H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_lo);
- temp = in->x_csect.x_scnlen.l >> 32;
- H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_hi);
- H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash);
- H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash);
- /* We don't have to hack bitfields in x_smtyp because it's
- defined by shifts-and-ands, which are equivalent on all
- byte orders. */
- H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
- H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
- H_PUT_8 (abfd, _AUX_CSECT, ext->x_auxtype.x_auxtype);
- goto end;
- }
- break;
-
- case C_STAT:
- case C_LEAFSTAT:
- case C_HIDDEN:
- if (type == T_NULL)
- {
- goto end;
- }
- break;
- }
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- H_PUT_64 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
- ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
- H_PUT_8 (abfd, _AUX_FCN,
- ext->x_auxtype.x_auxtype);
- H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
- ext->x_sym.x_fcnary.x_fcn.x_endndx);
- }
- if (ISFCN (type))
- {
- H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize,
- ext->x_sym.x_fcnary.x_fcn.x_fsize);
- }
- else
- {
- H_PUT_32 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
- ext->x_sym.x_fcnary.x_lnsz.x_lnno);
- H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size,
- ext->x_sym.x_fcnary.x_lnsz.x_size);
- }
-
- end:
-
- return bfd_coff_auxesz (abfd);
-}
-
-static bfd_boolean
-_bfd_xcoff64_put_symbol_name (abfd, strtab, sym, name)
- bfd *abfd;
- struct bfd_strtab_hash *strtab;
- struct internal_syment *sym;
- const char *name;
-{
- bfd_boolean hash;
- bfd_size_type indx;
-
- hash = TRUE;
-
- if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = FALSE;
-
- indx = _bfd_stringtab_add (strtab, name, hash, FALSE);
-
- if (indx == (bfd_size_type) -1)
- return FALSE;
-
- sym->_n._n_n._n_zeroes = 0;
- sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx;
-
- return TRUE;
-}
-
-static bfd_boolean
-_bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct xcoff_loader_info *ldinfo;
- struct internal_ldsym *ldsym;
- const char *name;
-{
- size_t len;
- len = strlen (name);
-
- if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
- {
- bfd_size_type newalc;
- bfd_byte *newstrings;
-
- newalc = ldinfo->string_alc * 2;
- if (newalc == 0)
- newalc = 32;
- while (ldinfo->string_size + len + 3 > newalc)
- newalc *= 2;
-
- newstrings = ((bfd_byte *)
- bfd_realloc ((PTR) ldinfo->strings, newalc));
- if (newstrings == NULL)
- {
- ldinfo->failed = TRUE;
- return FALSE;
- }
- ldinfo->string_alc = newalc;
- ldinfo->strings = newstrings;
- }
-
- bfd_put_16 (ldinfo->output_bfd, (bfd_vma) (len + 1),
- ldinfo->strings + ldinfo->string_size);
- strcpy (ldinfo->strings + ldinfo->string_size + 2, name);
- ldsym->_l._l_l._l_zeroes = 0;
- ldsym->_l._l_l._l_offset = ldinfo->string_size + 2;
- ldinfo->string_size += len + 3;
-
- return TRUE;
-}
-
-/* Routines to swap information in the XCOFF .loader section. If we
- ever need to write an XCOFF loader, this stuff will need to be
- moved to another file shared by the linker (which XCOFF calls the
- ``binder'') and the loader. */
-
-/* Swap in the ldhdr structure. */
-
-static void
-xcoff64_swap_ldhdr_in (abfd, s, dst)
- bfd *abfd;
- const PTR s;
- struct internal_ldhdr *dst;
-{
- const struct external_ldhdr *src = (const struct external_ldhdr *) s;
-
- dst->l_version = bfd_get_32 (abfd, src->l_version);
- dst->l_nsyms = bfd_get_32 (abfd, src->l_nsyms);
- dst->l_nreloc = bfd_get_32 (abfd, src->l_nreloc);
- dst->l_istlen = bfd_get_32 (abfd, src->l_istlen);
- dst->l_nimpid = bfd_get_32 (abfd, src->l_nimpid);
- dst->l_stlen = bfd_get_32 (abfd, src->l_stlen);
- dst->l_impoff = bfd_get_64 (abfd, src->l_impoff);
- dst->l_stoff = bfd_get_64 (abfd, src->l_stoff);
- dst->l_symoff = bfd_get_64 (abfd, src->l_symoff);
- dst->l_rldoff = bfd_get_64 (abfd, src->l_rldoff);
-}
-
-/* Swap out the ldhdr structure. */
-
-static void
-xcoff64_swap_ldhdr_out (abfd, src, d)
- bfd *abfd;
- const struct internal_ldhdr *src;
- PTR d;
-{
- struct external_ldhdr *dst = (struct external_ldhdr *) d;
-
- bfd_put_32 (abfd, (bfd_vma) src->l_version, dst->l_version);
- bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms);
- bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc);
- bfd_put_32 (abfd, src->l_istlen, dst->l_istlen);
- bfd_put_32 (abfd, src->l_nimpid, dst->l_nimpid);
- bfd_put_32 (abfd, src->l_stlen, dst->l_stlen);
- bfd_put_64 (abfd, src->l_impoff, dst->l_impoff);
- bfd_put_64 (abfd, src->l_stoff, dst->l_stoff);
- bfd_put_64 (abfd, src->l_symoff, dst->l_symoff);
- bfd_put_64 (abfd, src->l_rldoff, dst->l_rldoff);
-}
-
-/* Swap in the ldsym structure. */
-
-static void
-xcoff64_swap_ldsym_in (abfd, s, dst)
- bfd *abfd;
- const PTR s;
- struct internal_ldsym *dst;
-{
- const struct external_ldsym *src = (const struct external_ldsym *) s;
- /* XCOFF64 does not use l_zeroes like XCOFF32
- Set the internal l_zeroes to 0 so the common 32/64 code uses l_value
- as an offset into the loader symbol table. */
- dst->_l._l_l._l_zeroes = 0;
- dst->_l._l_l._l_offset = bfd_get_32 (abfd, src->l_offset);
- dst->l_value = bfd_get_64 (abfd, src->l_value);
- dst->l_scnum = bfd_get_16 (abfd, src->l_scnum);
- dst->l_smtype = bfd_get_8 (abfd, src->l_smtype);
- dst->l_smclas = bfd_get_8 (abfd, src->l_smclas);
- dst->l_ifile = bfd_get_32 (abfd, src->l_ifile);
- dst->l_parm = bfd_get_32 (abfd, src->l_parm);
-}
-
-/* Swap out the ldsym structure. */
-
-static void
-xcoff64_swap_ldsym_out (abfd, src, d)
- bfd *abfd;
- const struct internal_ldsym *src;
- PTR d;
-{
- struct external_ldsym *dst = (struct external_ldsym *) d;
-
- bfd_put_64 (abfd, src->l_value, dst->l_value);
- bfd_put_32 (abfd, (bfd_vma) src->_l._l_l._l_offset, dst->l_offset);
- bfd_put_16 (abfd, (bfd_vma) src->l_scnum, dst->l_scnum);
- bfd_put_8 (abfd, src->l_smtype, dst->l_smtype);
- bfd_put_8 (abfd, src->l_smclas, dst->l_smclas);
- bfd_put_32 (abfd, src->l_ifile, dst->l_ifile);
- bfd_put_32 (abfd, src->l_parm, dst->l_parm);
-}
-
-static void
-xcoff64_swap_reloc_in (abfd, s, d)
- bfd *abfd;
- PTR s;
- PTR d;
-{
- struct external_reloc *src = (struct external_reloc *) s;
- struct internal_reloc *dst = (struct internal_reloc *) d;
-
- memset (dst, 0, sizeof (struct internal_reloc));
-
- dst->r_vaddr = bfd_get_64 (abfd, src->r_vaddr);
- dst->r_symndx = bfd_get_32 (abfd, src->r_symndx);
- dst->r_size = bfd_get_8 (abfd, src->r_size);
- dst->r_type = bfd_get_8 (abfd, src->r_type);
-}
-
-static unsigned int
-xcoff64_swap_reloc_out (abfd, s, d)
- bfd *abfd;
- PTR s;
- PTR d;
-{
- struct internal_reloc *src = (struct internal_reloc *) s;
- struct external_reloc *dst = (struct external_reloc *) d;
-
- bfd_put_64 (abfd, src->r_vaddr, dst->r_vaddr);
- bfd_put_32 (abfd, src->r_symndx, dst->r_symndx);
- bfd_put_8 (abfd, src->r_type, dst->r_type);
- bfd_put_8 (abfd, src->r_size, dst->r_size);
-
- return bfd_coff_relsz (abfd);
-}
-
-/* Swap in the ldrel structure. */
-
-static void
-xcoff64_swap_ldrel_in (abfd, s, dst)
- bfd *abfd;
- const PTR s;
- struct internal_ldrel *dst;
-{
- const struct external_ldrel *src = (const struct external_ldrel *) s;
-
- dst->l_vaddr = bfd_get_64 (abfd, src->l_vaddr);
- dst->l_symndx = bfd_get_32 (abfd, src->l_symndx);
- dst->l_rtype = bfd_get_16 (abfd, src->l_rtype);
- dst->l_rsecnm = bfd_get_16 (abfd, src->l_rsecnm);
-}
-
-/* Swap out the ldrel structure. */
-
-static void
-xcoff64_swap_ldrel_out (abfd, src, d)
- bfd *abfd;
- const struct internal_ldrel *src;
- PTR d;
-{
- struct external_ldrel *dst = (struct external_ldrel *) d;
-
- bfd_put_64 (abfd, src->l_vaddr, dst->l_vaddr);
- bfd_put_16 (abfd, (bfd_vma) src->l_rtype, dst->l_rtype);
- bfd_put_16 (abfd, (bfd_vma) src->l_rsecnm, dst->l_rsecnm);
- bfd_put_32 (abfd, src->l_symndx, dst->l_symndx);
-}
-
-static bfd_boolean
-xcoff64_write_object_contents (abfd)
- bfd *abfd;
-{
- asection *current;
- bfd_boolean hasrelocs = FALSE;
- bfd_boolean haslinno = FALSE;
- file_ptr scn_base;
- file_ptr reloc_base;
- file_ptr lineno_base;
- file_ptr sym_base;
- unsigned long reloc_size = 0;
- unsigned long lnno_size = 0;
- bfd_boolean long_section_names;
- asection *text_sec = ((void *) 0);
- asection *data_sec = ((void *) 0);
- asection *bss_sec = ((void *) 0);
- struct internal_filehdr internal_f;
- struct internal_aouthdr internal_a;
-
- bfd_set_error (bfd_error_system_call);
-
- if (! abfd->output_has_begun)
- {
- if (! bfd_coff_compute_section_file_positions (abfd))
- return FALSE;
- }
-
- /* Work out the size of the reloc and linno areas. */
- reloc_base = obj_relocbase (abfd);
-
- for (current = abfd->sections; current != NULL; current = current->next)
- reloc_size += current->reloc_count * bfd_coff_relsz (abfd);
-
- lineno_base = reloc_base + reloc_size;
-
- /* Make a pass through the symbol table to count line number entries and
- put them into the correct asections. */
- lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
-
- sym_base = lineno_base + lnno_size;
-
- /* Indicate in each section->line_filepos its actual file address. */
- for (current = abfd->sections; current != NULL; current = current->next)
- {
- if (current->lineno_count)
- {
- current->line_filepos = lineno_base;
- current->moving_line_filepos = lineno_base;
- lineno_base += current->lineno_count * bfd_coff_linesz (abfd);
- }
- else
- {
- current->line_filepos = 0;
- }
-
- if (current->reloc_count)
- {
- current->rel_filepos = reloc_base;
- reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
- }
- else
- {
- current->rel_filepos = 0;
- }
- }
-
- if ((abfd->flags & EXEC_P) != 0)
- {
- scn_base = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
- internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
- }
- else
- {
- scn_base = bfd_coff_filhsz (abfd);
- internal_f.f_opthdr = 0;
- }
-
- internal_f.f_nscns = 0;
-
- if (bfd_seek (abfd, scn_base, SEEK_SET) != 0)
- return FALSE;
-
- long_section_names = FALSE;
- for (current = abfd->sections; current != NULL; current = current->next)
- {
- struct internal_scnhdr section;
- struct external_scnhdr buff;
- bfd_size_type amount;
-
- internal_f.f_nscns++;
-
- strncpy (section.s_name, current->name, SCNNMLEN);
-
- section.s_vaddr = current->vma;
- section.s_paddr = current->lma;
- section.s_size = current->_raw_size;
-
- /* If this section has no size or is unloadable then the scnptr
- will be 0 too. */
- if (current->_raw_size == 0
- || (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
- {
- section.s_scnptr = 0;
- }
- else
- {
- section.s_scnptr = current->filepos;
- }
-
- section.s_relptr = current->rel_filepos;
- section.s_lnnoptr = current->line_filepos;
- section.s_nreloc = current->reloc_count;
-
- section.s_nlnno = current->lineno_count;
- if (current->reloc_count != 0)
- hasrelocs = TRUE;
- if (current->lineno_count != 0)
- haslinno = TRUE;
-
- section.s_flags = sec_to_styp_flags (current->name, current->flags);
-
- if (!strcmp (current->name, _TEXT))
- {
- text_sec = current;
- }
- else if (!strcmp (current->name, _DATA))
- {
- data_sec = current;
- }
- else if (!strcmp (current->name, _BSS))
- {
- bss_sec = current;
- }
-
- amount = bfd_coff_scnhsz (abfd);
- if (bfd_coff_swap_scnhdr_out (abfd, &section, &buff) == 0
- || bfd_bwrite ((PTR) (&buff), amount, abfd) != amount)
- return FALSE;
- }
-
- internal_f.f_timdat = 0;
-
- internal_f.f_flags = 0;
-
- if (!hasrelocs)
- internal_f.f_flags |= F_RELFLG;
- if (!haslinno)
- internal_f.f_flags |= F_LNNO;
- if (abfd->flags & EXEC_P)
- internal_f.f_flags |= F_EXEC;
-
- /* FIXME: this is wrong for PPC_PE! */
- if (bfd_little_endian (abfd))
- internal_f.f_flags |= F_AR32WR;
- else
- internal_f.f_flags |= F_AR32W;
-
- if ((abfd->flags & DYNAMIC) != 0)
- internal_f.f_flags |= F_SHROBJ;
- if (bfd_get_section_by_name (abfd, _LOADER) != NULL)
- internal_f.f_flags |= F_DYNLOAD;
-
- memset (&internal_a, 0, sizeof internal_a);
-
- internal_f.f_magic = bfd_xcoff_magic_number (abfd);
- internal_a.magic = (abfd->flags & D_PAGED
- ? RS6K_AOUTHDR_ZMAGIC
- : (abfd->flags & WP_TEXT
- ? RS6K_AOUTHDR_NMAGIC
- : RS6K_AOUTHDR_OMAGIC));
-
- /* FIXME: Does anybody ever set this to another value? */
- internal_a.vstamp = 0;
-
- /* Now should write relocs, strings, syms. */
- obj_sym_filepos (abfd) = sym_base;
-
- internal_f.f_symptr = 0;
- internal_f.f_nsyms = 0;
-
- /* If bfd_get_symcount (abfd) != 0, then we are not using the COFF
- backend linker, and obj_raw_syment_count is not valid until after
- coff_write_symbols is called. */
- if (bfd_get_symcount (abfd) != 0)
- {
- int firstundef;
-
- if (!coff_renumber_symbols (abfd, &firstundef))
- return FALSE;
- coff_mangle_symbols (abfd);
- if (! coff_write_symbols (abfd))
- return FALSE;
- if (! coff_write_linenumbers (abfd))
- return FALSE;
- if (! coff_write_relocs (abfd, firstundef))
- return FALSE;
-
- internal_f.f_symptr = sym_base;
- internal_f.f_nsyms = bfd_get_symcount (abfd);
- }
- else if (obj_raw_syment_count (abfd) != 0)
- {
- internal_f.f_symptr = sym_base;
-
- /* AIX appears to require that F_RELFLG not be set if there are
- local symbols but no relocations. */
- internal_f.f_flags &=~ F_RELFLG;
- }
- else
- {
- internal_f.f_flags |= F_LSYMS;
- }
-
- if (text_sec)
- {
- internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
- internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
- }
-
- if (data_sec)
- {
- internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
- internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
- }
-
- if (bss_sec)
- {
- internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
- if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
- internal_a.data_start = bss_sec->vma;
- }
-
- internal_a.entry = bfd_get_start_address (abfd);
- internal_f.f_nsyms = obj_raw_syment_count (abfd);
-
- if (xcoff_data (abfd)->full_aouthdr)
- {
- bfd_vma toc;
- asection *loader_sec;
-
- internal_a.vstamp = 1;
-
- internal_a.o_snentry = xcoff_data (abfd)->snentry;
- if (internal_a.o_snentry == 0)
- internal_a.entry = (bfd_vma) -1;
-
- if (text_sec != NULL)
- {
- internal_a.o_sntext = text_sec->target_index;
- internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec);
- }
- else
- {
- internal_a.o_sntext = 0;
- internal_a.o_algntext = 0;
- }
-
- if (data_sec != NULL)
- {
- internal_a.o_sndata = data_sec->target_index;
- internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec);
- }
- else
- {
- internal_a.o_sndata = 0;
- internal_a.o_algndata = 0;
- }
-
- loader_sec = bfd_get_section_by_name (abfd, ".loader");
- if (loader_sec != NULL)
- internal_a.o_snloader = loader_sec->target_index;
- else
- internal_a.o_snloader = 0;
- if (bss_sec != NULL)
- internal_a.o_snbss = bss_sec->target_index;
- else
- internal_a.o_snbss = 0;
-
- toc = xcoff_data (abfd)->toc;
- internal_a.o_toc = toc;
- internal_a.o_sntoc = xcoff_data (abfd)->sntoc;
-
- internal_a.o_modtype = xcoff_data (abfd)->modtype;
- if (xcoff_data (abfd)->cputype != -1)
- internal_a.o_cputype = xcoff_data (abfd)->cputype;
- else
- {
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_rs6000:
- internal_a.o_cputype = 4;
- break;
- case bfd_arch_powerpc:
- if (bfd_get_mach (abfd) == bfd_mach_ppc)
- internal_a.o_cputype = 3;
- else
- internal_a.o_cputype = 1;
- break;
- default:
- abort ();
- }
- }
- internal_a.o_maxstack = xcoff_data (abfd)->maxstack;
- internal_a.o_maxdata = xcoff_data (abfd)->maxdata;
- }
-
- if (bfd_seek (abfd, (file_ptr) 0, 0) != 0)
- return FALSE;
-
- {
- char * buff;
- bfd_size_type amount = bfd_coff_filhsz (abfd);
-
- buff = bfd_malloc (amount);
- if (buff == NULL)
- return FALSE;
-
- bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
-
- free (buff);
-
- if (amount != bfd_coff_filhsz (abfd))
- return FALSE;
- }
-
- if (abfd->flags & EXEC_P)
- {
- char * buff;
- bfd_size_type amount = bfd_coff_aoutsz (abfd);
-
- buff = bfd_malloc (amount);
- if (buff == NULL)
- return FALSE;
-
- bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
-
- free (buff);
-
- if (amount != bfd_coff_aoutsz (abfd))
- return FALSE;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
- val, addend, relocation, contents)
- bfd *input_bfd;
- asection *input_section;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct internal_reloc *rel;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- struct reloc_howto_struct *howto;
- bfd_vma val;
- bfd_vma addend;
- bfd_vma *relocation;
- bfd_byte *contents;
-{
- struct xcoff_link_hash_entry *h;
-
- if (0 > rel->r_symndx)
- return FALSE;
-
- h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx];
-
- /* If we see an R_BR or R_RBR reloc which is jumping to global
- linkage code, and it is followed by an appropriate cror nop
- instruction, we replace the cror with ld r2,40(r1). This
- restores the TOC after the glink code. Contrariwise, if the
- call is followed by a ld r2,40(r1), but the call is not
- going to global linkage code, we can replace the load with a
- cror. */
- if (NULL != h
- && bfd_link_hash_defined == h->root.type
- && (rel->r_vaddr - input_section->vma + 8
- <= input_section->_cooked_size))
- {
- bfd_byte *pnext;
- unsigned long next;
-
- pnext = contents + (rel->r_vaddr - input_section->vma) + 4;
- next = bfd_get_32 (input_bfd, pnext);
-
- /* The _ptrgl function is magic. It is used by the AIX compiler to call
- a function through a pointer. */
- if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0)
- {
- if (next == 0x4def7b82 /* cror 15,15,15 */
- || next == 0x4ffffb82 /* cror 31,31,31 */
- || next == 0x60000000) /* ori r0,r0,0 */
- bfd_put_32 (input_bfd, 0xe8410028, pnext); /* ld r2,40(r1) */
- }
- else
- {
- if (next == 0xe8410028) /* ld r2,40(r1) */
- bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
- }
- }
- else if (NULL != h && bfd_link_hash_undefined == h->root.type)
- {
- /* Normally, this relocation is against a defined symbol. In the
- case where this is a partial link and the output section offset
- is greater than 2^25, the linker will return an invalid error
- message that the relocation has been truncated. Yes it has been
- truncated but no it not important. For this case, disable the
- overflow checking. */
- howto->complain_on_overflow = complain_overflow_dont;
- }
-
- howto->pc_relative = TRUE;
- howto->src_mask &= ~3;
- howto->dst_mask = howto->src_mask;
-
- /* A PC relative reloc includes the section address. */
- addend += input_section->vma;
-
- *relocation = val + addend;
- *relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- return TRUE;
-}
-
-/* This is the relocation function for the PowerPC64.
- See xcoff_ppc_relocation_section for more information. */
-
-bfd_boolean
-xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
- input_section, contents, relocs, syms,
- sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
-{
- struct internal_reloc *rel;
- struct internal_reloc *relend;
-
- rel = relocs;
- relend = rel + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- long symndx;
- struct xcoff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma addend;
- bfd_vma val;
- struct reloc_howto_struct howto;
- bfd_vma relocation;
- bfd_vma value_to_relocate;
- bfd_vma address;
- bfd_byte *location;
-
- /* Relocation type R_REF is a special relocation type which is
- merely used to prevent garbage collection from occurring for
- the csect including the symbol which it references. */
- if (rel->r_type == R_REF)
- continue;
-
- /* howto */
- howto.type = rel->r_type;
- howto.rightshift = 0;
- howto.bitsize = (rel->r_size & 0x3f) + 1;
- howto.size = howto.bitsize > 16 ? (howto.bitsize > 32 ? 4 : 2) : 1;
- howto.pc_relative = FALSE;
- howto.bitpos = 0;
- howto.complain_on_overflow = (rel->r_size & 0x80
- ? complain_overflow_signed
- : complain_overflow_bitfield);
- howto.special_function = NULL;
- howto.name = "internal";
- howto.partial_inplace = TRUE;
- howto.src_mask = howto.dst_mask = N_ONES (howto.bitsize);
- howto.pcrel_offset = FALSE;
-
- /* symbol */
- val = 0;
- addend = 0;
- h = NULL;
- sym = NULL;
- symndx = rel->r_symndx;
-
- if (-1 != symndx)
- {
- asection *sec;
-
- h = obj_xcoff_sym_hashes (input_bfd)[symndx];
- sym = syms + symndx;
- addend = - sym->n_value;
-
- if (NULL == h)
- {
- sec = sections[symndx];
- /* Hack to make sure we use the right TOC anchor value
- if this reloc is against the TOC anchor. */
- if (sec->name[3] == '0'
- && strcmp (sec->name, ".tc0") == 0)
- val = xcoff_data (output_bfd)->toc;
- else
- val = (sec->output_section->vma
- + sec->output_offset
- + sym->n_value
- - sec->vma);
- }
- else
- {
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- val = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_common)
- {
- sec = h->root.u.c.p->section;
- val = (sec->output_section->vma
- + sec->output_offset);
- }
- else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT)))
- && ! info->relocatable)
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, TRUE)))
- return FALSE;
-
- /* Don't try to process the reloc. It can't help, and
- it may generate another error. */
- continue;
- }
- }
- }
-
- if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION
- || !((*xcoff64_calculate_relocation[rel->r_type])
- (input_bfd, input_section, output_bfd, rel, sym, &howto, val,
- addend, &relocation, contents)))
- return FALSE;
-
- /* address */
- address = rel->r_vaddr - input_section->vma;
- location = contents + address;
-
- if (address > input_section->_raw_size)
- abort ();
-
- /* Get the value we are going to relocate. */
- if (1 == howto.size)
- value_to_relocate = bfd_get_16 (input_bfd, location);
- else if (2 == howto.size)
- value_to_relocate = bfd_get_32 (input_bfd, location);
- else
- value_to_relocate = bfd_get_64 (input_bfd, location);
-
- /* overflow.
-
- FIXME: We may drop bits during the addition
- which we don't check for. We must either check at every single
- operation, which would be tedious, or we must do the computations
- in a type larger than bfd_vma, which would be inefficient. */
-
- if ((unsigned int) howto.complain_on_overflow
- >= XCOFF_MAX_COMPLAIN_OVERFLOW)
- abort ();
-
- if (((*xcoff_complain_overflow[howto.complain_on_overflow])
- (input_bfd, value_to_relocate, relocation, &howto)))
- {
- const char *name;
- char buf[SYMNMLEN + 1];
- char reloc_type_name[10];
-
- if (symndx == -1)
- {
- name = "*ABS*";
- }
- else if (h != NULL)
- {
- name = h->root.root.string;
- }
- else
- {
- name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
- if (name == NULL)
- name = "UNKNOWN";
- }
- sprintf (reloc_type_name, "0x%02x", rel->r_type);
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, reloc_type_name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
- return FALSE;
- }
-
- /* Add RELOCATION to the right bits of VALUE_TO_RELOCATE. */
- value_to_relocate = ((value_to_relocate & ~howto.dst_mask)
- | (((value_to_relocate & howto.src_mask)
- + relocation) & howto.dst_mask));
-
- /* Put the value back in the object file. */
- if (1 == howto.size)
- bfd_put_16 (input_bfd, value_to_relocate, location);
- else if (2 == howto.size)
- bfd_put_32 (input_bfd, value_to_relocate, location);
- else
- bfd_put_64 (input_bfd, value_to_relocate, location);
-
- }
- return TRUE;
-}
-
-
-/* The XCOFF reloc table. Actually, XCOFF relocations specify the
- bitsize and whether they are signed or not, along with a
- conventional type. This table is for the types, which are used for
- different algorithms for putting in the reloc. Many of these
- relocs need special_function entries, which I have not written. */
-
-reloc_howto_type xcoff64_howto_table[] =
-{
- /* Standard 64 bit relocation. */
- HOWTO (R_POS, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS_64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit relocation, but store negative value. */
- HOWTO (R_NEG, /* type */
- 0, /* rightshift */
- -4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_NEG", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit PC relative relocation. */
- HOWTO (R_REL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit TOC relative relocation. */
- HOWTO (R_TOC, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TOC", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* I don't really know what this is. */
- HOWTO (R_RTB, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RTB", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* External TOC relative symbol. */
- HOWTO (R_GL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_GL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Local TOC relative symbol. */
- HOWTO (R_TCL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TCL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (7),
-
- /* Non modifiable absolute branch. */
- HOWTO (R_BA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA_26", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (9),
-
- /* Non modifiable relative branch. */
- HOWTO (R_BR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_BR", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (0xb),
-
- /* Indirect load. */
- HOWTO (R_RL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Load address. */
- HOWTO (R_RLA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RLA", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (0xe),
-
- /* Non-relocating reference. */
- HOWTO (R_REF, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "R_REF", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (0x10),
- EMPTY_HOWTO (0x11),
-
- /* TOC relative indirect load. */
- HOWTO (R_TRL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* TOC relative load address. */
- HOWTO (R_TRLA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRLA", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable relative branch. */
- HOWTO (R_RRTBI, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBI", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable absolute branch. */
- HOWTO (R_RRTBA, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBA", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable call absolute indirect. */
- HOWTO (R_CAI, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CAI", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable call relative. */
- HOWTO (R_CREL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CREL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch absolute. */
- HOWTO (R_RBA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch absolute. */
- HOWTO (R_RBAC, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBAC", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch relative. */
- HOWTO (R_RBR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR_26", /* name */
- TRUE, /* partial_inplace */
- 0x03fffffc, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch absolute. */
- HOWTO (R_RBRC, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBRC", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_POS, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit Non modifiable absolute branch. */
- HOWTO (R_BA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA_16", /* name */
- TRUE, /* partial_inplace */
- 0xfffc, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch relative. */
- HOWTO (R_RBR, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR_16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Modifiable branch absolute. */
- HOWTO (R_RBA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA_16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
-};
-
-void
-xcoff64_rtype2howto (relent, internal)
- arelent *relent;
- struct internal_reloc *internal;
-{
- if (internal->r_type > R_RBRC)
- abort ();
-
- /* Default howto layout works most of the time */
- relent->howto = &xcoff64_howto_table[internal->r_type];
-
- /* Special case some 16 bit reloc */
- if (15 == (internal->r_size & 0x3f))
- {
- if (R_BA == internal->r_type)
- relent->howto = &xcoff64_howto_table[0x1d];
- else if (R_RBR == internal->r_type)
- relent->howto = &xcoff64_howto_table[0x1e];
- else if (R_RBA == internal->r_type)
- relent->howto = &xcoff64_howto_table[0x1f];
- }
- /* Special case 32 bit */
- else if (31 == (internal->r_size & 0x3f))
- {
- if (R_POS == internal->r_type)
- relent->howto = &xcoff64_howto_table[0x1c];
- }
-
- /* The r_size field of an XCOFF reloc encodes the bitsize of the
- relocation, as well as indicating whether it is signed or not.
- Doublecheck that the relocation information gathered from the
- type matches this information. The bitsize is not significant
- for R_REF relocs. */
- if (relent->howto->dst_mask != 0
- && (relent->howto->bitsize
- != ((unsigned int) internal->r_size & 0x3f) + 1))
- abort ();
-}
-
-reloc_howto_type *
-xcoff64_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- case BFD_RELOC_PPC_B26:
- return &xcoff64_howto_table[0xa];
- case BFD_RELOC_PPC_BA16:
- return &xcoff64_howto_table[0x1d];
- case BFD_RELOC_PPC_BA26:
- return &xcoff64_howto_table[8];
- case BFD_RELOC_PPC_TOC16:
- return &xcoff64_howto_table[3];
- case BFD_RELOC_32:
- case BFD_RELOC_CTOR:
- return &xcoff64_howto_table[0x1c];
- case BFD_RELOC_64:
- return &xcoff64_howto_table[0];
- default:
- return NULL;
- }
-}
-
-/* Read in the armap of an XCOFF archive. */
-
-static bfd_boolean
-xcoff64_slurp_armap (abfd)
- bfd *abfd;
-{
- file_ptr off;
- size_t namlen;
- bfd_size_type sz, amt;
- bfd_byte *contents, *cend;
- bfd_vma c, i;
- carsym *arsym;
- bfd_byte *p;
- file_ptr pos;
-
- /* This is for the new format. */
- struct xcoff_ar_hdr_big hdr;
-
- if (xcoff_ardata (abfd) == NULL)
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- off = bfd_scan_vma (xcoff_ardata_big (abfd)->symoff64,
- (const char **) NULL, 10);
- if (off == 0)
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- if (bfd_seek (abfd, off, SEEK_SET) != 0)
- return FALSE;
-
- /* The symbol table starts with a normal archive header. */
- if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
- != SIZEOF_AR_HDR_BIG)
- return FALSE;
-
- /* Skip the name (normally empty). */
- namlen = strtol (hdr.namlen, (char **) NULL, 10);
- pos = ((namlen + 1) & ~(size_t) 1) + SXCOFFARFMAG;
- if (bfd_seek (abfd, pos, SEEK_CUR) != 0)
- return FALSE;
-
- sz = bfd_scan_vma (hdr.size, (const char **) NULL, 10);
-
- /* Read in the entire symbol table. */
- contents = (bfd_byte *) bfd_alloc (abfd, sz);
- if (contents == NULL)
- return FALSE;
- if (bfd_bread ((PTR) contents, sz, abfd) != sz)
- return FALSE;
-
- /* The symbol table starts with an eight byte count. */
- c = H_GET_64 (abfd, contents);
-
- if (c * 8 >= sz)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- amt = c;
- amt *= sizeof (carsym);
- bfd_ardata (abfd)->symdefs = (carsym *) bfd_alloc (abfd, amt);
- if (bfd_ardata (abfd)->symdefs == NULL)
- return FALSE;
-
- /* After the count comes a list of eight byte file offsets. */
- for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
- i < c;
- ++i, ++arsym, p += 8)
- arsym->file_offset = H_GET_64 (abfd, p);
-
- /* After the file offsets come null terminated symbol names. */
- cend = contents + sz;
- for (i = 0, arsym = bfd_ardata (abfd)->symdefs;
- i < c;
- ++i, ++arsym, p += strlen ((char *) p) + 1)
- {
- if (p >= cend)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- arsym->name = (char *) p;
- }
-
- bfd_ardata (abfd)->symdef_count = c;
- bfd_has_map (abfd) = TRUE;
-
- return TRUE;
-}
-
-
-/* See if this is an NEW XCOFF archive. */
-
-static const bfd_target *
-xcoff64_archive_p (abfd)
- bfd *abfd;
-{
- struct artdata *tdata_hold;
- char magic[SXCOFFARMAG];
- /* This is the new format. */
- struct xcoff_ar_file_hdr_big hdr;
- bfd_size_type amt = SXCOFFARMAG;
-
- if (bfd_bread ((PTR) magic, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Copy over the magic string. */
- memcpy (hdr.magic, magic, SXCOFFARMAG);
-
- /* Now read the rest of the file header. */
- amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
- if (bfd_bread ((PTR) &hdr.memoff, amt, abfd) != amt)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- tdata_hold = bfd_ardata (abfd);
-
- amt = sizeof (struct artdata);
- bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd) == (struct artdata *) NULL)
- goto error_ret_restore;
-
- bfd_ardata (abfd)->cache = NULL;
- bfd_ardata (abfd)->archive_head = NULL;
- bfd_ardata (abfd)->symdefs = NULL;
- bfd_ardata (abfd)->extended_names = NULL;
- bfd_ardata (abfd)->first_file_filepos = bfd_scan_vma (hdr.firstmemoff,
- (const char **) NULL,
- 10);
-
- amt = SIZEOF_AR_FILE_HDR_BIG;
- bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd)->tdata == NULL)
- goto error_ret;
-
- memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG);
-
- if (! xcoff64_slurp_armap (abfd))
- {
- error_ret:
- bfd_release (abfd, bfd_ardata (abfd));
- error_ret_restore:
- bfd_ardata (abfd) = tdata_hold;
- return NULL;
- }
-
- return abfd->xvec;
-}
-
-
-/* Open the next element in an XCOFF archive. */
-
-static bfd *
-xcoff64_openr_next_archived_file (archive, last_file)
- bfd *archive;
- bfd *last_file;
-{
- bfd_vma filestart;
-
- if ((xcoff_ardata (archive) == NULL)
- || ! xcoff_big_format_p (archive))
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- if (last_file == NULL)
- {
- filestart = bfd_ardata (archive)->first_file_filepos;
- }
- else
- {
- filestart = bfd_scan_vma (arch_xhdr_big (last_file)->nextoff,
- (const char **) NULL, 10);
- }
-
- if (filestart == 0
- || filestart == bfd_scan_vma (xcoff_ardata_big (archive)->memoff,
- (const char **) NULL, 10)
- || filestart == bfd_scan_vma (xcoff_ardata_big (archive)->symoff,
- (const char **) NULL, 10))
- {
- bfd_set_error (bfd_error_no_more_archived_files);
- return NULL;
- }
-
- return _bfd_get_elt_at_filepos (archive, (file_ptr) filestart);
-}
-
-/* We can't use the usual coff_sizeof_headers routine, because AIX
- always uses an a.out header. */
-
-static int
-xcoff64_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
-{
- int size;
-
- size = bfd_coff_filhsz (abfd);
-
- /* Don't think the small aout header can be used since some of the
- old elements have been reordered past the end of the old coff
- small aout size. */
-
- if (xcoff_data (abfd)->full_aouthdr)
- size += bfd_coff_aoutsz (abfd);
-
- size += abfd->section_count * bfd_coff_scnhsz (abfd);
- return size;
-}
-
-
-
-static asection *
-xcoff64_create_csect_from_smclas (abfd, aux, symbol_name)
- bfd *abfd;
- union internal_auxent *aux;
- const char *symbol_name;
-{
- asection *return_value = NULL;
-
- /* Changes from 32 :
- .sv == 8, is only for 32 bit programs
- .ti == 12 and .tb == 13 are now reserved. */
- static const char *names[19] =
- {
- ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
- NULL, ".bs", ".ds", ".uc", NULL, NULL, NULL, ".tc0",
- ".td", ".sv64", ".sv3264"
- };
-
- if ((19 >= aux->x_csect.x_smclas)
- && (NULL != names[aux->x_csect.x_smclas]))
- {
-
- return_value = bfd_make_section_anyway
- (abfd, names[aux->x_csect.x_smclas]);
-
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: symbol `%s' has unrecognized smclas %d"),
- bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
- bfd_set_error (bfd_error_bad_value);
- }
-
- return return_value;
-}
-
-static bfd_boolean
-xcoff64_is_lineno_count_overflow (abfd, value)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_vma value ATTRIBUTE_UNUSED;
-{
- return FALSE;
-}
-
-static bfd_boolean
-xcoff64_is_reloc_count_overflow (abfd, value)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_vma value ATTRIBUTE_UNUSED;
-{
- return FALSE;
-}
-
-static bfd_vma
-xcoff64_loader_symbol_offset (abfd, ldhdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct internal_ldhdr *ldhdr;
-{
- return (ldhdr->l_symoff);
-}
-
-static bfd_vma
-xcoff64_loader_reloc_offset (abfd, ldhdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct internal_ldhdr *ldhdr;
-{
- return (ldhdr->l_rldoff);
-}
-
-static bfd_boolean
-xcoff64_bad_format_hook (abfd, filehdr)
- bfd * abfd;
- PTR filehdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- /* Check flavor first. */
- if (bfd_get_flavour (abfd) != bfd_target_xcoff_flavour)
- return FALSE;
-
- if (bfd_xcoff_magic_number (abfd) != internal_f->f_magic)
- return FALSE;
-
- return TRUE;
-}
-
-static bfd_boolean
-xcoff64_generate_rtinit (abfd, init, fini, rtld)
- bfd *abfd;
- const char *init;
- const char *fini;
- bfd_boolean rtld;
-{
- bfd_byte filehdr_ext[FILHSZ];
- bfd_byte scnhdr_ext[SCNHSZ * 3];
- bfd_byte syment_ext[SYMESZ * 10];
- bfd_byte reloc_ext[RELSZ * 3];
- bfd_byte *data_buffer;
- bfd_size_type data_buffer_size;
- bfd_byte *string_table, *st_tmp;
- bfd_size_type string_table_size;
- bfd_vma val;
- size_t initsz, finisz;
- struct internal_filehdr filehdr;
- struct internal_scnhdr text_scnhdr;
- struct internal_scnhdr data_scnhdr;
- struct internal_scnhdr bss_scnhdr;
- struct internal_syment syment;
- union internal_auxent auxent;
- struct internal_reloc reloc;
-
- char *text_name = ".text";
- char *data_name = ".data";
- char *bss_name = ".bss";
- char *rtinit_name = "__rtinit";
- char *rtld_name = "__rtld";
-
- if (! bfd_xcoff_rtinit_size (abfd))
- return FALSE;
-
- initsz = (init == NULL ? 0 : 1 + strlen (init));
- finisz = (fini == NULL ? 0 : 1 + strlen (fini));
-
- /* File header. */
- memset (filehdr_ext, 0, FILHSZ);
- memset (&filehdr, 0, sizeof (struct internal_filehdr));
- filehdr.f_magic = bfd_xcoff_magic_number (abfd);
- filehdr.f_nscns = 3;
- filehdr.f_timdat = 0;
- filehdr.f_nsyms = 0; /* at least 6, no more than 8 */
- filehdr.f_symptr = 0; /* set below */
- filehdr.f_opthdr = 0;
- filehdr.f_flags = 0;
-
- /* Section headers. */
- memset (scnhdr_ext, 0, 3 * SCNHSZ);
-
- /* Text. */
- memset (&text_scnhdr, 0, sizeof (struct internal_scnhdr));
- memcpy (text_scnhdr.s_name, text_name, strlen (text_name));
- text_scnhdr.s_paddr = 0;
- text_scnhdr.s_vaddr = 0;
- text_scnhdr.s_size = 0;
- text_scnhdr.s_scnptr = 0;
- text_scnhdr.s_relptr = 0;
- text_scnhdr.s_lnnoptr = 0;
- text_scnhdr.s_nreloc = 0;
- text_scnhdr.s_nlnno = 0;
- text_scnhdr.s_flags = STYP_TEXT;
-
- /* Data. */
- memset (&data_scnhdr, 0, sizeof (struct internal_scnhdr));
- memcpy (data_scnhdr.s_name, data_name, strlen (data_name));
- data_scnhdr.s_paddr = 0;
- data_scnhdr.s_vaddr = 0;
- data_scnhdr.s_size = 0; /* set below */
- data_scnhdr.s_scnptr = FILHSZ + 3 * SCNHSZ;
- data_scnhdr.s_relptr = 0; /* set below */
- data_scnhdr.s_lnnoptr = 0;
- data_scnhdr.s_nreloc = 0; /* either 1 or 2 */
- data_scnhdr.s_nlnno = 0;
- data_scnhdr.s_flags = STYP_DATA;
-
- /* Bss. */
- memset (&bss_scnhdr, 0, sizeof (struct internal_scnhdr));
- memcpy (bss_scnhdr.s_name, bss_name, strlen (bss_name));
- bss_scnhdr.s_paddr = 0; /* set below */
- bss_scnhdr.s_vaddr = 0; /* set below */
- bss_scnhdr.s_size = 0; /* set below */
- bss_scnhdr.s_scnptr = 0;
- bss_scnhdr.s_relptr = 0;
- bss_scnhdr.s_lnnoptr = 0;
- bss_scnhdr.s_nreloc = 0;
- bss_scnhdr.s_nlnno = 0;
- bss_scnhdr.s_flags = STYP_BSS;
-
- /* .data
- 0x0000 0x00000000 : rtl
- 0x0004 0x00000000 :
- 0x0008 0x00000018 : offset to init, or 0
- 0x000C 0x00000038 : offset to fini, or 0
- 0x0010 0x00000010 : size of descriptor
- 0x0014 0x00000000 : pad
- 0x0018 0x00000000 : init, needs a reloc
- 0x001C 0x00000000 :
- 0x0020 0x00000058 : offset to init name
- 0x0024 0x00000000 : flags, padded to a word
- 0x0028 0x00000000 : empty init
- 0x002C 0x00000000 :
- 0x0030 0x00000000 :
- 0x0034 0x00000000 :
- 0x0038 0x00000000 : fini, needs a reloc
- 0x003C 0x00000000 :
- 0x0040 0x00000??? : offset to fini name
- 0x0044 0x00000000 : flags, padded to a word
- 0x0048 0x00000000 : empty fini
- 0x004C 0x00000000 :
- 0x0050 0x00000000 :
- 0x0054 0x00000000 :
- 0x0058 init name
- 0x0058 + initsz fini name */
-
- data_buffer_size = 0x0058 + initsz + finisz;
- data_buffer_size = (data_buffer_size + 7) &~ (bfd_size_type) 7;
- data_buffer = NULL;
- data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
- if (data_buffer == NULL)
- return FALSE;
-
- if (initsz)
- {
- val = 0x18;
- bfd_put_32 (abfd, val, &data_buffer[0x08]);
- val = 0x58;
- bfd_put_32 (abfd, val, &data_buffer[0x20]);
- memcpy (&data_buffer[val], init, initsz);
- }
-
- if (finisz)
- {
- val = 0x38;
- bfd_put_32 (abfd, val, &data_buffer[0x0C]);
- val = 0x58 + initsz;
- bfd_put_32 (abfd, val, &data_buffer[0x40]);
- memcpy (&data_buffer[val], fini, finisz);
- }
-
- val = 0x10;
- bfd_put_32 (abfd, val, &data_buffer[0x10]);
- data_scnhdr.s_size = data_buffer_size;
- bss_scnhdr.s_paddr = bss_scnhdr.s_vaddr = data_scnhdr.s_size;
-
- /* String table. */
- string_table_size = 4;
- string_table_size += strlen (data_name) + 1;
- string_table_size += strlen (rtinit_name) + 1;
- string_table_size += initsz;
- string_table_size += finisz;
- if (rtld)
- string_table_size += strlen (rtld_name) + 1;
-
- string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
- if (string_table == NULL)
- return FALSE;
-
- val = string_table_size;
- bfd_put_32 (abfd, val, &string_table[0]);
- st_tmp = string_table + 4;
-
- /* symbols
- 0. .data csect
- 2. __rtinit
- 4. init function
- 6. fini function
- 8. __rtld */
- memset (syment_ext, 0, 10 * SYMESZ);
- memset (reloc_ext, 0, 3 * RELSZ);
-
- /* .data csect */
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
-
- syment._n._n_n._n_offset = st_tmp - string_table;
- memcpy (st_tmp, data_name, strlen (data_name));
- st_tmp += strlen (data_name) + 1;
-
- syment.n_scnum = 2;
- syment.n_sclass = C_HIDEXT;
- syment.n_numaux = 1;
- auxent.x_csect.x_scnlen.l = data_buffer_size;
- auxent.x_csect.x_smtyp = 3 << 3 | XTY_SD;
- auxent.x_csect.x_smclas = XMC_RW;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
- filehdr.f_nsyms += 2;
-
- /* __rtinit */
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
- syment._n._n_n._n_offset = st_tmp - string_table;
- memcpy (st_tmp, rtinit_name, strlen (rtinit_name));
- st_tmp += strlen (rtinit_name) + 1;
-
- syment.n_scnum = 2;
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- auxent.x_csect.x_smtyp = XTY_LD;
- auxent.x_csect.x_smclas = XMC_RW;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
- filehdr.f_nsyms += 2;
-
- /* Init. */
- if (initsz)
- {
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
-
- syment._n._n_n._n_offset = st_tmp - string_table;
- memcpy (st_tmp, init, initsz);
- st_tmp += initsz;
-
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
- /* Reloc. */
- memset (&reloc, 0, sizeof (struct internal_reloc));
- reloc.r_vaddr = 0x0018;
- reloc.r_symndx = filehdr.f_nsyms;
- reloc.r_type = R_POS;
- reloc.r_size = 63;
- bfd_coff_swap_reloc_out (abfd, &reloc, &reloc_ext[0]);
-
- filehdr.f_nsyms += 2;
- data_scnhdr.s_nreloc += 1;
- }
-
- /* Finit. */
- if (finisz)
- {
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
-
- syment._n._n_n._n_offset = st_tmp - string_table;
- memcpy (st_tmp, fini, finisz);
- st_tmp += finisz;
-
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
-
- /* Reloc. */
- memset (&reloc, 0, sizeof (struct internal_reloc));
- reloc.r_vaddr = 0x0038;
- reloc.r_symndx = filehdr.f_nsyms;
- reloc.r_type = R_POS;
- reloc.r_size = 63;
- bfd_coff_swap_reloc_out (abfd, &reloc,
- &reloc_ext[data_scnhdr.s_nreloc * RELSZ]);
-
- filehdr.f_nsyms += 2;
- data_scnhdr.s_nreloc += 1;
- }
-
- if (rtld)
- {
- memset (&syment, 0, sizeof (struct internal_syment));
- memset (&auxent, 0, sizeof (union internal_auxent));
-
- syment._n._n_n._n_offset = st_tmp - string_table;
- memcpy (st_tmp, rtld_name, strlen (rtld_name));
- st_tmp += strlen (rtld_name) + 1;
-
- syment.n_sclass = C_EXT;
- syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
- &syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
- &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
-
- /* Reloc. */
- memset (&reloc, 0, sizeof (struct internal_reloc));
- reloc.r_vaddr = 0x0000;
- reloc.r_symndx = filehdr.f_nsyms;
- reloc.r_type = R_POS;
- reloc.r_size = 63;
- bfd_coff_swap_reloc_out (abfd, &reloc,
- &reloc_ext[data_scnhdr.s_nreloc * RELSZ]);
-
- filehdr.f_nsyms += 2;
- data_scnhdr.s_nreloc += 1;
-
- bss_scnhdr.s_size = 0;
- }
-
- data_scnhdr.s_relptr = data_scnhdr.s_scnptr + data_buffer_size;
- filehdr.f_symptr = data_scnhdr.s_relptr + data_scnhdr.s_nreloc * RELSZ;
-
- bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
- bfd_bwrite (filehdr_ext, FILHSZ, abfd);
- bfd_coff_swap_scnhdr_out (abfd, &text_scnhdr, &scnhdr_ext[SCNHSZ * 0]);
- bfd_coff_swap_scnhdr_out (abfd, &data_scnhdr, &scnhdr_ext[SCNHSZ * 1]);
- bfd_coff_swap_scnhdr_out (abfd, &bss_scnhdr, &scnhdr_ext[SCNHSZ * 2]);
- bfd_bwrite (scnhdr_ext, 3 * SCNHSZ, abfd);
- bfd_bwrite (data_buffer, data_buffer_size, abfd);
- bfd_bwrite (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd);
- bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
- bfd_bwrite (string_table, string_table_size, abfd);
-
- free (data_buffer);
- data_buffer = NULL;
-
- return TRUE;
-}
-
-/* The typical dynamic reloc. */
-
-static reloc_howto_type xcoff64_dynamic_reloc =
-HOWTO (0, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-static unsigned long xcoff64_glink_code[10] =
-{
- 0xe9820000, /* ld r12,0(r2) */
- 0xf8410028, /* std r2,40(r1) */
- 0xe80c0000, /* ld r0,0(r12) */
- 0xe84c0008, /* ld r0,8(r12) */
- 0x7c0903a6, /* mtctr r0 */
- 0x4e800420, /* bctr */
- 0x00000000, /* start of traceback table */
- 0x000ca000, /* traceback table */
- 0x00000000, /* traceback table */
- 0x00000018, /* ??? */
-};
-
-static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
- {
- { /* COFF backend, defined in libcoff.h. */
- _bfd_xcoff64_swap_aux_in,
- _bfd_xcoff64_swap_sym_in,
- _bfd_xcoff64_swap_lineno_in,
- _bfd_xcoff64_swap_aux_out,
- _bfd_xcoff64_swap_sym_out,
- _bfd_xcoff64_swap_lineno_out,
- xcoff64_swap_reloc_out,
- coff_swap_filehdr_out,
- coff_swap_aouthdr_out,
- coff_swap_scnhdr_out,
- FILHSZ,
- AOUTSZ,
- SCNHSZ,
- SYMESZ,
- AUXESZ,
- RELSZ,
- LINESZ,
- FILNMLEN,
- TRUE, /* _bfd_coff_long_filenames */
- FALSE, /* _bfd_coff_long_section_names */
- 3, /* _bfd_coff_default_section_alignment_power */
- TRUE, /* _bfd_coff_force_symnames_in_strings */
- 4, /* _bfd_coff_debug_string_prefix_length */
- coff_swap_filehdr_in,
- coff_swap_aouthdr_in,
- coff_swap_scnhdr_in,
- xcoff64_swap_reloc_in,
- xcoff64_bad_format_hook,
- coff_set_arch_mach_hook,
- coff_mkobject_hook,
- styp_to_sec_flags,
- coff_set_alignment_hook,
- coff_slurp_symbol_table,
- symname_in_debug_hook,
- coff_pointerize_aux_hook,
- coff_print_aux,
- dummy_reloc16_extra_cases,
- dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
- coff_compute_section_file_positions,
- NULL, /* _bfd_coff_start_final_link */
- xcoff64_ppc_relocate_section,
- coff_rtype_to_howto,
- NULL, /* _bfd_coff_adjust_symndx */
- _bfd_generic_link_add_one_symbol,
- coff_link_output_has_begun,
- coff_final_link_postscript
- },
-
- 0x01EF, /* magic number */
- bfd_arch_powerpc,
- bfd_mach_ppc_620,
-
- /* Function pointers to xcoff specific swap routines. */
- xcoff64_swap_ldhdr_in,
- xcoff64_swap_ldhdr_out,
- xcoff64_swap_ldsym_in,
- xcoff64_swap_ldsym_out,
- xcoff64_swap_ldrel_in,
- xcoff64_swap_ldrel_out,
-
- /* Sizes. */
- LDHDRSZ,
- LDSYMSZ,
- LDRELSZ,
- 24, /* _xcoff_function_descriptor_size */
- 0, /* _xcoff_small_aout_header_size */
-
- /* Versions. */
- 2, /* _xcoff_ldhdr_version */
-
- _bfd_xcoff64_put_symbol_name,
- _bfd_xcoff64_put_ldsymbol_name,
- &xcoff64_dynamic_reloc,
- xcoff64_create_csect_from_smclas,
-
- /* Lineno and reloc count overflow. */
- xcoff64_is_lineno_count_overflow,
- xcoff64_is_reloc_count_overflow,
-
- xcoff64_loader_symbol_offset,
- xcoff64_loader_reloc_offset,
-
- /* glink. */
- &xcoff64_glink_code[0],
- 40, /* _xcoff_glink_size */
-
- /* rtinit. */
- 88, /* _xcoff_rtinit_size */
- xcoff64_generate_rtinit,
- };
-
-/* The transfer vector that leads the outside world to all of the above. */
-const bfd_target rs6000coff64_vec =
- {
- "aixcoff64-rs6000",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
- | HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
- SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
- 0, /* leading char */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
-
- /* data */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- /* hdrs */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- xcoff64_archive_p,
- CORE_FILE_P
- },
-
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
-
- {/* bfd_write_contents */
- bfd_false,
- xcoff64_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
-
- /* Generic */
- bfd_true,
- bfd_true,
- coff_new_section_hook,
- _bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
-
- /* Copy */
- _bfd_xcoff_copy_private_bfd_data,
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
- ((bfd_boolean (*) (bfd *, void * )) bfd_true),
-
- /* Core */
- coff_core_file_failing_command,
- coff_core_file_failing_signal,
- coff_core_file_matches_executable_p,
-
- /* Archive */
- xcoff64_slurp_armap,
- bfd_false,
- ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
- bfd_dont_truncate_arname,
- _bfd_xcoff_write_armap,
- _bfd_xcoff_read_ar_hdr,
- xcoff64_openr_next_archived_file,
- _bfd_generic_get_elt_at_index,
- _bfd_xcoff_stat_arch_elt,
- bfd_true,
-
- /* Symbols */
- coff_get_symtab_upper_bound,
- coff_canonicalize_symtab,
- coff_make_empty_symbol,
- coff_print_symbol,
- coff_get_symbol_info,
- _bfd_xcoff_is_local_label_name,
- coff_get_lineno,
- coff_find_nearest_line,
- coff_bfd_make_debug_symbol,
- _bfd_generic_read_minisymbols,
- _bfd_generic_minisymbol_to_symbol,
-
- /* Reloc */
- coff_get_reloc_upper_bound,
- coff_canonicalize_reloc,
- xcoff64_reloc_type_lookup,
-
- /* Write */
- coff_set_arch_mach,
- coff_set_section_contents,
-
- /* Link */
- xcoff64_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
- bfd_generic_relax_section,
- _bfd_xcoff_bfd_link_hash_table_create,
- _bfd_generic_link_hash_table_free,
- _bfd_xcoff_bfd_link_add_symbols,
- _bfd_generic_link_just_syms,
- _bfd_xcoff_bfd_final_link,
- _bfd_generic_link_split_section,
- bfd_generic_gc_sections,
- bfd_generic_merge_sections,
- bfd_generic_discard_group,
-
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_symtab,
- _bfd_xcoff_get_dynamic_reloc_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_reloc,
-
- /* Opposite endian version, none exists */
- NULL,
-
- (void *) &bfd_xcoff_backend_data,
- };
-
-extern const bfd_target *xcoff64_core_p
- PARAMS ((bfd *));
-extern bfd_boolean xcoff64_core_file_matches_executable_p
- PARAMS ((bfd *, bfd *));
-extern char *xcoff64_core_file_failing_command
- PARAMS ((bfd *));
-extern int xcoff64_core_file_failing_signal
- PARAMS ((bfd *));
-
-/* AIX 5 */
-static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
- {
- { /* COFF backend, defined in libcoff.h. */
- _bfd_xcoff64_swap_aux_in,
- _bfd_xcoff64_swap_sym_in,
- _bfd_xcoff64_swap_lineno_in,
- _bfd_xcoff64_swap_aux_out,
- _bfd_xcoff64_swap_sym_out,
- _bfd_xcoff64_swap_lineno_out,
- xcoff64_swap_reloc_out,
- coff_swap_filehdr_out,
- coff_swap_aouthdr_out,
- coff_swap_scnhdr_out,
- FILHSZ,
- AOUTSZ,
- SCNHSZ,
- SYMESZ,
- AUXESZ,
- RELSZ,
- LINESZ,
- FILNMLEN,
- TRUE, /* _bfd_coff_long_filenames */
- FALSE, /* _bfd_coff_long_section_names */
- 3, /* _bfd_coff_default_section_alignment_power */
- TRUE, /* _bfd_coff_force_symnames_in_strings */
- 4, /* _bfd_coff_debug_string_prefix_length */
- coff_swap_filehdr_in,
- coff_swap_aouthdr_in,
- coff_swap_scnhdr_in,
- xcoff64_swap_reloc_in,
- xcoff64_bad_format_hook,
- coff_set_arch_mach_hook,
- coff_mkobject_hook,
- styp_to_sec_flags,
- coff_set_alignment_hook,
- coff_slurp_symbol_table,
- symname_in_debug_hook,
- coff_pointerize_aux_hook,
- coff_print_aux,
- dummy_reloc16_extra_cases,
- dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
- coff_compute_section_file_positions,
- NULL, /* _bfd_coff_start_final_link */
- xcoff64_ppc_relocate_section,
- coff_rtype_to_howto,
- NULL, /* _bfd_coff_adjust_symndx */
- _bfd_generic_link_add_one_symbol,
- coff_link_output_has_begun,
- coff_final_link_postscript
- },
-
- U64_TOCMAGIC, /* magic number */
- bfd_arch_powerpc,
- bfd_mach_ppc_620,
-
- /* Function pointers to xcoff specific swap routines. */
- xcoff64_swap_ldhdr_in,
- xcoff64_swap_ldhdr_out,
- xcoff64_swap_ldsym_in,
- xcoff64_swap_ldsym_out,
- xcoff64_swap_ldrel_in,
- xcoff64_swap_ldrel_out,
-
- /* Sizes. */
- LDHDRSZ,
- LDSYMSZ,
- LDRELSZ,
- 24, /* _xcoff_function_descriptor_size */
- 0, /* _xcoff_small_aout_header_size */
- /* Versions. */
- 2, /* _xcoff_ldhdr_version */
-
- _bfd_xcoff64_put_symbol_name,
- _bfd_xcoff64_put_ldsymbol_name,
- &xcoff64_dynamic_reloc,
- xcoff64_create_csect_from_smclas,
-
- /* Lineno and reloc count overflow. */
- xcoff64_is_lineno_count_overflow,
- xcoff64_is_reloc_count_overflow,
-
- xcoff64_loader_symbol_offset,
- xcoff64_loader_reloc_offset,
-
- /* glink. */
- &xcoff64_glink_code[0],
- 40, /* _xcoff_glink_size */
-
- /* rtinit. */
- 88, /* _xcoff_rtinit_size */
- xcoff64_generate_rtinit,
- };
-
-/* The transfer vector that leads the outside world to all of the above. */
-const bfd_target aix5coff64_vec =
- {
- "aix5coff64-rs6000",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
- | HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
- SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
- 0, /* leading char */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
-
- /* data */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- /* hdrs */
- bfd_getb64,
- bfd_getb_signed_64,
- bfd_putb64,
- bfd_getb32,
- bfd_getb_signed_32,
- bfd_putb32,
- bfd_getb16,
- bfd_getb_signed_16,
- bfd_putb16,
-
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- xcoff64_archive_p,
- xcoff64_core_p
- },
-
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
-
- {/* bfd_write_contents */
- bfd_false,
- xcoff64_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
-
- /* Generic */
- bfd_true,
- bfd_true,
- coff_new_section_hook,
- _bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
-
- /* Copy */
- _bfd_xcoff_copy_private_bfd_data,
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
- ((bfd_boolean (*) (bfd *, void * )) bfd_true),
-
- /* Core */
- xcoff64_core_file_failing_command,
- xcoff64_core_file_failing_signal,
- xcoff64_core_file_matches_executable_p,
-
- /* Archive */
- xcoff64_slurp_armap,
- bfd_false,
- ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
- bfd_dont_truncate_arname,
- _bfd_xcoff_write_armap,
- _bfd_xcoff_read_ar_hdr,
- xcoff64_openr_next_archived_file,
- _bfd_generic_get_elt_at_index,
- _bfd_xcoff_stat_arch_elt,
- bfd_true,
-
- /* Symbols */
- coff_get_symtab_upper_bound,
- coff_canonicalize_symtab,
- coff_make_empty_symbol,
- coff_print_symbol,
- coff_get_symbol_info,
- _bfd_xcoff_is_local_label_name,
- coff_get_lineno,
- coff_find_nearest_line,
- coff_bfd_make_debug_symbol,
- _bfd_generic_read_minisymbols,
- _bfd_generic_minisymbol_to_symbol,
-
- /* Reloc */
- coff_get_reloc_upper_bound,
- coff_canonicalize_reloc,
- xcoff64_reloc_type_lookup,
-
- /* Write */
- coff_set_arch_mach,
- coff_set_section_contents,
-
- /* Link */
- xcoff64_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
- bfd_generic_relax_section,
- _bfd_xcoff_bfd_link_hash_table_create,
- _bfd_generic_link_hash_table_free,
- _bfd_xcoff_bfd_link_add_symbols,
- _bfd_generic_link_just_syms,
- _bfd_xcoff_bfd_final_link,
- _bfd_generic_link_split_section,
- bfd_generic_gc_sections,
- bfd_generic_merge_sections,
- bfd_generic_discard_group,
-
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_symtab,
- _bfd_xcoff_get_dynamic_reloc_upper_bound,
- _bfd_xcoff_canonicalize_dynamic_reloc,
-
- /* Opposite endian version, none exists. */
- NULL,
-
- (void *) & bfd_xcoff_aix5_backend_data,
- };
diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h
deleted file mode 100644
index 15d9709..0000000
--- a/contrib/binutils/bfd/coffcode.h
+++ /dev/null
@@ -1,5709 +0,0 @@
-/* Support for the generic parts of most COFF variants, for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-Most of this hacked by Steve Chamberlain,
- sac@cygnus.com
-*/
-/*
-
-SECTION
- coff backends
-
- BFD supports a number of different flavours of coff format.
- The major differences between formats are the sizes and
- alignments of fields in structures on disk, and the occasional
- extra field.
-
- Coff in all its varieties is implemented with a few common
- files and a number of implementation specific files. For
- example, The 88k bcs coff format is implemented in the file
- @file{coff-m88k.c}. This file @code{#include}s
- @file{coff/m88k.h} which defines the external structure of the
- coff format for the 88k, and @file{coff/internal.h} which
- defines the internal structure. @file{coff-m88k.c} also
- defines the relocations used by the 88k format
- @xref{Relocations}.
-
- The Intel i960 processor version of coff is implemented in
- @file{coff-i960.c}. This file has the same structure as
- @file{coff-m88k.c}, except that it includes @file{coff/i960.h}
- rather than @file{coff-m88k.h}.
-
-SUBSECTION
- Porting to a new version of coff
-
- The recommended method is to select from the existing
- implementations the version of coff which is most like the one
- you want to use. For example, we'll say that i386 coff is
- the one you select, and that your coff flavour is called foo.
- Copy @file{i386coff.c} to @file{foocoff.c}, copy
- @file{../include/coff/i386.h} to @file{../include/coff/foo.h},
- and add the lines to @file{targets.c} and @file{Makefile.in}
- so that your new back end is used. Alter the shapes of the
- structures in @file{../include/coff/foo.h} so that they match
- what you need. You will probably also have to add
- @code{#ifdef}s to the code in @file{coff/internal.h} and
- @file{coffcode.h} if your version of coff is too wild.
-
- You can verify that your new BFD backend works quite simply by
- building @file{objdump} from the @file{binutils} directory,
- and making sure that its version of what's going on and your
- host system's idea (assuming it has the pretty standard coff
- dump utility, usually called @code{att-dump} or just
- @code{dump}) are the same. Then clean up your code, and send
- what you've done to Cygnus. Then your stuff will be in the
- next release, and you won't have to keep integrating it.
-
-SUBSECTION
- How the coff backend works
-
-SUBSUBSECTION
- File layout
-
- The Coff backend is split into generic routines that are
- applicable to any Coff target and routines that are specific
- to a particular target. The target-specific routines are
- further split into ones which are basically the same for all
- Coff targets except that they use the external symbol format
- or use different values for certain constants.
-
- The generic routines are in @file{coffgen.c}. These routines
- work for any Coff target. They use some hooks into the target
- specific code; the hooks are in a @code{bfd_coff_backend_data}
- structure, one of which exists for each target.
-
- The essentially similar target-specific routines are in
- @file{coffcode.h}. This header file includes executable C code.
- The various Coff targets first include the appropriate Coff
- header file, make any special defines that are needed, and
- then include @file{coffcode.h}.
-
- Some of the Coff targets then also have additional routines in
- the target source file itself.
-
- For example, @file{coff-i960.c} includes
- @file{coff/internal.h} and @file{coff/i960.h}. It then
- defines a few constants, such as @code{I960}, and includes
- @file{coffcode.h}. Since the i960 has complex relocation
- types, @file{coff-i960.c} also includes some code to
- manipulate the i960 relocs. This code is not in
- @file{coffcode.h} because it would not be used by any other
- target.
-
-SUBSUBSECTION
- Bit twiddling
-
- Each flavour of coff supported in BFD has its own header file
- describing the external layout of the structures. There is also
- an internal description of the coff layout, in
- @file{coff/internal.h}. A major function of the
- coff backend is swapping the bytes and twiddling the bits to
- translate the external form of the structures into the normal
- internal form. This is all performed in the
- @code{bfd_swap}_@i{thing}_@i{direction} routines. Some
- elements are different sizes between different versions of
- coff; it is the duty of the coff version specific include file
- to override the definitions of various packing routines in
- @file{coffcode.h}. E.g., the size of line number entry in coff is
- sometimes 16 bits, and sometimes 32 bits. @code{#define}ing
- @code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the
- correct one. No doubt, some day someone will find a version of
- coff which has a varying field size not catered to at the
- moment. To port BFD, that person will have to add more @code{#defines}.
- Three of the bit twiddling routines are exported to
- @code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in}
- and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol
- table on its own, but uses BFD to fix things up. More of the
- bit twiddlers are exported for @code{gas};
- @code{coff_swap_aux_out}, @code{coff_swap_sym_out},
- @code{coff_swap_lineno_out}, @code{coff_swap_reloc_out},
- @code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out},
- @code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track
- of all the symbol table and reloc drudgery itself, thereby
- saving the internal BFD overhead, but uses BFD to swap things
- on the way out, making cross ports much safer. Doing so also
- allows BFD (and thus the linker) to use the same header files
- as @code{gas}, which makes one avenue to disaster disappear.
-
-SUBSUBSECTION
- Symbol reading
-
- The simple canonical form for symbols used by BFD is not rich
- enough to keep all the information available in a coff symbol
- table. The back end gets around this problem by keeping the original
- symbol table around, "behind the scenes".
-
- When a symbol table is requested (through a call to
- @code{bfd_canonicalize_symtab}), a request gets through to
- @code{coff_get_normalized_symtab}. This reads the symbol table from
- the coff file and swaps all the structures inside into the
- internal form. It also fixes up all the pointers in the table
- (represented in the file by offsets from the first symbol in
- the table) into physical pointers to elements in the new
- internal table. This involves some work since the meanings of
- fields change depending upon context: a field that is a
- pointer to another structure in the symbol table at one moment
- may be the size in bytes of a structure at the next. Another
- pass is made over the table. All symbols which mark file names
- (<<C_FILE>> symbols) are modified so that the internal
- string points to the value in the auxent (the real filename)
- rather than the normal text associated with the symbol
- (@code{".file"}).
-
- At this time the symbol names are moved around. Coff stores
- all symbols less than nine characters long physically
- within the symbol table; longer strings are kept at the end of
- the file in the string table. This pass moves all strings
- into memory and replaces them with pointers to the strings.
-
- The symbol table is massaged once again, this time to create
- the canonical table used by the BFD application. Each symbol
- is inspected in turn, and a decision made (using the
- @code{sclass} field) about the various flags to set in the
- @code{asymbol}. @xref{Symbols}. The generated canonical table
- shares strings with the hidden internal symbol table.
-
- Any linenumbers are read from the coff file too, and attached
- to the symbols which own the functions the linenumbers belong to.
-
-SUBSUBSECTION
- Symbol writing
-
- Writing a symbol to a coff file which didn't come from a coff
- file will lose any debugging information. The @code{asymbol}
- structure remembers the BFD from which the symbol was taken, and on
- output the back end makes sure that the same destination target as
- source target is present.
-
- When the symbols have come from a coff file then all the
- debugging information is preserved.
-
- Symbol tables are provided for writing to the back end in a
- vector of pointers to pointers. This allows applications like
- the linker to accumulate and output large symbol tables
- without having to do too much byte copying.
-
- This function runs through the provided symbol table and
- patches each symbol marked as a file place holder
- (@code{C_FILE}) to point to the next file place holder in the
- list. It also marks each @code{offset} field in the list with
- the offset from the first symbol of the current symbol.
-
- Another function of this procedure is to turn the canonical
- value form of BFD into the form used by coff. Internally, BFD
- expects symbol values to be offsets from a section base; so a
- symbol physically at 0x120, but in a section starting at
- 0x100, would have the value 0x20. Coff expects symbols to
- contain their final value, so symbols have their values
- changed at this point to reflect their sum with their owning
- section. This transformation uses the
- <<output_section>> field of the @code{asymbol}'s
- @code{asection} @xref{Sections}.
-
- o <<coff_mangle_symbols>>
-
- This routine runs though the provided symbol table and uses
- the offsets generated by the previous pass and the pointers
- generated when the symbol table was read in to create the
- structured hierarchy required by coff. It changes each pointer
- to a symbol into the index into the symbol table of the asymbol.
-
- o <<coff_write_symbols>>
-
- This routine runs through the symbol table and patches up the
- symbols from their internal form into the coff way, calls the
- bit twiddlers, and writes out the table to the file.
-
-*/
-
-/*
-INTERNAL_DEFINITION
- coff_symbol_type
-
-DESCRIPTION
- The hidden information for an <<asymbol>> is described in a
- <<combined_entry_type>>:
-
-CODE_FRAGMENT
-.
-.typedef struct coff_ptr_struct
-.{
-. {* Remembers the offset from the first symbol in the file for
-. this symbol. Generated by coff_renumber_symbols. *}
-. unsigned int offset;
-.
-. {* Should the value of this symbol be renumbered. Used for
-. XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *}
-. unsigned int fix_value : 1;
-.
-. {* Should the tag field of this symbol be renumbered.
-. Created by coff_pointerize_aux. *}
-. unsigned int fix_tag : 1;
-.
-. {* Should the endidx field of this symbol be renumbered.
-. Created by coff_pointerize_aux. *}
-. unsigned int fix_end : 1;
-.
-. {* Should the x_csect.x_scnlen field be renumbered.
-. Created by coff_pointerize_aux. *}
-. unsigned int fix_scnlen : 1;
-.
-. {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
-. index into the line number entries. Set by coff_slurp_symbol_table. *}
-. unsigned int fix_line : 1;
-.
-. {* The container for the symbol structure as read and translated
-. from the file. *}
-. union
-. {
-. union internal_auxent auxent;
-. struct internal_syment syment;
-. } u;
-.} combined_entry_type;
-.
-.
-.{* Each canonical asymbol really looks like this: *}
-.
-.typedef struct coff_symbol_struct
-.{
-. {* The actual symbol which the rest of BFD works with *}
-. asymbol symbol;
-.
-. {* A pointer to the hidden information for this symbol *}
-. combined_entry_type *native;
-.
-. {* A pointer to the linenumber information for this symbol *}
-. struct lineno_cache_entry *lineno;
-.
-. {* Have the line numbers been relocated yet ? *}
-. bfd_boolean done_lineno;
-.} coff_symbol_type;
-
-*/
-
-#ifdef COFF_WITH_PE
-#include "peicode.h"
-#else
-#include "coffswap.h"
-#endif
-
-#define STRING_SIZE_SIZE (4)
-
-static long sec_to_styp_flags
- PARAMS ((const char *, flagword));
-static bfd_boolean styp_to_sec_flags
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-static bfd_boolean coff_bad_format_hook
- PARAMS ((bfd *, PTR));
-static void coff_set_custom_section_alignment
- PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *,
- const unsigned int));
-static bfd_boolean coff_new_section_hook
- PARAMS ((bfd *, asection *));
-static bfd_boolean coff_set_arch_mach_hook
- PARAMS ((bfd *, PTR));
-static bfd_boolean coff_write_relocs
- PARAMS ((bfd *, int));
-static bfd_boolean coff_set_flags
- PARAMS ((bfd *, unsigned int *, unsigned short *));
-static bfd_boolean coff_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED;
-static bfd_boolean coff_compute_section_file_positions
- PARAMS ((bfd *));
-static bfd_boolean coff_write_object_contents
- PARAMS ((bfd *)) ATTRIBUTE_UNUSED;
-static bfd_boolean coff_set_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static PTR buy_and_read
- PARAMS ((bfd *, file_ptr, bfd_size_type));
-static bfd_boolean coff_slurp_line_table
- PARAMS ((bfd *, asection *));
-static bfd_boolean coff_slurp_symbol_table
- PARAMS ((bfd *));
-static enum coff_symbol_classification coff_classify_symbol
- PARAMS ((bfd *, struct internal_syment *));
-static bfd_boolean coff_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **));
-static long coff_canonicalize_reloc
- PARAMS ((bfd *, asection *, arelent **, asymbol **));
-#ifndef coff_mkobject_hook
-static PTR coff_mkobject_hook
- PARAMS ((bfd *, PTR, PTR));
-#endif
-#ifdef COFF_WITH_PE
-static flagword handle_COMDAT
- PARAMS ((bfd *, flagword, PTR, const char *, asection *));
-#endif
-#ifdef COFF_IMAGE_WITH_PE
-static bfd_boolean coff_read_word
- PARAMS ((bfd *, unsigned int *));
-static unsigned int coff_compute_checksum
- PARAMS ((bfd *));
-static bfd_boolean coff_apply_checksum
- PARAMS ((bfd *));
-#endif
-#ifdef TICOFF
-static bfd_boolean ticoff0_bad_format_hook
- PARAMS ((bfd *, PTR ));
-static bfd_boolean ticoff1_bad_format_hook
- PARAMS ((bfd *, PTR ));
-#endif
-
-/* void warning(); */
-
-/* Return a word with STYP_* (scnhdr.s_flags) flags set to represent
- the incoming SEC_* flags. The inverse of this function is
- styp_to_sec_flags(). NOTE: If you add to/change this routine, you
- should probably mirror the changes in styp_to_sec_flags(). */
-
-#ifndef COFF_WITH_PE
-
-/* Macros for setting debugging flags. */
-#ifdef STYP_DEBUG
-#define STYP_XCOFF_DEBUG STYP_DEBUG
-#else
-#define STYP_XCOFF_DEBUG STYP_INFO
-#endif
-
-#ifdef COFF_ALIGN_IN_S_FLAGS
-#define STYP_DEBUG_INFO STYP_DSECT
-#else
-#define STYP_DEBUG_INFO STYP_INFO
-#endif
-
-static long
-sec_to_styp_flags (sec_name, sec_flags)
- const char *sec_name;
- flagword sec_flags;
-{
- long styp_flags = 0;
-
- if (!strcmp (sec_name, _TEXT))
- {
- styp_flags = STYP_TEXT;
- }
- else if (!strcmp (sec_name, _DATA))
- {
- styp_flags = STYP_DATA;
- }
- else if (!strcmp (sec_name, _BSS))
- {
- styp_flags = STYP_BSS;
-#ifdef _COMMENT
- }
- else if (!strcmp (sec_name, _COMMENT))
- {
- styp_flags = STYP_INFO;
-#endif /* _COMMENT */
-#ifdef _LIB
- }
- else if (!strcmp (sec_name, _LIB))
- {
- styp_flags = STYP_LIB;
-#endif /* _LIB */
-#ifdef _LIT
- }
- else if (!strcmp (sec_name, _LIT))
- {
- styp_flags = STYP_LIT;
-#endif /* _LIT */
- }
- else if (!strncmp (sec_name, ".debug", 6))
- {
- /* Handle the XCOFF debug section and DWARF2 debug sections. */
- if (!sec_name[6])
- styp_flags = STYP_XCOFF_DEBUG;
- else
- styp_flags = STYP_DEBUG_INFO;
- }
- else if (!strncmp (sec_name, ".stab", 5))
- {
- styp_flags = STYP_DEBUG_INFO;
- }
-#ifdef COFF_LONG_SECTION_NAMES
- else if (!strncmp (sec_name, ".gnu.linkonce.wi.", 17))
- {
- styp_flags = STYP_DEBUG_INFO;
- }
-#endif
-#ifdef RS6000COFF_C
- else if (!strcmp (sec_name, _PAD))
- {
- styp_flags = STYP_PAD;
- }
- else if (!strcmp (sec_name, _LOADER))
- {
- styp_flags = STYP_LOADER;
- }
- else if (!strcmp (sec_name, _EXCEPT))
- {
- styp_flags = STYP_EXCEPT;
- }
- else if (!strcmp (sec_name, _TYPCHK))
- {
- styp_flags = STYP_TYPCHK;
- }
-#endif
- /* Try and figure out what it should be */
- else if (sec_flags & SEC_CODE)
- {
- styp_flags = STYP_TEXT;
- }
- else if (sec_flags & SEC_DATA)
- {
- styp_flags = STYP_DATA;
- }
- else if (sec_flags & SEC_READONLY)
- {
-#ifdef STYP_LIT /* 29k readonly text/data section */
- styp_flags = STYP_LIT;
-#else
- styp_flags = STYP_TEXT;
-#endif /* STYP_LIT */
- }
- else if (sec_flags & SEC_LOAD)
- {
- styp_flags = STYP_TEXT;
- }
- else if (sec_flags & SEC_ALLOC)
- {
- styp_flags = STYP_BSS;
- }
-
-#ifdef STYP_CLINK
- if (sec_flags & SEC_CLINK)
- styp_flags |= STYP_CLINK;
-#endif
-
-#ifdef STYP_BLOCK
- if (sec_flags & SEC_BLOCK)
- styp_flags |= STYP_BLOCK;
-#endif
-
-#ifdef STYP_NOLOAD
- if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0)
- styp_flags |= STYP_NOLOAD;
-#endif
-
- return styp_flags;
-}
-
-#else /* COFF_WITH_PE */
-
-/* The PE version; see above for the general comments. The non-PE
- case seems to be more guessing, and breaks PE format; specifically,
- .rdata is readonly, but it sure ain't text. Really, all this
- should be set up properly in gas (or whatever assembler is in use),
- and honor whatever objcopy/strip, etc. sent us as input. */
-
-static long
-sec_to_styp_flags (sec_name, sec_flags)
- const char *sec_name ATTRIBUTE_UNUSED;
- flagword sec_flags;
-{
- long styp_flags = 0;
-
- /* caution: there are at least three groups of symbols that have
- very similar bits and meanings: IMAGE_SCN*, SEC_*, and STYP_*.
- SEC_* are the BFD internal flags, used for generic BFD
- information. STYP_* are the COFF section flags which appear in
- COFF files. IMAGE_SCN_* are the PE section flags which appear in
- PE files. The STYP_* flags and the IMAGE_SCN_* flags overlap,
- but there are more IMAGE_SCN_* flags. */
-
- /* skip LOAD */
- /* READONLY later */
- /* skip RELOC */
- if ((sec_flags & SEC_CODE) != 0)
- styp_flags |= IMAGE_SCN_CNT_CODE;
- if ((sec_flags & SEC_DATA) != 0)
- styp_flags |= IMAGE_SCN_CNT_INITIALIZED_DATA;
- if ((sec_flags & SEC_ALLOC) != 0 && (sec_flags & SEC_LOAD) == 0)
- styp_flags |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; /* ==STYP_BSS */
- /* skip ROM */
- /* skip constRUCTOR */
- /* skip CONTENTS */
-#ifdef STYP_NOLOAD
- if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0)
- styp_flags |= STYP_NOLOAD;
-#endif
- if ((sec_flags & SEC_IS_COMMON) != 0)
- styp_flags |= IMAGE_SCN_LNK_COMDAT;
- if ((sec_flags & SEC_DEBUGGING) != 0)
- styp_flags |= IMAGE_SCN_MEM_DISCARDABLE;
- if ((sec_flags & SEC_EXCLUDE) != 0)
- styp_flags |= IMAGE_SCN_LNK_REMOVE;
- if ((sec_flags & SEC_NEVER_LOAD) != 0)
- styp_flags |= IMAGE_SCN_LNK_REMOVE;
- /* skip IN_MEMORY */
- /* skip SORT */
- if (sec_flags & SEC_LINK_ONCE)
- styp_flags |= IMAGE_SCN_LNK_COMDAT;
- /* skip LINK_DUPLICATES */
- /* skip LINKER_CREATED */
-
- /* For now, the read/write bits are mapped onto SEC_READONLY, even
- though the semantics don't quite match. The bits from the input
- are retained in pei_section_data(abfd, section)->pe_flags. */
-
- styp_flags |= IMAGE_SCN_MEM_READ; /* Always readable. */
- if ((sec_flags & SEC_READONLY) == 0)
- styp_flags |= IMAGE_SCN_MEM_WRITE; /* Invert READONLY for write. */
- if (sec_flags & SEC_CODE)
- styp_flags |= IMAGE_SCN_MEM_EXECUTE; /* CODE->EXECUTE. */
- if (sec_flags & SEC_SHARED)
- styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful. */
-
- return styp_flags;
-}
-
-#endif /* COFF_WITH_PE */
-
-/* Return a word with SEC_* flags set to represent the incoming STYP_*
- flags (from scnhdr.s_flags). The inverse of this function is
- sec_to_styp_flags(). NOTE: If you add to/change this routine, you
- should probably mirror the changes in sec_to_styp_flags(). */
-
-#ifndef COFF_WITH_PE
-
-static bfd_boolean
-styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR hdr;
- const char *name;
- asection *section ATTRIBUTE_UNUSED;
- flagword *flags_ptr;
-{
- struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
- long styp_flags = internal_s->s_flags;
- flagword sec_flags = 0;
-
-#ifdef STYP_BLOCK
- if (styp_flags & STYP_BLOCK)
- sec_flags |= SEC_BLOCK;
-#endif
-
-#ifdef STYP_CLINK
- if (styp_flags & STYP_CLINK)
- sec_flags |= SEC_CLINK;
-#endif
-
-#ifdef STYP_NOLOAD
- if (styp_flags & STYP_NOLOAD)
- sec_flags |= SEC_NEVER_LOAD;
-#endif /* STYP_NOLOAD */
-
- /* For 386 COFF, at least, an unloadable text or data section is
- actually a shared library section. */
- if (styp_flags & STYP_TEXT)
- {
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY;
- else
- sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC;
- }
- else if (styp_flags & STYP_DATA)
- {
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY;
- else
- sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC;
- }
- else if (styp_flags & STYP_BSS)
- {
-#ifdef BSS_NOLOAD_IS_SHARED_LIBRARY
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_ALLOC | SEC_COFF_SHARED_LIBRARY;
- else
-#endif
- sec_flags |= SEC_ALLOC;
- }
- else if (styp_flags & STYP_INFO)
- {
- /* We mark these as SEC_DEBUGGING, but only if COFF_PAGE_SIZE is
- defined. coff_compute_section_file_positions uses
- COFF_PAGE_SIZE to ensure that the low order bits of the
- section VMA and the file offset match. If we don't know
- COFF_PAGE_SIZE, we can't ensure the correct correspondence,
- and demand page loading of the file will fail. */
-#if defined (COFF_PAGE_SIZE) && !defined (COFF_ALIGN_IN_S_FLAGS)
- sec_flags |= SEC_DEBUGGING;
-#endif
- }
- else if (styp_flags & STYP_PAD)
- sec_flags = 0;
- else if (strcmp (name, _TEXT) == 0)
- {
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY;
- else
- sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC;
- }
- else if (strcmp (name, _DATA) == 0)
- {
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY;
- else
- sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC;
- }
- else if (strcmp (name, _BSS) == 0)
- {
-#ifdef BSS_NOLOAD_IS_SHARED_LIBRARY
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_ALLOC | SEC_COFF_SHARED_LIBRARY;
- else
-#endif
- sec_flags |= SEC_ALLOC;
- }
- else if (strncmp (name, ".debug", 6) == 0
-#ifdef _COMMENT
- || strcmp (name, _COMMENT) == 0
-#endif
-#ifdef COFF_LONG_SECTION_NAMES
- || strncmp (name, ".gnu.linkonce.wi.", 17) == 0
-#endif
- || strncmp (name, ".stab", 5) == 0)
- {
-#ifdef COFF_PAGE_SIZE
- sec_flags |= SEC_DEBUGGING;
-#endif
- }
-#ifdef _LIB
- else if (strcmp (name, _LIB) == 0)
- ;
-#endif
-#ifdef _LIT
- else if (strcmp (name, _LIT) == 0)
- sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY;
-#endif
- else
- sec_flags |= SEC_ALLOC | SEC_LOAD;
-
-#ifdef STYP_LIT /* A29k readonly text/data section type. */
- if ((styp_flags & STYP_LIT) == STYP_LIT)
- sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY);
-#endif /* STYP_LIT */
-
-#ifdef STYP_OTHER_LOAD /* Other loaded sections. */
- if (styp_flags & STYP_OTHER_LOAD)
- sec_flags = (SEC_LOAD | SEC_ALLOC);
-#endif /* STYP_SDATA */
-
-#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
- /* As a GNU extension, if the name begins with .gnu.linkonce, we
- only link a single copy of the section. This is used to support
- g++. g++ will emit each template expansion in its own section.
- The symbols will be defined as weak, so that multiple definitions
- are permitted. The GNU linker extension is to actually discard
- all but one of the sections. */
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
- sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
-#endif
-
- if (flags_ptr == NULL)
- return FALSE;
-
- * flags_ptr = sec_flags;
- return TRUE;
-}
-
-#else /* COFF_WITH_PE */
-
-static flagword
-handle_COMDAT (abfd, sec_flags, hdr, name, section)
- bfd * abfd;
- flagword sec_flags;
- PTR hdr;
- const char *name;
- asection *section;
-{
- struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
- bfd_byte *esymstart, *esym, *esymend;
- int seen_state = 0;
- char *target_name = NULL;
-
- sec_flags |= SEC_LINK_ONCE;
-
- /* Unfortunately, the PE format stores essential information in
- the symbol table, of all places. We need to extract that
- information now, so that objdump and the linker will know how
- to handle the section without worrying about the symbols. We
- can't call slurp_symtab, because the linker doesn't want the
- swapped symbols. */
-
- /* COMDAT sections are special. The first symbol is the section
- symbol, which tells what kind of COMDAT section it is. The
- second symbol is the "comdat symbol" - the one with the
- unique name. GNU uses the section symbol for the unique
- name; MS uses ".text" for every comdat section. Sigh. - DJ */
-
- /* This is not mirrored in sec_to_styp_flags(), but there
- doesn't seem to be a need to, either, and it would at best be
- rather messy. */
-
- if (! _bfd_coff_get_external_symbols (abfd))
- return sec_flags;
-
- esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
- esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
-
- while (esym < esymend)
- {
- struct internal_syment isym;
- char buf[SYMNMLEN + 1];
- const char *symname;
-
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym);
-
- if (sizeof (internal_s->s_name) > SYMNMLEN)
- {
- /* This case implies that the matching
- symbol name will be in the string table. */
- abort ();
- }
-
- if (isym.n_scnum == section->target_index)
- {
- /* According to the MSVC documentation, the first
- TWO entries with the section # are both of
- interest to us. The first one is the "section
- symbol" (section name). The second is the comdat
- symbol name. Here, we've found the first
- qualifying entry; we distinguish it from the
- second with a state flag.
-
- In the case of gas-generated (at least until that
- is fixed) .o files, it isn't necessarily the
- second one. It may be some other later symbol.
-
- Since gas also doesn't follow MS conventions and
- emits the section similar to .text$<name>, where
- <something> is the name we're looking for, we
- distinguish the two as follows:
-
- If the section name is simply a section name (no
- $) we presume it's MS-generated, and look at
- precisely the second symbol for the comdat name.
- If the section name has a $, we assume it's
- gas-generated, and look for <something> (whatever
- follows the $) as the comdat symbol. */
-
- /* All 3 branches use this. */
- symname = _bfd_coff_internal_syment_name (abfd, &isym, buf);
-
- if (symname == NULL)
- abort ();
-
- switch (seen_state)
- {
- case 0:
- {
- /* The first time we've seen the symbol. */
- union internal_auxent aux;
-
- seen_state = 1;
-
- /* If it isn't the stuff we're expecting, die;
- The MS documentation is vague, but it
- appears that the second entry serves BOTH
- as the comdat symbol and the defining
- symbol record (either C_STAT or C_EXT,
- possibly with an aux entry with debug
- information if it's a function.) It
- appears the only way to find the second one
- is to count. (On Intel, they appear to be
- adjacent, but on Alpha, they have been
- found separated.)
-
- Here, we think we've found the first one,
- but there's some checking we can do to be
- sure. */
-
- if (! (isym.n_sclass == C_STAT
- && isym.n_type == T_NULL
- && isym.n_value == 0))
- abort ();
-
- /* FIXME LATER: MSVC generates section names
- like .text for comdats. Gas generates
- names like .text$foo__Fv (in the case of a
- function). See comment above for more. */
-
- if (strcmp (name, symname) != 0)
- abort ();
-
- /* This is the section symbol. */
- bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)),
- isym.n_type, isym.n_sclass,
- 0, isym.n_numaux, (PTR) &aux);
-
- target_name = strchr (name, '$');
- if (target_name != NULL)
- {
- /* Gas mode. */
- seen_state = 2;
- /* Skip the `$'. */
- target_name += 1;
- }
-
- /* FIXME: Microsoft uses NODUPLICATES and
- ASSOCIATIVE, but gnu uses ANY and
- SAME_SIZE. Unfortunately, gnu doesn't do
- the comdat symbols right. So, until we can
- fix it to do the right thing, we are
- temporarily disabling comdats for the MS
- types (they're used in DLLs and C++, but we
- don't support *their* C++ libraries anyway
- - DJ. */
-
- /* Cygwin does not follow the MS style, and
- uses ANY and SAME_SIZE where NODUPLICATES
- and ASSOCIATIVE should be used. For
- Interix, we just do the right thing up
- front. */
-
- switch (aux.x_scn.x_comdat)
- {
- case IMAGE_COMDAT_SELECT_NODUPLICATES:
-#ifdef STRICT_PE_FORMAT
- sec_flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
-#else
- sec_flags &= ~SEC_LINK_ONCE;
-#endif
- break;
-
- case IMAGE_COMDAT_SELECT_ANY:
- sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
- break;
-
- case IMAGE_COMDAT_SELECT_SAME_SIZE:
- sec_flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
- break;
-
- case IMAGE_COMDAT_SELECT_EXACT_MATCH:
- /* Not yet fully implemented ??? */
- sec_flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
- break;
-
- /* debug$S gets this case; other
- implications ??? */
-
- /* There may be no symbol... we'll search
- the whole table... Is this the right
- place to play this game? Or should we do
- it when reading it in. */
- case IMAGE_COMDAT_SELECT_ASSOCIATIVE:
-#ifdef STRICT_PE_FORMAT
- /* FIXME: This is not currently implemented. */
- sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
-#else
- sec_flags &= ~SEC_LINK_ONCE;
-#endif
- break;
-
- default: /* 0 means "no symbol" */
- /* debug$F gets this case; other
- implications ??? */
- sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
- break;
- }
- }
- break;
-
- case 2:
- /* Gas mode: the first matching on partial name. */
-
-#ifndef TARGET_UNDERSCORE
-#define TARGET_UNDERSCORE 0
-#endif
- /* Is this the name we're looking for ? */
- if (strcmp (target_name,
- symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0)
- {
- /* Not the name we're looking for */
- esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
- continue;
- }
- /* Fall through. */
- case 1:
- /* MSVC mode: the lexically second symbol (or
- drop through from the above). */
- {
- char *newname;
- bfd_size_type amt;
-
- /* This must the second symbol with the
- section #. It is the actual symbol name.
- Intel puts the two adjacent, but Alpha (at
- least) spreads them out. */
-
- amt = sizeof (struct bfd_comdat_info);
- section->comdat = bfd_alloc (abfd, amt);
- if (section->comdat == NULL)
- abort ();
-
- section->comdat->symbol =
- (esym - esymstart) / bfd_coff_symesz (abfd);
-
- amt = strlen (symname) + 1;
- newname = bfd_alloc (abfd, amt);
- if (newname == NULL)
- abort ();
-
- strcpy (newname, symname);
- section->comdat->name = newname;
- }
-
- goto breakloop;
- }
- }
-
- esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
- }
-
- breakloop:
- return sec_flags;
-}
-
-
-/* The PE version; see above for the general comments.
-
- Since to set the SEC_LINK_ONCE and associated flags, we have to
- look at the symbol table anyway, we return the symbol table index
- of the symbol being used as the COMDAT symbol. This is admittedly
- ugly, but there's really nowhere else that we have access to the
- required information. FIXME: Is the COMDAT symbol index used for
- any purpose other than objdump? */
-
-static bfd_boolean
-styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
- bfd *abfd;
- PTR hdr;
- const char *name;
- asection *section;
- flagword *flags_ptr;
-{
- struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
- long styp_flags = internal_s->s_flags;
- flagword sec_flags;
- bfd_boolean result = TRUE;
-
- /* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */
- sec_flags = SEC_READONLY;
-
- /* Process each flag bit in styp_flags in turn. */
- while (styp_flags)
- {
- long flag = styp_flags & - styp_flags;
- char * unhandled = NULL;
-
- styp_flags &= ~ flag;
-
- /* We infer from the distinct read/write/execute bits the settings
- of some of the bfd flags; the actual values, should we need them,
- are also in pei_section_data (abfd, section)->pe_flags. */
-
- switch (flag)
- {
- case STYP_DSECT:
- unhandled = "STYP_DSECT";
- break;
- case STYP_GROUP:
- unhandled = "STYP_GROUP";
- break;
- case STYP_COPY:
- unhandled = "STYP_COPY";
- break;
- case STYP_OVER:
- unhandled = "STYP_OVER";
- break;
-#ifdef SEC_NEVER_LOAD
- case STYP_NOLOAD:
- sec_flags |= SEC_NEVER_LOAD;
- break;
-#endif
- case IMAGE_SCN_MEM_READ:
- /* Ignored, assume it always to be true. */
- break;
- case IMAGE_SCN_TYPE_NO_PAD:
- /* Skip. */
- break;
- case IMAGE_SCN_LNK_OTHER:
- unhandled = "IMAGE_SCN_LNK_OTHER";
- break;
- case IMAGE_SCN_MEM_NOT_CACHED:
- unhandled = "IMAGE_SCN_MEM_NOT_CACHED";
- break;
- case IMAGE_SCN_MEM_NOT_PAGED:
- unhandled = "IMAGE_SCN_MEM_NOT_PAGED";
- break;
- case IMAGE_SCN_MEM_EXECUTE:
- sec_flags |= SEC_CODE;
- break;
- case IMAGE_SCN_MEM_WRITE:
- sec_flags &= ~ SEC_READONLY;
- break;
- case IMAGE_SCN_MEM_DISCARDABLE:
- /* The MS PE spec sets the DISCARDABLE flag on .reloc sections
- but we do not want them to be labelled as debug section, since
- then strip would remove them. */
- if (strncmp (name, ".reloc", sizeof ".reloc" - 1) != 0)
- sec_flags |= SEC_DEBUGGING;
- break;
- case IMAGE_SCN_MEM_SHARED:
- sec_flags |= SEC_SHARED;
- break;
- case IMAGE_SCN_LNK_REMOVE:
- sec_flags |= SEC_EXCLUDE;
- break;
- case IMAGE_SCN_CNT_CODE:
- sec_flags |= SEC_CODE | SEC_ALLOC | SEC_LOAD;
- break;
- case IMAGE_SCN_CNT_INITIALIZED_DATA:
- sec_flags |= SEC_DATA | SEC_ALLOC | SEC_LOAD;
- break;
- case IMAGE_SCN_CNT_UNINITIALIZED_DATA:
- sec_flags |= SEC_ALLOC;
- break;
- case IMAGE_SCN_LNK_INFO:
- /* We mark these as SEC_DEBUGGING, but only if COFF_PAGE_SIZE is
- defined. coff_compute_section_file_positions uses
- COFF_PAGE_SIZE to ensure that the low order bits of the
- section VMA and the file offset match. If we don't know
- COFF_PAGE_SIZE, we can't ensure the correct correspondence,
- and demand page loading of the file will fail. */
-#ifdef COFF_PAGE_SIZE
- sec_flags |= SEC_DEBUGGING;
-#endif
- break;
- case IMAGE_SCN_LNK_COMDAT:
- /* COMDAT gets very special treatment. */
- sec_flags = handle_COMDAT (abfd, sec_flags, hdr, name, section);
- break;
- default:
- /* Silently ignore for now. */
- break;
- }
-
- /* If the section flag was not handled, report it here. */
- if (unhandled != NULL)
- {
- (*_bfd_error_handler)
- (_("%s (%s): Section flag %s (0x%x) ignored"),
- bfd_archive_filename (abfd), name, unhandled, flag);
- result = FALSE;
- }
- }
-
-#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
- /* As a GNU extension, if the name begins with .gnu.linkonce, we
- only link a single copy of the section. This is used to support
- g++. g++ will emit each template expansion in its own section.
- The symbols will be defined as weak, so that multiple definitions
- are permitted. The GNU linker extension is to actually discard
- all but one of the sections. */
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
- sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
-#endif
-
- if (flags_ptr)
- * flags_ptr = sec_flags;
-
- return result;
-}
-
-#endif /* COFF_WITH_PE */
-
-#define get_index(symbol) ((symbol)->udata.i)
-
-/*
-INTERNAL_DEFINITION
- bfd_coff_backend_data
-
-CODE_FRAGMENT
-
-.{* COFF symbol classifications. *}
-.
-.enum coff_symbol_classification
-.{
-. {* Global symbol. *}
-. COFF_SYMBOL_GLOBAL,
-. {* Common symbol. *}
-. COFF_SYMBOL_COMMON,
-. {* Undefined symbol. *}
-. COFF_SYMBOL_UNDEFINED,
-. {* Local symbol. *}
-. COFF_SYMBOL_LOCAL,
-. {* PE section symbol. *}
-. COFF_SYMBOL_PE_SECTION
-.};
-.
-Special entry points for gdb to swap in coff symbol table parts:
-.typedef struct
-.{
-. void (*_bfd_coff_swap_aux_in)
-. PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-.
-. void (*_bfd_coff_swap_sym_in)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. void (*_bfd_coff_swap_lineno_in)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. unsigned int (*_bfd_coff_swap_aux_out)
-. PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-.
-. unsigned int (*_bfd_coff_swap_sym_out)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. unsigned int (*_bfd_coff_swap_lineno_out)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. unsigned int (*_bfd_coff_swap_reloc_out)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. unsigned int (*_bfd_coff_swap_filehdr_out)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. unsigned int (*_bfd_coff_swap_aouthdr_out)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. unsigned int (*_bfd_coff_swap_scnhdr_out)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. unsigned int _bfd_filhsz;
-. unsigned int _bfd_aoutsz;
-. unsigned int _bfd_scnhsz;
-. unsigned int _bfd_symesz;
-. unsigned int _bfd_auxesz;
-. unsigned int _bfd_relsz;
-. unsigned int _bfd_linesz;
-. unsigned int _bfd_filnmlen;
-. bfd_boolean _bfd_coff_long_filenames;
-. bfd_boolean _bfd_coff_long_section_names;
-. unsigned int _bfd_coff_default_section_alignment_power;
-. bfd_boolean _bfd_coff_force_symnames_in_strings;
-. unsigned int _bfd_coff_debug_string_prefix_length;
-.
-. void (*_bfd_coff_swap_filehdr_in)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. void (*_bfd_coff_swap_aouthdr_in)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. void (*_bfd_coff_swap_scnhdr_in)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. void (*_bfd_coff_swap_reloc_in)
-. PARAMS ((bfd *abfd, PTR, PTR));
-.
-. bfd_boolean (*_bfd_coff_bad_format_hook)
-. PARAMS ((bfd *, PTR));
-.
-. bfd_boolean (*_bfd_coff_set_arch_mach_hook)
-. PARAMS ((bfd *, PTR));
-.
-. PTR (*_bfd_coff_mkobject_hook)
-. PARAMS ((bfd *, PTR, PTR));
-.
-. bfd_boolean (*_bfd_styp_to_sec_flags_hook)
-. PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-.
-. void (*_bfd_set_alignment_hook)
-. PARAMS ((bfd *, asection *, PTR));
-.
-. bfd_boolean (*_bfd_coff_slurp_symbol_table)
-. PARAMS ((bfd *));
-.
-. bfd_boolean (*_bfd_coff_symname_in_debug)
-. PARAMS ((bfd *, struct internal_syment *));
-.
-. bfd_boolean (*_bfd_coff_pointerize_aux_hook)
-. PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
-. unsigned int, combined_entry_type *));
-.
-. bfd_boolean (*_bfd_coff_print_aux)
-. PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
-. combined_entry_type *, unsigned int));
-.
-. void (*_bfd_coff_reloc16_extra_cases)
-. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
-. bfd_byte *, unsigned int *, unsigned int *));
-.
-. int (*_bfd_coff_reloc16_estimate)
-. PARAMS ((bfd *, asection *, arelent *, unsigned int,
-. struct bfd_link_info *));
-.
-. enum coff_symbol_classification (*_bfd_coff_classify_symbol)
-. PARAMS ((bfd *, struct internal_syment *));
-.
-. bfd_boolean (*_bfd_coff_compute_section_file_positions)
-. PARAMS ((bfd *));
-.
-. bfd_boolean (*_bfd_coff_start_final_link)
-. PARAMS ((bfd *, struct bfd_link_info *));
-.
-. bfd_boolean (*_bfd_coff_relocate_section)
-. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
-. struct internal_reloc *, struct internal_syment *, asection **));
-.
-. reloc_howto_type *(*_bfd_coff_rtype_to_howto)
-. PARAMS ((bfd *, asection *, struct internal_reloc *,
-. struct coff_link_hash_entry *, struct internal_syment *,
-. bfd_vma *));
-.
-. bfd_boolean (*_bfd_coff_adjust_symndx)
-. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
-. struct internal_reloc *, bfd_boolean *));
-.
-. bfd_boolean (*_bfd_coff_link_add_one_symbol)
-. PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
-. asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
-. struct bfd_link_hash_entry **));
-.
-. bfd_boolean (*_bfd_coff_link_output_has_begun)
-. PARAMS ((bfd *, struct coff_final_link_info *));
-.
-. bfd_boolean (*_bfd_coff_final_link_postscript)
-. PARAMS ((bfd *, struct coff_final_link_info *));
-.
-.} bfd_coff_backend_data;
-.
-.#define coff_backend_info(abfd) \
-. ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
-.
-.#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
-. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
-.
-.#define bfd_coff_swap_sym_in(a,e,i) \
-. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
-.
-.#define bfd_coff_swap_lineno_in(a,e,i) \
-. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
-.
-.#define bfd_coff_swap_reloc_out(abfd, i, o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
-.
-.#define bfd_coff_swap_lineno_out(abfd, i, o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
-.
-.#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
-. ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
-.
-.#define bfd_coff_swap_sym_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
-.
-.#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
-.
-.#define bfd_coff_swap_filehdr_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
-.
-.#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
-.
-.#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
-.#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
-.#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
-.#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
-.#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
-.#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
-.#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
-.#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
-.#define bfd_coff_long_filenames(abfd) \
-. (coff_backend_info (abfd)->_bfd_coff_long_filenames)
-.#define bfd_coff_long_section_names(abfd) \
-. (coff_backend_info (abfd)->_bfd_coff_long_section_names)
-.#define bfd_coff_default_section_alignment_power(abfd) \
-. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
-.#define bfd_coff_swap_filehdr_in(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
-.
-.#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
-.
-.#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
-.
-.#define bfd_coff_swap_reloc_in(abfd, i, o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
-.
-.#define bfd_coff_bad_format_hook(abfd, filehdr) \
-. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
-.
-.#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
-. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
-.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
-. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\
-. (abfd, filehdr, aouthdr))
-.
-.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
-. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
-. (abfd, scnhdr, name, section, flags_ptr))
-.
-.#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
-. ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
-.
-.#define bfd_coff_slurp_symbol_table(abfd)\
-. ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
-.
-.#define bfd_coff_symname_in_debug(abfd, sym)\
-. ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
-.
-.#define bfd_coff_force_symnames_in_strings(abfd)\
-. (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
-.
-.#define bfd_coff_debug_string_prefix_length(abfd)\
-. (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
-.
-.#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
-. ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
-. (abfd, file, base, symbol, aux, indaux))
-.
-.#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
-. reloc, data, src_ptr, dst_ptr)\
-. ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
-. (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
-.
-.#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
-. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
-. (abfd, section, reloc, shrink, link_info))
-.
-.#define bfd_coff_classify_symbol(abfd, sym)\
-. ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
-. (abfd, sym))
-.
-.#define bfd_coff_compute_section_file_positions(abfd)\
-. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
-. (abfd))
-.
-.#define bfd_coff_start_final_link(obfd, info)\
-. ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
-. (obfd, info))
-.#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
-. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
-. (obfd, info, ibfd, o, con, rel, isyms, secs))
-.#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
-. ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
-. (abfd, sec, rel, h, sym, addendp))
-.#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
-. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
-. (obfd, info, ibfd, sec, rel, adjustedp))
-.#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
-. value, string, cp, coll, hashp)\
-. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
-. (info, abfd, name, flags, section, value, string, cp, coll, hashp))
-.
-.#define bfd_coff_link_output_has_begun(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
-.#define bfd_coff_final_link_postscript(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
-.
-*/
-
-/* See whether the magic number matches. */
-
-static bfd_boolean
-coff_bad_format_hook (abfd, filehdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- if (BADMAG (*internal_f))
- return FALSE;
-
- /* If the optional header is NULL or not the correct size then
- quit; the only difference I can see between m88k dgux headers (MC88DMAGIC)
- and Intel 960 readwrite headers (I960WRMAGIC) is that the
- optional header is of a different size.
-
- But the mips keeps extra stuff in it's opthdr, so dont check
- when doing that. */
-
-#if defined(M88) || defined(I960)
- if (internal_f->f_opthdr != 0 && bfd_coff_aoutsz (abfd) != internal_f->f_opthdr)
- return FALSE;
-#endif
-
- return TRUE;
-}
-
-#ifdef TICOFF
-static bfd_boolean
-ticoff0_bad_format_hook (abfd, filehdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- if (COFF0_BADMAG (*internal_f))
- return FALSE;
-
- return TRUE;
-}
-#endif
-
-#ifdef TICOFF
-static bfd_boolean
-ticoff1_bad_format_hook (abfd, filehdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- if (COFF1_BADMAG (*internal_f))
- return FALSE;
-
- return TRUE;
-}
-#endif
-
-/* Check whether this section uses an alignment other than the
- default. */
-
-static void
-coff_set_custom_section_alignment (abfd, section, alignment_table, table_size)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section;
- const struct coff_section_alignment_entry *alignment_table;
- const unsigned int table_size;
-{
- const unsigned int default_alignment = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
- unsigned int i;
-
- for (i = 0; i < table_size; ++i)
- {
- const char *secname = bfd_get_section_name (abfd, section);
-
- if (alignment_table[i].comparison_length == (unsigned int) -1
- ? strcmp (alignment_table[i].name, secname) == 0
- : strncmp (alignment_table[i].name, secname,
- alignment_table[i].comparison_length) == 0)
- break;
- }
- if (i >= table_size)
- return;
-
- if (alignment_table[i].default_alignment_min != COFF_ALIGNMENT_FIELD_EMPTY
- && default_alignment < alignment_table[i].default_alignment_min)
- return;
-
- if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY
-#if COFF_DEFAULT_SECTION_ALIGNMENT_POWER != 0
- && default_alignment > alignment_table[i].default_alignment_max
-#endif
- )
- return;
-
- section->alignment_power = alignment_table[i].alignment_power;
-}
-
-/* Custom section alignment records. */
-
-static const struct coff_section_alignment_entry
-coff_section_alignment_table[] =
-{
-#ifdef COFF_SECTION_ALIGNMENT_ENTRIES
- COFF_SECTION_ALIGNMENT_ENTRIES,
-#endif
- /* There must not be any gaps between .stabstr sections. */
- { COFF_SECTION_NAME_PARTIAL_MATCH (".stabstr"),
- 1, COFF_ALIGNMENT_FIELD_EMPTY, 0 },
- /* The .stab section must be aligned to 2**2 at most, to avoid gaps. */
- { COFF_SECTION_NAME_PARTIAL_MATCH (".stab"),
- 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 },
- /* Similarly for the .ctors and .dtors sections. */
- { COFF_SECTION_NAME_EXACT_MATCH (".ctors"),
- 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 },
- { COFF_SECTION_NAME_EXACT_MATCH (".dtors"),
- 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 }
-};
-
-static const unsigned int coff_section_alignment_table_size =
- sizeof coff_section_alignment_table / sizeof coff_section_alignment_table[0];
-
-/* Initialize a section structure with information peculiar to this
- particular implementation of COFF. */
-
-static bfd_boolean
-coff_new_section_hook (abfd, section)
- bfd * abfd;
- asection * section;
-{
- combined_entry_type *native;
- bfd_size_type amt;
-
- section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
-
-#ifdef RS6000COFF_C
- if (bfd_xcoff_text_align_power (abfd) != 0
- && strcmp (bfd_get_section_name (abfd, section), ".text") == 0)
- section->alignment_power = bfd_xcoff_text_align_power (abfd);
- if (bfd_xcoff_data_align_power (abfd) != 0
- && strcmp (bfd_get_section_name (abfd, section), ".data") == 0)
- section->alignment_power = bfd_xcoff_data_align_power (abfd);
-#endif
-
- /* Allocate aux records for section symbols, to store size and
- related info.
-
- @@ The 10 is a guess at a plausible maximum number of aux entries
- (but shouldn't be a constant). */
- amt = sizeof (combined_entry_type) * 10;
- native = (combined_entry_type *) bfd_zalloc (abfd, amt);
- if (native == NULL)
- return FALSE;
-
- /* We don't need to set up n_name, n_value, or n_scnum in the native
- symbol information, since they'll be overridden by the BFD symbol
- anyhow. However, we do need to set the type and storage class,
- in case this symbol winds up getting written out. The value 0
- for n_numaux is already correct. */
-
- native->u.syment.n_type = T_NULL;
- native->u.syment.n_sclass = C_STAT;
-
- coffsymbol (section->symbol)->native = native;
-
- coff_set_custom_section_alignment (abfd, section,
- coff_section_alignment_table,
- coff_section_alignment_table_size);
-
- return TRUE;
-}
-
-#ifdef COFF_ALIGN_IN_SECTION_HEADER
-
-/* Set the alignment of a BFD section. */
-
-static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));
-
-static void
-coff_set_alignment_hook (abfd, section, scnhdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- asection * section;
- PTR scnhdr;
-{
- struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
- unsigned int i;
-
-#ifdef I960
- /* Extract ALIGN from 2**ALIGN stored in section header. */
- for (i = 0; i < 32; i++)
- if ((1 << i) >= hdr->s_align)
- break;
-#endif
-#ifdef TIC80COFF
- /* TI tools puts the alignment power in bits 8-11. */
- i = (hdr->s_flags >> 8) & 0xF ;
-#endif
-#ifdef COFF_DECODE_ALIGNMENT
- i = COFF_DECODE_ALIGNMENT(hdr->s_flags);
-#endif
- section->alignment_power = i;
-
-#ifdef coff_set_section_load_page
- coff_set_section_load_page (section, hdr->s_page);
-#endif
-}
-
-#else /* ! COFF_ALIGN_IN_SECTION_HEADER */
-#ifdef COFF_WITH_PE
-
-/* A couple of macros to help setting the alignment power field. */
-#define ALIGN_SET(field,x,y) \
- if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\
- {\
- section->alignment_power = y;\
- }
-
-#define ELIFALIGN_SET(field,x,y) \
- else if (( (field) & IMAGE_SCN_ALIGN_64BYTES) == x ) \
- {\
- section->alignment_power = y;\
- }
-
-static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));
-
-static void
-coff_set_alignment_hook (abfd, section, scnhdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- asection * section;
- PTR scnhdr;
-{
- struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
- bfd_size_type amt;
-
- ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6)
- ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_32BYTES, 5)
- ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_16BYTES, 4)
- ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_8BYTES, 3)
- ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_4BYTES, 2)
- ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_2BYTES, 1)
- ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_1BYTES, 0)
-
- /* In a PE image file, the s_paddr field holds the virtual size of a
- section, while the s_size field holds the raw size. We also keep
- the original section flag value, since not every bit can be
- mapped onto a generic BFD section bit. */
- if (coff_section_data (abfd, section) == NULL)
- {
- amt = sizeof (struct coff_section_tdata);
- section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
- if (section->used_by_bfd == NULL)
- {
- /* FIXME: Return error. */
- abort ();
- }
- }
- if (pei_section_data (abfd, section) == NULL)
- {
- amt = sizeof (struct pei_section_tdata);
- coff_section_data (abfd, section)->tdata = (PTR) bfd_zalloc (abfd, amt);
- if (coff_section_data (abfd, section)->tdata == NULL)
- {
- /* FIXME: Return error. */
- abort ();
- }
- }
- pei_section_data (abfd, section)->virt_size = hdr->s_paddr;
- pei_section_data (abfd, section)->pe_flags = hdr->s_flags;
-
- section->lma = hdr->s_vaddr;
-
- /* Check for extended relocs. */
- if (hdr->s_flags & IMAGE_SCN_LNK_NRELOC_OVFL)
- {
- struct external_reloc dst;
- struct internal_reloc n;
- file_ptr oldpos = bfd_tell (abfd);
- bfd_size_type relsz = bfd_coff_relsz (abfd);
-
- bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0);
- if (bfd_bread ((PTR) &dst, relsz, abfd) != relsz)
- return;
-
- coff_swap_reloc_in (abfd, &dst, &n);
- bfd_seek (abfd, oldpos, 0);
- section->reloc_count = hdr->s_nreloc = n.r_vaddr - 1;
- section->rel_filepos += relsz;
- }
- else if (hdr->s_nreloc == 0xffff)
- (*_bfd_error_handler)
- ("%s: warning: claims to have 0xffff relocs, without overflow",
- bfd_get_filename (abfd));
-}
-#undef ALIGN_SET
-#undef ELIFALIGN_SET
-
-#else /* ! COFF_WITH_PE */
-#ifdef RS6000COFF_C
-
-/* We grossly abuse this function to handle XCOFF overflow headers.
- When we see one, we correct the reloc and line number counts in the
- real header, and remove the section we just created. */
-
-static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));
-
-static void
-coff_set_alignment_hook (abfd, section, scnhdr)
- bfd *abfd;
- asection *section;
- PTR scnhdr;
-{
- struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
- asection *real_sec;
- asection **ps;
-
- if ((hdr->s_flags & STYP_OVRFLO) == 0)
- return;
-
- real_sec = coff_section_from_bfd_index (abfd, (int) hdr->s_nreloc);
- if (real_sec == NULL)
- return;
-
- real_sec->reloc_count = hdr->s_paddr;
- real_sec->lineno_count = hdr->s_vaddr;
-
- for (ps = &abfd->sections; *ps != NULL; ps = &(*ps)->next)
- {
- if (*ps == section)
- {
- bfd_section_list_remove (abfd, ps);
- --abfd->section_count;
- break;
- }
- }
-}
-
-#else /* ! RS6000COFF_C */
-
-#define coff_set_alignment_hook \
- ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
-
-#endif /* ! RS6000COFF_C */
-#endif /* ! COFF_WITH_PE */
-#endif /* ! COFF_ALIGN_IN_SECTION_HEADER */
-
-#ifndef coff_mkobject
-
-static bfd_boolean coff_mkobject PARAMS ((bfd *));
-
-static bfd_boolean
-coff_mkobject (abfd)
- bfd * abfd;
-{
- coff_data_type *coff;
- bfd_size_type amt = sizeof (coff_data_type);
-
- abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, amt);
- if (abfd->tdata.coff_obj_data == 0)
- return FALSE;
- coff = coff_data (abfd);
- coff->symbols = (coff_symbol_type *) NULL;
- coff->conversion_table = (unsigned int *) NULL;
- coff->raw_syments = (struct coff_ptr_struct *) NULL;
- coff->relocbase = 0;
- coff->local_toc_sym_map = 0;
-
-/* make_abs_section(abfd);*/
-
- return TRUE;
-}
-#endif
-
-/* Create the COFF backend specific information. */
-
-#ifndef coff_mkobject_hook
-static PTR
-coff_mkobject_hook (abfd, filehdr, aouthdr)
- bfd * abfd;
- PTR filehdr;
- PTR aouthdr ATTRIBUTE_UNUSED;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
- coff_data_type *coff;
-
- if (! coff_mkobject (abfd))
- return NULL;
-
- coff = coff_data (abfd);
-
- coff->sym_filepos = internal_f->f_symptr;
-
- /* These members communicate important constants about the symbol
- table to GDB's symbol-reading code. These `constants'
- unfortunately vary among coff implementations... */
- coff->local_n_btmask = N_BTMASK;
- coff->local_n_btshft = N_BTSHFT;
- coff->local_n_tmask = N_TMASK;
- coff->local_n_tshift = N_TSHIFT;
- coff->local_symesz = bfd_coff_symesz (abfd);
- coff->local_auxesz = bfd_coff_auxesz (abfd);
- coff->local_linesz = bfd_coff_linesz (abfd);
-
- coff->timestamp = internal_f->f_timdat;
-
- obj_raw_syment_count (abfd) =
- obj_conv_table_size (abfd) =
- internal_f->f_nsyms;
-
-#ifdef RS6000COFF_C
- if ((internal_f->f_flags & F_SHROBJ) != 0)
- abfd->flags |= DYNAMIC;
- if (aouthdr != NULL && internal_f->f_opthdr >= bfd_coff_aoutsz (abfd))
- {
- struct internal_aouthdr *internal_a =
- (struct internal_aouthdr *) aouthdr;
- struct xcoff_tdata *xcoff;
-
- xcoff = xcoff_data (abfd);
-# ifdef U803XTOCMAGIC
- xcoff->xcoff64 = internal_f->f_magic == U803XTOCMAGIC;
-# else
- xcoff->xcoff64 = 0;
-# endif
- xcoff->full_aouthdr = TRUE;
- xcoff->toc = internal_a->o_toc;
- xcoff->sntoc = internal_a->o_sntoc;
- xcoff->snentry = internal_a->o_snentry;
- bfd_xcoff_text_align_power (abfd) = internal_a->o_algntext;
- bfd_xcoff_data_align_power (abfd) = internal_a->o_algndata;
- xcoff->modtype = internal_a->o_modtype;
- xcoff->cputype = internal_a->o_cputype;
- xcoff->maxdata = internal_a->o_maxdata;
- xcoff->maxstack = internal_a->o_maxstack;
- }
-#endif
-
-#ifdef ARM
- /* Set the flags field from the COFF header read in. */
- if (! _bfd_coff_arm_set_private_flags (abfd, internal_f->f_flags))
- coff->flags = 0;
-#endif
-
-#ifdef COFF_WITH_PE
- /* FIXME: I'm not sure this is ever executed, since peicode.h
- defines coff_mkobject_hook. */
- if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0)
- abfd->flags |= HAS_DEBUG;
-#endif
-
- return (PTR) coff;
-}
-#endif
-
-/* Determine the machine architecture and type. FIXME: This is target
- dependent because the magic numbers are defined in the target
- dependent header files. But there is no particular need for this.
- If the magic numbers were moved to a separate file, this function
- would be target independent and would also be much more successful
- at linking together COFF files for different architectures. */
-
-static bfd_boolean
-coff_set_arch_mach_hook (abfd, filehdr)
- bfd *abfd;
- PTR filehdr;
-{
- unsigned long machine;
- enum bfd_architecture arch;
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
-
- /* Zero selects the default machine for an arch. */
- machine = 0;
- switch (internal_f->f_magic)
- {
-#ifdef OR32_MAGIC_BIG
- case OR32_MAGIC_BIG:
- case OR32_MAGIC_LITTLE:
- arch = bfd_arch_or32;
- break;
-#endif
-#ifdef PPCMAGIC
- case PPCMAGIC:
- arch = bfd_arch_powerpc;
- break;
-#endif
-#ifdef I386MAGIC
- case I386MAGIC:
- case I386PTXMAGIC:
- case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */
- case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */
- arch = bfd_arch_i386;
- break;
-#endif
-#ifdef IA64MAGIC
- case IA64MAGIC:
- arch = bfd_arch_ia64;
- break;
-#endif
-#ifdef A29K_MAGIC_BIG
- case A29K_MAGIC_BIG:
- case A29K_MAGIC_LITTLE:
- arch = bfd_arch_a29k;
- break;
-#endif
-#ifdef ARMMAGIC
- case ARMMAGIC:
- case ARMPEMAGIC:
- case THUMBPEMAGIC:
- arch = bfd_arch_arm;
- machine = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
- if (machine == bfd_mach_arm_unknown)
- {
- switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK)
- {
- case F_ARM_2: machine = bfd_mach_arm_2; break;
- case F_ARM_2a: machine = bfd_mach_arm_2a; break;
- case F_ARM_3: machine = bfd_mach_arm_3; break;
- default:
- case F_ARM_3M: machine = bfd_mach_arm_3M; break;
- case F_ARM_4: machine = bfd_mach_arm_4; break;
- case F_ARM_4T: machine = bfd_mach_arm_4T; break;
- /* The COFF header does not have enough bits available
- to cover all the different ARM architectures. So
- we interpret F_ARM_5, the highest flag value to mean
- "the highest ARM architecture known to BFD" which is
- currently the XScale. */
- case F_ARM_5: machine = bfd_mach_arm_XScale; break;
- }
- }
- break;
-#endif
-#ifdef MC68MAGIC
- case MC68MAGIC:
- case M68MAGIC:
-#ifdef MC68KBCSMAGIC
- case MC68KBCSMAGIC:
-#endif
-#ifdef APOLLOM68KMAGIC
- case APOLLOM68KMAGIC:
-#endif
-#ifdef LYNXCOFFMAGIC
- case LYNXCOFFMAGIC:
-#endif
- arch = bfd_arch_m68k;
- machine = bfd_mach_m68020;
- break;
-#endif
-#ifdef MC88MAGIC
- case MC88MAGIC:
- case MC88DMAGIC:
- case MC88OMAGIC:
- arch = bfd_arch_m88k;
- machine = 88100;
- break;
-#endif
-#ifdef Z8KMAGIC
- case Z8KMAGIC:
- arch = bfd_arch_z8k;
- switch (internal_f->f_flags & F_MACHMASK)
- {
- case F_Z8001:
- machine = bfd_mach_z8001;
- break;
- case F_Z8002:
- machine = bfd_mach_z8002;
- break;
- default:
- return FALSE;
- }
- break;
-#endif
-#ifdef I860
- case I860MAGIC:
- arch = bfd_arch_i860;
- break;
-#endif
-#ifdef I960
-#ifdef I960ROMAGIC
- case I960ROMAGIC:
- case I960RWMAGIC:
- arch = bfd_arch_i960;
- switch (F_I960TYPE & internal_f->f_flags)
- {
- default:
- case F_I960CORE:
- machine = bfd_mach_i960_core;
- break;
- case F_I960KB:
- machine = bfd_mach_i960_kb_sb;
- break;
- case F_I960MC:
- machine = bfd_mach_i960_mc;
- break;
- case F_I960XA:
- machine = bfd_mach_i960_xa;
- break;
- case F_I960CA:
- machine = bfd_mach_i960_ca;
- break;
- case F_I960KA:
- machine = bfd_mach_i960_ka_sa;
- break;
- case F_I960JX:
- machine = bfd_mach_i960_jx;
- break;
- case F_I960HX:
- machine = bfd_mach_i960_hx;
- break;
- }
- break;
-#endif
-#endif
-
-#ifdef RS6000COFF_C
-#ifdef XCOFF64
- case U64_TOCMAGIC:
- case U803XTOCMAGIC:
-#else
- case U802ROMAGIC:
- case U802WRMAGIC:
- case U802TOCMAGIC:
-#endif
- {
- int cputype;
-
- if (xcoff_data (abfd)->cputype != -1)
- cputype = xcoff_data (abfd)->cputype & 0xff;
- else
- {
- /* We did not get a value from the a.out header. If the
- file has not been stripped, we may be able to get the
- architecture information from the first symbol, if it
- is a .file symbol. */
- if (obj_raw_syment_count (abfd) == 0)
- cputype = 0;
- else
- {
- bfd_byte *buf;
- struct internal_syment sym;
- bfd_size_type amt = bfd_coff_symesz (abfd);
-
- buf = (bfd_byte *) bfd_malloc (amt);
- if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
- || bfd_bread (buf, amt, abfd) != amt)
- {
- free (buf);
- return FALSE;
- }
- bfd_coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym);
- if (sym.n_sclass == C_FILE)
- cputype = sym.n_type & 0xff;
- else
- cputype = 0;
- free (buf);
- }
- }
-
- /* FIXME: We don't handle all cases here. */
- switch (cputype)
- {
- default:
- case 0:
- arch = bfd_xcoff_architecture (abfd);
- machine = bfd_xcoff_machine (abfd);
- break;
-
- case 1:
- arch = bfd_arch_powerpc;
- machine = bfd_mach_ppc_601;
- break;
- case 2: /* 64 bit PowerPC */
- arch = bfd_arch_powerpc;
- machine = bfd_mach_ppc_620;
- break;
- case 3:
- arch = bfd_arch_powerpc;
- machine = bfd_mach_ppc;
- break;
- case 4:
- arch = bfd_arch_rs6000;
- machine = bfd_mach_rs6k;
- break;
- }
- }
- break;
-#endif
-
-#ifdef WE32KMAGIC
- case WE32KMAGIC:
- arch = bfd_arch_we32k;
- break;
-#endif
-
-#ifdef H8300MAGIC
- case H8300MAGIC:
- arch = bfd_arch_h8300;
- machine = bfd_mach_h8300;
- /* !! FIXME this probably isn't the right place for this. */
- abfd->flags |= BFD_IS_RELAXABLE;
- break;
-#endif
-
-#ifdef H8300HMAGIC
- case H8300HMAGIC:
- arch = bfd_arch_h8300;
- machine = bfd_mach_h8300h;
- /* !! FIXME this probably isn't the right place for this. */
- abfd->flags |= BFD_IS_RELAXABLE;
- break;
-#endif
-
-#ifdef H8300SMAGIC
- case H8300SMAGIC:
- arch = bfd_arch_h8300;
- machine = bfd_mach_h8300s;
- /* !! FIXME this probably isn't the right place for this. */
- abfd->flags |= BFD_IS_RELAXABLE;
- break;
-#endif
-
-#ifdef H8300HNMAGIC
- case H8300HNMAGIC:
- arch = bfd_arch_h8300;
- machine = bfd_mach_h8300hn;
- /* !! FIXME this probably isn't the right place for this. */
- abfd->flags |= BFD_IS_RELAXABLE;
- break;
-#endif
-
-#ifdef H8300SNMAGIC
- case H8300SNMAGIC:
- arch = bfd_arch_h8300;
- machine = bfd_mach_h8300sn;
- /* !! FIXME this probably isn't the right place for this. */
- abfd->flags |= BFD_IS_RELAXABLE;
- break;
-#endif
-
-#ifdef SH_ARCH_MAGIC_BIG
- case SH_ARCH_MAGIC_BIG:
- case SH_ARCH_MAGIC_LITTLE:
-#ifdef COFF_WITH_PE
- case SH_ARCH_MAGIC_WINCE:
-#endif
- arch = bfd_arch_sh;
- break;
-#endif
-
-#ifdef MIPS_ARCH_MAGIC_WINCE
- case MIPS_ARCH_MAGIC_WINCE:
- arch = bfd_arch_mips;
- break;
-#endif
-
-#ifdef H8500MAGIC
- case H8500MAGIC:
- arch = bfd_arch_h8500;
- break;
-#endif
-
-#ifdef SPARCMAGIC
- case SPARCMAGIC:
-#ifdef LYNXCOFFMAGIC
- case LYNXCOFFMAGIC:
-#endif
- arch = bfd_arch_sparc;
- break;
-#endif
-
-#ifdef TIC30MAGIC
- case TIC30MAGIC:
- arch = bfd_arch_tic30;
- break;
-#endif
-
-#ifdef TICOFF0MAGIC
-#ifdef TICOFF_TARGET_ARCH
- /* This TI COFF section should be used by all new TI COFF v0 targets. */
- case TICOFF0MAGIC:
- arch = TICOFF_TARGET_ARCH;
- machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags);
- break;
-#endif
-#endif
-
-#ifdef TICOFF1MAGIC
- /* This TI COFF section should be used by all new TI COFF v1/2 targets. */
- /* TI COFF1 and COFF2 use the target_id field to specify which arch. */
- case TICOFF1MAGIC:
- case TICOFF2MAGIC:
- switch (internal_f->f_target_id)
- {
-#ifdef TI_TARGET_ID
- case TI_TARGET_ID:
- arch = TICOFF_TARGET_ARCH;
- machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags);
- break;
-#endif
- default:
- arch = bfd_arch_obscure;
- (*_bfd_error_handler)
- (_("Unrecognized TI COFF target id '0x%x'"),
- internal_f->f_target_id);
- break;
- }
- break;
-#endif
-
-#ifdef TIC80_ARCH_MAGIC
- case TIC80_ARCH_MAGIC:
- arch = bfd_arch_tic80;
- break;
-#endif
-
-#ifdef MCOREMAGIC
- case MCOREMAGIC:
- arch = bfd_arch_mcore;
- break;
-#endif
-
-#ifdef W65MAGIC
- case W65MAGIC:
- arch = bfd_arch_w65;
- break;
-#endif
-
- default: /* Unreadable input file type. */
- arch = bfd_arch_obscure;
- break;
- }
-
- bfd_default_set_arch_mach (abfd, arch, machine);
- return TRUE;
-}
-
-#ifdef SYMNAME_IN_DEBUG
-
-static bfd_boolean symname_in_debug_hook
- PARAMS ((bfd *, struct internal_syment *));
-
-static bfd_boolean
-symname_in_debug_hook (abfd, sym)
- bfd * abfd ATTRIBUTE_UNUSED;
- struct internal_syment *sym;
-{
- return SYMNAME_IN_DEBUG (sym) != 0;
-}
-
-#else
-
-#define symname_in_debug_hook \
- (bfd_boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false
-
-#endif
-
-#ifdef RS6000COFF_C
-
-#ifdef XCOFF64
-#define FORCE_SYMNAMES_IN_STRINGS
-#endif
-
-/* Handle the csect auxent of a C_EXT or C_HIDEXT symbol. */
-
-static bfd_boolean coff_pointerize_aux_hook
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-
-static bfd_boolean
-coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
- bfd *abfd ATTRIBUTE_UNUSED;
- combined_entry_type *table_base;
- combined_entry_type *symbol;
- unsigned int indaux;
- combined_entry_type *aux;
-{
- int class = symbol->u.syment.n_sclass;
-
- if ((class == C_EXT || class == C_HIDEXT)
- && indaux + 1 == symbol->u.syment.n_numaux)
- {
- if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD)
- {
- aux->u.auxent.x_csect.x_scnlen.p =
- table_base + aux->u.auxent.x_csect.x_scnlen.l;
- aux->fix_scnlen = 1;
- }
-
- /* Return TRUE to indicate that the caller should not do any
- further work on this auxent. */
- return TRUE;
- }
-
- /* Return FALSE to indicate that this auxent should be handled by
- the caller. */
- return FALSE;
-}
-
-#else
-#ifdef I960
-
-/* We don't want to pointerize bal entries. */
-
-static bfd_boolean coff_pointerize_aux_hook
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-
-static bfd_boolean
-coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
- bfd *abfd ATTRIBUTE_UNUSED;
- combined_entry_type *table_base ATTRIBUTE_UNUSED;
- combined_entry_type *symbol;
- unsigned int indaux;
- combined_entry_type *aux ATTRIBUTE_UNUSED;
-{
- /* Return TRUE if we don't want to pointerize this aux entry, which
- is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */
- return (indaux == 1
- && (symbol->u.syment.n_sclass == C_LEAFPROC
- || symbol->u.syment.n_sclass == C_LEAFSTAT
- || symbol->u.syment.n_sclass == C_LEAFEXT));
-}
-
-#else /* ! I960 */
-
-#define coff_pointerize_aux_hook 0
-
-#endif /* ! I960 */
-#endif /* ! RS6000COFF_C */
-
-/* Print an aux entry. This returns TRUE if it has printed it. */
-
-static bfd_boolean coff_print_aux
- PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
- combined_entry_type *, unsigned int));
-
-static bfd_boolean
-coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
- bfd *abfd ATTRIBUTE_UNUSED;
- FILE *file ATTRIBUTE_UNUSED;
- combined_entry_type *table_base ATTRIBUTE_UNUSED;
- combined_entry_type *symbol ATTRIBUTE_UNUSED;
- combined_entry_type *aux ATTRIBUTE_UNUSED;
- unsigned int indaux ATTRIBUTE_UNUSED;
-{
-#ifdef RS6000COFF_C
- if ((symbol->u.syment.n_sclass == C_EXT
- || symbol->u.syment.n_sclass == C_HIDEXT)
- && indaux + 1 == symbol->u.syment.n_numaux)
- {
- /* This is a csect entry. */
- fprintf (file, "AUX ");
- if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD)
- {
- BFD_ASSERT (! aux->fix_scnlen);
-#ifdef XCOFF64
- fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l);
-#else
- fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
-#endif
- }
- else
- {
- fprintf (file, "indx ");
- if (! aux->fix_scnlen)
-#ifdef XCOFF64
- fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l);
-#else
- fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
-#endif
- else
- fprintf (file, "%4ld",
- (long) (aux->u.auxent.x_csect.x_scnlen.p - table_base));
- }
- fprintf (file,
- " prmhsh %ld snhsh %u typ %d algn %d clss %u stb %ld snstb %u",
- aux->u.auxent.x_csect.x_parmhash,
- (unsigned int) aux->u.auxent.x_csect.x_snhash,
- SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp),
- SMTYP_ALIGN (aux->u.auxent.x_csect.x_smtyp),
- (unsigned int) aux->u.auxent.x_csect.x_smclas,
- aux->u.auxent.x_csect.x_stab,
- (unsigned int) aux->u.auxent.x_csect.x_snstab);
- return TRUE;
- }
-#endif
-
- /* Return FALSE to indicate that no special action was taken. */
- return FALSE;
-}
-
-/*
-SUBSUBSECTION
- Writing relocations
-
- To write relocations, the back end steps though the
- canonical relocation table and create an
- @code{internal_reloc}. The symbol index to use is removed from
- the @code{offset} field in the symbol table supplied. The
- address comes directly from the sum of the section base
- address and the relocation offset; the type is dug directly
- from the howto field. Then the @code{internal_reloc} is
- swapped into the shape of an @code{external_reloc} and written
- out to disk.
-
-*/
-
-#ifdef TARG_AUX
-
-static int compare_arelent_ptr PARAMS ((const PTR, const PTR));
-
-/* AUX's ld wants relocations to be sorted. */
-static int
-compare_arelent_ptr (x, y)
- const PTR x;
- const PTR y;
-{
- const arelent **a = (const arelent **) x;
- const arelent **b = (const arelent **) y;
- bfd_size_type aadr = (*a)->address;
- bfd_size_type badr = (*b)->address;
-
- return (aadr < badr ? -1 : badr < aadr ? 1 : 0);
-}
-
-#endif /* TARG_AUX */
-
-static bfd_boolean
-coff_write_relocs (abfd, first_undef)
- bfd * abfd;
- int first_undef;
-{
- asection *s;
-
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
- {
- unsigned int i;
- struct external_reloc dst;
- arelent **p;
-
-#ifndef TARG_AUX
- p = s->orelocation;
-#else
- {
- /* Sort relocations before we write them out. */
- bfd_size_type amt;
-
- amt = s->reloc_count;
- amt *= sizeof (arelent *);
- p = (arelent **) bfd_malloc (amt);
- if (p == NULL && s->reloc_count > 0)
- return FALSE;
- memcpy (p, s->orelocation, (size_t) amt);
- qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr);
- }
-#endif
-
- if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0)
- return FALSE;
-
-#ifdef COFF_WITH_PE
- if (obj_pe (abfd) && s->reloc_count >= 0xffff)
- {
- /* Encode real count here as first reloc. */
- struct internal_reloc n;
-
- memset ((PTR) & n, 0, sizeof (n));
- /* Add one to count *this* reloc (grr). */
- n.r_vaddr = s->reloc_count + 1;
- coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
- abfd) != bfd_coff_relsz (abfd))
- return FALSE;
- }
-#endif
-
- for (i = 0; i < s->reloc_count; i++)
- {
- struct internal_reloc n;
- arelent *q = p[i];
-
- memset ((PTR) & n, 0, sizeof (n));
-
- /* Now we've renumbered the symbols we know where the
- undefined symbols live in the table. Check the reloc
- entries for symbols who's output bfd isn't the right one.
- This is because the symbol was undefined (which means
- that all the pointers are never made to point to the same
- place). This is a bad thing,'cause the symbols attached
- to the output bfd are indexed, so that the relocation
- entries know which symbol index they point to. So we
- have to look up the output symbol here. */
-
- if (q->sym_ptr_ptr[0]->the_bfd != abfd)
- {
- int j;
- const char *sname = q->sym_ptr_ptr[0]->name;
- asymbol **outsyms = abfd->outsymbols;
-
- for (j = first_undef; outsyms[j]; j++)
- {
- const char *intable = outsyms[j]->name;
-
- if (strcmp (intable, sname) == 0) {
- /* Got a hit, so repoint the reloc. */
- q->sym_ptr_ptr = outsyms + j;
- break;
- }
- }
- }
-
- n.r_vaddr = q->address + s->vma;
-
-#ifdef R_IHCONST
- /* The 29k const/consth reloc pair is a real kludge. The consth
- part doesn't have a symbol; it has an offset. So rebuilt
- that here. */
- if (q->howto->type == R_IHCONST)
- n.r_symndx = q->addend;
- else
-#endif
- if (q->sym_ptr_ptr)
- {
-#ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
- if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s))
-#else
- if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr
- && ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0)
-#endif
- /* This is a relocation relative to the absolute symbol. */
- n.r_symndx = -1;
- else
- {
- n.r_symndx = get_index ((*(q->sym_ptr_ptr)));
- /* Take notice if the symbol reloc points to a symbol
- we don't have in our symbol table. What should we
- do for this?? */
- if (n.r_symndx > obj_conv_table_size (abfd))
- abort ();
- }
- }
-
-#ifdef SWAP_OUT_RELOC_OFFSET
- n.r_offset = q->addend;
-#endif
-
-#ifdef SELECT_RELOC
- /* Work out reloc type from what is required. */
- SELECT_RELOC (n, q->howto);
-#else
- n.r_type = q->howto->type;
-#endif
- coff_swap_reloc_out (abfd, &n, &dst);
-
- if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
- abfd) != bfd_coff_relsz (abfd))
- return FALSE;
- }
-
-#ifdef TARG_AUX
- if (p != NULL)
- free (p);
-#endif
- }
-
- return TRUE;
-}
-
-/* Set flags and magic number of a coff file from architecture and machine
- type. Result is TRUE if we can represent the arch&type, FALSE if not. */
-
-static bfd_boolean
-coff_set_flags (abfd, magicp, flagsp)
- bfd * abfd;
- unsigned int *magicp ATTRIBUTE_UNUSED;
- unsigned short *flagsp ATTRIBUTE_UNUSED;
-{
- switch (bfd_get_arch (abfd))
- {
-#ifdef Z8KMAGIC
- case bfd_arch_z8k:
- *magicp = Z8KMAGIC;
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_z8001:
- *flagsp = F_Z8001;
- break;
- case bfd_mach_z8002:
- *flagsp = F_Z8002;
- break;
- default:
- return FALSE;
- }
- return TRUE;
-#endif
-#ifdef I960ROMAGIC
-
- case bfd_arch_i960:
-
- {
- unsigned flags;
- *magicp = I960ROMAGIC;
- /*
- ((bfd_get_file_flags(abfd) & WP_TEXT) ? I960ROMAGIC :
- I960RWMAGIC); FIXME???
- */
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_i960_core:
- flags = F_I960CORE;
- break;
- case bfd_mach_i960_kb_sb:
- flags = F_I960KB;
- break;
- case bfd_mach_i960_mc:
- flags = F_I960MC;
- break;
- case bfd_mach_i960_xa:
- flags = F_I960XA;
- break;
- case bfd_mach_i960_ca:
- flags = F_I960CA;
- break;
- case bfd_mach_i960_ka_sa:
- flags = F_I960KA;
- break;
- case bfd_mach_i960_jx:
- flags = F_I960JX;
- break;
- case bfd_mach_i960_hx:
- flags = F_I960HX;
- break;
- default:
- return FALSE;
- }
- *flagsp = flags;
- return TRUE;
- }
- break;
-#endif
-
-#ifdef TIC30MAGIC
- case bfd_arch_tic30:
- *magicp = TIC30MAGIC;
- return TRUE;
-#endif
-
-#ifdef TICOFF_DEFAULT_MAGIC
- case TICOFF_TARGET_ARCH:
- /* If there's no indication of which version we want, use the default. */
- if (!abfd->xvec )
- *magicp = TICOFF_DEFAULT_MAGIC;
- else
- {
- /* We may want to output in a different COFF version. */
- switch (abfd->xvec->name[4])
- {
- case '0':
- *magicp = TICOFF0MAGIC;
- break;
- case '1':
- *magicp = TICOFF1MAGIC;
- break;
- case '2':
- *magicp = TICOFF2MAGIC;
- break;
- default:
- return FALSE;
- }
- }
- TICOFF_TARGET_MACHINE_SET (flagsp, bfd_get_mach (abfd));
- return TRUE;
-#endif
-
-#ifdef TIC80_ARCH_MAGIC
- case bfd_arch_tic80:
- *magicp = TIC80_ARCH_MAGIC;
- return TRUE;
-#endif
-#ifdef ARMMAGIC
- case bfd_arch_arm:
-#ifdef ARM_WINCE
- * magicp = ARMPEMAGIC;
-#else
- * magicp = ARMMAGIC;
-#endif
- * flagsp = 0;
- if (APCS_SET (abfd))
- {
- if (APCS_26_FLAG (abfd))
- * flagsp |= F_APCS26;
-
- if (APCS_FLOAT_FLAG (abfd))
- * flagsp |= F_APCS_FLOAT;
-
- if (PIC_FLAG (abfd))
- * flagsp |= F_PIC;
- }
- if (INTERWORK_SET (abfd) && INTERWORK_FLAG (abfd))
- * flagsp |= F_INTERWORK;
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_arm_2: * flagsp |= F_ARM_2; break;
- case bfd_mach_arm_2a: * flagsp |= F_ARM_2a; break;
- case bfd_mach_arm_3: * flagsp |= F_ARM_3; break;
- case bfd_mach_arm_3M: * flagsp |= F_ARM_3M; break;
- case bfd_mach_arm_4: * flagsp |= F_ARM_4; break;
- case bfd_mach_arm_4T: * flagsp |= F_ARM_4T; break;
- case bfd_mach_arm_5: * flagsp |= F_ARM_5; break;
- /* FIXME: we do not have F_ARM vaues greater than F_ARM_5.
- See also the comment in coff_set_arch_mach_hook(). */
- case bfd_mach_arm_5T: * flagsp |= F_ARM_5; break;
- case bfd_mach_arm_5TE: * flagsp |= F_ARM_5; break;
- case bfd_mach_arm_XScale: * flagsp |= F_ARM_5; break;
- }
- return TRUE;
-#endif
-#ifdef PPCMAGIC
- case bfd_arch_powerpc:
- *magicp = PPCMAGIC;
- return TRUE;
- break;
-#endif
-#ifdef I386MAGIC
- case bfd_arch_i386:
- *magicp = I386MAGIC;
-#ifdef LYNXOS
- /* Just overwrite the usual value if we're doing Lynx. */
- *magicp = LYNXCOFFMAGIC;
-#endif
- return TRUE;
- break;
-#endif
-#ifdef I860MAGIC
- case bfd_arch_i860:
- *magicp = I860MAGIC;
- return TRUE;
- break;
-#endif
-#ifdef IA64MAGIC
- case bfd_arch_ia64:
- *magicp = IA64MAGIC;
- return TRUE;
- break;
-#endif
-#ifdef MC68MAGIC
- case bfd_arch_m68k:
-#ifdef APOLLOM68KMAGIC
- *magicp = APOLLO_COFF_VERSION_NUMBER;
-#else
- /* NAMES_HAVE_UNDERSCORE may be defined by coff-u68k.c. */
-#ifdef NAMES_HAVE_UNDERSCORE
- *magicp = MC68KBCSMAGIC;
-#else
- *magicp = MC68MAGIC;
-#endif
-#endif
-#ifdef LYNXOS
- /* Just overwrite the usual value if we're doing Lynx. */
- *magicp = LYNXCOFFMAGIC;
-#endif
- return TRUE;
- break;
-#endif
-
-#ifdef MC88MAGIC
- case bfd_arch_m88k:
- *magicp = MC88OMAGIC;
- return TRUE;
- break;
-#endif
-#ifdef H8300MAGIC
- case bfd_arch_h8300:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_h8300:
- *magicp = H8300MAGIC;
- return TRUE;
- case bfd_mach_h8300h:
- *magicp = H8300HMAGIC;
- return TRUE;
- case bfd_mach_h8300s:
- *magicp = H8300SMAGIC;
- return TRUE;
- case bfd_mach_h8300hn:
- *magicp = H8300HNMAGIC;
- return TRUE;
- case bfd_mach_h8300sn:
- *magicp = H8300SNMAGIC;
- return TRUE;
- }
- break;
-#endif
-
-#ifdef SH_ARCH_MAGIC_BIG
- case bfd_arch_sh:
-#ifdef COFF_IMAGE_WITH_PE
- *magicp = SH_ARCH_MAGIC_WINCE;
-#else
- if (bfd_big_endian (abfd))
- *magicp = SH_ARCH_MAGIC_BIG;
- else
- *magicp = SH_ARCH_MAGIC_LITTLE;
-#endif
- return TRUE;
- break;
-#endif
-
-#ifdef MIPS_ARCH_MAGIC_WINCE
- case bfd_arch_mips:
- *magicp = MIPS_ARCH_MAGIC_WINCE;
- return TRUE;
- break;
-#endif
-
-#ifdef SPARCMAGIC
- case bfd_arch_sparc:
- *magicp = SPARCMAGIC;
-#ifdef LYNXOS
- /* Just overwrite the usual value if we're doing Lynx. */
- *magicp = LYNXCOFFMAGIC;
-#endif
- return TRUE;
- break;
-#endif
-
-#ifdef H8500MAGIC
- case bfd_arch_h8500:
- *magicp = H8500MAGIC;
- return TRUE;
- break;
-#endif
-#ifdef A29K_MAGIC_BIG
- case bfd_arch_a29k:
- if (bfd_big_endian (abfd))
- *magicp = A29K_MAGIC_BIG;
- else
- *magicp = A29K_MAGIC_LITTLE;
- return TRUE;
- break;
-#endif
-
-#ifdef WE32KMAGIC
- case bfd_arch_we32k:
- *magicp = WE32KMAGIC;
- return TRUE;
- break;
-#endif
-
-#ifdef RS6000COFF_C
- case bfd_arch_rs6000:
-#ifndef PPCMAGIC
- case bfd_arch_powerpc:
-#endif
- BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
- *magicp = bfd_xcoff_magic_number (abfd);
- return TRUE;
- break;
-#endif
-
-#ifdef MCOREMAGIC
- case bfd_arch_mcore:
- * magicp = MCOREMAGIC;
- return TRUE;
-#endif
-
-#ifdef W65MAGIC
- case bfd_arch_w65:
- *magicp = W65MAGIC;
- return TRUE;
-#endif
-
-#ifdef OR32_MAGIC_BIG
- case bfd_arch_or32:
- if (bfd_big_endian (abfd))
- * magicp = OR32_MAGIC_BIG;
- else
- * magicp = OR32_MAGIC_LITTLE;
- return TRUE;
-#endif
-
- default: /* Unknown architecture. */
- /* Fall through to "return FALSE" below, to avoid
- "statement never reached" errors on the one below. */
- break;
- }
-
- return FALSE;
-}
-
-static bfd_boolean
-coff_set_arch_mach (abfd, arch, machine)
- bfd * abfd;
- enum bfd_architecture arch;
- unsigned long machine;
-{
- unsigned dummy1;
- unsigned short dummy2;
-
- if (! bfd_default_set_arch_mach (abfd, arch, machine))
- return FALSE;
-
- if (arch != bfd_arch_unknown
- && ! coff_set_flags (abfd, &dummy1, &dummy2))
- return FALSE; /* We can't represent this type */
-
- return TRUE; /* We're easy ... */
-}
-
-#ifdef COFF_IMAGE_WITH_PE
-
-/* This is used to sort sections by VMA, as required by PE image
- files. */
-
-static int sort_by_secaddr PARAMS ((const PTR, const PTR));
-
-static int
-sort_by_secaddr (arg1, arg2)
- const PTR arg1;
- const PTR arg2;
-{
- const asection *a = *(const asection **) arg1;
- const asection *b = *(const asection **) arg2;
-
- if (a->vma < b->vma)
- return -1;
- else if (a->vma > b->vma)
- return 1;
- else
- return 0;
-}
-
-#endif /* COFF_IMAGE_WITH_PE */
-
-/* Calculate the file position for each section. */
-
-#ifndef I960
-#define ALIGN_SECTIONS_IN_FILE
-#endif
-#if defined(TIC80COFF) || defined(TICOFF)
-#undef ALIGN_SECTIONS_IN_FILE
-#endif
-
-static bfd_boolean
-coff_compute_section_file_positions (abfd)
- bfd * abfd;
-{
- asection *current;
- asection *previous = (asection *) NULL;
- file_ptr sofar = bfd_coff_filhsz (abfd);
- bfd_boolean align_adjust;
-#ifdef ALIGN_SECTIONS_IN_FILE
- file_ptr old_sofar;
-#endif
-
-#ifdef RS6000COFF_C
- /* On XCOFF, if we have symbols, set up the .debug section. */
- if (bfd_get_symcount (abfd) > 0)
- {
- bfd_size_type sz;
- bfd_size_type i, symcount;
- asymbol **symp;
-
- sz = 0;
- symcount = bfd_get_symcount (abfd);
- for (symp = abfd->outsymbols, i = 0; i < symcount; symp++, i++)
- {
- coff_symbol_type *cf;
-
- cf = coff_symbol_from (abfd, *symp);
- if (cf != NULL
- && cf->native != NULL
- && SYMNAME_IN_DEBUG (&cf->native->u.syment))
- {
- size_t len;
-
- len = strlen (bfd_asymbol_name (*symp));
- if (len > SYMNMLEN || bfd_coff_force_symnames_in_strings (abfd))
- sz += len + 1 + bfd_coff_debug_string_prefix_length (abfd);
- }
- }
- if (sz > 0)
- {
- asection *dsec;
-
- dsec = bfd_make_section_old_way (abfd, ".debug");
- if (dsec == NULL)
- abort ();
- dsec->_raw_size = sz;
- dsec->flags |= SEC_HAS_CONTENTS;
- }
- }
-#endif
-
-#ifdef COFF_IMAGE_WITH_PE
- int page_size;
- if (coff_data (abfd)->link_info)
- {
- page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
-
- /* If no file alignment has been set, default to one.
- This repairs 'ld -r' for arm-wince-pe target. */
- if (page_size == 0)
- page_size = 1;
- }
- else
- page_size = PE_DEF_FILE_ALIGNMENT;
-#else
-#ifdef COFF_PAGE_SIZE
- int page_size = COFF_PAGE_SIZE;
-#endif
-#endif
-
- if (bfd_get_start_address (abfd))
- {
- /* A start address may have been added to the original file. In this
- case it will need an optional header to record it. */
- abfd->flags |= EXEC_P;
- }
-
- if (abfd->flags & EXEC_P)
- sofar += bfd_coff_aoutsz (abfd);
-#ifdef RS6000COFF_C
- else if (xcoff_data (abfd)->full_aouthdr)
- sofar += bfd_coff_aoutsz (abfd);
- else
- sofar += SMALL_AOUTSZ;
-#endif
-
- sofar += abfd->section_count * bfd_coff_scnhsz (abfd);
-
-#ifdef RS6000COFF_C
- /* XCOFF handles overflows in the reloc and line number count fields
- by allocating a new section header to hold the correct counts. */
- for (current = abfd->sections; current != NULL; current = current->next)
- if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff)
- sofar += bfd_coff_scnhsz (abfd);
-#endif
-
-#ifdef COFF_IMAGE_WITH_PE
- {
- /* PE requires the sections to be in memory order when listed in
- the section headers. It also does not like empty loadable
- sections. The sections apparently do not have to be in the
- right order in the image file itself, but we do need to get the
- target_index values right. */
-
- unsigned int count;
- asection **section_list;
- unsigned int i;
- int target_index;
- bfd_size_type amt;
-
- count = 0;
- for (current = abfd->sections; current != NULL; current = current->next)
- ++count;
-
- /* We allocate an extra cell to simplify the final loop. */
- amt = sizeof (struct asection *) * (count + 1);
- section_list = bfd_malloc (amt);
- if (section_list == NULL)
- return FALSE;
-
- i = 0;
- for (current = abfd->sections; current != NULL; current = current->next)
- {
- section_list[i] = current;
- ++i;
- }
- section_list[i] = NULL;
-
- qsort (section_list, count, sizeof (asection *), sort_by_secaddr);
-
- /* Rethread the linked list into sorted order; at the same time,
- assign target_index values. */
- target_index = 1;
- abfd->sections = section_list[0];
- for (i = 0; i < count; i++)
- {
- current = section_list[i];
- current->next = section_list[i + 1];
-
- /* Later, if the section has zero size, we'll be throwing it
- away, so we don't want to number it now. Note that having
- a zero size and having real contents are different
- concepts: .bss has no contents, but (usually) non-zero
- size. */
- if (current->_raw_size == 0)
- {
- /* Discard. However, it still might have (valid) symbols
- in it, so arbitrarily set it to section 1 (indexing is
- 1-based here; usually .text). __end__ and other
- contents of .endsection really have this happen.
- FIXME: This seems somewhat dubious. */
- current->target_index = 1;
- }
- else
- current->target_index = target_index++;
- }
- abfd->section_tail = &current->next;
-
- free (section_list);
- }
-#else /* ! COFF_IMAGE_WITH_PE */
- {
- /* Set the target_index field. */
- int target_index;
-
- target_index = 1;
- for (current = abfd->sections; current != NULL; current = current->next)
- current->target_index = target_index++;
- }
-#endif /* ! COFF_IMAGE_WITH_PE */
-
- align_adjust = FALSE;
- for (current = abfd->sections;
- current != (asection *) NULL;
- current = current->next)
- {
-#ifdef COFF_IMAGE_WITH_PE
- /* With PE we have to pad each section to be a multiple of its
- page size too, and remember both sizes. */
- if (coff_section_data (abfd, current) == NULL)
- {
- bfd_size_type amt = sizeof (struct coff_section_tdata);
- current->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
- if (current->used_by_bfd == NULL)
- return FALSE;
- }
- if (pei_section_data (abfd, current) == NULL)
- {
- bfd_size_type amt = sizeof (struct pei_section_tdata);
- coff_section_data (abfd, current)->tdata
- = (PTR) bfd_zalloc (abfd, amt);
- if (coff_section_data (abfd, current)->tdata == NULL)
- return FALSE;
- }
- if (pei_section_data (abfd, current)->virt_size == 0)
- pei_section_data (abfd, current)->virt_size = current->_raw_size;
-#endif
-
- /* Only deal with sections which have contents. */
- if (!(current->flags & SEC_HAS_CONTENTS))
- continue;
-
-#ifdef COFF_IMAGE_WITH_PE
- /* Make sure we skip empty sections in a PE image. */
- if (current->_raw_size == 0)
- continue;
-#endif
-
- /* Align the sections in the file to the same boundary on
- which they are aligned in virtual memory. I960 doesn't
- do this (FIXME) so we can stay in sync with Intel. 960
- doesn't yet page from files... */
-#ifdef ALIGN_SECTIONS_IN_FILE
- if ((abfd->flags & EXEC_P) != 0)
- {
- /* Make sure this section is aligned on the right boundary - by
- padding the previous section up if necessary. */
-
- old_sofar = sofar;
-#ifdef RS6000COFF_C
- /* AIX loader checks the text section alignment of (vma - filepos)
- So even though the filepos may be aligned wrt the o_algntext, for
- AIX executables, this check fails. This shows up when a native
- AIX executable is stripped with gnu strip because the default vma
- of native is 0x10000150 but default for gnu is 0x10000140. Gnu
- stripped gnu excutable passes this check because the filepos is
- 0x0140. This problem also show up with 64 bit shared objects. The
- data section must also be aligned. */
- if (!strcmp (current->name, _TEXT)
- || !strcmp (current->name, _DATA))
- {
- bfd_vma pad;
- bfd_vma align;
-
- sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
-
- align = 1 << current->alignment_power;
- pad = abs (current->vma - sofar) % align;
-
- if (pad)
- {
- pad = align - pad;
- sofar += pad;
- }
- }
- else
-#else
- {
- sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
- }
-#endif
- if (previous != (asection *) NULL)
- previous->_raw_size += sofar - old_sofar;
- }
-
-#endif
-
- /* In demand paged files the low order bits of the file offset
- must match the low order bits of the virtual address. */
-#ifdef COFF_PAGE_SIZE
- if ((abfd->flags & D_PAGED) != 0
- && (current->flags & SEC_ALLOC) != 0)
- sofar += (current->vma - sofar) % page_size;
-#endif
- current->filepos = sofar;
-
-#ifdef COFF_IMAGE_WITH_PE
- /* Set the padded size. */
- current->_raw_size = (current->_raw_size + page_size -1) & -page_size;
-#endif
-
- sofar += current->_raw_size;
-
-#ifdef ALIGN_SECTIONS_IN_FILE
- /* Make sure that this section is of the right size too. */
- if ((abfd->flags & EXEC_P) == 0)
- {
- bfd_size_type old_size;
-
- old_size = current->_raw_size;
- current->_raw_size = BFD_ALIGN (current->_raw_size,
- 1 << current->alignment_power);
- align_adjust = current->_raw_size != old_size;
- sofar += current->_raw_size - old_size;
- }
- else
- {
- old_sofar = sofar;
- sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
- align_adjust = sofar != old_sofar;
- current->_raw_size += sofar - old_sofar;
- }
-#endif
-
-#ifdef COFF_IMAGE_WITH_PE
- /* For PE we need to make sure we pad out to the aligned
- _raw_size, in case the caller only writes out data to the
- unaligned _raw_size. */
- if (pei_section_data (abfd, current)->virt_size < current->_raw_size)
- align_adjust = TRUE;
-#endif
-
-#ifdef _LIB
- /* Force .lib sections to start at zero. The vma is then
- incremented in coff_set_section_contents. This is right for
- SVR3.2. */
- if (strcmp (current->name, _LIB) == 0)
- bfd_set_section_vma (abfd, current, 0);
-#endif
-
- previous = current;
- }
-
- /* It is now safe to write to the output file. If we needed an
- alignment adjustment for the last section, then make sure that
- there is a byte at offset sofar. If there are no symbols and no
- relocs, then nothing follows the last section. If we don't force
- the last byte out, then the file may appear to be truncated. */
- if (align_adjust)
- {
- bfd_byte b;
-
- b = 0;
- if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0
- || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return FALSE;
- }
-
- /* Make sure the relocations are aligned. We don't need to make
- sure that this byte exists, because it will only matter if there
- really are relocs. */
- sofar = BFD_ALIGN (sofar, 1 << COFF_DEFAULT_SECTION_ALIGNMENT_POWER);
-
- obj_relocbase (abfd) = sofar;
- abfd->output_has_begun = TRUE;
-
- return TRUE;
-}
-
-#if 0
-
-/* This can never work, because it is called too late--after the
- section positions have been set. I can't figure out what it is
- for, so I am going to disable it--Ian Taylor 20 March 1996. */
-
-/* If .file, .text, .data, .bss symbols are missing, add them. */
-/* @@ Should we only be adding missing symbols, or overriding the aux
- values for existing section symbols? */
-static bfd_boolean
-coff_add_missing_symbols (abfd)
- bfd *abfd;
-{
- unsigned int nsyms = bfd_get_symcount (abfd);
- asymbol **sympp = abfd->outsymbols;
- asymbol **sympp2;
- unsigned int i;
- int need_text = 1, need_data = 1, need_bss = 1, need_file = 1;
- bfd_size_type amt;
-
- for (i = 0; i < nsyms; i++)
- {
- coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]);
- const char *name;
-
- if (csym)
- {
- /* Only do this if there is a coff representation of the input
- symbol. */
- if (csym->native && csym->native->u.syment.n_sclass == C_FILE)
- {
- need_file = 0;
- continue;
- }
- name = csym->symbol.name;
- if (!name)
- continue;
- if (!strcmp (name, _TEXT))
- need_text = 0;
-#ifdef APOLLO_M68
- else if (!strcmp (name, ".wtext"))
- need_text = 0;
-#endif
- else if (!strcmp (name, _DATA))
- need_data = 0;
- else if (!strcmp (name, _BSS))
- need_bss = 0;
- }
- }
- /* Now i == bfd_get_symcount (abfd). */
- /* @@ For now, don't deal with .file symbol. */
- need_file = 0;
-
- if (!need_text && !need_data && !need_bss && !need_file)
- return TRUE;
- nsyms += need_text + need_data + need_bss + need_file;
- amt = nsyms;
- amt *= sizeof (asymbol *);
- sympp2 = (asymbol **) bfd_alloc (abfd, amt);
- if (!sympp2)
- return FALSE;
- memcpy (sympp2, sympp, i * sizeof (asymbol *));
-
- if (need_file)
- /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */
- abort ();
-
- if (need_text)
- sympp2[i++] = coff_section_symbol (abfd, _TEXT);
- if (need_data)
- sympp2[i++] = coff_section_symbol (abfd, _DATA);
- if (need_bss)
- sympp2[i++] = coff_section_symbol (abfd, _BSS);
- BFD_ASSERT (i == nsyms);
- bfd_set_symtab (abfd, sympp2, nsyms);
- return TRUE;
-}
-
-#endif /* 0 */
-
-#ifdef COFF_IMAGE_WITH_PE
-
-static unsigned int pelength;
-static unsigned int peheader;
-
-static bfd_boolean
-coff_read_word (abfd, value)
- bfd *abfd;
- unsigned int *value;
-{
- unsigned char b[2];
- int status;
-
- status = bfd_bread (b, (bfd_size_type) 2, abfd);
- if (status < 1)
- {
- *value = 0;
- return FALSE;
- }
-
- if (status == 1)
- *value = (unsigned int) b[0];
- else
- *value = (unsigned int) (b[0] + (b[1] << 8));
-
- pelength += (unsigned int) status;
-
- return TRUE;
-}
-
-static unsigned int
-coff_compute_checksum (abfd)
- bfd *abfd;
-{
- bfd_boolean more_data;
- file_ptr filepos;
- unsigned int value;
- unsigned int total;
-
- total = 0;
- pelength = 0;
- filepos = (file_ptr) 0;
-
- do
- {
- if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
- return 0;
-
- more_data = coff_read_word (abfd, &value);
- total += value;
- total = 0xffff & (total + (total >> 0x10));
- filepos += 2;
- }
- while (more_data);
-
- return (0xffff & (total + (total >> 0x10)));
-}
-
-static bfd_boolean
-coff_apply_checksum (abfd)
- bfd *abfd;
-{
- unsigned int computed;
- unsigned int checksum = 0;
-
- if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0)
- return FALSE;
-
- if (!coff_read_word (abfd, &peheader))
- return FALSE;
-
- if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
- return FALSE;
-
- checksum = 0;
- bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
-
- if (bfd_seek (abfd, peheader, SEEK_SET) != 0)
- return FALSE;
-
- computed = coff_compute_checksum (abfd);
-
- checksum = computed + pelength;
-
- if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
- return FALSE;
-
- bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
-
- return TRUE;
-}
-
-#endif /* COFF_IMAGE_WITH_PE */
-
-/* SUPPRESS 558 */
-/* SUPPRESS 529 */
-static bfd_boolean
-coff_write_object_contents (abfd)
- bfd * abfd;
-{
- asection *current;
- bfd_boolean hasrelocs = FALSE;
- bfd_boolean haslinno = FALSE;
- bfd_boolean hasdebug = FALSE;
- file_ptr scn_base;
- file_ptr reloc_base;
- file_ptr lineno_base;
- file_ptr sym_base;
- unsigned long reloc_size = 0, reloc_count = 0;
- unsigned long lnno_size = 0;
- bfd_boolean long_section_names;
- asection *text_sec = NULL;
- asection *data_sec = NULL;
- asection *bss_sec = NULL;
- struct internal_filehdr internal_f;
- struct internal_aouthdr internal_a;
-#ifdef COFF_LONG_SECTION_NAMES
- size_t string_size = STRING_SIZE_SIZE;
-#endif
-
- bfd_set_error (bfd_error_system_call);
-
- /* Make a pass through the symbol table to count line number entries and
- put them into the correct asections. */
-
- lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
-
- if (! abfd->output_has_begun)
- {
- if (! coff_compute_section_file_positions (abfd))
- return FALSE;
- }
-
- reloc_base = obj_relocbase (abfd);
-
- /* Work out the size of the reloc and linno areas. */
-
- for (current = abfd->sections; current != NULL; current =
- current->next)
- {
-#ifdef COFF_WITH_PE
- /* We store the actual reloc count in the first reloc's addr. */
- if (obj_pe (abfd) && current->reloc_count >= 0xffff)
- reloc_count ++;
-#endif
- reloc_count += current->reloc_count;
- }
-
- reloc_size = reloc_count * bfd_coff_relsz (abfd);
-
- lineno_base = reloc_base + reloc_size;
- sym_base = lineno_base + lnno_size;
-
- /* Indicate in each section->line_filepos its actual file address. */
- for (current = abfd->sections; current != NULL; current =
- current->next)
- {
- if (current->lineno_count)
- {
- current->line_filepos = lineno_base;
- current->moving_line_filepos = lineno_base;
- lineno_base += current->lineno_count * bfd_coff_linesz (abfd);
- }
- else
- {
- current->line_filepos = 0;
- }
- if (current->reloc_count)
- {
- current->rel_filepos = reloc_base;
- reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
-#ifdef COFF_WITH_PE
- /* Extra reloc to hold real count. */
- if (obj_pe (abfd) && current->reloc_count >= 0xffff)
- reloc_base += bfd_coff_relsz (abfd);
-#endif
- }
- else
- {
- current->rel_filepos = 0;
- }
- }
-
- /* Write section headers to the file. */
- internal_f.f_nscns = 0;
-
- if ((abfd->flags & EXEC_P) != 0)
- scn_base = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
- else
- {
- scn_base = bfd_coff_filhsz (abfd);
-#ifdef RS6000COFF_C
-#ifndef XCOFF64
- if (xcoff_data (abfd)->full_aouthdr)
- scn_base += bfd_coff_aoutsz (abfd);
- else
- scn_base += SMALL_AOUTSZ;
-#endif
-#endif
- }
-
- if (bfd_seek (abfd, scn_base, SEEK_SET) != 0)
- return FALSE;
-
- long_section_names = FALSE;
- for (current = abfd->sections;
- current != NULL;
- current = current->next)
- {
- struct internal_scnhdr section;
- bfd_boolean is_reloc_section = FALSE;
-
-#ifdef COFF_IMAGE_WITH_PE
- if (strcmp (current->name, ".reloc") == 0)
- {
- is_reloc_section = TRUE;
- hasrelocs = TRUE;
- pe_data (abfd)->has_reloc_section = 1;
- }
-#endif
-
- internal_f.f_nscns++;
-
- strncpy (section.s_name, current->name, SCNNMLEN);
-
-#ifdef COFF_LONG_SECTION_NAMES
- /* Handle long section names as in PE. This must be compatible
- with the code in coff_write_symbols and _bfd_coff_final_link. */
- {
- size_t len;
-
- len = strlen (current->name);
- if (len > SCNNMLEN)
- {
- memset (section.s_name, 0, SCNNMLEN);
- sprintf (section.s_name, "/%lu", (unsigned long) string_size);
- string_size += len + 1;
- long_section_names = TRUE;
- }
- }
-#endif
-
-#ifdef _LIB
- /* Always set s_vaddr of .lib to 0. This is right for SVR3.2
- Ian Taylor <ian@cygnus.com>. */
- if (strcmp (current->name, _LIB) == 0)
- section.s_vaddr = 0;
- else
-#endif
- section.s_vaddr = current->vma;
- section.s_paddr = current->lma;
- section.s_size = current->_raw_size;
-#ifdef coff_get_section_load_page
- section.s_page = coff_get_section_load_page (current);
-#endif
-
-#ifdef COFF_WITH_PE
- section.s_paddr = 0;
-#endif
-#ifdef COFF_IMAGE_WITH_PE
- /* Reminder: s_paddr holds the virtual size of the section. */
- if (coff_section_data (abfd, current) != NULL
- && pei_section_data (abfd, current) != NULL)
- section.s_paddr = pei_section_data (abfd, current)->virt_size;
- else
- section.s_paddr = 0;
-#endif
-
- /* If this section has no size or is unloadable then the scnptr
- will be 0 too. */
- if (current->_raw_size == 0 ||
- (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
- section.s_scnptr = 0;
- else
- section.s_scnptr = current->filepos;
-
- section.s_relptr = current->rel_filepos;
- section.s_lnnoptr = current->line_filepos;
- section.s_nreloc = current->reloc_count;
- section.s_nlnno = current->lineno_count;
-#ifndef COFF_IMAGE_WITH_PE
- /* In PEI, relocs come in the .reloc section. */
- if (current->reloc_count != 0)
- hasrelocs = TRUE;
-#endif
- if (current->lineno_count != 0)
- haslinno = TRUE;
- if ((current->flags & SEC_DEBUGGING) != 0
- && ! is_reloc_section)
- hasdebug = TRUE;
-
-#ifdef RS6000COFF_C
-#ifndef XCOFF64
- /* Indicate the use of an XCOFF overflow section header. */
- if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff)
- {
- section.s_nreloc = 0xffff;
- section.s_nlnno = 0xffff;
- }
-#endif
-#endif
-
- section.s_flags = sec_to_styp_flags (current->name, current->flags);
-
- if (!strcmp (current->name, _TEXT))
- text_sec = current;
- else if (!strcmp (current->name, _DATA))
- data_sec = current;
- else if (!strcmp (current->name, _BSS))
- bss_sec = current;
-
-#ifdef I960
- section.s_align = (current->alignment_power
- ? 1 << current->alignment_power
- : 0);
-#endif
-#ifdef TIC80COFF
- /* TI COFF puts the alignment power in bits 8-11 of the flags. */
- section.s_flags |= (current->alignment_power & 0xF) << 8;
-#endif
-#ifdef COFF_ENCODE_ALIGNMENT
- COFF_ENCODE_ALIGNMENT(section, current->alignment_power);
-#endif
-
-#ifdef COFF_IMAGE_WITH_PE
- /* Suppress output of the sections if they are null. ld
- includes the bss and data sections even if there is no size
- assigned to them. NT loader doesn't like it if these section
- headers are included if the sections themselves are not
- needed. See also coff_compute_section_file_positions. */
- if (section.s_size == 0)
- internal_f.f_nscns--;
- else
-#endif
- {
- SCNHDR buff;
- bfd_size_type amt = bfd_coff_scnhsz (abfd);
-
- if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
- || bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
- return FALSE;
- }
-
-#ifdef COFF_WITH_PE
- /* PE stores COMDAT section information in the symbol table. If
- this section is supposed to have some COMDAT info, track down
- the symbol in the symbol table and modify it. */
- if ((current->flags & SEC_LINK_ONCE) != 0)
- {
- unsigned int i, count;
- asymbol **psym;
- coff_symbol_type *csym = NULL;
- asymbol **psymsec;
-
- psymsec = NULL;
- count = bfd_get_symcount (abfd);
- for (i = 0, psym = abfd->outsymbols; i < count; i++, psym++)
- {
- if ((*psym)->section != current)
- continue;
-
- /* Remember the location of the first symbol in this
- section. */
- if (psymsec == NULL)
- psymsec = psym;
-
- /* See if this is the section symbol. */
- if (strcmp ((*psym)->name, current->name) == 0)
- {
- csym = coff_symbol_from (abfd, *psym);
- if (csym == NULL
- || csym->native == NULL
- || csym->native->u.syment.n_numaux < 1
- || csym->native->u.syment.n_sclass != C_STAT
- || csym->native->u.syment.n_type != T_NULL)
- continue;
-
- /* Here *PSYM is the section symbol for CURRENT. */
-
- break;
- }
- }
-
- /* Did we find it?
- Note that we might not if we're converting the file from
- some other object file format. */
- if (i < count)
- {
- combined_entry_type *aux;
-
- /* We don't touch the x_checksum field. The
- x_associated field is not currently supported. */
-
- aux = csym->native + 1;
- switch (current->flags & SEC_LINK_DUPLICATES)
- {
- case SEC_LINK_DUPLICATES_DISCARD:
- aux->u.auxent.x_scn.x_comdat = IMAGE_COMDAT_SELECT_ANY;
- break;
-
- case SEC_LINK_DUPLICATES_ONE_ONLY:
- aux->u.auxent.x_scn.x_comdat =
- IMAGE_COMDAT_SELECT_NODUPLICATES;
- break;
-
- case SEC_LINK_DUPLICATES_SAME_SIZE:
- aux->u.auxent.x_scn.x_comdat =
- IMAGE_COMDAT_SELECT_SAME_SIZE;
- break;
-
- case SEC_LINK_DUPLICATES_SAME_CONTENTS:
- aux->u.auxent.x_scn.x_comdat =
- IMAGE_COMDAT_SELECT_EXACT_MATCH;
- break;
- }
-
- /* The COMDAT symbol must be the first symbol from this
- section in the symbol table. In order to make this
- work, we move the COMDAT symbol before the first
- symbol we found in the search above. It's OK to
- rearrange the symbol table at this point, because
- coff_renumber_symbols is going to rearrange it
- further and fix up all the aux entries. */
- if (psym != psymsec)
- {
- asymbol *hold;
- asymbol **pcopy;
-
- hold = *psym;
- for (pcopy = psym; pcopy > psymsec; pcopy--)
- pcopy[0] = pcopy[-1];
- *psymsec = hold;
- }
- }
- }
-#endif /* COFF_WITH_PE */
- }
-
-#ifdef RS6000COFF_C
-#ifndef XCOFF64
- /* XCOFF handles overflows in the reloc and line number count fields
- by creating a new section header to hold the correct values. */
- for (current = abfd->sections; current != NULL; current = current->next)
- {
- if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff)
- {
- struct internal_scnhdr scnhdr;
- SCNHDR buff;
- bfd_size_type amt;
-
- internal_f.f_nscns++;
- strncpy (&(scnhdr.s_name[0]), current->name, 8);
- scnhdr.s_paddr = current->reloc_count;
- scnhdr.s_vaddr = current->lineno_count;
- scnhdr.s_size = 0;
- scnhdr.s_scnptr = 0;
- scnhdr.s_relptr = current->rel_filepos;
- scnhdr.s_lnnoptr = current->line_filepos;
- scnhdr.s_nreloc = current->target_index;
- scnhdr.s_nlnno = current->target_index;
- scnhdr.s_flags = STYP_OVRFLO;
- amt = bfd_coff_scnhsz (abfd);
- if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
- || bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
- return FALSE;
- }
- }
-#endif
-#endif
-
- /* OK, now set up the filehdr... */
-
- /* Don't include the internal abs section in the section count */
-
- /* We will NOT put a fucking timestamp in the header here. Every time you
- put it back, I will come in and take it out again. I'm sorry. This
- field does not belong here. We fill it with a 0 so it compares the
- same but is not a reasonable time. -- gnu@cygnus.com */
- internal_f.f_timdat = 0;
- internal_f.f_flags = 0;
-
- if (abfd->flags & EXEC_P)
- internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
- else
- {
- internal_f.f_opthdr = 0;
-#ifdef RS6000COFF_C
-#ifndef XCOFF64
- if (xcoff_data (abfd)->full_aouthdr)
- internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
- else
- internal_f.f_opthdr = SMALL_AOUTSZ;
-#endif
-#endif
- }
-
- if (!hasrelocs)
- internal_f.f_flags |= F_RELFLG;
- if (!haslinno)
- internal_f.f_flags |= F_LNNO;
- if (abfd->flags & EXEC_P)
- internal_f.f_flags |= F_EXEC;
-#ifdef COFF_IMAGE_WITH_PE
- if (! hasdebug)
- internal_f.f_flags |= IMAGE_FILE_DEBUG_STRIPPED;
-#endif
-
-#ifdef COFF_WITH_PE
- internal_f.f_flags |= IMAGE_FILE_32BIT_MACHINE;
-#else
- if (bfd_little_endian (abfd))
- internal_f.f_flags |= F_AR32WR;
- else
- internal_f.f_flags |= F_AR32W;
-#endif
-
-#ifdef TI_TARGET_ID
- /* Target id is used in TI COFF v1 and later; COFF0 won't use this field,
- but it doesn't hurt to set it internally. */
- internal_f.f_target_id = TI_TARGET_ID;
-#endif
-#ifdef TIC80_TARGET_ID
- internal_f.f_target_id = TIC80_TARGET_ID;
-#endif
-
- /* FIXME, should do something about the other byte orders and
- architectures. */
-
-#ifdef RS6000COFF_C
- if ((abfd->flags & DYNAMIC) != 0)
- internal_f.f_flags |= F_SHROBJ;
- if (bfd_get_section_by_name (abfd, _LOADER) != NULL)
- internal_f.f_flags |= F_DYNLOAD;
-#endif
-
- memset (&internal_a, 0, sizeof internal_a);
-
- /* Set up architecture-dependent stuff. */
- {
- unsigned int magic = 0;
- unsigned short flags = 0;
-
- coff_set_flags (abfd, &magic, &flags);
- internal_f.f_magic = magic;
- internal_f.f_flags |= flags;
- /* ...and the "opt"hdr... */
-
-#ifdef A29K
-#ifdef ULTRA3 /* NYU's machine */
- /* FIXME: This is a bogus check. I really want to see if there
- is a .shbss or a .shdata section, if so then set the magic
- number to indicate a shared data executable. */
- if (internal_f.f_nscns >= 7)
- internal_a.magic = SHMAGIC; /* Shared magic. */
- else
-#endif /* ULTRA3 */
- internal_a.magic = NMAGIC; /* Assume separate i/d. */
-#define __A_MAGIC_SET__
-#endif /* A29K */
-#ifdef TICOFF_AOUT_MAGIC
- internal_a.magic = TICOFF_AOUT_MAGIC;
-#define __A_MAGIC_SET__
-#endif
-#ifdef TIC80COFF
- internal_a.magic = TIC80_ARCH_MAGIC;
-#define __A_MAGIC_SET__
-#endif /* TIC80 */
-#ifdef I860
- /* FIXME: What are the a.out magic numbers for the i860? */
- internal_a.magic = 0;
-#define __A_MAGIC_SET__
-#endif /* I860 */
-#ifdef I960
- internal_a.magic = (magic == I960ROMAGIC ? NMAGIC : OMAGIC);
-#define __A_MAGIC_SET__
-#endif /* I960 */
-#if M88
-#define __A_MAGIC_SET__
- internal_a.magic = PAGEMAGICBCS;
-#endif /* M88 */
-
-#if APOLLO_M68
-#define __A_MAGIC_SET__
- internal_a.magic = APOLLO_COFF_VERSION_NUMBER;
-#endif
-
-#if defined(M68) || defined(WE32K) || defined(M68K)
-#define __A_MAGIC_SET__
-#if defined(LYNXOS)
- internal_a.magic = LYNXCOFFMAGIC;
-#else
-#if defined(TARG_AUX)
- internal_a.magic = (abfd->flags & D_PAGED ? PAGEMAGICPEXECPAGED :
- abfd->flags & WP_TEXT ? PAGEMAGICPEXECSWAPPED :
- PAGEMAGICEXECSWAPPED);
-#else
-#if defined (PAGEMAGICPEXECPAGED)
- internal_a.magic = PAGEMAGICPEXECPAGED;
-#endif
-#endif /* TARG_AUX */
-#endif /* LYNXOS */
-#endif /* M68 || WE32K || M68K */
-
-#if defined(ARM)
-#define __A_MAGIC_SET__
- internal_a.magic = ZMAGIC;
-#endif
-
-#if defined(PPC_PE)
-#define __A_MAGIC_SET__
- internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
-#endif
-
-#if defined MCORE_PE
-#define __A_MAGIC_SET__
- internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
-#endif
-
-#if defined(I386)
-#define __A_MAGIC_SET__
-#if defined(LYNXOS)
- internal_a.magic = LYNXCOFFMAGIC;
-#else /* LYNXOS */
- internal_a.magic = ZMAGIC;
-#endif /* LYNXOS */
-#endif /* I386 */
-
-#if defined(IA64)
-#define __A_MAGIC_SET__
- internal_a.magic = ZMAGIC;
-#endif /* IA64 */
-
-#if defined(SPARC)
-#define __A_MAGIC_SET__
-#if defined(LYNXOS)
- internal_a.magic = LYNXCOFFMAGIC;
-#endif /* LYNXOS */
-#endif /* SPARC */
-
-#ifdef RS6000COFF_C
-#define __A_MAGIC_SET__
- internal_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC :
- (abfd->flags & WP_TEXT) ? RS6K_AOUTHDR_NMAGIC :
- RS6K_AOUTHDR_OMAGIC;
-#endif
-
-#if defined(SH) && defined(COFF_WITH_PE)
-#define __A_MAGIC_SET__
- internal_a.magic = SH_PE_MAGIC;
-#endif
-
-#if defined(MIPS) && defined(COFF_WITH_PE)
-#define __A_MAGIC_SET__
- internal_a.magic = MIPS_PE_MAGIC;
-#endif
-
-#ifdef OR32
-#define __A_MAGIC_SET__
- internal_a.magic = NMAGIC; /* Assume separate i/d. */
-#endif
-
-#ifndef __A_MAGIC_SET__
-#include "Your aouthdr magic number is not being set!"
-#else
-#undef __A_MAGIC_SET__
-#endif
- }
-
- /* FIXME: Does anybody ever set this to another value? */
- internal_a.vstamp = 0;
-
- /* Now should write relocs, strings, syms. */
- obj_sym_filepos (abfd) = sym_base;
-
- if (bfd_get_symcount (abfd) != 0)
- {
- int firstundef;
-#if 0
- if (!coff_add_missing_symbols (abfd))
- return FALSE;
-#endif
- if (!coff_renumber_symbols (abfd, &firstundef))
- return FALSE;
- coff_mangle_symbols (abfd);
- if (! coff_write_symbols (abfd))
- return FALSE;
- if (! coff_write_linenumbers (abfd))
- return FALSE;
- if (! coff_write_relocs (abfd, firstundef))
- return FALSE;
- }
-#ifdef COFF_LONG_SECTION_NAMES
- else if (long_section_names && ! obj_coff_strings_written (abfd))
- {
- /* If we have long section names we have to write out the string
- table even if there are no symbols. */
- if (! coff_write_symbols (abfd))
- return FALSE;
- }
-#endif
-#ifdef COFF_IMAGE_WITH_PE
-#ifdef PPC_PE
- else if ((abfd->flags & EXEC_P) != 0)
- {
- bfd_byte b;
-
- /* PowerPC PE appears to require that all executable files be
- rounded up to the page size. */
- b = 0;
- if (bfd_seek (abfd,
- (file_ptr) BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1,
- SEEK_SET) != 0
- || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return FALSE;
- }
-#endif
-#endif
-
- /* If bfd_get_symcount (abfd) != 0, then we are not using the COFF
- backend linker, and obj_raw_syment_count is not valid until after
- coff_write_symbols is called. */
- if (obj_raw_syment_count (abfd) != 0)
- {
- internal_f.f_symptr = sym_base;
-#ifdef RS6000COFF_C
- /* AIX appears to require that F_RELFLG not be set if there are
- local symbols but no relocations. */
- internal_f.f_flags &=~ F_RELFLG;
-#endif
- }
- else
- {
- if (long_section_names)
- internal_f.f_symptr = sym_base;
- else
- internal_f.f_symptr = 0;
- internal_f.f_flags |= F_LSYMS;
- }
-
- if (text_sec)
- {
- internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
- internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
- }
- if (data_sec)
- {
- internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
- internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
- }
- if (bss_sec)
- {
- internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
- if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
- internal_a.data_start = bss_sec->vma;
- }
-
- internal_a.entry = bfd_get_start_address (abfd);
- internal_f.f_nsyms = obj_raw_syment_count (abfd);
-
-#ifdef RS6000COFF_C
- if (xcoff_data (abfd)->full_aouthdr)
- {
- bfd_vma toc;
- asection *loader_sec;
-
- internal_a.vstamp = 1;
-
- internal_a.o_snentry = xcoff_data (abfd)->snentry;
- if (internal_a.o_snentry == 0)
- internal_a.entry = (bfd_vma) -1;
-
- if (text_sec != NULL)
- {
- internal_a.o_sntext = text_sec->target_index;
- internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec);
- }
- else
- {
- internal_a.o_sntext = 0;
- internal_a.o_algntext = 0;
- }
- if (data_sec != NULL)
- {
- internal_a.o_sndata = data_sec->target_index;
- internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec);
- }
- else
- {
- internal_a.o_sndata = 0;
- internal_a.o_algndata = 0;
- }
- loader_sec = bfd_get_section_by_name (abfd, ".loader");
- if (loader_sec != NULL)
- internal_a.o_snloader = loader_sec->target_index;
- else
- internal_a.o_snloader = 0;
- if (bss_sec != NULL)
- internal_a.o_snbss = bss_sec->target_index;
- else
- internal_a.o_snbss = 0;
-
- toc = xcoff_data (abfd)->toc;
- internal_a.o_toc = toc;
- internal_a.o_sntoc = xcoff_data (abfd)->sntoc;
-
- internal_a.o_modtype = xcoff_data (abfd)->modtype;
- if (xcoff_data (abfd)->cputype != -1)
- internal_a.o_cputype = xcoff_data (abfd)->cputype;
- else
- {
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_rs6000:
- internal_a.o_cputype = 4;
- break;
- case bfd_arch_powerpc:
- if (bfd_get_mach (abfd) == bfd_mach_ppc)
- internal_a.o_cputype = 3;
- else
- internal_a.o_cputype = 1;
- break;
- default:
- abort ();
- }
- }
- internal_a.o_maxstack = xcoff_data (abfd)->maxstack;
- internal_a.o_maxdata = xcoff_data (abfd)->maxdata;
- }
-#endif
-
- /* now write them */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
-
- {
- char * buff;
- bfd_size_type amount = bfd_coff_filhsz (abfd);
-
- buff = bfd_malloc (amount);
- if (buff == NULL)
- return FALSE;
-
- bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
-
- free (buff);
-
- if (amount != bfd_coff_filhsz (abfd))
- return FALSE;
- }
-
- if (abfd->flags & EXEC_P)
- {
- /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
- include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)). */
- char * buff;
- bfd_size_type amount = bfd_coff_aoutsz (abfd);
-
- buff = bfd_malloc (amount);
- if (buff == NULL)
- return FALSE;
-
- coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
-
- free (buff);
-
- if (amount != bfd_coff_aoutsz (abfd))
- return FALSE;
-
-#ifdef COFF_IMAGE_WITH_PE
- if (! coff_apply_checksum (abfd))
- return FALSE;
-#endif
- }
-#ifdef RS6000COFF_C
- else
- {
- AOUTHDR buff;
- size_t size;
-
- /* XCOFF seems to always write at least a small a.out header. */
- coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) &buff);
- if (xcoff_data (abfd)->full_aouthdr)
- size = bfd_coff_aoutsz (abfd);
- else
- size = SMALL_AOUTSZ;
- if (bfd_bwrite ((PTR) &buff, (bfd_size_type) size, abfd) != size)
- return FALSE;
- }
-#endif
-
- return TRUE;
-}
-
-static bfd_boolean
-coff_set_section_contents (abfd, section, location, offset, count)
- bfd * abfd;
- sec_ptr section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- if (! abfd->output_has_begun) /* Set by bfd.c handler. */
- {
- if (! coff_compute_section_file_positions (abfd))
- return FALSE;
- }
-
-#if defined(_LIB) && !defined(TARG_AUX)
-
- /* The physical address field of a .lib section is used to hold the
- number of shared libraries in the section. This code counts the
- number of sections being written, and increments the lma field
- with the number.
-
- I have found no documentation on the contents of this section.
- Experimentation indicates that the section contains zero or more
- records, each of which has the following structure:
-
- - a (four byte) word holding the length of this record, in words,
- - a word that always seems to be set to "2",
- - the path to a shared library, null-terminated and then padded
- to a whole word boundary.
-
- bfd_assert calls have been added to alert if an attempt is made
- to write a section which doesn't follow these assumptions. The
- code has been tested on ISC 4.1 by me, and on SCO by Robert Lipe
- <robertl@arnet.com> (Thanks!).
-
- Gvran Uddeborg <gvran@uddeborg.pp.se>. */
-
- if (strcmp (section->name, _LIB) == 0)
- {
- bfd_byte *rec, *recend;
-
- rec = (bfd_byte *) location;
- recend = rec + count;
- while (rec < recend)
- {
- ++section->lma;
- rec += bfd_get_32 (abfd, rec) * 4;
- }
-
- BFD_ASSERT (rec == recend);
- }
-
-#endif
-
- /* Don't write out bss sections - one way to do this is to
- see if the filepos has not been set. */
- if (section->filepos == 0)
- return TRUE;
-
- if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
- return FALSE;
-
- if (count == 0)
- return TRUE;
-
- return bfd_bwrite (location, count, abfd) == count;
-}
-#if 0
-static bfd_boolean
-coff_close_and_cleanup (abfd)
- bfd *abfd;
-{
- if (!bfd_read_p (abfd))
- switch (abfd->format)
- {
- case bfd_archive:
- if (!_bfd_write_archive_contents (abfd))
- return FALSE;
- break;
- case bfd_object:
- if (!coff_write_object_contents (abfd))
- return FALSE;
- break;
- default:
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- /* We depend on bfd_close to free all the memory on the objalloc. */
- return TRUE;
-}
-
-#endif
-
-static PTR
-buy_and_read (abfd, where, size)
- bfd *abfd;
- file_ptr where;
- bfd_size_type size;
-{
- PTR area = (PTR) bfd_alloc (abfd, size);
- if (!area)
- return (NULL);
- if (bfd_seek (abfd, where, SEEK_SET) != 0
- || bfd_bread (area, size, abfd) != size)
- return (NULL);
- return (area);
-} /* buy_and_read() */
-
-/*
-SUBSUBSECTION
- Reading linenumbers
-
- Creating the linenumber table is done by reading in the entire
- coff linenumber table, and creating another table for internal use.
-
- A coff linenumber table is structured so that each function
- is marked as having a line number of 0. Each line within the
- function is an offset from the first line in the function. The
- base of the line number information for the table is stored in
- the symbol associated with the function.
-
- Note: The PE format uses line number 0 for a flag indicating a
- new source file.
-
- The information is copied from the external to the internal
- table, and each symbol which marks a function is marked by
- pointing its...
-
- How does this work ?
-
-*/
-
-static bfd_boolean
-coff_slurp_line_table (abfd, asect)
- bfd *abfd;
- asection *asect;
-{
- LINENO *native_lineno;
- alent *lineno_cache;
- bfd_size_type amt;
-
- BFD_ASSERT (asect->lineno == (alent *) NULL);
-
- amt = (bfd_size_type) bfd_coff_linesz (abfd) * asect->lineno_count;
- native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt);
- if (native_lineno == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: warning: line number table read failed"),
- bfd_archive_filename (abfd));
- return FALSE;
- }
- amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
- lineno_cache = (alent *) bfd_alloc (abfd, amt);
- if (lineno_cache == NULL)
- return FALSE;
- else
- {
- unsigned int counter = 0;
- alent *cache_ptr = lineno_cache;
- LINENO *src = native_lineno;
-
- while (counter < asect->lineno_count)
- {
- struct internal_lineno dst;
-
- bfd_coff_swap_lineno_in (abfd, src, &dst);
- cache_ptr->line_number = dst.l_lnno;
-
- if (cache_ptr->line_number == 0)
- {
- bfd_boolean warned;
- bfd_signed_vma symndx;
- coff_symbol_type *sym;
-
- warned = FALSE;
- symndx = dst.l_addr.l_symndx;
- if (symndx < 0
- || (bfd_vma) symndx >= obj_raw_syment_count (abfd))
- {
- (*_bfd_error_handler)
- (_("%s: warning: illegal symbol index %ld in line numbers"),
- bfd_archive_filename (abfd), dst.l_addr.l_symndx);
- symndx = 0;
- warned = TRUE;
- }
- /* FIXME: We should not be casting between ints and
- pointers like this. */
- sym = ((coff_symbol_type *)
- ((symndx + obj_raw_syments (abfd))
- ->u.syment._n._n_n._n_zeroes));
- cache_ptr->u.sym = (asymbol *) sym;
- if (sym->lineno != NULL && ! warned)
- {
- (*_bfd_error_handler)
- (_("%s: warning: duplicate line number information for `%s'"),
- bfd_archive_filename (abfd),
- bfd_asymbol_name (&sym->symbol));
- }
- sym->lineno = cache_ptr;
- }
- else
- {
- cache_ptr->u.offset = dst.l_addr.l_paddr
- - bfd_section_vma (abfd, asect);
- } /* If no linenumber expect a symbol index */
-
- cache_ptr++;
- src++;
- counter++;
- }
- cache_ptr->line_number = 0;
-
- }
- asect->lineno = lineno_cache;
- /* FIXME, free native_lineno here, or use alloca or something. */
- return TRUE;
-}
-
-/* Slurp in the symbol table, converting it to generic form. Note
- that if coff_relocate_section is defined, the linker will read
- symbols via coff_link_add_symbols, rather than via this routine. */
-
-static bfd_boolean
-coff_slurp_symbol_table (abfd)
- bfd * abfd;
-{
- combined_entry_type *native_symbols;
- coff_symbol_type *cached_area;
- unsigned int *table_ptr;
- bfd_size_type amt;
- unsigned int number_of_symbols = 0;
-
- if (obj_symbols (abfd))
- return TRUE;
-
- /* Read in the symbol table. */
- if ((native_symbols = coff_get_normalized_symtab (abfd)) == NULL)
- return FALSE;
-
- /* Allocate enough room for all the symbols in cached form. */
- amt = obj_raw_syment_count (abfd);
- amt *= sizeof (coff_symbol_type);
- cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
- if (cached_area == NULL)
- return FALSE;
-
- amt = obj_raw_syment_count (abfd);
- amt *= sizeof (unsigned int);
- table_ptr = (unsigned int *) bfd_alloc (abfd, amt);
-
- if (table_ptr == NULL)
- return FALSE;
- else
- {
- coff_symbol_type *dst = cached_area;
- unsigned int last_native_index = obj_raw_syment_count (abfd);
- unsigned int this_index = 0;
-
- while (this_index < last_native_index)
- {
- combined_entry_type *src = native_symbols + this_index;
- table_ptr[this_index] = number_of_symbols;
- dst->symbol.the_bfd = abfd;
-
- dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset);
- /* We use the native name field to point to the cached field. */
- src->u.syment._n._n_n._n_zeroes = (long) dst;
- dst->symbol.section = coff_section_from_bfd_index (abfd,
- src->u.syment.n_scnum);
- dst->symbol.flags = 0;
- dst->done_lineno = FALSE;
-
- switch (src->u.syment.n_sclass)
- {
-#ifdef I960
- case C_LEAFEXT:
-#if 0
- dst->symbol.value = src->u.syment.n_value - dst->symbol.section->vma;
- dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL;
- dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
-#endif
- /* Fall through to next case. */
-#endif
-
- case C_EXT:
- case C_WEAKEXT:
-#if defined ARM
- case C_THUMBEXT:
- case C_THUMBEXTFUNC:
-#endif
-#ifdef RS6000COFF_C
- case C_HIDEXT:
-#endif
-#ifdef C_SYSTEM
- case C_SYSTEM: /* System Wide variable. */
-#endif
-#ifdef COFF_WITH_PE
- /* In PE, 0x68 (104) denotes a section symbol. */
- case C_SECTION:
- /* In PE, 0x69 (105) denotes a weak external symbol. */
- case C_NT_WEAK:
-#endif
- switch (coff_classify_symbol (abfd, &src->u.syment))
- {
- case COFF_SYMBOL_GLOBAL:
- dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL;
-#if defined COFF_WITH_PE
- /* PE sets the symbol to a value relative to the
- start of the section. */
- dst->symbol.value = src->u.syment.n_value;
-#else
- dst->symbol.value = (src->u.syment.n_value
- - dst->symbol.section->vma);
-#endif
- if (ISFCN ((src->u.syment.n_type)))
- {
- /* A function ext does not go at the end of a
- file. */
- dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
- }
- break;
-
- case COFF_SYMBOL_COMMON:
- dst->symbol.section = bfd_com_section_ptr;
- dst->symbol.value = src->u.syment.n_value;
- break;
-
- case COFF_SYMBOL_UNDEFINED:
- dst->symbol.section = bfd_und_section_ptr;
- dst->symbol.value = 0;
- break;
-
- case COFF_SYMBOL_PE_SECTION:
- dst->symbol.flags |= BSF_EXPORT | BSF_SECTION_SYM;
- dst->symbol.value = 0;
- break;
-
- case COFF_SYMBOL_LOCAL:
- dst->symbol.flags = BSF_LOCAL;
-#if defined COFF_WITH_PE
- /* PE sets the symbol to a value relative to the
- start of the section. */
- dst->symbol.value = src->u.syment.n_value;
-#else
- dst->symbol.value = (src->u.syment.n_value
- - dst->symbol.section->vma);
-#endif
- if (ISFCN ((src->u.syment.n_type)))
- dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
- break;
- }
-
-#ifdef RS6000COFF_C
- /* A symbol with a csect entry should not go at the end. */
- if (src->u.syment.n_numaux > 0)
- dst->symbol.flags |= BSF_NOT_AT_END;
-#endif
-
-#ifdef COFF_WITH_PE
- if (src->u.syment.n_sclass == C_NT_WEAK)
- dst->symbol.flags |= BSF_WEAK;
-
- if (src->u.syment.n_sclass == C_SECTION
- && src->u.syment.n_scnum > 0)
- dst->symbol.flags = BSF_LOCAL;
-#endif
- if (src->u.syment.n_sclass == C_WEAKEXT)
- dst->symbol.flags |= BSF_WEAK;
-
- break;
-
- case C_STAT: /* Static. */
-#ifdef I960
- case C_LEAFSTAT: /* Static leaf procedure. */
-#endif
-#if defined ARM
- case C_THUMBSTAT: /* Thumb static. */
- case C_THUMBLABEL: /* Thumb label. */
- case C_THUMBSTATFUNC:/* Thumb static function. */
-#endif
- case C_LABEL: /* Label. */
- if (src->u.syment.n_scnum == N_DEBUG)
- dst->symbol.flags = BSF_DEBUGGING;
- else
- dst->symbol.flags = BSF_LOCAL;
-
- /* Base the value as an index from the base of the
- section, if there is one. */
- if (dst->symbol.section)
- {
-#if defined COFF_WITH_PE
- /* PE sets the symbol to a value relative to the
- start of the section. */
- dst->symbol.value = src->u.syment.n_value;
-#else
- dst->symbol.value = (src->u.syment.n_value
- - dst->symbol.section->vma);
-#endif
- }
- else
- dst->symbol.value = src->u.syment.n_value;
- break;
-
- case C_MOS: /* Member of structure. */
- case C_EOS: /* End of structure. */
-#ifdef NOTDEF /* C_AUTOARG has the same value. */
-#ifdef C_GLBLREG
- case C_GLBLREG: /* A29k-specific storage class. */
-#endif
-#endif
- case C_REGPARM: /* Register parameter. */
- case C_REG: /* register variable. */
- /* C_AUTOARG conflicts with TI COFF C_UEXT. */
-#if !defined (TIC80COFF) && !defined (TICOFF)
-#ifdef C_AUTOARG
- case C_AUTOARG: /* 960-specific storage class. */
-#endif
-#endif
- case C_TPDEF: /* Type definition. */
- case C_ARG:
- case C_AUTO: /* Automatic variable. */
- case C_FIELD: /* Bit field. */
- case C_ENTAG: /* Enumeration tag. */
- case C_MOE: /* Member of enumeration. */
- case C_MOU: /* Member of union. */
- case C_UNTAG: /* Union tag. */
- dst->symbol.flags = BSF_DEBUGGING;
- dst->symbol.value = (src->u.syment.n_value);
- break;
-
- case C_FILE: /* File name. */
- case C_STRTAG: /* Structure tag. */
-#ifdef RS6000COFF_C
- case C_GSYM:
- case C_LSYM:
- case C_PSYM:
- case C_RSYM:
- case C_RPSYM:
- case C_STSYM:
- case C_TCSYM:
- case C_BCOMM:
- case C_ECOML:
- case C_ECOMM:
- case C_DECL:
- case C_ENTRY:
- case C_FUN:
- case C_ESTAT:
-#endif
- dst->symbol.flags = BSF_DEBUGGING;
- dst->symbol.value = (src->u.syment.n_value);
- break;
-
-#ifdef RS6000COFF_C
- case C_BINCL: /* Beginning of include file. */
- case C_EINCL: /* Ending of include file. */
- /* The value is actually a pointer into the line numbers
- of the file. We locate the line number entry, and
- set the section to the section which contains it, and
- the value to the index in that section. */
- {
- asection *sec;
-
- dst->symbol.flags = BSF_DEBUGGING;
- for (sec = abfd->sections; sec != NULL; sec = sec->next)
- if (sec->line_filepos <= (file_ptr) src->u.syment.n_value
- && ((file_ptr) (sec->line_filepos
- + sec->lineno_count * bfd_coff_linesz (abfd))
- > (file_ptr) src->u.syment.n_value))
- break;
- if (sec == NULL)
- dst->symbol.value = 0;
- else
- {
- dst->symbol.section = sec;
- dst->symbol.value = ((src->u.syment.n_value
- - sec->line_filepos)
- / bfd_coff_linesz (abfd));
- src->fix_line = 1;
- }
- }
- break;
-
- case C_BSTAT:
- dst->symbol.flags = BSF_DEBUGGING;
-
- /* The value is actually a symbol index. Save a pointer
- to the symbol instead of the index. FIXME: This
- should use a union. */
- src->u.syment.n_value =
- (long) (native_symbols + src->u.syment.n_value);
- dst->symbol.value = src->u.syment.n_value;
- src->fix_value = 1;
- break;
-#endif
-
- case C_BLOCK: /* ".bb" or ".eb". */
- case C_FCN: /* ".bf" or ".ef" (or PE ".lf"). */
- case C_EFCN: /* Physical end of function. */
-#if defined COFF_WITH_PE
- /* PE sets the symbol to a value relative to the start
- of the section. */
- dst->symbol.value = src->u.syment.n_value;
- if (strcmp (dst->symbol.name, ".bf") != 0)
- {
- /* PE uses funny values for .ef and .lf; don't
- relocate them. */
- dst->symbol.flags = BSF_DEBUGGING;
- }
- else
- dst->symbol.flags = BSF_DEBUGGING | BSF_DEBUGGING_RELOC;
-#else
- /* Base the value as an index from the base of the
- section. */
- dst->symbol.flags = BSF_LOCAL;
- dst->symbol.value = (src->u.syment.n_value
- - dst->symbol.section->vma);
-#endif
- break;
-
- case C_STATLAB: /* Static load time label. */
- dst->symbol.value = src->u.syment.n_value;
- dst->symbol.flags = BSF_GLOBAL;
- break;
-
- case C_NULL:
- /* PE DLLs sometimes have zeroed out symbols for some
- reason. Just ignore them without a warning. */
- if (src->u.syment.n_type == 0
- && src->u.syment.n_value == 0
- && src->u.syment.n_scnum == 0)
- break;
- /* Fall through. */
- case C_EXTDEF: /* External definition. */
- case C_ULABEL: /* Undefined label. */
- case C_USTATIC: /* Undefined static. */
-#ifndef COFF_WITH_PE
- /* C_LINE in regular coff is 0x68. NT has taken over this storage
- class to represent a section symbol. */
- case C_LINE: /* line # reformatted as symbol table entry. */
- /* NT uses 0x67 for a weak symbol, not C_ALIAS. */
- case C_ALIAS: /* Duplicate tag. */
-#endif
- /* New storage classes for TI COFF. */
-#if defined(TIC80COFF) || defined(TICOFF)
- case C_UEXT: /* Tentative external definition. */
-#endif
- case C_EXTLAB: /* External load time label. */
- case C_HIDDEN: /* Ext symbol in dmert public lib. */
- default:
- (*_bfd_error_handler)
- (_("%s: Unrecognized storage class %d for %s symbol `%s'"),
- bfd_archive_filename (abfd), src->u.syment.n_sclass,
- dst->symbol.section->name, dst->symbol.name);
- dst->symbol.flags = BSF_DEBUGGING;
- dst->symbol.value = (src->u.syment.n_value);
- break;
- }
-
-/* BFD_ASSERT(dst->symbol.flags != 0);*/
-
- dst->native = src;
-
- dst->symbol.udata.i = 0;
- dst->lineno = (alent *) NULL;
- this_index += (src->u.syment.n_numaux) + 1;
- dst++;
- number_of_symbols++;
- }
- }
-
- obj_symbols (abfd) = cached_area;
- obj_raw_syments (abfd) = native_symbols;
-
- bfd_get_symcount (abfd) = number_of_symbols;
- obj_convert (abfd) = table_ptr;
- /* Slurp the line tables for each section too. */
- {
- asection *p;
-
- p = abfd->sections;
- while (p)
- {
- coff_slurp_line_table (abfd, p);
- p = p->next;
- }
- }
-
- return TRUE;
-} /* coff_slurp_symbol_table() */
-
-/* Classify a COFF symbol. A couple of targets have globally visible
- symbols which are not class C_EXT, and this handles those. It also
- recognizes some special PE cases. */
-
-static enum coff_symbol_classification
-coff_classify_symbol (abfd, syment)
- bfd *abfd;
- struct internal_syment *syment;
-{
- /* FIXME: This partially duplicates the switch in
- coff_slurp_symbol_table. */
- switch (syment->n_sclass)
- {
- case C_EXT:
- case C_WEAKEXT:
-#ifdef I960
- case C_LEAFEXT:
-#endif
-#ifdef ARM
- case C_THUMBEXT:
- case C_THUMBEXTFUNC:
-#endif
-#ifdef C_SYSTEM
- case C_SYSTEM:
-#endif
-#ifdef COFF_WITH_PE
- case C_NT_WEAK:
-#endif
- if (syment->n_scnum == 0)
- {
- if (syment->n_value == 0)
- return COFF_SYMBOL_UNDEFINED;
- else
- return COFF_SYMBOL_COMMON;
- }
- return COFF_SYMBOL_GLOBAL;
-
- default:
- break;
- }
-
-#ifdef COFF_WITH_PE
- if (syment->n_sclass == C_STAT)
- {
- if (syment->n_scnum == 0)
- {
- /* The Microsoft compiler sometimes generates these if a
- small static function is inlined every time it is used.
- The function is discarded, but the symbol table entry
- remains. */
- return COFF_SYMBOL_LOCAL;
- }
-
-#ifdef STRICT_PE_FORMAT
- /* This is correct for Microsoft generated objects, but it
- breaks gas generated objects. */
-
- if (syment->n_value == 0)
- {
- asection *sec;
- char buf[SYMNMLEN + 1];
-
- sec = coff_section_from_bfd_index (abfd, syment->n_scnum);
- if (sec != NULL
- && (strcmp (bfd_get_section_name (abfd, sec),
- _bfd_coff_internal_syment_name (abfd, syment, buf))
- == 0))
- return COFF_SYMBOL_PE_SECTION;
- }
-#endif
-
- return COFF_SYMBOL_LOCAL;
- }
-
- if (syment->n_sclass == C_SECTION)
- {
- /* In some cases in a DLL generated by the Microsoft linker, the
- n_value field will contain garbage. FIXME: This should
- probably be handled by the swapping function instead. */
- syment->n_value = 0;
- if (syment->n_scnum == 0)
- return COFF_SYMBOL_UNDEFINED;
- return COFF_SYMBOL_PE_SECTION;
- }
-#endif /* COFF_WITH_PE */
-
- /* If it is not a global symbol, we presume it is a local symbol. */
-
- if (syment->n_scnum == 0)
- {
- char buf[SYMNMLEN + 1];
-
- (*_bfd_error_handler)
- (_("warning: %s: local symbol `%s' has no section"),
- bfd_archive_filename (abfd),
- _bfd_coff_internal_syment_name (abfd, syment, buf));
- }
-
- return COFF_SYMBOL_LOCAL;
-}
-
-/*
-SUBSUBSECTION
- Reading relocations
-
- Coff relocations are easily transformed into the internal BFD form
- (@code{arelent}).
-
- Reading a coff relocation table is done in the following stages:
-
- o Read the entire coff relocation table into memory.
-
- o Process each relocation in turn; first swap it from the
- external to the internal form.
-
- o Turn the symbol referenced in the relocation's symbol index
- into a pointer into the canonical symbol table.
- This table is the same as the one returned by a call to
- @code{bfd_canonicalize_symtab}. The back end will call that
- routine and save the result if a canonicalization hasn't been done.
-
- o The reloc index is turned into a pointer to a howto
- structure, in a back end specific way. For instance, the 386
- and 960 use the @code{r_type} to directly produce an index
- into a howto table vector; the 88k subtracts a number from the
- @code{r_type} field and creates an addend field.
-
-*/
-
-#ifndef CALC_ADDEND
-#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
- { \
- coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
- if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
- coffsym = (obj_symbols (abfd) \
- + (cache_ptr->sym_ptr_ptr - symbols)); \
- else if (ptr) \
- coffsym = coff_symbol_from (abfd, ptr); \
- if (coffsym != (coff_symbol_type *) NULL \
- && coffsym->native->u.syment.n_scnum == 0) \
- cache_ptr->addend = 0; \
- else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
- && ptr->section != (asection *) NULL) \
- cache_ptr->addend = - (ptr->section->vma + ptr->value); \
- else \
- cache_ptr->addend = 0; \
- }
-#endif
-
-static bfd_boolean
-coff_slurp_reloc_table (abfd, asect, symbols)
- bfd * abfd;
- sec_ptr asect;
- asymbol ** symbols;
-{
- RELOC *native_relocs;
- arelent *reloc_cache;
- arelent *cache_ptr;
- unsigned int idx;
- bfd_size_type amt;
-
- if (asect->relocation)
- return TRUE;
- if (asect->reloc_count == 0)
- return TRUE;
- if (asect->flags & SEC_CONSTRUCTOR)
- return TRUE;
- if (!coff_slurp_symbol_table (abfd))
- return FALSE;
- amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count;
- native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt);
- amt = (bfd_size_type) asect->reloc_count * sizeof (arelent);
- reloc_cache = (arelent *) bfd_alloc (abfd, amt);
-
- if (reloc_cache == NULL)
- return FALSE;
-
- for (idx = 0; idx < asect->reloc_count; idx++)
- {
- struct internal_reloc dst;
- struct external_reloc *src;
-#ifndef RELOC_PROCESSING
- asymbol *ptr;
-#endif
-
- cache_ptr = reloc_cache + idx;
- src = native_relocs + idx;
-
- coff_swap_reloc_in (abfd, src, &dst);
-
-#ifdef RELOC_PROCESSING
- RELOC_PROCESSING (cache_ptr, &dst, symbols, abfd, asect);
-#else
- cache_ptr->address = dst.r_vaddr;
-
- if (dst.r_symndx != -1)
- {
- if (dst.r_symndx < 0 || dst.r_symndx >= obj_conv_table_size (abfd))
- {
- (*_bfd_error_handler)
- (_("%s: warning: illegal symbol index %ld in relocs"),
- bfd_archive_filename (abfd), dst.r_symndx);
- cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- ptr = NULL;
- }
- else
- {
- cache_ptr->sym_ptr_ptr = (symbols
- + obj_convert (abfd)[dst.r_symndx]);
- ptr = *(cache_ptr->sym_ptr_ptr);
- }
- }
- else
- {
- cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- ptr = NULL;
- }
-
- /* The symbols definitions that we have read in have been
- relocated as if their sections started at 0. But the offsets
- refering to the symbols in the raw data have not been
- modified, so we have to have a negative addend to compensate.
-
- Note that symbols which used to be common must be left alone. */
-
- /* Calculate any reloc addend by looking at the symbol. */
- CALC_ADDEND (abfd, ptr, dst, cache_ptr);
-
- cache_ptr->address -= asect->vma;
-/* !! cache_ptr->section = (asection *) NULL;*/
-
- /* Fill in the cache_ptr->howto field from dst.r_type. */
- RTYPE2HOWTO (cache_ptr, &dst);
-#endif /* RELOC_PROCESSING */
-
- if (cache_ptr->howto == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: illegal relocation type %d at address 0x%lx"),
- bfd_archive_filename (abfd), dst.r_type, (long) dst.r_vaddr);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
-
- asect->relocation = reloc_cache;
- return TRUE;
-}
-
-#ifndef coff_rtype_to_howto
-#ifdef RTYPE2HOWTO
-
-/* Get the howto structure for a reloc. This is only used if the file
- including this one defines coff_relocate_section to be
- _bfd_coff_generic_relocate_section, so it is OK if it does not
- always work. It is the responsibility of the including file to
- make sure it is reasonable if it is needed. */
-
-static reloc_howto_type *coff_rtype_to_howto
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-
-static reloc_howto_type *
-coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
- struct internal_syment *sym ATTRIBUTE_UNUSED;
- bfd_vma *addendp ATTRIBUTE_UNUSED;
-{
- arelent genrel;
-
- RTYPE2HOWTO (&genrel, rel);
- return genrel.howto;
-}
-
-#else /* ! defined (RTYPE2HOWTO) */
-
-#define coff_rtype_to_howto NULL
-
-#endif /* ! defined (RTYPE2HOWTO) */
-#endif /* ! defined (coff_rtype_to_howto) */
-
-/* This is stupid. This function should be a boolean predicate. */
-static long
-coff_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd * abfd;
- sec_ptr section;
- arelent ** relptr;
- asymbol ** symbols;
-{
- arelent *tblptr = section->relocation;
- unsigned int count = 0;
-
- if (section->flags & SEC_CONSTRUCTOR)
- {
- /* This section has relocs made up by us, they are not in the
- file, so take them out of their chain and place them into
- the data area provided. */
- arelent_chain *chain = section->constructor_chain;
-
- for (count = 0; count < section->reloc_count; count++)
- {
- *relptr++ = &chain->relent;
- chain = chain->next;
- }
- }
- else
- {
- if (! coff_slurp_reloc_table (abfd, section, symbols))
- return -1;
-
- tblptr = section->relocation;
-
- for (; count++ < section->reloc_count;)
- *relptr++ = tblptr++;
- }
- *relptr = 0;
- return section->reloc_count;
-}
-
-#ifdef GNU960
-file_ptr
-coff_sym_filepos (abfd)
- bfd *abfd;
-{
- return obj_sym_filepos (abfd);
-}
-#endif
-
-#ifndef coff_reloc16_estimate
-#define coff_reloc16_estimate dummy_reloc16_estimate
-
-static int dummy_reloc16_estimate
- PARAMS ((bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *));
-
-static int
-dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- arelent *reloc ATTRIBUTE_UNUSED;
- unsigned int shrink ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
-{
- abort ();
- return 0;
-}
-
-#endif
-
-#ifndef coff_reloc16_extra_cases
-
-#define coff_reloc16_extra_cases dummy_reloc16_extra_cases
-
-/* This works even if abort is not declared in any header file. */
-
-static void dummy_reloc16_extra_cases
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
- bfd_byte *, unsigned int *, unsigned int *));
-
-static void
-dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
- dst_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
- arelent *reloc ATTRIBUTE_UNUSED;
- bfd_byte *data ATTRIBUTE_UNUSED;
- unsigned int *src_ptr ATTRIBUTE_UNUSED;
- unsigned int *dst_ptr ATTRIBUTE_UNUSED;
-{
- abort ();
-}
-#endif
-
-#ifndef coff_bfd_link_hash_table_free
-#define coff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#endif
-
-/* If coff_relocate_section is defined, we can use the optimized COFF
- backend linker. Otherwise we must continue to use the old linker. */
-#ifdef coff_relocate_section
-#ifndef coff_bfd_link_hash_table_create
-#define coff_bfd_link_hash_table_create _bfd_coff_link_hash_table_create
-#endif
-#ifndef coff_bfd_link_add_symbols
-#define coff_bfd_link_add_symbols _bfd_coff_link_add_symbols
-#endif
-#ifndef coff_bfd_final_link
-#define coff_bfd_final_link _bfd_coff_final_link
-#endif
-#else /* ! defined (coff_relocate_section) */
-#define coff_relocate_section NULL
-#ifndef coff_bfd_link_hash_table_create
-#define coff_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#endif
-#ifndef coff_bfd_link_add_symbols
-#define coff_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#endif
-#define coff_bfd_final_link _bfd_generic_final_link
-#endif /* ! defined (coff_relocate_section) */
-
-#define coff_bfd_link_just_syms _bfd_generic_link_just_syms
-#define coff_bfd_link_split_section _bfd_generic_link_split_section
-
-#ifndef coff_start_final_link
-#define coff_start_final_link NULL
-#endif
-
-#ifndef coff_adjust_symndx
-#define coff_adjust_symndx NULL
-#endif
-
-#ifndef coff_link_add_one_symbol
-#define coff_link_add_one_symbol _bfd_generic_link_add_one_symbol
-#endif
-
-#ifndef coff_link_output_has_begun
-
-static bfd_boolean coff_link_output_has_begun
- PARAMS ((bfd *, struct coff_final_link_info *));
-
-static bfd_boolean
-coff_link_output_has_begun (abfd, info)
- bfd * abfd;
- struct coff_final_link_info * info ATTRIBUTE_UNUSED;
-{
- return abfd->output_has_begun;
-}
-#endif
-
-#ifndef coff_final_link_postscript
-
-static bfd_boolean coff_final_link_postscript
- PARAMS ((bfd *, struct coff_final_link_info *));
-
-static bfd_boolean
-coff_final_link_postscript (abfd, pfinfo)
- bfd * abfd ATTRIBUTE_UNUSED;
- struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED;
-{
- return TRUE;
-}
-#endif
-
-#ifndef coff_SWAP_aux_in
-#define coff_SWAP_aux_in coff_swap_aux_in
-#endif
-#ifndef coff_SWAP_sym_in
-#define coff_SWAP_sym_in coff_swap_sym_in
-#endif
-#ifndef coff_SWAP_lineno_in
-#define coff_SWAP_lineno_in coff_swap_lineno_in
-#endif
-#ifndef coff_SWAP_aux_out
-#define coff_SWAP_aux_out coff_swap_aux_out
-#endif
-#ifndef coff_SWAP_sym_out
-#define coff_SWAP_sym_out coff_swap_sym_out
-#endif
-#ifndef coff_SWAP_lineno_out
-#define coff_SWAP_lineno_out coff_swap_lineno_out
-#endif
-#ifndef coff_SWAP_reloc_out
-#define coff_SWAP_reloc_out coff_swap_reloc_out
-#endif
-#ifndef coff_SWAP_filehdr_out
-#define coff_SWAP_filehdr_out coff_swap_filehdr_out
-#endif
-#ifndef coff_SWAP_aouthdr_out
-#define coff_SWAP_aouthdr_out coff_swap_aouthdr_out
-#endif
-#ifndef coff_SWAP_scnhdr_out
-#define coff_SWAP_scnhdr_out coff_swap_scnhdr_out
-#endif
-#ifndef coff_SWAP_reloc_in
-#define coff_SWAP_reloc_in coff_swap_reloc_in
-#endif
-#ifndef coff_SWAP_filehdr_in
-#define coff_SWAP_filehdr_in coff_swap_filehdr_in
-#endif
-#ifndef coff_SWAP_aouthdr_in
-#define coff_SWAP_aouthdr_in coff_swap_aouthdr_in
-#endif
-#ifndef coff_SWAP_scnhdr_in
-#define coff_SWAP_scnhdr_in coff_swap_scnhdr_in
-#endif
-
-static const bfd_coff_backend_data bfd_coff_std_swap_table =
-{
- coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
- coff_SWAP_aux_out, coff_SWAP_sym_out,
- coff_SWAP_lineno_out, coff_SWAP_reloc_out,
- coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
- coff_SWAP_scnhdr_out,
- FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
-#ifdef COFF_LONG_FILENAMES
- TRUE,
-#else
- FALSE,
-#endif
-#ifdef COFF_LONG_SECTION_NAMES
- TRUE,
-#else
- FALSE,
-#endif
- COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
-#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
- TRUE,
-#else
- FALSE,
-#endif
-#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
- 4,
-#else
- 2,
-#endif
- coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
- coff_SWAP_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook,
- coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
- coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
- coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
- coff_classify_symbol, coff_compute_section_file_positions,
- coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
- coff_adjust_symndx, coff_link_add_one_symbol,
- coff_link_output_has_begun, coff_final_link_postscript
-};
-
-#ifdef TICOFF
-/* COFF0 differs in file/section header size and relocation entry size. */
-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,
- coff_SWAP_lineno_out, coff_SWAP_reloc_out,
- coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
- coff_SWAP_scnhdr_out,
- FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN,
-#ifdef COFF_LONG_FILENAMES
- TRUE,
-#else
- FALSE,
-#endif
-#ifdef COFF_LONG_SECTION_NAMES
- TRUE,
-#else
- FALSE,
-#endif
- COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
-#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
- TRUE,
-#else
- FALSE,
-#endif
-#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
- 4,
-#else
- 2,
-#endif
- coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
- coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook,
- coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
- coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
- coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
- coff_classify_symbol, coff_compute_section_file_positions,
- coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
- coff_adjust_symndx, coff_link_add_one_symbol,
- coff_link_output_has_begun, coff_final_link_postscript
-};
-#endif
-
-#ifdef TICOFF
-/* COFF1 differs in section header size. */
-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,
- coff_SWAP_lineno_out, coff_SWAP_reloc_out,
- coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
- coff_SWAP_scnhdr_out,
- FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
-#ifdef COFF_LONG_FILENAMES
- TRUE,
-#else
- FALSE,
-#endif
-#ifdef COFF_LONG_SECTION_NAMES
- TRUE,
-#else
- FALSE,
-#endif
- COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
-#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
- TRUE,
-#else
- FALSE,
-#endif
-#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
- 4,
-#else
- 2,
-#endif
- coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
- coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook,
- coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
- coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
- coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
- coff_classify_symbol, coff_compute_section_file_positions,
- coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
- coff_adjust_symndx, coff_link_add_one_symbol,
- coff_link_output_has_begun, coff_final_link_postscript
-};
-#endif
-
-#ifndef coff_close_and_cleanup
-#define coff_close_and_cleanup _bfd_generic_close_and_cleanup
-#endif
-
-#ifndef coff_bfd_free_cached_info
-#define coff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#endif
-
-#ifndef coff_get_section_contents
-#define coff_get_section_contents _bfd_generic_get_section_contents
-#endif
-
-#ifndef coff_bfd_copy_private_symbol_data
-#define coff_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
-#endif
-
-#ifndef coff_bfd_copy_private_section_data
-#define coff_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
-#endif
-
-#ifndef coff_bfd_copy_private_bfd_data
-#define coff_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
-#endif
-
-#ifndef coff_bfd_merge_private_bfd_data
-#define coff_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
-#endif
-
-#ifndef coff_bfd_set_private_flags
-#define coff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
-#endif
-
-#ifndef coff_bfd_print_private_bfd_data
-#define coff_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
-#endif
-
-#ifndef coff_bfd_is_local_label_name
-#define coff_bfd_is_local_label_name _bfd_coff_is_local_label_name
-#endif
-
-#ifndef coff_read_minisymbols
-#define coff_read_minisymbols _bfd_generic_read_minisymbols
-#endif
-
-#ifndef coff_minisymbol_to_symbol
-#define coff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#endif
-
-/* The reloc lookup routine must be supplied by each individual COFF
- backend. */
-#ifndef coff_bfd_reloc_type_lookup
-#define coff_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-#endif
-
-#ifndef coff_bfd_get_relocated_section_contents
-#define coff_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#endif
-
-#ifndef coff_bfd_relax_section
-#define coff_bfd_relax_section bfd_generic_relax_section
-#endif
-
-#ifndef coff_bfd_gc_sections
-#define coff_bfd_gc_sections bfd_generic_gc_sections
-#endif
-
-#ifndef coff_bfd_merge_sections
-#define coff_bfd_merge_sections bfd_generic_merge_sections
-#endif
-
-#ifndef coff_bfd_discard_group
-#define coff_bfd_discard_group bfd_generic_discard_group
-#endif
-
-#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \
-const bfd_target VAR = \
-{ \
- NAME , \
- bfd_target_coff_flavour, \
- BFD_ENDIAN_BIG, /* data byte order is big */ \
- BFD_ENDIAN_BIG, /* header byte order is big */ \
- /* object flags */ \
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \
- HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \
- /* section flags */ \
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
- UNDER, /* leading symbol underscore */ \
- '/', /* ar_pad_char */ \
- 15, /* ar_max_namelen */ \
- \
- /* Data conversion functions. */ \
- bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
- bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
- \
- /* Header conversion functions. */ \
- bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
- bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
- \
- /* bfd_check_format */ \
- { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
- _bfd_dummy_target }, \
- /* bfd_set_format */ \
- { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
- { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
- bfd_false }, \
- \
- BFD_JUMP_TABLE_GENERIC (coff), \
- BFD_JUMP_TABLE_COPY (coff), \
- BFD_JUMP_TABLE_CORE (_bfd_nocore), \
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), \
- BFD_JUMP_TABLE_SYMBOLS (coff), \
- BFD_JUMP_TABLE_RELOCS (coff), \
- BFD_JUMP_TABLE_WRITE (coff), \
- BFD_JUMP_TABLE_LINK (coff), \
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), \
- \
- ALTERNATIVE, \
- \
- SWAP_TABLE \
-};
-
-#define CREATE_BIGHDR_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \
-const bfd_target VAR = \
-{ \
- NAME , \
- bfd_target_coff_flavour, \
- BFD_ENDIAN_LITTLE, /* data byte order is little */ \
- BFD_ENDIAN_BIG, /* header byte order is big */ \
- /* object flags */ \
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \
- HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \
- /* section flags */ \
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
- UNDER, /* leading symbol underscore */ \
- '/', /* ar_pad_char */ \
- 15, /* ar_max_namelen */ \
- \
- /* Data conversion functions. */ \
- bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
- bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
- \
- /* Header conversion functions. */ \
- bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
- bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
- \
- /* bfd_check_format */ \
- { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
- _bfd_dummy_target }, \
- /* bfd_set_format */ \
- { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
- { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
- bfd_false }, \
- \
- BFD_JUMP_TABLE_GENERIC (coff), \
- BFD_JUMP_TABLE_COPY (coff), \
- BFD_JUMP_TABLE_CORE (_bfd_nocore), \
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), \
- BFD_JUMP_TABLE_SYMBOLS (coff), \
- BFD_JUMP_TABLE_RELOCS (coff), \
- BFD_JUMP_TABLE_WRITE (coff), \
- BFD_JUMP_TABLE_LINK (coff), \
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), \
- \
- ALTERNATIVE, \
- \
- SWAP_TABLE \
-};
-
-#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \
-const bfd_target VAR = \
-{ \
- NAME , \
- bfd_target_coff_flavour, \
- BFD_ENDIAN_LITTLE, /* data byte order is little */ \
- BFD_ENDIAN_LITTLE, /* header byte order is little */ \
- /* object flags */ \
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \
- HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \
- /* section flags */ \
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
- UNDER, /* leading symbol underscore */ \
- '/', /* ar_pad_char */ \
- 15, /* ar_max_namelen */ \
- \
- /* Data conversion functions. */ \
- bfd_getl64, bfd_getl_signed_64, bfd_putl64, \
- bfd_getl32, bfd_getl_signed_32, bfd_putl32, \
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, \
- /* Header conversion functions. */ \
- bfd_getl64, bfd_getl_signed_64, bfd_putl64, \
- bfd_getl32, bfd_getl_signed_32, bfd_putl32, \
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, \
- /* bfd_check_format */ \
- { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
- _bfd_dummy_target }, \
- /* bfd_set_format */ \
- { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
- { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
- bfd_false }, \
- \
- BFD_JUMP_TABLE_GENERIC (coff), \
- BFD_JUMP_TABLE_COPY (coff), \
- BFD_JUMP_TABLE_CORE (_bfd_nocore), \
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), \
- BFD_JUMP_TABLE_SYMBOLS (coff), \
- BFD_JUMP_TABLE_RELOCS (coff), \
- BFD_JUMP_TABLE_WRITE (coff), \
- BFD_JUMP_TABLE_LINK (coff), \
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), \
- \
- ALTERNATIVE, \
- \
- SWAP_TABLE \
-};
diff --git a/contrib/binutils/bfd/coffgen.c b/contrib/binutils/bfd/coffgen.c
deleted file mode 100644
index a712b4b..0000000
--- a/contrib/binutils/bfd/coffgen.c
+++ /dev/null
@@ -1,2498 +0,0 @@
-/* Support for the generic parts of COFF, for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Most of this hacked by Steve Chamberlain, sac@cygnus.com.
- Split out of coffcode.h by Ian Taylor, ian@cygnus.com. */
-
-/* This file contains COFF code that is not dependent on any
- particular COFF target. There is only one version of this file in
- libbfd.a, so no target specific code may be put in here. Or, to
- put it another way,
-
- ********** DO NOT PUT TARGET SPECIFIC CODE IN THIS FILE **********
-
- If you need to add some target specific behaviour, add a new hook
- function to bfd_coff_backend_data.
-
- Some of these functions are also called by the ECOFF routines.
- Those functions may not use any COFF specific information, such as
- coff_data (abfd). */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "libcoff.h"
-
-static void coff_fix_symbol_name
- PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_size_type *,
- asection **, bfd_size_type *));
-static bfd_boolean coff_write_symbol
- PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_vma *,
- bfd_size_type *, asection **, bfd_size_type *));
-static bfd_boolean coff_write_alien_symbol
- PARAMS ((bfd *, asymbol *, bfd_vma *, bfd_size_type *,
- asection **, bfd_size_type *));
-static bfd_boolean coff_write_native_symbol
- PARAMS ((bfd *, coff_symbol_type *, bfd_vma *, bfd_size_type *,
- asection **, bfd_size_type *));
-static void coff_pointerize_aux
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-static bfd_boolean make_a_section_from_file
- PARAMS ((bfd *, struct internal_scnhdr *, unsigned int));
-static const bfd_target *coff_real_object_p
- PARAMS ((bfd *, unsigned, struct internal_filehdr *,
- struct internal_aouthdr *));
-static void fixup_symbol_value
- PARAMS ((bfd *, coff_symbol_type *, struct internal_syment *));
-static char *build_debug_section
- PARAMS ((bfd *));
-static char *copy_name
- PARAMS ((bfd *, char *, size_t));
-
-#define STRING_SIZE_SIZE (4)
-
-/* Take a section header read from a coff file (in HOST byte order),
- and make a BFD "section" out of it. This is used by ECOFF. */
-static bfd_boolean
-make_a_section_from_file (abfd, hdr, target_index)
- bfd *abfd;
- struct internal_scnhdr *hdr;
- unsigned int target_index;
-{
- asection *return_section;
- char *name;
- bfd_boolean result = TRUE;
- flagword flags;
-
- name = NULL;
-
- /* Handle long section names as in PE. */
- if (bfd_coff_long_section_names (abfd)
- && hdr->s_name[0] == '/')
- {
- char buf[SCNNMLEN];
- long strindex;
- char *p;
- const char *strings;
-
- memcpy (buf, hdr->s_name + 1, SCNNMLEN - 1);
- buf[SCNNMLEN - 1] = '\0';
- strindex = strtol (buf, &p, 10);
- if (*p == '\0' && strindex >= 0)
- {
- strings = _bfd_coff_read_string_table (abfd);
- if (strings == NULL)
- return FALSE;
- /* FIXME: For extra safety, we should make sure that
- 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, (bfd_size_type) strlen (strings) + 1);
- if (name == NULL)
- return FALSE;
- strcpy (name, strings);
- }
- }
-
- if (name == NULL)
- {
- /* Assorted wastage to null-terminate the name, thanks AT&T! */
- 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));
- name[sizeof (hdr->s_name)] = 0;
- }
-
- return_section = bfd_make_section_anyway (abfd, name);
- if (return_section == NULL)
- return FALSE;
-
- return_section->vma = hdr->s_vaddr;
- return_section->lma = hdr->s_paddr;
- return_section->_raw_size = hdr->s_size;
- return_section->filepos = hdr->s_scnptr;
- return_section->rel_filepos = hdr->s_relptr;
- return_section->reloc_count = hdr->s_nreloc;
-
- bfd_coff_set_alignment_hook (abfd, return_section, hdr);
-
- return_section->line_filepos = hdr->s_lnnoptr;
-
- return_section->lineno_count = hdr->s_nlnno;
- return_section->userdata = NULL;
- return_section->next = (asection *) NULL;
- return_section->target_index = 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
- section must be ignored. */
- if ((return_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
- return_section->lineno_count = 0;
-
- if (hdr->s_nreloc != 0)
- return_section->flags |= SEC_RELOC;
- /* FIXME: should this check 'hdr->s_size > 0' */
- if (hdr->s_scnptr != 0)
- return_section->flags |= SEC_HAS_CONTENTS;
-
- return result;
-}
-
-/* Read in a COFF object and make it into a BFD. This is used by
- ECOFF as well. */
-
-static const bfd_target *
-coff_real_object_p (abfd, nscns, internal_f, internal_a)
- bfd *abfd;
- unsigned nscns;
- struct internal_filehdr *internal_f;
- struct internal_aouthdr *internal_a;
-{
- flagword oflags = abfd->flags;
- bfd_vma ostart = bfd_get_start_address (abfd);
- PTR tdata;
- PTR tdata_save;
- bfd_size_type readsize; /* length of file_info */
- unsigned int scnhsz;
- char *external_sections;
-
- if (!(internal_f->f_flags & F_RELFLG))
- abfd->flags |= HAS_RELOC;
- if ((internal_f->f_flags & F_EXEC))
- abfd->flags |= EXEC_P;
- if (!(internal_f->f_flags & F_LNNO))
- abfd->flags |= HAS_LINENO;
- if (!(internal_f->f_flags & F_LSYMS))
- abfd->flags |= HAS_LOCALS;
-
- /* FIXME: How can we set D_PAGED correctly? */
- if ((internal_f->f_flags & F_EXEC) != 0)
- abfd->flags |= D_PAGED;
-
- bfd_get_symcount (abfd) = internal_f->f_nsyms;
- if (internal_f->f_nsyms)
- abfd->flags |= HAS_SYMS;
-
- if (internal_a != (struct internal_aouthdr *) NULL)
- bfd_get_start_address (abfd) = internal_a->entry;
- else
- bfd_get_start_address (abfd) = 0;
-
- /* Set up the tdata area. ECOFF uses its own routine, and overrides
- abfd->flags. */
- tdata_save = abfd->tdata.any;
- tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a);
- if (tdata == NULL)
- goto fail2;
-
- scnhsz = bfd_coff_scnhsz (abfd);
- readsize = (bfd_size_type) nscns * scnhsz;
- external_sections = (char *) bfd_alloc (abfd, readsize);
- if (!external_sections)
- goto fail;
-
- if (bfd_bread ((PTR) external_sections, readsize, abfd) != readsize)
- goto fail;
-
- /* Set the arch/mach *before* swapping in sections; section header swapping
- may depend on arch/mach info. */
- if (! bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f))
- goto fail;
-
- /* Now copy data as required; construct all asections etc. */
- if (nscns != 0)
- {
- unsigned int i;
- for (i = 0; i < nscns; i++)
- {
- struct internal_scnhdr tmp;
- bfd_coff_swap_scnhdr_in (abfd,
- (PTR) (external_sections + i * scnhsz),
- (PTR) & tmp);
- if (! make_a_section_from_file (abfd, &tmp, i + 1))
- goto fail;
- }
- }
-
- return abfd->xvec;
-
- fail:
- bfd_release (abfd, tdata);
- fail2:
- abfd->tdata.any = tdata_save;
- abfd->flags = oflags;
- bfd_get_start_address (abfd) = ostart;
- return (const bfd_target *) NULL;
-}
-
-/* Turn a COFF file into a BFD, but fail with bfd_error_wrong_format if it is
- not a COFF file. This is also used by ECOFF. */
-
-const bfd_target *
-coff_object_p (abfd)
- bfd *abfd;
-{
- bfd_size_type filhsz;
- bfd_size_type aoutsz;
- unsigned int nscns;
- PTR filehdr;
- struct internal_filehdr internal_f;
- struct internal_aouthdr internal_a;
-
- /* figure out how much to read */
- filhsz = bfd_coff_filhsz (abfd);
- aoutsz = bfd_coff_aoutsz (abfd);
-
- filehdr = bfd_alloc (abfd, filhsz);
- if (filehdr == NULL)
- return NULL;
- if (bfd_bread (filehdr, filhsz, abfd) != filhsz)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- bfd_release (abfd, filehdr);
- return NULL;
- }
- bfd_coff_swap_filehdr_in (abfd, filehdr, &internal_f);
- bfd_release (abfd, filehdr);
-
- /* The XCOFF format has two sizes for the f_opthdr. SMALL_AOUTSZ
- (less than aoutsz) used in object files and AOUTSZ (equal to
- aoutsz) in executables. The bfd_coff_swap_aouthdr_in function
- expects this header to be aoutsz bytes in length, so we use that
- value in the call to bfd_alloc below. But we must be careful to
- only read in f_opthdr bytes in the call to bfd_bread. We should
- also attempt to catch corrupt or non-COFF binaries with a strange
- value for f_opthdr. */
- if (! bfd_coff_bad_format_hook (abfd, &internal_f)
- || internal_f.f_opthdr > aoutsz)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- nscns = internal_f.f_nscns;
-
- if (internal_f.f_opthdr)
- {
- PTR opthdr;
-
- opthdr = bfd_alloc (abfd, aoutsz);
- if (opthdr == NULL)
- return NULL;
- if (bfd_bread (opthdr, (bfd_size_type) internal_f.f_opthdr, abfd)
- != internal_f.f_opthdr)
- {
- bfd_release (abfd, opthdr);
- return NULL;
- }
- bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) &internal_a);
- bfd_release (abfd, opthdr);
- }
-
- return coff_real_object_p (abfd, nscns, &internal_f,
- (internal_f.f_opthdr != 0
- ? &internal_a
- : (struct internal_aouthdr *) NULL));
-}
-
-/* Get the BFD section from a COFF symbol section number. */
-
-asection *
-coff_section_from_bfd_index (abfd, index)
- bfd *abfd;
- int index;
-{
- struct bfd_section *answer = abfd->sections;
-
- if (index == N_ABS)
- return bfd_abs_section_ptr;
- if (index == N_UNDEF)
- return bfd_und_section_ptr;
- if (index == N_DEBUG)
- return bfd_abs_section_ptr;
-
- while (answer)
- {
- if (answer->target_index == index)
- return answer;
- answer = answer->next;
- }
-
- /* We should not reach this point, but the SCO 3.2v4 /lib/libc_s.a
- has a bad symbol table in biglitpow.o. */
- return bfd_und_section_ptr;
-}
-
-/* Get the upper bound of a COFF symbol table. */
-
-long
-coff_get_symtab_upper_bound (abfd)
- bfd *abfd;
-{
- if (!bfd_coff_slurp_symbol_table (abfd))
- return -1;
-
- return (bfd_get_symcount (abfd) + 1) * (sizeof (coff_symbol_type *));
-}
-
-/* Canonicalize a COFF symbol table. */
-
-long
-coff_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
-{
- unsigned int counter;
- coff_symbol_type *symbase;
- coff_symbol_type **location = (coff_symbol_type **) alocation;
-
- if (!bfd_coff_slurp_symbol_table (abfd))
- return -1;
-
- symbase = obj_symbols (abfd);
- counter = bfd_get_symcount (abfd);
- while (counter-- > 0)
- *location++ = symbase++;
-
- *location = NULL;
-
- return bfd_get_symcount (abfd);
-}
-
-/* Get the name of a symbol. The caller must pass in a buffer of size
- >= SYMNMLEN + 1. */
-
-const char *
-_bfd_coff_internal_syment_name (abfd, sym, buf)
- bfd *abfd;
- const struct internal_syment *sym;
- char *buf;
-{
- /* FIXME: It's not clear this will work correctly if sizeof
- (_n_zeroes) != 4. */
- if (sym->_n._n_n._n_zeroes != 0
- || sym->_n._n_n._n_offset == 0)
- {
- memcpy (buf, sym->_n._n_name, SYMNMLEN);
- buf[SYMNMLEN] = '\0';
- return buf;
- }
- else
- {
- const char *strings;
-
- BFD_ASSERT (sym->_n._n_n._n_offset >= STRING_SIZE_SIZE);
- strings = obj_coff_strings (abfd);
- if (strings == NULL)
- {
- strings = _bfd_coff_read_string_table (abfd);
- if (strings == NULL)
- return NULL;
- }
- return strings + sym->_n._n_n._n_offset;
- }
-}
-
-/* Read in and swap the relocs. This returns a buffer holding the
- relocs for section SEC in file ABFD. If CACHE is TRUE and
- INTERNAL_RELOCS is NULL, the relocs read in will be saved in case
- the function is called again. If EXTERNAL_RELOCS is not NULL, it
- is a buffer large enough to hold the unswapped relocs. If
- INTERNAL_RELOCS is not NULL, it is a buffer large enough to hold
- the swapped relocs. If REQUIRE_INTERNAL is TRUE, then the return
- value must be INTERNAL_RELOCS. The function returns NULL on error. */
-
-struct internal_reloc *
-_bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
- require_internal, internal_relocs)
- bfd *abfd;
- asection *sec;
- bfd_boolean cache;
- bfd_byte *external_relocs;
- bfd_boolean require_internal;
- struct internal_reloc *internal_relocs;
-{
- bfd_size_type relsz;
- bfd_byte *free_external = NULL;
- struct internal_reloc *free_internal = NULL;
- 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)
- {
- if (! require_internal)
- return coff_section_data (abfd, sec)->relocs;
- memcpy (internal_relocs, coff_section_data (abfd, sec)->relocs,
- sec->reloc_count * sizeof (struct internal_reloc));
- return internal_relocs;
- }
-
- relsz = bfd_coff_relsz (abfd);
-
- amt = sec->reloc_count * relsz;
- if (external_relocs == NULL)
- {
- 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_bread (external_relocs, amt, abfd) != amt)
- goto error_return;
-
- if (internal_relocs == NULL)
- {
- 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;
- }
-
- /* Swap in the relocs. */
- erel = external_relocs;
- erel_end = erel + relsz * sec->reloc_count;
- irel = internal_relocs;
- for (; erel < erel_end; erel += relsz, irel++)
- bfd_coff_swap_reloc_in (abfd, (PTR) erel, (PTR) irel);
-
- if (free_external != NULL)
- {
- free (free_external);
- free_external = NULL;
- }
-
- if (cache && free_internal != NULL)
- {
- if (coff_section_data (abfd, sec) == NULL)
- {
- 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;
- }
- coff_section_data (abfd, sec)->relocs = free_internal;
- }
-
- return internal_relocs;
-
- error_return:
- if (free_external != NULL)
- free (free_external);
- if (free_internal != NULL)
- free (free_internal);
- return NULL;
-}
-
-/* Set lineno_count for the output sections of a COFF file. */
-
-int
-coff_count_linenumbers (abfd)
- bfd *abfd;
-{
- unsigned int limit = bfd_get_symcount (abfd);
- unsigned int i;
- int total = 0;
- asymbol **p;
- asection *s;
-
- if (limit == 0)
- {
- /* This may be from the backend linker, in which case the
- lineno_count in the sections is correct. */
- for (s = abfd->sections; s != NULL; s = s->next)
- total += s->lineno_count;
- return total;
- }
-
- for (s = abfd->sections; s != NULL; s = s->next)
- BFD_ASSERT (s->lineno_count == 0);
-
- for (p = abfd->outsymbols, i = 0; i < limit; i++, p++)
- {
- asymbol *q_maybe = *p;
-
- if (bfd_family_coff (bfd_asymbol_bfd (q_maybe)))
- {
- coff_symbol_type *q = coffsymbol (q_maybe);
-
- /* The AIX 4.1 compiler can sometimes generate line numbers
- attached to debugging symbols. We try to simply ignore
- those here. */
- if (q->lineno != NULL
- && q->symbol.section->owner != NULL)
- {
- /* This symbol has line numbers. Increment the owning
- section's linenumber count. */
- alent *l = q->lineno;
-
- do
- {
- asection * sec = q->symbol.section->output_section;
-
- /* Do not try to update fields in read-only sections. */
- if (! bfd_is_const_section (sec))
- sec->lineno_count ++;
-
- ++total;
- ++l;
- }
- while (l->line_number != 0);
- }
- }
- }
-
- return total;
-}
-
-/* Takes a bfd and a symbol, returns a pointer to the coff specific
- area of the symbol if there is one. */
-
-coff_symbol_type *
-coff_symbol_from (ignore_abfd, symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
-{
- if (!bfd_family_coff (bfd_asymbol_bfd (symbol)))
- return (coff_symbol_type *) NULL;
-
- if (bfd_asymbol_bfd (symbol)->tdata.coff_obj_data == (coff_data_type *) NULL)
- return (coff_symbol_type *) NULL;
-
- return (coff_symbol_type *) symbol;
-}
-
-static void
-fixup_symbol_value (abfd, coff_symbol_ptr, syment)
- bfd *abfd;
- coff_symbol_type *coff_symbol_ptr;
- struct internal_syment *syment;
-{
-
- /* Normalize the symbol flags */
- if (bfd_is_com_section (coff_symbol_ptr->symbol.section))
- {
- /* a common symbol is undefined with a value */
- syment->n_scnum = N_UNDEF;
- syment->n_value = coff_symbol_ptr->symbol.value;
- }
- else if ((coff_symbol_ptr->symbol.flags & BSF_DEBUGGING) != 0
- && (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING_RELOC) == 0)
- {
- syment->n_value = coff_symbol_ptr->symbol.value;
- }
- else if (bfd_is_und_section (coff_symbol_ptr->symbol.section))
- {
- syment->n_scnum = N_UNDEF;
- syment->n_value = 0;
- }
- /* FIXME: Do we need to handle the absolute section here? */
- else
- {
- if (coff_symbol_ptr->symbol.section)
- {
- syment->n_scnum =
- coff_symbol_ptr->symbol.section->output_section->target_index;
-
- syment->n_value = (coff_symbol_ptr->symbol.value
- + coff_symbol_ptr->symbol.section->output_offset);
- if (! obj_pe (abfd))
- {
- syment->n_value += (syment->n_sclass == C_STATLAB)
- ? coff_symbol_ptr->symbol.section->output_section->lma
- : coff_symbol_ptr->symbol.section->output_section->vma;
- }
- }
- else
- {
- BFD_ASSERT (0);
- /* This can happen, but I don't know why yet (steve@cygnus.com) */
- syment->n_scnum = N_ABS;
- syment->n_value = coff_symbol_ptr->symbol.value;
- }
- }
-}
-
-/* Run through all the symbols in the symbol table and work out what
- their indexes into the symbol table will be when output.
-
- Coff requires that each C_FILE symbol points to the next one in the
- chain, and that the last one points to the first external symbol. We
- do that here too. */
-
-bfd_boolean
-coff_renumber_symbols (bfd_ptr, first_undef)
- bfd *bfd_ptr;
- int *first_undef;
-{
- unsigned int symbol_count = bfd_get_symcount (bfd_ptr);
- asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols;
- unsigned int native_index = 0;
- struct internal_syment *last_file = (struct internal_syment *) NULL;
- unsigned int symbol_index;
-
- /* COFF demands that undefined symbols come after all other symbols.
- Since we don't need to impose this extra knowledge on all our
- client programs, deal with that here. Sort the symbol table;
- just move the undefined symbols to the end, leaving the rest
- alone. The O'Reilly book says that defined global symbols come
- at the end before the undefined symbols, so we do that here as
- well. */
- /* @@ Do we have some condition we could test for, so we don't always
- have to do this? I don't think relocatability is quite right, but
- I'm not certain. [raeburn:19920508.1711EST] */
- {
- asymbol **newsyms;
- unsigned int i;
- bfd_size_type amt;
-
- amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
- newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
- if (!newsyms)
- return FALSE;
- bfd_ptr->outsymbols = newsyms;
- for (i = 0; i < symbol_count; i++)
- if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) != 0
- || (!bfd_is_und_section (symbol_ptr_ptr[i]->section)
- && !bfd_is_com_section (symbol_ptr_ptr[i]->section)
- && ((symbol_ptr_ptr[i]->flags & BSF_FUNCTION) != 0
- || ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL | BSF_WEAK))
- == 0))))
- *newsyms++ = symbol_ptr_ptr[i];
-
- for (i = 0; i < symbol_count; i++)
- if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) == 0
- && !bfd_is_und_section (symbol_ptr_ptr[i]->section)
- && (bfd_is_com_section (symbol_ptr_ptr[i]->section)
- || ((symbol_ptr_ptr[i]->flags & BSF_FUNCTION) == 0
- && ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL | BSF_WEAK))
- != 0))))
- *newsyms++ = symbol_ptr_ptr[i];
-
- *first_undef = newsyms - bfd_ptr->outsymbols;
-
- for (i = 0; i < symbol_count; i++)
- if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) == 0
- && bfd_is_und_section (symbol_ptr_ptr[i]->section))
- *newsyms++ = symbol_ptr_ptr[i];
- *newsyms = (asymbol *) NULL;
- symbol_ptr_ptr = bfd_ptr->outsymbols;
- }
-
- for (symbol_index = 0; symbol_index < symbol_count; symbol_index++)
- {
- coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]);
- symbol_ptr_ptr[symbol_index]->udata.i = symbol_index;
- if (coff_symbol_ptr && coff_symbol_ptr->native)
- {
- combined_entry_type *s = coff_symbol_ptr->native;
- int i;
-
- if (s->u.syment.n_sclass == C_FILE)
- {
- if (last_file != (struct internal_syment *) NULL)
- last_file->n_value = native_index;
- last_file = &(s->u.syment);
- }
- else
- {
-
- /* Modify the symbol values according to their section and
- type */
-
- fixup_symbol_value (bfd_ptr, coff_symbol_ptr, &(s->u.syment));
- }
- for (i = 0; i < s->u.syment.n_numaux + 1; i++)
- s[i].offset = native_index++;
- }
- else
- {
- native_index++;
- }
- }
- obj_conv_table_size (bfd_ptr) = native_index;
-
- return TRUE;
-}
-
-/* Run thorough the symbol table again, and fix it so that all
- pointers to entries are changed to the entries' index in the output
- symbol table. */
-
-void
-coff_mangle_symbols (bfd_ptr)
- bfd *bfd_ptr;
-{
- unsigned int symbol_count = bfd_get_symcount (bfd_ptr);
- asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols;
- unsigned int symbol_index;
-
- for (symbol_index = 0; symbol_index < symbol_count; symbol_index++)
- {
- coff_symbol_type *coff_symbol_ptr =
- coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]);
-
- if (coff_symbol_ptr && coff_symbol_ptr->native)
- {
- int i;
- combined_entry_type *s = coff_symbol_ptr->native;
-
- if (s->fix_value)
- {
- /* FIXME: We should use a union here. */
- s->u.syment.n_value =
- (bfd_vma)((combined_entry_type *)
- ((unsigned long) s->u.syment.n_value))->offset;
- s->fix_value = 0;
- }
- if (s->fix_line)
- {
- /* The value is the offset into the line number entries
- for the symbol's section. On output, the symbol's
- section should be N_DEBUG. */
- s->u.syment.n_value =
- (coff_symbol_ptr->symbol.section->output_section->line_filepos
- + s->u.syment.n_value * bfd_coff_linesz (bfd_ptr));
- coff_symbol_ptr->symbol.section =
- coff_section_from_bfd_index (bfd_ptr, N_DEBUG);
- BFD_ASSERT (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING);
- }
- for (i = 0; i < s->u.syment.n_numaux; i++)
- {
- combined_entry_type *a = s + i + 1;
- if (a->fix_tag)
- {
- a->u.auxent.x_sym.x_tagndx.l =
- a->u.auxent.x_sym.x_tagndx.p->offset;
- a->fix_tag = 0;
- }
- if (a->fix_end)
- {
- a->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l =
- a->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p->offset;
- a->fix_end = 0;
- }
- if (a->fix_scnlen)
- {
- a->u.auxent.x_csect.x_scnlen.l =
- a->u.auxent.x_csect.x_scnlen.p->offset;
- a->fix_scnlen = 0;
- }
- }
- }
- }
-}
-
-static void
-coff_fix_symbol_name (abfd, symbol, native, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- asymbol *symbol;
- combined_entry_type *native;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
-{
- unsigned int name_length;
- union internal_auxent *auxent;
- char *name = (char *) (symbol->name);
-
- if (name == (char *) NULL)
- {
- /* coff symbols always have names, so we'll make one up */
- symbol->name = "strange";
- name = (char *) symbol->name;
- }
- name_length = strlen (name);
-
- if (native->u.syment.n_sclass == C_FILE
- && native->u.syment.n_numaux > 0)
- {
- unsigned int filnmlen;
-
- if (bfd_coff_force_symnames_in_strings (abfd))
- {
- native->u.syment._n._n_n._n_offset =
- (*string_size_p + STRING_SIZE_SIZE);
- native->u.syment._n._n_n._n_zeroes = 0;
- *string_size_p += 6; /* strlen(".file") + 1 */
- }
- else
- strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
-
- auxent = &(native + 1)->u.auxent;
-
- filnmlen = bfd_coff_filnmlen (abfd);
-
- if (bfd_coff_long_filenames (abfd))
- {
- if (name_length <= filnmlen)
- {
- strncpy (auxent->x_file.x_fname, name, filnmlen);
- }
- else
- {
- auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE;
- auxent->x_file.x_n.x_zeroes = 0;
- *string_size_p += name_length + 1;
- }
- }
- else
- {
- strncpy (auxent->x_file.x_fname, name, filnmlen);
- if (name_length > filnmlen)
- name[filnmlen] = '\0';
- }
- }
- else
- {
- if (name_length <= SYMNMLEN && !bfd_coff_force_symnames_in_strings (abfd))
- {
- /* This name will fit into the symbol neatly */
- strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN);
- }
- else if (!bfd_coff_symname_in_debug (abfd, &native->u.syment))
- {
- native->u.syment._n._n_n._n_offset = (*string_size_p
- + STRING_SIZE_SIZE);
- native->u.syment._n._n_n._n_zeroes = 0;
- *string_size_p += name_length + 1;
- }
- else
- {
- file_ptr filepos;
- bfd_byte buf[4];
- int prefix_len = bfd_coff_debug_string_prefix_length (abfd);
-
- /* This name should be written into the .debug section. For
- some reason each name is preceded by a two byte length
- and also followed by a null byte. FIXME: We assume that
- the .debug section has already been created, and that it
- is large enough. */
- if (*debug_string_section_p == (asection *) NULL)
- *debug_string_section_p = bfd_get_section_by_name (abfd, ".debug");
- filepos = bfd_tell (abfd);
- if (prefix_len == 4)
- bfd_put_32 (abfd, (bfd_vma) (name_length + 1), buf);
- else
- bfd_put_16 (abfd, (bfd_vma) (name_length + 1), buf);
-
- if (!bfd_set_section_contents (abfd,
- *debug_string_section_p,
- (PTR) buf,
- (file_ptr) *debug_string_size_p,
- (bfd_size_type) prefix_len)
- || !bfd_set_section_contents (abfd,
- *debug_string_section_p,
- (PTR) symbol->name,
- (file_ptr) (*debug_string_size_p
- + prefix_len),
- (bfd_size_type) name_length + 1))
- abort ();
- if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
- abort ();
- native->u.syment._n._n_n._n_offset =
- *debug_string_size_p + prefix_len;
- native->u.syment._n._n_n._n_zeroes = 0;
- *debug_string_size_p += name_length + 1 + prefix_len;
- }
- }
-}
-
-/* We need to keep track of the symbol index so that when we write out
- the relocs we can get the index for a symbol. This method is a
- hack. FIXME. */
-
-#define set_index(symbol, idx) ((symbol)->udata.i = (idx))
-
-/* Write a symbol out to a COFF file. */
-
-static bfd_boolean
-coff_write_symbol (abfd, symbol, native, written, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- asymbol *symbol;
- combined_entry_type *native;
- bfd_vma *written;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
-{
- unsigned int numaux = native->u.syment.n_numaux;
- int type = native->u.syment.n_type;
- int class = native->u.syment.n_sclass;
- PTR buf;
- bfd_size_type symesz;
-
- if (native->u.syment.n_sclass == C_FILE)
- symbol->flags |= BSF_DEBUGGING;
-
- if (symbol->flags & BSF_DEBUGGING
- && bfd_is_abs_section (symbol->section))
- {
- native->u.syment.n_scnum = N_DEBUG;
- }
- else if (bfd_is_abs_section (symbol->section))
- {
- native->u.syment.n_scnum = N_ABS;
- }
- else if (bfd_is_und_section (symbol->section))
- {
- native->u.syment.n_scnum = N_UNDEF;
- }
- else
- {
- native->u.syment.n_scnum =
- symbol->section->output_section->target_index;
- }
-
- coff_fix_symbol_name (abfd, symbol, native, string_size_p,
- debug_string_section_p, debug_string_size_p);
-
- symesz = bfd_coff_symesz (abfd);
- buf = bfd_alloc (abfd, symesz);
- if (!buf)
- return FALSE;
- bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
- if (bfd_bwrite (buf, symesz, abfd) != symesz)
- return FALSE;
- bfd_release (abfd, buf);
-
- if (native->u.syment.n_numaux > 0)
- {
- bfd_size_type auxesz;
- unsigned int j;
-
- auxesz = bfd_coff_auxesz (abfd);
- buf = bfd_alloc (abfd, auxesz);
- if (!buf)
- return FALSE;
- for (j = 0; j < native->u.syment.n_numaux; j++)
- {
- bfd_coff_swap_aux_out (abfd,
- &((native + j + 1)->u.auxent),
- type,
- class,
- (int) j,
- native->u.syment.n_numaux,
- buf);
- if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
- return FALSE;
- }
- bfd_release (abfd, buf);
- }
-
- /* Store the index for use when we write out the relocs. */
- set_index (symbol, *written);
-
- *written += numaux + 1;
- return TRUE;
-}
-
-/* Write out a symbol to a COFF file that does not come from a COFF
- file originally. This symbol may have been created by the linker,
- or we may be linking a non COFF file to a COFF file. */
-
-static bfd_boolean
-coff_write_alien_symbol (abfd, symbol, written, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- asymbol *symbol;
- bfd_vma *written;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
-{
- combined_entry_type *native;
- combined_entry_type dummy;
-
- native = &dummy;
- native->u.syment.n_type = T_NULL;
- native->u.syment.n_flags = 0;
- if (bfd_is_und_section (symbol->section))
- {
- native->u.syment.n_scnum = N_UNDEF;
- native->u.syment.n_value = symbol->value;
- }
- else if (bfd_is_com_section (symbol->section))
- {
- native->u.syment.n_scnum = N_UNDEF;
- native->u.syment.n_value = symbol->value;
- }
- else if (symbol->flags & BSF_DEBUGGING)
- {
- /* There isn't much point to writing out a debugging symbol
- unless we are prepared to convert it into COFF debugging
- format. So, we just ignore them. We must clobber the symbol
- name to keep it from being put in the string table. */
- symbol->name = "";
- return TRUE;
- }
- else
- {
- native->u.syment.n_scnum =
- symbol->section->output_section->target_index;
- native->u.syment.n_value = (symbol->value
- + symbol->section->output_offset);
- if (! obj_pe (abfd))
- native->u.syment.n_value += symbol->section->output_section->vma;
-
- /* Copy the any flags from the file header into the symbol.
- FIXME: Why? */
- {
- coff_symbol_type *c = coff_symbol_from (abfd, symbol);
- if (c != (coff_symbol_type *) NULL)
- native->u.syment.n_flags = bfd_asymbol_bfd (&c->symbol)->flags;
- }
- }
-
- native->u.syment.n_type = 0;
- if (symbol->flags & BSF_LOCAL)
- native->u.syment.n_sclass = C_STAT;
- else if (symbol->flags & BSF_WEAK)
- native->u.syment.n_sclass = obj_pe (abfd) ? C_NT_WEAK : C_WEAKEXT;
- else
- native->u.syment.n_sclass = C_EXT;
- native->u.syment.n_numaux = 0;
-
- return coff_write_symbol (abfd, symbol, native, written, string_size_p,
- debug_string_section_p, debug_string_size_p);
-}
-
-/* Write a native symbol to a COFF file. */
-
-static bfd_boolean
-coff_write_native_symbol (abfd, symbol, written, string_size_p,
- debug_string_section_p, debug_string_size_p)
- bfd *abfd;
- coff_symbol_type *symbol;
- bfd_vma *written;
- bfd_size_type *string_size_p;
- asection **debug_string_section_p;
- bfd_size_type *debug_string_size_p;
-{
- combined_entry_type *native = symbol->native;
- alent *lineno = symbol->lineno;
-
- /* If this symbol has an associated line number, we must store the
- symbol index in the line number field. We also tag the auxent to
- point to the right place in the lineno table. */
- if (lineno && !symbol->done_lineno && symbol->symbol.section->owner != NULL)
- {
- unsigned int count = 0;
- lineno[count].u.offset = *written;
- if (native->u.syment.n_numaux)
- {
- union internal_auxent *a = &((native + 1)->u.auxent);
-
- a->x_sym.x_fcnary.x_fcn.x_lnnoptr =
- symbol->symbol.section->output_section->moving_line_filepos;
- }
-
- /* Count and relocate all other linenumbers. */
- count++;
- while (lineno[count].line_number != 0)
- {
-#if 0
- /* 13 april 92. sac
- I've been told this, but still need proof:
- > The second bug is also in `bfd/coffcode.h'. This bug
- > causes the linker to screw up the pc-relocations for
- > all the line numbers in COFF code. This bug isn't only
- > specific to A29K implementations, but affects all
- > systems using COFF format binaries. Note that in COFF
- > object files, the line number core offsets output by
- > the assembler are relative to the start of each
- > procedure, not to the start of the .text section. This
- > patch relocates the line numbers relative to the
- > `native->u.syment.n_value' instead of the section
- > virtual address.
- > modular!olson@cs.arizona.edu (Jon Olson)
- */
- lineno[count].u.offset += native->u.syment.n_value;
-#else
- lineno[count].u.offset +=
- (symbol->symbol.section->output_section->vma
- + symbol->symbol.section->output_offset);
-#endif
- count++;
- }
- symbol->done_lineno = TRUE;
-
- if (! bfd_is_const_section (symbol->symbol.section->output_section))
- symbol->symbol.section->output_section->moving_line_filepos +=
- count * bfd_coff_linesz (abfd);
- }
-
- return coff_write_symbol (abfd, &(symbol->symbol), native, written,
- string_size_p, debug_string_section_p,
- debug_string_size_p);
-}
-
-/* Write out the COFF symbols. */
-
-bfd_boolean
-coff_write_symbols (abfd)
- bfd *abfd;
-{
- bfd_size_type string_size;
- asection *debug_string_section;
- bfd_size_type debug_string_size;
- unsigned int i;
- unsigned int limit = bfd_get_symcount (abfd);
- bfd_signed_vma written = 0;
- asymbol **p;
-
- string_size = 0;
- debug_string_section = NULL;
- debug_string_size = 0;
-
- /* If this target supports long section names, they must be put into
- the string table. This is supported by PE. This code must
- handle section names just as they are handled in
- coff_write_object_contents. */
- if (bfd_coff_long_section_names (abfd))
- {
- asection *o;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- size_t len;
-
- len = strlen (o->name);
- if (len > SCNNMLEN)
- string_size += len + 1;
- }
- }
-
- /* Seek to the right place */
- if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
- return FALSE;
-
- /* Output all the symbols we have */
-
- written = 0;
- for (p = abfd->outsymbols, i = 0; i < limit; i++, p++)
- {
- asymbol *symbol = *p;
- coff_symbol_type *c_symbol = coff_symbol_from (abfd, symbol);
-
- if (c_symbol == (coff_symbol_type *) NULL
- || c_symbol->native == (combined_entry_type *) NULL)
- {
- if (!coff_write_alien_symbol (abfd, symbol, &written, &string_size,
- &debug_string_section,
- &debug_string_size))
- return FALSE;
- }
- else
- {
- if (!coff_write_native_symbol (abfd, c_symbol, &written,
- &string_size, &debug_string_section,
- &debug_string_size))
- return FALSE;
- }
- }
-
- obj_raw_syment_count (abfd) = written;
-
- /* Now write out strings */
-
- if (string_size != 0)
- {
- unsigned int size = string_size + STRING_SIZE_SIZE;
- bfd_byte buffer[STRING_SIZE_SIZE];
-
-#if STRING_SIZE_SIZE == 4
- H_PUT_32 (abfd, size, buffer);
-#else
- #error Change H_PUT_32
-#endif
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd)
- != sizeof (buffer))
- return FALSE;
-
- /* Handle long section names. This code must handle section
- names just as they are handled in coff_write_object_contents. */
- if (bfd_coff_long_section_names (abfd))
- {
- asection *o;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- size_t len;
-
- len = strlen (o->name);
- if (len > SCNNMLEN)
- {
- if (bfd_bwrite (o->name, (bfd_size_type) (len + 1), abfd)
- != len + 1)
- return FALSE;
- }
- }
- }
-
- for (p = abfd->outsymbols, i = 0;
- i < limit;
- i++, p++)
- {
- asymbol *q = *p;
- size_t name_length = strlen (q->name);
- coff_symbol_type *c_symbol = coff_symbol_from (abfd, q);
- size_t maxlen;
-
- /* Figure out whether the symbol name should go in the string
- table. Symbol names that are short enough are stored
- directly in the syment structure. File names permit a
- different, longer, length in the syment structure. On
- XCOFF, some symbol names are stored in the .debug section
- rather than in the string table. */
-
- if (c_symbol == NULL
- || c_symbol->native == NULL)
- {
- /* This is not a COFF symbol, so it certainly is not a
- file name, nor does it go in the .debug section. */
- maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN;
- }
- else if (bfd_coff_symname_in_debug (abfd,
- &c_symbol->native->u.syment))
- {
- /* This symbol name is in the XCOFF .debug section.
- Don't write it into the string table. */
- maxlen = name_length;
- }
- else if (c_symbol->native->u.syment.n_sclass == C_FILE
- && c_symbol->native->u.syment.n_numaux > 0)
- {
- if (bfd_coff_force_symnames_in_strings (abfd))
- {
- if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6)
- return FALSE;
- }
- maxlen = bfd_coff_filnmlen (abfd);
- }
- else
- maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN;
-
- if (name_length > maxlen)
- {
- if (bfd_bwrite ((PTR) (q->name), (bfd_size_type) name_length + 1,
- abfd) != name_length + 1)
- return FALSE;
- }
- }
- }
- else
- {
- /* We would normally not write anything here, but we'll write
- out 4 so that any stupid coff reader which tries to read the
- string table even when there isn't one won't croak. */
- unsigned int size = STRING_SIZE_SIZE;
- bfd_byte buffer[STRING_SIZE_SIZE];
-
-#if STRING_SIZE_SIZE == 4
- H_PUT_32 (abfd, size, buffer);
-#else
- #error Change H_PUT_32
-#endif
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd)
- != STRING_SIZE_SIZE)
- return FALSE;
- }
-
- /* Make sure the .debug section was created to be the correct size.
- We should create it ourselves on the fly, but we don't because
- BFD won't let us write to any section until we know how large all
- the sections are. We could still do it by making another pass
- over the symbols. FIXME. */
- BFD_ASSERT (debug_string_size == 0
- || (debug_string_section != (asection *) NULL
- && (BFD_ALIGN (debug_string_size,
- 1 << debug_string_section->alignment_power)
- == bfd_section_size (abfd, debug_string_section))));
-
- return TRUE;
-}
-
-bfd_boolean
-coff_write_linenumbers (abfd)
- bfd *abfd;
-{
- asection *s;
- bfd_size_type linesz;
- PTR buff;
-
- linesz = bfd_coff_linesz (abfd);
- buff = bfd_alloc (abfd, linesz);
- if (!buff)
- return FALSE;
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
- {
- if (s->lineno_count)
- {
- asymbol **q = abfd->outsymbols;
- if (bfd_seek (abfd, s->line_filepos, SEEK_SET) != 0)
- return FALSE;
- /* Find all the linenumbers in this section */
- while (*q)
- {
- asymbol *p = *q;
- if (p->section->output_section == s)
- {
- alent *l =
- BFD_SEND (bfd_asymbol_bfd (p), _get_lineno,
- (bfd_asymbol_bfd (p), p));
- if (l)
- {
- /* Found a linenumber entry, output */
- struct internal_lineno out;
- memset ((PTR) & out, 0, sizeof (out));
- out.l_lnno = 0;
- out.l_addr.l_symndx = l->u.offset;
- bfd_coff_swap_lineno_out (abfd, &out, buff);
- if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
- != linesz)
- return FALSE;
- l++;
- while (l->line_number)
- {
- out.l_lnno = l->line_number;
- out.l_addr.l_symndx = l->u.offset;
- bfd_coff_swap_lineno_out (abfd, &out, buff);
- if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
- != linesz)
- return FALSE;
- l++;
- }
- }
- }
- q++;
- }
- }
- }
- bfd_release (abfd, buff);
- return TRUE;
-}
-
-alent *
-coff_get_lineno (ignore_abfd, symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
-{
- return coffsymbol (symbol)->lineno;
-}
-
-#if 0
-
-/* This is only called from coff_add_missing_symbols, which has been
- disabled. */
-
-asymbol *
-coff_section_symbol (abfd, name)
- bfd *abfd;
- char *name;
-{
- asection *sec = bfd_make_section_old_way (abfd, name);
- asymbol *sym;
- combined_entry_type *csym;
-
- sym = sec->symbol;
- csym = coff_symbol_from (abfd, sym)->native;
- /* Make sure back-end COFF stuff is there. */
- if (csym == 0)
- {
- struct foo
- {
- coff_symbol_type sym;
- /* @@FIXME This shouldn't use a fixed size!! */
- combined_entry_type e[10];
- };
- struct foo *f;
-
- f = (struct foo *) bfd_zalloc (abfd, (bfd_size_type) sizeof (*f));
- if (!f)
- {
- bfd_set_error (bfd_error_no_error);
- return NULL;
- }
- coff_symbol_from (abfd, sym)->native = csym = f->e;
- }
- csym[0].u.syment.n_sclass = C_STAT;
- csym[0].u.syment.n_numaux = 1;
-/* SF_SET_STATICS (sym); @@ ??? */
- csym[1].u.auxent.x_scn.x_scnlen = sec->_raw_size;
- csym[1].u.auxent.x_scn.x_nreloc = sec->reloc_count;
- csym[1].u.auxent.x_scn.x_nlinno = sec->lineno_count;
-
- if (sec->output_section == NULL)
- {
- sec->output_section = sec;
- sec->output_offset = 0;
- }
-
- return sym;
-}
-
-#endif /* 0 */
-
-/* This function transforms the offsets into the symbol table into
- pointers to syments. */
-
-static void
-coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent)
- bfd *abfd;
- combined_entry_type *table_base;
- combined_entry_type *symbol;
- unsigned int indaux;
- combined_entry_type *auxent;
-{
- unsigned int type = symbol->u.syment.n_type;
- unsigned int class = symbol->u.syment.n_sclass;
-
- if (coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook)
- {
- if ((*coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook)
- (abfd, table_base, symbol, indaux, auxent))
- return;
- }
-
- /* Don't bother if this is a file or a section */
- if (class == C_STAT && type == T_NULL)
- return;
- if (class == C_FILE)
- return;
-
- /* Otherwise patch up */
-#define N_TMASK coff_data (abfd)->local_n_tmask
-#define N_BTSHFT coff_data (abfd)->local_n_btshft
- if ((ISFCN (type) || ISTAG (class) || class == C_BLOCK || class == C_FCN)
- && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
- {
- auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p =
- table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;
- auxent->fix_end = 1;
- }
- /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can
- generate one, so we must be careful to ignore it. */
- if (auxent->u.auxent.x_sym.x_tagndx.l > 0)
- {
- auxent->u.auxent.x_sym.x_tagndx.p =
- table_base + auxent->u.auxent.x_sym.x_tagndx.l;
- auxent->fix_tag = 1;
- }
-}
-
-/* Allocate space for the ".debug" section, and read it.
- We did not read the debug section until now, because
- we didn't want to go to the trouble until someone needed it. */
-
-static char *
-build_debug_section (abfd)
- bfd *abfd;
-{
- char *debug_section;
- file_ptr position;
- bfd_size_type sec_size;
-
- asection *sect = bfd_get_section_by_name (abfd, ".debug");
-
- if (!sect)
- {
- bfd_set_error (bfd_error_no_debug_section);
- return NULL;
- }
-
- sec_size = bfd_get_section_size_before_reloc (sect);
- debug_section = (PTR) bfd_alloc (abfd, sec_size);
- if (debug_section == NULL)
- return NULL;
-
- /* Seek to the beginning of the `.debug' section and read it.
- Save the current position first; it is needed by our caller.
- Then read debug section and reset the file pointer. */
-
- position = bfd_tell (abfd);
- if (bfd_seek (abfd, sect->filepos, SEEK_SET) != 0
- || bfd_bread (debug_section, sec_size, abfd) != sec_size
- || bfd_seek (abfd, position, SEEK_SET) != 0)
- return NULL;
- return debug_section;
-}
-
-/* Return a pointer to a malloc'd copy of 'name'. 'name' may not be
- \0-terminated, but will not exceed 'maxlen' characters. The copy *will*
- be \0-terminated. */
-static char *
-copy_name (abfd, name, maxlen)
- bfd *abfd;
- char *name;
- size_t maxlen;
-{
- size_t len;
- char *newname;
-
- for (len = 0; len < maxlen; ++len)
- {
- if (name[len] == '\0')
- {
- break;
- }
- }
-
- if ((newname = (PTR) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
- return (NULL);
- strncpy (newname, name, len);
- newname[len] = '\0';
- return newname;
-}
-
-/* Read in the external symbols. */
-
-bfd_boolean
-_bfd_coff_get_external_symbols (abfd)
- bfd *abfd;
-{
- bfd_size_type symesz;
- bfd_size_type size;
- PTR syms;
-
- if (obj_coff_external_syms (abfd) != NULL)
- return TRUE;
-
- symesz = bfd_coff_symesz (abfd);
-
- size = obj_raw_syment_count (abfd) * symesz;
-
- syms = (PTR) bfd_malloc (size);
- if (syms == NULL && size != 0)
- return FALSE;
-
- if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
- || bfd_bread (syms, size, abfd) != size)
- {
- if (syms != NULL)
- free (syms);
- return FALSE;
- }
-
- obj_coff_external_syms (abfd) = syms;
-
- return TRUE;
-}
-
-/* Read in the external strings. The strings are not loaded until
- they are needed. This is because we have no simple way of
- detecting a missing string table in an archive. */
-
-const char *
-_bfd_coff_read_string_table (abfd)
- bfd *abfd;
-{
- char extstrsize[STRING_SIZE_SIZE];
- bfd_size_type strsize;
- char *strings;
- file_ptr pos;
-
- if (obj_coff_strings (abfd) != NULL)
- return obj_coff_strings (abfd);
-
- if (obj_sym_filepos (abfd) == 0)
- {
- bfd_set_error (bfd_error_no_symbols);
- return NULL;
- }
-
- 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_bread (extstrsize, (bfd_size_type) sizeof extstrsize, abfd)
- != sizeof extstrsize)
- {
- if (bfd_get_error () != bfd_error_file_truncated)
- return NULL;
-
- /* There is no string table. */
- strsize = STRING_SIZE_SIZE;
- }
- else
- {
-#if STRING_SIZE_SIZE == 4
- strsize = H_GET_32 (abfd, extstrsize);
-#else
- #error Change H_GET_32
-#endif
- }
-
- if (strsize < STRING_SIZE_SIZE)
- {
- (*_bfd_error_handler)
- (_("%s: bad string table size %lu"), bfd_archive_filename (abfd),
- (unsigned long) strsize);
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-
- strings = (char *) bfd_malloc (strsize);
- if (strings == NULL)
- return NULL;
-
- if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd)
- != strsize - STRING_SIZE_SIZE)
- {
- free (strings);
- return NULL;
- }
-
- obj_coff_strings (abfd) = strings;
-
- return strings;
-}
-
-/* Free up the external symbols and strings read from a COFF file. */
-
-bfd_boolean
-_bfd_coff_free_symbols (abfd)
- bfd *abfd;
-{
- if (obj_coff_external_syms (abfd) != NULL
- && ! obj_coff_keep_syms (abfd))
- {
- free (obj_coff_external_syms (abfd));
- obj_coff_external_syms (abfd) = NULL;
- }
- if (obj_coff_strings (abfd) != NULL
- && ! obj_coff_keep_strings (abfd))
- {
- free (obj_coff_strings (abfd));
- obj_coff_strings (abfd) = NULL;
- }
- return TRUE;
-}
-
-/* Read a symbol table into freshly bfd_allocated memory, swap it, and
- knit the symbol names into a normalized form. By normalized here I
- mean that all symbols have an n_offset pointer that points to a null-
- terminated string. */
-
-combined_entry_type *
-coff_get_normalized_symtab (abfd)
- bfd *abfd;
-{
- combined_entry_type *internal;
- combined_entry_type *internal_ptr;
- combined_entry_type *symbol_ptr;
- combined_entry_type *internal_end;
- size_t symesz;
- char *raw_src;
- char *raw_end;
- const char *string_table = NULL;
- char *debug_section = NULL;
- bfd_size_type size;
-
- if (obj_raw_syments (abfd) != NULL)
- return obj_raw_syments (abfd);
-
- size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
- internal = (combined_entry_type *) bfd_zalloc (abfd, size);
- if (internal == NULL && size != 0)
- return NULL;
- internal_end = internal + obj_raw_syment_count (abfd);
-
- if (! _bfd_coff_get_external_symbols (abfd))
- return NULL;
-
- raw_src = (char *) obj_coff_external_syms (abfd);
-
- /* mark the end of the symbols */
- symesz = bfd_coff_symesz (abfd);
- raw_end = (char *) raw_src + obj_raw_syment_count (abfd) * symesz;
-
- /* FIXME SOMEDAY. A string table size of zero is very weird, but
- probably possible. If one shows up, it will probably kill us. */
-
- /* Swap all the raw entries */
- for (internal_ptr = internal;
- raw_src < raw_end;
- raw_src += symesz, internal_ptr++)
- {
-
- unsigned int i;
- bfd_coff_swap_sym_in (abfd, (PTR) raw_src,
- (PTR) & internal_ptr->u.syment);
- symbol_ptr = internal_ptr;
-
- for (i = 0;
- i < symbol_ptr->u.syment.n_numaux;
- i++)
- {
- internal_ptr++;
- raw_src += symesz;
- bfd_coff_swap_aux_in (abfd, (PTR) raw_src,
- symbol_ptr->u.syment.n_type,
- symbol_ptr->u.syment.n_sclass,
- (int) i, symbol_ptr->u.syment.n_numaux,
- &(internal_ptr->u.auxent));
- coff_pointerize_aux (abfd, internal, symbol_ptr, i,
- internal_ptr);
- }
- }
-
- /* Free the raw symbols, but not the strings (if we have them). */
- obj_coff_keep_strings (abfd) = TRUE;
- if (! _bfd_coff_free_symbols (abfd))
- return NULL;
-
- for (internal_ptr = internal; internal_ptr < internal_end;
- internal_ptr++)
- {
- if (internal_ptr->u.syment.n_sclass == C_FILE
- && internal_ptr->u.syment.n_numaux > 0)
- {
- /* make a file symbol point to the name in the auxent, since
- the text ".file" is redundant */
- if ((internal_ptr + 1)->u.auxent.x_file.x_n.x_zeroes == 0)
- {
- /* the filename is a long one, point into the string table */
- if (string_table == NULL)
- {
- string_table = _bfd_coff_read_string_table (abfd);
- if (string_table == NULL)
- return NULL;
- }
-
- internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
- (string_table
- + (internal_ptr + 1)->u.auxent.x_file.x_n.x_offset));
- }
- else
- {
- /* Ordinary short filename, put into memory anyway. The
- Microsoft PE tools sometimes store a filename in
- multiple AUX entries. */
- if (internal_ptr->u.syment.n_numaux > 1
- && coff_data (abfd)->pe)
- {
- internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
- copy_name (abfd,
- (internal_ptr + 1)->u.auxent.x_file.x_fname,
- internal_ptr->u.syment.n_numaux * symesz));
- }
- else
- {
- internal_ptr->u.syment._n._n_n._n_offset =
- ((long)
- copy_name (abfd,
- (internal_ptr + 1)->u.auxent.x_file.x_fname,
- (size_t) bfd_coff_filnmlen (abfd)));
- }
- }
- }
- else
- {
- if (internal_ptr->u.syment._n._n_n._n_zeroes != 0)
- {
- /* This is a "short" name. Make it long. */
- 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;
-
- newstring = (PTR) bfd_zalloc (abfd, (bfd_size_type) (i + 1));
- if (newstring == NULL)
- return (NULL);
- 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;
- }
- else if (internal_ptr->u.syment._n._n_n._n_offset == 0)
- internal_ptr->u.syment._n._n_n._n_offset = (long int) "";
- else if (!bfd_coff_symname_in_debug (abfd, &internal_ptr->u.syment))
- {
- /* Long name already. Point symbol at the string in the
- table. */
- if (string_table == NULL)
- {
- string_table = _bfd_coff_read_string_table (abfd);
- if (string_table == NULL)
- return NULL;
- }
- internal_ptr->u.syment._n._n_n._n_offset =
- ((long int)
- (string_table
- + internal_ptr->u.syment._n._n_n._n_offset));
- }
- else
- {
- /* Long name in debug section. Very similar. */
- if (debug_section == NULL)
- debug_section = build_debug_section (abfd);
- internal_ptr->u.syment._n._n_n._n_offset = (long int)
- (debug_section + internal_ptr->u.syment._n._n_n._n_offset);
- }
- }
- internal_ptr += internal_ptr->u.syment.n_numaux;
- }
-
- obj_raw_syments (abfd) = internal;
- BFD_ASSERT (obj_raw_syment_count (abfd)
- == (unsigned int) (internal_ptr - internal));
-
- return (internal);
-} /* coff_get_normalized_symtab() */
-
-long
-coff_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
-{
- if (bfd_get_format (abfd) != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
- return (asect->reloc_count + 1) * sizeof (arelent *);
-}
-
-asymbol *
-coff_make_empty_symbol (abfd)
- bfd *abfd;
-{
- bfd_size_type amt = sizeof (coff_symbol_type);
- coff_symbol_type *new = (coff_symbol_type *) bfd_zalloc (abfd, amt);
- if (new == NULL)
- return (NULL);
- new->symbol.section = 0;
- new->native = 0;
- new->lineno = (alent *) NULL;
- new->done_lineno = FALSE;
- new->symbol.the_bfd = abfd;
- return &new->symbol;
-}
-
-/* Make a debugging symbol. */
-
-asymbol *
-coff_bfd_make_debug_symbol (abfd, ptr, sz)
- bfd *abfd;
- PTR ptr ATTRIBUTE_UNUSED;
- unsigned long sz ATTRIBUTE_UNUSED;
-{
- 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). */
- 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;
- new->symbol.flags = BSF_DEBUGGING;
- new->lineno = (alent *) NULL;
- new->done_lineno = FALSE;
- new->symbol.the_bfd = abfd;
- return &new->symbol;
-}
-
-void
-coff_get_symbol_info (abfd, symbol, ret)
- bfd *abfd;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
- if (coffsymbol (symbol)->native != NULL
- && coffsymbol (symbol)->native->fix_value)
- {
- ret->value = coffsymbol (symbol)->native->u.syment.n_value -
- (unsigned long) obj_raw_syments (abfd);
- }
-}
-
-/* Return the COFF syment for a symbol. */
-
-bfd_boolean
-bfd_coff_get_syment (abfd, symbol, psyment)
- bfd *abfd;
- asymbol *symbol;
- struct internal_syment *psyment;
-{
- coff_symbol_type *csym;
-
- csym = coff_symbol_from (abfd, symbol);
- if (csym == NULL || csym->native == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- *psyment = csym->native->u.syment;
-
- if (csym->native->fix_value)
- psyment->n_value = psyment->n_value -
- (unsigned long) obj_raw_syments (abfd);
-
- /* FIXME: We should handle fix_line here. */
-
- return TRUE;
-}
-
-/* Return the COFF auxent for a symbol. */
-
-bfd_boolean
-bfd_coff_get_auxent (abfd, symbol, indx, pauxent)
- bfd *abfd;
- asymbol *symbol;
- int indx;
- union internal_auxent *pauxent;
-{
- coff_symbol_type *csym;
- combined_entry_type *ent;
-
- csym = coff_symbol_from (abfd, symbol);
-
- if (csym == NULL
- || csym->native == NULL
- || indx >= csym->native->u.syment.n_numaux)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- ent = csym->native + indx + 1;
-
- *pauxent = ent->u.auxent;
-
- if (ent->fix_tag)
- pauxent->x_sym.x_tagndx.l =
- ((combined_entry_type *) pauxent->x_sym.x_tagndx.p
- - obj_raw_syments (abfd));
-
- if (ent->fix_end)
- pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l =
- ((combined_entry_type *) pauxent->x_sym.x_fcnary.x_fcn.x_endndx.p
- - obj_raw_syments (abfd));
-
- if (ent->fix_scnlen)
- pauxent->x_csect.x_scnlen.l =
- ((combined_entry_type *) pauxent->x_csect.x_scnlen.p
- - obj_raw_syments (abfd));
-
- return TRUE;
-}
-
-/* Print out information about COFF symbol. */
-
-void
-coff_print_symbol (abfd, filep, symbol, how)
- bfd *abfd;
- PTR filep;
- asymbol *symbol;
- bfd_print_symbol_type how;
-{
- FILE *file = (FILE *) filep;
-
- switch (how)
- {
- case bfd_print_symbol_name:
- fprintf (file, "%s", symbol->name);
- break;
-
- case bfd_print_symbol_more:
- fprintf (file, "coff %s %s",
- coffsymbol (symbol)->native ? "n" : "g",
- coffsymbol (symbol)->lineno ? "l" : " ");
- break;
-
- case bfd_print_symbol_all:
- if (coffsymbol (symbol)->native)
- {
- bfd_vma val;
- unsigned int aux;
- combined_entry_type *combined = coffsymbol (symbol)->native;
- combined_entry_type *root = obj_raw_syments (abfd);
- struct lineno_cache_entry *l = coffsymbol (symbol)->lineno;
-
- fprintf (file, "[%3ld]", (long) (combined - root));
-
- if (! combined->fix_value)
- val = (bfd_vma) combined->u.syment.n_value;
- else
- val = combined->u.syment.n_value - (unsigned long) root;
-
-#ifndef XCOFF64
- fprintf (file,
- "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%08lx %s",
- combined->u.syment.n_scnum,
- combined->u.syment.n_flags,
- combined->u.syment.n_type,
- combined->u.syment.n_sclass,
- combined->u.syment.n_numaux,
- (unsigned long) val,
- symbol->name);
-#else
- /* Print out the wide, 64 bit, symbol value */
- fprintf (file,
- "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%016llx %s",
- combined->u.syment.n_scnum,
- combined->u.syment.n_flags,
- combined->u.syment.n_type,
- combined->u.syment.n_sclass,
- combined->u.syment.n_numaux,
- val,
- symbol->name);
-#endif
-
- for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
- {
- combined_entry_type *auxp = combined + aux + 1;
- long tagndx;
-
- if (auxp->fix_tag)
- tagndx = auxp->u.auxent.x_sym.x_tagndx.p - root;
- else
- tagndx = auxp->u.auxent.x_sym.x_tagndx.l;
-
- fprintf (file, "\n");
-
- if (bfd_coff_print_aux (abfd, file, root, combined, auxp, aux))
- continue;
-
- switch (combined->u.syment.n_sclass)
- {
- case C_FILE:
- fprintf (file, "File ");
- break;
-
- case C_STAT:
- if (combined->u.syment.n_type == T_NULL)
- /* probably a section symbol? */
- {
- fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d",
- (long) auxp->u.auxent.x_scn.x_scnlen,
- auxp->u.auxent.x_scn.x_nreloc,
- auxp->u.auxent.x_scn.x_nlinno);
- if (auxp->u.auxent.x_scn.x_checksum != 0
- || auxp->u.auxent.x_scn.x_associated != 0
- || auxp->u.auxent.x_scn.x_comdat != 0)
- fprintf (file, " checksum 0x%lx assoc %d comdat %d",
- auxp->u.auxent.x_scn.x_checksum,
- auxp->u.auxent.x_scn.x_associated,
- auxp->u.auxent.x_scn.x_comdat);
- break;
- }
- /* else fall through */
- case C_EXT:
- if (ISFCN (combined->u.syment.n_type))
- {
- long next, llnos;
-
- if (auxp->fix_end)
- next = (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
- - root);
- else
- next = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;
- llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr;
- fprintf (file,
- "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld",
- tagndx, auxp->u.auxent.x_sym.x_misc.x_fsize,
- llnos, next);
- break;
- }
- /* else fall through */
- default:
- fprintf (file, "AUX lnno %d size 0x%x tagndx %ld",
- auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
- auxp->u.auxent.x_sym.x_misc.x_lnsz.x_size,
- tagndx);
- if (auxp->fix_end)
- fprintf (file, " endndx %ld",
- ((long)
- (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
- - root)));
- break;
- }
- }
-
- if (l)
- {
- fprintf (file, "\n%s :", l->u.sym->name);
- l++;
- while (l->line_number)
- {
- fprintf (file, "\n%4d : 0x%lx",
- l->line_number,
- ((unsigned long)
- (l->u.offset + symbol->section->vma)));
- l++;
- }
- }
- }
- else
- {
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
- fprintf (file, " %-5s %s %s %s",
- symbol->section->name,
- coffsymbol (symbol)->native ? "n" : "g",
- coffsymbol (symbol)->lineno ? "l" : " ",
- symbol->name);
- }
- }
-}
-
-/* Return whether a symbol name implies a local symbol. In COFF,
- local symbols generally start with ``.L''. Most targets use this
- function for the is_local_label_name entry point, but some may
- override it. */
-
-bfd_boolean
-_bfd_coff_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
-{
- return name[0] == '.' && name[1] == 'L';
-}
-
-/* Provided a BFD, a section and an offset (in bytes, not octets) into the
- section, calculate and return the name of the source file and the line
- nearest to the wanted location. */
-
-bfd_boolean
-coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
- functionname_ptr, line_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *line_ptr;
-{
- bfd_boolean found;
- unsigned int i;
- unsigned int line_base;
- coff_data_type *cof = coff_data (abfd);
- /* Run through the raw syments if available */
- combined_entry_type *p;
- 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. */
- if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
- &found, filename_ptr,
- functionname_ptr, line_ptr,
- &coff_data(abfd)->line_info))
- return FALSE;
-
- if (found)
- return TRUE;
-
- /* Also try examining DWARF2 debugging information. */
- if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr, 0,
- &coff_data(abfd)->dwarf2_find_line_info))
- return TRUE;
-
- *filename_ptr = 0;
- *functionname_ptr = 0;
- *line_ptr = 0;
-
- /* Don't try and find line numbers in a non coff file */
- if (!bfd_family_coff (abfd))
- return FALSE;
-
- if (cof == NULL)
- return FALSE;
-
- /* Find the first C_FILE symbol. */
- p = cof->raw_syments;
- if (!p)
- return FALSE;
-
- pend = p + cof->raw_syment_count;
- while (p < pend)
- {
- if (p->u.syment.n_sclass == C_FILE)
- break;
- p += 1 + p->u.syment.n_numaux;
- }
-
- if (p < pend)
- {
- bfd_vma sec_vma;
- bfd_vma maxdiff;
-
- /* Look through the C_FILE symbols to find the best one. */
- sec_vma = bfd_get_section_vma (abfd, section);
- *filename_ptr = (char *) p->u.syment._n._n_n._n_offset;
- maxdiff = (bfd_vma) 0 - (bfd_vma) 1;
- while (1)
- {
- combined_entry_type *p2;
-
- for (p2 = p + 1 + p->u.syment.n_numaux;
- p2 < pend;
- p2 += 1 + p2->u.syment.n_numaux)
- {
- if (p2->u.syment.n_scnum > 0
- && (section
- == coff_section_from_bfd_index (abfd,
- p2->u.syment.n_scnum)))
- break;
- if (p2->u.syment.n_sclass == C_FILE)
- {
- p2 = pend;
- break;
- }
- }
-
- /* We use <= MAXDIFF here so that if we get a zero length
- file, we actually use the next file entry. */
- if (p2 < pend
- && offset + sec_vma >= (bfd_vma) p2->u.syment.n_value
- && offset + sec_vma - (bfd_vma) p2->u.syment.n_value <= maxdiff)
- {
- *filename_ptr = (char *) p->u.syment._n._n_n._n_offset;
- maxdiff = offset + sec_vma - p2->u.syment.n_value;
- }
-
- /* Avoid endless loops on erroneous files by ensuring that
- we always move forward in the file. */
- if (p >= cof->raw_syments + p->u.syment.n_value)
- break;
-
- p = cof->raw_syments + p->u.syment.n_value;
- if (p > pend || p->u.syment.n_sclass != C_FILE)
- break;
- }
- }
-
- /* Now wander though the raw linenumbers of the section */
- /* If we have been called on this section before, and the offset we
- want is further down then we can prime the lookup loop. */
- sec_data = coff_section_data (abfd, section);
- if (sec_data != NULL
- && sec_data->i > 0
- && offset >= sec_data->offset)
- {
- i = sec_data->i;
- *functionname_ptr = sec_data->function;
- line_base = sec_data->line_base;
- }
- else
- {
- i = 0;
- line_base = 0;
- }
-
- if (section->lineno != NULL)
- {
- bfd_vma last_value = 0;
-
- l = &section->lineno[i];
-
- for (; i < section->lineno_count; i++)
- {
- if (l->line_number == 0)
- {
- /* Get the symbol this line number points at */
- coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym);
- if (coff->symbol.value > offset)
- break;
- *functionname_ptr = coff->symbol.name;
- last_value = coff->symbol.value;
- if (coff->native)
- {
- combined_entry_type *s = coff->native;
- s = s + 1 + s->u.syment.n_numaux;
-
- /* In XCOFF a debugging symbol can follow the
- function symbol. */
- if (s->u.syment.n_scnum == N_DEBUG)
- s = s + 1 + s->u.syment.n_numaux;
-
- /* S should now point to the .bf of the function. */
- if (s->u.syment.n_numaux)
- {
- /* The linenumber is stored in the auxent. */
- union internal_auxent *a = &((s + 1)->u.auxent);
- line_base = a->x_sym.x_misc.x_lnsz.x_lnno;
- *line_ptr = line_base;
- }
- }
- }
- else
- {
- if (l->u.offset > offset)
- break;
- *line_ptr = l->line_number + line_base - 1;
- }
- l++;
- }
-
- /* If we fell off the end of the loop, then assume that this
- symbol has no line number info. Otherwise, symbols with no
- line number info get reported with the line number of the
- last line of the last symbol which does have line number
- info. We use 0x100 as a slop to account for cases where the
- last line has executable code. */
- if (i >= section->lineno_count
- && last_value != 0
- && offset - last_value > 0x100)
- {
- *functionname_ptr = NULL;
- *line_ptr = 0;
- }
- }
-
- /* Cache the results for the next call. */
- if (sec_data == NULL && section->owner == abfd)
- {
- 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)
- {
- sec_data->offset = offset;
- sec_data->i = i;
- sec_data->function = *functionname_ptr;
- sec_data->line_base = line_base;
- }
-
- return TRUE;
-}
-
-int
-coff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc;
-{
- size_t size;
-
- if (! reloc)
- {
- size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
- }
- else
- {
- size = bfd_coff_filhsz (abfd);
- }
-
- size += abfd->section_count * bfd_coff_scnhsz (abfd);
- return size;
-}
-
-/* Change the class of a coff symbol held by BFD. */
-bfd_boolean
-bfd_coff_set_symbol_class (abfd, symbol, class)
- bfd * abfd;
- asymbol * symbol;
- unsigned int class;
-{
- coff_symbol_type * csym;
-
- csym = coff_symbol_from (abfd, symbol);
- if (csym == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
- else if (csym->native == NULL)
- {
- /* This is an alien symbol which no native coff backend data.
- We cheat here by creating a fake native entry for it and
- then filling in the class. This code is based on that in
- coff_write_alien_symbol(). */
-
- combined_entry_type * native;
- bfd_size_type amt = sizeof (* native);
-
- native = (combined_entry_type *) bfd_zalloc (abfd, amt);
- if (native == NULL)
- return FALSE;
-
- native->u.syment.n_type = T_NULL;
- native->u.syment.n_sclass = class;
-
- if (bfd_is_und_section (symbol->section))
- {
- native->u.syment.n_scnum = N_UNDEF;
- native->u.syment.n_value = symbol->value;
- }
- else if (bfd_is_com_section (symbol->section))
- {
- native->u.syment.n_scnum = N_UNDEF;
- native->u.syment.n_value = symbol->value;
- }
- else
- {
- native->u.syment.n_scnum =
- symbol->section->output_section->target_index;
- native->u.syment.n_value = (symbol->value
- + symbol->section->output_offset);
- if (! obj_pe (abfd))
- native->u.syment.n_value += symbol->section->output_section->vma;
-
- /* Copy the any flags from the file header into the symbol.
- FIXME: Why? */
- native->u.syment.n_flags = bfd_asymbol_bfd (& csym->symbol)->flags;
- }
-
- csym->native = native;
- }
- else
- {
- csym->native->u.syment.n_sclass = class;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/cofflink.c b/contrib/binutils/bfd/cofflink.c
deleted file mode 100644
index 4ad566c..0000000
--- a/contrib/binutils/bfd/cofflink.c
+++ /dev/null
@@ -1,3016 +0,0 @@
-/* COFF specific linker code.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file contains the COFF backend linker code. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "libcoff.h"
-#include "safe-ctype.h"
-
-static bfd_boolean coff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info);
-static bfd_boolean coff_link_check_archive_element (bfd *abfd, struct bfd_link_info *info, bfd_boolean *pneeded);
-static bfd_boolean coff_link_add_symbols (bfd *abfd, struct bfd_link_info *info);
-
-/* Return TRUE if SYM is a weak, external symbol. */
-#define IS_WEAK_EXTERNAL(abfd, sym) \
- ((sym).n_sclass == C_WEAKEXT \
- || (obj_pe (abfd) && (sym).n_sclass == C_NT_WEAK))
-
-/* Return TRUE if SYM is an external symbol. */
-#define IS_EXTERNAL(abfd, sym) \
- ((sym).n_sclass == C_EXT || IS_WEAK_EXTERNAL (abfd, sym))
-
-/* Define macros so that the ISFCN, et. al., macros work correctly.
- These macros are defined in include/coff/internal.h in terms of
- N_TMASK, etc. These definitions require a user to define local
- variables with the appropriate names, and with values from the
- coff_data (abfd) structure. */
-
-#define N_TMASK n_tmask
-#define N_BTSHFT n_btshft
-#define N_BTMASK n_btmask
-
-/* Create an entry in a COFF linker hash table. */
-
-struct bfd_hash_entry *
-_bfd_coff_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- struct coff_link_hash_entry *ret = (struct coff_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct coff_link_hash_entry *) NULL)
- ret = ((struct coff_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct coff_link_hash_entry)));
- if (ret == (struct coff_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct coff_link_hash_entry *)
- _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != (struct coff_link_hash_entry *) NULL)
- {
- /* Set local fields. */
- ret->indx = -1;
- ret->type = T_NULL;
- ret->class = C_NULL;
- ret->numaux = 0;
- ret->auxbfd = NULL;
- ret->aux = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Initialize a COFF linker hash table. */
-
-bfd_boolean
-_bfd_coff_link_hash_table_init (struct coff_link_hash_table *table,
- bfd *abfd,
- struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *))
-{
- table->stab_info = NULL;
- return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
-}
-
-/* Create a COFF linker hash table. */
-
-struct bfd_link_hash_table *
-_bfd_coff_link_hash_table_create (bfd *abfd)
-{
- struct coff_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct coff_link_hash_table);
-
- ret = bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_coff_link_hash_table_init (ret, abfd,
- _bfd_coff_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
- return &ret->root;
-}
-
-/* Create an entry in a COFF debug merge hash table. */
-
-struct bfd_hash_entry *
-_bfd_coff_debug_merge_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- struct coff_debug_merge_hash_entry *ret =
- (struct coff_debug_merge_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct coff_debug_merge_hash_entry *) NULL)
- ret = ((struct coff_debug_merge_hash_entry *)
- bfd_hash_allocate (table,
- sizeof (struct coff_debug_merge_hash_entry)));
- if (ret == (struct coff_debug_merge_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct coff_debug_merge_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
- if (ret != (struct coff_debug_merge_hash_entry *) NULL)
- {
- /* Set local fields. */
- ret->types = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Given a COFF BFD, add symbols to the global hash table as
- appropriate. */
-
-bfd_boolean
-_bfd_coff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
-{
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
- return coff_link_add_object_symbols (abfd, info);
- case bfd_archive:
- return _bfd_generic_link_add_archive_symbols
- (abfd, info, coff_link_check_archive_element);
- default:
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-}
-
-/* Add symbols from a COFF object file. */
-
-static bfd_boolean
-coff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
-{
- if (! _bfd_coff_get_external_symbols (abfd))
- return FALSE;
- if (! coff_link_add_symbols (abfd, info))
- return FALSE;
-
- if (! info->keep_memory
- && ! _bfd_coff_free_symbols (abfd))
- return FALSE;
-
- return TRUE;
-}
-
-/* Look through the symbols to see if this object file should be
- included in the link. */
-
-static bfd_boolean
-coff_link_check_ar_symbols (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean *pneeded)
-{
- bfd_size_type symesz;
- bfd_byte *esym;
- bfd_byte *esym_end;
-
- *pneeded = FALSE;
-
- symesz = bfd_coff_symesz (abfd);
- esym = (bfd_byte *) obj_coff_external_syms (abfd);
- esym_end = esym + obj_raw_syment_count (abfd) * symesz;
- while (esym < esym_end)
- {
- struct internal_syment sym;
- enum coff_symbol_classification classification;
-
- bfd_coff_swap_sym_in (abfd, esym, &sym);
-
- classification = bfd_coff_classify_symbol (abfd, &sym);
- if (classification == COFF_SYMBOL_GLOBAL
- || classification == COFF_SYMBOL_COMMON)
- {
- const char *name;
- char buf[SYMNMLEN + 1];
- struct bfd_link_hash_entry *h;
-
- /* This symbol is externally visible, and is defined by this
- object file. */
- name = _bfd_coff_internal_syment_name (abfd, &sym, buf);
- if (name == NULL)
- return FALSE;
- h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
-
- /* Auto import. */
- if (!h
- && info->pei386_auto_import
- && !strncmp (name,"__imp_", 6))
- h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE);
-
- /* We are only interested in symbols that are currently
- undefined. If a symbol is currently known to be common,
- COFF linkers do not bring in an object file which defines
- it. */
- if (h != (struct bfd_link_hash_entry *) NULL
- && h->type == bfd_link_hash_undefined)
- {
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
- }
-
- esym += (sym.n_numaux + 1) * symesz;
- }
-
- /* We do not need this object file. */
- return TRUE;
-}
-
-/* Check a single archive element to see if we need to include it in
- the link. *PNEEDED is set according to whether this element is
- needed in the link or not. This is called via
- _bfd_generic_link_add_archive_symbols. */
-
-static bfd_boolean
-coff_link_check_archive_element (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean *pneeded)
-{
- if (! _bfd_coff_get_external_symbols (abfd))
- return FALSE;
-
- if (! coff_link_check_ar_symbols (abfd, info, pneeded))
- return FALSE;
-
- if (*pneeded
- && ! coff_link_add_symbols (abfd, info))
- return FALSE;
-
- if ((! info->keep_memory || ! *pneeded)
- && ! _bfd_coff_free_symbols (abfd))
- return FALSE;
-
- return TRUE;
-}
-
-/* Add all the symbols from an object file to the hash table. */
-
-static bfd_boolean
-coff_link_add_symbols (bfd *abfd,
- struct bfd_link_info *info)
-{
- unsigned int n_tmask = coff_data (abfd)->local_n_tmask;
- unsigned int n_btshft = coff_data (abfd)->local_n_btshft;
- unsigned int n_btmask = coff_data (abfd)->local_n_btmask;
- bfd_boolean keep_syms;
- bfd_boolean default_copy;
- bfd_size_type symcount;
- struct coff_link_hash_entry **sym_hash;
- 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. */
- keep_syms = obj_coff_keep_syms (abfd);
- obj_coff_keep_syms (abfd) = TRUE;
-
- if (info->keep_memory)
- default_copy = FALSE;
- else
- default_copy = TRUE;
-
- symcount = obj_raw_syment_count (abfd);
-
- /* We keep a list of the linker hash table entries that correspond
- to particular symbols. */
- amt = symcount * sizeof (struct coff_link_hash_entry *);
- sym_hash = bfd_zalloc (abfd, amt);
- if (sym_hash == NULL && symcount != 0)
- goto error_return;
- obj_coff_sym_hashes (abfd) = sym_hash;
-
- symesz = bfd_coff_symesz (abfd);
- BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));
- esym = (bfd_byte *) obj_coff_external_syms (abfd);
- esym_end = esym + symcount * symesz;
- while (esym < esym_end)
- {
- struct internal_syment sym;
- enum coff_symbol_classification classification;
- bfd_boolean copy;
-
- bfd_coff_swap_sym_in (abfd, esym, &sym);
-
- classification = bfd_coff_classify_symbol (abfd, &sym);
- if (classification != COFF_SYMBOL_LOCAL)
- {
- const char *name;
- char buf[SYMNMLEN + 1];
- flagword flags;
- asection *section;
- bfd_vma value;
- bfd_boolean addit;
-
- /* This symbol is externally visible. */
-
- name = _bfd_coff_internal_syment_name (abfd, &sym, buf);
- if (name == NULL)
- goto error_return;
-
- /* We must copy the name into memory if we got it from the
- syment itself, rather than the string table. */
- copy = default_copy;
- if (sym._n._n_n._n_zeroes != 0
- || sym._n._n_n._n_offset == 0)
- copy = TRUE;
-
- value = sym.n_value;
-
- switch (classification)
- {
- default:
- abort ();
-
- case COFF_SYMBOL_GLOBAL:
- flags = BSF_EXPORT | BSF_GLOBAL;
- section = coff_section_from_bfd_index (abfd, sym.n_scnum);
- if (! obj_pe (abfd))
- value -= section->vma;
- break;
-
- case COFF_SYMBOL_UNDEFINED:
- flags = 0;
- section = bfd_und_section_ptr;
- break;
-
- case COFF_SYMBOL_COMMON:
- flags = BSF_GLOBAL;
- section = bfd_com_section_ptr;
- break;
-
- case COFF_SYMBOL_PE_SECTION:
- flags = BSF_SECTION_SYM | BSF_GLOBAL;
- section = coff_section_from_bfd_index (abfd, sym.n_scnum);
- break;
- }
-
- if (IS_WEAK_EXTERNAL (abfd, sym))
- flags = BSF_WEAK;
-
- addit = TRUE;
-
- /* In the PE format, section symbols actually refer to the
- start of the output section. We handle them specially
- here. */
- if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
- {
- *sym_hash = coff_link_hash_lookup (coff_hash_table (info),
- name, FALSE, copy, FALSE);
- if (*sym_hash != NULL)
- {
- if (((*sym_hash)->coff_link_hash_flags
- & COFF_LINK_HASH_PE_SECTION_SYMBOL) == 0
- && (*sym_hash)->root.type != bfd_link_hash_undefined
- && (*sym_hash)->root.type != bfd_link_hash_undefweak)
- (*_bfd_error_handler)
- ("Warning: symbol `%s' is both section and non-section",
- name);
-
- addit = FALSE;
- }
- }
-
- /* The Microsoft Visual C compiler does string pooling by
- hashing the constants to an internal symbol name, and
- relying on the linker comdat support to discard
- duplicate names. However, if one string is a literal and
- one is a data initializer, one will end up in the .data
- section and one will end up in the .rdata section. The
- Microsoft linker will combine them into the .data
- section, which seems to be wrong since it might cause the
- literal to change.
-
- As long as there are no external references to the
- symbols, which there shouldn't be, we can treat the .data
- and .rdata instances as separate symbols. The comdat
- code in the linker will do the appropriate merging. Here
- we avoid getting a multiple definition error for one of
- these special symbols.
-
- FIXME: I don't think this will work in the case where
- there are two object files which use the constants as a
- literal and two object files which use it as a data
- initializer. One or the other of the second object files
- is going to wind up with an inappropriate reference. */
- if (obj_pe (abfd)
- && (classification == COFF_SYMBOL_GLOBAL
- || classification == COFF_SYMBOL_PE_SECTION)
- && section->comdat != NULL
- && strncmp (name, "??_", 3) == 0
- && strcmp (name, section->comdat->name) == 0)
- {
- if (*sym_hash == NULL)
- *sym_hash = coff_link_hash_lookup (coff_hash_table (info),
- name, FALSE, copy, FALSE);
- if (*sym_hash != NULL
- && (*sym_hash)->root.type == bfd_link_hash_defined
- && (*sym_hash)->root.u.def.section->comdat != NULL
- && strcmp ((*sym_hash)->root.u.def.section->comdat->name,
- section->comdat->name) == 0)
- addit = FALSE;
- }
-
- if (addit)
- {
- if (! (bfd_coff_link_add_one_symbol
- (info, abfd, name, flags, section, value,
- (const char *) NULL, copy, FALSE,
- (struct bfd_link_hash_entry **) sym_hash)))
- goto error_return;
- }
-
- if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
- (*sym_hash)->coff_link_hash_flags |=
- COFF_LINK_HASH_PE_SECTION_SYMBOL;
-
- /* Limit the alignment of a common symbol to the possible
- alignment of a section. There is no point to permitting
- a higher alignment for a common symbol: we can not
- guarantee it, and it may cause us to allocate extra space
- in the common section. */
- if (section == bfd_com_section_ptr
- && (*sym_hash)->root.type == bfd_link_hash_common
- && ((*sym_hash)->root.u.c.p->alignment_power
- > bfd_coff_default_section_alignment_power (abfd)))
- (*sym_hash)->root.u.c.p->alignment_power
- = bfd_coff_default_section_alignment_power (abfd);
-
- if (info->hash->creator->flavour == bfd_get_flavour (abfd))
- {
- /* If we don't have any symbol information currently in
- the hash table, or if we are looking at a symbol
- definition, then update the symbol class and type in
- the hash table. */
- if (((*sym_hash)->class == C_NULL
- && (*sym_hash)->type == T_NULL)
- || sym.n_scnum != 0
- || (sym.n_value != 0
- && (*sym_hash)->root.type != bfd_link_hash_defined
- && (*sym_hash)->root.type != bfd_link_hash_defweak))
- {
- (*sym_hash)->class = sym.n_sclass;
- if (sym.n_type != T_NULL)
- {
- /* We want to warn if the type changed, but not
- if it changed from an unspecified type.
- Testing the whole type byte may work, but the
- change from (e.g.) a function of unspecified
- type to function of known type also wants to
- skip the warning. */
- if ((*sym_hash)->type != T_NULL
- && (*sym_hash)->type != sym.n_type
- && !(DTYPE ((*sym_hash)->type) == DTYPE (sym.n_type)
- && (BTYPE ((*sym_hash)->type) == T_NULL
- || BTYPE (sym.n_type) == T_NULL)))
- (*_bfd_error_handler)
- (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
- name, (*sym_hash)->type, sym.n_type,
- bfd_archive_filename (abfd));
-
- /* We don't want to change from a meaningful
- base type to a null one, but if we know
- nothing, take what little we might now know. */
- if (BTYPE (sym.n_type) != T_NULL
- || (*sym_hash)->type == T_NULL)
- (*sym_hash)->type = sym.n_type;
- }
- (*sym_hash)->auxbfd = abfd;
- if (sym.n_numaux != 0)
- {
- union internal_auxent *alloc;
- unsigned int i;
- bfd_byte *eaux;
- union internal_auxent *iaux;
-
- (*sym_hash)->numaux = sym.n_numaux;
- alloc = ((union internal_auxent *)
- bfd_hash_allocate (&info->hash->table,
- (sym.n_numaux
- * sizeof (*alloc))));
- if (alloc == NULL)
- goto error_return;
- for (i = 0, eaux = esym + symesz, iaux = alloc;
- i < sym.n_numaux;
- i++, eaux += symesz, iaux++)
- bfd_coff_swap_aux_in (abfd, eaux, sym.n_type,
- sym.n_sclass, (int) i,
- sym.n_numaux, iaux);
- (*sym_hash)->aux = alloc;
- }
- }
- }
-
- if (classification == COFF_SYMBOL_PE_SECTION
- && (*sym_hash)->numaux != 0)
- {
- /* Some PE sections (such as .bss) have a zero size in
- the section header, but a non-zero size in the AUX
- record. Correct that here.
-
- FIXME: This is not at all the right place to do this.
- For example, it won't help objdump. This needs to be
- done when we swap in the section header. */
- BFD_ASSERT ((*sym_hash)->numaux == 1);
- if (section->_raw_size == 0)
- section->_raw_size = (*sym_hash)->aux[0].x_scn.x_scnlen;
-
- /* FIXME: We could test whether the section sizes
- matches the size in the aux entry, but apparently
- that sometimes fails unexpectedly. */
- }
- }
-
- esym += (sym.n_numaux + 1) * symesz;
- sym_hash += sym.n_numaux + 1;
- }
-
- /* If this is a non-traditional, non-relocatable link, try to
- optimize the handling of any .stab/.stabstr sections. */
- if (! info->relocatable
- && ! info->traditional_format
- && info->hash->creator->flavour == bfd_get_flavour (abfd)
- && (info->strip != strip_all && info->strip != strip_debugger))
- {
- asection *stabstr;
-
- stabstr = bfd_get_section_by_name (abfd, ".stabstr");
-
- if (stabstr != NULL)
- {
- bfd_size_type string_offset = 0;
- asection *stab;
-
- for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
- && (!stab->name[5]
- || (stab->name[5] == '.' && ISDIGIT (stab->name[6]))))
- {
- struct coff_link_hash_table *table;
- struct coff_section_tdata *secdata
- = coff_section_data (abfd, stab);
-
- if (secdata == NULL)
- {
- amt = sizeof (struct coff_section_tdata);
- stab->used_by_bfd = bfd_zalloc (abfd, amt);
- if (stab->used_by_bfd == NULL)
- goto error_return;
- secdata = coff_section_data (abfd, stab);
- }
-
- table = coff_hash_table (info);
-
- if (! _bfd_link_section_stabs (abfd, &table->stab_info,
- stab, stabstr,
- &secdata->stab_info,
- &string_offset))
- goto error_return;
- }
- }
- }
-
- obj_coff_keep_syms (abfd) = keep_syms;
-
- return TRUE;
-
- error_return:
- obj_coff_keep_syms (abfd) = keep_syms;
- return FALSE;
-}
-
-/* Do the final link step. */
-
-bfd_boolean
-_bfd_coff_final_link (bfd *abfd,
- struct bfd_link_info *info)
-{
- bfd_size_type symesz;
- struct coff_final_link_info finfo;
- bfd_boolean debug_merge_allocated;
- bfd_boolean long_section_names;
- asection *o;
- struct bfd_link_order *p;
- 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;
- unsigned int linesz;
- bfd *sub;
- bfd_byte *external_relocs = NULL;
- char strbuf[STRING_SIZE_SIZE];
- bfd_size_type amt;
-
- symesz = bfd_coff_symesz (abfd);
-
- finfo.info = info;
- finfo.output_bfd = abfd;
- finfo.strtab = NULL;
- finfo.section_info = NULL;
- finfo.last_file_index = -1;
- finfo.last_bf_index = -1;
- finfo.internal_syms = NULL;
- finfo.sec_ptrs = NULL;
- finfo.sym_indices = NULL;
- finfo.outsyms = NULL;
- finfo.linenos = NULL;
- finfo.contents = NULL;
- finfo.external_relocs = NULL;
- finfo.internal_relocs = NULL;
- finfo.global_to_static = FALSE;
- debug_merge_allocated = FALSE;
-
- coff_data (abfd)->link_info = info;
-
- finfo.strtab = _bfd_stringtab_init ();
- if (finfo.strtab == NULL)
- goto error_return;
-
- if (! coff_debug_merge_hash_table_init (&finfo.debug_merge))
- goto error_return;
- debug_merge_allocated = TRUE;
-
- /* Compute the file positions for all the sections. */
- if (! abfd->output_has_begun)
- {
- if (! bfd_coff_compute_section_file_positions (abfd))
- goto error_return;
- }
-
- /* Count the line numbers and relocation entries required for the
- output file. Set the file positions for the relocs. */
- rel_filepos = obj_relocbase (abfd);
- relsz = bfd_coff_relsz (abfd);
- max_contents_size = 0;
- max_lineno_count = 0;
- max_reloc_count = 0;
-
- long_section_names = FALSE;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- o->reloc_count = 0;
- o->lineno_count = 0;
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order)
- {
- asection *sec;
-
- sec = p->u.indirect.section;
-
- /* Mark all sections which are to be included in the
- link. This will normally be every section. We need
- to do this so that we can identify any sections which
- the linker has decided to not include. */
- sec->linker_mark = TRUE;
-
- if (info->strip == strip_none
- || info->strip == strip_some)
- o->lineno_count += sec->lineno_count;
-
- if (info->relocatable)
- o->reloc_count += sec->reloc_count;
-
- if (sec->_raw_size > max_contents_size)
- max_contents_size = sec->_raw_size;
- if (sec->lineno_count > max_lineno_count)
- max_lineno_count = sec->lineno_count;
- if (sec->reloc_count > max_reloc_count)
- max_reloc_count = sec->reloc_count;
- }
- else if (info->relocatable
- && (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order))
- ++o->reloc_count;
- }
- if (o->reloc_count == 0)
- o->rel_filepos = 0;
- else
- {
- o->flags |= SEC_RELOC;
- o->rel_filepos = rel_filepos;
- rel_filepos += o->reloc_count * relsz;
- /* In PE COFF, if there are at least 0xffff relocations an
- extra relocation will be written out to encode the count. */
- if (obj_pe (abfd) && o->reloc_count >= 0xffff)
- rel_filepos += relsz;
- }
-
- if (bfd_coff_long_section_names (abfd)
- && strlen (o->name) > SCNNMLEN)
- {
- /* This section has a long name which must go in the string
- table. This must correspond to the code in
- coff_write_object_contents which puts the string index
- into the s_name field of the section header. That is why
- we pass hash as FALSE. */
- if (_bfd_stringtab_add (finfo.strtab, o->name, FALSE, FALSE)
- == (bfd_size_type) -1)
- goto error_return;
- long_section_names = TRUE;
- }
- }
-
- /* If doing a relocatable link, allocate space for the pointers we
- need to keep. */
- if (info->relocatable)
- {
- unsigned int i;
-
- /* We use section_count + 1, rather than section_count, because
- the target_index fields are 1 based. */
- amt = abfd->section_count + 1;
- amt *= sizeof (struct coff_link_section_info);
- finfo.section_info = bfd_malloc (amt);
- if (finfo.section_info == NULL)
- goto error_return;
- for (i = 0; i <= abfd->section_count; i++)
- {
- finfo.section_info[i].relocs = NULL;
- finfo.section_info[i].rel_hashes = NULL;
- }
- }
-
- /* We now know the size of the relocs, so we can determine the file
- positions of the line numbers. */
- line_filepos = rel_filepos;
- linesz = bfd_coff_linesz (abfd);
- max_output_reloc_count = 0;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (o->lineno_count == 0)
- o->line_filepos = 0;
- else
- {
- o->line_filepos = line_filepos;
- line_filepos += o->lineno_count * linesz;
- }
-
- if (o->reloc_count != 0)
- {
- /* We don't know the indices of global symbols until we have
- written out all the local symbols. For each section in
- the output file, we keep an array of pointers to hash
- table entries. Each entry in the array corresponds to a
- reloc. When we find a reloc against a global symbol, we
- set the corresponding entry in this array so that we can
- fix up the symbol index after we have written out all the
- local symbols.
-
- Because of this problem, we also keep the relocs in
- memory until the end of the link. This wastes memory,
- but only when doing a relocatable link, which is not the
- common case. */
- BFD_ASSERT (info->relocatable);
- amt = o->reloc_count;
- amt *= sizeof (struct internal_reloc);
- finfo.section_info[o->target_index].relocs = bfd_malloc (amt);
- amt = o->reloc_count;
- amt *= sizeof (struct coff_link_hash_entry *);
- finfo.section_info[o->target_index].rel_hashes = bfd_malloc (amt);
- if (finfo.section_info[o->target_index].relocs == NULL
- || finfo.section_info[o->target_index].rel_hashes == NULL)
- goto error_return;
-
- if (o->reloc_count > max_output_reloc_count)
- max_output_reloc_count = o->reloc_count;
- }
-
- /* Reset the reloc and lineno counts, so that we can use them to
- count the number of entries we have output so far. */
- o->reloc_count = 0;
- o->lineno_count = 0;
- }
-
- obj_sym_filepos (abfd) = line_filepos;
-
- /* Figure out the largest number of symbols in an input BFD. Take
- the opportunity to clear the output_has_begun fields of all the
- input BFD's. */
- max_sym_count = 0;
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- size_t sz;
-
- sub->output_has_begun = FALSE;
- sz = obj_raw_syment_count (sub);
- if (sz > max_sym_count)
- max_sym_count = sz;
- }
-
- /* Allocate some buffers used while linking. */
- amt = max_sym_count * sizeof (struct internal_syment);
- finfo.internal_syms = bfd_malloc (amt);
- amt = max_sym_count * sizeof (asection *);
- finfo.sec_ptrs = bfd_malloc (amt);
- amt = max_sym_count * sizeof (long);
- finfo.sym_indices = bfd_malloc (amt);
- finfo.outsyms = bfd_malloc ((max_sym_count + 1) * symesz);
- amt = max_lineno_count * bfd_coff_linesz (abfd);
- finfo.linenos = bfd_malloc (amt);
- finfo.contents = bfd_malloc (max_contents_size);
- amt = max_reloc_count * relsz;
- finfo.external_relocs = bfd_malloc (amt);
- if (! info->relocatable)
- {
- amt = max_reloc_count * sizeof (struct internal_reloc);
- finfo.internal_relocs = 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)
- || finfo.outsyms == NULL
- || (finfo.linenos == NULL && max_lineno_count > 0)
- || (finfo.contents == NULL && max_contents_size > 0)
- || (finfo.external_relocs == NULL && max_reloc_count > 0)
- || (! info->relocatable
- && finfo.internal_relocs == NULL
- && max_reloc_count > 0))
- goto error_return;
-
- /* We now know the position of everything in the file, except that
- we don't know the size of the symbol table and therefore we don't
- know where the string table starts. We just build the string
- table in memory as we go along. We process all the relocations
- for a single input file at once. */
- obj_raw_syment_count (abfd) = 0;
-
- if (coff_backend_info (abfd)->_bfd_coff_start_final_link)
- {
- if (! bfd_coff_start_final_link (abfd, info))
- goto error_return;
- }
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order
- && bfd_family_coff (p->u.indirect.section->owner))
- {
- sub = p->u.indirect.section->owner;
- if (! bfd_coff_link_output_has_begun (sub, & finfo))
- {
- if (! _bfd_coff_link_input_bfd (&finfo, sub))
- goto error_return;
- sub->output_has_begun = TRUE;
- }
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- if (! _bfd_coff_reloc_link_order (abfd, &finfo, o, p))
- goto error_return;
- }
- else
- {
- if (! _bfd_default_link_order (abfd, info, o, p))
- goto error_return;
- }
- }
- }
-
- if (! bfd_coff_final_link_postscript (abfd, & finfo))
- goto error_return;
-
- /* Free up the buffers used by _bfd_coff_link_input_bfd. */
-
- coff_debug_merge_hash_table_free (&finfo.debug_merge);
- debug_merge_allocated = FALSE;
-
- if (finfo.internal_syms != NULL)
- {
- free (finfo.internal_syms);
- finfo.internal_syms = NULL;
- }
- if (finfo.sec_ptrs != NULL)
- {
- free (finfo.sec_ptrs);
- finfo.sec_ptrs = NULL;
- }
- if (finfo.sym_indices != NULL)
- {
- free (finfo.sym_indices);
- finfo.sym_indices = NULL;
- }
- if (finfo.linenos != NULL)
- {
- free (finfo.linenos);
- finfo.linenos = NULL;
- }
- if (finfo.contents != NULL)
- {
- free (finfo.contents);
- finfo.contents = NULL;
- }
- if (finfo.external_relocs != NULL)
- {
- free (finfo.external_relocs);
- finfo.external_relocs = NULL;
- }
- if (finfo.internal_relocs != NULL)
- {
- free (finfo.internal_relocs);
- finfo.internal_relocs = NULL;
- }
-
- /* The value of the last C_FILE symbol is supposed to be the symbol
- index of the first external symbol. Write it out again if
- necessary. */
- 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, &finfo.last_file,
- finfo.outsyms);
-
- pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
- return FALSE;
- }
-
- /* If doing task linking (ld --task-link) then make a pass through the
- global symbols, writing out any that are defined, and making them
- static. */
- if (info->task_link)
- {
- finfo.failed = FALSE;
- coff_link_hash_traverse (coff_hash_table (info),
- _bfd_coff_write_task_globals, &finfo);
- if (finfo.failed)
- goto error_return;
- }
-
- /* Write out the global symbols. */
- finfo.failed = FALSE;
- coff_link_hash_traverse (coff_hash_table (info),
- _bfd_coff_write_global_sym, &finfo);
- if (finfo.failed)
- goto error_return;
-
- /* The outsyms buffer is used by _bfd_coff_write_global_sym. */
- if (finfo.outsyms != NULL)
- {
- free (finfo.outsyms);
- finfo.outsyms = NULL;
- }
-
- if (info->relocatable && max_output_reloc_count > 0)
- {
- /* 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. */
- amt = max_output_reloc_count * relsz;
- external_relocs = bfd_malloc (amt);
- if (external_relocs == NULL)
- goto error_return;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct internal_reloc *irel;
- struct internal_reloc *irelend;
- struct coff_link_hash_entry **rel_hash;
- bfd_byte *erel;
-
- if (o->reloc_count == 0)
- continue;
-
- irel = finfo.section_info[o->target_index].relocs;
- irelend = irel + o->reloc_count;
- rel_hash = finfo.section_info[o->target_index].rel_hashes;
- erel = external_relocs;
- for (; irel < irelend; irel++, rel_hash++, erel += relsz)
- {
- if (*rel_hash != NULL)
- {
- BFD_ASSERT ((*rel_hash)->indx >= 0);
- irel->r_symndx = (*rel_hash)->indx;
- }
- bfd_coff_swap_reloc_out (abfd, irel, erel);
- }
-
- if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0)
- goto error_return;
- if (obj_pe (abfd) && o->reloc_count >= 0xffff)
- {
- /* In PE COFF, write the count of relocs as the first
- reloc. The header overflow bit will be set
- elsewhere. */
- struct internal_reloc incount;
- bfd_byte *excount = (bfd_byte *)bfd_malloc (relsz);
-
- memset (&incount, 0, sizeof (incount));
- incount.r_vaddr = o->reloc_count + 1;
- bfd_coff_swap_reloc_out (abfd, (PTR) &incount, (PTR) excount);
- if (bfd_bwrite (excount, relsz, abfd) != relsz)
- /* We'll leak, but it's an error anyway. */
- goto error_return;
- free (excount);
- }
- if (bfd_bwrite (external_relocs,
- (bfd_size_type) relsz * o->reloc_count, abfd)
- != (bfd_size_type) relsz * o->reloc_count)
- goto error_return;
- }
-
- free (external_relocs);
- external_relocs = NULL;
- }
-
- /* Free up the section information. */
- if (finfo.section_info != NULL)
- {
- unsigned int i;
-
- for (i = 0; i < abfd->section_count; i++)
- {
- if (finfo.section_info[i].relocs != NULL)
- free (finfo.section_info[i].relocs);
- if (finfo.section_info[i].rel_hashes != NULL)
- free (finfo.section_info[i].rel_hashes);
- }
- free (finfo.section_info);
- finfo.section_info = NULL;
- }
-
- /* If we have optimized stabs strings, output them. */
- if (coff_hash_table (info)->stab_info != NULL)
- {
- if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
- return FALSE;
- }
-
- /* Write out the string table. */
- if (obj_raw_syment_count (abfd) != 0 || long_section_names)
- {
- 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
- H_PUT_32 (abfd,
- _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
- strbuf);
-#else
- #error Change H_PUT_32 above
-#endif
-
- if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
- != STRING_SIZE_SIZE)
- return FALSE;
-
- if (! _bfd_stringtab_emit (abfd, finfo.strtab))
- return FALSE;
-
- obj_coff_strings_written (abfd) = TRUE;
- }
-
- _bfd_stringtab_free (finfo.strtab);
-
- /* Setting bfd_get_symcount to 0 will cause write_object_contents to
- not try to write out the symbols. */
- bfd_get_symcount (abfd) = 0;
-
- return TRUE;
-
- error_return:
- if (debug_merge_allocated)
- coff_debug_merge_hash_table_free (&finfo.debug_merge);
- if (finfo.strtab != NULL)
- _bfd_stringtab_free (finfo.strtab);
- if (finfo.section_info != NULL)
- {
- unsigned int i;
-
- for (i = 0; i < abfd->section_count; i++)
- {
- if (finfo.section_info[i].relocs != NULL)
- free (finfo.section_info[i].relocs);
- if (finfo.section_info[i].rel_hashes != NULL)
- free (finfo.section_info[i].rel_hashes);
- }
- free (finfo.section_info);
- }
- if (finfo.internal_syms != NULL)
- free (finfo.internal_syms);
- if (finfo.sec_ptrs != NULL)
- free (finfo.sec_ptrs);
- if (finfo.sym_indices != NULL)
- free (finfo.sym_indices);
- if (finfo.outsyms != NULL)
- free (finfo.outsyms);
- if (finfo.linenos != NULL)
- free (finfo.linenos);
- if (finfo.contents != NULL)
- free (finfo.contents);
- if (finfo.external_relocs != NULL)
- free (finfo.external_relocs);
- if (finfo.internal_relocs != NULL)
- free (finfo.internal_relocs);
- if (external_relocs != NULL)
- free (external_relocs);
- return FALSE;
-}
-
-/* Parse out a -heap <reserved>,<commit> line. */
-
-static char *
-dores_com (char *ptr, bfd *output_bfd, int heap)
-{
- if (coff_data(output_bfd)->pe)
- {
- int val = strtoul (ptr, &ptr, 0);
-
- if (heap)
- pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve = val;
- else
- pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve = val;
-
- if (ptr[0] == ',')
- {
- val = strtoul (ptr+1, &ptr, 0);
- if (heap)
- pe_data(output_bfd)->pe_opthdr.SizeOfHeapCommit = val;
- else
- pe_data(output_bfd)->pe_opthdr.SizeOfStackCommit = val;
- }
- }
- return ptr;
-}
-
-static char *
-get_name (char *ptr, char **dst)
-{
- while (*ptr == ' ')
- ptr++;
- *dst = ptr;
- while (*ptr && *ptr != ' ')
- ptr++;
- *ptr = 0;
- return ptr+1;
-}
-
-/* Process any magic embedded commands in a section called .drectve. */
-
-static int
-process_embedded_commands (bfd *output_bfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- bfd *abfd)
-{
- asection *sec = bfd_get_section_by_name (abfd, ".drectve");
- char *s;
- char *e;
- char *copy;
-
- if (!sec)
- return 1;
-
- copy = bfd_malloc (sec->_raw_size);
- if (!copy)
- return 0;
-
- if (! bfd_get_section_contents (abfd, sec, copy, (bfd_vma) 0, sec->_raw_size))
- {
- free (copy);
- return 0;
- }
- e = copy + sec->_raw_size;
-
- for (s = copy; s < e ; )
- {
- if (s[0]!= '-')
- {
- s++;
- continue;
- }
- if (strncmp (s,"-attr", 5) == 0)
- {
- char *name;
- char *attribs;
- asection *asec;
- int loop = 1;
- int had_write = 0;
- int had_read = 0;
- int had_exec= 0;
- int had_shared= 0;
-
- s += 5;
- s = get_name (s, &name);
- s = get_name (s, &attribs);
-
- while (loop)
- {
- switch (*attribs++)
- {
- case 'W':
- had_write = 1;
- break;
- case 'R':
- had_read = 1;
- break;
- case 'S':
- had_shared = 1;
- break;
- case 'X':
- had_exec = 1;
- break;
- default:
- loop = 0;
- }
- }
- asec = bfd_get_section_by_name (abfd, name);
- if (asec)
- {
- if (had_exec)
- asec->flags |= SEC_CODE;
- if (!had_write)
- asec->flags |= SEC_READONLY;
- }
- }
- else if (strncmp (s,"-heap", 5) == 0)
- s = dores_com (s+5, output_bfd, 1);
-
- else if (strncmp (s,"-stack", 6) == 0)
- s = dores_com (s+6, output_bfd, 0);
-
- else
- s++;
- }
- free (copy);
- return 1;
-}
-
-/* Place a marker against all symbols which are used by relocations.
- This marker can be picked up by the 'do we skip this symbol ?'
- loop in _bfd_coff_link_input_bfd() and used to prevent skipping
- that symbol. */
-
-static void
-mark_relocs (struct coff_final_link_info *finfo, bfd *input_bfd)
-{
- asection * a;
-
- if ((bfd_get_file_flags (input_bfd) & HAS_SYMS) == 0)
- return;
-
- for (a = input_bfd->sections; a != (asection *) NULL; a = a->next)
- {
- struct internal_reloc * internal_relocs;
- struct internal_reloc * irel;
- struct internal_reloc * irelend;
-
- if ((a->flags & SEC_RELOC) == 0 || a->reloc_count < 1)
- continue;
- /* Don't mark relocs in excluded sections. */
- if (a->output_section == bfd_abs_section_ptr)
- continue;
-
- /* Read in the relocs. */
- internal_relocs = _bfd_coff_read_internal_relocs
- (input_bfd, a, FALSE,
- finfo->external_relocs,
- finfo->info->relocatable,
- (finfo->info->relocatable
- ? (finfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count)
- : finfo->internal_relocs)
- );
-
- if (internal_relocs == NULL)
- continue;
-
- irel = internal_relocs;
- irelend = irel + a->reloc_count;
-
- /* Place a mark in the sym_indices array (whose entries have
- been initialised to 0) for all of the symbols that are used
- in the relocation table. This will then be picked up in the
- skip/don't-skip pass. */
- for (; irel < irelend; irel++)
- finfo->sym_indices[ irel->r_symndx ] = -1;
- }
-}
-
-/* Link an input file into the linker output file. This function
- handles all the sections and relocations of the input file at once. */
-
-bfd_boolean
-_bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
-{
- unsigned int n_tmask = coff_data (input_bfd)->local_n_tmask;
- unsigned int n_btshft = coff_data (input_bfd)->local_n_btshft;
-#if 0
- unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask;
-#endif
- bfd_boolean (*adjust_symndx)
- (bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, bfd_boolean *);
- bfd *output_bfd;
- const char *strings;
- bfd_size_type syment_base;
- bfd_boolean copy, hash;
- bfd_size_type isymesz;
- bfd_size_type osymesz;
- bfd_size_type linesz;
- bfd_byte *esym;
- bfd_byte *esym_end;
- struct internal_syment *isymp;
- asection **secpp;
- long *indexp;
- unsigned long output_index;
- bfd_byte *outsym;
- struct coff_link_hash_entry **sym_hash;
- asection *o;
-
- /* Move all the symbols to the output file. */
-
- output_bfd = finfo->output_bfd;
- strings = NULL;
- syment_base = obj_raw_syment_count (output_bfd);
- isymesz = bfd_coff_symesz (input_bfd);
- osymesz = bfd_coff_symesz (output_bfd);
- linesz = bfd_coff_linesz (input_bfd);
- BFD_ASSERT (linesz == bfd_coff_linesz (output_bfd));
-
- copy = FALSE;
- if (! finfo->info->keep_memory)
- copy = TRUE;
- hash = TRUE;
- if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = FALSE;
-
- if (! _bfd_coff_get_external_symbols (input_bfd))
- return FALSE;
-
- esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
- esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
- isymp = finfo->internal_syms;
- secpp = finfo->sec_ptrs;
- indexp = finfo->sym_indices;
- output_index = syment_base;
- outsym = finfo->outsyms;
-
- if (coff_data (output_bfd)->pe
- && ! process_embedded_commands (output_bfd, finfo->info, input_bfd))
- return FALSE;
-
- /* If we are going to perform relocations and also strip/discard some
- symbols then we must make sure that we do not strip/discard those
- symbols that are going to be involved in the relocations. */
- if (( finfo->info->strip != strip_none
- || finfo->info->discard != discard_none)
- && finfo->info->relocatable)
- {
- /* Mark the symbol array as 'not-used'. */
- memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
-
- mark_relocs (finfo, input_bfd);
- }
-
- while (esym < esym_end)
- {
- struct internal_syment isym;
- enum coff_symbol_classification classification;
- bfd_boolean skip;
- bfd_boolean global;
- bfd_boolean dont_skip_symbol;
- int add;
-
- bfd_coff_swap_sym_in (input_bfd, esym, isymp);
-
- /* Make a copy of *isymp so that the relocate_section function
- always sees the original values. This is more reliable than
- always recomputing the symbol value even if we are stripping
- the symbol. */
- isym = *isymp;
-
- classification = bfd_coff_classify_symbol (input_bfd, &isym);
- switch (classification)
- {
- default:
- abort ();
- case COFF_SYMBOL_GLOBAL:
- case COFF_SYMBOL_PE_SECTION:
- case COFF_SYMBOL_LOCAL:
- *secpp = coff_section_from_bfd_index (input_bfd, isym.n_scnum);
- break;
- case COFF_SYMBOL_COMMON:
- *secpp = bfd_com_section_ptr;
- break;
- case COFF_SYMBOL_UNDEFINED:
- *secpp = bfd_und_section_ptr;
- break;
- }
-
- /* Extract the flag indicating if this symbol is used by a
- relocation. */
- if ((finfo->info->strip != strip_none
- || finfo->info->discard != discard_none)
- && finfo->info->relocatable)
- dont_skip_symbol = *indexp;
- else
- dont_skip_symbol = FALSE;
-
- *indexp = -1;
-
- skip = FALSE;
- global = FALSE;
- add = 1 + isym.n_numaux;
-
- /* If we are stripping all symbols, we want to skip this one. */
- if (finfo->info->strip == strip_all && ! dont_skip_symbol)
- skip = TRUE;
-
- if (! skip)
- {
- switch (classification)
- {
- default:
- abort ();
- case COFF_SYMBOL_GLOBAL:
- case COFF_SYMBOL_COMMON:
- case COFF_SYMBOL_PE_SECTION:
- /* This is a global symbol. Global symbols come at the
- end of the symbol table, so skip them for now.
- Locally defined function symbols, however, are an
- exception, and are not moved to the end. */
- global = TRUE;
- if (! ISFCN (isym.n_type))
- skip = TRUE;
- break;
-
- case COFF_SYMBOL_UNDEFINED:
- /* Undefined symbols are left for the end. */
- global = TRUE;
- skip = TRUE;
- break;
-
- case COFF_SYMBOL_LOCAL:
- /* This is a local symbol. Skip it if we are discarding
- local symbols. */
- if (finfo->info->discard == discard_all && ! dont_skip_symbol)
- skip = TRUE;
- break;
- }
- }
-
-#ifndef COFF_WITH_PE
- /* Skip section symbols for sections which are not going to be
- emitted. */
- if (!skip
- && dont_skip_symbol == 0
- && isym.n_sclass == C_STAT
- && isym.n_type == T_NULL
- && isym.n_numaux > 0
- && (*secpp)->output_section == bfd_abs_section_ptr)
- skip = TRUE;
-#endif
-
- /* If we stripping debugging symbols, and this is a debugging
- symbol, then skip it. FIXME: gas sets the section to N_ABS
- for some types of debugging symbols; I don't know if this is
- a bug or not. In any case, we handle it here. */
- if (! skip
- && finfo->info->strip == strip_debugger
- && ! dont_skip_symbol
- && (isym.n_scnum == N_DEBUG
- || (isym.n_scnum == N_ABS
- && (isym.n_sclass == C_AUTO
- || isym.n_sclass == C_REG
- || isym.n_sclass == C_MOS
- || isym.n_sclass == C_MOE
- || isym.n_sclass == C_MOU
- || isym.n_sclass == C_ARG
- || isym.n_sclass == C_REGPARM
- || isym.n_sclass == C_FIELD
- || isym.n_sclass == C_EOS))))
- skip = TRUE;
-
- /* If some symbols are stripped based on the name, work out the
- name and decide whether to skip this symbol. */
- if (! skip
- && (finfo->info->strip == strip_some
- || finfo->info->discard == discard_l))
- {
- const char *name;
- char buf[SYMNMLEN + 1];
-
- name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
- if (name == NULL)
- return FALSE;
-
- if (! dont_skip_symbol
- && ((finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE,
- FALSE) == NULL))
- || (! global
- && finfo->info->discard == discard_l
- && bfd_is_local_label_name (input_bfd, name))))
- skip = TRUE;
- }
-
- /* If this is an enum, struct, or union tag, see if we have
- already output an identical type. */
- if (! skip
- && (finfo->output_bfd->flags & BFD_TRADITIONAL_FORMAT) == 0
- && (isym.n_sclass == C_ENTAG
- || isym.n_sclass == C_STRTAG
- || isym.n_sclass == C_UNTAG)
- && isym.n_numaux == 1)
- {
- const char *name;
- char buf[SYMNMLEN + 1];
- struct coff_debug_merge_hash_entry *mh;
- struct coff_debug_merge_type *mt;
- union internal_auxent aux;
- 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)
- return FALSE;
-
- /* Ignore fake names invented by compiler; treat them all as
- the same name. */
- if (*name == '~' || *name == '.' || *name == '$'
- || (*name == bfd_get_symbol_leading_char (input_bfd)
- && (name[1] == '~' || name[1] == '.' || name[1] == '$')))
- name = "";
-
- mh = coff_debug_merge_hash_lookup (&finfo->debug_merge, name,
- TRUE, TRUE);
- if (mh == NULL)
- return FALSE;
-
- /* Allocate memory to hold type information. If this turns
- out to be a duplicate, we pass this address to
- bfd_release. */
- amt = sizeof (struct coff_debug_merge_type);
- mt = bfd_alloc (input_bfd, amt);
- if (mt == NULL)
- return FALSE;
- mt->class = isym.n_sclass;
-
- /* Pick up the aux entry, which points to the end of the tag
- entries. */
- bfd_coff_swap_aux_in (input_bfd, (esym + isymesz),
- isym.n_type, isym.n_sclass, 0, isym.n_numaux,
- &aux);
-
- /* Gather the elements. */
- epp = &mt->elements;
- mt->elements = NULL;
- islp = isymp + 2;
- esl = esym + 2 * isymesz;
- eslend = ((bfd_byte *) obj_coff_external_syms (input_bfd)
- + aux.x_sym.x_fcnary.x_fcn.x_endndx.l * isymesz);
- while (esl < eslend)
- {
- const char *elename;
- char elebuf[SYMNMLEN + 1];
- char *name_copy;
-
- bfd_coff_swap_sym_in (input_bfd, esl, islp);
-
- amt = sizeof (struct coff_debug_merge_element);
- *epp = bfd_alloc (input_bfd, amt);
- if (*epp == NULL)
- return FALSE;
-
- elename = _bfd_coff_internal_syment_name (input_bfd, islp,
- elebuf);
- if (elename == NULL)
- return FALSE;
-
- amt = strlen (elename) + 1;
- name_copy = bfd_alloc (input_bfd, amt);
- if (name_copy == NULL)
- return FALSE;
- strcpy (name_copy, elename);
-
- (*epp)->name = name_copy;
- (*epp)->type = islp->n_type;
- (*epp)->tagndx = 0;
- if (islp->n_numaux >= 1
- && islp->n_type != T_NULL
- && islp->n_sclass != C_EOS)
- {
- union internal_auxent eleaux;
- long indx;
-
- bfd_coff_swap_aux_in (input_bfd, (esl + isymesz),
- islp->n_type, islp->n_sclass, 0,
- islp->n_numaux, &eleaux);
- indx = eleaux.x_sym.x_tagndx.l;
-
- /* FIXME: If this tagndx entry refers to a symbol
- defined later in this file, we just ignore it.
- Handling this correctly would be tedious, and may
- not be required. */
- if (indx > 0
- && (indx
- < ((esym -
- (bfd_byte *) obj_coff_external_syms (input_bfd))
- / (long) isymesz)))
- {
- (*epp)->tagndx = finfo->sym_indices[indx];
- if ((*epp)->tagndx < 0)
- (*epp)->tagndx = 0;
- }
- }
- epp = &(*epp)->next;
- *epp = NULL;
-
- esl += (islp->n_numaux + 1) * isymesz;
- islp += islp->n_numaux + 1;
- }
-
- /* See if we already have a definition which matches this
- type. We always output the type if it has no elements,
- for simplicity. */
- if (mt->elements == NULL)
- bfd_release (input_bfd, mt);
- else
- {
- struct coff_debug_merge_type *mtl;
-
- for (mtl = mh->types; mtl != NULL; mtl = mtl->next)
- {
- struct coff_debug_merge_element *me, *mel;
-
- if (mtl->class != mt->class)
- continue;
-
- for (me = mt->elements, mel = mtl->elements;
- me != NULL && mel != NULL;
- me = me->next, mel = mel->next)
- {
- if (strcmp (me->name, mel->name) != 0
- || me->type != mel->type
- || me->tagndx != mel->tagndx)
- break;
- }
-
- if (me == NULL && mel == NULL)
- break;
- }
-
- if (mtl == NULL || (bfd_size_type) mtl->indx >= syment_base)
- {
- /* This is the first definition of this type. */
- mt->indx = output_index;
- mt->next = mh->types;
- mh->types = mt;
- }
- else
- {
- /* This is a redefinition which can be merged. */
- bfd_release (input_bfd, mt);
- *indexp = mtl->indx;
- add = (eslend - esym) / isymesz;
- skip = TRUE;
- }
- }
- }
-
- /* We now know whether we are to skip this symbol or not. */
- if (! skip)
- {
- /* Adjust the symbol in order to output it. */
-
- if (isym._n._n_n._n_zeroes == 0
- && isym._n._n_n._n_offset != 0)
- {
- const char *name;
- bfd_size_type indx;
-
- /* This symbol has a long name. Enter it in the string
- table we are building. Note that we do not check
- bfd_coff_symname_in_debug. That is only true for
- XCOFF, and XCOFF requires different linking code
- anyhow. */
- name = _bfd_coff_internal_syment_name (input_bfd, &isym, NULL);
- if (name == NULL)
- return FALSE;
- indx = _bfd_stringtab_add (finfo->strtab, name, hash, copy);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
- }
-
- switch (isym.n_sclass)
- {
- case C_AUTO:
- case C_MOS:
- case C_EOS:
- case C_MOE:
- case C_MOU:
- case C_UNTAG:
- case C_STRTAG:
- case C_ENTAG:
- case C_TPDEF:
- case C_ARG:
- case C_USTATIC:
- case C_REG:
- case C_REGPARM:
- case C_FIELD:
- /* The symbol value should not be modified. */
- break;
-
- case C_FCN:
- if (obj_pe (input_bfd)
- && strcmp (isym.n_name, ".bf") != 0
- && isym.n_scnum > 0)
- {
- /* For PE, .lf and .ef get their value left alone,
- while .bf gets relocated. However, they all have
- "real" section numbers, and need to be moved into
- the new section. */
- isym.n_scnum = (*secpp)->output_section->target_index;
- break;
- }
- /* Fall through. */
- default:
- case C_LABEL: /* Not completely sure about these 2 */
- case C_EXTDEF:
- case C_BLOCK:
- case C_EFCN:
- case C_NULL:
- case C_EXT:
- case C_STAT:
- case C_SECTION:
- case C_NT_WEAK:
- /* Compute new symbol location. */
- if (isym.n_scnum > 0)
- {
- isym.n_scnum = (*secpp)->output_section->target_index;
- isym.n_value += (*secpp)->output_offset;
- if (! obj_pe (input_bfd))
- isym.n_value -= (*secpp)->vma;
- if (! obj_pe (finfo->output_bfd))
- isym.n_value += (*secpp)->output_section->vma;
- }
- break;
-
- case C_FILE:
- /* The value of a C_FILE symbol is the symbol index of
- the next C_FILE symbol. The value of the last C_FILE
- symbol is the symbol index to the first external
- symbol (actually, coff_renumber_symbols does not get
- this right--it just sets the value of the last C_FILE
- symbol to zero--and nobody has ever complained about
- it). We try to get this right, below, just before we
- write the symbols out, but in the general case we may
- have to write the symbol out twice. */
- if (finfo->last_file_index != -1
- && finfo->last_file.n_value != (bfd_vma) output_index)
- {
- /* We must correct the value of the last C_FILE
- entry. */
- finfo->last_file.n_value = output_index;
- if ((bfd_size_type) finfo->last_file_index >= syment_base)
- {
- /* The last C_FILE symbol is in this input file. */
- bfd_coff_swap_sym_out (output_bfd,
- &finfo->last_file,
- (finfo->outsyms
- + ((finfo->last_file_index
- - syment_base)
- * osymesz)));
- }
- 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,
- &finfo->last_file, outsym);
- 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;
- }
- }
-
- finfo->last_file_index = output_index;
- finfo->last_file = isym;
- break;
- }
-
- /* If doing task linking, convert normal global function symbols to
- static functions. */
- if (finfo->info->task_link && IS_EXTERNAL (input_bfd, isym))
- isym.n_sclass = C_STAT;
-
- /* Output the symbol. */
- bfd_coff_swap_sym_out (output_bfd, &isym, outsym);
-
- *indexp = output_index;
-
- if (global)
- {
- long indx;
- struct coff_link_hash_entry *h;
-
- indx = ((esym - (bfd_byte *) obj_coff_external_syms (input_bfd))
- / isymesz);
- h = obj_coff_sym_hashes (input_bfd)[indx];
- if (h == NULL)
- {
- /* This can happen if there were errors earlier in
- the link. */
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- h->indx = output_index;
- }
-
- output_index += add;
- outsym += add * osymesz;
- }
-
- esym += add * isymesz;
- isymp += add;
- ++secpp;
- ++indexp;
- for (--add; add > 0; --add)
- {
- *secpp++ = NULL;
- *indexp++ = -1;
- }
- }
-
- /* Fix up the aux entries. This must be done in a separate pass,
- because we don't know the correct symbol indices until we have
- already decided which symbols we are going to keep. */
- esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
- esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
- isymp = finfo->internal_syms;
- indexp = finfo->sym_indices;
- sym_hash = obj_coff_sym_hashes (input_bfd);
- outsym = finfo->outsyms;
-
- while (esym < esym_end)
- {
- int add;
-
- add = 1 + isymp->n_numaux;
-
- if ((*indexp < 0
- || (bfd_size_type) *indexp < syment_base)
- && (*sym_hash == NULL
- || (*sym_hash)->auxbfd != input_bfd))
- esym += add * isymesz;
- else
- {
- struct coff_link_hash_entry *h;
- int i;
-
- h = NULL;
- if (*indexp < 0)
- {
- h = *sym_hash;
-
- /* The m68k-motorola-sysv assembler will sometimes
- generate two symbols with the same name, but only one
- will have aux entries. */
- BFD_ASSERT (isymp->n_numaux == 0
- || h->numaux == isymp->n_numaux);
- }
-
- esym += isymesz;
-
- if (h == NULL)
- outsym += osymesz;
-
- /* Handle the aux entries. This handling is based on
- coff_pointerize_aux. I don't know if it always correct. */
- for (i = 0; i < isymp->n_numaux && esym < esym_end; i++)
- {
- union internal_auxent aux;
- union internal_auxent *auxp;
-
- if (h != NULL)
- auxp = h->aux + i;
- else
- {
- bfd_coff_swap_aux_in (input_bfd, esym, isymp->n_type,
- isymp->n_sclass, i, isymp->n_numaux, &aux);
- auxp = &aux;
- }
-
- if (isymp->n_sclass == C_FILE)
- {
- /* If this is a long filename, we must put it in the
- string table. */
- if (auxp->x_file.x_n.x_zeroes == 0
- && auxp->x_file.x_n.x_offset != 0)
- {
- const char *filename;
- bfd_size_type indx;
-
- BFD_ASSERT (auxp->x_file.x_n.x_offset
- >= STRING_SIZE_SIZE);
- if (strings == NULL)
- {
- strings = _bfd_coff_read_string_table (input_bfd);
- if (strings == NULL)
- return FALSE;
- }
- filename = strings + auxp->x_file.x_n.x_offset;
- indx = _bfd_stringtab_add (finfo->strtab, filename,
- hash, copy);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
- }
- }
- else if (isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
- {
- unsigned long indx;
-
- if (ISFCN (isymp->n_type)
- || ISTAG (isymp->n_sclass)
- || isymp->n_sclass == C_BLOCK
- || isymp->n_sclass == C_FCN)
- {
- indx = auxp->x_sym.x_fcnary.x_fcn.x_endndx.l;
- if (indx > 0
- && indx < obj_raw_syment_count (input_bfd))
- {
- /* We look forward through the symbol for
- the index of the next symbol we are going
- to include. I don't know if this is
- entirely right. */
- while ((finfo->sym_indices[indx] < 0
- || ((bfd_size_type) finfo->sym_indices[indx]
- < syment_base))
- && indx < obj_raw_syment_count (input_bfd))
- ++indx;
- if (indx >= obj_raw_syment_count (input_bfd))
- indx = output_index;
- else
- indx = finfo->sym_indices[indx];
- auxp->x_sym.x_fcnary.x_fcn.x_endndx.l = indx;
- }
- }
-
- indx = auxp->x_sym.x_tagndx.l;
- if (indx > 0 && indx < obj_raw_syment_count (input_bfd))
- {
- long symindx;
-
- symindx = finfo->sym_indices[indx];
- if (symindx < 0)
- auxp->x_sym.x_tagndx.l = 0;
- else
- auxp->x_sym.x_tagndx.l = symindx;
- }
-
- /* The .bf symbols are supposed to be linked through
- the endndx field. We need to carry this list
- across object files. */
- if (i == 0
- && h == NULL
- && isymp->n_sclass == C_FCN
- && (isymp->_n._n_n._n_zeroes != 0
- || isymp->_n._n_n._n_offset == 0)
- && isymp->_n._n_name[0] == '.'
- && isymp->_n._n_name[1] == 'b'
- && isymp->_n._n_name[2] == 'f'
- && isymp->_n._n_name[3] == '\0')
- {
- if (finfo->last_bf_index != -1)
- {
- finfo->last_bf.x_sym.x_fcnary.x_fcn.x_endndx.l =
- *indexp;
-
- if ((bfd_size_type) finfo->last_bf_index
- >= syment_base)
- {
- void *auxout;
-
- /* The last .bf symbol is in this input
- file. This will only happen if the
- assembler did not set up the .bf
- endndx symbols correctly. */
- auxout = (finfo->outsyms
- + ((finfo->last_bf_index
- - syment_base)
- * osymesz));
-
- bfd_coff_swap_aux_out (output_bfd,
- &finfo->last_bf,
- isymp->n_type,
- isymp->n_sclass,
- 0, isymp->n_numaux,
- auxout);
- }
- else
- {
- file_ptr pos;
-
- /* We have already written out the last
- .bf aux entry. We need to write it
- out again. We borrow *outsym
- temporarily. FIXME: This case should
- be made faster. */
- bfd_coff_swap_aux_out (output_bfd,
- &finfo->last_bf,
- isymp->n_type,
- isymp->n_sclass,
- 0, isymp->n_numaux,
- outsym);
- 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;
- }
- }
-
- if (auxp->x_sym.x_fcnary.x_fcn.x_endndx.l != 0)
- finfo->last_bf_index = -1;
- else
- {
- /* The endndx field of this aux entry must
- be updated with the symbol number of the
- next .bf symbol. */
- finfo->last_bf = *auxp;
- finfo->last_bf_index = (((outsym - finfo->outsyms)
- / osymesz)
- + syment_base);
- }
- }
- }
-
- if (h == NULL)
- {
- bfd_coff_swap_aux_out (output_bfd, auxp, isymp->n_type,
- isymp->n_sclass, i, isymp->n_numaux,
- outsym);
- outsym += osymesz;
- }
-
- esym += isymesz;
- }
- }
-
- indexp += add;
- isymp += add;
- sym_hash += add;
- }
-
- /* Relocate the line numbers, unless we are stripping them. */
- if (finfo->info->strip == strip_none
- || finfo->info->strip == strip_some)
- {
- for (o = input_bfd->sections; o != NULL; o = o->next)
- {
- bfd_vma offset;
- bfd_byte *eline;
- bfd_byte *elineend;
- bfd_byte *oeline;
- bfd_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
- link order, which means that we will not have seen this
- input section in _bfd_coff_final_link, which means that
- we will not have allocated space for the line numbers of
- this section. I don't think line numbers can be
- meaningful for a section which does not have
- SEC_HAS_CONTENTS set, but, if they do, this must be
- changed. */
- if (o->lineno_count == 0
- || (o->output_section->flags & SEC_HAS_CONTENTS) == 0)
- continue;
-
- if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0
- || bfd_bread (finfo->linenos, linesz * o->lineno_count,
- input_bfd) != linesz * o->lineno_count)
- return FALSE;
-
- offset = o->output_section->vma + o->output_offset - o->vma;
- eline = finfo->linenos;
- oeline = finfo->linenos;
- elineend = eline + linesz * o->lineno_count;
- skipping = FALSE;
- for (; eline < elineend; eline += linesz)
- {
- struct internal_lineno iline;
-
- bfd_coff_swap_lineno_in (input_bfd, eline, &iline);
-
- if (iline.l_lnno != 0)
- iline.l_addr.l_paddr += offset;
- else if (iline.l_addr.l_symndx >= 0
- && ((unsigned long) iline.l_addr.l_symndx
- < obj_raw_syment_count (input_bfd)))
- {
- long indx;
-
- indx = finfo->sym_indices[iline.l_addr.l_symndx];
-
- if (indx < 0)
- {
- /* These line numbers are attached to a symbol
- which we are stripping. We must discard the
- line numbers because reading them back with
- no associated symbol (or associating them all
- with symbol #0) will fail. We can't regain
- the space in the output file, but at least
- they're dense. */
- skipping = TRUE;
- }
- else
- {
- struct internal_syment is;
- union internal_auxent ia;
-
- /* Fix up the lnnoptr field in the aux entry of
- the symbol. It turns out that we can't do
- this when we modify the symbol aux entries,
- because gas sometimes screws up the lnnoptr
- field and makes it an offset from the start
- of the line numbers rather than an absolute
- file index. */
- bfd_coff_swap_sym_in (output_bfd,
- (finfo->outsyms
- + ((indx - syment_base)
- * osymesz)), &is);
- if ((ISFCN (is.n_type)
- || is.n_sclass == C_BLOCK)
- && is.n_numaux >= 1)
- {
- void *auxptr;
-
- auxptr = (finfo->outsyms
- + ((indx - syment_base + 1)
- * osymesz));
- bfd_coff_swap_aux_in (output_bfd, auxptr,
- is.n_type, is.n_sclass,
- 0, is.n_numaux, &ia);
- ia.x_sym.x_fcnary.x_fcn.x_lnnoptr =
- (o->output_section->line_filepos
- + o->output_section->lineno_count * linesz
- + eline - finfo->linenos);
- bfd_coff_swap_aux_out (output_bfd, &ia,
- is.n_type, is.n_sclass, 0,
- is.n_numaux, auxptr);
- }
-
- skipping = FALSE;
- }
-
- iline.l_addr.l_symndx = indx;
- }
-
- if (!skipping)
- {
- bfd_coff_swap_lineno_out (output_bfd, &iline, oeline);
- oeline += linesz;
- }
- }
-
- 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 += amt / linesz;
- }
- }
-
- /* If we swapped out a C_FILE symbol, guess that the next C_FILE
- symbol will be the first symbol in the next input file. In the
- normal case, this will save us from writing out the C_FILE symbol
- again. */
- if (finfo->last_file_index != -1
- && (bfd_size_type) finfo->last_file_index >= syment_base)
- {
- finfo->last_file.n_value = output_index;
- bfd_coff_swap_sym_out (output_bfd, &finfo->last_file,
- (finfo->outsyms
- + ((finfo->last_file_index - syment_base)
- * osymesz)));
- }
-
- /* Write the modified symbols to the output file. */
- if (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)
- + (outsym - finfo->outsyms) / osymesz)
- == output_index);
-
- obj_raw_syment_count (output_bfd) = output_index;
- }
-
- /* Relocate the contents of each section. */
- adjust_symndx = coff_backend_info (input_bfd)->_bfd_coff_adjust_symndx;
- for (o = input_bfd->sections; o != NULL; o = o->next)
- {
- bfd_byte *contents;
- struct coff_section_tdata *secdata;
-
- if (! o->linker_mark)
- /* This section was omitted from the link. */
- continue;
-
- if ((o->flags & SEC_HAS_CONTENTS) == 0
- || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
- {
- if ((o->flags & SEC_RELOC) != 0
- && o->reloc_count != 0)
- {
- ((*_bfd_error_handler)
- (_("%s: relocs in section `%s', but it has no contents"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, o)));
- bfd_set_error (bfd_error_no_contents);
- return FALSE;
- }
-
- continue;
- }
-
- secdata = coff_section_data (input_bfd, o);
- if (secdata != NULL && secdata->contents != NULL)
- contents = secdata->contents;
- else
- {
- if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
- (file_ptr) 0, o->_raw_size))
- return FALSE;
- contents = finfo->contents;
- }
-
- if ((o->flags & SEC_RELOC) != 0)
- {
- int target_index;
- struct internal_reloc *internal_relocs;
- struct internal_reloc *irel;
-
- /* Read in the relocs. */
- target_index = o->output_section->target_index;
- internal_relocs = (_bfd_coff_read_internal_relocs
- (input_bfd, o, FALSE, finfo->external_relocs,
- finfo->info->relocatable,
- (finfo->info->relocatable
- ? (finfo->section_info[target_index].relocs
- + o->output_section->reloc_count)
- : finfo->internal_relocs)));
- if (internal_relocs == NULL)
- return FALSE;
-
- /* Call processor specific code to relocate the section
- contents. */
- if (! bfd_coff_relocate_section (output_bfd, finfo->info,
- input_bfd, o,
- contents,
- internal_relocs,
- finfo->internal_syms,
- finfo->sec_ptrs))
- return FALSE;
-
- if (finfo->info->relocatable)
- {
- bfd_vma offset;
- struct internal_reloc *irelend;
- struct coff_link_hash_entry **rel_hash;
-
- offset = o->output_section->vma + o->output_offset - o->vma;
- irel = internal_relocs;
- irelend = irel + o->reloc_count;
- rel_hash = (finfo->section_info[target_index].rel_hashes
- + o->output_section->reloc_count);
- for (; irel < irelend; irel++, rel_hash++)
- {
- struct coff_link_hash_entry *h;
- bfd_boolean adjusted;
-
- *rel_hash = NULL;
-
- /* Adjust the reloc address and symbol index. */
- irel->r_vaddr += offset;
-
- if (irel->r_symndx == -1)
- continue;
-
- if (adjust_symndx)
- {
- if (! (*adjust_symndx) (output_bfd, finfo->info,
- input_bfd, o, irel,
- &adjusted))
- return FALSE;
- if (adjusted)
- continue;
- }
-
- h = obj_coff_sym_hashes (input_bfd)[irel->r_symndx];
- if (h != NULL)
- {
- /* This is a global symbol. */
- if (h->indx >= 0)
- irel->r_symndx = h->indx;
- else
- {
- /* This symbol is being written at the end
- of the file, and we do not yet know the
- symbol index. We save the pointer to the
- hash table entry in the rel_hash list.
- We set the indx field to -2 to indicate
- that this symbol must not be stripped. */
- *rel_hash = h;
- h->indx = -2;
- }
- }
- else
- {
- long indx;
-
- indx = finfo->sym_indices[irel->r_symndx];
- if (indx != -1)
- irel->r_symndx = indx;
- else
- {
- struct internal_syment *is;
- const char *name;
- char buf[SYMNMLEN + 1];
-
- /* This reloc is against a symbol we are
- stripping. This should have been handled
- by the 'dont_skip_symbol' code in the while
- loop at the top of this function. */
- is = finfo->internal_syms + irel->r_symndx;
-
- name = (_bfd_coff_internal_syment_name
- (input_bfd, is, buf));
- if (name == NULL)
- return FALSE;
-
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, name, input_bfd, o,
- irel->r_vaddr)))
- return FALSE;
- }
- }
- }
-
- o->output_section->reloc_count += o->reloc_count;
- }
- }
-
- /* 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, loc, amt))
- return FALSE;
- }
- else
- {
- if (! (_bfd_write_section_stabs
- (output_bfd, &coff_hash_table (finfo->info)->stab_info,
- o, &secdata->stab_info, contents)))
- return FALSE;
- }
- }
-
- if (! finfo->info->keep_memory
- && ! _bfd_coff_free_symbols (input_bfd))
- return FALSE;
-
- return TRUE;
-}
-
-/* Write out a global symbol. Called via coff_link_hash_traverse. */
-
-bfd_boolean
-_bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data)
-{
- struct coff_final_link_info *finfo = (struct coff_final_link_info *) data;
- bfd *output_bfd;
- struct internal_syment isym;
- bfd_size_type symesz;
- unsigned int i;
- file_ptr pos;
-
- output_bfd = finfo->output_bfd;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h = (struct coff_link_hash_entry *) h->root.u.i.link;
- if (h->root.type == bfd_link_hash_new)
- return TRUE;
- }
-
- if (h->indx >= 0)
- return TRUE;
-
- if (h->indx != -2
- && (finfo->info->strip == strip_all
- || (finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash,
- h->root.root.string, FALSE, FALSE)
- == NULL))))
- return TRUE;
-
- switch (h->root.type)
- {
- default:
- case bfd_link_hash_new:
- case bfd_link_hash_warning:
- abort ();
- return FALSE;
-
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- isym.n_scnum = N_UNDEF;
- isym.n_value = 0;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- {
- asection *sec;
-
- sec = h->root.u.def.section->output_section;
- if (bfd_is_abs_section (sec))
- isym.n_scnum = N_ABS;
- else
- isym.n_scnum = sec->target_index;
- isym.n_value = (h->root.u.def.value
- + h->root.u.def.section->output_offset);
- if (! obj_pe (finfo->output_bfd))
- isym.n_value += sec->vma;
- }
- break;
-
- case bfd_link_hash_common:
- isym.n_scnum = N_UNDEF;
- isym.n_value = h->root.u.c.size;
- break;
-
- case bfd_link_hash_indirect:
- /* Just ignore these. They can't be handled anyhow. */
- return TRUE;
- }
-
- if (strlen (h->root.root.string) <= SYMNMLEN)
- strncpy (isym._n._n_name, h->root.root.string, SYMNMLEN);
- else
- {
- bfd_boolean hash;
- bfd_size_type indx;
-
- hash = TRUE;
- if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = FALSE;
- indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string, hash,
- FALSE);
- if (indx == (bfd_size_type) -1)
- {
- finfo->failed = TRUE;
- return FALSE;
- }
- isym._n._n_n._n_zeroes = 0;
- isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
- }
-
- isym.n_sclass = h->class;
- isym.n_type = h->type;
-
- if (isym.n_sclass == C_NULL)
- isym.n_sclass = C_EXT;
-
- /* If doing task linking and this is the pass where we convert
- defined globals to statics, then do that conversion now. If the
- symbol is not being converted, just ignore it and it will be
- output during a later pass. */
- if (finfo->global_to_static)
- {
- if (! IS_EXTERNAL (output_bfd, isym))
- return TRUE;
-
- isym.n_sclass = C_STAT;
- }
-
- /* When a weak symbol is not overridden by a strong one,
- turn it into an external symbol when not building a
- shared or relocatable object. */
- if (! finfo->info->shared
- && ! finfo->info->relocatable
- && IS_WEAK_EXTERNAL (finfo->output_bfd, isym))
- isym.n_sclass = C_EXT;
-
- isym.n_numaux = h->numaux;
-
- bfd_coff_swap_sym_out (output_bfd, &isym, finfo->outsyms);
-
- symesz = bfd_coff_symesz (output_bfd);
-
- 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;
- }
-
- h->indx = obj_raw_syment_count (output_bfd);
-
- ++obj_raw_syment_count (output_bfd);
-
- /* Write out any associated aux entries. Most of the aux entries
- will have been modified in _bfd_coff_link_input_bfd. We have to
- handle section aux entries here, now that we have the final
- relocation and line number counts. */
- for (i = 0; i < isym.n_numaux; i++)
- {
- union internal_auxent *auxp;
-
- auxp = h->aux + i;
-
- /* Look for a section aux entry here using the same tests that
- coff_swap_aux_out uses. */
- if (i == 0
- && (isym.n_sclass == C_STAT
- || isym.n_sclass == C_HIDDEN)
- && isym.n_type == T_NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- asection *sec;
-
- sec = h->root.u.def.section->output_section;
- if (sec != NULL)
- {
- auxp->x_scn.x_scnlen = (sec->_cooked_size != 0
- ? sec->_cooked_size
- : sec->_raw_size);
-
- /* For PE, an overflow on the final link reportedly does
- not matter. FIXME: Why not? */
- if (sec->reloc_count > 0xffff
- && (! obj_pe (output_bfd)
- || finfo->info->relocatable))
- (*_bfd_error_handler)
- (_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
- bfd_get_filename (output_bfd),
- bfd_get_section_name (output_bfd, sec),
- sec->reloc_count);
-
- if (sec->lineno_count > 0xffff
- && (! obj_pe (output_bfd)
- || finfo->info->relocatable))
- (*_bfd_error_handler)
- (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
- bfd_get_filename (output_bfd),
- bfd_get_section_name (output_bfd, sec),
- sec->lineno_count);
-
- auxp->x_scn.x_nreloc = sec->reloc_count;
- auxp->x_scn.x_nlinno = sec->lineno_count;
- auxp->x_scn.x_checksum = 0;
- auxp->x_scn.x_associated = 0;
- auxp->x_scn.x_comdat = 0;
- }
- }
-
- bfd_coff_swap_aux_out (output_bfd, auxp, isym.n_type,
- isym.n_sclass, (int) i, isym.n_numaux,
- finfo->outsyms);
- if (bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz)
- {
- finfo->failed = TRUE;
- return FALSE;
- }
- ++obj_raw_syment_count (output_bfd);
- }
-
- return TRUE;
-}
-
-/* Write out task global symbols, converting them to statics. Called
- via coff_link_hash_traverse. Calls bfd_coff_write_global_sym to do
- the dirty work, if the symbol we are processing needs conversion. */
-
-bfd_boolean
-_bfd_coff_write_task_globals (struct coff_link_hash_entry *h, void *data)
-{
- struct coff_final_link_info *finfo = (struct coff_final_link_info *) data;
- bfd_boolean rtnval = TRUE;
- bfd_boolean save_global_to_static;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct coff_link_hash_entry *) h->root.u.i.link;
-
- if (h->indx < 0)
- {
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- save_global_to_static = finfo->global_to_static;
- finfo->global_to_static = TRUE;
- rtnval = _bfd_coff_write_global_sym (h, data);
- finfo->global_to_static = save_global_to_static;
- break;
- default:
- break;
- }
- }
- return (rtnval);
-}
-
-/* Handle a link order which is supposed to generate a reloc. */
-
-bfd_boolean
-_bfd_coff_reloc_link_order (bfd *output_bfd,
- struct coff_final_link_info *finfo,
- asection *output_section,
- struct bfd_link_order *link_order)
-{
- reloc_howto_type *howto;
- struct internal_reloc *irel;
- struct coff_link_hash_entry **rel_hash_ptr;
-
- howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
- if (howto == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (link_order->u.reloc.p->addend != 0)
- {
- bfd_size_type size;
- bfd_byte *buf;
- bfd_reloc_status_type rstat;
- bfd_boolean ok;
- file_ptr loc;
-
- size = bfd_get_reloc_size (howto);
- buf = bfd_zmalloc (size);
- if (buf == NULL)
- return FALSE;
-
- rstat = _bfd_relocate_contents (howto, output_bfd,
- (bfd_vma) link_order->u.reloc.p->addend,\
- buf);
- switch (rstat)
- {
- case bfd_reloc_ok:
- break;
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- if (! ((*finfo->info->callbacks->reloc_overflow)
- (finfo->info,
- (link_order->type == bfd_section_reloc_link_order
- ? bfd_section_name (output_bfd,
- link_order->u.reloc.p->u.section)
- : link_order->u.reloc.p->u.name),
- howto->name, link_order->u.reloc.p->addend,
- (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
- {
- free (buf);
- return FALSE;
- }
- break;
- }
- loc = link_order->offset * bfd_octets_per_byte (output_bfd);
- ok = bfd_set_section_contents (output_bfd, output_section, buf,
- loc, size);
- free (buf);
- if (! ok)
- return FALSE;
- }
-
- /* Store the reloc information in the right place. It will get
- swapped and written out at the end of the final_link routine. */
- irel = (finfo->section_info[output_section->target_index].relocs
- + output_section->reloc_count);
- rel_hash_ptr = (finfo->section_info[output_section->target_index].rel_hashes
- + output_section->reloc_count);
-
- memset (irel, 0, sizeof (struct internal_reloc));
- *rel_hash_ptr = NULL;
-
- irel->r_vaddr = output_section->vma + link_order->offset;
-
- if (link_order->type == bfd_section_reloc_link_order)
- {
- /* We need to somehow locate a symbol in the right section. The
- symbol must either have a value of zero, or we must adjust
- the addend by the value of the symbol. FIXME: Write this
- when we need it. The old linker couldn't handle this anyhow. */
- abort ();
- *rel_hash_ptr = NULL;
- irel->r_symndx = 0;
- }
- else
- {
- struct coff_link_hash_entry *h;
-
- h = ((struct coff_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, finfo->info,
- link_order->u.reloc.p->u.name,
- FALSE, FALSE, TRUE));
- if (h != NULL)
- {
- if (h->indx >= 0)
- irel->r_symndx = h->indx;
- else
- {
- /* Set the index to -2 to force this symbol to get
- written out. */
- h->indx = -2;
- *rel_hash_ptr = h;
- irel->r_symndx = 0;
- }
- }
- else
- {
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, link_order->u.reloc.p->u.name, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- return FALSE;
- irel->r_symndx = 0;
- }
- }
-
- /* FIXME: Is this always right? */
- irel->r_type = howto->type;
-
- /* r_size is only used on the RS/6000, which needs its own linker
- routines anyhow. r_extern is only used for ECOFF. */
-
- /* FIXME: What is the right value for r_offset? Is zero OK? */
- ++output_section->reloc_count;
-
- return TRUE;
-}
-
-/* A basic reloc handling routine which may be used by processors with
- simple relocs. */
-
-bfd_boolean
-_bfd_coff_generic_relocate_section (bfd *output_bfd,
- struct bfd_link_info *info,
- bfd *input_bfd,
- asection *input_section,
- bfd_byte *contents,
- struct internal_reloc *relocs,
- struct internal_syment *syms,
- asection **sections)
-{
- struct internal_reloc *rel;
- struct internal_reloc *relend;
-
- rel = relocs;
- relend = rel + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- long symndx;
- struct coff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma addend;
- bfd_vma val;
- reloc_howto_type *howto;
- bfd_reloc_status_type rstat;
-
- symndx = rel->r_symndx;
-
- if (symndx == -1)
- {
- h = NULL;
- sym = NULL;
- }
- else if (symndx < 0
- || (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
- {
- (*_bfd_error_handler)
- ("%s: illegal symbol index %ld in relocs",
- bfd_archive_filename (input_bfd), symndx);
- return FALSE;
- }
- else
- {
- h = obj_coff_sym_hashes (input_bfd)[symndx];
- sym = syms + symndx;
- }
-
- /* COFF treats common symbols in one of two ways. Either the
- size of the symbol is included in the section contents, or it
- is not. We assume that the size is not included, and force
- the rtype_to_howto function to adjust the addend as needed. */
- if (sym != NULL && sym->n_scnum != 0)
- addend = - sym->n_value;
- else
- addend = 0;
-
- howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
- sym, &addend);
- if (howto == NULL)
- return FALSE;
-
- /* If we are doing a relocatable link, then we can just ignore
- a PC relative reloc that is pcrel_offset. It will already
- have the correct value. If this is not a relocatable link,
- then we should ignore the symbol value. */
- if (howto->pc_relative && howto->pcrel_offset)
- {
- if (info->relocatable)
- continue;
- if (sym != NULL && sym->n_scnum != 0)
- addend += sym->n_value;
- }
-
- val = 0;
-
- if (h == NULL)
- {
- asection *sec;
-
- if (symndx == -1)
- {
- sec = bfd_abs_section_ptr;
- val = 0;
- }
- else
- {
- sec = sections[symndx];
- val = (sec->output_section->vma
- + sec->output_offset
- + sym->n_value);
- if (! obj_pe (input_bfd))
- val -= sec->vma;
- }
- }
- else
- {
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *sec;
-
- sec = h->root.u.def.section;
- val = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
-
- else if (h->root.type == bfd_link_hash_undefweak)
- val = 0;
-
- else if (! info->relocatable)
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, TRUE)))
- return FALSE;
- }
- }
-
- if (info->base_file)
- {
- /* Emit a reloc if the backend thinks it needs it. */
- if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
- {
- /* Relocation to a symbol in a section which isn't
- absolute. We output the address here to a file.
- This file is then read by dlltool when generating the
- reloc section. Note that the base file is not
- portable between systems. We write out a long here,
- and dlltool reads in a long. */
- long addr = (rel->r_vaddr
- - input_section->vma
- + input_section->output_offset
- + input_section->output_section->vma);
- if (coff_data (output_bfd)->pe)
- addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
- if (fwrite (&addr, 1, sizeof (long), (FILE *) info->base_file)
- != sizeof (long))
- {
- bfd_set_error (bfd_error_system_call);
- return FALSE;
- }
- }
- }
-
- rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents,
- rel->r_vaddr - input_section->vma,
- val, addend);
-
- switch (rstat)
- {
- default:
- abort ();
- case bfd_reloc_ok:
- break;
- case bfd_reloc_outofrange:
- (*_bfd_error_handler)
- (_("%s: bad reloc address 0x%lx in section `%s'"),
- bfd_archive_filename (input_bfd),
- (unsigned long) rel->r_vaddr,
- bfd_get_section_name (input_bfd, input_section));
- return FALSE;
- case bfd_reloc_overflow:
- {
- const char *name;
- char buf[SYMNMLEN + 1];
-
- if (symndx == -1)
- name = "*ABS*";
- else if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
- if (name == NULL)
- return FALSE;
- }
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
- return FALSE;
- }
- }
- }
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/coffswap.h b/contrib/binutils/bfd/coffswap.h
deleted file mode 100644
index 5f23ecc..0000000
--- a/contrib/binutils/bfd/coffswap.h
+++ /dev/null
@@ -1,906 +0,0 @@
-/* Generic COFF swapping routines, for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
- 2001, 2002
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file contains routines used to swap COFF data. It is a header
- file because the details of swapping depend on the details of the
- structures used by each COFF implementation. This is included by
- coffcode.h, as well as by the ECOFF backend.
-
- Any file which uses this must first include "coff/internal.h" and
- "coff/CPU.h". The functions will then be correct for that CPU. */
-
-#ifndef GET_FCN_LNNOPTR
-#define GET_FCN_LNNOPTR(abfd, ext) \
- H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#endif
-
-#ifndef GET_FCN_ENDNDX
-#define GET_FCN_ENDNDX(abfd, ext) \
- H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#endif
-
-#ifndef PUT_FCN_LNNOPTR
-#define PUT_FCN_LNNOPTR(abfd, in, ext) \
- H_PUT_32 (abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#endif
-#ifndef PUT_FCN_ENDNDX
-#define PUT_FCN_ENDNDX(abfd, in, ext) \
- H_PUT_32 (abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#endif
-#ifndef GET_LNSZ_LNNO
-#define GET_LNSZ_LNNO(abfd, ext) \
- H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
-#endif
-#ifndef GET_LNSZ_SIZE
-#define GET_LNSZ_SIZE(abfd, ext) \
- H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
-#endif
-#ifndef PUT_LNSZ_LNNO
-#define PUT_LNSZ_LNNO(abfd, in, ext) \
- H_PUT_16 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
-#endif
-#ifndef PUT_LNSZ_SIZE
-#define PUT_LNSZ_SIZE(abfd, in, ext) \
- H_PUT_16 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
-#endif
-#ifndef GET_SCN_SCNLEN
-#define GET_SCN_SCNLEN(abfd, ext) \
- H_GET_32 (abfd, ext->x_scn.x_scnlen)
-#endif
-#ifndef GET_SCN_NRELOC
-#define GET_SCN_NRELOC(abfd, ext) \
- H_GET_16 (abfd, ext->x_scn.x_nreloc)
-#endif
-#ifndef GET_SCN_NLINNO
-#define GET_SCN_NLINNO(abfd, ext) \
- H_GET_16 (abfd, ext->x_scn.x_nlinno)
-#endif
-#ifndef PUT_SCN_SCNLEN
-#define PUT_SCN_SCNLEN(abfd, in, ext) \
- H_PUT_32 (abfd, in, ext->x_scn.x_scnlen)
-#endif
-#ifndef PUT_SCN_NRELOC
-#define PUT_SCN_NRELOC(abfd, in, ext) \
- H_PUT_16 (abfd, in, ext->x_scn.x_nreloc)
-#endif
-#ifndef PUT_SCN_NLINNO
-#define PUT_SCN_NLINNO(abfd, in, ext) \
- H_PUT_16 (abfd, in, ext->x_scn.x_nlinno)
-#endif
-#ifndef GET_LINENO_LNNO
-#define GET_LINENO_LNNO(abfd, ext) \
- H_GET_16 (abfd, ext->l_lnno);
-#endif
-#ifndef PUT_LINENO_LNNO
-#define PUT_LINENO_LNNO(abfd, val, ext) \
- H_PUT_16 (abfd, val, ext->l_lnno);
-#endif
-
-/* The f_symptr field in the filehdr is sometimes 64 bits. */
-#ifndef GET_FILEHDR_SYMPTR
-#define GET_FILEHDR_SYMPTR H_GET_32
-#endif
-#ifndef PUT_FILEHDR_SYMPTR
-#define PUT_FILEHDR_SYMPTR H_PUT_32
-#endif
-
-/* Some fields in the aouthdr are sometimes 64 bits. */
-#ifndef GET_AOUTHDR_TSIZE
-#define GET_AOUTHDR_TSIZE H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_TSIZE
-#define PUT_AOUTHDR_TSIZE H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_DSIZE
-#define GET_AOUTHDR_DSIZE H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_DSIZE
-#define PUT_AOUTHDR_DSIZE H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_BSIZE
-#define GET_AOUTHDR_BSIZE H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_BSIZE
-#define PUT_AOUTHDR_BSIZE H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_ENTRY
-#define GET_AOUTHDR_ENTRY H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_ENTRY
-#define PUT_AOUTHDR_ENTRY H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_TEXT_START
-#define GET_AOUTHDR_TEXT_START H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_TEXT_START
-#define PUT_AOUTHDR_TEXT_START H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_DATA_START
-#define GET_AOUTHDR_DATA_START H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_DATA_START
-#define PUT_AOUTHDR_DATA_START H_PUT_32
-#endif
-
-/* Some fields in the scnhdr are sometimes 64 bits. */
-#ifndef GET_SCNHDR_PADDR
-#define GET_SCNHDR_PADDR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_PADDR
-#define PUT_SCNHDR_PADDR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_VADDR
-#define GET_SCNHDR_VADDR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_VADDR
-#define PUT_SCNHDR_VADDR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_SIZE
-#define GET_SCNHDR_SIZE H_GET_32
-#endif
-#ifndef PUT_SCNHDR_SIZE
-#define PUT_SCNHDR_SIZE H_PUT_32
-#endif
-#ifndef GET_SCNHDR_SCNPTR
-#define GET_SCNHDR_SCNPTR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_SCNPTR
-#define PUT_SCNHDR_SCNPTR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_RELPTR
-#define GET_SCNHDR_RELPTR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_RELPTR
-#define PUT_SCNHDR_RELPTR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_LNNOPTR
-#define GET_SCNHDR_LNNOPTR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_LNNOPTR
-#define PUT_SCNHDR_LNNOPTR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_NRELOC
-#define GET_SCNHDR_NRELOC H_GET_16
-#endif
-#ifndef MAX_SCNHDR_NRELOC
-#define MAX_SCNHDR_NRELOC 0xffff
-#endif
-#ifndef PUT_SCNHDR_NRELOC
-#define PUT_SCNHDR_NRELOC H_PUT_16
-#endif
-#ifndef GET_SCNHDR_NLNNO
-#define GET_SCNHDR_NLNNO H_GET_16
-#endif
-#ifndef MAX_SCNHDR_NLNNO
-#define MAX_SCNHDR_NLNNO 0xffff
-#endif
-#ifndef PUT_SCNHDR_NLNNO
-#define PUT_SCNHDR_NLNNO H_PUT_16
-#endif
-#ifndef GET_SCNHDR_FLAGS
-#define GET_SCNHDR_FLAGS H_GET_32
-#endif
-#ifndef PUT_SCNHDR_FLAGS
-#define PUT_SCNHDR_FLAGS H_PUT_32
-#endif
-
-#ifndef GET_RELOC_VADDR
-#define GET_RELOC_VADDR H_GET_32
-#endif
-#ifndef PUT_RELOC_VADDR
-#define PUT_RELOC_VADDR H_PUT_32
-#endif
-
-static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR));
-#ifndef NO_COFF_RELOCS
-static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
-#endif /* NO_COFF_RELOCS */
-#ifndef NO_COFF_SYMBOLS
-static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static unsigned int coff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#endif /* NO_COFF_SYMBOLS */
-#ifndef NO_COFF_LINENOS
-static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR));
-#endif /* NO_COFF_LINENOS */
-
-#ifndef NO_COFF_RELOCS
-
-static void
-coff_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- RELOC *reloc_src = (RELOC *) src;
- struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
-
- reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
- reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
- reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
-
-#ifdef SWAP_IN_RELOC_OFFSET
- reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
-#endif
-}
-
-static unsigned int
-coff_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- struct internal_reloc *reloc_src = (struct internal_reloc *) src;
- struct external_reloc *reloc_dst = (struct external_reloc *) dst;
- PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
- H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
- H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
-
-#ifdef SWAP_OUT_RELOC_OFFSET
- SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset);
-#endif
-#ifdef SWAP_OUT_RELOC_EXTRA
- SWAP_OUT_RELOC_EXTRA (abfd, reloc_src, reloc_dst);
-#endif
-
- return bfd_coff_relsz (abfd);
-}
-
-#endif /* NO_COFF_RELOCS */
-
-static void
-coff_swap_filehdr_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- FILHDR *filehdr_src = (FILHDR *) src;
- struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
-
-#ifdef COFF_ADJUST_FILEHDR_IN_PRE
- COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
-#endif
- filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
- filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
- filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat);
- filehdr_dst->f_symptr = GET_FILEHDR_SYMPTR (abfd, filehdr_src->f_symptr);
- filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
- filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
- filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
-#ifdef TIC80_TARGET_ID
- filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id);
-#endif
-
-#ifdef COFF_ADJUST_FILEHDR_IN_POST
- COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
-#endif
-}
-
-static unsigned int
-coff_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
-{
- struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
- FILHDR *filehdr_out = (FILHDR *) out;
-
-#ifdef COFF_ADJUST_FILEHDR_OUT_PRE
- COFF_ADJUST_FILEHDR_OUT_PRE (abfd, in, out);
-#endif
- H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic);
- H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns);
- H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->f_timdat);
- PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, filehdr_out->f_symptr);
- H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
- H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
- H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
-#ifdef TIC80_TARGET_ID
- H_PUT_16 (abfd, filehdr_in->f_target_id, filehdr_out->f_target_id);
-#endif
-
-#ifdef COFF_ADJUST_FILEHDR_OUT_POST
- COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
-#endif
- return bfd_coff_filhsz (abfd);
-}
-
-#ifndef NO_COFF_SYMBOLS
-
-static void
-coff_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
-{
- SYMENT *ext = (SYMENT *) ext1;
- struct internal_syment *in = (struct internal_syment *) in1;
-
- if (ext->e.e_name[0] == 0)
- {
- in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset);
- }
- else
- {
-#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
-#else
- memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
-#endif
- }
- in->n_value = H_GET_32 (abfd, ext->e_value);
- in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
- if (sizeof (ext->e_type) == 2)
- {
- in->n_type = H_GET_16 (abfd, ext->e_type);
- }
- else
- {
- in->n_type = H_GET_32 (abfd, ext->e_type);
- }
- in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
- in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
-#ifdef COFF_ADJUST_SYM_IN_POST
- COFF_ADJUST_SYM_IN_POST (abfd, ext1, in1);
-#endif
-}
-
-static unsigned int
-coff_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
-{
- struct internal_syment *in = (struct internal_syment *) inp;
- SYMENT *ext =(SYMENT *) extp;
-
-#ifdef COFF_ADJUST_SYM_OUT_PRE
- COFF_ADJUST_SYM_OUT_PRE (abfd, inp, extp);
-#endif
-
- if (in->_n._n_name[0] == 0)
- {
- H_PUT_32 (abfd, 0, ext->e.e.e_zeroes);
- H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
- }
- else
- {
-#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
-#else
- memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
-#endif
- }
-
- H_PUT_32 (abfd, in->n_value, ext->e_value);
- H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
-
- if (sizeof (ext->e_type) == 2)
- {
- H_PUT_16 (abfd, in->n_type, ext->e_type);
- }
- else
- {
- H_PUT_32 (abfd, in->n_type, ext->e_type);
- }
-
- H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
- H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
-
-#ifdef COFF_ADJUST_SYM_OUT_POST
- COFF_ADJUST_SYM_OUT_POST (abfd, inp, extp);
-#endif
-
- return SYMESZ;
-}
-
-static void
-coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx;
- int numaux;
- PTR in1;
-{
- AUXENT *ext = (AUXENT *) ext1;
- union internal_auxent *in = (union internal_auxent *) in1;
-
-#ifdef COFF_ADJUST_AUX_IN_PRE
- COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, class, indx, numaux, in1);
-#endif
-
- switch (class)
- {
- case C_FILE:
- if (ext->x_file.x_fname[0] == 0)
- {
- in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
- }
- else
- {
-#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
-#else
- if (numaux > 1)
- {
- if (indx == 0)
- memcpy (in->x_file.x_fname, ext->x_file.x_fname,
- numaux * sizeof (AUXENT));
- }
- else
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
-#endif
- }
- goto end;
-
- case C_STAT:
-#ifdef C_LEAFSTAT
- case C_LEAFSTAT:
-#endif
- case C_HIDDEN:
- if (type == T_NULL)
- {
- in->x_scn.x_scnlen = GET_SCN_SCNLEN (abfd, ext);
- in->x_scn.x_nreloc = GET_SCN_NRELOC (abfd, ext);
- in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext);
-
- /* PE defines some extra fields; we zero them out for
- safety. */
- in->x_scn.x_checksum = 0;
- in->x_scn.x_associated = 0;
- in->x_scn.x_comdat = 0;
-
- goto end;
- }
- break;
- }
-
- in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx);
-#ifndef NO_TVNDX
- in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
-#endif
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext);
- in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext);
- }
- else
- {
-#if DIMNUM != E_DIMNUM
-#error we need to cope with truncating or extending DIMNUM
-#endif
- in->x_sym.x_fcnary.x_ary.x_dimen[0] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- in->x_sym.x_fcnary.x_ary.x_dimen[1] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- in->x_sym.x_fcnary.x_ary.x_dimen[2] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- in->x_sym.x_fcnary.x_ary.x_dimen[3] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
- }
-
- if (ISFCN (type))
- {
- in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
- }
- else
- {
- in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext);
- in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE (abfd, ext);
- }
-
- end: ;
-
-#ifdef COFF_ADJUST_AUX_IN_POST
- COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1);
-#endif
-}
-
-static unsigned int
-coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd *abfd;
- PTR inp;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR extp;
-{
- union internal_auxent *in = (union internal_auxent *) inp;
- AUXENT *ext = (AUXENT *) extp;
-
-#ifdef COFF_ADJUST_AUX_OUT_PRE
- COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp);
-#endif
-
- memset ((PTR)ext, 0, AUXESZ);
-
- switch (class)
- {
- case C_FILE:
- if (in->x_file.x_fname[0] == 0)
- {
- H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
- H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
- }
- else
- {
-#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
-#else
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
-#endif
- }
- goto end;
-
- case C_STAT:
-#ifdef C_LEAFSTAT
- case C_LEAFSTAT:
-#endif
- case C_HIDDEN:
- if (type == T_NULL)
- {
- PUT_SCN_SCNLEN (abfd, in->x_scn.x_scnlen, ext);
- PUT_SCN_NRELOC (abfd, in->x_scn.x_nreloc, ext);
- PUT_SCN_NLINNO (abfd, in->x_scn.x_nlinno, ext);
- goto end;
- }
- break;
- }
-
- H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx);
-#ifndef NO_TVNDX
- H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
-#endif
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
- PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
- }
- else
- {
-#if DIMNUM != E_DIMNUM
-#error we need to cope with truncating or extending DIMNUM
-#endif
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
- ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
- ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
- ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
- ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
- }
-
- if (ISFCN (type))
- H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
- else
- {
- PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext);
- PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext);
- }
-
- end:
-#ifdef COFF_ADJUST_AUX_OUT_POST
- COFF_ADJUST_AUX_OUT_POST (abfd, inp, type, class, indx, numaux, extp);
-#endif
- return AUXESZ;
-}
-
-#endif /* NO_COFF_SYMBOLS */
-
-#ifndef NO_COFF_LINENOS
-
-static void
-coff_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
-{
- LINENO *ext = (LINENO *) ext1;
- struct internal_lineno *in = (struct internal_lineno *) in1;
-
- in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx);
- in->l_lnno = GET_LINENO_LNNO (abfd, ext);
-}
-
-static unsigned int
-coff_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
-{
- struct internal_lineno *in = (struct internal_lineno *) inp;
- struct external_lineno *ext = (struct external_lineno *) outp;
- H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
-
- PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
- return LINESZ;
-}
-
-#endif /* NO_COFF_LINENOS */
-
-static void
-coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
- bfd *abfd;
- PTR aouthdr_ext1;
- PTR aouthdr_int1;
-{
- AOUTHDR *aouthdr_ext;
- struct internal_aouthdr *aouthdr_int;
-
- aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
- aouthdr_int = (struct internal_aouthdr *) aouthdr_int1;
- aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
- aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp);
- aouthdr_int->tsize = GET_AOUTHDR_TSIZE (abfd, aouthdr_ext->tsize);
- aouthdr_int->dsize = GET_AOUTHDR_DSIZE (abfd, aouthdr_ext->dsize);
- aouthdr_int->bsize = GET_AOUTHDR_BSIZE (abfd, aouthdr_ext->bsize);
- aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry);
- aouthdr_int->text_start =
- GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start);
- aouthdr_int->data_start =
- GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
-
-#ifdef I960
- aouthdr_int->tagentries = H_GET_32 (abfd, aouthdr_ext->tagentries);
-#endif
-
-#ifdef APOLLO_M68
- H_PUT_32 (abfd, aouthdr_int->o_inlib, aouthdr_ext->o_inlib);
- H_PUT_32 (abfd, aouthdr_int->o_sri, aouthdr_ext->o_sri);
- H_PUT_32 (abfd, aouthdr_int->vid[0], aouthdr_ext->vid);
- H_PUT_32 (abfd, aouthdr_int->vid[1], aouthdr_ext->vid + 4);
-#endif
-
-#ifdef RS6000COFF_C
-#ifdef XCOFF64
- aouthdr_int->o_toc = H_GET_64 (abfd, aouthdr_ext->o_toc);
-#else
- aouthdr_int->o_toc = H_GET_32 (abfd, aouthdr_ext->o_toc);
-#endif
- aouthdr_int->o_snentry = H_GET_16 (abfd, aouthdr_ext->o_snentry);
- aouthdr_int->o_sntext = H_GET_16 (abfd, aouthdr_ext->o_sntext);
- aouthdr_int->o_sndata = H_GET_16 (abfd, aouthdr_ext->o_sndata);
- aouthdr_int->o_sntoc = H_GET_16 (abfd, aouthdr_ext->o_sntoc);
- aouthdr_int->o_snloader = H_GET_16 (abfd, aouthdr_ext->o_snloader);
- aouthdr_int->o_snbss = H_GET_16 (abfd, aouthdr_ext->o_snbss);
- aouthdr_int->o_algntext = H_GET_16 (abfd, aouthdr_ext->o_algntext);
- aouthdr_int->o_algndata = H_GET_16 (abfd, aouthdr_ext->o_algndata);
- aouthdr_int->o_modtype = H_GET_16 (abfd, aouthdr_ext->o_modtype);
- aouthdr_int->o_cputype = H_GET_16 (abfd, aouthdr_ext->o_cputype);
-#ifdef XCOFF64
- aouthdr_int->o_maxstack = H_GET_64 (abfd, aouthdr_ext->o_maxstack);
- aouthdr_int->o_maxdata = H_GET_64 (abfd, aouthdr_ext->o_maxdata);
-#else
- aouthdr_int->o_maxstack = H_GET_32 (abfd, aouthdr_ext->o_maxstack);
- aouthdr_int->o_maxdata = H_GET_32 (abfd, aouthdr_ext->o_maxdata);
-#endif
-#endif
-
-#ifdef MIPSECOFF
- aouthdr_int->bss_start = H_GET_32 (abfd, aouthdr_ext->bss_start);
- aouthdr_int->gp_value = H_GET_32 (abfd, aouthdr_ext->gp_value);
- aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
- aouthdr_int->cprmask[0] = H_GET_32 (abfd, aouthdr_ext->cprmask[0]);
- aouthdr_int->cprmask[1] = H_GET_32 (abfd, aouthdr_ext->cprmask[1]);
- aouthdr_int->cprmask[2] = H_GET_32 (abfd, aouthdr_ext->cprmask[2]);
- aouthdr_int->cprmask[3] = H_GET_32 (abfd, aouthdr_ext->cprmask[3]);
-#endif
-
-#ifdef ALPHAECOFF
- aouthdr_int->bss_start = H_GET_64 (abfd, aouthdr_ext->bss_start);
- aouthdr_int->gp_value = H_GET_64 (abfd, aouthdr_ext->gp_value);
- aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
- aouthdr_int->fprmask = H_GET_32 (abfd, aouthdr_ext->fprmask);
-#endif
-}
-
-static unsigned int
-coff_swap_aouthdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
-{
- struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
- AOUTHDR *aouthdr_out = (AOUTHDR *) out;
-
- H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->magic);
- H_PUT_16 (abfd, aouthdr_in->vstamp, aouthdr_out->vstamp);
- PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, aouthdr_out->tsize);
- PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, aouthdr_out->dsize);
- PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, aouthdr_out->bsize);
- PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, aouthdr_out->entry);
- PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
- aouthdr_out->text_start);
- PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
- aouthdr_out->data_start);
-
-#ifdef I960
- H_PUT_32 (abfd, aouthdr_in->tagentries, aouthdr_out->tagentries);
-#endif
-
-#ifdef RS6000COFF_C
-#ifdef XCOFF64
- H_PUT_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
-#else
- H_PUT_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
-#endif
- H_PUT_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry);
- H_PUT_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext);
- H_PUT_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata);
- H_PUT_16 (abfd, aouthdr_in->o_sntoc, aouthdr_out->o_sntoc);
- H_PUT_16 (abfd, aouthdr_in->o_snloader, aouthdr_out->o_snloader);
- H_PUT_16 (abfd, aouthdr_in->o_snbss, aouthdr_out->o_snbss);
- H_PUT_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext);
- H_PUT_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata);
- H_PUT_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype);
- H_PUT_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype);
-#ifdef XCOFF64
- H_PUT_64 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
- H_PUT_64 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
-#else
- H_PUT_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
- H_PUT_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
-#endif
- memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2);
-#ifdef XCOFF64
- memset (aouthdr_out->o_debugger, 0, sizeof aouthdr_out->o_debugger);
- memset (aouthdr_out->o_resv3, 0, sizeof aouthdr_out->o_resv3);
-#endif
-#endif
-
-#ifdef MIPSECOFF
- H_PUT_32 (abfd, aouthdr_in->bss_start, aouthdr_out->bss_start);
- H_PUT_32 (abfd, aouthdr_in->gp_value, aouthdr_out->gp_value);
- H_PUT_32 (abfd, aouthdr_in->gprmask, aouthdr_out->gprmask);
- H_PUT_32 (abfd, aouthdr_in->cprmask[0], aouthdr_out->cprmask[0]);
- H_PUT_32 (abfd, aouthdr_in->cprmask[1], aouthdr_out->cprmask[1]);
- H_PUT_32 (abfd, aouthdr_in->cprmask[2], aouthdr_out->cprmask[2]);
- H_PUT_32 (abfd, aouthdr_in->cprmask[3], aouthdr_out->cprmask[3]);
-#endif
-
-#ifdef ALPHAECOFF
- /* FIXME: What does bldrev mean? */
- H_PUT_16 (abfd, 2, aouthdr_out->bldrev);
- H_PUT_16 (abfd, 0, aouthdr_out->padding);
- H_PUT_64 (abfd, aouthdr_in->bss_start, aouthdr_out->bss_start);
- H_PUT_64 (abfd, aouthdr_in->gp_value, aouthdr_out->gp_value);
- H_PUT_32 (abfd, aouthdr_in->gprmask, aouthdr_out->gprmask);
- H_PUT_32 (abfd, aouthdr_in->fprmask, aouthdr_out->fprmask);
-#endif
-
- return AOUTSZ;
-}
-
-static void
-coff_swap_scnhdr_in (abfd, ext, in)
- bfd *abfd;
- PTR ext;
- PTR in;
-{
- SCNHDR *scnhdr_ext = (SCNHDR *) ext;
- struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
-
-#ifdef COFF_ADJUST_SCNHDR_IN_PRE
- COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in);
-#endif
- memcpy (scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
-
- scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
- scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
- scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
-
- scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
- scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
- scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr);
- scnhdr_int->s_flags = GET_SCNHDR_FLAGS (abfd, scnhdr_ext->s_flags);
- scnhdr_int->s_nreloc = GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc);
- scnhdr_int->s_nlnno = GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
-#ifdef I960
- scnhdr_int->s_align = GET_SCNHDR_ALIGN (abfd, scnhdr_ext->s_align);
-#endif
-#ifdef COFF_ADJUST_SCNHDR_IN_POST
- COFF_ADJUST_SCNHDR_IN_POST (abfd, ext, in);
-#endif
-}
-
-static unsigned int
-coff_swap_scnhdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
-{
- struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
- SCNHDR *scnhdr_ext = (SCNHDR *) out;
- unsigned int ret = bfd_coff_scnhsz (abfd);
-
-#ifdef COFF_ADJUST_SCNHDR_OUT_PRE
- COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
-#endif
- memcpy (scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
-
- PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, scnhdr_ext->s_vaddr);
- PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, scnhdr_ext->s_paddr);
- PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, scnhdr_ext->s_size);
- PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, scnhdr_ext->s_scnptr);
- PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr);
- PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr);
- PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
-#if defined(M88)
- H_PUT_32 (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
- H_PUT_32 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
-#else
- if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
- PUT_SCNHDR_NLNNO (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
- else
- {
- char buf[sizeof (scnhdr_int->s_name) + 1];
-
- memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
- buf[sizeof (scnhdr_int->s_name)] = '\0';
- (*_bfd_error_handler)
- (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
- bfd_get_filename (abfd),
- buf, scnhdr_int->s_nlnno);
- PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
- }
-
- if (scnhdr_int->s_nreloc <= MAX_SCNHDR_NRELOC)
- PUT_SCNHDR_NRELOC (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
- else
- {
- char buf[sizeof (scnhdr_int->s_name) + 1];
-
- memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
- buf[sizeof (scnhdr_int->s_name)] = '\0';
- (*_bfd_error_handler) (_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
- bfd_get_filename (abfd),
- buf, scnhdr_int->s_nreloc);
- bfd_set_error (bfd_error_file_truncated);
- PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc);
- ret = 0;
- }
-#endif
-
-#ifdef I960
- PUT_SCNHDR_ALIGN (abfd, scnhdr_int->s_align, scnhdr_ext->s_align);
-#endif
-#ifdef COFF_ADJUST_SCNHDR_OUT_POST
- COFF_ADJUST_SCNHDR_OUT_POST (abfd, in, out);
-#endif
- return ret;
-}
diff --git a/contrib/binutils/bfd/config.bfd b/contrib/binutils/bfd/config.bfd
deleted file mode 100755
index 1428831..0000000
--- a/contrib/binutils/bfd/config.bfd
+++ /dev/null
@@ -1,1341 +0,0 @@
-# config.bfd
-# Convert a canonical host type into a BFD host type.
-# Set shell variable targ to canonical target name, and run
-# using ``. config.bfd''.
-# Sets the following shell variables:
-# targ_defvec Default vector for this target
-# targ_selvecs Vectors to build for this target
-# targ64_selvecs Vectors to build if --enable-64-bit-bfd is given
-# or if host is 64 bit.
-# targ_archs Architectures for this target
-# targ_cflags $(CFLAGS) for this target (FIXME: pretty bogus)
-# targ_underscore Whether underscores are used: yes or no
-
-# Part of this file is processed by targmatch.sed to generate the
-# targmatch.h file. The #ifdef and #endif lines that appear below are
-# copied directly into targmatch.h.
-
-# The binutils c++filt program wants to know whether underscores are
-# stripped or not. That is why we set targ_underscore. c++filt uses
-# this information to choose a default. This information is
-# duplicated in the symbol_leading_char field of the BFD target
-# vector, but c++filt does not deal with object files and is not
-# linked against libbfd.a. It is not terribly important that c++filt
-# get this right; it is just convenient.
-
-targ_defvec=
-targ_selvecs=
-targ64_selvecs=
-targ_cflags=
-targ_underscore=no
-
-# Catch obsolete configurations.
-case $targ in
- vax-*-vms* \
- )
- if test "x$enable_obsolete" != xyes; then
- echo "*** Configuration $targ is obsolete." >&2
- echo "*** Specify --enable-obsolete to build it anyway." >&2
- echo "*** Support will be REMOVED in the next major release of BINUTILS," >&2
- echo "*** unless a maintainer comes forward." >&2
- exit 1
- fi;;
-esac
-
-
-targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-case "${targ_cpu}" in
-alpha*) targ_archs=bfd_alpha_arch ;;
-arm*) targ_archs=bfd_arm_arch ;;
-c30*) targ_archs=bfd_tic30_arch ;;
-c4x*) targ_archs=bfd_tic4x_arch ;;
-c54x*) targ_archs=bfd_tic54x_arch ;;
-dlx*) targ_archs=bfd_dlx_arch ;;
-hppa*) targ_archs=bfd_hppa_arch ;;
-i[3-7]86) targ_archs=bfd_i386_arch ;;
-i370) targ_archs=bfd_i370_arch ;;
-m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
-m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
-m68*) targ_archs=bfd_m68k_arch ;;
-m88*) targ_archs=bfd_m88k_arch ;;
-mips*) targ_archs=bfd_mips_arch ;;
-or32*) targ_archs=bfd_or32_arch ;;
-pdp11*) targ_archs=bfd_pdp11_arch ;;
-pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
-powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
-rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
-s390*) targ_archs=bfd_s390_arch ;;
-sh*) targ_archs=bfd_sh_arch ;;
-sparc*) targ_archs=bfd_sparc_arch ;;
-strongarm*) targ_archs=bfd_arm_arch ;;
-thumb*) targ_archs=bfd_arm_arch ;;
-v850*) targ_archs=bfd_v850_arch ;;
-x86_64) targ_archs=bfd_i386_arch ;;
-xscale*) targ_archs=bfd_arm_arch ;;
-xtensa*) targ_archs=bfd_xtensa_arch ;;
-z8k*) targ_archs=bfd_z8k_arch ;;
-am33_2.0) targ_archs=bfd_mn10300_arch ;;
-*) targ_archs=bfd_${targ_cpu}_arch ;;
-esac
-
-
-# WHEN ADDING ENTRIES TO THIS MATRIX:
-# Make sure that the left side always has two dashes. Otherwise you
-# can get spurious matches. Even for unambiguous cases, do this as a
-# convention, else the table becomes a real mess to understand and maintain.
-#
-# Keep obsolete entries above the START comment, to keep them out of
-# targmatch.h.
-
-case "${targ}" in
- mips*-dec-bsd*)
- echo "This target is obsolete and has been removed."
- exit 1
- ;;
-
- mips*-*-mach3*)
- echo "This target is obsolete and has been removed."
- exit 1
- ;;
-
- mips*-*-pe*)
- echo "This target is obsolete and has been removed."
- exit 1
- ;;
-
-# START OF targmatch.h
-#ifdef BFD64
- alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
- targ_defvec=bfd_elf64_alpha_freebsd_vec
- targ_selvecs=ecoffalpha_little_vec
- # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
- case "${targ}" in
- alpha*-*-freebsd3* | alpha*-*-freebsd4 | alpha*-*-freebsd4.0*)
- targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
- esac
- ;;
- alpha*-*-netbsd* | alpha*-*-openbsd*)
- targ_defvec=bfd_elf64_alpha_vec
- targ_selvecs=ecoffalpha_little_vec
- ;;
- alpha*-*-netware*)
- targ_defvec=ecoffalpha_little_vec
- targ_selvecs=nlm32_alpha_vec
- ;;
- alpha*-*-linuxecoff*)
- targ_defvec=ecoffalpha_little_vec
- targ_selvecs=bfd_elf64_alpha_vec
- ;;
- alpha*-*-linux-gnu* | alpha*-*-elf*)
- targ_defvec=bfd_elf64_alpha_vec
- targ_selvecs=ecoffalpha_little_vec
- ;;
- alpha*-*-*vms*)
- targ_defvec=vms_alpha_vec
- ;;
- alpha*-*-*)
- targ_defvec=ecoffalpha_little_vec
- ;;
- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
- targ_defvec=bfd_elf64_ia64_little_vec
- targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
- ;;
- ia64*-*-hpux*)
- targ_defvec=bfd_elf32_ia64_hpux_big_vec
- targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
- ;;
- sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd* | sparc64-*-kfreebsd*-gnu)
- targ_defvec=bfd_elf64_sparc_vec
- targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
- ;;
-#endif /* BFD64 */
-
- am33_2.0-*-linux*)
- targ_defvec=bfd_elf32_am33lin_vec
- ;;
- arc-*-elf*)
- targ_defvec=bfd_elf32_littlearc_vec
- targ_selvecs=bfd_elf32_bigarc_vec
- ;;
-
- armeb-*-netbsdelf*)
- targ_defvec=bfd_elf32_bigarm_vec
- targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec"
- ;;
- arm-*-netbsdelf*)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs="bfd_elf32_bigarm_vec armnetbsd_vec"
- ;;
- arm-*-netbsd* | arm-*-openbsd*)
- targ_defvec=armnetbsd_vec
- targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
- targ_underscore=yes
- targ_cflags=-D__QNXTARGET__
- ;;
- arm-*-nto* | nto*arm*)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- arm-*-riscix*)
- targ_defvec=riscix_vec
- ;;
- arm-epoc-pe*)
- targ_defvec=arm_epoc_pe_little_vec
- targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
- targ_underscore=no
- targ_cflags=-DARM_COFF_BUGFIX
- ;;
- arm-wince-pe | arm-*-wince)
- targ_defvec=armpe_little_vec
- targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
- targ_underscore=no
- targ_cflags="-DARM_WINCE -DARM_COFF_BUGFIX"
- ;;
- arm-*-pe*)
- targ_defvec=armpe_little_vec
- targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
- targ_underscore=yes
- ;;
- arm-*-aout | armel-*-aout)
- targ_defvec=aout_arm_little_vec
- targ_selvecs=aout_arm_big_vec
- ;;
- armeb-*-aout)
- targ_defvec=aout_arm_big_vec
- targ_selvecs=aout_arm_little_vec
- ;;
- arm-*-coff)
- targ_defvec=armcoff_little_vec
- targ_selvecs=armcoff_big_vec
- targ_underscore=yes
- ;;
- arm-*-rtems*)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- armeb-*-elf | arm*b-*-linux-gnu*)
- targ_defvec=bfd_elf32_bigarm_vec
- targ_selvecs=bfd_elf32_littlearm_vec
- ;;
- arm-*-kaos* | strongarm-*-kaos*)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
- arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- arm9e-*-elf)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- arm-*-oabi)
- targ_defvec=bfd_elf32_littlearm_oabi_vec
- targ_selvecs=bfd_elf32_bigarm_oabi_vec
- ;;
-
- thumb-*-coff)
- targ_defvec=armcoff_little_vec
- targ_selvecs=armcoff_big_vec
- targ_underscore=yes
- ;;
- thumb-*-oabi)
- targ_defvec=bfd_elf32_littlearm_oabi_vec
- targ_selvecs=bfd_elf32_bigarm_oabi_vec
- ;;
- thumb-*-elf)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- thumb-epoc-pe*)
- targ_defvec=arm_epoc_pe_little_vec
- targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
- targ_underscore=no
- ;;
- thumb-*-pe*)
- targ_defvec=armpe_little_vec
- targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
- targ_underscore=yes
- ;;
- strongarm-*-elf)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- strongarm-*-coff)
- targ_defvec=armcoff_little_vec
- targ_selvecs=armcoff_big_vec
- targ_underscore=yes
- ;;
- xscale-*-elf)
- targ_defvec=bfd_elf32_littlearm_vec
- targ_selvecs=bfd_elf32_bigarm_vec
- ;;
- xscale-*-coff)
- targ_defvec=armcoff_little_vec
- targ_selvecs=armcoff_big_vec
- targ_underscore=yes
- ;;
-
- a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \
- a29k-*-vxworks* | a29k-*-sysv* | a29k-*rtems*)
- targ_defvec=a29kcoff_big_vec
- targ_selvecs=sunos_big_vec
- targ_underscore=yes
- ;;
- a29k-*-aout* | a29k-*-bsd* | a29k-*-vsta*)
- targ_defvec=sunos_big_vec
- targ_underscore=yes
- ;;
-
- avr-*-*)
- targ_defvec=bfd_elf32_avr_vec
- ;;
-
- c30-*-*aout* | tic30-*-*aout*)
- targ_defvec=tic30_aout_vec
- ;;
- c30-*-*coff* | tic30-*-*coff*)
- targ_defvec=tic30_coff_vec
- ;;
-
- c4x-*-*coff* | tic4x-*-*coff* | tic4x-*-rtems*)
- targ_defvec=tic4x_coff1_vec
- targ_selvecs="tic4x_coff1_beh_vec tic4x_coff2_vec tic4x_coff2_beh_vec tic4x_coff0_vec tic4x_coff0_beh_vec"
- targ_underscore=yes
- ;;
-
- c54x*-*-*coff* | tic54x-*-*coff*)
- targ_defvec=tic54x_coff1_vec
- targ_selvecs="tic54x_coff1_beh_vec tic54x_coff2_vec tic54x_coff2_beh_vec tic54x_coff0_vec tic54x_coff0_beh_vec"
- targ_underscore=yes
- ;;
-
- cris-*-*)
- targ_defvec=cris_aout_vec
- targ_selvecs="bfd_elf32_us_cris_vec bfd_elf32_cris_vec ieee_vec"
- targ_underscore=yes # Note: not true for bfd_elf32_cris_vec.
- ;;
-
- d10v-*-*)
- targ_defvec=bfd_elf32_d10v_vec
- ;;
-
- dlx-*-elf*)
- targ_defvec=bfd_elf32_dlx_big_vec
- targ_selvecs="bfd_elf32_dlx_big_vec"
- ;;
-
- d30v-*-*)
- targ_defvec=bfd_elf32_d30v_vec
- ;;
-
- fr30-*-elf)
- targ_defvec=bfd_elf32_fr30_vec
- ;;
-
- frv-*-elf)
- targ_defvec=bfd_elf32_frv_vec
- targ_selvecs=bfd_elf32_frvfdpic_vec
- ;;
-
- frv-*-*linux*)
- targ_defvec=bfd_elf32_frvfdpic_vec
- targ_selvecs=bfd_elf32_frv_vec
- ;;
-
- h8300*-*-elf)
- targ_defvec=bfd_elf32_h8300_vec
- targ_underscore=yes
- ;;
-
- h8300*-*-*)
- targ_defvec=h8300coff_vec
- targ_underscore=yes
- ;;
-
- h8500-*-*)
- targ_defvec=h8500coff_vec
- targ_underscore=yes
- ;;
-
-#ifdef BFD64
- hppa*64*-*-linux-gnu*)
- targ_defvec=bfd_elf64_hppa_linux_vec
- targ_selvecs=bfd_elf64_hppa_vec
- ;;
- hppa*64*-*-hpux11*)
- targ_defvec=bfd_elf64_hppa_vec
- targ_selvecs=bfd_elf64_hppa_linux_vec
- targ_cflags=-DHPUX_LARGE_AR_IDS
- ;;
-#endif
-
- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
- targ_defvec=bfd_elf32_hppa_linux_vec
- targ_selvecs=bfd_elf32_hppa_vec
- ;;
- hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
- targ_defvec=bfd_elf32_hppa_vec
- targ_selvecs=bfd_elf32_hppa_linux_vec
- ;;
-
-#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined (HOST_HPPAMPEIX)
- hppa*-*-bsd*)
- targ_defvec=som_vec
- targ_selvecs=bfd_elf32_hppa_vec
- ;;
- hppa*-*-hpux* | hppa*-*-hiux* | hppa*-*-mpeix*)
- targ_defvec=som_vec
- ;;
- hppa*-*-osf*)
- targ_defvec=som_vec
- targ_selvecs=bfd_elf32_hppa_vec
- ;;
-#endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
-
- i370-*-*)
- targ_defvec=bfd_elf32_i370_vec
- targ_selvecs="bfd_elf32_i370_vec"
- ;;
- i[3-7]86-*-sco3.2v5*coff)
- targ_defvec=i386coff_vec
- targ_selvecs=bfd_elf32_i386_vec
- ;;
- i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | i[3-7]86-*-solaris2* | \
- i[3-7]86-*-elf | i[3-7]86-*-sco3.2v5* | \
- i[3-7]86-*-dgux* | i[3-7]86-*-sysv5*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs=i386coff_vec
- ;;
- i[3-7]86-*-kaos*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs=bfd_elf32_i386_vec
- ;;
- i[3-7]86-*-nto*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs=i386coff_vec
- ;;
- i[3-7]86-*-aros*)
- targ_defvec=bfd_elf32_i386_vec
- ;;
- i[3-7]86-*-chorus*)
- targ_defvec=bfd_elf32_i386_vec
- ;;
- *-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* )
- targ_defvec=go32coff_vec
- targ_selvecs="go32stubbedcoff_vec i386aout_vec"
- ;;
- i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \
- i[3-7]86-*-aix*)
- targ_defvec=i386coff_vec
- ;;
- i[3-7]86*-*-rtemscoff*)
- targ_defvec=i386coff_vec
- targ_selvecs="bfd_elf32_i386_vec i386aout_vec"
- ;;
- i[3-7]86-*-rtemself* | i[3-7]86-*-rtems*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs="i386coff_vec i386aout_vec"
- ;;
- i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*)
- targ_defvec=mach_o_le_vec
- targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
- targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
- ;;
- i[3-7]86-sequent-bsd*)
- targ_defvec=i386dynix_vec
- targ_underscore=yes
- ;;
- i[3-7]86-*-bsd*)
- targ_defvec=i386bsd_vec
- targ_underscore=yes
- ;;
- i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \
- i[3-7]86-*-freebsd[12])
- targ_defvec=i386freebsd_vec
- targ_selvecs=i386bsd_vec
- targ_underscore=yes
- ;;
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
- targ_defvec=bfd_elf32_i386_freebsd_vec
- targ_selvecs=i386coff_vec
- # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
- case "${targ}" in
- i[3-7]86-*-freebsd3* | i[3-7]86-*-freebsd4 | i[3-7]86-*-freebsd4.0*)
- targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
- esac
- ;;
- i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs=i386netbsd_vec
- targ64_selvecs=bfd_elf64_x86_64_vec
- ;;
- i[3-7]86-*-netbsdpe*)
- targ_defvec=i386pe_vec
- targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
- ;;
- i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \
- i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3])
- targ_defvec=i386netbsd_vec
- targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
- targ_underscore=yes
- ;;
- i[3-7]86-*-openbsd*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs=i386netbsd_vec
- ;;
- i[3-7]86-*-netware*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec"
- ;;
- i[3-7]86-*-linux*aout*)
- targ_defvec=i386linux_vec
- targ_selvecs=bfd_elf32_i386_vec
- targ_underscore=yes
- ;;
- i[3-7]86-*-linux-gnu*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
- targ64_selvecs=bfd_elf64_x86_64_vec
- ;;
-#ifdef BFD64
- x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
- targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
- ;;
- x86_64-*-netbsd* | x86_64-*-openbsd*)
- targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
- ;;
- x86_64-*-linux-gnu*)
- targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
- ;;
-#endif
- i[3-7]86-*-lynxos*)
- targ_defvec=i386lynx_coff_vec
- targ_selvecs=i386lynx_aout_vec
- ;;
- i[3-7]86-*-gnu*)
- targ_defvec=bfd_elf32_i386_vec
- ;;
- i[3-7]86-*-mach* | i[3-7]86-*-osf1mk*)
- targ_defvec=i386mach3_vec
- targ_cflags=-DSTAT_FOR_EXEC
- targ_underscore=yes
- ;;
- i[3-7]86-*-os9k)
- targ_defvec=i386os9k_vec
- ;;
- i[3-7]86-*-msdos*)
- targ_defvec=i386aout_vec
- targ_selvecs=i386msdos_vec
- ;;
- i[3-7]86-*-moss*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs="i386msdos_vec i386aout_vec"
- ;;
- i[3-7]86-*-beospe*)
- targ_defvec=i386pe_vec
- targ_selvecs="i386pe_vec i386pei_vec"
- ;;
- i[3-7]86-*-beoself* | i[3-7]86-*-beos*)
- targ_defvec=bfd_elf32_i386_vec
- targ_selvecs="i386pe_vec i386pei_vec"
- ;;
- i[3-7]86-*-interix*)
- targ_defvec=i386pei_vec
- targ_selvecs="i386pe_vec"
- # FIXME: This should eventually be checked at runtime.
- targ_cflags=-DSTRICT_PE_FORMAT
- ;;
- i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
- targ_defvec=i386pe_vec
- targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
- ;;
- i[3-7]86-none-*)
- targ_defvec=i386coff_vec
- ;;
- i[3-7]86-*-aout* | i[3-7]86*-*-vsta*)
- targ_defvec=i386aout_vec
- ;;
- i[3-7]86-*-vxworks)
- targ_defvec=bfd_elf32_i386_vec
- targ_underscore=yes
- ;;
- i[3-7]86-*-chaos)
- targ_defvec=bfd_elf32_i386_vec
- targ_selfvecs=i386chaos_vec
- ;;
-
- i860-*-mach3* | i860-*-osf1* | i860-*-coff*)
- targ_defvec=i860coff_vec
- ;;
- i860-stardent-sysv4* | i860-stardent-elf*)
- targ_defvec=bfd_elf32_i860_little_vec
- targ_selvecs="bfd_elf32_i860_vec bfd_elf32_i860_little_vec"
- ;;
- i860-*-sysv4* | i860-*-elf*)
- targ_defvec=bfd_elf32_i860_vec
- ;;
-
- i960-*-vxworks4* | i960-*-vxworks5.0)
- targ_defvec=b_out_vec_little_host
- targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec ieee_vec"
- targ_underscore=yes
- ;;
- i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv* | i960-*-rtems*)
- targ_defvec=icoff_little_vec
- targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host ieee_vec"
- targ_underscore=yes
- ;;
- i960-*-vxworks* | i960-*-aout* | i960-*-bout* | i960-*-nindy*)
- targ_defvec=b_out_vec_little_host
- targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec ieee_vec"
- targ_underscore=yes
- ;;
- i960-*-elf*)
- targ_defvec=bfd_elf32_i960_vec
- targ_selvecs="icoff_little_vec icoff_big_vec"
- ;;
-
- ip2k-*-elf)
- targ_defvec=bfd_elf32_ip2k_vec
- ;;
-
- iq2000-*-elf)
- targ_defvec=bfd_elf32_iq2000_vec
- ;;
-
- m32r*le-*-linux*)
- targ_defvec=bfd_elf32_m32rlelin_vec
- targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec"
- ;;
-
- m32r*-*-linux*)
- targ_defvec=bfd_elf32_m32rlin_vec
- targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec"
- ;;
-
- m32r*le-*-*)
- targ_defvec=bfd_elf32_m32rle_vec
- targ_selvecs="bfd_elf32_m32r_vec bfd_elf32_m32rle_vec"
- ;;
-
- m32r-*-*)
- targ_defvec=bfd_elf32_m32r_vec
- ;;
-
- m68hc11-*-* | m6811-*-*)
- targ_defvec=bfd_elf32_m68hc11_vec
- targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec"
- ;;
- m68hc12-*-* | m6812-*-*)
- targ_defvec=bfd_elf32_m68hc12_vec
- targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec"
- ;;
-
- m68*-apollo-*)
- targ_defvec=apollocoff_vec
- ;;
- m68*-bull-sysv*)
- targ_defvec=m68kcoffun_vec
- targ_underscore=yes
- ;;
- m68*-motorola-sysv*)
- targ_defvec=m68ksysvcoff_vec
- ;;
- m68*-hp-bsd*)
- targ_defvec=hp300bsd_vec
- targ_underscore=yes
- ;;
- m68*-*-aout*)
- targ_defvec=aout0_big_vec
- # We include cisco_core_big_vec here, rather than making a separate cisco
- # configuration, so that cisco-core.c gets routinely tested at
- # least for compilation.
- targ_selvecs="cisco_core_big_vec ieee_vec"
- targ_underscore=yes
- ;;
- m68*-*-rtemscoff*)
- targ_defvec=m68kcoff_vec
- targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
- ;;
- m68*-*-elf* | m68*-*-sysv4* | m68*-*-uclinux*)
- targ_defvec=bfd_elf32_m68k_vec
- targ_selvecs="m68kcoff_vec ieee_vec"
- ;;
- m68*-*-rtems*)
- targ_defvec=bfd_elf32_m68k_vec
- targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
- ;;
- m68*-*-coff* | m68*-*-sysv*)
- targ_defvec=m68kcoff_vec
- targ_selvecs="m68kcoff_vec versados_vec ieee_vec"
- ;;
- m68*-*-hpux*)
- targ_defvec=hp300hpux_vec
- targ_underscore=yes
- ;;
- m68*-*-linux*aout*)
- targ_defvec=m68klinux_vec
- targ_selvecs=bfd_elf32_m68k_vec
- targ_underscore=yes
- ;;
- m68*-*-linux-gnu*)
- targ_defvec=bfd_elf32_m68k_vec
- targ_selvecs=m68klinux_vec
- ;;
- m68*-*-gnu*)
- targ_defvec=bfd_elf32_m68k_vec
- # targ_selvecs=m68kmach3_vec
- # targ_cflags=-DSTAT_FOR_EXEC
- ;;
- m68*-*-lynxos*)
- targ_defvec=m68klynx_coff_vec
- targ_selvecs=m68klynx_aout_vec
- ;;
- m68*-hp*-netbsd*)
- targ_defvec=m68k4knetbsd_vec
- targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
- targ_underscore=yes
- ;;
- m68*-*-netbsdelf*)
- targ_defvec=bfd_elf32_m68k_vec
- targ_selvecs="m68knetbsd_vec m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
- ;;
- m68*-*-netbsdaout* | m68*-*-netbsd*)
- targ_defvec=m68knetbsd_vec
- targ_selvecs="m68k4knetbsd_vec bfd_elf32_m68k_vec hp300bsd_vec sunos_big_vec"
- targ_underscore=yes
- ;;
- m68*-*-openbsd*)
- targ_defvec=m68knetbsd_vec
- targ_selvecs="m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
- targ_underscore=yes
- ;;
- m68*-*-sunos* | m68*-*-os68k* | m68*-*-vxworks* | m68*-netx-* | \
- m68*-*-bsd* | m68*-*-vsta*)
- targ_defvec=sunos_big_vec
- targ_underscore=yes
- ;;
- m68*-ericsson-*)
- targ_defvec=sunos_big_vec
- targ_selvecs="m68kcoff_vec versados_vec tekhex_vec"
- targ_underscore=yes
- ;;
- m68*-cbm-*)
- targ_defvec=bfd_elf32_m68k_vec
- targ_selvecs=m68kcoff_vec
- ;;
- m68*-apple-aux*)
- targ_defvec=m68kaux_coff_vec
- ;;
- m68*-*-psos*)
- targ_defvec=bfd_elf32_m68k_vec
- targ_selvecs=ieee_vec
- targ_underscore=yes
- ;;
-
- m88*-harris-cxux* | m88*-*-dgux* | m88*-*-sysv4*)
- targ_defvec=bfd_elf32_m88k_vec
- targ_selvecs=m88kbcs_vec
- ;;
- m88*-*-mach3*)
- targ_defvec=m88kmach3_vec
- targ_cflags=-DSTAT_FOR_EXEC
- ;;
- m88*-*-*)
- targ_defvec=m88kbcs_vec
- targ_underscore=yes
- ;;
-
- mcore-*-elf)
- targ_defvec=bfd_elf32_mcore_big_vec
- targ_selvecs="bfd_elf32_mcore_big_vec bfd_elf32_mcore_little_vec"
- ;;
- mcore-*-pe)
- targ_defvec=mcore_pe_big_vec
- targ_selvecs="mcore_pe_big_vec mcore_pe_little_vec mcore_pei_big_vec mcore_pei_little_vec"
- ;;
-
- mips*-big-*)
- targ_defvec=ecoff_big_vec
- targ_selvecs=ecoff_little_vec
- ;;
- mips*el-*-netbsd*)
- targ_defvec=bfd_elf32_littlemips_vec
- targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
- ;;
- mips*-*-netbsd*)
- targ_defvec=bfd_elf32_bigmips_vec
- targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
- ;;
- mips*-dec-* | mips*el-*-ecoff*)
- targ_defvec=ecoff_little_vec
- targ_selvecs=ecoff_big_vec
- ;;
- mips*-*-ecoff*)
- targ_defvec=ecoff_big_vec
- targ_selvecs=ecoff_little_vec
- ;;
-#ifdef BFD64
- mips*-*-irix6*)
- targ_defvec=bfd_elf32_nbigmips_vec
- targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
- ;;
-#endif
- mips*-*-irix5*)
- targ_defvec=bfd_elf32_bigmips_vec
- targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
- ;;
- mips*-sgi-* | mips*-*-bsd*)
- targ_defvec=ecoff_big_vec
- targ_selvecs=ecoff_little_vec
- ;;
- mips*-*-lnews*)
- targ_defvec=ecoff_biglittle_vec
- targ_selvecs="ecoff_little_vec ecoff_big_vec"
- ;;
- mips*-*-sysv4*)
- targ_defvec=bfd_elf32_tradbigmips_vec
- targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
- ;;
- mips*-*-sysv* | mips*-*-riscos*)
- targ_defvec=ecoff_big_vec
- targ_selvecs=ecoff_little_vec
- ;;
- mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks* | mips*-*-chorus*)
- targ_defvec=bfd_elf32_littlemips_vec
- targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
- ;;
- mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks | mips*-*-windiss)
- targ_defvec=bfd_elf32_bigmips_vec
- targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
- ;;
- mips*-*-none)
- targ_defvec=bfd_elf32_bigmips_vec
- targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
- ;;
- mips*el-*-openbsd*)
- targ_defvec=bfd_elf32_littlemips_vec
- targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
- ;;
- mips*-*-openbsd*)
- targ_defvec=bfd_elf32_bigmips_vec
- targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
- ;;
-#ifdef BFD64
- mips64*el-*-linux*)
- targ_defvec=bfd_elf32_ntradlittlemips_vec
- targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
- ;;
- mips64*-*-linux*)
- targ_defvec=bfd_elf32_ntradbigmips_vec
- targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
- ;;
-#endif
- mips*el-*-linux*)
- targ_defvec=bfd_elf32_tradlittlemips_vec
- targ_selvecs="bfd_elf32_tradbigmips_vec ecoff_little_vec ecoff_big_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec"
- want64=true
- ;;
- mips*-*-linux*)
- targ_defvec=bfd_elf32_tradbigmips_vec
- targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec"
- want64=true
- ;;
-#ifdef BFD64
- mmix-*-*)
- targ_defvec=bfd_elf64_mmix_vec
- targ_selvecs=bfd_mmo_vec
- ;;
-#endif
- mn10200-*-*)
- targ_defvec=bfd_elf32_mn10200_vec
- ;;
-
- mn10300-*-*)
- targ_defvec=bfd_elf32_mn10300_vec
- targ_underscore=yes
- ;;
-
- msp430-*-*)
- targ_defvec=bfd_elf32_msp430_vec
- ;;
-
- ns32k-pc532-mach* | ns32k-pc532-ux*)
- targ_defvec=pc532machaout_vec
- targ_underscore=yes
- ;;
- ns32k-*-netbsd* | ns32k-*-lites* | ns32k-*-openbsd*)
- targ_defvec=pc532netbsd_vec
- targ_underscore=yes
- ;;
-
- openrisc-*-elf)
- targ_defvec=bfd_elf32_openrisc_vec
- ;;
-
- or32-*-coff)
- targ_defvec=or32coff_big_vec
- targ_underscore=yes
- ;;
-
- or32-*-elf | or32-*-rtems*)
- targ_defvec=bfd_elf32_or32_big_vec
- ;;
-
- pdp11-*-*)
- targ_defvec=pdp11_aout_vec
- targ_underscore=yes
- ;;
-
- pj-*-*)
- targ_defvec=bfd_elf32_pj_vec
- targ_selvecs="bfd_elf32_pj_vec bfd_elf32_pjl_vec"
- ;;
-
- pjl-*-*)
- targ_defvec=bfd_elf32_pjl_vec
- targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
- ;;
-
- powerpc-*-aix5.[01])
- targ_defvec=rs6000coff_vec
- targ_selvecs="aix5coff64_vec"
- want64=true
- ;;
-#ifdef BFD64
- powerpc64-*-aix5.[01])
- targ_defvec=aix5coff64_vec
- targ_selvecs="rs6000coff_vec"
- want64=true
- ;;
-#endif
- powerpc-*-aix5*)
- targ_cflags=-DAIX_WEAK_SUPPORT
- targ_defvec=rs6000coff_vec
- targ_selvecs="aix5coff64_vec"
- want64=true
- ;;
-#ifdef BFD64
- powerpc64-*-aix5*)
- targ_cflags=-DAIX_WEAK_SUPPORT
- targ_defvec=aix5coff64_vec
- targ_selvecs="rs6000coff_vec"
- want64=true
- ;;
-#endif
-
- powerpc-*-aix* | powerpc-*-beos* | rs6000-*-*)
- targ_defvec=rs6000coff_vec
- targ64_selvecs=rs6000coff64_vec
- case "${targ}" in
- *-*-aix4.[3456789]* | *-*-aix[56789]*)
- want64=true;;
- *)
- targ_cflags=-DSMALL_ARCHIVE;;
- esac
- ;;
-#ifdef BFD64
- powerpc64-*-aix*)
- targ_defvec=rs6000coff64_vec
- targ_selvecs=rs6000coff_vec
- ;;
- powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux* | \
- powerpc64-*-*bsd*)
- targ_defvec=bfd_elf64_powerpc_vec
- targ_selvecs="bfd_elf64_powerpcle_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec"
- ;;
- powerpc64le-*-elf* | powerpcle-*-elf64*)
- targ_defvec=bfd_elf64_powerpcle_vec
- targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec"
- ;;
-#endif
- powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
- powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
- targ_defvec=bfd_elf32_powerpc_vec
- targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
- targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
- ;;
- powerpc-*-kaos*)
- targ_defvec=bfd_elf32_powerpc_vec
- targ_selvecs="bfd_elf32_powerpcle_vec ppcboot_vec"
- targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
- ;;
- powerpc-*-darwin* | powerpc-*-macos10* | powerpc-*-rhapsody*)
- targ_defvec=mach_o_be_vec
- targ_selvecs="mach_o_be_vec mach_o_le_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
- targ_archs="bfd_powerpc_arch bfd_rs6000_arch bfd_i386_arch"
- ;;
- powerpc-*-macos* | powerpc-*-mpw*)
- targ_defvec=pmac_xcoff_vec
- ;;
- powerpc-*-netware*)
- targ_defvec=bfd_elf32_powerpc_vec
- targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
- ;;
- powerpc-*-nto*)
- targ_defvec=bfd_elf32_powerpc_vec
- targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
- ;;
- powerpcle-*-nto*)
- targ_defvec=bfd_elf32_powerpcle_vec
- targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
- ;;
- powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
- powerpcle-*-rtems*)
- targ_defvec=bfd_elf32_powerpcle_vec
- targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
- targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
- ;;
- powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
- targ_defvec=bfd_powerpcle_pe_vec
- targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
- ;;
-
- s390-*-linux*)
- targ_defvec=bfd_elf32_s390_vec
- targ64_selvecs=bfd_elf64_s390_vec
- ;;
-#ifdef BFD64
- s390x-*-linux*)
- targ_defvec=bfd_elf64_s390_vec
- targ_selvecs=bfd_elf32_s390_vec
- ;;
-#endif
-
-#ifdef BFD64
- sh64l*-*-elf*)
- targ_defvec=bfd_elf32_sh64l_vec
- targ_selvecs="bfd_elf32_sh64_vec bfd_elf64_sh64l_vec bfd_elf64_sh64_vec bfd_elf32_shl_vec bfd_elf32_sh_vec"
- targ_underscore=yes
- ;;
- sh64-*-elf*)
- targ_defvec=bfd_elf32_sh64_vec
- targ_selvecs="bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec bfd_elf32_sh_vec bfd_elf32_shl_vec"
- targ_underscore=yes
- ;;
- sh64eb-*-linux*)
- targ_defvec=bfd_elf32_sh64blin_vec
- targ_selvecs="bfd_elf32_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf32_shblin_vec bfd_elf32_shlin_vec"
- ;;
- sh64-*-linux*)
- targ_defvec=bfd_elf32_sh64lin_vec
- targ_selvecs="bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf32_shlin_vec bfd_elf32_shblin_vec"
- ;;
-#endif /* BFD64 */
-
- sh-*-linux*)
- targ_defvec=bfd_elf32_shblin_vec
- targ_selvecs=bfd_elf32_shlin_vec
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec"
-#endif
- ;;
- sh*eb-*-linux*)
- targ_defvec=bfd_elf32_shblin_vec
- targ_selvecs=bfd_elf32_shlin_vec
- ;;
- sh*-*-linux*)
- targ_defvec=bfd_elf32_shlin_vec
- targ_selvecs=bfd_elf32_shblin_vec
- ;;
-
-#ifdef BFD64
- sh5le-*-netbsd*)
- targ_defvec=bfd_elf32_sh64lnbsd_vec
- targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
- ;;
- sh5-*-netbsd*)
- targ_defvec=bfd_elf32_sh64nbsd_vec
- targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
- ;;
-
- sh64le-*-netbsd*)
- targ_defvec=bfd_elf64_sh64lnbsd_vec
- targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
- ;;
- sh64-*-netbsd*)
- targ_defvec=bfd_elf64_sh64nbsd_vec
- targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
- ;;
-#endif
-
- sh*l*-*-netbsdelf*)
- targ_defvec=bfd_elf32_shlnbsd_vec
- targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
-#endif
- ;;
- sh-*-netbsdelf*)
- targ_defvec=bfd_elf32_shnbsd_vec
- targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
-#endif
- ;;
- sh*-*-netbsdelf*)
- targ_defvec=bfd_elf32_shnbsd_vec
- targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
- ;;
- shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
- targ_defvec=bfd_elf32_shl_vec
- targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
-#endif
- targ_underscore=yes
- ;;
- sh-*-rtemscoff*)
- targ_defvec=shcoff_vec
- targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
- targ_underscore=yes
- ;;
- sh-*-elf* | sh[1234]*-elf* | sh-*-rtems* | sh-*-kaos*)
- targ_defvec=bfd_elf32_sh_vec
- targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
-#endif
- targ_underscore=yes
- ;;
- sh-*-nto*)
- targ_defvec=bfd_elf32_sh_vec
- targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
- targ_underscore=yes
- ;;
- sh-*-pe)
- targ_defvec=shlpe_vec
- targ_selvecs="shlpe_vec shlpei_vec"
- targ_underscore=yes
- ;;
- sh-*-vxworks)
- targ_defvec=bfd_elf32_sh_vec
- targ_selvecs="bfd_elf32_shl_vec"
- # FIXME None of the following are actually used on this target, but
- # they're necessary for coff-sh.c (which is unconditionally used) to be
- # compiled correctly.
- targ_selvecs="$targ_selvecs shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
- ;;
- sh-*-*)
- targ_defvec=shcoff_vec
- targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
- targ_underscore=yes
- ;;
-
- sparclet-*-aout*)
- targ_defvec=sunos_big_vec
- targ_selvecs=sparcle_aout_vec
- targ_underscore=yes
- ;;
- sparc86x-*-aout*)
- targ_defvec=sunos_big_vec
- targ_underscore=yes
- ;;
- sparclite-*-elf* | sparc86x-*-elf*)
- targ_defvec=bfd_elf32_sparc_vec
- ;;
- sparc*-*-chorus*)
- targ_defvec=bfd_elf32_sparc_vec
- ;;
- sparc-*-linux*aout*)
- targ_defvec=sparclinux_vec
- targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
- targ_underscore=yes
- ;;
- sparc-*-linux-gnu*)
- targ_defvec=bfd_elf32_sparc_vec
- targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
- ;;
- sparc-*-lynxos*)
- targ_defvec=sparclynx_coff_vec
- targ_selvecs=sparclynx_aout_vec
- ;;
- sparc-*-netbsdelf*)
- targ_defvec=bfd_elf32_sparc_vec
- targ_selvecs=sparcnetbsd_vec
- ;;
- sparc-*-netbsdaout* | sparc-*-netbsd*)
- targ_defvec=sparcnetbsd_vec
- targ_selvecs=bfd_elf32_sparc_vec
- targ_underscore=yes
- ;;
- sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1])
- targ_defvec=sparcnetbsd_vec
- targ_underscore=yes
- ;;
- sparc-*-openbsd*)
- targ_defvec=bfd_elf32_sparc_vec
- targ_selvecs=sparcnetbsd_vec
- ;;
- sparc-*-elf* | sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
- targ_defvec=bfd_elf32_sparc_vec
- targ_selvecs=sunos_big_vec
- ;;
-#ifdef BFD64
- sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
- targ_defvec=bfd_elf32_sparc_vec
- targ_selvecs="bfd_elf64_sparc_vec sunos_big_vec"
- ;;
-#endif
- sparc-*-sysv4*)
- targ_defvec=bfd_elf32_sparc_vec
- ;;
- sparc-*-netware*)
- targ_defvec=bfd_elf32_sparc_vec
- targ_selvecs="nlm32_sparc_vec sunos_big_vec"
- ;;
-#ifdef BFD64
- sparc64-*-aout*)
- targ_defvec=sunos_big_vec
- targ_underscore=yes
- ;;
- sparc64-*-linux-gnu*)
- targ_defvec=bfd_elf64_sparc_vec
- targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
- ;;
- sparc64-*-elf*)
- targ_defvec=bfd_elf64_sparc_vec
- targ_selvecs=bfd_elf32_sparc_vec
- ;;
-#endif /* BFD64 */
- sparc*-*-coff*)
- targ_defvec=sparccoff_vec
- ;;
- sparc*-*-rtemsaout*)
- targ_defvec=sunos_big_vec
- targ_selvecs="bfd_elf32_sparc_vec sparccoff_vec"
- targ_underscore=yes
- ;;
- sparc*-*-rtems* | sparc*-*-rtemself*)
- targ_defvec=bfd_elf32_sparc_vec
- targ_selvecs="sunos_big_vec sparccoff_vec"
- ;;
- sparc*-*-* | sparc*-*-rtems*)
- targ_defvec=sunos_big_vec
- targ_underscore=yes
- ;;
-
-#if HAVE_host_aout_vec
- tahoe-*-*)
- targ_defvec=host_aout_vec
- targ_underscore=yes
- ;;
-#endif
-
- tic80*-*-*)
- targ_defvec=tic80coff_vec
- targ_underscore=yes
- ;;
-
- v850-*-*)
- targ_defvec=bfd_elf32_v850_vec
- ;;
- v850e-*-*)
- targ_defvec=bfd_elf32_v850_vec
- ;;
- v850ea-*-*)
- targ_defvec=bfd_elf32_v850_vec
- ;;
-
- vax-*-netbsdelf*)
- targ_defvec=bfd_elf32_vax_vec
- targ_selvecs="vaxnetbsd_vec vax1knetbsd_vec"
- ;;
-
- vax-*-netbsdaout* | vax-*-netbsd*)
- targ_defvec=vaxnetbsd_vec
- targ_selvecs="bfd_elf32_vax_vec vax1knetbsd_vec"
- targ_underscore=yes
- ;;
-
- vax-*-bsd* | vax-*-ultrix*)
- targ_defvec=vaxbsd_vec
- targ_underscore=yes
- ;;
-
- vax-*-openbsd*)
- targ_defvec=vaxnetbsd_vec
- targ_underscore=yes
- ;;
-
- vax-*-linux-gnu*)
- targ_defvec=bfd_elf32_vax_vec
- ;;
-
- vax*-*-*vms*)
- targ_defvec=vms_vax_vec
- ;;
-
- we32k-*-*)
- targ_defvec=we32kcoff_vec
- ;;
-
- w65-*-*)
- targ_defvec=w65_vec
- ;;
-
- xstormy16-*-elf)
- targ_defvec=bfd_elf32_xstormy16_vec
- ;;
-
- xtensa-*-*)
- targ_defvec=bfd_elf32_xtensa_le_vec
- targ_selvecs=bfd_elf32_xtensa_be_vec
- ;;
-
- z8k*-*-*)
- targ_defvec=z8kcoff_vec
- targ_underscore=yes
- ;;
-
- *-*-ieee*)
- targ_defvec=ieee_vec
- ;;
-
- *-adobe-*)
- targ_defvec=a_out_adobe_vec
- targ_underscore=yes
- ;;
-
- *-sony-*)
- targ_defvec=newsos3_vec
- targ_underscore=yes
- ;;
-
- *-tandem-*)
- targ_defvec=m68kcoff_vec
- targ_selvecs=ieee_vec
- ;;
-# END OF targmatch.h
- *)
- echo 1>&2 "*** BFD does not support target ${targ}."
- echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
- exit 1
- ;;
-esac
-
-case "${host64}${want64}" in
- *true*)
- targ_selvecs="${targ_selvecs} ${targ64_selvecs}"
- ;;
-esac
-
-# If we support any ELF target, then automatically add support for the
-# generic ELF targets. This permits an objdump with some ELF support
-# to be used on an arbitrary ELF file for anything other than
-# relocation information.
-case "${targ_defvec} ${targ_selvecs}" in
- *bfd_elf64* | *bfd_elf32_n*mips*)
- targ_selvecs="${targ_selvecs} bfd_elf64_little_generic_vec bfd_elf64_big_generic_vec bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec"
- ;;
- *bfd_elf32*)
- targ_selvecs="${targ_selvecs} bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec"
- ;;
-esac
diff --git a/contrib/binutils/bfd/config.in b/contrib/binutils/bfd/config.in
deleted file mode 100644
index ef9eca4..0000000
--- a/contrib/binutils/bfd/config.in
+++ /dev/null
@@ -1,288 +0,0 @@
-/* config.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if using alloca.c. */
-#undef C_ALLOCA
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-#undef CRAY_STACKSEG_END
-
-/* Define if you have alloca, as a function or macro. */
-#undef HAVE_ALLOCA
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-#undef HAVE_ALLOCA_H
-
-/* Define if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
-/* Define as __inline if that's what the C compiler calls it. */
-#undef inline
-
-/* Define to `long' if <sys/types.h> doesn't define. */
-#undef off_t
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-#undef size_t
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-#undef STACK_DIRECTION
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define if you have the __argz_count function. */
-#undef HAVE___ARGZ_COUNT
-
-/* Define if you have the __argz_next function. */
-#undef HAVE___ARGZ_NEXT
-
-/* Define if you have the __argz_stringify function. */
-#undef HAVE___ARGZ_STRINGIFY
-
-/* Define if you have the dcgettext function. */
-#undef HAVE_DCGETTEXT
-
-/* Define if you have the fcntl function. */
-#undef HAVE_FCNTL
-
-/* Define if you have the fdopen function. */
-#undef HAVE_FDOPEN
-
-/* Define if you have the fseeko function. */
-#undef HAVE_FSEEKO
-
-/* Define if you have the fseeko64 function. */
-#undef HAVE_FSEEKO64
-
-/* Define if you have the ftello function. */
-#undef HAVE_FTELLO
-
-/* Define if you have the ftello64 function. */
-#undef HAVE_FTELLO64
-
-/* Define if you have the getcwd function. */
-#undef HAVE_GETCWD
-
-/* Define if you have the getgid function. */
-#undef HAVE_GETGID
-
-/* Define if you have the getpagesize function. */
-#undef HAVE_GETPAGESIZE
-
-/* Define if you have the getuid function. */
-#undef HAVE_GETUID
-
-/* Define if you have the madvise function. */
-#undef HAVE_MADVISE
-
-/* Define if you have the mprotect function. */
-#undef HAVE_MPROTECT
-
-/* Define if you have the munmap function. */
-#undef HAVE_MUNMAP
-
-/* Define if you have the putenv function. */
-#undef HAVE_PUTENV
-
-/* Define if you have the setenv function. */
-#undef HAVE_SETENV
-
-/* Define if you have the setitimer function. */
-#undef HAVE_SETITIMER
-
-/* Define if you have the setlocale function. */
-#undef HAVE_SETLOCALE
-
-/* Define if you have the stpcpy function. */
-#undef HAVE_STPCPY
-
-/* Define if you have the strcasecmp function. */
-#undef HAVE_STRCASECMP
-
-/* Define if you have the strchr function. */
-#undef HAVE_STRCHR
-
-/* Define if you have the strtoull function. */
-#undef HAVE_STRTOULL
-
-/* Define if you have the sysconf function. */
-#undef HAVE_SYSCONF
-
-/* Define if you have the <argz.h> header file. */
-#undef HAVE_ARGZ_H
-
-/* Define if you have the <dirent.h> header file. */
-#undef HAVE_DIRENT_H
-
-/* Define if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
-/* Define if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
-/* Define if you have the <ndir.h> header file. */
-#undef HAVE_NDIR_H
-
-/* Define if you have the <nl_types.h> header file. */
-#undef HAVE_NL_TYPES_H
-
-/* Define if you have the <stddef.h> header file. */
-#undef HAVE_STDDEF_H
-
-/* Define if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define if you have the <sys/dir.h> header file. */
-#undef HAVE_SYS_DIR_H
-
-/* Define if you have the <sys/file.h> header file. */
-#undef HAVE_SYS_FILE_H
-
-/* Define if you have the <sys/ndir.h> header file. */
-#undef HAVE_SYS_NDIR_H
-
-/* Define if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define if you have the <sys/procfs.h> header file. */
-#undef HAVE_SYS_PROCFS_H
-
-/* Define if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if you have the <values.h> header file. */
-#undef HAVE_VALUES_H
-
-/* Name of package */
-#undef PACKAGE
-
-/* Version number of package */
-#undef VERSION
-
-/* Define if you have the stpcpy function */
-#undef HAVE_STPCPY
-
-/* Define if your locale.h file contains LC_MESSAGES. */
-#undef HAVE_LC_MESSAGES
-
-/* Define to 1 if NLS is requested */
-#undef ENABLE_NLS
-
-/* Define as 1 if you have gettext and don't want to use GNU gettext. */
-#undef HAVE_GETTEXT
-
-/* The number of bytes in type long long */
-#undef SIZEOF_LONG_LONG
-
-/* The number of bytes in type long */
-#undef SIZEOF_LONG
-
-/* Use b modifier when opening binary files? */
-#undef USE_BINARY_FOPEN
-
-/* Define if strstr is not declared in system header files. */
-#undef NEED_DECLARATION_STRSTR
-
-/* Define if malloc is not declared in system header files. */
-#undef NEED_DECLARATION_MALLOC
-
-/* Define if realloc is not declared in system header files. */
-#undef NEED_DECLARATION_REALLOC
-
-/* Define if free is not declared in system header files. */
-#undef NEED_DECLARATION_FREE
-
-/* Define if getenv is not declared in system header files. */
-#undef NEED_DECLARATION_GETENV
-
-/* Define if struct core_dumpx has member c_impl */
-#undef HAVE_ST_C_IMPL
-
-/* Define if <sys/procfs.h> has prstatus_t. */
-#undef HAVE_PRSTATUS_T
-
-/* Define if <sys/procfs.h> has prstatus32_t. */
-#undef HAVE_PRSTATUS32_T
-
-/* Define if <sys/procfs.h> has prstatus_t.pr_who. */
-#undef HAVE_PRSTATUS_T_PR_WHO
-
-/* Define if <sys/procfs.h> has prstatus32_t.pr_who. */
-#undef HAVE_PRSTATUS32_T_PR_WHO
-
-/* Define if <sys/procfs.h> has pstatus_t. */
-#undef HAVE_PSTATUS_T
-
-/* Define if <sys/procfs.h> has pxstatus_t. */
-#undef HAVE_PXSTATUS_T
-
-/* Define if <sys/procfs.h> has pstatus32_t. */
-#undef HAVE_PSTATUS32_T
-
-/* Define if <sys/procfs.h> has prpsinfo_t. */
-#undef HAVE_PRPSINFO_T
-
-/* Define if <sys/procfs.h> has prpsinfo32_t. */
-#undef HAVE_PRPSINFO32_T
-
-/* Define if <sys/procfs.h> has psinfo_t. */
-#undef HAVE_PSINFO_T
-
-/* Define if <sys/procfs.h> has psinfo32_t. */
-#undef HAVE_PSINFO32_T
-
-/* Define if <sys/procfs.h> has lwpstatus_t. */
-#undef HAVE_LWPSTATUS_T
-
-/* Define if <sys/procfs.h> has lwpxstatus_t. */
-#undef HAVE_LWPXSTATUS_T
-
-/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
-#undef HAVE_LWPSTATUS_T_PR_CONTEXT
-
-/* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
-#undef HAVE_LWPSTATUS_T_PR_REG
-
-/* Define if <sys/procfs.h> has win32_pstatus_t. */
-#undef HAVE_WIN32_PSTATUS_T
-
-/* Name of host specific header file to include in trad-core.c. */
-#undef TRAD_HEADER
-
-/* The number of bytes in type off_t */
-#undef SIZEOF_OFF_T
-
-/* Use mmap if it's available? */
-#undef USE_MMAP
-
diff --git a/contrib/binutils/bfd/configure b/contrib/binutils/bfd/configure
deleted file mode 100755
index 49516021..0000000
--- a/contrib/binutils/bfd/configure
+++ /dev/null
@@ -1,7520 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --enable-shared[=PKGS] build shared libraries [default=no]"
-ac_help="$ac_help
- --enable-static[=PKGS] build static libraries [default=yes]"
-ac_help="$ac_help
- --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
-ac_help="$ac_help
- --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
-ac_help="$ac_help
- --disable-libtool-lock avoid locking (might break parallel builds)"
-ac_help="$ac_help
- --with-pic try to use only PIC/non-PIC objects [default=use both]"
-ac_help="$ac_help
- --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)"
-ac_help="$ac_help
- --enable-targets alternative target configurations"
-ac_help="$ac_help
- --enable-commonbfdlib build shared BFD/opcodes/libiberty library"
-ac_help="$ac_help
- --with-mmap try using mmap for BFD input files if available"
-ac_help="$ac_help
- --enable-build-warnings Enable build-time compiler warnings if gcc is used"
-ac_help="$ac_help
- --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer"
-ac_help="$ac_help
- --enable-install-libbfd controls installation of libbfd and related headers"
-ac_help="$ac_help
- --disable-nls do not use Native Language Support"
-ac_help="$ac_help
- --with-included-gettext use the GNU gettext library included here"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=libbfd.c
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:556: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 561 "configure"
-#include "confdefs.h"
-
-int main() {
-
-#ifndef __CYGWIN__
-#define __CYGWIN__ __CYGWIN32__
-#endif
-return __CYGWIN__;
-; return 0; }
-EOF
-if { (eval echo configure:572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_cygwin=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_cygwin" 1>&6
-CYGWIN=
-test "$ac_cv_cygwin" = yes && CYGWIN=yes
-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:589: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 594 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_mingw32=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_mingw32=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_mingw32" 1>&6
-MINGW32=
-test "$ac_cv_mingw32" = yes && MINGW32=yes
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:666: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:687: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:705: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
- echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
-echo "configure:729: checking for strerror in -lcposix" >&5
-ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lcposix $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 737 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char strerror();
-
-int main() {
-strerror()
-; return 0; }
-EOF
-if { (eval echo configure:748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lcposix"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
-
-am__api_version="1.4"
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:784: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:837: checking whether build environment is sane" >&5
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "$*" != "X $srcdir/configure conftestfile" \
- && test "$*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" 1>&2; exit 1; }
- fi
-
- test "$2" = conftestfile
- )
-then
- # Ok.
- :
-else
- { echo "configure: error: newly created file is older than distributed files!
-Check your system clock" 1>&2; exit 1; }
-fi
-rm -f conftest*
-echo "$ac_t""yes" 1>&6
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:894: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-PACKAGE=bfd
-
-VERSION=2.15
-
-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; }
-fi
-cat >> confdefs.h <<EOF
-#define PACKAGE "$PACKAGE"
-EOF
-
-cat >> confdefs.h <<EOF
-#define VERSION "$VERSION"
-EOF
-
-
-
-missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6
-echo "configure:940: checking for working aclocal-${am__api_version}" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL=aclocal-${am__api_version}
- echo "$ac_t""found" 1>&6
-else
- ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:953: checking for working autoconf" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoconf --version) < /dev/null > /dev/null 2>&1; then
- AUTOCONF=autoconf
- echo "$ac_t""found" 1>&6
-else
- AUTOCONF="$missing_dir/missing autoconf"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6
-echo "configure:966: checking for working automake-${am__api_version}" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
- AUTOMAKE=automake-${am__api_version}
- echo "$ac_t""found" 1>&6
-else
- AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:979: checking for working autoheader" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoheader --version) < /dev/null > /dev/null 2>&1; then
- AUTOHEADER=autoheader
- echo "$ac_t""found" 1>&6
-else
- AUTOHEADER="$missing_dir/missing autoheader"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:992: checking for working makeinfo" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
- MAKEINFO=makeinfo
- echo "$ac_t""found" 1>&6
-else
- MAKEINFO="$missing_dir/missing makeinfo"
- echo "$ac_t""missing" 1>&6
-fi
-
-
-# Uncomment the next line to remove the date from the reported bfd version
-#is_release=y
-
-bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
-
-bfd_version_string="\"${VERSION}\""
-if test x${is_release} = x; then
- bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
- bfd_version_string="\"${VERSION} ${bfd_version_date}\""
-fi
-
-
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1027: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
-# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1059: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1091: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- RANLIB=":"
-fi
-fi
-
-
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_shared=no
-fi
-
-
-# Check whether --enable-static or --disable-static was given.
-if test "${enable_static+set}" = set; then
- enableval="$enable_static"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_static=yes
-fi
-
-# Check whether --enable-fast-install or --disable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
- enableval="$enable_fast_install"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_fast_install=yes
-fi
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1197: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1227: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1278: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1310: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 1321 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:1326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1352: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1357: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1385: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-# Check whether --with-gnu-ld or --without-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
- withval="$with_gnu_ld"
- test "$withval" = no || with_gnu_ld=yes
-else
- with_gnu_ld=no
-fi
-
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1428: checking for ld used by GCC" >&5
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case $ac_prog in
- # Accept absolute paths.
- [\\/]* | [A-Za-z]:[\\/]*)
- re_direlt='/[^/][^/]*/\.\./'
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1458: checking for GNU ld" >&5
-else
- echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1461: checking for non-GNU ld" >&5
-fi
-if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- lt_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
-else
- lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
- echo "$ac_t""$LD" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
-echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1496: checking if the linker ($LD) is GNU ld" >&5
-if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- lt_cv_prog_gnu_ld=yes
-else
- lt_cv_prog_gnu_ld=no
-fi
-fi
-
-echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
-with_gnu_ld=$lt_cv_prog_gnu_ld
-
-
-echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1513: checking for $LD option to reload object files" >&5
-if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- lt_cv_ld_reload_flag='-r'
-fi
-
-echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
-reload_flag=$lt_cv_ld_reload_flag
-test -n "$reload_flag" && reload_flag=" $reload_flag"
-
-echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1525: checking for BSD-compatible nm" >&5
-if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$NM"; then
- # Let the user override the test.
- lt_cv_path_NM="$NM"
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
- test -z "$ac_dir" && ac_dir=.
- tmp_nm=$ac_dir/${ac_tool_prefix}nm
- if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- # Tru64's nm complains that /dev/null is an invalid object file
- if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
- lt_cv_path_NM="$tmp_nm -B"
- break
- elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- lt_cv_path_NM="$tmp_nm -p"
- break
- else
- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
-fi
-fi
-
-NM="$lt_cv_path_NM"
-echo "$ac_t""$NM" 1>&6
-
-echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1563: checking whether ln -s works" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- rm -f conftestdata
-if ln -s X conftestdata 2>/dev/null
-then
- rm -f conftestdata
- ac_cv_prog_LN_S="ln -s"
-else
- ac_cv_prog_LN_S=ln
-fi
-fi
-LN_S="$ac_cv_prog_LN_S"
-if test "$ac_cv_prog_LN_S" = "ln -s"; then
- echo "$ac_t""yes" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1584: checking how to recognise dependant libraries" >&5
-if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [regex]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given egrep regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-beos*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-bsdi4*)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
- lt_cv_file_magic_cmd='/usr/bin/file -L'
- lt_cv_file_magic_test_file=/shlib/libc.so
- ;;
-
-cygwin* | mingw* |pw32*)
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- ;;
-
-darwin* | rhapsody*)
- lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
- lt_cv_file_magic_cmd='/usr/bin/file -L'
- case "$host_os" in
- rhapsody* | darwin1.012)
- lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
- ;;
- *) # Darwin 1.3 on
- lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
- ;;
- esac
- ;;
-
-freebsd* )
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- case $host_cpu in
- i*86 )
- # Not sure whether the presence of OpenBSD here was a mistake.
- # Let's accept both of them until this is cleared up.
- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
- ;;
- esac
- else
- lt_cv_deplibs_check_method=pass_all
- fi
- ;;
-
-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-hpux10.20*|hpux11*)
- case $host_cpu in
- hppa*)
- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/libc.sl
- ;;
- ia64*)
- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
- ;;
- esac
- ;;
-
-irix5* | irix6*)
- case $host_os in
- irix5*)
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
- ;;
- *)
- case $LD in
- *-32|*"-32 ") libmagic=32-bit;;
- *-n32|*"-n32 ") libmagic=N32;;
- *-64|*"-64 ") libmagic=64-bit;;
- *) libmagic=never-match;;
- esac
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
- ;;
- esac
- lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-# This must be Linux ELF.
-linux-gnu*)
- case $host_cpu in
- alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
- lt_cv_deplibs_check_method=pass_all ;;
- *)
- # glibc up to 2.1.1 does not perform some relocations on ARM
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
- esac
- lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
- ;;
-
-netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
- else
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
- fi
- ;;
-
-newsos6)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/libnls.so
- ;;
-
-osf3* | osf4* | osf5*)
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
- lt_cv_file_magic_test_file=/shlib/libc.so
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-sco3.2v5*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-solaris*)
- lt_cv_deplibs_check_method=pass_all
- lt_cv_file_magic_test_file=/lib/libc.so
- ;;
-
-sysv5uw[78]* | sysv4*uw2*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
- case $host_vendor in
- ncr)
- lt_cv_deplibs_check_method=pass_all
- ;;
- motorola)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
- ;;
- esac
- ;;
-esac
-
-fi
-
-echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-
-echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1757: checking for object suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- rm -f conftest*
-echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- for ac_file in conftest.*; do
- case $ac_file in
- *.c) ;;
- *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
- esac
- done
-else
- { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_objext" 1>&6
-OBJEXT=$ac_cv_objext
-ac_objext=$ac_cv_objext
-
-
-
-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1783: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
- ac_cv_exeext=.exe
-else
- rm -f conftest*
- echo 'int main () { return 0; }' > conftest.$ac_ext
- ac_cv_exeext=
- if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj) ;;
- *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
- fi
- rm -f conftest*
- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
-fi
-fi
-
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-echo "$ac_t""${ac_cv_exeext}" 1>&6
-ac_exeext=$EXEEXT
-
-# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
-
-# Only perform the check for file, if the check method requires it
-case $deplibs_check_method in
-file_magic*)
- if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1820: checking for ${ac_tool_prefix}file" >&5
-if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case $MAGIC_CMD in
- /*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
- ;;
- ?:/*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
- ;;
- *)
- ac_save_MAGIC_CMD="$MAGIC_CMD"
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="/usr/bin:$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/${ac_tool_prefix}file; then
- lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
- if test -n "$file_magic_test_file"; then
- case $deplibs_check_method in
- "file_magic "*)
- file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
- MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
- if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
- egrep "$file_magic_regex" > /dev/null; then
- :
- else
- cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
- fi ;;
- esac
- fi
- break
- fi
- done
- IFS="$ac_save_ifs"
- MAGIC_CMD="$ac_save_MAGIC_CMD"
- ;;
-esac
-fi
-
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
- echo "$ac_t""$MAGIC_CMD" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$lt_cv_path_MAGIC_CMD"; then
- if test -n "$ac_tool_prefix"; then
- echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1882: checking for file" >&5
-if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case $MAGIC_CMD in
- /*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
- ;;
- ?:/*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
- ;;
- *)
- ac_save_MAGIC_CMD="$MAGIC_CMD"
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="/usr/bin:$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/file; then
- lt_cv_path_MAGIC_CMD="$ac_dir/file"
- if test -n "$file_magic_test_file"; then
- case $deplibs_check_method in
- "file_magic "*)
- file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
- MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
- if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
- egrep "$file_magic_regex" > /dev/null; then
- :
- else
- cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
- fi ;;
- esac
- fi
- break
- fi
- done
- IFS="$ac_save_ifs"
- MAGIC_CMD="$ac_save_MAGIC_CMD"
- ;;
-esac
-fi
-
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
- echo "$ac_t""$MAGIC_CMD" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- else
- MAGIC_CMD=:
- fi
-fi
-
- fi
- ;;
-esac
-
-# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1953: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1985: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- RANLIB=":"
-fi
-fi
-
-# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2020: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_STRIP="${ac_tool_prefix}strip"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-STRIP="$ac_cv_prog_STRIP"
-if test -n "$STRIP"; then
- echo "$ac_t""$STRIP" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_STRIP"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2052: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_STRIP="strip"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
-fi
-fi
-STRIP="$ac_cv_prog_STRIP"
-if test -n "$STRIP"; then
- echo "$ac_t""$STRIP" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- STRIP=":"
-fi
-fi
-
-
-# Check for any special flags to pass to ltconfig.
-libtool_flags="--cache-file=$cache_file"
-test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
-test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
-test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
-test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
-test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
-
-
-# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
- enableval="$enable_libtool_lock"
- :
-fi
-
-test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
-test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
-
-# Check whether --with-pic or --without-pic was given.
-if test "${with_pic+set}" = set; then
- withval="$with_pic"
- pic_mode="$withval"
-else
- pic_mode=default
-fi
-
-test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
-test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-*-*-irix6*)
- # Find out which ABI we are using.
- echo '#line 2119 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- if test "$lt_cv_prog_gnu_ld" = yes; then
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -melf32bsmip"
- ;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
- ;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
- ;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
- fi
- rm -rf conftest*
- ;;
-
-ia64-*-hpux*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- case "`/usr/bin/file conftest.o`" in
- *ELF-32*)
- HPUX_IA64_MODE="32"
- ;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-*-*-sco3.2v5*)
- # On SCO OpenServer 5, we need -belf to get full-featured binaries.
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -belf"
- echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2171: checking whether the C compiler needs -belf" >&5
-if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
- cat > conftest.$ac_ext <<EOF
-#line 2184 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:2191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- lt_cv_cc_needs_belf=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- lt_cv_cc_needs_belf=no
-fi
-rm -f conftest*
- ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-fi
-
-echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
- if test x"$lt_cv_cc_needs_belf" != x"yes"; then
- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
- CFLAGS="$SAVE_CFLAGS"
- fi
- ;;
-
-
-esac
-
-
-# Save cache, so that ltconfig can load it
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-
-# Actually configure libtool. ac_aux_dir is where install-sh is found.
-AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
-AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
-objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
-deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
-|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
-
-# Reload cache, that may have been modified by ltconfig
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
-
-
-
-
-
-
-
-# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given.
-if test "${enable_64_bit_bfd+set}" = set; then
- enableval="$enable_64_bit_bfd"
- case "${enableval}" in
- yes) want64=true ;;
- no) want64=false ;;
- *) { echo "configure: error: bad value ${enableval} for 64-bit-bfd option" 1>&2; exit 1; } ;;
-esac
-else
- want64=false
-fi
-# Check whether --enable-targets or --disable-targets was given.
-if test "${enable_targets+set}" = set; then
- enableval="$enable_targets"
- case "${enableval}" in
- yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; }
- ;;
- no) enable_targets= ;;
- *) enable_targets=$enableval ;;
-esac
-fi
-# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given.
-if test "${enable_commonbfdlib+set}" = set; then
- enableval="$enable_commonbfdlib"
- case "${enableval}" in
- yes) commonbfdlib=true ;;
- no) commonbfdlib=false ;;
- *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;;
-esac
-fi
-# Check whether --with-mmap or --without-mmap was given.
-if test "${with_mmap+set}" = set; then
- withval="$with_mmap"
- case "${withval}" in
- yes) want_mmap=true ;;
- no) want_mmap=false ;;
- *) { echo "configure: error: bad value ${withval} for BFD with-mmap option" 1>&2; exit 1; } ;;
-esac
-else
- want_mmap=false
-fi
-
-build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-# Check whether --enable-build-warnings or --disable-build-warnings was given.
-if test "${enable_build_warnings+set}" = set; then
- enableval="$enable_build_warnings"
- case "${enableval}" in
- yes) ;;
- no) build_warnings="-w";;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${build_warnings} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${t} ${build_warnings}";;
- *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-esac
-if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
- echo "Setting warning flags = $build_warnings" 6>&1
-fi
-fi
-WARN_CFLAGS=""
-if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then
- WARN_CFLAGS="${build_warnings}"
-fi
-
-
-
-
-
-
-if test -z "$target" ; then
- { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2381: checking whether to enable maintainer-specific portions of Makefiles" >&5
- # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- USE_MAINTAINER_MODE=$enableval
-else
- USE_MAINTAINER_MODE=no
-fi
-
- echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
-
-
-if test $USE_MAINTAINER_MODE = yes; then
- MAINTAINER_MODE_TRUE=
- MAINTAINER_MODE_FALSE='#'
-else
- MAINTAINER_MODE_TRUE='#'
- MAINTAINER_MODE_FALSE=
-fi
- MAINT=$MAINTAINER_MODE_TRUE
-
-
-echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6
-echo "configure:2404: checking whether to install libbfd" >&5
- # Check whether --enable-install-libbfd or --disable-install-libbfd was given.
-if test "${enable_install_libbfd+set}" = set; then
- enableval="$enable_install_libbfd"
- install_libbfd_p=$enableval
-else
- if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
- install_libbfd_p=yes
- else
- install_libbfd_p=no
- fi
-fi
-
- echo "$ac_t""$install_libbfd_p" 1>&6
-
-
-if test $install_libbfd_p = yes; then
- INSTALL_LIBBFD_TRUE=
- INSTALL_LIBBFD_FALSE='#'
-else
- INSTALL_LIBBFD_TRUE='#'
- INSTALL_LIBBFD_FALSE=
-fi
- # libbfd.a is a host library containing target dependent code
- bfdlibdir='$(libdir)'
- bfdincludedir='$(includedir)'
- if test "${host}" != "${target}"; then
- bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
- bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
- fi
-
-
-
-
-
-
-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2441: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
- ac_cv_exeext=.exe
-else
- rm -f conftest*
- echo 'int main () { return 0; }' > conftest.$ac_ext
- ac_cv_exeext=
- if { (eval echo configure:2451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj) ;;
- *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
- fi
- rm -f conftest*
- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
-fi
-fi
-
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-echo "$ac_t""${ac_cv_exeext}" 1>&6
-ac_exeext=$EXEEXT
-
-
-host64=false
-target64=false
-bfd_default_target_size=32
-
-# host stuff:
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2481: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2511: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2562: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2594: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 2605 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2636: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2641: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2650: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2669: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-
-ALL_LINGUAS="fr tr ja es sv da zh_CN ro"
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2703: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 2718 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2724: \"$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
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 2735 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2741: \"$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
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 2752 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2758: \"$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
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2785: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2813: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2818 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2826: \"$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*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 2843 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 2861 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 2882 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:2893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2917: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2922 "configure"
-#include "confdefs.h"
-
-int main() {
-
-/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this. */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in an arm
- of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
-}
-{ /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:2971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_const=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_const=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
-if test $ac_cv_c_const = no; then
- cat >> confdefs.h <<\EOF
-#define const
-EOF
-
-fi
-
-echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2992: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
- cat > conftest.$ac_ext <<EOF
-#line 2999 "configure"
-#include "confdefs.h"
-
-int main() {
-} $ac_kw foo() {
-; return 0; }
-EOF
-if { (eval echo configure:3006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_inline=$ac_kw; break
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-done
-
-fi
-
-echo "$ac_t""$ac_cv_c_inline" 1>&6
-case "$ac_cv_c_inline" in
- inline | yes) ;;
- no) cat >> confdefs.h <<\EOF
-#define inline
-EOF
- ;;
- *) cat >> confdefs.h <<EOF
-#define inline $ac_cv_c_inline
-EOF
- ;;
-esac
-
-echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3032: checking for off_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3037 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_off_t=yes
-else
- rm -rf conftest*
- ac_cv_type_off_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_off_t" 1>&6
-if test $ac_cv_type_off_t = no; then
- cat >> confdefs.h <<\EOF
-#define off_t long
-EOF
-
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3065: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3070 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
-else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
-
-fi
-
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments. Useless!
-echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:3100: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3105 "configure"
-#include "confdefs.h"
-#include <alloca.h>
-int main() {
-char *p = alloca(2 * sizeof(int));
-; return 0; }
-EOF
-if { (eval echo configure:3112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_header_alloca_h=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_alloca_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
-EOF
-
-fi
-
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3133: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3138 "configure"
-#include "confdefs.h"
-
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
-
-int main() {
-char *p = (char *) alloca(1);
-; return 0; }
-EOF
-if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_func_alloca_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_func_alloca_works=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
-
-fi
-
-if test $ac_cv_func_alloca_works = no; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.${ac_objext}
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
-
-
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3198: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3203 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_os_cray=yes
-else
- rm -rf conftest*
- ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_os_cray" 1>&6
-if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3228: 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 3233 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3256: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
-EOF
-
- break
-else
- echo "$ac_t""no" 1>&6
-fi
-
-done
-fi
-
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3283: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
-else
- cat > conftest.$ac_ext <<EOF
-#line 3291 "configure"
-#include "confdefs.h"
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
- exit (find_stack_direction() < 0);
-}
-EOF
-if { (eval echo configure:3310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_stack_direction=1
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-EOF
-
-fi
-
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3335: 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 3340 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3345: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in getpagesize
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3374: 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 3379 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3402: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3427: 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
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 3435 "configure"
-#include "confdefs.h"
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the filesystem buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propogated back to all the places they're supposed to be.
-
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
-
-/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
-int
-main()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = malloc(pagesize);
- if (!data)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand();
- umask(0);
- fd = creat("conftestmmap", 0600);
- if (fd < 0)
- exit(1);
- if (write(fd, data, pagesize) != pagesize)
- exit(1);
- close(fd);
-
- /*
- * Next, try to mmap the file at a fixed address which
- * already has something else allocated at it. If we can,
- * also make sure that we see the same garbage.
- */
- fd = open("conftestmmap", O_RDWR);
- if (fd < 0)
- exit(1);
- data2 = malloc(2 * pagesize);
- if (!data2)
- exit(1);
- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit(1);
-
- /*
- * Finally, make sure that changes to the mapped area
- * do not percolate back to the file as seen by read().
- * (This is a bug on some variants of i386 svr4.0.)
- */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = malloc(pagesize);
- if (!data3)
- exit(1);
- if (read(fd, data3, pagesize) != pagesize)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit(1);
- close(fd);
- unlink("conftestmmap");
- exit(0);
-}
-
-EOF
-if { (eval echo configure:3588: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MMAP 1
-EOF
-
-fi
-
-
- for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
-unistd.h values.h sys/param.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3616: 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 3621 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3626: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
-__argz_count __argz_stringify __argz_next
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3656: 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 3661 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3684: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
- if test "${ac_cv_func_stpcpy+set}" != "set"; then
- for ac_func in stpcpy
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3713: 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 3718 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3741: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- fi
- if test "${ac_cv_func_stpcpy}" = "yes"; then
- cat >> confdefs.h <<\EOF
-#define HAVE_STPCPY 1
-EOF
-
- fi
-
- if test $ac_cv_header_locale_h = yes; then
- echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3775: checking for LC_MESSAGES" >&5
-if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3780 "configure"
-#include "confdefs.h"
-#include <locale.h>
-int main() {
-return LC_MESSAGES
-; return 0; }
-EOF
-if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- am_cv_val_LC_MESSAGES=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- am_cv_val_LC_MESSAGES=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
- if test $am_cv_val_LC_MESSAGES = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_LC_MESSAGES 1
-EOF
-
- fi
- fi
- echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3808: checking whether NLS is requested" >&5
- # Check whether --enable-nls or --disable-nls was given.
-if test "${enable_nls+set}" = set; then
- enableval="$enable_nls"
- USE_NLS=$enableval
-else
- USE_NLS=yes
-fi
-
- echo "$ac_t""$USE_NLS" 1>&6
-
-
- USE_INCLUDED_LIBINTL=no
-
- if test "$USE_NLS" = "yes"; then
- cat >> confdefs.h <<\EOF
-#define ENABLE_NLS 1
-EOF
-
- echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3828: checking whether included gettext is requested" >&5
- # Check whether --with-included-gettext or --without-included-gettext was given.
-if test "${with_included_gettext+set}" = set; then
- withval="$with_included_gettext"
- nls_cv_force_use_gnu_gettext=$withval
-else
- nls_cv_force_use_gnu_gettext=no
-fi
-
- echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
-
- nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
- if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
- nls_cv_header_intl=
- nls_cv_header_libgt=
- CATOBJEXT=NONE
-
- ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3847: checking for libintl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3852 "configure"
-#include "confdefs.h"
-#include <libintl.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3857: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
-echo "configure:3874: checking for gettext in libc" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3879 "configure"
-#include "confdefs.h"
-#include <libintl.h>
-int main() {
-return (int) gettext ("")
-; return 0; }
-EOF
-if { (eval echo configure:3886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- gt_cv_func_gettext_libc=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- gt_cv_func_gettext_libc=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
-
- if test "$gt_cv_func_gettext_libc" != "yes"; then
- echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3902: checking for bindtextdomain in -lintl" >&5
-ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lintl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3910 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char bindtextdomain();
-
-int main() {
-bindtextdomain()
-; return 0; }
-EOF
-if { (eval echo configure:3921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
-echo "configure:3937: checking for gettext in libintl" >&5
-if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3942 "configure"
-#include "confdefs.h"
-
-int main() {
-return (int) gettext ("")
-; return 0; }
-EOF
-if { (eval echo configure:3949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- gt_cv_func_gettext_libintl=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- gt_cv_func_gettext_libintl=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
-
- if test "$gt_cv_func_gettext_libc" = "yes" \
- || test "$gt_cv_func_gettext_libintl" = "yes"; then
- cat >> confdefs.h <<\EOF
-#define HAVE_GETTEXT 1
-EOF
-
- # Extract the first word of "msgfmt", so it can be a program name with args.
-set dummy msgfmt; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3977: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
- ac_cv_path_MSGFMT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
- ;;
-esac
-fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
- echo "$ac_t""$MSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- if test "$MSGFMT" != "no"; then
- for ac_func in dcgettext
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4011: 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 4016 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:4039: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- # Extract the first word of "gmsgfmt", so it can be a program name with args.
-set dummy gmsgfmt; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4066: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$GMSGFMT" in
- /*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
- ;;
- ?:/*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
- ;;
-esac
-fi
-GMSGFMT="$ac_cv_path_GMSGFMT"
-if test -n "$GMSGFMT"; then
- echo "$ac_t""$GMSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- # Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4102: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$XGETTEXT" in
- /*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
- ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
- ;;
-esac
-fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test -n "$XGETTEXT"; then
- echo "$ac_t""$XGETTEXT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- cat > conftest.$ac_ext <<EOF
-#line 4134 "configure"
-#include "confdefs.h"
-
-int main() {
-extern int _nl_msg_cat_cntr;
- return _nl_msg_cat_cntr
-; return 0; }
-EOF
-if { (eval echo configure:4142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- CATOBJEXT=.gmo
- DATADIRNAME=share
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CATOBJEXT=.mo
- DATADIRNAME=lib
-fi
-rm -f conftest*
- INSTOBJEXT=.mo
- fi
- fi
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
- if test "$CATOBJEXT" = "NONE"; then
- nls_cv_use_gnu_gettext=yes
- fi
- fi
-
- if test "$nls_cv_use_gnu_gettext" = "yes"; then
- INTLOBJS="\$(GETTOBJS)"
- # Extract the first word of "msgfmt", so it can be a program name with args.
-set dummy msgfmt; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4174: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
- ac_cv_path_MSGFMT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
- ;;
-esac
-fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
- echo "$ac_t""$MSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- # Extract the first word of "gmsgfmt", so it can be a program name with args.
-set dummy gmsgfmt; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4208: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$GMSGFMT" in
- /*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
- ;;
- ?:/*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
- ;;
-esac
-fi
-GMSGFMT="$ac_cv_path_GMSGFMT"
-if test -n "$GMSGFMT"; then
- echo "$ac_t""$GMSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- # Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4244: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$XGETTEXT" in
- /*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
- ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
- ;;
-esac
-fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test -n "$XGETTEXT"; then
- echo "$ac_t""$XGETTEXT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
- USE_INCLUDED_LIBINTL=yes
- CATOBJEXT=.gmo
- INSTOBJEXT=.mo
- DATADIRNAME=share
- INTLDEPS='$(top_builddir)/../intl/libintl.a'
- INTLLIBS=$INTLDEPS
- LIBS=`echo $LIBS | sed -e 's/-lintl//'`
- nls_cv_header_intl=libintl.h
- nls_cv_header_libgt=libgettext.h
- fi
-
- if test "$XGETTEXT" != ":"; then
- if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
- : ;
- else
- echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6
- XGETTEXT=":"
- fi
- fi
-
- # We need to process the po/ directory.
- POSUB=po
- else
- DATADIRNAME=share
- nls_cv_header_intl=libintl.h
- nls_cv_header_libgt=libgettext.h
- fi
-
- # If this is used in GNU gettext we have to set USE_NLS to `yes'
- # because some of the sources are only built for this goal.
- if test "$PACKAGE" = gettext; then
- USE_NLS=yes
- USE_INCLUDED_LIBINTL=yes
- fi
-
- for lang in $ALL_LINGUAS; do
- GMOFILES="$GMOFILES $lang.gmo"
- POFILES="$POFILES $lang.po"
- done
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if test "x$CATOBJEXT" != "x"; then
- if test "x$ALL_LINGUAS" = "x"; then
- LINGUAS=
- else
- echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4334: checking for catalogs to be installed" >&5
- NEW_LINGUAS=
- for lang in ${LINGUAS=$ALL_LINGUAS}; do
- case "$ALL_LINGUAS" in
- *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
- esac
- done
- LINGUAS=$NEW_LINGUAS
- echo "$ac_t""$LINGUAS" 1>&6
- fi
-
- if test -n "$LINGUAS"; then
- for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
- fi
- fi
-
- if test $ac_cv_header_locale_h = yes; then
- INCLUDE_LOCALE_H="#include <locale.h>"
- else
- INCLUDE_LOCALE_H="\
-/* The system does not provide the header <locale.h>. Take care yourself. */"
- fi
-
-
- if test -f $srcdir/po2tbl.sed.in; then
- if test "$CATOBJEXT" = ".cat"; then
- ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
-echo "configure:4362: checking for linux/version.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4367 "configure"
-#include "confdefs.h"
-#include <linux/version.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4372: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- msgformat=linux
-else
- echo "$ac_t""no" 1>&6
-msgformat=xopen
-fi
-
-
- sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
- fi
- sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
- $srcdir/po2tbl.sed.in > po2tbl.sed
- fi
-
- if test "$PACKAGE" = "gettext"; then
- GT_NO="#NO#"
- GT_YES=
- else
- GT_NO=
- GT_YES="#YES#"
- fi
-
-
-
- MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
-
-
- l=
-
-
- if test -f $srcdir/po/POTFILES.in; then
- test -d po || mkdir po
- if test "x$srcdir" != "x."; then
- if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
- posrcprefix="$srcdir/"
- else
- posrcprefix="../$srcdir/"
- fi
- else
- posrcprefix="../"
- fi
- rm -f po/POTFILES
- sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
- < $srcdir/po/POTFILES.in > po/POTFILES
- fi
-
-
-# Permit host specific settings.
-. ${srcdir}/configure.host
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4450: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-BFD_HOST_64BIT_LONG=0
-BFD_HOST_LONG_LONG=0
-BFD_HOST_64_BIT_DEFINED=0
-BFD_HOST_64_BIT=
-BFD_HOST_U_64_BIT=
-
-echo $ac_n "checking for long long""... $ac_c" 1>&6
-echo "configure:4510: checking for long long" >&5
-if eval "test \"`echo '$''{'bfd_cv_has_long_long'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4515 "configure"
-#include "confdefs.h"
-
-int main() {
-unsigned long long ll = 18446744073709551615ULL;
-; return 0; }
-EOF
-if { (eval echo configure:4522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_has_long_long=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_has_long_long=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$bfd_cv_has_long_long" 1>&6
-if test $bfd_cv_has_long_long = yes; then
- BFD_HOST_LONG_LONG=1
- echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:4538: checking size of long long" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
- cat > conftest.$ac_ext <<EOF
-#line 4544 "configure"
-#include "confdefs.h"
-#include "confdefs.h"
-#include <sys/types.h>
-
-
-int main() {
-switch (0) case 0: case (sizeof (long long) == $ac_size):;
-; return 0; }
-EOF
-if { (eval echo configure:4554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_sizeof_long_long=$ac_size
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
- if test x$ac_cv_sizeof_long_long != x ; then break; fi
-done
-
-fi
-
-if test x$ac_cv_sizeof_long_long = x ; then
- { echo "configure: error: cannot determine a size for long long" 1>&2; exit 1; }
-fi
-echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-EOF
-
-
-fi
-
-echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:4579: checking size of long" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
- cat > conftest.$ac_ext <<EOF
-#line 4585 "configure"
-#include "confdefs.h"
-#include "confdefs.h"
-#include <sys/types.h>
-
-
-int main() {
-switch (0) case 0: case (sizeof (long) == $ac_size):;
-; return 0; }
-EOF
-if { (eval echo configure:4595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_sizeof_long=$ac_size
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
- if test x$ac_cv_sizeof_long != x ; then break; fi
-done
-
-fi
-
-if test x$ac_cv_sizeof_long = x ; then
- { echo "configure: error: cannot determine a size for long" 1>&2; exit 1; }
-fi
-echo "$ac_t""$ac_cv_sizeof_long" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-EOF
-
-
-if test "x${ac_cv_sizeof_long}" = "x8"; then
- host64=true
- BFD_HOST_64BIT_LONG=1
- test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
- test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
- test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
- test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
-fi
-
-if test -n "${HOST_64BIT_TYPE}" -a -n "${HOST_U_64BIT_TYPE}"; then
- BFD_HOST_64_BIT_DEFINED=1
- BFD_HOST_64_BIT="${HOST_64BIT_TYPE}"
- BFD_HOST_U_64_BIT="${HOST_U_64BIT_TYPE}"
-fi
-
-
-
-
-
-
-
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test -z "$CC_FOR_BUILD"; then
- if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
- else
- CC_FOR_BUILD=gcc
- fi
-fi
-
-# Also set EXEEXT_FOR_BUILD.
-if test "x$cross_compiling" = "xno"; then
- EXEEXT_FOR_BUILD='$(EXEEXT)'
-else
- echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4653: checking for build system executable suffix" >&5
-if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- rm -f conftest*
- echo 'int main () { return 0; }' > conftest.c
- bfd_cv_build_exeext=
- ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
- *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- rm -f conftest*
- test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
-fi
-
-echo "$ac_t""$bfd_cv_build_exeext" 1>&6
- EXEEXT_FOR_BUILD=""
- test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
-fi
-
-
-for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4681: 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 4686 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4691: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_hdr in fcntl.h sys/file.h sys/time.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4721: 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 4726 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4731: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4758: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4763 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:4772: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_header_time=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_time=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
-if test $ac_cv_header_time = yes; then
- cat >> confdefs.h <<\EOF
-#define TIME_WITH_SYS_TIME 1
-EOF
-
-fi
-
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:4797: checking for $ac_hdr that defines DIR" >&5
-if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4802 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <$ac_hdr>
-int main() {
-DIR *dirp = 0;
-; return 0; }
-EOF
-if { (eval echo configure:4810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- eval "ac_cv_header_dirent_$ac_safe=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_dirent_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
- ac_header_dirent=$ac_hdr; break
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4835: checking for opendir in -ldir" >&5
-ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldir $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 4843 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char opendir();
-
-int main() {
-opendir()
-; return 0; }
-EOF
-if { (eval echo configure:4854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -ldir"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
-echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4876: checking for opendir in -lx" >&5
-ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lx $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 4884 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char opendir();
-
-int main() {
-opendir()
-; return 0; }
-EOF
-if { (eval echo configure:4895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lx"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4920: 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 4925 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:4948: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in strtoull
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4975: 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 4980 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:5003: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-
-case "${host}" in
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
- cat >> confdefs.h <<\EOF
-#define USE_BINARY_FOPEN 1
-EOF
- ;;
-esac
-
-echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:5038: checking whether strstr must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5043 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-int main() {
-char *(*pfn) = (char *(*)) strstr
-; return 0; }
-EOF
-if { (eval echo configure:5064: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_decl_needed_strstr=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_decl_needed_strstr=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6
-if test $bfd_cv_decl_needed_strstr = yes; then
- cat >> confdefs.h <<\EOF
-#define NEED_DECLARATION_STRSTR 1
-EOF
-
-fi
-
-echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:5085: checking whether malloc must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5090 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-int main() {
-char *(*pfn) = (char *(*)) malloc
-; return 0; }
-EOF
-if { (eval echo configure:5111: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_decl_needed_malloc=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_decl_needed_malloc=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6
-if test $bfd_cv_decl_needed_malloc = yes; then
- cat >> confdefs.h <<\EOF
-#define NEED_DECLARATION_MALLOC 1
-EOF
-
-fi
-
-echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:5132: checking whether realloc must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5137 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-int main() {
-char *(*pfn) = (char *(*)) realloc
-; return 0; }
-EOF
-if { (eval echo configure:5158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_decl_needed_realloc=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_decl_needed_realloc=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$bfd_cv_decl_needed_realloc" 1>&6
-if test $bfd_cv_decl_needed_realloc = yes; then
- cat >> confdefs.h <<\EOF
-#define NEED_DECLARATION_REALLOC 1
-EOF
-
-fi
-
-echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:5179: checking whether free must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5184 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-int main() {
-char *(*pfn) = (char *(*)) free
-; return 0; }
-EOF
-if { (eval echo configure:5205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_decl_needed_free=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_decl_needed_free=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6
-if test $bfd_cv_decl_needed_free = yes; then
- cat >> confdefs.h <<\EOF
-#define NEED_DECLARATION_FREE 1
-EOF
-
-fi
-
-echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:5226: checking whether getenv must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5231 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-int main() {
-char *(*pfn) = (char *(*)) getenv
-; return 0; }
-EOF
-if { (eval echo configure:5252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_decl_needed_getenv=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_decl_needed_getenv=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6
-if test $bfd_cv_decl_needed_getenv = yes; then
- cat >> confdefs.h <<\EOF
-#define NEED_DECLARATION_GETENV 1
-EOF
-
-fi
-
-
-# If we are configured native, pick a core file support file.
-COREFILE=
-COREFLAG=
-TRAD_HEADER=
-if test "${target}" = "${host}"; then
- case "${host}" in
- alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
- COREFILE=''
- ;;
- alpha*-*-linux-gnu*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/alphalinux.h"'
- ;;
- alpha*-*-netbsd* | alpha*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- alpha*-*-*) COREFILE=osf-core.lo ;;
- arm-*-freebsd* | arm-*-kfreebsd*-gnu)
- COREFILE='' ;;
- arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
- arm-*-riscix) COREFILE=trad-core.lo ;;
- hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
- hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
- hppa*-*-mpeix*) COREFILE=hpux-core.lo ;;
- hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo"
- COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
- i370-*-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i370linux.h"'
- ;;
-
- i[3-7]86-sequent-bsd*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/symmetry.h"'
- ;;
- i[3-7]86-sequent-sysv4*) ;;
- i[3-7]86-sequent-sysv*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/symmetry.h"'
- ;;
- i[3-7]86-*-bsdi)
- COREFILE=
- ;;
- i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234]* | i[3-7]86-*-freebsd*aout*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386bsd.h"'
- ;;
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
- COREFILE=''
- TRAD_HEADER='"hosts/i386bsd.h"'
- ;;
- i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu | i[3-7]86-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- i[3-7]86-esix-sysv3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/esix.h"'
- ;;
- i[3-7]86-*-sco3.2v5*)
- COREFILE=sco5-core.lo
- ;;
- i[3-7]86-*-sco* | i[3-7]86-*-isc*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386sco.h"'
- ;;
- i[3-7]86-*-mach3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386mach3.h"'
- ;;
- i[3-7]86-*-linux-gnu*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386linux.h"'
- ;;
- i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
- i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
- i860-*-mach3* | i860-*-osf1*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i860mach3.h"'
- ;;
- mips-*-netbsd* | mips*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- mips-dec-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/decstation.h"'
- ;;
- mips-sgi-irix4*) COREFILE=irix-core.lo ;;
- mips-sgi-irix5*) COREFILE=irix-core.lo ;;
- mips-sgi-irix6*) COREFILE=irix-core.lo ;;
- mips-*-sysv4*) ;;
- mips-*-sysv* | mips-*-riscos*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/riscos.h"'
- ;;
- mips-sony-bsd*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/news-mips.h"'
- ;;
- m68*-bull*-sysv*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/dpx2.h"'
- ;;
- m68*-hp-hpux*) COREFILE=hpux-core.lo ;;
- m68*-hp-bsd*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/hp300bsd.h"'
- ;;
- m68*-*-linux-gnu*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/m68klinux.h"'
- ;;
- m68*-motorola-sysv*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/delta68.h"'
- ;;
- m68*-sony-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/news.h"'
- ;;
- m68*-*-netbsd* | m68*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- m68*-apple-aux*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/m68kaux.h"'
- ;;
- m88*-*-sysv4*)
- ;;
- m88*-motorola-sysv*)
- COREFILE=ptrace-core.lo
- ;;
- m88*-*-mach3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/m88kmach3.h"'
- ;;
- ns32k-pc532-mach)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/pc532mach.h"'
- ;;
- ns32k-*-netbsd* | ns32k-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- rs6000-*-lynx*)
- COREFILE=lynx-core.lo
- ;;
- rs6000-*-aix5.* | powerpc-*-aix5.*)
- COREFILE=rs6000-core.lo
- COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE"
- ;;
- rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*)
- COREFILE=rs6000-core.lo
- COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE"
- # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE
- # have c_impl as a member of struct core_dumpx
- echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6
-echo "configure:5428: checking for c_impl in struct core_dumpx" >&5
- cat > conftest.$ac_ext <<EOF
-#line 5430 "configure"
-#include "confdefs.h"
-#include <core.h>
-int main() {
-struct core_dumpx c; c.c_impl = 0;
-; return 0; }
-EOF
-if { (eval echo configure:5437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- cat >> confdefs.h <<\EOF
-#define HAVE_ST_C_IMPL 1
-EOF
-
- echo "$ac_t""yes" 1>&6
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "$ac_t""no" 1>&6
-fi
-rm -f conftest*
- ;;
- rs6000-*-aix4*) COREFILE=rs6000-core.lo ;;
- rs6000-*-*) COREFILE=rs6000-core.lo ;;
- powerpc-*-aix4*) COREFILE=rs6000-core.lo ;;
- powerpc-*-aix*) COREFILE=rs6000-core.lo ;;
- powerpc-*-beos*) ;;
- powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
- COREFILE='' ;;
- powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
- powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
- s390*-*-*) COREFILE=trad-core.lo ;;
- sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
- sparc-*-netbsd* | sparc*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- tahoe-*-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/tahoe.h"'
- ;;
- vax-*-netbsd* | vax-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- vax-*-ultrix2*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxult2.h"'
- ;;
- vax-*-ultrix*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxult2.h"'
- ;;
- vax-*-linux-gnu*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxlinux.h"'
- ;;
- vax-*-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxbsd.h"'
- ;;
- x86_64-*-netbsd* | x86_64-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- esac
-
- case "$COREFILE" in
- aix386-core.lo) COREFLAG=-DAIX386_CORE ;;
- hppabsd-core.lo) COREFLAG=-DHPPABSD_CORE ;;
- hpux-core.lo) COREFLAG=-DHPUX_CORE ;;
- irix-core.lo) COREFLAG=-DIRIX_CORE ;;
- lynx-core.lo) COREFLAG=-DLYNX_CORE ;;
- netbsd-core.lo) COREFLAG=-DNETBSD_CORE ;;
- osf-core.lo) COREFLAG=-DOSF_CORE ;;
- ptrace-core.lo) COREFLAG=-DPTRACE_CORE ;;
- rs6000-core.lo) COREFLAG="$COREFLAG -DAIX_CORE" ;;
- sco5-core.lo) COREFLAG="$COREFLAG -DSCO5_CORE" ;;
- trad-core.lo) COREFLAG="$COREFLAG -DTRAD_CORE" ;;
- esac
-
- # ELF corefile support has several flavors, but all of
- # them use something called <sys/procfs.h>
- for ac_hdr in sys/procfs.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5514: 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 5519 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5524: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- if test "$ac_cv_header_sys_procfs_h" = yes; then
- echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5552: checking for prstatus_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5557 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-prstatus_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prstatus_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prstatus_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_prstatus_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PRSTATUS_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6
-
- echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5588: checking for prstatus32_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5593 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-prstatus32_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prstatus32_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prstatus32_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_prstatus32_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PRSTATUS32_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6
-
- echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5624: checking for prstatus_t.pr_who in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5629 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-prstatus_t avar; void* aref = (void*) &avar.pr_who
-; return 0; }
-EOF
-if { (eval echo configure:5638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PRSTATUS_T_PR_WHO 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6
-
- echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5660: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5665 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-prstatus32_t avar; void* aref = (void*) &avar.pr_who
-; return 0; }
-EOF
-if { (eval echo configure:5674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PRSTATUS32_T_PR_WHO 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6
-
- echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5696: checking for pstatus_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5701 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-pstatus_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_pstatus_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_pstatus_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_pstatus_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PSTATUS_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
-
- echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5732: checking for pxstatus_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5737 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-pxstatus_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_pxstatus_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_pxstatus_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_pxstatus_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PXSTATUS_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6
-
- echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5768: checking for pstatus32_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5773 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-pstatus32_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_pstatus32_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_pstatus32_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_pstatus32_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PSTATUS32_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6
-
- echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5804: checking for prpsinfo_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5809 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-prpsinfo_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prpsinfo_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prpsinfo_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_prpsinfo_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PRPSINFO_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6
-
- echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5840: checking for prpsinfo32_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5845 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-prpsinfo32_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_prpsinfo32_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_prpsinfo32_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PRPSINFO32_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6
-
- echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5876: checking for psinfo_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5881 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-psinfo_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_psinfo_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_psinfo_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_psinfo_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PSINFO_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6
-
- echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5912: checking for psinfo32_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5917 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-psinfo32_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_psinfo32_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_psinfo32_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_psinfo32_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PSINFO32_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6
-
- echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5948: checking for lwpstatus_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5953 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-lwpstatus_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_lwpstatus_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_lwpstatus_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_lwpstatus_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_LWPSTATUS_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6
-
- echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5984: checking for lwpxstatus_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5989 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-lwpxstatus_t avar
-; return 0; }
-EOF
-if { (eval echo configure:5998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_lwpxstatus_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_lwpxstatus_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_LWPXSTATUS_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6
-
- echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:6020: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 6025 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-lwpstatus_t avar; void* aref = (void*) &avar.pr_context
-; return 0; }
-EOF
-if { (eval echo configure:6034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_LWPSTATUS_T_PR_CONTEXT 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6
-
- echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:6056: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 6061 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-lwpstatus_t avar; void* aref = (void*) &avar.pr_reg
-; return 0; }
-EOF
-if { (eval echo configure:6070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_LWPSTATUS_T_PR_REG 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6
-
- echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:6092: checking for win32_pstatus_t in sys/procfs.h" >&5
- if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 6097 "configure"
-#include "confdefs.h"
-
-#define _SYSCALL32
-#include <sys/procfs.h>
-int main() {
-win32_pstatus_t avar
-; return 0; }
-EOF
-if { (eval echo configure:6106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_have_sys_procfs_type_win32_pstatus_t=no
-
-fi
-rm -f conftest*
-fi
-
- if test $bfd_cv_have_sys_procfs_type_win32_pstatus_t = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_WIN32_PSTATUS_T 1
-EOF
-
- fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_win32_pstatus_t" 1>&6
-
- fi
-fi
-
-
-if test -n "$TRAD_HEADER"; then
- cat >> confdefs.h <<EOF
-#define TRAD_HEADER $TRAD_HEADER
-EOF
-
-fi
-
-# Horrible hacks to build DLLs on Windows.
-WIN32LDFLAGS=
-WIN32LIBADD=
-case "${host}" in
-*-*-cygwin*)
- if test "$enable_shared" = "yes"; then
- WIN32LDFLAGS="-no-undefined"
- WIN32LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
- fi
- ;;
-*-*-linux*)
- # We borrow WIN32LIBADD so that the shared libbfd won't depend on
- # libiberty.a.
- case "${host}" in
- mips*-*-linux*)
- # Linux/MIPS uses PIC by default.
- if test "$enable_shared" = "yes"; then
- WIN32LIBADD="-L../libiberty -liberty"
- fi
- ;;
- *)
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
- if test -n "$x"; then
- WIN32LIBADD="-L../libiberty/pic -liberty"
- fi
- ;;
- esac
- ;;
-esac
-
-
-
-# target stuff:
-
-# Canonicalize the secondary target names.
-if test -n "$enable_targets" ; then
- for targ in `echo $enable_targets | sed 's/,/ /g'`
- do
- result=`$ac_config_sub $targ 2>/dev/null`
- if test -n "$result" ; then
- canon_targets="$canon_targets $result"
- else
- # Allow targets that config.sub doesn't recognize, like "all".
- canon_targets="$canon_targets $targ"
- fi
- done
-fi
-
-all_targets=false
-defvec=
-selvecs=
-assocvecs=
-selarchs=
-TDEFINES=
-for targ in $target $canon_targets
-do
- if test "x$targ" = "xall"; then
- all_targets=true
- assocvecs="$assocvecs $targ_defvec $targ_selvecs"
- else
- . $srcdir/config.bfd
- if test "x$targ" = "x$target"; then
- defvec=$targ_defvec
- fi
- selvecs="$selvecs $targ_defvec $targ_selvecs"
- selarchs="$selarchs $targ_archs"
- TDEFINES="$TDEFINES $targ_cflags"
- fi
-done
-
-
-# This processing still needs to be done if we're to decide properly whether
-# 64-bit support needs to be compiled in. Currently, it will be included if
-# the default or any other explicitly requested target requires it; it
-# will not be included on a 32-bit host if no 64-bit target is requested, and
-# no "--with-64-bit-bfd" option is given, even if "--enable-targets=all" is
-# used.
-
-# uniq the default and selected vectors in all the configured targets.
-f=""
-for i in $selvecs ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-selvecs="$f"
-
-
-# uniq the associated vectors in all the configured targets.
-f=""
-for i in $assocvecs ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-assocvecs="$f"
-
-
-# uniq the architectures in all the configured targets.
-f=""
-for i in $selarchs ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-selarchs="$f"
-
-# Target backend .o files.
-tb=
-
-elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
-
-for vec in $selvecs
-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. 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" ;;
- aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
- 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" ;;
- 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_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
- bfd_elf32_avr_vec) tb="$tb elf32-avr.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf32_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_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
- bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
- bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
- bfd_elf32_frvfdpic_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
- bfd_elf32_h8300_vec) tb="$tb elf32-h8300.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_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
- bfd_elf32_i386_vec) tb="$tb elf32-i386.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_ia64_hpux_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf";;
- bfd_elf32_ip2k_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;;
- bfd_elf32_iq2000_vec) tb="$tb elf32-iq2000.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m32rlelin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
- bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
- bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
- bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
- bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
- bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
- bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
- bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
- bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
- bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;;
- bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
- 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_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
- # FIXME: We include cofflink.lo not because it's needed for
- # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
- # which needs it but does not list it. Should be fixed in right place.
- bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shblin_vec) tb="$tb elf32-sh.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.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-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_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
- bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
- bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
- bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
- bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; 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 elfxx-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_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_ia64_hpux_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 elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" 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_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64lin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.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_mmo_vec) tb="$tb mmo.lo" 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" ;;
- cris_aout_vec) tb="$tb aout-cris.lo" ;;
- 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_biglittle_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
- 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" ;;
- h8500coff_vec) tb="$tb coff-h8500.lo reloc16.lo" ;;
- host_aout_vec) tb="$tb host-aout.lo aout32.lo" ;;
- hp300bsd_vec) tb="$tb hp300bsd.lo aout32.lo" ;;
- hp300hpux_vec) tb="$tb hp300hpux.lo aout32.lo" ;;
- i386aout_vec) tb="$tb i386aout.lo aout32.lo" ;;
- i386bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;;
- 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" ;;
- 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" ;;
- m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
- m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
- m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
- mach_o_be_vec) tb="$tb mach-o.lo" ;;
- mach_o_le_vec) tb="$tb mach-o.lo" ;;
- mach_o_fat_vec) tb="$tb mach-o.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" ;;
- nlm32_powerpc_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;;
- nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
- or32coff_big_vec) tb="$tb coff-or32.lo cofflink.lo" ;;
- pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
- pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
- pef_vec) tb="$tb pef.lo" ;;
- pef_xlib_vec) tb="$tb pef.lo" ;;
- pdp11_aout_vec) tb="$tb pdp11.lo" ;;
- pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
- ppcboot_vec) tb="$tb ppcboot.lo" ;;
- riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
- rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.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" ;;
- sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
- sym_vec) tb="$tb xsym.lo" ;;
- tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
- tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
- tic4x_coff0_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff0_beh_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff1_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff1_beh_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff2_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff2_beh_vec) tb="$tb coff-tic4x.lo" ;;
- tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff1_beh_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" ;;
- vaxnetbsd_vec) tb="$tb vaxnetbsd.lo aout32.lo" ;;
- vax1knetbsd_vec) tb="$tb vax1knetbsd.lo aout32.lo" ;;
- vaxbsd_vec) tb="$tb vaxbsd.lo aout32.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_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" ;;
- z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;;
-
- # These appear out of order in targets.c
- srec_vec) tb="$tb srec.lo" ;;
- symbolsrec_vec) tb="$tb srec.lo" ;;
- tekhex_vec) tb="$tb tekhex.lo" ;;
- cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
- cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
-
- "") ;;
- *) { echo "configure: error: *** unknown target vector $vec" 1>&2; exit 1; } ;;
- esac
-
- if test ${target_size} = 64; then
- target64=true
- fi
- if test x"${vec}" = x"${defvec}"; then
- bfd_default_target_size=${target_size}
- fi
-done
-
-# Target architecture .o files.
-# A couple of CPUs use shorter file names to avoid problems on DOS
-# filesystems.
-ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.lo/g -e s/mn10200/m10200/ -e s/mn10300/m10300/`
-
-# Weed out duplicate .o files.
-f=""
-for i in $tb ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-tb="$f"
-
-f=""
-for i in $ta ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-ta="$f"
-
-bfd_backends="$tb"
-bfd_machines="$ta"
-
-if test x${all_targets} = xtrue ; then
- bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)'
- bfd_machines="${bfd_machines}"' $(ALL_MACHINES)'
- selvecs=
- havevecs=
- selarchs=
- test -n "$assocvecs" &&
- assocvecs=`echo $assocvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
-else # all_targets is true
- # Only set these if they will be nonempty, for the clever echo.
- havevecs=
- assocvecs=
- test -n "$selvecs" &&
- havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'`
- test -n "$selvecs" &&
- selvecs=`echo $selvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
- test -n "$selarchs" &&
- selarchs=`echo $selarchs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
-fi # all_targets is true
-
-case ${host64}-${target64}-${want64} in
- *true*)
- wordsize=64
- bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
- all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
- if test $BFD_HOST_64_BIT_DEFINED = 0; then
- echo "configure: warning: You have requested a 64 bit BFD configuration, but" 1>&2
- echo "configure: warning: your compiler may not have a 64 bit integral type" 1>&2
- fi
- if test -n "$GCC" ; then
- bad_64bit_gcc=no;
- echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6
-echo "configure:6577: checking for gcc version with buggy 64-bit support" >&5
- # Add more tests for gcc versions with non-working 64-bit support here.
- cat > conftest.$ac_ext <<EOF
-#line 6580 "configure"
-#include "confdefs.h"
-:__GNUC__:__GNUC_MINOR__:__i386__:
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep ": 2 : 91 : 1 :" >/dev/null 2>&1; then
- rm -rf conftest*
- bad_64bit_gcc=yes;
- echo "$ac_t""yes: egcs-1.1.2 on ix86 spotted" 1>&6
-else
- rm -rf conftest*
- echo "$ac_t""no" 1>&6
-fi
-rm -f conftest*
-
- if test $bad_64bit_gcc = yes ; then
- { echo "configure: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" 1>&2; exit 1; }
- fi
- fi
- ;;
- false-false-false)
- wordsize=32
- bfd_libs='$(BFD32_LIBS)'
- all_backends='$(BFD32_BACKENDS)'
- ;;
-esac
-
-
-
-
-
-
-
-
-# Determine the host dependant file_ptr a.k.a. off_t type. In order
-# prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and
-# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long.
-# Hopefully a reasonable assumption since fseeko et.al. should be
-# upward compatible.
-for ac_func in ftello ftello64 fseeko fseeko64
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6622: 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 6627 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:6650: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
- echo $ac_n "checking size of off_t""... $ac_c" 1>&6
-echo "configure:6676: checking size of off_t" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
- cat > conftest.$ac_ext <<EOF
-#line 6682 "configure"
-#include "confdefs.h"
-#include "confdefs.h"
-#include <sys/types.h>
-
-
-int main() {
-switch (0) case 0: case (sizeof (off_t) == $ac_size):;
-; return 0; }
-EOF
-if { (eval echo configure:6692: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_sizeof_off_t=$ac_size
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
- if test x$ac_cv_sizeof_off_t != x ; then break; fi
-done
-
-fi
-
-if test x$ac_cv_sizeof_off_t = x ; then
- { echo "configure: error: cannot determine a size for off_t" 1>&2; exit 1; }
-fi
-echo "$ac_t""$ac_cv_sizeof_off_t" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
-EOF
-
-
-fi
-echo $ac_n "checking file_ptr type""... $ac_c" 1>&6
-echo "configure:6716: checking file_ptr type" >&5
-bfd_file_ptr="long"
-bfd_ufile_ptr="unsigned long"
-if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
- -o x"${ac_cv_sizeof_off_t}" = x8; then
- bfd_file_ptr=BFD_HOST_64_BIT
- bfd_ufile_ptr=BFD_HOST_U_64_BIT
-fi
-echo "$ac_t""$bfd_file_ptr" 1>&6
-
-
-
-
-tdefaults=""
-test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
-test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
-test -n "${assocvecs}" && tdefaults="${tdefaults} -DASSOCIATED_VECS='${assocvecs}'"
-test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
-test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
-
-
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6741: 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 6746 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6751: \"$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*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in getpagesize
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6780: 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 6785 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:6808: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6833: 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
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 6841 "configure"
-#include "confdefs.h"
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the filesystem buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propogated back to all the places they're supposed to be.
-
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
-
-/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
-int
-main()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = malloc(pagesize);
- if (!data)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand();
- umask(0);
- fd = creat("conftestmmap", 0600);
- if (fd < 0)
- exit(1);
- if (write(fd, data, pagesize) != pagesize)
- exit(1);
- close(fd);
-
- /*
- * Next, try to mmap the file at a fixed address which
- * already has something else allocated at it. If we can,
- * also make sure that we see the same garbage.
- */
- fd = open("conftestmmap", O_RDWR);
- if (fd < 0)
- exit(1);
- data2 = malloc(2 * pagesize);
- if (!data2)
- exit(1);
- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit(1);
-
- /*
- * Finally, make sure that changes to the mapped area
- * do not percolate back to the file as seen by read().
- * (This is a bug on some variants of i386 svr4.0.)
- */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = malloc(pagesize);
- if (!data3)
- exit(1);
- if (read(fd, data3, pagesize) != pagesize)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit(1);
- close(fd);
- unlink("conftestmmap");
- exit(0);
-}
-
-EOF
-if { (eval echo configure:6994: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MMAP 1
-EOF
-
-fi
-
-for ac_func in madvise mprotect
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7019: 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 7024 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:7047: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
- true+yes ) cat >> confdefs.h <<\EOF
-#define USE_MMAP 1
-EOF
- ;;
-esac
-
-rm -f doc/config.status
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-DEFS=-DHAVE_CONFIG_H
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@PACKAGE@%$PACKAGE%g
-s%@VERSION@%$VERSION%g
-s%@ACLOCAL@%$ACLOCAL%g
-s%@AUTOCONF@%$AUTOCONF%g
-s%@AUTOMAKE@%$AUTOMAKE%g
-s%@AUTOHEADER@%$AUTOHEADER%g
-s%@MAKEINFO@%$MAKEINFO%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@bfd_version@%$bfd_version%g
-s%@bfd_version_string@%$bfd_version_string%g
-s%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@CC@%$CC%g
-s%@LN_S@%$LN_S%g
-s%@OBJEXT@%$OBJEXT%g
-s%@EXEEXT@%$EXEEXT%g
-s%@STRIP@%$STRIP%g
-s%@LIBTOOL@%$LIBTOOL%g
-s%@WARN_CFLAGS@%$WARN_CFLAGS%g
-s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
-s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
-s%@MAINT@%$MAINT%g
-s%@INSTALL_LIBBFD_TRUE@%$INSTALL_LIBBFD_TRUE%g
-s%@INSTALL_LIBBFD_FALSE@%$INSTALL_LIBBFD_FALSE%g
-s%@bfdlibdir@%$bfdlibdir%g
-s%@bfdincludedir@%$bfdincludedir%g
-s%@CPP@%$CPP%g
-s%@ALLOCA@%$ALLOCA%g
-s%@USE_NLS@%$USE_NLS%g
-s%@MSGFMT@%$MSGFMT%g
-s%@GMSGFMT@%$GMSGFMT%g
-s%@XGETTEXT@%$XGETTEXT%g
-s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
-s%@CATALOGS@%$CATALOGS%g
-s%@CATOBJEXT@%$CATOBJEXT%g
-s%@DATADIRNAME@%$DATADIRNAME%g
-s%@GMOFILES@%$GMOFILES%g
-s%@INSTOBJEXT@%$INSTOBJEXT%g
-s%@INTLDEPS@%$INTLDEPS%g
-s%@INTLLIBS@%$INTLLIBS%g
-s%@INTLOBJS@%$INTLOBJS%g
-s%@POFILES@%$POFILES%g
-s%@POSUB@%$POSUB%g
-s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
-s%@GT_NO@%$GT_NO%g
-s%@GT_YES@%$GT_YES%g
-s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
-s%@l@%$l%g
-s%@HDEFINES@%$HDEFINES%g
-s%@BFD_HOST_64BIT_LONG@%$BFD_HOST_64BIT_LONG%g
-s%@BFD_HOST_LONG_LONG@%$BFD_HOST_LONG_LONG%g
-s%@BFD_HOST_64_BIT_DEFINED@%$BFD_HOST_64_BIT_DEFINED%g
-s%@BFD_HOST_64_BIT@%$BFD_HOST_64_BIT%g
-s%@BFD_HOST_U_64_BIT@%$BFD_HOST_U_64_BIT%g
-s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
-s%@EXEEXT_FOR_BUILD@%$EXEEXT_FOR_BUILD%g
-s%@COREFILE@%$COREFILE%g
-s%@COREFLAG@%$COREFLAG%g
-s%@WIN32LDFLAGS@%$WIN32LDFLAGS%g
-s%@WIN32LIBADD@%$WIN32LIBADD%g
-s%@TDEFINES@%$TDEFINES%g
-s%@wordsize@%$wordsize%g
-s%@bfd_libs@%$bfd_libs%g
-s%@all_backends@%$all_backends%g
-s%@bfd_backends@%$bfd_backends%g
-s%@bfd_machines@%$bfd_machines%g
-s%@bfd_default_target_size@%$bfd_default_target_size%g
-s%@bfd_file_ptr@%$bfd_file_ptr%g
-s%@bfd_ufile_ptr@%$bfd_ufile_ptr%g
-s%@tdefaults@%$tdefaults%g
-
-CEOF
-EOF
-
-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=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.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h:config.in"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
- echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
- else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- fi
- rm -f $ac_file
- mv conftest.h $ac_file
- fi
-fi; done
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
-sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
diff --git a/contrib/binutils/bfd/configure.host b/contrib/binutils/bfd/configure.host
deleted file mode 100644
index 024ed62..0000000
--- a/contrib/binutils/bfd/configure.host
+++ /dev/null
@@ -1,74 +0,0 @@
-# This file is a shell script that overrides some of the tools and
-# flags used on a host specific basis.
-
-# Since the "bfd/hosts" directory is shared by the bfd, opcodes, and
-# binutils directories (at least), the index to it is also shared.
-# This is that index. Each configure.in file should source this file
-# in its per-host part.
-
-# This sets the following shell variables:
-# HDEFINES host specific compiler options
-# host64 set to true if 64 bit types are as fast as 32 bit
-# HOST_64BIT_TYPE host 64 bit type
-# HOST_U_64BIT_TYPE unsigned 64 bit type (not needed if 64BIT_TYPE is long)
-
-HDEFINES=
-host64=false
-HOST_64BIT_TYPE=
-HOST_U_64BIT_TYPE=
-
-case "${host}" in
-
-hppa*-*-hpux*) # HP/UX's ftello64 et.al. declarations are only
- # visible when _LARGEFILE64_SOURCE is defined.
- # Without those declarations, real_ftell et.al.
- # get mis-compiled.
- HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" ;;
-hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
-hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
-hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
-hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
-
-ia64-*-*) host64=true;;
-
-# Workaround for limitations on win9x where file contents are
-# not zero'd out if you seek past the end and then write.
-i[3-7]86-*-mingw32*) HDEFINES=-D__USE_MINGW_FSEEK;;
-
-i[3-7]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
-i[3-7]86-sequent-sysv4*) ;;
-i[3-7]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
-
-mips*-*-netbsd*) ;;
-mips*-*-openbsd*) ;;
-mips*-dec-*) HDEFINES="-G 4" ;;
-mips*-sgi-irix3*) HDEFINES="-G 4" ;;
-mips*-sgi-irix4*) HDEFINES="-G 4" ;;
-mips*-sgi-irix6*) host64=true;;
-mips64*-*-linux*) host64=true;;
-mips*-*-sysv4*) ;;
-mips*-*-sysv*) HDEFINES="-G 4" ;;
-mips*-*-riscos*) HDEFINES="-G 4" ;;
-
-m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
-
-*-*-windows*)
- HOST_64BIT_TYPE=__int64
- HOST_U_64BIT_TYPE="unsigned __int64"
-# The following krock is necessary because we can't run the build compiler
-# (MSVC) on the configure host, so we have to explicitly set the values here.
-# Note that this file is never run through autoconf, so we can't use any
-# autoconf macros here. Because of this, we have to muck with autoconf
-# variables explicitly.
- ac_cv_func_mmap_fixed_mapped=no
- ac_cv_header_time=no
- ac_cv_func_getpagesize=no
- ac_cv_func_madvise=no
- ac_cv_func_mprotect=no
- ac_cv_func_getuid=no
- ac_cv_func_getgid=no
- ac_cv_header_sys_file_h=no
- ac_cv_header_sys_time_h=no
- ac_cv_header_unistd_h=no
- ;;
-esac
diff --git a/contrib/binutils/bfd/configure.in b/contrib/binutils/bfd/configure.in
deleted file mode 100644
index 837b753..0000000
--- a/contrib/binutils/bfd/configure.in
+++ /dev/null
@@ -1,949 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-dnl
-
-AC_PREREQ(2.13)
-AC_INIT(libbfd.c)
-
-AC_CANONICAL_SYSTEM
-AC_ISC_POSIX
-
-AM_INIT_AUTOMAKE(bfd, 2.15)
-# Uncomment the next line to remove the date from the reported bfd version
-#is_release=y
-
-changequote(,)dnl
-bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
-changequote([,])dnl
-
-bfd_version_string="\"${VERSION}\""
-if test x${is_release} = x; then
- bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
- bfd_version_string="\"${VERSION} ${bfd_version_date}\""
-fi
-AC_SUBST(bfd_version)
-AC_SUBST(bfd_version_string)
-
-dnl These must be called before AM_PROG_LIBTOOL, because it may want
-dnl to call AC_CHECK_PROG.
-AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-
-dnl Default to a non shared library. This may be overridden by the
-dnl configure option --enable-shared.
-AM_DISABLE_SHARED
-
-AM_PROG_LIBTOOL
-
-AC_ARG_ENABLE(64-bit-bfd,
-[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
-[case "${enableval}" in
- yes) want64=true ;;
- no) want64=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
-esac],[want64=false])dnl
-AC_ARG_ENABLE(targets,
-[ --enable-targets alternative target configurations],
-[case "${enableval}" in
- yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
- ;;
- no) enable_targets= ;;
- *) enable_targets=$enableval ;;
-esac])dnl
-AC_ARG_ENABLE(commonbfdlib,
-[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
-[case "${enableval}" in
- yes) commonbfdlib=true ;;
- no) commonbfdlib=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
-esac])dnl
-AC_ARG_WITH(mmap,
-[ --with-mmap try using mmap for BFD input files if available],
-[case "${withval}" in
- yes) want_mmap=true ;;
- no) want_mmap=false ;;
- *) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
-esac],[want_mmap=false])dnl
-
-build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-AC_ARG_ENABLE(build-warnings,
-[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
-[case "${enableval}" in
- yes) ;;
- no) build_warnings="-w";;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${build_warnings} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${t} ${build_warnings}";;
- *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-esac
-if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
- echo "Setting warning flags = $build_warnings" 6>&1
-fi])dnl
-WARN_CFLAGS=""
-if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then
- WARN_CFLAGS="${build_warnings}"
-fi
-AC_SUBST(WARN_CFLAGS)
-
-AM_CONFIG_HEADER(config.h:config.in)
-
-if test -z "$target" ; then
- AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
-fi
-
-AM_MAINTAINER_MODE
-AM_INSTALL_LIBBFD
-AC_EXEEXT
-
-host64=false
-target64=false
-bfd_default_target_size=32
-
-# host stuff:
-
-AC_PROG_CC
-
-ALL_LINGUAS="fr tr ja es sv da zh_CN ro"
-CY_GNU_GETTEXT
-
-# Permit host specific settings.
-. ${srcdir}/configure.host
-
-AC_SUBST(HDEFINES)
-AC_PROG_INSTALL
-
-BFD_HOST_64BIT_LONG=0
-BFD_HOST_LONG_LONG=0
-BFD_HOST_64_BIT_DEFINED=0
-BFD_HOST_64_BIT=
-BFD_HOST_U_64_BIT=
-
-AC_MSG_CHECKING([for long long])
-AC_CACHE_VAL(bfd_cv_has_long_long,
-[AC_TRY_COMPILE(,
-[unsigned long long ll = 18446744073709551615ULL;],
-bfd_cv_has_long_long=yes, bfd_cv_has_long_long=no)])
-AC_MSG_RESULT($bfd_cv_has_long_long)
-if test $bfd_cv_has_long_long = yes; then
- BFD_HOST_LONG_LONG=1
- AC_COMPILE_CHECK_SIZEOF(long long)
-fi
-
-AC_COMPILE_CHECK_SIZEOF(long)
-if test "x${ac_cv_sizeof_long}" = "x8"; then
- host64=true
- BFD_HOST_64BIT_LONG=1
- test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
- test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
- test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
- test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
-fi
-
-if test -n "${HOST_64BIT_TYPE}" -a -n "${HOST_U_64BIT_TYPE}"; then
- BFD_HOST_64_BIT_DEFINED=1
- BFD_HOST_64_BIT="${HOST_64BIT_TYPE}"
- BFD_HOST_U_64_BIT="${HOST_U_64BIT_TYPE}"
-fi
-
-AC_SUBST(BFD_HOST_64BIT_LONG)
-AC_SUBST(BFD_HOST_LONG_LONG)
-AC_SUBST(BFD_HOST_64_BIT_DEFINED)
-AC_SUBST(BFD_HOST_64_BIT)
-AC_SUBST(BFD_HOST_U_64_BIT)
-
-BFD_CC_FOR_BUILD
-
-AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h)
-AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
-AC_HEADER_TIME
-AC_HEADER_DIRENT
-AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
-AC_CHECK_FUNCS(strtoull)
-
-BFD_BINARY_FOPEN
-
-BFD_NEED_DECLARATION(strstr)
-BFD_NEED_DECLARATION(malloc)
-BFD_NEED_DECLARATION(realloc)
-BFD_NEED_DECLARATION(free)
-BFD_NEED_DECLARATION(getenv)
-
-# If we are configured native, pick a core file support file.
-COREFILE=
-COREFLAG=
-TRAD_HEADER=
-if test "${target}" = "${host}"; then
- case "${host}" in
- alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
- COREFILE=''
- ;;
- alpha*-*-linux-gnu*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/alphalinux.h"'
- ;;
- alpha*-*-netbsd* | alpha*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- alpha*-*-*) COREFILE=osf-core.lo ;;
- arm-*-freebsd* | arm-*-kfreebsd*-gnu)
- COREFILE='' ;;
- arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
- arm-*-riscix) COREFILE=trad-core.lo ;;
- hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
- hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
- hppa*-*-mpeix*) COREFILE=hpux-core.lo ;;
- hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo"
- COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
- i370-*-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i370linux.h"'
- ;;
-
-changequote(,)dnl
- i[3-7]86-sequent-bsd*)
-changequote([,])dnl
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/symmetry.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-sequent-sysv4*) ;;
- i[3-7]86-sequent-sysv*)
-changequote([,])dnl
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/symmetry.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-*-bsdi)
-changequote([,])dnl
- COREFILE=
- ;;
-changequote(,)dnl
- i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234]* | i[3-7]86-*-freebsd*aout*)
-changequote([,])dnl
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386bsd.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
-changequote([,])dnl
- COREFILE=''
- TRAD_HEADER='"hosts/i386bsd.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu | i[3-7]86-*-openbsd*)
-changequote([,])dnl
- COREFILE=netbsd-core.lo
- ;;
-changequote(,)dnl
- i[3-7]86-esix-sysv3*)
-changequote([,])dnl
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/esix.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-*-sco3.2v5*)
-changequote([,])dnl
- COREFILE=sco5-core.lo
- ;;
-changequote(,)dnl
- i[3-7]86-*-sco* | i[3-7]86-*-isc*)
-changequote([,])dnl
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386sco.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-*-mach3*)
-changequote([,])dnl
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386mach3.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-*-linux-gnu*)
-changequote([,])dnl
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i386linux.h"'
- ;;
-changequote(,)dnl
- i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
- i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
-changequote([,])dnl
- i860-*-mach3* | i860-*-osf1*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/i860mach3.h"'
- ;;
- mips-*-netbsd* | mips*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- mips-dec-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/decstation.h"'
- ;;
- mips-sgi-irix4*) COREFILE=irix-core.lo ;;
- mips-sgi-irix5*) COREFILE=irix-core.lo ;;
- mips-sgi-irix6*) COREFILE=irix-core.lo ;;
- mips-*-sysv4*) ;;
- mips-*-sysv* | mips-*-riscos*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/riscos.h"'
- ;;
- mips-sony-bsd*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/news-mips.h"'
- ;;
- m68*-bull*-sysv*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/dpx2.h"'
- ;;
- m68*-hp-hpux*) COREFILE=hpux-core.lo ;;
- m68*-hp-bsd*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/hp300bsd.h"'
- ;;
- m68*-*-linux-gnu*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/m68klinux.h"'
- ;;
- m68*-motorola-sysv*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/delta68.h"'
- ;;
- m68*-sony-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/news.h"'
- ;;
- m68*-*-netbsd* | m68*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- m68*-apple-aux*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/m68kaux.h"'
- ;;
- m88*-*-sysv4*)
- ;;
- m88*-motorola-sysv*)
- COREFILE=ptrace-core.lo
- ;;
- m88*-*-mach3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/m88kmach3.h"'
- ;;
- ns32k-pc532-mach)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/pc532mach.h"'
- ;;
- ns32k-*-netbsd* | ns32k-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- rs6000-*-lynx*)
- COREFILE=lynx-core.lo
- ;;
- rs6000-*-aix5.* | powerpc-*-aix5.*)
- COREFILE=rs6000-core.lo
- COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE"
- ;;
-changequote(,)dnl
- rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*)
-changequote([,])dnl
- COREFILE=rs6000-core.lo
- COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE"
- # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE
- # have c_impl as a member of struct core_dumpx
- AC_MSG_CHECKING([for c_impl in struct core_dumpx])
- AC_TRY_COMPILE([#include <core.h>],
- [struct core_dumpx c; c.c_impl = 0;],
- [AC_DEFINE(HAVE_ST_C_IMPL, 1,
- [Define if struct core_dumpx has member c_impl])
- AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
- ;;
- rs6000-*-aix4*) COREFILE=rs6000-core.lo ;;
- rs6000-*-*) COREFILE=rs6000-core.lo ;;
- powerpc-*-aix4*) COREFILE=rs6000-core.lo ;;
- powerpc-*-aix*) COREFILE=rs6000-core.lo ;;
- powerpc-*-beos*) ;;
- powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
- COREFILE='' ;;
- powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
- powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
- s390*-*-*) COREFILE=trad-core.lo ;;
- sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
- sparc-*-netbsd* | sparc*-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- tahoe-*-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/tahoe.h"'
- ;;
- vax-*-netbsd* | vax-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- vax-*-ultrix2*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxult2.h"'
- ;;
- vax-*-ultrix*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxult2.h"'
- ;;
- vax-*-linux-gnu*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxlinux.h"'
- ;;
- vax-*-*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/vaxbsd.h"'
- ;;
- x86_64-*-netbsd* | x86_64-*-openbsd*)
- COREFILE=netbsd-core.lo
- ;;
- esac
-
- case "$COREFILE" in
- aix386-core.lo) COREFLAG=-DAIX386_CORE ;;
- hppabsd-core.lo) COREFLAG=-DHPPABSD_CORE ;;
- hpux-core.lo) COREFLAG=-DHPUX_CORE ;;
- irix-core.lo) COREFLAG=-DIRIX_CORE ;;
- lynx-core.lo) COREFLAG=-DLYNX_CORE ;;
- netbsd-core.lo) COREFLAG=-DNETBSD_CORE ;;
- osf-core.lo) COREFLAG=-DOSF_CORE ;;
- ptrace-core.lo) COREFLAG=-DPTRACE_CORE ;;
- rs6000-core.lo) COREFLAG="$COREFLAG -DAIX_CORE" ;;
- sco5-core.lo) COREFLAG="$COREFLAG -DSCO5_CORE" ;;
- trad-core.lo) COREFLAG="$COREFLAG -DTRAD_CORE" ;;
- esac
-
- # ELF corefile support has several flavors, but all of
- # them use something called <sys/procfs.h>
- AC_CHECK_HEADERS(sys/procfs.h)
- if test "$ac_cv_header_sys_procfs_h" = yes; then
- BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t)
- BFD_HAVE_SYS_PROCFS_TYPE(prstatus32_t)
- BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus_t, pr_who)
- BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus32_t, pr_who)
- BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
- BFD_HAVE_SYS_PROCFS_TYPE(pxstatus_t)
- BFD_HAVE_SYS_PROCFS_TYPE(pstatus32_t)
- BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
- BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo32_t)
- BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
- BFD_HAVE_SYS_PROCFS_TYPE(psinfo32_t)
- BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
- BFD_HAVE_SYS_PROCFS_TYPE(lwpxstatus_t)
- BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
- BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_reg)
- BFD_HAVE_SYS_PROCFS_TYPE(win32_pstatus_t)
- fi
-fi
-AC_SUBST(COREFILE)
-AC_SUBST(COREFLAG)
-if test -n "$TRAD_HEADER"; then
- AC_DEFINE_UNQUOTED(TRAD_HEADER, $TRAD_HEADER,
- [Name of host specific header file to include in trad-core.c.])
-fi
-
-# Horrible hacks to build DLLs on Windows.
-WIN32LDFLAGS=
-WIN32LIBADD=
-case "${host}" in
-*-*-cygwin*)
- if test "$enable_shared" = "yes"; then
- WIN32LDFLAGS="-no-undefined"
- WIN32LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
- fi
- ;;
-*-*-linux*)
- # We borrow WIN32LIBADD so that the shared libbfd won't depend on
- # libiberty.a.
- case "${host}" in
- mips*-*-linux*)
- # Linux/MIPS uses PIC by default.
- if test "$enable_shared" = "yes"; then
- WIN32LIBADD="-L../libiberty -liberty"
- fi
- ;;
- *)
-changequote(,)dnl
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
-changequote([,])dnl
- if test -n "$x"; then
- WIN32LIBADD="-L../libiberty/pic -liberty"
- fi
- ;;
- esac
- ;;
-esac
-AC_SUBST(WIN32LDFLAGS)
-AC_SUBST(WIN32LIBADD)
-
-# target stuff:
-
-# Canonicalize the secondary target names.
-if test -n "$enable_targets" ; then
- for targ in `echo $enable_targets | sed 's/,/ /g'`
- do
- result=`$ac_config_sub $targ 2>/dev/null`
- if test -n "$result" ; then
- canon_targets="$canon_targets $result"
- else
- # Allow targets that config.sub doesn't recognize, like "all".
- canon_targets="$canon_targets $targ"
- fi
- done
-fi
-
-all_targets=false
-defvec=
-selvecs=
-assocvecs=
-selarchs=
-TDEFINES=
-for targ in $target $canon_targets
-do
- if test "x$targ" = "xall"; then
- all_targets=true
- assocvecs="$assocvecs $targ_defvec $targ_selvecs"
- else
- . $srcdir/config.bfd
- if test "x$targ" = "x$target"; then
- defvec=$targ_defvec
- fi
- selvecs="$selvecs $targ_defvec $targ_selvecs"
- selarchs="$selarchs $targ_archs"
- TDEFINES="$TDEFINES $targ_cflags"
- fi
-done
-AC_SUBST(TDEFINES)
-
-# This processing still needs to be done if we're to decide properly whether
-# 64-bit support needs to be compiled in. Currently, it will be included if
-# the default or any other explicitly requested target requires it; it
-# will not be included on a 32-bit host if no 64-bit target is requested, and
-# no "--with-64-bit-bfd" option is given, even if "--enable-targets=all" is
-# used.
-
-# uniq the default and selected vectors in all the configured targets.
-f=""
-for i in $selvecs ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-selvecs="$f"
-
-
-# uniq the associated vectors in all the configured targets.
-f=""
-for i in $assocvecs ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-assocvecs="$f"
-
-
-# uniq the architectures in all the configured targets.
-f=""
-for i in $selarchs ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-selarchs="$f"
-
-# Target backend .o files.
-tb=
-
-elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
-
-for vec in $selvecs
-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. 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" ;;
- aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
- 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" ;;
- 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_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
- bfd_elf32_avr_vec) tb="$tb elf32-avr.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf32_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_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
- bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
- bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
- bfd_elf32_frvfdpic_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
- bfd_elf32_h8300_vec) tb="$tb elf32-h8300.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_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
- bfd_elf32_i386_vec) tb="$tb elf32-i386.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_ia64_hpux_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf";;
- bfd_elf32_ip2k_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;;
- bfd_elf32_iq2000_vec) tb="$tb elf32-iq2000.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m32rlelin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
- bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
- bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
- bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
- bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
- bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
- bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
- bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
- bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
- bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;;
- bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
- 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_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
- # FIXME: We include cofflink.lo not because it's needed for
- # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
- # which needs it but does not list it. Should be fixed in right place.
- bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shblin_vec) tb="$tb elf32-sh.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.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-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_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
- bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
- bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
- bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
- bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; 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 elfxx-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_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_ia64_hpux_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 elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" 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_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64lin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.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 elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
- bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.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_mmo_vec) tb="$tb mmo.lo" 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" ;;
- cris_aout_vec) tb="$tb aout-cris.lo" ;;
- 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_biglittle_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
- 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" ;;
- h8500coff_vec) tb="$tb coff-h8500.lo reloc16.lo" ;;
- host_aout_vec) tb="$tb host-aout.lo aout32.lo" ;;
- hp300bsd_vec) tb="$tb hp300bsd.lo aout32.lo" ;;
- hp300hpux_vec) tb="$tb hp300hpux.lo aout32.lo" ;;
- i386aout_vec) tb="$tb i386aout.lo aout32.lo" ;;
- i386bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;;
- 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" ;;
- 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" ;;
- m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
- m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
- m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
- mach_o_be_vec) tb="$tb mach-o.lo" ;;
- mach_o_le_vec) tb="$tb mach-o.lo" ;;
- mach_o_fat_vec) tb="$tb mach-o.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" ;;
- nlm32_powerpc_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;;
- nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
- or32coff_big_vec) tb="$tb coff-or32.lo cofflink.lo" ;;
- pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
- pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
- pef_vec) tb="$tb pef.lo" ;;
- pef_xlib_vec) tb="$tb pef.lo" ;;
- pdp11_aout_vec) tb="$tb pdp11.lo" ;;
- pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
- ppcboot_vec) tb="$tb ppcboot.lo" ;;
- riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
- rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.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" ;;
- sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
- sym_vec) tb="$tb xsym.lo" ;;
- tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
- tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
- tic4x_coff0_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff0_beh_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff1_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff1_beh_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff2_vec) tb="$tb coff-tic4x.lo" ;;
- tic4x_coff2_beh_vec) tb="$tb coff-tic4x.lo" ;;
- tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff1_beh_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" ;;
- vaxnetbsd_vec) tb="$tb vaxnetbsd.lo aout32.lo" ;;
- vax1knetbsd_vec) tb="$tb vax1knetbsd.lo aout32.lo" ;;
- vaxbsd_vec) tb="$tb vaxbsd.lo aout32.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_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" ;;
- z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;;
-
- # These appear out of order in targets.c
- srec_vec) tb="$tb srec.lo" ;;
- symbolsrec_vec) tb="$tb srec.lo" ;;
- tekhex_vec) tb="$tb tekhex.lo" ;;
- cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
- cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
-
- "") ;;
- *) AC_MSG_ERROR(*** unknown target vector $vec) ;;
- esac
-
- if test ${target_size} = 64; then
- target64=true
- fi
- if test x"${vec}" = x"${defvec}"; then
- bfd_default_target_size=${target_size}
- fi
-done
-
-# Target architecture .o files.
-# A couple of CPUs use shorter file names to avoid problems on DOS
-# filesystems.
-ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.lo/g -e s/mn10200/m10200/ -e s/mn10300/m10300/`
-
-# Weed out duplicate .o files.
-f=""
-for i in $tb ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-tb="$f"
-
-f=""
-for i in $ta ; do
- case " $f " in
- *" $i "*) ;;
- *) f="$f $i" ;;
- esac
-done
-ta="$f"
-
-bfd_backends="$tb"
-bfd_machines="$ta"
-
-if test x${all_targets} = xtrue ; then
- bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)'
- bfd_machines="${bfd_machines}"' $(ALL_MACHINES)'
- selvecs=
- havevecs=
- selarchs=
- test -n "$assocvecs" &&
- assocvecs=`echo $assocvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
-else # all_targets is true
- # Only set these if they will be nonempty, for the clever echo.
- havevecs=
- assocvecs=
- test -n "$selvecs" &&
- havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'`
- test -n "$selvecs" &&
- selvecs=`echo $selvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
- test -n "$selarchs" &&
- selarchs=`echo $selarchs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
-fi # all_targets is true
-
-case ${host64}-${target64}-${want64} in
- *true*)
- wordsize=64
- bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
- all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
- if test $BFD_HOST_64_BIT_DEFINED = 0; then
- AC_MSG_WARN([You have requested a 64 bit BFD configuration, but])
- AC_MSG_WARN([your compiler may not have a 64 bit integral type])
- fi
- if test -n "$GCC" ; then
- bad_64bit_gcc=no;
- AC_MSG_CHECKING([for gcc version with buggy 64-bit support])
- # Add more tests for gcc versions with non-working 64-bit support here.
- AC_EGREP_CPP([: 2 : 91 : 1 :],[:__GNUC__:__GNUC_MINOR__:__i386__:],
- bad_64bit_gcc=yes;
- AC_MSG_RESULT([yes: egcs-1.1.2 on ix86 spotted]),
- AC_MSG_RESULT(no))
- if test $bad_64bit_gcc = yes ; then
- AC_ERROR([A newer version of gcc is needed for the requested 64-bit BFD configuration])
- fi
- fi
- ;;
- false-false-false)
- wordsize=32
- bfd_libs='$(BFD32_LIBS)'
- all_backends='$(BFD32_BACKENDS)'
- ;;
-esac
-
-AC_SUBST(wordsize)
-AC_SUBST(bfd_libs)
-AC_SUBST(all_backends)
-AC_SUBST(bfd_backends)
-AC_SUBST(bfd_machines)
-AC_SUBST(bfd_default_target_size)
-
-# Determine the host dependant file_ptr a.k.a. off_t type. In order
-# prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and
-# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long.
-# Hopefully a reasonable assumption since fseeko et.al. should be
-# upward compatible.
-AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64)
-if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
- AC_COMPILE_CHECK_SIZEOF(off_t)
-fi
-AC_MSG_CHECKING([file_ptr type])
-bfd_file_ptr="long"
-bfd_ufile_ptr="unsigned long"
-if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
- -o x"${ac_cv_sizeof_off_t}" = x8; then
- bfd_file_ptr=BFD_HOST_64_BIT
- bfd_ufile_ptr=BFD_HOST_U_64_BIT
-fi
-AC_MSG_RESULT($bfd_file_ptr)
-AC_SUBST(bfd_file_ptr)
-AC_SUBST(bfd_ufile_ptr)
-
-
-tdefaults=""
-test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
-test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
-test -n "${assocvecs}" && tdefaults="${tdefaults} -DASSOCIATED_VECS='${assocvecs}'"
-test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
-test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
-AC_SUBST(tdefaults)
-
-dnl AC_CHECK_HEADERS(sys/mman.h)
-AC_FUNC_MMAP
-AC_CHECK_FUNCS(madvise mprotect)
-case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
- true+yes ) AC_DEFINE(USE_MMAP, 1, [Use mmap if it's available?]) ;;
-esac
-
-rm -f doc/config.status
-AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in,
-[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile])
-
diff --git a/contrib/binutils/bfd/corefile.c b/contrib/binutils/bfd/corefile.c
deleted file mode 100644
index 8af4f45..0000000
--- a/contrib/binutils/bfd/corefile.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Core file generic interface routines for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- Core files
-
-DESCRIPTION
- These are functions pertaining to core files.
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-/*
-FUNCTION
- bfd_core_file_failing_command
-
-SYNOPSIS
- const char *bfd_core_file_failing_command (bfd *abfd);
-
-DESCRIPTION
- Return a read-only string explaining which program was running
- when it failed and produced the core file @var{abfd}.
-
-*/
-
-const char *
-bfd_core_file_failing_command (bfd *abfd)
-{
- if (abfd->format != bfd_core)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
- return BFD_SEND (abfd, _core_file_failing_command, (abfd));
-}
-
-/*
-FUNCTION
- bfd_core_file_failing_signal
-
-SYNOPSIS
- int bfd_core_file_failing_signal (bfd *abfd);
-
-DESCRIPTION
- Returns the signal number which caused the core dump which
- generated the file the BFD @var{abfd} is attached to.
-*/
-
-int
-bfd_core_file_failing_signal (bfd *abfd)
-{
- if (abfd->format != bfd_core)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return 0;
- }
- return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
-}
-
-/*
-FUNCTION
- core_file_matches_executable_p
-
-SYNOPSIS
- bfd_boolean core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
-
-DESCRIPTION
- Return <<TRUE>> if the core file attached to @var{core_bfd}
- was generated by a run of the executable file attached to
- @var{exec_bfd}, <<FALSE>> otherwise.
-*/
-
-bfd_boolean
-core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
-{
- if (core_bfd->format != bfd_core || exec_bfd->format != bfd_object)
- {
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- return BFD_SEND (core_bfd, _core_file_matches_executable_p,
- (core_bfd, exec_bfd));
-}
diff --git a/contrib/binutils/bfd/cpu-alpha.c b/contrib/binutils/bfd/cpu-alpha.c
deleted file mode 100644
index c593fc3..0000000
--- a/contrib/binutils/bfd/cpu-alpha.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* BFD support for the Alpha architecture.
- Copyright 1992, 1993, 1998, 2000, 2002 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
- { \
- BITS_WORD, /* bits in a word */ \
- BITS_ADDR, /* bits in an address */ \
- 8, /* 8 bits in a byte */ \
- bfd_arch_alpha, \
- NUMBER, \
- "alpha", \
- PRINT, \
- 3, \
- DEFAULT, \
- bfd_default_compatible, \
- bfd_default_scan, \
- NEXT, \
- }
-
-#define NN(index) (&arch_info_struct[index])
-
-/* These exist only so that we can reasonably disassemble PALcode. */
-static const bfd_arch_info_type arch_info_struct[] =
-{
- N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", FALSE, NN(1)),
- N (64, 64, bfd_mach_alpha_ev5, "alpha:ev5", FALSE, NN(2)),
- N (64, 64, bfd_mach_alpha_ev6, "alpha:ev6", FALSE, 0),
-};
-
-const bfd_arch_info_type bfd_alpha_arch =
- N (64, 64, 0, "alpha", TRUE, NN(0));
diff --git a/contrib/binutils/bfd/cpu-arc.c b/contrib/binutils/bfd/cpu-arc.c
deleted file mode 100644
index c69df0e..0000000
--- a/contrib/binutils/bfd/cpu-arc.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* BFD support for the ARC processor
- Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc.
- Contributed by Doug Evans (dje@cygnus.com).
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#define ARC(mach, print_name, default_p, next) \
-{ \
- 32, /* 32 bits in a word */ \
- 32, /* 32 bits in an address */ \
- 8, /* 8 bits in a byte */ \
- bfd_arch_arc, \
- mach, \
- "arc", \
- print_name, \
- 4, /* section alignment power */ \
- default_p, \
- bfd_default_compatible, \
- bfd_default_scan, \
- next, \
- }
-
-static const bfd_arch_info_type arch_info_struct[] =
-{
- ARC ( bfd_mach_arc_5, "arc5", FALSE, &arch_info_struct[1] ),
- ARC ( bfd_mach_arc_5, "base", FALSE, &arch_info_struct[2] ),
- ARC ( bfd_mach_arc_6, "arc6", FALSE, &arch_info_struct[3] ),
- ARC ( bfd_mach_arc_7, "arc7", FALSE, &arch_info_struct[4] ),
- ARC ( bfd_mach_arc_8, "arc8", FALSE, NULL ),
-};
-
-const bfd_arch_info_type bfd_arc_arch =
- ARC ( bfd_mach_arc_6, "arc", TRUE, &arch_info_struct[0] );
-
-/* Utility routines. */
-
-/* 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;
-{
- const bfd_arch_info_type *p;
-
- for (p = &bfd_arc_arch; p != NULL; p = p->next)
- if (strcmp (name, p->printable_name) == 0)
- return p->mach;
- return -1;
-}
diff --git a/contrib/binutils/bfd/cpu-arm.c b/contrib/binutils/bfd/cpu-arm.c
deleted file mode 100644
index 17889f3..0000000
--- a/contrib/binutils/bfd/cpu-arm.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/* BFD support for the ARM processor
- Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libiberty.h"
-
-static const bfd_arch_info_type * compatible
- PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
-static bfd_boolean scan
- PARAMS ((const struct bfd_arch_info *, const char *));
-static bfd_boolean arm_check_note
- PARAMS ((bfd *, char *, bfd_size_type, const char *, char **));
-
-/* This routine is provided two arch_infos and works out which ARM
- machine which would be compatible with both and returns a pointer
- to its info structure. */
-
-static const bfd_arch_info_type *
-compatible (a,b)
- const bfd_arch_info_type * a;
- const bfd_arch_info_type * b;
-{
- /* If a & b are for different architecture we can do nothing. */
- if (a->arch != b->arch)
- return NULL;
-
- /* If a & b are for the same machine then all is well. */
- if (a->mach == b->mach)
- return a;
-
- /* Otherwise if either a or b is the 'default' machine
- then it can be polymorphed into the other. */
- if (a->the_default)
- return b;
-
- if (b->the_default)
- return a;
-
- /* So far all newer ARM architecture cores are
- supersets of previous cores. */
- if (a->mach < b->mach)
- return b;
- else if (a->mach > b->mach)
- return a;
-
- /* Never reached! */
- return NULL;
-}
-
-static struct
-{
- unsigned int mach;
- char * name;
-}
-processors[] =
-{
- { bfd_mach_arm_2, "arm2" },
- { bfd_mach_arm_2a, "arm250" },
- { bfd_mach_arm_2a, "arm3" },
- { bfd_mach_arm_3, "arm6" },
- { bfd_mach_arm_3, "arm60" },
- { bfd_mach_arm_3, "arm600" },
- { bfd_mach_arm_3, "arm610" },
- { bfd_mach_arm_3, "arm7" },
- { bfd_mach_arm_3, "arm710" },
- { bfd_mach_arm_3, "arm7500" },
- { bfd_mach_arm_3, "arm7d" },
- { bfd_mach_arm_3, "arm7di" },
- { bfd_mach_arm_3M, "arm7dm" },
- { bfd_mach_arm_3M, "arm7dmi" },
- { bfd_mach_arm_4T, "arm7tdmi" },
- { bfd_mach_arm_4, "arm8" },
- { bfd_mach_arm_4, "arm810" },
- { bfd_mach_arm_4, "arm9" },
- { bfd_mach_arm_4, "arm920" },
- { bfd_mach_arm_4T, "arm920t" },
- { bfd_mach_arm_4T, "arm9tdmi" },
- { bfd_mach_arm_4, "sa1" },
- { bfd_mach_arm_4, "strongarm"},
- { bfd_mach_arm_4, "strongarm110" },
- { bfd_mach_arm_4, "strongarm1100" },
- { bfd_mach_arm_XScale, "xscale" },
- { bfd_mach_arm_ep9312, "ep9312" },
- { bfd_mach_arm_iWMMXt, "iwmmxt" }
-};
-
-static bfd_boolean
-scan (info, string)
- const struct bfd_arch_info * info;
- const char * string;
-{
- int i;
-
- /* First test for an exact match. */
- if (strcasecmp (string, info->printable_name) == 0)
- return TRUE;
-
- /* Next check for a processor name instead of an Architecture name. */
- for (i = sizeof (processors) / sizeof (processors[0]); i--;)
- {
- if (strcasecmp (string, processors [i].name) == 0)
- break;
- }
-
- if (i != -1 && info->mach == processors [i].mach)
- return TRUE;
-
- /* Finally check for the default architecture. */
- if (strcasecmp (string, "arm") == 0)
- return info->the_default;
-
- return FALSE;
-}
-
-#define N(number, print, default, next) \
-{ 32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
-
-static const bfd_arch_info_type arch_info_struct[] =
-{
- N (bfd_mach_arm_2, "armv2", FALSE, & arch_info_struct[1]),
- N (bfd_mach_arm_2a, "armv2a", FALSE, & arch_info_struct[2]),
- N (bfd_mach_arm_3, "armv3", FALSE, & arch_info_struct[3]),
- N (bfd_mach_arm_3M, "armv3m", FALSE, & arch_info_struct[4]),
- N (bfd_mach_arm_4, "armv4", FALSE, & arch_info_struct[5]),
- N (bfd_mach_arm_4T, "armv4t", FALSE, & arch_info_struct[6]),
- N (bfd_mach_arm_5, "armv5", FALSE, & arch_info_struct[7]),
- N (bfd_mach_arm_5T, "armv5t", FALSE, & arch_info_struct[8]),
- N (bfd_mach_arm_5TE, "armv5te", FALSE, & arch_info_struct[9]),
- N (bfd_mach_arm_XScale, "xscale", FALSE, & arch_info_struct[10]),
- N (bfd_mach_arm_ep9312, "ep9312", FALSE, & arch_info_struct[11]),
- N (bfd_mach_arm_iWMMXt,"iwmmxt", FALSE, NULL)
-};
-
-const bfd_arch_info_type bfd_arm_arch =
- N (0, "arm", TRUE, & arch_info_struct[0]);
-
-/* Support functions used by both the COFF and ELF versions of the ARM port. */
-
-/* Handle the merging of the 'machine' settings of input file IBFD
- and an output file OBFD. These values actually represent the
- different possible ARM architecture variants.
- Returns TRUE if they were merged successfully or FALSE otherwise. */
-
-bfd_boolean
-bfd_arm_merge_machines (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
-{
- unsigned int in = bfd_get_mach (ibfd);
- unsigned int out = bfd_get_mach (obfd);
-
- /* If the output architecture is unknown, we now have a value to set. */
- if (out == bfd_mach_arm_unknown)
- bfd_set_arch_mach (obfd, bfd_arch_arm, in);
-
- /* If the input architecture is unknown,
- then so must be the output architecture. */
- else if (in == bfd_mach_arm_unknown)
- /* FIXME: We ought to have some way to
- override this on the command line. */
- bfd_set_arch_mach (obfd, bfd_arch_arm, bfd_mach_arm_unknown);
-
- /* If they are the same then nothing needs to be done. */
- else if (out == in)
- ;
-
- /* Otherwise the general principle that a earlier architecture can be
- linked with a later architecture to produce a binary that will execute
- on the later architecture.
-
- We fail however if we attempt to link a Cirrus EP9312 binary with an
- Intel XScale binary, since these architecture have co-processors which
- will not both be present on the same physical hardware. */
- else if (in == bfd_mach_arm_ep9312
- && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt))
- {
- _bfd_error_handler (_("\
-ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
- else if (out == bfd_mach_arm_ep9312
- && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt))
- {
- _bfd_error_handler (_("\
-ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
- bfd_archive_filename (obfd),
- bfd_get_filename (ibfd));
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
- else if (in > out)
- bfd_set_arch_mach (obfd, bfd_arch_arm, in);
- /* else
- Nothing to do. */
-
- return TRUE;
-}
-
-typedef struct
-{
- unsigned char namesz[4]; /* Size of entry's owner string. */
- unsigned char descsz[4]; /* Size of the note descriptor. */
- unsigned char type[4]; /* Interpretation of the descriptor. */
- char name[1]; /* Start of the name+desc data. */
-} arm_Note;
-
-static bfd_boolean
-arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
- bfd * abfd;
- char * buffer;
- bfd_size_type buffer_size;
- const char * expected_name;
- char ** description_return;
-{
- unsigned long namesz;
- unsigned long descsz;
- unsigned long type;
- char * descr;
-
- if (buffer_size < offsetof (arm_Note, name))
- return FALSE;
-
- /* We have to extract the values this way to allow for a
- host whose endian-ness is different from the target. */
- namesz = bfd_get_32 (abfd, buffer);
- descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz));
- type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type));
- descr = buffer + offsetof (arm_Note, name);
-
- /* Check for buffer overflow. */
- if (namesz + descsz + offsetof (arm_Note, name) > buffer_size)
- return FALSE;
-
- if (expected_name == NULL)
- {
- if (namesz != 0)
- return FALSE;
- }
- else
- {
- if (namesz != ((strlen (expected_name) + 1 + 3) & ~3))
- return FALSE;
-
- if (strcmp (descr, expected_name) != 0)
- return FALSE;
-
- descr += (namesz + 3) & ~3;
- }
-
- /* FIXME: We should probably check the type as well. */
-
- if (description_return != NULL)
- * description_return = descr;
-
- return TRUE;
-}
-
-#define NOTE_ARCH_STRING "arch: "
-
-bfd_boolean
-bfd_arm_update_notes (abfd, note_section)
- bfd * abfd;
- const char * note_section;
-{
- asection * arm_arch_section;
- bfd_size_type buffer_size;
- char * buffer;
- char * arch_string;
- char * expected;
-
- /* Look for a note section. If one is present check the architecture
- string encoded in it, and set it to the current architecture if it is
- different. */
- arm_arch_section = bfd_get_section_by_name (abfd, note_section);
-
- if (arm_arch_section == NULL)
- return TRUE;
-
- buffer_size = arm_arch_section->_raw_size;
- if (buffer_size == 0)
- return FALSE;
-
- buffer = bfd_malloc (buffer_size);
- if (buffer == NULL)
- return FALSE;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, buffer_size))
- goto FAIL;
-
- /* Parse the note. */
- if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
- goto FAIL;
-
- /* Check the architecture in the note against the architecture of the bfd. */
- switch (bfd_get_mach (abfd))
- {
- default:
- case bfd_mach_arm_unknown: expected = "unknown"; break;
- case bfd_mach_arm_2: expected = "armv2"; break;
- case bfd_mach_arm_2a: expected = "armv2a"; break;
- case bfd_mach_arm_3: expected = "armv3"; break;
- case bfd_mach_arm_3M: expected = "armv3M"; break;
- case bfd_mach_arm_4: expected = "armv4"; break;
- case bfd_mach_arm_4T: expected = "armv4t"; break;
- case bfd_mach_arm_5: expected = "armv5"; break;
- case bfd_mach_arm_5T: expected = "armv5t"; break;
- case bfd_mach_arm_5TE: expected = "armv5te"; break;
- case bfd_mach_arm_XScale: expected = "XScale"; break;
- case bfd_mach_arm_ep9312: expected = "ep9312"; break;
- case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break;
- }
-
- if (strcmp (arch_string, expected) != 0)
- {
- strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected);
-
- if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, buffer_size))
- {
- (*_bfd_error_handler)
- (_("warning: unable to update contents of %s section in %s"),
- note_section, bfd_get_filename (abfd));
- goto FAIL;
- }
- }
-
- free (buffer);
- return TRUE;
-
- FAIL:
- free (buffer);
- return FALSE;
-}
-
-
-static struct
-{
- const char * string;
- unsigned int mach;
-}
-architectures[] =
-{
- { "armv2", bfd_mach_arm_2 },
- { "armv2a", bfd_mach_arm_2a },
- { "armv3", bfd_mach_arm_3 },
- { "armv3M", bfd_mach_arm_3M },
- { "armv4", bfd_mach_arm_4 },
- { "armv4t", bfd_mach_arm_4T },
- { "armv5", bfd_mach_arm_5 },
- { "armv5t", bfd_mach_arm_5T },
- { "armv5te", bfd_mach_arm_5TE },
- { "XScale", bfd_mach_arm_XScale },
- { "ep9312", bfd_mach_arm_ep9312 },
- { "iWMMXt", bfd_mach_arm_iWMMXt }
-};
-
-/* Extract the machine number stored in a note section. */
-unsigned int
-bfd_arm_get_mach_from_notes (abfd, note_section)
- bfd * abfd;
- const char * note_section;
-{
- asection * arm_arch_section;
- bfd_size_type buffer_size;
- char * buffer;
- char * arch_string;
- int i;
-
- /* Look for a note section. If one is present check the architecture
- string encoded in it, and set it to the current architecture if it is
- different. */
- arm_arch_section = bfd_get_section_by_name (abfd, note_section);
-
- if (arm_arch_section == NULL)
- return bfd_mach_arm_unknown;
-
- buffer_size = arm_arch_section->_raw_size;
- if (buffer_size == 0)
- return bfd_mach_arm_unknown;
-
- buffer = bfd_malloc (buffer_size);
- if (buffer == NULL)
- return bfd_mach_arm_unknown;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, buffer_size))
- goto FAIL;
-
- /* Parse the note. */
- if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
- goto FAIL;
-
- /* Interpret the architecture string. */
- for (i = ARRAY_SIZE (architectures); i--;)
- if (strcmp (arch_string, architectures[i].string) == 0)
- {
- free (buffer);
- return architectures[i].mach;
- }
-
- FAIL:
- free (buffer);
- return bfd_mach_arm_unknown;
-}
diff --git a/contrib/binutils/bfd/cpu-i386.c b/contrib/binutils/bfd/cpu-i386.c
deleted file mode 100644
index 272c719..0000000
--- a/contrib/binutils/bfd/cpu-i386.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* BFD support for the Intel 386 architecture.
- Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-const bfd_arch_info_type bfd_i386_arch_intel_syntax =
-{
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_i386,
- bfd_mach_i386_i386_intel_syntax,
- "i386:intel",
- "i386:intel",
- 3,
- TRUE,
- bfd_default_compatible,
- bfd_default_scan ,
- 0,
-};
-const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
-{
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_i386,
- bfd_mach_x86_64_intel_syntax,
- "i386:intel",
- "i386:x86-64:intel",
- 3,
- TRUE,
- bfd_default_compatible,
- bfd_default_scan ,
- &bfd_i386_arch_intel_syntax,
-};
-static const bfd_arch_info_type i8086_arch =
-{
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address (well, not really) */
- 8, /* 8 bits in a byte */
- bfd_arch_i386,
- bfd_mach_i386_i8086,
- "i8086",
- "i8086",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan ,
- &bfd_x86_64_arch_intel_syntax,
-};
-
-const bfd_arch_info_type bfd_x86_64_arch =
-{
- 64, /* 32 bits in a word */
- 64, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_i386,
- bfd_mach_x86_64,
- "i386",
- "i386:x86-64",
- 3,
- TRUE,
- bfd_default_compatible,
- bfd_default_scan ,
- &i8086_arch,
-};
-
-const bfd_arch_info_type bfd_i386_arch =
-{
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_i386,
- bfd_mach_i386_i386,
- "i386",
- "i386",
- 3,
- TRUE,
- bfd_default_compatible,
- bfd_default_scan ,
- &bfd_x86_64_arch
-};
diff --git a/contrib/binutils/bfd/cpu-ia64-opc.c b/contrib/binutils/bfd/cpu-ia64-opc.c
deleted file mode 100644
index 740c2ee..0000000
--- a/contrib/binutils/bfd/cpu-ia64-opc.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/* Copyright 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* 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 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.
-
- --davidm Mon Apr 13 22:14:02 1998 */
-
-#include "../opcodes/ia64-opc.h"
-
-#define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
-
-static const char*
-ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
- ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
-{
- return "internal error---this shouldn't happen";
-}
-
-static const char*
-ext_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
- ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
-{
- return "internal error---this shouldn't happen";
-}
-
-static const char*
-ins_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
- ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-static const char*
-ext_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
- ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-static const char*
-ins_reg (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- if (value >= 1u << self->field[0].bits)
- return "register number out of range";
-
- *code |= value << self->field[0].shift;
- return 0;
-}
-
-static const char*
-ext_reg (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- *valuep = ((code >> self->field[0].shift)
- & ((1u << self->field[0].bits) - 1));
- return 0;
-}
-
-static const char*
-ins_immu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- ia64_insn new = 0;
- int i;
-
- for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
- {
- new |= ((value & ((((ia64_insn) 1) << self->field[i].bits) - 1))
- << self->field[i].shift);
- value >>= self->field[i].bits;
- }
- if (value)
- return "integer operand out of range";
-
- *code |= new;
- return 0;
-}
-
-static const char*
-ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- BFD_HOST_U_64_BIT value = 0;
- int i, bits = 0, total = 0;
-
- for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
- {
- bits = self->field[i].bits;
- value |= ((code >> self->field[i].shift)
- & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
- total += bits;
- }
- *valuep = value;
- return 0;
-}
-
-static const char*
-ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- if (value & 0x7)
- return "value not an integer multiple of 8";
- return ins_immu (self, value >> 3, code);
-}
-
-static const char*
-ext_immus8 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- const char *result;
-
- result = ext_immu (self, code, valuep);
- if (result)
- return result;
-
- *valuep = *valuep << 3;
- return 0;
-}
-
-static const char*
-ins_imms_scaled (const struct ia64_operand *self, ia64_insn value,
- ia64_insn *code, int scale)
-{
- BFD_HOST_64_BIT svalue = value, sign_bit = 0;
- ia64_insn new = 0;
- int i;
-
- svalue >>= scale;
-
- for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
- {
- new |= ((svalue & ((((ia64_insn) 1) << self->field[i].bits) - 1))
- << self->field[i].shift);
- sign_bit = (svalue >> (self->field[i].bits - 1)) & 1;
- svalue >>= self->field[i].bits;
- }
- if ((!sign_bit && svalue != 0) || (sign_bit && svalue != -1))
- return "integer operand out of range";
-
- *code |= new;
- return 0;
-}
-
-static const char*
-ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
- ia64_insn *valuep, int scale)
-{
- int i, bits = 0, total = 0;
- BFD_HOST_64_BIT val = 0, sign;
-
- for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
- {
- bits = self->field[i].bits;
- val |= ((code >> self->field[i].shift)
- & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
- total += bits;
- }
- /* sign extend: */
- sign = (BFD_HOST_64_BIT) 1 << (total - 1);
- val = (val ^ sign) - sign;
-
- *valuep = (val << scale);
- return 0;
-}
-
-static const char*
-ins_imms (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- return ins_imms_scaled (self, value, code, 0);
-}
-
-static const char*
-ins_immsu4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
-
- return ins_imms_scaled (self, value, code, 0);
-}
-
-static const char*
-ext_imms (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- return ext_imms_scaled (self, code, valuep, 0);
-}
-
-static const char*
-ins_immsm1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- --value;
- return ins_imms_scaled (self, value, code, 0);
-}
-
-static const char*
-ins_immsm1u4 (const struct ia64_operand *self, ia64_insn value,
- ia64_insn *code)
-{
- value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
-
- --value;
- return ins_imms_scaled (self, value, code, 0);
-}
-
-static const char*
-ext_immsm1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- const char *res = ext_imms_scaled (self, code, valuep, 0);
-
- ++*valuep;
- return res;
-}
-
-static const char*
-ins_imms1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- return ins_imms_scaled (self, value, code, 1);
-}
-
-static const char*
-ext_imms1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- return ext_imms_scaled (self, code, valuep, 1);
-}
-
-static const char*
-ins_imms4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- return ins_imms_scaled (self, value, code, 4);
-}
-
-static const char*
-ext_imms4 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- return ext_imms_scaled (self, code, valuep, 4);
-}
-
-static const char*
-ins_imms16 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- return ins_imms_scaled (self, value, code, 16);
-}
-
-static const char*
-ext_imms16 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- return ext_imms_scaled (self, code, valuep, 16);
-}
-
-static const char*
-ins_cimmu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- ia64_insn mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
- return ins_immu (self, value ^ mask, code);
-}
-
-static const char*
-ext_cimmu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- const char *result;
- ia64_insn mask;
-
- mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
- result = ext_immu (self, code, valuep);
- if (!result)
- {
- mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
- *valuep ^= mask;
- }
- return result;
-}
-
-static const char*
-ins_cnt (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- --value;
- if (value >= ((BFD_HOST_U_64_BIT) 1) << self->field[0].bits)
- return "count out of range";
-
- *code |= value << self->field[0].shift;
- return 0;
-}
-
-static const char*
-ext_cnt (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- *valuep = ((code >> self->field[0].shift)
- & ((((BFD_HOST_U_64_BIT) 1) << self->field[0].bits) - 1)) + 1;
- return 0;
-}
-
-static const char*
-ins_cnt2b (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- --value;
-
- if (value > 2)
- return "count must be in range 1..3";
-
- *code |= value << self->field[0].shift;
- return 0;
-}
-
-static const char*
-ext_cnt2b (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- *valuep = ((code >> self->field[0].shift) & 0x3) + 1;
- return 0;
-}
-
-static const char*
-ins_cnt2c (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- switch (value)
- {
- case 0: value = 0; break;
- case 7: value = 1; break;
- case 15: value = 2; break;
- case 16: value = 3; break;
- default: return "count must be 0, 7, 15, or 16";
- }
- *code |= value << self->field[0].shift;
- return 0;
-}
-
-static const char*
-ext_cnt2c (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- ia64_insn value;
-
- value = (code >> self->field[0].shift) & 0x3;
- switch (value)
- {
- case 0: value = 0; break;
- case 1: value = 7; break;
- case 2: value = 15; break;
- case 3: value = 16; break;
- }
- *valuep = value;
- return 0;
-}
-
-static const char*
-ins_inc3 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
-{
- BFD_HOST_64_BIT val = value;
- BFD_HOST_U_64_BIT sign = 0;
-
- if (val < 0)
- {
- sign = 0x4;
- value = -value;
- }
- switch (value)
- {
- case 1: value = 3; break;
- case 4: value = 2; break;
- case 8: value = 1; break;
- case 16: value = 0; break;
- default: return "count must be +/- 1, 4, 8, or 16";
- }
- *code |= (sign | value) << self->field[0].shift;
- return 0;
-}
-
-static const char*
-ext_inc3 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
-{
- BFD_HOST_64_BIT val;
- int negate;
-
- val = (code >> self->field[0].shift) & 0x7;
- negate = val & 0x4;
- switch (val & 0x3)
- {
- case 0: val = 16; break;
- case 1: val = 8; break;
- case 2: val = 4; break;
- case 3: val = 1; break;
- }
- if (negate)
- val = -val;
-
- *valuep = val;
- return 0;
-}
-
-#define CST IA64_OPND_CLASS_CST
-#define REG IA64_OPND_CLASS_REG
-#define IND IA64_OPND_CLASS_IND
-#define ABS IA64_OPND_CLASS_ABS
-#define REL IA64_OPND_CLASS_REL
-
-#define SDEC IA64_OPND_FLAG_DECIMAL_SIGNED
-#define UDEC IA64_OPND_FLAG_DECIMAL_UNSIGNED
-
-const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
- {
- /* constants: */
- { CST, ins_const, ext_const, "NIL", {{ 0, 0}}, 0, "<none>" },
- { CST, ins_const, ext_const, "ar.csd", {{ 0, 0}}, 0, "ar.csd" },
- { CST, ins_const, ext_const, "ar.ccv", {{ 0, 0}}, 0, "ar.ccv" },
- { CST, ins_const, ext_const, "ar.pfs", {{ 0, 0}}, 0, "ar.pfs" },
- { CST, ins_const, ext_const, "1", {{ 0, 0}}, 0, "1" },
- { CST, ins_const, ext_const, "8", {{ 0, 0}}, 0, "8" },
- { CST, ins_const, ext_const, "16", {{ 0, 0}}, 0, "16" },
- { CST, ins_const, ext_const, "r0", {{ 0, 0}}, 0, "r0" },
- { CST, ins_const, ext_const, "ip", {{ 0, 0}}, 0, "ip" },
- { CST, ins_const, ext_const, "pr", {{ 0, 0}}, 0, "pr" },
- { CST, ins_const, ext_const, "pr.rot", {{ 0, 0}}, 0, "pr.rot" },
- { CST, ins_const, ext_const, "psr", {{ 0, 0}}, 0, "psr" },
- { CST, ins_const, ext_const, "psr.l", {{ 0, 0}}, 0, "psr.l" },
- { CST, ins_const, ext_const, "psr.um", {{ 0, 0}}, 0, "psr.um" },
-
- /* register operands: */
- { REG, ins_reg, ext_reg, "ar", {{ 7, 20}}, 0, /* AR3 */
- "an application register" },
- { REG, ins_reg, ext_reg, "b", {{ 3, 6}}, 0, /* B1 */
- "a branch register" },
- { REG, ins_reg, ext_reg, "b", {{ 3, 13}}, 0, /* B2 */
- "a branch register"},
- { REG, ins_reg, ext_reg, "cr", {{ 7, 20}}, 0, /* CR */
- "a control register"},
- { REG, ins_reg, ext_reg, "f", {{ 7, 6}}, 0, /* F1 */
- "a floating-point register" },
- { REG, ins_reg, ext_reg, "f", {{ 7, 13}}, 0, /* F2 */
- "a floating-point register" },
- { REG, ins_reg, ext_reg, "f", {{ 7, 20}}, 0, /* F3 */
- "a floating-point register" },
- { REG, ins_reg, ext_reg, "f", {{ 7, 27}}, 0, /* F4 */
- "a floating-point register" },
- { REG, ins_reg, ext_reg, "p", {{ 6, 6}}, 0, /* P1 */
- "a predicate register" },
- { REG, ins_reg, ext_reg, "p", {{ 6, 27}}, 0, /* P2 */
- "a predicate register" },
- { REG, ins_reg, ext_reg, "r", {{ 7, 6}}, 0, /* R1 */
- "a general register" },
- { REG, ins_reg, ext_reg, "r", {{ 7, 13}}, 0, /* R2 */
- "a general register" },
- { REG, ins_reg, ext_reg, "r", {{ 7, 20}}, 0, /* R3 */
- "a general register" },
- { REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */
- "a general register r0-r3" },
-
- /* indirect operands: */
- { IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */
- "a cpuid register" },
- { IND, ins_reg, ext_reg, "dbr", {{7, 20}}, 0, /* DBR_R3 */
- "a dbr register" },
- { IND, ins_reg, ext_reg, "dtr", {{7, 20}}, 0, /* DTR_R3 */
- "a dtr register" },
- { IND, ins_reg, ext_reg, "itr", {{7, 20}}, 0, /* ITR_R3 */
- "an itr register" },
- { IND, ins_reg, ext_reg, "ibr", {{7, 20}}, 0, /* IBR_R3 */
- "an ibr register" },
- { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */
- "an indirect memory address" },
- { IND, ins_reg, ext_reg, "msr", {{7, 20}}, 0, /* MSR_R3 */
- "an msr register" },
- { IND, ins_reg, ext_reg, "pkr", {{7, 20}}, 0, /* PKR_R3 */
- "a pkr register" },
- { IND, ins_reg, ext_reg, "pmc", {{7, 20}}, 0, /* PMC_R3 */
- "a pmc register" },
- { IND, ins_reg, ext_reg, "pmd", {{7, 20}}, 0, /* PMD_R3 */
- "a pmd register" },
- { IND, ins_reg, ext_reg, "rr", {{7, 20}}, 0, /* RR_R3 */
- "an rr register" },
-
- /* immediate operands: */
- { ABS, ins_cimmu, ext_cimmu, 0, {{ 5, 20 }}, UDEC, /* CCNT5 */
- "a 5-bit count (0-31)" },
- { ABS, ins_cnt, ext_cnt, 0, {{ 2, 27 }}, UDEC, /* CNT2a */
- "a 2-bit count (1-4)" },
- { ABS, ins_cnt2b, ext_cnt2b, 0, {{ 2, 27 }}, UDEC, /* CNT2b */
- "a 2-bit count (1-3)" },
- { ABS, ins_cnt2c, ext_cnt2c, 0, {{ 2, 30 }}, UDEC, /* CNT2c */
- "a count (0, 7, 15, or 16)" },
- { ABS, ins_immu, ext_immu, 0, {{ 5, 14}}, UDEC, /* CNT5 */
- "a 5-bit count (0-31)" },
- { ABS, ins_immu, ext_immu, 0, {{ 6, 27}}, UDEC, /* CNT6 */
- "a 6-bit count (0-63)" },
- { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 20}}, UDEC, /* CPOS6a */
- "a 6-bit bit pos (0-63)" },
- { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 14}}, UDEC, /* CPOS6b */
- "a 6-bit bit pos (0-63)" },
- { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 31}}, UDEC, /* CPOS6c */
- "a 6-bit bit pos (0-63)" },
- { ABS, ins_imms, ext_imms, 0, {{ 1, 36}}, SDEC, /* IMM1 */
- "a 1-bit integer (-1, 0)" },
- { ABS, ins_immu, ext_immu, 0, {{ 2, 13}}, UDEC, /* IMMU2 */
- "a 2-bit unsigned (0-3)" },
- { ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, 0, /* IMMU7a */
- "a 7-bit unsigned (0-127)" },
- { ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, 0, /* IMMU7b */
- "a 7-bit unsigned (0-127)" },
- { ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, UDEC, /* SOF */
- "a frame size (register count)" },
- { ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, UDEC, /* SOL */
- "a local register count" },
- { ABS, ins_immus8,ext_immus8,0, {{ 4, 27}}, UDEC, /* SOR */
- "a rotating register count (integer multiple of 8)" },
- { ABS, ins_imms, ext_imms, 0, /* IMM8 */
- {{ 7, 13}, { 1, 36}}, SDEC,
- "an 8-bit integer (-128-127)" },
- { ABS, ins_immsu4, ext_imms, 0, /* IMM8U4 */
- {{ 7, 13}, { 1, 36}}, SDEC,
- "an 8-bit signed integer for 32-bit unsigned compare (-128-127)" },
- { ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1 */
- {{ 7, 13}, { 1, 36}}, SDEC,
- "an 8-bit integer (-127-128)" },
- { ABS, ins_immsm1u4, ext_immsm1, 0, /* IMM8M1U4 */
- {{ 7, 13}, { 1, 36}}, SDEC,
- "an 8-bit integer for 32-bit unsigned compare (-127-(-1),1-128,0x100000000)" },
- { ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1U8 */
- {{ 7, 13}, { 1, 36}}, SDEC,
- "an 8-bit integer for 64-bit unsigned compare (-127-(-1),1-128,0x10000000000000000)" },
- { ABS, ins_immu, ext_immu, 0, {{ 2, 33}, { 7, 20}}, 0, /* IMMU9 */
- "a 9-bit unsigned (0-511)" },
- { ABS, ins_imms, ext_imms, 0, /* IMM9a */
- {{ 7, 6}, { 1, 27}, { 1, 36}}, SDEC,
- "a 9-bit integer (-256-255)" },
- { ABS, ins_imms, ext_imms, 0, /* IMM9b */
- {{ 7, 13}, { 1, 27}, { 1, 36}}, SDEC,
- "a 9-bit integer (-256-255)" },
- { ABS, ins_imms, ext_imms, 0, /* IMM14 */
- {{ 7, 13}, { 6, 27}, { 1, 36}}, SDEC,
- "a 14-bit integer (-8192-8191)" },
- { ABS, ins_imms1, ext_imms1, 0, /* IMM17 */
- {{ 7, 6}, { 8, 24}, { 1, 36}}, 0,
- "a 17-bit integer (-65536-65535)" },
- { ABS, ins_immu, ext_immu, 0, {{20, 6}, { 1, 36}}, 0, /* IMMU21 */
- "a 21-bit unsigned" },
- { ABS, ins_imms, ext_imms, 0, /* IMM22 */
- {{ 7, 13}, { 9, 27}, { 5, 22}, { 1, 36}}, SDEC,
- "a 22-bit signed integer" },
- { ABS, ins_immu, ext_immu, 0, /* IMMU24 */
- {{21, 6}, { 2, 31}, { 1, 36}}, 0,
- "a 24-bit unsigned" },
- { ABS, ins_imms16,ext_imms16,0, {{27, 6}, { 1, 36}}, 0, /* IMM44 */
- "a 44-bit unsigned (least 16 bits ignored/zeroes)" },
- { ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU62 */
- "a 62-bit unsigned" },
- { ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU64 */
- "a 64-bit unsigned" },
- { ABS, ins_inc3, ext_inc3, 0, {{ 3, 13}}, SDEC, /* INC3 */
- "an increment (+/- 1, 4, 8, or 16)" },
- { ABS, ins_cnt, ext_cnt, 0, {{ 4, 27}}, UDEC, /* LEN4 */
- "a 4-bit length (1-16)" },
- { ABS, ins_cnt, ext_cnt, 0, {{ 6, 27}}, UDEC, /* LEN6 */
- "a 6-bit length (1-64)" },
- { ABS, ins_immu, ext_immu, 0, {{ 4, 20}}, 0, /* MBTYPE4 */
- "a mix type (@rev, @mix, @shuf, @alt, or @brcst)" },
- { ABS, ins_immu, ext_immu, 0, {{ 8, 20}}, 0, /* MBTYPE8 */
- "an 8-bit mix type" },
- { ABS, ins_immu, ext_immu, 0, {{ 6, 14}}, UDEC, /* POS6 */
- "a 6-bit bit pos (0-63)" },
- { REL, ins_imms4, ext_imms4, 0, {{ 7, 6}, { 2, 33}}, 0, /* TAG13 */
- "a branch tag" },
- { REL, ins_imms4, ext_imms4, 0, {{ 9, 24}}, 0, /* TAG13b */
- "a branch tag" },
- { REL, ins_imms4, ext_imms4, 0, {{20, 6}, { 1, 36}}, 0, /* TGT25 */
- "a branch target" },
- { REL, ins_imms4, ext_imms4, 0, /* TGT25b */
- {{ 7, 6}, {13, 20}, { 1, 36}}, 0,
- "a branch target" },
- { REL, ins_imms4, ext_imms4, 0, {{20, 13}, { 1, 36}}, 0, /* TGT25c */
- "a branch target" },
- { REL, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* TGT64 */
- "a branch target" },
-
- { ABS, ins_const, ext_const, 0, {{0, 0}}, 0, /* LDXMOV */
- "ldxmov target" },
- };
diff --git a/contrib/binutils/bfd/cpu-ia64.c b/contrib/binutils/bfd/cpu-ia64.c
deleted file mode 100644
index 2185241..0000000
--- a/contrib/binutils/bfd/cpu-ia64.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* BFD support for the ia64 architecture.
- Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-const bfd_arch_info_type bfd_ia64_elf32_arch =
- {
- 64, /* 64 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_ia64,
- bfd_mach_ia64_elf32,
- "ia64",
- "ia64-elf32",
- 3, /* log2 of section alignment */
- TRUE, /* the one and only */
- bfd_default_compatible,
- bfd_default_scan ,
- 0,
- };
-
-const bfd_arch_info_type bfd_ia64_arch =
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_ia64,
- bfd_mach_ia64_elf64,
- "ia64",
- "ia64-elf64",
- 3, /* log2 of section alignment */
- TRUE, /* the one and only */
- bfd_default_compatible,
- bfd_default_scan ,
- &bfd_ia64_elf32_arch,
- };
-
-#include "cpu-ia64-opc.c"
diff --git a/contrib/binutils/bfd/cpu-mips.c b/contrib/binutils/bfd/cpu-mips.c
deleted file mode 100644
index 01ecc4e..0000000
--- a/contrib/binutils/bfd/cpu-mips.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* bfd back-end for mips support
- Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
- Written by Steve Chamberlain of Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-static const bfd_arch_info_type *mips_compatible
- (const bfd_arch_info_type *, const bfd_arch_info_type *);
-
-/* The default routine tests bits_per_word, which is wrong on mips as
- mips word size doesn't correlate with reloc size. */
-
-static const bfd_arch_info_type *
-mips_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
-{
- if (a->arch != b->arch)
- return NULL;
-
- /* Machine compatibility is checked in
- _bfd_mips_elf_merge_private_bfd_data. */
-
- return a;
-}
-
-#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
- { \
- BITS_WORD, /* bits in a word */ \
- BITS_ADDR, /* bits in an address */ \
- 8, /* 8 bits in a byte */ \
- bfd_arch_mips, \
- NUMBER, \
- "mips", \
- PRINT, \
- 3, \
- DEFAULT, \
- mips_compatible, \
- bfd_default_scan, \
- NEXT, \
- }
-
-enum
-{
- I_mips3000,
- I_mips3900,
- I_mips4000,
- I_mips4010,
- I_mips4100,
- I_mips4111,
- I_mips4120,
- I_mips4300,
- I_mips4400,
- I_mips4600,
- I_mips4650,
- I_mips5000,
- I_mips5400,
- I_mips5500,
- I_mips6000,
- I_mips7000,
- I_mips8000,
- I_mips10000,
- I_mips12000,
- I_mips16,
- I_mips5,
- I_mipsisa32,
- I_mipsisa32r2,
- I_mipsisa64,
- I_mipsisa64r2,
- I_sb1,
-};
-
-#define NN(index) (&arch_info_struct[(index) + 1])
-
-static const bfd_arch_info_type arch_info_struct[] =
-{
- N (32, 32, bfd_mach_mips3000, "mips:3000", FALSE, NN(I_mips3000)),
- N (32, 32, bfd_mach_mips3900, "mips:3900", FALSE, NN(I_mips3900)),
- N (64, 64, bfd_mach_mips4000, "mips:4000", FALSE, NN(I_mips4000)),
- N (64, 64, bfd_mach_mips4010, "mips:4010", FALSE, NN(I_mips4010)),
- N (64, 64, bfd_mach_mips4100, "mips:4100", FALSE, NN(I_mips4100)),
- N (64, 64, bfd_mach_mips4111, "mips:4111", FALSE, NN(I_mips4111)),
- N (64, 64, bfd_mach_mips4120, "mips:4120", FALSE, NN(I_mips4120)),
- N (64, 64, bfd_mach_mips4300, "mips:4300", FALSE, NN(I_mips4300)),
- N (64, 64, bfd_mach_mips4400, "mips:4400", FALSE, NN(I_mips4400)),
- N (64, 64, bfd_mach_mips4600, "mips:4600", FALSE, NN(I_mips4600)),
- N (64, 64, bfd_mach_mips4650, "mips:4650", FALSE, NN(I_mips4650)),
- N (64, 64, bfd_mach_mips5000, "mips:5000", FALSE, NN(I_mips5000)),
- N (64, 64, bfd_mach_mips5400, "mips:5400", FALSE, NN(I_mips5400)),
- N (64, 64, bfd_mach_mips5500, "mips:5500", FALSE, NN(I_mips5500)),
- N (32, 32, bfd_mach_mips6000, "mips:6000", FALSE, NN(I_mips6000)),
- N (64, 64, bfd_mach_mips7000, "mips:7000", FALSE, NN(I_mips7000)),
- N (64, 64, bfd_mach_mips8000, "mips:8000", FALSE, NN(I_mips8000)),
- N (64, 64, bfd_mach_mips10000,"mips:10000", FALSE, NN(I_mips10000)),
- N (64, 64, bfd_mach_mips12000,"mips:12000", FALSE, NN(I_mips12000)),
- N (64, 64, bfd_mach_mips16, "mips:16", FALSE, NN(I_mips16)),
- N (64, 64, bfd_mach_mips5, "mips:mips5", FALSE, NN(I_mips5)),
- N (32, 32, bfd_mach_mipsisa32, "mips:isa32", FALSE, NN(I_mipsisa32)),
- N (32, 32, bfd_mach_mipsisa32r2,"mips:isa32r2", FALSE, NN(I_mipsisa32r2)),
- N (64, 64, bfd_mach_mipsisa64, "mips:isa64", FALSE, NN(I_mipsisa64)),
- N (64, 64, bfd_mach_mipsisa64r2,"mips:isa64r2", FALSE, NN(I_mipsisa64r2)),
- N (64, 64, bfd_mach_mips_sb1, "mips:sb1", FALSE, 0),
-};
-
-/* The default architecture is mips:3000, but with a machine number of
- zero. This lets the linker distinguish between a default setting
- of mips, and an explicit setting of mips:3000. */
-
-const bfd_arch_info_type bfd_mips_arch =
-N (32, 32, 0, "mips", TRUE, &arch_info_struct[0]);
diff --git a/contrib/binutils/bfd/cpu-powerpc.c b/contrib/binutils/bfd/cpu-powerpc.c
deleted file mode 100644
index a4e72d5..0000000
--- a/contrib/binutils/bfd/cpu-powerpc.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* BFD PowerPC CPU definition
- Copyright 1994, 1995, 1996, 2000, 2001, 2002
- Free Software Foundation, Inc.
- Contributed by Ian Lance Taylor, Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-/* The common PowerPC architecture is compatible with the RS/6000. */
-
-static const bfd_arch_info_type *powerpc_compatible
- PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
-
-static const bfd_arch_info_type *
-powerpc_compatible (a,b)
- const bfd_arch_info_type *a;
- const bfd_arch_info_type *b;
-{
- BFD_ASSERT (a->arch == bfd_arch_powerpc);
- switch (b->arch)
- {
- default:
- return NULL;
- case bfd_arch_powerpc:
- return bfd_default_compatible (a, b);
- case bfd_arch_rs6000:
- if (b->mach == bfd_mach_rs6k)
- return a;
- return NULL;
- }
- /*NOTREACHED*/
-}
-
-const bfd_arch_info_type bfd_powerpc_archs[] =
-{
-#if BFD_DEFAULT_TARGET_SIZE == 64
- /* Default arch must come first. */
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc64,
- "powerpc",
- "powerpc:common64",
- 3,
- TRUE, /* default for 64 bit target */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[1]
- },
- /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
- being immediately after the 64 bit default. */
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
- "powerpc",
- "powerpc:common",
- 3,
- FALSE,
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[2],
- },
-#else
- /* Default arch must come first. */
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
- "powerpc",
- "powerpc:common",
- 3,
- TRUE, /* default for 32 bit target */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[1],
- },
- /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
- being immediately after the 32 bit default. */
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc64,
- "powerpc",
- "powerpc:common64",
- 3,
- FALSE,
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[2]
- },
-#endif
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_603,
- "powerpc",
- "powerpc:603",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[3]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_ec603e,
- "powerpc",
- "powerpc:EC603e",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[4]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_604,
- "powerpc",
- "powerpc:604",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[5]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_403,
- "powerpc",
- "powerpc:403",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[6]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_601,
- "powerpc",
- "powerpc:601",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[7]
- },
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_620,
- "powerpc",
- "powerpc:620",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[8]
- },
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_630,
- "powerpc",
- "powerpc:630",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[9]
- },
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_a35,
- "powerpc",
- "powerpc:a35",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[10]
- },
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_rs64ii,
- "powerpc",
- "powerpc:rs64ii",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[11]
- },
- {
- 64, /* 64 bits in a word */
- 64, /* 64 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_rs64iii,
- "powerpc",
- "powerpc:rs64iii",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[12]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_7400,
- "powerpc",
- "powerpc:7400",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[13]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_e500,
- "powerpc",
- "powerpc:e500",
- 3,
- FALSE,
- powerpc_compatible,
- bfd_default_scan,
- &bfd_powerpc_archs[14]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_powerpc,
- bfd_mach_ppc_860,
- "powerpc",
- "powerpc:MPC8XX",
- 3,
- FALSE, /* not the default */
- powerpc_compatible,
- bfd_default_scan,
- 0
- }
-};
diff --git a/contrib/binutils/bfd/cpu-rs6000.c b/contrib/binutils/bfd/cpu-rs6000.c
deleted file mode 100644
index d94921f..0000000
--- a/contrib/binutils/bfd/cpu-rs6000.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* BFD back-end for rs6000 support
- Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003
- Free Software Foundation, Inc.
- FIXME: Can someone provide a transliteration of this name into ASCII?
- Using the following chars caused a compiler warning on HIUX (so I replaced
- them with octal escapes), and isn't useful without an understanding of what
- character set it is.
- Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
- and John Gilmore of Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-/* The RS/6000 architecture is compatible with the PowerPC common
- architecture. */
-
-static const bfd_arch_info_type *rs6000_compatible
- PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
-
-static const bfd_arch_info_type *
-rs6000_compatible (a,b)
- const bfd_arch_info_type *a;
- const bfd_arch_info_type *b;
-{
- BFD_ASSERT (a->arch == bfd_arch_rs6000);
- switch (b->arch)
- {
- default:
- return NULL;
- case bfd_arch_rs6000:
- return bfd_default_compatible (a, b);
- case bfd_arch_powerpc:
- if (a->mach == bfd_mach_rs6k)
- return b;
- return NULL;
- }
- /*NOTREACHED*/
-}
-
-static const bfd_arch_info_type arch_info_struct[] =
-{
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_rs6000,
- bfd_mach_rs6k_rs1,
- "rs6000",
- "rs6000:rs1",
- 3,
- FALSE, /* not the default */
- rs6000_compatible,
- bfd_default_scan,
- &arch_info_struct[1]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_rs6000,
- bfd_mach_rs6k_rsc,
- "rs6000",
- "rs6000:rsc",
- 3,
- FALSE, /* not the default */
- rs6000_compatible,
- bfd_default_scan,
- &arch_info_struct[2]
- },
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_rs6000,
- bfd_mach_rs6k_rs2,
- "rs6000",
- "rs6000:rs2",
- 3,
- FALSE, /* not the default */
- rs6000_compatible,
- bfd_default_scan,
- 0
- }
-};
-
-const bfd_arch_info_type bfd_rs6000_arch =
- {
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
- 8, /* 8 bits in a byte */
- bfd_arch_rs6000,
- bfd_mach_rs6k, /* POWER common architecture */
- "rs6000",
- "rs6000:6000",
- 3,
- TRUE, /* the default */
- rs6000_compatible,
- bfd_default_scan,
- &arch_info_struct[0]
- };
diff --git a/contrib/binutils/bfd/cpu-s390.c b/contrib/binutils/bfd/cpu-s390.c
deleted file mode 100644
index 66fd246..0000000
--- a/contrib/binutils/bfd/cpu-s390.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* BFD support for the s390 processor.
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
- Contributed by Carl B. Pedersen and Martin Schwidefsky.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-const bfd_arch_info_type bfd_s390_64_arch =
-{
- 64, /* bits in a word */
- 64, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_s390,
- bfd_mach_s390_64,
- "s390",
- "s390:64-bit",
- 3, /* section alignment power */
- TRUE, /* the default */
- bfd_default_compatible,
- bfd_default_scan,
- NULL
-};
-
-const bfd_arch_info_type bfd_s390_arch =
-{
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_s390,
- bfd_mach_s390_31,
- "s390",
- "s390:31-bit",
- 3, /* section alignment power */
- TRUE, /* the default */
- bfd_default_compatible,
- bfd_default_scan,
- &bfd_s390_64_arch
-};
diff --git a/contrib/binutils/bfd/cpu-sparc.c b/contrib/binutils/bfd/cpu-sparc.c
deleted file mode 100644
index 3c0eae5..0000000
--- a/contrib/binutils/bfd/cpu-sparc.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* BFD support for the SPARC architecture.
- Copyright 1992, 1995, 1996, 1998, 2000, 2002
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-static const bfd_arch_info_type arch_info_struct[] =
-{
- {
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_sparclet,
- "sparc",
- "sparc:sparclet",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[1],
- },
- {
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_sparclite,
- "sparc",
- "sparc:sparclite",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[2],
- },
- {
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_v8plus,
- "sparc",
- "sparc:v8plus",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[3],
- },
- {
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_v8plusa,
- "sparc",
- "sparc:v8plusa",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[4],
- },
- {
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_sparclite_le,
- "sparc",
- "sparc:sparclite_le",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[5],
- },
- {
- 64, /* bits in a word */
- 64, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_v9,
- "sparc",
- "sparc:v9",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[6],
- },
- {
- 64, /* bits in a word */
- 64, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_v9a,
- "sparc",
- "sparc:v9a",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[7],
- },
- {
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_v8plusb,
- "sparc",
- "sparc:v8plusb",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[8],
- },
- {
- 64, /* bits in a word */
- 64, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc_v9b,
- "sparc",
- "sparc:v9b",
- 3,
- FALSE,
- bfd_default_compatible,
- bfd_default_scan,
- 0,
- }
-};
-
-const bfd_arch_info_type bfd_sparc_arch =
- {
- 32, /* bits in a word */
- 32, /* bits in an address */
- 8, /* bits in a byte */
- bfd_arch_sparc,
- bfd_mach_sparc,
- "sparc",
- "sparc",
- 3,
- TRUE, /* the default */
- bfd_default_compatible,
- bfd_default_scan,
- &arch_info_struct[0],
- };
diff --git a/contrib/binutils/bfd/demo64.c b/contrib/binutils/bfd/demo64.c
deleted file mode 100644
index a8c0b32..0000000
--- a/contrib/binutils/bfd/demo64.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* BFD backend for demonstration 64-bit a.out binaries.
- Copyright 1990, 1991, 1992, 1993, 1994, 2001
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define ARCH_SIZE 64
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (demo_64_,OP)
-
-#define TARGETNAME "demo64"
-#include "aoutf1.h"
diff --git a/contrib/binutils/bfd/dep-in.sed b/contrib/binutils/bfd/dep-in.sed
deleted file mode 100644
index 90a2e6a..0000000
--- a/contrib/binutils/bfd/dep-in.sed
+++ /dev/null
@@ -1,31 +0,0 @@
-:loop
-/\\$/N
-s/\\\n */ /g
-t loop
-
-s!\.o:!.lo:!
-s! @BFD_H@!!g
-s!@SRCDIR@/../include!$(INCDIR)!g
-s!@TOPDIR@/include!$(INCDIR)!g
-s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g
-s!@TOPDIR@/opcodes!$(srcdir)/../opcodes!g
-s!@SRCDIR@/!!g
-s! hosts/[^ ]*\.h! !g
-s! sysdep.h!!g
-s! \.\./bfd/sysdep.h!!g
-s! libbfd.h!!g
-s! config.h!!g
-s! \$(INCDIR)/fopen-[^ ]*\.h!!g
-s! \$(INCDIR)/ansidecl\.h!!g
-s! \$(INCDIR)/symcat\.h!!g
-s! \.\./intl/libintl\.h!!g
-
-s/\\\n */ /g
-
-s/ *$//
-s/ */ /g
-s/ *:/:/g
-/:$/d
-
-s/\(.\{50\}[^ ]*\) /\1 \\\
- /g
diff --git a/contrib/binutils/bfd/doc/ChangeLog b/contrib/binutils/bfd/doc/ChangeLog
deleted file mode 100644
index fc06933..0000000
--- a/contrib/binutils/bfd/doc/ChangeLog
+++ /dev/null
@@ -1,14 +0,0 @@
-2004-04-08 Alan Modra <amodra@bigpond.net.au>
-
- Apply from mainline.
- 2004-03-27 Alan Modra <amodra@bigpond.net.au>
- * bfdint.texi: Remove all mention of elflink.h.
-
-For older changes see ChangeLog-9103
-
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/doc/ChangeLog-9103 b/contrib/binutils/bfd/doc/ChangeLog-9103
deleted file mode 100644
index 3636ed8..0000000
--- a/contrib/binutils/bfd/doc/ChangeLog-9103
+++ /dev/null
@@ -1,594 +0,0 @@
-2003-10-15 Andrew Cagney <cagney@redhat.com>
-
- * bfdint.texi (BFD target vector symbols): Rename _get_symtab to
- _canonicalize_symtab.
-
-2003-10-08 David Taylor <dtaylor@emc.com>
-
- * bfd.texinfo: Remove spurious backslash.
-
-2003-07-04 Josh Baratz <baratz@intersystems.com>
-
- * Makefile.am (MKDOC rule): Add $(CFLAGS) in case it contains
- CC_FOR_BUILD specific switches.
- * Makefile.in: Regenerate.
-
-2003-06-29 Alan Modra <amodra@bigpond.net.au>
-
- * chew.c (paramstuff): Don't emit PARAMS.
-
-2003-02-12 Bob Wilson <bob.wilson@acm.org>
-
- * bfd.texinfo: Fix quotes for texinfo. Make section title
- capitalization more consistent. Use @example instead of @lisp.
- Replace FDL appendix with include of fdl.texi.
- * fdl.texi: New file.
-
-2002-11-18 Klee Dienes <kdienes@apple.com>
-
- * Makefile.am (DOCFILES): Add bfdwin.texi, bfdio.texi.
- (PROTOS): Add bfdio.p, bfdwin.p.
- (SRCDOC): Add bfdio.c, bfdwin.c.
- (SRCPROT): Add bfdio.c, bfdwin.c.
- (SRCIPROT): Add bfdio.c, bfdwin.c.
- (LIBBFD_H_DEP): Add bfdio.c, bfdwin.c.
- (BFD_H_DEP): Add bfdio.c, bfdwin.c.
- Add rules for bfdio.texi, bfdwin.text.
- * bfd.texinfo: Include bfdio.texi.
-
-2002-10-14 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2002-10-11 Daniel Jacobowitz <drow@mvista.com>
-
- * Makefile.in: Regenerated.
-
-2002-08-29 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * chew.c (paramstuff, outputdots, perform, bang and usage): Remove
- void from function definitions.
-
-2002-08-13 Alan Modra <amodra@bigpond.net.au>
-
- * header.sed: Strip tabs.
-
-2002-06-08 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Fix quote style in last change.
- * Makefile.in: Regenerate.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (libbfd.h): Don't use "echo -n".
- (libcoff.h, bfd.h): Likewise.
- * Makefile.in: Regenerate.
-
-2002-06-06 Lars Brinkhoff <lars@nocrew.org>
-
- * bfdint.texi: Change registry@sco.com to registry@caldera.com.
-
-2002-06-05 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (libbfd.h): Add "Extracted from.." comment.
- (libcoff.h, bfd.h): Likewise.
- * Makefile.in: Regenerate.
-
-2002-05-25 Alan Modra <amodra@bigpond.net.au>
-
- * chew.c: Use #include "" instead of <> for local header files.
-
-2002-04-20 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2002-02-11 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2002-02-01 Alan Modra <amodra@bigpond.net.au>
-
- * chew.c (WORD): Eliminate.
-
-2002-01-31 Ivan Guzvinec <ivang@opencores.org>
-
- * Makefile.in: Regenerate.
-
-2002-01-31 Alan Modra <amodra@bigpond.net.au>
-
- * chew.c (courierize): Don't modify @command params.
-
-2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
-
- * proto.str (ENUMDOC): Place two spaces between the end of
- the text and the closing comment marker.
-
-2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
-
- * bfdint.texi (BFD target vector miscellaneous): Add
- bfd_target_mmo_flavour.
- * bfd.texinfo (BFD back ends): Add entry for mmo.
- * Makefile.am (DOCFILES): Add mmo.texi.
- (SRCDOC): Add mmo.c.
- (s-mmo, mmo.texi): New rules.
-
-2001-10-29 Kazu Hirata <kazu@hxi.com>
-
- * bfdsumm.texi: Fix a typo.
-
-2001-10-26 Nick Clifton <nickc@cambridge.redhat.com>
-
- * bfd.texinfo: Change footer to refer to FSF. Change subtitle
- to refer to original creation date.
-
-2002-01-26 Hans-Peter Nilsson <hp@bitrange.com>
-
- * Makefile.am (install): Depend on install-info.
- * Makefile.in: Regenerate.
-
-2001-10-03 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (BFD_H_DEP): Add ../version.h.
- * Makefile.in: Regenerate.
-
-2001-10-02 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2001-10-01 Alan Modra <amodra@bigpond.net.au>
-
- * header.sed: New file, adds header to generated files.
- * Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and
- bfd.h, using above. Add missing elf.c dependecy for libbfd.h.
- * Makefile.in: Regenerate.
-
-2001-09-21 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2001-09-18 Alan Modra <amodra@bigpond.net.au>
-
- * bfdint.texi: Replace reference to bfd_read with bfd_bread.
- Likewise for bfd_write.
-
-2001-07-24 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2001-06-21 Hans-Peter Nilsson <hp@axis.com>
-
- * bfdint.texi (BFD relocation functions) <different formats>:
- Mention that the GNU linker is aware of input-output format
- restrictions when generating relocatable output. Make new
- paragraph for final-link case.
- (BFD target vector swap): Fix typo.
-
-2001-01-25 Kazu Hirata <kazu@hxi.com>
-
- * chew.c: Do not output trailing whitespaces in type and
- functionname. Update copyright.
-
-2001-01-24 Kazu Hirata <kazu@hxi.com>
-
- * chew.c: Do not output a trailing whitespace.
-
-2000-11-06 Nick Clifton <nickc@redhat.com>
-
- * bfd.texinfo: Add GNU Free Documentation License.
-
-2000-07-09 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.in: Regenerate.
-
-2000-07-08 Alan Modra <alan@linuxcare.com.au>
-
- * chew.c (outputdots): Don't add a space before `/*'.
- (courierize): Likewise.
-
-Wed May 24 12:03:25 2000 Hans-Peter Nilsson <hp@axis.com>
-
- * bfdint.texi (BFD ELF processor required): Add paragraph about
- target necessities for readelf.
-
-2000-04-30 Ben Elliston <bje@redhat.com>
-
- * bfdint.texi (BFD generated files): Fix another typo.
-
-2000-04-17 Ben Elliston <bje@redhat.com>
-
- * bfdint.texi (BFD_JUMP_TABLE macros): Fix typo.
-
-2000-04-07 Andrew Cagney <cagney@b1.cygnus.com>
-
- * Makefile.in: Rebuild with current autoconf/automake.
-
-1999-02-04 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in: Rebuild with current autoconf/automake.
-
-1998-07-23 Nick Clifton <nickc@cygnus.com>
-
- * bfdint.texi (BFD ELF processor required): Add paragraph
- describing the necessity to create "include/elf/CPU.h".
-
-1998-05-07 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (chew.o): Add -I options for intl srcdir and
- objdir.
- * Makefile.in: Rebuild.
-
-1998-04-27 Ian Lance Taylor <ian@cygnus.com>
-
- * bfdint.texi: New file.
- * Makefile.am (noinst_TEXINFOS): New variable.
- * Makefile.in: Rebuild.
-
-1998-04-13 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in: Rebuild.
-
-1998-04-06 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (STAGESTUFF): Remove variable.
- (CLEANFILES): Don't remove $(STAGESTUFF).
- (DISTCLEANFILES, MAINTAINERCLEANFILES): New variables.
- * Makefile.in: Rebuild.
-
-1998-03-27 Ian Lance Taylor <ian@cygnus.com>
-
- * chew.c (skip_white_and_starts): Remove unused declaration.
- (skip_white_and_stars): Add casts to avoid warnings.
- (skip_trailing_newlines, paramstuff, courierize): Likewise.
- (bulletize, do_fancy_stuff, iscommand): Likewise.
- (kill_bogus_lines, nextword, main): Likewise.
- (manglecomments): Comment out.
- (outputdots, kill_bogus_lines): Remove unused local variables.
- (perform, compile): Likewise.
- (courierize): Fully parenthesize expression.
- (copy_past_newline): Declare return value.
- (print): Change printf format string.
- (main): Call usage for an unrecognized option.
-
-1998-02-13 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (AUTOMAKE_OPTIONS): Define.
- * Makefile.in: Rebuild.
-
-1998-01-26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * doc.str (bodytext): Don't output @* at the end.
- * chew.c (kill_bogus_lines): Make sure that a period at the
- beginning is recognized.
- (indent): Don't put indentation at the end.
- (copy_past_newline): Expand tabs.
- * Makefile.am (s-reloc, s-syms): Depend on doc.str.
- * Makefile.in: Rebuild.
-
-1997-10-01 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (libbfd.h): Don't use cpu-h8300.c, cpu-i960.c, or
- elfcode.h as input files; they don't contribute anything.
- * Makefile.in: Rebuild.
-
-1997-08-15 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.am (libbfd.h, libcoff.h): Invoke $(MKDOC) as ./$(MKDOC).
- * Makefile.in: Rebuild.
-
-1997-08-01 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (CC_FOR_BUILD): Don't set explicitly.
- * Makefile.in: Rebuild.
-
-1997-07-31 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: New file, based on old Makefile.in.
- * Makefile.in: Now built with automake.
-
-1997-07-22 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
-
- * Makefile.in: Change stamp-* files to s-* files. Use bfdt.texi
- rather than bfd.texi.
- (DOCFILES): Change bfd.texi to bfdt.texi.
- * bfd.texinfo: Include bfdt.texi, not bfd.texi.
-
-1997-06-16 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (CC, CFLAGS): Substitute from configure script.
- From Jeff Makey <jeff@cts.com>.
-
-1997-04-15 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (install-info): Use mkinstalldirs to build
- $(infodir).
-
-1997-04-08 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (install-info): Permit info files to be in srcdir.
- (stamp-*): Add a stamp-X target for each X.texi target.
- (*.texi): Just depend upon stamp-X.
- (clean): Remove stamp-*.
- (distclean): Depend upon mostlyclean. Remove stamp-*. Don't
- remove $(DOCFILES).
-
-1997-04-07 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (distclean): Don't remove *.info files.
-
-1997-02-13 Klaus Kaempf (kkaempf@progis.de)
-
- * makefile.vms: New file.
-
-1996-06-18 Ian Lance Taylor <ian@cygnus.com>
-
- * chew.c (kill_bogus_lines): Reset sl when not at the start of a
- line. From Uwe Ohse <uwe@tirka.gun.de>.
-
-1996-01-30 Ian Lance Taylor <ian@cygnus.com>
-
- From Ronald F. Guilmette <rfg@monkeys.com>:
- * Makefile.in (libbfd.h): Depend upon proto.str.
- (libcoff.h, bfd.h): Likewise.
-
-1995-11-03 Fred Fish <fnf@cygnus.com>
-
- * Makefile.in (SRCDOC, SRCPROT, core.texi, bfd.h): Use corefile.c,
- renamed from core.c.
-
-1995-11-01 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de>
-
- * chew.c: Include <ctype.h>.
-
-1995-10-06 Ken Raeburn <raeburn@cygnus.com>
-
- Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * Makefile.in (Makefile): Only remake this Makefile.
-
-1995-10-04 Ken Raeburn <raeburn@cygnus.com>
-
- * chew.c: Include <stdio.h>.
-
-1995-09-12 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (maintainer-clean): New target.
-
-1995-08-31 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (bfd.h): Add additional #endif at end of bfd.h if
- __cplusplus is defined.
-
-1994-11-29 Doug Evans <dje@canuck.cygnus.com>
-
- * chew.c (write_buffer): New argument `f', all callers changed.
- (stdout, stderr, print, drop, idrop): New forth words.
- * proto.str (COMMENT): New command.
- * doc.str (COMMENT): Likewise.
-
-1994-09-12 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * Makefile.in (DOCFILES): Remove ctor.texi.
- (IPROTOS): Remove ctor.ip.
- (SRCIPROT): Remove $(srcdir)/../ctor.c.
- (ctor.texi): Remove target.
- (libbfd.h): Remove dependency on $(srcdir)/../ctor.c. Remove
- $(MKDOC) run on $(srcdir)/../ctor.c.
- * bfd.texinfo (Constructors): Remove section.
-
-1994-09-02 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * chew.c: Include assert.h. Added prototypes for most functions.
- Changed most uses of int to long. Do bounds checking on the
- stacks. Added comment at the beginning documenting most of the
- intrinsics. Lots of whitespace changes. Re-ordered some
- functions.
- (die, check_range, icheck_range): New functions.
- (strip_trailing_newlines, print_stack_level): New functions.
- (translatecomments): Don't insert tab before "/*".
- (iscommand): Minimum command length is now 4.
- (nextword): Handle some \-sequences.
- (push_addr): Deleted.
- (main): Add new intrinsics strip_trailing_newlines and
- print_stack_level. Complain at end if stack contains more than
- one element, or less.
- (remchar): Make sure the string is not empty before chopping off a
- character.
-
- * doc.str, proto.str: Handle new commands SENUM, ENUM, ENUMX,
- ENUMEQ, ENUMEQX, ENUMDOC.
-
-1994-01-12 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd.texinfo: Added Linker Functions node.
- * Makefile.in (DOCFILES): Added linker.texi.
- (SRCDOC): Added linker.c.
- (linker.texi): New target.
-
-1994-01-04 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * chew.c: Don't rely on a correct declaration of exit.
- (chew_exit): New function which just calls exit.
- (main): Use it.
-
-1994-01-03 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd.texinfo: Added Hash Tables node.
- * Makefile.in (DOCFILES): Added hash.texi.
- (SRCDOC): Added hash.c.
- (hash.texi): New target.
-
-1993-12-30 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * Makefile.in: Delete all references to seclet.c, since it's just
- been deleted. Don't mention hash.c, linker.c, or genlink.h yet,
- since they don't contain documentation yet (hint, hint!).
-
-1993-11-05 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * bfd.texinfo: Small cleanups.
-
-1993-11-19 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * Makefile.in (archures.texi): Depends on $(MKDOC).
-
-1993-08-10 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bfd.texinfo (BFD back end): Don't include elfcode.texi, since
- it's empty now and that triggers a makeinfo bug.
-
-1993-08-09 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bfd.texinfo (BFD back end): New section on ELF, includes
- elf.texi and elfcode.texi.
- * Makefile.in (DOCFILES): Include elf.texi, elfcode.texi.
- (SRCDOC): Include elfcode.h, elf.c.
- (elf.texi, elfcode.texi): New intermediate targets.
-
-1993-06-24 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * Makefile.in (.c.o, chew.o): Put CFLAGS last.
- * bfdsumm.texi: New file, broken out of bfd.texinfo, to share
- with ld.texinfo.
-
-1993-06-14 david d `zoo' zuhn (zoo at rtl.cygnus.com)
-
- * Makefile.in (install-info): remove parentdir cruft,
-
-1993-06-09 Jim Kingdon (kingdon@cygnus.com)
-
- * Makefile.in (mostlyclean): Remove chew.o.
-
-1993-05-25 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * Makefile.in (libbfd.h): Use elfcode.h, not elf32.c.
-
-1993-05-24 Ken Raeburn (raeburn@cygnus.com)
-
- * chew.c (compile): Add a couple of missing casts.
-
-1993-05-12 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in (CC_FOR_BUILD): New variable, define to be $(CC).
- (chew.o, $(MKDOC)): Build using CC_FOR_BUILD rather than CC, since
- it must run on the build machine.
-
-1993-04-07 John Gilmore (gnu@cygnus.com)
-
- * Makefile.in (chew): Don't compile from .c to executable in a
- single step; it puts a temporary .o filename into the executable,
- which makes multi-stage comparisons fail. Compile chew.c to
- chew.o, and link that, which makes identical executables every time.
-
-1993-03-24 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
-
- * Makefile.in: fix typo (bfd.texinfo not bfd.texino)
-
-1993-03-19 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * bfd.texinfo: Since BFD version number has been bumped, do same
- to "version number" on title page, and elsewhere. Should be
- fixed to extract real version number.
-
-1993-03-16 Per Bothner (bothner@rtl.cygnus.com)
-
- * Makefile.in: Add *clean rules.
-
-1993-01-11 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * Makefile.in (libbfd.h): Removed duplicate init.c and libbfd.c.
- Added seclet.c.
- (bfd.h): Added dependency on bfd.c and seclet.c. Added seclet.c
- to build.
-
-1992-12-17 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: added dvi target, define and use $(TEXI2DVI)
-
-1992-12-03 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * Makefile.in (TEXIDIR): New variable.
- (bfd.dvi): Look for bfd.texinfo in $(srcdir). Generate index.
-
- * bfd.texinfo: Minor doc fixes.
-
-1992-11-05 John Gilmore (gnu@cygnus.com)
-
- Cleanup: Replace all uses of EXFUN in the BFD sources, with PARAMS.
-
- * chew.c (exfunstuff): Eliminate.
- (paramstuff): Replace exfunstuff with function to generate PARAMS.
- * proto.str: Use paramstuff rather than exfunstuff.
-
-1992-08-17 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * chew.c: various patches provided by Howard Chu.
-
-1992-06-19 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in (libbfd.h): Add elf.c as a source of prototypes.
-
-1992-05-11 John Gilmore (gnu at cygnus.com)
-
- * chew.c: exit() should be declared by config files, not by
- portable source code. Its type could be int or void function.
-
-1992-05-04 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: another CFLAGS correction.
-
-1992-04-28 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: Do the CFLAGS thing.
-
-1992-04-11 Fred Fish (fnf@cygnus.com)
-
- * Makefile.in (MINUS_G): Add macro and default to -g.
-
-1992-03-06 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * chew.c: now has -w switch turn on warnings
-
-1992-02-26 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in, configure.in: removed traces of namesubdir,
- -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
- copyrights to '92, changed some from Cygnus to FSF.
-
-1991-12-10 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: build chew into the current directory. Complete
- the MKDOC macro transition.
-
-1991-12-10 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * chew.c: don't core dump when can't open file
- * Makefile.in: get proto.str from the right place when built in
- odd directories
-
-1991-12-10 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: infodir belongs in datadir.
-
-1991-12-07 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * chew.c: Much modified
- * proto.str, doc.str: New files for extracting to product
- prototypes and documents respectively.
-
-
-1991-12-06 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: added standards.text support, host/site/target
- inclusion hooks, install using INSTALL_DATA rather than cp,
- don't echo on install.
-
-1991-12-05 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: idestdir and ddestdir go away. Added copyrights
- and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
- and mandir now keyed off datadir by default.
-
-
-Local Variables:
-version-control: never
-End:
diff --git a/contrib/binutils/bfd/doc/Makefile.am b/contrib/binutils/bfd/doc/Makefile.am
deleted file mode 100644
index 4aaa341..0000000
--- a/contrib/binutils/bfd/doc/Makefile.am
+++ /dev/null
@@ -1,307 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AUTOMAKE_OPTIONS = cygnus
-
-DOCFILES = aoutx.texi archive.texi archures.texi \
- bfdt.texi cache.texi coffcode.texi \
- core.texi elf.texi elfcode.texi format.texi \
- libbfd.texi bfdwin.texi bfdio.texi \
- opncls.texi reloc.texi section.texi \
- syms.texi targets.texi init.texi hash.texi linker.texi \
- mmo.texi
-
-PROTOS = archive.p archures.p bfd.p \
- core.p format.p \
- bfdio.p bfdwin.p \
- libbfd.p opncls.p reloc.p \
- section.p syms.p targets.p \
- format.p core.p init.p
-
-IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip
-
-# SRCDOC, SRCPROT, SRCIPROT only used to sidestep Sun Make bug in interaction
-# between VPATH and suffix rules. If you use GNU Make, perhaps other Makes,
-# you don't need these three:
-SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
- $(srcdir)/../archures.c $(srcdir)/../bfd.c \
- $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
- $(srcdir)/../cache.c $(srcdir)/../coffcode.h \
- $(srcdir)/../corefile.c $(srcdir)/../elf.c \
- $(srcdir)/../elfcode.h $(srcdir)/../format.c \
- $(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
- $(srcdir)/../reloc.c $(srcdir)/../section.c \
- $(srcdir)/../syms.c $(srcdir)/../targets.c \
- $(srcdir)/../hash.c $(srcdir)/../linker.c \
- $(srcdir)/../mmo.c
-
-SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
- $(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \
- $(srcdir)/../format.c $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
- $(srcdir)/../opncls.c $(srcdir)/../reloc.c \
- $(srcdir)/../section.c $(srcdir)/../syms.c \
- $(srcdir)/../targets.c $(srcdir)/../init.c
-
-SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
- $(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \
- $(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \
- $(srcdir)/../init.c
-
-TEXIDIR = $(srcdir)/../../texinfo/fsf
-
-info_TEXINFOS = bfd.texinfo
-
-MKDOC = chew$(EXEEXT_FOR_BUILD)
-
-$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
-
-chew.o: chew.c
- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
-
-protos: libbfd.h libcoff.h bfd.h
-
-bfd.info bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo
-
-# We can't replace these rules with an implicit rule, because
-# makes without VPATH support couldn't find the .h files in `..'.
-
-# We use s-XXX targets so that we can distribute the info files,
-# and permit people to rebuild them, without requiring the makeinfo
-# program. If somebody tries to rebuild info, but none of the .texi
-# files have changed, then this Makefile will build chew, and will
-# build all of the stamp files, but will not actually have to rebuild
-# bfd.info.
-
-s-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
- $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
- touch s-aoutx
-aoutx.texi: s-aoutx
-
-s-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp
- $(srcdir)/../../move-if-change archive.tmp archive.texi
- touch s-archive
-archive.texi: s-archive
-
-s-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp
- $(srcdir)/../../move-if-change archures.tmp archures.texi
- touch s-archures
-archures.texi: s-archures
-
-# We use bfdt.texi, rather than bfd.texi, to avoid conflicting with
-# bfd.texinfo on an 8.3 filesystem.
-s-bfd: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp
- $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
- touch s-bfd
-bfdt.texi: s-bfd
-
-s-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp
- $(srcdir)/../../move-if-change cache.tmp cache.texi
- touch s-cache
-cache.texi: s-cache
-
-s-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp
- $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
- touch s-coffcode
-coffcode.texi: s-coffcode
-
-s-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp
- $(srcdir)/../../move-if-change core.tmp core.texi
- touch s-core
-core.texi: s-core
-
-s-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp
- $(srcdir)/../../move-if-change elf.tmp elf.texi
- touch s-elf
-elf.texi: s-elf
-
-s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp
- $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
- touch s-elfcode
-elfcode.texi: s-elfcode
-
-s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
- $(srcdir)/../../move-if-change mmo.tmp mmo.texi
- touch s-mmo
-mmo.texi: s-mmo
-
-s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
- $(srcdir)/../../move-if-change format.tmp format.texi
- touch s-format
-format.texi: s-format
-
-s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp
- $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
- touch s-libbfd
-libbfd.texi: s-libbfd
-
-s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
- $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
- touch s-bfdio
-bfdio.texi: s-bfdio
-
-s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
- $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
- touch s-bfdwin
-bfdwin.texi: s-bfdwin
-
-s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp
- $(srcdir)/../../move-if-change opncls.tmp opncls.texi
- touch s-opncls
-opncls.texi: s-opncls
-
-s-reloc: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp
- $(srcdir)/../../move-if-change reloc.tmp reloc.texi
- touch s-reloc
-reloc.texi: s-reloc
-
-s-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp
- $(srcdir)/../../move-if-change section.tmp section.texi
- touch s-section
-section.texi: s-section
-
-s-syms: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp
- $(srcdir)/../../move-if-change syms.tmp syms.texi
- touch s-syms
-syms.texi: s-syms
-
-s-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp
- $(srcdir)/../../move-if-change targets.tmp targets.texi
- touch s-targets
-targets.texi: s-targets
-
-s-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp
- $(srcdir)/../../move-if-change init.tmp init.texi
- touch s-init
-init.texi: s-init
-
-s-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp
- $(srcdir)/../../move-if-change hash.tmp hash.texi
- touch s-hash
-hash.texi: s-hash
-
-s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp
- $(srcdir)/../../move-if-change linker.tmp linker.texi
- touch s-linker
-linker.texi: s-linker
-
-LIBBFD_H_DEP = \
- $(srcdir)/../libbfd-in.h \
- $(srcdir)/../init.c \
- $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c \
- $(srcdir)/../bfdwin.c \
- $(srcdir)/../cache.c \
- $(srcdir)/../reloc.c \
- $(srcdir)/../archures.c \
- $(srcdir)/../elf.c \
- $(srcdir)/header.sed \
- $(srcdir)/proto.str \
- $(MKDOC)
-
-libbfd.h: $(LIBBFD_H_DEP)
- echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
- for file in $(LIBBFD_H_DEP); do \
- case $$file in \
- *-in.h) cat $$file >> $@ ;; \
- */header.sed) break ;; \
- *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
- -e 's,$$,. */,' >> $@ ; \
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
- esac; \
- done
-
-LIBCOFF_H_DEP = \
- $(srcdir)/../libcoff-in.h \
- $(srcdir)/../coffcode.h \
- $(srcdir)/header.sed \
- $(srcdir)/proto.str \
- $(MKDOC)
-
-libcoff.h: $(LIBCOFF_H_DEP)
- echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@
- for file in $(LIBCOFF_H_DEP); do \
- case $$file in \
- *-in.h) cat $$file >> $@ ;; \
- */header.sed) break ;; \
- *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
- -e 's,$$,. */,' >> $@ ; \
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
- esac; \
- done
-
-BFD_H_DEP = \
- $(srcdir)/../bfd-in.h \
- $(srcdir)/../init.c \
- $(srcdir)/../opncls.c \
- $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c \
- $(srcdir)/../bfdwin.c \
- $(srcdir)/../section.c \
- $(srcdir)/../archures.c \
- $(srcdir)/../reloc.c \
- $(srcdir)/../syms.c \
- $(srcdir)/../bfd.c \
- $(srcdir)/../archive.c \
- $(srcdir)/../corefile.c \
- $(srcdir)/../targets.c \
- $(srcdir)/../format.c \
- $(srcdir)/../linker.c \
- $(srcdir)/../simple.c \
- $(srcdir)/header.sed \
- $(srcdir)/proto.str \
- $(srcdir)/../version.h \
- $(MKDOC)
-
-bfd.h: $(BFD_H_DEP)
- echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
- for file in $(BFD_H_DEP); do \
- case $$file in \
- *-in.h) cat $$file >> $@ ;; \
- */header.sed) break ;; \
- *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
- -e 's,$$,. */,' >> $@ ; \
- ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
- esac; \
- done
- echo "#ifdef __cplusplus" >> $@
- echo "}" >> $@
- echo "#endif" >> $@
- echo "#endif" >> $@
-
-noinst_TEXINFOS = bfdint.texi
-
-MOSTLYCLEANFILES = $(MKDOC) *.o
-
-CLEANFILES = s-* *.p *.ip
-
-DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log
-
-MAINTAINERCLEANFILES = $(DOCFILES)
-
-# We want install to imply install-info as per GNU standards, despite the
-# cygnus option.
-install: install-info
diff --git a/contrib/binutils/bfd/doc/Makefile.in b/contrib/binutils/bfd/doc/Makefile.in
deleted file mode 100644
index 85d6427..0000000
--- a/contrib/binutils/bfd/doc/Makefile.in
+++ /dev/null
@@ -1,674 +0,0 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_alias = @build_alias@
-build_triplet = @build@
-host_alias = @host_alias@
-host_triplet = @host@
-target_alias = @target_alias@
-target_triplet = @target@
-AR = @AR@
-AS = @AS@
-BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
-BFD_HOST_64_BIT = @BFD_HOST_64_BIT@
-BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@
-BFD_HOST_LONG_LONG = @BFD_HOST_LONG_LONG@
-BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
-CC = @CC@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-COREFILE = @COREFILE@
-COREFLAG = @COREFLAG@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-DATADIRNAME = @DATADIRNAME@
-DLLTOOL = @DLLTOOL@
-EXEEXT = @EXEEXT@
-EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
-GMOFILES = @GMOFILES@
-GMSGFMT = @GMSGFMT@
-GT_NO = @GT_NO@
-GT_YES = @GT_YES@
-HDEFINES = @HDEFINES@
-INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
-INSTOBJEXT = @INSTOBJEXT@
-INTLDEPS = @INTLDEPS@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-MSGFMT = @MSGFMT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-POFILES = @POFILES@
-POSUB = @POSUB@
-RANLIB = @RANLIB@
-STRIP = @STRIP@
-TDEFINES = @TDEFINES@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WIN32LDFLAGS = @WIN32LDFLAGS@
-WIN32LIBADD = @WIN32LIBADD@
-all_backends = @all_backends@
-bfd_backends = @bfd_backends@
-bfd_default_target_size = @bfd_default_target_size@
-bfd_file_ptr = @bfd_file_ptr@
-bfd_libs = @bfd_libs@
-bfd_machines = @bfd_machines@
-bfd_ufile_ptr = @bfd_ufile_ptr@
-bfd_version = @bfd_version@
-bfd_version_string = @bfd_version_string@
-bfdincludedir = @bfdincludedir@
-bfdlibdir = @bfdlibdir@
-l = @l@
-tdefaults = @tdefaults@
-wordsize = @wordsize@
-
-AUTOMAKE_OPTIONS = cygnus
-
-DOCFILES = aoutx.texi archive.texi archures.texi \
- bfdt.texi cache.texi coffcode.texi \
- core.texi elf.texi elfcode.texi format.texi \
- libbfd.texi bfdwin.texi bfdio.texi \
- opncls.texi reloc.texi section.texi \
- syms.texi targets.texi init.texi hash.texi linker.texi \
- mmo.texi
-
-
-PROTOS = archive.p archures.p bfd.p \
- core.p format.p \
- bfdio.p bfdwin.p \
- libbfd.p opncls.p reloc.p \
- section.p syms.p targets.p \
- format.p core.p init.p
-
-
-IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip
-
-# SRCDOC, SRCPROT, SRCIPROT only used to sidestep Sun Make bug in interaction
-# between VPATH and suffix rules. If you use GNU Make, perhaps other Makes,
-# you don't need these three:
-SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
- $(srcdir)/../archures.c $(srcdir)/../bfd.c \
- $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
- $(srcdir)/../cache.c $(srcdir)/../coffcode.h \
- $(srcdir)/../corefile.c $(srcdir)/../elf.c \
- $(srcdir)/../elfcode.h $(srcdir)/../format.c \
- $(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
- $(srcdir)/../reloc.c $(srcdir)/../section.c \
- $(srcdir)/../syms.c $(srcdir)/../targets.c \
- $(srcdir)/../hash.c $(srcdir)/../linker.c \
- $(srcdir)/../mmo.c
-
-
-SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
- $(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \
- $(srcdir)/../format.c $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
- $(srcdir)/../opncls.c $(srcdir)/../reloc.c \
- $(srcdir)/../section.c $(srcdir)/../syms.c \
- $(srcdir)/../targets.c $(srcdir)/../init.c
-
-
-SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
- $(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \
- $(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \
- $(srcdir)/../init.c
-
-
-TEXIDIR = $(srcdir)/../../texinfo/fsf
-
-info_TEXINFOS = bfd.texinfo
-
-MKDOC = chew$(EXEEXT_FOR_BUILD)
-
-LIBBFD_H_DEP = \
- $(srcdir)/../libbfd-in.h \
- $(srcdir)/../init.c \
- $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c \
- $(srcdir)/../bfdwin.c \
- $(srcdir)/../cache.c \
- $(srcdir)/../reloc.c \
- $(srcdir)/../archures.c \
- $(srcdir)/../elf.c \
- $(srcdir)/header.sed \
- $(srcdir)/proto.str \
- $(MKDOC)
-
-
-LIBCOFF_H_DEP = \
- $(srcdir)/../libcoff-in.h \
- $(srcdir)/../coffcode.h \
- $(srcdir)/header.sed \
- $(srcdir)/proto.str \
- $(MKDOC)
-
-
-BFD_H_DEP = \
- $(srcdir)/../bfd-in.h \
- $(srcdir)/../init.c \
- $(srcdir)/../opncls.c \
- $(srcdir)/../libbfd.c \
- $(srcdir)/../bfdio.c \
- $(srcdir)/../bfdwin.c \
- $(srcdir)/../section.c \
- $(srcdir)/../archures.c \
- $(srcdir)/../reloc.c \
- $(srcdir)/../syms.c \
- $(srcdir)/../bfd.c \
- $(srcdir)/../archive.c \
- $(srcdir)/../corefile.c \
- $(srcdir)/../targets.c \
- $(srcdir)/../format.c \
- $(srcdir)/../linker.c \
- $(srcdir)/../simple.c \
- $(srcdir)/header.sed \
- $(srcdir)/proto.str \
- $(srcdir)/../version.h \
- $(MKDOC)
-
-
-noinst_TEXINFOS = bfdint.texi
-
-MOSTLYCLEANFILES = $(MKDOC) *.o
-
-CLEANFILES = s-* *.p *.ip
-
-DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log
-
-MAINTAINERCLEANFILES = $(DOCFILES)
-mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi`
-TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
-INFO_DEPS = bfd.info
-DVIS = bfd.dvi
-TEXINFOS = bfd.texinfo
-DIST_COMMON = ChangeLog Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP_ENV = --best
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-bfd.info: bfd.texinfo
-bfd.dvi: bfd.texinfo
-
-
-DVIPS = dvips
-
-.texi.info:
- @rm -f $@ $@-[0-9] $@-[0-9][0-9]
- $(MAKEINFO) -I $(srcdir) $<
-
-.texi.dvi:
- TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
- MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
-
-.texi:
- @rm -f $@ $@-[0-9] $@-[0-9][0-9]
- $(MAKEINFO) -I $(srcdir) $<
-
-.texinfo.info:
- @rm -f $@ $@-[0-9] $@-[0-9][0-9]
- $(MAKEINFO) -I $(srcdir) $<
-
-.texinfo:
- @rm -f $@ $@-[0-9] $@-[0-9][0-9]
- $(MAKEINFO) -I $(srcdir) $<
-
-.texinfo.dvi:
- TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
- MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
-
-.txi.info:
- @rm -f $@ $@-[0-9] $@-[0-9][0-9]
- $(MAKEINFO) -I $(srcdir) $<
-
-.txi.dvi:
- TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
- MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
-
-.txi:
- @rm -f $@ $@-[0-9] $@-[0-9][0-9]
- $(MAKEINFO) -I $(srcdir) $<
-.dvi.ps:
- $(DVIPS) $< -o $@
-
-install-info-am: $(INFO_DEPS)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(infodir)
- @list='$(INFO_DEPS)'; \
- for file in $$list; do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
- for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
- if test -f $$d/$$ifile; then \
- echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
- $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
- else : ; fi; \
- done; \
- done
- @$(POST_INSTALL)
- @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
- list='$(INFO_DEPS)'; \
- for file in $$list; do \
- echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
- install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
- done; \
- else : ; fi
-
-uninstall-info:
- $(PRE_UNINSTALL)
- @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
- ii=yes; \
- else ii=; fi; \
- list='$(INFO_DEPS)'; \
- for file in $$list; do \
- test -z "$$ii" \
- || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
- done
- @$(NORMAL_UNINSTALL)
- list='$(INFO_DEPS)'; \
- for file in $$list; do \
- (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
- done
-
-dist-info: $(INFO_DEPS)
- list='$(INFO_DEPS)'; \
- for base in $$list; do \
- if test -f $$base; then d=.; else d=$(srcdir); fi; \
- for file in `cd $$d && eval echo $$base*`; do \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file; \
- done; \
- done
-
-mostlyclean-aminfo:
- -rm -f bfd.aux bfd.cp bfd.cps bfd.dvi bfd.fn bfd.fns bfd.ky bfd.kys \
- bfd.ps bfd.log bfd.pg bfd.toc bfd.tp bfd.tps bfd.vr bfd.vrs \
- bfd.op bfd.tr bfd.cv bfd.cn
-
-clean-aminfo:
-
-distclean-aminfo:
-
-maintainer-clean-aminfo:
- for i in $(INFO_DEPS); do \
- rm -f $$i; \
- if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
- rm -f $$i-[0-9]*; \
- fi; \
- done
-clean-info: mostlyclean-aminfo
-tags: TAGS
-TAGS:
-
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = doc
-
-distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
- $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
-info-am: $(INFO_DEPS)
-info: info-am
-dvi-am: $(DVIS)
-dvi: dvi-am
-check-am:
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-info-am:
-install-info: install-info-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-
-
-mostlyclean-generic:
- -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
- -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
-
-maintainer-clean-generic:
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-mostlyclean-am: mostlyclean-aminfo mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-aminfo clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-aminfo distclean-generic clean-am
- -rm -f libtool
-
-distclean: distclean-am
-
-maintainer-clean-am: maintainer-clean-aminfo maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: install-info-am uninstall-info mostlyclean-aminfo \
-distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir \
-info-am info dvi-am dvi check check-am installcheck-am installcheck \
-install-info-am install-info install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
-
-chew.o: chew.c
- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
-
-protos: libbfd.h libcoff.h bfd.h
-
-bfd.info bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo
-
-# We can't replace these rules with an implicit rule, because
-# makes without VPATH support couldn't find the .h files in `..'.
-
-# We use s-XXX targets so that we can distribute the info files,
-# and permit people to rebuild them, without requiring the makeinfo
-# program. If somebody tries to rebuild info, but none of the .texi
-# files have changed, then this Makefile will build chew, and will
-# build all of the stamp files, but will not actually have to rebuild
-# bfd.info.
-
-s-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
- $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
- touch s-aoutx
-aoutx.texi: s-aoutx
-
-s-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp
- $(srcdir)/../../move-if-change archive.tmp archive.texi
- touch s-archive
-archive.texi: s-archive
-
-s-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp
- $(srcdir)/../../move-if-change archures.tmp archures.texi
- touch s-archures
-archures.texi: s-archures
-
-# We use bfdt.texi, rather than bfd.texi, to avoid conflicting with
-# bfd.texinfo on an 8.3 filesystem.
-s-bfd: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp
- $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
- touch s-bfd
-bfdt.texi: s-bfd
-
-s-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp
- $(srcdir)/../../move-if-change cache.tmp cache.texi
- touch s-cache
-cache.texi: s-cache
-
-s-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp
- $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
- touch s-coffcode
-coffcode.texi: s-coffcode
-
-s-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp
- $(srcdir)/../../move-if-change core.tmp core.texi
- touch s-core
-core.texi: s-core
-
-s-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp
- $(srcdir)/../../move-if-change elf.tmp elf.texi
- touch s-elf
-elf.texi: s-elf
-
-s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp
- $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
- touch s-elfcode
-elfcode.texi: s-elfcode
-
-s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
- $(srcdir)/../../move-if-change mmo.tmp mmo.texi
- touch s-mmo
-mmo.texi: s-mmo
-
-s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
- $(srcdir)/../../move-if-change format.tmp format.texi
- touch s-format
-format.texi: s-format
-
-s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp
- $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
- touch s-libbfd
-libbfd.texi: s-libbfd
-
-s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
- $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
- touch s-bfdio
-bfdio.texi: s-bfdio
-
-s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
- $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
- touch s-bfdwin
-bfdwin.texi: s-bfdwin
-
-s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp
- $(srcdir)/../../move-if-change opncls.tmp opncls.texi
- touch s-opncls
-opncls.texi: s-opncls
-
-s-reloc: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp
- $(srcdir)/../../move-if-change reloc.tmp reloc.texi
- touch s-reloc
-reloc.texi: s-reloc
-
-s-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp
- $(srcdir)/../../move-if-change section.tmp section.texi
- touch s-section
-section.texi: s-section
-
-s-syms: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp
- $(srcdir)/../../move-if-change syms.tmp syms.texi
- touch s-syms
-syms.texi: s-syms
-
-s-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp
- $(srcdir)/../../move-if-change targets.tmp targets.texi
- touch s-targets
-targets.texi: s-targets
-
-s-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp
- $(srcdir)/../../move-if-change init.tmp init.texi
- touch s-init
-init.texi: s-init
-
-s-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp
- $(srcdir)/../../move-if-change hash.tmp hash.texi
- touch s-hash
-hash.texi: s-hash
-
-s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
- ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp
- $(srcdir)/../../move-if-change linker.tmp linker.texi
- touch s-linker
-linker.texi: s-linker
-
-libbfd.h: $(LIBBFD_H_DEP)
- echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
- for file in $(LIBBFD_H_DEP); do \
- case $$file in \
- *-in.h) cat $$file >> $@ ;; \
- */header.sed) break ;; \
- *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
- -e 's,$$,. */,' >> $@ ; \
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
- esac; \
- done
-
-libcoff.h: $(LIBCOFF_H_DEP)
- echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@
- for file in $(LIBCOFF_H_DEP); do \
- case $$file in \
- *-in.h) cat $$file >> $@ ;; \
- */header.sed) break ;; \
- *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
- -e 's,$$,. */,' >> $@ ; \
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
- esac; \
- done
-
-bfd.h: $(BFD_H_DEP)
- echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
- for file in $(BFD_H_DEP); do \
- case $$file in \
- *-in.h) cat $$file >> $@ ;; \
- */header.sed) break ;; \
- *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
- -e 's,$$,. */,' >> $@ ; \
- ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
- esac; \
- done
- echo "#ifdef __cplusplus" >> $@
- echo "}" >> $@
- echo "#endif" >> $@
- echo "#endif" >> $@
-
-# We want install to imply install-info as per GNU standards, despite the
-# cygnus option.
-install: install-info
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/contrib/binutils/bfd/doc/aoutx.texi b/contrib/binutils/bfd/doc/aoutx.texi
deleted file mode 100644
index 0c4167b..0000000
--- a/contrib/binutils/bfd/doc/aoutx.texi
+++ /dev/null
@@ -1,211 +0,0 @@
-@section a.out backends
-
-
-@strong{Description}@*
-BFD supports a number of different flavours of a.out format,
-though the major differences are only the sizes of the
-structures on disk, and the shape of the relocation
-information.
-
-The support is split into a basic support file @file{aoutx.h}
-and other files which derive functions from the base. One
-derivation file is @file{aoutf1.h} (for a.out flavour 1), and
-adds to the basic a.out functions support for sun3, sun4, 386
-and 29k a.out files, to create a target jump vector for a
-specific target.
-
-This information is further split out into more specific files
-for each machine, including @file{sunos.c} for sun3 and sun4,
-@file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a
-demonstration of a 64 bit a.out format.
-
-The base file @file{aoutx.h} defines general mechanisms for
-reading and writing records to and from disk and various
-other methods which BFD requires. It is included by
-@file{aout32.c} and @file{aout64.c} to form the names
-@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc.
-
-As an example, this is what goes on to make the back end for a
-sun4, from @file{aout32.c}:
-
-@example
- #define ARCH_SIZE 32
- #include "aoutx.h"
-@end example
-
-Which exports names:
-
-@example
- ...
- aout_32_canonicalize_reloc
- aout_32_find_nearest_line
- aout_32_get_lineno
- aout_32_get_reloc_upper_bound
- ...
-@end example
-
-from @file{sunos.c}:
-
-@example
- #define TARGET_NAME "a.out-sunos-big"
- #define VECNAME sunos_big_vec
- #include "aoutf1.h"
-@end example
-
-requires all the names from @file{aout32.c}, and produces the jump vector
-
-@example
- sunos_big_vec
-@end example
-
-The file @file{host-aout.c} is a special case. It is for a large set
-of hosts that use ``more or less standard'' a.out files, and
-for which cross-debugging is not interesting. It uses the
-standard 32-bit a.out support routines, but determines the
-file offsets and addresses of the text, data, and BSS
-sections, the machine architecture and machine type, and the
-entry point address, in a host-dependent manner. Once these
-values have been determined, generic code is used to handle
-the object file.
-
-When porting it to run on a new system, you must supply:
-
-@example
- HOST_PAGE_SIZE
- HOST_SEGMENT_SIZE
- HOST_MACHINE_ARCH (optional)
- HOST_MACHINE_MACHINE (optional)
- HOST_TEXT_START_ADDR
- HOST_STACK_END_ADDR
-@end example
-
-in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These
-values, plus the structures and macros defined in @file{a.out.h} on
-your host system, will produce a BFD target that will access
-ordinary a.out files on your host. To configure a new machine
-to use @file{host-aout.c}, specify:
-
-@example
- TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
- TDEPFILES= host-aout.o trad-core.o
-@end example
-
-in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
-to use the
-@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your
-configuration is selected.
-
-@subsection Relocations
-
-
-@strong{Description}@*
-The file @file{aoutx.h} provides for both the @emph{standard}
-and @emph{extended} forms of a.out relocation records.
-
-The standard records contain only an
-address, a symbol index, and a type field. The extended records
-(used on 29ks and sparcs) also have a full integer for an
-addend.
-
-@subsection Internal entry points
-
-
-@strong{Description}@*
-@file{aoutx.h} exports several routines for accessing the
-contents of an a.out file, which are gathered and exported in
-turn by various format specific files (eg sunos.c).
-
-@findex aout_@var{size}_swap_exec_header_in
-@subsubsection @code{aout_@var{size}_swap_exec_header_in}
-@strong{Synopsis}
-@example
-void aout_@var{size}_swap_exec_header_in,
- (bfd *abfd,
- struct external_exec *raw_bytes,
- struct internal_exec *execp);
-@end example
-@strong{Description}@*
-Swap the information in an executable header @var{raw_bytes} taken
-from a raw byte stream memory image into the internal exec header
-structure @var{execp}.
-
-@findex aout_@var{size}_swap_exec_header_out
-@subsubsection @code{aout_@var{size}_swap_exec_header_out}
-@strong{Synopsis}
-@example
-void aout_@var{size}_swap_exec_header_out
- (bfd *abfd,
- struct internal_exec *execp,
- struct external_exec *raw_bytes);
-@end example
-@strong{Description}@*
-Swap the information in an internal exec header structure
-@var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
-
-@findex aout_@var{size}_some_aout_object_p
-@subsubsection @code{aout_@var{size}_some_aout_object_p}
-@strong{Synopsis}
-@example
-const bfd_target *aout_@var{size}_some_aout_object_p
- (bfd *abfd,
- const bfd_target *(*callback_to_real_object_p) ());
-@end example
-@strong{Description}@*
-Some a.out variant thinks that the file open in @var{abfd}
-checking is an a.out file. Do some more checking, and set up
-for access if it really is. Call back to the calling
-environment's "finish up" function just before returning, to
-handle any last-minute setup.
-
-@findex aout_@var{size}_mkobject
-@subsubsection @code{aout_@var{size}_mkobject}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
-@end example
-@strong{Description}@*
-Initialize BFD @var{abfd} for use with a.out files.
-
-@findex aout_@var{size}_machine_type
-@subsubsection @code{aout_@var{size}_machine_type}
-@strong{Synopsis}
-@example
-enum machine_type aout_@var{size}_machine_type
- (enum bfd_architecture arch,
- unsigned long machine));
-@end example
-@strong{Description}@*
-Keep track of machine architecture and machine type for
-a.out's. Return the @code{machine_type} for a particular
-architecture and machine, or @code{M_UNKNOWN} if that exact architecture
-and machine can't be represented in a.out format.
-
-If the architecture is understood, machine type 0 (default)
-is always understood.
-
-@findex aout_@var{size}_set_arch_mach
-@subsubsection @code{aout_@var{size}_set_arch_mach}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_set_arch_mach,
- (bfd *,
- enum bfd_architecture arch,
- unsigned long machine));
-@end example
-@strong{Description}@*
-Set the architecture and the machine of the BFD @var{abfd} to the
-values @var{arch} and @var{machine}. Verify that @var{abfd}'s format
-can support the architecture required.
-
-@findex aout_@var{size}_new_section_hook
-@subsubsection @code{aout_@var{size}_new_section_hook}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_new_section_hook,
- (bfd *abfd,
- asection *newsect));
-@end example
-@strong{Description}@*
-Called by the BFD in response to a @code{bfd_make_section}
-request.
-
diff --git a/contrib/binutils/bfd/doc/archive.texi b/contrib/binutils/bfd/doc/archive.texi
deleted file mode 100644
index e20906a..0000000
--- a/contrib/binutils/bfd/doc/archive.texi
+++ /dev/null
@@ -1,96 +0,0 @@
-@section Archives
-
-
-@strong{Description}@*
-An archive (or library) is just another BFD. It has a symbol
-table, although there's not much a user program will do with it.
-
-The big difference between an archive BFD and an ordinary BFD
-is that the archive doesn't have sections. Instead it has a
-chain of BFDs that are considered its contents. These BFDs can
-be manipulated like any other. The BFDs contained in an
-archive opened for reading will all be opened for reading. You
-may put either input or output BFDs into an archive opened for
-output; they will be handled correctly when the archive is closed.
-
-Use @code{bfd_openr_next_archived_file} to step through
-the contents of an archive opened for input. You don't
-have to read the entire archive if you don't want
-to! Read it until you find what you want.
-
-Archive contents of output BFDs are chained through the
-@code{next} pointer in a BFD. The first one is findable through
-the @code{archive_head} slot of the archive. Set it with
-@code{bfd_set_archive_head} (q.v.). A given BFD may be in only one
-open output archive at a time.
-
-As expected, the BFD archive code is more general than the
-archive code of any given environment. BFD archives may
-contain files of different formats (e.g., a.out and coff) and
-even different architectures. You may even place archives
-recursively into archives!
-
-This can cause unexpected confusion, since some archive
-formats are more expressive than others. For instance, Intel
-COFF archives can preserve long filenames; SunOS a.out archives
-cannot. If you move a file from the first to the second
-format and back again, the filename may be truncated.
-Likewise, different a.out environments have different
-conventions as to how they truncate filenames, whether they
-preserve directory names in filenames, etc. When
-interoperating with native tools, be sure your files are
-homogeneous.
-
-Beware: most of these formats do not react well to the
-presence of spaces in filenames. We do the best we can, but
-can't always handle this case due to restrictions in the format of
-archives. Many Unix utilities are braindead in regards to
-spaces and such in filenames anyway, so this shouldn't be much
-of a restriction.
-
-Archives are supported in BFD in @code{archive.c}.
-
-@findex bfd_get_next_mapent
-@subsubsection @code{bfd_get_next_mapent}
-@strong{Synopsis}
-@example
-symindex bfd_get_next_mapent
- (bfd *abfd, symindex previous, carsym **sym);
-@end example
-@strong{Description}@*
-Step through archive @var{abfd}'s symbol table (if it
-has one). Successively update @var{sym} with the next symbol's
-information, returning that symbol's (internal) index into the
-symbol table.
-
-Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get
-the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already
-got the last one.
-
-A @code{carsym} is a canonical archive symbol. The only
-user-visible element is its name, a null-terminated string.
-
-@findex bfd_set_archive_head
-@subsubsection @code{bfd_set_archive_head}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
-@end example
-@strong{Description}@*
-Set the head of the chain of
-BFDs contained in the archive @var{output} to @var{new_head}.
-
-@findex bfd_openr_next_archived_file
-@subsubsection @code{bfd_openr_next_archived_file}
-@strong{Synopsis}
-@example
-bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-@end example
-@strong{Description}@*
-Provided a BFD, @var{archive}, containing an archive and NULL, open
-an input BFD on the first contained element and returns that.
-Subsequent calls should pass
-the archive and the previous return value to return a created
-BFD to the next contained element. NULL is returned when there
-are no more.
-
diff --git a/contrib/binutils/bfd/doc/archures.texi b/contrib/binutils/bfd/doc/archures.texi
deleted file mode 100644
index 06ee6d3..0000000
--- a/contrib/binutils/bfd/doc/archures.texi
+++ /dev/null
@@ -1,534 +0,0 @@
-@section Architectures
-BFD keeps one atom in a BFD describing the
-architecture of the data attached to the BFD: a pointer to a
-@code{bfd_arch_info_type}.
-
-Pointers to structures can be requested independently of a BFD
-so that an architecture's information can be interrogated
-without access to an open BFD.
-
-The architecture information is provided by each architecture package.
-The set of default architectures is selected by the macro
-@code{SELECT_ARCHITECTURES}. This is normally set up in the
-@file{config/@var{target}.mt} file of your choice. If the name is not
-defined, then all the architectures supported are included.
-
-When BFD starts up, all the architectures are called with an
-initialize method. It is up to the architecture back end to
-insert as many items into the list of architectures as it wants to;
-generally this would be one for each machine and one for the
-default case (an item with a machine field of 0).
-
-BFD's idea of an architecture is implemented in @file{archures.c}.
-
-@subsection bfd_architecture
-
-
-@strong{Description}@*
-This enum gives the object file's CPU architecture, in a
-global sense---i.e., what processor family does it belong to?
-Another field indicates which processor within
-the family is in use. The machine gives a number which
-distinguishes different versions of the architecture,
-containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
-and 68020 and 68030 for Motorola 68020 and 68030.
-@example
-enum bfd_architecture
-@{
- bfd_arch_unknown, /* File arch not known. */
- bfd_arch_obscure, /* Arch known, not one of these. */
- bfd_arch_m68k, /* Motorola 68xxx */
-#define bfd_mach_m68000 1
-#define bfd_mach_m68008 2
-#define bfd_mach_m68010 3
-#define bfd_mach_m68020 4
-#define bfd_mach_m68030 5
-#define bfd_mach_m68040 6
-#define bfd_mach_m68060 7
-#define bfd_mach_cpu32 8
-#define bfd_mach_mcf5200 9
-#define bfd_mach_mcf5206e 10
-#define bfd_mach_mcf5307 11
-#define bfd_mach_mcf5407 12
-#define bfd_mach_mcf528x 13
- bfd_arch_vax, /* DEC Vax */
- bfd_arch_i960, /* Intel 960 */
- /* The order of the following is important.
- lower number indicates a machine type that
- only accepts a subset of the instructions
- available to machines with higher numbers.
- The exception is the "ca", which is
- incompatible with all other machines except
- "core". */
-
-#define bfd_mach_i960_core 1
-#define bfd_mach_i960_ka_sa 2
-#define bfd_mach_i960_kb_sb 3
-#define bfd_mach_i960_mc 4
-#define bfd_mach_i960_xa 5
-#define bfd_mach_i960_ca 6
-#define bfd_mach_i960_jx 7
-#define bfd_mach_i960_hx 8
-
- bfd_arch_or32, /* OpenRISC 32 */
-
- bfd_arch_a29k, /* AMD 29000 */
- bfd_arch_sparc, /* SPARC */
-#define bfd_mach_sparc 1
-/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
-#define bfd_mach_sparc_sparclet 2
-#define bfd_mach_sparc_sparclite 3
-#define bfd_mach_sparc_v8plus 4
-#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
-#define bfd_mach_sparc_sparclite_le 6
-#define bfd_mach_sparc_v9 7
-#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
-#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
-#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
-/* Nonzero if MACH has the v9 instruction set. */
-#define bfd_mach_sparc_v9_p(mach) \
- ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
- && (mach) != bfd_mach_sparc_sparclite_le)
- bfd_arch_mips, /* MIPS Rxxxx */
-#define bfd_mach_mips3000 3000
-#define bfd_mach_mips3900 3900
-#define bfd_mach_mips4000 4000
-#define bfd_mach_mips4010 4010
-#define bfd_mach_mips4100 4100
-#define bfd_mach_mips4111 4111
-#define bfd_mach_mips4120 4120
-#define bfd_mach_mips4300 4300
-#define bfd_mach_mips4400 4400
-#define bfd_mach_mips4600 4600
-#define bfd_mach_mips4650 4650
-#define bfd_mach_mips5000 5000
-#define bfd_mach_mips5400 5400
-#define bfd_mach_mips5500 5500
-#define bfd_mach_mips6000 6000
-#define bfd_mach_mips7000 7000
-#define bfd_mach_mips8000 8000
-#define bfd_mach_mips10000 10000
-#define bfd_mach_mips12000 12000
-#define bfd_mach_mips16 16
-#define bfd_mach_mips5 5
-#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
-#define bfd_mach_mipsisa32 32
-#define bfd_mach_mipsisa32r2 33
-#define bfd_mach_mipsisa64 64
-#define bfd_mach_mipsisa64r2 65
- bfd_arch_i386, /* Intel 386 */
-#define bfd_mach_i386_i386 1
-#define bfd_mach_i386_i8086 2
-#define bfd_mach_i386_i386_intel_syntax 3
-#define bfd_mach_x86_64 64
-#define bfd_mach_x86_64_intel_syntax 65
- bfd_arch_we32k, /* AT&T WE32xxx */
- bfd_arch_tahoe, /* CCI/Harris Tahoe */
- bfd_arch_i860, /* Intel 860 */
- bfd_arch_i370, /* IBM 360/370 Mainframes */
- bfd_arch_romp, /* IBM ROMP PC/RT */
- bfd_arch_alliant, /* Alliant */
- bfd_arch_convex, /* Convex */
- bfd_arch_m88k, /* Motorola 88xxx */
- bfd_arch_m98k, /* Motorola 98xxx */
- bfd_arch_pyramid, /* Pyramid Technology */
- bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
-#define bfd_mach_h8300 1
-#define bfd_mach_h8300h 2
-#define bfd_mach_h8300s 3
-#define bfd_mach_h8300hn 4
-#define bfd_mach_h8300sn 5
-#define bfd_mach_h8300sx 6
-#define bfd_mach_h8300sxn 7
- bfd_arch_pdp11, /* DEC PDP-11 */
- bfd_arch_powerpc, /* PowerPC */
-#define bfd_mach_ppc 32
-#define bfd_mach_ppc64 64
-#define bfd_mach_ppc_403 403
-#define bfd_mach_ppc_403gc 4030
-#define bfd_mach_ppc_505 505
-#define bfd_mach_ppc_601 601
-#define bfd_mach_ppc_602 602
-#define bfd_mach_ppc_603 603
-#define bfd_mach_ppc_ec603e 6031
-#define bfd_mach_ppc_604 604
-#define bfd_mach_ppc_620 620
-#define bfd_mach_ppc_630 630
-#define bfd_mach_ppc_750 750
-#define bfd_mach_ppc_860 860
-#define bfd_mach_ppc_a35 35
-#define bfd_mach_ppc_rs64ii 642
-#define bfd_mach_ppc_rs64iii 643
-#define bfd_mach_ppc_7400 7400
-#define bfd_mach_ppc_e500 500
- bfd_arch_rs6000, /* IBM RS/6000 */
-#define bfd_mach_rs6k 6000
-#define bfd_mach_rs6k_rs1 6001
-#define bfd_mach_rs6k_rsc 6003
-#define bfd_mach_rs6k_rs2 6002
- bfd_arch_hppa, /* HP PA RISC */
-#define bfd_mach_hppa10 10
-#define bfd_mach_hppa11 11
-#define bfd_mach_hppa20 20
-#define bfd_mach_hppa20w 25
- bfd_arch_d10v, /* Mitsubishi D10V */
-#define bfd_mach_d10v 1
-#define bfd_mach_d10v_ts2 2
-#define bfd_mach_d10v_ts3 3
- bfd_arch_d30v, /* Mitsubishi D30V */
- bfd_arch_dlx, /* DLX */
- bfd_arch_m68hc11, /* Motorola 68HC11 */
- bfd_arch_m68hc12, /* Motorola 68HC12 */
-#define bfd_mach_m6812_default 0
-#define bfd_mach_m6812 1
-#define bfd_mach_m6812s 2
- bfd_arch_z8k, /* Zilog Z8000 */
-#define bfd_mach_z8001 1
-#define bfd_mach_z8002 2
- bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
- bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
-#define bfd_mach_sh 1
-#define bfd_mach_sh2 0x20
-#define bfd_mach_sh_dsp 0x2d
-#define bfd_mach_sh2e 0x2e
-#define bfd_mach_sh3 0x30
-#define bfd_mach_sh3_dsp 0x3d
-#define bfd_mach_sh3e 0x3e
-#define bfd_mach_sh4 0x40
-#define bfd_mach_sh4_nofpu 0x41
-#define bfd_mach_sh4a 0x4a
-#define bfd_mach_sh4a_nofpu 0x4b
-#define bfd_mach_sh4al_dsp 0x4d
-#define bfd_mach_sh5 0x50
- bfd_arch_alpha, /* Dec Alpha */
-#define bfd_mach_alpha_ev4 0x10
-#define bfd_mach_alpha_ev5 0x20
-#define bfd_mach_alpha_ev6 0x30
- bfd_arch_arm, /* Advanced Risc Machines ARM. */
-#define bfd_mach_arm_unknown 0
-#define bfd_mach_arm_2 1
-#define bfd_mach_arm_2a 2
-#define bfd_mach_arm_3 3
-#define bfd_mach_arm_3M 4
-#define bfd_mach_arm_4 5
-#define bfd_mach_arm_4T 6
-#define bfd_mach_arm_5 7
-#define bfd_mach_arm_5T 8
-#define bfd_mach_arm_5TE 9
-#define bfd_mach_arm_XScale 10
-#define bfd_mach_arm_ep9312 11
-#define bfd_mach_arm_iWMMXt 12
- bfd_arch_ns32k, /* National Semiconductors ns32000 */
- bfd_arch_w65, /* WDC 65816 */
- bfd_arch_tic30, /* Texas Instruments TMS320C30 */
- bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
-#define bfd_mach_tic3x 30
-#define bfd_mach_tic4x 40
- bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
- bfd_arch_tic80, /* TI TMS320c80 (MVP) */
- bfd_arch_v850, /* NEC V850 */
-#define bfd_mach_v850 1
-#define bfd_mach_v850e 'E'
-#define bfd_mach_v850e1 '1'
- bfd_arch_arc, /* ARC Cores */
-#define bfd_mach_arc_5 5
-#define bfd_mach_arc_6 6
-#define bfd_mach_arc_7 7
-#define bfd_mach_arc_8 8
- bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
-#define bfd_mach_m32r 1 /* For backwards compatibility. */
-#define bfd_mach_m32rx 'x'
-#define bfd_mach_m32r2 '2'
- bfd_arch_mn10200, /* Matsushita MN10200 */
- bfd_arch_mn10300, /* Matsushita MN10300 */
-#define bfd_mach_mn10300 300
-#define bfd_mach_am33 330
-#define bfd_mach_am33_2 332
- bfd_arch_fr30,
-#define bfd_mach_fr30 0x46523330
- bfd_arch_frv,
-#define bfd_mach_frv 1
-#define bfd_mach_frvsimple 2
-#define bfd_mach_fr300 300
-#define bfd_mach_fr400 400
-#define bfd_mach_frvtomcat 499 /* fr500 prototype */
-#define bfd_mach_fr500 500
-#define bfd_mach_fr550 550
- bfd_arch_mcore,
- bfd_arch_ia64, /* HP/Intel ia64 */
-#define bfd_mach_ia64_elf64 64
-#define bfd_mach_ia64_elf32 32
- bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
-#define bfd_mach_ip2022 1
-#define bfd_mach_ip2022ext 2
- bfd_arch_iq2000, /* Vitesse IQ2000. */
-#define bfd_mach_iq2000 1
-#define bfd_mach_iq10 2
- bfd_arch_pj,
- bfd_arch_avr, /* Atmel AVR microcontrollers. */
-#define bfd_mach_avr1 1
-#define bfd_mach_avr2 2
-#define bfd_mach_avr3 3
-#define bfd_mach_avr4 4
-#define bfd_mach_avr5 5
- bfd_arch_cris, /* Axis CRIS */
- bfd_arch_s390, /* IBM s390 */
-#define bfd_mach_s390_31 31
-#define bfd_mach_s390_64 64
- bfd_arch_openrisc, /* OpenRISC */
- bfd_arch_mmix, /* Donald Knuth's educational processor. */
- bfd_arch_xstormy16,
-#define bfd_mach_xstormy16 1
- bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
-#define bfd_mach_msp11 11
-#define bfd_mach_msp110 110
-#define bfd_mach_msp12 12
-#define bfd_mach_msp13 13
-#define bfd_mach_msp14 14
-#define bfd_mach_msp15 15
-#define bfd_mach_msp16 16
-#define bfd_mach_msp31 31
-#define bfd_mach_msp32 32
-#define bfd_mach_msp33 33
-#define bfd_mach_msp41 41
-#define bfd_mach_msp42 42
-#define bfd_mach_msp43 43
-#define bfd_mach_msp44 44
- bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
-#define bfd_mach_xtensa 1
- bfd_arch_last
- @};
-@end example
-
-@subsection bfd_arch_info
-
-
-@strong{Description}@*
-This structure contains information on architectures for use
-within BFD.
-@example
-
-typedef struct bfd_arch_info
-@{
- int bits_per_word;
- int bits_per_address;
- int bits_per_byte;
- enum bfd_architecture arch;
- unsigned long mach;
- const char *arch_name;
- const char *printable_name;
- unsigned int section_align_power;
- /* TRUE if this is the default machine for the architecture.
- The default arch should be the first entry for an arch so that
- all the entries for that arch can be accessed via @code{next}. */
- bfd_boolean the_default;
- const struct bfd_arch_info * (*compatible)
- (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
-
- bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
-
- const struct bfd_arch_info *next;
-@}
-bfd_arch_info_type;
-
-@end example
-
-@findex bfd_printable_name
-@subsubsection @code{bfd_printable_name}
-@strong{Synopsis}
-@example
-const char *bfd_printable_name (bfd *abfd);
-@end example
-@strong{Description}@*
-Return a printable string representing the architecture and machine
-from the pointer to the architecture info structure.
-
-@findex bfd_scan_arch
-@subsubsection @code{bfd_scan_arch}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_scan_arch (const char *string);
-@end example
-@strong{Description}@*
-Figure out if BFD supports any cpu which could be described with
-the name @var{string}. Return a pointer to an @code{arch_info}
-structure if a machine is found, otherwise NULL.
-
-@findex bfd_arch_list
-@subsubsection @code{bfd_arch_list}
-@strong{Synopsis}
-@example
-const char **bfd_arch_list (void);
-@end example
-@strong{Description}@*
-Return a freshly malloced NULL-terminated vector of the names
-of all the valid BFD architectures. Do not modify the names.
-
-@findex bfd_arch_get_compatible
-@subsubsection @code{bfd_arch_get_compatible}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_arch_get_compatible
- (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
-@end example
-@strong{Description}@*
-Determine whether two BFDs' architectures and machine types
-are compatible. Calculates the lowest common denominator
-between the two architectures and machine types implied by
-the BFDs and returns a pointer to an @code{arch_info} structure
-describing the compatible machine.
-
-@findex bfd_default_arch_struct
-@subsubsection @code{bfd_default_arch_struct}
-@strong{Description}@*
-The @code{bfd_default_arch_struct} is an item of
-@code{bfd_arch_info_type} which has been initialized to a fairly
-generic state. A BFD starts life by pointing to this
-structure, until the correct back end has determined the real
-architecture of the file.
-@example
-extern const bfd_arch_info_type bfd_default_arch_struct;
-@end example
-
-@findex bfd_set_arch_info
-@subsubsection @code{bfd_set_arch_info}
-@strong{Synopsis}
-@example
-void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
-@end example
-@strong{Description}@*
-Set the architecture info of @var{abfd} to @var{arg}.
-
-@findex bfd_default_set_arch_mach
-@subsubsection @code{bfd_default_set_arch_mach}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_default_set_arch_mach
- (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
-@end example
-@strong{Description}@*
-Set the architecture and machine type in BFD @var{abfd}
-to @var{arch} and @var{mach}. Find the correct
-pointer to a structure and insert it into the @code{arch_info}
-pointer.
-
-@findex bfd_get_arch
-@subsubsection @code{bfd_get_arch}
-@strong{Synopsis}
-@example
-enum bfd_architecture bfd_get_arch (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the enumerated type which describes the BFD @var{abfd}'s
-architecture.
-
-@findex bfd_get_mach
-@subsubsection @code{bfd_get_mach}
-@strong{Synopsis}
-@example
-unsigned long bfd_get_mach (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the long type which describes the BFD @var{abfd}'s
-machine.
-
-@findex bfd_arch_bits_per_byte
-@subsubsection @code{bfd_arch_bits_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_bits_per_byte (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of bits in one of the BFD @var{abfd}'s
-architecture's bytes.
-
-@findex bfd_arch_bits_per_address
-@subsubsection @code{bfd_arch_bits_per_address}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_bits_per_address (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of bits in one of the BFD @var{abfd}'s
-architecture's addresses.
-
-@findex bfd_default_compatible
-@subsubsection @code{bfd_default_compatible}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-@end example
-@strong{Description}@*
-The default function for testing for compatibility.
-
-@findex bfd_default_scan
-@subsubsection @code{bfd_default_scan}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_default_scan
- (const struct bfd_arch_info *info, const char *string);
-@end example
-@strong{Description}@*
-The default function for working out whether this is an
-architecture hit and a machine hit.
-
-@findex bfd_get_arch_info
-@subsubsection @code{bfd_get_arch_info}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the architecture info struct in @var{abfd}.
-
-@findex bfd_lookup_arch
-@subsubsection @code{bfd_lookup_arch}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_lookup_arch
- (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-Look for the architecture info structure which matches the
-arguments @var{arch} and @var{machine}. A machine of 0 matches the
-machine/architecture structure which marks itself as the
-default.
-
-@findex bfd_printable_arch_mach
-@subsubsection @code{bfd_printable_arch_mach}
-@strong{Synopsis}
-@example
-const char *bfd_printable_arch_mach
- (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-Return a printable string representing the architecture and
-machine type.
-
-This routine is depreciated.
-
-@findex bfd_octets_per_byte
-@subsubsection @code{bfd_octets_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_octets_per_byte (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of octets (8-bit quantities) per target byte
-(minimum addressable unit). In most cases, this will be one, but some
-DSP targets have 16, 32, or even 48 bits per byte.
-
-@findex bfd_arch_mach_octets_per_byte
-@subsubsection @code{bfd_arch_mach_octets_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_mach_octets_per_byte
- (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-See bfd_octets_per_byte.
-
-This routine is provided for those cases where a bfd * is not
-available
-
diff --git a/contrib/binutils/bfd/doc/bfd.texi b/contrib/binutils/bfd/doc/bfd.texi
deleted file mode 100644
index ea0ca9e..0000000
--- a/contrib/binutils/bfd/doc/bfd.texi
+++ /dev/null
@@ -1,585 +0,0 @@
-@section @code{typedef bfd}
-A BFD has type @code{bfd}; objects of this type are the
-cornerstone of any application using BFD. Using BFD
-consists of making references though the BFD and to data in the BFD.
-
-Here is the structure that defines the type @code{bfd}. It
-contains the major data about the file and pointers
-to the rest of the data.
-@*
-.
-@example
-struct _bfd
-@{
- /* The filename the application opened the BFD with. */
- CONST char *filename;
-
- /* A pointer to the target jump table. */
- const struct bfd_target *xvec;
-
- /* To avoid dragging too many header files into every file that
- includes `@code{bfd.h}', IOSTREAM has been declared as a "char
- *", and MTIME as a "long". Their correct types, to which they
- are cast when used, are "FILE *" and "time_t". The iostream
- is the result of an fopen on the filename. However, if the
- BFD_IN_MEMORY flag is set, then iostream is actually a pointer
- to a bfd_in_memory struct. */
- PTR iostream;
-
- /* Is the file descriptor being cached? That is, can it be closed as
- needed, and re-opened when accessed later? */
-
- boolean cacheable;
-
- /* Marks whether there was a default target specified when the
- BFD was opened. This is used to select which matching algorithm
- to use to choose the back end. */
-
- boolean target_defaulted;
-
- /* The caching routines use these to maintain a
- least-recently-used list of BFDs */
-
- struct _bfd *lru_prev, *lru_next;
-
- /* When a file is closed by the caching routines, BFD retains
- state information on the file here: */
-
- file_ptr where;
-
- /* and here: (``once'' means at least once) */
-
- boolean opened_once;
-
- /* Set if we have a locally maintained mtime value, rather than
- getting it from the file each time: */
-
- boolean mtime_set;
-
- /* File modified time, if mtime_set is true: */
-
- long mtime;
-
- /* Reserved for an unimplemented file locking extension.*/
-
- int ifd;
-
- /* The format which belongs to the BFD. (object, core, etc.) */
-
- bfd_format format;
-
- /* The direction the BFD was opened with*/
-
- enum bfd_direction @{no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3@} direction;
-
- /* Format_specific flags*/
-
- flagword flags;
-
- /* Currently my_archive is tested before adding origin to
- anything. I believe that this can become always an add of
- origin, with origin set to 0 for non archive files. */
-
- file_ptr origin;
-
- /* Remember when output has begun, to stop strange things
- from happening. */
- boolean output_has_begun;
-
- /* Pointer to linked list of sections*/
- struct sec *sections;
-
- /* The number of sections */
- unsigned int section_count;
-
- /* Stuff only useful for object files:
- The start address. */
- bfd_vma start_address;
-
- /* Used for input and output*/
- unsigned int symcount;
-
- /* Symbol table for output BFD (with symcount entries) */
- struct symbol_cache_entry **outsymbols;
-
- /* Pointer to structure which contains architecture information*/
- const struct bfd_arch_info *arch_info;
-
- /* Stuff only useful for archives:*/
- PTR arelt_data;
- struct _bfd *my_archive; /* The containing archive BFD. */
- struct _bfd *next; /* The next BFD in the archive. */
- struct _bfd *archive_head; /* The first BFD in the archive. */
- boolean has_armap;
-
- /* A chain of BFD structures involved in a link. */
- struct _bfd *link_next;
-
- /* A field used by _bfd_generic_link_add_archive_symbols. This will
- be used only for archive elements. */
- int archive_pass;
-
- /* Used by the back end to hold private data. */
-
- union
- @{
- struct aout_data_struct *aout_data;
- struct artdata *aout_ar_data;
- struct _oasys_data *oasys_obj_data;
- struct _oasys_ar_data *oasys_ar_data;
- struct coff_tdata *coff_obj_data;
- struct pe_tdata *pe_obj_data;
- struct xcoff_tdata *xcoff_obj_data;
- struct ecoff_tdata *ecoff_obj_data;
- struct ieee_data_struct *ieee_data;
- struct ieee_ar_data_struct *ieee_ar_data;
- struct srec_data_struct *srec_data;
- struct ihex_data_struct *ihex_data;
- struct tekhex_data_struct *tekhex_data;
- struct elf_obj_tdata *elf_obj_data;
- struct nlm_obj_tdata *nlm_obj_data;
- struct bout_data_struct *bout_data;
- struct sun_core_struct *sun_core_data;
- struct trad_core_struct *trad_core_data;
- struct som_data_struct *som_data;
- struct hpux_core_struct *hpux_core_data;
- struct hppabsd_core_struct *hppabsd_core_data;
- struct sgi_core_struct *sgi_core_data;
- struct lynx_core_struct *lynx_core_data;
- struct osf_core_struct *osf_core_data;
- struct cisco_core_struct *cisco_core_data;
- struct versados_data_struct *versados_data;
- struct netbsd_core_struct *netbsd_core_data;
- PTR any;
- @} tdata;
-
- /* Used by the application to hold private data*/
- PTR usrdata;
-
- /* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use PTR to avoid requiring the inclusion of
- objalloc.h. */
- PTR memory;
-@};
-
-@end example
-@section Error reporting
-Most BFD functions return nonzero on success (check their
-individual documentation for precise semantics). On an error,
-they call @code{bfd_set_error} to set an error condition that callers
-can check by calling @code{bfd_get_error}.
-If that returns @code{bfd_error_system_call}, then check
-@code{errno}.
-
-The easiest way to report a BFD error to the user is to
-use @code{bfd_perror}.
-@*
-@subsection Type @code{bfd_error_type}
-The values returned by @code{bfd_get_error} are defined by the
-enumerated type @code{bfd_error_type}.
-@*
-.
-@example
-typedef enum bfd_error
-@{
- bfd_error_no_error = 0,
- bfd_error_system_call,
- bfd_error_invalid_target,
- bfd_error_wrong_format,
- bfd_error_invalid_operation,
- bfd_error_no_memory,
- bfd_error_no_symbols,
- bfd_error_no_armap,
- bfd_error_no_more_archived_files,
- bfd_error_malformed_archive,
- bfd_error_file_not_recognized,
- bfd_error_file_ambiguously_recognized,
- bfd_error_no_contents,
- bfd_error_nonrepresentable_section,
- bfd_error_no_debug_section,
- bfd_error_bad_value,
- bfd_error_file_truncated,
- bfd_error_file_too_big,
- bfd_error_invalid_error_code
-@} bfd_error_type;
-
-@end example
-@findex bfd_get_error
-@subsubsection @code{bfd_get_error}
-@strong{Synopsis}
-@example
-bfd_error_type bfd_get_error (void);
-@end example
-@strong{Description}@*
-Return the current BFD error condition.
-@*
-@findex bfd_set_error
-@subsubsection @code{bfd_set_error}
-@strong{Synopsis}
-@example
-void bfd_set_error (bfd_error_type error_tag);
-@end example
-@strong{Description}@*
-Set the BFD error condition to be @var{error_tag}.
-@*
-@findex bfd_errmsg
-@subsubsection @code{bfd_errmsg}
-@strong{Synopsis}
-@example
-CONST char *bfd_errmsg (bfd_error_type error_tag);
-@end example
-@strong{Description}@*
-Return a string describing the error @var{error_tag}, or
-the system error if @var{error_tag} is @code{bfd_error_system_call}.
-@*
-@findex bfd_perror
-@subsubsection @code{bfd_perror}
-@strong{Synopsis}
-@example
-void bfd_perror (CONST char *message);
-@end example
-@strong{Description}@*
-Print to the standard error stream a string describing the
-last BFD error that occurred, or the last system error if
-the last BFD error was a system call failure. If @var{message}
-is non-NULL and non-empty, the error string printed is preceded
-by @var{message}, a colon, and a space. It is followed by a newline.
-@*
-@subsection BFD error handler
-Some BFD functions want to print messages describing the
-problem. They call a BFD error handler function. This
-function may be overriden by the program.
-
-The BFD error handler acts like printf.
-@*
-.
-@example
-typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
-
-@end example
-@findex bfd_set_error_handler
-@subsubsection @code{bfd_set_error_handler}
-@strong{Synopsis}
-@example
-bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-@end example
-@strong{Description}@*
-Set the BFD error handler function. Returns the previous
-function.
-@*
-@findex bfd_set_error_program_name
-@subsubsection @code{bfd_set_error_program_name}
-@strong{Synopsis}
-@example
-void bfd_set_error_program_name (const char *);
-@end example
-@strong{Description}@*
-Set the program name to use when printing a BFD error. This
-is printed before the error message followed by a colon and
-space. The string must not be changed after it is passed to
-this function.
-@*
-@section Symbols
-
-@*
-@findex bfd_get_reloc_upper_bound
-@subsubsection @code{bfd_get_reloc_upper_bound}
-@strong{Synopsis}
-@example
-long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
-@end example
-@strong{Description}@*
-Return the number of bytes required to store the
-relocation information associated with section @var{sect}
-attached to bfd @var{abfd}. If an error occurs, return -1.
-@*
-@findex bfd_canonicalize_reloc
-@subsubsection @code{bfd_canonicalize_reloc}
-@strong{Synopsis}
-@example
-long bfd_canonicalize_reloc
- (bfd *abfd,
- asection *sec,
- arelent **loc,
- asymbol **syms);
-@end example
-@strong{Description}@*
-Call the back end associated with the open BFD
-@var{abfd} and translate the external form of the relocation
-information attached to @var{sec} into the internal canonical
-form. Place the table into memory at @var{loc}, which has
-been preallocated, usually by a call to
-@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
--1 on error.
-
-The @var{syms} table is also needed for horrible internal magic
-reasons.
-@*
-@findex bfd_set_reloc
-@subsubsection @code{bfd_set_reloc}
-@strong{Synopsis}
-@example
-void bfd_set_reloc
- (bfd *abfd, asection *sec, arelent **rel, unsigned int count)
-@end example
-@strong{Description}@*
-Set the relocation pointer and count within
-section @var{sec} to the values @var{rel} and @var{count}.
-The argument @var{abfd} is ignored.
-@*
-@findex bfd_set_file_flags
-@subsubsection @code{bfd_set_file_flags}
-@strong{Synopsis}
-@example
-boolean bfd_set_file_flags(bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set the flag word in the BFD @var{abfd} to the value @var{flags}.
-
-Possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_wrong_format} - The target bfd was not of object format.
-@item
-@code{bfd_error_invalid_operation} - The target bfd was open for reading.
-@item
-@code{bfd_error_invalid_operation} -
-The flag word contained a bit which was not applicable to the
-type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
-on a BFD format which does not support demand paging.
-@end itemize
-@*
-@findex bfd_set_start_address
-@subsubsection @code{bfd_set_start_address}
-@strong{Synopsis}
-@example
-boolean bfd_set_start_address(bfd *abfd, bfd_vma vma);
-@end example
-@strong{Description}@*
-Make @var{vma} the entry point of output BFD @var{abfd}.
-@*
-@strong{Returns}@*
-Returns @code{true} on success, @code{false} otherwise.
-@*
-@findex bfd_get_mtime
-@subsubsection @code{bfd_get_mtime}
-@strong{Synopsis}
-@example
-long bfd_get_mtime(bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file modification time (as read from the file system, or
-from the archive header for archive members).
-@*
-@findex bfd_get_size
-@subsubsection @code{bfd_get_size}
-@strong{Synopsis}
-@example
-long bfd_get_size(bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file size (as read from file system) for the file
-associated with BFD @var{abfd}.
-
-The initial motivation for, and use of, this routine is not
-so we can get the exact size of the object the BFD applies to, since
-that might not be generally possible (archive members for example).
-It would be ideal if someone could eventually modify
-it so that such results were guaranteed.
-
-Instead, we want to ask questions like "is this NNN byte sized
-object I'm about to try read from file offset YYY reasonable?"
-As as example of where we might do this, some object formats
-use string tables for which the first @code{sizeof(long)} bytes of the
-table contain the size of the table itself, including the size bytes.
-If an application tries to read what it thinks is one of these
-string tables, without some way to validate the size, and for
-some reason the size is wrong (byte swapping error, wrong location
-for the string table, etc.), the only clue is likely to be a read
-error when it tries to read the table, or a "virtual memory
-exhausted" error when it tries to allocate 15 bazillon bytes
-of space for the 15 bazillon byte table it is about to read.
-This function at least allows us to answer the quesion, "is the
-size reasonable?".
-@*
-@findex bfd_get_gp_size
-@subsubsection @code{bfd_get_gp_size}
-@strong{Synopsis}
-@example
-int bfd_get_gp_size(bfd *abfd);
-@end example
-@strong{Description}@*
-Return the maximum size of objects to be optimized using the GP
-register under MIPS ECOFF. This is typically set by the @code{-G}
-argument to the compiler, assembler or linker.
-@*
-@findex bfd_set_gp_size
-@subsubsection @code{bfd_set_gp_size}
-@strong{Synopsis}
-@example
-void bfd_set_gp_size(bfd *abfd, int i);
-@end example
-@strong{Description}@*
-Set the maximum size of objects to be optimized using the GP
-register under ECOFF or MIPS ELF. This is typically set by
-the @code{-G} argument to the compiler, assembler or linker.
-@*
-@findex bfd_scan_vma
-@subsubsection @code{bfd_scan_vma}
-@strong{Synopsis}
-@example
-bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base);
-@end example
-@strong{Description}@*
-Convert, like @code{strtoul}, a numerical expression
-@var{string} into a @code{bfd_vma} integer, and return that integer.
-(Though without as many bells and whistles as @code{strtoul}.)
-The expression is assumed to be unsigned (i.e., positive).
-If given a @var{base}, it is used as the base for conversion.
-A base of 0 causes the function to interpret the string
-in hex if a leading "0x" or "0X" is found, otherwise
-in octal if a leading zero is found, otherwise in decimal.
-
-Overflow is not detected.
-@*
-@findex bfd_copy_private_bfd_data
-@subsubsection @code{bfd_copy_private_bfd_data}
-@strong{Synopsis}
-@example
-boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Copy private BFD information from the BFD @var{ibfd} to the
-the BFD @var{obfd}. Return @code{true} on success, @code{false} on error.
-Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
-@end example
-@*
-@findex bfd_merge_private_bfd_data
-@subsubsection @code{bfd_merge_private_bfd_data}
-@strong{Synopsis}
-@example
-boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Merge private BFD information from the BFD @var{ibfd} to the
-the output file BFD @var{obfd} when linking. Return @code{true}
-on success, @code{false} on error. Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
- (ibfd, obfd))
-@end example
-@*
-@findex bfd_set_private_flags
-@subsubsection @code{bfd_set_private_flags}
-@strong{Synopsis}
-@example
-boolean bfd_set_private_flags(bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set private BFD flag information in the BFD @var{abfd}.
-Return @code{true} on success, @code{false} on error. Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, \
- (abfd, flags))
-@end example
-@*
-@findex stuff
-@subsubsection @code{stuff}
-@strong{Description}@*
-Stuff which should be documented:
-@example
-#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
- BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
-
- /* Do these three do anything useful at all, for any back end? */
-#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-
-#define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
- BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
- BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_link_hash_table_create(abfd) \
- BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_add_symbols(abfd, info) \
- BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_final_link(abfd, info) \
- BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
- BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
- BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *,
- struct bfd_link_order *, bfd_byte *,
- boolean, asymbol **));
-
-@end example
-@*
diff --git a/contrib/binutils/bfd/doc/bfd.texinfo b/contrib/binutils/bfd/doc/bfd.texinfo
deleted file mode 100644
index 3ed4194..0000000
--- a/contrib/binutils/bfd/doc/bfd.texinfo
+++ /dev/null
@@ -1,349 +0,0 @@
-\input texinfo.tex
-@setfilename bfd.info
-@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, 2003
-@c Free Software Foundation, Inc.
-@c
-@tex
-% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE
-\global\long\def\example{%
-\begingroup
-\let\aboveenvbreak=\par
-\let\afterenvbreak=\par
-\parskip=0pt
-\lisp}
-\global\long\def\Eexample{%
-\Elisp
-\endgroup
-\vskip -\parskip% to cancel out effect of following \par
-}
-@end tex
-@synindex fn cp
-
-@ifinfo
-@format
-START-INFO-DIR-ENTRY
-* Bfd: (bfd). The Binary File Descriptor library.
-END-INFO-DIR-ENTRY
-@end format
-@end ifinfo
-
-@ifinfo
-This file documents the BFD library.
-
-Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc.
-
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, with no Front-Cover Texts, and with no
- Back-Cover Texts. A copy of the license is included in the
- section entitled ``GNU Free Documentation License''.
-
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
-@end ignore
-@end ifinfo
-@iftex
-@c@finalout
-@setchapternewpage on
-@c@setchapternewpage odd
-@settitle LIB BFD, the Binary File Descriptor Library
-@titlepage
-@title{libbfd}
-@subtitle{The Binary File Descriptor Library}
-@sp 1
-@subtitle First Edition---BFD version < 3.0 % Since no product is stable berfore version 3.0 :-)
-@subtitle Original Document Created: April 1991
-@author {Steve Chamberlain}
-@author {Cygnus Support}
-@page
-
-@tex
-\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
-\xdef\manvers{1.5} % For use in headers, footers too
-{\parskip=0pt
-\hfill Free Software Foundation\par
-\hfill sac\@www.gnu.org\par
-\hfill {\it BFD}, \manvers\par
-\hfill \TeX{}info \texinfoversion\par
-}
-\global\parindent=0pt % Steve likes it this way
-@end tex
-
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc.
-
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, with no Front-Cover Texts, and with no
- Back-Cover Texts. A copy of the license is included in the
- section entitled ``GNU Free Documentation License''.
-
-@end titlepage
-@end iftex
-
-@node Top, Overview, (dir), (dir)
-@ifinfo
-This file documents the binary file descriptor library libbfd.
-@end ifinfo
-
-@menu
-* Overview:: Overview of BFD
-* BFD front end:: BFD front end
-* BFD back ends:: BFD back ends
-* GNU Free Documentation License:: GNU Free Documentation License
-* Index:: Index
-@end menu
-
-@node Overview, BFD front end, Top, Top
-@chapter Introduction
-@cindex BFD
-@cindex what is it?
-BFD is a package which allows applications to use the
-same routines to operate on object files whatever the object file
-format. A new object file format can be supported simply by
-creating a new BFD back end and adding it to the library.
-
-BFD is split into two parts: the front end, and the back ends (one for
-each object file format).
-@itemize @bullet
-@item The front end of BFD provides the interface to the user. It manages
-memory and various canonical data structures. The front end also
-decides which back end to use and when to call back end routines.
-@item The back ends provide BFD its view of the real world. Each back
-end provides a set of calls which the BFD front end can use to maintain
-its canonical form. The back ends also may keep around information for
-their own use, for greater efficiency.
-@end itemize
-@menu
-* History:: History
-* How It Works:: How It Works
-* What BFD Version 2 Can Do:: What BFD Version 2 Can Do
-@end menu
-
-@node History, How It Works, Overview, Overview
-@section History
-
-One spur behind BFD was the desire, on the part of the GNU 960 team at
-Intel Oregon, for interoperability of applications on their COFF and
-b.out file formats. Cygnus was providing GNU support for the team, and
-was contracted to provide the required functionality.
-
-The name came from a conversation David Wallace was having with Richard
-Stallman about the library: RMS said that it would be quite hard---David
-said ``BFD''. Stallman was right, but the name stuck.
-
-At the same time, Ready Systems wanted much the same thing, but for
-different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k
-coff.
-
-BFD was first implemented by members of Cygnus Support; Steve
-Chamberlain (@code{sac@@cygnus.com}), John Gilmore
-(@code{gnu@@cygnus.com}), K. Richard Pixley (@code{rich@@cygnus.com})
-and David Henkel-Wallace (@code{gumby@@cygnus.com}).
-
-
-
-@node How It Works, What BFD Version 2 Can Do, History, Overview
-@section How To Use BFD
-
-To use the library, include @file{bfd.h} and link with @file{libbfd.a}.
-
-BFD provides a common interface to the parts of an object file
-for a calling application.
-
-When an application sucessfully opens a target file (object, archive, or
-whatever), a pointer to an internal structure is returned. This pointer
-points to a structure called @code{bfd}, described in
-@file{bfd.h}. Our convention is to call this pointer a BFD, and
-instances of it within code @code{abfd}. All operations on
-the target object file are applied as methods to the BFD. The mapping is
-defined within @code{bfd.h} in a set of macros, all beginning
-with @samp{bfd_} to reduce namespace pollution.
-
-For example, this sequence does what you would probably expect:
-return the number of sections in an object file attached to a BFD
-@code{abfd}.
-
-@example
-@c @cartouche
-#include "bfd.h"
-
-unsigned int number_of_sections (abfd)
-bfd *abfd;
-@{
- return bfd_count_sections (abfd);
-@}
-@c @end cartouche
-@end example
-
-The abstraction used within BFD is that an object file has:
-
-@itemize @bullet
-@item
-a header,
-@item
-a number of sections containing raw data (@pxref{Sections}),
-@item
-a set of relocations (@pxref{Relocations}), and
-@item
-some symbol information (@pxref{Symbols}).
-@end itemize
-@noindent
-Also, BFDs opened for archives have the additional attribute of an index
-and contain subordinate BFDs. This approach is fine for a.out and coff,
-but loses efficiency when applied to formats such as S-records and
-IEEE-695.
-
-@node What BFD Version 2 Can Do, , How It Works, Overview
-@section What BFD Version 2 Can Do
-@include bfdsumm.texi
-
-@node BFD front end, BFD back ends, Overview, Top
-@chapter BFD Front End
-@include bfdt.texi
-@include bfdio.texi
-
-@menu
-* Memory Usage::
-* Initialization::
-* Sections::
-* Symbols::
-* Archives::
-* Formats::
-* Relocations::
-* Core Files::
-* Targets::
-* Architectures::
-* Opening and Closing::
-* Internal::
-* File Caching::
-* Linker Functions::
-* Hash Tables::
-@end menu
-
-@node Memory Usage, Initialization, BFD front end, BFD front end
-@section Memory Usage
-BFD keeps all of its internal structures in obstacks. There is one obstack
-per open BFD file, into which the current state is stored. When a BFD is
-closed, the obstack is deleted, and so everything which has been
-allocated by BFD for the closing file is thrown away.
-
-BFD does not free anything created by an application, but pointers into
-@code{bfd} structures become invalid on a @code{bfd_close}; for example,
-after a @code{bfd_close} the vector passed to
-@code{bfd_canonicalize_symtab} is still around, since it has been
-allocated by the application, but the data that it pointed to are
-lost.
-
-The general rule is to not close a BFD until all operations dependent
-upon data from the BFD have been completed, or all the data from within
-the file has been copied. To help with the management of memory, there
-is a function (@code{bfd_alloc_size}) which returns the number of bytes
-in obstacks associated with the supplied BFD. This could be used to
-select the greediest open BFD, close it to reclaim the memory, perform
-some operation and reopen the BFD again, to get a fresh copy of the data
-structures.
-
-@node Initialization, Sections, Memory Usage, BFD front end
-@include init.texi
-
-@node Sections, Symbols, Initialization, BFD front end
-@include section.texi
-
-@node Symbols, Archives, Sections, BFD front end
-@include syms.texi
-
-@node Archives, Formats, Symbols, BFD front end
-@include archive.texi
-
-@node Formats, Relocations, Archives, BFD front end
-@include format.texi
-
-@node Relocations, Core Files, Formats, BFD front end
-@include reloc.texi
-
-@node Core Files, Targets, Relocations, BFD front end
-@include core.texi
-
-@node Targets, Architectures, Core Files, BFD front end
-@include targets.texi
-
-@node Architectures, Opening and Closing, Targets, BFD front end
-@include archures.texi
-
-@node Opening and Closing, Internal, Architectures, BFD front end
-@include opncls.texi
-
-@node Internal, File Caching, Opening and Closing, BFD front end
-@include libbfd.texi
-
-@node File Caching, Linker Functions, Internal, BFD front end
-@include cache.texi
-
-@node Linker Functions, Hash Tables, File Caching, BFD front end
-@include linker.texi
-
-@node Hash Tables, , Linker Functions, BFD front end
-@include hash.texi
-
-@node BFD back ends, GNU Free Documentation License, BFD front end, Top
-@chapter BFD back ends
-@menu
-* What to Put Where::
-* aout :: a.out backends
-* coff :: coff backends
-* elf :: elf backends
-* mmo :: mmo backend
-@ignore
-* oasys :: oasys backends
-* ieee :: ieee backend
-* srecord :: s-record backend
-@end ignore
-@end menu
-@node What to Put Where, aout, BFD back ends, BFD back ends
-All of BFD lives in one directory.
-
-@node aout, coff, What to Put Where, BFD back ends
-@include aoutx.texi
-
-@node coff, elf, aout, BFD back ends
-@include coffcode.texi
-
-@node elf, mmo, coff, BFD back ends
-@include elf.texi
-@c Leave this out until the file has some actual contents...
-@c @include elfcode.texi
-
-@node mmo, , elf, BFD back ends
-@include mmo.texi
-
-@node GNU Free Documentation License, Index, BFD back ends, Top
-@include fdl.texi
-
-@node Index, , GNU Free Documentation License, Top
-@unnumbered Index
-@printindex cp
-
-@tex
-% I think something like @colophon should be in texinfo. In the
-% meantime:
-\long\def\colophon{\hbox to0pt{}\vfill
-\centerline{The body of this manual is set in}
-\centerline{\fontname\tenrm,}
-\centerline{with headings in {\bf\fontname\tenbf}}
-\centerline{and examples in {\tt\fontname\tentt}.}
-\centerline{{\it\fontname\tenit\/} and}
-\centerline{{\sl\fontname\tensl\/}}
-\centerline{are used for emphasis.}\vfill}
-\page\colophon
-% Blame: doc@cygnus.com, 28mar91.
-@end tex
-
-@contents
-@bye
diff --git a/contrib/binutils/bfd/doc/bfdint.texi b/contrib/binutils/bfd/doc/bfdint.texi
deleted file mode 100644
index 95c0096..0000000
--- a/contrib/binutils/bfd/doc/bfdint.texi
+++ /dev/null
@@ -1,1890 +0,0 @@
-\input texinfo
-@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-@c 2000, 2001, 2002, 2003
-@c Free Software Foundation, Inc.
-@setfilename bfdint.info
-
-@settitle BFD Internals
-@iftex
-@titlepage
-@title{BFD Internals}
-@author{Ian Lance Taylor}
-@author{Cygnus Solutions}
-@page
-@end iftex
-
-@node Top
-@top BFD Internals
-@raisesections
-@cindex bfd internals
-
-This document describes some BFD internal information which may be
-helpful when working on BFD. It is very incomplete.
-
-This document is not updated regularly, and may be out of date.
-
-The initial version of this document was written by Ian Lance Taylor
-@email{ian@@cygnus.com}.
-
-@menu
-* BFD overview:: BFD overview
-* BFD guidelines:: BFD programming guidelines
-* BFD target vector:: BFD target vector
-* BFD generated files:: BFD generated files
-* BFD multiple compilations:: Files compiled multiple times in BFD
-* BFD relocation handling:: BFD relocation handling
-* BFD ELF support:: BFD ELF support
-* BFD glossary:: Glossary
-* Index:: Index
-@end menu
-
-@node BFD overview
-@section BFD overview
-
-BFD is a library which provides a single interface to read and write
-object files, executables, archive files, and core files in any format.
-
-@menu
-* BFD library interfaces:: BFD library interfaces
-* BFD library users:: BFD library users
-* BFD view:: The BFD view of a file
-* BFD blindness:: BFD loses information
-@end menu
-
-@node BFD library interfaces
-@subsection BFD library interfaces
-
-One way to look at the BFD library is to divide it into four parts by
-type of interface.
-
-The first interface is the set of generic functions which programs using
-the BFD library will call. These generic function normally translate
-directly or indirectly into calls to routines which are specific to a
-particular object file format. Many of these generic functions are
-actually defined as macros in @file{bfd.h}. These functions comprise
-the official BFD interface.
-
-The second interface is the set of functions which appear in the target
-vectors. This is the bulk of the code in BFD. A target vector is a set
-of function pointers specific to a particular object file format. The
-target vector is used to implement the generic BFD functions. These
-functions are always called through the target vector, and are never
-called directly. The target vector is described in detail in @ref{BFD
-target vector}. The set of functions which appear in a particular
-target vector is often referred to as a BFD backend.
-
-The third interface is a set of oddball functions which are typically
-specific to a particular object file format, are not generic functions,
-and are called from outside of the BFD library. These are used as hooks
-by the linker and the assembler when a particular object file format
-requires some action which the BFD generic interface does not provide.
-These functions are typically declared in @file{bfd.h}, but in many
-cases they are only provided when BFD is configured with support for a
-particular object file format. These functions live in a grey area, and
-are not really part of the official BFD interface.
-
-The fourth interface is the set of BFD support functions which are
-called by the other BFD functions. These manage issues like memory
-allocation, error handling, file access, hash tables, swapping, and the
-like. These functions are never called from outside of the BFD library.
-
-@node BFD library users
-@subsection BFD library users
-
-Another way to look at the BFD library is to divide it into three parts
-by the manner in which it is used.
-
-The first use is to read an object file. The object file readers are
-programs like @samp{gdb}, @samp{nm}, @samp{objdump}, and @samp{objcopy}.
-These programs use BFD to view an object file in a generic form. The
-official BFD interface is normally fully adequate for these programs.
-
-The second use is to write an object file. The object file writers are
-programs like @samp{gas} and @samp{objcopy}. These programs use BFD to
-create an object file. The official BFD interface is normally adequate
-for these programs, but for some object file formats the assembler needs
-some additional hooks in order to set particular flags or other
-information. The official BFD interface includes functions to copy
-private information from one object file to another, and these functions
-are used by @samp{objcopy} to avoid information loss.
-
-The third use is to link object files. There is only one object file
-linker, @samp{ld}. Originally, @samp{ld} was an object file reader and
-an object file writer, and it did the link operation using the generic
-BFD structures. However, this turned out to be too slow and too memory
-intensive.
-
-The official BFD linker functions were written to permit specific BFD
-backends to perform the link without translating through the generic
-structures, in the normal case where all the input files and output file
-have the same object file format. Not all of the backends currently
-implement the new interface, and there are default linking functions
-within BFD which use the generic structures and which work with all
-backends.
-
-For several object file formats the linker needs additional hooks which
-are not provided by the official BFD interface, particularly for dynamic
-linking support. These functions are typically called from the linker
-emulation template.
-
-@node BFD view
-@subsection The BFD view of a file
-
-BFD uses generic structures to manage information. It translates data
-into the generic form when reading files, and out of the generic form
-when writing files.
-
-BFD describes a file as a pointer to the @samp{bfd} type. A @samp{bfd}
-is composed of the following elements. The BFD information can be
-displayed using the @samp{objdump} program with various options.
-
-@table @asis
-@item general information
-The object file format, a few general flags, the start address.
-@item architecture
-The architecture, including both a general processor type (m68k, MIPS
-etc.) and a specific machine number (m68000, R4000, etc.).
-@item sections
-A list of sections.
-@item symbols
-A symbol table.
-@end table
-
-BFD represents a section as a pointer to the @samp{asection} type. Each
-section has a name and a size. Most sections also have an associated
-block of data, known as the section contents. Sections also have
-associated flags, a virtual memory address, a load memory address, a
-required alignment, a list of relocations, and other miscellaneous
-information.
-
-BFD represents a relocation as a pointer to the @samp{arelent} type. A
-relocation describes an action which the linker must take to modify the
-section contents. Relocations have a symbol, an address, an addend, and
-a pointer to a howto structure which describes how to perform the
-relocation. For more information, see @ref{BFD relocation handling}.
-
-BFD represents a symbol as a pointer to the @samp{asymbol} type. A
-symbol has a name, a pointer to a section, an offset within that
-section, and some flags.
-
-Archive files do not have any sections or symbols. Instead, BFD
-represents an archive file as a file which contains a list of
-@samp{bfd}s. BFD also provides access to the archive symbol map, as a
-list of symbol names. BFD provides a function to return the @samp{bfd}
-within the archive which corresponds to a particular entry in the
-archive symbol map.
-
-@node BFD blindness
-@subsection BFD loses information
-
-Most object file formats have information which BFD can not represent in
-its generic form, at least as currently defined.
-
-There is often explicit information which BFD can not represent. For
-example, the COFF version stamp, or the ELF program segments. BFD
-provides special hooks to handle this information when copying,
-printing, or linking an object file. The BFD support for a particular
-object file format will normally store this information in private data
-and handle it using the special hooks.
-
-In some cases there is also implicit information which BFD can not
-represent. For example, the MIPS processor distinguishes small and
-large symbols, and requires that all small symbls be within 32K of the
-GP register. This means that the MIPS assembler must be able to mark
-variables as either small or large, and the MIPS linker must know to put
-small symbols within range of the GP register. Since BFD can not
-represent this information, this means that the assembler and linker
-must have information that is specific to a particular object file
-format which is outside of the BFD library.
-
-This loss of information indicates areas where the BFD paradigm breaks
-down. It is not actually possible to represent the myriad differences
-among object file formats using a single generic interface, at least not
-in the manner which BFD does it today.
-
-Nevertheless, the BFD library does greatly simplify the task of dealing
-with object files, and particular problems caused by information loss
-can normally be solved using some sort of relatively constrained hook
-into the library.
-
-
-
-@node BFD guidelines
-@section BFD programming guidelines
-@cindex bfd programming guidelines
-@cindex programming guidelines for bfd
-@cindex guidelines, bfd programming
-
-There is a lot of poorly written and confusing code in BFD. New BFD
-code should be written to a higher standard. Merely because some BFD
-code is written in a particular manner does not mean that you should
-emulate it.
-
-Here are some general BFD programming guidelines:
-
-@itemize @bullet
-@item
-Follow the GNU coding standards.
-
-@item
-Avoid global variables. We ideally want BFD to be fully reentrant, so
-that it can be used in multiple threads. All uses of global or static
-variables interfere with that. Initialized constant variables are OK,
-and they should be explicitly marked with const. Instead of global
-variables, use data attached to a BFD or to a linker hash table.
-
-@item
-All externally visible functions should have names which start with
-@samp{bfd_}. All such functions should be declared in some header file,
-typically @file{bfd.h}. See, for example, the various declarations near
-the end of @file{bfd-in.h}, which mostly declare functions required by
-specific linker emulations.
-
-@item
-All functions which need to be visible from one file to another within
-BFD, but should not be visible outside of BFD, should start with
-@samp{_bfd_}. Although external names beginning with @samp{_} are
-prohibited by the ANSI standard, in practice this usage will always
-work, and it is required by the GNU coding standards.
-
-@item
-Always remember that people can compile using @samp{--enable-targets} to
-build several, or all, targets at once. It must be possible to link
-together the files for all targets.
-
-@item
-BFD code should compile with few or no warnings using @samp{gcc -Wall}.
-Some warnings are OK, like the absence of certain function declarations
-which may or may not be declared in system header files. Warnings about
-ambiguous expressions and the like should always be fixed.
-@end itemize
-
-@node BFD target vector
-@section BFD target vector
-@cindex bfd target vector
-@cindex target vector in bfd
-
-BFD supports multiple object file formats by using the @dfn{target
-vector}. This is simply a set of function pointers which implement
-behaviour that is specific to a particular object file format.
-
-In this section I list all of the entries in the target vector and
-describe what they do.
-
-@menu
-* BFD target vector miscellaneous:: Miscellaneous constants
-* BFD target vector swap:: Swapping functions
-* BFD target vector format:: Format type dependent functions
-* BFD_JUMP_TABLE macros:: BFD_JUMP_TABLE macros
-* BFD target vector generic:: Generic functions
-* BFD target vector copy:: Copy functions
-* BFD target vector core:: Core file support functions
-* BFD target vector archive:: Archive functions
-* BFD target vector symbols:: Symbol table functions
-* BFD target vector relocs:: Relocation support
-* BFD target vector write:: Output functions
-* BFD target vector link:: Linker functions
-* BFD target vector dynamic:: Dynamic linking information functions
-@end menu
-
-@node BFD target vector miscellaneous
-@subsection Miscellaneous constants
-
-The target vector starts with a set of constants.
-
-@table @samp
-@item name
-The name of the target vector. This is an arbitrary string. This is
-how the target vector is named in command line options for tools which
-use BFD, such as the @samp{--oformat} linker option.
-
-@item flavour
-A general description of the type of target. The following flavours are
-currently defined:
-
-@table @samp
-@item bfd_target_unknown_flavour
-Undefined or unknown.
-@item bfd_target_aout_flavour
-a.out.
-@item bfd_target_coff_flavour
-COFF.
-@item bfd_target_ecoff_flavour
-ECOFF.
-@item bfd_target_elf_flavour
-ELF.
-@item bfd_target_ieee_flavour
-IEEE-695.
-@item bfd_target_nlm_flavour
-NLM.
-@item bfd_target_oasys_flavour
-OASYS.
-@item bfd_target_tekhex_flavour
-Tektronix hex format.
-@item bfd_target_srec_flavour
-Motorola S-record format.
-@item bfd_target_ihex_flavour
-Intel hex format.
-@item bfd_target_som_flavour
-SOM (used on HP/UX).
-@item bfd_target_os9k_flavour
-os9000.
-@item bfd_target_versados_flavour
-VERSAdos.
-@item bfd_target_msdos_flavour
-MS-DOS.
-@item bfd_target_evax_flavour
-openVMS.
-@item bfd_target_mmo_flavour
-Donald Knuth's MMIXware object format.
-@end table
-
-@item byteorder
-The byte order of data in the object file. One of
-@samp{BFD_ENDIAN_BIG}, @samp{BFD_ENDIAN_LITTLE}, or
-@samp{BFD_ENDIAN_UNKNOWN}. The latter would be used for a format such
-as S-records which do not record the architecture of the data.
-
-@item header_byteorder
-The byte order of header information in the object file. Normally the
-same as the @samp{byteorder} field, but there are certain cases where it
-may be different.
-
-@item object_flags
-Flags which may appear in the @samp{flags} field of a BFD with this
-format.
-
-@item section_flags
-Flags which may appear in the @samp{flags} field of a section within a
-BFD with this format.
-
-@item symbol_leading_char
-A character which the C compiler normally puts before a symbol. For
-example, an a.out compiler will typically generate the symbol
-@samp{_foo} for a function named @samp{foo} in the C source, in which
-case this field would be @samp{_}. If there is no such character, this
-field will be @samp{0}.
-
-@item ar_pad_char
-The padding character to use at the end of an archive name. Normally
-@samp{/}.
-
-@item ar_max_namelen
-The maximum length of a short name in an archive. Normally @samp{14}.
-
-@item backend_data
-A pointer to constant backend data. This is used by backends to store
-whatever additional information they need to distinguish similar target
-vectors which use the same sets of functions.
-@end table
-
-@node BFD target vector swap
-@subsection Swapping functions
-
-Every target vector has function pointers used for swapping information
-in and out of the target representation. There are two sets of
-functions: one for data information, and one for header information.
-Each set has three sizes: 64-bit, 32-bit, and 16-bit. Each size has
-three actual functions: put, get unsigned, and get signed.
-
-These 18 functions are used to convert data between the host and target
-representations.
-
-@node BFD target vector format
-@subsection Format type dependent functions
-
-Every target vector has three arrays of function pointers which are
-indexed by the BFD format type. The BFD format types are as follows:
-
-@table @samp
-@item bfd_unknown
-Unknown format. Not used for anything useful.
-@item bfd_object
-Object file.
-@item bfd_archive
-Archive file.
-@item bfd_core
-Core file.
-@end table
-
-The three arrays of function pointers are as follows:
-
-@table @samp
-@item bfd_check_format
-Check whether the BFD is of a particular format (object file, archive
-file, or core file) corresponding to this target vector. This is called
-by the @samp{bfd_check_format} function when examining an existing BFD.
-If the BFD matches the desired format, this function will initialize any
-format specific information such as the @samp{tdata} field of the BFD.
-This function must be called before any other BFD target vector function
-on a file opened for reading.
-
-@item bfd_set_format
-Set the format of a BFD which was created for output. This is called by
-the @samp{bfd_set_format} function after creating the BFD with a
-function such as @samp{bfd_openw}. This function will initialize format
-specific information required to write out an object file or whatever of
-the given format. This function must be called before any other BFD
-target vector function on a file opened for writing.
-
-@item bfd_write_contents
-Write out the contents of the BFD in the given format. This is called
-by @samp{bfd_close} function for a BFD opened for writing. This really
-should not be an array selected by format type, as the
-@samp{bfd_set_format} function provides all the required information.
-In fact, BFD will fail if a different format is used when calling
-through the @samp{bfd_set_format} and the @samp{bfd_write_contents}
-arrays; fortunately, since @samp{bfd_close} gets it right, this is a
-difficult error to make.
-@end table
-
-@node BFD_JUMP_TABLE macros
-@subsection @samp{BFD_JUMP_TABLE} macros
-@cindex @samp{BFD_JUMP_TABLE}
-
-Most target vectors are defined using @samp{BFD_JUMP_TABLE} macros.
-These macros take a single argument, which is a prefix applied to a set
-of functions. The macros are then used to initialize the fields in the
-target vector.
-
-For example, the @samp{BFD_JUMP_TABLE_RELOCS} macro defines three
-functions: @samp{_get_reloc_upper_bound}, @samp{_canonicalize_reloc},
-and @samp{_bfd_reloc_type_lookup}. A reference like
-@samp{BFD_JUMP_TABLE_RELOCS (foo)} will expand into three functions
-prefixed with @samp{foo}: @samp{foo_get_reloc_upper_bound}, etc. The
-@samp{BFD_JUMP_TABLE_RELOCS} macro will be placed such that those three
-functions initialize the appropriate fields in the BFD target vector.
-
-This is done because it turns out that many different target vectors can
-share certain classes of functions. For example, archives are similar
-on most platforms, so most target vectors can use the same archive
-functions. Those target vectors all use @samp{BFD_JUMP_TABLE_ARCHIVE}
-with the same argument, calling a set of functions which is defined in
-@file{archive.c}.
-
-Each of the @samp{BFD_JUMP_TABLE} macros is mentioned below along with
-the description of the function pointers which it defines. The function
-pointers will be described using the name without the prefix which the
-@samp{BFD_JUMP_TABLE} macro defines. This name is normally the same as
-the name of the field in the target vector structure. Any differences
-will be noted.
-
-@node BFD target vector generic
-@subsection Generic functions
-@cindex @samp{BFD_JUMP_TABLE_GENERIC}
-
-The @samp{BFD_JUMP_TABLE_GENERIC} macro is used for some catch all
-functions which don't easily fit into other categories.
-
-@table @samp
-@item _close_and_cleanup
-Free any target specific information associated with the BFD. This is
-called when any BFD is closed (the @samp{bfd_write_contents} function
-mentioned earlier is only called for a BFD opened for writing). Most
-targets use @samp{bfd_alloc} to allocate all target specific
-information, and therefore don't have to do anything in this function.
-This function pointer is typically set to
-@samp{_bfd_generic_close_and_cleanup}, which simply returns true.
-
-@item _bfd_free_cached_info
-Free any cached information associated with the BFD which can be
-recreated later if necessary. This is used to reduce the memory
-consumption required by programs using BFD. This is normally called via
-the @samp{bfd_free_cached_info} macro. It is used by the default
-archive routines when computing the archive map. Most targets do not
-do anything special for this entry point, and just set it to
-@samp{_bfd_generic_free_cached_info}, which simply returns true.
-
-@item _new_section_hook
-This is called from @samp{bfd_make_section_anyway} whenever a new
-section is created. Most targets use it to initialize section specific
-information. This function is called whether or not the section
-corresponds to an actual section in an actual BFD.
-
-@item _get_section_contents
-Get the contents of a section. This is called from
-@samp{bfd_get_section_contents}. Most targets set this to
-@samp{_bfd_generic_get_section_contents}, which does a @samp{bfd_seek}
-based on the section's @samp{filepos} field and a @samp{bfd_bread}. The
-corresponding field in the target vector is named
-@samp{_bfd_get_section_contents}.
-
-@item _get_section_contents_in_window
-Set a @samp{bfd_window} to hold the contents of a section. This is
-called from @samp{bfd_get_section_contents_in_window}. The
-@samp{bfd_window} idea never really caught on, and I don't think this is
-ever called. Pretty much all targets implement this as
-@samp{bfd_generic_get_section_contents_in_window}, which uses
-@samp{bfd_get_section_contents} to do the right thing. The
-corresponding field in the target vector is named
-@samp{_bfd_get_section_contents_in_window}.
-@end table
-
-@node BFD target vector copy
-@subsection Copy functions
-@cindex @samp{BFD_JUMP_TABLE_COPY}
-
-The @samp{BFD_JUMP_TABLE_COPY} macro is used for functions which are
-called when copying BFDs, and for a couple of functions which deal with
-internal BFD information.
-
-@table @samp
-@item _bfd_copy_private_bfd_data
-This is called when copying a BFD, via @samp{bfd_copy_private_bfd_data}.
-If the input and output BFDs have the same format, this will copy any
-private information over. This is called after all the section contents
-have been written to the output file. Only a few targets do anything in
-this function.
-
-@item _bfd_merge_private_bfd_data
-This is called when linking, via @samp{bfd_merge_private_bfd_data}. It
-gives the backend linker code a chance to set any special flags in the
-output file based on the contents of the input file. Only a few targets
-do anything in this function.
-
-@item _bfd_copy_private_section_data
-This is similar to @samp{_bfd_copy_private_bfd_data}, but it is called
-for each section, via @samp{bfd_copy_private_section_data}. This
-function is called before any section contents have been written. Only
-a few targets do anything in this function.
-
-@item _bfd_copy_private_symbol_data
-This is called via @samp{bfd_copy_private_symbol_data}, but I don't
-think anything actually calls it. If it were defined, it could be used
-to copy private symbol data from one BFD to another. However, most BFDs
-store extra symbol information by allocating space which is larger than
-the @samp{asymbol} structure and storing private information in the
-extra space. Since @samp{objcopy} and other programs copy symbol
-information by copying pointers to @samp{asymbol} structures, the
-private symbol information is automatically copied as well. Most
-targets do not do anything in this function.
-
-@item _bfd_set_private_flags
-This is called via @samp{bfd_set_private_flags}. It is basically a hook
-for the assembler to set magic information. For example, the PowerPC
-ELF assembler uses it to set flags which appear in the e_flags field of
-the ELF header. Most targets do not do anything in this function.
-
-@item _bfd_print_private_bfd_data
-This is called by @samp{objdump} when the @samp{-p} option is used. It
-is called via @samp{bfd_print_private_data}. It prints any interesting
-information about the BFD which can not be otherwise represented by BFD
-and thus can not be printed by @samp{objdump}. Most targets do not do
-anything in this function.
-@end table
-
-@node BFD target vector core
-@subsection Core file support functions
-@cindex @samp{BFD_JUMP_TABLE_CORE}
-
-The @samp{BFD_JUMP_TABLE_CORE} macro is used for functions which deal
-with core files. Obviously, these functions only do something
-interesting for targets which have core file support.
-
-@table @samp
-@item _core_file_failing_command
-Given a core file, this returns the command which was run to produce the
-core file.
-
-@item _core_file_failing_signal
-Given a core file, this returns the signal number which produced the
-core file.
-
-@item _core_file_matches_executable_p
-Given a core file and a BFD for an executable, this returns whether the
-core file was generated by the executable.
-@end table
-
-@node BFD target vector archive
-@subsection Archive functions
-@cindex @samp{BFD_JUMP_TABLE_ARCHIVE}
-
-The @samp{BFD_JUMP_TABLE_ARCHIVE} macro is used for functions which deal
-with archive files. Most targets use COFF style archive files
-(including ELF targets), and these use @samp{_bfd_archive_coff} as the
-argument to @samp{BFD_JUMP_TABLE_ARCHIVE}. Some targets use BSD/a.out
-style archives, and these use @samp{_bfd_archive_bsd}. (The main
-difference between BSD and COFF archives is the format of the archive
-symbol table). Targets with no archive support use
-@samp{_bfd_noarchive}. Finally, a few targets have unusual archive
-handling.
-
-@table @samp
-@item _slurp_armap
-Read in the archive symbol table, storing it in private BFD data. This
-is normally called from the archive @samp{check_format} routine. The
-corresponding field in the target vector is named
-@samp{_bfd_slurp_armap}.
-
-@item _slurp_extended_name_table
-Read in the extended name table from the archive, if there is one,
-storing it in private BFD data. This is normally called from the
-archive @samp{check_format} routine. The corresponding field in the
-target vector is named @samp{_bfd_slurp_extended_name_table}.
-
-@item construct_extended_name_table
-Build and return an extended name table if one is needed to write out
-the archive. This also adjusts the archive headers to refer to the
-extended name table appropriately. This is normally called from the
-archive @samp{write_contents} routine. The corresponding field in the
-target vector is named @samp{_bfd_construct_extended_name_table}.
-
-@item _truncate_arname
-This copies a file name into an archive header, truncating it as
-required. It is normally called from the archive @samp{write_contents}
-routine. This function is more interesting in targets which do not
-support extended name tables, but I think the GNU @samp{ar} program
-always uses extended name tables anyhow. The corresponding field in the
-target vector is named @samp{_bfd_truncate_arname}.
-
-@item _write_armap
-Write out the archive symbol table using calls to @samp{bfd_bwrite}.
-This is normally called from the archive @samp{write_contents} routine.
-The corresponding field in the target vector is named @samp{write_armap}
-(no leading underscore).
-
-@item _read_ar_hdr
-Read and parse an archive header. This handles expanding the archive
-header name into the real file name using the extended name table. This
-is called by routines which read the archive symbol table or the archive
-itself. The corresponding field in the target vector is named
-@samp{_bfd_read_ar_hdr_fn}.
-
-@item _openr_next_archived_file
-Given an archive and a BFD representing a file stored within the
-archive, return a BFD for the next file in the archive. This is called
-via @samp{bfd_openr_next_archived_file}. The corresponding field in the
-target vector is named @samp{openr_next_archived_file} (no leading
-underscore).
-
-@item _get_elt_at_index
-Given an archive and an index, return a BFD for the file in the archive
-corresponding to that entry in the archive symbol table. This is called
-via @samp{bfd_get_elt_at_index}. The corresponding field in the target
-vector is named @samp{_bfd_get_elt_at_index}.
-
-@item _generic_stat_arch_elt
-Do a stat on an element of an archive, returning information read from
-the archive header (modification time, uid, gid, file mode, size). This
-is called via @samp{bfd_stat_arch_elt}. The corresponding field in the
-target vector is named @samp{_bfd_stat_arch_elt}.
-
-@item _update_armap_timestamp
-After the entire contents of an archive have been written out, update
-the timestamp of the archive symbol table to be newer than that of the
-file. This is required for a.out style archives. This is normally
-called by the archive @samp{write_contents} routine. The corresponding
-field in the target vector is named @samp{_bfd_update_armap_timestamp}.
-@end table
-
-@node BFD target vector symbols
-@subsection Symbol table functions
-@cindex @samp{BFD_JUMP_TABLE_SYMBOLS}
-
-The @samp{BFD_JUMP_TABLE_SYMBOLS} macro is used for functions which deal
-with symbols.
-
-@table @samp
-@item _get_symtab_upper_bound
-Return a sensible upper bound on the amount of memory which will be
-required to read the symbol table. In practice most targets return the
-amount of memory required to hold @samp{asymbol} pointers for all the
-symbols plus a trailing @samp{NULL} entry, and store the actual symbol
-information in BFD private data. This is called via
-@samp{bfd_get_symtab_upper_bound}. The corresponding field in the
-target vector is named @samp{_bfd_get_symtab_upper_bound}.
-
-@item _canonicalize_symtab
-Read in the symbol table. This is called via
-@samp{bfd_canonicalize_symtab}. The corresponding field in the target
-vector is named @samp{_bfd_canonicalize_symtab}.
-
-@item _make_empty_symbol
-Create an empty symbol for the BFD. This is needed because most targets
-store extra information with each symbol by allocating a structure
-larger than an @samp{asymbol} and storing the extra information at the
-end. This function will allocate the right amount of memory, and return
-what looks like a pointer to an empty @samp{asymbol}. This is called
-via @samp{bfd_make_empty_symbol}. The corresponding field in the target
-vector is named @samp{_bfd_make_empty_symbol}.
-
-@item _print_symbol
-Print information about the symbol. This is called via
-@samp{bfd_print_symbol}. One of the arguments indicates what sort of
-information should be printed:
-
-@table @samp
-@item bfd_print_symbol_name
-Just print the symbol name.
-@item bfd_print_symbol_more
-Print the symbol name and some interesting flags. I don't think
-anything actually uses this.
-@item bfd_print_symbol_all
-Print all information about the symbol. This is used by @samp{objdump}
-when run with the @samp{-t} option.
-@end table
-The corresponding field in the target vector is named
-@samp{_bfd_print_symbol}.
-
-@item _get_symbol_info
-Return a standard set of information about the symbol. This is called
-via @samp{bfd_symbol_info}. The corresponding field in the target
-vector is named @samp{_bfd_get_symbol_info}.
-
-@item _bfd_is_local_label_name
-Return whether the given string would normally represent the name of a
-local label. This is called via @samp{bfd_is_local_label} and
-@samp{bfd_is_local_label_name}. Local labels are normally discarded by
-the assembler. In the linker, this defines the difference between the
-@samp{-x} and @samp{-X} options.
-
-@item _get_lineno
-Return line number information for a symbol. This is only meaningful
-for a COFF target. This is called when writing out COFF line numbers.
-
-@item _find_nearest_line
-Given an address within a section, use the debugging information to find
-the matching file name, function name, and line number, if any. This is
-called via @samp{bfd_find_nearest_line}. The corresponding field in the
-target vector is named @samp{_bfd_find_nearest_line}.
-
-@item _bfd_make_debug_symbol
-Make a debugging symbol. This is only meaningful for a COFF target,
-where it simply returns a symbol which will be placed in the
-@samp{N_DEBUG} section when it is written out. This is called via
-@samp{bfd_make_debug_symbol}.
-
-@item _read_minisymbols
-Minisymbols are used to reduce the memory requirements of programs like
-@samp{nm}. A minisymbol is a cookie pointing to internal symbol
-information which the caller can use to extract complete symbol
-information. This permits BFD to not convert all the symbols into
-generic form, but to instead convert them one at a time. This is called
-via @samp{bfd_read_minisymbols}. Most targets do not implement this,
-and just use generic support which is based on using standard
-@samp{asymbol} structures.
-
-@item _minisymbol_to_symbol
-Convert a minisymbol to a standard @samp{asymbol}. This is called via
-@samp{bfd_minisymbol_to_symbol}.
-@end table
-
-@node BFD target vector relocs
-@subsection Relocation support
-@cindex @samp{BFD_JUMP_TABLE_RELOCS}
-
-The @samp{BFD_JUMP_TABLE_RELOCS} macro is used for functions which deal
-with relocations.
-
-@table @samp
-@item _get_reloc_upper_bound
-Return a sensible upper bound on the amount of memory which will be
-required to read the relocations for a section. In practice most
-targets return the amount of memory required to hold @samp{arelent}
-pointers for all the relocations plus a trailing @samp{NULL} entry, and
-store the actual relocation information in BFD private data. This is
-called via @samp{bfd_get_reloc_upper_bound}.
-
-@item _canonicalize_reloc
-Return the relocation information for a section. This is called via
-@samp{bfd_canonicalize_reloc}. The corresponding field in the target
-vector is named @samp{_bfd_canonicalize_reloc}.
-
-@item _bfd_reloc_type_lookup
-Given a relocation code, return the corresponding howto structure
-(@pxref{BFD relocation codes}). This is called via
-@samp{bfd_reloc_type_lookup}. The corresponding field in the target
-vector is named @samp{reloc_type_lookup}.
-@end table
-
-@node BFD target vector write
-@subsection Output functions
-@cindex @samp{BFD_JUMP_TABLE_WRITE}
-
-The @samp{BFD_JUMP_TABLE_WRITE} macro is used for functions which deal
-with writing out a BFD.
-
-@table @samp
-@item _set_arch_mach
-Set the architecture and machine number for a BFD. This is called via
-@samp{bfd_set_arch_mach}. Most targets implement this by calling
-@samp{bfd_default_set_arch_mach}. The corresponding field in the target
-vector is named @samp{_bfd_set_arch_mach}.
-
-@item _set_section_contents
-Write out the contents of a section. This is called via
-@samp{bfd_set_section_contents}. The corresponding field in the target
-vector is named @samp{_bfd_set_section_contents}.
-@end table
-
-@node BFD target vector link
-@subsection Linker functions
-@cindex @samp{BFD_JUMP_TABLE_LINK}
-
-The @samp{BFD_JUMP_TABLE_LINK} macro is used for functions called by the
-linker.
-
-@table @samp
-@item _sizeof_headers
-Return the size of the header information required for a BFD. This is
-used to implement the @samp{SIZEOF_HEADERS} linker script function. It
-is normally used to align the first section at an efficient position on
-the page. This is called via @samp{bfd_sizeof_headers}. The
-corresponding field in the target vector is named
-@samp{_bfd_sizeof_headers}.
-
-@item _bfd_get_relocated_section_contents
-Read the contents of a section and apply the relocation information.
-This handles both a final link and a relocatable link; in the latter
-case, it adjust the relocation information as well. This is called via
-@samp{bfd_get_relocated_section_contents}. Most targets implement it by
-calling @samp{bfd_generic_get_relocated_section_contents}.
-
-@item _bfd_relax_section
-Try to use relaxation to shrink the size of a section. This is called
-by the linker when the @samp{-relax} option is used. This is called via
-@samp{bfd_relax_section}. Most targets do not support any sort of
-relaxation.
-
-@item _bfd_link_hash_table_create
-Create the symbol hash table to use for the linker. This linker hook
-permits the backend to control the size and information of the elements
-in the linker symbol hash table. This is called via
-@samp{bfd_link_hash_table_create}.
-
-@item _bfd_link_add_symbols
-Given an object file or an archive, add all symbols into the linker
-symbol hash table. Use callbacks to the linker to include archive
-elements in the link. This is called via @samp{bfd_link_add_symbols}.
-
-@item _bfd_final_link
-Finish the linking process. The linker calls this hook after all of the
-input files have been read, when it is ready to finish the link and
-generate the output file. This is called via @samp{bfd_final_link}.
-
-@item _bfd_link_split_section
-I don't know what this is for. Nothing seems to call it. The only
-non-trivial definition is in @file{som.c}.
-@end table
-
-@node BFD target vector dynamic
-@subsection Dynamic linking information functions
-@cindex @samp{BFD_JUMP_TABLE_DYNAMIC}
-
-The @samp{BFD_JUMP_TABLE_DYNAMIC} macro is used for functions which read
-dynamic linking information.
-
-@table @samp
-@item _get_dynamic_symtab_upper_bound
-Return a sensible upper bound on the amount of memory which will be
-required to read the dynamic symbol table. In practice most targets
-return the amount of memory required to hold @samp{asymbol} pointers for
-all the symbols plus a trailing @samp{NULL} entry, and store the actual
-symbol information in BFD private data. This is called via
-@samp{bfd_get_dynamic_symtab_upper_bound}. The corresponding field in
-the target vector is named @samp{_bfd_get_dynamic_symtab_upper_bound}.
-
-@item _canonicalize_dynamic_symtab
-Read the dynamic symbol table. This is called via
-@samp{bfd_canonicalize_dynamic_symtab}. The corresponding field in the
-target vector is named @samp{_bfd_canonicalize_dynamic_symtab}.
-
-@item _get_dynamic_reloc_upper_bound
-Return a sensible upper bound on the amount of memory which will be
-required to read the dynamic relocations. In practice most targets
-return the amount of memory required to hold @samp{arelent} pointers for
-all the relocations plus a trailing @samp{NULL} entry, and store the
-actual relocation information in BFD private data. This is called via
-@samp{bfd_get_dynamic_reloc_upper_bound}. The corresponding field in
-the target vector is named @samp{_bfd_get_dynamic_reloc_upper_bound}.
-
-@item _canonicalize_dynamic_reloc
-Read the dynamic relocations. This is called via
-@samp{bfd_canonicalize_dynamic_reloc}. The corresponding field in the
-target vector is named @samp{_bfd_canonicalize_dynamic_reloc}.
-@end table
-
-@node BFD generated files
-@section BFD generated files
-@cindex generated files in bfd
-@cindex bfd generated files
-
-BFD contains several automatically generated files. This section
-describes them. Some files are created at configure time, when you
-configure BFD. Some files are created at make time, when you build
-BFD. Some files are automatically rebuilt at make time, but only if
-you configure with the @samp{--enable-maintainer-mode} option. Some
-files live in the object directory---the directory from which you run
-configure---and some live in the source directory. All files that live
-in the source directory are checked into the CVS repository.
-
-@table @file
-@item bfd.h
-@cindex @file{bfd.h}
-@cindex @file{bfd-in3.h}
-Lives in the object directory. Created at make time from
-@file{bfd-in2.h} via @file{bfd-in3.h}. @file{bfd-in3.h} is created at
-configure time from @file{bfd-in2.h}. There are automatic dependencies
-to rebuild @file{bfd-in3.h} and hence @file{bfd.h} if @file{bfd-in2.h}
-changes, so you can normally ignore @file{bfd-in3.h}, and just think
-about @file{bfd-in2.h} and @file{bfd.h}.
-
-@file{bfd.h} is built by replacing a few strings in @file{bfd-in2.h}.
-To see them, search for @samp{@@} in @file{bfd-in2.h}. They mainly
-control whether BFD is built for a 32 bit target or a 64 bit target.
-
-@item bfd-in2.h
-@cindex @file{bfd-in2.h}
-Lives in the source directory. Created from @file{bfd-in.h} and several
-other BFD source files. If you configure with the
-@samp{--enable-maintainer-mode} option, @file{bfd-in2.h} is rebuilt
-automatically when a source file changes.
-
-@item elf32-target.h
-@itemx elf64-target.h
-@cindex @file{elf32-target.h}
-@cindex @file{elf64-target.h}
-Live in the object directory. Created from @file{elfxx-target.h}.
-These files are versions of @file{elfxx-target.h} customized for either
-a 32 bit ELF target or a 64 bit ELF target.
-
-@item libbfd.h
-@cindex @file{libbfd.h}
-Lives in the source directory. Created from @file{libbfd-in.h} and
-several other BFD source files. If you configure with the
-@samp{--enable-maintainer-mode} option, @file{libbfd.h} is rebuilt
-automatically when a source file changes.
-
-@item libcoff.h
-@cindex @file{libcoff.h}
-Lives in the source directory. Created from @file{libcoff-in.h} and
-@file{coffcode.h}. If you configure with the
-@samp{--enable-maintainer-mode} option, @file{libcoff.h} is rebuilt
-automatically when a source file changes.
-
-@item targmatch.h
-@cindex @file{targmatch.h}
-Lives in the object directory. Created at make time from
-@file{config.bfd}. This file is used to map configuration triplets into
-BFD target vector variable names at run time.
-@end table
-
-@node BFD multiple compilations
-@section Files compiled multiple times in BFD
-Several files in BFD are compiled multiple times. By this I mean that
-there are header files which contain function definitions. These header
-files are included by other files, and thus the functions are compiled
-once per file which includes them.
-
-Preprocessor macros are used to control the compilation, so that each
-time the files are compiled the resulting functions are slightly
-different. Naturally, if they weren't different, there would be no
-reason to compile them multiple times.
-
-This is a not a particularly good programming technique, and future BFD
-work should avoid it.
-
-@itemize @bullet
-@item
-Since this technique is rarely used, even experienced C programmers find
-it confusing.
-
-@item
-It is difficult to debug programs which use BFD, since there is no way
-to describe which version of a particular function you are looking at.
-
-@item
-Programs which use BFD wind up incorporating two or more slightly
-different versions of the same function, which wastes space in the
-executable.
-
-@item
-This technique is never required nor is it especially efficient. It is
-always possible to use statically initialized structures holding
-function pointers and magic constants instead.
-@end itemize
-
-The following is a list of the files which are compiled multiple times.
-
-@table @file
-@item aout-target.h
-@cindex @file{aout-target.h}
-Describes a few functions and the target vector for a.out targets. This
-is used by individual a.out targets with different definitions of
-@samp{N_TXTADDR} and similar a.out macros.
-
-@item aoutf1.h
-@cindex @file{aoutf1.h}
-Implements standard SunOS a.out files. In principle it supports 64 bit
-a.out targets based on the preprocessor macro @samp{ARCH_SIZE}, but
-since all known a.out targets are 32 bits, this code may or may not
-work. This file is only included by a few other files, and it is
-difficult to justify its existence.
-
-@item aoutx.h
-@cindex @file{aoutx.h}
-Implements basic a.out support routines. This file can be compiled for
-either 32 or 64 bit support. Since all known a.out targets are 32 bits,
-the 64 bit support may or may not work. I believe the original
-intention was that this file would only be included by @samp{aout32.c}
-and @samp{aout64.c}, and that other a.out targets would simply refer to
-the functions it defined. Unfortunately, some other a.out targets
-started including it directly, leading to a somewhat confused state of
-affairs.
-
-@item coffcode.h
-@cindex @file{coffcode.h}
-Implements basic COFF support routines. This file is included by every
-COFF target. It implements code which handles COFF magic numbers as
-well as various hook functions called by the generic COFF functions in
-@file{coffgen.c}. This file is controlled by a number of different
-macros, and more are added regularly.
-
-@item coffswap.h
-@cindex @file{coffswap.h}
-Implements COFF swapping routines. This file is included by
-@file{coffcode.h}, and thus by every COFF target. It implements the
-routines which swap COFF structures between internal and external
-format. The main control for this file is the external structure
-definitions in the files in the @file{include/coff} directory. A COFF
-target file will include one of those files before including
-@file{coffcode.h} and thus @file{coffswap.h}. There are a few other
-macros which affect @file{coffswap.h} as well, mostly describing whether
-certain fields are present in the external structures.
-
-@item ecoffswap.h
-@cindex @file{ecoffswap.h}
-Implements ECOFF swapping routines. This is like @file{coffswap.h}, but
-for ECOFF. It is included by the ECOFF target files (of which there are
-only two). The control is the preprocessor macro @samp{ECOFF_32} or
-@samp{ECOFF_64}.
-
-@item elfcode.h
-@cindex @file{elfcode.h}
-Implements ELF functions that use external structure definitions. This
-file is included by two other files: @file{elf32.c} and @file{elf64.c}.
-It is controlled by the @samp{ARCH_SIZE} macro which is defined to be
-@samp{32} or @samp{64} before including it. The @samp{NAME} macro is
-used internally to give the functions different names for the two target
-sizes.
-
-@item elfcore.h
-@cindex @file{elfcore.h}
-Like @file{elfcode.h}, but for functions that are specific to ELF core
-files. This is included only by @file{elfcode.h}.
-
-@item elfxx-target.h
-@cindex @file{elfxx-target.h}
-This file is the source for the generated files @file{elf32-target.h}
-and @file{elf64-target.h}, one of which is included by every ELF target.
-It defines the ELF target vector.
-
-@item freebsd.h
-@cindex @file{freebsd.h}
-Presumably intended to be included by all FreeBSD targets, but in fact
-there is only one such target, @samp{i386-freebsd}. This defines a
-function used to set the right magic number for FreeBSD, as well as
-various macros, and includes @file{aout-target.h}.
-
-@item netbsd.h
-@cindex @file{netbsd.h}
-Like @file{freebsd.h}, except that there are several files which include
-it.
-
-@item nlm-target.h
-@cindex @file{nlm-target.h}
-Defines the target vector for a standard NLM target.
-
-@item nlmcode.h
-@cindex @file{nlmcode.h}
-Like @file{elfcode.h}, but for NLM targets. This is only included by
-@file{nlm32.c} and @file{nlm64.c}, both of which define the macro
-@samp{ARCH_SIZE} to an appropriate value. There are no 64 bit NLM
-targets anyhow, so this is sort of useless.
-
-@item nlmswap.h
-@cindex @file{nlmswap.h}
-Like @file{coffswap.h}, but for NLM targets. This is included by each
-NLM target, but I think it winds up compiling to the exact same code for
-every target, and as such is fairly useless.
-
-@item peicode.h
-@cindex @file{peicode.h}
-Provides swapping routines and other hooks for PE targets.
-@file{coffcode.h} will include this rather than @file{coffswap.h} for a
-PE target. This defines PE specific versions of the COFF swapping
-routines, and also defines some macros which control @file{coffcode.h}
-itself.
-@end table
-
-@node BFD relocation handling
-@section BFD relocation handling
-@cindex bfd relocation handling
-@cindex relocations in bfd
-
-The handling of relocations is one of the more confusing aspects of BFD.
-Relocation handling has been implemented in various different ways, all
-somewhat incompatible, none perfect.
-
-@menu
-* BFD relocation concepts:: BFD relocation concepts
-* BFD relocation functions:: BFD relocation functions
-* BFD relocation codes:: BFD relocation codes
-* BFD relocation future:: BFD relocation future
-@end menu
-
-@node BFD relocation concepts
-@subsection BFD relocation concepts
-
-A relocation is an action which the linker must take when linking. It
-describes a change to the contents of a section. The change is normally
-based on the final value of one or more symbols. Relocations are
-created by the assembler when it creates an object file.
-
-Most relocations are simple. A typical simple relocation is to set 32
-bits at a given offset in a section to the value of a symbol. This type
-of relocation would be generated for code like @code{int *p = &i;} where
-@samp{p} and @samp{i} are global variables. A relocation for the symbol
-@samp{i} would be generated such that the linker would initialize the
-area of memory which holds the value of @samp{p} to the value of the
-symbol @samp{i}.
-
-Slightly more complex relocations may include an addend, which is a
-constant to add to the symbol value before using it. In some cases a
-relocation will require adding the symbol value to the existing contents
-of the section in the object file. In others the relocation will simply
-replace the contents of the section with the symbol value. Some
-relocations are PC relative, so that the value to be stored in the
-section is the difference between the value of a symbol and the final
-address of the section contents.
-
-In general, relocations can be arbitrarily complex. For example,
-relocations used in dynamic linking systems often require the linker to
-allocate space in a different section and use the offset within that
-section as the value to store. In the IEEE object file format,
-relocations may involve arbitrary expressions.
-
-When doing a relocatable link, the linker may or may not have to do
-anything with a relocation, depending upon the definition of the
-relocation. Simple relocations generally do not require any special
-action.
-
-@node BFD relocation functions
-@subsection BFD relocation functions
-
-In BFD, each section has an array of @samp{arelent} structures. Each
-structure has a pointer to a symbol, an address within the section, an
-addend, and a pointer to a @samp{reloc_howto_struct} structure. The
-howto structure has a bunch of fields describing the reloc, including a
-type field. The type field is specific to the object file format
-backend; none of the generic code in BFD examines it.
-
-Originally, the function @samp{bfd_perform_relocation} was supposed to
-handle all relocations. In theory, many relocations would be simple
-enough to be described by the fields in the howto structure. For those
-that weren't, the howto structure included a @samp{special_function}
-field to use as an escape.
-
-While this seems plausible, a look at @samp{bfd_perform_relocation}
-shows that it failed. The function has odd special cases. Some of the
-fields in the howto structure, such as @samp{pcrel_offset}, were not
-adequately documented.
-
-The linker uses @samp{bfd_perform_relocation} to do all relocations when
-the input and output file have different formats (e.g., when generating
-S-records). The generic linker code, which is used by all targets which
-do not define their own special purpose linker, uses
-@samp{bfd_get_relocated_section_contents}, which for most targets turns
-into a call to @samp{bfd_generic_get_relocated_section_contents}, which
-calls @samp{bfd_perform_relocation}. So @samp{bfd_perform_relocation}
-is still widely used, which makes it difficult to change, since it is
-difficult to test all possible cases.
-
-The assembler used @samp{bfd_perform_relocation} for a while. This
-turned out to be the wrong thing to do, since
-@samp{bfd_perform_relocation} was written to handle relocations on an
-existing object file, while the assembler needed to create relocations
-in a new object file. The assembler was changed to use the new function
-@samp{bfd_install_relocation} instead, and @samp{bfd_install_relocation}
-was created as a copy of @samp{bfd_perform_relocation}.
-
-Unfortunately, the work did not progress any farther, so
-@samp{bfd_install_relocation} remains a simple copy of
-@samp{bfd_perform_relocation}, with all the odd special cases and
-confusing code. This again is difficult to change, because again any
-change can affect any assembler target, and so is difficult to test.
-
-The new linker, when using the same object file format for all input
-files and the output file, does not convert relocations into
-@samp{arelent} structures, so it can not use
-@samp{bfd_perform_relocation} at all. Instead, users of the new linker
-are expected to write a @samp{relocate_section} function which will
-handle relocations in a target specific fashion.
-
-There are two helper functions for target specific relocation:
-@samp{_bfd_final_link_relocate} and @samp{_bfd_relocate_contents}.
-These functions use a howto structure, but they @emph{do not} use the
-@samp{special_function} field. Since the functions are normally called
-from target specific code, the @samp{special_function} field adds
-little; any relocations which require special handling can be handled
-without calling those functions.
-
-So, if you want to add a new target, or add a new relocation to an
-existing target, you need to do the following:
-
-@itemize @bullet
-@item
-Make sure you clearly understand what the contents of the section should
-look like after assembly, after a relocatable link, and after a final
-link. Make sure you clearly understand the operations the linker must
-perform during a relocatable link and during a final link.
-
-@item
-Write a howto structure for the relocation. The howto structure is
-flexible enough to represent any relocation which should be handled by
-setting a contiguous bitfield in the destination to the value of a
-symbol, possibly with an addend, possibly adding the symbol value to the
-value already present in the destination.
-
-@item
-Change the assembler to generate your relocation. The assembler will
-call @samp{bfd_install_relocation}, so your howto structure has to be
-able to handle that. You may need to set the @samp{special_function}
-field to handle assembly correctly. Be careful to ensure that any code
-you write to handle the assembler will also work correctly when doing a
-relocatable link. For example, see @samp{bfd_elf_generic_reloc}.
-
-@item
-Test the assembler. Consider the cases of relocation against an
-undefined symbol, a common symbol, a symbol defined in the object file
-in the same section, and a symbol defined in the object file in a
-different section. These cases may not all be applicable for your
-reloc.
-
-@item
-If your target uses the new linker, which is recommended, add any
-required handling to the target specific relocation function. In simple
-cases this will just involve a call to @samp{_bfd_final_link_relocate}
-or @samp{_bfd_relocate_contents}, depending upon the definition of the
-relocation and whether the link is relocatable or not.
-
-@item
-Test the linker. Test the case of a final link. If the relocation can
-overflow, use a linker script to force an overflow and make sure the
-error is reported correctly. Test a relocatable link, whether the
-symbol is defined or undefined in the relocatable output. For both the
-final and relocatable link, test the case when the symbol is a common
-symbol, when the symbol looked like a common symbol but became a defined
-symbol, when the symbol is defined in a different object file, and when
-the symbol is defined in the same object file.
-
-@item
-In order for linking to another object file format, such as S-records,
-to work correctly, @samp{bfd_perform_relocation} has to do the right
-thing for the relocation. You may need to set the
-@samp{special_function} field to handle this correctly. Test this by
-doing a link in which the output object file format is S-records.
-
-@item
-Using the linker to generate relocatable output in a different object
-file format is impossible in the general case, so you generally don't
-have to worry about that. The GNU linker makes sure to stop that from
-happening when an input file in a different format has relocations.
-
-Linking input files of different object file formats together is quite
-unusual, but if you're really dedicated you may want to consider testing
-this case, both when the output object file format is the same as your
-format, and when it is different.
-@end itemize
-
-@node BFD relocation codes
-@subsection BFD relocation codes
-
-BFD has another way of describing relocations besides the howto
-structures described above: the enum @samp{bfd_reloc_code_real_type}.
-
-Every known relocation type can be described as a value in this
-enumeration. The enumeration contains many target specific relocations,
-but where two or more targets have the same relocation, a single code is
-used. For example, the single value @samp{BFD_RELOC_32} is used for all
-simple 32 bit relocation types.
-
-The main purpose of this relocation code is to give the assembler some
-mechanism to create @samp{arelent} structures. In order for the
-assembler to create an @samp{arelent} structure, it has to be able to
-obtain a howto structure. The function @samp{bfd_reloc_type_lookup},
-which simply calls the target vector entry point
-@samp{reloc_type_lookup}, takes a relocation code and returns a howto
-structure.
-
-The function @samp{bfd_get_reloc_code_name} returns the name of a
-relocation code. This is mainly used in error messages.
-
-Using both howto structures and relocation codes can be somewhat
-confusing. There are many processor specific relocation codes.
-However, the relocation is only fully defined by the howto structure.
-The same relocation code will map to different howto structures in
-different object file formats. For example, the addend handling may be
-different.
-
-Most of the relocation codes are not really general. The assembler can
-not use them without already understanding what sorts of relocations can
-be used for a particular target. It might be possible to replace the
-relocation codes with something simpler.
-
-@node BFD relocation future
-@subsection BFD relocation future
-
-Clearly the current BFD relocation support is in bad shape. A
-wholescale rewrite would be very difficult, because it would require
-thorough testing of every BFD target. So some sort of incremental
-change is required.
-
-My vague thoughts on this would involve defining a new, clearly defined,
-howto structure. Some mechanism would be used to determine which type
-of howto structure was being used by a particular format.
-
-The new howto structure would clearly define the relocation behaviour in
-the case of an assembly, a relocatable link, and a final link. At
-least one special function would be defined as an escape, and it might
-make sense to define more.
-
-One or more generic functions similar to @samp{bfd_perform_relocation}
-would be written to handle the new howto structure.
-
-This should make it possible to write a generic version of the relocate
-section functions used by the new linker. The target specific code
-would provide some mechanism (a function pointer or an initial
-conversion) to convert target specific relocations into howto
-structures.
-
-Ideally it would be possible to use this generic relocate section
-function for the generic linker as well. That is, it would replace the
-@samp{bfd_generic_get_relocated_section_contents} function which is
-currently normally used.
-
-For the special case of ELF dynamic linking, more consideration needs to
-be given to writing ELF specific but ELF target generic code to handle
-special relocation types such as GOT and PLT.
-
-@node BFD ELF support
-@section BFD ELF support
-@cindex elf support in bfd
-@cindex bfd elf support
-
-The ELF object file format is defined in two parts: a generic ABI and a
-processor specific supplement. The ELF support in BFD is split in a
-similar fashion. The processor specific support is largely kept within
-a single file. The generic support is provided by several other files.
-The processor specific support provides a set of function pointers and
-constants used by the generic support.
-
-@menu
-* BFD ELF sections and segments:: ELF sections and segments
-* BFD ELF generic support:: BFD ELF generic support
-* BFD ELF processor specific support:: BFD ELF processor specific support
-* BFD ELF core files:: BFD ELF core files
-* BFD ELF future:: BFD ELF future
-@end menu
-
-@node BFD ELF sections and segments
-@subsection ELF sections and segments
-
-The ELF ABI permits a file to have either sections or segments or both.
-Relocateable object files conventionally have only sections.
-Executables conventionally have both. Core files conventionally have
-only program segments.
-
-ELF sections are similar to sections in other object file formats: they
-have a name, a VMA, file contents, flags, and other miscellaneous
-information. ELF relocations are stored in sections of a particular
-type; BFD automatically converts these sections into internal relocation
-information.
-
-ELF program segments are intended for fast interpretation by a system
-loader. They have a type, a VMA, an LMA, file contents, and a couple of
-other fields. When an ELF executable is run on a Unix system, the
-system loader will examine the program segments to decide how to load
-it. The loader will ignore the section information. Loadable program
-segments (type @samp{PT_LOAD}) are directly loaded into memory. Other
-program segments are interpreted by the loader, and generally provide
-dynamic linking information.
-
-When an ELF file has both program segments and sections, an ELF program
-segment may encompass one or more ELF sections, in the sense that the
-portion of the file which corresponds to the program segment may include
-the portions of the file corresponding to one or more sections. When
-there is more than one section in a loadable program segment, the
-relative positions of the section contents in the file must correspond
-to the relative positions they should hold when the program segment is
-loaded. This requirement should be obvious if you consider that the
-system loader will load an entire program segment at a time.
-
-On a system which supports dynamic paging, such as any native Unix
-system, the contents of a loadable program segment must be at the same
-offset in the file as in memory, modulo the memory page size used on the
-system. This is because the system loader will map the file into memory
-starting at the start of a page. The system loader can easily remap
-entire pages to the correct load address. However, if the contents of
-the file were not correctly aligned within the page, the system loader
-would have to shift the contents around within the page, which is too
-expensive. For example, if the LMA of a loadable program segment is
-@samp{0x40080} and the page size is @samp{0x1000}, then the position of
-the segment contents within the file must equal @samp{0x80} modulo
-@samp{0x1000}.
-
-BFD has only a single set of sections. It does not provide any generic
-way to examine both sections and segments. When BFD is used to open an
-object file or executable, the BFD sections will represent ELF sections.
-When BFD is used to open a core file, the BFD sections will represent
-ELF program segments.
-
-When BFD is used to examine an object file or executable, any program
-segments will be read to set the LMA of the sections. This is because
-ELF sections only have a VMA, while ELF program segments have both a VMA
-and an LMA. Any program segments will be copied by the
-@samp{copy_private} entry points. They will be printed by the
-@samp{print_private} entry point. Otherwise, the program segments are
-ignored. In particular, programs which use BFD currently have no direct
-access to the program segments.
-
-When BFD is used to create an executable, the program segments will be
-created automatically based on the section information. This is done in
-the function @samp{assign_file_positions_for_segments} in @file{elf.c}.
-This function has been tweaked many times, and probably still has
-problems that arise in particular cases.
-
-There is a hook which may be used to explicitly define the program
-segments when creating an executable: the @samp{bfd_record_phdr}
-function in @file{bfd.c}. If this function is called, BFD will not
-create program segments itself, but will only create the program
-segments specified by the caller. The linker uses this function to
-implement the @samp{PHDRS} linker script command.
-
-@node BFD ELF generic support
-@subsection BFD ELF generic support
-
-In general, functions which do not read external data from the ELF file
-are found in @file{elf.c}. They operate on the internal forms of the
-ELF structures, which are defined in @file{include/elf/internal.h}. The
-internal structures are defined in terms of @samp{bfd_vma}, and so may
-be used for both 32 bit and 64 bit ELF targets.
-
-The file @file{elfcode.h} contains functions which operate on the
-external data. @file{elfcode.h} is compiled twice, once via
-@file{elf32.c} with @samp{ARCH_SIZE} defined as @samp{32}, and once via
-@file{elf64.c} with @samp{ARCH_SIZE} defined as @samp{64}.
-@file{elfcode.h} includes functions to swap the ELF structures in and
-out of external form, as well as a few more complex functions.
-
-Linker support is found in @file{elflink.c}. The
-linker support is only used if the processor specific file defines
-@samp{elf_backend_relocate_section}, which is required to relocate the
-section contents. If that macro is not defined, the generic linker code
-is used, and relocations are handled via @samp{bfd_perform_relocation}.
-
-The core file support is in @file{elfcore.h}, which is compiled twice,
-for both 32 and 64 bit support. The more interesting cases of core file
-support only work on a native system which has the @file{sys/procfs.h}
-header file. Without that file, the core file support does little more
-than read the ELF program segments as BFD sections.
-
-The BFD internal header file @file{elf-bfd.h} is used for communication
-among these files and the processor specific files.
-
-The default entries for the BFD ELF target vector are found mainly in
-@file{elf.c}. Some functions are found in @file{elfcode.h}.
-
-The processor specific files may override particular entries in the
-target vector, but most do not, with one exception: the
-@samp{bfd_reloc_type_lookup} entry point is always processor specific.
-
-@node BFD ELF processor specific support
-@subsection BFD ELF processor specific support
-
-By convention, the processor specific support for a particular processor
-will be found in @file{elf@var{nn}-@var{cpu}.c}, where @var{nn} is
-either 32 or 64, and @var{cpu} is the name of the processor.
-
-@menu
-* BFD ELF processor required:: Required processor specific support
-* BFD ELF processor linker:: Processor specific linker support
-* BFD ELF processor other:: Other processor specific support options
-@end menu
-
-@node BFD ELF processor required
-@subsubsection Required processor specific support
-
-When writing a @file{elf@var{nn}-@var{cpu}.c} file, you must do the
-following:
-
-@itemize @bullet
-@item
-Define either @samp{TARGET_BIG_SYM} or @samp{TARGET_LITTLE_SYM}, or
-both, to a unique C name to use for the target vector. This name should
-appear in the list of target vectors in @file{targets.c}, and will also
-have to appear in @file{config.bfd} and @file{configure.in}. Define
-@samp{TARGET_BIG_SYM} for a big-endian processor,
-@samp{TARGET_LITTLE_SYM} for a little-endian processor, and define both
-for a bi-endian processor.
-@item
-Define either @samp{TARGET_BIG_NAME} or @samp{TARGET_LITTLE_NAME}, or
-both, to a string used as the name of the target vector. This is the
-name which a user of the BFD tool would use to specify the object file
-format. It would normally appear in a linker emulation parameters
-file.
-@item
-Define @samp{ELF_ARCH} to the BFD architecture (an element of the
-@samp{bfd_architecture} enum, typically @samp{bfd_arch_@var{cpu}}).
-@item
-Define @samp{ELF_MACHINE_CODE} to the magic number which should appear
-in the @samp{e_machine} field of the ELF header. As of this writing,
-these magic numbers are assigned by Caldera; if you want to get a magic
-number for a particular processor, try sending a note to
-@email{registry@@caldera.com}. In the BFD sources, the magic numbers are
-found in @file{include/elf/common.h}; they have names beginning with
-@samp{EM_}.
-@item
-Define @samp{ELF_MAXPAGESIZE} to the maximum size of a virtual page in
-memory. This can normally be found at the start of chapter 5 in the
-processor specific supplement. For a processor which will only be used
-in an embedded system, or which has no memory management hardware, this
-can simply be @samp{1}.
-@item
-If the format should use @samp{Rel} rather than @samp{Rela} relocations,
-define @samp{USE_REL}. This is normally defined in chapter 4 of the
-processor specific supplement.
-
-In the absence of a supplement, it's easier to work with @samp{Rela}
-relocations. @samp{Rela} relocations will require more space in object
-files (but not in executables, except when using dynamic linking).
-However, this is outweighed by the simplicity of addend handling when
-using @samp{Rela} relocations. With @samp{Rel} relocations, the addend
-must be stored in the section contents, which makes relocatable links
-more complex.
-
-For example, consider C code like @code{i = a[1000];} where @samp{a} is
-a global array. The instructions which load the value of @samp{a[1000]}
-will most likely use a relocation which refers to the symbol
-representing @samp{a}, with an addend that gives the offset from the
-start of @samp{a} to element @samp{1000}. When using @samp{Rel}
-relocations, that addend must be stored in the instructions themselves.
-If you are adding support for a RISC chip which uses two or more
-instructions to load an address, then the addend may not fit in a single
-instruction, and will have to be somehow split among the instructions.
-This makes linking awkward, particularly when doing a relocatable link
-in which the addend may have to be updated. It can be done---the MIPS
-ELF support does it---but it should be avoided when possible.
-
-It is possible, though somewhat awkward, to support both @samp{Rel} and
-@samp{Rela} relocations for a single target; @file{elf64-mips.c} does it
-by overriding the relocation reading and writing routines.
-@item
-Define howto structures for all the relocation types.
-@item
-Define a @samp{bfd_reloc_type_lookup} routine. This must be named
-@samp{bfd_elf@var{nn}_bfd_reloc_type_lookup}, and may be either a
-function or a macro. It must translate a BFD relocation code into a
-howto structure. This is normally a table lookup or a simple switch.
-@item
-If using @samp{Rel} relocations, define @samp{elf_info_to_howto_rel}.
-If using @samp{Rela} relocations, define @samp{elf_info_to_howto}.
-Either way, this is a macro defined as the name of a function which
-takes an @samp{arelent} and a @samp{Rel} or @samp{Rela} structure, and
-sets the @samp{howto} field of the @samp{arelent} based on the
-@samp{Rel} or @samp{Rela} structure. This is normally uses
-@samp{ELF@var{nn}_R_TYPE} to get the ELF relocation type and uses it as
-an index into a table of howto structures.
-@end itemize
-
-You must also add the magic number for this processor to the
-@samp{prep_headers} function in @file{elf.c}.
-
-You must also create a header file in the @file{include/elf} directory
-called @file{@var{cpu}.h}. This file should define any target specific
-information which may be needed outside of the BFD code. In particular
-it should use the @samp{START_RELOC_NUMBERS}, @samp{RELOC_NUMBER},
-@samp{FAKE_RELOC}, @samp{EMPTY_RELOC} and @samp{END_RELOC_NUMBERS}
-macros to create a table mapping the number used to identify a
-relocation to a name describing that relocation.
-
-While not a BFD component, you probably also want to make the binutils
-program @samp{readelf} parse your ELF objects. For this, you need to add
-code for @code{EM_@var{cpu}} as appropriate in @file{binutils/readelf.c}.
-
-@node BFD ELF processor linker
-@subsubsection Processor specific linker support
-
-The linker will be much more efficient if you define a relocate section
-function. This will permit BFD to use the ELF specific linker support.
-
-If you do not define a relocate section function, BFD must use the
-generic linker support, which requires converting all symbols and
-relocations into BFD @samp{asymbol} and @samp{arelent} structures. In
-this case, relocations will be handled by calling
-@samp{bfd_perform_relocation}, which will use the howto structures you
-have defined. @xref{BFD relocation handling}.
-
-In order to support linking into a different object file format, such as
-S-records, @samp{bfd_perform_relocation} must work correctly with your
-howto structures, so you can't skip that step. However, if you define
-the relocate section function, then in the normal case of linking into
-an ELF file the linker will not need to convert symbols and relocations,
-and will be much more efficient.
-
-To use a relocation section function, define the macro
-@samp{elf_backend_relocate_section} as the name of a function which will
-take the contents of a section, as well as relocation, symbol, and other
-information, and modify the section contents according to the relocation
-information. In simple cases, this is little more than a loop over the
-relocations which computes the value of each relocation and calls
-@samp{_bfd_final_link_relocate}. The function must check for a
-relocatable link, and in that case normally needs to do nothing other
-than adjust the addend for relocations against a section symbol.
-
-The complex cases generally have to do with dynamic linker support. GOT
-and PLT relocations must be handled specially, and the linker normally
-arranges to set up the GOT and PLT sections while handling relocations.
-When generating a shared library, random relocations must normally be
-copied into the shared library, or converted to RELATIVE relocations
-when possible.
-
-@node BFD ELF processor other
-@subsubsection Other processor specific support options
-
-There are many other macros which may be defined in
-@file{elf@var{nn}-@var{cpu}.c}. These macros may be found in
-@file{elfxx-target.h}.
-
-Macros may be used to override some of the generic ELF target vector
-functions.
-
-Several processor specific hook functions which may be defined as
-macros. These functions are found as function pointers in the
-@samp{elf_backend_data} structure defined in @file{elf-bfd.h}. In
-general, a hook function is set by defining a macro
-@samp{elf_backend_@var{name}}.
-
-There are a few processor specific constants which may also be defined.
-These are again found in the @samp{elf_backend_data} structure.
-
-I will not define the various functions and constants here; see the
-comments in @file{elf-bfd.h}.
-
-Normally any odd characteristic of a particular ELF processor is handled
-via a hook function. For example, the special @samp{SHN_MIPS_SCOMMON}
-section number found in MIPS ELF is handled via the hooks
-@samp{section_from_bfd_section}, @samp{symbol_processing},
-@samp{add_symbol_hook}, and @samp{output_symbol_hook}.
-
-Dynamic linking support, which involves processor specific relocations
-requiring special handling, is also implemented via hook functions.
-
-@node BFD ELF core files
-@subsection BFD ELF core files
-@cindex elf core files
-
-On native ELF Unix systems, core files are generated without any
-sections. Instead, they only have program segments.
-
-When BFD is used to read an ELF core file, the BFD sections will
-actually represent program segments. Since ELF program segments do not
-have names, BFD will invent names like @samp{segment@var{n}} where
-@var{n} is a number.
-
-A single ELF program segment may include both an initialized part and an
-uninitialized part. The size of the initialized part is given by the
-@samp{p_filesz} field. The total size of the segment is given by the
-@samp{p_memsz} field. If @samp{p_memsz} is larger than @samp{p_filesz},
-then the extra space is uninitialized, or, more precisely, initialized
-to zero.
-
-BFD will represent such a program segment as two different sections.
-The first, named @samp{segment@var{n}a}, will represent the initialized
-part of the program segment. The second, named @samp{segment@var{n}b},
-will represent the uninitialized part.
-
-ELF core files store special information such as register values in
-program segments with the type @samp{PT_NOTE}. BFD will attempt to
-interpret the information in these segments, and will create additional
-sections holding the information. Some of this interpretation requires
-information found in the host header file @file{sys/procfs.h}, and so
-will only work when BFD is built on a native system.
-
-BFD does not currently provide any way to create an ELF core file. In
-general, BFD does not provide a way to create core files. The way to
-implement this would be to write @samp{bfd_set_format} and
-@samp{bfd_write_contents} routines for the @samp{bfd_core} type; see
-@ref{BFD target vector format}.
-
-@node BFD ELF future
-@subsection BFD ELF future
-
-The current dynamic linking support has too much code duplication.
-While each processor has particular differences, much of the dynamic
-linking support is quite similar for each processor. The GOT and PLT
-are handled in fairly similar ways, the details of -Bsymbolic linking
-are generally similar, etc. This code should be reworked to use more
-generic functions, eliminating the duplication.
-
-Similarly, the relocation handling has too much duplication. Many of
-the @samp{reloc_type_lookup} and @samp{info_to_howto} functions are
-quite similar. The relocate section functions are also often quite
-similar, both in the standard linker handling and the dynamic linker
-handling. Many of the COFF processor specific backends share a single
-relocate section function (@samp{_bfd_coff_generic_relocate_section}),
-and it should be possible to do something like this for the ELF targets
-as well.
-
-The appearance of the processor specific magic number in
-@samp{prep_headers} in @file{elf.c} is somewhat bogus. It should be
-possible to add support for a new processor without changing the generic
-support.
-
-The processor function hooks and constants are ad hoc and need better
-documentation.
-
-When a linker script uses @samp{SIZEOF_HEADERS}, the ELF backend must
-guess at the number of program segments which will be required, in
-@samp{get_program_header_size}. This is because the linker calls
-@samp{bfd_sizeof_headers} before it knows all the section addresses and
-sizes. The ELF backend may later discover, when creating program
-segments, that more program segments are required. This is currently
-reported as an error in @samp{assign_file_positions_for_segments}.
-
-In practice this makes it difficult to use @samp{SIZEOF_HEADERS} except
-with a carefully defined linker script. Unfortunately,
-@samp{SIZEOF_HEADERS} is required for fast program loading on a native
-system, since it permits the initial code section to appear on the same
-page as the program segments, saving a page read when the program starts
-running. Fortunately, native systems permit careful definition of the
-linker script. Still, ideally it would be possible to use relaxation to
-compute the number of program segments.
-
-@node BFD glossary
-@section BFD glossary
-@cindex glossary for bfd
-@cindex bfd glossary
-
-This is a short glossary of some BFD terms.
-
-@table @asis
-@item a.out
-The a.out object file format. The original Unix object file format.
-Still used on SunOS, though not Solaris. Supports only three sections.
-
-@item archive
-A collection of object files produced and manipulated by the @samp{ar}
-program.
-
-@item backend
-The implementation within BFD of a particular object file format. The
-set of functions which appear in a particular target vector.
-
-@item BFD
-The BFD library itself. Also, each object file, archive, or executable
-opened by the BFD library has the type @samp{bfd *}, and is sometimes
-referred to as a bfd.
-
-@item COFF
-The Common Object File Format. Used on Unix SVR3. Used by some
-embedded targets, although ELF is normally better.
-
-@item DLL
-A shared library on Windows.
-
-@item dynamic linker
-When a program linked against a shared library is run, the dynamic
-linker will locate the appropriate shared library and arrange to somehow
-include it in the running image.
-
-@item dynamic object
-Another name for an ELF shared library.
-
-@item ECOFF
-The Extended Common Object File Format. Used on Alpha Digital Unix
-(formerly OSF/1), as well as Ultrix and Irix 4. A variant of COFF.
-
-@item ELF
-The Executable and Linking Format. The object file format used on most
-modern Unix systems, including GNU/Linux, Solaris, Irix, and SVR4. Also
-used on many embedded systems.
-
-@item executable
-A program, with instructions and symbols, and perhaps dynamic linking
-information. Normally produced by a linker.
-
-@item LMA
-Load Memory Address. This is the address at which a section will be
-loaded. Compare with VMA, below.
-
-@item NLM
-NetWare Loadable Module. Used to describe the format of an object which
-be loaded into NetWare, which is some kind of PC based network server
-program.
-
-@item object file
-A binary file including machine instructions, symbols, and relocation
-information. Normally produced by an assembler.
-
-@item object file format
-The format of an object file. Typically object files and executables
-for a particular system are in the same format, although executables
-will not contain any relocation information.
-
-@item PE
-The Portable Executable format. This is the object file format used for
-Windows (specifically, Win32) object files. It is based closely on
-COFF, but has a few significant differences.
-
-@item PEI
-The Portable Executable Image format. This is the object file format
-used for Windows (specifically, Win32) executables. It is very similar
-to PE, but includes some additional header information.
-
-@item relocations
-Information used by the linker to adjust section contents. Also called
-relocs.
-
-@item section
-Object files and executable are composed of sections. Sections have
-optional data and optional relocation information.
-
-@item shared library
-A library of functions which may be used by many executables without
-actually being linked into each executable. There are several different
-implementations of shared libraries, each having slightly different
-features.
-
-@item symbol
-Each object file and executable may have a list of symbols, often
-referred to as the symbol table. A symbol is basically a name and an
-address. There may also be some additional information like the type of
-symbol, although the type of a symbol is normally something simple like
-function or object, and should be confused with the more complex C
-notion of type. Typically every global function and variable in a C
-program will have an associated symbol.
-
-@item target vector
-A set of functions which implement support for a particular object file
-format. The @samp{bfd_target} structure.
-
-@item Win32
-The current Windows API, implemented by Windows 95 and later and Windows
-NT 3.51 and later, but not by Windows 3.1.
-
-@item XCOFF
-The eXtended Common Object File Format. Used on AIX. A variant of
-COFF, with a completely different symbol table implementation.
-
-@item VMA
-Virtual Memory Address. This is the address a section will have when
-an executable is run. Compare with LMA, above.
-@end table
-
-@node Index
-@unnumberedsec Index
-@printindex cp
-
-@contents
-@bye
diff --git a/contrib/binutils/bfd/doc/bfdio.texi b/contrib/binutils/bfd/doc/bfdio.texi
deleted file mode 100644
index b8c79d3..0000000
--- a/contrib/binutils/bfd/doc/bfdio.texi
+++ /dev/null
@@ -1,41 +0,0 @@
-@findex bfd_get_mtime
-@subsubsection @code{bfd_get_mtime}
-@strong{Synopsis}
-@example
-long bfd_get_mtime (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file modification time (as read from the file system, or
-from the archive header for archive members).
-
-@findex bfd_get_size
-@subsubsection @code{bfd_get_size}
-@strong{Synopsis}
-@example
-long bfd_get_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file size (as read from file system) for the file
-associated with BFD @var{abfd}.
-
-The initial motivation for, and use of, this routine is not
-so we can get the exact size of the object the BFD applies to, since
-that might not be generally possible (archive members for example).
-It would be ideal if someone could eventually modify
-it so that such results were guaranteed.
-
-Instead, we want to ask questions like "is this NNN byte sized
-object I'm about to try read from file offset YYY reasonable?"
-As as example of where we might do this, some object formats
-use string tables for which the first @code{sizeof (long)} bytes of the
-table contain the size of the table itself, including the size bytes.
-If an application tries to read what it thinks is one of these
-string tables, without some way to validate the size, and for
-some reason the size is wrong (byte swapping error, wrong location
-for the string table, etc.), the only clue is likely to be a read
-error when it tries to read the table, or a "virtual memory
-exhausted" error when it tries to allocate 15 bazillon bytes
-of space for the 15 bazillon byte table it is about to read.
-This function at least allows us to answer the question, "is the
-size reasonable?".
-
diff --git a/contrib/binutils/bfd/doc/bfdsumm.texi b/contrib/binutils/bfd/doc/bfdsumm.texi
deleted file mode 100644
index 77a5f09..0000000
--- a/contrib/binutils/bfd/doc/bfdsumm.texi
+++ /dev/null
@@ -1,148 +0,0 @@
-@c This summary of BFD is shared by the BFD and LD docs.
-When an object file is opened, BFD subroutines automatically determine
-the format of the input object file. They then build a descriptor in
-memory with pointers to routines that will be used to access elements of
-the object file's data structures.
-
-As different information from the object files is required,
-BFD reads from different sections of the file and processes them.
-For example, a very common operation for the linker is processing symbol
-tables. Each BFD back end provides a routine for converting
-between the object file's representation of symbols and an internal
-canonical format. When the linker asks for the symbol table of an object
-file, it calls through a memory pointer to the routine from the
-relevant BFD back end which reads and converts the table into a canonical
-form. The linker then operates upon the canonical form. When the link is
-finished and the linker writes the output file's symbol table,
-another BFD back end routine is called to take the newly
-created symbol table and convert it into the chosen output format.
-
-@menu
-* BFD information loss:: Information Loss
-* Canonical format:: The BFD canonical object-file format
-@end menu
-
-@node BFD information loss
-@subsection Information Loss
-
-@emph{Information can be lost during output.} The output formats
-supported by BFD do not provide identical facilities, and
-information which can be described in one form has nowhere to go in
-another format. One example of this is alignment information in
-@code{b.out}. There is nowhere in an @code{a.out} format file to store
-alignment information on the contained data, so when a file is linked
-from @code{b.out} and an @code{a.out} image is produced, alignment
-information will not propagate to the output file. (The linker will
-still use the alignment information internally, so the link is performed
-correctly).
-
-Another example is COFF section names. COFF files may contain an
-unlimited number of sections, each one with a textual section name. If
-the target of the link is a format which does not have many sections (e.g.,
-@code{a.out}) or has sections without names (e.g., the Oasys format), the
-link cannot be done simply. You can circumvent this problem by
-describing the desired input-to-output section mapping with the linker command
-language.
-
-@emph{Information can be lost during canonicalization.} The BFD
-internal canonical form of the external formats is not exhaustive; there
-are structures in input formats for which there is no direct
-representation internally. This means that the BFD back ends
-cannot maintain all possible data richness through the transformation
-between external to internal and back to external formats.
-
-This limitation is only a problem when an application reads one
-format and writes another. Each BFD back end is responsible for
-maintaining as much data as possible, and the internal BFD
-canonical form has structures which are opaque to the BFD core,
-and exported only to the back ends. When a file is read in one format,
-the canonical form is generated for BFD and the application. At the
-same time, the back end saves away any information which may otherwise
-be lost. If the data is then written back in the same format, the back
-end routine will be able to use the canonical form provided by the
-BFD core as well as the information it prepared earlier. Since
-there is a great deal of commonality between back ends,
-there is no information lost when
-linking or copying big endian COFF to little endian COFF, or @code{a.out} to
-@code{b.out}. When a mixture of formats is linked, the information is
-only lost from the files whose format differs from the destination.
-
-@node Canonical format
-@subsection The BFD canonical object-file format
-
-The greatest potential for loss of information occurs when there is the least
-overlap between the information provided by the source format, that
-stored by the canonical format, and that needed by the
-destination format. A brief description of the canonical form may help
-you understand which kinds of data you can count on preserving across
-conversions.
-@cindex BFD canonical format
-@cindex internal object-file format
-
-@table @emph
-@item files
-Information stored on a per-file basis includes target machine
-architecture, particular implementation format type, a demand pageable
-bit, and a write protected bit. Information like Unix magic numbers is
-not stored here---only the magic numbers' meaning, so a @code{ZMAGIC}
-file would have both the demand pageable bit and the write protected
-text bit set. The byte order of the target is stored on a per-file
-basis, so that big- and little-endian object files may be used with one
-another.
-
-@item sections
-Each section in the input file contains the name of the section, the
-section's original address in the object file, size and alignment
-information, various flags, and pointers into other BFD data
-structures.
-
-@item symbols
-Each symbol contains a pointer to the information for the object file
-which originally defined it, its name, its value, and various flag
-bits. When a BFD back end reads in a symbol table, it relocates all
-symbols to make them relative to the base of the section where they were
-defined. Doing this ensures that each symbol points to its containing
-section. Each symbol also has a varying amount of hidden private data
-for the BFD back end. Since the symbol points to the original file, the
-private data format for that symbol is accessible. @code{ld} can
-operate on a collection of symbols of wildly different formats without
-problems.
-
-Normal global and simple local symbols are maintained on output, so an
-output file (no matter its format) will retain symbols pointing to
-functions and to global, static, and common variables. Some symbol
-information is not worth retaining; in @code{a.out}, type information is
-stored in the symbol table as long symbol names. This information would
-be useless to most COFF debuggers; the linker has command line switches
-to allow users to throw it away.
-
-There is one word of type information within the symbol, so if the
-format supports symbol type information within symbols (for example, COFF,
-IEEE, Oasys) and the type is simple enough to fit within one word
-(nearly everything but aggregates), the information will be preserved.
-
-@item relocation level
-Each canonical BFD relocation record contains a pointer to the symbol to
-relocate to, the offset of the data to relocate, the section the data
-is in, and a pointer to a relocation type descriptor. Relocation is
-performed by passing messages through the relocation type
-descriptor and the symbol pointer. Therefore, relocations can be performed
-on output data using a relocation method that is only available in one of the
-input formats. For instance, Oasys provides a byte relocation format.
-A relocation record requesting this relocation type would point
-indirectly to a routine to perform this, so the relocation may be
-performed on a byte being written to a 68k COFF file, even though 68k COFF
-has no such relocation type.
-
-@item line numbers
-Object formats can contain, for debugging purposes, some form of mapping
-between symbols, source line numbers, and addresses in the output file.
-These addresses have to be relocated along with the symbol information.
-Each symbol with an associated list of line number records points to the
-first record of the list. The head of a line number list consists of a
-pointer to the symbol, which allows finding out the address of the
-function whose line number is being described. The rest of the list is
-made up of pairs: offsets into the section and line numbers. Any format
-which can simply derive this information can pass it successfully
-between formats (COFF, IEEE and Oasys).
-@end table
diff --git a/contrib/binutils/bfd/doc/bfdt.texi b/contrib/binutils/bfd/doc/bfdt.texi
deleted file mode 100644
index 74cace4..0000000
--- a/contrib/binutils/bfd/doc/bfdt.texi
+++ /dev/null
@@ -1,690 +0,0 @@
-@section @code{typedef bfd}
-A BFD has type @code{bfd}; objects of this type are the
-cornerstone of any application using BFD. Using BFD
-consists of making references though the BFD and to data in the BFD.
-
-Here is the structure that defines the type @code{bfd}. It
-contains the major data about the file and pointers
-to the rest of the data.
-
-
-@example
-
-struct bfd
-@{
- /* A unique identifier of the BFD */
- unsigned int id;
-
- /* The filename the application opened the BFD with. */
- const char *filename;
-
- /* A pointer to the target jump table. */
- const struct bfd_target *xvec;
-
- /* To avoid dragging too many header files into every file that
- includes `@code{bfd.h}', IOSTREAM has been declared as a "char *",
- and MTIME as a "long". Their correct types, to which they
- are cast when used, are "FILE *" and "time_t". The iostream
- is the result of an fopen on the filename. However, if the
- BFD_IN_MEMORY flag is set, then iostream is actually a pointer
- to a bfd_in_memory struct. */
- void *iostream;
-
- /* Is the file descriptor being cached? That is, can it be closed as
- needed, and re-opened when accessed later? */
- bfd_boolean cacheable;
-
- /* Marks whether there was a default target specified when the
- BFD was opened. This is used to select which matching algorithm
- to use to choose the back end. */
- bfd_boolean target_defaulted;
-
- /* The caching routines use these to maintain a
- least-recently-used list of BFDs. */
- struct bfd *lru_prev, *lru_next;
-
- /* When a file is closed by the caching routines, BFD retains
- state information on the file here... */
- ufile_ptr where;
-
- /* ... and here: (``once'' means at least once). */
- bfd_boolean opened_once;
-
- /* Set if we have a locally maintained mtime value, rather than
- getting it from the file each time. */
- bfd_boolean mtime_set;
-
- /* File modified time, if mtime_set is TRUE. */
- long mtime;
-
- /* Reserved for an unimplemented file locking extension. */
- int ifd;
-
- /* The format which belongs to the BFD. (object, core, etc.) */
- bfd_format format;
-
- /* The direction with which the BFD was opened. */
- enum bfd_direction
- @{
- no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3
- @}
- direction;
-
- /* Format_specific flags. */
- flagword flags;
-
- /* Currently my_archive is tested before adding origin to
- anything. I believe that this can become always an add of
- origin, with origin set to 0 for non archive files. */
- ufile_ptr origin;
-
- /* Remember when output has begun, to stop strange things
- from happening. */
- bfd_boolean output_has_begun;
-
- /* A hash table for section names. */
- struct bfd_hash_table section_htab;
-
- /* Pointer to linked list of sections. */
- struct bfd_section *sections;
-
- /* The place where we add to the section list. */
- struct bfd_section **section_tail;
-
- /* The number of sections. */
- unsigned int section_count;
-
- /* Stuff only useful for object files:
- The start address. */
- bfd_vma start_address;
-
- /* Used for input and output. */
- unsigned int symcount;
-
- /* Symbol table for output BFD (with symcount entries). */
- struct bfd_symbol **outsymbols;
-
- /* Used for slurped dynamic symbol tables. */
- unsigned int dynsymcount;
-
- /* Pointer to structure which contains architecture information. */
- const struct bfd_arch_info *arch_info;
-
- /* Stuff only useful for archives. */
- void *arelt_data;
- struct bfd *my_archive; /* The containing archive BFD. */
- struct bfd *next; /* The next BFD in the archive. */
- struct bfd *archive_head; /* The first BFD in the archive. */
- bfd_boolean has_armap;
-
- /* A chain of BFD structures involved in a link. */
- struct bfd *link_next;
-
- /* A field used by _bfd_generic_link_add_archive_symbols. This will
- be used only for archive elements. */
- int archive_pass;
-
- /* Used by the back end to hold private data. */
- union
- @{
- struct aout_data_struct *aout_data;
- struct artdata *aout_ar_data;
- struct _oasys_data *oasys_obj_data;
- struct _oasys_ar_data *oasys_ar_data;
- struct coff_tdata *coff_obj_data;
- struct pe_tdata *pe_obj_data;
- struct xcoff_tdata *xcoff_obj_data;
- struct ecoff_tdata *ecoff_obj_data;
- struct ieee_data_struct *ieee_data;
- struct ieee_ar_data_struct *ieee_ar_data;
- struct srec_data_struct *srec_data;
- struct ihex_data_struct *ihex_data;
- struct tekhex_data_struct *tekhex_data;
- struct elf_obj_tdata *elf_obj_data;
- struct nlm_obj_tdata *nlm_obj_data;
- struct bout_data_struct *bout_data;
- struct mmo_data_struct *mmo_data;
- struct sun_core_struct *sun_core_data;
- struct sco5_core_struct *sco5_core_data;
- struct trad_core_struct *trad_core_data;
- struct som_data_struct *som_data;
- struct hpux_core_struct *hpux_core_data;
- struct hppabsd_core_struct *hppabsd_core_data;
- struct sgi_core_struct *sgi_core_data;
- struct lynx_core_struct *lynx_core_data;
- struct osf_core_struct *osf_core_data;
- struct cisco_core_struct *cisco_core_data;
- struct versados_data_struct *versados_data;
- struct netbsd_core_struct *netbsd_core_data;
- struct mach_o_data_struct *mach_o_data;
- struct mach_o_fat_data_struct *mach_o_fat_data;
- struct bfd_pef_data_struct *pef_data;
- struct bfd_pef_xlib_data_struct *pef_xlib_data;
- struct bfd_sym_data_struct *sym_data;
- void *any;
- @}
- tdata;
-
- /* Used by the application to hold private data. */
- void *usrdata;
-
- /* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use void * to avoid requiring the inclusion
- of objalloc.h. */
- void *memory;
-@};
-
-@end example
-@section Error reporting
-Most BFD functions return nonzero on success (check their
-individual documentation for precise semantics). On an error,
-they call @code{bfd_set_error} to set an error condition that callers
-can check by calling @code{bfd_get_error}.
-If that returns @code{bfd_error_system_call}, then check
-@code{errno}.
-
-The easiest way to report a BFD error to the user is to
-use @code{bfd_perror}.
-
-@subsection Type @code{bfd_error_type}
-The values returned by @code{bfd_get_error} are defined by the
-enumerated type @code{bfd_error_type}.
-
-
-@example
-
-typedef enum bfd_error
-@{
- bfd_error_no_error = 0,
- bfd_error_system_call,
- bfd_error_invalid_target,
- bfd_error_wrong_format,
- bfd_error_wrong_object_format,
- bfd_error_invalid_operation,
- bfd_error_no_memory,
- bfd_error_no_symbols,
- bfd_error_no_armap,
- bfd_error_no_more_archived_files,
- bfd_error_malformed_archive,
- bfd_error_file_not_recognized,
- bfd_error_file_ambiguously_recognized,
- bfd_error_no_contents,
- bfd_error_nonrepresentable_section,
- bfd_error_no_debug_section,
- bfd_error_bad_value,
- bfd_error_file_truncated,
- bfd_error_file_too_big,
- bfd_error_invalid_error_code
-@}
-bfd_error_type;
-
-@end example
-@findex bfd_get_error
-@subsubsection @code{bfd_get_error}
-@strong{Synopsis}
-@example
-bfd_error_type bfd_get_error (void);
-@end example
-@strong{Description}@*
-Return the current BFD error condition.
-
-@findex bfd_set_error
-@subsubsection @code{bfd_set_error}
-@strong{Synopsis}
-@example
-void bfd_set_error (bfd_error_type error_tag);
-@end example
-@strong{Description}@*
-Set the BFD error condition to be @var{error_tag}.
-
-@findex bfd_errmsg
-@subsubsection @code{bfd_errmsg}
-@strong{Synopsis}
-@example
-const char *bfd_errmsg (bfd_error_type error_tag);
-@end example
-@strong{Description}@*
-Return a string describing the error @var{error_tag}, or
-the system error if @var{error_tag} is @code{bfd_error_system_call}.
-
-@findex bfd_perror
-@subsubsection @code{bfd_perror}
-@strong{Synopsis}
-@example
-void bfd_perror (const char *message);
-@end example
-@strong{Description}@*
-Print to the standard error stream a string describing the
-last BFD error that occurred, or the last system error if
-the last BFD error was a system call failure. If @var{message}
-is non-NULL and non-empty, the error string printed is preceded
-by @var{message}, a colon, and a space. It is followed by a newline.
-
-@subsection BFD error handler
-Some BFD functions want to print messages describing the
-problem. They call a BFD error handler function. This
-function may be overridden by the program.
-
-The BFD error handler acts like printf.
-
-
-@example
-
-typedef void (*bfd_error_handler_type) (const char *, ...);
-
-@end example
-@findex bfd_set_error_handler
-@subsubsection @code{bfd_set_error_handler}
-@strong{Synopsis}
-@example
-bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-@end example
-@strong{Description}@*
-Set the BFD error handler function. Returns the previous
-function.
-
-@findex bfd_set_error_program_name
-@subsubsection @code{bfd_set_error_program_name}
-@strong{Synopsis}
-@example
-void bfd_set_error_program_name (const char *);
-@end example
-@strong{Description}@*
-Set the program name to use when printing a BFD error. This
-is printed before the error message followed by a colon and
-space. The string must not be changed after it is passed to
-this function.
-
-@findex bfd_get_error_handler
-@subsubsection @code{bfd_get_error_handler}
-@strong{Synopsis}
-@example
-bfd_error_handler_type bfd_get_error_handler (void);
-@end example
-@strong{Description}@*
-Return the BFD error handler function.
-
-@findex bfd_archive_filename
-@subsubsection @code{bfd_archive_filename}
-@strong{Synopsis}
-@example
-const char *bfd_archive_filename (bfd *);
-@end example
-@strong{Description}@*
-For a BFD that is a component of an archive, returns a string
-with both the archive name and file name. For other BFDs, just
-returns the file name.
-
-@section Symbols
-
-
-@findex bfd_get_reloc_upper_bound
-@subsubsection @code{bfd_get_reloc_upper_bound}
-@strong{Synopsis}
-@example
-long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-@end example
-@strong{Description}@*
-Return the number of bytes required to store the
-relocation information associated with section @var{sect}
-attached to bfd @var{abfd}. If an error occurs, return -1.
-
-@findex bfd_canonicalize_reloc
-@subsubsection @code{bfd_canonicalize_reloc}
-@strong{Synopsis}
-@example
-long bfd_canonicalize_reloc
- (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-@end example
-@strong{Description}@*
-Call the back end associated with the open BFD
-@var{abfd} and translate the external form of the relocation
-information attached to @var{sec} into the internal canonical
-form. Place the table into memory at @var{loc}, which has
-been preallocated, usually by a call to
-@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
--1 on error.
-
-The @var{syms} table is also needed for horrible internal magic
-reasons.
-
-@findex bfd_set_reloc
-@subsubsection @code{bfd_set_reloc}
-@strong{Synopsis}
-@example
-void bfd_set_reloc
- (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-@end example
-@strong{Description}@*
-Set the relocation pointer and count within
-section @var{sec} to the values @var{rel} and @var{count}.
-The argument @var{abfd} is ignored.
-
-@findex bfd_set_file_flags
-@subsubsection @code{bfd_set_file_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set the flag word in the BFD @var{abfd} to the value @var{flags}.
-
-Possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_wrong_format} - The target bfd was not of object format.
-@item
-@code{bfd_error_invalid_operation} - The target bfd was open for reading.
-@item
-@code{bfd_error_invalid_operation} -
-The flag word contained a bit which was not applicable to the
-type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
-on a BFD format which does not support demand paging.
-@end itemize
-
-@findex bfd_get_arch_size
-@subsubsection @code{bfd_get_arch_size}
-@strong{Synopsis}
-@example
-int bfd_get_arch_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Returns the architecture address size, in bits, as determined
-by the object file's format. For ELF, this information is
-included in the header.
-
-@strong{Returns}@*
-Returns the arch size in bits if known, @code{-1} otherwise.
-
-@findex bfd_get_sign_extend_vma
-@subsubsection @code{bfd_get_sign_extend_vma}
-@strong{Synopsis}
-@example
-int bfd_get_sign_extend_vma (bfd *abfd);
-@end example
-@strong{Description}@*
-Indicates if the target architecture "naturally" sign extends
-an address. Some architectures implicitly sign extend address
-values when they are converted to types larger than the size
-of an address. For instance, bfd_get_start_address() will
-return an address sign extended to fill a bfd_vma when this is
-the case.
-
-@strong{Returns}@*
-Returns @code{1} if the target architecture is known to sign
-extend addresses, @code{0} if the target architecture is known to
-not sign extend addresses, and @code{-1} otherwise.
-
-@findex bfd_set_start_address
-@subsubsection @code{bfd_set_start_address}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
-@end example
-@strong{Description}@*
-Make @var{vma} the entry point of output BFD @var{abfd}.
-
-@strong{Returns}@*
-Returns @code{TRUE} on success, @code{FALSE} otherwise.
-
-@findex bfd_get_gp_size
-@subsubsection @code{bfd_get_gp_size}
-@strong{Synopsis}
-@example
-unsigned int bfd_get_gp_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the maximum size of objects to be optimized using the GP
-register under MIPS ECOFF. This is typically set by the @code{-G}
-argument to the compiler, assembler or linker.
-
-@findex bfd_set_gp_size
-@subsubsection @code{bfd_set_gp_size}
-@strong{Synopsis}
-@example
-void bfd_set_gp_size (bfd *abfd, unsigned int i);
-@end example
-@strong{Description}@*
-Set the maximum size of objects to be optimized using the GP
-register under ECOFF or MIPS ELF. This is typically set by
-the @code{-G} argument to the compiler, assembler or linker.
-
-@findex bfd_scan_vma
-@subsubsection @code{bfd_scan_vma}
-@strong{Synopsis}
-@example
-bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-@end example
-@strong{Description}@*
-Convert, like @code{strtoul}, a numerical expression
-@var{string} into a @code{bfd_vma} integer, and return that integer.
-(Though without as many bells and whistles as @code{strtoul}.)
-The expression is assumed to be unsigned (i.e., positive).
-If given a @var{base}, it is used as the base for conversion.
-A base of 0 causes the function to interpret the string
-in hex if a leading "0x" or "0X" is found, otherwise
-in octal if a leading zero is found, otherwise in decimal.
-
-If the value would overflow, the maximum @code{bfd_vma} value is
-returned.
-
-@findex bfd_copy_private_bfd_data
-@subsubsection @code{bfd_copy_private_bfd_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Copy private BFD information from the BFD @var{ibfd} to the
-the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error.
-Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
-@end example
-
-@findex bfd_merge_private_bfd_data
-@subsubsection @code{bfd_merge_private_bfd_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Merge private BFD information from the BFD @var{ibfd} to the
-the output file BFD @var{obfd} when linking. Return @code{TRUE}
-on success, @code{FALSE} on error. Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
- (ibfd, obfd))
-@end example
-
-@findex bfd_set_private_flags
-@subsubsection @code{bfd_set_private_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set private BFD flag information in the BFD @var{abfd}.
-Return @code{TRUE} on success, @code{FALSE} on error. Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-@end example
-
-@findex Other functions
-@subsubsection @code{Other functions}
-@strong{Description}@*
-The following functions exist but have not yet been documented.
-@example
-#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
- BFD_SEND (abfd, _bfd_find_nearest_line, \
- (abfd, sec, syms, off, file, func, line))
-
-#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-#define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
- BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
- BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_gc_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
-#define bfd_merge_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-
-#define bfd_discard_group(abfd, sec) \
- BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
-#define bfd_link_hash_table_create(abfd) \
- BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_hash_table_free(abfd, hash) \
- BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-
-#define bfd_link_add_symbols(abfd, info) \
- BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_link_just_syms(sec, info) \
- BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
-#define bfd_final_link(abfd, info) \
- BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
- BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
- BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
- bfd_boolean, asymbol **);
-
-@end example
-
-@findex bfd_alt_mach_code
-@subsubsection @code{bfd_alt_mach_code}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
-@end example
-@strong{Description}@*
-When more than one machine code number is available for the
-same machine type, this function can be used to switch between
-the preferred one (alternative == 0) and any others. Currently,
-only ELF supports this feature, with up to two alternate
-machine codes.
-
-
-@example
-struct bfd_preserve
-@{
- void *marker;
- void *tdata;
- flagword flags;
- const struct bfd_arch_info *arch_info;
- struct bfd_section *sections;
- struct bfd_section **section_tail;
- unsigned int section_count;
- struct bfd_hash_table section_htab;
-@};
-
-@end example
-@findex bfd_preserve_save
-@subsubsection @code{bfd_preserve_save}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-@end example
-@strong{Description}@*
-When testing an object for compatibility with a particular
-target back-end, the back-end object_p function needs to set
-up certain fields in the bfd on successfully recognizing the
-object. This typically happens in a piecemeal fashion, with
-failures possible at many points. On failure, the bfd is
-supposed to be restored to its initial state, which is
-virtually impossible. However, restoring a subset of the bfd
-state works in practice. This function stores the subset and
-reinitializes the bfd.
-
-@findex bfd_preserve_restore
-@subsubsection @code{bfd_preserve_restore}
-@strong{Synopsis}
-@example
-void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-@end example
-@strong{Description}@*
-This function restores bfd state saved by bfd_preserve_save.
-If MARKER is non-NULL in struct bfd_preserve then that block
-and all subsequently bfd_alloc'd memory is freed.
-
-@findex bfd_preserve_finish
-@subsubsection @code{bfd_preserve_finish}
-@strong{Synopsis}
-@example
-void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-@end example
-@strong{Description}@*
-This function should be called when the bfd state saved by
-bfd_preserve_save is no longer needed. ie. when the back-end
-object_p function returns with success.
-
diff --git a/contrib/binutils/bfd/doc/bfdwin.texi b/contrib/binutils/bfd/doc/bfdwin.texi
deleted file mode 100644
index b1fd7d5..0000000
--- a/contrib/binutils/bfd/doc/bfdwin.texi
+++ /dev/null
@@ -1,2 +0,0 @@
-@findex
-@subsubsection @code{}
diff --git a/contrib/binutils/bfd/doc/cache.texi b/contrib/binutils/bfd/doc/cache.texi
deleted file mode 100644
index 2bc3696..0000000
--- a/contrib/binutils/bfd/doc/cache.texi
+++ /dev/null
@@ -1,95 +0,0 @@
-@section File caching
-The file caching mechanism is embedded within BFD and allows
-the application to open as many BFDs as it wants without
-regard to the underlying operating system's file descriptor
-limit (often as low as 20 open files). The module in
-@code{cache.c} maintains a least recently used list of
-@code{BFD_CACHE_MAX_OPEN} files, and exports the name
-@code{bfd_cache_lookup}, which runs around and makes sure that
-the required BFD is open. If not, then it chooses a file to
-close, closes it and opens the one wanted, returning its file
-handle.
-
-@findex BFD_CACHE_MAX_OPEN macro
-@subsubsection @code{BFD_CACHE_MAX_OPEN macro}
-@strong{Description}@*
-The maximum number of files which the cache will keep open at
-one time.
-@example
-#define BFD_CACHE_MAX_OPEN 10
-@end example
-
-@findex bfd_last_cache
-@subsubsection @code{bfd_last_cache}
-@strong{Synopsis}
-@example
-extern bfd *bfd_last_cache;
-@end example
-@strong{Description}@*
-Zero, or a pointer to the topmost BFD on the chain. This is
-used by the @code{bfd_cache_lookup} macro in @file{libbfd.h} to
-determine when it can avoid a function call.
-
-@findex bfd_cache_lookup
-@subsubsection @code{bfd_cache_lookup}
-@strong{Description}@*
-Check to see if the required BFD is the same as the last one
-looked up. If so, then it can use the stream in the BFD with
-impunity, since it can't have changed since the last lookup;
-otherwise, it has to perform the complicated lookup function.
-@example
-#define bfd_cache_lookup(x) \
- ((x)==bfd_last_cache? \
- (FILE*) (bfd_last_cache->iostream): \
- bfd_cache_lookup_worker(x))
-@end example
-
-@findex bfd_cache_init
-@subsubsection @code{bfd_cache_init}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_init (bfd *abfd);
-@end example
-@strong{Description}@*
-Add a newly opened BFD to the cache.
-
-@findex bfd_cache_close
-@subsubsection @code{bfd_cache_close}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_close (bfd *abfd);
-@end example
-@strong{Description}@*
-Remove the BFD @var{abfd} from the cache. If the attached file is open,
-then close it too.
-
-@strong{Returns}@*
-@code{FALSE} is returned if closing the file fails, @code{TRUE} is
-returned if all is well.
-
-@findex bfd_open_file
-@subsubsection @code{bfd_open_file}
-@strong{Synopsis}
-@example
-FILE* bfd_open_file (bfd *abfd);
-@end example
-@strong{Description}@*
-Call the OS to open a file for @var{abfd}. Return the @code{FILE *}
-(possibly @code{NULL}) that results from this operation. Set up the
-BFD so that future accesses know the file is open. If the @code{FILE *}
-returned is @code{NULL}, then it won't have been put in the
-cache, so it won't have to be removed from it.
-
-@findex bfd_cache_lookup_worker
-@subsubsection @code{bfd_cache_lookup_worker}
-@strong{Synopsis}
-@example
-FILE *bfd_cache_lookup_worker (bfd *abfd);
-@end example
-@strong{Description}@*
-Called when the macro @code{bfd_cache_lookup} fails to find a
-quick answer. Find a file descriptor for @var{abfd}. If
-necessary, it open it. If there are already more than
-@code{BFD_CACHE_MAX_OPEN} files open, it tries to close one first, to
-avoid running out of file descriptors.
-
diff --git a/contrib/binutils/bfd/doc/chew.c b/contrib/binutils/bfd/doc/chew.c
deleted file mode 100644
index 7c060da..0000000
--- a/contrib/binutils/bfd/doc/chew.c
+++ /dev/null
@@ -1,1605 +0,0 @@
-/* chew
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
- 2002, 2003
- Free Software Foundation, Inc.
- Contributed by steve chamberlain @cygnus
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Yet another way of extracting documentation from source.
- No, I haven't finished it yet, but I hope you people like it better
- than the old way
-
- sac
-
- Basically, this is a sort of string forth, maybe we should call it
- struth?
-
- You define new words thus:
- : <newword> <oldwords> ;
-
-*/
-
-/* Primitives provided by the program:
-
- Two stacks are provided, a string stack and an integer stack.
-
- Internal state variables:
- internal_wanted - indicates whether `-i' was passed
- internal_mode - user-settable
-
- Commands:
- push_text
- ! - pop top of integer stack for address, pop next for value; store
- @ - treat value on integer stack as the address of an integer; push
- that integer on the integer stack after popping the "address"
- hello - print "hello\n" to stdout
- stdout - put stdout marker on TOS
- stderr - put stderr marker on TOS
- print - print TOS-1 on TOS (eg: "hello\n" stdout print)
- skip_past_newline
- catstr - fn icatstr
- copy_past_newline - append input, up to and including newline into TOS
- dup - fn other_dup
- drop - discard TOS
- idrop - ditto
- remchar - delete last character from TOS
- get_stuff_in_command
- do_fancy_stuff - translate <<foo>> to @code{foo} in TOS
- bulletize - if "o" lines found, prepend @itemize @bullet to TOS
- and @item to each "o" line; append @end itemize
- courierize - put @example around . and | lines, translate {* *} { }
- exit - fn chew_exit
- swap
- outputdots - strip out lines without leading dots
- paramstuff - convert full declaration into "PARAMS" form if not already
- maybecatstr - do catstr if internal_mode == internal_wanted, discard
- value in any case
- translatecomments - turn {* and *} into comment delimiters
- kill_bogus_lines - get rid of extra newlines
- indent
- internalmode - pop from integer stack, set `internalmode' to that value
- print_stack_level - print current stack depth to stderr
- strip_trailing_newlines - go ahead, guess...
- [quoted string] - push string onto string stack
- [word starting with digit] - push atol(str) onto integer stack
-
- A command must be all upper-case, and alone on a line.
-
- Foo. */
-
-#include "ansidecl.h"
-#include "sysdep.h"
-#include <assert.h>
-#include <stdio.h>
-#include <ctype.h>
-
-#define DEF_SIZE 5000
-#define STACK 50
-
-int internal_wanted;
-int internal_mode;
-
-int warning;
-
-/* Here is a string type ... */
-
-typedef struct buffer
-{
- char *ptr;
- unsigned long write_idx;
- unsigned long size;
-} string_type;
-
-#ifdef __STDC__
-static void init_string_with_size (string_type *, unsigned int);
-static void init_string (string_type *);
-static int find (string_type *, char *);
-static void write_buffer (string_type *, FILE *);
-static void delete_string (string_type *);
-static char *addr (string_type *, unsigned int);
-static char at (string_type *, unsigned int);
-static void catchar (string_type *, int);
-static void overwrite_string (string_type *, string_type *);
-static void catbuf (string_type *, char *, unsigned int);
-static void cattext (string_type *, char *);
-static void catstr (string_type *, string_type *);
-#endif
-
-static void
-init_string_with_size (buffer, size)
- string_type *buffer;
- unsigned int size;
-{
- buffer->write_idx = 0;
- buffer->size = size;
- buffer->ptr = malloc (size);
-}
-
-static void
-init_string (buffer)
- string_type *buffer;
-{
- init_string_with_size (buffer, DEF_SIZE);
-}
-
-static int
-find (str, what)
- string_type *str;
- char *what;
-{
- unsigned int i;
- char *p;
- p = what;
- for (i = 0; i < str->write_idx && *p; i++)
- {
- if (*p == str->ptr[i])
- p++;
- else
- p = what;
- }
- return (*p == 0);
-}
-
-static void
-write_buffer (buffer, f)
- string_type *buffer;
- FILE *f;
-{
- fwrite (buffer->ptr, buffer->write_idx, 1, f);
-}
-
-static void
-delete_string (buffer)
- string_type *buffer;
-{
- free (buffer->ptr);
-}
-
-static char *
-addr (buffer, idx)
- string_type *buffer;
- unsigned int idx;
-{
- return buffer->ptr + idx;
-}
-
-static char
-at (buffer, pos)
- string_type *buffer;
- unsigned int pos;
-{
- if (pos >= buffer->write_idx)
- return 0;
- return buffer->ptr[pos];
-}
-
-static void
-catchar (buffer, ch)
- string_type *buffer;
- int ch;
-{
- if (buffer->write_idx == buffer->size)
- {
- buffer->size *= 2;
- buffer->ptr = realloc (buffer->ptr, buffer->size);
- }
-
- buffer->ptr[buffer->write_idx++] = ch;
-}
-
-static void
-overwrite_string (dst, src)
- string_type *dst;
- string_type *src;
-{
- free (dst->ptr);
- dst->size = src->size;
- dst->write_idx = src->write_idx;
- dst->ptr = src->ptr;
-}
-
-static void
-catbuf (buffer, buf, len)
- string_type *buffer;
- char *buf;
- unsigned int len;
-{
- if (buffer->write_idx + len >= buffer->size)
- {
- while (buffer->write_idx + len >= buffer->size)
- buffer->size *= 2;
- buffer->ptr = realloc (buffer->ptr, buffer->size);
- }
- memcpy (buffer->ptr + buffer->write_idx, buf, len);
- buffer->write_idx += len;
-}
-
-static void
-cattext (buffer, string)
- string_type *buffer;
- char *string;
-{
- catbuf (buffer, string, (unsigned int) strlen (string));
-}
-
-static void
-catstr (dst, src)
- string_type *dst;
- string_type *src;
-{
- catbuf (dst, src->ptr, src->write_idx);
-}
-
-static unsigned int
-skip_white_and_stars (src, idx)
- string_type *src;
- unsigned int idx;
-{
- char c;
- while ((c = at (src, idx)),
- isspace ((unsigned char) c)
- || (c == '*'
- /* Don't skip past end-of-comment or star as first
- character on its line. */
- && at (src, idx +1) != '/'
- && at (src, idx -1) != '\n'))
- idx++;
- return idx;
-}
-
-/***********************************************************************/
-
-string_type stack[STACK];
-string_type *tos;
-
-unsigned int idx = 0; /* Pos in input buffer */
-string_type *ptr; /* and the buffer */
-typedef void (*stinst_type)();
-stinst_type *pc;
-stinst_type sstack[STACK];
-stinst_type *ssp = &sstack[0];
-long istack[STACK];
-long *isp = &istack[0];
-
-typedef int *word_type;
-
-struct dict_struct
-{
- char *word;
- struct dict_struct *next;
- stinst_type *code;
- int code_length;
- int code_end;
- int var;
-};
-
-typedef struct dict_struct dict_type;
-
-static void
-die (msg)
- char *msg;
-{
- fprintf (stderr, "%s\n", msg);
- exit (1);
-}
-
-static void
-check_range ()
-{
- if (tos < stack)
- die ("underflow in string stack");
- if (tos >= stack + STACK)
- die ("overflow in string stack");
-}
-
-static void
-icheck_range ()
-{
- if (isp < istack)
- die ("underflow in integer stack");
- if (isp >= istack + STACK)
- die ("overflow in integer stack");
-}
-
-#ifdef __STDC__
-static void exec (dict_type *);
-static void call (void);
-static void remchar (void), strip_trailing_newlines (void), push_number (void);
-static void push_text (void);
-static void remove_noncomments (string_type *, string_type *);
-static void print_stack_level (void);
-static void paramstuff (void), translatecomments (void);
-static void outputdots (void), courierize (void), bulletize (void);
-static void do_fancy_stuff (void);
-static int iscommand (string_type *, unsigned int);
-static int copy_past_newline (string_type *, unsigned int, string_type *);
-static void icopy_past_newline (void), kill_bogus_lines (void), indent (void);
-static void get_stuff_in_command (void), swap (void), other_dup (void);
-static void drop (void), idrop (void);
-static void icatstr (void), skip_past_newline (void), internalmode (void);
-static void maybecatstr (void);
-static char *nextword (char *, char **);
-dict_type *lookup_word (char *);
-static void perform (void);
-dict_type *newentry (char *);
-unsigned int add_to_definition (dict_type *, stinst_type);
-void add_intrinsic (char *, void (*)());
-void add_var (char *);
-void compile (char *);
-static void bang (void);
-static void atsign (void);
-static void hello (void);
-static void stdout_ (void);
-static void stderr_ (void);
-static void print (void);
-static void read_in (string_type *, FILE *);
-static void usage (void);
-static void chew_exit (void);
-#endif
-
-static void
-exec (word)
- dict_type *word;
-{
- pc = word->code;
- while (*pc)
- (*pc) ();
-}
-
-static void
-call ()
-{
- stinst_type *oldpc = pc;
- dict_type *e;
- e = (dict_type *) (pc[1]);
- exec (e);
- pc = oldpc + 2;
-}
-
-static void
-remchar ()
-{
- if (tos->write_idx)
- tos->write_idx--;
- pc++;
-}
-
-static void
-strip_trailing_newlines ()
-{
- while ((isspace ((unsigned char) at (tos, tos->write_idx - 1))
- || at (tos, tos->write_idx - 1) == '\n')
- && tos->write_idx > 0)
- tos->write_idx--;
- pc++;
-}
-
-static void
-push_number ()
-{
- isp++;
- icheck_range ();
- pc++;
- *isp = (long) (*pc);
- pc++;
-}
-
-static void
-push_text ()
-{
- tos++;
- check_range ();
- init_string (tos);
- pc++;
- cattext (tos, *((char **) pc));
- pc++;
-}
-
-/* This function removes everything not inside comments starting on
- the first char of the line from the string, also when copying
- comments, removes blank space and leading *'s.
- Blank lines are turned into one blank line. */
-
-static void
-remove_noncomments (src, dst)
- string_type *src;
- string_type *dst;
-{
- unsigned int idx = 0;
-
- while (at (src, idx))
- {
- /* Now see if we have a comment at the start of the line. */
- if (at (src, idx) == '\n'
- && at (src, idx + 1) == '/'
- && at (src, idx + 2) == '*')
- {
- idx += 3;
-
- idx = skip_white_and_stars (src, idx);
-
- /* Remove leading dot */
- if (at (src, idx) == '.')
- idx++;
-
- /* Copy to the end of the line, or till the end of the
- comment. */
- while (at (src, idx))
- {
- if (at (src, idx) == '\n')
- {
- /* end of line, echo and scrape of leading blanks */
- if (at (src, idx + 1) == '\n')
- catchar (dst, '\n');
- catchar (dst, '\n');
- idx++;
- idx = skip_white_and_stars (src, idx);
- }
- else if (at (src, idx) == '*' && at (src, idx + 1) == '/')
- {
- idx += 2;
- cattext (dst, "\nENDDD\n");
- break;
- }
- else
- {
- catchar (dst, at (src, idx));
- idx++;
- }
- }
- }
- else
- idx++;
- }
-}
-
-static void
-print_stack_level ()
-{
- fprintf (stderr, "current string stack depth = %d, ", tos - stack);
- fprintf (stderr, "current integer stack depth = %d\n", isp - istack);
- pc++;
-}
-
-/* turn:
- foobar name(stuff);
- into:
- foobar
- name PARAMS ((stuff));
- and a blank line.
- */
-
-static void
-paramstuff ()
-{
- unsigned int openp;
- unsigned int fname;
- unsigned int idx;
- unsigned int len;
- string_type out;
- init_string (&out);
-
-#define NO_PARAMS 1
-
- /* Make sure that it's not already param'd or proto'd. */
- if (NO_PARAMS
- || find (tos, "PARAMS") || find (tos, "PROTO") || !find (tos, "("))
- {
- catstr (&out, tos);
- }
- else
- {
- /* Find the open paren. */
- for (openp = 0; at (tos, openp) != '(' && at (tos, openp); openp++)
- ;
-
- fname = openp;
- /* Step back to the fname. */
- fname--;
- while (fname && isspace ((unsigned char) at (tos, fname)))
- fname--;
- while (fname
- && !isspace ((unsigned char) at (tos,fname))
- && at (tos,fname) != '*')
- fname--;
-
- fname++;
-
- /* Output type, omitting trailing whitespace character(s), if
- any. */
- for (len = fname; 0 < len; len--)
- {
- if (!isspace ((unsigned char) at (tos, len - 1)))
- break;
- }
- for (idx = 0; idx < len; idx++)
- catchar (&out, at (tos, idx));
-
- cattext (&out, "\n"); /* Insert a newline between type and fnname */
-
- /* Output function name, omitting trailing whitespace
- character(s), if any. */
- for (len = openp; 0 < len; len--)
- {
- if (!isspace ((unsigned char) at (tos, len - 1)))
- break;
- }
- for (idx = fname; idx < len; idx++)
- catchar (&out, at (tos, idx));
-
- cattext (&out, " PARAMS (");
-
- for (idx = openp; at (tos, idx) && at (tos, idx) != ';'; idx++)
- catchar (&out, at (tos, idx));
-
- cattext (&out, ");\n\n");
- }
- overwrite_string (tos, &out);
- pc++;
-
-}
-
-/* turn {*
- and *} into comments */
-
-static void
-translatecomments ()
-{
- unsigned int idx = 0;
- string_type out;
- init_string (&out);
-
- while (at (tos, idx))
- {
- if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
- {
- cattext (&out, "/*");
- idx += 2;
- }
- else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
- {
- cattext (&out, "*/");
- idx += 2;
- }
- else
- {
- catchar (&out, at (tos, idx));
- idx++;
- }
- }
-
- overwrite_string (tos, &out);
-
- pc++;
-}
-
-#if 0
-
-/* This is not currently used. */
-
-/* turn everything not starting with a . into a comment */
-
-static void
-manglecomments ()
-{
- unsigned int idx = 0;
- string_type out;
- init_string (&out);
-
- while (at (tos, idx))
- {
- if (at (tos, idx) == '\n' && at (tos, idx + 1) == '*')
- {
- cattext (&out, " /*");
- idx += 2;
- }
- else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
- {
- cattext (&out, "*/");
- idx += 2;
- }
- else
- {
- catchar (&out, at (tos, idx));
- idx++;
- }
- }
-
- overwrite_string (tos, &out);
-
- pc++;
-}
-
-#endif
-
-/* Mod tos so that only lines with leading dots remain */
-static void
-outputdots ()
-{
- unsigned int idx = 0;
- string_type out;
- init_string (&out);
-
- while (at (tos, idx))
- {
- if (at (tos, idx) == '\n' && at (tos, idx + 1) == '.')
- {
- char c;
- idx += 2;
-
- while ((c = at (tos, idx)) && c != '\n')
- {
- if (c == '{' && at (tos, idx + 1) == '*')
- {
- cattext (&out, "/*");
- idx += 2;
- }
- else if (c == '*' && at (tos, idx + 1) == '}')
- {
- cattext (&out, "*/");
- idx += 2;
- }
- else
- {
- catchar (&out, c);
- idx++;
- }
- }
- catchar (&out, '\n');
- }
- else
- {
- idx++;
- }
- }
-
- overwrite_string (tos, &out);
- pc++;
-}
-
-/* Find lines starting with . and | and put example around them on tos */
-static void
-courierize ()
-{
- string_type out;
- unsigned int idx = 0;
- int command = 0;
-
- init_string (&out);
-
- while (at (tos, idx))
- {
- if (at (tos, idx) == '\n'
- && (at (tos, idx +1 ) == '.'
- || at (tos, idx + 1) == '|'))
- {
- cattext (&out, "\n@example\n");
- do
- {
- idx += 2;
-
- while (at (tos, idx) && at (tos, idx) != '\n')
- {
- if (command > 1)
- {
- /* We are inside {} parameters of some command;
- Just pass through until matching brace. */
- if (at (tos, idx) == '{')
- ++command;
- else if (at (tos, idx) == '}')
- --command;
- }
- else if (command != 0)
- {
- if (at (tos, idx) == '{')
- ++command;
- else if (!islower ((unsigned char) at (tos, idx)))
- --command;
- }
- else if (at (tos, idx) == '@'
- && islower ((unsigned char) at (tos, idx + 1)))
- {
- ++command;
- }
- else if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
- {
- cattext (&out, "/*");
- idx += 2;
- continue;
- }
- else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
- {
- cattext (&out, "*/");
- idx += 2;
- continue;
- }
- else if (at (tos, idx) == '{'
- || at (tos, idx) == '}')
- {
- catchar (&out, '@');
- }
-
- catchar (&out, at (tos, idx));
- idx++;
- }
- catchar (&out, '\n');
- }
- while (at (tos, idx) == '\n'
- && ((at (tos, idx + 1) == '.')
- || (at (tos, idx + 1) == '|')))
- ;
- cattext (&out, "@end example");
- }
- else
- {
- catchar (&out, at (tos, idx));
- idx++;
- }
- }
-
- overwrite_string (tos, &out);
- pc++;
-}
-
-/* Finds any lines starting with "o ", if there are any, then turns
- on @itemize @bullet, and @items each of them. Then ends with @end
- itemize, inplace at TOS*/
-
-static void
-bulletize ()
-{
- unsigned int idx = 0;
- int on = 0;
- string_type out;
- init_string (&out);
-
- while (at (tos, idx))
- {
- if (at (tos, idx) == '@'
- && at (tos, idx + 1) == '*')
- {
- cattext (&out, "*");
- idx += 2;
- }
- else if (at (tos, idx) == '\n'
- && at (tos, idx + 1) == 'o'
- && isspace ((unsigned char) at (tos, idx + 2)))
- {
- if (!on)
- {
- cattext (&out, "\n@itemize @bullet\n");
- on = 1;
-
- }
- cattext (&out, "\n@item\n");
- idx += 3;
- }
- else
- {
- catchar (&out, at (tos, idx));
- if (on && at (tos, idx) == '\n'
- && at (tos, idx + 1) == '\n'
- && at (tos, idx + 2) != 'o')
- {
- cattext (&out, "@end itemize");
- on = 0;
- }
- idx++;
-
- }
- }
- if (on)
- {
- cattext (&out, "@end itemize\n");
- }
-
- delete_string (tos);
- *tos = out;
- pc++;
-}
-
-/* Turn <<foo>> into @code{foo} in place at TOS*/
-
-static void
-do_fancy_stuff ()
-{
- unsigned int idx = 0;
- string_type out;
- init_string (&out);
- while (at (tos, idx))
- {
- if (at (tos, idx) == '<'
- && at (tos, idx + 1) == '<'
- && !isspace ((unsigned char) at (tos, idx + 2)))
- {
- /* This qualifies as a << startup. */
- idx += 2;
- cattext (&out, "@code{");
- while (at (tos, idx)
- && at (tos, idx) != '>' )
- {
- catchar (&out, at (tos, idx));
- idx++;
-
- }
- cattext (&out, "}");
- idx += 2;
- }
- else
- {
- catchar (&out, at (tos, idx));
- idx++;
- }
- }
- delete_string (tos);
- *tos = out;
- pc++;
-
-}
-
-/* A command is all upper case,and alone on a line. */
-
-static int
-iscommand (ptr, idx)
- string_type *ptr;
- unsigned int idx;
-{
- unsigned int len = 0;
- while (at (ptr, idx))
- {
- if (isupper ((unsigned char) at (ptr, idx))
- || at (ptr, idx) == ' ' || at (ptr, idx) == '_')
- {
- len++;
- idx++;
- }
- else if (at (ptr, idx) == '\n')
- {
- if (len > 3)
- return 1;
- return 0;
- }
- else
- return 0;
- }
- return 0;
-}
-
-static int
-copy_past_newline (ptr, idx, dst)
- string_type *ptr;
- unsigned int idx;
- string_type *dst;
-{
- int column = 0;
-
- while (at (ptr, idx) && at (ptr, idx) != '\n')
- {
- if (at (ptr, idx) == '\t')
- {
- /* Expand tabs. Neither makeinfo nor TeX can cope well with
- them. */
- do
- catchar (dst, ' ');
- while (++column & 7);
- }
- else
- {
- catchar (dst, at (ptr, idx));
- column++;
- }
- idx++;
-
- }
- catchar (dst, at (ptr, idx));
- idx++;
- return idx;
-
-}
-
-static void
-icopy_past_newline ()
-{
- tos++;
- check_range ();
- init_string (tos);
- idx = copy_past_newline (ptr, idx, tos);
- pc++;
-}
-
-/* indent
- Take the string at the top of the stack, do some prettying. */
-
-static void
-kill_bogus_lines ()
-{
- int sl;
-
- int idx = 0;
- int c;
- int dot = 0;
-
- string_type out;
- init_string (&out);
- /* Drop leading nl. */
- while (at (tos, idx) == '\n')
- {
- idx++;
- }
- c = idx;
-
- /* If the first char is a '.' prepend a newline so that it is
- recognized properly later. */
- if (at (tos, idx) == '.')
- catchar (&out, '\n');
-
- /* Find the last char. */
- while (at (tos, idx))
- {
- idx++;
- }
-
- /* Find the last non white before the nl. */
- idx--;
-
- while (idx && isspace ((unsigned char) at (tos, idx)))
- idx--;
- idx++;
-
- /* Copy buffer upto last char, but blank lines before and after
- dots don't count. */
- sl = 1;
-
- while (c < idx)
- {
- if (at (tos, c) == '\n'
- && at (tos, c + 1) == '\n'
- && at (tos, c + 2) == '.')
- {
- /* Ignore two newlines before a dot. */
- c++;
- }
- else if (at (tos, c) == '.' && sl)
- {
- /* remember that this line started with a dot. */
- dot = 2;
- }
- else if (at (tos, c) == '\n'
- && at (tos, c + 1) == '\n'
- && dot)
- {
- c++;
- /* Ignore two newlines when last line was dot. */
- }
-
- catchar (&out, at (tos, c));
- if (at (tos, c) == '\n')
- {
- sl = 1;
-
- if (dot == 2)
- dot = 1;
- else
- dot = 0;
- }
- else
- sl = 0;
-
- c++;
-
- }
-
- /* Append nl. */
- catchar (&out, '\n');
- pc++;
- delete_string (tos);
- *tos = out;
-
-}
-
-static void
-indent ()
-{
- string_type out;
- int tab = 0;
- int idx = 0;
- int ol = 0;
- init_string (&out);
- while (at (tos, idx))
- {
- switch (at (tos, idx))
- {
- case '\n':
- cattext (&out, "\n");
- idx++;
- if (tab && at (tos, idx))
- {
- cattext (&out, " ");
- }
- ol = 0;
- break;
- case '(':
- tab++;
- if (ol == 0)
- cattext (&out, " ");
- idx++;
- cattext (&out, "(");
- ol = 1;
- break;
- case ')':
- tab--;
- cattext (&out, ")");
- idx++;
- ol = 1;
-
- break;
- default:
- catchar (&out, at (tos, idx));
- ol = 1;
-
- idx++;
- break;
- }
- }
-
- pc++;
- delete_string (tos);
- *tos = out;
-
-}
-
-static void
-get_stuff_in_command ()
-{
- tos++;
- check_range ();
- init_string (tos);
-
- while (at (ptr, idx))
- {
- if (iscommand (ptr, idx))
- break;
- idx = copy_past_newline (ptr, idx, tos);
- }
- pc++;
-}
-
-static void
-swap ()
-{
- string_type t;
-
- t = tos[0];
- tos[0] = tos[-1];
- tos[-1] = t;
- pc++;
-}
-
-static void
-other_dup ()
-{
- tos++;
- check_range ();
- init_string (tos);
- catstr (tos, tos - 1);
- pc++;
-}
-
-static void
-drop ()
-{
- tos--;
- check_range ();
- pc++;
-}
-
-static void
-idrop ()
-{
- isp--;
- icheck_range ();
- pc++;
-}
-
-static void
-icatstr ()
-{
- tos--;
- check_range ();
- catstr (tos, tos + 1);
- delete_string (tos + 1);
- pc++;
-}
-
-static void
-skip_past_newline ()
-{
- while (at (ptr, idx)
- && at (ptr, idx) != '\n')
- idx++;
- idx++;
- pc++;
-}
-
-static void
-internalmode ()
-{
- internal_mode = *(isp);
- isp--;
- icheck_range ();
- pc++;
-}
-
-static void
-maybecatstr ()
-{
- if (internal_wanted == internal_mode)
- {
- catstr (tos - 1, tos);
- }
- delete_string (tos);
- tos--;
- check_range ();
- pc++;
-}
-
-char *
-nextword (string, word)
- char *string;
- char **word;
-{
- char *word_start;
- int idx;
- char *dst;
- char *src;
-
- int length = 0;
-
- while (isspace ((unsigned char) *string) || *string == '-')
- {
- if (*string == '-')
- {
- while (*string && *string != '\n')
- string++;
-
- }
- else
- {
- string++;
- }
- }
- if (!*string)
- return 0;
-
- word_start = string;
- if (*string == '"')
- {
- do
- {
- string++;
- length++;
- if (*string == '\\')
- {
- string += 2;
- length += 2;
- }
- }
- while (*string != '"');
- }
- else
- {
- while (!isspace ((unsigned char) *string))
- {
- string++;
- length++;
-
- }
- }
-
- *word = malloc (length + 1);
-
- dst = *word;
- src = word_start;
-
- for (idx = 0; idx < length; idx++)
- {
- if (src[idx] == '\\')
- switch (src[idx + 1])
- {
- case 'n':
- *dst++ = '\n';
- idx++;
- break;
- case '"':
- case '\\':
- *dst++ = src[idx + 1];
- idx++;
- break;
- default:
- *dst++ = '\\';
- break;
- }
- else
- *dst++ = src[idx];
- }
- *dst++ = 0;
-
- if (*string)
- return string + 1;
- else
- return 0;
-}
-
-dict_type *root;
-
-dict_type *
-lookup_word (word)
- char *word;
-{
- dict_type *ptr = root;
- while (ptr)
- {
- if (strcmp (ptr->word, word) == 0)
- return ptr;
- ptr = ptr->next;
- }
- if (warning)
- fprintf (stderr, "Can't find %s\n", word);
- return 0;
-}
-
-static void
-perform ()
-{
- tos = stack;
-
- while (at (ptr, idx))
- {
- /* It's worth looking through the command list. */
- if (iscommand (ptr, idx))
- {
- char *next;
- dict_type *word;
-
- (void) nextword (addr (ptr, idx), &next);
-
- word = lookup_word (next);
-
- if (word)
- {
- exec (word);
- }
- else
- {
- if (warning)
- fprintf (stderr, "warning, %s is not recognised\n", next);
- skip_past_newline ();
- }
-
- }
- else
- skip_past_newline ();
- }
-}
-
-dict_type *
-newentry (word)
- char *word;
-{
- dict_type *new = (dict_type *) malloc (sizeof (dict_type));
- new->word = word;
- new->next = root;
- root = new;
- new->code = (stinst_type *) malloc (sizeof (stinst_type));
- new->code_length = 1;
- new->code_end = 0;
- return new;
-}
-
-unsigned int
-add_to_definition (entry, word)
- dict_type *entry;
- stinst_type word;
-{
- if (entry->code_end == entry->code_length)
- {
- entry->code_length += 2;
- entry->code =
- (stinst_type *) realloc ((char *) (entry->code),
- entry->code_length * sizeof (word_type));
- }
- entry->code[entry->code_end] = word;
-
- return entry->code_end++;
-}
-
-void
-add_intrinsic (name, func)
- char *name;
- void (*func) ();
-{
- dict_type *new = newentry (name);
- add_to_definition (new, func);
- add_to_definition (new, 0);
-}
-
-void
-add_var (name)
- char *name;
-{
- dict_type *new = newentry (name);
- add_to_definition (new, push_number);
- add_to_definition (new, (stinst_type) (&(new->var)));
- add_to_definition (new, 0);
-}
-
-void
-compile (string)
- char *string;
-{
- /* Add words to the dictionary. */
- char *word;
- string = nextword (string, &word);
- while (string && *string && word[0])
- {
- if (strcmp (word, "var") == 0)
- {
- string = nextword (string, &word);
-
- add_var (word);
- string = nextword (string, &word);
- }
- else if (word[0] == ':')
- {
- dict_type *ptr;
- /* Compile a word and add to dictionary. */
- string = nextword (string, &word);
-
- ptr = newentry (word);
- string = nextword (string, &word);
- while (word[0] != ';')
- {
- switch (word[0])
- {
- case '"':
- /* got a string, embed magic push string
- function */
- add_to_definition (ptr, push_text);
- add_to_definition (ptr, (stinst_type) (word + 1));
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- /* Got a number, embedd the magic push number
- function */
- add_to_definition (ptr, push_number);
- add_to_definition (ptr, (stinst_type) atol (word));
- break;
- default:
- add_to_definition (ptr, call);
- add_to_definition (ptr, (stinst_type) lookup_word (word));
- }
-
- string = nextword (string, &word);
- }
- add_to_definition (ptr, 0);
- string = nextword (string, &word);
- }
- else
- {
- fprintf (stderr, "syntax error at %s\n", string - 1);
- }
- }
-}
-
-static void
-bang ()
-{
- *(long *) ((isp[0])) = isp[-1];
- isp -= 2;
- icheck_range ();
- pc++;
-}
-
-static void
-atsign ()
-{
- isp[0] = *(long *) (isp[0]);
- pc++;
-}
-
-static void
-hello ()
-{
- printf ("hello\n");
- pc++;
-}
-
-static void
-stdout_ ()
-{
- isp++;
- icheck_range ();
- *isp = 1;
- pc++;
-}
-
-static void
-stderr_ ()
-{
- isp++;
- icheck_range ();
- *isp = 2;
- pc++;
-}
-
-static void
-print ()
-{
- if (*isp == 1)
- write_buffer (tos, stdout);
- else if (*isp == 2)
- write_buffer (tos, stderr);
- else
- fprintf (stderr, "print: illegal print destination `%ld'\n", *isp);
- isp--;
- tos--;
- icheck_range ();
- check_range ();
- pc++;
-}
-
-static void
-read_in (str, file)
- string_type *str;
- FILE *file;
-{
- char buff[10000];
- unsigned int r;
- do
- {
- r = fread (buff, 1, sizeof (buff), file);
- catbuf (str, buff, r);
- }
- while (r);
- buff[0] = 0;
-
- catbuf (str, buff, 1);
-}
-
-static void
-usage ()
-{
- fprintf (stderr, "usage: -[d|i|g] <file >file\n");
- exit (33);
-}
-
-/* There is no reliable way to declare exit. Sometimes it returns
- int, and sometimes it returns void. Sometimes it changes between
- OS releases. Trying to get it declared correctly in the hosts file
- is a pointless waste of time. */
-
-static void
-chew_exit ()
-{
- exit (0);
-}
-
-int
-main (ac, av)
- int ac;
- char *av[];
-{
- unsigned int i;
- string_type buffer;
- string_type pptr;
-
- init_string (&buffer);
- init_string (&pptr);
- init_string (stack + 0);
- tos = stack + 1;
- ptr = &pptr;
-
- add_intrinsic ("push_text", push_text);
- add_intrinsic ("!", bang);
- add_intrinsic ("@", atsign);
- add_intrinsic ("hello", hello);
- add_intrinsic ("stdout", stdout_);
- add_intrinsic ("stderr", stderr_);
- add_intrinsic ("print", print);
- add_intrinsic ("skip_past_newline", skip_past_newline);
- add_intrinsic ("catstr", icatstr);
- add_intrinsic ("copy_past_newline", icopy_past_newline);
- add_intrinsic ("dup", other_dup);
- add_intrinsic ("drop", drop);
- add_intrinsic ("idrop", idrop);
- add_intrinsic ("remchar", remchar);
- add_intrinsic ("get_stuff_in_command", get_stuff_in_command);
- add_intrinsic ("do_fancy_stuff", do_fancy_stuff);
- add_intrinsic ("bulletize", bulletize);
- add_intrinsic ("courierize", courierize);
- /* If the following line gives an error, exit() is not declared in the
- ../hosts/foo.h file for this host. Fix it there, not here! */
- /* No, don't fix it anywhere; see comment on chew_exit--Ian Taylor. */
- add_intrinsic ("exit", chew_exit);
- add_intrinsic ("swap", swap);
- add_intrinsic ("outputdots", outputdots);
- add_intrinsic ("paramstuff", paramstuff);
- add_intrinsic ("maybecatstr", maybecatstr);
- add_intrinsic ("translatecomments", translatecomments);
- add_intrinsic ("kill_bogus_lines", kill_bogus_lines);
- add_intrinsic ("indent", indent);
- add_intrinsic ("internalmode", internalmode);
- add_intrinsic ("print_stack_level", print_stack_level);
- add_intrinsic ("strip_trailing_newlines", strip_trailing_newlines);
-
- /* Put a nl at the start. */
- catchar (&buffer, '\n');
-
- read_in (&buffer, stdin);
- remove_noncomments (&buffer, ptr);
- for (i = 1; i < (unsigned int) ac; i++)
- {
- if (av[i][0] == '-')
- {
- if (av[i][1] == 'f')
- {
- string_type b;
- FILE *f;
- init_string (&b);
-
- f = fopen (av[i + 1], "r");
- if (!f)
- {
- fprintf (stderr, "Can't open the input file %s\n",
- av[i + 1]);
- return 33;
- }
-
- read_in (&b, f);
- compile (b.ptr);
- perform ();
- }
- else if (av[i][1] == 'i')
- {
- internal_wanted = 1;
- }
- else if (av[i][1] == 'w')
- {
- warning = 1;
- }
- else
- usage ();
- }
- }
- write_buffer (stack + 0, stdout);
- if (tos != stack)
- {
- fprintf (stderr, "finishing with current stack level %d\n",
- tos - stack);
- return 1;
- }
- return 0;
-}
diff --git a/contrib/binutils/bfd/doc/coffcode.texi b/contrib/binutils/bfd/doc/coffcode.texi
deleted file mode 100644
index f9e15a6..0000000
--- a/contrib/binutils/bfd/doc/coffcode.texi
+++ /dev/null
@@ -1,608 +0,0 @@
-@section coff backends
-BFD supports a number of different flavours of coff format.
-The major differences between formats are the sizes and
-alignments of fields in structures on disk, and the occasional
-extra field.
-
-Coff in all its varieties is implemented with a few common
-files and a number of implementation specific files. For
-example, The 88k bcs coff format is implemented in the file
-@file{coff-m88k.c}. This file @code{#include}s
-@file{coff/m88k.h} which defines the external structure of the
-coff format for the 88k, and @file{coff/internal.h} which
-defines the internal structure. @file{coff-m88k.c} also
-defines the relocations used by the 88k format
-@xref{Relocations}.
-
-The Intel i960 processor version of coff is implemented in
-@file{coff-i960.c}. This file has the same structure as
-@file{coff-m88k.c}, except that it includes @file{coff/i960.h}
-rather than @file{coff-m88k.h}.
-
-@subsection Porting to a new version of coff
-The recommended method is to select from the existing
-implementations the version of coff which is most like the one
-you want to use. For example, we'll say that i386 coff is
-the one you select, and that your coff flavour is called foo.
-Copy @file{i386coff.c} to @file{foocoff.c}, copy
-@file{../include/coff/i386.h} to @file{../include/coff/foo.h},
-and add the lines to @file{targets.c} and @file{Makefile.in}
-so that your new back end is used. Alter the shapes of the
-structures in @file{../include/coff/foo.h} so that they match
-what you need. You will probably also have to add
-@code{#ifdef}s to the code in @file{coff/internal.h} and
-@file{coffcode.h} if your version of coff is too wild.
-
-You can verify that your new BFD backend works quite simply by
-building @file{objdump} from the @file{binutils} directory,
-and making sure that its version of what's going on and your
-host system's idea (assuming it has the pretty standard coff
-dump utility, usually called @code{att-dump} or just
-@code{dump}) are the same. Then clean up your code, and send
-what you've done to Cygnus. Then your stuff will be in the
-next release, and you won't have to keep integrating it.
-
-@subsection How the coff backend works
-
-
-@subsubsection File layout
-The Coff backend is split into generic routines that are
-applicable to any Coff target and routines that are specific
-to a particular target. The target-specific routines are
-further split into ones which are basically the same for all
-Coff targets except that they use the external symbol format
-or use different values for certain constants.
-
-The generic routines are in @file{coffgen.c}. These routines
-work for any Coff target. They use some hooks into the target
-specific code; the hooks are in a @code{bfd_coff_backend_data}
-structure, one of which exists for each target.
-
-The essentially similar target-specific routines are in
-@file{coffcode.h}. This header file includes executable C code.
-The various Coff targets first include the appropriate Coff
-header file, make any special defines that are needed, and
-then include @file{coffcode.h}.
-
-Some of the Coff targets then also have additional routines in
-the target source file itself.
-
-For example, @file{coff-i960.c} includes
-@file{coff/internal.h} and @file{coff/i960.h}. It then
-defines a few constants, such as @code{I960}, and includes
-@file{coffcode.h}. Since the i960 has complex relocation
-types, @file{coff-i960.c} also includes some code to
-manipulate the i960 relocs. This code is not in
-@file{coffcode.h} because it would not be used by any other
-target.
-
-@subsubsection Bit twiddling
-Each flavour of coff supported in BFD has its own header file
-describing the external layout of the structures. There is also
-an internal description of the coff layout, in
-@file{coff/internal.h}. A major function of the
-coff backend is swapping the bytes and twiddling the bits to
-translate the external form of the structures into the normal
-internal form. This is all performed in the
-@code{bfd_swap}_@i{thing}_@i{direction} routines. Some
-elements are different sizes between different versions of
-coff; it is the duty of the coff version specific include file
-to override the definitions of various packing routines in
-@file{coffcode.h}. E.g., the size of line number entry in coff is
-sometimes 16 bits, and sometimes 32 bits. @code{#define}ing
-@code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the
-correct one. No doubt, some day someone will find a version of
-coff which has a varying field size not catered to at the
-moment. To port BFD, that person will have to add more @code{#defines}.
-Three of the bit twiddling routines are exported to
-@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in}
-and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol
-table on its own, but uses BFD to fix things up. More of the
-bit twiddlers are exported for @code{gas};
-@code{coff_swap_aux_out}, @code{coff_swap_sym_out},
-@code{coff_swap_lineno_out}, @code{coff_swap_reloc_out},
-@code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out},
-@code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track
-of all the symbol table and reloc drudgery itself, thereby
-saving the internal BFD overhead, but uses BFD to swap things
-on the way out, making cross ports much safer. Doing so also
-allows BFD (and thus the linker) to use the same header files
-as @code{gas}, which makes one avenue to disaster disappear.
-
-@subsubsection Symbol reading
-The simple canonical form for symbols used by BFD is not rich
-enough to keep all the information available in a coff symbol
-table. The back end gets around this problem by keeping the original
-symbol table around, "behind the scenes".
-
-When a symbol table is requested (through a call to
-@code{bfd_canonicalize_symtab}), a request gets through to
-@code{coff_get_normalized_symtab}. This reads the symbol table from
-the coff file and swaps all the structures inside into the
-internal form. It also fixes up all the pointers in the table
-(represented in the file by offsets from the first symbol in
-the table) into physical pointers to elements in the new
-internal table. This involves some work since the meanings of
-fields change depending upon context: a field that is a
-pointer to another structure in the symbol table at one moment
-may be the size in bytes of a structure at the next. Another
-pass is made over the table. All symbols which mark file names
-(@code{C_FILE} symbols) are modified so that the internal
-string points to the value in the auxent (the real filename)
-rather than the normal text associated with the symbol
-(@code{".file"}).
-
-At this time the symbol names are moved around. Coff stores
-all symbols less than nine characters long physically
-within the symbol table; longer strings are kept at the end of
-the file in the string table. This pass moves all strings
-into memory and replaces them with pointers to the strings.
-
-The symbol table is massaged once again, this time to create
-the canonical table used by the BFD application. Each symbol
-is inspected in turn, and a decision made (using the
-@code{sclass} field) about the various flags to set in the
-@code{asymbol}. @xref{Symbols}. The generated canonical table
-shares strings with the hidden internal symbol table.
-
-Any linenumbers are read from the coff file too, and attached
-to the symbols which own the functions the linenumbers belong to.
-
-@subsubsection Symbol writing
-Writing a symbol to a coff file which didn't come from a coff
-file will lose any debugging information. The @code{asymbol}
-structure remembers the BFD from which the symbol was taken, and on
-output the back end makes sure that the same destination target as
-source target is present.
-
-When the symbols have come from a coff file then all the
-debugging information is preserved.
-
-Symbol tables are provided for writing to the back end in a
-vector of pointers to pointers. This allows applications like
-the linker to accumulate and output large symbol tables
-without having to do too much byte copying.
-
-This function runs through the provided symbol table and
-patches each symbol marked as a file place holder
-(@code{C_FILE}) to point to the next file place holder in the
-list. It also marks each @code{offset} field in the list with
-the offset from the first symbol of the current symbol.
-
-Another function of this procedure is to turn the canonical
-value form of BFD into the form used by coff. Internally, BFD
-expects symbol values to be offsets from a section base; so a
-symbol physically at 0x120, but in a section starting at
-0x100, would have the value 0x20. Coff expects symbols to
-contain their final value, so symbols have their values
-changed at this point to reflect their sum with their owning
-section. This transformation uses the
-@code{output_section} field of the @code{asymbol}'s
-@code{asection} @xref{Sections}.
-
-@itemize @bullet
-
-@item
-@code{coff_mangle_symbols}
-@end itemize
-This routine runs though the provided symbol table and uses
-the offsets generated by the previous pass and the pointers
-generated when the symbol table was read in to create the
-structured hierarchy required by coff. It changes each pointer
-to a symbol into the index into the symbol table of the asymbol.
-
-@itemize @bullet
-
-@item
-@code{coff_write_symbols}
-@end itemize
-This routine runs through the symbol table and patches up the
-symbols from their internal form into the coff way, calls the
-bit twiddlers, and writes out the table to the file.
-
-@findex coff_symbol_type
-@subsubsection @code{coff_symbol_type}
-@strong{Description}@*
-The hidden information for an @code{asymbol} is described in a
-@code{combined_entry_type}:
-
-
-@example
-
-typedef struct coff_ptr_struct
-@{
- /* Remembers the offset from the first symbol in the file for
- this symbol. Generated by coff_renumber_symbols. */
- unsigned int offset;
-
- /* Should the value of this symbol be renumbered. Used for
- XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
- unsigned int fix_value : 1;
-
- /* Should the tag field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_tag : 1;
-
- /* Should the endidx field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_end : 1;
-
- /* Should the x_csect.x_scnlen field be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_scnlen : 1;
-
- /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
- index into the line number entries. Set by coff_slurp_symbol_table. */
- unsigned int fix_line : 1;
-
- /* The container for the symbol structure as read and translated
- from the file. */
- union
- @{
- union internal_auxent auxent;
- struct internal_syment syment;
- @} u;
-@} combined_entry_type;
-
-
-/* Each canonical asymbol really looks like this: */
-
-typedef struct coff_symbol_struct
-@{
- /* The actual symbol which the rest of BFD works with */
- asymbol symbol;
-
- /* A pointer to the hidden information for this symbol */
- combined_entry_type *native;
-
- /* A pointer to the linenumber information for this symbol */
- struct lineno_cache_entry *lineno;
-
- /* Have the line numbers been relocated yet ? */
- bfd_boolean done_lineno;
-@} coff_symbol_type;
-@end example
-@findex bfd_coff_backend_data
-@subsubsection @code{bfd_coff_backend_data}
-
-@example
-/* COFF symbol classifications. */
-
-enum coff_symbol_classification
-@{
- /* Global symbol. */
- COFF_SYMBOL_GLOBAL,
- /* Common symbol. */
- COFF_SYMBOL_COMMON,
- /* Undefined symbol. */
- COFF_SYMBOL_UNDEFINED,
- /* Local symbol. */
- COFF_SYMBOL_LOCAL,
- /* PE section symbol. */
- COFF_SYMBOL_PE_SECTION
-@};
-
-@end example
-Special entry points for gdb to swap in coff symbol table parts:
-@example
-typedef struct
-@{
- void (*_bfd_coff_swap_aux_in)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-
- void (*_bfd_coff_swap_sym_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_lineno_in)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_aux_out)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-
- unsigned int (*_bfd_coff_swap_sym_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_lineno_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_reloc_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_filehdr_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_aouthdr_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_scnhdr_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int _bfd_filhsz;
- unsigned int _bfd_aoutsz;
- unsigned int _bfd_scnhsz;
- unsigned int _bfd_symesz;
- unsigned int _bfd_auxesz;
- unsigned int _bfd_relsz;
- unsigned int _bfd_linesz;
- unsigned int _bfd_filnmlen;
- bfd_boolean _bfd_coff_long_filenames;
- bfd_boolean _bfd_coff_long_section_names;
- unsigned int _bfd_coff_default_section_alignment_power;
- bfd_boolean _bfd_coff_force_symnames_in_strings;
- unsigned int _bfd_coff_debug_string_prefix_length;
-
- void (*_bfd_coff_swap_filehdr_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_aouthdr_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_scnhdr_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_reloc_in)
- PARAMS ((bfd *abfd, PTR, PTR));
-
- bfd_boolean (*_bfd_coff_bad_format_hook)
- PARAMS ((bfd *, PTR));
-
- bfd_boolean (*_bfd_coff_set_arch_mach_hook)
- PARAMS ((bfd *, PTR));
-
- PTR (*_bfd_coff_mkobject_hook)
- PARAMS ((bfd *, PTR, PTR));
-
- bfd_boolean (*_bfd_styp_to_sec_flags_hook)
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-
- void (*_bfd_set_alignment_hook)
- PARAMS ((bfd *, asection *, PTR));
-
- bfd_boolean (*_bfd_coff_slurp_symbol_table)
- PARAMS ((bfd *));
-
- bfd_boolean (*_bfd_coff_symname_in_debug)
- PARAMS ((bfd *, struct internal_syment *));
-
- bfd_boolean (*_bfd_coff_pointerize_aux_hook)
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-
- bfd_boolean (*_bfd_coff_print_aux)
- PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
- combined_entry_type *, unsigned int));
-
- void (*_bfd_coff_reloc16_extra_cases)
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
- bfd_byte *, unsigned int *, unsigned int *));
-
- int (*_bfd_coff_reloc16_estimate)
- PARAMS ((bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *));
-
- enum coff_symbol_classification (*_bfd_coff_classify_symbol)
- PARAMS ((bfd *, struct internal_syment *));
-
- bfd_boolean (*_bfd_coff_compute_section_file_positions)
- PARAMS ((bfd *));
-
- bfd_boolean (*_bfd_coff_start_final_link)
- PARAMS ((bfd *, struct bfd_link_info *));
-
- bfd_boolean (*_bfd_coff_relocate_section)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
- reloc_howto_type *(*_bfd_coff_rtype_to_howto)
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-
- bfd_boolean (*_bfd_coff_adjust_symndx)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, bfd_boolean *));
-
- bfd_boolean (*_bfd_coff_link_add_one_symbol)
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
-
- bfd_boolean (*_bfd_coff_link_output_has_begun)
- PARAMS ((bfd *, struct coff_final_link_info *));
-
- bfd_boolean (*_bfd_coff_final_link_postscript)
- PARAMS ((bfd *, struct coff_final_link_info *));
-
-@} bfd_coff_backend_data;
-
-#define coff_backend_info(abfd) \
- ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
-
-#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
-
-#define bfd_coff_swap_sym_in(a,e,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
-
-#define bfd_coff_swap_lineno_in(a,e,i) \
- ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
-
-#define bfd_coff_swap_reloc_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
-
-#define bfd_coff_swap_lineno_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
-
-#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
-
-#define bfd_coff_swap_sym_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_filehdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
-
-#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
-#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
-#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
-#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
-#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
-#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
-#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
-#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
-#define bfd_coff_long_filenames(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_filenames)
-#define bfd_coff_long_section_names(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_section_names)
-#define bfd_coff_default_section_alignment_power(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
-#define bfd_coff_swap_filehdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_reloc_in(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
-
-#define bfd_coff_bad_format_hook(abfd, filehdr) \
- ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
-
-#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
- ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
-#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
- ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\
- (abfd, filehdr, aouthdr))
-
-#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
- ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
- (abfd, scnhdr, name, section, flags_ptr))
-
-#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
- ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
-
-#define bfd_coff_slurp_symbol_table(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
-
-#define bfd_coff_symname_in_debug(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
-
-#define bfd_coff_force_symnames_in_strings(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
-
-#define bfd_coff_debug_string_prefix_length(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
-
-#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
- ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
- (abfd, file, base, symbol, aux, indaux))
-
-#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
- reloc, data, src_ptr, dst_ptr)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
- (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
-
-#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
- (abfd, section, reloc, shrink, link_info))
-
-#define bfd_coff_classify_symbol(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
- (abfd, sym))
-
-#define bfd_coff_compute_section_file_positions(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
- (abfd))
-
-#define bfd_coff_start_final_link(obfd, info)\
- ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
- (obfd, info))
-#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
- ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
- (obfd, info, ibfd, o, con, rel, isyms, secs))
-#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
- ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
- (abfd, sec, rel, h, sym, addendp))
-#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
- ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
- (obfd, info, ibfd, sec, rel, adjustedp))
-#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
- value, string, cp, coll, hashp)\
- ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
- (info, abfd, name, flags, section, value, string, cp, coll, hashp))
-
-#define bfd_coff_link_output_has_begun(a,p) \
- ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
-#define bfd_coff_final_link_postscript(a,p) \
- ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
-
-@end example
-@subsubsection Writing relocations
-To write relocations, the back end steps though the
-canonical relocation table and create an
-@code{internal_reloc}. The symbol index to use is removed from
-the @code{offset} field in the symbol table supplied. The
-address comes directly from the sum of the section base
-address and the relocation offset; the type is dug directly
-from the howto field. Then the @code{internal_reloc} is
-swapped into the shape of an @code{external_reloc} and written
-out to disk.
-
-@subsubsection Reading linenumbers
-Creating the linenumber table is done by reading in the entire
-coff linenumber table, and creating another table for internal use.
-
-A coff linenumber table is structured so that each function
-is marked as having a line number of 0. Each line within the
-function is an offset from the first line in the function. The
-base of the line number information for the table is stored in
-the symbol associated with the function.
-
-Note: The PE format uses line number 0 for a flag indicating a
-new source file.
-
-The information is copied from the external to the internal
-table, and each symbol which marks a function is marked by
-pointing its...
-
-How does this work ?
-
-@subsubsection Reading relocations
-Coff relocations are easily transformed into the internal BFD form
-(@code{arelent}).
-
-Reading a coff relocation table is done in the following stages:
-
-@itemize @bullet
-
-@item
-Read the entire coff relocation table into memory.
-
-@item
-Process each relocation in turn; first swap it from the
-external to the internal form.
-
-@item
-Turn the symbol referenced in the relocation's symbol index
-into a pointer into the canonical symbol table.
-This table is the same as the one returned by a call to
-@code{bfd_canonicalize_symtab}. The back end will call that
-routine and save the result if a canonicalization hasn't been done.
-
-@item
-The reloc index is turned into a pointer to a howto
-structure, in a back end specific way. For instance, the 386
-and 960 use the @code{r_type} to directly produce an index
-into a howto table vector; the 88k subtracts a number from the
-@code{r_type} field and creates an addend field.
-@end itemize
-
diff --git a/contrib/binutils/bfd/doc/core.texi b/contrib/binutils/bfd/doc/core.texi
deleted file mode 100644
index e45759c..0000000
--- a/contrib/binutils/bfd/doc/core.texi
+++ /dev/null
@@ -1,38 +0,0 @@
-@section Core files
-
-
-@strong{Description}@*
-These are functions pertaining to core files.
-
-@findex bfd_core_file_failing_command
-@subsubsection @code{bfd_core_file_failing_command}
-@strong{Synopsis}
-@example
-const char *bfd_core_file_failing_command (bfd *abfd);
-@end example
-@strong{Description}@*
-Return a read-only string explaining which program was running
-when it failed and produced the core file @var{abfd}.
-
-@findex bfd_core_file_failing_signal
-@subsubsection @code{bfd_core_file_failing_signal}
-@strong{Synopsis}
-@example
-int bfd_core_file_failing_signal (bfd *abfd);
-@end example
-@strong{Description}@*
-Returns the signal number which caused the core dump which
-generated the file the BFD @var{abfd} is attached to.
-
-@findex core_file_matches_executable_p
-@subsubsection @code{core_file_matches_executable_p}
-@strong{Synopsis}
-@example
-bfd_boolean core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
-@end example
-@strong{Description}@*
-Return @code{TRUE} if the core file attached to @var{core_bfd}
-was generated by a run of the executable file attached to
-@var{exec_bfd}, @code{FALSE} otherwise.
-
diff --git a/contrib/binutils/bfd/doc/doc.str b/contrib/binutils/bfd/doc/doc.str
deleted file mode 100644
index 7a276fe..0000000
--- a/contrib/binutils/bfd/doc/doc.str
+++ /dev/null
@@ -1,158 +0,0 @@
-: DOCDD
- skip_past_newline
- get_stuff_in_command kill_bogus_lines catstr
- ;
-
-: ENDDD
- skip_past_newline
- ;
-
-: EXAMPLE
- skip_past_newline
- get_stuff_in_command kill_bogus_lines do_fancy_stuff translatecomments
- courierize catstr
-
- ;
-
-: INODE
- "@node " catstr skip_past_newline copy_past_newline catstr
- ;
-
-: CODE_FRAGMENT
- EXAMPLE
- ;
-
-: COMMENT
- skip_past_newline
- get_stuff_in_command
- drop
- ;
-
-: SYNOPSIS
- skip_past_newline
- "@strong{Synopsis}\n" catstr
- "@example\n" catstr
- get_stuff_in_command
- kill_bogus_lines
- indent
- catstr
- "@end example\n" catstr
-
- ;
-
-: func
- "@findex " - a
- skip_past_newline
- copy_past_newline
- dup - a x x
- "@subsubsection @code{" - a x x b
- swap
- remchar
- "}\n" - a x b x c
- catstr catstr catstr catstr catstr
- ;
-
-: FUNCTION
- "@findex " - a
- skip_past_newline
- copy_past_newline
- dup - a x x
- "@subsubsection @code{" - a x x b
- swap
- remchar
- "}\n" - a x b x c
- catstr catstr catstr catstr catstr
- ;
-
-: bodytext
- get_stuff_in_command
- bulletize
- kill_bogus_lines
- do_fancy_stuff
- courierize
- catstr
- "\n" catstr
- ;
-
-: asection
- skip_past_newline
- catstr
- copy_past_newline
- do_fancy_stuff catstr
- bodytext
- ;
-
-: SECTION
- "@section " asection ;
-
-: SUBSECTION
- "@subsection " asection ;
-
-: SUBSUBSECTION
- "@subsubsection " asection ;
-
-: subhead
- skip_past_newline
- bodytext
- ;
-
-
-
-
-: DESCRIPTION
- "@strong{Description}@*\n" catstr subhead ;
-
-: RETURNS
- "@strong{Returns}@*\n" catstr subhead ;
-
-: INTERNAL_FUNCTION
- func ;
-
-
-: INTERNAL_DEFINITION
- func ;
-
-
-: INTERNAL
- func ;
-
-: TYPEDEF
- FUNCTION ;
-
-: SENUM
- skip_past_newline
- "Here are the possible values for @code{enum "
- copy_past_newline remchar catstr
- "}:\n\n" catstr catstr
- ;
-: ENUM
- skip_past_newline
- "@deffn {} "
- copy_past_newline catstr catstr
- ;
-: ENUMX
- skip_past_newline
- "@deffnx {} "
- copy_past_newline catstr
- catstr
- ;
-: ENUMEQ
- skip_past_newline
- "@deffn {} "
- copy_past_newline catstr catstr
- skip_past_newline
- ;
-: ENUMEQX
- skip_past_newline
- "@deffnx {} "
- copy_past_newline catstr
- catstr
- skip_past_newline
- ;
-: ENUMDOC
- skip_past_newline
- get_stuff_in_command
- strip_trailing_newlines
- catstr
- "\n@end deffn\n" catstr
- ;
diff --git a/contrib/binutils/bfd/doc/elf.texi b/contrib/binutils/bfd/doc/elf.texi
deleted file mode 100644
index 101001c..0000000
--- a/contrib/binutils/bfd/doc/elf.texi
+++ /dev/null
@@ -1,24 +0,0 @@
-@section
-ELF backends
-
-BFD support for ELF formats is being worked on.
-Currently, the best supported back ends are for sparc and i386
-(running svr4 or Solaris 2).
-
-Documentation of the internals of the support code still needs
-to be written. The code is changing quickly enough that we
-haven't bothered yet.
-
-@findex bfd_elf_find_section
-@subsubsection @code{bfd_elf_find_section}
-@strong{Synopsis}
-@example
-struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
-@end example
-@strong{Description}@*
-Helper functions for GDB to locate the string tables.
-Since BFD hides string tables from callers, GDB needs to use an
-internal hook to find them. Sun's .stabstr, in particular,
-isn't even pointed to by the .stab section, so ordinary
-mechanisms wouldn't work to find it, even if we had some.
-
diff --git a/contrib/binutils/bfd/doc/elfcode.texi b/contrib/binutils/bfd/doc/elfcode.texi
deleted file mode 100644
index e69de29..0000000
--- a/contrib/binutils/bfd/doc/elfcode.texi
+++ /dev/null
diff --git a/contrib/binutils/bfd/doc/fdl.texi b/contrib/binutils/bfd/doc/fdl.texi
deleted file mode 100644
index 176233c..0000000
--- a/contrib/binutils/bfd/doc/fdl.texi
+++ /dev/null
@@ -1,366 +0,0 @@
-@c -*-texinfo-*-
-@appendix GNU Free Documentation License
-@center Version 1.1, March 2000
-
-@display
-Copyright (C) 2000, Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-@end display
-@sp 1
-@enumerate 0
-@item
-PREAMBLE
-
-The purpose of this License is to make a manual, textbook, or other
-written document ``free'' in the sense of freedom: to assure everyone
-the effective freedom to copy and redistribute it, with or without
-modifying it, either commercially or noncommercially. Secondarily,
-this License preserves for the author and publisher a way to get
-credit for their work, while not being considered responsible for
-modifications made by others.
-
-This License is a kind of ``copyleft'', which means that derivative
-works of the document must themselves be free in the same sense. It
-complements the GNU General Public License, which is a copyleft
-license designed for free software.
-
-We have designed this License in order to use it for manuals for free
-software, because free software needs free documentation: a free
-program should come with manuals providing the same freedoms that the
-software does. But this License is not limited to software manuals;
-it can be used for any textual work, regardless of subject matter or
-whether it is published as a printed book. We recommend this License
-principally for works whose purpose is instruction or reference.
-
-@sp 1
-@item
-APPLICABILITY AND DEFINITIONS
-
-This License applies to any manual or other work that contains a
-notice placed by the copyright holder saying it can be distributed
-under the terms of this License. The ``Document'', below, refers to any
-such manual or work. Any member of the public is a licensee, and is
-addressed as ``you.''
-
-A ``Modified Version'' of the Document means any work containing the
-Document or a portion of it, either copied verbatim, or with
-modifications and/or translated into another language.
-
-A ``Secondary Section'' is a named appendix or a front-matter section of
-the Document that deals exclusively with the relationship of the
-publishers or authors of the Document to the Document's overall subject
-(or to related matters) and contains nothing that could fall directly
-within that overall subject. (For example, if the Document is in part a
-textbook of mathematics, a Secondary Section may not explain any
-mathematics.) The relationship could be a matter of historical
-connection with the subject or with related matters, or of legal,
-commercial, philosophical, ethical or political position regarding
-them.
-
-The ``Invariant Sections'' are certain Secondary Sections whose titles
-are designated, as being those of Invariant Sections, in the notice
-that says that the Document is released under this License.
-
-The ``Cover Texts'' are certain short passages of text that are listed,
-as Front-Cover Texts or Back-Cover Texts, in the notice that says that
-the Document is released under this License.
-
-A ``Transparent'' copy of the Document means a machine-readable copy,
-represented in a format whose specification is available to the
-general public, whose contents can be viewed and edited directly and
-straightforwardly with generic text editors or (for images composed of
-pixels) generic paint programs or (for drawings) some widely available
-drawing editor, and that is suitable for input to text formatters or
-for automatic translation to a variety of formats suitable for input
-to text formatters. A copy made in an otherwise Transparent file
-format whose markup has been designed to thwart or discourage
-subsequent modification by readers is not Transparent. A copy that is
-not ``Transparent'' is called ``Opaque.''
-
-Examples of suitable formats for Transparent copies include plain
-ASCII without markup, Texinfo input format, LaTeX input format, SGML
-or XML using a publicly available DTD, and standard-conforming simple
-HTML designed for human modification. Opaque formats include
-PostScript, PDF, proprietary formats that can be read and edited only
-by proprietary word processors, SGML or XML for which the DTD and/or
-processing tools are not generally available, and the
-machine-generated HTML produced by some word processors for output
-purposes only.
-
-The ``Title Page'' means, for a printed book, the title page itself,
-plus such following pages as are needed to hold, legibly, the material
-this License requires to appear in the title page. For works in
-formats which do not have any title page as such, ``Title Page'' means
-the text near the most prominent appearance of the work's title,
-preceding the beginning of the body of the text.
-@sp 1
-@item
-VERBATIM COPYING
-
-You may copy and distribute the Document in any medium, either
-commercially or noncommercially, provided that this License, the
-copyright notices, and the license notice saying this License applies
-to the Document are reproduced in all copies, and that you add no other
-conditions whatsoever to those of this License. You may not use
-technical measures to obstruct or control the reading or further
-copying of the copies you make or distribute. However, you may accept
-compensation in exchange for copies. If you distribute a large enough
-number of copies you must also follow the conditions in section 3.
-
-You may also lend copies, under the same conditions stated above, and
-you may publicly display copies.
-@sp 1
-@item
-COPYING IN QUANTITY
-
-If you publish printed copies of the Document numbering more than 100,
-and the Document's license notice requires Cover Texts, you must enclose
-the copies in covers that carry, clearly and legibly, all these Cover
-Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
-the back cover. Both covers must also clearly and legibly identify
-you as the publisher of these copies. The front cover must present
-the full title with all words of the title equally prominent and
-visible. You may add other material on the covers in addition.
-Copying with changes limited to the covers, as long as they preserve
-the title of the Document and satisfy these conditions, can be treated
-as verbatim copying in other respects.
-
-If the required texts for either cover are too voluminous to fit
-legibly, you should put the first ones listed (as many as fit
-reasonably) on the actual cover, and continue the rest onto adjacent
-pages.
-
-If you publish or distribute Opaque copies of the Document numbering
-more than 100, you must either include a machine-readable Transparent
-copy along with each Opaque copy, or state in or with each Opaque copy
-a publicly-accessible computer-network location containing a complete
-Transparent copy of the Document, free of added material, which the
-general network-using public has access to download anonymously at no
-charge using public-standard network protocols. If you use the latter
-option, you must take reasonably prudent steps, when you begin
-distribution of Opaque copies in quantity, to ensure that this
-Transparent copy will remain thus accessible at the stated location
-until at least one year after the last time you distribute an Opaque
-copy (directly or through your agents or retailers) of that edition to
-the public.
-
-It is requested, but not required, that you contact the authors of the
-Document well before redistributing any large number of copies, to give
-them a chance to provide you with an updated version of the Document.
-@sp 1
-@item
-MODIFICATIONS
-
-You may copy and distribute a Modified Version of the Document under
-the conditions of sections 2 and 3 above, provided that you release
-the Modified Version under precisely this License, with the Modified
-Version filling the role of the Document, thus licensing distribution
-and modification of the Modified Version to whoever possesses a copy
-of it. In addition, you must do these things in the Modified Version:
-
-A. Use in the Title Page (and on the covers, if any) a title distinct
- from that of the Document, and from those of previous versions
- (which should, if there were any, be listed in the History section
- of the Document). You may use the same title as a previous version
- if the original publisher of that version gives permission.@*
-B. List on the Title Page, as authors, one or more persons or entities
- responsible for authorship of the modifications in the Modified
- Version, together with at least five of the principal authors of the
- Document (all of its principal authors, if it has less than five).@*
-C. State on the Title page the name of the publisher of the
- Modified Version, as the publisher.@*
-D. Preserve all the copyright notices of the Document.@*
-E. Add an appropriate copyright notice for your modifications
- adjacent to the other copyright notices.@*
-F. Include, immediately after the copyright notices, a license notice
- giving the public permission to use the Modified Version under the
- terms of this License, in the form shown in the Addendum below.@*
-G. Preserve in that license notice the full lists of Invariant Sections
- and required Cover Texts given in the Document's license notice.@*
-H. Include an unaltered copy of this License.@*
-I. Preserve the section entitled ``History'', and its title, and add to
- it an item stating at least the title, year, new authors, and
- publisher of the Modified Version as given on the Title Page. If
- there is no section entitled ``History'' in the Document, create one
- stating the title, year, authors, and publisher of the Document as
- given on its Title Page, then add an item describing the Modified
- Version as stated in the previous sentence.@*
-J. Preserve the network location, if any, given in the Document for
- public access to a Transparent copy of the Document, and likewise
- the network locations given in the Document for previous versions
- it was based on. These may be placed in the ``History'' section.
- You may omit a network location for a work that was published at
- least four years before the Document itself, or if the original
- publisher of the version it refers to gives permission.@*
-K. In any section entitled ``Acknowledgements'' or ``Dedications'',
- preserve the section's title, and preserve in the section all the
- substance and tone of each of the contributor acknowledgements
- and/or dedications given therein.@*
-L. Preserve all the Invariant Sections of the Document,
- unaltered in their text and in their titles. Section numbers
- or the equivalent are not considered part of the section titles.@*
-M. Delete any section entitled ``Endorsements.'' Such a section
- may not be included in the Modified Version.@*
-N. Do not retitle any existing section as ``Endorsements''
- or to conflict in title with any Invariant Section.@*
-@sp 1
-If the Modified Version includes new front-matter sections or
-appendices that qualify as Secondary Sections and contain no material
-copied from the Document, you may at your option designate some or all
-of these sections as invariant. To do this, add their titles to the
-list of Invariant Sections in the Modified Version's license notice.
-These titles must be distinct from any other section titles.
-
-You may add a section entitled ``Endorsements'', provided it contains
-nothing but endorsements of your Modified Version by various
-parties--for example, statements of peer review or that the text has
-been approved by an organization as the authoritative definition of a
-standard.
-
-You may add a passage of up to five words as a Front-Cover Text, and a
-passage of up to 25 words as a Back-Cover Text, to the end of the list
-of Cover Texts in the Modified Version. Only one passage of
-Front-Cover Text and one of Back-Cover Text may be added by (or
-through arrangements made by) any one entity. If the Document already
-includes a cover text for the same cover, previously added by you or
-by arrangement made by the same entity you are acting on behalf of,
-you may not add another; but you may replace the old one, on explicit
-permission from the previous publisher that added the old one.
-
-The author(s) and publisher(s) of the Document do not by this License
-give permission to use their names for publicity for or to assert or
-imply endorsement of any Modified Version.
-@sp 1
-@item
-COMBINING DOCUMENTS
-
-You may combine the Document with other documents released under this
-License, under the terms defined in section 4 above for modified
-versions, provided that you include in the combination all of the
-Invariant Sections of all of the original documents, unmodified, and
-list them all as Invariant Sections of your combined work in its
-license notice.
-
-The combined work need only contain one copy of this License, and
-multiple identical Invariant Sections may be replaced with a single
-copy. If there are multiple Invariant Sections with the same name but
-different contents, make the title of each such section unique by
-adding at the end of it, in parentheses, the name of the original
-author or publisher of that section if known, or else a unique number.
-Make the same adjustment to the section titles in the list of
-Invariant Sections in the license notice of the combined work.
-
-In the combination, you must combine any sections entitled ``History''
-in the various original documents, forming one section entitled
-``History''; likewise combine any sections entitled ``Acknowledgements'',
-and any sections entitled ``Dedications.'' You must delete all sections
-entitled ``Endorsements.''
-@sp 1
-@item
-COLLECTIONS OF DOCUMENTS
-
-You may make a collection consisting of the Document and other documents
-released under this License, and replace the individual copies of this
-License in the various documents with a single copy that is included in
-the collection, provided that you follow the rules of this License for
-verbatim copying of each of the documents in all other respects.
-
-You may extract a single document from such a collection, and distribute
-it individually under this License, provided you insert a copy of this
-License into the extracted document, and follow this License in all
-other respects regarding verbatim copying of that document.
-@sp 1
-@item
-AGGREGATION WITH INDEPENDENT WORKS
-
-A compilation of the Document or its derivatives with other separate
-and independent documents or works, in or on a volume of a storage or
-distribution medium, does not as a whole count as a Modified Version
-of the Document, provided no compilation copyright is claimed for the
-compilation. Such a compilation is called an ``aggregate'', and this
-License does not apply to the other self-contained works thus compiled
-with the Document, on account of their being thus compiled, if they
-are not themselves derivative works of the Document.
-
-If the Cover Text requirement of section 3 is applicable to these
-copies of the Document, then if the Document is less than one quarter
-of the entire aggregate, the Document's Cover Texts may be placed on
-covers that surround only the Document within the aggregate.
-Otherwise they must appear on covers around the whole aggregate.
-@sp 1
-@item
-TRANSLATION
-
-Translation is considered a kind of modification, so you may
-distribute translations of the Document under the terms of section 4.
-Replacing Invariant Sections with translations requires special
-permission from their copyright holders, but you may include
-translations of some or all Invariant Sections in addition to the
-original versions of these Invariant Sections. You may include a
-translation of this License provided that you also include the
-original English version of this License. In case of a disagreement
-between the translation and the original English version of this
-License, the original English version will prevail.
-@sp 1
-@item
-TERMINATION
-
-You may not copy, modify, sublicense, or distribute the Document except
-as expressly provided for under this License. Any other attempt to
-copy, modify, sublicense or distribute the Document is void, and will
-automatically terminate your rights under this License. However,
-parties who have received copies, or rights, from you under this
-License will not have their licenses terminated so long as such
-parties remain in full compliance.
-@sp 1
-@item
-FUTURE REVISIONS OF THIS LICENSE
-
-The Free Software Foundation may publish new, revised versions
-of the GNU Free Documentation License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns. See
-http://www.gnu.org/copyleft/.
-
-Each version of the License is given a distinguishing version number.
-If the Document specifies that a particular numbered version of this
-License ``or any later version'' applies to it, you have the option of
-following the terms and conditions either of that specified version or
-of any later version that has been published (not as a draft) by the
-Free Software Foundation. If the Document does not specify a version
-number of this License, you may choose any version ever published (not
-as a draft) by the Free Software Foundation.
-
-@end enumerate
-
-@unnumberedsec ADDENDUM: How to use this License for your documents
-
-To use this License in a document you have written, include a copy of
-the License in the document and put the following copyright and
-license notices just after the title page:
-
-@smallexample
-@group
-Copyright (C) @var{year} @var{your name}.
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1
-or any later version published by the Free Software Foundation;
-with the Invariant Sections being @var{list their titles}, with the
-Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
-A copy of the license is included in the section entitled "GNU
-Free Documentation License."
-@end group
-@end smallexample
-
-If you have no Invariant Sections, write ``with no Invariant Sections''
-instead of saying which ones are invariant. If you have no
-Front-Cover Texts, write ``no Front-Cover Texts'' instead of
-``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts.
-
-If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of
-free software license, such as the GNU General Public License,
-to permit their use in free software.
diff --git a/contrib/binutils/bfd/doc/format.texi b/contrib/binutils/bfd/doc/format.texi
deleted file mode 100644
index 32a1d75..0000000
--- a/contrib/binutils/bfd/doc/format.texi
+++ /dev/null
@@ -1,109 +0,0 @@
-@section File formats
-A format is a BFD concept of high level file contents type. The
-formats supported by BFD are:
-
-@itemize @bullet
-
-@item
-@code{bfd_object}
-@end itemize
-The BFD may contain data, symbols, relocations and debug info.
-
-@itemize @bullet
-
-@item
-@code{bfd_archive}
-@end itemize
-The BFD contains other BFDs and an optional index.
-
-@itemize @bullet
-
-@item
-@code{bfd_core}
-@end itemize
-The BFD contains the result of an executable core dump.
-
-@findex bfd_check_format
-@subsubsection @code{bfd_check_format}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
-@end example
-@strong{Description}@*
-Verify if the file attached to the BFD @var{abfd} is compatible
-with the format @var{format} (i.e., one of @code{bfd_object},
-@code{bfd_archive} or @code{bfd_core}).
-
-If the BFD has been set to a specific target before the
-call, only the named target and format combination is
-checked. If the target has not been set, or has been set to
-@code{default}, then all the known target backends is
-interrogated to determine a match. If the default target
-matches, it is used. If not, exactly one target must recognize
-the file, or an error results.
-
-The function returns @code{TRUE} on success, otherwise @code{FALSE}
-with one of the following error codes:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or
-@code{bfd_core}.
-
-@item
-@code{bfd_error_system_call} -
-if an error occured during a read - even some file mismatches
-can cause bfd_error_system_calls.
-
-@item
-@code{file_not_recognised} -
-none of the backends recognised the file format.
-
-@item
-@code{bfd_error_file_ambiguously_recognized} -
-more than one backend recognised the file format.
-@end itemize
-
-@findex bfd_check_format_matches
-@subsubsection @code{bfd_check_format_matches}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
-@end example
-@strong{Description}@*
-Like @code{bfd_check_format}, except when it returns FALSE with
-@code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}. In that
-case, if @var{matching} is not NULL, it will be filled in with
-a NULL-terminated list of the names of the formats that matched,
-allocated with @code{malloc}.
-Then the user may choose a format and try again.
-
-When done with the list that @var{matching} points to, the caller
-should free it.
-
-@findex bfd_set_format
-@subsubsection @code{bfd_set_format}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
-@end example
-@strong{Description}@*
-This function sets the file format of the BFD @var{abfd} to the
-format @var{format}. If the target set in the BFD does not
-support the format requested, the format is invalid, or the BFD
-is not open for writing, then an error occurs.
-
-@findex bfd_format_string
-@subsubsection @code{bfd_format_string}
-@strong{Synopsis}
-@example
-const char *bfd_format_string (bfd_format format);
-@end example
-@strong{Description}@*
-Return a pointer to a const string
-@code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown},
-depending upon the value of @var{format}.
-
diff --git a/contrib/binutils/bfd/doc/hash.texi b/contrib/binutils/bfd/doc/hash.texi
deleted file mode 100644
index 3e7372c..0000000
--- a/contrib/binutils/bfd/doc/hash.texi
+++ /dev/null
@@ -1,245 +0,0 @@
-@section Hash Tables
-@cindex Hash tables
-BFD provides a simple set of hash table functions. Routines
-are provided to initialize a hash table, to free a hash table,
-to look up a string in a hash table and optionally create an
-entry for it, and to traverse a hash table. There is
-currently no routine to delete an string from a hash table.
-
-The basic hash table does not permit any data to be stored
-with a string. However, a hash table is designed to present a
-base class from which other types of hash tables may be
-derived. These derived types may store additional information
-with the string. Hash tables were implemented in this way,
-rather than simply providing a data pointer in a hash table
-entry, because they were designed for use by the linker back
-ends. The linker may create thousands of hash table entries,
-and the overhead of allocating private data and storing and
-following pointers becomes noticeable.
-
-The basic hash table code is in @code{hash.c}.
-
-@menu
-* Creating and Freeing a Hash Table::
-* Looking Up or Entering a String::
-* Traversing a Hash Table::
-* Deriving a New Hash Table Type::
-@end menu
-
-@node Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables
-@subsection Creating and freeing a hash table
-@findex bfd_hash_table_init
-@findex bfd_hash_table_init_n
-To create a hash table, create an instance of a @code{struct
-bfd_hash_table} (defined in @code{bfd.h}) and call
-@code{bfd_hash_table_init} (if you know approximately how many
-entries you will need, the function @code{bfd_hash_table_init_n},
-which takes a @var{size} argument, may be used).
-@code{bfd_hash_table_init} returns @code{FALSE} if some sort of
-error occurs.
-
-@findex bfd_hash_newfunc
-The function @code{bfd_hash_table_init} take as an argument a
-function to use to create new entries. For a basic hash
-table, use the function @code{bfd_hash_newfunc}. @xref{Deriving
-a New Hash Table Type}, for why you would want to use a
-different value for this argument.
-
-@findex bfd_hash_allocate
-@code{bfd_hash_table_init} will create an objalloc which will be
-used to allocate new entries. You may allocate memory on this
-objalloc using @code{bfd_hash_allocate}.
-
-@findex bfd_hash_table_free
-Use @code{bfd_hash_table_free} to free up all the memory that has
-been allocated for a hash table. This will not free up the
-@code{struct bfd_hash_table} itself, which you must provide.
-
-@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
-@subsection Looking up or entering a string
-@findex bfd_hash_lookup
-The function @code{bfd_hash_lookup} is used both to look up a
-string in the hash table and to create a new entry.
-
-If the @var{create} argument is @code{FALSE}, @code{bfd_hash_lookup}
-will look up a string. If the string is found, it will
-returns a pointer to a @code{struct bfd_hash_entry}. If the
-string is not found in the table @code{bfd_hash_lookup} will
-return @code{NULL}. You should not modify any of the fields in
-the returns @code{struct bfd_hash_entry}.
-
-If the @var{create} argument is @code{TRUE}, the string will be
-entered into the hash table if it is not already there.
-Either way a pointer to a @code{struct bfd_hash_entry} will be
-returned, either to the existing structure or to a newly
-created one. In this case, a @code{NULL} return means that an
-error occurred.
-
-If the @var{create} argument is @code{TRUE}, and a new entry is
-created, the @var{copy} argument is used to decide whether to
-copy the string onto the hash table objalloc or not. If
-@var{copy} is passed as @code{FALSE}, you must be careful not to
-deallocate or modify the string as long as the hash table
-exists.
-
-@node Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables
-@subsection Traversing a hash table
-@findex bfd_hash_traverse
-The function @code{bfd_hash_traverse} may be used to traverse a
-hash table, calling a function on each element. The traversal
-is done in a random order.
-
-@code{bfd_hash_traverse} takes as arguments a function and a
-generic @code{void *} pointer. The function is called with a
-hash table entry (a @code{struct bfd_hash_entry *}) and the
-generic pointer passed to @code{bfd_hash_traverse}. The function
-must return a @code{boolean} value, which indicates whether to
-continue traversing the hash table. If the function returns
-@code{FALSE}, @code{bfd_hash_traverse} will stop the traversal and
-return immediately.
-
-@node Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables
-@subsection Deriving a new hash table type
-Many uses of hash tables want to store additional information
-which each entry in the hash table. Some also find it
-convenient to store additional information with the hash table
-itself. This may be done using a derived hash table.
-
-Since C is not an object oriented language, creating a derived
-hash table requires sticking together some boilerplate
-routines with a few differences specific to the type of hash
-table you want to create.
-
-An example of a derived hash table is the linker hash table.
-The structures for this are defined in @code{bfdlink.h}. The
-functions are in @code{linker.c}.
-
-You may also derive a hash table from an already derived hash
-table. For example, the a.out linker backend code uses a hash
-table derived from the linker hash table.
-
-@menu
-* Define the Derived Structures::
-* Write the Derived Creation Routine::
-* Write Other Derived Routines::
-@end menu
-
-@node Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type
-@subsubsection Define the derived structures
-You must define a structure for an entry in the hash table,
-and a structure for the hash table itself.
-
-The first field in the structure for an entry in the hash
-table must be of the type used for an entry in the hash table
-you are deriving from. If you are deriving from a basic hash
-table this is @code{struct bfd_hash_entry}, which is defined in
-@code{bfd.h}. The first field in the structure for the hash
-table itself must be of the type of the hash table you are
-deriving from itself. If you are deriving from a basic hash
-table, this is @code{struct bfd_hash_table}.
-
-For example, the linker hash table defines @code{struct
-bfd_link_hash_entry} (in @code{bfdlink.h}). The first field,
-@code{root}, is of type @code{struct bfd_hash_entry}. Similarly,
-the first field in @code{struct bfd_link_hash_table}, @code{table},
-is of type @code{struct bfd_hash_table}.
-
-@node Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type
-@subsubsection Write the derived creation routine
-You must write a routine which will create and initialize an
-entry in the hash table. This routine is passed as the
-function argument to @code{bfd_hash_table_init}.
-
-In order to permit other hash tables to be derived from the
-hash table you are creating, this routine must be written in a
-standard way.
-
-The first argument to the creation routine is a pointer to a
-hash table entry. This may be @code{NULL}, in which case the
-routine should allocate the right amount of space. Otherwise
-the space has already been allocated by a hash table type
-derived from this one.
-
-After allocating space, the creation routine must call the
-creation routine of the hash table type it is derived from,
-passing in a pointer to the space it just allocated. This
-will initialize any fields used by the base hash table.
-
-Finally the creation routine must initialize any local fields
-for the new hash table type.
-
-Here is a boilerplate example of a creation routine.
-@var{function_name} is the name of the routine.
-@var{entry_type} is the type of an entry in the hash table you
-are creating. @var{base_newfunc} is the name of the creation
-routine of the hash table type your hash table is derived
-from.
-
-
-@example
-struct bfd_hash_entry *
-@var{function_name} (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-@{
- struct @var{entry_type} *ret = (@var{entry_type} *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- derived class. */
- if (ret == (@var{entry_type} *) NULL)
- @{
- ret = ((@var{entry_type} *)
- bfd_hash_allocate (table, sizeof (@var{entry_type})));
- if (ret == (@var{entry_type} *) NULL)
- return NULL;
- @}
-
- /* Call the allocation method of the base class. */
- ret = ((@var{entry_type} *)
- @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string));
-
- /* Initialize the local fields here. */
-
- return (struct bfd_hash_entry *) ret;
-@}
-@end example
-@strong{Description}@*
-The creation routine for the linker hash table, which is in
-@code{linker.c}, looks just like this example.
-@var{function_name} is @code{_bfd_link_hash_newfunc}.
-@var{entry_type} is @code{struct bfd_link_hash_entry}.
-@var{base_newfunc} is @code{bfd_hash_newfunc}, the creation
-routine for a basic hash table.
-
-@code{_bfd_link_hash_newfunc} also initializes the local fields
-in a linker hash table entry: @code{type}, @code{written} and
-@code{next}.
-
-@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type
-@subsubsection Write other derived routines
-You will want to write other routines for your new hash table,
-as well.
-
-You will want an initialization routine which calls the
-initialization routine of the hash table you are deriving from
-and initializes any other local fields. For the linker hash
-table, this is @code{_bfd_link_hash_table_init} in @code{linker.c}.
-
-You will want a lookup routine which calls the lookup routine
-of the hash table you are deriving from and casts the result.
-The linker hash table uses @code{bfd_link_hash_lookup} in
-@code{linker.c} (this actually takes an additional argument which
-it uses to decide how to return the looked up value).
-
-You may want a traversal routine. This should just call the
-traversal routine of the hash table you are deriving from with
-appropriate casts. The linker hash table uses
-@code{bfd_link_hash_traverse} in @code{linker.c}.
-
-These routines may simply be defined as macros. For example,
-the a.out backend linker hash table, which is derived from the
-linker hash table, uses macros for the lookup and traversal
-routines. These are @code{aout_link_hash_lookup} and
-@code{aout_link_hash_traverse} in aoutx.h.
-
diff --git a/contrib/binutils/bfd/doc/header.sed b/contrib/binutils/bfd/doc/header.sed
deleted file mode 100644
index c58dc60..0000000
--- a/contrib/binutils/bfd/doc/header.sed
+++ /dev/null
@@ -1,13 +0,0 @@
-s|[ ][ ]*| |g
-s|\(.*\) [^ ]*header.sed.*|\1|
-s|[^ ]*/||g
-s|^ *|"|
-s| |", "|g
-s|$|"|
-s|, \([^ ]*\)$| and \1|
-s|^|/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated from |
-s|\(.\{60\}[^ ]* \)|\1\
- |g
-s|$|.\
- Run "make headers" in your build bfd/ to regenerate. */\
-|
diff --git a/contrib/binutils/bfd/doc/init.texi b/contrib/binutils/bfd/doc/init.texi
deleted file mode 100644
index 0905f6b..0000000
--- a/contrib/binutils/bfd/doc/init.texi
+++ /dev/null
@@ -1,13 +0,0 @@
-@section Initialization
-These are the functions that handle initializing a BFD.
-
-@findex bfd_init
-@subsubsection @code{bfd_init}
-@strong{Synopsis}
-@example
-void bfd_init (void);
-@end example
-@strong{Description}@*
-This routine must be called before any other BFD function to
-initialize magical internal data structures.
-
diff --git a/contrib/binutils/bfd/doc/libbfd.texi b/contrib/binutils/bfd/doc/libbfd.texi
deleted file mode 100644
index 5c9ced0..0000000
--- a/contrib/binutils/bfd/doc/libbfd.texi
+++ /dev/null
@@ -1,176 +0,0 @@
-@section Internal functions
-
-
-@strong{Description}@*
-These routines are used within BFD.
-They are not intended for export, but are documented here for
-completeness.
-
-@findex bfd_write_bigendian_4byte_int
-@subsubsection @code{bfd_write_bigendian_4byte_int}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
-@end example
-@strong{Description}@*
-Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
-endian order regardless of what else is going on. This is useful in
-archives.
-
-@findex bfd_put_size
-@subsubsection @code{bfd_put_size}
-@findex bfd_get_size
-@subsubsection @code{bfd_get_size}
-@strong{Description}@*
-These macros as used for reading and writing raw data in
-sections; each access (except for bytes) is vectored through
-the target format of the BFD and mangled accordingly. The
-mangling performs any necessary endian translations and
-removes alignment restrictions. Note that types accepted and
-returned by these macros are identical so they can be swapped
-around in macros---for example, @file{libaout.h} defines @code{GET_WORD}
-to either @code{bfd_get_32} or @code{bfd_get_64}.
-
-In the put routines, @var{val} must be a @code{bfd_vma}. If we are on a
-system without prototypes, the caller is responsible for making
-sure that is true, with a cast if necessary. We don't cast
-them in the macro definitions because that would prevent @code{lint}
-or @code{gcc -Wall} from detecting sins such as passing a pointer.
-To detect calling these with less than a @code{bfd_vma}, use
-@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s.
-@example
-
-/* Byte swapping macros for user section data. */
-
-#define bfd_put_8(abfd, val, ptr) \
- ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
-#define bfd_put_signed_8 \
- bfd_put_8
-#define bfd_get_8(abfd, ptr) \
- (*(unsigned char *) (ptr) & 0xff)
-#define bfd_get_signed_8(abfd, ptr) \
- (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-
-#define bfd_put_16(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
-#define bfd_put_signed_16 \
- bfd_put_16
-#define bfd_get_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx16, (ptr))
-#define bfd_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
-#define bfd_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
-#define bfd_put_signed_32 \
- bfd_put_32
-#define bfd_get_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx32, (ptr))
-#define bfd_get_signed_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
-
-#define bfd_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
-#define bfd_put_signed_64 \
- bfd_put_64
-#define bfd_get_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx64, (ptr))
-#define bfd_get_signed_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
-
-#define bfd_get(bits, abfd, ptr) \
- ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
- : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
- : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
- : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
- : (abort (), (bfd_vma) - 1))
-
-#define bfd_put(bits, abfd, val, ptr) \
- ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
- : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
- : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
- : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
- : (abort (), (void) 0))
-
-@end example
-
-@findex bfd_h_put_size
-@subsubsection @code{bfd_h_put_size}
-@strong{Description}@*
-These macros have the same function as their @code{bfd_get_x}
-brethren, except that they are used for removing information
-for the header records of object files. Believe it or not,
-some object files keep their header records in big endian
-order and their data in little endian order.
-@example
-
-/* Byte swapping macros for file header data. */
-
-#define bfd_h_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)
-#define bfd_h_get_8(abfd, ptr) \
- bfd_get_8 (abfd, ptr)
-#define bfd_h_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))
-#define bfd_h_put_signed_16 \
- bfd_h_put_16
-#define bfd_h_get_16(abfd, 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))
-
-#define bfd_h_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
-#define bfd_h_put_signed_32 \
- bfd_h_put_32
-#define bfd_h_get_32(abfd, 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))
-
-#define bfd_h_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
-#define bfd_h_put_signed_64 \
- bfd_h_put_64
-#define bfd_h_get_64(abfd, 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))
-
-/* Aliases for the above, which should eventually go away. */
-
-#define H_PUT_64 bfd_h_put_64
-#define H_PUT_32 bfd_h_put_32
-#define H_PUT_16 bfd_h_put_16
-#define H_PUT_8 bfd_h_put_8
-#define H_PUT_S64 bfd_h_put_signed_64
-#define H_PUT_S32 bfd_h_put_signed_32
-#define H_PUT_S16 bfd_h_put_signed_16
-#define H_PUT_S8 bfd_h_put_signed_8
-#define H_GET_64 bfd_h_get_64
-#define H_GET_32 bfd_h_get_32
-#define H_GET_16 bfd_h_get_16
-#define H_GET_8 bfd_h_get_8
-#define H_GET_S64 bfd_h_get_signed_64
-#define H_GET_S32 bfd_h_get_signed_32
-#define H_GET_S16 bfd_h_get_signed_16
-#define H_GET_S8 bfd_h_get_signed_8
-
-
-@end example
-
-@findex bfd_log2
-@subsubsection @code{bfd_log2}
-@strong{Synopsis}
-@example
-unsigned int bfd_log2 (bfd_vma x);
-@end example
-@strong{Description}@*
-Return the log base 2 of the value supplied, rounded up. E.g., an
-@var{x} of 1025 returns 11. A @var{x} of 0 returns 0.
-
diff --git a/contrib/binutils/bfd/doc/linker.texi b/contrib/binutils/bfd/doc/linker.texi
deleted file mode 100644
index f2e2bc1..0000000
--- a/contrib/binutils/bfd/doc/linker.texi
+++ /dev/null
@@ -1,365 +0,0 @@
-@section Linker Functions
-@cindex Linker
-The linker uses three special entry points in the BFD target
-vector. It is not necessary to write special routines for
-these entry points when creating a new BFD back end, since
-generic versions are provided. However, writing them can
-speed up linking and make it use significantly less runtime
-memory.
-
-The first routine creates a hash table used by the other
-routines. The second routine adds the symbols from an object
-file to the hash table. The third routine takes all the
-object files and links them together to create the output
-file. These routines are designed so that the linker proper
-does not need to know anything about the symbols in the object
-files that it is linking. The linker merely arranges the
-sections as directed by the linker script and lets BFD handle
-the details of symbols and relocs.
-
-The second routine and third routines are passed a pointer to
-a @code{struct bfd_link_info} structure (defined in
-@code{bfdlink.h}) which holds information relevant to the link,
-including the linker hash table (which was created by the
-first routine) and a set of callback functions to the linker
-proper.
-
-The generic linker routines are in @code{linker.c}, and use the
-header file @code{genlink.h}. As of this writing, the only back
-ends which have implemented versions of these routines are
-a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}). The a.out
-routines are used as examples throughout this section.
-
-@menu
-* Creating a Linker Hash Table::
-* Adding Symbols to the Hash Table::
-* Performing the Final Link::
-@end menu
-
-@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions
-@subsection Creating a linker hash table
-@cindex _bfd_link_hash_table_create in target vector
-@cindex target vector (_bfd_link_hash_table_create)
-The linker routines must create a hash table, which must be
-derived from @code{struct bfd_link_hash_table} described in
-@code{bfdlink.c}. @xref{Hash Tables}, for information on how to
-create a derived hash table. This entry point is called using
-the target vector of the linker output file.
-
-The @code{_bfd_link_hash_table_create} entry point must allocate
-and initialize an instance of the desired hash table. If the
-back end does not require any additional information to be
-stored with the entries in the hash table, the entry point may
-simply create a @code{struct bfd_link_hash_table}. Most likely,
-however, some additional information will be needed.
-
-For example, with each entry in the hash table the a.out
-linker keeps the index the symbol has in the final output file
-(this index number is used so that when doing a relocatable
-link the symbol index used in the output file can be quickly
-filled in when copying over a reloc). The a.out linker code
-defines the required structures and functions for a hash table
-derived from @code{struct bfd_link_hash_table}. The a.out linker
-hash table is created by the function
-@code{NAME(aout,link_hash_table_create)}; it simply allocates
-space for the hash table, initializes it, and returns a
-pointer to it.
-
-When writing the linker routines for a new back end, you will
-generally not know exactly which fields will be required until
-you have finished. You should simply create a new hash table
-which defines no additional fields, and then simply add fields
-as they become necessary.
-
-@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions
-@subsection Adding symbols to the hash table
-@cindex _bfd_link_add_symbols in target vector
-@cindex target vector (_bfd_link_add_symbols)
-The linker proper will call the @code{_bfd_link_add_symbols}
-entry point for each object file or archive which is to be
-linked (typically these are the files named on the command
-line, but some may also come from the linker script). The
-entry point is responsible for examining the file. For an
-object file, BFD must add any relevant symbol information to
-the hash table. For an archive, BFD must determine which
-elements of the archive should be used and adding them to the
-link.
-
-The a.out version of this entry point is
-@code{NAME(aout,link_add_symbols)}.
-
-@menu
-* Differing file formats::
-* Adding symbols from an object file::
-* Adding symbols from an archive::
-@end menu
-
-@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table
-@subsubsection Differing file formats
-Normally all the files involved in a link will be of the same
-format, but it is also possible to link together different
-format object files, and the back end must support that. The
-@code{_bfd_link_add_symbols} entry point is called via the target
-vector of the file to be added. This has an important
-consequence: the function may not assume that the hash table
-is the type created by the corresponding
-@code{_bfd_link_hash_table_create} vector. All the
-@code{_bfd_link_add_symbols} function can assume about the hash
-table is that it is derived from @code{struct
-bfd_link_hash_table}.
-
-Sometimes the @code{_bfd_link_add_symbols} function must store
-some information in the hash table entry to be used by the
-@code{_bfd_final_link} function. In such a case the @code{creator}
-field of the hash table must be checked to make sure that the
-hash table was created by an object file of the same format.
-
-The @code{_bfd_final_link} routine must be prepared to handle a
-hash entry without any extra information added by the
-@code{_bfd_link_add_symbols} function. A hash entry without
-extra information will also occur when the linker script
-directs the linker to create a symbol. Note that, regardless
-of how a hash table entry is added, all the fields will be
-initialized to some sort of null value by the hash table entry
-initialization function.
-
-See @code{ecoff_link_add_externals} for an example of how to
-check the @code{creator} field before saving information (in this
-case, the ECOFF external symbol debugging information) in a
-hash table entry.
-
-@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table
-@subsubsection Adding symbols from an object file
-When the @code{_bfd_link_add_symbols} routine is passed an object
-file, it must add all externally visible symbols in that
-object file to the hash table. The actual work of adding the
-symbol to the hash table is normally handled by the function
-@code{_bfd_generic_link_add_one_symbol}. The
-@code{_bfd_link_add_symbols} routine is responsible for reading
-all the symbols from the object file and passing the correct
-information to @code{_bfd_generic_link_add_one_symbol}.
-
-The @code{_bfd_link_add_symbols} routine should not use
-@code{bfd_canonicalize_symtab} to read the symbols. The point of
-providing this routine is to avoid the overhead of converting
-the symbols into generic @code{asymbol} structures.
-
-@findex _bfd_generic_link_add_one_symbol
-@code{_bfd_generic_link_add_one_symbol} handles the details of
-combining common symbols, warning about multiple definitions,
-and so forth. It takes arguments which describe the symbol to
-add, notably symbol flags, a section, and an offset. The
-symbol flags include such things as @code{BSF_WEAK} or
-@code{BSF_INDIRECT}. The section is a section in the object
-file, or something like @code{bfd_und_section_ptr} for an undefined
-symbol or @code{bfd_com_section_ptr} for a common symbol.
-
-If the @code{_bfd_final_link} routine is also going to need to
-read the symbol information, the @code{_bfd_link_add_symbols}
-routine should save it somewhere attached to the object file
-BFD. However, the information should only be saved if the
-@code{keep_memory} field of the @code{info} argument is TRUE, so
-that the @code{-no-keep-memory} linker switch is effective.
-
-The a.out function which adds symbols from an object file is
-@code{aout_link_add_object_symbols}, and most of the interesting
-work is in @code{aout_link_add_symbols}. The latter saves
-pointers to the hash tables entries created by
-@code{_bfd_generic_link_add_one_symbol} indexed by symbol number,
-so that the @code{_bfd_final_link} routine does not have to call
-the hash table lookup routine to locate the entry.
-
-@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table
-@subsubsection Adding symbols from an archive
-When the @code{_bfd_link_add_symbols} routine is passed an
-archive, it must look through the symbols defined by the
-archive and decide which elements of the archive should be
-included in the link. For each such element it must call the
-@code{add_archive_element} linker callback, and it must add the
-symbols from the object file to the linker hash table.
-
-@findex _bfd_generic_link_add_archive_symbols
-In most cases the work of looking through the symbols in the
-archive should be done by the
-@code{_bfd_generic_link_add_archive_symbols} function. This
-function builds a hash table from the archive symbol table and
-looks through the list of undefined symbols to see which
-elements should be included.
-@code{_bfd_generic_link_add_archive_symbols} is passed a function
-to call to make the final decision about adding an archive
-element to the link and to do the actual work of adding the
-symbols to the linker hash table.
-
-The function passed to
-@code{_bfd_generic_link_add_archive_symbols} must read the
-symbols of the archive element and decide whether the archive
-element should be included in the link. If the element is to
-be included, the @code{add_archive_element} linker callback
-routine must be called with the element as an argument, and
-the elements symbols must be added to the linker hash table
-just as though the element had itself been passed to the
-@code{_bfd_link_add_symbols} function.
-
-When the a.out @code{_bfd_link_add_symbols} function receives an
-archive, it calls @code{_bfd_generic_link_add_archive_symbols}
-passing @code{aout_link_check_archive_element} as the function
-argument. @code{aout_link_check_archive_element} calls
-@code{aout_link_check_ar_symbols}. If the latter decides to add
-the element (an element is only added if it provides a real,
-non-common, definition for a previously undefined or common
-symbol) it calls the @code{add_archive_element} callback and then
-@code{aout_link_check_archive_element} calls
-@code{aout_link_add_symbols} to actually add the symbols to the
-linker hash table.
-
-The ECOFF back end is unusual in that it does not normally
-call @code{_bfd_generic_link_add_archive_symbols}, because ECOFF
-archives already contain a hash table of symbols. The ECOFF
-back end searches the archive itself to avoid the overhead of
-creating a new hash table.
-
-@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions
-@subsection Performing the final link
-@cindex _bfd_link_final_link in target vector
-@cindex target vector (_bfd_final_link)
-When all the input files have been processed, the linker calls
-the @code{_bfd_final_link} entry point of the output BFD. This
-routine is responsible for producing the final output file,
-which has several aspects. It must relocate the contents of
-the input sections and copy the data into the output sections.
-It must build an output symbol table including any local
-symbols from the input files and the global symbols from the
-hash table. When producing relocatable output, it must
-modify the input relocs and write them into the output file.
-There may also be object format dependent work to be done.
-
-The linker will also call the @code{write_object_contents} entry
-point when the BFD is closed. The two entry points must work
-together in order to produce the correct output file.
-
-The details of how this works are inevitably dependent upon
-the specific object file format. The a.out
-@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}.
-
-@menu
-* Information provided by the linker::
-* Relocating the section contents::
-* Writing the symbol table::
-@end menu
-
-@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link
-@subsubsection Information provided by the linker
-Before the linker calls the @code{_bfd_final_link} entry point,
-it sets up some data structures for the function to use.
-
-The @code{input_bfds} field of the @code{bfd_link_info} structure
-will point to a list of all the input files included in the
-link. These files are linked through the @code{link_next} field
-of the @code{bfd} structure.
-
-Each section in the output file will have a list of
-@code{link_order} structures attached to the @code{link_order_head}
-field (the @code{link_order} structure is defined in
-@code{bfdlink.h}). These structures describe how to create the
-contents of the output section in terms of the contents of
-various input sections, fill constants, and, eventually, other
-types of information. They also describe relocs that must be
-created by the BFD backend, but do not correspond to any input
-file; this is used to support -Ur, which builds constructors
-while generating a relocatable object file.
-
-@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link
-@subsubsection Relocating the section contents
-The @code{_bfd_final_link} function should look through the
-@code{link_order} structures attached to each section of the
-output file. Each @code{link_order} structure should either be
-handled specially, or it should be passed to the function
-@code{_bfd_default_link_order} which will do the right thing
-(@code{_bfd_default_link_order} is defined in @code{linker.c}).
-
-For efficiency, a @code{link_order} of type
-@code{bfd_indirect_link_order} whose associated section belongs
-to a BFD of the same format as the output BFD must be handled
-specially. This type of @code{link_order} describes part of an
-output section in terms of a section belonging to one of the
-input files. The @code{_bfd_final_link} function should read the
-contents of the section and any associated relocs, apply the
-relocs to the section contents, and write out the modified
-section contents. If performing a relocatable link, the
-relocs themselves must also be modified and written out.
-
-@findex _bfd_relocate_contents
-@findex _bfd_final_link_relocate
-The functions @code{_bfd_relocate_contents} and
-@code{_bfd_final_link_relocate} provide some general support for
-performing the actual relocations, notably overflow checking.
-Their arguments include information about the symbol the
-relocation is against and a @code{reloc_howto_type} argument
-which describes the relocation to perform. These functions
-are defined in @code{reloc.c}.
-
-The a.out function which handles reading, relocating, and
-writing section contents is @code{aout_link_input_section}. The
-actual relocation is done in @code{aout_link_input_section_std}
-and @code{aout_link_input_section_ext}.
-
-@node Writing the symbol table, , Relocating the section contents, Performing the Final Link
-@subsubsection Writing the symbol table
-The @code{_bfd_final_link} function must gather all the symbols
-in the input files and write them out. It must also write out
-all the symbols in the global hash table. This must be
-controlled by the @code{strip} and @code{discard} fields of the
-@code{bfd_link_info} structure.
-
-The local symbols of the input files will not have been
-entered into the linker hash table. The @code{_bfd_final_link}
-routine must consider each input file and include the symbols
-in the output file. It may be convenient to do this when
-looking through the @code{link_order} structures, or it may be
-done by stepping through the @code{input_bfds} list.
-
-The @code{_bfd_final_link} routine must also traverse the global
-hash table to gather all the externally visible symbols. It
-is possible that most of the externally visible symbols may be
-written out when considering the symbols of each input file,
-but it is still necessary to traverse the hash table since the
-linker script may have defined some symbols that are not in
-any of the input files.
-
-The @code{strip} field of the @code{bfd_link_info} structure
-controls which symbols are written out. The possible values
-are listed in @code{bfdlink.h}. If the value is @code{strip_some},
-then the @code{keep_hash} field of the @code{bfd_link_info}
-structure is a hash table of symbols to keep; each symbol
-should be looked up in this hash table, and only symbols which
-are present should be included in the output file.
-
-If the @code{strip} field of the @code{bfd_link_info} structure
-permits local symbols to be written out, the @code{discard} field
-is used to further controls which local symbols are included
-in the output file. If the value is @code{discard_l}, then all
-local symbols which begin with a certain prefix are discarded;
-this is controlled by the @code{bfd_is_local_label_name} entry point.
-
-The a.out backend handles symbols by calling
-@code{aout_link_write_symbols} on each input BFD and then
-traversing the global hash table with the function
-@code{aout_link_write_other_symbol}. It builds a string table
-while writing out the symbols, which is written to the output
-file at the end of @code{NAME(aout,final_link)}.
-
-@findex bfd_link_split_section
-@subsubsection @code{bfd_link_split_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
-@end example
-@strong{Description}@*
-Return nonzero if @var{sec} should be split during a
-reloceatable or final link.
-@example
-#define bfd_link_split_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-@end example
-
diff --git a/contrib/binutils/bfd/doc/mmo.texi b/contrib/binutils/bfd/doc/mmo.texi
deleted file mode 100644
index c308952..0000000
--- a/contrib/binutils/bfd/doc/mmo.texi
+++ /dev/null
@@ -1,365 +0,0 @@
-@section mmo backend
-The mmo object format is used exclusively together with Professor
-Donald E.@: Knuth's educational 64-bit processor MMIX. The simulator
-@command{mmix} which is available at
-@url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz}
-understands this format. That package also includes a combined
-assembler and linker called @command{mmixal}. The mmo format has
-no advantages feature-wise compared to e.g. ELF. It is a simple
-non-relocatable object format with no support for archives or
-debugging information, except for symbol value information and
-line numbers (which is not yet implemented in BFD). See
-@url{http://www-cs-faculty.stanford.edu/~knuth/mmix.html} for more
-information about MMIX. The ELF format is used for intermediate
-object files in the BFD implementation.
-
-@c We want to xref the symbol table node. A feature in "chew"
-@c requires that "commands" do not contain spaces in the
-@c arguments. Hence the hyphen in "Symbol-table".
-@menu
-* File layout::
-* Symbol-table::
-* mmo section mapping::
-@end menu
-
-@node File layout, Symbol-table, mmo, mmo
-@subsection File layout
-The mmo file contents is not partitioned into named sections as
-with e.g.@: ELF. Memory areas is formed by specifying the
-location of the data that follows. Only the memory area
-@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} is executable, so
-it is used for code (and constants) and the area
-@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for
-writable data. @xref{mmo section mapping}.
-
-Contents is entered as 32-bit words, xor:ed over previous
-contents, always zero-initialized. A word that starts with the
-byte @samp{0x98} forms a command called a @samp{lopcode}, where
-the next byte distinguished between the thirteen lopcodes. The
-two remaining bytes, called the @samp{Y} and @samp{Z} fields, or
-the @samp{YZ} field (a 16-bit big-endian number), are used for
-various purposes different for each lopcode. As documented in
-@url{http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz},
-the lopcodes are:
-
-There is provision for specifying ``special data'' of 65536
-different types. We use type 80 (decimal), arbitrarily chosen the
-same as the ELF @code{e_machine} number for MMIX, filling it with
-section information normally found in ELF objects. @xref{mmo
-section mapping}.
-
-@table @code
-@item lop_quote
-0x98000001. The next word is contents, regardless of whether it
-starts with 0x98 or not.
-
-@item lop_loc
-0x9801YYZZ, where @samp{Z} is 1 or 2. This is a location
-directive, setting the location for the next data to the next
-32-bit word (for @math{Z = 1}) or 64-bit word (for @math{Z = 2}),
-plus @math{Y * 2^56}. Normally @samp{Y} is 0 for the text segment
-and 2 for the data segment.
-
-@item lop_skip
-0x9802YYZZ. Increase the current location by @samp{YZ} bytes.
-
-@item lop_fixo
-0x9803YYZZ, where @samp{Z} is 1 or 2. Store the current location
-as 64 bits into the location pointed to by the next 32-bit
-(@math{Z = 1}) or 64-bit (@math{Z = 2}) word, plus @math{Y *
-2^56}.
-
-@item lop_fixr
-0x9804YYZZ. @samp{YZ} is stored into the current location plus
-@math{2 - 4 * YZ}.
-
-@item lop_fixrx
-0x980500ZZ. @samp{Z} is 16 or 24. A value @samp{L} derived from
-the following 32-bit word are used in a manner similar to
-@samp{YZ} in lop_fixr: it is xor:ed into the current location
-minus @math{4 * L}. The first byte of the word is 0 or 1. If it
-is 1, then @math{L = (@var{lowest 24 bits of word}) - 2^Z}, if 0,
-then @math{L = (@var{lowest 24 bits of word})}.
-
-@item lop_file
-0x9806YYZZ. @samp{Y} is the file number, @samp{Z} is count of
-32-bit words. Set the file number to @samp{Y} and the line
-counter to 0. The next @math{Z * 4} bytes contain the file name,
-padded with zeros if the count is not a multiple of four. The
-same @samp{Y} may occur multiple times, but @samp{Z} must be 0 for
-all but the first occurrence.
-
-@item lop_line
-0x9807YYZZ. @samp{YZ} is the line number. Together with
-lop_file, it forms the source location for the next 32-bit word.
-Note that for each non-lopcode 32-bit word, line numbers are
-assumed incremented by one.
-
-@item lop_spec
-0x9808YYZZ. @samp{YZ} is the type number. Data until the next
-lopcode other than lop_quote forms special data of type @samp{YZ}.
-@xref{mmo section mapping}.
-
-Other types than 80, (or type 80 with a content that does not
-parse) is stored in sections named @code{.MMIX.spec_data.@var{n}}
-where @var{n} is the @samp{YZ}-type. The flags for such a
-sections say not to allocate or load the data. The vma is 0.
-Contents of multiple occurrences of special data @var{n} is
-concatenated to the data of the previous lop_spec @var{n}s. The
-location in data or code at which the lop_spec occurred is lost.
-
-@item lop_pre
-0x980901ZZ. The first lopcode in a file. The @samp{Z} field forms the
-length of header information in 32-bit words, where the first word
-tells the time in seconds since @samp{00:00:00 GMT Jan 1 1970}.
-
-@item lop_post
-0x980a00ZZ. @math{Z > 32}. This lopcode follows after all
-content-generating lopcodes in a program. The @samp{Z} field
-denotes the value of @samp{rG} at the beginning of the program.
-The following @math{256 - Z} big-endian 64-bit words are loaded
-into global registers @samp{$G} @dots{} @samp{$255}.
-
-@item lop_stab
-0x980b0000. The next-to-last lopcode in a program. Must follow
-immediately after the lop_post lopcode and its data. After this
-lopcode follows all symbols in a compressed format
-(@pxref{Symbol-table}).
-
-@item lop_end
-0x980cYYZZ. The last lopcode in a program. It must follow the
-lop_stab lopcode and its data. The @samp{YZ} field contains the
-number of 32-bit words of symbol table information after the
-preceding lop_stab lopcode.
-@end table
-
-Note that the lopcode "fixups"; @code{lop_fixr}, @code{lop_fixrx} and
-@code{lop_fixo} are not generated by BFD, but are handled. They are
-generated by @code{mmixal}.
-
-This trivial one-label, one-instruction file:
-
-@example
- :Main TRAP 1,2,3
-@end example
-
-can be represented this way in mmo:
-
-@example
- 0x98090101 - lop_pre, one 32-bit word with timestamp.
- <timestamp>
- 0x98010002 - lop_loc, text segment, using a 64-bit address.
- Note that mmixal does not emit this for the file above.
- 0x00000000 - Address, high 32 bits.
- 0x00000000 - Address, low 32 bits.
- 0x98060002 - lop_file, 2 32-bit words for file-name.
- 0x74657374 - "test"
- 0x2e730000 - ".s\0\0"
- 0x98070001 - lop_line, line 1.
- 0x00010203 - TRAP 1,2,3
- 0x980a00ff - lop_post, setting $255 to 0.
- 0x00000000
- 0x00000000
- 0x980b0000 - lop_stab for ":Main" = 0, serial 1.
- 0x203a4040 @xref{Symbol-table}.
- 0x10404020
- 0x4d206120
- 0x69016e00
- 0x81000000
- 0x980c0005 - lop_end; symbol table contained five 32-bit words.
-@end example
-@node Symbol-table, mmo section mapping, File layout, mmo
-@subsection Symbol table format
-From mmixal.w (or really, the generated mmixal.tex) in
-@url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz}):
-``Symbols are stored and retrieved by means of a @samp{ternary
-search trie}, following ideas of Bentley and Sedgewick. (See
-ACM--SIAM Symp.@: on Discrete Algorithms @samp{8} (1997), 360--369;
-R.@:Sedgewick, @samp{Algorithms in C} (Reading, Mass.@:
-Addison--Wesley, 1998), @samp{15.4}.) Each trie node stores a
-character, and there are branches to subtries for the cases where
-a given character is less than, equal to, or greater than the
-character in the trie. There also is a pointer to a symbol table
-entry if a symbol ends at the current node.''
-
-So it's a tree encoded as a stream of bytes. The stream of bytes
-acts on a single virtual global symbol, adding and removing
-characters and signalling complete symbol points. Here, we read
-the stream and create symbols at the completion points.
-
-First, there's a control byte @code{m}. If any of the listed bits
-in @code{m} is nonzero, we execute what stands at the right, in
-the listed order:
-
-@example
- (MMO3_LEFT)
- 0x40 - Traverse left trie.
- (Read a new command byte and recurse.)
-
- (MMO3_SYMBITS)
- 0x2f - Read the next byte as a character and store it in the
- current character position; increment character position.
- Test the bits of @code{m}:
-
- (MMO3_WCHAR)
- 0x80 - The character is 16-bit (so read another byte,
- merge into current character.
-
- (MMO3_TYPEBITS)
- 0xf - We have a complete symbol; parse the type, value
- and serial number and do what should be done
- with a symbol. The type and length information
- is in j = (m & 0xf).
-
- (MMO3_REGQUAL_BITS)
- j == 0xf: A register variable. The following
- byte tells which register.
- j <= 8: An absolute symbol. Read j bytes as the
- big-endian number the symbol equals.
- A j = 2 with two zero bytes denotes an
- unknown symbol.
- j > 8: As with j <= 8, but add (0x20 << 56)
- to the value in the following j - 8
- bytes.
-
- Then comes the serial number, as a variant of
- uleb128, but better named ubeb128:
- Read bytes and shift the previous value left 7
- (multiply by 128). Add in the new byte, repeat
- until a byte has bit 7 set. The serial number
- is the computed value minus 128.
-
- (MMO3_MIDDLE)
- 0x20 - Traverse middle trie. (Read a new command byte
- and recurse.) Decrement character position.
-
- (MMO3_RIGHT)
- 0x10 - Traverse right trie. (Read a new command byte and
- recurse.)
-@end example
-
-Let's look again at the @code{lop_stab} for the trivial file
-(@pxref{File layout}).
-
-@example
- 0x980b0000 - lop_stab for ":Main" = 0, serial 1.
- 0x203a4040
- 0x10404020
- 0x4d206120
- 0x69016e00
- 0x81000000
-@end example
-
-This forms the trivial trie (note that the path between ``:'' and
-``M'' is redundant):
-
-@example
- 203a ":"
- 40 /
- 40 /
- 10 \
- 40 /
- 40 /
- 204d "M"
- 2061 "a"
- 2069 "i"
- 016e "n" is the last character in a full symbol, and
- with a value represented in one byte.
- 00 The value is 0.
- 81 The serial number is 1.
-@end example
-
-@node mmo section mapping, , Symbol-table, mmo
-@subsection mmo section mapping
-The implementation in BFD uses special data type 80 (decimal) to
-encapsulate and describe named sections, containing e.g.@: debug
-information. If needed, any datum in the encapsulation will be
-quoted using lop_quote. First comes a 32-bit word holding the
-number of 32-bit words containing the zero-terminated zero-padded
-segment name. After the name there's a 32-bit word holding flags
-describing the section type. Then comes a 64-bit big-endian word
-with the section length (in bytes), then another with the section
-start address. Depending on the type of section, the contents
-might follow, zero-padded to 32-bit boundary. For a loadable
-section (such as data or code), the contents might follow at some
-later point, not necessarily immediately, as a lop_loc with the
-same start address as in the section description, followed by the
-contents. This in effect forms a descriptor that must be emitted
-before the actual contents. Sections described this way must not
-overlap.
-
-For areas that don't have such descriptors, synthetic sections are
-formed by BFD. Consecutive contents in the two memory areas
-@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} and
-@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} are entered in
-sections named @code{.text} and @code{.data} respectively. If an area
-is not otherwise described, but would together with a neighboring
-lower area be less than @samp{0x40000000} bytes long, it is joined
-with the lower area and the gap is zero-filled. For other cases,
-a new section is formed, named @code{.MMIX.sec.@var{n}}. Here,
-@var{n} is a number, a running count through the mmo file,
-starting at 0.
-
-A loadable section specified as:
-
-@example
- .section secname,"ax"
- TETRA 1,2,3,4,-1,-2009
- BYTE 80
-@end example
-
-and linked to address @samp{0x4}, is represented by the sequence:
-
-@example
- 0x98080050 - lop_spec 80
- 0x00000002 - two 32-bit words for the section name
- 0x7365636e - "secn"
- 0x616d6500 - "ame\0"
- 0x00000033 - flags CODE, READONLY, LOAD, ALLOC
- 0x00000000 - high 32 bits of section length
- 0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits
- 0x00000000 - high 32 bits of section address
- 0x00000004 - section address is 4
- 0x98010002 - 64 bits with address of following data
- 0x00000000 - high 32 bits of address
- 0x00000004 - low 32 bits: data starts at address 4
- 0x00000001 - 1
- 0x00000002 - 2
- 0x00000003 - 3
- 0x00000004 - 4
- 0xffffffff - -1
- 0xfffff827 - -2009
- 0x50000000 - 80 as a byte, padded with zeros.
-@end example
-
-Note that the lop_spec wrapping does not include the section
-contents. Compare this to a non-loaded section specified as:
-
-@example
- .section thirdsec
- TETRA 200001,100002
- BYTE 38,40
-@end example
-
-This, when linked to address @samp{0x200000000000001c}, is
-represented by:
-
-@example
- 0x98080050 - lop_spec 80
- 0x00000002 - two 32-bit words for the section name
- 0x7365636e - "thir"
- 0x616d6500 - "dsec"
- 0x00000010 - flag READONLY
- 0x00000000 - high 32 bits of section length
- 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits
- 0x20000000 - high 32 bits of address
- 0x0000001c - low 32 bits of address 0x200000000000001c
- 0x00030d41 - 200001
- 0x000186a2 - 100002
- 0x26280000 - 38, 40 as bytes, padded with zeros
-@end example
-
-For the latter example, the section contents must not be
-loaded in memory, and is therefore specified as part of the
-special data. The address is usually unimportant but might
-provide information for e.g.@: the DWARF 2 debugging format.
diff --git a/contrib/binutils/bfd/doc/opncls.texi b/contrib/binutils/bfd/doc/opncls.texi
deleted file mode 100644
index 8cd2ab9..0000000
--- a/contrib/binutils/bfd/doc/opncls.texi
+++ /dev/null
@@ -1,265 +0,0 @@
-@section Opening and closing BFDs
-
-
-@findex bfd_openr
-@subsubsection @code{bfd_openr}
-@strong{Synopsis}
-@example
-bfd *bfd_openr (const char *filename, const char *target);
-@end example
-@strong{Description}@*
-Open the file @var{filename} (using @code{fopen}) with the target
-@var{target}. Return a pointer to the created BFD.
-
-Calls @code{bfd_find_target}, so @var{target} is interpreted as by
-that function.
-
-If @code{NULL} is returned then an error has occured. Possible errors
-are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or
-@code{system_call} error.
-
-@findex bfd_fdopenr
-@subsubsection @code{bfd_fdopenr}
-@strong{Synopsis}
-@example
-bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
-@end example
-@strong{Description}@*
-@code{bfd_fdopenr} is to @code{bfd_fopenr} much like @code{fdopen} is to
-@code{fopen}. It opens a BFD on a file already described by the
-@var{fd} supplied.
-
-When the file is later @code{bfd_close}d, the file descriptor will
-be closed. If the caller desires that this file descriptor be
-cached by BFD (opened as needed, closed as needed to free
-descriptors for other opens), with the supplied @var{fd} used as
-an initial file descriptor (but subject to closure at any time),
-call bfd_set_cacheable(bfd, 1) on the returned BFD. The default
-is to assume no caching; the file descriptor will remain open
-until @code{bfd_close}, and will not be affected by BFD operations
-on other files.
-
-Possible errors are @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target} and @code{bfd_error_system_call}.
-
-@findex bfd_openstreamr
-@subsubsection @code{bfd_openstreamr}
-@strong{Synopsis}
-@example
-bfd *bfd_openstreamr (const char *, const char *, void *);
-@end example
-@strong{Description}@*
-Open a BFD for read access on an existing stdio stream. When
-the BFD is passed to @code{bfd_close}, the stream will be closed.
-
-@findex bfd_openw
-@subsubsection @code{bfd_openw}
-@strong{Synopsis}
-@example
-bfd *bfd_openw (const char *filename, const char *target);
-@end example
-@strong{Description}@*
-Create a BFD, associated with file @var{filename}, using the
-file format @var{target}, and return a pointer to it.
-
-Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target}.
-
-@findex bfd_close
-@subsubsection @code{bfd_close}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_close (bfd *abfd);
-@end example
-@strong{Description}@*
-Close a BFD. If the BFD was open for writing, then pending
-operations are completed and the file written out and closed.
-If the created file is executable, then @code{chmod} is called
-to mark it as such.
-
-All memory attached to the BFD is released.
-
-The file descriptor associated with the BFD is closed (even
-if it was passed in to BFD by @code{bfd_fdopenr}).
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_close_all_done
-@subsubsection @code{bfd_close_all_done}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_close_all_done (bfd *);
-@end example
-@strong{Description}@*
-Close a BFD. Differs from @code{bfd_close} since it does not
-complete any pending operations. This routine would be used
-if the application had just used BFD for swapping and didn't
-want to use any of the writing code.
-
-If the created file is executable, then @code{chmod} is called
-to mark it as such.
-
-All memory attached to the BFD is released.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_create
-@subsubsection @code{bfd_create}
-@strong{Synopsis}
-@example
-bfd *bfd_create (const char *filename, bfd *templ);
-@end example
-@strong{Description}@*
-Create a new BFD in the manner of @code{bfd_openw}, but without
-opening a file. The new BFD takes the target from the target
-used by @var{template}. The format is always set to @code{bfd_object}.
-
-@findex bfd_make_writable
-@subsubsection @code{bfd_make_writable}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_make_writable (bfd *abfd);
-@end example
-@strong{Description}@*
-Takes a BFD as created by @code{bfd_create} and converts it
-into one like as returned by @code{bfd_openw}. It does this
-by converting the BFD to BFD_IN_MEMORY. It's assumed that
-you will call @code{bfd_make_readable} on this bfd later.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_make_readable
-@subsubsection @code{bfd_make_readable}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_make_readable (bfd *abfd);
-@end example
-@strong{Description}@*
-Takes a BFD as created by @code{bfd_create} and
-@code{bfd_make_writable} and converts it into one like as
-returned by @code{bfd_openr}. It does this by writing the
-contents out to the memory buffer, then reversing the
-direction.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_alloc
-@subsubsection @code{bfd_alloc}
-@strong{Synopsis}
-@example
-void *bfd_alloc (bfd *abfd, size_t wanted);
-@end example
-@strong{Description}@*
-Allocate a block of @var{wanted} bytes of memory attached to
-@code{abfd} and return a pointer to it.
-
-@findex bfd_calc_gnu_debuglink_crc32
-@subsubsection @code{bfd_calc_gnu_debuglink_crc32}
-@strong{Synopsis}
-@example
-unsigned long bfd_calc_gnu_debuglink_crc32
- (unsigned long crc, const unsigned char *buf, bfd_size_type len);
-@end example
-@strong{Description}@*
-Computes a CRC value as used in the .gnu_debuglink section.
-Advances the previously computed @var{crc} value by computing
-and adding in the crc32 for @var{len} bytes of @var{buf}.
-
-@strong{Returns}@*
-Return the updated CRC32 value.
-
-@findex get_debug_link_info
-@subsubsection @code{get_debug_link_info}
-@strong{Synopsis}
-@example
-char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out);
-@end example
-@strong{Description}@*
-fetch the filename and CRC32 value for any separate debuginfo
-associated with @var{abfd}. Return NULL if no such info found,
-otherwise return filename and update @var{crc32_out}.
-
-@findex separate_debug_file_exists
-@subsubsection @code{separate_debug_file_exists}
-@strong{Synopsis}
-@example
-bfd_boolean separate_debug_file_exists
- (char *name, unsigned long crc32);
-@end example
-@strong{Description}@*
-Checks to see if @var{name} is a file and if its contents
-match @var{crc32}.
-
-@findex find_separate_debug_file
-@subsubsection @code{find_separate_debug_file}
-@strong{Synopsis}
-@example
-char *find_separate_debug_file (bfd *abfd);
-@end example
-@strong{Description}@*
-Searches @var{abfd} for a reference to separate debugging
-information, scans various locations in the filesystem, including
-the file tree rooted at @var{debug_file_directory}, and returns a
-filename of such debugging information if the file is found and has
-matching CRC32. Returns NULL if no reference to debugging file
-exists, or file cannot be found.
-
-@findex bfd_follow_gnu_debuglink
-@subsubsection @code{bfd_follow_gnu_debuglink}
-@strong{Synopsis}
-@example
-char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
-@end example
-@strong{Description}@*
-Takes a BFD and searches it for a .gnu_debuglink section. If this
-section is found, it examines the section for the name and checksum
-of a '.debug' file containing auxiliary debugging information. It
-then searches the filesystem for this .debug file in some standard
-locations, including the directory tree rooted at @var{dir}, and if
-found returns the full filename.
-
-If @var{dir} is NULL, it will search a default path configured into
-libbfd at build time. [XXX this feature is not currently
-implemented].
-
-@strong{Returns}@*
-@code{NULL} on any errors or failure to locate the .debug file,
-otherwise a pointer to a heap-allocated string containing the
-filename. The caller is responsible for freeing this string.
-
-@findex bfd_create_gnu_debuglink_section
-@subsubsection @code{bfd_create_gnu_debuglink_section}
-@strong{Synopsis}
-@example
-struct bfd_section *bfd_create_gnu_debuglink_section
- (bfd *abfd, const char *filename);
-@end example
-@strong{Description}@*
-Takes a @var{BFD} and adds a .gnu_debuglink section to it. The section is sized
-to be big enough to contain a link to the specified @var{filename}.
-
-@strong{Returns}@*
-A pointer to the new section is returned if all is ok. Otherwise @code{NULL} is
-returned and bfd_error is set.
-
-@findex bfd_fill_in_gnu_debuglink_section
-@subsubsection @code{bfd_fill_in_gnu_debuglink_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_fill_in_gnu_debuglink_section
- (bfd *abfd, struct bfd_section *sect, const char *filename);
-@end example
-@strong{Description}@*
-Takes a @var{BFD} and containing a .gnu_debuglink section @var{SECT}
-and fills in the contents of the section to contain a link to the
-specified @var{filename}. The filename should be relative to the
-current directory.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok. Otherwise @code{FALSE} is returned
-and bfd_error is set.
-
diff --git a/contrib/binutils/bfd/doc/proto.str b/contrib/binutils/bfd/doc/proto.str
deleted file mode 100644
index 702d9f5..0000000
--- a/contrib/binutils/bfd/doc/proto.str
+++ /dev/null
@@ -1,135 +0,0 @@
-
-: SYNOPSIS
- skip_past_newline
- get_stuff_in_command
- paramstuff
- indent
- maybecatstr
-;
-
-: ignore
- skip_past_newline
- get_stuff_in_command
- outputdots
- maybecatstr
- ;
-
-: CODE_FRAGMENT
- ignore ;
-
-: external
- 0 internalmode ignore ;
-
-: internal
- 1 internalmode ignore ;
-
-- input stack { a b } output b if internal, a if external
-: ifinternal
- "" swap 1 internalmode maybecatstr
- swap
- "" swap 0 internalmode maybecatstr
- catstr
- ;
-
-- Put note in output string, regardless of internal mode.
-: COMMENT
- skip_past_newline
- get_stuff_in_command
- translatecomments
- catstr
- ;
-
-- SENUM enum-type-name
-- ENUM enum-name
-- ENUMX addl-enum-name
-- ENUMDOC doc for preceding enums
-- ENDSENUM max-enum-name
-
-: make_enum_header
- dup
- "enum " swap catstr
- " {\n" catstr
- swap " _dummy_first_" swap catstr catstr
- ",\n" catstr
- ;
-: make_string_table_header
- dup
- "#ifdef _BFD_MAKE_TABLE_" swap catstr swap
- "\n\nstatic const char *const " swap catstr catstr
- "_names[] = { \"@@uninitialized@@\",\n" catstr
- ;
-: SENUM
- skip_past_newline
- copy_past_newline
- remchar
- dup
- make_enum_header
- swap
- make_string_table_header
- ifinternal
- catstr
- get_stuff_in_command catstr
- translatecomments ;
-: ENDSENUM
- skip_past_newline
- copy_past_newline strip_trailing_newlines
- dup
- " " swap catstr " };\n" catstr swap
- " \"@@overflow: " swap catstr "@@\",\n};\n#endif\n\n" catstr
- ifinternal
- catstr
- ;
-: make_enumerator
- " " swap catstr
- ",\n" catstr
- ;
-: make_enumerator_string
- " \"" swap catstr
- "\",\n" catstr
- ;
-: ENUM
- skip_past_newline
- copy_past_newline
- remchar
- dup
- make_enumerator
- swap
- make_enumerator_string
- ifinternal
- ;
-: ENUMX ENUM catstr ;
-: ENUMEQ
- skip_past_newline
- "#define "
- copy_past_newline remchar
- catstr
- " "
- catstr
- copy_past_newline
- catstr
- "" swap 0 internalmode maybecatstr
- ;
-: ENUMEQX ENUMEQ catstr ;
-: ENUMDOC
- skip_past_newline
- get_stuff_in_command
- strip_trailing_newlines
- "\n{* " swap catstr " *}\n" catstr
- translatecomments
- - discard it if we're doing internal mode
- "" swap 0 internalmode maybecatstr
- swap
- catstr catstr
- ;
-: ENDDD external ;
-: SECTION ignore ;
-: SUBSECTION ignore ;
-: SUBSUBSECTION ignore ;
-: INTERNAL_DEFINITION internal ;
-: DESCRIPTION ignore ;
-: FUNCTION external ;
-: RETURNS ignore ;
-: TYPEDEF external ;
-: INTERNAL_FUNCTION internal ;
-: INTERNAL internal ;
-: INODE ignore ;
diff --git a/contrib/binutils/bfd/doc/reloc.texi b/contrib/binutils/bfd/doc/reloc.texi
deleted file mode 100644
index 9253a33..0000000
--- a/contrib/binutils/bfd/doc/reloc.texi
+++ /dev/null
@@ -1,2068 +0,0 @@
-@section Relocations
-BFD maintains relocations in much the same way it maintains
-symbols: they are left alone until required, then read in
-en-masse and translated into an internal form. A common
-routine @code{bfd_perform_relocation} acts upon the
-canonical form to do the fixup.
-
-Relocations are maintained on a per section basis,
-while symbols are maintained on a per BFD basis.
-
-All that a back end has to do to fit the BFD interface is to create
-a @code{struct reloc_cache_entry} for each relocation
-in a particular section, and fill in the right bits of the structures.
-
-@menu
-* typedef arelent::
-* howto manager::
-@end menu
-
-
-@node typedef arelent, howto manager, Relocations, Relocations
-@subsection typedef arelent
-This is the structure of a relocation entry:
-
-
-@example
-
-typedef enum bfd_reloc_status
-@{
- /* No errors detected. */
- bfd_reloc_ok,
-
- /* The relocation was performed, but there was an overflow. */
- bfd_reloc_overflow,
-
- /* The address to relocate was not within the section supplied. */
- bfd_reloc_outofrange,
-
- /* Used by special functions. */
- bfd_reloc_continue,
-
- /* Unsupported relocation size requested. */
- bfd_reloc_notsupported,
-
- /* Unused. */
- bfd_reloc_other,
-
- /* 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. */
- bfd_reloc_dangerous
- @}
- bfd_reloc_status_type;
-
-
-typedef struct reloc_cache_entry
-@{
- /* A pointer into the canonical table of pointers. */
- struct bfd_symbol **sym_ptr_ptr;
-
- /* offset in section. */
- bfd_size_type address;
-
- /* addend for relocation value. */
- bfd_vma addend;
-
- /* Pointer to how to perform the required relocation. */
- reloc_howto_type *howto;
-
-@}
-arelent;
-
-@end example
-@strong{Description}@*
-Here is a description of each of the fields within an @code{arelent}:
-
-@itemize @bullet
-
-@item
-@code{sym_ptr_ptr}
-@end itemize
-The symbol table pointer points to a pointer to the symbol
-associated with the relocation request. It is the pointer
-into the table returned by the back end's
-@code{canonicalize_symtab} action. @xref{Symbols}. The symbol is
-referenced through a pointer to a pointer so that tools like
-the linker can fix up all the symbols of the same name by
-modifying only one pointer. The relocation routine looks in
-the symbol and uses the base of the section the symbol is
-attached to and the value of the symbol as the initial
-relocation offset. If the symbol pointer is zero, then the
-section provided is looked up.
-
-@itemize @bullet
-
-@item
-@code{address}
-@end itemize
-The @code{address} field gives the offset in bytes from the base of
-the section data which owns the relocation record to the first
-byte of relocatable information. The actual data relocated
-will be relative to this point; for example, a relocation
-type which modifies the bottom two bytes of a four byte word
-would not touch the first byte pointed to in a big endian
-world.
-
-@itemize @bullet
-
-@item
-@code{addend}
-@end itemize
-The @code{addend} is a value provided by the back end to be added (!)
-to the relocation offset. Its interpretation is dependent upon
-the howto. For example, on the 68k the code:
-
-@example
- char foo[];
- main()
- @{
- return foo[0x12345678];
- @}
-@end example
-
-Could be compiled into:
-
-@example
- linkw fp,#-4
- moveb @@#12345678,d0
- extbl d0
- unlk fp
- rts
-@end example
-
-This could create a reloc pointing to @code{foo}, but leave the
-offset in the data, something like:
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset type value
-00000006 32 _foo
-
-00000000 4e56 fffc ; linkw fp,#-4
-00000004 1039 1234 5678 ; moveb @@#12345678,d0
-0000000a 49c0 ; extbl d0
-0000000c 4e5e ; unlk fp
-0000000e 4e75 ; rts
-@end example
-
-Using coff and an 88k, some instructions don't have enough
-space in them to represent the full address range, and
-pointers have to be loaded in two parts. So you'd get something like:
-
-@example
- or.u r13,r0,hi16(_foo+0x12345678)
- ld.b r2,r13,lo16(_foo+0x12345678)
- jmp r1
-@end example
-
-This should create two relocs, both pointing to @code{_foo}, and with
-0x12340000 in their addend field. The data would consist of:
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset type value
-00000002 HVRT16 _foo+0x12340000
-00000006 LVRT16 _foo+0x12340000
-
-00000000 5da05678 ; or.u r13,r0,0x5678
-00000004 1c4d5678 ; ld.b r2,r13,0x5678
-00000008 f400c001 ; jmp r1
-@end example
-
-The relocation routine digs out the value from the data, adds
-it to the addend to get the original offset, and then adds the
-value of @code{_foo}. Note that all 32 bits have to be kept around
-somewhere, to cope with carry from bit 15 to bit 16.
-
-One further example is the sparc and the a.out format. The
-sparc has a similar problem to the 88k, in that some
-instructions don't have room for an entire offset, but on the
-sparc the parts are created in odd sized lumps. The designers of
-the a.out format chose to not use the data within the section
-for storing part of the offset; all the offset is kept within
-the reloc. Anything in the data should be ignored.
-
-@example
- save %sp,-112,%sp
- sethi %hi(_foo+0x12345678),%g2
- ldsb [%g2+%lo(_foo+0x12345678)],%i0
- ret
- restore
-@end example
-
-Both relocs contain a pointer to @code{foo}, and the offsets
-contain junk.
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset type value
-00000004 HI22 _foo+0x12345678
-00000008 LO10 _foo+0x12345678
-
-00000000 9de3bf90 ; save %sp,-112,%sp
-00000004 05000000 ; sethi %hi(_foo+0),%g2
-00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0
-0000000c 81c7e008 ; ret
-00000010 81e80000 ; restore
-@end example
-
-@itemize @bullet
-
-@item
-@code{howto}
-@end itemize
-The @code{howto} field can be imagined as a
-relocation instruction. It is a pointer to a structure which
-contains information on what to do with all of the other
-information in the reloc record and data section. A back end
-would normally have a relocation instruction set and turn
-relocations into pointers to the correct structure on input -
-but it would be possible to create each howto field on demand.
-
-@subsubsection @code{enum complain_overflow}
-Indicates what sort of overflow checking should be done when
-performing a relocation.
-
-
-@example
-
-enum complain_overflow
-@{
- /* Do not complain on overflow. */
- complain_overflow_dont,
-
- /* 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_overflow_signed,
-
- /* Complain if the value overflows when considered as an
- unsigned number. */
- complain_overflow_unsigned
-@};
-@end example
-@subsubsection @code{reloc_howto_type}
-The @code{reloc_howto_type} is a structure which contains all the
-information that libbfd needs to know to tie up a back end's data.
-
-
-@example
-struct bfd_symbol; /* Forward declaration. */
-
-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. */
- unsigned int type;
-
- /* 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. */
- int size;
-
- /* 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. */
- bfd_boolean pc_relative;
-
- /* 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. */
- 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 accommodated (e.g., i960 callj
- instructions). */
- bfd_reloc_status_type (*special_function)
- (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
- bfd *, char **);
-
- /* 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. */
- bfd_boolean partial_inplace;
-
- /* src_mask selects the part of the instruction (or data) to be used
- in the relocation sum. If the target relocations don't have an
- addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
- dst_mask to extract the addend from the section contents. If
- relocations do have an addend in the reloc, eg. ELF USE_RELA, this
- field should be zero. Non-zero values for ELF USE_RELA targets are
- bogus as in those cases the value in the dst_mask part of the
- section contents should be treated as garbage. */
- bfd_vma src_mask;
-
- /* dst_mask selects which parts of the instruction (or data) are
- replaced with a relocated value. */
- 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. */
- bfd_boolean pcrel_offset;
-@};
-
-@end example
-@findex The HOWTO Macro
-@subsubsection @code{The HOWTO Macro}
-@strong{Description}@*
-The HOWTO define is horrible and will go away.
-@example
-#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 @}
-@end example
-
-@strong{Description}@*
-And will be replaced with the totally magic way. But for the
-moment, we are compatible, so do it this way.
-@example
-#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
- HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
- NAME, FALSE, 0, 0, IN)
-
-@end example
-
-@strong{Description}@*
-This is used to fill in an empty howto entry in an array.
-@example
-#define EMPTY_HOWTO(C) \
- HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
- NULL, FALSE, 0, 0, FALSE)
-
-@end example
-
-@strong{Description}@*
-Helper routine to turn a symbol into a relocation value.
-@example
-#define HOWTO_PREPARE(relocation, symbol) \
- @{ \
- if (symbol != NULL) \
- @{ \
- if (bfd_is_com_section (symbol->section)) \
- @{ \
- relocation = 0; \
- @} \
- else \
- @{ \
- relocation = symbol->value; \
- @} \
- @} \
- @}
-
-@end example
-
-@findex bfd_get_reloc_size
-@subsubsection @code{bfd_get_reloc_size}
-@strong{Synopsis}
-@example
-unsigned int bfd_get_reloc_size (reloc_howto_type *);
-@end example
-@strong{Description}@*
-For a reloc_howto_type that operates on a fixed number of bytes,
-this returns the number of bytes operated on.
-
-@findex arelent_chain
-@subsubsection @code{arelent_chain}
-@strong{Description}@*
-How relocs are tied together in an @code{asection}:
-@example
-typedef struct relent_chain
-@{
- arelent relent;
- struct relent_chain *next;
-@}
-arelent_chain;
-
-@end example
-
-@findex bfd_check_overflow
-@subsubsection @code{bfd_check_overflow}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_check_overflow
- (enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
- bfd_vma relocation);
-@end example
-@strong{Description}@*
-Perform overflow checking on @var{relocation} which has
-@var{bitsize} significant bits and will be shifted right by
-@var{rightshift} bits, on a machine with addresses containing
-@var{addrsize} significant bits. The result is either of
-@code{bfd_reloc_ok} or @code{bfd_reloc_overflow}.
-
-@findex bfd_perform_relocation
-@subsubsection @code{bfd_perform_relocation}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_perform_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message);
-@end example
-@strong{Description}@*
-If @var{output_bfd} is supplied to this function, the
-generated image will be relocatable; the relocations are
-copied to the output file after they have been changed to
-reflect the new state of the world. There are two ways of
-reflecting the results of partial linkage in an output file:
-by modifying the output data in place, and by modifying the
-relocation record. Some native formats (e.g., basic a.out and
-basic coff) have no way of specifying an addend in the
-relocation type, so the addend has to go in the output data.
-This is no big deal since in these formats the output data
-slot will always be big enough for the addend. Complex reloc
-types with addends were invented to solve just this problem.
-The @var{error_message} argument is set to an error message if
-this return @code{bfd_reloc_dangerous}.
-
-@findex bfd_install_relocation
-@subsubsection @code{bfd_install_relocation}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_install_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data, bfd_vma data_start,
- asection *input_section,
- char **error_message);
-@end example
-@strong{Description}@*
-This looks remarkably like @code{bfd_perform_relocation}, except it
-does not expect that the section contents have been filled in.
-I.e., it's suitable for use when creating, rather than applying
-a relocation.
-
-For now, this function should be considered reserved for the
-assembler.
-
-
-@node howto manager, , typedef arelent, Relocations
-@section The howto manager
-When an application wants to create a relocation, but doesn't
-know what the target machine might call it, it can find out by
-using this bit of code.
-
-@findex bfd_reloc_code_type
-@subsubsection @code{bfd_reloc_code_type}
-@strong{Description}@*
-The insides of a reloc code. The idea is that, eventually, there
-will be one enumerator for every type of relocation we ever do.
-Pass one of these values to @code{bfd_reloc_type_lookup}, and it'll
-return a howto pointer.
-
-This does mean that the application must determine the correct
-enumerator value; you can't get a howto pointer from a random set
-of attributes.
-
-Here are the possible values for @code{enum bfd_reloc_code_real}:
-
-@deffn {} BFD_RELOC_64
-@deffnx {} BFD_RELOC_32
-@deffnx {} BFD_RELOC_26
-@deffnx {} BFD_RELOC_24
-@deffnx {} BFD_RELOC_16
-@deffnx {} BFD_RELOC_14
-@deffnx {} BFD_RELOC_8
-Basic absolute relocations of N bits.
-@end deffn
-@deffn {} BFD_RELOC_64_PCREL
-@deffnx {} BFD_RELOC_32_PCREL
-@deffnx {} BFD_RELOC_24_PCREL
-@deffnx {} BFD_RELOC_16_PCREL
-@deffnx {} BFD_RELOC_12_PCREL
-@deffnx {} BFD_RELOC_8_PCREL
-PC-relative relocations. Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation. It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations.
-@end deffn
-@deffn {} BFD_RELOC_32_GOT_PCREL
-@deffnx {} BFD_RELOC_16_GOT_PCREL
-@deffnx {} BFD_RELOC_8_GOT_PCREL
-@deffnx {} BFD_RELOC_32_GOTOFF
-@deffnx {} BFD_RELOC_16_GOTOFF
-@deffnx {} BFD_RELOC_LO16_GOTOFF
-@deffnx {} BFD_RELOC_HI16_GOTOFF
-@deffnx {} BFD_RELOC_HI16_S_GOTOFF
-@deffnx {} BFD_RELOC_8_GOTOFF
-@deffnx {} BFD_RELOC_64_PLT_PCREL
-@deffnx {} BFD_RELOC_32_PLT_PCREL
-@deffnx {} BFD_RELOC_24_PLT_PCREL
-@deffnx {} BFD_RELOC_16_PLT_PCREL
-@deffnx {} BFD_RELOC_8_PLT_PCREL
-@deffnx {} BFD_RELOC_64_PLTOFF
-@deffnx {} BFD_RELOC_32_PLTOFF
-@deffnx {} BFD_RELOC_16_PLTOFF
-@deffnx {} BFD_RELOC_LO16_PLTOFF
-@deffnx {} BFD_RELOC_HI16_PLTOFF
-@deffnx {} BFD_RELOC_HI16_S_PLTOFF
-@deffnx {} BFD_RELOC_8_PLTOFF
-For ELF.
-@end deffn
-@deffn {} BFD_RELOC_68K_GLOB_DAT
-@deffnx {} BFD_RELOC_68K_JMP_SLOT
-@deffnx {} BFD_RELOC_68K_RELATIVE
-Relocations used by 68K ELF.
-@end deffn
-@deffn {} BFD_RELOC_32_BASEREL
-@deffnx {} BFD_RELOC_16_BASEREL
-@deffnx {} BFD_RELOC_LO16_BASEREL
-@deffnx {} BFD_RELOC_HI16_BASEREL
-@deffnx {} BFD_RELOC_HI16_S_BASEREL
-@deffnx {} BFD_RELOC_8_BASEREL
-@deffnx {} BFD_RELOC_RVA
-Linkage-table relative.
-@end deffn
-@deffn {} BFD_RELOC_8_FFnn
-Absolute 8-bit relocation, but used to form an address like 0xFFnn.
-@end deffn
-@deffn {} BFD_RELOC_32_PCREL_S2
-@deffnx {} BFD_RELOC_16_PCREL_S2
-@deffnx {} BFD_RELOC_23_PCREL_S2
-These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits. The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha.
-@end deffn
-@deffn {} BFD_RELOC_HI22
-@deffnx {} BFD_RELOC_LO10
-High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word. These are used on the SPARC.
-@end deffn
-@deffn {} BFD_RELOC_GPREL16
-@deffnx {} BFD_RELOC_GPREL32
-For systems that allocate a Global Pointer register, these are
-displacements off that register. These relocation types are
-handled specially, because the value the register will have is
-decided relatively late.
-@end deffn
-@deffn {} BFD_RELOC_I960_CALLJ
-Reloc types used for i960/b.out.
-@end deffn
-@deffn {} BFD_RELOC_NONE
-@deffnx {} BFD_RELOC_SPARC_WDISP22
-@deffnx {} BFD_RELOC_SPARC22
-@deffnx {} BFD_RELOC_SPARC13
-@deffnx {} BFD_RELOC_SPARC_GOT10
-@deffnx {} BFD_RELOC_SPARC_GOT13
-@deffnx {} BFD_RELOC_SPARC_GOT22
-@deffnx {} BFD_RELOC_SPARC_PC10
-@deffnx {} BFD_RELOC_SPARC_PC22
-@deffnx {} BFD_RELOC_SPARC_WPLT30
-@deffnx {} BFD_RELOC_SPARC_COPY
-@deffnx {} BFD_RELOC_SPARC_GLOB_DAT
-@deffnx {} BFD_RELOC_SPARC_JMP_SLOT
-@deffnx {} BFD_RELOC_SPARC_RELATIVE
-@deffnx {} BFD_RELOC_SPARC_UA16
-@deffnx {} BFD_RELOC_SPARC_UA32
-@deffnx {} BFD_RELOC_SPARC_UA64
-SPARC ELF relocations. There is probably some overlap with other
-relocation types already defined.
-@end deffn
-@deffn {} BFD_RELOC_SPARC_BASE13
-@deffnx {} BFD_RELOC_SPARC_BASE22
-I think these are specific to SPARC a.out (e.g., Sun 4).
-@end deffn
-@deffn {} BFD_RELOC_SPARC_64
-@deffnx {} BFD_RELOC_SPARC_10
-@deffnx {} BFD_RELOC_SPARC_11
-@deffnx {} BFD_RELOC_SPARC_OLO10
-@deffnx {} BFD_RELOC_SPARC_HH22
-@deffnx {} BFD_RELOC_SPARC_HM10
-@deffnx {} BFD_RELOC_SPARC_LM22
-@deffnx {} BFD_RELOC_SPARC_PC_HH22
-@deffnx {} BFD_RELOC_SPARC_PC_HM10
-@deffnx {} BFD_RELOC_SPARC_PC_LM22
-@deffnx {} BFD_RELOC_SPARC_WDISP16
-@deffnx {} BFD_RELOC_SPARC_WDISP19
-@deffnx {} BFD_RELOC_SPARC_7
-@deffnx {} BFD_RELOC_SPARC_6
-@deffnx {} BFD_RELOC_SPARC_5
-@deffnx {} BFD_RELOC_SPARC_DISP64
-@deffnx {} BFD_RELOC_SPARC_PLT32
-@deffnx {} BFD_RELOC_SPARC_PLT64
-@deffnx {} BFD_RELOC_SPARC_HIX22
-@deffnx {} BFD_RELOC_SPARC_LOX10
-@deffnx {} BFD_RELOC_SPARC_H44
-@deffnx {} BFD_RELOC_SPARC_M44
-@deffnx {} BFD_RELOC_SPARC_L44
-@deffnx {} BFD_RELOC_SPARC_REGISTER
-SPARC64 relocations
-@end deffn
-@deffn {} BFD_RELOC_SPARC_REV32
-SPARC little endian relocation
-@end deffn
-@deffn {} BFD_RELOC_SPARC_TLS_GD_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_CALL
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_CALL
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_HIX22
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_LOX10
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LD
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LDX
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_LE_HIX22
-@deffnx {} BFD_RELOC_SPARC_TLS_LE_LOX10
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD64
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF64
-@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF32
-@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF64
-SPARC TLS relocations
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP_HI16
-Alpha ECOFF and ELF relocations. Some of these treat the symbol or
-"addend" in some special way.
-For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
-writing; when reading, it will be the absolute section symbol. The
-addend is the displacement in bytes of the "lda" instruction from
-the "ldah" instruction (which is at the address of this reloc).
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP_LO16
-For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
-with GPDISP_HI16 relocs. The addend is ignored when writing the
-relocations out, and is filled in with the file's GP value on
-reading, for convenience.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP
-The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
-relocation except that there is no accompanying GPDISP_LO16
-relocation.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_LITERAL
-@deffnx {} BFD_RELOC_ALPHA_ELF_LITERAL
-@deffnx {} BFD_RELOC_ALPHA_LITUSE
-The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
-the assembler turns it into a LDQ instruction to load the address of
-the symbol, and then fills in a register in the real instruction.
-
-The LITERAL reloc, at the LDQ instruction, refers to the .lita
-section symbol. The addend is ignored when writing, but is filled
-in with the file's GP value on reading, for convenience, as with the
-GPDISP_LO16 reloc.
-
-The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
-It should refer to the symbol to be referenced, as with 16_GOTOFF,
-but it generates output not based on the position within the .got
-section, but relative to the GP value chosen for the file during the
-final link stage.
-
-The LITUSE reloc, on the instruction using the loaded address, gives
-information to the linker that it might be able to use to optimize
-away some literal section references. The symbol is ignored (read
-as the absolute section symbol), and the "addend" indicates the type
-of instruction using the register:
-1 - "memory" fmt insn
-2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch)
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_HINT
-The HINT relocation indicates a value that should be filled into the
-"hint" field of a jmp/jsr/ret instruction, for possible branch-
-prediction logic which may be provided on some processors.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_LINKAGE
-The LINKAGE relocation outputs a linkage pair in the object file,
-which is filled by the linker.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_CODEADDR
-The CODEADDR relocation outputs a STO_CA in the object file,
-which is filled by the linker.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_GPREL_LO16
-The GPREL_HI/LO relocations together form a 32-bit offset from the
-GP register.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_BRSGP
-Like BFD_RELOC_23_PCREL_S2, except that the source and target must
-share a common GP, and the target address is adjusted for
-STO_ALPHA_STD_GPLOAD.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_TLSGD
-@deffnx {} BFD_RELOC_ALPHA_TLSLDM
-@deffnx {} BFD_RELOC_ALPHA_DTPMOD64
-@deffnx {} BFD_RELOC_ALPHA_GOTDTPREL16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL64
-@deffnx {} BFD_RELOC_ALPHA_DTPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL_LO16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL16
-@deffnx {} BFD_RELOC_ALPHA_GOTTPREL16
-@deffnx {} BFD_RELOC_ALPHA_TPREL64
-@deffnx {} BFD_RELOC_ALPHA_TPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_TPREL_LO16
-@deffnx {} BFD_RELOC_ALPHA_TPREL16
-Alpha thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_JMP
-Bits 27..2 of the relocation address shifted right 2 bits;
-simple reloc otherwise.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_JMP
-The MIPS16 jump instruction.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_GPREL
-MIPS16 GP relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_HI16
-High 16 bits of 32-bit value; simple reloc.
-@end deffn
-@deffn {} BFD_RELOC_HI16_S
-High 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result. If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added.
-@end deffn
-@deffn {} BFD_RELOC_LO16
-Low 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_PCREL_HI16_S
-Like BFD_RELOC_HI16_S, but PC relative.
-@end deffn
-@deffn {} BFD_RELOC_PCREL_LO16
-Like BFD_RELOC_LO16, but PC relative.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_LITERAL
-Relocation against a MIPS literal section.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_GOT16
-@deffnx {} BFD_RELOC_MIPS_CALL16
-@deffnx {} BFD_RELOC_MIPS_GOT_HI16
-@deffnx {} BFD_RELOC_MIPS_GOT_LO16
-@deffnx {} BFD_RELOC_MIPS_CALL_HI16
-@deffnx {} BFD_RELOC_MIPS_CALL_LO16
-@deffnx {} BFD_RELOC_MIPS_SUB
-@deffnx {} BFD_RELOC_MIPS_GOT_PAGE
-@deffnx {} BFD_RELOC_MIPS_GOT_OFST
-@deffnx {} BFD_RELOC_MIPS_GOT_DISP
-@deffnx {} BFD_RELOC_MIPS_SHIFT5
-@deffnx {} BFD_RELOC_MIPS_SHIFT6
-@deffnx {} BFD_RELOC_MIPS_INSERT_A
-@deffnx {} BFD_RELOC_MIPS_INSERT_B
-@deffnx {} BFD_RELOC_MIPS_DELETE
-@deffnx {} BFD_RELOC_MIPS_HIGHEST
-@deffnx {} BFD_RELOC_MIPS_HIGHER
-@deffnx {} BFD_RELOC_MIPS_SCN_DISP
-@deffnx {} BFD_RELOC_MIPS_REL16
-@deffnx {} BFD_RELOC_MIPS_RELGOT
-@deffnx {} BFD_RELOC_MIPS_JALR
-MIPS ELF relocations.
-@end deffn
-@deffn {} BFD_RELOC_FRV_LABEL16
-@deffnx {} BFD_RELOC_FRV_LABEL24
-@deffnx {} BFD_RELOC_FRV_LO16
-@deffnx {} BFD_RELOC_FRV_HI16
-@deffnx {} BFD_RELOC_FRV_GPREL12
-@deffnx {} BFD_RELOC_FRV_GPRELU12
-@deffnx {} BFD_RELOC_FRV_GPREL32
-@deffnx {} BFD_RELOC_FRV_GPRELHI
-@deffnx {} BFD_RELOC_FRV_GPRELLO
-@deffnx {} BFD_RELOC_FRV_GOT12
-@deffnx {} BFD_RELOC_FRV_GOTHI
-@deffnx {} BFD_RELOC_FRV_GOTLO
-@deffnx {} BFD_RELOC_FRV_FUNCDESC
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOT12
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTHI
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTLO
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_VALUE
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFF12
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFHI
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
-@deffnx {} BFD_RELOC_FRV_GOTOFF12
-@deffnx {} BFD_RELOC_FRV_GOTOFFHI
-@deffnx {} BFD_RELOC_FRV_GOTOFFLO
-Fujitsu Frv Relocations.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOTOFF24
-This is a 24bit GOT-relative reloc for the mn10300.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT32
-This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT24
-This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT16
-This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_COPY
-Copy symbol at runtime.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GLOB_DAT
-Create GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_JMP_SLOT
-Create PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_RELATIVE
-Adjust by program base.
-@end deffn
-@deffn {} BFD_RELOC_386_GOT32
-@deffnx {} BFD_RELOC_386_PLT32
-@deffnx {} BFD_RELOC_386_COPY
-@deffnx {} BFD_RELOC_386_GLOB_DAT
-@deffnx {} BFD_RELOC_386_JUMP_SLOT
-@deffnx {} BFD_RELOC_386_RELATIVE
-@deffnx {} BFD_RELOC_386_GOTOFF
-@deffnx {} BFD_RELOC_386_GOTPC
-@deffnx {} BFD_RELOC_386_TLS_TPOFF
-@deffnx {} BFD_RELOC_386_TLS_IE
-@deffnx {} BFD_RELOC_386_TLS_GOTIE
-@deffnx {} BFD_RELOC_386_TLS_LE
-@deffnx {} BFD_RELOC_386_TLS_GD
-@deffnx {} BFD_RELOC_386_TLS_LDM
-@deffnx {} BFD_RELOC_386_TLS_LDO_32
-@deffnx {} BFD_RELOC_386_TLS_IE_32
-@deffnx {} BFD_RELOC_386_TLS_LE_32
-@deffnx {} BFD_RELOC_386_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_386_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_386_TLS_TPOFF32
-i386/elf relocations
-@end deffn
-@deffn {} BFD_RELOC_X86_64_GOT32
-@deffnx {} BFD_RELOC_X86_64_PLT32
-@deffnx {} BFD_RELOC_X86_64_COPY
-@deffnx {} BFD_RELOC_X86_64_GLOB_DAT
-@deffnx {} BFD_RELOC_X86_64_JUMP_SLOT
-@deffnx {} BFD_RELOC_X86_64_RELATIVE
-@deffnx {} BFD_RELOC_X86_64_GOTPCREL
-@deffnx {} BFD_RELOC_X86_64_32S
-@deffnx {} BFD_RELOC_X86_64_DTPMOD64
-@deffnx {} BFD_RELOC_X86_64_DTPOFF64
-@deffnx {} BFD_RELOC_X86_64_TPOFF64
-@deffnx {} BFD_RELOC_X86_64_TLSGD
-@deffnx {} BFD_RELOC_X86_64_TLSLD
-@deffnx {} BFD_RELOC_X86_64_DTPOFF32
-@deffnx {} BFD_RELOC_X86_64_GOTTPOFF
-@deffnx {} BFD_RELOC_X86_64_TPOFF32
-x86-64/elf relocations
-@end deffn
-@deffn {} BFD_RELOC_NS32K_IMM_8
-@deffnx {} BFD_RELOC_NS32K_IMM_16
-@deffnx {} BFD_RELOC_NS32K_IMM_32
-@deffnx {} BFD_RELOC_NS32K_IMM_8_PCREL
-@deffnx {} BFD_RELOC_NS32K_IMM_16_PCREL
-@deffnx {} BFD_RELOC_NS32K_IMM_32_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_8
-@deffnx {} BFD_RELOC_NS32K_DISP_16
-@deffnx {} BFD_RELOC_NS32K_DISP_32
-@deffnx {} BFD_RELOC_NS32K_DISP_8_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_16_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_32_PCREL
-ns32k relocations
-@end deffn
-@deffn {} BFD_RELOC_PDP11_DISP_8_PCREL
-@deffnx {} BFD_RELOC_PDP11_DISP_6_PCREL
-PDP11 relocations
-@end deffn
-@deffn {} BFD_RELOC_PJ_CODE_HI16
-@deffnx {} BFD_RELOC_PJ_CODE_LO16
-@deffnx {} BFD_RELOC_PJ_CODE_DIR16
-@deffnx {} BFD_RELOC_PJ_CODE_DIR32
-@deffnx {} BFD_RELOC_PJ_CODE_REL16
-@deffnx {} BFD_RELOC_PJ_CODE_REL32
-Picojava relocs. Not all of these appear in object files.
-@end deffn
-@deffn {} BFD_RELOC_PPC_B26
-@deffnx {} BFD_RELOC_PPC_BA26
-@deffnx {} BFD_RELOC_PPC_TOC16
-@deffnx {} BFD_RELOC_PPC_B16
-@deffnx {} BFD_RELOC_PPC_B16_BRTAKEN
-@deffnx {} BFD_RELOC_PPC_B16_BRNTAKEN
-@deffnx {} BFD_RELOC_PPC_BA16
-@deffnx {} BFD_RELOC_PPC_BA16_BRTAKEN
-@deffnx {} BFD_RELOC_PPC_BA16_BRNTAKEN
-@deffnx {} BFD_RELOC_PPC_COPY
-@deffnx {} BFD_RELOC_PPC_GLOB_DAT
-@deffnx {} BFD_RELOC_PPC_JMP_SLOT
-@deffnx {} BFD_RELOC_PPC_RELATIVE
-@deffnx {} BFD_RELOC_PPC_LOCAL24PC
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR32
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_LO
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HI
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HA
-@deffnx {} BFD_RELOC_PPC_EMB_SDAI16
-@deffnx {} BFD_RELOC_PPC_EMB_SDA2I16
-@deffnx {} BFD_RELOC_PPC_EMB_SDA2REL
-@deffnx {} BFD_RELOC_PPC_EMB_SDA21
-@deffnx {} BFD_RELOC_PPC_EMB_MRKREF
-@deffnx {} BFD_RELOC_PPC_EMB_RELSEC16
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_LO
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_HI
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_HA
-@deffnx {} BFD_RELOC_PPC_EMB_BIT_FLD
-@deffnx {} BFD_RELOC_PPC_EMB_RELSDA
-@deffnx {} BFD_RELOC_PPC64_HIGHER
-@deffnx {} BFD_RELOC_PPC64_HIGHER_S
-@deffnx {} BFD_RELOC_PPC64_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_HIGHEST_S
-@deffnx {} BFD_RELOC_PPC64_TOC16_LO
-@deffnx {} BFD_RELOC_PPC64_TOC16_HI
-@deffnx {} BFD_RELOC_PPC64_TOC16_HA
-@deffnx {} BFD_RELOC_PPC64_TOC
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HI
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HA
-@deffnx {} BFD_RELOC_PPC64_ADDR16_DS
-@deffnx {} BFD_RELOC_PPC64_ADDR16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_GOT16_DS
-@deffnx {} BFD_RELOC_PPC64_GOT16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_PLT16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_SECTOFF_DS
-@deffnx {} BFD_RELOC_PPC64_SECTOFF_LO_DS
-@deffnx {} BFD_RELOC_PPC64_TOC16_DS
-@deffnx {} BFD_RELOC_PPC64_TOC16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_DS
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO_DS
-Power(rs6000) and PowerPC relocations.
-@end deffn
-@deffn {} BFD_RELOC_PPC_TLS
-@deffnx {} BFD_RELOC_PPC_DTPMOD
-@deffnx {} BFD_RELOC_PPC_TPREL16
-@deffnx {} BFD_RELOC_PPC_TPREL16_LO
-@deffnx {} BFD_RELOC_PPC_TPREL16_HI
-@deffnx {} BFD_RELOC_PPC_TPREL16_HA
-@deffnx {} BFD_RELOC_PPC_TPREL
-@deffnx {} BFD_RELOC_PPC_DTPREL16
-@deffnx {} BFD_RELOC_PPC_DTPREL16_LO
-@deffnx {} BFD_RELOC_PPC_DTPREL16_HI
-@deffnx {} BFD_RELOC_PPC_DTPREL16_HA
-@deffnx {} BFD_RELOC_PPC_DTPREL
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HA
-@deffnx {} BFD_RELOC_PPC64_TPREL16_DS
-@deffnx {} BFD_RELOC_PPC64_TPREL16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHER
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHERA
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHESTA
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_DS
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHER
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHERA
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHESTA
-PowerPC and PowerPC64 thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_I370_D12
-IBM 370/390 relocations
-@end deffn
-@deffn {} BFD_RELOC_CTOR
-The type of reloc used to build a constructor table - at the moment
-probably a 32 bit wide absolute relocation, but the target can choose.
-It generally does map to one of the other relocation types.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_BRANCH
-ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
-not stored in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_BLX
-ARM 26 bit pc-relative branch. The lowest bit must be zero and is
-not stored in the instruction. The 2nd lowest bit comes from a 1 bit
-field in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_THUMB_PCREL_BLX
-Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
-not stored in the instruction. The 2nd lowest bit comes from a 1 bit
-field in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_OFFSET_IMM
-@deffnx {} BFD_RELOC_ARM_SHIFT_IMM
-@deffnx {} BFD_RELOC_ARM_SWI
-@deffnx {} BFD_RELOC_ARM_MULTI
-@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM
-@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM_S2
-@deffnx {} BFD_RELOC_ARM_ADR_IMM
-@deffnx {} BFD_RELOC_ARM_LDR_IMM
-@deffnx {} BFD_RELOC_ARM_LITERAL
-@deffnx {} BFD_RELOC_ARM_IN_POOL
-@deffnx {} BFD_RELOC_ARM_OFFSET_IMM8
-@deffnx {} BFD_RELOC_ARM_HWLITERAL
-@deffnx {} BFD_RELOC_ARM_THUMB_ADD
-@deffnx {} BFD_RELOC_ARM_THUMB_IMM
-@deffnx {} BFD_RELOC_ARM_THUMB_SHIFT
-@deffnx {} BFD_RELOC_ARM_THUMB_OFFSET
-@deffnx {} BFD_RELOC_ARM_GOT12
-@deffnx {} BFD_RELOC_ARM_GOT32
-@deffnx {} BFD_RELOC_ARM_JUMP_SLOT
-@deffnx {} BFD_RELOC_ARM_COPY
-@deffnx {} BFD_RELOC_ARM_GLOB_DAT
-@deffnx {} BFD_RELOC_ARM_PLT32
-@deffnx {} BFD_RELOC_ARM_RELATIVE
-@deffnx {} BFD_RELOC_ARM_GOTOFF
-@deffnx {} BFD_RELOC_ARM_GOTPC
-These relocs are only used within the ARM assembler. They are not
-(at present) written to any object files.
-@end deffn
-@deffn {} BFD_RELOC_SH_PCDISP8BY2
-@deffnx {} BFD_RELOC_SH_PCDISP12BY2
-@deffnx {} BFD_RELOC_SH_IMM4
-@deffnx {} BFD_RELOC_SH_IMM4BY2
-@deffnx {} BFD_RELOC_SH_IMM4BY4
-@deffnx {} BFD_RELOC_SH_IMM8
-@deffnx {} BFD_RELOC_SH_IMM8BY2
-@deffnx {} BFD_RELOC_SH_IMM8BY4
-@deffnx {} BFD_RELOC_SH_PCRELIMM8BY2
-@deffnx {} BFD_RELOC_SH_PCRELIMM8BY4
-@deffnx {} BFD_RELOC_SH_SWITCH16
-@deffnx {} BFD_RELOC_SH_SWITCH32
-@deffnx {} BFD_RELOC_SH_USES
-@deffnx {} BFD_RELOC_SH_COUNT
-@deffnx {} BFD_RELOC_SH_ALIGN
-@deffnx {} BFD_RELOC_SH_CODE
-@deffnx {} BFD_RELOC_SH_DATA
-@deffnx {} BFD_RELOC_SH_LABEL
-@deffnx {} BFD_RELOC_SH_LOOP_START
-@deffnx {} BFD_RELOC_SH_LOOP_END
-@deffnx {} BFD_RELOC_SH_COPY
-@deffnx {} BFD_RELOC_SH_GLOB_DAT
-@deffnx {} BFD_RELOC_SH_JMP_SLOT
-@deffnx {} BFD_RELOC_SH_RELATIVE
-@deffnx {} BFD_RELOC_SH_GOTPC
-@deffnx {} BFD_RELOC_SH_GOT_LOW16
-@deffnx {} BFD_RELOC_SH_GOT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOT_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOT_HI16
-@deffnx {} BFD_RELOC_SH_GOTPLT_LOW16
-@deffnx {} BFD_RELOC_SH_GOTPLT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTPLT_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTPLT_HI16
-@deffnx {} BFD_RELOC_SH_PLT_LOW16
-@deffnx {} BFD_RELOC_SH_PLT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_PLT_MEDHI16
-@deffnx {} BFD_RELOC_SH_PLT_HI16
-@deffnx {} BFD_RELOC_SH_GOTOFF_LOW16
-@deffnx {} BFD_RELOC_SH_GOTOFF_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTOFF_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTOFF_HI16
-@deffnx {} BFD_RELOC_SH_GOTPC_LOW16
-@deffnx {} BFD_RELOC_SH_GOTPC_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTPC_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTPC_HI16
-@deffnx {} BFD_RELOC_SH_COPY64
-@deffnx {} BFD_RELOC_SH_GLOB_DAT64
-@deffnx {} BFD_RELOC_SH_JMP_SLOT64
-@deffnx {} BFD_RELOC_SH_RELATIVE64
-@deffnx {} BFD_RELOC_SH_GOT10BY4
-@deffnx {} BFD_RELOC_SH_GOT10BY8
-@deffnx {} BFD_RELOC_SH_GOTPLT10BY4
-@deffnx {} BFD_RELOC_SH_GOTPLT10BY8
-@deffnx {} BFD_RELOC_SH_GOTPLT32
-@deffnx {} BFD_RELOC_SH_SHMEDIA_CODE
-@deffnx {} BFD_RELOC_SH_IMMU5
-@deffnx {} BFD_RELOC_SH_IMMS6
-@deffnx {} BFD_RELOC_SH_IMMS6BY32
-@deffnx {} BFD_RELOC_SH_IMMU6
-@deffnx {} BFD_RELOC_SH_IMMS10
-@deffnx {} BFD_RELOC_SH_IMMS10BY2
-@deffnx {} BFD_RELOC_SH_IMMS10BY4
-@deffnx {} BFD_RELOC_SH_IMMS10BY8
-@deffnx {} BFD_RELOC_SH_IMMS16
-@deffnx {} BFD_RELOC_SH_IMMU16
-@deffnx {} BFD_RELOC_SH_IMM_LOW16
-@deffnx {} BFD_RELOC_SH_IMM_LOW16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16
-@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_MEDHI16
-@deffnx {} BFD_RELOC_SH_IMM_MEDHI16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_HI16
-@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL
-@deffnx {} BFD_RELOC_SH_PT_16
-@deffnx {} BFD_RELOC_SH_TLS_GD_32
-@deffnx {} BFD_RELOC_SH_TLS_LD_32
-@deffnx {} BFD_RELOC_SH_TLS_LDO_32
-@deffnx {} BFD_RELOC_SH_TLS_IE_32
-@deffnx {} BFD_RELOC_SH_TLS_LE_32
-@deffnx {} BFD_RELOC_SH_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_SH_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_SH_TLS_TPOFF32
-Renesas / SuperH SH relocs. Not all of these appear in object files.
-@end deffn
-@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH9
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23
-Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must
-be zero and is not stored in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARC_B22_PCREL
-ARC Cores relocs.
-ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
-not stored in the instruction. The high 20 bits are installed in bits 26
-through 7 of the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARC_B26
-ARC 26 bit absolute branch. The lowest two bits must be zero and are not
-stored in the instruction. The high 24 bits are installed in bits 23
-through 0.
-@end deffn
-@deffn {} BFD_RELOC_D10V_10_PCREL_R
-Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D10V_10_PCREL_L
-Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0. This is the same as the previous reloc
-except it is in the left container, i.e.,
-shifted left 15 bits.
-@end deffn
-@deffn {} BFD_RELOC_D10V_18
-This is an 18-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D10V_18_PCREL
-This is an 18-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_6
-Mitsubishi D30V relocs.
-This is a 6-bit absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_D30V_9_PCREL
-This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_9_PCREL_R
-This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15
-This is a 12-bit absolute reloc with the
-right 3 bitsassumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15_PCREL
-This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15_PCREL_R
-This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21
-This is an 18-bit absolute reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21_PCREL
-This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21_PCREL_R
-This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_32
-This is a 32-bit absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_D30V_32_PCREL
-This is a 32-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_DLX_HI16_S
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_DLX_LO16
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_DLX_JMP26
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_M32R_24
-Renesas M32R (formerly Mitsubishi M32R) relocs.
-This is a 24 bit absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M32R_10_PCREL
-This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_18_PCREL
-This is an 18-bit reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_26_PCREL
-This is a 26-bit reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_HI16_ULO
-This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as unsigned.
-@end deffn
-@deffn {} BFD_RELOC_M32R_HI16_SLO
-This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as signed.
-@end deffn
-@deffn {} BFD_RELOC_M32R_LO16
-This is a 16-bit reloc containing the lower 16 bits of an address.
-@end deffn
-@deffn {} BFD_RELOC_M32R_SDA16
-This is a 16-bit reloc containing the small data area offset for use in
-add3, load, and store instructions.
-@end deffn
-@deffn {} BFD_RELOC_M32R_GOT24
-@deffnx {} BFD_RELOC_M32R_26_PLTREL
-@deffnx {} BFD_RELOC_M32R_COPY
-@deffnx {} BFD_RELOC_M32R_GLOB_DAT
-@deffnx {} BFD_RELOC_M32R_JMP_SLOT
-@deffnx {} BFD_RELOC_M32R_RELATIVE
-@deffnx {} BFD_RELOC_M32R_GOTOFF
-@deffnx {} BFD_RELOC_M32R_GOTPC24
-@deffnx {} BFD_RELOC_M32R_GOT16_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOT16_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOT16_LO
-@deffnx {} BFD_RELOC_M32R_GOTPC_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOTPC_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOTPC_LO
-For PIC.
-@end deffn
-@deffn {} BFD_RELOC_V850_9_PCREL
-This is a 9-bit reloc
-@end deffn
-@deffn {} BFD_RELOC_V850_22_PCREL
-This is a 22-bit reloc
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_16_16_OFFSET
-This is a 16 bit offset from the short data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_15_16_OFFSET
-This is a 16 bit offset (of which only 15 bits are used) from the
-short data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_16_16_OFFSET
-This is a 16 bit offset from the zero data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_15_16_OFFSET
-This is a 16 bit offset (of which only 15 bits are used) from the
-zero data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_6_8_OFFSET
-This is an 8 bit offset (of which only 6 bits are used) from the
-tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_7_8_OFFSET
-This is an 8bit offset (of which only 7 bits are used) from the tiny
-data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_7_7_OFFSET
-This is a 7 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_16_16_OFFSET
-This is a 16 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_4_5_OFFSET
-This is a 5 bit offset (of which only 4 bits are used) from the tiny
-data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_4_4_OFFSET
-This is a 4 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
-This is a 16 bit offset from the short data area pointer, with the
-bits placed non-contiguously in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
-This is a 16 bit offset from the zero data area pointer, with the
-bits placed non-contiguously in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_V850_CALLT_6_7_OFFSET
-This is a 6 bit offset from the call table base pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_CALLT_16_16_OFFSET
-This is a 16 bit offset from the call table base pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_LONGCALL
-Used for relaxing indirect function calls.
-@end deffn
-@deffn {} BFD_RELOC_V850_LONGJUMP
-Used for relaxing indirect jumps.
-@end deffn
-@deffn {} BFD_RELOC_V850_ALIGN
-Used to maintain alignment whilst relaxing.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_32_PCREL
-This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_16_PCREL
-This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.
-@end deffn
-@deffn {} BFD_RELOC_TIC30_LDP
-This is a 8bit DP reloc for the tms320c30, where the most
-significant 8 bits of a 24 bit word are placed into the least
-significant 8 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_PARTLS7
-This is a 7bit reloc for the tms320c54x, where the least
-significant 7 bits of a 16 bit word are placed into the least
-significant 7 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_PARTMS9
-This is a 9bit DP reloc for the tms320c54x, where the most
-significant 9 bits of a 16 bit word are placed into the least
-significant 9 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_23
-This is an extended address 23-bit reloc for the tms320c54x.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_16_OF_23
-This is a 16-bit reloc for the tms320c54x, where the least
-significant 16 bits of a 23-bit extended address are placed into
-the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_MS7_OF_23
-This is a reloc for the tms320c54x, where the most
-significant 7 bits of a 23-bit extended address are placed into
-the opcode.
-@end deffn
-@deffn {} BFD_RELOC_FR30_48
-This is a 48 bit reloc for the FR30 that stores 32 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_20
-This is a 32 bit reloc for the FR30 that stores 20 bits split up into
-two sections.
-@end deffn
-@deffn {} BFD_RELOC_FR30_6_IN_4
-This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
-4 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_8_IN_8
-This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_9_IN_8
-This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_10_IN_8
-This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_9_PCREL
-This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
-short offset into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_12_PCREL
-This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
-short offset into 11 bits.
-@end deffn
-@deffn {} BFD_RELOC_MCORE_PCREL_IMM8BY4
-@deffnx {} BFD_RELOC_MCORE_PCREL_IMM11BY2
-@deffnx {} BFD_RELOC_MCORE_PCREL_IMM4BY2
-@deffnx {} BFD_RELOC_MCORE_PCREL_32
-@deffnx {} BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2
-@deffnx {} BFD_RELOC_MCORE_RVA
-Motorola Mcore relocations.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_GETA
-@deffnx {} BFD_RELOC_MMIX_GETA_1
-@deffnx {} BFD_RELOC_MMIX_GETA_2
-@deffnx {} BFD_RELOC_MMIX_GETA_3
-These are relocations for the GETA instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_CBRANCH
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_J
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_1
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_2
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_3
-These are relocations for a conditional branch instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_PUSHJ
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_1
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_2
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_3
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_STUBBABLE
-These are relocations for the PUSHJ instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_JMP
-@deffnx {} BFD_RELOC_MMIX_JMP_1
-@deffnx {} BFD_RELOC_MMIX_JMP_2
-@deffnx {} BFD_RELOC_MMIX_JMP_3
-These are relocations for the JMP instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_ADDR19
-This is a relocation for a relative address as in a GETA instruction or
-a branch.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_ADDR27
-This is a relocation for a relative address as in a JMP instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_REG_OR_BYTE
-This is a relocation for an instruction field that may be a general
-register or a value 0..255.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_REG
-This is a relocation for an instruction field that may be a general
-register.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_BASE_PLUS_OFFSET
-This is a relocation for two instruction fields holding a register and
-an offset, the equivalent of the relocation.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_LOCAL
-This relocation is an assertion that the expression is not allocated as
-a global register. It does not modify contents.
-@end deffn
-@deffn {} BFD_RELOC_AVR_7_PCREL
-This is a 16 bit reloc for the AVR that stores 8 bit pc relative
-short offset into 7 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_13_PCREL
-This is a 16 bit reloc for the AVR that stores 13 bit pc relative
-short offset into 12 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_16_PM
-This is a 16 bit reloc for the AVR that stores 17 bit value (usually
-program memory address) into 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-data memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of data memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of program memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually data memory address) into 8 bit immediate value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of data memory address) into 8 bit immediate value of
-SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(most high 8 bit of program memory address) into 8 bit immediate value
-of LDI or SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually command address) into 8 bit immediate value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of 16 bit command address) into 8 bit immediate value
-of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 6 bit of 22 bit command address) into 8 bit immediate
-value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_CALL
-This is a 32 bit reloc for the AVR that stores 23 bit value
-into 22 bits.
-@end deffn
-@deffn {} BFD_RELOC_390_12
-Direct 12 bit.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT12
-12 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT32
-32 bit PC relative PLT address.
-@end deffn
-@deffn {} BFD_RELOC_390_COPY
-Copy symbol at runtime.
-@end deffn
-@deffn {} BFD_RELOC_390_GLOB_DAT
-Create GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_JMP_SLOT
-Create PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_RELATIVE
-Adjust by program base.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPC
-32 bit PC relative offset to GOT.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT16
-16 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PC16DBL
-PC relative 16 bit shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT16DBL
-16 bit PC rel. PLT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PC32DBL
-PC relative 32 bit shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT32DBL
-32 bit PC rel. PLT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPCDBL
-32 bit PC rel. GOT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT64
-64 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT64
-64 bit PC relative PLT address.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTENT
-32 bit rel. offset to GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTOFF64
-64 bit offset to GOT.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT12
-12-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT16
-16-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT32
-32-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT64
-64-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLTENT
-32-bit rel. offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF16
-16-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF32
-32-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF64
-64-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_TLS_LOAD
-@deffnx {} BFD_RELOC_390_TLS_GDCALL
-@deffnx {} BFD_RELOC_390_TLS_LDCALL
-@deffnx {} BFD_RELOC_390_TLS_GD32
-@deffnx {} BFD_RELOC_390_TLS_GD64
-@deffnx {} BFD_RELOC_390_TLS_GOTIE12
-@deffnx {} BFD_RELOC_390_TLS_GOTIE32
-@deffnx {} BFD_RELOC_390_TLS_GOTIE64
-@deffnx {} BFD_RELOC_390_TLS_LDM32
-@deffnx {} BFD_RELOC_390_TLS_LDM64
-@deffnx {} BFD_RELOC_390_TLS_IE32
-@deffnx {} BFD_RELOC_390_TLS_IE64
-@deffnx {} BFD_RELOC_390_TLS_IEENT
-@deffnx {} BFD_RELOC_390_TLS_LE32
-@deffnx {} BFD_RELOC_390_TLS_LE64
-@deffnx {} BFD_RELOC_390_TLS_LDO32
-@deffnx {} BFD_RELOC_390_TLS_LDO64
-@deffnx {} BFD_RELOC_390_TLS_DTPMOD
-@deffnx {} BFD_RELOC_390_TLS_DTPOFF
-@deffnx {} BFD_RELOC_390_TLS_TPOFF
-s390 tls relocations.
-@end deffn
-@deffn {} BFD_RELOC_390_20
-@deffnx {} BFD_RELOC_390_GOT20
-@deffnx {} BFD_RELOC_390_GOTPLT20
-@deffnx {} BFD_RELOC_390_TLS_GOTIE20
-Long displacement extension.
-@end deffn
-@deffn {} BFD_RELOC_IP2K_FR9
-Scenix IP2K - 9-bit register number / data address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_BANK
-Scenix IP2K - 4-bit register/data bank number
-@end deffn
-@deffn {} BFD_RELOC_IP2K_ADDR16CJP
-Scenix IP2K - low 13 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_PAGE3
-Scenix IP2K - high 3 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_LO8DATA
-@deffnx {} BFD_RELOC_IP2K_HI8DATA
-@deffnx {} BFD_RELOC_IP2K_EX8DATA
-Scenix IP2K - ext/low/high 8 bits of data address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_LO8INSN
-@deffnx {} BFD_RELOC_IP2K_HI8INSN
-Scenix IP2K - low/high 8 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_PC_SKIP
-Scenix IP2K - even/odd PC modifier to modify snb pcl.0
-@end deffn
-@deffn {} BFD_RELOC_IP2K_TEXT
-Scenix IP2K - 16 bit word address in text section.
-@end deffn
-@deffn {} BFD_RELOC_IP2K_FR_OFFSET
-Scenix IP2K - 7-bit sp or dp offset
-@end deffn
-@deffn {} BFD_RELOC_VPE4KMATH_DATA
-@deffnx {} BFD_RELOC_VPE4KMATH_INSN
-Scenix VPE4K coprocessor - data/insn-space addressing
-@end deffn
-@deffn {} BFD_RELOC_VTABLE_INHERIT
-@deffnx {} BFD_RELOC_VTABLE_ENTRY
-These two relocations are used by the linker to determine which of
-the entries in a C++ virtual function table are actually used. When
-the --gc-sections option is given, the linker will zero out the entries
-that are not used, so that the code for those functions need not be
-included in the output.
-
-VTABLE_INHERIT is a zero-space relocation used to describe to the
-linker the inheritance tree of a C++ virtual function table. The
-relocation's symbol should be the parent class' vtable, and the
-relocation should be located at the child vtable.
-
-VTABLE_ENTRY is a zero-space relocation that describes the use of a
-virtual function table entry. The reloc's symbol should refer to the
-table of the class mentioned in the code. Off of that base, an offset
-describes the entry that is being used. For Rela hosts, this offset
-is stored in the reloc's addend. For Rel hosts, we are forced to put
-this offset in the reloc's section offset.
-@end deffn
-@deffn {} BFD_RELOC_IA64_IMM14
-@deffnx {} BFD_RELOC_IA64_IMM22
-@deffnx {} BFD_RELOC_IA64_IMM64
-@deffnx {} BFD_RELOC_IA64_DIR32MSB
-@deffnx {} BFD_RELOC_IA64_DIR32LSB
-@deffnx {} BFD_RELOC_IA64_DIR64MSB
-@deffnx {} BFD_RELOC_IA64_DIR64LSB
-@deffnx {} BFD_RELOC_IA64_GPREL22
-@deffnx {} BFD_RELOC_IA64_GPREL64I
-@deffnx {} BFD_RELOC_IA64_GPREL32MSB
-@deffnx {} BFD_RELOC_IA64_GPREL32LSB
-@deffnx {} BFD_RELOC_IA64_GPREL64MSB
-@deffnx {} BFD_RELOC_IA64_GPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF22
-@deffnx {} BFD_RELOC_IA64_LTOFF64I
-@deffnx {} BFD_RELOC_IA64_PLTOFF22
-@deffnx {} BFD_RELOC_IA64_PLTOFF64I
-@deffnx {} BFD_RELOC_IA64_PLTOFF64MSB
-@deffnx {} BFD_RELOC_IA64_PLTOFF64LSB
-@deffnx {} BFD_RELOC_IA64_FPTR64I
-@deffnx {} BFD_RELOC_IA64_FPTR32MSB
-@deffnx {} BFD_RELOC_IA64_FPTR32LSB
-@deffnx {} BFD_RELOC_IA64_FPTR64MSB
-@deffnx {} BFD_RELOC_IA64_FPTR64LSB
-@deffnx {} BFD_RELOC_IA64_PCREL21B
-@deffnx {} BFD_RELOC_IA64_PCREL21BI
-@deffnx {} BFD_RELOC_IA64_PCREL21M
-@deffnx {} BFD_RELOC_IA64_PCREL21F
-@deffnx {} BFD_RELOC_IA64_PCREL22
-@deffnx {} BFD_RELOC_IA64_PCREL60B
-@deffnx {} BFD_RELOC_IA64_PCREL64I
-@deffnx {} BFD_RELOC_IA64_PCREL32MSB
-@deffnx {} BFD_RELOC_IA64_PCREL32LSB
-@deffnx {} BFD_RELOC_IA64_PCREL64MSB
-@deffnx {} BFD_RELOC_IA64_PCREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR22
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64I
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32MSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64MSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64LSB
-@deffnx {} BFD_RELOC_IA64_SEGREL32MSB
-@deffnx {} BFD_RELOC_IA64_SEGREL32LSB
-@deffnx {} BFD_RELOC_IA64_SEGREL64MSB
-@deffnx {} BFD_RELOC_IA64_SEGREL64LSB
-@deffnx {} BFD_RELOC_IA64_SECREL32MSB
-@deffnx {} BFD_RELOC_IA64_SECREL32LSB
-@deffnx {} BFD_RELOC_IA64_SECREL64MSB
-@deffnx {} BFD_RELOC_IA64_SECREL64LSB
-@deffnx {} BFD_RELOC_IA64_REL32MSB
-@deffnx {} BFD_RELOC_IA64_REL32LSB
-@deffnx {} BFD_RELOC_IA64_REL64MSB
-@deffnx {} BFD_RELOC_IA64_REL64LSB
-@deffnx {} BFD_RELOC_IA64_LTV32MSB
-@deffnx {} BFD_RELOC_IA64_LTV32LSB
-@deffnx {} BFD_RELOC_IA64_LTV64MSB
-@deffnx {} BFD_RELOC_IA64_LTV64LSB
-@deffnx {} BFD_RELOC_IA64_IPLTMSB
-@deffnx {} BFD_RELOC_IA64_IPLTLSB
-@deffnx {} BFD_RELOC_IA64_COPY
-@deffnx {} BFD_RELOC_IA64_LTOFF22X
-@deffnx {} BFD_RELOC_IA64_LDXMOV
-@deffnx {} BFD_RELOC_IA64_TPREL14
-@deffnx {} BFD_RELOC_IA64_TPREL22
-@deffnx {} BFD_RELOC_IA64_TPREL64I
-@deffnx {} BFD_RELOC_IA64_TPREL64MSB
-@deffnx {} BFD_RELOC_IA64_TPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_TPREL22
-@deffnx {} BFD_RELOC_IA64_DTPMOD64MSB
-@deffnx {} BFD_RELOC_IA64_DTPMOD64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_DTPMOD22
-@deffnx {} BFD_RELOC_IA64_DTPREL14
-@deffnx {} BFD_RELOC_IA64_DTPREL22
-@deffnx {} BFD_RELOC_IA64_DTPREL64I
-@deffnx {} BFD_RELOC_IA64_DTPREL32MSB
-@deffnx {} BFD_RELOC_IA64_DTPREL32LSB
-@deffnx {} BFD_RELOC_IA64_DTPREL64MSB
-@deffnx {} BFD_RELOC_IA64_DTPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_DTPREL22
-Intel IA64 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_HI8
-Motorola 68HC11 reloc.
-This is the 8 bit high part of an absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_LO8
-Motorola 68HC11 reloc.
-This is the 8 bit low part of an absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_3B
-Motorola 68HC11 reloc.
-This is the 3 bit of a value.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_RL_JUMP
-Motorola 68HC11 reloc.
-This reloc marks the beginning of a jump/call instruction.
-It is used for linker relaxation to correctly identify beginning
-of instruction and change some branches to use PC-relative
-addressing mode.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_RL_GROUP
-Motorola 68HC11 reloc.
-This reloc marks a group of several instructions that gcc generates
-and for which the linker relaxation pass can modify and/or remove
-some of them.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_LO16
-Motorola 68HC11 reloc.
-This is the 16-bit lower part of an address. It is used for 'call'
-instruction to specify the symbol address without any special
-transformation (due to memory bank window).
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_PAGE
-Motorola 68HC11 reloc.
-This is a 8-bit reloc that specifies the page number of an address.
-It is used by 'call' instruction to specify the page number of
-the symbol.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_24
-Motorola 68HC11 reloc.
-This is a 24-bit reloc that represents the address with a 16-bit
-value and a 8-bit page number. The symbol address is transformed
-to follow the 16K memory bank of 68HC12 (seen as mapped in the window).
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_5B
-Motorola 68HC12 reloc.
-This is the 5 bits of a value.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_BDISP8
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_5
-@deffnx {} BFD_RELOC_CRIS_SIGNED_6
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_6
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_4
-These relocs are only used within the CRIS assembler. They are not
-(at present) written to any object files.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_COPY
-@deffnx {} BFD_RELOC_CRIS_GLOB_DAT
-@deffnx {} BFD_RELOC_CRIS_JUMP_SLOT
-@deffnx {} BFD_RELOC_CRIS_RELATIVE
-Relocs used in ELF shared libraries for CRIS.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOT
-32-bit offset to symbol-entry within GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_16_GOT
-16-bit offset to symbol-entry within GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOTPLT
-32-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_16_GOTPLT
-16-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOTREL
-32-bit offset to symbol, relative to GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_PLT_GOTREL
-32-bit offset to symbol with PLT entry, relative to GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_PLT_PCREL
-32-bit offset to symbol with PLT entry, relative to this relocation.
-@end deffn
-@deffn {} BFD_RELOC_860_COPY
-@deffnx {} BFD_RELOC_860_GLOB_DAT
-@deffnx {} BFD_RELOC_860_JUMP_SLOT
-@deffnx {} BFD_RELOC_860_RELATIVE
-@deffnx {} BFD_RELOC_860_PC26
-@deffnx {} BFD_RELOC_860_PLT26
-@deffnx {} BFD_RELOC_860_PC16
-@deffnx {} BFD_RELOC_860_LOW0
-@deffnx {} BFD_RELOC_860_SPLIT0
-@deffnx {} BFD_RELOC_860_LOW1
-@deffnx {} BFD_RELOC_860_SPLIT1
-@deffnx {} BFD_RELOC_860_LOW2
-@deffnx {} BFD_RELOC_860_SPLIT2
-@deffnx {} BFD_RELOC_860_LOW3
-@deffnx {} BFD_RELOC_860_LOGOT0
-@deffnx {} BFD_RELOC_860_SPGOT0
-@deffnx {} BFD_RELOC_860_LOGOT1
-@deffnx {} BFD_RELOC_860_SPGOT1
-@deffnx {} BFD_RELOC_860_LOGOTOFF0
-@deffnx {} BFD_RELOC_860_SPGOTOFF0
-@deffnx {} BFD_RELOC_860_LOGOTOFF1
-@deffnx {} BFD_RELOC_860_SPGOTOFF1
-@deffnx {} BFD_RELOC_860_LOGOTOFF2
-@deffnx {} BFD_RELOC_860_LOGOTOFF3
-@deffnx {} BFD_RELOC_860_LOPC
-@deffnx {} BFD_RELOC_860_HIGHADJ
-@deffnx {} BFD_RELOC_860_HAGOT
-@deffnx {} BFD_RELOC_860_HAGOTOFF
-@deffnx {} BFD_RELOC_860_HAPC
-@deffnx {} BFD_RELOC_860_HIGH
-@deffnx {} BFD_RELOC_860_HIGOT
-@deffnx {} BFD_RELOC_860_HIGOTOFF
-Intel i860 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_OPENRISC_ABS_26
-@deffnx {} BFD_RELOC_OPENRISC_REL_26
-OpenRISC Relocations.
-@end deffn
-@deffn {} BFD_RELOC_H8_DIR16A8
-@deffnx {} BFD_RELOC_H8_DIR16R8
-@deffnx {} BFD_RELOC_H8_DIR24A8
-@deffnx {} BFD_RELOC_H8_DIR24R8
-@deffnx {} BFD_RELOC_H8_DIR32A16
-H8 elf Relocations.
-@end deffn
-@deffn {} BFD_RELOC_XSTORMY16_REL_12
-@deffnx {} BFD_RELOC_XSTORMY16_12
-@deffnx {} BFD_RELOC_XSTORMY16_24
-@deffnx {} BFD_RELOC_XSTORMY16_FPTR16
-Sony Xstormy16 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_VAX_GLOB_DAT
-@deffnx {} BFD_RELOC_VAX_JMP_SLOT
-@deffnx {} BFD_RELOC_VAX_RELATIVE
-Relocations used by VAX ELF.
-@end deffn
-@deffn {} BFD_RELOC_MSP430_10_PCREL
-@deffnx {} BFD_RELOC_MSP430_16_PCREL
-@deffnx {} BFD_RELOC_MSP430_16
-@deffnx {} BFD_RELOC_MSP430_16_PCREL_BYTE
-@deffnx {} BFD_RELOC_MSP430_16_BYTE
-msp430 specific relocation codes
-@end deffn
-@deffn {} BFD_RELOC_IQ2000_OFFSET_16
-@deffnx {} BFD_RELOC_IQ2000_OFFSET_21
-@deffnx {} BFD_RELOC_IQ2000_UHI16
-IQ2000 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_RTLD
-Special Xtensa relocation used only by PLT entries in ELF shared
-objects to indicate that the runtime linker should set the value
-to one of its own internal functions or data structures.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_GLOB_DAT
-@deffnx {} BFD_RELOC_XTENSA_JMP_SLOT
-@deffnx {} BFD_RELOC_XTENSA_RELATIVE
-Xtensa relocations for ELF shared objects.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_PLT
-Xtensa relocation used in ELF object files for symbols that may require
-PLT entries. Otherwise, this is just a generic 32-bit relocation.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_OP0
-@deffnx {} BFD_RELOC_XTENSA_OP1
-@deffnx {} BFD_RELOC_XTENSA_OP2
-Generic Xtensa relocations. Only the operand number is encoded
-in the relocation. The details are determined by extracting the
-instruction opcode.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_ASM_EXPAND
-Xtensa relocation to mark that the assembler expanded the
-instructions from an original target. The expansion size is
-encoded in the reloc size.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_ASM_SIMPLIFY
-Xtensa relocation to mark that the linker should simplify
-assembler-expanded instructions. This is commonly used
-internally by the linker after analysis of a
-BFD_RELOC_XTENSA_ASM_EXPAND.
-@end deffn
-
-@example
-
-typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-@end example
-@findex bfd_reloc_type_lookup
-@subsubsection @code{bfd_reloc_type_lookup}
-@strong{Synopsis}
-@example
-reloc_howto_type *bfd_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-@end example
-@strong{Description}@*
-Return a pointer to a howto structure which, when
-invoked, will perform the relocation @var{code} on data from the
-architecture noted.
-
-@findex bfd_default_reloc_type_lookup
-@subsubsection @code{bfd_default_reloc_type_lookup}
-@strong{Synopsis}
-@example
-reloc_howto_type *bfd_default_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-@end example
-@strong{Description}@*
-Provides a default relocation lookup routine for any architecture.
-
-@findex bfd_get_reloc_code_name
-@subsubsection @code{bfd_get_reloc_code_name}
-@strong{Synopsis}
-@example
-const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
-@end example
-@strong{Description}@*
-Provides a printable name for the supplied relocation code.
-Useful mainly for printing error messages.
-
-@findex bfd_generic_relax_section
-@subsubsection @code{bfd_generic_relax_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_relax_section
- (bfd *abfd,
- asection *section,
- struct bfd_link_info *,
- bfd_boolean *);
-@end example
-@strong{Description}@*
-Provides default handling for relaxing for back ends which
-don't do relaxing -- i.e., does nothing except make sure that the
-final size of the section is set.
-
-@findex bfd_generic_gc_sections
-@subsubsection @code{bfd_generic_gc_sections}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_gc_sections
- (bfd *, struct bfd_link_info *);
-@end example
-@strong{Description}@*
-Provides default handling for relaxing for back ends which
-don't do section gc -- i.e., does nothing.
-
-@findex bfd_generic_merge_sections
-@subsubsection @code{bfd_generic_merge_sections}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_merge_sections
- (bfd *, struct bfd_link_info *);
-@end example
-@strong{Description}@*
-Provides default handling for SEC_MERGE section merging for back ends
-which don't have SEC_MERGE support -- i.e., does nothing.
-
-@findex bfd_generic_get_relocated_section_contents
-@subsubsection @code{bfd_generic_get_relocated_section_contents}
-@strong{Synopsis}
-@example
-bfd_byte *bfd_generic_get_relocated_section_contents
- (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols);
-@end example
-@strong{Description}@*
-Provides default handling of relocation effort for back ends
-which can't be bothered to do it efficiently.
-
diff --git a/contrib/binutils/bfd/doc/section.texi b/contrib/binutils/bfd/doc/section.texi
deleted file mode 100644
index b1501f9..0000000
--- a/contrib/binutils/bfd/doc/section.texi
+++ /dev/null
@@ -1,817 +0,0 @@
-@section Sections
-The raw data contained within a BFD is maintained through the
-section abstraction. A single BFD may have any number of
-sections. It keeps hold of them by pointing to the first;
-each one points to the next in the list.
-
-Sections are supported in BFD in @code{section.c}.
-
-@menu
-* Section Input::
-* Section Output::
-* typedef asection::
-* section prototypes::
-@end menu
-
-@node Section Input, Section Output, Sections, Sections
-@subsection Section input
-When a BFD is opened for reading, the section structures are
-created and attached to the BFD.
-
-Each section has a name which describes the section in the
-outside world---for example, @code{a.out} would contain at least
-three sections, called @code{.text}, @code{.data} and @code{.bss}.
-
-Names need not be unique; for example a COFF file may have several
-sections named @code{.data}.
-
-Sometimes a BFD will contain more than the ``natural'' number of
-sections. A back end may attach other sections containing
-constructor data, or an application may add a section (using
-@code{bfd_make_section}) to the sections attached to an already open
-BFD. For example, the linker creates an extra section
-@code{COMMON} for each input file's BFD to hold information about
-common storage.
-
-The raw data is not necessarily read in when
-the section descriptor is created. Some targets may leave the
-data in place until a @code{bfd_get_section_contents} call is
-made. Other back ends may read in all the data at once. For
-example, an S-record file has to be read once to determine the
-size of the data. An IEEE-695 file doesn't contain raw data in
-sections, but data and relocation expressions intermixed, so
-the data area has to be parsed to get out the data and
-relocations.
-
-@node Section Output, typedef asection, Section Input, Sections
-@subsection Section output
-To write a new object style BFD, the various sections to be
-written have to be created. They are attached to the BFD in
-the same way as input sections; data is written to the
-sections using @code{bfd_set_section_contents}.
-
-Any program that creates or combines sections (e.g., the assembler
-and linker) must use the @code{asection} fields @code{output_section} and
-@code{output_offset} to indicate the file sections to which each
-section must be written. (If the section is being created from
-scratch, @code{output_section} should probably point to the section
-itself and @code{output_offset} should probably be zero.)
-
-The data to be written comes from input sections attached
-(via @code{output_section} pointers) to
-the output sections. The output section structure can be
-considered a filter for the input section: the output section
-determines the vma of the output data and the name, but the
-input section determines the offset into the output section of
-the data to be written.
-
-E.g., to create a section "O", starting at 0x100, 0x123 long,
-containing two subsections, "A" at offset 0x0 (i.e., at vma
-0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection}
-structures would look like:
-
-@example
- section name "A"
- output_offset 0x00
- size 0x20
- output_section -----------> section name "O"
- | vma 0x100
- section name "B" | size 0x123
- output_offset 0x20 |
- size 0x103 |
- output_section --------|
-@end example
-
-@subsection Link orders
-The data within a section is stored in a @dfn{link_order}.
-These are much like the fixups in @code{gas}. The link_order
-abstraction allows a section to grow and shrink within itself.
-
-A link_order knows how big it is, and which is the next
-link_order and where the raw data for it is; it also points to
-a list of relocations which apply to it.
-
-The link_order is used by the linker to perform relaxing on
-final code. The compiler creates code which is as big as
-necessary to make it work without relaxing, and the user can
-select whether to relax. Sometimes relaxing takes a lot of
-time. The linker runs around the relocations to see if any
-are attached to data which can be shrunk, if so it does it on
-a link_order by link_order basis.
-
-
-@node typedef asection, section prototypes, Section Output, Sections
-@subsection typedef asection
-Here is the section structure:
-
-
-@example
-
-/* This structure is used for a comdat section, as in PE. A comdat
- section is associated with a particular symbol. When the linker
- sees a comdat section, it keeps only one of the sections with a
- given name and associated with a given symbol. */
-
-struct bfd_comdat_info
-@{
- /* The name of the symbol associated with a comdat section. */
- const char *name;
-
- /* The local symbol table index of the symbol associated with a
- comdat section. This is only meaningful to the object file format
- specific code; it is not an index into the list returned by
- bfd_canonicalize_symtab. */
- long symbol;
-@};
-
-typedef struct bfd_section
-@{
- /* The name of the section; the name isn't a copy, the pointer is
- the same as that passed to bfd_make_section. */
- const char *name;
-
- /* A unique sequence number. */
- int id;
-
- /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
- int index;
-
- /* The next section in the list belonging to the BFD, or NULL. */
- struct bfd_section *next;
-
- /* The field flags contains attributes of the section. Some
- flags are read in from the object file, and some are
- synthesized from other information. */
- flagword flags;
-
-#define SEC_NO_FLAGS 0x000
-
- /* Tells the OS to allocate space for this section when loading.
- This is clear for a section containing debug information only. */
-#define SEC_ALLOC 0x001
-
- /* Tells the OS to load the section from the file when loading.
- This is clear for a .bss section. */
-#define SEC_LOAD 0x002
-
- /* The section contains data still to be relocated, so there is
- some relocation information too. */
-#define SEC_RELOC 0x004
-
- /* ELF reserves 4 processor specific bits and 8 operating system
- specific bits in sh_flags; at present we can get away with just
- one in communicating between the assembler and BFD, but this
- isn't a good long-term solution. */
-#define SEC_ARCH_BIT_0 0x008
-
- /* A signal to the OS that the section contains read only data. */
-#define SEC_READONLY 0x010
-
- /* The section contains code only. */
-#define SEC_CODE 0x020
-
- /* The section contains data only. */
-#define SEC_DATA 0x040
-
- /* The section will reside in ROM. */
-#define SEC_ROM 0x080
-
- /* The section contains constructor information. This section
- type is used by the linker to create lists of constructors and
- destructors used by @code{g++}. When a back end sees a symbol
- which should be used in a constructor list, it creates a new
- section for the type of name (e.g., @code{__CTOR_LIST__}), attaches
- the symbol to it, and builds a relocation. To build the lists
- of constructors, all the linker has to do is catenate all the
- sections called @code{__CTOR_LIST__} and relocate the data
- contained within - exactly the operations it would peform on
- standard data. */
-#define SEC_CONSTRUCTOR 0x100
-
- /* The section has contents - a data section could be
- @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
- @code{SEC_HAS_CONTENTS} */
-#define SEC_HAS_CONTENTS 0x200
-
- /* An instruction to the linker to not output the section
- even if it has information which would normally be written. */
-#define SEC_NEVER_LOAD 0x400
-
- /* The section is a COFF shared library section. This flag is
- only for the linker. If this type of section appears in
- the input file, the linker must copy it to the output file
- without changing the vma or size. FIXME: Although this
- was originally intended to be general, it really is COFF
- specific (and the flag was renamed to indicate this). It
- might be cleaner to have some more general mechanism to
- allow the back end to control what the linker does with
- sections. */
-#define SEC_COFF_SHARED_LIBRARY 0x800
-
- /* The section contains thread local data. */
-#define SEC_THREAD_LOCAL 0x1000
-
- /* The section has GOT references. This flag is only for the
- linker, and is currently only used by the elf32-hppa back end.
- It will be set if global offset table references were detected
- in this section, which indicate to the linker that the section
- contains PIC code, and must be handled specially when doing a
- static link. */
-#define SEC_HAS_GOT_REF 0x4000
-
- /* The section contains common symbols (symbols may be defined
- multiple times, the value of a symbol is the amount of
- space it requires, and the largest symbol value is the one
- used). Most targets have exactly one of these (which we
- translate to bfd_com_section_ptr), but ECOFF has two. */
-#define SEC_IS_COMMON 0x8000
-
- /* The section contains only debugging information. For
- example, this is set for ELF .debug and .stab sections.
- strip tests this flag to see if a section can be
- discarded. */
-#define SEC_DEBUGGING 0x10000
-
- /* The contents of this section are held in memory pointed to
- by the contents field. This is checked by bfd_get_section_contents,
- and the data is retrieved from memory if appropriate. */
-#define SEC_IN_MEMORY 0x20000
-
- /* The contents of this section are to be excluded by the
- linker for executable and shared objects unless those
- objects are to be further relocated. */
-#define SEC_EXCLUDE 0x40000
-
- /* The contents of this section are to be sorted based on the sum of
- the symbol and addend values specified by the associated relocation
- entries. Entries without associated relocation entries will be
- appended to the end of the section in an unspecified order. */
-#define SEC_SORT_ENTRIES 0x80000
-
- /* When linking, duplicate sections of the same name should be
- discarded, rather than being combined into a single section as
- is usually done. This is similar to how common symbols are
- handled. See SEC_LINK_DUPLICATES below. */
-#define SEC_LINK_ONCE 0x100000
-
- /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
- should handle duplicate sections. */
-#define SEC_LINK_DUPLICATES 0x600000
-
- /* This value for SEC_LINK_DUPLICATES means that duplicate
- sections with the same name should simply be discarded. */
-#define SEC_LINK_DUPLICATES_DISCARD 0x0
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if there are any duplicate sections, although
- it should still only link one copy. */
-#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections are a different size. */
-#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections contain different
- contents. */
-#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
-
- /* This section was created by the linker as part of dynamic
- relocation or other arcane processing. It is skipped when
- going through the first-pass output, trusting that someone
- else up the line will take care of it later. */
-#define SEC_LINKER_CREATED 0x800000
-
- /* This section should not be subject to garbage collection. */
-#define SEC_KEEP 0x1000000
-
- /* This section contains "short" data, and should be placed
- "near" the GP. */
-#define SEC_SMALL_DATA 0x2000000
-
- /* This section contains data which may be shared with other
- executables or shared objects. */
-#define SEC_SHARED 0x4000000
-
- /* When a section with this flag is being linked, then if the size of
- the input section is less than a page, it should not cross a page
- boundary. If the size of the input section is one page or more, it
- should be aligned on a page boundary. */
-#define SEC_BLOCK 0x8000000
-
- /* Conditionally link this section; do not link if there are no
- references found to any symbol in the section. */
-#define SEC_CLINK 0x10000000
-
- /* Attempt to merge identical entities in the section.
- Entity size is given in the entsize field. */
-#define SEC_MERGE 0x20000000
-
- /* If given with SEC_MERGE, entities to merge are zero terminated
- strings where entsize specifies character size instead of fixed
- size entries. */
-#define SEC_STRINGS 0x40000000
-
- /* This section contains data about section groups. */
-#define SEC_GROUP 0x80000000
-
- /* End of section flags. */
-
- /* Some internal packed boolean fields. */
-
- /* See the vma field. */
- unsigned int user_set_vma : 1;
-
- /* Whether relocations have been processed. */
- unsigned int reloc_done : 1;
-
- /* A mark flag used by some of the linker backends. */
- unsigned int linker_mark : 1;
-
- /* Another mark flag used by some of the linker backends. Set for
- output sections that have an input section. */
- unsigned int linker_has_input : 1;
-
- /* A mark flag used by some linker backends for garbage collection. */
- unsigned int gc_mark : 1;
-
- /* The following flags are used by the ELF linker. */
-
- /* Mark sections which have been allocated to segments. */
- unsigned int segment_mark : 1;
-
- /* Type of sec_info information. */
- unsigned int sec_info_type:3;
-#define ELF_INFO_TYPE_NONE 0
-#define ELF_INFO_TYPE_STABS 1
-#define ELF_INFO_TYPE_MERGE 2
-#define ELF_INFO_TYPE_EH_FRAME 3
-#define ELF_INFO_TYPE_JUST_SYMS 4
-
- /* Nonzero if this section uses RELA relocations, rather than REL. */
- unsigned int use_rela_p:1;
-
- /* Bits used by various backends. */
- unsigned int has_tls_reloc:1;
-
- /* Nonzero if this section needs the relax finalize pass. */
- unsigned int need_finalize_relax:1;
-
- /* Nonzero if this section has a gp reloc. */
- unsigned int has_gp_reloc:1;
-
- /* Unused bits. */
- unsigned int flag13:1;
- unsigned int flag14:1;
- unsigned int flag15:1;
- unsigned int flag16:4;
- unsigned int flag20:4;
- unsigned int flag24:8;
-
- /* End of internal packed boolean fields. */
-
- /* The virtual memory address of the section - where it will be
- at run time. The symbols are relocated against this. The
- user_set_vma flag is maintained by bfd; if it's not set, the
- backend can assign addresses (for example, in @code{a.out}, where
- the default address for @code{.data} is dependent on the specific
- target and various flags). */
- bfd_vma vma;
-
- /* The load address of the section - where it would be in a
- rom image; really only used for writing section header
- information. */
- bfd_vma lma;
-
- /* The size of the section in octets, as it will be output.
- Contains a value even if the section has no contents (e.g., the
- size of @code{.bss}). This will be filled in after relocation. */
- bfd_size_type _cooked_size;
-
- /* The original size on disk of the section, in octets. Normally this
- value is the same as the size, but if some relaxing has
- been done, then this value will be bigger. */
- bfd_size_type _raw_size;
-
- /* If this section is going to be output, then this value is the
- offset in *bytes* into the output section of the first byte in the
- input section (byte ==> smallest addressable unit on the
- target). In most cases, if this was going to start at the
- 100th octet (8-bit quantity) in the output section, this value
- would be 100. However, if the target byte size is 16 bits
- (bfd_octets_per_byte is "2"), this value would be 50. */
- bfd_vma output_offset;
-
- /* The output section through which to map on output. */
- struct bfd_section *output_section;
-
- /* The alignment requirement of the section, as an exponent of 2 -
- e.g., 3 aligns to 2^3 (or 8). */
- unsigned int alignment_power;
-
- /* If an input section, a pointer to a vector of relocation
- records for the data in this section. */
- struct reloc_cache_entry *relocation;
-
- /* If an output section, a pointer to a vector of pointers to
- relocation records for the data in this section. */
- struct reloc_cache_entry **orelocation;
-
- /* The number of relocation records in one of the above. */
- unsigned reloc_count;
-
- /* Information below is back end specific - and not always used
- or updated. */
-
- /* File position of section data. */
- file_ptr filepos;
-
- /* File position of relocation info. */
- file_ptr rel_filepos;
-
- /* File position of line data. */
- file_ptr line_filepos;
-
- /* Pointer to data for applications. */
- void *userdata;
-
- /* If the SEC_IN_MEMORY flag is set, this points to the actual
- contents. */
- unsigned char *contents;
-
- /* Attached line number information. */
- alent *lineno;
-
- /* Number of line number records. */
- unsigned int lineno_count;
-
- /* Entity size for merging purposes. */
- unsigned int entsize;
-
- /* Optional information about a COMDAT entry; NULL if not COMDAT. */
- struct bfd_comdat_info *comdat;
-
- /* Points to the kept section if this section is a link-once section,
- and is discarded. */
- struct bfd_section *kept_section;
-
- /* When a section is being output, this value changes as more
- linenumbers are written out. */
- file_ptr moving_line_filepos;
-
- /* What the section number is in the target world. */
- int target_index;
-
- void *used_by_bfd;
-
- /* If this is a constructor section then here is a list of the
- relocations created to relocate items within it. */
- struct relent_chain *constructor_chain;
-
- /* The BFD which owns the section. */
- bfd *owner;
-
- /* A symbol which points at this section only. */
- struct bfd_symbol *symbol;
- struct bfd_symbol **symbol_ptr_ptr;
-
- struct bfd_link_order *link_order_head;
- struct bfd_link_order *link_order_tail;
-@} asection;
-
-/* These sections are global, and are managed by BFD. The application
- and target back end are not permitted to change the values in
- these sections. New code should use the section_ptr macros rather
- than referring directly to the const sections. The const sections
- may eventually vanish. */
-#define BFD_ABS_SECTION_NAME "*ABS*"
-#define BFD_UND_SECTION_NAME "*UND*"
-#define BFD_COM_SECTION_NAME "*COM*"
-#define BFD_IND_SECTION_NAME "*IND*"
-
-/* The absolute section. */
-extern asection bfd_abs_section;
-#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-/* Pointer to the undefined section. */
-extern asection bfd_und_section;
-#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-/* Pointer to the common section. */
-extern asection bfd_com_section;
-#define bfd_com_section_ptr ((asection *) &bfd_com_section)
-/* Pointer to the indirect section. */
-extern asection bfd_ind_section;
-#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
-#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
-#define bfd_is_const_section(SEC) \
- ( ((SEC) == bfd_abs_section_ptr) \
- || ((SEC) == bfd_und_section_ptr) \
- || ((SEC) == bfd_com_section_ptr) \
- || ((SEC) == bfd_ind_section_ptr))
-
-extern const struct bfd_symbol * const bfd_abs_symbol;
-extern const struct bfd_symbol * const bfd_com_symbol;
-extern const struct bfd_symbol * const bfd_und_symbol;
-extern const struct bfd_symbol * const bfd_ind_symbol;
-#define bfd_get_section_size_before_reloc(section) \
- ((section)->_raw_size)
-#define bfd_get_section_size_after_reloc(section) \
- ((section)->reloc_done ? (section)->_cooked_size \
- : (abort (), (bfd_size_type) 1))
-
-/* Macros to handle insertion and deletion of a bfd's sections. These
- only handle the list pointers, ie. do not adjust section_count,
- target_index etc. */
-#define bfd_section_list_remove(ABFD, PS) \
- do \
- @{ \
- asection **_ps = PS; \
- asection *_s = *_ps; \
- *_ps = _s->next; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = _ps; \
- @} \
- while (0)
-#define bfd_section_list_insert(ABFD, PS, S) \
- do \
- @{ \
- asection **_ps = PS; \
- asection *_s = S; \
- _s->next = *_ps; \
- *_ps = _s; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = &_s->next; \
- @} \
- while (0)
-
-@end example
-
-@node section prototypes, , typedef asection, Sections
-@subsection Section prototypes
-These are the functions exported by the section handling part of BFD.
-
-@findex bfd_section_list_clear
-@subsubsection @code{bfd_section_list_clear}
-@strong{Synopsis}
-@example
-void bfd_section_list_clear (bfd *);
-@end example
-@strong{Description}@*
-Clears the section list, and also resets the section count and
-hash table entries.
-
-@findex bfd_get_section_by_name
-@subsubsection @code{bfd_get_section_by_name}
-@strong{Synopsis}
-@example
-asection *bfd_get_section_by_name (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Run through @var{abfd} and return the one of the
-@code{asection}s whose name matches @var{name}, otherwise @code{NULL}.
-@xref{Sections}, for more information.
-
-This should only be used in special cases; the normal way to process
-all sections of a given name is to use @code{bfd_map_over_sections} and
-@code{strcmp} on the name (or better yet, base it on the section flags
-or something else) for each section.
-
-@findex bfd_get_unique_section_name
-@subsubsection @code{bfd_get_unique_section_name}
-@strong{Synopsis}
-@example
-char *bfd_get_unique_section_name
- (bfd *abfd, const char *templat, int *count);
-@end example
-@strong{Description}@*
-Invent a section name that is unique in @var{abfd} by tacking
-a dot and a digit suffix onto the original @var{templat}. If
-@var{count} is non-NULL, then it specifies the first number
-tried as a suffix to generate a unique name. The value
-pointed to by @var{count} will be incremented in this case.
-
-@findex bfd_make_section_old_way
-@subsubsection @code{bfd_make_section_old_way}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_old_way (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name}
-and attach it to the end of the chain of sections for the
-BFD @var{abfd}. An attempt to create a section with a name which
-is already in use returns its pointer without changing the
-section chain.
-
-It has the funny name since this is the way it used to be
-before it was rewritten....
-
-Possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-If output has already started for this BFD.
-@item
-@code{bfd_error_no_memory} -
-If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section_anyway
-@subsubsection @code{bfd_make_section_anyway}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_anyway (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name} and attach it to the end of
-the chain of sections for @var{abfd}. Create a new section even if there
-is already a section with that name.
-
-Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
-@item
-@code{bfd_error_no_memory} - If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section
-@subsubsection @code{bfd_make_section}
-@strong{Synopsis}
-@example
-asection *bfd_make_section (bfd *, const char *name);
-@end example
-@strong{Description}@*
-Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
-bfd_set_error ()) without changing the section chain if there is already a
-section named @var{name}. If there is an error, return @code{NULL} and set
-@code{bfd_error}.
-
-@findex bfd_set_section_flags
-@subsubsection @code{bfd_set_section_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_flags
- (bfd *abfd, asection *sec, flagword flags);
-@end example
-@strong{Description}@*
-Set the attributes of the section @var{sec} in the BFD
-@var{abfd} to the value @var{flags}. Return @code{TRUE} on success,
-@code{FALSE} on error. Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-The section cannot have one or more of the attributes
-requested. For example, a .bss section in @code{a.out} may not
-have the @code{SEC_HAS_CONTENTS} field set.
-@end itemize
-
-@findex bfd_map_over_sections
-@subsubsection @code{bfd_map_over_sections}
-@strong{Synopsis}
-@example
-void bfd_map_over_sections
- (bfd *abfd,
- void (*func) (bfd *abfd, asection *sect, void *obj),
- void *obj);
-@end example
-@strong{Description}@*
-Call the provided function @var{func} for each section
-attached to the BFD @var{abfd}, passing @var{obj} as an
-argument. The function will be called as if by
-
-@example
- func (abfd, the_section, obj);
-@end example
-
-This is the preferred method for iterating over sections; an
-alternative would be to use a loop:
-
-@example
- section *p;
- for (p = abfd->sections; p != NULL; p = p->next)
- func (abfd, p, ...)
-@end example
-
-@findex bfd_set_section_size
-@subsubsection @code{bfd_set_section_size}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_size
- (bfd *abfd, asection *sec, bfd_size_type val);
-@end example
-@strong{Description}@*
-Set @var{sec} to the size @var{val}. If the operation is
-ok, then @code{TRUE} is returned, else @code{FALSE}.
-
-Possible error returns:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-Writing has started to the BFD, so setting the size is invalid.
-@end itemize
-
-@findex bfd_set_section_contents
-@subsubsection @code{bfd_set_section_contents}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_contents
- (bfd *abfd, asection *section, const void *data,
- file_ptr offset, bfd_size_type count);
-@end example
-@strong{Description}@*
-Sets the contents of the section @var{section} in BFD
-@var{abfd} to the data starting in memory at @var{data}. The
-data is written to the output section starting at offset
-@var{offset} for @var{count} octets.
-
-Normally @code{TRUE} is returned, else @code{FALSE}. Possible error
-returns are:
-@itemize @bullet
-
-@item
-@code{bfd_error_no_contents} -
-The output section does not have the @code{SEC_HAS_CONTENTS}
-attribute, so nothing can be written to it.
-@item
-and some more too
-@end itemize
-This routine is front end to the back end function
-@code{_bfd_set_section_contents}.
-
-@findex bfd_get_section_contents
-@subsubsection @code{bfd_get_section_contents}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_get_section_contents
- (bfd *abfd, asection *section, void *location, file_ptr offset,
- bfd_size_type count);
-@end example
-@strong{Description}@*
-Read data from @var{section} in BFD @var{abfd}
-into memory starting at @var{location}. The data is read at an
-offset of @var{offset} from the start of the input section,
-and is read for @var{count} bytes.
-
-If the contents of a constructor with the @code{SEC_CONSTRUCTOR}
-flag set are requested or if the section does not have the
-@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled
-with zeroes. If no errors occur, @code{TRUE} is returned, else
-@code{FALSE}.
-
-@findex bfd_copy_private_section_data
-@subsubsection @code{bfd_copy_private_section_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_section_data
- (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
-@end example
-@strong{Description}@*
-Copy private section information from @var{isec} in the BFD
-@var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
-Return @code{TRUE} on success, @code{FALSE} on error. Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{osec}.
-@end itemize
-@example
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
- BFD_SEND (obfd, _bfd_copy_private_section_data, \
- (ibfd, isection, obfd, osection))
-@end example
-
-@findex _bfd_strip_section_from_output
-@subsubsection @code{_bfd_strip_section_from_output}
-@strong{Synopsis}
-@example
-void _bfd_strip_section_from_output
- (struct bfd_link_info *info, asection *section);
-@end example
-@strong{Description}@*
-Remove @var{section} from the output. If the output section
-becomes empty, remove it from the output bfd.
-
-This function won't actually do anything except twiddle flags
-if called too late in the linking process, when it's not safe
-to remove sections.
-
-@findex bfd_generic_discard_group
-@subsubsection @code{bfd_generic_discard_group}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
-@end example
-@strong{Description}@*
-Remove all members of @var{group} from the output.
-
diff --git a/contrib/binutils/bfd/doc/syms.texi b/contrib/binutils/bfd/doc/syms.texi
deleted file mode 100644
index 415d156..0000000
--- a/contrib/binutils/bfd/doc/syms.texi
+++ /dev/null
@@ -1,445 +0,0 @@
-@section Symbols
-BFD tries to maintain as much symbol information as it can when
-it moves information from file to file. BFD passes information
-to applications though the @code{asymbol} structure. When the
-application requests the symbol table, BFD reads the table in
-the native form and translates parts of it into the internal
-format. To maintain more than the information passed to
-applications, some targets keep some information ``behind the
-scenes'' in a structure only the particular back end knows
-about. For example, the coff back end keeps the original
-symbol table structure as well as the canonical structure when
-a BFD is read in. On output, the coff back end can reconstruct
-the output symbol table so that no information is lost, even
-information unique to coff which BFD doesn't know or
-understand. If a coff symbol table were read, but were written
-through an a.out back end, all the coff specific information
-would be lost. The symbol table of a BFD
-is not necessarily read in until a canonicalize request is
-made. Then the BFD back end fills in a table provided by the
-application with pointers to the canonical information. To
-output symbols, the application provides BFD with a table of
-pointers to pointers to @code{asymbol}s. This allows applications
-like the linker to output a symbol as it was read, since the ``behind
-the scenes'' information will be still available.
-@menu
-* Reading Symbols::
-* Writing Symbols::
-* Mini Symbols::
-* typedef asymbol::
-* symbol handling functions::
-@end menu
-
-@node Reading Symbols, Writing Symbols, Symbols, Symbols
-@subsection Reading symbols
-There are two stages to reading a symbol table from a BFD:
-allocating storage, and the actual reading process. This is an
-excerpt from an application which reads the symbol table:
-
-@example
- long storage_needed;
- asymbol **symbol_table;
- long number_of_symbols;
- long i;
-
- storage_needed = bfd_get_symtab_upper_bound (abfd);
-
- if (storage_needed < 0)
- FAIL
-
- if (storage_needed == 0)
- return;
-
- symbol_table = xmalloc (storage_needed);
- ...
- number_of_symbols =
- bfd_canonicalize_symtab (abfd, symbol_table);
-
- if (number_of_symbols < 0)
- FAIL
-
- for (i = 0; i < number_of_symbols; i++)
- process_symbol (symbol_table[i]);
-@end example
-
-All storage for the symbols themselves is in an objalloc
-connected to the BFD; it is freed when the BFD is closed.
-
-@node Writing Symbols, Mini Symbols, Reading Symbols, Symbols
-@subsection Writing symbols
-Writing of a symbol table is automatic when a BFD open for
-writing is closed. The application attaches a vector of
-pointers to pointers to symbols to the BFD being written, and
-fills in the symbol count. The close and cleanup code reads
-through the table provided and performs all the necessary
-operations. The BFD output code must always be provided with an
-``owned'' symbol: one which has come from another BFD, or one
-which has been created using @code{bfd_make_empty_symbol}. Here is an
-example showing the creation of a symbol table with only one element:
-
-@example
- #include "bfd.h"
- int main (void)
- @{
- bfd *abfd;
- asymbol *ptrs[2];
- asymbol *new;
-
- abfd = bfd_openw ("foo","a.out-sunos-big");
- bfd_set_format (abfd, bfd_object);
- new = bfd_make_empty_symbol (abfd);
- new->name = "dummy_symbol";
- new->section = bfd_make_section_old_way (abfd, ".text");
- new->flags = BSF_GLOBAL;
- new->value = 0x12345;
-
- ptrs[0] = new;
- ptrs[1] = 0;
-
- bfd_set_symtab (abfd, ptrs, 1);
- bfd_close (abfd);
- return 0;
- @}
-
- ./makesym
- nm foo
- 00012345 A dummy_symbol
-@end example
-
-Many formats cannot represent arbitrary symbol information; for
-instance, the @code{a.out} object format does not allow an
-arbitrary number of sections. A symbol pointing to a section
-which is not one of @code{.text}, @code{.data} or @code{.bss} cannot
-be described.
-
-@node Mini Symbols, typedef asymbol, Writing Symbols, Symbols
-@subsection Mini Symbols
-Mini symbols provide read-only access to the symbol table.
-They use less memory space, but require more time to access.
-They can be useful for tools like nm or objdump, which may
-have to handle symbol tables of extremely large executables.
-
-The @code{bfd_read_minisymbols} function will read the symbols
-into memory in an internal form. It will return a @code{void *}
-pointer to a block of memory, a symbol count, and the size of
-each symbol. The pointer is allocated using @code{malloc}, and
-should be freed by the caller when it is no longer needed.
-
-The function @code{bfd_minisymbol_to_symbol} will take a pointer
-to a minisymbol, and a pointer to a structure returned by
-@code{bfd_make_empty_symbol}, and return a @code{asymbol} structure.
-The return value may or may not be the same as the value from
-@code{bfd_make_empty_symbol} which was passed in.
-
-
-@node typedef asymbol, symbol handling functions, Mini Symbols, Symbols
-@subsection typedef asymbol
-An @code{asymbol} has the form:
-
-
-@example
-
-typedef struct bfd_symbol
-@{
- /* A pointer to the BFD which owns the symbol. This information
- is necessary so that a back end can work out what additional
- information (invisible to the application writer) is carried
- with the symbol.
-
- This field is *almost* redundant, since you can use section->owner
- instead, except that some symbols point to the global sections
- bfd_@{abs,com,und@}_section. This could be fixed by making
- these globals be per-bfd (or per-target-flavor). FIXME. */
- struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
-
- /* The text of the symbol. The name is left alone, and not copied; the
- application may not alter it. */
- 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
- a pointer to another symbol is stored here. */
- symvalue value;
-
- /* Attributes of a symbol. */
-#define BSF_NO_FLAGS 0x00
-
- /* The symbol has local scope; @code{static} in @code{C}. The value
- is the offset into the section of the data. */
-#define BSF_LOCAL 0x01
-
- /* The symbol has global scope; initialized data in @code{C}. The
- value is the offset into the section of the data. */
-#define BSF_GLOBAL 0x02
-
- /* The symbol has global scope and is exported. The value is
- the offset into the section of the data. */
-#define BSF_EXPORT BSF_GLOBAL /* No real difference. */
-
- /* A normal C symbol would be one of:
- @code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or
- @code{BSF_GLOBAL}. */
-
- /* The symbol is a debugging record. The value has an arbitrary
- meaning, unless BSF_DEBUGGING_RELOC is also set. */
-#define BSF_DEBUGGING 0x08
-
- /* The symbol denotes a function entry point. Used in ELF,
- perhaps others someday. */
-#define BSF_FUNCTION 0x10
-
- /* Used by the linker. */
-#define BSF_KEEP 0x20
-#define BSF_KEEP_G 0x40
-
- /* A weak global symbol, overridable without warnings by
- a regular global symbol of the same name. */
-#define BSF_WEAK 0x80
-
- /* This symbol was created to point to a section, e.g. ELF's
- STT_SECTION symbols. */
-#define BSF_SECTION_SYM 0x100
-
- /* The symbol used to be a common symbol, but now it is
- allocated. */
-#define BSF_OLD_COMMON 0x200
-
- /* The default value for common data. */
-#define BFD_FORT_COMM_DEFAULT_VALUE 0
-
- /* In some files the type of a symbol sometimes alters its
- location in an output file - ie in coff a @code{ISFCN} symbol
- which is also @code{C_EXT} symbol appears where it was
- declared and not at the end of a section. This bit is set
- by the target BFD part to convey this information. */
-#define BSF_NOT_AT_END 0x400
-
- /* Signal that the symbol is the label of constructor section. */
-#define BSF_CONSTRUCTOR 0x800
-
- /* Signal that the symbol is a warning symbol. The name is a
- warning. The name of the next symbol is the one to warn about;
- if a reference is made to a symbol with the same name as the next
- symbol, a warning is issued by the linker. */
-#define BSF_WARNING 0x1000
-
- /* Signal that the symbol is indirect. This symbol is an indirect
- pointer to the symbol with the same name as the next symbol. */
-#define BSF_INDIRECT 0x2000
-
- /* BSF_FILE marks symbols that contain a file name. This is used
- for ELF STT_FILE symbols. */
-#define BSF_FILE 0x4000
-
- /* Symbol is from dynamic linking information. */
-#define BSF_DYNAMIC 0x8000
-
- /* The symbol denotes a data object. Used in ELF, and perhaps
- others someday. */
-#define BSF_OBJECT 0x10000
-
- /* This symbol is a debugging symbol. The value is the offset
- into the section of the data. BSF_DEBUGGING should be set
- as well. */
-#define BSF_DEBUGGING_RELOC 0x20000
-
- /* This symbol is thread local. Used in ELF. */
-#define BSF_THREAD_LOCAL 0x40000
-
- flagword flags;
-
- /* A pointer to the section to which this symbol is
- relative. This will always be non NULL, there are special
- sections for undefined and absolute symbols. */
- struct bfd_section *section;
-
- /* Back end special data. */
- union
- @{
- void *p;
- bfd_vma i;
- @}
- udata;
-@}
-asymbol;
-
-@end example
-
-@node symbol handling functions, , typedef asymbol, Symbols
-@subsection Symbol handling functions
-
-
-@findex bfd_get_symtab_upper_bound
-@subsubsection @code{bfd_get_symtab_upper_bound}
-@strong{Description}@*
-Return the number of bytes required to store a vector of pointers
-to @code{asymbols} for all the symbols in the BFD @var{abfd},
-including a terminal NULL pointer. If there are no symbols in
-the BFD, then return 0. If an error occurs, return -1.
-@example
-#define bfd_get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-@end example
-
-@findex bfd_is_local_label
-@subsubsection @code{bfd_is_local_label}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
-@end example
-@strong{Description}@*
-Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is
-a compiler generated local label, else return FALSE.
-
-@findex bfd_is_local_label_name
-@subsubsection @code{bfd_is_local_label_name}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Return TRUE if a symbol with the name @var{name} in the BFD
-@var{abfd} is a compiler generated local label, else return
-FALSE. This just checks whether the name has the form of a
-local label.
-@example
-#define bfd_is_local_label_name(abfd, name) \
- BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-@end example
-
-@findex bfd_canonicalize_symtab
-@subsubsection @code{bfd_canonicalize_symtab}
-@strong{Description}@*
-Read the symbols from the BFD @var{abfd}, and fills in
-the vector @var{location} with pointers to the symbols and
-a trailing NULL.
-Return the actual number of symbol pointers, not
-including the NULL.
-@example
-#define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-
-@end example
-
-@findex bfd_set_symtab
-@subsubsection @code{bfd_set_symtab}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_symtab
- (bfd *abfd, asymbol **location, unsigned int count);
-@end example
-@strong{Description}@*
-Arrange that when the output BFD @var{abfd} is closed,
-the table @var{location} of @var{count} pointers to symbols
-will be written.
-
-@findex bfd_print_symbol_vandf
-@subsubsection @code{bfd_print_symbol_vandf}
-@strong{Synopsis}
-@example
-void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
-@end example
-@strong{Description}@*
-Print the value and flags of the @var{symbol} supplied to the
-stream @var{file}.
-
-@findex bfd_make_empty_symbol
-@subsubsection @code{bfd_make_empty_symbol}
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd}
-and return a pointer to it.
-
-This routine is necessary because each back end has private
-information surrounding the @code{asymbol}. Building your own
-@code{asymbol} and pointing to it will not create the private
-information, and will cause problems later on.
-@example
-#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-@end example
-
-@findex _bfd_generic_make_empty_symbol
-@subsubsection @code{_bfd_generic_make_empty_symbol}
-@strong{Synopsis}
-@example
-asymbol *_bfd_generic_make_empty_symbol (bfd *);
-@end example
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd}
-and return a pointer to it. Used by core file routines,
-binary back-end and anywhere else where no private info
-is needed.
-
-@findex bfd_make_debug_symbol
-@subsubsection @code{bfd_make_debug_symbol}
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd},
-to be used as a debugging symbol. Further details of its use have
-yet to be worked out.
-@example
-#define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-@end example
-
-@findex bfd_decode_symclass
-@subsubsection @code{bfd_decode_symclass}
-@strong{Description}@*
-Return a character corresponding to the symbol
-class of @var{symbol}, or '?' for an unknown class.
-
-@strong{Synopsis}
-@example
-int bfd_decode_symclass (asymbol *symbol);
-@end example
-@findex bfd_is_undefined_symclass
-@subsubsection @code{bfd_is_undefined_symclass}
-@strong{Description}@*
-Returns non-zero if the class symbol returned by
-bfd_decode_symclass represents an undefined symbol.
-Returns zero otherwise.
-
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_undefined_symclass (int symclass);
-@end example
-@findex bfd_symbol_info
-@subsubsection @code{bfd_symbol_info}
-@strong{Description}@*
-Fill in the basic info about symbol that nm needs.
-Additional info may be added by the back-ends after
-calling this function.
-
-@strong{Synopsis}
-@example
-void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-@end example
-@findex bfd_copy_private_symbol_data
-@subsubsection @code{bfd_copy_private_symbol_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_symbol_data
- (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
-@end example
-@strong{Description}@*
-Copy private symbol information from @var{isym} in the BFD
-@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
-Return @code{TRUE} on success, @code{FALSE} on error. Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{osec}.
-@end itemize
-@example
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
- (ibfd, isymbol, obfd, osymbol))
-
-@end example
-
diff --git a/contrib/binutils/bfd/doc/targets.texi b/contrib/binutils/bfd/doc/targets.texi
deleted file mode 100644
index 9b499cf..0000000
--- a/contrib/binutils/bfd/doc/targets.texi
+++ /dev/null
@@ -1,517 +0,0 @@
-@section Targets
-
-
-@strong{Description}@*
-Each port of BFD to a different machine requires the creation
-of a target back end. All the back end provides to the root
-part of BFD is a structure containing pointers to functions
-which perform certain low level operations on files. BFD
-translates the applications's requests through a pointer into
-calls to the back end routines.
-
-When a file is opened with @code{bfd_openr}, its format and
-target are unknown. BFD uses various mechanisms to determine
-how to interpret the file. The operations performed are:
-
-@itemize @bullet
-
-@item
-Create a BFD by calling the internal routine
-@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the
-target string supplied to @code{bfd_openr} and the new BFD pointer.
-
-@item
-If a null target string was provided to @code{bfd_find_target},
-look up the environment variable @code{GNUTARGET} and use
-that as the target string.
-
-@item
-If the target string is still @code{NULL}, or the target string is
-@code{default}, then use the first item in the target vector
-as the target type, and set @code{target_defaulted} in the BFD to
-cause @code{bfd_check_format} to loop through all the targets.
-@xref{bfd_target}. @xref{Formats}.
-
-@item
-Otherwise, inspect the elements in the target vector
-one by one, until a match on target name is found. When found,
-use it.
-
-@item
-Otherwise return the error @code{bfd_error_invalid_target} to
-@code{bfd_openr}.
-
-@item
-@code{bfd_openr} attempts to open the file using
-@code{bfd_open_file}, and returns the BFD.
-@end itemize
-Once the BFD has been opened and the target selected, the file
-format may be determined. This is done by calling
-@code{bfd_check_format} on the BFD with a suggested format.
-If @code{target_defaulted} has been set, each possible target
-type is tried to see if it recognizes the specified format.
-@code{bfd_check_format} returns @code{TRUE} when the caller guesses right.
-@menu
-* bfd_target::
-@end menu
-
-@node bfd_target, , Targets, Targets
-
-@subsection bfd_target
-
-
-@strong{Description}@*
-This structure contains everything that BFD knows about a
-target. It includes things like its byte order, name, and which
-routines to call to do various operations.
-
-Every BFD points to a target structure with its @code{xvec}
-member.
-
-The macros below are used to dispatch to functions through the
-@code{bfd_target} vector. They are used in a number of macros further
-down in @file{bfd.h}, and are also used when calling various
-routines by hand inside the BFD implementation. The @var{arglist}
-argument must be parenthesized; it contains all the arguments
-to the called function.
-
-They make the documentation (more) unpleasant to read, so if
-someone wants to fix this and not break the above, please do.
-@example
-#define BFD_SEND(bfd, message, arglist) \
- ((*((bfd)->xvec->message)) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND
-#define BFD_SEND(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- ((*((bfd)->xvec->message)) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-@end example
-For operations which index on the BFD format:
-@example
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND_FMT
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-
-@end example
-This is the structure which defines the type of BFD this is. The
-@code{xvec} member of the struct @code{bfd} itself points here. Each
-module that implements access to a different target under BFD,
-defines one of these.
-
-FIXME, these names should be rationalised with the names of
-the entry points which call them. Too bad we can't have one
-macro to define them both!
-@example
-enum bfd_flavour
-@{
- bfd_target_unknown_flavour,
- bfd_target_aout_flavour,
- bfd_target_coff_flavour,
- bfd_target_ecoff_flavour,
- bfd_target_xcoff_flavour,
- bfd_target_elf_flavour,
- bfd_target_ieee_flavour,
- bfd_target_nlm_flavour,
- bfd_target_oasys_flavour,
- bfd_target_tekhex_flavour,
- bfd_target_srec_flavour,
- bfd_target_ihex_flavour,
- bfd_target_som_flavour,
- bfd_target_os9k_flavour,
- bfd_target_versados_flavour,
- bfd_target_msdos_flavour,
- bfd_target_ovax_flavour,
- bfd_target_evax_flavour,
- bfd_target_mmo_flavour,
- bfd_target_mach_o_flavour,
- bfd_target_pef_flavour,
- bfd_target_pef_xlib_flavour,
- bfd_target_sym_flavour
-@};
-
-enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @};
-
-/* Forward declaration. */
-typedef struct bfd_link_info _bfd_link_info;
-
-typedef struct bfd_target
-@{
- /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
- char *name;
-
- /* The "flavour" of a back end is a general indication about
- the contents of a file. */
- enum bfd_flavour flavour;
-
- /* The order of bytes within the data area of a file. */
- enum bfd_endian byteorder;
-
- /* The order of bytes within the header parts of a file. */
- enum bfd_endian header_byteorder;
-
- /* A mask of all the flags which an executable may have set -
- from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}. */
- flagword object_flags;
-
- /* A mask of all the flags which a section may have set - from
- the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}. */
- flagword section_flags;
-
- /* The character normally found at the front of a symbol.
- (if any), perhaps `_'. */
- char symbol_leading_char;
-
- /* The pad character for file names within an archive header. */
- char ar_pad_char;
-
- /* The maximum number of characters in an archive header. */
- unsigned short ar_max_namelen;
-
- /* Entries for byte swapping for data. These are different from the
- other entry points, since they don't take a BFD asthe first argument.
- Certain other handlers could do the same. */
- bfd_uint64_t (*bfd_getx64) (const void *);
- bfd_int64_t (*bfd_getx_signed_64) (const void *);
- void (*bfd_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_getx32) (const void *);
- bfd_signed_vma (*bfd_getx_signed_32) (const void *);
- void (*bfd_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_getx16) (const void *);
- bfd_signed_vma (*bfd_getx_signed_16) (const void *);
- void (*bfd_putx16) (bfd_vma, void *);
-
- /* Byte swapping for the headers. */
- bfd_uint64_t (*bfd_h_getx64) (const void *);
- bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
- void (*bfd_h_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_h_getx32) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
- void (*bfd_h_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_h_getx16) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
- void (*bfd_h_putx16) (bfd_vma, void *);
-
- /* Format dependent routines: these are vectors of entry points
- within the target vector structure, one for each format to check. */
-
- /* Check the format of a file being read. Return a @code{bfd_target *} or zero. */
- const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
-
- /* Set the format of a file being written. */
- bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
-
- /* Write cached information into a file being written, at @code{bfd_close}. */
- bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
-
-@end example
-The general target vector. These vectors are initialized using the
-BFD_JUMP_TABLE macros.
-@example
-
- /* Generic entry points. */
-#define BFD_JUMP_TABLE_GENERIC(NAME) \
- NAME##_close_and_cleanup, \
- NAME##_bfd_free_cached_info, \
- NAME##_new_section_hook, \
- NAME##_get_section_contents, \
- NAME##_get_section_contents_in_window
-
- /* Called when the BFD is being closed to do any necessary cleanup. */
- bfd_boolean (*_close_and_cleanup) (bfd *);
- /* Ask the BFD to free all cached information. */
- bfd_boolean (*_bfd_free_cached_info) (bfd *);
- /* Called when a new section is created. */
- bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
- /* Read the contents of a section. */
- bfd_boolean (*_bfd_get_section_contents)
- (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
- bfd_boolean (*_bfd_get_section_contents_in_window)
- (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
-
- /* Entry points to copy private data. */
-#define BFD_JUMP_TABLE_COPY(NAME) \
- NAME##_bfd_copy_private_bfd_data, \
- NAME##_bfd_merge_private_bfd_data, \
- NAME##_bfd_copy_private_section_data, \
- NAME##_bfd_copy_private_symbol_data, \
- NAME##_bfd_set_private_flags, \
- NAME##_bfd_print_private_bfd_data
-
- /* Called to copy BFD general private data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
- /* Called to merge BFD general private data from one object file
- to a common output file when linking. */
- bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
- /* Called to copy BFD private section data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_section_data)
- (bfd *, sec_ptr, bfd *, sec_ptr);
- /* Called to copy BFD private symbol data from one symbol
- to another. */
- bfd_boolean (*_bfd_copy_private_symbol_data)
- (bfd *, asymbol *, bfd *, asymbol *);
- /* Called to set private backend flags. */
- bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
-
- /* Called to print private BFD data. */
- bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
-
- /* Core file entry points. */
-#define BFD_JUMP_TABLE_CORE(NAME) \
- NAME##_core_file_failing_command, \
- NAME##_core_file_failing_signal, \
- NAME##_core_file_matches_executable_p
-
- char * (*_core_file_failing_command) (bfd *);
- int (*_core_file_failing_signal) (bfd *);
- bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
-
- /* Archive entry points. */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
- NAME##_slurp_armap, \
- NAME##_slurp_extended_name_table, \
- NAME##_construct_extended_name_table, \
- NAME##_truncate_arname, \
- NAME##_write_armap, \
- NAME##_read_ar_hdr, \
- NAME##_openr_next_archived_file, \
- NAME##_get_elt_at_index, \
- NAME##_generic_stat_arch_elt, \
- NAME##_update_armap_timestamp
-
- bfd_boolean (*_bfd_slurp_armap) (bfd *);
- bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
- bfd_boolean (*_bfd_construct_extended_name_table)
- (bfd *, char **, bfd_size_type *, const char **);
- void (*_bfd_truncate_arname) (bfd *, const char *, char *);
- bfd_boolean (*write_armap)
- (bfd *, unsigned int, struct orl *, unsigned int, int);
- void * (*_bfd_read_ar_hdr_fn) (bfd *);
- bfd * (*openr_next_archived_file) (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) (bfd *, symindex);
- int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
- bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
-
- /* Entry points used for symbols. */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
- NAME##_get_symtab_upper_bound, \
- NAME##_canonicalize_symtab, \
- NAME##_make_empty_symbol, \
- NAME##_print_symbol, \
- NAME##_get_symbol_info, \
- NAME##_bfd_is_local_label_name, \
- NAME##_get_lineno, \
- NAME##_find_nearest_line, \
- NAME##_bfd_make_debug_symbol, \
- NAME##_read_minisymbols, \
- NAME##_minisymbol_to_symbol
-
- long (*_bfd_get_symtab_upper_bound) (bfd *);
- long (*_bfd_canonicalize_symtab)
- (bfd *, struct bfd_symbol **);
- struct bfd_symbol *
- (*_bfd_make_empty_symbol) (bfd *);
- void (*_bfd_print_symbol)
- (bfd *, void *, struct bfd_symbol *, 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)
- (bfd *, struct bfd_symbol *, symbol_info *);
-#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
- bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
-
- alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
- bfd_boolean (*_bfd_find_nearest_line)
- (bfd *, struct bfd_section *, struct bfd_symbol **, 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)
- (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)
- (bfd *, bfd_boolean, void **, 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)
- (bfd *, bfd_boolean, const void *, asymbol *);
-
- /* Routines for relocs. */
-#define BFD_JUMP_TABLE_RELOCS(NAME) \
- NAME##_get_reloc_upper_bound, \
- NAME##_canonicalize_reloc, \
- NAME##_bfd_reloc_type_lookup
-
- long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
- long (*_bfd_canonicalize_reloc)
- (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
- /* See documentation on reloc types. */
- reloc_howto_type *
- (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
-
- /* Routines used when writing an object file. */
-#define BFD_JUMP_TABLE_WRITE(NAME) \
- NAME##_set_arch_mach, \
- NAME##_set_section_contents
-
- bfd_boolean (*_bfd_set_arch_mach)
- (bfd *, enum bfd_architecture, unsigned long);
- bfd_boolean (*_bfd_set_section_contents)
- (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-
- /* Routines used by the linker. */
-#define BFD_JUMP_TABLE_LINK(NAME) \
- NAME##_sizeof_headers, \
- NAME##_bfd_get_relocated_section_contents, \
- NAME##_bfd_relax_section, \
- NAME##_bfd_link_hash_table_create, \
- NAME##_bfd_link_hash_table_free, \
- NAME##_bfd_link_add_symbols, \
- NAME##_bfd_link_just_syms, \
- NAME##_bfd_final_link, \
- NAME##_bfd_link_split_section, \
- NAME##_bfd_gc_sections, \
- NAME##_bfd_merge_sections, \
- NAME##_bfd_discard_group
-
- int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
- bfd_byte * (*_bfd_get_relocated_section_contents)
- (bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, struct bfd_symbol **);
-
- bfd_boolean (*_bfd_relax_section)
- (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_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) (bfd *);
-
- /* Release the memory associated with the linker hash table. */
- void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
-
- /* Add symbols from this object file into the hash table. */
- bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
-
- /* Indicate that we are only retrieving symbol values from this section. */
- void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
-
- /* Do a link based on the link_order structures attached to each
- section of the BFD. */
- bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
-
- /* Should this section be split up into smaller pieces during linking. */
- bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
-
- /* Remove sections that are not referenced from the output. */
- bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
-
- /* Attempt to merge SEC_MERGE sections. */
- bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
-
- /* Discard members of a group. */
- bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
-
- /* Routines to handle dynamic symbols and relocs. */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
- NAME##_get_dynamic_symtab_upper_bound, \
- NAME##_canonicalize_dynamic_symtab, \
- NAME##_get_dynamic_reloc_upper_bound, \
- NAME##_canonicalize_dynamic_reloc
-
- /* Get the amount of memory required to hold the dynamic symbols. */
- long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
- /* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
- (bfd *, struct bfd_symbol **);
- /* Get the amount of memory required to hold the dynamic relocs. */
- long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
- /* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
- (bfd *, arelent **, struct bfd_symbol **);
-
-@end example
-A pointer to an alternative bfd_target in case the current one is not
-satisfactory. This can happen when the target cpu supports both big
-and little endian code, and target chosen by the linker has the wrong
-endianness. The function open_output() in ld/ldlang.c uses this field
-to find an alternative output format that is suitable.
-@example
- /* Opposite endian version of this target. */
- const struct bfd_target * alternative_target;
-
- /* Data for use by back-end routines, which isn't
- generic enough to belong in this structure. */
- const void *backend_data;
-
-@} bfd_target;
-
-@end example
-
-@findex bfd_set_default_target
-@subsubsection @code{bfd_set_default_target}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_default_target (const char *name);
-@end example
-@strong{Description}@*
-Set the default target vector to use when recognizing a BFD.
-This takes the name of the target, which may be a BFD target
-name or a configuration triplet.
-
-@findex bfd_find_target
-@subsubsection @code{bfd_find_target}
-@strong{Synopsis}
-@example
-const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
-@end example
-@strong{Description}@*
-Return a pointer to the transfer vector for the object target
-named @var{target_name}. If @var{target_name} is @code{NULL}, choose the
-one in the environment variable @code{GNUTARGET}; if that is null or not
-defined, then choose the first entry in the target list.
-Passing in the string "default" or setting the environment
-variable to "default" will cause the first entry in the target
-list to be returned, and "target_defaulted" will be set in the
-BFD. This causes @code{bfd_check_format} to loop over all the
-targets to find the one that matches the file being read.
-
-@findex bfd_target_list
-@subsubsection @code{bfd_target_list}
-@strong{Synopsis}
-@example
-const char ** bfd_target_list (void);
-@end example
-@strong{Description}@*
-Return a freshly malloced NULL-terminated
-vector of the names of all the valid BFD targets. Do not
-modify the names.
-
-@findex bfd_seach_for_target
-@subsubsection @code{bfd_seach_for_target}
-@strong{Synopsis}
-@example
-const bfd_target *bfd_search_for_target
- (int (*search_func) (const bfd_target *, void *),
- void *);
-@end example
-@strong{Description}@*
-Return a pointer to the first transfer vector in the list of
-transfer vectors maintained by BFD that produces a non-zero
-result when passed to the function @var{search_func}. The
-parameter @var{data} is passed, unexamined, to the search
-function.
-
diff --git a/contrib/binutils/bfd/dwarf1.c b/contrib/binutils/bfd/dwarf1.c
deleted file mode 100644
index 1047ebf..0000000
--- a/contrib/binutils/bfd/dwarf1.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
-
-This file is part of BFD.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libiberty.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/dwarf.h"
-
-/* dwarf1_debug is the starting point for all dwarf1 info. */
-
-struct dwarf1_debug {
-
- /* The bfd we are working with. */
- bfd* abfd;
-
- /* List of already parsed compilation units. */
- struct dwarf1_unit* lastUnit;
-
- /* The buffer for the .debug section.
- Zero indicates that the .debug section failed to load. */
- char* debug_section;
-
- /* Pointer to the end of the .debug_info section memory buffer. */
- char* debug_section_end;
-
- /* The buffer for the .line section. */
- char* line_section;
-
- /* End of that buffer. */
- char* line_section_end;
-
- /* The current or next unread die within the .debug section. */
- char* currentDie;
-};
-
-/* One dwarf1_unit for each parsed compilation unit die. */
-
-struct dwarf1_unit {
- /* Linked starting from stash->lastUnit. */
- struct dwarf1_unit* prev;
-
- /* Name of the compilation unit. */
- char* name;
-
- /* The highest and lowest address used in the compilation unit. */
- unsigned long low_pc;
- unsigned long high_pc;
-
- /* Does this unit have a statement list? */
- int has_stmt_list;
-
- /* If any, the offset of the line number table in the .line section. */
- unsigned long stmt_list_offset;
-
- /* If non-zero, a pointer to the first child of this unit. */
- char* first_child;
-
- /* How many line entries? */
- unsigned long line_count;
-
- /* The decoded line number table (line_count entries). */
- struct linenumber* linenumber_table;
-
- /* The list of functions in this unit. */
- struct dwarf1_func* func_list;
-};
-
-/* One dwarf1_func for each parsed function die. */
-
-struct dwarf1_func {
- /* Linked starting from aUnit->func_list. */
- struct dwarf1_func* prev;
-
- /* Name of function. */
- char* name;
-
- /* The highest and lowest address used in the compilation unit. */
- unsigned long low_pc;
- unsigned long high_pc;
-};
-
-/* Used to return info about a parsed die. */
-struct die_info {
- unsigned long length;
- unsigned long sibling;
- unsigned long low_pc;
- unsigned long high_pc;
- unsigned long stmt_list_offset;
-
- char* name;
-
- int has_stmt_list;
-
- unsigned short tag;
-};
-
-/* Parsed line number information. */
-struct linenumber {
- /* First address in the line. */
- unsigned long addr;
-
- /* The line number. */
- unsigned long linenumber;
-};
-
-/* Find the form of an attr, from the attr field. */
-#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */
-
-static struct dwarf1_unit *alloc_dwarf1_unit
- PARAMS ((struct dwarf1_debug *));
-static struct dwarf1_func *alloc_dwarf1_func
- PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
-static bfd_boolean parse_die
- PARAMS ((bfd *, struct die_info *, char *, char *));
-static bfd_boolean parse_line_table
- PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
-static bfd_boolean parse_functions_in_unit
- PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
-static bfd_boolean dwarf1_unit_find_nearest_line
- PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *, unsigned long,
- const char **, const char **, unsigned int *));
-
-/* Return a newly allocated dwarf1_unit. It should be cleared and
- then attached into the 'stash' at 'stash->lastUnit'. */
-
-static struct dwarf1_unit*
-alloc_dwarf1_unit (stash)
- struct dwarf1_debug* stash;
-{
- 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;
-
- return x;
-}
-
-/* Return a newly allocated dwarf1_func. It must be cleared and
- attached into 'aUnit' at 'aUnit->func_list'. */
-
-static struct dwarf1_func*
-alloc_dwarf1_func (stash, aUnit)
- struct dwarf1_debug* stash;
- struct dwarf1_unit* aUnit;
-{
- 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;
-
- return x;
-}
-
-/* parse_die - parse a Dwarf1 die.
- Parse the die starting at 'aDiePtr' into 'aDieInfo'.
- 'abfd' must be the bfd from which the section that 'aDiePtr'
- points to was pulled from.
-
- Return FALSE if the die is invalidly formatted; TRUE otherwise. */
-
-static bfd_boolean
-parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
- bfd* abfd;
- struct die_info* aDieInfo;
- char* aDiePtr;
- char* aDiePtrEnd;
-{
- char* this_die = aDiePtr;
- char* xptr = this_die;
-
- memset (aDieInfo,0,sizeof (*aDieInfo));
-
- /* First comes the length. */
- aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
- xptr += 4;
- if (aDieInfo->length == 0
- || (this_die + aDieInfo->length) >= aDiePtrEnd)
- return FALSE;
- if (aDieInfo->length < 6)
- {
- /* Just padding bytes. */
- aDieInfo->tag = TAG_padding;
- return TRUE;
- }
-
- /* Then the tag. */
- aDieInfo->tag = bfd_get_16 (abfd, (bfd_byte *) xptr);
- xptr += 2;
-
- /* Then the attributes. */
- while (xptr < (this_die + aDieInfo->length))
- {
- unsigned short attr;
-
- /* Parse the attribute based on its form. This section
- must handle all dwarf1 forms, but need only handle the
- actual attributes that we care about. */
-
- attr = bfd_get_16 (abfd, (bfd_byte *) xptr);
- xptr += 2;
-
- switch (FORM_FROM_ATTR (attr))
- {
- case FORM_DATA2:
- xptr += 2;
- break;
- case FORM_DATA4:
- case FORM_REF:
- if (attr == AT_sibling)
- aDieInfo->sibling = bfd_get_32 (abfd, (bfd_byte *) xptr);
- else if (attr == AT_stmt_list)
- {
- aDieInfo->stmt_list_offset = bfd_get_32 (abfd, (bfd_byte *) xptr);
- aDieInfo->has_stmt_list = 1;
- }
- xptr += 4;
- break;
- case FORM_DATA8:
- xptr += 8;
- break;
- case FORM_ADDR:
- if (attr == AT_low_pc)
- aDieInfo->low_pc = bfd_get_32 (abfd, (bfd_byte *) xptr);
- else if (attr == AT_high_pc)
- aDieInfo->high_pc = bfd_get_32 (abfd, (bfd_byte *) xptr);
- xptr += 4;
- break;
- case FORM_BLOCK2:
- xptr += 2 + bfd_get_16 (abfd, (bfd_byte *) xptr);
- break;
- case FORM_BLOCK4:
- xptr += 4 + bfd_get_32 (abfd, (bfd_byte *) xptr);
- break;
- case FORM_STRING:
- if (attr == AT_name)
- aDieInfo->name = xptr;
- xptr += strlen (xptr) + 1;
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Parse a dwarf1 line number table for 'aUnit->stmt_list_offset'
- into 'aUnit->linenumber_table'. Return FALSE if an error
- occurs; TRUE otherwise. */
-
-static bfd_boolean
-parse_line_table (stash, aUnit)
- struct dwarf1_debug* stash;
- struct dwarf1_unit* aUnit;
-{
- char* xptr;
-
- /* Load the ".line" section from the bfd if we haven't already. */
- if (stash->line_section == 0)
- {
- asection *msec;
- bfd_size_type size;
-
- msec = bfd_get_section_by_name (stash->abfd, ".line");
- if (! msec)
- return FALSE;
-
- size = bfd_get_section_size_before_reloc (msec);
- stash->line_section = (char *) bfd_alloc (stash->abfd, size);
-
- if (! stash->line_section)
- return FALSE;
-
- if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section,
- (bfd_vma) 0, size))
- {
- stash->line_section = 0;
- return FALSE;
- }
-
- stash->line_section_end = stash->line_section + size;
- }
-
- xptr = stash->line_section + aUnit->stmt_list_offset;
- if (xptr < stash->line_section_end)
- {
- unsigned long eachLine;
- char *tblend;
- unsigned long base;
- bfd_size_type amt;
-
- /* First comes the length. */
- tblend = bfd_get_32 (stash->abfd, (bfd_byte *) xptr) + xptr;
- xptr += 4;
-
- /* Then the base address for each address in the table. */
- base = bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
- xptr += 4;
-
- /* How many line entrys?
- 10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */
- aUnit->line_count = (tblend - xptr) / 10;
-
- /* Allocate an array for the entries. */
- 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++)
- {
- /* A line number. */
- aUnit->linenumber_table[eachLine].linenumber
- = bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
- xptr += 4;
-
- /* Skip the position within the line. */
- xptr += 2;
-
- /* And finally the address. */
- aUnit->linenumber_table[eachLine].addr
- = base + bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
- xptr += 4;
- }
- }
-
- return TRUE;
-}
-
-/* Parse each function die in a compilation unit 'aUnit'.
- The first child die of 'aUnit' should be in 'aUnit->first_child',
- the result is placed in 'aUnit->func_list'.
- Return FALSE if error; TRUE otherwise. */
-
-static bfd_boolean
-parse_functions_in_unit (stash, aUnit)
- struct dwarf1_debug* stash;
- struct dwarf1_unit* aUnit;
-{
- char* eachDie;
-
- if (aUnit->first_child)
- for (eachDie = aUnit->first_child;
- eachDie < stash->debug_section_end;
- )
- {
- struct die_info eachDieInfo;
-
- if (! parse_die (stash->abfd, &eachDieInfo, eachDie,
- stash->debug_section_end))
- return FALSE;
-
- if (eachDieInfo.tag == TAG_global_subroutine
- || eachDieInfo.tag == TAG_subroutine
- || eachDieInfo.tag == TAG_inlined_subroutine
- || eachDieInfo.tag == TAG_entry_point)
- {
- struct dwarf1_func* aFunc = alloc_dwarf1_func (stash,aUnit);
-
- aFunc->name = eachDieInfo.name;
- aFunc->low_pc = eachDieInfo.low_pc;
- aFunc->high_pc = eachDieInfo.high_pc;
- }
-
- /* Move to next sibling, if none, end loop */
- if (eachDieInfo.sibling)
- eachDie = stash->debug_section + eachDieInfo.sibling;
- else
- break;
- }
-
- return TRUE;
-}
-
-/* Find the nearest line to 'addr' in 'aUnit'.
- Return whether we found the line (or a function) without error. */
-
-static bfd_boolean
-dwarf1_unit_find_nearest_line (stash, aUnit, addr,
- filename_ptr, functionname_ptr,
- linenumber_ptr)
- struct dwarf1_debug* stash;
- struct dwarf1_unit* aUnit;
- unsigned long addr;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *linenumber_ptr;
-{
- int line_p = FALSE;
- int func_p = FALSE;
-
- if (aUnit->low_pc <= addr && addr < aUnit->high_pc)
- {
- if (aUnit->has_stmt_list)
- {
- unsigned long i;
- struct dwarf1_func* eachFunc;
-
- if (! aUnit->linenumber_table)
- {
- if (! parse_line_table (stash, aUnit))
- return FALSE;
- }
-
- if (! aUnit->func_list)
- {
- if (! parse_functions_in_unit (stash, aUnit))
- return FALSE;
- }
-
- for (i = 0; i < aUnit->line_count; i++)
- {
- if (aUnit->linenumber_table[i].addr <= addr
- && addr < aUnit->linenumber_table[i+1].addr)
- {
- *filename_ptr = aUnit->name;
- *linenumber_ptr = aUnit->linenumber_table[i].linenumber;
- line_p = TRUE;
- break;
- }
- }
-
- for (eachFunc = aUnit->func_list;
- eachFunc;
- eachFunc = eachFunc->prev)
- {
- if (eachFunc->low_pc <= addr
- && addr < eachFunc->high_pc)
- {
- *functionname_ptr = eachFunc->name;
- func_p = TRUE;
- break;
- }
- }
- }
- }
-
- return line_p || func_p;
-}
-
-/* The DWARF 1 version of find_nearest line.
- Return TRUE if the line is found without error. */
-
-bfd_boolean
-_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr, linenumber_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols ATTRIBUTE_UNUSED;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *linenumber_ptr;
-{
- struct dwarf1_debug *stash = elf_tdata (abfd)->dwarf1_find_line_info;
-
- struct dwarf1_unit* eachUnit;
-
- /* What address are we looking for? */
- unsigned long addr = (unsigned long)(offset + section->vma);
-
- *filename_ptr = NULL;
- *functionname_ptr = NULL;
- *linenumber_ptr = 0;
-
- if (! stash)
- {
- asection *msec;
- bfd_size_type size = sizeof (struct dwarf1_debug);
-
- stash = elf_tdata (abfd)->dwarf1_find_line_info
- = (struct dwarf1_debug *) bfd_zalloc (abfd, size);
-
- if (! stash)
- return FALSE;
-
- msec = bfd_get_section_by_name (abfd, ".debug");
- if (! msec)
- {
- /* No dwarf1 info. Note that at this point the stash
- has been allocated, but contains zeros, this lets
- future calls to this function fail quicker. */
- return FALSE;
- }
-
- size = bfd_get_section_size_before_reloc (msec);
- stash->debug_section = (char *) bfd_alloc (abfd, size);
-
- if (! stash->debug_section)
- return FALSE;
-
- if (! bfd_get_section_contents (abfd, msec, stash->debug_section,
- (bfd_vma) 0, size))
- {
- stash->debug_section = 0;
- return FALSE;
- }
-
- stash->debug_section_end = stash->debug_section + size;
- stash->currentDie = stash->debug_section;
- stash->abfd = abfd;
- }
-
- /* A null debug_section indicates that there was no dwarf1 info
- or that an error occured while setting up the stash. */
-
- if (! stash->debug_section)
- return FALSE;
-
- /* Look at the previously parsed units to see if any contain
- the addr. */
- for (eachUnit = stash->lastUnit; eachUnit; eachUnit = eachUnit->prev)
- {
- if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc)
- return dwarf1_unit_find_nearest_line (stash, eachUnit, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr);
- }
-
- while (stash->currentDie < stash->debug_section_end)
- {
- struct die_info aDieInfo;
-
- if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie,
- stash->debug_section_end))
- return FALSE;
-
- if (aDieInfo.tag == TAG_compile_unit)
- {
- struct dwarf1_unit* aUnit
- = alloc_dwarf1_unit (stash);
-
- aUnit->name = aDieInfo.name;
- aUnit->low_pc = aDieInfo.low_pc;
- aUnit->high_pc = aDieInfo.high_pc;
- aUnit->has_stmt_list = aDieInfo.has_stmt_list;
- aUnit->stmt_list_offset = aDieInfo.stmt_list_offset;
-
- /* A die has a child if it's followed by a die that is
- not it's sibling. */
- if (aDieInfo.sibling
- && stash->currentDie + aDieInfo.length
- < stash->debug_section_end
- && stash->currentDie + aDieInfo.length
- != stash->debug_section + aDieInfo.sibling)
- aUnit->first_child = stash->currentDie + aDieInfo.length;
- else
- aUnit->first_child = 0;
-
- if (aUnit->low_pc <= addr && addr < aUnit->high_pc)
- return dwarf1_unit_find_nearest_line (stash, aUnit, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr);
- }
-
- if (aDieInfo.sibling != 0)
- stash->currentDie = stash->debug_section + aDieInfo.sibling;
- else
- stash->currentDie += aDieInfo.length;
- }
-
- return FALSE;
-}
-
-/* EOF */
diff --git a/contrib/binutils/bfd/dwarf2.c b/contrib/binutils/bfd/dwarf2.c
deleted file mode 100644
index 6182ea9..0000000
--- a/contrib/binutils/bfd/dwarf2.c
+++ /dev/null
@@ -1,1876 +0,0 @@
-/* DWARF 2 support.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004 Free Software Foundation, Inc.
-
- Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
- (gavin@cygnus.com).
-
- From the dwarf2read.c header:
- Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
- Inc. with support from Florida State University (under contract
- with the Ada Joint Program Office), and Silicon Graphics, Inc.
- Initial contribution by Brent Benson, Harris Computer Systems, Inc.,
- based on Fred Fish's (Cygnus Support) implementation of DWARF 1
- support in dwarfread.c
-
- This file is part of BFD.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libiberty.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/dwarf2.h"
-
-/* The data in the .debug_line statement prologue looks like this. */
-
-struct line_head
-{
- bfd_vma total_length;
- unsigned short version;
- bfd_vma prologue_length;
- unsigned char minimum_instruction_length;
- unsigned char default_is_stmt;
- int line_base;
- unsigned char line_range;
- unsigned char opcode_base;
- unsigned char *standard_opcode_lengths;
-};
-
-/* Attributes have a name and a value. */
-
-struct attribute
-{
- enum dwarf_attribute name;
- enum dwarf_form form;
- union
- {
- char *str;
- struct dwarf_block *blk;
- bfd_uint64_t val;
- bfd_int64_t sval;
- }
- u;
-};
-
-/* Blocks are a bunch of untyped bytes. */
-struct dwarf_block
-{
- unsigned int size;
- char *data;
-};
-
-struct dwarf2_debug
-{
- /* A list of all previously read comp_units. */
- struct comp_unit* all_comp_units;
-
- /* The next unread compilation unit within the .debug_info section.
- Zero indicates that the .debug_info section has not been loaded
- into a buffer yet. */
- char* info_ptr;
-
- /* Pointer to the end of the .debug_info section memory buffer. */
- char* info_ptr_end;
-
- /* Pointer to the section and address of the beginning of the
- section. */
- asection* sec;
- char* sec_info_ptr;
-
- /* Pointer to the symbol table. */
- asymbol** syms;
-
- /* Pointer to the .debug_abbrev section loaded into memory. */
- char* dwarf_abbrev_buffer;
-
- /* Length of the loaded .debug_abbrev section. */
- unsigned long dwarf_abbrev_size;
-
- /* Buffer for decode_line_info. */
- char *dwarf_line_buffer;
-
- /* Length of the loaded .debug_line section. */
- unsigned long dwarf_line_size;
-
- /* Pointer to the .debug_str section loaded into memory. */
- char* dwarf_str_buffer;
-
- /* Length of the loaded .debug_str section. */
- unsigned long dwarf_str_size;
-};
-
-struct arange
-{
- struct arange *next;
- bfd_vma low;
- bfd_vma high;
-};
-
-/* A minimal decoding of DWARF2 compilation units. We only decode
- what's needed to get to the line number information. */
-
-struct comp_unit
-{
- /* Chain the previously read compilation units. */
- struct comp_unit* next_unit;
-
- /* Keep the bdf convenient (for memory allocation). */
- bfd* abfd;
-
- /* The lowest and higest addresses contained in this compilation
- unit as specified in the compilation unit header. */
- struct arange arange;
-
- /* The DW_AT_name attribute (for error messages). */
- char* name;
-
- /* The abbrev hash table. */
- struct abbrev_info** abbrevs;
-
- /* Note that an error was found by comp_unit_find_nearest_line. */
- int error;
-
- /* The DW_AT_comp_dir attribute. */
- char* comp_dir;
-
- /* TRUE if there is a line number table associated with this comp. unit. */
- int stmtlist;
-
- /* The offset into .debug_line of the line number table. */
- unsigned long line_offset;
-
- /* Pointer to the first child die for the comp unit. */
- char *first_child_die_ptr;
-
- /* The end of the comp unit. */
- char *end_ptr;
-
- /* The decoded line number, NULL if not yet decoded. */
- struct line_info_table* line_table;
-
- /* A list of the functions found in this comp. unit. */
- struct funcinfo* function_table;
-
- /* Pointer to dwarf2_debug structure. */
- struct dwarf2_debug *stash;
-
- /* Address size for this unit - from unit header. */
- unsigned char addr_size;
-
- /* Offset size for this unit - from unit header. */
- unsigned char offset_size;
-};
-
-/* This data structure holds the information of an abbrev. */
-struct abbrev_info
-{
- unsigned int number; /* Number identifying abbrev. */
- enum dwarf_tag tag; /* DWARF tag. */
- int has_children; /* Boolean. */
- unsigned int num_attrs; /* Number of attributes. */
- struct attr_abbrev *attrs; /* An array of attribute descriptions. */
- struct abbrev_info *next; /* Next in chain. */
-};
-
-struct attr_abbrev
-{
- enum dwarf_attribute name;
- enum dwarf_form form;
-};
-
-#ifndef ABBREV_HASH_SIZE
-#define ABBREV_HASH_SIZE 121
-#endif
-#ifndef ATTR_ALLOC_CHUNK
-#define ATTR_ALLOC_CHUNK 4
-#endif
-
-/* VERBATIM
- The following function up to the END VERBATIM mark are
- copied directly from dwarf2read.c. */
-
-/* Read dwarf information from a buffer. */
-
-static unsigned int
-read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf)
-{
- return bfd_get_8 (abfd, buf);
-}
-
-static int
-read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf)
-{
- return bfd_get_signed_8 (abfd, buf);
-}
-
-static unsigned int
-read_2_bytes (bfd *abfd, char *buf)
-{
- return bfd_get_16 (abfd, buf);
-}
-
-static unsigned int
-read_4_bytes (bfd *abfd, char *buf)
-{
- return bfd_get_32 (abfd, buf);
-}
-
-static bfd_uint64_t
-read_8_bytes (bfd *abfd, char *buf)
-{
- return bfd_get_64 (abfd, buf);
-}
-
-static char *
-read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int size ATTRIBUTE_UNUSED)
-{
- /* If the size of a host char is 8 bits, we can return a pointer
- to the buffer, otherwise we have to copy the data to a buffer
- allocated on the temporary obstack. */
- return buf;
-}
-
-static char *
-read_string (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int *bytes_read_ptr)
-{
- /* Return a pointer to the embedded string. */
- if (*buf == '\0')
- {
- *bytes_read_ptr = 1;
- return NULL;
- }
-
- *bytes_read_ptr = strlen (buf) + 1;
- return buf;
-}
-
-static char *
-read_indirect_string (struct comp_unit* unit,
- char *buf,
- unsigned int *bytes_read_ptr)
-{
- bfd_uint64_t offset;
- struct dwarf2_debug *stash = unit->stash;
-
- if (unit->offset_size == 4)
- offset = read_4_bytes (unit->abfd, buf);
- else
- offset = read_8_bytes (unit->abfd, buf);
- *bytes_read_ptr = unit->offset_size;
-
- if (! stash->dwarf_str_buffer)
- {
- asection *msec;
- bfd *abfd = unit->abfd;
-
- msec = bfd_get_section_by_name (abfd, ".debug_str");
- if (! msec)
- {
- (*_bfd_error_handler)
- (_("Dwarf Error: Can't find .debug_str section."));
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-
- stash->dwarf_str_size = msec->_raw_size;
- stash->dwarf_str_buffer = bfd_alloc (abfd, msec->_raw_size);
- if (! stash->dwarf_abbrev_buffer)
- return NULL;
-
- if (! bfd_get_section_contents (abfd, msec, stash->dwarf_str_buffer,
- 0, msec->_raw_size))
- return NULL;
- }
-
- if (offset >= stash->dwarf_str_size)
- {
- (*_bfd_error_handler) (_("Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)."),
- (unsigned long) offset, stash->dwarf_str_size);
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-
- buf = stash->dwarf_str_buffer + offset;
- if (*buf == '\0')
- return NULL;
- return buf;
-}
-
-static unsigned int
-read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int *bytes_read_ptr)
-{
- unsigned int result;
- unsigned int num_read;
- int shift;
- unsigned char byte;
-
- result = 0;
- shift = 0;
- num_read = 0;
-
- do
- {
- byte = bfd_get_8 (abfd, buf);
- buf ++;
- num_read ++;
- result |= ((byte & 0x7f) << shift);
- shift += 7;
- }
- while (byte & 0x80);
-
- * bytes_read_ptr = num_read;
-
- return result;
-}
-
-static int
-read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int * bytes_read_ptr)
-{
- int result;
- int shift;
- int num_read;
- unsigned char byte;
-
- result = 0;
- shift = 0;
- num_read = 0;
-
- do
- {
- byte = bfd_get_8 (abfd, buf);
- buf ++;
- num_read ++;
- result |= ((byte & 0x7f) << shift);
- shift += 7;
- }
- while (byte & 0x80);
-
- if ((shift < 32) && (byte & 0x40))
- result |= -(1 << shift);
-
- * bytes_read_ptr = num_read;
-
- return result;
-}
-
-/* END VERBATIM */
-
-static bfd_uint64_t
-read_address (struct comp_unit *unit, char *buf)
-{
- switch (unit->addr_size)
- {
- case 8:
- return bfd_get_64 (unit->abfd, buf);
- case 4:
- return bfd_get_32 (unit->abfd, buf);
- case 2:
- return bfd_get_16 (unit->abfd, buf);
- default:
- abort ();
- }
-}
-
-/* Lookup an abbrev_info structure in the abbrev hash table. */
-
-static struct abbrev_info *
-lookup_abbrev (unsigned int number, struct abbrev_info **abbrevs)
-{
- unsigned int hash_number;
- struct abbrev_info *abbrev;
-
- hash_number = number % ABBREV_HASH_SIZE;
- abbrev = abbrevs[hash_number];
-
- while (abbrev)
- {
- if (abbrev->number == number)
- return abbrev;
- else
- abbrev = abbrev->next;
- }
-
- return NULL;
-}
-
-/* In DWARF version 2, the description of the debugging information is
- stored in a separate .debug_abbrev section. Before we read any
- dies from a section we read in all abbreviations and install them
- in a hash table. */
-
-static struct abbrev_info**
-read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
-{
- struct abbrev_info **abbrevs;
- char *abbrev_ptr;
- 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)
- {
- asection *msec;
-
- msec = bfd_get_section_by_name (abfd, ".debug_abbrev");
- if (! msec)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_abbrev section."));
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- stash->dwarf_abbrev_size = msec->_raw_size;
- stash->dwarf_abbrev_buffer
- = bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
- stash->syms);
- if (! stash->dwarf_abbrev_buffer)
- return 0;
- }
-
- if (offset >= stash->dwarf_abbrev_size)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)."),
- (unsigned long) offset, stash->dwarf_abbrev_size);
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE;
- abbrevs = bfd_zalloc (abfd, amt);
-
- abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
- abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
-
- /* Loop until we reach an abbrev number of 0. */
- while (abbrev_number)
- {
- amt = sizeof (struct abbrev_info);
- cur_abbrev = bfd_zalloc (abfd, amt);
-
- /* Read in abbrev header. */
- cur_abbrev->number = abbrev_number;
- cur_abbrev->tag = (enum dwarf_tag)
- read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr);
- abbrev_ptr += 1;
-
- /* Now read in declarations. */
- abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
-
- while (abbrev_name)
- {
- if ((cur_abbrev->num_attrs % ATTR_ALLOC_CHUNK) == 0)
- {
- amt = cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK;
- amt *= sizeof (struct attr_abbrev);
- cur_abbrev->attrs = bfd_realloc (cur_abbrev->attrs, amt);
- if (! cur_abbrev->attrs)
- return 0;
- }
-
- cur_abbrev->attrs[cur_abbrev->num_attrs].name
- = (enum dwarf_attribute) abbrev_name;
- cur_abbrev->attrs[cur_abbrev->num_attrs++].form
- = (enum dwarf_form) abbrev_form;
- abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- }
-
- hash_number = abbrev_number % ABBREV_HASH_SIZE;
- cur_abbrev->next = abbrevs[hash_number];
- abbrevs[hash_number] = cur_abbrev;
-
- /* Get next abbreviation.
- Under Irix6 the abbreviations for a compilation unit are not
- always properly terminated with an abbrev number of 0.
- Exit loop if we encounter an abbreviation which we have
- already read (which means we are about to read the abbreviations
- for the next compile unit) or if the end of the abbreviation
- table is reached. */
- if ((unsigned int) (abbrev_ptr - stash->dwarf_abbrev_buffer)
- >= stash->dwarf_abbrev_size)
- break;
- abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- if (lookup_abbrev (abbrev_number,abbrevs) != NULL)
- break;
- }
-
- return abbrevs;
-}
-
-/* Read an attribute value described by an attribute form. */
-
-static char *
-read_attribute_value (struct attribute *attr,
- unsigned form,
- struct comp_unit *unit,
- char *info_ptr)
-{
- bfd *abfd = unit->abfd;
- unsigned int bytes_read;
- struct dwarf_block *blk;
- bfd_size_type amt;
-
- attr->form = (enum dwarf_form) form;
-
- switch (form)
- {
- case DW_FORM_addr:
- /* FIXME: DWARF3 draft says DW_FORM_ref_addr is offset_size. */
- case DW_FORM_ref_addr:
- attr->u.val = read_address (unit, info_ptr);
- info_ptr += unit->addr_size;
- break;
- case DW_FORM_block2:
- amt = sizeof (struct dwarf_block);
- blk = 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);
- info_ptr += blk->size;
- attr->u.blk = blk;
- break;
- case DW_FORM_block4:
- amt = sizeof (struct dwarf_block);
- blk = 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);
- info_ptr += blk->size;
- attr->u.blk = blk;
- break;
- case DW_FORM_data2:
- attr->u.val = read_2_bytes (abfd, info_ptr);
- info_ptr += 2;
- break;
- case DW_FORM_data4:
- attr->u.val = read_4_bytes (abfd, info_ptr);
- info_ptr += 4;
- break;
- case DW_FORM_data8:
- attr->u.val = read_8_bytes (abfd, info_ptr);
- info_ptr += 8;
- break;
- case DW_FORM_string:
- attr->u.str = read_string (abfd, info_ptr, &bytes_read);
- info_ptr += bytes_read;
- break;
- case DW_FORM_strp:
- attr->u.str = read_indirect_string (unit, info_ptr, &bytes_read);
- info_ptr += bytes_read;
- break;
- case DW_FORM_block:
- amt = sizeof (struct dwarf_block);
- blk = 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);
- info_ptr += blk->size;
- attr->u.blk = blk;
- break;
- case DW_FORM_block1:
- amt = sizeof (struct dwarf_block);
- blk = 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);
- info_ptr += blk->size;
- attr->u.blk = blk;
- break;
- case DW_FORM_data1:
- attr->u.val = read_1_byte (abfd, info_ptr);
- info_ptr += 1;
- break;
- case DW_FORM_flag:
- attr->u.val = read_1_byte (abfd, info_ptr);
- info_ptr += 1;
- break;
- case DW_FORM_sdata:
- attr->u.sval = read_signed_leb128 (abfd, info_ptr, &bytes_read);
- info_ptr += bytes_read;
- break;
- case DW_FORM_udata:
- attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
- info_ptr += bytes_read;
- break;
- case DW_FORM_ref1:
- attr->u.val = read_1_byte (abfd, info_ptr);
- info_ptr += 1;
- break;
- case DW_FORM_ref2:
- attr->u.val = read_2_bytes (abfd, info_ptr);
- info_ptr += 2;
- break;
- case DW_FORM_ref4:
- attr->u.val = read_4_bytes (abfd, info_ptr);
- info_ptr += 4;
- break;
- case DW_FORM_ref8:
- attr->u.val = read_8_bytes (abfd, info_ptr);
- info_ptr += 8;
- break;
- case DW_FORM_ref_udata:
- attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
- info_ptr += bytes_read;
- break;
- case DW_FORM_indirect:
- form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
- info_ptr += bytes_read;
- info_ptr = read_attribute_value (attr, form, unit, info_ptr);
- break;
- default:
- (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %u."),
- form);
- bfd_set_error (bfd_error_bad_value);
- }
- return info_ptr;
-}
-
-/* Read an attribute described by an abbreviated attribute. */
-
-static char *
-read_attribute (struct attribute *attr,
- struct attr_abbrev *abbrev,
- struct comp_unit *unit,
- char *info_ptr)
-{
- attr->name = abbrev->name;
- info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr);
- return info_ptr;
-}
-
-/* Source line information table routines. */
-
-#define FILE_ALLOC_CHUNK 5
-#define DIR_ALLOC_CHUNK 5
-
-struct line_info
-{
- struct line_info* prev_line;
- bfd_vma address;
- char* filename;
- unsigned int line;
- unsigned int column;
- int end_sequence; /* End of (sequential) code sequence. */
-};
-
-struct fileinfo
-{
- char *name;
- unsigned int dir;
- unsigned int time;
- unsigned int size;
-};
-
-struct line_info_table
-{
- bfd* abfd;
- unsigned int num_files;
- unsigned int num_dirs;
- char* comp_dir;
- char** dirs;
- struct fileinfo* files;
- struct line_info* last_line; /* largest VMA */
- struct line_info* lcl_head; /* local head; used in 'add_line_info' */
-};
-
-struct funcinfo
-{
- struct funcinfo *prev_func;
- char* name;
- bfd_vma low;
- bfd_vma high;
-};
-
-/* Adds a new entry to the line_info list in the line_info_table, ensuring
- that the list is sorted. Note that the line_info list is sorted from
- highest to lowest VMA (with possible duplicates); that is,
- line_info->prev_line always accesses an equal or smaller VMA. */
-
-static void
-add_line_info (struct line_info_table *table,
- bfd_vma address,
- char *filename,
- unsigned int line,
- unsigned int column,
- int end_sequence)
-{
- bfd_size_type amt = sizeof (struct line_info);
- struct line_info* info = bfd_alloc (table->abfd, amt);
-
- /* Find the correct location for 'info'. Normally we will receive
- new line_info data 1) in order and 2) with increasing VMAs.
- However some compilers break the rules (cf. decode_line_info) and
- so we include some heuristics for quickly finding the correct
- location for 'info'. In particular, these heuristics optimize for
- the common case in which the VMA sequence that we receive is a
- list of locally sorted VMAs such as
- p...z a...j (where a < j < p < z)
-
- Note: table->lcl_head is used to head an *actual* or *possible*
- sequence within the list (such as a...j) that is not directly
- headed by table->last_line
-
- Note: we may receive duplicate entries from 'decode_line_info'. */
-
- while (1)
- if (!table->last_line
- || address >= table->last_line->address)
- {
- /* Normal case: add 'info' to the beginning of the list */
- info->prev_line = table->last_line;
- table->last_line = info;
-
- /* lcl_head: initialize to head a *possible* sequence at the end. */
- if (!table->lcl_head)
- table->lcl_head = info;
- break;
- }
- else if (!table->lcl_head->prev_line
- && table->lcl_head->address > address)
- {
- /* Abnormal but easy: lcl_head is 1) at the *end* of the line
- list and 2) the head of 'info'. */
- info->prev_line = NULL;
- table->lcl_head->prev_line = info;
- break;
- }
- else if (table->lcl_head->prev_line
- && table->lcl_head->address > address
- && address >= table->lcl_head->prev_line->address)
- {
- /* Abnormal but easy: lcl_head is 1) in the *middle* of the line
- list and 2) the head of 'info'. */
- info->prev_line = table->lcl_head->prev_line;
- table->lcl_head->prev_line = info;
- break;
- }
- else
- {
- /* Abnormal and hard: Neither 'last_line' nor 'lcl_head' are valid
- heads for 'info'. Reset 'lcl_head' and repeat. */
- struct line_info* li2 = table->last_line; /* always non-NULL */
- struct line_info* li1 = li2->prev_line;
-
- while (li1)
- {
- if (li2->address > address && address >= li1->address)
- break;
-
- li2 = li1; /* always non-NULL */
- li1 = li1->prev_line;
- }
- table->lcl_head = li2;
- }
-
- /* Set member data of 'info'. */
- info->address = address;
- info->line = line;
- info->column = column;
- info->end_sequence = end_sequence;
-
- if (filename && filename[0])
- {
- info->filename = bfd_alloc (table->abfd, strlen (filename) + 1);
- if (info->filename)
- strcpy (info->filename, filename);
- }
- else
- info->filename = NULL;
-}
-
-/* Extract a fully qualified filename from a line info table.
- The returned string has been malloc'ed and it is the caller's
- responsibility to free it. */
-
-static char *
-concat_filename (struct line_info_table *table, unsigned int file)
-{
- char* filename;
-
- if (file - 1 >= table->num_files)
- {
- (*_bfd_error_handler)
- (_("Dwarf Error: mangled line number section (bad file number)."));
- return strdup ("<unknown>");
- }
-
- filename = table->files[file - 1].name;
-
- if (! IS_ABSOLUTE_PATH (filename))
- {
- char* dirname = (table->files[file - 1].dir
- ? table->dirs[table->files[file - 1].dir - 1]
- : table->comp_dir);
-
- /* Not all tools set DW_AT_comp_dir, so dirname may be unknown.
- The best we can do is return the filename part. */
- if (dirname != NULL)
- {
- unsigned int len = strlen (dirname) + strlen (filename) + 2;
- char * name;
-
- name = bfd_malloc (len);
- if (name)
- sprintf (name, "%s/%s", dirname, filename);
- return name;
- }
- }
-
- return strdup (filename);
-}
-
-static void
-arange_add (struct comp_unit *unit, bfd_vma low_pc, bfd_vma high_pc)
-{
- struct arange *arange;
-
- /* First see if we can cheaply extend an existing range. */
- arange = &unit->arange;
-
- do
- {
- if (low_pc == arange->high)
- {
- arange->high = high_pc;
- return;
- }
- if (high_pc == arange->low)
- {
- arange->low = low_pc;
- return;
- }
- arange = arange->next;
- }
- while (arange);
-
- if (unit->arange.high == 0)
- {
- /* This is the first address range: store it in unit->arange. */
- unit->arange.next = 0;
- unit->arange.low = low_pc;
- unit->arange.high = high_pc;
- return;
- }
-
- /* Need to allocate a new arange and insert it into the arange list. */
- arange = bfd_zalloc (unit->abfd, sizeof (*arange));
- arange->low = low_pc;
- arange->high = high_pc;
-
- arange->next = unit->arange.next;
- unit->arange.next = arange;
-}
-
-/* Decode the line number information for UNIT. */
-
-static struct line_info_table*
-decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
-{
- bfd *abfd = unit->abfd;
- struct line_info_table* table;
- char *line_ptr;
- char *line_end;
- struct line_head lh;
- unsigned int i, bytes_read, offset_size;
- char *cur_file, *cur_dir;
- unsigned char op_code, extended_op, adj_opcode;
- bfd_size_type amt;
-
- if (! stash->dwarf_line_buffer)
- {
- asection *msec;
-
- msec = bfd_get_section_by_name (abfd, ".debug_line");
- if (! msec)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_line section."));
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- stash->dwarf_line_size = msec->_raw_size;
- stash->dwarf_line_buffer
- = bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
- stash->syms);
- if (! stash->dwarf_line_buffer)
- return 0;
- }
-
- /* It is possible to get a bad value for the line_offset. Validate
- it here so that we won't get a segfault below. */
- if (unit->line_offset >= stash->dwarf_line_size)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)."),
- unit->line_offset, stash->dwarf_line_size);
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- amt = sizeof (struct line_info_table);
- table = bfd_alloc (abfd, amt);
- table->abfd = abfd;
- table->comp_dir = unit->comp_dir;
-
- table->num_files = 0;
- table->files = NULL;
-
- table->num_dirs = 0;
- table->dirs = NULL;
-
- table->files = NULL;
- table->last_line = NULL;
- table->lcl_head = NULL;
-
- line_ptr = stash->dwarf_line_buffer + unit->line_offset;
-
- /* Read in the prologue. */
- lh.total_length = read_4_bytes (abfd, line_ptr);
- line_ptr += 4;
- offset_size = 4;
- if (lh.total_length == 0xffffffff)
- {
- lh.total_length = read_8_bytes (abfd, line_ptr);
- line_ptr += 8;
- offset_size = 8;
- }
- else if (lh.total_length == 0 && unit->addr_size == 8)
- {
- /* Handle (non-standard) 64-bit DWARF2 formats. */
- lh.total_length = read_4_bytes (abfd, line_ptr);
- line_ptr += 4;
- offset_size = 8;
- }
- line_end = line_ptr + lh.total_length;
- lh.version = read_2_bytes (abfd, line_ptr);
- line_ptr += 2;
- if (offset_size == 4)
- lh.prologue_length = read_4_bytes (abfd, line_ptr);
- else
- lh.prologue_length = read_8_bytes (abfd, line_ptr);
- line_ptr += offset_size;
- lh.minimum_instruction_length = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
- lh.default_is_stmt = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
- lh.line_base = read_1_signed_byte (abfd, line_ptr);
- line_ptr += 1;
- lh.line_range = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
- lh.opcode_base = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
- amt = lh.opcode_base * sizeof (unsigned char);
- lh.standard_opcode_lengths = bfd_alloc (abfd, amt);
-
- lh.standard_opcode_lengths[0] = 1;
-
- for (i = 1; i < lh.opcode_base; ++i)
- {
- lh.standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
- }
-
- /* Read directory table. */
- while ((cur_dir = read_string (abfd, line_ptr, &bytes_read)) != NULL)
- {
- line_ptr += bytes_read;
-
- if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0)
- {
- amt = table->num_dirs + DIR_ALLOC_CHUNK;
- amt *= sizeof (char *);
- table->dirs = bfd_realloc (table->dirs, amt);
- if (! table->dirs)
- return 0;
- }
-
- table->dirs[table->num_dirs++] = cur_dir;
- }
-
- line_ptr += bytes_read;
-
- /* Read file name table. */
- while ((cur_file = read_string (abfd, line_ptr, &bytes_read)) != NULL)
- {
- line_ptr += bytes_read;
-
- if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
- {
- amt = table->num_files + FILE_ALLOC_CHUNK;
- amt *= sizeof (struct fileinfo);
- table->files = bfd_realloc (table->files, amt);
- if (! table->files)
- return 0;
- }
-
- table->files[table->num_files].name = cur_file;
- table->files[table->num_files].dir =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- table->files[table->num_files].time =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- table->files[table->num_files].size =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- table->num_files++;
- }
-
- line_ptr += bytes_read;
-
- /* Read the statement sequences until there's nothing left. */
- while (line_ptr < line_end)
- {
- /* State machine registers. */
- bfd_vma address = 0;
- char * filename = table->num_files ? concat_filename (table, 1) : NULL;
- unsigned int line = 1;
- unsigned int column = 0;
- int is_stmt = lh.default_is_stmt;
- int basic_block = 0;
- int end_sequence = 0;
- /* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some
- compilers generate address sequences that are wildly out of
- order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler
- for ia64-Linux). Thus, to determine the low and high
- address, we must compare on every DW_LNS_copy, etc. */
- bfd_vma low_pc = 0;
- bfd_vma high_pc = 0;
-
- /* Decode the table. */
- while (! end_sequence)
- {
- op_code = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
-
- if (op_code >= lh.opcode_base)
- {
- /* Special operand. */
- adj_opcode = op_code - lh.opcode_base;
- address += (adj_opcode / lh.line_range)
- * lh.minimum_instruction_length;
- line += lh.line_base + (adj_opcode % lh.line_range);
- /* Append row to matrix using current values. */
- add_line_info (table, address, filename, line, column, 0);
- basic_block = 1;
- if (low_pc == 0 || address < low_pc)
- low_pc = address;
- if (address > high_pc)
- high_pc = address;
- }
- else switch (op_code)
- {
- case DW_LNS_extended_op:
- /* Ignore length. */
- line_ptr += 1;
- extended_op = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
-
- switch (extended_op)
- {
- case DW_LNE_end_sequence:
- end_sequence = 1;
- add_line_info (table, address, filename, line, column,
- end_sequence);
- if (low_pc == 0 || address < low_pc)
- low_pc = address;
- if (address > high_pc)
- high_pc = address;
- arange_add (unit, low_pc, high_pc);
- break;
- case DW_LNE_set_address:
- address = read_address (unit, line_ptr);
- line_ptr += unit->addr_size;
- break;
- case DW_LNE_define_file:
- cur_file = read_string (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
- {
- amt = table->num_files + FILE_ALLOC_CHUNK;
- amt *= sizeof (struct fileinfo);
- table->files = bfd_realloc (table->files, amt);
- if (! table->files)
- return 0;
- }
- table->files[table->num_files].name = cur_file;
- table->files[table->num_files].dir =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- table->files[table->num_files].time =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- table->files[table->num_files].size =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- table->num_files++;
- break;
- default:
- (*_bfd_error_handler) (_("Dwarf Error: mangled line number section."));
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
- break;
- case DW_LNS_copy:
- add_line_info (table, address, filename, line, column, 0);
- basic_block = 0;
- if (low_pc == 0 || address < low_pc)
- low_pc = address;
- if (address > high_pc)
- high_pc = address;
- break;
- case DW_LNS_advance_pc:
- address += lh.minimum_instruction_length
- * read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- break;
- case DW_LNS_advance_line:
- line += read_signed_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- break;
- case DW_LNS_set_file:
- {
- unsigned int file;
-
- /* The file and directory tables are 0
- based, the references are 1 based. */
- file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- if (filename)
- free (filename);
- filename = concat_filename (table, file);
- break;
- }
- case DW_LNS_set_column:
- column = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- break;
- case DW_LNS_negate_stmt:
- is_stmt = (!is_stmt);
- break;
- case DW_LNS_set_basic_block:
- basic_block = 1;
- break;
- case DW_LNS_const_add_pc:
- address += lh.minimum_instruction_length
- * ((255 - lh.opcode_base) / lh.line_range);
- break;
- case DW_LNS_fixed_advance_pc:
- address += read_2_bytes (abfd, line_ptr);
- line_ptr += 2;
- break;
- default:
- {
- int i;
-
- /* Unknown standard opcode, ignore it. */
- for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
- {
- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- }
- }
- }
- }
-
- if (filename)
- free (filename);
- }
-
- return table;
-}
-
-/* If ADDR is within TABLE set the output parameters and return TRUE,
- otherwise return FALSE. The output parameters, FILENAME_PTR and
- LINENUMBER_PTR, are pointers to the objects to be filled in. */
-
-static bfd_boolean
-lookup_address_in_line_info_table (struct line_info_table *table,
- bfd_vma addr,
- struct funcinfo *function,
- const char **filename_ptr,
- unsigned int *linenumber_ptr)
-{
- /* Note: table->last_line should be a descendingly sorted list. */
- struct line_info* next_line = table->last_line;
- struct line_info* each_line = NULL;
- *filename_ptr = NULL;
-
- if (!next_line)
- return FALSE;
-
- each_line = next_line->prev_line;
-
- /* Check for large addresses */
- if (addr > next_line->address)
- each_line = NULL; /* ensure we skip over the normal case */
-
- /* Normal case: search the list; save */
- while (each_line && next_line)
- {
- /* If we have an address match, save this info. This allows us
- to return as good as results as possible for strange debugging
- info. */
- bfd_boolean addr_match = FALSE;
- if (each_line->address <= addr && addr <= next_line->address)
- {
- addr_match = TRUE;
-
- /* If this line appears to span functions, and addr is in the
- later function, return the first line of that function instead
- of the last line of the earlier one. This check is for GCC
- 2.95, which emits the first line number for a function late. */
- if (function != NULL
- && each_line->address < function->low
- && next_line->address > function->low)
- {
- *filename_ptr = next_line->filename;
- *linenumber_ptr = next_line->line;
- }
- else
- {
- *filename_ptr = each_line->filename;
- *linenumber_ptr = each_line->line;
- }
- }
-
- if (addr_match && !each_line->end_sequence)
- return TRUE; /* we have definitely found what we want */
-
- next_line = each_line;
- each_line = each_line->prev_line;
- }
-
- /* At this point each_line is NULL but next_line is not. If we found
- a candidate end-of-sequence point in the loop above, we can return
- that (compatibility with a bug in the Intel compiler); otherwise,
- assuming that we found the containing function for this address in
- this compilation unit, return the first line we have a number for
- (compatibility with GCC 2.95). */
- if (*filename_ptr == NULL && function != NULL)
- {
- *filename_ptr = next_line->filename;
- *linenumber_ptr = next_line->line;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* Function table functions. */
-
-/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return TRUE. */
-
-static bfd_boolean
-lookup_address_in_function_table (struct funcinfo *table,
- bfd_vma addr,
- struct funcinfo **function_ptr,
- const char **functionname_ptr)
-{
- struct funcinfo* each_func;
-
- for (each_func = table;
- each_func;
- each_func = each_func->prev_func)
- {
- if (addr >= each_func->low && addr < each_func->high)
- {
- *functionname_ptr = each_func->name;
- *function_ptr = each_func;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* DWARF2 Compilation unit functions. */
-
-/* Scan over each die in a comp. unit looking for functions to add
- to the function table. */
-
-static bfd_boolean
-scan_unit_for_functions (struct comp_unit *unit)
-{
- bfd *abfd = unit->abfd;
- char *info_ptr = unit->first_child_die_ptr;
- int nesting_level = 1;
-
- while (nesting_level)
- {
- unsigned int abbrev_number, bytes_read, i;
- struct abbrev_info *abbrev;
- struct attribute attr;
- struct funcinfo *func;
- char* name = 0;
-
- abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
- info_ptr += bytes_read;
-
- if (! abbrev_number)
- {
- nesting_level--;
- continue;
- }
-
- abbrev = lookup_abbrev (abbrev_number,unit->abbrevs);
- if (! abbrev)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."),
- abbrev_number);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (abbrev->tag == DW_TAG_subprogram)
- {
- bfd_size_type amt = sizeof (struct funcinfo);
- func = bfd_zalloc (abfd, amt);
- func->prev_func = unit->function_table;
- unit->function_table = func;
- }
- else
- func = NULL;
-
- for (i = 0; i < abbrev->num_attrs; ++i)
- {
- info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
-
- if (func)
- {
- switch (attr.name)
- {
- case DW_AT_name:
-
- name = attr.u.str;
-
- /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */
- if (func->name == NULL)
- func->name = attr.u.str;
- break;
-
- case DW_AT_MIPS_linkage_name:
- func->name = attr.u.str;
- break;
-
- case DW_AT_low_pc:
- func->low = attr.u.val;
- break;
-
- case DW_AT_high_pc:
- func->high = attr.u.val;
- break;
-
- default:
- break;
- }
- }
- else
- {
- switch (attr.name)
- {
- case DW_AT_name:
- name = attr.u.str;
- break;
-
- default:
- break;
- }
- }
- }
-
- if (abbrev->has_children)
- nesting_level++;
- }
-
- return TRUE;
-}
-
-/* Parse a DWARF2 compilation unit starting at INFO_PTR. This
- includes the compilation unit header that proceeds the DIE's, but
- does not include the length field that precedes each compilation
- unit header. END_PTR points one past the end of this comp unit.
- OFFSET_SIZE is the size of DWARF2 offsets (either 4 or 8 bytes).
-
- This routine does not read the whole compilation unit; only enough
- to get to the line number information for the compilation unit. */
-
-static struct comp_unit *
-parse_comp_unit (bfd *abfd,
- struct dwarf2_debug *stash,
- bfd_vma unit_length,
- unsigned int offset_size)
-{
- struct comp_unit* unit;
- unsigned int version;
- bfd_uint64_t abbrev_offset = 0;
- unsigned int addr_size;
- struct abbrev_info** abbrevs;
- unsigned int abbrev_number, bytes_read, i;
- struct abbrev_info *abbrev;
- struct attribute attr;
- char *info_ptr = stash->info_ptr;
- char *end_ptr = info_ptr + unit_length;
- bfd_size_type amt;
-
- version = read_2_bytes (abfd, info_ptr);
- info_ptr += 2;
- BFD_ASSERT (offset_size == 4 || offset_size == 8);
- if (offset_size == 4)
- abbrev_offset = read_4_bytes (abfd, info_ptr);
- else
- abbrev_offset = read_8_bytes (abfd, info_ptr);
- info_ptr += offset_size;
- addr_size = read_1_byte (abfd, info_ptr);
- info_ptr += 1;
-
- if (version != 2)
- {
- (*_bfd_error_handler) (_("Dwarf Error: found dwarf version '%u', this reader only handles version 2 information."), version);
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- if (addr_size > sizeof (bfd_vma))
- {
- (*_bfd_error_handler) (_("Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'."),
- addr_size,
- (unsigned int) sizeof (bfd_vma));
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- if (addr_size != 2 && addr_size != 4 && addr_size != 8)
- {
- (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '2', '4' and '8'.", addr_size);
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- /* Read the abbrevs for this compilation unit into a table. */
- abbrevs = read_abbrevs (abfd, abbrev_offset, stash);
- if (! abbrevs)
- return 0;
-
- abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
- info_ptr += bytes_read;
- if (! abbrev_number)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Bad abbrev number: %u."),
- abbrev_number);
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- abbrev = lookup_abbrev (abbrev_number, abbrevs);
- if (! abbrev)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."),
- abbrev_number);
- bfd_set_error (bfd_error_bad_value);
- return 0;
- }
-
- amt = sizeof (struct comp_unit);
- unit = bfd_zalloc (abfd, amt);
- unit->abfd = abfd;
- unit->addr_size = addr_size;
- unit->offset_size = offset_size;
- unit->abbrevs = abbrevs;
- unit->end_ptr = end_ptr;
- unit->stash = stash;
-
- for (i = 0; i < abbrev->num_attrs; ++i)
- {
- info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
-
- /* Store the data if it is of an attribute we want to keep in a
- partial symbol table. */
- switch (attr.name)
- {
- case DW_AT_stmt_list:
- unit->stmtlist = 1;
- unit->line_offset = attr.u.val;
- break;
-
- case DW_AT_name:
- unit->name = attr.u.str;
- break;
-
- case DW_AT_low_pc:
- unit->arange.low = attr.u.val;
- break;
-
- case DW_AT_high_pc:
- unit->arange.high = attr.u.val;
- break;
-
- case DW_AT_comp_dir:
- {
- char* comp_dir = attr.u.str;
- if (comp_dir)
- {
- /* Irix 6.2 native cc prepends <machine>.: to the compilation
- directory, get rid of it. */
- char *cp = strchr (comp_dir, ':');
-
- if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/')
- comp_dir = cp + 1;
- }
- unit->comp_dir = comp_dir;
- break;
- }
-
- default:
- break;
- }
- }
-
- unit->first_child_die_ptr = info_ptr;
- return unit;
-}
-
-/* Return TRUE if UNIT contains the address given by ADDR. */
-
-static bfd_boolean
-comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr)
-{
- struct arange *arange;
-
- if (unit->error)
- return FALSE;
-
- arange = &unit->arange;
- do
- {
- if (addr >= arange->low && addr < arange->high)
- return TRUE;
- arange = arange->next;
- }
- while (arange);
-
- return FALSE;
-}
-
-/* If UNIT contains ADDR, set the output parameters to the values for
- the line containing ADDR. The output parameters, FILENAME_PTR,
- FUNCTIONNAME_PTR, and LINENUMBER_PTR, are pointers to the objects
- to be filled in.
-
- Return TRUE if UNIT contains ADDR, and no errors were encountered;
- FALSE otherwise. */
-
-static bfd_boolean
-comp_unit_find_nearest_line (struct comp_unit *unit,
- bfd_vma addr,
- const char **filename_ptr,
- const char **functionname_ptr,
- unsigned int *linenumber_ptr,
- struct dwarf2_debug *stash)
-{
- bfd_boolean line_p;
- bfd_boolean func_p;
- struct funcinfo *function;
-
- if (unit->error)
- return FALSE;
-
- if (! unit->line_table)
- {
- if (! unit->stmtlist)
- {
- unit->error = 1;
- return FALSE;
- }
-
- unit->line_table = decode_line_info (unit, stash);
-
- if (! unit->line_table)
- {
- unit->error = 1;
- return FALSE;
- }
-
- if (unit->first_child_die_ptr < unit->end_ptr
- && ! scan_unit_for_functions (unit))
- {
- unit->error = 1;
- return FALSE;
- }
- }
-
- function = NULL;
- func_p = lookup_address_in_function_table (unit->function_table, addr,
- &function, functionname_ptr);
- line_p = lookup_address_in_line_info_table (unit->line_table, addr,
- function, filename_ptr,
- linenumber_ptr);
- return line_p || func_p;
-}
-
-/* Locate a section in a BFD containing debugging info. The search starts
- from the section after AFTER_SEC, or from the first section in the BFD if
- AFTER_SEC is NULL. The search works by examining the names of the
- sections. There are two permissiable names. The first is .debug_info.
- This is the standard DWARF2 name. The second is a prefix .gnu.linkonce.wi.
- This is a variation on the .debug_info section which has a checksum
- describing the contents appended onto the name. This allows the linker to
- identify and discard duplicate debugging sections for different
- compilation units. */
-#define DWARF2_DEBUG_INFO ".debug_info"
-#define GNU_LINKONCE_INFO ".gnu.linkonce.wi."
-
-static asection *
-find_debug_info (bfd *abfd, asection *after_sec)
-{
- asection * msec;
-
- if (after_sec)
- msec = after_sec->next;
- else
- msec = abfd->sections;
-
- while (msec)
- {
- if (strcmp (msec->name, DWARF2_DEBUG_INFO) == 0)
- return msec;
-
- if (strncmp (msec->name, GNU_LINKONCE_INFO, strlen (GNU_LINKONCE_INFO)) == 0)
- return msec;
-
- msec = msec->next;
- }
-
- return NULL;
-}
-
-/* The DWARF2 version of find_nearest line. Return TRUE if the line
- is found without error. ADDR_SIZE is the number of bytes in the
- initial .debug_info length field and in the abbreviation offset.
- You may use zero to indicate that the default value should be
- used. */
-
-bfd_boolean
-_bfd_dwarf2_find_nearest_line (bfd *abfd,
- asection *section,
- asymbol **symbols,
- bfd_vma offset,
- const char **filename_ptr,
- const char **functionname_ptr,
- unsigned int *linenumber_ptr,
- unsigned int addr_size,
- void **pinfo)
-{
- /* Read each compilation unit from the section .debug_info, and check
- to see if it contains the address we are searching for. If yes,
- lookup the address, and return the line number info. If no, go
- on to the next compilation unit.
-
- We keep a list of all the previously read compilation units, and
- a pointer to the next un-read compilation unit. Check the
- previously read units before reading more. */
- struct dwarf2_debug *stash = *pinfo;
-
- /* What address are we looking for? */
- bfd_vma addr = offset + section->vma;
-
- struct comp_unit* each;
-
- *filename_ptr = NULL;
- *functionname_ptr = NULL;
- *linenumber_ptr = 0;
-
- /* The DWARF2 spec says that the initial length field, and the
- offset of the abbreviation table, should both be 4-byte values.
- However, some compilers do things differently. */
- if (addr_size == 0)
- addr_size = 4;
- BFD_ASSERT (addr_size == 4 || addr_size == 8);
-
- if (! stash)
- {
- bfd_size_type total_size;
- asection *msec;
- bfd_size_type amt = sizeof (struct dwarf2_debug);
-
- stash = bfd_zalloc (abfd, amt);
- if (! stash)
- return FALSE;
-
- *pinfo = stash;
-
- msec = find_debug_info (abfd, NULL);
- if (! msec)
- /* No dwarf2 info. Note that at this point the stash
- has been allocated, but contains zeros, this lets
- future calls to this function fail quicker. */
- return FALSE;
-
- /* There can be more than one DWARF2 info section in a BFD these days.
- Read them all in and produce one large stash. We do this in two
- passes - in the first pass we just accumulate the section sizes.
- In the second pass we read in the section's contents. The allows
- us to avoid reallocing the data as we add sections to the stash. */
- for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
- total_size += msec->_raw_size;
-
- stash->info_ptr = bfd_alloc (abfd, total_size);
- if (stash->info_ptr == NULL)
- return FALSE;
-
- stash->info_ptr_end = stash->info_ptr;
-
- for (msec = find_debug_info (abfd, NULL);
- msec;
- msec = find_debug_info (abfd, msec))
- {
- bfd_size_type size;
- bfd_size_type start;
-
- size = msec->_raw_size;
- if (size == 0)
- continue;
-
- start = stash->info_ptr_end - stash->info_ptr;
-
- if ((bfd_simple_get_relocated_section_contents
- (abfd, msec, stash->info_ptr + start, symbols)) == NULL)
- continue;
-
- stash->info_ptr_end = stash->info_ptr + start + size;
- }
-
- BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);
-
- stash->sec = find_debug_info (abfd, NULL);
- stash->sec_info_ptr = stash->info_ptr;
- stash->syms = symbols;
- }
-
- /* A null info_ptr indicates that there is no dwarf2 info
- (or that an error occured while setting up the stash). */
- if (! stash->info_ptr)
- return FALSE;
-
- /* Check the previously read comp. units first. */
- for (each = stash->all_comp_units; each; each = each->next_unit)
- if (comp_unit_contains_address (each, addr))
- return comp_unit_find_nearest_line (each, addr, filename_ptr,
- functionname_ptr, linenumber_ptr,
- stash);
-
- /* Read each remaining comp. units checking each as they are read. */
- while (stash->info_ptr < stash->info_ptr_end)
- {
- bfd_vma length;
- bfd_boolean found;
- unsigned int offset_size = addr_size;
-
- length = read_4_bytes (abfd, stash->info_ptr);
- /* A 0xffffff length is the DWARF3 way of indicating we use
- 64-bit offsets, instead of 32-bit offsets. */
- if (length == 0xffffffff)
- {
- offset_size = 8;
- length = read_8_bytes (abfd, stash->info_ptr + 4);
- stash->info_ptr += 12;
- }
- /* A zero length is the IRIX way of indicating 64-bit offsets,
- mostly because the 64-bit length will generally fit in 32
- bits, and the endianness helps. */
- else if (length == 0)
- {
- offset_size = 8;
- length = read_4_bytes (abfd, stash->info_ptr + 4);
- stash->info_ptr += 8;
- }
- /* In the absence of the hints above, we assume addr_size-sized
- offsets, for backward-compatibility with pre-DWARF3 64-bit
- platforms. */
- else if (addr_size == 8)
- {
- length = read_8_bytes (abfd, stash->info_ptr);
- stash->info_ptr += 8;
- }
- else
- stash->info_ptr += 4;
-
- if (length > 0)
- {
- each = parse_comp_unit (abfd, stash, length, offset_size);
- stash->info_ptr += length;
-
- if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
- == stash->sec->_raw_size)
- {
- stash->sec = find_debug_info (abfd, stash->sec);
- stash->sec_info_ptr = stash->info_ptr;
- }
-
- if (each)
- {
- each->next_unit = stash->all_comp_units;
- stash->all_comp_units = each;
-
- /* DW_AT_low_pc and DW_AT_high_pc are optional for
- compilation units. If we don't have them (i.e.,
- unit->high == 0), we need to consult the line info
- table to see if a compilation unit contains the given
- address. */
- if (each->arange.high > 0)
- {
- if (comp_unit_contains_address (each, addr))
- return comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash);
- }
- else
- {
- found = comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash);
- if (found)
- return TRUE;
- }
- }
- }
- }
-
- return FALSE;
-}
diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c
deleted file mode 100644
index cfc5ae1..0000000
--- a/contrib/binutils/bfd/ecoff.c
+++ /dev/null
@@ -1,4846 +0,0 @@
-/* Generic ECOFF (Extended-COFF) routines.
- Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
- Original version by Per Bothner.
- Full support added by Ian Lance Taylor, ian@cygnus.com.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "aout/ar.h"
-#include "aout/ranlib.h"
-#include "aout/stab_gnu.h"
-
-/* FIXME: We need the definitions of N_SET[ADTB], but aout64.h defines
- some other stuff which we don't want and which conflicts with stuff
- we do want. */
-#include "libaout.h"
-#include "aout/aout64.h"
-#undef N_ABS
-#undef exec_hdr
-#undef obj_sym_filepos
-
-#include "coff/internal.h"
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/ecoff.h"
-#include "libcoff.h"
-#include "libecoff.h"
-
-/* Prototypes for static functions. */
-
-static int ecoff_get_magic
- PARAMS ((bfd *));
-static long ecoff_sec_to_styp_flags
- PARAMS ((const char *, flagword));
-static bfd_boolean ecoff_slurp_symbolic_header
- PARAMS ((bfd *));
-static bfd_boolean ecoff_set_symbol_info
- PARAMS ((bfd *, SYMR *, asymbol *, int, int));
-static void ecoff_emit_aggregate
- PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *));
-static char *ecoff_type_to_string
- PARAMS ((bfd *, FDR *, unsigned int));
-static bfd_boolean ecoff_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **));
-static int ecoff_sort_hdrs
- PARAMS ((const PTR, const PTR));
-static bfd_boolean ecoff_compute_section_file_positions
- PARAMS ((bfd *));
-static bfd_size_type ecoff_compute_reloc_file_positions
- PARAMS ((bfd *));
-static bfd_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 *, unsigned int *, unsigned int, unsigned int));
-
-/* This stuff is somewhat copied from coffcode.h. */
-
-static asection bfd_debug_section =
-{
- /* name, id, index, next, flags, user_set_vma, reloc_done, */
- "*DEBUG*", 0, 0, NULL, 0, 0, 0,
- /* linker_mark, linker_has_input, gc_mark, segment_mark, */
- 0, 0, 0, 0,
- /* sec_info_type, use_rela_p, has_tls_reloc, */
- 0, 0, 0,
- /* need_finalize_relax, has_gp_reloc, */
- 0, 0,
- /* flag13, flag14, flag15, flag16, flag20, flag24, */
- 0, 0, 0, 0, 0, 0,
- /* vma, lma, _cooked_size, _raw_size, */
- 0, 0, 0, 0,
- /* output_offset, output_section, alignment_power, */
- 0, NULL, 0,
- /* relocation, orelocation, reloc_count, filepos, rel_filepos, */
- NULL, NULL, 0, 0, 0,
- /* line_filepos, userdata, contents, lineno, lineno_count, */
- 0, NULL, NULL, NULL, 0,
- /* entsize, comdat, kept_section, moving_line_filepos, */
- 0, NULL, NULL, 0,
- /* target_index, used_by_bfd, constructor_chain, owner, */
- 0, NULL, NULL, NULL,
- /* symbol, */
- (struct bfd_symbol *) NULL,
- /* symbol_ptr_ptr, */
- (struct bfd_symbol **) NULL,
- /* link_order_head, link_order_tail */
- NULL, NULL
-};
-
-/* Create an ECOFF object. */
-
-bfd_boolean
-_bfd_ecoff_mkobject (abfd)
- bfd *abfd;
-{
- 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;
-
- return TRUE;
-}
-
-/* This is a hook called by coff_real_object_p to create any backend
- specific information. */
-
-PTR
-_bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
- bfd *abfd;
- PTR filehdr;
- PTR aouthdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
- struct internal_aouthdr *internal_a = (struct internal_aouthdr *) aouthdr;
- ecoff_data_type *ecoff;
-
- if (! _bfd_ecoff_mkobject (abfd))
- return NULL;
-
- ecoff = ecoff_data (abfd);
- ecoff->gp_size = 8;
- ecoff->sym_filepos = internal_f->f_symptr;
-
- if (internal_a != (struct internal_aouthdr *) NULL)
- {
- int i;
-
- ecoff->text_start = internal_a->text_start;
- ecoff->text_end = internal_a->text_start + internal_a->tsize;
- ecoff->gp = internal_a->gp_value;
- ecoff->gprmask = internal_a->gprmask;
- for (i = 0; i < 4; i++)
- ecoff->cprmask[i] = internal_a->cprmask[i];
- ecoff->fprmask = internal_a->fprmask;
- if (internal_a->magic == ECOFF_AOUT_ZMAGIC)
- abfd->flags |= D_PAGED;
- else
- abfd->flags &=~ D_PAGED;
- }
-
- /* It turns out that no special action is required by the MIPS or
- Alpha ECOFF backends. They have different information in the
- a.out header, but we just copy it all (e.g., gprmask, cprmask and
- fprmask) and let the swapping routines ensure that only relevant
- information is written out. */
-
- return (PTR) ecoff;
-}
-
-/* Initialize a new section. */
-
-bfd_boolean
-_bfd_ecoff_new_section_hook (abfd, section)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section;
-{
- section->alignment_power = 4;
-
- if (strcmp (section->name, _TEXT) == 0
- || strcmp (section->name, _INIT) == 0
- || strcmp (section->name, _FINI) == 0)
- section->flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC;
- else if (strcmp (section->name, _DATA) == 0
- || strcmp (section->name, _SDATA) == 0)
- section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC;
- else if (strcmp (section->name, _RDATA) == 0
- || strcmp (section->name, _LIT8) == 0
- || strcmp (section->name, _LIT4) == 0
- || strcmp (section->name, _RCONST) == 0
- || strcmp (section->name, _PDATA) == 0)
- section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
- else if (strcmp (section->name, _BSS) == 0
- || strcmp (section->name, _SBSS) == 0)
- section->flags |= SEC_ALLOC;
- else if (strcmp (section->name, _LIB) == 0)
- /* An Irix 4 shared libary. */
- section->flags |= SEC_COFF_SHARED_LIBRARY;
-
- /* Probably any other section name is SEC_NEVER_LOAD, but I'm
- uncertain about .init on some systems and I don't know how shared
- libraries work. */
-
- return TRUE;
-}
-
-/* Determine the machine architecture and type. This is called from
- the generic COFF routines. It is the inverse of ecoff_get_magic,
- below. This could be an ECOFF backend routine, with one version
- for each target, but there aren't all that many ECOFF targets. */
-
-bfd_boolean
-_bfd_ecoff_set_arch_mach_hook (abfd, filehdr)
- bfd *abfd;
- PTR filehdr;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
- enum bfd_architecture arch;
- unsigned long mach;
-
- switch (internal_f->f_magic)
- {
- case MIPS_MAGIC_1:
- case MIPS_MAGIC_LITTLE:
- case MIPS_MAGIC_BIG:
- arch = bfd_arch_mips;
- mach = bfd_mach_mips3000;
- break;
-
- case MIPS_MAGIC_LITTLE2:
- case MIPS_MAGIC_BIG2:
- /* MIPS ISA level 2: the r6000. */
- arch = bfd_arch_mips;
- mach = bfd_mach_mips6000;
- break;
-
- case MIPS_MAGIC_LITTLE3:
- case MIPS_MAGIC_BIG3:
- /* MIPS ISA level 3: the r4000. */
- arch = bfd_arch_mips;
- mach = bfd_mach_mips4000;
- break;
-
- case ALPHA_MAGIC:
- arch = bfd_arch_alpha;
- mach = 0;
- break;
-
- default:
- arch = bfd_arch_obscure;
- mach = 0;
- break;
- }
-
- return bfd_default_set_arch_mach (abfd, arch, mach);
-}
-
-/* Get the magic number to use based on the architecture and machine.
- This is the inverse of _bfd_ecoff_set_arch_mach_hook, above. */
-
-static int
-ecoff_get_magic (abfd)
- bfd *abfd;
-{
- int big, little;
-
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_mips:
- switch (bfd_get_mach (abfd))
- {
- default:
- case 0:
- case bfd_mach_mips3000:
- big = MIPS_MAGIC_BIG;
- little = MIPS_MAGIC_LITTLE;
- break;
-
- case bfd_mach_mips6000:
- big = MIPS_MAGIC_BIG2;
- little = MIPS_MAGIC_LITTLE2;
- break;
-
- case bfd_mach_mips4000:
- big = MIPS_MAGIC_BIG3;
- little = MIPS_MAGIC_LITTLE3;
- break;
- }
-
- return bfd_big_endian (abfd) ? big : little;
-
- case bfd_arch_alpha:
- return ALPHA_MAGIC;
-
- default:
- abort ();
- return 0;
- }
-}
-
-/* Get the section s_flags to use for a section. */
-
-static long
-ecoff_sec_to_styp_flags (name, flags)
- const char *name;
- flagword flags;
-{
- long styp;
-
- styp = 0;
-
- if (strcmp (name, _TEXT) == 0)
- styp = STYP_TEXT;
- else if (strcmp (name, _DATA) == 0)
- styp = STYP_DATA;
- else if (strcmp (name, _SDATA) == 0)
- styp = STYP_SDATA;
- else if (strcmp (name, _RDATA) == 0)
- styp = STYP_RDATA;
- else if (strcmp (name, _LITA) == 0)
- styp = STYP_LITA;
- else if (strcmp (name, _LIT8) == 0)
- styp = STYP_LIT8;
- else if (strcmp (name, _LIT4) == 0)
- styp = STYP_LIT4;
- else if (strcmp (name, _BSS) == 0)
- styp = STYP_BSS;
- else if (strcmp (name, _SBSS) == 0)
- styp = STYP_SBSS;
- else if (strcmp (name, _INIT) == 0)
- styp = STYP_ECOFF_INIT;
- else if (strcmp (name, _FINI) == 0)
- styp = STYP_ECOFF_FINI;
- else if (strcmp (name, _PDATA) == 0)
- styp = STYP_PDATA;
- else if (strcmp (name, _XDATA) == 0)
- styp = STYP_XDATA;
- else if (strcmp (name, _LIB) == 0)
- styp = STYP_ECOFF_LIB;
- else if (strcmp (name, _GOT) == 0)
- styp = STYP_GOT;
- else if (strcmp (name, _HASH) == 0)
- styp = STYP_HASH;
- else if (strcmp (name, _DYNAMIC) == 0)
- styp = STYP_DYNAMIC;
- else if (strcmp (name, _LIBLIST) == 0)
- styp = STYP_LIBLIST;
- else if (strcmp (name, _RELDYN) == 0)
- styp = STYP_RELDYN;
- else if (strcmp (name, _CONFLIC) == 0)
- styp = STYP_CONFLIC;
- else if (strcmp (name, _DYNSTR) == 0)
- styp = STYP_DYNSTR;
- else if (strcmp (name, _DYNSYM) == 0)
- styp = STYP_DYNSYM;
- else if (strcmp (name, _COMMENT) == 0)
- {
- styp = STYP_COMMENT;
- flags &=~ SEC_NEVER_LOAD;
- }
- else if (strcmp (name, _RCONST) == 0)
- styp = STYP_RCONST;
- else if (flags & SEC_CODE)
- styp = STYP_TEXT;
- else if (flags & SEC_DATA)
- styp = STYP_DATA;
- else if (flags & SEC_READONLY)
- styp = STYP_RDATA;
- else if (flags & SEC_LOAD)
- styp = STYP_REG;
- else
- styp = STYP_BSS;
-
- if (flags & SEC_NEVER_LOAD)
- styp |= STYP_NOLOAD;
-
- return styp;
-}
-
-/* Get the BFD flags to use for a section. */
-
-bfd_boolean
-_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR hdr;
- const char *name ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- flagword * flags_ptr;
-{
- struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
- long styp_flags = internal_s->s_flags;
- flagword sec_flags = 0;
-
- if (styp_flags & STYP_NOLOAD)
- sec_flags |= SEC_NEVER_LOAD;
-
- /* For 386 COFF, at least, an unloadable text or data section is
- actually a shared library section. */
- if ((styp_flags & STYP_TEXT)
- || (styp_flags & STYP_ECOFF_INIT)
- || (styp_flags & STYP_ECOFF_FINI)
- || (styp_flags & STYP_DYNAMIC)
- || (styp_flags & STYP_LIBLIST)
- || (styp_flags & STYP_RELDYN)
- || styp_flags == STYP_CONFLIC
- || (styp_flags & STYP_DYNSTR)
- || (styp_flags & STYP_DYNSYM)
- || (styp_flags & STYP_HASH))
- {
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY;
- else
- sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC;
- }
- else if ((styp_flags & STYP_DATA)
- || (styp_flags & STYP_RDATA)
- || (styp_flags & STYP_SDATA)
- || styp_flags == STYP_PDATA
- || styp_flags == STYP_XDATA
- || (styp_flags & STYP_GOT)
- || styp_flags == STYP_RCONST)
- {
- if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY;
- else
- sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC;
- if ((styp_flags & STYP_RDATA)
- || styp_flags == STYP_PDATA
- || styp_flags == STYP_RCONST)
- sec_flags |= SEC_READONLY;
- }
- else if ((styp_flags & STYP_BSS)
- || (styp_flags & STYP_SBSS))
- sec_flags |= SEC_ALLOC;
- else if ((styp_flags & STYP_INFO) || styp_flags == STYP_COMMENT)
- sec_flags |= SEC_NEVER_LOAD;
- else if ((styp_flags & STYP_LITA)
- || (styp_flags & STYP_LIT8)
- || (styp_flags & STYP_LIT4))
- sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
- else if (styp_flags & STYP_ECOFF_LIB)
- sec_flags |= SEC_COFF_SHARED_LIBRARY;
- else
- sec_flags |= SEC_ALLOC | SEC_LOAD;
-
- * flags_ptr = sec_flags;
- return TRUE;
-}
-
-/* Read in the symbolic header for an ECOFF object file. */
-
-static bfd_boolean
-ecoff_slurp_symbolic_header (abfd)
- bfd *abfd;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- bfd_size_type external_hdr_size;
- PTR raw = NULL;
- HDRR *internal_symhdr;
-
- /* See if we've already read it in. */
- if (ecoff_data (abfd)->debug_info.symbolic_header.magic ==
- backend->debug_swap.sym_magic)
- return TRUE;
-
- /* See whether there is a symbolic header. */
- if (ecoff_data (abfd)->sym_filepos == 0)
- {
- bfd_get_symcount (abfd) = 0;
- return TRUE;
- }
-
- /* At this point bfd_get_symcount (abfd) holds the number of symbols
- as read from the file header, but on ECOFF this is always the
- size of the symbolic information header. It would be cleaner to
- handle this when we first read the file in coffgen.c. */
- external_hdr_size = backend->debug_swap.external_hdr_size;
- if (bfd_get_symcount (abfd) != external_hdr_size)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- /* Read the symbolic information header. */
- raw = (PTR) bfd_malloc (external_hdr_size);
- if (raw == NULL)
- goto error_return;
-
- 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);
-
- if (internal_symhdr->magic != backend->debug_swap.sym_magic)
- {
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- /* Now we can get the correct number of symbols. */
- bfd_get_symcount (abfd) = (internal_symhdr->isymMax
- + internal_symhdr->iextMax);
-
- if (raw != NULL)
- free (raw);
- return TRUE;
- error_return:
- if (raw != NULL)
- free (raw);
- return FALSE;
-}
-
-/* Read in and swap the important symbolic information for an ECOFF
- object file. This is called by gdb via the read_debug_info entry
- point in the backend structure. */
-
-bfd_boolean
-_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
- bfd *abfd;
- asection *ignore ATTRIBUTE_UNUSED;
- struct ecoff_debug_info *debug;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- HDRR *internal_symhdr;
- bfd_size_type raw_base;
- bfd_size_type raw_size;
- PTR raw;
- bfd_size_type external_fdr_size;
- char *fraw_src;
- char *fraw_end;
- 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);
-
- /* Check whether we've already gotten it, and whether there's any to
- get. */
- if (ecoff_data (abfd)->raw_syments != (PTR) NULL)
- return TRUE;
- if (ecoff_data (abfd)->sym_filepos == 0)
- {
- bfd_get_symcount (abfd) = 0;
- return TRUE;
- }
-
- if (! ecoff_slurp_symbolic_header (abfd))
- return FALSE;
-
- internal_symhdr = &debug->symbolic_header;
-
- /* Read all the symbolic information at once. */
- raw_base = (ecoff_data (abfd)->sym_filepos
- + backend->debug_swap.external_hdr_size);
-
- /* Alpha ecoff makes the determination of raw_size difficult. It has
- an undocumented debug data section between the symhdr and the first
- documented section. And the ordering of the sections varies between
- statically and dynamically linked executables.
- If bfd supports SEEK_END someday, this code could be simplified. */
- raw_end = 0;
-
-#define UPDATE_RAW_END(start, count, size) \
- cb_end = internal_symhdr->start + internal_symhdr->count * (size); \
- if (cb_end > raw_end) \
- raw_end = cb_end
-
- UPDATE_RAW_END (cbLineOffset, cbLine, sizeof (unsigned char));
- UPDATE_RAW_END (cbDnOffset, idnMax, backend->debug_swap.external_dnr_size);
- UPDATE_RAW_END (cbPdOffset, ipdMax, backend->debug_swap.external_pdr_size);
- UPDATE_RAW_END (cbSymOffset, isymMax, backend->debug_swap.external_sym_size);
- /* eraxxon@alumni.rice.edu: ioptMax refers to the size of the
- optimization symtab, not the number of entries */
- UPDATE_RAW_END (cbOptOffset, ioptMax, sizeof (char));
- UPDATE_RAW_END (cbAuxOffset, iauxMax, sizeof (union aux_ext));
- UPDATE_RAW_END (cbSsOffset, issMax, sizeof (char));
- UPDATE_RAW_END (cbSsExtOffset, issExtMax, sizeof (char));
- UPDATE_RAW_END (cbFdOffset, ifdMax, backend->debug_swap.external_fdr_size);
- UPDATE_RAW_END (cbRfdOffset, crfd, backend->debug_swap.external_rfd_size);
- UPDATE_RAW_END (cbExtOffset, iextMax, backend->debug_swap.external_ext_size);
-
-#undef UPDATE_RAW_END
-
- raw_size = raw_end - raw_base;
- if (raw_size == 0)
- {
- ecoff_data (abfd)->sym_filepos = 0;
- return TRUE;
- }
- raw = (PTR) bfd_alloc (abfd, raw_size);
- if (raw == NULL)
- return FALSE;
-
- 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;
- }
-
- ecoff_data (abfd)->raw_syments = raw;
-
- /* Get pointers for the numeric offsets in the HDRR structure. */
-#define FIX(off1, off2, type) \
- if (internal_symhdr->off1 == 0) \
- debug->off2 = (type) NULL; \
- else \
- debug->off2 = (type) ((char *) raw \
- + (internal_symhdr->off1 \
- - raw_base))
-
- FIX (cbLineOffset, line, unsigned char *);
- FIX (cbDnOffset, external_dnr, PTR);
- FIX (cbPdOffset, external_pdr, PTR);
- FIX (cbSymOffset, external_sym, PTR);
- FIX (cbOptOffset, external_opt, PTR);
- FIX (cbAuxOffset, external_aux, union aux_ext *);
- FIX (cbSsOffset, ss, char *);
- FIX (cbSsExtOffset, ssext, char *);
- FIX (cbFdOffset, external_fdr, PTR);
- FIX (cbRfdOffset, external_rfd, PTR);
- FIX (cbExtOffset, external_ext, PTR);
-#undef FIX
-
- /* I don't want to always swap all the data, because it will just
- waste time and most programs will never look at it. The only
- time the linker needs most of the debugging information swapped
- is when linking big-endian and little-endian MIPS object files
- together, which is not a common occurrence.
-
- We need to look at the fdr to deal with a lot of information in
- the symbols, so we swap them here. */
- 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;
- fdr_ptr = debug->fdr;
- fraw_src = (char *) debug->external_fdr;
- fraw_end = fraw_src + internal_symhdr->ifdMax * external_fdr_size;
- for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++)
- (*backend->debug_swap.swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr);
-
- return TRUE;
-}
-
-/* ECOFF symbol table routines. The ECOFF symbol table is described
- in gcc/mips-tfile.c. */
-
-/* ECOFF uses two common sections. One is the usual one, and the
- other is for small objects. All the small objects are kept
- together, and then referenced via the gp pointer, which yields
- faster assembler code. This is what we use for the small common
- section. */
-static asection ecoff_scom_section;
-static asymbol ecoff_scom_symbol;
-static asymbol *ecoff_scom_symbol_ptr;
-
-/* Create an empty symbol. */
-
-asymbol *
-_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_zalloc (abfd, amt);
- if (new == (ecoff_symbol_type *) NULL)
- return (asymbol *) NULL;
- new->symbol.section = (asection *) NULL;
- new->fdr = (FDR *) NULL;
- new->local = FALSE;
- new->native = NULL;
- new->symbol.the_bfd = abfd;
- return &new->symbol;
-}
-
-/* Set the BFD flags and section for an ECOFF symbol. */
-
-static bfd_boolean
-ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
- bfd *abfd;
- SYMR *ecoff_sym;
- asymbol *asym;
- int ext;
- int weak;
-{
- asym->the_bfd = abfd;
- asym->value = ecoff_sym->value;
- asym->section = &bfd_debug_section;
- asym->udata.i = 0;
-
- /* Most symbol types are just for debugging. */
- switch (ecoff_sym->st)
- {
- case stGlobal:
- case stStatic:
- case stLabel:
- case stProc:
- case stStaticProc:
- break;
- case stNil:
- if (ECOFF_IS_STAB (ecoff_sym))
- {
- asym->flags = BSF_DEBUGGING;
- return TRUE;
- }
- break;
- default:
- asym->flags = BSF_DEBUGGING;
- return TRUE;
- }
-
- if (weak)
- asym->flags = BSF_EXPORT | BSF_WEAK;
- else if (ext)
- asym->flags = BSF_EXPORT | BSF_GLOBAL;
- else
- {
- asym->flags = BSF_LOCAL;
- /* Normally, a local stProc symbol will have a corresponding
- external symbol. We mark the local symbol as a debugging
- symbol, in order to prevent nm from printing both out.
- Similarly, we mark stLabel and stabs symbols as debugging
- symbols. In both cases, we do want to set the value
- correctly based on the symbol class. */
- if (ecoff_sym->st == stProc
- || ecoff_sym->st == stLabel
- || ECOFF_IS_STAB (ecoff_sym))
- asym->flags |= BSF_DEBUGGING;
- }
-
- if (ecoff_sym->st == stProc || ecoff_sym->st == stStaticProc)
- asym->flags |= BSF_FUNCTION;
-
- switch (ecoff_sym->sc)
- {
- case scNil:
- /* Used for compiler generated labels. Leave them in the
- debugging section, and mark them as local. If BSF_DEBUGGING
- is set, then nm does not display them for some reason. If no
- flags are set then the linker whines about them. */
- asym->flags = BSF_LOCAL;
- break;
- case scText:
- asym->section = bfd_make_section_old_way (abfd, ".text");
- asym->value -= asym->section->vma;
- break;
- case scData:
- asym->section = bfd_make_section_old_way (abfd, ".data");
- asym->value -= asym->section->vma;
- break;
- case scBss:
- asym->section = bfd_make_section_old_way (abfd, ".bss");
- asym->value -= asym->section->vma;
- break;
- case scRegister:
- asym->flags = BSF_DEBUGGING;
- break;
- case scAbs:
- asym->section = bfd_abs_section_ptr;
- break;
- case scUndefined:
- asym->section = bfd_und_section_ptr;
- asym->flags = 0;
- asym->value = 0;
- break;
- case scCdbLocal:
- case scBits:
- case scCdbSystem:
- case scRegImage:
- case scInfo:
- case scUserStruct:
- asym->flags = BSF_DEBUGGING;
- break;
- case scSData:
- asym->section = bfd_make_section_old_way (abfd, ".sdata");
- asym->value -= asym->section->vma;
- break;
- case scSBss:
- asym->section = bfd_make_section_old_way (abfd, ".sbss");
- asym->value -= asym->section->vma;
- break;
- case scRData:
- asym->section = bfd_make_section_old_way (abfd, ".rdata");
- asym->value -= asym->section->vma;
- break;
- case scVar:
- asym->flags = BSF_DEBUGGING;
- break;
- case scCommon:
- if (asym->value > ecoff_data (abfd)->gp_size)
- {
- asym->section = bfd_com_section_ptr;
- asym->flags = 0;
- break;
- }
- /* Fall through. */
- case scSCommon:
- if (ecoff_scom_section.name == NULL)
- {
- /* Initialize the small common section. */
- ecoff_scom_section.name = SCOMMON;
- ecoff_scom_section.flags = SEC_IS_COMMON;
- ecoff_scom_section.output_section = &ecoff_scom_section;
- ecoff_scom_section.symbol = &ecoff_scom_symbol;
- ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr;
- ecoff_scom_symbol.name = SCOMMON;
- ecoff_scom_symbol.flags = BSF_SECTION_SYM;
- ecoff_scom_symbol.section = &ecoff_scom_section;
- ecoff_scom_symbol_ptr = &ecoff_scom_symbol;
- }
- asym->section = &ecoff_scom_section;
- asym->flags = 0;
- break;
- case scVarRegister:
- case scVariant:
- asym->flags = BSF_DEBUGGING;
- break;
- case scSUndefined:
- asym->section = bfd_und_section_ptr;
- asym->flags = 0;
- asym->value = 0;
- break;
- case scInit:
- asym->section = bfd_make_section_old_way (abfd, ".init");
- asym->value -= asym->section->vma;
- break;
- case scBasedVar:
- case scXData:
- case scPData:
- asym->flags = BSF_DEBUGGING;
- break;
- case scFini:
- asym->section = bfd_make_section_old_way (abfd, ".fini");
- asym->value -= asym->section->vma;
- break;
- case scRConst:
- asym->section = bfd_make_section_old_way (abfd, ".rconst");
- asym->value -= asym->section->vma;
- break;
- default:
- break;
- }
-
- /* Look for special constructors symbols and make relocation entries
- in a special construction section. These are produced by the
- -fgnu-linker argument to g++. */
- if (ECOFF_IS_STAB (ecoff_sym))
- {
- switch (ECOFF_UNMARK_STAB (ecoff_sym->index))
- {
- default:
- break;
-
- case N_SETA:
- case N_SETT:
- case N_SETD:
- case N_SETB:
- {
- /* This code is no longer needed. It used to be used to
- make the linker handle set symbols, but they are now
- handled in the add_symbols routine instead. */
-#if 0
- const char *name;
- 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
- name ___CTOR_LIST (three underscores). We need
- __CTOR_LIST (two underscores), since ECOFF doesn't use
- a leading underscore. This should be handled by gcc,
- but instead we do it here. Actually, this should all
- be done differently anyhow. */
- name = bfd_asymbol_name (asym);
- if (name[0] == '_' && name[1] == '_' && name[2] == '_')
- {
- ++name;
- asym->name = name;
- }
- section = bfd_get_section_by_name (abfd, name);
- if (section == (asection *) NULL)
- {
- char *copy;
-
- amt = strlen (name) + 1;
- copy = (char *) bfd_alloc (abfd, amt);
- if (!copy)
- return FALSE;
- strcpy (copy, name);
- section = bfd_make_section (abfd, copy);
- }
-
- /* Build a reloc pointing to this constructor. */
- amt = sizeof (arelent_chain);
- reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt);
- if (!reloc_chain)
- return FALSE;
- reloc_chain->relent.sym_ptr_ptr =
- bfd_get_section (asym)->symbol_ptr_ptr;
- reloc_chain->relent.address = section->_raw_size;
- reloc_chain->relent.addend = asym->value;
- reloc_chain->relent.howto =
- ecoff_backend (abfd)->constructor_reloc;
-
- /* Set up the constructor section to hold the reloc. */
- section->flags = SEC_CONSTRUCTOR;
- ++section->reloc_count;
-
- /* Constructor sections must be rounded to a boundary
- based on the bitsize. These are not real sections--
- they are handled specially by the linker--so the ECOFF
- 16 byte alignment restriction does not apply. */
- bitsize = ecoff_backend (abfd)->constructor_bitsize;
- section->alignment_power = 1;
- while ((1 << section->alignment_power) < bitsize / 8)
- ++section->alignment_power;
-
- reloc_chain->next = section->constructor_chain;
- section->constructor_chain = reloc_chain;
- section->_raw_size += bitsize / 8;
-
-#endif /* 0 */
-
- /* Mark the symbol as a constructor. */
- asym->flags |= BSF_CONSTRUCTOR;
- }
- break;
- }
- }
- return TRUE;
-}
-
-/* Read an ECOFF symbol table. */
-
-bfd_boolean
-_bfd_ecoff_slurp_symbol_table (abfd)
- bfd *abfd;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- const bfd_size_type external_ext_size
- = backend->debug_swap.external_ext_size;
- const bfd_size_type external_sym_size
- = backend->debug_swap.external_sym_size;
- void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *))
- = backend->debug_swap.swap_ext_in;
- void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *))
- = backend->debug_swap.swap_sym_in;
- bfd_size_type internal_size;
- ecoff_symbol_type *internal;
- ecoff_symbol_type *internal_ptr;
- char *eraw_src;
- char *eraw_end;
- FDR *fdr_ptr;
- FDR *fdr_end;
-
- /* If we've already read in the symbol table, do nothing. */
- if (ecoff_data (abfd)->canonical_symbols != NULL)
- return TRUE;
-
- /* Get the symbolic information. */
- if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
- &ecoff_data (abfd)->debug_info))
- return FALSE;
- if (bfd_get_symcount (abfd) == 0)
- return TRUE;
-
- 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;
-
- internal_ptr = internal;
- eraw_src = (char *) ecoff_data (abfd)->debug_info.external_ext;
- eraw_end = (eraw_src
- + (ecoff_data (abfd)->debug_info.symbolic_header.iextMax
- * external_ext_size));
- for (; eraw_src < eraw_end; eraw_src += external_ext_size, internal_ptr++)
- {
- EXTR internal_esym;
-
- (*swap_ext_in) (abfd, (PTR) eraw_src, &internal_esym);
- internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ssext
- + internal_esym.asym.iss);
- if (!ecoff_set_symbol_info (abfd, &internal_esym.asym,
- &internal_ptr->symbol, 1,
- internal_esym.weakext))
- return FALSE;
- /* The alpha uses a negative ifd field for section symbols. */
- if (internal_esym.ifd >= 0)
- internal_ptr->fdr = (ecoff_data (abfd)->debug_info.fdr
- + internal_esym.ifd);
- else
- internal_ptr->fdr = NULL;
- internal_ptr->local = FALSE;
- internal_ptr->native = (PTR) eraw_src;
- }
-
- /* The local symbols must be accessed via the fdr's, because the
- string and aux indices are relative to the fdr information. */
- fdr_ptr = ecoff_data (abfd)->debug_info.fdr;
- fdr_end = fdr_ptr + ecoff_data (abfd)->debug_info.symbolic_header.ifdMax;
- for (; fdr_ptr < fdr_end; fdr_ptr++)
- {
- char *lraw_src;
- char *lraw_end;
-
- lraw_src = ((char *) ecoff_data (abfd)->debug_info.external_sym
- + fdr_ptr->isymBase * external_sym_size);
- lraw_end = lraw_src + fdr_ptr->csym * external_sym_size;
- for (;
- lraw_src < lraw_end;
- lraw_src += external_sym_size, internal_ptr++)
- {
- SYMR internal_sym;
-
- (*swap_sym_in) (abfd, (PTR) lraw_src, &internal_sym);
- internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ss
- + fdr_ptr->issBase
- + internal_sym.iss);
- if (!ecoff_set_symbol_info (abfd, &internal_sym,
- &internal_ptr->symbol, 0, 0))
- return FALSE;
- internal_ptr->fdr = fdr_ptr;
- internal_ptr->local = TRUE;
- internal_ptr->native = (PTR) lraw_src;
- }
- }
-
- ecoff_data (abfd)->canonical_symbols = internal;
-
- return TRUE;
-}
-
-/* Return the amount of space needed for the canonical symbols. */
-
-long
-_bfd_ecoff_get_symtab_upper_bound (abfd)
- bfd *abfd;
-{
- if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
- &ecoff_data (abfd)->debug_info))
- return -1;
-
- if (bfd_get_symcount (abfd) == 0)
- return 0;
-
- return (bfd_get_symcount (abfd) + 1) * (sizeof (ecoff_symbol_type *));
-}
-
-/* Get the canonical symbols. */
-
-long
-_bfd_ecoff_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
-{
- unsigned int counter = 0;
- ecoff_symbol_type *symbase;
- ecoff_symbol_type **location = (ecoff_symbol_type **) alocation;
-
- if (! _bfd_ecoff_slurp_symbol_table (abfd))
- return -1;
- if (bfd_get_symcount (abfd) == 0)
- return 0;
-
- symbase = ecoff_data (abfd)->canonical_symbols;
- while (counter < bfd_get_symcount (abfd))
- {
- *(location++) = symbase++;
- counter++;
- }
- *location++ = (ecoff_symbol_type *) NULL;
- return bfd_get_symcount (abfd);
-}
-
-/* Turn ECOFF type information into a printable string.
- ecoff_emit_aggregate and ecoff_type_to_string are from
- gcc/mips-tdump.c, with swapping added and used_ptr removed. */
-
-/* Write aggregate information to a string. */
-
-static void
-ecoff_emit_aggregate (abfd, fdr, string, rndx, isym, which)
- bfd *abfd;
- FDR *fdr;
- char *string;
- RNDXR *rndx;
- long isym;
- const char *which;
-{
- const struct ecoff_debug_swap * const debug_swap =
- &ecoff_backend (abfd)->debug_swap;
- struct ecoff_debug_info * const debug_info = &ecoff_data (abfd)->debug_info;
- unsigned int ifd = rndx->rfd;
- unsigned int indx = rndx->index;
- const char *name;
-
- if (ifd == 0xfff)
- ifd = isym;
-
- /* An ifd of -1 is an opaque type. An escaped index of 0 is a
- struct return type of a procedure compiled without -g. */
- if (ifd == 0xffffffff
- || (rndx->rfd == 0xfff && indx == 0))
- name = "<undefined>";
- else if (indx == indexNil)
- name = "<no name>";
- else
- {
- SYMR sym;
-
- if (debug_info->external_rfd == NULL)
- fdr = debug_info->fdr + ifd;
- else
- {
- RFDT rfd;
-
- (*debug_swap->swap_rfd_in) (abfd,
- ((char *) debug_info->external_rfd
- + ((fdr->rfdBase + ifd)
- * debug_swap->external_rfd_size)),
- &rfd);
- fdr = debug_info->fdr + rfd;
- }
-
- indx += fdr->isymBase;
-
- (*debug_swap->swap_sym_in) (abfd,
- ((char *) debug_info->external_sym
- + indx * debug_swap->external_sym_size),
- &sym);
-
- name = debug_info->ss + fdr->issBase + sym.iss;
- }
-
- sprintf (string,
- "%s %s { ifd = %u, index = %lu }",
- which, name, ifd,
- ((long) indx
- + debug_info->symbolic_header.iextMax));
-}
-
-/* Convert the type information to string format. */
-
-static char *
-ecoff_type_to_string (abfd, fdr, indx)
- bfd *abfd;
- FDR *fdr;
- unsigned int indx;
-{
- union aux_ext *aux_ptr;
- int bigendian;
- AUXU u;
- struct qual {
- unsigned int type;
- int low_bound;
- int high_bound;
- int stride;
- } qualifiers[7];
- unsigned int basic_type;
- int i;
- char buffer1[1024];
- static char buffer2[1024];
- char *p1 = buffer1;
- char *p2 = buffer2;
- RNDXR rndx;
-
- aux_ptr = ecoff_data (abfd)->debug_info.external_aux + fdr->iauxBase;
- bigendian = fdr->fBigendian;
-
- for (i = 0; i < 7; i++)
- {
- qualifiers[i].low_bound = 0;
- qualifiers[i].high_bound = 0;
- qualifiers[i].stride = 0;
- }
-
- if (AUX_GET_ISYM (bigendian, &aux_ptr[indx]) == (bfd_vma) -1)
- return "-1 (no type)";
- _bfd_ecoff_swap_tir_in (bigendian, &aux_ptr[indx++].a_ti, &u.ti);
-
- basic_type = u.ti.bt;
- qualifiers[0].type = u.ti.tq0;
- qualifiers[1].type = u.ti.tq1;
- qualifiers[2].type = u.ti.tq2;
- qualifiers[3].type = u.ti.tq3;
- qualifiers[4].type = u.ti.tq4;
- qualifiers[5].type = u.ti.tq5;
- qualifiers[6].type = tqNil;
-
- /* Go get the basic type. */
- switch (basic_type)
- {
- case btNil: /* Undefined. */
- strcpy (p1, "nil");
- break;
-
- case btAdr: /* Address - integer same size as pointer. */
- strcpy (p1, "address");
- break;
-
- case btChar: /* Character. */
- strcpy (p1, "char");
- break;
-
- case btUChar: /* Unsigned character. */
- strcpy (p1, "unsigned char");
- break;
-
- case btShort: /* Short. */
- strcpy (p1, "short");
- break;
-
- case btUShort: /* Unsigned short. */
- strcpy (p1, "unsigned short");
- break;
-
- case btInt: /* Int. */
- strcpy (p1, "int");
- break;
-
- case btUInt: /* Unsigned int. */
- strcpy (p1, "unsigned int");
- break;
-
- case btLong: /* Long. */
- strcpy (p1, "long");
- break;
-
- case btULong: /* Unsigned long. */
- strcpy (p1, "unsigned long");
- break;
-
- case btFloat: /* Float (real). */
- strcpy (p1, "float");
- break;
-
- case btDouble: /* Double (real). */
- strcpy (p1, "double");
- break;
-
- /* Structures add 1-2 aux words:
- 1st word is [ST_RFDESCAPE, offset] pointer to struct def;
- 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
-
- case btStruct: /* Structure (Record). */
- _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
- ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
- (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
- "struct");
- indx++; /* Skip aux words. */
- break;
-
- /* Unions add 1-2 aux words:
- 1st word is [ST_RFDESCAPE, offset] pointer to union def;
- 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
-
- case btUnion: /* Union. */
- _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
- ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
- (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
- "union");
- indx++; /* Skip aux words. */
- break;
-
- /* Enumerations add 1-2 aux words:
- 1st word is [ST_RFDESCAPE, offset] pointer to enum def;
- 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
-
- case btEnum: /* Enumeration. */
- _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
- ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
- (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
- "enum");
- indx++; /* Skip aux words. */
- break;
-
- case btTypedef: /* Defined via a typedef, isymRef points. */
- strcpy (p1, "typedef");
- break;
-
- case btRange: /* Subrange of int. */
- strcpy (p1, "subrange");
- break;
-
- case btSet: /* Pascal sets. */
- strcpy (p1, "set");
- break;
-
- case btComplex: /* Fortran complex. */
- strcpy (p1, "complex");
- break;
-
- case btDComplex: /* Fortran double complex. */
- strcpy (p1, "double complex");
- break;
-
- case btIndirect: /* Forward or unnamed typedef. */
- strcpy (p1, "forward/unamed typedef");
- break;
-
- case btFixedDec: /* Fixed Decimal. */
- strcpy (p1, "fixed decimal");
- break;
-
- case btFloatDec: /* Float Decimal. */
- strcpy (p1, "float decimal");
- break;
-
- case btString: /* Varying Length Character String. */
- strcpy (p1, "string");
- break;
-
- case btBit: /* Aligned Bit String. */
- strcpy (p1, "bit");
- break;
-
- case btPicture: /* Picture. */
- strcpy (p1, "picture");
- break;
-
- case btVoid: /* Void. */
- strcpy (p1, "void");
- break;
-
- default:
- sprintf (p1, _("Unknown basic type %d"), (int) basic_type);
- break;
- }
-
- p1 += strlen (buffer1);
-
- /* If this is a bitfield, get the bitsize. */
- if (u.ti.fBitfield)
- {
- int bitsize;
-
- bitsize = AUX_GET_WIDTH (bigendian, &aux_ptr[indx++]);
- sprintf (p1, " : %d", bitsize);
- p1 += strlen (buffer1);
- }
-
- /* Deal with any qualifiers. */
- if (qualifiers[0].type != tqNil)
- {
- /* Snarf up any array bounds in the correct order. Arrays
- store 5 successive words in the aux. table:
- word 0 RNDXR to type of the bounds (ie, int)
- word 1 Current file descriptor index
- word 2 low bound
- word 3 high bound (or -1 if [])
- word 4 stride size in bits. */
- for (i = 0; i < 7; i++)
- {
- if (qualifiers[i].type == tqArray)
- {
- qualifiers[i].low_bound =
- AUX_GET_DNLOW (bigendian, &aux_ptr[indx+2]);
- qualifiers[i].high_bound =
- AUX_GET_DNHIGH (bigendian, &aux_ptr[indx+3]);
- qualifiers[i].stride =
- AUX_GET_WIDTH (bigendian, &aux_ptr[indx+4]);
- indx += 5;
- }
- }
-
- /* Now print out the qualifiers. */
- for (i = 0; i < 6; i++)
- {
- switch (qualifiers[i].type)
- {
- case tqNil:
- case tqMax:
- break;
-
- case tqPtr:
- strcpy (p2, "ptr to ");
- p2 += sizeof ("ptr to ")-1;
- break;
-
- case tqVol:
- strcpy (p2, "volatile ");
- p2 += sizeof ("volatile ")-1;
- break;
-
- case tqFar:
- strcpy (p2, "far ");
- p2 += sizeof ("far ")-1;
- break;
-
- case tqProc:
- strcpy (p2, "func. ret. ");
- p2 += sizeof ("func. ret. ");
- break;
-
- case tqArray:
- {
- int first_array = i;
- int j;
-
- /* Print array bounds reversed (ie, in the order the C
- programmer writes them). C is such a fun language.... */
- while (i < 5 && qualifiers[i+1].type == tqArray)
- i++;
-
- for (j = i; j >= first_array; j--)
- {
- strcpy (p2, "array [");
- p2 += sizeof ("array [")-1;
- if (qualifiers[j].low_bound != 0)
- sprintf (p2,
- "%ld:%ld {%ld bits}",
- (long) qualifiers[j].low_bound,
- (long) qualifiers[j].high_bound,
- (long) qualifiers[j].stride);
-
- else if (qualifiers[j].high_bound != -1)
- sprintf (p2,
- "%ld {%ld bits}",
- (long) (qualifiers[j].high_bound + 1),
- (long) (qualifiers[j].stride));
-
- else
- sprintf (p2, " {%ld bits}", (long) (qualifiers[j].stride));
-
- p2 += strlen (p2);
- strcpy (p2, "] of ");
- p2 += sizeof ("] of ")-1;
- }
- }
- break;
- }
- }
- }
-
- strcpy (p2, buffer1);
- return buffer2;
-}
-
-/* Return information about ECOFF symbol SYMBOL in RET. */
-
-void
-_bfd_ecoff_get_symbol_info (abfd, symbol, ret)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
-}
-
-/* Return whether this is a local label. */
-
-bfd_boolean
-_bfd_ecoff_bfd_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
-{
- return name[0] == '$';
-}
-
-/* Print information about an ECOFF symbol. */
-
-void
-_bfd_ecoff_print_symbol (abfd, filep, symbol, how)
- bfd *abfd;
- PTR filep;
- asymbol *symbol;
- bfd_print_symbol_type how;
-{
- const struct ecoff_debug_swap * const debug_swap
- = &ecoff_backend (abfd)->debug_swap;
- FILE *file = (FILE *)filep;
-
- switch (how)
- {
- case bfd_print_symbol_name:
- fprintf (file, "%s", symbol->name);
- break;
- case bfd_print_symbol_more:
- if (ecoffsymbol (symbol)->local)
- {
- SYMR ecoff_sym;
-
- (*debug_swap->swap_sym_in) (abfd, ecoffsymbol (symbol)->native,
- &ecoff_sym);
- fprintf (file, "ecoff local ");
- fprintf_vma (file, (bfd_vma) ecoff_sym.value);
- fprintf (file, " %x %x", (unsigned) ecoff_sym.st,
- (unsigned) ecoff_sym.sc);
- }
- else
- {
- EXTR ecoff_ext;
-
- (*debug_swap->swap_ext_in) (abfd, ecoffsymbol (symbol)->native,
- &ecoff_ext);
- fprintf (file, "ecoff extern ");
- fprintf_vma (file, (bfd_vma) ecoff_ext.asym.value);
- fprintf (file, " %x %x", (unsigned) ecoff_ext.asym.st,
- (unsigned) ecoff_ext.asym.sc);
- }
- break;
- case bfd_print_symbol_all:
- /* Print out the symbols in a reasonable way. */
- {
- char type;
- int pos;
- EXTR ecoff_ext;
- char jmptbl;
- char cobol_main;
- char weakext;
-
- if (ecoffsymbol (symbol)->local)
- {
- (*debug_swap->swap_sym_in) (abfd, ecoffsymbol (symbol)->native,
- &ecoff_ext.asym);
- type = 'l';
- pos = ((((char *) ecoffsymbol (symbol)->native
- - (char *) ecoff_data (abfd)->debug_info.external_sym)
- / debug_swap->external_sym_size)
- + ecoff_data (abfd)->debug_info.symbolic_header.iextMax);
- jmptbl = ' ';
- cobol_main = ' ';
- weakext = ' ';
- }
- else
- {
- (*debug_swap->swap_ext_in) (abfd, ecoffsymbol (symbol)->native,
- &ecoff_ext);
- type = 'e';
- pos = (((char *) ecoffsymbol (symbol)->native
- - (char *) ecoff_data (abfd)->debug_info.external_ext)
- / debug_swap->external_ext_size);
- jmptbl = ecoff_ext.jmptbl ? 'j' : ' ';
- cobol_main = ecoff_ext.cobol_main ? 'c' : ' ';
- weakext = ecoff_ext.weakext ? 'w' : ' ';
- }
-
- fprintf (file, "[%3d] %c ",
- pos, type);
- fprintf_vma (file, (bfd_vma) ecoff_ext.asym.value);
- fprintf (file, " st %x sc %x indx %x %c%c%c %s",
- (unsigned) ecoff_ext.asym.st,
- (unsigned) ecoff_ext.asym.sc,
- (unsigned) ecoff_ext.asym.index,
- jmptbl, cobol_main, weakext,
- symbol->name);
-
- if (ecoffsymbol (symbol)->fdr != NULL
- && ecoff_ext.asym.index != indexNil)
- {
- FDR *fdr;
- unsigned int indx;
- int bigendian;
- bfd_size_type sym_base;
- union aux_ext *aux_base;
-
- fdr = ecoffsymbol (symbol)->fdr;
- indx = ecoff_ext.asym.index;
-
- /* sym_base is used to map the fdr relative indices which
- appear in the file to the position number which we are
- using. */
- sym_base = fdr->isymBase;
- if (ecoffsymbol (symbol)->local)
- sym_base +=
- ecoff_data (abfd)->debug_info.symbolic_header.iextMax;
-
- /* aux_base is the start of the aux entries for this file;
- asym.index is an offset from this. */
- aux_base = (ecoff_data (abfd)->debug_info.external_aux
- + fdr->iauxBase);
-
- /* The aux entries are stored in host byte order; the
- order is indicated by a bit in the fdr. */
- bigendian = fdr->fBigendian;
-
- /* This switch is basically from gcc/mips-tdump.c. */
- switch (ecoff_ext.asym.st)
- {
- case stNil:
- case stLabel:
- break;
-
- case stFile:
- case stBlock:
- fprintf (file, _("\n End+1 symbol: %ld"),
- (long) (indx + sym_base));
- break;
-
- case stEnd:
- if (ecoff_ext.asym.sc == scText
- || ecoff_ext.asym.sc == scInfo)
- fprintf (file, _("\n First symbol: %ld"),
- (long) (indx + sym_base));
- else
- fprintf (file, _("\n First symbol: %ld"),
- ((long)
- (AUX_GET_ISYM (bigendian,
- &aux_base[ecoff_ext.asym.index])
- + sym_base)));
- break;
-
- case stProc:
- case stStaticProc:
- if (ECOFF_IS_STAB (&ecoff_ext.asym))
- ;
- else if (ecoffsymbol (symbol)->local)
- fprintf (file, _("\n End+1 symbol: %-7ld Type: %s"),
- ((long)
- (AUX_GET_ISYM (bigendian,
- &aux_base[ecoff_ext.asym.index])
- + sym_base)),
- ecoff_type_to_string (abfd, fdr, indx + 1));
- else
- fprintf (file, _("\n Local symbol: %ld"),
- ((long) indx
- + (long) sym_base
- + (ecoff_data (abfd)
- ->debug_info.symbolic_header.iextMax)));
- break;
-
- case stStruct:
- fprintf (file, _("\n struct; End+1 symbol: %ld"),
- (long) (indx + sym_base));
- break;
-
- case stUnion:
- fprintf (file, _("\n union; End+1 symbol: %ld"),
- (long) (indx + sym_base));
- break;
-
- case stEnum:
- fprintf (file, _("\n enum; End+1 symbol: %ld"),
- (long) (indx + sym_base));
- break;
-
- default:
- if (! ECOFF_IS_STAB (&ecoff_ext.asym))
- fprintf (file, _("\n Type: %s"),
- ecoff_type_to_string (abfd, fdr, indx));
- break;
- }
- }
- }
- break;
- }
-}
-
-/* Read in the relocs for a section. */
-
-static bfd_boolean
-ecoff_slurp_reloc_table (abfd, section, symbols)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- arelent *internal_relocs;
- bfd_size_type external_reloc_size;
- bfd_size_type amt;
- char *external_relocs;
- arelent *rptr;
- unsigned int i;
-
- if (section->relocation != (arelent *) NULL
- || section->reloc_count == 0
- || (section->flags & SEC_CONSTRUCTOR) != 0)
- return TRUE;
-
- if (! _bfd_ecoff_slurp_symbol_table (abfd))
- return FALSE;
-
- amt = section->reloc_count;
- amt *= sizeof (arelent);
- internal_relocs = (arelent *) bfd_alloc (abfd, amt);
-
- external_reloc_size = backend->external_reloc_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_bread (external_relocs, amt, abfd) != amt)
- return FALSE;
-
- for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++)
- {
- struct internal_reloc intern;
-
- (*backend->swap_reloc_in) (abfd,
- external_relocs + i * external_reloc_size,
- &intern);
-
- if (intern.r_extern)
- {
- /* r_symndx is an index into the external symbols. */
- BFD_ASSERT (intern.r_symndx >= 0
- && (intern.r_symndx
- < (ecoff_data (abfd)
- ->debug_info.symbolic_header.iextMax)));
- rptr->sym_ptr_ptr = symbols + intern.r_symndx;
- rptr->addend = 0;
- }
- else if (intern.r_symndx == RELOC_SECTION_NONE
- || intern.r_symndx == RELOC_SECTION_ABS)
- {
- rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- rptr->addend = 0;
- }
- else
- {
- const char *sec_name;
- asection *sec;
-
- /* r_symndx is a section key. */
- switch (intern.r_symndx)
- {
- case RELOC_SECTION_TEXT: sec_name = ".text"; break;
- case RELOC_SECTION_RDATA: sec_name = ".rdata"; break;
- case RELOC_SECTION_DATA: sec_name = ".data"; break;
- case RELOC_SECTION_SDATA: sec_name = ".sdata"; break;
- case RELOC_SECTION_SBSS: sec_name = ".sbss"; break;
- case RELOC_SECTION_BSS: sec_name = ".bss"; break;
- case RELOC_SECTION_INIT: sec_name = ".init"; break;
- case RELOC_SECTION_LIT8: sec_name = ".lit8"; break;
- case RELOC_SECTION_LIT4: sec_name = ".lit4"; break;
- case RELOC_SECTION_XDATA: sec_name = ".xdata"; break;
- case RELOC_SECTION_PDATA: sec_name = ".pdata"; break;
- case RELOC_SECTION_FINI: sec_name = ".fini"; break;
- case RELOC_SECTION_LITA: sec_name = ".lita"; break;
- case RELOC_SECTION_RCONST: sec_name = ".rconst"; break;
- default: abort ();
- }
-
- sec = bfd_get_section_by_name (abfd, sec_name);
- if (sec == (asection *) NULL)
- abort ();
- rptr->sym_ptr_ptr = sec->symbol_ptr_ptr;
-
- rptr->addend = - bfd_get_section_vma (abfd, sec);
- }
-
- rptr->address = intern.r_vaddr - bfd_get_section_vma (abfd, section);
-
- /* Let the backend select the howto field and do any other
- required processing. */
- (*backend->adjust_reloc_in) (abfd, &intern, rptr);
- }
-
- bfd_release (abfd, external_relocs);
-
- section->relocation = internal_relocs;
-
- return TRUE;
-}
-
-/* Get a canonical list of relocs. */
-
-long
-_bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- asection *section;
- arelent **relptr;
- asymbol **symbols;
-{
- unsigned int count;
-
- if (section->flags & SEC_CONSTRUCTOR)
- {
- arelent_chain *chain;
-
- /* This section has relocs made up by us, not the file, so take
- them out of their chain and place them into the data area
- provided. */
- for (count = 0, chain = section->constructor_chain;
- count < section->reloc_count;
- count++, chain = chain->next)
- *relptr++ = &chain->relent;
- }
- else
- {
- arelent *tblptr;
-
- if (! ecoff_slurp_reloc_table (abfd, section, symbols))
- return -1;
-
- tblptr = section->relocation;
-
- for (count = 0; count < section->reloc_count; count++)
- *relptr++ = tblptr++;
- }
-
- *relptr = (arelent *) NULL;
-
- return section->reloc_count;
-}
-
-/* Provided a BFD, a section and an offset into the section, calculate
- and return the name of the source file and the line nearest to the
- wanted location. */
-
-bfd_boolean
-_bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
- filename_ptr, functionname_ptr, retline_ptr)
- bfd *abfd;
- asection *section;
- asymbol **ignore_symbols ATTRIBUTE_UNUSED;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *retline_ptr;
-{
- const struct ecoff_debug_swap * const debug_swap
- = &ecoff_backend (abfd)->debug_swap;
- struct ecoff_debug_info * const debug_info = &ecoff_data (abfd)->debug_info;
- struct ecoff_find_line *line_info;
-
- /* Make sure we have the FDR's. */
- if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info)
- || bfd_get_symcount (abfd) == 0)
- return FALSE;
-
- if (ecoff_data (abfd)->find_line_info == NULL)
- {
- 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;
- }
- line_info = ecoff_data (abfd)->find_line_info;
-
- return _bfd_ecoff_locate_line (abfd, section, offset, debug_info,
- debug_swap, line_info, filename_ptr,
- functionname_ptr, retline_ptr);
-}
-
-/* Copy private BFD data. This is called by objcopy and strip. We
- use it to copy the ECOFF debugging information from one BFD to the
- other. It would be theoretically possible to represent the ECOFF
- debugging information in the symbol table. However, it would be a
- lot of work, and there would be little gain (gas, gdb, and ld
- already access the ECOFF debugging information via the
- ecoff_debug_info structure, and that structure would have to be
- retained in order to support ECOFF debugging in MIPS ELF).
-
- The debugging information for the ECOFF external symbols comes from
- the symbol table, so this function only handles the other debugging
- information. */
-
-bfd_boolean
-_bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
-{
- struct ecoff_debug_info *iinfo = &ecoff_data (ibfd)->debug_info;
- struct ecoff_debug_info *oinfo = &ecoff_data (obfd)->debug_info;
- register int i;
- asymbol **sym_ptr_ptr;
- size_t c;
- bfd_boolean local;
-
- /* We only want to copy information over if both BFD's use ECOFF
- format. */
- if (bfd_get_flavour (ibfd) != bfd_target_ecoff_flavour
- || bfd_get_flavour (obfd) != bfd_target_ecoff_flavour)
- return TRUE;
-
- /* Copy the GP value and the register masks. */
- ecoff_data (obfd)->gp = ecoff_data (ibfd)->gp;
- ecoff_data (obfd)->gprmask = ecoff_data (ibfd)->gprmask;
- ecoff_data (obfd)->fprmask = ecoff_data (ibfd)->fprmask;
- for (i = 0; i < 3; i++)
- ecoff_data (obfd)->cprmask[i] = ecoff_data (ibfd)->cprmask[i];
-
- /* Copy the version stamp. */
- oinfo->symbolic_header.vstamp = iinfo->symbolic_header.vstamp;
-
- /* If there are no symbols, don't copy any debugging information. */
- c = bfd_get_symcount (obfd);
- sym_ptr_ptr = bfd_get_outsymbols (obfd);
- if (c == 0 || sym_ptr_ptr == (asymbol **) NULL)
- return TRUE;
-
- /* See if there are any local symbols. */
- local = FALSE;
- for (; c > 0; c--, sym_ptr_ptr++)
- {
- if (ecoffsymbol (*sym_ptr_ptr)->local)
- {
- local = TRUE;
- break;
- }
- }
-
- if (local)
- {
- /* There are some local symbols. We just bring over all the
- debugging information. FIXME: This is not quite the right
- thing to do. If the user has asked us to discard all
- debugging information, then we are probably going to wind up
- keeping it because there will probably be some local symbol
- which objcopy did not discard. We should actually break
- apart the debugging information and only keep that which
- applies to the symbols we want to keep. */
- oinfo->symbolic_header.ilineMax = iinfo->symbolic_header.ilineMax;
- oinfo->symbolic_header.cbLine = iinfo->symbolic_header.cbLine;
- oinfo->line = iinfo->line;
-
- oinfo->symbolic_header.idnMax = iinfo->symbolic_header.idnMax;
- oinfo->external_dnr = iinfo->external_dnr;
-
- oinfo->symbolic_header.ipdMax = iinfo->symbolic_header.ipdMax;
- oinfo->external_pdr = iinfo->external_pdr;
-
- oinfo->symbolic_header.isymMax = iinfo->symbolic_header.isymMax;
- oinfo->external_sym = iinfo->external_sym;
-
- oinfo->symbolic_header.ioptMax = iinfo->symbolic_header.ioptMax;
- oinfo->external_opt = iinfo->external_opt;
-
- oinfo->symbolic_header.iauxMax = iinfo->symbolic_header.iauxMax;
- oinfo->external_aux = iinfo->external_aux;
-
- oinfo->symbolic_header.issMax = iinfo->symbolic_header.issMax;
- oinfo->ss = iinfo->ss;
-
- oinfo->symbolic_header.ifdMax = iinfo->symbolic_header.ifdMax;
- oinfo->external_fdr = iinfo->external_fdr;
-
- oinfo->symbolic_header.crfd = iinfo->symbolic_header.crfd;
- oinfo->external_rfd = iinfo->external_rfd;
- }
- else
- {
- /* We are discarding all the local symbol information. Look
- through the external symbols and remove all references to FDR
- or aux information. */
- c = bfd_get_symcount (obfd);
- sym_ptr_ptr = bfd_get_outsymbols (obfd);
- for (; c > 0; c--, sym_ptr_ptr++)
- {
- EXTR esym;
-
- (*(ecoff_backend (obfd)->debug_swap.swap_ext_in))
- (obfd, ecoffsymbol (*sym_ptr_ptr)->native, &esym);
- esym.ifd = ifdNil;
- esym.asym.index = indexNil;
- (*(ecoff_backend (obfd)->debug_swap.swap_ext_out))
- (obfd, &esym, ecoffsymbol (*sym_ptr_ptr)->native);
- }
- }
-
- return TRUE;
-}
-
-/* Set the architecture. The supported architecture is stored in the
- backend pointer. We always set the architecture anyhow, since many
- callers ignore the return value. */
-
-bfd_boolean
-_bfd_ecoff_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
-{
- bfd_default_set_arch_mach (abfd, arch, machine);
- return arch == ecoff_backend (abfd)->arch;
-}
-
-/* Get the size of the section headers. */
-
-int
-_bfd_ecoff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
-{
- asection *current;
- int c;
- int ret;
-
- c = 0;
- for (current = abfd->sections;
- current != (asection *)NULL;
- current = current->next)
- ++c;
-
- ret = (bfd_coff_filhsz (abfd)
- + bfd_coff_aoutsz (abfd)
- + c * bfd_coff_scnhsz (abfd));
- return BFD_ALIGN (ret, 16);
-}
-
-/* Get the contents of a section. */
-
-bfd_boolean
-_bfd_ecoff_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- return _bfd_generic_get_section_contents (abfd, section, location,
- offset, count);
-}
-
-/* Sort sections by VMA, but put SEC_ALLOC sections first. This is
- called via qsort. */
-
-static int
-ecoff_sort_hdrs (arg1, arg2)
- const PTR arg1;
- const PTR arg2;
-{
- const asection *hdr1 = *(const asection **) arg1;
- const asection *hdr2 = *(const asection **) arg2;
-
- if ((hdr1->flags & SEC_ALLOC) != 0)
- {
- if ((hdr2->flags & SEC_ALLOC) == 0)
- return -1;
- }
- else
- {
- if ((hdr2->flags & SEC_ALLOC) != 0)
- return 1;
- }
- if (hdr1->vma < hdr2->vma)
- return -1;
- else if (hdr1->vma > hdr2->vma)
- return 1;
- else
- return 0;
-}
-
-/* Calculate the file position for each section, and set
- reloc_filepos. */
-
-static bfd_boolean
-ecoff_compute_section_file_positions (abfd)
- bfd *abfd;
-{
- file_ptr sofar, file_sofar;
- asection **sorted_hdrs;
- asection *current;
- unsigned int i;
- file_ptr old_sofar;
- bfd_boolean rdata_in_text;
- bfd_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. */
- 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;
- current != NULL;
- current = current->next, i++)
- sorted_hdrs[i] = current;
- BFD_ASSERT (i == abfd->section_count);
-
- qsort (sorted_hdrs, abfd->section_count, sizeof (asection *),
- ecoff_sort_hdrs);
-
- /* Some versions of the OSF linker put the .rdata section in the
- text segment, and some do not. */
- rdata_in_text = ecoff_backend (abfd)->rdata_in_text;
- if (rdata_in_text)
- {
- for (i = 0; i < abfd->section_count; i++)
- {
- current = sorted_hdrs[i];
- if (strcmp (current->name, _RDATA) == 0)
- break;
- if ((current->flags & SEC_CODE) == 0
- && strcmp (current->name, _PDATA) != 0
- && strcmp (current->name, _RCONST) != 0)
- {
- rdata_in_text = FALSE;
- break;
- }
- }
- }
- ecoff_data (abfd)->rdata_in_text = rdata_in_text;
-
- first_data = TRUE;
- first_nonalloc = TRUE;
- for (i = 0; i < abfd->section_count; i++)
- {
- unsigned int alignment_power;
-
- current = sorted_hdrs[i];
-
- /* For the Alpha ECOFF .pdata section the lnnoptr field is
- supposed to indicate the number of .pdata entries that are
- really in the section. Each entry is 8 bytes. We store this
- away in line_filepos before increasing the section size. */
- if (strcmp (current->name, _PDATA) == 0)
- current->line_filepos = current->_raw_size / 8;
-
- alignment_power = current->alignment_power;
-
- /* On Ultrix, the data sections in an executable file must be
- aligned to a page boundary within the file. This does not
- affect the section size, though. FIXME: Does this work for
- other platforms? It requires some modification for the
- Alpha, because .rdata on the Alpha goes with the text, not
- the data. */
- if ((abfd->flags & EXEC_P) != 0
- && (abfd->flags & D_PAGED) != 0
- && ! first_data
- && (current->flags & SEC_CODE) == 0
- && (! rdata_in_text
- || strcmp (current->name, _RDATA) != 0)
- && strcmp (current->name, _PDATA) != 0
- && strcmp (current->name, _RCONST) != 0)
- {
- sofar = (sofar + round - 1) &~ (round - 1);
- file_sofar = (file_sofar + round - 1) &~ (round - 1);
- first_data = FALSE;
- }
- else if (strcmp (current->name, _LIB) == 0)
- {
- /* On Irix 4, the location of contents of the .lib section
- from a shared library section is also rounded up to a
- page boundary. */
-
- sofar = (sofar + round - 1) &~ (round - 1);
- file_sofar = (file_sofar + round - 1) &~ (round - 1);
- }
- else if (first_nonalloc
- && (current->flags & SEC_ALLOC) == 0
- && (abfd->flags & D_PAGED) != 0)
- {
- /* Skip up to the next page for an unallocated section, such
- as the .comment section on the Alpha. This leaves room
- for the .bss section. */
- first_nonalloc = FALSE;
- sofar = (sofar + round - 1) &~ (round - 1);
- file_sofar = (file_sofar + round - 1) &~ (round - 1);
- }
-
- /* Align the sections in the file to the same boundary on
- which they are aligned in virtual memory. */
- sofar = BFD_ALIGN (sofar, 1 << alignment_power);
- if ((current->flags & SEC_HAS_CONTENTS) != 0)
- file_sofar = BFD_ALIGN (file_sofar, 1 << alignment_power);
-
- if ((abfd->flags & D_PAGED) != 0
- && (current->flags & SEC_ALLOC) != 0)
- {
- sofar += (current->vma - sofar) % round;
- if ((current->flags & SEC_HAS_CONTENTS) != 0)
- file_sofar += (current->vma - file_sofar) % round;
- }
-
- if ((current->flags & (SEC_HAS_CONTENTS | SEC_LOAD)) != 0)
- current->filepos = file_sofar;
-
- sofar += current->_raw_size;
- if ((current->flags & SEC_HAS_CONTENTS) != 0)
- file_sofar += current->_raw_size;
-
- /* Make sure that this section is of the right size too. */
- old_sofar = sofar;
- sofar = BFD_ALIGN (sofar, 1 << alignment_power);
- if ((current->flags & SEC_HAS_CONTENTS) != 0)
- file_sofar = BFD_ALIGN (file_sofar, 1 << alignment_power);
- current->_raw_size += sofar - old_sofar;
- }
-
- free (sorted_hdrs);
- sorted_hdrs = NULL;
-
- ecoff_data (abfd)->reloc_filepos = file_sofar;
-
- return TRUE;
-}
-
-/* Determine the location of the relocs for all the sections in the
- output file, as well as the location of the symbolic debugging
- information. */
-
-static bfd_size_type
-ecoff_compute_reloc_file_positions (abfd)
- bfd *abfd;
-{
- const bfd_size_type external_reloc_size =
- ecoff_backend (abfd)->external_reloc_size;
- file_ptr reloc_base;
- bfd_size_type reloc_size;
- asection *current;
- file_ptr sym_base;
-
- if (! abfd->output_has_begun)
- {
- if (! ecoff_compute_section_file_positions (abfd))
- abort ();
- abfd->output_has_begun = TRUE;
- }
-
- reloc_base = ecoff_data (abfd)->reloc_filepos;
-
- reloc_size = 0;
- for (current = abfd->sections;
- current != (asection *)NULL;
- current = current->next)
- {
- if (current->reloc_count == 0)
- current->rel_filepos = 0;
- else
- {
- bfd_size_type relsize;
-
- current->rel_filepos = reloc_base;
- relsize = current->reloc_count * external_reloc_size;
- reloc_size += relsize;
- reloc_base += relsize;
- }
- }
-
- sym_base = ecoff_data (abfd)->reloc_filepos + reloc_size;
-
- /* At least on Ultrix, the symbol table of an executable file must
- be aligned to a page boundary. FIXME: Is this true on other
- platforms? */
- if ((abfd->flags & EXEC_P) != 0
- && (abfd->flags & D_PAGED) != 0)
- sym_base = ((sym_base + ecoff_backend (abfd)->round - 1)
- &~ (ecoff_backend (abfd)->round - 1));
-
- ecoff_data (abfd)->sym_filepos = sym_base;
-
- return reloc_size;
-}
-
-/* Set the contents of a section. */
-
-bfd_boolean
-_bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- const PTR location;
- 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)
- {
- if (! ecoff_compute_section_file_positions (abfd))
- return FALSE;
- }
-
- /* Handle the .lib section specially so that Irix 4 shared libraries
- work out. See coff_set_section_contents in coffcode.h. */
- if (strcmp (section->name, _LIB) == 0)
- {
- bfd_byte *rec, *recend;
-
- rec = (bfd_byte *) location;
- recend = rec + count;
- while (rec < recend)
- {
- ++section->lma;
- rec += bfd_get_32 (abfd, rec) * 4;
- }
-
- BFD_ASSERT (rec == recend);
- }
-
- if (count == 0)
- return TRUE;
-
- pos = section->filepos + offset;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
- return FALSE;
-
- return TRUE;
-}
-
-/* Get the GP value for an ECOFF file. This is a hook used by
- nlmconv. */
-
-bfd_vma
-bfd_ecoff_get_gp_value (abfd)
- bfd *abfd;
-{
- if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
- || bfd_get_format (abfd) != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return 0;
- }
-
- return ecoff_data (abfd)->gp;
-}
-
-/* Set the GP value for an ECOFF file. This is a hook used by the
- assembler. */
-
-bfd_boolean
-bfd_ecoff_set_gp_value (abfd, gp_value)
- bfd *abfd;
- bfd_vma gp_value;
-{
- if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
- || bfd_get_format (abfd) != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- ecoff_data (abfd)->gp = gp_value;
-
- return TRUE;
-}
-
-/* Set the register masks for an ECOFF file. This is a hook used by
- the assembler. */
-
-bfd_boolean
-bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
- bfd *abfd;
- unsigned long gprmask;
- unsigned long fprmask;
- unsigned long *cprmask;
-{
- ecoff_data_type *tdata;
-
- if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
- || bfd_get_format (abfd) != bfd_object)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- tdata = ecoff_data (abfd);
- tdata->gprmask = gprmask;
- tdata->fprmask = fprmask;
- if (cprmask != (unsigned long *) NULL)
- {
- int i;
-
- for (i = 0; i < 3; i++)
- tdata->cprmask[i] = cprmask[i];
- }
-
- return TRUE;
-}
-
-/* Get ECOFF EXTR information for an external symbol. This function
- is passed to bfd_ecoff_debug_externals. */
-
-static bfd_boolean
-ecoff_get_extr (sym, esym)
- asymbol *sym;
- EXTR *esym;
-{
- ecoff_symbol_type *ecoff_sym_ptr;
- bfd *input_bfd;
-
- if (bfd_asymbol_flavour (sym) != bfd_target_ecoff_flavour
- || ecoffsymbol (sym)->native == NULL)
- {
- /* Don't include debugging, local, or section symbols. */
- if ((sym->flags & BSF_DEBUGGING) != 0
- || (sym->flags & BSF_LOCAL) != 0
- || (sym->flags & BSF_SECTION_SYM) != 0)
- return FALSE;
-
- esym->jmptbl = 0;
- esym->cobol_main = 0;
- esym->weakext = (sym->flags & BSF_WEAK) != 0;
- esym->reserved = 0;
- esym->ifd = ifdNil;
- /* FIXME: we can do better than this for st and sc. */
- esym->asym.st = stGlobal;
- esym->asym.sc = scAbs;
- esym->asym.reserved = 0;
- esym->asym.index = indexNil;
- return TRUE;
- }
-
- ecoff_sym_ptr = ecoffsymbol (sym);
-
- if (ecoff_sym_ptr->local)
- return FALSE;
-
- input_bfd = bfd_asymbol_bfd (sym);
- (*(ecoff_backend (input_bfd)->debug_swap.swap_ext_in))
- (input_bfd, ecoff_sym_ptr->native, esym);
-
- /* If the symbol was defined by the linker, then esym will be
- undefined but sym will not be. Get a better class for such a
- symbol. */
- if ((esym->asym.sc == scUndefined
- || esym->asym.sc == scSUndefined)
- && ! bfd_is_und_section (bfd_get_section (sym)))
- esym->asym.sc = scAbs;
-
- /* Adjust the FDR index for the symbol by that used for the input
- BFD. */
- if (esym->ifd != -1)
- {
- struct ecoff_debug_info *input_debug;
-
- input_debug = &ecoff_data (input_bfd)->debug_info;
- BFD_ASSERT (esym->ifd < input_debug->symbolic_header.ifdMax);
- if (input_debug->ifdmap != (RFDT *) NULL)
- esym->ifd = input_debug->ifdmap[esym->ifd];
- }
-
- return TRUE;
-}
-
-/* Set the external symbol index. This routine is passed to
- bfd_ecoff_debug_externals. */
-
-static void
-ecoff_set_index (sym, indx)
- asymbol *sym;
- bfd_size_type indx;
-{
- ecoff_set_sym_index (sym, indx);
-}
-
-/* Write out an ECOFF file. */
-
-bfd_boolean
-_bfd_ecoff_write_object_contents (abfd)
- bfd *abfd;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- const bfd_vma round = backend->round;
- const bfd_size_type filhsz = bfd_coff_filhsz (abfd);
- const bfd_size_type aoutsz = bfd_coff_aoutsz (abfd);
- const bfd_size_type scnhsz = bfd_coff_scnhsz (abfd);
- const bfd_size_type external_hdr_size
- = backend->debug_swap.external_hdr_size;
- const bfd_size_type external_reloc_size = backend->external_reloc_size;
- void (* const adjust_reloc_out)
- PARAMS ((bfd *, const arelent *, struct internal_reloc *))
- = backend->adjust_reloc_out;
- void (* const swap_reloc_out)
- PARAMS ((bfd *, const struct internal_reloc *, PTR))
- = backend->swap_reloc_out;
- struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info;
- HDRR * const symhdr = &debug->symbolic_header;
- asection *current;
- unsigned int count;
- bfd_size_type reloc_size;
- bfd_size_type text_size;
- bfd_vma text_start;
- bfd_boolean set_text_start;
- bfd_size_type data_size;
- bfd_vma data_start;
- bfd_boolean set_data_start;
- bfd_size_type bss_size;
- PTR buff = NULL;
- PTR reloc_buff = NULL;
- struct internal_filehdr internal_f;
- struct internal_aouthdr internal_a;
- int i;
-
- /* Determine where the sections and relocs will go in the output
- file. */
- reloc_size = ecoff_compute_reloc_file_positions (abfd);
-
- count = 1;
- for (current = abfd->sections;
- current != (asection *)NULL;
- current = current->next)
- {
- current->target_index = count;
- ++count;
- }
-
- if ((abfd->flags & D_PAGED) != 0)
- text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE);
- else
- text_size = 0;
- text_start = 0;
- set_text_start = FALSE;
- data_size = 0;
- data_start = 0;
- set_data_start = FALSE;
- bss_size = 0;
-
- /* Write section headers to the file. */
-
- /* Allocate buff big enough to hold a section header,
- file header, or a.out header. */
- {
- bfd_size_type siz;
- siz = scnhsz;
- if (siz < filhsz)
- siz = filhsz;
- if (siz < aoutsz)
- siz = aoutsz;
- buff = (PTR) bfd_malloc (siz);
- if (buff == NULL)
- goto error_return;
- }
-
- internal_f.f_nscns = 0;
- if (bfd_seek (abfd, (file_ptr) (filhsz + aoutsz), SEEK_SET) != 0)
- goto error_return;
- for (current = abfd->sections;
- current != (asection *) NULL;
- current = current->next)
- {
- struct internal_scnhdr section;
- bfd_vma vma;
-
- ++internal_f.f_nscns;
-
- strncpy (section.s_name, current->name, sizeof section.s_name);
-
- /* This seems to be correct for Irix 4 shared libraries. */
- vma = bfd_get_section_vma (abfd, current);
- if (strcmp (current->name, _LIB) == 0)
- section.s_vaddr = 0;
- else
- section.s_vaddr = vma;
-
- section.s_paddr = current->lma;
- section.s_size = bfd_get_section_size_before_reloc (current);
-
- /* If this section is unloadable then the scnptr will be 0. */
- if ((current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
- section.s_scnptr = 0;
- else
- section.s_scnptr = current->filepos;
- section.s_relptr = current->rel_filepos;
-
- /* FIXME: the lnnoptr of the .sbss or .sdata section of an
- object file produced by the assembler is supposed to point to
- information about how much room is required by objects of
- various different sizes. I think this only matters if we
- want the linker to compute the best size to use, or
- something. I don't know what happens if the information is
- not present. */
- if (strcmp (current->name, _PDATA) != 0)
- section.s_lnnoptr = 0;
- else
- {
- /* The Alpha ECOFF .pdata section uses the lnnoptr field to
- hold the number of entries in the section (each entry is
- 8 bytes). We stored this in the line_filepos field in
- ecoff_compute_section_file_positions. */
- section.s_lnnoptr = current->line_filepos;
- }
-
- section.s_nreloc = current->reloc_count;
- section.s_nlnno = 0;
- section.s_flags = ecoff_sec_to_styp_flags (current->name,
- current->flags);
-
- if (bfd_coff_swap_scnhdr_out (abfd, (PTR) &section, buff) == 0
- || bfd_bwrite (buff, scnhsz, abfd) != scnhsz)
- goto error_return;
-
- if ((section.s_flags & STYP_TEXT) != 0
- || ((section.s_flags & STYP_RDATA) != 0
- && ecoff_data (abfd)->rdata_in_text)
- || section.s_flags == STYP_PDATA
- || (section.s_flags & STYP_DYNAMIC) != 0
- || (section.s_flags & STYP_LIBLIST) != 0
- || (section.s_flags & STYP_RELDYN) != 0
- || section.s_flags == STYP_CONFLIC
- || (section.s_flags & STYP_DYNSTR) != 0
- || (section.s_flags & STYP_DYNSYM) != 0
- || (section.s_flags & STYP_HASH) != 0
- || (section.s_flags & STYP_ECOFF_INIT) != 0
- || (section.s_flags & STYP_ECOFF_FINI) != 0
- || section.s_flags == STYP_RCONST)
- {
- text_size += bfd_get_section_size_before_reloc (current);
- if (! set_text_start || text_start > vma)
- {
- text_start = vma;
- set_text_start = TRUE;
- }
- }
- else if ((section.s_flags & STYP_RDATA) != 0
- || (section.s_flags & STYP_DATA) != 0
- || (section.s_flags & STYP_LITA) != 0
- || (section.s_flags & STYP_LIT8) != 0
- || (section.s_flags & STYP_LIT4) != 0
- || (section.s_flags & STYP_SDATA) != 0
- || section.s_flags == STYP_XDATA
- || (section.s_flags & STYP_GOT) != 0)
- {
- data_size += bfd_get_section_size_before_reloc (current);
- if (! set_data_start || data_start > vma)
- {
- data_start = vma;
- set_data_start = TRUE;
- }
- }
- else if ((section.s_flags & STYP_BSS) != 0
- || (section.s_flags & STYP_SBSS) != 0)
- bss_size += bfd_get_section_size_before_reloc (current);
- else if (section.s_flags == 0
- || (section.s_flags & STYP_ECOFF_LIB) != 0
- || section.s_flags == STYP_COMMENT)
- /* Do nothing. */ ;
- else
- abort ();
- }
-
- /* Set up the file header. */
- internal_f.f_magic = ecoff_get_magic (abfd);
-
- /* We will NOT put a fucking timestamp in the header here. Every
- time you put it back, I will come in and take it out again. I'm
- sorry. This field does not belong here. We fill it with a 0 so
- it compares the same but is not a reasonable time. --
- gnu@cygnus.com. */
- internal_f.f_timdat = 0;
-
- if (bfd_get_symcount (abfd) != 0)
- {
- /* The ECOFF f_nsyms field is not actually the number of
- symbols, it's the size of symbolic information header. */
- internal_f.f_nsyms = external_hdr_size;
- internal_f.f_symptr = ecoff_data (abfd)->sym_filepos;
- }
- else
- {
- internal_f.f_nsyms = 0;
- internal_f.f_symptr = 0;
- }
-
- internal_f.f_opthdr = aoutsz;
-
- internal_f.f_flags = F_LNNO;
- if (reloc_size == 0)
- internal_f.f_flags |= F_RELFLG;
- if (bfd_get_symcount (abfd) == 0)
- internal_f.f_flags |= F_LSYMS;
- if (abfd->flags & EXEC_P)
- internal_f.f_flags |= F_EXEC;
-
- if (bfd_little_endian (abfd))
- internal_f.f_flags |= F_AR32WR;
- else
- internal_f.f_flags |= F_AR32W;
-
- /* Set up the ``optional'' header. */
- if ((abfd->flags & D_PAGED) != 0)
- internal_a.magic = ECOFF_AOUT_ZMAGIC;
- else
- internal_a.magic = ECOFF_AOUT_OMAGIC;
-
- /* FIXME: Is this really correct? */
- internal_a.vstamp = symhdr->vstamp;
-
- /* At least on Ultrix, these have to be rounded to page boundaries.
- FIXME: Is this true on other platforms? */
- if ((abfd->flags & D_PAGED) != 0)
- {
- internal_a.tsize = (text_size + round - 1) &~ (round - 1);
- internal_a.text_start = text_start &~ (round - 1);
- internal_a.dsize = (data_size + round - 1) &~ (round - 1);
- internal_a.data_start = data_start &~ (round - 1);
- }
- else
- {
- internal_a.tsize = text_size;
- internal_a.text_start = text_start;
- internal_a.dsize = data_size;
- internal_a.data_start = data_start;
- }
-
- /* On Ultrix, the initial portions of the .sbss and .bss segments
- are at the end of the data section. The bsize field in the
- optional header records how many bss bytes are required beyond
- those in the data section. The value is not rounded to a page
- boundary. */
- if (bss_size < internal_a.dsize - data_size)
- bss_size = 0;
- else
- bss_size -= internal_a.dsize - data_size;
- internal_a.bsize = bss_size;
- internal_a.bss_start = internal_a.data_start + internal_a.dsize;
-
- internal_a.entry = bfd_get_start_address (abfd);
-
- internal_a.gp_value = ecoff_data (abfd)->gp;
-
- internal_a.gprmask = ecoff_data (abfd)->gprmask;
- internal_a.fprmask = ecoff_data (abfd)->fprmask;
- for (i = 0; i < 4; i++)
- internal_a.cprmask[i] = ecoff_data (abfd)->cprmask[i];
-
- /* Let the backend adjust the headers if necessary. */
- if (backend->adjust_headers)
- {
- if (! (*backend->adjust_headers) (abfd, &internal_f, &internal_a))
- goto error_return;
- }
-
- /* Write out the file header and the optional header. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- goto error_return;
-
- bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff);
- if (bfd_bwrite (buff, filhsz, abfd) != filhsz)
- goto error_return;
-
- bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff);
- if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz)
- goto error_return;
-
- /* Build the external symbol information. This must be done before
- writing out the relocs so that we know the symbol indices. We
- don't do this if this BFD was created by the backend linker,
- since it will have already handled the symbols and relocs. */
- if (! ecoff_data (abfd)->linker)
- {
- symhdr->iextMax = 0;
- symhdr->issExtMax = 0;
- debug->external_ext = debug->external_ext_end = NULL;
- debug->ssext = debug->ssext_end = NULL;
- if (! bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap,
- (abfd->flags & EXEC_P) == 0,
- ecoff_get_extr, ecoff_set_index))
- goto error_return;
-
- /* Write out the relocs. */
- for (current = abfd->sections;
- current != (asection *) NULL;
- current = current->next)
- {
- arelent **reloc_ptr_ptr;
- arelent **reloc_end;
- char *out_ptr;
- bfd_size_type amt;
-
- if (current->reloc_count == 0)
- continue;
-
- amt = current->reloc_count * external_reloc_size;
- reloc_buff = bfd_alloc (abfd, amt);
- if (reloc_buff == NULL)
- goto error_return;
-
- reloc_ptr_ptr = current->orelocation;
- reloc_end = reloc_ptr_ptr + current->reloc_count;
- out_ptr = (char *) reloc_buff;
- for (;
- reloc_ptr_ptr < reloc_end;
- reloc_ptr_ptr++, out_ptr += external_reloc_size)
- {
- arelent *reloc;
- asymbol *sym;
- struct internal_reloc in;
-
- memset ((PTR) &in, 0, sizeof in);
-
- reloc = *reloc_ptr_ptr;
- sym = *reloc->sym_ptr_ptr;
-
- in.r_vaddr = (reloc->address
- + bfd_get_section_vma (abfd, current));
- in.r_type = reloc->howto->type;
-
- if ((sym->flags & BSF_SECTION_SYM) == 0)
- {
- in.r_symndx = ecoff_get_sym_index (*reloc->sym_ptr_ptr);
- in.r_extern = 1;
- }
- else
- {
- const char *name;
-
- name = bfd_get_section_name (abfd, bfd_get_section (sym));
- if (strcmp (name, ".text") == 0)
- in.r_symndx = RELOC_SECTION_TEXT;
- else if (strcmp (name, ".rdata") == 0)
- in.r_symndx = RELOC_SECTION_RDATA;
- else if (strcmp (name, ".data") == 0)
- in.r_symndx = RELOC_SECTION_DATA;
- else if (strcmp (name, ".sdata") == 0)
- in.r_symndx = RELOC_SECTION_SDATA;
- else if (strcmp (name, ".sbss") == 0)
- in.r_symndx = RELOC_SECTION_SBSS;
- else if (strcmp (name, ".bss") == 0)
- in.r_symndx = RELOC_SECTION_BSS;
- else if (strcmp (name, ".init") == 0)
- in.r_symndx = RELOC_SECTION_INIT;
- else if (strcmp (name, ".lit8") == 0)
- in.r_symndx = RELOC_SECTION_LIT8;
- else if (strcmp (name, ".lit4") == 0)
- in.r_symndx = RELOC_SECTION_LIT4;
- else if (strcmp (name, ".xdata") == 0)
- in.r_symndx = RELOC_SECTION_XDATA;
- else if (strcmp (name, ".pdata") == 0)
- in.r_symndx = RELOC_SECTION_PDATA;
- else if (strcmp (name, ".fini") == 0)
- in.r_symndx = RELOC_SECTION_FINI;
- else if (strcmp (name, ".lita") == 0)
- in.r_symndx = RELOC_SECTION_LITA;
- else if (strcmp (name, "*ABS*") == 0)
- in.r_symndx = RELOC_SECTION_ABS;
- else if (strcmp (name, ".rconst") == 0)
- in.r_symndx = RELOC_SECTION_RCONST;
- else
- abort ();
- in.r_extern = 0;
- }
-
- (*adjust_reloc_out) (abfd, reloc, &in);
-
- (*swap_reloc_out) (abfd, &in, (PTR) out_ptr);
- }
-
- if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0)
- goto error_return;
- 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;
- }
-
- /* Write out the symbolic debugging information. */
- if (bfd_get_symcount (abfd) > 0)
- {
- /* Write out the debugging information. */
- if (! bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap,
- ecoff_data (abfd)->sym_filepos))
- goto error_return;
- }
- }
-
- /* The .bss section of a demand paged executable must receive an
- entire page. If there are symbols, the symbols will start on the
- next page. If there are no symbols, we must fill out the page by
- hand. */
- if (bfd_get_symcount (abfd) == 0
- && (abfd->flags & EXEC_P) != 0
- && (abfd->flags & D_PAGED) != 0)
- {
- char c;
-
- if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
- SEEK_SET) != 0)
- goto error_return;
- 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_bwrite (&c, (bfd_size_type) 1, abfd) != 1)
- goto error_return;
- }
-
- if (reloc_buff != NULL)
- bfd_release (abfd, reloc_buff);
- if (buff != NULL)
- free (buff);
- return TRUE;
- error_return:
- if (reloc_buff != NULL)
- bfd_release (abfd, reloc_buff);
- if (buff != NULL)
- free (buff);
- return FALSE;
-}
-
-/* Archive handling. ECOFF uses what appears to be a unique type of
- archive header (armap). The byte ordering of the armap and the
- contents are encoded in the name of the armap itself. At least for
- now, we only support archives with the same byte ordering in the
- armap and the contents.
-
- The first four bytes in the armap are the number of symbol
- definitions. This is always a power of two.
-
- This is followed by the symbol definitions. Each symbol definition
- occupies 8 bytes. The first four bytes are the offset from the
- start of the armap strings to the null-terminated string naming
- this symbol. The second four bytes are the file offset to the
- archive member which defines this symbol. If the second four bytes
- are 0, then this is not actually a symbol definition, and it should
- be ignored.
-
- The symbols are hashed into the armap with a closed hashing scheme.
- See the functions below for the details of the algorithm.
-
- After the symbol definitions comes four bytes holding the size of
- the string table, followed by the string table itself. */
-
-/* The name of an archive headers looks like this:
- __________E[BL]E[BL]_ (with a trailing space).
- The trailing space is changed to an X if the archive is changed to
- indicate that the armap is out of date.
-
- The Alpha seems to use ________64E[BL]E[BL]_. */
-
-#define ARMAP_BIG_ENDIAN 'B'
-#define ARMAP_LITTLE_ENDIAN 'L'
-#define ARMAP_MARKER 'E'
-#define ARMAP_START_LENGTH 10
-#define ARMAP_HEADER_MARKER_INDEX 10
-#define ARMAP_HEADER_ENDIAN_INDEX 11
-#define ARMAP_OBJECT_MARKER_INDEX 12
-#define ARMAP_OBJECT_ENDIAN_INDEX 13
-#define ARMAP_END_INDEX 14
-#define ARMAP_END "_ "
-
-/* This is a magic number used in the hashing algorithm. */
-#define ARMAP_HASH_MAGIC 0x9dd68ab5
-
-/* This returns the hash value to use for a string. It also sets
- *REHASH to the rehash adjustment if the first slot is taken. SIZE
- is the number of entries in the hash table, and HLOG is the log
- base 2 of SIZE. */
-
-static unsigned int
-ecoff_armap_hash (s, rehash, size, hlog)
- const char *s;
- unsigned int *rehash;
- unsigned int size;
- unsigned int hlog;
-{
- unsigned int hash;
-
- if (hlog == 0)
- return 0;
- hash = *s++;
- while (*s != '\0')
- hash = ((hash >> 27) | (hash << 5)) + *s++;
- hash *= ARMAP_HASH_MAGIC;
- *rehash = (hash & (size - 1)) | 1;
- return hash >> (32 - hlog);
-}
-
-/* Read in the armap. */
-
-bfd_boolean
-_bfd_ecoff_slurp_armap (abfd)
- bfd *abfd;
-{
- char nextname[17];
- unsigned int i;
- struct areltdata *mapdata;
- bfd_size_type parsed_size;
- char *raw_armap;
- struct artdata *ardata;
- unsigned int count;
- char *raw_ptr;
- struct symdef *symdef_ptr;
- char *stringbase;
- bfd_size_type amt;
-
- /* Get the name of the first element. */
- 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)
- return FALSE;
-
- /* Irix 4.0.5F apparently can use either an ECOFF armap or a
- standard COFF armap. We could move the ECOFF armap stuff into
- bfd_slurp_armap, but that seems inappropriate since no other
- target uses this format. Instead, we check directly for a COFF
- armap. */
- if (strncmp (nextname, "/ ", 16) == 0)
- return bfd_slurp_armap (abfd);
-
- /* See if the first element is an armap. */
- if (strncmp (nextname, ecoff_backend (abfd)->armap_start,
- ARMAP_START_LENGTH) != 0
- || nextname[ARMAP_HEADER_MARKER_INDEX] != ARMAP_MARKER
- || (nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN
- && nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN)
- || nextname[ARMAP_OBJECT_MARKER_INDEX] != ARMAP_MARKER
- || (nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN
- && nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN)
- || strncmp (nextname + ARMAP_END_INDEX,
- ARMAP_END, sizeof ARMAP_END - 1) != 0)
- {
- bfd_has_map (abfd) = FALSE;
- return TRUE;
- }
-
- /* Make sure we have the right byte ordering. */
- if (((nextname[ARMAP_HEADER_ENDIAN_INDEX] == ARMAP_BIG_ENDIAN)
- ^ (bfd_header_big_endian (abfd)))
- || ((nextname[ARMAP_OBJECT_ENDIAN_INDEX] == ARMAP_BIG_ENDIAN)
- ^ (bfd_big_endian (abfd))))
- {
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- /* Read in the armap. */
- ardata = bfd_ardata (abfd);
- mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
- if (mapdata == (struct areltdata *) NULL)
- return FALSE;
- parsed_size = mapdata->parsed_size;
- bfd_release (abfd, (PTR) mapdata);
-
- raw_armap = (char *) bfd_alloc (abfd, parsed_size);
- if (raw_armap == (char *) NULL)
- return FALSE;
-
- 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);
- bfd_release (abfd, (PTR) raw_armap);
- return FALSE;
- }
-
- ardata->tdata = (PTR) raw_armap;
-
- count = H_GET_32 (abfd, raw_armap);
-
- ardata->symdef_count = 0;
- ardata->cache = (struct ar_cache *) NULL;
-
- /* This code used to overlay the symdefs over the raw archive data,
- but that doesn't work on a 64 bit host. */
- stringbase = raw_armap + count * 8 + 8;
-
-#ifdef CHECK_ARMAP_HASH
- {
- unsigned int hlog;
-
- /* Double check that I have the hashing algorithm right by making
- sure that every symbol can be looked up successfully. */
- hlog = 0;
- for (i = 1; i < count; i <<= 1)
- hlog++;
- BFD_ASSERT (i == count);
-
- raw_ptr = raw_armap + 4;
- for (i = 0; i < count; i++, raw_ptr += 8)
- {
- unsigned int name_offset, file_offset;
- unsigned int hash, rehash, srch;
-
- 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,
- hlog);
- if (hash == i)
- continue;
-
- /* See if we can rehash to this location. */
- for (srch = (hash + rehash) & (count - 1);
- srch != hash && srch != i;
- srch = (srch + rehash) & (count - 1))
- BFD_ASSERT (H_GET_32 (abfd, (raw_armap + 8 + srch * 8)) != 0);
- BFD_ASSERT (srch == i);
- }
- }
-
-#endif /* CHECK_ARMAP_HASH */
-
- raw_ptr = raw_armap + 4;
- for (i = 0; i < count; i++, raw_ptr += 8)
- if (H_GET_32 (abfd, (raw_ptr + 4)) != 0)
- ++ardata->symdef_count;
-
- amt = ardata->symdef_count;
- amt *= sizeof (struct symdef);
- symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt);
- if (!symdef_ptr)
- return FALSE;
-
- ardata->symdefs = (carsym *) symdef_ptr;
-
- raw_ptr = raw_armap + 4;
- for (i = 0; i < count; i++, raw_ptr += 8)
- {
- unsigned int name_offset, file_offset;
-
- file_offset = H_GET_32 (abfd, (raw_ptr + 4));
- if (file_offset == 0)
- continue;
- name_offset = H_GET_32 (abfd, raw_ptr);
- symdef_ptr->s.name = stringbase + name_offset;
- symdef_ptr->file_offset = file_offset;
- ++symdef_ptr;
- }
-
- ardata->first_file_filepos = bfd_tell (abfd);
- /* Pad to an even boundary. */
- ardata->first_file_filepos += ardata->first_file_filepos % 2;
-
- bfd_has_map (abfd) = TRUE;
-
- return TRUE;
-}
-
-/* Write out an armap. */
-
-bfd_boolean
-_bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
- bfd *abfd;
- unsigned int elength;
- struct orl *map;
- unsigned int orl_count;
- int stridx;
-{
- unsigned int hashsize, hashlog;
- bfd_size_type symdefsize;
- int padit;
- unsigned int stringsize;
- unsigned int mapsize;
- file_ptr firstreal;
- struct ar_hdr hdr;
- struct stat statbuf;
- unsigned int i;
- bfd_byte temp[4];
- bfd_byte *hashtable;
- bfd *current;
- bfd *last_elt;
-
- /* Ultrix appears to use as a hash table size the least power of two
- greater than twice the number of entries. */
- for (hashlog = 0; ((unsigned int) 1 << hashlog) <= 2 * orl_count; hashlog++)
- ;
- hashsize = 1 << hashlog;
-
- symdefsize = hashsize * 8;
- padit = stridx % 2;
- stringsize = stridx + padit;
-
- /* Include 8 bytes to store symdefsize and stringsize in output. */
- mapsize = symdefsize + stringsize + 8;
-
- firstreal = SARMAG + sizeof (struct ar_hdr) + mapsize + elength;
-
- memset ((PTR) &hdr, 0, sizeof hdr);
-
- /* Work out the ECOFF armap name. */
- strcpy (hdr.ar_name, ecoff_backend (abfd)->armap_start);
- hdr.ar_name[ARMAP_HEADER_MARKER_INDEX] = ARMAP_MARKER;
- hdr.ar_name[ARMAP_HEADER_ENDIAN_INDEX] =
- (bfd_header_big_endian (abfd)
- ? ARMAP_BIG_ENDIAN
- : ARMAP_LITTLE_ENDIAN);
- hdr.ar_name[ARMAP_OBJECT_MARKER_INDEX] = ARMAP_MARKER;
- hdr.ar_name[ARMAP_OBJECT_ENDIAN_INDEX] =
- bfd_big_endian (abfd) ? ARMAP_BIG_ENDIAN : ARMAP_LITTLE_ENDIAN;
- memcpy (hdr.ar_name + ARMAP_END_INDEX, ARMAP_END, sizeof ARMAP_END - 1);
-
- /* Write the timestamp of the archive header to be just a little bit
- later than the timestamp of the file, otherwise the linker will
- complain that the index is out of date. Actually, the Ultrix
- linker just checks the archive name; the GNU linker may check the
- date. */
- stat (abfd->filename, &statbuf);
- sprintf (hdr.ar_date, "%ld", (long) (statbuf.st_mtime + 60));
-
- /* The DECstation uses zeroes for the uid, gid and mode of the
- armap. */
- hdr.ar_uid[0] = '0';
- hdr.ar_gid[0] = '0';
-#if 0
- hdr.ar_mode[0] = '0';
-#else
- /* Building gcc ends up extracting the armap as a file - twice. */
- hdr.ar_mode[0] = '6';
- hdr.ar_mode[1] = '4';
- hdr.ar_mode[2] = '4';
-#endif
-
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
-
- hdr.ar_fmag[0] = '`';
- hdr.ar_fmag[1] = '\012';
-
- /* Turn all null bytes in the header into spaces. */
- for (i = 0; i < sizeof (struct ar_hdr); i++)
- if (((char *) (&hdr))[i] == '\0')
- (((char *) (&hdr))[i]) = ' ';
-
- if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
- != sizeof (struct ar_hdr))
- return FALSE;
-
- 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);
- if (!hashtable)
- return FALSE;
-
- current = abfd->archive_head;
- last_elt = current;
- for (i = 0; i < orl_count; i++)
- {
- unsigned int hash, rehash;
-
- /* Advance firstreal to the file position of this archive
- element. */
- if (map[i].u.abfd != last_elt)
- {
- do
- {
- firstreal += arelt_size (current) + sizeof (struct ar_hdr);
- firstreal += firstreal % 2;
- current = current->next;
- }
- while (current != map[i].u.abfd);
- }
-
- last_elt = current;
-
- hash = ecoff_armap_hash (*map[i].name, &rehash, hashsize, hashlog);
- if (H_GET_32 (abfd, (hashtable + (hash * 8) + 4)) != 0)
- {
- unsigned int srch;
-
- /* The desired slot is already taken. */
- for (srch = (hash + rehash) & (hashsize - 1);
- srch != hash;
- srch = (srch + rehash) & (hashsize - 1))
- if (H_GET_32 (abfd, (hashtable + (srch * 8) + 4)) == 0)
- break;
-
- BFD_ASSERT (srch != hash);
-
- hash = srch;
- }
-
- H_PUT_32 (abfd, map[i].namidx, (hashtable + hash * 8));
- H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4));
- }
-
- if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize)
- return FALSE;
-
- bfd_release (abfd, hashtable);
-
- /* Now write the strings. */
- 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_bwrite ((PTR) (*map[i].name), len, abfd) != len)
- return FALSE;
- }
-
- /* The spec sez this should be a newline. But in order to be
- bug-compatible for DECstation ar we use a null. */
- if (padit)
- {
- if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* See whether this BFD is an archive. If it is, read in the armap
- and the extended name table. */
-
-const bfd_target *
-_bfd_ecoff_archive_p (abfd)
- bfd *abfd;
-{
- struct artdata *tdata_hold;
- char armag[SARMAG + 1];
- bfd_size_type amt;
-
- 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);
- return (const bfd_target *) NULL;
- }
-
- if (strncmp (armag, ARMAG, SARMAG) != 0)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- tdata_hold = bfd_ardata (abfd);
-
- amt = sizeof (struct artdata);
- bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
- if (bfd_ardata (abfd) == (struct artdata *) NULL)
- {
- bfd_ardata (abfd) = tdata_hold;
- return (const bfd_target *) NULL;
- }
-
- bfd_ardata (abfd)->first_file_filepos = SARMAG;
- bfd_ardata (abfd)->cache = NULL;
- bfd_ardata (abfd)->archive_head = NULL;
- bfd_ardata (abfd)->symdefs = NULL;
- bfd_ardata (abfd)->extended_names = NULL;
- bfd_ardata (abfd)->tdata = NULL;
-
- if (! _bfd_ecoff_slurp_armap (abfd)
- || ! _bfd_ecoff_slurp_extended_name_table (abfd))
- {
- bfd_release (abfd, bfd_ardata (abfd));
- bfd_ardata (abfd) = tdata_hold;
- return (const bfd_target *) NULL;
- }
-
- if (bfd_has_map (abfd))
- {
- bfd *first;
-
- /* This archive has a map, so we may presume that the contents
- are object files. Make sure that if the first file in the
- archive can be recognized as an object file, it is for this
- target. If not, assume that this is the wrong format. If
- the first file is not an object file, somebody is doing
- something weird, and we permit it so that ar -t will work. */
-
- first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
- if (first != NULL)
- {
- first->target_defaulted = FALSE;
- if (bfd_check_format (first, bfd_object)
- && first->xvec != abfd->xvec)
- {
-#if 0
- /* We ought to close `first' here, but we can't, because
- we have no way to remove it from the archive cache.
- It's close to impossible to figure out when we can
- release bfd_ardata. FIXME. */
- (void) bfd_close (first);
- bfd_release (abfd, bfd_ardata (abfd));
-#endif
- bfd_set_error (bfd_error_wrong_object_format);
- bfd_ardata (abfd) = tdata_hold;
- return NULL;
- }
- /* And we ought to close `first' here too. */
- }
- }
-
- return abfd->xvec;
-}
-
-/* ECOFF linker code. */
-
-static struct bfd_hash_entry *ecoff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string));
-static bfd_boolean ecoff_link_add_archive_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean ecoff_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
-static bfd_boolean ecoff_link_add_object_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean ecoff_link_add_externals
- PARAMS ((bfd *, struct bfd_link_info *, PTR, char *));
-
-/* Routine to create an entry in an ECOFF link hash table. */
-
-static struct bfd_hash_entry *
-ecoff_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct ecoff_link_hash_entry *ret = (struct ecoff_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct ecoff_link_hash_entry *) NULL)
- ret = ((struct ecoff_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct ecoff_link_hash_entry)));
- if (ret == (struct ecoff_link_hash_entry *) NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct ecoff_link_hash_entry *)
- _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
-
- if (ret)
- {
- /* Set local fields. */
- ret->indx = -1;
- ret->abfd = NULL;
- ret->written = 0;
- ret->small = 0;
- }
- memset ((PTR) &ret->esym, 0, sizeof ret->esym);
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create an ECOFF link hash table. */
-
-struct bfd_link_hash_table *
-_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_malloc (amt);
- if (ret == NULL)
- return NULL;
- if (! _bfd_link_hash_table_init (&ret->root, abfd,
- ecoff_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
- return &ret->root;
-}
-
-/* Look up an entry in an ECOFF link hash table. */
-
-#define ecoff_link_hash_lookup(table, string, create, copy, follow) \
- ((struct ecoff_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
-
-/* Traverse an ECOFF link hash table. */
-
-#define ecoff_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the ECOFF link hash table from the info structure. This is
- just a cast. */
-
-#define ecoff_hash_table(p) ((struct ecoff_link_hash_table *) ((p)->hash))
-
-/* Given an ECOFF BFD, add symbols to the global hash table as
- appropriate. */
-
-bfd_boolean
-_bfd_ecoff_bfd_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
- return ecoff_link_add_object_symbols (abfd, info);
- case bfd_archive:
- return ecoff_link_add_archive_symbols (abfd, info);
- default:
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-}
-
-/* Add the symbols from an archive file to the global hash table.
- This looks through the undefined symbols, looks each one up in the
- archive hash table, and adds any associated object file. We do not
- use _bfd_generic_link_add_archive_symbols because ECOFF archives
- already have a hash table, so there is no reason to construct
- another one. */
-
-static bfd_boolean
-ecoff_link_add_archive_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- const bfd_byte *raw_armap;
- struct bfd_link_hash_entry **pundef;
- unsigned int armap_count;
- unsigned int armap_log;
- unsigned int i;
- const bfd_byte *hashtable;
- const char *stringbase;
-
- if (! bfd_has_map (abfd))
- {
- /* An empty archive is a special case. */
- if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
- return TRUE;
- bfd_set_error (bfd_error_no_armap);
- return FALSE;
- }
-
- /* If we don't have any raw data for this archive, as can happen on
- Irix 4.0.5F, we call the generic routine.
- FIXME: We should be more clever about this, since someday tdata
- may get to something for a generic archive. */
- raw_armap = (const bfd_byte *) bfd_ardata (abfd)->tdata;
- if (raw_armap == (bfd_byte *) NULL)
- return (_bfd_generic_link_add_archive_symbols
- (abfd, info, ecoff_link_check_archive_element));
-
- armap_count = H_GET_32 (abfd, raw_armap);
-
- armap_log = 0;
- for (i = 1; i < armap_count; i <<= 1)
- armap_log++;
- BFD_ASSERT (i == armap_count);
-
- hashtable = raw_armap + 4;
- stringbase = (const char *) raw_armap + armap_count * 8 + 8;
-
- /* Look through the list of undefined symbols. */
- pundef = &info->hash->undefs;
- while (*pundef != (struct bfd_link_hash_entry *) NULL)
- {
- struct bfd_link_hash_entry *h;
- unsigned int hash, rehash;
- unsigned int file_offset;
- const char *name;
- bfd *element;
-
- h = *pundef;
-
- /* When a symbol is defined, it is not necessarily removed from
- the list. */
- if (h->type != bfd_link_hash_undefined
- && h->type != bfd_link_hash_common)
- {
- /* Remove this entry from the list, for general cleanliness
- and because we are going to look through the list again
- if we search any more libraries. We can't remove the
- entry if it is the tail, because that would lose any
- entries we add to the list later on. */
- if (*pundef != info->hash->undefs_tail)
- *pundef = (*pundef)->und_next;
- else
- pundef = &(*pundef)->und_next;
- continue;
- }
-
- /* Native ECOFF linkers do not pull in archive elements merely
- to satisfy common definitions, so neither do we. We leave
- them on the list, though, in case we are linking against some
- other object format. */
- if (h->type != bfd_link_hash_undefined)
- {
- pundef = &(*pundef)->und_next;
- continue;
- }
-
- /* Look for this symbol in the archive hash table. */
- hash = ecoff_armap_hash (h->root.string, &rehash, armap_count,
- armap_log);
-
- file_offset = H_GET_32 (abfd, hashtable + (hash * 8) + 4);
- if (file_offset == 0)
- {
- /* Nothing in this slot. */
- pundef = &(*pundef)->und_next;
- continue;
- }
-
- name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8));
- if (name[0] != h->root.string[0]
- || strcmp (name, h->root.string) != 0)
- {
- unsigned int srch;
- bfd_boolean found;
-
- /* That was the wrong symbol. Try rehashing. */
- found = FALSE;
- for (srch = (hash + rehash) & (armap_count - 1);
- srch != hash;
- srch = (srch + rehash) & (armap_count - 1))
- {
- file_offset = H_GET_32 (abfd, hashtable + (srch * 8) + 4);
- if (file_offset == 0)
- break;
- name = stringbase + H_GET_32 (abfd, hashtable + (srch * 8));
- if (name[0] == h->root.string[0]
- && strcmp (name, h->root.string) == 0)
- {
- found = TRUE;
- break;
- }
- }
-
- if (! found)
- {
- pundef = &(*pundef)->und_next;
- continue;
- }
-
- hash = srch;
- }
-
- element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset);
- if (element == (bfd *) NULL)
- return FALSE;
-
- if (! bfd_check_format (element, bfd_object))
- return FALSE;
-
- /* Unlike the generic linker, we know that this element provides
- a definition for an undefined symbol and we know that we want
- to include it. We don't need to check anything. */
- if (! (*info->callbacks->add_archive_element) (info, element, name))
- return FALSE;
- if (! ecoff_link_add_object_symbols (element, info))
- return FALSE;
-
- pundef = &(*pundef)->und_next;
- }
-
- return TRUE;
-}
-
-/* This is called if we used _bfd_generic_link_add_archive_symbols
- because we were not dealing with an ECOFF archive. */
-
-static bfd_boolean
-ecoff_link_check_archive_element (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean *pneeded;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *))
- = backend->debug_swap.swap_ext_in;
- HDRR *symhdr;
- bfd_size_type external_ext_size;
- PTR external_ext = NULL;
- bfd_size_type esize;
- char *ssext = NULL;
- char *ext_ptr;
- char *ext_end;
-
- *pneeded = FALSE;
-
- if (! ecoff_slurp_symbolic_header (abfd))
- goto error_return;
-
- /* If there are no symbols, we don't want it. */
- if (bfd_get_symcount (abfd) == 0)
- goto successful_return;
-
- symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
-
- /* Read in the external symbols and external strings. */
- external_ext_size = backend->debug_swap.external_ext_size;
- esize = symhdr->iextMax * external_ext_size;
- external_ext = (PTR) bfd_malloc (esize);
- if (external_ext == NULL && esize != 0)
- goto error_return;
-
- 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 ((bfd_size_type) symhdr->issExtMax);
- if (ssext == NULL && symhdr->issExtMax != 0)
- goto error_return;
-
- 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
- symbol that is currently undefined. */
- ext_ptr = (char *) external_ext;
- ext_end = ext_ptr + esize;
- for (; ext_ptr < ext_end; ext_ptr += external_ext_size)
- {
- EXTR esym;
- bfd_boolean def;
- const char *name;
- struct bfd_link_hash_entry *h;
-
- (*swap_ext_in) (abfd, (PTR) ext_ptr, &esym);
-
- /* See if this symbol defines something. */
- if (esym.asym.st != stGlobal
- && esym.asym.st != stLabel
- && esym.asym.st != stProc)
- continue;
-
- switch (esym.asym.sc)
- {
- case scText:
- case scData:
- case scBss:
- case scAbs:
- case scSData:
- case scSBss:
- case scRData:
- case scCommon:
- case scSCommon:
- case scInit:
- case scFini:
- case scRConst:
- def = TRUE;
- break;
- default:
- def = FALSE;
- break;
- }
-
- if (! def)
- continue;
-
- name = ssext + esym.asym.iss;
- h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
-
- /* Unlike the generic linker, we do not pull in elements because
- of common symbols. */
- if (h == (struct bfd_link_hash_entry *) NULL
- || h->type != bfd_link_hash_undefined)
- continue;
-
- /* Include this element. */
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- goto error_return;
- if (! ecoff_link_add_externals (abfd, info, external_ext, ssext))
- goto error_return;
-
- *pneeded = TRUE;
- goto successful_return;
- }
-
- successful_return:
- if (external_ext != NULL)
- free (external_ext);
- if (ssext != NULL)
- free (ssext);
- return TRUE;
- error_return:
- if (external_ext != NULL)
- free (external_ext);
- if (ssext != NULL)
- free (ssext);
- return FALSE;
-}
-
-/* Add symbols from an ECOFF object file to the global linker hash
- table. */
-
-static bfd_boolean
-ecoff_link_add_object_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- HDRR *symhdr;
- bfd_size_type external_ext_size;
- PTR external_ext = NULL;
- bfd_size_type esize;
- char *ssext = NULL;
- bfd_boolean result;
-
- if (! ecoff_slurp_symbolic_header (abfd))
- return FALSE;
-
- /* If there are no symbols, we don't want it. */
- if (bfd_get_symcount (abfd) == 0)
- return TRUE;
-
- symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
-
- /* Read in the external symbols and external strings. */
- external_ext_size = ecoff_backend (abfd)->debug_swap.external_ext_size;
- esize = symhdr->iextMax * external_ext_size;
- external_ext = (PTR) bfd_malloc (esize);
- if (external_ext == NULL && esize != 0)
- goto error_return;
-
- 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 ((bfd_size_type) symhdr->issExtMax);
- if (ssext == NULL && symhdr->issExtMax != 0)
- goto error_return;
-
- 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;
-
- result = ecoff_link_add_externals (abfd, info, external_ext, ssext);
-
- if (ssext != NULL)
- free (ssext);
- if (external_ext != NULL)
- free (external_ext);
- return result;
-
- error_return:
- if (ssext != NULL)
- free (ssext);
- if (external_ext != NULL)
- free (external_ext);
- return FALSE;
-}
-
-/* Add the external symbols of an object file to the global linker
- hash table. The external symbols and strings we are passed are
- just allocated on the stack, and will be discarded. We must
- explicitly save any information we may need later on in the link.
- We do not want to read the external symbol information again. */
-
-static bfd_boolean
-ecoff_link_add_externals (abfd, info, external_ext, ssext)
- bfd *abfd;
- struct bfd_link_info *info;
- PTR external_ext;
- char *ssext;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *))
- = backend->debug_swap.swap_ext_in;
- bfd_size_type external_ext_size = backend->debug_swap.external_ext_size;
- unsigned long ext_count;
- struct bfd_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;
-
- amt = ext_count;
- amt *= sizeof (struct bfd_link_hash_entry *);
- sym_hash = (struct bfd_link_hash_entry **) bfd_alloc (abfd, amt);
- if (!sym_hash)
- return FALSE;
- ecoff_data (abfd)->sym_hashes = (struct ecoff_link_hash_entry **) sym_hash;
-
- ext_ptr = (char *) external_ext;
- ext_end = ext_ptr + ext_count * external_ext_size;
- for (; ext_ptr < ext_end; ext_ptr += external_ext_size, sym_hash++)
- {
- EXTR esym;
- bfd_boolean skip;
- bfd_vma value;
- asection *section;
- const char *name;
- struct ecoff_link_hash_entry *h;
-
- *sym_hash = NULL;
-
- (*swap_ext_in) (abfd, (PTR) ext_ptr, &esym);
-
- /* Skip debugging symbols. */
- skip = FALSE;
- switch (esym.asym.st)
- {
- case stGlobal:
- case stStatic:
- case stLabel:
- case stProc:
- case stStaticProc:
- break;
- default:
- skip = TRUE;
- break;
- }
-
- if (skip)
- continue;
-
- /* Get the information for this symbol. */
- value = esym.asym.value;
- switch (esym.asym.sc)
- {
- default:
- case scNil:
- case scRegister:
- case scCdbLocal:
- case scBits:
- case scCdbSystem:
- case scRegImage:
- case scInfo:
- case scUserStruct:
- case scVar:
- case scVarRegister:
- case scVariant:
- case scBasedVar:
- case scXData:
- case scPData:
- section = NULL;
- break;
- case scText:
- section = bfd_make_section_old_way (abfd, ".text");
- value -= section->vma;
- break;
- case scData:
- section = bfd_make_section_old_way (abfd, ".data");
- value -= section->vma;
- break;
- case scBss:
- section = bfd_make_section_old_way (abfd, ".bss");
- value -= section->vma;
- break;
- case scAbs:
- section = bfd_abs_section_ptr;
- break;
- case scUndefined:
- section = bfd_und_section_ptr;
- break;
- case scSData:
- section = bfd_make_section_old_way (abfd, ".sdata");
- value -= section->vma;
- break;
- case scSBss:
- section = bfd_make_section_old_way (abfd, ".sbss");
- value -= section->vma;
- break;
- case scRData:
- section = bfd_make_section_old_way (abfd, ".rdata");
- value -= section->vma;
- break;
- case scCommon:
- if (value > ecoff_data (abfd)->gp_size)
- {
- section = bfd_com_section_ptr;
- break;
- }
- /* Fall through. */
- case scSCommon:
- if (ecoff_scom_section.name == NULL)
- {
- /* Initialize the small common section. */
- ecoff_scom_section.name = SCOMMON;
- ecoff_scom_section.flags = SEC_IS_COMMON;
- ecoff_scom_section.output_section = &ecoff_scom_section;
- ecoff_scom_section.symbol = &ecoff_scom_symbol;
- ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr;
- ecoff_scom_symbol.name = SCOMMON;
- ecoff_scom_symbol.flags = BSF_SECTION_SYM;
- ecoff_scom_symbol.section = &ecoff_scom_section;
- ecoff_scom_symbol_ptr = &ecoff_scom_symbol;
- }
- section = &ecoff_scom_section;
- break;
- case scSUndefined:
- section = bfd_und_section_ptr;
- break;
- case scInit:
- section = bfd_make_section_old_way (abfd, ".init");
- value -= section->vma;
- break;
- case scFini:
- section = bfd_make_section_old_way (abfd, ".fini");
- value -= section->vma;
- break;
- case scRConst:
- section = bfd_make_section_old_way (abfd, ".rconst");
- value -= section->vma;
- break;
- }
-
- if (section == (asection *) NULL)
- continue;
-
- name = ssext + esym.asym.iss;
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name,
- (flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL),
- section, value, (const char *) NULL, TRUE, TRUE, sym_hash)))
- return FALSE;
-
- h = (struct ecoff_link_hash_entry *) *sym_hash;
-
- /* If we are building an ECOFF hash table, save the external
- symbol information. */
- if (info->hash->creator->flavour == bfd_get_flavour (abfd))
- {
- if (h->abfd == (bfd *) NULL
- || (! bfd_is_und_section (section)
- && (! bfd_is_com_section (section)
- || (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak))))
- {
- h->abfd = abfd;
- h->esym = esym;
- }
-
- /* Remember whether this symbol was small undefined. */
- if (esym.asym.sc == scSUndefined)
- h->small = 1;
-
- /* If this symbol was ever small undefined, it needs to wind
- up in a GP relative section. We can't control the
- section of a defined symbol, but we can control the
- section of a common symbol. This case is actually needed
- on Ultrix 4.2 to handle the symbol cred in -lckrb. */
- if (h->small
- && h->root.type == bfd_link_hash_common
- && strcmp (h->root.u.c.p->section->name, SCOMMON) != 0)
- {
- h->root.u.c.p->section = bfd_make_section_old_way (abfd,
- SCOMMON);
- h->root.u.c.p->section->flags = SEC_ALLOC;
- if (h->esym.asym.sc == scCommon)
- h->esym.asym.sc = scSCommon;
- }
- }
- }
-
- return TRUE;
-}
-
-/* ECOFF final link routines. */
-
-static bfd_boolean ecoff_final_link_debug_accumulate
- PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
- PTR handle));
-static bfd_boolean ecoff_link_write_external
- PARAMS ((struct ecoff_link_hash_entry *, PTR));
-static bfd_boolean ecoff_indirect_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
-static bfd_boolean ecoff_reloc_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
-
-/* Structure used to pass information to ecoff_link_write_external. */
-
-struct extsym_info
-{
- bfd *abfd;
- struct bfd_link_info *info;
-};
-
-/* ECOFF final link routine. This looks through all the input BFDs
- and gathers together all the debugging information, and then
- processes all the link order information. This may cause it to
- close and reopen some input BFDs; I'll see how bad this is. */
-
-bfd_boolean
-_bfd_ecoff_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info;
- HDRR *symhdr;
- PTR handle;
- register bfd *input_bfd;
- asection *o;
- struct bfd_link_order *p;
- struct extsym_info einfo;
-
- /* We accumulate the debugging information counts in the symbolic
- header. */
- symhdr = &debug->symbolic_header;
- symhdr->vstamp = 0;
- symhdr->ilineMax = 0;
- symhdr->cbLine = 0;
- symhdr->idnMax = 0;
- symhdr->ipdMax = 0;
- symhdr->isymMax = 0;
- symhdr->ioptMax = 0;
- symhdr->iauxMax = 0;
- symhdr->issMax = 0;
- symhdr->issExtMax = 0;
- symhdr->ifdMax = 0;
- symhdr->crfd = 0;
- symhdr->iextMax = 0;
-
- /* We accumulate the debugging information itself in the debug_info
- structure. */
- debug->line = NULL;
- debug->external_dnr = NULL;
- debug->external_pdr = NULL;
- debug->external_sym = NULL;
- debug->external_opt = NULL;
- debug->external_aux = NULL;
- debug->ss = NULL;
- debug->ssext = debug->ssext_end = NULL;
- debug->external_fdr = NULL;
- debug->external_rfd = NULL;
- debug->external_ext = debug->external_ext_end = NULL;
-
- handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info);
- if (handle == (PTR) NULL)
- return FALSE;
-
- /* Accumulate the debugging symbols from each input BFD. */
- for (input_bfd = info->input_bfds;
- input_bfd != (bfd *) NULL;
- input_bfd = input_bfd->link_next)
- {
- bfd_boolean ret;
-
- if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour)
- {
- /* Arbitrarily set the symbolic header vstamp to the vstamp
- of the first object file in the link. */
- if (symhdr->vstamp == 0)
- symhdr->vstamp
- = ecoff_data (input_bfd)->debug_info.symbolic_header.vstamp;
- ret = ecoff_final_link_debug_accumulate (abfd, input_bfd, info,
- handle);
- }
- else
- ret = bfd_ecoff_debug_accumulate_other (handle, abfd,
- debug, &backend->debug_swap,
- input_bfd, info);
- if (! ret)
- return FALSE;
-
- /* Combine the register masks. */
- ecoff_data (abfd)->gprmask |= ecoff_data (input_bfd)->gprmask;
- ecoff_data (abfd)->fprmask |= ecoff_data (input_bfd)->fprmask;
- ecoff_data (abfd)->cprmask[0] |= ecoff_data (input_bfd)->cprmask[0];
- ecoff_data (abfd)->cprmask[1] |= ecoff_data (input_bfd)->cprmask[1];
- ecoff_data (abfd)->cprmask[2] |= ecoff_data (input_bfd)->cprmask[2];
- ecoff_data (abfd)->cprmask[3] |= ecoff_data (input_bfd)->cprmask[3];
- }
-
- /* Write out the external symbols. */
- einfo.abfd = abfd;
- einfo.info = info;
- ecoff_link_hash_traverse (ecoff_hash_table (info),
- ecoff_link_write_external,
- (PTR) &einfo);
-
- if (info->relocatable)
- {
- /* We need to make a pass over the link_orders to count up the
- number of relocations we will need to output, so that we know
- how much space they will take up. */
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- {
- o->reloc_count = 0;
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- if (p->type == bfd_indirect_link_order)
- o->reloc_count += p->u.indirect.section->reloc_count;
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- ++o->reloc_count;
- }
- }
-
- /* Compute the reloc and symbol file positions. */
- ecoff_compute_reloc_file_positions (abfd);
-
- /* Write out the debugging information. */
- if (! bfd_ecoff_write_accumulated_debug (handle, abfd, debug,
- &backend->debug_swap, info,
- ecoff_data (abfd)->sym_filepos))
- return FALSE;
-
- bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info);
-
- if (info->relocatable)
- {
- /* Now reset the reloc_count field of the sections in the output
- BFD to 0, so that we can use them to keep track of how many
- relocs we have output thus far. */
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- o->reloc_count = 0;
- }
-
- /* Get a value for the GP register. */
- if (ecoff_data (abfd)->gp == 0)
- {
- struct bfd_link_hash_entry *h;
-
- h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE);
- if (h != (struct bfd_link_hash_entry *) NULL
- && h->type == bfd_link_hash_defined)
- ecoff_data (abfd)->gp = (h->u.def.value
- + h->u.def.section->output_section->vma
- + h->u.def.section->output_offset);
- else if (info->relocatable)
- {
- bfd_vma lo;
-
- /* Make up a value. */
- lo = (bfd_vma) -1;
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- {
- if (o->vma < lo
- && (strcmp (o->name, _SBSS) == 0
- || strcmp (o->name, _SDATA) == 0
- || strcmp (o->name, _LIT4) == 0
- || strcmp (o->name, _LIT8) == 0
- || strcmp (o->name, _LITA) == 0))
- lo = o->vma;
- }
- ecoff_data (abfd)->gp = lo + 0x8000;
- }
- else
- {
- /* If the relocate_section function needs to do a reloc
- involving the GP value, it should make a reloc_dangerous
- callback to warn that GP is not defined. */
- }
- }
-
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- {
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- {
- if (p->type == bfd_indirect_link_order
- && (bfd_get_flavour (p->u.indirect.section->owner)
- == bfd_target_ecoff_flavour))
- {
- if (! ecoff_indirect_link_order (abfd, info, o, p))
- return FALSE;
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- if (! ecoff_reloc_link_order (abfd, info, o, p))
- return FALSE;
- }
- else
- {
- if (! _bfd_default_link_order (abfd, info, o, p))
- return FALSE;
- }
- }
- }
-
- bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax;
-
- ecoff_data (abfd)->linker = TRUE;
-
- return TRUE;
-}
-
-/* Accumulate the debugging information for an input BFD into the
- output BFD. This must read in the symbolic information of the
- input BFD. */
-
-static bfd_boolean
-ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
- bfd *output_bfd;
- bfd *input_bfd;
- struct bfd_link_info *info;
- PTR handle;
-{
- struct ecoff_debug_info * const debug = &ecoff_data (input_bfd)->debug_info;
- const struct ecoff_debug_swap * const swap =
- &ecoff_backend (input_bfd)->debug_swap;
- HDRR *symhdr = &debug->symbolic_header;
- bfd_boolean ret;
-
-#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
- _bfd_ecoff_slurp_symbolic_info. */
- if (ecoff_data (input_bfd)->raw_syments == NULL)
- {
- READ (line, cbLineOffset, cbLine, sizeof (unsigned char),
- unsigned char *);
- READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR);
- READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR);
- READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR);
- READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR);
- READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext),
- union aux_ext *);
- READ (ss, cbSsOffset, issMax, sizeof (char), char *);
- READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR);
- READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR);
- }
-#undef READ
-
- /* We do not read the external strings or the external symbols. */
-
- ret = (bfd_ecoff_debug_accumulate
- (handle, output_bfd, &ecoff_data (output_bfd)->debug_info,
- &ecoff_backend (output_bfd)->debug_swap,
- input_bfd, debug, swap, info));
-
- return_something:
- if (ecoff_data (input_bfd)->raw_syments == NULL)
- {
- if (debug->line != NULL)
- free (debug->line);
- if (debug->external_dnr != NULL)
- free (debug->external_dnr);
- if (debug->external_pdr != NULL)
- free (debug->external_pdr);
- if (debug->external_sym != NULL)
- free (debug->external_sym);
- if (debug->external_opt != NULL)
- free (debug->external_opt);
- if (debug->external_aux != NULL)
- free (debug->external_aux);
- if (debug->ss != NULL)
- free (debug->ss);
- if (debug->external_fdr != NULL)
- free (debug->external_fdr);
- if (debug->external_rfd != NULL)
- free (debug->external_rfd);
-
- /* Make sure we don't accidentally follow one of these pointers
- into freed memory. */
- debug->line = NULL;
- debug->external_dnr = NULL;
- debug->external_pdr = NULL;
- debug->external_sym = NULL;
- debug->external_opt = NULL;
- debug->external_aux = NULL;
- debug->ss = NULL;
- debug->external_fdr = NULL;
- debug->external_rfd = NULL;
- }
-
- return ret;
-}
-
-/* Put out information for an external symbol. These come only from
- the hash table. */
-
-static bfd_boolean
-ecoff_link_write_external (h, data)
- struct ecoff_link_hash_entry *h;
- PTR data;
-{
- struct extsym_info *einfo = (struct extsym_info *) data;
- bfd *output_bfd = einfo->abfd;
- bfd_boolean strip;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h = (struct ecoff_link_hash_entry *) h->root.u.i.link;
- if (h->root.type == bfd_link_hash_new)
- return TRUE;
- }
-
- /* We need to check if this symbol is being stripped. */
- if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- strip = FALSE;
- else if (einfo->info->strip == strip_all
- || (einfo->info->strip == strip_some
- && bfd_hash_lookup (einfo->info->keep_hash,
- h->root.root.string,
- FALSE, FALSE) == NULL))
- strip = TRUE;
- else
- strip = FALSE;
-
- if (strip || h->written)
- return TRUE;
-
- if (h->abfd == (bfd *) NULL)
- {
- h->esym.jmptbl = 0;
- h->esym.cobol_main = 0;
- h->esym.weakext = 0;
- h->esym.reserved = 0;
- h->esym.ifd = ifdNil;
- h->esym.asym.value = 0;
- h->esym.asym.st = stGlobal;
-
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- h->esym.asym.sc = scAbs;
- else
- {
- asection *output_section;
- const char *name;
-
- output_section = h->root.u.def.section->output_section;
- name = bfd_section_name (output_section->owner, output_section);
-
- if (strcmp (name, _TEXT) == 0)
- h->esym.asym.sc = scText;
- else if (strcmp (name, _DATA) == 0)
- h->esym.asym.sc = scData;
- else if (strcmp (name, _SDATA) == 0)
- h->esym.asym.sc = scSData;
- else if (strcmp (name, _RDATA) == 0)
- h->esym.asym.sc = scRData;
- else if (strcmp (name, _BSS) == 0)
- h->esym.asym.sc = scBss;
- else if (strcmp (name, _SBSS) == 0)
- h->esym.asym.sc = scSBss;
- else if (strcmp (name, _INIT) == 0)
- h->esym.asym.sc = scInit;
- else if (strcmp (name, _FINI) == 0)
- h->esym.asym.sc = scFini;
- else if (strcmp (name, _PDATA) == 0)
- h->esym.asym.sc = scPData;
- else if (strcmp (name, _XDATA) == 0)
- h->esym.asym.sc = scXData;
- else if (strcmp (name, _RCONST) == 0)
- h->esym.asym.sc = scRConst;
- else
- h->esym.asym.sc = scAbs;
- }
-
- h->esym.asym.reserved = 0;
- h->esym.asym.index = indexNil;
- }
- else if (h->esym.ifd != -1)
- {
- struct ecoff_debug_info *debug;
-
- /* Adjust the FDR index for the symbol by that used for the
- input BFD. */
- debug = &ecoff_data (h->abfd)->debug_info;
- BFD_ASSERT (h->esym.ifd >= 0
- && h->esym.ifd < debug->symbolic_header.ifdMax);
- h->esym.ifd = debug->ifdmap[h->esym.ifd];
- }
-
- switch (h->root.type)
- {
- default:
- case bfd_link_hash_warning:
- case bfd_link_hash_new:
- abort ();
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- if (h->esym.asym.sc != scUndefined
- && h->esym.asym.sc != scSUndefined)
- h->esym.asym.sc = scUndefined;
- break;
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- if (h->esym.asym.sc == scUndefined
- || h->esym.asym.sc == scSUndefined)
- h->esym.asym.sc = scAbs;
- else if (h->esym.asym.sc == scCommon)
- h->esym.asym.sc = scBss;
- else if (h->esym.asym.sc == scSCommon)
- h->esym.asym.sc = scSBss;
- h->esym.asym.value = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- break;
- case bfd_link_hash_common:
- if (h->esym.asym.sc != scCommon
- && h->esym.asym.sc != scSCommon)
- h->esym.asym.sc = scCommon;
- h->esym.asym.value = h->root.u.c.size;
- break;
- case bfd_link_hash_indirect:
- /* We ignore these symbols, since the indirected symbol is
- already in the hash table. */
- return TRUE;
- }
-
- /* bfd_ecoff_debug_one_external uses iextMax to keep track of the
- symbol number. */
- h->indx = ecoff_data (output_bfd)->debug_info.symbolic_header.iextMax;
- h->written = 1;
-
- return (bfd_ecoff_debug_one_external
- (output_bfd, &ecoff_data (output_bfd)->debug_info,
- &ecoff_backend (output_bfd)->debug_swap, h->root.root.string,
- &h->esym));
-}
-
-/* Relocate and write an ECOFF section into an ECOFF output file. */
-
-static bfd_boolean
-ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
- bfd *output_bfd;
- struct bfd_link_info *info;
- asection *output_section;
- struct bfd_link_order *link_order;
-{
- asection *input_section;
- bfd *input_bfd;
- struct ecoff_section_tdata *section_tdata;
- bfd_size_type raw_size;
- bfd_size_type cooked_size;
- bfd_byte *contents = NULL;
- 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);
-
- if (link_order->size == 0)
- return TRUE;
-
- input_section = link_order->u.indirect.section;
- input_bfd = input_section->owner;
- section_tdata = ecoff_section_data (input_bfd, input_section);
-
- raw_size = input_section->_raw_size;
- cooked_size = input_section->_cooked_size;
- if (cooked_size == 0)
- cooked_size = raw_size;
-
- BFD_ASSERT (input_section->output_section == output_section);
- BFD_ASSERT (input_section->output_offset == link_order->offset);
- BFD_ASSERT (cooked_size == link_order->size);
-
- /* Get the section contents. We allocate memory for the larger of
- the size before relocating and the size after relocating. */
- 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
- memory, in which case we copy them into our new buffer. We don't
- simply reuse the old buffer in case cooked_size > raw_size. */
- if (section_tdata != (struct ecoff_section_tdata *) NULL
- && section_tdata->contents != (bfd_byte *) NULL)
- memcpy (contents, section_tdata->contents, (size_t) raw_size);
- else
- {
- if (! bfd_get_section_contents (input_bfd, input_section,
- (PTR) contents,
- (file_ptr) 0, raw_size))
- goto error_return;
- }
-
- /* Get the relocs. If we are relaxing MIPS code, they will already
- have been read in. Otherwise, we read them in now. */
- external_reloc_size = ecoff_backend (input_bfd)->external_reloc_size;
- external_relocs_size = external_reloc_size * input_section->reloc_count;
-
- if (section_tdata != (struct ecoff_section_tdata *) NULL
- && section_tdata->external_relocs != NULL)
- external_relocs = section_tdata->external_relocs;
- else
- {
- 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_bread (external_relocs, external_relocs_size, input_bfd)
- != external_relocs_size))
- goto error_return;
- }
-
- /* Relocate the section contents. */
- if (! ((*ecoff_backend (input_bfd)->relocate_section)
- (output_bfd, info, input_bfd, input_section, contents,
- external_relocs)))
- goto error_return;
-
- /* Write out the relocated section. */
- if (! bfd_set_section_contents (output_bfd,
- output_section,
- (PTR) contents,
- (file_ptr) input_section->output_offset,
- cooked_size))
- goto error_return;
-
- /* If we are producing relocatable output, the relocs were
- modified, and we write them out now. We use the reloc_count
- field of output_section to keep track of the number of relocs we
- have output so far. */
- if (info->relocatable)
- {
- 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;
- }
-
- if (contents != NULL)
- free (contents);
- if (external_relocs != NULL && section_tdata == NULL)
- free (external_relocs);
- return TRUE;
-
- error_return:
- if (contents != NULL)
- free (contents);
- if (external_relocs != NULL && section_tdata == NULL)
- free (external_relocs);
- return FALSE;
-}
-
-/* Generate a reloc when linking an ECOFF file. This is a reloc
- requested by the linker, and does come from any input file. This
- is used to build constructor and destructor tables when linking
- with -Ur. */
-
-static bfd_boolean
-ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
- bfd *output_bfd;
- struct bfd_link_info *info;
- asection *output_section;
- struct bfd_link_order *link_order;
-{
- enum bfd_link_order_type type;
- asection *section;
- bfd_vma addend;
- arelent rel;
- struct internal_reloc in;
- bfd_size_type external_reloc_size;
- bfd_byte *rbuf;
- bfd_boolean ok;
- file_ptr pos;
-
- type = link_order->type;
- section = NULL;
- addend = link_order->u.reloc.p->addend;
-
- /* We set up an arelent to pass to the backend adjust_reloc_out
- routine. */
- rel.address = link_order->offset;
-
- rel.howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
- if (rel.howto == 0)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (type == bfd_section_reloc_link_order)
- {
- section = link_order->u.reloc.p->u.section;
- rel.sym_ptr_ptr = section->symbol_ptr_ptr;
- }
- else
- {
- struct bfd_link_hash_entry *h;
-
- /* Treat a reloc against a defined symbol as though it were
- actually against the section. */
- h = bfd_wrapped_link_hash_lookup (output_bfd, info,
- link_order->u.reloc.p->u.name,
- FALSE, FALSE, FALSE);
- if (h != NULL
- && (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_defweak))
- {
- type = bfd_section_reloc_link_order;
- section = h->u.def.section->output_section;
- /* It seems that we ought to add the symbol value to the
- addend here, but in practice it has already been added
- because it was passed to constructor_callback. */
- addend += section->vma + h->u.def.section->output_offset;
- }
- else
- {
- /* We can't set up a reloc against a symbol correctly,
- because we have no asymbol structure. Currently no
- adjust_reloc_out routine cares. */
- rel.sym_ptr_ptr = (asymbol **) NULL;
- }
- }
-
- /* All ECOFF relocs are in-place. Put the addend into the object
- file. */
-
- BFD_ASSERT (rel.howto->partial_inplace);
- if (addend != 0)
- {
- bfd_size_type size;
- bfd_reloc_status_type rstat;
- bfd_byte *buf;
-
- 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,
- (bfd_vma) addend, buf);
- switch (rstat)
- {
- case bfd_reloc_ok:
- break;
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- if (! ((*info->callbacks->reloc_overflow)
- (info,
- (link_order->type == bfd_section_reloc_link_order
- ? bfd_section_name (output_bfd, section)
- : link_order->u.reloc.p->u.name),
- rel.howto->name, addend, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- {
- free (buf);
- return FALSE;
- }
- break;
- }
- ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
- (file_ptr) link_order->offset, size);
- free (buf);
- if (! ok)
- return FALSE;
- }
-
- rel.addend = 0;
-
- /* Move the information into an internal_reloc structure. */
- in.r_vaddr = (rel.address
- + bfd_get_section_vma (output_bfd, output_section));
- in.r_type = rel.howto->type;
-
- if (type == bfd_symbol_reloc_link_order)
- {
- struct ecoff_link_hash_entry *h;
-
- h = ((struct ecoff_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, info,
- link_order->u.reloc.p->u.name,
- FALSE, FALSE, TRUE));
- if (h != (struct ecoff_link_hash_entry *) NULL
- && h->indx != -1)
- in.r_symndx = h->indx;
- else
- {
- if (! ((*info->callbacks->unattached_reloc)
- (info, link_order->u.reloc.p->u.name, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- return FALSE;
- in.r_symndx = 0;
- }
- in.r_extern = 1;
- }
- else
- {
- const char *name;
-
- name = bfd_get_section_name (output_bfd, section);
- if (strcmp (name, ".text") == 0)
- in.r_symndx = RELOC_SECTION_TEXT;
- else if (strcmp (name, ".rdata") == 0)
- in.r_symndx = RELOC_SECTION_RDATA;
- else if (strcmp (name, ".data") == 0)
- in.r_symndx = RELOC_SECTION_DATA;
- else if (strcmp (name, ".sdata") == 0)
- in.r_symndx = RELOC_SECTION_SDATA;
- else if (strcmp (name, ".sbss") == 0)
- in.r_symndx = RELOC_SECTION_SBSS;
- else if (strcmp (name, ".bss") == 0)
- in.r_symndx = RELOC_SECTION_BSS;
- else if (strcmp (name, ".init") == 0)
- in.r_symndx = RELOC_SECTION_INIT;
- else if (strcmp (name, ".lit8") == 0)
- in.r_symndx = RELOC_SECTION_LIT8;
- else if (strcmp (name, ".lit4") == 0)
- in.r_symndx = RELOC_SECTION_LIT4;
- else if (strcmp (name, ".xdata") == 0)
- in.r_symndx = RELOC_SECTION_XDATA;
- else if (strcmp (name, ".pdata") == 0)
- in.r_symndx = RELOC_SECTION_PDATA;
- else if (strcmp (name, ".fini") == 0)
- in.r_symndx = RELOC_SECTION_FINI;
- else if (strcmp (name, ".lita") == 0)
- in.r_symndx = RELOC_SECTION_LITA;
- else if (strcmp (name, "*ABS*") == 0)
- in.r_symndx = RELOC_SECTION_ABS;
- else if (strcmp (name, ".rconst") == 0)
- in.r_symndx = RELOC_SECTION_RCONST;
- else
- abort ();
- in.r_extern = 0;
- }
-
- /* Let the BFD backend adjust the reloc. */
- (*ecoff_backend (output_bfd)->adjust_reloc_out) (output_bfd, &rel, &in);
-
- /* Get some memory and swap out the reloc. */
- external_reloc_size = ecoff_backend (output_bfd)->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);
-
- 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)
- ++output_section->reloc_count;
-
- free (rbuf);
-
- return ok;
-}
diff --git a/contrib/binutils/bfd/ecofflink.c b/contrib/binutils/bfd/ecofflink.c
deleted file mode 100644
index 9e23848..0000000
--- a/contrib/binutils/bfd/ecofflink.c
+++ /dev/null
@@ -1,2611 +0,0 @@
-/* Routines to link ECOFF debugging information.
- Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "objalloc.h"
-#include "aout/stab_gnu.h"
-#include "coff/internal.h"
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/ecoff.h"
-#include "libcoff.h"
-#include "libecoff.h"
-
-static bfd_boolean ecoff_add_bytes
- PARAMS ((char **buf, char **bufend, size_t need));
-static struct bfd_hash_entry *string_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- const char *));
-static void ecoff_align_debug
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap));
-static bfd_boolean ecoff_write_symhdr
- PARAMS ((bfd *, struct ecoff_debug_info *, const struct ecoff_debug_swap *,
- file_ptr where));
-static int cmp_fdrtab_entry
- PARAMS ((const PTR, const PTR));
-static bfd_boolean mk_fdrtab
- PARAMS ((bfd *, struct ecoff_debug_info * const,
- const struct ecoff_debug_swap * const, struct ecoff_find_line *));
-static long fdrtab_lookup
- PARAMS ((struct ecoff_find_line *, bfd_vma));
-static bfd_boolean lookup_line
- PARAMS ((bfd *, struct ecoff_debug_info * const,
- const struct ecoff_debug_swap * const, struct ecoff_find_line *));
-
-/* Routines to swap auxiliary information in and out. I am assuming
- that the auxiliary information format is always going to be target
- independent. */
-
-/* Swap in a type information record.
- BIGEND says whether AUX symbols are big-endian or little-endian; this
- info comes from the file header record (fh-fBigendian). */
-
-void
-_bfd_ecoff_swap_tir_in (bigend, ext_copy, intern)
- int bigend;
- const struct tir_ext *ext_copy;
- TIR *intern;
-{
- struct tir_ext ext[1];
-
- *ext = *ext_copy; /* Make it reasonable to do in-place. */
-
- /* now the fun stuff... */
- if (bigend) {
- intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_BIG);
- intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_BIG);
- intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_BIG)
- >> TIR_BITS1_BT_SH_BIG;
- intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_BIG)
- >> TIR_BITS_TQ4_SH_BIG;
- intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_BIG)
- >> TIR_BITS_TQ5_SH_BIG;
- intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_BIG)
- >> TIR_BITS_TQ0_SH_BIG;
- intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_BIG)
- >> TIR_BITS_TQ1_SH_BIG;
- intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_BIG)
- >> TIR_BITS_TQ2_SH_BIG;
- intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_BIG)
- >> TIR_BITS_TQ3_SH_BIG;
- } else {
- intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_LITTLE);
- intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_LITTLE);
- intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_LITTLE)
- >> TIR_BITS1_BT_SH_LITTLE;
- intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_LITTLE)
- >> TIR_BITS_TQ4_SH_LITTLE;
- intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_LITTLE)
- >> TIR_BITS_TQ5_SH_LITTLE;
- intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_LITTLE)
- >> TIR_BITS_TQ0_SH_LITTLE;
- intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_LITTLE)
- >> TIR_BITS_TQ1_SH_LITTLE;
- intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_LITTLE)
- >> TIR_BITS_TQ2_SH_LITTLE;
- intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_LITTLE)
- >> TIR_BITS_TQ3_SH_LITTLE;
- }
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap out a type information record.
- BIGEND says whether AUX symbols are big-endian or little-endian; this
- info comes from the file header record (fh-fBigendian). */
-
-void
-_bfd_ecoff_swap_tir_out (bigend, intern_copy, ext)
- int bigend;
- const TIR *intern_copy;
- struct tir_ext *ext;
-{
- TIR intern[1];
-
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
-
- /* now the fun stuff... */
- if (bigend) {
- ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_BIG : 0)
- | (intern->continued ? TIR_BITS1_CONTINUED_BIG : 0)
- | ((intern->bt << TIR_BITS1_BT_SH_BIG)
- & TIR_BITS1_BT_BIG));
- ext->t_tq45[0] = (((intern->tq4 << TIR_BITS_TQ4_SH_BIG)
- & TIR_BITS_TQ4_BIG)
- | ((intern->tq5 << TIR_BITS_TQ5_SH_BIG)
- & TIR_BITS_TQ5_BIG));
- ext->t_tq01[0] = (((intern->tq0 << TIR_BITS_TQ0_SH_BIG)
- & TIR_BITS_TQ0_BIG)
- | ((intern->tq1 << TIR_BITS_TQ1_SH_BIG)
- & TIR_BITS_TQ1_BIG));
- ext->t_tq23[0] = (((intern->tq2 << TIR_BITS_TQ2_SH_BIG)
- & TIR_BITS_TQ2_BIG)
- | ((intern->tq3 << TIR_BITS_TQ3_SH_BIG)
- & TIR_BITS_TQ3_BIG));
- } else {
- ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_LITTLE : 0)
- | (intern->continued ? TIR_BITS1_CONTINUED_LITTLE : 0)
- | ((intern->bt << TIR_BITS1_BT_SH_LITTLE)
- & TIR_BITS1_BT_LITTLE));
- ext->t_tq45[0] = (((intern->tq4 << TIR_BITS_TQ4_SH_LITTLE)
- & TIR_BITS_TQ4_LITTLE)
- | ((intern->tq5 << TIR_BITS_TQ5_SH_LITTLE)
- & TIR_BITS_TQ5_LITTLE));
- ext->t_tq01[0] = (((intern->tq0 << TIR_BITS_TQ0_SH_LITTLE)
- & TIR_BITS_TQ0_LITTLE)
- | ((intern->tq1 << TIR_BITS_TQ1_SH_LITTLE)
- & TIR_BITS_TQ1_LITTLE));
- ext->t_tq23[0] = (((intern->tq2 << TIR_BITS_TQ2_SH_LITTLE)
- & TIR_BITS_TQ2_LITTLE)
- | ((intern->tq3 << TIR_BITS_TQ3_SH_LITTLE)
- & TIR_BITS_TQ3_LITTLE));
- }
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap in a relative symbol record. BIGEND says whether it is in
- big-endian or little-endian format.*/
-
-void
-_bfd_ecoff_swap_rndx_in (bigend, ext_copy, intern)
- int bigend;
- const struct rndx_ext *ext_copy;
- RNDXR *intern;
-{
- struct rndx_ext ext[1];
-
- *ext = *ext_copy; /* Make it reasonable to do in-place. */
-
- /* now the fun stuff... */
- if (bigend) {
- intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_BIG)
- | ((ext->r_bits[1] & RNDX_BITS1_RFD_BIG)
- >> RNDX_BITS1_RFD_SH_BIG);
- intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_BIG)
- << RNDX_BITS1_INDEX_SH_LEFT_BIG)
- | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_BIG)
- | (ext->r_bits[3] << RNDX_BITS3_INDEX_SH_LEFT_BIG);
- } else {
- intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_LITTLE)
- | ((ext->r_bits[1] & RNDX_BITS1_RFD_LITTLE)
- << RNDX_BITS1_RFD_SH_LEFT_LITTLE);
- intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_LITTLE)
- >> RNDX_BITS1_INDEX_SH_LITTLE)
- | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_LITTLE)
- | ((unsigned int) ext->r_bits[3]
- << RNDX_BITS3_INDEX_SH_LEFT_LITTLE);
- }
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap out a relative symbol record. BIGEND says whether it is in
- big-endian or little-endian format.*/
-
-void
-_bfd_ecoff_swap_rndx_out (bigend, intern_copy, ext)
- int bigend;
- const RNDXR *intern_copy;
- struct rndx_ext *ext;
-{
- RNDXR intern[1];
-
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
-
- /* now the fun stuff... */
- if (bigend) {
- ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_BIG;
- ext->r_bits[1] = (((intern->rfd << RNDX_BITS1_RFD_SH_BIG)
- & RNDX_BITS1_RFD_BIG)
- | ((intern->index >> RNDX_BITS1_INDEX_SH_LEFT_BIG)
- & RNDX_BITS1_INDEX_BIG));
- ext->r_bits[2] = intern->index >> RNDX_BITS2_INDEX_SH_LEFT_BIG;
- ext->r_bits[3] = intern->index >> RNDX_BITS3_INDEX_SH_LEFT_BIG;
- } else {
- ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_LITTLE;
- ext->r_bits[1] = (((intern->rfd >> RNDX_BITS1_RFD_SH_LEFT_LITTLE)
- & RNDX_BITS1_RFD_LITTLE)
- | ((intern->index << RNDX_BITS1_INDEX_SH_LITTLE)
- & RNDX_BITS1_INDEX_LITTLE));
- ext->r_bits[2] = intern->index >> RNDX_BITS2_INDEX_SH_LEFT_LITTLE;
- ext->r_bits[3] = intern->index >> RNDX_BITS3_INDEX_SH_LEFT_LITTLE;
- }
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* The minimum amount of data to allocate. */
-#define ALLOC_SIZE (4064)
-
-/* Add bytes to a buffer. Return success. */
-
-static bfd_boolean
-ecoff_add_bytes (buf, bufend, need)
- char **buf;
- char **bufend;
- size_t need;
-{
- size_t have;
- size_t want;
- char *newbuf;
-
- have = *bufend - *buf;
- if (have > need)
- want = ALLOC_SIZE;
- else
- {
- want = need - have;
- if (want < ALLOC_SIZE)
- want = ALLOC_SIZE;
- }
- newbuf = (char *) bfd_realloc (*buf, (bfd_size_type) have + want);
- if (newbuf == NULL)
- return FALSE;
- *buf = newbuf;
- *bufend = *buf + have + want;
- return TRUE;
-}
-
-/* We keep a hash table which maps strings to numbers. We use it to
- map FDR names to indices in the output file, and to map local
- strings when combining stabs debugging information. */
-
-struct string_hash_entry
-{
- struct bfd_hash_entry root;
- /* FDR index or string table offset. */
- long val;
- /* Next entry in string table. */
- struct string_hash_entry *next;
-};
-
-struct string_hash_table
-{
- struct bfd_hash_table table;
-};
-
-/* Routine to create an entry in a string hash table. */
-
-static struct bfd_hash_entry *
-string_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct string_hash_entry *ret = (struct string_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct string_hash_entry *) NULL)
- ret = ((struct string_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct string_hash_entry)));
- if (ret == (struct string_hash_entry *) NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct string_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
- if (ret)
- {
- /* Initialize the local fields. */
- ret->val = -1;
- ret->next = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Look up an entry in an string hash table. */
-
-#define string_hash_lookup(t, string, create, copy) \
- ((struct string_hash_entry *) \
- bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
-
-/* We can't afford to read in all the debugging information when we do
- a link. Instead, we build a list of these structures to show how
- different parts of the input file map to the output file. */
-
-struct shuffle
-{
- /* The next entry in this linked list. */
- struct shuffle *next;
- /* The length of the information. */
- unsigned long size;
- /* Whether this information comes from a file or not. */
- bfd_boolean filep;
- union
- {
- struct
- {
- /* The BFD the data comes from. */
- bfd *input_bfd;
- /* The offset within input_bfd. */
- file_ptr offset;
- } file;
- /* The data to be written out. */
- PTR memory;
- } u;
-};
-
-/* This structure holds information across calls to
- bfd_ecoff_debug_accumulate. */
-
-struct accumulate
-{
- /* The FDR hash table. */
- struct string_hash_table fdr_hash;
- /* The strings hash table. */
- struct string_hash_table str_hash;
- /* Linked lists describing how to shuffle the input debug
- information into the output file. We keep a pointer to both the
- head and the tail. */
- struct shuffle *line;
- struct shuffle *line_end;
- struct shuffle *pdr;
- struct shuffle *pdr_end;
- struct shuffle *sym;
- struct shuffle *sym_end;
- struct shuffle *opt;
- struct shuffle *opt_end;
- struct shuffle *aux;
- struct shuffle *aux_end;
- struct shuffle *ss;
- struct shuffle *ss_end;
- struct string_hash_entry *ss_hash;
- struct string_hash_entry *ss_hash_end;
- struct shuffle *fdr;
- struct shuffle *fdr_end;
- struct shuffle *rfd;
- struct shuffle *rfd_end;
- /* The size of the largest file shuffle. */
- unsigned long largest_file_shuffle;
- /* An objalloc for debugging information. */
- struct objalloc *memory;
-};
-
-/* Add a file entry to a shuffle list. */
-
-static bfd_boolean add_file_shuffle
- PARAMS ((struct accumulate *, struct shuffle **, struct shuffle **,
- bfd *, file_ptr, unsigned long));
-
-static bfd_boolean
-add_file_shuffle (ainfo, head, tail, input_bfd, offset, size)
- struct accumulate *ainfo;
- struct shuffle **head;
- struct shuffle **tail;
- bfd *input_bfd;
- file_ptr offset;
- unsigned long size;
-{
- struct shuffle *n;
-
- if (*tail != (struct shuffle *) NULL
- && (*tail)->filep
- && (*tail)->u.file.input_bfd == input_bfd
- && (*tail)->u.file.offset + (*tail)->size == (unsigned long) offset)
- {
- /* Just merge this entry onto the existing one. */
- (*tail)->size += size;
- if ((*tail)->size > ainfo->largest_file_shuffle)
- ainfo->largest_file_shuffle = (*tail)->size;
- return TRUE;
- }
-
- n = (struct shuffle *) objalloc_alloc (ainfo->memory,
- sizeof (struct shuffle));
- if (!n)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- n->next = NULL;
- n->size = size;
- n->filep = TRUE;
- n->u.file.input_bfd = input_bfd;
- n->u.file.offset = offset;
- if (*head == (struct shuffle *) NULL)
- *head = n;
- if (*tail != (struct shuffle *) NULL)
- (*tail)->next = n;
- *tail = n;
- if (size > ainfo->largest_file_shuffle)
- ainfo->largest_file_shuffle = size;
- return TRUE;
-}
-
-/* Add a memory entry to a shuffle list. */
-
-static bfd_boolean add_memory_shuffle
- PARAMS ((struct accumulate *, struct shuffle **head, struct shuffle **tail,
- bfd_byte *data, unsigned long size));
-
-static bfd_boolean
-add_memory_shuffle (ainfo, head, tail, data, size)
- struct accumulate *ainfo;
- struct shuffle **head;
- struct shuffle **tail;
- bfd_byte *data;
- unsigned long size;
-{
- struct shuffle *n;
-
- n = (struct shuffle *) objalloc_alloc (ainfo->memory,
- sizeof (struct shuffle));
- if (!n)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- n->next = NULL;
- n->size = size;
- n->filep = FALSE;
- n->u.memory = (PTR) data;
- if (*head == (struct shuffle *) NULL)
- *head = n;
- if (*tail != (struct shuffle *) NULL)
- (*tail)->next = n;
- *tail = n;
- return TRUE;
-}
-
-/* Initialize the FDR hash table. This returns a handle which is then
- passed in to bfd_ecoff_debug_accumulate, et. al. */
-
-PTR
-bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct ecoff_debug_info *output_debug;
- const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- struct accumulate *ainfo;
- bfd_size_type amt = 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,
- 1021))
- return NULL;
-
- ainfo->line = NULL;
- ainfo->line_end = NULL;
- ainfo->pdr = NULL;
- ainfo->pdr_end = NULL;
- ainfo->sym = NULL;
- ainfo->sym_end = NULL;
- ainfo->opt = NULL;
- ainfo->opt_end = NULL;
- ainfo->aux = NULL;
- ainfo->aux_end = NULL;
- ainfo->ss = NULL;
- ainfo->ss_end = NULL;
- ainfo->ss_hash = NULL;
- ainfo->ss_hash_end = NULL;
- ainfo->fdr = NULL;
- ainfo->fdr_end = NULL;
- ainfo->rfd = NULL;
- ainfo->rfd_end = NULL;
-
- ainfo->largest_file_shuffle = 0;
-
- if (! info->relocatable)
- {
- if (! bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc))
- return NULL;
-
- /* The first entry in the string table is the empty string. */
- output_debug->symbolic_header.issMax = 1;
- }
-
- ainfo->memory = objalloc_create ();
- if (ainfo->memory == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
-
- return (PTR) ainfo;
-}
-
-/* Free the accumulated debugging information. */
-
-void
-bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
- PTR handle;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct ecoff_debug_info *output_debug ATTRIBUTE_UNUSED;
- const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- struct accumulate *ainfo = (struct accumulate *) handle;
-
- bfd_hash_table_free (&ainfo->fdr_hash.table);
-
- if (! info->relocatable)
- bfd_hash_table_free (&ainfo->str_hash.table);
-
- objalloc_free (ainfo->memory);
-
- free (ainfo);
-}
-
-/* Accumulate the debugging information from INPUT_BFD into
- OUTPUT_BFD. The INPUT_DEBUG argument points to some ECOFF
- debugging information which we want to link into the information
- pointed to by the OUTPUT_DEBUG argument. OUTPUT_SWAP and
- INPUT_SWAP point to the swapping information needed. INFO is the
- linker information structure. HANDLE is returned by
- bfd_ecoff_debug_init. */
-
-bfd_boolean
-bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
- input_bfd, input_debug, input_swap,
- info)
- PTR handle;
- bfd *output_bfd;
- struct ecoff_debug_info *output_debug;
- const struct ecoff_debug_swap *output_swap;
- bfd *input_bfd;
- struct ecoff_debug_info *input_debug;
- const struct ecoff_debug_swap *input_swap;
- struct bfd_link_info *info;
-{
- struct accumulate *ainfo = (struct accumulate *) handle;
- void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *))
- = input_swap->swap_sym_in;
- void (* const swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *))
- = input_swap->swap_rfd_in;
- void (* const swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR))
- = output_swap->swap_sym_out;
- void (* const swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR))
- = output_swap->swap_fdr_out;
- void (* const swap_rfd_out) PARAMS ((bfd *, const RFDT *, PTR))
- = output_swap->swap_rfd_out;
- bfd_size_type external_pdr_size = output_swap->external_pdr_size;
- bfd_size_type external_sym_size = output_swap->external_sym_size;
- bfd_size_type external_opt_size = output_swap->external_opt_size;
- bfd_size_type external_fdr_size = output_swap->external_fdr_size;
- bfd_size_type external_rfd_size = output_swap->external_rfd_size;
- HDRR * const output_symhdr = &output_debug->symbolic_header;
- HDRR * const input_symhdr = &input_debug->symbolic_header;
- bfd_vma section_adjust[scMax];
- asection *sec;
- bfd_byte *fdr_start;
- bfd_byte *fdr_ptr;
- bfd_byte *fdr_end;
- bfd_size_type fdr_add;
- unsigned int copied;
- RFDT i;
- unsigned long sz;
- bfd_byte *rfd_out;
- bfd_byte *rfd_in;
- bfd_byte *rfd_end;
- 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. */
- memset ((PTR) section_adjust, 0, sizeof section_adjust);
-
-#define SET(name, indx) \
- sec = bfd_get_section_by_name (input_bfd, name); \
- if (sec != NULL) \
- section_adjust[indx] = (sec->output_section->vma \
- + sec->output_offset \
- - sec->vma);
-
- SET (".text", scText);
- SET (".data", scData);
- SET (".bss", scBss);
- SET (".sdata", scSData);
- SET (".sbss", scSBss);
- /* scRdata section may be either .rdata or .rodata. */
- SET (".rdata", scRData);
- SET (".rodata", scRData);
- SET (".init", scInit);
- SET (".fini", scFini);
- SET (".rconst", scRConst);
-
-#undef SET
-
- /* Find all the debugging information based on the FDR's. We need
- to handle them whether they are swapped or not. */
- if (input_debug->fdr != (FDR *) NULL)
- {
- fdr_start = (bfd_byte *) input_debug->fdr;
- fdr_add = sizeof (FDR);
- }
- else
- {
- fdr_start = (bfd_byte *) input_debug->external_fdr;
- fdr_add = input_swap->external_fdr_size;
- }
- fdr_end = fdr_start + input_symhdr->ifdMax * fdr_add;
-
- 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);
- if (!input_debug->ifdmap || !rfd_out)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- if (!add_memory_shuffle (ainfo, &ainfo->rfd, &ainfo->rfd_end, rfd_out, sz))
- return FALSE;
-
- copied = 0;
-
- /* Look through the FDR's to see which ones we are going to include
- in the final output. We do not want duplicate FDR information
- for header files, because ECOFF debugging is often very large.
- When we find an FDR with no line information which can be merged,
- we look it up in a hash table to ensure that we only include it
- once. We keep a table mapping FDR numbers to the final number
- they get with the BFD, so that we can refer to it when we write
- out the external symbols. */
- for (fdr_ptr = fdr_start, i = 0;
- fdr_ptr < fdr_end;
- fdr_ptr += fdr_add, i++, rfd_out += external_rfd_size)
- {
- FDR fdr;
-
- if (input_debug->fdr != (FDR *) NULL)
- fdr = *(FDR *) fdr_ptr;
- else
- (*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr);
-
- /* See if this FDR can be merged with an existing one. */
- if (fdr.cbLine == 0 && fdr.rss != -1 && fdr.fMerge)
- {
- const char *name;
- char *lookup;
- struct string_hash_entry *fh;
-
- /* We look up a string formed from the file name and the
- number of symbols and aux entries. Sometimes an include
- file will conditionally define a typedef or something
- based on the order of include files. Using the number of
- symbols and aux entries as a hash reduces the chance that
- we will merge symbol information that should not be
- merged. */
- name = input_debug->ss + fdr.issBase + fdr.rss;
-
- 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);
-
- fh = string_hash_lookup (&ainfo->fdr_hash, lookup, TRUE, TRUE);
- free (lookup);
- if (fh == (struct string_hash_entry *) NULL)
- return FALSE;
-
- if (fh->val != -1)
- {
- input_debug->ifdmap[i] = fh->val;
- (*swap_rfd_out) (output_bfd, input_debug->ifdmap + i,
- (PTR) rfd_out);
-
- /* Don't copy this FDR. */
- continue;
- }
-
- fh->val = output_symhdr->ifdMax + copied;
- }
-
- input_debug->ifdmap[i] = output_symhdr->ifdMax + copied;
- (*swap_rfd_out) (output_bfd, input_debug->ifdmap + i, (PTR) rfd_out);
- ++copied;
- }
-
- newrfdbase = output_symhdr->crfd;
- output_symhdr->crfd += input_symhdr->ifdMax;
-
- /* Copy over any existing RFD's. RFD's are only created by the
- linker, so this will only happen for input files which are the
- result of a partial link. */
- rfd_in = (bfd_byte *) input_debug->external_rfd;
- rfd_end = rfd_in + input_symhdr->crfd * input_swap->external_rfd_size;
- for (;
- rfd_in < rfd_end;
- rfd_in += input_swap->external_rfd_size)
- {
- RFDT rfd;
-
- (*swap_rfd_in) (input_bfd, (PTR) rfd_in, &rfd);
- BFD_ASSERT (rfd >= 0 && rfd < input_symhdr->ifdMax);
- rfd = input_debug->ifdmap[rfd];
- (*swap_rfd_out) (output_bfd, &rfd, (PTR) rfd_out);
- rfd_out += external_rfd_size;
- }
-
- oldrfdbase = output_symhdr->crfd;
- output_symhdr->crfd += input_symhdr->crfd;
-
- /* Look through the FDR's and copy over all associated debugging
- information. */
- sz = copied * external_fdr_size;
- fdr_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz);
- if (!fdr_out)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- if (!add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end, fdr_out, sz))
- return FALSE;
- for (fdr_ptr = fdr_start, i = 0;
- fdr_ptr < fdr_end;
- fdr_ptr += fdr_add, i++)
- {
- FDR fdr;
- bfd_vma fdr_adr;
- bfd_byte *sym_out;
- bfd_byte *lraw_src;
- bfd_byte *lraw_end;
- bfd_boolean fgotfilename;
-
- if (input_debug->ifdmap[i] < output_symhdr->ifdMax)
- {
- /* We are not copying this FDR. */
- continue;
- }
-
- if (input_debug->fdr != (FDR *) NULL)
- fdr = *(FDR *) fdr_ptr;
- else
- (*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr);
-
- fdr_adr = fdr.adr;
-
- /* Adjust the FDR address for any changes that may have been
- made by relaxing. */
- if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
- {
- struct ecoff_value_adjust *adjust;
-
- for (adjust = input_debug->adjust;
- adjust != (struct ecoff_value_adjust *) NULL;
- adjust = adjust->next)
- if (fdr_adr >= adjust->start
- && fdr_adr < adjust->end)
- fdr.adr += adjust->adjust;
- }
-
- /* FIXME: It is conceivable that this FDR points to the .init or
- .fini section, in which case this will not do the right
- thing. */
- fdr.adr += section_adjust[scText];
-
- /* Swap in the local symbols, adjust their values, and swap them
- out again. */
- fgotfilename = FALSE;
- sz = fdr.csym * external_sym_size;
- sym_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz);
- if (!sym_out)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- if (!add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end, sym_out,
- sz))
- return FALSE;
- lraw_src = ((bfd_byte *) input_debug->external_sym
- + fdr.isymBase * input_swap->external_sym_size);
- lraw_end = lraw_src + fdr.csym * input_swap->external_sym_size;
- for (; lraw_src < lraw_end; lraw_src += input_swap->external_sym_size)
- {
- SYMR internal_sym;
-
- (*swap_sym_in) (input_bfd, (PTR) lraw_src, &internal_sym);
-
- BFD_ASSERT (internal_sym.sc != scCommon
- && internal_sym.sc != scSCommon);
-
- /* Adjust the symbol value if appropriate. */
- switch (internal_sym.st)
- {
- case stNil:
- if (ECOFF_IS_STAB (&internal_sym))
- break;
- /* Fall through. */
- case stGlobal:
- case stStatic:
- case stLabel:
- case stProc:
- case stStaticProc:
- if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
- {
- bfd_vma value;
- struct ecoff_value_adjust *adjust;
-
- value = internal_sym.value;
- for (adjust = input_debug->adjust;
- adjust != (struct ecoff_value_adjust *) NULL;
- adjust = adjust->next)
- if (value >= adjust->start
- && value < adjust->end)
- internal_sym.value += adjust->adjust;
- }
- internal_sym.value += section_adjust[internal_sym.sc];
- break;
-
- default:
- break;
- }
-
- /* If we are doing a final link, we hash all the strings in
- the local symbol table together. This reduces the amount
- of space required by debugging information. We don't do
- this when performing a relocatable link because it would
- prevent us from easily merging different FDR's. */
- if (! info->relocatable)
- {
- bfd_boolean ffilename;
- const char *name;
-
- if (! fgotfilename && internal_sym.iss == fdr.rss)
- ffilename = TRUE;
- else
- ffilename = FALSE;
-
- /* Hash the name into the string table. */
- name = input_debug->ss + fdr.issBase + internal_sym.iss;
- if (*name == '\0')
- internal_sym.iss = 0;
- else
- {
- struct string_hash_entry *sh;
-
- sh = string_hash_lookup (&ainfo->str_hash, name, TRUE, TRUE);
- if (sh == (struct string_hash_entry *) NULL)
- return FALSE;
- if (sh->val == -1)
- {
- sh->val = output_symhdr->issMax;
- output_symhdr->issMax += strlen (name) + 1;
- if (ainfo->ss_hash == (struct string_hash_entry *) NULL)
- ainfo->ss_hash = sh;
- if (ainfo->ss_hash_end
- != (struct string_hash_entry *) NULL)
- ainfo->ss_hash_end->next = sh;
- ainfo->ss_hash_end = sh;
- }
- internal_sym.iss = sh->val;
- }
-
- if (ffilename)
- {
- fdr.rss = internal_sym.iss;
- fgotfilename = TRUE;
- }
- }
-
- (*swap_sym_out) (output_bfd, &internal_sym, sym_out);
- sym_out += external_sym_size;
- }
-
- fdr.isymBase = output_symhdr->isymMax;
- output_symhdr->isymMax += fdr.csym;
-
- /* Copy the information that does not need swapping. */
-
- /* FIXME: If we are relaxing, we need to adjust the line
- numbers. Frankly, forget it. Anybody using stabs debugging
- information will not use this line number information, and
- 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, pos, (unsigned long) fdr.cbLine))
- return FALSE;
- fdr.ilineBase = output_symhdr->ilineMax;
- fdr.cbLineOffset = output_symhdr->cbLine;
- output_symhdr->ilineMax += fdr.cline;
- output_symhdr->cbLine += fdr.cbLine;
- }
- 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, pos,
- fdr.caux * sizeof (union aux_ext)))
- return FALSE;
- fdr.iauxBase = output_symhdr->iauxMax;
- output_symhdr->iauxMax += fdr.caux;
- }
- if (! info->relocatable)
- {
-
- /* When are are hashing strings, we lie about the number of
- strings attached to each FDR. We need to set cbSs
- because some versions of dbx apparently use it to decide
- how much of the string table to read in. */
- fdr.issBase = 0;
- fdr.cbSs = output_symhdr->issMax;
- }
- 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, pos, (unsigned long) fdr.cbSs))
- return FALSE;
- fdr.issBase = output_symhdr->issMax;
- output_symhdr->issMax += fdr.cbSs;
- }
-
- if ((output_bfd->xvec->header_byteorder
- == input_bfd->xvec->header_byteorder)
- && input_debug->adjust == (struct ecoff_value_adjust *) NULL)
- {
- /* The two BFD's have the same endianness, and we don't have
- to adjust the PDR addresses, so simply copying the
- information will suffice. */
- 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, 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, pos, size))
- return FALSE;
- }
- }
- else
- {
- bfd_size_type outsz, insz;
- bfd_byte *in;
- bfd_byte *end;
- bfd_byte *out;
-
- /* The two BFD's have different endianness, so we must swap
- everything in and out. This code would always work, but
- it would be unnecessarily slow in the normal case. */
- outsz = external_pdr_size;
- insz = input_swap->external_pdr_size;
- in = ((bfd_byte *) input_debug->external_pdr
- + fdr.ipdFirst * insz);
- end = in + fdr.cpd * insz;
- sz = fdr.cpd * outsz;
- out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz);
- if (!out)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- if (!add_memory_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end, out,
- sz))
- return FALSE;
- for (; in < end; in += insz, out += outsz)
- {
- PDR pdr;
-
- (*input_swap->swap_pdr_in) (input_bfd, (PTR) in, &pdr);
-
- /* If we have been relaxing, we may have to adjust the
- address. */
- if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
- {
- bfd_vma adr;
- struct ecoff_value_adjust *adjust;
-
- adr = fdr_adr + pdr.adr;
- for (adjust = input_debug->adjust;
- adjust != (struct ecoff_value_adjust *) NULL;
- adjust = adjust->next)
- if (adr >= adjust->start
- && adr < adjust->end)
- pdr.adr += adjust->adjust;
- }
-
- (*output_swap->swap_pdr_out) (output_bfd, &pdr, (PTR) out);
- }
-
- /* Swap over the optimization information. */
- outsz = external_opt_size;
- insz = input_swap->external_opt_size;
- in = ((bfd_byte *) input_debug->external_opt
- + fdr.ioptBase * insz);
- end = in + fdr.copt * insz;
- sz = fdr.copt * outsz;
- out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz);
- if (!out)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- if (!add_memory_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end, out,
- sz))
- return FALSE;
- for (; in < end; in += insz, out += outsz)
- {
- OPTR opt;
-
- (*input_swap->swap_opt_in) (input_bfd, (PTR) in, &opt);
- (*output_swap->swap_opt_out) (output_bfd, &opt, (PTR) out);
- }
- }
-
- fdr.ipdFirst = output_symhdr->ipdMax;
- output_symhdr->ipdMax += fdr.cpd;
- fdr.ioptBase = output_symhdr->ioptMax;
- output_symhdr->ioptMax += fdr.copt;
-
- if (fdr.crfd <= 0)
- {
- /* Point this FDR at the table of RFD's we created. */
- fdr.rfdBase = newrfdbase;
- fdr.crfd = input_symhdr->ifdMax;
- }
- else
- {
- /* Point this FDR at the remapped RFD's. */
- fdr.rfdBase += oldrfdbase;
- }
-
- (*swap_fdr_out) (output_bfd, &fdr, fdr_out);
- fdr_out += external_fdr_size;
- ++output_symhdr->ifdMax;
- }
-
- return TRUE;
-}
-
-/* Add a string to the debugging information we are accumulating.
- Return the offset from the fdr string base. */
-
-static long ecoff_add_string
- PARAMS ((struct accumulate *, struct bfd_link_info *,
- struct ecoff_debug_info *, FDR *fdr, const char *string));
-
-static long
-ecoff_add_string (ainfo, info, debug, fdr, string)
- struct accumulate *ainfo;
- struct bfd_link_info *info;
- struct ecoff_debug_info *debug;
- FDR *fdr;
- const char *string;
-{
- HDRR *symhdr;
- size_t len;
- bfd_size_type ret;
-
- symhdr = &debug->symbolic_header;
- len = strlen (string);
- if (info->relocatable)
- {
- if (!add_memory_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end, (PTR) string,
- len + 1))
- return -1;
- ret = symhdr->issMax;
- symhdr->issMax += len + 1;
- fdr->cbSs += len + 1;
- }
- else
- {
- struct string_hash_entry *sh;
-
- sh = string_hash_lookup (&ainfo->str_hash, string, TRUE, TRUE);
- if (sh == (struct string_hash_entry *) NULL)
- return -1;
- if (sh->val == -1)
- {
- sh->val = symhdr->issMax;
- symhdr->issMax += len + 1;
- if (ainfo->ss_hash == (struct string_hash_entry *) NULL)
- ainfo->ss_hash = sh;
- if (ainfo->ss_hash_end
- != (struct string_hash_entry *) NULL)
- ainfo->ss_hash_end->next = sh;
- ainfo->ss_hash_end = sh;
- }
- ret = sh->val;
- }
-
- return ret;
-}
-
-/* Add debugging information from a non-ECOFF file. */
-
-bfd_boolean
-bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
- output_swap, input_bfd, info)
- PTR handle;
- bfd *output_bfd;
- struct ecoff_debug_info *output_debug;
- const struct ecoff_debug_swap *output_swap;
- bfd *input_bfd;
- struct bfd_link_info *info;
-{
- struct accumulate *ainfo = (struct accumulate *) handle;
- void (* const swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR))
- = output_swap->swap_sym_out;
- HDRR *output_symhdr = &output_debug->symbolic_header;
- FDR fdr;
- asection *sec;
- asymbol **symbols;
- asymbol **sym_ptr;
- asymbol **sym_end;
- long symsize;
- long symcount;
- PTR external_fdr;
-
- memset ((PTR) &fdr, 0, sizeof fdr);
-
- sec = bfd_get_section_by_name (input_bfd, ".text");
- if (sec != NULL)
- fdr.adr = sec->output_section->vma + sec->output_offset;
- else
- {
- /* FIXME: What about .init or .fini? */
- fdr.adr = 0;
- }
-
- fdr.issBase = output_symhdr->issMax;
- fdr.cbSs = 0;
- fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr,
- bfd_archive_filename (input_bfd));
- if (fdr.rss == -1)
- return FALSE;
- fdr.isymBase = output_symhdr->isymMax;
-
- /* Get the local symbols from the input BFD. */
- symsize = bfd_get_symtab_upper_bound (input_bfd);
- if (symsize < 0)
- return FALSE;
- symbols = (asymbol **) bfd_alloc (output_bfd, (bfd_size_type) symsize);
- if (symbols == (asymbol **) NULL)
- return FALSE;
- symcount = bfd_canonicalize_symtab (input_bfd, symbols);
- if (symcount < 0)
- return FALSE;
- sym_end = symbols + symcount;
-
- /* Handle the local symbols. Any external symbols are handled
- separately. */
- fdr.csym = 0;
- for (sym_ptr = symbols; sym_ptr != sym_end; sym_ptr++)
- {
- SYMR internal_sym;
- PTR external_sym;
-
- if (((*sym_ptr)->flags & BSF_EXPORT) != 0)
- continue;
- memset ((PTR) &internal_sym, 0, sizeof internal_sym);
- internal_sym.iss = ecoff_add_string (ainfo, info, output_debug, &fdr,
- (*sym_ptr)->name);
-
- if (internal_sym.iss == -1)
- return FALSE;
- if (bfd_is_com_section ((*sym_ptr)->section)
- || bfd_is_und_section ((*sym_ptr)->section))
- internal_sym.value = (*sym_ptr)->value;
- else
- internal_sym.value = ((*sym_ptr)->value
- + (*sym_ptr)->section->output_offset
- + (*sym_ptr)->section->output_section->vma);
- internal_sym.st = stNil;
- internal_sym.sc = scUndefined;
- internal_sym.index = indexNil;
-
- external_sym = (PTR) objalloc_alloc (ainfo->memory,
- output_swap->external_sym_size);
- if (!external_sym)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- (*swap_sym_out) (output_bfd, &internal_sym, external_sym);
- add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end,
- external_sym,
- (unsigned long) output_swap->external_sym_size);
- ++fdr.csym;
- ++output_symhdr->isymMax;
- }
-
- bfd_release (output_bfd, (PTR) symbols);
-
- /* Leave everything else in the FDR zeroed out. This will cause
- the lang field to be langC. The fBigendian field will
- indicate little endian format, but it doesn't matter because
- it only applies to aux fields and there are none. */
- external_fdr = (PTR) objalloc_alloc (ainfo->memory,
- output_swap->external_fdr_size);
- if (!external_fdr)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- (*output_swap->swap_fdr_out) (output_bfd, &fdr, external_fdr);
- add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end,
- external_fdr,
- (unsigned long) output_swap->external_fdr_size);
-
- ++output_symhdr->ifdMax;
-
- return TRUE;
-}
-
-/* Set up ECOFF debugging information for the external symbols.
- FIXME: This is done using a memory buffer, but it should be
- probably be changed to use a shuffle structure. The assembler uses
- this interface, so that must be changed to do something else. */
-
-bfd_boolean
-bfd_ecoff_debug_externals (abfd, debug, swap, relocatable, get_extr,
- set_index)
- bfd *abfd;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
- bfd_boolean relocatable;
- bfd_boolean (*get_extr) PARAMS ((asymbol *, EXTR *));
- void (*set_index) PARAMS ((asymbol *, bfd_size_type));
-{
- HDRR * const symhdr = &debug->symbolic_header;
- asymbol **sym_ptr_ptr;
- size_t c;
-
- sym_ptr_ptr = bfd_get_outsymbols (abfd);
- if (sym_ptr_ptr == NULL)
- return TRUE;
-
- for (c = bfd_get_symcount (abfd); c > 0; c--, sym_ptr_ptr++)
- {
- asymbol *sym_ptr;
- EXTR esym;
-
- sym_ptr = *sym_ptr_ptr;
-
- /* Get the external symbol information. */
- if (! (*get_extr) (sym_ptr, &esym))
- continue;
-
- /* If we're producing an executable, move common symbols into
- bss. */
- if (! relocatable)
- {
- if (esym.asym.sc == scCommon)
- esym.asym.sc = scBss;
- else if (esym.asym.sc == scSCommon)
- esym.asym.sc = scSBss;
- }
-
- if (bfd_is_com_section (sym_ptr->section)
- || bfd_is_und_section (sym_ptr->section)
- || sym_ptr->section->output_section == (asection *) NULL)
- {
- /* FIXME: gas does not keep the value of a small undefined
- symbol in the symbol itself, because of relocation
- problems. */
- if (esym.asym.sc != scSUndefined
- || esym.asym.value == 0
- || sym_ptr->value != 0)
- esym.asym.value = sym_ptr->value;
- }
- else
- esym.asym.value = (sym_ptr->value
- + sym_ptr->section->output_offset
- + sym_ptr->section->output_section->vma);
-
- if (set_index)
- (*set_index) (sym_ptr, (bfd_size_type) symhdr->iextMax);
-
- if (! bfd_ecoff_debug_one_external (abfd, debug, swap,
- sym_ptr->name, &esym))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Add a single external symbol to the debugging information. */
-
-bfd_boolean
-bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
- bfd *abfd;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
- const char *name;
- EXTR *esym;
-{
- const bfd_size_type external_ext_size = swap->external_ext_size;
- void (* const swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR))
- = swap->swap_ext_out;
- HDRR * const symhdr = &debug->symbolic_header;
- size_t namelen;
-
- namelen = strlen (name);
-
- if ((size_t) (debug->ssext_end - debug->ssext)
- < symhdr->issExtMax + namelen + 1)
- {
- if (! ecoff_add_bytes ((char **) &debug->ssext,
- (char **) &debug->ssext_end,
- symhdr->issExtMax + namelen + 1))
- return FALSE;
- }
- if ((size_t) ((char *) debug->external_ext_end
- - (char *) debug->external_ext)
- < (symhdr->iextMax + 1) * external_ext_size)
- {
- if (! ecoff_add_bytes ((char **) &debug->external_ext,
- (char **) &debug->external_ext_end,
- (symhdr->iextMax + 1) * (size_t) external_ext_size))
- return FALSE;
- }
-
- esym->asym.iss = symhdr->issExtMax;
-
- (*swap_ext_out) (abfd, esym,
- ((char *) debug->external_ext
- + symhdr->iextMax * swap->external_ext_size));
-
- ++symhdr->iextMax;
-
- strcpy (debug->ssext + symhdr->issExtMax, name);
- symhdr->issExtMax += namelen + 1;
-
- return TRUE;
-}
-
-/* Align the ECOFF debugging information. */
-
-static void
-ecoff_align_debug (abfd, debug, swap)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
-{
- HDRR * const symhdr = &debug->symbolic_header;
- bfd_size_type debug_align, aux_align, rfd_align;
- size_t add;
-
- /* Adjust the counts so that structures are aligned. */
- debug_align = swap->debug_align;
- aux_align = debug_align / sizeof (union aux_ext);
- rfd_align = debug_align / swap->external_rfd_size;
-
- add = debug_align - (symhdr->cbLine & (debug_align - 1));
- if (add != debug_align)
- {
- if (debug->line != (unsigned char *) NULL)
- memset ((PTR) (debug->line + symhdr->cbLine), 0, add);
- symhdr->cbLine += add;
- }
-
- add = debug_align - (symhdr->issMax & (debug_align - 1));
- if (add != debug_align)
- {
- if (debug->ss != (char *) NULL)
- memset ((PTR) (debug->ss + symhdr->issMax), 0, add);
- symhdr->issMax += add;
- }
-
- add = debug_align - (symhdr->issExtMax & (debug_align - 1));
- if (add != debug_align)
- {
- if (debug->ssext != (char *) NULL)
- memset ((PTR) (debug->ssext + symhdr->issExtMax), 0, add);
- symhdr->issExtMax += add;
- }
-
- add = aux_align - (symhdr->iauxMax & (aux_align - 1));
- if (add != aux_align)
- {
- if (debug->external_aux != (union aux_ext *) NULL)
- memset ((PTR) (debug->external_aux + symhdr->iauxMax), 0,
- add * sizeof (union aux_ext));
- symhdr->iauxMax += add;
- }
-
- add = rfd_align - (symhdr->crfd & (rfd_align - 1));
- if (add != rfd_align)
- {
- if (debug->external_rfd != (PTR) NULL)
- memset ((PTR) ((char *) debug->external_rfd
- + symhdr->crfd * swap->external_rfd_size),
- 0, (size_t) (add * swap->external_rfd_size));
- symhdr->crfd += add;
- }
-}
-
-/* Return the size required by the ECOFF debugging information. */
-
-bfd_size_type
-bfd_ecoff_debug_size (abfd, debug, swap)
- bfd *abfd;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
-{
- bfd_size_type tot;
-
- ecoff_align_debug (abfd, debug, swap);
- tot = swap->external_hdr_size;
-
-#define ADD(count, size) \
- tot += debug->symbolic_header.count * size
-
- ADD (cbLine, sizeof (unsigned char));
- ADD (idnMax, swap->external_dnr_size);
- ADD (ipdMax, swap->external_pdr_size);
- ADD (isymMax, swap->external_sym_size);
- ADD (ioptMax, swap->external_opt_size);
- ADD (iauxMax, sizeof (union aux_ext));
- ADD (issMax, sizeof (char));
- ADD (issExtMax, sizeof (char));
- ADD (ifdMax, swap->external_fdr_size);
- ADD (crfd, swap->external_rfd_size);
- ADD (iextMax, swap->external_ext_size);
-
-#undef ADD
-
- return tot;
-}
-
-/* Write out the ECOFF symbolic header, given the file position it is
- going to be placed at. This assumes that the counts are set
- correctly. */
-
-static bfd_boolean
-ecoff_write_symhdr (abfd, debug, swap, where)
- bfd *abfd;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
- file_ptr where;
-{
- HDRR * const symhdr = &debug->symbolic_header;
- char *buff = NULL;
-
- ecoff_align_debug (abfd, debug, swap);
-
- /* Go to the right location in the file. */
- if (bfd_seek (abfd, where, SEEK_SET) != 0)
- return FALSE;
-
- where += swap->external_hdr_size;
-
- symhdr->magic = swap->sym_magic;
-
- /* Fill in the file offsets. */
-#define SET(offset, count, size) \
- if (symhdr->count == 0) \
- symhdr->offset = 0; \
- else \
- { \
- symhdr->offset = where; \
- where += symhdr->count * size; \
- }
-
- SET (cbLineOffset, cbLine, sizeof (unsigned char));
- SET (cbDnOffset, idnMax, swap->external_dnr_size);
- SET (cbPdOffset, ipdMax, swap->external_pdr_size);
- SET (cbSymOffset, isymMax, swap->external_sym_size);
- SET (cbOptOffset, ioptMax, swap->external_opt_size);
- SET (cbAuxOffset, iauxMax, sizeof (union aux_ext));
- SET (cbSsOffset, issMax, sizeof (char));
- SET (cbSsExtOffset, issExtMax, sizeof (char));
- SET (cbFdOffset, ifdMax, swap->external_fdr_size);
- SET (cbRfdOffset, crfd, swap->external_rfd_size);
- SET (cbExtOffset, iextMax, swap->external_ext_size);
-#undef SET
-
- 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_bwrite (buff, swap->external_hdr_size, abfd)
- != swap->external_hdr_size)
- goto error_return;
-
- if (buff != NULL)
- free (buff);
- return TRUE;
- error_return:
- if (buff != NULL)
- free (buff);
- return FALSE;
-}
-
-/* Write out the ECOFF debugging information. This function assumes
- that the information (the pointers and counts) in *DEBUG have been
- set correctly. WHERE is the position in the file to write the
- information to. This function fills in the file offsets in the
- symbolic header. */
-
-bfd_boolean
-bfd_ecoff_write_debug (abfd, debug, swap, where)
- bfd *abfd;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
- file_ptr where;
-{
- HDRR * const symhdr = &debug->symbolic_header;
-
- if (! ecoff_write_symhdr (abfd, debug, swap, where))
- return FALSE;
-
-#define WRITE(ptr, count, size, offset) \
- BFD_ASSERT (symhdr->offset == 0 \
- || (bfd_vma) bfd_tell (abfd) == symhdr->offset); \
- if (bfd_bwrite ((PTR) debug->ptr, (bfd_size_type) size * symhdr->count, abfd)\
- != size * symhdr->count) \
- return FALSE;
-
- WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset);
- WRITE (external_dnr, idnMax, swap->external_dnr_size, cbDnOffset);
- 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, (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);
- WRITE (external_rfd, crfd, swap->external_rfd_size, cbRfdOffset);
- WRITE (external_ext, iextMax, swap->external_ext_size, cbExtOffset);
-#undef WRITE
-
- return TRUE;
-}
-
-/* Write out a shuffle list. */
-
-static bfd_boolean ecoff_write_shuffle
- PARAMS ((bfd *, const struct ecoff_debug_swap *, struct shuffle *,
- PTR space));
-
-static bfd_boolean
-ecoff_write_shuffle (abfd, swap, shuffle, space)
- bfd *abfd;
- const struct ecoff_debug_swap *swap;
- struct shuffle *shuffle;
- PTR space;
-{
- register struct shuffle *l;
- unsigned long total;
-
- total = 0;
- for (l = shuffle; l != (struct shuffle *) NULL; l = l->next)
- {
- if (! l->filep)
- {
- 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_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;
- }
-
- if ((total & (swap->debug_align - 1)) != 0)
- {
- unsigned int i;
- bfd_byte *s;
-
- i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
- if (s == NULL && i != 0)
- return FALSE;
-
- if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
- {
- free (s);
- return FALSE;
- }
- free (s);
- }
-
- return TRUE;
-}
-
-/* Write out debugging information using accumulated linker
- information. */
-
-bfd_boolean
-bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
- PTR handle;
- bfd *abfd;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
- struct bfd_link_info *info;
- file_ptr 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;
-
- amt = ainfo->largest_file_shuffle;
- space = (PTR) bfd_malloc (amt);
- if (space == NULL && ainfo->largest_file_shuffle != 0)
- goto error_return;
-
- if (! ecoff_write_shuffle (abfd, swap, ainfo->line, space)
- || ! ecoff_write_shuffle (abfd, swap, ainfo->pdr, space)
- || ! ecoff_write_shuffle (abfd, swap, ainfo->sym, space)
- || ! ecoff_write_shuffle (abfd, swap, ainfo->opt, space)
- || ! ecoff_write_shuffle (abfd, swap, ainfo->aux, space))
- goto error_return;
-
- /* The string table is written out from the hash table if this is a
- final link. */
- if (info->relocatable)
- {
- BFD_ASSERT (ainfo->ss_hash == (struct string_hash_entry *) NULL);
- if (! ecoff_write_shuffle (abfd, swap, ainfo->ss, space))
- goto error_return;
- }
- else
- {
- unsigned long total;
- bfd_byte null;
- struct string_hash_entry *sh;
-
- BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL);
- null = 0;
- 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);
- for (sh = ainfo->ss_hash;
- sh != (struct string_hash_entry *) NULL;
- sh = sh->next)
- {
- size_t len;
-
- len = strlen (sh->root.string);
- amt = len + 1;
- if (bfd_bwrite ((PTR) sh->root.string, amt, abfd) != amt)
- goto error_return;
- total += len + 1;
- }
-
- if ((total & (swap->debug_align - 1)) != 0)
- {
- unsigned int i;
- bfd_byte *s;
-
- i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
- if (s == NULL && i != 0)
- goto error_return;
-
- if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
- {
- free (s);
- goto error_return;
- }
- free (s);
- }
- }
-
- /* The external strings and symbol are not converted over to using
- shuffles. FIXME: They probably should be. */
- 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)
- {
- unsigned int i;
- bfd_byte *s;
-
- i = (swap->debug_align
- - (debug->symbolic_header.issExtMax & (swap->debug_align - 1)));
- s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
- if (s == NULL && i != 0)
- goto error_return;
-
- if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
- {
- free (s);
- goto error_return;
- }
- free (s);
- }
-
- if (! ecoff_write_shuffle (abfd, swap, ainfo->fdr, space)
- || ! ecoff_write_shuffle (abfd, swap, ainfo->rfd, space))
- goto error_return;
-
- BFD_ASSERT (debug->symbolic_header.cbExtOffset == 0
- || (debug->symbolic_header.cbExtOffset
- == (bfd_vma) bfd_tell (abfd)));
-
- amt = debug->symbolic_header.iextMax * swap->external_ext_size;
- if (bfd_bwrite (debug->external_ext, amt, abfd) != amt)
- goto error_return;
-
- if (space != NULL)
- free (space);
- return TRUE;
-
- error_return:
- if (space != NULL)
- free (space);
- return FALSE;
-}
-
-/* Handle the find_nearest_line function for both ECOFF and MIPS ELF
- files. */
-
-/* Compare FDR entries. This is called via qsort. */
-
-static int
-cmp_fdrtab_entry (leftp, rightp)
- const PTR leftp;
- const PTR rightp;
-{
- const struct ecoff_fdrtab_entry *lp =
- (const struct ecoff_fdrtab_entry *) leftp;
- const struct ecoff_fdrtab_entry *rp =
- (const struct ecoff_fdrtab_entry *) rightp;
-
- if (lp->base_addr < rp->base_addr)
- return -1;
- if (lp->base_addr > rp->base_addr)
- return 1;
- return 0;
-}
-
-/* Each file descriptor (FDR) has a memory address, to simplify
- looking up an FDR by address, we build a table covering all FDRs
- that have a least one procedure descriptor in them. The final
- table will be sorted by address so we can look it up via binary
- search. */
-
-static bfd_boolean
-mk_fdrtab (abfd, debug_info, debug_swap, line_info)
- bfd *abfd;
- struct ecoff_debug_info * const debug_info;
- const struct ecoff_debug_swap * const debug_swap;
- struct ecoff_find_line *line_info;
-{
- struct ecoff_fdrtab_entry *tab;
- FDR *fdr_ptr;
- FDR *fdr_start;
- FDR *fdr_end;
- bfd_boolean stabs;
- long len;
- bfd_size_type amt;
-
- fdr_start = debug_info->fdr;
- fdr_end = fdr_start + debug_info->symbolic_header.ifdMax;
-
- /* First, let's see how long the table needs to be. */
- for (len = 0, fdr_ptr = fdr_start; fdr_ptr < fdr_end; fdr_ptr++)
- {
- if (fdr_ptr->cpd == 0) /* Skip FDRs that have no PDRs. */
- continue;
- ++len;
- }
-
- /* Now, create and fill in the table. */
- 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;
-
- tab = line_info->fdrtab;
- for (fdr_ptr = fdr_start; fdr_ptr < fdr_end; fdr_ptr++)
- {
- if (fdr_ptr->cpd == 0)
- continue;
-
- /* Check whether this file has stabs debugging information. In
- a file with stabs debugging information, the second local
- symbol is named @stabs. */
- stabs = FALSE;
- if (fdr_ptr->csym >= 2)
- {
- char *sym_ptr;
- SYMR sym;
-
- sym_ptr = ((char *) debug_info->external_sym
- + (fdr_ptr->isymBase + 1) * debug_swap->external_sym_size);
- (*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym);
- if (strcmp (debug_info->ss + fdr_ptr->issBase + sym.iss,
- STABS_SYMBOL) == 0)
- stabs = TRUE;
- }
-
- if (!stabs)
- {
- /* eraxxon: There are at least two problems with this computation:
- 1) PDRs do *not* contain offsets but full vma's; and typically the
- address of the first PDR is the address of the FDR, which will
- make (most) of the results of the original computation 0!
- 2) Once in a wacky while, the Compaq compiler generated PDR
- addresses do not equal the FDR vma, but they (the PDR address)
- are still vma's and not offsets. Cf. comments in
- 'lookup_line'. */
-#if 0
- bfd_size_type external_pdr_size;
- char *pdr_ptr;
- PDR pdr;
-
- external_pdr_size = debug_swap->external_pdr_size;
-
- pdr_ptr = ((char *) debug_info->external_pdr
- + fdr_ptr->ipdFirst * external_pdr_size);
- (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
- /* The address of the first PDR is the offset of that
- procedure relative to the beginning of file FDR. */
- tab->base_addr = fdr_ptr->adr - pdr.adr;
-#else
- /* The address of the first PDR is the offset of that
- procedure relative to the beginning of file FDR. */
- tab->base_addr = fdr_ptr->adr;
-#endif
- }
- else
- {
- /* XXX I don't know about stabs, so this is a guess
- (davidm@cs.arizona.edu). */
- tab->base_addr = fdr_ptr->adr;
- }
- tab->fdr = fdr_ptr;
- ++tab;
- }
-
- /* Finally, the table is sorted in increasing memory-address order.
- 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, (size_t) len,
- sizeof (struct ecoff_fdrtab_entry), cmp_fdrtab_entry);
-
- return TRUE;
-}
-
-/* Return index of first FDR that covers to OFFSET. */
-
-static long
-fdrtab_lookup (line_info, offset)
- struct ecoff_find_line *line_info;
- bfd_vma offset;
-{
- long low, high, len;
- long mid = -1;
- struct ecoff_fdrtab_entry *tab;
-
- len = line_info->fdrtab_len;
- if (len == 0)
- return -1;
-
- tab = line_info->fdrtab;
- for (low = 0, high = len - 1 ; low != high ;)
- {
- mid = (high + low) / 2;
- if (offset >= tab[mid].base_addr && offset < tab[mid + 1].base_addr)
- goto find_min;
-
- if (tab[mid].base_addr > offset)
- high = mid;
- else
- low = mid + 1;
- }
-
- /* eraxxon: at this point 'offset' is either lower than the lowest entry or
- higher than the highest entry. In the former case high = low = mid = 0;
- we want to return -1. In the latter case, low = high and mid = low - 1;
- we want to return the index of the highest entry. Only in former case
- will the following 'catch-all' test be true. */
- ++mid;
-
- /* Last entry is catch-all for all higher addresses. */
- if (offset < tab[mid].base_addr)
- return -1;
-
- find_min:
-
- /* eraxxon: There may be multiple FDRs in the table with the
- same base_addr; make sure that we are at the first one. */
- while (mid > 0 && tab[mid - 1].base_addr == tab[mid].base_addr)
- --mid;
-
- return mid;
-}
-
-/* Look up a line given an address, storing the information in
- LINE_INFO->cache. */
-
-static bfd_boolean
-lookup_line (abfd, debug_info, debug_swap, line_info)
- bfd *abfd;
- struct ecoff_debug_info * const debug_info;
- const struct ecoff_debug_swap * const debug_swap;
- struct ecoff_find_line *line_info;
-{
- struct ecoff_fdrtab_entry *tab;
- bfd_vma offset;
- bfd_boolean stabs;
- FDR *fdr_ptr;
- int i;
-
- /* eraxxon: note that 'offset' is the full vma, not a section offset. */
- offset = line_info->cache.start;
-
- /* Build FDR table (sorted by object file's base-address) if we
- don't have it already. */
- if (line_info->fdrtab == NULL
- && !mk_fdrtab (abfd, debug_info, debug_swap, line_info))
- return FALSE;
-
- tab = line_info->fdrtab;
-
- /* Find first FDR for address OFFSET. */
- i = fdrtab_lookup (line_info, offset);
- if (i < 0)
- return FALSE; /* no FDR, no fun... */
-
- /* eraxxon: 'fdrtab_lookup' doesn't give what we want, at least for Compaq's
- C++ compiler 6.2. Consider three FDRs with starting addresses of x, y,
- and z, respectively, such that x < y < z. Assume further that
- y < 'offset' < z. It is possible at times that the PDR for 'offset' is
- associated with FDR x and *not* with FDR y. Erg!!
-
- From a binary dump of my C++ test case 'moo' using Compaq's coffobjanl
- (output format has been edited for our purposes):
-
- FDR [2]: (main.C): First instruction: 0x12000207c <x>
- PDR [5] for File [2]: LoopTest__Xv <0x1200020a0> (a)
- PDR [7] for File [2]: foo__Xv <0x120002168>
- FDR [1]: (-1): First instruction: 0x1200020e8 <y>
- PDR [3] for File [1]: <0x120001ad0> (b)
- FDR [6]: (-1): First instruction: 0x1200026f0 <z>
-
- (a) In the case of PDR5, the vma is such that the first few instructions
- of the procedure can be found. But since the size of this procedure is
- 160b, the vma will soon cross into the 'address space' of FDR1 and no
- debugging info will be found. How repugnant!
-
- (b) It is also possible for a PDR to have a *lower* vma than its associated
- FDR; see FDR1 and PDR3. Gross!
-
- Since the FDRs that are causing so much havok (in this case) 1) do not
- describe actual files (fdr.rss == -1), and 2) contain only compiler
- generated routines, I thought a simple fix would be to exclude them from
- the FDR table in 'mk_fdrtab'. But, besides not knowing for certain
- whether this would be correct, it creates an additional problem. If we
- happen to ask for source file info on a compiler generated (procedure)
- symbol -- which is still in the symbol table -- the result can be
- information from a real procedure! This is because compiler generated
- procedures with vma's higher than the last FDR in the fdr table will be
- associated with a PDR from this FDR, specifically the PDR with the
- highest vma. This wasn't a problem before, because each procedure had a
- PDR. (Yes, this problem could be eliminated if we kept the size of the
- last PDR around, but things are already getting ugly).
-
- Probably, a better solution would be to have a sorted PDR table. Each
- PDR would have a pointer to its FDR so file information could still be
- obtained. A FDR table could still be constructed if necessary -- since
- it only contains pointers, not much extra memory would be used -- but
- the PDR table would be searched to locate debugging info.
-
- There is still at least one remaining issue. Sometimes a FDR can have a
- bogus name, but contain PDRs that should belong to another FDR with a
- real name. E.g:
-
- FDR [3]: 0000000120001b50 (/home/.../Array.H~alt~deccxx_5E5A62AD)
- PDR [a] for File [3]: 0000000120001b50
- PDR [b] for File [3]: 0000000120001cf0
- PDR [c] for File [3]: 0000000120001dc8
- PDR [d] for File [3]: 0000000120001e40
- PDR [e] for File [3]: 0000000120001eb8
- PDR [f] for File [3]: 0000000120001f4c
- FDR [4]: 0000000120001b50 (/home/.../Array.H)
-
- Here, FDR4 has the correct name, but should (seemingly) contain PDRa-f.
- The symbol table for PDR4 does contain symbols for PDRa-f, but so does
- the symbol table for FDR3. However the former is different; perhaps this
- can be detected easily. (I'm not sure at this point.) This problem only
- seems to be associated with files with templates. I am assuming the idea
- is that there is a 'fake' FDR (with PDRs) for each differently typed set
- of templates that must be generated. Currently, FDR4 is completely
- excluded from the FDR table in 'mk_fdrtab' because it contains no PDRs.
-
- Since I don't have time to prepare a real fix for this right now, be
- prepared for 'A Horrible Hack' to force the inspection of all non-stabs
- FDRs. It's coming... */
- fdr_ptr = tab[i].fdr;
-
- /* Check whether this file has stabs debugging information. In a
- file with stabs debugging information, the second local symbol is
- named @stabs. */
- stabs = FALSE;
- if (fdr_ptr->csym >= 2)
- {
- char *sym_ptr;
- SYMR sym;
-
- sym_ptr = ((char *) debug_info->external_sym
- + (fdr_ptr->isymBase + 1) * debug_swap->external_sym_size);
- (*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym);
- if (strcmp (debug_info->ss + fdr_ptr->issBase + sym.iss,
- STABS_SYMBOL) == 0)
- stabs = TRUE;
- }
-
- if (!stabs)
- {
- bfd_size_type external_pdr_size;
- char *pdr_ptr;
- char *best_pdr = NULL;
- FDR *best_fdr;
- bfd_signed_vma best_dist = -1;
- PDR pdr;
- unsigned char *line_ptr;
- unsigned char *line_end;
- int lineno;
- /* This file uses ECOFF debugging information. Each FDR has a
- list of procedure descriptors (PDR). The address in the FDR
- is the absolute address of the first procedure. The address
- in the first PDR gives the offset of that procedure relative
- to the object file's base-address. The addresses in
- subsequent PDRs specify each procedure's address relative to
- the object file's base-address. To make things more juicy,
- whenever the PROF bit in the PDR is set, the real entry point
- of the procedure may be 16 bytes below what would normally be
- the procedure's entry point. Instead, DEC came up with a
- wicked scheme to create profiled libraries "on the fly":
- instead of shipping a regular and a profiled version of each
- library, they insert 16 bytes of unused space in front of
- each procedure and set the "prof" bit in the PDR to indicate
- that there is a gap there (this is done automagically by "as"
- when option "-pg" is specified). Thus, normally, you link
- against such a library and, except for lots of 16 byte gaps
- between functions, things will behave as usual. However,
- when invoking "ld" with option "-pg", it will fill those gaps
- with code that calls mcount(). It then moves the function's
- entry point down by 16 bytes, and out pops a binary that has
- all functions profiled.
-
- NOTE: Neither FDRs nor PDRs are strictly sorted in memory
- order. For example, when including header-files that
- define functions, the FDRs follow behind the including
- file, even though their code may have been generated at
- a lower address. File coff-alpha.c from libbfd
- illustrates this (use "odump -PFv" to look at a file's
- FDR/PDR). Similarly, PDRs are sometimes out of order
- as well. An example of this is OSF/1 v3.0 libc's
- malloc.c. I'm not sure why this happens, but it could
- be due to optimizations that reorder a function's
- position within an object-file.
-
- Strategy:
-
- On the first call to this function, we build a table of FDRs
- that is sorted by the base-address of the object-file the FDR
- is referring to. Notice that each object-file may contain
- code from multiple source files (e.g., due to code defined in
- include files). Thus, for any given base-address, there may
- be multiple FDRs (but this case is, fortunately, uncommon).
- lookup(addr) guarantees to return the first FDR that applies
- to address ADDR. Thus, after invoking lookup(), we have a
- list of FDRs that may contain the PDR for ADDR. Next, we
- walk through the PDRs of these FDRs and locate the one that
- is closest to ADDR (i.e., for which the difference between
- ADDR and the PDR's entry point is positive and minimal).
- Once, the right FDR and PDR are located, we simply walk
- through the line-number table to lookup the line-number that
- best matches ADDR. Obviously, things could be sped up by
- keeping a sorted list of PDRs instead of a sorted list of
- FDRs. However, this would increase space requirements
- considerably, which is undesirable. */
- external_pdr_size = debug_swap->external_pdr_size;
-
-#if 0 /* eraxxon: PDR addresses (pdr.adr) are not relative to FDRs!
- Leave 'offset' alone. */
- /* Make offset relative to object file's start-address. */
- offset -= tab[i].base_addr;
-#endif
- /* eraxxon: The Horrible Hack: Because of the problems above, set 'i'
- to 0 so we look through all FDRs.
-
- Because FDR's without any symbols are assumed to be non-stabs,
- searching through all FDRs may cause the following code to try to
- read stabs FDRs as ECOFF ones. However, I don't think this will
- harm anything. */
- i = 0;
-
- /* Search FDR list starting at tab[i] for the PDR that best matches
- OFFSET. Normally, the FDR list is only one entry long. */
- best_fdr = NULL;
- do
- {
- /* eraxxon: 'dist' and 'min_dist' can be negative now
- because we iterate over every FDR rather than just ones
- with a base address less than or equal to 'offset'. */
- bfd_signed_vma dist = -1, min_dist = -1;
- char *pdr_hold;
- char *pdr_end;
-
- fdr_ptr = tab[i].fdr;
-
- pdr_ptr = ((char *) debug_info->external_pdr
- + fdr_ptr->ipdFirst * external_pdr_size);
- pdr_end = pdr_ptr + fdr_ptr->cpd * external_pdr_size;
- (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
- /* Find PDR that is closest to OFFSET. If pdr.prof is set,
- the procedure entry-point *may* be 0x10 below pdr.adr. We
- simply pretend that pdr.prof *implies* a lower entry-point.
- This is safe because it just means that may identify 4 NOPs
- in front of the function as belonging to the function. */
- for (pdr_hold = NULL;
- pdr_ptr < pdr_end;
- (pdr_ptr += external_pdr_size,
- (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr)))
- {
- if (offset >= (pdr.adr - 0x10 * pdr.prof))
- {
- dist = offset - (pdr.adr - 0x10 * pdr.prof);
-
- /* eraxxon: 'dist' can be negative now. Note that
- 'min_dist' can be negative if 'pdr_hold' below is NULL. */
- if (!pdr_hold || (dist >= 0 && dist < min_dist))
- {
- min_dist = dist;
- pdr_hold = pdr_ptr;
- }
- }
- }
-
- if (!best_pdr || (min_dist >= 0 && min_dist < best_dist))
- {
- best_dist = (bfd_vma) min_dist;
- best_fdr = fdr_ptr;
- best_pdr = pdr_hold;
- }
- /* Continue looping until base_addr of next entry is different. */
- }
- /* eraxxon: We want to iterate over all FDRs.
- See previous comment about 'fdrtab_lookup'. */
- while (++i < line_info->fdrtab_len);
-
- if (!best_fdr || !best_pdr)
- return FALSE; /* Shouldn't happen... */
-
- /* Phew, finally we got something that we can hold onto. */
- fdr_ptr = best_fdr;
- pdr_ptr = best_pdr;
- (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
- /* Now we can look for the actual line number. The line numbers
- are stored in a very funky format, which I won't try to
- describe. The search is bounded by the end of the FDRs line
- number entries. */
- line_end = debug_info->line + fdr_ptr->cbLineOffset + fdr_ptr->cbLine;
-
- /* Make offset relative to procedure entry. */
- offset -= pdr.adr - 0x10 * pdr.prof;
- lineno = pdr.lnLow;
- line_ptr = debug_info->line + fdr_ptr->cbLineOffset + pdr.cbLineOffset;
- while (line_ptr < line_end)
- {
- int delta;
- unsigned int count;
-
- delta = *line_ptr >> 4;
- if (delta >= 0x8)
- delta -= 0x10;
- count = (*line_ptr & 0xf) + 1;
- ++line_ptr;
- if (delta == -8)
- {
- delta = (((line_ptr[0]) & 0xff) << 8) + ((line_ptr[1]) & 0xff);
- if (delta >= 0x8000)
- delta -= 0x10000;
- line_ptr += 2;
- }
- lineno += delta;
- if (offset < count * 4)
- {
- line_info->cache.stop += count * 4 - offset;
- break;
- }
- offset -= count * 4;
- }
-
- /* If fdr_ptr->rss is -1, then this file does not have full
- symbols, at least according to gdb/mipsread.c. */
- if (fdr_ptr->rss == -1)
- {
- line_info->cache.filename = NULL;
- if (pdr.isym == -1)
- line_info->cache.functionname = NULL;
- else
- {
- EXTR proc_ext;
-
- (*debug_swap->swap_ext_in)
- (abfd,
- ((char *) debug_info->external_ext
- + pdr.isym * debug_swap->external_ext_size),
- &proc_ext);
- line_info->cache.functionname = (debug_info->ssext
- + proc_ext.asym.iss);
- }
- }
- else
- {
- SYMR proc_sym;
-
- line_info->cache.filename = (debug_info->ss
- + fdr_ptr->issBase
- + fdr_ptr->rss);
- (*debug_swap->swap_sym_in)
- (abfd,
- ((char *) debug_info->external_sym
- + ((fdr_ptr->isymBase + pdr.isym)
- * debug_swap->external_sym_size)),
- &proc_sym);
- line_info->cache.functionname = (debug_info->ss
- + fdr_ptr->issBase
- + proc_sym.iss);
- }
- if (lineno == ilineNil)
- lineno = 0;
- line_info->cache.line_num = lineno;
- }
- else
- {
- bfd_size_type external_sym_size;
- const char *directory_name;
- const char *main_file_name;
- const char *current_file_name;
- const char *function_name;
- const char *line_file_name;
- bfd_vma low_func_vma;
- bfd_vma low_line_vma;
- bfd_boolean past_line;
- bfd_boolean past_fn;
- char *sym_ptr, *sym_ptr_end;
- size_t len, funclen;
- char *buffer = NULL;
-
- /* This file uses stabs debugging information. When gcc is not
- optimizing, it will put the line number information before
- the function name stabs entry. When gcc is optimizing, it
- will put the stabs entry for all the function first, followed
- by the line number information. (This appears to happen
- because of the two output files used by the -mgpopt switch,
- which is implied by -O). This means that we must keep
- looking through the symbols until we find both a line number
- and a function name which are beyond the address we want. */
-
- line_info->cache.filename = NULL;
- line_info->cache.functionname = NULL;
- line_info->cache.line_num = 0;
-
- directory_name = NULL;
- main_file_name = NULL;
- current_file_name = NULL;
- function_name = NULL;
- line_file_name = NULL;
- low_func_vma = 0;
- low_line_vma = 0;
- past_line = FALSE;
- past_fn = FALSE;
-
- external_sym_size = debug_swap->external_sym_size;
-
- sym_ptr = ((char *) debug_info->external_sym
- + (fdr_ptr->isymBase + 2) * external_sym_size);
- sym_ptr_end = sym_ptr + (fdr_ptr->csym - 2) * external_sym_size;
- for (;
- sym_ptr < sym_ptr_end && (! past_line || ! past_fn);
- sym_ptr += external_sym_size)
- {
- SYMR sym;
-
- (*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym);
-
- if (ECOFF_IS_STAB (&sym))
- {
- switch (ECOFF_UNMARK_STAB (sym.index))
- {
- case N_SO:
- main_file_name = current_file_name =
- debug_info->ss + fdr_ptr->issBase + sym.iss;
-
- /* Check the next symbol to see if it is also an
- N_SO symbol. */
- if (sym_ptr + external_sym_size < sym_ptr_end)
- {
- SYMR nextsym;
-
- (*debug_swap->swap_sym_in) (abfd,
- sym_ptr + external_sym_size,
- &nextsym);
- if (ECOFF_IS_STAB (&nextsym)
- && ECOFF_UNMARK_STAB (nextsym.index) == N_SO)
- {
- directory_name = current_file_name;
- main_file_name = current_file_name =
- debug_info->ss + fdr_ptr->issBase + nextsym.iss;
- sym_ptr += external_sym_size;
- }
- }
- break;
-
- case N_SOL:
- current_file_name =
- debug_info->ss + fdr_ptr->issBase + sym.iss;
- break;
-
- case N_FUN:
- if (sym.value > offset)
- past_fn = TRUE;
- else if (sym.value >= low_func_vma)
- {
- low_func_vma = sym.value;
- function_name =
- debug_info->ss + fdr_ptr->issBase + sym.iss;
- }
- break;
- }
- }
- else if (sym.st == stLabel && sym.index != indexNil)
- {
- if (sym.value > offset)
- past_line = TRUE;
- else if (sym.value >= low_line_vma)
- {
- low_line_vma = sym.value;
- line_file_name = current_file_name;
- line_info->cache.line_num = sym.index;
- }
- }
- }
-
- if (line_info->cache.line_num != 0)
- main_file_name = line_file_name;
-
- /* We need to remove the stuff after the colon in the function
- name. We also need to put the directory name and the file
- name together. */
- if (function_name == NULL)
- len = funclen = 0;
- else
- len = funclen = strlen (function_name) + 1;
-
- if (main_file_name != NULL
- && directory_name != NULL
- && main_file_name[0] != '/')
- len += strlen (directory_name) + strlen (main_file_name) + 1;
-
- if (len != 0)
- {
- if (line_info->find_buffer != NULL)
- free (line_info->find_buffer);
- buffer = (char *) bfd_malloc ((bfd_size_type) len);
- if (buffer == NULL)
- return FALSE;
- line_info->find_buffer = buffer;
- }
-
- if (function_name != NULL)
- {
- char *colon;
-
- strcpy (buffer, function_name);
- colon = strchr (buffer, ':');
- if (colon != NULL)
- *colon = '\0';
- line_info->cache.functionname = buffer;
- }
-
- if (main_file_name != NULL)
- {
- if (directory_name == NULL || main_file_name[0] == '/')
- line_info->cache.filename = main_file_name;
- else
- {
- sprintf (buffer + funclen, "%s%s", directory_name,
- main_file_name);
- line_info->cache.filename = buffer + funclen;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Do the work of find_nearest_line. */
-
-bfd_boolean
-_bfd_ecoff_locate_line (abfd, section, offset, debug_info, debug_swap,
- line_info, filename_ptr, functionname_ptr, retline_ptr)
- bfd *abfd;
- asection *section;
- bfd_vma offset;
- struct ecoff_debug_info * const debug_info;
- const struct ecoff_debug_swap * const debug_swap;
- struct ecoff_find_line *line_info;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *retline_ptr;
-{
- offset += section->vma;
-
- if (line_info->cache.sect == NULL
- || line_info->cache.sect != section
- || offset < line_info->cache.start
- || offset >= line_info->cache.stop)
- {
- line_info->cache.sect = section;
- line_info->cache.start = offset;
- line_info->cache.stop = offset;
- if (! lookup_line (abfd, debug_info, debug_swap, line_info))
- {
- line_info->cache.sect = NULL;
- return FALSE;
- }
- }
-
- *filename_ptr = line_info->cache.filename;
- *functionname_ptr = line_info->cache.functionname;
- *retline_ptr = line_info->cache.line_num;
-
- return TRUE;
-}
-
-/* These routines copy symbolic information into a memory buffer.
-
- FIXME: The whole point of the shuffle code is to avoid storing
- everything in memory, since the linker is such a memory hog. This
- code makes that effort useless. It is only called by the MIPS ELF
- code when generating a shared library, so it is not that big a
- deal, but it should be fixed eventually. */
-
-/* Collect a shuffle into a memory buffer. */
-
-static bfd_boolean ecoff_collect_shuffle
- PARAMS ((struct shuffle *, bfd_byte *));
-
-static bfd_boolean
-ecoff_collect_shuffle (l, buff)
- struct shuffle *l;
- bfd_byte *buff;
-{
- unsigned long total;
-
- total = 0;
- for (; l != (struct shuffle *) NULL; l = l->next)
- {
- if (! l->filep)
- memcpy (buff, l->u.memory, l->size);
- else
- {
- if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
- || (bfd_bread (buff, (bfd_size_type) l->size, l->u.file.input_bfd)
- != l->size))
- return FALSE;
- }
- total += l->size;
- buff += l->size;
- }
-
- return TRUE;
-}
-
-/* Copy PDR information into a memory buffer. */
-
-bfd_boolean
-_bfd_ecoff_get_accumulated_pdr (handle, buff)
- PTR handle;
- bfd_byte *buff;
-{
- struct accumulate *ainfo = (struct accumulate *) handle;
-
- return ecoff_collect_shuffle (ainfo->pdr, buff);
-}
-
-/* Copy symbol information into a memory buffer. */
-
-bfd_boolean
-_bfd_ecoff_get_accumulated_sym (handle, buff)
- PTR handle;
- bfd_byte *buff;
-{
- struct accumulate *ainfo = (struct accumulate *) handle;
-
- return ecoff_collect_shuffle (ainfo->sym, buff);
-}
-
-/* Copy the string table into a memory buffer. */
-
-bfd_boolean
-_bfd_ecoff_get_accumulated_ss (handle, buff)
- PTR handle;
- bfd_byte *buff;
-{
- struct accumulate *ainfo = (struct accumulate *) handle;
- struct string_hash_entry *sh;
- unsigned long total;
-
- /* The string table is written out from the hash table if this is a
- final link. */
- BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL);
- *buff++ = '\0';
- total = 1;
- BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1);
- for (sh = ainfo->ss_hash;
- sh != (struct string_hash_entry *) NULL;
- sh = sh->next)
- {
- size_t len;
-
- len = strlen (sh->root.string);
- memcpy (buff, (PTR) sh->root.string, len + 1);
- total += len + 1;
- buff += len + 1;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/ecoffswap.h b/contrib/binutils/bfd/ecoffswap.h
deleted file mode 100644
index 7ea0394..0000000
--- a/contrib/binutils/bfd/ecoffswap.h
+++ /dev/null
@@ -1,893 +0,0 @@
-/* Generic ECOFF swapping routines, for BFD.
- Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* NOTE: This is a header file, but it contains executable routines.
- This is done this way because these routines are substantially
- similar, but are not identical, for all ECOFF targets.
-
- These are routines to swap the ECOFF symbolic information in and
- out. The routines are defined statically. You can set breakpoints
- on them in gdb by naming the including source file; e.g.,
- 'coff-mips.c':ecoff_swap_hdr_in.
-
- Before including this header file, one of ECOFF_32, ECOFF_64,
- ECOFF_SIGNED_32 or ECOFF_SIGNED_64 must be defined. These are
- checked when swapping information that depends upon the target
- size. This code works for 32 bit and 64 bit ECOFF, but may need to
- be generalized in the future.
-
- Some header file which defines the external forms of these
- structures must also be included before including this header file.
- Currently this is either coff/mips.h or coff/alpha.h.
-
- If the symbol TEST is defined when this file is compiled, a
- comparison is made to ensure that, in fact, the output is
- bit-for-bit the same as the input. Of course, this symbol should
- only be defined when deliberately testing the code on a machine
- with the proper byte sex and such. */
-
-#ifdef ECOFF_32
-#define ECOFF_GET_OFF H_GET_32
-#define ECOFF_PUT_OFF H_PUT_32
-#endif
-#ifdef ECOFF_64
-#define ECOFF_GET_OFF H_GET_64
-#define ECOFF_PUT_OFF H_PUT_64
-#endif
-#ifdef ECOFF_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 H_GET_S64
-#define ECOFF_PUT_OFF H_PUT_S64
-#endif
-
-/* ECOFF auxiliary information swapping routines. These are the same
- for all ECOFF targets, so they are defined in ecofflink.c. */
-
-extern void _bfd_ecoff_swap_tir_in
- PARAMS ((int, const struct tir_ext *, TIR *));
-extern void _bfd_ecoff_swap_tir_out
- PARAMS ((int, const TIR *, struct tir_ext *));
-extern void _bfd_ecoff_swap_rndx_in
- PARAMS ((int, const struct rndx_ext *, RNDXR *));
-extern void _bfd_ecoff_swap_rndx_out
- PARAMS ((int, const RNDXR *, struct rndx_ext *));
-
-/* Prototypes for functions defined in this file. */
-
-static void ecoff_swap_hdr_in PARAMS ((bfd *, PTR, HDRR *));
-static void ecoff_swap_hdr_out PARAMS ((bfd *, const HDRR *, PTR));
-static void ecoff_swap_fdr_in PARAMS ((bfd *, PTR, FDR *));
-static void ecoff_swap_fdr_out PARAMS ((bfd *, const FDR *, PTR));
-static void ecoff_swap_pdr_in PARAMS ((bfd *, PTR, PDR *));
-static void ecoff_swap_pdr_out PARAMS ((bfd *, const PDR *, PTR));
-static void ecoff_swap_sym_in PARAMS ((bfd *, PTR, SYMR *));
-static void ecoff_swap_sym_out PARAMS ((bfd *, const SYMR *, PTR));
-static void ecoff_swap_ext_in PARAMS ((bfd *, PTR, EXTR *));
-static void ecoff_swap_ext_out PARAMS ((bfd *, const EXTR *, PTR));
-static void ecoff_swap_rfd_in PARAMS ((bfd *, PTR, RFDT *));
-static void ecoff_swap_rfd_out PARAMS ((bfd *, const RFDT *, PTR));
-static void ecoff_swap_opt_in PARAMS ((bfd *, PTR, OPTR *));
-static void ecoff_swap_opt_out PARAMS ((bfd *, const OPTR *, PTR));
-static void ecoff_swap_dnr_in PARAMS ((bfd *, PTR, DNR *));
-static void ecoff_swap_dnr_out PARAMS ((bfd *, const DNR *, PTR));
-
-/* Swap in the symbolic header. */
-
-static void
-ecoff_swap_hdr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- HDRR *intern;
-{
- struct hdr_ext ext[1];
-
- *ext = *(struct hdr_ext *) ext_copy;
-
- 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)
- abort ();
-#endif
-}
-
-/* Swap out the symbolic header. */
-
-static void
-ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const HDRR *intern_copy;
- PTR ext_ptr;
-{
- struct hdr_ext *ext = (struct hdr_ext *) ext_ptr;
- HDRR intern[1];
-
- *intern = *intern_copy;
-
- 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)
- abort ();
-#endif
-}
-
-/* Swap in the file descriptor record. */
-
-static void
-ecoff_swap_fdr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- FDR *intern;
-{
- struct fdr_ext ext[1];
-
- *ext = *(struct fdr_ext *) ext_copy;
-
- 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 = 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 = 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 = H_GET_32 (abfd, ext->f_ipdFirst);
- intern->cpd = H_GET_32 (abfd, ext->f_cpd);
-#endif
- 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);
- }
- intern->reserved = 0;
-
- 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)
- abort ();
-#endif
-}
-
-/* Swap out the file descriptor record. */
-
-static void
-ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const FDR *intern_copy;
- PTR ext_ptr;
-{
- struct fdr_ext *ext = (struct fdr_ext *) ext_ptr;
- FDR intern[1];
-
- /* Make it reasonable to do in-place. */
- *intern = *intern_copy;
-
- 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)
- 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)
- H_PUT_32 (abfd, intern->ipdFirst, ext->f_ipdFirst);
- H_PUT_32 (abfd, intern->cpd, ext->f_cpd);
-#endif
- 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;
- }
-
- 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)
- abort ();
-#endif
-}
-
-#ifndef MPW_C
-
-/* Swap in the procedure descriptor record. */
-
-static void
-ecoff_swap_pdr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- PDR *intern;
-{
- struct pdr_ext ext[1];
-
- *ext = *(struct pdr_ext *) ext_copy;
-
- memset ((PTR) intern, 0, sizeof (*intern));
-
- 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)
- if (intern->isym == (signed long) 0xffffffff)
- intern->isym = -1;
- if (intern->iline == (signed long) 0xffffffff)
- intern->iline = -1;
-
- 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);
- intern->reg_frame = 0 != (ext->p_bits1[0] & PDR_BITS1_REG_FRAME_BIG);
- intern->prof = 0 != (ext->p_bits1[0] & PDR_BITS1_PROF_BIG);
- intern->reserved = (((ext->p_bits1[0] & PDR_BITS1_RESERVED_BIG)
- << PDR_BITS1_RESERVED_SH_LEFT_BIG)
- | ((ext->p_bits2[0] & PDR_BITS2_RESERVED_BIG)
- >> PDR_BITS2_RESERVED_SH_BIG));
- }
- else
- {
- intern->gp_used = 0 != (ext->p_bits1[0] & PDR_BITS1_GP_USED_LITTLE);
- intern->reg_frame = 0 != (ext->p_bits1[0] & PDR_BITS1_REG_FRAME_LITTLE);
- intern->prof = 0 != (ext->p_bits1[0] & PDR_BITS1_PROF_LITTLE);
- intern->reserved = (((ext->p_bits1[0] & PDR_BITS1_RESERVED_LITTLE)
- >> PDR_BITS1_RESERVED_SH_LITTLE)
- | ((ext->p_bits2[0] & PDR_BITS2_RESERVED_LITTLE)
- << PDR_BITS2_RESERVED_SH_LEFT_LITTLE));
- }
- intern->localoff = H_GET_8 (abfd, ext->p_localoff);
-#endif
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap out the procedure descriptor record. */
-
-static void
-ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const PDR *intern_copy;
- PTR ext_ptr;
-{
- struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
- PDR intern[1];
-
- /* Make it reasonable to do in-place. */
- *intern = *intern_copy;
-
- 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)
- 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)
- | (intern->reg_frame ? PDR_BITS1_REG_FRAME_BIG : 0)
- | (intern->prof ? PDR_BITS1_PROF_BIG : 0)
- | ((intern->reserved
- >> PDR_BITS1_RESERVED_SH_LEFT_BIG)
- & PDR_BITS1_RESERVED_BIG));
- ext->p_bits2[0] = ((intern->reserved << PDR_BITS2_RESERVED_SH_BIG)
- & PDR_BITS2_RESERVED_BIG);
- }
- else
- {
- ext->p_bits1[0] = ((intern->gp_used ? PDR_BITS1_GP_USED_LITTLE : 0)
- | (intern->reg_frame ? PDR_BITS1_REG_FRAME_LITTLE : 0)
- | (intern->prof ? PDR_BITS1_PROF_LITTLE : 0)
- | ((intern->reserved << PDR_BITS1_RESERVED_SH_LITTLE)
- & PDR_BITS1_RESERVED_LITTLE));
- ext->p_bits2[0] = ((intern->reserved >>
- PDR_BITS2_RESERVED_SH_LEFT_LITTLE)
- & PDR_BITS2_RESERVED_LITTLE);
- }
- H_PUT_8 (abfd, intern->localoff, ext->p_localoff);
-#endif
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-#else /* MPW_C */
-/* Same routines, but with ECOFF_64 code removed, so ^&%$#&! MPW C doesn't
- corrupt itself and then freak out. */
-/* Swap in the procedure descriptor record. */
-
-static void
-ecoff_swap_pdr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- PDR *intern;
-{
- struct pdr_ext ext[1];
-
- *ext = *(struct pdr_ext *) ext_copy;
-
- 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)
- abort ();
-#endif
-}
-
-/* Swap out the procedure descriptor record. */
-
-static void
-ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const PDR *intern_copy;
- PTR ext_ptr;
-{
- struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
- PDR intern[1];
-
- /* Make it reasonable to do in-place. */
- *intern = *intern_copy;
-
- 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)
- abort ();
-#endif
-}
-#endif /* MPW_C */
-
-/* Swap in a symbol record. */
-
-static void
-ecoff_swap_sym_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- SYMR *intern;
-{
- struct sym_ext ext[1];
-
- *ext = *(struct sym_ext *) ext_copy;
-
- intern->iss = H_GET_32 (abfd, ext->s_iss);
- intern->value = ECOFF_GET_OFF (abfd, ext->s_value);
-
-#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- if (intern->iss == (signed long) 0xffffffff)
- intern->iss = -1;
-#endif
-
- /* Now the fun stuff... */
- if (bfd_header_big_endian (abfd))
- {
- intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG)
- >> SYM_BITS1_ST_SH_BIG;
- intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG)
- << SYM_BITS1_SC_SH_LEFT_BIG)
- | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG)
- >> SYM_BITS2_SC_SH_BIG);
- intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG);
- intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG)
- << SYM_BITS2_INDEX_SH_LEFT_BIG)
- | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG)
- | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG);
- }
- else
- {
- intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE)
- >> SYM_BITS1_ST_SH_LITTLE;
- intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE)
- >> SYM_BITS1_SC_SH_LITTLE)
- | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE)
- << SYM_BITS2_SC_SH_LEFT_LITTLE);
- intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE);
- intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE)
- >> SYM_BITS2_INDEX_SH_LITTLE)
- | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE)
- | ((unsigned int) ext->s_bits4[0]
- << SYM_BITS4_INDEX_SH_LEFT_LITTLE);
- }
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap out a symbol record. */
-
-static void
-ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const SYMR *intern_copy;
- PTR ext_ptr;
-{
- struct sym_ext *ext = (struct sym_ext *) ext_ptr;
- SYMR intern[1];
-
- /* Make it reasonable to do in-place. */
- *intern = *intern_copy;
-
- 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))
- {
- ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG)
- & SYM_BITS1_ST_BIG)
- | ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG)
- & SYM_BITS1_SC_BIG));
- ext->s_bits2[0] = (((intern->sc << SYM_BITS2_SC_SH_BIG)
- & SYM_BITS2_SC_BIG)
- | (intern->reserved ? SYM_BITS2_RESERVED_BIG : 0)
- | ((intern->index >> SYM_BITS2_INDEX_SH_LEFT_BIG)
- & SYM_BITS2_INDEX_BIG));
- ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff;
- ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff;
- }
- else
- {
- ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE)
- & SYM_BITS1_ST_LITTLE)
- | ((intern->sc << SYM_BITS1_SC_SH_LITTLE)
- & SYM_BITS1_SC_LITTLE));
- ext->s_bits2[0] = (((intern->sc >> SYM_BITS2_SC_SH_LEFT_LITTLE)
- & SYM_BITS2_SC_LITTLE)
- | (intern->reserved ? SYM_BITS2_RESERVED_LITTLE : 0)
- | ((intern->index << SYM_BITS2_INDEX_SH_LITTLE)
- & SYM_BITS2_INDEX_LITTLE));
- ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_LITTLE) & 0xff;
- ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_LITTLE) & 0xff;
- }
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap in an external symbol record. */
-
-static void
-ecoff_swap_ext_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- EXTR *intern;
-{
- struct ext_ext ext[1];
-
- *ext = *(struct ext_ext *) ext_copy;
-
- /* Now the fun stuff... */
- if (bfd_header_big_endian (abfd))
- {
- intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG);
- intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG);
- intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG);
- }
- else
- {
- intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE);
- intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE);
- intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE);
- }
- intern->reserved = 0;
-
-#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
- intern->ifd = H_GET_S16 (abfd, ext->es_ifd);
-#endif
-#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- intern->ifd = H_GET_S32 (abfd, ext->es_ifd);
-#endif
-
- ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym);
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap out an external symbol record. */
-
-static void
-ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const EXTR *intern_copy;
- PTR ext_ptr;
-{
- struct ext_ext *ext = (struct ext_ext *) ext_ptr;
- EXTR intern[1];
-
- /* Make it reasonable to do in-place. */
- *intern = *intern_copy;
-
- /* Now the fun stuff... */
- if (bfd_header_big_endian (abfd))
- {
- ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0)
- | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
- | (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
- ext->es_bits2[0] = 0;
-#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- ext->es_bits2[1] = 0;
- ext->es_bits2[2] = 0;
-#endif
- }
- else
- {
- ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0)
- | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
- | (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
- ext->es_bits2[0] = 0;
-#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- ext->es_bits2[1] = 0;
- ext->es_bits2[2] = 0;
-#endif
- }
-
-#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
- H_PUT_S16 (abfd, intern->ifd, ext->es_ifd);
-#endif
-#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- H_PUT_S32 (abfd, intern->ifd, ext->es_ifd);
-#endif
-
- ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym);
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap in a relative file descriptor. */
-
-static void
-ecoff_swap_rfd_in (abfd, ext_ptr, intern)
- bfd *abfd;
- PTR ext_ptr;
- RFDT *intern;
-{
- struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
-
- *intern = H_GET_32 (abfd, ext->rfd);
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap out a relative file descriptor. */
-
-static void
-ecoff_swap_rfd_out (abfd, intern, ext_ptr)
- bfd *abfd;
- const RFDT *intern;
- PTR ext_ptr;
-{
- struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
-
- H_PUT_32 (abfd, *intern, ext->rfd);
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap in an optimization symbol. */
-
-static void
-ecoff_swap_opt_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- OPTR *intern;
-{
- struct opt_ext ext[1];
-
- *ext = *(struct opt_ext *) ext_copy;
-
- if (bfd_header_big_endian (abfd))
- {
- intern->ot = ext->o_bits1[0];
- intern->value = (((unsigned int) ext->o_bits2[0]
- << OPT_BITS2_VALUE_SH_LEFT_BIG)
- | ((unsigned int) ext->o_bits3[0]
- << OPT_BITS2_VALUE_SH_LEFT_BIG)
- | ((unsigned int) ext->o_bits4[0]
- << OPT_BITS2_VALUE_SH_LEFT_BIG));
- }
- else
- {
- intern->ot = ext->o_bits1[0];
- intern->value = ((ext->o_bits2[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE)
- | (ext->o_bits3[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE)
- | (ext->o_bits4[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE));
- }
-
- _bfd_ecoff_swap_rndx_in (bfd_header_big_endian (abfd),
- &ext->o_rndx, &intern->rndx);
-
- intern->offset = H_GET_32 (abfd, ext->o_offset);
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap out an optimization symbol. */
-
-static void
-ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const OPTR *intern_copy;
- PTR ext_ptr;
-{
- struct opt_ext *ext = (struct opt_ext *) ext_ptr;
- OPTR intern[1];
-
- /* Make it reasonable to do in-place. */
- *intern = *intern_copy;
-
- if (bfd_header_big_endian (abfd))
- {
- ext->o_bits1[0] = intern->ot;
- ext->o_bits2[0] = intern->value >> OPT_BITS2_VALUE_SH_LEFT_BIG;
- ext->o_bits3[0] = intern->value >> OPT_BITS3_VALUE_SH_LEFT_BIG;
- ext->o_bits4[0] = intern->value >> OPT_BITS4_VALUE_SH_LEFT_BIG;
- }
- else
- {
- ext->o_bits1[0] = intern->ot;
- ext->o_bits2[0] = intern->value >> OPT_BITS2_VALUE_SH_LEFT_LITTLE;
- ext->o_bits3[0] = intern->value >> OPT_BITS3_VALUE_SH_LEFT_LITTLE;
- ext->o_bits4[0] = intern->value >> OPT_BITS4_VALUE_SH_LEFT_LITTLE;
- }
-
- _bfd_ecoff_swap_rndx_out (bfd_header_big_endian (abfd),
- &intern->rndx, &ext->o_rndx);
-
- H_PUT_32 (abfd, intern->value, ext->o_offset);
-
-#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
- abort ();
-#endif
-}
-
-/* Swap in a dense number. */
-
-static void
-ecoff_swap_dnr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- DNR *intern;
-{
- struct dnr_ext ext[1];
-
- *ext = *(struct dnr_ext *) ext_copy;
-
- 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)
- abort ();
-#endif
-}
-
-/* Swap out a dense number. */
-
-static void
-ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
- bfd *abfd;
- const DNR *intern_copy;
- PTR ext_ptr;
-{
- struct dnr_ext *ext = (struct dnr_ext *) ext_ptr;
- DNR intern[1];
-
- /* Make it reasonable to do in-place. */
- *intern = *intern_copy;
-
- 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)
- abort ();
-#endif
-}
diff --git a/contrib/binutils/bfd/efi-app-ia32.c b/contrib/binutils/bfd/efi-app-ia32.c
deleted file mode 100644
index 92a17ef..0000000
--- a/contrib/binutils/bfd/efi-app-ia32.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* BFD back-end for Intel IA-32 EFI application files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- Contributed by David Mosberger <davidm@hpl.hp.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#define TARGET_SYM bfd_efi_app_ia32_vec
-#define TARGET_NAME "efi-app-ia32"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-#define COFF_LONG_SECTION_NAMES
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-i386.c"
diff --git a/contrib/binutils/bfd/efi-app-ia64.c b/contrib/binutils/bfd/efi-app-ia64.c
deleted file mode 100644
index c7e9bcf..0000000
--- a/contrib/binutils/bfd/efi-app-ia64.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* BFD back-end for HP/Intel IA-64 EFI application files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- Contributed by David Mosberger <davidm@hpl.hp.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#define TARGET_SYM bfd_efi_app_ia64_vec
-#define TARGET_NAME "efi-app-ia64"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define COFF_WITH_pep
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-#define COFF_LONG_SECTION_NAMES
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-ia64.c"
diff --git a/contrib/binutils/bfd/elf-bfd.h b/contrib/binutils/bfd/elf-bfd.h
deleted file mode 100644
index 110dd69..0000000
--- a/contrib/binutils/bfd/elf-bfd.h
+++ /dev/null
@@ -1,1762 +0,0 @@
-/* BFD back-end data structures for ELF files.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _LIBELF_H_
-#define _LIBELF_H_ 1
-
-#include "elf/common.h"
-#include "elf/internal.h"
-#include "elf/external.h"
-#include "bfdlink.h"
-
-/* The number of entries in a section is its size divided by the size
- of a single entry. This is normally only applicable to reloc and
- symbol table sections. */
-#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
-
-/* If size isn't specified as 64 or 32, NAME macro should fail. */
-#ifndef NAME
-#if ARCH_SIZE == 64
-#define NAME(x, y) x ## 64 ## _ ## y
-#endif
-#if ARCH_SIZE == 32
-#define NAME(x, y) x ## 32 ## _ ## y
-#endif
-#endif
-
-#ifndef NAME
-#define NAME(x, y) x ## NOSIZE ## _ ## y
-#endif
-
-#define ElfNAME(X) NAME(Elf,X)
-#define elfNAME(X) NAME(elf,X)
-
-/* Information held for an ELF symbol. The first field is the
- corresponding asymbol. Every symbol is an ELF file is actually a
- pointer to this structure, although it is often handled as a
- pointer to an asymbol. */
-
-typedef struct
-{
- /* The BFD symbol. */
- asymbol symbol;
- /* ELF symbol information. */
- Elf_Internal_Sym internal_elf_sym;
- /* Backend specific information. */
- union
- {
- unsigned int hppa_arg_reloc;
- void *mips_extr;
- void *any;
- }
- tc_data;
-
- /* Version information. This is from an Elf_Internal_Versym
- structure in a SHT_GNU_versym section. It is zero if there is no
- version information. */
- unsigned short version;
-
-} elf_symbol_type;
-
-struct elf_strtab_hash;
-struct got_entry;
-struct plt_entry;
-
-/* ELF linker hash table entries. */
-
-struct elf_link_hash_entry
-{
- struct bfd_link_hash_entry root;
-
- /* Symbol index in output file. This is initialized to -1. It is
- set to -2 if the symbol is used by a reloc. */
- long indx;
-
- /* Symbol index as a dynamic symbol. Initialized to -1, and remains
- -1 if this is not a dynamic symbol. */
- /* ??? Note that this is consistently used as a synonym for tests
- against whether we can perform various simplifying transformations
- to the code. (E.g. changing a pc-relative jump to a PLT entry
- into a pc-relative jump to the target function.) That test, which
- is often relatively complex, and someplaces wrong or incomplete,
- should really be replaced by a predicate in elflink.c.
-
- End result: this field -1 does not indicate that the symbol is
- not in the dynamic symbol table, but rather that the symbol is
- not visible outside this DSO. */
- long dynindx;
-
- /* String table index in .dynstr if this is a dynamic symbol. */
- unsigned long dynstr_index;
-
- /* Hash value of the name computed using the ELF hash function. */
- unsigned long elf_hash_value;
-
- /* If this is a weak defined symbol from a dynamic object, this
- field points to a defined symbol with the same value, if there is
- one. Otherwise it is NULL. */
- struct elf_link_hash_entry *weakdef;
-
- /* Version information. */
- union
- {
- /* This field is used for a symbol which is not defined in a
- regular object. It points to the version information read in
- from the dynamic object. */
- Elf_Internal_Verdef *verdef;
- /* This field is used for a symbol which is defined in a regular
- object. It is set up in size_dynamic_sections. It points to
- the version information we should write out for this symbol. */
- struct bfd_elf_version_tree *vertree;
- } verinfo;
-
- /* Virtual table entry use information. This array is nominally of size
- size/sizeof(target_void_pointer), though we have to be able to assume
- and track a size while the symbol is still undefined. It is indexed
- via offset/sizeof(target_void_pointer). */
- size_t vtable_entries_size;
- bfd_boolean *vtable_entries_used;
-
- /* Virtual table derivation info. */
- struct elf_link_hash_entry *vtable_parent;
-
- /* If this symbol requires an entry in the global offset table, the
- processor specific backend uses this field to track usage and
- final offset. Two schemes are supported: The first assumes that
- a symbol may only have one GOT entry, and uses REFCOUNT until
- size_dynamic_sections, at which point the contents of the .got is
- fixed. Afterward, if OFFSET is -1, then the symbol does not
- require a global offset table entry. The second scheme allows
- multiple GOT entries per symbol, managed via a linked list
- pointed to by GLIST. */
- union gotplt_union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- struct got_entry *glist;
- struct plt_entry *plist;
- } got;
-
- /* Same, but tracks a procedure linkage table entry. */
- union gotplt_union plt;
-
- /* Symbol size. */
- bfd_size_type size;
-
- /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
- char type;
-
- /* Symbol st_other value, symbol visibility. */
- unsigned char other;
-
- /* Some flags; legal values follow. */
- unsigned short elf_link_hash_flags;
- /* Symbol is referenced by a non-shared object. */
-#define ELF_LINK_HASH_REF_REGULAR 01
- /* Symbol is defined by a non-shared object. */
-#define ELF_LINK_HASH_DEF_REGULAR 02
- /* Symbol is referenced by a shared object. */
-#define ELF_LINK_HASH_REF_DYNAMIC 04
- /* Symbol is defined by a shared object. */
-#define ELF_LINK_HASH_DEF_DYNAMIC 010
- /* Symbol has a non-weak reference from a non-shared object. */
-#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
- /* Dynamic symbol has been adjustd. */
-#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
- /* Symbol needs a copy reloc. */
-#define ELF_LINK_HASH_NEEDS_COPY 0100
- /* Symbol needs a procedure linkage table entry. */
-#define ELF_LINK_HASH_NEEDS_PLT 0200
- /* Symbol appears in a non-ELF input file. */
-#define ELF_LINK_NON_ELF 0400
- /* Symbol should be marked as hidden in the version information. */
-#define ELF_LINK_HIDDEN 01000
- /* Symbol was forced to local scope due to a version script file. */
-#define ELF_LINK_FORCED_LOCAL 02000
- /* Symbol was marked during garbage collection. */
-#define ELF_LINK_HASH_MARK 04000
- /* Symbol is referenced by a non-GOT/non-PLT relocation. This is
- not currently set by all the backends. */
-#define ELF_LINK_NON_GOT_REF 010000
- /* Symbol has a definition in a shared object. */
-#define ELF_LINK_DYNAMIC_DEF 020000
- /* Symbol is weak in all shared objects. */
-#define ELF_LINK_DYNAMIC_WEAK 040000
- /* Symbol is referenced with a relocation where C/C++ pointer equality
- matters. */
-#define ELF_LINK_POINTER_EQUALITY_NEEDED 0100000
-};
-
-/* Will references to this symbol always reference the symbol
- in this object? STV_PROTECTED is excluded from the visibility test
- here so that function pointer comparisons work properly. Since
- function symbols not defined in an app are set to their .plt entry,
- it's necessary for shared libs to also reference the .plt even
- though the symbol is really local to the shared lib. */
-#define SYMBOL_REFERENCES_LOCAL(INFO, H) \
- _bfd_elf_symbol_refs_local_p (H, INFO, 0)
-
-/* Will _calls_ to this symbol always call the version in this object? */
-#define SYMBOL_CALLS_LOCAL(INFO, H) \
- _bfd_elf_symbol_refs_local_p (H, INFO, 1)
-
-/* Records local symbols to be emitted in the dynamic symbol table. */
-
-struct elf_link_local_dynamic_entry
-{
- struct elf_link_local_dynamic_entry *next;
-
- /* The input bfd this symbol came from. */
- bfd *input_bfd;
-
- /* The index of the local symbol being copied. */
- long input_indx;
-
- /* The index in the outgoing dynamic symbol table. */
- long dynindx;
-
- /* A copy of the input symbol. */
- Elf_Internal_Sym isym;
-};
-
-struct elf_link_loaded_list
-{
- struct elf_link_loaded_list *next;
- bfd *abfd;
-};
-
-/* Structures used by the eh_frame optimization code. */
-struct cie_header
-{
- unsigned int length;
- unsigned int id;
-};
-
-struct cie
-{
- struct cie_header hdr;
- unsigned char version;
- unsigned char augmentation[20];
- unsigned int code_align;
- int data_align;
- unsigned int ra_column;
- unsigned int augmentation_size;
- struct elf_link_hash_entry *personality;
- unsigned char per_encoding;
- unsigned char lsda_encoding;
- unsigned char fde_encoding;
- unsigned char initial_insn_length;
- unsigned char make_relative;
- unsigned char make_lsda_relative;
- unsigned char initial_instructions[50];
-};
-
-struct eh_cie_fde
-{
- unsigned int offset;
- unsigned int size;
- asection *sec;
- unsigned int new_offset;
- unsigned char fde_encoding;
- unsigned char lsda_encoding;
- unsigned char lsda_offset;
- unsigned char cie : 1;
- unsigned char removed : 1;
- unsigned char make_relative : 1;
- unsigned char make_lsda_relative : 1;
- unsigned char per_encoding_relative : 1;
-};
-
-struct eh_frame_sec_info
-{
- unsigned int count;
- unsigned int alloced;
- struct eh_cie_fde entry[1];
-};
-
-struct eh_frame_array_ent
-{
- bfd_vma initial_loc;
- bfd_vma fde;
-};
-
-struct eh_frame_hdr_info
-{
- struct cie last_cie;
- asection *last_cie_sec;
- asection *hdr_sec;
- unsigned int last_cie_offset;
- unsigned int fde_count, array_count;
- struct eh_frame_array_ent *array;
- /* TRUE if .eh_frame_hdr should contain the sorted search table.
- We build it if we successfully read all .eh_frame input sections
- and recognize them. */
- bfd_boolean table;
-};
-
-/* ELF linker hash table. */
-
-struct elf_link_hash_table
-{
- struct bfd_link_hash_table root;
-
- /* Whether we have created the special dynamic sections required
- when linking against or generating a shared object. */
- bfd_boolean dynamic_sections_created;
-
- /* The BFD used to hold special sections created by the linker.
- This will be the first BFD found which requires these sections to
- be created. */
- bfd *dynobj;
-
- /* The value to use when initialising got.refcount/offset and
- plt.refcount/offset in an elf_link_hash_entry. Set to zero when
- the values are refcounts. Set to init_offset in
- size_dynamic_sections when the values may be offsets. */
- union gotplt_union init_refcount;
-
- /* The value to use for got.refcount/offset and plt.refcount/offset
- when the values may be offsets. Normally (bfd_vma) -1. */
- union gotplt_union init_offset;
-
- /* The number of symbols found in the link which must be put into
- the .dynsym section. */
- bfd_size_type dynsymcount;
-
- /* The string table of dynamic symbols, which becomes the .dynstr
- section. */
- struct elf_strtab_hash *dynstr;
-
- /* The number of buckets in the hash table in the .hash section.
- This is based on the number of dynamic symbols. */
- bfd_size_type bucketcount;
-
- /* A linked list of DT_NEEDED names found in dynamic objects
- included in the link. */
- struct bfd_link_needed_list *needed;
-
- /* The _GLOBAL_OFFSET_TABLE_ symbol. */
- struct elf_link_hash_entry *hgot;
-
- /* A pointer to information used to link stabs in sections. */
- void *stab_info;
-
- /* A pointer to information used to merge SEC_MERGE sections. */
- void *merge_info;
-
- /* Used by eh_frame code when editing .eh_frame. */
- struct eh_frame_hdr_info eh_info;
-
- /* A linked list of local symbols to be added to .dynsym. */
- struct elf_link_local_dynamic_entry *dynlocal;
-
- /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
- objects included in the link. */
- struct bfd_link_needed_list *runpath;
-
- /* Cached first output tls section and size of PT_TLS segment. */
- asection *tls_sec;
- bfd_size_type tls_size;
-
- /* A linked list of BFD's loaded in the link. */
- struct elf_link_loaded_list *loaded;
-};
-
-/* Look up an entry in an ELF linker hash table. */
-
-#define elf_link_hash_lookup(table, string, create, copy, follow) \
- ((struct elf_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), \
- (copy), (follow)))
-
-/* Traverse an ELF linker hash table. */
-
-#define elf_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
- (info)))
-
-/* Get the ELF linker hash table from a link_info structure. */
-
-#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
-
-/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
-#define is_elf_hash_table(htab) \
- (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
-
-/* Used by bfd_section_from_r_symndx to cache a small number of local
- symbol to section mappings. */
-#define LOCAL_SYM_CACHE_SIZE 32
-struct sym_sec_cache
-{
- bfd *abfd;
- unsigned long indx[LOCAL_SYM_CACHE_SIZE];
- asection *sec[LOCAL_SYM_CACHE_SIZE];
-};
-
-/* Constant information held for an ELF backend. */
-
-struct elf_size_info {
- unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
- unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
-
- /* The size of entries in the .hash section. */
- unsigned char sizeof_hash_entry;
-
- /* The number of internal relocations to allocate per external
- relocation entry. */
- unsigned char int_rels_per_ext_rel;
- /* We use some fixed size arrays. This should be large enough to
- handle all back-ends. */
-#define MAX_INT_RELS_PER_EXT_REL 3
-
- unsigned char arch_size, log_file_align;
- unsigned char elfclass, ev_current;
- int (*write_out_phdrs)
- (bfd *, const Elf_Internal_Phdr *, unsigned int);
- bfd_boolean
- (*write_shdrs_and_ehdr) (bfd *);
- void (*write_relocs)
- (bfd *, asection *, void *);
- void (*swap_symbol_in)
- (bfd *, const void *, const void *, Elf_Internal_Sym *);
- void (*swap_symbol_out)
- (bfd *, const Elf_Internal_Sym *, void *, void *);
- bfd_boolean (*slurp_reloc_table)
- (bfd *, asection *, asymbol **, bfd_boolean);
- long (*slurp_symbol_table)
- (bfd *, asymbol **, bfd_boolean);
- void (*swap_dyn_in)
- (bfd *, const void *, Elf_Internal_Dyn *);
- void (*swap_dyn_out)
- (bfd *, const Elf_Internal_Dyn *, void *);
-
- /* This function is called to swap in a REL relocation. If an
- external relocation corresponds to more than one internal
- relocation, then all relocations are swapped in at once. */
- void (*swap_reloc_in)
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-
- /* This function is called to swap out a REL relocation. */
- void (*swap_reloc_out)
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-
- /* This function is called to swap in a RELA relocation. If an
- external relocation corresponds to more than one internal
- relocation, then all relocations are swapped in at once. */
- void (*swap_reloca_in)
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-
- /* This function is called to swap out a RELA relocation. */
- void (*swap_reloca_out)
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-};
-
-#define elf_symbol_from(ABFD,S) \
- (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
- && (S)->the_bfd->tdata.elf_obj_data != 0) \
- ? (elf_symbol_type *) (S) \
- : 0)
-
-enum elf_reloc_type_class {
- reloc_class_normal,
- reloc_class_relative,
- reloc_class_plt,
- reloc_class_copy
-};
-
-struct elf_reloc_cookie
-{
- Elf_Internal_Rela *rels, *rel, *relend;
- Elf_Internal_Sym *locsyms;
- bfd *abfd;
- size_t locsymcount;
- size_t extsymoff;
- struct elf_link_hash_entry **sym_hashes;
- int r_sym_shift;
- bfd_boolean bad_symtab;
-};
-
-/* The level of IRIX compatibility we're striving for. */
-
-typedef enum {
- ict_none,
- ict_irix5,
- ict_irix6
-} irix_compat_t;
-
-/* Mapping of ELF section names and types. */
-struct bfd_elf_special_section
-{
- const char *prefix;
- int prefix_length;
- /* 0 means name must match PREFIX exactly.
- -1 means name must start with PREFIX followed by an arbitrary string.
- -2 means name must match PREFIX exactly or consist of PREFIX followed
- by a dot then anything.
- > 0 means name must start with the first PREFIX_LENGTH chars of
- PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */
- int suffix_length;
- int type;
- int attr;
-};
-
-struct elf_backend_data
-{
- /* The architecture for this backend. */
- enum bfd_architecture arch;
-
- /* The ELF machine code (EM_xxxx) for this backend. */
- int elf_machine_code;
-
- /* The maximum page size for this backend. */
- bfd_vma maxpagesize;
-
- /* A function to translate an ELF RELA relocation to a BFD arelent
- structure. */
- void (*elf_info_to_howto)
- (bfd *, arelent *, Elf_Internal_Rela *);
-
- /* A function to translate an ELF REL relocation to a BFD arelent
- structure. */
- void (*elf_info_to_howto_rel)
- (bfd *, arelent *, Elf_Internal_Rela *);
-
- /* 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. */
- bfd_boolean (*elf_backend_sym_is_global)
- (bfd *, asymbol *);
-
- /* The remaining functions are hooks which are called only if they
- are not NULL. */
-
- /* A function to permit a backend specific check on whether a
- particular BFD format is relevant for an object file, and to
- permit the backend to set any global information it wishes. When
- 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. */
- bfd_boolean (*elf_backend_object_p)
- (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)
- (bfd *, asymbol *);
-
- /* A function to do additional symbol processing after reading the
- entire ELF symbol table. */
- bfd_boolean (*elf_backend_symbol_table_processing)
- (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)
- (Elf_Internal_Sym *, int);
-
- /* Return true if local section symbols should have a non-null st_name.
- NULL implies false. */
- bfd_boolean (*elf_backend_name_local_section_symbols)
- (bfd *);
-
- /* 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. */
- bfd_boolean (*elf_backend_section_processing)
- (bfd *, Elf_Internal_Shdr *);
-
- /* A function to handle unusual section types when creating BFD
- sections from ELF sections. */
- bfd_boolean (*elf_backend_section_from_shdr)
- (bfd *, Elf_Internal_Shdr *, const char *);
-
- /* A function to convert machine dependent section header flags to
- BFD internal section header flags. */
- bfd_boolean (*elf_backend_section_flags)
- (flagword *, Elf_Internal_Shdr *);
-
- /* A function to handle unusual program segment types when creating BFD
- sections from ELF program segments. */
- bfd_boolean (*elf_backend_section_from_phdr)
- (bfd *, Elf_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. */
- bfd_boolean (*elf_backend_fake_sections)
- (bfd *, Elf_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
- section, *RETVAL should be left unchanged. If it is not a normal
- ELF section *RETVAL should be set to the SHN_xxxx index. */
- bfd_boolean (*elf_backend_section_from_bfd_section)
- (bfd *, asection *, int *retval);
-
- /* If this field is not NULL, it is called by the add_symbols phase
- of a link just before adding a symbol to the global linker hash
- table. It may modify any of the fields as it wishes. If *NAME
- is set to NULL, the symbol will be skipped rather than being
- added to the hash table. This function is responsible for
- handling all processor dependent symbol bindings and section
- indices, and must set at least *FLAGS and *SEC for each processor
- dependent case; failure to do so will cause a link error. */
- bfd_boolean (*elf_add_symbol_hook)
- (bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *,
- const char **name, flagword *flags, asection **sec, bfd_vma *value);
-
- /* If this field is not NULL, it is called by the elf_link_output_sym
- phase of a link for each symbol which will appear in the object file. */
- bfd_boolean (*elf_backend_link_output_symbol_hook)
- (struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
- asection *, struct elf_link_hash_entry *);
-
- /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
- linker the first time it encounters a dynamic object in the link.
- This function must create any sections required for dynamic
- linking. The ABFD argument is a dynamic object. The .interp,
- .dynamic, .dynsym, .dynstr, and .hash functions have already been
- created, and this function may modify the section flags if
- desired. This function will normally create the .got and .plt
- sections, but different backends have different requirements. */
- bfd_boolean (*elf_backend_create_dynamic_sections)
- (bfd *abfd, struct bfd_link_info *info);
-
- /* The CHECK_RELOCS function is called by the add_symbols phase of
- the ELF backend linker. It is called once for each section with
- relocs of an object file, just after the symbols for the object
- file have been added to the global linker hash table. The
- function must look through the relocs and do any special handling
- required. This generally means allocating space in the global
- offset table, and perhaps allocating space for a reloc. The
- relocs are always passed as Rela structures; if the section
- actually uses Rel structures, the r_addend field will always be
- zero. */
- bfd_boolean (*check_relocs)
- (bfd *abfd, struct bfd_link_info *info, asection *o,
- const Elf_Internal_Rela *relocs);
-
- /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
- linker for every symbol which is defined by a dynamic object and
- referenced by a regular object. This is called after all the
- input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
- function has been called. The hash table entry should be
- bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
- defined in a section from a dynamic object. Dynamic object
- sections are not included in the final link, and this function is
- responsible for changing the value to something which the rest of
- the link can deal with. This will normally involve adding an
- entry to the .plt or .got or some such section, and setting the
- symbol to point to that. */
- bfd_boolean (*elf_backend_adjust_dynamic_symbol)
- (struct bfd_link_info *info, struct elf_link_hash_entry *h);
-
- /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
- after all the linker input files have been seen but before the
- section sizes have been set. This is called after
- ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
- bfd_boolean (*elf_backend_always_size_sections)
- (bfd *output_bfd, struct bfd_link_info *info);
-
- /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
- linker after all the linker input files have been seen but before
- the sections sizes have been set. This is called after
- ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
- It is only called when linking against a dynamic object. It must
- set the sizes of the dynamic sections, and may fill in their
- contents as well. The generic ELF linker can handle the .dynsym,
- .dynstr and .hash sections. This function must handle the
- .interp section and any sections created by the
- CREATE_DYNAMIC_SECTIONS entry point. */
- bfd_boolean (*elf_backend_size_dynamic_sections)
- (bfd *output_bfd, struct bfd_link_info *info);
-
- /* The RELOCATE_SECTION function is called by the ELF backend linker
- to handle the relocations for a section.
-
- The relocs are always passed as Rela structures; if the section
- actually uses Rel structures, the r_addend field will always be
- zero.
-
- This function is responsible for adjust the section contents as
- necessary, and (if using Rela relocs and generating a
- relocatable output file) adjusting the reloc addend as
- necessary.
-
- This function does not have to worry about setting the reloc
- address or the reloc symbol index.
-
- LOCAL_SYMS is a pointer to the swapped in local symbols.
-
- LOCAL_SECTIONS is an array giving the section in the input file
- corresponding to the st_shndx field of each local symbol.
-
- The global hash table entry for the global symbols can be found
- via elf_sym_hashes (input_bfd).
-
- When generating relocatable output, this function must handle
- STB_LOCAL/STT_SECTION symbols specially. The output symbol is
- going to be the section symbol corresponding to the output
- section, which means that the addend must be adjusted
- accordingly. */
- bfd_boolean (*elf_backend_relocate_section)
- (bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd,
- asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms, asection **local_sections);
-
- /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
- linker just before it writes a symbol out to the .dynsym section.
- The processor backend may make any required adjustment to the
- symbol. It may also take the opportunity to set contents of the
- dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
- all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
- on those symbols which are defined by a dynamic object. */
- bfd_boolean (*elf_backend_finish_dynamic_symbol)
- (bfd *output_bfd, struct bfd_link_info *info,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *sym);
-
- /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
- linker just before it writes all the dynamic sections out to the
- output file. The FINISH_DYNAMIC_SYMBOL will have been called on
- all dynamic symbols. */
- bfd_boolean (*elf_backend_finish_dynamic_sections)
- (bfd *output_bfd, struct bfd_link_info *info);
-
- /* A function to do any beginning processing needed for the ELF file
- before building the ELF headers and computing file positions. */
- void (*elf_backend_begin_write_processing)
- (bfd *, struct bfd_link_info *);
-
- /* A function to do any final processing needed for the ELF file
- before writing it out. The LINKER argument is TRUE if this BFD
- was created by the ELF backend linker. */
- void (*elf_backend_final_write_processing)
- (bfd *, bfd_boolean linker);
-
- /* 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)
- (bfd *);
-
- /* This function is called to modify an existing segment map in a
- backend specific fashion. */
- bfd_boolean (*elf_backend_modify_segment_map)
- (bfd *, struct bfd_link_info *);
-
- /* This function is called during section gc to discover the section a
- particular relocation refers to. */
- asection * (*gc_mark_hook)
- (asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *);
-
- /* This function, if defined, is called during the sweep phase of gc
- in order that a backend might update any data structures it might
- be maintaining. */
- bfd_boolean (*gc_sweep_hook)
- (bfd *abfd, struct bfd_link_info *info, asection *o,
- const Elf_Internal_Rela *relocs);
-
- /* This function, if defined, is called after the ELF headers have
- been created. This allows for things like the OS and ABI versions
- to be changed. */
- void (*elf_backend_post_process_headers)
- (bfd *, struct bfd_link_info *);
-
- /* This function, if defined, prints a symbol to file and returns the
- name of the symbol to be printed. It should return NULL to fall
- back to default symbol printing. */
- const char *(*elf_backend_print_symbol_all)
- (bfd *, void *, asymbol *);
-
- /* This function, if defined, is called after all local symbols and
- global symbols converted to locals are emitted into the symtab
- section. It allows the backend to emit special global symbols
- not handled in the hash table. */
- bfd_boolean (*elf_backend_output_arch_syms)
- (bfd *, struct bfd_link_info *, void *,
- bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *,
- struct elf_link_hash_entry *));
-
- /* Copy any information related to dynamic linking from a pre-existing
- symbol to a newly created symbol. Also called to copy flags and
- other back-end info to a weakdef, in which case the symbol is not
- newly created and plt/got refcounts and dynamic indices should not
- be copied. */
- void (*elf_backend_copy_indirect_symbol)
- (const struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *);
-
- /* Modify any information related to dynamic linking such that the
- symbol is not exported. */
- void (*elf_backend_hide_symbol)
- (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
-
- /* Merge the backend specific symbol attribute. */
- void (*elf_backend_merge_symbol_attribute)
- (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
- bfd_boolean);
-
- /* Emit relocations. Overrides default routine for emitting relocs,
- except during a relocatable link, or if all relocs are being emitted. */
- bfd_boolean (*elf_backend_emit_relocs)
- (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
-
- /* Count relocations. Not called for relocatable links
- or if all relocs are being preserved in the output. */
- unsigned int (*elf_backend_count_relocs)
- (asection *, Elf_Internal_Rela *);
-
- /* This function, if defined, is called when an NT_PRSTATUS note is found
- in a core file. */
- bfd_boolean (*elf_backend_grok_prstatus)
- (bfd *, Elf_Internal_Note *);
-
- /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
- note is found in a core file. */
- bfd_boolean (*elf_backend_grok_psinfo)
- (bfd *, Elf_Internal_Note *);
-
- /* Functions to print VMAs. Special code to handle 64 bit ELF files. */
- void (* elf_backend_sprintf_vma)
- (bfd *, char *, bfd_vma);
- void (* elf_backend_fprintf_vma)
- (bfd *, void *, bfd_vma);
-
- /* This function returns class of a reloc type. */
- enum elf_reloc_type_class (*elf_backend_reloc_type_class)
- (const Elf_Internal_Rela *);
-
- /* This function, if defined, removes information about discarded functions
- from other sections which mention them. */
- bfd_boolean (*elf_backend_discard_info)
- (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *);
-
- /* This function, if defined, signals that the function above has removed
- the discarded relocations for this section. */
- bfd_boolean (*elf_backend_ignore_discarded_relocs)
- (asection *);
-
- /* These functions tell elf-eh-frame whether to attempt to turn
- absolute or lsda encodings into pc-relative ones. The default
- definition enables these transformations. */
- bfd_boolean (*elf_backend_can_make_relative_eh_frame)
- (bfd *, struct bfd_link_info *, asection *);
- bfd_boolean (*elf_backend_can_make_lsda_relative_eh_frame)
- (bfd *, struct bfd_link_info *, asection *);
-
- /* This function returns an encoding after computing the encoded
- value (and storing it in ENCODED) for the given OFFSET into OSEC,
- to be stored in at LOC_OFFSET into the LOC_SEC input section.
- The default definition chooses a 32-bit PC-relative encoding. */
- bfd_byte (*elf_backend_encode_eh_address)
- (bfd *abfd, struct bfd_link_info *info,
- asection *osec, bfd_vma offset,
- asection *loc_sec, bfd_vma loc_offset,
- bfd_vma *encoded);
-
- /* This function, if defined, may write out the given section.
- Returns TRUE if it did so and FALSE if the caller should. */
- bfd_boolean (*elf_backend_write_section)
- (bfd *, asection *, bfd_byte *);
-
- /* The level of IRIX compatibility we're striving for.
- MIPS ELF specific function. */
- irix_compat_t (*elf_backend_mips_irix_compat)
- (bfd *);
-
- reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
- (unsigned int, bfd_boolean);
-
- /* The swapping table to use when dealing with ECOFF information.
- Used for the MIPS ELF .mdebug section. */
- const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
-
- /* This function implements `bfd_elf_bfd_from_remote_memory';
- see elf.c, elfcode.h. */
- bfd *(*elf_backend_bfd_from_remote_memory)
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
-
- /* Alternate EM_xxxx machine codes for this backend. */
- int elf_machine_alt1;
- int elf_machine_alt2;
-
- const struct elf_size_info *s;
-
- /* An array of target specific special section map. */
- const struct bfd_elf_special_section *special_sections;
-
- /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
- .got section */
- bfd_vma got_symbol_offset;
-
- /* The size in bytes of the header for the GOT. This includes the
- so-called reserved entries on some systems. */
- bfd_vma got_header_size;
-
- /* This is TRUE if the linker should act like collect and gather
- global constructors and destructors by name. This is TRUE for
- MIPS ELF because the Irix 5 tools can not handle the .init
- section. */
- unsigned collect : 1;
-
- /* This is TRUE if the linker should ignore changes to the type of a
- symbol. This is TRUE for MIPS ELF because some Irix 5 objects
- record undefined functions as STT_OBJECT although the definitions
- are STT_FUNC. */
- unsigned type_change_ok : 1;
-
- /* Whether the backend may use REL relocations. (Some backends use
- both REL and RELA relocations, and this flag is set for those
- backends.) */
- unsigned may_use_rel_p : 1;
-
- /* Whether the backend may use RELA relocations. (Some backends use
- both REL and RELA relocations, and this flag is set for those
- backends.) */
- unsigned may_use_rela_p : 1;
-
- /* Whether the default relocation type is RELA. If a backend with
- this flag set wants REL relocations for a particular section,
- it must note that explicitly. Similarly, if this flag is clear,
- and the backend wants RELA relocations for a particular
- section. */
- unsigned default_use_rela_p : 1;
-
- /* Set if RELA relocations for a relocatable link can be handled by
- generic code. Backends that set this flag need do nothing in the
- backend relocate_section routine for relocatable linking. */
- unsigned rela_normal : 1;
-
- /* TRUE if addresses "naturally" sign extend. This is used when
- swapping in from Elf32 when BFD64. */
- unsigned sign_extend_vma : 1;
-
- unsigned want_got_plt : 1;
- unsigned plt_readonly : 1;
- unsigned want_plt_sym : 1;
- unsigned plt_not_loaded : 1;
- unsigned plt_alignment : 4;
- unsigned can_gc_sections : 1;
- unsigned can_refcount : 1;
- unsigned want_got_sym : 1;
- unsigned want_dynbss : 1;
- /* Targets which do not support physical addressing often require
- that the p_paddr field in the section header to be set to zero.
- This field indicates whether this behavior is required. */
- unsigned want_p_paddr_set_to_zero : 1;
-};
-
-/* Information stored for each BFD section in an ELF file. This
- structure is allocated by elf_new_section_hook. */
-
-struct bfd_elf_section_data
-{
- /* The ELF header for this section. */
- Elf_Internal_Shdr this_hdr;
-
- /* The ELF header for the reloc section associated with this
- section, if any. */
- Elf_Internal_Shdr rel_hdr;
-
- /* If there is a second reloc section associated with this section,
- as can happen on Irix 6, this field points to the header. */
- Elf_Internal_Shdr *rel_hdr2;
-
- /* The number of relocations currently assigned to REL_HDR. */
- unsigned int rel_count;
-
- /* The number of relocations currently assigned to REL_HDR2. */
- unsigned int rel_count2;
-
- /* The ELF section number of this section. Only used for an output
- file. */
- int this_idx;
-
- /* The ELF section number of the reloc section indicated by
- REL_HDR if any. Only used for an output file. */
- int rel_idx;
-
- /* The ELF section number of the reloc section indicated by
- REL_HDR2 if any. Only used for an output file. */
- int rel_idx2;
-
- /* Used by the backend linker when generating a shared library to
- record the dynamic symbol index for a section symbol
- corresponding to this section. A value of 0 means that there is
- no dynamic symbol for this section. */
- int dynindx;
-
- /* Used by the backend linker to store the symbol hash table entries
- associated with relocs against global symbols. */
- struct elf_link_hash_entry **rel_hashes;
-
- /* A pointer to the swapped relocs. If the section uses REL relocs,
- rather than RELA, all the r_addend fields will be zero. This
- pointer may be NULL. It is used by the backend linker. */
- Elf_Internal_Rela *relocs;
-
- /* A pointer to a linked list tracking dynamic relocs copied for
- local symbols. */
- void *local_dynrel;
-
- /* A pointer to the bfd section used for dynamic relocs. */
- asection *sreloc;
-
- union {
- /* Group name, if this section is a member of a group. */
- const char *name;
-
- /* Group signature sym, if this is the SHT_GROUP section. */
- struct bfd_symbol *id;
- } group;
-
- /* A linked list of sections in the group. Circular when used by
- the linker. */
- asection *next_in_group;
-
- /* A pointer used for various section optimizations. */
- void *sec_info;
-};
-
-#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
-#define elf_section_type(sec) (elf_section_data(sec)->this_hdr.sh_type)
-#define elf_section_flags(sec) (elf_section_data(sec)->this_hdr.sh_flags)
-#define elf_group_name(sec) (elf_section_data(sec)->group.name)
-#define elf_group_id(sec) (elf_section_data(sec)->group.id)
-#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
-
-/* Return TRUE if section has been discarded. */
-#define elf_discarded_section(sec) \
- (!bfd_is_abs_section (sec) \
- && bfd_is_abs_section ((sec)->output_section) \
- && sec->sec_info_type != ELF_INFO_TYPE_MERGE \
- && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
-
-#define get_elf_backend_data(abfd) \
- ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
-
-/* This struct is used to pass information to routines called via
- elf_link_hash_traverse which must return failure. */
-
-struct elf_info_failed
-{
- bfd_boolean failed;
- struct bfd_link_info *info;
- struct bfd_elf_version_tree *verdefs;
-};
-
-/* This structure is used to pass information to
- _bfd_elf_link_assign_sym_version. */
-
-struct elf_assign_sym_version_info
-{
- /* Output BFD. */
- bfd *output_bfd;
- /* General link information. */
- struct bfd_link_info *info;
- /* Version tree. */
- struct bfd_elf_version_tree *verdefs;
- /* Whether we had a failure. */
- bfd_boolean failed;
-};
-
-/* This structure is used to pass information to
- _bfd_elf_link_find_version_dependencies. */
-
-struct elf_find_verdep_info
-{
- /* Output BFD. */
- bfd *output_bfd;
- /* General link information. */
- struct bfd_link_info *info;
- /* The number of dependencies. */
- unsigned int vers;
- /* Whether we had a failure. */
- bfd_boolean failed;
-};
-
-/* Some private data is stashed away for future use using the tdata pointer
- in the bfd structure. */
-
-struct elf_obj_tdata
-{
- Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
- Elf_Internal_Shdr **elf_sect_ptr;
- Elf_Internal_Phdr *phdr;
- struct elf_segment_map *segment_map;
- struct elf_strtab_hash *strtab_ptr;
- int num_locals;
- int num_globals;
- unsigned int num_elf_sections; /* elf_sect_ptr size */
- int num_section_syms;
- asymbol **section_syms; /* STT_SECTION symbols for each section */
- Elf_Internal_Shdr symtab_hdr;
- Elf_Internal_Shdr shstrtab_hdr;
- Elf_Internal_Shdr strtab_hdr;
- Elf_Internal_Shdr dynsymtab_hdr;
- Elf_Internal_Shdr dynstrtab_hdr;
- Elf_Internal_Shdr dynversym_hdr;
- Elf_Internal_Shdr dynverref_hdr;
- Elf_Internal_Shdr dynverdef_hdr;
- Elf_Internal_Shdr symtab_shndx_hdr;
- unsigned int symtab_section, shstrtab_section;
- unsigned int strtab_section, dynsymtab_section;
- unsigned int symtab_shndx_section;
- unsigned int dynversym_section, dynverdef_section, dynverref_section;
- file_ptr next_file_pos;
- bfd_vma gp; /* The gp value */
- unsigned int gp_size; /* The gp size */
-
- /* Information grabbed from an elf core file. */
- int core_signal;
- int core_pid;
- int core_lwpid;
- char* core_program;
- char* core_command;
-
- /* A mapping from external symbols to entries in the linker hash
- table, used when linking. This is indexed by the symbol index
- minus the sh_info field of the symbol table header. */
- struct elf_link_hash_entry **sym_hashes;
-
- /* Track usage and final offsets of GOT entries for local symbols.
- This array is indexed by symbol index. Elements are used
- identically to "got" in struct elf_link_hash_entry. */
- union
- {
- bfd_signed_vma *refcounts;
- bfd_vma *offsets;
- struct got_entry **ents;
- } local_got;
-
- /* The linker ELF emulation code needs to let the backend ELF linker
- know what filename should be used for a dynamic object if the
- dynamic object is found using a search. The emulation code then
- sometimes needs to know what name was actually used. Until the
- file has been added to the linker symbol table, this field holds
- the name the linker wants. After it has been added, it holds the
- name actually used, which will be the DT_SONAME entry if there is
- one. */
- const char *dt_name;
-
- /* Records the result of `get_program_header_size'. */
- bfd_size_type program_header_size;
-
- /* Used by find_nearest_line entry point. */
- void *line_info;
-
- /* Used by MIPS ELF find_nearest_line entry point. The structure
- could be included directly in this one, but there's no point to
- wasting the memory just for the infrequently called
- find_nearest_line. */
- struct mips_elf_find_line *find_line_info;
-
- /* A place to stash dwarf1 info for this bfd. */
- struct dwarf1_debug *dwarf1_find_line_info;
-
- /* A place to stash dwarf2 info for this bfd. */
- void *dwarf2_find_line_info;
-
- /* An array of stub sections indexed by symbol number, used by the
- MIPS ELF linker. FIXME: We should figure out some way to only
- include this field for a MIPS ELF target. */
- asection **local_stubs;
-
- /* Used to determine if PT_GNU_EH_FRAME segment header should be
- created. */
- asection *eh_frame_hdr;
-
- Elf_Internal_Shdr **group_sect_ptr;
- int num_group;
-
- /* Number of symbol version definitions we are about to emit. */
- unsigned int cverdefs;
-
- /* Number of symbol version references we are about to emit. */
- unsigned int cverrefs;
-
- /* Segment flags for the PT_GNU_STACK segment. */
- unsigned int stack_flags;
-
- /* Symbol version definitions in external objects. */
- Elf_Internal_Verdef *verdef;
-
- /* Symbol version references to external objects. */
- Elf_Internal_Verneed *verref;
-
- /* The Irix 5 support uses two virtual sections, which represent
- text/data symbols defined in dynamic objects. */
- asymbol *elf_data_symbol;
- asymbol *elf_text_symbol;
- asection *elf_data_section;
- asection *elf_text_section;
-
- /* Whether a dyanmic object was specified normally on the linker
- command line, or was specified when --as-needed was in effect,
- or was found via a DT_NEEDED entry. */
- enum dynamic_lib_link_class dyn_lib_class;
-
- /* This is set to TRUE if the object was created by the backend
- linker. */
- bfd_boolean linker;
-
- /* Irix 5 often screws up the symbol table, sorting local symbols
- after global symbols. This flag is set if the symbol table in
- this BFD appears to be screwed up. If it is, we ignore the
- sh_info field in the symbol table header, and always read all the
- symbols. */
- bfd_boolean bad_symtab;
-
- /* Used to determine if the e_flags field has been initialized */
- bfd_boolean flags_init;
-};
-
-#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
-#define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
-#define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
-#define elf_numsections(bfd) (elf_tdata(bfd) -> num_elf_sections)
-#define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
-#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
-#define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section)
-#define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
-#define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
-#define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
-#define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
-#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
-#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
-#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
-#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
-#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
-#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
-#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
-#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
-#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
-#define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
-#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
-#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
-#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
-#define elf_dyn_lib_class(bfd) (elf_tdata(bfd) -> dyn_lib_class)
-#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
-#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
-
-extern void _bfd_elf_swap_verdef_in
- (bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *);
-extern void _bfd_elf_swap_verdef_out
- (bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *);
-extern void _bfd_elf_swap_verdaux_in
- (bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *);
-extern void _bfd_elf_swap_verdaux_out
- (bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *);
-extern void _bfd_elf_swap_verneed_in
- (bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *);
-extern void _bfd_elf_swap_verneed_out
- (bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *);
-extern void _bfd_elf_swap_vernaux_in
- (bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *);
-extern void _bfd_elf_swap_vernaux_out
- (bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *);
-extern void _bfd_elf_swap_versym_in
- (bfd *, const Elf_External_Versym *, Elf_Internal_Versym *);
-extern void _bfd_elf_swap_versym_out
- (bfd *, const Elf_Internal_Versym *, Elf_External_Versym *);
-
-extern int _bfd_elf_section_from_bfd_section
- (bfd *, asection *);
-extern char *bfd_elf_string_from_elf_section
- (bfd *, unsigned, unsigned);
-extern char *bfd_elf_get_str_section
- (bfd *, unsigned);
-extern Elf_Internal_Sym *bfd_elf_get_elf_syms
- (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
- Elf_External_Sym_Shndx *);
-extern const char *bfd_elf_local_sym_name
- (bfd *, Elf_Internal_Sym *);
-
-extern bfd_boolean _bfd_elf_copy_private_bfd_data
- (bfd *, bfd *);
-extern bfd_boolean _bfd_elf_print_private_bfd_data
- (bfd *, void *);
-extern void bfd_elf_print_symbol
- (bfd *, void *, 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 void _bfd_elf_sprintf_vma
- (bfd *, char *, bfd_vma);
-extern void _bfd_elf_fprintf_vma
- (bfd *, void *, bfd_vma);
-
-extern bfd_byte _bfd_elf_encode_eh_address
- (bfd *abfd, struct bfd_link_info *info, asection *osec, bfd_vma offset,
- asection *loc_sec, bfd_vma loc_offset, bfd_vma *encoded);
-extern bfd_boolean _bfd_elf_can_make_relative
- (bfd *input_bfd, struct bfd_link_info *info, asection *eh_frame_section);
-
-extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
- (const Elf_Internal_Rela *);
-extern bfd_vma _bfd_elf_rela_local_sym
- (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *);
-extern bfd_vma _bfd_elf_rel_local_sym
- (bfd *, Elf_Internal_Sym *, asection **, bfd_vma);
-extern bfd_vma _bfd_elf_section_offset
- (bfd *, struct bfd_link_info *, asection *, bfd_vma);
-
-extern unsigned long bfd_elf_hash
- (const char *);
-
-extern bfd_reloc_status_type bfd_elf_generic_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-extern bfd_boolean bfd_elf_mkobject
- (bfd *);
-extern bfd_boolean bfd_elf_mkcorefile
- (bfd *);
-extern Elf_Internal_Shdr *bfd_elf_find_section
- (bfd *, char *);
-extern bfd_boolean _bfd_elf_make_section_from_shdr
- (bfd *, Elf_Internal_Shdr *, const char *);
-extern bfd_boolean _bfd_elf_make_section_from_phdr
- (bfd *, Elf_Internal_Phdr *, int, const char *);
-extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
- (bfd *);
-extern void _bfd_elf_link_hash_copy_indirect
- (const struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *);
-extern void _bfd_elf_link_hash_hide_symbol
- (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
-extern bfd_boolean _bfd_elf_link_hash_table_init
- (struct elf_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*)
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern bfd_boolean _bfd_elf_slurp_version_tables
- (bfd *);
-extern bfd_boolean _bfd_elf_merge_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_elf_discard_group
- (bfd *, struct bfd_section *);
-extern void bfd_elf_set_group_contents
- (bfd *, asection *, void *);
-extern void _bfd_elf_link_just_syms
- (asection *, struct bfd_link_info *);
-extern bfd_boolean _bfd_elf_copy_private_symbol_data
- (bfd *, asymbol *, bfd *, asymbol *);
-extern bfd_boolean _bfd_elf_copy_private_section_data
- (bfd *, asection *, bfd *, asection *);
-extern bfd_boolean _bfd_elf_write_object_contents
- (bfd *);
-extern bfd_boolean _bfd_elf_write_corefile_contents
- (bfd *);
-extern bfd_boolean _bfd_elf_set_section_contents
- (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-extern long _bfd_elf_get_symtab_upper_bound
- (bfd *);
-extern long _bfd_elf_canonicalize_symtab
- (bfd *, asymbol **);
-extern long _bfd_elf_get_dynamic_symtab_upper_bound
- (bfd *);
-extern long _bfd_elf_canonicalize_dynamic_symtab
- (bfd *, asymbol **);
-extern long _bfd_elf_get_reloc_upper_bound
- (bfd *, sec_ptr);
-extern long _bfd_elf_canonicalize_reloc
- (bfd *, sec_ptr, arelent **, asymbol **);
-extern long _bfd_elf_get_dynamic_reloc_upper_bound
- (bfd *);
-extern long _bfd_elf_canonicalize_dynamic_reloc
- (bfd *, arelent **, asymbol **);
-extern asymbol *_bfd_elf_make_empty_symbol
- (bfd *);
-extern void _bfd_elf_get_symbol_info
- (bfd *, asymbol *, symbol_info *);
-extern bfd_boolean _bfd_elf_is_local_label_name
- (bfd *, const char *);
-extern alent *_bfd_elf_get_lineno
- (bfd *, asymbol *);
-extern bfd_boolean _bfd_elf_set_arch_mach
- (bfd *, enum bfd_architecture, unsigned long);
-extern bfd_boolean _bfd_elf_find_nearest_line
- (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
- (bfd *, bfd_boolean);
-extern bfd_boolean _bfd_elf_new_section_hook
- (bfd *, asection *);
-extern bfd_boolean _bfd_elf_init_reloc_shdr
- (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean);
-extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
- (bfd *, const char *);
-
-/* If the target doesn't have reloc handling written yet: */
-extern void _bfd_elf_no_info_to_howto
- (bfd *, arelent *, Elf_Internal_Rela *);
-
-extern bfd_boolean bfd_section_from_shdr
- (bfd *, unsigned int shindex);
-extern bfd_boolean bfd_section_from_phdr
- (bfd *, Elf_Internal_Phdr *, int);
-
-extern int _bfd_elf_symbol_from_bfd_symbol
- (bfd *, asymbol **);
-
-extern asection *bfd_section_from_r_symndx
- (bfd *, struct sym_sec_cache *, asection *, unsigned long);
-extern asection *bfd_section_from_elf_index
- (bfd *, unsigned int);
-extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
- (void);
-
-extern struct elf_strtab_hash * _bfd_elf_strtab_init
- (void);
-extern void _bfd_elf_strtab_free
- (struct elf_strtab_hash *);
-extern bfd_size_type _bfd_elf_strtab_add
- (struct elf_strtab_hash *, const char *, bfd_boolean);
-extern void _bfd_elf_strtab_addref
- (struct elf_strtab_hash *, bfd_size_type);
-extern void _bfd_elf_strtab_delref
- (struct elf_strtab_hash *, bfd_size_type);
-extern void _bfd_elf_strtab_clear_all_refs
- (struct elf_strtab_hash *);
-extern bfd_size_type _bfd_elf_strtab_size
- (struct elf_strtab_hash *);
-extern bfd_size_type _bfd_elf_strtab_offset
- (struct elf_strtab_hash *, bfd_size_type);
-extern bfd_boolean _bfd_elf_strtab_emit
- (bfd *, struct elf_strtab_hash *);
-extern void _bfd_elf_strtab_finalize
- (struct elf_strtab_hash *);
-
-extern bfd_boolean _bfd_elf_discard_section_eh_frame
- (bfd *, struct bfd_link_info *, asection *,
- bfd_boolean (*) (bfd_vma, void *), struct elf_reloc_cookie *);
-extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr
- (bfd *, struct bfd_link_info *);
-extern bfd_vma _bfd_elf_eh_frame_section_offset
- (bfd *, asection *, bfd_vma);
-extern bfd_boolean _bfd_elf_write_section_eh_frame
- (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
-extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
- (struct bfd_link_info *);
-
-extern bfd_boolean _bfd_elf_merge_symbol
- (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
- asection **, bfd_vma *, struct elf_link_hash_entry **, bfd_boolean *,
- bfd_boolean *, bfd_boolean *, bfd_boolean *);
-
-extern bfd_boolean _bfd_elf_add_default_symbol
- (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
- bfd_boolean *, bfd_boolean);
-
-extern bfd_boolean _bfd_elf_export_symbol
- (struct elf_link_hash_entry *, void *);
-
-extern bfd_boolean _bfd_elf_link_find_version_dependencies
- (struct elf_link_hash_entry *, void *);
-
-extern bfd_boolean _bfd_elf_link_assign_sym_version
- (struct elf_link_hash_entry *, void *);
-
-extern long _bfd_elf_link_lookup_local_dynindx
- (struct bfd_link_info *, bfd *, long);
-extern bfd_boolean _bfd_elf_compute_section_file_positions
- (bfd *, struct bfd_link_info *);
-extern void _bfd_elf_assign_file_positions_for_relocs
- (bfd *);
-extern file_ptr _bfd_elf_assign_file_position_for_section
- (Elf_Internal_Shdr *, file_ptr, bfd_boolean);
-
-extern bfd_boolean _bfd_elf_validate_reloc
- (bfd *, arelent *);
-
-extern bfd_boolean _bfd_elf_link_create_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_elf_create_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_elf_create_got_section
- (bfd *, struct bfd_link_info *);
-extern unsigned long _bfd_elf_link_renumber_dynsyms
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean _bfd_elfcore_make_pseudosection
- (bfd *, char *, size_t, ufile_ptr);
-extern char *_bfd_elfcore_strndup
- (bfd *, char *, size_t);
-
-extern Elf_Internal_Rela *_bfd_elf_link_read_relocs
- (bfd *, asection *, void *, Elf_Internal_Rela *, bfd_boolean);
-
-extern bfd_boolean _bfd_elf_link_size_reloc_section
- (bfd *, Elf_Internal_Shdr *, asection *);
-
-extern bfd_boolean _bfd_elf_link_output_relocs
- (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
-
-extern bfd_boolean _bfd_elf_fix_symbol_flags
- (struct elf_link_hash_entry *, struct elf_info_failed *);
-
-extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
- (struct elf_link_hash_entry *, void *);
-
-extern bfd_boolean _bfd_elf_link_sec_merge_syms
- (struct elf_link_hash_entry *, void *);
-
-extern bfd_boolean _bfd_elf_dynamic_symbol_p
- (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
-
-extern bfd_boolean _bfd_elf_symbol_refs_local_p
- (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
-
-extern const bfd_target *bfd_elf32_object_p
- (bfd *);
-extern const bfd_target *bfd_elf32_core_file_p
- (bfd *);
-extern char *bfd_elf32_core_file_failing_command
- (bfd *);
-extern int bfd_elf32_core_file_failing_signal
- (bfd *);
-extern bfd_boolean bfd_elf32_core_file_matches_executable_p
- (bfd *, bfd *);
-
-extern void bfd_elf32_swap_symbol_in
- (bfd *, const void *, const void *, Elf_Internal_Sym *);
-extern void bfd_elf32_swap_symbol_out
- (bfd *, const Elf_Internal_Sym *, void *, void *);
-extern void bfd_elf32_swap_reloc_in
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-extern void bfd_elf32_swap_reloc_out
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-extern void bfd_elf32_swap_reloca_in
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-extern void bfd_elf32_swap_reloca_out
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-extern void bfd_elf32_swap_phdr_in
- (bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *);
-extern void bfd_elf32_swap_phdr_out
- (bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *);
-extern void bfd_elf32_swap_dyn_in
- (bfd *, const void *, Elf_Internal_Dyn *);
-extern void bfd_elf32_swap_dyn_out
- (bfd *, const Elf_Internal_Dyn *, void *);
-extern long bfd_elf32_slurp_symbol_table
- (bfd *, asymbol **, bfd_boolean);
-extern bfd_boolean bfd_elf32_write_shdrs_and_ehdr
- (bfd *);
-extern int bfd_elf32_write_out_phdrs
- (bfd *, const Elf_Internal_Phdr *, unsigned int);
-extern void bfd_elf32_write_relocs
- (bfd *, asection *, void *);
-extern bfd_boolean bfd_elf32_slurp_reloc_table
- (bfd *, asection *, asymbol **, bfd_boolean);
-
-extern const bfd_target *bfd_elf64_object_p
- (bfd *);
-extern const bfd_target *bfd_elf64_core_file_p
- (bfd *);
-extern char *bfd_elf64_core_file_failing_command
- (bfd *);
-extern int bfd_elf64_core_file_failing_signal
- (bfd *);
-extern bfd_boolean bfd_elf64_core_file_matches_executable_p
- (bfd *, bfd *);
-
-extern void bfd_elf64_swap_symbol_in
- (bfd *, const void *, const void *, Elf_Internal_Sym *);
-extern void bfd_elf64_swap_symbol_out
- (bfd *, const Elf_Internal_Sym *, void *, void *);
-extern void bfd_elf64_swap_reloc_in
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-extern void bfd_elf64_swap_reloc_out
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-extern void bfd_elf64_swap_reloca_in
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-extern void bfd_elf64_swap_reloca_out
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-extern void bfd_elf64_swap_phdr_in
- (bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *);
-extern void bfd_elf64_swap_phdr_out
- (bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *);
-extern void bfd_elf64_swap_dyn_in
- (bfd *, const void *, Elf_Internal_Dyn *);
-extern void bfd_elf64_swap_dyn_out
- (bfd *, const Elf_Internal_Dyn *, void *);
-extern long bfd_elf64_slurp_symbol_table
- (bfd *, asymbol **, bfd_boolean);
-extern bfd_boolean bfd_elf64_write_shdrs_and_ehdr
- (bfd *);
-extern int bfd_elf64_write_out_phdrs
- (bfd *, const Elf_Internal_Phdr *, unsigned int);
-extern void bfd_elf64_write_relocs
- (bfd *, asection *, void *);
-extern bfd_boolean bfd_elf64_slurp_reloc_table
- (bfd *, asection *, asymbol **, bfd_boolean);
-
-extern bfd_boolean bfd_elf_link_add_symbols
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_elf_add_dynamic_entry
- (struct bfd_link_info *, bfd_vma, bfd_vma);
-
-extern bfd_boolean bfd_elf_link_record_dynamic_symbol
- (struct bfd_link_info *, struct elf_link_hash_entry *);
-
-extern int bfd_elf_link_record_local_dynamic_symbol
- (struct bfd_link_info *, bfd *, long);
-
-extern bfd_boolean _bfd_elf_close_and_cleanup
- (bfd *);
-extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
- (bfd *, arelent *, struct bfd_symbol *, void *,
- asection *, bfd *, char **);
-
-extern bfd_boolean bfd_elf_final_link
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf_gc_sections
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf_gc_record_vtinherit
- (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
-
-extern bfd_boolean bfd_elf_gc_record_vtentry
- (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
-
-extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf_gc_common_final_link
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
- (bfd_vma, void *);
-
-/* Exported interface for writing elf corefile notes. */
-extern char *elfcore_write_note
- (bfd *, char *, int *, const char *, int, const void *, int);
-extern char *elfcore_write_prpsinfo
- (bfd *, char *, int *, const char *, const char *);
-extern char *elfcore_write_prstatus
- (bfd *, char *, int *, long, int, const void *);
-extern char * elfcore_write_pstatus
- (bfd *, char *, int *, long, int, const void *);
-extern char *elfcore_write_prfpreg
- (bfd *, char *, int *, const void *, int);
-extern char *elfcore_write_prxfpreg
- (bfd *, char *, int *, const void *, int);
-extern char *elfcore_write_lwpstatus
- (bfd *, char *, int *, long, int, const void *);
-
-extern bfd *_bfd_elf32_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma, char *, int));
-extern bfd *_bfd_elf64_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma, char *, int));
-
-/* SH ELF specific routine. */
-
-extern bfd_boolean _sh_elf_set_mach_from_flags
- (bfd *);
-
-/* This is the condition under which finish_dynamic_symbol will be called.
- If our finish_dynamic_symbol isn't called, we'll need to do something
- about initializing any .plt and .got entries in relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
- ((DYN) \
- && ((SHARED) \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
-
-/* This macro is to avoid lots of duplicated code in the body
- of xxx_relocate_section() in the various elfxx-xxxx.c files. */
-#define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, \
- r_symndx, symtab_hdr, sym_hashes, \
- h, sec, relocation, \
- unresolved_reloc, warned) \
- do \
- { \
- /* It seems this can happen with erroneous or unsupported \
- input (mixing a.out and elf in an archive, for example.) */ \
- if (sym_hashes == NULL) \
- return FALSE; \
- \
- h = sym_hashes[r_symndx - symtab_hdr->sh_info]; \
- \
- while (h->root.type == bfd_link_hash_indirect \
- || h->root.type == bfd_link_hash_warning) \
- h = (struct elf_link_hash_entry *) h->root.u.i.link; \
- \
- warned = FALSE; \
- unresolved_reloc = FALSE; \
- relocation = 0; \
- if (h->root.type == bfd_link_hash_defined \
- || h->root.type == bfd_link_hash_defweak) \
- { \
- sec = h->root.u.def.section; \
- if (sec == NULL \
- || sec->output_section == NULL) \
- /* Set a flag that will be cleared later if we find a \
- relocation value for this symbol. output_section \
- is typically NULL for symbols satisfied by a shared \
- library. */ \
- unresolved_reloc = TRUE; \
- else \
- relocation = (h->root.u.def.value \
- + sec->output_section->vma \
- + sec->output_offset); \
- } \
- else if (h->root.type == bfd_link_hash_undefweak) \
- ; \
- else if (info->unresolved_syms_in_objects == RM_IGNORE \
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
- ; \
- else \
- { \
- bfd_boolean err; \
- err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
- || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT); \
- if (!info->callbacks->undefined_symbol (info, \
- h->root.root.string, \
- input_bfd, \
- input_section, \
- rel->r_offset, err)) \
- return FALSE; \
- warned = TRUE; \
- } \
- } \
- while (0)
-
-#endif /* _LIBELF_H_ */
diff --git a/contrib/binutils/bfd/elf-eh-frame.c b/contrib/binutils/bfd/elf-eh-frame.c
deleted file mode 100644
index d3777b4..0000000
--- a/contrib/binutils/bfd/elf-eh-frame.c
+++ /dev/null
@@ -1,1219 +0,0 @@
-/* .eh_frame section optimization.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
- Written by Jakub Jelinek <jakub@redhat.com>.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/dwarf2.h"
-
-#define EH_FRAME_HDR_SIZE 8
-
-/* Helper function for reading uleb128 encoded data. */
-
-static bfd_vma
-read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int *bytes_read_ptr)
-{
- bfd_vma result;
- unsigned int num_read;
- int shift;
- unsigned char byte;
-
- result = 0;
- shift = 0;
- num_read = 0;
- do
- {
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
- buf++;
- num_read++;
- result |= (((bfd_vma) byte & 0x7f) << shift);
- shift += 7;
- }
- while (byte & 0x80);
- *bytes_read_ptr = num_read;
- return result;
-}
-
-/* Helper function for reading sleb128 encoded data. */
-
-static bfd_signed_vma
-read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int * bytes_read_ptr)
-{
- bfd_vma result;
- int shift;
- int num_read;
- unsigned char byte;
-
- result = 0;
- shift = 0;
- num_read = 0;
- do
- {
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
- buf ++;
- num_read ++;
- result |= (((bfd_vma) byte & 0x7f) << shift);
- shift += 7;
- }
- while (byte & 0x80);
- if (byte & 0x40)
- result |= (((bfd_vma) -1) << (shift - 7)) << 7;
- *bytes_read_ptr = num_read;
- return result;
-}
-
-#define read_uleb128(VAR, BUF) \
-do \
- { \
- (VAR) = read_unsigned_leb128 (abfd, buf, &leb128_tmp); \
- (BUF) += leb128_tmp; \
- } \
-while (0)
-
-#define read_sleb128(VAR, BUF) \
-do \
- { \
- (VAR) = read_signed_leb128 (abfd, buf, &leb128_tmp); \
- (BUF) += leb128_tmp; \
- } \
-while (0)
-
-/* Return 0 if either encoding is variable width, or not yet known to bfd. */
-
-static
-int get_DW_EH_PE_width (int encoding, int ptr_size)
-{
- /* DW_EH_PE_ values of 0x60 and 0x70 weren't defined at the time .eh_frame
- was added to bfd. */
- if ((encoding & 0x60) == 0x60)
- return 0;
-
- switch (encoding & 7)
- {
- case DW_EH_PE_udata2: return 2;
- case DW_EH_PE_udata4: return 4;
- case DW_EH_PE_udata8: return 8;
- case DW_EH_PE_absptr: return ptr_size;
- default:
- break;
- }
-
- return 0;
-}
-
-#define get_DW_EH_PE_signed(encoding) (((encoding) & DW_EH_PE_signed) != 0)
-
-/* Read a width sized value from memory. */
-
-static bfd_vma
-read_value (bfd *abfd, bfd_byte *buf, int width, int is_signed)
-{
- bfd_vma value;
-
- switch (width)
- {
- case 2:
- if (is_signed)
- value = bfd_get_signed_16 (abfd, buf);
- else
- value = bfd_get_16 (abfd, buf);
- break;
- case 4:
- if (is_signed)
- value = bfd_get_signed_32 (abfd, buf);
- else
- value = bfd_get_32 (abfd, buf);
- break;
- case 8:
- if (is_signed)
- value = bfd_get_signed_64 (abfd, buf);
- else
- value = bfd_get_64 (abfd, buf);
- break;
- default:
- BFD_FAIL ();
- return 0;
- }
-
- return value;
-}
-
-/* Store a width sized value to memory. */
-
-static void
-write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width)
-{
- switch (width)
- {
- case 2: bfd_put_16 (abfd, value, buf); break;
- case 4: bfd_put_32 (abfd, value, buf); break;
- case 8: bfd_put_64 (abfd, value, buf); break;
- default: BFD_FAIL ();
- }
-}
-
-/* Return zero if C1 and C2 CIEs can be merged. */
-
-static
-int cie_compare (struct cie *c1, struct cie *c2)
-{
- if (c1->hdr.length == c2->hdr.length
- && c1->version == c2->version
- && strcmp (c1->augmentation, c2->augmentation) == 0
- && strcmp (c1->augmentation, "eh") != 0
- && c1->code_align == c2->code_align
- && c1->data_align == c2->data_align
- && c1->ra_column == c2->ra_column
- && c1->augmentation_size == c2->augmentation_size
- && c1->personality == c2->personality
- && c1->per_encoding == c2->per_encoding
- && c1->lsda_encoding == c2->lsda_encoding
- && c1->fde_encoding == c2->fde_encoding
- && c1->initial_insn_length == c2->initial_insn_length
- && memcmp (c1->initial_instructions,
- c2->initial_instructions,
- c1->initial_insn_length) == 0)
- return 0;
-
- return 1;
-}
-
-/* This function is called for each input file before the .eh_frame
- section is relocated. It discards duplicate CIEs and FDEs for discarded
- functions. The function returns TRUE iff any entries have been
- deleted. */
-
-bfd_boolean
-_bfd_elf_discard_section_eh_frame
- (bfd *abfd, struct bfd_link_info *info, asection *sec,
- bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *),
- struct elf_reloc_cookie *cookie)
-{
- bfd_byte *ehbuf = NULL, *buf;
- bfd_byte *last_cie, *last_fde;
- struct cie_header hdr;
- struct cie cie;
- struct elf_link_hash_table *htab;
- struct eh_frame_hdr_info *hdr_info;
- struct eh_frame_sec_info *sec_info = NULL;
- unsigned int leb128_tmp;
- unsigned int cie_usage_count, last_cie_ndx, i, offset;
- unsigned int make_relative, make_lsda_relative;
- bfd_size_type new_size;
- unsigned int ptr_size;
-
- if (sec->_raw_size == 0)
- {
- /* This file does not contain .eh_frame information. */
- return FALSE;
- }
-
- if ((sec->output_section != NULL
- && bfd_is_abs_section (sec->output_section)))
- {
- /* At least one of the sections is being discarded from the
- link, so we should just ignore them. */
- return FALSE;
- }
-
- htab = elf_hash_table (info);
- hdr_info = &htab->eh_info;
-
- /* Read the frame unwind information from abfd. */
-
- ehbuf = bfd_malloc (sec->_raw_size);
- if (ehbuf == NULL)
- goto free_no_table;
-
- if (! bfd_get_section_contents (abfd, sec, ehbuf, 0, sec->_raw_size))
- goto free_no_table;
-
- if (sec->_raw_size >= 4
- && bfd_get_32 (abfd, ehbuf) == 0
- && cookie->rel == cookie->relend)
- {
- /* Empty .eh_frame section. */
- free (ehbuf);
- return FALSE;
- }
-
- /* If .eh_frame section size doesn't fit into int, we cannot handle
- it (it would need to use 64-bit .eh_frame format anyway). */
- if (sec->_raw_size != (unsigned int) sec->_raw_size)
- goto free_no_table;
-
- ptr_size = (elf_elfheader (abfd)->e_ident[EI_CLASS]
- == ELFCLASS64) ? 8 : 4;
- buf = ehbuf;
- last_cie = NULL;
- last_cie_ndx = 0;
- memset (&cie, 0, sizeof (cie));
- cie_usage_count = 0;
- new_size = sec->_raw_size;
- make_relative = hdr_info->last_cie.make_relative;
- make_lsda_relative = hdr_info->last_cie.make_lsda_relative;
- sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info)
- + 99 * sizeof (struct eh_cie_fde));
- if (sec_info == NULL)
- goto free_no_table;
- sec_info->alloced = 100;
-
-#define ENSURE_NO_RELOCS(buf) \
- if (cookie->rel < cookie->relend \
- && (cookie->rel->r_offset \
- < (bfd_size_type) ((buf) - ehbuf)) \
- && cookie->rel->r_info != 0) \
- goto free_no_table
-
-#define SKIP_RELOCS(buf) \
- while (cookie->rel < cookie->relend \
- && (cookie->rel->r_offset \
- < (bfd_size_type) ((buf) - ehbuf))) \
- cookie->rel++
-
-#define GET_RELOC(buf) \
- ((cookie->rel < cookie->relend \
- && (cookie->rel->r_offset \
- == (bfd_size_type) ((buf) - ehbuf))) \
- ? cookie->rel : NULL)
-
- for (;;)
- {
- unsigned char *aug;
-
- if (sec_info->count == sec_info->alloced)
- {
- sec_info = bfd_realloc (sec_info,
- sizeof (struct eh_frame_sec_info)
- + (sec_info->alloced + 99)
- * sizeof (struct eh_cie_fde));
- if (sec_info == NULL)
- goto free_no_table;
-
- memset (&sec_info->entry[sec_info->alloced], 0,
- 100 * sizeof (struct eh_cie_fde));
- sec_info->alloced += 100;
- }
-
- last_fde = buf;
- /* If we are at the end of the section, we still need to decide
- on whether to output or discard last encountered CIE (if any). */
- if ((bfd_size_type) (buf - ehbuf) == sec->_raw_size)
- hdr.id = (unsigned int) -1;
- else
- {
- if ((bfd_size_type) (buf + 4 - ehbuf) > sec->_raw_size)
- /* No space for CIE/FDE header length. */
- goto free_no_table;
-
- hdr.length = bfd_get_32 (abfd, buf);
- if (hdr.length == 0xffffffff)
- /* 64-bit .eh_frame is not supported. */
- goto free_no_table;
- buf += 4;
- if ((bfd_size_type) (buf - ehbuf) + hdr.length > sec->_raw_size)
- /* CIE/FDE not contained fully in this .eh_frame input section. */
- goto free_no_table;
-
- sec_info->entry[sec_info->count].offset = last_fde - ehbuf;
- sec_info->entry[sec_info->count].size = 4 + hdr.length;
-
- if (hdr.length == 0)
- {
- /* CIE with length 0 must be only the last in the section. */
- if ((bfd_size_type) (buf - ehbuf) < sec->_raw_size)
- goto free_no_table;
- ENSURE_NO_RELOCS (buf);
- sec_info->count++;
- /* Now just finish last encountered CIE processing and break
- the loop. */
- hdr.id = (unsigned int) -1;
- }
- else
- {
- hdr.id = bfd_get_32 (abfd, buf);
- buf += 4;
- if (hdr.id == (unsigned int) -1)
- goto free_no_table;
- }
- }
-
- if (hdr.id == 0 || hdr.id == (unsigned int) -1)
- {
- unsigned int initial_insn_length;
-
- /* CIE */
- if (last_cie != NULL)
- {
- /* Now check if this CIE is identical to the last CIE,
- in which case we can remove it provided we adjust
- all FDEs. Also, it can be removed if we have removed
- all FDEs using it. */
- if ((!info->relocatable
- && hdr_info->last_cie_sec
- && (sec->output_section
- == hdr_info->last_cie_sec->output_section)
- && cie_compare (&cie, &hdr_info->last_cie) == 0)
- || cie_usage_count == 0)
- {
- new_size -= cie.hdr.length + 4;
- sec_info->entry[last_cie_ndx].removed = 1;
- sec_info->entry[last_cie_ndx].sec = hdr_info->last_cie_sec;
- sec_info->entry[last_cie_ndx].new_offset
- = hdr_info->last_cie_offset;
- }
- else
- {
- hdr_info->last_cie = cie;
- hdr_info->last_cie_sec = sec;
- hdr_info->last_cie_offset = last_cie - ehbuf;
- sec_info->entry[last_cie_ndx].make_relative
- = cie.make_relative;
- sec_info->entry[last_cie_ndx].make_lsda_relative
- = cie.make_lsda_relative;
- sec_info->entry[last_cie_ndx].per_encoding_relative
- = (cie.per_encoding & 0x70) == DW_EH_PE_pcrel;
- }
- }
-
- if (hdr.id == (unsigned int) -1)
- break;
-
- last_cie_ndx = sec_info->count;
- sec_info->entry[sec_info->count].cie = 1;
-
- cie_usage_count = 0;
- memset (&cie, 0, sizeof (cie));
- cie.hdr = hdr;
- cie.version = *buf++;
-
- /* Cannot handle unknown versions. */
- if (cie.version != 1)
- goto free_no_table;
- if (strlen (buf) > sizeof (cie.augmentation) - 1)
- goto free_no_table;
-
- strcpy (cie.augmentation, buf);
- buf = strchr (buf, '\0') + 1;
- ENSURE_NO_RELOCS (buf);
- if (buf[0] == 'e' && buf[1] == 'h')
- {
- /* GCC < 3.0 .eh_frame CIE */
- /* We cannot merge "eh" CIEs because __EXCEPTION_TABLE__
- is private to each CIE, so we don't need it for anything.
- Just skip it. */
- buf += ptr_size;
- SKIP_RELOCS (buf);
- }
- read_uleb128 (cie.code_align, buf);
- read_sleb128 (cie.data_align, buf);
- /* Note - in DWARF2 the return address column is an unsigned byte.
- In DWARF3 it is a ULEB128. We are following DWARF3. For most
- ports this will not matter as the value will be less than 128.
- For the others (eg FRV, SH, MMIX, IA64) they need a fixed GCC
- which conforms to the DWARF3 standard. */
- read_uleb128 (cie.ra_column, buf);
- ENSURE_NO_RELOCS (buf);
- cie.lsda_encoding = DW_EH_PE_omit;
- cie.fde_encoding = DW_EH_PE_omit;
- cie.per_encoding = DW_EH_PE_omit;
- aug = cie.augmentation;
- if (aug[0] != 'e' || aug[1] != 'h')
- {
- if (*aug == 'z')
- {
- aug++;
- read_uleb128 (cie.augmentation_size, buf);
- ENSURE_NO_RELOCS (buf);
- }
-
- while (*aug != '\0')
- switch (*aug++)
- {
- case 'L':
- cie.lsda_encoding = *buf++;
- ENSURE_NO_RELOCS (buf);
- if (get_DW_EH_PE_width (cie.lsda_encoding, ptr_size) == 0)
- goto free_no_table;
- break;
- case 'R':
- cie.fde_encoding = *buf++;
- ENSURE_NO_RELOCS (buf);
- if (get_DW_EH_PE_width (cie.fde_encoding, ptr_size) == 0)
- goto free_no_table;
- break;
- case 'P':
- {
- int per_width;
-
- cie.per_encoding = *buf++;
- per_width = get_DW_EH_PE_width (cie.per_encoding,
- ptr_size);
- if (per_width == 0)
- goto free_no_table;
- if ((cie.per_encoding & 0xf0) == DW_EH_PE_aligned)
- buf = (ehbuf
- + ((buf - ehbuf + per_width - 1)
- & ~((bfd_size_type) per_width - 1)));
- ENSURE_NO_RELOCS (buf);
- /* Ensure we have a reloc here, against
- a global symbol. */
- if (GET_RELOC (buf) != NULL)
- {
- unsigned long r_symndx;
-
-#ifdef BFD64
- if (ptr_size == 8)
- r_symndx = ELF64_R_SYM (cookie->rel->r_info);
- else
-#endif
- r_symndx = ELF32_R_SYM (cookie->rel->r_info);
- if (r_symndx >= cookie->locsymcount)
- {
- struct elf_link_hash_entry *h;
-
- r_symndx -= cookie->extsymoff;
- h = cookie->sym_hashes[r_symndx];
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *)
- h->root.u.i.link;
-
- cie.personality = h;
- }
- cookie->rel++;
- }
- buf += per_width;
- }
- break;
- default:
- /* Unrecognized augmentation. Better bail out. */
- goto free_no_table;
- }
- }
-
- /* For shared libraries, try to get rid of as many RELATIVE relocs
- as possible. */
- if (info->shared
- && (get_elf_backend_data (abfd)
- ->elf_backend_can_make_relative_eh_frame
- (abfd, info, sec))
- && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr)
- cie.make_relative = 1;
-
- if (info->shared
- && (get_elf_backend_data (abfd)
- ->elf_backend_can_make_lsda_relative_eh_frame
- (abfd, info, sec))
- && (cie.lsda_encoding & 0xf0) == DW_EH_PE_absptr)
- cie.make_lsda_relative = 1;
-
- /* If FDE encoding was not specified, it defaults to
- DW_EH_absptr. */
- if (cie.fde_encoding == DW_EH_PE_omit)
- cie.fde_encoding = DW_EH_PE_absptr;
-
- initial_insn_length = cie.hdr.length - (buf - last_fde - 4);
- if (initial_insn_length <= 50)
- {
- cie.initial_insn_length = initial_insn_length;
- memcpy (cie.initial_instructions, buf, initial_insn_length);
- }
- buf += initial_insn_length;
- ENSURE_NO_RELOCS (buf);
- last_cie = last_fde;
- }
- else
- {
- /* Ensure this FDE uses the last CIE encountered. */
- if (last_cie == NULL
- || hdr.id != (unsigned int) (buf - 4 - last_cie))
- goto free_no_table;
-
- ENSURE_NO_RELOCS (buf);
- if (GET_RELOC (buf) == NULL)
- /* This should not happen. */
- goto free_no_table;
- if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
- {
- /* This is a FDE against a discarded section. It should
- be deleted. */
- new_size -= hdr.length + 4;
- sec_info->entry[sec_info->count].removed = 1;
- }
- else
- {
- if (info->shared
- && (((cie.fde_encoding & 0xf0) == DW_EH_PE_absptr
- && cie.make_relative == 0)
- || (cie.fde_encoding & 0xf0) == DW_EH_PE_aligned))
- {
- /* If a shared library uses absolute pointers
- which we cannot turn into PC relative,
- don't create the binary search table,
- since it is affected by runtime relocations. */
- hdr_info->table = FALSE;
- }
- cie_usage_count++;
- hdr_info->fde_count++;
- }
- if (cie.lsda_encoding != DW_EH_PE_omit)
- {
- unsigned int dummy;
-
- aug = buf;
- buf += 2 * get_DW_EH_PE_width (cie.fde_encoding, ptr_size);
- if (cie.augmentation[0] == 'z')
- read_uleb128 (dummy, buf);
- /* If some new augmentation data is added before LSDA
- in FDE augmentation area, this need to be adjusted. */
- sec_info->entry[sec_info->count].lsda_offset = (buf - aug);
- }
- buf = last_fde + 4 + hdr.length;
- SKIP_RELOCS (buf);
- }
-
- sec_info->entry[sec_info->count].fde_encoding = cie.fde_encoding;
- sec_info->entry[sec_info->count].lsda_encoding = cie.lsda_encoding;
- sec_info->count++;
- }
-
- elf_section_data (sec)->sec_info = sec_info;
- sec->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
-
- /* Ok, now we can assign new offsets. */
- offset = 0;
- last_cie_ndx = 0;
- for (i = 0; i < sec_info->count; i++)
- {
- if (! sec_info->entry[i].removed)
- {
- sec_info->entry[i].new_offset = offset;
- offset += sec_info->entry[i].size;
- if (sec_info->entry[i].cie)
- {
- last_cie_ndx = i;
- make_relative = sec_info->entry[i].make_relative;
- make_lsda_relative = sec_info->entry[i].make_lsda_relative;
- }
- else
- {
- sec_info->entry[i].make_relative = make_relative;
- sec_info->entry[i].make_lsda_relative = make_lsda_relative;
- sec_info->entry[i].per_encoding_relative = 0;
- }
- }
- else if (sec_info->entry[i].cie && sec_info->entry[i].sec == sec)
- {
- /* Need to adjust new_offset too. */
- BFD_ASSERT (sec_info->entry[last_cie_ndx].offset
- == sec_info->entry[i].new_offset);
- sec_info->entry[i].new_offset
- = sec_info->entry[last_cie_ndx].new_offset;
- }
- }
- if (hdr_info->last_cie_sec == sec)
- {
- BFD_ASSERT (sec_info->entry[last_cie_ndx].offset
- == hdr_info->last_cie_offset);
- hdr_info->last_cie_offset = sec_info->entry[last_cie_ndx].new_offset;
- }
-
- /* FIXME: Currently it is not possible to shrink sections to zero size at
- this point, so build a fake minimal CIE. */
- if (new_size == 0)
- new_size = 16;
-
- /* Shrink the sec as needed. */
- sec->_cooked_size = new_size;
- if (sec->_cooked_size == 0)
- sec->flags |= SEC_EXCLUDE;
-
- free (ehbuf);
- return new_size != sec->_raw_size;
-
-free_no_table:
- if (ehbuf)
- free (ehbuf);
- if (sec_info)
- free (sec_info);
- hdr_info->table = FALSE;
- hdr_info->last_cie.hdr.length = 0;
- return FALSE;
-}
-
-/* This function is called for .eh_frame_hdr section after
- _bfd_elf_discard_section_eh_frame has been called on all .eh_frame
- input sections. It finalizes the size of .eh_frame_hdr section. */
-
-bfd_boolean
-_bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
-{
- struct elf_link_hash_table *htab;
- struct eh_frame_hdr_info *hdr_info;
- asection *sec;
-
- htab = elf_hash_table (info);
- hdr_info = &htab->eh_info;
- sec = hdr_info->hdr_sec;
- if (sec == NULL)
- return FALSE;
-
- sec->_cooked_size = EH_FRAME_HDR_SIZE;
- if (hdr_info->table)
- sec->_cooked_size += 4 + hdr_info->fde_count * 8;
-
- /* Request program headers to be recalculated. */
- elf_tdata (abfd)->program_header_size = 0;
- elf_tdata (abfd)->eh_frame_hdr = sec;
- return TRUE;
-}
-
-/* This function is called from size_dynamic_sections.
- It needs to decide whether .eh_frame_hdr should be output or not,
- because later on it is too late for calling _bfd_strip_section_from_output,
- since dynamic symbol table has been sized. */
-
-bfd_boolean
-_bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
-{
- asection *o;
- bfd *abfd;
- struct elf_link_hash_table *htab;
- struct eh_frame_hdr_info *hdr_info;
-
- htab = elf_hash_table (info);
- hdr_info = &htab->eh_info;
- if (hdr_info->hdr_sec == NULL)
- return TRUE;
-
- if (bfd_is_abs_section (hdr_info->hdr_sec->output_section))
- {
- hdr_info->hdr_sec = NULL;
- return TRUE;
- }
-
- abfd = NULL;
- if (info->eh_frame_hdr)
- for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
- {
- /* Count only sections which have at least a single CIE or FDE.
- There cannot be any CIE or FDE <= 8 bytes. */
- o = bfd_get_section_by_name (abfd, ".eh_frame");
- if (o && o->_raw_size > 8 && !bfd_is_abs_section (o->output_section))
- break;
- }
-
- if (abfd == NULL)
- {
- _bfd_strip_section_from_output (info, hdr_info->hdr_sec);
- hdr_info->hdr_sec = NULL;
- return TRUE;
- }
-
- hdr_info->table = TRUE;
- return TRUE;
-}
-
-/* Adjust an address in the .eh_frame section. Given OFFSET within
- SEC, this returns the new offset in the adjusted .eh_frame section,
- or -1 if the address refers to a CIE/FDE which has been removed
- or to offset with dynamic relocation which is no longer needed. */
-
-bfd_vma
-_bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
- asection *sec,
- bfd_vma offset)
-{
- struct eh_frame_sec_info *sec_info;
- unsigned int lo, hi, mid;
-
- if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
- return offset;
- sec_info = elf_section_data (sec)->sec_info;
-
- if (offset >= sec->_raw_size)
- return offset - (sec->_cooked_size - sec->_raw_size);
-
- lo = 0;
- hi = sec_info->count;
- mid = 0;
- while (lo < hi)
- {
- mid = (lo + hi) / 2;
- if (offset < sec_info->entry[mid].offset)
- hi = mid;
- else if (offset
- >= sec_info->entry[mid].offset + sec_info->entry[mid].size)
- lo = mid + 1;
- else
- break;
- }
-
- BFD_ASSERT (lo < hi);
-
- /* FDE or CIE was removed. */
- if (sec_info->entry[mid].removed)
- return (bfd_vma) -1;
-
- /* If converting to DW_EH_PE_pcrel, there will be no need for run-time
- relocation against FDE's initial_location field. */
- if (sec_info->entry[mid].make_relative
- && ! sec_info->entry[mid].cie
- && offset == sec_info->entry[mid].offset + 8)
- return (bfd_vma) -2;
-
- /* If converting LSDA pointers to DW_EH_PE_pcrel, there will be no need
- for run-time relocation against LSDA field. */
- if (sec_info->entry[mid].make_lsda_relative
- && ! sec_info->entry[mid].cie
- && (offset == (sec_info->entry[mid].offset + 8
- + sec_info->entry[mid].lsda_offset)))
- return (bfd_vma) -2;
-
- return (offset + sec_info->entry[mid].new_offset
- - sec_info->entry[mid].offset);
-}
-
-/* Write out .eh_frame section. This is called with the relocated
- contents. */
-
-bfd_boolean
-_bfd_elf_write_section_eh_frame (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- bfd_byte *contents)
-{
- struct eh_frame_sec_info *sec_info;
- struct elf_link_hash_table *htab;
- struct eh_frame_hdr_info *hdr_info;
- unsigned int i;
- bfd_byte *p, *buf;
- unsigned int leb128_tmp;
- unsigned int cie_offset = 0;
- unsigned int ptr_size;
-
- ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
- == ELFCLASS64) ? 8 : 4;
-
- if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
- return bfd_set_section_contents (abfd, sec->output_section, contents,
- sec->output_offset, sec->_raw_size);
- sec_info = elf_section_data (sec)->sec_info;
- htab = elf_hash_table (info);
- hdr_info = &htab->eh_info;
- if (hdr_info->table && hdr_info->array == NULL)
- hdr_info->array
- = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
- if (hdr_info->array == NULL)
- hdr_info = NULL;
-
- p = contents;
- for (i = 0; i < sec_info->count; ++i)
- {
- if (sec_info->entry[i].removed)
- {
- if (sec_info->entry[i].cie)
- {
- /* If CIE is removed due to no remaining FDEs referencing it
- and there were no CIEs kept before it, sec_info->entry[i].sec
- will be zero. */
- if (sec_info->entry[i].sec == NULL)
- cie_offset = 0;
- else
- {
- cie_offset = sec_info->entry[i].new_offset;
- cie_offset += (sec_info->entry[i].sec->output_section->vma
- + sec_info->entry[i].sec->output_offset
- - sec->output_section->vma
- - sec->output_offset);
- }
- }
- continue;
- }
-
- if (sec_info->entry[i].cie)
- {
- /* CIE */
- cie_offset = sec_info->entry[i].new_offset;
- if (sec_info->entry[i].make_relative
- || sec_info->entry[i].make_lsda_relative
- || sec_info->entry[i].per_encoding_relative)
- {
- unsigned char *aug;
- unsigned int action;
- unsigned int dummy, per_width, per_encoding;
-
- /* Need to find 'R' or 'L' augmentation's argument and modify
- DW_EH_PE_* value. */
- action = (sec_info->entry[i].make_relative ? 1 : 0)
- | (sec_info->entry[i].make_lsda_relative ? 2 : 0)
- | (sec_info->entry[i].per_encoding_relative ? 4 : 0);
- buf = contents + sec_info->entry[i].offset;
- /* Skip length, id and version. */
- buf += 9;
- aug = buf;
- buf = strchr (buf, '\0') + 1;
- read_uleb128 (dummy, buf);
- read_sleb128 (dummy, buf);
- read_uleb128 (dummy, buf);
- if (*aug == 'z')
- {
- read_uleb128 (dummy, buf);
- aug++;
- }
-
- while (action)
- switch (*aug++)
- {
- case 'L':
- if (action & 2)
- {
- BFD_ASSERT (*buf == sec_info->entry[i].lsda_encoding);
- *buf |= DW_EH_PE_pcrel;
- action &= ~2;
- }
- buf++;
- break;
- case 'P':
- per_encoding = *buf++;
- per_width = get_DW_EH_PE_width (per_encoding,
- ptr_size);
- BFD_ASSERT (per_width != 0);
- BFD_ASSERT (((per_encoding & 0x70) == DW_EH_PE_pcrel)
- == sec_info->entry[i].per_encoding_relative);
- if ((per_encoding & 0xf0) == DW_EH_PE_aligned)
- buf = (contents
- + ((buf - contents + per_width - 1)
- & ~((bfd_size_type) per_width - 1)));
- if (action & 4)
- {
- bfd_vma value;
-
- value = read_value (abfd, buf, per_width,
- get_DW_EH_PE_signed
- (per_encoding));
- value += (sec_info->entry[i].offset
- - sec_info->entry[i].new_offset);
- write_value (abfd, buf, value, per_width);
- action &= ~4;
- }
- buf += per_width;
- break;
- case 'R':
- if (action & 1)
- {
- BFD_ASSERT (*buf == sec_info->entry[i].fde_encoding);
- *buf |= DW_EH_PE_pcrel;
- action &= ~1;
- }
- buf++;
- break;
- default:
- BFD_FAIL ();
- }
- }
- }
- else if (sec_info->entry[i].size > 4)
- {
- /* FDE */
- bfd_vma value = 0, address;
- unsigned int width;
-
- buf = contents + sec_info->entry[i].offset;
- /* Skip length. */
- buf += 4;
- bfd_put_32 (abfd,
- sec_info->entry[i].new_offset + 4 - cie_offset, buf);
- buf += 4;
- width = get_DW_EH_PE_width (sec_info->entry[i].fde_encoding,
- ptr_size);
- address = value = read_value (abfd, buf, width,
- get_DW_EH_PE_signed
- (sec_info->entry[i].fde_encoding));
- if (value)
- {
- switch (sec_info->entry[i].fde_encoding & 0xf0)
- {
- case DW_EH_PE_indirect:
- case DW_EH_PE_textrel:
- BFD_ASSERT (hdr_info == NULL);
- break;
- case DW_EH_PE_datarel:
- {
- asection *got = bfd_get_section_by_name (abfd, ".got");
-
- BFD_ASSERT (got != NULL);
- address += got->vma;
- }
- break;
- case DW_EH_PE_pcrel:
- value += (sec_info->entry[i].offset
- - sec_info->entry[i].new_offset);
- address += (sec->output_section->vma + sec->output_offset
- + sec_info->entry[i].offset + 8);
- break;
- }
- if (sec_info->entry[i].make_relative)
- value -= (sec->output_section->vma + sec->output_offset
- + sec_info->entry[i].new_offset + 8);
- write_value (abfd, buf, value, width);
- }
-
- if (hdr_info)
- {
- hdr_info->array[hdr_info->array_count].initial_loc = address;
- hdr_info->array[hdr_info->array_count++].fde
- = (sec->output_section->vma + sec->output_offset
- + sec_info->entry[i].new_offset);
- }
-
- if ((sec_info->entry[i].lsda_encoding & 0xf0) == DW_EH_PE_pcrel
- || sec_info->entry[i].make_lsda_relative)
- {
- buf += sec_info->entry[i].lsda_offset;
- width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding,
- ptr_size);
- value = read_value (abfd, buf, width,
- get_DW_EH_PE_signed
- (sec_info->entry[i].lsda_encoding));
- if (value)
- {
- if ((sec_info->entry[i].lsda_encoding & 0xf0)
- == DW_EH_PE_pcrel)
- value += (sec_info->entry[i].offset
- - sec_info->entry[i].new_offset);
- else if (sec_info->entry[i].make_lsda_relative)
- value -= (sec->output_section->vma + sec->output_offset
- + sec_info->entry[i].new_offset + 8
- + sec_info->entry[i].lsda_offset);
- write_value (abfd, buf, value, width);
- }
- }
- }
- else
- /* Terminating FDE must be at the end of .eh_frame section only. */
- BFD_ASSERT (i == sec_info->count - 1);
-
- BFD_ASSERT (p == contents + sec_info->entry[i].new_offset);
- memmove (p, contents + sec_info->entry[i].offset,
- sec_info->entry[i].size);
- p += sec_info->entry[i].size;
- }
-
- /* FIXME: Once _bfd_elf_discard_section_eh_frame will be able to
- shrink sections to zero size, this won't be needed any more. */
- if (p == contents && sec->_cooked_size == 16)
- {
- bfd_put_32 (abfd, 12, p); /* Fake CIE length */
- bfd_put_32 (abfd, 0, p + 4); /* Fake CIE id */
- p[8] = 1; /* Fake CIE version */
- memset (p + 9, 0, 7); /* Fake CIE augmentation, 3xleb128
- and 3xDW_CFA_nop as pad */
- p += 16;
- }
- else
- {
- unsigned int alignment = 1 << sec->alignment_power;
- unsigned int pad = sec->_cooked_size % alignment;
-
- /* Don't pad beyond the raw size of the output section. It
- can happen at the last input section. */
- if (pad
- && ((sec->output_offset + sec->_cooked_size + pad)
- <= sec->output_section->_raw_size))
- {
- /* Find the last CIE/FDE. */
- for (i = sec_info->count - 1; i > 0; i--)
- if (! sec_info->entry[i].removed)
- break;
-
- /* The size of the last CIE/FDE must be at least 4. */
- if (sec_info->entry[i].removed
- || sec_info->entry[i].size < 4)
- abort ();
-
- pad = alignment - pad;
-
- buf = contents + sec_info->entry[i].new_offset;
-
- /* Update length. */
- sec_info->entry[i].size += pad;
- bfd_put_32 (abfd, sec_info->entry[i].size - 4, buf);
-
- /* Pad it with DW_CFA_nop */
- memset (p, 0, pad);
- p += pad;
-
- sec->_cooked_size += pad;
- }
- }
-
- BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size);
-
- return bfd_set_section_contents (abfd, sec->output_section,
- contents, (file_ptr) sec->output_offset,
- sec->_cooked_size);
-}
-
-/* Helper function used to sort .eh_frame_hdr search table by increasing
- VMA of FDE initial location. */
-
-static int
-vma_compare (const void *a, const void *b)
-{
- const struct eh_frame_array_ent *p = a;
- const struct eh_frame_array_ent *q = b;
- if (p->initial_loc > q->initial_loc)
- return 1;
- if (p->initial_loc < q->initial_loc)
- return -1;
- return 0;
-}
-
-/* Write out .eh_frame_hdr section. This must be called after
- _bfd_elf_write_section_eh_frame has been called on all input
- .eh_frame sections.
- .eh_frame_hdr format:
- ubyte version (currently 1)
- ubyte eh_frame_ptr_enc (DW_EH_PE_* encoding of pointer to start of
- .eh_frame section)
- ubyte fde_count_enc (DW_EH_PE_* encoding of total FDE count
- number (or DW_EH_PE_omit if there is no
- binary search table computed))
- ubyte table_enc (DW_EH_PE_* encoding of binary search table,
- or DW_EH_PE_omit if not present.
- DW_EH_PE_datarel is using address of
- .eh_frame_hdr section start as base)
- [encoded] eh_frame_ptr (pointer to start of .eh_frame section)
- optionally followed by:
- [encoded] fde_count (total number of FDEs in .eh_frame section)
- fde_count x [encoded] initial_loc, fde
- (array of encoded pairs containing
- FDE initial_location field and FDE address,
- sorted by increasing initial_loc). */
-
-bfd_boolean
-_bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
-{
- struct elf_link_hash_table *htab;
- struct eh_frame_hdr_info *hdr_info;
- asection *sec;
- bfd_byte *contents;
- asection *eh_frame_sec;
- bfd_size_type size;
- bfd_boolean retval;
- bfd_vma encoded_eh_frame;
-
- htab = elf_hash_table (info);
- hdr_info = &htab->eh_info;
- sec = hdr_info->hdr_sec;
- if (sec == NULL)
- return TRUE;
-
- size = EH_FRAME_HDR_SIZE;
- if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
- size += 4 + hdr_info->fde_count * 8;
- contents = bfd_malloc (size);
- if (contents == NULL)
- return FALSE;
-
- eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
- if (eh_frame_sec == NULL)
- {
- free (contents);
- return FALSE;
- }
-
- memset (contents, 0, EH_FRAME_HDR_SIZE);
- contents[0] = 1; /* Version. */
- contents[1] = get_elf_backend_data (abfd)->elf_backend_encode_eh_address
- (abfd, info, eh_frame_sec, 0, sec, 4,
- &encoded_eh_frame); /* .eh_frame offset. */
-
- if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
- {
- contents[2] = DW_EH_PE_udata4; /* FDE count encoding. */
- contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* Search table enc. */
- }
- else
- {
- contents[2] = DW_EH_PE_omit;
- contents[3] = DW_EH_PE_omit;
- }
- bfd_put_32 (abfd, encoded_eh_frame, contents + 4);
-
- if (contents[2] != DW_EH_PE_omit)
- {
- unsigned int i;
-
- bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
- qsort (hdr_info->array, hdr_info->fde_count, sizeof (*hdr_info->array),
- vma_compare);
- for (i = 0; i < hdr_info->fde_count; i++)
- {
- bfd_put_32 (abfd,
- hdr_info->array[i].initial_loc
- - sec->output_section->vma,
- contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
- bfd_put_32 (abfd,
- hdr_info->array[i].fde - sec->output_section->vma,
- contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
- }
- }
-
- retval = bfd_set_section_contents (abfd, sec->output_section,
- contents, (file_ptr) sec->output_offset,
- sec->_cooked_size);
- free (contents);
- return retval;
-}
-
-/* Decide whether we can use a PC-relative encoding within the given
- EH frame section. This is the default implementation. */
-
-bfd_boolean
-_bfd_elf_can_make_relative (bfd *input_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *eh_frame_section ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/* Select an encoding for the given address. Preference is given to
- PC-relative addressing modes. */
-
-bfd_byte
-_bfd_elf_encode_eh_address (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *osec, bfd_vma offset,
- asection *loc_sec, bfd_vma loc_offset,
- bfd_vma *encoded)
-{
- *encoded = osec->vma + offset -
- (loc_sec->output_section->vma + loc_sec->output_offset + loc_offset);
- return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
-}
diff --git a/contrib/binutils/bfd/elf-strtab.c b/contrib/binutils/bfd/elf-strtab.c
deleted file mode 100644
index 673b9d7..0000000
--- a/contrib/binutils/bfd/elf-strtab.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/* ELF strtab with GC and suffix merging support.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
- Written by Jakub Jelinek <jakub@redhat.com>.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "hashtab.h"
-#include "libiberty.h"
-
-/* An entry in the strtab hash table. */
-
-struct elf_strtab_hash_entry
-{
- struct bfd_hash_entry root;
- /* Length of this entry. This includes the zero terminator. */
- int len;
- unsigned int refcount;
- union {
- /* Index within the merged section. */
- bfd_size_type index;
- /* Entry this is a suffix of (if len < 0). */
- struct elf_strtab_hash_entry *suffix;
- } u;
-};
-
-/* The strtab hash table. */
-
-struct elf_strtab_hash
-{
- struct bfd_hash_table table;
- /* Next available index. */
- bfd_size_type size;
- /* Number of array entries alloced. */
- bfd_size_type alloced;
- /* Final strtab size. */
- bfd_size_type sec_size;
- /* Array of pointers to strtab entries. */
- struct elf_strtab_hash_entry **array;
-};
-
-/* Routine to create an entry in a section merge hashtab. */
-
-static struct bfd_hash_entry *
-elf_strtab_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- entry = bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
- if (entry == NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- entry = bfd_hash_newfunc (entry, table, string);
-
- if (entry)
- {
- /* Initialize the local fields. */
- struct elf_strtab_hash_entry *ret;
-
- ret = (struct elf_strtab_hash_entry *) entry;
- ret->u.index = -1;
- ret->refcount = 0;
- ret->len = 0;
- }
-
- return entry;
-}
-
-/* Create a new hash table. */
-
-struct elf_strtab_hash *
-_bfd_elf_strtab_init (void)
-{
- struct elf_strtab_hash *table;
- bfd_size_type amt = sizeof (struct elf_strtab_hash);
-
- table = bfd_malloc (amt);
- if (table == NULL)
- return NULL;
-
- if (! bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc))
- {
- free (table);
- return NULL;
- }
-
- table->sec_size = 0;
- table->size = 1;
- table->alloced = 64;
- amt = sizeof (struct elf_strtab_hasn_entry *);
- table->array = bfd_malloc (table->alloced * amt);
- if (table->array == NULL)
- {
- free (table);
- return NULL;
- }
-
- table->array[0] = NULL;
-
- return table;
-}
-
-/* Free a strtab. */
-
-void
-_bfd_elf_strtab_free (struct elf_strtab_hash *tab)
-{
- bfd_hash_table_free (&tab->table);
- free (tab->array);
- free (tab);
-}
-
-/* Get the index of an entity in a hash table, adding it if it is not
- already present. */
-
-bfd_size_type
-_bfd_elf_strtab_add (struct elf_strtab_hash *tab,
- const char *str,
- bfd_boolean copy)
-{
- register struct elf_strtab_hash_entry *entry;
-
- /* We handle this specially, since we don't want to do refcounting
- on it. */
- if (*str == '\0')
- return 0;
-
- BFD_ASSERT (tab->sec_size == 0);
- entry = (struct elf_strtab_hash_entry *)
- bfd_hash_lookup (&tab->table, str, TRUE, copy);
-
- if (entry == NULL)
- return (bfd_size_type) -1;
-
- entry->refcount++;
- if (entry->len == 0)
- {
- entry->len = strlen (str) + 1;
- /* 2G strings lose. */
- BFD_ASSERT (entry->len > 0);
- if (tab->size == tab->alloced)
- {
- bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
- tab->alloced *= 2;
- tab->array = bfd_realloc (tab->array, tab->alloced * amt);
- if (tab->array == NULL)
- return (bfd_size_type) -1;
- }
-
- entry->u.index = tab->size++;
- tab->array[entry->u.index] = entry;
- }
- return entry->u.index;
-}
-
-void
-_bfd_elf_strtab_addref (struct elf_strtab_hash *tab, bfd_size_type idx)
-{
- if (idx == 0 || idx == (bfd_size_type) -1)
- return;
- BFD_ASSERT (tab->sec_size == 0);
- BFD_ASSERT (idx < tab->size);
- ++tab->array[idx]->refcount;
-}
-
-void
-_bfd_elf_strtab_delref (struct elf_strtab_hash *tab, bfd_size_type idx)
-{
- if (idx == 0 || idx == (bfd_size_type) -1)
- return;
- BFD_ASSERT (tab->sec_size == 0);
- BFD_ASSERT (idx < tab->size);
- BFD_ASSERT (tab->array[idx]->refcount > 0);
- --tab->array[idx]->refcount;
-}
-
-void
-_bfd_elf_strtab_clear_all_refs (struct elf_strtab_hash *tab)
-{
- bfd_size_type idx;
-
- for (idx = 1; idx < tab->size; ++idx)
- tab->array[idx]->refcount = 0;
-}
-
-bfd_size_type
-_bfd_elf_strtab_size (struct elf_strtab_hash *tab)
-{
- return tab->sec_size ? tab->sec_size : tab->size;
-}
-
-bfd_size_type
-_bfd_elf_strtab_offset (struct elf_strtab_hash *tab, bfd_size_type idx)
-{
- struct elf_strtab_hash_entry *entry;
-
- if (idx == 0)
- return 0;
- BFD_ASSERT (idx < tab->size);
- BFD_ASSERT (tab->sec_size);
- entry = tab->array[idx];
- BFD_ASSERT (entry->refcount > 0);
- entry->refcount--;
- return tab->array[idx]->u.index;
-}
-
-bfd_boolean
-_bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
-{
- bfd_size_type off = 1, i;
-
- if (bfd_bwrite ("", 1, abfd) != 1)
- return FALSE;
-
- for (i = 1; i < tab->size; ++i)
- {
- register const char *str;
- register unsigned int len;
-
- BFD_ASSERT (tab->array[i]->refcount == 0);
- len = tab->array[i]->len;
- if ((int) len < 0)
- continue;
-
- str = tab->array[i]->root.string;
- if (bfd_bwrite (str, len, abfd) != len)
- return FALSE;
-
- off += len;
- }
-
- BFD_ASSERT (off == tab->sec_size);
- return TRUE;
-}
-
-/* Compare two elf_strtab_hash_entry structures. Called via qsort. */
-
-static int
-strrevcmp (const void *a, const void *b)
-{
- struct elf_strtab_hash_entry *A = *(struct elf_strtab_hash_entry **) a;
- struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b;
- unsigned int lenA = A->len;
- unsigned int lenB = B->len;
- const unsigned char *s = A->root.string + lenA - 1;
- const unsigned char *t = B->root.string + lenB - 1;
- int l = lenA < lenB ? lenA : lenB;
-
- while (l)
- {
- if (*s != *t)
- return (int) *s - (int) *t;
- s--;
- t--;
- l--;
- }
- return lenA - lenB;
-}
-
-static inline int
-is_suffix (const struct elf_strtab_hash_entry *A,
- const struct elf_strtab_hash_entry *B)
-{
- if (A->len <= B->len)
- /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
- not to be equal by the hash table. */
- return 0;
-
- return memcmp (A->root.string + (A->len - B->len),
- B->root.string, B->len - 1) == 0;
-}
-
-/* This function assigns final string table offsets for used strings,
- merging strings matching suffixes of longer strings if possible. */
-
-void
-_bfd_elf_strtab_finalize (struct elf_strtab_hash *tab)
-{
- struct elf_strtab_hash_entry **array, **a, *e;
- bfd_size_type size, amt;
-
- /* GCC 2.91.66 (egcs-1.1.2) on i386 miscompiles this function when i is
- a 64-bit bfd_size_type: a 64-bit target or --enable-64-bit-bfd.
- Besides, indexing with a long long wouldn't give anything but extra
- cycles. */
- size_t i;
-
- /* Sort the strings by suffix and length. */
- amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
- array = bfd_malloc (amt);
- if (array == NULL)
- goto alloc_failure;
-
- for (i = 1, a = array; i < tab->size; ++i)
- {
- e = tab->array[i];
- if (e->refcount)
- {
- *a++ = e;
- /* Adjust the length to not include the zero terminator. */
- e->len -= 1;
- }
- else
- e->len = 0;
- }
-
- size = a - array;
- if (size != 0)
- {
- qsort (array, size, sizeof (struct elf_strtab_hash_entry *), strrevcmp);
-
- /* Loop over the sorted array and merge suffixes. Start from the
- end because we want eg.
-
- s1 -> "d"
- s2 -> "bcd"
- s3 -> "abcd"
-
- to end up as
-
- s3 -> "abcd"
- s2 _____^
- s1 _______^
-
- ie. we don't want s1 pointing into the old s2. */
- e = *--a;
- e->len += 1;
- while (--a >= array)
- {
- struct elf_strtab_hash_entry *cmp = *a;
-
- cmp->len += 1;
- if (is_suffix (e, cmp))
- {
- cmp->u.suffix = e;
- cmp->len = -cmp->len;
- }
- else
- e = cmp;
- }
- }
-
-alloc_failure:
- if (array)
- free (array);
-
- /* Assign positions to the strings we want to keep. */
- size = 1;
- for (i = 1; i < tab->size; ++i)
- {
- e = tab->array[i];
- if (e->refcount && e->len > 0)
- {
- e->u.index = size;
- size += e->len;
- }
- }
-
- tab->sec_size = size;
-
- /* Adjust the rest. */
- for (i = 1; i < tab->size; ++i)
- {
- e = tab->array[i];
- if (e->refcount && e->len < 0)
- e->u.index = e->u.suffix->u.index + (e->u.suffix->len + e->len);
- }
-}
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
deleted file mode 100644
index a14fd35..0000000
--- a/contrib/binutils/bfd/elf.c
+++ /dev/null
@@ -1,7513 +0,0 @@
-/* ELF executable support for BFD.
-
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* SECTION
-
- ELF backends
-
- BFD support for ELF formats is being worked on.
- Currently, the best supported back ends are for sparc and i386
- (running svr4 or Solaris 2).
-
- Documentation of the internals of the support code still needs
- to be written. The code is changing quickly enough that we
- haven't bothered yet. */
-
-/* For sparc64-cross-sparc32. */
-#define _SYSCALL32
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#define ARCH_SIZE 0
-#include "elf-bfd.h"
-#include "libiberty.h"
-
-static int elf_sort_sections (const void *, const void *);
-static bfd_boolean assign_file_positions_except_relocs (bfd *, struct bfd_link_info *);
-static bfd_boolean prep_headers (bfd *);
-static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ;
-static bfd_boolean elfcore_read_notes (bfd *, file_ptr, bfd_size_type) ;
-
-/* Swap version information in and out. The version information is
- currently size independent. If that ever changes, this code will
- need to move into elfcode.h. */
-
-/* Swap in a Verdef structure. */
-
-void
-_bfd_elf_swap_verdef_in (bfd *abfd,
- const Elf_External_Verdef *src,
- Elf_Internal_Verdef *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_verdef_out (bfd *abfd,
- const Elf_Internal_Verdef *src,
- Elf_External_Verdef *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_verdaux_in (bfd *abfd,
- const Elf_External_Verdaux *src,
- Elf_Internal_Verdaux *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_verdaux_out (bfd *abfd,
- const Elf_Internal_Verdaux *src,
- Elf_External_Verdaux *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_verneed_in (bfd *abfd,
- const Elf_External_Verneed *src,
- Elf_Internal_Verneed *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_verneed_out (bfd *abfd,
- const Elf_Internal_Verneed *src,
- Elf_External_Verneed *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_vernaux_in (bfd *abfd,
- const Elf_External_Vernaux *src,
- Elf_Internal_Vernaux *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_vernaux_out (bfd *abfd,
- const Elf_Internal_Vernaux *src,
- Elf_External_Vernaux *dst)
-{
- 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. */
-
-void
-_bfd_elf_swap_versym_in (bfd *abfd,
- const Elf_External_Versym *src,
- Elf_Internal_Versym *dst)
-{
- dst->vs_vers = H_GET_16 (abfd, src->vs_vers);
-}
-
-/* Swap out a Versym structure. */
-
-void
-_bfd_elf_swap_versym_out (bfd *abfd,
- const Elf_Internal_Versym *src,
- Elf_External_Versym *dst)
-{
- H_PUT_16 (abfd, src->vs_vers, dst->vs_vers);
-}
-
-/* Standard ELF hash function. Do not change this function; you will
- cause invalid hash tables to be generated. */
-
-unsigned long
-bfd_elf_hash (const char *namearg)
-{
- const unsigned char *name = (const unsigned char *) namearg;
- unsigned long h = 0;
- unsigned long g;
- int ch;
-
- while ((ch = *name++) != '\0')
- {
- h = (h << 4) + ch;
- if ((g = (h & 0xf0000000)) != 0)
- {
- h ^= g >> 24;
- /* The ELF ABI says `h &= ~g', but this is equivalent in
- this case and on some machines one insn instead of two. */
- h ^= g;
- }
- }
- return h & 0xffffffff;
-}
-
-/* Read a specified number of bytes at a specified offset in an ELF
- file, into a newly allocated buffer, and return a pointer to the
- buffer. */
-
-static char *
-elf_read (bfd *abfd, 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) != 0)
- return NULL;
- if (bfd_bread (buf, size, abfd) != size)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_file_truncated);
- return NULL;
- }
- return buf;
-}
-
-bfd_boolean
-bfd_elf_mkobject (bfd *abfd)
-{
- /* This just does initialization. */
- /* coff_mkobject zalloc's space for tdata.coff_obj_data ... */
- elf_tdata (abfd) = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
- if (elf_tdata (abfd) == 0)
- return FALSE;
- /* Since everything is done at close time, do we need any
- initialization? */
-
- return TRUE;
-}
-
-bfd_boolean
-bfd_elf_mkcorefile (bfd *abfd)
-{
- /* I think this can be done just like an object file. */
- return bfd_elf_mkobject (abfd);
-}
-
-char *
-bfd_elf_get_str_section (bfd *abfd, unsigned int shindex)
-{
- Elf_Internal_Shdr **i_shdrp;
- char *shstrtab = NULL;
- file_ptr offset;
- bfd_size_type shstrtabsize;
-
- i_shdrp = elf_elfsections (abfd);
- if (i_shdrp == 0 || i_shdrp[shindex] == 0)
- return 0;
-
- shstrtab = (char *) i_shdrp[shindex]->contents;
- if (shstrtab == NULL)
- {
- /* No cached one, attempt to read, and cache what we read. */
- offset = i_shdrp[shindex]->sh_offset;
- shstrtabsize = i_shdrp[shindex]->sh_size;
- shstrtab = elf_read (abfd, offset, shstrtabsize);
- i_shdrp[shindex]->contents = shstrtab;
- }
- return shstrtab;
-}
-
-char *
-bfd_elf_string_from_elf_section (bfd *abfd,
- unsigned int shindex,
- unsigned int strindex)
-{
- Elf_Internal_Shdr *hdr;
-
- if (strindex == 0)
- return "";
-
- hdr = elf_elfsections (abfd)[shindex];
-
- if (hdr->contents == NULL
- && bfd_elf_get_str_section (abfd, shindex) == NULL)
- return NULL;
-
- if (strindex >= hdr->sh_size)
- {
- (*_bfd_error_handler)
- (_("%s: invalid string offset %u >= %lu for section `%s'"),
- bfd_archive_filename (abfd), strindex, (unsigned long) hdr->sh_size,
- ((shindex == elf_elfheader(abfd)->e_shstrndx
- && strindex == hdr->sh_name)
- ? ".shstrtab"
- : elf_string_from_elf_strtab (abfd, hdr->sh_name)));
- return "";
- }
-
- return ((char *) hdr->contents) + strindex;
-}
-
-/* Read and convert symbols to internal format.
- SYMCOUNT specifies the number of symbols to read, starting from
- symbol SYMOFFSET. If any of INTSYM_BUF, EXTSYM_BUF or EXTSHNDX_BUF
- are non-NULL, they are used to store the internal symbols, external
- symbols, and symbol section index extensions, respectively. */
-
-Elf_Internal_Sym *
-bfd_elf_get_elf_syms (bfd *ibfd,
- Elf_Internal_Shdr *symtab_hdr,
- size_t symcount,
- size_t symoffset,
- Elf_Internal_Sym *intsym_buf,
- void *extsym_buf,
- Elf_External_Sym_Shndx *extshndx_buf)
-{
- Elf_Internal_Shdr *shndx_hdr;
- void *alloc_ext;
- const bfd_byte *esym;
- Elf_External_Sym_Shndx *alloc_extshndx;
- Elf_External_Sym_Shndx *shndx;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- const struct elf_backend_data *bed;
- size_t extsym_size;
- bfd_size_type amt;
- file_ptr pos;
-
- if (symcount == 0)
- return intsym_buf;
-
- /* Normal syms might have section extension entries. */
- shndx_hdr = NULL;
- if (symtab_hdr == &elf_tdata (ibfd)->symtab_hdr)
- shndx_hdr = &elf_tdata (ibfd)->symtab_shndx_hdr;
-
- /* Read the symbols. */
- alloc_ext = NULL;
- alloc_extshndx = NULL;
- bed = get_elf_backend_data (ibfd);
- extsym_size = bed->s->sizeof_sym;
- amt = symcount * extsym_size;
- pos = symtab_hdr->sh_offset + symoffset * extsym_size;
- if (extsym_buf == NULL)
- {
- alloc_ext = bfd_malloc (amt);
- extsym_buf = alloc_ext;
- }
- if (extsym_buf == NULL
- || bfd_seek (ibfd, pos, SEEK_SET) != 0
- || bfd_bread (extsym_buf, amt, ibfd) != amt)
- {
- intsym_buf = NULL;
- goto out;
- }
-
- if (shndx_hdr == NULL || shndx_hdr->sh_size == 0)
- extshndx_buf = NULL;
- else
- {
- amt = symcount * sizeof (Elf_External_Sym_Shndx);
- pos = shndx_hdr->sh_offset + symoffset * sizeof (Elf_External_Sym_Shndx);
- if (extshndx_buf == NULL)
- {
- alloc_extshndx = bfd_malloc (amt);
- extshndx_buf = alloc_extshndx;
- }
- if (extshndx_buf == NULL
- || bfd_seek (ibfd, pos, SEEK_SET) != 0
- || bfd_bread (extshndx_buf, amt, ibfd) != amt)
- {
- intsym_buf = NULL;
- goto out;
- }
- }
-
- if (intsym_buf == NULL)
- {
- bfd_size_type amt = symcount * sizeof (Elf_Internal_Sym);
- intsym_buf = bfd_malloc (amt);
- if (intsym_buf == NULL)
- goto out;
- }
-
- /* Convert the symbols to internal form. */
- isymend = intsym_buf + symcount;
- for (esym = extsym_buf, isym = intsym_buf, shndx = extshndx_buf;
- isym < isymend;
- esym += extsym_size, isym++, shndx = shndx != NULL ? shndx + 1 : NULL)
- (*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym);
-
- out:
- if (alloc_ext != NULL)
- free (alloc_ext);
- if (alloc_extshndx != NULL)
- free (alloc_extshndx);
-
- return intsym_buf;
-}
-
-/* Look up a symbol name. */
-const char *
-bfd_elf_local_sym_name (bfd *abfd, Elf_Internal_Sym *isym)
-{
- unsigned int iname = isym->st_name;
- unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link;
- if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION)
- {
- iname = elf_elfsections (abfd)[isym->st_shndx]->sh_name;
- shindex = elf_elfheader (abfd)->e_shstrndx;
- }
-
- return bfd_elf_string_from_elf_section (abfd, shindex, iname);
-}
-
-/* Elf_Internal_Shdr->contents is an array of these for SHT_GROUP
- sections. The first element is the flags, the rest are section
- pointers. */
-
-typedef union elf_internal_group {
- Elf_Internal_Shdr *shdr;
- unsigned int flags;
-} Elf_Internal_Group;
-
-/* Return the name of the group signature symbol. Why isn't the
- signature just a string? */
-
-static const char *
-group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr)
-{
- Elf_Internal_Shdr *hdr;
- unsigned char esym[sizeof (Elf64_External_Sym)];
- Elf_External_Sym_Shndx eshndx;
- Elf_Internal_Sym isym;
-
- /* First we need to ensure the symbol table is available. */
- if (! bfd_section_from_shdr (abfd, ghdr->sh_link))
- return NULL;
-
- /* Go read the symbol. */
- hdr = &elf_tdata (abfd)->symtab_hdr;
- if (bfd_elf_get_elf_syms (abfd, hdr, 1, ghdr->sh_info,
- &isym, esym, &eshndx) == NULL)
- return NULL;
-
- return bfd_elf_local_sym_name (abfd, &isym);
-}
-
-/* Set next_in_group list pointer, and group name for NEWSECT. */
-
-static bfd_boolean
-setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
-{
- unsigned int num_group = elf_tdata (abfd)->num_group;
-
- /* If num_group is zero, read in all SHT_GROUP sections. The count
- is set to -1 if there are no SHT_GROUP sections. */
- if (num_group == 0)
- {
- unsigned int i, shnum;
-
- /* First count the number of groups. If we have a SHT_GROUP
- section with just a flag word (ie. sh_size is 4), ignore it. */
- shnum = elf_numsections (abfd);
- num_group = 0;
- for (i = 0; i < shnum; i++)
- {
- Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
- if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8)
- num_group += 1;
- }
-
- if (num_group == 0)
- num_group = (unsigned) -1;
- elf_tdata (abfd)->num_group = num_group;
-
- if (num_group > 0)
- {
- /* We keep a list of elf section headers for group sections,
- so we can find them quickly. */
- bfd_size_type amt = num_group * sizeof (Elf_Internal_Shdr *);
- elf_tdata (abfd)->group_sect_ptr = bfd_alloc (abfd, amt);
- if (elf_tdata (abfd)->group_sect_ptr == NULL)
- return FALSE;
-
- num_group = 0;
- for (i = 0; i < shnum; i++)
- {
- Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
- if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8)
- {
- unsigned char *src;
- Elf_Internal_Group *dest;
-
- /* Add to list of sections. */
- elf_tdata (abfd)->group_sect_ptr[num_group] = shdr;
- num_group += 1;
-
- /* Read the raw contents. */
- BFD_ASSERT (sizeof (*dest) >= 4);
- amt = shdr->sh_size * sizeof (*dest) / 4;
- shdr->contents = bfd_alloc (abfd, amt);
- if (shdr->contents == NULL
- || bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread (shdr->contents, shdr->sh_size, abfd)
- != shdr->sh_size))
- return FALSE;
-
- /* Translate raw contents, a flag word followed by an
- array of elf section indices all in target byte order,
- to the flag word followed by an array of elf section
- pointers. */
- src = shdr->contents + shdr->sh_size;
- dest = (Elf_Internal_Group *) (shdr->contents + amt);
- while (1)
- {
- unsigned int idx;
-
- src -= 4;
- --dest;
- idx = H_GET_32 (abfd, src);
- if (src == shdr->contents)
- {
- dest->flags = idx;
- if (shdr->bfd_section != NULL && (idx & GRP_COMDAT))
- shdr->bfd_section->flags
- |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
- break;
- }
- if (idx >= shnum)
- {
- ((*_bfd_error_handler)
- (_("%s: invalid SHT_GROUP entry"),
- bfd_archive_filename (abfd)));
- idx = 0;
- }
- dest->shdr = elf_elfsections (abfd)[idx];
- }
- }
- }
- }
- }
-
- if (num_group != (unsigned) -1)
- {
- unsigned int i;
-
- for (i = 0; i < num_group; i++)
- {
- Elf_Internal_Shdr *shdr = elf_tdata (abfd)->group_sect_ptr[i];
- Elf_Internal_Group *idx = (Elf_Internal_Group *) shdr->contents;
- unsigned int n_elt = shdr->sh_size / 4;
-
- /* Look through this group's sections to see if current
- section is a member. */
- while (--n_elt != 0)
- if ((++idx)->shdr == hdr)
- {
- asection *s = NULL;
-
- /* We are a member of this group. Go looking through
- other members to see if any others are linked via
- next_in_group. */
- idx = (Elf_Internal_Group *) shdr->contents;
- n_elt = shdr->sh_size / 4;
- while (--n_elt != 0)
- if ((s = (++idx)->shdr->bfd_section) != NULL
- && elf_next_in_group (s) != NULL)
- break;
- if (n_elt != 0)
- {
- /* Snarf the group name from other member, and
- insert current section in circular list. */
- elf_group_name (newsect) = elf_group_name (s);
- elf_next_in_group (newsect) = elf_next_in_group (s);
- elf_next_in_group (s) = newsect;
- }
- else
- {
- const char *gname;
-
- gname = group_signature (abfd, shdr);
- if (gname == NULL)
- return FALSE;
- elf_group_name (newsect) = gname;
-
- /* Start a circular list with one element. */
- elf_next_in_group (newsect) = newsect;
- }
-
- /* If the group section has been created, point to the
- new member. */
- if (shdr->bfd_section != NULL)
- elf_next_in_group (shdr->bfd_section) = newsect;
-
- i = num_group - 1;
- break;
- }
- }
- }
-
- if (elf_group_name (newsect) == NULL)
- {
- (*_bfd_error_handler) (_("%s: no group info for section %s"),
- bfd_archive_filename (abfd), newsect->name);
- }
- return TRUE;
-}
-
-bfd_boolean
-bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group)
-{
- asection *first = elf_next_in_group (group);
- asection *s = first;
-
- while (s != NULL)
- {
- s->output_section = bfd_abs_section_ptr;
- s = elf_next_in_group (s);
- /* These lists are circular. */
- if (s == first)
- break;
- }
- return TRUE;
-}
-
-/* Make a BFD section from an ELF section. We store a pointer to the
- BFD section in the bfd_section field of the header. */
-
-bfd_boolean
-_bfd_elf_make_section_from_shdr (bfd *abfd,
- Elf_Internal_Shdr *hdr,
- const char *name)
-{
- asection *newsect;
- flagword flags;
- const struct elf_backend_data *bed;
-
- if (hdr->bfd_section != NULL)
- {
- BFD_ASSERT (strcmp (name,
- bfd_get_section_name (abfd, hdr->bfd_section)) == 0);
- return TRUE;
- }
-
- newsect = bfd_make_section_anyway (abfd, name);
- if (newsect == NULL)
- return FALSE;
-
- /* Always use the real type/flags. */
- elf_section_type (newsect) = hdr->sh_type;
- elf_section_flags (newsect) = hdr->sh_flags;
-
- newsect->filepos = hdr->sh_offset;
-
- 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 ((bfd_vma) hdr->sh_addralign)))
- return FALSE;
-
- flags = SEC_NO_FLAGS;
- if (hdr->sh_type != SHT_NOBITS)
- flags |= SEC_HAS_CONTENTS;
- if (hdr->sh_type == SHT_GROUP)
- flags |= SEC_GROUP | SEC_EXCLUDE;
- if ((hdr->sh_flags & SHF_ALLOC) != 0)
- {
- flags |= SEC_ALLOC;
- if (hdr->sh_type != SHT_NOBITS)
- flags |= SEC_LOAD;
- }
- if ((hdr->sh_flags & SHF_WRITE) == 0)
- flags |= SEC_READONLY;
- if ((hdr->sh_flags & SHF_EXECINSTR) != 0)
- flags |= SEC_CODE;
- else if ((flags & SEC_LOAD) != 0)
- flags |= SEC_DATA;
- if ((hdr->sh_flags & SHF_MERGE) != 0)
- {
- flags |= SEC_MERGE;
- newsect->entsize = hdr->sh_entsize;
- if ((hdr->sh_flags & SHF_STRINGS) != 0)
- flags |= SEC_STRINGS;
- }
- if (hdr->sh_flags & SHF_GROUP)
- if (!setup_group (abfd, hdr, newsect))
- return FALSE;
- if ((hdr->sh_flags & SHF_TLS) != 0)
- flags |= SEC_THREAD_LOCAL;
-
- /* The debugging sections appear to be recognized only by name, not
- any sort of flag. */
- {
- static const char *debug_sec_names [] =
- {
- ".debug",
- ".gnu.linkonce.wi.",
- ".line",
- ".stab"
- };
- int i;
-
- for (i = ARRAY_SIZE (debug_sec_names); i--;)
- if (strncmp (name, debug_sec_names[i], strlen (debug_sec_names[i])) == 0)
- break;
-
- if (i >= 0)
- flags |= SEC_DEBUGGING;
- }
-
- /* As a GNU extension, if the name begins with .gnu.linkonce, we
- only link a single copy of the section. This is used to support
- g++. g++ will emit each template expansion in its own section.
- The symbols will be defined as weak, so that multiple definitions
- are permitted. The GNU linker extension is to actually discard
- all but one of the sections. */
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0
- && elf_next_in_group (newsect) == NULL)
- flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
-
- bed = get_elf_backend_data (abfd);
- if (bed->elf_backend_section_flags)
- if (! bed->elf_backend_section_flags (&flags, hdr))
- return FALSE;
-
- if (! bfd_set_section_flags (abfd, newsect, flags))
- return FALSE;
-
- if ((flags & SEC_ALLOC) != 0)
- {
- Elf_Internal_Phdr *phdr;
- unsigned int i;
-
- /* Look through the phdrs to see if we need to adjust the lma.
- If all the p_paddr fields are zero, we ignore them, since
- some ELF linkers produce such output. */
- phdr = elf_tdata (abfd)->phdr;
- for (i = 0; i < elf_elfheader (abfd)->e_phnum; i++, phdr++)
- {
- if (phdr->p_paddr != 0)
- break;
- }
- if (i < elf_elfheader (abfd)->e_phnum)
- {
- phdr = elf_tdata (abfd)->phdr;
- for (i = 0; i < elf_elfheader (abfd)->e_phnum; i++, phdr++)
- {
- /* This section is part of this segment if its file
- offset plus size lies within the segment's memory
- span and, if the section is loaded, the extent of the
- loaded data lies within the extent of the segment.
-
- Note - we used to check the p_paddr field as well, and
- refuse to set the LMA if it was 0. This is wrong
- though, as a perfectly valid initialised segment can
- have a p_paddr of zero. Some architectures, eg ARM,
- place special significance on the address 0 and
- executables need to be able to have a segment which
- covers this address. */
- if (phdr->p_type == PT_LOAD
- && (bfd_vma) hdr->sh_offset >= phdr->p_offset
- && (hdr->sh_offset + hdr->sh_size
- <= phdr->p_offset + phdr->p_memsz)
- && ((flags & SEC_LOAD) == 0
- || (hdr->sh_offset + hdr->sh_size
- <= phdr->p_offset + phdr->p_filesz)))
- {
- if ((flags & SEC_LOAD) == 0)
- newsect->lma = (phdr->p_paddr
- + hdr->sh_addr - phdr->p_vaddr);
- else
- /* We used to use the same adjustment for SEC_LOAD
- sections, but that doesn't work if the segment
- is packed with code from multiple VMAs.
- Instead we calculate the section LMA based on
- the segment LMA. It is assumed that the
- segment will contain sections with contiguous
- LMAs, even if the VMAs are not. */
- newsect->lma = (phdr->p_paddr
- + hdr->sh_offset - phdr->p_offset);
-
- /* With contiguous segments, we can't tell from file
- offsets whether a section with zero size should
- be placed at the end of one segment or the
- beginning of the next. Decide based on vaddr. */
- if (hdr->sh_addr >= phdr->p_vaddr
- && (hdr->sh_addr + hdr->sh_size
- <= phdr->p_vaddr + phdr->p_memsz))
- break;
- }
- }
- }
- }
-
- hdr->bfd_section = newsect;
- elf_section_data (newsect)->this_hdr = *hdr;
-
- return TRUE;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_elf_find_section
-
-SYNOPSIS
- struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
-
-DESCRIPTION
- Helper functions for GDB to locate the string tables.
- Since BFD hides string tables from callers, GDB needs to use an
- internal hook to find them. Sun's .stabstr, in particular,
- isn't even pointed to by the .stab section, so ordinary
- mechanisms wouldn't work to find it, even if we had some.
-*/
-
-struct elf_internal_shdr *
-bfd_elf_find_section (bfd *abfd, char *name)
-{
- Elf_Internal_Shdr **i_shdrp;
- char *shstrtab;
- unsigned int max;
- unsigned int i;
-
- i_shdrp = elf_elfsections (abfd);
- if (i_shdrp != NULL)
- {
- shstrtab = bfd_elf_get_str_section (abfd,
- elf_elfheader (abfd)->e_shstrndx);
- if (shstrtab != NULL)
- {
- max = elf_numsections (abfd);
- for (i = 1; i < max; i++)
- if (!strcmp (&shstrtab[i_shdrp[i]->sh_name], name))
- return i_shdrp[i];
- }
- }
- return 0;
-}
-
-const char *const bfd_elf_section_type_names[] = {
- "SHT_NULL", "SHT_PROGBITS", "SHT_SYMTAB", "SHT_STRTAB",
- "SHT_RELA", "SHT_HASH", "SHT_DYNAMIC", "SHT_NOTE",
- "SHT_NOBITS", "SHT_REL", "SHT_SHLIB", "SHT_DYNSYM",
-};
-
-/* ELF relocs are against symbols. If we are producing relocatable
- output, and the reloc is against an external symbol, and nothing
- has given us any additional addend, the resulting reloc will also
- be against the same symbol. In such a case, we don't want to
- change anything about the way the reloc is handled, since it will
- all be done at final link time. Rather than put special case code
- into bfd_perform_relocation, all the reloc types use this howto
- function. It just short circuits the reloc if producing
- relocatable output against an external symbol. */
-
-bfd_reloc_status_type
-bfd_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *reloc_entry,
- asymbol *symbol,
- void *data ATTRIBUTE_UNUSED,
- asection *input_section,
- bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- return bfd_reloc_continue;
-}
-
-/* Make sure sec_info_type is cleared if sec_info is cleared too. */
-
-static void
-merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec)
-{
- BFD_ASSERT (sec->sec_info_type == ELF_INFO_TYPE_MERGE);
- sec->sec_info_type = ELF_INFO_TYPE_NONE;
-}
-
-/* Finish SHF_MERGE section merging. */
-
-bfd_boolean
-_bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info)
-{
- if (!is_elf_hash_table (info->hash))
- return FALSE;
- if (elf_hash_table (info)->merge_info)
- _bfd_merge_sections (abfd, elf_hash_table (info)->merge_info,
- merge_sections_remove_hook);
- return TRUE;
-}
-
-void
-_bfd_elf_link_just_syms (asection *sec, struct bfd_link_info *info)
-{
- sec->output_section = bfd_abs_section_ptr;
- sec->output_offset = sec->vma;
- if (!is_elf_hash_table (info->hash))
- return;
-
- sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
-}
-
-/* Copy the program header and other data from one object module to
- another. */
-
-bfd_boolean
-_bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
-{
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- BFD_ASSERT (!elf_flags_init (obfd)
- || (elf_elfheader (obfd)->e_flags
- == elf_elfheader (ibfd)->e_flags));
-
- elf_gp (obfd) = elf_gp (ibfd);
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = TRUE;
- return TRUE;
-}
-
-/* Print out the program headers. */
-
-bfd_boolean
-_bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
-{
- FILE *f = farg;
- Elf_Internal_Phdr *p;
- asection *s;
- bfd_byte *dynbuf = NULL;
-
- p = elf_tdata (abfd)->phdr;
- if (p != NULL)
- {
- unsigned int i, c;
-
- fprintf (f, _("\nProgram Header:\n"));
- c = elf_elfheader (abfd)->e_phnum;
- for (i = 0; i < c; i++, p++)
- {
- const char *pt;
- char buf[20];
-
- switch (p->p_type)
- {
- 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;
- case PT_TLS: pt = "TLS"; break;
- case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
- case PT_GNU_STACK: pt = "STACK"; break;
- default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break;
- }
- 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);
- fprintf (f, " paddr 0x");
- bfd_fprintf_vma (abfd, f, p->p_paddr);
- fprintf (f, " align 2**%u\n", bfd_log2 (p->p_align));
- fprintf (f, " filesz 0x");
- bfd_fprintf_vma (abfd, f, p->p_filesz);
- fprintf (f, " memsz 0x");
- bfd_fprintf_vma (abfd, f, p->p_memsz);
- fprintf (f, " flags %c%c%c",
- (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 &~ (unsigned) (PF_R | PF_W | PF_X)) != 0)
- fprintf (f, " %lx", p->p_flags &~ (unsigned) (PF_R | PF_W | PF_X));
- fprintf (f, "\n");
- }
- }
-
- s = bfd_get_section_by_name (abfd, ".dynamic");
- if (s != NULL)
- {
- int elfsec;
- unsigned long shlink;
- bfd_byte *extdyn, *extdynend;
- size_t extdynsize;
- void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *);
-
- fprintf (f, _("\nDynamic Section:\n"));
-
- dynbuf = bfd_malloc (s->_raw_size);
- if (dynbuf == NULL)
- goto error_return;
- if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size))
- goto error_return;
-
- elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
- if (elfsec == -1)
- goto error_return;
- 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;
-
- extdyn = dynbuf;
- extdynend = extdyn + s->_raw_size;
- for (; extdyn < extdynend; extdyn += extdynsize)
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- char ab[20];
- bfd_boolean stringp;
-
- (*swap_dyn_in) (abfd, extdyn, &dyn);
-
- if (dyn.d_tag == DT_NULL)
- break;
-
- stringp = FALSE;
- switch (dyn.d_tag)
- {
- default:
- sprintf (ab, "0x%lx", (unsigned long) dyn.d_tag);
- name = ab;
- break;
-
- case DT_NEEDED: name = "NEEDED"; stringp = TRUE; break;
- case DT_PLTRELSZ: name = "PLTRELSZ"; break;
- case DT_PLTGOT: name = "PLTGOT"; break;
- case DT_HASH: name = "HASH"; break;
- case DT_STRTAB: name = "STRTAB"; break;
- case DT_SYMTAB: name = "SYMTAB"; break;
- case DT_RELA: name = "RELA"; break;
- case DT_RELASZ: name = "RELASZ"; break;
- case DT_RELAENT: name = "RELAENT"; break;
- case DT_STRSZ: name = "STRSZ"; break;
- case DT_SYMENT: name = "SYMENT"; break;
- case DT_INIT: name = "INIT"; break;
- case DT_FINI: name = "FINI"; break;
- case DT_SONAME: name = "SONAME"; stringp = TRUE; break;
- case DT_RPATH: name = "RPATH"; stringp = TRUE; break;
- case DT_SYMBOLIC: name = "SYMBOLIC"; break;
- case DT_REL: name = "REL"; break;
- case DT_RELSZ: name = "RELSZ"; break;
- case DT_RELENT: name = "RELENT"; break;
- case DT_PLTREL: name = "PLTREL"; break;
- case DT_DEBUG: name = "DEBUG"; break;
- case DT_TEXTREL: name = "TEXTREL"; break;
- case DT_JMPREL: name = "JMPREL"; break;
- case DT_BIND_NOW: name = "BIND_NOW"; break;
- case DT_INIT_ARRAY: name = "INIT_ARRAY"; break;
- case DT_FINI_ARRAY: name = "FINI_ARRAY"; break;
- case DT_INIT_ARRAYSZ: name = "INIT_ARRAYSZ"; break;
- case DT_FINI_ARRAYSZ: name = "FINI_ARRAYSZ"; break;
- case DT_RUNPATH: name = "RUNPATH"; stringp = TRUE; break;
- case DT_FLAGS: name = "FLAGS"; break;
- case DT_PREINIT_ARRAY: name = "PREINIT_ARRAY"; break;
- case DT_PREINIT_ARRAYSZ: name = "PREINIT_ARRAYSZ"; break;
- case DT_CHECKSUM: name = "CHECKSUM"; break;
- case DT_PLTPADSZ: name = "PLTPADSZ"; break;
- case DT_MOVEENT: name = "MOVEENT"; break;
- case DT_MOVESZ: name = "MOVESZ"; break;
- case DT_FEATURE: name = "FEATURE"; break;
- case DT_POSFLAG_1: name = "POSFLAG_1"; break;
- case DT_SYMINSZ: name = "SYMINSZ"; break;
- case DT_SYMINENT: name = "SYMINENT"; break;
- case DT_CONFIG: name = "CONFIG"; stringp = TRUE; break;
- case DT_DEPAUDIT: name = "DEPAUDIT"; stringp = TRUE; break;
- case DT_AUDIT: name = "AUDIT"; stringp = TRUE; break;
- case DT_PLTPAD: name = "PLTPAD"; break;
- case DT_MOVETAB: name = "MOVETAB"; break;
- case DT_SYMINFO: name = "SYMINFO"; break;
- case DT_RELACOUNT: name = "RELACOUNT"; break;
- case DT_RELCOUNT: name = "RELCOUNT"; break;
- case DT_FLAGS_1: name = "FLAGS_1"; break;
- case DT_VERSYM: name = "VERSYM"; break;
- case DT_VERDEF: name = "VERDEF"; break;
- case DT_VERDEFNUM: name = "VERDEFNUM"; break;
- case DT_VERNEED: name = "VERNEED"; break;
- case DT_VERNEEDNUM: name = "VERNEEDNUM"; break;
- case DT_AUXILIARY: name = "AUXILIARY"; stringp = TRUE; break;
- case DT_USED: name = "USED"; break;
- case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
- }
-
- fprintf (f, " %-11s ", name);
- if (! stringp)
- fprintf (f, "0x%lx", (unsigned long) dyn.d_un.d_val);
- else
- {
- const char *string;
- unsigned int tagv = 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);
- }
- fprintf (f, "\n");
- }
-
- free (dynbuf);
- dynbuf = NULL;
- }
-
- if ((elf_dynverdef (abfd) != 0 && elf_tdata (abfd)->verdef == NULL)
- || (elf_dynverref (abfd) != 0 && elf_tdata (abfd)->verref == NULL))
- {
- if (! _bfd_elf_slurp_version_tables (abfd))
- return FALSE;
- }
-
- if (elf_dynverdef (abfd) != 0)
- {
- Elf_Internal_Verdef *t;
-
- fprintf (f, _("\nVersion definitions:\n"));
- for (t = elf_tdata (abfd)->verdef; t != NULL; t = t->vd_nextdef)
- {
- fprintf (f, "%d 0x%2.2x 0x%8.8lx %s\n", t->vd_ndx,
- t->vd_flags, t->vd_hash, t->vd_nodename);
- if (t->vd_auxptr->vda_nextptr != NULL)
- {
- Elf_Internal_Verdaux *a;
-
- fprintf (f, "\t");
- for (a = t->vd_auxptr->vda_nextptr;
- a != NULL;
- a = a->vda_nextptr)
- fprintf (f, "%s ", a->vda_nodename);
- fprintf (f, "\n");
- }
- }
- }
-
- if (elf_dynverref (abfd) != 0)
- {
- Elf_Internal_Verneed *t;
-
- fprintf (f, _("\nVersion References:\n"));
- for (t = elf_tdata (abfd)->verref; t != NULL; t = t->vn_nextref)
- {
- Elf_Internal_Vernaux *a;
-
- fprintf (f, _(" required from %s:\n"), t->vn_filename);
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- fprintf (f, " 0x%8.8lx 0x%2.2x %2.2d %s\n", a->vna_hash,
- a->vna_flags, a->vna_other, a->vna_nodename);
- }
- }
-
- return TRUE;
-
- error_return:
- if (dynbuf != NULL)
- free (dynbuf);
- return FALSE;
-}
-
-/* Display ELF-specific fields of a symbol. */
-
-void
-bfd_elf_print_symbol (bfd *abfd,
- void *filep,
- asymbol *symbol,
- bfd_print_symbol_type how)
-{
- FILE *file = filep;
- switch (how)
- {
- case bfd_print_symbol_name:
- fprintf (file, "%s", symbol->name);
- break;
- case bfd_print_symbol_more:
- fprintf (file, "elf ");
- bfd_fprintf_vma (abfd, file, symbol->value);
- fprintf (file, " %lx", (long) symbol->flags);
- break;
- case bfd_print_symbol_all:
- {
- const char *section_name;
- const char *name = NULL;
- const struct elf_backend_data *bed;
- unsigned char st_other;
- bfd_vma val;
-
- section_name = symbol->section ? symbol->section->name : "(*none*)";
-
- bed = get_elf_backend_data (abfd);
- if (bed->elf_backend_print_symbol_all)
- name = (*bed->elf_backend_print_symbol_all) (abfd, filep, symbol);
-
- if (name == NULL)
- {
- name = symbol->name;
- bfd_print_symbol_vandf (abfd, file, symbol);
- }
-
- fprintf (file, " %s\t", section_name);
- /* Print the "other" value for a symbol. For common symbols,
- we've already printed the size; now print the alignment.
- For other symbols, we have no specified alignment, and
- we've printed the address; now print the size. */
- if (bfd_is_com_section (symbol->section))
- val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_value;
- else
- val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_size;
- bfd_fprintf_vma (abfd, file, val);
-
- /* If we have version information, print it. */
- if (elf_tdata (abfd)->dynversym_section != 0
- && (elf_tdata (abfd)->dynverdef_section != 0
- || elf_tdata (abfd)->dynverref_section != 0))
- {
- unsigned int vernum;
- const char *version_string;
-
- vernum = ((elf_symbol_type *) symbol)->version & VERSYM_VERSION;
-
- if (vernum == 0)
- version_string = "";
- else if (vernum == 1)
- version_string = "Base";
- else if (vernum <= elf_tdata (abfd)->cverdefs)
- version_string =
- elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
- else
- {
- Elf_Internal_Verneed *t;
-
- version_string = "";
- for (t = elf_tdata (abfd)->verref;
- t != NULL;
- t = t->vn_nextref)
- {
- Elf_Internal_Vernaux *a;
-
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- {
- if (a->vna_other == vernum)
- {
- version_string = a->vna_nodename;
- break;
- }
- }
- }
- }
-
- if ((((elf_symbol_type *) symbol)->version & VERSYM_HIDDEN) == 0)
- fprintf (file, " %-11s", version_string);
- else
- {
- int i;
-
- fprintf (file, " (%s)", version_string);
- for (i = 10 - strlen (version_string); i > 0; --i)
- putc (' ', file);
- }
- }
-
- /* If the st_other field is not zero, print it. */
- st_other = ((elf_symbol_type *) symbol)->internal_elf_sym.st_other;
-
- switch (st_other)
- {
- case 0: break;
- case STV_INTERNAL: fprintf (file, " .internal"); break;
- case STV_HIDDEN: fprintf (file, " .hidden"); break;
- case STV_PROTECTED: fprintf (file, " .protected"); break;
- default:
- /* Some other non-defined flags are also present, so print
- everything hex. */
- fprintf (file, " 0x%02x", (unsigned int) st_other);
- }
-
- fprintf (file, " %s", name);
- }
- break;
- }
-}
-
-/* Create an entry in an ELF linker hash table. */
-
-struct bfd_hash_entry *
-_bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct elf_link_hash_entry *ret = (struct elf_link_hash_entry *) entry;
- struct elf_link_hash_table *htab = (struct elf_link_hash_table *) table;
-
- /* Set local fields. */
- ret->indx = -1;
- ret->dynindx = -1;
- ret->dynstr_index = 0;
- ret->elf_hash_value = 0;
- ret->weakdef = NULL;
- ret->verinfo.verdef = NULL;
- ret->vtable_entries_size = 0;
- ret->vtable_entries_used = NULL;
- ret->vtable_parent = NULL;
- ret->got = htab->init_refcount;
- ret->plt = htab->init_refcount;
- ret->size = 0;
- ret->type = STT_NOTYPE;
- ret->other = 0;
- /* Assume that we have been called by a non-ELF symbol reader.
- This flag is then reset by the code which reads an ELF input
- file. This ensures that a symbol created by a non-ELF symbol
- reader will have the flag set correctly. */
- ret->elf_link_hash_flags = ELF_LINK_NON_ELF;
- }
-
- return entry;
-}
-
-/* Copy data from an indirect symbol to its direct symbol, hiding the
- old indirect symbol. Also used for copying flags to a weakdef. */
-
-void
-_bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed,
- struct elf_link_hash_entry *dir,
- struct elf_link_hash_entry *ind)
-{
- bfd_signed_vma tmp;
- bfd_signed_vma lowest_valid = bed->can_refcount;
-
- /* Copy down any references that we may have already seen to the
- symbol which just became indirect. */
-
- dir->elf_link_hash_flags
- |= ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_NON_GOT_REF
- | ELF_LINK_HASH_NEEDS_PLT
- | ELF_LINK_POINTER_EQUALITY_NEEDED);
-
- if (ind->root.type != bfd_link_hash_indirect)
- return;
-
- /* Copy over the global and procedure linkage table refcount entries.
- These may have been already set up by a check_relocs routine. */
- tmp = dir->got.refcount;
- if (tmp < lowest_valid)
- {
- dir->got.refcount = ind->got.refcount;
- ind->got.refcount = tmp;
- }
- else
- BFD_ASSERT (ind->got.refcount < lowest_valid);
-
- tmp = dir->plt.refcount;
- if (tmp < lowest_valid)
- {
- dir->plt.refcount = ind->plt.refcount;
- ind->plt.refcount = tmp;
- }
- else
- BFD_ASSERT (ind->plt.refcount < lowest_valid);
-
- if (dir->dynindx == -1)
- {
- dir->dynindx = ind->dynindx;
- dir->dynstr_index = ind->dynstr_index;
- ind->dynindx = -1;
- ind->dynstr_index = 0;
- }
- else
- BFD_ASSERT (ind->dynindx == -1);
-}
-
-void
-_bfd_elf_link_hash_hide_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- bfd_boolean force_local)
-{
- h->plt = elf_hash_table (info)->init_offset;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- if (force_local)
- {
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- if (h->dynindx != -1)
- {
- h->dynindx = -1;
- _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
- h->dynstr_index);
- }
- }
-}
-
-/* Initialize an ELF linker hash table. */
-
-bfd_boolean
-_bfd_elf_link_hash_table_init
- (struct elf_link_hash_table *table,
- bfd *abfd,
- struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *))
-{
- bfd_boolean ret;
-
- table->dynamic_sections_created = FALSE;
- table->dynobj = NULL;
- /* Make sure can_refcount is extended to the width and signedness of
- init_refcount before we subtract one from it. */
- table->init_refcount.refcount = get_elf_backend_data (abfd)->can_refcount;
- table->init_refcount.refcount -= 1;
- table->init_offset.offset = -(bfd_vma) 1;
- /* The first dynamic symbol is a dummy. */
- table->dynsymcount = 1;
- table->dynstr = NULL;
- table->bucketcount = 0;
- table->needed = NULL;
- table->hgot = NULL;
- table->stab_info = NULL;
- table->merge_info = NULL;
- memset (&table->eh_info, 0, sizeof (table->eh_info));
- table->dynlocal = NULL;
- table->runpath = NULL;
- table->tls_sec = NULL;
- table->tls_size = 0;
- table->loaded = NULL;
-
- ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc);
- table->root.type = bfd_link_elf_hash_table;
-
- return ret;
-}
-
-/* Create an ELF linker hash table. */
-
-struct bfd_link_hash_table *
-_bfd_elf_link_hash_table_create (bfd *abfd)
-{
- struct elf_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf_link_hash_table);
-
- ret = bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- return &ret->root;
-}
-
-/* This is a hook for the ELF emulation code in the generic linker to
- tell the backend linker what file name to use for the DT_NEEDED
- entry for a dynamic object. */
-
-void
-bfd_elf_set_dt_needed_name (bfd *abfd, const char *name)
-{
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_get_format (abfd) == bfd_object)
- elf_dt_name (abfd) = name;
-}
-
-void
-bfd_elf_set_dyn_lib_class (bfd *abfd, int lib_class)
-{
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_get_format (abfd) == bfd_object)
- elf_dyn_lib_class (abfd) = lib_class;
-}
-
-/* Get the list of DT_NEEDED entries for a link. This is a hook for
- the linker ELF emulation code. */
-
-struct bfd_link_needed_list *
-bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- if (! is_elf_hash_table (info->hash))
- return NULL;
- return elf_hash_table (info)->needed;
-}
-
-/* Get the list of DT_RPATH/DT_RUNPATH entries for a link. This is a
- hook for the linker ELF emulation code. */
-
-struct bfd_link_needed_list *
-bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- if (! is_elf_hash_table (info->hash))
- return NULL;
- return elf_hash_table (info)->runpath;
-}
-
-/* Get the name actually used for a dynamic object for a link. This
- is the SONAME entry if there is one. Otherwise, it is the string
- passed to bfd_elf_set_dt_needed_name, or it is the filename. */
-
-const char *
-bfd_elf_get_dt_soname (bfd *abfd)
-{
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_get_format (abfd) == bfd_object)
- return elf_dt_name (abfd);
- return NULL;
-}
-
-/* Get the list of DT_NEEDED entries from a BFD. This is a hook for
- the ELF linker emulation code. */
-
-bfd_boolean
-bfd_elf_get_bfd_needed_list (bfd *abfd,
- struct bfd_link_needed_list **pneeded)
-{
- asection *s;
- bfd_byte *dynbuf = NULL;
- int elfsec;
- unsigned long shlink;
- bfd_byte *extdyn, *extdynend;
- size_t extdynsize;
- void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *);
-
- *pneeded = NULL;
-
- if (bfd_get_flavour (abfd) != bfd_target_elf_flavour
- || bfd_get_format (abfd) != bfd_object)
- return TRUE;
-
- s = bfd_get_section_by_name (abfd, ".dynamic");
- if (s == NULL || s->_raw_size == 0)
- return TRUE;
-
- dynbuf = bfd_malloc (s->_raw_size);
- if (dynbuf == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size))
- goto error_return;
-
- elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
- if (elfsec == -1)
- goto error_return;
-
- 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;
-
- extdyn = dynbuf;
- extdynend = extdyn + s->_raw_size;
- for (; extdyn < extdynend; extdyn += extdynsize)
- {
- Elf_Internal_Dyn dyn;
-
- (*swap_dyn_in) (abfd, extdyn, &dyn);
-
- if (dyn.d_tag == DT_NULL)
- break;
-
- if (dyn.d_tag == DT_NEEDED)
- {
- 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, shlink, tagv);
- if (string == NULL)
- goto error_return;
-
- amt = sizeof *l;
- l = bfd_alloc (abfd, amt);
- if (l == NULL)
- goto error_return;
-
- l->by = abfd;
- l->name = string;
- l->next = *pneeded;
- *pneeded = l;
- }
- }
-
- free (dynbuf);
-
- return TRUE;
-
- error_return:
- if (dynbuf != NULL)
- free (dynbuf);
- return FALSE;
-}
-
-/* Allocate an ELF string table--force the first byte to be zero. */
-
-struct bfd_strtab_hash *
-_bfd_elf_stringtab_init (void)
-{
- struct bfd_strtab_hash *ret;
-
- ret = _bfd_stringtab_init ();
- if (ret != NULL)
- {
- bfd_size_type loc;
-
- loc = _bfd_stringtab_add (ret, "", TRUE, FALSE);
- BFD_ASSERT (loc == 0 || loc == (bfd_size_type) -1);
- if (loc == (bfd_size_type) -1)
- {
- _bfd_stringtab_free (ret);
- ret = NULL;
- }
- }
- return ret;
-}
-
-/* ELF .o/exec file reading */
-
-/* Create a new bfd section from an ELF section header. */
-
-bfd_boolean
-bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
-{
- Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[shindex];
- Elf_Internal_Ehdr *ehdr = elf_elfheader (abfd);
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- const char *name;
-
- name = elf_string_from_elf_strtab (abfd, hdr->sh_name);
-
- switch (hdr->sh_type)
- {
- case SHT_NULL:
- /* Inactive section. Throw it away. */
- return TRUE;
-
- case SHT_PROGBITS: /* Normal section with contents. */
- case SHT_NOBITS: /* .bss section. */
- case SHT_HASH: /* .hash section. */
- case SHT_NOTE: /* .note section. */
- case SHT_INIT_ARRAY: /* .init_array section. */
- case SHT_FINI_ARRAY: /* .fini_array section. */
- case SHT_PREINIT_ARRAY: /* .preinit_array section. */
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
-
- case SHT_DYNAMIC: /* Dynamic linking information. */
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return FALSE;
- if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB)
- {
- Elf_Internal_Shdr *dynsymhdr;
-
- /* The shared libraries distributed with hpux11 have a bogus
- sh_link field for the ".dynamic" section. Find the
- string table for the ".dynsym" section instead. */
- if (elf_dynsymtab (abfd) != 0)
- {
- dynsymhdr = elf_elfsections (abfd)[elf_dynsymtab (abfd)];
- hdr->sh_link = dynsymhdr->sh_link;
- }
- else
- {
- unsigned int i, num_sec;
-
- num_sec = elf_numsections (abfd);
- for (i = 1; i < num_sec; i++)
- {
- dynsymhdr = elf_elfsections (abfd)[i];
- if (dynsymhdr->sh_type == SHT_DYNSYM)
- {
- hdr->sh_link = dynsymhdr->sh_link;
- break;
- }
- }
- }
- }
- break;
-
- case SHT_SYMTAB: /* A symbol table */
- if (elf_onesymtab (abfd) == shindex)
- return TRUE;
-
- BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym);
- BFD_ASSERT (elf_onesymtab (abfd) == 0);
- elf_onesymtab (abfd) = shindex;
- elf_tdata (abfd)->symtab_hdr = *hdr;
- elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->symtab_hdr;
- abfd->flags |= HAS_SYMS;
-
- /* Sometimes a shared object will map in the symbol table. If
- SHF_ALLOC is set, and this is a shared object, then we also
- treat this section as a BFD section. We can not base the
- decision purely on SHF_ALLOC, because that flag is sometimes
- set in a relocatable object file, which would confuse the
- linker. */
- if ((hdr->sh_flags & SHF_ALLOC) != 0
- && (abfd->flags & DYNAMIC) != 0
- && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return FALSE;
-
- return TRUE;
-
- case SHT_DYNSYM: /* A dynamic symbol table */
- if (elf_dynsymtab (abfd) == shindex)
- return TRUE;
-
- BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym);
- BFD_ASSERT (elf_dynsymtab (abfd) == 0);
- elf_dynsymtab (abfd) = shindex;
- elf_tdata (abfd)->dynsymtab_hdr = *hdr;
- elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->dynsymtab_hdr;
- abfd->flags |= HAS_SYMS;
-
- /* Besides being a symbol table, we also treat this as a regular
- section, so that objcopy can handle it. */
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
-
- case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections */
- if (elf_symtab_shndx (abfd) == shindex)
- return TRUE;
-
- /* Get the associated symbol table. */
- if (! bfd_section_from_shdr (abfd, hdr->sh_link)
- || hdr->sh_link != elf_onesymtab (abfd))
- return FALSE;
-
- elf_symtab_shndx (abfd) = shindex;
- elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
- elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr;
- return TRUE;
-
- case SHT_STRTAB: /* A string table */
- if (hdr->bfd_section != NULL)
- return TRUE;
- if (ehdr->e_shstrndx == shindex)
- {
- elf_tdata (abfd)->shstrtab_hdr = *hdr;
- elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr;
- return TRUE;
- }
- {
- unsigned int i, num_sec;
-
- num_sec = elf_numsections (abfd);
- for (i = 1; i < num_sec; i++)
- {
- Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
- if (hdr2->sh_link == shindex)
- {
- if (! bfd_section_from_shdr (abfd, i))
- return FALSE;
- if (elf_onesymtab (abfd) == i)
- {
- elf_tdata (abfd)->strtab_hdr = *hdr;
- elf_elfsections (abfd)[shindex] =
- &elf_tdata (abfd)->strtab_hdr;
- return TRUE;
- }
- if (elf_dynsymtab (abfd) == i)
- {
- elf_tdata (abfd)->dynstrtab_hdr = *hdr;
- elf_elfsections (abfd)[shindex] = hdr =
- &elf_tdata (abfd)->dynstrtab_hdr;
- /* We also treat this as a regular section, so
- that objcopy can handle it. */
- break;
- }
-#if 0 /* Not handling other string tables specially right now. */
- hdr2 = elf_elfsections (abfd)[i]; /* in case it moved */
- /* We have a strtab for some random other section. */
- newsect = (asection *) hdr2->bfd_section;
- if (!newsect)
- break;
- hdr->bfd_section = newsect;
- hdr2 = &elf_section_data (newsect)->str_hdr;
- *hdr2 = *hdr;
- elf_elfsections (abfd)[shindex] = hdr2;
-#endif
- }
- }
- }
-
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
-
- case SHT_REL:
- case SHT_RELA:
- /* *These* do a lot of work -- but build no sections! */
- {
- asection *target_sect;
- Elf_Internal_Shdr *hdr2;
- unsigned int num_sec = elf_numsections (abfd);
-
- /* Check for a bogus link to avoid crashing. */
- if ((hdr->sh_link >= SHN_LORESERVE && hdr->sh_link <= SHN_HIRESERVE)
- || hdr->sh_link >= num_sec)
- {
- ((*_bfd_error_handler)
- (_("%s: invalid link %lu for reloc section %s (index %u)"),
- bfd_archive_filename (abfd), hdr->sh_link, name, shindex));
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
- }
-
- /* For some incomprehensible reason Oracle distributes
- libraries for Solaris in which some of the objects have
- bogus sh_link fields. It would be nice if we could just
- reject them, but, unfortunately, some people need to use
- them. We scan through the section headers; if we find only
- one suitable symbol table, we clobber the sh_link to point
- to it. I hope this doesn't break anything. */
- if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_SYMTAB
- && elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_DYNSYM)
- {
- unsigned int scan;
- int found;
-
- found = 0;
- for (scan = 1; scan < num_sec; scan++)
- {
- if (elf_elfsections (abfd)[scan]->sh_type == SHT_SYMTAB
- || elf_elfsections (abfd)[scan]->sh_type == SHT_DYNSYM)
- {
- if (found != 0)
- {
- found = 0;
- break;
- }
- found = scan;
- }
- }
- if (found != 0)
- hdr->sh_link = found;
- }
-
- /* Get the symbol table. */
- if (elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB
- && ! bfd_section_from_shdr (abfd, hdr->sh_link))
- return FALSE;
-
- /* If this reloc section does not use the main symbol table we
- don't treat it as a reloc section. BFD can't adequately
- represent such a section, so at least for now, we don't
- try. We just present it as a normal section. We also
- can't use it as a reloc section if it points to the null
- section. */
- if (hdr->sh_link != elf_onesymtab (abfd) || hdr->sh_info == SHN_UNDEF)
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
-
- if (! bfd_section_from_shdr (abfd, hdr->sh_info))
- return FALSE;
- target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info);
- if (target_sect == NULL)
- return FALSE;
-
- if ((target_sect->flags & SEC_RELOC) == 0
- || target_sect->reloc_count == 0)
- hdr2 = &elf_section_data (target_sect)->rel_hdr;
- else
- {
- bfd_size_type amt;
- BFD_ASSERT (elf_section_data (target_sect)->rel_hdr2 == NULL);
- amt = sizeof (*hdr2);
- hdr2 = bfd_alloc (abfd, amt);
- elf_section_data (target_sect)->rel_hdr2 = hdr2;
- }
- *hdr2 = *hdr;
- elf_elfsections (abfd)[shindex] = hdr2;
- target_sect->reloc_count += NUM_SHDR_ENTRIES (hdr);
- target_sect->flags |= SEC_RELOC;
- target_sect->relocation = NULL;
- target_sect->rel_filepos = hdr->sh_offset;
- /* In the section to which the relocations apply, mark whether
- its relocations are of the REL or RELA variety. */
- if (hdr->sh_size != 0)
- target_sect->use_rela_p = hdr->sh_type == SHT_RELA;
- abfd->flags |= HAS_RELOC;
- return TRUE;
- }
- break;
-
- case SHT_GNU_verdef:
- elf_dynverdef (abfd) = shindex;
- elf_tdata (abfd)->dynverdef_hdr = *hdr;
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
- break;
-
- case SHT_GNU_versym:
- elf_dynversym (abfd) = shindex;
- elf_tdata (abfd)->dynversym_hdr = *hdr;
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
- break;
-
- case SHT_GNU_verneed:
- elf_dynverref (abfd) = shindex;
- elf_tdata (abfd)->dynverref_hdr = *hdr;
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
- break;
-
- case SHT_SHLIB:
- return TRUE;
-
- case SHT_GROUP:
- /* We need a BFD section for objcopy and relocatable linking,
- and it's handy to have the signature available as the section
- name. */
- name = group_signature (abfd, hdr);
- if (name == NULL)
- return FALSE;
- if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return FALSE;
- if (hdr->contents != NULL)
- {
- Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
- unsigned int n_elt = hdr->sh_size / 4;
- asection *s;
-
- if (idx->flags & GRP_COMDAT)
- hdr->bfd_section->flags
- |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
-
- while (--n_elt != 0)
- if ((s = (++idx)->shdr->bfd_section) != NULL
- && elf_next_in_group (s) != NULL)
- {
- elf_next_in_group (hdr->bfd_section) = s;
- break;
- }
- }
- break;
-
- default:
- /* Check for any processor-specific section types. */
- {
- if (bed->elf_backend_section_from_shdr)
- (*bed->elf_backend_section_from_shdr) (abfd, hdr, name);
- }
- break;
- }
-
- return TRUE;
-}
-
-/* Return the section for the local symbol specified by ABFD, R_SYMNDX.
- Return SEC for sections that have no elf section, and NULL on error. */
-
-asection *
-bfd_section_from_r_symndx (bfd *abfd,
- struct sym_sec_cache *cache,
- asection *sec,
- unsigned long r_symndx)
-{
- Elf_Internal_Shdr *symtab_hdr;
- unsigned char esym[sizeof (Elf64_External_Sym)];
- Elf_External_Sym_Shndx eshndx;
- Elf_Internal_Sym isym;
- unsigned int ent = r_symndx % LOCAL_SYM_CACHE_SIZE;
-
- if (cache->abfd == abfd && cache->indx[ent] == r_symndx)
- return cache->sec[ent];
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- if (bfd_elf_get_elf_syms (abfd, symtab_hdr, 1, r_symndx,
- &isym, esym, &eshndx) == NULL)
- return NULL;
-
- if (cache->abfd != abfd)
- {
- memset (cache->indx, -1, sizeof (cache->indx));
- cache->abfd = abfd;
- }
- cache->indx[ent] = r_symndx;
- cache->sec[ent] = sec;
- if ((isym.st_shndx != SHN_UNDEF && isym.st_shndx < SHN_LORESERVE)
- || isym.st_shndx > SHN_HIRESERVE)
- {
- asection *s;
- s = bfd_section_from_elf_index (abfd, isym.st_shndx);
- if (s != NULL)
- cache->sec[ent] = s;
- }
- return cache->sec[ent];
-}
-
-/* Given an ELF section number, retrieve the corresponding BFD
- section. */
-
-asection *
-bfd_section_from_elf_index (bfd *abfd, unsigned int index)
-{
- if (index >= elf_numsections (abfd))
- return NULL;
- return elf_elfsections (abfd)[index]->bfd_section;
-}
-
-static struct bfd_elf_special_section const special_sections[] =
-{
- { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".comment", 8, 0, SHT_PROGBITS, 0 },
- { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".debug", 6, 0, SHT_PROGBITS, 0 },
- { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".line", 5, 0, SHT_PROGBITS, 0 },
- { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
- { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
- { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
- { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
- { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
- { ".debug_line", 11, 0, SHT_PROGBITS, 0 },
- { ".debug_info", 11, 0, SHT_PROGBITS, 0 },
- { ".debug_abbrev", 13, 0, SHT_PROGBITS, 0 },
- { ".debug_aranges", 14, 0, SHT_PROGBITS, 0 },
- { ".dynamic", 8, 0, SHT_DYNAMIC, SHF_ALLOC },
- { ".dynstr", 7, 0, SHT_STRTAB, SHF_ALLOC },
- { ".dynsym", 7, 0, SHT_DYNSYM, SHF_ALLOC },
- { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".hash", 5, 0, SHT_HASH, SHF_ALLOC },
- { ".interp", 7, 0, SHT_PROGBITS, 0 },
- { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".shstrtab", 9, 0, SHT_STRTAB, 0 },
- { ".strtab", 7, 0, SHT_STRTAB, 0 },
- { ".symtab", 7, 0, SHT_SYMTAB, 0 },
- { ".gnu.version", 12, 0, SHT_GNU_versym, 0 },
- { ".gnu.version_d", 14, 0, SHT_GNU_verdef, 0 },
- { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 },
- { ".note", 5, -1, SHT_NOTE, 0 },
- { ".rela", 5, -1, SHT_RELA, 0 },
- { ".rel", 4, -1, SHT_REL, 0 },
- { ".stabstr", 5, 3, SHT_STRTAB, 0 },
- { NULL, 0, 0, 0, 0 }
-};
-
-static const struct bfd_elf_special_section *
-get_special_section (const char *name,
- const struct bfd_elf_special_section *special_sections,
- unsigned int rela)
-{
- int i;
- int len = strlen (name);
-
- for (i = 0; special_sections[i].prefix != NULL; i++)
- {
- int suffix_len;
- int prefix_len = special_sections[i].prefix_length;
-
- if (len < prefix_len)
- continue;
- if (memcmp (name, special_sections[i].prefix, prefix_len) != 0)
- continue;
-
- suffix_len = special_sections[i].suffix_length;
- if (suffix_len <= 0)
- {
- if (name[prefix_len] != 0)
- {
- if (suffix_len == 0)
- continue;
- if (name[prefix_len] != '.'
- && (suffix_len == -2
- || (rela && special_sections[i].type == SHT_REL)))
- continue;
- }
- }
- else
- {
- if (len < prefix_len + suffix_len)
- continue;
- if (memcmp (name + len - suffix_len,
- special_sections[i].prefix + prefix_len,
- suffix_len) != 0)
- continue;
- }
- return &special_sections[i];
- }
-
- return NULL;
-}
-
-const struct bfd_elf_special_section *
-_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- const struct bfd_elf_special_section *ssect = NULL;
-
- /* See if this is one of the special sections. */
- if (name)
- {
- unsigned int rela = bed->default_use_rela_p;
-
- if (bed->special_sections)
- ssect = get_special_section (name, bed->special_sections, rela);
-
- if (! ssect)
- ssect = get_special_section (name, special_sections, rela);
- }
-
- return ssect;
-}
-
-bfd_boolean
-_bfd_elf_new_section_hook (bfd *abfd, asection *sec)
-{
- struct bfd_elf_section_data *sdata;
- const struct bfd_elf_special_section *ssect;
-
- sdata = (struct bfd_elf_section_data *) sec->used_by_bfd;
- if (sdata == NULL)
- {
- sdata = bfd_zalloc (abfd, sizeof (*sdata));
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = sdata;
- }
-
- elf_section_type (sec) = SHT_NULL;
- ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name);
- if (ssect != NULL)
- {
- elf_section_type (sec) = ssect->type;
- elf_section_flags (sec) = ssect->attr;
- }
-
- /* Indicate whether or not this section should use RELA relocations. */
- sec->use_rela_p = get_elf_backend_data (abfd)->default_use_rela_p;
-
- return TRUE;
-}
-
-/* Create a new bfd section from an ELF program header.
-
- Since program segments have no names, we generate a synthetic name
- of the form segment<NUM>, where NUM is generally the index in the
- program header table. For segments that are split (see below) we
- generate the names segment<NUM>a and segment<NUM>b.
-
- Note that some program segments may have a file size that is different than
- (less than) the memory size. All this means is that at execution the
- system must allocate the amount of memory specified by the memory size,
- but only initialize it with the first "file size" bytes read from the
- file. This would occur for example, with program segments consisting
- of combined data+bss.
-
- To handle the above situation, this routine generates TWO bfd sections
- for the single program segment. The first has the length specified by
- the file size of the segment, and the second has the length specified
- by the difference between the two sizes. In effect, the segment is split
- into it's initialized and uninitialized parts.
-
- */
-
-bfd_boolean
-_bfd_elf_make_section_from_phdr (bfd *abfd,
- Elf_Internal_Phdr *hdr,
- int index,
- const char *typename)
-{
- asection *newsect;
- char *name;
- char namebuf[64];
- size_t len;
- int split;
-
- split = ((hdr->p_memsz > 0)
- && (hdr->p_filesz > 0)
- && (hdr->p_memsz > hdr->p_filesz));
- sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
- len = strlen (namebuf) + 1;
- name = bfd_alloc (abfd, len);
- if (!name)
- return FALSE;
- memcpy (name, namebuf, len);
- newsect = bfd_make_section (abfd, name);
- if (newsect == NULL)
- return FALSE;
- newsect->vma = hdr->p_vaddr;
- newsect->lma = hdr->p_paddr;
- newsect->_raw_size = hdr->p_filesz;
- newsect->filepos = hdr->p_offset;
- newsect->flags |= SEC_HAS_CONTENTS;
- newsect->alignment_power = bfd_log2 (hdr->p_align);
- if (hdr->p_type == PT_LOAD)
- {
- newsect->flags |= SEC_ALLOC;
- newsect->flags |= SEC_LOAD;
- if (hdr->p_flags & PF_X)
- {
- /* FIXME: all we known is that it has execute PERMISSION,
- may be data. */
- newsect->flags |= SEC_CODE;
- }
- }
- if (!(hdr->p_flags & PF_W))
- {
- newsect->flags |= SEC_READONLY;
- }
-
- if (split)
- {
- sprintf (namebuf, "%s%db", typename, index);
- len = strlen (namebuf) + 1;
- name = bfd_alloc (abfd, len);
- if (!name)
- return FALSE;
- memcpy (name, namebuf, len);
- newsect = bfd_make_section (abfd, name);
- if (newsect == NULL)
- return FALSE;
- newsect->vma = hdr->p_vaddr + hdr->p_filesz;
- newsect->lma = hdr->p_paddr + hdr->p_filesz;
- newsect->_raw_size = hdr->p_memsz - hdr->p_filesz;
- if (hdr->p_type == PT_LOAD)
- {
- newsect->flags |= SEC_ALLOC;
- if (hdr->p_flags & PF_X)
- newsect->flags |= SEC_CODE;
- }
- if (!(hdr->p_flags & PF_W))
- newsect->flags |= SEC_READONLY;
- }
-
- return TRUE;
-}
-
-bfd_boolean
-bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
-{
- const struct elf_backend_data *bed;
-
- switch (hdr->p_type)
- {
- case PT_NULL:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "null");
-
- case PT_LOAD:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "load");
-
- case PT_DYNAMIC:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "dynamic");
-
- case PT_INTERP:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "interp");
-
- 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))
- return FALSE;
- return TRUE;
-
- case PT_SHLIB:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "shlib");
-
- case PT_PHDR:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "phdr");
-
- case PT_GNU_EH_FRAME:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index,
- "eh_frame_hdr");
-
- case PT_GNU_STACK:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "stack");
-
- default:
- /* Check for any processor-specific program segment types.
- If no handler for them, default to making "segment" sections. */
- bed = get_elf_backend_data (abfd);
- if (bed->elf_backend_section_from_phdr)
- return (*bed->elf_backend_section_from_phdr) (abfd, hdr, index);
- else
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "segment");
- }
-}
-
-/* Initialize REL_HDR, the section-header for new section, containing
- relocations against ASECT. If USE_RELA_P is TRUE, we use RELA
- relocations; otherwise, we use REL relocations. */
-
-bfd_boolean
-_bfd_elf_init_reloc_shdr (bfd *abfd,
- Elf_Internal_Shdr *rel_hdr,
- asection *asect,
- bfd_boolean use_rela_p)
-{
- char *name;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_size_type amt = 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);
- rel_hdr->sh_name =
- (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), name,
- FALSE);
- if (rel_hdr->sh_name == (unsigned int) -1)
- return FALSE;
- rel_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL;
- rel_hdr->sh_entsize = (use_rela_p
- ? bed->s->sizeof_rela
- : bed->s->sizeof_rel);
- rel_hdr->sh_addralign = 1 << bed->s->log_file_align;
- rel_hdr->sh_flags = 0;
- rel_hdr->sh_addr = 0;
- rel_hdr->sh_size = 0;
- rel_hdr->sh_offset = 0;
-
- return TRUE;
-}
-
-/* Set up an ELF internal section header for a section. */
-
-static void
-elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_boolean *failedptr = failedptrarg;
- Elf_Internal_Shdr *this_hdr;
-
- if (*failedptr)
- {
- /* We already failed; just get out of the bfd_map_over_sections
- loop. */
- return;
- }
-
- this_hdr = &elf_section_data (asect)->this_hdr;
-
- this_hdr->sh_name = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
- asect->name, FALSE);
- if (this_hdr->sh_name == (unsigned int) -1)
- {
- *failedptr = TRUE;
- return;
- }
-
- this_hdr->sh_flags = 0;
-
- if ((asect->flags & SEC_ALLOC) != 0
- || asect->user_set_vma)
- this_hdr->sh_addr = asect->vma;
- else
- this_hdr->sh_addr = 0;
-
- this_hdr->sh_offset = 0;
- this_hdr->sh_size = asect->_raw_size;
- this_hdr->sh_link = 0;
- this_hdr->sh_addralign = 1 << asect->alignment_power;
- /* The sh_entsize and sh_info fields may have been set already by
- copy_private_section_data. */
-
- this_hdr->bfd_section = asect;
- this_hdr->contents = NULL;
-
- /* If the section type is unspecified, we set it based on
- asect->flags. */
- if (this_hdr->sh_type == SHT_NULL)
- {
- if ((asect->flags & SEC_ALLOC) != 0
- && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
- || (asect->flags & SEC_NEVER_LOAD) != 0))
- this_hdr->sh_type = SHT_NOBITS;
- else
- this_hdr->sh_type = SHT_PROGBITS;
- }
-
- switch (this_hdr->sh_type)
- {
- default:
- break;
-
- case SHT_STRTAB:
- case SHT_INIT_ARRAY:
- case SHT_FINI_ARRAY:
- case SHT_PREINIT_ARRAY:
- case SHT_NOTE:
- case SHT_NOBITS:
- case SHT_PROGBITS:
- break;
-
- case SHT_HASH:
- this_hdr->sh_entsize = bed->s->sizeof_hash_entry;
- break;
-
- case SHT_DYNSYM:
- this_hdr->sh_entsize = bed->s->sizeof_sym;
- break;
-
- case SHT_DYNAMIC:
- this_hdr->sh_entsize = bed->s->sizeof_dyn;
- break;
-
- case SHT_RELA:
- if (get_elf_backend_data (abfd)->may_use_rela_p)
- this_hdr->sh_entsize = bed->s->sizeof_rela;
- break;
-
- case SHT_REL:
- if (get_elf_backend_data (abfd)->may_use_rel_p)
- this_hdr->sh_entsize = bed->s->sizeof_rel;
- break;
-
- case SHT_GNU_versym:
- this_hdr->sh_entsize = sizeof (Elf_External_Versym);
- break;
-
- case SHT_GNU_verdef:
- this_hdr->sh_entsize = 0;
- /* objcopy or strip will copy over sh_info, but may not set
- cverdefs. The linker will set cverdefs, but sh_info will be
- zero. */
- if (this_hdr->sh_info == 0)
- this_hdr->sh_info = elf_tdata (abfd)->cverdefs;
- else
- BFD_ASSERT (elf_tdata (abfd)->cverdefs == 0
- || this_hdr->sh_info == elf_tdata (abfd)->cverdefs);
- break;
-
- case SHT_GNU_verneed:
- this_hdr->sh_entsize = 0;
- /* objcopy or strip will copy over sh_info, but may not set
- cverrefs. The linker will set cverrefs, but sh_info will be
- zero. */
- if (this_hdr->sh_info == 0)
- this_hdr->sh_info = elf_tdata (abfd)->cverrefs;
- else
- BFD_ASSERT (elf_tdata (abfd)->cverrefs == 0
- || this_hdr->sh_info == elf_tdata (abfd)->cverrefs);
- break;
-
- case SHT_GROUP:
- this_hdr->sh_entsize = 4;
- break;
- }
-
- if ((asect->flags & SEC_ALLOC) != 0)
- this_hdr->sh_flags |= SHF_ALLOC;
- if ((asect->flags & SEC_READONLY) == 0)
- this_hdr->sh_flags |= SHF_WRITE;
- if ((asect->flags & SEC_CODE) != 0)
- this_hdr->sh_flags |= SHF_EXECINSTR;
- if ((asect->flags & SEC_MERGE) != 0)
- {
- this_hdr->sh_flags |= SHF_MERGE;
- this_hdr->sh_entsize = asect->entsize;
- if ((asect->flags & SEC_STRINGS) != 0)
- this_hdr->sh_flags |= SHF_STRINGS;
- }
- if ((asect->flags & SEC_GROUP) == 0 && elf_group_name (asect) != NULL)
- this_hdr->sh_flags |= SHF_GROUP;
- if ((asect->flags & SEC_THREAD_LOCAL) != 0)
- {
- this_hdr->sh_flags |= SHF_TLS;
- if (asect->_raw_size == 0 && (asect->flags & SEC_HAS_CONTENTS) == 0)
- {
- struct bfd_link_order *o;
-
- this_hdr->sh_size = 0;
- for (o = asect->link_order_head; o != NULL; o = o->next)
- if (this_hdr->sh_size < o->offset + o->size)
- this_hdr->sh_size = o->offset + o->size;
- if (this_hdr->sh_size)
- this_hdr->sh_type = SHT_NOBITS;
- }
- }
-
- /* Check for processor-specific section types. */
- if (bed->elf_backend_fake_sections
- && !(*bed->elf_backend_fake_sections) (abfd, this_hdr, asect))
- *failedptr = TRUE;
-
- /* If the section has relocs, set up a section header for the
- SHT_REL[A] section. If two relocation sections are required for
- this section, it is up to the processor-specific back-end to
- create the other. */
- if ((asect->flags & SEC_RELOC) != 0
- && !_bfd_elf_init_reloc_shdr (abfd,
- &elf_section_data (asect)->rel_hdr,
- asect,
- asect->use_rela_p))
- *failedptr = TRUE;
-}
-
-/* Fill in the contents of a SHT_GROUP section. */
-
-void
-bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
-{
- bfd_boolean *failedptr = failedptrarg;
- unsigned long symindx;
- asection *elt, *first;
- unsigned char *loc;
- struct bfd_link_order *l;
- bfd_boolean gas;
-
- if (elf_section_data (sec)->this_hdr.sh_type != SHT_GROUP
- || *failedptr)
- return;
-
- symindx = 0;
- if (elf_group_id (sec) != NULL)
- symindx = elf_group_id (sec)->udata.i;
-
- if (symindx == 0)
- {
- /* If called from the assembler, swap_out_syms will have set up
- elf_section_syms; If called for "ld -r", use target_index. */
- if (elf_section_syms (abfd) != NULL)
- symindx = elf_section_syms (abfd)[sec->index]->udata.i;
- else
- symindx = sec->target_index;
- }
- elf_section_data (sec)->this_hdr.sh_info = symindx;
-
- /* The contents won't be allocated for "ld -r" or objcopy. */
- gas = TRUE;
- if (sec->contents == NULL)
- {
- gas = FALSE;
- sec->contents = bfd_alloc (abfd, sec->_raw_size);
-
- /* Arrange for the section to be written out. */
- elf_section_data (sec)->this_hdr.contents = sec->contents;
- if (sec->contents == NULL)
- {
- *failedptr = TRUE;
- return;
- }
- }
-
- loc = sec->contents + sec->_raw_size;
-
- /* Get the pointer to the first section in the group that gas
- squirreled away here. objcopy arranges for this to be set to the
- start of the input section group. */
- first = elt = elf_next_in_group (sec);
-
- /* First element is a flag word. Rest of section is elf section
- indices for all the sections of the group. Write them backwards
- just to keep the group in the same order as given in .section
- directives, not that it matters. */
- while (elt != NULL)
- {
- asection *s;
- unsigned int idx;
-
- loc -= 4;
- s = elt;
- if (!gas)
- s = s->output_section;
- idx = 0;
- if (s != NULL)
- idx = elf_section_data (s)->this_idx;
- H_PUT_32 (abfd, idx, loc);
- elt = elf_next_in_group (elt);
- if (elt == first)
- break;
- }
-
- /* If this is a relocatable link, then the above did nothing because
- SEC is the output section. Look through the input sections
- instead. */
- for (l = sec->link_order_head; l != NULL; l = l->next)
- if (l->type == bfd_indirect_link_order
- && (elt = elf_next_in_group (l->u.indirect.section)) != NULL)
- do
- {
- loc -= 4;
- H_PUT_32 (abfd,
- elf_section_data (elt->output_section)->this_idx, loc);
- elt = elf_next_in_group (elt);
- /* During a relocatable link, the lists are circular. */
- }
- while (elt != elf_next_in_group (l->u.indirect.section));
-
- /* With ld -r, merging SHT_GROUP sections results in wasted space
- due to allowing for the flag word on each input. We may well
- duplicate entries too. */
- while ((loc -= 4) > sec->contents)
- H_PUT_32 (abfd, 0, loc);
-
- if (loc != sec->contents)
- abort ();
-
- H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
-}
-
-/* Assign all ELF section numbers. The dummy first section is handled here
- too. The link/info pointers for the standard section types are filled
- in here too, while we're at it. */
-
-static bfd_boolean
-assign_section_numbers (bfd *abfd)
-{
- struct elf_obj_tdata *t = elf_tdata (abfd);
- asection *sec;
- unsigned int section_number, secn;
- Elf_Internal_Shdr **i_shdrp;
- bfd_size_type amt;
-
- section_number = 1;
-
- _bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd));
-
- for (sec = abfd->sections; sec; sec = sec->next)
- {
- struct bfd_elf_section_data *d = elf_section_data (sec);
-
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- d->this_idx = section_number++;
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->this_hdr.sh_name);
- if ((sec->flags & SEC_RELOC) == 0)
- d->rel_idx = 0;
- else
- {
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- d->rel_idx = section_number++;
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rel_hdr.sh_name);
- }
-
- if (d->rel_hdr2)
- {
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- d->rel_idx2 = section_number++;
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rel_hdr2->sh_name);
- }
- else
- d->rel_idx2 = 0;
- }
-
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- t->shstrtab_section = section_number++;
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->shstrtab_hdr.sh_name);
- elf_elfheader (abfd)->e_shstrndx = t->shstrtab_section;
-
- if (bfd_get_symcount (abfd) > 0)
- {
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- t->symtab_section = section_number++;
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->symtab_hdr.sh_name);
- if (section_number > SHN_LORESERVE - 2)
- {
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- t->symtab_shndx_section = section_number++;
- t->symtab_shndx_hdr.sh_name
- = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
- ".symtab_shndx", FALSE);
- if (t->symtab_shndx_hdr.sh_name == (unsigned int) -1)
- return FALSE;
- }
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- t->strtab_section = section_number++;
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->strtab_hdr.sh_name);
- }
-
- _bfd_elf_strtab_finalize (elf_shstrtab (abfd));
- t->shstrtab_hdr.sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
-
- elf_numsections (abfd) = section_number;
- elf_elfheader (abfd)->e_shnum = section_number;
- if (section_number > SHN_LORESERVE)
- elf_elfheader (abfd)->e_shnum -= SHN_HIRESERVE + 1 - SHN_LORESERVE;
-
- /* Set up the list of section header pointers, in agreement with the
- indices. */
- amt = section_number * sizeof (Elf_Internal_Shdr *);
- i_shdrp = bfd_zalloc (abfd, amt);
- if (i_shdrp == NULL)
- return FALSE;
-
- amt = sizeof (Elf_Internal_Shdr);
- i_shdrp[0] = bfd_zalloc (abfd, amt);
- if (i_shdrp[0] == NULL)
- {
- bfd_release (abfd, i_shdrp);
- return FALSE;
- }
-
- elf_elfsections (abfd) = i_shdrp;
-
- i_shdrp[t->shstrtab_section] = &t->shstrtab_hdr;
- if (bfd_get_symcount (abfd) > 0)
- {
- i_shdrp[t->symtab_section] = &t->symtab_hdr;
- if (elf_numsections (abfd) > SHN_LORESERVE)
- {
- i_shdrp[t->symtab_shndx_section] = &t->symtab_shndx_hdr;
- t->symtab_shndx_hdr.sh_link = t->symtab_section;
- }
- i_shdrp[t->strtab_section] = &t->strtab_hdr;
- t->symtab_hdr.sh_link = t->strtab_section;
- }
- for (sec = abfd->sections; sec; sec = sec->next)
- {
- struct bfd_elf_section_data *d = elf_section_data (sec);
- asection *s;
- const char *name;
-
- i_shdrp[d->this_idx] = &d->this_hdr;
- if (d->rel_idx != 0)
- i_shdrp[d->rel_idx] = &d->rel_hdr;
- if (d->rel_idx2 != 0)
- i_shdrp[d->rel_idx2] = d->rel_hdr2;
-
- /* Fill in the sh_link and sh_info fields while we're at it. */
-
- /* sh_link of a reloc section is the section index of the symbol
- table. sh_info is the section index of the section to which
- the relocation entries apply. */
- if (d->rel_idx != 0)
- {
- d->rel_hdr.sh_link = t->symtab_section;
- d->rel_hdr.sh_info = d->this_idx;
- }
- if (d->rel_idx2 != 0)
- {
- d->rel_hdr2->sh_link = t->symtab_section;
- d->rel_hdr2->sh_info = d->this_idx;
- }
-
- switch (d->this_hdr.sh_type)
- {
- case SHT_REL:
- case SHT_RELA:
- /* A reloc section which we are treating as a normal BFD
- section. sh_link is the section index of the symbol
- table. sh_info is the section index of the section to
- which the relocation entries apply. We assume that an
- allocated reloc section uses the dynamic symbol table.
- FIXME: How can we be sure? */
- s = bfd_get_section_by_name (abfd, ".dynsym");
- if (s != NULL)
- d->this_hdr.sh_link = elf_section_data (s)->this_idx;
-
- /* We look up the section the relocs apply to by name. */
- name = sec->name;
- if (d->this_hdr.sh_type == SHT_REL)
- name += 4;
- else
- name += 5;
- s = bfd_get_section_by_name (abfd, name);
- if (s != NULL)
- d->this_hdr.sh_info = elf_section_data (s)->this_idx;
- break;
-
- case SHT_STRTAB:
- /* We assume that a section named .stab*str is a stabs
- string section. We look for a section with the same name
- but without the trailing ``str'', and set its sh_link
- field to point to this section. */
- if (strncmp (sec->name, ".stab", sizeof ".stab" - 1) == 0
- && strcmp (sec->name + strlen (sec->name) - 3, "str") == 0)
- {
- size_t len;
- char *alc;
-
- len = strlen (sec->name);
- alc = bfd_malloc (len - 2);
- if (alc == NULL)
- return FALSE;
- memcpy (alc, sec->name, len - 3);
- alc[len - 3] = '\0';
- s = bfd_get_section_by_name (abfd, alc);
- free (alc);
- if (s != NULL)
- {
- elf_section_data (s)->this_hdr.sh_link = d->this_idx;
-
- /* This is a .stab section. */
- if (elf_section_data (s)->this_hdr.sh_entsize == 0)
- elf_section_data (s)->this_hdr.sh_entsize
- = 4 + 2 * bfd_get_arch_size (abfd) / 8;
- }
- }
- break;
-
- case SHT_DYNAMIC:
- case SHT_DYNSYM:
- case SHT_GNU_verneed:
- case SHT_GNU_verdef:
- /* sh_link is the section header index of the string table
- used for the dynamic entries, or the symbol table, or the
- version strings. */
- s = bfd_get_section_by_name (abfd, ".dynstr");
- if (s != NULL)
- d->this_hdr.sh_link = elf_section_data (s)->this_idx;
- break;
-
- case SHT_HASH:
- case SHT_GNU_versym:
- /* sh_link is the section header index of the symbol table
- this hash table or version table is for. */
- s = bfd_get_section_by_name (abfd, ".dynsym");
- if (s != NULL)
- d->this_hdr.sh_link = elf_section_data (s)->this_idx;
- break;
-
- case SHT_GROUP:
- d->this_hdr.sh_link = t->symtab_section;
- }
- }
-
- for (secn = 1; secn < section_number; ++secn)
- if (i_shdrp[secn] == NULL)
- i_shdrp[secn] = i_shdrp[0];
- else
- i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
- i_shdrp[secn]->sh_name);
- return TRUE;
-}
-
-/* Map symbol from it's internal number to the external number, moving
- all local symbols to be at the head of the list. */
-
-static int
-sym_is_global (bfd *abfd, asymbol *sym)
-{
- /* If the backend has a special mapping, use it. */
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- if (bed->elf_backend_sym_is_global)
- return (*bed->elf_backend_sym_is_global) (abfd, sym);
-
- return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (sym))
- || bfd_is_com_section (bfd_get_section (sym)));
-}
-
-static bfd_boolean
-elf_map_symbols (bfd *abfd)
-{
- unsigned int symcount = bfd_get_symcount (abfd);
- asymbol **syms = bfd_get_outsymbols (abfd);
- asymbol **sect_syms;
- unsigned int num_locals = 0;
- unsigned int num_globals = 0;
- unsigned int num_locals2 = 0;
- unsigned int num_globals2 = 0;
- int max_index = 0;
- unsigned int idx;
- asection *asect;
- asymbol **new_syms;
- bfd_size_type amt;
-
-#ifdef DEBUG
- fprintf (stderr, "elf_map_symbols\n");
- fflush (stderr);
-#endif
-
- for (asect = abfd->sections; asect; asect = asect->next)
- {
- if (max_index < asect->index)
- max_index = asect->index;
- }
-
- max_index++;
- amt = max_index * sizeof (asymbol *);
- sect_syms = bfd_zalloc (abfd, amt);
- if (sect_syms == NULL)
- return FALSE;
- elf_section_syms (abfd) = sect_syms;
- elf_num_section_syms (abfd) = max_index;
-
- /* Init sect_syms entries for any section symbols we have already
- decided to output. */
- for (idx = 0; idx < symcount; idx++)
- {
- asymbol *sym = syms[idx];
-
- if ((sym->flags & BSF_SECTION_SYM) != 0
- && sym->value == 0)
- {
- asection *sec;
-
- sec = sym->section;
-
- if (sec->owner != NULL)
- {
- if (sec->owner != abfd)
- {
- if (sec->output_offset != 0)
- continue;
-
- sec = sec->output_section;
-
- /* Empty sections in the input files may have had a
- section symbol created for them. (See the comment
- near the end of _bfd_generic_link_output_symbols in
- linker.c). If the linker script discards such
- sections then we will reach this point. Since we know
- that we cannot avoid this case, we detect it and skip
- the abort and the assignment to the sect_syms array.
- To reproduce this particular case try running the
- linker testsuite test ld-scripts/weak.exp for an ELF
- port that uses the generic linker. */
- if (sec->owner == NULL)
- continue;
-
- BFD_ASSERT (sec->owner == abfd);
- }
- sect_syms[sec->index] = syms[idx];
- }
- }
- }
-
- /* Classify all of the symbols. */
- for (idx = 0; idx < symcount; idx++)
- {
- if (!sym_is_global (abfd, syms[idx]))
- num_locals++;
- else
- num_globals++;
- }
-
- /* We will be adding a section symbol for each BFD section. Most normal
- sections will already have a section symbol in outsymbols, but
- eg. SHT_GROUP sections will not, and we need the section symbol mapped
- at least in that case. */
- for (asect = abfd->sections; asect; asect = asect->next)
- {
- if (sect_syms[asect->index] == NULL)
- {
- if (!sym_is_global (abfd, asect->symbol))
- num_locals++;
- else
- num_globals++;
- }
- }
-
- /* Now sort the symbols so the local symbols are first. */
- amt = (num_locals + num_globals) * sizeof (asymbol *);
- new_syms = bfd_alloc (abfd, amt);
-
- if (new_syms == NULL)
- return FALSE;
-
- for (idx = 0; idx < symcount; idx++)
- {
- asymbol *sym = syms[idx];
- unsigned int i;
-
- if (!sym_is_global (abfd, sym))
- i = num_locals2++;
- else
- i = num_locals + num_globals2++;
- new_syms[i] = sym;
- sym->udata.i = i + 1;
- }
- for (asect = abfd->sections; asect; asect = asect->next)
- {
- if (sect_syms[asect->index] == NULL)
- {
- asymbol *sym = asect->symbol;
- unsigned int i;
-
- sect_syms[asect->index] = sym;
- if (!sym_is_global (abfd, sym))
- i = num_locals2++;
- else
- i = num_locals + num_globals2++;
- new_syms[i] = sym;
- sym->udata.i = i + 1;
- }
- }
-
- bfd_set_symtab (abfd, new_syms, num_locals + num_globals);
-
- elf_num_locals (abfd) = num_locals;
- elf_num_globals (abfd) = num_globals;
- return TRUE;
-}
-
-/* Align to the maximum file alignment that could be required for any
- ELF data structure. */
-
-static inline file_ptr
-align_file_position (file_ptr off, int align)
-{
- return (off + align - 1) & ~(align - 1);
-}
-
-/* Assign a file position to a section, optionally aligning to the
- required section alignment. */
-
-file_ptr
-_bfd_elf_assign_file_position_for_section (Elf_Internal_Shdr *i_shdrp,
- file_ptr offset,
- bfd_boolean align)
-{
- if (align)
- {
- unsigned int al;
-
- al = i_shdrp->sh_addralign;
- if (al > 1)
- offset = BFD_ALIGN (offset, al);
- }
- i_shdrp->sh_offset = offset;
- if (i_shdrp->bfd_section != NULL)
- i_shdrp->bfd_section->filepos = offset;
- if (i_shdrp->sh_type != SHT_NOBITS)
- offset += i_shdrp->sh_size;
- return offset;
-}
-
-/* Compute the file positions we are going to put the sections at, and
- otherwise prepare to begin writing out the ELF file. If LINK_INFO
- is not NULL, this is being called by the ELF backend linker. */
-
-bfd_boolean
-_bfd_elf_compute_section_file_positions (bfd *abfd,
- struct bfd_link_info *link_info)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_boolean failed;
- struct bfd_strtab_hash *strtab;
- Elf_Internal_Shdr *shstrtab_hdr;
-
- if (abfd->output_has_begun)
- return TRUE;
-
- /* Do any elf backend specific processing first. */
- if (bed->elf_backend_begin_write_processing)
- (*bed->elf_backend_begin_write_processing) (abfd, link_info);
-
- if (! prep_headers (abfd))
- return FALSE;
-
- /* Post process the headers if necessary. */
- if (bed->elf_backend_post_process_headers)
- (*bed->elf_backend_post_process_headers) (abfd, link_info);
-
- failed = FALSE;
- bfd_map_over_sections (abfd, elf_fake_sections, &failed);
- if (failed)
- return FALSE;
-
- if (!assign_section_numbers (abfd))
- return FALSE;
-
- /* The backend linker builds symbol table information itself. */
- if (link_info == NULL && bfd_get_symcount (abfd) > 0)
- {
- /* Non-zero if doing a relocatable link. */
- int relocatable_p = ! (abfd->flags & (EXEC_P | DYNAMIC));
-
- if (! swap_out_syms (abfd, &strtab, relocatable_p))
- return FALSE;
- }
-
- if (link_info == NULL)
- {
- bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
- if (failed)
- return FALSE;
- }
-
- shstrtab_hdr = &elf_tdata (abfd)->shstrtab_hdr;
- /* sh_name was set in prep_headers. */
- shstrtab_hdr->sh_type = SHT_STRTAB;
- shstrtab_hdr->sh_flags = 0;
- shstrtab_hdr->sh_addr = 0;
- shstrtab_hdr->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
- shstrtab_hdr->sh_entsize = 0;
- shstrtab_hdr->sh_link = 0;
- shstrtab_hdr->sh_info = 0;
- /* sh_offset is set in assign_file_positions_except_relocs. */
- shstrtab_hdr->sh_addralign = 1;
-
- if (!assign_file_positions_except_relocs (abfd, link_info))
- return FALSE;
-
- if (link_info == NULL && bfd_get_symcount (abfd) > 0)
- {
- file_ptr off;
- Elf_Internal_Shdr *hdr;
-
- off = elf_tdata (abfd)->next_file_pos;
-
- hdr = &elf_tdata (abfd)->symtab_hdr;
- off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
-
- hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
- if (hdr->sh_size != 0)
- off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
-
- hdr = &elf_tdata (abfd)->strtab_hdr;
- off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
-
- elf_tdata (abfd)->next_file_pos = off;
-
- /* Now that we know where the .strtab section goes, write it
- out. */
- if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || ! _bfd_stringtab_emit (abfd, strtab))
- return FALSE;
- _bfd_stringtab_free (strtab);
- }
-
- abfd->output_has_begun = TRUE;
-
- return TRUE;
-}
-
-/* Create a mapping from a set of sections to a program segment. */
-
-static struct elf_segment_map *
-make_mapping (bfd *abfd,
- asection **sections,
- unsigned int from,
- unsigned int to,
- bfd_boolean phdr)
-{
- struct elf_segment_map *m;
- unsigned int i;
- asection **hdrpp;
- bfd_size_type amt;
-
- amt = sizeof (struct elf_segment_map);
- amt += (to - from - 1) * sizeof (asection *);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- return NULL;
- m->next = NULL;
- m->p_type = PT_LOAD;
- for (i = from, hdrpp = sections + from; i < to; i++, hdrpp++)
- m->sections[i - from] = *hdrpp;
- m->count = to - from;
-
- if (from == 0 && phdr)
- {
- /* Include the headers in the first PT_LOAD segment. */
- m->includes_filehdr = 1;
- m->includes_phdrs = 1;
- }
-
- return m;
-}
-
-/* Set up a mapping from BFD sections to program segments. */
-
-static bfd_boolean
-map_sections_to_segments (bfd *abfd)
-{
- asection **sections = NULL;
- asection *s;
- unsigned int i;
- unsigned int count;
- struct elf_segment_map *mfirst;
- struct elf_segment_map **pm;
- struct elf_segment_map *m;
- asection *last_hdr;
- bfd_vma last_size;
- unsigned int phdr_index;
- bfd_vma maxpagesize;
- asection **hdrpp;
- bfd_boolean phdr_in_segment = TRUE;
- bfd_boolean writable;
- int tls_count = 0;
- asection *first_tls = NULL;
- asection *dynsec, *eh_frame_hdr;
- bfd_size_type amt;
-
- if (elf_tdata (abfd)->segment_map != NULL)
- return TRUE;
-
- if (bfd_count_sections (abfd) == 0)
- return TRUE;
-
- /* Select the allocated sections, and sort them. */
-
- amt = bfd_count_sections (abfd) * sizeof (asection *);
- sections = bfd_malloc (amt);
- if (sections == NULL)
- goto error_return;
-
- i = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_ALLOC) != 0)
- {
- sections[i] = s;
- ++i;
- }
- }
- BFD_ASSERT (i <= bfd_count_sections (abfd));
- count = i;
-
- qsort (sections, (size_t) count, sizeof (asection *), elf_sort_sections);
-
- /* Build the mapping. */
-
- mfirst = NULL;
- pm = &mfirst;
-
- /* If we have a .interp section, then create a PT_PHDR segment for
- the program headers and a PT_INTERP segment for the .interp
- section. */
- s = bfd_get_section_by_name (abfd, ".interp");
- if (s != NULL && (s->flags & SEC_LOAD) != 0)
- {
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_PHDR;
- /* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */
- m->p_flags = PF_R | PF_X;
- m->p_flags_valid = 1;
- m->includes_phdrs = 1;
-
- *pm = m;
- pm = &m->next;
-
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_INTERP;
- m->count = 1;
- m->sections[0] = s;
-
- *pm = m;
- pm = &m->next;
- }
-
- /* Look through the sections. We put sections in the same program
- segment when the start of the second section can be placed within
- a few bytes of the end of the first section. */
- last_hdr = NULL;
- last_size = 0;
- phdr_index = 0;
- maxpagesize = get_elf_backend_data (abfd)->maxpagesize;
- writable = FALSE;
- dynsec = bfd_get_section_by_name (abfd, ".dynamic");
- if (dynsec != NULL
- && (dynsec->flags & SEC_LOAD) == 0)
- dynsec = NULL;
-
- /* Deal with -Ttext or something similar such that the first section
- is not adjacent to the program headers. This is an
- approximation, since at this point we don't know exactly how many
- program headers we will need. */
- if (count > 0)
- {
- bfd_size_type phdr_size;
-
- phdr_size = elf_tdata (abfd)->program_header_size;
- if (phdr_size == 0)
- phdr_size = get_elf_backend_data (abfd)->s->sizeof_phdr;
- if ((abfd->flags & D_PAGED) == 0
- || sections[0]->lma < phdr_size
- || sections[0]->lma % maxpagesize < phdr_size % maxpagesize)
- phdr_in_segment = FALSE;
- }
-
- for (i = 0, hdrpp = sections; i < count; i++, hdrpp++)
- {
- asection *hdr;
- bfd_boolean new_segment;
-
- hdr = *hdrpp;
-
- /* See if this section and the last one will fit in the same
- segment. */
-
- if (last_hdr == NULL)
- {
- /* If we don't have a segment yet, then we don't need a new
- one (we build the last one after this loop). */
- new_segment = FALSE;
- }
- else if (last_hdr->lma - last_hdr->vma != hdr->lma - hdr->vma)
- {
- /* If this section has a different relation between the
- virtual address and the load address, then we need a new
- segment. */
- new_segment = TRUE;
- }
- else if (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
- < BFD_ALIGN (hdr->lma, maxpagesize))
- {
- /* If putting this section in this segment would force us to
- skip a page in the segment, then we need a new segment. */
- new_segment = TRUE;
- }
- else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0
- && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
- {
- /* We don't want to put a loadable section after a
- nonloadable section in the same segment.
- Consider .tbss sections as loadable for this purpose. */
- new_segment = TRUE;
- }
- else if ((abfd->flags & D_PAGED) == 0)
- {
- /* If the file is not demand paged, which means that we
- don't require the sections to be correctly aligned in the
- file, then there is no other reason for a new segment. */
- new_segment = FALSE;
- }
- else if (! writable
- && (hdr->flags & SEC_READONLY) == 0
- && (((last_hdr->lma + last_size - 1)
- & ~(maxpagesize - 1))
- != (hdr->lma & ~(maxpagesize - 1))))
- {
- /* We don't want to put a writable section in a read only
- segment, unless they are on the same page in memory
- anyhow. We already know that the last section does not
- bring us past the current section on the page, so the
- only case in which the new section is not on the same
- page as the previous section is when the previous section
- ends precisely on a page boundary. */
- new_segment = TRUE;
- }
- else
- {
- /* Otherwise, we can use the same segment. */
- new_segment = FALSE;
- }
-
- if (! new_segment)
- {
- if ((hdr->flags & SEC_READONLY) == 0)
- writable = TRUE;
- last_hdr = hdr;
- /* .tbss sections effectively have zero size. */
- if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL)
- last_size = hdr->_raw_size;
- else
- last_size = 0;
- continue;
- }
-
- /* We need a new program segment. We must create a new program
- header holding all the sections from phdr_index until hdr. */
-
- m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment);
- if (m == NULL)
- goto error_return;
-
- *pm = m;
- pm = &m->next;
-
- if ((hdr->flags & SEC_READONLY) == 0)
- writable = TRUE;
- else
- writable = FALSE;
-
- last_hdr = hdr;
- /* .tbss sections effectively have zero size. */
- if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL)
- last_size = hdr->_raw_size;
- else
- last_size = 0;
- phdr_index = i;
- phdr_in_segment = FALSE;
- }
-
- /* Create a final PT_LOAD program segment. */
- if (last_hdr != NULL)
- {
- m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment);
- if (m == NULL)
- goto error_return;
-
- *pm = m;
- pm = &m->next;
- }
-
- /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */
- if (dynsec != NULL)
- {
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_DYNAMIC;
- m->count = 1;
- m->sections[0] = dynsec;
-
- *pm = m;
- pm = &m->next;
- }
-
- /* For each loadable .note section, add a PT_NOTE segment. We don't
- use bfd_get_section_by_name, because if we link together
- nonloadable .note sections and loadable .note sections, we will
- generate two .note sections in the output file. FIXME: Using
- names for section types is bogus anyhow. */
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LOAD) != 0
- && strncmp (s->name, ".note", 5) == 0)
- {
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_NOTE;
- m->count = 1;
- m->sections[0] = s;
-
- *pm = m;
- pm = &m->next;
- }
- if (s->flags & SEC_THREAD_LOCAL)
- {
- if (! tls_count)
- first_tls = s;
- tls_count++;
- }
- }
-
- /* If there are any SHF_TLS output sections, add PT_TLS segment. */
- if (tls_count > 0)
- {
- int i;
-
- amt = sizeof (struct elf_segment_map);
- amt += (tls_count - 1) * sizeof (asection *);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_TLS;
- m->count = tls_count;
- /* Mandated PF_R. */
- m->p_flags = PF_R;
- m->p_flags_valid = 1;
- for (i = 0; i < tls_count; ++i)
- {
- BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL);
- m->sections[i] = first_tls;
- first_tls = first_tls->next;
- }
-
- *pm = m;
- pm = &m->next;
- }
-
- /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
- segment. */
- eh_frame_hdr = elf_tdata (abfd)->eh_frame_hdr;
- if (eh_frame_hdr != NULL
- && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0)
- {
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_GNU_EH_FRAME;
- m->count = 1;
- m->sections[0] = eh_frame_hdr->output_section;
-
- *pm = m;
- pm = &m->next;
- }
-
- if (elf_tdata (abfd)->stack_flags)
- {
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_GNU_STACK;
- m->p_flags = elf_tdata (abfd)->stack_flags;
- m->p_flags_valid = 1;
-
- *pm = m;
- pm = &m->next;
- }
-
- free (sections);
- sections = NULL;
-
- elf_tdata (abfd)->segment_map = mfirst;
- return TRUE;
-
- error_return:
- if (sections != NULL)
- free (sections);
- return FALSE;
-}
-
-/* Sort sections by address. */
-
-static int
-elf_sort_sections (const void *arg1, const void *arg2)
-{
- const asection *sec1 = *(const asection **) arg1;
- const asection *sec2 = *(const asection **) arg2;
- bfd_size_type size1, size2;
-
- /* Sort by LMA first, since this is the address used to
- place the section into a segment. */
- if (sec1->lma < sec2->lma)
- return -1;
- else if (sec1->lma > sec2->lma)
- return 1;
-
- /* Then sort by VMA. Normally the LMA and the VMA will be
- the same, and this will do nothing. */
- if (sec1->vma < sec2->vma)
- return -1;
- else if (sec1->vma > sec2->vma)
- return 1;
-
- /* Put !SEC_LOAD sections after SEC_LOAD ones. */
-
-#define TOEND(x) (((x)->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0)
-
- if (TOEND (sec1))
- {
- if (TOEND (sec2))
- {
- /* If the indicies are the same, do not return 0
- here, but continue to try the next comparison. */
- if (sec1->target_index - sec2->target_index != 0)
- return sec1->target_index - sec2->target_index;
- }
- else
- return 1;
- }
- else if (TOEND (sec2))
- return -1;
-
-#undef TOEND
-
- /* Sort by size, to put zero sized sections
- before others at the same address. */
-
- size1 = (sec1->flags & SEC_LOAD) ? sec1->_raw_size : 0;
- size2 = (sec2->flags & SEC_LOAD) ? sec2->_raw_size : 0;
-
- if (size1 < size2)
- return -1;
- if (size1 > size2)
- return 1;
-
- return sec1->target_index - sec2->target_index;
-}
-
-/* Ian Lance Taylor writes:
-
- We shouldn't be using % with a negative signed number. That's just
- not good. We have to make sure either that the number is not
- negative, or that the number has an unsigned type. When the types
- are all the same size they wind up as unsigned. When file_ptr is a
- larger signed type, the arithmetic winds up as signed long long,
- which is wrong.
-
- What we're trying to say here is something like ``increase OFF by
- the least amount that will cause it to be equal to the VMA modulo
- the page size.'' */
-/* In other words, something like:
-
- vma_offset = m->sections[0]->vma % bed->maxpagesize;
- off_offset = off % bed->maxpagesize;
- if (vma_offset < off_offset)
- adjustment = vma_offset + bed->maxpagesize - off_offset;
- else
- adjustment = vma_offset - off_offset;
-
- which can can be collapsed into the expression below. */
-
-static file_ptr
-vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize)
-{
- return ((vma - off) % maxpagesize);
-}
-
-/* Assign file positions to the sections based on the mapping from
- sections to segments. This function also sets up some fields in
- the file header, and writes out the program headers. */
-
-static bfd_boolean
-assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- unsigned int count;
- struct elf_segment_map *m;
- unsigned int alloc;
- Elf_Internal_Phdr *phdrs;
- file_ptr off, voff;
- 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)
- {
- if (! map_sections_to_segments (abfd))
- return FALSE;
- }
- else
- {
- /* The placement algorithm assumes that non allocated sections are
- not in PT_LOAD segments. We ensure this here by removing such
- sections from the segment map. */
- for (m = elf_tdata (abfd)->segment_map;
- m != NULL;
- m = m->next)
- {
- unsigned int new_count;
- unsigned int i;
-
- if (m->p_type != PT_LOAD)
- continue;
-
- new_count = 0;
- for (i = 0; i < m->count; i ++)
- {
- if ((m->sections[i]->flags & SEC_ALLOC) != 0)
- {
- if (i != new_count)
- m->sections[new_count] = m->sections[i];
-
- new_count ++;
- }
- }
-
- if (new_count != m->count)
- m->count = new_count;
- }
- }
-
- if (bed->elf_backend_modify_segment_map)
- {
- if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info))
- return FALSE;
- }
-
- count = 0;
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- ++count;
-
- elf_elfheader (abfd)->e_phoff = bed->s->sizeof_ehdr;
- elf_elfheader (abfd)->e_phentsize = bed->s->sizeof_phdr;
- elf_elfheader (abfd)->e_phnum = count;
-
- if (count == 0)
- return TRUE;
-
- /* If we already counted the number of program segments, make sure
- that we allocated enough space. This happens when SIZEOF_HEADERS
- is used in a linker script. */
- alloc = elf_tdata (abfd)->program_header_size / bed->s->sizeof_phdr;
- if (alloc != 0 && count > alloc)
- {
- ((*_bfd_error_handler)
- (_("%s: Not enough room for program headers (allocated %u, need %u)"),
- bfd_get_filename (abfd), alloc, count));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (alloc == 0)
- alloc = count;
-
- amt = alloc * sizeof (Elf_Internal_Phdr);
- phdrs = bfd_alloc (abfd, amt);
- if (phdrs == NULL)
- return FALSE;
-
- off = bed->s->sizeof_ehdr;
- off += alloc * bed->s->sizeof_phdr;
-
- filehdr_vaddr = 0;
- filehdr_paddr = 0;
- phdrs_vaddr = 0;
- phdrs_paddr = 0;
-
- for (m = elf_tdata (abfd)->segment_map, p = phdrs;
- m != NULL;
- m = m->next, p++)
- {
- unsigned int i;
- asection **secpp;
-
- /* If elf_segment_map is not from map_sections_to_segments, the
- sections may not be correctly ordered. NOTE: sorting should
- not be done to the PT_NOTE section of a corefile, which may
- contain several pseudo-sections artificially created by bfd.
- Sorting these pseudo-sections breaks things badly. */
- if (m->count > 1
- && !(elf_elfheader (abfd)->e_type == ET_CORE
- && m->p_type == PT_NOTE))
- qsort (m->sections, (size_t) m->count, sizeof (asection *),
- elf_sort_sections);
-
- p->p_type = m->p_type;
- p->p_flags = m->p_flags;
-
- if (p->p_type == PT_LOAD
- && m->count > 0
- && (m->sections[0]->flags & SEC_ALLOC) != 0)
- {
- if ((abfd->flags & D_PAGED) != 0)
- off += vma_page_aligned_bias (m->sections[0]->vma, off,
- bed->maxpagesize);
- else
- {
- bfd_size_type align;
-
- align = 0;
- for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
- {
- bfd_size_type secalign;
-
- secalign = bfd_get_section_alignment (abfd, *secpp);
- if (secalign > align)
- align = secalign;
- }
-
- off += vma_page_aligned_bias (m->sections[0]->vma, off,
- 1 << align);
- }
- }
-
- if (m->count == 0)
- p->p_vaddr = 0;
- else
- p->p_vaddr = m->sections[0]->vma;
-
- if (m->p_paddr_valid)
- p->p_paddr = m->p_paddr;
- else if (m->count == 0)
- p->p_paddr = 0;
- else
- p->p_paddr = m->sections[0]->lma;
-
- if (p->p_type == PT_LOAD
- && (abfd->flags & D_PAGED) != 0)
- p->p_align = bed->maxpagesize;
- else if (m->count == 0)
- p->p_align = 1 << bed->s->log_file_align;
- else
- p->p_align = 0;
-
- p->p_offset = 0;
- p->p_filesz = 0;
- p->p_memsz = 0;
-
- if (m->includes_filehdr)
- {
- if (! m->p_flags_valid)
- p->p_flags |= PF_R;
- p->p_offset = 0;
- p->p_filesz = bed->s->sizeof_ehdr;
- p->p_memsz = bed->s->sizeof_ehdr;
- if (m->count > 0)
- {
- BFD_ASSERT (p->p_type == PT_LOAD);
-
- if (p->p_vaddr < (bfd_vma) off)
- {
- (*_bfd_error_handler)
- (_("%s: Not enough room for program headers, try linking with -N"),
- bfd_get_filename (abfd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- p->p_vaddr -= off;
- if (! m->p_paddr_valid)
- p->p_paddr -= off;
- }
- if (p->p_type == PT_LOAD)
- {
- filehdr_vaddr = p->p_vaddr;
- filehdr_paddr = p->p_paddr;
- }
- }
-
- if (m->includes_phdrs)
- {
- if (! m->p_flags_valid)
- p->p_flags |= PF_R;
-
- if (m->includes_filehdr)
- {
- if (p->p_type == PT_LOAD)
- {
- phdrs_vaddr = p->p_vaddr + bed->s->sizeof_ehdr;
- phdrs_paddr = p->p_paddr + bed->s->sizeof_ehdr;
- }
- }
- else
- {
- p->p_offset = bed->s->sizeof_ehdr;
-
- if (m->count > 0)
- {
- BFD_ASSERT (p->p_type == PT_LOAD);
- p->p_vaddr -= off - p->p_offset;
- if (! m->p_paddr_valid)
- p->p_paddr -= off - p->p_offset;
- }
-
- if (p->p_type == PT_LOAD)
- {
- phdrs_vaddr = p->p_vaddr;
- phdrs_paddr = p->p_paddr;
- }
- else
- phdrs_vaddr = bed->maxpagesize + bed->s->sizeof_ehdr;
- }
-
- p->p_filesz += alloc * bed->s->sizeof_phdr;
- p->p_memsz += alloc * bed->s->sizeof_phdr;
- }
-
- if (p->p_type == PT_LOAD
- || (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core))
- {
- if (! m->includes_filehdr && ! m->includes_phdrs)
- p->p_offset = off;
- else
- {
- file_ptr adjust;
-
- adjust = off - (p->p_offset + p->p_filesz);
- p->p_filesz += adjust;
- p->p_memsz += adjust;
- }
- }
-
- voff = off;
-
- for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
- {
- asection *sec;
- flagword flags;
- bfd_size_type align;
-
- sec = *secpp;
- flags = sec->flags;
- align = 1 << bfd_get_section_alignment (abfd, sec);
-
- /* The section may have artificial alignment forced by a
- link script. Notice this case by the gap between the
- cumulative phdr lma and the section's lma. */
- if (p->p_paddr + p->p_memsz < sec->lma)
- {
- bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
-
- p->p_memsz += adjust;
- if (p->p_type == PT_LOAD
- || (p->p_type == PT_NOTE
- && bfd_get_format (abfd) == bfd_core))
- {
- off += adjust;
- voff += adjust;
- }
- if ((flags & SEC_LOAD) != 0
- || (flags & SEC_THREAD_LOCAL) != 0)
- p->p_filesz += adjust;
- }
-
- if (p->p_type == PT_LOAD)
- {
- bfd_signed_vma adjust;
-
- if ((flags & SEC_LOAD) != 0)
- {
- adjust = sec->lma - (p->p_paddr + p->p_memsz);
- if (adjust < 0)
- adjust = 0;
- }
- else if ((flags & SEC_ALLOC) != 0)
- {
- /* The section VMA must equal the file position
- modulo the page size. FIXME: I'm not sure if
- this adjustment is really necessary. We used to
- not have the SEC_LOAD case just above, and then
- this was necessary, but now I'm not sure. */
- if ((abfd->flags & D_PAGED) != 0)
- adjust = vma_page_aligned_bias (sec->vma, voff,
- bed->maxpagesize);
- else
- adjust = vma_page_aligned_bias (sec->vma, voff,
- align);
- }
- else
- adjust = 0;
-
- if (adjust != 0)
- {
- if (i == 0)
- {
- (* _bfd_error_handler) (_("\
-Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x"),
- bfd_section_name (abfd, sec),
- sec->lma,
- p->p_paddr);
- return FALSE;
- }
- p->p_memsz += adjust;
- off += adjust;
- voff += adjust;
- if ((flags & SEC_LOAD) != 0)
- p->p_filesz += adjust;
- }
-
- sec->filepos = off;
-
- /* We check SEC_HAS_CONTENTS here because if NOLOAD is
- used in a linker script we may have a section with
- SEC_LOAD clear but which is supposed to have
- contents. */
- if ((flags & SEC_LOAD) != 0
- || (flags & SEC_HAS_CONTENTS) != 0)
- off += sec->_raw_size;
-
- if ((flags & SEC_ALLOC) != 0
- && ((flags & SEC_LOAD) != 0
- || (flags & SEC_THREAD_LOCAL) == 0))
- voff += sec->_raw_size;
- }
-
- if (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core)
- {
- /* The actual "note" segment has i == 0.
- This is the one that actually contains everything. */
- if (i == 0)
- {
- sec->filepos = off;
- p->p_filesz = sec->_raw_size;
- off += sec->_raw_size;
- voff = off;
- }
- else
- {
- /* Fake sections -- don't need to be written. */
- sec->filepos = 0;
- sec->_raw_size = 0;
- flags = sec->flags = 0;
- }
- p->p_memsz = 0;
- p->p_align = 1;
- }
- else
- {
- if ((sec->flags & SEC_LOAD) != 0
- || (sec->flags & SEC_THREAD_LOCAL) == 0
- || p->p_type == PT_TLS)
- p->p_memsz += sec->_raw_size;
-
- if ((flags & SEC_LOAD) != 0)
- p->p_filesz += sec->_raw_size;
-
- if (p->p_type == PT_TLS
- && sec->_raw_size == 0
- && (sec->flags & SEC_HAS_CONTENTS) == 0)
- {
- struct bfd_link_order *o;
- bfd_vma tbss_size = 0;
-
- for (o = sec->link_order_head; o != NULL; o = o->next)
- if (tbss_size < o->offset + o->size)
- tbss_size = o->offset + o->size;
-
- p->p_memsz += tbss_size;
- }
-
- if (align > p->p_align
- && (p->p_type != PT_LOAD || (abfd->flags & D_PAGED) == 0))
- p->p_align = align;
- }
-
- if (! m->p_flags_valid)
- {
- p->p_flags |= PF_R;
- if ((flags & SEC_CODE) != 0)
- p->p_flags |= PF_X;
- if ((flags & SEC_READONLY) == 0)
- p->p_flags |= PF_W;
- }
- }
- }
-
- /* Now that we have set the section file positions, we can set up
- the file positions for the non PT_LOAD segments. */
- for (m = elf_tdata (abfd)->segment_map, p = phdrs;
- m != NULL;
- m = m->next, p++)
- {
- if (p->p_type != PT_LOAD && m->count > 0)
- {
- BFD_ASSERT (! m->includes_filehdr && ! m->includes_phdrs);
- p->p_offset = m->sections[0]->filepos;
- }
- if (m->count == 0)
- {
- if (m->includes_filehdr)
- {
- p->p_vaddr = filehdr_vaddr;
- if (! m->p_paddr_valid)
- p->p_paddr = filehdr_paddr;
- }
- else if (m->includes_phdrs)
- {
- p->p_vaddr = phdrs_vaddr;
- if (! m->p_paddr_valid)
- p->p_paddr = phdrs_paddr;
- }
- }
- }
-
- /* Clear out any program headers we allocated but did not use. */
- for (; count < alloc; count++, p++)
- {
- memset (p, 0, sizeof *p);
- p->p_type = PT_NULL;
- }
-
- elf_tdata (abfd)->phdr = phdrs;
-
- elf_tdata (abfd)->next_file_pos = off;
-
- /* Write out the program headers. */
- 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;
-
- return TRUE;
-}
-
-/* Get the size of the program header.
-
- If this is called by the linker before any of the section VMA's are set, it
- can't calculate the correct value for a strange memory layout. This only
- happens when SIZEOF_HEADERS is used in a linker script. In this case,
- SORTED_HDRS is NULL and we assume the normal scenario of one text and one
- data segment (exclusive of .interp and .dynamic).
-
- ??? User written scripts must either not use SIZEOF_HEADERS, or assume there
- will be two segments. */
-
-static bfd_size_type
-get_program_header_size (bfd *abfd)
-{
- size_t segs;
- asection *s;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- /* We can't return a different result each time we're called. */
- if (elf_tdata (abfd)->program_header_size != 0)
- return elf_tdata (abfd)->program_header_size;
-
- if (elf_tdata (abfd)->segment_map != NULL)
- {
- struct elf_segment_map *m;
-
- segs = 0;
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- ++segs;
- elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr;
- return elf_tdata (abfd)->program_header_size;
- }
-
- /* Assume we will need exactly two PT_LOAD segments: one for text
- and one for data. */
- segs = 2;
-
- s = bfd_get_section_by_name (abfd, ".interp");
- if (s != NULL && (s->flags & SEC_LOAD) != 0)
- {
- /* If we have a loadable interpreter section, we need a
- PT_INTERP segment. In this case, assume we also need a
- PT_PHDR segment, although that may not be true for all
- targets. */
- segs += 2;
- }
-
- if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
- {
- /* We need a PT_DYNAMIC segment. */
- ++segs;
- }
-
- if (elf_tdata (abfd)->eh_frame_hdr)
- {
- /* We need a PT_GNU_EH_FRAME segment. */
- ++segs;
- }
-
- if (elf_tdata (abfd)->stack_flags)
- {
- /* We need a PT_GNU_STACK segment. */
- ++segs;
- }
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LOAD) != 0
- && strncmp (s->name, ".note", 5) == 0)
- {
- /* We need a PT_NOTE segment. */
- ++segs;
- }
- }
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if (s->flags & SEC_THREAD_LOCAL)
- {
- /* We need a PT_TLS segment. */
- ++segs;
- break;
- }
- }
-
- /* Let the backend count up any program headers it might need. */
- if (bed->elf_backend_additional_program_headers)
- {
- int a;
-
- a = (*bed->elf_backend_additional_program_headers) (abfd);
- if (a == -1)
- abort ();
- segs += a;
- }
-
- elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr;
- return elf_tdata (abfd)->program_header_size;
-}
-
-/* Work out the file positions of all the sections. This is called by
- _bfd_elf_compute_section_file_positions. All the section sizes and
- VMAs must be known before this is called.
-
- We do not consider reloc sections at this point, unless they form
- part of the loadable image. Reloc sections are assigned file
- positions in assign_file_positions_for_relocs, which is called by
- write_object_contents and final_link.
-
- We also don't set the positions of the .symtab and .strtab here. */
-
-static bfd_boolean
-assign_file_positions_except_relocs (bfd *abfd,
- struct bfd_link_info *link_info)
-{
- struct elf_obj_tdata * const tdata = elf_tdata (abfd);
- Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd);
- Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd);
- unsigned int num_sec = elf_numsections (abfd);
- file_ptr off;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0
- && bfd_get_format (abfd) != bfd_core)
- {
- Elf_Internal_Shdr **hdrpp;
- unsigned int i;
-
- /* Start after the ELF header. */
- off = i_ehdrp->e_ehsize;
-
- /* We are not creating an executable, which means that we are
- not creating a program header, and that the actual order of
- the sections in the file is unimportant. */
- for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
- {
- Elf_Internal_Shdr *hdr;
-
- hdr = *hdrpp;
- if (hdr->sh_type == SHT_REL
- || hdr->sh_type == SHT_RELA
- || i == tdata->symtab_section
- || i == tdata->symtab_shndx_section
- || i == tdata->strtab_section)
- {
- hdr->sh_offset = -1;
- }
- else
- off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
-
- if (i == SHN_LORESERVE - 1)
- {
- i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- }
- }
- else
- {
- unsigned int i;
- Elf_Internal_Shdr **hdrpp;
-
- /* Assign file positions for the loaded sections based on the
- assignment of sections to segments. */
- if (! assign_file_positions_for_segments (abfd, link_info))
- return FALSE;
-
- /* Assign file positions for the other sections. */
-
- off = elf_tdata (abfd)->next_file_pos;
- for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
- {
- Elf_Internal_Shdr *hdr;
-
- hdr = *hdrpp;
- if (hdr->bfd_section != NULL
- && hdr->bfd_section->filepos != 0)
- hdr->sh_offset = hdr->bfd_section->filepos;
- else if ((hdr->sh_flags & SHF_ALLOC) != 0)
- {
- ((*_bfd_error_handler)
- (_("%s: warning: allocated section `%s' not in segment"),
- bfd_get_filename (abfd),
- (hdr->bfd_section == NULL
- ? "*unknown*"
- : hdr->bfd_section->name)));
- if ((abfd->flags & D_PAGED) != 0)
- off += vma_page_aligned_bias (hdr->sh_addr, off,
- bed->maxpagesize);
- else
- off += vma_page_aligned_bias (hdr->sh_addr, off,
- hdr->sh_addralign);
- off = _bfd_elf_assign_file_position_for_section (hdr, off,
- FALSE);
- }
- else if (hdr == i_shdrpp[tdata->symtab_section]
- || hdr == i_shdrpp[tdata->symtab_shndx_section]
- || hdr == i_shdrpp[tdata->strtab_section])
- hdr->sh_offset = -1;
- else
- off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
-
- if (i == SHN_LORESERVE - 1)
- {
- i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- }
- }
-
- /* Place the section headers. */
- off = align_file_position (off, 1 << bed->s->log_file_align);
- i_ehdrp->e_shoff = off;
- off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize;
-
- elf_tdata (abfd)->next_file_pos = off;
-
- return TRUE;
-}
-
-static bfd_boolean
-prep_headers (bfd *abfd)
-{
- Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
- Elf_Internal_Phdr *i_phdrp = 0; /* Program header table, internal form */
- Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */
- struct elf_strtab_hash *shstrtab;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- i_ehdrp = elf_elfheader (abfd);
- i_shdrp = elf_elfsections (abfd);
-
- shstrtab = _bfd_elf_strtab_init ();
- if (shstrtab == NULL)
- return FALSE;
-
- elf_shstrtab (abfd) = shstrtab;
-
- i_ehdrp->e_ident[EI_MAG0] = ELFMAG0;
- i_ehdrp->e_ident[EI_MAG1] = ELFMAG1;
- i_ehdrp->e_ident[EI_MAG2] = ELFMAG2;
- i_ehdrp->e_ident[EI_MAG3] = ELFMAG3;
-
- i_ehdrp->e_ident[EI_CLASS] = bed->s->elfclass;
- i_ehdrp->e_ident[EI_DATA] =
- bfd_big_endian (abfd) ? ELFDATA2MSB : ELFDATA2LSB;
- i_ehdrp->e_ident[EI_VERSION] = bed->s->ev_current;
-
- if ((abfd->flags & DYNAMIC) != 0)
- i_ehdrp->e_type = ET_DYN;
- else if ((abfd->flags & EXEC_P) != 0)
- i_ehdrp->e_type = ET_EXEC;
- else if (bfd_get_format (abfd) == bfd_core)
- i_ehdrp->e_type = ET_CORE;
- else
- i_ehdrp->e_type = ET_REL;
-
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_unknown:
- i_ehdrp->e_machine = EM_NONE;
- break;
-
- /* There used to be a long list of cases here, each one setting
- e_machine to the same EM_* macro #defined as ELF_MACHINE_CODE
- in the corresponding bfd definition. To avoid duplication,
- the switch was removed. Machines that need special handling
- can generally do it in elf_backend_final_write_processing(),
- unless they need the information earlier than the final write.
- Such need can generally be supplied by replacing the tests for
- e_machine with the conditions used to determine it. */
- default:
- i_ehdrp->e_machine = bed->elf_machine_code;
- }
-
- i_ehdrp->e_version = bed->s->ev_current;
- i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;
-
- /* No program header, for now. */
- i_ehdrp->e_phoff = 0;
- i_ehdrp->e_phentsize = 0;
- i_ehdrp->e_phnum = 0;
-
- /* Each bfd section is section header entry. */
- i_ehdrp->e_entry = bfd_get_start_address (abfd);
- i_ehdrp->e_shentsize = bed->s->sizeof_shdr;
-
- /* If we're building an executable, we'll need a program header table. */
- if (abfd->flags & EXEC_P)
- {
- /* It all happens later. */
-#if 0
- i_ehdrp->e_phentsize = sizeof (Elf_External_Phdr);
-
- /* elf_build_phdrs() returns a (NULL-terminated) array of
- Elf_Internal_Phdrs. */
- i_phdrp = elf_build_phdrs (abfd, i_ehdrp, i_shdrp, &i_ehdrp->e_phnum);
- i_ehdrp->e_phoff = outbase;
- outbase += i_ehdrp->e_phentsize * i_ehdrp->e_phnum;
-#endif
- }
- else
- {
- i_ehdrp->e_phentsize = 0;
- i_phdrp = 0;
- i_ehdrp->e_phoff = 0;
- }
-
- elf_tdata (abfd)->symtab_hdr.sh_name =
- (unsigned int) _bfd_elf_strtab_add (shstrtab, ".symtab", FALSE);
- elf_tdata (abfd)->strtab_hdr.sh_name =
- (unsigned int) _bfd_elf_strtab_add (shstrtab, ".strtab", FALSE);
- elf_tdata (abfd)->shstrtab_hdr.sh_name =
- (unsigned int) _bfd_elf_strtab_add (shstrtab, ".shstrtab", FALSE);
- if (elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1
- || elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1
- || elf_tdata (abfd)->shstrtab_hdr.sh_name == (unsigned int) -1)
- return FALSE;
-
- return TRUE;
-}
-
-/* Assign file positions for all the reloc sections which are not part
- of the loadable file image. */
-
-void
-_bfd_elf_assign_file_positions_for_relocs (bfd *abfd)
-{
- file_ptr off;
- unsigned int i, num_sec;
- Elf_Internal_Shdr **shdrpp;
-
- off = elf_tdata (abfd)->next_file_pos;
-
- num_sec = elf_numsections (abfd);
- for (i = 1, shdrpp = elf_elfsections (abfd) + 1; i < num_sec; i++, shdrpp++)
- {
- Elf_Internal_Shdr *shdrp;
-
- shdrp = *shdrpp;
- if ((shdrp->sh_type == SHT_REL || shdrp->sh_type == SHT_RELA)
- && shdrp->sh_offset == -1)
- off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE);
- }
-
- elf_tdata (abfd)->next_file_pos = off;
-}
-
-bfd_boolean
-_bfd_elf_write_object_contents (bfd *abfd)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- Elf_Internal_Ehdr *i_ehdrp;
- Elf_Internal_Shdr **i_shdrp;
- bfd_boolean failed;
- unsigned int count, num_sec;
-
- if (! abfd->output_has_begun
- && ! _bfd_elf_compute_section_file_positions (abfd, NULL))
- return FALSE;
-
- i_shdrp = elf_elfsections (abfd);
- i_ehdrp = elf_elfheader (abfd);
-
- failed = FALSE;
- bfd_map_over_sections (abfd, bed->s->write_relocs, &failed);
- if (failed)
- return FALSE;
-
- _bfd_elf_assign_file_positions_for_relocs (abfd);
-
- /* After writing the headers, we need to write the sections too... */
- num_sec = elf_numsections (abfd);
- for (count = 1; count < num_sec; count++)
- {
- if (bed->elf_backend_section_processing)
- (*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_bwrite (i_shdrp[count]->contents, amt, abfd) != amt)
- return FALSE;
- }
- if (count == SHN_LORESERVE - 1)
- count += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
-
- /* Write out the section header names. */
- if (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0
- || ! _bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd)))
- return FALSE;
-
- if (bed->elf_backend_final_write_processing)
- (*bed->elf_backend_final_write_processing) (abfd,
- elf_tdata (abfd)->linker);
-
- return bed->s->write_shdrs_and_ehdr (abfd);
-}
-
-bfd_boolean
-_bfd_elf_write_corefile_contents (bfd *abfd)
-{
- /* Hopefully this can be done just like an object file. */
- return _bfd_elf_write_object_contents (abfd);
-}
-
-/* Given a section, search the header to find them. */
-
-int
-_bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
-{
- const struct elf_backend_data *bed;
- int index;
-
- if (elf_section_data (asect) != NULL
- && elf_section_data (asect)->this_idx != 0)
- return elf_section_data (asect)->this_idx;
-
- if (bfd_is_abs_section (asect))
- index = SHN_ABS;
- else if (bfd_is_com_section (asect))
- index = SHN_COMMON;
- else if (bfd_is_und_section (asect))
- index = SHN_UNDEF;
- else
- {
- Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd);
- int maxindex = elf_numsections (abfd);
-
- for (index = 1; index < maxindex; index++)
- {
- Elf_Internal_Shdr *hdr = i_shdrp[index];
-
- if (hdr != NULL && hdr->bfd_section == asect)
- return index;
- }
- index = -1;
- }
-
- bed = get_elf_backend_data (abfd);
- if (bed->elf_backend_section_from_bfd_section)
- {
- int retval = index;
-
- if ((*bed->elf_backend_section_from_bfd_section) (abfd, asect, &retval))
- return retval;
- }
-
- if (index == -1)
- bfd_set_error (bfd_error_nonrepresentable_section);
-
- return index;
-}
-
-/* Given a BFD symbol, return the index in the ELF symbol table, or -1
- on error. */
-
-int
-_bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
-{
- asymbol *asym_ptr = *asym_ptr_ptr;
- int idx;
- flagword flags = asym_ptr->flags;
-
- /* When gas creates relocations against local labels, it creates its
- own symbol for the section, but does put the symbol into the
- symbol chain, so udata is 0. When the linker is generating
- relocatable output, this section symbol may be for one of the
- input sections rather than the output section. */
- if (asym_ptr->udata.i == 0
- && (flags & BSF_SECTION_SYM)
- && asym_ptr->section)
- {
- int indx;
-
- if (asym_ptr->section->output_section != NULL)
- indx = asym_ptr->section->output_section->index;
- else
- indx = asym_ptr->section->index;
- if (indx < elf_num_section_syms (abfd)
- && elf_section_syms (abfd)[indx] != NULL)
- asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i;
- }
-
- idx = asym_ptr->udata.i;
-
- if (idx == 0)
- {
- /* This case can occur when using --strip-symbol on a symbol
- which is used in a relocation entry. */
- (*_bfd_error_handler)
- (_("%s: symbol `%s' required but not present"),
- bfd_archive_filename (abfd), bfd_asymbol_name (asym_ptr));
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
-#if DEBUG & 4
- {
- fprintf (stderr,
- "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%s\n",
- (long) asym_ptr, asym_ptr->name, idx, flags,
- elf_symbol_flags (flags));
- fflush (stderr);
- }
-#endif
-
- return idx;
-}
-
-/* Copy private BFD data. This copies any program header information. */
-
-static bfd_boolean
-copy_private_bfd_data (bfd *ibfd, bfd *obfd)
-{
- Elf_Internal_Ehdr *iehdr;
- struct elf_segment_map *map;
- struct elf_segment_map *map_first;
- struct elf_segment_map **pointer_to_map;
- Elf_Internal_Phdr *segment;
- asection *section;
- unsigned int i;
- unsigned int num_segments;
- bfd_boolean phdr_included = FALSE;
- bfd_vma maxpagesize;
- struct elf_segment_map *phdr_adjust_seg = NULL;
- unsigned int phdr_adjust_num = 0;
- const struct elf_backend_data *bed;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- if (elf_tdata (ibfd)->phdr == NULL)
- return TRUE;
-
- bed = get_elf_backend_data (ibfd);
- iehdr = elf_elfheader (ibfd);
-
- map_first = NULL;
- pointer_to_map = &map_first;
-
- num_segments = elf_elfheader (ibfd)->e_phnum;
- maxpagesize = get_elf_backend_data (obfd)->maxpagesize;
-
- /* Returns the end address of the segment + 1. */
-#define SEGMENT_END(segment, start) \
- (start + (segment->p_memsz > segment->p_filesz \
- ? segment->p_memsz : segment->p_filesz))
-
-#define SECTION_SIZE(section, segment) \
- (((section->flags & (SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) \
- != SEC_THREAD_LOCAL || segment->p_type == PT_TLS) \
- ? section->_raw_size : 0)
-
- /* Returns TRUE if the given section is contained within
- the given segment. VMA addresses are compared. */
-#define IS_CONTAINED_BY_VMA(section, segment) \
- (section->vma >= segment->p_vaddr \
- && (section->vma + SECTION_SIZE (section, segment) \
- <= (SEGMENT_END (segment, segment->p_vaddr))))
-
- /* Returns TRUE if the given section is contained within
- the given segment. LMA addresses are compared. */
-#define IS_CONTAINED_BY_LMA(section, segment, base) \
- (section->lma >= base \
- && (section->lma + SECTION_SIZE (section, segment) \
- <= SEGMENT_END (segment, base)))
-
- /* Special case: corefile "NOTE" section containing regs, prpsinfo etc. */
-#define IS_COREFILE_NOTE(p, s) \
- (p->p_type == PT_NOTE \
- && bfd_get_format (ibfd) == bfd_core \
- && s->vma == 0 && s->lma == 0 \
- && (bfd_vma) s->filepos >= p->p_offset \
- && ((bfd_vma) s->filepos + s->_raw_size \
- <= p->p_offset + p->p_filesz))
-
- /* The complicated case when p_vaddr is 0 is to handle the Solaris
- linker, which generates a PT_INTERP section with p_vaddr and
- p_memsz set to 0. */
-#define IS_SOLARIS_PT_INTERP(p, s) \
- (p->p_vaddr == 0 \
- && p->p_paddr == 0 \
- && p->p_memsz == 0 \
- && p->p_filesz > 0 \
- && (s->flags & SEC_HAS_CONTENTS) != 0 \
- && s->_raw_size > 0 \
- && (bfd_vma) s->filepos >= p->p_offset \
- && ((bfd_vma) s->filepos + s->_raw_size \
- <= p->p_offset + p->p_filesz))
-
- /* Decide if the given section should be included in the given segment.
- A section will be included if:
- 1. It is within the address space of the segment -- we use the LMA
- if that is set for the segment and the VMA otherwise,
- 2. It is an allocated segment,
- 3. There is an output section associated with it,
- 4. The section has not already been allocated to a previous segment.
- 5. PT_GNU_STACK segments do not include any sections.
- 6. PT_TLS segment includes only SHF_TLS sections.
- 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. */
-#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \
- ((((segment->p_paddr \
- ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
- : IS_CONTAINED_BY_VMA (section, segment)) \
- && (section->flags & SEC_ALLOC) != 0) \
- || IS_COREFILE_NOTE (segment, section)) \
- && section->output_section != NULL \
- && segment->p_type != PT_GNU_STACK \
- && (segment->p_type != PT_TLS \
- || (section->flags & SEC_THREAD_LOCAL)) \
- && (segment->p_type == PT_LOAD \
- || segment->p_type == PT_TLS \
- || (section->flags & SEC_THREAD_LOCAL) == 0) \
- && ! section->segment_mark)
-
- /* Returns TRUE iff seg1 starts after the end of seg2. */
-#define SEGMENT_AFTER_SEGMENT(seg1, seg2, field) \
- (seg1->field >= SEGMENT_END (seg2, seg2->field))
-
- /* Returns TRUE iff seg1 and seg2 overlap. Segments overlap iff both
- their VMA address ranges and their LMA address ranges overlap.
- It is possible to have overlapping VMA ranges without overlapping LMA
- ranges. RedBoot images for example can have both .data and .bss mapped
- to the same VMA range, but with the .data section mapped to a different
- LMA. */
-#define SEGMENT_OVERLAPS(seg1, seg2) \
- ( !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_vaddr) \
- || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \
- && !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_paddr) \
- || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
-
- /* Initialise the segment mark field. */
- for (section = ibfd->sections; section != NULL; section = section->next)
- section->segment_mark = FALSE;
-
- /* Scan through the segments specified in the program header
- of the input BFD. For this first scan we look for overlaps
- in the loadable segments. These can be created by weird
- parameters to objcopy. Also, fix some solaris weirdness. */
- for (i = 0, segment = elf_tdata (ibfd)->phdr;
- i < num_segments;
- i++, segment++)
- {
- unsigned int j;
- Elf_Internal_Phdr *segment2;
-
- if (segment->p_type == PT_INTERP)
- for (section = ibfd->sections; section; section = section->next)
- if (IS_SOLARIS_PT_INTERP (segment, section))
- {
- /* Mininal change so that the normal section to segment
- assignment code will work. */
- segment->p_vaddr = section->vma;
- break;
- }
-
- if (segment->p_type != PT_LOAD)
- continue;
-
- /* Determine if this segment overlaps any previous segments. */
- for (j = 0, segment2 = elf_tdata (ibfd)->phdr; j < i; j++, segment2 ++)
- {
- bfd_signed_vma extra_length;
-
- if (segment2->p_type != PT_LOAD
- || ! SEGMENT_OVERLAPS (segment, segment2))
- continue;
-
- /* Merge the two segments together. */
- if (segment2->p_vaddr < segment->p_vaddr)
- {
- /* Extend SEGMENT2 to include SEGMENT and then delete
- SEGMENT. */
- extra_length =
- SEGMENT_END (segment, segment->p_vaddr)
- - SEGMENT_END (segment2, segment2->p_vaddr);
-
- if (extra_length > 0)
- {
- segment2->p_memsz += extra_length;
- segment2->p_filesz += extra_length;
- }
-
- segment->p_type = PT_NULL;
-
- /* Since we have deleted P we must restart the outer loop. */
- i = 0;
- segment = elf_tdata (ibfd)->phdr;
- break;
- }
- else
- {
- /* Extend SEGMENT to include SEGMENT2 and then delete
- SEGMENT2. */
- extra_length =
- SEGMENT_END (segment2, segment2->p_vaddr)
- - SEGMENT_END (segment, segment->p_vaddr);
-
- if (extra_length > 0)
- {
- segment->p_memsz += extra_length;
- segment->p_filesz += extra_length;
- }
-
- segment2->p_type = PT_NULL;
- }
- }
- }
-
- /* The second scan attempts to assign sections to segments. */
- for (i = 0, segment = elf_tdata (ibfd)->phdr;
- i < num_segments;
- i ++, segment ++)
- {
- unsigned int section_count;
- asection ** sections;
- asection * output_section;
- unsigned int isec;
- bfd_vma matching_lma;
- bfd_vma suggested_lma;
- unsigned int j;
- bfd_size_type amt;
-
- if (segment->p_type == PT_NULL)
- continue;
-
- /* Compute how many sections might be placed into this segment. */
- for (section = ibfd->sections, section_count = 0;
- section != NULL;
- section = section->next)
- if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
- ++section_count;
-
- /* Allocate a segment map big enough to contain
- all of the sections we have selected. */
- amt = sizeof (struct elf_segment_map);
- amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = bfd_alloc (obfd, amt);
- if (map == NULL)
- return FALSE;
-
- /* Initialise the fields of the segment map. Default to
- using the physical address of the segment in the input BFD. */
- map->next = NULL;
- map->p_type = segment->p_type;
- map->p_flags = segment->p_flags;
- map->p_flags_valid = 1;
- map->p_paddr = segment->p_paddr;
- map->p_paddr_valid = 1;
-
- /* Determine if this segment contains the ELF file header
- and if it contains the program headers themselves. */
- map->includes_filehdr = (segment->p_offset == 0
- && segment->p_filesz >= iehdr->e_ehsize);
-
- map->includes_phdrs = 0;
-
- if (! phdr_included || segment->p_type != PT_LOAD)
- {
- map->includes_phdrs =
- (segment->p_offset <= (bfd_vma) iehdr->e_phoff
- && (segment->p_offset + segment->p_filesz
- >= ((bfd_vma) iehdr->e_phoff
- + iehdr->e_phnum * iehdr->e_phentsize)));
-
- if (segment->p_type == PT_LOAD && map->includes_phdrs)
- phdr_included = TRUE;
- }
-
- if (section_count == 0)
- {
- /* Special segments, such as the PT_PHDR segment, may contain
- no sections, but ordinary, loadable segments should contain
- something. They are allowed by the ELF spec however, so only
- a warning is produced. */
- if (segment->p_type == PT_LOAD)
- (*_bfd_error_handler)
- (_("%s: warning: Empty loadable segment detected, is this intentional ?\n"),
- bfd_archive_filename (ibfd));
-
- map->count = 0;
- *pointer_to_map = map;
- pointer_to_map = &map->next;
-
- continue;
- }
-
- /* Now scan the sections in the input BFD again and attempt
- to add their corresponding output sections to the segment map.
- The problem here is how to handle an output section which has
- been moved (ie had its LMA changed). There are four possibilities:
-
- 1. None of the sections have been moved.
- In this case we can continue to use the segment LMA from the
- input BFD.
-
- 2. All of the sections have been moved by the same amount.
- In this case we can change the segment's LMA to match the LMA
- of the first section.
-
- 3. Some of the sections have been moved, others have not.
- In this case those sections which have not been moved can be
- placed in the current segment which will have to have its size,
- and possibly its LMA changed, and a new segment or segments will
- have to be created to contain the other sections.
-
- 4. The sections have been moved, but not by the same amount.
- In this case we can change the segment's LMA to match the LMA
- of the first section and we will have to create a new segment
- or segments to contain the other sections.
-
- In order to save time, we allocate an array to hold the section
- pointers that we are interested in. As these sections get assigned
- to a segment, they are removed from this array. */
-
- /* Gcc 2.96 miscompiles this code on mips. Don't do casting here
- to work around this long long bug. */
- amt = section_count * sizeof (asection *);
- sections = bfd_malloc (amt);
- if (sections == NULL)
- return FALSE;
-
- /* Step One: Scan for segment vs section LMA conflicts.
- Also add the sections to the section array allocated above.
- Also add the sections to the current segment. In the common
- case, where the sections have not been moved, this means that
- we have completely filled the segment, and there is nothing
- more to do. */
- isec = 0;
- matching_lma = 0;
- suggested_lma = 0;
-
- for (j = 0, section = ibfd->sections;
- section != NULL;
- section = section->next)
- {
- if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
- {
- output_section = section->output_section;
-
- sections[j ++] = section;
-
- /* The Solaris native linker always sets p_paddr to 0.
- We try to catch that case here, and set it to the
- correct value. Note - some backends require that
- p_paddr be left as zero. */
- if (segment->p_paddr == 0
- && segment->p_vaddr != 0
- && (! bed->want_p_paddr_set_to_zero)
- && isec == 0
- && output_section->lma != 0
- && (output_section->vma == (segment->p_vaddr
- + (map->includes_filehdr
- ? iehdr->e_ehsize
- : 0)
- + (map->includes_phdrs
- ? (iehdr->e_phnum
- * iehdr->e_phentsize)
- : 0))))
- map->p_paddr = segment->p_vaddr;
-
- /* Match up the physical address of the segment with the
- LMA address of the output section. */
- if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
- || IS_COREFILE_NOTE (segment, section)
- || (bed->want_p_paddr_set_to_zero &&
- IS_CONTAINED_BY_VMA (output_section, segment))
- )
- {
- if (matching_lma == 0)
- matching_lma = output_section->lma;
-
- /* We assume that if the section fits within the segment
- then it does not overlap any other section within that
- segment. */
- map->sections[isec ++] = output_section;
- }
- else if (suggested_lma == 0)
- suggested_lma = output_section->lma;
- }
- }
-
- BFD_ASSERT (j == section_count);
-
- /* Step Two: Adjust the physical address of the current segment,
- if necessary. */
- if (isec == section_count)
- {
- /* All of the sections fitted within the segment as currently
- specified. This is the default case. Add the segment to
- the list of built segments and carry on to process the next
- program header in the input BFD. */
- map->count = section_count;
- *pointer_to_map = map;
- pointer_to_map = &map->next;
-
- free (sections);
- continue;
- }
- else
- {
- if (matching_lma != 0)
- {
- /* At least one section fits inside the current segment.
- Keep it, but modify its physical address to match the
- LMA of the first section that fitted. */
- map->p_paddr = matching_lma;
- }
- else
- {
- /* None of the sections fitted inside the current segment.
- Change the current segment's physical address to match
- the LMA of the first section. */
- map->p_paddr = suggested_lma;
- }
-
- /* Offset the segment physical address from the lma
- to allow for space taken up by elf headers. */
- if (map->includes_filehdr)
- map->p_paddr -= iehdr->e_ehsize;
-
- if (map->includes_phdrs)
- {
- map->p_paddr -= iehdr->e_phnum * iehdr->e_phentsize;
-
- /* iehdr->e_phnum is just an estimate of the number
- of program headers that we will need. Make a note
- here of the number we used and the segment we chose
- to hold these headers, so that we can adjust the
- offset when we know the correct value. */
- phdr_adjust_num = iehdr->e_phnum;
- phdr_adjust_seg = map;
- }
- }
-
- /* Step Three: Loop over the sections again, this time assigning
- those that fit to the current segment and removing them from the
- sections array; but making sure not to leave large gaps. Once all
- possible sections have been assigned to the current segment it is
- added to the list of built segments and if sections still remain
- to be assigned, a new segment is constructed before repeating
- the loop. */
- isec = 0;
- do
- {
- map->count = 0;
- suggested_lma = 0;
-
- /* Fill the current segment with sections that fit. */
- for (j = 0; j < section_count; j++)
- {
- section = sections[j];
-
- if (section == NULL)
- continue;
-
- output_section = section->output_section;
-
- BFD_ASSERT (output_section != NULL);
-
- if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
- || IS_COREFILE_NOTE (segment, section))
- {
- if (map->count == 0)
- {
- /* If the first section in a segment does not start at
- the beginning of the segment, then something is
- wrong. */
- if (output_section->lma !=
- (map->p_paddr
- + (map->includes_filehdr ? iehdr->e_ehsize : 0)
- + (map->includes_phdrs
- ? iehdr->e_phnum * iehdr->e_phentsize
- : 0)))
- abort ();
- }
- else
- {
- asection * prev_sec;
-
- prev_sec = map->sections[map->count - 1];
-
- /* If the gap between the end of the previous section
- and the start of this section is more than
- maxpagesize then we need to start a new segment. */
- if ((BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size,
- maxpagesize)
- < BFD_ALIGN (output_section->lma, maxpagesize))
- || ((prev_sec->lma + prev_sec->_raw_size)
- > output_section->lma))
- {
- if (suggested_lma == 0)
- suggested_lma = output_section->lma;
-
- continue;
- }
- }
-
- map->sections[map->count++] = output_section;
- ++isec;
- sections[j] = NULL;
- section->segment_mark = TRUE;
- }
- else if (suggested_lma == 0)
- suggested_lma = output_section->lma;
- }
-
- BFD_ASSERT (map->count > 0);
-
- /* Add the current segment to the list of built segments. */
- *pointer_to_map = map;
- pointer_to_map = &map->next;
-
- if (isec < section_count)
- {
- /* We still have not allocated all of the sections to
- segments. Create a new segment here, initialise it
- and carry on looping. */
- amt = sizeof (struct elf_segment_map);
- amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = bfd_alloc (obfd, amt);
- if (map == NULL)
- {
- free (sections);
- return FALSE;
- }
-
- /* Initialise the fields of the segment map. Set the physical
- physical address to the LMA of the first section that has
- not yet been assigned. */
- map->next = NULL;
- map->p_type = segment->p_type;
- map->p_flags = segment->p_flags;
- map->p_flags_valid = 1;
- map->p_paddr = suggested_lma;
- map->p_paddr_valid = 1;
- map->includes_filehdr = 0;
- map->includes_phdrs = 0;
- }
- }
- while (isec < section_count);
-
- free (sections);
- }
-
- /* The Solaris linker creates program headers in which all the
- p_paddr fields are zero. When we try to objcopy or strip such a
- file, we get confused. Check for this case, and if we find it
- reset the p_paddr_valid fields. */
- for (map = map_first; map != NULL; map = map->next)
- if (map->p_paddr != 0)
- break;
- if (map == NULL)
- for (map = map_first; map != NULL; map = map->next)
- map->p_paddr_valid = 0;
-
- elf_tdata (obfd)->segment_map = map_first;
-
- /* If we had to estimate the number of program headers that were
- going to be needed, then check our estimate now and adjust
- the offset if necessary. */
- if (phdr_adjust_seg != NULL)
- {
- unsigned int count;
-
- for (count = 0, map = map_first; map != NULL; map = map->next)
- count++;
-
- if (count > phdr_adjust_num)
- phdr_adjust_seg->p_paddr
- -= (count - phdr_adjust_num) * iehdr->e_phentsize;
- }
-
-#if 0
- /* Final Step: Sort the segments into ascending order of physical
- address. */
- if (map_first != NULL)
- {
- struct elf_segment_map *prev;
-
- prev = map_first;
- for (map = map_first->next; map != NULL; prev = map, map = map->next)
- {
- /* Yes I know - its a bubble sort.... */
- if (map->next != NULL && (map->next->p_paddr < map->p_paddr))
- {
- /* Swap map and map->next. */
- prev->next = map->next;
- map->next = map->next->next;
- prev->next->next = map;
-
- /* Restart loop. */
- map = map_first;
- }
- }
- }
-#endif
-
-#undef SEGMENT_END
-#undef SECTION_SIZE
-#undef IS_CONTAINED_BY_VMA
-#undef IS_CONTAINED_BY_LMA
-#undef IS_COREFILE_NOTE
-#undef IS_SOLARIS_PT_INTERP
-#undef INCLUDE_SECTION_IN_SEGMENT
-#undef SEGMENT_AFTER_SEGMENT
-#undef SEGMENT_OVERLAPS
- return TRUE;
-}
-
-/* Copy private section information. This copies over the entsize
- field, and sometimes the info field. */
-
-bfd_boolean
-_bfd_elf_copy_private_section_data (bfd *ibfd,
- asection *isec,
- bfd *obfd,
- asection *osec)
-{
- Elf_Internal_Shdr *ihdr, *ohdr;
-
- if (ibfd->xvec->flavour != bfd_target_elf_flavour
- || obfd->xvec->flavour != bfd_target_elf_flavour)
- return TRUE;
-
- if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
- {
- asection *s;
-
- /* Only set up the segments if there are no more SEC_ALLOC
- sections. FIXME: This won't do the right thing if objcopy is
- used to remove the last SEC_ALLOC section, since objcopy
- won't call this routine in that case. */
- for (s = isec->next; s != NULL; s = s->next)
- if ((s->flags & SEC_ALLOC) != 0)
- break;
- if (s == NULL)
- {
- if (! copy_private_bfd_data (ibfd, obfd))
- return FALSE;
- }
- }
-
- ihdr = &elf_section_data (isec)->this_hdr;
- ohdr = &elf_section_data (osec)->this_hdr;
-
- ohdr->sh_entsize = ihdr->sh_entsize;
-
- if (ihdr->sh_type == SHT_SYMTAB
- || ihdr->sh_type == SHT_DYNSYM
- || ihdr->sh_type == SHT_GNU_verneed
- || ihdr->sh_type == SHT_GNU_verdef)
- ohdr->sh_info = ihdr->sh_info;
-
- /* Set things up for objcopy. The output SHT_GROUP section will
- have its elf_next_in_group pointing back to the input group
- members. */
- elf_next_in_group (osec) = elf_next_in_group (isec);
- elf_group_name (osec) = elf_group_name (isec);
-
- osec->use_rela_p = isec->use_rela_p;
-
- return TRUE;
-}
-
-/* Copy private symbol information. If this symbol is in a section
- which we did not map into a BFD section, try to map the section
- index correctly. We use special macro definitions for the mapped
- section indices; these definitions are interpreted by the
- swap_out_syms function. */
-
-#define MAP_ONESYMTAB (SHN_HIOS + 1)
-#define MAP_DYNSYMTAB (SHN_HIOS + 2)
-#define MAP_STRTAB (SHN_HIOS + 3)
-#define MAP_SHSTRTAB (SHN_HIOS + 4)
-#define MAP_SYM_SHNDX (SHN_HIOS + 5)
-
-bfd_boolean
-_bfd_elf_copy_private_symbol_data (bfd *ibfd,
- asymbol *isymarg,
- bfd *obfd,
- asymbol *osymarg)
-{
- elf_symbol_type *isym, *osym;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- isym = elf_symbol_from (ibfd, isymarg);
- osym = elf_symbol_from (obfd, osymarg);
-
- if (isym != NULL
- && osym != NULL
- && bfd_is_abs_section (isym->symbol.section))
- {
- unsigned int shndx;
-
- shndx = isym->internal_elf_sym.st_shndx;
- if (shndx == elf_onesymtab (ibfd))
- shndx = MAP_ONESYMTAB;
- else if (shndx == elf_dynsymtab (ibfd))
- shndx = MAP_DYNSYMTAB;
- else if (shndx == elf_tdata (ibfd)->strtab_section)
- shndx = MAP_STRTAB;
- else if (shndx == elf_tdata (ibfd)->shstrtab_section)
- shndx = MAP_SHSTRTAB;
- else if (shndx == elf_tdata (ibfd)->symtab_shndx_section)
- shndx = MAP_SYM_SHNDX;
- osym->internal_elf_sym.st_shndx = shndx;
- }
-
- return TRUE;
-}
-
-/* Swap out the symbols. */
-
-static bfd_boolean
-swap_out_syms (bfd *abfd,
- struct bfd_strtab_hash **sttp,
- int relocatable_p)
-{
- const struct elf_backend_data *bed;
- int symcount;
- asymbol **syms;
- struct bfd_strtab_hash *stt;
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Shdr *symtab_shndx_hdr;
- Elf_Internal_Shdr *symstrtab_hdr;
- char *outbound_syms;
- char *outbound_shndx;
- int idx;
- bfd_size_type amt;
- bfd_boolean name_local_sections;
-
- if (!elf_map_symbols (abfd))
- return FALSE;
-
- /* Dump out the symtabs. */
- stt = _bfd_elf_stringtab_init ();
- if (stt == NULL)
- return FALSE;
-
- bed = get_elf_backend_data (abfd);
- symcount = bfd_get_symcount (abfd);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- symtab_hdr->sh_type = SHT_SYMTAB;
- symtab_hdr->sh_entsize = bed->s->sizeof_sym;
- symtab_hdr->sh_size = symtab_hdr->sh_entsize * (symcount + 1);
- symtab_hdr->sh_info = elf_num_locals (abfd) + 1;
- symtab_hdr->sh_addralign = 1 << bed->s->log_file_align;
-
- symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
- symstrtab_hdr->sh_type = SHT_STRTAB;
-
- amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym;
- outbound_syms = bfd_alloc (abfd, amt);
- if (outbound_syms == NULL)
- {
- _bfd_stringtab_free (stt);
- return FALSE;
- }
- symtab_hdr->contents = outbound_syms;
-
- outbound_shndx = NULL;
- symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
- if (symtab_shndx_hdr->sh_name != 0)
- {
- amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
- outbound_shndx = bfd_zalloc (abfd, amt);
- if (outbound_shndx == NULL)
- {
- _bfd_stringtab_free (stt);
- return FALSE;
- }
-
- symtab_shndx_hdr->contents = outbound_shndx;
- symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
- symtab_shndx_hdr->sh_size = amt;
- symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
- symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
- }
-
- /* Now generate the data (for "contents"). */
- {
- /* Fill in zeroth symbol and swap it out. */
- Elf_Internal_Sym sym;
- sym.st_name = 0;
- sym.st_value = 0;
- sym.st_size = 0;
- sym.st_info = 0;
- sym.st_other = 0;
- sym.st_shndx = SHN_UNDEF;
- bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx);
- outbound_syms += bed->s->sizeof_sym;
- if (outbound_shndx != NULL)
- outbound_shndx += sizeof (Elf_External_Sym_Shndx);
- }
-
- name_local_sections
- = (bed->elf_backend_name_local_section_symbols
- && bed->elf_backend_name_local_section_symbols (abfd));
-
- syms = bfd_get_outsymbols (abfd);
- for (idx = 0; idx < symcount; idx++)
- {
- Elf_Internal_Sym sym;
- bfd_vma value = syms[idx]->value;
- elf_symbol_type *type_ptr;
- flagword flags = syms[idx]->flags;
- int type;
-
- if (!name_local_sections
- && (flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM)
- {
- /* Local section symbols have no name. */
- sym.st_name = 0;
- }
- else
- {
- sym.st_name = (unsigned long) _bfd_stringtab_add (stt,
- syms[idx]->name,
- TRUE, FALSE);
- if (sym.st_name == (unsigned long) -1)
- {
- _bfd_stringtab_free (stt);
- return FALSE;
- }
- }
-
- type_ptr = elf_symbol_from (abfd, syms[idx]);
-
- if ((flags & BSF_SECTION_SYM) == 0
- && bfd_is_com_section (syms[idx]->section))
- {
- /* ELF common symbols put the alignment into the `value' field,
- and the size into the `size' field. This is backwards from
- how BFD handles it, so reverse it here. */
- sym.st_size = value;
- if (type_ptr == NULL
- || type_ptr->internal_elf_sym.st_value == 0)
- sym.st_value = value >= 16 ? 16 : (1 << bfd_log2 (value));
- else
- sym.st_value = type_ptr->internal_elf_sym.st_value;
- sym.st_shndx = _bfd_elf_section_from_bfd_section
- (abfd, syms[idx]->section);
- }
- else
- {
- asection *sec = syms[idx]->section;
- int shndx;
-
- if (sec->output_section)
- {
- value += sec->output_offset;
- sec = sec->output_section;
- }
-
- /* Don't add in the section vma for relocatable output. */
- if (! relocatable_p)
- value += sec->vma;
- sym.st_value = value;
- sym.st_size = type_ptr ? type_ptr->internal_elf_sym.st_size : 0;
-
- if (bfd_is_abs_section (sec)
- && type_ptr != NULL
- && type_ptr->internal_elf_sym.st_shndx != 0)
- {
- /* This symbol is in a real ELF section which we did
- not create as a BFD section. Undo the mapping done
- by copy_private_symbol_data. */
- shndx = type_ptr->internal_elf_sym.st_shndx;
- switch (shndx)
- {
- case MAP_ONESYMTAB:
- shndx = elf_onesymtab (abfd);
- break;
- case MAP_DYNSYMTAB:
- shndx = elf_dynsymtab (abfd);
- break;
- case MAP_STRTAB:
- shndx = elf_tdata (abfd)->strtab_section;
- break;
- case MAP_SHSTRTAB:
- shndx = elf_tdata (abfd)->shstrtab_section;
- break;
- case MAP_SYM_SHNDX:
- shndx = elf_tdata (abfd)->symtab_shndx_section;
- break;
- default:
- break;
- }
- }
- else
- {
- shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
-
- if (shndx == -1)
- {
- asection *sec2;
-
- /* Writing this would be a hell of a lot easier if
- we had some decent documentation on bfd, and
- knew what to expect of the library, and what to
- demand of applications. For example, it
- appears that `objcopy' might not set the
- section of a symbol to be a section that is
- actually in the output file. */
- sec2 = bfd_get_section_by_name (abfd, sec->name);
- if (sec2 == NULL)
- {
- _bfd_error_handler (_("\
-Unable to find equivalent output section for symbol '%s' from section '%s'"),
- syms[idx]->name ? syms[idx]->name : "<Local sym>",
- sec->name);
- bfd_set_error (bfd_error_invalid_operation);
- _bfd_stringtab_free (stt);
- return FALSE;
- }
-
- shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
- BFD_ASSERT (shndx != -1);
- }
- }
-
- sym.st_shndx = shndx;
- }
-
- if ((flags & BSF_THREAD_LOCAL) != 0)
- type = STT_TLS;
- else if ((flags & BSF_FUNCTION) != 0)
- type = STT_FUNC;
- else if ((flags & BSF_OBJECT) != 0)
- type = STT_OBJECT;
- else
- type = STT_NOTYPE;
-
- if (syms[idx]->section->flags & SEC_THREAD_LOCAL)
- type = STT_TLS;
-
- /* Processor-specific types. */
- if (type_ptr != NULL
- && bed->elf_backend_get_symbol_type)
- type = ((*bed->elf_backend_get_symbol_type)
- (&type_ptr->internal_elf_sym, type));
-
- if (flags & BSF_SECTION_SYM)
- {
- if (flags & BSF_GLOBAL)
- sym.st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- else
- sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
- }
- else if (bfd_is_com_section (syms[idx]->section))
- sym.st_info = ELF_ST_INFO (STB_GLOBAL, type);
- else if (bfd_is_und_section (syms[idx]->section))
- sym.st_info = ELF_ST_INFO (((flags & BSF_WEAK)
- ? STB_WEAK
- : STB_GLOBAL),
- type);
- else if (flags & BSF_FILE)
- sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
- else
- {
- int bind = STB_LOCAL;
-
- if (flags & BSF_LOCAL)
- bind = STB_LOCAL;
- else if (flags & BSF_WEAK)
- bind = STB_WEAK;
- else if (flags & BSF_GLOBAL)
- bind = STB_GLOBAL;
-
- sym.st_info = ELF_ST_INFO (bind, type);
- }
-
- if (type_ptr != NULL)
- sym.st_other = type_ptr->internal_elf_sym.st_other;
- else
- sym.st_other = 0;
-
- bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx);
- outbound_syms += bed->s->sizeof_sym;
- if (outbound_shndx != NULL)
- outbound_shndx += sizeof (Elf_External_Sym_Shndx);
- }
-
- *sttp = stt;
- symstrtab_hdr->sh_size = _bfd_stringtab_size (stt);
- symstrtab_hdr->sh_type = SHT_STRTAB;
-
- symstrtab_hdr->sh_flags = 0;
- symstrtab_hdr->sh_addr = 0;
- symstrtab_hdr->sh_entsize = 0;
- symstrtab_hdr->sh_link = 0;
- symstrtab_hdr->sh_info = 0;
- symstrtab_hdr->sh_addralign = 1;
-
- return TRUE;
-}
-
-/* Return the number of bytes required to hold the symtab vector.
-
- Note that we base it on the count plus 1, since we will null terminate
- the vector allocated based on this size. However, the ELF symbol table
- always has a dummy entry as symbol #0, so it ends up even. */
-
-long
-_bfd_elf_get_symtab_upper_bound (bfd *abfd)
-{
- long symcount;
- long symtab_size;
- Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
-
- symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
- symtab_size = (symcount + 1) * (sizeof (asymbol *));
- if (symcount > 0)
- symtab_size -= sizeof (asymbol *);
-
- return symtab_size;
-}
-
-long
-_bfd_elf_get_dynamic_symtab_upper_bound (bfd *abfd)
-{
- long symcount;
- long symtab_size;
- Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->dynsymtab_hdr;
-
- if (elf_dynsymtab (abfd) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
- symtab_size = (symcount + 1) * (sizeof (asymbol *));
- if (symcount > 0)
- symtab_size -= sizeof (asymbol *);
-
- return symtab_size;
-}
-
-long
-_bfd_elf_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
- sec_ptr asect)
-{
- return (asect->reloc_count + 1) * sizeof (arelent *);
-}
-
-/* Canonicalize the relocs. */
-
-long
-_bfd_elf_canonicalize_reloc (bfd *abfd,
- sec_ptr section,
- arelent **relptr,
- asymbol **symbols)
-{
- arelent *tblptr;
- unsigned int i;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE))
- return -1;
-
- tblptr = section->relocation;
- for (i = 0; i < section->reloc_count; i++)
- *relptr++ = tblptr++;
-
- *relptr = NULL;
-
- return section->reloc_count;
-}
-
-long
-_bfd_elf_canonicalize_symtab (bfd *abfd, asymbol **allocation)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- long symcount = bed->s->slurp_symbol_table (abfd, allocation, FALSE);
-
- if (symcount >= 0)
- bfd_get_symcount (abfd) = symcount;
- return symcount;
-}
-
-long
-_bfd_elf_canonicalize_dynamic_symtab (bfd *abfd,
- asymbol **allocation)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- long symcount = bed->s->slurp_symbol_table (abfd, allocation, TRUE);
-
- if (symcount >= 0)
- bfd_get_dynamic_symcount (abfd) = symcount;
- return symcount;
-}
-
-/* Return the size required for the dynamic reloc entries. Any
- section that was actually installed in the BFD, and has type
- SHT_REL or SHT_RELA, and uses the dynamic symbol table, is
- considered to be a dynamic reloc section. */
-
-long
-_bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
-{
- long ret;
- asection *s;
-
- if (elf_dynsymtab (abfd) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- ret = sizeof (arelent *);
- for (s = abfd->sections; s != NULL; s = s->next)
- if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
- && (elf_section_data (s)->this_hdr.sh_type == SHT_REL
- || elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
- ret += ((s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize)
- * sizeof (arelent *));
-
- return ret;
-}
-
-/* Canonicalize the dynamic relocation entries. Note that we return
- the dynamic relocations as a single block, although they are
- actually associated with particular sections; the interface, which
- was designed for SunOS style shared libraries, expects that there
- is only one set of dynamic relocs. Any section that was actually
- installed in the BFD, and has type SHT_REL or SHT_RELA, and uses
- the dynamic symbol table, is considered to be a dynamic reloc
- section. */
-
-long
-_bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
- arelent **storage,
- asymbol **syms)
-{
- bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
- asection *s;
- long ret;
-
- if (elf_dynsymtab (abfd) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
- ret = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
- && (elf_section_data (s)->this_hdr.sh_type == SHT_REL
- || elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
- {
- arelent *p;
- long count, i;
-
- if (! (*slurp_relocs) (abfd, s, syms, TRUE))
- return -1;
- count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize;
- p = s->relocation;
- for (i = 0; i < count; i++)
- *storage++ = p++;
- ret += count;
- }
- }
-
- *storage = NULL;
-
- return ret;
-}
-
-/* Read in the version information. */
-
-bfd_boolean
-_bfd_elf_slurp_version_tables (bfd *abfd)
-{
- bfd_byte *contents = NULL;
- bfd_size_type amt;
-
- if (elf_dynverdef (abfd) != 0)
- {
- Elf_Internal_Shdr *hdr;
- Elf_External_Verdef *everdef;
- Elf_Internal_Verdef *iverdef;
- Elf_Internal_Verdef *iverdefarr;
- Elf_Internal_Verdef iverdefmem;
- unsigned int i;
- unsigned int maxidx;
-
- hdr = &elf_tdata (abfd)->dynverdef_hdr;
-
- contents = bfd_malloc (hdr->sh_size);
- if (contents == NULL)
- goto error_return;
- if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
- goto error_return;
-
- /* We know the number of entries in the section but not the maximum
- index. Therefore we have to run through all entries and find
- the maximum. */
- everdef = (Elf_External_Verdef *) contents;
- maxidx = 0;
- for (i = 0; i < hdr->sh_info; ++i)
- {
- _bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem);
-
- if ((iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION)) > maxidx)
- maxidx = iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION);
-
- everdef = ((Elf_External_Verdef *)
- ((bfd_byte *) everdef + iverdefmem.vd_next));
- }
-
- amt = (bfd_size_type) maxidx * sizeof (Elf_Internal_Verdef);
- elf_tdata (abfd)->verdef = bfd_zalloc (abfd, amt);
- if (elf_tdata (abfd)->verdef == NULL)
- goto error_return;
-
- elf_tdata (abfd)->cverdefs = maxidx;
-
- everdef = (Elf_External_Verdef *) contents;
- iverdefarr = elf_tdata (abfd)->verdef;
- for (i = 0; i < hdr->sh_info; i++)
- {
- Elf_External_Verdaux *everdaux;
- Elf_Internal_Verdaux *iverdaux;
- unsigned int j;
-
- _bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem);
-
- iverdef = &iverdefarr[(iverdefmem.vd_ndx & VERSYM_VERSION) - 1];
- memcpy (iverdef, &iverdefmem, sizeof (Elf_Internal_Verdef));
-
- iverdef->vd_bfd = abfd;
-
- amt = (bfd_size_type) iverdef->vd_cnt * sizeof (Elf_Internal_Verdaux);
- iverdef->vd_auxptr = bfd_alloc (abfd, amt);
- if (iverdef->vd_auxptr == NULL)
- goto error_return;
-
- everdaux = ((Elf_External_Verdaux *)
- ((bfd_byte *) everdef + iverdef->vd_aux));
- iverdaux = iverdef->vd_auxptr;
- for (j = 0; j < iverdef->vd_cnt; j++, iverdaux++)
- {
- _bfd_elf_swap_verdaux_in (abfd, everdaux, iverdaux);
-
- iverdaux->vda_nodename =
- bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- iverdaux->vda_name);
- if (iverdaux->vda_nodename == NULL)
- goto error_return;
-
- if (j + 1 < iverdef->vd_cnt)
- iverdaux->vda_nextptr = iverdaux + 1;
- else
- iverdaux->vda_nextptr = NULL;
-
- everdaux = ((Elf_External_Verdaux *)
- ((bfd_byte *) everdaux + iverdaux->vda_next));
- }
-
- iverdef->vd_nodename = iverdef->vd_auxptr->vda_nodename;
-
- if (i + 1 < hdr->sh_info)
- iverdef->vd_nextdef = iverdef + 1;
- else
- iverdef->vd_nextdef = NULL;
-
- everdef = ((Elf_External_Verdef *)
- ((bfd_byte *) everdef + iverdef->vd_next));
- }
-
- free (contents);
- contents = NULL;
- }
-
- if (elf_dynverref (abfd) != 0)
- {
- Elf_Internal_Shdr *hdr;
- Elf_External_Verneed *everneed;
- Elf_Internal_Verneed *iverneed;
- unsigned int i;
-
- hdr = &elf_tdata (abfd)->dynverref_hdr;
-
- amt = (bfd_size_type) hdr->sh_info * sizeof (Elf_Internal_Verneed);
- elf_tdata (abfd)->verref = bfd_zalloc (abfd, amt);
- if (elf_tdata (abfd)->verref == NULL)
- goto error_return;
-
- elf_tdata (abfd)->cverrefs = hdr->sh_info;
-
- contents = bfd_malloc (hdr->sh_size);
- if (contents == NULL)
- goto error_return;
- if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
- goto error_return;
-
- everneed = (Elf_External_Verneed *) contents;
- iverneed = elf_tdata (abfd)->verref;
- for (i = 0; i < hdr->sh_info; i++, iverneed++)
- {
- Elf_External_Vernaux *evernaux;
- Elf_Internal_Vernaux *ivernaux;
- unsigned int j;
-
- _bfd_elf_swap_verneed_in (abfd, everneed, iverneed);
-
- iverneed->vn_bfd = abfd;
-
- iverneed->vn_filename =
- bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- iverneed->vn_file);
- if (iverneed->vn_filename == NULL)
- goto error_return;
-
- amt = iverneed->vn_cnt;
- amt *= sizeof (Elf_Internal_Vernaux);
- iverneed->vn_auxptr = bfd_alloc (abfd, amt);
-
- evernaux = ((Elf_External_Vernaux *)
- ((bfd_byte *) everneed + iverneed->vn_aux));
- ivernaux = iverneed->vn_auxptr;
- for (j = 0; j < iverneed->vn_cnt; j++, ivernaux++)
- {
- _bfd_elf_swap_vernaux_in (abfd, evernaux, ivernaux);
-
- ivernaux->vna_nodename =
- bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- ivernaux->vna_name);
- if (ivernaux->vna_nodename == NULL)
- goto error_return;
-
- if (j + 1 < iverneed->vn_cnt)
- ivernaux->vna_nextptr = ivernaux + 1;
- else
- ivernaux->vna_nextptr = NULL;
-
- evernaux = ((Elf_External_Vernaux *)
- ((bfd_byte *) evernaux + ivernaux->vna_next));
- }
-
- if (i + 1 < hdr->sh_info)
- iverneed->vn_nextref = iverneed + 1;
- else
- iverneed->vn_nextref = NULL;
-
- everneed = ((Elf_External_Verneed *)
- ((bfd_byte *) everneed + iverneed->vn_next));
- }
-
- free (contents);
- contents = NULL;
- }
-
- return TRUE;
-
- error_return:
- if (contents != NULL)
- free (contents);
- return FALSE;
-}
-
-asymbol *
-_bfd_elf_make_empty_symbol (bfd *abfd)
-{
- elf_symbol_type *newsym;
- bfd_size_type amt = sizeof (elf_symbol_type);
-
- newsym = bfd_zalloc (abfd, amt);
- if (!newsym)
- return NULL;
- else
- {
- newsym->symbol.the_bfd = abfd;
- return &newsym->symbol;
- }
-}
-
-void
-_bfd_elf_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
- asymbol *symbol,
- symbol_info *ret)
-{
- bfd_symbol_info (symbol, ret);
-}
-
-/* Return whether a symbol name implies a local symbol. Most targets
- use this function for the is_local_label_name entry point, but some
- override it. */
-
-bfd_boolean
-_bfd_elf_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
- const char *name)
-{
- /* Normal local symbols start with ``.L''. */
- if (name[0] == '.' && name[1] == 'L')
- return TRUE;
-
- /* At least some SVR4 compilers (e.g., UnixWare 2.1 cc) generate
- DWARF debugging symbols starting with ``..''. */
- if (name[0] == '.' && name[1] == '.')
- return TRUE;
-
- /* gcc will sometimes generate symbols beginning with ``_.L_'' when
- emitting DWARF debugging output. I suspect this is actually a
- small bug in gcc (it calls ASM_OUTPUT_LABEL when it should call
- ASM_GENERATE_INTERNAL_LABEL, and this causes the leading
- underscore to be emitted on some ELF targets). For ease of use,
- we treat such symbols as local. */
- if (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_')
- return TRUE;
-
- return FALSE;
-}
-
-alent *
-_bfd_elf_get_lineno (bfd *abfd ATTRIBUTE_UNUSED,
- asymbol *symbol ATTRIBUTE_UNUSED)
-{
- abort ();
- return NULL;
-}
-
-bfd_boolean
-_bfd_elf_set_arch_mach (bfd *abfd,
- enum bfd_architecture arch,
- unsigned long machine)
-{
- /* If this isn't the right architecture for this backend, and this
- isn't the generic backend, fail. */
- if (arch != get_elf_backend_data (abfd)->arch
- && arch != bfd_arch_unknown
- && get_elf_backend_data (abfd)->arch != bfd_arch_unknown)
- return FALSE;
-
- return bfd_default_set_arch_mach (abfd, arch, machine);
-}
-
-/* Find the function to a particular section and offset,
- for error reporting. */
-
-static bfd_boolean
-elf_find_function (bfd *abfd ATTRIBUTE_UNUSED,
- asection *section,
- asymbol **symbols,
- bfd_vma offset,
- const char **filename_ptr,
- const char **functionname_ptr)
-{
- const char *filename;
- asymbol *func;
- bfd_vma low_func;
- asymbol **p;
-
- filename = NULL;
- func = NULL;
- low_func = 0;
-
- for (p = symbols; *p != NULL; p++)
- {
- elf_symbol_type *q;
-
- q = (elf_symbol_type *) *p;
-
- if (bfd_get_section (&q->symbol) != section)
- continue;
-
- switch (ELF_ST_TYPE (q->internal_elf_sym.st_info))
- {
- default:
- break;
- case STT_FILE:
- filename = bfd_asymbol_name (&q->symbol);
- break;
- case STT_NOTYPE:
- case STT_FUNC:
- if (q->symbol.section == section
- && q->symbol.value >= low_func
- && q->symbol.value <= offset)
- {
- func = (asymbol *) q;
- low_func = q->symbol.value;
- }
- break;
- }
- }
-
- if (func == NULL)
- return FALSE;
-
- if (filename_ptr)
- *filename_ptr = filename;
- if (functionname_ptr)
- *functionname_ptr = bfd_asymbol_name (func);
-
- return TRUE;
-}
-
-/* Find the nearest line to a particular section and offset,
- for error reporting. */
-
-bfd_boolean
-_bfd_elf_find_nearest_line (bfd *abfd,
- asection *section,
- asymbol **symbols,
- bfd_vma offset,
- const char **filename_ptr,
- const char **functionname_ptr,
- unsigned int *line_ptr)
-{
- bfd_boolean found;
-
- if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr))
- {
- if (!*functionname_ptr)
- elf_find_function (abfd, section, symbols, offset,
- *filename_ptr ? NULL : filename_ptr,
- functionname_ptr);
-
- return TRUE;
- }
-
- if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr, 0,
- &elf_tdata (abfd)->dwarf2_find_line_info))
- {
- if (!*functionname_ptr)
- elf_find_function (abfd, section, symbols, offset,
- *filename_ptr ? NULL : filename_ptr,
- functionname_ptr);
-
- return TRUE;
- }
-
- if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
- &found, filename_ptr,
- functionname_ptr, line_ptr,
- &elf_tdata (abfd)->line_info))
- return FALSE;
- if (found && (*functionname_ptr || *line_ptr))
- return TRUE;
-
- if (symbols == NULL)
- return FALSE;
-
- if (! elf_find_function (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr))
- return FALSE;
-
- *line_ptr = 0;
- return TRUE;
-}
-
-int
-_bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc)
-{
- int ret;
-
- ret = get_elf_backend_data (abfd)->s->sizeof_ehdr;
- if (! reloc)
- ret += get_program_header_size (abfd);
- return ret;
-}
-
-bfd_boolean
-_bfd_elf_set_section_contents (bfd *abfd,
- sec_ptr section,
- const void *location,
- file_ptr offset,
- bfd_size_type count)
-{
- Elf_Internal_Shdr *hdr;
- bfd_signed_vma pos;
-
- if (! abfd->output_has_begun
- && ! _bfd_elf_compute_section_file_positions (abfd, NULL))
- return FALSE;
-
- hdr = &elf_section_data (section)->this_hdr;
- pos = hdr->sh_offset + offset;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
- return FALSE;
-
- return TRUE;
-}
-
-void
-_bfd_elf_no_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *cache_ptr ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *dst ATTRIBUTE_UNUSED)
-{
- abort ();
-}
-
-/* Try to convert a non-ELF reloc into an ELF one. */
-
-bfd_boolean
-_bfd_elf_validate_reloc (bfd *abfd, arelent *areloc)
-{
- /* Check whether we really have an ELF howto. */
-
- if ((*areloc->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec)
- {
- bfd_reloc_code_real_type code;
- reloc_howto_type *howto;
-
- /* Alien reloc: Try to determine its type to replace it with an
- equivalent ELF reloc. */
-
- if (areloc->howto->pc_relative)
- {
- switch (areloc->howto->bitsize)
- {
- case 8:
- code = BFD_RELOC_8_PCREL;
- break;
- case 12:
- code = BFD_RELOC_12_PCREL;
- break;
- case 16:
- code = BFD_RELOC_16_PCREL;
- break;
- case 24:
- code = BFD_RELOC_24_PCREL;
- break;
- case 32:
- code = BFD_RELOC_32_PCREL;
- break;
- case 64:
- code = BFD_RELOC_64_PCREL;
- break;
- default:
- goto fail;
- }
-
- howto = bfd_reloc_type_lookup (abfd, code);
-
- if (areloc->howto->pcrel_offset != howto->pcrel_offset)
- {
- if (howto->pcrel_offset)
- areloc->addend += areloc->address;
- else
- areloc->addend -= areloc->address; /* addend is unsigned!! */
- }
- }
- else
- {
- switch (areloc->howto->bitsize)
- {
- case 8:
- code = BFD_RELOC_8;
- break;
- case 14:
- code = BFD_RELOC_14;
- break;
- case 16:
- code = BFD_RELOC_16;
- break;
- case 26:
- code = BFD_RELOC_26;
- break;
- case 32:
- code = BFD_RELOC_32;
- break;
- case 64:
- code = BFD_RELOC_64;
- break;
- default:
- goto fail;
- }
-
- howto = bfd_reloc_type_lookup (abfd, code);
- }
-
- if (howto)
- areloc->howto = howto;
- else
- goto fail;
- }
-
- return TRUE;
-
- fail:
- (*_bfd_error_handler)
- (_("%s: unsupported relocation type %s"),
- bfd_archive_filename (abfd), areloc->howto->name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
-}
-
-bfd_boolean
-_bfd_elf_close_and_cleanup (bfd *abfd)
-{
- if (bfd_get_format (abfd) == bfd_object)
- {
- if (elf_shstrtab (abfd) != NULL)
- _bfd_elf_strtab_free (elf_shstrtab (abfd));
- }
-
- return _bfd_generic_close_and_cleanup (abfd);
-}
-
-/* For Rel targets, we encode meaningful data for BFD_RELOC_VTABLE_ENTRY
- in the relocation's offset. Thus we cannot allow any sort of sanity
- range-checking to interfere. There is nothing else to do in processing
- this reloc. */
-
-bfd_reloc_status_type
-_bfd_elf_rel_vtable_reloc_fn
- (bfd *abfd ATTRIBUTE_UNUSED, arelent *re ATTRIBUTE_UNUSED,
- struct bfd_symbol *symbol ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED, asection *is ATTRIBUTE_UNUSED,
- bfd *obfd ATTRIBUTE_UNUSED, char **errmsg ATTRIBUTE_UNUSED)
-{
- return bfd_reloc_ok;
-}
-
-/* Elf core file support. Much of this only works on native
- toolchains, since we rely on knowing the
- machine-dependent procfs structure in order to pick
- out details about the corefile. */
-
-#ifdef HAVE_SYS_PROCFS_H
-# include <sys/procfs.h>
-#endif
-
-/* FIXME: this is kinda wrong, but it's what gdb wants. */
-
-static int
-elfcore_make_pid (bfd *abfd)
-{
- return ((elf_tdata (abfd)->core_lwpid << 16)
- + (elf_tdata (abfd)->core_pid));
-}
-
-/* If there isn't a section called NAME, make one, using
- data from SECT. Note, this function will generate a
- reference to NAME, so you shouldn't deallocate or
- overwrite it. */
-
-static bfd_boolean
-elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect)
-{
- asection *sect2;
-
- if (bfd_get_section_by_name (abfd, name) != NULL)
- return TRUE;
-
- sect2 = bfd_make_section (abfd, name);
- if (sect2 == NULL)
- return FALSE;
-
- sect2->_raw_size = sect->_raw_size;
- sect2->filepos = sect->filepos;
- sect2->flags = sect->flags;
- sect2->alignment_power = sect->alignment_power;
- return TRUE;
-}
-
-/* Create a pseudosection containing SIZE bytes at FILEPOS. This
- actually creates up to two pseudosections:
- - For the single-threaded case, a section named NAME, unless
- such a section already exists.
- - For the multi-threaded case, a section named "NAME/PID", where
- PID is elfcore_make_pid (abfd).
- Both pseudosections have identical contents. */
-bfd_boolean
-_bfd_elfcore_make_pseudosection (bfd *abfd,
- char *name,
- size_t size,
- ufile_ptr filepos)
-{
- char buf[100];
- char *threaded_name;
- size_t len;
- asection *sect;
-
- /* Build the section name. */
-
- sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
- len = strlen (buf) + 1;
- threaded_name = bfd_alloc (abfd, len);
- if (threaded_name == NULL)
- return FALSE;
- memcpy (threaded_name, buf, len);
-
- sect = bfd_make_section_anyway (abfd, threaded_name);
- if (sect == NULL)
- return FALSE;
- sect->_raw_size = size;
- sect->filepos = filepos;
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- return elfcore_maybe_make_sect (abfd, name, sect);
-}
-
-/* prstatus_t exists on:
- solaris 2.5+
- linux 2.[01] + glibc
- unixware 4.2
-*/
-
-#if defined (HAVE_PRSTATUS_T)
-
-static bfd_boolean
-elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- size_t raw_size;
- int offset;
-
- if (note->descsz == sizeof (prstatus_t))
- {
- prstatus_t prstat;
-
- raw_size = sizeof (prstat.pr_reg);
- offset = offsetof (prstatus_t, pr_reg);
- memcpy (&prstat, note->descdata, sizeof (prstat));
-
- /* Do not overwrite the core signal if it
- has already been set by another thread. */
- if (elf_tdata (abfd)->core_signal == 0)
- elf_tdata (abfd)->core_signal = prstat.pr_cursig;
- elf_tdata (abfd)->core_pid = prstat.pr_pid;
-
- /* pr_who exists on:
- solaris 2.5+
- unixware 4.2
- pr_who doesn't exist on:
- linux 2.[01]
- */
-#if defined (HAVE_PRSTATUS_T_PR_WHO)
- elf_tdata (abfd)->core_lwpid = prstat.pr_who;
-#endif
- }
-#if defined (HAVE_PRSTATUS32_T)
- else if (note->descsz == sizeof (prstatus32_t))
- {
- /* 64-bit host, 32-bit corefile */
- prstatus32_t prstat;
-
- raw_size = sizeof (prstat.pr_reg);
- offset = offsetof (prstatus32_t, pr_reg);
- memcpy (&prstat, note->descdata, sizeof (prstat));
-
- /* Do not overwrite the core signal if it
- has already been set by another thread. */
- if (elf_tdata (abfd)->core_signal == 0)
- elf_tdata (abfd)->core_signal = prstat.pr_cursig;
- elf_tdata (abfd)->core_pid = prstat.pr_pid;
-
- /* pr_who exists on:
- solaris 2.5+
- unixware 4.2
- pr_who doesn't exist on:
- linux 2.[01]
- */
-#if defined (HAVE_PRSTATUS32_T_PR_WHO)
- elf_tdata (abfd)->core_lwpid = prstat.pr_who;
-#endif
- }
-#endif /* HAVE_PRSTATUS32_T */
- else
- {
- /* Fail - we don't know how to handle any other
- note size (ie. data object type). */
- return TRUE;
- }
-
- /* Make a ".reg/999" section and a ".reg" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-#endif /* defined (HAVE_PRSTATUS_T) */
-
-/* Create a pseudosection containing the exact contents of NOTE. */
-static bfd_boolean
-elfcore_make_note_pseudosection (bfd *abfd,
- char *name,
- Elf_Internal_Note *note)
-{
- return _bfd_elfcore_make_pseudosection (abfd, name,
- note->descsz, note->descpos);
-}
-
-/* There isn't a consistent prfpregset_t across platforms,
- but it doesn't matter, because we don't have to pick this
- data structure apart. */
-
-static bfd_boolean
-elfcore_grok_prfpreg (bfd *abfd, Elf_Internal_Note *note)
-{
- return elfcore_make_note_pseudosection (abfd, ".reg2", note);
-}
-
-/* Linux dumps the Intel SSE regs in a note named "LINUX" with a note
- type of 5 (NT_PRXFPREG). Just include the whole note's contents
- literally. */
-
-static bfd_boolean
-elfcore_grok_prxfpreg (bfd *abfd, Elf_Internal_Note *note)
-{
- return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note);
-}
-
-#if defined (HAVE_PRPSINFO_T)
-typedef prpsinfo_t elfcore_psinfo_t;
-#if defined (HAVE_PRPSINFO32_T) /* Sparc64 cross Sparc32 */
-typedef prpsinfo32_t elfcore_psinfo32_t;
-#endif
-#endif
-
-#if defined (HAVE_PSINFO_T)
-typedef psinfo_t elfcore_psinfo_t;
-#if defined (HAVE_PSINFO32_T) /* Sparc64 cross Sparc32 */
-typedef psinfo32_t elfcore_psinfo32_t;
-#endif
-#endif
-
-/* return a malloc'ed copy of a string at START which is at
- most MAX bytes long, possibly without a terminating '\0'.
- the copy will always have a terminating '\0'. */
-
-char *
-_bfd_elfcore_strndup (bfd *abfd, char *start, size_t max)
-{
- char *dups;
- char *end = memchr (start, '\0', max);
- size_t len;
-
- if (end == NULL)
- len = max;
- else
- len = end - start;
-
- dups = bfd_alloc (abfd, len + 1);
- if (dups == NULL)
- return NULL;
-
- memcpy (dups, start, len);
- dups[len] = '\0';
-
- return dups;
-}
-
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-static bfd_boolean
-elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- if (note->descsz == sizeof (elfcore_psinfo_t))
- {
- elfcore_psinfo_t psinfo;
-
- memcpy (&psinfo, note->descdata, sizeof (psinfo));
-
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
- sizeof (psinfo.pr_fname));
-
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, psinfo.pr_psargs,
- sizeof (psinfo.pr_psargs));
- }
-#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
- else if (note->descsz == sizeof (elfcore_psinfo32_t))
- {
- /* 64-bit host, 32-bit corefile */
- elfcore_psinfo32_t psinfo;
-
- memcpy (&psinfo, note->descdata, sizeof (psinfo));
-
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
- sizeof (psinfo.pr_fname));
-
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, psinfo.pr_psargs,
- sizeof (psinfo.pr_psargs));
- }
-#endif
-
- else
- {
- /* Fail - we don't know how to handle any other
- note size (ie. data object type). */
- return TRUE;
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-#endif /* defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) */
-
-#if defined (HAVE_PSTATUS_T)
-static bfd_boolean
-elfcore_grok_pstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- if (note->descsz == sizeof (pstatus_t)
-#if defined (HAVE_PXSTATUS_T)
- || note->descsz == sizeof (pxstatus_t)
-#endif
- )
- {
- pstatus_t pstat;
-
- memcpy (&pstat, note->descdata, sizeof (pstat));
-
- elf_tdata (abfd)->core_pid = pstat.pr_pid;
- }
-#if defined (HAVE_PSTATUS32_T)
- else if (note->descsz == sizeof (pstatus32_t))
- {
- /* 64-bit host, 32-bit corefile */
- pstatus32_t pstat;
-
- memcpy (&pstat, note->descdata, sizeof (pstat));
-
- elf_tdata (abfd)->core_pid = pstat.pr_pid;
- }
-#endif
- /* Could grab some more details from the "representative"
- lwpstatus_t in pstat.pr_lwp, but we'll catch it all in an
- NT_LWPSTATUS note, presumably. */
-
- return TRUE;
-}
-#endif /* defined (HAVE_PSTATUS_T) */
-
-#if defined (HAVE_LWPSTATUS_T)
-static bfd_boolean
-elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- lwpstatus_t lwpstat;
- char buf[100];
- char *name;
- size_t len;
- asection *sect;
-
- if (note->descsz != sizeof (lwpstat)
-#if defined (HAVE_LWPXSTATUS_T)
- && note->descsz != sizeof (lwpxstatus_t)
-#endif
- )
- return TRUE;
-
- memcpy (&lwpstat, note->descdata, sizeof (lwpstat));
-
- elf_tdata (abfd)->core_lwpid = lwpstat.pr_lwpid;
- elf_tdata (abfd)->core_signal = lwpstat.pr_cursig;
-
- /* Make a ".reg/999" section. */
-
- sprintf (buf, ".reg/%d", elfcore_make_pid (abfd));
- len = strlen (buf) + 1;
- name = bfd_alloc (abfd, len);
- if (name == NULL)
- return FALSE;
- memcpy (name, buf, len);
-
- sect = bfd_make_section_anyway (abfd, name);
- if (sect == NULL)
- return FALSE;
-
-#if defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
- sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.gregs);
- sect->filepos = note->descpos
- + offsetof (lwpstatus_t, pr_context.uc_mcontext.gregs);
-#endif
-
-#if defined (HAVE_LWPSTATUS_T_PR_REG)
- sect->_raw_size = sizeof (lwpstat.pr_reg);
- sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg);
-#endif
-
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- if (!elfcore_maybe_make_sect (abfd, ".reg", sect))
- return FALSE;
-
- /* Make a ".reg2/999" section */
-
- sprintf (buf, ".reg2/%d", elfcore_make_pid (abfd));
- len = strlen (buf) + 1;
- name = bfd_alloc (abfd, len);
- if (name == NULL)
- return FALSE;
- memcpy (name, buf, len);
-
- sect = bfd_make_section_anyway (abfd, name);
- if (sect == NULL)
- return FALSE;
-
-#if defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
- sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.fpregs);
- sect->filepos = note->descpos
- + offsetof (lwpstatus_t, pr_context.uc_mcontext.fpregs);
-#endif
-
-#if defined (HAVE_LWPSTATUS_T_PR_FPREG)
- sect->_raw_size = sizeof (lwpstat.pr_fpreg);
- sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg);
-#endif
-
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- return elfcore_maybe_make_sect (abfd, ".reg2", sect);
-}
-#endif /* defined (HAVE_LWPSTATUS_T) */
-
-#if defined (HAVE_WIN32_PSTATUS_T)
-static bfd_boolean
-elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- char buf[30];
- char *name;
- size_t len;
- asection *sect;
- win32_pstatus_t pstatus;
-
- if (note->descsz < sizeof (pstatus))
- return TRUE;
-
- memcpy (&pstatus, note->descdata, sizeof (pstatus));
-
- switch (pstatus.data_type)
- {
- case NOTE_INFO_PROCESS:
- /* FIXME: need to add ->core_command. */
- elf_tdata (abfd)->core_signal = pstatus.data.process_info.signal;
- elf_tdata (abfd)->core_pid = pstatus.data.process_info.pid;
- break;
-
- case NOTE_INFO_THREAD:
- /* Make a ".reg/999" section. */
- sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid);
-
- len = strlen (buf) + 1;
- name = bfd_alloc (abfd, len);
- if (name == NULL)
- return FALSE;
-
- memcpy (name, buf, len);
-
- sect = bfd_make_section_anyway (abfd, name);
- if (sect == NULL)
- return FALSE;
-
- sect->_raw_size = sizeof (pstatus.data.thread_info.thread_context);
- sect->filepos = (note->descpos
- + offsetof (struct win32_pstatus,
- data.thread_info.thread_context));
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- if (pstatus.data.thread_info.is_active_thread)
- if (! elfcore_maybe_make_sect (abfd, ".reg", sect))
- return FALSE;
- break;
-
- case NOTE_INFO_MODULE:
- /* Make a ".module/xxxxxxxx" section. */
- sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address);
-
- len = strlen (buf) + 1;
- name = bfd_alloc (abfd, len);
- if (name == NULL)
- return FALSE;
-
- memcpy (name, buf, len);
-
- sect = bfd_make_section_anyway (abfd, name);
-
- if (sect == NULL)
- return FALSE;
-
- sect->_raw_size = note->descsz;
- sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
- break;
-
- default:
- return TRUE;
- }
-
- return TRUE;
-}
-#endif /* HAVE_WIN32_PSTATUS_T */
-
-static bfd_boolean
-elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- switch (note->type)
- {
- default:
- return TRUE;
-
- case NT_PRSTATUS:
- if (bed->elf_backend_grok_prstatus)
- if ((*bed->elf_backend_grok_prstatus) (abfd, note))
- return TRUE;
-#if defined (HAVE_PRSTATUS_T)
- return elfcore_grok_prstatus (abfd, note);
-#else
- return TRUE;
-#endif
-
-#if defined (HAVE_PSTATUS_T)
- case NT_PSTATUS:
- return elfcore_grok_pstatus (abfd, note);
-#endif
-
-#if defined (HAVE_LWPSTATUS_T)
- case NT_LWPSTATUS:
- return elfcore_grok_lwpstatus (abfd, note);
-#endif
-
- case NT_FPREGSET: /* FIXME: rename to NT_PRFPREG */
- return elfcore_grok_prfpreg (abfd, note);
-
-#if defined (HAVE_WIN32_PSTATUS_T)
- case NT_WIN32PSTATUS:
- return elfcore_grok_win32pstatus (abfd, note);
-#endif
-
- case NT_PRXFPREG: /* Linux SSE extension */
- if (note->namesz == 6
- && strcmp (note->namedata, "LINUX") == 0)
- return elfcore_grok_prxfpreg (abfd, note);
- else
- return TRUE;
-
- case NT_PRPSINFO:
- case NT_PSINFO:
- if (bed->elf_backend_grok_psinfo)
- if ((*bed->elf_backend_grok_psinfo) (abfd, note))
- return TRUE;
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
- return elfcore_grok_psinfo (abfd, note);
-#else
- return TRUE;
-#endif
-
- case NT_AUXV:
- {
- asection *sect = bfd_make_section_anyway (abfd, ".auxv");
-
- if (sect == NULL)
- return FALSE;
- sect->_raw_size = note->descsz;
- sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
-
- return TRUE;
- }
- }
-}
-
-static bfd_boolean
-elfcore_netbsd_get_lwpid (Elf_Internal_Note *note, int *lwpidp)
-{
- char *cp;
-
- cp = strchr (note->namedata, '@');
- if (cp != NULL)
- {
- *lwpidp = atoi(cp + 1);
- return TRUE;
- }
- return FALSE;
-}
-
-static bfd_boolean
-elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note)
-{
-
- /* Signal number at offset 0x08. */
- elf_tdata (abfd)->core_signal
- = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x08);
-
- /* Process ID at offset 0x50. */
- elf_tdata (abfd)->core_pid
- = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x50);
-
- /* Command name at 0x7c (max 32 bytes, including nul). */
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 0x7c, 31);
-
- return elfcore_make_note_pseudosection (abfd, ".note.netbsdcore.procinfo",
- note);
-}
-
-static bfd_boolean
-elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
-{
- int lwp;
-
- if (elfcore_netbsd_get_lwpid (note, &lwp))
- elf_tdata (abfd)->core_lwpid = lwp;
-
- if (note->type == NT_NETBSDCORE_PROCINFO)
- {
- /* NetBSD-specific core "procinfo". Note that we expect to
- find this note before any of the others, which is fine,
- since the kernel writes this note out first when it
- creates a core file. */
-
- return elfcore_grok_netbsd_procinfo (abfd, note);
- }
-
- /* As of Jan 2002 there are no other machine-independent notes
- defined for NetBSD core files. If the note type is less
- than the start of the machine-dependent note types, we don't
- understand it. */
-
- if (note->type < NT_NETBSDCORE_FIRSTMACH)
- return TRUE;
-
-
- switch (bfd_get_arch (abfd))
- {
- /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and
- PT_GETFPREGS == mach+2. */
-
- case bfd_arch_alpha:
- case bfd_arch_sparc:
- switch (note->type)
- {
- case NT_NETBSDCORE_FIRSTMACH+0:
- return elfcore_make_note_pseudosection (abfd, ".reg", note);
-
- case NT_NETBSDCORE_FIRSTMACH+2:
- return elfcore_make_note_pseudosection (abfd, ".reg2", note);
-
- default:
- return TRUE;
- }
-
- /* On all other arch's, PT_GETREGS == mach+1 and
- PT_GETFPREGS == mach+3. */
-
- default:
- switch (note->type)
- {
- case NT_NETBSDCORE_FIRSTMACH+1:
- return elfcore_make_note_pseudosection (abfd, ".reg", note);
-
- case NT_NETBSDCORE_FIRSTMACH+3:
- return elfcore_make_note_pseudosection (abfd, ".reg2", note);
-
- default:
- return TRUE;
- }
- }
- /* NOTREACHED */
-}
-
-static bfd_boolean
-elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
-{
- void *ddata = note->descdata;
- char buf[100];
- char *name;
- asection *sect;
- short sig;
- unsigned flags;
-
- /* nto_procfs_status 'pid' field is at offset 0. */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, (bfd_byte *) ddata);
-
- /* nto_procfs_status 'tid' field is at offset 4. Pass it back. */
- *tid = bfd_get_32 (abfd, (bfd_byte *) ddata + 4);
-
- /* nto_procfs_status 'flags' field is at offset 8. */
- flags = bfd_get_32 (abfd, (bfd_byte *) ddata + 8);
-
- /* nto_procfs_status 'what' field is at offset 14. */
- if ((sig = bfd_get_16 (abfd, (bfd_byte *) ddata + 14)) > 0)
- {
- elf_tdata (abfd)->core_signal = sig;
- elf_tdata (abfd)->core_lwpid = *tid;
- }
-
- /* _DEBUG_FLAG_CURTID (current thread) is 0x80. Some cores
- do not come from signals so we make sure we set the current
- thread just in case. */
- if (flags & 0x00000080)
- elf_tdata (abfd)->core_lwpid = *tid;
-
- /* Make a ".qnx_core_status/%d" section. */
- sprintf (buf, ".qnx_core_status/%d", *tid);
-
- name = bfd_alloc (abfd, strlen (buf) + 1);
- if (name == NULL)
- return FALSE;
- strcpy (name, buf);
-
- sect = bfd_make_section_anyway (abfd, name);
- if (sect == NULL)
- return FALSE;
-
- sect->_raw_size = note->descsz;
- sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- return (elfcore_maybe_make_sect (abfd, ".qnx_core_status", sect));
-}
-
-static bfd_boolean
-elfcore_grok_nto_gregs (bfd *abfd, Elf_Internal_Note *note, pid_t tid)
-{
- char buf[100];
- char *name;
- asection *sect;
-
- /* Make a ".reg/%d" section. */
- sprintf (buf, ".reg/%d", tid);
-
- name = bfd_alloc (abfd, strlen (buf) + 1);
- if (name == NULL)
- return FALSE;
- strcpy (name, buf);
-
- sect = bfd_make_section_anyway (abfd, name);
- if (sect == NULL)
- return FALSE;
-
- sect->_raw_size = note->descsz;
- sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- /* This is the current thread. */
- if (elf_tdata (abfd)->core_lwpid == tid)
- return elfcore_maybe_make_sect (abfd, ".reg", sect);
-
- return TRUE;
-}
-
-#define BFD_QNT_CORE_INFO 7
-#define BFD_QNT_CORE_STATUS 8
-#define BFD_QNT_CORE_GREG 9
-#define BFD_QNT_CORE_FPREG 10
-
-static bfd_boolean
-elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note)
-{
- /* Every GREG section has a STATUS section before it. Store the
- tid from the previous call to pass down to the next gregs
- function. */
- static pid_t tid = 1;
-
- switch (note->type)
- {
- case BFD_QNT_CORE_INFO: return elfcore_make_note_pseudosection (abfd, ".qnx_core_info", note);
- case BFD_QNT_CORE_STATUS: return elfcore_grok_nto_status (abfd, note, &tid);
- case BFD_QNT_CORE_GREG: return elfcore_grok_nto_gregs (abfd, note, tid);
- case BFD_QNT_CORE_FPREG: return elfcore_grok_prfpreg (abfd, note);
- default: return TRUE;
- }
-}
-
-/* Function: elfcore_write_note
-
- Inputs:
- buffer to hold note
- name of note
- type of note
- data for note
- size of data for note
-
- Return:
- End of buffer containing note. */
-
-char *
-elfcore_write_note (bfd *abfd,
- char *buf,
- int *bufsiz,
- const char *name,
- int type,
- const void *input,
- int size)
-{
- Elf_External_Note *xnp;
- size_t namesz;
- size_t pad;
- size_t newspace;
- char *p, *dest;
-
- namesz = 0;
- pad = 0;
- if (name != NULL)
- {
- const struct elf_backend_data *bed;
-
- namesz = strlen (name) + 1;
- bed = get_elf_backend_data (abfd);
- pad = -namesz & ((1 << bed->s->log_file_align) - 1);
- }
-
- newspace = 12 + namesz + pad + size;
-
- p = realloc (buf, *bufsiz + newspace);
- dest = p + *bufsiz;
- *bufsiz += newspace;
- xnp = (Elf_External_Note *) dest;
- H_PUT_32 (abfd, namesz, xnp->namesz);
- H_PUT_32 (abfd, size, xnp->descsz);
- H_PUT_32 (abfd, type, xnp->type);
- dest = xnp->name;
- if (name != NULL)
- {
- memcpy (dest, name, namesz);
- dest += namesz;
- while (pad != 0)
- {
- *dest++ = '\0';
- --pad;
- }
- }
- memcpy (dest, input, size);
- return p;
-}
-
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-char *
-elfcore_write_prpsinfo (bfd *abfd,
- char *buf,
- int *bufsiz,
- const char *fname,
- const char *psargs)
-{
- int note_type;
- char *note_name = "CORE";
-
-#if defined (HAVE_PSINFO_T)
- psinfo_t data;
- note_type = NT_PSINFO;
-#else
- prpsinfo_t data;
- note_type = NT_PRPSINFO;
-#endif
-
- memset (&data, 0, sizeof (data));
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
- return elfcore_write_note (abfd, buf, bufsiz,
- note_name, note_type, &data, sizeof (data));
-}
-#endif /* PSINFO_T or PRPSINFO_T */
-
-#if defined (HAVE_PRSTATUS_T)
-char *
-elfcore_write_prstatus (bfd *abfd,
- char *buf,
- int *bufsiz,
- long pid,
- int cursig,
- const void *gregs)
-{
- prstatus_t prstat;
- char *note_name = "CORE";
-
- memset (&prstat, 0, sizeof (prstat));
- prstat.pr_pid = pid;
- prstat.pr_cursig = cursig;
- memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- return elfcore_write_note (abfd, buf, bufsiz,
- note_name, NT_PRSTATUS, &prstat, sizeof (prstat));
-}
-#endif /* HAVE_PRSTATUS_T */
-
-#if defined (HAVE_LWPSTATUS_T)
-char *
-elfcore_write_lwpstatus (bfd *abfd,
- char *buf,
- int *bufsiz,
- long pid,
- int cursig,
- const void *gregs)
-{
- lwpstatus_t lwpstat;
- char *note_name = "CORE";
-
- memset (&lwpstat, 0, sizeof (lwpstat));
- lwpstat.pr_lwpid = pid >> 16;
- lwpstat.pr_cursig = cursig;
-#if defined (HAVE_LWPSTATUS_T_PR_REG)
- memcpy (lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg));
-#elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
-#if !defined(gregs)
- memcpy (lwpstat.pr_context.uc_mcontext.gregs,
- gregs, sizeof (lwpstat.pr_context.uc_mcontext.gregs));
-#else
- memcpy (lwpstat.pr_context.uc_mcontext.__gregs,
- gregs, sizeof (lwpstat.pr_context.uc_mcontext.__gregs));
-#endif
-#endif
- return elfcore_write_note (abfd, buf, bufsiz, note_name,
- NT_LWPSTATUS, &lwpstat, sizeof (lwpstat));
-}
-#endif /* HAVE_LWPSTATUS_T */
-
-#if defined (HAVE_PSTATUS_T)
-char *
-elfcore_write_pstatus (bfd *abfd,
- char *buf,
- int *bufsiz,
- long pid,
- int cursig,
- const void *gregs)
-{
- pstatus_t pstat;
- char *note_name = "CORE";
-
- memset (&pstat, 0, sizeof (pstat));
- pstat.pr_pid = pid & 0xffff;
- buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
- NT_PSTATUS, &pstat, sizeof (pstat));
- return buf;
-}
-#endif /* HAVE_PSTATUS_T */
-
-char *
-elfcore_write_prfpreg (bfd *abfd,
- char *buf,
- int *bufsiz,
- const void *fpregs,
- int size)
-{
- char *note_name = "CORE";
- return elfcore_write_note (abfd, buf, bufsiz,
- note_name, NT_FPREGSET, fpregs, size);
-}
-
-char *
-elfcore_write_prxfpreg (bfd *abfd,
- char *buf,
- int *bufsiz,
- const void *xfpregs,
- int size)
-{
- char *note_name = "LINUX";
- return elfcore_write_note (abfd, buf, bufsiz,
- note_name, NT_PRXFPREG, xfpregs, size);
-}
-
-static bfd_boolean
-elfcore_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size)
-{
- char *buf;
- char *p;
-
- if (size <= 0)
- return TRUE;
-
- if (bfd_seek (abfd, offset, SEEK_SET) != 0)
- return FALSE;
-
- buf = bfd_malloc (size);
- if (buf == NULL)
- return FALSE;
-
- if (bfd_bread (buf, size, abfd) != size)
- {
- error:
- free (buf);
- return FALSE;
- }
-
- p = buf;
- while (p < buf + size)
- {
- /* FIXME: bad alignment assumption. */
- Elf_External_Note *xnp = (Elf_External_Note *) p;
- Elf_Internal_Note in;
-
- in.type = H_GET_32 (abfd, xnp->type);
-
- in.namesz = H_GET_32 (abfd, xnp->namesz);
- in.namedata = xnp->name;
-
- in.descsz = H_GET_32 (abfd, xnp->descsz);
- in.descdata = in.namedata + BFD_ALIGN (in.namesz, 4);
- in.descpos = offset + (in.descdata - buf);
-
- if (strncmp (in.namedata, "NetBSD-CORE", 11) == 0)
- {
- if (! elfcore_grok_netbsd_note (abfd, &in))
- goto error;
- }
- else if (strncmp (in.namedata, "QNX", 3) == 0)
- {
- if (! elfcore_grok_nto_note (abfd, &in))
- goto error;
- }
- else
- {
- if (! elfcore_grok_note (abfd, &in))
- goto error;
- }
-
- p = in.descdata + BFD_ALIGN (in.descsz, 4);
- }
-
- free (buf);
- return TRUE;
-}
-
-/* Providing external access to the ELF program header table. */
-
-/* Return an upper bound on the number of bytes required to store a
- copy of ABFD's program header table entries. Return -1 if an error
- occurs; bfd_get_error will return an appropriate code. */
-
-long
-bfd_get_elf_phdr_upper_bound (bfd *abfd)
-{
- if (abfd->xvec->flavour != bfd_target_elf_flavour)
- {
- bfd_set_error (bfd_error_wrong_format);
- return -1;
- }
-
- return elf_elfheader (abfd)->e_phnum * sizeof (Elf_Internal_Phdr);
-}
-
-/* Copy ABFD's program header table entries to *PHDRS. The entries
- will be stored as an array of Elf_Internal_Phdr structures, as
- defined in include/elf/internal.h. To find out how large the
- buffer needs to be, call bfd_get_elf_phdr_upper_bound.
-
- Return the number of program header table entries read, or -1 if an
- error occurs; bfd_get_error will return an appropriate code. */
-
-int
-bfd_get_elf_phdrs (bfd *abfd, void *phdrs)
-{
- int num_phdrs;
-
- if (abfd->xvec->flavour != bfd_target_elf_flavour)
- {
- bfd_set_error (bfd_error_wrong_format);
- return -1;
- }
-
- num_phdrs = elf_elfheader (abfd)->e_phnum;
- memcpy (phdrs, elf_tdata (abfd)->phdr,
- num_phdrs * sizeof (Elf_Internal_Phdr));
-
- return num_phdrs;
-}
-
-void
-_bfd_elf_sprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, char *buf, bfd_vma value)
-{
-#ifdef BFD64
- Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
-
- i_ehdrp = elf_elfheader (abfd);
- if (i_ehdrp == NULL)
- sprintf_vma (buf, value);
- else
- {
- if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
- {
-#if BFD_HOST_64BIT_LONG
- sprintf (buf, "%016lx", value);
-#else
- sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
- _bfd_int64_low (value));
-#endif
- }
- else
- sprintf (buf, "%08lx", (unsigned long) (value & 0xffffffff));
- }
-#else
- sprintf_vma (buf, value);
-#endif
-}
-
-void
-_bfd_elf_fprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, void *stream, bfd_vma value)
-{
-#ifdef BFD64
- Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
-
- i_ehdrp = elf_elfheader (abfd);
- if (i_ehdrp == NULL)
- fprintf_vma ((FILE *) stream, value);
- else
- {
- if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
- {
-#if BFD_HOST_64BIT_LONG
- fprintf ((FILE *) stream, "%016lx", value);
-#else
- fprintf ((FILE *) stream, "%08lx%08lx",
- _bfd_int64_high (value), _bfd_int64_low (value));
-#endif
- }
- else
- fprintf ((FILE *) stream, "%08lx",
- (unsigned long) (value & 0xffffffff));
- }
-#else
- fprintf_vma ((FILE *) stream, value);
-#endif
-}
-
-enum elf_reloc_type_class
-_bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED)
-{
- return reloc_class_normal;
-}
-
-/* For RELA architectures, return the relocation value for a
- relocation against a local symbol. */
-
-bfd_vma
-_bfd_elf_rela_local_sym (bfd *abfd,
- Elf_Internal_Sym *sym,
- asection **psec,
- Elf_Internal_Rela *rel)
-{
- asection *sec = *psec;
- bfd_vma relocation;
-
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
- {
- rel->r_addend =
- _bfd_merged_section_offset (abfd, psec,
- elf_section_data (sec)->sec_info,
- sym->st_value + rel->r_addend,
- 0);
- sec = *psec;
- rel->r_addend -= relocation;
- rel->r_addend += sec->output_section->vma + sec->output_offset;
- }
- return relocation;
-}
-
-bfd_vma
-_bfd_elf_rel_local_sym (bfd *abfd,
- Elf_Internal_Sym *sym,
- asection **psec,
- bfd_vma addend)
-{
- asection *sec = *psec;
-
- if (sec->sec_info_type != ELF_INFO_TYPE_MERGE)
- return sym->st_value + addend;
-
- return _bfd_merged_section_offset (abfd, psec,
- elf_section_data (sec)->sec_info,
- sym->st_value + addend, 0);
-}
-
-bfd_vma
-_bfd_elf_section_offset (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- bfd_vma offset)
-{
- struct bfd_elf_section_data *sec_data;
-
- sec_data = elf_section_data (sec);
- switch (sec->sec_info_type)
- {
- case ELF_INFO_TYPE_STABS:
- return _bfd_stab_section_offset (abfd,
- &elf_hash_table (info)->merge_info,
- sec, &sec_data->sec_info, offset);
- case ELF_INFO_TYPE_EH_FRAME:
- return _bfd_elf_eh_frame_section_offset (abfd, sec, offset);
- default:
- return offset;
- }
-}
-
-/* Create a new BFD as if by bfd_openr. Rather than opening a file,
- reconstruct an ELF file by reading the segments out of remote memory
- based on the ELF file header at EHDR_VMA and the ELF program headers it
- points to. If not null, *LOADBASEP is filled in with the difference
- between the VMAs from which the segments were read, and the VMAs the
- file headers (and hence BFD's idea of each section's VMA) put them at.
-
- The function TARGET_READ_MEMORY is called to copy LEN bytes from the
- remote memory at target address VMA into the local buffer at MYADDR; it
- should return zero on success or an `errno' code on failure. TEMPL must
- be a BFD for an ELF target with the word size and byte order found in
- the remote memory. */
-
-bfd *
-bfd_elf_bfd_from_remote_memory
- (bfd *templ,
- bfd_vma ehdr_vma,
- bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma, char *, int))
-{
- return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory)
- (templ, ehdr_vma, loadbasep, target_read_memory);
-}
diff --git a/contrib/binutils/bfd/elf32-arc.c b/contrib/binutils/bfd/elf32-arc.c
deleted file mode 100644
index 27c1639..0000000
--- a/contrib/binutils/bfd/elf32-arc.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* ARC-specific support for 32-bit ELF
- Copyright 1994, 1995, 1997, 1999, 2001, 2002
- Free Software Foundation, Inc.
- Contributed by Doug Evans (dje@cygnus.com).
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/arc.h"
-#include "libiberty.h"
-
-static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
- PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-static void arc_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static bfd_boolean arc_elf_object_p
- PARAMS ((bfd *));
-static void arc_elf_final_write_processing
- PARAMS ((bfd *, bfd_boolean));
-static bfd_reloc_status_type arc_elf_b22_pcrel
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
-/* Try to minimize the amount of space occupied by relocation tables
- on the ROM (not that the ROM won't be swamped by other ELF overhead). */
-
-#define USE_REL 1
-
-static reloc_howto_type elf_arc_howto_table[] =
-{
- /* This reloc does nothing. */
- HOWTO (R_ARC_NONE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARC_NONE", /* name */
- TRUE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 32 bit relocation. */
- HOWTO (R_ARC_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARC_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 26 bit absolute branch, right shifted by 2. */
- HOWTO (R_ARC_B26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARC_B26", /* name */
- TRUE, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A relative 22 bit branch; bits 21-2 are stored in bits 26-7. */
- HOWTO (R_ARC_B22_PCREL, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 22, /* bitsize */
- TRUE, /* pc_relative */
- 7, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- arc_elf_b22_pcrel, /* special_function */
- "R_ARC_B22_PCREL", /* name */
- TRUE, /* partial_inplace */
- 0x07ffff80, /* src_mask */
- 0x07ffff80, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* Map BFD reloc types to ARC ELF reloc types. */
-
-struct arc_reloc_map
-{
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
-};
-
-static const struct arc_reloc_map arc_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_ARC_NONE, },
- { BFD_RELOC_32, R_ARC_32 },
- { BFD_RELOC_CTOR, R_ARC_32 },
- { BFD_RELOC_ARC_B26, R_ARC_B26 },
- { BFD_RELOC_ARC_B22_PCREL, R_ARC_B22_PCREL },
-};
-
-static reloc_howto_type *
-bfd_elf32_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- unsigned int i;
-
- for (i = ARRAY_SIZE (arc_reloc_map); i--;)
- if (arc_reloc_map[i].bfd_reloc_val == code)
- return elf_arc_howto_table + arc_reloc_map[i].elf_reloc_val;
-
- return NULL;
-}
-
-/* Set the howto pointer for an ARC ELF reloc. */
-
-static void
-arc_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf_Internal_Rela *dst;
-{
- unsigned int r_type;
-
- r_type = ELF32_R_TYPE (dst->r_info);
- BFD_ASSERT (r_type < (unsigned int) R_ARC_max);
- cache_ptr->howto = &elf_arc_howto_table[r_type];
-}
-
-/* Set the right machine number for an ARC ELF file. */
-
-static bfd_boolean
-arc_elf_object_p (abfd)
- bfd *abfd;
-{
- unsigned int mach = bfd_mach_arc_6;
-
- if (elf_elfheader(abfd)->e_machine == EM_ARC)
- {
- unsigned long arch = elf_elfheader (abfd)->e_flags & EF_ARC_MACH;
-
- switch (arch)
- {
- case E_ARC_MACH_ARC5:
- mach = bfd_mach_arc_5;
- break;
- default:
- case E_ARC_MACH_ARC6:
- mach = bfd_mach_arc_6;
- break;
- case E_ARC_MACH_ARC7:
- mach = bfd_mach_arc_7;
- break;
- case E_ARC_MACH_ARC8:
- mach = bfd_mach_arc_8;
- break;
- }
- }
- return bfd_default_set_arch_mach (abfd, bfd_arch_arc, mach);
-}
-
-/* The final processing done just before writing out an ARC ELF object file.
- This gets the ARC architecture right based on the machine number. */
-
-static void
-arc_elf_final_write_processing (abfd, linker)
- bfd *abfd;
- bfd_boolean linker ATTRIBUTE_UNUSED;
-{
- unsigned long val;
-
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_arc_5:
- val = E_ARC_MACH_ARC5;
- break;
- default:
- case bfd_mach_arc_6:
- val = E_ARC_MACH_ARC6;
- break;
- case bfd_mach_arc_7:
- val = E_ARC_MACH_ARC7;
- break;
- case bfd_mach_arc_8:
- val = E_ARC_MACH_ARC8;
- break;
- }
- elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH;
- elf_elfheader (abfd)->e_flags |= val;
-}
-
-bfd_reloc_status_type
-arc_elf_b22_pcrel (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd * abfd;
- arelent * reloc_entry;
- asymbol * symbol;
- PTR data;
- asection * input_section;
- bfd * output_bfd;
- char ** error_message;
-{
- /* If linking, back up the final symbol address by the address of the
- reloc. This cannot be accomplished by setting the pcrel_offset
- field to TRUE, as bfd_install_relocation will detect this and refuse
- to install the offset in the first place, but bfd_perform_relocation
- will still insist on removing it. */
- if (output_bfd == (bfd *) NULL)
- reloc_entry->addend -= reloc_entry->address;
-
- /* Fall through to the default elf reloc handler. */
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-}
-
-#define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec
-#define TARGET_LITTLE_NAME "elf32-littlearc"
-#define TARGET_BIG_SYM bfd_elf32_bigarc_vec
-#define TARGET_BIG_NAME "elf32-bigarc"
-#define ELF_ARCH bfd_arch_arc
-#define ELF_MACHINE_CODE EM_ARC
-#define ELF_MAXPAGESIZE 0x1000
-
-#define elf_info_to_howto 0
-#define elf_info_to_howto_rel arc_info_to_howto_rel
-#define elf_backend_object_p arc_elf_object_p
-#define elf_backend_final_write_processing arc_elf_final_write_processing
-
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-arm.h b/contrib/binutils/bfd/elf32-arm.h
deleted file mode 100644
index 8c1acc0..0000000
--- a/contrib/binutils/bfd/elf32-arm.h
+++ /dev/null
@@ -1,4108 +0,0 @@
-/* 32-bit ELF support for ARM
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef USE_REL
-#define USE_REL 0
-#endif
-
-typedef unsigned long int insn32;
-typedef unsigned short int insn16;
-
-static bfd_boolean elf32_arm_set_private_flags
- PARAMS ((bfd *, flagword));
-static bfd_boolean elf32_arm_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static bfd_boolean elf32_arm_merge_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static bfd_boolean elf32_arm_print_private_bfd_data
- PARAMS ((bfd *, PTR));
-static int elf32_arm_get_symbol_type
- PARAMS (( Elf_Internal_Sym *, int));
-static struct bfd_link_hash_table *elf32_arm_link_hash_table_create
- PARAMS ((bfd *));
-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 *, int, struct elf_link_hash_entry *));
-static insn32 insert_thumb_branch
- PARAMS ((insn32, int));
-static struct elf_link_hash_entry *find_thumb_glue
- PARAMS ((struct bfd_link_info *, const char *, bfd *));
-static struct elf_link_hash_entry *find_arm_glue
- PARAMS ((struct bfd_link_info *, const char *, bfd *));
-static void elf32_arm_post_process_headers
- PARAMS ((bfd *, struct bfd_link_info *));
-static int elf32_arm_to_thumb_stub
- PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
- bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
-static int elf32_thumb_to_arm_stub
- PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
- bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
-static bfd_boolean elf32_arm_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static asection * elf32_arm_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf32_arm_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-static bfd_boolean elf32_arm_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean elf32_arm_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf32_arm_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static bfd_boolean elf32_arm_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static struct bfd_hash_entry * elf32_arm_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-#if USE_REL
-static void arm_add_to_rel
- PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma));
-#endif
-static bfd_boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *h, PTR inf));
-static bfd_boolean create_got_section
- PARAMS ((bfd * dynobj, struct bfd_link_info * info));
-static bfd_boolean elf32_arm_create_dynamic_sections
- PARAMS ((bfd * dynobj, struct bfd_link_info * info));
-static enum elf_reloc_type_class elf32_arm_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_object_p
- PARAMS ((bfd *));
-
-#ifndef ELFARM_NABI_C_INCLUDED
-static void record_arm_to_thumb_glue
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static void record_thumb_to_arm_glue
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-bfd_boolean bfd_elf32_arm_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
-bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
-bfd_boolean bfd_elf32_arm_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int));
-#endif
-
-
-#define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)
-
-/* The linker script knows the section names for placement.
- The entry_names are used to do simple name mangling on the stubs.
- Given a function name, and its type, the stub can be found. The
- name can be changed. The only requirement is the %s be present. */
-#define THUMB2ARM_GLUE_SECTION_NAME ".glue_7t"
-#define THUMB2ARM_GLUE_ENTRY_NAME "__%s_from_thumb"
-
-#define ARM2THUMB_GLUE_SECTION_NAME ".glue_7"
-#define ARM2THUMB_GLUE_ENTRY_NAME "__%s_from_arm"
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-
-#ifdef FOUR_WORD_PLT
-
-/* The size in bytes of the special first entry in the procedure
- linkage table. */
-#define PLT_HEADER_SIZE 16
-
-/* The size in bytes of an entry in the procedure linkage table. */
-#define PLT_ENTRY_SIZE 16
-
-/* The first entry in a procedure linkage table looks like
- 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 bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] =
- {
- 0xe52de004, /* str lr, [sp, #-4]! */
- 0xe59fe010, /* ldr lr, [pc, #16] */
- 0xe08fe00e, /* add lr, pc, lr */
- 0xe5bef008, /* ldr pc, [lr, #8]! */
- };
-
-/* Subsequent entries in a procedure linkage table look like
- this. */
-static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
- {
- 0xe28fc600, /* add ip, pc, #NN */
- 0xe28cca00, /* add ip, ip, #NN */
- 0xe5bcf000, /* ldr pc, [ip, #NN]! */
- 0x00000000, /* unused */
- };
-
-#else
-
-/* The size in bytes of the special first entry in the procedure
- linkage table. */
-#define PLT_HEADER_SIZE 20
-
-/* The size in bytes of an entry in the procedure linkage table. */
-#define PLT_ENTRY_SIZE 12
-
-/* The first entry in a procedure linkage table looks like
- 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 bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] =
- {
- 0xe52de004, /* str lr, [sp, #-4]! */
- 0xe59fe004, /* ldr lr, [pc, #4] */
- 0xe08fe00e, /* add lr, pc, lr */
- 0xe5bef008, /* ldr pc, [lr, #8]! */
- 0x00000000, /* &GOT[0] - . */
- };
-
-/* Subsequent entries in a procedure linkage table look like
- this. */
-static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
- {
- 0xe28fc600, /* add ip, pc, #0xNN00000 */
- 0xe28cca00, /* add ip, ip, #0xNN000 */
- 0xe5bcf000, /* ldr pc, [ip, #0xNNN]! */
- };
-
-#endif
-
-/* The ARM 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
- it can discard PC relative relocs if it doesn't need them when
- linking with -Bsymbolic. We store the information in a field
- extending the regular ELF linker hash table. */
-
-/* This structure keeps track of the number of PC relative relocs we
- have copied for a given symbol. */
-struct elf32_arm_relocs_copied
- {
- /* Next section. */
- struct elf32_arm_relocs_copied * next;
- /* A section in dynobj. */
- asection * section;
- /* Number of relocs copied in this section. */
- bfd_size_type count;
- };
-
-/* Arm ELF linker hash entry. */
-struct elf32_arm_link_hash_entry
- {
- struct elf_link_hash_entry root;
-
- /* Number of PC relative relocs copied for this symbol. */
- struct elf32_arm_relocs_copied * relocs_copied;
- };
-
-/* Traverse an arm ELF linker hash table. */
-#define elf32_arm_link_hash_traverse(table, func, info) \
- (elf_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the ARM elf linker hash table from a link_info structure. */
-#define elf32_arm_hash_table(info) \
- ((struct elf32_arm_link_hash_table *) ((info)->hash))
-
-/* ARM ELF linker hash table. */
-struct elf32_arm_link_hash_table
- {
- /* The main hash table. */
- struct elf_link_hash_table root;
-
- /* The size in bytes of the section containing the Thumb-to-ARM glue. */
- bfd_size_type thumb_glue_size;
-
- /* The size in bytes of the section containing the ARM-to-Thumb glue. */
- bfd_size_type arm_glue_size;
-
- /* An arbitrary input BFD chosen to hold the glue sections. */
- bfd * bfd_of_glue_owner;
-
- /* A boolean indicating whether knowledge of the ARM's pipeline
- length should be applied by the linker. */
- int no_pipeline_knowledge;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
- asection *sdynbss;
- asection *srelbss;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
- };
-
-/* Create an entry in an ARM ELF linker hash table. */
-
-static struct bfd_hash_entry *
-elf32_arm_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry * entry;
- struct bfd_hash_table * table;
- const char * string;
-{
- struct elf32_arm_link_hash_entry * ret =
- (struct elf32_arm_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct elf32_arm_link_hash_entry *) NULL)
- ret = ((struct elf32_arm_link_hash_entry *)
- bfd_hash_allocate (table,
- sizeof (struct elf32_arm_link_hash_entry)));
- if (ret == (struct elf32_arm_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct elf32_arm_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != (struct elf32_arm_link_hash_entry *) NULL)
- ret->relocs_copied = NULL;
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf32_arm_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf32_arm_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- if (!htab->sgot || !htab->sgotplt)
- abort ();
-
- htab->srelgot = bfd_make_section (dynobj, ".rel.got");
- if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return FALSE;
- return TRUE;
-}
-
-/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and
- .rel.bss sections in DYNOBJ, and set up shortcuts to them in our
- hash table. */
-
-static bfd_boolean
-elf32_arm_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf32_arm_link_hash_table *htab;
-
- htab = elf32_arm_hash_table (info);
- if (!htab->sgot && !create_got_section (dynobj, info))
- return FALSE;
-
- if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
- htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt");
- htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
- if (!info->shared)
- htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss");
-
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
- abort ();
-
- return TRUE;
-}
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-elf32_arm_copy_indirect_symbol (const struct elf_backend_data *bed,
- struct elf_link_hash_entry *dir,
- struct elf_link_hash_entry *ind)
-{
- struct elf32_arm_link_hash_entry *edir, *eind;
-
- edir = (struct elf32_arm_link_hash_entry *) dir;
- eind = (struct elf32_arm_link_hash_entry *) ind;
-
- if (eind->relocs_copied != NULL)
- {
- if (edir->relocs_copied != NULL)
- {
- struct elf32_arm_relocs_copied **pp;
- struct elf32_arm_relocs_copied *p;
-
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->relocs_copied; (p = *pp) != NULL; )
- {
- struct elf32_arm_relocs_copied *q;
-
- for (q = edir->relocs_copied; q != NULL; q = q->next)
- if (q->section == p->section)
- {
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->relocs_copied;
- }
-
- edir->relocs_copied = eind->relocs_copied;
- eind->relocs_copied = NULL;
- }
-
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-}
-
-/* Create an ARM elf linker hash table. */
-
-static struct bfd_link_hash_table *
-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_malloc (amt);
- if (ret == (struct elf32_arm_link_hash_table *) NULL)
- return NULL;
-
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
- elf32_arm_link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- ret->sgot = NULL;
- ret->sgotplt = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->thumb_glue_size = 0;
- ret->arm_glue_size = 0;
- ret->bfd_of_glue_owner = NULL;
- ret->no_pipeline_knowledge = 0;
- ret->sym_sec.abfd = NULL;
-
- return &ret->root.root;
-}
-
-/* Locate the Thumb encoded calling stub for NAME. */
-
-static struct elf_link_hash_entry *
-find_thumb_glue (link_info, name, input_bfd)
- struct bfd_link_info *link_info;
- const char *name;
- bfd *input_bfd;
-{
- char *tmp_name;
- struct elf_link_hash_entry *hash;
- struct elf32_arm_link_hash_table *hash_table;
-
- /* We need a pointer to the armelf specific hash table. */
- hash_table = elf32_arm_hash_table (link_info);
-
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
-
- hash = elf_link_hash_lookup
- (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
-
- if (hash == NULL)
- /* xgettext:c-format */
- (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
-
- free (tmp_name);
-
- return hash;
-}
-
-/* Locate the ARM encoded calling stub for NAME. */
-
-static struct elf_link_hash_entry *
-find_arm_glue (link_info, name, input_bfd)
- struct bfd_link_info *link_info;
- const char *name;
- bfd *input_bfd;
-{
- char *tmp_name;
- struct elf_link_hash_entry *myh;
- struct elf32_arm_link_hash_table *hash_table;
-
- /* We need a pointer to the elfarm specific hash table. */
- hash_table = elf32_arm_hash_table (link_info);
-
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
-
- myh = elf_link_hash_lookup
- (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
-
- if (myh == NULL)
- /* xgettext:c-format */
- (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
-
- free (tmp_name);
-
- return myh;
-}
-
-/* ARM->Thumb glue:
-
- .arm
- __func_from_arm:
- ldr r12, __func_addr
- bx r12
- __func_addr:
- .word func @ behave as if you saw a ARM_32 reloc. */
-
-#define ARM2THUMB_GLUE_SIZE 12
-static const insn32 a2t1_ldr_insn = 0xe59fc000;
-static const insn32 a2t2_bx_r12_insn = 0xe12fff1c;
-static const insn32 a2t3_func_addr_insn = 0x00000001;
-
-/* Thumb->ARM: Thumb->(non-interworking aware) ARM
-
- .thumb .thumb
- .align 2 .align 2
- __func_from_thumb: __func_from_thumb:
- bx pc push {r6, lr}
- nop ldr r6, __func_addr
- .arm mov lr, pc
- __func_change_to_arm: bx r6
- b func .arm
- __func_back_to_thumb:
- ldmia r13! {r6, lr}
- bx lr
- __func_addr:
- .word func */
-
-#define THUMB2ARM_GLUE_SIZE 8
-static const insn16 t2a1_bx_pc_insn = 0x4778;
-static const insn16 t2a2_noop_insn = 0x46c0;
-static const insn32 t2a3_b_insn = 0xea000000;
-
-#ifndef ELFARM_NABI_C_INCLUDED
-bfd_boolean
-bfd_elf32_arm_allocate_interworking_sections (info)
- struct bfd_link_info * info;
-{
- asection * s;
- bfd_byte * foo;
- struct elf32_arm_link_hash_table * globals;
-
- globals = elf32_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
-
- if (globals->arm_glue_size != 0)
- {
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- 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);
-
- s->_raw_size = s->_cooked_size = globals->arm_glue_size;
- s->contents = foo;
- }
-
- if (globals->thumb_glue_size != 0)
- {
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- s = bfd_get_section_by_name
- (globals->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
-
- 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;
- }
-
- return TRUE;
-}
-
-static void
-record_arm_to_thumb_glue (link_info, h)
- struct bfd_link_info * link_info;
- struct elf_link_hash_entry * h;
-{
- const char * name = h->root.root.string;
- asection * s;
- char * tmp_name;
- struct elf_link_hash_entry * myh;
- struct bfd_link_hash_entry * bh;
- struct elf32_arm_link_hash_table * globals;
- bfd_vma val;
-
- globals = elf32_arm_hash_table (link_info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- s = bfd_get_section_by_name
- (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
-
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
-
- myh = elf_link_hash_lookup
- (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
-
- if (myh != NULL)
- {
- /* We've already seen this guy. */
- free (tmp_name);
- return;
- }
-
- /* 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. */
- bh = NULL;
- 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, &bh);
-
- free (tmp_name);
-
- globals->arm_glue_size += ARM2THUMB_GLUE_SIZE;
-
- return;
-}
-
-static void
-record_thumb_to_arm_glue (link_info, h)
- struct bfd_link_info *link_info;
- struct elf_link_hash_entry *h;
-{
- const char *name = h->root.root.string;
- asection *s;
- char *tmp_name;
- struct elf_link_hash_entry *myh;
- struct bfd_link_hash_entry *bh;
- struct elf32_arm_link_hash_table *hash_table;
- char bind;
- bfd_vma val;
-
- hash_table = elf32_arm_hash_table (link_info);
-
- BFD_ASSERT (hash_table != NULL);
- BFD_ASSERT (hash_table->bfd_of_glue_owner != NULL);
-
- s = bfd_get_section_by_name
- (hash_table->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
-
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
-
- myh = elf_link_hash_lookup
- (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
-
- if (myh != NULL)
- {
- /* We've already seen this guy. */
- free (tmp_name);
- return;
- }
-
- bh = NULL;
- 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, &bh);
-
- /* If we mark it 'Thumb', the disassembler will do a better job. */
- myh = (struct elf_link_hash_entry *) bh;
- bind = ELF_ST_BIND (myh->type);
- myh->type = ELF_ST_INFO (bind, STT_ARM_TFUNC);
-
- free (tmp_name);
-
-#define CHANGE_TO_ARM "__%s_change_to_arm"
-#define BACK_FROM_ARM "__%s_back_from_arm"
-
- /* Allocate another symbol to mark where we switch to Arm mode. */
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (CHANGE_TO_ARM) + 1);
-
- BFD_ASSERT (tmp_name);
-
- sprintf (tmp_name, CHANGE_TO_ARM, name);
-
- bh = NULL;
- 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, &bh);
-
- free (tmp_name);
-
- hash_table->thumb_glue_size += THUMB2ARM_GLUE_SIZE;
-
- return;
-}
-
-/* Add the glue sections to ABFD. This function is called from the
- linker scripts in ld/emultempl/{armelf}.em. */
-
-bfd_boolean
-bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- flagword flags;
- asection *sec;
-
- /* If we are only performing a partial
- link do not bother adding the glue. */
- if (info->relocatable)
- return TRUE;
-
- sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-
- if (sec == NULL)
- {
- /* Note: we do not include the flag SEC_LINKER_CREATED, as this
- will prevent elf_link_input_bfd() from processing the contents
- of this section. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-
- if (sec == NULL
- || !bfd_set_section_flags (abfd, sec, flags)
- || !bfd_set_section_alignment (abfd, sec, 2))
- return FALSE;
-
- /* Set the gc mark to prevent the section from being removed by garbage
- collection, despite the fact that no relocs refer to this section. */
- sec->gc_mark = 1;
- }
-
- sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME);
-
- if (sec == NULL)
- {
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
-
- if (sec == NULL
- || !bfd_set_section_flags (abfd, sec, flags)
- || !bfd_set_section_alignment (abfd, sec, 2))
- return FALSE;
-
- sec->gc_mark = 1;
- }
-
- return TRUE;
-}
-
-/* Select a BFD to be used to hold the sections used by the glue code.
- This function is called from the linker scripts in ld/emultempl/
- {armelf/pe}.em */
-
-bfd_boolean
-bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- struct elf32_arm_link_hash_table *globals;
-
- /* If we are only performing a partial link
- do not bother getting a bfd to hold the glue. */
- if (info->relocatable)
- return TRUE;
-
- globals = elf32_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
-
- if (globals->bfd_of_glue_owner != NULL)
- return TRUE;
-
- /* Save the bfd for later use. */
- globals->bfd_of_glue_owner = abfd;
-
- return TRUE;
-}
-
-bfd_boolean
-bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
- bfd *abfd;
- struct bfd_link_info *link_info;
- int no_pipeline_knowledge;
-{
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Rela *internal_relocs = NULL;
- Elf_Internal_Rela *irel, *irelend;
- bfd_byte *contents = NULL;
-
- asection *sec;
- struct elf32_arm_link_hash_table *globals;
-
- /* If we are only performing a partial link do not bother
- to construct any glue. */
- if (link_info->relocatable)
- return TRUE;
-
- /* Here we have a bfd that is to be included on the link. We have a hook
- to do reloc rummaging, before section sizes are nailed down. */
- globals = elf32_arm_hash_table (link_info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- globals->no_pipeline_knowledge = no_pipeline_knowledge;
-
- /* Rummage around all the relocs and map the glue vectors. */
- sec = abfd->sections;
-
- if (sec == NULL)
- return TRUE;
-
- for (; sec != NULL; sec = sec->next)
- {
- if (sec->reloc_count == 0)
- continue;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-
- /* Load the relocs. */
- internal_relocs
- = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL,
- (Elf_Internal_Rela *) NULL, FALSE);
-
- if (internal_relocs == NULL)
- goto error_return;
-
- irelend = internal_relocs + sec->reloc_count;
- for (irel = internal_relocs; irel < irelend; irel++)
- {
- long r_type;
- unsigned long r_index;
-
- struct elf_link_hash_entry *h;
-
- r_type = ELF32_R_TYPE (irel->r_info);
- r_index = ELF32_R_SYM (irel->r_info);
-
- /* These are the only relocation types we care about. */
- if ( r_type != R_ARM_PC24
- && r_type != R_ARM_THM_PC22)
- continue;
-
- /* Get the section contents if we haven't done so already. */
- if (contents == NULL)
- {
- /* Get cached copy if it exists. */
- if (elf_section_data (sec)->this_hdr.contents != NULL)
- contents = elf_section_data (sec)->this_hdr.contents;
- else
- {
- /* Go get them off disk. */
- contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
- if (contents == NULL)
- goto error_return;
-
- if (!bfd_get_section_contents (abfd, sec, contents,
- (file_ptr) 0, sec->_raw_size))
- goto error_return;
- }
- }
-
- /* If the relocation is not against a symbol it cannot concern us. */
- h = NULL;
-
- /* We don't care about local symbols. */
- if (r_index < symtab_hdr->sh_info)
- continue;
-
- /* This is an external symbol. */
- r_index -= symtab_hdr->sh_info;
- h = (struct elf_link_hash_entry *)
- elf_sym_hashes (abfd)[r_index];
-
- /* If the relocation is against a static symbol it must be within
- the current section and so cannot be a cross ARM/Thumb relocation. */
- if (h == NULL)
- continue;
-
- switch (r_type)
- {
- case R_ARM_PC24:
- /* This one is a call from arm code. We need to look up
- the target of the call. If it is a thumb target, we
- insert glue. */
- if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC)
- record_arm_to_thumb_glue (link_info, h);
- break;
-
- case R_ARM_THM_PC22:
- /* This one is a call from thumb code. We look
- up the target of the call. If it is not a thumb
- target, we insert glue. */
- if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC)
- record_thumb_to_arm_glue (link_info, h);
- break;
-
- default:
- break;
- }
- }
-
- if (contents != NULL
- && elf_section_data (sec)->this_hdr.contents != contents)
- free (contents);
- contents = NULL;
-
- if (internal_relocs != NULL
- && elf_section_data (sec)->relocs != internal_relocs)
- free (internal_relocs);
- internal_relocs = NULL;
- }
-
- return TRUE;
-
-error_return:
- if (contents != NULL
- && elf_section_data (sec)->this_hdr.contents != contents)
- free (contents);
- if (internal_relocs != NULL
- && elf_section_data (sec)->relocs != internal_relocs)
- free (internal_relocs);
-
- return FALSE;
-}
-#endif
-
-/* The thumb form of a long branch is a bit finicky, because the offset
- encoding is split over two fields, each in it's own instruction. They
- can occur in any order. So given a thumb form of long branch, and an
- offset, insert the offset into the thumb branch and return finished
- instruction.
-
- It takes two thumb instructions to encode the target address. Each has
- 11 bits to invest. The upper 11 bits are stored in one (identified by
- H-0.. see below), the lower 11 bits are stored in the other (identified
- by H-1).
-
- Combine together and shifted left by 1 (it's a half word address) and
- there you have it.
-
- Op: 1111 = F,
- H-0, upper address-0 = 000
- Op: 1111 = F,
- H-1, lower address-0 = 800
-
- They can be ordered either way, but the arm tools I've seen always put
- the lower one first. It probably doesn't matter. krk@cygnus.com
-
- XXX: Actually the order does matter. The second instruction (H-1)
- moves the computed address into the PC, so it must be the second one
- in the sequence. The problem, however is that whilst little endian code
- stores the instructions in HI then LOW order, big endian code does the
- reverse. nickc@cygnus.com. */
-
-#define LOW_HI_ORDER 0xF800F000
-#define HI_LOW_ORDER 0xF000F800
-
-static insn32
-insert_thumb_branch (br_insn, rel_off)
- insn32 br_insn;
- int rel_off;
-{
- unsigned int low_bits;
- unsigned int high_bits;
-
- BFD_ASSERT ((rel_off & 1) != 1);
-
- rel_off >>= 1; /* Half word aligned address. */
- low_bits = rel_off & 0x000007FF; /* The bottom 11 bits. */
- high_bits = (rel_off >> 11) & 0x000007FF; /* The top 11 bits. */
-
- if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER)
- br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits;
- else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER)
- br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits;
- else
- /* FIXME: abort is probably not the right call. krk@cygnus.com */
- abort (); /* error - not a valid branch instruction form. */
-
- return br_insn;
-}
-
-/* Thumb code calling an ARM function. */
-
-static int
-elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
- hit_data, sym_sec, offset, addend, val)
- struct bfd_link_info * info;
- const char * name;
- bfd * input_bfd;
- bfd * output_bfd;
- asection * input_section;
- bfd_byte * hit_data;
- asection * sym_sec;
- bfd_vma offset;
- bfd_signed_vma addend;
- bfd_vma val;
-{
- asection * s = 0;
- bfd_vma my_offset;
- unsigned long int tmp;
- long int ret_offset;
- struct elf_link_hash_entry * myh;
- struct elf32_arm_link_hash_table * globals;
-
- myh = find_thumb_glue (info, name, input_bfd);
- if (myh == NULL)
- return FALSE;
-
- globals = elf32_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- my_offset = myh->root.u.def.value;
-
- s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
- THUMB2ARM_GLUE_SECTION_NAME);
-
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->contents != NULL);
- BFD_ASSERT (s->output_section != NULL);
-
- if ((my_offset & 0x01) == 0x01)
- {
- if (sym_sec != NULL
- && sym_sec->owner != NULL
- && !INTERWORK_FLAG (sym_sec->owner))
- {
- (*_bfd_error_handler)
- (_("%s(%s): warning: interworking not enabled."),
- bfd_archive_filename (sym_sec->owner), name);
- (*_bfd_error_handler)
- (_(" first occurrence: %s: thumb call to arm"),
- bfd_archive_filename (input_bfd));
-
- return FALSE;
- }
-
- --my_offset;
- myh->root.u.def.value = my_offset;
-
- bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn,
- s->contents + my_offset);
-
- bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn,
- s->contents + my_offset + 2);
-
- ret_offset =
- /* Address of destination of the stub. */
- ((bfd_signed_vma) val)
- - ((bfd_signed_vma)
- /* Offset from the start of the current section to the start of the stubs. */
- (s->output_offset
- /* Offset of the start of this stub from the start of the stubs. */
- + my_offset
- /* Address of the start of the current section. */
- + s->output_section->vma)
- /* The branch instruction is 4 bytes into the stub. */
- + 4
- /* ARM branches work from the pc of the instruction + 8. */
- + 8);
-
- bfd_put_32 (output_bfd,
- (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
- s->contents + my_offset + 4);
- }
-
- BFD_ASSERT (my_offset <= globals->thumb_glue_size);
-
- /* Now go back and fix up the original BL insn to point to here. */
- ret_offset =
- /* Address of where the stub is located. */
- (s->output_section->vma + s->output_offset + my_offset)
- /* Address of where the BL is located. */
- - (input_section->output_section->vma + input_section->output_offset + offset)
- /* Addend in the relocation. */
- - addend
- /* Biassing for PC-relative addressing. */
- - 8;
-
- tmp = bfd_get_32 (input_bfd, hit_data
- - input_section->vma);
-
- bfd_put_32 (output_bfd,
- (bfd_vma) insert_thumb_branch (tmp, ret_offset),
- hit_data - input_section->vma);
-
- return TRUE;
-}
-
-/* Arm code calling a Thumb function. */
-
-static int
-elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
- hit_data, sym_sec, offset, addend, val)
- struct bfd_link_info * info;
- const char * name;
- bfd * input_bfd;
- bfd * output_bfd;
- asection * input_section;
- bfd_byte * hit_data;
- asection * sym_sec;
- bfd_vma offset;
- bfd_signed_vma addend;
- bfd_vma val;
-{
- unsigned long int tmp;
- bfd_vma my_offset;
- asection * s;
- long int ret_offset;
- struct elf_link_hash_entry * myh;
- struct elf32_arm_link_hash_table * globals;
-
- myh = find_arm_glue (info, name, input_bfd);
- if (myh == NULL)
- return FALSE;
-
- globals = elf32_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
- BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-
- my_offset = myh->root.u.def.value;
- s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
- ARM2THUMB_GLUE_SECTION_NAME);
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->contents != NULL);
- BFD_ASSERT (s->output_section != NULL);
-
- if ((my_offset & 0x01) == 0x01)
- {
- if (sym_sec != NULL
- && sym_sec->owner != NULL
- && !INTERWORK_FLAG (sym_sec->owner))
- {
- (*_bfd_error_handler)
- (_("%s(%s): warning: interworking not enabled."),
- bfd_archive_filename (sym_sec->owner), name);
- (*_bfd_error_handler)
- (_(" first occurrence: %s: arm call to thumb"),
- bfd_archive_filename (input_bfd));
- }
-
- --my_offset;
- myh->root.u.def.value = my_offset;
-
- bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn,
- s->contents + my_offset);
-
- 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. */
- bfd_put_32 (output_bfd, val | a2t3_func_addr_insn,
- s->contents + my_offset + 8);
- }
-
- BFD_ASSERT (my_offset <= globals->arm_glue_size);
-
- tmp = bfd_get_32 (input_bfd, hit_data);
- 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);
-
- tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF);
-
- bfd_put_32 (output_bfd, (bfd_vma) tmp, hit_data - input_section->vma);
-
- return TRUE;
-}
-
-/* Perform a relocation as part of a final link. */
-
-static bfd_reloc_status_type
-elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
- input_section, contents, rel, value,
- info, sym_sec, sym_name, sym_flags, h)
- reloc_howto_type * howto;
- bfd * input_bfd;
- bfd * output_bfd;
- asection * input_section;
- bfd_byte * contents;
- Elf_Internal_Rela * rel;
- bfd_vma value;
- struct bfd_link_info * info;
- asection * sym_sec;
- const char * sym_name;
- int sym_flags;
- struct elf_link_hash_entry * h;
-{
- unsigned long r_type = howto->type;
- unsigned long r_symndx;
- bfd_byte * hit_data = contents + rel->r_offset;
- bfd * dynobj = NULL;
- Elf_Internal_Shdr * symtab_hdr;
- struct elf_link_hash_entry ** sym_hashes;
- bfd_vma * local_got_offsets;
- asection * sgot = NULL;
- asection * splt = NULL;
- asection * sreloc = NULL;
- bfd_vma addend;
- bfd_signed_vma signed_addend;
- struct elf32_arm_link_hash_table * globals;
-
- /* If the start address has been set, then set the EF_ARM_HASENTRY
- flag. Setting this more than once is redundant, but the cost is
- not too high, and it keeps the code simple.
-
- The test is done here, rather than somewhere else, because the
- start address is only set just before the final link commences.
-
- Note - if the user deliberately sets a start address of 0, the
- flag will not be set. */
- if (bfd_get_start_address (output_bfd) != 0)
- elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY;
-
- globals = elf32_arm_hash_table (info);
-
- dynobj = elf_hash_table (info)->dynobj;
- if (dynobj)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- splt = bfd_get_section_by_name (dynobj, ".plt");
- }
- symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
- r_symndx = ELF32_R_SYM (rel->r_info);
-
-#if USE_REL
- addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask;
-
- if (addend & ((howto->src_mask + 1) >> 1))
- {
- signed_addend = -1;
- signed_addend &= ~ howto->src_mask;
- signed_addend |= addend;
- }
- else
- signed_addend = addend;
-#else
- addend = signed_addend = rel->r_addend;
-#endif
-
- switch (r_type)
- {
- case R_ARM_NONE:
- return bfd_reloc_ok;
-
- case R_ARM_PC24:
- case R_ARM_ABS32:
- case R_ARM_REL32:
-#ifndef OLD_ARM_ABI
- case R_ARM_XPC25:
-#endif
- case R_ARM_PLT32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0)
- return bfd_reloc_ok;
-
- /* Handle relocations which should use the PLT entry. ABS32/REL32
- will use the symbol's value, which may point to a PLT entry, but we
- don't need to handle that here. If we created a PLT entry, all
- branches in this object should go to it. */
- if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32)
- && h != NULL
- && splt != NULL
- && h->plt.offset != (bfd_vma) -1)
- {
- /* If we've created a .plt section, and assigned a PLT entry to
- this function, it should not be known to bind locally. If
- it were, we would have cleared the PLT entry. */
- BFD_ASSERT (!SYMBOL_CALLS_LOCAL (info, h));
-
- value = (splt->output_section->vma
- + splt->output_offset
- + h->plt.offset);
- return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
- }
-
- /* When generating a shared object, these relocations are copied
- into the output file to be resolved at run time. */
- if (info->shared
- && (input_section->flags & SEC_ALLOC)
- && (r_type != R_ARM_REL32
- || !SYMBOL_CALLS_LOCAL (info, h))
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && r_type != R_ARM_PC24
- && r_type != R_ARM_PLT32)
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- bfd_boolean skip, relocate;
-
- if (sreloc == NULL)
- {
- const char * name;
-
- name = (bfd_elf_string_from_elf_section
- (input_bfd,
- elf_elfheader (input_bfd)->e_shstrndx,
- elf_section_data (input_section)->rel_hdr.sh_name));
- if (name == NULL)
- return bfd_reloc_notsupported;
-
- BFD_ASSERT (strncmp (name, ".rel", 4) == 0
- && strcmp (bfd_get_section_name (input_bfd,
- input_section),
- name + 4) == 0);
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- BFD_ASSERT (sreloc != NULL);
- }
-
- skip = FALSE;
- relocate = FALSE;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
- && h->dynindx != -1
- && (!info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
- else
- {
- /* This symbol is local, or marked to become local. */
- relocate = TRUE;
- outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- }
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
-
- /* If this reloc is against an external symbol, we do not want to
- fiddle with the addend. Otherwise, we need to include the symbol
- value so that it becomes an addend for the dynamic reloc. */
- if (! relocate)
- return bfd_reloc_ok;
-
- return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
- }
- else switch (r_type)
- {
-#ifndef OLD_ARM_ABI
- case R_ARM_XPC25: /* Arm BLX instruction. */
-#endif
- case R_ARM_PC24: /* Arm B/BL instruction */
- case R_ARM_PLT32:
-#ifndef OLD_ARM_ABI
- if (r_type == R_ARM_XPC25)
- {
- /* Check for Arm calling Arm function. */
- /* FIXME: Should we translate the instruction into a BL
- instruction instead ? */
- if (sym_flags != STT_ARM_TFUNC)
- (*_bfd_error_handler) (_("\
-%s: Warning: Arm BLX instruction targets Arm function '%s'."),
- bfd_archive_filename (input_bfd),
- h ? h->root.root.string : "(local)");
- }
- else
-#endif
- {
- /* Check for Arm calling Thumb function. */
- if (sym_flags == STT_ARM_TFUNC)
- {
- elf32_arm_to_thumb_stub (info, sym_name, input_bfd, output_bfd,
- input_section, hit_data, sym_sec, rel->r_offset,
- signed_addend, value);
- return bfd_reloc_ok;
- }
- }
-
- if ( strcmp (bfd_get_target (input_bfd), "elf32-littlearm-oabi") == 0
- || strcmp (bfd_get_target (input_bfd), "elf32-bigarm-oabi") == 0)
- {
- /* The old way of doing things. Trearing the addend as a
- byte sized field and adding in the pipeline offset. */
- value -= (input_section->output_section->vma
- + input_section->output_offset);
- value -= rel->r_offset;
- value += addend;
-
- if (! globals->no_pipeline_knowledge)
- value -= 8;
- }
- else
- {
- /* The ARM ELF ABI says that this reloc is computed as: S - P + A
- where:
- S is the address of the symbol in the relocation.
- P is address of the instruction being relocated.
- A is the addend (extracted from the instruction) in bytes.
-
- S is held in 'value'.
- P is the base address of the section containing the instruction
- plus the offset of the reloc into that section, ie:
- (input_section->output_section->vma +
- input_section->output_offset +
- rel->r_offset).
- A is the addend, converted into bytes, ie:
- (signed_addend * 4)
-
- Note: None of these operations have knowledge of the pipeline
- size of the processor, thus it is up to the assembler to encode
- this information into the addend. */
- value -= (input_section->output_section->vma
- + input_section->output_offset);
- value -= rel->r_offset;
- value += (signed_addend << howto->size);
-
- /* Previous versions of this code also used to add in the pipeline
- offset here. This is wrong because the linker is not supposed
- to know about such things, and one day it might change. In order
- to support old binaries that need the old behaviour however, so
- we attempt to detect which ABI was used to create the reloc. */
- if (! globals->no_pipeline_knowledge)
- {
- Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form */
-
- i_ehdrp = elf_elfheader (input_bfd);
-
- if (i_ehdrp->e_ident[EI_OSABI] == 0)
- value -= 8;
- }
- }
-
- signed_addend = value;
- signed_addend >>= howto->rightshift;
-
- /* It is not an error for an undefined weak reference to be
- out of range. Any program that branches to such a symbol
- is going to crash anyway, so there is no point worrying
- about getting the destination exactly right. */
- if (! h || h->root.type != bfd_link_hash_undefweak)
- {
- /* Perform a signed range check. */
- if ( signed_addend > ((bfd_signed_vma) (howto->dst_mask >> 1))
- || signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1)))
- return bfd_reloc_overflow;
- }
-
-#ifndef OLD_ARM_ABI
- /* If necessary set the H bit in the BLX instruction. */
- if (r_type == R_ARM_XPC25 && ((value & 2) == 2))
- value = (signed_addend & howto->dst_mask)
- | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask))
- | (1 << 24);
- else
-#endif
- value = (signed_addend & howto->dst_mask)
- | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
- break;
-
- case R_ARM_ABS32:
- value += addend;
- if (sym_flags == STT_ARM_TFUNC)
- value |= 1;
- break;
-
- case R_ARM_REL32:
- value -= (input_section->output_section->vma
- + input_section->output_offset + rel->r_offset);
- value += addend;
- break;
- }
-
- bfd_put_32 (input_bfd, value, hit_data);
- return bfd_reloc_ok;
-
- case R_ARM_ABS8:
- value += addend;
- if ((long) value > 0x7f || (long) value < -0x80)
- return bfd_reloc_overflow;
-
- bfd_put_8 (input_bfd, value, hit_data);
- return bfd_reloc_ok;
-
- case R_ARM_ABS16:
- value += addend;
-
- if ((long) value > 0x7fff || (long) value < -0x8000)
- return bfd_reloc_overflow;
-
- bfd_put_16 (input_bfd, value, hit_data);
- return bfd_reloc_ok;
-
- case R_ARM_ABS12:
- /* Support ldr and str instruction for the arm */
- /* Also thumb b (unconditional branch). ??? Really? */
- value += addend;
-
- if ((long) value > 0x7ff || (long) value < -0x800)
- return bfd_reloc_overflow;
-
- value |= (bfd_get_32 (input_bfd, hit_data) & 0xfffff000);
- bfd_put_32 (input_bfd, value, hit_data);
- return bfd_reloc_ok;
-
- case R_ARM_THM_ABS5:
- /* Support ldr and str instructions for the thumb. */
-#if USE_REL
- /* Need to refetch addend. */
- addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
- /* ??? Need to determine shift amount from operand size. */
- addend >>= howto->rightshift;
-#endif
- value += addend;
-
- /* ??? Isn't value unsigned? */
- if ((long) value > 0x1f || (long) value < -0x10)
- return bfd_reloc_overflow;
-
- /* ??? Value needs to be properly shifted into place first. */
- value |= bfd_get_16 (input_bfd, hit_data) & 0xf83f;
- bfd_put_16 (input_bfd, value, hit_data);
- return bfd_reloc_ok;
-
-#ifndef OLD_ARM_ABI
- case R_ARM_THM_XPC22:
-#endif
- case R_ARM_THM_PC22:
- /* Thumb BL (branch long instruction). */
- {
- bfd_vma relocation;
- bfd_boolean overflow = FALSE;
- bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data);
- bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
- bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift;
- bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
- bfd_vma check;
- bfd_signed_vma signed_check;
-
-#if USE_REL
- /* Need to refetch the addend and squish the two 11 bit pieces
- together. */
- {
- bfd_vma upper = upper_insn & 0x7ff;
- bfd_vma lower = lower_insn & 0x7ff;
- upper = (upper ^ 0x400) - 0x400; /* Sign extend. */
- addend = (upper << 12) | (lower << 1);
- signed_addend = addend;
- }
-#endif
-#ifndef OLD_ARM_ABI
- if (r_type == R_ARM_THM_XPC22)
- {
- /* Check for Thumb to Thumb call. */
- /* FIXME: Should we translate the instruction into a BL
- instruction instead ? */
- if (sym_flags == STT_ARM_TFUNC)
- (*_bfd_error_handler) (_("\
-%s: Warning: Thumb BLX instruction targets thumb function '%s'."),
- bfd_archive_filename (input_bfd),
- h ? h->root.root.string : "(local)");
- }
- else
-#endif
- {
- /* If it is not a call to Thumb, assume call to Arm.
- If it is a call relative to a section name, then it is not a
- function call at all, but rather a long jump. */
- if (sym_flags != STT_ARM_TFUNC && sym_flags != STT_SECTION)
- {
- if (elf32_thumb_to_arm_stub
- (info, sym_name, input_bfd, output_bfd, input_section,
- hit_data, sym_sec, rel->r_offset, signed_addend, value))
- return bfd_reloc_ok;
- else
- return bfd_reloc_dangerous;
- }
- }
-
- relocation = value + signed_addend;
-
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
-
- if (! globals->no_pipeline_knowledge)
- {
- Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form. */
-
- i_ehdrp = elf_elfheader (input_bfd);
-
- /* Previous versions of this code also used to add in the pipline
- offset here. This is wrong because the linker is not supposed
- to know about such things, and one day it might change. In order
- to support old binaries that need the old behaviour however, so
- we attempt to detect which ABI was used to create the reloc. */
- if ( strcmp (bfd_get_target (input_bfd), "elf32-littlearm-oabi") == 0
- || strcmp (bfd_get_target (input_bfd), "elf32-bigarm-oabi") == 0
- || i_ehdrp->e_ident[EI_OSABI] == 0)
- relocation += 4;
- }
-
- check = relocation >> howto->rightshift;
-
- /* If this is a signed value, the rightshift just dropped
- leading 1 bits (assuming twos complement). */
- if ((bfd_signed_vma) relocation >= 0)
- signed_check = check;
- else
- signed_check = check | ~((bfd_vma) -1 >> howto->rightshift);
-
- /* Assumes two's complement. */
- if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
- overflow = TRUE;
-
-#ifndef OLD_ARM_ABI
- if (r_type == R_ARM_THM_XPC22
- && ((lower_insn & 0x1800) == 0x0800))
- /* For a BLX instruction, make sure that the relocation is rounded up
- to a word boundary. This follows the semantics of the instruction
- which specifies that bit 1 of the target address will come from bit
- 1 of the base address. */
- relocation = (relocation + 2) & ~ 3;
-#endif
- /* Put RELOCATION back into the insn. */
- upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff);
- lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff);
-
- /* Put the relocated value back in the object file: */
- bfd_put_16 (input_bfd, upper_insn, hit_data);
- bfd_put_16 (input_bfd, lower_insn, hit_data + 2);
-
- return (overflow ? bfd_reloc_overflow : bfd_reloc_ok);
- }
- break;
-
- case R_ARM_THM_PC11:
- /* Thumb B (branch) instruction). */
- {
- bfd_signed_vma relocation;
- bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
- bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
- bfd_signed_vma signed_check;
-
-#if USE_REL
- /* Need to refetch addend. */
- addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
- if (addend & ((howto->src_mask + 1) >> 1))
- {
- signed_addend = -1;
- signed_addend &= ~ howto->src_mask;
- signed_addend |= addend;
- }
- else
- signed_addend = addend;
- /* The value in the insn has been right shifted. We need to
- undo this, so that we can perform the address calculation
- in terms of bytes. */
- signed_addend <<= howto->rightshift;
-#endif
- relocation = value + signed_addend;
-
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
-
- relocation >>= howto->rightshift;
- signed_check = relocation;
- relocation &= howto->dst_mask;
- relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask));
-
- bfd_put_16 (input_bfd, relocation, hit_data);
-
- /* Assumes two's complement. */
- if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
- return bfd_reloc_overflow;
-
- return bfd_reloc_ok;
- }
-
- case R_ARM_GNU_VTINHERIT:
- case R_ARM_GNU_VTENTRY:
- return bfd_reloc_ok;
-
- case R_ARM_COPY:
- return bfd_reloc_notsupported;
-
- case R_ARM_GLOB_DAT:
- return bfd_reloc_notsupported;
-
- case R_ARM_JUMP_SLOT:
- return bfd_reloc_notsupported;
-
- case R_ARM_RELATIVE:
- return bfd_reloc_notsupported;
-
- case R_ARM_GOTOFF:
- /* Relocation is relative to the start of the
- global offset table. */
-
- BFD_ASSERT (sgot != NULL);
- if (sgot == NULL)
- return bfd_reloc_notsupported;
-
- /* If we are addressing a Thumb function, we need to adjust the
- address by one, so that attempts to call the function pointer will
- correctly interpret it as Thumb code. */
- if (sym_flags == STT_ARM_TFUNC)
- value += 1;
-
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- define _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- value -= sgot->output_section->vma;
- return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
-
- case R_ARM_GOTPC:
- /* Use global offset table as symbol value. */
- BFD_ASSERT (sgot != NULL);
-
- if (sgot == NULL)
- return bfd_reloc_notsupported;
-
- value = sgot->output_section->vma;
- return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
-
- case R_ARM_GOT32:
- /* Relocation is to the entry for this symbol in the
- global offset table. */
- if (sgot == NULL)
- return bfd_reloc_notsupported;
-
- if (h != NULL)
- {
- bfd_vma off;
- bfd_boolean dyn;
-
- off = h->got.offset;
- BFD_ASSERT (off != (bfd_vma) -1);
- dyn = globals->root.dynamic_sections_created;
-
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h))
- || (ELF_ST_VISIBILITY (h->other)
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This is actually a static link, or it is a -Bsymbolic link
- and the symbol is defined locally. We must initialize this
- entry in the global offset table. Since the offset must
- always be a multiple of 4, we use the least significant bit
- to record whether we have initialized it already.
-
- When doing a dynamic link, we create a .rel.got relocation
- entry to initialize the value. This is done in the
- finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- /* If we are addressing a Thumb function, we need to
- adjust the address by one, so that attempts to
- call the function pointer will correctly
- interpret it as Thumb code. */
- if (sym_flags == STT_ARM_TFUNC)
- value |= 1;
-
- bfd_put_32 (output_bfd, value, sgot->contents + off);
- h->got.offset |= 1;
- }
- }
-
- value = sgot->output_offset + off;
- }
- else
- {
- bfd_vma off;
-
- BFD_ASSERT (local_got_offsets != NULL &&
- local_got_offsets[r_symndx] != (bfd_vma) -1);
-
- off = local_got_offsets[r_symndx];
-
- /* The offset must always be a multiple of 4. We use the
- least significant bit to record whether we have already
- generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_32 (output_bfd, value, sgot->contents + off);
-
- if (info->shared)
- {
- asection * srelgot;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
- BFD_ASSERT (srelgot != NULL);
-
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + off);
- outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- loc = srelgot->contents;
- loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- }
-
- local_got_offsets[r_symndx] |= 1;
- }
-
- value = sgot->output_offset + off;
- }
-
- return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
-
- case R_ARM_SBREL32:
- return bfd_reloc_notsupported;
-
- case R_ARM_AMP_VCALL9:
- return bfd_reloc_notsupported;
-
- case R_ARM_RSBREL32:
- return bfd_reloc_notsupported;
-
- case R_ARM_THM_RPC22:
- return bfd_reloc_notsupported;
-
- case R_ARM_RREL32:
- return bfd_reloc_notsupported;
-
- case R_ARM_RABS32:
- return bfd_reloc_notsupported;
-
- case R_ARM_RPC24:
- return bfd_reloc_notsupported;
-
- case R_ARM_RBASE:
- return bfd_reloc_notsupported;
-
- default:
- return bfd_reloc_notsupported;
- }
-}
-
-#if USE_REL
-/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */
-static void
-arm_add_to_rel (abfd, address, howto, increment)
- bfd * abfd;
- bfd_byte * address;
- reloc_howto_type * howto;
- bfd_signed_vma increment;
-{
- bfd_signed_vma addend;
-
- if (howto->type == R_ARM_THM_PC22)
- {
- int upper_insn, lower_insn;
- int upper, lower;
-
- upper_insn = bfd_get_16 (abfd, address);
- lower_insn = bfd_get_16 (abfd, address + 2);
- upper = upper_insn & 0x7ff;
- lower = lower_insn & 0x7ff;
-
- addend = (upper << 12) | (lower << 1);
- addend += increment;
- addend >>= 1;
-
- upper_insn = (upper_insn & 0xf800) | ((addend >> 11) & 0x7ff);
- lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff);
-
- bfd_put_16 (abfd, (bfd_vma) upper_insn, address);
- bfd_put_16 (abfd, (bfd_vma) lower_insn, address + 2);
- }
- else
- {
- bfd_vma contents;
-
- contents = bfd_get_32 (abfd, address);
-
- /* Get the (signed) value from the instruction. */
- addend = contents & howto->src_mask;
- if (addend & ((howto->src_mask + 1) >> 1))
- {
- bfd_signed_vma mask;
-
- mask = -1;
- mask &= ~ howto->src_mask;
- addend |= mask;
- }
-
- /* Add in the increment, (which is a byte value). */
- switch (howto->type)
- {
- default:
- addend += increment;
- break;
-
- case R_ARM_PC24:
- addend <<= howto->size;
- addend += increment;
-
- /* Should we check for overflow here ? */
-
- /* Drop any undesired bits. */
- addend >>= howto->rightshift;
- break;
- }
-
- contents = (contents & ~ howto->dst_mask) | (addend & howto->dst_mask);
-
- bfd_put_32 (abfd, contents, address);
- }
-}
-#endif /* USE_REL */
-
-/* Relocate an ARM ELF section. */
-static bfd_boolean
-elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
- const char *name;
-
-#if !USE_REL
- if (info->relocatable)
- return TRUE;
-#endif
-
- symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- int r_type;
- reloc_howto_type * howto;
- unsigned long r_symndx;
- Elf_Internal_Sym * sym;
- asection * sec;
- struct elf_link_hash_entry * h;
- bfd_vma relocation;
- bfd_reloc_status_type r;
- arelent bfd_reloc;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- r_type = ELF32_R_TYPE (rel->r_info);
-
- if ( r_type == R_ARM_GNU_VTENTRY
- || r_type == R_ARM_GNU_VTINHERIT)
- continue;
-
- elf32_arm_info_to_howto (input_bfd, & bfd_reloc, rel);
- howto = bfd_reloc.howto;
-
-#if USE_REL
- if (info->relocatable)
- {
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- arm_add_to_rel (input_bfd, contents + rel->r_offset,
- howto,
- (bfd_signed_vma) (sec->output_offset
- + sym->st_value));
- }
- }
-
- continue;
- }
-#endif
-
- /* This is a final link. */
- h = NULL;
- sym = NULL;
- sec = NULL;
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
-#if USE_REL
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- asection *msec;
- bfd_vma addend, value;
-
- if (howto->rightshift)
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset, howto->name);
- return FALSE;
- }
-
- value = bfd_get_32 (input_bfd, contents + rel->r_offset);
-
- /* Get the (signed) value from the instruction. */
- addend = value & howto->src_mask;
- if (addend & ((howto->src_mask + 1) >> 1))
- {
- bfd_signed_vma mask;
-
- mask = -1;
- mask &= ~ howto->src_mask;
- addend |= mask;
- }
- msec = sec;
- addend =
- _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
- - relocation;
- addend += msec->output_section->vma + msec->output_offset;
- value = (value & ~ howto->dst_mask) | (addend & howto->dst_mask);
- bfd_put_32 (input_bfd, value, contents + rel->r_offset);
- }
-#else
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
-#endif
- }
- else
- {
- bfd_boolean warned;
- bfd_boolean unresolved_reloc;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
-
- if (unresolved_reloc || relocation != 0)
- {
- /* In these cases, we don't need the relocation value.
- We check specially because in some obscure cases
- sec->output_section will be NULL. */
- switch (r_type)
- {
- case R_ARM_PC24:
- case R_ARM_ABS32:
- case R_ARM_THM_PC22:
- case R_ARM_PLT32:
-
- if (info->shared
- && (
- (!info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- )
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- && ((input_section->flags & SEC_ALLOC) != 0
- /* DWARF will emit R_ARM_ABS32 relocations in its
- sections against symbols defined externally
- in shared libraries. We can't do anything
- with them here. */
- || ((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- )
- relocation = 0;
- break;
-
- case R_ARM_GOTPC:
- relocation = 0;
- break;
-
- case R_ARM_GOT32:
- if ((WILL_CALL_FINISH_DYNAMIC_SYMBOL
- (elf_hash_table (info)->dynamic_sections_created,
- info->shared, h))
- && (!info->shared
- || (!info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- relocation = 0;
- break;
-
- default:
- if (unresolved_reloc)
- _bfd_error_handler
- (_("%s: warning: unresolvable relocation %d against symbol `%s' from %s section"),
- bfd_archive_filename (input_bfd),
- r_type,
- h->root.root.string,
- bfd_get_section_name (input_bfd, input_section));
- break;
- }
- }
- }
-
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = (bfd_elf_string_from_elf_section
- (input_bfd, symtab_hdr->sh_link, sym->st_name));
- if (name == NULL || *name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
-
- r = elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
- input_section, contents, rel,
- relocation, info, sec, name,
- (h ? ELF_ST_TYPE (h->type) :
- ELF_ST_TYPE (sym->st_info)), h);
-
- if (r != bfd_reloc_ok)
- {
- const char * msg = (const char *) 0;
-
- switch (r)
- {
- case bfd_reloc_overflow:
- /* If the overflowing reloc was to an undefined symbol,
- we have already printed one error message and there
- is no point complaining again. */
- if ((! h ||
- h->root.type != bfd_link_hash_undefined)
- && (!((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset))))
- return FALSE;
- break;
-
- case bfd_reloc_undefined:
- if (!((*info->callbacks->undefined_symbol)
- (info, name, input_bfd, input_section,
- rel->r_offset, TRUE)))
- return FALSE;
- break;
-
- case bfd_reloc_outofrange:
- msg = _("internal error: out of range error");
- goto common_error;
-
- case bfd_reloc_notsupported:
- msg = _("internal error: unsupported relocation error");
- goto common_error;
-
- case bfd_reloc_dangerous:
- msg = _("internal error: dangerous error");
- goto common_error;
-
- default:
- msg = _("internal error: unknown error");
- /* fall through */
-
- common_error:
- if (!((*info->callbacks->warning)
- (info, msg, name, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
- break;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Set the right machine number. */
-
-static bfd_boolean
-elf32_arm_object_p (abfd)
- bfd *abfd;
-{
- unsigned int mach;
-
- mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
-
- if (mach != bfd_mach_arm_unknown)
- bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
-
- else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
- bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312);
-
- else
- bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
-
- return TRUE;
-}
-
-/* Function to keep ARM specific flags in the ELF header. */
-static bfd_boolean
-elf32_arm_set_private_flags (abfd, flags)
- bfd *abfd;
- flagword flags;
-{
- if (elf_flags_init (abfd)
- && elf_elfheader (abfd)->e_flags != flags)
- {
- if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN)
- {
- if (flags & EF_ARM_INTERWORK)
- (*_bfd_error_handler) (_("\
-Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"),
- bfd_archive_filename (abfd));
- else
- _bfd_error_handler (_("\
-Warning: Clearing the interworking flag of %s due to outside request"),
- bfd_archive_filename (abfd));
- }
- }
- else
- {
- elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = TRUE;
- }
-
- return TRUE;
-}
-
-/* Copy backend specific data from one object module to another. */
-
-static bfd_boolean
-elf32_arm_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
-{
- flagword in_flags;
- flagword out_flags;
-
- if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- in_flags = elf_elfheader (ibfd)->e_flags;
- out_flags = elf_elfheader (obfd)->e_flags;
-
- if (elf_flags_init (obfd)
- && EF_ARM_EABI_VERSION (out_flags) == EF_ARM_EABI_UNKNOWN
- && in_flags != out_flags)
- {
- /* Cannot mix APCS26 and APCS32 code. */
- if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
- return FALSE;
-
- /* Cannot mix float APCS and non-float APCS code. */
- if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
- return FALSE;
-
- /* If the src and dest have different interworking flags
- then turn off the interworking bit. */
- if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
- {
- if (out_flags & EF_ARM_INTERWORK)
- _bfd_error_handler (_("\
-Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"),
- bfd_get_filename (obfd),
- bfd_archive_filename (ibfd));
-
- in_flags &= ~EF_ARM_INTERWORK;
- }
-
- /* Likewise for PIC, though don't warn for this case. */
- if ((in_flags & EF_ARM_PIC) != (out_flags & EF_ARM_PIC))
- in_flags &= ~EF_ARM_PIC;
- }
-
- elf_elfheader (obfd)->e_flags = in_flags;
- elf_flags_init (obfd) = TRUE;
-
- return TRUE;
-}
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
-
-static bfd_boolean
-elf32_arm_merge_private_bfd_data (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
-{
- flagword out_flags;
- flagword in_flags;
- bfd_boolean flags_compatible = TRUE;
- asection *sec;
-
- /* Check if we have the same endianess. */
- if (! _bfd_generic_verify_endian_match (ibfd, obfd))
- return FALSE;
-
- if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- /* The input BFD must have had its flags initialised. */
- /* The following seems bogus to me -- The flags are initialized in
- the assembler but I don't think an elf_flags_init field is
- written into the object. */
- /* BFD_ASSERT (elf_flags_init (ibfd)); */
-
- in_flags = elf_elfheader (ibfd)->e_flags;
- out_flags = elf_elfheader (obfd)->e_flags;
-
- if (!elf_flags_init (obfd))
- {
- /* If the input is the default architecture and had the default
- flags then do not bother setting the flags for the output
- architecture, instead allow future merges to do this. If no
- future merges ever set these flags then they will retain their
- uninitialised values, which surprise surprise, correspond
- to the default values. */
- if (bfd_get_arch_info (ibfd)->the_default
- && elf_elfheader (ibfd)->e_flags == 0)
- return TRUE;
-
- elf_flags_init (obfd) = TRUE;
- elf_elfheader (obfd)->e_flags = in_flags;
-
- if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
- && bfd_get_arch_info (obfd)->the_default)
- return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
-
- return TRUE;
- }
-
- /* Determine what should happen if the input ARM architecture
- does not match the output ARM architecture. */
- if (! bfd_arm_merge_machines (ibfd, obfd))
- return FALSE;
-
- /* Identical flags must be compatible. */
- if (in_flags == out_flags)
- return TRUE;
-
- /* Check to see if the input BFD actually contains any sections. If
- not, its flags may not have been initialised either, but it
- cannot actually cause any incompatibility. Do not short-circuit
- dynamic objects; their section list may be emptied by
- elf_link_add_object_symbols.
-
- Also check to see if there are no code sections in the input.
- In this case there is no need to check for code specific flags.
- XXX - do we need to worry about floating-point format compatability
- in data sections ? */
- if (!(ibfd->flags & DYNAMIC))
- {
- bfd_boolean null_input_bfd = TRUE;
- bfd_boolean only_data_sections = TRUE;
-
- for (sec = ibfd->sections; sec != NULL; sec = sec->next)
- {
- /* Ignore synthetic glue sections. */
- if (strcmp (sec->name, ".glue_7")
- && strcmp (sec->name, ".glue_7t"))
- {
- if ((bfd_get_section_flags (ibfd, sec)
- & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
- == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
- only_data_sections = FALSE;
-
- null_input_bfd = FALSE;
- break;
- }
- }
-
- if (null_input_bfd || only_data_sections)
- return TRUE;
- }
-
- /* Complain about various flag mismatches. */
- if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
- {
- _bfd_error_handler (_("\
-ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d"),
- bfd_archive_filename (ibfd),
- (in_flags & EF_ARM_EABIMASK) >> 24,
- bfd_get_filename (obfd),
- (out_flags & EF_ARM_EABIMASK) >> 24);
- return FALSE;
- }
-
- /* Not sure what needs to be checked for EABI versions >= 1. */
- if (EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN)
- {
- if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
- {
- _bfd_error_handler (_("\
-ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"),
- bfd_archive_filename (ibfd),
- in_flags & EF_ARM_APCS_26 ? 26 : 32,
- bfd_get_filename (obfd),
- out_flags & EF_ARM_APCS_26 ? 26 : 32);
- flags_compatible = FALSE;
- }
-
- if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
- {
- if (in_flags & EF_ARM_APCS_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- else
- _bfd_error_handler (_("\
-ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
-
- flags_compatible = FALSE;
- }
-
- if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT))
- {
- if (in_flags & EF_ARM_VFP_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s uses VFP instructions, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- else
- _bfd_error_handler (_("\
-ERROR: %s uses FPA instructions, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
-
- flags_compatible = FALSE;
- }
-
- if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT))
- {
- if (in_flags & EF_ARM_MAVERICK_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s uses Maverick instructions, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- else
- _bfd_error_handler (_("\
-ERROR: %s does not use Maverick instructions, whereas %s does"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
-
- flags_compatible = FALSE;
- }
-
-#ifdef EF_ARM_SOFT_FLOAT
- if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT))
- {
- /* We can allow interworking between code that is VFP format
- layout, and uses either soft float or integer regs for
- passing floating point arguments and results. We already
- know that the APCS_FLOAT flags match; similarly for VFP
- flags. */
- if ((in_flags & EF_ARM_APCS_FLOAT) != 0
- || (in_flags & EF_ARM_VFP_FLOAT) == 0)
- {
- if (in_flags & EF_ARM_SOFT_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s uses software FP, whereas %s uses hardware FP"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- else
- _bfd_error_handler (_("\
-ERROR: %s uses hardware FP, whereas %s uses software FP"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
-
- flags_compatible = FALSE;
- }
- }
-#endif
-
- /* Interworking mismatch is only a warning. */
- if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
- {
- if (in_flags & EF_ARM_INTERWORK)
- {
- _bfd_error_handler (_("\
-Warning: %s supports interworking, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- }
- else
- {
- _bfd_error_handler (_("\
-Warning: %s does not support interworking, whereas %s does"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
- }
- }
- }
-
- return flags_compatible;
-}
-
-/* Display the flags field. */
-
-static bfd_boolean
-elf32_arm_print_private_bfd_data (abfd, ptr)
- bfd *abfd;
- PTR ptr;
-{
- FILE * file = (FILE *) ptr;
- unsigned long flags;
-
- BFD_ASSERT (abfd != NULL && ptr != NULL);
-
- /* Print normal ELF private data. */
- _bfd_elf_print_private_bfd_data (abfd, ptr);
-
- flags = elf_elfheader (abfd)->e_flags;
- /* Ignore init flag - it may not be set, despite the flags field
- containing valid data. */
-
- /* xgettext:c-format */
- fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
-
- switch (EF_ARM_EABI_VERSION (flags))
- {
- case EF_ARM_EABI_UNKNOWN:
- /* The following flag bits are GNU extensions and not part of the
- official ARM ELF extended ABI. Hence they are only decoded if
- the EABI version is not set. */
- if (flags & EF_ARM_INTERWORK)
- fprintf (file, _(" [interworking enabled]"));
-
- if (flags & EF_ARM_APCS_26)
- fprintf (file, " [APCS-26]");
- else
- fprintf (file, " [APCS-32]");
-
- if (flags & EF_ARM_VFP_FLOAT)
- fprintf (file, _(" [VFP float format]"));
- else if (flags & EF_ARM_MAVERICK_FLOAT)
- fprintf (file, _(" [Maverick float format]"));
- else
- fprintf (file, _(" [FPA float format]"));
-
- if (flags & EF_ARM_APCS_FLOAT)
- fprintf (file, _(" [floats passed in float registers]"));
-
- if (flags & EF_ARM_PIC)
- fprintf (file, _(" [position independent]"));
-
- if (flags & EF_ARM_NEW_ABI)
- fprintf (file, _(" [new ABI]"));
-
- if (flags & EF_ARM_OLD_ABI)
- fprintf (file, _(" [old ABI]"));
-
- if (flags & EF_ARM_SOFT_FLOAT)
- fprintf (file, _(" [software FP]"));
-
- flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT
- | EF_ARM_PIC | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI
- | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT
- | EF_ARM_MAVERICK_FLOAT);
- break;
-
- case EF_ARM_EABI_VER1:
- fprintf (file, _(" [Version1 EABI]"));
-
- if (flags & EF_ARM_SYMSARESORTED)
- fprintf (file, _(" [sorted symbol table]"));
- else
- fprintf (file, _(" [unsorted symbol table]"));
-
- flags &= ~ EF_ARM_SYMSARESORTED;
- break;
-
- case EF_ARM_EABI_VER2:
- fprintf (file, _(" [Version2 EABI]"));
-
- if (flags & EF_ARM_SYMSARESORTED)
- fprintf (file, _(" [sorted symbol table]"));
- else
- fprintf (file, _(" [unsorted symbol table]"));
-
- if (flags & EF_ARM_DYNSYMSUSESEGIDX)
- fprintf (file, _(" [dynamic symbols use segment index]"));
-
- if (flags & EF_ARM_MAPSYMSFIRST)
- fprintf (file, _(" [mapping symbols precede others]"));
-
- flags &= ~(EF_ARM_SYMSARESORTED | EF_ARM_DYNSYMSUSESEGIDX
- | EF_ARM_MAPSYMSFIRST);
- break;
-
- default:
- fprintf (file, _(" <EABI version unrecognised>"));
- break;
- }
-
- flags &= ~ EF_ARM_EABIMASK;
-
- if (flags & EF_ARM_RELEXEC)
- fprintf (file, _(" [relocatable executable]"));
-
- if (flags & EF_ARM_HASENTRY)
- fprintf (file, _(" [has entry point]"));
-
- flags &= ~ (EF_ARM_RELEXEC | EF_ARM_HASENTRY);
-
- if (flags)
- fprintf (file, _("<Unrecognised flag bits set>"));
-
- fputc ('\n', file);
-
- return TRUE;
-}
-
-static int
-elf32_arm_get_symbol_type (elf_sym, type)
- Elf_Internal_Sym * elf_sym;
- int type;
-{
- switch (ELF_ST_TYPE (elf_sym->st_info))
- {
- case STT_ARM_TFUNC:
- return ELF_ST_TYPE (elf_sym->st_info);
-
- case STT_ARM_16BIT:
- /* If the symbol is not an object, return the STT_ARM_16BIT flag.
- This allows us to distinguish between data used by Thumb instructions
- and non-data (which is probably code) inside Thumb regions of an
- executable. */
- if (type != STT_OBJECT)
- return ELF_ST_TYPE (elf_sym->st_info);
- break;
-
- default:
- break;
- }
-
- return type;
-}
-
-static asection *
-elf32_arm_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_ARM_GNU_VTINHERIT:
- case R_ARM_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf32_arm_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_ARM_GOT32:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- case R_ARM_ABS32:
- case R_ARM_REL32:
- case R_ARM_PC24:
- case R_ARM_PLT32:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf32_arm_link_hash_entry *eh;
- struct elf32_arm_relocs_copied **pp;
- struct elf32_arm_relocs_copied *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
-
- if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32
- || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32)
- {
- eh = (struct elf32_arm_link_hash_entry *) h;
-
- for (pp = &eh->relocs_copied; (p = *pp) != NULL;
- pp = &p->next)
- if (p->section == sec)
- {
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
- }
- break;
-
- default:
- break;
- }
-
- return TRUE;
-}
-
-/* Look through the relocs for a section during the first phase. */
-
-static bfd_boolean
-elf32_arm_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- struct elf_link_hash_entry **sym_hashes_end;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- bfd *dynobj;
- asection *sreloc;
- bfd_vma *local_got_offsets;
- struct elf32_arm_link_hash_table *htab;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf32_arm_hash_table (info);
- sreloc = NULL;
-
- dynobj = elf_hash_table (info)->dynobj;
- local_got_offsets = elf_local_got_offsets (abfd);
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = sym_hashes
- + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
-
- if (!elf_bad_symtab (abfd))
- sym_hashes_end -= symtab_hdr->sh_info;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- struct elf_link_hash_entry *h;
- unsigned long r_symndx;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_ARM_GOT32:
- /* This symbol requires a global offset table entry. */
- if (h != NULL)
- {
- h->got.refcount++;
- }
- else
- {
- bfd_signed_vma *local_got_refcounts;
-
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma) + sizeof(char));
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- }
- local_got_refcounts[r_symndx] += 1;
- }
- break;
-
- case R_ARM_GOTOFF:
- case R_ARM_GOTPC:
- if (htab->sgot == NULL)
- {
- if (htab->root.dynobj == NULL)
- htab->root.dynobj = abfd;
- if (!create_got_section (htab->root.dynobj, info))
- return FALSE;
- }
- break;
-
- case R_ARM_ABS32:
- case R_ARM_REL32:
- case R_ARM_PC24:
- case R_ARM_PLT32:
- if (h != NULL)
- {
- /* If this reloc is in a read-only section, we might
- need a copy reloc. We can't check reliably at this
- stage whether the section is read-only, as input
- sections have not yet been mapped to output sections.
- Tentatively set the flag for now, and correct in
- adjust_dynamic_symbol. */
- if (!info->shared)
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- /* We may need a .plt entry if the function this reloc
- refers to is in a different object. We can't tell for
- sure yet, because something later might force the
- symbol local. */
- if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24
- || ELF32_R_TYPE (rel->r_info) == R_ARM_PLT32)
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
-
- /* If we create a PLT entry, this relocation will reference
- it, even if it's an ABS32 relocation. */
- h->plt.refcount += 1;
- }
-
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). We account for that
- possibility below by storing information in the
- relocs_copied field of the hash table entry. */
- if (info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && ((ELF32_R_TYPE (rel->r_info) != R_ARM_PC24
- && ELF32_R_TYPE (rel->r_info) != R_ARM_PLT32
- && ELF32_R_TYPE (rel->r_info) != R_ARM_REL32)
- || (h != NULL
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- {
- struct elf32_arm_relocs_copied *p, **head;
-
- /* When creating a shared object, we must copy these
- reloc types into the output file. We create a reloc
- section in dynobj and make room for this reloc. */
- if (sreloc == NULL)
- {
- const char * name;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (name, ".rel", 4) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
- name + 4) == 0);
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return FALSE;
- }
-
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- {
- head = &((struct elf32_arm_link_hash_entry *) h)->relocs_copied;
- }
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
-
- asection *s;
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct elf32_arm_relocs_copied **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->section != sec)
- {
- bfd_size_type amt = sizeof *p;
- p = bfd_alloc (htab->root.dynobj, amt);
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->section = sec;
- p->count = 0;
- }
-
- if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32
- || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32)
- p->count += 1;
- }
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_ARM_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_ARM_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Find the nearest line to a particular section and offset, for error
- reporting. This code is a duplicate of the code in elf.c, except
- that it also accepts STT_ARM_TFUNC as a symbol that names a function. */
-
-static bfd_boolean
-elf32_arm_find_nearest_line
- (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *line_ptr;
-{
- bfd_boolean found;
- const char *filename;
- asymbol *func;
- bfd_vma low_func;
- asymbol **p;
-
- if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr, 0,
- &elf_tdata (abfd)->dwarf2_find_line_info))
- return TRUE;
-
- if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
- &found, filename_ptr,
- functionname_ptr, line_ptr,
- &elf_tdata (abfd)->line_info))
- return FALSE;
-
- if (found)
- return TRUE;
-
- if (symbols == NULL)
- return FALSE;
-
- filename = NULL;
- func = NULL;
- low_func = 0;
-
- for (p = symbols; *p != NULL; p++)
- {
- elf_symbol_type *q;
-
- q = (elf_symbol_type *) *p;
-
- if (bfd_get_section (&q->symbol) != section)
- continue;
-
- switch (ELF_ST_TYPE (q->internal_elf_sym.st_info))
- {
- default:
- break;
- case STT_FILE:
- filename = bfd_asymbol_name (&q->symbol);
- break;
- case STT_NOTYPE:
- case STT_FUNC:
- case STT_ARM_TFUNC:
- if (q->symbol.section == section
- && q->symbol.value >= low_func
- && q->symbol.value <= offset)
- {
- func = (asymbol *) q;
- low_func = q->symbol.value;
- }
- break;
- }
- }
-
- if (func == NULL)
- return FALSE;
-
- *filename_ptr = filename;
- *functionname_ptr = bfd_asymbol_name (func);
- *line_ptr = 0;
-
- return TRUE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-elf32_arm_adjust_dynamic_symbol (info, h)
- struct bfd_link_info * info;
- struct elf_link_hash_entry * h;
-{
- bfd * dynobj;
- asection * s;
- unsigned int power_of_two;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- /* Make sure we know what is going on here. */
- BFD_ASSERT (dynobj != NULL
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
- || h->weakdef != NULL
- || ((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)));
-
- /* If this is a function, put it in the procedure linkage table. We
- will fill in the contents of the procedure linkage table later,
- when we know the address of the .got section. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- if (h->plt.refcount <= 0
- || SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
- such a case, we don't actually need to build a procedure
- linkage table, and we can just do a PC24 reloc instead. */
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- return TRUE;
- }
- else
- /* It's possible that we incorrectly decided a .plt reloc was
- needed for an R_ARM_PC24 reloc to a non-function sym in
- check_relocs. We can't decide accurately between function and
- non-function syms in check-relocs; Objects loaded later in
- the link may change h->type. So fix it now. */
- h->plt.offset = (bfd_vma) -1;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
- s = bfd_get_section_by_name (dynobj, ".dynbss");
- BFD_ASSERT (s != NULL);
-
- /* We must generate a R_ARM_COPY reloc to tell the dynamic linker to
- copy the initial value out of the dynamic object and into the
- runtime process image. We need to remember the offset into the
- .rel.bss section we are going to use. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- asection *srel;
-
- srel = bfd_get_section_by_name (dynobj, ".rel.bss");
- BFD_ASSERT (srel != NULL);
- srel->_raw_size += sizeof (Elf32_External_Rel);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->_raw_size = BFD_ALIGN (s->_raw_size,
- (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Allocate space in .plt, .got and associated reloc sections for
- dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
-{
- struct bfd_link_info *info;
- struct elf32_arm_link_hash_table *htab;
- struct elf32_arm_link_hash_entry *eh;
- struct elf32_arm_relocs_copied *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- info = (struct bfd_link_info *) inf;
- htab = elf32_arm_hash_table (info);
-
- if (htab->root.dynamic_sections_created
- && h->plt.refcount > 0)
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
- {
- asection *s = htab->splt;
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_HEADER_SIZE;
-
- h->plt.offset = s->_raw_size;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- htab->sgotplt->_raw_size += 4;
-
- /* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf32_External_Rel);
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- if (h->got.refcount > 0)
- {
- asection *s;
- bfd_boolean dyn;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += 4;
- dyn = htab->root.dynamic_sections_created;
- if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- eh = (struct elf32_arm_link_hash_entry *) h;
- if (eh->relocs_copied == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for pc-relative relocs that have become local due to symbol
- visibility changes. */
-
- if (info->shared)
- {
- /* Discard relocs on undefined weak syms with non-default
- visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- eh->relocs_copied = NULL;
- }
- else
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || (htab->root.dynamic_sections_created
- && (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->relocs_copied = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->relocs_copied; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->section)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel);
- }
-
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-elf32_arm_size_dynamic_sections (output_bfd, info)
- bfd * output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info * info;
-{
- bfd * dynobj;
- asection * s;
- bfd_boolean plt;
- bfd_boolean relocs;
- bfd *ibfd;
- struct elf32_arm_link_hash_table *htab;
-
- htab = elf32_arm_hash_table (info);
- dynobj = elf_hash_table (info)->dynobj;
- BFD_ASSERT (dynobj != NULL);
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
- char *local_tls_type;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srel;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct elf32_arm_relocs_copied *p;
-
- for (p = *((struct elf32_arm_relocs_copied **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->section)
- && bfd_is_abs_section (p->section->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- srel = elf_section_data (p->section)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
- if ((p->section->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_local_got = local_got + locsymcount;
- s = htab->sgot;
- srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
- {
- if (*local_got > 0)
- {
- *local_got = s->_raw_size;
- s->_raw_size += 4;
- if (info->shared)
- srel->_raw_size += sizeof (Elf32_External_Rel);
- }
- else
- *local_got = (bfd_vma) -1;
- }
- }
-
- /* Allocate global sym .plt and .got entries, and space for global
- sym dynamic relocs. */
- elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info);
-
- /* The check_relocs and adjust_dynamic_symbol entry points have
- determined the sizes of the various dynamic sections. Allocate
- memory for them. */
- plt = FALSE;
- relocs = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- const char * name;
- bfd_boolean strip;
-
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
-
- strip = FALSE;
-
- if (strcmp (name, ".plt") == 0)
- {
- if (s->_raw_size == 0)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- strip = TRUE;
- }
- else
- {
- /* Remember whether there is a PLT. */
- plt = TRUE;
- }
- }
- else if (strncmp (name, ".rel", 4) == 0)
- {
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is mostly to handle .rel.bss and
- .rel.plt. We must create both sections in
- create_dynamic_sections, because they must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
- strip = TRUE;
- }
- else
- {
- /* Remember whether there are any reloc sections other
- than .rel.plt. */
- if (strcmp (name, ".rel.plt") != 0)
- relocs = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- }
- else if (strncmp (name, ".got", 4) != 0)
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (strip)
- {
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return FALSE;
- }
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in elf32_arm_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (!info->shared)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (plt)
- {
- 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 ( !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 (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- info->flags |= DF_TEXTREL;
- }
- }
-#undef add_synamic_entry
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd * output_bfd;
- struct bfd_link_info * info;
- struct elf_link_hash_entry * h;
- Elf_Internal_Sym * sym;
-{
- bfd * dynobj;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- asection * splt;
- asection * sgot;
- asection * srel;
- bfd_vma plt_index;
- bfd_vma got_offset;
- Elf_Internal_Rela rel;
- bfd_byte *loc;
- bfd_vma got_displacement;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
- BFD_ASSERT (h->dynindx != -1);
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got.plt");
- srel = bfd_get_section_by_name (dynobj, ".rel.plt");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
-
- /* Get the index in the procedure linkage table which
- corresponds to this symbol. This is the index of this symbol
- in all the symbols for which we are making plt entries. The
- first entry in the procedure linkage table is reserved. */
- plt_index = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE;
-
- /* Get the offset into the .got table of the entry that
- corresponds to this function. Each .got entry is 4 bytes.
- The first three are reserved. */
- got_offset = (plt_index + 3) * 4;
-
- /* Calculate the displacement between the PLT slot and the
- entry in the GOT. */
- got_displacement = (sgot->output_section->vma
- + sgot->output_offset
- + got_offset
- - splt->output_section->vma
- - splt->output_offset
- - h->plt.offset
- - 8);
-
- BFD_ASSERT ((got_displacement & 0xf0000000) == 0);
-
- /* Fill in the entry in the procedure linkage table. */
- bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement & 0x0ff00000) >> 20),
- splt->contents + h->plt.offset + 0);
- bfd_put_32 (output_bfd, elf32_arm_plt_entry[1] | ((got_displacement & 0x000ff000) >> 12),
- splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, elf32_arm_plt_entry[2] | (got_displacement & 0x00000fff),
- splt->contents + h->plt.offset + 8);
-#ifdef FOUR_WORD_PLT
- bfd_put_32 (output_bfd, elf32_arm_plt_entry[3],
- splt->contents + h->plt.offset + 12);
-#endif
-
- /* Fill in the entry in the global offset table. */
- bfd_put_32 (output_bfd,
- (splt->output_section->vma
- + splt->output_offset),
- sgot->contents + got_offset);
-
- /* Fill in the entry in the .rel.plt section. */
- rel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + got_offset);
- rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_JUMP_SLOT);
- loc = srel->contents + plt_index * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. */
- sym->st_shndx = SHN_UNDEF;
- /* If the symbol is weak, we do need to clear the value.
- Otherwise, the PLT entry would provide a definition for
- the symbol even if the symbol wasn't defined anywhere,
- and so the symbol would never be NULL. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
- == 0)
- sym->st_value = 0;
- }
- }
-
- if (h->got.offset != (bfd_vma) -1)
- {
- asection * sgot;
- asection * srel;
- Elf_Internal_Rela rel;
- bfd_byte *loc;
-
- /* This symbol has an entry in the global offset table. Set it
- up. */
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srel = bfd_get_section_by_name (dynobj, ".rel.got");
- BFD_ASSERT (sgot != NULL && srel != NULL);
-
- rel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + (h->got.offset &~ (bfd_vma) 1));
-
- /* If this is a static link, or it is a -Bsymbolic link and the
- symbol is defined locally or was forced to be local because
- of a version file, we just want to emit a RELATIVE reloc.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h))
- {
- BFD_ASSERT((h->got.offset & 1) != 0);
- rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- }
- else
- {
- BFD_ASSERT((h->got.offset & 1) == 0);
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
- rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
- }
-
- loc = srel->contents + srel->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- asection * s;
- Elf_Internal_Rela rel;
- bfd_byte *loc;
-
- /* This symbol needs a copy reloc. Set it up. */
- BFD_ASSERT (h->dynindx != -1
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak));
-
- s = bfd_get_section_by_name (h->root.u.def.section->owner,
- ".rel.bss");
- BFD_ASSERT (s != NULL);
-
- rel.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_COPY);
- loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
- }
-
- /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-elf32_arm_finish_dynamic_sections (output_bfd, info)
- bfd * output_bfd;
- struct bfd_link_info * info;
-{
- bfd * dynobj;
- asection * sgot;
- asection * sdyn;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- sgot = bfd_get_section_by_name (dynobj, ".got.plt");
- BFD_ASSERT (sgot != NULL);
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- asection *splt;
- Elf32_External_Dyn *dyncon, *dynconend;
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL && sdyn != NULL);
-
- dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
-
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- const char * name;
- asection * s;
-
- bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- break;
-
- case DT_PLTGOT:
- name = ".got";
- goto get_vma;
- case DT_JMPREL:
- name = ".rel.plt";
- get_vma:
- s = bfd_get_section_by_name (output_bfd, name);
- BFD_ASSERT (s != NULL);
- dyn.d_un.d_ptr = s->vma;
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- break;
-
- case DT_PLTRELSZ:
- s = bfd_get_section_by_name (output_bfd, ".rel.plt");
- BFD_ASSERT (s != NULL);
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- break;
-
- case DT_RELSZ:
- /* My reading of the SVR4 ABI indicates that the
- procedure linkage table relocs (DT_JMPREL) should be
- included in the overall relocs (DT_REL). This is
- what Solaris does. However, UnixWare can not handle
- that case. Therefore, we override the DT_RELSZ entry
- here to make it not include the JMPREL relocs. Since
- the linker script arranges for .rel.plt to follow all
- other relocation sections, we don't have to worry
- about changing the DT_REL entry. */
- s = bfd_get_section_by_name (output_bfd, ".rel.plt");
- if (s != NULL)
- {
- if (s->_cooked_size != 0)
- dyn.d_un.d_val -= s->_cooked_size;
- else
- dyn.d_un.d_val -= s->_raw_size;
- }
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- break;
-
- /* Set the bottom bit of DT_INIT/FINI if the
- corresponding function is Thumb. */
- case DT_INIT:
- name = info->init_function;
- goto get_sym;
- case DT_FINI:
- name = info->fini_function;
- get_sym:
- /* If it wasn't set by elf_bfd_final_link
- then there is nothing to adjust. */
- if (dyn.d_un.d_val != 0)
- {
- struct elf_link_hash_entry * eh;
-
- eh = elf_link_hash_lookup (elf_hash_table (info), name,
- FALSE, FALSE, TRUE);
- if (eh != (struct elf_link_hash_entry *) NULL
- && ELF_ST_TYPE (eh->type) == STT_ARM_TFUNC)
- {
- dyn.d_un.d_val |= 1;
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
- }
- break;
- }
- }
-
- /* Fill in the first entry in the procedure linkage table. */
- if (splt->_raw_size > 0)
- {
- bfd_vma got_displacement;
-
- /* Calculate the displacement between the PLT slot and &GOT[0]. */
- got_displacement = (sgot->output_section->vma
- + sgot->output_offset
- - splt->output_section->vma
- - splt->output_offset
- - 16);
-
- bfd_put_32 (output_bfd, elf32_arm_plt0_entry[0], splt->contents + 0);
- bfd_put_32 (output_bfd, elf32_arm_plt0_entry[1], splt->contents + 4);
- bfd_put_32 (output_bfd, elf32_arm_plt0_entry[2], splt->contents + 8);
- bfd_put_32 (output_bfd, elf32_arm_plt0_entry[3], splt->contents + 12);
-#ifdef FOUR_WORD_PLT
- /* The displacement value goes in the otherwise-unused last word of
- the second entry. */
- bfd_put_32 (output_bfd, got_displacement, splt->contents + 28);
-#else
- bfd_put_32 (output_bfd, got_displacement, splt->contents + 16);
-#endif
- }
-
- /* UnixWare sets the entsize of .plt to 4, although that doesn't
- really seem like the right value. */
- elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
- }
-
- /* Fill in the first three entries in the global offset table. */
- if (sgot->_raw_size > 0)
- {
- if (sdyn == NULL)
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
- else
- bfd_put_32 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- sgot->contents);
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4);
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8);
- }
-
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
-
- return TRUE;
-}
-
-static void
-elf32_arm_post_process_headers (abfd, link_info)
- bfd * abfd;
- struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
-{
- Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
-
- i_ehdrp = elf_elfheader (abfd);
-
- i_ehdrp->e_ident[EI_OSABI] = ARM_ELF_OS_ABI_VERSION;
- i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION;
-}
-
-static enum elf_reloc_type_class
-elf32_arm_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
-{
- switch ((int) ELF32_R_TYPE (rela->r_info))
- {
- case R_ARM_RELATIVE:
- return reloc_class_relative;
- case R_ARM_JUMP_SLOT:
- return reloc_class_plt;
- case R_ARM_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-static bfd_boolean elf32_arm_section_flags PARAMS ((flagword *, Elf_Internal_Shdr *));
-static void elf32_arm_final_write_processing PARAMS ((bfd *, bfd_boolean));
-
-/* Set the right machine number for an Arm ELF file. */
-
-static bfd_boolean
-elf32_arm_section_flags (flags, hdr)
- flagword *flags;
- Elf_Internal_Shdr *hdr;
-{
- if (hdr->sh_type == SHT_NOTE)
- *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS;
-
- return TRUE;
-}
-
-void
-elf32_arm_final_write_processing (abfd, linker)
- bfd *abfd;
- bfd_boolean linker ATTRIBUTE_UNUSED;
-{
- bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
-}
-
-#define ELF_ARCH bfd_arch_arm
-#define ELF_MACHINE_CODE EM_ARM
-#ifdef __QNXTARGET__
-#define ELF_MAXPAGESIZE 0x1000
-#else
-#define ELF_MAXPAGESIZE 0x8000
-#endif
-
-#define bfd_elf32_bfd_copy_private_bfd_data elf32_arm_copy_private_bfd_data
-#define bfd_elf32_bfd_merge_private_bfd_data elf32_arm_merge_private_bfd_data
-#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_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_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol
-#define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections
-#define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections
-#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections
-#define elf_backend_post_process_headers elf32_arm_post_process_headers
-#define elf_backend_reloc_type_class elf32_arm_reloc_type_class
-#define elf_backend_object_p elf32_arm_object_p
-#define elf_backend_section_flags elf32_arm_section_flags
-#define elf_backend_final_write_processing elf32_arm_final_write_processing
-#define elf_backend_copy_indirect_symbol elf32_arm_copy_indirect_symbol
-
-#define elf_backend_can_refcount 1
-#define elf_backend_can_gc_sections 1
-#define elf_backend_plt_readonly 1
-#define elf_backend_want_got_plt 1
-#define elf_backend_want_plt_sym 0
-#if !USE_REL
-#define elf_backend_rela_normal 1
-#endif
-
-#define elf_backend_got_header_size 12
-
-#include "elf32-target.h"
-
diff --git a/contrib/binutils/bfd/elf32-gen.c b/contrib/binutils/bfd/elf32-gen.c
deleted file mode 100644
index f2edf69..0000000
--- a/contrib/binutils/bfd/elf32-gen.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Generic support for 32-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-/* This does not include any relocation information, but should be
- good enough for GDB or objdump to read the file. */
-
-static reloc_howto_type dummy =
- HOWTO (0, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "UNKNOWN", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-static void elf_generic_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static void elf_generic_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static bfd_boolean elf32_generic_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void
-elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
-{
- bfd_reloc->howto = &dummy;
-}
-
-static void
-elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
-{
- bfd_reloc->howto = &dummy;
-}
-
-static bfd_boolean
-elf32_generic_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- asection *o;
-
- /* Check if there are any relocations. */
- for (o = abfd->sections; o != NULL; o = o->next)
- if ((o->flags & SEC_RELOC) != 0)
- {
- Elf_Internal_Ehdr *ehdrp;
-
- ehdrp = elf_elfheader (abfd);
- (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
- bfd_archive_filename (abfd),
- ehdrp->e_machine);
-
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- return bfd_elf_link_add_symbols (abfd, info);
-}
-
-#define TARGET_LITTLE_SYM bfd_elf32_little_generic_vec
-#define TARGET_LITTLE_NAME "elf32-little"
-#define TARGET_BIG_SYM bfd_elf32_big_generic_vec
-#define TARGET_BIG_NAME "elf32-big"
-#define ELF_ARCH bfd_arch_unknown
-#define ELF_MACHINE_CODE EM_NONE
-#define ELF_MAXPAGESIZE 0x1
-#define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
-#define bfd_elf32_bfd_link_add_symbols elf32_generic_link_add_symbols
-#define elf_info_to_howto elf_generic_info_to_howto
-#define elf_info_to_howto_rel elf_generic_info_to_howto_rel
-
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-i386-fbsd.c b/contrib/binutils/bfd/elf32-i386-fbsd.c
deleted file mode 100644
index 500e0eb..0000000
--- a/contrib/binutils/bfd/elf32-i386-fbsd.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Intel IA-32 specific support for 32-bit ELF on FreeBSD.
- Copyright 2002 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec
-#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
-#define ELF_ARCH bfd_arch_i386
-#define ELF_MACHINE_CODE EM_386
-#define ELF_MAXPAGESIZE 0x1000
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "elf-bfd.h"
-
-/* The kernel recognizes executables as valid only if they carry a
- "FreeBSD" label in the ELF header. So we put this label on all
- executables and (for simplicity) also all other object files. */
-
-static void elf_i386_post_process_headers
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void
-elf_i386_post_process_headers (abfd, link_info)
- bfd * abfd;
- struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
-{
- Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
-
- i_ehdrp = elf_elfheader (abfd);
-
- /* Put an ABI label supported by FreeBSD >= 4.1. */
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#ifdef OLD_FREEBSD_ABI_LABEL
- /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
- memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
-#endif
-}
-
-#define elf_backend_post_process_headers elf_i386_post_process_headers
-
-#include "elf32-i386.c"
diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c
deleted file mode 100644
index 7b173e4..0000000
--- a/contrib/binutils/bfd/elf32-i386.c
+++ /dev/null
@@ -1,3323 +0,0 @@
-/* Intel 80386/80486-specific support for 32-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-/* 386 uses REL relocations instead of RELA. */
-#define USE_REL 1
-
-#include "elf/i386.h"
-
-static reloc_howto_type elf_howto_table[]=
-{
- HOWTO(R_386_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_NONE",
- TRUE, 0x00000000, 0x00000000, FALSE),
- HOWTO(R_386_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_PC32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_PC32",
- TRUE, 0xffffffff, 0xffffffff, TRUE),
- HOWTO(R_386_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_GOT32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_PLT32",
- TRUE, 0xffffffff, 0xffffffff, TRUE),
- HOWTO(R_386_COPY, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_COPY",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_GLOB_DAT",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_JUMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_JUMP_SLOT",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_RELATIVE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_RELATIVE",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_GOTOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_GOTOFF",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_GOTPC, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_GOTPC",
- TRUE, 0xffffffff, 0xffffffff, TRUE),
-
- /* We have a gap in the reloc numbers here.
- R_386_standard counts the number up to this point, and
- R_386_ext_offset is the value to subtract from a reloc type of
- R_386_16 thru R_386_PC8 to form an index into this table. */
-#define R_386_standard (R_386_GOTPC + 1)
-#define R_386_ext_offset (R_386_TLS_TPOFF - R_386_standard)
-
- /* These relocs are a GNU extension. */
- HOWTO(R_386_TLS_TPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_TPOFF",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_IE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_IE",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_GOTIE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_GOTIE",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_LE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_LE",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_GD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_GD",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_LDM, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_LDM",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_16",
- TRUE, 0xffff, 0xffff, FALSE),
- HOWTO(R_386_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_PC16",
- TRUE, 0xffff, 0xffff, TRUE),
- HOWTO(R_386_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_8",
- TRUE, 0xff, 0xff, FALSE),
- HOWTO(R_386_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_386_PC8",
- TRUE, 0xff, 0xff, TRUE),
-
-#define R_386_ext (R_386_PC8 + 1 - R_386_ext_offset)
-#define R_386_tls_offset (R_386_TLS_LDO_32 - R_386_ext)
- /* These are common with Solaris TLS implementation. */
- HOWTO(R_386_TLS_LDO_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_LDO_32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_IE_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_IE_32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_LE_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_LE_32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_DTPMOD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_DTPMOD32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_DTPOFF32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
- HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_386_TLS_TPOFF32",
- TRUE, 0xffffffff, 0xffffffff, FALSE),
-
- /* Another gap. */
-#define R_386_tls (R_386_TLS_TPOFF32 + 1 - R_386_tls_offset)
-#define R_386_vt_offset (R_386_GNU_VTINHERIT - R_386_tls)
-
-/* GNU extension to record C++ vtable hierarchy. */
- HOWTO (R_386_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_386_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
-/* GNU extension to record C++ vtable member usage. */
- HOWTO (R_386_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_386_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE) /* pcrel_offset */
-
-#define R_386_vt (R_386_GNU_VTENTRY + 1 - R_386_vt_offset)
-
-};
-
-#ifdef DEBUG_GEN_RELOC
-#define TRACE(str) \
- fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str)
-#else
-#define TRACE(str)
-#endif
-
-static reloc_howto_type *
-elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
-{
- switch (code)
- {
- case BFD_RELOC_NONE:
- TRACE ("BFD_RELOC_NONE");
- return &elf_howto_table[R_386_NONE];
-
- case BFD_RELOC_32:
- TRACE ("BFD_RELOC_32");
- return &elf_howto_table[R_386_32];
-
- case BFD_RELOC_CTOR:
- TRACE ("BFD_RELOC_CTOR");
- return &elf_howto_table[R_386_32];
-
- case BFD_RELOC_32_PCREL:
- TRACE ("BFD_RELOC_PC32");
- return &elf_howto_table[R_386_PC32];
-
- case BFD_RELOC_386_GOT32:
- TRACE ("BFD_RELOC_386_GOT32");
- return &elf_howto_table[R_386_GOT32];
-
- case BFD_RELOC_386_PLT32:
- TRACE ("BFD_RELOC_386_PLT32");
- return &elf_howto_table[R_386_PLT32];
-
- case BFD_RELOC_386_COPY:
- TRACE ("BFD_RELOC_386_COPY");
- return &elf_howto_table[R_386_COPY];
-
- case BFD_RELOC_386_GLOB_DAT:
- TRACE ("BFD_RELOC_386_GLOB_DAT");
- return &elf_howto_table[R_386_GLOB_DAT];
-
- case BFD_RELOC_386_JUMP_SLOT:
- TRACE ("BFD_RELOC_386_JUMP_SLOT");
- return &elf_howto_table[R_386_JUMP_SLOT];
-
- case BFD_RELOC_386_RELATIVE:
- TRACE ("BFD_RELOC_386_RELATIVE");
- return &elf_howto_table[R_386_RELATIVE];
-
- case BFD_RELOC_386_GOTOFF:
- TRACE ("BFD_RELOC_386_GOTOFF");
- return &elf_howto_table[R_386_GOTOFF];
-
- case BFD_RELOC_386_GOTPC:
- TRACE ("BFD_RELOC_386_GOTPC");
- return &elf_howto_table[R_386_GOTPC];
-
- /* These relocs are a GNU extension. */
- case BFD_RELOC_386_TLS_TPOFF:
- TRACE ("BFD_RELOC_386_TLS_TPOFF");
- return &elf_howto_table[R_386_TLS_TPOFF - R_386_ext_offset];
-
- case BFD_RELOC_386_TLS_IE:
- TRACE ("BFD_RELOC_386_TLS_IE");
- return &elf_howto_table[R_386_TLS_IE - R_386_ext_offset];
-
- case BFD_RELOC_386_TLS_GOTIE:
- TRACE ("BFD_RELOC_386_TLS_GOTIE");
- return &elf_howto_table[R_386_TLS_GOTIE - R_386_ext_offset];
-
- case BFD_RELOC_386_TLS_LE:
- TRACE ("BFD_RELOC_386_TLS_LE");
- return &elf_howto_table[R_386_TLS_LE - R_386_ext_offset];
-
- case BFD_RELOC_386_TLS_GD:
- TRACE ("BFD_RELOC_386_TLS_GD");
- return &elf_howto_table[R_386_TLS_GD - R_386_ext_offset];
-
- case BFD_RELOC_386_TLS_LDM:
- TRACE ("BFD_RELOC_386_TLS_LDM");
- return &elf_howto_table[R_386_TLS_LDM - R_386_ext_offset];
-
- case BFD_RELOC_16:
- TRACE ("BFD_RELOC_16");
- return &elf_howto_table[R_386_16 - R_386_ext_offset];
-
- case BFD_RELOC_16_PCREL:
- TRACE ("BFD_RELOC_16_PCREL");
- return &elf_howto_table[R_386_PC16 - R_386_ext_offset];
-
- case BFD_RELOC_8:
- TRACE ("BFD_RELOC_8");
- return &elf_howto_table[R_386_8 - R_386_ext_offset];
-
- case BFD_RELOC_8_PCREL:
- TRACE ("BFD_RELOC_8_PCREL");
- return &elf_howto_table[R_386_PC8 - R_386_ext_offset];
-
- /* Common with Sun TLS implementation. */
- case BFD_RELOC_386_TLS_LDO_32:
- TRACE ("BFD_RELOC_386_TLS_LDO_32");
- return &elf_howto_table[R_386_TLS_LDO_32 - R_386_tls_offset];
-
- case BFD_RELOC_386_TLS_IE_32:
- TRACE ("BFD_RELOC_386_TLS_IE_32");
- return &elf_howto_table[R_386_TLS_IE_32 - R_386_tls_offset];
-
- case BFD_RELOC_386_TLS_LE_32:
- TRACE ("BFD_RELOC_386_TLS_LE_32");
- return &elf_howto_table[R_386_TLS_LE_32 - R_386_tls_offset];
-
- case BFD_RELOC_386_TLS_DTPMOD32:
- TRACE ("BFD_RELOC_386_TLS_DTPMOD32");
- return &elf_howto_table[R_386_TLS_DTPMOD32 - R_386_tls_offset];
-
- case BFD_RELOC_386_TLS_DTPOFF32:
- TRACE ("BFD_RELOC_386_TLS_DTPOFF32");
- return &elf_howto_table[R_386_TLS_DTPOFF32 - R_386_tls_offset];
-
- case BFD_RELOC_386_TLS_TPOFF32:
- TRACE ("BFD_RELOC_386_TLS_TPOFF32");
- return &elf_howto_table[R_386_TLS_TPOFF32 - R_386_tls_offset];
-
- case BFD_RELOC_VTABLE_INHERIT:
- TRACE ("BFD_RELOC_VTABLE_INHERIT");
- return &elf_howto_table[R_386_GNU_VTINHERIT - R_386_vt_offset];
-
- case BFD_RELOC_VTABLE_ENTRY:
- TRACE ("BFD_RELOC_VTABLE_ENTRY");
- return &elf_howto_table[R_386_GNU_VTENTRY - R_386_vt_offset];
-
- default:
- break;
- }
-
- TRACE ("Unknown");
- return 0;
-}
-
-static void
-elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *cache_ptr,
- Elf_Internal_Rela *dst)
-{
- unsigned int r_type = ELF32_R_TYPE (dst->r_info);
- unsigned int indx;
-
- if ((indx = r_type) >= R_386_standard
- && ((indx = r_type - R_386_ext_offset) - R_386_standard
- >= R_386_ext - R_386_standard)
- && ((indx = r_type - R_386_tls_offset) - R_386_ext
- >= R_386_tls - R_386_ext)
- && ((indx = r_type - R_386_vt_offset) - R_386_tls
- >= R_386_vt - R_386_tls))
- {
- (*_bfd_error_handler) (_("%s: invalid relocation type %d"),
- bfd_archive_filename (abfd), (int) r_type);
- indx = R_386_NONE;
- }
- cache_ptr->howto = &elf_howto_table[indx];
-}
-
-/* Return whether a symbol name implies a local label. The UnixWare
- 2.1 cc generates temporary symbols that start with .X, so we
- recognize them here. FIXME: do other SVR4 compilers also use .X?.
- If so, we should move the .X recognition into
- _bfd_elf_is_local_label_name. */
-
-static bfd_boolean
-elf_i386_is_local_label_name (bfd *abfd, const char *name)
-{
- if (name[0] == '.' && name[1] == 'X')
- return TRUE;
-
- return _bfd_elf_is_local_label_name (abfd, name);
-}
-
-/* Support for core dump NOTE sections. */
-
-static bfd_boolean
-elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- int offset;
- size_t raw_size;
-
- if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0)
- {
- int pr_version = bfd_get_32 (abfd, note->descdata);
-
- if (pr_version != 1)
- return FALSE;
-
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 20);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 28;
- raw_size = bfd_get_32 (abfd, note->descdata + 8);
- }
- else
- {
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 144: /* Linux/i386 */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 72;
- raw_size = 68;
-
- break;
- }
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static bfd_boolean
-elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0)
- {
- int pr_version = bfd_get_32 (abfd, note->descdata);
-
- if (pr_version != 1)
- return FALSE;
-
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 8, 17);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 25, 81);
- }
- else
- {
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 124: /* Linux/i386 elf_prpsinfo. */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
- }
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-
-/* Functions for the i386 ELF linker.
-
- In order to gain some understanding of code in this file without
- knowing all the intricate details of the linker, note the
- following:
-
- Functions named elf_i386_* are called by external routines, other
- functions are only called locally. elf_i386_* functions appear
- in this file more or less in the order in which they are called
- from external routines. eg. elf_i386_check_relocs is called
- early in the link process, elf_i386_finish_dynamic_sections is
- one of the last functions. */
-
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
-
-/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
- copying dynamic variables from a shared lib into an app's dynbss
- section, and instead use a dynamic relocation to point into the
- shared lib. */
-#define ELIMINATE_COPY_RELOCS 1
-
-/* The size in bytes of an entry in the procedure linkage table. */
-
-#define PLT_ENTRY_SIZE 16
-
-/* The first entry in an absolute procedure linkage table looks like
- this. See the SVR4 ABI i386 supplement to see how this works. */
-
-static const bfd_byte elf_i386_plt0_entry[PLT_ENTRY_SIZE] =
-{
- 0xff, 0x35, /* pushl contents of address */
- 0, 0, 0, 0, /* replaced with address of .got + 4. */
- 0xff, 0x25, /* jmp indirect */
- 0, 0, 0, 0, /* replaced with address of .got + 8. */
- 0, 0, 0, 0 /* pad out to 16 bytes. */
-};
-
-/* Subsequent entries in an absolute procedure linkage table look like
- this. */
-
-static const bfd_byte elf_i386_plt_entry[PLT_ENTRY_SIZE] =
-{
- 0xff, 0x25, /* jmp indirect */
- 0, 0, 0, 0, /* replaced with address of this symbol in .got. */
- 0x68, /* pushl immediate */
- 0, 0, 0, 0, /* replaced with offset into relocation table. */
- 0xe9, /* jmp relative */
- 0, 0, 0, 0 /* replaced with offset to start of .plt. */
-};
-
-/* The first entry in a PIC procedure linkage table look like this. */
-
-static const bfd_byte elf_i386_pic_plt0_entry[PLT_ENTRY_SIZE] =
-{
- 0xff, 0xb3, 4, 0, 0, 0, /* pushl 4(%ebx) */
- 0xff, 0xa3, 8, 0, 0, 0, /* jmp *8(%ebx) */
- 0, 0, 0, 0 /* pad out to 16 bytes. */
-};
-
-/* Subsequent entries in a PIC procedure linkage table look like this. */
-
-static const bfd_byte elf_i386_pic_plt_entry[PLT_ENTRY_SIZE] =
-{
- 0xff, 0xa3, /* jmp *offset(%ebx) */
- 0, 0, 0, 0, /* replaced with offset of this symbol in .got. */
- 0x68, /* pushl immediate */
- 0, 0, 0, 0, /* replaced with offset into relocation table. */
- 0xe9, /* jmp relative */
- 0, 0, 0, 0 /* replaced with offset to start of .plt. */
-};
-
-/* The i386 linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct elf_i386_dyn_relocs
-{
- struct elf_i386_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
-
-/* i386 ELF linker hash entry. */
-
-struct elf_i386_link_hash_entry
-{
- struct elf_link_hash_entry elf;
-
- /* Track dynamic relocs copied for this symbol. */
- struct elf_i386_dyn_relocs *dyn_relocs;
-
-#define GOT_UNKNOWN 0
-#define GOT_NORMAL 1
-#define GOT_TLS_GD 2
-#define GOT_TLS_IE 4
-#define GOT_TLS_IE_POS 5
-#define GOT_TLS_IE_NEG 6
-#define GOT_TLS_IE_BOTH 7
- unsigned char tls_type;
-};
-
-#define elf_i386_hash_entry(ent) ((struct elf_i386_link_hash_entry *)(ent))
-
-struct elf_i386_obj_tdata
-{
- struct elf_obj_tdata root;
-
- /* tls_type for each local got entry. */
- char *local_got_tls_type;
-};
-
-#define elf_i386_tdata(abfd) \
- ((struct elf_i386_obj_tdata *) (abfd)->tdata.any)
-
-#define elf_i386_local_got_tls_type(abfd) \
- (elf_i386_tdata (abfd)->local_got_tls_type)
-
-static bfd_boolean
-elf_i386_mkobject (bfd *abfd)
-{
- bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
-}
-
-/* i386 ELF linker hash table. */
-
-struct elf_i386_link_hash_table
-{
- struct elf_link_hash_table elf;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
- asection *sdynbss;
- asection *srelbss;
-
- union {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } tls_ldm_got;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-};
-
-/* Get the i386 ELF linker hash table from a link_info structure. */
-
-#define elf_i386_hash_table(p) \
- ((struct elf_i386_link_hash_table *) ((p)->hash))
-
-/* Create an entry in an i386 ELF linker hash table. */
-
-static struct bfd_hash_entry *
-link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table,
- sizeof (struct elf_i386_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct elf_i386_link_hash_entry *eh;
-
- eh = (struct elf_i386_link_hash_entry *) entry;
- eh->dyn_relocs = NULL;
- eh->tls_type = GOT_UNKNOWN;
- }
-
- return entry;
-}
-
-/* Create an i386 ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-elf_i386_link_hash_table_create (bfd *abfd)
-{
- struct elf_i386_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
-
- ret = bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- ret->sgot = NULL;
- ret->sgotplt = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->tls_ldm_got.refcount = 0;
- ret->sym_sec.abfd = NULL;
-
- return &ret->elf.root;
-}
-
-/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf_i386_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf_i386_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- if (!htab->sgot || !htab->sgotplt)
- abort ();
-
- htab->srelgot = bfd_make_section (dynobj, ".rel.got");
- if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return FALSE;
- return TRUE;
-}
-
-/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and
- .rel.bss sections in DYNOBJ, and set up shortcuts to them in our
- hash table. */
-
-static bfd_boolean
-elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf_i386_link_hash_table *htab;
-
- htab = elf_i386_hash_table (info);
- if (!htab->sgot && !create_got_section (dynobj, info))
- return FALSE;
-
- if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
- htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt");
- htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
- if (!info->shared)
- htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss");
-
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
- abort ();
-
- return TRUE;
-}
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed,
- struct elf_link_hash_entry *dir,
- struct elf_link_hash_entry *ind)
-{
- struct elf_i386_link_hash_entry *edir, *eind;
-
- edir = (struct elf_i386_link_hash_entry *) dir;
- eind = (struct elf_i386_link_hash_entry *) ind;
-
- if (eind->dyn_relocs != NULL)
- {
- if (edir->dyn_relocs != NULL)
- {
- struct elf_i386_dyn_relocs **pp;
- struct elf_i386_dyn_relocs *p;
-
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
- {
- struct elf_i386_dyn_relocs *q;
-
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
- if (q->sec == p->sec)
- {
- q->pc_count += p->pc_count;
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->dyn_relocs;
- }
-
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
-
- if (ind->root.type == bfd_link_hash_indirect
- && dir->got.refcount <= 0)
- {
- edir->tls_type = eind->tls_type;
- eind->tls_type = GOT_UNKNOWN;
- }
-
- if (ELIMINATE_COPY_RELOCS
- && ind->root.type != bfd_link_hash_indirect
- && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- dir->elf_link_hash_flags |=
- (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_HASH_NEEDS_PLT
- | ELF_LINK_POINTER_EQUALITY_NEEDED));
- else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-}
-
-static int
-elf_i386_tls_transition (struct bfd_link_info *info, int r_type, int is_local)
-{
- if (info->shared)
- return r_type;
-
- switch (r_type)
- {
- case R_386_TLS_GD:
- case R_386_TLS_IE_32:
- if (is_local)
- return R_386_TLS_LE_32;
- return R_386_TLS_IE_32;
- case R_386_TLS_IE:
- case R_386_TLS_GOTIE:
- if (is_local)
- return R_386_TLS_LE_32;
- return r_type;
- case R_386_TLS_LDM:
- return R_386_TLS_LE_32;
- }
-
- return r_type;
-}
-
-/* Look through the relocs for a section during the first phase, and
- calculate needed space in the global offset table, procedure linkage
- table, and dynamic reloc sections. */
-
-static bfd_boolean
-elf_i386_check_relocs (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- const Elf_Internal_Rela *relocs)
-{
- struct elf_i386_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sreloc;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf_i386_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
-
- sreloc = NULL;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned int r_type;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- r_type = ELF32_R_TYPE (rel->r_info);
-
- if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
- r_symndx);
- return FALSE;
- }
-
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- r_type = elf_i386_tls_transition (info, r_type, h == NULL);
-
- switch (r_type)
- {
- case R_386_TLS_LDM:
- htab->tls_ldm_got.refcount += 1;
- goto create_got;
-
- case R_386_PLT32:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
-
- /* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
- if (h == NULL)
- continue;
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- break;
-
- case R_386_TLS_IE_32:
- case R_386_TLS_IE:
- case R_386_TLS_GOTIE:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- /* Fall through */
-
- case R_386_GOT32:
- case R_386_TLS_GD:
- /* This symbol requires a global offset table entry. */
- {
- int tls_type, old_tls_type;
-
- switch (r_type)
- {
- default:
- case R_386_GOT32: tls_type = GOT_NORMAL; break;
- case R_386_TLS_GD: tls_type = GOT_TLS_GD; break;
- case R_386_TLS_IE_32:
- if (ELF32_R_TYPE (rel->r_info) == r_type)
- tls_type = GOT_TLS_IE_NEG;
- else
- /* If this is a GD->IE transition, we may use either of
- R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */
- tls_type = GOT_TLS_IE;
- break;
- case R_386_TLS_IE:
- case R_386_TLS_GOTIE:
- tls_type = GOT_TLS_IE_POS; break;
- }
-
- if (h != NULL)
- {
- h->got.refcount += 1;
- old_tls_type = elf_i386_hash_entry(h)->tls_type;
- }
- else
- {
- bfd_signed_vma *local_got_refcounts;
-
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma) + sizeof(char));
- local_got_refcounts = bfd_zalloc (abfd, size);
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- elf_i386_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + symtab_hdr->sh_info);
- }
- local_got_refcounts[r_symndx] += 1;
- old_tls_type = elf_i386_local_got_tls_type (abfd) [r_symndx];
- }
-
- if ((old_tls_type & GOT_TLS_IE) && (tls_type & GOT_TLS_IE))
- tls_type |= old_tls_type;
- /* If a TLS symbol is accessed using IE at least once,
- there is no point to use dynamic model for it. */
- else if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
- && (old_tls_type != GOT_TLS_GD
- || (tls_type & GOT_TLS_IE) == 0))
- {
- if ((old_tls_type & GOT_TLS_IE) && tls_type == GOT_TLS_GD)
- tls_type = old_tls_type;
- else
- {
- (*_bfd_error_handler)
- (_("%s: `%s' accessed both as normal and "
- "thread local symbol"),
- bfd_archive_filename (abfd),
- h ? h->root.root.string : "<local>");
- return FALSE;
- }
- }
-
- if (old_tls_type != tls_type)
- {
- if (h != NULL)
- elf_i386_hash_entry (h)->tls_type = tls_type;
- else
- elf_i386_local_got_tls_type (abfd) [r_symndx] = tls_type;
- }
- }
- /* Fall through */
-
- case R_386_GOTOFF:
- case R_386_GOTPC:
- create_got:
- if (htab->sgot == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
- return FALSE;
- }
- if (r_type != R_386_TLS_IE)
- break;
- /* Fall through */
-
- case R_386_TLS_LE_32:
- case R_386_TLS_LE:
- if (!info->shared)
- break;
- info->flags |= DF_STATIC_TLS;
- /* Fall through */
-
- case R_386_32:
- case R_386_PC32:
- if (h != NULL && !info->shared)
- {
- /* If this reloc is in a read-only section, we might
- need a copy reloc. We can't check reliably at this
- stage whether the section is read-only, as input
- sections have not yet been mapped to output sections.
- Tentatively set the flag for now, and correct in
- adjust_dynamic_symbol. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- /* We may need a .plt entry if the function this reloc
- refers to is in a shared lib. */
- h->plt.refcount += 1;
- if (r_type != R_386_PC32)
- h->elf_link_hash_flags |= ELF_LINK_POINTER_EQUALITY_NEEDED;
- }
-
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). In case of a weak definition,
- DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
- storing information in the relocs_copied field of the hash
- table entry. A similar situation occurs when creating
- shared libraries and symbol visibility changes render the
- symbol local.
-
- If on the other hand, we are creating an executable, we
- may need to keep relocations for symbols satisfied by a
- dynamic library if we manage to avoid copy relocs for the
- symbol. */
- if ((info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && (r_type != R_386_PC32
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- struct elf_i386_dyn_relocs *p;
- struct elf_i386_dyn_relocs **head;
-
- /* We must copy these reloc types into the output file.
- Create a reloc section in dynobj and make room for
- this reloc. */
- if (sreloc == NULL)
- {
- const char *name;
- bfd *dynobj;
- unsigned int strndx = elf_elfheader (abfd)->e_shstrndx;
- unsigned int shnam = elf_section_data (sec)->rel_hdr.sh_name;
-
- name = bfd_elf_string_from_elf_section (abfd, strndx, shnam);
- if (name == NULL)
- return FALSE;
-
- if (strncmp (name, ".rel", 4) != 0
- || strcmp (bfd_get_section_name (abfd, sec),
- name + 4) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
- }
-
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
-
- dynobj = htab->elf.dynobj;
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return FALSE;
- }
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- {
- head = &((struct elf_i386_link_hash_entry *) h)->dyn_relocs;
- }
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
-
- asection *s;
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct elf_i386_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->sec != sec)
- {
- bfd_size_type amt = sizeof *p;
- p = bfd_alloc (htab->elf.dynobj, amt);
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
- }
-
- p->count += 1;
- if (r_type == R_386_PC32)
- p->pc_count += 1;
- }
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_386_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_386_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-elf_i386_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_386_GNU_VTINHERIT:
- case R_386_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf_i386_gc_sweep_hook (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- const Elf_Internal_Rela *relocs)
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h = NULL;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_i386_link_hash_entry *eh;
- struct elf_i386_dyn_relocs **pp;
- struct elf_i386_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct elf_i386_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- r_type = ELF32_R_TYPE (rel->r_info);
- r_type = elf_i386_tls_transition (info, r_type, h != NULL);
- switch (r_type)
- {
- case R_386_TLS_LDM:
- if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0)
- elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1;
- break;
-
- case R_386_TLS_GD:
- case R_386_TLS_IE_32:
- case R_386_TLS_IE:
- case R_386_TLS_GOTIE:
- case R_386_GOT32:
- if (h != NULL)
- {
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- case R_386_32:
- case R_386_PC32:
- if (info->shared)
- break;
- /* Fall through */
-
- case R_386_PLT32:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
-{
- struct elf_i386_link_hash_table *htab;
- asection *s;
- unsigned int power_of_two;
-
- /* If this is a function, put it in the procedure linkage table. We
- will fill in the contents of the procedure linkage table later,
- when we know the address of the .got section. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- if (h->plt.refcount <= 0
- || SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
- such a case, we don't actually need to build a procedure
- linkage table, and we can just do a PC32 reloc instead. */
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- return TRUE;
- }
- else
- /* It's possible that we incorrectly decided a .plt reloc was
- needed for an R_386_PC32 reloc to a non-function sym in
- check_relocs. We can't decide accurately between function and
- non-function syms in check-relocs; Objects loaded later in
- the link may change h->type. So fix it now. */
- h->plt.offset = (bfd_vma) -1;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
- h->elf_link_hash_flags
- = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
- | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* If there are no references to this symbol that do not use the
- GOT, we don't need to generate a copy reloc. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
- return TRUE;
-
- /* If -z nocopyreloc was given, we won't generate them either. */
- if (info->nocopyreloc)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
-
- if (ELIMINATE_COPY_RELOCS)
- {
- struct elf_i386_link_hash_entry * eh;
- struct elf_i386_dyn_relocs *p;
-
- eh = (struct elf_i386_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
-
- /* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
- if (p == NULL)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
- }
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
-
- htab = elf_i386_hash_table (info);
-
- /* We must generate a R_386_COPY reloc to tell the dynamic linker to
- copy the initial value out of the dynamic object and into the
- runtime process image. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- htab->srelbss->_raw_size += sizeof (Elf32_External_Rel);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s = htab->sdynbss;
- s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Allocate space in .plt, .got and associated reloc sections for
- dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
-{
- struct bfd_link_info *info;
- struct elf_i386_link_hash_table *htab;
- struct elf_i386_link_hash_entry *eh;
- struct elf_i386_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- info = (struct bfd_link_info *) inf;
- htab = elf_i386_hash_table (info);
-
- if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
- {
- asection *s = htab->splt;
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_ENTRY_SIZE;
-
- h->plt.offset = s->_raw_size;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- htab->sgotplt->_raw_size += 4;
-
- /* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf32_External_Rel);
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- /* If R_386_TLS_{IE_32,IE,GOTIE} symbol is now local to the binary,
- make it a R_386_TLS_LE_32 requiring no TLS entry. */
- if (h->got.refcount > 0
- && !info->shared
- && h->dynindx == -1
- && (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE))
- h->got.offset = (bfd_vma) -1;
- else if (h->got.refcount > 0)
- {
- asection *s;
- bfd_boolean dyn;
- int tls_type = elf_i386_hash_entry(h)->tls_type;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += 4;
- /* R_386_TLS_GD needs 2 consecutive GOT slots. */
- if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE_BOTH)
- s->_raw_size += 4;
- dyn = htab->elf.dynamic_sections_created;
- /* R_386_TLS_IE_32 needs one dynamic relocation,
- R_386_TLS_IE resp. R_386_TLS_GOTIE needs one dynamic relocation,
- (but if both R_386_TLS_IE_32 and R_386_TLS_IE is present, we
- need two), R_386_TLS_GD needs one if local symbol and two if
- global. */
- if (tls_type == GOT_TLS_IE_BOTH)
- htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel);
- else if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
- || (tls_type & GOT_TLS_IE))
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
- else if (tls_type == GOT_TLS_GD)
- htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel);
- else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- eh = (struct elf_i386_link_hash_entry *) h;
- if (eh->dyn_relocs == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for pc-relative relocs that have become local due to symbol
- visibility changes. */
-
- if (info->shared)
- {
- /* The only reloc that uses pc_count is R_386_PC32, which will
- appear on a call or on something like ".long foo - .". We
- want calls to protected symbols to resolve directly to the
- function rather than going via the plt. If people want
- function pointer comparisons to work as expected then they
- should avoid writing assembly like ".long foo - .". */
- if (SYMBOL_CALLS_LOCAL (info, h))
- {
- struct elf_i386_dyn_relocs **pp;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
- {
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
- else
- pp = &p->next;
- }
- }
-
- /* Also discard relocs on undefined weak syms with non-default
- visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
- }
- else if (ELIMINATE_COPY_RELOCS)
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || (htab->elf.dynamic_sections_created
- && (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->dyn_relocs = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel);
- }
-
- return TRUE;
-}
-
-/* Find any dynamic relocs that apply to read-only sections. */
-
-static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
-{
- struct elf_i386_link_hash_entry *eh;
- struct elf_i386_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- eh = (struct elf_i386_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
-
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- {
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
- info->flags |= DF_TEXTREL;
-
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- struct elf_i386_link_hash_table *htab;
- bfd *dynobj;
- asection *s;
- bfd_boolean relocs;
- bfd *ibfd;
-
- htab = elf_i386_hash_table (info);
- dynobj = htab->elf.dynobj;
- if (dynobj == NULL)
- abort ();
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- if (s == NULL)
- abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
- char *local_tls_type;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srel;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct elf_i386_dyn_relocs *p;
-
- for (p = *((struct elf_i386_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- srel = elf_section_data (p->sec)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_local_got = local_got + locsymcount;
- local_tls_type = elf_i386_local_got_tls_type (ibfd);
- s = htab->sgot;
- srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
- {
- if (*local_got > 0)
- {
- *local_got = s->_raw_size;
- s->_raw_size += 4;
- if (*local_tls_type == GOT_TLS_GD
- || *local_tls_type == GOT_TLS_IE_BOTH)
- s->_raw_size += 4;
- if (info->shared
- || *local_tls_type == GOT_TLS_GD
- || (*local_tls_type & GOT_TLS_IE))
- {
- if (*local_tls_type == GOT_TLS_IE_BOTH)
- srel->_raw_size += 2 * sizeof (Elf32_External_Rel);
- else
- srel->_raw_size += sizeof (Elf32_External_Rel);
- }
- }
- else
- *local_got = (bfd_vma) -1;
- }
- }
-
- if (htab->tls_ldm_got.refcount > 0)
- {
- /* Allocate 2 got entries and 1 dynamic reloc for R_386_TLS_LDM
- relocs. */
- htab->tls_ldm_got.offset = htab->sgot->_raw_size;
- htab->sgot->_raw_size += 8;
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
- }
- else
- htab->tls_ldm_got.offset = -1;
-
- /* Allocate global sym .plt and .got entries, and space for global
- sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
-
- /* We now have determined the sizes of the various dynamic sections.
- Allocate memory for them. */
- relocs = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- }
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0)
- {
- if (s->_raw_size != 0 && s != htab->srelplt)
- relocs = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- else
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is mostly to handle .rel.bss and
- .rel.plt. We must create both sections in
- create_dynamic_sections, because they must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
-
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. We use bfd_zalloc
- here in case unused entries are not reclaimed before the
- section's contents are written out. This should not happen,
- but this way if it does, we get a R_386_NONE reloc instead
- of garbage. */
- s->contents = bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in elf_i386_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->splt->_raw_size != 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 (!add_dynamic_entry (DT_REL, 0)
- || !add_dynamic_entry (DT_RELSZ, 0)
- || !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel)))
- return FALSE;
-
- /* If any dynamic relocs apply to a read-only section,
- then we need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
- (PTR) info);
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-/* Set the correct type for an x86 ELF section. We do this by the
- section name, which is a hack, but ought to work. */
-
-static bfd_boolean
-elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
- Elf_Internal_Shdr *hdr,
- asection *sec)
-{
- register const char *name;
-
- name = bfd_get_section_name (abfd, sec);
-
- /* This is an ugly, but unfortunately necessary hack that is
- needed when producing EFI binaries on x86. It tells
- elf.c:elf_fake_sections() not to consider ".reloc" as a section
- containing ELF relocation info. We need this hack in order to
- be able to generate ELF binaries that can be translated into
- EFI applications (which are essentially COFF objects). Those
- files contain a COFF ".reloc" section inside an ELFNN object,
- which would normally cause BFD to segfault because it would
- attempt to interpret this section as containing relocation
- entries for section "oc". With this hack enabled, ".reloc"
- will be treated as a normal data section, which will avoid the
- segfault. However, you won't be able to create an ELFNN binary
- with a section named "oc" that needs relocations, but that's
- the kind of ugly side-effects you get when detecting section
- types based on their names... In practice, this limitation is
- unlikely to bite. */
- if (strcmp (name, ".reloc") == 0)
- hdr->sh_type = SHT_PROGBITS;
-
- return TRUE;
-}
-
-/* Return the base VMA address which should be subtracted from real addresses
- when resolving @dtpoff relocation.
- This is PT_TLS segment p_vaddr. */
-
-static bfd_vma
-dtpoff_base (struct bfd_link_info *info)
-{
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (elf_hash_table (info)->tls_sec == NULL)
- return 0;
- return elf_hash_table (info)->tls_sec->vma;
-}
-
-/* Return the relocation value for @tpoff relocation
- if STT_TLS virtual address is ADDRESS. */
-
-static bfd_vma
-tpoff (struct bfd_link_info *info, bfd_vma address)
-{
- struct elf_link_hash_table *htab = elf_hash_table (info);
-
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (htab->tls_sec == NULL)
- return 0;
- return htab->tls_size + htab->tls_sec->vma - address;
-}
-
-/* Relocate an i386 ELF section. */
-
-static bfd_boolean
-elf_i386_relocate_section (bfd *output_bfd,
- struct bfd_link_info *info,
- bfd *input_bfd,
- asection *input_section,
- bfd_byte *contents,
- Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms,
- asection **local_sections)
-{
- struct elf_i386_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
-
- htab = elf_i386_hash_table (info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- unsigned int r_type;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sec;
- bfd_vma off;
- bfd_vma relocation;
- bfd_boolean unresolved_reloc;
- bfd_reloc_status_type r;
- unsigned int indx;
- int tls_type;
-
- r_type = ELF32_R_TYPE (rel->r_info);
- if (r_type == R_386_GNU_VTINHERIT
- || r_type == R_386_GNU_VTENTRY)
- continue;
-
- if ((indx = r_type) >= R_386_standard
- && ((indx = r_type - R_386_ext_offset) - R_386_standard
- >= R_386_ext - R_386_standard)
- && ((indx = r_type - R_386_tls_offset) - R_386_ext
- >= R_386_tls - R_386_ext))
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- howto = elf_howto_table + indx;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (info->relocatable)
- {
- bfd_vma val;
- bfd_byte *where;
-
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx >= symtab_hdr->sh_info)
- continue;
-
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
- continue;
-
- sec = local_sections[r_symndx];
- val = sec->output_offset;
- if (val == 0)
- continue;
-
- where = contents + rel->r_offset;
- switch (howto->size)
- {
- /* FIXME: overflow checks. */
- case 0:
- val += bfd_get_8 (input_bfd, where);
- bfd_put_8 (input_bfd, val, where);
- break;
- case 1:
- val += bfd_get_16 (input_bfd, where);
- bfd_put_16 (input_bfd, val, where);
- break;
- case 2:
- val += bfd_get_32 (input_bfd, where);
- bfd_put_32 (input_bfd, val, where);
- break;
- default:
- abort ();
- }
- continue;
- }
-
- /* This is a final link. */
- h = NULL;
- sym = NULL;
- sec = NULL;
- unresolved_reloc = FALSE;
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- asection *msec;
- bfd_vma addend;
- bfd_byte *where = contents + rel->r_offset;
-
- switch (howto->size)
- {
- case 0:
- addend = bfd_get_8 (input_bfd, where);
- if (howto->pc_relative)
- {
- addend = (addend ^ 0x80) - 0x80;
- addend += 1;
- }
- break;
- case 1:
- addend = bfd_get_16 (input_bfd, where);
- if (howto->pc_relative)
- {
- addend = (addend ^ 0x8000) - 0x8000;
- addend += 2;
- }
- break;
- case 2:
- addend = bfd_get_32 (input_bfd, where);
- if (howto->pc_relative)
- {
- addend = (addend ^ 0x80000000) - 0x80000000;
- addend += 4;
- }
- break;
- default:
- abort ();
- }
-
- msec = sec;
- addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend);
- addend -= relocation;
- addend += msec->output_section->vma + msec->output_offset;
-
- switch (howto->size)
- {
- case 0:
- /* FIXME: overflow checks. */
- if (howto->pc_relative)
- addend -= 1;
- bfd_put_8 (input_bfd, addend, where);
- break;
- case 1:
- if (howto->pc_relative)
- addend -= 2;
- bfd_put_16 (input_bfd, addend, where);
- break;
- case 2:
- if (howto->pc_relative)
- addend -= 4;
- bfd_put_32 (input_bfd, addend, where);
- break;
- }
- }
- }
- else
- {
- bfd_boolean warned;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
- }
-
- switch (r_type)
- {
- case R_386_GOT32:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- {
- bfd_boolean dyn;
-
- off = h->got.offset;
- dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h))
- || (ELF_ST_VISIBILITY (h->other)
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally, or the symbol was forced to be local
- because of a version file. We must initialize
- this entry in the global offset table. Since the
- offset must always be a multiple of 4, we use the
- least significant bit to record whether we have
- initialized it already.
-
- When doing a dynamic link, we create a .rel.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
- else
- unresolved_reloc = FALSE;
- }
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
-
- /* The offset must always be a multiple of 4. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
-
- if (info->shared)
- {
- asection *s;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- s = htab->srelgot;
- if (s == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- loc = s->contents;
- loc += s->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- }
-
- local_got_offsets[r_symndx] |= 1;
- }
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
-
- relocation = htab->sgot->output_offset + off;
- break;
-
- case R_386_GOTOFF:
- /* Relocation is relative to the start of the global offset
- table. */
-
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- defined _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- relocation -= htab->sgot->output_section->vma;
- break;
-
- case R_386_GOTPC:
- /* Use global offset table as symbol value. */
- relocation = htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- break;
-
- case R_386_PLT32:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
-
- if (h->plt.offset == (bfd_vma) -1
- || htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = FALSE;
- break;
-
- case R_386_32:
- case R_386_PC32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
- break;
-
- if ((info->shared
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (r_type != R_386_PC32
- || !SYMBOL_CALLS_LOCAL (info, h)))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && h != NULL
- && h->dynindx != -1
- && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- bfd_boolean skip, relocate;
- asection *sreloc;
-
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
-
- skip = FALSE;
- relocate = FALSE;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
- && h->dynindx != -1
- && (r_type == R_386_PC32
- || !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
- else
- {
- /* This symbol is local, or marked to become local. */
- relocate = TRUE;
- outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- }
-
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
-
- /* If this reloc is against an external symbol, we do
- not want to fiddle with the addend. Otherwise, we
- need to include the symbol value so that it becomes
- an addend for the dynamic reloc. */
- if (! relocate)
- continue;
- }
- break;
-
- case R_386_TLS_IE:
- if (info->shared)
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- asection *sreloc;
-
- outrel.r_offset = rel->r_offset
- + input_section->output_section->vma
- + input_section->output_offset;
- outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- }
- /* Fall through */
-
- case R_386_TLS_GD:
- case R_386_TLS_IE_32:
- case R_386_TLS_GOTIE:
- r_type = elf_i386_tls_transition (info, r_type, h == NULL);
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf_i386_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- {
- tls_type = elf_i386_hash_entry(h)->tls_type;
- if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE))
- r_type = R_386_TLS_LE_32;
- }
- if (tls_type == GOT_TLS_IE)
- tls_type = GOT_TLS_IE_NEG;
- if (r_type == R_386_TLS_GD)
- {
- if (tls_type == GOT_TLS_IE_POS)
- r_type = R_386_TLS_GOTIE;
- else if (tls_type & GOT_TLS_IE)
- r_type = R_386_TLS_IE_32;
- }
-
- if (r_type == R_386_TLS_LE_32)
- {
- BFD_ASSERT (! unresolved_reloc);
- if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD)
- {
- unsigned int val, type;
- bfd_vma roff;
-
- /* GD->LE transition. */
- BFD_ASSERT (rel->r_offset >= 2);
- type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
- BFD_ASSERT (type == 0x8d || type == 0x04);
- BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset + 4)
- == 0xe8);
- BFD_ASSERT (rel + 1 < relend);
- BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
- roff = rel->r_offset + 5;
- val = bfd_get_8 (input_bfd,
- contents + rel->r_offset - 1);
- if (type == 0x04)
- {
- /* leal foo(,%reg,1), %eax; call ___tls_get_addr
- Change it into:
- movl %gs:0, %eax; subl $foo@tpoff, %eax
- (6 byte form of subl). */
- BFD_ASSERT (rel->r_offset >= 3);
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset - 3)
- == 0x8d);
- BFD_ASSERT ((val & 0xc7) == 0x05 && val != (4 << 3));
- memcpy (contents + rel->r_offset - 3,
- "\x65\xa1\0\0\0\0\x81\xe8\0\0\0", 12);
- }
- else
- {
- BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
- if (rel->r_offset + 10 <= input_section->_raw_size
- && bfd_get_8 (input_bfd,
- contents + rel->r_offset + 9) == 0x90)
- {
- /* leal foo(%reg), %eax; call ___tls_get_addr; nop
- Change it into:
- movl %gs:0, %eax; subl $foo@tpoff, %eax
- (6 byte form of subl). */
- memcpy (contents + rel->r_offset - 2,
- "\x65\xa1\0\0\0\0\x81\xe8\0\0\0", 12);
- roff = rel->r_offset + 6;
- }
- else
- {
- /* leal foo(%reg), %eax; call ___tls_get_addr
- Change it into:
- movl %gs:0, %eax; subl $foo@tpoff, %eax
- (5 byte form of subl). */
- memcpy (contents + rel->r_offset - 2,
- "\x65\xa1\0\0\0\0\x2d\0\0\0", 11);
- }
- }
- bfd_put_32 (output_bfd, tpoff (info, relocation),
- contents + roff);
- /* Skip R_386_PLT32. */
- rel++;
- continue;
- }
- else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_IE)
- {
- unsigned int val, type;
-
- /* IE->LE transition:
- Originally it can be one of:
- movl foo, %eax
- movl foo, %reg
- addl foo, %reg
- We change it into:
- movl $foo, %eax
- movl $foo, %reg
- addl $foo, %reg. */
- BFD_ASSERT (rel->r_offset >= 1);
- val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
- BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size);
- if (val == 0xa1)
- {
- /* movl foo, %eax. */
- bfd_put_8 (output_bfd, 0xb8,
- contents + rel->r_offset - 1);
- }
- else
- {
- BFD_ASSERT (rel->r_offset >= 2);
- type = bfd_get_8 (input_bfd,
- contents + rel->r_offset - 2);
- switch (type)
- {
- case 0x8b:
- /* movl */
- BFD_ASSERT ((val & 0xc7) == 0x05);
- bfd_put_8 (output_bfd, 0xc7,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd,
- 0xc0 | ((val >> 3) & 7),
- contents + rel->r_offset - 1);
- break;
- case 0x03:
- /* addl */
- BFD_ASSERT ((val & 0xc7) == 0x05);
- bfd_put_8 (output_bfd, 0x81,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd,
- 0xc0 | ((val >> 3) & 7),
- contents + rel->r_offset - 1);
- break;
- default:
- BFD_FAIL ();
- break;
- }
- }
- bfd_put_32 (output_bfd, -tpoff (info, relocation),
- contents + rel->r_offset);
- continue;
- }
- else
- {
- unsigned int val, type;
-
- /* {IE_32,GOTIE}->LE transition:
- Originally it can be one of:
- subl foo(%reg1), %reg2
- movl foo(%reg1), %reg2
- addl foo(%reg1), %reg2
- We change it into:
- subl $foo, %reg2
- movl $foo, %reg2 (6 byte form)
- addl $foo, %reg2. */
- BFD_ASSERT (rel->r_offset >= 2);
- type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
- val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
- BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size);
- BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4);
- if (type == 0x8b)
- {
- /* movl */
- bfd_put_8 (output_bfd, 0xc7,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7),
- contents + rel->r_offset - 1);
- }
- else if (type == 0x2b)
- {
- /* subl */
- bfd_put_8 (output_bfd, 0x81,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd, 0xe8 | ((val >> 3) & 7),
- contents + rel->r_offset - 1);
- }
- else if (type == 0x03)
- {
- /* addl */
- bfd_put_8 (output_bfd, 0x81,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7),
- contents + rel->r_offset - 1);
- }
- else
- BFD_FAIL ();
- if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTIE)
- bfd_put_32 (output_bfd, -tpoff (info, relocation),
- contents + rel->r_offset);
- else
- bfd_put_32 (output_bfd, tpoff (info, relocation),
- contents + rel->r_offset);
- continue;
- }
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- off = h->got.offset;
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
- }
-
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- int dr_type, indx;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- indx = h && h->dynindx != -1 ? h->dynindx : 0;
- if (r_type == R_386_TLS_GD)
- dr_type = R_386_TLS_DTPMOD32;
- else if (tls_type == GOT_TLS_IE_POS)
- dr_type = R_386_TLS_TPOFF;
- else
- dr_type = R_386_TLS_TPOFF32;
- if (dr_type == R_386_TLS_TPOFF && indx == 0)
- bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
- htab->sgot->contents + off);
- else if (dr_type == R_386_TLS_TPOFF32 && indx == 0)
- bfd_put_32 (output_bfd, dtpoff_base (info) - relocation,
- htab->sgot->contents + off);
- else
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off);
- outrel.r_info = ELF32_R_INFO (indx, dr_type);
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
-
- if (r_type == R_386_TLS_GD)
- {
- if (indx == 0)
- {
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd,
- relocation - dtpoff_base (info),
- htab->sgot->contents + off + 4);
- }
- else
- {
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off + 4);
- outrel.r_info = ELF32_R_INFO (indx,
- R_386_TLS_DTPOFF32);
- outrel.r_offset += 4;
- htab->srelgot->reloc_count++;
- loc += sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- }
- }
- else if (tls_type == GOT_TLS_IE_BOTH)
- {
- bfd_put_32 (output_bfd,
- indx == 0 ? relocation - dtpoff_base (info) : 0,
- htab->sgot->contents + off + 4);
- outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF);
- outrel.r_offset += 4;
- htab->srelgot->reloc_count++;
- loc += sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- }
-
- if (h != NULL)
- h->got.offset |= 1;
- else
- local_got_offsets[r_symndx] |= 1;
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
- if (r_type == ELF32_R_TYPE (rel->r_info))
- {
- relocation = htab->sgot->output_offset + off;
- if ((r_type == R_386_TLS_IE || r_type == R_386_TLS_GOTIE)
- && tls_type == GOT_TLS_IE_BOTH)
- relocation += 4;
- if (r_type == R_386_TLS_IE)
- relocation += htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- }
- else
- {
- unsigned int val, type;
- bfd_vma roff;
-
- /* GD->IE transition. */
- BFD_ASSERT (rel->r_offset >= 2);
- type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
- BFD_ASSERT (type == 0x8d || type == 0x04);
- BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
- == 0xe8);
- BFD_ASSERT (rel + 1 < relend);
- BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
- roff = rel->r_offset - 3;
- val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
- if (type == 0x04)
- {
- /* leal foo(,%reg,1), %eax; call ___tls_get_addr
- Change it into:
- movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax. */
- BFD_ASSERT (rel->r_offset >= 3);
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset - 3)
- == 0x8d);
- BFD_ASSERT ((val & 0xc7) == 0x05 && val != (4 << 3));
- val >>= 3;
- }
- else
- {
- /* leal foo(%reg), %eax; call ___tls_get_addr; nop
- Change it into:
- movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax. */
- BFD_ASSERT (rel->r_offset + 10 <= input_section->_raw_size);
- BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset + 9)
- == 0x90);
- roff = rel->r_offset - 2;
- }
- memcpy (contents + roff,
- "\x65\xa1\0\0\0\0\x2b\x80\0\0\0", 12);
- contents[roff + 7] = 0x80 | (val & 7);
- /* If foo is used only with foo@gotntpoff(%reg) and
- foo@indntpoff, but not with foo@gottpoff(%reg), change
- subl $foo@gottpoff(%reg), %eax
- into:
- addl $foo@gotntpoff(%reg), %eax. */
- if (r_type == R_386_TLS_GOTIE)
- {
- contents[roff + 6] = 0x03;
- if (tls_type == GOT_TLS_IE_BOTH)
- off += 4;
- }
- bfd_put_32 (output_bfd, htab->sgot->output_offset + off,
- contents + roff + 8);
- /* Skip R_386_PLT32. */
- rel++;
- continue;
- }
- break;
-
- case R_386_TLS_LDM:
- if (! info->shared)
- {
- unsigned int val;
-
- /* LD->LE transition:
- Ensure it is:
- leal foo(%reg), %eax; call ___tls_get_addr.
- We change it into:
- movl %gs:0, %eax; nop; leal 0(%esi,1), %esi. */
- BFD_ASSERT (rel->r_offset >= 2);
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 2)
- == 0x8d);
- val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
- BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
- BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
- == 0xe8);
- BFD_ASSERT (rel + 1 < relend);
- BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
- memcpy (contents + rel->r_offset - 2,
- "\x65\xa1\0\0\0\0\x90\x8d\x74\x26", 11);
- /* Skip R_386_PLT32. */
- rel++;
- continue;
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- off = htab->tls_ldm_got.offset;
- if (off & 1)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off);
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off + 4);
- outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32);
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- htab->tls_ldm_got.offset |= 1;
- }
- relocation = htab->sgot->output_offset + off;
- unresolved_reloc = FALSE;
- break;
-
- case R_386_TLS_LDO_32:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
- relocation -= dtpoff_base (info);
- else
- /* When converting LDO to LE, we must negate. */
- relocation = -tpoff (info, relocation);
- break;
-
- case R_386_TLS_LE_32:
- case R_386_TLS_LE:
- if (info->shared)
- {
- Elf_Internal_Rela outrel;
- asection *sreloc;
- bfd_byte *loc;
- int indx;
-
- outrel.r_offset = rel->r_offset
- + input_section->output_section->vma
- + input_section->output_offset;
- if (h != NULL && h->dynindx != -1)
- indx = h->dynindx;
- else
- indx = 0;
- if (r_type == R_386_TLS_LE_32)
- outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF32);
- else
- outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF);
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- if (indx)
- continue;
- else if (r_type == R_386_TLS_LE_32)
- relocation = dtpoff_base (info) - relocation;
- else
- relocation -= dtpoff_base (info);
- }
- else if (r_type == R_386_TLS_LE_32)
- relocation = tpoff (info, relocation);
- else
- relocation = -tpoff (info, relocation);
- break;
-
- default:
- break;
- }
-
- /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
- because such sections are not SEC_ALLOC and thus ld.so will
- not process them. */
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- h->root.root.string);
- return FALSE;
- }
-
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, 0);
-
- if (r != bfd_reloc_ok)
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
-
- if (r == bfd_reloc_overflow)
- {
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): reloc against `%s': error %d"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset, name, (int) r);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-elf_i386_finish_dynamic_symbol (bfd *output_bfd,
- struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- struct elf_i386_link_hash_table *htab;
-
- htab = elf_i386_hash_table (info);
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- bfd_vma plt_index;
- bfd_vma got_offset;
- Elf_Internal_Rela rel;
- bfd_byte *loc;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
- if (h->dynindx == -1
- || htab->splt == NULL
- || htab->sgotplt == NULL
- || htab->srelplt == NULL)
- abort ();
-
- /* Get the index in the procedure linkage table which
- corresponds to this symbol. This is the index of this symbol
- in all the symbols for which we are making plt entries. The
- first entry in the procedure linkage table is reserved. */
- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
-
- /* Get the offset into the .got table of the entry that
- corresponds to this function. Each .got entry is 4 bytes.
- The first three are reserved. */
- got_offset = (plt_index + 3) * 4;
-
- /* Fill in the entry in the procedure linkage table. */
- if (! info->shared)
- {
- memcpy (htab->splt->contents + h->plt.offset, elf_i386_plt_entry,
- PLT_ENTRY_SIZE);
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + got_offset),
- htab->splt->contents + h->plt.offset + 2);
- }
- else
- {
- memcpy (htab->splt->contents + h->plt.offset, elf_i386_pic_plt_entry,
- PLT_ENTRY_SIZE);
- bfd_put_32 (output_bfd, got_offset,
- htab->splt->contents + h->plt.offset + 2);
- }
-
- bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rel),
- htab->splt->contents + h->plt.offset + 7);
- bfd_put_32 (output_bfd, - (h->plt.offset + PLT_ENTRY_SIZE),
- htab->splt->contents + h->plt.offset + 12);
-
- /* Fill in the entry in the global offset table. */
- bfd_put_32 (output_bfd,
- (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset
- + 6),
- htab->sgotplt->contents + got_offset);
-
- /* Fill in the entry in the .rel.plt section. */
- rel.r_offset = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + got_offset);
- rel.r_info = ELF32_R_INFO (h->dynindx, R_386_JUMP_SLOT);
- loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value if there were any
- relocations where pointer equality matters (this is a clue
- for the dynamic linker, to make function pointer
- comparisons work between an application and shared
- library), otherwise set it to zero. If a function is only
- called from a binary, there is no need to slow down
- shared libraries because of that. */
- sym->st_shndx = SHN_UNDEF;
- if ((h->elf_link_hash_flags & ELF_LINK_POINTER_EQUALITY_NEEDED) == 0)
- sym->st_value = 0;
- }
- }
-
- if (h->got.offset != (bfd_vma) -1
- && elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD
- && (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE) == 0)
- {
- Elf_Internal_Rela rel;
- bfd_byte *loc;
-
- /* This symbol has an entry in the global offset table. Set it
- up. */
-
- if (htab->sgot == NULL || htab->srelgot == NULL)
- abort ();
-
- rel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + (h->got.offset & ~(bfd_vma) 1));
-
- /* If this is a static link, or it is a -Bsymbolic link and the
- symbol is defined locally or was forced to be local because
- of a version file, we just want to emit a RELATIVE reloc.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h))
- {
- BFD_ASSERT((h->got.offset & 1) != 0);
- rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- }
- else
- {
- BFD_ASSERT((h->got.offset & 1) == 0);
- bfd_put_32 (output_bfd, (bfd_vma) 0,
- htab->sgot->contents + h->got.offset);
- rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT);
- }
-
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- Elf_Internal_Rela rel;
- bfd_byte *loc;
-
- /* This symbol needs a copy reloc. Set it up. */
-
- if (h->dynindx == -1
- || (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || htab->srelbss == NULL)
- abort ();
-
- rel.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY);
- loc = htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
- }
-
- /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Used to decide how to sort relocs in an optimal manner for the
- dynamic linker, before writing them out. */
-
-static enum elf_reloc_type_class
-elf_i386_reloc_type_class (const Elf_Internal_Rela *rela)
-{
- switch (ELF32_R_TYPE (rela->r_info))
- {
- case R_386_RELATIVE:
- return reloc_class_relative;
- case R_386_JUMP_SLOT:
- return reloc_class_plt;
- case R_386_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-elf_i386_finish_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- struct elf_i386_link_hash_table *htab;
- bfd *dynobj;
- asection *sdyn;
-
- htab = elf_i386_hash_table (info);
- dynobj = htab->elf.dynobj;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (htab->elf.dynamic_sections_created)
- {
- Elf32_External_Dyn *dyncon, *dynconend;
-
- if (sdyn == NULL || htab->sgot == NULL)
- abort ();
-
- dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- asection *s;
-
- bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- continue;
-
- case DT_PLTGOT:
- dyn.d_un.d_ptr = htab->sgot->output_section->vma;
- break;
-
- case DT_JMPREL:
- s = htab->srelplt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- break;
-
- case DT_PLTRELSZ:
- s = htab->srelplt;
- dyn.d_un.d_val = s->_raw_size;
- break;
-
- case DT_RELSZ:
- /* My reading of the SVR4 ABI indicates that the
- procedure linkage table relocs (DT_JMPREL) should be
- included in the overall relocs (DT_REL). This is
- what Solaris does. However, UnixWare can not handle
- that case. Therefore, we override the DT_RELSZ entry
- here to make it not include the JMPREL relocs. */
- s = htab->srelplt;
- if (s == NULL)
- continue;
- dyn.d_un.d_val -= s->_raw_size;
- break;
-
- case DT_REL:
- /* We may not be using the standard ELF linker script.
- If .rel.plt is the first .rel section, we adjust
- DT_REL to not include it. */
- s = htab->srelplt;
- if (s == NULL)
- continue;
- if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
- continue;
- dyn.d_un.d_ptr += s->_raw_size;
- break;
- }
-
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
-
- /* Fill in the first entry in the procedure linkage table. */
- if (htab->splt && htab->splt->_raw_size > 0)
- {
- if (info->shared)
- memcpy (htab->splt->contents,
- elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE);
- else
- {
- memcpy (htab->splt->contents,
- elf_i386_plt0_entry, PLT_ENTRY_SIZE);
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + 4),
- htab->splt->contents + 2);
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + 8),
- htab->splt->contents + 8);
- }
-
- /* UnixWare sets the entsize of .plt to 4, although that doesn't
- really seem like the right value. */
- elf_section_data (htab->splt->output_section)
- ->this_hdr.sh_entsize = 4;
- }
- }
-
- if (htab->sgotplt)
- {
- /* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
- {
- bfd_put_32 (output_bfd,
- (sdyn == NULL ? 0
- : sdyn->output_section->vma + sdyn->output_offset),
- htab->sgotplt->contents);
- bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 4);
- bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 8);
- }
-
- elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = 4;
- }
- return TRUE;
-}
-
-#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
-#define TARGET_LITTLE_NAME "elf32-i386"
-#define ELF_ARCH bfd_arch_i386
-#define ELF_MACHINE_CODE EM_386
-#define ELF_MAXPAGESIZE 0x1000
-
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_want_got_plt 1
-#define elf_backend_plt_readonly 1
-#define elf_backend_want_plt_sym 0
-#define elf_backend_got_header_size 12
-
-/* Support RELA for objdump of prelink objects. */
-#define elf_info_to_howto elf_i386_info_to_howto_rel
-#define elf_info_to_howto_rel elf_i386_info_to_howto_rel
-
-#define bfd_elf32_mkobject elf_i386_mkobject
-
-#define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name
-#define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create
-#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
-
-#define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol
-#define elf_backend_check_relocs elf_i386_check_relocs
-#define elf_backend_copy_indirect_symbol elf_i386_copy_indirect_symbol
-#define elf_backend_create_dynamic_sections elf_i386_create_dynamic_sections
-#define elf_backend_fake_sections elf_i386_fake_sections
-#define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections
-#define elf_backend_finish_dynamic_symbol elf_i386_finish_dynamic_symbol
-#define elf_backend_gc_mark_hook elf_i386_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf_i386_gc_sweep_hook
-#define elf_backend_grok_prstatus elf_i386_grok_prstatus
-#define elf_backend_grok_psinfo elf_i386_grok_psinfo
-#define elf_backend_reloc_type_class elf_i386_reloc_type_class
-#define elf_backend_relocate_section elf_i386_relocate_section
-#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
-
-#include "elf32-target.h"
-
-/* FreeBSD support. */
-
-#undef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec
-#undef TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
-
-/* The kernel recognizes executables as valid only if they carry a
- "FreeBSD" label in the ELF header. So we put this label on all
- executables and (for simplicity) also all other object files. */
-
-static void
-elf_i386_post_process_headers (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- Elf_Internal_Ehdr *i_ehdrp;
-
- i_ehdrp = elf_elfheader (abfd);
-
- /* Put an ABI label supported by FreeBSD >= 4.1. */
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#ifdef OLD_FREEBSD_ABI_LABEL
- /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
- memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
-#endif
-}
-
-#undef elf_backend_post_process_headers
-#define elf_backend_post_process_headers elf_i386_post_process_headers
-#undef elf32_bed
-#define elf32_bed elf32_i386_fbsd_bed
-
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c
deleted file mode 100644
index a0480f0..0000000
--- a/contrib/binutils/bfd/elf32-mips.c
+++ /dev/null
@@ -1,1618 +0,0 @@
-/* MIPS-specific support for 32-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
-
- Most of the information added by Ian Lance Taylor, Cygnus Support,
- <ian@cygnus.com>.
- N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
- <mark@codesourcery.com>
- Traditional MIPS targets support added by Koundinya.K, Dansk Data
- Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly
- different MIPS ELF from other targets. This matters when linking.
- This file supports both, switching at runtime. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-#include "genlink.h"
-#include "elf-bfd.h"
-#include "elfxx-mips.h"
-#include "elf/mips.h"
-
-/* Get the ECOFF swapping routines. */
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/internal.h"
-#include "coff/ecoff.h"
-#include "coff/mips.h"
-#define ECOFF_SIGNED_32
-#include "ecoffswap.h"
-
-static bfd_reloc_status_type gprel32_with_gp
- (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
-static bfd_reloc_status_type mips_elf_gprel32_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips32_64bit_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
- (bfd *, bfd_reloc_code_real_type);
-static reloc_howto_type *mips_elf32_rtype_to_howto
- (unsigned int, bfd_boolean);
-static void mips_info_to_howto_rel
- (bfd *, arelent *, Elf_Internal_Rela *);
-static void mips_info_to_howto_rela
- (bfd *, arelent *, Elf_Internal_Rela *);
-static bfd_boolean mips_elf_sym_is_global
- (bfd *, asymbol *);
-static bfd_boolean mips_elf32_object_p
- (bfd *);
-static bfd_boolean mips_elf_is_local_label_name
- (bfd *, const char *);
-static bfd_reloc_status_type mips16_jump_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips16_gprel_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips_elf_final_gp
- (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
-static bfd_boolean mips_elf_assign_gp
- (bfd *, bfd_vma *);
-static bfd_boolean elf32_mips_grok_prstatus
- (bfd *, Elf_Internal_Note *);
-static bfd_boolean elf32_mips_grok_psinfo
- (bfd *, Elf_Internal_Note *);
-static irix_compat_t elf32_mips_irix_compat
- (bfd *);
-
-extern const bfd_target bfd_elf32_bigmips_vec;
-extern const bfd_target bfd_elf32_littlemips_vec;
-
-/* Nonzero if ABFD is using the N32 ABI. */
-#define ABI_N32_P(abfd) \
- ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
-
-/* Whether we are trying to be compatible with IRIX at all. */
-#define SGI_COMPAT(abfd) \
- (elf32_mips_irix_compat (abfd) != ict_none)
-
-/* The number of local .got entries we reserve. */
-#define MIPS_RESERVED_GOTNO (2)
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-/* The relocation table used for SHT_REL sections. */
-
-static reloc_howto_type elf_mips_howto_table_rel[] =
-{
- /* No relocation. */
- HOWTO (R_MIPS_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit relocation. */
- HOWTO (R_MIPS_16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit relocation. */
- HOWTO (R_MIPS_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit symbol relative relocation. */
- HOWTO (R_MIPS_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 26 bit jump address. */
- HOWTO (R_MIPS_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC + 4. */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- TRUE, /* partial_inplace */
- 0x03ffffff, /* src_mask */
- 0x03ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of symbol value. */
- HOWTO (R_MIPS_HI16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_hi16_reloc, /* special_function */
- "R_MIPS_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of symbol value. */
- HOWTO (R_MIPS_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_lo16_reloc, /* special_function */
- "R_MIPS_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GP relative reference. */
- HOWTO (R_MIPS_GPREL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf32_gprel16_reloc, /* special_function */
- "R_MIPS_GPREL16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to literal section. */
- HOWTO (R_MIPS_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf32_gprel16_reloc, /* special_function */
- "R_MIPS_LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to global offset table. */
- HOWTO (R_MIPS_GOT16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_got16_reloc, /* special_function */
- "R_MIPS_GOT16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit PC relative reference. */
- HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_PC16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 16 bit call through global offset table. */
- HOWTO (R_MIPS_CALL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit GP relative reference. */
- HOWTO (R_MIPS_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_elf_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The remaining relocs are defined on Irix 5, although they are
- not defined by the ABI. */
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
-
- /* A 5 bit shift field. */
- HOWTO (R_MIPS_SHIFT5, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SHIFT5", /* name */
- TRUE, /* partial_inplace */
- 0x000007c0, /* src_mask */
- 0x000007c0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 6 bit shift field. */
- /* FIXME: This is not handled correctly; a special function is
- needed to put the most significant bit in the right place. */
- HOWTO (R_MIPS_SHIFT6, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 6, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SHIFT6", /* name */
- TRUE, /* partial_inplace */
- 0x000007c4, /* src_mask */
- 0x000007c4, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 64 bit relocation. */
- HOWTO (R_MIPS_64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips32_64bit_reloc, /* special_function */
- "R_MIPS_64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement in the global offset table. */
- HOWTO (R_MIPS_GOT_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_DISP", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement to page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_PAGE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_PAGE", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Offset from page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_OFST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_OFST", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit subtraction. Used in the N32 ABI. */
- HOWTO (R_MIPS_SUB, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SUB", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used to cause the linker to insert and delete instructions? */
- EMPTY_HOWTO (R_MIPS_INSERT_A),
- EMPTY_HOWTO (R_MIPS_INSERT_B),
- EMPTY_HOWTO (R_MIPS_DELETE),
-
- /* Get the higher value of a 64 bit addend. */
- HOWTO (R_MIPS_HIGHER, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HIGHER", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Get the highest value of a 64 bit addend. */
- HOWTO (R_MIPS_HIGHEST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HIGHEST", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Section displacement. */
- HOWTO (R_MIPS_SCN_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SCN_DISP", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (R_MIPS_REL16),
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
- EMPTY_HOWTO (R_MIPS_RELGOT),
-
- /* Protected jump conversion. This is an optimization hint. No
- relocation is required for correctness. */
- HOWTO (R_MIPS_JALR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_JALR", /* name */
- FALSE, /* partial_inplace */
- 0x00000000, /* src_mask */
- 0x00000000, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This
- is a hack to make the linker think that we need 64 bit values. */
-static reloc_howto_type elf_mips_ctor64_howto =
- HOWTO (R_MIPS_64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips32_64bit_reloc, /* special_function */
- "R_MIPS_64", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* The reloc used for the mips16 jump instruction. */
-static reloc_howto_type elf_mips16_jump_howto =
- HOWTO (R_MIPS16_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC. */
- mips16_jump_reloc, /* special_function */
- "R_MIPS16_26", /* name */
- TRUE, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* The reloc used for the mips16 gprel instruction. */
-static reloc_howto_type elf_mips16_gprel_howto =
- HOWTO (R_MIPS16_GPREL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips16_gprel_reloc, /* special_function */
- "R_MIPS16_GPREL", /* name */
- TRUE, /* partial_inplace */
- 0x07ff001f, /* src_mask */
- 0x07ff001f, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* GNU extensions for embedded-pic. */
-/* High 16 bits of symbol value, pc-relative. */
-static reloc_howto_type elf_mips_gnu_rel_hi16 =
- HOWTO (R_MIPS_GNU_REL_HI16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_hi16_reloc, /* special_function */
- "R_MIPS_GNU_REL_HI16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* Low 16 bits of symbol value, pc-relative. */
-static reloc_howto_type elf_mips_gnu_rel_lo16 =
- HOWTO (R_MIPS_GNU_REL_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_lo16_reloc, /* special_function */
- "R_MIPS_GNU_REL_LO16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* 16 bit offset for pc-relative branches. */
-static reloc_howto_type elf_mips_gnu_rel16_s2 =
- HOWTO (R_MIPS_GNU_REL16_S2, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GNU_REL16_S2", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* 64 bit pc-relative. */
-static reloc_howto_type elf_mips_gnu_pcrel64 =
- HOWTO (R_MIPS_PC64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_PC64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* 32 bit pc-relative. */
-static reloc_howto_type elf_mips_gnu_pcrel32 =
- HOWTO (R_MIPS_PC32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_PC32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* GNU extension to record C++ vtable hierarchy */
-static reloc_howto_type elf_mips_gnu_vtinherit_howto =
- HOWTO (R_MIPS_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_MIPS_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* GNU extension to record C++ vtable member usage */
-static reloc_howto_type elf_mips_gnu_vtentry_howto =
- HOWTO (R_MIPS_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_MIPS_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
- dangerous relocation. */
-
-static bfd_boolean
-mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp)
-{
- unsigned int count;
- asymbol **sym;
- unsigned int i;
-
- /* If we've already figured out what GP will be, just return it. */
- *pgp = _bfd_get_gp_value (output_bfd);
- if (*pgp)
- return TRUE;
-
- count = bfd_get_symcount (output_bfd);
- sym = bfd_get_outsymbols (output_bfd);
-
- /* The linker script will have created a symbol named `_gp' with the
- appropriate value. */
- if (sym == NULL)
- i = count;
- else
- {
- for (i = 0; i < count; i++, sym++)
- {
- register const char *name;
-
- name = bfd_asymbol_name (*sym);
- if (*name == '_' && strcmp (name, "_gp") == 0)
- {
- *pgp = bfd_asymbol_value (*sym);
- _bfd_set_gp_value (output_bfd, *pgp);
- break;
- }
- }
- }
-
- if (i >= count)
- {
- /* Only get the error once. */
- *pgp = 4;
- _bfd_set_gp_value (output_bfd, *pgp);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We have to figure out the gp value, so that we can adjust the
- symbol value correctly. We look up the symbol _gp in the output
- BFD. If we can't find it, we're stuck. We cache it in the ELF
- target data. We don't need to adjust the symbol value for an
- external symbol if we are producing relocatable output. */
-
-static bfd_reloc_status_type
-mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
- char **error_message, bfd_vma *pgp)
-{
- if (bfd_is_und_section (symbol->section)
- && ! relocatable)
- {
- *pgp = 0;
- return bfd_reloc_undefined;
- }
-
- *pgp = _bfd_get_gp_value (output_bfd);
- if (*pgp == 0
- && (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0))
- {
- if (relocatable)
- {
- /* Make up a value. */
- *pgp = symbol->section->output_section->vma + 0x4000;
- _bfd_set_gp_value (output_bfd, *pgp);
- }
- else if (!mips_elf_assign_gp (output_bfd, pgp))
- {
- *error_message =
- (char *) _("GP relative relocation when _gp not defined");
- return bfd_reloc_dangerous;
- }
- }
-
- return bfd_reloc_ok;
-}
-
-/* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
- become the offset from the gp register. This function also handles
- R_MIPS_LITERAL relocations, although those can be handled more
- cleverly because the entries in the .lit8 and .lit4 sections can be
- merged. */
-
-bfd_reloc_status_type
-_bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry,
- asymbol *symbol, void *data,
- asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
- input_section, relocatable,
- data, gp);
-}
-
-/* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
- become the offset from the gp register. */
-
-static bfd_reloc_status_type
-mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf_final_gp (output_bfd, symbol, relocatable,
- error_message, &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
- relocatable, data, gp);
-}
-
-static bfd_reloc_status_type
-gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
- asection *input_section, bfd_boolean relocatable,
- void *data, bfd_vma gp)
-{
- bfd_vma relocation;
- bfd_vma val;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- /* Set val to the offset into the section or symbol. */
- val = reloc_entry->addend;
-
- if (reloc_entry->howto->partial_inplace)
- val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- if (reloc_entry->howto->partial_inplace)
- bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
- else
- reloc_entry->addend = val;
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
-
- return bfd_reloc_ok;
-}
-
-/* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are
- generated when addresses are 64 bits. The upper 32 bits are a simple
- sign extension. */
-
-static bfd_reloc_status_type
-mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry,
- asymbol *symbol ATTRIBUTE_UNUSED,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- bfd_reloc_status_type r;
- arelent reloc32;
- unsigned long val;
- bfd_size_type addr;
-
- /* Do a normal 32 bit relocation on the lower 32 bits. */
- reloc32 = *reloc_entry;
- if (bfd_big_endian (abfd))
- reloc32.address += 4;
- reloc32.howto = &elf_mips_howto_table_rel[R_MIPS_32];
- r = bfd_perform_relocation (abfd, &reloc32, data, input_section,
- output_bfd, error_message);
-
- /* Sign extend into the upper 32 bits. */
- val = bfd_get_32 (abfd, (bfd_byte *) data + reloc32.address);
- if ((val & 0x80000000) != 0)
- val = 0xffffffff;
- else
- val = 0;
- addr = reloc_entry->address;
- if (bfd_little_endian (abfd))
- addr += 4;
- bfd_put_32 (abfd, val, (bfd_byte *) data + addr);
-
- return r;
-}
-
-/* Handle a mips16 jump. */
-
-static bfd_reloc_status_type
-mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && reloc_entry->addend == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* FIXME. */
- {
- static bfd_boolean warned;
-
- if (! warned)
- (*_bfd_error_handler)
- (_("Linking mips16 objects into %s format is not supported"),
- bfd_get_target (input_section->output_section->owner));
- warned = TRUE;
- }
-
- return bfd_reloc_undefined;
-}
-
-/* Handle a mips16 GP relative reloc. */
-
-static bfd_reloc_status_type
-mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
- unsigned short extend = 0;
- unsigned short insn = 0;
- bfd_signed_vma val;
- bfd_vma relocation;
-
- /* If we're relocating, and this is an external symbol, we don't want
- to change anything. */
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (symbol->flags & BSF_LOCAL) != 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- /* Set val to the offset into the section or symbol. */
- val = reloc_entry->addend;
-
- if (reloc_entry->howto->partial_inplace)
- {
- /* Pick up the mips16 extend instruction and the real instruction. */
- extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
- insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2);
- val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f);
- }
-
- _bfd_mips_elf_sign_extend(val, 16);
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- if (reloc_entry->howto->partial_inplace)
- {
- bfd_put_16 (abfd,
- (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0),
- (bfd_byte *) data + reloc_entry->address);
- bfd_put_16 (abfd,
- (insn & 0xffe0) | (val & 0x1f),
- (bfd_byte *) data + reloc_entry->address + 2);
- }
- else
- reloc_entry->addend = val;
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
- else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0))
- return bfd_reloc_overflow;
-
- return bfd_reloc_ok;
-}
-
-/* A mapping from BFD reloc types to MIPS ELF reloc types. */
-
-struct elf_reloc_map {
- bfd_reloc_code_real_type bfd_val;
- enum elf_mips_reloc_type elf_val;
-};
-
-static const struct elf_reloc_map mips_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_MIPS_NONE },
- { BFD_RELOC_16, R_MIPS_16 },
- { BFD_RELOC_32, R_MIPS_32 },
- /* There is no BFD reloc for R_MIPS_REL32. */
- { BFD_RELOC_64, R_MIPS_64 },
- { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
- { BFD_RELOC_HI16_S, R_MIPS_HI16 },
- { BFD_RELOC_LO16, R_MIPS_LO16 },
- { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
- { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
- { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
- { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
- { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
- { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
- { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
- { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
- { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
- { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
- { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
- { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
- { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
- { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }
-};
-
-/* Given a BFD reloc type, return a howto structure. */
-
-static reloc_howto_type *
-bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
-{
- unsigned int i;
- reloc_howto_type *howto_table = elf_mips_howto_table_rel;
-
- for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
- i++)
- {
- if (mips_reloc_map[i].bfd_val == code)
- return &howto_table[(int) mips_reloc_map[i].elf_val];
- }
-
- switch (code)
- {
- default:
- bfd_set_error (bfd_error_bad_value);
- return NULL;
-
- case BFD_RELOC_CTOR:
- /* We need to handle BFD_RELOC_CTOR specially.
- Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the
- size of addresses of the ABI. */
- if ((elf_elfheader (abfd)->e_flags & (E_MIPS_ABI_O64
- | E_MIPS_ABI_EABI64)) != 0)
- return &elf_mips_ctor64_howto;
- else
- return &howto_table[(int) R_MIPS_32];
-
- case BFD_RELOC_MIPS16_JMP:
- return &elf_mips16_jump_howto;
- case BFD_RELOC_MIPS16_GPREL:
- return &elf_mips16_gprel_howto;
- case BFD_RELOC_VTABLE_INHERIT:
- return &elf_mips_gnu_vtinherit_howto;
- case BFD_RELOC_VTABLE_ENTRY:
- return &elf_mips_gnu_vtentry_howto;
- case BFD_RELOC_PCREL_HI16_S:
- return &elf_mips_gnu_rel_hi16;
- case BFD_RELOC_PCREL_LO16:
- return &elf_mips_gnu_rel_lo16;
- case BFD_RELOC_16_PCREL_S2:
- return &elf_mips_gnu_rel16_s2;
- case BFD_RELOC_64_PCREL:
- return &elf_mips_gnu_pcrel64;
- case BFD_RELOC_32_PCREL:
- return &elf_mips_gnu_pcrel32;
- }
-}
-
-/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
-
-static reloc_howto_type *
-mips_elf32_rtype_to_howto (unsigned int r_type,
- bfd_boolean rela_p ATTRIBUTE_UNUSED)
-{
- switch (r_type)
- {
- case R_MIPS16_26:
- return &elf_mips16_jump_howto;
- case R_MIPS16_GPREL:
- return &elf_mips16_gprel_howto;
- case R_MIPS_GNU_VTINHERIT:
- return &elf_mips_gnu_vtinherit_howto;
- case R_MIPS_GNU_VTENTRY:
- return &elf_mips_gnu_vtentry_howto;
- case R_MIPS_GNU_REL_HI16:
- return &elf_mips_gnu_rel_hi16;
- case R_MIPS_GNU_REL_LO16:
- return &elf_mips_gnu_rel_lo16;
- case R_MIPS_GNU_REL16_S2:
- return &elf_mips_gnu_rel16_s2;
- case R_MIPS_PC64:
- return &elf_mips_gnu_pcrel64;
- case R_MIPS_PC32:
- return &elf_mips_gnu_pcrel32;
- default:
- BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
- return &elf_mips_howto_table_rel[r_type];
- }
-}
-
-/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
-
-static void
-mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
-{
- unsigned int r_type;
-
- r_type = ELF32_R_TYPE (dst->r_info);
- cache_ptr->howto = mips_elf32_rtype_to_howto (r_type, FALSE);
-
- /* The addend for a GPREL16 or LITERAL relocation comes from the GP
- value for the object file. We get the addend now, rather than
- when we do the relocation, because the symbol manipulations done
- by the linker may cause us to lose track of the input BFD. */
- if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
- && (r_type == (unsigned int) R_MIPS_GPREL16
- || r_type == (unsigned int) R_MIPS_LITERAL))
- cache_ptr->addend = elf_gp (abfd);
-}
-
-/* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
-
-static void
-mips_info_to_howto_rela (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
-{
- mips_info_to_howto_rel (abfd, cache_ptr, dst);
-
- /* If we ever need to do any extra processing with dst->r_addend
- (the field omitted in an Elf_Internal_Rel) we can do it here. */
-}
-
-/* Determine whether a symbol is global for the purposes of splitting
- the symbol table into global symbols and local symbols. At least
- on Irix 5, this split must be between section symbols and all other
- symbols. On most ELF targets the split is between static symbols
- and externally visible symbols. */
-
-static bfd_boolean
-mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
-{
- if (SGI_COMPAT (abfd))
- return (sym->flags & BSF_SECTION_SYM) == 0;
- else
- return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (sym))
- || bfd_is_com_section (bfd_get_section (sym)));
-}
-
-/* Set the right machine number for a MIPS ELF file. */
-
-static bfd_boolean
-mips_elf32_object_p (bfd *abfd)
-{
- unsigned long mach;
-
- /* Irix 5 and 6 are broken. Object file symbol tables are not always
- sorted correctly such that local symbols precede global symbols,
- and the sh_info field in the symbol table is not always right. */
- if (SGI_COMPAT (abfd))
- elf_bad_symtab (abfd) = TRUE;
-
- if (ABI_N32_P (abfd))
- return FALSE;
-
- mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
- bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
-
- return TRUE;
-}
-
-/* MIPS ELF local labels start with '$', not 'L'. */
-
-static bfd_boolean
-mips_elf_is_local_label_name (bfd *abfd, const char *name)
-{
- if (name[0] == '$')
- return TRUE;
-
- /* On Irix 6, the labels go back to starting with '.', so we accept
- the generic ELF local label syntax as well. */
- return _bfd_elf_is_local_label_name (abfd, name);
-}
-
-/* Support for core dump NOTE sections. */
-static bfd_boolean
-elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- int offset;
- unsigned int raw_size;
-
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 256: /* Linux/MIPS */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 72;
- raw_size = 180;
-
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static bfd_boolean
-elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 128: /* Linux/MIPS elf_prpsinfo */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-
-/* Depending on the target vector we generate some version of Irix
- executables or "normal" MIPS ELF ABI executables. */
-static irix_compat_t
-elf32_mips_irix_compat (bfd *abfd)
-{
- if ((abfd->xvec == &bfd_elf32_bigmips_vec)
- || (abfd->xvec == &bfd_elf32_littlemips_vec))
- return ict_irix5;
- else
- return ict_none;
-}
-
-/* Given a data section and an in-memory embedded reloc section, store
- relocation information into the embedded reloc section which can be
- used at runtime to relocate the data section. This is called by the
- linker when the --embedded-relocs switch is used. This is called
- after the add_symbols entry point has been called for all the
- objects, and before the final_link entry point is called. */
-
-bfd_boolean
-bfd_mips_elf32_create_embedded_relocs (bfd *abfd, struct bfd_link_info *info,
- asection *datasec, asection *relsec,
- char **errmsg)
-{
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Sym *isymbuf = NULL;
- Elf_Internal_Rela *internal_relocs = NULL;
- Elf_Internal_Rela *irel, *irelend;
- bfd_byte *p;
-
- BFD_ASSERT (! info->relocatable);
-
- *errmsg = NULL;
-
- if (datasec->reloc_count == 0)
- return TRUE;
-
- /* Read this BFD's symbols if we haven't done so already, or get the cached
- copy if it exists. */
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- if (symtab_hdr->sh_info != 0)
- {
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- goto error_return;
- }
-
- /* Get a copy of the native relocations. */
- internal_relocs = _bfd_elf_link_read_relocs (abfd, datasec, NULL, NULL,
- info->keep_memory);
- if (internal_relocs == NULL)
- goto error_return;
-
- relsec->contents = bfd_alloc (abfd, datasec->reloc_count * 12);
- if (relsec->contents == NULL)
- goto error_return;
-
- p = relsec->contents;
-
- irelend = internal_relocs + datasec->reloc_count;
-
- for (irel = internal_relocs; irel < irelend; irel++, p += 12)
- {
- asection *targetsec;
-
- /* We are going to write a four byte longword into the runtime
- reloc section. The longword will be the address in the data
- section which must be relocated. It is followed by the name
- of the target section NUL-padded or truncated to 8
- characters. */
-
- /* We can only relocate absolute longword relocs at run time. */
- if ((ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_32) &&
- (ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_64))
- {
- *errmsg = _("unsupported reloc type");
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- /* Get the target section referred to by the reloc. */
- if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
- {
- Elf_Internal_Sym *isym;
-
- /* A local symbol. */
- isym = isymbuf + ELF32_R_SYM (irel->r_info);
- targetsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
- }
- else
- {
- unsigned long indx;
- struct elf_link_hash_entry *h;
-
- /* An external symbol. */
- indx = ELF32_R_SYM (irel->r_info);
- h = elf_sym_hashes (abfd)[indx];
- targetsec = NULL;
- /*
- For some reason, in certain programs, the symbol will
- not be in the hash table. It seems to happen when you
- declare a static table of pointers to const external structures.
- In this case, the relocs are relative to data, not
- text, so just treating it like an undefined link
- should be sufficient. */
- BFD_ASSERT(h != NULL);
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- targetsec = h->root.u.def.section;
- }
-
-
- /*
- Set the low bit of the relocation offset if it's a MIPS64 reloc.
- Relocations will always be on (at least) 32-bit boundaries. */
-
- bfd_put_32 (abfd, ((irel->r_offset + datasec->output_offset) +
- ((ELF32_R_TYPE (irel->r_info) == (int) R_MIPS_64) ? 1 : 0)),
- p);
- memset (p + 4, 0, 8);
- if (targetsec != NULL)
- strncpy (p + 4, targetsec->output_section->name, 8);
- }
-
- if (internal_relocs != NULL
- && elf_section_data (datasec)->relocs != internal_relocs)
- free (internal_relocs);
- if (isymbuf != NULL
- && symtab_hdr->contents != (unsigned char *) isymbuf)
- free (isymbuf);
- return TRUE;
-
- error_return:
- if (internal_relocs != NULL
- && elf_section_data (datasec)->relocs != internal_relocs)
- free (internal_relocs);
- if (isymbuf != NULL
- && symtab_hdr->contents != (unsigned char *) isymbuf)
- free (isymbuf);
- return FALSE;
-}
-
-/* ECOFF swapping routines. These are used when dealing with the
- .mdebug section, which is in the ECOFF debugging format. */
-static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
- /* Symbol table magic number. */
- magicSym,
- /* Alignment of debugging information. E.g., 4. */
- 4,
- /* Sizes of external symbolic information. */
- sizeof (struct hdr_ext),
- sizeof (struct dnr_ext),
- sizeof (struct pdr_ext),
- sizeof (struct sym_ext),
- sizeof (struct opt_ext),
- sizeof (struct fdr_ext),
- sizeof (struct rfd_ext),
- sizeof (struct ext_ext),
- /* Functions to swap in external symbolic data. */
- ecoff_swap_hdr_in,
- ecoff_swap_dnr_in,
- ecoff_swap_pdr_in,
- ecoff_swap_sym_in,
- ecoff_swap_opt_in,
- ecoff_swap_fdr_in,
- ecoff_swap_rfd_in,
- ecoff_swap_ext_in,
- _bfd_ecoff_swap_tir_in,
- _bfd_ecoff_swap_rndx_in,
- /* Functions to swap out external symbolic data. */
- ecoff_swap_hdr_out,
- ecoff_swap_dnr_out,
- ecoff_swap_pdr_out,
- ecoff_swap_sym_out,
- ecoff_swap_opt_out,
- ecoff_swap_fdr_out,
- ecoff_swap_rfd_out,
- ecoff_swap_ext_out,
- _bfd_ecoff_swap_tir_out,
- _bfd_ecoff_swap_rndx_out,
- /* Function to read in symbolic data. */
- _bfd_mips_elf_read_ecoff_info
-};
-
-#define ELF_ARCH bfd_arch_mips
-#define ELF_MACHINE_CODE EM_MIPS
-
-#define elf_backend_collect TRUE
-#define elf_backend_type_change_ok TRUE
-#define elf_backend_can_gc_sections TRUE
-#define elf_info_to_howto mips_info_to_howto_rela
-#define elf_info_to_howto_rel mips_info_to_howto_rel
-#define elf_backend_sym_is_global mips_elf_sym_is_global
-#define elf_backend_object_p mips_elf32_object_p
-#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
-#define elf_backend_section_processing _bfd_mips_elf_section_processing
-#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
-#define elf_backend_fake_sections _bfd_mips_elf_fake_sections
-#define elf_backend_section_from_bfd_section \
- _bfd_mips_elf_section_from_bfd_section
-#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
-#define elf_backend_link_output_symbol_hook \
- _bfd_mips_elf_link_output_symbol_hook
-#define elf_backend_create_dynamic_sections \
- _bfd_mips_elf_create_dynamic_sections
-#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
- _bfd_mips_elf_adjust_dynamic_symbol
-#define elf_backend_always_size_sections \
- _bfd_mips_elf_always_size_sections
-#define elf_backend_size_dynamic_sections \
- _bfd_mips_elf_size_dynamic_sections
-#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- _bfd_mips_elf_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- _bfd_mips_elf_finish_dynamic_sections
-#define elf_backend_final_write_processing \
- _bfd_mips_elf_final_write_processing
-#define elf_backend_additional_program_headers \
- _bfd_mips_elf_additional_program_headers
-#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
-#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
-#define elf_backend_copy_indirect_symbol \
- _bfd_mips_elf_copy_indirect_symbol
-#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
-#define elf_backend_grok_prstatus elf32_mips_grok_prstatus
-#define elf_backend_grok_psinfo elf32_mips_grok_psinfo
-#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
-
-#define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
-#define elf_backend_may_use_rel_p 1
-#define elf_backend_may_use_rela_p 0
-#define elf_backend_default_use_rela_p 0
-#define elf_backend_sign_extend_vma TRUE
-
-#define elf_backend_discard_info _bfd_mips_elf_discard_info
-#define elf_backend_ignore_discarded_relocs \
- _bfd_mips_elf_ignore_discarded_relocs
-#define elf_backend_mips_irix_compat elf32_mips_irix_compat
-#define elf_backend_mips_rtype_to_howto mips_elf32_rtype_to_howto
-#define bfd_elf32_bfd_is_local_label_name \
- mips_elf_is_local_label_name
-#define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
-#define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
-#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
-#define bfd_elf32_bfd_get_relocated_section_contents \
- _bfd_elf_mips_get_relocated_section_contents
-#define bfd_elf32_bfd_link_hash_table_create \
- _bfd_mips_elf_link_hash_table_create
-#define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link
-#define bfd_elf32_bfd_merge_private_bfd_data \
- _bfd_mips_elf_merge_private_bfd_data
-#define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags
-#define bfd_elf32_bfd_print_private_bfd_data \
- _bfd_mips_elf_print_private_bfd_data
-
-/* Support for SGI-ish mips targets. */
-#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec
-#define TARGET_LITTLE_NAME "elf32-littlemips"
-#define TARGET_BIG_SYM bfd_elf32_bigmips_vec
-#define TARGET_BIG_NAME "elf32-bigmips"
-
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible. */
-#define ELF_MAXPAGESIZE 0x1000
-
-#include "elf32-target.h"
-
-/* Support for traditional mips targets. */
-#undef TARGET_LITTLE_SYM
-#undef TARGET_LITTLE_NAME
-#undef TARGET_BIG_SYM
-#undef TARGET_BIG_NAME
-
-#undef ELF_MAXPAGESIZE
-
-#define TARGET_LITTLE_SYM bfd_elf32_tradlittlemips_vec
-#define TARGET_LITTLE_NAME "elf32-tradlittlemips"
-#define TARGET_BIG_SYM bfd_elf32_tradbigmips_vec
-#define TARGET_BIG_NAME "elf32-tradbigmips"
-
-/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
-#define ELF_MAXPAGESIZE 0x10000
-#define elf32_bed elf32_tradbed
-
-/* Include the target file again for this target. */
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-ppc.c b/contrib/binutils/bfd/elf32-ppc.c
deleted file mode 100644
index 4eb08ad..0000000
--- a/contrib/binutils/bfd/elf32-ppc.c
+++ /dev/null
@@ -1,6209 +0,0 @@
-/* PowerPC-specific support for 32-bit ELF
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004 Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* This file is based on a preliminary PowerPC ELF ABI. The
- information may not match the final PowerPC ELF ABI. It includes
- suggestions from the in-progress Embedded PowerPC ABI, and that
- information may also not match. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/ppc.h"
-#include "elf32-ppc.h"
-
-/* RELA relocations are used here. */
-
-static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc_elf_unhandled_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-
-/* Branch prediction bit for branch taken relocs. */
-#define BRANCH_PREDICT_BIT 0x200000
-/* Mask to set RA in memory instructions. */
-#define RA_REGISTER_MASK 0x001f0000
-/* Value to shift register by to insert RA. */
-#define RA_REGISTER_SHIFT 16
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-
-/* The size in bytes of an entry in the procedure linkage table. */
-#define PLT_ENTRY_SIZE 12
-/* The initial size of the plt reserved for the dynamic linker. */
-#define PLT_INITIAL_ENTRY_SIZE 72
-/* The size of the gap between entries in the PLT. */
-#define PLT_SLOT_SIZE 8
-/* The number of single-slot PLT entries (the rest use two slots). */
-#define PLT_NUM_SINGLE_ENTRIES 8192
-
-/* Some nop instructions. */
-#define NOP 0x60000000
-#define CROR_151515 0x4def7b82
-#define CROR_313131 0x4ffffb82
-
-/* Offset of tp and dtp pointers from start of TLS block. */
-#define TP_OFFSET 0x7000
-#define DTP_OFFSET 0x8000
-
-
-/* Enumeration to specify the special section. */
-enum elf_linker_section_enum
-{
- LINKER_SECTION_SDATA,
- LINKER_SECTION_SDATA2
-};
-
-/* Sections created by the linker. */
-
-typedef struct elf_linker_section
-{
- /* pointer to the section */
- asection *section;
- /* pointer to the relocations needed for this section */
- asection *rel_section;
- /* pointer to the created symbol hash value */
- struct elf_link_hash_entry *sym_hash;
- /* offset of symbol from beginning of section */
- bfd_vma sym_offset;
-} elf_linker_section_t;
-
-/* Linked list of allocated pointer entries. This hangs off of the
- symbol lists, and provides allows us to return different pointers,
- based on different addend's. */
-
-typedef struct elf_linker_section_pointers
-{
- /* next allocated pointer for this symbol */
- struct elf_linker_section_pointers *next;
- /* offset of pointer from beginning of section */
- bfd_vma offset;
- /* addend used */
- bfd_vma addend;
- /* which linker section this is */
- elf_linker_section_t *lsect;
- /* whether address was written yet */
- bfd_boolean written_address_p;
-} elf_linker_section_pointers_t;
-
-struct ppc_elf_obj_tdata
-{
- struct elf_obj_tdata elf;
-
- /* A mapping from local symbols to offsets into the various linker
- sections added. This is index by the symbol index. */
- elf_linker_section_pointers_t **linker_section_pointers;
-};
-
-#define ppc_elf_tdata(bfd) \
- ((struct ppc_elf_obj_tdata *) (bfd)->tdata.any)
-
-#define elf_local_ptr_offsets(bfd) \
- (ppc_elf_tdata (bfd)->linker_section_pointers)
-
-/* Override the generic function because we store some extras. */
-
-static bfd_boolean
-ppc_elf_mkobject (bfd *abfd)
-{
- bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
-}
-
-/* The PPC linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct ppc_elf_dyn_relocs
-{
- struct ppc_elf_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
-
-/* PPC ELF linker hash entry. */
-
-struct ppc_elf_link_hash_entry
-{
- struct elf_link_hash_entry elf;
-
- /* If this symbol is used in the linker created sections, the processor
- specific backend uses this field to map the field into the offset
- from the beginning of the section. */
- elf_linker_section_pointers_t *linker_section_pointer;
-
- /* Track dynamic relocs copied for this symbol. */
- struct ppc_elf_dyn_relocs *dyn_relocs;
-
- /* Contexts in which symbol is used in the GOT (or TOC).
- TLS_GD .. TLS_TLS bits are or'd into the mask as the
- corresponding relocs are encountered during check_relocs.
- tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to
- indicate the corresponding GOT entry type is not needed. */
-#define TLS_GD 1 /* GD reloc. */
-#define TLS_LD 2 /* LD reloc. */
-#define TLS_TPREL 4 /* TPREL reloc, => IE. */
-#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */
-#define TLS_TLS 16 /* Any TLS reloc. */
-#define TLS_TPRELGD 32 /* TPREL reloc resulting from GD->IE. */
- char tls_mask;
-};
-
-#define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent))
-
-/* PPC ELF linker hash table. */
-
-struct ppc_elf_link_hash_table
-{
- struct elf_link_hash_table elf;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *got;
- asection *relgot;
- asection *plt;
- asection *relplt;
- asection *dynbss;
- asection *relbss;
- asection *dynsbss;
- asection *relsbss;
- elf_linker_section_t *sdata;
- elf_linker_section_t *sdata2;
- asection *sbss;
-
- /* Shortcut to .__tls_get_addr. */
- struct elf_link_hash_entry *tls_get_addr;
-
- /* TLS local dynamic got entry handling. */
- union {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } tlsld_got;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-};
-
-/* Get the PPC ELF linker hash table from a link_info structure. */
-
-#define ppc_elf_hash_table(p) \
- ((struct ppc_elf_link_hash_table *) (p)->hash)
-
-/* Create an entry in a PPC ELF linker hash table. */
-
-static struct bfd_hash_entry *
-ppc_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table,
- sizeof (struct ppc_elf_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- ppc_elf_hash_entry (entry)->linker_section_pointer = NULL;
- ppc_elf_hash_entry (entry)->dyn_relocs = NULL;
- ppc_elf_hash_entry (entry)->tls_mask = 0;
- }
-
- return entry;
-}
-
-/* Create a PPC ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-ppc_elf_link_hash_table_create (bfd *abfd)
-{
- struct ppc_elf_link_hash_table *ret;
-
- ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table));
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd,
- ppc_elf_link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- return &ret->elf.root;
-}
-
-/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
- copying dynamic variables from a shared lib into an app's dynbss
- section, and instead use a dynamic relocation to point into the
- shared lib. */
-#define ELIMINATE_COPY_RELOCS 1
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-ppc_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
- struct elf_link_hash_entry *dir,
- struct elf_link_hash_entry *ind)
-{
- struct ppc_elf_link_hash_entry *edir, *eind;
-
- edir = (struct ppc_elf_link_hash_entry *) dir;
- eind = (struct ppc_elf_link_hash_entry *) ind;
-
- if (eind->dyn_relocs != NULL)
- {
- if (edir->dyn_relocs != NULL)
- {
- struct ppc_elf_dyn_relocs **pp;
- struct ppc_elf_dyn_relocs *p;
-
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
- {
- struct ppc_elf_dyn_relocs *q;
-
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
- if (q->sec == p->sec)
- {
- q->pc_count += p->pc_count;
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->dyn_relocs;
- }
-
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
-
- edir->tls_mask |= eind->tls_mask;
-
- if (ELIMINATE_COPY_RELOCS
- && ind->root.type != bfd_link_hash_indirect
- && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- dir->elf_link_hash_flags |=
- (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_HASH_NEEDS_PLT));
- else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-}
-
-static reloc_howto_type *ppc_elf_howto_table[R_PPC_max];
-
-static reloc_howto_type ppc_elf_howto_raw[] = {
- /* This reloc does nothing. */
- HOWTO (R_PPC_NONE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 32 bit relocation. */
- HOWTO (R_PPC_ADDR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 26 bit branch; the lower two bits must be zero.
- FIXME: we don't check that, we just clear them. */
- HOWTO (R_PPC_ADDR24, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR24", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 16 bit relocation. */
- HOWTO (R_PPC_ADDR16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit relocation without overflow. */
- HOWTO (R_PPC_ADDR16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high order 16 bits of an address. */
- HOWTO (R_PPC_ADDR16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high order 16 bits of an address, plus 1 if the contents of
- the low 16 bits, treated as a signed number, is negative. */
- HOWTO (R_PPC_ADDR16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_addr16_ha_reloc, /* special_function */
- "R_PPC_ADDR16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 16 bit branch; the lower two bits must be zero.
- FIXME: we don't check that, we just clear them. */
- HOWTO (R_PPC_ADDR14, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR14", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 16 bit branch, for which bit 10 should be set to
- indicate that the branch is expected to be taken. The lower two
- bits must be zero. */
- HOWTO (R_PPC_ADDR14_BRTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR14_BRTAKEN",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 16 bit branch, for which bit 10 should be set to
- indicate that the branch is not expected to be taken. The lower
- two bits must be zero. */
- HOWTO (R_PPC_ADDR14_BRNTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_ADDR14_BRNTAKEN",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A relative 26 bit branch; the lower two bits must be zero. */
- HOWTO (R_PPC_REL24, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_REL24", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A relative 16 bit branch; the lower two bits must be zero. */
- HOWTO (R_PPC_REL14, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_REL14", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A relative 16 bit branch. Bit 10 should be set to indicate that
- the branch is expected to be taken. The lower two bits must be
- zero. */
- HOWTO (R_PPC_REL14_BRTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_REL14_BRTAKEN", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A relative 16 bit branch. Bit 10 should be set to indicate that
- the branch is not expected to be taken. The lower two bits must
- be zero. */
- HOWTO (R_PPC_REL14_BRNTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_REL14_BRNTAKEN",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16, but referring to the GOT table entry for the
- symbol. */
- HOWTO (R_PPC_GOT16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_GOT16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16_LO, but referring to the GOT table entry for
- the symbol. */
- HOWTO (R_PPC_GOT16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_GOT16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16_HI, but referring to the GOT table entry for
- the symbol. */
- HOWTO (R_PPC_GOT16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_GOT16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16_HA, but referring to the GOT table entry for
- the symbol. */
- HOWTO (R_PPC_GOT16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_addr16_ha_reloc, /* special_function */
- "R_PPC_GOT16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_REL24, but referring to the procedure linkage table
- entry for the symbol. */
- HOWTO (R_PPC_PLTREL24, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_PLTREL24", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* This is used only by the dynamic linker. The symbol should exist
- both in the object being run and in some shared library. The
- dynamic linker copies the data addressed by the symbol from the
- shared library into the object, because the object being
- run has to have the data at some particular address. */
- HOWTO (R_PPC_COPY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_COPY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR32, but used when setting global offset table
- entries. */
- HOWTO (R_PPC_GLOB_DAT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_GLOB_DAT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Marks a procedure linkage table entry for a symbol. */
- HOWTO (R_PPC_JMP_SLOT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_JMP_SLOT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used only by the dynamic linker. When the object is run, this
- longword is set to the load address of the object, plus the
- addend. */
- HOWTO (R_PPC_RELATIVE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_RELATIVE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_REL24, but uses the value of the symbol within the
- object rather than the final value. Normally used for
- _GLOBAL_OFFSET_TABLE_. */
- HOWTO (R_PPC_LOCAL24PC, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_LOCAL24PC", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR32, but may be unaligned. */
- HOWTO (R_PPC_UADDR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_UADDR32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16, but may be unaligned. */
- HOWTO (R_PPC_UADDR16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_UADDR16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32-bit PC relative */
- HOWTO (R_PPC_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_REL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 32-bit relocation to the symbol's procedure linkage table.
- FIXME: not supported. */
- HOWTO (R_PPC_PLT32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_PLT32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32-bit PC relative relocation to the symbol's procedure linkage table.
- FIXME: not supported. */
- HOWTO (R_PPC_PLTREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_PLTREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16_LO, but referring to the PLT table entry for
- the symbol. */
- HOWTO (R_PPC_PLT16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_PLT16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16_HI, but referring to the PLT table entry for
- the symbol. */
- HOWTO (R_PPC_PLT16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_PLT16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC_ADDR16_HA, but referring to the PLT table entry for
- the symbol. */
- HOWTO (R_PPC_PLT16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_addr16_ha_reloc, /* special_function */
- "R_PPC_PLT16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A sign-extended 16 bit value relative to _SDA_BASE_, for use with
- small data items. */
- HOWTO (R_PPC_SDAREL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_SDAREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16-bit section relative relocation. */
- HOWTO (R_PPC_SECTOFF, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_SECTOFF", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16-bit lower half section relative relocation. */
- HOWTO (R_PPC_SECTOFF_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_SECTOFF_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16-bit upper half section relative relocation. */
- HOWTO (R_PPC_SECTOFF_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_SECTOFF_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16-bit upper half adjusted section relative relocation. */
- HOWTO (R_PPC_SECTOFF_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_addr16_ha_reloc, /* special_function */
- "R_PPC_SECTOFF_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Marker reloc for TLS. */
- HOWTO (R_PPC_TLS,
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_TLS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Computes the load module index of the load module that contains the
- definition of its TLS sym. */
- HOWTO (R_PPC_DTPMOD32,
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_DTPMOD32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Computes a dtv-relative displacement, the difference between the value
- of sym+add and the base address of the thread-local storage block that
- contains the definition of sym, minus 0x8000. */
- HOWTO (R_PPC_DTPREL32,
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_DTPREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit dtprel reloc. */
- HOWTO (R_PPC_DTPREL16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_DTPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16, but no overflow. */
- HOWTO (R_PPC_DTPREL16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_DTPREL16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC_DTPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_DTPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC_DTPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_DTPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Computes a tp-relative displacement, the difference between the value of
- sym+add and the value of the thread pointer (r13). */
- HOWTO (R_PPC_TPREL32,
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_TPREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit tprel reloc. */
- HOWTO (R_PPC_TPREL16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_TPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16, but no overflow. */
- HOWTO (R_PPC_TPREL16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_TPREL16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC_TPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_TPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC_TPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_TPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
- with values (sym+add)@dtpmod and (sym+add)@dtprel, and computes the offset
- to the first entry. */
- HOWTO (R_PPC_GOT_TLSGD16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSGD16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSGD16, but no overflow. */
- HOWTO (R_PPC_GOT_TLSGD16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSGD16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSGD16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC_GOT_TLSGD16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSGD16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSGD16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC_GOT_TLSGD16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSGD16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
- with values (sym+add)@dtpmod and zero, and computes the offset to the
- first entry. */
- HOWTO (R_PPC_GOT_TLSLD16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSLD16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSLD16, but no overflow. */
- HOWTO (R_PPC_GOT_TLSLD16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSLD16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSLD16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC_GOT_TLSLD16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSLD16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSLD16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC_GOT_TLSLD16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TLSLD16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates an entry in the GOT with value (sym+add)@dtprel, and computes
- the offset to the entry. */
- HOWTO (R_PPC_GOT_DTPREL16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_DTPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_DTPREL16, but no overflow. */
- HOWTO (R_PPC_GOT_DTPREL16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_DTPREL16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_DTPREL16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC_GOT_DTPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_DTPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_DTPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC_GOT_DTPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_DTPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates an entry in the GOT with value (sym+add)@tprel, and computes the
- offset to the entry. */
- HOWTO (R_PPC_GOT_TPREL16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TPREL16, but no overflow. */
- HOWTO (R_PPC_GOT_TPREL16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TPREL16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TPREL16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC_GOT_TPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC_GOT_TPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unhandled_reloc, /* special_function */
- "R_PPC_GOT_TPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The remaining relocs are from the Embedded ELF ABI, and are not
- in the SVR4 ELF ABI. */
-
- /* 32 bit value resulting from the addend minus the symbol. */
- HOWTO (R_PPC_EMB_NADDR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_NADDR32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit value resulting from the addend minus the symbol. */
- HOWTO (R_PPC_EMB_NADDR16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_NADDR16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit value resulting from the addend minus the symbol. */
- HOWTO (R_PPC_EMB_NADDR16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_ADDR16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high order 16 bits of the addend minus the symbol. */
- HOWTO (R_PPC_EMB_NADDR16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_NADDR16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high order 16 bits of the result of the addend minus the address,
- plus 1 if the contents of the low 16 bits, treated as a signed number,
- is negative. */
- HOWTO (R_PPC_EMB_NADDR16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_addr16_ha_reloc, /* special_function */
- "R_PPC_EMB_NADDR16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit value resulting from allocating a 4 byte word to hold an
- address in the .sdata section, and returning the offset from
- _SDA_BASE_ for that relocation. */
- HOWTO (R_PPC_EMB_SDAI16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_SDAI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit value resulting from allocating a 4 byte word to hold an
- address in the .sdata2 section, and returning the offset from
- _SDA2_BASE_ for that relocation. */
- HOWTO (R_PPC_EMB_SDA2I16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_SDA2I16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A sign-extended 16 bit value relative to _SDA2_BASE_, for use with
- small data items. */
- HOWTO (R_PPC_EMB_SDA2REL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_SDA2REL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Relocate against either _SDA_BASE_ or _SDA2_BASE_, filling in the 16 bit
- signed offset from the appropriate base, and filling in the register
- field with the appropriate register (0, 2, or 13). */
- HOWTO (R_PPC_EMB_SDA21, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_SDA21", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Relocation not handled: R_PPC_EMB_MRKREF */
- /* Relocation not handled: R_PPC_EMB_RELSEC16 */
- /* Relocation not handled: R_PPC_EMB_RELST_LO */
- /* Relocation not handled: R_PPC_EMB_RELST_HI */
- /* Relocation not handled: R_PPC_EMB_RELST_HA */
- /* Relocation not handled: R_PPC_EMB_BIT_FLD */
-
- /* PC relative relocation against either _SDA_BASE_ or _SDA2_BASE_, filling
- in the 16 bit signed offset from the appropriate base, and filling in the
- register field with the appropriate register (0, 2, or 13). */
- HOWTO (R_PPC_EMB_RELSDA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_EMB_RELSDA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Phony relocs to handle branch stubs. */
- HOWTO (R_PPC_RELAX32, /* type */
- 0, /* rightshift */
- 0, /* size */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_RELAX32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_PPC_RELAX32PC, /* type */
- 0, /* rightshift */
- 0, /* size */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_RELAX32PC", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable hierarchy. */
- HOWTO (R_PPC_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_PPC_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable member usage. */
- HOWTO (R_PPC_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_PPC_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Phony reloc to handle AIX style TOC entries. */
- HOWTO (R_PPC_TOC16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC_TOC16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* Initialize the ppc_elf_howto_table, so that linear accesses can be done. */
-
-static void
-ppc_elf_howto_init (void)
-{
- unsigned int i, type;
-
- for (i = 0;
- i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]);
- i++)
- {
- type = ppc_elf_howto_raw[i].type;
- if (type >= (sizeof (ppc_elf_howto_table)
- / sizeof (ppc_elf_howto_table[0])))
- abort ();
- ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i];
- }
-}
-
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
-static const int shared_stub_entry[] =
- {
- 0x7c0802a6, /* mflr 0 */
- 0x429f0005, /* bcl 20, 31, .Lxxx */
- 0x7d6802a6, /* mflr 11 */
- 0x3d6b0000, /* addis 11, 11, (xxx-.Lxxx)@ha */
- 0x396b0018, /* addi 11, 11, (xxx-.Lxxx)@l */
- 0x7c0803a6, /* mtlr 0 */
- 0x7d6903a6, /* mtctr 11 */
- 0x4e800420, /* bctr */
- };
-
-static const int stub_entry[] =
- {
- 0x3d600000, /* lis 11,xxx@ha */
- 0x396b0000, /* addi 11,11,xxx@l */
- 0x7d6903a6, /* mtctr 11 */
- 0x4e800420, /* bctr */
- };
-
-
-static bfd_boolean
-ppc_elf_relax_section (bfd *abfd,
- asection *isec,
- struct bfd_link_info *link_info,
- bfd_boolean *again)
-{
- struct one_fixup
- {
- struct one_fixup *next;
- asection *tsec;
- bfd_vma toff;
- bfd_vma trampoff;
- };
-
- Elf_Internal_Shdr *symtab_hdr;
- bfd_byte *contents = NULL;
- Elf_Internal_Sym *isymbuf = NULL;
- Elf_Internal_Rela *internal_relocs = NULL;
- Elf_Internal_Rela *irel, *irelend;
- struct one_fixup *fixups = NULL;
- bfd_boolean changed;
- struct ppc_elf_link_hash_table *ppc_info;
- bfd_size_type trampoff;
-
- *again = FALSE;
-
- /* Nothing to do if there are no relocations. */
- if ((isec->flags & SEC_RELOC) == 0 || isec->reloc_count == 0)
- return TRUE;
-
- /* If needed, initialize this section's cooked size. */
- if (isec->_cooked_size == 0)
- isec->_cooked_size = isec->_raw_size;
-
- trampoff = (isec->_cooked_size + 3) & (bfd_vma) -4;
- /* Space for a branch around any trampolines. */
- trampoff += 4;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-
- /* Get a copy of the native relocations. */
- internal_relocs = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL,
- link_info->keep_memory);
- if (internal_relocs == NULL)
- goto error_return;
-
- ppc_info = ppc_elf_hash_table (link_info);
- irelend = internal_relocs + isec->reloc_count;
-
- /* Get the section contents. */
- /* Get cached copy if it exists. */
- if (elf_section_data (isec)->this_hdr.contents != NULL)
- contents = elf_section_data (isec)->this_hdr.contents;
- else
- {
- /* Go get them off disk. */
- contents = bfd_malloc (isec->_raw_size);
- if (contents == NULL)
- goto error_return;
-
- if (!bfd_get_section_contents (abfd, isec, contents, 0, isec->_raw_size))
- goto error_return;
- }
-
- for (irel = internal_relocs; irel < irelend; irel++)
- {
- unsigned long r_type = ELF32_R_TYPE (irel->r_info);
- bfd_vma symaddr, reladdr, toff, roff;
- asection *tsec;
- struct one_fixup *f;
- size_t insn_offset = 0;
- bfd_vma max_branch_offset, val;
- bfd_byte *hit_addr;
- unsigned long t0;
-
- switch (r_type)
- {
- case R_PPC_REL24:
- case R_PPC_LOCAL24PC:
- case R_PPC_PLTREL24:
- max_branch_offset = 1 << 25;
- break;
-
- case R_PPC_REL14:
- case R_PPC_REL14_BRTAKEN:
- case R_PPC_REL14_BRNTAKEN:
- max_branch_offset = 1 << 15;
- break;
-
- default:
- continue;
- }
-
- /* Get the value of the symbol referred to by the reloc. */
- if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
- {
- /* A local symbol. */
- Elf_Internal_Sym *isym;
-
- /* Read this BFD's local symbols. */
- if (isymbuf == NULL)
- {
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == 0)
- goto error_return;
- }
- isym = isymbuf + ELF32_R_SYM (irel->r_info);
- if (isym->st_shndx == SHN_UNDEF)
- continue; /* We can't do anything with undefined symbols. */
- else if (isym->st_shndx == SHN_ABS)
- tsec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- tsec = bfd_com_section_ptr;
- else
- tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
-
- toff = isym->st_value;
- }
- else
- {
- /* Global symbol handling. */
- unsigned long indx;
- struct elf_link_hash_entry *h;
-
- indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
- h = elf_sym_hashes (abfd)[indx];
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (r_type == R_PPC_PLTREL24
- && ppc_info->plt != NULL
- && h->plt.offset != (bfd_vma) -1)
- {
- tsec = ppc_info->plt;
- toff = h->plt.offset;
- }
- else if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- tsec = h->root.u.def.section;
- toff = h->root.u.def.value;
- }
- else
- continue;
- }
-
- /* If the branch and target are in the same section, you have
- no hope of adding stubs. We'll error out later should the
- branch overflow. */
- if (tsec == isec)
- continue;
-
- toff += irel->r_addend;
- if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE)
- toff = _bfd_merged_section_offset (abfd, &tsec,
- elf_section_data (tsec)->sec_info,
- toff, 0);
-
- symaddr = tsec->output_section->vma + tsec->output_offset + toff;
-
- roff = irel->r_offset;
- reladdr = isec->output_section->vma + isec->output_offset + roff;
-
- /* If the branch is in range, no need to do anything. */
- if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset)
- continue;
-
- /* Look for an existing fixup to this address. */
- for (f = fixups; f ; f = f->next)
- if (f->tsec == tsec && f->toff == toff)
- break;
-
- if (f == NULL)
- {
- size_t size;
- unsigned long stub_rtype;
-
- val = trampoff - roff;
- if (val >= max_branch_offset)
- /* Oh dear, we can't reach a trampoline. Don't try to add
- one. We'll report an error later. */
- continue;
-
- if (link_info->shared)
- {
- size = 4 * ARRAY_SIZE (shared_stub_entry);
- insn_offset = 12;
- stub_rtype = R_PPC_RELAX32PC;
- }
- else
- {
- size = 4 * ARRAY_SIZE (stub_entry);
- insn_offset = 0;
- stub_rtype = R_PPC_RELAX32;
- }
-
- /* Hijack the old relocation. Since we need two
- relocations for this use a "composite" reloc. */
- irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
- stub_rtype);
- irel->r_offset = trampoff + insn_offset;
-
- /* Record the fixup so we don't do it again this section. */
- f = bfd_malloc (sizeof (*f));
- f->next = fixups;
- f->tsec = tsec;
- f->toff = toff;
- f->trampoff = trampoff;
- fixups = f;
-
- trampoff += size;
- }
- else
- {
- val = f->trampoff - roff;
- if (val >= max_branch_offset)
- continue;
-
- /* Nop out the reloc, since we're finalizing things here. */
- irel->r_info = ELF32_R_INFO (0, R_PPC_NONE);
- }
-
- /* Fix up the existing branch to hit the trampoline. */
- hit_addr = contents + roff;
- switch (r_type)
- {
- case R_PPC_REL24:
- case R_PPC_LOCAL24PC:
- case R_PPC_PLTREL24:
- t0 = bfd_get_32 (abfd, hit_addr);
- t0 &= ~0x3fffffc;
- t0 |= val & 0x3fffffc;
- bfd_put_32 (abfd, t0, hit_addr);
- break;
-
- case R_PPC_REL14:
- case R_PPC_REL14_BRTAKEN:
- case R_PPC_REL14_BRNTAKEN:
- t0 = bfd_get_32 (abfd, hit_addr);
- t0 &= ~0xfffc;
- t0 |= val & 0xfffc;
- bfd_put_32 (abfd, t0, hit_addr);
- break;
- }
- }
-
- /* Write out the trampolines. */
- changed = fixups != NULL;
- if (fixups != NULL)
- {
- const int *stub;
- bfd_byte *dest;
- bfd_vma val;
- int i, size;
-
- do
- {
- struct one_fixup *f = fixups;
- fixups = fixups->next;
- free (f);
- }
- while (fixups);
-
- contents = bfd_realloc (contents, trampoff);
- if (contents == NULL)
- goto error_return;
-
- isec->_cooked_size = (isec->_cooked_size + 3) & (bfd_vma) -4;
- /* Branch around the trampolines. */
- val = trampoff - isec->_cooked_size + 0x48000000;
- dest = contents + isec->_cooked_size;
- isec->_cooked_size = trampoff;
- bfd_put_32 (abfd, val, dest);
- dest += 4;
-
- if (link_info->shared)
- {
- stub = shared_stub_entry;
- size = ARRAY_SIZE (shared_stub_entry);
- }
- else
- {
- stub = stub_entry;
- size = ARRAY_SIZE (stub_entry);
- }
-
- i = 0;
- while (dest < contents + trampoff)
- {
- bfd_put_32 (abfd, stub[i], dest);
- i++;
- if (i == size)
- i = 0;
- dest += 4;
- }
- BFD_ASSERT (i == 0);
- }
-
- if (isymbuf != NULL
- && symtab_hdr->contents != (unsigned char *) isymbuf)
- {
- if (! link_info->keep_memory)
- free (isymbuf);
- else
- {
- /* Cache the symbols for elf_link_input_bfd. */
- symtab_hdr->contents = (unsigned char *) isymbuf;
- }
- }
-
- if (contents != NULL
- && elf_section_data (isec)->this_hdr.contents != contents)
- {
- if (!changed && !link_info->keep_memory)
- free (contents);
- else
- {
- /* Cache the section contents for elf_link_input_bfd. */
- elf_section_data (isec)->this_hdr.contents = contents;
- }
- }
-
- if (elf_section_data (isec)->relocs != internal_relocs)
- {
- if (!changed)
- free (internal_relocs);
- else
- elf_section_data (isec)->relocs = internal_relocs;
- }
-
- *again = changed;
- return TRUE;
-
- error_return:
- if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
- free (isymbuf);
- if (contents != NULL
- && elf_section_data (isec)->this_hdr.contents != contents)
- free (contents);
- if (internal_relocs != NULL
- && elf_section_data (isec)->relocs != internal_relocs)
- free (internal_relocs);
- return FALSE;
-}
-
-static reloc_howto_type *
-ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
-{
- enum elf_ppc_reloc_type r;
-
- /* Initialize howto table if not already done. */
- if (!ppc_elf_howto_table[R_PPC_ADDR32])
- ppc_elf_howto_init ();
-
- switch (code)
- {
- default:
- return NULL;
-
- case BFD_RELOC_NONE: r = R_PPC_NONE; break;
- case BFD_RELOC_32: r = R_PPC_ADDR32; break;
- case BFD_RELOC_PPC_BA26: r = R_PPC_ADDR24; break;
- case BFD_RELOC_16: r = R_PPC_ADDR16; break;
- case BFD_RELOC_LO16: r = R_PPC_ADDR16_LO; break;
- case BFD_RELOC_HI16: r = R_PPC_ADDR16_HI; break;
- case BFD_RELOC_HI16_S: r = R_PPC_ADDR16_HA; break;
- case BFD_RELOC_PPC_BA16: r = R_PPC_ADDR14; break;
- case BFD_RELOC_PPC_BA16_BRTAKEN: r = R_PPC_ADDR14_BRTAKEN; break;
- case BFD_RELOC_PPC_BA16_BRNTAKEN: r = R_PPC_ADDR14_BRNTAKEN; break;
- case BFD_RELOC_PPC_B26: r = R_PPC_REL24; break;
- case BFD_RELOC_PPC_B16: r = R_PPC_REL14; break;
- case BFD_RELOC_PPC_B16_BRTAKEN: r = R_PPC_REL14_BRTAKEN; break;
- case BFD_RELOC_PPC_B16_BRNTAKEN: r = R_PPC_REL14_BRNTAKEN; break;
- case BFD_RELOC_16_GOTOFF: r = R_PPC_GOT16; break;
- case BFD_RELOC_LO16_GOTOFF: r = R_PPC_GOT16_LO; break;
- case BFD_RELOC_HI16_GOTOFF: r = R_PPC_GOT16_HI; break;
- case BFD_RELOC_HI16_S_GOTOFF: r = R_PPC_GOT16_HA; break;
- case BFD_RELOC_24_PLT_PCREL: r = R_PPC_PLTREL24; break;
- case BFD_RELOC_PPC_COPY: r = R_PPC_COPY; break;
- case BFD_RELOC_PPC_GLOB_DAT: r = R_PPC_GLOB_DAT; break;
- case BFD_RELOC_PPC_LOCAL24PC: r = R_PPC_LOCAL24PC; break;
- case BFD_RELOC_32_PCREL: r = R_PPC_REL32; break;
- case BFD_RELOC_32_PLTOFF: r = R_PPC_PLT32; break;
- case BFD_RELOC_32_PLT_PCREL: r = R_PPC_PLTREL32; break;
- case BFD_RELOC_LO16_PLTOFF: r = R_PPC_PLT16_LO; break;
- case BFD_RELOC_HI16_PLTOFF: r = R_PPC_PLT16_HI; break;
- case BFD_RELOC_HI16_S_PLTOFF: r = R_PPC_PLT16_HA; break;
- case BFD_RELOC_GPREL16: r = R_PPC_SDAREL16; break;
- case BFD_RELOC_16_BASEREL: r = R_PPC_SECTOFF; break;
- case BFD_RELOC_LO16_BASEREL: r = R_PPC_SECTOFF_LO; break;
- case BFD_RELOC_HI16_BASEREL: r = R_PPC_SECTOFF_HI; break;
- case BFD_RELOC_HI16_S_BASEREL: r = R_PPC_SECTOFF_HA; break;
- case BFD_RELOC_CTOR: r = R_PPC_ADDR32; break;
- case BFD_RELOC_PPC_TOC16: r = R_PPC_TOC16; break;
- case BFD_RELOC_PPC_TLS: r = R_PPC_TLS; break;
- case BFD_RELOC_PPC_DTPMOD: r = R_PPC_DTPMOD32; break;
- case BFD_RELOC_PPC_TPREL16: r = R_PPC_TPREL16; break;
- case BFD_RELOC_PPC_TPREL16_LO: r = R_PPC_TPREL16_LO; break;
- case BFD_RELOC_PPC_TPREL16_HI: r = R_PPC_TPREL16_HI; break;
- case BFD_RELOC_PPC_TPREL16_HA: r = R_PPC_TPREL16_HA; break;
- case BFD_RELOC_PPC_TPREL: r = R_PPC_TPREL32; break;
- case BFD_RELOC_PPC_DTPREL16: r = R_PPC_DTPREL16; break;
- case BFD_RELOC_PPC_DTPREL16_LO: r = R_PPC_DTPREL16_LO; break;
- case BFD_RELOC_PPC_DTPREL16_HI: r = R_PPC_DTPREL16_HI; break;
- case BFD_RELOC_PPC_DTPREL16_HA: r = R_PPC_DTPREL16_HA; break;
- case BFD_RELOC_PPC_DTPREL: r = R_PPC_DTPREL32; break;
- case BFD_RELOC_PPC_GOT_TLSGD16: r = R_PPC_GOT_TLSGD16; break;
- case BFD_RELOC_PPC_GOT_TLSGD16_LO: r = R_PPC_GOT_TLSGD16_LO; break;
- case BFD_RELOC_PPC_GOT_TLSGD16_HI: r = R_PPC_GOT_TLSGD16_HI; break;
- case BFD_RELOC_PPC_GOT_TLSGD16_HA: r = R_PPC_GOT_TLSGD16_HA; break;
- case BFD_RELOC_PPC_GOT_TLSLD16: r = R_PPC_GOT_TLSLD16; break;
- case BFD_RELOC_PPC_GOT_TLSLD16_LO: r = R_PPC_GOT_TLSLD16_LO; break;
- case BFD_RELOC_PPC_GOT_TLSLD16_HI: r = R_PPC_GOT_TLSLD16_HI; break;
- case BFD_RELOC_PPC_GOT_TLSLD16_HA: r = R_PPC_GOT_TLSLD16_HA; break;
- case BFD_RELOC_PPC_GOT_TPREL16: r = R_PPC_GOT_TPREL16; break;
- case BFD_RELOC_PPC_GOT_TPREL16_LO: r = R_PPC_GOT_TPREL16_LO; break;
- case BFD_RELOC_PPC_GOT_TPREL16_HI: r = R_PPC_GOT_TPREL16_HI; break;
- case BFD_RELOC_PPC_GOT_TPREL16_HA: r = R_PPC_GOT_TPREL16_HA; break;
- case BFD_RELOC_PPC_GOT_DTPREL16: r = R_PPC_GOT_DTPREL16; break;
- case BFD_RELOC_PPC_GOT_DTPREL16_LO: r = R_PPC_GOT_DTPREL16_LO; break;
- case BFD_RELOC_PPC_GOT_DTPREL16_HI: r = R_PPC_GOT_DTPREL16_HI; break;
- case BFD_RELOC_PPC_GOT_DTPREL16_HA: r = R_PPC_GOT_DTPREL16_HA; break;
- case BFD_RELOC_PPC_EMB_NADDR32: r = R_PPC_EMB_NADDR32; break;
- case BFD_RELOC_PPC_EMB_NADDR16: r = R_PPC_EMB_NADDR16; break;
- case BFD_RELOC_PPC_EMB_NADDR16_LO: r = R_PPC_EMB_NADDR16_LO; break;
- case BFD_RELOC_PPC_EMB_NADDR16_HI: r = R_PPC_EMB_NADDR16_HI; break;
- case BFD_RELOC_PPC_EMB_NADDR16_HA: r = R_PPC_EMB_NADDR16_HA; break;
- case BFD_RELOC_PPC_EMB_SDAI16: r = R_PPC_EMB_SDAI16; break;
- case BFD_RELOC_PPC_EMB_SDA2I16: r = R_PPC_EMB_SDA2I16; break;
- case BFD_RELOC_PPC_EMB_SDA2REL: r = R_PPC_EMB_SDA2REL; break;
- case BFD_RELOC_PPC_EMB_SDA21: r = R_PPC_EMB_SDA21; break;
- case BFD_RELOC_PPC_EMB_MRKREF: r = R_PPC_EMB_MRKREF; break;
- case BFD_RELOC_PPC_EMB_RELSEC16: r = R_PPC_EMB_RELSEC16; break;
- case BFD_RELOC_PPC_EMB_RELST_LO: r = R_PPC_EMB_RELST_LO; break;
- case BFD_RELOC_PPC_EMB_RELST_HI: r = R_PPC_EMB_RELST_HI; break;
- case BFD_RELOC_PPC_EMB_RELST_HA: r = R_PPC_EMB_RELST_HA; break;
- case BFD_RELOC_PPC_EMB_BIT_FLD: r = R_PPC_EMB_BIT_FLD; break;
- case BFD_RELOC_PPC_EMB_RELSDA: r = R_PPC_EMB_RELSDA; break;
- case BFD_RELOC_VTABLE_INHERIT: r = R_PPC_GNU_VTINHERIT; break;
- case BFD_RELOC_VTABLE_ENTRY: r = R_PPC_GNU_VTENTRY; break;
- }
-
- return ppc_elf_howto_table[r];
-};
-
-/* Set the howto pointer for a PowerPC ELF reloc. */
-
-static void
-ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *cache_ptr,
- Elf_Internal_Rela *dst)
-{
- /* Initialize howto table if not already done. */
- if (!ppc_elf_howto_table[R_PPC_ADDR32])
- ppc_elf_howto_init ();
-
- BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max);
- cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)];
-}
-
-/* Handle the R_PPC_ADDR16_HA reloc. */
-
-static bfd_reloc_status_type
-ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *reloc_entry,
- asymbol *symbol,
- void *data ATTRIBUTE_UNUSED,
- asection *input_section,
- bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- bfd_vma relocation;
-
- if (output_bfd != NULL)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
-
- reloc_entry->addend += (relocation & 0x8000) << 1;
-
- return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-ppc_elf_unhandled_reloc (bfd *abfd,
- arelent *reloc_entry,
- asymbol *symbol,
- void *data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message)
-{
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- if (error_message != NULL)
- {
- static char buf[60];
- sprintf (buf, _("generic linker can't handle %s"),
- reloc_entry->howto->name);
- *error_message = buf;
- }
- return bfd_reloc_dangerous;
-}
-
-/* Fix bad default arch selected for a 32 bit input bfd when the
- default is 64 bit. */
-
-static bfd_boolean
-ppc_elf_object_p (bfd *abfd)
-{
- if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 64)
- {
- Elf_Internal_Ehdr *i_ehdr = elf_elfheader (abfd);
-
- if (i_ehdr->e_ident[EI_CLASS] == ELFCLASS32)
- {
- /* Relies on arch after 64 bit default being 32 bit default. */
- abfd->arch_info = abfd->arch_info->next;
- BFD_ASSERT (abfd->arch_info->bits_per_word == 32);
- }
- }
- return TRUE;
-}
-
-/* Function to set whether a module needs the -mrelocatable bit set. */
-
-static bfd_boolean
-ppc_elf_set_private_flags (bfd *abfd, flagword flags)
-{
- BFD_ASSERT (!elf_flags_init (abfd)
- || elf_elfheader (abfd)->e_flags == flags);
-
- elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = TRUE;
- return TRUE;
-}
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
-
-static bfd_boolean
-ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
-{
- flagword old_flags;
- flagword new_flags;
- bfd_boolean error;
-
- /* Check if we have the same endianess. */
- if (! _bfd_generic_verify_endian_match (ibfd, obfd))
- return FALSE;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- new_flags = elf_elfheader (ibfd)->e_flags;
- old_flags = elf_elfheader (obfd)->e_flags;
- if (!elf_flags_init (obfd))
- {
- /* First call, no flags set. */
- elf_flags_init (obfd) = TRUE;
- elf_elfheader (obfd)->e_flags = new_flags;
- }
-
- /* Compatible flags are ok. */
- else if (new_flags == old_flags)
- ;
-
- /* Incompatible flags. */
- else
- {
- /* Warn about -mrelocatable mismatch. Allow -mrelocatable-lib
- to be linked with either. */
- error = FALSE;
- if ((new_flags & EF_PPC_RELOCATABLE) != 0
- && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0)
- {
- error = TRUE;
- (*_bfd_error_handler)
- (_("%s: compiled with -mrelocatable and linked with "
- "modules compiled normally"),
- bfd_archive_filename (ibfd));
- }
- else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
- && (old_flags & EF_PPC_RELOCATABLE) != 0)
- {
- error = TRUE;
- (*_bfd_error_handler)
- (_("%s: compiled normally and linked with "
- "modules compiled with -mrelocatable"),
- bfd_archive_filename (ibfd));
- }
-
- /* The output is -mrelocatable-lib iff both the input files are. */
- if (! (new_flags & EF_PPC_RELOCATABLE_LIB))
- elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB;
-
- /* The output is -mrelocatable iff it can't be -mrelocatable-lib,
- but each input file is either -mrelocatable or -mrelocatable-lib. */
- if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB)
- && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))
- && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)))
- elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE;
-
- /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if
- any module uses it. */
- elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB);
-
- new_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
- old_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
-
- /* Warn about any other mismatches. */
- if (new_flags != old_flags)
- {
- error = TRUE;
- (*_bfd_error_handler)
- (_("%s: uses different e_flags (0x%lx) fields "
- "than previous modules (0x%lx)"),
- bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
- }
-
- if (error)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Handle a PowerPC specific section when reading an object file. This
- is called when elfcode.h finds a section with an unknown type. */
-
-static bfd_boolean
-ppc_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)
-{
- asection *newsect;
- flagword flags;
-
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return FALSE;
-
- newsect = hdr->bfd_section;
- flags = bfd_get_section_flags (abfd, newsect);
- if (hdr->sh_flags & SHF_EXCLUDE)
- flags |= SEC_EXCLUDE;
-
- if (hdr->sh_type == SHT_ORDERED)
- flags |= SEC_SORT_ENTRIES;
-
- bfd_set_section_flags (abfd, newsect, flags);
- return TRUE;
-}
-
-/* Set up any other section flags and such that may be necessary. */
-
-static bfd_boolean
-ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
- Elf_Internal_Shdr *shdr,
- asection *asect)
-{
- if ((asect->flags & SEC_EXCLUDE) != 0)
- shdr->sh_flags |= SHF_EXCLUDE;
-
- if ((asect->flags & SEC_SORT_ENTRIES) != 0)
- shdr->sh_type = SHT_ORDERED;
-
- return TRUE;
-}
-
-/* Find a linker generated pointer with a given addend and type. */
-
-static elf_linker_section_pointers_t *
-elf_find_pointer_linker_section
- (elf_linker_section_pointers_t *linker_pointers,
- bfd_vma addend,
- elf_linker_section_t *lsect)
-{
- for ( ; linker_pointers != NULL; linker_pointers = linker_pointers->next)
- if (lsect == linker_pointers->lsect && addend == linker_pointers->addend)
- return linker_pointers;
-
- return NULL;
-}
-
-/* Allocate a pointer to live in a linker created section. */
-
-static bfd_boolean
-elf_create_pointer_linker_section (bfd *abfd,
- struct bfd_link_info *info,
- elf_linker_section_t *lsect,
- struct elf_link_hash_entry *h,
- const Elf_Internal_Rela *rel)
-{
- elf_linker_section_pointers_t **ptr_linker_section_ptr = NULL;
- elf_linker_section_pointers_t *linker_section_ptr;
- unsigned long r_symndx = ELF32_R_SYM (rel->r_info);
- bfd_size_type amt;
-
- BFD_ASSERT (lsect != NULL);
-
- /* Is this a global symbol? */
- if (h != NULL)
- {
- struct ppc_elf_link_hash_entry *eh;
-
- /* Has this symbol already been allocated? If so, our work is done. */
- eh = (struct ppc_elf_link_hash_entry *) h;
- if (elf_find_pointer_linker_section (eh->linker_section_pointer,
- rel->r_addend,
- lsect))
- return TRUE;
-
- ptr_linker_section_ptr = &eh->linker_section_pointer;
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (lsect->rel_section)
- lsect->rel_section->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- {
- /* Allocation of a pointer to a local symbol. */
- elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd);
-
- /* Allocate a table to hold the local symbols if first time. */
- if (!ptr)
- {
- unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info;
-
- amt = num_symbols;
- amt *= sizeof (elf_linker_section_pointers_t *);
- ptr = bfd_zalloc (abfd, amt);
-
- if (!ptr)
- return FALSE;
-
- elf_local_ptr_offsets (abfd) = ptr;
- }
-
- /* Has this symbol already been allocated? If so, our work is done. */
- if (elf_find_pointer_linker_section (ptr[r_symndx],
- rel->r_addend,
- lsect))
- return TRUE;
-
- ptr_linker_section_ptr = &ptr[r_symndx];
-
- if (info->shared)
- {
- /* If we are generating a shared object, we need to
- output a R_<xxx>_RELATIVE reloc so that the
- dynamic linker can adjust this GOT entry. */
- BFD_ASSERT (lsect->rel_section != NULL);
- lsect->rel_section->_raw_size += sizeof (Elf32_External_Rela);
- }
- }
-
- /* Allocate space for a pointer in the linker section, and allocate
- a new pointer record from internal memory. */
- BFD_ASSERT (ptr_linker_section_ptr != NULL);
- amt = sizeof (elf_linker_section_pointers_t);
- linker_section_ptr = bfd_alloc (abfd, amt);
-
- if (!linker_section_ptr)
- return FALSE;
-
- linker_section_ptr->next = *ptr_linker_section_ptr;
- linker_section_ptr->addend = rel->r_addend;
- linker_section_ptr->lsect = lsect;
- linker_section_ptr->written_address_p = FALSE;
- *ptr_linker_section_ptr = linker_section_ptr;
-
- linker_section_ptr->offset = lsect->section->_raw_size;
- lsect->section->_raw_size += 4;
-
-#ifdef DEBUG
- fprintf (stderr,
- "Create pointer in linker section %s, offset = %ld, section size = %ld\n",
- lsect->name, (long) linker_section_ptr->offset,
- (long) lsect->section->_raw_size);
-#endif
-
- return TRUE;
-}
-
-#define bfd_put_ptr(BFD, VAL, ADDR) bfd_put_32 (BFD, VAL, ADDR)
-
-/* Fill in the address for a pointer generated in a linker section. */
-
-static bfd_vma
-elf_finish_pointer_linker_section (bfd *output_bfd,
- bfd *input_bfd,
- struct bfd_link_info *info,
- elf_linker_section_t *lsect,
- struct elf_link_hash_entry *h,
- bfd_vma relocation,
- const Elf_Internal_Rela *rel,
- int relative_reloc)
-{
- elf_linker_section_pointers_t *linker_section_ptr;
-
- BFD_ASSERT (lsect != NULL);
-
- if (h != NULL)
- {
- /* Handle global symbol. */
- struct ppc_elf_link_hash_entry *eh;
-
- eh = (struct ppc_elf_link_hash_entry *) h;
- linker_section_ptr
- = elf_find_pointer_linker_section (eh->linker_section_pointer,
- rel->r_addend,
- lsect);
-
- BFD_ASSERT (linker_section_ptr != NULL);
-
- if (! elf_hash_table (info)->dynamic_sections_created
- || (info->shared
- && info->symbolic
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally. We must initialize this entry in the
- global section.
-
- When doing a dynamic link, we create a .rela.<xxx>
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if (!linker_section_ptr->written_address_p)
- {
- linker_section_ptr->written_address_p = TRUE;
- bfd_put_ptr (output_bfd,
- relocation + linker_section_ptr->addend,
- (lsect->section->contents
- + linker_section_ptr->offset));
- }
- }
- }
- else
- {
- /* Handle local symbol. */
- unsigned long r_symndx = ELF32_R_SYM (rel->r_info);
- BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL);
- BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL);
- linker_section_ptr = (elf_find_pointer_linker_section
- (elf_local_ptr_offsets (input_bfd)[r_symndx],
- rel->r_addend,
- lsect));
-
- BFD_ASSERT (linker_section_ptr != NULL);
-
- /* Write out pointer if it hasn't been rewritten out before. */
- if (!linker_section_ptr->written_address_p)
- {
- linker_section_ptr->written_address_p = TRUE;
- bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend,
- lsect->section->contents + linker_section_ptr->offset);
-
- if (info->shared)
- {
- /* We need to generate a relative reloc for the dynamic
- linker. */
-
- asection *srel = lsect->rel_section;
- Elf_Internal_Rela outrel[MAX_INT_RELS_PER_EXT_REL];
- bfd_byte *erel;
- const struct elf_backend_data *bed;
- unsigned int i;
-
- BFD_ASSERT (srel != NULL);
-
- bed = get_elf_backend_data (output_bfd);
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- {
- outrel[i].r_offset = (lsect->section->output_section->vma
- + lsect->section->output_offset
- + linker_section_ptr->offset);
- outrel[i].r_info = 0;
- outrel[i].r_addend = 0;
- }
- outrel[0].r_info = ELF32_R_INFO (0, relative_reloc);
- erel = lsect->section->contents;
- erel += (elf_section_data (lsect->section)->rel_count++
- * sizeof (Elf32_External_Rela));
- bfd_elf32_swap_reloca_out (output_bfd, outrel, erel);
- }
- }
- }
-
- relocation = (lsect->section->output_offset
- + linker_section_ptr->offset
- - lsect->sym_offset);
-
-#ifdef DEBUG
- fprintf (stderr,
- "Finish pointer in linker section %s, offset = %ld (0x%lx)\n",
- lsect->name, (long) relocation, (long) relocation);
-#endif
-
- /* Subtract out the addend, because it will get added back in by the normal
- processing. */
- return relocation - linker_section_ptr->addend;
-}
-
-/* Create a special linker section */
-static elf_linker_section_t *
-ppc_elf_create_linker_section (bfd *abfd,
- struct bfd_link_info *info,
- enum elf_linker_section_enum which)
-{
- elf_linker_section_t *lsect;
- struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
- asection *s;
- bfd_size_type amt;
- flagword flags;
- const char *name;
- const char *rel_name;
- const char *sym_name;
- bfd_vma sym_offset;
-
- /* Both of these sections are (technically) created by the user
- putting data in them, so they shouldn't be marked
- SEC_LINKER_CREATED.
-
- The linker creates them so it has somewhere to attach their
- respective symbols. In fact, if they were empty it would
- be OK to leave the symbol set to 0 (or any random number), because
- the appropriate register should never be used. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- sym_offset = 32768;
-
- switch (which)
- {
- default:
- abort ();
- return NULL;
-
- case LINKER_SECTION_SDATA: /* .sdata/.sbss section */
- name = ".sdata";
- rel_name = ".rela.sdata";
- sym_name = "_SDA_BASE_";
- break;
-
- case LINKER_SECTION_SDATA2: /* .sdata2/.sbss2 section */
- name = ".sdata2";
- rel_name = ".rela.sdata2";
- sym_name = "_SDA2_BASE_";
- flags |= SEC_READONLY;
- break;
- }
-
- /* Record the first bfd that needs the special sections. */
- if (!htab->elf.dynobj)
- htab->elf.dynobj = abfd;
-
- amt = sizeof (elf_linker_section_t);
- lsect = bfd_zalloc (htab->elf.dynobj, amt);
-
- lsect->sym_offset = sym_offset;
-
- /* See if the sections already exist. */
- s = bfd_get_section_by_name (htab->elf.dynobj, name);
- if (s == NULL || (s->flags & flags) != flags)
- {
- s = bfd_make_section_anyway (htab->elf.dynobj, name);
- if (s == NULL
- || !bfd_set_section_flags (htab->elf.dynobj, s, flags))
- return NULL;
- }
- lsect->section = s;
-
- if (bfd_get_section_alignment (htab->elf.dynobj, s) < 2
- && !bfd_set_section_alignment (htab->elf.dynobj, s, 2))
- return NULL;
-
- s->_raw_size = align_power (s->_raw_size, 2);
-
-#ifdef DEBUG
- fprintf (stderr, "Creating section %s, current size = %ld\n",
- name, (long) s->_raw_size);
-#endif
-
- if (sym_name)
- {
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
-
-#ifdef DEBUG
- fprintf (stderr, "Adding %s to section %s\n", sym_name, name);
-#endif
- bh = bfd_link_hash_lookup (info->hash, sym_name,
- FALSE, FALSE, FALSE);
-
- if ((bh == NULL || bh->type == bfd_link_hash_undefined)
- && !(_bfd_generic_link_add_one_symbol
- (info, abfd, sym_name, BSF_GLOBAL, s, sym_offset, NULL,
- FALSE, get_elf_backend_data (abfd)->collect, &bh)))
- return NULL;
- h = (struct elf_link_hash_entry *) bh;
-
- h->type = STT_OBJECT;
- lsect->sym_hash = h;
-
- if (info->shared
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return NULL;
- }
-
- if (info->shared)
- {
- s = bfd_make_section_anyway (htab->elf.dynobj, rel_name);
- lsect->rel_section = s;
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED | SEC_READONLY);
- if (s == NULL
- || ! bfd_set_section_flags (htab->elf.dynobj, s, flags)
- || ! bfd_set_section_alignment (htab->elf.dynobj, s, 2))
- return NULL;
- }
-
- return lsect;
-}
-
-/* If we have a non-zero sized .sbss2 or .PPC.EMB.sbss0 sections, we
- need to bump up the number of section headers. */
-
-static int
-ppc_elf_additional_program_headers (bfd *abfd)
-{
- asection *s;
- int ret;
-
- ret = 0;
-
- s = bfd_get_section_by_name (abfd, ".interp");
- if (s != NULL)
- ++ret;
-
- s = bfd_get_section_by_name (abfd, ".sbss2");
- if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
- ++ret;
-
- s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0");
- if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
- ++ret;
-
- return ret;
-}
-
-/* Modify the segment map if needed. */
-
-static bfd_boolean
-ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/* The powerpc .got has a blrl instruction in it. Mark it executable. */
-
-static bfd_boolean
-ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
-{
- struct ppc_elf_link_hash_table *htab;
- asection *s;
- flagword flags;
-
- if (!_bfd_elf_create_got_section (abfd, info))
- return FALSE;
-
- htab = ppc_elf_hash_table (info);
- htab->got = s = bfd_get_section_by_name (abfd, ".got");
- if (s == NULL)
- abort ();
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
- if (!bfd_set_section_flags (abfd, s, flags))
- return FALSE;
-
- htab->relgot = bfd_make_section (abfd, ".rela.got");
- if (!htab->relgot
- || ! bfd_set_section_flags (abfd, htab->relgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (abfd, htab->relgot, 2))
- return FALSE;
-
- return TRUE;
-}
-
-/* We have to create .dynsbss and .rela.sbss here so that they get mapped
- to output sections (just like _bfd_elf_create_dynamic_sections has
- to create .dynbss and .rela.bss). */
-
-static bfd_boolean
-ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
-{
- struct ppc_elf_link_hash_table *htab;
- asection *s;
- flagword flags;
-
- htab = ppc_elf_hash_table (info);
-
- if (htab->got == NULL
- && !ppc_elf_create_got (abfd, info))
- return FALSE;
-
- if (!_bfd_elf_create_dynamic_sections (abfd, info))
- return FALSE;
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
-
- htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
- htab->dynsbss = s = bfd_make_section (abfd, ".dynsbss");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
- return FALSE;
-
- if (! info->shared)
- {
- htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
- htab->relsbss = s = bfd_make_section (abfd, ".rela.sbss");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
- }
-
- htab->relplt = bfd_get_section_by_name (abfd, ".rela.plt");
- htab->plt = s = bfd_get_section_by_name (abfd, ".plt");
- if (s == NULL)
- abort ();
-
- flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED;
- return bfd_set_section_flags (abfd, s, flags);
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
-{
- struct ppc_elf_link_hash_table *htab;
- asection *s;
- unsigned int power_of_two;
-
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n",
- h->root.root.string);
-#endif
-
- /* Make sure we know what is going on here. */
- htab = ppc_elf_hash_table (info);
- BFD_ASSERT (htab->elf.dynobj != NULL
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
- || h->weakdef != NULL
- || ((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)));
-
- /* Deal with function syms. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- /* Clear procedure linkage table information for any symbol that
- won't need a .plt entry. */
- if (h->plt.refcount <= 0
- || SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* A PLT entry is not required/allowed when:
-
- 1. We are not using ld.so; because then the PLT entry
- can't be set up, so we can't use one. In this case,
- ppc_elf_adjust_dynamic_symbol won't even be called.
-
- 2. GC has rendered the entry unused.
-
- 3. We know for certain that a call to this symbol
- will go to this object, or will remain undefined. */
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- return TRUE;
- }
- else
- h->plt.offset = (bfd_vma) -1;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- if (ELIMINATE_COPY_RELOCS)
- h->elf_link_hash_flags
- = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
- | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* If there are no references to this symbol that do not use the
- GOT, we don't need to generate a copy reloc. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
- return TRUE;
-
- if (ELIMINATE_COPY_RELOCS)
- {
- struct ppc_elf_dyn_relocs *p;
- for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
- {
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
-
- /* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
- if (p == NULL)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
- }
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable.
-
- Of course, if the symbol is sufficiently small, we must instead
- allocate it in .sbss. FIXME: It would be better to do this if and
- only if there were actually SDAREL relocs for that symbol. */
-
- if (h->size <= elf_gp_size (htab->elf.dynobj))
- s = htab->dynsbss;
- else
- s = htab->dynbss;
- BFD_ASSERT (s != NULL);
-
- /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
- copy the initial value out of the dynamic object and into the
- runtime process image. We need to remember the offset into the
- .rela.bss section we are going to use. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- asection *srel;
-
- if (h->size <= elf_gp_size (htab->elf.dynobj))
- srel = htab->relsbss;
- else
- srel = htab->relbss;
- BFD_ASSERT (srel != NULL);
- srel->_raw_size += sizeof (Elf32_External_Rela);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
- s->_raw_size = BFD_ALIGN (s->_raw_size,
- (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Of those relocs that might be copied as dynamic relocs, this macro
- selects those that must be copied when linking a shared library,
- even when the symbol is local. */
-
-#define MUST_BE_DYN_RELOC(RTYPE) \
- ((RTYPE) != R_PPC_REL24 \
- && (RTYPE) != R_PPC_REL14 \
- && (RTYPE) != R_PPC_REL14_BRTAKEN \
- && (RTYPE) != R_PPC_REL14_BRNTAKEN \
- && (RTYPE) != R_PPC_REL32)
-
-/* Allocate space in associated reloc sections for dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
-{
- struct bfd_link_info *info = inf;
- struct ppc_elf_link_hash_entry *eh;
- struct ppc_elf_link_hash_table *htab;
- struct ppc_elf_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- htab = ppc_elf_hash_table (info);
- if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
- {
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
- {
- asection *s = htab->plt;
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
-
- /* The PowerPC PLT is actually composed of two parts, the
- first part is 2 words (for a load and a jump), and then
- there is a remaining word available at the end. */
- h->plt.offset = (PLT_INITIAL_ENTRY_SIZE
- + (PLT_SLOT_SIZE
- * ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE)
- / PLT_ENTRY_SIZE)));
-
- /* If this symbol is not defined in a regular file, and we
- are not generating a shared library, then set the symbol
- to this location in the .plt. This is required to make
- function pointers compare as equal between the normal
- executable and the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* Make room for this entry. After the 8192nd entry, room
- for two entries is allocated. */
- s->_raw_size += PLT_ENTRY_SIZE;
- if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
- > PLT_NUM_SINGLE_ENTRIES)
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .rela.plt section. */
- htab->relplt->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- eh = (struct ppc_elf_link_hash_entry *) h;
- if (eh->elf.got.refcount > 0)
- {
- /* Make sure this symbol is output as a dynamic symbol. */
- if (eh->elf.dynindx == -1
- && (eh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (!bfd_elf_link_record_dynamic_symbol (info, &eh->elf))
- return FALSE;
- }
-
- if (eh->tls_mask == (TLS_TLS | TLS_LD)
- && !(eh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
- /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */
- eh->elf.got.offset = (bfd_vma) -1;
- else
- {
- bfd_boolean dyn;
- eh->elf.got.offset = htab->got->_raw_size;
- if ((eh->tls_mask & TLS_TLS) != 0)
- {
- if ((eh->tls_mask & TLS_LD) != 0)
- htab->got->_raw_size += 8;
- if ((eh->tls_mask & TLS_GD) != 0)
- htab->got->_raw_size += 8;
- if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
- htab->got->_raw_size += 4;
- if ((eh->tls_mask & TLS_DTPREL) != 0)
- htab->got->_raw_size += 4;
- }
- else
- htab->got->_raw_size += 4;
- dyn = htab->elf.dynamic_sections_created;
- if ((info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
- && (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
- || eh->elf.root.type != bfd_link_hash_undefweak))
- {
- /* All the entries we allocated need relocs. */
- htab->relgot->_raw_size
- += ((htab->got->_raw_size - eh->elf.got.offset) / 4
- * sizeof (Elf32_External_Rela));
- /* Except LD only needs one. */
- if ((eh->tls_mask & TLS_LD) != 0)
- htab->relgot->_raw_size -= sizeof (Elf32_External_Rela);
- }
- }
- }
- else
- eh->elf.got.offset = (bfd_vma) -1;
-
- if (eh->dyn_relocs == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for relocs that have become local due to symbol visibility
- changes. */
-
- if (info->shared)
- {
- /* Relocs that use pc_count are those that appear on a call insn,
- or certain REL relocs (see MUST_BE_DYN_RELOC) that can be
- generated via assembly. We want calls to protected symbols to
- resolve directly to the function rather than going via the plt.
- If people want function pointer comparisons to work as expected
- then they should avoid writing weird assembly. */
- if (SYMBOL_CALLS_LOCAL (info, h))
- {
- struct ppc_elf_dyn_relocs **pp;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
- {
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
- else
- pp = &p->next;
- }
- }
-
- /* Also discard relocs on undefined weak syms with non-default
- visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
-
- /* Make sure undefined weak symbols are output as a dynamic symbol
- in PIEs. */
- if (info->pie
- && eh->dyn_relocs != NULL
- && h->dynindx == -1
- && h->root.type == bfd_link_hash_undefweak
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
- }
- else if (ELIMINATE_COPY_RELOCS)
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->dyn_relocs = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela);
- }
-
- return TRUE;
-}
-
-/* Find any dynamic relocs that apply to read-only sections. */
-
-static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h, void *info)
-{
- struct ppc_elf_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
-
- if (s != NULL
- && ((s->flags & (SEC_READONLY | SEC_ALLOC))
- == (SEC_READONLY | SEC_ALLOC)))
- {
- ((struct bfd_link_info *) info)->flags |= DF_TEXTREL;
-
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- struct ppc_elf_link_hash_table *htab;
- asection *s;
- bfd_boolean relocs;
- bfd *ibfd;
-
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
-#endif
-
- htab = ppc_elf_hash_table (info);
- BFD_ASSERT (htab->elf.dynobj != NULL);
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (htab->elf.dynobj, ".interp");
- BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- if (htab->tlsld_got.refcount > 0)
- {
- htab->tlsld_got.offset = htab->got->_raw_size;
- htab->got->_raw_size += 8;
- if (info->shared)
- htab->relgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- htab->tlsld_got.offset = (bfd_vma) -1;
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
- char *lgot_masks;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srel;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct ppc_elf_dyn_relocs *p;
-
- for (p = ((struct ppc_elf_dyn_relocs *)
- elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- elf_section_data (p->sec)->sreloc->_raw_size
- += p->count * sizeof (Elf32_External_Rela);
- if ((p->sec->output_section->flags
- & (SEC_READONLY | SEC_ALLOC))
- == (SEC_READONLY | SEC_ALLOC))
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_local_got = local_got + locsymcount;
- lgot_masks = (char *) end_local_got;
- s = htab->got;
- srel = htab->relgot;
- for (; local_got < end_local_got; ++local_got, ++lgot_masks)
- if (*local_got > 0)
- {
- if (*lgot_masks == (TLS_TLS | TLS_LD))
- {
- /* If just an LD reloc, we'll just use
- htab->tlsld_got.offset. */
- if (htab->tlsld_got.offset == (bfd_vma) -1)
- {
- htab->tlsld_got.offset = s->_raw_size;
- s->_raw_size += 8;
- if (info->shared)
- srel->_raw_size += sizeof (Elf32_External_Rela);
- }
- *local_got = (bfd_vma) -1;
- }
- else
- {
- *local_got = s->_raw_size;
- if ((*lgot_masks & TLS_TLS) != 0)
- {
- if ((*lgot_masks & TLS_GD) != 0)
- s->_raw_size += 8;
- if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
- s->_raw_size += 4;
- if ((*lgot_masks & TLS_DTPREL) != 0)
- s->_raw_size += 4;
- }
- else
- s->_raw_size += 4;
- if (info->shared)
- srel->_raw_size += ((s->_raw_size - *local_got) / 4
- * sizeof (Elf32_External_Rela));
- }
- }
- else
- *local_got = (bfd_vma) -1;
- }
-
- /* Allocate space for global sym dynamic relocs. */
- elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
-
- /* We've now determined the sizes of the various dynamic sections.
- Allocate memory for them. */
- relocs = FALSE;
- for (s = htab->elf.dynobj->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- if (s == htab->plt
- || s == htab->got
- || (htab->sdata != NULL && s == htab->sdata->section)
- || (htab->sdata2 != NULL && s == htab->sdata2->section))
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- }
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
- {
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is mostly to handle .rela.bss and
- .rela.plt. We must create both sections in
- create_dynamic_sections, because they must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
- }
- else
- {
- /* Remember whether there are any relocation sections. */
- relocs = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- }
- else
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (s->_raw_size == 0)
- {
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. */
- s->contents = bfd_zalloc (htab->elf.dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in ppc_elf_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->plt != NULL && htab->plt->_raw_size != 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 (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
- return FALSE;
- }
-
- /* If any dynamic relocs apply to a read-only section, then we
- need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (elf_hash_table (info), readonly_dynrelocs,
- info);
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-static bfd_boolean
-update_local_sym_info (bfd *abfd,
- Elf_Internal_Shdr *symtab_hdr,
- unsigned long r_symndx,
- int tls_type)
-{
- bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd);
- char *local_got_tls_masks;
-
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size = symtab_hdr->sh_info;
-
- size *= sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks);
- local_got_refcounts = bfd_zalloc (abfd, size);
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- }
-
- local_got_refcounts[r_symndx] += 1;
- local_got_tls_masks = (char *) (local_got_refcounts + symtab_hdr->sh_info);
- local_got_tls_masks[r_symndx] |= tls_type;
- return TRUE;
-}
-
-static void
-bad_shared_reloc (bfd *abfd, enum elf_ppc_reloc_type r_type)
-{
- (*_bfd_error_handler)
- (_("%s: relocation %s cannot be used when making a shared object"),
- bfd_archive_filename (abfd),
- ppc_elf_howto_table[r_type]->name);
- bfd_set_error (bfd_error_bad_value);
-}
-
-/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table or procedure linkage
- table. */
-
-static bfd_boolean
-ppc_elf_check_relocs (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- const Elf_Internal_Rela *relocs)
-{
- struct ppc_elf_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sreloc;
-
- if (info->relocatable)
- return TRUE;
-
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n",
- bfd_get_section_name (abfd, sec),
- bfd_archive_filename (abfd));
-#endif
-
- /* Initialize howto table if not already done. */
- if (!ppc_elf_howto_table[R_PPC_ADDR32])
- ppc_elf_howto_init ();
-
- /* Create the linker generated sections all the time so that the
- special symbols are created. */
- htab = ppc_elf_hash_table (info);
- if (htab->sdata == NULL)
- {
- htab->sdata = ppc_elf_create_linker_section (abfd, info,
- LINKER_SECTION_SDATA);
- if (htab->sdata == NULL)
- return FALSE;
- }
-
- if (htab->sdata2 == NULL)
- {
- htab->sdata2 = ppc_elf_create_linker_section (abfd, info,
- LINKER_SECTION_SDATA2);
- if (htab->sdata2 == NULL)
- return FALSE;
- }
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- sreloc = NULL;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned long r_symndx;
- enum elf_ppc_reloc_type r_type;
- struct elf_link_hash_entry *h;
- int tls_type = 0;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- /* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
- This shows up in particular in an R_PPC_ADDR32 in the eabi
- startup code. */
- if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- {
- if (htab->got == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!ppc_elf_create_got (htab->elf.dynobj, info))
- return FALSE;
- }
- }
-
- r_type = ELF32_R_TYPE (rel->r_info);
- switch (r_type)
- {
- case R_PPC_GOT_TLSLD16:
- case R_PPC_GOT_TLSLD16_LO:
- case R_PPC_GOT_TLSLD16_HI:
- case R_PPC_GOT_TLSLD16_HA:
- htab->tlsld_got.refcount += 1;
- tls_type = TLS_TLS | TLS_LD;
- goto dogottls;
-
- case R_PPC_GOT_TLSGD16:
- case R_PPC_GOT_TLSGD16_LO:
- case R_PPC_GOT_TLSGD16_HI:
- case R_PPC_GOT_TLSGD16_HA:
- tls_type = TLS_TLS | TLS_GD;
- goto dogottls;
-
- case R_PPC_GOT_TPREL16:
- case R_PPC_GOT_TPREL16_LO:
- case R_PPC_GOT_TPREL16_HI:
- case R_PPC_GOT_TPREL16_HA:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- tls_type = TLS_TLS | TLS_TPREL;
- goto dogottls;
-
- case R_PPC_GOT_DTPREL16:
- case R_PPC_GOT_DTPREL16_LO:
- case R_PPC_GOT_DTPREL16_HI:
- case R_PPC_GOT_DTPREL16_HA:
- tls_type = TLS_TLS | TLS_DTPREL;
- dogottls:
- sec->has_tls_reloc = 1;
- /* Fall thru */
-
- /* GOT16 relocations */
- case R_PPC_GOT16:
- case R_PPC_GOT16_LO:
- case R_PPC_GOT16_HI:
- case R_PPC_GOT16_HA:
- /* This symbol requires a global offset table entry. */
- if (htab->got == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!ppc_elf_create_got (htab->elf.dynobj, info))
- return FALSE;
- }
- if (h != NULL)
- {
- h->got.refcount += 1;
- ppc_elf_hash_entry (h)->tls_mask |= tls_type;
- }
- else
- /* This is a global offset table entry for a local symbol. */
- if (!update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type))
- return FALSE;
- break;
-
- /* Indirect .sdata relocation. */
- case R_PPC_EMB_SDAI16:
- if (info->shared)
- {
- bad_shared_reloc (abfd, r_type);
- return FALSE;
- }
- if (!elf_create_pointer_linker_section (abfd, info,
- htab->sdata, h, rel))
- return FALSE;
- break;
-
- /* Indirect .sdata2 relocation. */
- case R_PPC_EMB_SDA2I16:
- if (info->shared)
- {
- bad_shared_reloc (abfd, r_type);
- return FALSE;
- }
- if (!elf_create_pointer_linker_section (abfd, info,
- htab->sdata2, h, rel))
- return FALSE;
- break;
-
- case R_PPC_SDAREL16:
- case R_PPC_EMB_SDA2REL:
- case R_PPC_EMB_SDA21:
- case R_PPC_EMB_RELSDA:
- case R_PPC_EMB_NADDR32:
- case R_PPC_EMB_NADDR16:
- case R_PPC_EMB_NADDR16_LO:
- case R_PPC_EMB_NADDR16_HI:
- case R_PPC_EMB_NADDR16_HA:
- if (info->shared)
- {
- bad_shared_reloc (abfd, r_type);
- return FALSE;
- }
- break;
-
- case R_PPC_PLT32:
- case R_PPC_PLTREL24:
- case R_PPC_PLTREL32:
- case R_PPC_PLT16_LO:
- case R_PPC_PLT16_HI:
- case R_PPC_PLT16_HA:
-#ifdef DEBUG
- fprintf (stderr, "Reloc requires a PLT entry\n");
-#endif
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in finish_dynamic_symbol,
- because this might be a case of linking PIC code without
- linking in any dynamic objects, in which case we don't
- need to generate a procedure linkage table after all. */
-
- if (h == NULL)
- {
- /* It does not make sense to have a procedure linkage
- table entry for a local symbol. */
- (*_bfd_error_handler) (_("%s(%s+0x%lx): %s reloc against "
- "local symbol"),
- bfd_archive_filename (abfd),
- sec->name,
- (long) rel->r_offset,
- ppc_elf_howto_table[r_type]->name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount++;
- break;
-
- /* The following relocations don't need to propagate the
- relocation if linking a shared object since they are
- section relative. */
- case R_PPC_SECTOFF:
- case R_PPC_SECTOFF_LO:
- case R_PPC_SECTOFF_HI:
- case R_PPC_SECTOFF_HA:
- case R_PPC_DTPREL16:
- case R_PPC_DTPREL16_LO:
- case R_PPC_DTPREL16_HI:
- case R_PPC_DTPREL16_HA:
- case R_PPC_TOC16:
- break;
-
- /* This are just markers. */
- case R_PPC_TLS:
- case R_PPC_EMB_MRKREF:
- case R_PPC_NONE:
- case R_PPC_max:
- break;
-
- /* These should only appear in dynamic objects. */
- case R_PPC_COPY:
- case R_PPC_GLOB_DAT:
- case R_PPC_JMP_SLOT:
- case R_PPC_RELATIVE:
- break;
-
- /* These aren't handled yet. We'll report an error later. */
- case R_PPC_ADDR30:
- case R_PPC_EMB_RELSEC16:
- case R_PPC_EMB_RELST_LO:
- case R_PPC_EMB_RELST_HI:
- case R_PPC_EMB_RELST_HA:
- case R_PPC_EMB_BIT_FLD:
- break;
-
- /* This refers only to functions defined in the shared library. */
- case R_PPC_LOCAL24PC:
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_PPC_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_PPC_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return FALSE;
- break;
-
- /* We shouldn't really be seeing these. */
- case R_PPC_TPREL32:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- goto dodyn;
-
- /* Nor these. */
- case R_PPC_DTPMOD32:
- case R_PPC_DTPREL32:
- goto dodyn;
-
- case R_PPC_TPREL16:
- case R_PPC_TPREL16_LO:
- case R_PPC_TPREL16_HI:
- case R_PPC_TPREL16_HA:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- goto dodyn;
-
- /* When creating a shared object, we must copy these
- relocs into the output file. We create a reloc
- section in dynobj and make room for the reloc. */
- case R_PPC_REL24:
- case R_PPC_REL14:
- case R_PPC_REL14_BRTAKEN:
- case R_PPC_REL14_BRNTAKEN:
- case R_PPC_REL32:
- if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* fall through */
-
- case R_PPC_ADDR32:
- case R_PPC_ADDR24:
- case R_PPC_ADDR16:
- case R_PPC_ADDR16_LO:
- case R_PPC_ADDR16_HI:
- case R_PPC_ADDR16_HA:
- case R_PPC_ADDR14:
- case R_PPC_ADDR14_BRTAKEN:
- case R_PPC_ADDR14_BRNTAKEN:
- case R_PPC_UADDR32:
- case R_PPC_UADDR16:
- if (h != NULL && !info->shared)
- {
- /* We may need a plt entry if the symbol turns out to be
- a function defined in a dynamic object. */
- h->plt.refcount++;
-
- /* We may need a copy reloc too. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
- }
-
- dodyn:
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). In case of a weak definition,
- DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
- storing information in the dyn_relocs field of the hash
- table entry. A similar situation occurs when creating
- shared libraries and symbol visibility changes render the
- symbol local.
-
- If on the other hand, we are creating an executable, we
- may need to keep relocations for symbols satisfied by a
- dynamic library if we manage to avoid copy relocs for the
- symbol. */
- if ((info->shared
- && (MUST_BE_DYN_RELOC (r_type)
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- struct ppc_elf_dyn_relocs *p;
- struct ppc_elf_dyn_relocs **head;
-
-#ifdef DEBUG
- fprintf (stderr,
- "ppc_elf_check_relocs needs to "
- "create relocation for %s\n",
- (h && h->root.root.string
- ? h->root.root.string : "<unknown>"));
-#endif
- if (sreloc == NULL)
- {
- const char *name;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
- name + 5) == 0);
-
- sreloc = bfd_get_section_by_name (htab->elf.dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (htab->elf.dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (htab->elf.dynobj,
- sreloc, flags)
- || ! bfd_set_section_alignment (htab->elf.dynobj,
- sreloc, 2))
- return FALSE;
- }
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- {
- head = &ppc_elf_hash_entry (h)->dyn_relocs;
- }
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
-
- asection *s;
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct ppc_elf_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->sec != sec)
- {
- p = bfd_alloc (htab->elf.dynobj, sizeof *p);
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
- }
-
- p->count += 1;
- if (!MUST_BE_DYN_RELOC (r_type))
- p->pc_count += 1;
- }
-
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-ppc_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_PPC_GNU_VTINHERIT:
- case R_PPC_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got, plt and dynamic reloc reference counts for the
- section being removed. */
-
-static bfd_boolean
-ppc_elf_gc_sweep_hook (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- const Elf_Internal_Rela *relocs)
-{
- struct ppc_elf_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- htab = ppc_elf_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- enum elf_ppc_reloc_type r_type;
- struct elf_link_hash_entry *h = NULL;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct ppc_elf_dyn_relocs **pp, *p;
- struct ppc_elf_link_hash_entry *eh;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct ppc_elf_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- r_type = ELF32_R_TYPE (rel->r_info);
- switch (r_type)
- {
- case R_PPC_GOT_TLSLD16:
- case R_PPC_GOT_TLSLD16_LO:
- case R_PPC_GOT_TLSLD16_HI:
- case R_PPC_GOT_TLSLD16_HA:
- htab->tlsld_got.refcount -= 1;
- /* Fall thru */
-
- case R_PPC_GOT_TLSGD16:
- case R_PPC_GOT_TLSGD16_LO:
- case R_PPC_GOT_TLSGD16_HI:
- case R_PPC_GOT_TLSGD16_HA:
- case R_PPC_GOT_TPREL16:
- case R_PPC_GOT_TPREL16_LO:
- case R_PPC_GOT_TPREL16_HI:
- case R_PPC_GOT_TPREL16_HA:
- case R_PPC_GOT_DTPREL16:
- case R_PPC_GOT_DTPREL16_LO:
- case R_PPC_GOT_DTPREL16_HI:
- case R_PPC_GOT_DTPREL16_HA:
- case R_PPC_GOT16:
- case R_PPC_GOT16_LO:
- case R_PPC_GOT16_HI:
- case R_PPC_GOT16_HA:
- if (h != NULL)
- {
- if (h->got.refcount > 0)
- h->got.refcount--;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx]--;
- }
- break;
-
- case R_PPC_REL24:
- case R_PPC_REL14:
- case R_PPC_REL14_BRTAKEN:
- case R_PPC_REL14_BRNTAKEN:
- case R_PPC_REL32:
- if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* Fall thru */
-
- case R_PPC_ADDR32:
- case R_PPC_ADDR24:
- case R_PPC_ADDR16:
- case R_PPC_ADDR16_LO:
- case R_PPC_ADDR16_HI:
- case R_PPC_ADDR16_HA:
- case R_PPC_ADDR14:
- case R_PPC_ADDR14_BRTAKEN:
- case R_PPC_ADDR14_BRNTAKEN:
- case R_PPC_UADDR32:
- case R_PPC_UADDR16:
- case R_PPC_PLT32:
- case R_PPC_PLTREL24:
- case R_PPC_PLT16_LO:
- case R_PPC_PLT16_HI:
- case R_PPC_PLT16_HA:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;
-
- default:
- break;
- }
- }
- return TRUE;
-}
-
-/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */
-
-asection *
-ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
-{
- struct ppc_elf_link_hash_table *htab;
-
- htab = ppc_elf_hash_table (info);
- htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
- FALSE, FALSE, TRUE);
-
- return _bfd_elf_tls_setup (obfd, info);
-}
-
-/* Run through all the TLS relocs looking for optimization
- opportunities. */
-
-bfd_boolean
-ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- bfd *ibfd;
- asection *sec;
- struct ppc_elf_link_hash_table *htab;
-
- if (info->relocatable || info->shared)
- return TRUE;
-
- htab = ppc_elf_hash_table (info);
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- Elf_Internal_Sym *locsyms = NULL;
- Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
-
- for (sec = ibfd->sections; sec != NULL; sec = sec->next)
- if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section))
- {
- Elf_Internal_Rela *relstart, *rel, *relend;
- int expecting_tls_get_addr;
-
- /* Read the relocations. */
- relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
- info->keep_memory);
- if (relstart == NULL)
- return FALSE;
-
- expecting_tls_get_addr = 0;
- relend = relstart + sec->reloc_count;
- for (rel = relstart; rel < relend; rel++)
- {
- enum elf_ppc_reloc_type r_type;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h = NULL;
- char *tls_mask;
- char tls_set, tls_clear;
- bfd_boolean is_local;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_link_hash_entry **sym_hashes;
-
- sym_hashes = elf_sym_hashes (ibfd);
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- }
-
- is_local = FALSE;
- if (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
- is_local = TRUE;
-
- r_type = ELF32_R_TYPE (rel->r_info);
- switch (r_type)
- {
- case R_PPC_GOT_TLSLD16:
- case R_PPC_GOT_TLSLD16_LO:
- case R_PPC_GOT_TLSLD16_HI:
- case R_PPC_GOT_TLSLD16_HA:
- /* These relocs should never be against a symbol
- defined in a shared lib. Leave them alone if
- that turns out to be the case. */
- expecting_tls_get_addr = 0;
- htab->tlsld_got.refcount -= 1;
- if (!is_local)
- continue;
-
- /* LD -> LE */
- tls_set = 0;
- tls_clear = TLS_LD;
- expecting_tls_get_addr = 1;
- break;
-
- case R_PPC_GOT_TLSGD16:
- case R_PPC_GOT_TLSGD16_LO:
- case R_PPC_GOT_TLSGD16_HI:
- case R_PPC_GOT_TLSGD16_HA:
- if (is_local)
- /* GD -> LE */
- tls_set = 0;
- else
- /* GD -> IE */
- tls_set = TLS_TLS | TLS_TPRELGD;
- tls_clear = TLS_GD;
- expecting_tls_get_addr = 1;
- break;
-
- case R_PPC_GOT_TPREL16:
- case R_PPC_GOT_TPREL16_LO:
- case R_PPC_GOT_TPREL16_HI:
- case R_PPC_GOT_TPREL16_HA:
- expecting_tls_get_addr = 0;
- if (is_local)
- {
- /* IE -> LE */
- tls_set = 0;
- tls_clear = TLS_TPREL;
- break;
- }
- else
- continue;
-
- case R_PPC_REL14:
- case R_PPC_REL14_BRTAKEN:
- case R_PPC_REL14_BRNTAKEN:
- case R_PPC_REL24:
- if (expecting_tls_get_addr
- && h != NULL
- && h == htab->tls_get_addr)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- expecting_tls_get_addr = 0;
- continue;
-
- default:
- expecting_tls_get_addr = 0;
- continue;
- }
-
- if (h != NULL)
- {
- if (tls_set == 0)
- {
- /* We managed to get rid of a got entry. */
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- tls_mask = &ppc_elf_hash_entry (h)->tls_mask;
- }
- else
- {
- Elf_Internal_Sym *sym;
- bfd_signed_vma *lgot_refs;
- char *lgot_masks;
-
- if (locsyms == NULL)
- {
- locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (locsyms == NULL)
- locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
- symtab_hdr->sh_info,
- 0, NULL, NULL, NULL);
- if (locsyms == NULL)
- {
- if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
- return FALSE;
- }
- }
- sym = locsyms + r_symndx;
- lgot_refs = elf_local_got_refcounts (ibfd);
- if (lgot_refs == NULL)
- abort ();
- if (tls_set == 0)
- {
- /* We managed to get rid of a got entry. */
- if (lgot_refs[r_symndx] > 0)
- lgot_refs[r_symndx] -= 1;
- }
- lgot_masks = (char *) (lgot_refs + symtab_hdr->sh_info);
- tls_mask = &lgot_masks[r_symndx];
- }
-
- *tls_mask |= tls_set;
- *tls_mask &= ~tls_clear;
- }
-
- if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
- }
-
- if (locsyms != NULL
- && (symtab_hdr->contents != (unsigned char *) locsyms))
- {
- if (!info->keep_memory)
- free (locsyms);
- else
- symtab_hdr->contents = (unsigned char *) locsyms;
- }
- }
- return TRUE;
-}
-
-/* Hook called by the linker routine which adds symbols from an object
- file. We use it to put .comm items in .sbss, and not .bss. */
-
-static bfd_boolean
-ppc_elf_add_symbol_hook (bfd *abfd,
- struct bfd_link_info *info,
- Elf_Internal_Sym *sym,
- const char **namep ATTRIBUTE_UNUSED,
- flagword *flagsp ATTRIBUTE_UNUSED,
- asection **secp,
- bfd_vma *valp)
-{
- if (sym->st_shndx == SHN_COMMON
- && !info->relocatable
- && sym->st_size <= elf_gp_size (abfd)
- && (info->hash->creator == abfd->xvec
- || info->hash->creator == abfd->xvec->alternative_target))
- {
- /* Common symbols less than or equal to -G nn bytes are automatically
- put into .sbss. */
- struct ppc_elf_link_hash_table *htab;
-
- htab = ppc_elf_hash_table (info);
- if (htab->sbss == NULL)
- {
- flagword flags = SEC_IS_COMMON;
-
- htab->sbss = bfd_make_section_anyway (abfd, ".sbss");
- if (htab->sbss == NULL
- || ! bfd_set_section_flags (abfd, htab->sbss, flags))
- return FALSE;
- }
-
- *secp = htab->sbss;
- *valp = sym->st_size;
- }
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
- struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- struct ppc_elf_link_hash_table *htab;
-
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s",
- h->root.root.string);
-#endif
-
- htab = ppc_elf_hash_table (info);
- BFD_ASSERT (htab->elf.dynobj != NULL);
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
- bfd_vma reloc_index;
-
-#ifdef DEBUG
- fprintf (stderr, ", plt_offset = %d", h->plt.offset);
-#endif
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
- BFD_ASSERT (h->dynindx != -1);
- BFD_ASSERT (htab->plt != NULL && htab->relplt != NULL);
-
- /* We don't need to fill in the .plt. The ppc dynamic linker
- will fill it in. */
-
- /* Fill in the entry in the .rela.plt section. */
- rela.r_offset = (htab->plt->output_section->vma
- + htab->plt->output_offset
- + h->plt.offset);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT);
- rela.r_addend = 0;
-
- reloc_index = (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_SLOT_SIZE;
- if (reloc_index > PLT_NUM_SINGLE_ENTRIES)
- reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2;
- loc = (htab->relplt->contents
- + reloc_index * sizeof (Elf32_External_Rela));
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. */
- sym->st_shndx = SHN_UNDEF;
- /* If the symbol is weak, we do need to clear the value.
- Otherwise, the PLT entry would provide a definition for
- the symbol even if the symbol wasn't defined anywhere,
- and so the symbol would never be NULL. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
- == 0)
- sym->st_value = 0;
- }
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- asection *s;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbols needs a copy reloc. Set it up. */
-
-#ifdef DEBUG
- fprintf (stderr, ", copy");
-#endif
-
- BFD_ASSERT (h->dynindx != -1);
-
- if (h->size <= elf_gp_size (htab->elf.dynobj))
- s = htab->relsbss;
- else
- s = htab->relbss;
- BFD_ASSERT (s != NULL);
-
- rela.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY);
- rela.r_addend = 0;
- loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
- }
-
-#ifdef DEBUG
- fprintf (stderr, "\n");
-#endif
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-ppc_elf_finish_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- asection *sdyn;
- struct ppc_elf_link_hash_table *htab;
-
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
-#endif
-
- htab = ppc_elf_hash_table (info);
- sdyn = bfd_get_section_by_name (htab->elf.dynobj, ".dynamic");
-
- if (htab->elf.dynamic_sections_created)
- {
- Elf32_External_Dyn *dyncon, *dynconend;
-
- BFD_ASSERT (htab->plt != NULL && sdyn != NULL);
-
- dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- asection *s;
-
- bfd_elf32_swap_dyn_in (htab->elf.dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- case DT_PLTGOT:
- s = htab->plt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- break;
-
- case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->relplt->_raw_size;
- break;
-
- case DT_JMPREL:
- s = htab->relplt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- break;
-
- default:
- continue;
- }
-
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
- }
-
- /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
- easily find the address of the _GLOBAL_OFFSET_TABLE_. */
- if (htab->got)
- {
- unsigned char *contents = htab->got->contents;
- bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents);
-
- if (sdyn == NULL)
- bfd_put_32 (output_bfd, 0, contents + 4);
- else
- bfd_put_32 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- contents + 4);
-
- elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
- }
-
- return TRUE;
-}
-
-/* The RELOCATE_SECTION function is called by the ELF backend linker
- to handle the relocations for a section.
-
- The relocs are always passed as Rela structures; if the section
- actually uses Rel structures, the r_addend field will always be
- zero.
-
- This function is responsible for adjust the section contents as
- necessary, and (if using Rela relocs and generating a
- relocatable output file) adjusting the reloc addend as
- necessary.
-
- This function does not have to worry about setting the reloc
- address or the reloc symbol index.
-
- LOCAL_SYMS is a pointer to the swapped in local symbols.
-
- LOCAL_SECTIONS is an array giving the section in the input file
- corresponding to the st_shndx field of each local symbol.
-
- The global hash table entry for the global symbols can be found
- via elf_sym_hashes (input_bfd).
-
- When generating relocatable output, this function must handle
- STB_LOCAL/STT_SECTION symbols specially. The output symbol is
- going to be the section symbol corresponding to the output
- section, which means that the addend must be adjusted
- accordingly. */
-
-static bfd_boolean
-ppc_elf_relocate_section (bfd *output_bfd,
- struct bfd_link_info *info,
- bfd *input_bfd,
- asection *input_section,
- bfd_byte *contents,
- Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms,
- asection **local_sections)
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- struct ppc_elf_link_hash_table *htab;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- asection *sreloc = NULL;
- bfd_vma *local_got_offsets;
- bfd_boolean ret = TRUE;
-
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, "
- "%ld relocations%s\n",
- bfd_archive_filename (input_bfd),
- bfd_section_name(input_bfd, input_section),
- (long) input_section->reloc_count,
- (info->relocatable) ? " (relocatable)" : "");
-#endif
-
- if (info->relocatable)
- return TRUE;
-
- /* Initialize howto table if not already done. */
- if (!ppc_elf_howto_table[R_PPC_ADDR32])
- ppc_elf_howto_init ();
-
- htab = ppc_elf_hash_table (info);
- local_got_offsets = elf_local_got_offsets (input_bfd);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- enum elf_ppc_reloc_type r_type;
- bfd_vma addend;
- bfd_reloc_status_type r;
- Elf_Internal_Sym *sym;
- asection *sec;
- struct elf_link_hash_entry *h;
- const char *sym_name;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- bfd_vma relocation;
- bfd_vma branch_bit, insn, from;
- bfd_boolean unresolved_reloc;
- bfd_boolean warned;
- unsigned int tls_type, tls_mask, tls_gd;
-
- r_type = ELF32_R_TYPE (rel->r_info);
- sym = NULL;
- sec = NULL;
- h = NULL;
- unresolved_reloc = FALSE;
- warned = FALSE;
- r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- sym_name = bfd_elf_local_sym_name (input_bfd, sym);
-
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- }
- else
- {
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
-
- sym_name = h->root.root.string;
- }
-
- /* TLS optimizations. Replace instruction sequences and relocs
- based on information we collected in tls_optimize. We edit
- RELOCS so that --emit-relocs will output something sensible
- for the final instruction stream. */
- tls_mask = 0;
- tls_gd = 0;
- if (IS_PPC_TLS_RELOC (r_type))
- {
- if (h != NULL)
- tls_mask = ((struct ppc_elf_link_hash_entry *) h)->tls_mask;
- else if (local_got_offsets != NULL)
- {
- char *lgot_masks;
- lgot_masks = (char *) (local_got_offsets + symtab_hdr->sh_info);
- tls_mask = lgot_masks[r_symndx];
- }
- }
-
- /* Ensure reloc mapping code below stays sane. */
- if ((R_PPC_GOT_TLSLD16 & 3) != (R_PPC_GOT_TLSGD16 & 3)
- || (R_PPC_GOT_TLSLD16_LO & 3) != (R_PPC_GOT_TLSGD16_LO & 3)
- || (R_PPC_GOT_TLSLD16_HI & 3) != (R_PPC_GOT_TLSGD16_HI & 3)
- || (R_PPC_GOT_TLSLD16_HA & 3) != (R_PPC_GOT_TLSGD16_HA & 3)
- || (R_PPC_GOT_TLSLD16 & 3) != (R_PPC_GOT_TPREL16 & 3)
- || (R_PPC_GOT_TLSLD16_LO & 3) != (R_PPC_GOT_TPREL16_LO & 3)
- || (R_PPC_GOT_TLSLD16_HI & 3) != (R_PPC_GOT_TPREL16_HI & 3)
- || (R_PPC_GOT_TLSLD16_HA & 3) != (R_PPC_GOT_TPREL16_HA & 3))
- abort ();
- switch (r_type)
- {
- default:
- break;
-
- case R_PPC_GOT_TPREL16:
- case R_PPC_GOT_TPREL16_LO:
- if (tls_mask != 0
- && (tls_mask & TLS_TPREL) == 0)
- {
- bfd_vma insn;
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
- insn &= 31 << 21;
- insn |= 0x3c020000; /* addis 0,2,0 */
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
- r_type = R_PPC_TPREL16_HA;
- rel->r_info = ELF32_R_INFO (r_symndx, r_type);
- }
- break;
-
- case R_PPC_TLS:
- if (tls_mask != 0
- && (tls_mask & TLS_TPREL) == 0)
- {
- bfd_vma insn, rtra;
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
- if ((insn & ((31 << 26) | (31 << 11)))
- == ((31 << 26) | (2 << 11)))
- rtra = insn & ((1 << 26) - (1 << 16));
- else if ((insn & ((31 << 26) | (31 << 16)))
- == ((31 << 26) | (2 << 16)))
- rtra = (insn & (31 << 21)) | ((insn & (31 << 11)) << 5);
- else
- abort ();
- if ((insn & ((1 << 11) - (1 << 1))) == 266 << 1)
- /* add -> addi. */
- insn = 14 << 26;
- else if ((insn & (31 << 1)) == 23 << 1
- && ((insn & (31 << 6)) < 14 << 6
- || ((insn & (31 << 6)) >= 16 << 6
- && (insn & (31 << 6)) < 24 << 6)))
- /* load and store indexed -> dform. */
- insn = (32 | ((insn >> 6) & 31)) << 26;
- else if ((insn & (31 << 1)) == 21 << 1
- && (insn & (0x1a << 6)) == 0)
- /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu. */
- insn = (((58 | ((insn >> 6) & 4)) << 26)
- | ((insn >> 6) & 1));
- else if ((insn & (31 << 1)) == 21 << 1
- && (insn & ((1 << 11) - (1 << 1))) == 341 << 1)
- /* lwax -> lwa. */
- insn = (58 << 26) | 2;
- else
- abort ();
- insn |= rtra;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- r_type = R_PPC_TPREL16_LO;
- rel->r_info = ELF32_R_INFO (r_symndx, r_type);
- /* Was PPC_TLS which sits on insn boundary, now
- PPC_TPREL16_LO which is at insn+2. */
- rel->r_offset += 2;
- }
- break;
-
- case R_PPC_GOT_TLSGD16_HI:
- case R_PPC_GOT_TLSGD16_HA:
- tls_gd = TLS_TPRELGD;
- if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
- goto tls_gdld_hi;
- break;
-
- case R_PPC_GOT_TLSLD16_HI:
- case R_PPC_GOT_TLSLD16_HA:
- if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
- {
- tls_gdld_hi:
- if ((tls_mask & tls_gd) != 0)
- r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
- + R_PPC_GOT_TPREL16);
- else
- {
- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
- rel->r_offset -= 2;
- r_type = R_PPC_NONE;
- }
- rel->r_info = ELF32_R_INFO (r_symndx, r_type);
- }
- break;
-
- case R_PPC_GOT_TLSGD16:
- case R_PPC_GOT_TLSGD16_LO:
- tls_gd = TLS_TPRELGD;
- if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
- goto tls_get_addr_check;
- break;
-
- case R_PPC_GOT_TLSLD16:
- case R_PPC_GOT_TLSLD16_LO:
- if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
- {
- tls_get_addr_check:
- if (rel + 1 < relend)
- {
- enum elf_ppc_reloc_type r_type2;
- unsigned long r_symndx2;
- struct elf_link_hash_entry *h2;
- bfd_vma insn1, insn2;
- bfd_vma offset;
-
- /* The next instruction should be a call to
- __tls_get_addr. Peek at the reloc to be sure. */
- r_type2 = ELF32_R_TYPE (rel[1].r_info);
- r_symndx2 = ELF32_R_SYM (rel[1].r_info);
- if (r_symndx2 < symtab_hdr->sh_info
- || (r_type2 != R_PPC_REL14
- && r_type2 != R_PPC_REL14_BRTAKEN
- && r_type2 != R_PPC_REL14_BRNTAKEN
- && r_type2 != R_PPC_REL24
- && r_type2 != R_PPC_PLTREL24))
- break;
-
- h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
- while (h2->root.type == bfd_link_hash_indirect
- || h2->root.type == bfd_link_hash_warning)
- h2 = (struct elf_link_hash_entry *) h2->root.u.i.link;
- if (h2 == NULL || h2 != htab->tls_get_addr)
- break;
-
- /* OK, it checks out. Replace the call. */
- offset = rel[1].r_offset;
- insn1 = bfd_get_32 (output_bfd,
- contents + rel->r_offset - 2);
- if ((tls_mask & tls_gd) != 0)
- {
- /* IE */
- insn1 &= (1 << 26) - 1;
- insn1 |= 32 << 26; /* lwz */
- insn2 = 0x7c631214; /* add 3,3,2 */
- rel[1].r_info = ELF32_R_INFO (r_symndx2, R_PPC_NONE);
- r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
- + R_PPC_GOT_TPREL16);
- rel->r_info = ELF32_R_INFO (r_symndx, r_type);
- }
- else
- {
- /* LE */
- insn1 = 0x3c620000; /* addis 3,2,0 */
- insn2 = 0x38630000; /* addi 3,3,0 */
- if (tls_gd == 0)
- {
- /* Was an LD reloc. */
- r_symndx = 0;
- rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
- rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
- }
- r_type = R_PPC_TPREL16_HA;
- rel->r_info = ELF32_R_INFO (r_symndx, r_type);
- rel[1].r_info = ELF32_R_INFO (r_symndx,
- R_PPC_TPREL16_LO);
- rel[1].r_offset += 2;
- }
- bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
- bfd_put_32 (output_bfd, insn2, contents + offset);
- if (tls_gd == 0)
- {
- /* We changed the symbol on an LD reloc. Start over
- in order to get h, sym, sec etc. right. */
- rel--;
- continue;
- }
- }
- }
- break;
- }
-
- /* Handle other relocations that tweak non-addend part of insn. */
- branch_bit = 0;
- switch (r_type)
- {
- default:
- break;
-
- /* Branch taken prediction relocations. */
- case R_PPC_ADDR14_BRTAKEN:
- case R_PPC_REL14_BRTAKEN:
- branch_bit = BRANCH_PREDICT_BIT;
- /* Fall thru */
-
- /* Branch not taken prediction relocations. */
- case R_PPC_ADDR14_BRNTAKEN:
- case R_PPC_REL14_BRNTAKEN:
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
- insn &= ~BRANCH_PREDICT_BIT;
- insn |= branch_bit;
-
- from = (rel->r_offset
- + input_section->output_offset
- + input_section->output_section->vma);
-
- /* Invert 'y' bit if not the default. */
- if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
- insn ^= BRANCH_PREDICT_BIT;
-
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- break;
- }
-
- addend = rel->r_addend;
- tls_type = 0;
- howto = NULL;
- if (r_type < R_PPC_max)
- howto = ppc_elf_howto_table[r_type];
- switch (r_type)
- {
- default:
- (*_bfd_error_handler)
- (_("%s: unknown relocation type %d for symbol %s"),
- bfd_archive_filename (input_bfd), (int) r_type, sym_name);
-
- bfd_set_error (bfd_error_bad_value);
- ret = FALSE;
- continue;
-
- case R_PPC_NONE:
- case R_PPC_TLS:
- case R_PPC_EMB_MRKREF:
- case R_PPC_GNU_VTINHERIT:
- case R_PPC_GNU_VTENTRY:
- continue;
-
- /* GOT16 relocations. Like an ADDR16 using the symbol's
- address in the GOT as relocation value instead of the
- symbol's value itself. Also, create a GOT entry for the
- symbol and put the symbol value there. */
- case R_PPC_GOT_TLSGD16:
- case R_PPC_GOT_TLSGD16_LO:
- case R_PPC_GOT_TLSGD16_HI:
- case R_PPC_GOT_TLSGD16_HA:
- tls_type = TLS_TLS | TLS_GD;
- goto dogot;
-
- case R_PPC_GOT_TLSLD16:
- case R_PPC_GOT_TLSLD16_LO:
- case R_PPC_GOT_TLSLD16_HI:
- case R_PPC_GOT_TLSLD16_HA:
- tls_type = TLS_TLS | TLS_LD;
- goto dogot;
-
- case R_PPC_GOT_TPREL16:
- case R_PPC_GOT_TPREL16_LO:
- case R_PPC_GOT_TPREL16_HI:
- case R_PPC_GOT_TPREL16_HA:
- tls_type = TLS_TLS | TLS_TPREL;
- goto dogot;
-
- case R_PPC_GOT_DTPREL16:
- case R_PPC_GOT_DTPREL16_LO:
- case R_PPC_GOT_DTPREL16_HI:
- case R_PPC_GOT_DTPREL16_HA:
- tls_type = TLS_TLS | TLS_DTPREL;
- goto dogot;
-
- case R_PPC_GOT16:
- case R_PPC_GOT16_LO:
- case R_PPC_GOT16_HI:
- case R_PPC_GOT16_HA:
- dogot:
- {
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- bfd_vma off;
- bfd_vma *offp;
- unsigned long indx;
-
- if (htab->got == NULL)
- abort ();
-
- indx = 0;
- if (tls_type == (TLS_TLS | TLS_LD)
- && (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
- offp = &htab->tlsld_got.offset;
- else if (h != NULL)
- {
- bfd_boolean dyn;
- dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h)))
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally, or the symbol was forced to be local
- because of a version file. */
- ;
- else
- {
- indx = h->dynindx;
- unresolved_reloc = FALSE;
- }
- offp = &h->got.offset;
- }
- else
- {
- if (local_got_offsets == NULL)
- abort ();
- offp = &local_got_offsets[r_symndx];
- }
-
- /* The offset must always be a multiple of 4. We use the
- least significant bit to record whether we have already
- processed this entry. */
- off = *offp;
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- unsigned int tls_m = (tls_mask
- & (TLS_LD | TLS_GD | TLS_DTPREL
- | TLS_TPREL | TLS_TPRELGD));
-
- if (offp == &htab->tlsld_got.offset)
- tls_m = TLS_LD;
- else if (h == NULL
- || !(h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC))
- tls_m &= ~TLS_LD;
-
- /* We might have multiple got entries for this sym.
- Initialize them all. */
- do
- {
- int tls_ty = 0;
-
- if ((tls_m & TLS_LD) != 0)
- {
- tls_ty = TLS_TLS | TLS_LD;
- tls_m &= ~TLS_LD;
- }
- else if ((tls_m & TLS_GD) != 0)
- {
- tls_ty = TLS_TLS | TLS_GD;
- tls_m &= ~TLS_GD;
- }
- else if ((tls_m & TLS_DTPREL) != 0)
- {
- tls_ty = TLS_TLS | TLS_DTPREL;
- tls_m &= ~TLS_DTPREL;
- }
- else if ((tls_m & (TLS_TPREL | TLS_TPRELGD)) != 0)
- {
- tls_ty = TLS_TLS | TLS_TPREL;
- tls_m = 0;
- }
-
- /* Generate relocs for the dynamic linker. */
- if ((info->shared || indx != 0)
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
- {
- outrel.r_offset = (htab->got->output_section->vma
- + htab->got->output_offset
- + off);
- outrel.r_addend = 0;
- if (tls_ty & (TLS_LD | TLS_GD))
- {
- outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32);
- if (tls_ty == (TLS_TLS | TLS_GD))
- {
- loc = htab->relgot->contents;
- loc += (htab->relgot->reloc_count++
- * sizeof (Elf32_External_Rela));
- bfd_elf32_swap_reloca_out (output_bfd,
- &outrel, loc);
- outrel.r_offset += 4;
- outrel.r_info
- = ELF32_R_INFO (indx, R_PPC_DTPREL32);
- }
- }
- else if (tls_ty == (TLS_TLS | TLS_DTPREL))
- outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32);
- else if (tls_ty == (TLS_TLS | TLS_TPREL))
- outrel.r_info = ELF32_R_INFO (indx, R_PPC_TPREL32);
- else if (indx == 0)
- outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE);
- else
- outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT);
- if (indx == 0)
- {
- outrel.r_addend += relocation;
- if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL))
- outrel.r_addend -= htab->elf.tls_sec->vma;
- }
- loc = htab->relgot->contents;
- loc += (htab->relgot->reloc_count++
- * sizeof (Elf32_External_Rela));
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- }
-
- /* Init the .got section contents if we're not
- emitting a reloc. */
- else
- {
- bfd_vma value = relocation;
-
- if (tls_ty == (TLS_TLS | TLS_LD))
- value = 1;
- else if (tls_ty != 0)
- {
- value -= htab->elf.tls_sec->vma + DTP_OFFSET;
- if (tls_ty == (TLS_TLS | TLS_TPREL))
- value += DTP_OFFSET - TP_OFFSET;
-
- if (tls_ty == (TLS_TLS | TLS_GD))
- {
- bfd_put_32 (output_bfd, value,
- htab->got->contents + off + 4);
- value = 1;
- }
- }
- bfd_put_32 (output_bfd, value,
- htab->got->contents + off);
- }
-
- off += 4;
- if (tls_ty & (TLS_LD | TLS_GD))
- off += 4;
- }
- while (tls_m != 0);
-
- off = *offp;
- *offp = off | 1;
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
-
- if ((tls_type & TLS_TLS) != 0)
- {
- if (tls_type != (TLS_TLS | TLS_LD))
- {
- if ((tls_mask & TLS_LD) != 0
- && !(h == NULL
- || !(h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC)))
- off += 8;
- if (tls_type != (TLS_TLS | TLS_GD))
- {
- if ((tls_mask & TLS_GD) != 0)
- off += 8;
- if (tls_type != (TLS_TLS | TLS_DTPREL))
- {
- if ((tls_mask & TLS_DTPREL) != 0)
- off += 4;
- }
- }
- }
- }
-
- relocation = htab->got->output_offset + off - 4;
-
- /* Addends on got relocations don't make much sense.
- x+off@got is actually x@got+off, and since the got is
- generated by a hash table traversal, the value in the
- got at entry m+n bears little relation to the entry m. */
- if (addend != 0)
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- howto->name,
- sym_name);
- }
- break;
-
- /* Relocations that need no special processing. */
- case R_PPC_LOCAL24PC:
- /* It makes no sense to point a local relocation
- at a symbol not in this object. */
- if (unresolved_reloc)
- {
- if (! (*info->callbacks->undefined_symbol) (info,
- h->root.root.string,
- input_bfd,
- input_section,
- rel->r_offset,
- TRUE))
- return FALSE;
- continue;
- }
- break;
-
- case R_PPC_DTPREL16:
- case R_PPC_DTPREL16_LO:
- case R_PPC_DTPREL16_HI:
- case R_PPC_DTPREL16_HA:
- addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
- break;
-
- /* Relocations that may need to be propagated if this is a shared
- object. */
- case R_PPC_TPREL16:
- case R_PPC_TPREL16_LO:
- case R_PPC_TPREL16_HI:
- case R_PPC_TPREL16_HA:
- addend -= htab->elf.tls_sec->vma + TP_OFFSET;
- /* The TPREL16 relocs shouldn't really be used in shared
- libs as they will result in DT_TEXTREL being set, but
- support them anyway. */
- goto dodyn;
-
- case R_PPC_TPREL32:
- addend -= htab->elf.tls_sec->vma + TP_OFFSET;
- goto dodyn;
-
- case R_PPC_DTPREL32:
- addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
- goto dodyn;
-
- case R_PPC_DTPMOD32:
- relocation = 1;
- addend = 0;
- goto dodyn;
-
- case R_PPC_REL24:
- case R_PPC_REL32:
- case R_PPC_REL14:
- case R_PPC_REL14_BRTAKEN:
- case R_PPC_REL14_BRNTAKEN:
- /* If these relocations are not to a named symbol, they can be
- handled right here, no need to bother the dynamic linker. */
- if (SYMBOL_REFERENCES_LOCAL (info, h)
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* fall through */
-
- /* Relocations that always need to be propagated if this is a shared
- object. */
- case R_PPC_ADDR32:
- case R_PPC_ADDR24:
- case R_PPC_ADDR16:
- case R_PPC_ADDR16_LO:
- case R_PPC_ADDR16_HI:
- case R_PPC_ADDR16_HA:
- case R_PPC_ADDR14:
- case R_PPC_ADDR14_BRTAKEN:
- case R_PPC_ADDR14_BRNTAKEN:
- case R_PPC_UADDR32:
- case R_PPC_UADDR16:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- dodyn:
- if (r_symndx == 0)
- break;
- /* Fall thru. */
-
- if ((info->shared
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (MUST_BE_DYN_RELOC (r_type)
- || !SYMBOL_CALLS_LOCAL (info, h)))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && (input_section->flags & SEC_ALLOC) != 0
- && h != NULL
- && h->dynindx != -1
- && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- int skip;
-
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_relocate_section needs to "
- "create relocation for %s\n",
- (h && h->root.root.string
- ? h->root.root.string : "<unknown>"));
-#endif
-
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
- if (sreloc == NULL)
- {
- const char *name;
-
- name = (bfd_elf_string_from_elf_section
- (input_bfd,
- elf_elfheader (input_bfd)->e_shstrndx,
- elf_section_data (input_section)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name (input_bfd,
- input_section),
- name + 5) == 0);
-
- sreloc = bfd_get_section_by_name (htab->elf.dynobj, name);
- BFD_ASSERT (sreloc != NULL);
- }
-
- skip = 0;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1
- || outrel.r_offset == (bfd_vma) -2)
- skip = (int) outrel.r_offset;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- else if (!SYMBOL_REFERENCES_LOCAL (info, h))
- {
- unresolved_reloc = FALSE;
- outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
- outrel.r_addend = rel->r_addend;
- }
- else
- {
- outrel.r_addend = relocation + rel->r_addend;
-
- if (r_type == R_PPC_ADDR32)
- outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
- else
- {
- long indx;
-
- if (bfd_is_abs_section (sec))
- indx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- asection *osec;
-
- /* We are turning this relocation into one
- against a section symbol. It would be
- proper to subtract the symbol's value,
- osec->vma, from the emitted reloc addend,
- but ld.so expects buggy relocs. */
- osec = sec->output_section;
- indx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (indx > 0);
-#ifdef DEBUG
- if (indx <= 0)
- printf ("indx=%d section=%s flags=%08x name=%s\n",
- indx, osec->name, osec->flags,
- h->root.root.string);
-#endif
- }
-
- outrel.r_info = ELF32_R_INFO (indx, r_type);
- }
- }
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-
- if (skip == -1)
- continue;
-
- /* This reloc will be computed at runtime. We clear the memory
- so that it contains predictable value. */
- if (! skip
- && ((input_section->flags & SEC_ALLOC) != 0
- || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE))
- {
- relocation = howto->pc_relative ? outrel.r_offset : 0;
- addend = 0;
- break;
- }
- }
- break;
-
- case R_PPC_RELAX32PC:
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset - 4);
- /* Fall thru */
- case R_PPC_RELAX32:
- {
- unsigned long t0;
- unsigned long t1;
-
- t0 = bfd_get_32 (output_bfd, contents + rel->r_offset);
- t1 = bfd_get_32 (output_bfd, contents + rel->r_offset + 4);
-
- /* We're clearing the bits for R_PPC_ADDR16_HA
- and R_PPC_ADDR16_LO here. */
- t0 &= ~0xffff;
- t1 &= ~0xffff;
-
- /* t0 is HA, t1 is LO */
- relocation += addend;
- t0 |= ((relocation + 0x8000) >> 16) & 0xffff;
- t1 |= relocation & 0xffff;
-
- bfd_put_32 (output_bfd, t0, contents + rel->r_offset);
- bfd_put_32 (output_bfd, t1, contents + rel->r_offset + 4);
- }
- continue;
-
- /* Indirect .sdata relocation. */
- case R_PPC_EMB_SDAI16:
- BFD_ASSERT (htab->sdata != NULL);
- relocation
- = elf_finish_pointer_linker_section (output_bfd, input_bfd, info,
- htab->sdata, h, relocation,
- rel, R_PPC_RELATIVE);
- break;
-
- /* Indirect .sdata2 relocation. */
- case R_PPC_EMB_SDA2I16:
- BFD_ASSERT (htab->sdata2 != NULL);
- relocation
- = elf_finish_pointer_linker_section (output_bfd, input_bfd, info,
- htab->sdata2, h, relocation,
- rel, R_PPC_RELATIVE);
- break;
-
- /* Handle the TOC16 reloc. We want to use the offset within the .got
- section, not the actual VMA. This is appropriate when generating
- an embedded ELF object, for which the .got section acts like the
- AIX .toc section. */
- case R_PPC_TOC16: /* phony GOT16 relocations */
- BFD_ASSERT (sec != NULL);
- BFD_ASSERT (bfd_is_und_section (sec)
- || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
- || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0)
-
- addend -= sec->output_section->vma + sec->output_offset + 0x8000;
- break;
-
- case R_PPC_PLTREL24:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
- BFD_ASSERT (h != NULL);
-
- if (h->plt.offset == (bfd_vma) -1
- || htab->plt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- unresolved_reloc = FALSE;
- relocation = (htab->plt->output_section->vma
- + htab->plt->output_offset
- + h->plt.offset);
- break;
-
- /* Relocate against _SDA_BASE_. */
- case R_PPC_SDAREL16:
- {
- const char *name;
- const struct elf_link_hash_entry *sh;
-
- BFD_ASSERT (sec != NULL);
- name = bfd_get_section_name (abfd, sec->output_section);
- if (! ((strncmp (name, ".sdata", 6) == 0
- && (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
- && (name[5] == 0 || name[5] == '.'))))
- {
- (*_bfd_error_handler)
- (_("%s: the target (%s) of a %s relocation is "
- "in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
- sym_name,
- howto->name,
- name);
- }
- sh = htab->sdata->sym_hash;
- addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
- }
- break;
-
- /* Relocate against _SDA2_BASE_. */
- case R_PPC_EMB_SDA2REL:
- {
- const char *name;
- const struct elf_link_hash_entry *sh;
-
- BFD_ASSERT (sec != NULL);
- name = bfd_get_section_name (abfd, sec->output_section);
- if (! (strncmp (name, ".sdata2", 7) == 0
- || strncmp (name, ".sbss2", 6) == 0))
- {
- (*_bfd_error_handler)
- (_("%s: the target (%s) of a %s relocation is "
- "in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
- sym_name,
- howto->name,
- name);
-
- bfd_set_error (bfd_error_bad_value);
- ret = FALSE;
- continue;
- }
- sh = htab->sdata2->sym_hash;
- addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
- }
- break;
-
- /* Relocate against either _SDA_BASE_, _SDA2_BASE_, or 0. */
- case R_PPC_EMB_SDA21:
- case R_PPC_EMB_RELSDA:
- {
- const char *name;
- const struct elf_link_hash_entry *sh;
- int reg;
-
- BFD_ASSERT (sec != NULL);
- name = bfd_get_section_name (abfd, sec->output_section);
- if (((strncmp (name, ".sdata", 6) == 0
- && (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
- && (name[5] == 0 || name[5] == '.'))))
- {
- reg = 13;
- sh = htab->sdata->sym_hash;
- addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
- }
-
- else if (strncmp (name, ".sdata2", 7) == 0
- || strncmp (name, ".sbss2", 6) == 0)
- {
- reg = 2;
- sh = htab->sdata2->sym_hash;
- addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
- }
-
- else if (strcmp (name, ".PPC.EMB.sdata0") == 0
- || strcmp (name, ".PPC.EMB.sbss0") == 0)
- {
- reg = 0;
- }
-
- else
- {
- (*_bfd_error_handler)
- (_("%s: the target (%s) of a %s relocation is "
- "in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
- sym_name,
- howto->name,
- name);
-
- bfd_set_error (bfd_error_bad_value);
- ret = FALSE;
- continue;
- }
-
- if (r_type == R_PPC_EMB_SDA21)
- { /* fill in register field */
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
- insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- }
- }
- break;
-
- /* Relocate against the beginning of the section. */
- case R_PPC_SECTOFF:
- case R_PPC_SECTOFF_LO:
- case R_PPC_SECTOFF_HI:
- case R_PPC_SECTOFF_HA:
- BFD_ASSERT (sec != NULL);
- addend -= sec->output_section->vma;
- break;
-
- /* Negative relocations. */
- case R_PPC_EMB_NADDR32:
- case R_PPC_EMB_NADDR16:
- case R_PPC_EMB_NADDR16_LO:
- case R_PPC_EMB_NADDR16_HI:
- case R_PPC_EMB_NADDR16_HA:
- addend -= 2 * relocation;
- break;
-
- case R_PPC_COPY:
- case R_PPC_GLOB_DAT:
- case R_PPC_JMP_SLOT:
- case R_PPC_RELATIVE:
- case R_PPC_PLT32:
- case R_PPC_PLTREL32:
- case R_PPC_PLT16_LO:
- case R_PPC_PLT16_HI:
- case R_PPC_PLT16_HA:
- case R_PPC_ADDR30:
- case R_PPC_EMB_RELSEC16:
- case R_PPC_EMB_RELST_LO:
- case R_PPC_EMB_RELST_HI:
- case R_PPC_EMB_RELST_HA:
- case R_PPC_EMB_BIT_FLD:
- (*_bfd_error_handler)
- (_("%s: relocation %s is not yet supported for symbol %s."),
- bfd_archive_filename (input_bfd),
- howto->name,
- sym_name);
-
- bfd_set_error (bfd_error_invalid_operation);
- ret = FALSE;
- continue;
- }
-
- /* Do any further special processing. */
- switch (r_type)
- {
- default:
- break;
-
- case R_PPC_ADDR16_HA:
- case R_PPC_GOT16_HA:
- case R_PPC_PLT16_HA:
- case R_PPC_SECTOFF_HA:
- case R_PPC_TPREL16_HA:
- case R_PPC_DTPREL16_HA:
- case R_PPC_GOT_TLSGD16_HA:
- case R_PPC_GOT_TLSLD16_HA:
- case R_PPC_GOT_TPREL16_HA:
- case R_PPC_GOT_DTPREL16_HA:
- case R_PPC_EMB_NADDR16_HA:
- case R_PPC_EMB_RELST_HA:
- /* It's just possible that this symbol is a weak symbol
- that's not actually defined anywhere. In that case,
- 'sec' would be NULL, and we should leave the symbol
- alone (it will be set to zero elsewhere in the link). */
- if (sec != NULL)
- /* Add 0x10000 if sign bit in 0:15 is set.
- Bits 0:15 are not used. */
- addend += 0x8000;
- break;
- }
-
-#ifdef DEBUG
- fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, "
- "offset = %ld, addend = %ld\n",
- howto->name,
- (int) r_type,
- sym_name,
- r_symndx,
- (long) rel->r_offset,
- (long) addend);
-#endif
-
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- howto->name,
- sym_name);
- ret = FALSE;
- }
-
- r = _bfd_final_link_relocate (howto,
- input_bfd,
- input_section,
- contents,
- rel->r_offset,
- relocation,
- addend);
-
- if (r != bfd_reloc_ok)
- {
- if (sym_name == NULL)
- sym_name = "(null)";
- if (r == bfd_reloc_overflow)
- {
- if (warned)
- continue;
- if (h != NULL
- && h->root.type == bfd_link_hash_undefweak
- && howto->pc_relative)
- {
- /* Assume this is a call protected by other code that
- detect the symbol is undefined. If this is the case,
- we can safely ignore the overflow. If not, the
- program is hosed anyway, and a little warning isn't
- going to help. */
-
- continue;
- }
-
- if (! (*info->callbacks->reloc_overflow) (info,
- sym_name,
- howto->name,
- rel->r_addend,
- input_bfd,
- input_section,
- rel->r_offset))
- return FALSE;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): %s reloc against `%s': error %d"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset, howto->name, sym_name, (int) r);
- ret = FALSE;
- }
- }
- }
-
-#ifdef DEBUG
- fprintf (stderr, "\n");
-#endif
-
- return ret;
-}
-
-static enum elf_reloc_type_class
-ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela)
-{
- switch (ELF32_R_TYPE (rela->r_info))
- {
- case R_PPC_RELATIVE:
- return reloc_class_relative;
- case R_PPC_REL24:
- case R_PPC_ADDR24:
- case R_PPC_JMP_SLOT:
- return reloc_class_plt;
- case R_PPC_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-/* Support for core dump NOTE sections. */
-
-static bfd_boolean
-ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- int offset;
- unsigned int raw_size;
-
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 268: /* Linux/PPC. */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 72;
- raw_size = 192;
-
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static bfd_boolean
-ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 128: /* Linux/PPC elf_prpsinfo. */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-
-/* Very simple linked list structure for recording apuinfo values. */
-typedef struct apuinfo_list
-{
- struct apuinfo_list *next;
- unsigned long value;
-}
-apuinfo_list;
-
-static apuinfo_list *head;
-
-
-static void
-apuinfo_list_init (void)
-{
- head = NULL;
-}
-
-static void
-apuinfo_list_add (unsigned long value)
-{
- apuinfo_list *entry = head;
-
- while (entry != NULL)
- {
- if (entry->value == value)
- return;
- entry = entry->next;
- }
-
- entry = bfd_malloc (sizeof (* entry));
- if (entry == NULL)
- return;
-
- entry->value = value;
- entry->next = head;
- head = entry;
-}
-
-static unsigned
-apuinfo_list_length (void)
-{
- apuinfo_list *entry;
- unsigned long count;
-
- for (entry = head, count = 0;
- entry;
- entry = entry->next)
- ++ count;
-
- return count;
-}
-
-static inline unsigned long
-apuinfo_list_element (unsigned long number)
-{
- apuinfo_list * entry;
-
- for (entry = head;
- entry && number --;
- entry = entry->next)
- ;
-
- return entry ? entry->value : 0;
-}
-
-static void
-apuinfo_list_finish (void)
-{
- apuinfo_list *entry;
-
- for (entry = head; entry;)
- {
- apuinfo_list *next = entry->next;
- free (entry);
- entry = next;
- }
-
- head = NULL;
-}
-
-#define APUINFO_SECTION_NAME ".PPC.EMB.apuinfo"
-#define APUINFO_LABEL "APUinfo"
-
-/* Scan the input BFDs and create a linked list of
- the APUinfo values that will need to be emitted. */
-
-static void
-ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
-{
- bfd *ibfd;
- asection *asec;
- char *buffer;
- unsigned num_input_sections;
- bfd_size_type output_section_size;
- unsigned i;
- unsigned num_entries;
- unsigned long offset;
- unsigned long length;
- const char *error_message = NULL;
-
- if (link_info == NULL)
- return;
-
- /* Scan the input bfds, looking for apuinfo sections. */
- num_input_sections = 0;
- output_section_size = 0;
-
- for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next)
- {
- asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME);
- if (asec)
- {
- ++ num_input_sections;
- output_section_size += asec->_raw_size;
- }
- }
-
- /* We need at least one input sections
- in order to make merging worthwhile. */
- if (num_input_sections < 1)
- return;
-
- /* Just make sure that the output section exists as well. */
- asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
- if (asec == NULL)
- return;
-
- /* Allocate a buffer for the contents of the input sections. */
- buffer = bfd_malloc (output_section_size);
- if (buffer == NULL)
- return;
-
- offset = 0;
- apuinfo_list_init ();
-
- /* Read in the input sections contents. */
- for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next)
- {
- unsigned long datum;
- char *ptr;
-
- asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME);
- if (asec == NULL)
- continue;
-
- length = asec->_raw_size;
- if (length < 24)
- {
- error_message = _("corrupt or empty %s section in %s");
- goto fail;
- }
-
- if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0
- || (bfd_bread (buffer + offset, length, ibfd) != length))
- {
- error_message = _("unable to read in %s section from %s");
- goto fail;
- }
-
- /* Process the contents of the section. */
- ptr = buffer + offset;
- error_message = _("corrupt %s section in %s");
-
- /* Verify the contents of the header. Note - we have to
- extract the values this way in order to allow for a
- host whose endian-ness is different from the target. */
- datum = bfd_get_32 (ibfd, ptr);
- if (datum != sizeof APUINFO_LABEL)
- goto fail;
-
- datum = bfd_get_32 (ibfd, ptr + 8);
- if (datum != 0x2)
- goto fail;
-
- if (strcmp (ptr + 12, APUINFO_LABEL) != 0)
- goto fail;
-
- /* Get the number of bytes used for apuinfo entries. */
- datum = bfd_get_32 (ibfd, ptr + 4);
- if (datum + 20 != length)
- goto fail;
-
- /* Make sure that we do not run off the end of the section. */
- if (offset + length > output_section_size)
- goto fail;
-
- /* Scan the apuinfo section, building a list of apuinfo numbers. */
- for (i = 0; i < datum; i += 4)
- apuinfo_list_add (bfd_get_32 (ibfd, ptr + 20 + i));
-
- /* Update the offset. */
- offset += length;
- }
-
- error_message = NULL;
-
- /* Compute the size of the output section. */
- num_entries = apuinfo_list_length ();
- output_section_size = 20 + num_entries * 4;
-
- asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
-
- if (! bfd_set_section_size (abfd, asec, output_section_size))
- ibfd = abfd,
- error_message = _("warning: unable to set size of %s section in %s");
-
- fail:
- free (buffer);
-
- if (error_message)
- (*_bfd_error_handler) (error_message, APUINFO_SECTION_NAME,
- bfd_archive_filename (ibfd));
-}
-
-
-/* Prevent the output section from accumulating the input sections'
- contents. We have already stored this in our linked list structure. */
-
-static bfd_boolean
-ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED,
- asection *asec,
- bfd_byte *contents ATTRIBUTE_UNUSED)
-{
- return (apuinfo_list_length ()
- && strcmp (asec->name, APUINFO_SECTION_NAME) == 0);
-}
-
-
-/* Finally we can generate the output section. */
-
-static void
-ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
-{
- bfd_byte *buffer;
- asection *asec;
- unsigned i;
- unsigned num_entries;
- bfd_size_type length;
-
- asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
- if (asec == NULL)
- return;
-
- if (apuinfo_list_length () == 0)
- return;
-
- length = asec->_raw_size;
- if (length < 20)
- return;
-
- buffer = bfd_malloc (length);
- if (buffer == NULL)
- {
- (*_bfd_error_handler)
- (_("failed to allocate space for new APUinfo section."));
- return;
- }
-
- /* Create the apuinfo header. */
- num_entries = apuinfo_list_length ();
- bfd_put_32 (abfd, sizeof APUINFO_LABEL, buffer);
- bfd_put_32 (abfd, num_entries * 4, buffer + 4);
- bfd_put_32 (abfd, 0x2, buffer + 8);
- strcpy (buffer + 12, APUINFO_LABEL);
-
- length = 20;
- for (i = 0; i < num_entries; i++)
- {
- bfd_put_32 (abfd, apuinfo_list_element (i), buffer + length);
- length += 4;
- }
-
- if (length != asec->_raw_size)
- (*_bfd_error_handler) (_("failed to compute new APUinfo section."));
-
- if (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length))
- (*_bfd_error_handler) (_("failed to install new APUinfo section."));
-
- free (buffer);
-
- apuinfo_list_finish ();
-}
-
-/* Add extra PPC sections -- Note, for now, make .sbss2 and
- .PPC.EMB.sbss0 a normal section, and not a bss section so
- that the linker doesn't crater when trying to make more than
- 2 sections. */
-
-static struct bfd_elf_special_section const ppc_elf_special_sections[]=
-{
- { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 },
- { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC },
- { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC },
- { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
-};
-
-#define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec
-#define TARGET_LITTLE_NAME "elf32-powerpcle"
-#define TARGET_BIG_SYM bfd_elf32_powerpc_vec
-#define TARGET_BIG_NAME "elf32-powerpc"
-#define ELF_ARCH bfd_arch_powerpc
-#define ELF_MACHINE_CODE EM_PPC
-#ifdef __QNXTARGET__
-#define ELF_MAXPAGESIZE 0x1000
-#else
-#define ELF_MAXPAGESIZE 0x10000
-#endif
-#define elf_info_to_howto ppc_elf_info_to_howto
-
-#ifdef EM_CYGNUS_POWERPC
-#define ELF_MACHINE_ALT1 EM_CYGNUS_POWERPC
-#endif
-
-#ifdef EM_PPC_OLD
-#define ELF_MACHINE_ALT2 EM_PPC_OLD
-#endif
-
-#define elf_backend_plt_not_loaded 1
-#define elf_backend_got_symbol_offset 4
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_got_header_size 12
-#define elf_backend_rela_normal 1
-
-#define bfd_elf32_mkobject ppc_elf_mkobject
-#define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data
-#define bfd_elf32_bfd_relax_section ppc_elf_relax_section
-#define bfd_elf32_bfd_reloc_type_lookup ppc_elf_reloc_type_lookup
-#define bfd_elf32_bfd_set_private_flags ppc_elf_set_private_flags
-#define bfd_elf32_bfd_link_hash_table_create ppc_elf_link_hash_table_create
-
-#define elf_backend_object_p ppc_elf_object_p
-#define elf_backend_gc_mark_hook ppc_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook ppc_elf_gc_sweep_hook
-#define elf_backend_section_from_shdr ppc_elf_section_from_shdr
-#define elf_backend_relocate_section ppc_elf_relocate_section
-#define elf_backend_create_dynamic_sections ppc_elf_create_dynamic_sections
-#define elf_backend_check_relocs ppc_elf_check_relocs
-#define elf_backend_copy_indirect_symbol ppc_elf_copy_indirect_symbol
-#define elf_backend_adjust_dynamic_symbol ppc_elf_adjust_dynamic_symbol
-#define elf_backend_add_symbol_hook ppc_elf_add_symbol_hook
-#define elf_backend_size_dynamic_sections ppc_elf_size_dynamic_sections
-#define elf_backend_finish_dynamic_symbol ppc_elf_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections ppc_elf_finish_dynamic_sections
-#define elf_backend_fake_sections ppc_elf_fake_sections
-#define elf_backend_additional_program_headers ppc_elf_additional_program_headers
-#define elf_backend_modify_segment_map ppc_elf_modify_segment_map
-#define elf_backend_grok_prstatus ppc_elf_grok_prstatus
-#define elf_backend_grok_psinfo ppc_elf_grok_psinfo
-#define elf_backend_reloc_type_class ppc_elf_reloc_type_class
-#define elf_backend_begin_write_processing ppc_elf_begin_write_processing
-#define elf_backend_final_write_processing ppc_elf_final_write_processing
-#define elf_backend_write_section ppc_elf_write_section
-#define elf_backend_special_sections ppc_elf_special_sections
-
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-ppc.h b/contrib/binutils/bfd/elf32-ppc.h
deleted file mode 100644
index fa2c585..0000000
--- a/contrib/binutils/bfd/elf32-ppc.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* PowerPC-specific support for 64-bit ELF.
- Copyright 2003 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *);
-bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *);
diff --git a/contrib/binutils/bfd/elf32-s390.c b/contrib/binutils/bfd/elf32-s390.c
deleted file mode 100644
index 074c108..0000000
--- a/contrib/binutils/bfd/elf32-s390.c
+++ /dev/null
@@ -1,3498 +0,0 @@
-/* IBM S/390-specific support for 32-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
- Contributed by Carl B. Pedersen and Martin Schwidefsky.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-static reloc_howto_type *elf_s390_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void elf_s390_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static bfd_boolean elf_s390_is_local_label_name
- PARAMS ((bfd *, const char *));
-static struct bfd_hash_entry *link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *elf_s390_link_hash_table_create
- PARAMS ((bfd *));
-static bfd_boolean create_got_section
- PARAMS((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_create_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
-static void elf_s390_copy_indirect_symbol
- PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static bfd_boolean elf_s390_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static asection *elf_s390_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf_s390_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-struct elf_s390_link_hash_entry;
-static void elf_s390_adjust_gotplt
- PARAMS ((struct elf_s390_link_hash_entry *));
-static bfd_boolean elf_s390_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean readonly_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean elf_s390_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static bfd_boolean elf_s390_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static enum elf_reloc_type_class elf_s390_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static bfd_boolean elf_s390_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_mkobject
- PARAMS ((bfd *));
-static bfd_boolean elf_s390_object_p
- PARAMS ((bfd *));
-static bfd_boolean elf_s390_grok_prstatus
- PARAMS ((bfd *, Elf_Internal_Note *));
-static int elf_s390_tls_transition
- PARAMS ((struct bfd_link_info *, int, int));
-static bfd_reloc_status_type s390_tls_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_vma dtpoff_base
- PARAMS ((struct bfd_link_info *));
-static bfd_vma tpoff
- PARAMS ((struct bfd_link_info *, bfd_vma));
-static void invalid_tls_insn
- PARAMS ((bfd *, asection *, Elf_Internal_Rela *));
-static bfd_reloc_status_type s390_elf_ldisp_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
-#include "elf/s390.h"
-
-/* The relocation "howto" table. */
-
-static reloc_howto_type elf_howto_table[] =
-{
- HOWTO (R_390_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_390_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO(R_390_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_8", FALSE, 0,0x000000ff, FALSE),
- HOWTO(R_390_12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_390_12", FALSE, 0,0x00000fff, FALSE),
- HOWTO(R_390_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_PC32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC32", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_GOT12, 0, 1, 12, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOT12", FALSE, 0,0x00000fff, FALSE),
- HOWTO(R_390_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOT32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLT32", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_COPY, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_COPY", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GLOB_DAT", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_JMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_JMP_SLOT", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_RELATIVE, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_RELATIVE", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_GOTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTOFF32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_GOTPC, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPC", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_GOT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOT16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC16", FALSE, 0,0x0000ffff, TRUE),
- HOWTO(R_390_PC16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC16DBL", FALSE, 0,0x0000ffff, TRUE),
- HOWTO(R_390_PLT16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLT16DBL", FALSE, 0,0x0000ffff, TRUE),
- HOWTO(R_390_PC32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC32DBL", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_PLT32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLT32DBL", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_GOTPCDBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPCDBL", FALSE, 0,0xffffffff, TRUE),
- EMPTY_HOWTO (R_390_64), /* Empty entry for R_390_64. */
- EMPTY_HOWTO (R_390_PC64), /* Empty entry for R_390_PC64. */
- EMPTY_HOWTO (R_390_GOT64), /* Empty entry for R_390_GOT64. */
- EMPTY_HOWTO (R_390_PLT64), /* Empty entry for R_390_PLT64. */
- HOWTO(R_390_GOTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTENT", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_GOTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTOFF16", FALSE, 0,0x0000ffff, FALSE),
- EMPTY_HOWTO (R_390_GOTOFF64), /* Empty entry for R_390_GOTOFF64. */
- HOWTO(R_390_GOTPLT12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_390_GOTPLT12", FALSE, 0,0x00000fff, FALSE),
- HOWTO(R_390_GOTPLT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPLT16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_GOTPLT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPLT32", FALSE, 0,0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_GOTPLT64), /* Empty entry for R_390_GOTPLT64. */
- HOWTO(R_390_GOTPLTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPLTENT",FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_PLTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLTOFF16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_PLTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLTOFF32", FALSE, 0,0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_PLTOFF64), /* Empty entry for R_390_PLTOFF64. */
- HOWTO(R_390_TLS_LOAD, 0, 0, 0, FALSE, 0, complain_overflow_dont,
- s390_tls_reloc, "R_390_TLS_LOAD", FALSE, 0, 0, FALSE),
- HOWTO(R_390_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
- s390_tls_reloc, "R_390_TLS_GDCALL", FALSE, 0, 0, FALSE),
- HOWTO(R_390_TLS_LDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
- s390_tls_reloc, "R_390_TLS_LDCALL", FALSE, 0, 0, FALSE),
- HOWTO(R_390_TLS_GD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_GD32", FALSE, 0, 0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_TLS_GD64), /* Empty entry for R_390_TLS_GD64. */
- HOWTO(R_390_TLS_GOTIE12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_390_TLS_GOTIE12", FALSE, 0, 0x00000fff, FALSE),
- HOWTO(R_390_TLS_GOTIE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_GOTIE32", FALSE, 0, 0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_TLS_GOTIE64), /* Empty entry for R_390_TLS_GOTIE64. */
- HOWTO(R_390_TLS_LDM32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_LDM32", FALSE, 0, 0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_TLS_LDM64), /* Empty entry for R_390_TLS_LDM64. */
- HOWTO(R_390_TLS_IE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_IE32", FALSE, 0, 0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_TLS_IE64), /* Empty entry for R_390_TLS_IE64. */
- HOWTO(R_390_TLS_IEENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_IEENT", FALSE, 0, 0xffffffff, TRUE),
- HOWTO(R_390_TLS_LE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_LE32", FALSE, 0, 0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_TLS_LE64), /* Empty entry for R_390_TLS_LE64. */
- HOWTO(R_390_TLS_LDO32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_LDO32", FALSE, 0, 0xffffffff, FALSE),
- EMPTY_HOWTO (R_390_TLS_LDO64), /* Empty entry for R_390_TLS_LDO64. */
- HOWTO(R_390_TLS_DTPMOD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_DTPMOD", FALSE, 0, 0xffffffff, FALSE),
- HOWTO(R_390_TLS_DTPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_DTPOFF", FALSE, 0, 0xffffffff, FALSE),
- HOWTO(R_390_TLS_TPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_TPOFF", FALSE, 0, 0xffffffff, FALSE),
- HOWTO(R_390_20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_20", FALSE, 0,0x0fffff00, FALSE),
- HOWTO(R_390_GOT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_GOT20", FALSE, 0,0x0fffff00, FALSE),
- HOWTO(R_390_GOTPLT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_GOTPLT20", FALSE, 0,0x0fffff00, FALSE),
- HOWTO(R_390_TLS_GOTIE20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_TLS_GOTIE20", FALSE, 0,0x0fffff00, FALSE),
-};
-
-/* GNU extension to record C++ vtable hierarchy. */
-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);
-
-static reloc_howto_type *
-elf_s390_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- case BFD_RELOC_NONE:
- return &elf_howto_table[(int) R_390_NONE];
- case BFD_RELOC_8:
- return &elf_howto_table[(int) R_390_8];
- case BFD_RELOC_390_12:
- return &elf_howto_table[(int) R_390_12];
- case BFD_RELOC_16:
- return &elf_howto_table[(int) R_390_16];
- case BFD_RELOC_32:
- return &elf_howto_table[(int) R_390_32];
- case BFD_RELOC_CTOR:
- return &elf_howto_table[(int) R_390_32];
- case BFD_RELOC_32_PCREL:
- return &elf_howto_table[(int) R_390_PC32];
- case BFD_RELOC_390_GOT12:
- return &elf_howto_table[(int) R_390_GOT12];
- case BFD_RELOC_32_GOT_PCREL:
- return &elf_howto_table[(int) R_390_GOT32];
- case BFD_RELOC_390_PLT32:
- return &elf_howto_table[(int) R_390_PLT32];
- case BFD_RELOC_390_COPY:
- return &elf_howto_table[(int) R_390_COPY];
- case BFD_RELOC_390_GLOB_DAT:
- return &elf_howto_table[(int) R_390_GLOB_DAT];
- case BFD_RELOC_390_JMP_SLOT:
- return &elf_howto_table[(int) R_390_JMP_SLOT];
- case BFD_RELOC_390_RELATIVE:
- return &elf_howto_table[(int) R_390_RELATIVE];
- case BFD_RELOC_32_GOTOFF:
- return &elf_howto_table[(int) R_390_GOTOFF32];
- case BFD_RELOC_390_GOTPC:
- return &elf_howto_table[(int) R_390_GOTPC];
- case BFD_RELOC_390_GOT16:
- return &elf_howto_table[(int) R_390_GOT16];
- case BFD_RELOC_16_PCREL:
- return &elf_howto_table[(int) R_390_PC16];
- case BFD_RELOC_390_PC16DBL:
- return &elf_howto_table[(int) R_390_PC16DBL];
- case BFD_RELOC_390_PLT16DBL:
- return &elf_howto_table[(int) R_390_PLT16DBL];
- case BFD_RELOC_390_PC32DBL:
- return &elf_howto_table[(int) R_390_PC32DBL];
- case BFD_RELOC_390_PLT32DBL:
- return &elf_howto_table[(int) R_390_PLT32DBL];
- case BFD_RELOC_390_GOTPCDBL:
- return &elf_howto_table[(int) R_390_GOTPCDBL];
- case BFD_RELOC_390_GOTENT:
- return &elf_howto_table[(int) R_390_GOTENT];
- case BFD_RELOC_16_GOTOFF:
- return &elf_howto_table[(int) R_390_GOTOFF16];
- case BFD_RELOC_390_GOTPLT12:
- return &elf_howto_table[(int) R_390_GOTPLT12];
- case BFD_RELOC_390_GOTPLT16:
- return &elf_howto_table[(int) R_390_GOTPLT16];
- case BFD_RELOC_390_GOTPLT32:
- return &elf_howto_table[(int) R_390_GOTPLT32];
- case BFD_RELOC_390_GOTPLTENT:
- return &elf_howto_table[(int) R_390_GOTPLTENT];
- case BFD_RELOC_390_PLTOFF16:
- return &elf_howto_table[(int) R_390_PLTOFF16];
- case BFD_RELOC_390_PLTOFF32:
- return &elf_howto_table[(int) R_390_PLTOFF32];
- case BFD_RELOC_390_TLS_LOAD:
- return &elf_howto_table[(int) R_390_TLS_LOAD];
- case BFD_RELOC_390_TLS_GDCALL:
- return &elf_howto_table[(int) R_390_TLS_GDCALL];
- case BFD_RELOC_390_TLS_LDCALL:
- return &elf_howto_table[(int) R_390_TLS_LDCALL];
- case BFD_RELOC_390_TLS_GD32:
- return &elf_howto_table[(int) R_390_TLS_GD32];
- case BFD_RELOC_390_TLS_GOTIE12:
- return &elf_howto_table[(int) R_390_TLS_GOTIE12];
- case BFD_RELOC_390_TLS_GOTIE32:
- return &elf_howto_table[(int) R_390_TLS_GOTIE32];
- case BFD_RELOC_390_TLS_LDM32:
- return &elf_howto_table[(int) R_390_TLS_LDM32];
- case BFD_RELOC_390_TLS_IE32:
- return &elf_howto_table[(int) R_390_TLS_IE32];
- case BFD_RELOC_390_TLS_IEENT:
- return &elf_howto_table[(int) R_390_TLS_IEENT];
- case BFD_RELOC_390_TLS_LE32:
- return &elf_howto_table[(int) R_390_TLS_LE32];
- case BFD_RELOC_390_TLS_LDO32:
- return &elf_howto_table[(int) R_390_TLS_LDO32];
- case BFD_RELOC_390_TLS_DTPMOD:
- return &elf_howto_table[(int) R_390_TLS_DTPMOD];
- case BFD_RELOC_390_TLS_DTPOFF:
- return &elf_howto_table[(int) R_390_TLS_DTPOFF];
- case BFD_RELOC_390_TLS_TPOFF:
- return &elf_howto_table[(int) R_390_TLS_TPOFF];
- case BFD_RELOC_390_20:
- return &elf_howto_table[(int) R_390_20];
- case BFD_RELOC_390_GOT20:
- return &elf_howto_table[(int) R_390_GOT20];
- case BFD_RELOC_390_GOTPLT20:
- return &elf_howto_table[(int) R_390_GOTPLT20];
- case BFD_RELOC_390_TLS_GOTIE20:
- return &elf_howto_table[(int) R_390_TLS_GOTIE20];
- case BFD_RELOC_VTABLE_INHERIT:
- return &elf32_s390_vtinherit_howto;
- case BFD_RELOC_VTABLE_ENTRY:
- return &elf32_s390_vtentry_howto;
- default:
- break;
- }
- return 0;
-}
-
-/* We need to use ELF32_R_TYPE so we have our own copy of this function,
- and elf32-s390.c has its own copy. */
-
-static void
-elf_s390_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf_Internal_Rela *dst;
-{
- switch (ELF32_R_TYPE(dst->r_info))
- {
- case R_390_GNU_VTINHERIT:
- cache_ptr->howto = &elf32_s390_vtinherit_howto;
- break;
-
- case R_390_GNU_VTENTRY:
- cache_ptr->howto = &elf32_s390_vtentry_howto;
- break;
-
- 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)];
- }
-}
-
-/* A relocation function which doesn't do anything. */
-static bfd_reloc_status_type
-s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- if (output_bfd)
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
-}
-
-/* Handle the large displacement relocs. */
-static bfd_reloc_status_type
-s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- reloc_howto_type *howto = reloc_entry->howto;
- bfd_vma relocation;
- bfd_vma insn;
-
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != NULL)
- return bfd_reloc_continue;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- relocation = (symbol->value
- + symbol->section->output_section->vma
- + symbol->section->output_offset);
- relocation += reloc_entry->addend;
- if (howto->pc_relative)
- {
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- relocation -= reloc_entry->address;
- }
-
- insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- insn |= (relocation & 0xfff) << 16 | (relocation & 0xff000) >> 4;
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-
- if ((bfd_signed_vma) relocation < - 0x80000
- || (bfd_signed_vma) relocation > 0x7ffff)
- return bfd_reloc_overflow;
- else
- return bfd_reloc_ok;
-}
-
-static bfd_boolean
-elf_s390_is_local_label_name (abfd, name)
- bfd *abfd;
- const char *name;
-{
- if (name[0] == '.' && (name[1] == 'X' || name[1] == 'L'))
- return TRUE;
-
- return _bfd_elf_is_local_label_name (abfd, name);
-}
-
-/* Functions for the 390 ELF linker. */
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-
-/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
- copying dynamic variables from a shared lib into an app's dynbss
- section, and instead use a dynamic relocation to point into the
- shared lib. */
-#define ELIMINATE_COPY_RELOCS 1
-
-/* 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 GOT_ENTRY_SIZE 4
-
-/* The first three entries in a procedure linkage table are reserved,
- and the initial contents are unimportant (we zero them out).
- Subsequent entries look like this. See the SVR4 ABI 386
- supplement to see how this works. */
-
-/* For the s390, simple addr offset can only be 0 - 4096.
- To use the full 2 GB address space, several instructions
- 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!!! */
-
-/* The first 3 words in the GOT are then reserved.
- Word 0 is the address of the dynamic table.
- Word 1 is a pointer to a structure describing the object
- Word 2 is used to point to the loader entry address.
-
- The code for position independent PLT entries looks like this:
-
- r12 holds addr of the current GOT at entry to the PLT
-
- 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
-
- The loader must then find the module where the function is
- and insert the address in the GOT.
-
- Note: 390 can only address +- 64 K relative.
- We check if offset > 65536, then make a relative branch -64xxx
- back to a previous defined branch
-
-PLT1: BASR 1,0 # 2 bytes
- L 1,22(1) # 4 bytes Load offset in GOT in r 1
- L 1,(1,12) # 4 bytes Load address from GOT in r1
- BCR 15,1 # 2 bytes Jump to address
-RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
- L 1,14(1) # 4 bytes Load offset in symol table in r1
- BRC 15,-x # 4 bytes Jump to start of PLT
- .word 0 # 2 bytes filler
- .long ? # 4 bytes offset in GOT
- .long ? # 4 bytes offset into symbol table
-
- This was the general case. There are two additional, optimizes PLT
- definitions. One for GOT offsets < 4096 and one for GOT offsets < 32768.
- First the one for GOT offsets < 4096:
-
-PLT1: L 1,<offset>(12) # 4 bytes Load address from GOT in R1
- BCR 15,1 # 2 bytes Jump to address
- .word 0,0,0 # 6 bytes filler
-RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
- L 1,14(1) # 4 bytes Load offset in symbol table in r1
- BRC 15,-x # 4 bytes Jump to start of PLT
- .word 0,0,0 # 6 bytes filler
- .long ? # 4 bytes offset into symbol table
-
- Second the one for GOT offsets < 32768:
-
-PLT1: LHI 1,<offset> # 4 bytes Load offset in GOT to r1
- L 1,(1,12) # 4 bytes Load address from GOT to r1
- BCR 15,1 # 2 bytes Jump to address
- .word 0 # 2 bytes filler
-RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
- L 1,14(1) # 4 bytes Load offset in symbol table in r1
- BRC 15,-x # 4 bytes Jump to start of PLT
- .word 0,0,0 # 6 bytes filler
- .long ? # 4 bytes offset into symbol table
-
-Total = 32 bytes per PLT entry
-
- The code for static build PLT entries looks like this:
-
-PLT1: BASR 1,0 # 2 bytes
- L 1,22(1) # 4 bytes Load address of GOT entry
- L 1,0(0,1) # 4 bytes Load address from GOT in r1
- BCR 15,1 # 2 bytes Jump to address
-RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
- L 1,14(1) # 4 bytes Load offset in symbol table in r1
- BRC 15,-x # 4 bytes Jump to start of PLT
- .word 0 # 2 bytes filler
- .long ? # 4 bytes address of GOT entry
- .long ? # 4 bytes offset into symbol table */
-
-#define PLT_PIC_ENTRY_WORD0 0x0d105810
-#define PLT_PIC_ENTRY_WORD1 0x10165811
-#define PLT_PIC_ENTRY_WORD2 0xc00007f1
-#define PLT_PIC_ENTRY_WORD3 0x0d105810
-#define PLT_PIC_ENTRY_WORD4 0x100ea7f4
-
-#define PLT_PIC12_ENTRY_WORD0 0x5810c000
-#define PLT_PIC12_ENTRY_WORD1 0x07f10000
-#define PLT_PIC12_ENTRY_WORD2 0x00000000
-#define PLT_PIC12_ENTRY_WORD3 0x0d105810
-#define PLT_PIC12_ENTRY_WORD4 0x100ea7f4
-
-#define PLT_PIC16_ENTRY_WORD0 0xa7180000
-#define PLT_PIC16_ENTRY_WORD1 0x5811c000
-#define PLT_PIC16_ENTRY_WORD2 0x07f10000
-#define PLT_PIC16_ENTRY_WORD3 0x0d105810
-#define PLT_PIC16_ENTRY_WORD4 0x100ea7f4
-
-#define PLT_ENTRY_WORD0 0x0d105810
-#define PLT_ENTRY_WORD1 0x10165810
-#define PLT_ENTRY_WORD2 0x100007f1
-#define PLT_ENTRY_WORD3 0x0d105810
-#define PLT_ENTRY_WORD4 0x100ea7f4
-
-/* The first PLT entry pushes the offset into the symbol table
- from R1 onto the stack at 8(15) and the loader object info
- at 12(15), loads the loader address in R1 and jumps to it. */
-
-/* The first entry in the PLT for PIC code:
-
-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
- L 1,8(12) # Entry address of loader in R1
- BR 1 # Jump to loader
-
- The first entry in the PLT for static code:
-
-PLT0:
- ST 1,28(15) # R1 has offset into symbol table
- BASR 1,0
- L 1,18(0,1) # Get address of GOT
- MVC 24(4,15),4(1) # Move loader ino to stack
- L 1,8(1) # Get address of loader
- BR 1 # Jump to loader
- .word 0 # filler
- .long got # address of GOT */
-
-#define PLT_PIC_FIRST_ENTRY_WORD0 0x5010f01c
-#define PLT_PIC_FIRST_ENTRY_WORD1 0x5810c004
-#define PLT_PIC_FIRST_ENTRY_WORD2 0x5010f018
-#define PLT_PIC_FIRST_ENTRY_WORD3 0x5810c008
-#define PLT_PIC_FIRST_ENTRY_WORD4 0x07f10000
-
-#define PLT_FIRST_ENTRY_WORD0 0x5010f01c
-#define PLT_FIRST_ENTRY_WORD1 0x0d105810
-#define PLT_FIRST_ENTRY_WORD2 0x1012D203
-#define PLT_FIRST_ENTRY_WORD3 0xf0181004
-#define PLT_FIRST_ENTRY_WORD4 0x58101008
-#define PLT_FIRST_ENTRY_WORD5 0x07f10000
-
-/* The s390 linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct elf_s390_dyn_relocs
-{
- struct elf_s390_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
-
-/* s390 ELF linker hash entry. */
-
-struct elf_s390_link_hash_entry
-{
- struct elf_link_hash_entry elf;
-
- /* Track dynamic relocs copied for this symbol. */
- struct elf_s390_dyn_relocs *dyn_relocs;
-
- /* Number of GOTPLT references for a function. */
- bfd_signed_vma gotplt_refcount;
-
-#define GOT_UNKNOWN 0
-#define GOT_NORMAL 1
-#define GOT_TLS_GD 2
-#define GOT_TLS_IE 3
-#define GOT_TLS_IE_NLT 4
- unsigned char tls_type;
-};
-
-#define elf_s390_hash_entry(ent) \
- ((struct elf_s390_link_hash_entry *)(ent))
-
-struct elf_s390_obj_tdata
-{
- struct elf_obj_tdata root;
-
- /* tls_type for each local got entry. */
- char *local_got_tls_type;
-};
-
-#define elf_s390_tdata(abfd) \
- ((struct elf_s390_obj_tdata *) (abfd)->tdata.any)
-
-#define elf_s390_local_got_tls_type(abfd) \
- (elf_s390_tdata (abfd)->local_got_tls_type)
-
-static bfd_boolean
-elf_s390_mkobject (abfd)
- bfd *abfd;
-{
- bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-elf_s390_object_p (abfd)
- bfd *abfd;
-{
- /* Set the right machine number for an s390 elf32 file. */
- return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31);
-}
-
-/* s390 ELF linker hash table. */
-
-struct elf_s390_link_hash_table
-{
- struct elf_link_hash_table elf;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
- asection *sdynbss;
- asection *srelbss;
-
- union {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } tls_ldm_got;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-};
-
-/* Get the s390 ELF linker hash table from a link_info structure. */
-
-#define elf_s390_hash_table(p) \
- ((struct elf_s390_link_hash_table *) ((p)->hash))
-
-/* Create an entry in an s390 ELF linker hash table. */
-
-static struct bfd_hash_entry *
-link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table,
- sizeof (struct elf_s390_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct elf_s390_link_hash_entry *eh;
-
- eh = (struct elf_s390_link_hash_entry *) entry;
- eh->dyn_relocs = NULL;
- eh->gotplt_refcount = 0;
- eh->tls_type = GOT_UNKNOWN;
- }
-
- return entry;
-}
-
-/* Create an s390 ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-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_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- ret->sgot = NULL;
- ret->sgotplt = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->tls_ldm_got.refcount = 0;
- ret->sym_sec.abfd = NULL;
-
- return &ret->elf.root;
-}
-
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf_s390_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- if (!htab->sgot || !htab->sgotplt)
- abort ();
-
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
- if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return FALSE;
- return TRUE;
-}
-
-/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
- .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
- hash table. */
-
-static bfd_boolean
-elf_s390_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
-
- htab = elf_s390_hash_table (info);
- if (!htab->sgot && !create_got_section (dynobj, info))
- return FALSE;
-
- if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
- htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
- htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
- if (!info->shared)
- htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
-
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
- abort ();
-
- return TRUE;
-}
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-elf_s390_copy_indirect_symbol (bed, dir, ind)
- const struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
-{
- struct elf_s390_link_hash_entry *edir, *eind;
-
- edir = (struct elf_s390_link_hash_entry *) dir;
- eind = (struct elf_s390_link_hash_entry *) ind;
-
- if (eind->dyn_relocs != NULL)
- {
- if (edir->dyn_relocs != NULL)
- {
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
-
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
- {
- struct elf_s390_dyn_relocs *q;
-
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
- if (q->sec == p->sec)
- {
- q->pc_count += p->pc_count;
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->dyn_relocs;
- }
-
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
-
- if (ind->root.type == bfd_link_hash_indirect
- && dir->got.refcount <= 0)
- {
- edir->tls_type = eind->tls_type;
- eind->tls_type = GOT_UNKNOWN;
- }
-
- if (ELIMINATE_COPY_RELOCS
- && ind->root.type != bfd_link_hash_indirect
- && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- dir->elf_link_hash_flags |=
- (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_HASH_NEEDS_PLT));
- else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-}
-
-static int
-elf_s390_tls_transition (info, r_type, is_local)
- struct bfd_link_info *info;
- int r_type;
- int is_local;
-{
- if (info->shared)
- return r_type;
-
- switch (r_type)
- {
- case R_390_TLS_GD32:
- case R_390_TLS_IE32:
- if (is_local)
- return R_390_TLS_LE32;
- return R_390_TLS_IE32;
- case R_390_TLS_GOTIE32:
- if (is_local)
- return R_390_TLS_LE32;
- return R_390_TLS_GOTIE32;
- case R_390_TLS_LDM32:
- return R_390_TLS_LE32;
- }
-
- return r_type;
-}
-
-/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table or procedure linkage
- table. */
-
-static bfd_boolean
-elf_s390_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- struct elf_s390_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sreloc;
- bfd_signed_vma *local_got_refcounts;
- int tls_type, old_tls_type;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf_s390_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- sreloc = NULL;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned int r_type;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
- r_symndx);
- return FALSE;
- }
-
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- /* Create got section and local_got_refcounts array if they
- are needed. */
- r_type = elf_s390_tls_transition (info,
- ELF32_R_TYPE (rel->r_info),
- h == NULL);
- switch (r_type)
- {
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOTENT:
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLTENT:
- case R_390_TLS_GD32:
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_GOTIE32:
- case R_390_TLS_IEENT:
- case R_390_TLS_IE32:
- case R_390_TLS_LDM32:
- if (h == NULL
- && local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma) + sizeof(char));
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- elf_s390_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + symtab_hdr->sh_info);
- }
- /* Fall through. */
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- if (htab->sgot == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
- return FALSE;
- }
- }
-
- switch (r_type)
- {
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- /* Got is created, nothing to be done. */
- break;
-
- case R_390_PLT16DBL:
- case R_390_PLT32DBL:
- case R_390_PLT32:
- case R_390_PLTOFF16:
- case R_390_PLTOFF32:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
-
- /* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
- if (h != NULL)
- {
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- }
- break;
-
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLTENT:
- /* This symbol requires either a procedure linkage table entry
- or an entry in the local got. We actually build the entry
- in adjust_dynamic_symbol because whether this is really a
- global reference can change and with it the fact if we have
- to create a plt entry or a local got entry. To be able to
- make a once global symbol a local one we have to keep track
- of the number of gotplt references that exist for this
- symbol. */
- if (h != NULL)
- {
- ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- }
- else
- local_got_refcounts[r_symndx] += 1;
- break;
-
- case R_390_TLS_LDM32:
- htab->tls_ldm_got.refcount += 1;
- break;
-
- case R_390_TLS_IE32:
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_GOTIE32:
- case R_390_TLS_IEENT:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- /* Fall through. */
-
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOTENT:
- case R_390_TLS_GD32:
- /* This symbol requires a global offset table entry. */
- switch (r_type)
- {
- default:
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOTENT:
- tls_type = GOT_NORMAL;
- break;
- case R_390_TLS_GD32:
- tls_type = GOT_TLS_GD;
- break;
- case R_390_TLS_IE32:
- case R_390_TLS_GOTIE32:
- tls_type = GOT_TLS_IE;
- break;
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_IEENT:
- tls_type = GOT_TLS_IE_NLT;
- break;
- }
-
- if (h != NULL)
- {
- h->got.refcount += 1;
- old_tls_type = elf_s390_hash_entry(h)->tls_type;
- }
- else
- {
- local_got_refcounts[r_symndx] += 1;
- old_tls_type = elf_s390_local_got_tls_type (abfd) [r_symndx];
- }
- /* If a TLS symbol is accessed using IE at least once,
- there is no point to use dynamic model for it. */
- if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN)
- {
- if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL)
- {
- (*_bfd_error_handler)
- (_("%s: `%s' accessed both as normal and thread local symbol"),
- bfd_archive_filename (abfd), h->root.root.string);
- return FALSE;
- }
- if (old_tls_type > tls_type)
- tls_type = old_tls_type;
- }
-
- if (old_tls_type != tls_type)
- {
- if (h != NULL)
- elf_s390_hash_entry (h)->tls_type = tls_type;
- else
- elf_s390_local_got_tls_type (abfd) [r_symndx] = tls_type;
- }
-
- if (r_type != R_390_TLS_IE32)
- break;
- /* Fall through. */
-
- case R_390_TLS_LE32:
- if (!info->shared)
- break;
- info->flags |= DF_STATIC_TLS;
- /* Fall through. */
-
- case R_390_8:
- case R_390_16:
- case R_390_32:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32DBL:
- case R_390_PC32:
- if (h != NULL && !info->shared)
- {
- /* If this reloc is in a read-only section, we might
- need a copy reloc. We can't check reliably at this
- stage whether the section is read-only, as input
- sections have not yet been mapped to output sections.
- Tentatively set the flag for now, and correct in
- adjust_dynamic_symbol. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- /* We may need a .plt entry if the function this reloc
- refers to is in a shared lib. */
- h->plt.refcount += 1;
- }
-
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). In case of a weak definition,
- DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
- storing information in the relocs_copied field of the hash
- table entry. A similar situation occurs when creating
- shared libraries and symbol visibility changes render the
- symbol local.
-
- If on the other hand, we are creating an executable, we
- may need to keep relocations for symbols satisfied by a
- dynamic library if we manage to avoid copy relocs for the
- symbol. */
- if ((info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && ((ELF32_R_TYPE (rel->r_info) != R_390_PC16
- && ELF32_R_TYPE (rel->r_info) != R_390_PC16DBL
- && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL
- && ELF32_R_TYPE (rel->r_info) != R_390_PC32)
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- struct elf_s390_dyn_relocs *p;
- struct elf_s390_dyn_relocs **head;
-
- /* We must copy these reloc types into the output file.
- Create a reloc section in dynobj and make room for
- this reloc. */
- if (sreloc == NULL)
- {
- const char *name;
- bfd *dynobj;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- if (strncmp (name, ".rela", 5) != 0
- || strcmp (bfd_get_section_name (abfd, sec),
- name + 5) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
- }
-
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
-
- dynobj = htab->elf.dynobj;
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return FALSE;
- }
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- {
- head = &((struct elf_s390_link_hash_entry *) h)->dyn_relocs;
- }
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
- asection *s;
-
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct elf_s390_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->sec != sec)
- {
- bfd_size_type amt = sizeof *p;
-
- p = ((struct elf_s390_dyn_relocs *)
- bfd_alloc (htab->elf.dynobj, amt));
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
- }
-
- p->count += 1;
- if (ELF32_R_TYPE (rel->r_info) == R_390_PC16
- || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL
- || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL
- || ELF32_R_TYPE (rel->r_info) == R_390_PC32)
- p->pc_count += 1;
- }
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_390_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_390_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return FALSE;
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-elf_s390_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_390_GNU_VTINHERIT:
- case R_390_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h = NULL;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct elf_s390_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- r_type = ELF32_R_TYPE (rel->r_info);
- r_type = elf_s390_tls_transition (info, r_type, h != NULL);
- switch (r_type)
- {
- case R_390_TLS_LDM32:
- if (elf_s390_hash_table (info)->tls_ldm_got.refcount > 0)
- elf_s390_hash_table (info)->tls_ldm_got.refcount -= 1;
- break;
-
- case R_390_TLS_GD32:
- case R_390_TLS_IE32:
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_GOTIE32:
- case R_390_TLS_IEENT:
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- case R_390_GOTENT:
- if (h != NULL)
- {
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- case R_390_8:
- case R_390_12:
- case R_390_16:
- case R_390_20:
- case R_390_32:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32DBL:
- case R_390_PC32:
- if (info->shared)
- break;
- /* Fall through. */
-
- case R_390_PLT16DBL:
- case R_390_PLT32DBL:
- case R_390_PLT32:
- case R_390_PLTOFF16:
- case R_390_PLTOFF32:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
-
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLTENT:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- {
- ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount--;
- h->plt.refcount -= 1;
- }
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
- entry but we found we will not create any. Called when we find we will
- not have any PLT for this symbol, by for example
- elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link,
- or elf_s390_size_dynamic_sections if no dynamic sections will be
- created (we're only linking static objects). */
-
-static void
-elf_s390_adjust_gotplt (h)
- struct elf_s390_link_hash_entry *h;
-{
- if (h->elf.root.type == bfd_link_hash_warning)
- h = (struct elf_s390_link_hash_entry *) h->elf.root.u.i.link;
-
- if (h->gotplt_refcount <= 0)
- return;
-
- /* We simply add the number of gotplt references to the number
- * of got references for this symbol. */
- h->elf.got.refcount += h->gotplt_refcount;
- h->gotplt_refcount = -1;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-elf_s390_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
-{
- struct elf_s390_link_hash_table *htab;
- asection *s;
- unsigned int power_of_two;
-
- /* If this is a function, put it in the procedure linkage table. We
- will fill in the contents of the procedure linkage table later
- (although we could actually do it here). */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- if (h->plt.refcount <= 0
- || (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
- && h->root.type != bfd_link_hash_undefweak
- && h->root.type != bfd_link_hash_undefined))
- {
- /* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
- such a case, we don't actually need to build a procedure
- linkage table, and we can just do a PC32 reloc instead. */
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
- }
-
- return TRUE;
- }
- else
- /* It's possible that we incorrectly decided a .plt reloc was
- needed for an R_390_PC32 reloc to a non-function sym in
- check_relocs. We can't decide accurately between function and
- non-function syms in check-relocs; Objects loaded later in
- the link may change h->type. So fix it now. */
- h->plt.offset = (bfd_vma) -1;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
- h->elf_link_hash_flags
- = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
- | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* If there are no references to this symbol that do not use the
- GOT, we don't need to generate a copy reloc. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
- return TRUE;
-
- /* If -z nocopyreloc was given, we won't generate them either. */
- if (info->nocopyreloc)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
-
- if (ELIMINATE_COPY_RELOCS)
- {
- struct elf_s390_link_hash_entry * eh;
- struct elf_s390_dyn_relocs *p;
-
- eh = (struct elf_s390_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
-
- /* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
- if (p == NULL)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
- }
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
-
- htab = elf_s390_hash_table (info);
-
- /* We must generate a R_390_COPY reloc to tell the dynamic linker to
- copy the initial value out of the dynamic object and into the
- runtime process image. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- htab->srelbss->_raw_size += sizeof (Elf32_External_Rela);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s = htab->sdynbss;
- s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Allocate space in .plt, .got and associated reloc sections for
- dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
-{
- struct bfd_link_info *info;
- struct elf_s390_link_hash_table *htab;
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- info = (struct bfd_link_info *) inf;
- htab = elf_s390_hash_table (info);
-
- if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
- {
- asection *s = htab->splt;
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_FIRST_ENTRY_SIZE;
-
- h->plt.offset = s->_raw_size;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- htab->sgotplt->_raw_size += GOT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
- }
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
- }
-
- /* If R_390_TLS_{IE32,GOTIE32,GOTIE12,IEENT} symbol is now local to
- the binary, we can optimize a bit. IE32 and GOTIE32 get converted
- to R_390_TLS_LE32 requiring no TLS entry. For GOTIE12 and IEENT
- we can save the dynamic TLS relocation. */
- if (h->got.refcount > 0
- && !info->shared
- && h->dynindx == -1
- && elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
- {
- if (elf_s390_hash_entry(h)->tls_type == GOT_TLS_IE_NLT)
- /* For the GOTIE access without a literal pool entry the offset has
- to be stored somewhere. The immediate value in the instruction
- is not bit enough so the value is stored in the got. */
- {
- h->got.offset = htab->sgot->_raw_size;
- htab->sgot->_raw_size += GOT_ENTRY_SIZE;
- }
- else
- h->got.offset = (bfd_vma) -1;
- }
- else if (h->got.refcount > 0)
- {
- asection *s;
- bfd_boolean dyn;
- int tls_type = elf_s390_hash_entry(h)->tls_type;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
- /* R_390_TLS_GD32 needs 2 consecutive GOT slots. */
- if (tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
- dyn = htab->elf.dynamic_sections_created;
- /* R_390_TLS_IE32 needs one dynamic relocation,
- R_390_TLS_GD32 needs one if local symbol and two if global. */
- if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
- || tls_type >= GOT_TLS_IE)
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
- else if (tls_type == GOT_TLS_GD)
- htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela);
- else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- eh = (struct elf_s390_link_hash_entry *) h;
- if (eh->dyn_relocs == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for pc-relative relocs that have become local due to symbol
- visibility changes. */
-
- if (info->shared)
- {
- if (SYMBOL_REFERENCES_LOCAL (info, h))
- {
- struct elf_s390_dyn_relocs **pp;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
- {
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
- else
- pp = &p->next;
- }
- }
-
- /* Also discard relocs on undefined weak syms with non-default
- visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
- }
- else if (ELIMINATE_COPY_RELOCS)
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || (htab->elf.dynamic_sections_created
- && (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->dyn_relocs = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->sec)->sreloc;
-
- sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela);
- }
-
- return TRUE;
-}
-
-/* Find any dynamic relocs that apply to read-only sections. */
-
-static bfd_boolean
-readonly_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
-{
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- eh = (struct elf_s390_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
-
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- {
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
- info->flags |= DF_TEXTREL;
-
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-elf_s390_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
- bfd *dynobj;
- asection *s;
- bfd_boolean relocs;
- bfd *ibfd;
-
- htab = elf_s390_hash_table (info);
- dynobj = htab->elf.dynobj;
- if (dynobj == NULL)
- abort ();
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- if (s == NULL)
- abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
- char *local_tls_type;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srela;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct elf_s390_dyn_relocs *p;
-
- for (p = *((struct elf_s390_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- srela = elf_section_data (p->sec)->sreloc;
- srela->_raw_size += p->count * sizeof (Elf32_External_Rela);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_local_got = local_got + locsymcount;
- local_tls_type = elf_s390_local_got_tls_type (ibfd);
- s = htab->sgot;
- srela = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
- {
- if (*local_got > 0)
- {
- *local_got = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
- if (*local_tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
- if (info->shared)
- srela->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- *local_got = (bfd_vma) -1;
- }
- }
-
- if (htab->tls_ldm_got.refcount > 0)
- {
- /* Allocate 2 got entries and 1 dynamic reloc for R_390_TLS_LDM32
- relocs. */
- htab->tls_ldm_got.offset = htab->sgot->_raw_size;
- htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE;
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- htab->tls_ldm_got.offset = -1;
-
- /* Allocate global sym .plt and .got entries, and space for global
- sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
-
- /* We now have determined the sizes of the various dynamic sections.
- Allocate memory for them. */
- relocs = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- }
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
- {
- if (s->_raw_size != 0)
- relocs = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- else
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is to handle .rela.bss and
- .rela.plt. We must create it in
- create_dynamic_sections, because it must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
-
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. We use bfd_zalloc
- here in case unused entries are not reclaimed before the
- section's contents are written out. This should not happen,
- but this way if it does, we get a R_390_NONE reloc instead
- of garbage. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in elf_s390_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->splt->_raw_size != 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 (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
- return FALSE;
-
- /* If any dynamic relocs apply to a read-only section,
- then we need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
- (PTR) info);
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-/* Return the base VMA address which should be subtracted from real addresses
- when resolving @dtpoff relocation.
- This is PT_TLS segment p_vaddr. */
-
-static bfd_vma
-dtpoff_base (info)
- struct bfd_link_info *info;
-{
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (elf_hash_table (info)->tls_sec == NULL)
- return 0;
- return elf_hash_table (info)->tls_sec->vma;
-}
-
-/* Return the relocation value for @tpoff relocation
- if STT_TLS virtual address is ADDRESS. */
-
-static bfd_vma
-tpoff (info, address)
- struct bfd_link_info *info;
- bfd_vma address;
-{
- struct elf_link_hash_table *htab = elf_hash_table (info);
-
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (htab->tls_sec == NULL)
- return 0;
- return htab->tls_size + htab->tls_sec->vma - address;
-}
-
-/* Complain if TLS instruction relocation is against an invalid
- instruction. */
-
-static void
-invalid_tls_insn (input_bfd, input_section, rel)
- bfd *input_bfd;
- asection *input_section;
- Elf_Internal_Rela *rel;
-{
- reloc_howto_type *howto;
-
- howto = elf_howto_table + ELF32_R_TYPE (rel->r_info);
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- howto->name);
-}
-
-/* Relocate a 390 ELF section. */
-
-static bfd_boolean
-elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- struct elf_s390_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf_s390_hash_table (info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- unsigned int r_type;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sec;
- bfd_vma off;
- bfd_vma relocation;
- bfd_boolean unresolved_reloc;
- bfd_reloc_status_type r;
- int tls_type;
-
- r_type = ELF32_R_TYPE (rel->r_info);
- if (r_type == (int) R_390_GNU_VTINHERIT
- || r_type == (int) R_390_GNU_VTENTRY)
- continue;
- if (r_type >= (int) R_390_max)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- howto = elf_howto_table + r_type;
- r_symndx = ELF32_R_SYM (rel->r_info);
-
- /* This is a final link. */
- h = NULL;
- sym = NULL;
- sec = NULL;
- unresolved_reloc = FALSE;
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- }
- else
- {
- bfd_boolean warned ATTRIBUTE_UNUSED;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
- }
-
- switch (r_type)
- {
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLTENT:
- /* There are three cases for a GOTPLT relocation. 1) The
- relocation is against the jump slot entry of a plt that
- will get emitted to the output file. 2) The relocation
- is against the jump slot of a plt entry that has been
- removed. elf_s390_adjust_gotplt has created a GOT entry
- as replacement. 3) The relocation is against a local symbol.
- Cases 2) and 3) are the same as the GOT relocation code
- so we just have to test for case 1 and fall through for
- the other two. */
- if (h != NULL && h->plt.offset != (bfd_vma) -1)
- {
- bfd_vma plt_index;
-
- /* Calc. index no.
- Current offset - size first entry / entry size. */
- plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
- PLT_ENTRY_SIZE;
-
- /* Offset in GOT is PLT index plus GOT headers(3) times 4,
- addr & GOT addr. */
- relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
- unresolved_reloc = FALSE;
-
- if (r_type == R_390_GOTPLTENT)
- relocation += htab->sgot->output_section->vma;
- break;
- }
- /* Fall through. */
-
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOTENT:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- {
- bfd_boolean dyn;
-
- off = h->got.offset;
- dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- || (ELF_ST_VISIBILITY (h->other)
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally, or the symbol was forced to be local
- because of a version file. We must initialize
- this entry in the global offset table. Since the
- offset must always be a multiple of 2, we use the
- least significant bit to record whether we have
- initialized it already.
-
- When doing a dynamic link, we create a .rel.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
- else
- unresolved_reloc = FALSE;
- }
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
-
- /* The offset must always be a multiple of 4. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
-
- if (info->shared)
- {
- asection *srelgot;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- srelgot = htab->srelgot;
- if (srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
- outrel.r_addend = relocation;
- loc = srelgot->contents;
- loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- }
-
- local_got_offsets[r_symndx] |= 1;
- }
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
-
- relocation = htab->sgot->output_offset + off;
-
- /* For @GOTENT the relocation is against the offset between
- the instruction and the symbols entry in the GOT and not
- between the start of the GOT and the symbols entry. We
- add the vma of the GOT to get the correct value. */
- if ( r_type == R_390_GOTENT
- || r_type == R_390_GOTPLTENT)
- relocation += htab->sgot->output_section->vma;
-
- break;
-
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- /* Relocation is relative to the start of the global offset
- table. */
-
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- defined _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- relocation -= htab->sgot->output_section->vma;
- break;
-
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- /* Use global offset table as symbol value. */
- relocation = htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- break;
-
- case R_390_PLT16DBL:
- case R_390_PLT32DBL:
- case R_390_PLT32:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
-
- if (h->plt.offset == (bfd_vma) -1
- || htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = FALSE;
- break;
-
- case R_390_PLTOFF16:
- case R_390_PLTOFF32:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table relative to the start of the GOT. */
-
- /* For local symbols or if we didn't make a PLT entry for
- this symbol resolve the symbol directly. */
- if ( h == NULL
- || h->plt.offset == (bfd_vma) -1
- || htab->splt == NULL)
- {
- relocation -= htab->sgot->output_section->vma;
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset
- - htab->sgot->output_section->vma);
- unresolved_reloc = FALSE;
- break;
-
- case R_390_8:
- case R_390_16:
- case R_390_32:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32DBL:
- case R_390_PC32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
- break;
-
- if ((info->shared
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && ((r_type != R_390_PC16
- && r_type != R_390_PC16DBL
- && r_type != R_390_PC32DBL
- && r_type != R_390_PC32)
- || (h != NULL
- && !SYMBOL_REFERENCES_LOCAL (info, h))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && h != NULL
- && h->dynindx != -1
- && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- bfd_boolean skip, relocate;
- asection *sreloc;
- bfd_byte *loc;
-
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
-
- skip = FALSE;
- relocate = FALSE;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
- && h->dynindx != -1
- && (r_type == R_390_PC16
- || r_type == R_390_PC16DBL
- || r_type == R_390_PC32DBL
- || r_type == R_390_PC32
- || !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
- outrel.r_addend = rel->r_addend;
- }
- else
- {
- /* This symbol is local, or marked to become local. */
- outrel.r_addend = relocation + rel->r_addend;
- if (r_type == R_390_32)
- {
- relocate = TRUE;
- outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
- }
- else
- {
- long sindx;
-
- if (bfd_is_abs_section (sec))
- sindx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error(bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- asection *osec;
-
- osec = sec->output_section;
- sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
-
- /* We are turning this relocation into one
- against a section symbol, so subtract out
- the output section's address but not the
- offset of the input section in the output
- section. */
-
- outrel.r_addend -= osec->vma;
- }
- outrel.r_info = ELF32_R_INFO (sindx, r_type);
- }
- }
-
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-
- /* If this reloc is against an external symbol, we do
- not want to fiddle with the addend. Otherwise, we
- need to include the symbol value so that it becomes
- an addend for the dynamic reloc. */
- if (! relocate)
- continue;
- }
- break;
-
- /* Relocations for tls literal pool entries. */
- case R_390_TLS_IE32:
- if (info->shared)
- {
- Elf_Internal_Rela outrel;
- asection *sreloc;
- bfd_byte *loc;
-
- outrel.r_offset = rel->r_offset
- + input_section->output_section->vma
- + input_section->output_offset;
- outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- }
- /* Fall through. */
-
- case R_390_TLS_GD32:
- case R_390_TLS_GOTIE32:
- r_type = elf_s390_tls_transition (info, r_type, h == NULL);
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- {
- tls_type = elf_s390_hash_entry(h)->tls_type;
- if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
- r_type = R_390_TLS_LE32;
- }
- if (r_type == R_390_TLS_GD32 && tls_type >= GOT_TLS_IE)
- r_type = R_390_TLS_IE32;
-
- if (r_type == R_390_TLS_LE32)
- {
- /* This relocation gets optimized away by the local exec
- access optimization. */
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd, -tpoff (info, relocation),
- contents + rel->r_offset);
- continue;
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- off = h->got.offset;
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
- }
-
- emit_tls_relocs:
-
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- int dr_type, indx;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- indx = h && h->dynindx != -1 ? h->dynindx : 0;
- if (r_type == R_390_TLS_GD32)
- dr_type = R_390_TLS_DTPMOD;
- else
- dr_type = R_390_TLS_TPOFF;
- if (dr_type == R_390_TLS_TPOFF && indx == 0)
- outrel.r_addend = relocation - dtpoff_base (info);
- else
- outrel.r_addend = 0;
- outrel.r_info = ELF32_R_INFO (indx, dr_type);
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++
- * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-
- if (r_type == R_390_TLS_GD32)
- {
- if (indx == 0)
- {
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd,
- relocation - dtpoff_base (info),
- htab->sgot->contents + off + GOT_ENTRY_SIZE);
- }
- else
- {
- outrel.r_info = ELF32_R_INFO (indx, R_390_TLS_DTPOFF);
- outrel.r_offset += GOT_ENTRY_SIZE;
- outrel.r_addend = 0;
- htab->srelgot->reloc_count++;
- loc += sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- }
- }
-
- if (h != NULL)
- h->got.offset |= 1;
- else
- local_got_offsets[r_symndx] |= 1;
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
- if (r_type == ELF32_R_TYPE (rel->r_info))
- {
- relocation = htab->sgot->output_offset + off;
- if (r_type == R_390_TLS_IE32 || r_type == R_390_TLS_IEENT)
- relocation += htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- }
- else
- {
- bfd_put_32 (output_bfd, htab->sgot->output_offset + off,
- contents + rel->r_offset);
- continue;
- }
- break;
-
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_IEENT:
- if (h == NULL)
- {
- if (local_got_offsets == NULL)
- abort();
- off = local_got_offsets[r_symndx];
- if (info->shared)
- goto emit_tls_relocs;
- }
- else
- {
- off = h->got.offset;
- tls_type = elf_s390_hash_entry(h)->tls_type;
- if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE)
- goto emit_tls_relocs;
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd, -tpoff (info, relocation),
- htab->sgot->contents + off);
- relocation = htab->sgot->output_offset + off;
- if (r_type == R_390_TLS_IEENT)
- relocation += htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- break;
-
- case R_390_TLS_LDM32:
- if (! info->shared)
- /* The literal pool entry this relocation refers to gets ignored
- by the optimized code of the local exec model. Do nothing
- and the value will turn out zero. */
- continue;
-
- if (htab->sgot == NULL)
- abort ();
-
- off = htab->tls_ldm_got.offset;
- if (off & 1)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off + GOT_ENTRY_SIZE);
- outrel.r_info = ELF32_R_INFO (0, R_390_TLS_DTPMOD);
- outrel.r_addend = 0;
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++
- * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- htab->tls_ldm_got.offset |= 1;
- }
- relocation = htab->sgot->output_offset + off;
- unresolved_reloc = FALSE;
- break;
-
- case R_390_TLS_LE32:
- if (info->shared)
- {
- /* Linking a shared library with non-fpic code requires
- a R_390_TLS_TPOFF relocation. */
- Elf_Internal_Rela outrel;
- asection *sreloc;
- bfd_byte *loc;
- int indx;
-
- outrel.r_offset = rel->r_offset
- + input_section->output_section->vma
- + input_section->output_offset;
- if (h != NULL && h->dynindx != -1)
- indx = h->dynindx;
- else
- indx = 0;
- outrel.r_info = ELF32_R_INFO (indx, R_390_TLS_TPOFF);
- if (indx == 0)
- outrel.r_addend = relocation - dtpoff_base (info);
- else
- outrel.r_addend = 0;
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- }
- else
- {
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd, -tpoff (info, relocation),
- contents + rel->r_offset);
- }
- continue;
-
- case R_390_TLS_LDO32:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
- relocation -= dtpoff_base (info);
- else
- /* When converting LDO to LE, we must negate. */
- relocation = -tpoff (info, relocation);
- break;
-
- /* Relocations for tls instructions. */
- case R_390_TLS_LOAD:
- case R_390_TLS_GDCALL:
- case R_390_TLS_LDCALL:
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- tls_type = elf_s390_hash_entry(h)->tls_type;
-
- if (tls_type == GOT_TLS_GD)
- continue;
-
- if (r_type == R_390_TLS_LOAD)
- {
- if (!info->shared && (h == NULL || h->dynindx == -1))
- {
- /* IE->LE transition. Four valid cases:
- l %rx,0(0,%ry) -> lr %rx,%ry + bcr 0,0
- l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0
- l %rx,0(%ry,%r12) -> lr %rx,%ry + bcr 0,0
- l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
- unsigned int insn, ry;
-
- insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- ry = 0;
- if ((insn & 0xff00f000) == 0x58000000)
- /* l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0 */
- ry = (insn & 0x000f0000);
- else if ((insn & 0xff0f0000) == 0x58000000)
- /* l %rx,0(0,%ry) -> lr %rx,%ry + bcr 0,0 */
- ry = (insn & 0x0000f000) << 4;
- else if ((insn & 0xff00f000) == 0x5800c000)
- /* l %rx,0(%ry,%r12) -> lr %rx,%ry + bcr 0,0 */
- ry = (insn & 0x000f0000);
- else if ((insn & 0xff0f0000) == 0x580c0000)
- /* l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
- ry = (insn & 0x0000f000) << 4;
- else
- invalid_tls_insn (input_bfd, input_section, rel);
- insn = 0x18000700 | (insn & 0x00f00000) | ry;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- }
- }
- else if (r_type == R_390_TLS_GDCALL)
- {
- unsigned int insn;
-
- insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((insn & 0xff000fff) != 0x4d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
- if (!info->shared && (h == NULL || h->dynindx == -1))
- /* GD->LE transition.
- bas %r14,0(%rx,%r13) -> bc 0,0 */
- insn = 0x47000000;
- else
- /* GD->IE transition.
- bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */
- insn = 0x5822c000;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- }
- else if (r_type == R_390_TLS_LDCALL)
- {
- if (!info->shared)
- {
- unsigned int insn;
-
- insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((insn & 0xff000fff) != 0x4d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
- /* LD->LE transition.
- bas %r14,0(%rx,%r13) -> bc 0,0 */
- insn = 0x47000000;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- }
- }
- continue;
-
- default:
- break;
- }
-
- /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
- because such sections are not SEC_ALLOC and thus ld.so will
- not process them. */
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- h->root.root.string);
-
- if (r_type == R_390_20
- || r_type == R_390_GOT20
- || r_type == R_390_GOTPLT20
- || r_type == R_390_TLS_GOTIE20)
- {
- relocation += rel->r_addend;
- relocation = (relocation&0xfff) << 8 | (relocation&0xff000) >> 12;
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, 0);
- }
- else
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, rel->r_addend);
-
- if (r != bfd_reloc_ok)
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
-
- if (r == bfd_reloc_overflow)
- {
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): reloc against `%s': error %d"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset, name, (int) r);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- struct elf_s390_link_hash_table *htab;
-
- htab = elf_s390_hash_table (info);
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- bfd_vma plt_index;
- bfd_vma got_offset;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
- bfd_vma relative_offset;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
- if (h->dynindx == -1
- || htab->splt == NULL
- || htab->sgotplt == NULL
- || htab->srelplt == NULL)
- abort ();
-
- /* Calc. index no.
- Current offset - size first entry / entry size. */
- plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
-
- /* Offset in GOT is PLT index plus GOT headers(3) times 4,
- addr & GOT addr. */
- 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);
- /* If offset is > 32768, branch to a previous branch
- 390 can only handle +-64 K jumps. */
- 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, (bfd_vma) PLT_ENTRY_WORD0,
- htab->splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD1,
- htab->splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD2,
- htab->splt->contents + h->plt.offset + 8);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD3,
- htab->splt->contents + h->plt.offset + 12);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD4,
- htab->splt->contents + h->plt.offset + 16);
- bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
- htab->splt->contents + h->plt.offset + 20);
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + got_offset),
- htab->splt->contents + h->plt.offset + 24);
- }
- else if (got_offset < 4096)
- {
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD0 + got_offset,
- htab->splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD1,
- htab->splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD2,
- htab->splt->contents + h->plt.offset + 8);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD3,
- htab->splt->contents + h->plt.offset + 12);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD4,
- htab->splt->contents + h->plt.offset + 16);
- bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
- htab->splt->contents + h->plt.offset + 20);
- bfd_put_32 (output_bfd, (bfd_vma) 0,
- htab->splt->contents + h->plt.offset + 24);
- }
- else if (got_offset < 32768)
- {
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD0 + got_offset,
- htab->splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD1,
- htab->splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD2,
- htab->splt->contents + h->plt.offset + 8);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD3,
- htab->splt->contents + h->plt.offset + 12);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD4,
- htab->splt->contents + h->plt.offset + 16);
- bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
- htab->splt->contents + h->plt.offset + 20);
- bfd_put_32 (output_bfd, (bfd_vma) 0,
- htab->splt->contents + h->plt.offset + 24);
- }
- else
- {
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD0,
- htab->splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD1,
- htab->splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD2,
- htab->splt->contents + h->plt.offset + 8);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD3,
- htab->splt->contents + h->plt.offset + 12);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD4,
- htab->splt->contents + h->plt.offset + 16);
- bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
- htab->splt->contents + h->plt.offset + 20);
- bfd_put_32 (output_bfd, got_offset,
- htab->splt->contents + h->plt.offset + 24);
- }
- /* Insert offset into reloc. table here. */
- bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
- htab->splt->contents + h->plt.offset + 28);
-
- /* Fill in the entry in the global offset table.
- Points to instruction after GOT offset. */
- bfd_put_32 (output_bfd,
- (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset
- + 12),
- htab->sgotplt->contents + got_offset);
-
- /* Fill in the entry in the .rela.plt section. */
- rela.r_offset = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + got_offset);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_390_JMP_SLOT);
- rela.r_addend = 0;
- loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. This is a clue
- for the dynamic linker, to make function pointer
- comparisons work between an application and shared
- library. */
- sym->st_shndx = SHN_UNDEF;
- }
- }
-
- if (h->got.offset != (bfd_vma) -1
- && elf_s390_hash_entry(h)->tls_type != GOT_TLS_GD
- && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE
- && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE_NLT)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the global offset table. Set it
- up. */
-
- if (htab->sgot == NULL || htab->srelgot == NULL)
- abort ();
-
- rela.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + (h->got.offset &~ (bfd_vma) 1));
-
- /* If this is a static link, or it is a -Bsymbolic link and the
- symbol is defined locally or was forced to be local because
- of a version file, we just want to emit a RELATIVE reloc.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
- BFD_ASSERT((h->got.offset & 1) != 0);
- rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else
- {
- BFD_ASSERT((h->got.offset & 1) == 0);
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_390_GLOB_DAT);
- rela.r_addend = 0;
- }
-
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbols needs a copy reloc. Set it up. */
-
- if (h->dynindx == -1
- || (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || htab->srelbss == NULL)
- abort ();
-
- rela.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_390_COPY);
- rela.r_addend = 0;
- loc = htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Used to decide how to sort relocs in an optimal manner for the
- dynamic linker, before writing them out. */
-
-static enum elf_reloc_type_class
-elf_s390_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
-{
- switch ((int) ELF32_R_TYPE (rela->r_info))
- {
- case R_390_RELATIVE:
- return reloc_class_relative;
- case R_390_JMP_SLOT:
- return reloc_class_plt;
- case R_390_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-elf_s390_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
- bfd *dynobj;
- asection *sdyn;
-
- htab = elf_s390_hash_table (info);
- dynobj = htab->elf.dynobj;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (htab->elf.dynamic_sections_created)
- {
- Elf32_External_Dyn *dyncon, *dynconend;
-
- if (sdyn == NULL || htab->sgot == NULL)
- abort ();
-
- dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- asection *s;
-
- bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- continue;
-
- case DT_PLTGOT:
- dyn.d_un.d_ptr = htab->sgot->output_section->vma;
- break;
-
- case DT_JMPREL:
- dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
- break;
-
- case DT_PLTRELSZ:
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
- break;
- }
-
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
-
- /* Fill in the special first entry in the procedure linkage table. */
- if (htab->splt && htab->splt->_raw_size > 0)
- {
- memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
- if (info->shared)
- {
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD0,
- htab->splt->contents );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD1,
- htab->splt->contents +4 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD2,
- htab->splt->contents +8 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD3,
- htab->splt->contents +12 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD4,
- htab->splt->contents +16 );
- }
- else
- {
- bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0,
- htab->splt->contents );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1,
- htab->splt->contents +4 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2,
- htab->splt->contents +8 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3,
- htab->splt->contents +12 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4,
- htab->splt->contents +16 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5,
- htab->splt->contents +20 );
- bfd_put_32 (output_bfd,
- htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset,
- htab->splt->contents + 24);
- }
- elf_section_data (htab->splt->output_section)
- ->this_hdr.sh_entsize = 4;
- }
-
- }
-
- if (htab->sgotplt)
- {
- /* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
- {
- bfd_put_32 (output_bfd,
- (sdyn == NULL ? (bfd_vma) 0
- : sdyn->output_section->vma + sdyn->output_offset),
- htab->sgotplt->contents);
- /* One entry for shared object struct ptr. */
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 4);
- /* One entry for _dl_runtime_resolve. */
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 8);
- }
-
- elf_section_data (htab->sgotplt->output_section)
- ->this_hdr.sh_entsize = 4;
- }
- return TRUE;
-}
-
-static bfd_boolean
-elf_s390_grok_prstatus (abfd, note)
- bfd * abfd;
- Elf_Internal_Note * note;
-{
- int offset;
- unsigned int raw_size;
-
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 224: /* S/390 Linux. */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 72;
- raw_size = 144;
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-#define TARGET_BIG_SYM bfd_elf32_s390_vec
-#define TARGET_BIG_NAME "elf32-s390"
-#define ELF_ARCH bfd_arch_s390
-#define ELF_MACHINE_CODE EM_S390
-#define ELF_MACHINE_ALT1 EM_S390_OLD
-#define ELF_MAXPAGESIZE 0x1000
-
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_want_got_plt 1
-#define elf_backend_plt_readonly 1
-#define elf_backend_want_plt_sym 0
-#define elf_backend_got_header_size 12
-#define elf_backend_rela_normal 1
-
-#define elf_info_to_howto elf_s390_info_to_howto
-
-#define bfd_elf32_bfd_is_local_label_name elf_s390_is_local_label_name
-#define bfd_elf32_bfd_link_hash_table_create elf_s390_link_hash_table_create
-#define bfd_elf32_bfd_reloc_type_lookup elf_s390_reloc_type_lookup
-
-#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
-#define elf_backend_check_relocs elf_s390_check_relocs
-#define elf_backend_copy_indirect_symbol elf_s390_copy_indirect_symbol
-#define elf_backend_create_dynamic_sections elf_s390_create_dynamic_sections
-#define elf_backend_finish_dynamic_sections elf_s390_finish_dynamic_sections
-#define elf_backend_finish_dynamic_symbol elf_s390_finish_dynamic_symbol
-#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook
-#define elf_backend_reloc_type_class elf_s390_reloc_type_class
-#define elf_backend_relocate_section elf_s390_relocate_section
-#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
-#define elf_backend_reloc_type_class elf_s390_reloc_type_class
-#define elf_backend_grok_prstatus elf_s390_grok_prstatus
-
-#define bfd_elf32_mkobject elf_s390_mkobject
-#define elf_backend_object_p elf_s390_object_p
-
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-sparc.c b/contrib/binutils/bfd/elf32-sparc.c
deleted file mode 100644
index 0f94f5f..0000000
--- a/contrib/binutils/bfd/elf32-sparc.c
+++ /dev/null
@@ -1,3479 +0,0 @@
-/* SPARC-specific support for 32-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/sparc.h"
-#include "opcode/sparc.h"
-
-static reloc_howto_type *elf32_sparc_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void elf32_sparc_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static bfd_boolean elf32_sparc_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static bfd_boolean elf32_sparc_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean readonly_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean elf32_sparc_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf32_sparc_new_section_hook
- PARAMS ((bfd *, asection *));
-static bfd_boolean elf32_sparc_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
-static bfd_vma dtpoff_base
- PARAMS ((struct bfd_link_info *));
-static bfd_vma tpoff
- PARAMS ((struct bfd_link_info *, bfd_vma));
-static bfd_boolean elf32_sparc_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static bfd_boolean elf32_sparc_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static bfd_boolean elf32_sparc_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf32_sparc_merge_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static struct bfd_hash_entry *link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *elf32_sparc_link_hash_table_create
- PARAMS ((bfd *));
-static bfd_boolean create_got_section
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf32_sparc_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static void elf32_sparc_copy_indirect_symbol
- PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static int elf32_sparc_tls_transition
- PARAMS ((struct bfd_link_info *, bfd *, int, int));
-
-static bfd_boolean elf32_sparc_mkobject
- PARAMS ((bfd *));
-static bfd_boolean elf32_sparc_object_p
- PARAMS ((bfd *));
-static void elf32_sparc_final_write_processing
- PARAMS ((bfd *, bfd_boolean));
-static enum elf_reloc_type_class elf32_sparc_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static asection * elf32_sparc_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf32_sparc_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-
-/* The relocation "howto" table. */
-
-static bfd_reloc_status_type sparc_elf_notsupported_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type sparc_elf_wdisp16_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type sparc_elf_hix22_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type sparc_elf_lox10_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
-reloc_howto_type _bfd_sparc_elf_howto_table[] =
-{
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_PC10, 0,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_PC22, 10,2,22,TRUE, 0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_WPLT30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WPLT30", FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_GLOB_DAT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_JMP_SLOT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_RELATIVE, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_UA32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_PLT32, 0,0,00,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_HIPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_HIPLT22", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_LOPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_LOPLT10", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PCPLT32, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PCPLT32", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PCPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PCPLT22", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PCPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PCPLT10", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_11, 0,2,11,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_11", FALSE,0,0x000007ff,TRUE),
- /* These are for sparc64 in a 64 bit environment.
- Values need to be here because the table is indexed by reloc number. */
- HOWTO(R_SPARC_64, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_64", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_OLO10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_OLO10", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_HH22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_HH22", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_HM10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_HM10", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_LM22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_LM22", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PC_HH22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PC_HH22", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PC_HM10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PC_HM10", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PC_LM22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PC_LM22", FALSE,0,0x00000000,TRUE),
- /* End sparc64 in 64 bit environment values.
- The following are for sparc64 in a 32 bit environment. */
- HOWTO(R_SPARC_WDISP16, 2,2,16,TRUE, 0,complain_overflow_signed, sparc_elf_wdisp16_reloc,"R_SPARC_WDISP16", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_WDISP19, 2,2,19,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP19", FALSE,0,0x0007ffff,TRUE),
- HOWTO(R_SPARC_UNUSED_42, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_UNUSED_42",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_7, 0,2, 7,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_7", FALSE,0,0x0000007f,TRUE),
- HOWTO(R_SPARC_5, 0,2, 5,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", FALSE,0,0x0000001f,TRUE),
- HOWTO(R_SPARC_6, 0,2, 6,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", FALSE,0,0x0000003f,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_UA64, 0,0, 0,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_UA64", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_UA16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_TLS_GD_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_HI22",FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_TLS_GD_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_LO10",FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_TLS_GD_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_GD_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_CALL",FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_TLS_LDM_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_HI22",FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_TLS_LDM_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_LO10",FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_TLS_LDM_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_LDM_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_CALL",FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_TLS_LDO_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc,"R_SPARC_TLS_LDO_HIX22",FALSE,0,0x003fffff, FALSE),
- HOWTO(R_SPARC_TLS_LDO_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LDO_LOX10",FALSE,0,0x000003ff, FALSE),
- HOWTO(R_SPARC_TLS_LDO_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDO_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_IE_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_HI22",FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_TLS_IE_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LO10",FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_TLS_IE_LD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_IE_LDX,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LDX",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_IE_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_LE_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_TLS_LE_HIX22",FALSE,0,0x003fffff, FALSE),
- HOWTO(R_SPARC_TLS_LE_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LE_LOX10",FALSE,0,0x000003ff, FALSE),
- HOWTO(R_SPARC_TLS_DTPMOD32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD32",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_DTPMOD64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD64",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_TLS_DTPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPOFF64",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE)
-};
-static reloc_howto_type elf32_sparc_vtinherit_howto =
- HOWTO (R_SPARC_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_SPARC_GNU_VTINHERIT", FALSE,0, 0, FALSE);
-static reloc_howto_type elf32_sparc_vtentry_howto =
- HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", FALSE,0,0, FALSE);
-static reloc_howto_type elf32_sparc_rev32_howto =
- HOWTO(R_SPARC_REV32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", FALSE,0,0xffffffff,TRUE);
-
-struct elf_reloc_map {
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
-};
-
-static const struct elf_reloc_map sparc_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_SPARC_NONE, },
- { BFD_RELOC_16, R_SPARC_16, },
- { BFD_RELOC_16_PCREL, R_SPARC_DISP16 },
- { BFD_RELOC_8, R_SPARC_8 },
- { BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
- { BFD_RELOC_CTOR, R_SPARC_32 },
- { BFD_RELOC_32, R_SPARC_32 },
- { BFD_RELOC_32_PCREL, R_SPARC_DISP32 },
- { BFD_RELOC_HI22, R_SPARC_HI22 },
- { BFD_RELOC_LO10, R_SPARC_LO10, },
- { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
- { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 },
- { BFD_RELOC_SPARC22, R_SPARC_22 },
- { BFD_RELOC_SPARC13, R_SPARC_13 },
- { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
- { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 },
- { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 },
- { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 },
- { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 },
- { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 },
- { BFD_RELOC_SPARC_COPY, R_SPARC_COPY },
- { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT },
- { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
- { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
- { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
- { BFD_RELOC_SPARC_UA16, R_SPARC_UA16 },
- { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 },
- { BFD_RELOC_SPARC_UA64, R_SPARC_UA64 },
- { BFD_RELOC_SPARC_10, R_SPARC_10 },
- { BFD_RELOC_SPARC_11, R_SPARC_11 },
- { BFD_RELOC_SPARC_64, R_SPARC_64 },
- { BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 },
- { BFD_RELOC_SPARC_HH22, R_SPARC_HH22 },
- { BFD_RELOC_SPARC_HM10, R_SPARC_HM10 },
- { BFD_RELOC_SPARC_LM22, R_SPARC_LM22 },
- { BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 },
- { BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 },
- { BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 },
- { BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 },
- { BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 },
- { BFD_RELOC_SPARC_7, R_SPARC_7 },
- { BFD_RELOC_SPARC_5, R_SPARC_5 },
- { BFD_RELOC_SPARC_6, R_SPARC_6 },
- { BFD_RELOC_SPARC_TLS_GD_HI22, R_SPARC_TLS_GD_HI22 },
- { BFD_RELOC_SPARC_TLS_GD_LO10, R_SPARC_TLS_GD_LO10 },
- { BFD_RELOC_SPARC_TLS_GD_ADD, R_SPARC_TLS_GD_ADD },
- { BFD_RELOC_SPARC_TLS_GD_CALL, R_SPARC_TLS_GD_CALL },
- { BFD_RELOC_SPARC_TLS_LDM_HI22, R_SPARC_TLS_LDM_HI22 },
- { BFD_RELOC_SPARC_TLS_LDM_LO10, R_SPARC_TLS_LDM_LO10 },
- { BFD_RELOC_SPARC_TLS_LDM_ADD, R_SPARC_TLS_LDM_ADD },
- { BFD_RELOC_SPARC_TLS_LDM_CALL, R_SPARC_TLS_LDM_CALL },
- { BFD_RELOC_SPARC_TLS_LDO_HIX22, R_SPARC_TLS_LDO_HIX22 },
- { BFD_RELOC_SPARC_TLS_LDO_LOX10, R_SPARC_TLS_LDO_LOX10 },
- { BFD_RELOC_SPARC_TLS_LDO_ADD, R_SPARC_TLS_LDO_ADD },
- { BFD_RELOC_SPARC_TLS_IE_HI22, R_SPARC_TLS_IE_HI22 },
- { BFD_RELOC_SPARC_TLS_IE_LO10, R_SPARC_TLS_IE_LO10 },
- { BFD_RELOC_SPARC_TLS_IE_LD, R_SPARC_TLS_IE_LD },
- { BFD_RELOC_SPARC_TLS_IE_LDX, R_SPARC_TLS_IE_LDX },
- { BFD_RELOC_SPARC_TLS_IE_ADD, R_SPARC_TLS_IE_ADD },
- { BFD_RELOC_SPARC_TLS_LE_HIX22, R_SPARC_TLS_LE_HIX22 },
- { BFD_RELOC_SPARC_TLS_LE_LOX10, R_SPARC_TLS_LE_LOX10 },
- { BFD_RELOC_SPARC_TLS_DTPMOD32, R_SPARC_TLS_DTPMOD32 },
- { BFD_RELOC_SPARC_TLS_DTPMOD64, R_SPARC_TLS_DTPMOD64 },
- { BFD_RELOC_SPARC_TLS_DTPOFF32, R_SPARC_TLS_DTPOFF32 },
- { BFD_RELOC_SPARC_TLS_DTPOFF64, R_SPARC_TLS_DTPOFF64 },
- { BFD_RELOC_SPARC_TLS_TPOFF32, R_SPARC_TLS_TPOFF32 },
- { BFD_RELOC_SPARC_TLS_TPOFF64, R_SPARC_TLS_TPOFF64 },
- { BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT },
- { BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY },
- { BFD_RELOC_SPARC_REV32, R_SPARC_REV32 }
-};
-
-static reloc_howto_type *
-elf32_sparc_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- unsigned int i;
-
- switch (code)
- {
- case BFD_RELOC_VTABLE_INHERIT:
- return &elf32_sparc_vtinherit_howto;
-
- case BFD_RELOC_VTABLE_ENTRY:
- return &elf32_sparc_vtentry_howto;
-
- case BFD_RELOC_SPARC_REV32:
- return &elf32_sparc_rev32_howto;
-
- default:
- for (i = 0;
- i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map);
- i++)
- {
- if (sparc_reloc_map[i].bfd_reloc_val == code)
- return (_bfd_sparc_elf_howto_table
- + (int) sparc_reloc_map[i].elf_reloc_val);
- }
- }
- bfd_set_error (bfd_error_bad_value);
- return NULL;
-}
-
-/* We need to use ELF32_R_TYPE so we have our own copy of this function,
- and elf64-sparc.c has its own copy. */
-
-static void
-elf32_sparc_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf_Internal_Rela *dst;
-{
- switch (ELF32_R_TYPE(dst->r_info))
- {
- case R_SPARC_GNU_VTINHERIT:
- cache_ptr->howto = &elf32_sparc_vtinherit_howto;
- break;
-
- case R_SPARC_GNU_VTENTRY:
- cache_ptr->howto = &elf32_sparc_vtentry_howto;
- break;
-
- case R_SPARC_REV32:
- cache_ptr->howto = &elf32_sparc_rev32_howto;
- break;
-
- default:
- BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_SPARC_max_std);
- cache_ptr->howto = &_bfd_sparc_elf_howto_table[ELF32_R_TYPE(dst->r_info)];
- }
-}
-
-/* For unsupported relocs. */
-
-static bfd_reloc_status_type
-sparc_elf_notsupported_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
-{
- return bfd_reloc_notsupported;
-}
-
-/* Handle the WDISP16 reloc. */
-
-static bfd_reloc_status_type
-sparc_elf_wdisp16_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_vma x;
-
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != NULL)
- return bfd_reloc_continue;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- relocation = (symbol->value
- + symbol->section->output_section->vma
- + symbol->section->output_offset);
- relocation += reloc_entry->addend;
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- relocation -= reloc_entry->address;
-
- x = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- x |= ((((relocation >> 2) & 0xc000) << 6)
- | ((relocation >> 2) & 0x3fff));
- bfd_put_32 (abfd, x, (bfd_byte *) data + reloc_entry->address);
-
- if ((bfd_signed_vma) relocation < - 0x40000
- || (bfd_signed_vma) relocation > 0x3ffff)
- return bfd_reloc_overflow;
- else
- return bfd_reloc_ok;
-}
-
-/* Handle the HIX22 reloc. */
-
-static bfd_reloc_status_type
-sparc_elf_hix22_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_vma insn;
-
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != NULL)
- return bfd_reloc_continue;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- relocation = (symbol->value
- + symbol->section->output_section->vma
- + symbol->section->output_offset);
- relocation += reloc_entry->addend;
- insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
-
- insn = (insn &~ (bfd_vma) 0x3fffff) | (((~relocation) >> 10) & 0x3fffff);
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-
- return bfd_reloc_ok;
-}
-
-/* Handle the LOX10 reloc. */
-
-static bfd_reloc_status_type
-sparc_elf_lox10_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_vma insn;
-
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != NULL)
- return bfd_reloc_continue;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- relocation = (symbol->value
- + symbol->section->output_section->vma
- + symbol->section->output_offset);
- relocation += reloc_entry->addend;
- insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
-
- insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff);
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-
- return bfd_reloc_ok;
-}
-
-/* Support for core dump NOTE sections. */
-
-static bfd_boolean
-elf32_sparc_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 260: /* Solaris prpsinfo_t. */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 84, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 100, 80);
- break;
-
- case 336: /* Solaris psinfo_t. */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 88, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 104, 80);
- break;
- }
-
- return TRUE;
-}
-
-
-/* Functions for the SPARC ELF linker. */
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-
-/* The nop opcode we use. */
-
-#define SPARC_NOP 0x01000000
-
-/* The size in bytes of an entry in the procedure linkage table. */
-
-#define PLT_ENTRY_SIZE 12
-
-/* The first four entries in a procedure linkage table are reserved,
- and the initial contents are unimportant (we zero them out).
- Subsequent entries look like this. See the SVR4 ABI SPARC
- supplement to see how this works. */
-
-/* sethi %hi(.-.plt0),%g1. We fill in the address later. */
-#define PLT_ENTRY_WORD0 0x03000000
-/* b,a .plt0. We fill in the offset later. */
-#define PLT_ENTRY_WORD1 0x30800000
-/* nop. */
-#define PLT_ENTRY_WORD2 SPARC_NOP
-
-/* The SPARC linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct elf32_sparc_dyn_relocs
-{
- struct elf32_sparc_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
-
-/* SPARC ELF linker hash entry. */
-
-struct elf32_sparc_link_hash_entry
-{
- struct elf_link_hash_entry elf;
-
- /* Track dynamic relocs copied for this symbol. */
- struct elf32_sparc_dyn_relocs *dyn_relocs;
-
-#define GOT_UNKNOWN 0
-#define GOT_NORMAL 1
-#define GOT_TLS_GD 2
-#define GOT_TLS_IE 3
- unsigned char tls_type;
-};
-
-#define elf32_sparc_hash_entry(ent) ((struct elf32_sparc_link_hash_entry *)(ent))
-
-struct elf32_sparc_obj_tdata
-{
- struct elf_obj_tdata root;
-
- /* tls_type for each local got entry. */
- char *local_got_tls_type;
-
- /* TRUE if TLS GD relocs has been seen for this object. */
- bfd_boolean has_tlsgd;
-};
-
-#define elf32_sparc_tdata(abfd) \
- ((struct elf32_sparc_obj_tdata *) (abfd)->tdata.any)
-
-#define elf32_sparc_local_got_tls_type(abfd) \
- (elf32_sparc_tdata (abfd)->local_got_tls_type)
-
-static bfd_boolean
-elf32_sparc_mkobject (abfd)
- bfd *abfd;
-{
- bfd_size_type amt = sizeof (struct elf32_sparc_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
-}
-
-/* SPARC ELF linker hash table. */
-
-struct elf32_sparc_link_hash_table
-{
- struct elf_link_hash_table elf;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
- asection *sdynbss;
- asection *srelbss;
-
- union {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } tls_ldm_got;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-};
-
-/* Get the SPARC ELF linker hash table from a link_info structure. */
-
-#define elf32_sparc_hash_table(p) \
- ((struct elf32_sparc_link_hash_table *) ((p)->hash))
-
-/* Create an entry in an i386 ELF linker hash table. */
-
-static struct bfd_hash_entry *
-link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table,
- sizeof (struct elf32_sparc_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct elf32_sparc_link_hash_entry *eh;
-
- eh = (struct elf32_sparc_link_hash_entry *) entry;
- eh->dyn_relocs = NULL;
- eh->tls_type = GOT_UNKNOWN;
- }
-
- return entry;
-}
-
-/* Create a SPARC ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-elf32_sparc_link_hash_table_create (abfd)
- bfd *abfd;
-{
- struct elf32_sparc_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf32_sparc_link_hash_table);
-
- ret = (struct elf32_sparc_link_hash_table *) bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- ret->sgot = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->tls_ldm_got.refcount = 0;
- ret->sym_sec.abfd = NULL;
-
- return &ret->elf.root;
-}
-
-/* Create .got and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf32_sparc_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf32_sparc_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- if (!htab->sgot)
- abort ();
-
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
- if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return FALSE;
- return TRUE;
-}
-
-/* Create .plt, .rela.plt, .got, .rela.got, .dynbss, and
- .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
- hash table. */
-
-static bfd_boolean
-elf32_sparc_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf32_sparc_link_hash_table *htab;
-
- htab = elf32_sparc_hash_table (info);
- if (!htab->sgot && !create_got_section (dynobj, info))
- return FALSE;
-
- if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
- htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
- htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
- if (!info->shared)
- htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
-
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
- abort ();
-
- return TRUE;
-}
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-elf32_sparc_copy_indirect_symbol (bed, dir, ind)
- const struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
-{
- struct elf32_sparc_link_hash_entry *edir, *eind;
-
- edir = (struct elf32_sparc_link_hash_entry *) dir;
- eind = (struct elf32_sparc_link_hash_entry *) ind;
-
- if (eind->dyn_relocs != NULL)
- {
- if (edir->dyn_relocs != NULL)
- {
- struct elf32_sparc_dyn_relocs **pp;
- struct elf32_sparc_dyn_relocs *p;
-
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
- {
- struct elf32_sparc_dyn_relocs *q;
-
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
- if (q->sec == p->sec)
- {
- q->pc_count += p->pc_count;
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->dyn_relocs;
- }
-
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
-
- if (ind->root.type == bfd_link_hash_indirect
- && dir->got.refcount <= 0)
- {
- edir->tls_type = eind->tls_type;
- eind->tls_type = GOT_UNKNOWN;
- }
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-}
-
-static int
-elf32_sparc_tls_transition (info, abfd, r_type, is_local)
- struct bfd_link_info *info;
- bfd *abfd;
- int r_type;
- int is_local;
-{
- if (r_type == R_SPARC_TLS_GD_HI22
- && ! elf32_sparc_tdata (abfd)->has_tlsgd)
- r_type = R_SPARC_REV32;
-
- if (info->shared)
- return r_type;
-
- switch (r_type)
- {
- case R_SPARC_TLS_GD_HI22:
- if (is_local)
- return R_SPARC_TLS_LE_HIX22;
- return R_SPARC_TLS_IE_HI22;
- case R_SPARC_TLS_GD_LO10:
- if (is_local)
- return R_SPARC_TLS_LE_LOX10;
- return R_SPARC_TLS_IE_LO10;
- case R_SPARC_TLS_IE_HI22:
- if (is_local)
- return R_SPARC_TLS_LE_HIX22;
- return r_type;
- case R_SPARC_TLS_IE_LO10:
- if (is_local)
- return R_SPARC_TLS_LE_LOX10;
- return r_type;
- case R_SPARC_TLS_LDM_HI22:
- return R_SPARC_TLS_LE_HIX22;
- case R_SPARC_TLS_LDM_LO10:
- return R_SPARC_TLS_LE_LOX10;
- }
-
- return r_type;
-}
-
-/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table or procedure linkage
- table. */
-
-static bfd_boolean
-elf32_sparc_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- struct elf32_sparc_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sreloc;
- bfd_boolean checked_tlsgd = FALSE;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf32_sparc_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_offsets = elf_local_got_offsets (abfd);
-
- sreloc = NULL;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned int r_type;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- r_type = ELF32_R_TYPE (rel->r_info);
-
- if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
- r_symndx);
- return FALSE;
- }
-
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- /* Compatibility with old R_SPARC_REV32 reloc conflicting
- with R_SPARC_TLS_GD_HI22. */
- if (! checked_tlsgd)
- switch (r_type)
- {
- case R_SPARC_TLS_GD_HI22:
- {
- const Elf_Internal_Rela *relt;
-
- for (relt = rel + 1; relt < rel_end; relt++)
- if (ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_LO10
- || ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_ADD
- || ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_CALL)
- break;
- checked_tlsgd = TRUE;
- elf32_sparc_tdata (abfd)->has_tlsgd = relt < rel_end;
- }
- break;
- case R_SPARC_TLS_GD_LO10:
- case R_SPARC_TLS_GD_ADD:
- case R_SPARC_TLS_GD_CALL:
- checked_tlsgd = TRUE;
- elf32_sparc_tdata (abfd)->has_tlsgd = TRUE;
- break;
- }
-
- r_type = elf32_sparc_tls_transition (info, abfd, r_type, h == NULL);
- switch (r_type)
- {
- case R_SPARC_TLS_LDM_HI22:
- case R_SPARC_TLS_LDM_LO10:
- htab->tls_ldm_got.refcount += 1;
- break;
-
- case R_SPARC_TLS_LE_HIX22:
- case R_SPARC_TLS_LE_LOX10:
- if (info->shared)
- goto r_sparc_plt32;
- break;
-
- case R_SPARC_TLS_IE_HI22:
- case R_SPARC_TLS_IE_LO10:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- /* Fall through */
-
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- case R_SPARC_TLS_GD_HI22:
- case R_SPARC_TLS_GD_LO10:
- /* This symbol requires a global offset table entry. */
- {
- int tls_type, old_tls_type;
-
- switch (r_type)
- {
- default:
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- tls_type = GOT_NORMAL;
- break;
- case R_SPARC_TLS_GD_HI22:
- case R_SPARC_TLS_GD_LO10:
- tls_type = GOT_TLS_GD;
- break;
- case R_SPARC_TLS_IE_HI22:
- case R_SPARC_TLS_IE_LO10:
- tls_type = GOT_TLS_IE;
- break;
- }
-
- if (h != NULL)
- {
- h->got.refcount += 1;
- old_tls_type = elf32_sparc_hash_entry(h)->tls_type;
- }
- else
- {
- bfd_signed_vma *local_got_refcounts;
-
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma) + sizeof(char));
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- elf32_sparc_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + symtab_hdr->sh_info);
- }
- local_got_refcounts[r_symndx] += 1;
- old_tls_type = elf32_sparc_local_got_tls_type (abfd) [r_symndx];
- }
-
- /* If a TLS symbol is accessed using IE at least once,
- there is no point to use dynamic model for it. */
- if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
- && (old_tls_type != GOT_TLS_GD
- || tls_type != GOT_TLS_IE))
- {
- if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD)
- tls_type = old_tls_type;
- else
- {
- (*_bfd_error_handler)
- (_("%s: `%s' accessed both as normal and thread local symbol"),
- bfd_archive_filename (abfd),
- h ? h->root.root.string : "<local>");
- return FALSE;
- }
- }
-
- if (old_tls_type != tls_type)
- {
- if (h != NULL)
- elf32_sparc_hash_entry (h)->tls_type = tls_type;
- else
- elf32_sparc_local_got_tls_type (abfd) [r_symndx] = tls_type;
- }
- }
-
- if (htab->sgot == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
- return FALSE;
- }
- break;
-
- case R_SPARC_TLS_GD_CALL:
- case R_SPARC_TLS_LDM_CALL:
- if (info->shared)
- {
- /* These are basically R_SPARC_TLS_WPLT30 relocs against
- __tls_get_addr. */
- struct bfd_link_hash_entry *bh = NULL;
- if (! _bfd_generic_link_add_one_symbol (info, abfd,
- "__tls_get_addr", 0,
- bfd_und_section_ptr, 0,
- NULL, FALSE, FALSE,
- &bh))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- }
- else
- break;
- /* Fall through */
-
- case R_SPARC_PLT32:
- case R_SPARC_WPLT30:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code without
- linking in any dynamic objects, in which case we don't
- need to generate a procedure linkage table after all. */
-
- if (h == NULL)
- {
- /* The Solaris native assembler will generate a WPLT30
- reloc for a local symbol if you assemble a call from
- one section to another when using -K pic. We treat
- it as WDISP30. */
- if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32)
- goto r_sparc_plt32;
- break;
- }
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
-
- if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32)
- goto r_sparc_plt32;
- h->plt.refcount += 1;
- break;
-
- case R_SPARC_PC10:
- case R_SPARC_PC22:
- if (h != NULL)
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- if (h != NULL
- && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* Fall through. */
-
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- case R_SPARC_WDISP30:
- case R_SPARC_WDISP22:
- case R_SPARC_WDISP19:
- case R_SPARC_WDISP16:
- case R_SPARC_8:
- case R_SPARC_16:
- case R_SPARC_32:
- case R_SPARC_HI22:
- case R_SPARC_22:
- case R_SPARC_13:
- case R_SPARC_LO10:
- case R_SPARC_UA16:
- case R_SPARC_UA32:
- if (h != NULL)
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- r_sparc_plt32:
- if (h != NULL && !info->shared)
- {
- /* We may need a .plt entry if the function this reloc
- refers to is in a shared lib. */
- h->plt.refcount += 1;
- }
-
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). In case of a weak definition,
- DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
- storing information in the relocs_copied field of the hash
- table entry. A similar situation occurs when creating
- shared libraries and symbol visibility changes render the
- symbol local.
-
- If on the other hand, we are creating an executable, we
- may need to keep relocations for symbols satisfied by a
- dynamic library if we manage to avoid copy relocs for the
- symbol. */
- if ((info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && (! _bfd_sparc_elf_howto_table[r_type].pc_relative
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- struct elf32_sparc_dyn_relocs *p;
- struct elf32_sparc_dyn_relocs **head;
-
- /* When creating a shared object, we must copy these
- relocs into the output file. We create a reloc
- section in dynobj and make room for the reloc. */
- if (sreloc == NULL)
- {
- const char *name;
- bfd *dynobj;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
- name + 5) == 0);
-
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- dynobj = htab->elf.dynobj;
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return FALSE;
- }
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- head = &((struct elf32_sparc_link_hash_entry *) h)->dyn_relocs;
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
-
- asection *s;
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct elf32_sparc_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->sec != sec)
- {
- bfd_size_type amt = sizeof *p;
- p = ((struct elf32_sparc_dyn_relocs *)
- bfd_alloc (htab->elf.dynobj, amt));
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
- }
-
- p->count += 1;
- if (_bfd_sparc_elf_howto_table[r_type].pc_relative)
- p->pc_count += 1;
- }
-
- break;
-
- case R_SPARC_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- case R_SPARC_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return FALSE;
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-static asection *
-elf32_sparc_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_SPARC_GNU_VTINHERIT:
- case R_SPARC_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-static bfd_boolean
-elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h = NULL;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf32_sparc_link_hash_entry *eh;
- struct elf32_sparc_dyn_relocs **pp;
- struct elf32_sparc_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct elf32_sparc_link_hash_entry *) h;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- r_type = ELF32_R_TYPE (rel->r_info);
- r_type = elf32_sparc_tls_transition (info, abfd, r_type, h != NULL);
- switch (r_type)
- {
- case R_SPARC_TLS_LDM_HI22:
- case R_SPARC_TLS_LDM_LO10:
- if (elf32_sparc_hash_table (info)->tls_ldm_got.refcount > 0)
- elf32_sparc_hash_table (info)->tls_ldm_got.refcount -= 1;
- break;
-
- case R_SPARC_TLS_GD_HI22:
- case R_SPARC_TLS_GD_LO10:
- case R_SPARC_TLS_IE_HI22:
- case R_SPARC_TLS_IE_LO10:
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- if (h != NULL)
- {
- if (h->got.refcount > 0)
- h->got.refcount--;
- }
- else
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx]--;
- }
- break;
-
- case R_SPARC_PC10:
- case R_SPARC_PC22:
- if (h != NULL
- && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* Fall through. */
-
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- case R_SPARC_WDISP30:
- case R_SPARC_WDISP22:
- case R_SPARC_WDISP19:
- case R_SPARC_WDISP16:
- case R_SPARC_8:
- case R_SPARC_16:
- case R_SPARC_32:
- case R_SPARC_HI22:
- case R_SPARC_22:
- case R_SPARC_13:
- case R_SPARC_LO10:
- case R_SPARC_UA16:
- case R_SPARC_UA32:
- case R_SPARC_PLT32:
- if (info->shared)
- break;
- /* Fall through. */
-
- case R_SPARC_WPLT30:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-elf32_sparc_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
-{
- struct elf32_sparc_link_hash_table *htab;
- struct elf32_sparc_link_hash_entry * eh;
- struct elf32_sparc_dyn_relocs *p;
- asection *s;
- unsigned int power_of_two;
-
- htab = elf32_sparc_hash_table (info);
-
- /* Make sure we know what is going on here. */
- BFD_ASSERT (htab->elf.dynobj != NULL
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
- || h->weakdef != NULL
- || ((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)));
-
- /* If this is a function, put it in the procedure linkage table. We
- will fill in the contents of the procedure linkage table later
- (although we could actually do it here). The STT_NOTYPE
- condition is a hack specifically for the Oracle libraries
- delivered for Solaris; for some inexplicable reason, they define
- some of their functions as STT_NOTYPE when they really should be
- STT_FUNC. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
- || (h->type == STT_NOTYPE
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->root.u.def.section->flags & SEC_CODE) != 0))
- {
- if (h->plt.refcount <= 0
- || (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
- && h->root.type != bfd_link_hash_undefweak
- && h->root.type != bfd_link_hash_undefined))
- {
- /* This case can occur if we saw a WPLT30 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
- such a case, we don't actually need to build a procedure
- linkage table, and we can just do a WDISP30 reloc instead. */
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- return TRUE;
- }
- else
- h->plt.offset = (bfd_vma) -1;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* If there are no references to this symbol that do not use the
- GOT, we don't need to generate a copy reloc. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
- return TRUE;
-
- eh = (struct elf32_sparc_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
-
- /* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
- if (p == NULL)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
-
- /* We must generate a R_SPARC_COPY reloc to tell the dynamic linker
- to copy the initial value out of the dynamic object and into the
- runtime process image. We need to remember the offset into the
- .rel.bss section we are going to use. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- htab->srelbss->_raw_size += sizeof (Elf32_External_Rela);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s = htab->sdynbss;
- s->_raw_size = BFD_ALIGN (s->_raw_size,
- (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Allocate space in .plt, .got and associated reloc sections for
- dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
-{
- struct bfd_link_info *info;
- struct elf32_sparc_link_hash_table *htab;
- struct elf32_sparc_link_hash_entry *eh;
- struct elf32_sparc_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- info = (struct bfd_link_info *) inf;
- htab = elf32_sparc_hash_table (info);
-
- if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
- {
- asection *s = htab->splt;
-
- /* The first four entries in .plt are reserved. */
- if (s->_raw_size == 0)
- s->_raw_size = 4 * PLT_ENTRY_SIZE;
-
- /* The procedure linkage table has a maximum size. */
- if (s->_raw_size >= 0x400000)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- h->plt.offset = s->_raw_size;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
- make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry. */
- if (h->got.refcount > 0
- && !info->shared
- && h->dynindx == -1
- && elf32_sparc_hash_entry(h)->tls_type == GOT_TLS_IE)
- h->got.offset = (bfd_vma) -1;
- else if (h->got.refcount > 0)
- {
- asection *s;
- bfd_boolean dyn;
- int tls_type = elf32_sparc_hash_entry(h)->tls_type;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += 4;
- /* R_SPARC_TLS_GD_HI{22,LO10} needs 2 consecutive GOT slots. */
- if (tls_type == GOT_TLS_GD)
- s->_raw_size += 4;
- dyn = htab->elf.dynamic_sections_created;
- /* R_SPARC_TLS_IE_{HI22,LO10} needs one dynamic relocation,
- R_SPARC_TLS_GD_{HI22,LO10} needs one if local symbol and two if
- global. */
- if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
- || tls_type == GOT_TLS_IE)
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
- else if (tls_type == GOT_TLS_GD)
- htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela);
- else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- eh = (struct elf32_sparc_link_hash_entry *) h;
- if (eh->dyn_relocs == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for pc-relative relocs that have become local due to symbol
- visibility changes. */
-
- if (info->shared)
- {
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
- || info->symbolic))
- {
- struct elf32_sparc_dyn_relocs **pp;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
- {
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
- else
- pp = &p->next;
- }
- }
- }
- else
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || (htab->elf.dynamic_sections_created
- && (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->dyn_relocs = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela);
- }
-
- return TRUE;
-}
-
-/* Find any dynamic relocs that apply to read-only sections. */
-
-static bfd_boolean
-readonly_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
-{
- struct elf32_sparc_link_hash_entry *eh;
- struct elf32_sparc_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- eh = (struct elf32_sparc_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
-
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- {
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
- info->flags |= DF_TEXTREL;
-
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-elf32_sparc_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- struct elf32_sparc_link_hash_table *htab;
- bfd *dynobj;
- asection *s;
- bfd *ibfd;
-
- htab = elf32_sparc_hash_table (info);
- dynobj = htab->elf.dynobj;
- BFD_ASSERT (dynobj != NULL);
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
- char *local_tls_type;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srel;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct elf32_sparc_dyn_relocs *p;
-
- for (p = *((struct elf32_sparc_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- srel = elf_section_data (p->sec)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf32_External_Rela);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_local_got = local_got + locsymcount;
- local_tls_type = elf32_sparc_local_got_tls_type (ibfd);
- s = htab->sgot;
- srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
- {
- if (*local_got > 0)
- {
- *local_got = s->_raw_size;
- s->_raw_size += 4;
- if (*local_tls_type == GOT_TLS_GD)
- s->_raw_size += 4;
- if (info->shared
- || *local_tls_type == GOT_TLS_GD
- || *local_tls_type == GOT_TLS_IE)
- srel->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- *local_got = (bfd_vma) -1;
- }
- }
-
- if (htab->tls_ldm_got.refcount > 0)
- {
- /* Allocate 2 got entries and 1 dynamic reloc for
- R_SPARC_TLS_LDM_{HI22,LO10} relocs. */
- htab->tls_ldm_got.offset = htab->sgot->_raw_size;
- htab->sgot->_raw_size += 8;
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
- htab->tls_ldm_got.offset = -1;
-
- /* Allocate global sym .plt and .got entries, and space for global
- sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Make space for the trailing nop in .plt. */
- if (htab->splt->_raw_size > 0)
- htab->splt->_raw_size += 4;
-
- /* If the .got section is more than 0x1000 bytes, we add
- 0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13
- bit relocations have a greater chance of working. */
- if (htab->sgot->_raw_size >= 0x1000
- && elf_hash_table (info)->hgot->root.u.def.value == 0)
- elf_hash_table (info)->hgot->root.u.def.value = 0x1000;
- }
-
- /* The check_relocs and adjust_dynamic_symbol entry points have
- determined the sizes of the various dynamic sections. Allocate
- memory for them. */
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- const char *name;
- bfd_boolean strip = FALSE;
-
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
-
- if (strncmp (name, ".rela", 5) == 0)
- {
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is to handle .rela.bss and
- .rel.plt. We must create it in
- create_dynamic_sections, because it must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
- strip = TRUE;
- }
- else
- {
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- }
- else if (s != htab->splt && s != htab->sgot)
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (strip)
- {
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. */
- /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
- Unused entries should be reclaimed before the section's contents
- are written out, but at the moment this does not happen. Thus in
- order to prevent writing out garbage, we initialise the section's
- contents to zero. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return FALSE;
- }
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in elf32_sparc_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->srelplt->_raw_size != 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 (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
- return FALSE;
-
- /* If any dynamic relocs apply to a read-only section,
- then we need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
- (PTR) info);
-
- if (info->flags & DF_TEXTREL)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-struct elf32_sparc_section_data
-{
- struct bfd_elf_section_data elf;
- unsigned int do_relax;
-};
-
-#define sec_do_relax(sec) \
- ((struct elf32_sparc_section_data *) elf_section_data (sec))->do_relax
-
-static bfd_boolean
-elf32_sparc_new_section_hook (abfd, sec)
- bfd *abfd;
- asection *sec;
-{
- struct elf32_sparc_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
-
- sdata = (struct elf32_sparc_section_data *) bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = (PTR) sdata;
-
- return _bfd_elf_new_section_hook (abfd, sec);
-}
-
-static bfd_boolean
-elf32_sparc_relax_section (abfd, section, link_info, again)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- bfd_boolean *again;
-{
- *again = FALSE;
- sec_do_relax (section) = 1;
- return TRUE;
-}
-
-/* Return the base VMA address which should be subtracted from real addresses
- when resolving @dtpoff relocation.
- This is PT_TLS segment p_vaddr. */
-
-static bfd_vma
-dtpoff_base (info)
- struct bfd_link_info *info;
-{
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (elf_hash_table (info)->tls_sec == NULL)
- return 0;
- return elf_hash_table (info)->tls_sec->vma;
-}
-
-/* Return the relocation value for @tpoff relocation
- if STT_TLS virtual address is ADDRESS. */
-
-static bfd_vma
-tpoff (info, address)
- struct bfd_link_info *info;
- bfd_vma address;
-{
- struct elf_link_hash_table *htab = elf_hash_table (info);
-
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (htab->tls_sec == NULL)
- return 0;
- return address - htab->tls_size - htab->tls_sec->vma;
-}
-
-/* Relocate a SPARC ELF section. */
-
-static bfd_boolean
-elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- struct elf32_sparc_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- bfd_vma got_base;
- asection *sreloc;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf32_sparc_hash_table (info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
-
- if (elf_hash_table (info)->hgot == NULL)
- got_base = 0;
- else
- got_base = elf_hash_table (info)->hgot->root.u.def.value;
-
- sreloc = elf_section_data (input_section)->sreloc;
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- int r_type, tls_type;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sec;
- bfd_vma relocation, off;
- bfd_reloc_status_type r;
- bfd_boolean is_plt = FALSE;
- bfd_boolean unresolved_reloc;
-
- r_type = ELF32_R_TYPE (rel->r_info);
-
- if (r_type == R_SPARC_GNU_VTINHERIT
- || r_type == R_SPARC_GNU_VTENTRY)
- continue;
-
- if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- howto = _bfd_sparc_elf_howto_table + r_type;
-
- /* This is a final link. */
- r_symndx = ELF32_R_SYM (rel->r_info);
- h = NULL;
- sym = NULL;
- sec = NULL;
- unresolved_reloc = FALSE;
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- }
- else
- {
- bfd_boolean warned ATTRIBUTE_UNUSED;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
- }
-
- switch (r_type)
- {
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- {
- bfd_boolean dyn;
-
- off = h->got.offset;
- BFD_ASSERT (off != (bfd_vma) -1);
- dyn = elf_hash_table (info)->dynamic_sections_created;
-
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally, or the symbol was forced to be local
- because of a version file. We must initialize
- this entry in the global offset table. Since the
- offset must always be a multiple of 4, we use the
- least significant bit to record whether we have
- initialized it already.
-
- When doing a dynamic link, we create a .rela.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
- else
- unresolved_reloc = FALSE;
- }
- else
- {
- BFD_ASSERT (local_got_offsets != NULL
- && local_got_offsets[r_symndx] != (bfd_vma) -1);
-
- off = local_got_offsets[r_symndx];
-
- /* The offset must always be a multiple of 4. We use
- the least significant bit to record whether we have
- already processed this entry. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
-
- if (info->shared)
- {
- asection *s;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- /* We need to generate a R_SPARC_RELATIVE reloc
- for the dynamic linker. */
- s = htab->srelgot;
- BFD_ASSERT (s != NULL);
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
- outrel.r_addend = relocation;
- relocation = 0;
- loc = s->contents;
- loc += s->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- }
-
- bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
- local_got_offsets[r_symndx] |= 1;
- }
- }
- relocation = htab->sgot->output_offset + off - got_base;
- break;
-
- case R_SPARC_PLT32:
- if (h == NULL || h->plt.offset == (bfd_vma) -1)
- {
- r_type = R_SPARC_32;
- goto r_sparc_plt32;
- }
- /* Fall through. */
- case R_SPARC_WPLT30:
- r_sparc_wplt30:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* The Solaris native assembler will generate a WPLT30 reloc
- for a local symbol if you assemble a call from one
- section to another when using -K pic. We treat it as
- WDISP30. */
- if (h == NULL)
- break;
-
- if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = FALSE;
- if (r_type == R_SPARC_PLT32)
- {
- r_type = R_SPARC_32;
- is_plt = TRUE;
- goto r_sparc_plt32;
- }
- break;
-
- case R_SPARC_PC10:
- case R_SPARC_PC22:
- if (h != NULL
- && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* Fall through. */
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- case R_SPARC_WDISP30:
- case R_SPARC_WDISP22:
- case R_SPARC_WDISP19:
- case R_SPARC_WDISP16:
- case R_SPARC_8:
- case R_SPARC_16:
- case R_SPARC_32:
- case R_SPARC_HI22:
- case R_SPARC_22:
- case R_SPARC_13:
- case R_SPARC_LO10:
- case R_SPARC_UA16:
- case R_SPARC_UA32:
- r_sparc_plt32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
- break;
-
- if ((info->shared
- && (! howto->pc_relative
- || (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
- && h != NULL
- && h->dynindx != -1
- && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- bfd_boolean skip, relocate = FALSE;
-
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
-
- BFD_ASSERT (sreloc != NULL);
-
- skip = FALSE;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- /* Optimize unaligned reloc usage now that we know where
- it finally resides. */
- switch (r_type)
- {
- case R_SPARC_16:
- if (outrel.r_offset & 1)
- r_type = R_SPARC_UA16;
- break;
- case R_SPARC_UA16:
- if (!(outrel.r_offset & 1))
- r_type = R_SPARC_16;
- break;
- case R_SPARC_32:
- if (outrel.r_offset & 3)
- r_type = R_SPARC_UA32;
- break;
- case R_SPARC_UA32:
- if (!(outrel.r_offset & 3))
- r_type = R_SPARC_32;
- break;
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- /* If the symbol is not dynamic, we should not keep
- a dynamic relocation. But an .rela.* slot has been
- allocated for it, output R_SPARC_NONE.
- FIXME: Add code tracking needed dynamic relocs as
- e.g. i386 has. */
- if (h->dynindx == -1)
- skip = TRUE, relocate = TRUE;
- break;
- }
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- /* h->dynindx may be -1 if the symbol was marked to
- become local. */
- else if (h != NULL && ! is_plt
- && ((! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- BFD_ASSERT (h->dynindx != -1);
- outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
- outrel.r_addend = rel->r_addend;
- }
- else
- {
- if (r_type == R_SPARC_32)
- {
- outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
- }
- else
- {
- long indx;
-
- if (is_plt)
- sec = htab->splt;
-
- if (bfd_is_abs_section (sec))
- indx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- asection *osec;
-
- osec = sec->output_section;
- indx = elf_section_data (osec)->dynindx;
-
- /* FIXME: we really should be able to link non-pic
- shared libraries. */
- if (indx == 0)
- {
- BFD_FAIL ();
- (*_bfd_error_handler)
- (_("%s: probably compiled without -fPIC?"),
- bfd_archive_filename (input_bfd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
-
- outrel.r_info = ELF32_R_INFO (indx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
- }
- }
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-
- /* This reloc will be computed at runtime, so there's no
- need to do anything now. */
- if (! relocate)
- continue;
- }
- break;
-
- case R_SPARC_TLS_GD_HI22:
- if (! elf32_sparc_tdata (input_bfd)->has_tlsgd)
- {
- /* R_SPARC_REV32 used the same reloc number as
- R_SPARC_TLS_GD_HI22. */
- r_type = R_SPARC_REV32;
- break;
- }
- /* Fall through */
-
- case R_SPARC_TLS_GD_LO10:
- case R_SPARC_TLS_IE_HI22:
- case R_SPARC_TLS_IE_LO10:
- r_type = elf32_sparc_tls_transition (info, input_bfd, r_type,
- h == NULL);
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf32_sparc_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- {
- tls_type = elf32_sparc_hash_entry(h)->tls_type;
- if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_SPARC_TLS_GD_HI22:
- case R_SPARC_TLS_IE_HI22:
- r_type = R_SPARC_TLS_LE_HIX22;
- break;
- default:
- r_type = R_SPARC_TLS_LE_LOX10;
- break;
- }
- }
- if (tls_type == GOT_TLS_IE)
- switch (r_type)
- {
- case R_SPARC_TLS_GD_HI22:
- r_type = R_SPARC_TLS_IE_HI22;
- break;
- case R_SPARC_TLS_GD_LO10:
- r_type = R_SPARC_TLS_IE_LO10;
- break;
- }
-
- if (r_type == R_SPARC_TLS_LE_HIX22)
- {
- relocation = tpoff (info, relocation);
- break;
- }
- if (r_type == R_SPARC_TLS_LE_LOX10)
- {
- /* Change add into xor. */
- relocation = tpoff (info, relocation);
- bfd_put_32 (output_bfd, (bfd_get_32 (input_bfd,
- contents + rel->r_offset)
- | 0x80182000), contents + rel->r_offset);
- break;
- }
-
- if (h != NULL)
- {
- off = h->got.offset;
- h->got.offset |= 1;
- }
- else
- {
- BFD_ASSERT (local_got_offsets != NULL);
- off = local_got_offsets[r_symndx];
- local_got_offsets[r_symndx] |= 1;
- }
-
- r_sparc_tlsldm:
- if (htab->sgot == NULL)
- abort ();
-
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
- int dr_type, indx;
-
- if (htab->srelgot == NULL)
- abort ();
-
- bfd_put_32 (output_bfd, 0, htab->sgot->contents + off);
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
- indx = h && h->dynindx != -1 ? h->dynindx : 0;
- if (r_type == R_SPARC_TLS_IE_HI22
- || r_type == R_SPARC_TLS_IE_LO10)
- dr_type = R_SPARC_TLS_TPOFF32;
- else
- dr_type = R_SPARC_TLS_DTPMOD32;
- if (dr_type == R_SPARC_TLS_TPOFF32 && indx == 0)
- outrel.r_addend = relocation - dtpoff_base (info);
- else
- outrel.r_addend = 0;
- outrel.r_info = ELF32_R_INFO (indx, dr_type);
- loc = (Elf32_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (bfd_byte *) loc);
-
- if (r_type == R_SPARC_TLS_GD_HI22
- || r_type == R_SPARC_TLS_GD_LO10)
- {
- if (indx == 0)
- {
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_32 (output_bfd,
- relocation - dtpoff_base (info),
- htab->sgot->contents + off + 4);
- }
- else
- {
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off + 4);
- outrel.r_info = ELF32_R_INFO (indx,
- R_SPARC_TLS_DTPOFF32);
- outrel.r_offset += 4;
- htab->srelgot->reloc_count++;
- loc++;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (bfd_byte *) loc);
- }
- }
- else if (dr_type == R_SPARC_TLS_DTPMOD32)
- {
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off + 4);
- }
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
-
- relocation = htab->sgot->output_offset + off - got_base;
- unresolved_reloc = FALSE;
- howto = _bfd_sparc_elf_howto_table + r_type;
- break;
-
- case R_SPARC_TLS_LDM_HI22:
- case R_SPARC_TLS_LDM_LO10:
- if (! info->shared)
- {
- bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
- continue;
- }
- off = htab->tls_ldm_got.offset;
- htab->tls_ldm_got.offset |= 1;
- goto r_sparc_tlsldm;
-
- case R_SPARC_TLS_LDO_HIX22:
- case R_SPARC_TLS_LDO_LOX10:
- if (info->shared)
- relocation -= dtpoff_base (info);
- else
- relocation = tpoff (info, relocation);
- break;
-
- case R_SPARC_TLS_LE_HIX22:
- case R_SPARC_TLS_LE_LOX10:
- if (info->shared)
- {
- Elf_Internal_Rela outrel;
- bfd_boolean skip, relocate = FALSE;
-
- BFD_ASSERT (sreloc != NULL);
- skip = FALSE;
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- else
- {
- outrel.r_info = ELF32_R_INFO (0, r_type);
- outrel.r_addend = relocation - dtpoff_base (info)
- + rel->r_addend;
- }
-
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (bfd_byte *) (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
- continue;
- }
- relocation = tpoff (info, relocation);
- break;
-
- case R_SPARC_TLS_LDM_CALL:
- if (! info->shared)
- {
- /* mov %g0, %o0 */
- bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset);
- continue;
- }
- /* Fall through */
-
- case R_SPARC_TLS_GD_CALL:
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf32_sparc_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- tls_type = elf32_sparc_hash_entry(h)->tls_type;
- if (! info->shared
- || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE))
- {
- bfd_vma insn;
-
- if (!info->shared && (h == NULL || h->dynindx == -1))
- {
- /* GD -> LE */
- bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
- continue;
- }
-
- /* GD -> IE */
- if (rel + 1 < relend
- && ELF32_R_TYPE (rel[1].r_info) == R_SPARC_TLS_GD_ADD
- && rel[1].r_offset == rel->r_offset + 4
- && ELF32_R_SYM (rel[1].r_info) == r_symndx
- && (((insn = bfd_get_32 (input_bfd,
- contents + rel[1].r_offset))
- >> 25) & 0x1f) == 8)
- {
- /* We have
- call __tls_get_addr, %tgd_call(foo)
- add %reg1, %reg2, %o0, %tgd_add(foo)
- and change it into IE:
- ld [%reg1 + %reg2], %o0, %tie_ld(foo)
- add %g7, %o0, %o0, %tie_add(foo).
- add is 0x80000000 | (rd << 25) | (rs1 << 14) | rs2,
- ld is 0xc0000000 | (rd << 25) | (rs1 << 14) | rs2. */
- bfd_put_32 (output_bfd, insn | 0xc0000000,
- contents + rel->r_offset);
- bfd_put_32 (output_bfd, 0x9001c008,
- contents + rel->r_offset + 4);
- rel++;
- continue;
- }
-
- bfd_put_32 (output_bfd, 0x9001c008, contents + rel->r_offset);
- continue;
- }
-
- h = (struct elf_link_hash_entry *)
- bfd_link_hash_lookup (info->hash, "__tls_get_addr", FALSE,
- FALSE, TRUE);
- BFD_ASSERT (h != NULL);
- r_type = R_SPARC_WPLT30;
- howto = _bfd_sparc_elf_howto_table + r_type;
- goto r_sparc_wplt30;
-
- case R_SPARC_TLS_GD_ADD:
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf32_sparc_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- tls_type = elf32_sparc_hash_entry(h)->tls_type;
- if (! info->shared || tls_type == GOT_TLS_IE)
- {
- /* add %reg1, %reg2, %reg3, %tgd_add(foo)
- changed into IE:
- ld [%reg1 + %reg2], %reg3, %tie_ld(foo)
- or LE:
- add %g7, %reg2, %reg3. */
- bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((h != NULL && h->dynindx != -1) || info->shared)
- relocation = insn | 0xc0000000;
- else
- relocation = (insn & ~0x7c000) | 0x1c000;
- bfd_put_32 (output_bfd, relocation, contents + rel->r_offset);
- }
- continue;
-
- case R_SPARC_TLS_LDM_ADD:
- if (! info->shared)
- bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
- continue;
-
- case R_SPARC_TLS_LDO_ADD:
- if (! info->shared)
- {
- /* Change rs1 into %g7. */
- bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- insn = (insn & ~0x7c000) | 0x1c000;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- }
- continue;
-
- case R_SPARC_TLS_IE_LD:
- case R_SPARC_TLS_IE_LDX:
- if (! info->shared && (h == NULL || h->dynindx == -1))
- {
- bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- int rs2 = insn & 0x1f;
- int rd = (insn >> 25) & 0x1f;
-
- if (rs2 == rd)
- relocation = SPARC_NOP;
- else
- relocation = 0x80100000 | (insn & 0x3e00001f);
- bfd_put_32 (output_bfd, relocation, contents + rel->r_offset);
- }
- continue;
-
- case R_SPARC_TLS_IE_ADD:
- /* Totally useless relocation. */
- continue;
-
- case R_SPARC_TLS_DTPOFF32:
- relocation -= dtpoff_base (info);
- break;
-
- default:
- break;
- }
-
- /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
- because such sections are not SEC_ALLOC and thus ld.so will
- not process them. */
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- h->root.root.string);
-
- r = bfd_reloc_continue;
- if (r_type == R_SPARC_WDISP16)
- {
- bfd_vma x;
-
- relocation += rel->r_addend;
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- relocation -= rel->r_offset;
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x |= ((((relocation >> 2) & 0xc000) << 6)
- | ((relocation >> 2) & 0x3fff));
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
-
- if ((bfd_signed_vma) relocation < - 0x40000
- || (bfd_signed_vma) relocation > 0x3ffff)
- r = bfd_reloc_overflow;
- else
- r = bfd_reloc_ok;
- }
- else if (r_type == R_SPARC_REV32)
- {
- bfd_vma x;
-
- relocation = relocation + rel->r_addend;
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = x + relocation;
- bfd_putl32 (/*input_bfd,*/ x, contents + rel->r_offset);
- r = bfd_reloc_ok;
- }
- else if (r_type == R_SPARC_TLS_LDO_HIX22
- || r_type == R_SPARC_TLS_LE_HIX22)
- {
- bfd_vma x;
-
- relocation += rel->r_addend;
- relocation = relocation ^ 0xffffffff;
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
- r = bfd_reloc_ok;
- }
- else if (r_type == R_SPARC_TLS_LDO_LOX10
- || r_type == R_SPARC_TLS_LE_LOX10)
- {
- bfd_vma x;
-
- relocation += rel->r_addend;
- relocation = (relocation & 0x3ff) | 0x1c00;
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~(bfd_vma) 0x1fff) | relocation;
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
-
- r = bfd_reloc_ok;
- }
- else if ((r_type == R_SPARC_WDISP30 || r_type == R_SPARC_WPLT30)
- && sec_do_relax (input_section)
- && rel->r_offset + 4 < input_section->_raw_size)
- {
-#define G0 0
-#define O7 15
-#define XCC (2 << 20)
-#define COND(x) (((x)&0xf)<<25)
-#define CONDA COND(0x8)
-#define INSN_BPA (F2(0,1) | CONDA | BPRED | XCC)
-#define INSN_BA (F2(0,2) | CONDA)
-#define INSN_OR F3(2, 0x2, 0)
-#define INSN_NOP F2(0,4)
-
- bfd_vma x, y;
-
- /* If the instruction is a call with either:
- restore
- arithmetic instruction with rd == %o7
- where rs1 != %o7 and rs2 if it is register != %o7
- then we can optimize if the call destination is near
- by changing the call into a branch always. */
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
- if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2))
- {
- if (((y & OP3(~0)) == OP3(0x3d) /* restore */
- || ((y & OP3(0x28)) == 0 /* arithmetic */
- && (y & RD(~0)) == RD(O7)))
- && (y & RS1(~0)) != RS1(O7)
- && ((y & F3I(~0))
- || (y & RS2(~0)) != RS2(O7)))
- {
- bfd_vma reloc;
-
- reloc = relocation + rel->r_addend - rel->r_offset;
- reloc -= (input_section->output_section->vma
- + input_section->output_offset);
-
- /* Ensure the reloc fits into simm22. */
- if ((reloc & 3) == 0
- && ((reloc & ~(bfd_vma)0x7fffff) == 0
- || ((reloc | 0x7fffff) == ~(bfd_vma)0)))
- {
- reloc >>= 2;
-
- /* Check whether it fits into simm19 on v9. */
- if (((reloc & 0x3c0000) == 0
- || (reloc & 0x3c0000) == 0x3c0000)
- && (elf_elfheader (output_bfd)->e_flags & EF_SPARC_32PLUS))
- x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */
- else
- x = INSN_BA | (reloc & 0x3fffff); /* ba */
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
- r = bfd_reloc_ok;
- if (rel->r_offset >= 4
- && (y & (0xffffffff ^ RS1(~0)))
- == (INSN_OR | RD(O7) | RS2(G0)))
- {
- bfd_vma z;
- unsigned int reg;
-
- z = bfd_get_32 (input_bfd,
- contents + rel->r_offset - 4);
- if ((z & (0xffffffff ^ RD(~0)))
- != (INSN_OR | RS1(O7) | RS2(G0)))
- break;
-
- /* The sequence was
- or %o7, %g0, %rN
- call foo
- or %rN, %g0, %o7
-
- If call foo was replaced with ba, replace
- or %rN, %g0, %o7 with nop. */
-
- reg = (y & RS1(~0)) >> 14;
- if (reg != ((z & RD(~0)) >> 25)
- || reg == G0 || reg == O7)
- break;
-
- bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP,
- contents + rel->r_offset + 4);
- }
-
- }
- }
- }
- }
-
- if (r == bfd_reloc_continue)
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, rel->r_addend);
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- break;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- bfd *dynobj;
- struct elf32_sparc_link_hash_table *htab;
-
- htab = elf32_sparc_hash_table (info);
- dynobj = htab->elf.dynobj;
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- asection *splt;
- asection *srela;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
- BFD_ASSERT (h->dynindx != -1);
-
- splt = htab->splt;
- srela = htab->srelplt;
- BFD_ASSERT (splt != NULL && srela != NULL);
-
- /* Fill in the entry in the procedure linkage table. */
- bfd_put_32 (output_bfd,
- PLT_ENTRY_WORD0 + h->plt.offset,
- splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd,
- (PLT_ENTRY_WORD1
- + (((- (h->plt.offset + 4)) >> 2) & 0x3fffff)),
- splt->contents + h->plt.offset + 4);
- 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. */
- rela.r_offset = (splt->output_section->vma
- + splt->output_offset
- + h->plt.offset);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
- rela.r_addend = 0;
- loc = srela->contents;
- loc += (h->plt.offset / PLT_ENTRY_SIZE - 4) * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. */
- sym->st_shndx = SHN_UNDEF;
- /* If the symbol is weak, we do need to clear the value.
- Otherwise, the PLT entry would provide a definition for
- the symbol even if the symbol wasn't defined anywhere,
- and so the symbol would never be NULL. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
- == 0)
- sym->st_value = 0;
- }
- }
-
- if (h->got.offset != (bfd_vma) -1
- && elf32_sparc_hash_entry(h)->tls_type != GOT_TLS_GD
- && elf32_sparc_hash_entry(h)->tls_type != GOT_TLS_IE)
- {
- asection *sgot;
- asection *srela;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the global offset table. Set it
- up. */
-
- sgot = htab->sgot;
- srela = htab->srelgot;
- BFD_ASSERT (sgot != NULL && srela != NULL);
-
- rela.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + (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
- the symbol was forced to be local because of a version file.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && (info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
- asection *sec = h->root.u.def.section;
- rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else
- {
- rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
- rela.r_addend = 0;
- }
-
- bfd_put_32 (output_bfd, (bfd_vma) 0,
- sgot->contents + (h->got.offset &~ (bfd_vma) 1));
- loc = srela->contents;
- loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- asection *s;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbols needs a copy reloc. Set it up. */
-
- BFD_ASSERT (h->dynindx != -1);
-
- s = bfd_get_section_by_name (h->root.u.def.section->owner,
- ".rela.bss");
- BFD_ASSERT (s != NULL);
-
- rela.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_COPY);
- rela.r_addend = 0;
- loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-elf32_sparc_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- asection *sdyn;
- struct elf32_sparc_link_hash_table *htab;
-
- htab = elf32_sparc_hash_table (info);
- dynobj = htab->elf.dynobj;
-
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- asection *splt;
- Elf32_External_Dyn *dyncon, *dynconend;
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL && sdyn != NULL);
-
- dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- bfd_boolean size;
-
- bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- case DT_PLTGOT: name = ".plt"; size = FALSE; break;
- case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break;
- case DT_JMPREL: name = ".rela.plt"; size = FALSE; break;
- default: name = NULL; size = FALSE; break;
- }
-
- if (name != NULL)
- {
- asection *s;
-
- s = bfd_get_section_by_name (output_bfd, name);
- if (s == NULL)
- dyn.d_un.d_val = 0;
- else
- {
- if (! size)
- dyn.d_un.d_ptr = s->vma;
- else
- {
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
- }
- }
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
- }
-
- /* Clear the first four entries in the procedure linkage table,
- and put a nop in the last four bytes. */
- if (splt->_raw_size > 0)
- {
- memset (splt->contents, 0, 4 * PLT_ENTRY_SIZE);
- bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP,
- splt->contents + splt->_raw_size - 4);
- }
-
- elf_section_data (splt->output_section)->this_hdr.sh_entsize = 0;
- }
-
- /* Set the first entry in the global offset table to the address of
- the dynamic section. */
- if (htab->sgot && htab->sgot->_raw_size > 0)
- {
- if (sdyn == NULL)
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents);
- else
- bfd_put_32 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- htab->sgot->contents);
- }
-
- if (htab->sgot)
- elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4;
-
- return TRUE;
-}
-
-/* Functions for dealing with the e_flags field.
-
- We don't define set_private_flags or copy_private_bfd_data because
- the only currently defined values are based on the bfd mach number,
- so we use the latter instead and defer setting e_flags until the
- file is written out. */
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
-
-static bfd_boolean
-elf32_sparc_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
-{
- bfd_boolean error;
- /* FIXME: This should not be static. */
- static unsigned long previous_ibfd_e_flags = (unsigned long) -1;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- error = FALSE;
-
- if (bfd_get_mach (ibfd) >= bfd_mach_sparc_v9)
- {
- error = TRUE;
- (*_bfd_error_handler)
- (_("%s: compiled for a 64 bit system and target is 32 bit"),
- bfd_archive_filename (ibfd));
- }
- else if ((ibfd->flags & DYNAMIC) == 0)
- {
- if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
- bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
- }
-
- if (((elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA)
- != previous_ibfd_e_flags)
- && previous_ibfd_e_flags != (unsigned long) -1)
- {
- (*_bfd_error_handler)
- (_("%s: linking little endian files with big endian files"),
- bfd_archive_filename (ibfd));
- error = TRUE;
- }
- previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA;
-
- if (error)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Set the right machine number. */
-
-static bfd_boolean
-elf32_sparc_object_p (abfd)
- bfd *abfd;
-{
- if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS)
- {
- if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3)
- return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
- bfd_mach_sparc_v8plusb);
- else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
- return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
- bfd_mach_sparc_v8plusa);
- else if (elf_elfheader (abfd)->e_flags & EF_SPARC_32PLUS)
- return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
- bfd_mach_sparc_v8plus);
- else
- return FALSE;
- }
- else if (elf_elfheader (abfd)->e_flags & EF_SPARC_LEDATA)
- return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
- bfd_mach_sparc_sparclite_le);
- else
- return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc);
-}
-
-/* The final processing done just before writing out the object file.
- We need to set the e_machine field appropriately. */
-
-static void
-elf32_sparc_final_write_processing (abfd, linker)
- bfd *abfd;
- bfd_boolean linker ATTRIBUTE_UNUSED;
-{
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_sparc :
- break; /* nothing to do */
- case bfd_mach_sparc_v8plus :
- elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
- elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
- elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS;
- break;
- case bfd_mach_sparc_v8plusa :
- elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
- elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
- elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1;
- break;
- case bfd_mach_sparc_v8plusb :
- elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
- elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
- elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1
- | EF_SPARC_SUN_US3;
- break;
- case bfd_mach_sparc_sparclite_le :
- elf_elfheader (abfd)->e_machine = EM_SPARC;
- elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA;
- break;
- default :
- abort ();
- break;
- }
-}
-
-static enum elf_reloc_type_class
-elf32_sparc_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
-{
- switch ((int) ELF32_R_TYPE (rela->r_info))
- {
- case R_SPARC_RELATIVE:
- return reloc_class_relative;
- case R_SPARC_JMP_SLOT:
- return reloc_class_plt;
- case R_SPARC_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-#define TARGET_BIG_SYM bfd_elf32_sparc_vec
-#define TARGET_BIG_NAME "elf32-sparc"
-#define ELF_ARCH bfd_arch_sparc
-#define ELF_MACHINE_CODE EM_SPARC
-#define ELF_MACHINE_ALT1 EM_SPARC32PLUS
-#define ELF_MAXPAGESIZE 0x10000
-
-#define bfd_elf32_bfd_reloc_type_lookup elf32_sparc_reloc_type_lookup
-#define bfd_elf32_bfd_link_hash_table_create \
- elf32_sparc_link_hash_table_create
-#define bfd_elf32_bfd_relax_section elf32_sparc_relax_section
-#define bfd_elf32_new_section_hook elf32_sparc_new_section_hook
-#define elf_info_to_howto elf32_sparc_info_to_howto
-#define elf_backend_copy_indirect_symbol \
- elf32_sparc_copy_indirect_symbol
-#define elf_backend_create_dynamic_sections \
- elf32_sparc_create_dynamic_sections
-#define elf_backend_check_relocs elf32_sparc_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
- elf32_sparc_adjust_dynamic_symbol
-#define elf_backend_size_dynamic_sections \
- elf32_sparc_size_dynamic_sections
-#define elf_backend_relocate_section elf32_sparc_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- elf32_sparc_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- elf32_sparc_finish_dynamic_sections
-#define bfd_elf32_bfd_merge_private_bfd_data \
- elf32_sparc_merge_private_bfd_data
-#define bfd_elf32_mkobject elf32_sparc_mkobject
-#define elf_backend_object_p elf32_sparc_object_p
-#define elf_backend_final_write_processing \
- elf32_sparc_final_write_processing
-#define elf_backend_gc_mark_hook elf32_sparc_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_sparc_gc_sweep_hook
-#define elf_backend_grok_psinfo elf32_sparc_grok_psinfo
-#define elf_backend_reloc_type_class elf32_sparc_reloc_type_class
-
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_want_got_plt 0
-#define elf_backend_plt_readonly 0
-#define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size 4
-#define elf_backend_rela_normal 1
-
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32.c b/contrib/binutils/bfd/elf32.c
deleted file mode 100644
index bfadd5c..0000000
--- a/contrib/binutils/bfd/elf32.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* ELF 32-bit executable support for BFD.
- Copyright 1993, 2001 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define ARCH_SIZE 32
-
-#include "elfcode.h"
diff --git a/contrib/binutils/bfd/elf64-alpha-fbsd.c b/contrib/binutils/bfd/elf64-alpha-fbsd.c
deleted file mode 100644
index 061b0b8..0000000
--- a/contrib/binutils/bfd/elf64-alpha-fbsd.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Alpha specific support for 64-bit ELF on FreeBSD.
- Copyright 2002 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec
-#define TARGET_LITTLE_NAME "elf64-alpha-freebsd"
-#define ELF_ARCH bfd_arch_alpha
-#define ELF_MACHINE_CODE EM_ALPHA
-#define ELF_MAXPAGESIZE 0x10000
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "elf-bfd.h"
-
-/* The kernel recognizes executables as valid only if they carry a
- "FreeBSD" label in the ELF header. So we put this label on all
- executables and (for simplicity) also all other object files. */
-
-static void elf_alpha_post_process_headers
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void
-elf_alpha_post_process_headers (abfd, link_info)
- bfd * abfd;
- struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
-{
- Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
-
- i_ehdrp = elf_elfheader (abfd);
-
- /* Put an ABI label supported by FreeBSD >= 4.1. */
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#ifdef OLD_FREEBSD_ABI_LABEL
- /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
- memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
-#endif
-}
-
-#define elf_backend_post_process_headers elf_alpha_post_process_headers
-
-#include "elf64-alpha.c"
diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c
deleted file mode 100644
index 2d4715b..0000000
--- a/contrib/binutils/bfd/elf64-alpha.c
+++ /dev/null
@@ -1,5590 +0,0 @@
-/* Alpha specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Contributed by Richard Henderson <rth@tamu.edu>.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* We need a published ABI spec for this. Until one comes out, don't
- assume this'll remain unchanged forever. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-#include "elf/alpha.h"
-
-#define ALPHAECOFF
-
-#define NO_COFF_RELOCS
-#define NO_COFF_SYMBOLS
-#define NO_COFF_LINENOS
-
-/* Get the ECOFF swapping routines. Needed for the debug information. */
-#include "coff/internal.h"
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/ecoff.h"
-#include "coff/alpha.h"
-#include "aout/ar.h"
-#include "libcoff.h"
-#include "libecoff.h"
-#define ECOFF_64
-#include "ecoffswap.h"
-
-static bfd_boolean alpha_elf_dynamic_symbol_p
- PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *));
-static struct bfd_hash_entry * elf64_alpha_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table * elf64_alpha_bfd_link_hash_table_create
- PARAMS ((bfd *));
-
-static bfd_reloc_status_type elf64_alpha_reloc_nil
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type elf64_alpha_reloc_bad
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type elf64_alpha_do_reloc_gpdisp
- PARAMS ((bfd *, bfd_vma, bfd_byte *, bfd_byte *));
-static bfd_reloc_status_type elf64_alpha_reloc_gpdisp
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
-static reloc_howto_type * elf64_alpha_bfd_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void elf64_alpha_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-
-static bfd_boolean elf64_alpha_mkobject
- PARAMS ((bfd *));
-static bfd_boolean elf64_alpha_object_p
- PARAMS ((bfd *));
-static bfd_boolean elf64_alpha_section_from_shdr
- PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
-static bfd_boolean elf64_alpha_section_flags
- PARAMS ((flagword *, Elf_Internal_Shdr *));
-static bfd_boolean elf64_alpha_fake_sections
- PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
-static bfd_boolean elf64_alpha_create_got_section
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf64_alpha_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static bfd_boolean elf64_alpha_read_ecoff_info
- PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
-static bfd_boolean elf64_alpha_is_local_label_name
- PARAMS ((bfd *, const char *));
-static bfd_boolean elf64_alpha_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct alpha_elf_link_hash_entry;
-#endif
-
-static bfd_boolean elf64_alpha_output_extsym
- PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
-
-static bfd_boolean elf64_alpha_can_merge_gots
- PARAMS ((bfd *, bfd *));
-static void elf64_alpha_merge_gots
- PARAMS ((bfd *, bfd *));
-static bfd_boolean elf64_alpha_calc_got_offsets_for_symbol
- PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
-static void elf64_alpha_calc_got_offsets
- PARAMS ((struct bfd_link_info *));
-static bfd_boolean elf64_alpha_size_got_sections
- PARAMS ((struct bfd_link_info *));
-static bfd_boolean elf64_alpha_size_plt_section
- PARAMS ((struct bfd_link_info *));
-static bfd_boolean elf64_alpha_size_plt_section_1
- PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
-static bfd_boolean elf64_alpha_always_size_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static int alpha_dynamic_entries_for_reloc
- PARAMS ((int, int, int));
-static bfd_boolean elf64_alpha_calc_dynrel_sizes
- PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *));
-static bfd_boolean elf64_alpha_size_rela_got_section
- PARAMS ((struct bfd_link_info *));
-static bfd_boolean elf64_alpha_size_rela_got_1
- PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *));
-static bfd_boolean elf64_alpha_add_symbol_hook
- PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
- const char **, flagword *, asection **, bfd_vma *));
-static struct alpha_elf_got_entry *get_got_entry
- PARAMS ((bfd *, struct alpha_elf_link_hash_entry *, unsigned long,
- unsigned long, bfd_vma));
-static bfd_boolean elf64_alpha_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
- const Elf_Internal_Rela *));
-static bfd_boolean elf64_alpha_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean elf64_alpha_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static void elf64_alpha_emit_dynrel
- PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *,
- bfd_vma, long, long, bfd_vma));
-static bfd_boolean elf64_alpha_relocate_section_r
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static bfd_boolean elf64_alpha_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static bfd_boolean elf64_alpha_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static bfd_boolean elf64_alpha_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf64_alpha_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf64_alpha_merge_ind_symbols
- PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
-static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs
- PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int));
-static enum elf_reloc_type_class elf64_alpha_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-
-struct alpha_elf_link_hash_entry
-{
- struct elf_link_hash_entry root;
-
- /* External symbol information. */
- EXTR esym;
-
- /* Cumulative flags for all the .got entries. */
- int flags;
-
- /* Contexts in which a literal was referenced. */
-#define ALPHA_ELF_LINK_HASH_LU_ADDR 0x01
-#define ALPHA_ELF_LINK_HASH_LU_MEM 0x02
-#define ALPHA_ELF_LINK_HASH_LU_BYTE 0x04
-#define ALPHA_ELF_LINK_HASH_LU_JSR 0x08
-#define ALPHA_ELF_LINK_HASH_LU_TLSGD 0x10
-#define ALPHA_ELF_LINK_HASH_LU_TLSLDM 0x20
-#define ALPHA_ELF_LINK_HASH_LU_FUNC 0x38
-#define ALPHA_ELF_LINK_HASH_TLS_IE 0x40
-#define ALPHA_ELF_LINK_HASH_PLT_LOC 0x80
-
- /* Used to undo the localization of a plt symbol. */
- asection *plt_old_section;
- bfd_vma plt_old_value;
-
- /* Used to implement multiple .got subsections. */
- struct alpha_elf_got_entry
- {
- struct alpha_elf_got_entry *next;
-
- /* Which .got subsection? */
- bfd *gotobj;
-
- /* The addend in effect for this entry. */
- bfd_vma addend;
-
- /* The .got offset for this entry. */
- int got_offset;
-
- /* How many references to this entry? */
- int use_count;
-
- /* The relocation type of this entry. */
- unsigned char reloc_type;
-
- /* How a LITERAL is used. */
- unsigned char flags;
-
- /* Have we initialized the dynamic relocation for this entry? */
- unsigned char reloc_done;
-
- /* Have we adjusted this entry for SEC_MERGE? */
- unsigned char reloc_xlated;
- } *got_entries;
-
- /* Used to count non-got, non-plt relocations for delayed sizing
- of relocation sections. */
- struct alpha_elf_reloc_entry
- {
- struct alpha_elf_reloc_entry *next;
-
- /* Which .reloc section? */
- asection *srel;
-
- /* What kind of relocation? */
- unsigned int rtype;
-
- /* Is this against read-only section? */
- unsigned int reltext : 1;
-
- /* How many did we find? */
- unsigned long count;
- } *reloc_entries;
-};
-
-/* Alpha ELF linker hash table. */
-
-struct alpha_elf_link_hash_table
-{
- struct elf_link_hash_table root;
-
- /* The head of a list of .got subsections linked through
- alpha_elf_tdata(abfd)->got_link_next. */
- bfd *got_list;
-};
-
-/* Look up an entry in a Alpha ELF linker hash table. */
-
-#define alpha_elf_link_hash_lookup(table, string, create, copy, follow) \
- ((struct alpha_elf_link_hash_entry *) \
- elf_link_hash_lookup (&(table)->root, (string), (create), \
- (copy), (follow)))
-
-/* Traverse a Alpha ELF linker hash table. */
-
-#define alpha_elf_link_hash_traverse(table, func, info) \
- (elf_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the Alpha ELF linker hash table from a link_info structure. */
-
-#define alpha_elf_hash_table(p) \
- ((struct alpha_elf_link_hash_table *) ((p)->hash))
-
-/* Get the object's symbols as our own entry type. */
-
-#define alpha_elf_sym_hashes(abfd) \
- ((struct alpha_elf_link_hash_entry **)elf_sym_hashes(abfd))
-
-/* Should we do dynamic things to this symbol? This differs from the
- generic version in that we never need to consider function pointer
- equality wrt PLT entries -- we don't create a PLT entry if a symbol's
- address is ever taken. */
-
-static inline bfd_boolean
-alpha_elf_dynamic_symbol_p (h, info)
- struct elf_link_hash_entry *h;
- struct bfd_link_info *info;
-{
- return _bfd_elf_dynamic_symbol_p (h, info, 0);
-}
-
-/* Create an entry in a Alpha ELF linker hash table. */
-
-static struct bfd_hash_entry *
-elf64_alpha_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct alpha_elf_link_hash_entry *ret =
- (struct alpha_elf_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct alpha_elf_link_hash_entry *) NULL)
- ret = ((struct alpha_elf_link_hash_entry *)
- bfd_hash_allocate (table,
- sizeof (struct alpha_elf_link_hash_entry)));
- if (ret == (struct alpha_elf_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct alpha_elf_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != (struct alpha_elf_link_hash_entry *) NULL)
- {
- /* Set local fields. */
- memset (&ret->esym, 0, sizeof (EXTR));
- /* We use -2 as a marker to indicate that the information has
- not been set. -1 means there is no associated ifd. */
- ret->esym.ifd = -2;
- ret->flags = 0;
- ret->got_entries = NULL;
- ret->reloc_entries = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create a Alpha ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-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_zmalloc (amt);
- if (ret == (struct alpha_elf_link_hash_table *) NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
- elf64_alpha_link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- return &ret->root.root;
-}
-
-/* We have some private fields hanging off of the elf_tdata structure. */
-
-struct alpha_elf_obj_tdata
-{
- struct elf_obj_tdata root;
-
- /* For every input file, these are the got entries for that object's
- local symbols. */
- struct alpha_elf_got_entry ** local_got_entries;
-
- /* For every input file, this is the object that owns the got that
- this input file uses. */
- bfd *gotobj;
-
- /* For every got, this is a linked list through the objects using this got */
- bfd *in_got_link_next;
-
- /* For every got, this is a link to the next got subsegment. */
- bfd *got_link_next;
-
- /* For every got, this is the section. */
- asection *got;
-
- /* For every got, this is it's total number of words. */
- int total_got_size;
-
- /* For every got, this is the sum of the number of words required
- to hold all of the member object's local got. */
- int local_got_size;
-};
-
-#define alpha_elf_tdata(abfd) \
- ((struct alpha_elf_obj_tdata *) (abfd)->tdata.any)
-
-static bfd_boolean
-elf64_alpha_mkobject (abfd)
- bfd *abfd;
-{
- 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;
-}
-
-static bfd_boolean
-elf64_alpha_object_p (abfd)
- bfd *abfd;
-{
- /* Set the right machine number for an Alpha ELF file. */
- return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0);
-}
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-#define SKIP_HOWTO(N) \
- HOWTO(N, 0, 0, 0, 0, 0, 0, elf64_alpha_reloc_bad, 0, 0, 0, 0, 0)
-
-static reloc_howto_type elf64_alpha_howto_table[] =
-{
- HOWTO (R_ALPHA_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_nil, /* special_function */
- "NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A 32 bit reference to a symbol. */
- HOWTO (R_ALPHA_REFLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "REFLONG", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 64 bit reference to a symbol. */
- HOWTO (R_ALPHA_REFQUAD, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "REFQUAD", /* name */
- FALSE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 32 bit GP relative offset. This is just like REFLONG except
- that when the value is used the value of the gp register will be
- added in. */
- HOWTO (R_ALPHA_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "GPREL32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used for an instruction that refers to memory off the GP register. */
- HOWTO (R_ALPHA_LITERAL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "ELF_LITERAL", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* This reloc only appears immediately following an ELF_LITERAL reloc.
- It identifies a use of the literal. The symbol index is special:
- 1 means the literal address is in the base register of a memory
- format instruction; 2 means the literal address is in the byte
- offset register of a byte-manipulation instruction; 3 means the
- literal address is in the target register of a jsr instruction.
- This does not actually do any relocation. */
- HOWTO (R_ALPHA_LITUSE, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_nil, /* special_function */
- "LITUSE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Load the gp register. This is always used for a ldah instruction
- which loads the upper 16 bits of the gp register. The symbol
- index of the GPDISP instruction is an offset in bytes to the lda
- instruction that loads the lower 16 bits. The value to use for
- the relocation is the difference between the GP value and the
- current location; the load will always be done against a register
- holding the current address.
-
- NOTE: Unlike ECOFF, partial in-place relocation is not done. If
- any offset is present in the instructions, it is an offset from
- the register to the ldah instruction. This lets us avoid any
- stupid hackery like inventing a gp value to do partial relocation
- against. Also unlike ECOFF, we do the whole relocation off of
- the GPDISP rather than a GPDISP_HI16/GPDISP_LO16 pair. An odd,
- space consuming bit, that, since all the information was present
- in the GPDISP_HI16 reloc. */
- HOWTO (R_ALPHA_GPDISP, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_gpdisp, /* special_function */
- "GPDISP", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A 21 bit branch. */
- HOWTO (R_ALPHA_BRADDR, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 21, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "BRADDR", /* name */
- FALSE, /* partial_inplace */
- 0x1fffff, /* src_mask */
- 0x1fffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A hint for a jump to a register. */
- HOWTO (R_ALPHA_HINT, /* type */
- 2, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 14, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "HINT", /* name */
- FALSE, /* partial_inplace */
- 0x3fff, /* src_mask */
- 0x3fff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 16 bit PC relative offset. */
- HOWTO (R_ALPHA_SREL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL16", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 32 bit PC relative offset. */
- HOWTO (R_ALPHA_SREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A 64 bit PC relative offset. */
- HOWTO (R_ALPHA_SREL64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "SREL64", /* name */
- FALSE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Skip 12 - 16; deprecated ECOFF relocs. */
- SKIP_HOWTO (12),
- SKIP_HOWTO (13),
- SKIP_HOWTO (14),
- SKIP_HOWTO (15),
- SKIP_HOWTO (16),
-
- /* The high 16 bits of the displacement from GP to the target. */
- HOWTO (R_ALPHA_GPRELHIGH,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "GPRELHIGH", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The low 16 bits of the displacement from GP to the target. */
- HOWTO (R_ALPHA_GPRELLOW,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "GPRELLOW", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16-bit displacement from the GP to the target. */
- HOWTO (R_ALPHA_GPREL16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "GPREL16", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Skip 20 - 23; deprecated ECOFF relocs. */
- SKIP_HOWTO (20),
- SKIP_HOWTO (21),
- SKIP_HOWTO (22),
- SKIP_HOWTO (23),
-
- /* Misc ELF relocations. */
-
- /* A dynamic relocation to copy the target into our .dynbss section. */
- /* Not generated, as all Alpha objects use PIC, so it is not needed. It
- is present because every other ELF has one, but should not be used
- because .dynbss is an ugly thing. */
- HOWTO (R_ALPHA_COPY,
- 0,
- 0,
- 0,
- FALSE,
- 0,
- complain_overflow_dont,
- bfd_elf_generic_reloc,
- "COPY",
- FALSE,
- 0,
- 0,
- TRUE),
-
- /* A dynamic relocation for a .got entry. */
- HOWTO (R_ALPHA_GLOB_DAT,
- 0,
- 0,
- 0,
- FALSE,
- 0,
- complain_overflow_dont,
- bfd_elf_generic_reloc,
- "GLOB_DAT",
- FALSE,
- 0,
- 0,
- TRUE),
-
- /* A dynamic relocation for a .plt entry. */
- HOWTO (R_ALPHA_JMP_SLOT,
- 0,
- 0,
- 0,
- FALSE,
- 0,
- complain_overflow_dont,
- bfd_elf_generic_reloc,
- "JMP_SLOT",
- FALSE,
- 0,
- 0,
- TRUE),
-
- /* A dynamic relocation to add the base of the DSO to a 64-bit field. */
- HOWTO (R_ALPHA_RELATIVE,
- 0,
- 0,
- 0,
- FALSE,
- 0,
- complain_overflow_dont,
- bfd_elf_generic_reloc,
- "RELATIVE",
- FALSE,
- 0,
- 0,
- TRUE),
-
- /* A 21 bit branch that adjusts for gp loads. */
- HOWTO (R_ALPHA_BRSGP, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 21, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "BRSGP", /* name */
- FALSE, /* partial_inplace */
- 0x1fffff, /* src_mask */
- 0x1fffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Creates a tls_index for the symbol in the got. */
- HOWTO (R_ALPHA_TLSGD, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "TLSGD", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Creates a tls_index for the (current) module in the got. */
- HOWTO (R_ALPHA_TLSLDM, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "TLSLDM", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A dynamic relocation for a DTP module entry. */
- HOWTO (R_ALPHA_DTPMOD64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "DTPMOD64", /* name */
- FALSE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Creates a 64-bit offset in the got for the displacement
- from DTP to the target. */
- HOWTO (R_ALPHA_GOTDTPREL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "GOTDTPREL", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A dynamic relocation for a displacement from DTP to the target. */
- HOWTO (R_ALPHA_DTPREL64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "DTPREL64", /* name */
- FALSE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high 16 bits of the displacement from DTP to the target. */
- HOWTO (R_ALPHA_DTPRELHI, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "DTPRELHI", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The low 16 bits of the displacement from DTP to the target. */
- HOWTO (R_ALPHA_DTPRELLO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "DTPRELLO", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16-bit displacement from DTP to the target. */
- HOWTO (R_ALPHA_DTPREL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "DTPREL16", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Creates a 64-bit offset in the got for the displacement
- from TP to the target. */
- HOWTO (R_ALPHA_GOTTPREL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "GOTTPREL", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A dynamic relocation for a displacement from TP to the target. */
- HOWTO (R_ALPHA_TPREL64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "TPREL64", /* name */
- FALSE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high 16 bits of the displacement from TP to the target. */
- HOWTO (R_ALPHA_TPRELHI, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "TPRELHI", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The low 16 bits of the displacement from TP to the target. */
- HOWTO (R_ALPHA_TPRELLO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "TPRELLO", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16-bit displacement from TP to the target. */
- HOWTO (R_ALPHA_TPREL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "TPREL16", /* name */
- FALSE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* A relocation function which doesn't do anything. */
-
-static bfd_reloc_status_type
-elf64_alpha_reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc;
- asymbol *sym ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *sec;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- if (output_bfd)
- reloc->address += sec->output_offset;
- return bfd_reloc_ok;
-}
-
-/* A relocation function used for an unsupported reloc. */
-
-static bfd_reloc_status_type
-elf64_alpha_reloc_bad (abfd, reloc, sym, data, sec, output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc;
- asymbol *sym ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *sec;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- if (output_bfd)
- reloc->address += sec->output_offset;
- return bfd_reloc_notsupported;
-}
-
-/* Do the work of the GPDISP relocation. */
-
-static bfd_reloc_status_type
-elf64_alpha_do_reloc_gpdisp (abfd, gpdisp, p_ldah, p_lda)
- bfd *abfd;
- bfd_vma gpdisp;
- bfd_byte *p_ldah;
- bfd_byte *p_lda;
-{
- bfd_reloc_status_type ret = bfd_reloc_ok;
- bfd_vma addend;
- unsigned long i_ldah, i_lda;
-
- i_ldah = bfd_get_32 (abfd, p_ldah);
- i_lda = bfd_get_32 (abfd, p_lda);
-
- /* Complain if the instructions are not correct. */
- if (((i_ldah >> 26) & 0x3f) != 0x09
- || ((i_lda >> 26) & 0x3f) != 0x08)
- ret = bfd_reloc_dangerous;
-
- /* Extract the user-supplied offset, mirroring the sign extensions
- that the instructions perform. */
- addend = ((i_ldah & 0xffff) << 16) | (i_lda & 0xffff);
- addend = (addend ^ 0x80008000) - 0x80008000;
-
- gpdisp += addend;
-
- if ((bfd_signed_vma) gpdisp < -(bfd_signed_vma) 0x80000000
- || (bfd_signed_vma) gpdisp >= (bfd_signed_vma) 0x7fff8000)
- ret = bfd_reloc_overflow;
-
- /* compensate for the sign extension again. */
- i_ldah = ((i_ldah & 0xffff0000)
- | (((gpdisp >> 16) + ((gpdisp >> 15) & 1)) & 0xffff));
- i_lda = (i_lda & 0xffff0000) | (gpdisp & 0xffff);
-
- bfd_put_32 (abfd, (bfd_vma) i_ldah, p_ldah);
- bfd_put_32 (abfd, (bfd_vma) i_lda, p_lda);
-
- return ret;
-}
-
-/* The special function for the GPDISP reloc. */
-
-static bfd_reloc_status_type
-elf64_alpha_reloc_gpdisp (abfd, reloc_entry, sym, data, input_section,
- output_bfd, err_msg)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *sym ATTRIBUTE_UNUSED;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **err_msg;
-{
- bfd_reloc_status_type ret;
- bfd_vma gp, relocation;
- bfd_byte *p_ldah, *p_lda;
-
- /* Don't do anything if we're not doing a final link. */
- if (output_bfd)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (reloc_entry->address > input_section->_cooked_size ||
- reloc_entry->address + reloc_entry->addend > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- /* The gp used in the portion of the output object to which this
- input object belongs is cached on the input bfd. */
- gp = _bfd_get_gp_value (abfd);
-
- relocation = (input_section->output_section->vma
- + input_section->output_offset
- + reloc_entry->address);
-
- p_ldah = (bfd_byte *) data + reloc_entry->address;
- p_lda = p_ldah + reloc_entry->addend;
-
- ret = elf64_alpha_do_reloc_gpdisp (abfd, gp - relocation, p_ldah, p_lda);
-
- /* Complain if the instructions are not correct. */
- if (ret == bfd_reloc_dangerous)
- *err_msg = _("GPDISP relocation did not find ldah and lda instructions");
-
- return ret;
-}
-
-/* A mapping from BFD reloc types to Alpha ELF reloc types. */
-
-struct elf_reloc_map
-{
- bfd_reloc_code_real_type bfd_reloc_val;
- int elf_reloc_val;
-};
-
-static const struct elf_reloc_map elf64_alpha_reloc_map[] =
-{
- {BFD_RELOC_NONE, R_ALPHA_NONE},
- {BFD_RELOC_32, R_ALPHA_REFLONG},
- {BFD_RELOC_64, R_ALPHA_REFQUAD},
- {BFD_RELOC_CTOR, R_ALPHA_REFQUAD},
- {BFD_RELOC_GPREL32, R_ALPHA_GPREL32},
- {BFD_RELOC_ALPHA_ELF_LITERAL, R_ALPHA_LITERAL},
- {BFD_RELOC_ALPHA_LITUSE, R_ALPHA_LITUSE},
- {BFD_RELOC_ALPHA_GPDISP, R_ALPHA_GPDISP},
- {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR},
- {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT},
- {BFD_RELOC_16_PCREL, R_ALPHA_SREL16},
- {BFD_RELOC_32_PCREL, R_ALPHA_SREL32},
- {BFD_RELOC_64_PCREL, R_ALPHA_SREL64},
- {BFD_RELOC_ALPHA_GPREL_HI16, R_ALPHA_GPRELHIGH},
- {BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW},
- {BFD_RELOC_GPREL16, R_ALPHA_GPREL16},
- {BFD_RELOC_ALPHA_BRSGP, R_ALPHA_BRSGP},
- {BFD_RELOC_ALPHA_TLSGD, R_ALPHA_TLSGD},
- {BFD_RELOC_ALPHA_TLSLDM, R_ALPHA_TLSLDM},
- {BFD_RELOC_ALPHA_DTPMOD64, R_ALPHA_DTPMOD64},
- {BFD_RELOC_ALPHA_GOTDTPREL16, R_ALPHA_GOTDTPREL},
- {BFD_RELOC_ALPHA_DTPREL64, R_ALPHA_DTPREL64},
- {BFD_RELOC_ALPHA_DTPREL_HI16, R_ALPHA_DTPRELHI},
- {BFD_RELOC_ALPHA_DTPREL_LO16, R_ALPHA_DTPRELLO},
- {BFD_RELOC_ALPHA_DTPREL16, R_ALPHA_DTPREL16},
- {BFD_RELOC_ALPHA_GOTTPREL16, R_ALPHA_GOTTPREL},
- {BFD_RELOC_ALPHA_TPREL64, R_ALPHA_TPREL64},
- {BFD_RELOC_ALPHA_TPREL_HI16, R_ALPHA_TPRELHI},
- {BFD_RELOC_ALPHA_TPREL_LO16, R_ALPHA_TPRELLO},
- {BFD_RELOC_ALPHA_TPREL16, R_ALPHA_TPREL16},
-};
-
-/* Given a BFD reloc type, return a HOWTO structure. */
-
-static reloc_howto_type *
-elf64_alpha_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- const struct elf_reloc_map *i, *e;
- i = e = elf64_alpha_reloc_map;
- e += sizeof (elf64_alpha_reloc_map) / sizeof (struct elf_reloc_map);
- for (; i != e; ++i)
- {
- if (i->bfd_reloc_val == code)
- return &elf64_alpha_howto_table[i->elf_reloc_val];
- }
- return 0;
-}
-
-/* Given an Alpha ELF reloc type, fill in an arelent structure. */
-
-static void
-elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf_Internal_Rela *dst;
-{
- unsigned r_type;
-
- r_type = ELF64_R_TYPE(dst->r_info);
- BFD_ASSERT (r_type < (unsigned int) R_ALPHA_max);
- cache_ptr->howto = &elf64_alpha_howto_table[r_type];
-}
-
-/* These two relocations create a two-word entry in the got. */
-#define alpha_got_entry_size(r_type) \
- (r_type == R_ALPHA_TLSGD || r_type == R_ALPHA_TLSLDM ? 16 : 8)
-
-/* This is PT_TLS segment p_vaddr. */
-#define alpha_get_dtprel_base(info) \
- (elf_hash_table (info)->tls_sec->vma)
-
-/* Main program TLS (whose template starts at PT_TLS p_vaddr)
- is assigned offset round(16, PT_TLS p_align). */
-#define alpha_get_tprel_base(info) \
- (elf_hash_table (info)->tls_sec->vma \
- - align_power ((bfd_vma) 16, \
- elf_hash_table (info)->tls_sec->alignment_power))
-
-/* These functions do relaxation for Alpha ELF.
-
- Currently I'm only handling what I can do with existing compiler
- and assembler support, which means no instructions are removed,
- though some may be nopped. At this time GCC does not emit enough
- information to do all of the relaxing that is possible. It will
- take some not small amount of work for that to happen.
-
- There are a couple of interesting papers that I once read on this
- subject, that I cannot find references to at the moment, that
- related to Alpha in particular. They are by David Wall, then of
- DEC WRL. */
-
-#define OP_LDA 0x08
-#define OP_LDAH 0x09
-#define INSN_JSR 0x68004000
-#define INSN_JSR_MASK 0xfc00c000
-#define OP_LDQ 0x29
-#define OP_BR 0x30
-#define OP_BSR 0x34
-#define INSN_UNOP 0x2ffe0000
-#define INSN_ADDQ 0x40000400
-#define INSN_RDUNIQ 0x0000009e
-
-struct alpha_relax_info
-{
- bfd *abfd;
- asection *sec;
- bfd_byte *contents;
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Rela *relocs, *relend;
- struct bfd_link_info *link_info;
- bfd_vma gp;
- bfd *gotobj;
- asection *tsec;
- struct alpha_elf_link_hash_entry *h;
- struct alpha_elf_got_entry **first_gotent;
- struct alpha_elf_got_entry *gotent;
- bfd_boolean changed_contents;
- bfd_boolean changed_relocs;
- unsigned char other;
-};
-
-static bfd_boolean elf64_alpha_relax_with_lituse
- PARAMS((struct alpha_relax_info *info, bfd_vma symval,
- Elf_Internal_Rela *irel));
-static bfd_vma elf64_alpha_relax_opt_call
- PARAMS((struct alpha_relax_info *info, bfd_vma symval));
-static bfd_boolean elf64_alpha_relax_got_load
- PARAMS((struct alpha_relax_info *info, bfd_vma symval,
- Elf_Internal_Rela *irel, unsigned long));
-static bfd_boolean elf64_alpha_relax_gprelhilo
- PARAMS((struct alpha_relax_info *info, bfd_vma symval,
- Elf_Internal_Rela *irel, bfd_boolean));
-static bfd_boolean elf64_alpha_relax_tls_get_addr
- PARAMS((struct alpha_relax_info *info, bfd_vma symval,
- Elf_Internal_Rela *irel, bfd_boolean));
-static bfd_boolean elf64_alpha_relax_section
- PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
- bfd_boolean *again));
-
-static Elf_Internal_Rela *
-elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type)
- Elf_Internal_Rela *rel, *relend;
- bfd_vma offset;
- int type;
-{
- while (rel < relend)
- {
- if (rel->r_offset == offset
- && ELF64_R_TYPE (rel->r_info) == (unsigned int) type)
- return rel;
- ++rel;
- }
- return NULL;
-}
-
-static bfd_boolean
-elf64_alpha_relax_with_lituse (info, symval, irel)
- struct alpha_relax_info *info;
- bfd_vma symval;
- Elf_Internal_Rela *irel;
-{
- Elf_Internal_Rela *urel, *irelend = info->relend;
- int flags, count, i;
- bfd_signed_vma disp;
- bfd_boolean fits16;
- bfd_boolean fits32;
- bfd_boolean lit_reused = FALSE;
- bfd_boolean all_optimized = TRUE;
- unsigned int lit_insn;
-
- lit_insn = bfd_get_32 (info->abfd, info->contents + irel->r_offset);
- if (lit_insn >> 26 != OP_LDQ)
- {
- ((*_bfd_error_handler)
- ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn",
- bfd_archive_filename (info->abfd), info->sec->name,
- (unsigned long) irel->r_offset));
- return TRUE;
- }
-
- /* Can't relax dynamic symbols. */
- if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
- return TRUE;
-
- /* Summarize how this particular LITERAL is used. */
- for (urel = irel+1, flags = count = 0; urel < irelend; ++urel, ++count)
- {
- if (ELF64_R_TYPE (urel->r_info) != R_ALPHA_LITUSE)
- break;
- if (urel->r_addend <= 3)
- flags |= 1 << urel->r_addend;
- }
-
- /* A little preparation for the loop... */
- disp = symval - info->gp;
-
- for (urel = irel+1, i = 0; i < count; ++i, ++urel)
- {
- unsigned int insn;
- int insn_disp;
- bfd_signed_vma xdisp;
-
- insn = bfd_get_32 (info->abfd, info->contents + urel->r_offset);
-
- switch (urel->r_addend)
- {
- case LITUSE_ALPHA_ADDR:
- default:
- /* This type is really just a placeholder to note that all
- uses cannot be optimized, but to still allow some. */
- all_optimized = FALSE;
- break;
-
- case LITUSE_ALPHA_BASE:
- /* We can always optimize 16-bit displacements. */
-
- /* Extract the displacement from the instruction, sign-extending
- it if necessary, then test whether it is within 16 or 32 bits
- displacement from GP. */
- insn_disp = insn & 0x0000ffff;
- if (insn_disp & 0x8000)
- insn_disp |= ~0xffff; /* Negative: sign-extend. */
-
- xdisp = disp + insn_disp;
- fits16 = (xdisp >= - (bfd_signed_vma) 0x8000 && xdisp < 0x8000);
- fits32 = (xdisp >= - (bfd_signed_vma) 0x80000000
- && xdisp < 0x7fff8000);
-
- if (fits16)
- {
- /* Take the op code and dest from this insn, take the base
- register from the literal insn. Leave the offset alone. */
- insn = (insn & 0xffe0ffff) | (lit_insn & 0x001f0000);
- urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
- R_ALPHA_GPREL16);
- urel->r_addend = irel->r_addend;
- info->changed_relocs = TRUE;
-
- bfd_put_32 (info->abfd, (bfd_vma) insn,
- info->contents + urel->r_offset);
- info->changed_contents = TRUE;
- }
-
- /* If all mem+byte, we can optimize 32-bit mem displacements. */
- else if (fits32 && !(flags & ~6))
- {
- /* FIXME: sanity check that lit insn Ra is mem insn Rb. */
-
- 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, (bfd_vma) lit_insn,
- info->contents + irel->r_offset);
- lit_reused = TRUE;
- info->changed_contents = TRUE;
-
- urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
- R_ALPHA_GPRELLOW);
- urel->r_addend = irel->r_addend;
- info->changed_relocs = TRUE;
- }
- else
- all_optimized = FALSE;
- break;
-
- case LITUSE_ALPHA_BYTOFF:
- /* We can always optimize byte instructions. */
-
- /* FIXME: sanity check the insn for byte op. Check that the
- literal dest reg is indeed Rb in the byte insn. */
-
- 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, (bfd_vma) insn,
- info->contents + urel->r_offset);
- info->changed_contents = TRUE;
- break;
-
- case LITUSE_ALPHA_JSR:
- case LITUSE_ALPHA_TLSGD:
- case LITUSE_ALPHA_TLSLDM:
- {
- bfd_vma optdest, org;
- bfd_signed_vma odisp;
-
- /* If not zero, place to jump without needing pv. */
- optdest = elf64_alpha_relax_opt_call (info, symval);
- org = (info->sec->output_section->vma
- + info->sec->output_offset
- + urel->r_offset + 4);
- odisp = (optdest ? optdest : symval) - org;
-
- if (odisp >= -0x400000 && odisp < 0x400000)
- {
- Elf_Internal_Rela *xrel;
-
- /* Preserve branch prediction call stack when possible. */
- if ((insn & INSN_JSR_MASK) == INSN_JSR)
- insn = (OP_BSR << 26) | (insn & 0x03e00000);
- else
- insn = (OP_BR << 26) | (insn & 0x03e00000);
-
- urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
- R_ALPHA_BRADDR);
- urel->r_addend = irel->r_addend;
-
- if (optdest)
- urel->r_addend += optdest - symval;
- else
- all_optimized = FALSE;
-
- 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
- (info->relocs, info->relend, urel->r_offset,
- R_ALPHA_HINT));
- if (xrel)
- xrel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
-
- info->changed_contents = TRUE;
- info->changed_relocs = TRUE;
- }
- else
- all_optimized = FALSE;
-
- /* Even if the target is not in range for a direct branch,
- if we share a GP, we can eliminate the gp reload. */
- if (optdest)
- {
- Elf_Internal_Rela *gpdisp
- = (elf64_alpha_find_reloc_at_ofs
- (info->relocs, irelend, urel->r_offset + 4,
- R_ALPHA_GPDISP));
- if (gpdisp)
- {
- bfd_byte *p_ldah = info->contents + gpdisp->r_offset;
- bfd_byte *p_lda = p_ldah + gpdisp->r_addend;
- unsigned int ldah = bfd_get_32 (info->abfd, p_ldah);
- unsigned int lda = bfd_get_32 (info->abfd, p_lda);
-
- /* Verify that the instruction is "ldah $29,0($26)".
- Consider a function that ends in a noreturn call,
- and that the next function begins with an ldgp,
- and that by accident there is no padding between.
- In that case the insn would use $27 as the base. */
- if (ldah == 0x27ba0000 && lda == 0x23bd0000)
- {
- bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, p_ldah);
- bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, p_lda);
-
- gpdisp->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- info->changed_contents = TRUE;
- info->changed_relocs = TRUE;
- }
- }
- }
- }
- break;
- }
- }
-
- /* If all cases were optimized, we can reduce the use count on this
- got entry by one, possibly eliminating it. */
- if (all_optimized)
- {
- if (--info->gotent->use_count == 0)
- {
- int sz = alpha_got_entry_size (R_ALPHA_LITERAL);
- alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
- if (!info->h)
- alpha_elf_tdata (info->gotobj)->local_got_size -= sz;
- }
-
- /* If the literal instruction is no longer needed (it may have been
- reused. We can eliminate it. */
- /* ??? For now, I don't want to deal with compacting the section,
- so just nop it out. */
- if (!lit_reused)
- {
- irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- info->changed_relocs = TRUE;
-
- bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP,
- info->contents + irel->r_offset);
- info->changed_contents = TRUE;
- }
- }
-
- return TRUE;
-}
-
-static bfd_vma
-elf64_alpha_relax_opt_call (info, symval)
- struct alpha_relax_info *info;
- bfd_vma symval;
-{
- /* If the function has the same gp, and we can identify that the
- function does not use its function pointer, we can eliminate the
- address load. */
-
- /* If the symbol is marked NOPV, we are being told the function never
- needs its procedure value. */
- if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_NOPV)
- return symval;
-
- /* If the symbol is marked STD_GP, we are being told the function does
- a normal ldgp in the first two words. */
- else if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_STD_GPLOAD)
- ;
-
- /* Otherwise, we may be able to identify a GP load in the first two
- words, which we can then skip. */
- else
- {
- Elf_Internal_Rela *tsec_relocs, *tsec_relend, *tsec_free, *gpdisp;
- bfd_vma ofs;
-
- /* Load the relocations from the section that the target symbol is in. */
- if (info->sec == info->tsec)
- {
- tsec_relocs = info->relocs;
- tsec_relend = info->relend;
- tsec_free = NULL;
- }
- else
- {
- tsec_relocs = (_bfd_elf_link_read_relocs
- (info->abfd, info->tsec, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->link_info->keep_memory));
- if (tsec_relocs == NULL)
- return 0;
- tsec_relend = tsec_relocs + info->tsec->reloc_count;
- tsec_free = (info->link_info->keep_memory ? NULL : tsec_relocs);
- }
-
- /* Recover the symbol's offset within the section. */
- ofs = (symval - info->tsec->output_section->vma
- - info->tsec->output_offset);
-
- /* Look for a GPDISP reloc. */
- gpdisp = (elf64_alpha_find_reloc_at_ofs
- (tsec_relocs, tsec_relend, ofs, R_ALPHA_GPDISP));
-
- if (!gpdisp || gpdisp->r_addend != 4)
- {
- if (tsec_free)
- free (tsec_free);
- return 0;
- }
- if (tsec_free)
- free (tsec_free);
- }
-
- /* We've now determined that we can skip an initial gp load. Verify
- that the call and the target use the same gp. */
- if (info->link_info->hash->creator != info->tsec->owner->xvec
- || info->gotobj != alpha_elf_tdata (info->tsec->owner)->gotobj)
- return 0;
-
- return symval + 8;
-}
-
-static bfd_boolean
-elf64_alpha_relax_got_load (info, symval, irel, r_type)
- struct alpha_relax_info *info;
- bfd_vma symval;
- Elf_Internal_Rela *irel;
- unsigned long r_type;
-{
- unsigned int insn;
- bfd_signed_vma disp;
-
- /* Get the instruction. */
- insn = bfd_get_32 (info->abfd, info->contents + irel->r_offset);
-
- if (insn >> 26 != OP_LDQ)
- {
- reloc_howto_type *howto = elf64_alpha_howto_table + r_type;
- ((*_bfd_error_handler)
- ("%s: %s+0x%lx: warning: %s relocation against unexpected insn",
- bfd_archive_filename (info->abfd), info->sec->name,
- (unsigned long) irel->r_offset, howto->name));
- return TRUE;
- }
-
- /* Can't relax dynamic symbols. */
- if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
- return TRUE;
-
- /* Can't use local-exec relocations in shared libraries. */
- if (r_type == R_ALPHA_GOTTPREL && info->link_info->shared)
- return TRUE;
-
- if (r_type == R_ALPHA_LITERAL)
- disp = symval - info->gp;
- else
- {
- bfd_vma dtp_base, tp_base;
-
- BFD_ASSERT (elf_hash_table (info->link_info)->tls_sec != NULL);
- dtp_base = alpha_get_dtprel_base (info->link_info);
- tp_base = alpha_get_tprel_base (info->link_info);
- disp = symval - (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base);
- }
-
- if (disp < -0x8000 || disp >= 0x8000)
- return TRUE;
-
- /* Exchange LDQ for LDA. In the case of the TLS relocs, we're loading
- a constant, so force the base register to be $31. */
- if (r_type == R_ALPHA_LITERAL)
- insn = (OP_LDA << 26) | (insn & 0x03ff0000);
- else
- insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16);
- bfd_put_32 (info->abfd, (bfd_vma) insn, info->contents + irel->r_offset);
- info->changed_contents = TRUE;
-
- /* Reduce the use count on this got entry by one, possibly
- eliminating it. */
- if (--info->gotent->use_count == 0)
- {
- int sz = alpha_got_entry_size (r_type);
- alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
- if (!info->h)
- alpha_elf_tdata (info->gotobj)->local_got_size -= sz;
- }
-
- /* Smash the existing GOT relocation for its 16-bit immediate pair. */
- switch (r_type)
- {
- case R_ALPHA_LITERAL:
- r_type = R_ALPHA_GPREL16;
- break;
- case R_ALPHA_GOTDTPREL:
- r_type = R_ALPHA_DTPREL16;
- break;
- case R_ALPHA_GOTTPREL:
- r_type = R_ALPHA_TPREL16;
- break;
- default:
- BFD_ASSERT (0);
- return FALSE;
- }
-
- irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), r_type);
- info->changed_relocs = TRUE;
-
- /* ??? Search forward through this basic block looking for insns
- that use the target register. Stop after an insn modifying the
- register is seen, or after a branch or call.
-
- Any such memory load insn may be substituted by a load directly
- off the GP. This allows the memory load insn to be issued before
- the calculated GP register would otherwise be ready.
-
- Any such jsr insn can be replaced by a bsr if it is in range.
-
- This would mean that we'd have to _add_ relocations, the pain of
- which gives one pause. */
-
- return TRUE;
-}
-
-static bfd_boolean
-elf64_alpha_relax_gprelhilo (info, symval, irel, hi)
- struct alpha_relax_info *info;
- bfd_vma symval;
- Elf_Internal_Rela *irel;
- bfd_boolean hi;
-{
- unsigned int insn;
- bfd_signed_vma disp;
- bfd_byte *pos = info->contents + irel->r_offset;
-
- /* ??? This assumes that the compiler doesn't render
-
- array[i]
- as
- ldah t, array(gp) !gprelhigh
- s8addl i, t, t
- ldq r, array(t) !gprellow
-
- which would indeed be the most efficient way to implement this. */
-
- return TRUE;
-
- disp = symval - info->gp;
- if (disp < -0x8000 || disp >= 0x8000)
- return TRUE;
-
- if (hi)
- {
- /* Nop out the high instruction. */
-
- bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos);
- info->changed_contents = TRUE;
-
- irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- irel->r_addend = 0;
- info->changed_relocs = TRUE;
- }
- else
- {
- /* Adjust the low instruction to reference GP directly. */
-
- insn = bfd_get_32 (info->abfd, pos);
- insn = (insn & 0xffe00000) | (29 << 16);
- bfd_put_32 (info->abfd, (bfd_vma) insn, pos);
- info->changed_contents = TRUE;
-
- irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
- R_ALPHA_GPREL16);
- info->changed_relocs = TRUE;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
- struct alpha_relax_info *info;
- bfd_vma symval;
- Elf_Internal_Rela *irel;
- bfd_boolean is_gd;
-{
- bfd_byte *pos[5];
- unsigned int insn;
- Elf_Internal_Rela *gpdisp, *hint;
- bfd_boolean dynamic, use_gottprel, pos1_unusable;
- unsigned long new_symndx;
-
- dynamic = alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info);
-
- /* If a TLS symbol is accessed using IE at least once, there is no point
- to use dynamic model for it. */
- if (is_gd && info->h && (info->h->flags & ALPHA_ELF_LINK_HASH_TLS_IE))
- ;
-
- /* If the symbol is local, and we've already committed to DF_STATIC_TLS,
- then we might as well relax to IE. */
- else if (info->link_info->shared && !dynamic
- && (info->link_info->flags & DF_STATIC_TLS))
- ;
-
- /* Otherwise we must be building an executable to do anything. */
- else if (info->link_info->shared)
- return TRUE;
-
- /* The TLSGD/TLSLDM relocation must be followed by a LITERAL and
- the matching LITUSE_TLS relocations. */
- if (irel + 2 >= info->relend)
- return TRUE;
- if (ELF64_R_TYPE (irel[1].r_info) != R_ALPHA_LITERAL
- || ELF64_R_TYPE (irel[2].r_info) != R_ALPHA_LITUSE
- || irel[2].r_addend != (is_gd ? LITUSE_ALPHA_TLSGD : LITUSE_ALPHA_TLSLDM))
- return TRUE;
-
- /* There must be a GPDISP relocation positioned immediately after the
- LITUSE relocation. */
- gpdisp = elf64_alpha_find_reloc_at_ofs (info->relocs, info->relend,
- irel[2].r_offset + 4, R_ALPHA_GPDISP);
- if (!gpdisp)
- return TRUE;
-
- pos[0] = info->contents + irel[0].r_offset;
- pos[1] = info->contents + irel[1].r_offset;
- pos[2] = info->contents + irel[2].r_offset;
- pos[3] = info->contents + gpdisp->r_offset;
- pos[4] = pos[3] + gpdisp->r_addend;
- pos1_unusable = FALSE;
-
- /* Generally, the positions are not allowed to be out of order, lest the
- modified insn sequence have different register lifetimes. We can make
- an exception when pos 1 is adjacent to pos 0. */
- if (pos[1] + 4 == pos[0])
- {
- bfd_byte *tmp = pos[0];
- pos[0] = pos[1];
- pos[1] = tmp;
- }
- else if (pos[1] < pos[0])
- pos1_unusable = TRUE;
- if (pos[1] >= pos[2] || pos[2] >= pos[3])
- return TRUE;
-
- /* Reduce the use count on the LITERAL relocation. Do this before we
- smash the symndx when we adjust the relocations below. */
- {
- struct alpha_elf_got_entry *lit_gotent;
- struct alpha_elf_link_hash_entry *lit_h;
- unsigned long indx;
-
- BFD_ASSERT (ELF64_R_SYM (irel[1].r_info) >= info->symtab_hdr->sh_info);
- indx = ELF64_R_SYM (irel[1].r_info) - info->symtab_hdr->sh_info;
- lit_h = alpha_elf_sym_hashes (info->abfd)[indx];
-
- while (lit_h->root.root.type == bfd_link_hash_indirect
- || lit_h->root.root.type == bfd_link_hash_warning)
- lit_h = (struct alpha_elf_link_hash_entry *) lit_h->root.root.u.i.link;
-
- for (lit_gotent = lit_h->got_entries; lit_gotent ;
- lit_gotent = lit_gotent->next)
- if (lit_gotent->gotobj == info->gotobj
- && lit_gotent->reloc_type == R_ALPHA_LITERAL
- && lit_gotent->addend == irel[1].r_addend)
- break;
- BFD_ASSERT (lit_gotent);
-
- if (--lit_gotent->use_count == 0)
- {
- int sz = alpha_got_entry_size (R_ALPHA_LITERAL);
- alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
- }
- }
-
- /* Change
-
- lda $16,x($gp) !tlsgd!1
- ldq $27,__tls_get_addr($gp) !literal!1
- jsr $26,($27)__tls_get_addr !lituse_tlsgd!1
- ldah $29,0($26) !gpdisp!2
- lda $29,0($29) !gpdisp!2
- to
- ldq $16,x($gp) !gottprel
- unop
- call_pal rduniq
- addq $16,$0,$0
- unop
- or the first pair to
- lda $16,x($gp) !tprel
- unop
- or
- ldah $16,x($gp) !tprelhi
- lda $16,x($16) !tprello
-
- as appropriate. */
-
- use_gottprel = FALSE;
- new_symndx = is_gd ? ELF64_R_SYM (irel->r_info) : 0;
- switch (!dynamic && !info->link_info->shared)
- {
- case 1:
- {
- bfd_vma tp_base;
- bfd_signed_vma disp;
-
- BFD_ASSERT (elf_hash_table (info->link_info)->tls_sec != NULL);
- tp_base = alpha_get_tprel_base (info->link_info);
- disp = symval - tp_base;
-
- if (disp >= -0x8000 && disp < 0x8000)
- {
- insn = (OP_LDA << 26) | (16 << 21) | (31 << 16);
- bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
- bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]);
-
- irel[0].r_offset = pos[0] - info->contents;
- irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_TPREL16);
- irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- break;
- }
- else if (disp >= -(bfd_signed_vma) 0x80000000
- && disp < (bfd_signed_vma) 0x7fff8000
- && !pos1_unusable)
- {
- insn = (OP_LDAH << 26) | (16 << 21) | (31 << 16);
- bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
- insn = (OP_LDA << 26) | (16 << 21) | (16 << 16);
- bfd_put_32 (info->abfd, (bfd_vma) insn, pos[1]);
-
- irel[0].r_offset = pos[0] - info->contents;
- irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_TPRELHI);
- irel[1].r_offset = pos[1] - info->contents;
- irel[1].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_TPRELLO);
- break;
- }
- }
- /* FALLTHRU */
-
- default:
- use_gottprel = TRUE;
-
- insn = (OP_LDQ << 26) | (16 << 21) | (29 << 16);
- bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
- bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]);
-
- irel[0].r_offset = pos[0] - info->contents;
- irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_GOTTPREL);
- irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- break;
- }
-
- bfd_put_32 (info->abfd, (bfd_vma) INSN_RDUNIQ, pos[2]);
-
- insn = INSN_ADDQ | (16 << 21) | (0 << 16) | (0 << 0);
- bfd_put_32 (info->abfd, (bfd_vma) insn, pos[3]);
-
- bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[4]);
-
- irel[2].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- gpdisp->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
-
- hint = elf64_alpha_find_reloc_at_ofs (info->relocs, info->relend,
- irel[2].r_offset, R_ALPHA_HINT);
- if (hint)
- hint->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
-
- info->changed_contents = TRUE;
- info->changed_relocs = TRUE;
-
- /* Reduce the use count on the TLSGD/TLSLDM relocation. */
- if (--info->gotent->use_count == 0)
- {
- int sz = alpha_got_entry_size (info->gotent->reloc_type);
- alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
- if (!info->h)
- alpha_elf_tdata (info->gotobj)->local_got_size -= sz;
- }
-
- /* If we've switched to a GOTTPREL relocation, increment the reference
- count on that got entry. */
- if (use_gottprel)
- {
- struct alpha_elf_got_entry *tprel_gotent;
-
- for (tprel_gotent = *info->first_gotent; tprel_gotent ;
- tprel_gotent = tprel_gotent->next)
- if (tprel_gotent->gotobj == info->gotobj
- && tprel_gotent->reloc_type == R_ALPHA_GOTTPREL
- && tprel_gotent->addend == irel->r_addend)
- break;
- if (tprel_gotent)
- tprel_gotent->use_count++;
- else
- {
- if (info->gotent->use_count == 0)
- tprel_gotent = info->gotent;
- else
- {
- tprel_gotent = (struct alpha_elf_got_entry *)
- bfd_alloc (info->abfd, sizeof (struct alpha_elf_got_entry));
- if (!tprel_gotent)
- return FALSE;
-
- tprel_gotent->next = *info->first_gotent;
- *info->first_gotent = tprel_gotent;
-
- tprel_gotent->gotobj = info->gotobj;
- tprel_gotent->addend = irel->r_addend;
- tprel_gotent->got_offset = -1;
- tprel_gotent->reloc_done = 0;
- tprel_gotent->reloc_xlated = 0;
- }
-
- tprel_gotent->use_count = 1;
- tprel_gotent->reloc_type = R_ALPHA_GOTTPREL;
- }
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-elf64_alpha_relax_section (abfd, sec, link_info, again)
- bfd *abfd;
- asection *sec;
- struct bfd_link_info *link_info;
- bfd_boolean *again;
-{
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Rela *internal_relocs;
- Elf_Internal_Rela *irel, *irelend;
- Elf_Internal_Sym *isymbuf = NULL;
- struct alpha_elf_got_entry **local_got_entries;
- struct alpha_relax_info info;
-
- /* We are not currently changing any sizes, so only one pass. */
- *again = FALSE;
-
- if (link_info->relocatable
- || (sec->flags & SEC_RELOC) == 0
- || sec->reloc_count == 0)
- return TRUE;
-
- /* If this is the first time we have been called for this section,
- initialize the cooked size. */
- if (sec->_cooked_size == 0)
- sec->_cooked_size = sec->_raw_size;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- local_got_entries = alpha_elf_tdata(abfd)->local_got_entries;
-
- /* Load the relocations for this section. */
- internal_relocs = (_bfd_elf_link_read_relocs
- (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
- link_info->keep_memory));
- if (internal_relocs == NULL)
- return FALSE;
-
- memset(&info, 0, sizeof (info));
- info.abfd = abfd;
- info.sec = sec;
- info.link_info = link_info;
- info.symtab_hdr = symtab_hdr;
- info.relocs = internal_relocs;
- info.relend = irelend = internal_relocs + sec->reloc_count;
-
- /* Find the GP for this object. Do not store the result back via
- _bfd_set_gp_value, since this could change again before final. */
- info.gotobj = alpha_elf_tdata (abfd)->gotobj;
- if (info.gotobj)
- {
- asection *sgot = alpha_elf_tdata (info.gotobj)->got;
- info.gp = (sgot->output_section->vma
- + sgot->output_offset
- + 0x8000);
- }
-
- /* Get the section contents. */
- if (elf_section_data (sec)->this_hdr.contents != NULL)
- info.contents = elf_section_data (sec)->this_hdr.contents;
- else
- {
- info.contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
- if (info.contents == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, sec, info.contents,
- (file_ptr) 0, sec->_raw_size))
- goto error_return;
- }
-
- for (irel = internal_relocs; irel < irelend; irel++)
- {
- bfd_vma symval;
- struct alpha_elf_got_entry *gotent;
- unsigned long r_type = ELF64_R_TYPE (irel->r_info);
- unsigned long r_symndx = ELF64_R_SYM (irel->r_info);
-
- /* Early exit for unhandled or unrelaxable relocations. */
- switch (r_type)
- {
- case R_ALPHA_LITERAL:
- case R_ALPHA_GPRELHIGH:
- case R_ALPHA_GPRELLOW:
- case R_ALPHA_GOTDTPREL:
- case R_ALPHA_GOTTPREL:
- case R_ALPHA_TLSGD:
- break;
-
- case R_ALPHA_TLSLDM:
- /* The symbol for a TLSLDM reloc is ignored. Collapse the
- reloc to the 0 symbol so that they all match. */
- r_symndx = 0;
- break;
-
- default:
- continue;
- }
-
- /* Get the value of the symbol referred to by the reloc. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- /* A local symbol. */
- Elf_Internal_Sym *isym;
-
- /* Read this BFD's local symbols. */
- if (isymbuf == NULL)
- {
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- goto error_return;
- }
-
- isym = isymbuf + r_symndx;
-
- /* Given the symbol for a TLSLDM reloc is ignored, this also
- means forcing the symbol value to the tp base. */
- if (r_type == R_ALPHA_TLSLDM)
- {
- info.tsec = bfd_abs_section_ptr;
- symval = alpha_get_tprel_base (info.link_info);
- }
- else
- {
- symval = isym->st_value;
- if (isym->st_shndx == SHN_UNDEF)
- continue;
- else if (isym->st_shndx == SHN_ABS)
- info.tsec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- info.tsec = bfd_com_section_ptr;
- else
- info.tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
- }
-
- info.h = NULL;
- info.other = isym->st_other;
- if (local_got_entries)
- info.first_gotent = &local_got_entries[r_symndx];
- else
- {
- info.first_gotent = &info.gotent;
- info.gotent = NULL;
- }
- }
- else
- {
- unsigned long indx;
- struct alpha_elf_link_hash_entry *h;
-
- indx = r_symndx - symtab_hdr->sh_info;
- h = alpha_elf_sym_hashes (abfd)[indx];
- BFD_ASSERT (h != NULL);
-
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
-
- /* If the symbol is undefined, we can't do anything with it. */
- if (h->root.root.type == bfd_link_hash_undefweak
- || h->root.root.type == bfd_link_hash_undefined)
- continue;
-
- /* If the symbol isn't defined in the current module, again
- we can't do anything. */
- if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
- /* Except for TLSGD relocs, which can sometimes be
- relaxed to GOTTPREL relocs. */
- if (r_type != R_ALPHA_TLSGD)
- continue;
- info.tsec = bfd_abs_section_ptr;
- symval = 0;
- }
- else
- {
- info.tsec = h->root.root.u.def.section;
- symval = h->root.root.u.def.value;
- }
-
- info.h = h;
- info.other = h->root.other;
- info.first_gotent = &h->got_entries;
- }
-
- /* Search for the got entry to be used by this relocation. */
- for (gotent = *info.first_gotent; gotent ; gotent = gotent->next)
- if (gotent->gotobj == info.gotobj
- && gotent->reloc_type == r_type
- && gotent->addend == irel->r_addend)
- break;
- info.gotent = gotent;
-
- symval += info.tsec->output_section->vma + info.tsec->output_offset;
- symval += irel->r_addend;
-
- switch (r_type)
- {
- case R_ALPHA_LITERAL:
- BFD_ASSERT(info.gotent != NULL);
-
- /* If there exist LITUSE relocations immediately following, this
- opens up all sorts of interesting optimizations, because we
- now know every location that this address load is used. */
- if (irel+1 < irelend
- && ELF64_R_TYPE (irel[1].r_info) == R_ALPHA_LITUSE)
- {
- if (!elf64_alpha_relax_with_lituse (&info, symval, irel))
- goto error_return;
- }
- else
- {
- if (!elf64_alpha_relax_got_load (&info, symval, irel, r_type))
- goto error_return;
- }
- break;
-
- case R_ALPHA_GPRELHIGH:
- case R_ALPHA_GPRELLOW:
- if (!elf64_alpha_relax_gprelhilo (&info, symval, irel,
- r_type == R_ALPHA_GPRELHIGH))
- goto error_return;
- break;
-
- case R_ALPHA_GOTDTPREL:
- case R_ALPHA_GOTTPREL:
- BFD_ASSERT(info.gotent != NULL);
- if (!elf64_alpha_relax_got_load (&info, symval, irel, r_type))
- goto error_return;
- break;
-
- case R_ALPHA_TLSGD:
- case R_ALPHA_TLSLDM:
- BFD_ASSERT(info.gotent != NULL);
- if (!elf64_alpha_relax_tls_get_addr (&info, symval, irel,
- r_type == R_ALPHA_TLSGD))
- goto error_return;
- break;
- }
- }
-
- if (!elf64_alpha_size_plt_section (link_info))
- return FALSE;
- if (!elf64_alpha_size_got_sections (link_info))
- return FALSE;
- if (!elf64_alpha_size_rela_got_section (link_info))
- return FALSE;
-
- if (isymbuf != NULL
- && symtab_hdr->contents != (unsigned char *) isymbuf)
- {
- if (!link_info->keep_memory)
- free (isymbuf);
- else
- {
- /* Cache the symbols for elf_link_input_bfd. */
- symtab_hdr->contents = (unsigned char *) isymbuf;
- }
- }
-
- if (info.contents != NULL
- && elf_section_data (sec)->this_hdr.contents != info.contents)
- {
- if (!info.changed_contents && !link_info->keep_memory)
- free (info.contents);
- else
- {
- /* Cache the section contents for elf_link_input_bfd. */
- elf_section_data (sec)->this_hdr.contents = info.contents;
- }
- }
-
- if (elf_section_data (sec)->relocs != internal_relocs)
- {
- if (!info.changed_relocs)
- free (internal_relocs);
- else
- elf_section_data (sec)->relocs = internal_relocs;
- }
-
- *again = info.changed_contents || info.changed_relocs;
-
- return TRUE;
-
- error_return:
- if (isymbuf != NULL
- && symtab_hdr->contents != (unsigned char *) isymbuf)
- free (isymbuf);
- if (info.contents != NULL
- && elf_section_data (sec)->this_hdr.contents != info.contents)
- free (info.contents);
- if (internal_relocs != NULL
- && elf_section_data (sec)->relocs != internal_relocs)
- free (internal_relocs);
- return FALSE;
-}
-
-/* PLT/GOT Stuff */
-#define PLT_HEADER_SIZE 32
-#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 */
-#define PLT_ENTRY_WORD2 0
-#define PLT_ENTRY_WORD3 0
-
-#define MAX_GOT_SIZE (64*1024)
-
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so"
-
-/* Handle an Alpha specific section when reading an object file. This
- is called when elfcode.h finds a section with an unknown type.
- FIXME: We need to handle the SHF_ALPHA_GPREL flag, but I'm not sure
- how to. */
-
-static bfd_boolean
-elf64_alpha_section_from_shdr (abfd, hdr, name)
- bfd *abfd;
- Elf_Internal_Shdr *hdr;
- const char *name;
-{
- asection *newsect;
-
- /* There ought to be a place to keep ELF backend specific flags, but
- at the moment there isn't one. We just keep track of the
- sections by their name, instead. Fortunately, the ABI gives
- suggested names for all the MIPS specific sections, so we will
- probably get away with this. */
- switch (hdr->sh_type)
- {
- case SHT_ALPHA_DEBUG:
- if (strcmp (name, ".mdebug") != 0)
- return FALSE;
- break;
- default:
- return FALSE;
- }
-
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return FALSE;
- newsect = hdr->bfd_section;
-
- if (hdr->sh_type == SHT_ALPHA_DEBUG)
- {
- if (! bfd_set_section_flags (abfd, newsect,
- (bfd_get_section_flags (abfd, newsect)
- | SEC_DEBUGGING)))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Convert Alpha specific section flags to bfd internal section flags. */
-
-static bfd_boolean
-elf64_alpha_section_flags (flags, hdr)
- flagword *flags;
- Elf_Internal_Shdr *hdr;
-{
- if (hdr->sh_flags & SHF_ALPHA_GPREL)
- *flags |= SEC_SMALL_DATA;
-
- return TRUE;
-}
-
-/* Set the correct type for an Alpha ELF section. We do this by the
- section name, which is a hack, but ought to work. */
-
-static bfd_boolean
-elf64_alpha_fake_sections (abfd, hdr, sec)
- bfd *abfd;
- Elf_Internal_Shdr *hdr;
- asection *sec;
-{
- register const char *name;
-
- name = bfd_get_section_name (abfd, sec);
-
- if (strcmp (name, ".mdebug") == 0)
- {
- hdr->sh_type = SHT_ALPHA_DEBUG;
- /* In a shared object on Irix 5.3, the .mdebug section has an
- entsize of 0. FIXME: Does this matter? */
- if ((abfd->flags & DYNAMIC) != 0 )
- hdr->sh_entsize = 0;
- else
- hdr->sh_entsize = 1;
- }
- else if ((sec->flags & SEC_SMALL_DATA)
- || strcmp (name, ".sdata") == 0
- || strcmp (name, ".sbss") == 0
- || strcmp (name, ".lit4") == 0
- || strcmp (name, ".lit8") == 0)
- hdr->sh_flags |= SHF_ALPHA_GPREL;
-
- return TRUE;
-}
-
-/* Hook called by the linker routine which adds symbols from an object
- file. We use it to put .comm items in .sbss, and not .bss. */
-
-static bfd_boolean
-elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
- bfd *abfd;
- struct bfd_link_info *info;
- Elf_Internal_Sym *sym;
- const char **namep ATTRIBUTE_UNUSED;
- flagword *flagsp ATTRIBUTE_UNUSED;
- asection **secp;
- bfd_vma *valp;
-{
- if (sym->st_shndx == SHN_COMMON
- && !info->relocatable
- && sym->st_size <= elf_gp_size (abfd))
- {
- /* Common symbols less than or equal to -G nn bytes are
- automatically put into .sbss. */
-
- asection *scomm = bfd_get_section_by_name (abfd, ".scommon");
-
- if (scomm == NULL)
- {
- scomm = bfd_make_section (abfd, ".scommon");
- if (scomm == NULL
- || !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC
- | SEC_IS_COMMON
- | SEC_LINKER_CREATED)))
- return FALSE;
- }
-
- *secp = scomm;
- *valp = sym->st_size;
- }
-
- return TRUE;
-}
-
-/* Create the .got section. */
-
-static bfd_boolean
-elf64_alpha_create_got_section(abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
-{
- asection *s;
-
- if ((s = bfd_get_section_by_name (abfd, ".got")))
- {
- /* Check for a non-linker created .got? */
- if (alpha_elf_tdata (abfd)->got == NULL)
- alpha_elf_tdata (abfd)->got = s;
- return TRUE;
- }
-
- s = bfd_make_section (abfd, ".got");
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED))
- || !bfd_set_section_alignment (abfd, s, 3))
- return FALSE;
-
- alpha_elf_tdata (abfd)->got = s;
-
- return TRUE;
-}
-
-/* Create all the dynamic sections. */
-
-static bfd_boolean
-elf64_alpha_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- asection *s;
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
-
- /* We need to create .plt, .rela.plt, .got, and .rela.got sections. */
-
- s = bfd_make_section (abfd, ".plt");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_CODE))
- || ! bfd_set_section_alignment (abfd, s, 3))
- return FALSE;
-
- /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
- .plt section. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s,
- (bfd_vma) 0, (const char *) NULL, FALSE,
- get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (info->shared
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- s = bfd_make_section (abfd, ".rela.plt");
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (abfd, s, 3))
- return FALSE;
-
- /* We may or may not have created a .got section for this object, but
- we definitely havn't done the rest of the work. */
-
- if (!elf64_alpha_create_got_section (abfd, info))
- return FALSE;
-
- s = bfd_make_section(abfd, ".rela.got");
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (abfd, s, 3))
- return FALSE;
-
- /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the
- dynobj's .got section. We don't do this in the linker script
- because we don't want to define the symbol if we are not creating
- a global offset table. */
- bh = NULL;
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL,
- alpha_elf_tdata(abfd)->got, (bfd_vma) 0, (const char *) NULL,
- FALSE, get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (info->shared
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- elf_hash_table (info)->hgot = h;
-
- return TRUE;
-}
-
-/* Read ECOFF debugging information from a .mdebug section into a
- ecoff_debug_info structure. */
-
-static bfd_boolean
-elf64_alpha_read_ecoff_info (abfd, section, debug)
- bfd *abfd;
- asection *section;
- struct ecoff_debug_info *debug;
-{
- HDRR *symhdr;
- const struct ecoff_debug_swap *swap;
- char *ext_hdr = NULL;
-
- swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
- memset (debug, 0, sizeof (*debug));
-
- ext_hdr = (char *) bfd_malloc (swap->external_hdr_size);
- if (ext_hdr == NULL && swap->external_hdr_size != 0)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, section, ext_hdr, (file_ptr) 0,
- swap->external_hdr_size))
- goto error_return;
-
- symhdr = &debug->symbolic_header;
- (*swap->swap_hdr_in) (abfd, ext_hdr, symhdr);
-
- /* The symbolic header contains absolute file offsets and sizes to
- read. */
-#define READ(ptr, offset, count, size, type) \
- if (symhdr->count == 0) \
- debug->ptr = NULL; \
- else \
- { \
- 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_bread (debug->ptr, amt, abfd) != amt) \
- goto error_return; \
- }
-
- READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *);
- READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR);
- READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR);
- READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR);
- READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR);
- READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext),
- union aux_ext *);
- READ (ss, cbSsOffset, issMax, sizeof (char), char *);
- READ (ssext, cbSsExtOffset, issExtMax, sizeof (char), char *);
- READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR);
- READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR);
- READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, PTR);
-#undef READ
-
- debug->fdr = NULL;
- debug->adjust = NULL;
-
- return TRUE;
-
- error_return:
- if (ext_hdr != NULL)
- free (ext_hdr);
- if (debug->line != NULL)
- free (debug->line);
- if (debug->external_dnr != NULL)
- free (debug->external_dnr);
- if (debug->external_pdr != NULL)
- free (debug->external_pdr);
- if (debug->external_sym != NULL)
- free (debug->external_sym);
- if (debug->external_opt != NULL)
- free (debug->external_opt);
- if (debug->external_aux != NULL)
- free (debug->external_aux);
- if (debug->ss != NULL)
- free (debug->ss);
- if (debug->ssext != NULL)
- free (debug->ssext);
- if (debug->external_fdr != NULL)
- free (debug->external_fdr);
- if (debug->external_rfd != NULL)
- free (debug->external_rfd);
- if (debug->external_ext != NULL)
- free (debug->external_ext);
- return FALSE;
-}
-
-/* Alpha ELF local labels start with '$'. */
-
-static bfd_boolean
-elf64_alpha_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
-{
- return name[0] == '$';
-}
-
-/* Alpha ELF follows MIPS ELF in using a special find_nearest_line
- routine in order to handle the ECOFF debugging information. We
- still call this mips_elf_find_line because of the slot
- find_line_info in elf_obj_tdata is declared that way. */
-
-struct mips_elf_find_line
-{
- struct ecoff_debug_info d;
- struct ecoff_find_line i;
-};
-
-static bfd_boolean
-elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
- functionname_ptr, line_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *line_ptr;
-{
- asection *msec;
-
- if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr, 0,
- &elf_tdata (abfd)->dwarf2_find_line_info))
- return TRUE;
-
- msec = bfd_get_section_by_name (abfd, ".mdebug");
- if (msec != NULL)
- {
- flagword origflags;
- struct mips_elf_find_line *fi;
- const struct ecoff_debug_swap * const swap =
- get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
-
- /* If we are called during a link, alpha_elf_final_link may have
- cleared the SEC_HAS_CONTENTS field. We force it back on here
- if appropriate (which it normally will be). */
- origflags = msec->flags;
- if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS)
- msec->flags |= SEC_HAS_CONTENTS;
-
- fi = elf_tdata (abfd)->find_line_info;
- if (fi == NULL)
- {
- bfd_size_type external_fdr_size;
- char *fraw_src;
- char *fraw_end;
- struct fdr *fdr_ptr;
- bfd_size_type amt = sizeof (struct mips_elf_find_line);
-
- fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt);
- if (fi == NULL)
- {
- msec->flags = origflags;
- return FALSE;
- }
-
- if (!elf64_alpha_read_ecoff_info (abfd, msec, &fi->d))
- {
- msec->flags = origflags;
- return FALSE;
- }
-
- /* Swap in the FDR information. */
- 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;
- return FALSE;
- }
- external_fdr_size = swap->external_fdr_size;
- fdr_ptr = fi->d.fdr;
- fraw_src = (char *) fi->d.external_fdr;
- fraw_end = (fraw_src
- + fi->d.symbolic_header.ifdMax * external_fdr_size);
- for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++)
- (*swap->swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr);
-
- elf_tdata (abfd)->find_line_info = fi;
-
- /* Note that we don't bother to ever free this information.
- find_nearest_line is either called all the time, as in
- objdump -l, so the information should be saved, or it is
- rarely called, as in ld error messages, so the memory
- wasted is unimportant. Still, it would probably be a
- good idea for free_cached_info to throw it away. */
- }
-
- if (_bfd_ecoff_locate_line (abfd, section, offset, &fi->d, swap,
- &fi->i, filename_ptr, functionname_ptr,
- line_ptr))
- {
- msec->flags = origflags;
- return TRUE;
- }
-
- msec->flags = origflags;
- }
-
- /* Fall back on the generic ELF find_nearest_line routine. */
-
- return _bfd_elf_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr);
-}
-
-/* Structure used to pass information to alpha_elf_output_extsym. */
-
-struct extsym_info
-{
- bfd *abfd;
- struct bfd_link_info *info;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
- bfd_boolean failed;
-};
-
-static bfd_boolean
-elf64_alpha_output_extsym (h, data)
- struct alpha_elf_link_hash_entry *h;
- PTR data;
-{
- struct extsym_info *einfo = (struct extsym_info *) data;
- bfd_boolean strip;
- asection *sec, *output_section;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
- if (h->root.indx == -2)
- strip = FALSE;
- else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
- strip = TRUE;
- else if (einfo->info->strip == strip_all
- || (einfo->info->strip == strip_some
- && bfd_hash_lookup (einfo->info->keep_hash,
- h->root.root.root.string,
- FALSE, FALSE) == NULL))
- strip = TRUE;
- else
- strip = FALSE;
-
- if (strip)
- return TRUE;
-
- if (h->esym.ifd == -2)
- {
- h->esym.jmptbl = 0;
- h->esym.cobol_main = 0;
- h->esym.weakext = 0;
- h->esym.reserved = 0;
- h->esym.ifd = ifdNil;
- h->esym.asym.value = 0;
- h->esym.asym.st = stGlobal;
-
- if (h->root.root.type != bfd_link_hash_defined
- && h->root.root.type != bfd_link_hash_defweak)
- h->esym.asym.sc = scAbs;
- else
- {
- const char *name;
-
- sec = h->root.root.u.def.section;
- output_section = sec->output_section;
-
- /* When making a shared library and symbol h is the one from
- the another shared library, OUTPUT_SECTION may be null. */
- if (output_section == NULL)
- h->esym.asym.sc = scUndefined;
- else
- {
- name = bfd_section_name (output_section->owner, output_section);
-
- if (strcmp (name, ".text") == 0)
- h->esym.asym.sc = scText;
- else if (strcmp (name, ".data") == 0)
- h->esym.asym.sc = scData;
- else if (strcmp (name, ".sdata") == 0)
- h->esym.asym.sc = scSData;
- else if (strcmp (name, ".rodata") == 0
- || strcmp (name, ".rdata") == 0)
- h->esym.asym.sc = scRData;
- else if (strcmp (name, ".bss") == 0)
- h->esym.asym.sc = scBss;
- else if (strcmp (name, ".sbss") == 0)
- h->esym.asym.sc = scSBss;
- else if (strcmp (name, ".init") == 0)
- h->esym.asym.sc = scInit;
- else if (strcmp (name, ".fini") == 0)
- h->esym.asym.sc = scFini;
- else
- h->esym.asym.sc = scAbs;
- }
- }
-
- h->esym.asym.reserved = 0;
- h->esym.asym.index = indexNil;
- }
-
- if (h->root.root.type == bfd_link_hash_common)
- h->esym.asym.value = h->root.root.u.c.size;
- else if (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- {
- if (h->esym.asym.sc == scCommon)
- h->esym.asym.sc = scBss;
- else if (h->esym.asym.sc == scSCommon)
- h->esym.asym.sc = scSBss;
-
- sec = h->root.root.u.def.section;
- output_section = sec->output_section;
- if (output_section != NULL)
- h->esym.asym.value = (h->root.root.u.def.value
- + sec->output_offset
- + output_section->vma);
- else
- h->esym.asym.value = 0;
- }
- else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- /* Set type and value for a symbol with a function stub. */
- h->esym.asym.st = stProc;
- sec = bfd_get_section_by_name (einfo->abfd, ".plt");
- if (sec == NULL)
- h->esym.asym.value = 0;
- else
- {
- output_section = sec->output_section;
- if (output_section != NULL)
- h->esym.asym.value = (h->root.plt.offset
- + sec->output_offset
- + output_section->vma);
- else
- h->esym.asym.value = 0;
- }
- }
-
- if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,
- h->root.root.root.string,
- &h->esym))
- {
- einfo->failed = TRUE;
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Search for and possibly create a got entry. */
-
-static struct alpha_elf_got_entry *
-get_got_entry (abfd, h, r_type, r_symndx, r_addend)
- bfd *abfd;
- struct alpha_elf_link_hash_entry *h;
- unsigned long r_type, r_symndx;
- bfd_vma r_addend;
-{
- struct alpha_elf_got_entry *gotent;
- struct alpha_elf_got_entry **slot;
-
- if (h)
- slot = &h->got_entries;
- else
- {
- /* This is a local .got entry -- record for merge. */
-
- struct alpha_elf_got_entry **local_got_entries;
-
- local_got_entries = alpha_elf_tdata(abfd)->local_got_entries;
- if (!local_got_entries)
- {
- bfd_size_type size;
- Elf_Internal_Shdr *symtab_hdr;
-
- symtab_hdr = &elf_tdata(abfd)->symtab_hdr;
- size = symtab_hdr->sh_info;
- size *= sizeof (struct alpha_elf_got_entry *);
-
- local_got_entries
- = (struct alpha_elf_got_entry **) bfd_zalloc (abfd, size);
- if (!local_got_entries)
- return NULL;
-
- alpha_elf_tdata (abfd)->local_got_entries = local_got_entries;
- }
-
- slot = &local_got_entries[r_symndx];
- }
-
- for (gotent = *slot; gotent ; gotent = gotent->next)
- if (gotent->gotobj == abfd
- && gotent->reloc_type == r_type
- && gotent->addend == r_addend)
- break;
-
- if (!gotent)
- {
- int entry_size;
- bfd_size_type amt;
-
- amt = sizeof (struct alpha_elf_got_entry);
- gotent = (struct alpha_elf_got_entry *) bfd_alloc (abfd, amt);
- if (!gotent)
- return NULL;
-
- gotent->gotobj = abfd;
- gotent->addend = r_addend;
- gotent->got_offset = -1;
- gotent->use_count = 1;
- gotent->reloc_type = r_type;
- gotent->reloc_done = 0;
- gotent->reloc_xlated = 0;
-
- gotent->next = *slot;
- *slot = gotent;
-
- entry_size = alpha_got_entry_size (r_type);
- alpha_elf_tdata (abfd)->total_got_size += entry_size;
- if (!h)
- alpha_elf_tdata(abfd)->local_got_size += entry_size;
- }
- else
- gotent->use_count += 1;
-
- return gotent;
-}
-
-/* Handle dynamic relocations when doing an Alpha ELF link. */
-
-static bfd_boolean
-elf64_alpha_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- bfd *dynobj;
- asection *sreloc;
- const char *rel_sec_name;
- Elf_Internal_Shdr *symtab_hdr;
- struct alpha_elf_link_hash_entry **sym_hashes;
- const Elf_Internal_Rela *rel, *relend;
- bfd_boolean got_created;
- bfd_size_type amt;
-
- if (info->relocatable)
- return TRUE;
-
- dynobj = elf_hash_table(info)->dynobj;
- if (dynobj == NULL)
- elf_hash_table(info)->dynobj = dynobj = abfd;
-
- sreloc = NULL;
- rel_sec_name = NULL;
- symtab_hdr = &elf_tdata(abfd)->symtab_hdr;
- sym_hashes = alpha_elf_sym_hashes(abfd);
- got_created = FALSE;
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; ++rel)
- {
- enum {
- NEED_GOT = 1,
- NEED_GOT_ENTRY = 2,
- NEED_DYNREL = 4
- };
-
- unsigned long r_symndx, r_type;
- struct alpha_elf_link_hash_entry *h;
- unsigned int gotent_flags;
- bfd_boolean maybe_dynamic;
- unsigned int need;
- bfd_vma addend;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
-
- h->root.elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
- }
-
- /* We can only get preliminary data on whether a symbol is
- locally or externally defined, as not all of the input files
- have yet been processed. Do something with what we know, as
- this may help reduce memory usage and processing time later. */
- maybe_dynamic = FALSE;
- if (h && ((info->shared
- && (!info->symbolic || info->unresolved_syms_in_shared_libs == RM_IGNORE))
- || ! (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
- || h->root.root.type == bfd_link_hash_defweak))
- maybe_dynamic = TRUE;
-
- need = 0;
- gotent_flags = 0;
- r_type = ELF64_R_TYPE (rel->r_info);
- addend = rel->r_addend;
-
- switch (r_type)
- {
- case R_ALPHA_LITERAL:
- need = NEED_GOT | NEED_GOT_ENTRY;
-
- /* Remember how this literal is used from its LITUSEs.
- This will be important when it comes to decide if we can
- create a .plt entry for a function symbol. */
- while (++rel < relend && ELF64_R_TYPE (rel->r_info) == R_ALPHA_LITUSE)
- if (rel->r_addend >= 1 && rel->r_addend <= 5)
- gotent_flags |= 1 << rel->r_addend;
- --rel;
-
- /* No LITUSEs -- presumably the address is used somehow. */
- if (gotent_flags == 0)
- gotent_flags = ALPHA_ELF_LINK_HASH_LU_ADDR;
- break;
-
- case R_ALPHA_GPDISP:
- case R_ALPHA_GPREL16:
- case R_ALPHA_GPREL32:
- case R_ALPHA_GPRELHIGH:
- case R_ALPHA_GPRELLOW:
- case R_ALPHA_BRSGP:
- need = NEED_GOT;
- break;
-
- case R_ALPHA_REFLONG:
- case R_ALPHA_REFQUAD:
- if ((info->shared && (sec->flags & SEC_ALLOC)) || maybe_dynamic)
- need = NEED_DYNREL;
- break;
-
- case R_ALPHA_TLSLDM:
- /* The symbol for a TLSLDM reloc is ignored. Collapse the
- reloc to the 0 symbol so that they all match. */
- r_symndx = 0;
- h = 0;
- maybe_dynamic = FALSE;
- /* FALLTHRU */
-
- case R_ALPHA_TLSGD:
- case R_ALPHA_GOTDTPREL:
- need = NEED_GOT | NEED_GOT_ENTRY;
- break;
-
- case R_ALPHA_GOTTPREL:
- need = NEED_GOT | NEED_GOT_ENTRY;
- gotent_flags = ALPHA_ELF_LINK_HASH_TLS_IE;
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- break;
-
- case R_ALPHA_TPREL64:
- if (info->shared || maybe_dynamic)
- need = NEED_DYNREL;
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- break;
- }
-
- if (need & NEED_GOT)
- {
- if (!got_created)
- {
- if (!elf64_alpha_create_got_section (abfd, info))
- return FALSE;
-
- /* Make sure the object's gotobj is set to itself so
- that we default to every object with its own .got.
- We'll merge .gots later once we've collected each
- object's info. */
- alpha_elf_tdata(abfd)->gotobj = abfd;
-
- got_created = 1;
- }
- }
-
- if (need & NEED_GOT_ENTRY)
- {
- struct alpha_elf_got_entry *gotent;
-
- gotent = get_got_entry (abfd, h, r_type, r_symndx, addend);
- if (!gotent)
- return FALSE;
-
- if (gotent_flags)
- {
- gotent->flags |= gotent_flags;
- if (h)
- {
- gotent_flags |= h->flags;
- h->flags = gotent_flags;
-
- /* Make a guess as to whether a .plt entry is needed. */
- if ((gotent_flags & ALPHA_ELF_LINK_HASH_LU_FUNC)
- && !(gotent_flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC))
- h->root.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- else
- h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- }
-
- if (need & NEED_DYNREL)
- {
- if (rel_sec_name == NULL)
- {
- rel_sec_name = (bfd_elf_string_from_elf_section
- (abfd, elf_elfheader(abfd)->e_shstrndx,
- elf_section_data(sec)->rel_hdr.sh_name));
- if (rel_sec_name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
- rel_sec_name+5) == 0);
- }
-
- /* We need to create the section here now whether we eventually
- use it or not so that it gets mapped to an output section by
- the linker. If not used, we'll kill it in
- size_dynamic_sections. */
- if (sreloc == NULL)
- {
- 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, flags)
- || !bfd_set_section_alignment (dynobj, sreloc, 3))
- return FALSE;
- }
- }
-
- if (h)
- {
- /* Since we havn't seen all of the input symbols yet, we
- don't know whether we'll actually need a dynamic relocation
- entry for this reloc. So make a record of it. Once we
- find out if this thing needs dynamic relocation we'll
- expand the relocation sections by the appropriate amount. */
-
- struct alpha_elf_reloc_entry *rent;
-
- for (rent = h->reloc_entries; rent; rent = rent->next)
- if (rent->rtype == r_type && rent->srel == sreloc)
- break;
-
- if (!rent)
- {
- amt = sizeof (struct alpha_elf_reloc_entry);
- rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt);
- if (!rent)
- return FALSE;
-
- rent->srel = sreloc;
- rent->rtype = r_type;
- rent->count = 1;
- rent->reltext = ((sec->flags & (SEC_READONLY | SEC_ALLOC))
- == (SEC_READONLY | SEC_ALLOC));
-
- rent->next = h->reloc_entries;
- h->reloc_entries = rent;
- }
- else
- rent->count++;
- }
- else if (info->shared)
- {
- /* If this is a shared library, and the section is to be
- loaded into memory, we need a RELATIVE reloc. */
- sreloc->_raw_size += sizeof (Elf64_External_Rela);
- if ((sec->flags & (SEC_READONLY | SEC_ALLOC))
- == (SEC_READONLY | SEC_ALLOC))
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-elf64_alpha_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
-{
- bfd *dynobj;
- asection *s;
- struct alpha_elf_link_hash_entry *ah;
-
- dynobj = elf_hash_table(info)->dynobj;
- ah = (struct alpha_elf_link_hash_entry *)h;
-
- /* Now that we've seen all of the input symbols, finalize our decision
- about whether this symbol should get a .plt entry. */
-
- if (alpha_elf_dynamic_symbol_p (h, info)
- && ((h->type == STT_FUNC
- && !(ah->flags & ALPHA_ELF_LINK_HASH_LU_ADDR))
- || (h->type == STT_NOTYPE
- && (ah->flags & ALPHA_ELF_LINK_HASH_LU_FUNC)
- && !(ah->flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC)))
- /* Don't prevent otherwise valid programs from linking by attempting
- to create a new .got entry somewhere. A Correct Solution would be
- to add a new .got section to a new object file and let it be merged
- somewhere later. But for now don't bother. */
- && ah->got_entries)
- {
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
-
- s = bfd_get_section_by_name(dynobj, ".plt");
- if (!s && !elf64_alpha_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- /* The first bit of the .plt is reserved. */
- if (s->_raw_size == 0)
- s->_raw_size = PLT_HEADER_SIZE;
-
- h->plt.offset = s->_raw_size;
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* If this symbol is not defined in a regular file, and we are not
- generating a shared library, then set the symbol to the location
- in the .plt. This is required to make function pointers compare
- equal between the normal executable and the shared library. */
- if (! info->shared
- && h->root.type != bfd_link_hash_defweak)
- {
- ah->plt_old_section = h->root.u.def.section;
- ah->plt_old_value = h->root.u.def.value;
- ah->flags |= ALPHA_ELF_LINK_HASH_PLT_LOC;
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* We also need a JMP_SLOT entry in the .rela.plt section. */
- s = bfd_get_section_by_name (dynobj, ".rela.plt");
- BFD_ASSERT (s != NULL);
- s->_raw_size += sizeof (Elf64_External_Rela);
-
- return TRUE;
- }
- else
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. The Alpha, since it uses .got entries for all
- symbols even in regular objects, does not need the hackery of a
- .dynbss section and COPY dynamic relocations. */
-
- return TRUE;
-}
-
-/* Symbol versioning can create new symbols, and make our old symbols
- indirect to the new ones. Consolidate the got and reloc information
- in these situations. */
-
-static bfd_boolean
-elf64_alpha_merge_ind_symbols (hi, dummy)
- struct alpha_elf_link_hash_entry *hi;
- PTR dummy ATTRIBUTE_UNUSED;
-{
- struct alpha_elf_link_hash_entry *hs;
-
- if (hi->root.root.type != bfd_link_hash_indirect)
- return TRUE;
- hs = hi;
- do {
- hs = (struct alpha_elf_link_hash_entry *)hs->root.root.u.i.link;
- } while (hs->root.root.type == bfd_link_hash_indirect);
-
- /* Merge the flags. Whee. */
-
- hs->flags |= hi->flags;
-
- /* Merge the .got entries. Cannibalize the old symbol's list in
- doing so, since we don't need it anymore. */
-
- if (hs->got_entries == NULL)
- hs->got_entries = hi->got_entries;
- else
- {
- struct alpha_elf_got_entry *gi, *gs, *gin, *gsh;
-
- gsh = hs->got_entries;
- for (gi = hi->got_entries; gi ; gi = gin)
- {
- gin = gi->next;
- for (gs = gsh; gs ; gs = gs->next)
- if (gi->gotobj == gs->gotobj
- && gi->reloc_type == gs->reloc_type
- && gi->addend == gs->addend)
- {
- gi->use_count += gs->use_count;
- goto got_found;
- }
- gi->next = hs->got_entries;
- hs->got_entries = gi;
- got_found:;
- }
- }
- hi->got_entries = NULL;
-
- /* And similar for the reloc entries. */
-
- if (hs->reloc_entries == NULL)
- hs->reloc_entries = hi->reloc_entries;
- else
- {
- struct alpha_elf_reloc_entry *ri, *rs, *rin, *rsh;
-
- rsh = hs->reloc_entries;
- for (ri = hi->reloc_entries; ri ; ri = rin)
- {
- rin = ri->next;
- for (rs = rsh; rs ; rs = rs->next)
- if (ri->rtype == rs->rtype && ri->srel == rs->srel)
- {
- rs->count += ri->count;
- goto found_reloc;
- }
- ri->next = hs->reloc_entries;
- hs->reloc_entries = ri;
- found_reloc:;
- }
- }
- hi->reloc_entries = NULL;
-
- return TRUE;
-}
-
-/* Is it possible to merge two object file's .got tables? */
-
-static bfd_boolean
-elf64_alpha_can_merge_gots (a, b)
- bfd *a, *b;
-{
- int total = alpha_elf_tdata (a)->total_got_size;
- bfd *bsub;
-
- /* Trivial quick fallout test. */
- if (total + alpha_elf_tdata (b)->total_got_size <= MAX_GOT_SIZE)
- return TRUE;
-
- /* By their nature, local .got entries cannot be merged. */
- if ((total += alpha_elf_tdata (b)->local_got_size) > MAX_GOT_SIZE)
- return FALSE;
-
- /* Failing the common trivial comparison, we must effectively
- perform the merge. Not actually performing the merge means that
- we don't have to store undo information in case we fail. */
- for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next)
- {
- struct alpha_elf_link_hash_entry **hashes = alpha_elf_sym_hashes (bsub);
- Elf_Internal_Shdr *symtab_hdr = &elf_tdata (bsub)->symtab_hdr;
- int i, n;
-
- n = NUM_SHDR_ENTRIES (symtab_hdr) - symtab_hdr->sh_info;
- for (i = 0; i < n; ++i)
- {
- struct alpha_elf_got_entry *ae, *be;
- struct alpha_elf_link_hash_entry *h;
-
- h = hashes[i];
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
-
- for (be = h->got_entries; be ; be = be->next)
- {
- if (be->use_count == 0)
- continue;
- if (be->gotobj != b)
- continue;
-
- for (ae = h->got_entries; ae ; ae = ae->next)
- if (ae->gotobj == a
- && ae->reloc_type == be->reloc_type
- && ae->addend == be->addend)
- goto global_found;
-
- total += alpha_got_entry_size (be->reloc_type);
- if (total > MAX_GOT_SIZE)
- return FALSE;
- global_found:;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Actually merge two .got tables. */
-
-static void
-elf64_alpha_merge_gots (a, b)
- bfd *a, *b;
-{
- int total = alpha_elf_tdata (a)->total_got_size;
- bfd *bsub;
-
- /* Remember local expansion. */
- {
- int e = alpha_elf_tdata (b)->local_got_size;
- total += e;
- alpha_elf_tdata (a)->local_got_size += e;
- }
-
- for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next)
- {
- struct alpha_elf_got_entry **local_got_entries;
- struct alpha_elf_link_hash_entry **hashes;
- Elf_Internal_Shdr *symtab_hdr;
- int i, n;
-
- /* Let the local .got entries know they are part of a new subsegment. */
- local_got_entries = alpha_elf_tdata (bsub)->local_got_entries;
- if (local_got_entries)
- {
- n = elf_tdata (bsub)->symtab_hdr.sh_info;
- for (i = 0; i < n; ++i)
- {
- struct alpha_elf_got_entry *ent;
- for (ent = local_got_entries[i]; ent; ent = ent->next)
- ent->gotobj = a;
- }
- }
-
- /* Merge the global .got entries. */
- hashes = alpha_elf_sym_hashes (bsub);
- symtab_hdr = &elf_tdata (bsub)->symtab_hdr;
-
- n = NUM_SHDR_ENTRIES (symtab_hdr) - symtab_hdr->sh_info;
- for (i = 0; i < n; ++i)
- {
- struct alpha_elf_got_entry *ae, *be, **pbe, **start;
- struct alpha_elf_link_hash_entry *h;
-
- h = hashes[i];
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
-
- start = &h->got_entries;
- for (pbe = start, be = *start; be ; pbe = &be->next, be = be->next)
- {
- if (be->use_count == 0)
- {
- *pbe = be->next;
- continue;
- }
- if (be->gotobj != b)
- continue;
-
- for (ae = *start; ae ; ae = ae->next)
- if (ae->gotobj == a
- && ae->reloc_type == be->reloc_type
- && ae->addend == be->addend)
- {
- ae->flags |= be->flags;
- ae->use_count += be->use_count;
- *pbe = be->next;
- goto global_found;
- }
- be->gotobj = a;
- total += alpha_got_entry_size (be->reloc_type);
-
- global_found:;
- }
- }
-
- alpha_elf_tdata (bsub)->gotobj = a;
- }
- alpha_elf_tdata (a)->total_got_size = total;
-
- /* Merge the two in_got chains. */
- {
- bfd *next;
-
- bsub = a;
- while ((next = alpha_elf_tdata (bsub)->in_got_link_next) != NULL)
- bsub = next;
-
- alpha_elf_tdata (bsub)->in_got_link_next = b;
- }
-}
-
-/* Calculate the offsets for the got entries. */
-
-static bfd_boolean
-elf64_alpha_calc_got_offsets_for_symbol (h, arg)
- struct alpha_elf_link_hash_entry *h;
- PTR arg ATTRIBUTE_UNUSED;
-{
- bfd_boolean result = TRUE;
- struct alpha_elf_got_entry *gotent;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
- for (gotent = h->got_entries; gotent; gotent = gotent->next)
- if (gotent->use_count > 0)
- {
- struct alpha_elf_obj_tdata *td;
- bfd_size_type *plge;
-
- td = alpha_elf_tdata (gotent->gotobj);
- if (td == NULL)
- {
- _bfd_error_handler (_("Symbol %s has no GOT subsection for offset 0x%x"),
- h->root.root.root.string, gotent->got_offset);
- result = FALSE;
- continue;
- }
- plge = &td->got->_raw_size;
- gotent->got_offset = *plge;
- *plge += alpha_got_entry_size (gotent->reloc_type);
- }
-
- return result;
-}
-
-static void
-elf64_alpha_calc_got_offsets (info)
- struct bfd_link_info *info;
-{
- bfd *i, *got_list = alpha_elf_hash_table(info)->got_list;
-
- /* First, zero out the .got sizes, as we may be recalculating the
- .got after optimizing it. */
- for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next)
- alpha_elf_tdata(i)->got->_raw_size = 0;
-
- /* Next, fill in the offsets for all the global entries. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
- elf64_alpha_calc_got_offsets_for_symbol,
- NULL);
-
- /* Finally, fill in the offsets for the local entries. */
- for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next)
- {
- bfd_size_type got_offset = alpha_elf_tdata(i)->got->_raw_size;
- bfd *j;
-
- for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next)
- {
- struct alpha_elf_got_entry **local_got_entries, *gotent;
- int k, n;
-
- local_got_entries = alpha_elf_tdata(j)->local_got_entries;
- if (!local_got_entries)
- continue;
-
- for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k)
- for (gotent = local_got_entries[k]; gotent; gotent = gotent->next)
- if (gotent->use_count > 0)
- {
- gotent->got_offset = got_offset;
- got_offset += alpha_got_entry_size (gotent->reloc_type);
- }
- }
-
- alpha_elf_tdata(i)->got->_raw_size = got_offset;
- alpha_elf_tdata(i)->got->_cooked_size = got_offset;
- }
-}
-
-/* Constructs the gots. */
-
-static bfd_boolean
-elf64_alpha_size_got_sections (info)
- struct bfd_link_info *info;
-{
- bfd *i, *got_list, *cur_got_obj = NULL;
- int something_changed = 0;
-
- got_list = alpha_elf_hash_table (info)->got_list;
-
- /* On the first time through, pretend we have an existing got list
- consisting of all of the input files. */
- if (got_list == NULL)
- {
- for (i = info->input_bfds; i ; i = i->link_next)
- {
- bfd *this_got = alpha_elf_tdata (i)->gotobj;
- if (this_got == NULL)
- continue;
-
- /* We are assuming no merging has yet occurred. */
- BFD_ASSERT (this_got == i);
-
- if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE)
- {
- /* Yikes! A single object file has too many entries. */
- (*_bfd_error_handler)
- (_("%s: .got subsegment exceeds 64K (size %d)"),
- bfd_archive_filename (i),
- alpha_elf_tdata (this_got)->total_got_size);
- return FALSE;
- }
-
- if (got_list == NULL)
- got_list = this_got;
- else
- alpha_elf_tdata(cur_got_obj)->got_link_next = this_got;
- cur_got_obj = this_got;
- }
-
- /* Strange degenerate case of no got references. */
- if (got_list == NULL)
- return TRUE;
-
- alpha_elf_hash_table (info)->got_list = got_list;
-
- /* Force got offsets to be recalculated. */
- something_changed = 1;
- }
-
- cur_got_obj = got_list;
- i = alpha_elf_tdata(cur_got_obj)->got_link_next;
- while (i != NULL)
- {
- if (elf64_alpha_can_merge_gots (cur_got_obj, i))
- {
- elf64_alpha_merge_gots (cur_got_obj, i);
- i = alpha_elf_tdata(i)->got_link_next;
- alpha_elf_tdata(cur_got_obj)->got_link_next = i;
- something_changed = 1;
- }
- else
- {
- cur_got_obj = i;
- i = alpha_elf_tdata(i)->got_link_next;
- }
- }
-
- /* Once the gots have been merged, fill in the got offsets for
- everything therein. */
- if (1 || something_changed)
- elf64_alpha_calc_got_offsets (info);
-
- return TRUE;
-}
-
-/* Called from relax_section to rebuild the PLT in light of
- potential changes in the function's status. */
-
-static bfd_boolean
-elf64_alpha_size_plt_section (info)
- struct bfd_link_info *info;
-{
- asection *splt, *spltrel;
- unsigned long entries;
- bfd *dynobj;
-
- dynobj = elf_hash_table(info)->dynobj;
- splt = bfd_get_section_by_name(dynobj, ".plt");
- if (splt == NULL)
- return TRUE;
-
- splt->_raw_size = 0;
-
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
- elf64_alpha_size_plt_section_1, splt);
-
- splt->_cooked_size = splt->_raw_size;
-
- /* Every plt entry requires a JMP_SLOT relocation. */
- spltrel = bfd_get_section_by_name (dynobj, ".rela.plt");
- if (splt->_raw_size)
- entries = (splt->_raw_size - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE;
- else
- entries = 0;
- spltrel->_raw_size = entries * sizeof (Elf64_External_Rela);
- spltrel->_cooked_size = spltrel->_raw_size;
-
- return TRUE;
-}
-
-static bfd_boolean
-elf64_alpha_size_plt_section_1 (h, data)
- struct alpha_elf_link_hash_entry *h;
- PTR data;
-{
- asection *splt = (asection *) data;
- struct alpha_elf_got_entry *gotent;
-
- /* If we didn't need an entry before, we still don't. */
- if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT))
- return TRUE;
-
- /* There must still be a LITERAL got entry for the function. */
- for (gotent = h->got_entries; gotent ; gotent = gotent->next)
- if (gotent->reloc_type == R_ALPHA_LITERAL
- && gotent->use_count > 0)
- break;
-
- /* If there is, reset the PLT offset. If not, there's no longer
- a need for the PLT entry. */
- if (gotent)
- {
- if (splt->_raw_size == 0)
- splt->_raw_size = PLT_HEADER_SIZE;
- h->root.plt.offset = splt->_raw_size;
- splt->_raw_size += PLT_ENTRY_SIZE;
- }
- else
- {
- h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- h->root.plt.offset = -1;
-
- /* Undo the definition frobbing begun in adjust_dynamic_symbol. */
- if (h->flags & ALPHA_ELF_LINK_HASH_PLT_LOC)
- {
- h->root.root.u.def.section = h->plt_old_section;
- h->root.root.u.def.value = h->plt_old_value;
- h->flags &= ~ALPHA_ELF_LINK_HASH_PLT_LOC;
- }
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-elf64_alpha_always_size_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- bfd *i;
-
- if (info->relocatable)
- return TRUE;
-
- /* First, take care of the indirect symbols created by versioning. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
- elf64_alpha_merge_ind_symbols,
- NULL);
-
- if (!elf64_alpha_size_got_sections (info))
- return FALSE;
-
- /* Allocate space for all of the .got subsections. */
- i = alpha_elf_hash_table (info)->got_list;
- for ( ; i ; i = alpha_elf_tdata(i)->got_link_next)
- {
- asection *s = alpha_elf_tdata(i)->got;
- if (s->_raw_size > 0)
- {
- s->contents = (bfd_byte *) bfd_zalloc (i, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* The number of dynamic relocations required by a static relocation. */
-
-static int
-alpha_dynamic_entries_for_reloc (r_type, dynamic, shared)
- int r_type, dynamic, shared;
-{
- switch (r_type)
- {
- /* May appear in GOT entries. */
- case R_ALPHA_TLSGD:
- return (dynamic ? 2 : shared ? 1 : 0);
- case R_ALPHA_TLSLDM:
- return shared;
- case R_ALPHA_LITERAL:
- case R_ALPHA_GOTTPREL:
- return dynamic || shared;
- case R_ALPHA_GOTDTPREL:
- return dynamic;
-
- /* May appear in data sections. */
- case R_ALPHA_REFLONG:
- case R_ALPHA_REFQUAD:
- case R_ALPHA_TPREL64:
- return dynamic || shared;
-
- /* Everything else is illegal. We'll issue an error during
- relocate_section. */
- default:
- return 0;
- }
-}
-
-/* Work out the sizes of the dynamic relocation entries. */
-
-static bfd_boolean
-elf64_alpha_calc_dynrel_sizes (h, info)
- struct alpha_elf_link_hash_entry *h;
- struct bfd_link_info *info;
-{
- bfd_boolean dynamic;
- struct alpha_elf_reloc_entry *relent;
- unsigned long entries;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
- /* If the symbol was defined as a common symbol in a regular object
- file, and there was no definition in any dynamic object, then the
- linker will have allocated space for the symbol in a common
- section but the ELF_LINK_HASH_DEF_REGULAR flag will not have been
- set. This is done for dynamic symbols in
- elf_adjust_dynamic_symbol but this is not done for non-dynamic
- symbols, somehow. */
- if (((h->root.elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_DYNAMIC))
- == ELF_LINK_HASH_REF_REGULAR)
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- && !(h->root.root.u.def.section->owner->flags & DYNAMIC))
- h->root.elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
-
- /* If the symbol is dynamic, we'll need all the relocations in their
- natural form. If this is a shared object, and it has been forced
- local, we'll need the same number of RELATIVE relocations. */
-
- dynamic = alpha_elf_dynamic_symbol_p (&h->root, info);
-
- for (relent = h->reloc_entries; relent; relent = relent->next)
- {
- entries = alpha_dynamic_entries_for_reloc (relent->rtype, dynamic,
- info->shared);
- if (entries)
- {
- relent->srel->_raw_size +=
- entries * sizeof (Elf64_External_Rela) * relent->count;
- if (relent->reltext)
- info->flags |= DT_TEXTREL;
- }
- }
-
- return TRUE;
-}
-
-/* Set the sizes of the dynamic relocation sections. */
-
-static bfd_boolean
-elf64_alpha_size_rela_got_section (info)
- struct bfd_link_info *info;
-{
- unsigned long entries;
- bfd *i, *dynobj;
- asection *srel;
-
- /* Shared libraries often require RELATIVE relocs, and some relocs
- require attention for the main application as well. */
-
- entries = 0;
- for (i = alpha_elf_hash_table(info)->got_list;
- i ; i = alpha_elf_tdata(i)->got_link_next)
- {
- bfd *j;
-
- for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next)
- {
- struct alpha_elf_got_entry **local_got_entries, *gotent;
- int k, n;
-
- local_got_entries = alpha_elf_tdata(j)->local_got_entries;
- if (!local_got_entries)
- continue;
-
- for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k)
- for (gotent = local_got_entries[k];
- gotent ; gotent = gotent->next)
- if (gotent->use_count > 0)
- entries += (alpha_dynamic_entries_for_reloc
- (gotent->reloc_type, 0, info->shared));
- }
- }
-
- dynobj = elf_hash_table(info)->dynobj;
- srel = bfd_get_section_by_name (dynobj, ".rela.got");
- if (!srel)
- {
- BFD_ASSERT (entries == 0);
- return TRUE;
- }
- srel->_raw_size = sizeof (Elf64_External_Rela) * entries;
-
- /* Now do the non-local symbols. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
- elf64_alpha_size_rela_got_1, info);
-
- srel->_cooked_size = srel->_raw_size;
-
- return TRUE;
-}
-
-/* Subroutine of elf64_alpha_size_rela_got_section for doing the
- global symbols. */
-
-static bfd_boolean
-elf64_alpha_size_rela_got_1 (h, info)
- struct alpha_elf_link_hash_entry *h;
- struct bfd_link_info *info;
-{
- bfd_boolean dynamic;
- struct alpha_elf_got_entry *gotent;
- unsigned long entries;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
- /* If the symbol is dynamic, we'll need all the relocations in their
- natural form. If this is a shared object, and it has been forced
- local, we'll need the same number of RELATIVE relocations. */
-
- dynamic = alpha_elf_dynamic_symbol_p (&h->root, info);
-
- entries = 0;
- for (gotent = h->got_entries; gotent ; gotent = gotent->next)
- if (gotent->use_count > 0)
- entries += alpha_dynamic_entries_for_reloc (gotent->reloc_type,
- dynamic, info->shared);
-
- /* If we are using a .plt entry, subtract one, as the first
- reference uses a .rela.plt entry instead. */
- if (h->root.plt.offset != MINUS_ONE)
- entries--;
-
- if (entries > 0)
- {
- bfd *dynobj = elf_hash_table(info)->dynobj;
- asection *srel = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srel != NULL);
- srel->_raw_size += sizeof (Elf64_External_Rela) * entries;
- }
-
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-elf64_alpha_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- asection *s;
- bfd_boolean relplt;
-
- dynobj = elf_hash_table(info)->dynobj;
- BFD_ASSERT(dynobj != NULL);
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
-
- /* Now that we've seen all of the input files, we can decide which
- symbols need dynamic relocation entries and which don't. We've
- collected information in check_relocs that we can now apply to
- size the dynamic relocation sections. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
- elf64_alpha_calc_dynrel_sizes, info);
-
- elf64_alpha_size_rela_got_section (info);
- }
- /* else we're not dynamic and by definition we don't need such things. */
-
- /* The check_relocs and adjust_dynamic_symbol entry points have
- determined the sizes of the various dynamic sections. Allocate
- memory for them. */
- relplt = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- const char *name;
- bfd_boolean strip;
-
- if (!(s->flags & SEC_LINKER_CREATED))
- continue;
-
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
-
- /* If we don't need this section, strip it from the output file.
- This is to handle .rela.bss and .rela.plt. We must create it
- in create_dynamic_sections, because it must be created before
- the linker maps input sections to output sections. The
- linker does that before adjust_dynamic_symbol is called, and
- it is that function which decides whether anything needs to
- go into these sections. */
-
- strip = FALSE;
-
- if (strncmp (name, ".rela", 5) == 0)
- {
- strip = (s->_raw_size == 0);
-
- if (!strip)
- {
- if (strcmp(name, ".rela.plt") == 0)
- relplt = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- }
- else if (strcmp (name, ".plt") != 0)
- {
- /* It's not one of our dynamic sections, so don't allocate space. */
- continue;
- }
-
- if (strip)
- _bfd_strip_section_from_output (info, s);
- else
- {
- /* Allocate memory for the section contents. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return FALSE;
- }
- }
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in elf64_alpha_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (relplt)
- {
- 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 (!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 (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-/* Emit a dynamic relocation for (DYNINDX, RTYPE, ADDEND) at (SEC, OFFSET)
- into the next available slot in SREL. */
-
-static void
-elf64_alpha_emit_dynrel (abfd, info, sec, srel, offset, dynindx, rtype, addend)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec, *srel;
- bfd_vma offset, addend;
- long dynindx, rtype;
-{
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- BFD_ASSERT (srel != NULL);
-
- outrel.r_info = ELF64_R_INFO (dynindx, rtype);
- outrel.r_addend = addend;
-
- offset = _bfd_elf_section_offset (abfd, info, sec, offset);
- if ((offset | 1) != (bfd_vma) -1)
- outrel.r_offset = sec->output_section->vma + sec->output_offset + offset;
- else
- memset (&outrel, 0, sizeof (outrel));
-
- loc = srel->contents;
- loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (abfd, &outrel, loc);
- BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
- <= srel->_cooked_size);
-}
-
-/* Relocate an Alpha ELF section for a relocatable link.
-
- We don't have to change anything unless the reloc is against a section
- symbol, in which case we have to adjust according to where the section
- symbol winds up in the output section. */
-
-static bfd_boolean
-elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- unsigned long symtab_hdr_sh_info;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
- bfd_boolean ret_val = TRUE;
-
- symtab_hdr_sh_info = elf_tdata (input_bfd)->symtab_hdr.sh_info;
-
- relend = relocs + input_section->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- Elf_Internal_Sym *sym;
- asection *sec;
- unsigned long r_type;
-
- r_type = ELF64_R_TYPE(rel->r_info);
- if (r_type >= R_ALPHA_max)
- {
- (*_bfd_error_handler)
- (_("%s: unknown relocation type %d"),
- bfd_archive_filename (input_bfd), (int)r_type);
- bfd_set_error (bfd_error_bad_value);
- ret_val = FALSE;
- continue;
- }
-
- r_symndx = ELF64_R_SYM(rel->r_info);
-
- /* The symbol associated with GPDISP and LITUSE is
- immaterial. Only the addend is significant. */
- if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE)
- continue;
-
- if (r_symndx < symtab_hdr_sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
- }
-
- return ret_val;
-}
-
-/* Relocate an Alpha ELF section. */
-
-static bfd_boolean
-elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
- asection *sgot, *srel, *srelgot;
- bfd *dynobj, *gotobj;
- bfd_vma gp, tp_base, dtp_base;
- struct alpha_elf_got_entry **local_got_entries;
- bfd_boolean ret_val;
- const char *section_name;
-
- /* Handle relocatable links with a smaller loop. */
- if (info->relocatable)
- return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd,
- input_section, contents, relocs,
- local_syms, local_sections);
-
- /* This is a final link. */
-
- ret_val = TRUE;
-
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-
- dynobj = elf_hash_table (info)->dynobj;
- if (dynobj)
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- else
- srelgot = NULL;
-
- section_name = (bfd_elf_string_from_elf_section
- (input_bfd, elf_elfheader(input_bfd)->e_shstrndx,
- elf_section_data(input_section)->rel_hdr.sh_name));
- BFD_ASSERT(section_name != NULL);
- srel = bfd_get_section_by_name (dynobj, section_name);
-
- /* Find the gp value for this input bfd. */
- gotobj = alpha_elf_tdata (input_bfd)->gotobj;
- if (gotobj)
- {
- sgot = alpha_elf_tdata (gotobj)->got;
- gp = _bfd_get_gp_value (gotobj);
- if (gp == 0)
- {
- gp = (sgot->output_section->vma
- + sgot->output_offset
- + 0x8000);
- _bfd_set_gp_value (gotobj, gp);
- }
- }
- else
- {
- sgot = NULL;
- gp = 0;
- }
-
- local_got_entries = alpha_elf_tdata(input_bfd)->local_got_entries;
-
- if (elf_hash_table (info)->tls_sec != NULL)
- {
- dtp_base = alpha_get_dtprel_base (info);
- tp_base = alpha_get_tprel_base (info);
- }
- else
- dtp_base = tp_base = 0;
-
- relend = relocs + input_section->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- struct alpha_elf_link_hash_entry *h = NULL;
- struct alpha_elf_got_entry *gotent;
- bfd_reloc_status_type r;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- Elf_Internal_Sym *sym = NULL;
- asection *sec = NULL;
- bfd_vma value;
- bfd_vma addend;
- bfd_boolean dynamic_symbol_p;
- bfd_boolean undef_weak_ref = FALSE;
- unsigned long r_type;
-
- r_type = ELF64_R_TYPE(rel->r_info);
- if (r_type >= R_ALPHA_max)
- {
- (*_bfd_error_handler)
- (_("%s: unknown relocation type %d"),
- bfd_archive_filename (input_bfd), (int)r_type);
- bfd_set_error (bfd_error_bad_value);
- ret_val = FALSE;
- continue;
- }
-
- howto = elf64_alpha_howto_table + r_type;
- r_symndx = ELF64_R_SYM(rel->r_info);
-
- /* The symbol for a TLSLDM reloc is ignored. Collapse the
- reloc to the 0 symbol so that they all match. */
- if (r_type == R_ALPHA_TLSLDM)
- r_symndx = 0;
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- asection *msec;
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- msec = sec;
- value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
-
- /* If this is a tp-relative relocation against sym 0,
- this is hackery from relax_section. Force the value to
- be the tls base. */
- if (r_symndx == 0
- && (r_type == R_ALPHA_TLSLDM
- || r_type == R_ALPHA_GOTTPREL
- || r_type == R_ALPHA_TPREL64
- || r_type == R_ALPHA_TPRELHI
- || r_type == R_ALPHA_TPRELLO
- || r_type == R_ALPHA_TPREL16))
- value = tp_base;
-
- if (local_got_entries)
- gotent = local_got_entries[r_symndx];
- else
- gotent = NULL;
-
- /* Need to adjust local GOT entries' addends for SEC_MERGE
- unless it has been done already. */
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && sec->sec_info_type == ELF_INFO_TYPE_MERGE
- && gotent
- && !gotent->reloc_xlated)
- {
- struct alpha_elf_got_entry *ent;
-
- for (ent = gotent; ent; ent = ent->next)
- {
- ent->reloc_xlated = 1;
- if (ent->use_count == 0)
- continue;
- msec = sec;
- ent->addend =
- _bfd_merged_section_offset (output_bfd, &msec,
- elf_section_data (sec)->
- sec_info,
- sym->st_value + ent->addend,
- (bfd_vma) 0);
- ent->addend -= sym->st_value;
- ent->addend += msec->output_section->vma
- + msec->output_offset
- - sec->output_section->vma
- - sec->output_offset;
- }
- }
-
- dynamic_symbol_p = FALSE;
- }
- else
- {
- bfd_boolean warned;
- bfd_boolean unresolved_reloc;
- struct elf_link_hash_entry *hh;
- struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- hh, sec, value,
- unresolved_reloc, warned);
-
- if (warned)
- continue;
-
- if (value == 0
- && ! unresolved_reloc
- && hh->root.type == bfd_link_hash_undefweak)
- undef_weak_ref = TRUE;
-
- h = (struct alpha_elf_link_hash_entry *) hh;
- dynamic_symbol_p = alpha_elf_dynamic_symbol_p (&h->root, info);
- gotent = h->got_entries;
- }
-
- addend = rel->r_addend;
- value += addend;
-
- /* Search for the proper got entry. */
- for (; gotent ; gotent = gotent->next)
- if (gotent->gotobj == gotobj
- && gotent->reloc_type == r_type
- && gotent->addend == addend)
- break;
-
- switch (r_type)
- {
- case R_ALPHA_GPDISP:
- {
- bfd_byte *p_ldah, *p_lda;
-
- BFD_ASSERT(gp != 0);
-
- value = (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
-
- p_ldah = contents + rel->r_offset;
- p_lda = p_ldah + rel->r_addend;
-
- r = elf64_alpha_do_reloc_gpdisp (input_bfd, gp - value,
- p_ldah, p_lda);
- }
- break;
-
- case R_ALPHA_LITERAL:
- BFD_ASSERT(sgot != NULL);
- BFD_ASSERT(gp != 0);
- BFD_ASSERT(gotent != NULL);
- BFD_ASSERT(gotent->use_count >= 1);
-
- if (!gotent->reloc_done)
- {
- gotent->reloc_done = 1;
-
- bfd_put_64 (output_bfd, value,
- sgot->contents + gotent->got_offset);
-
- /* If the symbol has been forced local, output a
- RELATIVE reloc, otherwise it will be handled in
- finish_dynamic_symbol. */
- if (info->shared && !dynamic_symbol_p)
- elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
- gotent->got_offset, 0,
- R_ALPHA_RELATIVE, value);
- }
-
- value = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- value -= gp;
- goto default_reloc;
-
- case R_ALPHA_GPREL32:
- /* If the target section was a removed linkonce section,
- r_symndx will be zero. In this case, assume that the
- switch will not be used, so don't fill it in. If we
- do nothing here, we'll get relocation truncated messages,
- due to the placement of the application above 4GB. */
- if (r_symndx == 0)
- {
- r = bfd_reloc_ok;
- break;
- }
- /* FALLTHRU */
-
- case R_ALPHA_GPREL16:
- case R_ALPHA_GPRELLOW:
- if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: gp-relative relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = FALSE;
- }
- BFD_ASSERT(gp != 0);
- value -= gp;
- goto default_reloc;
-
- case R_ALPHA_GPRELHIGH:
- if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: gp-relative relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = FALSE;
- }
- BFD_ASSERT(gp != 0);
- value -= gp;
- value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
- goto default_reloc;
-
- case R_ALPHA_HINT:
- /* A call to a dynamic symbol is definitely out of range of
- the 16-bit displacement. Don't bother writing anything. */
- if (dynamic_symbol_p)
- {
- r = bfd_reloc_ok;
- break;
- }
- /* The regular PC-relative stuff measures from the start of
- the instruction rather than the end. */
- value -= 4;
- goto default_reloc;
-
- case R_ALPHA_BRADDR:
- if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: pc-relative relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = FALSE;
- }
- /* The regular PC-relative stuff measures from the start of
- the instruction rather than the end. */
- value -= 4;
- goto default_reloc;
-
- case R_ALPHA_BRSGP:
- {
- int other;
- const char *name;
-
- /* The regular PC-relative stuff measures from the start of
- the instruction rather than the end. */
- value -= 4;
-
- /* The source and destination gp must be the same. Note that
- the source will always have an assigned gp, since we forced
- one in check_relocs, but that the destination may not, as
- it might not have had any relocations at all. Also take
- care not to crash if H is an undefined symbol. */
- if (h != NULL && sec != NULL
- && alpha_elf_tdata (sec->owner)->gotobj
- && gotobj != alpha_elf_tdata (sec->owner)->gotobj)
- {
- (*_bfd_error_handler)
- (_("%s: change in gp: BRSGP %s"),
- bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = FALSE;
- }
-
- /* The symbol should be marked either NOPV or STD_GPLOAD. */
- if (h != NULL)
- other = h->root.other;
- else
- other = sym->st_other;
- switch (other & STO_ALPHA_STD_GPLOAD)
- {
- case STO_ALPHA_NOPV:
- break;
- case STO_ALPHA_STD_GPLOAD:
- value += 8;
- break;
- default:
- if (h != NULL)
- name = h->root.root.root.string;
- else
- {
- name = (bfd_elf_string_from_elf_section
- (input_bfd, symtab_hdr->sh_link, sym->st_name));
- if (name == NULL)
- name = _("<unknown>");
- else if (name[0] == 0)
- name = bfd_section_name (input_bfd, sec);
- }
- (*_bfd_error_handler)
- (_("%s: !samegp reloc against symbol without .prologue: %s"),
- bfd_archive_filename (input_bfd), name);
- ret_val = FALSE;
- break;
- }
-
- goto default_reloc;
- }
-
- case R_ALPHA_REFLONG:
- case R_ALPHA_REFQUAD:
- case R_ALPHA_DTPREL64:
- case R_ALPHA_TPREL64:
- {
- long dynindx, dyntype = r_type;
- bfd_vma dynaddend;
-
- /* Careful here to remember RELATIVE relocations for global
- variables for symbolic shared objects. */
-
- if (dynamic_symbol_p)
- {
- BFD_ASSERT(h->root.dynindx != -1);
- dynindx = h->root.dynindx;
- dynaddend = addend;
- addend = 0, value = 0;
- }
- else if (r_type == R_ALPHA_DTPREL64)
- {
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- value -= dtp_base;
- goto default_reloc;
- }
- else if (r_type == R_ALPHA_TPREL64)
- {
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- if (!info->shared)
- {
- value -= tp_base;
- goto default_reloc;
- }
- dynindx = 0;
- dynaddend = value - dtp_base;
- }
- else if (info->shared
- && r_symndx != 0
- && (input_section->flags & SEC_ALLOC))
- {
- if (r_type == R_ALPHA_REFLONG)
- {
- (*_bfd_error_handler)
- (_("%s: unhandled dynamic relocation against %s"),
- bfd_archive_filename (input_bfd),
- h->root.root.root.string);
- ret_val = FALSE;
- }
- dynindx = 0;
- dyntype = R_ALPHA_RELATIVE;
- dynaddend = value;
- }
- else
- goto default_reloc;
-
- elf64_alpha_emit_dynrel (output_bfd, info, input_section,
- srel, rel->r_offset, dynindx,
- dyntype, dynaddend);
- }
- goto default_reloc;
-
- case R_ALPHA_SREL16:
- case R_ALPHA_SREL32:
- case R_ALPHA_SREL64:
- if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: pc-relative relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = FALSE;
- }
-
- /* ??? .eh_frame references to discarded sections will be smashed
- to relocations against SHN_UNDEF. The .eh_frame format allows
- NULL to be encoded as 0 in any format, so this works here. */
- if (r_symndx == 0)
- howto = (elf64_alpha_howto_table
- + (r_type - R_ALPHA_SREL32 + R_ALPHA_REFLONG));
- goto default_reloc;
-
- case R_ALPHA_TLSLDM:
- /* Ignore the symbol for the relocation. The result is always
- the current module. */
- dynamic_symbol_p = 0;
- /* FALLTHRU */
-
- case R_ALPHA_TLSGD:
- if (!gotent->reloc_done)
- {
- gotent->reloc_done = 1;
-
- /* Note that the module index for the main program is 1. */
- bfd_put_64 (output_bfd, !info->shared && !dynamic_symbol_p,
- sgot->contents + gotent->got_offset);
-
- /* If the symbol has been forced local, output a
- DTPMOD64 reloc, otherwise it will be handled in
- finish_dynamic_symbol. */
- if (info->shared && !dynamic_symbol_p)
- elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
- gotent->got_offset, 0,
- R_ALPHA_DTPMOD64, 0);
-
- if (dynamic_symbol_p || r_type == R_ALPHA_TLSLDM)
- value = 0;
- else
- {
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- value -= dtp_base;
- }
- bfd_put_64 (output_bfd, value,
- sgot->contents + gotent->got_offset + 8);
- }
-
- value = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- value -= gp;
- goto default_reloc;
-
- case R_ALPHA_DTPRELHI:
- case R_ALPHA_DTPRELLO:
- case R_ALPHA_DTPREL16:
- if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: dtp-relative relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = FALSE;
- }
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- value -= dtp_base;
- if (r_type == R_ALPHA_DTPRELHI)
- value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
- goto default_reloc;
-
- case R_ALPHA_TPRELHI:
- case R_ALPHA_TPRELLO:
- case R_ALPHA_TPREL16:
- if (info->shared)
- {
- (*_bfd_error_handler)
- (_("%s: TLS local exec code cannot be linked into shared objects"),
- bfd_archive_filename (input_bfd));
- ret_val = FALSE;
- }
- else if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: tp-relative relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = FALSE;
- }
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- value -= tp_base;
- if (r_type == R_ALPHA_TPRELHI)
- value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
- goto default_reloc;
-
- case R_ALPHA_GOTDTPREL:
- case R_ALPHA_GOTTPREL:
- BFD_ASSERT(sgot != NULL);
- BFD_ASSERT(gp != 0);
- BFD_ASSERT(gotent != NULL);
- BFD_ASSERT(gotent->use_count >= 1);
-
- if (!gotent->reloc_done)
- {
- gotent->reloc_done = 1;
-
- if (dynamic_symbol_p)
- value = 0;
- else
- {
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- if (r_type == R_ALPHA_GOTDTPREL)
- value -= dtp_base;
- else if (!info->shared)
- value -= tp_base;
- else
- {
- elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
- gotent->got_offset, 0,
- R_ALPHA_TPREL64,
- value - dtp_base);
- value = 0;
- }
- }
- bfd_put_64 (output_bfd, value,
- sgot->contents + gotent->got_offset);
- }
-
- value = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- value -= gp;
- goto default_reloc;
-
- default:
- default_reloc:
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value, 0);
- break;
- }
-
- switch (r)
- {
- case bfd_reloc_ok:
- break;
-
- case bfd_reloc_overflow:
- {
- const char *name;
-
- /* Don't warn if the overflow is due to pc relative reloc
- against discarded section. Section optimization code should
- handle it. */
-
- if (r_symndx < symtab_hdr->sh_info
- && sec != NULL && howto->pc_relative
- && elf_discarded_section (sec))
- break;
-
- if (h != NULL)
- name = h->root.root.root.string;
- else
- {
- name = (bfd_elf_string_from_elf_section
- (input_bfd, symtab_hdr->sh_link, sym->st_name));
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- ret_val = FALSE;
- }
- break;
-
- default:
- case bfd_reloc_outofrange:
- abort ();
- }
- }
-
- return ret_val;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- bfd *dynobj = elf_hash_table(info)->dynobj;
-
- if (h->plt.offset != MINUS_ONE)
- {
- /* Fill in the .plt entry for this symbol. */
- asection *splt, *sgot, *srel;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- bfd_vma got_addr, plt_addr;
- bfd_vma plt_index;
- struct alpha_elf_got_entry *gotent;
-
- BFD_ASSERT (h->dynindx != -1);
-
- /* The first .got entry will be updated by the .plt with the
- address of the target function. */
- gotent = ((struct alpha_elf_link_hash_entry *) h)->got_entries;
- BFD_ASSERT (gotent && gotent->addend == 0);
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- srel = bfd_get_section_by_name (dynobj, ".rela.plt");
- BFD_ASSERT (srel != NULL);
- sgot = alpha_elf_tdata (gotent->gotobj)->got;
- BFD_ASSERT (sgot != NULL);
-
- got_addr = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- plt_addr = (splt->output_section->vma
- + splt->output_offset
- + h->plt.offset);
-
- plt_index = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE;
-
- /* Fill in the entry in the procedure linkage table. */
- {
- bfd_vma insn1, insn2, insn3;
-
- insn1 = PLT_ENTRY_WORD1 | ((-(h->plt.offset + 4) >> 2) & 0x1fffff);
- insn2 = PLT_ENTRY_WORD2;
- insn3 = PLT_ENTRY_WORD3;
-
- bfd_put_32 (output_bfd, insn1, splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd, insn2, splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, insn3, splt->contents + h->plt.offset + 8);
- }
-
- /* Fill in the entry in the .rela.plt section. */
- outrel.r_offset = got_addr;
- outrel.r_info = ELF64_R_INFO(h->dynindx, R_ALPHA_JMP_SLOT);
- outrel.r_addend = 0;
-
- loc = srel->contents + plt_index * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
-
- if (!(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
- /* Mark the symbol as undefined, rather than as defined in the
- .plt section. Leave the value alone. */
- sym->st_shndx = SHN_UNDEF;
- }
-
- /* Fill in the entries in the .got. */
- bfd_put_64 (output_bfd, plt_addr, sgot->contents + gotent->got_offset);
-
- /* Subsequent .got entries will continue to bounce through the .plt. */
- if (gotent->next)
- {
- srel = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (! info->shared || srel != NULL);
-
- gotent = gotent->next;
- do
- {
- sgot = alpha_elf_tdata(gotent->gotobj)->got;
- BFD_ASSERT(sgot != NULL);
- BFD_ASSERT(gotent->addend == 0);
-
- bfd_put_64 (output_bfd, plt_addr,
- sgot->contents + gotent->got_offset);
-
- if (info->shared)
- elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
- gotent->got_offset, 0,
- R_ALPHA_RELATIVE, plt_addr);
-
- gotent = gotent->next;
- }
- while (gotent != NULL);
- }
- }
- else if (alpha_elf_dynamic_symbol_p (h, info))
- {
- /* Fill in the dynamic relocations for this symbol's .got entries. */
- asection *srel;
- struct alpha_elf_got_entry *gotent;
-
- srel = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srel != NULL);
-
- for (gotent = ((struct alpha_elf_link_hash_entry *) h)->got_entries;
- gotent != NULL;
- gotent = gotent->next)
- {
- asection *sgot;
- long r_type;
-
- if (gotent->use_count == 0)
- continue;
-
- sgot = alpha_elf_tdata (gotent->gotobj)->got;
-
- r_type = gotent->reloc_type;
- switch (r_type)
- {
- case R_ALPHA_LITERAL:
- r_type = R_ALPHA_GLOB_DAT;
- break;
- case R_ALPHA_TLSGD:
- r_type = R_ALPHA_DTPMOD64;
- break;
- case R_ALPHA_GOTDTPREL:
- r_type = R_ALPHA_DTPREL64;
- break;
- case R_ALPHA_GOTTPREL:
- r_type = R_ALPHA_TPREL64;
- break;
- case R_ALPHA_TLSLDM:
- default:
- abort ();
- }
-
- elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
- gotent->got_offset, h->dynindx,
- r_type, gotent->addend);
-
- if (gotent->reloc_type == R_ALPHA_TLSGD)
- elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
- gotent->got_offset + 8, h->dynindx,
- R_ALPHA_DTPREL64, gotent->addend);
- }
- }
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-elf64_alpha_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- asection *sdyn;
-
- dynobj = elf_hash_table (info)->dynobj;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- asection *splt;
- Elf64_External_Dyn *dyncon, *dynconend;
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL && sdyn != NULL);
-
- dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- asection *s;
-
- bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- case DT_PLTGOT:
- name = ".plt";
- goto get_vma;
- case DT_PLTRELSZ:
- name = ".rela.plt";
- goto get_size;
- case DT_JMPREL:
- name = ".rela.plt";
- goto get_vma;
-
- case DT_RELASZ:
- /* My interpretation of the TIS v1.1 ELF document indicates
- that RELASZ should not include JMPREL. This is not what
- the rest of the BFD does. It is, however, what the
- glibc ld.so wants. Do this fixup here until we found
- out who is right. */
- s = bfd_get_section_by_name (output_bfd, ".rela.plt");
- if (s)
- {
- dyn.d_un.d_val -=
- (s->_cooked_size ? s->_cooked_size : s->_raw_size);
- }
- break;
-
- get_vma:
- s = bfd_get_section_by_name (output_bfd, name);
- dyn.d_un.d_ptr = (s ? s->vma : 0);
- break;
-
- get_size:
- s = bfd_get_section_by_name (output_bfd, name);
- dyn.d_un.d_val =
- (s->_cooked_size ? s->_cooked_size : s->_raw_size);
- break;
- }
-
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
-
- /* Initialize the PLT0 entry. */
- if (splt->_raw_size > 0)
- {
- bfd_put_32 (output_bfd, PLT_HEADER_WORD1, splt->contents);
- bfd_put_32 (output_bfd, PLT_HEADER_WORD2, splt->contents + 4);
- bfd_put_32 (output_bfd, PLT_HEADER_WORD3, splt->contents + 8);
- 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, (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 = 0;
- }
- }
-
- return TRUE;
-}
-
-/* We need to use a special link routine to handle the .mdebug section.
- We need to merge all instances of these sections together, not write
- them all out sequentially. */
-
-static bfd_boolean
-elf64_alpha_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- asection *o;
- struct bfd_link_order *p;
- asection *mdebug_sec;
- struct ecoff_debug_info debug;
- const struct ecoff_debug_swap *swap
- = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
- HDRR *symhdr = &debug.symbolic_header;
- PTR mdebug_handle = NULL;
-
- /* Go through the sections and collect the mdebug information. */
- mdebug_sec = NULL;
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- {
- if (strcmp (o->name, ".mdebug") == 0)
- {
- struct extsym_info einfo;
-
- /* We have found the .mdebug section in the output file.
- Look through all the link_orders comprising it and merge
- the information together. */
- symhdr->magic = swap->sym_magic;
- /* FIXME: What should the version stamp be? */
- symhdr->vstamp = 0;
- symhdr->ilineMax = 0;
- symhdr->cbLine = 0;
- symhdr->idnMax = 0;
- symhdr->ipdMax = 0;
- symhdr->isymMax = 0;
- symhdr->ioptMax = 0;
- symhdr->iauxMax = 0;
- symhdr->issMax = 0;
- symhdr->issExtMax = 0;
- symhdr->ifdMax = 0;
- symhdr->crfd = 0;
- symhdr->iextMax = 0;
-
- /* We accumulate the debugging information itself in the
- debug_info structure. */
- debug.line = NULL;
- debug.external_dnr = NULL;
- debug.external_pdr = NULL;
- debug.external_sym = NULL;
- debug.external_opt = NULL;
- debug.external_aux = NULL;
- debug.ss = NULL;
- debug.ssext = debug.ssext_end = NULL;
- debug.external_fdr = NULL;
- debug.external_rfd = NULL;
- debug.external_ext = debug.external_ext_end = NULL;
-
- mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info);
- if (mdebug_handle == (PTR) NULL)
- return FALSE;
-
- if (1)
- {
- asection *s;
- EXTR esym;
- bfd_vma last = 0;
- unsigned int i;
- static const char * const name[] =
- {
- ".text", ".init", ".fini", ".data",
- ".rodata", ".sdata", ".sbss", ".bss"
- };
- static const int sc[] = { scText, scInit, scFini, scData,
- scRData, scSData, scSBss, scBss };
-
- esym.jmptbl = 0;
- esym.cobol_main = 0;
- esym.weakext = 0;
- esym.reserved = 0;
- esym.ifd = ifdNil;
- esym.asym.iss = issNil;
- esym.asym.st = stLocal;
- esym.asym.reserved = 0;
- esym.asym.index = indexNil;
- for (i = 0; i < 8; i++)
- {
- esym.asym.sc = sc[i];
- s = bfd_get_section_by_name (abfd, name[i]);
- if (s != NULL)
- {
- esym.asym.value = s->vma;
- last = s->vma + s->_raw_size;
- }
- else
- esym.asym.value = last;
-
- if (! bfd_ecoff_debug_one_external (abfd, &debug, swap,
- name[i], &esym))
- return FALSE;
- }
- }
-
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- {
- asection *input_section;
- bfd *input_bfd;
- const struct ecoff_debug_swap *input_swap;
- struct ecoff_debug_info input_debug;
- char *eraw_src;
- char *eraw_end;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_data_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
- input_bfd = input_section->owner;
-
- if (bfd_get_flavour (input_bfd) != bfd_target_elf_flavour
- || (get_elf_backend_data (input_bfd)
- ->elf_backend_ecoff_debug_swap) == NULL)
- {
- /* I don't know what a non ALPHA ELF bfd would be
- doing with a .mdebug section, but I don't really
- want to deal with it. */
- continue;
- }
-
- input_swap = (get_elf_backend_data (input_bfd)
- ->elf_backend_ecoff_debug_swap);
-
- BFD_ASSERT (p->size == input_section->_raw_size);
-
- /* The ECOFF linking code expects that we have already
- read in the debugging information and set up an
- ecoff_debug_info structure, so we do that now. */
- if (!elf64_alpha_read_ecoff_info (input_bfd, input_section,
- &input_debug))
- return FALSE;
-
- if (! (bfd_ecoff_debug_accumulate
- (mdebug_handle, abfd, &debug, swap, input_bfd,
- &input_debug, input_swap, info)))
- return FALSE;
-
- /* Loop through the external symbols. For each one with
- interesting information, try to find the symbol in
- the linker global hash table and save the information
- for the output external symbols. */
- eraw_src = input_debug.external_ext;
- eraw_end = (eraw_src
- + (input_debug.symbolic_header.iextMax
- * input_swap->external_ext_size));
- for (;
- eraw_src < eraw_end;
- eraw_src += input_swap->external_ext_size)
- {
- EXTR ext;
- const char *name;
- struct alpha_elf_link_hash_entry *h;
-
- (*input_swap->swap_ext_in) (input_bfd, (PTR) eraw_src, &ext);
- if (ext.asym.sc == scNil
- || ext.asym.sc == scUndefined
- || ext.asym.sc == scSUndefined)
- continue;
-
- name = input_debug.ssext + ext.asym.iss;
- h = alpha_elf_link_hash_lookup (alpha_elf_hash_table (info),
- name, FALSE, FALSE, TRUE);
- if (h == NULL || h->esym.ifd != -2)
- continue;
-
- if (ext.ifd != -1)
- {
- BFD_ASSERT (ext.ifd
- < input_debug.symbolic_header.ifdMax);
- ext.ifd = input_debug.ifdmap[ext.ifd];
- }
-
- h->esym = ext;
- }
-
- /* Free up the information we just read. */
- free (input_debug.line);
- free (input_debug.external_dnr);
- free (input_debug.external_pdr);
- free (input_debug.external_sym);
- free (input_debug.external_opt);
- free (input_debug.external_aux);
- free (input_debug.ss);
- free (input_debug.ssext);
- free (input_debug.external_fdr);
- free (input_debug.external_rfd);
- free (input_debug.external_ext);
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
- }
-
- /* Build the external symbol information. */
- einfo.abfd = abfd;
- einfo.info = info;
- einfo.debug = &debug;
- einfo.swap = swap;
- einfo.failed = FALSE;
- elf_link_hash_traverse (elf_hash_table (info),
- elf64_alpha_output_extsym,
- (PTR) &einfo);
- if (einfo.failed)
- return FALSE;
-
- /* Set the size of the .mdebug section. */
- o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap);
-
- /* Skip this section later on (I don't think this currently
- matters, but someday it might). */
- o->link_order_head = (struct bfd_link_order *) NULL;
-
- mdebug_sec = o;
- }
- }
-
- /* Invoke the regular ELF backend linker to do all the work. */
- if (! bfd_elf_final_link (abfd, info))
- return FALSE;
-
- /* Now write out the computed sections. */
-
- /* The .got subsections... */
- {
- bfd *i, *dynobj = elf_hash_table(info)->dynobj;
- for (i = alpha_elf_hash_table(info)->got_list;
- i != NULL;
- i = alpha_elf_tdata(i)->got_link_next)
- {
- asection *sgot;
-
- /* elf_bfd_final_link already did everything in dynobj. */
- if (i == dynobj)
- continue;
-
- sgot = alpha_elf_tdata(i)->got;
- if (! bfd_set_section_contents (abfd, sgot->output_section,
- sgot->contents,
- (file_ptr) sgot->output_offset,
- sgot->_raw_size))
- return FALSE;
- }
- }
-
- if (mdebug_sec != (asection *) NULL)
- {
- BFD_ASSERT (abfd->output_has_begun);
- if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug,
- swap, info,
- mdebug_sec->filepos))
- return FALSE;
-
- bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info);
- }
-
- return TRUE;
-}
-
-static enum elf_reloc_type_class
-elf64_alpha_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
-{
- switch ((int) ELF64_R_TYPE (rela->r_info))
- {
- case R_ALPHA_RELATIVE:
- return reloc_class_relative;
- case R_ALPHA_JMP_SLOT:
- return reloc_class_plt;
- case R_ALPHA_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-static struct bfd_elf_special_section const elf64_alpha_special_sections[]=
-{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
- { NULL, 0, 0, 0, 0 }
-};
-
-/* ECOFF swapping routines. These are used when dealing with the
- .mdebug section, which is in the ECOFF debugging format. Copied
- from elf32-mips.c. */
-static const struct ecoff_debug_swap
-elf64_alpha_ecoff_debug_swap =
-{
- /* Symbol table magic number. */
- magicSym2,
- /* Alignment of debugging information. E.g., 4. */
- 8,
- /* Sizes of external symbolic information. */
- sizeof (struct hdr_ext),
- sizeof (struct dnr_ext),
- sizeof (struct pdr_ext),
- sizeof (struct sym_ext),
- sizeof (struct opt_ext),
- sizeof (struct fdr_ext),
- sizeof (struct rfd_ext),
- sizeof (struct ext_ext),
- /* Functions to swap in external symbolic data. */
- ecoff_swap_hdr_in,
- ecoff_swap_dnr_in,
- ecoff_swap_pdr_in,
- ecoff_swap_sym_in,
- ecoff_swap_opt_in,
- ecoff_swap_fdr_in,
- ecoff_swap_rfd_in,
- ecoff_swap_ext_in,
- _bfd_ecoff_swap_tir_in,
- _bfd_ecoff_swap_rndx_in,
- /* Functions to swap out external symbolic data. */
- ecoff_swap_hdr_out,
- ecoff_swap_dnr_out,
- ecoff_swap_pdr_out,
- ecoff_swap_sym_out,
- ecoff_swap_opt_out,
- ecoff_swap_fdr_out,
- ecoff_swap_rfd_out,
- ecoff_swap_ext_out,
- _bfd_ecoff_swap_tir_out,
- _bfd_ecoff_swap_rndx_out,
- /* Function to read in symbolic data. */
- elf64_alpha_read_ecoff_info
-};
-
-/* Use a non-standard hash bucket size of 8. */
-
-static const struct elf_size_info alpha_elf_size_info =
-{
- sizeof (Elf64_External_Ehdr),
- sizeof (Elf64_External_Phdr),
- sizeof (Elf64_External_Shdr),
- sizeof (Elf64_External_Rel),
- sizeof (Elf64_External_Rela),
- sizeof (Elf64_External_Sym),
- sizeof (Elf64_External_Dyn),
- sizeof (Elf_External_Note),
- 8,
- 1,
- 64, 3,
- ELFCLASS64, EV_CURRENT,
- bfd_elf64_write_out_phdrs,
- bfd_elf64_write_shdrs_and_ehdr,
- bfd_elf64_write_relocs,
- bfd_elf64_swap_symbol_in,
- bfd_elf64_swap_symbol_out,
- bfd_elf64_slurp_reloc_table,
- bfd_elf64_slurp_symbol_table,
- bfd_elf64_swap_dyn_in,
- bfd_elf64_swap_dyn_out,
- bfd_elf64_swap_reloc_in,
- bfd_elf64_swap_reloc_out,
- bfd_elf64_swap_reloca_in,
- bfd_elf64_swap_reloca_out
-};
-
-#define TARGET_LITTLE_SYM bfd_elf64_alpha_vec
-#define TARGET_LITTLE_NAME "elf64-alpha"
-#define ELF_ARCH bfd_arch_alpha
-#define ELF_MACHINE_CODE EM_ALPHA
-#define ELF_MAXPAGESIZE 0x10000
-
-#define bfd_elf64_bfd_link_hash_table_create \
- elf64_alpha_bfd_link_hash_table_create
-
-#define bfd_elf64_bfd_reloc_type_lookup \
- elf64_alpha_bfd_reloc_type_lookup
-#define elf_info_to_howto \
- elf64_alpha_info_to_howto
-
-#define bfd_elf64_mkobject \
- elf64_alpha_mkobject
-#define elf_backend_object_p \
- elf64_alpha_object_p
-
-#define elf_backend_section_from_shdr \
- elf64_alpha_section_from_shdr
-#define elf_backend_section_flags \
- elf64_alpha_section_flags
-#define elf_backend_fake_sections \
- elf64_alpha_fake_sections
-
-#define bfd_elf64_bfd_is_local_label_name \
- elf64_alpha_is_local_label_name
-#define bfd_elf64_find_nearest_line \
- elf64_alpha_find_nearest_line
-#define bfd_elf64_bfd_relax_section \
- elf64_alpha_relax_section
-
-#define elf_backend_add_symbol_hook \
- elf64_alpha_add_symbol_hook
-#define elf_backend_check_relocs \
- elf64_alpha_check_relocs
-#define elf_backend_create_dynamic_sections \
- elf64_alpha_create_dynamic_sections
-#define elf_backend_adjust_dynamic_symbol \
- elf64_alpha_adjust_dynamic_symbol
-#define elf_backend_always_size_sections \
- elf64_alpha_always_size_sections
-#define elf_backend_size_dynamic_sections \
- elf64_alpha_size_dynamic_sections
-#define elf_backend_relocate_section \
- elf64_alpha_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- elf64_alpha_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- elf64_alpha_finish_dynamic_sections
-#define bfd_elf64_bfd_final_link \
- elf64_alpha_final_link
-#define elf_backend_reloc_type_class \
- elf64_alpha_reloc_type_class
-
-#define elf_backend_ecoff_debug_swap \
- &elf64_alpha_ecoff_debug_swap
-
-#define elf_backend_size_info \
- alpha_elf_size_info
-
-#define elf_backend_special_sections \
- elf64_alpha_special_sections
-
-/* A few constants that determine how the .plt section is set up. */
-#define elf_backend_want_got_plt 0
-#define elf_backend_plt_readonly 0
-#define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size 0
-
-#include "elf64-target.h"
-
-/* FreeBSD support. */
-
-#undef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec
-#undef TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME "elf64-alpha-freebsd"
-
-/* The kernel recognizes executables as valid only if they carry a
- "FreeBSD" label in the ELF header. So we put this label on all
- executables and (for simplicity) also all other object files. */
-
-static void elf64_alpha_fbsd_post_process_headers
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void
-elf64_alpha_fbsd_post_process_headers (abfd, link_info)
- bfd * abfd;
- struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
-{
- Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
-
- i_ehdrp = elf_elfheader (abfd);
-
- /* Put an ABI label supported by FreeBSD >= 4.1. */
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#ifdef OLD_FREEBSD_ABI_LABEL
- /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
- memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
-#endif
-}
-
-#undef elf_backend_post_process_headers
-#define elf_backend_post_process_headers \
- elf64_alpha_fbsd_post_process_headers
-
-#undef elf64_bed
-#define elf64_bed elf64_alpha_fbsd_bed
-
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-gen.c b/contrib/binutils/bfd/elf64-gen.c
deleted file mode 100644
index be1dc3e..0000000
--- a/contrib/binutils/bfd/elf64-gen.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Generic support for 64-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-/* This does not include any relocation information, but should be
- good enough for GDB or objdump to read the file. */
-
-static reloc_howto_type dummy =
- HOWTO (0, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "UNKNOWN", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-static void elf_generic_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static void elf_generic_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static bfd_boolean elf64_generic_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void
-elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
-{
- bfd_reloc->howto = &dummy;
-}
-
-static void
-elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
-{
- bfd_reloc->howto = &dummy;
-}
-
-static bfd_boolean
-elf64_generic_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- asection *o;
-
- /* Check if there are any relocations. */
- for (o = abfd->sections; o != NULL; o = o->next)
- if ((o->flags & SEC_RELOC) != 0)
- {
- Elf_Internal_Ehdr *ehdrp;
-
- ehdrp = elf_elfheader (abfd);
- (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
- bfd_archive_filename (abfd),
- ehdrp->e_machine);
-
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- return bfd_elf_link_add_symbols (abfd, info);
-}
-
-#define TARGET_LITTLE_SYM bfd_elf64_little_generic_vec
-#define TARGET_LITTLE_NAME "elf64-little"
-#define TARGET_BIG_SYM bfd_elf64_big_generic_vec
-#define TARGET_BIG_NAME "elf64-big"
-#define ELF_ARCH bfd_arch_unknown
-#define ELF_MACHINE_CODE EM_NONE
-#define ELF_MAXPAGESIZE 0x1
-#define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
-#define bfd_elf64_bfd_link_add_symbols elf64_generic_link_add_symbols
-#define elf_info_to_howto elf_generic_info_to_howto
-#define elf_info_to_howto_rel elf_generic_info_to_howto_rel
-
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-mips.c b/contrib/binutils/bfd/elf64-mips.c
deleted file mode 100644
index fa3b494..0000000
--- a/contrib/binutils/bfd/elf64-mips.c
+++ /dev/null
@@ -1,2815 +0,0 @@
-/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Ian Lance Taylor, Cygnus Support
- Linker support added by Mark Mitchell, CodeSourcery, LLC.
- <mark@codesourcery.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file supports the 64-bit MIPS ELF ABI.
-
- The MIPS 64-bit ELF ABI uses an unusual reloc format. This file
- overrides the usual ELF reloc handling, and handles reading and
- writing the relocations here. */
-
-/* TODO: Many things are unsupported, even if there is some code for it
- . (which was mostly stolen from elf32-mips.c and slightly adapted).
- .
- . - Relocation handling for REL relocs is wrong in many cases and
- . generally untested.
- . - Relocation handling for RELA relocs related to GOT support are
- . also likely to be wrong.
- . - Support for MIPS16 is untested.
- . - Combined relocs with RSS_* entries are unsupported.
- . - The whole GOT handling for NewABI is missing, some parts of
- . the OldABI version is still lying around and should be removed.
- */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/ar.h"
-#include "bfdlink.h"
-#include "genlink.h"
-#include "elf-bfd.h"
-#include "elfxx-mips.h"
-#include "elf/mips.h"
-
-/* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to
- use ECOFF. However, we support it anyhow for an easier changeover. */
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/internal.h"
-#include "coff/ecoff.h"
-/* The 64 bit versions of the mdebug data structures are in alpha.h. */
-#include "coff/alpha.h"
-#define ECOFF_SIGNED_64
-#include "ecoffswap.h"
-
-static void mips_elf64_swap_reloc_in
- (bfd *, const Elf64_Mips_External_Rel *, Elf64_Mips_Internal_Rela *);
-static void mips_elf64_swap_reloca_in
- (bfd *, const Elf64_Mips_External_Rela *, Elf64_Mips_Internal_Rela *);
-static void mips_elf64_swap_reloc_out
- (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rel *);
-static void mips_elf64_swap_reloca_out
- (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rela *);
-static void mips_elf64_be_swap_reloc_in
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-static void mips_elf64_be_swap_reloc_out
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-static void mips_elf64_be_swap_reloca_in
- (bfd *, const bfd_byte *, Elf_Internal_Rela *);
-static void mips_elf64_be_swap_reloca_out
- (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup
- (bfd *, bfd_reloc_code_real_type);
-static reloc_howto_type *mips_elf64_rtype_to_howto
- (unsigned int, bfd_boolean);
-static void mips_elf64_info_to_howto_rel
- (bfd *, arelent *, Elf_Internal_Rela *);
-static void mips_elf64_info_to_howto_rela
- (bfd *, arelent *, Elf_Internal_Rela *);
-static long mips_elf64_get_reloc_upper_bound
- (bfd *, asection *);
-static long mips_elf64_canonicalize_reloc
- (bfd *, asection *, arelent **, asymbol **);
-static long mips_elf64_get_dynamic_reloc_upper_bound
- (bfd *);
-static long mips_elf64_canonicalize_dynamic_reloc
- (bfd *, arelent **, asymbol **);
-static bfd_boolean mips_elf64_slurp_one_reloc_table
- (bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, arelent *,
- asymbol **, bfd_boolean);
-static bfd_boolean mips_elf64_slurp_reloc_table
- (bfd *, asection *, asymbol **, bfd_boolean);
-static void mips_elf64_write_relocs
- (bfd *, asection *, void *);
-static void mips_elf64_write_rel
- (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
-static void mips_elf64_write_rela
- (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
-static bfd_reloc_status_type mips_elf64_gprel16_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips_elf64_literal_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips_elf64_gprel32_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips_elf64_shift6_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips16_jump_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips16_gprel_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_boolean mips_elf64_assign_gp
- (bfd *, bfd_vma *);
-static bfd_reloc_status_type mips_elf64_final_gp
- (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
-static bfd_boolean mips_elf64_object_p
- (bfd *);
-static irix_compat_t elf64_mips_irix_compat
- (bfd *);
-static bfd_boolean elf64_mips_grok_prstatus
- (bfd *, Elf_Internal_Note *);
-static bfd_boolean elf64_mips_grok_psinfo
- (bfd *, Elf_Internal_Note *);
-
-extern const bfd_target bfd_elf64_bigmips_vec;
-extern const bfd_target bfd_elf64_littlemips_vec;
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-/* The number of local .got entries we reserve. */
-#define MIPS_RESERVED_GOTNO (2)
-
-/* The relocation table used for SHT_REL sections. */
-
-static reloc_howto_type mips_elf64_howto_table_rel[] =
-{
- /* No relocation. */
- HOWTO (R_MIPS_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit relocation. */
- HOWTO (R_MIPS_16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit relocation. */
- HOWTO (R_MIPS_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit symbol relative relocation. */
- HOWTO (R_MIPS_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 26 bit jump address. */
- HOWTO (R_MIPS_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper 36
- bits must match the PC + 4. */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- TRUE, /* partial_inplace */
- 0x03ffffff, /* src_mask */
- 0x03ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
- However, the native IRIX6 tools use them, so we try our best. */
-
- /* High 16 bits of symbol value. */
- HOWTO (R_MIPS_HI16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_hi16_reloc, /* special_function */
- "R_MIPS_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of symbol value. */
- HOWTO (R_MIPS_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_lo16_reloc, /* special_function */
- "R_MIPS_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GP relative reference. */
- HOWTO (R_MIPS_GPREL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf64_gprel16_reloc, /* special_function */
- "R_MIPS_GPREL16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to literal section. */
- HOWTO (R_MIPS_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf64_literal_reloc, /* special_function */
- "R_MIPS_LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to global offset table. */
- HOWTO (R_MIPS_GOT16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_got16_reloc, /* special_function */
- "R_MIPS_GOT16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit PC relative reference. */
- HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_PC16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 16 bit call through global offset table. */
- HOWTO (R_MIPS_CALL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit GP relative reference. */
- HOWTO (R_MIPS_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_elf64_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
-
- /* A 5 bit shift field. */
- HOWTO (R_MIPS_SHIFT5, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SHIFT5", /* name */
- TRUE, /* partial_inplace */
- 0x000007c0, /* src_mask */
- 0x000007c0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 6 bit shift field. */
- HOWTO (R_MIPS_SHIFT6, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 6, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_elf64_shift6_reloc, /* special_function */
- "R_MIPS_SHIFT6", /* name */
- TRUE, /* partial_inplace */
- 0x000007c4, /* src_mask */
- 0x000007c4, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit relocation. */
- HOWTO (R_MIPS_64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement in the global offset table. */
- HOWTO (R_MIPS_GOT_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_DISP", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement to page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_PAGE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_PAGE", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Offset from page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_OFST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_OFST", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit subtraction. */
- HOWTO (R_MIPS_SUB, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SUB", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_A, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_A", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction, and change all relocations
- to refer to the old instruction at the address. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_B, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_B", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Delete a 32 bit instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_DELETE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_DELETE", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
- We don't, because
- a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
- R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
- fallable heuristics.
- b) No other NewABI toolchain actually emits such relocations. */
- EMPTY_HOWTO (R_MIPS_HIGHER),
- EMPTY_HOWTO (R_MIPS_HIGHEST),
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Section displacement, used by an associated event location section. */
- HOWTO (R_MIPS_SCN_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SCN_DISP", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_MIPS_REL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* These two are obsolete. */
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
-
- /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
- It must be used for multigot GOT's (and only there). */
- HOWTO (R_MIPS_RELGOT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_RELGOT", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Protected jump conversion. This is an optimization hint. No
- relocation is required for correctness. */
- HOWTO (R_MIPS_JALR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_JALR", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x00000000, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* The relocation table used for SHT_RELA sections. */
-
-static reloc_howto_type mips_elf64_howto_table_rela[] =
-{
- /* No relocation. */
- HOWTO (R_MIPS_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit relocation. */
- HOWTO (R_MIPS_16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit relocation. */
- HOWTO (R_MIPS_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit symbol relative relocation. */
- HOWTO (R_MIPS_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 26 bit jump address. */
- HOWTO (R_MIPS_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper 36
- bits must match the PC + 4. */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x03ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of symbol value. */
- HOWTO (R_MIPS_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of symbol value. */
- HOWTO (R_MIPS_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_LO16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GP relative reference. */
- HOWTO (R_MIPS_GPREL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf64_gprel16_reloc, /* special_function */
- "R_MIPS_GPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to literal section. */
- HOWTO (R_MIPS_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf64_literal_reloc, /* special_function */
- "R_MIPS_LITERAL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to global offset table. */
- HOWTO (R_MIPS_GOT16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit PC relative reference. */
- HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_PC16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 16 bit call through global offset table. */
- HOWTO (R_MIPS_CALL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit GP relative reference. */
- HOWTO (R_MIPS_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_elf64_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
-
- /* A 5 bit shift field. */
- HOWTO (R_MIPS_SHIFT5, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SHIFT5", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x000007c0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 6 bit shift field. */
- HOWTO (R_MIPS_SHIFT6, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 6, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_elf64_shift6_reloc, /* special_function */
- "R_MIPS_SHIFT6", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x000007c4, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit relocation. */
- HOWTO (R_MIPS_64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement in the global offset table. */
- HOWTO (R_MIPS_GOT_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_DISP", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement to page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_PAGE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_PAGE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Offset from page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_OFST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_OFST", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_LO16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit subtraction. */
- HOWTO (R_MIPS_SUB, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SUB", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_A, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_A", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction, and change all relocations
- to refer to the old instruction at the address. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_B, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_B", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Delete a 32 bit instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_DELETE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_DELETE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Get the higher value of a 64 bit addend. */
- HOWTO (R_MIPS_HIGHER, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HIGHER", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Get the highest value of a 64 bit addend. */
- HOWTO (R_MIPS_HIGHEST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HIGHEST", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_LO16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Section displacement, used by an associated event location section. */
- HOWTO (R_MIPS_SCN_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SCN_DISP", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_MIPS_REL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* These two are obsolete. */
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
-
- /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
- It must be used for multigot GOT's (and only there). */
- HOWTO (R_MIPS_RELGOT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_RELGOT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Protected jump conversion. This is an optimization hint. No
- relocation is required for correctness. */
- HOWTO (R_MIPS_JALR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_JALR", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x00000000, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* The reloc used for the mips16 jump instruction. */
-static reloc_howto_type elf_mips16_jump_howto =
- HOWTO (R_MIPS16_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC. */
- mips16_jump_reloc, /* special_function */
- "R_MIPS16_26", /* name */
- TRUE, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* The reloc used for the mips16 gprel instruction. */
-static reloc_howto_type elf_mips16_gprel_howto =
- HOWTO (R_MIPS16_GPREL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips16_gprel_reloc, /* special_function */
- "R_MIPS16_GPREL", /* name */
- TRUE, /* partial_inplace */
- 0x07ff001f, /* src_mask */
- 0x07ff001f, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* GNU extension to record C++ vtable hierarchy */
-static reloc_howto_type elf_mips_gnu_vtinherit_howto =
- HOWTO (R_MIPS_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_MIPS_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* GNU extension to record C++ vtable member usage */
-static reloc_howto_type elf_mips_gnu_vtentry_howto =
- HOWTO (R_MIPS_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_MIPS_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* 16 bit offset for pc-relative branches. */
-static reloc_howto_type elf_mips_gnu_rel16_s2 =
- HOWTO (R_MIPS_GNU_REL16_S2, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GNU_REL16_S2", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* 16 bit offset for pc-relative branches. */
-static reloc_howto_type elf_mips_gnu_rela16_s2 =
- HOWTO (R_MIPS_GNU_REL16_S2, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GNU_REL16_S2", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* Swap in a MIPS 64-bit Rel reloc. */
-
-static void
-mips_elf64_swap_reloc_in (bfd *abfd, const Elf64_Mips_External_Rel *src,
- Elf64_Mips_Internal_Rela *dst)
-{
- 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 = 0;
-}
-
-/* Swap in a MIPS 64-bit Rela reloc. */
-
-static void
-mips_elf64_swap_reloca_in (bfd *abfd, const Elf64_Mips_External_Rela *src,
- Elf64_Mips_Internal_Rela *dst)
-{
- 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. */
-
-static void
-mips_elf64_swap_reloc_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
- Elf64_Mips_External_Rel *dst)
-{
- 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. */
-
-static void
-mips_elf64_swap_reloca_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
- Elf64_Mips_External_Rela *dst)
-{
- 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_S64 (abfd, src->r_addend, dst->r_addend);
-}
-
-/* Swap in a MIPS 64-bit Rel reloc. */
-
-static void
-mips_elf64_be_swap_reloc_in (bfd *abfd, const bfd_byte *src,
- Elf_Internal_Rela *dst)
-{
- Elf64_Mips_Internal_Rela mirel;
-
- mips_elf64_swap_reloc_in (abfd,
- (const Elf64_Mips_External_Rel *) src,
- &mirel);
-
- dst[0].r_offset = mirel.r_offset;
- dst[0].r_info = ELF64_R_INFO (mirel.r_sym, mirel.r_type);
- dst[0].r_addend = 0;
- dst[1].r_offset = mirel.r_offset;
- dst[1].r_info = ELF64_R_INFO (mirel.r_ssym, mirel.r_type2);
- dst[1].r_addend = 0;
- dst[2].r_offset = mirel.r_offset;
- dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirel.r_type3);
- dst[2].r_addend = 0;
-}
-
-/* Swap in a MIPS 64-bit Rela reloc. */
-
-static void
-mips_elf64_be_swap_reloca_in (bfd *abfd, const bfd_byte *src,
- Elf_Internal_Rela *dst)
-{
- Elf64_Mips_Internal_Rela mirela;
-
- mips_elf64_swap_reloca_in (abfd,
- (const Elf64_Mips_External_Rela *) src,
- &mirela);
-
- dst[0].r_offset = mirela.r_offset;
- dst[0].r_info = ELF64_R_INFO (mirela.r_sym, mirela.r_type);
- dst[0].r_addend = mirela.r_addend;
- dst[1].r_offset = mirela.r_offset;
- dst[1].r_info = ELF64_R_INFO (mirela.r_ssym, mirela.r_type2);
- dst[1].r_addend = 0;
- dst[2].r_offset = mirela.r_offset;
- dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirela.r_type3);
- dst[2].r_addend = 0;
-}
-
-/* Swap out a MIPS 64-bit Rel reloc. */
-
-static void
-mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src,
- bfd_byte *dst)
-{
- Elf64_Mips_Internal_Rela mirel;
-
- mirel.r_offset = src[0].r_offset;
- BFD_ASSERT(src[0].r_offset == src[1].r_offset);
-#if 0
- BFD_ASSERT(src[0].r_offset == src[2].r_offset);
-#endif
-
- mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
- mirel.r_sym = ELF64_R_SYM (src[0].r_info);
- mirel.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
- mirel.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
- mirel.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
-
- mips_elf64_swap_reloc_out (abfd, &mirel,
- (Elf64_Mips_External_Rel *) dst);
-}
-
-/* Swap out a MIPS 64-bit Rela reloc. */
-
-static void
-mips_elf64_be_swap_reloca_out (bfd *abfd, const Elf_Internal_Rela *src,
- bfd_byte *dst)
-{
- Elf64_Mips_Internal_Rela mirela;
-
- mirela.r_offset = src[0].r_offset;
- BFD_ASSERT(src[0].r_offset == src[1].r_offset);
- BFD_ASSERT(src[0].r_offset == src[2].r_offset);
-
- mirela.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
- mirela.r_sym = ELF64_R_SYM (src[0].r_info);
- mirela.r_addend = src[0].r_addend;
- BFD_ASSERT(src[1].r_addend == 0);
- BFD_ASSERT(src[2].r_addend == 0);
-
- mirela.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
- mirela.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
- mirela.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
-
- mips_elf64_swap_reloca_out (abfd, &mirela,
- (Elf64_Mips_External_Rela *) dst);
-}
-
-/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
- dangerous relocation. */
-
-static bfd_boolean
-mips_elf64_assign_gp (bfd *output_bfd, bfd_vma *pgp)
-{
- unsigned int count;
- asymbol **sym;
- unsigned int i;
-
- /* If we've already figured out what GP will be, just return it. */
- *pgp = _bfd_get_gp_value (output_bfd);
- if (*pgp)
- return TRUE;
-
- count = bfd_get_symcount (output_bfd);
- sym = bfd_get_outsymbols (output_bfd);
-
- /* The linker script will have created a symbol named `_gp' with the
- appropriate value. */
- if (sym == NULL)
- i = count;
- else
- {
- for (i = 0; i < count; i++, sym++)
- {
- register const char *name;
-
- name = bfd_asymbol_name (*sym);
- if (*name == '_' && strcmp (name, "_gp") == 0)
- {
- *pgp = bfd_asymbol_value (*sym);
- _bfd_set_gp_value (output_bfd, *pgp);
- break;
- }
- }
- }
-
- if (i >= count)
- {
- /* Only get the error once. */
- *pgp = 4;
- _bfd_set_gp_value (output_bfd, *pgp);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We have to figure out the gp value, so that we can adjust the
- symbol value correctly. We look up the symbol _gp in the output
- BFD. If we can't find it, we're stuck. We cache it in the ELF
- target data. We don't need to adjust the symbol value for an
- external symbol if we are producing relocatable output. */
-
-static bfd_reloc_status_type
-mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
- char **error_message, bfd_vma *pgp)
-{
- if (bfd_is_und_section (symbol->section)
- && ! relocatable)
- {
- *pgp = 0;
- return bfd_reloc_undefined;
- }
-
- *pgp = _bfd_get_gp_value (output_bfd);
- if (*pgp == 0
- && (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0))
- {
- if (relocatable)
- {
- /* Make up a value. */
- *pgp = symbol->section->output_section->vma /*+ 0x4000*/;
- _bfd_set_gp_value (output_bfd, *pgp);
- }
- else if (!mips_elf64_assign_gp (output_bfd, pgp))
- {
- *error_message =
- (char *) _("GP relative relocation when _gp not defined");
- return bfd_reloc_dangerous;
- }
- }
-
- return bfd_reloc_ok;
-}
-
-/* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
- become the offset from the gp register. */
-
-static bfd_reloc_status_type
-mips_elf64_gprel16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
-
- /* If we're relocating, and this is an external symbol, we don't want
- to change anything. */
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (symbol->flags & BSF_LOCAL) != 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
- input_section, relocatable,
- data, gp);
-}
-
-/* Do a R_MIPS_LITERAL relocation. */
-
-static bfd_reloc_status_type
-mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
-
- /* If we're relocating, and this is an external symbol, we don't
- want to change anything. */
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (symbol->flags & BSF_LOCAL) != 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
- input_section, relocatable,
- data, gp);
-}
-
-/* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
- become the offset from the gp register. */
-
-static bfd_reloc_status_type
-mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
- bfd_vma relocation;
- bfd_vma val;
-
- /* If we're relocating, and this is an external symbol, we don't want
- to change anything. */
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (symbol->flags & BSF_LOCAL) != 0)
- {
- *error_message = (char *)
- _("32bits gp relative relocation occurs for an external symbol");
- return bfd_reloc_outofrange;
- }
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf64_final_gp (output_bfd, symbol, relocatable,
- error_message, &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- /* Set val to the offset into the section or symbol. */
- val = reloc_entry->addend;
-
- if (reloc_entry->howto->partial_inplace)
- val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- if (reloc_entry->howto->partial_inplace)
- bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
- else
- reloc_entry->addend = val;
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
-
- return bfd_reloc_ok;
-}
-
-/* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
- the rest is at bits 6-10. The bitpos already got right by the howto. */
-
-static bfd_reloc_status_type
-mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- if (reloc_entry->howto->partial_inplace)
- {
- reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
- | (reloc_entry->addend & 0x00000800) >> 9);
- }
-
- return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd,
- error_message);
-}
-
-/* Handle a mips16 jump. */
-
-static bfd_reloc_status_type
-mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* FIXME. */
- {
- static bfd_boolean warned;
-
- if (! warned)
- (*_bfd_error_handler)
- (_("Linking mips16 objects into %s format is not supported"),
- bfd_get_target (input_section->output_section->owner));
- warned = TRUE;
- }
-
- return bfd_reloc_undefined;
-}
-
-/* Handle a mips16 GP relative reloc. */
-
-static bfd_reloc_status_type
-mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
- unsigned short extend = 0;
- unsigned short insn = 0;
- bfd_signed_vma val;
- bfd_vma relocation;
-
- /* If we're relocating, and this is an external symbol with no
- addend, we don't want to change anything. */
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (symbol->flags & BSF_LOCAL) != 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- /* Set val to the offset into the section or symbol. */
- val = reloc_entry->addend;
-
- if (reloc_entry->howto->partial_inplace)
- {
- /* Pick up the mips16 extend instruction and the real instruction. */
- extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
- insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2);
- val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f);
- }
-
- _bfd_mips_elf_sign_extend(val, 16);
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- if (reloc_entry->howto->partial_inplace)
- {
- bfd_put_16 (abfd,
- (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0),
- (bfd_byte *) data + reloc_entry->address);
- bfd_put_16 (abfd,
- (insn & 0xffe0) | (val & 0x1f),
- (bfd_byte *) data + reloc_entry->address + 2);
- }
- else
- reloc_entry->addend = val;
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
- else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0))
- return bfd_reloc_overflow;
-
- return bfd_reloc_ok;
-}
-
-/* A mapping from BFD reloc types to MIPS ELF reloc types. */
-
-struct elf_reloc_map {
- bfd_reloc_code_real_type bfd_val;
- enum elf_mips_reloc_type elf_val;
-};
-
-static const struct elf_reloc_map mips_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_MIPS_NONE },
- { BFD_RELOC_16, R_MIPS_16 },
- { BFD_RELOC_32, R_MIPS_32 },
- /* There is no BFD reloc for R_MIPS_REL32. */
- { BFD_RELOC_64, R_MIPS_64 },
- { BFD_RELOC_CTOR, R_MIPS_64 },
- { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
- { BFD_RELOC_HI16_S, R_MIPS_HI16 },
- { BFD_RELOC_LO16, R_MIPS_LO16 },
- { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
- { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
- { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
- { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
- { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
- { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
- { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
- { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
- { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
- { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
- { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
- { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
- { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
- { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
- { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
- { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
- { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
- { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
- { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
- { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
- { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
- { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
- { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
- /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
- { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
- { BFD_RELOC_MIPS_JALR, R_MIPS_JALR }
-};
-
-/* Given a BFD reloc type, return a howto structure. */
-
-static reloc_howto_type *
-bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
-{
- unsigned int i;
- /* FIXME: We default to RELA here instead of choosing the right
- relocation variant. */
- reloc_howto_type *howto_table = mips_elf64_howto_table_rela;
-
- for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
- i++)
- {
- if (mips_reloc_map[i].bfd_val == code)
- return &howto_table[(int) mips_reloc_map[i].elf_val];
- }
-
- switch (code)
- {
- case BFD_RELOC_MIPS16_JMP:
- return &elf_mips16_jump_howto;
- case BFD_RELOC_MIPS16_GPREL:
- return &elf_mips16_gprel_howto;
- case BFD_RELOC_VTABLE_INHERIT:
- return &elf_mips_gnu_vtinherit_howto;
- case BFD_RELOC_VTABLE_ENTRY:
- return &elf_mips_gnu_vtentry_howto;
- case BFD_RELOC_16_PCREL_S2:
- return &elf_mips_gnu_rela16_s2;
- default:
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-}
-
-/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
-
-static reloc_howto_type *
-mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
-{
- switch (r_type)
- {
- case R_MIPS16_26:
- return &elf_mips16_jump_howto;
- case R_MIPS16_GPREL:
- return &elf_mips16_gprel_howto;
- case R_MIPS_GNU_VTINHERIT:
- return &elf_mips_gnu_vtinherit_howto;
- case R_MIPS_GNU_VTENTRY:
- return &elf_mips_gnu_vtentry_howto;
- case R_MIPS_GNU_REL16_S2:
- if (rela_p)
- return &elf_mips_gnu_rela16_s2;
- else
- return &elf_mips_gnu_rel16_s2;
- default:
- BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
- if (rela_p)
- return &mips_elf64_howto_table_rela[r_type];
- else
- return &mips_elf64_howto_table_rel[r_type];
- break;
- }
-}
-
-/* Prevent relocation handling by bfd for MIPS ELF64. */
-
-static void
-mips_elf64_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *cache_ptr ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *dst ATTRIBUTE_UNUSED)
-{
- BFD_ASSERT (0);
-}
-
-static void
-mips_elf64_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *cache_ptr ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *dst ATTRIBUTE_UNUSED)
-{
- BFD_ASSERT (0);
-}
-
-/* Since each entry in an SHT_REL or SHT_RELA section can represent up
- to three relocs, we must tell the user to allocate more space. */
-
-static long
-mips_elf64_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
-{
- return (sec->reloc_count * 3 + 1) * sizeof (arelent *);
-}
-
-static long
-mips_elf64_get_dynamic_reloc_upper_bound (bfd *abfd)
-{
- return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3;
-}
-
-/* We must also copy more relocations than the corresponding functions
- in elf.c would, so the two following functions are slightly
- modified from elf.c, that multiply the external relocation count by
- 3 to obtain the internal relocation count. */
-
-static long
-mips_elf64_canonicalize_reloc (bfd *abfd, sec_ptr section,
- arelent **relptr, asymbol **symbols)
-{
- arelent *tblptr;
- unsigned int i;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE))
- return -1;
-
- tblptr = section->relocation;
- for (i = 0; i < section->reloc_count * 3; i++)
- *relptr++ = tblptr++;
-
- *relptr = NULL;
-
- return section->reloc_count * 3;
-}
-
-static long
-mips_elf64_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage,
- asymbol **syms)
-{
- bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
- asection *s;
- long ret;
-
- if (elf_dynsymtab (abfd) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
- ret = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
- && (elf_section_data (s)->this_hdr.sh_type == SHT_REL
- || elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
- {
- arelent *p;
- long count, i;
-
- if (! (*slurp_relocs) (abfd, s, syms, TRUE))
- return -1;
- count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize * 3;
- p = s->relocation;
- for (i = 0; i < count; i++)
- *storage++ = p++;
- ret += count;
- }
- }
-
- *storage = NULL;
-
- return ret;
-}
-
-/* Read the relocations from one reloc section. This is mostly copied
- from elfcode.h, except for the changes to expand one external
- relocation to 3 internal ones. We must unfortunately set
- reloc_count to the number of external relocations, because a lot of
- generic code seems to depend on this. */
-
-static bfd_boolean
-mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
- Elf_Internal_Shdr *rel_hdr,
- bfd_size_type reloc_count,
- arelent *relents, asymbol **symbols,
- bfd_boolean dynamic)
-{
- void *allocated;
- bfd_byte *native_relocs;
- arelent *relent;
- bfd_vma i;
- int entsize;
- bfd_boolean rela_p;
-
- allocated = bfd_malloc (rel_hdr->sh_size);
- if (allocated == NULL)
- return FALSE;
-
- if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread (allocated, rel_hdr->sh_size, abfd)
- != rel_hdr->sh_size))
- goto error_return;
-
- native_relocs = allocated;
-
- entsize = rel_hdr->sh_entsize;
- BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel)
- || entsize == sizeof (Elf64_Mips_External_Rela));
-
- if (entsize == sizeof (Elf64_Mips_External_Rel))
- rela_p = FALSE;
- else
- rela_p = TRUE;
-
- for (i = 0, relent = relents;
- i < reloc_count;
- i++, native_relocs += entsize)
- {
- Elf64_Mips_Internal_Rela rela;
- bfd_boolean used_sym, used_ssym;
- int ir;
-
- if (entsize == sizeof (Elf64_Mips_External_Rela))
- mips_elf64_swap_reloca_in (abfd,
- (Elf64_Mips_External_Rela *) native_relocs,
- &rela);
- else
- mips_elf64_swap_reloc_in (abfd,
- (Elf64_Mips_External_Rel *) native_relocs,
- &rela);
-
- /* Each entry represents exactly three actual relocations. */
-
- used_sym = FALSE;
- used_ssym = FALSE;
- for (ir = 0; ir < 3; ir++)
- {
- enum elf_mips_reloc_type type;
-
- switch (ir)
- {
- default:
- abort ();
- case 0:
- type = (enum elf_mips_reloc_type) rela.r_type;
- break;
- case 1:
- type = (enum elf_mips_reloc_type) rela.r_type2;
- break;
- case 2:
- type = (enum elf_mips_reloc_type) rela.r_type3;
- break;
- }
-
- /* Some types require symbols, whereas some do not. */
- switch (type)
- {
- case R_MIPS_NONE:
- case R_MIPS_LITERAL:
- case R_MIPS_INSERT_A:
- case R_MIPS_INSERT_B:
- case R_MIPS_DELETE:
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- break;
-
- default:
- if (! used_sym)
- {
- if (rela.r_sym == 0)
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- else
- {
- asymbol **ps, *s;
-
- ps = symbols + rela.r_sym - 1;
- s = *ps;
- if ((s->flags & BSF_SECTION_SYM) == 0)
- relent->sym_ptr_ptr = ps;
- else
- relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
- }
-
- used_sym = TRUE;
- }
- else if (! used_ssym)
- {
- switch (rela.r_ssym)
- {
- case RSS_UNDEF:
- relent->sym_ptr_ptr =
- bfd_abs_section_ptr->symbol_ptr_ptr;
- break;
-
- case RSS_GP:
- case RSS_GP0:
- case RSS_LOC:
- /* FIXME: I think these need to be handled using
- special howto structures. */
- BFD_ASSERT (0);
- break;
-
- default:
- BFD_ASSERT (0);
- break;
- }
-
- used_ssym = TRUE;
- }
- else
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
-
- break;
- }
-
- /* The address of an ELF reloc is section relative for an
- object file, and absolute for an executable file or
- shared library. The address of a BFD reloc is always
- section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic)
- relent->address = rela.r_offset;
- else
- relent->address = rela.r_offset - asect->vma;
-
- relent->addend = rela.r_addend;
-
- relent->howto = mips_elf64_rtype_to_howto (type, rela_p);
-
- ++relent;
- }
- }
-
- asect->reloc_count += (relent - relents) / 3;
-
- if (allocated != NULL)
- free (allocated);
-
- return TRUE;
-
- error_return:
- if (allocated != NULL)
- free (allocated);
- return FALSE;
-}
-
-/* Read the relocations. On Irix 6, there can be two reloc sections
- associated with a single data section. This is copied from
- elfcode.h as well, with changes as small as accounting for 3
- internal relocs per external reloc and resetting reloc_count to
- zero before processing the relocs of a section. */
-
-static bfd_boolean
-mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
- asymbol **symbols, bfd_boolean dynamic)
-{
- struct bfd_elf_section_data * const d = elf_section_data (asect);
- Elf_Internal_Shdr *rel_hdr;
- Elf_Internal_Shdr *rel_hdr2;
- bfd_size_type reloc_count;
- bfd_size_type reloc_count2;
- arelent *relents;
- bfd_size_type amt;
-
- if (asect->relocation != NULL)
- return TRUE;
-
- if (! dynamic)
- {
- if ((asect->flags & SEC_RELOC) == 0
- || asect->reloc_count == 0)
- return TRUE;
-
- rel_hdr = &d->rel_hdr;
- reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
- rel_hdr2 = d->rel_hdr2;
- reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0);
-
- BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2);
- BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
- || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
-
- }
- else
- {
- /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
- case because relocations against this section may use the
- dynamic symbol table, and in that case bfd_section_from_shdr
- in elf.c does not update the RELOC_COUNT. */
- if (asect->_raw_size == 0)
- return TRUE;
-
- rel_hdr = &d->this_hdr;
- reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
- rel_hdr2 = NULL;
- reloc_count2 = 0;
- }
-
- /* Allocate space for 3 arelent structures for each Rel structure. */
- amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent);
- relents = bfd_alloc (abfd, amt);
- if (relents == NULL)
- return FALSE;
-
- /* The slurp_one_reloc_table routine increments reloc_count. */
- asect->reloc_count = 0;
-
- if (! mips_elf64_slurp_one_reloc_table (abfd, asect,
- rel_hdr, reloc_count,
- relents,
- symbols, dynamic))
- return FALSE;
- if (d->rel_hdr2 != NULL)
- {
- if (! mips_elf64_slurp_one_reloc_table (abfd, asect,
- rel_hdr2, reloc_count2,
- relents + reloc_count * 3,
- symbols, dynamic))
- return FALSE;
- }
-
- asect->relocation = relents;
- return TRUE;
-}
-
-/* Write out the relocations. */
-
-static void
-mips_elf64_write_relocs (bfd *abfd, asection *sec, void *data)
-{
- bfd_boolean *failedp = data;
- int count;
- Elf_Internal_Shdr *rel_hdr;
- unsigned int idx;
-
- /* If we have already failed, don't do anything. */
- if (*failedp)
- return;
-
- if ((sec->flags & SEC_RELOC) == 0)
- return;
-
- /* The linker backend writes the relocs out itself, and sets the
- reloc_count field to zero to inhibit writing them here. Also,
- sometimes the SEC_RELOC flag gets set even when there aren't any
- relocs. */
- if (sec->reloc_count == 0)
- return;
-
- /* We can combine up to three relocs that refer to the same address
- if the latter relocs have no associated symbol. */
- count = 0;
- for (idx = 0; idx < sec->reloc_count; idx++)
- {
- bfd_vma addr;
- unsigned int i;
-
- ++count;
-
- addr = sec->orelocation[idx]->address;
- for (i = 0; i < 2; i++)
- {
- arelent *r;
-
- if (idx + 1 >= sec->reloc_count)
- break;
- r = sec->orelocation[idx + 1];
- if (r->address != addr
- || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
- || (*r->sym_ptr_ptr)->value != 0)
- break;
-
- /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
-
- ++idx;
- }
- }
-
- rel_hdr = &elf_section_data (sec)->rel_hdr;
-
- /* Do the actual relocation. */
-
- if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rel))
- mips_elf64_write_rel (abfd, sec, rel_hdr, &count, data);
- else if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rela))
- mips_elf64_write_rela (abfd, sec, rel_hdr, &count, data);
- else
- BFD_ASSERT (0);
-}
-
-static void
-mips_elf64_write_rel (bfd *abfd, asection *sec,
- Elf_Internal_Shdr *rel_hdr,
- int *count, void *data)
-{
- bfd_boolean *failedp = data;
- Elf64_Mips_External_Rel *ext_rel;
- unsigned int idx;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
-
- rel_hdr->sh_size = rel_hdr->sh_entsize * *count;
- rel_hdr->contents = bfd_alloc (abfd, rel_hdr->sh_size);
- if (rel_hdr->contents == NULL)
- {
- *failedp = TRUE;
- return;
- }
-
- ext_rel = (Elf64_Mips_External_Rel *) rel_hdr->contents;
- for (idx = 0; idx < sec->reloc_count; idx++, ext_rel++)
- {
- arelent *ptr;
- Elf64_Mips_Internal_Rela int_rel;
- asymbol *sym;
- int n;
- unsigned int i;
-
- ptr = sec->orelocation[idx];
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a BFD reloc is always section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- int_rel.r_offset = ptr->address;
- else
- int_rel.r_offset = ptr->address + sec->vma;
-
- sym = *ptr->sym_ptr_ptr;
- if (sym == last_sym)
- n = last_sym_idx;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = TRUE;
- return;
- }
- last_sym_idx = n;
- }
-
- int_rel.r_sym = n;
- int_rel.r_ssym = RSS_UNDEF;
-
- if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
- {
- *failedp = TRUE;
- return;
- }
-
- int_rel.r_type = ptr->howto->type;
- int_rel.r_type2 = (int) R_MIPS_NONE;
- int_rel.r_type3 = (int) R_MIPS_NONE;
-
- for (i = 0; i < 2; i++)
- {
- arelent *r;
-
- if (idx + 1 >= sec->reloc_count)
- break;
- r = sec->orelocation[idx + 1];
- if (r->address != ptr->address
- || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
- || (*r->sym_ptr_ptr)->value != 0)
- break;
-
- /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
-
- if (i == 0)
- int_rel.r_type2 = r->howto->type;
- else
- int_rel.r_type3 = r->howto->type;
-
- ++idx;
- }
-
- mips_elf64_swap_reloc_out (abfd, &int_rel, ext_rel);
- }
-
- BFD_ASSERT (ext_rel - (Elf64_Mips_External_Rel *) rel_hdr->contents
- == *count);
-}
-
-static void
-mips_elf64_write_rela (bfd *abfd, asection *sec,
- Elf_Internal_Shdr *rela_hdr,
- int *count, void *data)
-{
- bfd_boolean *failedp = data;
- Elf64_Mips_External_Rela *ext_rela;
- unsigned int idx;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
-
- rela_hdr->sh_size = rela_hdr->sh_entsize * *count;
- rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
- if (rela_hdr->contents == NULL)
- {
- *failedp = TRUE;
- return;
- }
-
- ext_rela = (Elf64_Mips_External_Rela *) rela_hdr->contents;
- for (idx = 0; idx < sec->reloc_count; idx++, ext_rela++)
- {
- arelent *ptr;
- Elf64_Mips_Internal_Rela int_rela;
- asymbol *sym;
- int n;
- unsigned int i;
-
- ptr = sec->orelocation[idx];
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a BFD reloc is always section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- int_rela.r_offset = ptr->address;
- else
- int_rela.r_offset = ptr->address + sec->vma;
-
- sym = *ptr->sym_ptr_ptr;
- if (sym == last_sym)
- n = last_sym_idx;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = TRUE;
- return;
- }
- last_sym_idx = n;
- }
-
- int_rela.r_sym = n;
- int_rela.r_addend = ptr->addend;
- int_rela.r_ssym = RSS_UNDEF;
-
- if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
- {
- *failedp = TRUE;
- return;
- }
-
- int_rela.r_type = ptr->howto->type;
- int_rela.r_type2 = (int) R_MIPS_NONE;
- int_rela.r_type3 = (int) R_MIPS_NONE;
-
- for (i = 0; i < 2; i++)
- {
- arelent *r;
-
- if (idx + 1 >= sec->reloc_count)
- break;
- r = sec->orelocation[idx + 1];
- if (r->address != ptr->address
- || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
- || (*r->sym_ptr_ptr)->value != 0)
- break;
-
- /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
-
- if (i == 0)
- int_rela.r_type2 = r->howto->type;
- else
- int_rela.r_type3 = r->howto->type;
-
- ++idx;
- }
-
- mips_elf64_swap_reloca_out (abfd, &int_rela, ext_rela);
- }
-
- BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents
- == *count);
-}
-
-/* Set the right machine number for a MIPS ELF file. */
-
-static bfd_boolean
-mips_elf64_object_p (bfd *abfd)
-{
- unsigned long mach;
-
- /* Irix 6 is broken. Object file symbol tables are not always
- sorted correctly such that local symbols precede global symbols,
- and the sh_info field in the symbol table is not always right. */
- if (elf64_mips_irix_compat (abfd) != ict_none)
- elf_bad_symtab (abfd) = TRUE;
-
- mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
- bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
- return TRUE;
-}
-
-/* Depending on the target vector we generate some version of Irix
- executables or "normal" MIPS ELF ABI executables. */
-static irix_compat_t
-elf64_mips_irix_compat (bfd *abfd)
-{
- if ((abfd->xvec == &bfd_elf64_bigmips_vec)
- || (abfd->xvec == &bfd_elf64_littlemips_vec))
- return ict_irix6;
- else
- return ict_none;
-}
-
-/* Support for core dump NOTE sections. */
-static bfd_boolean
-elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- int offset;
- unsigned int raw_size;
-
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 480: /* Linux/MIPS - N64 kernel */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
-
- /* pr_reg */
- offset = 112;
- raw_size = 360;
-
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static bfd_boolean
-elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 136: /* Linux/MIPS - N64 kernel elf_prpsinfo */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-
-/* ECOFF swapping routines. These are used when dealing with the
- .mdebug section, which is in the ECOFF debugging format. */
-static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap =
-{
- /* Symbol table magic number. */
- magicSym2,
- /* Alignment of debugging information. E.g., 4. */
- 8,
- /* Sizes of external symbolic information. */
- sizeof (struct hdr_ext),
- sizeof (struct dnr_ext),
- sizeof (struct pdr_ext),
- sizeof (struct sym_ext),
- sizeof (struct opt_ext),
- sizeof (struct fdr_ext),
- sizeof (struct rfd_ext),
- sizeof (struct ext_ext),
- /* Functions to swap in external symbolic data. */
- ecoff_swap_hdr_in,
- ecoff_swap_dnr_in,
- ecoff_swap_pdr_in,
- ecoff_swap_sym_in,
- ecoff_swap_opt_in,
- ecoff_swap_fdr_in,
- ecoff_swap_rfd_in,
- ecoff_swap_ext_in,
- _bfd_ecoff_swap_tir_in,
- _bfd_ecoff_swap_rndx_in,
- /* Functions to swap out external symbolic data. */
- ecoff_swap_hdr_out,
- ecoff_swap_dnr_out,
- ecoff_swap_pdr_out,
- ecoff_swap_sym_out,
- ecoff_swap_opt_out,
- ecoff_swap_fdr_out,
- ecoff_swap_rfd_out,
- ecoff_swap_ext_out,
- _bfd_ecoff_swap_tir_out,
- _bfd_ecoff_swap_rndx_out,
- /* Function to read in symbolic data. */
- _bfd_mips_elf_read_ecoff_info
-};
-
-/* Relocations in the 64 bit MIPS ELF ABI are more complex than in
- standard ELF. This structure is used to redirect the relocation
- handling routines. */
-
-const struct elf_size_info mips_elf64_size_info =
-{
- sizeof (Elf64_External_Ehdr),
- sizeof (Elf64_External_Phdr),
- sizeof (Elf64_External_Shdr),
- sizeof (Elf64_Mips_External_Rel),
- sizeof (Elf64_Mips_External_Rela),
- sizeof (Elf64_External_Sym),
- sizeof (Elf64_External_Dyn),
- sizeof (Elf_External_Note),
- 4, /* hash-table entry size */
- 3, /* internal relocations per external relocations */
- 64, /* arch_size */
- 3, /* log_file_align */
- ELFCLASS64,
- EV_CURRENT,
- bfd_elf64_write_out_phdrs,
- bfd_elf64_write_shdrs_and_ehdr,
- mips_elf64_write_relocs,
- bfd_elf64_swap_symbol_in,
- bfd_elf64_swap_symbol_out,
- mips_elf64_slurp_reloc_table,
- bfd_elf64_slurp_symbol_table,
- bfd_elf64_swap_dyn_in,
- bfd_elf64_swap_dyn_out,
- mips_elf64_be_swap_reloc_in,
- mips_elf64_be_swap_reloc_out,
- mips_elf64_be_swap_reloca_in,
- mips_elf64_be_swap_reloca_out
-};
-
-#define ELF_ARCH bfd_arch_mips
-#define ELF_MACHINE_CODE EM_MIPS
-
-#define elf_backend_collect TRUE
-#define elf_backend_type_change_ok TRUE
-#define elf_backend_can_gc_sections TRUE
-#define elf_info_to_howto mips_elf64_info_to_howto_rela
-#define elf_info_to_howto_rel mips_elf64_info_to_howto_rel
-#define elf_backend_object_p mips_elf64_object_p
-#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
-#define elf_backend_section_processing _bfd_mips_elf_section_processing
-#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
-#define elf_backend_fake_sections _bfd_mips_elf_fake_sections
-#define elf_backend_section_from_bfd_section \
- _bfd_mips_elf_section_from_bfd_section
-#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
-#define elf_backend_link_output_symbol_hook \
- _bfd_mips_elf_link_output_symbol_hook
-#define elf_backend_create_dynamic_sections \
- _bfd_mips_elf_create_dynamic_sections
-#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
- _bfd_mips_elf_adjust_dynamic_symbol
-#define elf_backend_always_size_sections \
- _bfd_mips_elf_always_size_sections
-#define elf_backend_size_dynamic_sections \
- _bfd_mips_elf_size_dynamic_sections
-#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- _bfd_mips_elf_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- _bfd_mips_elf_finish_dynamic_sections
-#define elf_backend_final_write_processing \
- _bfd_mips_elf_final_write_processing
-#define elf_backend_additional_program_headers \
- _bfd_mips_elf_additional_program_headers
-#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
-#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
-#define elf_backend_copy_indirect_symbol \
- _bfd_mips_elf_copy_indirect_symbol
-#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
-#define elf_backend_ignore_discarded_relocs \
- _bfd_mips_elf_ignore_discarded_relocs
-#define elf_backend_mips_irix_compat elf64_mips_irix_compat
-#define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto
-#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
-#define elf_backend_size_info mips_elf64_size_info
-
-#define elf_backend_grok_prstatus elf64_mips_grok_prstatus
-#define elf_backend_grok_psinfo elf64_mips_grok_psinfo
-
-#define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
-
-/* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
- work better/work only in RELA, so we default to this. */
-#define elf_backend_may_use_rel_p 1
-#define elf_backend_may_use_rela_p 1
-#define elf_backend_default_use_rela_p 1
-
-#define elf_backend_write_section _bfd_mips_elf_write_section
-
-/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
- MIPS-specific function only applies to IRIX5, which had no 64-bit
- ABI. */
-#define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
-#define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook
-#define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
-#define bfd_elf64_bfd_get_relocated_section_contents \
- _bfd_elf_mips_get_relocated_section_contents
-#define bfd_elf64_bfd_link_hash_table_create \
- _bfd_mips_elf_link_hash_table_create
-#define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
-#define bfd_elf64_bfd_merge_private_bfd_data \
- _bfd_mips_elf_merge_private_bfd_data
-#define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
-#define bfd_elf64_bfd_print_private_bfd_data \
- _bfd_mips_elf_print_private_bfd_data
-
-#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
-#define bfd_elf64_canonicalize_reloc mips_elf64_canonicalize_reloc
-#define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
-#define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc
-#define bfd_elf64_bfd_relax_section _bfd_mips_relax_section
-
-/* MIPS ELF64 archive functions. */
-#define bfd_elf64_archive_functions
-extern bfd_boolean bfd_elf64_archive_slurp_armap
- (bfd *);
-extern bfd_boolean bfd_elf64_archive_write_armap
- (bfd *, unsigned int, struct orl *, unsigned int, int);
-#define bfd_elf64_archive_slurp_extended_name_table \
- _bfd_archive_coff_slurp_extended_name_table
-#define bfd_elf64_archive_construct_extended_name_table \
- _bfd_archive_coff_construct_extended_name_table
-#define bfd_elf64_archive_truncate_arname \
- _bfd_archive_coff_truncate_arname
-#define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr
-#define bfd_elf64_archive_openr_next_archived_file \
- _bfd_archive_coff_openr_next_archived_file
-#define bfd_elf64_archive_get_elt_at_index \
- _bfd_archive_coff_get_elt_at_index
-#define bfd_elf64_archive_generic_stat_arch_elt \
- _bfd_archive_coff_generic_stat_arch_elt
-#define bfd_elf64_archive_update_armap_timestamp \
- _bfd_archive_coff_update_armap_timestamp
-
-/* The SGI style (n)64 NewABI. */
-#define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
-#define TARGET_LITTLE_NAME "elf64-littlemips"
-#define TARGET_BIG_SYM bfd_elf64_bigmips_vec
-#define TARGET_BIG_NAME "elf64-bigmips"
-
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible.
- FIXME: How does this affect NewABI? */
-#define ELF_MAXPAGESIZE 0x1000
-
-#include "elf64-target.h"
-
-/* The SYSV-style 'traditional' (n)64 NewABI. */
-#undef TARGET_LITTLE_SYM
-#undef TARGET_LITTLE_NAME
-#undef TARGET_BIG_SYM
-#undef TARGET_BIG_NAME
-
-#undef ELF_MAXPAGESIZE
-
-#define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
-#define TARGET_LITTLE_NAME "elf64-tradlittlemips"
-#define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
-#define TARGET_BIG_NAME "elf64-tradbigmips"
-
-/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
-#define ELF_MAXPAGESIZE 0x10000
-#define elf64_bed elf64_tradbed
-
-/* Include the target file again for this target. */
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c
deleted file mode 100644
index a0d81d0..0000000
--- a/contrib/binutils/bfd/elf64-ppc.c
+++ /dev/null
@@ -1,9024 +0,0 @@
-/* PowerPC64-specific support for 64-bit ELF.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Linus Nordberg, Swox AB <info@swox.com>,
- based on elf32-ppc.c by Ian Lance Taylor.
- Largely rewritten by Alan Modra <amodra@bigpond.net.au>
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* The 64-bit PowerPC ELF ABI may be found at
- http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and
- http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "elf/ppc64.h"
-#include "elf64-ppc.h"
-
-static bfd_reloc_status_type ppc64_elf_ha_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc64_elf_brtaken_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc64_elf_sectoff_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc64_elf_sectoff_ha_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc64_elf_toc_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc64_elf_toc_ha_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc64_elf_toc64_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc64_elf_unhandled_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-
-
-#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec
-#define TARGET_LITTLE_NAME "elf64-powerpcle"
-#define TARGET_BIG_SYM bfd_elf64_powerpc_vec
-#define TARGET_BIG_NAME "elf64-powerpc"
-#define ELF_ARCH bfd_arch_powerpc
-#define ELF_MACHINE_CODE EM_PPC64
-#define ELF_MAXPAGESIZE 0x10000
-#define elf_info_to_howto ppc64_elf_info_to_howto
-
-#define elf_backend_want_got_sym 0
-#define elf_backend_want_plt_sym 0
-#define elf_backend_plt_alignment 3
-#define elf_backend_plt_not_loaded 1
-#define elf_backend_got_symbol_offset 0
-#define elf_backend_got_header_size 8
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_rela_normal 1
-
-#define bfd_elf64_mkobject ppc64_elf_mkobject
-#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
-#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
-#define bfd_elf64_new_section_hook ppc64_elf_new_section_hook
-#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create
-#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free
-
-#define elf_backend_object_p ppc64_elf_object_p
-#define elf_backend_grok_prstatus ppc64_elf_grok_prstatus
-#define elf_backend_grok_psinfo ppc64_elf_grok_psinfo
-#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
-#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol
-#define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook
-#define elf_backend_check_relocs ppc64_elf_check_relocs
-#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook
-#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol
-#define elf_backend_hide_symbol ppc64_elf_hide_symbol
-#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust
-#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections
-#define elf_backend_relocate_section ppc64_elf_relocate_section
-#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol
-#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
-#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
-#define elf_backend_link_output_symbol_hook ppc64_elf_output_symbol_hook
-#define elf_backend_special_sections ppc64_elf_special_sections
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-
-/* The size in bytes of an entry in the procedure linkage table. */
-#define PLT_ENTRY_SIZE 24
-
-/* The initial size of the plt reserved for the dynamic linker. */
-#define PLT_INITIAL_ENTRY_SIZE PLT_ENTRY_SIZE
-
-/* TOC base pointers offset from start of TOC. */
-#define TOC_BASE_OFF 0x8000
-
-/* Offset of tp and dtp pointers from start of TLS block. */
-#define TP_OFFSET 0x7000
-#define DTP_OFFSET 0x8000
-
-/* .plt call stub instructions. The normal stub is like this, but
- sometimes the .plt entry crosses a 64k boundary and we need to
- insert an addis to adjust r12. */
-#define PLT_CALL_STUB_SIZE (7*4)
-#define ADDIS_R12_R2 0x3d820000 /* addis %r12,%r2,xxx@ha */
-#define STD_R2_40R1 0xf8410028 /* std %r2,40(%r1) */
-#define LD_R11_0R12 0xe96c0000 /* ld %r11,xxx+0@l(%r12) */
-#define LD_R2_0R12 0xe84c0000 /* ld %r2,xxx+8@l(%r12) */
-#define MTCTR_R11 0x7d6903a6 /* mtctr %r11 */
- /* ld %r11,xxx+16@l(%r12) */
-#define BCTR 0x4e800420 /* bctr */
-
-
-#define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */
-#define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */
-
-#define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */
-
-/* glink call stub instructions. We enter with the index in R0, and the
- address of glink entry in CTR. From that, we can calculate PLT0. */
-#define GLINK_CALL_STUB_SIZE (16*4)
-#define MFCTR_R12 0x7d8902a6 /* mfctr %r12 */
-#define SLDI_R11_R0_3 0x780b1f24 /* sldi %r11,%r0,3 */
-#define ADDIC_R2_R0_32K 0x34408000 /* addic. %r2,%r0,-32768 */
-#define SUB_R12_R12_R11 0x7d8b6050 /* sub %r12,%r12,%r11 */
-#define SRADI_R2_R2_63 0x7c42fe76 /* sradi %r2,%r2,63 */
-#define SLDI_R11_R0_2 0x780b1764 /* sldi %r11,%r0,2 */
-#define AND_R2_R2_R11 0x7c425838 /* and %r2,%r2,%r11 */
- /* sub %r12,%r12,%r11 */
-#define ADD_R12_R12_R2 0x7d8c1214 /* add %r12,%r12,%r2 */
-#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,xxx@ha */
- /* ld %r11,xxx@l(%r12) */
-#define ADDI_R12_R12 0x398c0000 /* addi %r12,%r12,xxx@l */
- /* ld %r2,8(%r12) */
- /* mtctr %r11 */
- /* ld %r11,16(%r12) */
- /* bctr */
-
-/* Pad with this. */
-#define NOP 0x60000000
-
-/* Some other nops. */
-#define CROR_151515 0x4def7b82
-#define CROR_313131 0x4ffffb82
-
-/* .glink entries for the first 32k functions are two instructions. */
-#define LI_R0_0 0x38000000 /* li %r0,0 */
-#define B_DOT 0x48000000 /* b . */
-
-/* After that, we need two instructions to load the index, followed by
- a branch. */
-#define LIS_R0_0 0x3c000000 /* lis %r0,0 */
-#define ORI_R0_R0_0 0x60000000 /* ori %r0,%r0,0 */
-
-/* Instructions to save and restore floating point regs. */
-#define STFD_FR0_0R1 0xd8010000 /* stfd %fr0,0(%r1) */
-#define LFD_FR0_0R1 0xc8010000 /* lfd %fr0,0(%r1) */
-#define BLR 0x4e800020 /* blr */
-
-/* Since .opd is an array of descriptors and each entry will end up
- with identical R_PPC64_RELATIVE relocs, there is really no need to
- propagate .opd relocs; The dynamic linker should be taught to
- relocate .opd without reloc entries. */
-#ifndef NO_OPD_RELOCS
-#define NO_OPD_RELOCS 0
-#endif
-
-#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1)
-
-/* Relocation HOWTO's. */
-static reloc_howto_type *ppc64_elf_howto_table[(int) R_PPC64_max];
-
-static reloc_howto_type ppc64_elf_howto_raw[] = {
- /* This reloc does nothing. */
- HOWTO (R_PPC64_NONE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 32 bit relocation. */
- HOWTO (R_PPC64_ADDR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 26 bit branch; the lower two bits must be zero.
- FIXME: we don't check that, we just clear them. */
- HOWTO (R_PPC64_ADDR24, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR24", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x03fffffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 16 bit relocation. */
- HOWTO (R_PPC64_ADDR16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit relocation without overflow. */
- HOWTO (R_PPC64_ADDR16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Bits 16-31 of an address. */
- HOWTO (R_PPC64_ADDR16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Bits 16-31 of an address, plus 1 if the contents of the low 16
- bits, treated as a signed number, is negative. */
- HOWTO (R_PPC64_ADDR16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_ha_reloc, /* special_function */
- "R_PPC64_ADDR16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 16 bit branch; the lower two bits must be zero.
- FIXME: we don't check that, we just clear them. */
- HOWTO (R_PPC64_ADDR14, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR14", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000fffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 16 bit branch, for which bit 10 should be set to
- indicate that the branch is expected to be taken. The lower two
- bits must be zero. */
- HOWTO (R_PPC64_ADDR14_BRTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc64_elf_brtaken_reloc, /* special_function */
- "R_PPC64_ADDR14_BRTAKEN",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000fffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An absolute 16 bit branch, for which bit 10 should be set to
- indicate that the branch is not expected to be taken. The lower
- two bits must be zero. */
- HOWTO (R_PPC64_ADDR14_BRNTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc64_elf_brtaken_reloc, /* special_function */
- "R_PPC64_ADDR14_BRNTAKEN",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000fffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A relative 26 bit branch; the lower two bits must be zero. */
- HOWTO (R_PPC64_REL24, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_REL24", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x03fffffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A relative 16 bit branch; the lower two bits must be zero. */
- HOWTO (R_PPC64_REL14, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_REL14", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000fffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A relative 16 bit branch. Bit 10 should be set to indicate that
- the branch is expected to be taken. The lower two bits must be
- zero. */
- HOWTO (R_PPC64_REL14_BRTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_brtaken_reloc, /* special_function */
- "R_PPC64_REL14_BRTAKEN", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000fffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A relative 16 bit branch. Bit 10 should be set to indicate that
- the branch is not expected to be taken. The lower two bits must
- be zero. */
- HOWTO (R_PPC64_REL14_BRNTAKEN, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_brtaken_reloc, /* special_function */
- "R_PPC64_REL14_BRNTAKEN",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000fffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16, but referring to the GOT table entry for the
- symbol. */
- HOWTO (R_PPC64_GOT16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16_LO, but referring to the GOT table entry for
- the symbol. */
- HOWTO (R_PPC64_GOT16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16_HI, but referring to the GOT table entry for
- the symbol. */
- HOWTO (R_PPC64_GOT16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16_HA, but referring to the GOT table entry for
- the symbol. */
- HOWTO (R_PPC64_GOT16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* This is used only by the dynamic linker. The symbol should exist
- both in the object being run and in some shared library. The
- dynamic linker copies the data addressed by the symbol from the
- shared library into the object, because the object being
- run has to have the data at some particular address. */
- HOWTO (R_PPC64_COPY, /* type */
- 0, /* rightshift */
- 0, /* this one is variable size */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_COPY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR64, but used when setting global offset table
- entries. */
- HOWTO (R_PPC64_GLOB_DAT, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GLOB_DAT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Created by the link editor. Marks a procedure linkage table
- entry for a symbol. */
- HOWTO (R_PPC64_JMP_SLOT, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_JMP_SLOT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used only by the dynamic linker. When the object is run, this
- doubleword64 is set to the load address of the object, plus the
- addend. */
- HOWTO (R_PPC64_RELATIVE, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_RELATIVE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR32, but may be unaligned. */
- HOWTO (R_PPC64_UADDR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_UADDR32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16, but may be unaligned. */
- HOWTO (R_PPC64_UADDR16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_UADDR16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32-bit PC relative. */
- HOWTO (R_PPC64_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- /* FIXME: Verify. Was complain_overflow_bitfield. */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_REL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 32-bit relocation to the symbol's procedure linkage table. */
- HOWTO (R_PPC64_PLT32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLT32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32-bit PC relative relocation to the symbol's procedure linkage table.
- FIXME: R_PPC64_PLTREL32 not supported. */
- HOWTO (R_PPC64_PLTREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_PLTREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16_LO, but referring to the PLT table entry for
- the symbol. */
- HOWTO (R_PPC64_PLT16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLT16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16_HI, but referring to the PLT table entry for
- the symbol. */
- HOWTO (R_PPC64_PLT16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLT16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16_HA, but referring to the PLT table entry for
- the symbol. */
- HOWTO (R_PPC64_PLT16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLT16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16-bit section relative relocation. */
- HOWTO (R_PPC64_SECTOFF, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc64_elf_sectoff_reloc, /* special_function */
- "R_PPC64_SECTOFF", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_SECTOFF, but no overflow warning. */
- HOWTO (R_PPC64_SECTOFF_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_sectoff_reloc, /* special_function */
- "R_PPC64_SECTOFF_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16-bit upper half section relative relocation. */
- HOWTO (R_PPC64_SECTOFF_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_sectoff_reloc, /* special_function */
- "R_PPC64_SECTOFF_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16-bit upper half adjusted section relative relocation. */
- HOWTO (R_PPC64_SECTOFF_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_sectoff_ha_reloc, /* special_function */
- "R_PPC64_SECTOFF_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_REL24 without touching the two least significant bits. */
- HOWTO (R_PPC64_REL30, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 30, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_REL30", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffffffc, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Relocs in the 64-bit PowerPC ELF ABI, not in the 32-bit ABI. */
-
- /* A standard 64-bit relocation. */
- HOWTO (R_PPC64_ADDR64, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The bits 32-47 of an address. */
- HOWTO (R_PPC64_ADDR16_HIGHER, /* type */
- 32, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR16_HIGHER", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The bits 32-47 of an address, plus 1 if the contents of the low
- 16 bits, treated as a signed number, is negative. */
- HOWTO (R_PPC64_ADDR16_HIGHERA, /* type */
- 32, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_ha_reloc, /* special_function */
- "R_PPC64_ADDR16_HIGHERA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The bits 48-63 of an address. */
- HOWTO (R_PPC64_ADDR16_HIGHEST,/* type */
- 48, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR16_HIGHEST", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The bits 48-63 of an address, plus 1 if the contents of the low
- 16 bits, treated as a signed number, is negative. */
- HOWTO (R_PPC64_ADDR16_HIGHESTA,/* type */
- 48, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_ha_reloc, /* special_function */
- "R_PPC64_ADDR16_HIGHESTA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like ADDR64, but may be unaligned. */
- HOWTO (R_PPC64_UADDR64, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_UADDR64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64-bit relative relocation. */
- HOWTO (R_PPC64_REL64, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_REL64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 64-bit relocation to the symbol's procedure linkage table. */
- HOWTO (R_PPC64_PLT64, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLT64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64-bit PC relative relocation to the symbol's procedure linkage
- table. */
- /* FIXME: R_PPC64_PLTREL64 not supported. */
- HOWTO (R_PPC64_PLTREL64, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLTREL64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 16 bit TOC-relative relocation. */
-
- /* R_PPC64_TOC16 47 half16* S + A - .TOC. */
- HOWTO (R_PPC64_TOC16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_toc_reloc, /* special_function */
- "R_PPC64_TOC16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit TOC-relative relocation without overflow. */
-
- /* R_PPC64_TOC16_LO 48 half16 #lo (S + A - .TOC.) */
- HOWTO (R_PPC64_TOC16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_toc_reloc, /* special_function */
- "R_PPC64_TOC16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit TOC-relative relocation, high 16 bits. */
-
- /* R_PPC64_TOC16_HI 49 half16 #hi (S + A - .TOC.) */
- HOWTO (R_PPC64_TOC16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_toc_reloc, /* special_function */
- "R_PPC64_TOC16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit TOC-relative relocation, high 16 bits, plus 1 if the
- contents of the low 16 bits, treated as a signed number, is
- negative. */
-
- /* R_PPC64_TOC16_HA 50 half16 #ha (S + A - .TOC.) */
- HOWTO (R_PPC64_TOC16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_toc_ha_reloc, /* special_function */
- "R_PPC64_TOC16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64-bit relocation; insert value of TOC base (.TOC.). */
-
- /* R_PPC64_TOC 51 doubleword64 .TOC. */
- HOWTO (R_PPC64_TOC, /* type */
- 0, /* rightshift */
- 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc64_elf_toc64_reloc, /* special_function */
- "R_PPC64_TOC", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_GOT16, but also informs the link editor that the
- value to relocate may (!) refer to a PLT entry which the link
- editor (a) may replace with the symbol value. If the link editor
- is unable to fully resolve the symbol, it may (b) create a PLT
- entry and store the address to the new PLT entry in the GOT.
- This permits lazy resolution of function symbols at run time.
- The link editor may also skip all of this and just (c) emit a
- R_PPC64_GLOB_DAT to tie the symbol to the GOT entry. */
- /* FIXME: R_PPC64_PLTGOT16 not implemented. */
- HOWTO (R_PPC64_PLTGOT16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLTGOT16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_PLTGOT16, but without overflow. */
- /* FIXME: R_PPC64_PLTGOT16_LO not implemented. */
- HOWTO (R_PPC64_PLTGOT16_LO, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLTGOT16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_PLT_GOT16, but using bits 16-31 of the address. */
- /* FIXME: R_PPC64_PLTGOT16_HI not implemented. */
- HOWTO (R_PPC64_PLTGOT16_HI, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLTGOT16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_PLT_GOT16, but using bits 16-31 of the address, plus
- 1 if the contents of the low 16 bits, treated as a signed number,
- is negative. */
- /* FIXME: R_PPC64_PLTGOT16_HA not implemented. */
- HOWTO (R_PPC64_PLTGOT16_HA, /* type */
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLTGOT16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16, but for instructions with a DS field. */
- HOWTO (R_PPC64_ADDR16_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_ADDR16_LO, but for instructions with a DS field. */
- HOWTO (R_PPC64_ADDR16_LO_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR16_LO_DS",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_GOT16, but for instructions with a DS field. */
- HOWTO (R_PPC64_GOT16_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_GOT16_LO, but for instructions with a DS field. */
- HOWTO (R_PPC64_GOT16_LO_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT16_LO_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_PLT16_LO, but for instructions with a DS field. */
- HOWTO (R_PPC64_PLT16_LO_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLT16_LO_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_SECTOFF, but for instructions with a DS field. */
- HOWTO (R_PPC64_SECTOFF_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- ppc64_elf_sectoff_reloc, /* special_function */
- "R_PPC64_SECTOFF_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_SECTOFF_LO, but for instructions with a DS field. */
- HOWTO (R_PPC64_SECTOFF_LO_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_sectoff_reloc, /* special_function */
- "R_PPC64_SECTOFF_LO_DS",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_TOC16, but for instructions with a DS field. */
- HOWTO (R_PPC64_TOC16_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_toc_reloc, /* special_function */
- "R_PPC64_TOC16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_TOC16_LO, but for instructions with a DS field. */
- HOWTO (R_PPC64_TOC16_LO_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_toc_reloc, /* special_function */
- "R_PPC64_TOC16_LO_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_PLTGOT16, but for instructions with a DS field. */
- /* FIXME: R_PPC64_PLTGOT16_DS not implemented. */
- HOWTO (R_PPC64_PLTGOT16_DS, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLTGOT16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like R_PPC64_PLTGOT16_LO, but for instructions with a DS field. */
- /* FIXME: R_PPC64_PLTGOT16_LO not implemented. */
- HOWTO (R_PPC64_PLTGOT16_LO_DS,/* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_PLTGOT16_LO_DS",/* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Marker reloc for TLS. */
- HOWTO (R_PPC64_TLS,
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_TLS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Computes the load module index of the load module that contains the
- definition of its TLS sym. */
- HOWTO (R_PPC64_DTPMOD64,
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPMOD64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Computes a dtv-relative displacement, the difference between the value
- of sym+add and the base address of the thread-local storage block that
- contains the definition of sym, minus 0x8000. */
- HOWTO (R_PPC64_DTPREL64,
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit dtprel reloc. */
- HOWTO (R_PPC64_DTPREL16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16, but no overflow. */
- HOWTO (R_PPC64_DTPREL16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC64_DTPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC64_DTPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_HI, but next higher group of 16 bits. */
- HOWTO (R_PPC64_DTPREL16_HIGHER,
- 32, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_HIGHER", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_HIGHER, but adjust for low 16 bits. */
- HOWTO (R_PPC64_DTPREL16_HIGHERA,
- 32, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_HIGHERA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_HIGHER, but next higher group of 16 bits. */
- HOWTO (R_PPC64_DTPREL16_HIGHEST,
- 48, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_HIGHEST", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_HIGHEST, but adjust for low 16 bits. */
- HOWTO (R_PPC64_DTPREL16_HIGHESTA,
- 48, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_HIGHESTA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16, but for insns with a DS field. */
- HOWTO (R_PPC64_DTPREL16_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like DTPREL16_DS, but no overflow. */
- HOWTO (R_PPC64_DTPREL16_LO_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_DTPREL16_LO_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Computes a tp-relative displacement, the difference between the value of
- sym+add and the value of the thread pointer (r13). */
- HOWTO (R_PPC64_TPREL64,
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ONES (64), /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit tprel reloc. */
- HOWTO (R_PPC64_TPREL16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16, but no overflow. */
- HOWTO (R_PPC64_TPREL16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC64_TPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC64_TPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_HI, but next higher group of 16 bits. */
- HOWTO (R_PPC64_TPREL16_HIGHER,
- 32, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_HIGHER", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_HIGHER, but adjust for low 16 bits. */
- HOWTO (R_PPC64_TPREL16_HIGHERA,
- 32, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_HIGHERA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_HIGHER, but next higher group of 16 bits. */
- HOWTO (R_PPC64_TPREL16_HIGHEST,
- 48, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_HIGHEST", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_HIGHEST, but adjust for low 16 bits. */
- HOWTO (R_PPC64_TPREL16_HIGHESTA,
- 48, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_HIGHESTA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16, but for insns with a DS field. */
- HOWTO (R_PPC64_TPREL16_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like TPREL16_DS, but no overflow. */
- HOWTO (R_PPC64_TPREL16_LO_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_TPREL16_LO_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
- with values (sym+add)@dtpmod and (sym+add)@dtprel, and computes the offset
- to the first entry relative to the TOC base (r2). */
- HOWTO (R_PPC64_GOT_TLSGD16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSGD16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSGD16, but no overflow. */
- HOWTO (R_PPC64_GOT_TLSGD16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSGD16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSGD16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC64_GOT_TLSGD16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSGD16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSGD16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC64_GOT_TLSGD16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSGD16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
- with values (sym+add)@dtpmod and zero, and computes the offset to the
- first entry relative to the TOC base (r2). */
- HOWTO (R_PPC64_GOT_TLSLD16,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSLD16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSLD16, but no overflow. */
- HOWTO (R_PPC64_GOT_TLSLD16_LO,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSLD16_LO", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSLD16_LO, but next higher group of 16 bits. */
- HOWTO (R_PPC64_GOT_TLSLD16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSLD16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TLSLD16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC64_GOT_TLSLD16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TLSLD16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates an entry in the GOT with value (sym+add)@dtprel, and computes
- the offset to the entry relative to the TOC base (r2). */
- HOWTO (R_PPC64_GOT_DTPREL16_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_DTPREL16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_DTPREL16_DS, but no overflow. */
- HOWTO (R_PPC64_GOT_DTPREL16_LO_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_DTPREL16_LO_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_DTPREL16_LO_DS, but next higher group of 16 bits. */
- HOWTO (R_PPC64_GOT_DTPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_DTPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_DTPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC64_GOT_DTPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_DTPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Allocates an entry in the GOT with value (sym+add)@tprel, and computes the
- offset to the entry relative to the TOC base (r2). */
- HOWTO (R_PPC64_GOT_TPREL16_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TPREL16_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TPREL16_DS, but no overflow. */
- HOWTO (R_PPC64_GOT_TPREL16_LO_DS,
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TPREL16_LO_DS", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfffc, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TPREL16_LO_DS, but next higher group of 16 bits. */
- HOWTO (R_PPC64_GOT_TPREL16_HI,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TPREL16_HI", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Like GOT_TPREL16_HI, but adjust for low 16 bits. */
- HOWTO (R_PPC64_GOT_TPREL16_HA,
- 16, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- ppc64_elf_unhandled_reloc, /* special_function */
- "R_PPC64_GOT_TPREL16_HA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable hierarchy. */
- HOWTO (R_PPC64_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_PPC64_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable member usage. */
- HOWTO (R_PPC64_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_PPC64_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-
-/* Initialize the ppc64_elf_howto_table, so that linear accesses can
- be done. */
-
-static void
-ppc_howto_init (void)
-{
- unsigned int i, type;
-
- for (i = 0;
- i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]);
- i++)
- {
- type = ppc64_elf_howto_raw[i].type;
- BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
- / sizeof (ppc64_elf_howto_table[0])));
- ppc64_elf_howto_table[type] = &ppc64_elf_howto_raw[i];
- }
-}
-
-static reloc_howto_type *
-ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
-{
- enum elf_ppc64_reloc_type r = R_PPC64_NONE;
-
- if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
- /* Initialize howto table if needed. */
- ppc_howto_init ();
-
- switch (code)
- {
- default:
- return NULL;
-
- case BFD_RELOC_NONE: r = R_PPC64_NONE;
- break;
- case BFD_RELOC_32: r = R_PPC64_ADDR32;
- break;
- case BFD_RELOC_PPC_BA26: r = R_PPC64_ADDR24;
- break;
- case BFD_RELOC_16: r = R_PPC64_ADDR16;
- break;
- case BFD_RELOC_LO16: r = R_PPC64_ADDR16_LO;
- break;
- case BFD_RELOC_HI16: r = R_PPC64_ADDR16_HI;
- break;
- case BFD_RELOC_HI16_S: r = R_PPC64_ADDR16_HA;
- break;
- case BFD_RELOC_PPC_BA16: r = R_PPC64_ADDR14;
- break;
- case BFD_RELOC_PPC_BA16_BRTAKEN: r = R_PPC64_ADDR14_BRTAKEN;
- break;
- case BFD_RELOC_PPC_BA16_BRNTAKEN: r = R_PPC64_ADDR14_BRNTAKEN;
- break;
- case BFD_RELOC_PPC_B26: r = R_PPC64_REL24;
- break;
- case BFD_RELOC_PPC_B16: r = R_PPC64_REL14;
- break;
- case BFD_RELOC_PPC_B16_BRTAKEN: r = R_PPC64_REL14_BRTAKEN;
- break;
- case BFD_RELOC_PPC_B16_BRNTAKEN: r = R_PPC64_REL14_BRNTAKEN;
- break;
- case BFD_RELOC_16_GOTOFF: r = R_PPC64_GOT16;
- break;
- case BFD_RELOC_LO16_GOTOFF: r = R_PPC64_GOT16_LO;
- break;
- case BFD_RELOC_HI16_GOTOFF: r = R_PPC64_GOT16_HI;
- break;
- case BFD_RELOC_HI16_S_GOTOFF: r = R_PPC64_GOT16_HA;
- break;
- case BFD_RELOC_PPC_COPY: r = R_PPC64_COPY;
- break;
- case BFD_RELOC_PPC_GLOB_DAT: r = R_PPC64_GLOB_DAT;
- break;
- case BFD_RELOC_32_PCREL: r = R_PPC64_REL32;
- break;
- case BFD_RELOC_32_PLTOFF: r = R_PPC64_PLT32;
- break;
- case BFD_RELOC_32_PLT_PCREL: r = R_PPC64_PLTREL32;
- break;
- case BFD_RELOC_LO16_PLTOFF: r = R_PPC64_PLT16_LO;
- break;
- case BFD_RELOC_HI16_PLTOFF: r = R_PPC64_PLT16_HI;
- break;
- case BFD_RELOC_HI16_S_PLTOFF: r = R_PPC64_PLT16_HA;
- break;
- case BFD_RELOC_16_BASEREL: r = R_PPC64_SECTOFF;
- break;
- case BFD_RELOC_LO16_BASEREL: r = R_PPC64_SECTOFF_LO;
- break;
- case BFD_RELOC_HI16_BASEREL: r = R_PPC64_SECTOFF_HI;
- break;
- case BFD_RELOC_HI16_S_BASEREL: r = R_PPC64_SECTOFF_HA;
- break;
- case BFD_RELOC_CTOR: r = R_PPC64_ADDR64;
- break;
- case BFD_RELOC_64: r = R_PPC64_ADDR64;
- break;
- case BFD_RELOC_PPC64_HIGHER: r = R_PPC64_ADDR16_HIGHER;
- break;
- case BFD_RELOC_PPC64_HIGHER_S: r = R_PPC64_ADDR16_HIGHERA;
- break;
- case BFD_RELOC_PPC64_HIGHEST: r = R_PPC64_ADDR16_HIGHEST;
- break;
- case BFD_RELOC_PPC64_HIGHEST_S: r = R_PPC64_ADDR16_HIGHESTA;
- break;
- case BFD_RELOC_64_PCREL: r = R_PPC64_REL64;
- break;
- case BFD_RELOC_64_PLTOFF: r = R_PPC64_PLT64;
- break;
- case BFD_RELOC_64_PLT_PCREL: r = R_PPC64_PLTREL64;
- break;
- case BFD_RELOC_PPC_TOC16: r = R_PPC64_TOC16;
- break;
- case BFD_RELOC_PPC64_TOC16_LO: r = R_PPC64_TOC16_LO;
- break;
- case BFD_RELOC_PPC64_TOC16_HI: r = R_PPC64_TOC16_HI;
- break;
- case BFD_RELOC_PPC64_TOC16_HA: r = R_PPC64_TOC16_HA;
- break;
- case BFD_RELOC_PPC64_TOC: r = R_PPC64_TOC;
- break;
- case BFD_RELOC_PPC64_PLTGOT16: r = R_PPC64_PLTGOT16;
- break;
- case BFD_RELOC_PPC64_PLTGOT16_LO: r = R_PPC64_PLTGOT16_LO;
- break;
- case BFD_RELOC_PPC64_PLTGOT16_HI: r = R_PPC64_PLTGOT16_HI;
- break;
- case BFD_RELOC_PPC64_PLTGOT16_HA: r = R_PPC64_PLTGOT16_HA;
- break;
- case BFD_RELOC_PPC64_ADDR16_DS: r = R_PPC64_ADDR16_DS;
- break;
- case BFD_RELOC_PPC64_ADDR16_LO_DS: r = R_PPC64_ADDR16_LO_DS;
- break;
- case BFD_RELOC_PPC64_GOT16_DS: r = R_PPC64_GOT16_DS;
- break;
- case BFD_RELOC_PPC64_GOT16_LO_DS: r = R_PPC64_GOT16_LO_DS;
- break;
- case BFD_RELOC_PPC64_PLT16_LO_DS: r = R_PPC64_PLT16_LO_DS;
- break;
- case BFD_RELOC_PPC64_SECTOFF_DS: r = R_PPC64_SECTOFF_DS;
- break;
- case BFD_RELOC_PPC64_SECTOFF_LO_DS: r = R_PPC64_SECTOFF_LO_DS;
- break;
- case BFD_RELOC_PPC64_TOC16_DS: r = R_PPC64_TOC16_DS;
- break;
- case BFD_RELOC_PPC64_TOC16_LO_DS: r = R_PPC64_TOC16_LO_DS;
- break;
- case BFD_RELOC_PPC64_PLTGOT16_DS: r = R_PPC64_PLTGOT16_DS;
- break;
- case BFD_RELOC_PPC64_PLTGOT16_LO_DS: r = R_PPC64_PLTGOT16_LO_DS;
- break;
- case BFD_RELOC_PPC_TLS: r = R_PPC64_TLS;
- break;
- case BFD_RELOC_PPC_DTPMOD: r = R_PPC64_DTPMOD64;
- break;
- case BFD_RELOC_PPC_TPREL16: r = R_PPC64_TPREL16;
- break;
- case BFD_RELOC_PPC_TPREL16_LO: r = R_PPC64_TPREL16_LO;
- break;
- case BFD_RELOC_PPC_TPREL16_HI: r = R_PPC64_TPREL16_HI;
- break;
- case BFD_RELOC_PPC_TPREL16_HA: r = R_PPC64_TPREL16_HA;
- break;
- case BFD_RELOC_PPC_TPREL: r = R_PPC64_TPREL64;
- break;
- case BFD_RELOC_PPC_DTPREL16: r = R_PPC64_DTPREL16;
- break;
- case BFD_RELOC_PPC_DTPREL16_LO: r = R_PPC64_DTPREL16_LO;
- break;
- case BFD_RELOC_PPC_DTPREL16_HI: r = R_PPC64_DTPREL16_HI;
- break;
- case BFD_RELOC_PPC_DTPREL16_HA: r = R_PPC64_DTPREL16_HA;
- break;
- case BFD_RELOC_PPC_DTPREL: r = R_PPC64_DTPREL64;
- break;
- case BFD_RELOC_PPC_GOT_TLSGD16: r = R_PPC64_GOT_TLSGD16;
- break;
- case BFD_RELOC_PPC_GOT_TLSGD16_LO: r = R_PPC64_GOT_TLSGD16_LO;
- break;
- case BFD_RELOC_PPC_GOT_TLSGD16_HI: r = R_PPC64_GOT_TLSGD16_HI;
- break;
- case BFD_RELOC_PPC_GOT_TLSGD16_HA: r = R_PPC64_GOT_TLSGD16_HA;
- break;
- case BFD_RELOC_PPC_GOT_TLSLD16: r = R_PPC64_GOT_TLSLD16;
- break;
- case BFD_RELOC_PPC_GOT_TLSLD16_LO: r = R_PPC64_GOT_TLSLD16_LO;
- break;
- case BFD_RELOC_PPC_GOT_TLSLD16_HI: r = R_PPC64_GOT_TLSLD16_HI;
- break;
- case BFD_RELOC_PPC_GOT_TLSLD16_HA: r = R_PPC64_GOT_TLSLD16_HA;
- break;
- case BFD_RELOC_PPC_GOT_TPREL16: r = R_PPC64_GOT_TPREL16_DS;
- break;
- case BFD_RELOC_PPC_GOT_TPREL16_LO: r = R_PPC64_GOT_TPREL16_LO_DS;
- break;
- case BFD_RELOC_PPC_GOT_TPREL16_HI: r = R_PPC64_GOT_TPREL16_HI;
- break;
- case BFD_RELOC_PPC_GOT_TPREL16_HA: r = R_PPC64_GOT_TPREL16_HA;
- break;
- case BFD_RELOC_PPC_GOT_DTPREL16: r = R_PPC64_GOT_DTPREL16_DS;
- break;
- case BFD_RELOC_PPC_GOT_DTPREL16_LO: r = R_PPC64_GOT_DTPREL16_LO_DS;
- break;
- case BFD_RELOC_PPC_GOT_DTPREL16_HI: r = R_PPC64_GOT_DTPREL16_HI;
- break;
- case BFD_RELOC_PPC_GOT_DTPREL16_HA: r = R_PPC64_GOT_DTPREL16_HA;
- break;
- case BFD_RELOC_PPC64_TPREL16_DS: r = R_PPC64_TPREL16_DS;
- break;
- case BFD_RELOC_PPC64_TPREL16_LO_DS: r = R_PPC64_TPREL16_LO_DS;
- break;
- case BFD_RELOC_PPC64_TPREL16_HIGHER: r = R_PPC64_TPREL16_HIGHER;
- break;
- case BFD_RELOC_PPC64_TPREL16_HIGHERA: r = R_PPC64_TPREL16_HIGHERA;
- break;
- case BFD_RELOC_PPC64_TPREL16_HIGHEST: r = R_PPC64_TPREL16_HIGHEST;
- break;
- case BFD_RELOC_PPC64_TPREL16_HIGHESTA: r = R_PPC64_TPREL16_HIGHESTA;
- break;
- case BFD_RELOC_PPC64_DTPREL16_DS: r = R_PPC64_DTPREL16_DS;
- break;
- case BFD_RELOC_PPC64_DTPREL16_LO_DS: r = R_PPC64_DTPREL16_LO_DS;
- break;
- case BFD_RELOC_PPC64_DTPREL16_HIGHER: r = R_PPC64_DTPREL16_HIGHER;
- break;
- case BFD_RELOC_PPC64_DTPREL16_HIGHERA: r = R_PPC64_DTPREL16_HIGHERA;
- break;
- case BFD_RELOC_PPC64_DTPREL16_HIGHEST: r = R_PPC64_DTPREL16_HIGHEST;
- break;
- case BFD_RELOC_PPC64_DTPREL16_HIGHESTA: r = R_PPC64_DTPREL16_HIGHESTA;
- break;
- case BFD_RELOC_VTABLE_INHERIT: r = R_PPC64_GNU_VTINHERIT;
- break;
- case BFD_RELOC_VTABLE_ENTRY: r = R_PPC64_GNU_VTENTRY;
- break;
- }
-
- return ppc64_elf_howto_table[r];
-};
-
-/* Set the howto pointer for a PowerPC ELF reloc. */
-
-static void
-ppc64_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
- Elf_Internal_Rela *dst)
-{
- unsigned int type;
-
- /* Initialize howto table if needed. */
- if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
- ppc_howto_init ();
-
- type = ELF64_R_TYPE (dst->r_info);
- BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
- / sizeof (ppc64_elf_howto_table[0])));
- cache_ptr->howto = ppc64_elf_howto_table[type];
-}
-
-/* Handle the R_PPC64_ADDR16_HA and similar relocs. */
-
-static bfd_reloc_status_type
-ppc64_elf_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- /* Adjust the addend for sign extension of the low 16 bits.
- We won't actually be using the low 16 bits, so trashing them
- doesn't matter. */
- reloc_entry->addend += 0x8000;
- return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- long insn;
- enum elf_ppc64_reloc_type r_type;
- bfd_size_type octets;
- /* Disabled until we sort out how ld should choose 'y' vs 'at'. */
- bfd_boolean is_power4 = FALSE;
-
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- octets = reloc_entry->address * bfd_octets_per_byte (abfd);
- insn = bfd_get_32 (abfd, (bfd_byte *) data + octets);
- insn &= ~(0x01 << 21);
- r_type = reloc_entry->howto->type;
- if (r_type == R_PPC64_ADDR14_BRTAKEN
- || r_type == R_PPC64_REL14_BRTAKEN)
- insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */
-
- if (is_power4)
- {
- /* Set 'a' bit. This is 0b00010 in BO field for branch
- on CR(BI) insns (BO == 001at or 011at), and 0b01000
- for branch on CTR insns (BO == 1a00t or 1a01t). */
- if ((insn & (0x14 << 21)) == (0x04 << 21))
- insn |= 0x02 << 21;
- else if ((insn & (0x14 << 21)) == (0x10 << 21))
- insn |= 0x08 << 21;
- else
- return bfd_reloc_continue;
- }
- else
- {
- bfd_vma target = 0;
- bfd_vma from;
-
- if (!bfd_is_com_section (symbol->section))
- target = symbol->value;
- target += symbol->section->output_section->vma;
- target += symbol->section->output_offset;
- target += reloc_entry->addend;
-
- from = (reloc_entry->address
- + input_section->output_offset
- + input_section->output_section->vma);
-
- /* Invert 'y' bit if not the default. */
- if ((bfd_signed_vma) (target - from) < 0)
- insn ^= 0x01 << 21;
- }
- bfd_put_32 (abfd, insn, (bfd_byte *) data + octets);
- return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-ppc64_elf_sectoff_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- /* Subtract the symbol section base address. */
- reloc_entry->addend -= symbol->section->output_section->vma;
- return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-ppc64_elf_sectoff_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- /* Subtract the symbol section base address. */
- reloc_entry->addend -= symbol->section->output_section->vma;
-
- /* Adjust the addend for sign extension of the low 16 bits. */
- reloc_entry->addend += 0x8000;
- return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-ppc64_elf_toc_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- bfd_vma TOCstart;
-
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
- if (TOCstart == 0)
- TOCstart = ppc64_elf_toc (input_section->output_section->owner);
-
- /* Subtract the TOC base address. */
- reloc_entry->addend -= TOCstart + TOC_BASE_OFF;
- return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-ppc64_elf_toc_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- bfd_vma TOCstart;
-
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
- if (TOCstart == 0)
- TOCstart = ppc64_elf_toc (input_section->output_section->owner);
-
- /* Subtract the TOC base address. */
- reloc_entry->addend -= TOCstart + TOC_BASE_OFF;
-
- /* Adjust the addend for sign extension of the low 16 bits. */
- reloc_entry->addend += 0x8000;
- return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-ppc64_elf_toc64_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- bfd_vma TOCstart;
- bfd_size_type octets;
-
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
- if (TOCstart == 0)
- TOCstart = ppc64_elf_toc (input_section->output_section->owner);
-
- octets = reloc_entry->address * bfd_octets_per_byte (abfd);
- bfd_put_64 (abfd, TOCstart + TOC_BASE_OFF, (bfd_byte *) data + octets);
- return bfd_reloc_ok;
-}
-
-static bfd_reloc_status_type
-ppc64_elf_unhandled_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- /* If this is a relocatable link (output_bfd test tells us), just
- call the generic function. Any adjustment will be done at final
- link time. */
- if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-
- if (error_message != NULL)
- {
- static char buf[60];
- sprintf (buf, "generic linker can't handle %s",
- reloc_entry->howto->name);
- *error_message = buf;
- }
- return bfd_reloc_dangerous;
-}
-
-struct ppc64_elf_obj_tdata
-{
- struct elf_obj_tdata elf;
-
- /* Shortcuts to dynamic linker sections. */
- asection *got;
- asection *relgot;
-
- /* TLS local dynamic got entry handling. Suppose for multiple GOT
- sections means we potentially need one of these for each input bfd. */
- union {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } tlsld_got;
-};
-
-#define ppc64_elf_tdata(bfd) \
- ((struct ppc64_elf_obj_tdata *) (bfd)->tdata.any)
-
-#define ppc64_tlsld_got(bfd) \
- (&ppc64_elf_tdata (bfd)->tlsld_got)
-
-/* Override the generic function because we store some extras. */
-
-static bfd_boolean
-ppc64_elf_mkobject (bfd *abfd)
-{
- bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
-}
-
-/* Fix bad default arch selected for a 64 bit input bfd when the
- default is 32 bit. */
-
-static bfd_boolean
-ppc64_elf_object_p (bfd *abfd)
-{
- if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 32)
- {
- Elf_Internal_Ehdr *i_ehdr = elf_elfheader (abfd);
-
- if (i_ehdr->e_ident[EI_CLASS] == ELFCLASS64)
- {
- /* Relies on arch after 32 bit default being 64 bit default. */
- abfd->arch_info = abfd->arch_info->next;
- BFD_ASSERT (abfd->arch_info->bits_per_word == 64);
- }
- }
- return TRUE;
-}
-
-/* Support for core dump NOTE sections. */
-
-static bfd_boolean
-ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- size_t offset, raw_size;
-
- if (note->descsz != 504)
- return FALSE;
-
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
-
- /* pr_reg */
- offset = 112;
- raw_size = 384;
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static bfd_boolean
-ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- if (note->descsz != 136)
- return FALSE;
-
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
-
- return TRUE;
-}
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
-
-static bfd_boolean
-ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
-{
- /* Check if we have the same endianess. */
- if (ibfd->xvec->byteorder != obfd->xvec->byteorder
- && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
- && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
- {
- const char *msg;
-
- if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system "
- "and target is little endian");
- else
- msg = _("%s: compiled for a little endian system "
- "and target is big endian");
-
- (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
-
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Add extra PPC sections. */
-
-static struct bfd_elf_special_section const ppc64_elf_special_sections[]=
-{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".plt", 4, 0, SHT_NOBITS, 0 },
- { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
-
-struct _ppc64_elf_section_data
-{
- struct bfd_elf_section_data elf;
-
- /* An array with one entry for each opd function descriptor. */
- union
- {
- /* Points to the function code section for local opd entries. */
- asection **func_sec;
- /* After editing .opd, adjust references to opd local syms. */
- long *adjust;
- } opd;
-
- /* An array for toc sections, indexed by offset/8.
- Specifies the relocation symbol index used at a given toc offset. */
- unsigned *t_symndx;
-};
-
-#define ppc64_elf_section_data(sec) \
- ((struct _ppc64_elf_section_data *) elf_section_data (sec))
-
-static bfd_boolean
-ppc64_elf_new_section_hook (bfd *abfd, asection *sec)
-{
- struct _ppc64_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
-
- sdata = bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = sdata;
-
- return _bfd_elf_new_section_hook (abfd, sec);
-}
-
-/* The following functions are specific to the ELF linker, while
- functions above are used generally. Those named ppc64_elf_* are
- called by the main ELF linker code. They appear in this file more
- or less in the order in which they are called. eg.
- ppc64_elf_check_relocs is called early in the link process,
- ppc64_elf_finish_dynamic_sections is one of the last functions
- called.
-
- PowerPC64-ELF uses a similar scheme to PowerPC64-XCOFF in that
- functions have both a function code symbol and a function descriptor
- symbol. A call to foo in a relocatable object file looks like:
-
- . .text
- . x:
- . bl .foo
- . nop
-
- The function definition in another object file might be:
-
- . .section .opd
- . foo: .quad .foo
- . .quad .TOC.@tocbase
- . .quad 0
- .
- . .text
- . .foo: blr
-
- When the linker resolves the call during a static link, the branch
- unsurprisingly just goes to .foo and the .opd information is unused.
- If the function definition is in a shared library, things are a little
- different: The call goes via a plt call stub, the opd information gets
- copied to the plt, and the linker patches the nop.
-
- . x:
- . bl .foo_stub
- . ld 2,40(1)
- .
- .
- . .foo_stub:
- . addis 12,2,Lfoo@toc@ha # in practice, the call stub
- . addi 12,12,Lfoo@toc@l # is slightly optimized, but
- . std 2,40(1) # this is the general idea
- . ld 11,0(12)
- . ld 2,8(12)
- . mtctr 11
- . ld 11,16(12)
- . bctr
- .
- . .section .plt
- . Lfoo: reloc (R_PPC64_JMP_SLOT, foo)
-
- The "reloc ()" notation is supposed to indicate that the linker emits
- an R_PPC64_JMP_SLOT reloc against foo. The dynamic linker does the opd
- copying.
-
- What are the difficulties here? Well, firstly, the relocations
- examined by the linker in check_relocs are against the function code
- sym .foo, while the dynamic relocation in the plt is emitted against
- the function descriptor symbol, foo. Somewhere along the line, we need
- to carefully copy dynamic link information from one symbol to the other.
- Secondly, the generic part of the elf linker will make .foo a dynamic
- symbol as is normal for most other backends. We need foo dynamic
- instead, at least for an application final link. However, when
- creating a shared library containing foo, we need to have both symbols
- dynamic so that references to .foo are satisfied during the early
- stages of linking. Otherwise the linker might decide to pull in a
- definition from some other object, eg. a static library. */
-
-/* The linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct ppc_dyn_relocs
-{
- struct ppc_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
-
-/* Track GOT entries needed for a given symbol. We might need more
- than one got entry per symbol. */
-struct got_entry
-{
- struct got_entry *next;
-
- /* The symbol addend that we'll be placing in the GOT. */
- bfd_vma addend;
-
- /* Unlike other ELF targets, we use separate GOT entries for the same
- symbol referenced from different input files. This is to support
- automatic multiple TOC/GOT sections, where the TOC base can vary
- from one input file to another.
-
- Point to the BFD owning this GOT entry. */
- bfd *owner;
-
- /* Zero for non-tls entries, or TLS_TLS and one of TLS_GD, TLS_LD,
- TLS_TPREL or TLS_DTPREL for tls entries. */
- char tls_type;
-
- /* Reference count until size_dynamic_sections, GOT offset thereafter. */
- union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } got;
-};
-
-/* The same for PLT. */
-struct plt_entry
-{
- struct plt_entry *next;
-
- bfd_vma addend;
-
- union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } plt;
-};
-
-/* Of those relocs that might be copied as dynamic relocs, this macro
- selects those that must be copied when linking a shared library,
- even when the symbol is local. */
-
-#define MUST_BE_DYN_RELOC(RTYPE) \
- ((RTYPE) != R_PPC64_REL32 \
- && (RTYPE) != R_PPC64_REL64 \
- && (RTYPE) != R_PPC64_REL30)
-
-/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
- copying dynamic variables from a shared lib into an app's dynbss
- section, and instead use a dynamic relocation to point into the
- shared lib. With code that gcc generates, it's vital that this be
- enabled; In the PowerPC64 ABI, the address of a function is actually
- the address of a function descriptor, which resides in the .opd
- section. gcc uses the descriptor directly rather than going via the
- GOT as some other ABI's do, which means that initialized function
- pointers must reference the descriptor. Thus, a function pointer
- initialized to the address of a function in a shared library will
- either require a copy reloc, or a dynamic reloc. Using a copy reloc
- redefines the function descriptor symbol to point to the copy. This
- presents a problem as a plt entry for that function is also
- initialized from the function descriptor symbol and the copy reloc
- may not be initialized first. */
-#define ELIMINATE_COPY_RELOCS 1
-
-/* Section name for stubs is the associated section name plus this
- string. */
-#define STUB_SUFFIX ".stub"
-
-/* Linker stubs.
- ppc_stub_long_branch:
- Used when a 14 bit branch (or even a 24 bit branch) can't reach its
- destination, but a 24 bit branch in a stub section will reach.
- . b dest
-
- ppc_stub_plt_branch:
- Similar to the above, but a 24 bit branch in the stub section won't
- reach its destination.
- . addis %r12,%r2,xxx@toc@ha
- . ld %r11,xxx@toc@l(%r12)
- . mtctr %r11
- . bctr
-
- ppc_stub_plt_call:
- Used to call a function in a shared library.
- . addis %r12,%r2,xxx@toc@ha
- . std %r2,40(%r1)
- . ld %r11,xxx+0@toc@l(%r12)
- . ld %r2,xxx+8@toc@l(%r12)
- . mtctr %r11
- . ld %r11,xxx+16@toc@l(%r12)
- . bctr
-
- ppc_stub_long_branch and ppc_stub_plt_branch may also have additional
- code to adjust the value and save r2 to support multiple toc sections.
- A ppc_stub_long_branch with an r2 offset looks like:
- . std %r2,40(%r1)
- . addis %r2,%r2,off@ha
- . addi %r2,%r2,off@l
- . b dest
-
- A ppc_stub_plt_branch with an r2 offset looks like:
- . std %r2,40(%r1)
- . addis %r12,%r2,xxx@toc@ha
- . ld %r11,xxx@toc@l(%r12)
- . addis %r2,%r2,off@ha
- . addi %r2,%r2,off@l
- . mtctr %r11
- . bctr
-*/
-
-enum ppc_stub_type {
- ppc_stub_none,
- ppc_stub_long_branch,
- ppc_stub_long_branch_r2off,
- ppc_stub_plt_branch,
- ppc_stub_plt_branch_r2off,
- ppc_stub_plt_call
-};
-
-struct ppc_stub_hash_entry {
-
- /* Base hash table entry structure. */
- struct bfd_hash_entry root;
-
- enum ppc_stub_type stub_type;
-
- /* The stub section. */
- asection *stub_sec;
-
- /* Offset within stub_sec of the beginning of this stub. */
- bfd_vma stub_offset;
-
- /* Given the symbol's value and its section we can determine its final
- value when building the stubs (so the stub knows where to jump. */
- bfd_vma target_value;
- asection *target_section;
-
- /* The symbol table entry, if any, that this was derived from. */
- struct ppc_link_hash_entry *h;
-
- /* And the reloc addend that this was derived from. */
- bfd_vma addend;
-
- /* Where this stub is being called from, or, in the case of combined
- stub sections, the first input section in the group. */
- asection *id_sec;
-};
-
-struct ppc_branch_hash_entry {
-
- /* Base hash table entry structure. */
- struct bfd_hash_entry root;
-
- /* Offset within .branch_lt. */
- unsigned int offset;
-
- /* Generation marker. */
- unsigned int iter;
-};
-
-struct ppc_link_hash_entry
-{
- struct elf_link_hash_entry elf;
-
- /* A pointer to the most recently used stub hash entry against this
- symbol. */
- struct ppc_stub_hash_entry *stub_cache;
-
- /* Track dynamic relocs copied for this symbol. */
- struct ppc_dyn_relocs *dyn_relocs;
-
- /* Link between function code and descriptor symbols. */
- struct elf_link_hash_entry *oh;
-
- /* Flag function code and descriptor symbols. */
- unsigned int is_func:1;
- unsigned int is_func_descriptor:1;
- unsigned int is_entry:1;
-
- /* Whether global opd sym has been adjusted or not. */
- unsigned int adjust_done:1;
-
- /* Contexts in which symbol is used in the GOT (or TOC).
- TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the
- corresponding relocs are encountered during check_relocs.
- tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to
- indicate the corresponding GOT entry type is not needed.
- tls_optimize may also set TLS_TPRELGD when a GD reloc turns into
- a TPREL one. We use a separate flag rather than setting TPREL
- just for convenience in distinguishing the two cases. */
-#define TLS_GD 1 /* GD reloc. */
-#define TLS_LD 2 /* LD reloc. */
-#define TLS_TPREL 4 /* TPREL reloc, => IE. */
-#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */
-#define TLS_TLS 16 /* Any TLS reloc. */
-#define TLS_EXPLICIT 32 /* Marks TOC section TLS relocs. */
-#define TLS_TPRELGD 64 /* TPREL reloc resulting from GD->IE. */
- char tls_mask;
-};
-
-/* ppc64 ELF linker hash table. */
-
-struct ppc_link_hash_table
-{
- struct elf_link_hash_table elf;
-
- /* The stub hash table. */
- struct bfd_hash_table stub_hash_table;
-
- /* Another hash table for plt_branch stubs. */
- struct bfd_hash_table branch_hash_table;
-
- /* Linker stub bfd. */
- bfd *stub_bfd;
-
- /* Linker call-backs. */
- asection * (*add_stub_section) (const char *, asection *);
- void (*layout_sections_again) (void);
-
- /* Array to keep track of which stub sections have been created, and
- information on stub grouping. */
- struct map_stub {
- /* This is the section to which stubs in the group will be attached. */
- asection *link_sec;
- /* The stub section. */
- asection *stub_sec;
- /* Along with elf_gp, specifies the TOC pointer used in this group. */
- bfd_vma toc_off;
- } *stub_group;
-
- /* Support for multiple toc sections. */
- unsigned int no_multi_toc;
- unsigned int multi_toc_needed;
-
- /* Temp used when calculating TOC pointers. */
- bfd_vma toc_curr;
-
- /* Highest input section id. */
- int top_id;
-
- /* Highest output section index. */
- int top_index;
-
- /* List of input sections for each output section. */
- asection **input_list;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *got;
- asection *plt;
- asection *relplt;
- asection *dynbss;
- asection *relbss;
- asection *glink;
- asection *sfpr;
- asection *brlt;
- asection *relbrlt;
-
- /* Shortcut to .__tls_get_addr. */
- struct elf_link_hash_entry *tls_get_addr;
-
- /* Statistics. */
- unsigned long stub_count[ppc_stub_plt_call];
-
- /* Set if we should emit symbols for stubs. */
- unsigned int emit_stub_syms;
-
- /* Set on error. */
- unsigned int stub_error;
-
- /* Flag set when small branches are detected. Used to
- select suitable defaults for the stub group size. */
- unsigned int has_14bit_branch;
-
- /* Set if we detect a reference undefined weak symbol. */
- unsigned int have_undefweak;
-
- /* Incremented every time we size stubs. */
- unsigned int stub_iteration;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-};
-
-/* Get the ppc64 ELF linker hash table from a link_info structure. */
-
-#define ppc_hash_table(p) \
- ((struct ppc_link_hash_table *) ((p)->hash))
-
-#define ppc_stub_hash_lookup(table, string, create, copy) \
- ((struct ppc_stub_hash_entry *) \
- bfd_hash_lookup ((table), (string), (create), (copy)))
-
-#define ppc_branch_hash_lookup(table, string, create, copy) \
- ((struct ppc_branch_hash_entry *) \
- bfd_hash_lookup ((table), (string), (create), (copy)))
-
-/* Create an entry in the stub hash table. */
-
-static struct bfd_hash_entry *
-stub_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table, sizeof (struct ppc_stub_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = bfd_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct ppc_stub_hash_entry *eh;
-
- /* Initialize the local fields. */
- eh = (struct ppc_stub_hash_entry *) entry;
- eh->stub_type = ppc_stub_none;
- eh->stub_sec = NULL;
- eh->stub_offset = 0;
- eh->target_value = 0;
- eh->target_section = NULL;
- eh->h = NULL;
- eh->id_sec = NULL;
- }
-
- return entry;
-}
-
-/* Create an entry in the branch hash table. */
-
-static struct bfd_hash_entry *
-branch_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table, sizeof (struct ppc_branch_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = bfd_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct ppc_branch_hash_entry *eh;
-
- /* Initialize the local fields. */
- eh = (struct ppc_branch_hash_entry *) entry;
- eh->offset = 0;
- eh->iter = 0;
- }
-
- return entry;
-}
-
-/* Create an entry in a ppc64 ELF linker hash table. */
-
-static struct bfd_hash_entry *
-link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table, sizeof (struct ppc_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) entry;
-
- eh->stub_cache = NULL;
- eh->dyn_relocs = NULL;
- eh->oh = NULL;
- eh->is_func = 0;
- eh->is_func_descriptor = 0;
- eh->is_entry = 0;
- eh->adjust_done = 0;
- eh->tls_mask = 0;
- }
-
- return entry;
-}
-
-/* Create a ppc64 ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-ppc64_elf_link_hash_table_create (bfd *abfd)
-{
- struct ppc_link_hash_table *htab;
- bfd_size_type amt = sizeof (struct ppc_link_hash_table);
-
- htab = bfd_zmalloc (amt);
- if (htab == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc))
- {
- free (htab);
- return NULL;
- }
-
- /* Init the stub hash table too. */
- if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc))
- return NULL;
-
- /* And the branch hash table. */
- if (!bfd_hash_table_init (&htab->branch_hash_table, branch_hash_newfunc))
- return NULL;
-
- /* Initializing two fields of the union is just cosmetic. We really
- only care about glist, but when compiled on a 32-bit host the
- bfd_vma fields are larger. Setting the bfd_vma to zero makes
- debugger inspection of these fields look nicer. */
- htab->elf.init_refcount.refcount = 0;
- htab->elf.init_refcount.glist = NULL;
- htab->elf.init_offset.offset = 0;
- htab->elf.init_offset.glist = NULL;
-
- return &htab->elf.root;
-}
-
-/* Free the derived linker hash table. */
-
-static void
-ppc64_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
-{
- struct ppc_link_hash_table *ret = (struct ppc_link_hash_table *) hash;
-
- bfd_hash_table_free (&ret->stub_hash_table);
- bfd_hash_table_free (&ret->branch_hash_table);
- _bfd_generic_link_hash_table_free (hash);
-}
-
-/* Satisfy the ELF linker by filling in some fields in our fake bfd. */
-
-void
-ppc64_elf_init_stub_bfd (bfd *abfd, struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
-
- elf_elfheader (abfd)->e_ident[EI_CLASS] = ELFCLASS64;
-
-/* Always hook our dynamic sections into the first bfd, which is the
- linker created stub bfd. This ensures that the GOT header is at
- the start of the output TOC section. */
- htab = ppc_hash_table (info);
- htab->stub_bfd = abfd;
- htab->elf.dynobj = abfd;
-}
-
-/* Build a name for an entry in the stub hash table. */
-
-static char *
-ppc_stub_name (const asection *input_section,
- const asection *sym_sec,
- const struct ppc_link_hash_entry *h,
- const Elf_Internal_Rela *rel)
-{
- char *stub_name;
- bfd_size_type len;
-
- /* rel->r_addend is actually 64 bit, but who uses more than +/- 2^31
- offsets from a sym as a branch target? In fact, we could
- probably assume the addend is always zero. */
- BFD_ASSERT (((int) rel->r_addend & 0xffffffff) == rel->r_addend);
-
- if (h)
- {
- len = 8 + 1 + strlen (h->elf.root.root.string) + 1 + 8 + 1;
- stub_name = bfd_malloc (len);
- if (stub_name != NULL)
- {
- sprintf (stub_name, "%08x.%s+%x",
- input_section->id & 0xffffffff,
- h->elf.root.root.string,
- (int) rel->r_addend & 0xffffffff);
- }
- }
- else
- {
- len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1;
- stub_name = bfd_malloc (len);
- if (stub_name != NULL)
- {
- sprintf (stub_name, "%08x.%x:%x+%x",
- input_section->id & 0xffffffff,
- sym_sec->id & 0xffffffff,
- (int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
- (int) rel->r_addend & 0xffffffff);
- }
- }
- return stub_name;
-}
-
-/* Look up an entry in the stub hash. Stub entries are cached because
- creating the stub name takes a bit of time. */
-
-static struct ppc_stub_hash_entry *
-ppc_get_stub_entry (const asection *input_section,
- const asection *sym_sec,
- struct elf_link_hash_entry *hash,
- const Elf_Internal_Rela *rel,
- struct ppc_link_hash_table *htab)
-{
- struct ppc_stub_hash_entry *stub_entry;
- struct ppc_link_hash_entry *h = (struct ppc_link_hash_entry *) hash;
- const asection *id_sec;
-
- /* If this input section is part of a group of sections sharing one
- stub section, then use the id of the first section in the group.
- Stub names need to include a section id, as there may well be
- more than one stub used to reach say, printf, and we need to
- distinguish between them. */
- id_sec = htab->stub_group[input_section->id].link_sec;
-
- if (h != NULL && h->stub_cache != NULL
- && h->stub_cache->h == h
- && h->stub_cache->id_sec == id_sec)
- {
- stub_entry = h->stub_cache;
- }
- else
- {
- char *stub_name;
-
- stub_name = ppc_stub_name (id_sec, sym_sec, h, rel);
- if (stub_name == NULL)
- return NULL;
-
- stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table,
- stub_name, FALSE, FALSE);
- if (h != NULL)
- h->stub_cache = stub_entry;
-
- free (stub_name);
- }
-
- return stub_entry;
-}
-
-/* Add a new stub entry to the stub hash. Not all fields of the new
- stub entry are initialised. */
-
-static struct ppc_stub_hash_entry *
-ppc_add_stub (const char *stub_name,
- asection *section,
- struct ppc_link_hash_table *htab)
-{
- asection *link_sec;
- asection *stub_sec;
- struct ppc_stub_hash_entry *stub_entry;
-
- link_sec = htab->stub_group[section->id].link_sec;
- stub_sec = htab->stub_group[section->id].stub_sec;
- if (stub_sec == NULL)
- {
- stub_sec = htab->stub_group[link_sec->id].stub_sec;
- if (stub_sec == NULL)
- {
- size_t namelen;
- bfd_size_type len;
- char *s_name;
-
- namelen = strlen (link_sec->name);
- len = namelen + sizeof (STUB_SUFFIX);
- s_name = bfd_alloc (htab->stub_bfd, len);
- if (s_name == NULL)
- return NULL;
-
- memcpy (s_name, link_sec->name, namelen);
- memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
- stub_sec = (*htab->add_stub_section) (s_name, link_sec);
- if (stub_sec == NULL)
- return NULL;
- htab->stub_group[link_sec->id].stub_sec = stub_sec;
- }
- htab->stub_group[section->id].stub_sec = stub_sec;
- }
-
- /* Enter this entry into the linker stub hash table. */
- stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table, stub_name,
- TRUE, FALSE);
- if (stub_entry == NULL)
- {
- (*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
- bfd_archive_filename (section->owner),
- stub_name);
- return NULL;
- }
-
- stub_entry->stub_sec = stub_sec;
- stub_entry->stub_offset = 0;
- stub_entry->id_sec = link_sec;
- return stub_entry;
-}
-
-/* Create sections for linker generated code. */
-
-static bfd_boolean
-create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
- flagword flags;
-
- htab = ppc_hash_table (info);
-
- /* Create .sfpr for code to save and restore fp regs. */
- flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->sfpr = bfd_make_section_anyway (dynobj, ".sfpr");
- if (htab->sfpr == NULL
- || ! bfd_set_section_flags (dynobj, htab->sfpr, flags)
- || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2))
- return FALSE;
-
- /* Create .glink for lazy dynamic linking support. */
- htab->glink = bfd_make_section_anyway (dynobj, ".glink");
- if (htab->glink == NULL
- || ! bfd_set_section_flags (dynobj, htab->glink, flags)
- || ! bfd_set_section_alignment (dynobj, htab->glink, 2))
- return FALSE;
-
- /* Create .branch_lt for plt_branch stubs. */
- flags = (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->brlt = bfd_make_section_anyway (dynobj, ".branch_lt");
- if (htab->brlt == NULL
- || ! bfd_set_section_flags (dynobj, htab->brlt, flags)
- || ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
- return FALSE;
-
- if (info->shared)
- {
- flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->relbrlt = bfd_make_section_anyway (dynobj, ".rela.branch_lt");
- if (!htab->relbrlt
- || ! bfd_set_section_flags (dynobj, htab->relbrlt, flags)
- || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
- return FALSE;
- }
- return TRUE;
-}
-
-/* Create .got and .rela.got sections in ABFD, and .got in dynobj if
- not already done. */
-
-static bfd_boolean
-create_got_section (bfd *abfd, struct bfd_link_info *info)
-{
- asection *got, *relgot;
- flagword flags;
- struct ppc_link_hash_table *htab = ppc_hash_table (info);
-
- if (!htab->got)
- {
- if (! _bfd_elf_create_got_section (htab->elf.dynobj, info))
- return FALSE;
-
- htab->got = bfd_get_section_by_name (htab->elf.dynobj, ".got");
- if (!htab->got)
- abort ();
- }
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
-
- got = bfd_make_section (abfd, ".got");
- if (!got
- || !bfd_set_section_flags (abfd, got, flags)
- || !bfd_set_section_alignment (abfd, got, 3))
- return FALSE;
-
- relgot = bfd_make_section (abfd, ".rela.got");
- if (!relgot
- || ! bfd_set_section_flags (abfd, relgot, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, relgot, 3))
- return FALSE;
-
- ppc64_elf_tdata (abfd)->got = got;
- ppc64_elf_tdata (abfd)->relgot = relgot;
- return TRUE;
-}
-
-/* Create the dynamic sections, and set up shortcuts. */
-
-static bfd_boolean
-ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
-
- if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- htab = ppc_hash_table (info);
- if (!htab->got)
- htab->got = bfd_get_section_by_name (dynobj, ".got");
- htab->plt = bfd_get_section_by_name (dynobj, ".plt");
- htab->relplt = bfd_get_section_by_name (dynobj, ".rela.plt");
- htab->dynbss = bfd_get_section_by_name (dynobj, ".dynbss");
- if (!info->shared)
- htab->relbss = bfd_get_section_by_name (dynobj, ".rela.bss");
-
- if (!htab->got || !htab->plt || !htab->relplt || !htab->dynbss
- || (!info->shared && !htab->relbss))
- abort ();
-
- return TRUE;
-}
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-ppc64_elf_copy_indirect_symbol
- (const struct elf_backend_data *bed ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry *dir,
- struct elf_link_hash_entry *ind)
-{
- struct ppc_link_hash_entry *edir, *eind;
- flagword mask;
-
- edir = (struct ppc_link_hash_entry *) dir;
- eind = (struct ppc_link_hash_entry *) ind;
-
- /* Copy over any dynamic relocs we may have on the indirect sym. */
- if (eind->dyn_relocs != NULL)
- {
- if (edir->dyn_relocs != NULL)
- {
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
-
- if (eind->elf.root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
- {
- struct ppc_dyn_relocs *q;
-
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
- if (q->sec == p->sec)
- {
- q->pc_count += p->pc_count;
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->dyn_relocs;
- }
-
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
-
- edir->is_func |= eind->is_func;
- edir->is_func_descriptor |= eind->is_func_descriptor;
- edir->is_entry |= eind->is_entry;
- edir->tls_mask |= eind->tls_mask;
-
- mask = (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF
- | ELF_LINK_HASH_NEEDS_PLT);
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- if (ELIMINATE_COPY_RELOCS
- && eind->elf.root.type != bfd_link_hash_indirect
- && (edir->elf.elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- mask &= ~ELF_LINK_NON_GOT_REF;
-
- edir->elf.elf_link_hash_flags |= eind->elf.elf_link_hash_flags & mask;
-
- /* If we were called to copy over info for a weak sym, that's all. */
- if (eind->elf.root.type != bfd_link_hash_indirect)
- return;
-
- /* Copy over got entries that we may have already seen to the
- symbol which just became indirect. */
- if (eind->elf.got.glist != NULL)
- {
- if (edir->elf.got.glist != NULL)
- {
- struct got_entry **entp;
- struct got_entry *ent;
-
- for (entp = &eind->elf.got.glist; (ent = *entp) != NULL; )
- {
- struct got_entry *dent;
-
- for (dent = edir->elf.got.glist; dent != NULL; dent = dent->next)
- if (dent->addend == ent->addend
- && dent->owner == ent->owner
- && dent->tls_type == ent->tls_type)
- {
- dent->got.refcount += ent->got.refcount;
- *entp = ent->next;
- break;
- }
- if (dent == NULL)
- entp = &ent->next;
- }
- *entp = edir->elf.got.glist;
- }
-
- edir->elf.got.glist = eind->elf.got.glist;
- eind->elf.got.glist = NULL;
- }
-
- /* And plt entries. */
- if (eind->elf.plt.plist != NULL)
- {
- if (edir->elf.plt.plist != NULL)
- {
- struct plt_entry **entp;
- struct plt_entry *ent;
-
- for (entp = &eind->elf.plt.plist; (ent = *entp) != NULL; )
- {
- struct plt_entry *dent;
-
- for (dent = edir->elf.plt.plist; dent != NULL; dent = dent->next)
- if (dent->addend == ent->addend)
- {
- dent->plt.refcount += ent->plt.refcount;
- *entp = ent->next;
- break;
- }
- if (dent == NULL)
- entp = &ent->next;
- }
- *entp = edir->elf.plt.plist;
- }
-
- edir->elf.plt.plist = eind->elf.plt.plist;
- eind->elf.plt.plist = NULL;
- }
-
- if (edir->elf.dynindx == -1)
- {
- edir->elf.dynindx = eind->elf.dynindx;
- edir->elf.dynstr_index = eind->elf.dynstr_index;
- eind->elf.dynindx = -1;
- eind->elf.dynstr_index = 0;
- }
- else
- BFD_ASSERT (eind->elf.dynindx == -1);
-}
-
-/* Set a flag, used by ppc64_elf_gc_mark_hook, on the entry symbol and
- symbols undefined on the command-line. */
-
-bfd_boolean
-ppc64_elf_mark_entry_syms (struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
- struct bfd_sym_chain *sym;
-
- htab = ppc_hash_table (info);
- for (sym = info->gc_sym_list; sym; sym = sym->next)
- {
- struct elf_link_hash_entry *h;
-
- h = elf_link_hash_lookup (&htab->elf, sym->name, FALSE, FALSE, FALSE);
- if (h != NULL)
- ((struct ppc_link_hash_entry *) h)->is_entry = 1;
- }
- return TRUE;
-}
-
-/* Hack symbols defined in .opd sections to be function type. */
-
-static bfd_boolean
-ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Sym *isym,
- const char **name ATTRIBUTE_UNUSED,
- flagword *flags ATTRIBUTE_UNUSED,
- asection **sec,
- bfd_vma *value ATTRIBUTE_UNUSED)
-{
- if (strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0)
- isym->st_info = ELF_ST_INFO (ELF_ST_BIND (isym->st_info), STT_FUNC);
- return TRUE;
-}
-
-static bfd_boolean
-update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
- unsigned long r_symndx, bfd_vma r_addend, int tls_type)
-{
- struct got_entry **local_got_ents = elf_local_got_ents (abfd);
- char *local_got_tls_masks;
-
- if (local_got_ents == NULL)
- {
- bfd_size_type size = symtab_hdr->sh_info;
-
- size *= sizeof (*local_got_ents) + sizeof (*local_got_tls_masks);
- local_got_ents = bfd_zalloc (abfd, size);
- if (local_got_ents == NULL)
- return FALSE;
- elf_local_got_ents (abfd) = local_got_ents;
- }
-
- if ((tls_type & TLS_EXPLICIT) == 0)
- {
- struct got_entry *ent;
-
- for (ent = local_got_ents[r_symndx]; ent != NULL; ent = ent->next)
- if (ent->addend == r_addend
- && ent->owner == abfd
- && ent->tls_type == tls_type)
- break;
- if (ent == NULL)
- {
- bfd_size_type amt = sizeof (*ent);
- ent = bfd_alloc (abfd, amt);
- if (ent == NULL)
- return FALSE;
- ent->next = local_got_ents[r_symndx];
- ent->addend = r_addend;
- ent->owner = abfd;
- ent->tls_type = tls_type;
- ent->got.refcount = 0;
- local_got_ents[r_symndx] = ent;
- }
- ent->got.refcount += 1;
- }
-
- local_got_tls_masks = (char *) (local_got_ents + symtab_hdr->sh_info);
- local_got_tls_masks[r_symndx] |= tls_type;
- return TRUE;
-}
-
-static bfd_boolean
-update_plt_info (bfd *abfd, struct ppc_link_hash_entry *eh, bfd_vma addend)
-{
- struct plt_entry *ent;
-
- for (ent = eh->elf.plt.plist; ent != NULL; ent = ent->next)
- if (ent->addend == addend)
- break;
- if (ent == NULL)
- {
- bfd_size_type amt = sizeof (*ent);
- ent = bfd_alloc (abfd, amt);
- if (ent == NULL)
- return FALSE;
- ent->next = eh->elf.plt.plist;
- ent->addend = addend;
- ent->plt.refcount = 0;
- eh->elf.plt.plist = ent;
- }
- ent->plt.refcount += 1;
- eh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- eh->is_func = 1;
- return TRUE;
-}
-
-/* Find the function descriptor hash entry from the given function code
- hash entry FH. Link the entries via their OH fields. */
-static struct ppc_link_hash_entry *
-get_fdh (struct ppc_link_hash_entry *fh, struct ppc_link_hash_table *htab)
-{
- struct ppc_link_hash_entry *fdh = (struct ppc_link_hash_entry *) fh->oh;
-
- if (fdh == NULL)
- {
- const char *fd_name = fh->elf.root.root.string + 1;
-
- fdh = (struct ppc_link_hash_entry *)
- elf_link_hash_lookup (&htab->elf, fd_name, FALSE, FALSE, FALSE);
- if (fdh != NULL)
- {
- fdh->is_func_descriptor = 1;
- fdh->oh = &fh->elf;
- fh->is_func = 1;
- fh->oh = &fdh->elf;
- }
- }
-
- return fdh;
-}
-
-/* Look through the relocs for a section during the first phase, and
- calculate needed space in the global offset table, procedure
- linkage table, and dynamic reloc sections. */
-
-static bfd_boolean
-ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
- asection *sec, const Elf_Internal_Rela *relocs)
-{
- struct ppc_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sreloc;
- asection **opd_sym_map;
-
- if (info->relocatable)
- return TRUE;
-
- /* Don't do anything special with non-loaded, non-alloced sections.
- In particular, any relocs in such sections should not affect GOT
- and PLT reference counting (ie. we don't allow them to create GOT
- or PLT entries), there's no possibility or desire to optimize TLS
- relocs, and there's not much point in propagating relocs to shared
- libs that the dynamic linker won't relocate. */
- if ((sec->flags & SEC_ALLOC) == 0)
- return TRUE;
-
- htab = ppc_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-
- sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = (sym_hashes
- + symtab_hdr->sh_size / sizeof (Elf64_External_Sym)
- - symtab_hdr->sh_info);
-
- sreloc = NULL;
- opd_sym_map = NULL;
- if (strcmp (bfd_get_section_name (abfd, sec), ".opd") == 0)
- {
- /* Garbage collection needs some extra help with .opd sections.
- We don't want to necessarily keep everything referenced by
- relocs in .opd, as that would keep all functions. Instead,
- if we reference an .opd symbol (a function descriptor), we
- want to keep the function code symbol's section. This is
- easy for global symbols, but for local syms we need to keep
- information about the associated function section. Later, if
- edit_opd deletes entries, we'll use this array to adjust
- local syms in .opd. */
- union opd_info {
- asection *func_section;
- long entry_adjust;
- };
- bfd_size_type amt;
-
- amt = sec->_raw_size * sizeof (union opd_info) / 24;
- opd_sym_map = bfd_zalloc (abfd, amt);
- if (opd_sym_map == NULL)
- return FALSE;
- ppc64_elf_section_data (sec)->opd.func_sec = opd_sym_map;
- }
-
- if (htab->sfpr == NULL
- && !create_linkage_sections (htab->elf.dynobj, info))
- return FALSE;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- enum elf_ppc64_reloc_type r_type;
- int tls_type = 0;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- r_type = ELF64_R_TYPE (rel->r_info);
- switch (r_type)
- {
- case R_PPC64_GOT_TLSLD16:
- case R_PPC64_GOT_TLSLD16_LO:
- case R_PPC64_GOT_TLSLD16_HI:
- case R_PPC64_GOT_TLSLD16_HA:
- ppc64_tlsld_got (abfd)->refcount += 1;
- tls_type = TLS_TLS | TLS_LD;
- goto dogottls;
-
- case R_PPC64_GOT_TLSGD16:
- case R_PPC64_GOT_TLSGD16_LO:
- case R_PPC64_GOT_TLSGD16_HI:
- case R_PPC64_GOT_TLSGD16_HA:
- tls_type = TLS_TLS | TLS_GD;
- goto dogottls;
-
- case R_PPC64_GOT_TPREL16_DS:
- case R_PPC64_GOT_TPREL16_LO_DS:
- case R_PPC64_GOT_TPREL16_HI:
- case R_PPC64_GOT_TPREL16_HA:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- tls_type = TLS_TLS | TLS_TPREL;
- goto dogottls;
-
- case R_PPC64_GOT_DTPREL16_DS:
- case R_PPC64_GOT_DTPREL16_LO_DS:
- case R_PPC64_GOT_DTPREL16_HI:
- case R_PPC64_GOT_DTPREL16_HA:
- tls_type = TLS_TLS | TLS_DTPREL;
- dogottls:
- sec->has_tls_reloc = 1;
- /* Fall thru */
-
- case R_PPC64_GOT16:
- case R_PPC64_GOT16_DS:
- case R_PPC64_GOT16_HA:
- case R_PPC64_GOT16_HI:
- case R_PPC64_GOT16_LO:
- case R_PPC64_GOT16_LO_DS:
- /* This symbol requires a global offset table entry. */
- sec->has_gp_reloc = 1;
- if (ppc64_elf_tdata (abfd)->got == NULL
- && !create_got_section (abfd, info))
- return FALSE;
-
- if (h != NULL)
- {
- struct ppc_link_hash_entry *eh;
- struct got_entry *ent;
-
- eh = (struct ppc_link_hash_entry *) h;
- for (ent = eh->elf.got.glist; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
- && ent->owner == abfd
- && ent->tls_type == tls_type)
- break;
- if (ent == NULL)
- {
- bfd_size_type amt = sizeof (*ent);
- ent = bfd_alloc (abfd, amt);
- if (ent == NULL)
- return FALSE;
- ent->next = eh->elf.got.glist;
- ent->addend = rel->r_addend;
- ent->owner = abfd;
- ent->tls_type = tls_type;
- ent->got.refcount = 0;
- eh->elf.got.glist = ent;
- }
- ent->got.refcount += 1;
- eh->tls_mask |= tls_type;
- }
- else
- /* This is a global offset table entry for a local symbol. */
- if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
- rel->r_addend, tls_type))
- return FALSE;
- break;
-
- case R_PPC64_PLT16_HA:
- case R_PPC64_PLT16_HI:
- case R_PPC64_PLT16_LO:
- case R_PPC64_PLT32:
- case R_PPC64_PLT64:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code without
- linking in any dynamic objects, in which case we don't
- need to generate a procedure linkage table after all. */
- if (h == NULL)
- {
- /* It does not make sense to have a procedure linkage
- table entry for a local symbol. */
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
- rel->r_addend))
- return FALSE;
- break;
-
- /* The following relocations don't need to propagate the
- relocation if linking a shared object since they are
- section relative. */
- case R_PPC64_SECTOFF:
- case R_PPC64_SECTOFF_LO:
- case R_PPC64_SECTOFF_HI:
- case R_PPC64_SECTOFF_HA:
- case R_PPC64_SECTOFF_DS:
- case R_PPC64_SECTOFF_LO_DS:
- case R_PPC64_DTPREL16:
- case R_PPC64_DTPREL16_LO:
- case R_PPC64_DTPREL16_HI:
- case R_PPC64_DTPREL16_HA:
- case R_PPC64_DTPREL16_DS:
- case R_PPC64_DTPREL16_LO_DS:
- case R_PPC64_DTPREL16_HIGHER:
- case R_PPC64_DTPREL16_HIGHERA:
- case R_PPC64_DTPREL16_HIGHEST:
- case R_PPC64_DTPREL16_HIGHESTA:
- break;
-
- /* Nor do these. */
- case R_PPC64_TOC16:
- case R_PPC64_TOC16_LO:
- case R_PPC64_TOC16_HI:
- case R_PPC64_TOC16_HA:
- case R_PPC64_TOC16_DS:
- case R_PPC64_TOC16_LO_DS:
- sec->has_gp_reloc = 1;
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_PPC64_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_PPC64_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return FALSE;
- break;
-
- case R_PPC64_REL14:
- case R_PPC64_REL14_BRTAKEN:
- case R_PPC64_REL14_BRNTAKEN:
- htab->has_14bit_branch = 1;
- /* Fall through. */
-
- case R_PPC64_REL24:
- if (h != NULL
- && h->root.root.string[0] == '.'
- && h->root.root.string[1] != 0)
- {
- /* We may need a .plt entry if the function this reloc
- refers to is in a shared lib. */
- if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
- rel->r_addend))
- return FALSE;
- if (h == htab->tls_get_addr)
- sec->has_tls_reloc = 1;
- else if ((strncmp (h->root.root.string, ".__tls_get_addr", 15)
- == 0)
- && (h->root.root.string[15] == 0
- || h->root.root.string[15] == '@'))
- {
- htab->tls_get_addr = h;
- sec->has_tls_reloc = 1;
- }
- }
- break;
-
- case R_PPC64_TPREL64:
- tls_type = TLS_EXPLICIT | TLS_TLS | TLS_TPREL;
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- goto dotlstoc;
-
- case R_PPC64_DTPMOD64:
- if (rel + 1 < rel_end
- && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)
- && rel[1].r_offset == rel->r_offset + 8)
- tls_type = TLS_EXPLICIT | TLS_TLS | TLS_GD;
- else
- tls_type = TLS_EXPLICIT | TLS_TLS | TLS_LD;
- goto dotlstoc;
-
- case R_PPC64_DTPREL64:
- tls_type = TLS_EXPLICIT | TLS_TLS | TLS_DTPREL;
- if (rel != relocs
- && rel[-1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPMOD64)
- && rel[-1].r_offset == rel->r_offset - 8)
- /* This is the second reloc of a dtpmod, dtprel pair.
- Don't mark with TLS_DTPREL. */
- goto dodyn;
-
- dotlstoc:
- sec->has_tls_reloc = 1;
- if (h != NULL)
- {
- struct ppc_link_hash_entry *eh;
- eh = (struct ppc_link_hash_entry *) h;
- eh->tls_mask |= tls_type;
- }
- else
- if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
- rel->r_addend, tls_type))
- return FALSE;
-
- if (ppc64_elf_section_data (sec)->t_symndx == NULL)
- {
- /* One extra to simplify get_tls_mask. */
- bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8 + 1;
- ppc64_elf_section_data (sec)->t_symndx = bfd_zalloc (abfd, amt);
- if (ppc64_elf_section_data (sec)->t_symndx == NULL)
- return FALSE;
- }
- BFD_ASSERT (rel->r_offset % 8 == 0);
- ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8] = r_symndx;
-
- /* Mark the second slot of a GD or LD entry.
- -1 to indicate GD and -2 to indicate LD. */
- if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD))
- ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -1;
- else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD))
- ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -2;
- goto dodyn;
-
- case R_PPC64_TPREL16:
- case R_PPC64_TPREL16_LO:
- case R_PPC64_TPREL16_HI:
- case R_PPC64_TPREL16_HA:
- case R_PPC64_TPREL16_DS:
- case R_PPC64_TPREL16_LO_DS:
- case R_PPC64_TPREL16_HIGHER:
- case R_PPC64_TPREL16_HIGHERA:
- case R_PPC64_TPREL16_HIGHEST:
- case R_PPC64_TPREL16_HIGHESTA:
- if (info->shared)
- {
- info->flags |= DF_STATIC_TLS;
- goto dodyn;
- }
- break;
-
- case R_PPC64_ADDR64:
- if (opd_sym_map != NULL
- && h != NULL
- && h->root.root.string[0] == '.'
- && h->root.root.string[1] != 0)
- get_fdh ((struct ppc_link_hash_entry *) h, htab);
-
- if (opd_sym_map != NULL
- && h == NULL
- && rel + 1 < rel_end
- && ELF64_R_TYPE ((rel + 1)->r_info) == R_PPC64_TOC)
- {
- asection *s;
-
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec,
- r_symndx);
- if (s == NULL)
- return FALSE;
- else if (s != sec)
- opd_sym_map[rel->r_offset / 24] = s;
- }
- /* Fall through. */
-
- case R_PPC64_REL30:
- case R_PPC64_REL32:
- case R_PPC64_REL64:
- case R_PPC64_ADDR14:
- case R_PPC64_ADDR14_BRNTAKEN:
- case R_PPC64_ADDR14_BRTAKEN:
- case R_PPC64_ADDR16:
- case R_PPC64_ADDR16_DS:
- case R_PPC64_ADDR16_HA:
- case R_PPC64_ADDR16_HI:
- case R_PPC64_ADDR16_HIGHER:
- case R_PPC64_ADDR16_HIGHERA:
- case R_PPC64_ADDR16_HIGHEST:
- case R_PPC64_ADDR16_HIGHESTA:
- case R_PPC64_ADDR16_LO:
- case R_PPC64_ADDR16_LO_DS:
- case R_PPC64_ADDR24:
- case R_PPC64_ADDR32:
- case R_PPC64_UADDR16:
- case R_PPC64_UADDR32:
- case R_PPC64_UADDR64:
- case R_PPC64_TOC:
- if (h != NULL && !info->shared)
- /* We may need a copy reloc. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- /* Don't propagate .opd relocs. */
- if (NO_OPD_RELOCS && opd_sym_map != NULL)
- break;
-
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). In case of a weak definition,
- DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
- storing information in the dyn_relocs field of the hash
- table entry. A similar situation occurs when creating
- shared libraries and symbol visibility changes render the
- symbol local.
-
- If on the other hand, we are creating an executable, we
- may need to keep relocations for symbols satisfied by a
- dynamic library if we manage to avoid copy relocs for the
- symbol. */
- dodyn:
- if ((info->shared
- && (MUST_BE_DYN_RELOC (r_type)
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- struct ppc_dyn_relocs *p;
- struct ppc_dyn_relocs **head;
-
- /* We must copy these reloc types into the output file.
- Create a reloc section in dynobj and make room for
- this reloc. */
- if (sreloc == NULL)
- {
- const char *name;
- bfd *dynobj;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- if (strncmp (name, ".rela", 5) != 0
- || strcmp (bfd_get_section_name (abfd, sec),
- name + 5) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
- bfd_set_error (bfd_error_bad_value);
- }
-
- dynobj = htab->elf.dynobj;
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return FALSE;
- }
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- {
- head = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
- }
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
-
- asection *s;
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct ppc_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->sec != sec)
- {
- p = bfd_alloc (htab->elf.dynobj, sizeof *p);
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
- }
-
- p->count += 1;
- if (!MUST_BE_DYN_RELOC (r_type))
- p->pc_count += 1;
- }
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-ppc64_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- asection *rsec = NULL;
-
- if (h != NULL)
- {
- enum elf_ppc64_reloc_type r_type;
- struct ppc_link_hash_entry *fdh;
-
- r_type = ELF64_R_TYPE (rel->r_info);
- switch (r_type)
- {
- case R_PPC64_GNU_VTINHERIT:
- case R_PPC64_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- fdh = (struct ppc_link_hash_entry *) h;
-
- /* Function descriptor syms cause the associated
- function code sym section to be marked. */
- if (fdh->is_func_descriptor)
- rsec = fdh->oh->root.u.def.section;
-
- /* Function entry syms return NULL if they are in .opd
- and are not ._start (or others undefined on the ld
- command line). Thus we avoid marking all function
- sections, as all functions are referenced in .opd. */
- else if ((fdh->oh != NULL
- && ((struct ppc_link_hash_entry *) fdh->oh)->is_entry)
- || ppc64_elf_section_data (sec)->opd.func_sec == NULL)
- rsec = h->root.u.def.section;
- break;
-
- case bfd_link_hash_common:
- rsec = h->root.u.c.p->section;
- break;
-
- default:
- break;
- }
- }
- }
- else
- {
- asection **opd_sym_section;
-
- rsec = bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- opd_sym_section = ppc64_elf_section_data (rsec)->opd.func_sec;
- if (opd_sym_section != NULL)
- rsec = opd_sym_section[sym->st_value / 24];
- else if (ppc64_elf_section_data (sec)->opd.func_sec != NULL)
- rsec = NULL;
- }
-
- return rsec;
-}
-
-/* Update the .got, .plt. and dynamic reloc reference counts for the
- section being removed. */
-
-static bfd_boolean
-ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
- asection *sec, const Elf_Internal_Rela *relocs)
-{
- struct ppc_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- struct got_entry **local_got_ents;
- const Elf_Internal_Rela *rel, *relend;
-
- if ((sec->flags & SEC_ALLOC) == 0)
- return TRUE;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- htab = ppc_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_ents = elf_local_got_ents (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- enum elf_ppc64_reloc_type r_type;
- struct elf_link_hash_entry *h = NULL;
- char tls_type = 0;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- r_type = ELF64_R_TYPE (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct ppc_link_hash_entry *eh;
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct ppc_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- switch (r_type)
- {
- case R_PPC64_GOT_TLSLD16:
- case R_PPC64_GOT_TLSLD16_LO:
- case R_PPC64_GOT_TLSLD16_HI:
- case R_PPC64_GOT_TLSLD16_HA:
- ppc64_tlsld_got (abfd)->refcount -= 1;
- tls_type = TLS_TLS | TLS_LD;
- goto dogot;
-
- case R_PPC64_GOT_TLSGD16:
- case R_PPC64_GOT_TLSGD16_LO:
- case R_PPC64_GOT_TLSGD16_HI:
- case R_PPC64_GOT_TLSGD16_HA:
- tls_type = TLS_TLS | TLS_GD;
- goto dogot;
-
- case R_PPC64_GOT_TPREL16_DS:
- case R_PPC64_GOT_TPREL16_LO_DS:
- case R_PPC64_GOT_TPREL16_HI:
- case R_PPC64_GOT_TPREL16_HA:
- tls_type = TLS_TLS | TLS_TPREL;
- goto dogot;
-
- case R_PPC64_GOT_DTPREL16_DS:
- case R_PPC64_GOT_DTPREL16_LO_DS:
- case R_PPC64_GOT_DTPREL16_HI:
- case R_PPC64_GOT_DTPREL16_HA:
- tls_type = TLS_TLS | TLS_DTPREL;
- goto dogot;
-
- case R_PPC64_GOT16:
- case R_PPC64_GOT16_DS:
- case R_PPC64_GOT16_HA:
- case R_PPC64_GOT16_HI:
- case R_PPC64_GOT16_LO:
- case R_PPC64_GOT16_LO_DS:
- dogot:
- {
- struct got_entry *ent;
-
- if (h != NULL)
- ent = h->got.glist;
- else
- ent = local_got_ents[r_symndx];
-
- for (; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
- && ent->owner == abfd
- && ent->tls_type == tls_type)
- break;
- if (ent == NULL)
- abort ();
- if (ent->got.refcount > 0)
- ent->got.refcount -= 1;
- }
- break;
-
- case R_PPC64_PLT16_HA:
- case R_PPC64_PLT16_HI:
- case R_PPC64_PLT16_LO:
- case R_PPC64_PLT32:
- case R_PPC64_PLT64:
- case R_PPC64_REL14:
- case R_PPC64_REL14_BRNTAKEN:
- case R_PPC64_REL14_BRTAKEN:
- case R_PPC64_REL24:
- if (h != NULL)
- {
- struct plt_entry *ent;
-
- for (ent = h->plt.plist; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend)
- break;
- if (ent == NULL)
- abort ();
- if (ent->plt.refcount > 0)
- ent->plt.refcount -= 1;
- }
- break;
-
- default:
- break;
- }
- }
- return TRUE;
-}
-
-/* Called via elf_link_hash_traverse to transfer dynamic linking
- information on function code symbol entries to their corresponding
- function descriptor symbol entries. */
-static bfd_boolean
-func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
-{
- struct bfd_link_info *info;
- struct ppc_link_hash_table *htab;
- struct plt_entry *ent;
- struct ppc_link_hash_entry *fh;
- struct ppc_link_hash_entry *fdh;
- bfd_boolean force_local;
-
- fh = (struct ppc_link_hash_entry *) h;
- if (fh->elf.root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (fh->elf.root.type == bfd_link_hash_warning)
- fh = (struct ppc_link_hash_entry *) fh->elf.root.u.i.link;
-
- info = inf;
- htab = ppc_hash_table (info);
-
- /* If this is a function code symbol, transfer dynamic linking
- information to the function descriptor symbol. */
- if (!fh->is_func)
- return TRUE;
-
- if (fh->elf.root.type == bfd_link_hash_undefweak
- && (fh->elf.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR))
- htab->have_undefweak = TRUE;
-
- for (ent = fh->elf.plt.plist; ent != NULL; ent = ent->next)
- if (ent->plt.refcount > 0)
- break;
- if (ent == NULL
- || fh->elf.root.root.string[0] != '.'
- || fh->elf.root.root.string[1] == '\0')
- return TRUE;
-
- /* Find the corresponding function descriptor symbol. Create it
- as undefined if necessary. */
-
- fdh = get_fdh (fh, htab);
- if (fdh != NULL)
- while (fdh->elf.root.type == bfd_link_hash_indirect
- || fdh->elf.root.type == bfd_link_hash_warning)
- fdh = (struct ppc_link_hash_entry *) fdh->elf.root.u.i.link;
-
- if (fdh == NULL
- && info->shared
- && (fh->elf.root.type == bfd_link_hash_undefined
- || fh->elf.root.type == bfd_link_hash_undefweak))
- {
- bfd *abfd;
- asymbol *newsym;
- struct bfd_link_hash_entry *bh;
-
- abfd = fh->elf.root.u.undef.abfd;
- newsym = bfd_make_empty_symbol (abfd);
- newsym->name = fh->elf.root.root.string + 1;
- newsym->section = bfd_und_section_ptr;
- newsym->value = 0;
- newsym->flags = BSF_OBJECT;
- if (fh->elf.root.type == bfd_link_hash_undefweak)
- newsym->flags |= BSF_WEAK;
-
- bh = &fdh->elf.root;
- if ( !(_bfd_generic_link_add_one_symbol
- (info, abfd, newsym->name, newsym->flags,
- newsym->section, newsym->value, NULL, FALSE, FALSE, &bh)))
- {
- return FALSE;
- }
- fdh = (struct ppc_link_hash_entry *) bh;
- fdh->elf.elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
- fdh->elf.size = 24;
- fdh->elf.type = STT_OBJECT;
- }
-
- if (fdh != NULL
- && (fdh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0
- && (info->shared
- || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
- || (fdh->elf.root.type == bfd_link_hash_undefweak
- && ELF_ST_VISIBILITY (fdh->elf.other) == STV_DEFAULT)))
- {
- if (fdh->elf.dynindx == -1)
- if (! bfd_elf_link_record_dynamic_symbol (info, &fdh->elf))
- return FALSE;
- fdh->elf.elf_link_hash_flags
- |= (fh->elf.elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_NON_GOT_REF));
- if (ELF_ST_VISIBILITY (fh->elf.other) == STV_DEFAULT)
- {
- fdh->elf.plt.plist = fh->elf.plt.plist;
- fdh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- }
- fdh->is_func_descriptor = 1;
- fdh->oh = &fh->elf;
- fh->oh = &fdh->elf;
- }
-
- /* Now that the info is on the function descriptor, clear the
- function code sym info. Any function code syms for which we
- don't have a definition in a regular file, we force local.
- This prevents a shared library from exporting syms that have
- been imported from another library. Function code syms that
- are really in the library we must leave global to prevent the
- linker dragging in a definition from a static library. */
- force_local
- = (info->shared
- && ((fh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- || fdh == NULL
- || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- || (fdh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0));
- _bfd_elf_link_hash_hide_symbol (info, &fh->elf, force_local);
-
- return TRUE;
-}
-
-#define MIN_SAVE_FPR 14
-#define MAX_SAVE_FPR 31
-
-/* Called near the start of bfd_elf_size_dynamic_sections. We use
- this hook to a) provide some gcc support functions, and b) transfer
- dynamic linking information gathered so far on function code symbol
- entries, to their corresponding function descriptor symbol entries. */
-static bfd_boolean
-ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
- unsigned int lowest_savef = MAX_SAVE_FPR + 2;
- unsigned int lowest_restf = MAX_SAVE_FPR + 2;
- unsigned int i;
- struct elf_link_hash_entry *h;
- bfd_byte *p;
- char sym[10];
-
- htab = ppc_hash_table (info);
-
- if (htab->sfpr == NULL)
- /* We don't have any relocs. */
- return TRUE;
-
- /* First provide any missing ._savef* and ._restf* functions. */
- memcpy (sym, "._savef14", 10);
- for (i = MIN_SAVE_FPR; i <= MAX_SAVE_FPR; i++)
- {
- sym[7] = i / 10 + '0';
- sym[8] = i % 10 + '0';
- h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE);
- if (h != NULL
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- if (lowest_savef > i)
- lowest_savef = i;
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = htab->sfpr;
- h->root.u.def.value = (i - lowest_savef) * 4;
- h->type = STT_FUNC;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- _bfd_elf_link_hash_hide_symbol (info, h, TRUE);
- }
- }
-
- memcpy (sym, "._restf14", 10);
- for (i = MIN_SAVE_FPR; i <= MAX_SAVE_FPR; i++)
- {
- sym[7] = i / 10 + '0';
- sym[8] = i % 10 + '0';
- h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE);
- if (h != NULL
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- if (lowest_restf > i)
- lowest_restf = i;
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = htab->sfpr;
- h->root.u.def.value = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4
- + (i - lowest_restf) * 4);
- h->type = STT_FUNC;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- _bfd_elf_link_hash_hide_symbol (info, h, TRUE);
- }
- }
-
- elf_link_hash_traverse (&htab->elf, func_desc_adjust, info);
-
- htab->sfpr->_raw_size = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4
- + (MAX_SAVE_FPR + 2 - lowest_restf) * 4);
-
- if (htab->sfpr->_raw_size == 0)
- {
- if (!htab->have_undefweak)
- {
- _bfd_strip_section_from_output (info, htab->sfpr);
- return TRUE;
- }
-
- htab->sfpr->_raw_size = 4;
- }
-
- p = bfd_alloc (htab->elf.dynobj, htab->sfpr->_raw_size);
- if (p == NULL)
- return FALSE;
- htab->sfpr->contents = p;
-
- for (i = lowest_savef; i <= MAX_SAVE_FPR; i++)
- {
- unsigned int fpr = i << 21;
- unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8;
- bfd_put_32 (htab->elf.dynobj, STFD_FR0_0R1 + fpr + stackoff, p);
- p += 4;
- }
- if (lowest_savef <= MAX_SAVE_FPR)
- {
- bfd_put_32 (htab->elf.dynobj, BLR, p);
- p += 4;
- }
-
- for (i = lowest_restf; i <= MAX_SAVE_FPR; i++)
- {
- unsigned int fpr = i << 21;
- unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8;
- bfd_put_32 (htab->elf.dynobj, LFD_FR0_0R1 + fpr + stackoff, p);
- p += 4;
- }
- if (lowest_restf <= MAX_SAVE_FPR
- || htab->sfpr->_raw_size == 4)
- {
- bfd_put_32 (htab->elf.dynobj, BLR, p);
- }
-
- return TRUE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
-{
- struct ppc_link_hash_table *htab;
- asection *s;
- unsigned int power_of_two;
-
- htab = ppc_hash_table (info);
-
- /* Deal with function syms. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- /* Clear procedure linkage table information for any symbol that
- won't need a .plt entry. */
- struct plt_entry *ent;
- for (ent = h->plt.plist; ent != NULL; ent = ent->next)
- if (ent->plt.refcount > 0)
- break;
- if (!((struct ppc_link_hash_entry *) h)->is_func_descriptor
- || ent == NULL
- || SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak))
- {
- h->plt.plist = NULL;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- else
- h->plt.plist = NULL;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- if (ELIMINATE_COPY_RELOCS)
- h->elf_link_hash_flags
- = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
- | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
- return TRUE;
- }
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* If there are no references to this symbol that do not use the
- GOT, we don't need to generate a copy reloc. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
- return TRUE;
-
- if (ELIMINATE_COPY_RELOCS)
- {
- struct ppc_link_hash_entry * eh;
- struct ppc_dyn_relocs *p;
-
- eh = (struct ppc_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
-
- /* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
- if (p == NULL)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
- }
-
- if (h->plt.plist != NULL)
- {
- /* We should never get here, but unfortunately there are versions
- of gcc out there that improperly (for this ABI) put initialized
- function pointers, vtable refs and suchlike in read-only
- sections. Allow them to proceed, but warn that this might
- break at runtime. */
- (*_bfd_error_handler)
- (_("copy reloc against `%s' requires lazy plt linking; "
- "avoid setting LD_BIND_NOW=1 or upgrade gcc"),
- h->root.root.string);
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
-
- /* We must generate a R_PPC64_COPY reloc to tell the dynamic linker
- to copy the initial value out of the dynamic object and into the
- runtime process image. We need to remember the offset into the
- .rela.bss section we are going to use. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- htab->relbss->_raw_size += sizeof (Elf64_External_Rela);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
- s = htab->dynbss;
- s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* If given a function descriptor symbol, hide both the function code
- sym and the descriptor. */
-static void
-ppc64_elf_hide_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- bfd_boolean force_local)
-{
- _bfd_elf_link_hash_hide_symbol (info, h, force_local);
-
- if (((struct ppc_link_hash_entry *) h)->is_func_descriptor)
- {
- struct elf_link_hash_entry *fh = ((struct ppc_link_hash_entry *) h)->oh;
-
- if (fh == NULL)
- {
- const char *p, *q;
- struct ppc_link_hash_table *htab;
- char save;
-
- /* We aren't supposed to use alloca in BFD because on
- systems which do not have alloca the version in libiberty
- calls xmalloc, which might cause the program to crash
- when it runs out of memory. This function doesn't have a
- return status, so there's no way to gracefully return an
- error. So cheat. We know that string[-1] can be safely
- dereferenced; It's either a string in an ELF string
- table, or allocated in an objalloc structure. */
-
- p = h->root.root.string - 1;
- save = *p;
- *(char *) p = '.';
- htab = ppc_hash_table (info);
- fh = elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE);
- *(char *) p = save;
-
- /* Unfortunately, if it so happens that the string we were
- looking for was allocated immediately before this string,
- then we overwrote the string terminator. That's the only
- reason the lookup should fail. */
- if (fh == NULL)
- {
- q = h->root.root.string + strlen (h->root.root.string);
- while (q >= h->root.root.string && *q == *p)
- --q, --p;
- if (q < h->root.root.string && *p == '.')
- fh = elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE);
- }
- if (fh != NULL)
- {
- ((struct ppc_link_hash_entry *) h)->oh = fh;
- ((struct ppc_link_hash_entry *) fh)->oh = h;
- }
- }
- if (fh != NULL)
- _bfd_elf_link_hash_hide_symbol (info, fh, force_local);
- }
-}
-
-static bfd_boolean
-get_sym_h (struct elf_link_hash_entry **hp, Elf_Internal_Sym **symp,
- asection **symsecp, char **tls_maskp, Elf_Internal_Sym **locsymsp,
- unsigned long r_symndx, bfd *ibfd)
-{
- Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
-
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd);
- struct elf_link_hash_entry *h;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (hp != NULL)
- *hp = h;
-
- if (symp != NULL)
- *symp = NULL;
-
- if (symsecp != NULL)
- {
- asection *symsec = NULL;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- symsec = h->root.u.def.section;
- *symsecp = symsec;
- }
-
- if (tls_maskp != NULL)
- {
- struct ppc_link_hash_entry *eh;
-
- eh = (struct ppc_link_hash_entry *) h;
- *tls_maskp = &eh->tls_mask;
- }
- }
- else
- {
- Elf_Internal_Sym *sym;
- Elf_Internal_Sym *locsyms = *locsymsp;
-
- if (locsyms == NULL)
- {
- locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (locsyms == NULL)
- locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
- symtab_hdr->sh_info,
- 0, NULL, NULL, NULL);
- if (locsyms == NULL)
- return FALSE;
- *locsymsp = locsyms;
- }
- sym = locsyms + r_symndx;
-
- if (hp != NULL)
- *hp = NULL;
-
- if (symp != NULL)
- *symp = sym;
-
- if (symsecp != NULL)
- {
- asection *symsec = NULL;
- if ((sym->st_shndx != SHN_UNDEF
- && sym->st_shndx < SHN_LORESERVE)
- || sym->st_shndx > SHN_HIRESERVE)
- symsec = bfd_section_from_elf_index (ibfd, sym->st_shndx);
- *symsecp = symsec;
- }
-
- if (tls_maskp != NULL)
- {
- struct got_entry **lgot_ents;
- char *tls_mask;
-
- tls_mask = NULL;
- lgot_ents = elf_local_got_ents (ibfd);
- if (lgot_ents != NULL)
- {
- char *lgot_masks = (char *) (lgot_ents + symtab_hdr->sh_info);
- tls_mask = &lgot_masks[r_symndx];
- }
- *tls_maskp = tls_mask;
- }
- }
- return TRUE;
-}
-
-/* Returns TLS_MASKP for the given REL symbol. Function return is 0 on
- error, 2 on a toc GD type suitable for optimization, 3 on a toc LD
- type suitable for optimization, and 1 otherwise. */
-
-static int
-get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
- Elf_Internal_Sym **locsymsp,
- const Elf_Internal_Rela *rel, bfd *ibfd)
-{
- unsigned long r_symndx;
- int next_r;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sec;
- bfd_vma off;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
- return 0;
-
- if ((*tls_maskp != NULL && **tls_maskp != 0)
- || sec == NULL
- || ppc64_elf_section_data (sec)->t_symndx == NULL)
- return 1;
-
- /* Look inside a TOC section too. */
- if (h != NULL)
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined);
- off = h->root.u.def.value;
- }
- else
- off = sym->st_value;
- off += rel->r_addend;
- BFD_ASSERT (off % 8 == 0);
- r_symndx = ppc64_elf_section_data (sec)->t_symndx[off / 8];
- next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1];
- if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
- return 0;
- if (toc_symndx != NULL)
- *toc_symndx = r_symndx;
- if ((h == NULL
- || ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
- && (next_r == -1 || next_r == -2))
- return 1 - next_r;
- return 1;
-}
-
-/* Adjust all global syms defined in opd sections. In gcc generated
- code these will already have been done, but I suppose we have to
- cater for all sorts of hand written assembly. */
-
-static bfd_boolean
-adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
-{
- struct ppc_link_hash_entry *eh;
- asection *sym_sec;
- long *opd_adjust;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- return TRUE;
-
- eh = (struct ppc_link_hash_entry *) h;
- if (eh->adjust_done)
- return TRUE;
-
- sym_sec = eh->elf.root.u.def.section;
- if (sym_sec != NULL
- && elf_section_data (sym_sec) != NULL
- && (opd_adjust = ppc64_elf_section_data (sym_sec)->opd.adjust) != NULL)
- {
- eh->elf.root.u.def.value += opd_adjust[eh->elf.root.u.def.value / 24];
- eh->adjust_done = 1;
- }
- return TRUE;
-}
-
-/* Remove unused Official Procedure Descriptor entries. Currently we
- only remove those associated with functions in discarded link-once
- sections, or weakly defined functions that have been overridden. It
- would be possible to remove many more entries for statically linked
- applications. */
-
-bfd_boolean
-ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
-{
- bfd *ibfd;
- bfd_boolean some_edited = FALSE;
-
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- asection *sec;
- Elf_Internal_Rela *relstart, *rel, *relend;
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Sym *local_syms;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma offset;
- bfd_size_type amt;
- long *adjust;
- bfd_boolean need_edit;
-
- sec = bfd_get_section_by_name (ibfd, ".opd");
- if (sec == NULL)
- continue;
-
- amt = sec->_raw_size * sizeof (long) / 24;
- adjust = ppc64_elf_section_data (sec)->opd.adjust;
- if (adjust == NULL)
- {
- /* Must be a ld -r link. ie. check_relocs hasn't been
- called. */
- adjust = bfd_zalloc (obfd, amt);
- ppc64_elf_section_data (sec)->opd.adjust = adjust;
- }
- memset (adjust, 0, amt);
-
- if (sec->output_section == bfd_abs_section_ptr)
- continue;
-
- /* Look through the section relocs. */
- if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0)
- continue;
-
- local_syms = NULL;
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (ibfd);
-
- /* Read the relocations. */
- relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
- info->keep_memory);
- if (relstart == NULL)
- return FALSE;
-
- /* First run through the relocs to check they are sane, and to
- determine whether we need to edit this opd section. */
- need_edit = FALSE;
- offset = 0;
- relend = relstart + sec->reloc_count;
- for (rel = relstart; rel < relend; )
- {
- enum elf_ppc64_reloc_type r_type;
- unsigned long r_symndx;
- asection *sym_sec;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-
- /* .opd contains a regular array of 24 byte entries. We're
- only interested in the reloc pointing to a function entry
- point. */
- if (rel->r_offset != offset
- || rel + 1 >= relend
- || (rel + 1)->r_offset != offset + 8)
- {
- /* If someone messes with .opd alignment then after a
- "ld -r" we might have padding in the middle of .opd.
- Also, there's nothing to prevent someone putting
- something silly in .opd with the assembler. No .opd
- optimization for them! */
- (*_bfd_error_handler)
- (_("%s: .opd is not a regular array of opd entries"),
- bfd_archive_filename (ibfd));
- need_edit = FALSE;
- break;
- }
-
- if ((r_type = ELF64_R_TYPE (rel->r_info)) != R_PPC64_ADDR64
- || (r_type = ELF64_R_TYPE ((rel + 1)->r_info)) != R_PPC64_TOC)
- {
- (*_bfd_error_handler)
- (_("%s: unexpected reloc type %u in .opd section"),
- bfd_archive_filename (ibfd), r_type);
- need_edit = FALSE;
- break;
- }
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
- r_symndx, ibfd))
- goto error_ret;
-
- if (sym_sec == NULL || sym_sec->owner == NULL)
- {
- const char *sym_name;
- if (h != NULL)
- sym_name = h->root.root.string;
- else
- sym_name = bfd_elf_local_sym_name (ibfd, sym);
-
- (*_bfd_error_handler)
- (_("%s: undefined sym `%s' in .opd section"),
- bfd_archive_filename (ibfd),
- sym_name);
- need_edit = FALSE;
- break;
- }
-
- /* opd entries are always for functions defined in the
- current input bfd. If the symbol isn't defined in the
- input bfd, then we won't be using the function in this
- bfd; It must be defined in a linkonce section in another
- bfd, or is weak. It's also possible that we are
- discarding the function due to a linker script /DISCARD/,
- which we test for via the output_section. */
- if (sym_sec->owner != ibfd
- || sym_sec->output_section == bfd_abs_section_ptr)
- need_edit = TRUE;
-
- offset += 24;
- rel += 2;
- /* Allow for the possibility of a reloc on the third word. */
- if (rel < relend
- && rel->r_offset == offset - 8)
- rel += 1;
- }
-
- if (need_edit)
- {
- Elf_Internal_Rela *write_rel;
- bfd_byte *rptr, *wptr;
- bfd_boolean skip;
-
- /* This seems a waste of time as input .opd sections are all
- zeros as generated by gcc, but I suppose there's no reason
- this will always be so. We might start putting something in
- the third word of .opd entries. */
- if ((sec->flags & SEC_IN_MEMORY) == 0)
- {
- bfd_byte *loc = bfd_alloc (ibfd, sec->_raw_size);
- if (loc == NULL
- || !bfd_get_section_contents (ibfd, sec, loc, 0,
- sec->_raw_size))
- {
- error_ret:
- if (local_syms != NULL
- && symtab_hdr->contents != (unsigned char *) local_syms)
- free (local_syms);
- if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
- return FALSE;
- }
- sec->contents = loc;
- sec->flags |= (SEC_IN_MEMORY | SEC_HAS_CONTENTS);
- }
-
- elf_section_data (sec)->relocs = relstart;
-
- wptr = sec->contents;
- rptr = sec->contents;
- write_rel = relstart;
- skip = FALSE;
- offset = 0;
- for (rel = relstart; rel < relend; rel++)
- {
- unsigned long r_symndx;
- asection *sym_sec;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
- r_symndx, ibfd))
- goto error_ret;
-
- if (rel->r_offset == offset)
- {
- struct ppc_link_hash_entry *fdh = NULL;
- if (h != NULL)
- fdh = get_fdh ((struct ppc_link_hash_entry *) h,
- ppc_hash_table (info));
-
- skip = (sym_sec->owner != ibfd
- || sym_sec->output_section == bfd_abs_section_ptr);
- if (skip)
- {
- if (h != NULL && sym_sec->owner == ibfd)
- {
- /* Arrange for the function descriptor sym
- to be dropped. */
- fdh->elf.root.u.def.value = 0;
- fdh->elf.root.u.def.section = sym_sec;
- }
- }
- else
- {
- /* We'll be keeping this opd entry. */
-
- if (h != NULL)
- {
- /* Redefine the function descriptor symbol to
- this location in the opd section. It is
- necessary to update the value here rather
- than using an array of adjustments as we do
- for local symbols, because various places
- in the generic ELF code use the value
- stored in u.def.value. */
- fdh->elf.root.u.def.value = wptr - sec->contents;
- fdh->adjust_done = 1;
- }
-
- /* Local syms are a bit tricky. We could
- tweak them as they can be cached, but
- we'd need to look through the local syms
- for the function descriptor sym which we
- don't have at the moment. So keep an
- array of adjustments. */
- adjust[rel->r_offset / 24] = wptr - rptr;
-
- if (wptr != rptr)
- memcpy (wptr, rptr, 24);
- wptr += 24;
- }
- rptr += 24;
- offset += 24;
- }
-
- if (skip)
- {
- BFD_ASSERT (MUST_BE_DYN_RELOC (ELF64_R_TYPE (rel->r_info)));
- if (info->shared)
- {
- /* We won't be needing dynamic relocs here. */
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
-
- if (h != NULL)
- pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
- else if (sym_sec != NULL)
- pp = ((struct ppc_dyn_relocs **)
- &elf_section_data (sym_sec)->local_dynrel);
- else
- pp = ((struct ppc_dyn_relocs **)
- &elf_section_data (sec)->local_dynrel);
- while ((p = *pp) != NULL)
- {
- if (p->sec == sec)
- {
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- pp = &p->next;
- }
- }
- }
- else
- {
- /* We need to adjust any reloc offsets to point to the
- new opd entries. While we're at it, we may as well
- remove redundant relocs. */
- rel->r_offset += wptr - rptr;
- if (write_rel != rel)
- memcpy (write_rel, rel, sizeof (*rel));
- ++write_rel;
- }
- }
-
- sec->_cooked_size = wptr - sec->contents;
- sec->reloc_count = write_rel - relstart;
- /* Fudge the size too, as this is used later in
- elf_bfd_final_link if we are emitting relocs. */
- elf_section_data (sec)->rel_hdr.sh_size
- = sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize;
- BFD_ASSERT (elf_section_data (sec)->rel_hdr2 == NULL);
- some_edited = TRUE;
- }
- else if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
-
- if (local_syms != NULL
- && symtab_hdr->contents != (unsigned char *) local_syms)
- {
- if (!info->keep_memory)
- free (local_syms);
- else
- symtab_hdr->contents = (unsigned char *) local_syms;
- }
- }
-
- if (some_edited)
- elf_link_hash_traverse (elf_hash_table (info), adjust_opd_syms, NULL);
-
- return TRUE;
-}
-
-/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */
-
-asection *
-ppc64_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
-
- htab = ppc_hash_table (info);
- if (htab->tls_get_addr != NULL)
- {
- struct elf_link_hash_entry *h = htab->tls_get_addr;
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- htab->tls_get_addr = h;
- }
-
- return _bfd_elf_tls_setup (obfd, info);
-}
-
-/* Run through all the TLS relocs looking for optimization
- opportunities. The linker has been hacked (see ppc64elf.em) to do
- a preliminary section layout so that we know the TLS segment
- offsets. We can't optimize earlier because some optimizations need
- to know the tp offset, and we need to optimize before allocating
- dynamic relocations. */
-
-bfd_boolean
-ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
-{
- bfd *ibfd;
- asection *sec;
- struct ppc_link_hash_table *htab;
-
- if (info->relocatable || info->shared)
- return TRUE;
-
- htab = ppc_hash_table (info);
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- Elf_Internal_Sym *locsyms = NULL;
-
- for (sec = ibfd->sections; sec != NULL; sec = sec->next)
- if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section))
- {
- Elf_Internal_Rela *relstart, *rel, *relend;
- int expecting_tls_get_addr;
-
- /* Read the relocations. */
- relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
- info->keep_memory);
- if (relstart == NULL)
- return FALSE;
-
- expecting_tls_get_addr = 0;
- relend = relstart + sec->reloc_count;
- for (rel = relstart; rel < relend; rel++)
- {
- enum elf_ppc64_reloc_type r_type;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sym_sec;
- char *tls_mask;
- char tls_set, tls_clear, tls_type = 0;
- bfd_vma value;
- bfd_boolean ok_tprel, is_local;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (!get_sym_h (&h, &sym, &sym_sec, &tls_mask, &locsyms,
- r_symndx, ibfd))
- {
- err_free_rel:
- if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
- if (locsyms != NULL
- && (elf_tdata (ibfd)->symtab_hdr.contents
- != (unsigned char *) locsyms))
- free (locsyms);
- return FALSE;
- }
-
- if (h != NULL)
- {
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- continue;
- value = h->root.u.def.value;
- }
- else
- {
- value = sym->st_value;
-
- if (elf_section_data (sym_sec) != NULL)
- {
- long *adjust;
- adjust = ppc64_elf_section_data (sym_sec)->opd.adjust;
- if (adjust != NULL)
- value += adjust[value / 24];
- }
- }
-
- ok_tprel = FALSE;
- is_local = FALSE;
- if (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
- {
- is_local = TRUE;
- value += sym_sec->output_offset;
- value += sym_sec->output_section->vma;
- value -= htab->elf.tls_sec->vma;
- ok_tprel = (value + TP_OFFSET + ((bfd_vma) 1 << 31)
- < (bfd_vma) 1 << 32);
- }
-
- r_type = ELF64_R_TYPE (rel->r_info);
- switch (r_type)
- {
- case R_PPC64_GOT_TLSLD16:
- case R_PPC64_GOT_TLSLD16_LO:
- case R_PPC64_GOT_TLSLD16_HI:
- case R_PPC64_GOT_TLSLD16_HA:
- /* These relocs should never be against a symbol
- defined in a shared lib. Leave them alone if
- that turns out to be the case. */
- ppc64_tlsld_got (ibfd)->refcount -= 1;
- if (!is_local)
- continue;
-
- /* LD -> LE */
- tls_set = 0;
- tls_clear = TLS_LD;
- tls_type = TLS_TLS | TLS_LD;
- expecting_tls_get_addr = 1;
- break;
-
- case R_PPC64_GOT_TLSGD16:
- case R_PPC64_GOT_TLSGD16_LO:
- case R_PPC64_GOT_TLSGD16_HI:
- case R_PPC64_GOT_TLSGD16_HA:
- if (ok_tprel)
- /* GD -> LE */
- tls_set = 0;
- else
- /* GD -> IE */
- tls_set = TLS_TLS | TLS_TPRELGD;
- tls_clear = TLS_GD;
- tls_type = TLS_TLS | TLS_GD;
- expecting_tls_get_addr = 1;
- break;
-
- case R_PPC64_GOT_TPREL16_DS:
- case R_PPC64_GOT_TPREL16_LO_DS:
- case R_PPC64_GOT_TPREL16_HI:
- case R_PPC64_GOT_TPREL16_HA:
- expecting_tls_get_addr = 0;
- if (ok_tprel)
- {
- /* IE -> LE */
- tls_set = 0;
- tls_clear = TLS_TPREL;
- tls_type = TLS_TLS | TLS_TPREL;
- break;
- }
- else
- continue;
-
- case R_PPC64_REL14:
- case R_PPC64_REL14_BRTAKEN:
- case R_PPC64_REL14_BRNTAKEN:
- case R_PPC64_REL24:
- if (h != NULL
- && h == htab->tls_get_addr)
- {
- if (!expecting_tls_get_addr
- && rel != relstart
- && ((ELF64_R_TYPE (rel[-1].r_info)
- == R_PPC64_TOC16)
- || (ELF64_R_TYPE (rel[-1].r_info)
- == R_PPC64_TOC16_LO)))
- {
- /* Check for toc tls entries. */
- char *toc_tls;
- int retval;
-
- retval = get_tls_mask (&toc_tls, NULL, &locsyms,
- rel - 1, ibfd);
- if (retval == 0)
- goto err_free_rel;
- if (toc_tls != NULL)
- expecting_tls_get_addr = retval > 1;
- }
-
- if (expecting_tls_get_addr)
- {
- struct plt_entry *ent;
- for (ent = h->plt.plist; ent; ent = ent->next)
- if (ent->addend == 0)
- {
- if (ent->plt.refcount > 0)
- ent->plt.refcount -= 1;
- break;
- }
- }
- }
- expecting_tls_get_addr = 0;
- continue;
-
- case R_PPC64_TPREL64:
- expecting_tls_get_addr = 0;
- if (ok_tprel)
- {
- /* IE -> LE */
- tls_set = TLS_EXPLICIT;
- tls_clear = TLS_TPREL;
- break;
- }
- else
- continue;
-
- case R_PPC64_DTPMOD64:
- expecting_tls_get_addr = 0;
- if (rel + 1 < relend
- && (rel[1].r_info
- == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64))
- && rel[1].r_offset == rel->r_offset + 8)
- {
- if (ok_tprel)
- /* GD -> LE */
- tls_set = TLS_EXPLICIT | TLS_GD;
- else
- /* GD -> IE */
- tls_set = TLS_EXPLICIT | TLS_GD | TLS_TPRELGD;
- tls_clear = TLS_GD;
- }
- else
- {
- if (!is_local)
- continue;
-
- /* LD -> LE */
- tls_set = TLS_EXPLICIT;
- tls_clear = TLS_LD;
- }
- break;
-
- default:
- expecting_tls_get_addr = 0;
- continue;
- }
-
- if ((tls_set & TLS_EXPLICIT) == 0)
- {
- struct got_entry *ent;
-
- /* Adjust got entry for this reloc. */
- if (h != NULL)
- ent = h->got.glist;
- else
- ent = elf_local_got_ents (ibfd)[r_symndx];
-
- for (; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
- && ent->owner == ibfd
- && ent->tls_type == tls_type)
- break;
- if (ent == NULL)
- abort ();
-
- if (tls_set == 0)
- {
- /* We managed to get rid of a got entry. */
- if (ent->got.refcount > 0)
- ent->got.refcount -= 1;
- }
- }
- else if (h != NULL)
- {
- struct ppc_link_hash_entry * eh;
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
-
- /* Adjust dynamic relocs. */
- eh = (struct ppc_link_hash_entry *) h;
- for (pp = &eh->dyn_relocs;
- (p = *pp) != NULL;
- pp = &p->next)
- if (p->sec == sec)
- {
- /* If we got rid of a DTPMOD/DTPREL reloc
- pair then we'll lose one or two dyn
- relocs. */
- if (tls_set == (TLS_EXPLICIT | TLS_GD))
- p->count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
-
- *tls_mask |= tls_set;
- *tls_mask &= ~tls_clear;
- }
-
- if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
- }
-
- if (locsyms != NULL
- && (elf_tdata (ibfd)->symtab_hdr.contents
- != (unsigned char *) locsyms))
- {
- if (!info->keep_memory)
- free (locsyms);
- else
- elf_tdata (ibfd)->symtab_hdr.contents = (unsigned char *) locsyms;
- }
- }
- return TRUE;
-}
-
-/* Allocate space in .plt, .got and associated reloc sections for
- dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
-{
- struct bfd_link_info *info;
- struct ppc_link_hash_table *htab;
- asection *s;
- struct ppc_link_hash_entry *eh;
- struct ppc_dyn_relocs *p;
- struct got_entry *gent;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- info = (struct bfd_link_info *) inf;
- htab = ppc_hash_table (info);
-
- if (htab->elf.dynamic_sections_created
- && h->dynindx != -1
- && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
- {
- struct plt_entry *pent;
- bfd_boolean doneone = FALSE;
- for (pent = h->plt.plist; pent != NULL; pent = pent->next)
- if (pent->plt.refcount > 0)
- {
- BFD_ASSERT (((struct ppc_link_hash_entry *) h)->is_func_descriptor);
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- s = htab->plt;
- if (s->_raw_size == 0)
- s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
-
- pent->plt.offset = s->_raw_size;
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* Make room for the .glink code. */
- s = htab->glink;
- if (s->_raw_size == 0)
- s->_raw_size += GLINK_CALL_STUB_SIZE;
- /* We need bigger stubs past index 32767. */
- if (s->_raw_size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
- s->_raw_size += 4;
- s->_raw_size += 2*4;
-
- /* We also need to make an entry in the .rela.plt section. */
- s = htab->relplt;
- s->_raw_size += sizeof (Elf64_External_Rela);
- doneone = TRUE;
- }
- else
- pent->plt.offset = (bfd_vma) -1;
- if (!doneone)
- {
- h->plt.plist = NULL;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- else
- {
- h->plt.plist = NULL;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- eh = (struct ppc_link_hash_entry *) h;
- /* Run through the TLS GD got entries first if we're changing them
- to TPREL. */
- if ((eh->tls_mask & TLS_TPRELGD) != 0)
- for (gent = h->got.glist; gent != NULL; gent = gent->next)
- if (gent->got.refcount > 0
- && (gent->tls_type & TLS_GD) != 0)
- {
- /* This was a GD entry that has been converted to TPREL. If
- there happens to be a TPREL entry we can use that one. */
- struct got_entry *ent;
- for (ent = h->got.glist; ent != NULL; ent = ent->next)
- if (ent->got.refcount > 0
- && (ent->tls_type & TLS_TPREL) != 0
- && ent->addend == gent->addend
- && ent->owner == gent->owner)
- {
- gent->got.refcount = 0;
- break;
- }
-
- /* If not, then we'll be using our own TPREL entry. */
- if (gent->got.refcount != 0)
- gent->tls_type = TLS_TLS | TLS_TPREL;
- }
-
- for (gent = h->got.glist; gent != NULL; gent = gent->next)
- if (gent->got.refcount > 0)
- {
- bfd_boolean dyn;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic,
- nor will all TLS symbols. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if ((gent->tls_type & TLS_LD) != 0
- && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
- {
- gent->got.offset = ppc64_tlsld_got (gent->owner)->offset;
- continue;
- }
-
- s = ppc64_elf_tdata (gent->owner)->got;
- gent->got.offset = s->_raw_size;
- s->_raw_size
- += (gent->tls_type & eh->tls_mask & (TLS_GD | TLS_LD)) ? 16 : 8;
- dyn = htab->elf.dynamic_sections_created;
- if ((info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
- ppc64_elf_tdata (gent->owner)->relgot->_raw_size
- += (gent->tls_type & eh->tls_mask & TLS_GD
- ? 2 * sizeof (Elf64_External_Rela)
- : sizeof (Elf64_External_Rela));
- }
- else
- gent->got.offset = (bfd_vma) -1;
-
- if (eh->dyn_relocs == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for relocs that have become local due to symbol visibility
- changes. */
-
- if (info->shared)
- {
- /* Relocs that use pc_count are those that appear on a call insn,
- or certain REL relocs (see MUST_BE_DYN_RELOC) that can be
- generated via assembly. We want calls to protected symbols to
- resolve directly to the function rather than going via the plt.
- If people want function pointer comparisons to work as expected
- then they should avoid writing weird assembly. */
- if (SYMBOL_CALLS_LOCAL (info, h))
- {
- struct ppc_dyn_relocs **pp;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
- {
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
- else
- pp = &p->next;
- }
- }
-
- /* Also discard relocs on undefined weak syms with non-default
- visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
- }
- else if (ELIMINATE_COPY_RELOCS)
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->dyn_relocs = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela);
- }
-
- return TRUE;
-}
-
-/* Find any dynamic relocs that apply to read-only sections. */
-
-static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
-{
- struct ppc_link_hash_entry *eh;
- struct ppc_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- eh = (struct ppc_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
-
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- {
- struct bfd_link_info *info = inf;
-
- info->flags |= DF_TEXTREL;
-
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
- bfd *dynobj;
- asection *s;
- bfd_boolean relocs;
- bfd *ibfd;
-
- htab = ppc_hash_table (info);
- dynobj = htab->elf.dynobj;
- if (dynobj == NULL)
- abort ();
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- if (s == NULL)
- abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- struct got_entry **lgot_ents;
- struct got_entry **end_lgot_ents;
- char *lgot_masks;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srel;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- if (ppc64_tlsld_got (ibfd)->refcount > 0)
- {
- s = ppc64_elf_tdata (ibfd)->got;
- ppc64_tlsld_got (ibfd)->offset = s->_raw_size;
- s->_raw_size += 16;
- if (info->shared)
- {
- srel = ppc64_elf_tdata (ibfd)->relgot;
- srel->_raw_size += sizeof (Elf64_External_Rela);
- }
- }
- else
- ppc64_tlsld_got (ibfd)->offset = (bfd_vma) -1;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct ppc_dyn_relocs *p;
-
- for (p = *((struct ppc_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- srel = elf_section_data (p->sec)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf64_External_Rela);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- lgot_ents = elf_local_got_ents (ibfd);
- if (!lgot_ents)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_lgot_ents = lgot_ents + locsymcount;
- lgot_masks = (char *) end_lgot_ents;
- s = ppc64_elf_tdata (ibfd)->got;
- srel = ppc64_elf_tdata (ibfd)->relgot;
- for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_masks)
- {
- struct got_entry *ent;
-
- for (ent = *lgot_ents; ent != NULL; ent = ent->next)
- if (ent->got.refcount > 0)
- {
- if ((ent->tls_type & *lgot_masks & TLS_LD) != 0)
- {
- if (ppc64_tlsld_got (ibfd)->offset == (bfd_vma) -1)
- {
- ppc64_tlsld_got (ibfd)->offset = s->_raw_size;
- s->_raw_size += 16;
- if (info->shared)
- srel->_raw_size += sizeof (Elf64_External_Rela);
- }
- ent->got.offset = ppc64_tlsld_got (ibfd)->offset;
- }
- else
- {
- ent->got.offset = s->_raw_size;
- if ((ent->tls_type & *lgot_masks & TLS_GD) != 0)
- {
- s->_raw_size += 16;
- if (info->shared)
- srel->_raw_size += 2 * sizeof (Elf64_External_Rela);
- }
- else
- {
- s->_raw_size += 8;
- if (info->shared)
- srel->_raw_size += sizeof (Elf64_External_Rela);
- }
- }
- }
- else
- ent->got.offset = (bfd_vma) -1;
- }
- }
-
- /* Allocate global sym .plt and .got entries, and space for global
- sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info);
-
- /* We now have determined the sizes of the various dynamic sections.
- Allocate memory for them. */
- relocs = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- /* Reset _cooked_size since prelim layout will set it wrongly,
- and a non-zero _cooked_size sticks. */
- s->_cooked_size = 0;
-
- if (s == htab->brlt || s == htab->relbrlt)
- /* These haven't been allocated yet; don't strip. */
- continue;
- else if (s == htab->got
- || s == htab->plt
- || s == htab->glink)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- }
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
- {
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is mostly to handle .rela.bss and
- .rela.plt. We must create both sections in
- create_dynamic_sections, because they must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
- }
- else
- {
- if (s != htab->relplt)
- relocs = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- }
- else
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (s->_raw_size == 0)
- {
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* .plt is in the bss section. We don't initialise it. */
- if (s == htab->plt)
- continue;
-
- /* Allocate memory for the section contents. We use bfd_zalloc
- here in case unused entries are not reclaimed before the
- section's contents are written out. This should not happen,
- but this way if it does we get a R_PPC64_NONE reloc in .rela
- sections instead of garbage.
- We also rely on the section contents being zero when writing
- the GOT. */
- s->contents = bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- s = ppc64_elf_tdata (ibfd)->got;
- if (s != NULL && s != htab->got)
- {
- s->_cooked_size = 0;
- if (s->_raw_size == 0)
- _bfd_strip_section_from_output (info, s);
- else
- {
- s->contents = bfd_zalloc (ibfd, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
- }
- s = ppc64_elf_tdata (ibfd)->relgot;
- if (s != NULL)
- {
- s->_cooked_size = 0;
- if (s->_raw_size == 0)
- _bfd_strip_section_from_output (info, s);
- else
- {
- s->contents = bfd_zalloc (ibfd, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- relocs = TRUE;
- s->reloc_count = 0;
- }
- }
- }
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in ppc64_elf_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->plt != NULL && htab->plt->_raw_size != 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)
- || !add_dynamic_entry (DT_PPC64_GLINK, 0))
- return FALSE;
- }
-
- if (NO_OPD_RELOCS)
- {
- if (!add_dynamic_entry (DT_PPC64_OPD, 0)
- || !add_dynamic_entry (DT_PPC64_OPDSZ, 0))
- return FALSE;
- }
-
- if (relocs)
- {
- 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 any dynamic relocs apply to a read-only section,
- then we need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, info);
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-/* Determine the type of stub needed, if any, for a call. */
-
-static inline enum ppc_stub_type
-ppc_type_of_stub (asection *input_sec,
- const Elf_Internal_Rela *rel,
- struct ppc_link_hash_entry **hash,
- bfd_vma destination)
-{
- struct ppc_link_hash_entry *h = *hash;
- bfd_vma location;
- bfd_vma branch_offset;
- bfd_vma max_branch_offset;
- enum elf_ppc64_reloc_type r_type;
-
- if (h != NULL)
- {
- if (h->oh != NULL
- && h->oh->dynindx != -1)
- {
- struct plt_entry *ent;
- for (ent = h->oh->plt.plist; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
- && ent->plt.offset != (bfd_vma) -1)
- {
- *hash = (struct ppc_link_hash_entry *) h->oh;
- return ppc_stub_plt_call;
- }
- }
-
- if (!(h->elf.root.type == bfd_link_hash_defined
- || h->elf.root.type == bfd_link_hash_defweak)
- || h->elf.root.u.def.section->output_section == NULL)
- return ppc_stub_none;
- }
-
- /* Determine where the call point is. */
- location = (input_sec->output_offset
- + input_sec->output_section->vma
- + rel->r_offset);
-
- branch_offset = destination - location;
- r_type = ELF64_R_TYPE (rel->r_info);
-
- /* Determine if a long branch stub is needed. */
- max_branch_offset = 1 << 25;
- if (r_type != R_PPC64_REL24)
- max_branch_offset = 1 << 15;
-
- if (branch_offset + max_branch_offset >= 2 * max_branch_offset)
- /* We need a stub. Figure out whether a long_branch or plt_branch
- is needed later. */
- return ppc_stub_long_branch;
-
- return ppc_stub_none;
-}
-
-/* Build a .plt call stub. */
-
-static inline bfd_byte *
-build_plt_stub (bfd *obfd, bfd_byte *p, int offset)
-{
-#define PPC_LO(v) ((v) & 0xffff)
-#define PPC_HI(v) (((v) >> 16) & 0xffff)
-#define PPC_HA(v) PPC_HI ((v) + 0x8000)
-
- bfd_put_32 (obfd, ADDIS_R12_R2 | PPC_HA (offset), p), p += 4;
- bfd_put_32 (obfd, STD_R2_40R1, p), p += 4;
- bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4;
- if (PPC_HA (offset + 8) != PPC_HA (offset))
- bfd_put_32 (obfd, ADDIS_R12_R12 | 1, p), p += 4;
- offset += 8;
- bfd_put_32 (obfd, LD_R2_0R12 | PPC_LO (offset), p), p += 4;
- if (PPC_HA (offset + 8) != PPC_HA (offset))
- bfd_put_32 (obfd, ADDIS_R12_R12 | 1, p), p += 4;
- offset += 8;
- bfd_put_32 (obfd, MTCTR_R11, p), p += 4;
- bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4;
- bfd_put_32 (obfd, BCTR, p), p += 4;
- return p;
-}
-
-static bfd_boolean
-ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
-{
- struct ppc_stub_hash_entry *stub_entry;
- struct ppc_branch_hash_entry *br_entry;
- struct bfd_link_info *info;
- struct ppc_link_hash_table *htab;
- bfd_byte *loc;
- bfd_byte *p;
- unsigned int indx;
- struct plt_entry *ent;
- bfd_vma off;
- int size;
-
- /* Massage our args to the form they really have. */
- stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
- info = in_arg;
-
- htab = ppc_hash_table (info);
-
- /* Make a note of the offset within the stubs for this entry. */
- stub_entry->stub_offset = stub_entry->stub_sec->_cooked_size;
- loc = stub_entry->stub_sec->contents + stub_entry->stub_offset;
-
- htab->stub_count[stub_entry->stub_type - 1] += 1;
- switch (stub_entry->stub_type)
- {
- case ppc_stub_long_branch:
- case ppc_stub_long_branch_r2off:
- /* Branches are relative. This is where we are going to. */
- off = (stub_entry->target_value
- + stub_entry->target_section->output_offset
- + stub_entry->target_section->output_section->vma);
-
- /* And this is where we are coming from. */
- off -= (stub_entry->stub_offset
- + stub_entry->stub_sec->output_offset
- + stub_entry->stub_sec->output_section->vma);
-
- if (stub_entry->stub_type != ppc_stub_long_branch_r2off)
- size = 4;
- else
- {
- bfd_vma r2off;
-
- r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
- - htab->stub_group[stub_entry->id_sec->id].toc_off);
- bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
- loc += 4;
- off -= 12;
- size = 16;
- }
- bfd_put_32 (htab->stub_bfd, B_DOT | (off & 0x3fffffc), loc);
-
- BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26));
- break;
-
- case ppc_stub_plt_branch:
- case ppc_stub_plt_branch_r2off:
- br_entry = ppc_branch_hash_lookup (&htab->branch_hash_table,
- stub_entry->root.string + 9,
- FALSE, FALSE);
- if (br_entry == NULL)
- {
- (*_bfd_error_handler) (_("can't find branch stub `%s'"),
- stub_entry->root.string + 9);
- htab->stub_error = TRUE;
- return FALSE;
- }
-
- off = (stub_entry->target_value
- + stub_entry->target_section->output_offset
- + stub_entry->target_section->output_section->vma);
-
- bfd_put_64 (htab->brlt->owner, off,
- htab->brlt->contents + br_entry->offset);
-
- if (info->shared)
- {
- /* Create a reloc for the branch lookup table entry. */
- Elf_Internal_Rela rela;
- bfd_byte *rl;
-
- rela.r_offset = (br_entry->offset
- + htab->brlt->output_offset
- + htab->brlt->output_section->vma);
- rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
- rela.r_addend = off;
-
- rl = htab->relbrlt->contents;
- rl += htab->relbrlt->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (htab->relbrlt->owner, &rela, rl);
- }
-
- off = (br_entry->offset
- + htab->brlt->output_offset
- + htab->brlt->output_section->vma
- - elf_gp (htab->brlt->output_section->owner)
- - htab->stub_group[stub_entry->id_sec->id].toc_off);
-
- if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
- {
- (*_bfd_error_handler)
- (_("linkage table error against `%s'"),
- stub_entry->root.string);
- bfd_set_error (bfd_error_bad_value);
- htab->stub_error = TRUE;
- return FALSE;
- }
-
- indx = off;
- if (stub_entry->stub_type != ppc_stub_plt_branch_r2off)
- {
- bfd_put_32 (htab->stub_bfd, ADDIS_R12_R2 | PPC_HA (indx), loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, LD_R11_0R12 | PPC_LO (indx), loc);
- size = 16;
- }
- else
- {
- bfd_vma r2off;
-
- r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
- - htab->stub_group[stub_entry->id_sec->id].toc_off);
- bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, ADDIS_R12_R2 | PPC_HA (indx), loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, LD_R11_0R12 | PPC_LO (indx), loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
- size = 28;
- }
- loc += 4;
- bfd_put_32 (htab->stub_bfd, MTCTR_R11, loc);
- loc += 4;
- bfd_put_32 (htab->stub_bfd, BCTR, loc);
- break;
-
- case ppc_stub_plt_call:
- /* Do the best we can for shared libraries built without
- exporting ".foo" for each "foo". This can happen when symbol
- versioning scripts strip all bar a subset of symbols. */
- if (stub_entry->h->oh->root.type != bfd_link_hash_defined
- && stub_entry->h->oh->root.type != bfd_link_hash_defweak)
- {
- /* Point the symbol at the stub. There may be multiple stubs,
- we don't really care; The main thing is to make this sym
- defined somewhere. Maybe defining the symbol in the stub
- section is a silly idea. If we didn't do this, htab->top_id
- could disappear. */
- stub_entry->h->oh->root.type = bfd_link_hash_defined;
- stub_entry->h->oh->root.u.def.section = stub_entry->stub_sec;
- stub_entry->h->oh->root.u.def.value = stub_entry->stub_offset;
- }
-
- /* Now build the stub. */
- off = (bfd_vma) -1;
- for (ent = stub_entry->h->elf.plt.plist; ent != NULL; ent = ent->next)
- if (ent->addend == stub_entry->addend)
- {
- off = ent->plt.offset;
- break;
- }
- if (off >= (bfd_vma) -2)
- abort ();
-
- off &= ~ (bfd_vma) 1;
- off += (htab->plt->output_offset
- + htab->plt->output_section->vma
- - elf_gp (htab->plt->output_section->owner)
- - htab->stub_group[stub_entry->id_sec->id].toc_off);
-
- if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
- {
- (*_bfd_error_handler)
- (_("linkage table error against `%s'"),
- stub_entry->h->elf.root.root.string);
- bfd_set_error (bfd_error_bad_value);
- htab->stub_error = TRUE;
- return FALSE;
- }
-
- p = build_plt_stub (htab->stub_bfd, loc, off);
- size = p - loc;
- break;
-
- default:
- BFD_FAIL ();
- return FALSE;
- }
-
- stub_entry->stub_sec->_cooked_size += size;
-
- if (htab->emit_stub_syms
- && !(stub_entry->stub_type == ppc_stub_plt_call
- && stub_entry->h->oh->root.type == bfd_link_hash_defined
- && stub_entry->h->oh->root.u.def.section == stub_entry->stub_sec
- && stub_entry->h->oh->root.u.def.value == stub_entry->stub_offset))
- {
- struct elf_link_hash_entry *h;
- h = elf_link_hash_lookup (&htab->elf, stub_entry->root.string,
- TRUE, FALSE, FALSE);
- if (h == NULL)
- return FALSE;
- if (h->root.type == bfd_link_hash_new)
- {
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = stub_entry->stub_sec;
- h->root.u.def.value = stub_entry->stub_offset;
- h->elf_link_hash_flags = (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_FORCED_LOCAL);
- }
- }
-
- return TRUE;
-}
-
-/* As above, but don't actually build the stub. Just bump offset so
- we know stub section sizes, and select plt_branch stubs where
- long_branch stubs won't do. */
-
-static bfd_boolean
-ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
-{
- struct ppc_stub_hash_entry *stub_entry;
- struct bfd_link_info *info;
- struct ppc_link_hash_table *htab;
- bfd_vma off;
- int size;
-
- /* Massage our args to the form they really have. */
- stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
- info = in_arg;
-
- htab = ppc_hash_table (info);
-
- if (stub_entry->stub_type == ppc_stub_plt_call)
- {
- struct plt_entry *ent;
- off = (bfd_vma) -1;
- for (ent = stub_entry->h->elf.plt.plist; ent != NULL; ent = ent->next)
- if (ent->addend == stub_entry->addend)
- {
- off = ent->plt.offset & ~(bfd_vma) 1;
- break;
- }
- if (off >= (bfd_vma) -2)
- abort ();
- off += (htab->plt->output_offset
- + htab->plt->output_section->vma
- - elf_gp (htab->plt->output_section->owner)
- - htab->stub_group[stub_entry->id_sec->id].toc_off);
-
- size = PLT_CALL_STUB_SIZE;
- if (PPC_HA (off + 16) != PPC_HA (off))
- size += 4;
- }
- else
- {
- /* ppc_stub_long_branch or ppc_stub_plt_branch, or their r2off
- variants. */
- off = (stub_entry->target_value
- + stub_entry->target_section->output_offset
- + stub_entry->target_section->output_section->vma);
- off -= (stub_entry->stub_sec->_raw_size
- + stub_entry->stub_sec->output_offset
- + stub_entry->stub_sec->output_section->vma);
-
- /* Reset the stub type from the plt variant in case we now
- can reach with a shorter stub. */
- if (stub_entry->stub_type >= ppc_stub_plt_branch)
- stub_entry->stub_type += ppc_stub_long_branch - ppc_stub_plt_branch;
-
- size = 4;
- if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
- {
- off -= 12;
- size = 16;
- }
-
- /* If the branch offset if too big, use a ppc_stub_plt_branch. */
- if (off + (1 << 25) >= (bfd_vma) (1 << 26))
- {
- struct ppc_branch_hash_entry *br_entry;
-
- br_entry = ppc_branch_hash_lookup (&htab->branch_hash_table,
- stub_entry->root.string + 9,
- TRUE, FALSE);
- if (br_entry == NULL)
- {
- (*_bfd_error_handler) (_("can't build branch stub `%s'"),
- stub_entry->root.string + 9);
- htab->stub_error = TRUE;
- return FALSE;
- }
-
- if (br_entry->iter != htab->stub_iteration)
- {
- br_entry->iter = htab->stub_iteration;
- br_entry->offset = htab->brlt->_raw_size;
- htab->brlt->_raw_size += 8;
-
- if (info->shared)
- htab->relbrlt->_raw_size += sizeof (Elf64_External_Rela);
- }
-
- stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch;
- size = 16;
- if (stub_entry->stub_type != ppc_stub_plt_branch)
- size = 28;
- }
- }
-
- stub_entry->stub_sec->_raw_size += size;
- return TRUE;
-}
-
-/* Set up various things so that we can make a list of input sections
- for each output section included in the link. Returns -1 on error,
- 0 when no stubs will be needed, and 1 on success. */
-
-int
-ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
-{
- bfd *input_bfd;
- int top_id, top_index, id;
- asection *section;
- asection **input_list;
- bfd_size_type amt;
- struct ppc_link_hash_table *htab = ppc_hash_table (info);
-
- if (htab->brlt == NULL)
- return 0;
-
- /* Find the top input section id. */
- for (input_bfd = info->input_bfds, top_id = 3;
- input_bfd != NULL;
- input_bfd = input_bfd->link_next)
- {
- for (section = input_bfd->sections;
- section != NULL;
- section = section->next)
- {
- if (top_id < section->id)
- top_id = section->id;
- }
- }
-
- htab->top_id = top_id;
- amt = sizeof (struct map_stub) * (top_id + 1);
- htab->stub_group = bfd_zmalloc (amt);
- if (htab->stub_group == NULL)
- return -1;
-
- /* Set toc_off for com, und, abs and ind sections. */
- for (id = 0; id < 3; id++)
- htab->stub_group[id].toc_off = TOC_BASE_OFF;
-
- elf_gp (output_bfd) = htab->toc_curr = ppc64_elf_toc (output_bfd);
-
- /* We can't use output_bfd->section_count here to find the top output
- section index as some sections may have been removed, and
- _bfd_strip_section_from_output doesn't renumber the indices. */
- for (section = output_bfd->sections, top_index = 0;
- section != NULL;
- section = section->next)
- {
- if (top_index < section->index)
- top_index = section->index;
- }
-
- htab->top_index = top_index;
- amt = sizeof (asection *) * (top_index + 1);
- input_list = bfd_zmalloc (amt);
- htab->input_list = input_list;
- if (input_list == NULL)
- return -1;
-
- return 1;
-}
-
-/* The linker repeatedly calls this function for each TOC input section
- and linker generated GOT section. Group input bfds such that the toc
- within a group is less than 64k in size. Will break with cute linker
- scripts that play games with dot in the output toc section. */
-
-void
-ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec)
-{
- struct ppc_link_hash_table *htab = ppc_hash_table (info);
-
- if (!htab->no_multi_toc)
- {
- bfd_vma addr = isec->output_offset + isec->output_section->vma;
- bfd_vma off = addr - htab->toc_curr;
- if (off + isec->_raw_size > 0x10000)
- {
- htab->toc_curr = addr;
- htab->multi_toc_needed = 1;
- }
- elf_gp (isec->owner) = (htab->toc_curr
- - elf_gp (isec->output_section->owner)
- + TOC_BASE_OFF);
- }
-}
-
-/* Called after the last call to the above function. */
-
-void
-ppc64_elf_reinit_toc (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab = ppc_hash_table (info);
-
- /* toc_curr tracks the TOC offset used for code sections below in
- ppc64_elf_next_input_section. Start off at 0x8000. */
- htab->toc_curr = TOC_BASE_OFF;
-}
-
-/* No toc references were found in ISEC. If the code in ISEC makes no
- calls, then there's no need to use toc adjusting stubs when branching
- into ISEC. Actually, indirect calls from ISEC are OK as they will
- load r2. */
-
-static int
-toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec)
-{
- bfd_byte *contents;
- bfd_size_type i;
- int ret;
- int branch_ok;
-
- /* We know none of our code bearing sections will need toc stubs. */
- if ((isec->flags & SEC_LINKER_CREATED) != 0)
- return 0;
-
- if (isec->_raw_size == 0)
- return 0;
-
- /* Hack for linux kernel. .fixup contains branches, but only back to
- the function that hit an exception. */
- branch_ok = strcmp (isec->name, ".fixup") == 0;
-
- contents = elf_section_data (isec)->this_hdr.contents;
- if (contents == NULL)
- {
- contents = bfd_malloc (isec->_raw_size);
- if (contents == NULL)
- return -1;
- if (! bfd_get_section_contents (isec->owner, isec, contents,
- 0, isec->_raw_size))
- {
- free (contents);
- return -1;
- }
- if (info->keep_memory)
- elf_section_data (isec)->this_hdr.contents = contents;
- }
-
- /* Code scan, because we don't necessarily have relocs on calls to
- static functions. */
- ret = 0;
- for (i = 0; i < isec->_raw_size; i += 4)
- {
- unsigned long insn = bfd_get_32 (isec->owner, contents + i);
- /* Is this a branch? */
- if ((insn & (0x3f << 26)) == (18 << 26)
- /* If branch and link, it's a function call. */
- && ((insn & 1) != 0
- /* Sibling calls use a plain branch. I don't know a way
- of deciding whether a branch is really a sibling call. */
- || !branch_ok))
- {
- ret = 1;
- break;
- }
- }
-
- if (elf_section_data (isec)->this_hdr.contents != contents)
- free (contents);
- return ret;
-}
-
-/* The linker repeatedly calls this function for each input section,
- in the order that input sections are linked into output sections.
- Build lists of input sections to determine groupings between which
- we may insert linker stubs. */
-
-bfd_boolean
-ppc64_elf_next_input_section (struct bfd_link_info *info, asection *isec)
-{
- struct ppc_link_hash_table *htab = ppc_hash_table (info);
- int ret;
-
- if ((isec->output_section->flags & SEC_CODE) != 0
- && isec->output_section->index <= htab->top_index)
- {
- asection **list = htab->input_list + isec->output_section->index;
- /* Steal the link_sec pointer for our list. */
-#define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec)
- /* This happens to make the list in reverse order,
- which is what we want. */
- PREV_SEC (isec) = *list;
- *list = isec;
- }
-
- /* If a code section has a function that uses the TOC then we need
- to use the right TOC (obviously). Also, make sure that .opd gets
- the correct TOC value for R_PPC64_TOC relocs that don't have or
- can't find their function symbol (shouldn't ever happen now). */
- if (isec->has_gp_reloc || (isec->flags & SEC_CODE) == 0)
- {
- if (elf_gp (isec->owner) != 0)
- htab->toc_curr = elf_gp (isec->owner);
- }
- else if ((ret = toc_adjusting_stub_needed (info, isec)) < 0)
- return FALSE;
- else
- isec->has_gp_reloc = ret;
-
- /* Functions that don't use the TOC can belong in any TOC group.
- Use the last TOC base. This happens to make _init and _fini
- pasting work. */
- htab->stub_group[isec->id].toc_off = htab->toc_curr;
- return TRUE;
-}
-
-/* See whether we can group stub sections together. Grouping stub
- sections may result in fewer stubs. More importantly, we need to
- put all .init* and .fini* stubs at the beginning of the .init or
- .fini output sections respectively, because glibc splits the
- _init and _fini functions into multiple parts. Putting a stub in
- the middle of a function is not a good idea. */
-
-static void
-group_sections (struct ppc_link_hash_table *htab,
- bfd_size_type stub_group_size,
- bfd_boolean stubs_always_before_branch)
-{
- asection **list = htab->input_list + htab->top_index;
- do
- {
- asection *tail = *list;
- while (tail != NULL)
- {
- asection *curr;
- asection *prev;
- bfd_size_type total;
- bfd_boolean big_sec;
- bfd_vma curr_toc;
-
- curr = tail;
- if (tail->_cooked_size)
- total = tail->_cooked_size;
- else
- total = tail->_raw_size;
- big_sec = total >= stub_group_size;
- curr_toc = htab->stub_group[tail->id].toc_off;
-
- while ((prev = PREV_SEC (curr)) != NULL
- && ((total += curr->output_offset - prev->output_offset)
- < stub_group_size)
- && htab->stub_group[prev->id].toc_off == curr_toc)
- curr = prev;
-
- /* OK, the size from the start of CURR to the end is less
- than stub_group_size and thus can be handled by one stub
- section. (or the tail section is itself larger than
- stub_group_size, in which case we may be toast.) We
- should really be keeping track of the total size of stubs
- added here, as stubs contribute to the final output
- section size. That's a little tricky, and this way will
- only break if stubs added make the total size more than
- 2^25, ie. for the default stub_group_size, if stubs total
- more than 2097152 bytes, or nearly 75000 plt call stubs. */
- do
- {
- prev = PREV_SEC (tail);
- /* Set up this stub group. */
- htab->stub_group[tail->id].link_sec = curr;
- }
- while (tail != curr && (tail = prev) != NULL);
-
- /* But wait, there's more! Input sections up to stub_group_size
- bytes before the stub section can be handled by it too.
- Don't do this if we have a really large section after the
- stubs, as adding more stubs increases the chance that
- branches may not reach into the stub section. */
- if (!stubs_always_before_branch && !big_sec)
- {
- total = 0;
- while (prev != NULL
- && ((total += tail->output_offset - prev->output_offset)
- < stub_group_size)
- && htab->stub_group[prev->id].toc_off == curr_toc)
- {
- tail = prev;
- prev = PREV_SEC (tail);
- htab->stub_group[tail->id].link_sec = curr;
- }
- }
- tail = prev;
- }
- }
- while (list-- != htab->input_list);
- free (htab->input_list);
-#undef PREV_SEC
-}
-
-/* Determine and set the size of the stub section for a final link.
-
- The basic idea here is to examine all the relocations looking for
- PC-relative calls to a target that is unreachable with a "bl"
- instruction. */
-
-bfd_boolean
-ppc64_elf_size_stubs (bfd *output_bfd,
- struct bfd_link_info *info,
- bfd_signed_vma group_size,
- asection *(*add_stub_section) (const char *, asection *),
- void (*layout_sections_again) (void))
-{
- bfd_size_type stub_group_size;
- bfd_boolean stubs_always_before_branch;
- struct ppc_link_hash_table *htab = ppc_hash_table (info);
-
- /* Stash our params away. */
- htab->add_stub_section = add_stub_section;
- htab->layout_sections_again = layout_sections_again;
- stubs_always_before_branch = group_size < 0;
- if (group_size < 0)
- stub_group_size = -group_size;
- else
- stub_group_size = group_size;
- if (stub_group_size == 1)
- {
- /* Default values. */
- if (stubs_always_before_branch)
- {
- stub_group_size = 0x1e00000;
- if (htab->has_14bit_branch)
- stub_group_size = 0x7800;
- }
- else
- {
- stub_group_size = 0x1c00000;
- if (htab->has_14bit_branch)
- stub_group_size = 0x7000;
- }
- }
-
- group_sections (htab, stub_group_size, stubs_always_before_branch);
-
- while (1)
- {
- bfd *input_bfd;
- unsigned int bfd_indx;
- asection *stub_sec;
- bfd_boolean stub_changed;
-
- htab->stub_iteration += 1;
- stub_changed = FALSE;
-
- for (input_bfd = info->input_bfds, bfd_indx = 0;
- input_bfd != NULL;
- input_bfd = input_bfd->link_next, bfd_indx++)
- {
- Elf_Internal_Shdr *symtab_hdr;
- asection *section;
- Elf_Internal_Sym *local_syms = NULL;
-
- /* We'll need the symbol table in a second. */
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- if (symtab_hdr->sh_info == 0)
- continue;
-
- /* Walk over each section attached to the input bfd. */
- for (section = input_bfd->sections;
- section != NULL;
- section = section->next)
- {
- Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
-
- /* If there aren't any relocs, then there's nothing more
- to do. */
- if ((section->flags & SEC_RELOC) == 0
- || section->reloc_count == 0)
- continue;
-
- /* If this section is a link-once section that will be
- discarded, then don't create any stubs. */
- if (section->output_section == NULL
- || section->output_section->owner != output_bfd)
- continue;
-
- /* Get the relocs. */
- internal_relocs
- = _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL,
- info->keep_memory);
- if (internal_relocs == NULL)
- goto error_ret_free_local;
-
- /* Now examine each relocation. */
- irela = internal_relocs;
- irelaend = irela + section->reloc_count;
- for (; irela < irelaend; irela++)
- {
- enum elf_ppc64_reloc_type r_type;
- unsigned int r_indx;
- enum ppc_stub_type stub_type;
- struct ppc_stub_hash_entry *stub_entry;
- asection *sym_sec;
- bfd_vma sym_value;
- bfd_vma destination;
- struct ppc_link_hash_entry *hash;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- char *stub_name;
- const asection *id_sec;
-
- r_type = ELF64_R_TYPE (irela->r_info);
- r_indx = ELF64_R_SYM (irela->r_info);
-
- if (r_type >= R_PPC64_max)
- {
- bfd_set_error (bfd_error_bad_value);
- goto error_ret_free_internal;
- }
-
- /* Only look for stubs on branch instructions. */
- if (r_type != R_PPC64_REL24
- && r_type != R_PPC64_REL14
- && r_type != R_PPC64_REL14_BRTAKEN
- && r_type != R_PPC64_REL14_BRNTAKEN)
- continue;
-
- /* Now determine the call target, its name, value,
- section. */
- destination = 0;
- if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
- r_indx, input_bfd))
- goto error_ret_free_internal;
- hash = (struct ppc_link_hash_entry *) h;
-
- if (hash == NULL)
- {
- /* It's a local symbol. */
- sym_value = sym->st_value;
- destination = (sym_value + irela->r_addend
- + sym_sec->output_offset
- + sym_sec->output_section->vma);
- }
- else
- {
- /* It's an external symbol. */
- sym_value = 0;
- if (hash->elf.root.type == bfd_link_hash_defined
- || hash->elf.root.type == bfd_link_hash_defweak)
- {
- sym_value = hash->elf.root.u.def.value;
- if (sym_sec->output_section != NULL)
- destination = (sym_value + irela->r_addend
- + sym_sec->output_offset
- + sym_sec->output_section->vma);
- }
- else if (hash->elf.root.type == bfd_link_hash_undefweak)
- ;
- else if (hash->elf.root.type == bfd_link_hash_undefined)
- ;
- else
- {
- bfd_set_error (bfd_error_bad_value);
- goto error_ret_free_internal;
- }
- }
-
- /* Determine what (if any) linker stub is needed. */
- stub_type = ppc_type_of_stub (section, irela, &hash,
- destination);
-
- if (stub_type != ppc_stub_plt_call)
- {
- /* Check whether we need a TOC adjusting stub.
- Since the linker pastes together pieces from
- different object files when creating the
- _init and _fini functions, it may be that a
- call to what looks like a local sym is in
- fact a call needing a TOC adjustment. */
- if (sym_sec != NULL
- && sym_sec->output_section != NULL
- && (htab->stub_group[sym_sec->id].toc_off
- != htab->stub_group[section->id].toc_off)
- && sym_sec->has_gp_reloc
- && section->has_gp_reloc)
- stub_type = ppc_stub_long_branch_r2off;
- }
-
- if (stub_type == ppc_stub_none)
- continue;
-
- /* __tls_get_addr calls might be eliminated. */
- if (stub_type != ppc_stub_plt_call
- && hash != NULL
- && &hash->elf == htab->tls_get_addr
- && section->has_tls_reloc
- && irela != internal_relocs)
- {
- /* Get tls info. */
- char *tls_mask;
-
- if (!get_tls_mask (&tls_mask, NULL, &local_syms,
- irela - 1, input_bfd))
- goto error_ret_free_internal;
- if (*tls_mask != 0)
- continue;
- }
-
- /* Support for grouping stub sections. */
- id_sec = htab->stub_group[section->id].link_sec;
-
- /* Get the name of this stub. */
- stub_name = ppc_stub_name (id_sec, sym_sec, hash, irela);
- if (!stub_name)
- goto error_ret_free_internal;
-
- stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table,
- stub_name, FALSE, FALSE);
- if (stub_entry != NULL)
- {
- /* The proper stub has already been created. */
- free (stub_name);
- continue;
- }
-
- stub_entry = ppc_add_stub (stub_name, section, htab);
- if (stub_entry == NULL)
- {
- free (stub_name);
- error_ret_free_internal:
- if (elf_section_data (section)->relocs == NULL)
- free (internal_relocs);
- error_ret_free_local:
- if (local_syms != NULL
- && (symtab_hdr->contents
- != (unsigned char *) local_syms))
- free (local_syms);
- return FALSE;
- }
-
- stub_entry->stub_type = stub_type;
- stub_entry->target_value = sym_value;
- stub_entry->target_section = sym_sec;
- stub_entry->h = hash;
- stub_entry->addend = irela->r_addend;
- stub_changed = TRUE;
- }
-
- /* We're done with the internal relocs, free them. */
- if (elf_section_data (section)->relocs != internal_relocs)
- free (internal_relocs);
- }
-
- if (local_syms != NULL
- && symtab_hdr->contents != (unsigned char *) local_syms)
- {
- if (!info->keep_memory)
- free (local_syms);
- else
- symtab_hdr->contents = (unsigned char *) local_syms;
- }
- }
-
- if (!stub_changed)
- break;
-
- /* OK, we've added some stubs. Find out the new size of the
- stub sections. */
- for (stub_sec = htab->stub_bfd->sections;
- stub_sec != NULL;
- stub_sec = stub_sec->next)
- if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
- {
- stub_sec->_raw_size = 0;
- stub_sec->_cooked_size = 0;
- }
- htab->brlt->_raw_size = 0;
- htab->brlt->_cooked_size = 0;
- if (info->shared)
- {
- htab->relbrlt->_raw_size = 0;
- htab->relbrlt->_cooked_size = 0;
- }
-
- bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, info);
-
- /* Ask the linker to do its stuff. */
- (*htab->layout_sections_again) ();
- }
-
- /* It would be nice to strip .branch_lt from the output if the
- section is empty, but it's too late. If we strip sections here,
- the dynamic symbol table is corrupted since the section symbol
- for the stripped section isn't written. */
-
- return TRUE;
-}
-
-/* Called after we have determined section placement. If sections
- move, we'll be called again. Provide a value for TOCstart. */
-
-bfd_vma
-ppc64_elf_toc (bfd *obfd)
-{
- asection *s;
- bfd_vma TOCstart;
-
- /* The TOC consists of sections .got, .toc, .tocbss, .plt in that
- order. The TOC starts where the first of these sections starts. */
- s = bfd_get_section_by_name (obfd, ".got");
- if (s == NULL)
- s = bfd_get_section_by_name (obfd, ".toc");
- if (s == NULL)
- s = bfd_get_section_by_name (obfd, ".tocbss");
- if (s == NULL)
- s = bfd_get_section_by_name (obfd, ".plt");
- if (s == NULL)
- {
- /* This may happen for
- o references to TOC base (SYM@toc / TOC[tc0]) without a
- .toc directive
- o bad linker script
- o --gc-sections and empty TOC sections
-
- FIXME: Warn user? */
-
- /* Look for a likely section. We probably won't even be
- using TOCstart. */
- for (s = obfd->sections; s != NULL; s = s->next)
- if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA | SEC_READONLY))
- == (SEC_ALLOC | SEC_SMALL_DATA))
- break;
- if (s == NULL)
- for (s = obfd->sections; s != NULL; s = s->next)
- if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA))
- == (SEC_ALLOC | SEC_SMALL_DATA))
- break;
- if (s == NULL)
- for (s = obfd->sections; s != NULL; s = s->next)
- if ((s->flags & (SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
- break;
- if (s == NULL)
- for (s = obfd->sections; s != NULL; s = s->next)
- if ((s->flags & SEC_ALLOC) == SEC_ALLOC)
- break;
- }
-
- TOCstart = 0;
- if (s != NULL)
- TOCstart = s->output_section->vma + s->output_offset;
-
- return TOCstart;
-}
-
-/* Build all the stubs associated with the current output file.
- The stubs are kept in a hash table attached to the main linker
- hash table. This function is called via gldelf64ppc_finish. */
-
-bfd_boolean
-ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
- struct bfd_link_info *info,
- char **stats)
-{
- struct ppc_link_hash_table *htab = ppc_hash_table (info);
- asection *stub_sec;
- bfd_byte *p;
- int stub_sec_count = 0;
-
- htab->emit_stub_syms = emit_stub_syms;
- for (stub_sec = htab->stub_bfd->sections;
- stub_sec != NULL;
- stub_sec = stub_sec->next)
- if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
- {
- bfd_size_type size;
-
- /* Allocate memory to hold the linker stubs. */
- size = stub_sec->_raw_size;
- if (size != 0)
- {
- stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
- if (stub_sec->contents == NULL)
- return FALSE;
- }
- stub_sec->_cooked_size = 0;
- }
-
- if (htab->plt != NULL)
- {
- unsigned int indx;
- bfd_vma plt0;
-
- /* Build the .glink plt call stub. */
- plt0 = (htab->plt->output_section->vma
- + htab->plt->output_offset
- - (htab->glink->output_section->vma
- + htab->glink->output_offset
- + GLINK_CALL_STUB_SIZE));
- if (plt0 + 0x80008000 > 0xffffffff)
- {
- (*_bfd_error_handler) (_(".glink and .plt too far apart"));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (htab->emit_stub_syms)
- {
- struct elf_link_hash_entry *h;
- h = elf_link_hash_lookup (&htab->elf, "__glink", TRUE, FALSE, FALSE);
- if (h == NULL)
- return FALSE;
- if (h->root.type == bfd_link_hash_new)
- {
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = htab->glink;
- h->root.u.def.value = 0;
- h->elf_link_hash_flags = (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_FORCED_LOCAL);
- }
- }
- p = htab->glink->contents;
- bfd_put_32 (htab->glink->owner, MFCTR_R12, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SLDI_R11_R0_3, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, ADDIC_R2_R0_32K, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SRADI_R2_R2_63, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SLDI_R11_R0_2, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, AND_R2_R2_R11, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, ADD_R12_R12_R2, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p);
- p += 4;
- bfd_put_32 (htab->glink->owner, LD_R11_0R12 | PPC_LO (plt0), p);
- p += 4;
- bfd_put_32 (htab->glink->owner, ADDI_R12_R12 | PPC_LO (plt0), p);
- p += 4;
- bfd_put_32 (htab->glink->owner, LD_R2_0R12 | 8, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, MTCTR_R11, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, LD_R11_0R12 | 16, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, BCTR, p);
- p += 4;
-
- /* Build the .glink lazy link call stubs. */
- indx = 0;
- while (p < htab->glink->contents + htab->glink->_raw_size)
- {
- if (indx < 0x8000)
- {
- bfd_put_32 (htab->glink->owner, LI_R0_0 | indx, p);
- p += 4;
- }
- else
- {
- bfd_put_32 (htab->glink->owner, LIS_R0_0 | PPC_HI (indx), p);
- p += 4;
- bfd_put_32 (htab->glink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
- p += 4;
- }
- bfd_put_32 (htab->glink->owner,
- B_DOT | ((htab->glink->contents - p) & 0x3fffffc), p);
- indx++;
- p += 4;
- }
- htab->glink->_cooked_size = p - htab->glink->contents;
- }
-
- if (htab->brlt->_raw_size != 0)
- {
- htab->brlt->contents = bfd_zalloc (htab->brlt->owner,
- htab->brlt->_raw_size);
- if (htab->brlt->contents == NULL)
- return FALSE;
- }
- if (info->shared && htab->relbrlt->_raw_size != 0)
- {
- htab->relbrlt->contents = bfd_zalloc (htab->relbrlt->owner,
- htab->relbrlt->_raw_size);
- if (htab->relbrlt->contents == NULL)
- return FALSE;
- }
-
- /* Build the stubs as directed by the stub hash table. */
- bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info);
-
- for (stub_sec = htab->stub_bfd->sections;
- stub_sec != NULL;
- stub_sec = stub_sec->next)
- if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
- {
- stub_sec_count += 1;
- if (stub_sec->_raw_size != stub_sec->_cooked_size)
- break;
- }
-
- if (stub_sec != NULL
- || htab->glink->_raw_size != htab->glink->_cooked_size)
- {
- htab->stub_error = TRUE;
- (*_bfd_error_handler) (_("stubs don't match calculated size"));
- }
-
- if (htab->stub_error)
- return FALSE;
-
- if (stats != NULL)
- {
- *stats = bfd_malloc (500);
- if (*stats == NULL)
- return FALSE;
-
- sprintf (*stats, _("linker stubs in %u groups\n"
- " branch %lu\n"
- " toc adjust %lu\n"
- " long branch %lu\n"
- " long toc adj %lu\n"
- " plt call %lu"),
- stub_sec_count,
- htab->stub_count[ppc_stub_long_branch - 1],
- htab->stub_count[ppc_stub_long_branch_r2off - 1],
- htab->stub_count[ppc_stub_plt_branch - 1],
- htab->stub_count[ppc_stub_plt_branch_r2off - 1],
- htab->stub_count[ppc_stub_plt_call - 1]);
- }
- return TRUE;
-}
-
-/* The RELOCATE_SECTION function is called by the ELF backend linker
- to handle the relocations for a section.
-
- The relocs are always passed as Rela structures; if the section
- actually uses Rel structures, the r_addend field will always be
- zero.
-
- This function is responsible for adjust the section contents as
- necessary, and (if using Rela relocs and generating a
- relocatable output file) adjusting the reloc addend as
- necessary.
-
- This function does not have to worry about setting the reloc
- address or the reloc symbol index.
-
- LOCAL_SYMS is a pointer to the swapped in local symbols.
-
- LOCAL_SECTIONS is an array giving the section in the input file
- corresponding to the st_shndx field of each local symbol.
-
- The global hash table entry for the global symbols can be found
- via elf_sym_hashes (input_bfd).
-
- When generating relocatable output, this function must handle
- STB_LOCAL/STT_SECTION symbols specially. The output symbol is
- going to be the section symbol corresponding to the output
- section, which means that the addend must be adjusted
- accordingly. */
-
-static bfd_boolean
-ppc64_elf_relocate_section (bfd *output_bfd,
- struct bfd_link_info *info,
- bfd *input_bfd,
- asection *input_section,
- bfd_byte *contents,
- Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms,
- asection **local_sections)
-{
- struct ppc_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- struct got_entry **local_got_ents;
- bfd_vma TOCstart;
- bfd_boolean ret = TRUE;
- bfd_boolean is_opd;
- /* Disabled until we sort out how ld should choose 'y' vs 'at'. */
- bfd_boolean is_power4 = FALSE;
-
- if (info->relocatable)
- return TRUE;
-
- /* Initialize howto table if needed. */
- if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
- ppc_howto_init ();
-
- htab = ppc_hash_table (info);
- local_got_ents = elf_local_got_ents (input_bfd);
- TOCstart = elf_gp (output_bfd);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- is_opd = ppc64_elf_section_data (input_section)->opd.adjust != NULL;
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- enum elf_ppc64_reloc_type r_type;
- bfd_vma addend;
- bfd_reloc_status_type r;
- Elf_Internal_Sym *sym;
- asection *sec;
- struct elf_link_hash_entry *h;
- struct elf_link_hash_entry *fdh;
- const char *sym_name;
- unsigned long r_symndx, toc_symndx;
- char tls_mask, tls_gd, tls_type;
- char sym_type;
- bfd_vma relocation;
- bfd_boolean unresolved_reloc;
- bfd_boolean warned;
- unsigned long insn, mask;
- struct ppc_stub_hash_entry *stub_entry;
- bfd_vma max_br_offset;
- bfd_vma from;
-
- r_type = ELF64_R_TYPE (rel->r_info);
- r_symndx = ELF64_R_SYM (rel->r_info);
-
- /* For old style R_PPC64_TOC relocs with a zero symbol, use the
- symbol of the previous ADDR64 reloc. The symbol gives us the
- proper TOC base to use. */
- if (rel->r_info == ELF64_R_INFO (0, R_PPC64_TOC)
- && rel != relocs
- && ELF64_R_TYPE (rel[-1].r_info) == R_PPC64_ADDR64
- && is_opd)
- r_symndx = ELF64_R_SYM (rel[-1].r_info);
-
- sym = NULL;
- sec = NULL;
- h = NULL;
- sym_name = NULL;
- unresolved_reloc = FALSE;
- warned = FALSE;
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- /* It's a local symbol. */
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- sym_name = bfd_elf_local_sym_name (input_bfd, sym);
- sym_type = ELF64_ST_TYPE (sym->st_info);
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- if (elf_section_data (sec) != NULL)
- {
- long *opd_sym_adjust;
-
- opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust;
- if (opd_sym_adjust != NULL)
- relocation += opd_sym_adjust[sym->st_value / 24];
- }
- }
- else
- {
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
- sym_name = h->root.root.string;
- sym_type = h->type;
- }
-
- /* TLS optimizations. Replace instruction sequences and relocs
- based on information we collected in tls_optimize. We edit
- RELOCS so that --emit-relocs will output something sensible
- for the final instruction stream. */
- tls_mask = 0;
- tls_gd = 0;
- toc_symndx = 0;
- if (IS_PPC64_TLS_RELOC (r_type))
- {
- if (h != NULL)
- tls_mask = ((struct ppc_link_hash_entry *) h)->tls_mask;
- else if (local_got_ents != NULL)
- {
- char *lgot_masks;
- lgot_masks = (char *) (local_got_ents + symtab_hdr->sh_info);
- tls_mask = lgot_masks[r_symndx];
- }
- if (tls_mask == 0 && r_type == R_PPC64_TLS)
- {
- /* Check for toc tls entries. */
- char *toc_tls;
-
- if (!get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
- rel, input_bfd))
- return FALSE;
-
- if (toc_tls)
- tls_mask = *toc_tls;
- }
- }
-
- /* Check that tls relocs are used with tls syms, and non-tls
- relocs are used with non-tls syms. */
- if (r_symndx != 0
- && r_type != R_PPC64_NONE
- && (h == NULL
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && IS_PPC64_TLS_RELOC (r_type) != (sym_type == STT_TLS))
- {
- if (r_type == R_PPC64_TLS && tls_mask != 0)
- /* R_PPC64_TLS is OK against a symbol in the TOC. */
- ;
- else
- (*_bfd_error_handler)
- (sym_type == STT_TLS
- ? _("%s(%s+0x%lx): %s used with TLS symbol %s")
- : _("%s(%s+0x%lx): %s used with non-TLS symbol %s"),
- bfd_archive_filename (input_bfd),
- input_section->name,
- (long) rel->r_offset,
- ppc64_elf_howto_table[r_type]->name,
- sym_name);
- }
-
- /* Ensure reloc mapping code below stays sane. */
- if (R_PPC64_TOC16_LO_DS != R_PPC64_TOC16_DS + 1
- || R_PPC64_TOC16_LO != R_PPC64_TOC16 + 1
- || (R_PPC64_GOT_TLSLD16 & 3) != (R_PPC64_GOT_TLSGD16 & 3)
- || (R_PPC64_GOT_TLSLD16_LO & 3) != (R_PPC64_GOT_TLSGD16_LO & 3)
- || (R_PPC64_GOT_TLSLD16_HI & 3) != (R_PPC64_GOT_TLSGD16_HI & 3)
- || (R_PPC64_GOT_TLSLD16_HA & 3) != (R_PPC64_GOT_TLSGD16_HA & 3)
- || (R_PPC64_GOT_TLSLD16 & 3) != (R_PPC64_GOT_TPREL16_DS & 3)
- || (R_PPC64_GOT_TLSLD16_LO & 3) != (R_PPC64_GOT_TPREL16_LO_DS & 3)
- || (R_PPC64_GOT_TLSLD16_HI & 3) != (R_PPC64_GOT_TPREL16_HI & 3)
- || (R_PPC64_GOT_TLSLD16_HA & 3) != (R_PPC64_GOT_TPREL16_HA & 3))
- abort ();
-
- switch (r_type)
- {
- default:
- break;
-
- case R_PPC64_TOC16:
- case R_PPC64_TOC16_LO:
- case R_PPC64_TOC16_DS:
- case R_PPC64_TOC16_LO_DS:
- {
- /* Check for toc tls entries. */
- char *toc_tls;
- int retval;
-
- retval = get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
- rel, input_bfd);
- if (retval == 0)
- return FALSE;
-
- if (toc_tls)
- {
- tls_mask = *toc_tls;
- if (r_type == R_PPC64_TOC16_DS
- || r_type == R_PPC64_TOC16_LO_DS)
- {
- if (tls_mask != 0
- && (tls_mask & (TLS_DTPREL | TLS_TPREL)) == 0)
- goto toctprel;
- }
- else
- {
- /* If we found a GD reloc pair, then we might be
- doing a GD->IE transition. */
- if (retval == 2)
- {
- tls_gd = TLS_TPRELGD;
- if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
- goto tls_get_addr_check;
- }
- else if (retval == 3)
- {
- if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
- goto tls_get_addr_check;
- }
- }
- }
- }
- break;
-
- case R_PPC64_GOT_TPREL16_DS:
- case R_PPC64_GOT_TPREL16_LO_DS:
- if (tls_mask != 0
- && (tls_mask & TLS_TPREL) == 0)
- {
- toctprel:
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
- insn &= 31 << 21;
- insn |= 0x3c0d0000; /* addis 0,13,0 */
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
- r_type = R_PPC64_TPREL16_HA;
- if (toc_symndx != 0)
- {
- rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
- /* We changed the symbol. Start over in order to
- get h, sym, sec etc. right. */
- rel--;
- continue;
- }
- else
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- }
- break;
-
- case R_PPC64_TLS:
- if (tls_mask != 0
- && (tls_mask & TLS_TPREL) == 0)
- {
- bfd_vma rtra;
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
- if ((insn & ((0x3f << 26) | (31 << 11)))
- == ((31 << 26) | (13 << 11)))
- rtra = insn & ((1 << 26) - (1 << 16));
- else if ((insn & ((0x3f << 26) | (31 << 16)))
- == ((31 << 26) | (13 << 16)))
- rtra = (insn & (31 << 21)) | ((insn & (31 << 11)) << 5);
- else
- abort ();
- if ((insn & ((1 << 11) - (1 << 1))) == 266 << 1)
- /* add -> addi. */
- insn = 14 << 26;
- else if ((insn & (31 << 1)) == 23 << 1
- && ((insn & (31 << 6)) < 14 << 6
- || ((insn & (31 << 6)) >= 16 << 6
- && (insn & (31 << 6)) < 24 << 6)))
- /* load and store indexed -> dform. */
- insn = (32 | ((insn >> 6) & 31)) << 26;
- else if ((insn & (31 << 1)) == 21 << 1
- && (insn & (0x1a << 6)) == 0)
- /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu. */
- insn = (((58 | ((insn >> 6) & 4)) << 26)
- | ((insn >> 6) & 1));
- else if ((insn & (31 << 1)) == 21 << 1
- && (insn & ((1 << 11) - (1 << 1))) == 341 << 1)
- /* lwax -> lwa. */
- insn = (58 << 26) | 2;
- else
- abort ();
- insn |= rtra;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- /* Was PPC64_TLS which sits on insn boundary, now
- PPC64_TPREL16_LO which is at insn+2. */
- rel->r_offset += 2;
- r_type = R_PPC64_TPREL16_LO;
- if (toc_symndx != 0)
- {
- rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
- /* We changed the symbol. Start over in order to
- get h, sym, sec etc. right. */
- rel--;
- continue;
- }
- else
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- }
- break;
-
- case R_PPC64_GOT_TLSGD16_HI:
- case R_PPC64_GOT_TLSGD16_HA:
- tls_gd = TLS_TPRELGD;
- if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
- goto tls_gdld_hi;
- break;
-
- case R_PPC64_GOT_TLSLD16_HI:
- case R_PPC64_GOT_TLSLD16_HA:
- if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
- {
- tls_gdld_hi:
- if ((tls_mask & tls_gd) != 0)
- r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3)
- + R_PPC64_GOT_TPREL16_DS);
- else
- {
- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
- rel->r_offset -= 2;
- r_type = R_PPC64_NONE;
- }
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- }
- break;
-
- case R_PPC64_GOT_TLSGD16:
- case R_PPC64_GOT_TLSGD16_LO:
- tls_gd = TLS_TPRELGD;
- if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
- goto tls_get_addr_check;
- break;
-
- case R_PPC64_GOT_TLSLD16:
- case R_PPC64_GOT_TLSLD16_LO:
- if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
- {
- tls_get_addr_check:
- if (rel + 1 < relend)
- {
- enum elf_ppc64_reloc_type r_type2;
- unsigned long r_symndx2;
- struct elf_link_hash_entry *h2;
- bfd_vma insn1, insn2, insn3;
- bfd_vma offset;
-
- /* The next instruction should be a call to
- __tls_get_addr. Peek at the reloc to be sure. */
- r_type2 = ELF64_R_TYPE (rel[1].r_info);
- r_symndx2 = ELF64_R_SYM (rel[1].r_info);
- if (r_symndx2 < symtab_hdr->sh_info
- || (r_type2 != R_PPC64_REL14
- && r_type2 != R_PPC64_REL14_BRTAKEN
- && r_type2 != R_PPC64_REL14_BRNTAKEN
- && r_type2 != R_PPC64_REL24))
- break;
-
- h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
- while (h2->root.type == bfd_link_hash_indirect
- || h2->root.type == bfd_link_hash_warning)
- h2 = (struct elf_link_hash_entry *) h2->root.u.i.link;
- if (h2 == NULL || h2 != htab->tls_get_addr)
- break;
-
- /* OK, it checks out. Replace the call. */
- offset = rel[1].r_offset;
- insn1 = bfd_get_32 (output_bfd,
- contents + rel->r_offset - 2);
- insn3 = bfd_get_32 (output_bfd,
- contents + offset + 4);
- if ((tls_mask & tls_gd) != 0)
- {
- /* IE */
- insn1 &= (1 << 26) - (1 << 2);
- insn1 |= 58 << 26; /* ld */
- insn2 = 0x7c636a14; /* add 3,3,13 */
- rel[1].r_info = ELF64_R_INFO (r_symndx2, R_PPC64_NONE);
- if ((tls_mask & TLS_EXPLICIT) == 0)
- r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3)
- + R_PPC64_GOT_TPREL16_DS);
- else
- r_type += R_PPC64_TOC16_DS - R_PPC64_TOC16;
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- }
- else
- {
- /* LE */
- insn1 = 0x3c6d0000; /* addis 3,13,0 */
- insn2 = 0x38630000; /* addi 3,3,0 */
- if (tls_gd == 0)
- {
- /* Was an LD reloc. */
- r_symndx = 0;
- rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
- rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
- }
- else if (toc_symndx != 0)
- r_symndx = toc_symndx;
- r_type = R_PPC64_TPREL16_HA;
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- rel[1].r_info = ELF64_R_INFO (r_symndx,
- R_PPC64_TPREL16_LO);
- rel[1].r_offset += 2;
- }
- if (insn3 == NOP
- || insn3 == CROR_151515 || insn3 == CROR_313131)
- {
- insn3 = insn2;
- insn2 = NOP;
- rel[1].r_offset += 4;
- }
- bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
- bfd_put_32 (output_bfd, insn2, contents + offset);
- bfd_put_32 (output_bfd, insn3, contents + offset + 4);
- if (tls_gd == 0 || toc_symndx != 0)
- {
- /* We changed the symbol. Start over in order
- to get h, sym, sec etc. right. */
- rel--;
- continue;
- }
- }
- }
- break;
-
- case R_PPC64_DTPMOD64:
- if (rel + 1 < relend
- && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)
- && rel[1].r_offset == rel->r_offset + 8)
- {
- if ((tls_mask & TLS_GD) == 0)
- {
- rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_NONE);
- if ((tls_mask & TLS_TPRELGD) != 0)
- r_type = R_PPC64_TPREL64;
- else
- {
- bfd_put_64 (output_bfd, 1, contents + rel->r_offset);
- r_type = R_PPC64_NONE;
- }
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- }
- }
- else
- {
- if ((tls_mask & TLS_LD) == 0)
- {
- bfd_put_64 (output_bfd, 1, contents + rel->r_offset);
- r_type = R_PPC64_NONE;
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- }
- }
- break;
-
- case R_PPC64_TPREL64:
- if ((tls_mask & TLS_TPREL) == 0)
- {
- r_type = R_PPC64_NONE;
- rel->r_info = ELF64_R_INFO (r_symndx, r_type);
- }
- break;
- }
-
- /* Handle other relocations that tweak non-addend part of insn. */
- insn = 0;
- switch (r_type)
- {
- default:
- break;
-
- /* Branch taken prediction relocations. */
- case R_PPC64_ADDR14_BRTAKEN:
- case R_PPC64_REL14_BRTAKEN:
- insn = 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */
- /* Fall thru. */
-
- /* Branch not taken prediction relocations. */
- case R_PPC64_ADDR14_BRNTAKEN:
- case R_PPC64_REL14_BRNTAKEN:
- insn |= bfd_get_32 (output_bfd,
- contents + rel->r_offset) & ~(0x01 << 21);
- if (is_power4)
- {
- /* Set 'a' bit. This is 0b00010 in BO field for branch
- on CR(BI) insns (BO == 001at or 011at), and 0b01000
- for branch on CTR insns (BO == 1a00t or 1a01t). */
- if ((insn & (0x14 << 21)) == (0x04 << 21))
- insn |= 0x02 << 21;
- else if ((insn & (0x14 << 21)) == (0x10 << 21))
- insn |= 0x08 << 21;
- else
- break;
- }
- else
- {
- from = (rel->r_offset
- + input_section->output_offset
- + input_section->output_section->vma);
-
- /* Invert 'y' bit if not the default. */
- if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
- insn ^= 0x01 << 21;
- }
-
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- break;
-
- case R_PPC64_REL24:
- /* Calls to functions with a different TOC, such as calls to
- shared objects, need to alter the TOC pointer. This is
- done using a linkage stub. A REL24 branching to these
- linkage stubs needs to be followed by a nop, as the nop
- will be replaced with an instruction to restore the TOC
- base pointer. */
- if (((h != NULL
- && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL
- && fdh->plt.plist != NULL)
- || ((fdh = h, sec) != NULL
- && sec->output_section != NULL
- && (htab->stub_group[sec->id].toc_off
- != htab->stub_group[input_section->id].toc_off)))
- && (stub_entry = ppc_get_stub_entry (input_section, sec, fdh,
- rel, htab)) != NULL
- && (stub_entry->stub_type == ppc_stub_plt_call
- || stub_entry->stub_type == ppc_stub_plt_branch_r2off
- || stub_entry->stub_type == ppc_stub_long_branch_r2off))
- {
- bfd_boolean can_plt_call = 0;
-
- if (rel->r_offset + 8 <= input_section->_cooked_size)
- {
- insn = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
- if (insn == NOP
- || insn == CROR_151515 || insn == CROR_313131)
- {
- bfd_put_32 (input_bfd, LD_R2_40R1,
- contents + rel->r_offset + 4);
- can_plt_call = 1;
- }
- }
-
- if (!can_plt_call)
- {
- if (stub_entry->stub_type == ppc_stub_plt_call)
- {
- /* If this is a plain branch rather than a branch
- and link, don't require a nop. */
- insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((insn & 1) == 0)
- can_plt_call = 1;
- }
- else if (h != NULL
- && strcmp (h->root.root.string,
- ".__libc_start_main") == 0)
- {
- /* Allow crt1 branch to go via a toc adjusting stub. */
- can_plt_call = 1;
- }
- else
- {
- if (strcmp (input_section->output_section->name,
- ".init") == 0
- || strcmp (input_section->output_section->name,
- ".fini") == 0)
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): automatic multiple TOCs "
- "not supported using your crt files; "
- "recompile with -mminimal-toc or upgrade gcc"),
- bfd_archive_filename (input_bfd),
- input_section->name,
- (long) rel->r_offset);
- else
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): sibling call optimization to `%s' "
- "does not allow automatic multiple TOCs; "
- "recompile with -mminimal-toc or "
- "-fno-optimize-sibling-calls, "
- "or make `%s' extern"),
- bfd_archive_filename (input_bfd),
- input_section->name,
- (long) rel->r_offset,
- sym_name,
- sym_name);
- bfd_set_error (bfd_error_bad_value);
- ret = FALSE;
- }
- }
-
- if (can_plt_call)
- {
- relocation = (stub_entry->stub_offset
- + stub_entry->stub_sec->output_offset
- + stub_entry->stub_sec->output_section->vma);
- if (stub_entry->stub_type == ppc_stub_plt_call)
- unresolved_reloc = FALSE;
- }
- }
-
- if (h != NULL
- && h->root.type == bfd_link_hash_undefweak
- && relocation == 0
- && rel->r_addend == 0)
- {
- /* Tweak calls to undefined weak functions to point at a
- blr. We can thus call a weak function without first
- checking whether the function is defined. We have a
- blr at the end of .sfpr. */
- BFD_ASSERT (htab->sfpr->_raw_size != 0);
- relocation = (htab->sfpr->_raw_size - 4
- + htab->sfpr->output_offset
- + htab->sfpr->output_section->vma);
- from = (rel->r_offset
- + input_section->output_offset
- + input_section->output_section->vma);
-
- /* But let's not be silly about it. If the blr isn't in
- reach, just go to the next instruction. */
- if (relocation - from + (1 << 25) >= (1 << 26)
- || htab->sfpr->_raw_size == 0)
- relocation = from + 4;
- }
- break;
- }
-
- /* Set `addend'. */
- tls_type = 0;
- addend = rel->r_addend;
- switch (r_type)
- {
- default:
- (*_bfd_error_handler)
- (_("%s: unknown relocation type %d for symbol %s"),
- bfd_archive_filename (input_bfd), (int) r_type, sym_name);
-
- bfd_set_error (bfd_error_bad_value);
- ret = FALSE;
- continue;
-
- case R_PPC64_NONE:
- case R_PPC64_TLS:
- case R_PPC64_GNU_VTINHERIT:
- case R_PPC64_GNU_VTENTRY:
- continue;
-
- /* GOT16 relocations. Like an ADDR16 using the symbol's
- address in the GOT as relocation value instead of the
- symbol's value itself. Also, create a GOT entry for the
- symbol and put the symbol value there. */
- case R_PPC64_GOT_TLSGD16:
- case R_PPC64_GOT_TLSGD16_LO:
- case R_PPC64_GOT_TLSGD16_HI:
- case R_PPC64_GOT_TLSGD16_HA:
- tls_type = TLS_TLS | TLS_GD;
- goto dogot;
-
- case R_PPC64_GOT_TLSLD16:
- case R_PPC64_GOT_TLSLD16_LO:
- case R_PPC64_GOT_TLSLD16_HI:
- case R_PPC64_GOT_TLSLD16_HA:
- tls_type = TLS_TLS | TLS_LD;
- goto dogot;
-
- case R_PPC64_GOT_TPREL16_DS:
- case R_PPC64_GOT_TPREL16_LO_DS:
- case R_PPC64_GOT_TPREL16_HI:
- case R_PPC64_GOT_TPREL16_HA:
- tls_type = TLS_TLS | TLS_TPREL;
- goto dogot;
-
- case R_PPC64_GOT_DTPREL16_DS:
- case R_PPC64_GOT_DTPREL16_LO_DS:
- case R_PPC64_GOT_DTPREL16_HI:
- case R_PPC64_GOT_DTPREL16_HA:
- tls_type = TLS_TLS | TLS_DTPREL;
- goto dogot;
-
- case R_PPC64_GOT16:
- case R_PPC64_GOT16_LO:
- case R_PPC64_GOT16_HI:
- case R_PPC64_GOT16_HA:
- case R_PPC64_GOT16_DS:
- case R_PPC64_GOT16_LO_DS:
- dogot:
- {
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- asection *got;
- bfd_vma *offp;
- bfd_vma off;
- unsigned long indx = 0;
-
- if (tls_type == (TLS_TLS | TLS_LD)
- && (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
- offp = &ppc64_tlsld_got (input_bfd)->offset;
- else
- {
- struct got_entry *ent;
-
- if (h != NULL)
- {
- bfd_boolean dyn = htab->elf.dynamic_sections_created;
- if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h)))
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally, or the symbol was forced to be local
- because of a version file. */
- ;
- else
- {
- indx = h->dynindx;
- unresolved_reloc = FALSE;
- }
- ent = h->got.glist;
- }
- else
- {
- if (local_got_ents == NULL)
- abort ();
- ent = local_got_ents[r_symndx];
- }
-
- for (; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
- && ent->owner == input_bfd
- && ent->tls_type == tls_type)
- break;
- if (ent == NULL)
- abort ();
- offp = &ent->got.offset;
- }
-
- got = ppc64_elf_tdata (input_bfd)->got;
- if (got == NULL)
- abort ();
-
- /* The offset must always be a multiple of 8. We use the
- least significant bit to record whether we have already
- processed this entry. */
- off = *offp;
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- /* Generate relocs for the dynamic linker, except in
- the case of TLSLD where we'll use one entry per
- module. */
- asection *relgot = ppc64_elf_tdata (input_bfd)->relgot;
-
- *offp = off | 1;
- if ((info->shared || indx != 0)
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
- {
- outrel.r_offset = (got->output_section->vma
- + got->output_offset
- + off);
- outrel.r_addend = rel->r_addend;
- if (tls_type & (TLS_LD | TLS_GD))
- {
- outrel.r_addend = 0;
- outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64);
- if (tls_type == (TLS_TLS | TLS_GD))
- {
- loc = relgot->contents;
- loc += (relgot->reloc_count++
- * sizeof (Elf64_External_Rela));
- bfd_elf64_swap_reloca_out (output_bfd,
- &outrel, loc);
- outrel.r_offset += 8;
- outrel.r_addend = rel->r_addend;
- outrel.r_info
- = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
- }
- }
- else if (tls_type == (TLS_TLS | TLS_DTPREL))
- outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
- else if (tls_type == (TLS_TLS | TLS_TPREL))
- outrel.r_info = ELF64_R_INFO (indx, R_PPC64_TPREL64);
- else if (indx == 0)
- {
- outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE);
-
- /* Write the .got section contents for the sake
- of prelink. */
- loc = got->contents + off;
- bfd_put_64 (output_bfd, outrel.r_addend + relocation,
- loc);
- }
- else
- outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT);
-
- if (indx == 0 && tls_type != (TLS_TLS | TLS_LD))
- {
- outrel.r_addend += relocation;
- if (tls_type & (TLS_GD | TLS_DTPREL | TLS_TPREL))
- outrel.r_addend -= htab->elf.tls_sec->vma;
- }
- loc = relgot->contents;
- loc += (relgot->reloc_count++
- * sizeof (Elf64_External_Rela));
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
-
- /* Init the .got section contents here if we're not
- emitting a reloc. */
- else
- {
- relocation += rel->r_addend;
- if (tls_type == (TLS_TLS | TLS_LD))
- relocation = 1;
- else if (tls_type != 0)
- {
- relocation -= htab->elf.tls_sec->vma + DTP_OFFSET;
- if (tls_type == (TLS_TLS | TLS_TPREL))
- relocation += DTP_OFFSET - TP_OFFSET;
-
- if (tls_type == (TLS_TLS | TLS_GD))
- {
- bfd_put_64 (output_bfd, relocation,
- got->contents + off + 8);
- relocation = 1;
- }
- }
-
- bfd_put_64 (output_bfd, relocation,
- got->contents + off);
- }
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
-
- relocation = got->output_offset + off;
-
- /* TOC base (r2) is TOC start plus 0x8000. */
- addend = -TOC_BASE_OFF;
- }
- break;
-
- case R_PPC64_PLT16_HA:
- case R_PPC64_PLT16_HI:
- case R_PPC64_PLT16_LO:
- case R_PPC64_PLT32:
- case R_PPC64_PLT64:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
-
- /* It's possible that we didn't make a PLT entry for this
- symbol. This happens when statically linking PIC code,
- or when using -Bsymbolic. Go find a match if there is a
- PLT entry. */
- if (htab->plt != NULL)
- {
- struct plt_entry *ent;
- for (ent = h->plt.plist; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
- && ent->plt.offset != (bfd_vma) -1)
- {
- relocation = (htab->plt->output_section->vma
- + htab->plt->output_offset
- + ent->plt.offset);
- unresolved_reloc = FALSE;
- }
- }
- break;
-
- case R_PPC64_TOC:
- /* Relocation value is TOC base. */
- relocation = TOCstart;
- if (r_symndx == 0)
- relocation += htab->stub_group[input_section->id].toc_off;
- else if (unresolved_reloc)
- ;
- else if (sec != NULL && sec->id <= htab->top_id)
- relocation += htab->stub_group[sec->id].toc_off;
- else
- unresolved_reloc = TRUE;
- goto dodyn2;
-
- /* TOC16 relocs. We want the offset relative to the TOC base,
- which is the address of the start of the TOC plus 0x8000.
- The TOC consists of sections .got, .toc, .tocbss, and .plt,
- in this order. */
- case R_PPC64_TOC16:
- case R_PPC64_TOC16_LO:
- case R_PPC64_TOC16_HI:
- case R_PPC64_TOC16_DS:
- case R_PPC64_TOC16_LO_DS:
- case R_PPC64_TOC16_HA:
- addend -= TOCstart + htab->stub_group[input_section->id].toc_off;
- break;
-
- /* Relocate against the beginning of the section. */
- case R_PPC64_SECTOFF:
- case R_PPC64_SECTOFF_LO:
- case R_PPC64_SECTOFF_HI:
- case R_PPC64_SECTOFF_DS:
- case R_PPC64_SECTOFF_LO_DS:
- case R_PPC64_SECTOFF_HA:
- if (sec != NULL)
- addend -= sec->output_section->vma;
- break;
-
- case R_PPC64_REL14:
- case R_PPC64_REL14_BRNTAKEN:
- case R_PPC64_REL14_BRTAKEN:
- case R_PPC64_REL24:
- break;
-
- case R_PPC64_TPREL16:
- case R_PPC64_TPREL16_LO:
- case R_PPC64_TPREL16_HI:
- case R_PPC64_TPREL16_HA:
- case R_PPC64_TPREL16_DS:
- case R_PPC64_TPREL16_LO_DS:
- case R_PPC64_TPREL16_HIGHER:
- case R_PPC64_TPREL16_HIGHERA:
- case R_PPC64_TPREL16_HIGHEST:
- case R_PPC64_TPREL16_HIGHESTA:
- addend -= htab->elf.tls_sec->vma + TP_OFFSET;
- if (info->shared)
- /* The TPREL16 relocs shouldn't really be used in shared
- libs as they will result in DT_TEXTREL being set, but
- support them anyway. */
- goto dodyn;
- break;
-
- case R_PPC64_DTPREL16:
- case R_PPC64_DTPREL16_LO:
- case R_PPC64_DTPREL16_HI:
- case R_PPC64_DTPREL16_HA:
- case R_PPC64_DTPREL16_DS:
- case R_PPC64_DTPREL16_LO_DS:
- case R_PPC64_DTPREL16_HIGHER:
- case R_PPC64_DTPREL16_HIGHERA:
- case R_PPC64_DTPREL16_HIGHEST:
- case R_PPC64_DTPREL16_HIGHESTA:
- addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
- break;
-
- case R_PPC64_DTPMOD64:
- relocation = 1;
- addend = 0;
- goto dodyn;
-
- case R_PPC64_TPREL64:
- addend -= htab->elf.tls_sec->vma + TP_OFFSET;
- goto dodyn;
-
- case R_PPC64_DTPREL64:
- addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
- /* Fall thru */
-
- /* Relocations that may need to be propagated if this is a
- dynamic object. */
- case R_PPC64_REL30:
- case R_PPC64_REL32:
- case R_PPC64_REL64:
- case R_PPC64_ADDR14:
- case R_PPC64_ADDR14_BRNTAKEN:
- case R_PPC64_ADDR14_BRTAKEN:
- case R_PPC64_ADDR16:
- case R_PPC64_ADDR16_DS:
- case R_PPC64_ADDR16_HA:
- case R_PPC64_ADDR16_HI:
- case R_PPC64_ADDR16_HIGHER:
- case R_PPC64_ADDR16_HIGHERA:
- case R_PPC64_ADDR16_HIGHEST:
- case R_PPC64_ADDR16_HIGHESTA:
- case R_PPC64_ADDR16_LO:
- case R_PPC64_ADDR16_LO_DS:
- case R_PPC64_ADDR24:
- case R_PPC64_ADDR32:
- case R_PPC64_ADDR64:
- case R_PPC64_UADDR16:
- case R_PPC64_UADDR32:
- case R_PPC64_UADDR64:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- dodyn:
- if (r_symndx == 0)
- break;
- /* Fall thru. */
-
- dodyn2:
- if ((input_section->flags & SEC_ALLOC) == 0)
- break;
-
- if (NO_OPD_RELOCS && is_opd)
- break;
-
- if ((info->shared
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (MUST_BE_DYN_RELOC (r_type)
- || !SYMBOL_CALLS_LOCAL (info, h)))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && h != NULL
- && h->dynindx != -1
- && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- Elf_Internal_Rela outrel;
- bfd_boolean skip, relocate;
- asection *sreloc;
- bfd_byte *loc;
- bfd_vma out_off;
-
- /* When generating a dynamic object, these relocations
- are copied into the output file to be resolved at run
- time. */
-
- skip = FALSE;
- relocate = FALSE;
-
- out_off = _bfd_elf_section_offset (output_bfd, info,
- input_section, rel->r_offset);
- if (out_off == (bfd_vma) -1)
- skip = TRUE;
- else if (out_off == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
- out_off += (input_section->output_section->vma
- + input_section->output_offset);
- outrel.r_offset = out_off;
- outrel.r_addend = rel->r_addend;
-
- /* Optimize unaligned reloc use. */
- if ((r_type == R_PPC64_ADDR64 && (out_off & 7) != 0)
- || (r_type == R_PPC64_UADDR64 && (out_off & 7) == 0))
- r_type ^= R_PPC64_ADDR64 ^ R_PPC64_UADDR64;
- else if ((r_type == R_PPC64_ADDR32 && (out_off & 3) != 0)
- || (r_type == R_PPC64_UADDR32 && (out_off & 3) == 0))
- r_type ^= R_PPC64_ADDR32 ^ R_PPC64_UADDR32;
- else if ((r_type == R_PPC64_ADDR16 && (out_off & 1) != 0)
- || (r_type == R_PPC64_UADDR16 && (out_off & 1) == 0))
- r_type ^= R_PPC64_ADDR16 ^ R_PPC64_UADDR16;
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- else if (!SYMBOL_REFERENCES_LOCAL (info, h)
- && !is_opd
- && r_type != R_PPC64_TOC)
- outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
- else
- {
- /* This symbol is local, or marked to become local,
- or this is an opd section reloc which must point
- at a local function. */
- outrel.r_addend += relocation;
- if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
- {
- if (is_opd && h != NULL)
- {
- /* Lie about opd entries. This case occurs
- when building shared libraries and we
- reference a function in another shared
- lib. The same thing happens for a weak
- definition in an application that's
- overridden by a strong definition in a
- shared lib. (I believe this is a generic
- bug in binutils handling of weak syms.)
- In these cases we won't use the opd
- entry in this lib. */
- unresolved_reloc = FALSE;
- }
- outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
-
- /* We need to relocate .opd contents for ld.so.
- Prelink also wants simple and consistent rules
- for relocs. This make all RELATIVE relocs have
- *r_offset equal to r_addend. */
- relocate = TRUE;
- }
- else
- {
- long indx = 0;
-
- if (bfd_is_abs_section (sec))
- ;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- asection *osec;
-
- osec = sec->output_section;
- indx = elf_section_data (osec)->dynindx;
-
- /* We are turning this relocation into one
- against a section symbol, so subtract out
- the output section's address but not the
- offset of the input section in the output
- section. */
- outrel.r_addend -= osec->vma;
- }
-
- outrel.r_info = ELF64_R_INFO (indx, r_type);
- }
- }
-
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
-
- /* If this reloc is against an external symbol, it will
- be computed at runtime, so there's no need to do
- anything now. However, for the sake of prelink ensure
- that the section contents are a known value. */
- if (! relocate)
- {
- unresolved_reloc = FALSE;
- /* The value chosen here is quite arbitrary as ld.so
- ignores section contents except for the special
- case of .opd where the contents might be accessed
- before relocation. Choose zero, as that won't
- cause reloc overflow. */
- relocation = 0;
- addend = 0;
- /* Use *r_offset == r_addend for R_PPC64_ADDR64 relocs
- to improve backward compatibility with older
- versions of ld. */
- if (r_type == R_PPC64_ADDR64)
- addend = outrel.r_addend;
- /* Adjust pc_relative relocs to have zero in *r_offset. */
- else if (ppc64_elf_howto_table[r_type]->pc_relative)
- addend = (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
- }
- }
- break;
-
- case R_PPC64_COPY:
- case R_PPC64_GLOB_DAT:
- case R_PPC64_JMP_SLOT:
- case R_PPC64_RELATIVE:
- /* We shouldn't ever see these dynamic relocs in relocatable
- files. */
- /* Fall through. */
-
- case R_PPC64_PLTGOT16:
- case R_PPC64_PLTGOT16_DS:
- case R_PPC64_PLTGOT16_HA:
- case R_PPC64_PLTGOT16_HI:
- case R_PPC64_PLTGOT16_LO:
- case R_PPC64_PLTGOT16_LO_DS:
- case R_PPC64_PLTREL32:
- case R_PPC64_PLTREL64:
- /* These ones haven't been implemented yet. */
-
- (*_bfd_error_handler)
- (_("%s: relocation %s is not supported for symbol %s."),
- bfd_archive_filename (input_bfd),
- ppc64_elf_howto_table[r_type]->name, sym_name);
-
- bfd_set_error (bfd_error_invalid_operation);
- ret = FALSE;
- continue;
- }
-
- /* Do any further special processing. */
- switch (r_type)
- {
- default:
- break;
-
- case R_PPC64_ADDR16_HA:
- case R_PPC64_ADDR16_HIGHERA:
- case R_PPC64_ADDR16_HIGHESTA:
- case R_PPC64_GOT16_HA:
- case R_PPC64_PLTGOT16_HA:
- case R_PPC64_PLT16_HA:
- case R_PPC64_TOC16_HA:
- case R_PPC64_SECTOFF_HA:
- case R_PPC64_TPREL16_HA:
- case R_PPC64_DTPREL16_HA:
- case R_PPC64_GOT_TLSGD16_HA:
- case R_PPC64_GOT_TLSLD16_HA:
- case R_PPC64_GOT_TPREL16_HA:
- case R_PPC64_GOT_DTPREL16_HA:
- case R_PPC64_TPREL16_HIGHER:
- case R_PPC64_TPREL16_HIGHERA:
- case R_PPC64_TPREL16_HIGHEST:
- case R_PPC64_TPREL16_HIGHESTA:
- case R_PPC64_DTPREL16_HIGHER:
- case R_PPC64_DTPREL16_HIGHERA:
- case R_PPC64_DTPREL16_HIGHEST:
- case R_PPC64_DTPREL16_HIGHESTA:
- /* It's just possible that this symbol is a weak symbol
- that's not actually defined anywhere. In that case,
- 'sec' would be NULL, and we should leave the symbol
- alone (it will be set to zero elsewhere in the link). */
- if (sec != NULL)
- /* Add 0x10000 if sign bit in 0:15 is set.
- Bits 0:15 are not used. */
- addend += 0x8000;
- break;
-
- case R_PPC64_ADDR16_DS:
- case R_PPC64_ADDR16_LO_DS:
- case R_PPC64_GOT16_DS:
- case R_PPC64_GOT16_LO_DS:
- case R_PPC64_PLT16_LO_DS:
- case R_PPC64_SECTOFF_DS:
- case R_PPC64_SECTOFF_LO_DS:
- case R_PPC64_TOC16_DS:
- case R_PPC64_TOC16_LO_DS:
- case R_PPC64_PLTGOT16_DS:
- case R_PPC64_PLTGOT16_LO_DS:
- case R_PPC64_GOT_TPREL16_DS:
- case R_PPC64_GOT_TPREL16_LO_DS:
- case R_PPC64_GOT_DTPREL16_DS:
- case R_PPC64_GOT_DTPREL16_LO_DS:
- case R_PPC64_TPREL16_DS:
- case R_PPC64_TPREL16_LO_DS:
- case R_PPC64_DTPREL16_DS:
- case R_PPC64_DTPREL16_LO_DS:
- insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3));
- mask = 3;
- /* If this reloc is against an lq insn, then the value must be
- a multiple of 16. This is somewhat of a hack, but the
- "correct" way to do this by defining _DQ forms of all the
- _DS relocs bloats all reloc switches in this file. It
- doesn't seem to make much sense to use any of these relocs
- in data, so testing the insn should be safe. */
- if ((insn & (0x3f << 26)) == (56u << 26))
- mask = 15;
- if (((relocation + addend) & mask) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: error: relocation %s not a multiple of %d"),
- bfd_archive_filename (input_bfd),
- ppc64_elf_howto_table[r_type]->name,
- mask + 1);
- bfd_set_error (bfd_error_bad_value);
- ret = FALSE;
- continue;
- }
- break;
-
- case R_PPC64_REL14:
- case R_PPC64_REL14_BRNTAKEN:
- case R_PPC64_REL14_BRTAKEN:
- max_br_offset = 1 << 15;
- goto branch_check;
-
- case R_PPC64_REL24:
- max_br_offset = 1 << 25;
-
- branch_check:
- /* If the branch is out of reach or the TOC register needs
- adjusting, then redirect the call to the local stub for
- this function. */
- from = (rel->r_offset
- + input_section->output_offset
- + input_section->output_section->vma);
- if ((relocation + addend - from + max_br_offset >= 2 * max_br_offset
- || (sec != NULL
- && sec->output_section != NULL
- && sec->id <= htab->top_id
- && (htab->stub_group[sec->id].toc_off
- != htab->stub_group[input_section->id].toc_off)))
- && (stub_entry = ppc_get_stub_entry (input_section, sec, h,
- rel, htab)) != NULL)
- {
- /* Munge up the value and addend so that we call the stub
- rather than the procedure directly. */
- relocation = (stub_entry->stub_offset
- + stub_entry->stub_sec->output_offset
- + stub_entry->stub_sec->output_section->vma);
- addend = 0;
- }
- break;
- }
-
- /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
- because such sections are not SEC_ALLOC and thus ld.so will
- not process them. */
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- ppc64_elf_howto_table[(int) r_type]->name,
- h->root.root.string);
- ret = FALSE;
- }
-
- r = _bfd_final_link_relocate (ppc64_elf_howto_table[(int) r_type],
- input_bfd,
- input_section,
- contents,
- rel->r_offset,
- relocation,
- addend);
-
- if (r != bfd_reloc_ok)
- {
- if (sym_name == NULL)
- sym_name = "(null)";
- if (r == bfd_reloc_overflow)
- {
- if (warned)
- continue;
- if (h != NULL
- && h->root.type == bfd_link_hash_undefweak
- && ppc64_elf_howto_table[r_type]->pc_relative)
- {
- /* Assume this is a call protected by other code that
- detects the symbol is undefined. If this is the case,
- we can safely ignore the overflow. If not, the
- program is hosed anyway, and a little warning isn't
- going to help. */
-
- continue;
- }
-
- if (!((*info->callbacks->reloc_overflow)
- (info, sym_name, ppc64_elf_howto_table[r_type]->name,
- rel->r_addend, input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): %s reloc against `%s': error %d"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- ppc64_elf_howto_table[r_type]->name,
- sym_name,
- (int) r);
- ret = FALSE;
- }
- }
- }
-
- return ret;
-}
-
-/* Adjust the value of any local symbols in opd sections. */
-
-static bfd_boolean
-ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
- const char *name ATTRIBUTE_UNUSED,
- Elf_Internal_Sym *elfsym,
- asection *input_sec,
- struct elf_link_hash_entry *h)
-{
- long *adjust;
- bfd_vma value;
-
- if (h != NULL
- || input_sec == NULL
- || ppc64_elf_section_data (input_sec) == NULL
- || (adjust = ppc64_elf_section_data (input_sec)->opd.adjust) == NULL)
- return TRUE;
-
- value = elfsym->st_value - input_sec->output_offset;
- if (!info->relocatable)
- value -= input_sec->output_section->vma;
-
- elfsym->st_value += adjust[value / 24];
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
- struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- struct ppc_link_hash_table *htab;
- bfd *dynobj;
-
- htab = ppc_hash_table (info);
- dynobj = htab->elf.dynobj;
-
- if (((struct ppc_link_hash_entry *) h)->is_func_descriptor)
- {
- struct plt_entry *ent;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- for (ent = h->plt.plist; ent != NULL; ent = ent->next)
- if (ent->plt.offset != (bfd_vma) -1)
- {
- /* This symbol has an entry in the procedure linkage
- table. Set it up. */
-
- if (htab->plt == NULL
- || htab->relplt == NULL
- || htab->glink == NULL)
- abort ();
-
- /* Create a JMP_SLOT reloc to inform the dynamic linker to
- fill in the PLT entry. */
- rela.r_offset = (htab->plt->output_section->vma
- + htab->plt->output_offset
- + ent->plt.offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
- rela.r_addend = ent->addend;
-
- loc = htab->relplt->contents;
- loc += ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
- * sizeof (Elf64_External_Rela));
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol needs a copy reloc. Set it up. */
-
- if (h->dynindx == -1
- || (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || htab->relbss == NULL)
- abort ();
-
- rela.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY);
- rela.r_addend = 0;
- loc = htab->relbss->contents;
- loc += htab->relbss->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Used to decide how to sort relocs in an optimal manner for the
- dynamic linker, before writing them out. */
-
-static enum elf_reloc_type_class
-ppc64_elf_reloc_type_class (const Elf_Internal_Rela *rela)
-{
- enum elf_ppc64_reloc_type r_type;
-
- r_type = ELF64_R_TYPE (rela->r_info);
- switch (r_type)
- {
- case R_PPC64_RELATIVE:
- return reloc_class_relative;
- case R_PPC64_JMP_SLOT:
- return reloc_class_plt;
- case R_PPC64_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- struct ppc_link_hash_table *htab;
- bfd *dynobj;
- asection *sdyn;
-
- htab = ppc_hash_table (info);
- dynobj = htab->elf.dynobj;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (htab->elf.dynamic_sections_created)
- {
- Elf64_External_Dyn *dyncon, *dynconend;
-
- if (sdyn == NULL || htab->got == NULL)
- abort ();
-
- dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- asection *s;
-
- bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- continue;
-
- case DT_PPC64_GLINK:
- s = htab->glink;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- /* We stupidly defined DT_PPC64_GLINK to be the start
- of glink rather than the first entry point, which is
- what ld.so needs, and now have a bigger stub to
- support automatic multiple TOCs. */
- dyn.d_un.d_ptr += GLINK_CALL_STUB_SIZE - 32;
- break;
-
- case DT_PPC64_OPD:
- s = bfd_get_section_by_name (output_bfd, ".opd");
- if (s == NULL)
- continue;
- dyn.d_un.d_ptr = s->vma;
- break;
-
- case DT_PPC64_OPDSZ:
- s = bfd_get_section_by_name (output_bfd, ".opd");
- if (s == NULL)
- continue;
- dyn.d_un.d_val = s->_raw_size;
- break;
-
- case DT_PLTGOT:
- s = htab->plt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- break;
-
- case DT_JMPREL:
- s = htab->relplt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- break;
-
- case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->relplt->_raw_size;
- break;
-
- case DT_RELASZ:
- /* Don't count procedure linkage table relocs in the
- overall reloc count. */
- s = htab->relplt;
- if (s == NULL)
- continue;
- dyn.d_un.d_val -= s->_raw_size;
- break;
-
- case DT_RELA:
- /* We may not be using the standard ELF linker script.
- If .rela.plt is the first .rela section, we adjust
- DT_RELA to not include it. */
- s = htab->relplt;
- if (s == NULL)
- continue;
- if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
- continue;
- dyn.d_un.d_ptr += s->_raw_size;
- break;
- }
-
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
- }
-
- if (htab->got != NULL && htab->got->_raw_size != 0)
- {
- /* Fill in the first entry in the global offset table.
- We use it to hold the link-time TOCbase. */
- bfd_put_64 (output_bfd,
- elf_gp (output_bfd) + TOC_BASE_OFF,
- htab->got->contents);
-
- /* Set .got entry size. */
- elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 8;
- }
-
- if (htab->plt != NULL && htab->plt->_raw_size != 0)
- {
- /* Set .plt entry size. */
- elf_section_data (htab->plt->output_section)->this_hdr.sh_entsize
- = PLT_ENTRY_SIZE;
- }
-
- /* We need to handle writing out multiple GOT sections ourselves,
- since we didn't add them to DYNOBJ. */
- while ((dynobj = dynobj->link_next) != NULL)
- {
- asection *s;
- s = ppc64_elf_tdata (dynobj)->got;
- if (s != NULL
- && s->_raw_size != 0
- && s->output_section != bfd_abs_section_ptr
- && !bfd_set_section_contents (output_bfd, s->output_section,
- s->contents, s->output_offset,
- s->_raw_size))
- return FALSE;
- s = ppc64_elf_tdata (dynobj)->relgot;
- if (s != NULL
- && s->_raw_size != 0
- && s->output_section != bfd_abs_section_ptr
- && !bfd_set_section_contents (output_bfd, s->output_section,
- s->contents, s->output_offset,
- s->_raw_size))
- return FALSE;
- }
-
- return TRUE;
-}
-
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-ppc.h b/contrib/binutils/bfd/elf64-ppc.h
deleted file mode 100644
index 998e7e1..0000000
--- a/contrib/binutils/bfd/elf64-ppc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* PowerPC64-specific support for 64-bit ELF.
- Copyright 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-void ppc64_elf_init_stub_bfd
- (bfd *, struct bfd_link_info *);
-bfd_boolean ppc64_elf_mark_entry_syms
- (struct bfd_link_info *);
-bfd_boolean ppc64_elf_edit_opd
- (bfd *, struct bfd_link_info *);
-asection *ppc64_elf_tls_setup
- (bfd *, struct bfd_link_info *);
-bfd_boolean ppc64_elf_tls_optimize
- (bfd *, struct bfd_link_info *);
-bfd_vma ppc64_elf_toc
- (bfd *);
-int ppc64_elf_setup_section_lists
- (bfd *, struct bfd_link_info *);
-void ppc64_elf_next_toc_section
- (struct bfd_link_info *, asection *);
-void ppc64_elf_reinit_toc
- (bfd *, struct bfd_link_info *);
-bfd_boolean ppc64_elf_next_input_section
- (struct bfd_link_info *, asection *);
-bfd_boolean ppc64_elf_size_stubs
- (bfd *, struct bfd_link_info *, bfd_signed_vma,
- asection *(*) (const char *, asection *), void (*) (void));
-bfd_boolean ppc64_elf_build_stubs
- (bfd_boolean, struct bfd_link_info *, char **);
diff --git a/contrib/binutils/bfd/elf64-s390.c b/contrib/binutils/bfd/elf64-s390.c
deleted file mode 100644
index 63a261a..0000000
--- a/contrib/binutils/bfd/elf64-s390.c
+++ /dev/null
@@ -1,3445 +0,0 @@
-/* IBM S/390-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
- Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-static reloc_howto_type *elf_s390_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void elf_s390_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static bfd_boolean elf_s390_is_local_label_name
- PARAMS ((bfd *, const char *));
-static struct bfd_hash_entry *link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *elf_s390_link_hash_table_create
- PARAMS ((bfd *));
-static bfd_boolean create_got_section
- PARAMS((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_create_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
-static void elf_s390_copy_indirect_symbol
- PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static bfd_boolean elf_s390_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static asection *elf_s390_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf_s390_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-struct elf_s390_link_hash_entry;
-static void elf_s390_adjust_gotplt
- PARAMS ((struct elf_s390_link_hash_entry *));
-static bfd_boolean elf_s390_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean readonly_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean elf_s390_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static bfd_boolean elf_s390_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static enum elf_reloc_type_class elf_s390_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static bfd_boolean elf_s390_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_mkobject
- PARAMS ((bfd *));
-static bfd_boolean elf_s390_object_p
- PARAMS ((bfd *));
-static int elf_s390_tls_transition
- PARAMS ((struct bfd_link_info *, int, int));
-static bfd_reloc_status_type s390_tls_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_vma dtpoff_base
- PARAMS ((struct bfd_link_info *));
-static bfd_vma tpoff
- PARAMS ((struct bfd_link_info *, bfd_vma));
-static void invalid_tls_insn
- PARAMS ((bfd *, asection *, Elf_Internal_Rela *));
-static bfd_reloc_status_type s390_elf_ldisp_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
-#include "elf/s390.h"
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-/* The relocation "howto" table. */
-static reloc_howto_type elf_howto_table[] =
-{
- HOWTO (R_390_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_390_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO(R_390_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_8", FALSE, 0,0x000000ff, FALSE),
- HOWTO(R_390_12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_390_12", FALSE, 0,0x00000fff, FALSE),
- HOWTO(R_390_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_PC32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC32", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_GOT12, 0, 1, 12, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOT12", FALSE, 0,0x00000fff, FALSE),
- HOWTO(R_390_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOT32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLT32", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_COPY, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_COPY", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_GLOB_DAT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GLOB_DAT", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_JMP_SLOT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_JMP_SLOT", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_RELATIVE, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_RELATIVE", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_GOTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTOFF32", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_GOTPC, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPC", FALSE, 0,MINUS_ONE, TRUE),
- HOWTO(R_390_GOT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOT16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC16", FALSE, 0,0x0000ffff, TRUE),
- HOWTO(R_390_PC16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC16DBL", FALSE, 0,0x0000ffff, TRUE),
- HOWTO(R_390_PLT16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLT16DBL", FALSE, 0,0x0000ffff, TRUE),
- HOWTO(R_390_PC32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC32DBL", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_PLT32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLT32DBL", FALSE, 0,0xffffffff, TRUE),
- HOWTO(R_390_GOTPCDBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPCDBL", FALSE, 0,MINUS_ONE, TRUE),
- HOWTO(R_390_64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_64", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_PC64, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PC64", FALSE, 0,MINUS_ONE, TRUE),
- HOWTO(R_390_GOT64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOT64", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_PLT64, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLT64", FALSE, 0,MINUS_ONE, TRUE),
- HOWTO(R_390_GOTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTENT", FALSE, 0,MINUS_ONE, TRUE),
- HOWTO(R_390_GOTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTOFF16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_GOTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTOFF64", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_GOTPLT12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_390_GOTPLT12", FALSE, 0,0x00000fff, FALSE),
- HOWTO(R_390_GOTPLT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPLT16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_GOTPLT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPLT32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_GOTPLT64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPLT64", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_GOTPLTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_GOTPLTENT",FALSE, 0,MINUS_ONE, TRUE),
- HOWTO(R_390_PLTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLTOFF16", FALSE, 0,0x0000ffff, FALSE),
- HOWTO(R_390_PLTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLTOFF32", FALSE, 0,0xffffffff, FALSE),
- HOWTO(R_390_PLTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_PLTOFF64", FALSE, 0,MINUS_ONE, FALSE),
- HOWTO(R_390_TLS_LOAD, 0, 0, 0, FALSE, 0, complain_overflow_dont,
- s390_tls_reloc, "R_390_TLS_LOAD", FALSE, 0, 0, FALSE),
- HOWTO(R_390_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
- s390_tls_reloc, "R_390_TLS_GDCALL", FALSE, 0, 0, FALSE),
- HOWTO(R_390_TLS_LDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
- s390_tls_reloc, "R_390_TLS_LDCALL", FALSE, 0, 0, FALSE),
- EMPTY_HOWTO (R_390_TLS_GD32), /* Empty entry for R_390_TLS_GD32. */
- HOWTO(R_390_TLS_GD64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_GD64", FALSE, 0, MINUS_ONE, FALSE),
- HOWTO(R_390_TLS_GOTIE12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_390_TLS_GOTIE12", FALSE, 0, 0x00000fff, FALSE),
- EMPTY_HOWTO (R_390_TLS_GOTIE32), /* Empty entry for R_390_TLS_GOTIE32. */
- HOWTO(R_390_TLS_GOTIE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_GOTIE64", FALSE, 0, MINUS_ONE, FALSE),
- EMPTY_HOWTO (R_390_TLS_LDM32), /* Empty entry for R_390_TLS_LDM32. */
- HOWTO(R_390_TLS_LDM64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_LDM64", FALSE, 0, MINUS_ONE, FALSE),
- EMPTY_HOWTO (R_390_TLS_IE32), /* Empty entry for R_390_TLS_IE32. */
- HOWTO(R_390_TLS_IE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_IE64", FALSE, 0, MINUS_ONE, FALSE),
- HOWTO(R_390_TLS_IEENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_IEENT", FALSE, 0, MINUS_ONE, TRUE),
- EMPTY_HOWTO (R_390_TLS_LE32), /* Empty entry for R_390_TLS_LE32. */
- HOWTO(R_390_TLS_LE64, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_LE64", FALSE, 0, MINUS_ONE, FALSE),
- EMPTY_HOWTO (R_390_TLS_LDO32), /* Empty entry for R_390_TLS_LDO32. */
- HOWTO(R_390_TLS_LDO64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_LDO64", FALSE, 0, MINUS_ONE, FALSE),
- HOWTO(R_390_TLS_DTPMOD, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_DTPMOD", FALSE, 0, MINUS_ONE, FALSE),
- HOWTO(R_390_TLS_DTPOFF, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_DTPOFF", FALSE, 0, MINUS_ONE, FALSE),
- HOWTO(R_390_TLS_TPOFF, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_390_TLS_TPOFF", FALSE, 0, MINUS_ONE, FALSE),
- HOWTO(R_390_20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_20", FALSE, 0,0x0fffff00, FALSE),
- HOWTO(R_390_GOT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_GOT20", FALSE, 0,0x0fffff00, FALSE),
- HOWTO(R_390_GOTPLT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_GOTPLT20", FALSE, 0,0x0fffff00, FALSE),
- HOWTO(R_390_TLS_GOTIE20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
- s390_elf_ldisp_reloc, "R_390_TLS_GOTIE20", FALSE, 0,0x0fffff00, FALSE),
-};
-
-/* GNU extension to record C++ vtable hierarchy. */
-static reloc_howto_type elf64_s390_vtinherit_howto =
- HOWTO (R_390_GNU_VTINHERIT, 0,4,0,FALSE,0,complain_overflow_dont, NULL, "R_390_GNU_VTINHERIT", FALSE,0, 0, FALSE);
-static reloc_howto_type elf64_s390_vtentry_howto =
- HOWTO (R_390_GNU_VTENTRY, 0,4,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)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- switch (code)
- {
- case BFD_RELOC_NONE:
- return &elf_howto_table[(int) R_390_NONE];
- case BFD_RELOC_8:
- return &elf_howto_table[(int) R_390_8];
- case BFD_RELOC_390_12:
- return &elf_howto_table[(int) R_390_12];
- case BFD_RELOC_16:
- return &elf_howto_table[(int) R_390_16];
- case BFD_RELOC_32:
- return &elf_howto_table[(int) R_390_32];
- case BFD_RELOC_CTOR:
- return &elf_howto_table[(int) R_390_32];
- case BFD_RELOC_32_PCREL:
- return &elf_howto_table[(int) R_390_PC32];
- case BFD_RELOC_390_GOT12:
- return &elf_howto_table[(int) R_390_GOT12];
- case BFD_RELOC_32_GOT_PCREL:
- return &elf_howto_table[(int) R_390_GOT32];
- case BFD_RELOC_390_PLT32:
- return &elf_howto_table[(int) R_390_PLT32];
- case BFD_RELOC_390_COPY:
- return &elf_howto_table[(int) R_390_COPY];
- case BFD_RELOC_390_GLOB_DAT:
- return &elf_howto_table[(int) R_390_GLOB_DAT];
- case BFD_RELOC_390_JMP_SLOT:
- return &elf_howto_table[(int) R_390_JMP_SLOT];
- case BFD_RELOC_390_RELATIVE:
- return &elf_howto_table[(int) R_390_RELATIVE];
- case BFD_RELOC_32_GOTOFF:
- return &elf_howto_table[(int) R_390_GOTOFF32];
- case BFD_RELOC_390_GOTPC:
- return &elf_howto_table[(int) R_390_GOTPC];
- case BFD_RELOC_390_GOT16:
- return &elf_howto_table[(int) R_390_GOT16];
- case BFD_RELOC_16_PCREL:
- return &elf_howto_table[(int) R_390_PC16];
- case BFD_RELOC_390_PC16DBL:
- return &elf_howto_table[(int) R_390_PC16DBL];
- case BFD_RELOC_390_PLT16DBL:
- return &elf_howto_table[(int) R_390_PLT16DBL];
- case BFD_RELOC_390_PC32DBL:
- return &elf_howto_table[(int) R_390_PC32DBL];
- case BFD_RELOC_390_PLT32DBL:
- return &elf_howto_table[(int) R_390_PLT32DBL];
- case BFD_RELOC_390_GOTPCDBL:
- return &elf_howto_table[(int) R_390_GOTPCDBL];
- case BFD_RELOC_64:
- return &elf_howto_table[(int) R_390_64];
- case BFD_RELOC_64_PCREL:
- return &elf_howto_table[(int) R_390_PC64];
- case BFD_RELOC_390_GOT64:
- return &elf_howto_table[(int) R_390_GOT64];
- case BFD_RELOC_390_PLT64:
- return &elf_howto_table[(int) R_390_PLT64];
- case BFD_RELOC_390_GOTENT:
- return &elf_howto_table[(int) R_390_GOTENT];
- case BFD_RELOC_16_GOTOFF:
- return &elf_howto_table[(int) R_390_GOTOFF16];
- case BFD_RELOC_390_GOTOFF64:
- return &elf_howto_table[(int) R_390_GOTOFF64];
- case BFD_RELOC_390_GOTPLT12:
- return &elf_howto_table[(int) R_390_GOTPLT12];
- case BFD_RELOC_390_GOTPLT16:
- return &elf_howto_table[(int) R_390_GOTPLT16];
- case BFD_RELOC_390_GOTPLT32:
- return &elf_howto_table[(int) R_390_GOTPLT32];
- case BFD_RELOC_390_GOTPLT64:
- return &elf_howto_table[(int) R_390_GOTPLT64];
- case BFD_RELOC_390_GOTPLTENT:
- return &elf_howto_table[(int) R_390_GOTPLTENT];
- case BFD_RELOC_390_PLTOFF16:
- return &elf_howto_table[(int) R_390_PLTOFF16];
- case BFD_RELOC_390_PLTOFF32:
- return &elf_howto_table[(int) R_390_PLTOFF32];
- case BFD_RELOC_390_PLTOFF64:
- return &elf_howto_table[(int) R_390_PLTOFF64];
- case BFD_RELOC_390_TLS_LOAD:
- return &elf_howto_table[(int) R_390_TLS_LOAD];
- case BFD_RELOC_390_TLS_GDCALL:
- return &elf_howto_table[(int) R_390_TLS_GDCALL];
- case BFD_RELOC_390_TLS_LDCALL:
- return &elf_howto_table[(int) R_390_TLS_LDCALL];
- case BFD_RELOC_390_TLS_GD64:
- return &elf_howto_table[(int) R_390_TLS_GD64];
- case BFD_RELOC_390_TLS_GOTIE12:
- return &elf_howto_table[(int) R_390_TLS_GOTIE12];
- case BFD_RELOC_390_TLS_GOTIE64:
- return &elf_howto_table[(int) R_390_TLS_GOTIE64];
- case BFD_RELOC_390_TLS_LDM64:
- return &elf_howto_table[(int) R_390_TLS_LDM64];
- case BFD_RELOC_390_TLS_IE64:
- return &elf_howto_table[(int) R_390_TLS_IE64];
- case BFD_RELOC_390_TLS_IEENT:
- return &elf_howto_table[(int) R_390_TLS_IEENT];
- case BFD_RELOC_390_TLS_LE64:
- return &elf_howto_table[(int) R_390_TLS_LE64];
- case BFD_RELOC_390_TLS_LDO64:
- return &elf_howto_table[(int) R_390_TLS_LDO64];
- case BFD_RELOC_390_TLS_DTPMOD:
- return &elf_howto_table[(int) R_390_TLS_DTPMOD];
- case BFD_RELOC_390_TLS_DTPOFF:
- return &elf_howto_table[(int) R_390_TLS_DTPOFF];
- case BFD_RELOC_390_TLS_TPOFF:
- return &elf_howto_table[(int) R_390_TLS_TPOFF];
- case BFD_RELOC_390_20:
- return &elf_howto_table[(int) R_390_20];
- case BFD_RELOC_390_GOT20:
- return &elf_howto_table[(int) R_390_GOT20];
- case BFD_RELOC_390_GOTPLT20:
- return &elf_howto_table[(int) R_390_GOTPLT20];
- case BFD_RELOC_390_TLS_GOTIE20:
- return &elf_howto_table[(int) R_390_TLS_GOTIE20];
- case BFD_RELOC_VTABLE_INHERIT:
- return &elf64_s390_vtinherit_howto;
- case BFD_RELOC_VTABLE_ENTRY:
- return &elf64_s390_vtentry_howto;
- default:
- break;
- }
- return 0;
-}
-
-/* We need to use ELF64_R_TYPE so we have our own copy of this function,
- and elf64-s390.c has its own copy. */
-
-static void
-elf_s390_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf_Internal_Rela *dst;
-{
- switch (ELF64_R_TYPE(dst->r_info))
- {
- case R_390_GNU_VTINHERIT:
- cache_ptr->howto = &elf64_s390_vtinherit_howto;
- break;
-
- case R_390_GNU_VTENTRY:
- cache_ptr->howto = &elf64_s390_vtentry_howto;
- break;
-
- default:
- BFD_ASSERT (ELF64_R_TYPE(dst->r_info) < (unsigned int) R_390_max);
- cache_ptr->howto = &elf_howto_table[ELF64_R_TYPE(dst->r_info)];
- }
-}
-
-/* A relocation function which doesn't do anything. */
-static bfd_reloc_status_type
-s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- if (output_bfd)
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
-}
-
-/* Handle the large displacement relocs. */
-static bfd_reloc_status_type
-s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- reloc_howto_type *howto = reloc_entry->howto;
- bfd_vma relocation;
- bfd_vma insn;
-
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
- if (output_bfd != NULL)
- return bfd_reloc_continue;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- relocation = (symbol->value
- + symbol->section->output_section->vma
- + symbol->section->output_offset);
- relocation += reloc_entry->addend;
- if (howto->pc_relative)
- {
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- relocation -= reloc_entry->address;
- }
-
- insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- insn |= (relocation & 0xfff) << 16 | (relocation & 0xff000) >> 4;
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-
- if ((bfd_signed_vma) relocation < - 0x80000
- || (bfd_signed_vma) relocation > 0x7ffff)
- return bfd_reloc_overflow;
- else
- return bfd_reloc_ok;
-}
-
-static bfd_boolean
-elf_s390_is_local_label_name (abfd, name)
- bfd *abfd;
- const char *name;
-{
- if (name[0] == '.' && (name[1] == 'X' || name[1] == 'L'))
- return TRUE;
-
- return _bfd_elf_is_local_label_name (abfd, name);
-}
-
-/* Functions for the 390 ELF linker. */
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-
-/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
- copying dynamic variables from a shared lib into an app's dynbss
- section, and instead use a dynamic relocation to point into the
- shared lib. */
-#define ELIMINATE_COPY_RELOCS 1
-
-/* 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 GOT_ENTRY_SIZE 8
-
-/* The first three entries in a procedure linkage table are reserved,
- and the initial contents are unimportant (we zero them out).
- Subsequent entries look like this. See the SVR4 ABI 386
- supplement to see how this works. */
-
-/* For the s390, simple addr offset can only be 0 - 4096.
- To use the full 16777216 TB address space, several instructions
- 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!!! */
-
-/* The first 3 words in the GOT are then reserved.
- Word 0 is the address of the dynamic table.
- Word 1 is a pointer to a structure describing the object
- Word 2 is used to point to the loader entry address.
-
- The code for PLT entries looks like this:
-
- 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
- The loader must then find the module where the function is
- and insert the address in the GOT.
-
- PLT1: LARL 1,<fn>@GOTENT # 6 bytes Load address of GOT entry in r1
- LG 1,0(1) # 6 bytes Load address from GOT in r1
- BCR 15,1 # 2 bytes Jump to address
- RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
- LGF 1,12(1) # 6 bytes Load offset in symbl table in r1
- BRCL 15,-x # 6 bytes Jump to start of PLT
- .long ? # 4 bytes offset into symbol table
-
- Total = 32 bytes per PLT entry
- Fixup at offset 2: relative address to GOT entry
- Fixup at offset 22: relative branch to PLT0
- Fixup at offset 28: 32 bit offset into symbol table
-
- A 32 bit offset into the symbol table is enough. It allows for symbol
- tables up to a size of 2 gigabyte. A single dynamic object (the main
- program, any shared library) is limited to 4GB in size and I want to see
- 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 (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
- at 12(15), loads the loader address in R1 and jumps to it. */
-
-/* The first entry in the PLT:
-
- PLT0:
- STG 1,56(15) # r1 contains the offset into the symbol table
- LARL 1,_GLOBAL_OFFSET_TABLE # load address of global offset table
- MVC 48(8,15),8(1) # move loader ino (object struct address) to stack
- LG 1,16(1) # get entry address of loader
- BCR 15,1 # jump to loader
-
- Fixup at offset 8: relative address to start of GOT. */
-
-#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 as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct elf_s390_dyn_relocs
-{
- struct elf_s390_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
-
-/* s390 ELF linker hash entry. */
-
-struct elf_s390_link_hash_entry
-{
- struct elf_link_hash_entry elf;
-
- /* Track dynamic relocs copied for this symbol. */
- struct elf_s390_dyn_relocs *dyn_relocs;
-
- /* Number of GOTPLT references for a function. */
- bfd_signed_vma gotplt_refcount;
-
-#define GOT_UNKNOWN 0
-#define GOT_NORMAL 1
-#define GOT_TLS_GD 2
-#define GOT_TLS_IE 3
-#define GOT_TLS_IE_NLT 3
- unsigned char tls_type;
-};
-
-#define elf_s390_hash_entry(ent) \
- ((struct elf_s390_link_hash_entry *)(ent))
-
-struct elf_s390_obj_tdata
-{
- struct elf_obj_tdata root;
-
- /* tls_type for each local got entry. */
- char *local_got_tls_type;
-};
-
-#define elf_s390_tdata(abfd) \
- ((struct elf_s390_obj_tdata *) (abfd)->tdata.any)
-
-#define elf_s390_local_got_tls_type(abfd) \
- (elf_s390_tdata (abfd)->local_got_tls_type)
-
-static bfd_boolean
-elf_s390_mkobject (abfd)
- bfd *abfd;
-{
- bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-elf_s390_object_p (abfd)
- bfd *abfd;
-{
- /* Set the right machine number for an s390 elf32 file. */
- return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64);
-}
-
-/* s390 ELF linker hash table. */
-
-struct elf_s390_link_hash_table
-{
- struct elf_link_hash_table elf;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
- asection *sdynbss;
- asection *srelbss;
-
- union {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } tls_ldm_got;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-};
-
-/* Get the s390 ELF linker hash table from a link_info structure. */
-
-#define elf_s390_hash_table(p) \
- ((struct elf_s390_link_hash_table *) ((p)->hash))
-
-/* Create an entry in an s390 ELF linker hash table. */
-
-static struct bfd_hash_entry *
-link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table,
- sizeof (struct elf_s390_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct elf_s390_link_hash_entry *eh;
-
- eh = (struct elf_s390_link_hash_entry *) entry;
- eh->dyn_relocs = NULL;
- eh->gotplt_refcount = 0;
- eh->tls_type = GOT_UNKNOWN;
- }
-
- return entry;
-}
-
-/* Create an s390 ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-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_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- ret->sgot = NULL;
- ret->sgotplt = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->tls_ldm_got.refcount = 0;
- ret->sym_sec.abfd = NULL;
-
- return &ret->elf.root;
-}
-
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf_s390_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- if (!htab->sgot || !htab->sgotplt)
- abort ();
-
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
- if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
- return FALSE;
- return TRUE;
-}
-
-/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
- .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
- hash table. */
-
-static bfd_boolean
-elf_s390_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
-
- htab = elf_s390_hash_table (info);
- if (!htab->sgot && !create_got_section (dynobj, info))
- return FALSE;
-
- if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
- htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
- htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
- if (!info->shared)
- htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
-
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
- abort ();
-
- return TRUE;
-}
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-elf_s390_copy_indirect_symbol (bed, dir, ind)
- const struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
-{
- struct elf_s390_link_hash_entry *edir, *eind;
-
- edir = (struct elf_s390_link_hash_entry *) dir;
- eind = (struct elf_s390_link_hash_entry *) ind;
-
- if (eind->dyn_relocs != NULL)
- {
- if (edir->dyn_relocs != NULL)
- {
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
-
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
- {
- struct elf_s390_dyn_relocs *q;
-
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
- if (q->sec == p->sec)
- {
- q->pc_count += p->pc_count;
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->dyn_relocs;
- }
-
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
-
- if (ind->root.type == bfd_link_hash_indirect
- && dir->got.refcount <= 0)
- {
- edir->tls_type = eind->tls_type;
- eind->tls_type = GOT_UNKNOWN;
- }
-
- if (ELIMINATE_COPY_RELOCS
- && ind->root.type != bfd_link_hash_indirect
- && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- dir->elf_link_hash_flags |=
- (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_HASH_NEEDS_PLT));
- else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-}
-
-static int
-elf_s390_tls_transition (info, r_type, is_local)
- struct bfd_link_info *info;
- int r_type;
- int is_local;
-{
- if (info->shared)
- return r_type;
-
- switch (r_type)
- {
- case R_390_TLS_GD64:
- case R_390_TLS_IE64:
- if (is_local)
- return R_390_TLS_LE64;
- return R_390_TLS_IE64;
- case R_390_TLS_GOTIE64:
- if (is_local)
- return R_390_TLS_LE64;
- return R_390_TLS_GOTIE64;
- case R_390_TLS_LDM64:
- return R_390_TLS_LE64;
- }
-
- return r_type;
-}
-
-/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table or procedure linkage
- table. */
-
-static bfd_boolean
-elf_s390_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- struct elf_s390_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sreloc;
- bfd_signed_vma *local_got_refcounts;
- int tls_type, old_tls_type;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf_s390_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- sreloc = NULL;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned int r_type;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
-
- if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
- r_symndx);
- return FALSE;
- }
-
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- /* Create got section and local_got_refcounts array if they
- are needed. */
- r_type = elf_s390_tls_transition (info,
- ELF64_R_TYPE (rel->r_info),
- h == NULL);
- switch (r_type)
- {
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOT64:
- case R_390_GOTENT:
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLT64:
- case R_390_GOTPLTENT:
- case R_390_TLS_GD64:
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_GOTIE64:
- case R_390_TLS_IEENT:
- case R_390_TLS_IE64:
- case R_390_TLS_LDM64:
- if (h == NULL
- && local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma) + sizeof(char));
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- elf_s390_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + symtab_hdr->sh_info);
- }
- /* Fall through. */
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- case R_390_GOTOFF64:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- if (htab->sgot == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
- return FALSE;
- }
- }
-
- switch (r_type)
- {
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- case R_390_GOTOFF64:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- /* Got is created, nothing to be done. */
- break;
-
- case R_390_PLT16DBL:
- case R_390_PLT32:
- case R_390_PLT32DBL:
- case R_390_PLT64:
- case R_390_PLTOFF16:
- case R_390_PLTOFF32:
- case R_390_PLTOFF64:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
-
- /* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
- if (h != NULL)
- {
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- }
- break;
-
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLT64:
- case R_390_GOTPLTENT:
- /* This symbol requires either a procedure linkage table entry
- or an entry in the local got. We actually build the entry
- in adjust_dynamic_symbol because whether this is really a
- global reference can change and with it the fact if we have
- to create a plt entry or a local got entry. To be able to
- make a once global symbol a local one we have to keep track
- of the number of gotplt references that exist for this
- symbol. */
- if (h != NULL)
- {
- ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- }
- else
- local_got_refcounts[r_symndx] += 1;
- break;
-
- case R_390_TLS_LDM64:
- htab->tls_ldm_got.refcount += 1;
- break;
-
- case R_390_TLS_IE64:
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_GOTIE64:
- case R_390_TLS_IEENT:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- /* Fall through */
-
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOT64:
- case R_390_GOTENT:
- case R_390_TLS_GD64:
- /* This symbol requires a global offset table entry. */
- switch (r_type)
- {
- default:
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOTENT:
- tls_type = GOT_NORMAL;
- break;
- case R_390_TLS_GD64:
- tls_type = GOT_TLS_GD;
- break;
- case R_390_TLS_IE64:
- case R_390_TLS_GOTIE64:
- tls_type = GOT_TLS_IE;
- break;
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_IEENT:
- tls_type = GOT_TLS_IE_NLT;
- break;
- }
-
- if (h != NULL)
- {
- h->got.refcount += 1;
- old_tls_type = elf_s390_hash_entry(h)->tls_type;
- }
- else
- {
- local_got_refcounts[r_symndx] += 1;
- old_tls_type = elf_s390_local_got_tls_type (abfd) [r_symndx];
- }
- /* If a TLS symbol is accessed using IE at least once,
- there is no point to use dynamic model for it. */
- if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN)
- {
- if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL)
- {
- (*_bfd_error_handler)
- (_("%s: `%s' accessed both as normal and thread local symbol"),
- bfd_archive_filename (abfd), h->root.root.string);
- return FALSE;
- }
- if (old_tls_type > tls_type)
- tls_type = old_tls_type;
- }
-
- if (old_tls_type != tls_type)
- {
- if (h != NULL)
- elf_s390_hash_entry (h)->tls_type = tls_type;
- else
- elf_s390_local_got_tls_type (abfd) [r_symndx] = tls_type;
- }
-
- if (r_type != R_390_TLS_IE64)
- break;
- /* Fall through */
-
- case R_390_TLS_LE64:
- if (!info->shared)
- break;
- info->flags |= DF_STATIC_TLS;
- /* Fall through */
-
- case R_390_8:
- case R_390_16:
- case R_390_32:
- case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32:
- case R_390_PC32DBL:
- case R_390_PC64:
- if (h != NULL && !info->shared)
- {
- /* If this reloc is in a read-only section, we might
- need a copy reloc. We can't check reliably at this
- stage whether the section is read-only, as input
- sections have not yet been mapped to output sections.
- Tentatively set the flag for now, and correct in
- adjust_dynamic_symbol. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- /* We may need a .plt entry if the function this reloc
- refers to is in a shared lib. */
- h->plt.refcount += 1;
- }
-
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). In case of a weak definition,
- DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
- storing information in the relocs_copied field of the hash
- table entry. A similar situation occurs when creating
- shared libraries and symbol visibility changes render the
- symbol local.
-
- If on the other hand, we are creating an executable, we
- may need to keep relocations for symbols satisfied by a
- dynamic library if we manage to avoid copy relocs for the
- symbol. */
- if ((info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && ((ELF64_R_TYPE (rel->r_info) != R_390_PC16
- && ELF64_R_TYPE (rel->r_info) != R_390_PC16DBL
- && ELF64_R_TYPE (rel->r_info) != R_390_PC32
- && ELF64_R_TYPE (rel->r_info) != R_390_PC32DBL
- && ELF64_R_TYPE (rel->r_info) != R_390_PC64)
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- struct elf_s390_dyn_relocs *p;
- struct elf_s390_dyn_relocs **head;
-
- /* We must copy these reloc types into the output file.
- Create a reloc section in dynobj and make room for
- this reloc. */
- if (sreloc == NULL)
- {
- const char *name;
- bfd *dynobj;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- if (strncmp (name, ".rela", 5) != 0
- || strcmp (bfd_get_section_name (abfd, sec),
- name + 5) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
- }
-
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
-
- dynobj = htab->elf.dynobj;
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return FALSE;
- }
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- {
- head = &((struct elf_s390_link_hash_entry *) h)->dyn_relocs;
- }
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
-
- asection *s;
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct elf_s390_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->sec != sec)
- {
- bfd_size_type amt = sizeof *p;
- p = ((struct elf_s390_dyn_relocs *)
- bfd_alloc (htab->elf.dynobj, amt));
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
- }
-
- p->count += 1;
- if (ELF64_R_TYPE (rel->r_info) == R_390_PC16
- || ELF64_R_TYPE (rel->r_info) == R_390_PC16DBL
- || ELF64_R_TYPE (rel->r_info) == R_390_PC32
- || ELF64_R_TYPE (rel->r_info) == R_390_PC32DBL
- || ELF64_R_TYPE (rel->r_info) == R_390_PC64)
- p->pc_count += 1;
- }
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_390_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_390_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return FALSE;
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-elf_s390_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- if (h != NULL)
- {
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_390_GNU_VTINHERIT:
- case R_390_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h = NULL;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct elf_s390_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- r_type = ELF64_R_TYPE (rel->r_info);
- r_type = elf_s390_tls_transition (info, r_type, h != NULL);
- switch (r_type)
- {
- case R_390_TLS_LDM64:
- if (elf_s390_hash_table (info)->tls_ldm_got.refcount > 0)
- elf_s390_hash_table (info)->tls_ldm_got.refcount -= 1;
- break;
-
- case R_390_TLS_GD64:
- case R_390_TLS_IE64:
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_GOTIE64:
- case R_390_TLS_IEENT:
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOT64:
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- case R_390_GOTOFF64:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- case R_390_GOTENT:
- if (h != NULL)
- {
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- case R_390_8:
- case R_390_12:
- case R_390_16:
- case R_390_20:
- case R_390_32:
- case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32:
- case R_390_PC32DBL:
- case R_390_PC64:
- if (info->shared)
- break;
- /* Fall through */
-
- case R_390_PLT16DBL:
- case R_390_PLT32:
- case R_390_PLT32DBL:
- case R_390_PLT64:
- case R_390_PLTOFF16:
- case R_390_PLTOFF32:
- case R_390_PLTOFF64:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
-
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLT64:
- case R_390_GOTPLTENT:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- {
- ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount--;
- h->plt.refcount -= 1;
- }
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
- entry but we found we will not create any. Called when we find we will
- not have any PLT for this symbol, by for example
- elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link,
- or elf_s390_size_dynamic_sections if no dynamic sections will be
- created (we're only linking static objects). */
-
-static void
-elf_s390_adjust_gotplt (h)
- struct elf_s390_link_hash_entry *h;
-{
- if (h->elf.root.type == bfd_link_hash_warning)
- h = (struct elf_s390_link_hash_entry *) h->elf.root.u.i.link;
-
- if (h->gotplt_refcount <= 0)
- return;
-
- /* We simply add the number of gotplt references to the number
- * of got references for this symbol. */
- h->elf.got.refcount += h->gotplt_refcount;
- h->gotplt_refcount = -1;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-elf_s390_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
-{
- struct elf_s390_link_hash_table *htab;
- asection *s;
- unsigned int power_of_two;
-
- /* If this is a function, put it in the procedure linkage table. We
- will fill in the contents of the procedure linkage table later
- (although we could actually do it here). */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- if (h->plt.refcount <= 0
- || (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
- && h->root.type != bfd_link_hash_undefweak
- && h->root.type != bfd_link_hash_undefined))
- {
- /* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
- such a case, we don't actually need to build a procedure
- linkage table, and we can just do a PC32 reloc instead. */
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
- }
-
- return TRUE;
- }
- else
- /* It's possible that we incorrectly decided a .plt reloc was
- needed for an R_390_PC32 reloc to a non-function sym in
- check_relocs. We can't decide accurately between function and
- non-function syms in check-relocs; Objects loaded later in
- the link may change h->type. So fix it now. */
- h->plt.offset = (bfd_vma) -1;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
- h->elf_link_hash_flags
- = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
- | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* If there are no references to this symbol that do not use the
- GOT, we don't need to generate a copy reloc. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
- return TRUE;
-
- /* If -z nocopyreloc was given, we won't generate them either. */
- if (info->nocopyreloc)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
-
- if (ELIMINATE_COPY_RELOCS)
- {
- struct elf_s390_link_hash_entry * eh;
- struct elf_s390_dyn_relocs *p;
-
- eh = (struct elf_s390_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
-
- /* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
- if (p == NULL)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
- }
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
-
- htab = elf_s390_hash_table (info);
-
- /* We must generate a R_390_COPY reloc to tell the dynamic linker to
- copy the initial value out of the dynamic object and into the
- runtime process image. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- htab->srelbss->_raw_size += sizeof (Elf64_External_Rela);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s = htab->sdynbss;
- s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Allocate space in .plt, .got and associated reloc sections for
- dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
-{
- struct bfd_link_info *info;
- struct elf_s390_link_hash_table *htab;
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- info = (struct bfd_link_info *) inf;
- htab = elf_s390_hash_table (info);
-
- if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
- {
- asection *s = htab->splt;
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_FIRST_ENTRY_SIZE;
-
- h->plt.offset = s->_raw_size;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- htab->sgotplt->_raw_size += GOT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
- }
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
- }
-
- /* If R_390_TLS_{IE64,GOTIE64,GOTIE12,IEENT} symbol is now local to
- the binary, we can optimize a bit. IE64 and GOTIE64 get converted
- to R_390_TLS_LE64 requiring no TLS entry. For GOTIE12 and IEENT
- we can save the dynamic TLS relocation. */
- if (h->got.refcount > 0
- && !info->shared
- && h->dynindx == -1
- && elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
- {
- if (elf_s390_hash_entry(h)->tls_type == GOT_TLS_IE_NLT)
- /* For the GOTIE access without a literal pool entry the offset has
- to be stored somewhere. The immediate value in the instruction
- is not bit enough so the value is stored in the got. */
- {
- h->got.offset = htab->sgot->_raw_size;
- htab->sgot->_raw_size += GOT_ENTRY_SIZE;
- }
- else
- h->got.offset = (bfd_vma) -1;
- }
- else if (h->got.refcount > 0)
- {
- asection *s;
- bfd_boolean dyn;
- int tls_type = elf_s390_hash_entry(h)->tls_type;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
- /* R_390_TLS_GD64 needs 2 consecutive GOT slots. */
- if (tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
- dyn = htab->elf.dynamic_sections_created;
- /* R_390_TLS_IE64 needs one dynamic relocation,
- R_390_TLS_GD64 needs one if local symbol and two if global. */
- if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
- || tls_type >= GOT_TLS_IE)
- htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
- else if (tls_type == GOT_TLS_GD)
- htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
- else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
- htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- eh = (struct elf_s390_link_hash_entry *) h;
- if (eh->dyn_relocs == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for pc-relative relocs that have become local due to symbol
- visibility changes. */
-
- if (info->shared)
- {
- if (SYMBOL_REFERENCES_LOCAL (info, h))
- {
- struct elf_s390_dyn_relocs **pp;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
- {
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
- else
- pp = &p->next;
- }
- }
-
- /* Also discard relocs on undefined weak syms with non-default
- visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
- }
- else if (ELIMINATE_COPY_RELOCS)
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || (htab->elf.dynamic_sections_created
- && (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->dyn_relocs = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela);
- }
-
- return TRUE;
-}
-
-/* Find any dynamic relocs that apply to read-only sections. */
-
-static bfd_boolean
-readonly_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
-{
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- eh = (struct elf_s390_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
-
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- {
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
- info->flags |= DF_TEXTREL;
-
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-elf_s390_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
- bfd *dynobj;
- asection *s;
- bfd_boolean relocs;
- bfd *ibfd;
-
- htab = elf_s390_hash_table (info);
- dynobj = htab->elf.dynobj;
- if (dynobj == NULL)
- abort ();
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- if (s == NULL)
- abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
- char *local_tls_type;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srela;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct elf_s390_dyn_relocs *p;
-
- for (p = *((struct elf_s390_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- srela = elf_section_data (p->sec)->sreloc;
- srela->_raw_size += p->count * sizeof (Elf64_External_Rela);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
- }
- }
- }
-
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_local_got = local_got + locsymcount;
- local_tls_type = elf_s390_local_got_tls_type (ibfd);
- s = htab->sgot;
- srela = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
- {
- if (*local_got > 0)
- {
- *local_got = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
- if (*local_tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
- if (info->shared)
- srela->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- *local_got = (bfd_vma) -1;
- }
- }
-
- if (htab->tls_ldm_got.refcount > 0)
- {
- /* Allocate 2 got entries and 1 dynamic reloc for R_390_TLS_LDM64
- relocs. */
- htab->tls_ldm_got.offset = htab->sgot->_raw_size;
- htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE;
- htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- htab->tls_ldm_got.offset = -1;
-
- /* Allocate global sym .plt and .got entries, and space for global
- sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
-
- /* We now have determined the sizes of the various dynamic sections.
- Allocate memory for them. */
- relocs = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- }
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
- {
- if (s->_raw_size != 0 && s != htab->srelplt)
- relocs = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- else
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is to handle .rela.bss and
- .rela.plt. We must create it in
- create_dynamic_sections, because it must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
-
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. We use bfd_zalloc
- here in case unused entries are not reclaimed before the
- section's contents are written out. This should not happen,
- but this way if it does, we get a R_390_NONE reloc instead
- of garbage. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in elf_s390_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->splt->_raw_size != 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 (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
- return FALSE;
-
- /* If any dynamic relocs apply to a read-only section,
- then we need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
- (PTR) info);
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-/* Return the base VMA address which should be subtracted from real addresses
- when resolving @dtpoff relocation.
- This is PT_TLS segment p_vaddr. */
-
-static bfd_vma
-dtpoff_base (info)
- struct bfd_link_info *info;
-{
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (elf_hash_table (info)->tls_sec == NULL)
- return 0;
- return elf_hash_table (info)->tls_sec->vma;
-}
-
-/* Return the relocation value for @tpoff relocation
- if STT_TLS virtual address is ADDRESS. */
-
-static bfd_vma
-tpoff (info, address)
- struct bfd_link_info *info;
- bfd_vma address;
-{
- struct elf_link_hash_table *htab = elf_hash_table (info);
-
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (htab->tls_sec == NULL)
- return 0;
- return htab->tls_size + htab->tls_sec->vma - address;
-}
-
-/* Complain if TLS instruction relocation is against an invalid
- instruction. */
-
-static void
-invalid_tls_insn (input_bfd, input_section, rel)
- bfd *input_bfd;
- asection *input_section;
- Elf_Internal_Rela *rel;
-{
- reloc_howto_type *howto;
-
- howto = elf_howto_table + ELF64_R_TYPE (rel->r_info);
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- howto->name);
-}
-
-/* Relocate a 390 ELF section. */
-
-static bfd_boolean
-elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- struct elf_s390_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf_s390_hash_table (info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- unsigned int r_type;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sec;
- bfd_vma off;
- bfd_vma relocation;
- bfd_boolean unresolved_reloc;
- bfd_reloc_status_type r;
- int tls_type;
-
- r_type = ELF64_R_TYPE (rel->r_info);
- if (r_type == (int) R_390_GNU_VTINHERIT
- || r_type == (int) R_390_GNU_VTENTRY)
- continue;
- if (r_type >= (int) R_390_max)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- howto = elf_howto_table + r_type;
- r_symndx = ELF64_R_SYM (rel->r_info);
-
- /* This is a final link. */
- h = NULL;
- sym = NULL;
- sec = NULL;
- unresolved_reloc = FALSE;
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- }
- else
- {
- bfd_boolean warned ATTRIBUTE_UNUSED;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
- }
-
- switch (r_type)
- {
- case R_390_GOTPLT12:
- case R_390_GOTPLT16:
- case R_390_GOTPLT20:
- case R_390_GOTPLT32:
- case R_390_GOTPLT64:
- case R_390_GOTPLTENT:
- /* There are three cases for a GOTPLT relocation. 1) The
- relocation is against the jump slot entry of a plt that
- will get emitted to the output file. 2) The relocation
- is against the jump slot of a plt entry that has been
- removed. elf_s390_adjust_gotplt has created a GOT entry
- as replacement. 3) The relocation is against a local symbol.
- Cases 2) and 3) are the same as the GOT relocation code
- so we just have to test for case 1 and fall through for
- the other two. */
- if (h != NULL && h->plt.offset != (bfd_vma) -1)
- {
- bfd_vma plt_index;
-
- /* Calc. index no.
- Current offset - size first entry / entry size. */
- plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
- PLT_ENTRY_SIZE;
-
- /* Offset in GOT is PLT index plus GOT headers(3) times 4,
- addr & GOT addr. */
- relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
- unresolved_reloc = FALSE;
-
- if (r_type == R_390_GOTPLTENT)
- relocation += htab->sgot->output_section->vma;
- break;
- }
- /* Fall through. */
-
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT20:
- case R_390_GOT32:
- case R_390_GOT64:
- case R_390_GOTENT:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- {
- bfd_boolean dyn;
-
- off = h->got.offset;
- dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- || (ELF_ST_VISIBILITY (h->other)
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally, or the symbol was forced to be local
- because of a version file. We must initialize
- this entry in the global offset table. Since the
- offset must always be a multiple of 2, we use the
- least significant bit to record whether we have
- initialized it already.
-
- When doing a dynamic link, we create a .rel.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
- else
- unresolved_reloc = FALSE;
- }
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
-
- /* The offset must always be a multiple of 8. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
-
- if (info->shared)
- {
- asection *s;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- s = htab->srelgot;
- if (s == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
- outrel.r_addend = relocation;
- loc = s->contents;
- loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
-
- local_got_offsets[r_symndx] |= 1;
- }
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
-
- relocation = htab->sgot->output_offset + off;
-
- /* For @GOTENT the relocation is against the offset between
- the instruction and the symbols entry in the GOT and not
- between the start of the GOT and the symbols entry. We
- add the vma of the GOT to get the correct value. */
- if ( r_type == R_390_GOTENT
- || r_type == R_390_GOTPLTENT)
- relocation += htab->sgot->output_section->vma;
-
- break;
-
- case R_390_GOTOFF16:
- case R_390_GOTOFF32:
- case R_390_GOTOFF64:
- /* Relocation is relative to the start of the global offset
- table. */
-
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- defined _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- relocation -= htab->sgot->output_section->vma;
- break;
-
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- /* Use global offset table as symbol value. */
- relocation = htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- break;
-
- case R_390_PLT16DBL:
- case R_390_PLT32:
- case R_390_PLT32DBL:
- case R_390_PLT64:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
-
- if (h->plt.offset == (bfd_vma) -1
- || htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = FALSE;
- break;
-
- case R_390_PLTOFF16:
- case R_390_PLTOFF32:
- case R_390_PLTOFF64:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table relative to the start of the GOT. */
-
- /* For local symbols or if we didn't make a PLT entry for
- this symbol resolve the symbol directly. */
- if ( h == NULL
- || h->plt.offset == (bfd_vma) -1
- || htab->splt == NULL)
- {
- relocation -= htab->sgot->output_section->vma;
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset
- - htab->sgot->output_section->vma);
- unresolved_reloc = FALSE;
- break;
-
- case R_390_8:
- case R_390_16:
- case R_390_32:
- case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32:
- case R_390_PC32DBL:
- case R_390_PC64:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
- break;
-
- if ((info->shared
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && ((r_type != R_390_PC16
- && r_type != R_390_PC16DBL
- && r_type != R_390_PC32
- && r_type != R_390_PC32DBL
- && r_type != R_390_PC64)
- || (h != NULL
- && !SYMBOL_REFERENCES_LOCAL (info, h))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && h != NULL
- && h->dynindx != -1
- && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- bfd_boolean skip, relocate;
- asection *sreloc;
- bfd_byte *loc;
-
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
- skip = FALSE;
- relocate = FALSE;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
-
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
- && h->dynindx != -1
- && (r_type == R_390_PC16
- || r_type == R_390_PC16DBL
- || r_type == R_390_PC32
- || r_type == R_390_PC32DBL
- || r_type == R_390_PC64
- || !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
- outrel.r_addend = rel->r_addend;
- }
- else
- {
- /* This symbol is local, or marked to become local. */
- outrel.r_addend = relocation + rel->r_addend;
- if (r_type == R_390_64)
- {
- relocate = TRUE;
- outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
- }
- else
- {
- long sindx;
-
- if (bfd_is_abs_section (sec))
- sindx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error(bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- asection *osec;
-
- osec = sec->output_section;
- sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
-
- /* We are turning this relocation into one
- against a section symbol, so subtract out
- the output section's address but not the
- offset of the input section in the output
- section. */
-
- outrel.r_addend -= osec->vma;
- }
- outrel.r_info = ELF64_R_INFO (sindx, r_type);
- }
- }
-
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
-
- /* If this reloc is against an external symbol, we do
- not want to fiddle with the addend. Otherwise, we
- need to include the symbol value so that it becomes
- an addend for the dynamic reloc. */
- if (! relocate)
- continue;
- }
-
- break;
-
- /* Relocations for tls literal pool entries. */
- case R_390_TLS_IE64:
- if (info->shared)
- {
- Elf_Internal_Rela outrel;
- asection *sreloc;
- bfd_byte *loc;
-
- outrel.r_offset = rel->r_offset
- + input_section->output_section->vma
- + input_section->output_offset;
- outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloc_out (output_bfd, &outrel, loc);
- }
- /* Fall through. */
-
- case R_390_TLS_GD64:
- case R_390_TLS_GOTIE64:
- r_type = elf_s390_tls_transition (info, r_type, h == NULL);
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- {
- tls_type = elf_s390_hash_entry(h)->tls_type;
- if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
- r_type = R_390_TLS_LE64;
- }
- if (r_type == R_390_TLS_GD64 && tls_type >= GOT_TLS_IE)
- r_type = R_390_TLS_IE64;
-
- if (r_type == R_390_TLS_LE64)
- {
- /* This relocation gets optimized away by the local exec
- access optimization. */
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_64 (output_bfd, -tpoff (info, relocation),
- contents + rel->r_offset);
- continue;
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- off = h->got.offset;
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
- }
-
- emit_tls_relocs:
-
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- int dr_type, indx;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- indx = h && h->dynindx != -1 ? h->dynindx : 0;
- if (r_type == R_390_TLS_GD64)
- dr_type = R_390_TLS_DTPMOD;
- else
- dr_type = R_390_TLS_TPOFF;
- if (dr_type == R_390_TLS_TPOFF && indx == 0)
- outrel.r_addend = relocation - dtpoff_base (info);
- else
- outrel.r_addend = 0;
- outrel.r_info = ELF64_R_INFO (indx, dr_type);
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++
- * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
-
- if (r_type == R_390_TLS_GD64)
- {
- if (indx == 0)
- {
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_64 (output_bfd,
- relocation - dtpoff_base (info),
- htab->sgot->contents + off + GOT_ENTRY_SIZE);
- }
- else
- {
- outrel.r_info = ELF64_R_INFO (indx, R_390_TLS_DTPOFF);
- outrel.r_offset += GOT_ENTRY_SIZE;
- outrel.r_addend = 0;
- htab->srelgot->reloc_count++;
- loc += sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
- }
-
- if (h != NULL)
- h->got.offset |= 1;
- else
- local_got_offsets[r_symndx] |= 1;
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
- if (r_type == ELF64_R_TYPE (rel->r_info))
- {
- relocation = htab->sgot->output_offset + off;
- if (r_type == R_390_TLS_IE64 || r_type == R_390_TLS_IEENT)
- relocation += htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- }
- else
- {
- bfd_put_64 (output_bfd, htab->sgot->output_offset + off,
- contents + rel->r_offset);
- continue;
- }
- break;
-
- case R_390_TLS_GOTIE12:
- case R_390_TLS_GOTIE20:
- case R_390_TLS_IEENT:
- if (h == NULL)
- {
- if (local_got_offsets == NULL)
- abort();
- off = local_got_offsets[r_symndx];
- if (info->shared)
- goto emit_tls_relocs;
- }
- else
- {
- off = h->got.offset;
- tls_type = elf_s390_hash_entry(h)->tls_type;
- if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE)
- goto emit_tls_relocs;
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_64 (output_bfd, -tpoff (info, relocation),
- htab->sgot->contents + off);
- relocation = htab->sgot->output_offset + off;
- if (r_type == R_390_TLS_IEENT)
- relocation += htab->sgot->output_section->vma;
- unresolved_reloc = FALSE;
- break;
-
- case R_390_TLS_LDM64:
- if (! info->shared)
- /* The literal pool entry this relocation refers to gets ignored
- by the optimized code of the local exec model. Do nothing
- and the value will turn out zero. */
- continue;
-
- if (htab->sgot == NULL)
- abort ();
-
- off = htab->tls_ldm_got.offset;
- if (off & 1)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- bfd_put_64 (output_bfd, 0,
- htab->sgot->contents + off + GOT_ENTRY_SIZE);
- outrel.r_info = ELF64_R_INFO (0, R_390_TLS_DTPMOD);
- outrel.r_addend = 0;
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++
- * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- htab->tls_ldm_got.offset |= 1;
- }
- relocation = htab->sgot->output_offset + off;
- unresolved_reloc = FALSE;
- break;
-
- case R_390_TLS_LE64:
- if (info->shared)
- {
- /* Linking a shared library with non-fpic code requires
- a R_390_TLS_TPOFF relocation. */
- Elf_Internal_Rela outrel;
- asection *sreloc;
- bfd_byte *loc;
- int indx;
-
- outrel.r_offset = rel->r_offset
- + input_section->output_section->vma
- + input_section->output_offset;
- if (h != NULL && h->dynindx != -1)
- indx = h->dynindx;
- else
- indx = 0;
- outrel.r_info = ELF64_R_INFO (indx, R_390_TLS_TPOFF);
- if (indx == 0)
- outrel.r_addend = relocation - dtpoff_base (info);
- else
- outrel.r_addend = 0;
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
- else
- {
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_64 (output_bfd, -tpoff (info, relocation),
- contents + rel->r_offset);
- }
- continue;
-
- case R_390_TLS_LDO64:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
- relocation -= dtpoff_base (info);
- else
- /* When converting LDO to LE, we must negate. */
- relocation = -tpoff (info, relocation);
- break;
-
- /* Relocations for tls instructions. */
- case R_390_TLS_LOAD:
- case R_390_TLS_GDCALL:
- case R_390_TLS_LDCALL:
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- tls_type = elf_s390_hash_entry(h)->tls_type;
-
- if (tls_type == GOT_TLS_GD)
- continue;
-
- if (r_type == R_390_TLS_LOAD)
- {
- if (!info->shared && (h == NULL || h->dynindx == -1))
- {
- /* IE->LE transition. Four valid cases:
- lg %rx,(0,%ry) -> sllg %rx,%ry,0
- lg %rx,(%ry,0) -> sllg %rx,%ry,0
- lg %rx,(%ry,%r12) -> sllg %rx,%ry,0
- lg %rx,(%r12,%ry) -> sllg %rx,%ry,0 */
- unsigned int insn0, insn1, ry;
-
- insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
- insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
- if (insn1 != 0x0004)
- invalid_tls_insn (input_bfd, input_section, rel);
- ry = 0;
- if ((insn0 & 0xff00f000) == 0xe3000000)
- /* lg %rx,0(%ry,0) -> sllg %rx,%ry,0 */
- ry = (insn0 & 0x000f0000);
- else if ((insn0 & 0xff0f0000) == 0xe3000000)
- /* lg %rx,0(0,%ry) -> sllg %rx,%ry,0 */
- ry = (insn0 & 0x0000f000) << 4;
- else if ((insn0 & 0xff00f000) == 0xe300c000)
- /* lg %rx,0(%ry,%r12) -> sllg %rx,%ry,0 */
- ry = (insn0 & 0x000f0000);
- else if ((insn0 & 0xff0f0000) == 0xe30c0000)
- /* lg %rx,0(%r12,%ry) -> sllg %rx,%ry,0 */
- ry = (insn0 & 0x0000f000) << 4;
- else
- invalid_tls_insn (input_bfd, input_section, rel);
- insn0 = 0xeb000000 | (insn0 & 0x00f00000) | ry;
- insn1 = 0x000d;
- bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
- bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4);
- }
- }
- else if (r_type == R_390_TLS_GDCALL)
- {
- unsigned int insn0, insn1;
-
- insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
- insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
- if ((insn0 & 0xffff0000) != 0xc0e50000)
- invalid_tls_insn (input_bfd, input_section, rel);
- if (!info->shared && (h == NULL || h->dynindx == -1))
- {
- /* GD->LE transition.
- brasl %r14,__tls_get_addr@plt -> brcl 0,. */
- insn0 = 0xc0040000;
- insn1 = 0x0000;
- }
- else
- {
- /* GD->IE transition.
- brasl %r14,__tls_get_addr@plt -> lg %r2,0(%r2,%r12) */
- insn0 = 0xe322c000;
- insn1 = 0x0004;
- }
- bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
- bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4);
- }
- else if (r_type == R_390_TLS_LDCALL)
- {
- if (!info->shared)
- {
- unsigned int insn0, insn1;
-
- insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
- insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
- if ((insn0 & 0xffff0000) != 0xc0e50000)
- invalid_tls_insn (input_bfd, input_section, rel);
- /* LD->LE transition.
- brasl %r14,__tls_get_addr@plt -> brcl 0,. */
- insn0 = 0xc0040000;
- insn1 = 0x0000;
- bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
- bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4);
- }
- }
- continue;
-
- default:
- break;
- }
-
- /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
- because such sections are not SEC_ALLOC and thus ld.so will
- not process them. */
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- h->root.root.string);
-
- if (r_type == R_390_20
- || r_type == R_390_GOT20
- || r_type == R_390_GOTPLT20
- || r_type == R_390_TLS_GOTIE20)
- {
- relocation += rel->r_addend;
- relocation = (relocation&0xfff) << 8 | (relocation&0xff000) >> 12;
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, 0);
- }
- else
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, rel->r_addend);
-
- if (r != bfd_reloc_ok)
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
-
- if (r == bfd_reloc_overflow)
- {
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): reloc against `%s': error %d"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset, name, (int) r);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- struct elf_s390_link_hash_table *htab;
-
- htab = elf_s390_hash_table (info);
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- bfd_vma plt_index;
- bfd_vma got_offset;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
- if (h->dynindx == -1
- || htab->splt == NULL
- || htab->sgotplt == NULL
- || htab->srelplt == NULL)
- abort ();
-
- /* Calc. index no.
- Current offset - size first entry / entry size. */
- plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
-
- /* Offset in GOT is PLT index plus GOT headers(3) times 8,
- addr & GOT addr. */
- got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
-
- /* Fill in the blueprint of a PLT. */
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0,
- htab->splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD1,
- htab->splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD2,
- htab->splt->contents + h->plt.offset + 8);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD3,
- htab->splt->contents + h->plt.offset + 12);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD4,
- htab->splt->contents + h->plt.offset + 16);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD5,
- htab->splt->contents + h->plt.offset + 20);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD6,
- htab->splt->contents + h->plt.offset + 24);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD7,
- htab->splt->contents + h->plt.offset + 28);
- /* Fixup the relative address to the GOT entry */
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma +
- htab->sgotplt->output_offset + got_offset
- - (htab->splt->output_section->vma + h->plt.offset))/2,
- htab->splt->contents + h->plt.offset + 2);
- /* Fixup the relative branch to PLT 0 */
- bfd_put_32 (output_bfd, - (PLT_FIRST_ENTRY_SIZE +
- (PLT_ENTRY_SIZE * plt_index) + 22)/2,
- htab->splt->contents + h->plt.offset + 24);
- /* Fixup offset into symbol table */
- bfd_put_32 (output_bfd, plt_index * sizeof (Elf64_External_Rela),
- htab->splt->contents + h->plt.offset + 28);
-
- /* Fill in the entry in the global offset table.
- Points to instruction after GOT offset. */
- bfd_put_64 (output_bfd,
- (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset
- + 14),
- htab->sgotplt->contents + got_offset);
-
- /* Fill in the entry in the .rela.plt section. */
- rela.r_offset = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + got_offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_390_JMP_SLOT);
- rela.r_addend = 0;
- loc = htab->srelplt->contents + plt_index * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. This is a clue
- for the dynamic linker, to make function pointer
- comparisons work between an application and shared
- library. */
- sym->st_shndx = SHN_UNDEF;
- }
- }
-
- if (h->got.offset != (bfd_vma) -1
- && elf_s390_hash_entry(h)->tls_type != GOT_TLS_GD
- && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE
- && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE_NLT)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the global offset table. Set it
- up. */
- if (htab->sgot == NULL || htab->srelgot == NULL)
- abort ();
-
- rela.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + (h->got.offset &~ (bfd_vma) 1));
-
- /* If this is a static link, or it is a -Bsymbolic link and the
- symbol is defined locally or was forced to be local because
- of a version file, we just want to emit a RELATIVE reloc.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
- BFD_ASSERT((h->got.offset & 1) != 0);
- rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else
- {
- BFD_ASSERT((h->got.offset & 1) == 0);
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_390_GLOB_DAT);
- rela.r_addend = 0;
- }
-
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbols needs a copy reloc. Set it up. */
-
- if (h->dynindx == -1
- || (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || htab->srelbss == NULL)
- abort ();
-
- rela.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_390_COPY);
- rela.r_addend = 0;
- loc = htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Used to decide how to sort relocs in an optimal manner for the
- dynamic linker, before writing them out. */
-
-static enum elf_reloc_type_class
-elf_s390_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
-{
- switch ((int) ELF64_R_TYPE (rela->r_info))
- {
- case R_390_RELATIVE:
- return reloc_class_relative;
- case R_390_JMP_SLOT:
- return reloc_class_plt;
- case R_390_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-elf_s390_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- struct elf_s390_link_hash_table *htab;
- bfd *dynobj;
- asection *sdyn;
-
- htab = elf_s390_hash_table (info);
- dynobj = htab->elf.dynobj;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (htab->elf.dynamic_sections_created)
- {
- Elf64_External_Dyn *dyncon, *dynconend;
-
- if (sdyn == NULL || htab->sgot == NULL)
- abort ();
-
- dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- asection *s;
-
- bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- continue;
-
- case DT_PLTGOT:
- dyn.d_un.d_ptr = htab->sgot->output_section->vma;
- break;
-
- case DT_JMPREL:
- dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
- break;
-
- case DT_PLTRELSZ:
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
- break;
-
- case DT_RELASZ:
- /* The procedure linkage table relocs (DT_JMPREL) should
- not be included in the overall relocs (DT_RELA).
- Therefore, we override the DT_RELASZ entry here to
- make it not include the JMPREL relocs. Since the
- linker script arranges for .rela.plt to follow all
- other relocation sections, we don't have to worry
- about changing the DT_RELA entry. */
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val -= s->_cooked_size;
- else
- dyn.d_un.d_val -= s->_raw_size;
- break;
- }
-
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
-
- /* Fill in the special first entry in the procedure linkage table. */
- if (htab->splt && htab->splt->_raw_size > 0)
- {
- /* fill in blueprint for plt 0 entry */
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD0,
- htab->splt->contents );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1,
- htab->splt->contents +4 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3,
- htab->splt->contents +12 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4,
- htab->splt->contents +16 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5,
- htab->splt->contents +20 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD6,
- htab->splt->contents + 24);
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD7,
- htab->splt->contents + 28 );
- /* Fixup relative address to start of GOT */
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma +
- htab->sgotplt->output_offset
- - htab->splt->output_section->vma - 6)/2,
- htab->splt->contents + 8);
- }
- elf_section_data (htab->splt->output_section)
- ->this_hdr.sh_entsize = PLT_ENTRY_SIZE;
- }
-
- if (htab->sgotplt)
- {
- /* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
- {
- bfd_put_64 (output_bfd,
- (sdyn == NULL ? (bfd_vma) 0
- : sdyn->output_section->vma + sdyn->output_offset),
- htab->sgotplt->contents);
- /* One entry for shared object struct ptr. */
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 8);
- /* One entry for _dl_runtime_resolve. */
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 12);
- }
-
- elf_section_data (htab->sgot->output_section)
- ->this_hdr.sh_entsize = 8;
- }
- return TRUE;
-}
-
-/* Why was the hash table entry size definition changed from
- ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
- this is the only reason for the s390_elf64_size_info structure. */
-
-const struct elf_size_info s390_elf64_size_info =
-{
- sizeof (Elf64_External_Ehdr),
- sizeof (Elf64_External_Phdr),
- sizeof (Elf64_External_Shdr),
- sizeof (Elf64_External_Rel),
- sizeof (Elf64_External_Rela),
- sizeof (Elf64_External_Sym),
- sizeof (Elf64_External_Dyn),
- sizeof (Elf_External_Note),
- 8, /* hash-table entry size. */
- 1, /* internal relocations per external relocations. */
- 64, /* arch_size. */
- 3, /* log_file_align. */
- ELFCLASS64, EV_CURRENT,
- bfd_elf64_write_out_phdrs,
- bfd_elf64_write_shdrs_and_ehdr,
- bfd_elf64_write_relocs,
- bfd_elf64_swap_symbol_in,
- bfd_elf64_swap_symbol_out,
- bfd_elf64_slurp_reloc_table,
- bfd_elf64_slurp_symbol_table,
- bfd_elf64_swap_dyn_in,
- bfd_elf64_swap_dyn_out,
- bfd_elf64_swap_reloc_in,
- bfd_elf64_swap_reloc_out,
- bfd_elf64_swap_reloca_in,
- bfd_elf64_swap_reloca_out
-};
-
-#define TARGET_BIG_SYM bfd_elf64_s390_vec
-#define TARGET_BIG_NAME "elf64-s390"
-#define ELF_ARCH bfd_arch_s390
-#define ELF_MACHINE_CODE EM_S390
-#define ELF_MACHINE_ALT1 EM_S390_OLD
-#define ELF_MAXPAGESIZE 0x1000
-
-#define elf_backend_size_info s390_elf64_size_info
-
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_want_got_plt 1
-#define elf_backend_plt_readonly 1
-#define elf_backend_want_plt_sym 0
-#define elf_backend_got_header_size 24
-#define elf_backend_rela_normal 1
-
-#define elf_info_to_howto elf_s390_info_to_howto
-
-#define bfd_elf64_bfd_is_local_label_name elf_s390_is_local_label_name
-#define bfd_elf64_bfd_link_hash_table_create elf_s390_link_hash_table_create
-#define bfd_elf64_bfd_reloc_type_lookup elf_s390_reloc_type_lookup
-
-#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
-#define elf_backend_check_relocs elf_s390_check_relocs
-#define elf_backend_copy_indirect_symbol elf_s390_copy_indirect_symbol
-#define elf_backend_create_dynamic_sections elf_s390_create_dynamic_sections
-#define elf_backend_finish_dynamic_sections elf_s390_finish_dynamic_sections
-#define elf_backend_finish_dynamic_symbol elf_s390_finish_dynamic_symbol
-#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook
-#define elf_backend_reloc_type_class elf_s390_reloc_type_class
-#define elf_backend_relocate_section elf_s390_relocate_section
-#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
-#define elf_backend_reloc_type_class elf_s390_reloc_type_class
-
-#define bfd_elf64_mkobject elf_s390_mkobject
-#define elf_backend_object_p elf_s390_object_p
-
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-sparc.c b/contrib/binutils/bfd/elf64-sparc.c
deleted file mode 100644
index 90de3b9..0000000
--- a/contrib/binutils/bfd/elf64-sparc.c
+++ /dev/null
@@ -1,3224 +0,0 @@
-/* SPARC-specific support for 64-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "opcode/sparc.h"
-
-/* This is defined if one wants to build upward compatible binaries
- with the original sparc64-elf toolchain. The support is kept in for
- now but is turned off by default. dje 970930 */
-/*#define SPARC64_OLD_RELOCS*/
-
-#include "elf/sparc.h"
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
-#define MINUS_ONE (~ (bfd_vma) 0)
-
-static struct bfd_link_hash_table * sparc64_elf_bfd_link_hash_table_create
- PARAMS ((bfd *));
-static bfd_reloc_status_type init_insn_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *,
- bfd *, bfd_vma *, bfd_vma *));
-static reloc_howto_type *sparc64_elf_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void sparc64_elf_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-
-static void sparc64_elf_build_plt
- PARAMS ((bfd *, unsigned char *, int));
-static bfd_vma sparc64_elf_plt_entry_offset
- PARAMS ((bfd_vma));
-static bfd_vma sparc64_elf_plt_ptr_offset
- PARAMS ((bfd_vma, bfd_vma));
-
-static bfd_boolean sparc64_elf_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
- const Elf_Internal_Rela *));
-static bfd_boolean sparc64_elf_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean sparc64_elf_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static int sparc64_elf_get_symbol_type
- PARAMS (( Elf_Internal_Sym *, int));
-static bfd_boolean sparc64_elf_add_symbol_hook
- PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
- const char **, flagword *, asection **, bfd_vma *));
-static bfd_boolean sparc64_elf_output_arch_syms
- PARAMS ((bfd *, struct bfd_link_info *, PTR,
- bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *,
- asection *, struct elf_link_hash_entry *)));
-static void sparc64_elf_symbol_processing
- PARAMS ((bfd *, asymbol *));
-
-static bfd_boolean sparc64_elf_merge_private_bfd_data
- PARAMS ((bfd *, bfd *));
-
-static bfd_boolean sparc64_elf_fake_sections
- PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
-
-static const char *sparc64_elf_print_symbol_all
- PARAMS ((bfd *, PTR, asymbol *));
-static bfd_boolean sparc64_elf_new_section_hook
- PARAMS ((bfd *, asection *));
-static bfd_boolean sparc64_elf_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
-static bfd_boolean sparc64_elf_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static bfd_boolean sparc64_elf_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static bfd_boolean sparc64_elf_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean sparc64_elf_object_p PARAMS ((bfd *));
-static long sparc64_elf_get_reloc_upper_bound PARAMS ((bfd *, asection *));
-static long sparc64_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
-static bfd_boolean sparc64_elf_slurp_one_reloc_table
- PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, bfd_boolean));
-static bfd_boolean sparc64_elf_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **, bfd_boolean));
-static long sparc64_elf_canonicalize_reloc
- PARAMS ((bfd *, asection *, arelent **, asymbol **));
-static long sparc64_elf_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
-static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR));
-static enum elf_reloc_type_class sparc64_elf_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-
-/* The relocation "howto" table. */
-
-static bfd_reloc_status_type sparc_elf_notsup_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type sparc_elf_wdisp16_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type sparc_elf_hix22_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type sparc_elf_lox10_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
-static reloc_howto_type sparc64_elf_howto_table[] =
-{
- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
- HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_PC10, 0,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_PC22, 10,2,22,TRUE, 0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_WPLT30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WPLT30", FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_GLOB_DAT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_JMP_SLOT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_RELATIVE, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_UA32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", FALSE,0,0xffffffff,TRUE),
-#ifndef SPARC64_OLD_RELOCS
- HOWTO(R_SPARC_PLT32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT32", FALSE,0,0xffffffff,TRUE),
- /* These aren't implemented yet. */
- HOWTO(R_SPARC_HIPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_HIPLT22", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_LOPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_LOPLT10", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PCPLT32, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT32", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PCPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT22", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_PCPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT10", FALSE,0,0x00000000,TRUE),
-#endif
- HOWTO(R_SPARC_10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_11, 0,2,11,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_11", FALSE,0,0x000007ff,TRUE),
- HOWTO(R_SPARC_64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_64", FALSE,0,MINUS_ONE, TRUE),
- HOWTO(R_SPARC_OLO10, 0,2,13,FALSE,0,complain_overflow_signed, sparc_elf_notsup_reloc, "R_SPARC_OLO10", FALSE,0,0x00001fff,TRUE),
- HOWTO(R_SPARC_HH22, 42,2,22,FALSE,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_HH22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_HM10, 32,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HM10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_LM22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LM22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_PC_HH22, 42,2,22,TRUE, 0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_PC_HH22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_PC_HM10, 32,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_HM10", FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_PC_LM22, 10,2,22,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_LM22", FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_WDISP16, 2,2,16,TRUE, 0,complain_overflow_signed, sparc_elf_wdisp16_reloc,"R_SPARC_WDISP16", FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_WDISP19, 2,2,19,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP19", FALSE,0,0x0007ffff,TRUE),
- HOWTO(R_SPARC_UNUSED_42, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_UNUSED_42",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_7, 0,2, 7,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_7", FALSE,0,0x0000007f,TRUE),
- HOWTO(R_SPARC_5, 0,2, 5,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", FALSE,0,0x0000001f,TRUE),
- HOWTO(R_SPARC_6, 0,2, 6,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", FALSE,0,0x0000003f,TRUE),
- HOWTO(R_SPARC_DISP64, 0,4,64,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP64", FALSE,0,MINUS_ONE, TRUE),
- HOWTO(R_SPARC_PLT64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT64", FALSE,0,MINUS_ONE, TRUE),
- HOWTO(R_SPARC_HIX22, 0,4, 0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_HIX22", FALSE,0,MINUS_ONE, FALSE),
- HOWTO(R_SPARC_LOX10, 0,4, 0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_LOX10", FALSE,0,MINUS_ONE, FALSE),
- HOWTO(R_SPARC_H44, 22,2,22,FALSE,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_H44", FALSE,0,0x003fffff,FALSE),
- HOWTO(R_SPARC_M44, 12,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_M44", FALSE,0,0x000003ff,FALSE),
- HOWTO(R_SPARC_L44, 0,2,13,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_L44", FALSE,0,0x00000fff,FALSE),
- HOWTO(R_SPARC_REGISTER, 0,4, 0,FALSE,0,complain_overflow_bitfield,sparc_elf_notsup_reloc, "R_SPARC_REGISTER",FALSE,0,MINUS_ONE, FALSE),
- HOWTO(R_SPARC_UA64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA64", FALSE,0,MINUS_ONE, TRUE),
- HOWTO(R_SPARC_UA16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", FALSE,0,0x0000ffff,TRUE),
- HOWTO(R_SPARC_TLS_GD_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_HI22",FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_TLS_GD_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_LO10",FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_TLS_GD_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_GD_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_CALL",FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_TLS_LDM_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_HI22",FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_TLS_LDM_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_LO10",FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_TLS_LDM_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_LDM_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_CALL",FALSE,0,0x3fffffff,TRUE),
- HOWTO(R_SPARC_TLS_LDO_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc,"R_SPARC_TLS_LDO_HIX22",FALSE,0,0x003fffff, FALSE),
- HOWTO(R_SPARC_TLS_LDO_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LDO_LOX10",FALSE,0,0x000003ff, FALSE),
- HOWTO(R_SPARC_TLS_LDO_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDO_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_IE_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_HI22",FALSE,0,0x003fffff,TRUE),
- HOWTO(R_SPARC_TLS_IE_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LO10",FALSE,0,0x000003ff,TRUE),
- HOWTO(R_SPARC_TLS_IE_LD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_IE_LDX,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LDX",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_IE_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_ADD",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_LE_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_TLS_LE_HIX22",FALSE,0,0x003fffff, FALSE),
- HOWTO(R_SPARC_TLS_LE_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LE_LOX10",FALSE,0,0x000003ff, FALSE),
- HOWTO(R_SPARC_TLS_DTPMOD32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD32",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_DTPMOD64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD64",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE),
- HOWTO(R_SPARC_TLS_DTPOFF64,0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF64",FALSE,0,MINUS_ONE,TRUE),
- HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE)
-};
-
-struct elf_reloc_map {
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
-};
-
-static const struct elf_reloc_map sparc_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_SPARC_NONE, },
- { BFD_RELOC_16, R_SPARC_16, },
- { BFD_RELOC_16_PCREL, R_SPARC_DISP16 },
- { BFD_RELOC_8, R_SPARC_8 },
- { BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
- { BFD_RELOC_CTOR, R_SPARC_64 },
- { BFD_RELOC_32, R_SPARC_32 },
- { BFD_RELOC_32_PCREL, R_SPARC_DISP32 },
- { BFD_RELOC_HI22, R_SPARC_HI22 },
- { BFD_RELOC_LO10, R_SPARC_LO10, },
- { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
- { BFD_RELOC_64_PCREL, R_SPARC_DISP64 },
- { BFD_RELOC_SPARC22, R_SPARC_22 },
- { BFD_RELOC_SPARC13, R_SPARC_13 },
- { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
- { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 },
- { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 },
- { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 },
- { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 },
- { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 },
- { BFD_RELOC_SPARC_COPY, R_SPARC_COPY },
- { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT },
- { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
- { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
- { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
- { BFD_RELOC_SPARC_UA16, R_SPARC_UA16 },
- { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 },
- { BFD_RELOC_SPARC_UA64, R_SPARC_UA64 },
- { BFD_RELOC_SPARC_10, R_SPARC_10 },
- { BFD_RELOC_SPARC_11, R_SPARC_11 },
- { BFD_RELOC_SPARC_64, R_SPARC_64 },
- { BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 },
- { BFD_RELOC_SPARC_HH22, R_SPARC_HH22 },
- { BFD_RELOC_SPARC_HM10, R_SPARC_HM10 },
- { BFD_RELOC_SPARC_LM22, R_SPARC_LM22 },
- { BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 },
- { BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 },
- { BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 },
- { BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 },
- { BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 },
- { BFD_RELOC_SPARC_7, R_SPARC_7 },
- { BFD_RELOC_SPARC_5, R_SPARC_5 },
- { BFD_RELOC_SPARC_6, R_SPARC_6 },
- { BFD_RELOC_SPARC_DISP64, R_SPARC_DISP64 },
- { BFD_RELOC_SPARC_TLS_GD_HI22, R_SPARC_TLS_GD_HI22 },
- { BFD_RELOC_SPARC_TLS_GD_LO10, R_SPARC_TLS_GD_LO10 },
- { BFD_RELOC_SPARC_TLS_GD_ADD, R_SPARC_TLS_GD_ADD },
- { BFD_RELOC_SPARC_TLS_GD_CALL, R_SPARC_TLS_GD_CALL },
- { BFD_RELOC_SPARC_TLS_LDM_HI22, R_SPARC_TLS_LDM_HI22 },
- { BFD_RELOC_SPARC_TLS_LDM_LO10, R_SPARC_TLS_LDM_LO10 },
- { BFD_RELOC_SPARC_TLS_LDM_ADD, R_SPARC_TLS_LDM_ADD },
- { BFD_RELOC_SPARC_TLS_LDM_CALL, R_SPARC_TLS_LDM_CALL },
- { BFD_RELOC_SPARC_TLS_LDO_HIX22, R_SPARC_TLS_LDO_HIX22 },
- { BFD_RELOC_SPARC_TLS_LDO_LOX10, R_SPARC_TLS_LDO_LOX10 },
- { BFD_RELOC_SPARC_TLS_LDO_ADD, R_SPARC_TLS_LDO_ADD },
- { BFD_RELOC_SPARC_TLS_IE_HI22, R_SPARC_TLS_IE_HI22 },
- { BFD_RELOC_SPARC_TLS_IE_LO10, R_SPARC_TLS_IE_LO10 },
- { BFD_RELOC_SPARC_TLS_IE_LD, R_SPARC_TLS_IE_LD },
- { BFD_RELOC_SPARC_TLS_IE_LDX, R_SPARC_TLS_IE_LDX },
- { BFD_RELOC_SPARC_TLS_IE_ADD, R_SPARC_TLS_IE_ADD },
- { BFD_RELOC_SPARC_TLS_LE_HIX22, R_SPARC_TLS_LE_HIX22 },
- { BFD_RELOC_SPARC_TLS_LE_LOX10, R_SPARC_TLS_LE_LOX10 },
- { BFD_RELOC_SPARC_TLS_DTPMOD32, R_SPARC_TLS_DTPMOD32 },
- { BFD_RELOC_SPARC_TLS_DTPMOD64, R_SPARC_TLS_DTPMOD64 },
- { BFD_RELOC_SPARC_TLS_DTPOFF32, R_SPARC_TLS_DTPOFF32 },
- { BFD_RELOC_SPARC_TLS_DTPOFF64, R_SPARC_TLS_DTPOFF64 },
- { BFD_RELOC_SPARC_TLS_TPOFF32, R_SPARC_TLS_TPOFF32 },
- { BFD_RELOC_SPARC_TLS_TPOFF64, R_SPARC_TLS_TPOFF64 },
-#ifndef SPARC64_OLD_RELOCS
- { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 },
-#endif
- { BFD_RELOC_SPARC_PLT64, R_SPARC_PLT64 },
- { BFD_RELOC_SPARC_HIX22, R_SPARC_HIX22 },
- { BFD_RELOC_SPARC_LOX10, R_SPARC_LOX10 },
- { BFD_RELOC_SPARC_H44, R_SPARC_H44 },
- { BFD_RELOC_SPARC_M44, R_SPARC_M44 },
- { BFD_RELOC_SPARC_L44, R_SPARC_L44 },
- { BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER }
-};
-
-static reloc_howto_type *
-sparc64_elf_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- unsigned int i;
- for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); i++)
- {
- if (sparc_reloc_map[i].bfd_reloc_val == code)
- return &sparc64_elf_howto_table[(int) sparc_reloc_map[i].elf_reloc_val];
- }
- return 0;
-}
-
-static void
-sparc64_elf_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf_Internal_Rela *dst;
-{
- BFD_ASSERT (ELF64_R_TYPE_ID (dst->r_info) < (unsigned int) R_SPARC_max_std);
- cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (dst->r_info)];
-}
-
-struct sparc64_elf_section_data
-{
- struct bfd_elf_section_data elf;
- unsigned int do_relax, reloc_count;
-};
-
-#define sec_do_relax(sec) \
- ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax
-#define canon_reloc_count(sec) \
- ((struct sparc64_elf_section_data *) elf_section_data (sec))->reloc_count
-
-/* Due to the way how we handle R_SPARC_OLO10, each entry in a SHT_RELA
- section can represent up to two relocs, we must tell the user to allocate
- more space. */
-
-static long
-sparc64_elf_get_reloc_upper_bound (abfd, sec)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
-{
- return (sec->reloc_count * 2 + 1) * sizeof (arelent *);
-}
-
-static long
-sparc64_elf_get_dynamic_reloc_upper_bound (abfd)
- bfd *abfd;
-{
- return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 2;
-}
-
-/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
- them. We cannot use generic elf routines for this, because R_SPARC_OLO10
- has secondary addend in ELF64_R_TYPE_DATA. We handle it as two relocations
- for the same location, R_SPARC_LO10 and R_SPARC_13. */
-
-static bfd_boolean
-sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
- bfd *abfd;
- asection *asect;
- Elf_Internal_Shdr *rel_hdr;
- asymbol **symbols;
- bfd_boolean dynamic;
-{
- PTR allocated = NULL;
- bfd_byte *native_relocs;
- arelent *relent;
- unsigned int i;
- int entsize;
- bfd_size_type count;
- arelent *relents;
-
- allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
- if (allocated == NULL)
- goto error_return;
-
- if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)
- goto error_return;
-
- native_relocs = (bfd_byte *) allocated;
-
- relents = asect->relocation + canon_reloc_count (asect);
-
- entsize = rel_hdr->sh_entsize;
- BFD_ASSERT (entsize == sizeof (Elf64_External_Rela));
-
- count = rel_hdr->sh_size / entsize;
-
- for (i = 0, relent = relents; i < count;
- i++, relent++, native_relocs += entsize)
- {
- Elf_Internal_Rela rela;
-
- bfd_elf64_swap_reloca_in (abfd, native_relocs, &rela);
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a normal BFD reloc is always section relative,
- and the address of a dynamic reloc is absolute.. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic)
- relent->address = rela.r_offset;
- else
- relent->address = rela.r_offset - asect->vma;
-
- if (ELF64_R_SYM (rela.r_info) == 0)
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- else
- {
- asymbol **ps, *s;
-
- ps = symbols + ELF64_R_SYM (rela.r_info) - 1;
- s = *ps;
-
- /* Canonicalize ELF section symbols. FIXME: Why? */
- if ((s->flags & BSF_SECTION_SYM) == 0)
- relent->sym_ptr_ptr = ps;
- else
- relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
- }
-
- relent->addend = rela.r_addend;
-
- BFD_ASSERT (ELF64_R_TYPE_ID (rela.r_info) < (unsigned int) R_SPARC_max_std);
- if (ELF64_R_TYPE_ID (rela.r_info) == R_SPARC_OLO10)
- {
- relent->howto = &sparc64_elf_howto_table[R_SPARC_LO10];
- relent[1].address = relent->address;
- relent++;
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- relent->addend = ELF64_R_TYPE_DATA (rela.r_info);
- relent->howto = &sparc64_elf_howto_table[R_SPARC_13];
- }
- else
- relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)];
- }
-
- canon_reloc_count (asect) += relent - relents;
-
- if (allocated != NULL)
- free (allocated);
-
- return TRUE;
-
- error_return:
- if (allocated != NULL)
- free (allocated);
- return FALSE;
-}
-
-/* Read in and swap the external relocs. */
-
-static bfd_boolean
-sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
- bfd *abfd;
- asection *asect;
- asymbol **symbols;
- bfd_boolean dynamic;
-{
- struct bfd_elf_section_data * const d = elf_section_data (asect);
- Elf_Internal_Shdr *rel_hdr;
- Elf_Internal_Shdr *rel_hdr2;
- bfd_size_type amt;
-
- if (asect->relocation != NULL)
- return TRUE;
-
- if (! dynamic)
- {
- if ((asect->flags & SEC_RELOC) == 0
- || asect->reloc_count == 0)
- return TRUE;
-
- rel_hdr = &d->rel_hdr;
- rel_hdr2 = d->rel_hdr2;
-
- BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
- || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
- }
- else
- {
- /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
- case because relocations against this section may use the
- dynamic symbol table, and in that case bfd_section_from_shdr
- in elf.c does not update the RELOC_COUNT. */
- if (asect->_raw_size == 0)
- return TRUE;
-
- rel_hdr = &d->this_hdr;
- asect->reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
- rel_hdr2 = NULL;
- }
-
- amt = asect->reloc_count;
- amt *= 2 * sizeof (arelent);
- asect->relocation = (arelent *) bfd_alloc (abfd, amt);
- if (asect->relocation == NULL)
- return FALSE;
-
- /* The sparc64_elf_slurp_one_reloc_table routine increments
- canon_reloc_count. */
- canon_reloc_count (asect) = 0;
-
- if (!sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols,
- dynamic))
- return FALSE;
-
- if (rel_hdr2
- && !sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols,
- dynamic))
- return FALSE;
-
- return TRUE;
-}
-
-/* Canonicalize the relocs. */
-
-static long
-sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
-{
- arelent *tblptr;
- unsigned int i;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE))
- return -1;
-
- tblptr = section->relocation;
- for (i = 0; i < canon_reloc_count (section); i++)
- *relptr++ = tblptr++;
-
- *relptr = NULL;
-
- return canon_reloc_count (section);
-}
-
-
-/* Canonicalize the dynamic relocation entries. Note that we return
- the dynamic relocations as a single block, although they are
- actually associated with particular sections; the interface, which
- was designed for SunOS style shared libraries, expects that there
- is only one set of dynamic relocs. Any section that was actually
- installed in the BFD, and has type SHT_REL or SHT_RELA, and uses
- the dynamic symbol table, is considered to be a dynamic reloc
- section. */
-
-static long
-sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
- bfd *abfd;
- arelent **storage;
- asymbol **syms;
-{
- asection *s;
- long ret;
-
- if (elf_dynsymtab (abfd) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- ret = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
- && (elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
- {
- arelent *p;
- long count, i;
-
- if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, TRUE))
- return -1;
- count = canon_reloc_count (s);
- p = s->relocation;
- for (i = 0; i < count; i++)
- *storage++ = p++;
- ret += count;
- }
- }
-
- *storage = NULL;
-
- return ret;
-}
-
-/* Write out the relocs. */
-
-static void
-sparc64_elf_write_relocs (abfd, sec, data)
- bfd *abfd;
- asection *sec;
- PTR data;
-{
- bfd_boolean *failedp = (bfd_boolean *) data;
- Elf_Internal_Shdr *rela_hdr;
- Elf64_External_Rela *outbound_relocas, *src_rela;
- unsigned int idx, count;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
-
- /* If we have already failed, don't do anything. */
- if (*failedp)
- return;
-
- if ((sec->flags & SEC_RELOC) == 0)
- return;
-
- /* The linker backend writes the relocs out itself, and sets the
- reloc_count field to zero to inhibit writing them here. Also,
- sometimes the SEC_RELOC flag gets set even when there aren't any
- relocs. */
- if (sec->reloc_count == 0)
- return;
-
- /* We can combine two relocs that refer to the same address
- into R_SPARC_OLO10 if first one is R_SPARC_LO10 and the
- latter is R_SPARC_13 with no associated symbol. */
- count = 0;
- for (idx = 0; idx < sec->reloc_count; idx++)
- {
- bfd_vma addr;
-
- ++count;
-
- addr = sec->orelocation[idx]->address;
- if (sec->orelocation[idx]->howto->type == R_SPARC_LO10
- && idx < sec->reloc_count - 1)
- {
- arelent *r = sec->orelocation[idx + 1];
-
- if (r->howto->type == R_SPARC_13
- && r->address == addr
- && bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
- && (*r->sym_ptr_ptr)->value == 0)
- ++idx;
- }
- }
-
- rela_hdr = &elf_section_data (sec)->rel_hdr;
-
- rela_hdr->sh_size = rela_hdr->sh_entsize * count;
- rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
- if (rela_hdr->contents == NULL)
- {
- *failedp = TRUE;
- return;
- }
-
- /* Figure out whether the relocations are RELA or REL relocations. */
- if (rela_hdr->sh_type != SHT_RELA)
- abort ();
-
- /* orelocation has the data, reloc_count has the count... */
- outbound_relocas = (Elf64_External_Rela *) rela_hdr->contents;
- src_rela = outbound_relocas;
-
- for (idx = 0; idx < sec->reloc_count; idx++)
- {
- Elf_Internal_Rela dst_rela;
- arelent *ptr;
- asymbol *sym;
- int n;
-
- ptr = sec->orelocation[idx];
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a BFD reloc is always section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- dst_rela.r_offset = ptr->address;
- else
- dst_rela.r_offset = ptr->address + sec->vma;
-
- sym = *ptr->sym_ptr_ptr;
- if (sym == last_sym)
- n = last_sym_idx;
- else if (bfd_is_abs_section (sym->section) && sym->value == 0)
- n = STN_UNDEF;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = TRUE;
- return;
- }
- last_sym_idx = n;
- }
-
- if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
- && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
- {
- *failedp = TRUE;
- return;
- }
-
- if (ptr->howto->type == R_SPARC_LO10
- && idx < sec->reloc_count - 1)
- {
- arelent *r = sec->orelocation[idx + 1];
-
- if (r->howto->type == R_SPARC_13
- && r->address == ptr->address
- && bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
- && (*r->sym_ptr_ptr)->value == 0)
- {
- idx++;
- dst_rela.r_info
- = ELF64_R_INFO (n, ELF64_R_TYPE_INFO (r->addend,
- R_SPARC_OLO10));
- }
- else
- dst_rela.r_info = ELF64_R_INFO (n, R_SPARC_LO10);
- }
- else
- dst_rela.r_info = ELF64_R_INFO (n, ptr->howto->type);
-
- dst_rela.r_addend = ptr->addend;
- bfd_elf64_swap_reloca_out (abfd, &dst_rela, (bfd_byte *) src_rela);
- ++src_rela;
- }
-}
-
-/* Sparc64 ELF linker hash table. */
-
-struct sparc64_elf_app_reg
-{
- unsigned char bind;
- unsigned short shndx;
- bfd *abfd;
- char *name;
-};
-
-struct sparc64_elf_link_hash_table
-{
- struct elf_link_hash_table root;
-
- struct sparc64_elf_app_reg app_regs [4];
-};
-
-/* Get the Sparc64 ELF linker hash table from a link_info structure. */
-
-#define sparc64_elf_hash_table(p) \
- ((struct sparc64_elf_link_hash_table *) ((p)->hash))
-
-/* Create a Sparc64 ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-sparc64_elf_bfd_link_hash_table_create (abfd)
- bfd *abfd;
-{
- struct sparc64_elf_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct sparc64_elf_link_hash_table);
-
- ret = (struct sparc64_elf_link_hash_table *) bfd_zmalloc (amt);
- if (ret == (struct sparc64_elf_link_hash_table *) NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
- _bfd_elf_link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- return &ret->root.root;
-}
-
-/* Utility for performing the standard initial work of an instruction
- relocation.
- *PRELOCATION will contain the relocated item.
- *PINSN will contain the instruction from the input stream.
- If the result is `bfd_reloc_other' the caller can continue with
- performing the relocation. Otherwise it must stop and return the
- value to its caller. */
-
-static bfd_reloc_status_type
-init_insn_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- prelocation,
- pinsn)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- bfd_vma *prelocation;
- bfd_vma *pinsn;
-{
- bfd_vma relocation;
- reloc_howto_type *howto = reloc_entry->howto;
-
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* This works because partial_inplace is FALSE. */
- if (output_bfd != NULL)
- return bfd_reloc_continue;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- relocation = (symbol->value
- + symbol->section->output_section->vma
- + symbol->section->output_offset);
- relocation += reloc_entry->addend;
- if (howto->pc_relative)
- {
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- relocation -= reloc_entry->address;
- }
-
- *prelocation = relocation;
- *pinsn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- return bfd_reloc_other;
-}
-
-/* For unsupported relocs. */
-
-static bfd_reloc_status_type
-sparc_elf_notsup_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
-{
- return bfd_reloc_notsupported;
-}
-
-/* Handle the WDISP16 reloc. */
-
-static bfd_reloc_status_type
-sparc_elf_wdisp16_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_vma insn;
- bfd_reloc_status_type status;
-
- status = init_insn_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, &relocation, &insn);
- if (status != bfd_reloc_other)
- return status;
-
- insn &= ~ (bfd_vma) 0x303fff;
- insn |= (((relocation >> 2) & 0xc000) << 6) | ((relocation >> 2) & 0x3fff);
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-
- if ((bfd_signed_vma) relocation < - 0x40000
- || (bfd_signed_vma) relocation > 0x3ffff)
- return bfd_reloc_overflow;
- else
- return bfd_reloc_ok;
-}
-
-/* Handle the HIX22 reloc. */
-
-static bfd_reloc_status_type
-sparc_elf_hix22_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_vma insn;
- bfd_reloc_status_type status;
-
- status = init_insn_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, &relocation, &insn);
- if (status != bfd_reloc_other)
- return status;
-
- relocation ^= MINUS_ONE;
- insn = (insn &~ (bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-
- if ((relocation & ~ (bfd_vma) 0xffffffff) != 0)
- return bfd_reloc_overflow;
- else
- return bfd_reloc_ok;
-}
-
-/* Handle the LOX10 reloc. */
-
-static bfd_reloc_status_type
-sparc_elf_lox10_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
- bfd_vma insn;
- bfd_reloc_status_type status;
-
- status = init_insn_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, &relocation, &insn);
- if (status != bfd_reloc_other)
- return status;
-
- insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff);
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-
- return bfd_reloc_ok;
-}
-
-/* PLT/GOT stuff */
-
-/* Both the headers and the entries are icache aligned. */
-#define PLT_ENTRY_SIZE 32
-#define PLT_HEADER_SIZE (4 * PLT_ENTRY_SIZE)
-#define LARGE_PLT_THRESHOLD 32768
-#define GOT_RESERVED_ENTRIES 1
-
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/sparcv9/ld.so.1"
-
-/* Fill in the .plt section. */
-
-static void
-sparc64_elf_build_plt (output_bfd, contents, nentries)
- bfd *output_bfd;
- unsigned char *contents;
- int nentries;
-{
- const unsigned int nop = 0x01000000;
- int i, j;
-
- /* The first four entries are reserved, and are initially undefined.
- We fill them with `illtrap 0' to force ld.so to do something. */
-
- for (i = 0; i < PLT_HEADER_SIZE/4; ++i)
- bfd_put_32 (output_bfd, (bfd_vma) 0, contents+i*4);
-
- /* The first 32768 entries are close enough to plt1 to get there via
- a straight branch. */
-
- for (i = 4; i < LARGE_PLT_THRESHOLD && i < nentries; ++i)
- {
- unsigned char *entry = contents + i * PLT_ENTRY_SIZE;
- unsigned int sethi, ba;
-
- /* sethi (. - plt0), %g1 */
- sethi = 0x03000000 | (i * PLT_ENTRY_SIZE);
-
- /* ba,a,pt %xcc, plt1 */
- ba = 0x30680000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff);
-
- bfd_put_32 (output_bfd, (bfd_vma) sethi, entry);
- bfd_put_32 (output_bfd, (bfd_vma) ba, entry + 4);
- bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8);
- bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 12);
- bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 16);
- bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 20);
- bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 24);
- bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 28);
- }
-
- /* Now the tricky bit. Entries 32768 and higher are grouped in blocks of
- 160: 160 entries and 160 pointers. This is to separate code from data,
- which is much friendlier on the cache. */
-
- for (; i < nentries; i += 160)
- {
- int block = (i + 160 <= nentries ? 160 : nentries - i);
- for (j = 0; j < block; ++j)
- {
- unsigned char *entry, *ptr;
- unsigned int ldx;
-
- entry = contents + i*PLT_ENTRY_SIZE + j*4*6;
- ptr = contents + i*PLT_ENTRY_SIZE + block*4*6 + j*8;
-
- /* ldx [%o7 + ptr - (entry+4)], %g1 */
- ldx = 0xc25be000 | ((ptr - (entry+4)) & 0x1fff);
-
- /* mov %o7,%g5
- call .+8
- nop
- ldx [%o7+P],%g1
- jmpl %o7+%g1,%g1
- mov %g5,%o7 */
- bfd_put_32 (output_bfd, (bfd_vma) 0x8a10000f, entry);
- bfd_put_32 (output_bfd, (bfd_vma) 0x40000002, entry + 4);
- bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8);
- bfd_put_32 (output_bfd, (bfd_vma) ldx, entry + 12);
- bfd_put_32 (output_bfd, (bfd_vma) 0x83c3c001, entry + 16);
- bfd_put_32 (output_bfd, (bfd_vma) 0x9e100005, entry + 20);
-
- bfd_put_64 (output_bfd, (bfd_vma) (contents - (entry + 4)), ptr);
- }
- }
-}
-
-/* Return the offset of a particular plt entry within the .plt section. */
-
-static bfd_vma
-sparc64_elf_plt_entry_offset (index)
- bfd_vma index;
-{
- bfd_vma block, ofs;
-
- if (index < LARGE_PLT_THRESHOLD)
- return index * PLT_ENTRY_SIZE;
-
- /* See above for details. */
-
- block = (index - LARGE_PLT_THRESHOLD) / 160;
- ofs = (index - LARGE_PLT_THRESHOLD) % 160;
-
- return (LARGE_PLT_THRESHOLD + block * 160) * PLT_ENTRY_SIZE + ofs * 6 * 4;
-}
-
-static bfd_vma
-sparc64_elf_plt_ptr_offset (index, max)
- bfd_vma index;
- bfd_vma max;
-{
- bfd_vma block, ofs, last;
-
- BFD_ASSERT(index >= LARGE_PLT_THRESHOLD);
-
- /* See above for details. */
-
- block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160) + LARGE_PLT_THRESHOLD;
- ofs = index - block;
- if (block + 160 > max)
- last = (max - LARGE_PLT_THRESHOLD) % 160;
- else
- last = 160;
-
- return (block * PLT_ENTRY_SIZE
- + last * 6*4
- + ofs * 8);
-}
-
-/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table or procedure linkage
- table. */
-
-static bfd_boolean
-sparc64_elf_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- bfd *dynobj;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sgot;
- asection *srelgot;
- asection *sreloc;
-
- if (info->relocatable || !(sec->flags & SEC_ALLOC))
- return TRUE;
-
- dynobj = elf_hash_table (info)->dynobj;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_offsets = elf_local_got_offsets (abfd);
-
- sgot = NULL;
- srelgot = NULL;
- sreloc = NULL;
-
- rel_end = relocs + NUM_SHDR_ENTRIES (& elf_section_data (sec)->rel_hdr);
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- switch (ELF64_R_TYPE_ID (rel->r_info))
- {
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- /* This symbol requires a global offset table entry. */
-
- if (dynobj == NULL)
- {
- /* Create the .got section. */
- elf_hash_table (info)->dynobj = dynobj = abfd;
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
- }
-
- if (sgot == NULL)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL && (h != NULL || info->shared))
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rela.got");
- if (srelgot == NULL
- || ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, srelgot, 3))
- return FALSE;
- }
- }
-
- if (h != NULL)
- {
- if (h->got.offset != (bfd_vma) -1)
- {
- /* We have already allocated space in the .got. */
- break;
- }
- h->got.offset = sgot->_raw_size;
-
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- srelgot->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- {
- /* This is a global offset table entry for a local
- symbol. */
- if (local_got_offsets == NULL)
- {
- bfd_size_type size;
- register unsigned int i;
-
- 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;
- elf_local_got_offsets (abfd) = local_got_offsets;
- for (i = 0; i < symtab_hdr->sh_info; i++)
- local_got_offsets[i] = (bfd_vma) -1;
- }
- if (local_got_offsets[r_symndx] != (bfd_vma) -1)
- {
- /* We have already allocated space in the .got. */
- break;
- }
- local_got_offsets[r_symndx] = sgot->_raw_size;
-
- if (info->shared)
- {
- /* If we are generating a shared object, we need to
- output a R_SPARC_RELATIVE reloc so that the
- dynamic linker can adjust this GOT entry. */
- srelgot->_raw_size += sizeof (Elf64_External_Rela);
- }
- }
-
- sgot->_raw_size += 8;
-
-#if 0
- /* Doesn't work for 64-bit -fPIC, since sethi/or builds
- unsigned numbers. If we permit ourselves to modify
- code so we get sethi/xor, this could work.
- Question: do we consider conditionally re-enabling
- this for -fpic, once we know about object code models? */
- /* If the .got section is more than 0x1000 bytes, we add
- 0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13
- bit relocations have a greater chance of working. */
- if (sgot->_raw_size >= 0x1000
- && elf_hash_table (info)->hgot->root.u.def.value == 0)
- elf_hash_table (info)->hgot->root.u.def.value = 0x1000;
-#endif
-
- break;
-
- case R_SPARC_WPLT30:
- case R_SPARC_PLT32:
- case R_SPARC_HIPLT22:
- case R_SPARC_LOPLT10:
- case R_SPARC_PCPLT32:
- case R_SPARC_PCPLT22:
- case R_SPARC_PCPLT10:
- case R_SPARC_PLT64:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code without
- linking in any dynamic objects, in which case we don't
- need to generate a procedure linkage table after all. */
-
- if (h == NULL)
- {
- /* It does not make sense to have a procedure linkage
- table entry for a local symbol. */
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- if (ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT32
- && ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT64)
- break;
- /* Fall through. */
- case R_SPARC_PC10:
- case R_SPARC_PC22:
- case R_SPARC_PC_HH22:
- case R_SPARC_PC_HM10:
- case R_SPARC_PC_LM22:
- if (h != NULL
- && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* Fall through. */
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- case R_SPARC_DISP64:
- case R_SPARC_WDISP30:
- case R_SPARC_WDISP22:
- case R_SPARC_WDISP19:
- case R_SPARC_WDISP16:
- if (h == NULL)
- break;
- /* Fall through. */
- case R_SPARC_8:
- case R_SPARC_16:
- case R_SPARC_32:
- case R_SPARC_HI22:
- case R_SPARC_22:
- case R_SPARC_13:
- case R_SPARC_LO10:
- case R_SPARC_UA32:
- case R_SPARC_10:
- case R_SPARC_11:
- case R_SPARC_64:
- case R_SPARC_OLO10:
- case R_SPARC_HH22:
- case R_SPARC_HM10:
- case R_SPARC_LM22:
- case R_SPARC_7:
- case R_SPARC_5:
- case R_SPARC_6:
- case R_SPARC_HIX22:
- case R_SPARC_LOX10:
- case R_SPARC_H44:
- case R_SPARC_M44:
- case R_SPARC_L44:
- case R_SPARC_UA64:
- case R_SPARC_UA16:
- /* When creating a shared object, we must copy these relocs
- into the output file. We create a reloc section in
- dynobj and make room for the reloc.
-
- But don't do this for debugging sections -- this shows up
- with DWARF2 -- first because they are not loaded, and
- second because DWARF sez the debug info is not to be
- biased by the load address. */
- if (info->shared && (sec->flags & SEC_ALLOC))
- {
- if (sreloc == NULL)
- {
- const char *name;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
- name + 5) == 0);
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return FALSE;
- }
- if (sec->flags & SEC_READONLY)
- info->flags |= DF_TEXTREL;
- }
-
- sreloc->_raw_size += sizeof (Elf64_External_Rela);
- }
- break;
-
- case R_SPARC_REGISTER:
- /* Nothing to do. */
- break;
-
- default:
- (*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"),
- bfd_archive_filename (abfd),
- ELF64_R_TYPE_ID (rel->r_info));
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Hook called by the linker routine which adds symbols from an object
- file. We use it for STT_REGISTER symbols. */
-
-static bfd_boolean
-sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
- bfd *abfd;
- struct bfd_link_info *info;
- Elf_Internal_Sym *sym;
- const char **namep;
- flagword *flagsp ATTRIBUTE_UNUSED;
- asection **secp ATTRIBUTE_UNUSED;
- bfd_vma *valp ATTRIBUTE_UNUSED;
-{
- static const char *const stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
-
- if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER)
- {
- int reg;
- struct sparc64_elf_app_reg *p;
-
- reg = (int)sym->st_value;
- switch (reg & ~1)
- {
- case 2: reg -= 2; break;
- case 6: reg -= 4; break;
- default:
- (*_bfd_error_handler)
- (_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"),
- bfd_archive_filename (abfd));
- return FALSE;
- }
-
- if (info->hash->creator != abfd->xvec
- || (abfd->flags & DYNAMIC) != 0)
- {
- /* STT_REGISTER only works when linking an elf64_sparc object.
- If STT_REGISTER comes from a dynamic object, don't put it into
- the output bfd. The dynamic linker will recheck it. */
- *namep = NULL;
- return TRUE;
- }
-
- p = sparc64_elf_hash_table(info)->app_regs + reg;
-
- if (p->name != NULL && strcmp (p->name, *namep))
- {
- (*_bfd_error_handler)
- (_("Register %%g%d used incompatibly: %s in %s, previously %s in %s"),
- (int) sym->st_value,
- **namep ? *namep : "#scratch", bfd_archive_filename (abfd),
- *p->name ? p->name : "#scratch", bfd_archive_filename (p->abfd));
- return FALSE;
- }
-
- if (p->name == NULL)
- {
- if (**namep)
- {
- struct elf_link_hash_entry *h;
-
- h = (struct elf_link_hash_entry *)
- bfd_link_hash_lookup (info->hash, *namep, FALSE, FALSE, FALSE);
-
- if (h != NULL)
- {
- unsigned char type = h->type;
-
- if (type > STT_FUNC)
- type = 0;
- (*_bfd_error_handler)
- (_("Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"),
- *namep, bfd_archive_filename (abfd),
- stt_types[type], bfd_archive_filename (p->abfd));
- return FALSE;
- }
-
- p->name = bfd_hash_allocate (&info->hash->table,
- strlen (*namep) + 1);
- if (!p->name)
- return FALSE;
-
- strcpy (p->name, *namep);
- }
- else
- p->name = "";
- p->bind = ELF_ST_BIND (sym->st_info);
- p->abfd = abfd;
- p->shndx = sym->st_shndx;
- }
- else
- {
- if (p->bind == STB_WEAK
- && ELF_ST_BIND (sym->st_info) == STB_GLOBAL)
- {
- p->bind = STB_GLOBAL;
- p->abfd = abfd;
- }
- }
- *namep = NULL;
- return TRUE;
- }
- else if (*namep && **namep
- && info->hash->creator == abfd->xvec)
- {
- int i;
- struct sparc64_elf_app_reg *p;
-
- p = sparc64_elf_hash_table(info)->app_regs;
- for (i = 0; i < 4; i++, p++)
- if (p->name != NULL && ! strcmp (p->name, *namep))
- {
- unsigned char type = ELF_ST_TYPE (sym->st_info);
-
- if (type > STT_FUNC)
- type = 0;
- (*_bfd_error_handler)
- (_("Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"),
- *namep, stt_types[type], bfd_archive_filename (abfd),
- bfd_archive_filename (p->abfd));
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* This function takes care of emitting STT_REGISTER symbols
- which we cannot easily keep in the symbol hash table. */
-
-static bfd_boolean
-sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
- PTR finfo;
- bfd_boolean (*func)
- PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *,
- struct elf_link_hash_entry *));
-{
- int reg;
- struct sparc64_elf_app_reg *app_regs =
- sparc64_elf_hash_table(info)->app_regs;
- Elf_Internal_Sym sym;
-
- /* We arranged in size_dynamic_sections to put the STT_REGISTER entries
- at the end of the dynlocal list, so they came at the end of the local
- symbols in the symtab. Except that they aren't STB_LOCAL, so we need
- to back up symtab->sh_info. */
- if (elf_hash_table (info)->dynlocal)
- {
- bfd * dynobj = elf_hash_table (info)->dynobj;
- asection *dynsymsec = bfd_get_section_by_name (dynobj, ".dynsym");
- struct elf_link_local_dynamic_entry *e;
-
- for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
- if (e->input_indx == -1)
- break;
- if (e)
- {
- elf_section_data (dynsymsec->output_section)->this_hdr.sh_info
- = e->dynindx;
- }
- }
-
- if (info->strip == strip_all)
- return TRUE;
-
- for (reg = 0; reg < 4; reg++)
- if (app_regs [reg].name != NULL)
- {
- if (info->strip == strip_some
- && bfd_hash_lookup (info->keep_hash,
- app_regs [reg].name,
- FALSE, FALSE) == NULL)
- continue;
-
- sym.st_value = reg < 2 ? reg + 2 : reg + 4;
- sym.st_size = 0;
- sym.st_other = 0;
- sym.st_info = ELF_ST_INFO (app_regs [reg].bind, STT_REGISTER);
- sym.st_shndx = app_regs [reg].shndx;
- if (! (*func) (finfo, app_regs [reg].name, &sym,
- sym.st_shndx == SHN_ABS
- ? bfd_abs_section_ptr : bfd_und_section_ptr,
- NULL))
- return FALSE;
- }
-
- return TRUE;
-}
-
-static int
-sparc64_elf_get_symbol_type (elf_sym, type)
- Elf_Internal_Sym * elf_sym;
- int type;
-{
- if (ELF_ST_TYPE (elf_sym->st_info) == STT_REGISTER)
- return STT_REGISTER;
- else
- return type;
-}
-
-/* A STB_GLOBAL,STT_REGISTER symbol should be BSF_GLOBAL
- even in SHN_UNDEF section. */
-
-static void
-sparc64_elf_symbol_processing (abfd, asym)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol *asym;
-{
- elf_symbol_type *elfsym;
-
- elfsym = (elf_symbol_type *) asym;
- if (elfsym->internal_elf_sym.st_info
- == ELF_ST_INFO (STB_GLOBAL, STT_REGISTER))
- {
- asym->flags |= BSF_GLOBAL;
- }
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-sparc64_elf_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
-{
- bfd *dynobj;
- asection *s;
- unsigned int power_of_two;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- /* Make sure we know what is going on here. */
- BFD_ASSERT (dynobj != NULL
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
- || h->weakdef != NULL
- || ((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)));
-
- /* If this is a function, put it in the procedure linkage table. We
- will fill in the contents of the procedure linkage table later
- (although we could actually do it here). The STT_NOTYPE
- condition is a hack specifically for the Oracle libraries
- delivered for Solaris; for some inexplicable reason, they define
- some of their functions as STT_NOTYPE when they really should be
- STT_FUNC. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
- || (h->type == STT_NOTYPE
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->root.u.def.section->flags & SEC_CODE) != 0))
- {
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
- && h->root.type != bfd_link_hash_undefweak
- && h->root.type != bfd_link_hash_undefined)
- {
- /* This case can occur if we saw a WPLT30 reloc in an input
- file, but none of the input files were dynamic objects.
- In such a case, we don't actually need to build a
- procedure linkage table, and we can just do a WDISP30
- reloc instead. */
- BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
- return TRUE;
- }
-
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
-
- /* The first four bit in .plt is reserved. */
- if (s->_raw_size == 0)
- s->_raw_size = PLT_HEADER_SIZE;
-
- /* To simplify matters later, just store the plt index here. */
- h->plt.offset = s->_raw_size / PLT_ENTRY_SIZE;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = sparc64_elf_plt_entry_offset (h->plt.offset);
- }
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .rela.plt section. */
-
- s = bfd_get_section_by_name (dynobj, ".rela.plt");
- BFD_ASSERT (s != NULL);
-
- s->_raw_size += sizeof (Elf64_External_Rela);
-
- /* The procedure linkage table size is bounded by the magnitude
- of the offset we can describe in the entry. */
- if (s->_raw_size >= (bfd_vma)1 << 32)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- return TRUE;
- }
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
-
- s = bfd_get_section_by_name (dynobj, ".dynbss");
- BFD_ASSERT (s != NULL);
-
- /* We must generate a R_SPARC_COPY reloc to tell the dynamic linker
- to copy the initial value out of the dynamic object and into the
- runtime process image. We need to remember the offset into the
- .rel.bss section we are going to use. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- asection *srel;
-
- srel = bfd_get_section_by_name (dynobj, ".rela.bss");
- BFD_ASSERT (srel != NULL);
- srel->_raw_size += sizeof (Elf64_External_Rela);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. 16-bytes is the size
- of the largest type that requires hard alignment -- long double. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
- s->_raw_size = BFD_ALIGN (s->_raw_size,
- (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-sparc64_elf_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- asection *s;
- bfd_boolean relplt;
-
- dynobj = elf_hash_table (info)->dynobj;
- BFD_ASSERT (dynobj != NULL);
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
- else
- {
- /* We may have created entries in the .rela.got section.
- However, if we are not creating the dynamic sections, we will
- not actually use these entries. Reset the size of .rela.got,
- which will cause it to get stripped from the output file
- below. */
- s = bfd_get_section_by_name (dynobj, ".rela.got");
- if (s != NULL)
- s->_raw_size = 0;
- }
-
- /* The check_relocs and adjust_dynamic_symbol entry points have
- determined the sizes of the various dynamic sections. Allocate
- memory for them. */
- relplt = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- const char *name;
- bfd_boolean strip;
-
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
-
- strip = FALSE;
-
- if (strncmp (name, ".rela", 5) == 0)
- {
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is to handle .rela.bss and
- .rel.plt. We must create it in
- create_dynamic_sections, because it must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
- strip = TRUE;
- }
- else
- {
- if (strcmp (name, ".rela.plt") == 0)
- relplt = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- }
- else if (strcmp (name, ".plt") != 0
- && strncmp (name, ".got", 4) != 0)
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (strip)
- {
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. Zero the memory
- for the benefit of .rela.plt, which has 4 unused entries
- at the beginning, and we don't want garbage. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return FALSE;
- }
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in sparc64_elf_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- int reg;
- struct sparc64_elf_app_reg * app_regs;
- struct elf_strtab_hash *dynstr;
- struct elf_link_hash_table *eht = elf_hash_table (info);
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (relplt)
- {
- 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 (!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 (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
-
- /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
- entries if needed. */
- app_regs = sparc64_elf_hash_table (info)->app_regs;
- dynstr = eht->dynstr;
-
- for (reg = 0; reg < 4; reg++)
- if (app_regs [reg].name != NULL)
- {
- struct elf_link_local_dynamic_entry *entry, *e;
-
- if (!add_dynamic_entry (DT_SPARC_REGISTER, 0))
- return FALSE;
-
- entry = (struct elf_link_local_dynamic_entry *)
- bfd_hash_allocate (&info->hash->table, sizeof (*entry));
- if (entry == NULL)
- return FALSE;
-
- /* We cheat here a little bit: the symbol will not be local, so we
- put it at the end of the dynlocal linked list. We will fix it
- later on, as we have to fix other fields anyway. */
- entry->isym.st_value = reg < 2 ? reg + 2 : reg + 4;
- entry->isym.st_size = 0;
- if (*app_regs [reg].name != '\0')
- entry->isym.st_name
- = _bfd_elf_strtab_add (dynstr, app_regs[reg].name, FALSE);
- else
- entry->isym.st_name = 0;
- entry->isym.st_other = 0;
- entry->isym.st_info = ELF_ST_INFO (app_regs [reg].bind,
- STT_REGISTER);
- entry->isym.st_shndx = app_regs [reg].shndx;
- entry->next = NULL;
- entry->input_bfd = output_bfd;
- entry->input_indx = -1;
-
- if (eht->dynlocal == NULL)
- eht->dynlocal = entry;
- else
- {
- for (e = eht->dynlocal; e->next; e = e->next)
- ;
- e->next = entry;
- }
- eht->dynsymcount++;
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-static bfd_boolean
-sparc64_elf_new_section_hook (abfd, sec)
- bfd *abfd;
- asection *sec;
-{
- struct sparc64_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
-
- sdata = (struct sparc64_elf_section_data *) bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = (PTR) sdata;
-
- return _bfd_elf_new_section_hook (abfd, sec);
-}
-
-static bfd_boolean
-sparc64_elf_relax_section (abfd, section, link_info, again)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- bfd_boolean *again;
-{
- *again = FALSE;
- sec_do_relax (section) = 1;
- return TRUE;
-}
-
-/* Relocate a SPARC64 ELF section. */
-
-static bfd_boolean
-sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- bfd *dynobj;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- bfd_vma got_base;
- asection *sgot;
- asection *splt;
- asection *sreloc;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
-
- if (info->relocatable)
- return TRUE;
-
- dynobj = elf_hash_table (info)->dynobj;
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
-
- if (elf_hash_table(info)->hgot == NULL)
- got_base = 0;
- else
- got_base = elf_hash_table (info)->hgot->root.u.def.value;
-
- sgot = splt = sreloc = NULL;
- if (dynobj != NULL)
- splt = bfd_get_section_by_name (dynobj, ".plt");
-
- rel = relocs;
- relend = relocs + NUM_SHDR_ENTRIES (& elf_section_data (input_section)->rel_hdr);
- for (; rel < relend; rel++)
- {
- int r_type;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sec;
- bfd_vma relocation, off;
- bfd_reloc_status_type r;
- bfd_boolean is_plt = FALSE;
- bfd_boolean unresolved_reloc;
-
- r_type = ELF64_R_TYPE_ID (rel->r_info);
- if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- howto = sparc64_elf_howto_table + r_type;
-
- /* This is a final link. */
- r_symndx = ELF64_R_SYM (rel->r_info);
- h = NULL;
- sym = NULL;
- sec = NULL;
- unresolved_reloc = FALSE;
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- }
- else
- {
- bfd_boolean warned;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
- if (warned)
- {
- /* To avoid generating warning messages about truncated
- relocations, set the relocation's address to be the same as
- the start of this section. */
- if (input_section->output_section != NULL)
- relocation = input_section->output_section->vma;
- else
- relocation = 0;
- }
- }
-
- do_dynreloc:
- /* When generating a shared object, these relocations are copied
- into the output file to be resolved at run time. */
- if (info->shared && r_symndx != 0 && (input_section->flags & SEC_ALLOC))
- {
- switch (r_type)
- {
- case R_SPARC_PC10:
- case R_SPARC_PC22:
- case R_SPARC_PC_HH22:
- case R_SPARC_PC_HM10:
- case R_SPARC_PC_LM22:
- if (h != NULL
- && !strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_"))
- break;
- /* Fall through. */
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- case R_SPARC_DISP64:
- case R_SPARC_WDISP30:
- case R_SPARC_WDISP22:
- case R_SPARC_WDISP19:
- case R_SPARC_WDISP16:
- if (h == NULL)
- break;
- /* Fall through. */
- case R_SPARC_8:
- case R_SPARC_16:
- case R_SPARC_32:
- case R_SPARC_HI22:
- case R_SPARC_22:
- case R_SPARC_13:
- case R_SPARC_LO10:
- case R_SPARC_UA32:
- case R_SPARC_10:
- case R_SPARC_11:
- case R_SPARC_64:
- case R_SPARC_OLO10:
- case R_SPARC_HH22:
- case R_SPARC_HM10:
- case R_SPARC_LM22:
- case R_SPARC_7:
- case R_SPARC_5:
- case R_SPARC_6:
- case R_SPARC_HIX22:
- case R_SPARC_LOX10:
- case R_SPARC_H44:
- case R_SPARC_M44:
- case R_SPARC_L44:
- case R_SPARC_UA64:
- case R_SPARC_UA16:
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- bfd_boolean skip, relocate;
-
- if (sreloc == NULL)
- {
- const char *name =
- (bfd_elf_string_from_elf_section
- (input_bfd,
- elf_elfheader (input_bfd)->e_shstrndx,
- elf_section_data (input_section)->rel_hdr.sh_name));
-
- if (name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name(input_bfd,
- input_section),
- name + 5) == 0);
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- BFD_ASSERT (sreloc != NULL);
- }
-
- skip = FALSE;
- relocate = FALSE;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
-
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- /* Optimize unaligned reloc usage now that we know where
- it finally resides. */
- switch (r_type)
- {
- case R_SPARC_16:
- if (outrel.r_offset & 1) r_type = R_SPARC_UA16;
- break;
- case R_SPARC_UA16:
- if (!(outrel.r_offset & 1)) r_type = R_SPARC_16;
- break;
- case R_SPARC_32:
- if (outrel.r_offset & 3) r_type = R_SPARC_UA32;
- break;
- case R_SPARC_UA32:
- if (!(outrel.r_offset & 3)) r_type = R_SPARC_32;
- break;
- case R_SPARC_64:
- if (outrel.r_offset & 7) r_type = R_SPARC_UA64;
- break;
- case R_SPARC_UA64:
- if (!(outrel.r_offset & 7)) r_type = R_SPARC_64;
- break;
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- case R_SPARC_DISP64:
- /* If the symbol is not dynamic, we should not keep
- a dynamic relocation. But an .rela.* slot has been
- allocated for it, output R_SPARC_NONE.
- FIXME: Add code tracking needed dynamic relocs as
- e.g. i386 has. */
- if (h->dynindx == -1)
- skip = TRUE, relocate = TRUE;
- break;
- }
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
- /* h->dynindx may be -1 if the symbol was marked to
- become local. */
- else if (h != NULL && ! is_plt
- && ((! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- BFD_ASSERT (h->dynindx != -1);
- outrel.r_info
- = ELF64_R_INFO (h->dynindx,
- ELF64_R_TYPE_INFO (
- ELF64_R_TYPE_DATA (rel->r_info),
- r_type));
- outrel.r_addend = rel->r_addend;
- }
- else
- {
- outrel.r_addend = relocation + rel->r_addend;
- if (r_type == R_SPARC_64)
- outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
- else
- {
- long indx;
-
- if (is_plt)
- sec = splt;
-
- if (bfd_is_abs_section (sec))
- indx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- asection *osec;
-
- osec = sec->output_section;
- indx = elf_section_data (osec)->dynindx;
-
- /* We are turning this relocation into one
- against a section symbol, so subtract out
- the output section's address but not the
- offset of the input section in the output
- section. */
- outrel.r_addend -= osec->vma;
-
- /* FIXME: we really should be able to link non-pic
- shared libraries. */
- if (indx == 0)
- {
- BFD_FAIL ();
- (*_bfd_error_handler)
- (_("%s: probably compiled without -fPIC?"),
- bfd_archive_filename (input_bfd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
-
- outrel.r_info
- = ELF64_R_INFO (indx,
- ELF64_R_TYPE_INFO (
- ELF64_R_TYPE_DATA (rel->r_info),
- r_type));
- }
- }
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
-
- /* This reloc will be computed at runtime, so there's no
- need to do anything now. */
- if (! relocate)
- continue;
- }
- break;
- }
- }
-
- switch (r_type)
- {
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- if (sgot == NULL)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (h != NULL)
- {
- bfd_boolean dyn;
-
- off = h->got.offset;
- BFD_ASSERT (off != (bfd_vma) -1);
- dyn = elf_hash_table (info)->dynamic_sections_created;
-
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is actually a static link, or it is a -Bsymbolic
- link and the symbol is defined locally, or the symbol
- was forced to be local because of a version file. We
- must initialize this entry in the global offset table.
- Since the offset must always be a multiple of 8, we
- use the least significant bit to record whether we
- have initialized it already.
-
- When doing a dynamic link, we create a .rela.got
- relocation entry to initialize the value. This is
- done in the finish_dynamic_symbol routine. */
-
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_64 (output_bfd, relocation,
- sgot->contents + off);
- h->got.offset |= 1;
- }
- }
- else
- unresolved_reloc = FALSE;
- }
- else
- {
- BFD_ASSERT (local_got_offsets != NULL);
- off = local_got_offsets[r_symndx];
- BFD_ASSERT (off != (bfd_vma) -1);
-
- /* The offset must always be a multiple of 8. We use
- the least significant bit to record whether we have
- already processed this entry. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- local_got_offsets[r_symndx] |= 1;
-
- if (info->shared)
- {
- asection *s;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- /* The Solaris 2.7 64-bit linker adds the contents
- of the location to the value of the reloc.
- Note this is different behaviour to the
- 32-bit linker, which both adds the contents
- and ignores the addend. So clear the location. */
- bfd_put_64 (output_bfd, (bfd_vma) 0,
- sgot->contents + off);
-
- /* We need to generate a R_SPARC_RELATIVE reloc
- for the dynamic linker. */
- s = bfd_get_section_by_name(dynobj, ".rela.got");
- BFD_ASSERT (s != NULL);
-
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + off);
- outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
- outrel.r_addend = relocation;
- loc = s->contents;
- loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
- else
- bfd_put_64 (output_bfd, relocation, sgot->contents + off);
- }
- }
- relocation = sgot->output_offset + off - got_base;
- goto do_default;
-
- case R_SPARC_WPLT30:
- case R_SPARC_PLT32:
- case R_SPARC_HIPLT22:
- case R_SPARC_LOPLT10:
- case R_SPARC_PCPLT32:
- case R_SPARC_PCPLT22:
- case R_SPARC_PCPLT10:
- case R_SPARC_PLT64:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
- BFD_ASSERT (h != NULL);
-
- if (h->plt.offset == (bfd_vma) -1 || splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- goto do_default;
- }
-
- relocation = (splt->output_section->vma
- + splt->output_offset
- + sparc64_elf_plt_entry_offset (h->plt.offset));
- unresolved_reloc = FALSE;
- if (r_type == R_SPARC_WPLT30)
- goto do_wplt30;
- if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64)
- {
- r_type = r_type == R_SPARC_PLT32 ? R_SPARC_32 : R_SPARC_64;
- is_plt = TRUE;
- goto do_dynreloc;
- }
- goto do_default;
-
- case R_SPARC_OLO10:
- {
- bfd_vma x;
-
- relocation += rel->r_addend;
- relocation = (relocation & 0x3ff) + ELF64_R_TYPE_DATA (rel->r_info);
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff);
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
-
- r = bfd_check_overflow (howto->complain_on_overflow,
- howto->bitsize, howto->rightshift,
- bfd_arch_bits_per_address (input_bfd),
- relocation);
- }
- break;
-
- case R_SPARC_WDISP16:
- {
- bfd_vma x;
-
- relocation += rel->r_addend;
- /* Adjust for pc-relative-ness. */
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- relocation -= rel->r_offset;
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x &= ~(bfd_vma) 0x303fff;
- x |= ((((relocation >> 2) & 0xc000) << 6)
- | ((relocation >> 2) & 0x3fff));
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
-
- r = bfd_check_overflow (howto->complain_on_overflow,
- howto->bitsize, howto->rightshift,
- bfd_arch_bits_per_address (input_bfd),
- relocation);
- }
- break;
-
- case R_SPARC_HIX22:
- {
- bfd_vma x;
-
- relocation += rel->r_addend;
- relocation = relocation ^ MINUS_ONE;
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
-
- r = bfd_check_overflow (howto->complain_on_overflow,
- howto->bitsize, howto->rightshift,
- bfd_arch_bits_per_address (input_bfd),
- relocation);
- }
- break;
-
- case R_SPARC_LOX10:
- {
- bfd_vma x;
-
- relocation += rel->r_addend;
- relocation = (relocation & 0x3ff) | 0x1c00;
-
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~(bfd_vma) 0x1fff) | relocation;
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
-
- r = bfd_reloc_ok;
- }
- break;
-
- case R_SPARC_WDISP30:
- do_wplt30:
- if (sec_do_relax (input_section)
- && rel->r_offset + 4 < input_section->_raw_size)
- {
-#define G0 0
-#define O7 15
-#define XCC (2 << 20)
-#define COND(x) (((x)&0xf)<<25)
-#define CONDA COND(0x8)
-#define INSN_BPA (F2(0,1) | CONDA | BPRED | XCC)
-#define INSN_BA (F2(0,2) | CONDA)
-#define INSN_OR F3(2, 0x2, 0)
-#define INSN_NOP F2(0,4)
-
- bfd_vma x, y;
-
- /* If the instruction is a call with either:
- restore
- arithmetic instruction with rd == %o7
- where rs1 != %o7 and rs2 if it is register != %o7
- then we can optimize if the call destination is near
- by changing the call into a branch always. */
- x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
- if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2))
- {
- if (((y & OP3(~0)) == OP3(0x3d) /* restore */
- || ((y & OP3(0x28)) == 0 /* arithmetic */
- && (y & RD(~0)) == RD(O7)))
- && (y & RS1(~0)) != RS1(O7)
- && ((y & F3I(~0))
- || (y & RS2(~0)) != RS2(O7)))
- {
- bfd_vma reloc;
-
- reloc = relocation + rel->r_addend - rel->r_offset;
- reloc -= (input_section->output_section->vma
- + input_section->output_offset);
- if (reloc & 3)
- goto do_default;
-
- /* Ensure the branch fits into simm22. */
- if ((reloc & ~(bfd_vma)0x7fffff)
- && ((reloc | 0x7fffff) != MINUS_ONE))
- goto do_default;
- reloc >>= 2;
-
- /* Check whether it fits into simm19. */
- if ((reloc & 0x3c0000) == 0
- || (reloc & 0x3c0000) == 0x3c0000)
- x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */
- else
- x = INSN_BA | (reloc & 0x3fffff); /* ba */
- bfd_put_32 (input_bfd, x, contents + rel->r_offset);
- r = bfd_reloc_ok;
- if (rel->r_offset >= 4
- && (y & (0xffffffff ^ RS1(~0)))
- == (INSN_OR | RD(O7) | RS2(G0)))
- {
- bfd_vma z;
- unsigned int reg;
-
- z = bfd_get_32 (input_bfd,
- contents + rel->r_offset - 4);
- if ((z & (0xffffffff ^ RD(~0)))
- != (INSN_OR | RS1(O7) | RS2(G0)))
- break;
-
- /* The sequence was
- or %o7, %g0, %rN
- call foo
- or %rN, %g0, %o7
-
- If call foo was replaced with ba, replace
- or %rN, %g0, %o7 with nop. */
-
- reg = (y & RS1(~0)) >> 14;
- if (reg != ((z & RD(~0)) >> 25)
- || reg == G0 || reg == O7)
- break;
-
- bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP,
- contents + rel->r_offset + 4);
- }
- break;
- }
- }
- }
- /* Fall through. */
-
- default:
- do_default:
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, rel->r_addend);
- break;
- }
-
- /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
- because such sections are not SEC_ALLOC and thus ld.so will
- not process them. */
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- h->root.root.string);
-
- switch (r)
- {
- case bfd_reloc_ok:
- break;
-
- default:
- case bfd_reloc_outofrange:
- abort ();
-
- case bfd_reloc_overflow:
- {
- const char *name;
-
- /* The Solaris native linker silently disregards
- overflows. We don't, but this breaks stabs debugging
- info, whose relocations are only 32-bits wide. Ignore
- overflows for discarded entries. */
- if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32)
- && _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset) == (bfd_vma) -1)
- break;
-
- if (h != NULL)
- {
- if (h->root.type == bfd_link_hash_undefweak
- && howto->pc_relative)
- {
- /* Assume this is a call protected by other code that
- detect the symbol is undefined. If this is the case,
- we can safely ignore the overflow. If not, the
- program is hosed anyway, and a little warning isn't
- going to help. */
- break;
- }
-
- name = h->root.root.string;
- }
- else
- {
- name = (bfd_elf_string_from_elf_section
- (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name));
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- bfd *dynobj;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- asection *splt;
- asection *srela;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the PLT. Set it up. */
-
- BFD_ASSERT (h->dynindx != -1);
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- srela = bfd_get_section_by_name (dynobj, ".rela.plt");
- BFD_ASSERT (splt != NULL && srela != NULL);
-
- /* Fill in the entry in the .rela.plt section. */
-
- if (h->plt.offset < LARGE_PLT_THRESHOLD)
- {
- rela.r_offset = sparc64_elf_plt_entry_offset (h->plt.offset);
- rela.r_addend = 0;
- }
- else
- {
- bfd_vma max = splt->_raw_size / PLT_ENTRY_SIZE;
- rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max);
- rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4)
- -(splt->output_section->vma + splt->output_offset);
- }
- rela.r_offset += (splt->output_section->vma + splt->output_offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
-
- /* Adjust for the first 4 reserved elements in the .plt section
- when setting the offset in the .rela.plt section.
- Sun forgot to read their own ABI and copied elf32-sparc behaviour,
- thus .plt[4] has corresponding .rela.plt[0] and so on. */
-
- loc = srela->contents;
- loc += (h->plt.offset - 4) * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. */
- sym->st_shndx = SHN_UNDEF;
- /* If the symbol is weak, we do need to clear the value.
- Otherwise, the PLT entry would provide a definition for
- the symbol even if the symbol wasn't defined anywhere,
- and so the symbol would never be NULL. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
- == 0)
- sym->st_value = 0;
- }
- }
-
- if (h->got.offset != (bfd_vma) -1)
- {
- asection *sgot;
- asection *srela;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the GOT. Set it up. */
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srela = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (sgot != NULL && srela != NULL);
-
- rela.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + (h->got.offset &~ (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
- the symbol was forced to be local because of a version file.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && (info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
- asection *sec = h->root.u.def.section;
- rela.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else
- {
- rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
- rela.r_addend = 0;
- }
-
- bfd_put_64 (output_bfd, (bfd_vma) 0,
- sgot->contents + (h->got.offset &~ (bfd_vma) 1));
- loc = srela->contents;
- loc += srela->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- asection *s;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbols needs a copy reloc. Set it up. */
- BFD_ASSERT (h->dynindx != -1);
-
- s = bfd_get_section_by_name (h->root.u.def.section->owner,
- ".rela.bss");
- BFD_ASSERT (s != NULL);
-
- rela.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_COPY);
- rela.r_addend = 0;
- loc = s->contents + s->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-sparc64_elf_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- int stt_regidx = -1;
- asection *sdyn;
- asection *sgot;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- asection *splt;
- Elf64_External_Dyn *dyncon, *dynconend;
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL && sdyn != NULL);
-
- dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- bfd_boolean size;
-
- bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- case DT_PLTGOT: name = ".plt"; size = FALSE; break;
- case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break;
- case DT_JMPREL: name = ".rela.plt"; size = FALSE; break;
- case DT_SPARC_REGISTER:
- if (stt_regidx == -1)
- {
- stt_regidx =
- _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1);
- if (stt_regidx == -1)
- return FALSE;
- }
- dyn.d_un.d_val = stt_regidx++;
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- /* fallthrough */
- default: name = NULL; size = FALSE; break;
- }
-
- if (name != NULL)
- {
- asection *s;
-
- s = bfd_get_section_by_name (output_bfd, name);
- if (s == NULL)
- dyn.d_un.d_val = 0;
- else
- {
- if (! size)
- dyn.d_un.d_ptr = s->vma;
- else
- {
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
- }
- }
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
- }
-
- /* Initialize the contents of the .plt section. */
- if (splt->_raw_size > 0)
- sparc64_elf_build_plt (output_bfd, splt->contents,
- (int) (splt->_raw_size / PLT_ENTRY_SIZE));
-
- elf_section_data (splt->output_section)->this_hdr.sh_entsize =
- PLT_ENTRY_SIZE;
- }
-
- /* Set the first entry in the global offset table to the address of
- the dynamic section. */
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- if (sgot->_raw_size > 0)
- {
- if (sdyn == NULL)
- bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents);
- else
- bfd_put_64 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- sgot->contents);
- }
-
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8;
-
- return TRUE;
-}
-
-static enum elf_reloc_type_class
-sparc64_elf_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
-{
- switch ((int) ELF64_R_TYPE (rela->r_info))
- {
- case R_SPARC_RELATIVE:
- return reloc_class_relative;
- case R_SPARC_JMP_SLOT:
- return reloc_class_plt;
- case R_SPARC_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-/* Functions for dealing with the e_flags field. */
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
-
-static bfd_boolean
-sparc64_elf_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
-{
- bfd_boolean error;
- flagword new_flags, old_flags;
- int new_mm, old_mm;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- new_flags = elf_elfheader (ibfd)->e_flags;
- old_flags = elf_elfheader (obfd)->e_flags;
-
- if (!elf_flags_init (obfd)) /* First call, no flags set */
- {
- elf_flags_init (obfd) = TRUE;
- elf_elfheader (obfd)->e_flags = new_flags;
- }
-
- else if (new_flags == old_flags) /* Compatible flags are ok */
- ;
-
- else /* Incompatible flags */
- {
- error = FALSE;
-
-#define EF_SPARC_ISA_EXTENSIONS \
- (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3 | EF_SPARC_HAL_R1)
-
- if ((ibfd->flags & DYNAMIC) != 0)
- {
- /* We don't want dynamic objects memory ordering and
- architecture to have any role. That's what dynamic linker
- should do. */
- new_flags &= ~(EF_SPARCV9_MM | EF_SPARC_ISA_EXTENSIONS);
- new_flags |= (old_flags
- & (EF_SPARCV9_MM | EF_SPARC_ISA_EXTENSIONS));
- }
- else
- {
- /* Choose the highest architecture requirements. */
- old_flags |= (new_flags & EF_SPARC_ISA_EXTENSIONS);
- new_flags |= (old_flags & EF_SPARC_ISA_EXTENSIONS);
- if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3))
- && (old_flags & EF_SPARC_HAL_R1))
- {
- error = TRUE;
- (*_bfd_error_handler)
- (_("%s: linking UltraSPARC specific with HAL specific code"),
- bfd_archive_filename (ibfd));
- }
- /* Choose the most restrictive memory ordering. */
- old_mm = (old_flags & EF_SPARCV9_MM);
- new_mm = (new_flags & EF_SPARCV9_MM);
- old_flags &= ~EF_SPARCV9_MM;
- new_flags &= ~EF_SPARCV9_MM;
- if (new_mm < old_mm)
- old_mm = new_mm;
- old_flags |= old_mm;
- new_flags |= old_mm;
- }
-
- /* Warn about any other mismatches */
- if (new_flags != old_flags)
- {
- error = TRUE;
- (*_bfd_error_handler)
- (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
- bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
- }
-
- elf_elfheader (obfd)->e_flags = old_flags;
-
- if (error)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* MARCO: Set the correct entry size for the .stab section. */
-
-static bfd_boolean
-sparc64_elf_fake_sections (abfd, hdr, sec)
- bfd *abfd ATTRIBUTE_UNUSED;
- Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
- asection *sec;
-{
- const char *name;
-
- name = bfd_get_section_name (abfd, sec);
-
- if (strcmp (name, ".stab") == 0)
- {
- /* Even in the 64bit case the stab entries are only 12 bytes long. */
- elf_section_data (sec)->this_hdr.sh_entsize = 12;
- }
-
- return TRUE;
-}
-
-/* Print a STT_REGISTER symbol to file FILE. */
-
-static const char *
-sparc64_elf_print_symbol_all (abfd, filep, symbol)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filep;
- asymbol *symbol;
-{
- FILE *file = (FILE *) filep;
- int reg, type;
-
- if (ELF_ST_TYPE (((elf_symbol_type *) symbol)->internal_elf_sym.st_info)
- != STT_REGISTER)
- return NULL;
-
- reg = ((elf_symbol_type *) symbol)->internal_elf_sym.st_value;
- type = symbol->flags;
- fprintf (file, "REG_%c%c%11s%c%c R", "GOLI" [reg / 8], '0' + (reg & 7), "",
- ((type & BSF_LOCAL)
- ? (type & BSF_GLOBAL) ? '!' : 'l'
- : (type & BSF_GLOBAL) ? 'g' : ' '),
- (type & BSF_WEAK) ? 'w' : ' ');
- if (symbol->name == NULL || symbol->name [0] == '\0')
- return "#scratch";
- else
- return symbol->name;
-}
-
-/* Set the right machine number for a SPARC64 ELF file. */
-
-static bfd_boolean
-sparc64_elf_object_p (abfd)
- bfd *abfd;
-{
- unsigned long mach = bfd_mach_sparc_v9;
-
- if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3)
- mach = bfd_mach_sparc_v9b;
- else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
- mach = bfd_mach_sparc_v9a;
- return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, mach);
-}
-
-/* Relocations in the 64 bit SPARC ELF ABI are more complex than in
- standard ELF, because R_SPARC_OLO10 has secondary addend in
- ELF64_R_TYPE_DATA field. This structure is used to redirect the
- relocation handling routines. */
-
-const struct elf_size_info sparc64_elf_size_info =
-{
- sizeof (Elf64_External_Ehdr),
- sizeof (Elf64_External_Phdr),
- sizeof (Elf64_External_Shdr),
- sizeof (Elf64_External_Rel),
- sizeof (Elf64_External_Rela),
- sizeof (Elf64_External_Sym),
- sizeof (Elf64_External_Dyn),
- sizeof (Elf_External_Note),
- 4, /* hash-table entry size. */
- /* Internal relocations per external relocations.
- For link purposes we use just 1 internal per
- 1 external, for assembly and slurp symbol table
- we use 2. */
- 1,
- 64, /* arch_size. */
- 3, /* log_file_align. */
- ELFCLASS64,
- EV_CURRENT,
- bfd_elf64_write_out_phdrs,
- bfd_elf64_write_shdrs_and_ehdr,
- sparc64_elf_write_relocs,
- bfd_elf64_swap_symbol_in,
- bfd_elf64_swap_symbol_out,
- sparc64_elf_slurp_reloc_table,
- bfd_elf64_slurp_symbol_table,
- bfd_elf64_swap_dyn_in,
- bfd_elf64_swap_dyn_out,
- bfd_elf64_swap_reloc_in,
- bfd_elf64_swap_reloc_out,
- bfd_elf64_swap_reloca_in,
- bfd_elf64_swap_reloca_out
-};
-
-#define TARGET_BIG_SYM bfd_elf64_sparc_vec
-#define TARGET_BIG_NAME "elf64-sparc"
-#define ELF_ARCH bfd_arch_sparc
-#define ELF_MAXPAGESIZE 0x100000
-
-/* This is the official ABI value. */
-#define ELF_MACHINE_CODE EM_SPARCV9
-
-/* This is the value that we used before the ABI was released. */
-#define ELF_MACHINE_ALT1 EM_OLD_SPARCV9
-
-#define bfd_elf64_bfd_link_hash_table_create \
- sparc64_elf_bfd_link_hash_table_create
-
-#define elf_info_to_howto \
- sparc64_elf_info_to_howto
-#define bfd_elf64_get_reloc_upper_bound \
- sparc64_elf_get_reloc_upper_bound
-#define bfd_elf64_get_dynamic_reloc_upper_bound \
- sparc64_elf_get_dynamic_reloc_upper_bound
-#define bfd_elf64_canonicalize_reloc \
- sparc64_elf_canonicalize_reloc
-#define bfd_elf64_canonicalize_dynamic_reloc \
- sparc64_elf_canonicalize_dynamic_reloc
-#define bfd_elf64_bfd_reloc_type_lookup \
- sparc64_elf_reloc_type_lookup
-#define bfd_elf64_bfd_relax_section \
- sparc64_elf_relax_section
-#define bfd_elf64_new_section_hook \
- sparc64_elf_new_section_hook
-
-#define elf_backend_create_dynamic_sections \
- _bfd_elf_create_dynamic_sections
-#define elf_backend_add_symbol_hook \
- sparc64_elf_add_symbol_hook
-#define elf_backend_get_symbol_type \
- sparc64_elf_get_symbol_type
-#define elf_backend_symbol_processing \
- sparc64_elf_symbol_processing
-#define elf_backend_check_relocs \
- sparc64_elf_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
- sparc64_elf_adjust_dynamic_symbol
-#define elf_backend_size_dynamic_sections \
- sparc64_elf_size_dynamic_sections
-#define elf_backend_relocate_section \
- sparc64_elf_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- sparc64_elf_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- sparc64_elf_finish_dynamic_sections
-#define elf_backend_print_symbol_all \
- sparc64_elf_print_symbol_all
-#define elf_backend_output_arch_syms \
- sparc64_elf_output_arch_syms
-#define bfd_elf64_bfd_merge_private_bfd_data \
- sparc64_elf_merge_private_bfd_data
-#define elf_backend_fake_sections \
- sparc64_elf_fake_sections
-
-#define elf_backend_size_info \
- sparc64_elf_size_info
-#define elf_backend_object_p \
- sparc64_elf_object_p
-#define elf_backend_reloc_type_class \
- sparc64_elf_reloc_type_class
-
-#define elf_backend_want_got_plt 0
-#define elf_backend_plt_readonly 0
-#define elf_backend_want_plt_sym 1
-#define elf_backend_rela_normal 1
-
-/* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table. */
-#define elf_backend_plt_alignment 8
-
-#define elf_backend_got_header_size 8
-
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-x86-64.c b/contrib/binutils/bfd/elf64-x86-64.c
deleted file mode 100644
index a1d6250..0000000
--- a/contrib/binutils/bfd/elf64-x86-64.c
+++ /dev/null
@@ -1,2790 +0,0 @@
-/* X86-64 specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
- Contributed by Jan Hubicka <jh@suse.cz>.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-#include "elf/x86-64.h"
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
-#define MINUS_ONE (~ (bfd_vma) 0)
-
-/* The relocation "howto" table. Order of fields:
- type, size, bitsize, pc_relative, complain_on_overflow,
- special_function, name, partial_inplace, src_mask, dst_pack, pcrel_offset. */
-static reloc_howto_type x86_64_elf_howto_table[] =
-{
- HOWTO(R_X86_64_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_X86_64_NONE", FALSE, 0x00000000, 0x00000000,
- FALSE),
- HOWTO(R_X86_64_64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_64", FALSE, MINUS_ONE, MINUS_ONE,
- FALSE),
- HOWTO(R_X86_64_PC32, 0, 2, 32, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_PC32", FALSE, 0xffffffff, 0xffffffff,
- TRUE),
- HOWTO(R_X86_64_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_GOT32", FALSE, 0xffffffff, 0xffffffff,
- FALSE),
- HOWTO(R_X86_64_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_PLT32", FALSE, 0xffffffff, 0xffffffff,
- TRUE),
- HOWTO(R_X86_64_COPY, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_COPY", FALSE, 0xffffffff, 0xffffffff,
- FALSE),
- HOWTO(R_X86_64_GLOB_DAT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_GLOB_DAT", FALSE, MINUS_ONE,
- MINUS_ONE, FALSE),
- HOWTO(R_X86_64_JUMP_SLOT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_JUMP_SLOT", FALSE, MINUS_ONE,
- MINUS_ONE, FALSE),
- HOWTO(R_X86_64_RELATIVE, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_RELATIVE", FALSE, MINUS_ONE,
- MINUS_ONE, FALSE),
- HOWTO(R_X86_64_GOTPCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_GOTPCREL", FALSE, 0xffffffff,
- 0xffffffff, TRUE),
- HOWTO(R_X86_64_32, 0, 2, 32, FALSE, 0, complain_overflow_unsigned,
- bfd_elf_generic_reloc, "R_X86_64_32", FALSE, 0xffffffff, 0xffffffff,
- FALSE),
- HOWTO(R_X86_64_32S, 0, 2, 32, FALSE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_32S", FALSE, 0xffffffff, 0xffffffff,
- FALSE),
- HOWTO(R_X86_64_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_16", FALSE, 0xffff, 0xffff, FALSE),
- HOWTO(R_X86_64_PC16,0, 1, 16, TRUE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_PC16", FALSE, 0xffff, 0xffff, TRUE),
- HOWTO(R_X86_64_8, 0, 0, 8, FALSE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_8", FALSE, 0xff, 0xff, FALSE),
- HOWTO(R_X86_64_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_PC8", FALSE, 0xff, 0xff, TRUE),
- HOWTO(R_X86_64_DTPMOD64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_DTPMOD64", FALSE, MINUS_ONE,
- MINUS_ONE, FALSE),
- HOWTO(R_X86_64_DTPOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_DTPOFF64", FALSE, MINUS_ONE,
- MINUS_ONE, FALSE),
- HOWTO(R_X86_64_TPOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_TPOFF64", FALSE, MINUS_ONE,
- MINUS_ONE, FALSE),
- HOWTO(R_X86_64_TLSGD, 0, 2, 32, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_TLSGD", FALSE, 0xffffffff,
- 0xffffffff, TRUE),
- HOWTO(R_X86_64_TLSLD, 0, 2, 32, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_TLSLD", FALSE, 0xffffffff,
- 0xffffffff, TRUE),
- HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_DTPOFF32", FALSE, 0xffffffff,
- 0xffffffff, FALSE),
- HOWTO(R_X86_64_GOTTPOFF, 0, 2, 32, TRUE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_GOTTPOFF", FALSE, 0xffffffff,
- 0xffffffff, TRUE),
- HOWTO(R_X86_64_TPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_TPOFF32", FALSE, 0xffffffff,
- 0xffffffff, FALSE),
-
-/* GNU extension to record C++ vtable hierarchy. */
- HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, FALSE, 0, complain_overflow_dont,
- NULL, "R_X86_64_GNU_VTINHERIT", FALSE, 0, 0, FALSE),
-
-/* GNU extension to record C++ vtable member usage. */
- HOWTO (R_X86_64_GNU_VTENTRY, 0, 4, 0, FALSE, 0, complain_overflow_dont,
- _bfd_elf_rel_vtable_reloc_fn, "R_X86_64_GNU_VTENTRY", FALSE, 0, 0,
- FALSE)
-};
-
-/* Map BFD relocs to the x86_64 elf relocs. */
-struct elf_reloc_map
-{
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
-};
-
-static const struct elf_reloc_map x86_64_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_X86_64_NONE, },
- { BFD_RELOC_64, R_X86_64_64, },
- { BFD_RELOC_32_PCREL, R_X86_64_PC32, },
- { BFD_RELOC_X86_64_GOT32, R_X86_64_GOT32,},
- { BFD_RELOC_X86_64_PLT32, R_X86_64_PLT32,},
- { BFD_RELOC_X86_64_COPY, R_X86_64_COPY, },
- { BFD_RELOC_X86_64_GLOB_DAT, R_X86_64_GLOB_DAT, },
- { BFD_RELOC_X86_64_JUMP_SLOT, R_X86_64_JUMP_SLOT, },
- { BFD_RELOC_X86_64_RELATIVE, R_X86_64_RELATIVE, },
- { BFD_RELOC_X86_64_GOTPCREL, R_X86_64_GOTPCREL, },
- { BFD_RELOC_32, R_X86_64_32, },
- { BFD_RELOC_X86_64_32S, R_X86_64_32S, },
- { BFD_RELOC_16, R_X86_64_16, },
- { BFD_RELOC_16_PCREL, R_X86_64_PC16, },
- { BFD_RELOC_8, R_X86_64_8, },
- { BFD_RELOC_8_PCREL, R_X86_64_PC8, },
- { BFD_RELOC_X86_64_DTPMOD64, R_X86_64_DTPMOD64, },
- { BFD_RELOC_X86_64_DTPOFF64, R_X86_64_DTPOFF64, },
- { BFD_RELOC_X86_64_TPOFF64, R_X86_64_TPOFF64, },
- { BFD_RELOC_X86_64_TLSGD, R_X86_64_TLSGD, },
- { BFD_RELOC_X86_64_TLSLD, R_X86_64_TLSLD, },
- { BFD_RELOC_X86_64_DTPOFF32, R_X86_64_DTPOFF32, },
- { BFD_RELOC_X86_64_GOTTPOFF, R_X86_64_GOTTPOFF, },
- { BFD_RELOC_X86_64_TPOFF32, R_X86_64_TPOFF32, },
- { BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, },
- { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, },
-};
-
-
-/* Given a BFD reloc type, return a HOWTO structure. */
-static reloc_howto_type *
-elf64_x86_64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
-{
- unsigned int i;
-
- for (i = 0; i < sizeof (x86_64_reloc_map) / sizeof (struct elf_reloc_map);
- i++)
- {
- if (x86_64_reloc_map[i].bfd_reloc_val == code)
- return &x86_64_elf_howto_table[i];
- }
- return 0;
-}
-
-/* Given an x86_64 ELF reloc type, fill in an arelent structure. */
-
-static void
-elf64_x86_64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
- Elf_Internal_Rela *dst)
-{
- unsigned r_type, i;
-
- r_type = ELF64_R_TYPE (dst->r_info);
- if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT)
- {
- BFD_ASSERT (r_type <= (unsigned int) R_X86_64_TPOFF32);
- i = r_type;
- }
- else
- {
- BFD_ASSERT (r_type < (unsigned int) R_X86_64_max);
- i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_TPOFF32 - 1);
- }
- cache_ptr->howto = &x86_64_elf_howto_table[i];
- BFD_ASSERT (r_type == cache_ptr->howto->type);
-}
-
-/* Support for core dump NOTE sections. */
-static bfd_boolean
-elf64_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- int offset;
- size_t raw_size;
-
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 336: /* sizeof(istruct elf_prstatus) on Linux/x86_64 */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal
- = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid
- = bfd_get_32 (abfd, note->descdata + 32);
-
- /* pr_reg */
- offset = 112;
- raw_size = 216;
-
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static bfd_boolean
-elf64_x86_64_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-
-/* Functions for the x86-64 ELF linker. */
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld64.so.1"
-
-/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
- copying dynamic variables from a shared lib into an app's dynbss
- section, and instead use a dynamic relocation to point into the
- shared lib. */
-#define ELIMINATE_COPY_RELOCS 1
-
-/* The size in bytes of an entry in the global offset table. */
-
-#define GOT_ENTRY_SIZE 8
-
-/* The size in bytes of an entry in the procedure linkage table. */
-
-#define PLT_ENTRY_SIZE 16
-
-/* The first entry in a procedure linkage table looks like this. See the
- SVR4 ABI i386 supplement and the x86-64 ABI to see how this works. */
-
-static const bfd_byte elf64_x86_64_plt0_entry[PLT_ENTRY_SIZE] =
-{
- 0xff, 0x35, 8, 0, 0, 0, /* pushq GOT+8(%rip) */
- 0xff, 0x25, 16, 0, 0, 0, /* jmpq *GOT+16(%rip) */
- 0x90, 0x90, 0x90, 0x90 /* pad out to 16 bytes with nops. */
-};
-
-/* Subsequent entries in a procedure linkage table look like this. */
-
-static const bfd_byte elf64_x86_64_plt_entry[PLT_ENTRY_SIZE] =
-{
- 0xff, 0x25, /* jmpq *name@GOTPC(%rip) */
- 0, 0, 0, 0, /* replaced with offset to this symbol in .got. */
- 0x68, /* pushq immediate */
- 0, 0, 0, 0, /* replaced with index into relocation table. */
- 0xe9, /* jmp relative */
- 0, 0, 0, 0 /* replaced with offset to start of .plt0. */
-};
-
-/* The x86-64 linker needs to keep track of the number of relocs that
- it decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct elf64_x86_64_dyn_relocs
-{
- /* Next section. */
- struct elf64_x86_64_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
-
-/* x86-64 ELF linker hash entry. */
-
-struct elf64_x86_64_link_hash_entry
-{
- struct elf_link_hash_entry elf;
-
- /* Track dynamic relocs copied for this symbol. */
- struct elf64_x86_64_dyn_relocs *dyn_relocs;
-
-#define GOT_UNKNOWN 0
-#define GOT_NORMAL 1
-#define GOT_TLS_GD 2
-#define GOT_TLS_IE 3
- unsigned char tls_type;
-};
-
-#define elf64_x86_64_hash_entry(ent) \
- ((struct elf64_x86_64_link_hash_entry *)(ent))
-
-struct elf64_x86_64_obj_tdata
-{
- struct elf_obj_tdata root;
-
- /* tls_type for each local got entry. */
- char *local_got_tls_type;
-};
-
-#define elf64_x86_64_tdata(abfd) \
- ((struct elf64_x86_64_obj_tdata *) (abfd)->tdata.any)
-
-#define elf64_x86_64_local_got_tls_type(abfd) \
- (elf64_x86_64_tdata (abfd)->local_got_tls_type)
-
-
-/* x86-64 ELF linker hash table. */
-
-struct elf64_x86_64_link_hash_table
-{
- struct elf_link_hash_table elf;
-
- /* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
- asection *sdynbss;
- asection *srelbss;
-
- union {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } tls_ld_got;
-
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-};
-
-/* Get the x86-64 ELF linker hash table from a link_info structure. */
-
-#define elf64_x86_64_hash_table(p) \
- ((struct elf64_x86_64_link_hash_table *) ((p)->hash))
-
-/* Create an entry in an x86-64 ELF linker hash table. */
-
-static struct bfd_hash_entry *
-link_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table,
- sizeof (struct elf64_x86_64_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
- {
- struct elf64_x86_64_link_hash_entry *eh;
-
- eh = (struct elf64_x86_64_link_hash_entry *) entry;
- eh->dyn_relocs = NULL;
- eh->tls_type = GOT_UNKNOWN;
- }
-
- return entry;
-}
-
-/* Create an X86-64 ELF linker hash table. */
-
-static struct bfd_link_hash_table *
-elf64_x86_64_link_hash_table_create (bfd *abfd)
-{
- struct elf64_x86_64_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table);
-
- ret = (struct elf64_x86_64_link_hash_table *) bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
- ret->sgot = NULL;
- ret->sgotplt = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->sym_sec.abfd = NULL;
- ret->tls_ld_got.refcount = 0;
-
- return &ret->elf.root;
-}
-
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf64_x86_64_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf64_x86_64_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- if (!htab->sgot || !htab->sgotplt)
- abort ();
-
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
- if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
- return FALSE;
- return TRUE;
-}
-
-/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
- .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
- hash table. */
-
-static bfd_boolean
-elf64_x86_64_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf64_x86_64_link_hash_table *htab;
-
- htab = elf64_x86_64_hash_table (info);
- if (!htab->sgot && !create_got_section (dynobj, info))
- return FALSE;
-
- if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return FALSE;
-
- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
- htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
- htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
- if (!info->shared)
- htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
-
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
- abort ();
-
- return TRUE;
-}
-
-/* Copy the extra info we tack onto an elf_link_hash_entry. */
-
-static void
-elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed,
- struct elf_link_hash_entry *dir,
- struct elf_link_hash_entry *ind)
-{
- struct elf64_x86_64_link_hash_entry *edir, *eind;
-
- edir = (struct elf64_x86_64_link_hash_entry *) dir;
- eind = (struct elf64_x86_64_link_hash_entry *) ind;
-
- if (eind->dyn_relocs != NULL)
- {
- if (edir->dyn_relocs != NULL)
- {
- struct elf64_x86_64_dyn_relocs **pp;
- struct elf64_x86_64_dyn_relocs *p;
-
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
-
- /* Add reloc counts against the weak sym to the strong sym
- list. Merge any entries against the same section. */
- for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
- {
- struct elf64_x86_64_dyn_relocs *q;
-
- for (q = edir->dyn_relocs; q != NULL; q = q->next)
- if (q->sec == p->sec)
- {
- q->pc_count += p->pc_count;
- q->count += p->count;
- *pp = p->next;
- break;
- }
- if (q == NULL)
- pp = &p->next;
- }
- *pp = edir->dyn_relocs;
- }
-
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
-
- if (ind->root.type == bfd_link_hash_indirect
- && dir->got.refcount <= 0)
- {
- edir->tls_type = eind->tls_type;
- eind->tls_type = GOT_UNKNOWN;
- }
-
- if (ELIMINATE_COPY_RELOCS
- && ind->root.type != bfd_link_hash_indirect
- && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- dir->elf_link_hash_flags |=
- (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_HASH_NEEDS_PLT));
- else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-}
-
-static bfd_boolean
-elf64_x86_64_mkobject (bfd *abfd)
-{
- bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
- if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-elf64_x86_64_elf_object_p (bfd *abfd)
-{
- /* Set the right machine number for an x86-64 elf64 file. */
- bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
- return TRUE;
-}
-
-static int
-elf64_x86_64_tls_transition (struct bfd_link_info *info, int r_type, int is_local)
-{
- if (info->shared)
- return r_type;
-
- switch (r_type)
- {
- case R_X86_64_TLSGD:
- case R_X86_64_GOTTPOFF:
- if (is_local)
- return R_X86_64_TPOFF32;
- return R_X86_64_GOTTPOFF;
- case R_X86_64_TLSLD:
- return R_X86_64_TPOFF32;
- }
-
- return r_type;
-}
-
-/* Look through the relocs for a section during the first phase, and
- calculate needed space in the global offset table, procedure
- linkage table, and dynamic reloc sections. */
-
-static bfd_boolean
-elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
- const Elf_Internal_Rela *relocs)
-{
- struct elf64_x86_64_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sreloc;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf64_x86_64_hash_table (info);
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
-
- sreloc = NULL;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- unsigned int r_type;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- r_type = ELF64_R_TYPE (rel->r_info);
-
- if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
- r_symndx);
- return FALSE;
- }
-
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
- switch (r_type)
- {
- case R_X86_64_TLSLD:
- htab->tls_ld_got.refcount += 1;
- goto create_got;
-
- case R_X86_64_TPOFF32:
- if (info->shared)
- {
- (*_bfd_error_handler)
- (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
- bfd_archive_filename (abfd),
- x86_64_elf_howto_table[r_type].name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- break;
-
- case R_X86_64_GOTTPOFF:
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- /* Fall through */
-
- case R_X86_64_GOT32:
- case R_X86_64_GOTPCREL:
- case R_X86_64_TLSGD:
- /* This symbol requires a global offset table entry. */
- {
- int tls_type, old_tls_type;
-
- switch (r_type)
- {
- default: tls_type = GOT_NORMAL; break;
- case R_X86_64_TLSGD: tls_type = GOT_TLS_GD; break;
- case R_X86_64_GOTTPOFF: tls_type = GOT_TLS_IE; break;
- }
-
- if (h != NULL)
- {
- h->got.refcount += 1;
- old_tls_type = elf64_x86_64_hash_entry (h)->tls_type;
- }
- else
- {
- bfd_signed_vma *local_got_refcounts;
-
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= sizeof (bfd_signed_vma) + sizeof (char);
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- elf64_x86_64_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + symtab_hdr->sh_info);
- }
- local_got_refcounts[r_symndx] += 1;
- old_tls_type
- = elf64_x86_64_local_got_tls_type (abfd) [r_symndx];
- }
-
- /* If a TLS symbol is accessed using IE at least once,
- there is no point to use dynamic model for it. */
- if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
- && (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE))
- {
- if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD)
- tls_type = old_tls_type;
- else
- {
- (*_bfd_error_handler)
- (_("%s: %s' accessed both as normal and thread local symbol"),
- bfd_archive_filename (abfd),
- h ? h->root.root.string : "<local>");
- return FALSE;
- }
- }
-
- if (old_tls_type != tls_type)
- {
- if (h != NULL)
- elf64_x86_64_hash_entry (h)->tls_type = tls_type;
- else
- elf64_x86_64_local_got_tls_type (abfd) [r_symndx] = tls_type;
- }
- }
- /* Fall through */
-
- //case R_X86_64_GOTPCREL:
- create_got:
- if (htab->sgot == NULL)
- {
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
- return FALSE;
- }
- break;
-
- case R_X86_64_PLT32:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
-
- /* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
- if (h == NULL)
- continue;
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- break;
-
- case R_X86_64_8:
- case R_X86_64_16:
- case R_X86_64_32:
- case R_X86_64_32S:
- /* Let's help debug shared library creation. These relocs
- cannot be used in shared libs. Don't error out for
- sections we don't care about, such as debug sections or
- non-constant sections. */
- if (info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && (sec->flags & SEC_READONLY) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
- bfd_archive_filename (abfd),
- x86_64_elf_howto_table[r_type].name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- /* Fall through. */
-
- case R_X86_64_PC8:
- case R_X86_64_PC16:
- case R_X86_64_PC32:
- case R_X86_64_64:
- if (h != NULL && !info->shared)
- {
- /* If this reloc is in a read-only section, we might
- need a copy reloc. We can't check reliably at this
- stage whether the section is read-only, as input
- sections have not yet been mapped to output sections.
- Tentatively set the flag for now, and correct in
- adjust_dynamic_symbol. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- /* We may need a .plt entry if the function this reloc
- refers to is in a shared lib. */
- h->plt.refcount += 1;
- }
-
- /* If we are creating a shared library, and this is a reloc
- against a global symbol, or a non PC relative reloc
- against a local symbol, then we need to copy the reloc
- into the shared library. However, if we are linking with
- -Bsymbolic, we do not need to copy a reloc against a
- global symbol which is defined in an object we are
- including in the link (i.e., DEF_REGULAR is set). At
- this point we have not seen all the input files, so it is
- possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). In case of a weak definition,
- DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
- storing information in the relocs_copied field of the hash
- table entry. A similar situation occurs when creating
- shared libraries and symbol visibility changes render the
- symbol local.
-
- If on the other hand, we are creating an executable, we
- may need to keep relocations for symbols satisfied by a
- dynamic library if we manage to avoid copy relocs for the
- symbol. */
- if ((info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && (((r_type != R_X86_64_PC8)
- && (r_type != R_X86_64_PC16)
- && (r_type != R_X86_64_PC32))
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- struct elf64_x86_64_dyn_relocs *p;
- struct elf64_x86_64_dyn_relocs **head;
-
- /* We must copy these reloc types into the output file.
- Create a reloc section in dynobj and make room for
- this reloc. */
- if (sreloc == NULL)
- {
- const char *name;
- bfd *dynobj;
-
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- if (strncmp (name, ".rela", 5) != 0
- || strcmp (bfd_get_section_name (abfd, sec),
- name + 5) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
- }
-
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
-
- dynobj = htab->elf.dynobj;
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- if (sreloc == NULL)
- {
- flagword flags;
-
- sreloc = bfd_make_section (dynobj, name);
- flags = (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if ((sec->flags & SEC_ALLOC) != 0)
- flags |= SEC_ALLOC | SEC_LOAD;
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return FALSE;
- }
- elf_section_data (sec)->sreloc = sreloc;
- }
-
- /* If this is a global symbol, we count the number of
- relocations we need for this symbol. */
- if (h != NULL)
- {
- head = &((struct elf64_x86_64_link_hash_entry *) h)->dyn_relocs;
- }
- else
- {
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
-
- asection *s;
- s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
- sec, r_symndx);
- if (s == NULL)
- return FALSE;
-
- head = ((struct elf64_x86_64_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- }
-
- p = *head;
- if (p == NULL || p->sec != sec)
- {
- bfd_size_type amt = sizeof *p;
- p = ((struct elf64_x86_64_dyn_relocs *)
- bfd_alloc (htab->elf.dynobj, amt));
- if (p == NULL)
- return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
- }
-
- p->count += 1;
- if (r_type == R_X86_64_PC8
- || r_type == R_X86_64_PC16
- || r_type == R_X86_64_PC32)
- p->pc_count += 1;
- }
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_X86_64_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_X86_64_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return FALSE;
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-elf64_x86_64_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_X86_64_GNU_VTINHERIT:
- case R_X86_64_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
- asection *sec, const Elf_Internal_Rela *relocs)
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h = NULL;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf64_x86_64_link_hash_entry *eh;
- struct elf64_x86_64_dyn_relocs **pp;
- struct elf64_x86_64_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct elf64_x86_64_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- r_type = ELF64_R_TYPE (rel->r_info);
- r_type = elf64_x86_64_tls_transition (info, r_type, h != NULL);
- switch (r_type)
- {
- case R_X86_64_TLSLD:
- if (elf64_x86_64_hash_table (info)->tls_ld_got.refcount > 0)
- elf64_x86_64_hash_table (info)->tls_ld_got.refcount -= 1;
- break;
-
- case R_X86_64_TLSGD:
- case R_X86_64_GOTTPOFF:
- case R_X86_64_GOT32:
- case R_X86_64_GOTPCREL:
- if (h != NULL)
- {
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- case R_X86_64_8:
- case R_X86_64_16:
- case R_X86_64_32:
- case R_X86_64_64:
- case R_X86_64_32S:
- case R_X86_64_PC8:
- case R_X86_64_PC16:
- case R_X86_64_PC32:
- if (info->shared)
- break;
- /* Fall thru */
-
- case R_X86_64_PLT32:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-static bfd_boolean
-elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
-{
- struct elf64_x86_64_link_hash_table *htab;
- asection *s;
- unsigned int power_of_two;
-
- /* If this is a function, put it in the procedure linkage table. We
- will fill in the contents of the procedure linkage table later,
- when we know the address of the .got section. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- if (h->plt.refcount <= 0
- || SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
- such a case, we don't actually need to build a procedure
- linkage table, and we can just do a PC32 reloc instead. */
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- return TRUE;
- }
- else
- /* It's possible that we incorrectly decided a .plt reloc was
- needed for an R_X86_64_PC32 reloc to a non-function sym in
- check_relocs. We can't decide accurately between function and
- non-function syms in check-relocs; Objects loaded later in
- the link may change h->type. So fix it now. */
- h->plt.offset = (bfd_vma) -1;
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
- h->elf_link_hash_flags
- = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
- | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- /* If we are creating a shared library, we must presume that the
- only references to the symbol are via the global offset table.
- For such cases we need not do anything here; the relocations will
- be handled correctly by relocate_section. */
- if (info->shared)
- return TRUE;
-
- /* If there are no references to this symbol that do not use the
- GOT, we don't need to generate a copy reloc. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
- return TRUE;
-
- /* If -z nocopyreloc was given, we won't generate them either. */
- if (info->nocopyreloc)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
-
- if (ELIMINATE_COPY_RELOCS)
- {
- struct elf64_x86_64_link_hash_entry * eh;
- struct elf64_x86_64_dyn_relocs *p;
-
- eh = (struct elf64_x86_64_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
-
- /* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
- if (p == NULL)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return TRUE;
- }
- }
-
- /* We must allocate the symbol in our .dynbss section, which will
- become part of the .bss section of the executable. There will be
- an entry for this symbol in the .dynsym section. The dynamic
- object will contain position independent code, so all references
- from the dynamic object to this symbol will go through the global
- offset table. The dynamic linker will use the .dynsym entry to
- determine the address it must put in the global offset table, so
- both the dynamic object and the regular object will refer to the
- same memory location for the variable. */
-
- htab = elf64_x86_64_hash_table (info);
-
- /* We must generate a R_X86_64_COPY reloc to tell the dynamic linker
- to copy the initial value out of the dynamic object and into the
- runtime process image. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
- htab->srelbss->_raw_size += sizeof (Elf64_External_Rela);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
- }
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. 16-bytes is the size
- of the largest type that requires hard alignment -- long double. */
- /* FIXME: This is VERY ugly. Should be fixed for all architectures using
- this construct. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
- s = htab->sdynbss;
- s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
-
- return TRUE;
-}
-
-/* Allocate space in .plt, .got and associated reloc sections for
- dynamic relocs. */
-
-static bfd_boolean
-allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
-{
- struct bfd_link_info *info;
- struct elf64_x86_64_link_hash_table *htab;
- struct elf64_x86_64_link_hash_entry *eh;
- struct elf64_x86_64_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- info = (struct bfd_link_info *) inf;
- htab = elf64_x86_64_hash_table (info);
-
- if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- if (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
- {
- asection *s = htab->splt;
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_ENTRY_SIZE;
-
- h->plt.offset = s->_raw_size;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
- }
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- htab->sgotplt->_raw_size += GOT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- else
- {
- h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
-
- /* If R_X86_64_GOTTPOFF symbol is now local to the binary,
- make it a R_X86_64_TPOFF32 requiring no GOT entry. */
- if (h->got.refcount > 0
- && !info->shared
- && h->dynindx == -1
- && elf64_x86_64_hash_entry (h)->tls_type == GOT_TLS_IE)
- h->got.offset = (bfd_vma) -1;
- else if (h->got.refcount > 0)
- {
- asection *s;
- bfd_boolean dyn;
- int tls_type = elf64_x86_64_hash_entry (h)->tls_type;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
- /* R_X86_64_TLSGD needs 2 consecutive GOT slots. */
- if (tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
- dyn = htab->elf.dynamic_sections_created;
- /* R_X86_64_TLSGD needs one dynamic relocation if local symbol
- and two if global.
- R_X86_64_GOTTPOFF needs one dynamic relocation. */
- if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
- || tls_type == GOT_TLS_IE)
- htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
- else if (tls_type == GOT_TLS_GD)
- htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
- else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
- htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- eh = (struct elf64_x86_64_link_hash_entry *) h;
- if (eh->dyn_relocs == NULL)
- return TRUE;
-
- /* In the shared -Bsymbolic case, discard space allocated for
- dynamic pc-relative relocs against symbols which turn out to be
- defined in regular objects. For the normal shared case, discard
- space for pc-relative relocs that have become local due to symbol
- visibility changes. */
-
- if (info->shared)
- {
- /* Relocs that use pc_count are those that appear on a call
- insn, or certain REL relocs that can generated via assembly.
- We want calls to protected symbols to resolve directly to the
- function rather than going via the plt. If people want
- function pointer comparisons to work as expected then they
- should avoid writing weird assembly. */
- if (SYMBOL_CALLS_LOCAL (info, h))
- {
- struct elf64_x86_64_dyn_relocs **pp;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
- {
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
- else
- pp = &p->next;
- }
- }
-
- /* Also discard relocs on undefined weak syms with non-default
- visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
- }
- else if (ELIMINATE_COPY_RELOCS)
- {
- /* For the non-shared case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
-
- if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || (htab->elf.dynamic_sections_created
- && (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))))
- {
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* If that succeeded, we know we'll be keeping all the
- relocs. */
- if (h->dynindx != -1)
- goto keep;
- }
-
- eh->dyn_relocs = NULL;
-
- keep: ;
- }
-
- /* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela);
- }
-
- return TRUE;
-}
-
-/* Find any dynamic relocs that apply to read-only sections. */
-
-static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h, void * inf)
-{
- struct elf64_x86_64_link_hash_entry *eh;
- struct elf64_x86_64_dyn_relocs *p;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- eh = (struct elf64_x86_64_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
-
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- {
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
- info->flags |= DF_TEXTREL;
-
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-static bfd_boolean
-elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
-{
- struct elf64_x86_64_link_hash_table *htab;
- bfd *dynobj;
- asection *s;
- bfd_boolean relocs;
- bfd *ibfd;
-
- htab = elf64_x86_64_hash_table (info);
- dynobj = htab->elf.dynobj;
- if (dynobj == NULL)
- abort ();
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- if (s == NULL)
- abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
- }
- }
-
- /* Set up .got offsets for local syms, and space for local dynamic
- relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
- char *local_tls_type;
- bfd_size_type locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
- asection *srel;
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
- continue;
-
- for (s = ibfd->sections; s != NULL; s = s->next)
- {
- struct elf64_x86_64_dyn_relocs *p;
-
- for (p = *((struct elf64_x86_64_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
- {
- if (!bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
- {
- /* Input section has been discarded, either because
- it is a copy of a linkonce section or due to
- linker script /DISCARD/, so we'll be discarding
- the relocs too. */
- }
- else if (p->count != 0)
- {
- srel = elf_section_data (p->sec)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf64_External_Rela);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
-
- }
- }
- }
-
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
- locsymcount = symtab_hdr->sh_info;
- end_local_got = local_got + locsymcount;
- local_tls_type = elf64_x86_64_local_got_tls_type (ibfd);
- s = htab->sgot;
- srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
- {
- if (*local_got > 0)
- {
- *local_got = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
- if (*local_tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
- if (info->shared
- || *local_tls_type == GOT_TLS_GD
- || *local_tls_type == GOT_TLS_IE)
- srel->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- *local_got = (bfd_vma) -1;
- }
- }
-
- if (htab->tls_ld_got.refcount > 0)
- {
- /* Allocate 2 got entries and 1 dynamic reloc for R_X86_64_TLSLD
- relocs. */
- htab->tls_ld_got.offset = htab->sgot->_raw_size;
- htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE;
- htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- htab->tls_ld_got.offset = -1;
-
- /* Allocate global sym .plt and .got entries, and space for global
- sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
-
- /* We now have determined the sizes of the various dynamic sections.
- Allocate memory for them. */
- relocs = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- }
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
- {
- if (s->_raw_size != 0 && s != htab->srelplt)
- relocs = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
- else
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (s->_raw_size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is mostly to handle .rela.bss and
- .rela.plt. We must create both sections in
- create_dynamic_sections, because they must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
-
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. We use bfd_zalloc
- here in case unused entries are not reclaimed before the
- section's contents are written out. This should not happen,
- but this way if it does, we get a R_X86_64_NONE reloc instead
- of garbage. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- if (htab->elf.dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in elf64_x86_64_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (info->executable)
- {
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (htab->splt->_raw_size != 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 (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
- return FALSE;
-
- /* If any dynamic relocs apply to a read-only section,
- then we need a DT_TEXTREL entry. */
- if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
- (PTR) info);
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
- }
-#undef add_dynamic_entry
-
- return TRUE;
-}
-
-/* Return the base VMA address which should be subtracted from real addresses
- when resolving @dtpoff relocation.
- This is PT_TLS segment p_vaddr. */
-
-static bfd_vma
-dtpoff_base (struct bfd_link_info *info)
-{
- /* If tls_sec is NULL, we should have signalled an error already. */
- if (elf_hash_table (info)->tls_sec == NULL)
- return 0;
- return elf_hash_table (info)->tls_sec->vma;
-}
-
-/* Return the relocation value for @tpoff relocation
- if STT_TLS virtual address is ADDRESS. */
-
-static bfd_vma
-tpoff (struct bfd_link_info *info, bfd_vma address)
-{
- struct elf_link_hash_table *htab = elf_hash_table (info);
-
- /* If tls_segment is NULL, we should have signalled an error already. */
- if (htab->tls_sec == NULL)
- return 0;
- return address - htab->tls_size - htab->tls_sec->vma;
-}
-
-/* Relocate an x86_64 ELF section. */
-
-static bfd_boolean
-elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
- bfd *input_bfd, asection *input_section,
- bfd_byte *contents, Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms,
- asection **local_sections)
-{
- struct elf64_x86_64_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_vma *local_got_offsets;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
-
- if (info->relocatable)
- return TRUE;
-
- htab = elf64_x86_64_hash_table (info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
- local_got_offsets = elf_local_got_offsets (input_bfd);
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- unsigned int r_type;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sec;
- bfd_vma off;
- bfd_vma relocation;
- bfd_boolean unresolved_reloc;
- bfd_reloc_status_type r;
- int tls_type;
-
- r_type = ELF64_R_TYPE (rel->r_info);
- if (r_type == (int) R_X86_64_GNU_VTINHERIT
- || r_type == (int) R_X86_64_GNU_VTENTRY)
- continue;
-
- if (r_type >= R_X86_64_max)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- howto = x86_64_elf_howto_table + r_type;
- r_symndx = ELF64_R_SYM (rel->r_info);
- h = NULL;
- sym = NULL;
- sec = NULL;
- unresolved_reloc = FALSE;
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
-
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- }
- else
- {
- bfd_boolean warned;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
- }
- /* When generating a shared object, the relocations handled here are
- copied into the output file to be resolved at run time. */
- switch (r_type)
- {
- case R_X86_64_GOT32:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- case R_X86_64_GOTPCREL:
- /* Use global offset table as symbol value. */
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- {
- bfd_boolean dyn;
-
- off = h->got.offset;
- dyn = htab->elf.dynamic_sections_created;
-
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h))
- || (ELF_ST_VISIBILITY (h->other)
- && h->root.type == bfd_link_hash_undefweak))
- {
- /* This is actually a static link, or it is a -Bsymbolic
- link and the symbol is defined locally, or the symbol
- was forced to be local because of a version file. We
- must initialize this entry in the global offset table.
- Since the offset must always be a multiple of 8, we
- use the least significant bit to record whether we
- have initialized it already.
-
- When doing a dynamic link, we create a .rela.got
- relocation entry to initialize the value. This is
- done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
- else
- unresolved_reloc = FALSE;
- }
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
-
- /* The offset must always be a multiple of 8. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
-
- if (info->shared)
- {
- asection *s;
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- /* We need to generate a R_X86_64_RELATIVE reloc
- for the dynamic linker. */
- s = htab->srelgot;
- if (s == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
- outrel.r_addend = relocation;
- loc = s->contents;
- loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
-
- local_got_offsets[r_symndx] |= 1;
- }
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
-
- relocation = htab->sgot->output_offset + off;
- if (r_type == R_X86_64_GOTPCREL)
- relocation += htab->sgot->output_section->vma;
-
- break;
-
- case R_X86_64_PLT32:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
-
- if (h->plt.offset == (bfd_vma) -1
- || htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = FALSE;
- break;
-
- case R_X86_64_PC8:
- case R_X86_64_PC16:
- case R_X86_64_PC32:
- case R_X86_64_8:
- case R_X86_64_16:
- case R_X86_64_32:
- case R_X86_64_64:
- /* FIXME: The ABI says the linker should make sure the value is
- the same when it's zeroextended to 64 bit. */
-
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
- break;
-
- if ((info->shared
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && ((r_type != R_X86_64_PC8
- && r_type != R_X86_64_PC16
- && r_type != R_X86_64_PC32)
- || !SYMBOL_CALLS_LOCAL (info, h)))
- || (ELIMINATE_COPY_RELOCS
- && !info->shared
- && h != NULL
- && h->dynindx != -1
- && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- bfd_boolean skip, relocate;
- asection *sreloc;
-
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
- skip = FALSE;
- relocate = FALSE;
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = TRUE;
- else if (outrel.r_offset == (bfd_vma) -2)
- skip = TRUE, relocate = TRUE;
-
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
-
- if (skip)
- memset (&outrel, 0, sizeof outrel);
-
- /* h->dynindx may be -1 if this symbol was marked to
- become local. */
- else if (h != NULL
- && h->dynindx != -1
- && (r_type == R_X86_64_PC8
- || r_type == R_X86_64_PC16
- || r_type == R_X86_64_PC32
- || !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
- outrel.r_addend = rel->r_addend;
- }
- else
- {
- /* This symbol is local, or marked to become local. */
- if (r_type == R_X86_64_64)
- {
- relocate = TRUE;
- outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
- }
- else
- {
- long sindx;
-
- if (bfd_is_abs_section (sec))
- sindx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- asection *osec;
-
- osec = sec->output_section;
- sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
- }
-
- outrel.r_info = ELF64_R_INFO (sindx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
- }
- }
-
- sreloc = elf_section_data (input_section)->sreloc;
- if (sreloc == NULL)
- abort ();
-
- loc = sreloc->contents;
- loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
-
- /* If this reloc is against an external symbol, we do
- not want to fiddle with the addend. Otherwise, we
- need to include the symbol value so that it becomes
- an addend for the dynamic reloc. */
- if (! relocate)
- continue;
- }
-
- break;
-
- case R_X86_64_TLSGD:
- case R_X86_64_GOTTPOFF:
- r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
- tls_type = GOT_UNKNOWN;
- if (h == NULL && local_got_offsets)
- tls_type = elf64_x86_64_local_got_tls_type (input_bfd) [r_symndx];
- else if (h != NULL)
- {
- tls_type = elf64_x86_64_hash_entry (h)->tls_type;
- if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
- r_type = R_X86_64_TPOFF32;
- }
- if (r_type == R_X86_64_TLSGD)
- {
- if (tls_type == GOT_TLS_IE)
- r_type = R_X86_64_GOTTPOFF;
- }
-
- if (r_type == R_X86_64_TPOFF32)
- {
- BFD_ASSERT (! unresolved_reloc);
- if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSGD)
- {
- unsigned int i;
- static unsigned char tlsgd[8]
- = { 0x66, 0x48, 0x8d, 0x3d, 0x66, 0x66, 0x48, 0xe8 };
-
- /* GD->LE transition.
- .byte 0x66; leaq foo@tlsgd(%rip), %rdi
- .word 0x6666; rex64; call __tls_get_addr@plt
- Change it into:
- movq %fs:0, %rax
- leaq foo@tpoff(%rax), %rax */
- BFD_ASSERT (rel->r_offset >= 4);
- for (i = 0; i < 4; i++)
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset - 4 + i)
- == tlsgd[i]);
- BFD_ASSERT (rel->r_offset + 12 <= input_section->_raw_size);
- for (i = 0; i < 4; i++)
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset + 4 + i)
- == tlsgd[i+4]);
- BFD_ASSERT (rel + 1 < relend);
- BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
- memcpy (contents + rel->r_offset - 4,
- "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x8d\x80\0\0\0",
- 16);
- bfd_put_32 (output_bfd, tpoff (info, relocation),
- contents + rel->r_offset + 8);
- /* Skip R_X86_64_PLT32. */
- rel++;
- continue;
- }
- else
- {
- unsigned int val, type, reg;
-
- /* IE->LE transition:
- Originally it can be one of:
- movq foo@gottpoff(%rip), %reg
- addq foo@gottpoff(%rip), %reg
- We change it into:
- movq $foo, %reg
- leaq foo(%reg), %reg
- addq $foo, %reg. */
- BFD_ASSERT (rel->r_offset >= 3);
- val = bfd_get_8 (input_bfd, contents + rel->r_offset - 3);
- BFD_ASSERT (val == 0x48 || val == 0x4c);
- type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
- BFD_ASSERT (type == 0x8b || type == 0x03);
- reg = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
- BFD_ASSERT ((reg & 0xc7) == 5);
- reg >>= 3;
- BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size);
- if (type == 0x8b)
- {
- /* movq */
- if (val == 0x4c)
- bfd_put_8 (output_bfd, 0x49,
- contents + rel->r_offset - 3);
- bfd_put_8 (output_bfd, 0xc7,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd, 0xc0 | reg,
- contents + rel->r_offset - 1);
- }
- else if (reg == 4)
- {
- /* addq -> addq - addressing with %rsp/%r12 is
- special */
- if (val == 0x4c)
- bfd_put_8 (output_bfd, 0x49,
- contents + rel->r_offset - 3);
- bfd_put_8 (output_bfd, 0x81,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd, 0xc0 | reg,
- contents + rel->r_offset - 1);
- }
- else
- {
- /* addq -> leaq */
- if (val == 0x4c)
- bfd_put_8 (output_bfd, 0x4d,
- contents + rel->r_offset - 3);
- bfd_put_8 (output_bfd, 0x8d,
- contents + rel->r_offset - 2);
- bfd_put_8 (output_bfd, 0x80 | reg | (reg << 3),
- contents + rel->r_offset - 1);
- }
- bfd_put_32 (output_bfd, tpoff (info, relocation),
- contents + rel->r_offset);
- continue;
- }
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
- off = h->got.offset;
- else
- {
- if (local_got_offsets == NULL)
- abort ();
-
- off = local_got_offsets[r_symndx];
- }
-
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- int dr_type, indx;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- indx = h && h->dynindx != -1 ? h->dynindx : 0;
- if (r_type == R_X86_64_TLSGD)
- dr_type = R_X86_64_DTPMOD64;
- else
- dr_type = R_X86_64_TPOFF64;
-
- bfd_put_64 (output_bfd, 0, htab->sgot->contents + off);
- outrel.r_addend = 0;
- if (dr_type == R_X86_64_TPOFF64 && indx == 0)
- outrel.r_addend = relocation - dtpoff_base (info);
- outrel.r_info = ELF64_R_INFO (indx, dr_type);
-
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
-
- if (r_type == R_X86_64_TLSGD)
- {
- if (indx == 0)
- {
- BFD_ASSERT (! unresolved_reloc);
- bfd_put_64 (output_bfd,
- relocation - dtpoff_base (info),
- htab->sgot->contents + off + GOT_ENTRY_SIZE);
- }
- else
- {
- bfd_put_64 (output_bfd, 0,
- htab->sgot->contents + off + GOT_ENTRY_SIZE);
- outrel.r_info = ELF64_R_INFO (indx,
- R_X86_64_DTPOFF64);
- outrel.r_offset += GOT_ENTRY_SIZE;
- htab->srelgot->reloc_count++;
- loc += sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
- }
-
- if (h != NULL)
- h->got.offset |= 1;
- else
- local_got_offsets[r_symndx] |= 1;
- }
-
- if (off >= (bfd_vma) -2)
- abort ();
- if (r_type == ELF64_R_TYPE (rel->r_info))
- {
- relocation = htab->sgot->output_section->vma
- + htab->sgot->output_offset + off;
- unresolved_reloc = FALSE;
- }
- else
- {
- unsigned int i;
- static unsigned char tlsgd[8]
- = { 0x66, 0x48, 0x8d, 0x3d, 0x66, 0x66, 0x48, 0xe8 };
-
- /* GD->IE transition.
- .byte 0x66; leaq foo@tlsgd(%rip), %rdi
- .word 0x6666; rex64; call __tls_get_addr@plt
- Change it into:
- movq %fs:0, %rax
- addq foo@gottpoff(%rip), %rax */
- BFD_ASSERT (rel->r_offset >= 4);
- for (i = 0; i < 4; i++)
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset - 4 + i)
- == tlsgd[i]);
- BFD_ASSERT (rel->r_offset + 12 <= input_section->_raw_size);
- for (i = 0; i < 4; i++)
- BFD_ASSERT (bfd_get_8 (input_bfd,
- contents + rel->r_offset + 4 + i)
- == tlsgd[i+4]);
- BFD_ASSERT (rel + 1 < relend);
- BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
- memcpy (contents + rel->r_offset - 4,
- "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05\0\0\0",
- 16);
-
- relocation = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off
- - rel->r_offset
- - input_section->output_section->vma
- - input_section->output_offset
- - 12);
- bfd_put_32 (output_bfd, relocation,
- contents + rel->r_offset + 8);
- /* Skip R_X86_64_PLT32. */
- rel++;
- continue;
- }
- break;
-
- case R_X86_64_TLSLD:
- if (! info->shared)
- {
- /* LD->LE transition:
- Ensure it is:
- leaq foo@tlsld(%rip), %rdi; call __tls_get_addr@plt.
- We change it into:
- .word 0x6666; .byte 0x66; movl %fs:0, %rax. */
- BFD_ASSERT (rel->r_offset >= 3);
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 3)
- == 0x48);
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 2)
- == 0x8d);
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 1)
- == 0x3d);
- BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
- == 0xe8);
- BFD_ASSERT (rel + 1 < relend);
- BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
- memcpy (contents + rel->r_offset - 3,
- "\x66\x66\x66\x64\x48\x8b\x04\x25\0\0\0", 12);
- /* Skip R_X86_64_PLT32. */
- rel++;
- continue;
- }
-
- if (htab->sgot == NULL)
- abort ();
-
- off = htab->tls_ld_got.offset;
- if (off & 1)
- off &= ~1;
- else
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- if (htab->srelgot == NULL)
- abort ();
-
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset + off);
-
- bfd_put_64 (output_bfd, 0,
- htab->sgot->contents + off);
- bfd_put_64 (output_bfd, 0,
- htab->sgot->contents + off + GOT_ENTRY_SIZE);
- outrel.r_info = ELF64_R_INFO (0, R_X86_64_DTPMOD64);
- outrel.r_addend = 0;
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- htab->tls_ld_got.offset |= 1;
- }
- relocation = htab->sgot->output_section->vma
- + htab->sgot->output_offset + off;
- unresolved_reloc = FALSE;
- break;
-
- case R_X86_64_DTPOFF32:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
- relocation -= dtpoff_base (info);
- else
- relocation = tpoff (info, relocation);
- break;
-
- case R_X86_64_TPOFF32:
- BFD_ASSERT (! info->shared);
- relocation = tpoff (info, relocation);
- break;
-
- default:
- break;
- }
-
- /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
- because such sections are not SEC_ALLOC and thus ld.so will
- not process them. */
- if (unresolved_reloc
- && !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- h->root.root.string);
-
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, rel->r_addend);
-
- if (r != bfd_reloc_ok)
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
-
- if (r == bfd_reloc_overflow)
- {
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): reloc against `%s': error %d"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset, name, (int) r);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-static bfd_boolean
-elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
- struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- struct elf64_x86_64_link_hash_table *htab;
-
- htab = elf64_x86_64_hash_table (info);
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- bfd_vma plt_index;
- bfd_vma got_offset;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
- if (h->dynindx == -1
- || htab->splt == NULL
- || htab->sgotplt == NULL
- || htab->srelplt == NULL)
- abort ();
-
- /* Get the index in the procedure linkage table which
- corresponds to this symbol. This is the index of this symbol
- in all the symbols for which we are making plt entries. The
- first entry in the procedure linkage table is reserved. */
- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
-
- /* Get the offset into the .got table of the entry that
- corresponds to this function. Each .got entry is GOT_ENTRY_SIZE
- bytes. The first three are reserved for the dynamic linker. */
- got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
-
- /* Fill in the entry in the procedure linkage table. */
- memcpy (htab->splt->contents + h->plt.offset, elf64_x86_64_plt_entry,
- PLT_ENTRY_SIZE);
-
- /* Insert the relocation positions of the plt section. The magic
- numbers at the end of the statements are the positions of the
- relocations in the plt section. */
- /* Put offset for jmp *name@GOTPCREL(%rip), since the
- instruction uses 6 bytes, subtract this value. */
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + got_offset
- - htab->splt->output_section->vma
- - htab->splt->output_offset
- - h->plt.offset
- - 6),
- htab->splt->contents + h->plt.offset + 2);
- /* Put relocation index. */
- bfd_put_32 (output_bfd, plt_index,
- htab->splt->contents + h->plt.offset + 7);
- /* Put offset for jmp .PLT0. */
- bfd_put_32 (output_bfd, - (h->plt.offset + PLT_ENTRY_SIZE),
- htab->splt->contents + h->plt.offset + 12);
-
- /* Fill in the entry in the global offset table, initially this
- points to the pushq instruction in the PLT which is at offset 6. */
- bfd_put_64 (output_bfd, (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset + 6),
- htab->sgotplt->contents + got_offset);
-
- /* Fill in the entry in the .rela.plt section. */
- rela.r_offset = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + got_offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_JUMP_SLOT);
- rela.r_addend = 0;
- loc = htab->srelplt->contents + plt_index * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. This is a clue
- for the dynamic linker, to make function pointer
- comparisons work between an application and shared
- library. */
- sym->st_shndx = SHN_UNDEF;
- }
- }
-
- if (h->got.offset != (bfd_vma) -1
- && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_GD
- && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_IE)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol has an entry in the global offset table. Set it
- up. */
- if (htab->sgot == NULL || htab->srelgot == NULL)
- abort ();
-
- rela.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + (h->got.offset &~ (bfd_vma) 1));
-
- /* If this is a static link, or it is a -Bsymbolic link and the
- symbol is defined locally or was forced to be local because
- of a version file, we just want to emit a RELATIVE reloc.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h))
- {
- BFD_ASSERT((h->got.offset & 1) != 0);
- rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else
- {
- BFD_ASSERT((h->got.offset & 1) == 0);
- bfd_put_64 (output_bfd, (bfd_vma) 0,
- htab->sgot->contents + h->got.offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_GLOB_DAT);
- rela.r_addend = 0;
- }
-
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
- {
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
- /* This symbol needs a copy reloc. Set it up. */
-
- if (h->dynindx == -1
- || (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || htab->srelbss == NULL)
- abort ();
-
- rela.r_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_COPY);
- rela.r_addend = 0;
- loc = htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-/* Used to decide how to sort relocs in an optimal manner for the
- dynamic linker, before writing them out. */
-
-static enum elf_reloc_type_class
-elf64_x86_64_reloc_type_class (const Elf_Internal_Rela *rela)
-{
- switch ((int) ELF64_R_TYPE (rela->r_info))
- {
- case R_X86_64_RELATIVE:
- return reloc_class_relative;
- case R_X86_64_JUMP_SLOT:
- return reloc_class_plt;
- case R_X86_64_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-/* Finish up the dynamic sections. */
-
-static bfd_boolean
-elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
-{
- struct elf64_x86_64_link_hash_table *htab;
- bfd *dynobj;
- asection *sdyn;
-
- htab = elf64_x86_64_hash_table (info);
- dynobj = htab->elf.dynobj;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- if (htab->elf.dynamic_sections_created)
- {
- Elf64_External_Dyn *dyncon, *dynconend;
-
- if (sdyn == NULL || htab->sgot == NULL)
- abort ();
-
- dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- asection *s;
-
- bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- continue;
-
- case DT_PLTGOT:
- dyn.d_un.d_ptr = htab->sgot->output_section->vma;
- break;
-
- case DT_JMPREL:
- dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
- break;
-
- case DT_PLTRELSZ:
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
- break;
-
- case DT_RELASZ:
- /* The procedure linkage table relocs (DT_JMPREL) should
- not be included in the overall relocs (DT_RELA).
- Therefore, we override the DT_RELASZ entry here to
- make it not include the JMPREL relocs. Since the
- linker script arranges for .rela.plt to follow all
- other relocation sections, we don't have to worry
- about changing the DT_RELA entry. */
- if (htab->srelplt != NULL)
- {
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val -= s->_cooked_size;
- else
- dyn.d_un.d_val -= s->_raw_size;
- }
- break;
- }
-
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
-
- /* Fill in the special first entry in the procedure linkage table. */
- if (htab->splt && htab->splt->_raw_size > 0)
- {
- /* Fill in the first entry in the procedure linkage table. */
- memcpy (htab->splt->contents, elf64_x86_64_plt0_entry,
- PLT_ENTRY_SIZE);
- /* Add offset for pushq GOT+8(%rip), since the instruction
- uses 6 bytes subtract this value. */
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + 8
- - htab->splt->output_section->vma
- - htab->splt->output_offset
- - 6),
- htab->splt->contents + 2);
- /* Add offset for jmp *GOT+16(%rip). The 12 is the offset to
- the end of the instruction. */
- bfd_put_32 (output_bfd,
- (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
- + 16
- - htab->splt->output_section->vma
- - htab->splt->output_offset
- - 12),
- htab->splt->contents + 8);
-
- elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize =
- PLT_ENTRY_SIZE;
- }
- }
-
- if (htab->sgotplt)
- {
- /* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
- {
- /* Set the first entry in the global offset table to the address of
- the dynamic section. */
- if (sdyn == NULL)
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents);
- else
- bfd_put_64 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- htab->sgotplt->contents);
- /* Write GOT[1] and GOT[2], needed for the dynamic linker. */
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE);
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE*2);
- }
-
- elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize =
- GOT_ENTRY_SIZE;
- }
-
- return TRUE;
-}
-
-
-#define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec
-#define TARGET_LITTLE_NAME "elf64-x86-64"
-#define ELF_ARCH bfd_arch_i386
-#define ELF_MACHINE_CODE EM_X86_64
-#define ELF_MAXPAGESIZE 0x100000
-
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_want_got_plt 1
-#define elf_backend_plt_readonly 1
-#define elf_backend_want_plt_sym 0
-#define elf_backend_got_header_size (GOT_ENTRY_SIZE*3)
-#define elf_backend_rela_normal 1
-
-#define elf_info_to_howto elf64_x86_64_info_to_howto
-
-#define bfd_elf64_bfd_link_hash_table_create \
- elf64_x86_64_link_hash_table_create
-#define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup
-
-#define elf_backend_adjust_dynamic_symbol elf64_x86_64_adjust_dynamic_symbol
-#define elf_backend_check_relocs elf64_x86_64_check_relocs
-#define elf_backend_copy_indirect_symbol elf64_x86_64_copy_indirect_symbol
-#define elf_backend_create_dynamic_sections elf64_x86_64_create_dynamic_sections
-#define elf_backend_finish_dynamic_sections elf64_x86_64_finish_dynamic_sections
-#define elf_backend_finish_dynamic_symbol elf64_x86_64_finish_dynamic_symbol
-#define elf_backend_gc_mark_hook elf64_x86_64_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf64_x86_64_gc_sweep_hook
-#define elf_backend_grok_prstatus elf64_x86_64_grok_prstatus
-#define elf_backend_grok_psinfo elf64_x86_64_grok_psinfo
-#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class
-#define elf_backend_relocate_section elf64_x86_64_relocate_section
-#define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections
-#define elf_backend_object_p elf64_x86_64_elf_object_p
-#define bfd_elf64_mkobject elf64_x86_64_mkobject
-
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64.c b/contrib/binutils/bfd/elf64.c
deleted file mode 100644
index 69fb5b5..0000000
--- a/contrib/binutils/bfd/elf64.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* ELF 64-bit executable support for BFD.
- Copyright 1993 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define ARCH_SIZE 64
-
-#include "elfcode.h"
diff --git a/contrib/binutils/bfd/elfarm-nabi.c b/contrib/binutils/bfd/elfarm-nabi.c
deleted file mode 100644
index 5ecbe8e..0000000
--- a/contrib/binutils/bfd/elfarm-nabi.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/* 32-bit ELF support for ARM new abi option.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "elf/arm.h"
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-#ifndef NUM_ELEM
-#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
-#endif
-
-#define USE_REL 1
-
-#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
-#define TARGET_LITTLE_NAME "elf32-littlearm"
-#define TARGET_BIG_SYM bfd_elf32_bigarm_vec
-#define TARGET_BIG_NAME "elf32-bigarm"
-
-#define elf_info_to_howto 0
-#define elf_info_to_howto_rel elf32_arm_info_to_howto
-
-#define ARM_ELF_ABI_VERSION 0
-#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
-
-static reloc_howto_type * elf32_arm_reloc_type_lookup
- PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
-static bfd_boolean elf32_arm_nabi_grok_prstatus
- PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-static bfd_boolean elf32_arm_nabi_grok_psinfo
- PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-
-/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
- R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
- in that slot. */
-
-static reloc_howto_type elf32_arm_howto_table[] =
-{
- /* No relocation */
- HOWTO (R_ARM_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_PC24, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 24, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PC24", /* name */
- FALSE, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 32 bit absolute */
- HOWTO (R_ARM_ABS32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* standard 32bit pc-relative reloc */
- HOWTO (R_ARM_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_REL32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit absolute */
- HOWTO (R_ARM_PC13, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PC13", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit absolute */
- HOWTO (R_ARM_ABS16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS16", /* name */
- FALSE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 12 bit absolute */
- HOWTO (R_ARM_ABS12, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 12, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS12", /* name */
- FALSE, /* partial_inplace */
- 0x000008ff, /* src_mask */
- 0x000008ff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_ABS5, /* type */
- 6, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_ABS5", /* name */
- FALSE, /* partial_inplace */
- 0x000007e0, /* src_mask */
- 0x000007e0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 8 bit absolute */
- HOWTO (R_ARM_ABS8, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS8", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_SBREL32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_SBREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_PC22, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 23, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC22", /* name */
- FALSE, /* partial_inplace */
- 0x07ff07ff, /* src_mask */
- 0x07ff07ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_PC8, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC8", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- HOWTO (R_ARM_AMP_VCALL9, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_AMP_VCALL9", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- HOWTO (R_ARM_SWI24, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_SWI24", /* name */
- FALSE, /* partial_inplace */
- 0x00000000, /* src_mask */
- 0x00000000, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_SWI8, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_SWI8", /* name */
- FALSE, /* partial_inplace */
- 0x00000000, /* src_mask */
- 0x00000000, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* BLX instruction for the ARM. */
- HOWTO (R_ARM_XPC25, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 25, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_XPC25", /* name */
- FALSE, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* BLX instruction for the Thumb. */
- HOWTO (R_ARM_THM_XPC22, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 22, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_XPC22", /* name */
- FALSE, /* partial_inplace */
- 0x07ff07ff, /* src_mask */
- 0x07ff07ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* These next three relocs are not defined, but we need to fill the space. */
-
- HOWTO (R_ARM_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_unknown_17", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_unknown_18", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_unknown_19", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Relocs used in ARM Linux */
-
- HOWTO (R_ARM_COPY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_COPY", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_GLOB_DAT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_GLOB_DAT", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_JUMP_SLOT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_JUMP_SLOT", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_RELATIVE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RELATIVE", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_GOTOFF, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_GOTOFF", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_GOTPC, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_GOTPC", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- HOWTO (R_ARM_GOT32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_GOT32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_PLT32, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PLT32", /* name */
- TRUE, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* End of relocs used in ARM Linux */
-
- HOWTO (R_ARM_RREL32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_RABS32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RABS32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_RPC24, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RPC24", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_RBASE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RBASE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
-};
-
- /* GNU extension to record C++ vtable hierarchy */
-static reloc_howto_type elf32_arm_vtinherit_howto =
- HOWTO (R_ARM_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_ARM_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
- /* GNU extension to record C++ vtable member usage */
-static reloc_howto_type elf32_arm_vtentry_howto =
- HOWTO (R_ARM_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_ARM_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
- /* 12 bit pc relative */
-static reloc_howto_type elf32_arm_thm_pc11_howto =
- HOWTO (R_ARM_THM_PC11, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 11, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC11", /* name */
- FALSE, /* partial_inplace */
- 0x000007ff, /* src_mask */
- 0x000007ff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
- /* 12 bit pc relative */
-static reloc_howto_type elf32_arm_thm_pc9_howto =
- HOWTO (R_ARM_THM_PC9, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC9", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-static void elf32_arm_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-
-static void
-elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
- bfd * abfd ATTRIBUTE_UNUSED;
- arelent * bfd_reloc;
- Elf_Internal_Rela * elf_reloc;
-{
- unsigned int r_type;
-
- r_type = ELF32_R_TYPE (elf_reloc->r_info);
-
- switch (r_type)
- {
- case R_ARM_GNU_VTINHERIT:
- bfd_reloc->howto = & elf32_arm_vtinherit_howto;
- break;
-
- case R_ARM_GNU_VTENTRY:
- bfd_reloc->howto = & elf32_arm_vtentry_howto;
- break;
-
- case R_ARM_THM_PC11:
- bfd_reloc->howto = & elf32_arm_thm_pc11_howto;
- break;
-
- case R_ARM_THM_PC9:
- bfd_reloc->howto = & elf32_arm_thm_pc9_howto;
- break;
-
- default:
- if (r_type >= NUM_ELEM (elf32_arm_howto_table))
- bfd_reloc->howto = NULL;
- else
- bfd_reloc->howto = & elf32_arm_howto_table[r_type];
- break;
- }
-}
-
-struct elf32_arm_reloc_map
- {
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
- };
-
-static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
- {
- {BFD_RELOC_NONE, R_ARM_NONE},
- {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24},
- {BFD_RELOC_ARM_PCREL_BLX, R_ARM_XPC25},
- {BFD_RELOC_THUMB_PCREL_BLX, R_ARM_THM_XPC22},
- {BFD_RELOC_32, R_ARM_ABS32},
- {BFD_RELOC_32_PCREL, R_ARM_REL32},
- {BFD_RELOC_8, R_ARM_ABS8},
- {BFD_RELOC_16, R_ARM_ABS16},
- {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12},
- {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5},
- {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22},
- {BFD_RELOC_ARM_COPY, R_ARM_COPY},
- {BFD_RELOC_ARM_GLOB_DAT, R_ARM_GLOB_DAT},
- {BFD_RELOC_ARM_JUMP_SLOT, R_ARM_JUMP_SLOT},
- {BFD_RELOC_ARM_RELATIVE, R_ARM_RELATIVE},
- {BFD_RELOC_ARM_GOTOFF, R_ARM_GOTOFF},
- {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC},
- {BFD_RELOC_ARM_GOT32, R_ARM_GOT32},
- {BFD_RELOC_ARM_PLT32, R_ARM_PLT32}
- };
-
-static reloc_howto_type *
-elf32_arm_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- unsigned int i;
-
- switch (code)
- {
- case BFD_RELOC_VTABLE_INHERIT:
- return & elf32_arm_vtinherit_howto;
-
- case BFD_RELOC_VTABLE_ENTRY:
- return & elf32_arm_vtentry_howto;
-
- case BFD_RELOC_THUMB_PCREL_BRANCH12:
- return & elf32_arm_thm_pc11_howto;
-
- case BFD_RELOC_THUMB_PCREL_BRANCH9:
- return & elf32_arm_thm_pc9_howto;
-
- default:
- for (i = 0; i < NUM_ELEM (elf32_arm_reloc_map); i ++)
- if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
- return & elf32_arm_howto_table[elf32_arm_reloc_map[i].elf_reloc_val];
-
- return NULL;
- }
-}
-
-/* Support for core dump NOTE sections */
-static bfd_boolean
-elf32_arm_nabi_grok_prstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
-{
- int offset;
- size_t raw_size;
-
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 148: /* Linux/ARM 32-bit*/
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 72;
- raw_size = 72;
-
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static bfd_boolean
-elf32_arm_nabi_grok_psinfo (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 124: /* Linux/ARM elf_prpsinfo */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-
-#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
-#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo
-
-#include "elf32-arm.h"
diff --git a/contrib/binutils/bfd/elfarm-oabi.c b/contrib/binutils/bfd/elfarm-oabi.c
deleted file mode 100644
index 08ba41e..0000000
--- a/contrib/binutils/bfd/elfarm-oabi.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/* 32-bit ELF support for ARM old abi option.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define OLD_ARM_ABI
-#define bfd_elf32_arm_allocate_interworking_sections \
- bfd_elf32_arm_oabi_allocate_interworking_sections
-#define bfd_elf32_arm_get_bfd_for_interworking \
- bfd_elf32_arm_oabi_get_bfd_for_interworking
-#define bfd_elf32_arm_process_before_allocation \
- bfd_elf32_arm_oabi_process_before_allocation
-#define bfd_elf32_arm_add_glue_sections_to_bfd \
- bfd_elf32_arm_oabi_add_glue_sections_to_bfd
-
-#include "elf/arm.h"
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-#ifndef NUM_ELEM
-#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
-#endif
-
-#define TARGET_LITTLE_SYM bfd_elf32_littlearm_oabi_vec
-#define TARGET_LITTLE_NAME "elf32-littlearm-oabi"
-#define TARGET_BIG_SYM bfd_elf32_bigarm_oabi_vec
-#define TARGET_BIG_NAME "elf32-bigarm-oabi"
-
-#define elf_info_to_howto elf32_arm_info_to_howto
-#define elf_info_to_howto_rel 0
-
-#define ARM_ELF_ABI_VERSION 0
-#define ARM_ELF_OS_ABI_VERSION 0
-
-static reloc_howto_type * find_howto PARAMS ((unsigned int));
-static void elf32_arm_info_to_howto PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static reloc_howto_type * elf32_arm_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-static reloc_howto_type elf32_arm_howto_table[] =
- {
- /* No relocation. */
- HOWTO (R_ARM_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_PC24, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 24, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PC24", /* name */
- FALSE, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 32 bit absolute. */
- HOWTO (R_ARM_ABS32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Standard 32bit pc-relative reloc. */
- HOWTO (R_ARM_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_REL32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit absolute. */
- HOWTO (R_ARM_ABS8, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS8", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit absolute. */
- HOWTO (R_ARM_ABS16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 12 bit absolute. */
- HOWTO (R_ARM_ABS12, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 12, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS12", /* name */
- FALSE, /* partial_inplace */
- 0x000008ff, /* src_mask */
- 0x000008ff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_ABS5, /* type */
- 6, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_ABS5", /* name */
- FALSE, /* partial_inplace */
- 0x000007e0, /* src_mask */
- 0x000007e0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_PC22, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 23, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC22", /* name */
- FALSE, /* partial_inplace */
- 0x07ff07ff, /* src_mask */
- 0x07ff07ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- HOWTO (R_ARM_SBREL32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_SBREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_AMP_VCALL9, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_AMP_VCALL9", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 12 bit pc relative. */
- HOWTO (R_ARM_THM_PC11, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 11, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC11", /* name */
- FALSE, /* partial_inplace */
- 0x000007ff, /* src_mask */
- 0x000007ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 12 bit pc relative. */
- HOWTO (R_ARM_THM_PC9, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC9", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable hierarchy. */
- HOWTO (R_ARM_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_ARM_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable member usage. */
- HOWTO (R_ARM_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_ARM_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* XXX - gap in index numbering here. */
-
- HOWTO (R_ARM_PLT32, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PLT32", /* name */
- TRUE, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* XXX - gap in index numbering here. */
-
- HOWTO (R_ARM_RREL32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_RABS32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RABS32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_RPC24, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RPC24", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_ARM_RBASE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RBASE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE) /* pcrel_offset */
- };
-
-/* Locate a reloc in the howto table. This function must be used
- when the entry number is is > R_ARM_GNU_VTINHERIT. */
-
-static reloc_howto_type *
-find_howto (r_type)
- unsigned int r_type;
-{
- int i;
-
- for (i = NUM_ELEM (elf32_arm_howto_table); i--;)
- if (elf32_arm_howto_table [i].type == r_type)
- return elf32_arm_howto_table + i;
-
- return NULL;
-}
-
-static void
-elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc;
-{
- unsigned int r_type;
-
- r_type = ELF32_R_TYPE (elf_reloc->r_info);
-
- if (r_type <= R_ARM_GNU_VTINHERIT)
- bfd_reloc->howto = & elf32_arm_howto_table[r_type];
- else
- bfd_reloc->howto = find_howto (r_type);
-}
-
-struct elf32_arm_reloc_map
- {
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
- };
-
-static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
- {
- {BFD_RELOC_NONE, R_ARM_NONE },
- {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24 },
- {BFD_RELOC_32, R_ARM_ABS32 },
- {BFD_RELOC_32_PCREL, R_ARM_REL32 },
- {BFD_RELOC_8, R_ARM_ABS8 },
- {BFD_RELOC_16, R_ARM_ABS16 },
- {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12 },
- {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5 },
- {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22 },
- {BFD_RELOC_NONE, R_ARM_SBREL32 },
- {BFD_RELOC_NONE, R_ARM_AMP_VCALL9 },
- {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 },
- {BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 },
- {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT },
- {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY }
- };
-
-static reloc_howto_type *
-elf32_arm_reloc_type_lookup (abfd, code)
- bfd * abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- unsigned int i;
-
- for (i = NUM_ELEM (elf32_arm_reloc_map); i--;)
- if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
- return & elf32_arm_howto_table [elf32_arm_reloc_map[i].elf_reloc_val];
-
- if (code == BFD_RELOC_ARM_PLT32)
- return find_howto (R_ARM_PLT32);
-
- return NULL;
-}
-
-#include "elf32-arm.h"
diff --git a/contrib/binutils/bfd/elfcode.h b/contrib/binutils/bfd/elfcode.h
deleted file mode 100644
index bc69d48..0000000
--- a/contrib/binutils/bfd/elfcode.h
+++ /dev/null
@@ -1,1750 +0,0 @@
-/* ELF executable support for BFD.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003 Free Software Foundation, Inc.
-
- Written by Fred Fish @ Cygnus Support, from information published
- in "UNIX System V Release 4, Programmers Guide: ANSI C and
- Programming Support Tools". Sufficient support for gdb.
-
- Rewritten by Mark Eichin @ Cygnus Support, from information
- published in "System V Application Binary Interface", chapters 4
- and 5, as well as the various "Processor Supplement" documents
- derived from it. Added support for assembler and other object file
- utilities. Further work done by Ken Raeburn (Cygnus Support), Michael
- Meissner (Open Software Foundation), and Peter Hoogenboom (University
- of Utah) to finish and extend this.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Problems and other issues to resolve.
-
- (1) BFD expects there to be some fixed number of "sections" in
- the object file. I.E. there is a "section_count" variable in the
- bfd structure which contains the number of sections. However, ELF
- supports multiple "views" of a file. In particular, with current
- implementations, executable files typically have two tables, a
- program header table and a section header table, both of which
- partition the executable.
-
- In ELF-speak, the "linking view" of the file uses the section header
- table to access "sections" within the file, and the "execution view"
- uses the program header table to access "segments" within the file.
- "Segments" typically may contain all the data from one or more
- "sections".
-
- Note that the section header table is optional in ELF executables,
- but it is this information that is most useful to gdb. If the
- section header table is missing, then gdb should probably try
- to make do with the program header table. (FIXME)
-
- (2) The code in this file is compiled twice, once in 32-bit mode and
- once in 64-bit mode. More of it should be made size-independent
- and moved into elf.c.
-
- (3) ELF section symbols are handled rather sloppily now. This should
- be cleaned up, and ELF section symbols reconciled with BFD section
- symbols.
-
- (4) We need a published spec for 64-bit ELF. We've got some stuff here
- that we're using for SPARC V9 64-bit chips, but don't assume that
- it's cast in stone.
- */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libiberty.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-
-/* Renaming structures, typedefs, macros and functions to be size-specific. */
-#define Elf_External_Ehdr NAME(Elf,External_Ehdr)
-#define Elf_External_Sym NAME(Elf,External_Sym)
-#define Elf_External_Shdr NAME(Elf,External_Shdr)
-#define Elf_External_Phdr NAME(Elf,External_Phdr)
-#define Elf_External_Rel NAME(Elf,External_Rel)
-#define Elf_External_Rela NAME(Elf,External_Rela)
-#define Elf_External_Dyn NAME(Elf,External_Dyn)
-
-#define elf_core_file_failing_command NAME(bfd_elf,core_file_failing_command)
-#define elf_core_file_failing_signal NAME(bfd_elf,core_file_failing_signal)
-#define elf_core_file_matches_executable_p \
- NAME(bfd_elf,core_file_matches_executable_p)
-#define elf_object_p NAME(bfd_elf,object_p)
-#define elf_core_file_p NAME(bfd_elf,core_file_p)
-#define elf_get_symtab_upper_bound NAME(bfd_elf,get_symtab_upper_bound)
-#define elf_get_dynamic_symtab_upper_bound \
- NAME(bfd_elf,get_dynamic_symtab_upper_bound)
-#define elf_swap_reloc_in NAME(bfd_elf,swap_reloc_in)
-#define elf_swap_reloca_in NAME(bfd_elf,swap_reloca_in)
-#define elf_swap_reloc_out NAME(bfd_elf,swap_reloc_out)
-#define elf_swap_reloca_out NAME(bfd_elf,swap_reloca_out)
-#define elf_swap_symbol_in NAME(bfd_elf,swap_symbol_in)
-#define elf_swap_symbol_out NAME(bfd_elf,swap_symbol_out)
-#define elf_swap_phdr_in NAME(bfd_elf,swap_phdr_in)
-#define elf_swap_phdr_out NAME(bfd_elf,swap_phdr_out)
-#define elf_swap_dyn_in NAME(bfd_elf,swap_dyn_in)
-#define elf_swap_dyn_out NAME(bfd_elf,swap_dyn_out)
-#define elf_get_reloc_upper_bound NAME(bfd_elf,get_reloc_upper_bound)
-#define elf_canonicalize_reloc NAME(bfd_elf,canonicalize_reloc)
-#define elf_slurp_symbol_table NAME(bfd_elf,slurp_symbol_table)
-#define elf_canonicalize_symtab NAME(bfd_elf,canonicalize_symtab)
-#define elf_canonicalize_dynamic_symtab \
- NAME(bfd_elf,canonicalize_dynamic_symtab)
-#define elf_make_empty_symbol NAME(bfd_elf,make_empty_symbol)
-#define elf_get_symbol_info NAME(bfd_elf,get_symbol_info)
-#define elf_get_lineno NAME(bfd_elf,get_lineno)
-#define elf_set_arch_mach NAME(bfd_elf,set_arch_mach)
-#define elf_find_nearest_line NAME(bfd_elf,find_nearest_line)
-#define elf_sizeof_headers NAME(bfd_elf,sizeof_headers)
-#define elf_set_section_contents NAME(bfd_elf,set_section_contents)
-#define elf_no_info_to_howto NAME(bfd_elf,no_info_to_howto)
-#define elf_no_info_to_howto_rel NAME(bfd_elf,no_info_to_howto_rel)
-#define elf_find_section NAME(bfd_elf,find_section)
-#define elf_write_shdrs_and_ehdr NAME(bfd_elf,write_shdrs_and_ehdr)
-#define elf_write_out_phdrs NAME(bfd_elf,write_out_phdrs)
-#define elf_write_relocs NAME(bfd_elf,write_relocs)
-#define elf_slurp_reloc_table NAME(bfd_elf,slurp_reloc_table)
-
-#if ARCH_SIZE == 64
-#define ELF_R_INFO(X,Y) ELF64_R_INFO(X,Y)
-#define ELF_R_SYM(X) ELF64_R_SYM(X)
-#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
-#define ELFCLASS ELFCLASS64
-#define FILE_ALIGN 8
-#define LOG_FILE_ALIGN 3
-#endif
-#if ARCH_SIZE == 32
-#define ELF_R_INFO(X,Y) ELF32_R_INFO(X,Y)
-#define ELF_R_SYM(X) ELF32_R_SYM(X)
-#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
-#define ELFCLASS ELFCLASS32
-#define FILE_ALIGN 4
-#define LOG_FILE_ALIGN 2
-#endif
-
-#ifdef DEBUG
-static void elf_debug_section (int, Elf_Internal_Shdr *);
-static void elf_debug_file (Elf_Internal_Ehdr *);
-static char *elf_symbol_flags (flagword);
-#endif
-
-/* Structure swapping routines */
-
-/* Should perhaps use put_offset, put_word, etc. For now, the two versions
- can be handled by explicitly specifying 32 bits or "the long type". */
-#if ARCH_SIZE == 64
-#define H_PUT_WORD H_PUT_64
-#define H_PUT_SIGNED_WORD H_PUT_S64
-#define H_GET_WORD H_GET_64
-#define H_GET_SIGNED_WORD H_GET_S64
-#endif
-#if ARCH_SIZE == 32
-#define H_PUT_WORD H_PUT_32
-#define H_PUT_SIGNED_WORD H_PUT_S32
-#define H_GET_WORD H_GET_32
-#define H_GET_SIGNED_WORD H_GET_S32
-#endif
-
-/* Translate an ELF symbol in external format into an ELF symbol in internal
- format. */
-
-void
-elf_swap_symbol_in (bfd *abfd,
- const void *psrc,
- const void *pshn,
- Elf_Internal_Sym *dst)
-{
- const Elf_External_Sym *src = psrc;
- const Elf_External_Sym_Shndx *shndx = pshn;
- int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
-
- dst->st_name = H_GET_32 (abfd, src->st_name);
- if (signed_vma)
- dst->st_value = H_GET_SIGNED_WORD (abfd, src->st_value);
- else
- dst->st_value = H_GET_WORD (abfd, src->st_value);
- dst->st_size = H_GET_WORD (abfd, src->st_size);
- dst->st_info = H_GET_8 (abfd, src->st_info);
- dst->st_other = H_GET_8 (abfd, src->st_other);
- dst->st_shndx = H_GET_16 (abfd, src->st_shndx);
- if (dst->st_shndx == SHN_XINDEX)
- {
- if (shndx == NULL)
- abort ();
- dst->st_shndx = H_GET_32 (abfd, shndx->est_shndx);
- }
-}
-
-/* Translate an ELF symbol in internal format into an ELF symbol in external
- format. */
-
-void
-elf_swap_symbol_out (bfd *abfd,
- const Elf_Internal_Sym *src,
- void *cdst,
- void *shndx)
-{
- unsigned int tmp;
- Elf_External_Sym *dst = cdst;
- H_PUT_32 (abfd, src->st_name, dst->st_name);
- H_PUT_WORD (abfd, src->st_value, dst->st_value);
- H_PUT_WORD (abfd, src->st_size, dst->st_size);
- H_PUT_8 (abfd, src->st_info, dst->st_info);
- H_PUT_8 (abfd, src->st_other, dst->st_other);
- tmp = src->st_shndx;
- if (tmp > SHN_HIRESERVE)
- {
- if (shndx == NULL)
- abort ();
- H_PUT_32 (abfd, tmp, shndx);
- tmp = SHN_XINDEX;
- }
- H_PUT_16 (abfd, tmp, dst->st_shndx);
-}
-
-/* Translate an ELF file header in external format into an ELF file header in
- internal format. */
-
-static void
-elf_swap_ehdr_in (bfd *abfd,
- const Elf_External_Ehdr *src,
- Elf_Internal_Ehdr *dst)
-{
- int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
- memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
- dst->e_type = H_GET_16 (abfd, src->e_type);
- dst->e_machine = H_GET_16 (abfd, src->e_machine);
- dst->e_version = H_GET_32 (abfd, src->e_version);
- if (signed_vma)
- dst->e_entry = H_GET_SIGNED_WORD (abfd, src->e_entry);
- else
- dst->e_entry = H_GET_WORD (abfd, src->e_entry);
- dst->e_phoff = H_GET_WORD (abfd, src->e_phoff);
- dst->e_shoff = H_GET_WORD (abfd, src->e_shoff);
- dst->e_flags = H_GET_32 (abfd, src->e_flags);
- dst->e_ehsize = H_GET_16 (abfd, src->e_ehsize);
- dst->e_phentsize = H_GET_16 (abfd, src->e_phentsize);
- dst->e_phnum = H_GET_16 (abfd, src->e_phnum);
- dst->e_shentsize = H_GET_16 (abfd, src->e_shentsize);
- dst->e_shnum = H_GET_16 (abfd, src->e_shnum);
- dst->e_shstrndx = H_GET_16 (abfd, src->e_shstrndx);
-}
-
-/* Translate an ELF file header in internal format into an ELF file header in
- external format. */
-
-static void
-elf_swap_ehdr_out (bfd *abfd,
- const Elf_Internal_Ehdr *src,
- Elf_External_Ehdr *dst)
-{
- unsigned int tmp;
- int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
- memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
- /* note that all elements of dst are *arrays of unsigned char* already... */
- H_PUT_16 (abfd, src->e_type, dst->e_type);
- H_PUT_16 (abfd, src->e_machine, dst->e_machine);
- H_PUT_32 (abfd, src->e_version, dst->e_version);
- if (signed_vma)
- H_PUT_SIGNED_WORD (abfd, src->e_entry, dst->e_entry);
- else
- H_PUT_WORD (abfd, src->e_entry, dst->e_entry);
- H_PUT_WORD (abfd, src->e_phoff, dst->e_phoff);
- H_PUT_WORD (abfd, src->e_shoff, dst->e_shoff);
- H_PUT_32 (abfd, src->e_flags, dst->e_flags);
- H_PUT_16 (abfd, src->e_ehsize, dst->e_ehsize);
- H_PUT_16 (abfd, src->e_phentsize, dst->e_phentsize);
- H_PUT_16 (abfd, src->e_phnum, dst->e_phnum);
- H_PUT_16 (abfd, src->e_shentsize, dst->e_shentsize);
- tmp = src->e_shnum;
- if (tmp >= SHN_LORESERVE)
- tmp = SHN_UNDEF;
- H_PUT_16 (abfd, tmp, dst->e_shnum);
- tmp = src->e_shstrndx;
- if (tmp >= SHN_LORESERVE)
- tmp = SHN_XINDEX;
- H_PUT_16 (abfd, tmp, dst->e_shstrndx);
-}
-
-/* Translate an ELF section header table entry in external format into an
- ELF section header table entry in internal format. */
-
-static void
-elf_swap_shdr_in (bfd *abfd,
- const Elf_External_Shdr *src,
- Elf_Internal_Shdr *dst)
-{
- int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
-
- dst->sh_name = H_GET_32 (abfd, src->sh_name);
- dst->sh_type = H_GET_32 (abfd, src->sh_type);
- dst->sh_flags = H_GET_WORD (abfd, src->sh_flags);
- if (signed_vma)
- dst->sh_addr = H_GET_SIGNED_WORD (abfd, src->sh_addr);
- else
- dst->sh_addr = H_GET_WORD (abfd, src->sh_addr);
- dst->sh_offset = H_GET_WORD (abfd, src->sh_offset);
- dst->sh_size = H_GET_WORD (abfd, src->sh_size);
- dst->sh_link = H_GET_32 (abfd, src->sh_link);
- dst->sh_info = H_GET_32 (abfd, src->sh_info);
- dst->sh_addralign = H_GET_WORD (abfd, src->sh_addralign);
- dst->sh_entsize = H_GET_WORD (abfd, src->sh_entsize);
- dst->bfd_section = NULL;
- dst->contents = NULL;
-}
-
-/* Translate an ELF section header table entry in internal format into an
- ELF section header table entry in external format. */
-
-static void
-elf_swap_shdr_out (bfd *abfd,
- const Elf_Internal_Shdr *src,
- Elf_External_Shdr *dst)
-{
- /* note that all elements of dst are *arrays of unsigned char* already... */
- H_PUT_32 (abfd, src->sh_name, dst->sh_name);
- H_PUT_32 (abfd, src->sh_type, dst->sh_type);
- H_PUT_WORD (abfd, src->sh_flags, dst->sh_flags);
- H_PUT_WORD (abfd, src->sh_addr, dst->sh_addr);
- H_PUT_WORD (abfd, src->sh_offset, dst->sh_offset);
- H_PUT_WORD (abfd, src->sh_size, dst->sh_size);
- H_PUT_32 (abfd, src->sh_link, dst->sh_link);
- H_PUT_32 (abfd, src->sh_info, dst->sh_info);
- H_PUT_WORD (abfd, src->sh_addralign, dst->sh_addralign);
- H_PUT_WORD (abfd, src->sh_entsize, dst->sh_entsize);
-}
-
-/* Translate an ELF program header table entry in external format into an
- ELF program header table entry in internal format. */
-
-void
-elf_swap_phdr_in (bfd *abfd,
- const Elf_External_Phdr *src,
- Elf_Internal_Phdr *dst)
-{
- int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
-
- dst->p_type = H_GET_32 (abfd, src->p_type);
- dst->p_flags = H_GET_32 (abfd, src->p_flags);
- dst->p_offset = H_GET_WORD (abfd, src->p_offset);
- if (signed_vma)
- {
- dst->p_vaddr = H_GET_SIGNED_WORD (abfd, src->p_vaddr);
- dst->p_paddr = H_GET_SIGNED_WORD (abfd, src->p_paddr);
- }
- else
- {
- dst->p_vaddr = H_GET_WORD (abfd, src->p_vaddr);
- dst->p_paddr = H_GET_WORD (abfd, src->p_paddr);
- }
- dst->p_filesz = H_GET_WORD (abfd, src->p_filesz);
- dst->p_memsz = H_GET_WORD (abfd, src->p_memsz);
- dst->p_align = H_GET_WORD (abfd, src->p_align);
-}
-
-void
-elf_swap_phdr_out (bfd *abfd,
- const Elf_Internal_Phdr *src,
- Elf_External_Phdr *dst)
-{
- /* note that all elements of dst are *arrays of unsigned char* already... */
- H_PUT_32 (abfd, src->p_type, dst->p_type);
- H_PUT_WORD (abfd, src->p_offset, dst->p_offset);
- H_PUT_WORD (abfd, src->p_vaddr, dst->p_vaddr);
- H_PUT_WORD (abfd, src->p_paddr, dst->p_paddr);
- H_PUT_WORD (abfd, src->p_filesz, dst->p_filesz);
- H_PUT_WORD (abfd, src->p_memsz, dst->p_memsz);
- H_PUT_32 (abfd, src->p_flags, dst->p_flags);
- H_PUT_WORD (abfd, src->p_align, dst->p_align);
-}
-
-/* Translate an ELF reloc from external format to internal format. */
-void
-elf_swap_reloc_in (bfd *abfd,
- const bfd_byte *s,
- Elf_Internal_Rela *dst)
-{
- const Elf_External_Rel *src = (const Elf_External_Rel *) s;
- dst->r_offset = H_GET_WORD (abfd, src->r_offset);
- dst->r_info = H_GET_WORD (abfd, src->r_info);
- dst->r_addend = 0;
-}
-
-void
-elf_swap_reloca_in (bfd *abfd,
- const bfd_byte *s,
- Elf_Internal_Rela *dst)
-{
- const Elf_External_Rela *src = (const Elf_External_Rela *) s;
- dst->r_offset = H_GET_WORD (abfd, src->r_offset);
- dst->r_info = H_GET_WORD (abfd, src->r_info);
- dst->r_addend = H_GET_SIGNED_WORD (abfd, src->r_addend);
-}
-
-/* Translate an ELF reloc from internal format to external format. */
-void
-elf_swap_reloc_out (bfd *abfd,
- const Elf_Internal_Rela *src,
- bfd_byte *d)
-{
- Elf_External_Rel *dst = (Elf_External_Rel *) d;
- H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
- H_PUT_WORD (abfd, src->r_info, dst->r_info);
-}
-
-void
-elf_swap_reloca_out (bfd *abfd,
- const Elf_Internal_Rela *src,
- bfd_byte *d)
-{
- Elf_External_Rela *dst = (Elf_External_Rela *) d;
- H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
- H_PUT_WORD (abfd, src->r_info, dst->r_info);
- H_PUT_SIGNED_WORD (abfd, src->r_addend, dst->r_addend);
-}
-
-void
-elf_swap_dyn_in (bfd *abfd,
- const void *p,
- Elf_Internal_Dyn *dst)
-{
- const Elf_External_Dyn *src = p;
-
- dst->d_tag = H_GET_WORD (abfd, src->d_tag);
- dst->d_un.d_val = H_GET_WORD (abfd, src->d_un.d_val);
-}
-
-void
-elf_swap_dyn_out (bfd *abfd,
- const Elf_Internal_Dyn *src,
- void *p)
-{
- Elf_External_Dyn *dst = p;
-
- H_PUT_WORD (abfd, src->d_tag, dst->d_tag);
- H_PUT_WORD (abfd, src->d_un.d_val, dst->d_un.d_val);
-}
-
-/* ELF .o/exec file reading */
-
-/* Begin processing a given object.
-
- First we validate the file by reading in the ELF header and checking
- the magic number. */
-
-static inline bfd_boolean
-elf_file_p (Elf_External_Ehdr *x_ehdrp)
-{
- return ((x_ehdrp->e_ident[EI_MAG0] == ELFMAG0)
- && (x_ehdrp->e_ident[EI_MAG1] == ELFMAG1)
- && (x_ehdrp->e_ident[EI_MAG2] == ELFMAG2)
- && (x_ehdrp->e_ident[EI_MAG3] == ELFMAG3));
-}
-
-/* Check to see if the file associated with ABFD matches the target vector
- that ABFD points to.
-
- Note that we may be called several times with the same ABFD, but different
- target vectors, most of which will not match. We have to avoid leaving
- any side effects in ABFD, or any data it points to (like tdata), if the
- file does not match the target vector. */
-
-const bfd_target *
-elf_object_p (bfd *abfd)
-{
- Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
- Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
- Elf_External_Shdr x_shdr; /* Section header table entry, external form */
- Elf_Internal_Shdr i_shdr;
- Elf_Internal_Shdr *i_shdrp; /* Section header table, internal form */
- unsigned int shindex;
- char *shstrtab; /* Internal copy of section header stringtab */
- const struct elf_backend_data *ebd;
- struct bfd_preserve preserve;
- asection *s;
- bfd_size_type amt;
-
- preserve.marker = NULL;
-
- /* Read in the ELF header in external format. */
-
- if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
- {
- if (bfd_get_error () != bfd_error_system_call)
- goto got_wrong_format_error;
- else
- goto got_no_match;
- }
-
- /* Now check to see if we have a valid ELF file, and one that BFD can
- make use of. The magic number must match, the address size ('class')
- and byte-swapping must match our XVEC entry, and it must have a
- section header table (FIXME: See comments re sections at top of this
- file). */
-
- if (! elf_file_p (&x_ehdr)
- || x_ehdr.e_ident[EI_VERSION] != EV_CURRENT
- || x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
- goto got_wrong_format_error;
-
- /* Check that file's byte order matches xvec's */
- switch (x_ehdr.e_ident[EI_DATA])
- {
- case ELFDATA2MSB: /* Big-endian */
- if (! bfd_header_big_endian (abfd))
- goto got_wrong_format_error;
- break;
- case ELFDATA2LSB: /* Little-endian */
- if (! bfd_header_little_endian (abfd))
- goto got_wrong_format_error;
- break;
- case ELFDATANONE: /* No data encoding specified */
- default: /* Unknown data encoding specified */
- goto got_wrong_format_error;
- }
-
- if (!bfd_preserve_save (abfd, &preserve))
- goto got_no_match;
-
- /* Allocate an instance of the elf_obj_tdata structure and hook it up to
- the tdata pointer in the bfd. */
-
- if (! (*abfd->xvec->_bfd_set_format[bfd_object]) (abfd))
- goto got_no_match;
- preserve.marker = elf_tdata (abfd);
-
- /* Now that we know the byte order, swap in the rest of the header */
- i_ehdrp = elf_elfheader (abfd);
- elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
-#if DEBUG & 1
- elf_debug_file (i_ehdrp);
-#endif
-
- /* Reject ET_CORE (header indicates core file, not object file) */
- if (i_ehdrp->e_type == ET_CORE)
- goto got_wrong_format_error;
-
- /* If this is a relocatable file and there is no section header
- table, then we're hosed. */
- if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL)
- goto got_wrong_format_error;
-
- /* As a simple sanity check, verify that the what BFD thinks is the
- size of each section header table entry actually matches the size
- recorded in the file, but only if there are any sections. */
- if (i_ehdrp->e_shentsize != sizeof (x_shdr) && i_ehdrp->e_shnum != 0)
- goto got_wrong_format_error;
-
- /* Further sanity check. */
- if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0)
- goto got_wrong_format_error;
-
- ebd = get_elf_backend_data (abfd);
-
- /* Check that the ELF e_machine field matches what this particular
- BFD format expects. */
- if (ebd->elf_machine_code != i_ehdrp->e_machine
- && (ebd->elf_machine_alt1 == 0
- || i_ehdrp->e_machine != ebd->elf_machine_alt1)
- && (ebd->elf_machine_alt2 == 0
- || i_ehdrp->e_machine != ebd->elf_machine_alt2))
- {
- const bfd_target * const *target_ptr;
-
- if (ebd->elf_machine_code != EM_NONE)
- goto got_wrong_format_error;
-
- /* This is the generic ELF target. Let it match any ELF target
- for which we do not have a specific backend. */
- for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
- {
- const struct elf_backend_data *back;
-
- if ((*target_ptr)->flavour != bfd_target_elf_flavour)
- continue;
- back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
- if (back->elf_machine_code == i_ehdrp->e_machine
- || (back->elf_machine_alt1 != 0
- && back->elf_machine_alt1 == i_ehdrp->e_machine)
- || (back->elf_machine_alt2 != 0
- && back->elf_machine_alt2 == i_ehdrp->e_machine))
- {
- /* target_ptr is an ELF backend which matches this
- object file, so reject the generic ELF target. */
- goto got_wrong_format_error;
- }
- }
- }
-
- if (i_ehdrp->e_type == ET_EXEC)
- abfd->flags |= EXEC_P;
- else if (i_ehdrp->e_type == ET_DYN)
- abfd->flags |= DYNAMIC;
-
- if (i_ehdrp->e_phnum > 0)
- abfd->flags |= D_PAGED;
-
- if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
- {
- /* It's OK if this fails for the generic target. */
- if (ebd->elf_machine_code != EM_NONE)
- goto got_no_match;
- }
-
- /* Remember the entry point specified in the ELF file header. */
- bfd_set_start_address (abfd, i_ehdrp->e_entry);
-
- if (i_ehdrp->e_shoff != 0)
- {
- /* Seek to the section header table in the file. */
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0)
- goto got_no_match;
-
- /* Read the first section header at index 0, and convert to internal
- form. */
- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
- goto got_no_match;
- elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
-
- /* If the section count is zero, the actual count is in the first
- section header. */
- if (i_ehdrp->e_shnum == SHN_UNDEF)
- i_ehdrp->e_shnum = i_shdr.sh_size;
-
- /* And similarly for the string table index. */
- if (i_ehdrp->e_shstrndx == SHN_XINDEX)
- i_ehdrp->e_shstrndx = i_shdr.sh_link;
- }
-
- /* Allocate space for a copy of the section header table in
- internal form. */
- if (i_ehdrp->e_shnum != 0)
- {
- Elf_Internal_Shdr *shdrp;
- unsigned int num_sec;
-
- amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
- i_shdrp = bfd_alloc (abfd, amt);
- if (!i_shdrp)
- goto got_no_match;
- num_sec = i_ehdrp->e_shnum;
- if (num_sec > SHN_LORESERVE)
- num_sec += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- elf_numsections (abfd) = num_sec;
- amt = sizeof (i_shdrp) * num_sec;
- elf_elfsections (abfd) = bfd_alloc (abfd, amt);
- if (!elf_elfsections (abfd))
- goto got_no_match;
-
- memcpy (i_shdrp, &i_shdr, sizeof (*i_shdrp));
- shdrp = i_shdrp;
- shindex = 0;
- if (num_sec > SHN_LORESERVE)
- {
- for ( ; shindex < SHN_LORESERVE; shindex++)
- elf_elfsections (abfd)[shindex] = shdrp++;
- for ( ; shindex < SHN_HIRESERVE + 1; shindex++)
- elf_elfsections (abfd)[shindex] = i_shdrp;
- }
- for ( ; shindex < num_sec; shindex++)
- elf_elfsections (abfd)[shindex] = shdrp++;
-
- /* Read in the rest of the section header table and convert it
- to internal form. */
- for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
- {
- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
- goto got_no_match;
- elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
-
- /* If the section is loaded, but not page aligned, clear
- D_PAGED. */
- if (i_shdrp[shindex].sh_size != 0
- && (i_shdrp[shindex].sh_flags & SHF_ALLOC) != 0
- && i_shdrp[shindex].sh_type != SHT_NOBITS
- && (((i_shdrp[shindex].sh_addr - i_shdrp[shindex].sh_offset)
- % ebd->maxpagesize)
- != 0))
- abfd->flags &= ~D_PAGED;
- }
- }
-
- if (i_ehdrp->e_shstrndx && i_ehdrp->e_shoff)
- {
- if (! bfd_section_from_shdr (abfd, i_ehdrp->e_shstrndx))
- goto got_no_match;
- }
-
- /* Read in the program headers. */
- if (i_ehdrp->e_phnum == 0)
- elf_tdata (abfd)->phdr = NULL;
- else
- {
- Elf_Internal_Phdr *i_phdr;
- unsigned int i;
-
- amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr);
- elf_tdata (abfd)->phdr = bfd_alloc (abfd, amt);
- if (elf_tdata (abfd)->phdr == NULL)
- goto got_no_match;
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
- goto got_no_match;
- i_phdr = elf_tdata (abfd)->phdr;
- for (i = 0; i < i_ehdrp->e_phnum; i++, i_phdr++)
- {
- Elf_External_Phdr x_phdr;
-
- if (bfd_bread (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr)
- goto got_no_match;
- elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
- }
- }
-
- /* Read in the string table containing the names of the sections. We
- will need the base pointer to this table later. */
- /* We read this inline now, so that we don't have to go through
- bfd_section_from_shdr with it (since this particular strtab is
- used to find all of the ELF section names.) */
-
- if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff)
- {
- unsigned int num_sec;
-
- shstrtab = bfd_elf_get_str_section (abfd, i_ehdrp->e_shstrndx);
- if (!shstrtab)
- goto got_no_match;
-
- /* Once all of the section headers have been read and converted, we
- can start processing them. Note that the first section header is
- a dummy placeholder entry, so we ignore it. */
- num_sec = elf_numsections (abfd);
- for (shindex = 1; shindex < num_sec; shindex++)
- {
- if (! bfd_section_from_shdr (abfd, shindex))
- goto got_no_match;
- if (shindex == SHN_LORESERVE - 1)
- shindex += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- }
-
- /* Let the backend double check the format and override global
- information. */
- if (ebd->elf_backend_object_p)
- {
- if (! (*ebd->elf_backend_object_p) (abfd))
- goto got_wrong_format_error;
- }
-
- /* If we have created any reloc sections that are associated with
- debugging sections, mark the reloc sections as debugging as well. */
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((elf_section_data (s)->this_hdr.sh_type == SHT_REL
- || elf_section_data (s)->this_hdr.sh_type == SHT_RELA)
- && elf_section_data (s)->this_hdr.sh_info > 0)
- {
- unsigned long targ_index;
- asection *targ_sec;
-
- targ_index = elf_section_data (s)->this_hdr.sh_info;
- targ_sec = bfd_section_from_elf_index (abfd, targ_index);
- if (targ_sec != NULL
- && (targ_sec->flags & SEC_DEBUGGING) != 0)
- s->flags |= SEC_DEBUGGING;
- }
- }
-
- bfd_preserve_finish (abfd, &preserve);
- return abfd->xvec;
-
- got_wrong_format_error:
- /* There is way too much undoing of half-known state here. The caller,
- bfd_check_format_matches, really shouldn't iterate on live bfd's to
- check match/no-match like it does. We have to rely on that a call to
- bfd_default_set_arch_mach with the previously known mach, undoes what
- was done by the first bfd_default_set_arch_mach (with mach 0) here.
- For this to work, only elf-data and the mach may be changed by the
- target-specific elf_backend_object_p function. Note that saving the
- whole bfd here and restoring it would be even worse; the first thing
- you notice is that the cached bfd file position gets out of sync. */
- bfd_set_error (bfd_error_wrong_format);
-
- got_no_match:
- if (preserve.marker != NULL)
- bfd_preserve_restore (abfd, &preserve);
- return NULL;
-}
-
-/* ELF .o/exec file writing */
-
-/* Write out the relocs. */
-
-void
-elf_write_relocs (bfd *abfd, asection *sec, void *data)
-{
- bfd_boolean *failedp = data;
- Elf_Internal_Shdr *rela_hdr;
- bfd_vma addr_offset;
- void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
- size_t extsize;
- bfd_byte *dst_rela;
- unsigned int idx;
- asymbol *last_sym;
- int last_sym_idx;
-
- /* If we have already failed, don't do anything. */
- if (*failedp)
- return;
-
- if ((sec->flags & SEC_RELOC) == 0)
- return;
-
- /* The linker backend writes the relocs out itself, and sets the
- reloc_count field to zero to inhibit writing them here. Also,
- sometimes the SEC_RELOC flag gets set even when there aren't any
- relocs. */
- if (sec->reloc_count == 0)
- return;
-
- rela_hdr = &elf_section_data (sec)->rel_hdr;
-
- rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
- rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
- if (rela_hdr->contents == NULL)
- {
- *failedp = TRUE;
- return;
- }
-
- /* Figure out whether the relocations are RELA or REL relocations. */
- if (rela_hdr->sh_type == SHT_RELA)
- {
- swap_out = elf_swap_reloca_out;
- extsize = sizeof (Elf_External_Rela);
- }
- else if (rela_hdr->sh_type == SHT_REL)
- {
- swap_out = elf_swap_reloc_out;
- extsize = sizeof (Elf_External_Rel);
- }
- else
- /* Every relocation section should be either an SHT_RELA or an
- SHT_REL section. */
- abort ();
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a BFD reloc is always section relative. */
- addr_offset = 0;
- if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
- addr_offset = sec->vma;
-
- /* orelocation has the data, reloc_count has the count... */
- last_sym = 0;
- last_sym_idx = 0;
- dst_rela = rela_hdr->contents;
-
- for (idx = 0; idx < sec->reloc_count; idx++, dst_rela += extsize)
- {
- Elf_Internal_Rela src_rela;
- arelent *ptr;
- asymbol *sym;
- int n;
-
- ptr = sec->orelocation[idx];
- sym = *ptr->sym_ptr_ptr;
- if (sym == last_sym)
- n = last_sym_idx;
- else if (bfd_is_abs_section (sym->section) && sym->value == 0)
- n = STN_UNDEF;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = TRUE;
- return;
- }
- last_sym_idx = n;
- }
-
- if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
- && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
- {
- *failedp = TRUE;
- return;
- }
-
- src_rela.r_offset = ptr->address + addr_offset;
- src_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
- src_rela.r_addend = ptr->addend;
- (*swap_out) (abfd, &src_rela, dst_rela);
- }
-}
-
-/* Write out the program headers. */
-
-int
-elf_write_out_phdrs (bfd *abfd,
- const Elf_Internal_Phdr *phdr,
- unsigned int count)
-{
- while (count--)
- {
- Elf_External_Phdr extphdr;
- elf_swap_phdr_out (abfd, phdr, &extphdr);
- if (bfd_bwrite (&extphdr, sizeof (Elf_External_Phdr), abfd)
- != sizeof (Elf_External_Phdr))
- return -1;
- phdr++;
- }
- return 0;
-}
-
-/* Write out the section headers and the ELF file header. */
-
-bfd_boolean
-elf_write_shdrs_and_ehdr (bfd *abfd)
-{
- Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
- Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
- Elf_External_Shdr *x_shdrp; /* Section header table, external form */
- Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */
- unsigned int count;
- bfd_size_type amt;
-
- i_ehdrp = elf_elfheader (abfd);
- i_shdrp = elf_elfsections (abfd);
-
- /* swap the header before spitting it out... */
-
-#if DEBUG & 1
- elf_debug_file (i_ehdrp);
-#endif
- elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
- amt = sizeof (x_ehdr);
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bwrite (&x_ehdr, amt, abfd) != amt)
- return FALSE;
-
- /* Some fields in the first section header handle overflow of ehdr
- fields. */
- if (i_ehdrp->e_shnum >= SHN_LORESERVE)
- i_shdrp[0]->sh_size = i_ehdrp->e_shnum;
- if (i_ehdrp->e_shstrndx >= SHN_LORESERVE)
- i_shdrp[0]->sh_link = i_ehdrp->e_shstrndx;
-
- /* at this point we've concocted all the ELF sections... */
- amt = i_ehdrp->e_shnum;
- amt *= sizeof (*x_shdrp);
- x_shdrp = bfd_alloc (abfd, amt);
- if (!x_shdrp)
- return FALSE;
-
- for (count = 0; count < i_ehdrp->e_shnum; i_shdrp++, count++)
- {
-#if DEBUG & 2
- elf_debug_section (count, *i_shdrp);
-#endif
- elf_swap_shdr_out (abfd, *i_shdrp, x_shdrp + count);
-
- if (count == SHN_LORESERVE - 1)
- i_shdrp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0
- || bfd_bwrite (x_shdrp, amt, abfd) != amt)
- return FALSE;
-
- /* need to dump the string table too... */
-
- return TRUE;
-}
-
-long
-elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
-{
- Elf_Internal_Shdr *hdr;
- Elf_Internal_Shdr *verhdr;
- unsigned long symcount; /* Number of external ELF symbols */
- elf_symbol_type *sym; /* Pointer to current bfd symbol */
- elf_symbol_type *symbase; /* Buffer for generated bfd symbols */
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- Elf_Internal_Sym *isymbuf = NULL;
- Elf_External_Versym *xver;
- Elf_External_Versym *xverbuf = NULL;
- const struct elf_backend_data *ebd;
- bfd_size_type amt;
-
- /* Read each raw ELF symbol, converting from external ELF form to
- internal ELF form, and then using the information to create a
- canonical bfd symbol table entry.
-
- Note that we allocate the initial bfd canonical symbol buffer
- based on a one-to-one mapping of the ELF symbols to canonical
- symbols. We actually use all the ELF symbols, so there will be no
- space left over at the end. When we have all the symbols, we
- build the caller's pointer vector. */
-
- if (! dynamic)
- {
- hdr = &elf_tdata (abfd)->symtab_hdr;
- verhdr = NULL;
- }
- else
- {
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
- if (elf_dynversym (abfd) == 0)
- verhdr = NULL;
- else
- verhdr = &elf_tdata (abfd)->dynversym_hdr;
- if ((elf_tdata (abfd)->dynverdef_section != 0
- && elf_tdata (abfd)->verdef == NULL)
- || (elf_tdata (abfd)->dynverref_section != 0
- && elf_tdata (abfd)->verref == NULL))
- {
- if (! _bfd_elf_slurp_version_tables (abfd))
- return -1;
- }
- }
-
- ebd = get_elf_backend_data (abfd);
- symcount = hdr->sh_size / sizeof (Elf_External_Sym);
- if (symcount == 0)
- sym = symbase = NULL;
- else
- {
- isymbuf = bfd_elf_get_elf_syms (abfd, hdr, symcount, 0,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- return -1;
-
- amt = symcount;
- amt *= sizeof (elf_symbol_type);
- symbase = bfd_zalloc (abfd, amt);
- if (symbase == (elf_symbol_type *) NULL)
- goto error_return;
-
- /* Read the raw ELF version symbol information. */
- if (verhdr != NULL
- && verhdr->sh_size / sizeof (Elf_External_Versym) != symcount)
- {
- (*_bfd_error_handler)
- (_("%s: version count (%ld) does not match symbol count (%ld)"),
- abfd->filename,
- (long) (verhdr->sh_size / sizeof (Elf_External_Versym)),
- symcount);
-
- /* Slurp in the symbols without the version information,
- since that is more helpful than just quitting. */
- verhdr = NULL;
- }
-
- if (verhdr != NULL)
- {
- if (bfd_seek (abfd, verhdr->sh_offset, SEEK_SET) != 0)
- goto error_return;
-
- xverbuf = bfd_malloc (verhdr->sh_size);
- if (xverbuf == NULL && verhdr->sh_size != 0)
- goto error_return;
-
- if (bfd_bread (xverbuf, verhdr->sh_size, abfd) != verhdr->sh_size)
- goto error_return;
- }
-
- /* Skip first symbol, which is a null dummy. */
- xver = xverbuf;
- if (xver != NULL)
- ++xver;
- isymend = isymbuf + symcount;
- for (isym = isymbuf + 1, sym = symbase; isym < isymend; isym++, sym++)
- {
- memcpy (&sym->internal_elf_sym, isym, sizeof (Elf_Internal_Sym));
- sym->symbol.the_bfd = abfd;
-
- sym->symbol.name = bfd_elf_string_from_elf_section (abfd,
- hdr->sh_link,
- isym->st_name);
-
- sym->symbol.value = isym->st_value;
-
- if (isym->st_shndx == SHN_UNDEF)
- {
- sym->symbol.section = bfd_und_section_ptr;
- }
- else if (isym->st_shndx < SHN_LORESERVE
- || isym->st_shndx > SHN_HIRESERVE)
- {
- sym->symbol.section = bfd_section_from_elf_index (abfd,
- isym->st_shndx);
- if (sym->symbol.section == NULL)
- {
- /* This symbol is in a section for which we did not
- create a BFD section. Just use bfd_abs_section,
- although it is wrong. FIXME. */
- sym->symbol.section = bfd_abs_section_ptr;
- }
- }
- else if (isym->st_shndx == SHN_ABS)
- {
- sym->symbol.section = bfd_abs_section_ptr;
- }
- else if (isym->st_shndx == SHN_COMMON)
- {
- sym->symbol.section = bfd_com_section_ptr;
- /* Elf puts the alignment into the `value' field, and
- the size into the `size' field. BFD wants to see the
- size in the value field, and doesn't care (at the
- moment) about the alignment. */
- sym->symbol.value = isym->st_size;
- }
- else
- sym->symbol.section = bfd_abs_section_ptr;
-
- /* If this is a relocatable file, then the symbol value is
- already section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
- sym->symbol.value -= sym->symbol.section->vma;
-
- switch (ELF_ST_BIND (isym->st_info))
- {
- case STB_LOCAL:
- sym->symbol.flags |= BSF_LOCAL;
- break;
- case STB_GLOBAL:
- if (isym->st_shndx != SHN_UNDEF && isym->st_shndx != SHN_COMMON)
- sym->symbol.flags |= BSF_GLOBAL;
- break;
- case STB_WEAK:
- sym->symbol.flags |= BSF_WEAK;
- break;
- }
-
- switch (ELF_ST_TYPE (isym->st_info))
- {
- case STT_SECTION:
- sym->symbol.flags |= BSF_SECTION_SYM | BSF_DEBUGGING;
- break;
- case STT_FILE:
- sym->symbol.flags |= BSF_FILE | BSF_DEBUGGING;
- break;
- case STT_FUNC:
- sym->symbol.flags |= BSF_FUNCTION;
- break;
- case STT_OBJECT:
- sym->symbol.flags |= BSF_OBJECT;
- break;
- }
-
- if (dynamic)
- sym->symbol.flags |= BSF_DYNAMIC;
-
- if (xver != NULL)
- {
- Elf_Internal_Versym iversym;
-
- _bfd_elf_swap_versym_in (abfd, xver, &iversym);
- sym->version = iversym.vs_vers;
- xver++;
- }
-
- /* Do some backend-specific processing on this symbol. */
- if (ebd->elf_backend_symbol_processing)
- (*ebd->elf_backend_symbol_processing) (abfd, &sym->symbol);
- }
- }
-
- /* Do some backend-specific processing on this symbol table. */
- if (ebd->elf_backend_symbol_table_processing)
- (*ebd->elf_backend_symbol_table_processing) (abfd, symbase, symcount);
-
- /* We rely on the zalloc to clear out the final symbol entry. */
-
- symcount = sym - symbase;
-
- /* Fill in the user's symbol pointer vector if needed. */
- if (symptrs)
- {
- long l = symcount;
-
- sym = symbase;
- while (l-- > 0)
- {
- *symptrs++ = &sym->symbol;
- sym++;
- }
- *symptrs = 0; /* Final null pointer */
- }
-
- if (xverbuf != NULL)
- free (xverbuf);
- if (isymbuf != NULL && hdr->contents != (unsigned char *) isymbuf)
- free (isymbuf);
- return symcount;
-
-error_return:
- if (xverbuf != NULL)
- free (xverbuf);
- if (isymbuf != NULL && hdr->contents != (unsigned char *) isymbuf)
- free (isymbuf);
- return -1;
-}
-
-/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
- them. */
-
-static bfd_boolean
-elf_slurp_reloc_table_from_section (bfd *abfd,
- asection *asect,
- Elf_Internal_Shdr *rel_hdr,
- bfd_size_type reloc_count,
- arelent *relents,
- asymbol **symbols,
- bfd_boolean dynamic)
-{
- const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
- void *allocated = NULL;
- bfd_byte *native_relocs;
- arelent *relent;
- unsigned int i;
- int entsize;
- unsigned int symcount;
-
- allocated = bfd_malloc (rel_hdr->sh_size);
- if (allocated == NULL)
- goto error_return;
-
- if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread (allocated, rel_hdr->sh_size, abfd)
- != rel_hdr->sh_size))
- goto error_return;
-
- native_relocs = allocated;
-
- entsize = rel_hdr->sh_entsize;
- BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
- || entsize == sizeof (Elf_External_Rela));
-
- if (dynamic)
- symcount = bfd_get_dynamic_symcount (abfd);
- else
- symcount = bfd_get_symcount (abfd);
-
- for (i = 0, relent = relents;
- i < reloc_count;
- i++, relent++, native_relocs += entsize)
- {
- Elf_Internal_Rela rela;
-
- if (entsize == sizeof (Elf_External_Rela))
- elf_swap_reloca_in (abfd, native_relocs, &rela);
- else
- elf_swap_reloc_in (abfd, native_relocs, &rela);
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a normal BFD reloc is always section relative,
- and the address of a dynamic reloc is absolute.. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic)
- relent->address = rela.r_offset;
- else
- relent->address = rela.r_offset - asect->vma;
-
- if (ELF_R_SYM (rela.r_info) == 0)
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- else if (ELF_R_SYM (rela.r_info) > symcount)
- {
- (*_bfd_error_handler)
- (_("%s(%s): relocation %d has invalid symbol index %ld"),
- abfd->filename, asect->name, i, ELF_R_SYM (rela.r_info));
- relent->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
- }
- else
- {
- asymbol **ps, *s;
-
- ps = symbols + ELF_R_SYM (rela.r_info) - 1;
- s = *ps;
-
- /* Canonicalize ELF section symbols. FIXME: Why? */
- if ((s->flags & BSF_SECTION_SYM) == 0)
- relent->sym_ptr_ptr = ps;
- else
- relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
- }
-
- relent->addend = rela.r_addend;
-
- if ((entsize == sizeof (Elf_External_Rela)
- && ebd->elf_info_to_howto != NULL)
- || ebd->elf_info_to_howto_rel == NULL)
- (*ebd->elf_info_to_howto) (abfd, relent, &rela);
- else
- (*ebd->elf_info_to_howto_rel) (abfd, relent, &rela);
- }
-
- if (allocated != NULL)
- free (allocated);
-
- return TRUE;
-
- error_return:
- if (allocated != NULL)
- free (allocated);
- return FALSE;
-}
-
-/* Read in and swap the external relocs. */
-
-bfd_boolean
-elf_slurp_reloc_table (bfd *abfd,
- asection *asect,
- asymbol **symbols,
- bfd_boolean dynamic)
-{
- struct bfd_elf_section_data * const d = elf_section_data (asect);
- Elf_Internal_Shdr *rel_hdr;
- Elf_Internal_Shdr *rel_hdr2;
- bfd_size_type reloc_count;
- bfd_size_type reloc_count2;
- arelent *relents;
- bfd_size_type amt;
-
- if (asect->relocation != NULL)
- return TRUE;
-
- if (! dynamic)
- {
- if ((asect->flags & SEC_RELOC) == 0
- || asect->reloc_count == 0)
- return TRUE;
-
- rel_hdr = &d->rel_hdr;
- reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
- rel_hdr2 = d->rel_hdr2;
- reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0);
-
- BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2);
- BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
- || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
-
- }
- else
- {
- /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
- case because relocations against this section may use the
- dynamic symbol table, and in that case bfd_section_from_shdr
- in elf.c does not update the RELOC_COUNT. */
- if (asect->_raw_size == 0)
- return TRUE;
-
- rel_hdr = &d->this_hdr;
- reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
- rel_hdr2 = NULL;
- reloc_count2 = 0;
- }
-
- amt = (reloc_count + reloc_count2) * sizeof (arelent);
- relents = bfd_alloc (abfd, amt);
- if (relents == NULL)
- return FALSE;
-
- if (!elf_slurp_reloc_table_from_section (abfd, asect,
- rel_hdr, reloc_count,
- relents,
- symbols, dynamic))
- return FALSE;
-
- if (rel_hdr2
- && !elf_slurp_reloc_table_from_section (abfd, asect,
- rel_hdr2, reloc_count2,
- relents + reloc_count,
- symbols, dynamic))
- return FALSE;
-
- asect->relocation = relents;
- return TRUE;
-}
-
-#ifdef DEBUG
-static void
-elf_debug_section (int num, Elf_Internal_Shdr *hdr)
-{
- fprintf (stderr, "\nSection#%d '%s' 0x%.8lx\n", num,
- hdr->bfd_section != NULL ? hdr->bfd_section->name : "",
- (long) hdr);
- fprintf (stderr,
- "sh_name = %ld\tsh_type = %ld\tsh_flags = %ld\n",
- (long) hdr->sh_name,
- (long) hdr->sh_type,
- (long) hdr->sh_flags);
- fprintf (stderr,
- "sh_addr = %ld\tsh_offset = %ld\tsh_size = %ld\n",
- (long) hdr->sh_addr,
- (long) hdr->sh_offset,
- (long) hdr->sh_size);
- fprintf (stderr,
- "sh_link = %ld\tsh_info = %ld\tsh_addralign = %ld\n",
- (long) hdr->sh_link,
- (long) hdr->sh_info,
- (long) hdr->sh_addralign);
- fprintf (stderr, "sh_entsize = %ld\n",
- (long) hdr->sh_entsize);
- fflush (stderr);
-}
-
-static void
-elf_debug_file (Elf_Internal_Ehdr *ehdrp)
-{
- fprintf (stderr, "e_entry = 0x%.8lx\n", (long) ehdrp->e_entry);
- fprintf (stderr, "e_phoff = %ld\n", (long) ehdrp->e_phoff);
- fprintf (stderr, "e_phnum = %ld\n", (long) ehdrp->e_phnum);
- fprintf (stderr, "e_phentsize = %ld\n", (long) ehdrp->e_phentsize);
- fprintf (stderr, "e_shoff = %ld\n", (long) ehdrp->e_shoff);
- fprintf (stderr, "e_shnum = %ld\n", (long) ehdrp->e_shnum);
- fprintf (stderr, "e_shentsize = %ld\n", (long) ehdrp->e_shentsize);
-}
-
-static char *
-elf_symbol_flags (flagword flags)
-{
- static char buffer[1024];
-
- buffer[0] = '\0';
- if (flags & BSF_LOCAL)
- strcat (buffer, " local");
-
- if (flags & BSF_GLOBAL)
- strcat (buffer, " global");
-
- if (flags & BSF_DEBUGGING)
- strcat (buffer, " debug");
-
- if (flags & BSF_FUNCTION)
- strcat (buffer, " function");
-
- if (flags & BSF_KEEP)
- strcat (buffer, " keep");
-
- if (flags & BSF_KEEP_G)
- strcat (buffer, " keep_g");
-
- if (flags & BSF_WEAK)
- strcat (buffer, " weak");
-
- if (flags & BSF_SECTION_SYM)
- strcat (buffer, " section-sym");
-
- if (flags & BSF_OLD_COMMON)
- strcat (buffer, " old-common");
-
- if (flags & BSF_NOT_AT_END)
- strcat (buffer, " not-at-end");
-
- if (flags & BSF_CONSTRUCTOR)
- strcat (buffer, " constructor");
-
- if (flags & BSF_WARNING)
- strcat (buffer, " warning");
-
- if (flags & BSF_INDIRECT)
- strcat (buffer, " indirect");
-
- if (flags & BSF_FILE)
- strcat (buffer, " file");
-
- if (flags & DYNAMIC)
- strcat (buffer, " dynamic");
-
- if (flags & ~(BSF_LOCAL
- | BSF_GLOBAL
- | BSF_DEBUGGING
- | BSF_FUNCTION
- | BSF_KEEP
- | BSF_KEEP_G
- | BSF_WEAK
- | BSF_SECTION_SYM
- | BSF_OLD_COMMON
- | BSF_NOT_AT_END
- | BSF_CONSTRUCTOR
- | BSF_WARNING
- | BSF_INDIRECT
- | BSF_FILE
- | BSF_DYNAMIC))
- strcat (buffer, " unknown-bits");
-
- return buffer;
-}
-#endif
-
-/* Create a new BFD as if by bfd_openr. Rather than opening a file,
- reconstruct an ELF file by reading the segments out of remote memory
- based on the ELF file header at EHDR_VMA and the ELF program headers it
- points to. If not null, *LOADBASEP is filled in with the difference
- between the VMAs from which the segments were read, and the VMAs the
- file headers (and hence BFD's idea of each section's VMA) put them at.
-
- The function TARGET_READ_MEMORY is called to copy LEN bytes from the
- remote memory at target address VMA into the local buffer at MYADDR; it
- should return zero on success or an `errno' code on failure. TEMPL must
- be a BFD for a target with the word size and byte order found in the
- remote memory. */
-
-bfd *
-NAME(_bfd_elf,bfd_from_remote_memory)
- (bfd *templ,
- bfd_vma ehdr_vma,
- bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma, char *, int))
-{
- Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
- Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
- Elf_External_Phdr *x_phdrs;
- Elf_Internal_Phdr *i_phdrs, *last_phdr;
- bfd *nbfd;
- struct bfd_in_memory *bim;
- int contents_size;
- char *contents;
- int err;
- unsigned int i;
- bfd_vma loadbase;
-
- /* Read in the ELF header in external format. */
- err = target_read_memory (ehdr_vma, (char *) &x_ehdr, sizeof x_ehdr);
- if (err)
- {
- bfd_set_error (bfd_error_system_call);
- errno = err;
- return NULL;
- }
-
- /* Now check to see if we have a valid ELF file, and one that BFD can
- make use of. The magic number must match, the address size ('class')
- and byte-swapping must match our XVEC entry. */
-
- if (! elf_file_p (&x_ehdr)
- || x_ehdr.e_ident[EI_VERSION] != EV_CURRENT
- || x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Check that file's byte order matches xvec's */
- switch (x_ehdr.e_ident[EI_DATA])
- {
- case ELFDATA2MSB: /* Big-endian */
- if (! bfd_header_big_endian (templ))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- break;
- case ELFDATA2LSB: /* Little-endian */
- if (! bfd_header_little_endian (templ))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- break;
- case ELFDATANONE: /* No data encoding specified */
- default: /* Unknown data encoding specified */
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- elf_swap_ehdr_in (templ, &x_ehdr, &i_ehdr);
-
- /* The file header tells where to find the program headers.
- These are what we use to actually choose what to read. */
-
- if (i_ehdr.e_phentsize != sizeof (Elf_External_Phdr) || i_ehdr.e_phnum == 0)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- x_phdrs = bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
- if (x_phdrs == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
- err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (char *) x_phdrs,
- i_ehdr.e_phnum * sizeof x_phdrs[0]);
- if (err)
- {
- free (x_phdrs);
- bfd_set_error (bfd_error_system_call);
- errno = err;
- return NULL;
- }
- i_phdrs = (Elf_Internal_Phdr *) &x_phdrs[i_ehdr.e_phnum];
-
- contents_size = 0;
- last_phdr = NULL;
- loadbase = ehdr_vma;
- for (i = 0; i < i_ehdr.e_phnum; ++i)
- {
- elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]);
- if (i_phdrs[i].p_type == PT_LOAD)
- {
- bfd_vma segment_end;
- segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
- + i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align;
- if (segment_end > (bfd_vma) contents_size)
- contents_size = segment_end;
-
- if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0)
- loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align);
-
- last_phdr = &i_phdrs[i];
- }
- }
- if (last_phdr == NULL)
- {
- /* There were no PT_LOAD segments, so we don't have anything to read. */
- free (x_phdrs);
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Trim the last segment so we don't bother with zeros in the last page
- that are off the end of the file. However, if the extra bit in that
- page includes the section headers, keep them. */
- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
- && (bfd_vma) contents_size >= (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- {
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
- }
- else
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
-
- /* Now we know the size of the whole image we want read in. */
- contents = bfd_zmalloc (contents_size);
- if (contents == NULL)
- {
- free (x_phdrs);
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
-
- for (i = 0; i < i_ehdr.e_phnum; ++i)
- if (i_phdrs[i].p_type == PT_LOAD)
- {
- bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align;
- bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
- + i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align;
- if (end > (bfd_vma) contents_size)
- end = contents_size;
- err = target_read_memory ((loadbase + i_phdrs[i].p_vaddr)
- & -i_phdrs[i].p_align,
- contents + start, end - start);
- if (err)
- {
- free (x_phdrs);
- free (contents);
- bfd_set_error (bfd_error_system_call);
- errno = err;
- return NULL;
- }
- }
- free (x_phdrs);
-
- /* If the segments visible in memory didn't include the section headers,
- then clear them from the file header. */
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- {
- memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff);
- memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum);
- memset (&x_ehdr.e_shstrndx, 0, sizeof x_ehdr.e_shstrndx);
- }
-
- /* This will normally have been in the first PT_LOAD segment. But it
- conceivably could be missing, and we might have just changed it. */
- memcpy (contents, &x_ehdr, sizeof x_ehdr);
-
- /* Now we have a memory image of the ELF file contents. Make a BFD. */
- bim = bfd_malloc (sizeof (struct bfd_in_memory));
- if (bim == NULL)
- {
- free (contents);
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
- {
- free (bim);
- free (contents);
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
- nbfd->filename = "<in-memory>";
- nbfd->xvec = templ->xvec;
- bim->size = contents_size;
- bim->buffer = contents;
- nbfd->iostream = bim;
- nbfd->flags = BFD_IN_MEMORY;
- nbfd->direction = read_direction;
- nbfd->mtime = time (NULL);
- nbfd->mtime_set = TRUE;
-
- if (loadbasep)
- *loadbasep = loadbase;
- return nbfd;
-}
-
-#include "elfcore.h"
-
-/* Size-dependent data and functions. */
-const struct elf_size_info NAME(_bfd_elf,size_info) = {
- sizeof (Elf_External_Ehdr),
- sizeof (Elf_External_Phdr),
- sizeof (Elf_External_Shdr),
- sizeof (Elf_External_Rel),
- sizeof (Elf_External_Rela),
- sizeof (Elf_External_Sym),
- sizeof (Elf_External_Dyn),
- sizeof (Elf_External_Note),
- 4,
- 1,
- ARCH_SIZE, LOG_FILE_ALIGN,
- ELFCLASS, EV_CURRENT,
- elf_write_out_phdrs,
- elf_write_shdrs_and_ehdr,
- elf_write_relocs,
- elf_swap_symbol_in,
- elf_swap_symbol_out,
- elf_slurp_reloc_table,
- elf_slurp_symbol_table,
- elf_swap_dyn_in,
- elf_swap_dyn_out,
- elf_swap_reloc_in,
- elf_swap_reloc_out,
- elf_swap_reloca_in,
- elf_swap_reloca_out
-};
diff --git a/contrib/binutils/bfd/elfcore.h b/contrib/binutils/bfd/elfcore.h
deleted file mode 100644
index 81c4cff..0000000
--- a/contrib/binutils/bfd/elfcore.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/* ELF core file support for BFD.
- Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-char*
-elf_core_file_failing_command (bfd *abfd)
-{
- return elf_tdata (abfd)->core_command;
-}
-
-int
-elf_core_file_failing_signal (bfd *abfd)
-{
- return elf_tdata (abfd)->core_signal;
-}
-
-bfd_boolean
-elf_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
-{
- char* corename;
-
- /* xvecs must match if both are ELF files for the same target. */
-
- if (core_bfd->xvec != exec_bfd->xvec)
- {
- bfd_set_error (bfd_error_system_call);
- return FALSE;
- }
-
- /* See if the name in the corefile matches the executable name. */
- corename = elf_tdata (core_bfd)->core_program;
- if (corename != NULL)
- {
- const char* execname = strrchr (exec_bfd->filename, '/');
-
- execname = execname ? execname + 1 : exec_bfd->filename;
-
- if (strcmp (execname, corename) != 0)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Core files are simply standard ELF formatted files that partition
- the file using the execution view of the file (program header table)
- rather than the linking view. In fact, there is no section header
- table in a core file.
-
- The process status information (including the contents of the general
- register set) and the floating point register set are stored in a
- segment of type PT_NOTE. We handcraft a couple of extra bfd sections
- that allow standard bfd access to the general registers (.reg) and the
- floating point registers (.reg2). */
-
-const bfd_target *
-elf_core_file_p (bfd *abfd)
-{
- Elf_External_Ehdr x_ehdr; /* Elf file header, external form. */
- Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form. */
- Elf_Internal_Phdr *i_phdrp; /* Elf program header, internal form. */
- unsigned int phindex;
- const struct elf_backend_data *ebd;
- struct bfd_preserve preserve;
- bfd_size_type amt;
-
- preserve.marker = NULL;
-
- /* Read in the ELF header in external format. */
- if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
- {
- if (bfd_get_error () != bfd_error_system_call)
- goto wrong;
- else
- goto fail;
- }
-
- /* Check the magic number. */
- if (! elf_file_p (&x_ehdr))
- goto wrong;
-
- /* FIXME: Check EI_VERSION here ! */
-
- /* Check the address size ("class"). */
- if (x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
- goto wrong;
-
- /* Check the byteorder. */
- switch (x_ehdr.e_ident[EI_DATA])
- {
- case ELFDATA2MSB: /* Big-endian. */
- if (! bfd_big_endian (abfd))
- goto wrong;
- break;
- case ELFDATA2LSB: /* Little-endian. */
- if (! bfd_little_endian (abfd))
- goto wrong;
- break;
- default:
- goto wrong;
- }
-
- if (!bfd_preserve_save (abfd, &preserve))
- goto fail;
-
- /* Give abfd an elf_obj_tdata. */
- if (! (*abfd->xvec->_bfd_set_format[bfd_core]) (abfd))
- goto fail;
- preserve.marker = elf_tdata (abfd);
-
- /* Swap in the rest of the header, now that we have the byte order. */
- i_ehdrp = elf_elfheader (abfd);
- elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
-
-#if DEBUG & 1
- elf_debug_file (i_ehdrp);
-#endif
-
- ebd = get_elf_backend_data (abfd);
-
- /* Check that the ELF e_machine field matches what this particular
- BFD format expects. */
-
- if (ebd->elf_machine_code != i_ehdrp->e_machine
- && (ebd->elf_machine_alt1 == 0
- || i_ehdrp->e_machine != ebd->elf_machine_alt1)
- && (ebd->elf_machine_alt2 == 0
- || i_ehdrp->e_machine != ebd->elf_machine_alt2))
- {
- const bfd_target * const *target_ptr;
-
- if (ebd->elf_machine_code != EM_NONE)
- goto wrong;
-
- /* This is the generic ELF target. Let it match any ELF target
- for which we do not have a specific backend. */
-
- for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
- {
- const struct elf_backend_data *back;
-
- if ((*target_ptr)->flavour != bfd_target_elf_flavour)
- continue;
- back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
- if (back->elf_machine_code == i_ehdrp->e_machine
- || (back->elf_machine_alt1 != 0
- && i_ehdrp->e_machine == back->elf_machine_alt1)
- || (back->elf_machine_alt2 != 0
- && i_ehdrp->e_machine == back->elf_machine_alt2))
- {
- /* target_ptr is an ELF backend which matches this
- object file, so reject the generic ELF target. */
- goto wrong;
- }
- }
- }
-
- /* If there is no program header, or the type is not a core file, then
- we are hosed. */
- if (i_ehdrp->e_phoff == 0 || i_ehdrp->e_type != ET_CORE)
- goto wrong;
-
- /* Does BFD's idea of the phdr size match the size
- recorded in the file? */
- if (i_ehdrp->e_phentsize != sizeof (Elf_External_Phdr))
- goto wrong;
-
- /* Move to the start of the program headers. */
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
- goto wrong;
-
- /* Allocate space for the program headers. */
- amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
- i_phdrp = bfd_alloc (abfd, amt);
- if (!i_phdrp)
- goto fail;
-
- elf_tdata (abfd)->phdr = i_phdrp;
-
- /* Read and convert to internal form. */
- for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
- {
- Elf_External_Phdr x_phdr;
-
- if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
- goto fail;
-
- elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
- }
-
- /* Set the machine architecture. Do this before processing the
- program headers since we need to know the architecture type
- when processing the notes of some systems' core files. */
- if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
- {
- /* It's OK if this fails for the generic target. */
- if (ebd->elf_machine_code != EM_NONE)
- goto fail;
- }
-
- /* Process each program header. */
- for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
- if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
- goto fail;
-
- /* Save the entry point from the ELF header. */
- bfd_get_start_address (abfd) = i_ehdrp->e_entry;
-
- /* Let the backend double check the format and override global
- information. */
- if (ebd->elf_backend_object_p
- && (! (*ebd->elf_backend_object_p) (abfd)))
- goto wrong;
-
- bfd_preserve_finish (abfd, &preserve);
- return abfd->xvec;
-
-wrong:
- /* There is way too much undoing of half-known state here. The caller,
- bfd_check_format_matches, really shouldn't iterate on live bfd's to
- check match/no-match like it does. We have to rely on that a call to
- bfd_default_set_arch_mach with the previously known mach, undoes what
- was done by the first bfd_default_set_arch_mach (with mach 0) here.
- For this to work, only elf-data and the mach may be changed by the
- target-specific elf_backend_object_p function. Note that saving the
- whole bfd here and restoring it would be even worse; the first thing
- you notice is that the cached bfd file position gets out of sync. */
- bfd_set_error (bfd_error_wrong_format);
-
-fail:
- if (preserve.marker != NULL)
- bfd_preserve_restore (abfd, &preserve);
- return NULL;
-}
diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c
deleted file mode 100644
index 6628db3..0000000
--- a/contrib/binutils/bfd/elflink.c
+++ /dev/null
@@ -1,8908 +0,0 @@
-/* ELF linking support for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#define ARCH_SIZE 0
-#include "elf-bfd.h"
-#include "safe-ctype.h"
-#include "libiberty.h"
-
-bfd_boolean
-_bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
-{
- flagword flags;
- asection *s;
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- int ptralign;
-
- /* This function may be called more than once. */
- s = bfd_get_section_by_name (abfd, ".got");
- if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0)
- return TRUE;
-
- switch (bed->s->arch_size)
- {
- case 32:
- ptralign = 2;
- break;
-
- case 64:
- ptralign = 3;
- break;
-
- default:
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
-
- s = bfd_make_section (abfd, ".got");
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, flags)
- || !bfd_set_section_alignment (abfd, s, ptralign))
- return FALSE;
-
- if (bed->want_got_plt)
- {
- s = bfd_make_section (abfd, ".got.plt");
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, flags)
- || !bfd_set_section_alignment (abfd, s, ptralign))
- return FALSE;
- }
-
- if (bed->want_got_sym)
- {
- /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
- (or .got.plt) section. We don't do this in the linker script
- because we don't want to define the symbol if we are not creating
- a global offset table. */
- bh = NULL;
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, NULL, FALSE, bed->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (! info->executable
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- elf_hash_table (info)->hgot = h;
- }
-
- /* The first bit of the global offset table is the header. */
- s->_raw_size += bed->got_header_size + bed->got_symbol_offset;
-
- return TRUE;
-}
-
-/* Create some sections which will be filled in with dynamic linking
- information. ABFD is an input file which requires dynamic sections
- to be created. The dynamic sections take up virtual memory space
- when the final executable is run, so we need to create them before
- addresses are assigned to the output sections. We work out the
- actual contents and size of these sections later. */
-
-bfd_boolean
-_bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
-{
- flagword flags;
- register asection *s;
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
- const struct elf_backend_data *bed;
-
- if (! is_elf_hash_table (info->hash))
- return FALSE;
-
- if (elf_hash_table (info)->dynamic_sections_created)
- return TRUE;
-
- /* Make sure that all dynamic sections use the same input BFD. */
- if (elf_hash_table (info)->dynobj == NULL)
- elf_hash_table (info)->dynobj = abfd;
- else
- abfd = elf_hash_table (info)->dynobj;
-
- /* Note that we set the SEC_IN_MEMORY flag for all of these
- sections. */
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-
- /* A dynamically linked executable has a .interp section, but a
- shared library does not. */
- if (info->executable)
- {
- s = bfd_make_section (abfd, ".interp");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
- return FALSE;
- }
-
- if (! info->traditional_format)
- {
- s = bfd_make_section (abfd, ".eh_frame_hdr");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
- elf_hash_table (info)->eh_info.hdr_sec = s;
- }
-
- bed = get_elf_backend_data (abfd);
-
- /* Create sections to hold version informations. These are removed
- if they are not needed. */
- s = bfd_make_section (abfd, ".gnu.version_d");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
-
- s = bfd_make_section (abfd, ".gnu.version");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 1))
- return FALSE;
-
- s = bfd_make_section (abfd, ".gnu.version_r");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
-
- s = bfd_make_section (abfd, ".dynsym");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
-
- s = bfd_make_section (abfd, ".dynstr");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
- return FALSE;
-
- /* Create a strtab to hold the dynamic symbol names. */
- if (elf_hash_table (info)->dynstr == NULL)
- {
- elf_hash_table (info)->dynstr = _bfd_elf_strtab_init ();
- if (elf_hash_table (info)->dynstr == NULL)
- return FALSE;
- }
-
- s = bfd_make_section (abfd, ".dynamic");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
-
- /* The special symbol _DYNAMIC is always set to the start of the
- .dynamic section. This call occurs before we have processed the
- symbols for any dynamic object, so we don't have to worry about
- overriding a dynamic definition. We could set _DYNAMIC in a
- linker script, but we only want to define it if we are, in fact,
- creating a .dynamic section. We don't want to define it if there
- is no .dynamic section, since on some ELF platforms the start up
- code examines it to decide how to initialize the process. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, 0, NULL, FALSE,
- get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (! info->executable
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- s = bfd_make_section (abfd, ".hash");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
- elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
-
- /* Let the backend create the rest of the sections. This lets the
- backend set the right flags. The backend will normally create
- the .got and .plt sections. */
- if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
- return FALSE;
-
- elf_hash_table (info)->dynamic_sections_created = TRUE;
-
- return TRUE;
-}
-
-/* Create dynamic sections when linking against a dynamic object. */
-
-bfd_boolean
-_bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
-{
- flagword flags, pltflags;
- asection *s;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
- .rel[a].bss sections. */
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
-
- pltflags = flags;
- pltflags |= SEC_CODE;
- if (bed->plt_not_loaded)
- pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
- if (bed->plt_readonly)
- pltflags |= SEC_READONLY;
-
- s = bfd_make_section (abfd, ".plt");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, pltflags)
- || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
- return FALSE;
-
- if (bed->want_plt_sym)
- {
- /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
- .plt section. */
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh = NULL;
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, 0, NULL,
- FALSE, get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (! info->executable
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- s = bfd_make_section (abfd,
- bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
-
- if (! _bfd_elf_create_got_section (abfd, info))
- return FALSE;
-
- if (bed->want_dynbss)
- {
- /* The .dynbss section is a place to put symbols which are defined
- by dynamic objects, are referenced by regular objects, and are
- not functions. We must allocate space for them in the process
- image and use a R_*_COPY reloc to tell the dynamic linker to
- initialize them at run time. The linker script puts the .dynbss
- section into the .bss section of the final image. */
- s = bfd_make_section (abfd, ".dynbss");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED))
- return FALSE;
-
- /* The .rel[a].bss section holds copy relocs. This section is not
- normally needed. We need to create it here, though, so that the
- linker will map it to an output section. We can't just create it
- only if we need it, because we will not know whether we need it
- until we have seen all the input files, and the first time the
- main linker code calls BFD after examining all the input files
- (size_dynamic_sections) the input sections have already been
- mapped to the output sections. If the section turns out not to
- be needed, we can discard it later. We will never need this
- section when generating a shared object, since they do not use
- copy relocs. */
- if (! info->shared)
- {
- s = bfd_make_section (abfd,
- (bed->default_use_rela_p
- ? ".rela.bss" : ".rel.bss"));
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Record a new dynamic symbol. We record the dynamic symbols as we
- read the input files, since we need to have a list of all of them
- before we can determine the final sizes of the output sections.
- Note that we may actually call this function even though we are not
- going to output any dynamic symbols; in some cases we know that a
- symbol should be in the dynamic symbol table, but only if there is
- one. */
-
-bfd_boolean
-bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
-{
- if (h->dynindx == -1)
- {
- struct elf_strtab_hash *dynstr;
- char *p;
- const char *name;
- bfd_size_type indx;
-
- /* XXX: The ABI draft says the linker must turn hidden and
- internal symbols into STB_LOCAL symbols when producing the
- DSO. However, if ld.so honors st_other in the dynamic table,
- this would not be necessary. */
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- if (h->root.type != bfd_link_hash_undefined
- && h->root.type != bfd_link_hash_undefweak)
- {
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- return TRUE;
- }
-
- default:
- break;
- }
-
- h->dynindx = elf_hash_table (info)->dynsymcount;
- ++elf_hash_table (info)->dynsymcount;
-
- dynstr = elf_hash_table (info)->dynstr;
- if (dynstr == NULL)
- {
- /* Create a strtab to hold the dynamic symbol names. */
- elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
- if (dynstr == NULL)
- return FALSE;
- }
-
- /* We don't put any version information in the dynamic string
- table. */
- name = h->root.root.string;
- p = strchr (name, ELF_VER_CHR);
- if (p != NULL)
- /* We know that the p points into writable memory. In fact,
- there are only a few symbols that have read-only names, being
- those like _GLOBAL_OFFSET_TABLE_ that are created specially
- by the backends. Most symbols will have names pointing into
- an ELF string table read from a file, or to objalloc memory. */
- *p = 0;
-
- indx = _bfd_elf_strtab_add (dynstr, name, p != NULL);
-
- if (p != NULL)
- *p = ELF_VER_CHR;
-
- if (indx == (bfd_size_type) -1)
- return FALSE;
- h->dynstr_index = indx;
- }
-
- return TRUE;
-}
-
-/* Record an assignment to a symbol made by a linker script. We need
- this in case some dynamic object refers to this symbol. */
-
-bfd_boolean
-bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info,
- const char *name,
- bfd_boolean provide)
-{
- struct elf_link_hash_entry *h;
-
- if (!is_elf_hash_table (info->hash))
- return TRUE;
-
- h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE);
- if (h == NULL)
- return FALSE;
-
- /* Since we're defining the symbol, don't let it seem to have not
- been defined. record_dynamic_symbol and size_dynamic_sections
- may depend on this. */
- if (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)
- h->root.type = bfd_link_hash_new;
-
- if (h->root.type == bfd_link_hash_new)
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
-
- /* If this symbol is being provided by the linker script, and it is
- currently defined by a dynamic object, but not by a regular
- object, then mark it as undefined so that the generic linker will
- force the correct value. */
- if (provide
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- h->root.type = bfd_link_hash_undefined;
-
- /* If this symbol is not being provided by the linker script, and it is
- currently defined by a dynamic object, but not by a regular object,
- then clear out any version information because the symbol will not be
- associated with the dynamic object any more. */
- if (!provide
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- h->verinfo.verdef = NULL;
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
-
- if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_REF_DYNAMIC)) != 0
- || info->shared)
- && h->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- /* If this is a weak defined symbol, and we know a corresponding
- real symbol from the same dynamic object, make sure the real
- symbol is also made into a dynamic symbol. */
- if (h->weakdef != NULL
- && h->weakdef->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Record a new local dynamic symbol. Returns 0 on failure, 1 on
- success, and 2 on a failure caused by attempting to record a symbol
- in a discarded section, eg. a discarded link-once section symbol. */
-
-int
-bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *info,
- bfd *input_bfd,
- long input_indx)
-{
- bfd_size_type amt;
- struct elf_link_local_dynamic_entry *entry;
- struct elf_link_hash_table *eht;
- struct elf_strtab_hash *dynstr;
- unsigned long dynstr_index;
- char *name;
- Elf_External_Sym_Shndx eshndx;
- char esym[sizeof (Elf64_External_Sym)];
-
- if (! is_elf_hash_table (info->hash))
- return 0;
-
- /* See if the entry exists already. */
- for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next)
- if (entry->input_bfd == input_bfd && entry->input_indx == input_indx)
- return 1;
-
- amt = sizeof (*entry);
- entry = bfd_alloc (input_bfd, amt);
- if (entry == NULL)
- return 0;
-
- /* Go find the symbol, so that we can find it's name. */
- if (!bfd_elf_get_elf_syms (input_bfd, &elf_tdata (input_bfd)->symtab_hdr,
- 1, input_indx, &entry->isym, esym, &eshndx))
- {
- bfd_release (input_bfd, entry);
- return 0;
- }
-
- if (entry->isym.st_shndx != SHN_UNDEF
- && (entry->isym.st_shndx < SHN_LORESERVE
- || entry->isym.st_shndx > SHN_HIRESERVE))
- {
- asection *s;
-
- s = bfd_section_from_elf_index (input_bfd, entry->isym.st_shndx);
- if (s == NULL || bfd_is_abs_section (s->output_section))
- {
- /* We can still bfd_release here as nothing has done another
- bfd_alloc. We can't do this later in this function. */
- bfd_release (input_bfd, entry);
- return 2;
- }
- }
-
- name = (bfd_elf_string_from_elf_section
- (input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link,
- entry->isym.st_name));
-
- dynstr = elf_hash_table (info)->dynstr;
- if (dynstr == NULL)
- {
- /* Create a strtab to hold the dynamic symbol names. */
- elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
- if (dynstr == NULL)
- return 0;
- }
-
- dynstr_index = _bfd_elf_strtab_add (dynstr, name, FALSE);
- if (dynstr_index == (unsigned long) -1)
- return 0;
- entry->isym.st_name = dynstr_index;
-
- eht = elf_hash_table (info);
-
- entry->next = eht->dynlocal;
- eht->dynlocal = entry;
- entry->input_bfd = input_bfd;
- entry->input_indx = input_indx;
- eht->dynsymcount++;
-
- /* Whatever binding the symbol had before, it's now local. */
- entry->isym.st_info
- = ELF_ST_INFO (STB_LOCAL, ELF_ST_TYPE (entry->isym.st_info));
-
- /* The dynindx will be set at the end of size_dynamic_sections. */
-
- return 1;
-}
-
-/* Return the dynindex of a local dynamic symbol. */
-
-long
-_bfd_elf_link_lookup_local_dynindx (struct bfd_link_info *info,
- bfd *input_bfd,
- long input_indx)
-{
- struct elf_link_local_dynamic_entry *e;
-
- for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
- if (e->input_bfd == input_bfd && e->input_indx == input_indx)
- return e->dynindx;
- return -1;
-}
-
-/* This function is used to renumber the dynamic symbols, if some of
- them are removed because they are marked as local. This is called
- via elf_link_hash_traverse. */
-
-static bfd_boolean
-elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
- void *data)
-{
- size_t *count = data;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx != -1)
- h->dynindx = ++(*count);
-
- return TRUE;
-}
-
-/* Assign dynsym indices. In a shared library we generate a section
- symbol for each output section, which come first. Next come all of
- the back-end allocated local dynamic syms, followed by the rest of
- the global symbols. */
-
-unsigned long
-_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
-{
- unsigned long dynsymcount = 0;
-
- if (info->shared)
- {
- asection *p;
- for (p = output_bfd->sections; p ; p = p->next)
- if ((p->flags & SEC_EXCLUDE) == 0)
- elf_section_data (p)->dynindx = ++dynsymcount;
- }
-
- if (elf_hash_table (info)->dynlocal)
- {
- struct elf_link_local_dynamic_entry *p;
- for (p = elf_hash_table (info)->dynlocal; p ; p = p->next)
- p->dynindx = ++dynsymcount;
- }
-
- elf_link_hash_traverse (elf_hash_table (info),
- elf_link_renumber_hash_table_dynsyms,
- &dynsymcount);
-
- /* There is an unused NULL entry at the head of the table which
- we must account for in our count. Unless there weren't any
- symbols, which means we'll have no table at all. */
- if (dynsymcount != 0)
- ++dynsymcount;
-
- return elf_hash_table (info)->dynsymcount = dynsymcount;
-}
-
-/* This function is called when we want to define a new symbol. It
- handles the various cases which arise when we find a definition in
- a dynamic object, or when there is already a definition in a
- dynamic object. The new symbol is described by NAME, SYM, PSEC,
- and PVALUE. We set SYM_HASH to the hash table entry. We set
- OVERRIDE if the old symbol is overriding a new definition. We set
- TYPE_CHANGE_OK if it is OK for the type to change. We set
- SIZE_CHANGE_OK if it is OK for the size to change. By OK to
- change, we mean that we shouldn't warn if the type or size does
- change. */
-
-bfd_boolean
-_bfd_elf_merge_symbol (bfd *abfd,
- struct bfd_link_info *info,
- const char *name,
- Elf_Internal_Sym *sym,
- asection **psec,
- bfd_vma *pvalue,
- struct elf_link_hash_entry **sym_hash,
- bfd_boolean *skip,
- bfd_boolean *override,
- bfd_boolean *type_change_ok,
- bfd_boolean *size_change_ok)
-{
- asection *sec;
- struct elf_link_hash_entry *h;
- struct elf_link_hash_entry *flip;
- int bind;
- bfd *oldbfd;
- bfd_boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon;
- bfd_boolean newweak, oldweak;
-
- *skip = FALSE;
- *override = FALSE;
-
- sec = *psec;
- bind = ELF_ST_BIND (sym->st_info);
-
- if (! bfd_is_und_section (sec))
- h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
- else
- h = ((struct elf_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, FALSE, FALSE));
- if (h == NULL)
- return FALSE;
- *sym_hash = h;
-
- /* This code is for coping with dynamic objects, and is only useful
- if we are doing an ELF link. */
- if (info->hash->creator != abfd->xvec)
- return TRUE;
-
- /* For merging, we only care about real symbols. */
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* If we just created the symbol, mark it as being an ELF symbol.
- Other than that, there is nothing to do--there is no merge issue
- with a newly defined symbol--so we just return. */
-
- if (h->root.type == bfd_link_hash_new)
- {
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
- return TRUE;
- }
-
- /* OLDBFD is a BFD associated with the existing symbol. */
-
- switch (h->root.type)
- {
- default:
- oldbfd = NULL;
- break;
-
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- oldbfd = h->root.u.undef.abfd;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- oldbfd = h->root.u.def.section->owner;
- break;
-
- case bfd_link_hash_common:
- oldbfd = h->root.u.c.p->section->owner;
- break;
- }
-
- /* In cases involving weak versioned symbols, we may wind up trying
- to merge a symbol with itself. Catch that here, to avoid the
- confusion that results if we try to override a symbol with
- itself. The additional tests catch cases like
- _GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a
- dynamic object, which we do want to handle here. */
- if (abfd == oldbfd
- && ((abfd->flags & DYNAMIC) == 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
- return TRUE;
-
- /* NEWDYN and OLDDYN indicate whether the new or old symbol,
- respectively, is from a dynamic object. */
-
- if ((abfd->flags & DYNAMIC) != 0)
- newdyn = TRUE;
- else
- newdyn = FALSE;
-
- if (oldbfd != NULL)
- olddyn = (oldbfd->flags & DYNAMIC) != 0;
- else
- {
- asection *hsec;
-
- /* This code handles the special SHN_MIPS_{TEXT,DATA} section
- indices used by MIPS ELF. */
- switch (h->root.type)
- {
- default:
- hsec = NULL;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- hsec = h->root.u.def.section;
- break;
-
- case bfd_link_hash_common:
- hsec = h->root.u.c.p->section;
- break;
- }
-
- if (hsec == NULL)
- olddyn = FALSE;
- else
- olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0;
- }
-
- /* NEWDEF and OLDDEF indicate whether the new or old symbol,
- respectively, appear to be a definition rather than reference. */
-
- if (bfd_is_und_section (sec) || bfd_is_com_section (sec))
- newdef = FALSE;
- else
- newdef = TRUE;
-
- if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_common)
- olddef = FALSE;
- else
- olddef = TRUE;
-
- /* We need to remember if a symbol has a definition in a dynamic
- object or is weak in all dynamic objects. Internal and hidden
- visibility will make it unavailable to dynamic objects. */
- if (newdyn && (h->elf_link_hash_flags & ELF_LINK_DYNAMIC_DEF) == 0)
- {
- if (!bfd_is_und_section (sec))
- h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_DEF;
- else
- {
- /* Check if this symbol is weak in all dynamic objects. If it
- is the first time we see it in a dynamic object, we mark
- if it is weak. Otherwise, we clear it. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
- {
- if (bind == STB_WEAK)
- h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_WEAK;
- }
- else if (bind != STB_WEAK)
- h->elf_link_hash_flags &= ~ELF_LINK_DYNAMIC_WEAK;
- }
- }
-
- /* If the old symbol has non-default visibility, we ignore the new
- definition from a dynamic object. */
- if (newdyn
- && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && !bfd_is_und_section (sec))
- {
- *skip = TRUE;
- /* Make sure this symbol is dynamic. */
- h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
- /* A protected symbol has external availability. Make sure it is
- recorded as dynamic.
-
- FIXME: Should we check type and size for protected symbol? */
- if (ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
- return bfd_elf_link_record_dynamic_symbol (info, h);
- else
- return TRUE;
- }
- else if (!newdyn
- && ELF_ST_VISIBILITY (sym->st_other) != STV_DEFAULT
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
- {
- /* If the new symbol with non-default visibility comes from a
- relocatable file and the old definition comes from a dynamic
- object, we remove the old definition. */
- if ((*sym_hash)->root.type == bfd_link_hash_indirect)
- h = *sym_hash;
-
- if ((h->root.und_next || info->hash->undefs_tail == &h->root)
- && bfd_is_und_section (sec))
- {
- /* If the new symbol is undefined and the old symbol was
- also undefined before, we need to make sure
- _bfd_generic_link_add_one_symbol doesn't mess
- up the linker hash table undefs list. Since the old
- definition came from a dynamic object, it is still on the
- undefs list. */
- h->root.type = bfd_link_hash_undefined;
- /* FIXME: What if the new symbol is weak undefined? */
- h->root.u.undef.abfd = abfd;
- }
- else
- {
- h->root.type = bfd_link_hash_new;
- h->root.u.undef.abfd = NULL;
- }
-
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
- h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_DYNAMIC_DEF);
- }
- /* FIXME: Should we check type and size for protected symbol? */
- h->size = 0;
- h->type = 0;
- return TRUE;
- }
-
- /* Differentiate strong and weak symbols. */
- newweak = bind == STB_WEAK;
- oldweak = (h->root.type == bfd_link_hash_defweak
- || h->root.type == bfd_link_hash_undefweak);
-
- /* If a new weak symbol definition comes from a regular file and the
- old symbol comes from a dynamic library, we treat the new one as
- strong. Similarly, an old weak symbol definition from a regular
- file is treated as strong when the new symbol comes from a dynamic
- library. Further, an old weak symbol from a dynamic library is
- treated as strong if the new symbol is from a dynamic library.
- This reflects the way glibc's ld.so works.
-
- Do this before setting *type_change_ok or *size_change_ok so that
- we warn properly when dynamic library symbols are overridden. */
-
- if (newdef && !newdyn && olddyn)
- newweak = FALSE;
- if (olddef && newdyn)
- oldweak = FALSE;
-
- /* It's OK to change the type if either the existing symbol or the
- new symbol is weak. A type change is also OK if the old symbol
- is undefined and the new symbol is defined. */
-
- if (oldweak
- || newweak
- || (newdef
- && h->root.type == bfd_link_hash_undefined))
- *type_change_ok = TRUE;
-
- /* It's OK to change the size if either the existing symbol or the
- new symbol is weak, or if the old symbol is undefined. */
-
- if (*type_change_ok
- || h->root.type == bfd_link_hash_undefined)
- *size_change_ok = TRUE;
-
- /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old
- symbol, respectively, appears to be a common symbol in a dynamic
- object. If a symbol appears in an uninitialized section, and is
- not weak, and is not a function, then it may be a common symbol
- which was resolved when the dynamic object was created. We want
- to treat such symbols specially, because they raise special
- considerations when setting the symbol size: if the symbol
- appears as a common symbol in a regular object, and the size in
- the regular object is larger, we must make sure that we use the
- larger size. This problematic case can always be avoided in C,
- but it must be handled correctly when using Fortran shared
- libraries.
-
- Note that if NEWDYNCOMMON is set, NEWDEF will be set, and
- likewise for OLDDYNCOMMON and OLDDEF.
-
- Note that this test is just a heuristic, and that it is quite
- possible to have an uninitialized symbol in a shared object which
- is really a definition, rather than a common symbol. This could
- lead to some minor confusion when the symbol really is a common
- symbol in some regular object. However, I think it will be
- harmless. */
-
- if (newdyn
- && newdef
- && !newweak
- && (sec->flags & SEC_ALLOC) != 0
- && (sec->flags & SEC_LOAD) == 0
- && sym->st_size > 0
- && ELF_ST_TYPE (sym->st_info) != STT_FUNC)
- newdyncommon = TRUE;
- else
- newdyncommon = FALSE;
-
- if (olddyn
- && olddef
- && h->root.type == bfd_link_hash_defined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->root.u.def.section->flags & SEC_ALLOC) != 0
- && (h->root.u.def.section->flags & SEC_LOAD) == 0
- && h->size > 0
- && h->type != STT_FUNC)
- olddyncommon = TRUE;
- else
- olddyncommon = FALSE;
-
- /* If both the old and the new symbols look like common symbols in a
- dynamic object, set the size of the symbol to the larger of the
- two. */
-
- if (olddyncommon
- && newdyncommon
- && sym->st_size != h->size)
- {
- /* Since we think we have two common symbols, issue a multiple
- common warning if desired. Note that we only warn if the
- size is different. If the size is the same, we simply let
- the old symbol override the new one as normally happens with
- symbols defined in dynamic objects. */
-
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.root.string, oldbfd, bfd_link_hash_common,
- h->size, abfd, bfd_link_hash_common, sym->st_size)))
- return FALSE;
-
- if (sym->st_size > h->size)
- h->size = sym->st_size;
-
- *size_change_ok = TRUE;
- }
-
- /* If we are looking at a dynamic object, and we have found a
- definition, we need to see if the symbol was already defined by
- some other object. If so, we want to use the existing
- definition, and we do not want to report a multiple symbol
- definition error; we do this by clobbering *PSEC to be
- bfd_und_section_ptr.
-
- We treat a common symbol as a definition if the symbol in the
- shared library is a function, since common symbols always
- represent variables; this can cause confusion in principle, but
- any such confusion would seem to indicate an erroneous program or
- shared library. We also permit a common symbol in a regular
- object to override a weak symbol in a shared object. */
-
- if (newdyn
- && newdef
- && (olddef
- || (h->root.type == bfd_link_hash_common
- && (newweak
- || ELF_ST_TYPE (sym->st_info) == STT_FUNC))))
- {
- *override = TRUE;
- newdef = FALSE;
- newdyncommon = FALSE;
-
- *psec = sec = bfd_und_section_ptr;
- *size_change_ok = TRUE;
-
- /* If we get here when the old symbol is a common symbol, then
- we are explicitly letting it override a weak symbol or
- function in a dynamic object, and we don't want to warn about
- a type change. If the old symbol is a defined symbol, a type
- change warning may still be appropriate. */
-
- if (h->root.type == bfd_link_hash_common)
- *type_change_ok = TRUE;
- }
-
- /* Handle the special case of an old common symbol merging with a
- new symbol which looks like a common symbol in a shared object.
- We change *PSEC and *PVALUE to make the new symbol look like a
- common symbol, and let _bfd_generic_link_add_one_symbol will do
- the right thing. */
-
- if (newdyncommon
- && h->root.type == bfd_link_hash_common)
- {
- *override = TRUE;
- newdef = FALSE;
- newdyncommon = FALSE;
- *pvalue = sym->st_size;
- *psec = sec = bfd_com_section_ptr;
- *size_change_ok = TRUE;
- }
-
- /* If the old symbol is from a dynamic object, and the new symbol is
- a definition which is not from a dynamic object, then the new
- symbol overrides the old symbol. Symbols from regular files
- always take precedence over symbols from dynamic objects, even if
- they are defined after the dynamic object in the link.
-
- As above, we again permit a common symbol in a regular object to
- override a definition in a shared object if the shared object
- symbol is a function or is weak. */
-
- flip = NULL;
- if (! newdyn
- && (newdef
- || (bfd_is_com_section (sec)
- && (oldweak
- || h->type == STT_FUNC)))
- && olddyn
- && olddef
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
- {
- /* Change the hash table entry to undefined, and let
- _bfd_generic_link_add_one_symbol do the right thing with the
- new definition. */
-
- h->root.type = bfd_link_hash_undefined;
- h->root.u.undef.abfd = h->root.u.def.section->owner;
- *size_change_ok = TRUE;
-
- olddef = FALSE;
- olddyncommon = FALSE;
-
- /* We again permit a type change when a common symbol may be
- overriding a function. */
-
- if (bfd_is_com_section (sec))
- *type_change_ok = TRUE;
-
- if ((*sym_hash)->root.type == bfd_link_hash_indirect)
- flip = *sym_hash;
- else
- /* This union may have been set to be non-NULL when this symbol
- was seen in a dynamic object. We must force the union to be
- NULL, so that it is correct for a regular symbol. */
- h->verinfo.vertree = NULL;
- }
-
- /* Handle the special case of a new common symbol merging with an
- old symbol that looks like it might be a common symbol defined in
- a shared object. Note that we have already handled the case in
- which a new common symbol should simply override the definition
- in the shared library. */
-
- if (! newdyn
- && bfd_is_com_section (sec)
- && olddyncommon)
- {
- /* It would be best if we could set the hash table entry to a
- common symbol, but we don't know what to use for the section
- or the alignment. */
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.root.string, oldbfd, bfd_link_hash_common,
- h->size, abfd, bfd_link_hash_common, sym->st_size)))
- return FALSE;
-
- /* If the presumed common symbol in the dynamic object is
- larger, pretend that the new symbol has its size. */
-
- if (h->size > *pvalue)
- *pvalue = h->size;
-
- /* FIXME: We no longer know the alignment required by the symbol
- in the dynamic object, so we just wind up using the one from
- the regular object. */
-
- olddef = FALSE;
- olddyncommon = FALSE;
-
- h->root.type = bfd_link_hash_undefined;
- h->root.u.undef.abfd = h->root.u.def.section->owner;
-
- *size_change_ok = TRUE;
- *type_change_ok = TRUE;
-
- if ((*sym_hash)->root.type == bfd_link_hash_indirect)
- flip = *sym_hash;
- else
- h->verinfo.vertree = NULL;
- }
-
- if (flip != NULL)
- {
- /* Handle the case where we had a versioned symbol in a dynamic
- library and now find a definition in a normal object. In this
- case, we make the versioned symbol point to the normal one. */
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- flip->root.type = h->root.type;
- h->root.type = bfd_link_hash_indirect;
- h->root.u.i.link = (struct bfd_link_hash_entry *) flip;
- (*bed->elf_backend_copy_indirect_symbol) (bed, flip, h);
- flip->root.u.undef.abfd = h->root.u.undef.abfd;
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
- {
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
- flip->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
- }
- }
-
- return TRUE;
-}
-
-/* This function is called to create an indirect symbol from the
- default for the symbol with the default version if needed. The
- symbol is described by H, NAME, SYM, PSEC, VALUE, and OVERRIDE. We
- set DYNSYM if the new indirect symbol is dynamic. */
-
-bfd_boolean
-_bfd_elf_add_default_symbol (bfd *abfd,
- struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- const char *name,
- Elf_Internal_Sym *sym,
- asection **psec,
- bfd_vma *value,
- bfd_boolean *dynsym,
- bfd_boolean override)
-{
- bfd_boolean type_change_ok;
- bfd_boolean size_change_ok;
- bfd_boolean skip;
- char *shortname;
- struct elf_link_hash_entry *hi;
- struct bfd_link_hash_entry *bh;
- const struct elf_backend_data *bed;
- bfd_boolean collect;
- bfd_boolean dynamic;
- char *p;
- size_t len, shortlen;
- asection *sec;
-
- /* If this symbol has a version, and it is the default version, we
- create an indirect symbol from the default name to the fully
- decorated name. This will cause external references which do not
- specify a version to be bound to this version of the symbol. */
- p = strchr (name, ELF_VER_CHR);
- if (p == NULL || p[1] != ELF_VER_CHR)
- return TRUE;
-
- if (override)
- {
- /* We are overridden by an old definition. We need to check if we
- need to create the indirect symbol from the default name. */
- hi = elf_link_hash_lookup (elf_hash_table (info), name, TRUE,
- FALSE, FALSE);
- BFD_ASSERT (hi != NULL);
- if (hi == h)
- return TRUE;
- while (hi->root.type == bfd_link_hash_indirect
- || hi->root.type == bfd_link_hash_warning)
- {
- hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
- if (hi == h)
- return TRUE;
- }
- }
-
- bed = get_elf_backend_data (abfd);
- collect = bed->collect;
- dynamic = (abfd->flags & DYNAMIC) != 0;
-
- shortlen = p - name;
- shortname = bfd_hash_allocate (&info->hash->table, shortlen + 1);
- if (shortname == NULL)
- return FALSE;
- memcpy (shortname, name, shortlen);
- shortname[shortlen] = '\0';
-
- /* We are going to create a new symbol. Merge it with any existing
- symbol with this name. For the purposes of the merge, act as
- though we were defining the symbol we just defined, although we
- actually going to define an indirect symbol. */
- type_change_ok = FALSE;
- size_change_ok = FALSE;
- sec = *psec;
- if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
- &hi, &skip, &override, &type_change_ok,
- &size_change_ok))
- return FALSE;
-
- if (skip)
- goto nondefault;
-
- if (! override)
- {
- bh = &hi->root;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
- 0, name, FALSE, collect, &bh)))
- return FALSE;
- hi = (struct elf_link_hash_entry *) bh;
- }
- else
- {
- /* In this case the symbol named SHORTNAME is overriding the
- indirect symbol we want to add. We were planning on making
- SHORTNAME an indirect symbol referring to NAME. SHORTNAME
- is the name without a version. NAME is the fully versioned
- name, and it is the default version.
-
- Overriding means that we already saw a definition for the
- symbol SHORTNAME in a regular object, and it is overriding
- the symbol defined in the dynamic object.
-
- When this happens, we actually want to change NAME, the
- symbol we just added, to refer to SHORTNAME. This will cause
- references to NAME in the shared object to become references
- to SHORTNAME in the regular object. This is what we expect
- when we override a function in a shared object: that the
- references in the shared object will be mapped to the
- definition in the regular object. */
-
- while (hi->root.type == bfd_link_hash_indirect
- || hi->root.type == bfd_link_hash_warning)
- hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
-
- h->root.type = bfd_link_hash_indirect;
- h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
- {
- h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC;
- hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
- if (hi->elf_link_hash_flags
- & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR))
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, hi))
- return FALSE;
- }
- }
-
- /* Now set HI to H, so that the following code will set the
- other fields correctly. */
- hi = h;
- }
-
- /* If there is a duplicate definition somewhere, then HI may not
- point to an indirect symbol. We will have reported an error to
- the user in that case. */
-
- if (hi->root.type == bfd_link_hash_indirect)
- {
- struct elf_link_hash_entry *ht;
-
- ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
- (*bed->elf_backend_copy_indirect_symbol) (bed, ht, hi);
-
- /* See if the new flags lead us to realize that the symbol must
- be dynamic. */
- if (! *dynsym)
- {
- if (! dynamic)
- {
- if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC) != 0))
- *dynsym = TRUE;
- }
- else
- {
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- *dynsym = TRUE;
- }
- }
- }
-
- /* We also need to define an indirection from the nondefault version
- of the symbol. */
-
-nondefault:
- len = strlen (name);
- shortname = bfd_hash_allocate (&info->hash->table, len);
- if (shortname == NULL)
- return FALSE;
- memcpy (shortname, name, shortlen);
- memcpy (shortname + shortlen, p + 1, len - shortlen);
-
- /* Once again, merge with any existing symbol. */
- type_change_ok = FALSE;
- size_change_ok = FALSE;
- sec = *psec;
- if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
- &hi, &skip, &override, &type_change_ok,
- &size_change_ok))
- return FALSE;
-
- if (skip)
- return TRUE;
-
- if (override)
- {
- /* Here SHORTNAME is a versioned name, so we don't expect to see
- the type of override we do in the case above unless it is
- overridden by a versioned definition. */
- if (hi->root.type != bfd_link_hash_defined
- && hi->root.type != bfd_link_hash_defweak)
- (*_bfd_error_handler)
- (_("%s: warning: unexpected redefinition of indirect versioned symbol `%s'"),
- bfd_archive_filename (abfd), shortname);
- }
- else
- {
- bh = &hi->root;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, shortname, BSF_INDIRECT,
- bfd_ind_section_ptr, 0, name, FALSE, collect, &bh)))
- return FALSE;
- hi = (struct elf_link_hash_entry *) bh;
-
- /* If there is a duplicate definition somewhere, then HI may not
- point to an indirect symbol. We will have reported an error
- to the user in that case. */
-
- if (hi->root.type == bfd_link_hash_indirect)
- {
- (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
-
- /* See if the new flags lead us to realize that the symbol
- must be dynamic. */
- if (! *dynsym)
- {
- if (! dynamic)
- {
- if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC) != 0))
- *dynsym = TRUE;
- }
- else
- {
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- *dynsym = TRUE;
- }
- }
- }
- }
-
- return TRUE;
-}
-
-/* This routine is used to export all defined symbols into the dynamic
- symbol table. It is called via elf_link_hash_traverse. */
-
-bfd_boolean
-_bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
-{
- struct elf_info_failed *eif = data;
-
- /* Ignore indirect symbols. These are added by the versioning code. */
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx == -1
- && (h->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0)
- {
- struct bfd_elf_version_tree *t;
- struct bfd_elf_version_expr *d;
-
- for (t = eif->verdefs; t != NULL; t = t->next)
- {
- if (t->globals.list != NULL)
- {
- d = (*t->match) (&t->globals, NULL, h->root.root.string);
- if (d != NULL)
- goto doit;
- }
-
- if (t->locals.list != NULL)
- {
- d = (*t->match) (&t->locals, NULL, h->root.root.string);
- if (d != NULL)
- return TRUE;
- }
- }
-
- if (!eif->verdefs)
- {
- doit:
- if (! bfd_elf_link_record_dynamic_symbol (eif->info, h))
- {
- eif->failed = TRUE;
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Look through the symbols which are defined in other shared
- libraries and referenced here. Update the list of version
- dependencies. This will be put into the .gnu.version_r section.
- This function is called via elf_link_hash_traverse. */
-
-bfd_boolean
-_bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
- void *data)
-{
- struct elf_find_verdep_info *rinfo = data;
- Elf_Internal_Verneed *t;
- Elf_Internal_Vernaux *a;
- bfd_size_type amt;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* We only care about symbols defined in shared objects with version
- information. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- || h->dynindx == -1
- || h->verinfo.verdef == NULL)
- return TRUE;
-
- /* See if we already know about this version. */
- for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref)
- {
- if (t->vn_bfd != h->verinfo.verdef->vd_bfd)
- continue;
-
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- if (a->vna_nodename == h->verinfo.verdef->vd_nodename)
- return TRUE;
-
- break;
- }
-
- /* This is a new version. Add it to tree we are building. */
-
- if (t == NULL)
- {
- amt = sizeof *t;
- t = bfd_zalloc (rinfo->output_bfd, amt);
- if (t == NULL)
- {
- rinfo->failed = TRUE;
- return FALSE;
- }
-
- t->vn_bfd = h->verinfo.verdef->vd_bfd;
- t->vn_nextref = elf_tdata (rinfo->output_bfd)->verref;
- elf_tdata (rinfo->output_bfd)->verref = t;
- }
-
- amt = sizeof *a;
- a = bfd_zalloc (rinfo->output_bfd, amt);
-
- /* Note that we are copying a string pointer here, and testing it
- above. If bfd_elf_string_from_elf_section is ever changed to
- discard the string data when low in memory, this will have to be
- fixed. */
- a->vna_nodename = h->verinfo.verdef->vd_nodename;
-
- a->vna_flags = h->verinfo.verdef->vd_flags;
- a->vna_nextptr = t->vn_auxptr;
-
- h->verinfo.verdef->vd_exp_refno = rinfo->vers;
- ++rinfo->vers;
-
- a->vna_other = h->verinfo.verdef->vd_exp_refno + 1;
-
- t->vn_auxptr = a;
-
- return TRUE;
-}
-
-/* Figure out appropriate versions for all the symbols. We may not
- have the version number script until we have read all of the input
- files, so until that point we don't know which symbols should be
- local. This function is called via elf_link_hash_traverse. */
-
-bfd_boolean
-_bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
-{
- struct elf_assign_sym_version_info *sinfo;
- struct bfd_link_info *info;
- const struct elf_backend_data *bed;
- struct elf_info_failed eif;
- char *p;
- bfd_size_type amt;
-
- sinfo = data;
- info = sinfo->info;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Fix the symbol flags. */
- eif.failed = FALSE;
- eif.info = info;
- if (! _bfd_elf_fix_symbol_flags (h, &eif))
- {
- if (eif.failed)
- sinfo->failed = TRUE;
- return FALSE;
- }
-
- /* We only need version numbers for symbols defined in regular
- objects. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- return TRUE;
-
- bed = get_elf_backend_data (sinfo->output_bfd);
- p = strchr (h->root.root.string, ELF_VER_CHR);
- if (p != NULL && h->verinfo.vertree == NULL)
- {
- struct bfd_elf_version_tree *t;
- bfd_boolean hidden;
-
- hidden = TRUE;
-
- /* There are two consecutive ELF_VER_CHR characters if this is
- not a hidden symbol. */
- ++p;
- if (*p == ELF_VER_CHR)
- {
- hidden = FALSE;
- ++p;
- }
-
- /* If there is no version string, we can just return out. */
- if (*p == '\0')
- {
- if (hidden)
- h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
- return TRUE;
- }
-
- /* Look for the version. If we find it, it is no longer weak. */
- for (t = sinfo->verdefs; t != NULL; t = t->next)
- {
- if (strcmp (t->name, p) == 0)
- {
- size_t len;
- char *alc;
- struct bfd_elf_version_expr *d;
-
- len = p - h->root.root.string;
- alc = bfd_malloc (len);
- if (alc == NULL)
- return FALSE;
- memcpy (alc, h->root.root.string, len - 1);
- alc[len - 1] = '\0';
- if (alc[len - 2] == ELF_VER_CHR)
- alc[len - 2] = '\0';
-
- h->verinfo.vertree = t;
- t->used = TRUE;
- d = NULL;
-
- if (t->globals.list != NULL)
- d = (*t->match) (&t->globals, NULL, alc);
-
- /* See if there is anything to force this symbol to
- local scope. */
- if (d == NULL && t->locals.list != NULL)
- {
- d = (*t->match) (&t->locals, NULL, alc);
- if (d != NULL
- && h->dynindx != -1
- && info->shared
- && ! info->export_dynamic)
- (*bed->elf_backend_hide_symbol) (info, h, TRUE);
- }
-
- free (alc);
- break;
- }
- }
-
- /* If we are building an application, we need to create a
- version node for this version. */
- if (t == NULL && info->executable)
- {
- struct bfd_elf_version_tree **pp;
- int version_index;
-
- /* If we aren't going to export this symbol, we don't need
- to worry about it. */
- if (h->dynindx == -1)
- return TRUE;
-
- amt = sizeof *t;
- t = bfd_zalloc (sinfo->output_bfd, amt);
- if (t == NULL)
- {
- sinfo->failed = TRUE;
- return FALSE;
- }
-
- t->name = p;
- t->name_indx = (unsigned int) -1;
- t->used = TRUE;
-
- version_index = 1;
- /* Don't count anonymous version tag. */
- if (sinfo->verdefs != NULL && sinfo->verdefs->vernum == 0)
- version_index = 0;
- for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next)
- ++version_index;
- t->vernum = version_index;
-
- *pp = t;
-
- h->verinfo.vertree = t;
- }
- else if (t == NULL)
- {
- /* We could not find the version for a symbol when
- generating a shared archive. Return an error. */
- (*_bfd_error_handler)
- (_("%s: undefined versioned symbol name %s"),
- bfd_get_filename (sinfo->output_bfd), h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- sinfo->failed = TRUE;
- return FALSE;
- }
-
- if (hidden)
- h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
- }
-
- /* If we don't have a version for this symbol, see if we can find
- something. */
- if (h->verinfo.vertree == NULL && sinfo->verdefs != NULL)
- {
- struct bfd_elf_version_tree *t;
- struct bfd_elf_version_tree *local_ver;
- struct bfd_elf_version_expr *d;
-
- /* See if can find what version this symbol is in. If the
- symbol is supposed to be local, then don't actually register
- it. */
- local_ver = NULL;
- for (t = sinfo->verdefs; t != NULL; t = t->next)
- {
- if (t->globals.list != NULL)
- {
- bfd_boolean matched;
-
- matched = FALSE;
- d = NULL;
- while ((d = (*t->match) (&t->globals, d,
- h->root.root.string)) != NULL)
- if (d->symver)
- matched = TRUE;
- else
- {
- /* There is a version without definition. Make
- the symbol the default definition for this
- version. */
- h->verinfo.vertree = t;
- local_ver = NULL;
- d->script = 1;
- break;
- }
- if (d != NULL)
- break;
- else if (matched)
- /* There is no undefined version for this symbol. Hide the
- default one. */
- (*bed->elf_backend_hide_symbol) (info, h, TRUE);
- }
-
- if (t->locals.list != NULL)
- {
- d = NULL;
- while ((d = (*t->match) (&t->locals, d,
- h->root.root.string)) != NULL)
- {
- local_ver = t;
- /* If the match is "*", keep looking for a more
- explicit, perhaps even global, match.
- XXX: Shouldn't this be !d->wildcard instead? */
- if (d->pattern[0] != '*' || d->pattern[1] != '\0')
- break;
- }
-
- if (d != NULL)
- break;
- }
- }
-
- if (local_ver != NULL)
- {
- h->verinfo.vertree = local_ver;
- if (h->dynindx != -1
- && info->shared
- && ! info->export_dynamic)
- {
- (*bed->elf_backend_hide_symbol) (info, h, TRUE);
- }
- }
- }
-
- return TRUE;
-}
-
-/* Read and swap the relocs from the section indicated by SHDR. This
- may be either a REL or a RELA section. The relocations are
- translated into RELA relocations and stored in INTERNAL_RELOCS,
- which should have already been allocated to contain enough space.
- The EXTERNAL_RELOCS are a buffer where the external form of the
- relocations should be stored.
-
- Returns FALSE if something goes wrong. */
-
-static bfd_boolean
-elf_link_read_relocs_from_section (bfd *abfd,
- asection *sec,
- Elf_Internal_Shdr *shdr,
- void *external_relocs,
- Elf_Internal_Rela *internal_relocs)
-{
- const struct elf_backend_data *bed;
- void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
- const bfd_byte *erela;
- const bfd_byte *erelaend;
- Elf_Internal_Rela *irela;
- Elf_Internal_Shdr *symtab_hdr;
- size_t nsyms;
-
- /* Position ourselves at the start of the section. */
- if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0)
- return FALSE;
-
- /* Read the relocations. */
- if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
- return FALSE;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- nsyms = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
-
- bed = get_elf_backend_data (abfd);
-
- /* Convert the external relocations to the internal format. */
- if (shdr->sh_entsize == bed->s->sizeof_rel)
- swap_in = bed->s->swap_reloc_in;
- else if (shdr->sh_entsize == bed->s->sizeof_rela)
- swap_in = bed->s->swap_reloca_in;
- else
- {
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- erela = external_relocs;
- erelaend = erela + shdr->sh_size;
- irela = internal_relocs;
- while (erela < erelaend)
- {
- bfd_vma r_symndx;
-
- (*swap_in) (abfd, erela, irela);
- r_symndx = ELF32_R_SYM (irela->r_info);
- if (bed->s->arch_size == 64)
- r_symndx >>= 24;
- if ((size_t) r_symndx >= nsyms)
- {
- (*_bfd_error_handler)
- (_("%s: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%s'"),
- bfd_archive_filename (abfd), (unsigned long) r_symndx,
- (unsigned long) nsyms, irela->r_offset, sec->name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- irela += bed->s->int_rels_per_ext_rel;
- erela += shdr->sh_entsize;
- }
-
- return TRUE;
-}
-
-/* Read and swap the relocs for a section O. They may have been
- cached. If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are
- not NULL, they are used as buffers to read into. They are known to
- be large enough. If the INTERNAL_RELOCS relocs argument is NULL,
- the return value is allocated using either malloc or bfd_alloc,
- according to the KEEP_MEMORY argument. If O has two relocation
- sections (both REL and RELA relocations), then the REL_HDR
- relocations will appear first in INTERNAL_RELOCS, followed by the
- REL_HDR2 relocations. */
-
-Elf_Internal_Rela *
-_bfd_elf_link_read_relocs (bfd *abfd,
- asection *o,
- void *external_relocs,
- Elf_Internal_Rela *internal_relocs,
- bfd_boolean keep_memory)
-{
- Elf_Internal_Shdr *rel_hdr;
- void *alloc1 = NULL;
- Elf_Internal_Rela *alloc2 = NULL;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- if (elf_section_data (o)->relocs != NULL)
- return elf_section_data (o)->relocs;
-
- if (o->reloc_count == 0)
- return NULL;
-
- rel_hdr = &elf_section_data (o)->rel_hdr;
-
- if (internal_relocs == NULL)
- {
- bfd_size_type size;
-
- size = o->reloc_count;
- size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
- if (keep_memory)
- internal_relocs = bfd_alloc (abfd, size);
- else
- internal_relocs = alloc2 = bfd_malloc (size);
- if (internal_relocs == NULL)
- goto error_return;
- }
-
- if (external_relocs == NULL)
- {
- bfd_size_type size = rel_hdr->sh_size;
-
- if (elf_section_data (o)->rel_hdr2)
- size += elf_section_data (o)->rel_hdr2->sh_size;
- alloc1 = bfd_malloc (size);
- if (alloc1 == NULL)
- goto error_return;
- external_relocs = alloc1;
- }
-
- if (!elf_link_read_relocs_from_section (abfd, o, rel_hdr,
- external_relocs,
- internal_relocs))
- goto error_return;
- if (elf_section_data (o)->rel_hdr2
- && (!elf_link_read_relocs_from_section
- (abfd, o,
- elf_section_data (o)->rel_hdr2,
- ((bfd_byte *) external_relocs) + rel_hdr->sh_size,
- internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr)
- * bed->s->int_rels_per_ext_rel))))
- goto error_return;
-
- /* Cache the results for next time, if we can. */
- if (keep_memory)
- elf_section_data (o)->relocs = internal_relocs;
-
- if (alloc1 != NULL)
- free (alloc1);
-
- /* Don't free alloc2, since if it was allocated we are passing it
- back (under the name of internal_relocs). */
-
- return internal_relocs;
-
- error_return:
- if (alloc1 != NULL)
- free (alloc1);
- if (alloc2 != NULL)
- free (alloc2);
- return NULL;
-}
-
-/* Compute the size of, and allocate space for, REL_HDR which is the
- section header for a section containing relocations for O. */
-
-bfd_boolean
-_bfd_elf_link_size_reloc_section (bfd *abfd,
- Elf_Internal_Shdr *rel_hdr,
- asection *o)
-{
- bfd_size_type reloc_count;
- bfd_size_type num_rel_hashes;
-
- /* Figure out how many relocations there will be. */
- if (rel_hdr == &elf_section_data (o)->rel_hdr)
- reloc_count = elf_section_data (o)->rel_count;
- else
- reloc_count = elf_section_data (o)->rel_count2;
-
- num_rel_hashes = o->reloc_count;
- if (num_rel_hashes < reloc_count)
- num_rel_hashes = reloc_count;
-
- /* That allows us to calculate the size of the section. */
- rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
-
- /* The contents field must last into write_object_contents, so we
- allocate it with bfd_alloc rather than malloc. Also since we
- cannot be sure that the contents will actually be filled in,
- we zero the allocated space. */
- rel_hdr->contents = bfd_zalloc (abfd, rel_hdr->sh_size);
- if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
- return FALSE;
-
- /* We only allocate one set of hash entries, so we only do it the
- first time we are called. */
- if (elf_section_data (o)->rel_hashes == NULL
- && num_rel_hashes)
- {
- struct elf_link_hash_entry **p;
-
- p = bfd_zmalloc (num_rel_hashes * sizeof (struct elf_link_hash_entry *));
- if (p == NULL)
- return FALSE;
-
- elf_section_data (o)->rel_hashes = p;
- }
-
- return TRUE;
-}
-
-/* Copy the relocations indicated by the INTERNAL_RELOCS (which
- originated from the section given by INPUT_REL_HDR) to the
- OUTPUT_BFD. */
-
-bfd_boolean
-_bfd_elf_link_output_relocs (bfd *output_bfd,
- asection *input_section,
- Elf_Internal_Shdr *input_rel_hdr,
- Elf_Internal_Rela *internal_relocs)
-{
- Elf_Internal_Rela *irela;
- Elf_Internal_Rela *irelaend;
- bfd_byte *erel;
- Elf_Internal_Shdr *output_rel_hdr;
- asection *output_section;
- unsigned int *rel_countp = NULL;
- const struct elf_backend_data *bed;
- void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-
- output_section = input_section->output_section;
- output_rel_hdr = NULL;
-
- if (elf_section_data (output_section)->rel_hdr.sh_entsize
- == input_rel_hdr->sh_entsize)
- {
- output_rel_hdr = &elf_section_data (output_section)->rel_hdr;
- rel_countp = &elf_section_data (output_section)->rel_count;
- }
- else if (elf_section_data (output_section)->rel_hdr2
- && (elf_section_data (output_section)->rel_hdr2->sh_entsize
- == input_rel_hdr->sh_entsize))
- {
- output_rel_hdr = elf_section_data (output_section)->rel_hdr2;
- rel_countp = &elf_section_data (output_section)->rel_count2;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: relocation size mismatch in %s section %s"),
- bfd_get_filename (output_bfd),
- bfd_archive_filename (input_section->owner),
- input_section->name);
- bfd_set_error (bfd_error_wrong_object_format);
- return FALSE;
- }
-
- bed = get_elf_backend_data (output_bfd);
- if (input_rel_hdr->sh_entsize == bed->s->sizeof_rel)
- swap_out = bed->s->swap_reloc_out;
- else if (input_rel_hdr->sh_entsize == bed->s->sizeof_rela)
- swap_out = bed->s->swap_reloca_out;
- else
- abort ();
-
- erel = output_rel_hdr->contents;
- erel += *rel_countp * input_rel_hdr->sh_entsize;
- irela = internal_relocs;
- irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
- * bed->s->int_rels_per_ext_rel);
- while (irela < irelaend)
- {
- (*swap_out) (output_bfd, irela, erel);
- irela += bed->s->int_rels_per_ext_rel;
- erel += input_rel_hdr->sh_entsize;
- }
-
- /* Bump the counter, so that we know where to add the next set of
- relocations. */
- *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr);
-
- return TRUE;
-}
-
-/* Fix up the flags for a symbol. This handles various cases which
- can only be fixed after all the input files are seen. This is
- currently called by both adjust_dynamic_symbol and
- assign_sym_version, which is unnecessary but perhaps more robust in
- the face of future changes. */
-
-bfd_boolean
-_bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
- struct elf_info_failed *eif)
-{
- /* If this symbol was mentioned in a non-ELF file, try to set
- DEF_REGULAR and REF_REGULAR correctly. This is the only way to
- permit a non-ELF file to correctly refer to a symbol defined in
- an ELF dynamic object. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) != 0)
- {
- while (h->root.type == bfd_link_hash_indirect)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK);
- else
- {
- if (h->root.u.def.section->owner != NULL
- && (bfd_get_flavour (h->root.u.def.section->owner)
- == bfd_target_elf_flavour))
- h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK);
- else
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- }
-
- if (h->dynindx == -1
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0))
- {
- if (! bfd_elf_link_record_dynamic_symbol (eif->info, h))
- {
- eif->failed = TRUE;
- return FALSE;
- }
- }
- }
- else
- {
- /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol
- was first seen in a non-ELF file. Fortunately, if the symbol
- was first seen in an ELF file, we're probably OK unless the
- symbol was defined in a non-ELF file. Catch that case here.
- FIXME: We're still in trouble if the symbol was first seen in
- a dynamic object, and then later in a non-ELF regular object. */
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->root.u.def.section->owner != NULL
- ? (bfd_get_flavour (h->root.u.def.section->owner)
- != bfd_target_elf_flavour)
- : (bfd_is_abs_section (h->root.u.def.section)
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) == 0)))
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- }
-
- /* If this is a final link, and the symbol was defined as a common
- symbol in a regular object file, and there was no definition in
- any dynamic object, then the linker will have allocated space for
- the symbol in a common section but the ELF_LINK_HASH_DEF_REGULAR
- flag will not have been set. */
- if (h->root.type == bfd_link_hash_defined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
-
- /* If -Bsymbolic was used (which means to bind references to global
- symbols to the definition within the shared object), and this
- symbol was defined in a regular object, then it actually doesn't
- need a PLT entry. Likewise, if the symbol has non-default
- visibility. If the symbol has hidden or internal visibility, we
- will force it local. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
- && eif->info->shared
- && is_elf_hash_table (eif->info->hash)
- && (eif->info->symbolic
- || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
- {
- const struct elf_backend_data *bed;
- bfd_boolean force_local;
-
- bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
-
- force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
- || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN);
- (*bed->elf_backend_hide_symbol) (eif->info, h, force_local);
- }
-
- /* If a weak undefined symbol has non-default visibility, we also
- hide it from the dynamic linker. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak)
- {
- const struct elf_backend_data *bed;
- bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
- (*bed->elf_backend_hide_symbol) (eif->info, h, TRUE);
- }
-
- /* If this is a weak defined symbol in a dynamic object, and we know
- the real definition in the dynamic object, copy interesting flags
- over to the real definition. */
- if (h->weakdef != NULL)
- {
- struct elf_link_hash_entry *weakdef;
-
- weakdef = h->weakdef;
- if (h->root.type == bfd_link_hash_indirect)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak);
- BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
- || weakdef->root.type == bfd_link_hash_defweak);
- BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC);
-
- /* If the real definition is defined by a regular object file,
- don't do anything special. See the longer description in
- _bfd_elf_adjust_dynamic_symbol, below. */
- if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
- h->weakdef = NULL;
- else
- {
- const struct elf_backend_data *bed;
-
- bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
- (*bed->elf_backend_copy_indirect_symbol) (bed, weakdef, h);
- }
- }
-
- return TRUE;
-}
-
-/* Make the backend pick a good value for a dynamic symbol. This is
- called via elf_link_hash_traverse, and also calls itself
- recursively. */
-
-bfd_boolean
-_bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
-{
- struct elf_info_failed *eif = data;
- bfd *dynobj;
- const struct elf_backend_data *bed;
-
- if (! is_elf_hash_table (eif->info->hash))
- return FALSE;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h->plt = elf_hash_table (eif->info)->init_offset;
- h->got = elf_hash_table (eif->info)->init_offset;
-
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- }
-
- /* Ignore indirect symbols. These are added by the versioning code. */
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- /* Fix the symbol flags. */
- if (! _bfd_elf_fix_symbol_flags (h, eif))
- return FALSE;
-
- /* If this symbol does not require a PLT entry, and it is not
- defined by a dynamic object, or is not referenced by a regular
- object, ignore it. We do have to handle a weak defined symbol,
- even if no regular object refers to it, if we decided to add it
- to the dynamic symbol table. FIXME: Do we normally need to worry
- about symbols which are defined by one dynamic object and
- referenced by another one? */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
- && (h->weakdef == NULL || h->weakdef->dynindx == -1))))
- {
- h->plt = elf_hash_table (eif->info)->init_offset;
- return TRUE;
- }
-
- /* If we've already adjusted this symbol, don't do it again. This
- can happen via a recursive call. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- return TRUE;
-
- /* Don't look at this symbol again. Note that we must set this
- after checking the above conditions, because we may look at a
- symbol once, decide not to do anything, and then get called
- recursively later after REF_REGULAR is set below. */
- h->elf_link_hash_flags |= ELF_LINK_HASH_DYNAMIC_ADJUSTED;
-
- /* If this is a weak definition, and we know a real definition, and
- the real symbol is not itself defined by a regular object file,
- then get a good value for the real definition. We handle the
- real symbol first, for the convenience of the backend routine.
-
- Note that there is a confusing case here. If the real definition
- is defined by a regular object file, we don't get the real symbol
- from the dynamic object, but we do get the weak symbol. If the
- processor backend uses a COPY reloc, then if some routine in the
- dynamic object changes the real symbol, we will not see that
- change in the corresponding weak symbol. This is the way other
- ELF linkers work as well, and seems to be a result of the shared
- library model.
-
- I will clarify this issue. Most SVR4 shared libraries define the
- variable _timezone and define timezone as a weak synonym. The
- tzset call changes _timezone. If you write
- extern int timezone;
- int _timezone = 5;
- int main () { tzset (); printf ("%d %d\n", timezone, _timezone); }
- you might expect that, since timezone is a synonym for _timezone,
- the same number will print both times. However, if the processor
- backend uses a COPY reloc, then actually timezone will be copied
- into your process image, and, since you define _timezone
- yourself, _timezone will not. Thus timezone and _timezone will
- wind up at different memory locations. The tzset call will set
- _timezone, leaving timezone unchanged. */
-
- if (h->weakdef != NULL)
- {
- /* If we get to this point, we know there is an implicit
- reference by a regular object file via the weak symbol H.
- FIXME: Is this really true? What if the traversal finds
- H->WEAKDEF before it finds H? */
- h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
-
- if (! _bfd_elf_adjust_dynamic_symbol (h->weakdef, eif))
- return FALSE;
- }
-
- /* If a symbol has no type and no size and does not require a PLT
- entry, then we are probably about to do the wrong thing here: we
- are probably going to create a COPY reloc for an empty object.
- This case can arise when a shared object is built with assembly
- code, and the assembly code fails to set the symbol type. */
- if (h->size == 0
- && h->type == STT_NOTYPE
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
- (*_bfd_error_handler)
- (_("warning: type and size of dynamic symbol `%s' are not defined"),
- h->root.root.string);
-
- dynobj = elf_hash_table (eif->info)->dynobj;
- bed = get_elf_backend_data (dynobj);
- if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h))
- {
- eif->failed = TRUE;
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Adjust all external symbols pointing into SEC_MERGE sections
- to reflect the object merging within the sections. */
-
-bfd_boolean
-_bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
-{
- asection *sec;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
- && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
- {
- bfd *output_bfd = data;
-
- h->root.u.def.value =
- _bfd_merged_section_offset (output_bfd,
- &h->root.u.def.section,
- elf_section_data (sec)->sec_info,
- h->root.u.def.value, 0);
- }
-
- return TRUE;
-}
-
-/* Returns false if the symbol referred to by H should be considered
- to resolve local to the current module, and true if it should be
- considered to bind dynamically. */
-
-bfd_boolean
-_bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
- struct bfd_link_info *info,
- bfd_boolean ignore_protected)
-{
- bfd_boolean binding_stays_local_p;
-
- if (h == NULL)
- return FALSE;
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* If it was forced local, then clearly it's not dynamic. */
- if (h->dynindx == -1)
- return FALSE;
- if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)
- return FALSE;
-
- /* Identify the cases where name binding rules say that a
- visible symbol resolves locally. */
- binding_stays_local_p = info->executable || info->symbolic;
-
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- return FALSE;
-
- case STV_PROTECTED:
- /* Proper resolution for function pointer equality may require
- that these symbols perhaps be resolved dynamically, even though
- we should be resolving them to the current module. */
- if (!ignore_protected)
- binding_stays_local_p = TRUE;
- break;
-
- default:
- break;
- }
-
- /* If it isn't defined locally, then clearly it's dynamic. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- return TRUE;
-
- /* Otherwise, the symbol is dynamic if binding rules don't tell
- us that it remains local. */
- return !binding_stays_local_p;
-}
-
-/* Return true if the symbol referred to by H should be considered
- to resolve local to the current module, and false otherwise. Differs
- from (the inverse of) _bfd_elf_dynamic_symbol_p in the treatment of
- undefined symbols and weak symbols. */
-
-bfd_boolean
-_bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
- struct bfd_link_info *info,
- bfd_boolean local_protected)
-{
- /* If it's a local sym, of course we resolve locally. */
- if (h == NULL)
- return TRUE;
-
- /* If we don't have a definition in a regular file, then we can't
- resolve locally. The sym is either undefined or dynamic. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- return FALSE;
-
- /* Forced local symbols resolve locally. */
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- return TRUE;
-
- /* As do non-dynamic symbols. */
- if (h->dynindx == -1)
- return TRUE;
-
- /* At this point, we know the symbol is defined and dynamic. In an
- executable it must resolve locally, likewise when building symbolic
- shared libraries. */
- if (info->executable || info->symbolic)
- return TRUE;
-
- /* Now deal with defined dynamic symbols in shared libraries. Ones
- with default visibility might not resolve locally. */
- if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- return FALSE;
-
- /* However, STV_HIDDEN or STV_INTERNAL ones must be local. */
- if (ELF_ST_VISIBILITY (h->other) != STV_PROTECTED)
- return TRUE;
-
- /* Function pointer equality tests may require that STV_PROTECTED
- symbols be treated as dynamic symbols, even when we know that the
- dynamic linker will resolve them locally. */
- return local_protected;
-}
-
-/* Caches some TLS segment info, and ensures that the TLS segment vma is
- aligned. Returns the first TLS output section. */
-
-struct bfd_section *
-_bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
-{
- struct bfd_section *sec, *tls;
- unsigned int align = 0;
-
- for (sec = obfd->sections; sec != NULL; sec = sec->next)
- if ((sec->flags & SEC_THREAD_LOCAL) != 0)
- break;
- tls = sec;
-
- for (; sec != NULL && (sec->flags & SEC_THREAD_LOCAL) != 0; sec = sec->next)
- if (sec->alignment_power > align)
- align = sec->alignment_power;
-
- elf_hash_table (info)->tls_sec = tls;
-
- /* Ensure the alignment of the first section is the largest alignment,
- so that the tls segment starts aligned. */
- if (tls != NULL)
- tls->alignment_power = align;
-
- return tls;
-}
-
-/* Return TRUE iff this is a non-common, definition of a non-function symbol. */
-static bfd_boolean
-is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
- Elf_Internal_Sym *sym)
-{
- /* Local symbols do not count, but target specific ones might. */
- if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL
- && ELF_ST_BIND (sym->st_info) < STB_LOOS)
- return FALSE;
-
- /* Function symbols do not count. */
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
- return FALSE;
-
- /* If the section is undefined, then so is the symbol. */
- if (sym->st_shndx == SHN_UNDEF)
- return FALSE;
-
- /* If the symbol is defined in the common section, then
- it is a common definition and so does not count. */
- if (sym->st_shndx == SHN_COMMON)
- return FALSE;
-
- /* If the symbol is in a target specific section then we
- must rely upon the backend to tell us what it is. */
- if (sym->st_shndx >= SHN_LORESERVE && sym->st_shndx < SHN_ABS)
- /* FIXME - this function is not coded yet:
-
- return _bfd_is_global_symbol_definition (abfd, sym);
-
- Instead for now assume that the definition is not global,
- Even if this is wrong, at least the linker will behave
- in the same way that it used to do. */
- return FALSE;
-
- return TRUE;
-}
-
-/* Search the symbol table of the archive element of the archive ABFD
- whose archive map contains a mention of SYMDEF, and determine if
- the symbol is defined in this element. */
-static bfd_boolean
-elf_link_is_defined_archive_symbol (bfd * abfd, carsym * symdef)
-{
- Elf_Internal_Shdr * hdr;
- bfd_size_type symcount;
- bfd_size_type extsymcount;
- bfd_size_type extsymoff;
- Elf_Internal_Sym *isymbuf;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- bfd_boolean result;
-
- abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
- if (abfd == NULL)
- return FALSE;
-
- if (! bfd_check_format (abfd, bfd_object))
- return FALSE;
-
- /* If we have already included the element containing this symbol in the
- link then we do not need to include it again. Just claim that any symbol
- it contains is not a definition, so that our caller will not decide to
- (re)include this element. */
- if (abfd->archive_pass)
- return FALSE;
-
- /* Select the appropriate symbol table. */
- if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
- hdr = &elf_tdata (abfd)->symtab_hdr;
- else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
-
- symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
-
- /* The sh_info field of the symtab header tells us where the
- external symbols start. We don't care about the local symbols. */
- if (elf_bad_symtab (abfd))
- {
- extsymcount = symcount;
- extsymoff = 0;
- }
- else
- {
- extsymcount = symcount - hdr->sh_info;
- extsymoff = hdr->sh_info;
- }
-
- if (extsymcount == 0)
- return FALSE;
-
- /* Read in the symbol table. */
- isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- return FALSE;
-
- /* Scan the symbol table looking for SYMDEF. */
- result = FALSE;
- for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; isym++)
- {
- const char *name;
-
- name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- isym->st_name);
- if (name == NULL)
- break;
-
- if (strcmp (name, symdef->name) == 0)
- {
- result = is_global_data_symbol_definition (abfd, isym);
- break;
- }
- }
-
- free (isymbuf);
-
- return result;
-}
-
-/* Add an entry to the .dynamic table. */
-
-bfd_boolean
-_bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
- bfd_vma tag,
- bfd_vma val)
-{
- struct elf_link_hash_table *hash_table;
- const struct elf_backend_data *bed;
- asection *s;
- bfd_size_type newsize;
- bfd_byte *newcontents;
- Elf_Internal_Dyn dyn;
-
- hash_table = elf_hash_table (info);
- if (! is_elf_hash_table (hash_table))
- return FALSE;
-
- bed = get_elf_backend_data (hash_table->dynobj);
- s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
- BFD_ASSERT (s != NULL);
-
- newsize = s->_raw_size + bed->s->sizeof_dyn;
- newcontents = bfd_realloc (s->contents, newsize);
- if (newcontents == NULL)
- return FALSE;
-
- dyn.d_tag = tag;
- dyn.d_un.d_val = val;
- bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->_raw_size);
-
- s->_raw_size = newsize;
- s->contents = newcontents;
-
- return TRUE;
-}
-
-/* Add a DT_NEEDED entry for this dynamic object if DO_IT is true,
- otherwise just check whether one already exists. Returns -1 on error,
- 1 if a DT_NEEDED tag already exists, and 0 on success. */
-
-static int
-elf_add_dt_needed_tag (struct bfd_link_info *info,
- const char *soname,
- bfd_boolean do_it)
-{
- struct elf_link_hash_table *hash_table;
- bfd_size_type oldsize;
- bfd_size_type strindex;
-
- hash_table = elf_hash_table (info);
- oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
- strindex = _bfd_elf_strtab_add (hash_table->dynstr, soname, FALSE);
- if (strindex == (bfd_size_type) -1)
- return -1;
-
- if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
- {
- asection *sdyn;
- const struct elf_backend_data *bed;
- bfd_byte *extdyn;
-
- bed = get_elf_backend_data (hash_table->dynobj);
- sdyn = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
- BFD_ASSERT (sdyn != NULL);
-
- for (extdyn = sdyn->contents;
- extdyn < sdyn->contents + sdyn->_raw_size;
- extdyn += bed->s->sizeof_dyn)
- {
- Elf_Internal_Dyn dyn;
-
- bed->s->swap_dyn_in (hash_table->dynobj, extdyn, &dyn);
- if (dyn.d_tag == DT_NEEDED
- && dyn.d_un.d_val == strindex)
- {
- _bfd_elf_strtab_delref (hash_table->dynstr, strindex);
- return 1;
- }
- }
- }
-
- if (do_it)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
- return -1;
- }
- else
- /* We were just checking for existence of the tag. */
- _bfd_elf_strtab_delref (hash_table->dynstr, strindex);
-
- return 0;
-}
-
-/* Sort symbol by value and section. */
-static int
-elf_sort_symbol (const void *arg1, const void *arg2)
-{
- const struct elf_link_hash_entry *h1;
- const struct elf_link_hash_entry *h2;
- bfd_signed_vma vdiff;
-
- h1 = *(const struct elf_link_hash_entry **) arg1;
- h2 = *(const struct elf_link_hash_entry **) arg2;
- vdiff = h1->root.u.def.value - h2->root.u.def.value;
- if (vdiff != 0)
- return vdiff > 0 ? 1 : -1;
- else
- {
- long sdiff = h1->root.u.def.section - h2->root.u.def.section;
- if (sdiff != 0)
- return sdiff > 0 ? 1 : -1;
- }
- return 0;
-}
-
-/* This function is used to adjust offsets into .dynstr for
- dynamic symbols. This is called via elf_link_hash_traverse. */
-
-static bfd_boolean
-elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
-{
- struct elf_strtab_hash *dynstr = data;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx != -1)
- h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
- return TRUE;
-}
-
-/* Assign string offsets in .dynstr, update all structures referencing
- them. */
-
-static bfd_boolean
-elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
-{
- struct elf_link_hash_table *hash_table = elf_hash_table (info);
- struct elf_link_local_dynamic_entry *entry;
- struct elf_strtab_hash *dynstr = hash_table->dynstr;
- bfd *dynobj = hash_table->dynobj;
- asection *sdyn;
- bfd_size_type size;
- const struct elf_backend_data *bed;
- bfd_byte *extdyn;
-
- _bfd_elf_strtab_finalize (dynstr);
- size = _bfd_elf_strtab_size (dynstr);
-
- bed = get_elf_backend_data (dynobj);
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (sdyn != NULL);
-
- /* Update all .dynamic entries referencing .dynstr strings. */
- for (extdyn = sdyn->contents;
- extdyn < sdyn->contents + sdyn->_raw_size;
- extdyn += bed->s->sizeof_dyn)
- {
- Elf_Internal_Dyn dyn;
-
- bed->s->swap_dyn_in (dynobj, extdyn, &dyn);
- switch (dyn.d_tag)
- {
- case DT_STRSZ:
- dyn.d_un.d_val = size;
- break;
- case DT_NEEDED:
- case DT_SONAME:
- case DT_RPATH:
- case DT_RUNPATH:
- case DT_FILTER:
- case DT_AUXILIARY:
- dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val);
- break;
- default:
- continue;
- }
- bed->s->swap_dyn_out (dynobj, &dyn, extdyn);
- }
-
- /* Now update local dynamic symbols. */
- for (entry = hash_table->dynlocal; entry ; entry = entry->next)
- entry->isym.st_name = _bfd_elf_strtab_offset (dynstr,
- entry->isym.st_name);
-
- /* And the rest of dynamic symbols. */
- elf_link_hash_traverse (hash_table, elf_adjust_dynstr_offsets, dynstr);
-
- /* Adjust version definitions. */
- if (elf_tdata (output_bfd)->cverdefs)
- {
- asection *s;
- bfd_byte *p;
- bfd_size_type i;
- Elf_Internal_Verdef def;
- Elf_Internal_Verdaux defaux;
-
- s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
- p = s->contents;
- do
- {
- _bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p,
- &def);
- p += sizeof (Elf_External_Verdef);
- for (i = 0; i < def.vd_cnt; ++i)
- {
- _bfd_elf_swap_verdaux_in (output_bfd,
- (Elf_External_Verdaux *) p, &defaux);
- defaux.vda_name = _bfd_elf_strtab_offset (dynstr,
- defaux.vda_name);
- _bfd_elf_swap_verdaux_out (output_bfd,
- &defaux, (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
- }
- }
- while (def.vd_next);
- }
-
- /* Adjust version references. */
- if (elf_tdata (output_bfd)->verref)
- {
- asection *s;
- bfd_byte *p;
- bfd_size_type i;
- Elf_Internal_Verneed need;
- Elf_Internal_Vernaux needaux;
-
- s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
- p = s->contents;
- do
- {
- _bfd_elf_swap_verneed_in (output_bfd, (Elf_External_Verneed *) p,
- &need);
- need.vn_file = _bfd_elf_strtab_offset (dynstr, need.vn_file);
- _bfd_elf_swap_verneed_out (output_bfd, &need,
- (Elf_External_Verneed *) p);
- p += sizeof (Elf_External_Verneed);
- for (i = 0; i < need.vn_cnt; ++i)
- {
- _bfd_elf_swap_vernaux_in (output_bfd,
- (Elf_External_Vernaux *) p, &needaux);
- needaux.vna_name = _bfd_elf_strtab_offset (dynstr,
- needaux.vna_name);
- _bfd_elf_swap_vernaux_out (output_bfd,
- &needaux,
- (Elf_External_Vernaux *) p);
- p += sizeof (Elf_External_Vernaux);
- }
- }
- while (need.vn_next);
- }
-
- return TRUE;
-}
-
-/* Add symbols from an ELF object file to the linker hash table. */
-
-static bfd_boolean
-elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
-{
- bfd_boolean (*add_symbol_hook)
- (bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
- const char **, flagword *, asection **, bfd_vma *);
- bfd_boolean (*check_relocs)
- (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
- bfd_boolean collect;
- Elf_Internal_Shdr *hdr;
- bfd_size_type symcount;
- bfd_size_type extsymcount;
- bfd_size_type extsymoff;
- struct elf_link_hash_entry **sym_hash;
- bfd_boolean dynamic;
- Elf_External_Versym *extversym = NULL;
- Elf_External_Versym *ever;
- struct elf_link_hash_entry *weaks;
- struct elf_link_hash_entry **nondeflt_vers = NULL;
- bfd_size_type nondeflt_vers_cnt = 0;
- Elf_Internal_Sym *isymbuf = NULL;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- const struct elf_backend_data *bed;
- bfd_boolean add_needed;
- struct elf_link_hash_table * hash_table;
- bfd_size_type amt;
-
- hash_table = elf_hash_table (info);
-
- bed = get_elf_backend_data (abfd);
- add_symbol_hook = bed->elf_add_symbol_hook;
- collect = bed->collect;
-
- if ((abfd->flags & DYNAMIC) == 0)
- dynamic = FALSE;
- else
- {
- dynamic = TRUE;
-
- /* You can't use -r against a dynamic object. Also, there's no
- hope of using a dynamic object which does not exactly match
- the format of the output file. */
- if (info->relocatable
- || !is_elf_hash_table (hash_table)
- || hash_table->root.creator != abfd->xvec)
- {
- bfd_set_error (bfd_error_invalid_operation);
- goto error_return;
- }
- }
-
- /* As a GNU extension, any input sections which are named
- .gnu.warning.SYMBOL are treated as warning symbols for the given
- symbol. This differs from .gnu.warning sections, which generate
- warnings when they are included in an output file. */
- if (info->executable)
- {
- asection *s;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- const char *name;
-
- name = bfd_get_section_name (abfd, s);
- if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0)
- {
- char *msg;
- bfd_size_type sz;
- bfd_size_type prefix_len;
- const char * gnu_warning_prefix = _("warning: ");
-
- name += sizeof ".gnu.warning." - 1;
-
- /* If this is a shared object, then look up the symbol
- in the hash table. If it is there, and it is already
- been defined, then we will not be using the entry
- from this shared object, so we don't need to warn.
- FIXME: If we see the definition in a regular object
- later on, we will warn, but we shouldn't. The only
- fix is to keep track of what warnings we are supposed
- to emit, and then handle them all at the end of the
- link. */
- if (dynamic)
- {
- struct elf_link_hash_entry *h;
-
- h = elf_link_hash_lookup (hash_table, name,
- FALSE, FALSE, TRUE);
-
- /* FIXME: What about bfd_link_hash_common? */
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- /* We don't want to issue this warning. Clobber
- the section size so that the warning does not
- get copied into the output file. */
- s->_raw_size = 0;
- continue;
- }
- }
-
- sz = bfd_section_size (abfd, s);
- prefix_len = strlen (gnu_warning_prefix);
- msg = bfd_alloc (abfd, prefix_len + sz + 1);
- if (msg == NULL)
- goto error_return;
-
- strcpy (msg, gnu_warning_prefix);
- if (! bfd_get_section_contents (abfd, s, msg + prefix_len, 0, sz))
- goto error_return;
-
- msg[prefix_len + sz] = '\0';
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, BSF_WARNING, s, 0, msg,
- FALSE, collect, NULL)))
- goto error_return;
-
- if (! info->relocatable)
- {
- /* Clobber the section size so that the warning does
- not get copied into the output file. */
- s->_raw_size = 0;
- }
- }
- }
- }
-
- add_needed = TRUE;
- if (! dynamic)
- {
- /* If we are creating a shared library, create all the dynamic
- sections immediately. We need to attach them to something,
- so we attach them to this BFD, provided it is the right
- format. FIXME: If there are no input BFD's of the same
- format as the output, we can't make a shared library. */
- if (info->shared
- && is_elf_hash_table (hash_table)
- && hash_table->root.creator == abfd->xvec
- && ! hash_table->dynamic_sections_created)
- {
- if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
- goto error_return;
- }
- }
- else if (!is_elf_hash_table (hash_table))
- goto error_return;
- else
- {
- asection *s;
- const char *soname = NULL;
- struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
- int ret;
-
- /* ld --just-symbols and dynamic objects don't mix very well.
- Test for --just-symbols by looking at info set up by
- _bfd_elf_link_just_syms. */
- if ((s = abfd->sections) != NULL
- && s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
- goto error_return;
-
- /* If this dynamic lib was specified on the command line with
- --as-needed in effect, then we don't want to add a DT_NEEDED
- tag unless the lib is actually used. Similary for libs brought
- in by another lib's DT_NEEDED. */
- add_needed = elf_dyn_lib_class (abfd) == DYN_NORMAL;
-
- s = bfd_get_section_by_name (abfd, ".dynamic");
- if (s != NULL)
- {
- bfd_byte *dynbuf;
- bfd_byte *extdyn;
- int elfsec;
- unsigned long shlink;
-
- dynbuf = bfd_malloc (s->_raw_size);
- if (dynbuf == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size))
- goto error_free_dyn;
-
- elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
- if (elfsec == -1)
- goto error_free_dyn;
- shlink = elf_elfsections (abfd)[elfsec]->sh_link;
-
- for (extdyn = dynbuf;
- extdyn < dynbuf + s->_raw_size;
- extdyn += bed->s->sizeof_dyn)
- {
- Elf_Internal_Dyn dyn;
-
- bed->s->swap_dyn_in (abfd, extdyn, &dyn);
- if (dyn.d_tag == DT_SONAME)
- {
- unsigned int tagv = dyn.d_un.d_val;
- soname = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (soname == NULL)
- goto error_free_dyn;
- }
- if (dyn.d_tag == DT_NEEDED)
- {
- struct bfd_link_needed_list *n, **pn;
- char *fnm, *anm;
- unsigned int tagv = dyn.d_un.d_val;
-
- amt = sizeof (struct bfd_link_needed_list);
- n = bfd_alloc (abfd, amt);
- fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (n == NULL || fnm == NULL)
- goto error_free_dyn;
- amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
- if (anm == NULL)
- goto error_free_dyn;
- memcpy (anm, fnm, amt);
- n->name = anm;
- n->by = abfd;
- n->next = NULL;
- for (pn = & hash_table->needed;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = n;
- }
- if (dyn.d_tag == DT_RUNPATH)
- {
- struct bfd_link_needed_list *n, **pn;
- char *fnm, *anm;
- unsigned int tagv = dyn.d_un.d_val;
-
- amt = sizeof (struct bfd_link_needed_list);
- n = bfd_alloc (abfd, amt);
- fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (n == NULL || fnm == NULL)
- goto error_free_dyn;
- amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
- if (anm == NULL)
- goto error_free_dyn;
- memcpy (anm, fnm, amt);
- n->name = anm;
- n->by = abfd;
- n->next = NULL;
- for (pn = & runpath;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = n;
- }
- /* Ignore DT_RPATH if we have seen DT_RUNPATH. */
- if (!runpath && dyn.d_tag == DT_RPATH)
- {
- struct bfd_link_needed_list *n, **pn;
- char *fnm, *anm;
- unsigned int tagv = dyn.d_un.d_val;
-
- amt = sizeof (struct bfd_link_needed_list);
- n = bfd_alloc (abfd, amt);
- fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (n == NULL || fnm == NULL)
- goto error_free_dyn;
- amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
- if (anm == NULL)
- {
- error_free_dyn:
- free (dynbuf);
- goto error_return;
- }
- memcpy (anm, fnm, amt);
- n->name = anm;
- n->by = abfd;
- n->next = NULL;
- for (pn = & rpath;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = n;
- }
- }
-
- free (dynbuf);
- }
-
- /* DT_RUNPATH overrides DT_RPATH. Do _NOT_ bfd_release, as that
- frees all more recently bfd_alloc'd blocks as well. */
- if (runpath)
- rpath = runpath;
-
- if (rpath)
- {
- struct bfd_link_needed_list **pn;
- for (pn = & hash_table->runpath;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = rpath;
- }
-
- /* We do not want to include any of the sections in a dynamic
- object in the output file. We hack by simply clobbering the
- list of sections in the BFD. This could be handled more
- cleanly by, say, a new section flag; the existing
- SEC_NEVER_LOAD flag is not the one we want, because that one
- still implies that the section takes up space in the output
- file. */
- bfd_section_list_clear (abfd);
-
- /* If this is the first dynamic object found in the link, create
- the special sections required for dynamic linking. */
- if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
- goto error_return;
-
- /* Find the name to use in a DT_NEEDED entry that refers to this
- object. If the object has a DT_SONAME entry, we use it.
- Otherwise, if the generic linker stuck something in
- elf_dt_name, we use that. Otherwise, we just use the file
- name. */
- if (soname == NULL || *soname == '\0')
- {
- soname = elf_dt_name (abfd);
- if (soname == NULL || *soname == '\0')
- soname = bfd_get_filename (abfd);
- }
-
- /* Save the SONAME because sometimes the linker emulation code
- will need to know it. */
- elf_dt_name (abfd) = soname;
-
- ret = elf_add_dt_needed_tag (info, soname, add_needed);
- if (ret < 0)
- goto error_return;
-
- /* If we have already included this dynamic object in the
- link, just ignore it. There is no reason to include a
- particular dynamic object more than once. */
- if (ret > 0)
- return TRUE;
- }
-
- /* If this is a dynamic object, we always link against the .dynsym
- symbol table, not the .symtab symbol table. The dynamic linker
- will only see the .dynsym symbol table, so there is no reason to
- look at .symtab for a dynamic object. */
-
- if (! dynamic || elf_dynsymtab (abfd) == 0)
- hdr = &elf_tdata (abfd)->symtab_hdr;
- else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
-
- symcount = hdr->sh_size / bed->s->sizeof_sym;
-
- /* The sh_info field of the symtab header tells us where the
- external symbols start. We don't care about the local symbols at
- this point. */
- if (elf_bad_symtab (abfd))
- {
- extsymcount = symcount;
- extsymoff = 0;
- }
- else
- {
- extsymcount = symcount - hdr->sh_info;
- extsymoff = hdr->sh_info;
- }
-
- sym_hash = NULL;
- if (extsymcount != 0)
- {
- isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- goto error_return;
-
- /* We store a pointer to the hash table entry for each external
- symbol. */
- amt = extsymcount * sizeof (struct elf_link_hash_entry *);
- sym_hash = bfd_alloc (abfd, amt);
- if (sym_hash == NULL)
- goto error_free_sym;
- elf_sym_hashes (abfd) = sym_hash;
- }
-
- if (dynamic)
- {
- /* Read in any version definitions. */
- if (! _bfd_elf_slurp_version_tables (abfd))
- goto error_free_sym;
-
- /* Read in the symbol versions, but don't bother to convert them
- to internal format. */
- if (elf_dynversym (abfd) != 0)
- {
- Elf_Internal_Shdr *versymhdr;
-
- versymhdr = &elf_tdata (abfd)->dynversym_hdr;
- extversym = bfd_malloc (versymhdr->sh_size);
- if (extversym == NULL)
- goto error_free_sym;
- amt = versymhdr->sh_size;
- if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0
- || bfd_bread (extversym, amt, abfd) != amt)
- goto error_free_vers;
- }
- }
-
- weaks = NULL;
-
- ever = extversym != NULL ? extversym + extsymoff : NULL;
- for (isym = isymbuf, isymend = isymbuf + extsymcount;
- isym < isymend;
- isym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL))
- {
- int bind;
- bfd_vma value;
- asection *sec;
- flagword flags;
- const char *name;
- struct elf_link_hash_entry *h;
- bfd_boolean definition;
- bfd_boolean size_change_ok;
- bfd_boolean type_change_ok;
- bfd_boolean new_weakdef;
- bfd_boolean override;
- unsigned int old_alignment;
- bfd *old_bfd;
-
- override = FALSE;
-
- flags = BSF_NO_FLAGS;
- sec = NULL;
- value = isym->st_value;
- *sym_hash = NULL;
-
- bind = ELF_ST_BIND (isym->st_info);
- if (bind == STB_LOCAL)
- {
- /* This should be impossible, since ELF requires that all
- global symbols follow all local symbols, and that sh_info
- point to the first global symbol. Unfortunately, Irix 5
- screws this up. */
- continue;
- }
- else if (bind == STB_GLOBAL)
- {
- if (isym->st_shndx != SHN_UNDEF
- && isym->st_shndx != SHN_COMMON)
- flags = BSF_GLOBAL;
- }
- else if (bind == STB_WEAK)
- flags = BSF_WEAK;
- else
- {
- /* Leave it up to the processor backend. */
- }
-
- if (isym->st_shndx == SHN_UNDEF)
- sec = bfd_und_section_ptr;
- else if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
- {
- sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
- if (sec == NULL)
- sec = bfd_abs_section_ptr;
- else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
- value -= sec->vma;
- }
- else if (isym->st_shndx == SHN_ABS)
- sec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- {
- sec = bfd_com_section_ptr;
- /* What ELF calls the size we call the value. What ELF
- calls the value we call the alignment. */
- value = isym->st_size;
- }
- else
- {
- /* Leave it up to the processor backend. */
- }
-
- name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- isym->st_name);
- if (name == NULL)
- goto error_free_vers;
-
- if (isym->st_shndx == SHN_COMMON
- && ELF_ST_TYPE (isym->st_info) == STT_TLS)
- {
- asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon");
-
- if (tcomm == NULL)
- {
- tcomm = bfd_make_section (abfd, ".tcommon");
- if (tcomm == NULL
- || !bfd_set_section_flags (abfd, tcomm, (SEC_ALLOC
- | SEC_IS_COMMON
- | SEC_LINKER_CREATED
- | SEC_THREAD_LOCAL)))
- goto error_free_vers;
- }
- sec = tcomm;
- }
- else if (add_symbol_hook)
- {
- if (! (*add_symbol_hook) (abfd, info, isym, &name, &flags, &sec,
- &value))
- goto error_free_vers;
-
- /* The hook function sets the name to NULL if this symbol
- should be skipped for some reason. */
- if (name == NULL)
- continue;
- }
-
- /* Sanity check that all possibilities were handled. */
- if (sec == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- goto error_free_vers;
- }
-
- if (bfd_is_und_section (sec)
- || bfd_is_com_section (sec))
- definition = FALSE;
- else
- definition = TRUE;
-
- size_change_ok = FALSE;
- type_change_ok = get_elf_backend_data (abfd)->type_change_ok;
- old_alignment = 0;
- old_bfd = NULL;
-
- if (is_elf_hash_table (hash_table))
- {
- Elf_Internal_Versym iver;
- unsigned int vernum = 0;
- bfd_boolean skip;
-
- if (ever != NULL)
- {
- _bfd_elf_swap_versym_in (abfd, ever, &iver);
- vernum = iver.vs_vers & VERSYM_VERSION;
-
- /* If this is a hidden symbol, or if it is not version
- 1, we append the version name to the symbol name.
- However, we do not modify a non-hidden absolute
- symbol, because it might be the version symbol
- itself. FIXME: What if it isn't? */
- if ((iver.vs_vers & VERSYM_HIDDEN) != 0
- || (vernum > 1 && ! bfd_is_abs_section (sec)))
- {
- const char *verstr;
- size_t namelen, verlen, newlen;
- char *newname, *p;
-
- if (isym->st_shndx != SHN_UNDEF)
- {
- if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info)
- {
- (*_bfd_error_handler)
- (_("%s: %s: invalid version %u (max %d)"),
- bfd_archive_filename (abfd), name, vernum,
- elf_tdata (abfd)->dynverdef_hdr.sh_info);
- bfd_set_error (bfd_error_bad_value);
- goto error_free_vers;
- }
- else if (vernum > 1)
- verstr =
- elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
- else
- verstr = "";
- }
- else
- {
- /* We cannot simply test for the number of
- entries in the VERNEED section since the
- numbers for the needed versions do not start
- at 0. */
- Elf_Internal_Verneed *t;
-
- verstr = NULL;
- for (t = elf_tdata (abfd)->verref;
- t != NULL;
- t = t->vn_nextref)
- {
- Elf_Internal_Vernaux *a;
-
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- {
- if (a->vna_other == vernum)
- {
- verstr = a->vna_nodename;
- break;
- }
- }
- if (a != NULL)
- break;
- }
- if (verstr == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: %s: invalid needed version %d"),
- bfd_archive_filename (abfd), name, vernum);
- bfd_set_error (bfd_error_bad_value);
- goto error_free_vers;
- }
- }
-
- namelen = strlen (name);
- verlen = strlen (verstr);
- newlen = namelen + verlen + 2;
- if ((iver.vs_vers & VERSYM_HIDDEN) == 0
- && isym->st_shndx != SHN_UNDEF)
- ++newlen;
-
- newname = bfd_alloc (abfd, newlen);
- if (newname == NULL)
- goto error_free_vers;
- memcpy (newname, name, namelen);
- p = newname + namelen;
- *p++ = ELF_VER_CHR;
- /* If this is a defined non-hidden version symbol,
- we add another @ to the name. This indicates the
- default version of the symbol. */
- if ((iver.vs_vers & VERSYM_HIDDEN) == 0
- && isym->st_shndx != SHN_UNDEF)
- *p++ = ELF_VER_CHR;
- memcpy (p, verstr, verlen + 1);
-
- name = newname;
- }
- }
-
- if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, &value,
- sym_hash, &skip, &override,
- &type_change_ok, &size_change_ok))
- goto error_free_vers;
-
- if (skip)
- continue;
-
- if (override)
- definition = FALSE;
-
- h = *sym_hash;
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Remember the old alignment if this is a common symbol, so
- that we don't reduce the alignment later on. We can't
- check later, because _bfd_generic_link_add_one_symbol
- will set a default for the alignment which we want to
- override. We also remember the old bfd where the existing
- definition comes from. */
- switch (h->root.type)
- {
- default:
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- old_bfd = h->root.u.def.section->owner;
- break;
-
- case bfd_link_hash_common:
- old_bfd = h->root.u.c.p->section->owner;
- old_alignment = h->root.u.c.p->alignment_power;
- break;
- }
-
- if (elf_tdata (abfd)->verdef != NULL
- && ! override
- && vernum > 1
- && definition)
- h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
- }
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, flags, sec, value, NULL, FALSE, collect,
- (struct bfd_link_hash_entry **) sym_hash)))
- goto error_free_vers;
-
- h = *sym_hash;
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- *sym_hash = h;
-
- new_weakdef = FALSE;
- if (dynamic
- && definition
- && (flags & BSF_WEAK) != 0
- && ELF_ST_TYPE (isym->st_info) != STT_FUNC
- && is_elf_hash_table (hash_table)
- && h->weakdef == NULL)
- {
- /* Keep a list of all weak defined non function symbols from
- a dynamic object, using the weakdef field. Later in this
- function we will set the weakdef field to the correct
- value. We only put non-function symbols from dynamic
- objects on this list, because that happens to be the only
- time we need to know the normal symbol corresponding to a
- weak symbol, and the information is time consuming to
- figure out. If the weakdef field is not already NULL,
- then this symbol was already defined by some previous
- dynamic object, and we will be using that previous
- definition anyhow. */
-
- h->weakdef = weaks;
- weaks = h;
- new_weakdef = TRUE;
- }
-
- /* Set the alignment of a common symbol. */
- if (isym->st_shndx == SHN_COMMON
- && h->root.type == bfd_link_hash_common)
- {
- unsigned int align;
-
- align = bfd_log2 (isym->st_value);
- if (align > old_alignment
- /* Permit an alignment power of zero if an alignment of one
- is specified and no other alignments have been specified. */
- || (isym->st_value == 1 && old_alignment == 0))
- h->root.u.c.p->alignment_power = align;
- else
- h->root.u.c.p->alignment_power = old_alignment;
- }
-
- if (is_elf_hash_table (hash_table))
- {
- int old_flags;
- bfd_boolean dynsym;
- int new_flag;
-
- /* Check the alignment when a common symbol is involved. This
- can change when a common symbol is overridden by a normal
- definition or a common symbol is ignored due to the old
- normal definition. We need to make sure the maximum
- alignment is maintained. */
- if ((old_alignment || isym->st_shndx == SHN_COMMON)
- && h->root.type != bfd_link_hash_common)
- {
- unsigned int common_align;
- unsigned int normal_align;
- unsigned int symbol_align;
- bfd *normal_bfd;
- bfd *common_bfd;
-
- symbol_align = ffs (h->root.u.def.value) - 1;
- if (h->root.u.def.section->owner != NULL
- && (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
- {
- normal_align = h->root.u.def.section->alignment_power;
- if (normal_align > symbol_align)
- normal_align = symbol_align;
- }
- else
- normal_align = symbol_align;
-
- if (old_alignment)
- {
- common_align = old_alignment;
- common_bfd = old_bfd;
- normal_bfd = abfd;
- }
- else
- {
- common_align = bfd_log2 (isym->st_value);
- common_bfd = abfd;
- normal_bfd = old_bfd;
- }
-
- if (normal_align < common_align)
- (*_bfd_error_handler)
- (_("Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"),
- 1 << normal_align,
- name,
- bfd_archive_filename (normal_bfd),
- 1 << common_align,
- bfd_archive_filename (common_bfd));
- }
-
- /* Remember the symbol size and type. */
- if (isym->st_size != 0
- && (definition || h->size == 0))
- {
- if (h->size != 0 && h->size != isym->st_size && ! size_change_ok)
- (*_bfd_error_handler)
- (_("Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"),
- name, (unsigned long) h->size,
- bfd_archive_filename (old_bfd),
- (unsigned long) isym->st_size,
- bfd_archive_filename (abfd));
-
- h->size = isym->st_size;
- }
-
- /* If this is a common symbol, then we always want H->SIZE
- to be the size of the common symbol. The code just above
- won't fix the size if a common symbol becomes larger. We
- don't warn about a size change here, because that is
- covered by --warn-common. */
- if (h->root.type == bfd_link_hash_common)
- h->size = h->root.u.c.size;
-
- if (ELF_ST_TYPE (isym->st_info) != STT_NOTYPE
- && (definition || h->type == STT_NOTYPE))
- {
- if (h->type != STT_NOTYPE
- && h->type != ELF_ST_TYPE (isym->st_info)
- && ! type_change_ok)
- (*_bfd_error_handler)
- (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
- name, h->type, ELF_ST_TYPE (isym->st_info),
- bfd_archive_filename (abfd));
-
- h->type = ELF_ST_TYPE (isym->st_info);
- }
-
- /* If st_other has a processor-specific meaning, specific
- code might be needed here. We never merge the visibility
- attribute with the one from a dynamic object. */
- if (bed->elf_backend_merge_symbol_attribute)
- (*bed->elf_backend_merge_symbol_attribute) (h, isym, definition,
- dynamic);
-
- if (isym->st_other != 0 && !dynamic)
- {
- unsigned char hvis, symvis, other, nvis;
-
- /* Take the balance of OTHER from the definition. */
- other = (definition ? isym->st_other : h->other);
- other &= ~ ELF_ST_VISIBILITY (-1);
-
- /* Combine visibilities, using the most constraining one. */
- hvis = ELF_ST_VISIBILITY (h->other);
- symvis = ELF_ST_VISIBILITY (isym->st_other);
- if (! hvis)
- nvis = symvis;
- else if (! symvis)
- nvis = hvis;
- else
- nvis = hvis < symvis ? hvis : symvis;
-
- h->other = other | nvis;
- }
-
- /* Set a flag in the hash table entry indicating the type of
- reference or definition we just found. Keep a count of
- the number of dynamic symbols we find. A dynamic symbol
- is one which is referenced or defined by both a regular
- object and a shared object. */
- old_flags = h->elf_link_hash_flags;
- dynsym = FALSE;
- if (! dynamic)
- {
- if (! definition)
- {
- new_flag = ELF_LINK_HASH_REF_REGULAR;
- if (bind != STB_WEAK)
- new_flag |= ELF_LINK_HASH_REF_REGULAR_NONWEAK;
- }
- else
- new_flag = ELF_LINK_HASH_DEF_REGULAR;
- if (! info->executable
- || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_REF_DYNAMIC)) != 0)
- dynsym = TRUE;
- }
- else
- {
- if (! definition)
- new_flag = ELF_LINK_HASH_REF_DYNAMIC;
- else
- new_flag = ELF_LINK_HASH_DEF_DYNAMIC;
- if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR)) != 0
- || (h->weakdef != NULL
- && ! new_weakdef
- && h->weakdef->dynindx != -1))
- dynsym = TRUE;
- }
-
- h->elf_link_hash_flags |= new_flag;
-
- /* Check to see if we need to add an indirect symbol for
- the default name. */
- if (definition || h->root.type == bfd_link_hash_common)
- if (!_bfd_elf_add_default_symbol (abfd, info, h, name, isym,
- &sec, &value, &dynsym,
- override))
- goto error_free_vers;
-
- if (definition && !dynamic)
- {
- char *p = strchr (name, ELF_VER_CHR);
- if (p != NULL && p[1] != ELF_VER_CHR)
- {
- /* Queue non-default versions so that .symver x, x@FOO
- aliases can be checked. */
- if (! nondeflt_vers)
- {
- amt = (isymend - isym + 1)
- * sizeof (struct elf_link_hash_entry *);
- nondeflt_vers = bfd_malloc (amt);
- }
- nondeflt_vers [nondeflt_vers_cnt++] = h;
- }
- }
-
- if (dynsym && h->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- goto error_free_vers;
- if (h->weakdef != NULL
- && ! new_weakdef
- && h->weakdef->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
- goto error_free_vers;
- }
- }
- else if (dynsym && h->dynindx != -1)
- /* If the symbol already has a dynamic index, but
- visibility says it should not be visible, turn it into
- a local symbol. */
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- (*bed->elf_backend_hide_symbol) (info, h, TRUE);
- dynsym = FALSE;
- break;
- }
-
- if (!add_needed
- && definition
- && dynsym
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- {
- int ret;
- const char *soname = elf_dt_name (abfd);
-
- /* A symbol from a library loaded via DT_NEEDED of some
- other library is referenced by a regular object.
- Add a DT_NEEDED entry for it. */
- add_needed = TRUE;
- ret = elf_add_dt_needed_tag (info, soname, add_needed);
- if (ret < 0)
- goto error_free_vers;
-
- BFD_ASSERT (ret == 0);
- }
- }
- }
-
- /* Now that all the symbols from this input file are created, handle
- .symver foo, foo@BAR such that any relocs against foo become foo@BAR. */
- if (nondeflt_vers != NULL)
- {
- bfd_size_type cnt, symidx;
-
- for (cnt = 0; cnt < nondeflt_vers_cnt; ++cnt)
- {
- struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi;
- char *shortname, *p;
-
- p = strchr (h->root.root.string, ELF_VER_CHR);
- if (p == NULL
- || (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak))
- continue;
-
- amt = p - h->root.root.string;
- shortname = bfd_malloc (amt + 1);
- memcpy (shortname, h->root.root.string, amt);
- shortname[amt] = '\0';
-
- hi = (struct elf_link_hash_entry *)
- bfd_link_hash_lookup (&hash_table->root, shortname,
- FALSE, FALSE, FALSE);
- if (hi != NULL
- && hi->root.type == h->root.type
- && hi->root.u.def.value == h->root.u.def.value
- && hi->root.u.def.section == h->root.u.def.section)
- {
- (*bed->elf_backend_hide_symbol) (info, hi, TRUE);
- hi->root.type = bfd_link_hash_indirect;
- hi->root.u.i.link = (struct bfd_link_hash_entry *) h;
- (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
- sym_hash = elf_sym_hashes (abfd);
- if (sym_hash)
- for (symidx = 0; symidx < extsymcount; ++symidx)
- if (sym_hash[symidx] == hi)
- {
- sym_hash[symidx] = h;
- break;
- }
- }
- free (shortname);
- }
- free (nondeflt_vers);
- nondeflt_vers = NULL;
- }
-
- if (extversym != NULL)
- {
- free (extversym);
- extversym = NULL;
- }
-
- if (isymbuf != NULL)
- free (isymbuf);
- isymbuf = NULL;
-
- /* Now set the weakdefs field correctly for all the weak defined
- symbols we found. The only way to do this is to search all the
- symbols. Since we only need the information for non functions in
- dynamic objects, that's the only time we actually put anything on
- the list WEAKS. We need this information so that if a regular
- object refers to a symbol defined weakly in a dynamic object, the
- real symbol in the dynamic object is also put in the dynamic
- symbols; we also must arrange for both symbols to point to the
- same memory location. We could handle the general case of symbol
- aliasing, but a general symbol alias can only be generated in
- assembler code, handling it correctly would be very time
- consuming, and other ELF linkers don't handle general aliasing
- either. */
- if (weaks != NULL)
- {
- struct elf_link_hash_entry **hpp;
- struct elf_link_hash_entry **hppend;
- struct elf_link_hash_entry **sorted_sym_hash;
- struct elf_link_hash_entry *h;
- size_t sym_count;
-
- /* Since we have to search the whole symbol list for each weak
- defined symbol, search time for N weak defined symbols will be
- O(N^2). Binary search will cut it down to O(NlogN). */
- amt = extsymcount * sizeof (struct elf_link_hash_entry *);
- sorted_sym_hash = bfd_malloc (amt);
- if (sorted_sym_hash == NULL)
- goto error_return;
- sym_hash = sorted_sym_hash;
- hpp = elf_sym_hashes (abfd);
- hppend = hpp + extsymcount;
- sym_count = 0;
- for (; hpp < hppend; hpp++)
- {
- h = *hpp;
- if (h != NULL
- && h->root.type == bfd_link_hash_defined
- && h->type != STT_FUNC)
- {
- *sym_hash = h;
- sym_hash++;
- sym_count++;
- }
- }
-
- qsort (sorted_sym_hash, sym_count,
- sizeof (struct elf_link_hash_entry *),
- elf_sort_symbol);
-
- while (weaks != NULL)
- {
- struct elf_link_hash_entry *hlook;
- asection *slook;
- bfd_vma vlook;
- long ilook;
- size_t i, j, idx;
-
- hlook = weaks;
- weaks = hlook->weakdef;
- hlook->weakdef = NULL;
-
- BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
- || hlook->root.type == bfd_link_hash_defweak
- || hlook->root.type == bfd_link_hash_common
- || hlook->root.type == bfd_link_hash_indirect);
- slook = hlook->root.u.def.section;
- vlook = hlook->root.u.def.value;
-
- ilook = -1;
- i = 0;
- j = sym_count;
- while (i < j)
- {
- bfd_signed_vma vdiff;
- idx = (i + j) / 2;
- h = sorted_sym_hash [idx];
- vdiff = vlook - h->root.u.def.value;
- if (vdiff < 0)
- j = idx;
- else if (vdiff > 0)
- i = idx + 1;
- else
- {
- long sdiff = slook - h->root.u.def.section;
- if (sdiff < 0)
- j = idx;
- else if (sdiff > 0)
- i = idx + 1;
- else
- {
- ilook = idx;
- break;
- }
- }
- }
-
- /* We didn't find a value/section match. */
- if (ilook == -1)
- continue;
-
- for (i = ilook; i < sym_count; i++)
- {
- h = sorted_sym_hash [i];
-
- /* Stop if value or section doesn't match. */
- if (h->root.u.def.value != vlook
- || h->root.u.def.section != slook)
- break;
- else if (h != hlook)
- {
- hlook->weakdef = h;
-
- /* If the weak definition is in the list of dynamic
- symbols, make sure the real definition is put
- there as well. */
- if (hlook->dynindx != -1 && h->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- goto error_return;
- }
-
- /* If the real definition is in the list of dynamic
- symbols, make sure the weak definition is put
- there as well. If we don't do this, then the
- dynamic loader might not merge the entries for the
- real definition and the weak definition. */
- if (h->dynindx != -1 && hlook->dynindx == -1)
- {
- if (! bfd_elf_link_record_dynamic_symbol (info, hlook))
- goto error_return;
- }
- break;
- }
- }
- }
-
- free (sorted_sym_hash);
- }
-
- /* If this object is the same format as the output object, and it is
- not a shared library, then let the backend look through the
- relocs.
-
- This is required to build global offset table entries and to
- arrange for dynamic relocs. It is not required for the
- particular common case of linking non PIC code, even when linking
- against shared libraries, but unfortunately there is no way of
- knowing whether an object file has been compiled PIC or not.
- Looking through the relocs is not particularly time consuming.
- The problem is that we must either (1) keep the relocs in memory,
- which causes the linker to require additional runtime memory or
- (2) read the relocs twice from the input file, which wastes time.
- This would be a good case for using mmap.
-
- I have no idea how to handle linking PIC code into a file of a
- different format. It probably can't be done. */
- check_relocs = get_elf_backend_data (abfd)->check_relocs;
- if (! dynamic
- && is_elf_hash_table (hash_table)
- && hash_table->root.creator == abfd->xvec
- && check_relocs != NULL)
- {
- asection *o;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- Elf_Internal_Rela *internal_relocs;
- bfd_boolean ok;
-
- if ((o->flags & SEC_RELOC) == 0
- || o->reloc_count == 0
- || ((info->strip == strip_all || info->strip == strip_debugger)
- && (o->flags & SEC_DEBUGGING) != 0)
- || bfd_is_abs_section (o->output_section))
- continue;
-
- internal_relocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL,
- info->keep_memory);
- if (internal_relocs == NULL)
- goto error_return;
-
- ok = (*check_relocs) (abfd, info, o, internal_relocs);
-
- if (elf_section_data (o)->relocs != internal_relocs)
- free (internal_relocs);
-
- if (! ok)
- goto error_return;
- }
- }
-
- /* If this is a non-traditional link, try to optimize the handling
- of the .stab/.stabstr sections. */
- if (! dynamic
- && ! info->traditional_format
- && is_elf_hash_table (hash_table)
- && (info->strip != strip_all && info->strip != strip_debugger))
- {
- asection *stabstr;
-
- stabstr = bfd_get_section_by_name (abfd, ".stabstr");
- if (stabstr != NULL)
- {
- bfd_size_type string_offset = 0;
- asection *stab;
-
- for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
- && (!stab->name[5] ||
- (stab->name[5] == '.' && ISDIGIT (stab->name[6])))
- && (stab->flags & SEC_MERGE) == 0
- && !bfd_is_abs_section (stab->output_section))
- {
- struct bfd_elf_section_data *secdata;
-
- secdata = elf_section_data (stab);
- if (! _bfd_link_section_stabs (abfd,
- & hash_table->stab_info,
- stab, stabstr,
- &secdata->sec_info,
- &string_offset))
- goto error_return;
- if (secdata->sec_info)
- stab->sec_info_type = ELF_INFO_TYPE_STABS;
- }
- }
- }
-
- if (! info->relocatable
- && ! dynamic
- && is_elf_hash_table (hash_table))
- {
- asection *s;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- if ((s->flags & SEC_MERGE) != 0
- && !bfd_is_abs_section (s->output_section))
- {
- struct bfd_elf_section_data *secdata;
-
- secdata = elf_section_data (s);
- if (! _bfd_merge_section (abfd,
- & hash_table->merge_info,
- s, &secdata->sec_info))
- goto error_return;
- else if (secdata->sec_info)
- s->sec_info_type = ELF_INFO_TYPE_MERGE;
- }
- }
-
- if (is_elf_hash_table (hash_table))
- {
- /* Add this bfd to the loaded list. */
- struct elf_link_loaded_list *n;
-
- n = bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
- if (n == NULL)
- goto error_return;
- n->abfd = abfd;
- n->next = hash_table->loaded;
- hash_table->loaded = n;
- }
-
- return TRUE;
-
- error_free_vers:
- if (nondeflt_vers != NULL)
- free (nondeflt_vers);
- if (extversym != NULL)
- free (extversym);
- error_free_sym:
- if (isymbuf != NULL)
- free (isymbuf);
- error_return:
- return FALSE;
-}
-
-/* Add symbols from an ELF archive file to the linker hash table. We
- don't use _bfd_generic_link_add_archive_symbols because of a
- problem which arises on UnixWare. The UnixWare libc.so is an
- archive which includes an entry libc.so.1 which defines a bunch of
- symbols. The libc.so archive also includes a number of other
- object files, which also define symbols, some of which are the same
- as those defined in libc.so.1. Correct linking requires that we
- consider each object file in turn, and include it if it defines any
- symbols we need. _bfd_generic_link_add_archive_symbols does not do
- this; it looks through the list of undefined symbols, and includes
- any object file which defines them. When this algorithm is used on
- UnixWare, it winds up pulling in libc.so.1 early and defining a
- bunch of symbols. This means that some of the other objects in the
- archive are not included in the link, which is incorrect since they
- precede libc.so.1 in the archive.
-
- Fortunately, ELF archive handling is simpler than that done by
- _bfd_generic_link_add_archive_symbols, which has to allow for a.out
- oddities. In ELF, if we find a symbol in the archive map, and the
- symbol is currently undefined, we know that we must pull in that
- object file.
-
- Unfortunately, we do have to make multiple passes over the symbol
- table until nothing further is resolved. */
-
-static bfd_boolean
-elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
-{
- symindex c;
- bfd_boolean *defined = NULL;
- bfd_boolean *included = NULL;
- carsym *symdefs;
- bfd_boolean loop;
- bfd_size_type amt;
-
- if (! bfd_has_map (abfd))
- {
- /* An empty archive is a special case. */
- if (bfd_openr_next_archived_file (abfd, NULL) == NULL)
- return TRUE;
- bfd_set_error (bfd_error_no_armap);
- return FALSE;
- }
-
- /* Keep track of all symbols we know to be already defined, and all
- files we know to be already included. This is to speed up the
- second and subsequent passes. */
- c = bfd_ardata (abfd)->symdef_count;
- if (c == 0)
- return TRUE;
- amt = c;
- amt *= sizeof (bfd_boolean);
- defined = bfd_zmalloc (amt);
- included = bfd_zmalloc (amt);
- if (defined == NULL || included == NULL)
- goto error_return;
-
- symdefs = bfd_ardata (abfd)->symdefs;
-
- do
- {
- file_ptr last;
- symindex i;
- carsym *symdef;
- carsym *symdefend;
-
- loop = FALSE;
- last = -1;
-
- symdef = symdefs;
- symdefend = symdef + c;
- for (i = 0; symdef < symdefend; symdef++, i++)
- {
- struct elf_link_hash_entry *h;
- bfd *element;
- struct bfd_link_hash_entry *undefs_tail;
- symindex mark;
-
- if (defined[i] || included[i])
- continue;
- if (symdef->file_offset == last)
- {
- included[i] = TRUE;
- continue;
- }
-
- h = elf_link_hash_lookup (elf_hash_table (info), symdef->name,
- FALSE, FALSE, FALSE);
-
- if (h == NULL)
- {
- char *p, *copy;
- size_t len, first;
-
- /* If this is a default version (the name contains @@),
- look up the symbol again with only one `@' as well
- as without the version. The effect is that references
- to the symbol with and without the version will be
- matched by the default symbol in the archive. */
-
- p = strchr (symdef->name, ELF_VER_CHR);
- if (p == NULL || p[1] != ELF_VER_CHR)
- continue;
-
- /* First check with only one `@'. */
- len = strlen (symdef->name);
- copy = bfd_alloc (abfd, len);
- if (copy == NULL)
- goto error_return;
- first = p - symdef->name + 1;
- memcpy (copy, symdef->name, first);
- memcpy (copy + first, symdef->name + first + 1, len - first);
-
- h = elf_link_hash_lookup (elf_hash_table (info), copy,
- FALSE, FALSE, FALSE);
-
- if (h == NULL)
- {
- /* We also need to check references to the symbol
- without the version. */
-
- copy[first - 1] = '\0';
- h = elf_link_hash_lookup (elf_hash_table (info),
- copy, FALSE, FALSE, FALSE);
- }
-
- bfd_release (abfd, copy);
- }
-
- if (h == NULL)
- continue;
-
- if (h->root.type == bfd_link_hash_common)
- {
- /* We currently have a common symbol. The archive map contains
- a reference to this symbol, so we may want to include it. We
- only want to include it however, if this archive element
- contains a definition of the symbol, not just another common
- declaration of it.
-
- Unfortunately some archivers (including GNU ar) will put
- declarations of common symbols into their archive maps, as
- well as real definitions, so we cannot just go by the archive
- map alone. Instead we must read in the element's symbol
- table and check that to see what kind of symbol definition
- this is. */
- if (! elf_link_is_defined_archive_symbol (abfd, symdef))
- continue;
- }
- else if (h->root.type != bfd_link_hash_undefined)
- {
- if (h->root.type != bfd_link_hash_undefweak)
- defined[i] = TRUE;
- continue;
- }
-
- /* We need to include this archive member. */
- element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
- if (element == NULL)
- goto error_return;
-
- if (! bfd_check_format (element, bfd_object))
- goto error_return;
-
- /* Doublecheck that we have not included this object
- already--it should be impossible, but there may be
- something wrong with the archive. */
- if (element->archive_pass != 0)
- {
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- element->archive_pass = 1;
-
- undefs_tail = info->hash->undefs_tail;
-
- if (! (*info->callbacks->add_archive_element) (info, element,
- symdef->name))
- goto error_return;
- if (! bfd_link_add_symbols (element, info))
- goto error_return;
-
- /* If there are any new undefined symbols, we need to make
- another pass through the archive in order to see whether
- they can be defined. FIXME: This isn't perfect, because
- common symbols wind up on undefs_tail and because an
- undefined symbol which is defined later on in this pass
- does not require another pass. This isn't a bug, but it
- does make the code less efficient than it could be. */
- if (undefs_tail != info->hash->undefs_tail)
- loop = TRUE;
-
- /* Look backward to mark all symbols from this object file
- which we have already seen in this pass. */
- mark = i;
- do
- {
- included[mark] = TRUE;
- if (mark == 0)
- break;
- --mark;
- }
- while (symdefs[mark].file_offset == symdef->file_offset);
-
- /* We mark subsequent symbols from this object file as we go
- on through the loop. */
- last = symdef->file_offset;
- }
- }
- while (loop);
-
- free (defined);
- free (included);
-
- return TRUE;
-
- error_return:
- if (defined != NULL)
- free (defined);
- if (included != NULL)
- free (included);
- return FALSE;
-}
-
-/* Given an ELF BFD, add symbols to the global hash table as
- appropriate. */
-
-bfd_boolean
-bfd_elf_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
-{
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
- return elf_link_add_object_symbols (abfd, info);
- case bfd_archive:
- return elf_link_add_archive_symbols (abfd, info);
- default:
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-}
-
-/* This function will be called though elf_link_hash_traverse to store
- all hash value of the exported symbols in an array. */
-
-static bfd_boolean
-elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
-{
- unsigned long **valuep = data;
- const char *name;
- char *p;
- unsigned long ha;
- char *alc = NULL;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Ignore indirect symbols. These are added by the versioning code. */
- if (h->dynindx == -1)
- return TRUE;
-
- name = h->root.root.string;
- p = strchr (name, ELF_VER_CHR);
- if (p != NULL)
- {
- alc = bfd_malloc (p - name + 1);
- memcpy (alc, name, p - name);
- alc[p - name] = '\0';
- name = alc;
- }
-
- /* Compute the hash value. */
- ha = bfd_elf_hash (name);
-
- /* Store the found hash value in the array given as the argument. */
- *(*valuep)++ = ha;
-
- /* And store it in the struct so that we can put it in the hash table
- later. */
- h->elf_hash_value = ha;
-
- if (alc != NULL)
- free (alc);
-
- return TRUE;
-}
-
-/* Array used to determine the number of hash table buckets to use
- based on the number of symbols there are. If there are fewer than
- 3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets,
- fewer than 37 we use 17 buckets, and so forth. We never use more
- than 32771 buckets. */
-
-static const size_t elf_buckets[] =
-{
- 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209,
- 16411, 32771, 0
-};
-
-/* Compute bucket count for hashing table. We do not use a static set
- of possible tables sizes anymore. Instead we determine for all
- possible reasonable sizes of the table the outcome (i.e., the
- number of collisions etc) and choose the best solution. The
- weighting functions are not too simple to allow the table to grow
- without bounds. Instead one of the weighting factors is the size.
- Therefore the result is always a good payoff between few collisions
- (= short chain lengths) and table size. */
-static size_t
-compute_bucket_count (struct bfd_link_info *info)
-{
- size_t dynsymcount = elf_hash_table (info)->dynsymcount;
- size_t best_size = 0;
- unsigned long int *hashcodes;
- unsigned long int *hashcodesp;
- unsigned long int i;
- bfd_size_type amt;
-
- /* Compute the hash values for all exported symbols. At the same
- time store the values in an array so that we could use them for
- optimizations. */
- amt = dynsymcount;
- amt *= sizeof (unsigned long int);
- hashcodes = bfd_malloc (amt);
- if (hashcodes == NULL)
- return 0;
- hashcodesp = hashcodes;
-
- /* Put all hash values in HASHCODES. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_collect_hash_codes, &hashcodesp);
-
- /* We have a problem here. The following code to optimize the table
- size requires an integer type with more the 32 bits. If
- BFD_HOST_U_64_BIT is set we know about such a type. */
-#ifdef BFD_HOST_U_64_BIT
- if (info->optimize)
- {
- unsigned long int nsyms = hashcodesp - hashcodes;
- size_t minsize;
- size_t maxsize;
- BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0);
- unsigned long int *counts ;
- bfd *dynobj = elf_hash_table (info)->dynobj;
- const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-
- /* Possible optimization parameters: if we have NSYMS symbols we say
- that the hashing table must at least have NSYMS/4 and at most
- 2*NSYMS buckets. */
- minsize = nsyms / 4;
- if (minsize == 0)
- minsize = 1;
- best_size = maxsize = nsyms * 2;
-
- /* Create array where we count the collisions in. We must use bfd_malloc
- since the size could be large. */
- amt = maxsize;
- amt *= sizeof (unsigned long int);
- counts = bfd_malloc (amt);
- if (counts == NULL)
- {
- free (hashcodes);
- return 0;
- }
-
- /* Compute the "optimal" size for the hash table. The criteria is a
- minimal chain length. The minor criteria is (of course) the size
- of the table. */
- for (i = minsize; i < maxsize; ++i)
- {
- /* Walk through the array of hashcodes and count the collisions. */
- BFD_HOST_U_64_BIT max;
- unsigned long int j;
- unsigned long int fact;
-
- memset (counts, '\0', i * sizeof (unsigned long int));
-
- /* Determine how often each hash bucket is used. */
- for (j = 0; j < nsyms; ++j)
- ++counts[hashcodes[j] % i];
-
- /* For the weight function we need some information about the
- pagesize on the target. This is information need not be 100%
- accurate. Since this information is not available (so far) we
- define it here to a reasonable default value. If it is crucial
- to have a better value some day simply define this value. */
-# ifndef BFD_TARGET_PAGESIZE
-# define BFD_TARGET_PAGESIZE (4096)
-# endif
-
- /* We in any case need 2 + NSYMS entries for the size values and
- the chains. */
- max = (2 + nsyms) * (bed->s->arch_size / 8);
-
-# if 1
- /* Variant 1: optimize for short chains. We add the squares
- of all the chain lengths (which favors many small chain
- over a few long chains). */
- for (j = 0; j < i; ++j)
- max += counts[j] * counts[j];
-
- /* This adds penalties for the overall size of the table. */
- fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1;
- max *= fact * fact;
-# else
- /* Variant 2: Optimize a lot more for small table. Here we
- also add squares of the size but we also add penalties for
- empty slots (the +1 term). */
- for (j = 0; j < i; ++j)
- max += (1 + counts[j]) * (1 + counts[j]);
-
- /* The overall size of the table is considered, but not as
- strong as in variant 1, where it is squared. */
- fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1;
- max *= fact;
-# endif
-
- /* Compare with current best results. */
- if (max < best_chlen)
- {
- best_chlen = max;
- best_size = i;
- }
- }
-
- free (counts);
- }
- else
-#endif /* defined (BFD_HOST_U_64_BIT) */
- {
- /* This is the fallback solution if no 64bit type is available or if we
- are not supposed to spend much time on optimizations. We select the
- bucket count using a fixed set of numbers. */
- for (i = 0; elf_buckets[i] != 0; i++)
- {
- best_size = elf_buckets[i];
- if (dynsymcount < elf_buckets[i + 1])
- break;
- }
- }
-
- /* Free the arrays we needed. */
- free (hashcodes);
-
- return best_size;
-}
-
-/* Set up the sizes and contents of the ELF dynamic sections. This is
- called by the ELF linker emulation before_allocation routine. We
- must set the sizes of the sections before the linker sets the
- addresses of the various sections. */
-
-bfd_boolean
-bfd_elf_size_dynamic_sections (bfd *output_bfd,
- const char *soname,
- const char *rpath,
- const char *filter_shlib,
- const char * const *auxiliary_filters,
- struct bfd_link_info *info,
- asection **sinterpptr,
- struct bfd_elf_version_tree *verdefs)
-{
- bfd_size_type soname_indx;
- bfd *dynobj;
- const struct elf_backend_data *bed;
- struct elf_assign_sym_version_info asvinfo;
-
- *sinterpptr = NULL;
-
- soname_indx = (bfd_size_type) -1;
-
- if (!is_elf_hash_table (info->hash))
- return TRUE;
-
- if (info->execstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
- else if (info->noexecstack)
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
- else
- {
- bfd *inputobj;
- asection *notesec = NULL;
- int exec = 0;
-
- for (inputobj = info->input_bfds;
- inputobj;
- inputobj = inputobj->link_next)
- {
- asection *s;
-
- if (inputobj->flags & DYNAMIC)
- continue;
- s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
- if (s)
- {
- if (s->flags & SEC_CODE)
- exec = PF_X;
- notesec = s;
- }
- else
- exec = PF_X;
- }
- if (notesec)
- {
- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | exec;
- if (exec && info->relocatable
- && notesec->output_section != bfd_abs_section_ptr)
- notesec->output_section->flags |= SEC_CODE;
- }
- }
-
- /* Any syms created from now on start with -1 in
- got.refcount/offset and plt.refcount/offset. */
- elf_hash_table (info)->init_refcount = elf_hash_table (info)->init_offset;
-
- /* The backend may have to create some sections regardless of whether
- we're dynamic or not. */
- bed = get_elf_backend_data (output_bfd);
- if (bed->elf_backend_always_size_sections
- && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
- return FALSE;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- /* If there were no dynamic objects in the link, there is nothing to
- do here. */
- if (dynobj == NULL)
- return TRUE;
-
- if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
- return FALSE;
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- struct elf_info_failed eif;
- struct elf_link_hash_entry *h;
- asection *dynstr;
- struct bfd_elf_version_tree *t;
- struct bfd_elf_version_expr *d;
- bfd_boolean all_defined;
-
- *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (*sinterpptr != NULL || !info->executable);
-
- if (soname != NULL)
- {
- soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- soname, TRUE);
- if (soname_indx == (bfd_size_type) -1
- || !_bfd_elf_add_dynamic_entry (info, DT_SONAME, soname_indx))
- return FALSE;
- }
-
- if (info->symbolic)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
- return FALSE;
- info->flags |= DF_SYMBOLIC;
- }
-
- if (rpath != NULL)
- {
- bfd_size_type indx;
-
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
- TRUE);
- if (indx == (bfd_size_type) -1
- || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
- return FALSE;
-
- if (info->new_dtags)
- {
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
- if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
- return FALSE;
- }
- }
-
- if (filter_shlib != NULL)
- {
- bfd_size_type indx;
-
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- filter_shlib, TRUE);
- if (indx == (bfd_size_type) -1
- || !_bfd_elf_add_dynamic_entry (info, DT_FILTER, indx))
- return FALSE;
- }
-
- if (auxiliary_filters != NULL)
- {
- const char * const *p;
-
- for (p = auxiliary_filters; *p != NULL; p++)
- {
- bfd_size_type indx;
-
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- *p, TRUE);
- if (indx == (bfd_size_type) -1
- || !_bfd_elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
- return FALSE;
- }
- }
-
- eif.info = info;
- eif.verdefs = verdefs;
- eif.failed = FALSE;
-
- /* If we are supposed to export all symbols into the dynamic symbol
- table (this is not the normal case), then do so. */
- if (info->export_dynamic)
- {
- elf_link_hash_traverse (elf_hash_table (info),
- _bfd_elf_export_symbol,
- &eif);
- if (eif.failed)
- return FALSE;
- }
-
- /* Make all global versions with definition. */
- for (t = verdefs; t != NULL; t = t->next)
- for (d = t->globals.list; d != NULL; d = d->next)
- if (!d->symver && d->symbol)
- {
- const char *verstr, *name;
- size_t namelen, verlen, newlen;
- char *newname, *p;
- struct elf_link_hash_entry *newh;
-
- name = d->symbol;
- namelen = strlen (name);
- verstr = t->name;
- verlen = strlen (verstr);
- newlen = namelen + verlen + 3;
-
- newname = bfd_malloc (newlen);
- if (newname == NULL)
- return FALSE;
- memcpy (newname, name, namelen);
-
- /* Check the hidden versioned definition. */
- p = newname + namelen;
- *p++ = ELF_VER_CHR;
- memcpy (p, verstr, verlen + 1);
- newh = elf_link_hash_lookup (elf_hash_table (info),
- newname, FALSE, FALSE,
- FALSE);
- if (newh == NULL
- || (newh->root.type != bfd_link_hash_defined
- && newh->root.type != bfd_link_hash_defweak))
- {
- /* Check the default versioned definition. */
- *p++ = ELF_VER_CHR;
- memcpy (p, verstr, verlen + 1);
- newh = elf_link_hash_lookup (elf_hash_table (info),
- newname, FALSE, FALSE,
- FALSE);
- }
- free (newname);
-
- /* Mark this version if there is a definition and it is
- not defined in a shared object. */
- if (newh != NULL
- && ((newh->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) == 0)
- && (newh->root.type == bfd_link_hash_defined
- || newh->root.type == bfd_link_hash_defweak))
- d->symver = 1;
- }
-
- /* Attach all the symbols to their version information. */
- asvinfo.output_bfd = output_bfd;
- asvinfo.info = info;
- asvinfo.verdefs = verdefs;
- asvinfo.failed = FALSE;
-
- elf_link_hash_traverse (elf_hash_table (info),
- _bfd_elf_link_assign_sym_version,
- &asvinfo);
- if (asvinfo.failed)
- return FALSE;
-
- if (!info->allow_undefined_version)
- {
- /* Check if all global versions have a definition. */
- all_defined = TRUE;
- for (t = verdefs; t != NULL; t = t->next)
- for (d = t->globals.list; d != NULL; d = d->next)
- if (!d->symver && !d->script)
- {
- (*_bfd_error_handler)
- (_("%s: undefined version: %s"),
- d->pattern, t->name);
- all_defined = FALSE;
- }
-
- if (!all_defined)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
-
- /* Find all symbols which were defined in a dynamic object and make
- the backend pick a reasonable value for them. */
- elf_link_hash_traverse (elf_hash_table (info),
- _bfd_elf_adjust_dynamic_symbol,
- &eif);
- if (eif.failed)
- return FALSE;
-
- /* Add some entries to the .dynamic section. We fill in some of the
- values later, in elf_bfd_final_link, but we must add the entries
- now so that we know the final size of the .dynamic section. */
-
- /* If there are initialization and/or finalization functions to
- call then add the corresponding DT_INIT/DT_FINI entries. */
- h = (info->init_function
- ? elf_link_hash_lookup (elf_hash_table (info),
- info->init_function, FALSE,
- FALSE, FALSE)
- : NULL);
- if (h != NULL
- && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR)) != 0)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_INIT, 0))
- return FALSE;
- }
- h = (info->fini_function
- ? elf_link_hash_lookup (elf_hash_table (info),
- info->fini_function, FALSE,
- FALSE, FALSE)
- : NULL);
- if (h != NULL
- && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR)) != 0)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_FINI, 0))
- return FALSE;
- }
-
- if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL)
- {
- /* DT_PREINIT_ARRAY is not allowed in shared library. */
- if (! info->executable)
- {
- bfd *sub;
- asection *o;
-
- for (sub = info->input_bfds; sub != NULL;
- sub = sub->link_next)
- for (o = sub->sections; o != NULL; o = o->next)
- if (elf_section_data (o)->this_hdr.sh_type
- == SHT_PREINIT_ARRAY)
- {
- (*_bfd_error_handler)
- (_("%s: .preinit_array section is not allowed in DSO"),
- bfd_archive_filename (sub));
- break;
- }
-
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
-
- if (!_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAY, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0))
- return FALSE;
- }
- if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAY, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAYSZ, 0))
- return FALSE;
- }
- if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAYSZ, 0))
- return FALSE;
- }
-
- dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
- /* If .dynstr is excluded from the link, we don't want any of
- these tags. Strictly, we should be checking each section
- individually; This quick check covers for the case where
- someone does a /DISCARD/ : { *(*) }. */
- if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr)
- {
- bfd_size_type strsize;
-
- strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
- if (!_bfd_elf_add_dynamic_entry (info, DT_HASH, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_STRTAB, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize)
- || !_bfd_elf_add_dynamic_entry (info, DT_SYMENT,
- bed->s->sizeof_sym))
- return FALSE;
- }
- }
-
- /* The backend must work out the sizes of all the other dynamic
- sections. */
- if (bed->elf_backend_size_dynamic_sections
- && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
- return FALSE;
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- bfd_size_type dynsymcount;
- asection *s;
- size_t bucketcount = 0;
- size_t hash_entry_size;
- unsigned int dtagcount;
-
- /* Set up the version definition section. */
- s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
- BFD_ASSERT (s != NULL);
-
- /* We may have created additional version definitions if we are
- just linking a regular application. */
- verdefs = asvinfo.verdefs;
-
- /* Skip anonymous version tag. */
- if (verdefs != NULL && verdefs->vernum == 0)
- verdefs = verdefs->next;
-
- if (verdefs == NULL)
- _bfd_strip_section_from_output (info, s);
- else
- {
- unsigned int cdefs;
- bfd_size_type size;
- struct bfd_elf_version_tree *t;
- bfd_byte *p;
- Elf_Internal_Verdef def;
- Elf_Internal_Verdaux defaux;
-
- cdefs = 0;
- size = 0;
-
- /* Make space for the base version. */
- size += sizeof (Elf_External_Verdef);
- size += sizeof (Elf_External_Verdaux);
- ++cdefs;
-
- for (t = verdefs; t != NULL; t = t->next)
- {
- struct bfd_elf_version_deps *n;
-
- size += sizeof (Elf_External_Verdef);
- size += sizeof (Elf_External_Verdaux);
- ++cdefs;
-
- for (n = t->deps; n != NULL; n = n->next)
- size += sizeof (Elf_External_Verdaux);
- }
-
- s->_raw_size = size;
- s->contents = bfd_alloc (output_bfd, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return FALSE;
-
- /* Fill in the version definition section. */
-
- p = s->contents;
-
- def.vd_version = VER_DEF_CURRENT;
- def.vd_flags = VER_FLG_BASE;
- def.vd_ndx = 1;
- def.vd_cnt = 1;
- def.vd_aux = sizeof (Elf_External_Verdef);
- def.vd_next = (sizeof (Elf_External_Verdef)
- + sizeof (Elf_External_Verdaux));
-
- if (soname_indx != (bfd_size_type) -1)
- {
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
- soname_indx);
- def.vd_hash = bfd_elf_hash (soname);
- defaux.vda_name = soname_indx;
- }
- else
- {
- const char *name;
- bfd_size_type indx;
-
- name = basename (output_bfd->filename);
- def.vd_hash = bfd_elf_hash (name);
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- name, FALSE);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- defaux.vda_name = indx;
- }
- defaux.vda_next = 0;
-
- _bfd_elf_swap_verdef_out (output_bfd, &def,
- (Elf_External_Verdef *) p);
- p += sizeof (Elf_External_Verdef);
- _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
- (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
-
- for (t = verdefs; t != NULL; t = t->next)
- {
- unsigned int cdeps;
- struct bfd_elf_version_deps *n;
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
-
- cdeps = 0;
- for (n = t->deps; n != NULL; n = n->next)
- ++cdeps;
-
- /* Add a symbol representing this version. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
- 0, NULL, FALSE,
- get_elf_backend_data (dynobj)->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
- h->verinfo.vertree = t;
-
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- def.vd_version = VER_DEF_CURRENT;
- def.vd_flags = 0;
- if (t->globals.list == NULL
- && t->locals.list == NULL
- && ! t->used)
- def.vd_flags |= VER_FLG_WEAK;
- def.vd_ndx = t->vernum + 1;
- def.vd_cnt = cdeps + 1;
- def.vd_hash = bfd_elf_hash (t->name);
- def.vd_aux = sizeof (Elf_External_Verdef);
- def.vd_next = 0;
- if (t->next != NULL)
- def.vd_next = (sizeof (Elf_External_Verdef)
- + (cdeps + 1) * sizeof (Elf_External_Verdaux));
-
- _bfd_elf_swap_verdef_out (output_bfd, &def,
- (Elf_External_Verdef *) p);
- p += sizeof (Elf_External_Verdef);
-
- defaux.vda_name = h->dynstr_index;
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
- h->dynstr_index);
- defaux.vda_next = 0;
- if (t->deps != NULL)
- defaux.vda_next = sizeof (Elf_External_Verdaux);
- t->name_indx = defaux.vda_name;
-
- _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
- (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
-
- for (n = t->deps; n != NULL; n = n->next)
- {
- if (n->version_needed == NULL)
- {
- /* This can happen if there was an error in the
- version script. */
- defaux.vda_name = 0;
- }
- else
- {
- defaux.vda_name = n->version_needed->name_indx;
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
- defaux.vda_name);
- }
- if (n->next == NULL)
- defaux.vda_next = 0;
- else
- defaux.vda_next = sizeof (Elf_External_Verdaux);
-
- _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
- (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
- }
- }
-
- if (!_bfd_elf_add_dynamic_entry (info, DT_VERDEF, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs))
- return FALSE;
-
- elf_tdata (output_bfd)->cverdefs = cdefs;
- }
-
- if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
- return FALSE;
- }
- else if (info->flags & DF_BIND_NOW)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_BIND_NOW, 0))
- return FALSE;
- }
-
- if (info->flags_1)
- {
- if (info->executable)
- info->flags_1 &= ~ (DF_1_INITFIRST
- | DF_1_NODELETE
- | DF_1_NOOPEN);
- if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
- return FALSE;
- }
-
- /* Work out the size of the version reference section. */
-
- s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
- BFD_ASSERT (s != NULL);
- {
- struct elf_find_verdep_info sinfo;
-
- sinfo.output_bfd = output_bfd;
- sinfo.info = info;
- sinfo.vers = elf_tdata (output_bfd)->cverdefs;
- if (sinfo.vers == 0)
- sinfo.vers = 1;
- sinfo.failed = FALSE;
-
- elf_link_hash_traverse (elf_hash_table (info),
- _bfd_elf_link_find_version_dependencies,
- &sinfo);
-
- if (elf_tdata (output_bfd)->verref == NULL)
- _bfd_strip_section_from_output (info, s);
- else
- {
- Elf_Internal_Verneed *t;
- unsigned int size;
- unsigned int crefs;
- bfd_byte *p;
-
- /* Build the version definition section. */
- size = 0;
- crefs = 0;
- for (t = elf_tdata (output_bfd)->verref;
- t != NULL;
- t = t->vn_nextref)
- {
- Elf_Internal_Vernaux *a;
-
- size += sizeof (Elf_External_Verneed);
- ++crefs;
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- size += sizeof (Elf_External_Vernaux);
- }
-
- s->_raw_size = size;
- s->contents = bfd_alloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
-
- p = s->contents;
- for (t = elf_tdata (output_bfd)->verref;
- t != NULL;
- t = t->vn_nextref)
- {
- unsigned int caux;
- Elf_Internal_Vernaux *a;
- bfd_size_type indx;
-
- caux = 0;
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- ++caux;
-
- t->vn_version = VER_NEED_CURRENT;
- t->vn_cnt = caux;
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- elf_dt_name (t->vn_bfd) != NULL
- ? elf_dt_name (t->vn_bfd)
- : basename (t->vn_bfd->filename),
- FALSE);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- t->vn_file = indx;
- t->vn_aux = sizeof (Elf_External_Verneed);
- if (t->vn_nextref == NULL)
- t->vn_next = 0;
- else
- t->vn_next = (sizeof (Elf_External_Verneed)
- + caux * sizeof (Elf_External_Vernaux));
-
- _bfd_elf_swap_verneed_out (output_bfd, t,
- (Elf_External_Verneed *) p);
- p += sizeof (Elf_External_Verneed);
-
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- {
- a->vna_hash = bfd_elf_hash (a->vna_nodename);
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- a->vna_nodename, FALSE);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- a->vna_name = indx;
- if (a->vna_nextptr == NULL)
- a->vna_next = 0;
- else
- a->vna_next = sizeof (Elf_External_Vernaux);
-
- _bfd_elf_swap_vernaux_out (output_bfd, a,
- (Elf_External_Vernaux *) p);
- p += sizeof (Elf_External_Vernaux);
- }
- }
-
- if (!_bfd_elf_add_dynamic_entry (info, DT_VERNEED, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs))
- return FALSE;
-
- elf_tdata (output_bfd)->cverrefs = crefs;
- }
- }
-
- /* Assign dynsym indicies. In a shared library we generate a
- section symbol for each output section, which come first.
- Next come all of the back-end allocated local dynamic syms,
- followed by the rest of the global symbols. */
-
- dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
-
- /* Work out the size of the symbol version section. */
- s = bfd_get_section_by_name (dynobj, ".gnu.version");
- BFD_ASSERT (s != NULL);
- if (dynsymcount == 0
- || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL))
- {
- _bfd_strip_section_from_output (info, s);
- /* The DYNSYMCOUNT might have changed if we were going to
- output a dynamic symbol table entry for S. */
- dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
- }
- else
- {
- s->_raw_size = dynsymcount * sizeof (Elf_External_Versym);
- s->contents = bfd_zalloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
-
- if (!_bfd_elf_add_dynamic_entry (info, DT_VERSYM, 0))
- return FALSE;
- }
-
- /* Set the size of the .dynsym and .hash sections. We counted
- the number of dynamic symbols in elf_link_add_object_symbols.
- We will build the contents of .dynsym and .hash when we build
- the final symbol table, because until then we do not know the
- correct value to give the symbols. We built the .dynstr
- section as we went along in elf_link_add_object_symbols. */
- s = bfd_get_section_by_name (dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- s->_raw_size = dynsymcount * bed->s->sizeof_sym;
- s->contents = bfd_alloc (output_bfd, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return FALSE;
-
- if (dynsymcount != 0)
- {
- Elf_Internal_Sym isym;
-
- /* The first entry in .dynsym is a dummy symbol. */
- isym.st_value = 0;
- isym.st_size = 0;
- isym.st_name = 0;
- isym.st_info = 0;
- isym.st_other = 0;
- isym.st_shndx = 0;
- bed->s->swap_symbol_out (output_bfd, &isym, s->contents, 0);
- }
-
- /* Compute the size of the hashing table. As a side effect this
- computes the hash values for all the names we export. */
- bucketcount = compute_bucket_count (info);
-
- s = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
- hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
- s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
- s->contents = bfd_zalloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
-
- bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
- bfd_put (8 * hash_entry_size, output_bfd, dynsymcount,
- s->contents + hash_entry_size);
-
- elf_hash_table (info)->bucketcount = bucketcount;
-
- s = bfd_get_section_by_name (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
-
- elf_finalize_dynstr (output_bfd, info);
-
- s->_raw_size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
-
- for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
- if (!_bfd_elf_add_dynamic_entry (info, DT_NULL, 0))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Final phase of ELF linker. */
-
-/* A structure we use to avoid passing large numbers of arguments. */
-
-struct elf_final_link_info
-{
- /* General link information. */
- struct bfd_link_info *info;
- /* Output BFD. */
- bfd *output_bfd;
- /* Symbol string table. */
- struct bfd_strtab_hash *symstrtab;
- /* .dynsym section. */
- asection *dynsym_sec;
- /* .hash section. */
- asection *hash_sec;
- /* symbol version section (.gnu.version). */
- asection *symver_sec;
- /* Buffer large enough to hold contents of any section. */
- bfd_byte *contents;
- /* Buffer large enough to hold external relocs of any section. */
- void *external_relocs;
- /* Buffer large enough to hold internal relocs of any section. */
- Elf_Internal_Rela *internal_relocs;
- /* Buffer large enough to hold external local symbols of any input
- BFD. */
- bfd_byte *external_syms;
- /* And a buffer for symbol section indices. */
- Elf_External_Sym_Shndx *locsym_shndx;
- /* Buffer large enough to hold internal local symbols of any input
- BFD. */
- Elf_Internal_Sym *internal_syms;
- /* Array large enough to hold a symbol index for each local symbol
- of any input BFD. */
- long *indices;
- /* Array large enough to hold a section pointer for each local
- symbol of any input BFD. */
- asection **sections;
- /* Buffer to hold swapped out symbols. */
- bfd_byte *symbuf;
- /* And one for symbol section indices. */
- Elf_External_Sym_Shndx *symshndxbuf;
- /* Number of swapped out symbols in buffer. */
- size_t symbuf_count;
- /* Number of symbols which fit in symbuf. */
- size_t symbuf_size;
- /* And same for symshndxbuf. */
- size_t shndxbuf_size;
-};
-
-/* This struct is used to pass information to elf_link_output_extsym. */
-
-struct elf_outext_info
-{
- bfd_boolean failed;
- bfd_boolean localsyms;
- struct elf_final_link_info *finfo;
-};
-
-/* When performing a relocatable link, the input relocations are
- preserved. But, if they reference global symbols, the indices
- referenced must be updated. Update all the relocations in
- REL_HDR (there are COUNT of them), using the data in REL_HASH. */
-
-static void
-elf_link_adjust_relocs (bfd *abfd,
- Elf_Internal_Shdr *rel_hdr,
- unsigned int count,
- struct elf_link_hash_entry **rel_hash)
-{
- unsigned int i;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_byte *erela;
- void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
- void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
- bfd_vma r_type_mask;
- int r_sym_shift;
-
- if (rel_hdr->sh_entsize == bed->s->sizeof_rel)
- {
- swap_in = bed->s->swap_reloc_in;
- swap_out = bed->s->swap_reloc_out;
- }
- else if (rel_hdr->sh_entsize == bed->s->sizeof_rela)
- {
- swap_in = bed->s->swap_reloca_in;
- swap_out = bed->s->swap_reloca_out;
- }
- else
- abort ();
-
- if (bed->s->int_rels_per_ext_rel > MAX_INT_RELS_PER_EXT_REL)
- abort ();
-
- if (bed->s->arch_size == 32)
- {
- r_type_mask = 0xff;
- r_sym_shift = 8;
- }
- else
- {
- r_type_mask = 0xffffffff;
- r_sym_shift = 32;
- }
-
- erela = rel_hdr->contents;
- for (i = 0; i < count; i++, rel_hash++, erela += rel_hdr->sh_entsize)
- {
- Elf_Internal_Rela irela[MAX_INT_RELS_PER_EXT_REL];
- unsigned int j;
-
- if (*rel_hash == NULL)
- continue;
-
- BFD_ASSERT ((*rel_hash)->indx >= 0);
-
- (*swap_in) (abfd, erela, irela);
- for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
- irela[j].r_info = ((bfd_vma) (*rel_hash)->indx << r_sym_shift
- | (irela[j].r_info & r_type_mask));
- (*swap_out) (abfd, irela, erela);
- }
-}
-
-struct elf_link_sort_rela
-{
- union {
- bfd_vma offset;
- bfd_vma sym_mask;
- } u;
- enum elf_reloc_type_class type;
- /* We use this as an array of size int_rels_per_ext_rel. */
- Elf_Internal_Rela rela[1];
-};
-
-static int
-elf_link_sort_cmp1 (const void *A, const void *B)
-{
- const struct elf_link_sort_rela *a = A;
- const struct elf_link_sort_rela *b = B;
- int relativea, relativeb;
-
- relativea = a->type == reloc_class_relative;
- relativeb = b->type == reloc_class_relative;
-
- if (relativea < relativeb)
- return 1;
- if (relativea > relativeb)
- return -1;
- if ((a->rela->r_info & a->u.sym_mask) < (b->rela->r_info & b->u.sym_mask))
- return -1;
- if ((a->rela->r_info & a->u.sym_mask) > (b->rela->r_info & b->u.sym_mask))
- return 1;
- if (a->rela->r_offset < b->rela->r_offset)
- return -1;
- if (a->rela->r_offset > b->rela->r_offset)
- return 1;
- return 0;
-}
-
-static int
-elf_link_sort_cmp2 (const void *A, const void *B)
-{
- const struct elf_link_sort_rela *a = A;
- const struct elf_link_sort_rela *b = B;
- int copya, copyb;
-
- if (a->u.offset < b->u.offset)
- return -1;
- if (a->u.offset > b->u.offset)
- return 1;
- copya = (a->type == reloc_class_copy) * 2 + (a->type == reloc_class_plt);
- copyb = (b->type == reloc_class_copy) * 2 + (b->type == reloc_class_plt);
- if (copya < copyb)
- return -1;
- if (copya > copyb)
- return 1;
- if (a->rela->r_offset < b->rela->r_offset)
- return -1;
- if (a->rela->r_offset > b->rela->r_offset)
- return 1;
- return 0;
-}
-
-static size_t
-elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
-{
- asection *reldyn;
- bfd_size_type count, size;
- size_t i, ret, sort_elt, ext_size;
- bfd_byte *sort, *s_non_relative, *p;
- struct elf_link_sort_rela *sq;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- int i2e = bed->s->int_rels_per_ext_rel;
- void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
- void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
- struct bfd_link_order *lo;
- bfd_vma r_sym_mask;
-
- reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
- if (reldyn == NULL || reldyn->_raw_size == 0)
- {
- reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
- if (reldyn == NULL || reldyn->_raw_size == 0)
- return 0;
- ext_size = bed->s->sizeof_rel;
- swap_in = bed->s->swap_reloc_in;
- swap_out = bed->s->swap_reloc_out;
- }
- else
- {
- ext_size = bed->s->sizeof_rela;
- swap_in = bed->s->swap_reloca_in;
- swap_out = bed->s->swap_reloca_out;
- }
- count = reldyn->_raw_size / ext_size;
-
- size = 0;
- for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
- if (lo->type == bfd_indirect_link_order)
- {
- asection *o = lo->u.indirect.section;
- size += o->_raw_size;
- }
-
- if (size != reldyn->_raw_size)
- return 0;
-
- sort_elt = (sizeof (struct elf_link_sort_rela)
- + (i2e - 1) * sizeof (Elf_Internal_Rela));
- sort = bfd_zmalloc (sort_elt * count);
- if (sort == NULL)
- {
- (*info->callbacks->warning)
- (info, _("Not enough memory to sort relocations"), 0, abfd, 0, 0);
- return 0;
- }
-
- if (bed->s->arch_size == 32)
- r_sym_mask = ~(bfd_vma) 0xff;
- else
- r_sym_mask = ~(bfd_vma) 0xffffffff;
-
- for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
- if (lo->type == bfd_indirect_link_order)
- {
- bfd_byte *erel, *erelend;
- asection *o = lo->u.indirect.section;
-
- erel = o->contents;
- erelend = o->contents + o->_raw_size;
- p = sort + o->output_offset / ext_size * sort_elt;
- while (erel < erelend)
- {
- struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
- (*swap_in) (abfd, erel, s->rela);
- s->type = (*bed->elf_backend_reloc_type_class) (s->rela);
- s->u.sym_mask = r_sym_mask;
- p += sort_elt;
- erel += ext_size;
- }
- }
-
- qsort (sort, count, sort_elt, elf_link_sort_cmp1);
-
- for (i = 0, p = sort; i < count; i++, p += sort_elt)
- {
- struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
- if (s->type != reloc_class_relative)
- break;
- }
- ret = i;
- s_non_relative = p;
-
- sq = (struct elf_link_sort_rela *) s_non_relative;
- for (; i < count; i++, p += sort_elt)
- {
- struct elf_link_sort_rela *sp = (struct elf_link_sort_rela *) p;
- if (((sp->rela->r_info ^ sq->rela->r_info) & r_sym_mask) != 0)
- sq = sp;
- sp->u.offset = sq->rela->r_offset;
- }
-
- qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2);
-
- for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
- if (lo->type == bfd_indirect_link_order)
- {
- bfd_byte *erel, *erelend;
- asection *o = lo->u.indirect.section;
-
- erel = o->contents;
- erelend = o->contents + o->_raw_size;
- p = sort + o->output_offset / ext_size * sort_elt;
- while (erel < erelend)
- {
- struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
- (*swap_out) (abfd, s->rela, erel);
- p += sort_elt;
- erel += ext_size;
- }
- }
-
- free (sort);
- *psec = reldyn;
- return ret;
-}
-
-/* Flush the output symbols to the file. */
-
-static bfd_boolean
-elf_link_flush_output_syms (struct elf_final_link_info *finfo,
- const struct elf_backend_data *bed)
-{
- if (finfo->symbuf_count > 0)
- {
- Elf_Internal_Shdr *hdr;
- file_ptr pos;
- bfd_size_type amt;
-
- hdr = &elf_tdata (finfo->output_bfd)->symtab_hdr;
- pos = hdr->sh_offset + hdr->sh_size;
- amt = finfo->symbuf_count * bed->s->sizeof_sym;
- if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (finfo->symbuf, amt, finfo->output_bfd) != amt)
- return FALSE;
-
- hdr->sh_size += amt;
- finfo->symbuf_count = 0;
- }
-
- return TRUE;
-}
-
-/* Add a symbol to the output symbol table. */
-
-static bfd_boolean
-elf_link_output_sym (struct elf_final_link_info *finfo,
- const char *name,
- Elf_Internal_Sym *elfsym,
- asection *input_sec,
- struct elf_link_hash_entry *h)
-{
- bfd_byte *dest;
- Elf_External_Sym_Shndx *destshndx;
- bfd_boolean (*output_symbol_hook)
- (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
- struct elf_link_hash_entry *);
- const struct elf_backend_data *bed;
-
- bed = get_elf_backend_data (finfo->output_bfd);
- output_symbol_hook = bed->elf_backend_link_output_symbol_hook;
- if (output_symbol_hook != NULL)
- {
- if (! (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h))
- return FALSE;
- }
-
- if (name == NULL || *name == '\0')
- elfsym->st_name = 0;
- else if (input_sec->flags & SEC_EXCLUDE)
- elfsym->st_name = 0;
- else
- {
- elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
- name, TRUE, FALSE);
- if (elfsym->st_name == (unsigned long) -1)
- return FALSE;
- }
-
- if (finfo->symbuf_count >= finfo->symbuf_size)
- {
- if (! elf_link_flush_output_syms (finfo, bed))
- return FALSE;
- }
-
- dest = finfo->symbuf + finfo->symbuf_count * bed->s->sizeof_sym;
- destshndx = finfo->symshndxbuf;
- if (destshndx != NULL)
- {
- if (bfd_get_symcount (finfo->output_bfd) >= finfo->shndxbuf_size)
- {
- bfd_size_type amt;
-
- amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
- finfo->symshndxbuf = destshndx = bfd_realloc (destshndx, amt * 2);
- if (destshndx == NULL)
- return FALSE;
- memset ((char *) destshndx + amt, 0, amt);
- finfo->shndxbuf_size *= 2;
- }
- destshndx += bfd_get_symcount (finfo->output_bfd);
- }
-
- bed->s->swap_symbol_out (finfo->output_bfd, elfsym, dest, destshndx);
- finfo->symbuf_count += 1;
- bfd_get_symcount (finfo->output_bfd) += 1;
-
- return TRUE;
-}
-
-/* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in
- allowing an unsatisfied unversioned symbol in the DSO to match a
- versioned symbol that would normally require an explicit version.
- We also handle the case that a DSO references a hidden symbol
- which may be satisfied by a versioned symbol in another DSO. */
-
-static bfd_boolean
-elf_link_check_versioned_symbol (struct bfd_link_info *info,
- const struct elf_backend_data *bed,
- struct elf_link_hash_entry *h)
-{
- bfd *abfd;
- struct elf_link_loaded_list *loaded;
-
- if (!is_elf_hash_table (info->hash))
- return FALSE;
-
- switch (h->root.type)
- {
- default:
- abfd = NULL;
- break;
-
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- abfd = h->root.u.undef.abfd;
- if ((abfd->flags & DYNAMIC) == 0
- || elf_dyn_lib_class (abfd) != DYN_DT_NEEDED)
- return FALSE;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- abfd = h->root.u.def.section->owner;
- break;
-
- case bfd_link_hash_common:
- abfd = h->root.u.c.p->section->owner;
- break;
- }
- BFD_ASSERT (abfd != NULL);
-
- for (loaded = elf_hash_table (info)->loaded;
- loaded != NULL;
- loaded = loaded->next)
- {
- bfd *input;
- Elf_Internal_Shdr *hdr;
- bfd_size_type symcount;
- bfd_size_type extsymcount;
- bfd_size_type extsymoff;
- Elf_Internal_Shdr *versymhdr;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- Elf_Internal_Sym *isymbuf;
- Elf_External_Versym *ever;
- Elf_External_Versym *extversym;
-
- input = loaded->abfd;
-
- /* We check each DSO for a possible hidden versioned definition. */
- if (input == abfd
- || (input->flags & DYNAMIC) == 0
- || elf_dynversym (input) == 0)
- continue;
-
- hdr = &elf_tdata (input)->dynsymtab_hdr;
-
- symcount = hdr->sh_size / bed->s->sizeof_sym;
- if (elf_bad_symtab (input))
- {
- extsymcount = symcount;
- extsymoff = 0;
- }
- else
- {
- extsymcount = symcount - hdr->sh_info;
- extsymoff = hdr->sh_info;
- }
-
- if (extsymcount == 0)
- continue;
-
- isymbuf = bfd_elf_get_elf_syms (input, hdr, extsymcount, extsymoff,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- return FALSE;
-
- /* Read in any version definitions. */
- versymhdr = &elf_tdata (input)->dynversym_hdr;
- extversym = bfd_malloc (versymhdr->sh_size);
- if (extversym == NULL)
- goto error_ret;
-
- if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread (extversym, versymhdr->sh_size, input)
- != versymhdr->sh_size))
- {
- free (extversym);
- error_ret:
- free (isymbuf);
- return FALSE;
- }
-
- ever = extversym + extsymoff;
- isymend = isymbuf + extsymcount;
- for (isym = isymbuf; isym < isymend; isym++, ever++)
- {
- const char *name;
- Elf_Internal_Versym iver;
- unsigned short version_index;
-
- if (ELF_ST_BIND (isym->st_info) == STB_LOCAL
- || isym->st_shndx == SHN_UNDEF)
- continue;
-
- name = bfd_elf_string_from_elf_section (input,
- hdr->sh_link,
- isym->st_name);
- if (strcmp (name, h->root.root.string) != 0)
- continue;
-
- _bfd_elf_swap_versym_in (input, ever, &iver);
-
- if ((iver.vs_vers & VERSYM_HIDDEN) == 0)
- {
- /* If we have a non-hidden versioned sym, then it should
- have provided a definition for the undefined sym. */
- abort ();
- }
-
- version_index = iver.vs_vers & VERSYM_VERSION;
- if (version_index == 1 || version_index == 2)
- {
- /* This is the base or first version. We can use it. */
- free (extversym);
- free (isymbuf);
- return TRUE;
- }
- }
-
- free (extversym);
- free (isymbuf);
- }
-
- return FALSE;
-}
-
-/* Add an external symbol to the symbol table. This is called from
- the hash table traversal routine. When generating a shared object,
- we go through the symbol table twice. The first time we output
- anything that might have been forced to local scope in a version
- script. The second time we output the symbols that are still
- global symbols. */
-
-static bfd_boolean
-elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
-{
- struct elf_outext_info *eoinfo = data;
- struct elf_final_link_info *finfo = eoinfo->finfo;
- bfd_boolean strip;
- Elf_Internal_Sym sym;
- asection *input_sec;
- const struct elf_backend_data *bed;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (h->root.type == bfd_link_hash_new)
- return TRUE;
- }
-
- /* Decide whether to output this symbol in this pass. */
- if (eoinfo->localsyms)
- {
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- return TRUE;
- }
- else
- {
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- return TRUE;
- }
-
- bed = get_elf_backend_data (finfo->output_bfd);
-
- /* If we have an undefined symbol reference here then it must have
- come from a shared library that is being linked in. (Undefined
- references in regular files have already been handled). If we
- are reporting errors for this situation then do so now. */
- if (h->root.type == bfd_link_hash_undefined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
- && ! elf_link_check_versioned_symbol (finfo->info, bed, h)
- && finfo->info->unresolved_syms_in_shared_libs != RM_IGNORE)
- {
- if (! ((*finfo->info->callbacks->undefined_symbol)
- (finfo->info, h->root.root.string, h->root.u.undef.abfd,
- NULL, 0, finfo->info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR)))
- {
- eoinfo->failed = TRUE;
- return FALSE;
- }
- }
-
- /* We should also warn if a forced local symbol is referenced from
- shared libraries. */
- if (! finfo->info->relocatable
- && (! finfo->info->shared)
- && (h->elf_link_hash_flags
- & (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_DYNAMIC_DEF | ELF_LINK_DYNAMIC_WEAK))
- == (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC)
- && ! elf_link_check_versioned_symbol (finfo->info, bed, h))
- {
- (*_bfd_error_handler)
- (_("%s: %s symbol `%s' in %s is referenced by DSO"),
- bfd_get_filename (finfo->output_bfd),
- ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
- ? "internal"
- : ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
- ? "hidden" : "local",
- h->root.root.string,
- bfd_archive_filename (h->root.u.def.section->owner));
- eoinfo->failed = TRUE;
- return FALSE;
- }
-
- /* We don't want to output symbols that have never been mentioned by
- a regular file, or that we have been told to strip. However, if
- h->indx is set to -2, the symbol is used by a reloc and we must
- output it. */
- if (h->indx == -2)
- strip = FALSE;
- else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
- strip = TRUE;
- else if (finfo->info->strip == strip_all)
- strip = TRUE;
- else if (finfo->info->strip == strip_some
- && bfd_hash_lookup (finfo->info->keep_hash,
- h->root.root.string, FALSE, FALSE) == NULL)
- strip = TRUE;
- else if (finfo->info->strip_discarded
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && elf_discarded_section (h->root.u.def.section))
- strip = TRUE;
- else
- strip = FALSE;
-
- /* If we're stripping it, and it's not a dynamic symbol, there's
- nothing else to do unless it is a forced local symbol. */
- if (strip
- && h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- return TRUE;
-
- sym.st_value = 0;
- sym.st_size = h->size;
- sym.st_other = h->other;
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type);
- else if (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_defweak)
- sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
- else
- sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type);
-
- switch (h->root.type)
- {
- default:
- case bfd_link_hash_new:
- case bfd_link_hash_warning:
- abort ();
- return FALSE;
-
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- input_sec = bfd_und_section_ptr;
- sym.st_shndx = SHN_UNDEF;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- {
- input_sec = h->root.u.def.section;
- if (input_sec->output_section != NULL)
- {
- sym.st_shndx =
- _bfd_elf_section_from_bfd_section (finfo->output_bfd,
- input_sec->output_section);
- if (sym.st_shndx == SHN_BAD)
- {
- (*_bfd_error_handler)
- (_("%s: could not find output section %s for input section %s"),
- bfd_get_filename (finfo->output_bfd),
- input_sec->output_section->name,
- input_sec->name);
- eoinfo->failed = TRUE;
- return FALSE;
- }
-
- /* ELF symbols in relocatable files are section relative,
- but in nonrelocatable files they are virtual
- addresses. */
- sym.st_value = h->root.u.def.value + input_sec->output_offset;
- if (! finfo->info->relocatable)
- {
- sym.st_value += input_sec->output_section->vma;
- if (h->type == STT_TLS)
- {
- /* STT_TLS symbols are relative to PT_TLS segment
- base. */
- BFD_ASSERT (elf_hash_table (finfo->info)->tls_sec != NULL);
- sym.st_value -= elf_hash_table (finfo->info)->tls_sec->vma;
- }
- }
- }
- else
- {
- BFD_ASSERT (input_sec->owner == NULL
- || (input_sec->owner->flags & DYNAMIC) != 0);
- sym.st_shndx = SHN_UNDEF;
- input_sec = bfd_und_section_ptr;
- }
- }
- break;
-
- case bfd_link_hash_common:
- input_sec = h->root.u.c.p->section;
- sym.st_shndx = SHN_COMMON;
- sym.st_value = 1 << h->root.u.c.p->alignment_power;
- break;
-
- case bfd_link_hash_indirect:
- /* These symbols are created by symbol versioning. They point
- to the decorated version of the name. For example, if the
- symbol foo@@GNU_1.2 is the default, which should be used when
- foo is used with no version, then we add an indirect symbol
- foo which points to foo@@GNU_1.2. We ignore these symbols,
- since the indirected symbol is already in the hash table. */
- return TRUE;
- }
-
- /* Give the processor backend a chance to tweak the symbol value,
- and also to finish up anything that needs to be done for this
- symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for
- forced local syms when non-shared is due to a historical quirk. */
- if ((h->dynindx != -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- && ((finfo->info->shared
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- && elf_hash_table (finfo->info)->dynamic_sections_created)
- {
- if (! ((*bed->elf_backend_finish_dynamic_symbol)
- (finfo->output_bfd, finfo->info, h, &sym)))
- {
- eoinfo->failed = TRUE;
- return FALSE;
- }
- }
-
- /* If we are marking the symbol as undefined, and there are no
- non-weak references to this symbol from a regular object, then
- mark the symbol as weak undefined; if there are non-weak
- references, mark the symbol as strong. We can't do this earlier,
- because it might not be marked as undefined until the
- finish_dynamic_symbol routine gets through with it. */
- if (sym.st_shndx == SHN_UNDEF
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
- && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL
- || ELF_ST_BIND (sym.st_info) == STB_WEAK))
- {
- int bindtype;
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0)
- bindtype = STB_GLOBAL;
- else
- bindtype = STB_WEAK;
- sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
- }
-
- /* If a non-weak symbol with non-default visibility is not defined
- locally, it is a fatal error. */
- if (! finfo->info->relocatable
- && ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT
- && ELF_ST_BIND (sym.st_info) != STB_WEAK
- && h->root.type == bfd_link_hash_undefined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- (*_bfd_error_handler)
- (_("%s: %s symbol `%s' isn't defined"),
- bfd_get_filename (finfo->output_bfd),
- ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED
- ? "protected"
- : ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL
- ? "internal" : "hidden",
- h->root.root.string);
- eoinfo->failed = TRUE;
- return FALSE;
- }
-
- /* If this symbol should be put in the .dynsym section, then put it
- there now. We already know the symbol index. We also fill in
- the entry in the .hash section. */
- if (h->dynindx != -1
- && elf_hash_table (finfo->info)->dynamic_sections_created)
- {
- size_t bucketcount;
- size_t bucket;
- size_t hash_entry_size;
- bfd_byte *bucketpos;
- bfd_vma chain;
- bfd_byte *esym;
-
- sym.st_name = h->dynstr_index;
- esym = finfo->dynsym_sec->contents + h->dynindx * bed->s->sizeof_sym;
- bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0);
-
- bucketcount = elf_hash_table (finfo->info)->bucketcount;
- bucket = h->elf_hash_value % bucketcount;
- hash_entry_size
- = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
- bucketpos = ((bfd_byte *) finfo->hash_sec->contents
- + (bucket + 2) * hash_entry_size);
- chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
- ((bfd_byte *) finfo->hash_sec->contents
- + (bucketcount + 2 + h->dynindx) * hash_entry_size));
-
- if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
- {
- Elf_Internal_Versym iversym;
- Elf_External_Versym *eversym;
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- if (h->verinfo.verdef == NULL)
- iversym.vs_vers = 0;
- else
- iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1;
- }
- else
- {
- if (h->verinfo.vertree == NULL)
- iversym.vs_vers = 1;
- else
- iversym.vs_vers = h->verinfo.vertree->vernum + 1;
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0)
- iversym.vs_vers |= VERSYM_HIDDEN;
-
- eversym = (Elf_External_Versym *) finfo->symver_sec->contents;
- eversym += h->dynindx;
- _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
- }
- }
-
- /* If we're stripping it, then it was just a dynamic symbol, and
- there's nothing else to do. */
- if (strip || (input_sec->flags & SEC_EXCLUDE) != 0)
- return TRUE;
-
- h->indx = bfd_get_symcount (finfo->output_bfd);
-
- if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h))
- {
- eoinfo->failed = TRUE;
- return FALSE;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-elf_section_ignore_discarded_relocs (asection *sec)
-{
- const struct elf_backend_data *bed;
-
- switch (sec->sec_info_type)
- {
- case ELF_INFO_TYPE_STABS:
- case ELF_INFO_TYPE_EH_FRAME:
- return TRUE;
- default:
- break;
- }
-
- bed = get_elf_backend_data (sec->owner);
- if (bed->elf_backend_ignore_discarded_relocs != NULL
- && (*bed->elf_backend_ignore_discarded_relocs) (sec))
- return TRUE;
-
- return FALSE;
-}
-
-/* Link an input file into the linker output file. This function
- handles all the sections and relocations of the input file at once.
- This is so that we only have to read the local symbols once, and
- don't have to keep them in memory. */
-
-static bfd_boolean
-elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
-{
- bfd_boolean (*relocate_section)
- (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
- bfd *output_bfd;
- Elf_Internal_Shdr *symtab_hdr;
- size_t locsymcount;
- size_t extsymoff;
- Elf_Internal_Sym *isymbuf;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- long *pindex;
- asection **ppsection;
- asection *o;
- const struct elf_backend_data *bed;
- bfd_boolean emit_relocs;
- struct elf_link_hash_entry **sym_hashes;
-
- output_bfd = finfo->output_bfd;
- bed = get_elf_backend_data (output_bfd);
- relocate_section = bed->elf_backend_relocate_section;
-
- /* If this is a dynamic object, we don't want to do anything here:
- we don't want the local symbols, and we don't want the section
- contents. */
- if ((input_bfd->flags & DYNAMIC) != 0)
- return TRUE;
-
- emit_relocs = (finfo->info->relocatable
- || finfo->info->emitrelocations
- || bed->elf_backend_emit_relocs);
-
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- if (elf_bad_symtab (input_bfd))
- {
- locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
- extsymoff = 0;
- }
- else
- {
- locsymcount = symtab_hdr->sh_info;
- extsymoff = symtab_hdr->sh_info;
- }
-
- /* Read the local symbols. */
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL && locsymcount != 0)
- {
- isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
- finfo->internal_syms,
- finfo->external_syms,
- finfo->locsym_shndx);
- if (isymbuf == NULL)
- return FALSE;
- }
-
- /* Find local symbol sections and adjust values of symbols in
- SEC_MERGE sections. Write out those local symbols we know are
- going into the output file. */
- isymend = isymbuf + locsymcount;
- for (isym = isymbuf, pindex = finfo->indices, ppsection = finfo->sections;
- isym < isymend;
- isym++, pindex++, ppsection++)
- {
- asection *isec;
- const char *name;
- Elf_Internal_Sym osym;
-
- *pindex = -1;
-
- if (elf_bad_symtab (input_bfd))
- {
- if (ELF_ST_BIND (isym->st_info) != STB_LOCAL)
- {
- *ppsection = NULL;
- continue;
- }
- }
-
- if (isym->st_shndx == SHN_UNDEF)
- isec = bfd_und_section_ptr;
- else if (isym->st_shndx < SHN_LORESERVE
- || isym->st_shndx > SHN_HIRESERVE)
- {
- isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx);
- if (isec
- && isec->sec_info_type == ELF_INFO_TYPE_MERGE
- && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
- isym->st_value =
- _bfd_merged_section_offset (output_bfd, &isec,
- elf_section_data (isec)->sec_info,
- isym->st_value, 0);
- }
- else if (isym->st_shndx == SHN_ABS)
- isec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- isec = bfd_com_section_ptr;
- else
- {
- /* Who knows? */
- isec = NULL;
- }
-
- *ppsection = isec;
-
- /* Don't output the first, undefined, symbol. */
- if (ppsection == finfo->sections)
- continue;
-
- if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
- {
- /* We never output section symbols. Instead, we use the
- section symbol of the corresponding section in the output
- file. */
- continue;
- }
-
- /* If we are stripping all symbols, we don't want to output this
- one. */
- if (finfo->info->strip == strip_all)
- continue;
-
- /* If we are discarding all local symbols, we don't want to
- output this one. If we are generating a relocatable output
- file, then some of the local symbols may be required by
- relocs; we output them below as we discover that they are
- needed. */
- if (finfo->info->discard == discard_all)
- continue;
-
- /* If this symbol is defined in a section which we are
- discarding, we don't need to keep it, but note that
- linker_mark is only reliable for sections that have contents.
- For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
- as well as linker_mark. */
- if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
- && isec != NULL
- && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
- || (! finfo->info->relocatable
- && (isec->flags & SEC_EXCLUDE) != 0)))
- continue;
-
- /* Get the name of the symbol. */
- name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
- isym->st_name);
- if (name == NULL)
- return FALSE;
-
- /* See if we are discarding symbols with this name. */
- if ((finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
- == NULL))
- || (((finfo->info->discard == discard_sec_merge
- && (isec->flags & SEC_MERGE) && ! finfo->info->relocatable)
- || finfo->info->discard == discard_l)
- && bfd_is_local_label_name (input_bfd, name)))
- continue;
-
- /* If we get here, we are going to output this symbol. */
-
- osym = *isym;
-
- /* Adjust the section index for the output file. */
- osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
- isec->output_section);
- if (osym.st_shndx == SHN_BAD)
- return FALSE;
-
- *pindex = bfd_get_symcount (output_bfd);
-
- /* ELF symbols in relocatable files are section relative, but
- in executable files they are virtual addresses. Note that
- this code assumes that all ELF sections have an associated
- BFD section with a reasonable value for output_offset; below
- we assume that they also have a reasonable value for
- output_section. Any special sections must be set up to meet
- these requirements. */
- osym.st_value += isec->output_offset;
- if (! finfo->info->relocatable)
- {
- osym.st_value += isec->output_section->vma;
- if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
- {
- /* STT_TLS symbols are relative to PT_TLS segment base. */
- BFD_ASSERT (elf_hash_table (finfo->info)->tls_sec != NULL);
- osym.st_value -= elf_hash_table (finfo->info)->tls_sec->vma;
- }
- }
-
- if (! elf_link_output_sym (finfo, name, &osym, isec, NULL))
- return FALSE;
- }
-
- /* Relocate the contents of each section. */
- sym_hashes = elf_sym_hashes (input_bfd);
- for (o = input_bfd->sections; o != NULL; o = o->next)
- {
- bfd_byte *contents;
-
- if (! o->linker_mark)
- {
- /* This section was omitted from the link. */
- continue;
- }
-
- if ((o->flags & SEC_HAS_CONTENTS) == 0
- || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
- continue;
-
- if ((o->flags & SEC_LINKER_CREATED) != 0)
- {
- /* Section was created by _bfd_elf_link_create_dynamic_sections
- or somesuch. */
- continue;
- }
-
- /* Get the contents of the section. They have been cached by a
- relaxation routine. Note that o is a section in an input
- file, so the contents field will not have been set by any of
- the routines which work on output files. */
- if (elf_section_data (o)->this_hdr.contents != NULL)
- contents = elf_section_data (o)->this_hdr.contents;
- else
- {
- contents = finfo->contents;
- if (! bfd_get_section_contents (input_bfd, o, contents, 0,
- o->_raw_size))
- return FALSE;
- }
-
- if ((o->flags & SEC_RELOC) != 0)
- {
- Elf_Internal_Rela *internal_relocs;
- bfd_vma r_type_mask;
- int r_sym_shift;
-
- /* Get the swapped relocs. */
- internal_relocs
- = _bfd_elf_link_read_relocs (input_bfd, o, finfo->external_relocs,
- finfo->internal_relocs, FALSE);
- if (internal_relocs == NULL
- && o->reloc_count > 0)
- return FALSE;
-
- if (bed->s->arch_size == 32)
- {
- r_type_mask = 0xff;
- r_sym_shift = 8;
- }
- else
- {
- r_type_mask = 0xffffffff;
- r_sym_shift = 32;
- }
-
- /* Run through the relocs looking for any against symbols
- from discarded sections and section symbols from
- removed link-once sections. Complain about relocs
- against discarded sections. Zero relocs against removed
- link-once sections. Preserve debug information as much
- as we can. */
- if (!elf_section_ignore_discarded_relocs (o))
- {
- Elf_Internal_Rela *rel, *relend;
-
- rel = internal_relocs;
- relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
- for ( ; rel < relend; rel++)
- {
- unsigned long r_symndx = rel->r_info >> r_sym_shift;
- asection *sec;
-
- if (r_symndx >= locsymcount
- || (elf_bad_symtab (input_bfd)
- && finfo->sections[r_symndx] == NULL))
- {
- struct elf_link_hash_entry *h;
-
- h = sym_hashes[r_symndx - extsymoff];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Complain if the definition comes from a
- discarded section. */
- sec = h->root.u.def.section;
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && elf_discarded_section (sec))
- {
- if ((o->flags & SEC_DEBUGGING) != 0)
- {
- BFD_ASSERT (r_symndx != 0);
- /* Try to preserve debug information. */
- if ((o->flags & SEC_DEBUGGING) != 0
- && sec->kept_section != NULL
- && sec->_raw_size == sec->kept_section->_raw_size)
- h->root.u.def.section
- = sec->kept_section;
- else
- memset (rel, 0, sizeof (*rel));
- }
- else
- finfo->info->callbacks->error_handler
- (LD_DEFINITION_IN_DISCARDED_SECTION,
- _("%T: discarded in section `%s' from %s\n"),
- h->root.root.string,
- h->root.root.string,
- h->root.u.def.section->name,
- bfd_archive_filename (h->root.u.def.section->owner));
- }
- }
- else
- {
- sec = finfo->sections[r_symndx];
-
- if (sec != NULL && elf_discarded_section (sec))
- {
- if ((o->flags & SEC_DEBUGGING) != 0
- || (sec->flags & SEC_LINK_ONCE) != 0)
- {
- BFD_ASSERT (r_symndx != 0);
- /* Try to preserve debug information. */
- if ((o->flags & SEC_DEBUGGING) != 0
- && sec->kept_section != NULL
- && sec->_raw_size == sec->kept_section->_raw_size)
- finfo->sections[r_symndx]
- = sec->kept_section;
- else
- {
- rel->r_info &= r_type_mask;
- rel->r_addend = 0;
- }
- }
- else
- {
- static int count;
- int ok;
- char *buf;
-
- ok = asprintf (&buf, "local symbol %d",
- count++);
- if (ok <= 0)
- buf = (char *) "local symbol";
- finfo->info->callbacks->error_handler
- (LD_DEFINITION_IN_DISCARDED_SECTION,
- _("%T: discarded in section `%s' from %s\n"),
- buf, buf, sec->name,
- bfd_archive_filename (input_bfd));
- if (ok != -1)
- free (buf);
- }
- }
- }
- }
- }
-
- /* Relocate the section by invoking a back end routine.
-
- The back end routine is responsible for adjusting the
- section contents as necessary, and (if using Rela relocs
- and generating a relocatable output file) adjusting the
- reloc addend as necessary.
-
- The back end routine does not have to worry about setting
- the reloc address or the reloc symbol index.
-
- The back end routine is given a pointer to the swapped in
- internal symbols, and can access the hash table entries
- for the external symbols via elf_sym_hashes (input_bfd).
-
- When generating relocatable output, the back end routine
- must handle STB_LOCAL/STT_SECTION symbols specially. The
- output symbol is going to be a section symbol
- corresponding to the output section, which will require
- the addend to be adjusted. */
-
- if (! (*relocate_section) (output_bfd, finfo->info,
- input_bfd, o, contents,
- internal_relocs,
- isymbuf,
- finfo->sections))
- return FALSE;
-
- if (emit_relocs)
- {
- Elf_Internal_Rela *irela;
- Elf_Internal_Rela *irelaend;
- bfd_vma last_offset;
- struct elf_link_hash_entry **rel_hash;
- Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2;
- unsigned int next_erel;
- bfd_boolean (*reloc_emitter)
- (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
- bfd_boolean rela_normal;
-
- input_rel_hdr = &elf_section_data (o)->rel_hdr;
- rela_normal = (bed->rela_normal
- && (input_rel_hdr->sh_entsize
- == bed->s->sizeof_rela));
-
- /* Adjust the reloc addresses and symbol indices. */
-
- irela = internal_relocs;
- irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel;
- rel_hash = (elf_section_data (o->output_section)->rel_hashes
- + elf_section_data (o->output_section)->rel_count
- + elf_section_data (o->output_section)->rel_count2);
- last_offset = o->output_offset;
- if (!finfo->info->relocatable)
- last_offset += o->output_section->vma;
- for (next_erel = 0; irela < irelaend; irela++, next_erel++)
- {
- unsigned long r_symndx;
- asection *sec;
- Elf_Internal_Sym sym;
-
- if (next_erel == bed->s->int_rels_per_ext_rel)
- {
- rel_hash++;
- next_erel = 0;
- }
-
- irela->r_offset = _bfd_elf_section_offset (output_bfd,
- finfo->info, o,
- irela->r_offset);
- if (irela->r_offset >= (bfd_vma) -2)
- {
- /* This is a reloc for a deleted entry or somesuch.
- Turn it into an R_*_NONE reloc, at the same
- offset as the last reloc. elf_eh_frame.c and
- elf_bfd_discard_info rely on reloc offsets
- being ordered. */
- irela->r_offset = last_offset;
- irela->r_info = 0;
- irela->r_addend = 0;
- continue;
- }
-
- irela->r_offset += o->output_offset;
-
- /* Relocs in an executable have to be virtual addresses. */
- if (!finfo->info->relocatable)
- irela->r_offset += o->output_section->vma;
-
- last_offset = irela->r_offset;
-
- r_symndx = irela->r_info >> r_sym_shift;
- if (r_symndx == STN_UNDEF)
- continue;
-
- if (r_symndx >= locsymcount
- || (elf_bad_symtab (input_bfd)
- && finfo->sections[r_symndx] == NULL))
- {
- struct elf_link_hash_entry *rh;
- unsigned long indx;
-
- /* This is a reloc against a global symbol. We
- have not yet output all the local symbols, so
- we do not know the symbol index of any global
- symbol. We set the rel_hash entry for this
- reloc to point to the global hash table entry
- for this symbol. The symbol index is then
- set at the end of elf_bfd_final_link. */
- indx = r_symndx - extsymoff;
- rh = elf_sym_hashes (input_bfd)[indx];
- while (rh->root.type == bfd_link_hash_indirect
- || rh->root.type == bfd_link_hash_warning)
- rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
-
- /* Setting the index to -2 tells
- elf_link_output_extsym that this symbol is
- used by a reloc. */
- BFD_ASSERT (rh->indx < 0);
- rh->indx = -2;
-
- *rel_hash = rh;
-
- continue;
- }
-
- /* This is a reloc against a local symbol. */
-
- *rel_hash = NULL;
- sym = isymbuf[r_symndx];
- sec = finfo->sections[r_symndx];
- if (ELF_ST_TYPE (sym.st_info) == STT_SECTION)
- {
- /* I suppose the backend ought to fill in the
- section of any STT_SECTION symbol against a
- processor specific section. If we have
- discarded a section, the output_section will
- be the absolute section. */
- if (bfd_is_abs_section (sec)
- || (sec != NULL
- && bfd_is_abs_section (sec->output_section)))
- r_symndx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- r_symndx = sec->output_section->target_index;
- BFD_ASSERT (r_symndx != 0);
- }
-
- /* Adjust the addend according to where the
- section winds up in the output section. */
- if (rela_normal)
- irela->r_addend += sec->output_offset;
- }
- else
- {
- if (finfo->indices[r_symndx] == -1)
- {
- unsigned long shlink;
- const char *name;
- asection *osec;
-
- if (finfo->info->strip == strip_all)
- {
- /* You can't do ld -r -s. */
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- /* This symbol was skipped earlier, but
- since it is needed by a reloc, we
- must output it now. */
- shlink = symtab_hdr->sh_link;
- name = (bfd_elf_string_from_elf_section
- (input_bfd, shlink, sym.st_name));
- if (name == NULL)
- return FALSE;
-
- osec = sec->output_section;
- sym.st_shndx =
- _bfd_elf_section_from_bfd_section (output_bfd,
- osec);
- if (sym.st_shndx == SHN_BAD)
- return FALSE;
-
- sym.st_value += sec->output_offset;
- if (! finfo->info->relocatable)
- {
- sym.st_value += osec->vma;
- if (ELF_ST_TYPE (sym.st_info) == STT_TLS)
- {
- /* STT_TLS symbols are relative to PT_TLS
- segment base. */
- BFD_ASSERT (elf_hash_table (finfo->info)
- ->tls_sec != NULL);
- sym.st_value -= (elf_hash_table (finfo->info)
- ->tls_sec->vma);
- }
- }
-
- finfo->indices[r_symndx]
- = bfd_get_symcount (output_bfd);
-
- if (! elf_link_output_sym (finfo, name, &sym, sec,
- NULL))
- return FALSE;
- }
-
- r_symndx = finfo->indices[r_symndx];
- }
-
- irela->r_info = ((bfd_vma) r_symndx << r_sym_shift
- | (irela->r_info & r_type_mask));
- }
-
- /* Swap out the relocs. */
- if (bed->elf_backend_emit_relocs
- && !(finfo->info->relocatable
- || finfo->info->emitrelocations))
- reloc_emitter = bed->elf_backend_emit_relocs;
- else
- reloc_emitter = _bfd_elf_link_output_relocs;
-
- if (input_rel_hdr->sh_size != 0
- && ! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
- internal_relocs))
- return FALSE;
-
- input_rel_hdr2 = elf_section_data (o)->rel_hdr2;
- if (input_rel_hdr2 && input_rel_hdr2->sh_size != 0)
- {
- internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
- * bed->s->int_rels_per_ext_rel);
- if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr2,
- internal_relocs))
- return FALSE;
- }
- }
- }
-
- /* Write out the modified section contents. */
- if (bed->elf_backend_write_section
- && (*bed->elf_backend_write_section) (output_bfd, o, contents))
- {
- /* Section written out. */
- }
- else switch (o->sec_info_type)
- {
- case ELF_INFO_TYPE_STABS:
- if (! (_bfd_write_section_stabs
- (output_bfd,
- &elf_hash_table (finfo->info)->stab_info,
- o, &elf_section_data (o)->sec_info, contents)))
- return FALSE;
- break;
- case ELF_INFO_TYPE_MERGE:
- if (! _bfd_write_merged_section (output_bfd, o,
- elf_section_data (o)->sec_info))
- return FALSE;
- break;
- case ELF_INFO_TYPE_EH_FRAME:
- {
- if (! _bfd_elf_write_section_eh_frame (output_bfd, finfo->info,
- o, contents))
- return FALSE;
- }
- break;
- default:
- {
- bfd_size_type sec_size;
-
- sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size);
- if (! (o->flags & SEC_EXCLUDE)
- && ! bfd_set_section_contents (output_bfd, o->output_section,
- contents,
- (file_ptr) o->output_offset,
- sec_size))
- return FALSE;
- }
- break;
- }
- }
-
- return TRUE;
-}
-
-/* Generate a reloc when linking an ELF file. This is a reloc
- requested by the linker, and does come from any input file. This
- is used to build constructor and destructor tables when linking
- with -Ur. */
-
-static bfd_boolean
-elf_reloc_link_order (bfd *output_bfd,
- struct bfd_link_info *info,
- asection *output_section,
- struct bfd_link_order *link_order)
-{
- reloc_howto_type *howto;
- long indx;
- bfd_vma offset;
- bfd_vma addend;
- struct elf_link_hash_entry **rel_hash_ptr;
- Elf_Internal_Shdr *rel_hdr;
- const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
- Elf_Internal_Rela irel[MAX_INT_RELS_PER_EXT_REL];
- bfd_byte *erel;
- unsigned int i;
-
- howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
- if (howto == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- addend = link_order->u.reloc.p->addend;
-
- /* Figure out the symbol index. */
- rel_hash_ptr = (elf_section_data (output_section)->rel_hashes
- + elf_section_data (output_section)->rel_count
- + elf_section_data (output_section)->rel_count2);
- if (link_order->type == bfd_section_reloc_link_order)
- {
- indx = link_order->u.reloc.p->u.section->target_index;
- BFD_ASSERT (indx != 0);
- *rel_hash_ptr = NULL;
- }
- else
- {
- struct elf_link_hash_entry *h;
-
- /* Treat a reloc against a defined symbol as though it were
- actually against the section. */
- h = ((struct elf_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, info,
- link_order->u.reloc.p->u.name,
- FALSE, FALSE, TRUE));
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- asection *section;
-
- section = h->root.u.def.section;
- indx = section->output_section->target_index;
- *rel_hash_ptr = NULL;
- /* It seems that we ought to add the symbol value to the
- addend here, but in practice it has already been added
- because it was passed to constructor_callback. */
- addend += section->output_section->vma + section->output_offset;
- }
- else if (h != NULL)
- {
- /* Setting the index to -2 tells elf_link_output_extsym that
- this symbol is used by a reloc. */
- h->indx = -2;
- *rel_hash_ptr = h;
- indx = 0;
- }
- else
- {
- if (! ((*info->callbacks->unattached_reloc)
- (info, link_order->u.reloc.p->u.name, NULL, NULL, 0)))
- return FALSE;
- indx = 0;
- }
- }
-
- /* If this is an inplace reloc, we must write the addend into the
- object file. */
- if (howto->partial_inplace && addend != 0)
- {
- bfd_size_type size;
- bfd_reloc_status_type rstat;
- bfd_byte *buf;
- bfd_boolean ok;
- const char *sym_name;
-
- size = bfd_get_reloc_size (howto);
- buf = bfd_zmalloc (size);
- if (buf == NULL)
- return FALSE;
- rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
- switch (rstat)
- {
- case bfd_reloc_ok:
- break;
-
- default:
- case bfd_reloc_outofrange:
- abort ();
-
- case bfd_reloc_overflow:
- if (link_order->type == bfd_section_reloc_link_order)
- sym_name = bfd_section_name (output_bfd,
- link_order->u.reloc.p->u.section);
- else
- sym_name = link_order->u.reloc.p->u.name;
- if (! ((*info->callbacks->reloc_overflow)
- (info, sym_name, howto->name, addend, NULL, NULL, 0)))
- {
- free (buf);
- return FALSE;
- }
- break;
- }
- ok = bfd_set_section_contents (output_bfd, output_section, buf,
- link_order->offset, size);
- free (buf);
- if (! ok)
- return FALSE;
- }
-
- /* The address of a reloc is relative to the section in a
- relocatable file, and is a virtual address in an executable
- file. */
- offset = link_order->offset;
- if (! info->relocatable)
- offset += output_section->vma;
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- {
- irel[i].r_offset = offset;
- irel[i].r_info = 0;
- irel[i].r_addend = 0;
- }
- if (bed->s->arch_size == 32)
- irel[0].r_info = ELF32_R_INFO (indx, howto->type);
- else
- irel[0].r_info = ELF64_R_INFO (indx, howto->type);
-
- rel_hdr = &elf_section_data (output_section)->rel_hdr;
- erel = rel_hdr->contents;
- if (rel_hdr->sh_type == SHT_REL)
- {
- erel += (elf_section_data (output_section)->rel_count
- * bed->s->sizeof_rel);
- (*bed->s->swap_reloc_out) (output_bfd, irel, erel);
- }
- else
- {
- irel[0].r_addend = addend;
- erel += (elf_section_data (output_section)->rel_count
- * bed->s->sizeof_rela);
- (*bed->s->swap_reloca_out) (output_bfd, irel, erel);
- }
-
- ++elf_section_data (output_section)->rel_count;
-
- return TRUE;
-}
-
-/* Do the final step of an ELF link. */
-
-bfd_boolean
-bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
-{
- bfd_boolean dynamic;
- bfd_boolean emit_relocs;
- bfd *dynobj;
- struct elf_final_link_info finfo;
- register asection *o;
- register struct bfd_link_order *p;
- register bfd *sub;
- bfd_size_type max_contents_size;
- bfd_size_type max_external_reloc_size;
- bfd_size_type max_internal_reloc_count;
- bfd_size_type max_sym_count;
- bfd_size_type max_sym_shndx_count;
- file_ptr off;
- Elf_Internal_Sym elfsym;
- unsigned int i;
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Shdr *symtab_shndx_hdr;
- Elf_Internal_Shdr *symstrtab_hdr;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- struct elf_outext_info eoinfo;
- bfd_boolean merged;
- size_t relativecount = 0;
- asection *reldyn = 0;
- bfd_size_type amt;
-
- if (! is_elf_hash_table (info->hash))
- return FALSE;
-
- if (info->shared)
- abfd->flags |= DYNAMIC;
-
- dynamic = elf_hash_table (info)->dynamic_sections_created;
- dynobj = elf_hash_table (info)->dynobj;
-
- emit_relocs = (info->relocatable
- || info->emitrelocations
- || bed->elf_backend_emit_relocs);
-
- finfo.info = info;
- finfo.output_bfd = abfd;
- finfo.symstrtab = _bfd_elf_stringtab_init ();
- if (finfo.symstrtab == NULL)
- return FALSE;
-
- if (! dynamic)
- {
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
- }
- else
- {
- finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
- finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
- /* Note that it is OK if symver_sec is NULL. */
- }
-
- finfo.contents = NULL;
- finfo.external_relocs = NULL;
- finfo.internal_relocs = NULL;
- finfo.external_syms = NULL;
- finfo.locsym_shndx = NULL;
- finfo.internal_syms = NULL;
- finfo.indices = NULL;
- finfo.sections = NULL;
- finfo.symbuf = NULL;
- finfo.symshndxbuf = NULL;
- finfo.symbuf_count = 0;
- finfo.shndxbuf_size = 0;
-
- /* Count up the number of relocations we will output for each output
- section, so that we know the sizes of the reloc sections. We
- also figure out some maximum sizes. */
- max_contents_size = 0;
- max_external_reloc_size = 0;
- max_internal_reloc_count = 0;
- max_sym_count = 0;
- max_sym_shndx_count = 0;
- merged = FALSE;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct bfd_elf_section_data *esdo = elf_section_data (o);
- o->reloc_count = 0;
-
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- unsigned int reloc_count = 0;
- struct bfd_elf_section_data *esdi = NULL;
- unsigned int *rel_count1;
-
- if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- reloc_count = 1;
- else if (p->type == bfd_indirect_link_order)
- {
- asection *sec;
-
- sec = p->u.indirect.section;
- esdi = elf_section_data (sec);
-
- /* Mark all sections which are to be included in the
- link. This will normally be every section. We need
- to do this so that we can identify any sections which
- the linker has decided to not include. */
- sec->linker_mark = TRUE;
-
- if (sec->flags & SEC_MERGE)
- merged = TRUE;
-
- if (info->relocatable || info->emitrelocations)
- reloc_count = sec->reloc_count;
- else if (bed->elf_backend_count_relocs)
- {
- Elf_Internal_Rela * relocs;
-
- relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
- info->keep_memory);
-
- reloc_count = (*bed->elf_backend_count_relocs) (sec, relocs);
-
- if (elf_section_data (o)->relocs != relocs)
- free (relocs);
- }
-
- if (sec->_raw_size > max_contents_size)
- max_contents_size = sec->_raw_size;
- if (sec->_cooked_size > max_contents_size)
- max_contents_size = sec->_cooked_size;
-
- /* We are interested in just local symbols, not all
- symbols. */
- if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
- && (sec->owner->flags & DYNAMIC) == 0)
- {
- size_t sym_count;
-
- if (elf_bad_symtab (sec->owner))
- sym_count = (elf_tdata (sec->owner)->symtab_hdr.sh_size
- / bed->s->sizeof_sym);
- else
- sym_count = elf_tdata (sec->owner)->symtab_hdr.sh_info;
-
- if (sym_count > max_sym_count)
- max_sym_count = sym_count;
-
- if (sym_count > max_sym_shndx_count
- && elf_symtab_shndx (sec->owner) != 0)
- max_sym_shndx_count = sym_count;
-
- if ((sec->flags & SEC_RELOC) != 0)
- {
- size_t ext_size;
-
- ext_size = elf_section_data (sec)->rel_hdr.sh_size;
- if (ext_size > max_external_reloc_size)
- max_external_reloc_size = ext_size;
- if (sec->reloc_count > max_internal_reloc_count)
- max_internal_reloc_count = sec->reloc_count;
- }
- }
- }
-
- if (reloc_count == 0)
- continue;
-
- o->reloc_count += reloc_count;
-
- /* MIPS may have a mix of REL and RELA relocs on sections.
- To support this curious ABI we keep reloc counts in
- elf_section_data too. We must be careful to add the
- relocations from the input section to the right output
- count. FIXME: Get rid of one count. We have
- o->reloc_count == esdo->rel_count + esdo->rel_count2. */
- rel_count1 = &esdo->rel_count;
- if (esdi != NULL)
- {
- bfd_boolean same_size;
- bfd_size_type entsize1;
-
- entsize1 = esdi->rel_hdr.sh_entsize;
- BFD_ASSERT (entsize1 == bed->s->sizeof_rel
- || entsize1 == bed->s->sizeof_rela);
- same_size = !o->use_rela_p == (entsize1 == bed->s->sizeof_rel);
-
- if (!same_size)
- rel_count1 = &esdo->rel_count2;
-
- if (esdi->rel_hdr2 != NULL)
- {
- bfd_size_type entsize2 = esdi->rel_hdr2->sh_entsize;
- unsigned int alt_count;
- unsigned int *rel_count2;
-
- BFD_ASSERT (entsize2 != entsize1
- && (entsize2 == bed->s->sizeof_rel
- || entsize2 == bed->s->sizeof_rela));
-
- rel_count2 = &esdo->rel_count2;
- if (!same_size)
- rel_count2 = &esdo->rel_count;
-
- /* The following is probably too simplistic if the
- backend counts output relocs unusually. */
- BFD_ASSERT (bed->elf_backend_count_relocs == NULL);
- alt_count = NUM_SHDR_ENTRIES (esdi->rel_hdr2);
- *rel_count2 += alt_count;
- reloc_count -= alt_count;
- }
- }
- *rel_count1 += reloc_count;
- }
-
- if (o->reloc_count > 0)
- o->flags |= SEC_RELOC;
- else
- {
- /* Explicitly clear the SEC_RELOC flag. The linker tends to
- set it (this is probably a bug) and if it is set
- assign_section_numbers will create a reloc section. */
- o->flags &=~ SEC_RELOC;
- }
-
- /* If the SEC_ALLOC flag is not set, force the section VMA to
- zero. This is done in elf_fake_sections as well, but forcing
- the VMA to 0 here will ensure that relocs against these
- sections are handled correctly. */
- if ((o->flags & SEC_ALLOC) == 0
- && ! o->user_set_vma)
- o->vma = 0;
- }
-
- if (! info->relocatable && merged)
- elf_link_hash_traverse (elf_hash_table (info),
- _bfd_elf_link_sec_merge_syms, abfd);
-
- /* Figure out the file positions for everything but the symbol table
- and the relocs. We set symcount to force assign_section_numbers
- to create a symbol table. */
- bfd_get_symcount (abfd) = info->strip == strip_all ? 0 : 1;
- BFD_ASSERT (! abfd->output_has_begun);
- if (! _bfd_elf_compute_section_file_positions (abfd, info))
- goto error_return;
-
- /* That created the reloc sections. Set their sizes, and assign
- them file positions, and allocate some buffers. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) != 0)
- {
- if (!(_bfd_elf_link_size_reloc_section
- (abfd, &elf_section_data (o)->rel_hdr, o)))
- goto error_return;
-
- if (elf_section_data (o)->rel_hdr2
- && !(_bfd_elf_link_size_reloc_section
- (abfd, elf_section_data (o)->rel_hdr2, o)))
- goto error_return;
- }
-
- /* Now, reset REL_COUNT and REL_COUNT2 so that we can use them
- to count upwards while actually outputting the relocations. */
- elf_section_data (o)->rel_count = 0;
- elf_section_data (o)->rel_count2 = 0;
- }
-
- _bfd_elf_assign_file_positions_for_relocs (abfd);
-
- /* We have now assigned file positions for all the sections except
- .symtab and .strtab. We start the .symtab section at the current
- file position, and write directly to it. We build the .strtab
- section in memory. */
- bfd_get_symcount (abfd) = 0;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- /* sh_name is set in prep_headers. */
- symtab_hdr->sh_type = SHT_SYMTAB;
- /* sh_flags, sh_addr and sh_size all start off zero. */
- symtab_hdr->sh_entsize = bed->s->sizeof_sym;
- /* sh_link is set in assign_section_numbers. */
- /* sh_info is set below. */
- /* sh_offset is set just below. */
- symtab_hdr->sh_addralign = 1 << bed->s->log_file_align;
-
- off = elf_tdata (abfd)->next_file_pos;
- off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE);
-
- /* Note that at this point elf_tdata (abfd)->next_file_pos is
- incorrect. We do not yet know the size of the .symtab section.
- We correct next_file_pos below, after we do know the size. */
-
- /* Allocate a buffer to hold swapped out symbols. This is to avoid
- continuously seeking to the right position in the file. */
- if (! info->keep_memory || max_sym_count < 20)
- finfo.symbuf_size = 20;
- else
- finfo.symbuf_size = max_sym_count;
- amt = finfo.symbuf_size;
- amt *= bed->s->sizeof_sym;
- finfo.symbuf = bfd_malloc (amt);
- if (finfo.symbuf == NULL)
- goto error_return;
- if (elf_numsections (abfd) > SHN_LORESERVE)
- {
- /* Wild guess at number of output symbols. realloc'd as needed. */
- amt = 2 * max_sym_count + elf_numsections (abfd) + 1000;
- finfo.shndxbuf_size = amt;
- amt *= sizeof (Elf_External_Sym_Shndx);
- finfo.symshndxbuf = bfd_zmalloc (amt);
- if (finfo.symshndxbuf == NULL)
- goto error_return;
- }
-
- /* Start writing out the symbol table. The first symbol is always a
- dummy symbol. */
- if (info->strip != strip_all
- || emit_relocs)
- {
- elfsym.st_value = 0;
- elfsym.st_size = 0;
- elfsym.st_info = 0;
- elfsym.st_other = 0;
- elfsym.st_shndx = SHN_UNDEF;
- if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr,
- NULL))
- goto error_return;
- }
-
-#if 0
- /* Some standard ELF linkers do this, but we don't because it causes
- bootstrap comparison failures. */
- /* Output a file symbol for the output file as the second symbol.
- We output this even if we are discarding local symbols, although
- I'm not sure if this is correct. */
- elfsym.st_value = 0;
- elfsym.st_size = 0;
- elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
- elfsym.st_other = 0;
- elfsym.st_shndx = SHN_ABS;
- if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd),
- &elfsym, bfd_abs_section_ptr, NULL))
- goto error_return;
-#endif
-
- /* Output a symbol for each section. We output these even if we are
- discarding local symbols, since they are used for relocs. These
- symbols have no names. We store the index of each one in the
- index field of the section, so that we can find it again when
- outputting relocs. */
- if (info->strip != strip_all
- || emit_relocs)
- {
- elfsym.st_size = 0;
- elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
- elfsym.st_other = 0;
- for (i = 1; i < elf_numsections (abfd); i++)
- {
- o = bfd_section_from_elf_index (abfd, i);
- if (o != NULL)
- o->target_index = bfd_get_symcount (abfd);
- elfsym.st_shndx = i;
- if (info->relocatable || o == NULL)
- elfsym.st_value = 0;
- else
- elfsym.st_value = o->vma;
- if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
- goto error_return;
- if (i == SHN_LORESERVE - 1)
- i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- }
-
- /* Allocate some memory to hold information read in from the input
- files. */
- if (max_contents_size != 0)
- {
- finfo.contents = bfd_malloc (max_contents_size);
- if (finfo.contents == NULL)
- goto error_return;
- }
-
- if (max_external_reloc_size != 0)
- {
- finfo.external_relocs = bfd_malloc (max_external_reloc_size);
- if (finfo.external_relocs == NULL)
- goto error_return;
- }
-
- if (max_internal_reloc_count != 0)
- {
- amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
- amt *= sizeof (Elf_Internal_Rela);
- finfo.internal_relocs = bfd_malloc (amt);
- if (finfo.internal_relocs == NULL)
- goto error_return;
- }
-
- if (max_sym_count != 0)
- {
- amt = max_sym_count * bed->s->sizeof_sym;
- finfo.external_syms = bfd_malloc (amt);
- if (finfo.external_syms == NULL)
- goto error_return;
-
- amt = max_sym_count * sizeof (Elf_Internal_Sym);
- finfo.internal_syms = bfd_malloc (amt);
- if (finfo.internal_syms == NULL)
- goto error_return;
-
- amt = max_sym_count * sizeof (long);
- finfo.indices = bfd_malloc (amt);
- if (finfo.indices == NULL)
- goto error_return;
-
- amt = max_sym_count * sizeof (asection *);
- finfo.sections = bfd_malloc (amt);
- if (finfo.sections == NULL)
- goto error_return;
- }
-
- if (max_sym_shndx_count != 0)
- {
- amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
- finfo.locsym_shndx = bfd_malloc (amt);
- if (finfo.locsym_shndx == NULL)
- goto error_return;
- }
-
- if (elf_hash_table (info)->tls_sec)
- {
- bfd_vma base, end = 0;
- asection *sec;
-
- for (sec = elf_hash_table (info)->tls_sec;
- sec && (sec->flags & SEC_THREAD_LOCAL);
- sec = sec->next)
- {
- bfd_vma size = sec->_raw_size;
-
- if (size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0)
- {
- struct bfd_link_order *o;
-
- for (o = sec->link_order_head; o != NULL; o = o->next)
- if (size < o->offset + o->size)
- size = o->offset + o->size;
- }
- end = sec->vma + size;
- }
- base = elf_hash_table (info)->tls_sec->vma;
- end = align_power (end, elf_hash_table (info)->tls_sec->alignment_power);
- elf_hash_table (info)->tls_size = end - base;
- }
-
- /* Since ELF permits relocations to be against local symbols, we
- must have the local symbols available when we do the relocations.
- Since we would rather only read the local symbols once, and we
- would rather not keep them in memory, we handle all the
- relocations for a single input file at the same time.
-
- Unfortunately, there is no way to know the total number of local
- symbols until we have seen all of them, and the local symbol
- indices precede the global symbol indices. This means that when
- we are generating relocatable output, and we see a reloc against
- a global symbol, we can not know the symbol index until we have
- finished examining all the local symbols to see which ones we are
- going to output. To deal with this, we keep the relocations in
- memory, and don't output them until the end of the link. This is
- an unfortunate waste of memory, but I don't see a good way around
- it. Fortunately, it only happens when performing a relocatable
- link, which is not the common case. FIXME: If keep_memory is set
- we could write the relocs out and then read them again; I don't
- know how bad the memory loss will be. */
-
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- sub->output_has_begun = FALSE;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order
- && (bfd_get_flavour ((sub = p->u.indirect.section->owner))
- == bfd_target_elf_flavour)
- && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass)
- {
- if (! sub->output_has_begun)
- {
- if (! elf_link_input_bfd (&finfo, sub))
- goto error_return;
- sub->output_has_begun = TRUE;
- }
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- if (! elf_reloc_link_order (abfd, info, o, p))
- goto error_return;
- }
- else
- {
- if (! _bfd_default_link_order (abfd, info, o, p))
- goto error_return;
- }
- }
- }
-
- /* Output any global symbols that got converted to local in a
- version script or due to symbol visibility. We do this in a
- separate step since ELF requires all local symbols to appear
- prior to any global symbols. FIXME: We should only do this if
- some global symbols were, in fact, converted to become local.
- FIXME: Will this work correctly with the Irix 5 linker? */
- eoinfo.failed = FALSE;
- eoinfo.finfo = &finfo;
- eoinfo.localsyms = TRUE;
- elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- &eoinfo);
- if (eoinfo.failed)
- return FALSE;
-
- /* That wrote out all the local symbols. Finish up the symbol table
- with the global symbols. Even if we want to strip everything we
- can, we still need to deal with those global symbols that got
- converted to local in a version script. */
-
- /* The sh_info field records the index of the first non local symbol. */
- symtab_hdr->sh_info = bfd_get_symcount (abfd);
-
- if (dynamic
- && finfo.dynsym_sec->output_section != bfd_abs_section_ptr)
- {
- Elf_Internal_Sym sym;
- bfd_byte *dynsym = finfo.dynsym_sec->contents;
- long last_local = 0;
-
- /* Write out the section symbols for the output sections. */
- if (info->shared)
- {
- asection *s;
-
- sym.st_size = 0;
- sym.st_name = 0;
- sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
- sym.st_other = 0;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- int indx;
- bfd_byte *dest;
- long dynindx;
-
- indx = elf_section_data (s)->this_idx;
- dynindx = elf_section_data (s)->dynindx;
- BFD_ASSERT (indx > 0);
- sym.st_shndx = indx;
- sym.st_value = s->vma;
- dest = dynsym + dynindx * bed->s->sizeof_sym;
- bed->s->swap_symbol_out (abfd, &sym, dest, 0);
- }
-
- last_local = bfd_count_sections (abfd);
- }
-
- /* Write out the local dynsyms. */
- if (elf_hash_table (info)->dynlocal)
- {
- struct elf_link_local_dynamic_entry *e;
- for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
- {
- asection *s;
- bfd_byte *dest;
-
- sym.st_size = e->isym.st_size;
- sym.st_other = e->isym.st_other;
-
- /* Copy the internal symbol as is.
- Note that we saved a word of storage and overwrote
- the original st_name with the dynstr_index. */
- sym = e->isym;
-
- if (e->isym.st_shndx != SHN_UNDEF
- && (e->isym.st_shndx < SHN_LORESERVE
- || e->isym.st_shndx > SHN_HIRESERVE))
- {
- s = bfd_section_from_elf_index (e->input_bfd,
- e->isym.st_shndx);
-
- sym.st_shndx =
- elf_section_data (s->output_section)->this_idx;
- sym.st_value = (s->output_section->vma
- + s->output_offset
- + e->isym.st_value);
- }
-
- if (last_local < e->dynindx)
- last_local = e->dynindx;
-
- dest = dynsym + e->dynindx * bed->s->sizeof_sym;
- bed->s->swap_symbol_out (abfd, &sym, dest, 0);
- }
- }
-
- elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info =
- last_local + 1;
- }
-
- /* We get the global symbols from the hash table. */
- eoinfo.failed = FALSE;
- eoinfo.localsyms = FALSE;
- eoinfo.finfo = &finfo;
- elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- &eoinfo);
- if (eoinfo.failed)
- return FALSE;
-
- /* If backend needs to output some symbols not present in the hash
- table, do it now. */
- if (bed->elf_backend_output_arch_syms)
- {
- typedef bfd_boolean (*out_sym_func)
- (void *, const char *, Elf_Internal_Sym *, asection *,
- struct elf_link_hash_entry *);
-
- if (! ((*bed->elf_backend_output_arch_syms)
- (abfd, info, &finfo, (out_sym_func) elf_link_output_sym)))
- return FALSE;
- }
-
- /* Flush all symbols to the file. */
- if (! elf_link_flush_output_syms (&finfo, bed))
- return FALSE;
-
- /* Now we know the size of the symtab section. */
- off += symtab_hdr->sh_size;
-
- symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
- if (symtab_shndx_hdr->sh_name != 0)
- {
- symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
- symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
- symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
- amt = bfd_get_symcount (abfd) * sizeof (Elf_External_Sym_Shndx);
- symtab_shndx_hdr->sh_size = amt;
-
- off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr,
- off, TRUE);
-
- if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bwrite (finfo.symshndxbuf, amt, abfd) != amt))
- return FALSE;
- }
-
-
- /* Finish up and write out the symbol string table (.strtab)
- section. */
- symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
- /* sh_name was set in prep_headers. */
- symstrtab_hdr->sh_type = SHT_STRTAB;
- symstrtab_hdr->sh_flags = 0;
- symstrtab_hdr->sh_addr = 0;
- symstrtab_hdr->sh_size = _bfd_stringtab_size (finfo.symstrtab);
- symstrtab_hdr->sh_entsize = 0;
- symstrtab_hdr->sh_link = 0;
- symstrtab_hdr->sh_info = 0;
- /* sh_offset is set just below. */
- symstrtab_hdr->sh_addralign = 1;
-
- off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, TRUE);
- elf_tdata (abfd)->next_file_pos = off;
-
- if (bfd_get_symcount (abfd) > 0)
- {
- if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
- || ! _bfd_stringtab_emit (abfd, finfo.symstrtab))
- return FALSE;
- }
-
- /* Adjust the relocs to have the correct symbol indices. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) == 0)
- continue;
-
- elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr,
- elf_section_data (o)->rel_count,
- elf_section_data (o)->rel_hashes);
- if (elf_section_data (o)->rel_hdr2 != NULL)
- elf_link_adjust_relocs (abfd, elf_section_data (o)->rel_hdr2,
- elf_section_data (o)->rel_count2,
- (elf_section_data (o)->rel_hashes
- + elf_section_data (o)->rel_count));
-
- /* Set the reloc_count field to 0 to prevent write_relocs from
- trying to swap the relocs out itself. */
- o->reloc_count = 0;
- }
-
- if (dynamic && info->combreloc && dynobj != NULL)
- relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
-
- /* If we are linking against a dynamic object, or generating a
- shared library, finish up the dynamic linking information. */
- if (dynamic)
- {
- bfd_byte *dyncon, *dynconend;
-
- /* Fix up .dynamic entries. */
- o = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (o != NULL);
-
- dyncon = o->contents;
- dynconend = o->contents + o->_raw_size;
- for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- unsigned int type;
-
- bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- continue;
- case DT_NULL:
- if (relativecount > 0 && dyncon + bed->s->sizeof_dyn < dynconend)
- {
- switch (elf_section_data (reldyn)->this_hdr.sh_type)
- {
- case SHT_REL: dyn.d_tag = DT_RELCOUNT; break;
- case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break;
- default: continue;
- }
- dyn.d_un.d_val = relativecount;
- relativecount = 0;
- break;
- }
- continue;
-
- case DT_INIT:
- name = info->init_function;
- goto get_sym;
- case DT_FINI:
- name = info->fini_function;
- get_sym:
- {
- struct elf_link_hash_entry *h;
-
- h = elf_link_hash_lookup (elf_hash_table (info), name,
- FALSE, FALSE, TRUE);
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- dyn.d_un.d_val = h->root.u.def.value;
- o = h->root.u.def.section;
- if (o->output_section != NULL)
- dyn.d_un.d_val += (o->output_section->vma
- + o->output_offset);
- else
- {
- /* The symbol is imported from another shared
- library and does not apply to this one. */
- dyn.d_un.d_val = 0;
- }
- break;
- }
- }
- continue;
-
- case DT_PREINIT_ARRAYSZ:
- name = ".preinit_array";
- goto get_size;
- case DT_INIT_ARRAYSZ:
- name = ".init_array";
- goto get_size;
- case DT_FINI_ARRAYSZ:
- name = ".fini_array";
- get_size:
- o = bfd_get_section_by_name (abfd, name);
- if (o == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: could not find output section %s"),
- bfd_get_filename (abfd), name);
- goto error_return;
- }
- if (o->_raw_size == 0)
- (*_bfd_error_handler)
- (_("warning: %s section has zero size"), name);
- dyn.d_un.d_val = o->_raw_size;
- break;
-
- case DT_PREINIT_ARRAY:
- name = ".preinit_array";
- goto get_vma;
- case DT_INIT_ARRAY:
- name = ".init_array";
- goto get_vma;
- case DT_FINI_ARRAY:
- name = ".fini_array";
- goto get_vma;
-
- case DT_HASH:
- name = ".hash";
- goto get_vma;
- case DT_STRTAB:
- name = ".dynstr";
- goto get_vma;
- case DT_SYMTAB:
- name = ".dynsym";
- goto get_vma;
- case DT_VERDEF:
- name = ".gnu.version_d";
- goto get_vma;
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
- o = bfd_get_section_by_name (abfd, name);
- if (o == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: could not find output section %s"),
- bfd_get_filename (abfd), name);
- goto error_return;
- }
- dyn.d_un.d_ptr = o->vma;
- break;
-
- case DT_REL:
- case DT_RELA:
- case DT_RELSZ:
- case DT_RELASZ:
- if (dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ)
- type = SHT_REL;
- else
- type = SHT_RELA;
- dyn.d_un.d_val = 0;
- for (i = 1; i < elf_numsections (abfd); i++)
- {
- Elf_Internal_Shdr *hdr;
-
- hdr = elf_elfsections (abfd)[i];
- if (hdr->sh_type == type
- && (hdr->sh_flags & SHF_ALLOC) != 0)
- {
- if (dyn.d_tag == DT_RELSZ || dyn.d_tag == DT_RELASZ)
- dyn.d_un.d_val += hdr->sh_size;
- else
- {
- if (dyn.d_un.d_val == 0
- || hdr->sh_addr < dyn.d_un.d_val)
- dyn.d_un.d_val = hdr->sh_addr;
- }
- }
- }
- break;
- }
- bed->s->swap_dyn_out (dynobj, &dyn, dyncon);
- }
- }
-
- /* If we have created any dynamic sections, then output them. */
- if (dynobj != NULL)
- {
- if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info))
- goto error_return;
-
- for (o = dynobj->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_HAS_CONTENTS) == 0
- || o->_raw_size == 0
- || o->output_section == bfd_abs_section_ptr)
- continue;
- if ((o->flags & SEC_LINKER_CREATED) == 0)
- {
- /* At this point, we are only interested in sections
- created by _bfd_elf_link_create_dynamic_sections. */
- continue;
- }
- if ((elf_section_data (o->output_section)->this_hdr.sh_type
- != SHT_STRTAB)
- || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
- {
- if (! bfd_set_section_contents (abfd, o->output_section,
- o->contents,
- (file_ptr) o->output_offset,
- o->_raw_size))
- goto error_return;
- }
- else
- {
- /* The contents of the .dynstr section are actually in a
- stringtab. */
- off = elf_section_data (o->output_section)->this_hdr.sh_offset;
- if (bfd_seek (abfd, off, SEEK_SET) != 0
- || ! _bfd_elf_strtab_emit (abfd,
- elf_hash_table (info)->dynstr))
- goto error_return;
- }
- }
- }
-
- if (info->relocatable)
- {
- bfd_boolean failed = FALSE;
-
- bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
- if (failed)
- goto error_return;
- }
-
- /* If we have optimized stabs strings, output them. */
- if (elf_hash_table (info)->stab_info != NULL)
- {
- if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info))
- goto error_return;
- }
-
- if (info->eh_frame_hdr)
- {
- if (! _bfd_elf_write_section_eh_frame_hdr (abfd, info))
- goto error_return;
- }
-
- if (finfo.symstrtab != NULL)
- _bfd_stringtab_free (finfo.symstrtab);
- if (finfo.contents != NULL)
- free (finfo.contents);
- if (finfo.external_relocs != NULL)
- free (finfo.external_relocs);
- if (finfo.internal_relocs != NULL)
- free (finfo.internal_relocs);
- if (finfo.external_syms != NULL)
- free (finfo.external_syms);
- if (finfo.locsym_shndx != NULL)
- free (finfo.locsym_shndx);
- if (finfo.internal_syms != NULL)
- free (finfo.internal_syms);
- if (finfo.indices != NULL)
- free (finfo.indices);
- if (finfo.sections != NULL)
- free (finfo.sections);
- if (finfo.symbuf != NULL)
- free (finfo.symbuf);
- if (finfo.symshndxbuf != NULL)
- free (finfo.symshndxbuf);
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) != 0
- && elf_section_data (o)->rel_hashes != NULL)
- free (elf_section_data (o)->rel_hashes);
- }
-
- elf_tdata (abfd)->linker = TRUE;
-
- return TRUE;
-
- error_return:
- if (finfo.symstrtab != NULL)
- _bfd_stringtab_free (finfo.symstrtab);
- if (finfo.contents != NULL)
- free (finfo.contents);
- if (finfo.external_relocs != NULL)
- free (finfo.external_relocs);
- if (finfo.internal_relocs != NULL)
- free (finfo.internal_relocs);
- if (finfo.external_syms != NULL)
- free (finfo.external_syms);
- if (finfo.locsym_shndx != NULL)
- free (finfo.locsym_shndx);
- if (finfo.internal_syms != NULL)
- free (finfo.internal_syms);
- if (finfo.indices != NULL)
- free (finfo.indices);
- if (finfo.sections != NULL)
- free (finfo.sections);
- if (finfo.symbuf != NULL)
- free (finfo.symbuf);
- if (finfo.symshndxbuf != NULL)
- free (finfo.symshndxbuf);
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) != 0
- && elf_section_data (o)->rel_hashes != NULL)
- free (elf_section_data (o)->rel_hashes);
- }
-
- return FALSE;
-}
-
-/* Garbage collect unused sections. */
-
-/* The mark phase of garbage collection. For a given section, mark
- it and any sections in this section's group, and all the sections
- which define symbols to which it refers. */
-
-typedef asection * (*gc_mark_hook_fn)
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *);
-
-static bfd_boolean
-elf_gc_mark (struct bfd_link_info *info,
- asection *sec,
- gc_mark_hook_fn gc_mark_hook)
-{
- bfd_boolean ret;
- asection *group_sec;
-
- sec->gc_mark = 1;
-
- /* Mark all the sections in the group. */
- group_sec = elf_section_data (sec)->next_in_group;
- if (group_sec && !group_sec->gc_mark)
- if (!elf_gc_mark (info, group_sec, gc_mark_hook))
- return FALSE;
-
- /* Look through the section relocs. */
- ret = TRUE;
- if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0)
- {
- Elf_Internal_Rela *relstart, *rel, *relend;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- size_t nlocsyms;
- size_t extsymoff;
- bfd *input_bfd = sec->owner;
- const struct elf_backend_data *bed = get_elf_backend_data (input_bfd);
- Elf_Internal_Sym *isym = NULL;
- int r_sym_shift;
-
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
-
- /* Read the local symbols. */
- if (elf_bad_symtab (input_bfd))
- {
- nlocsyms = symtab_hdr->sh_size / bed->s->sizeof_sym;
- extsymoff = 0;
- }
- else
- extsymoff = nlocsyms = symtab_hdr->sh_info;
-
- isym = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isym == NULL && nlocsyms != 0)
- {
- isym = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, nlocsyms, 0,
- NULL, NULL, NULL);
- if (isym == NULL)
- return FALSE;
- }
-
- /* Read the relocations. */
- relstart = _bfd_elf_link_read_relocs (input_bfd, sec, NULL, NULL,
- info->keep_memory);
- if (relstart == NULL)
- {
- ret = FALSE;
- goto out1;
- }
- relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
-
- if (bed->s->arch_size == 32)
- r_sym_shift = 8;
- else
- r_sym_shift = 32;
-
- for (rel = relstart; rel < relend; rel++)
- {
- unsigned long r_symndx;
- asection *rsec;
- struct elf_link_hash_entry *h;
-
- r_symndx = rel->r_info >> r_sym_shift;
- if (r_symndx == 0)
- continue;
-
- if (r_symndx >= nlocsyms
- || ELF_ST_BIND (isym[r_symndx].st_info) != STB_LOCAL)
- {
- h = sym_hashes[r_symndx - extsymoff];
- rsec = (*gc_mark_hook) (sec, info, rel, h, NULL);
- }
- else
- {
- rsec = (*gc_mark_hook) (sec, info, rel, NULL, &isym[r_symndx]);
- }
-
- if (rsec && !rsec->gc_mark)
- {
- if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour)
- rsec->gc_mark = 1;
- else if (!elf_gc_mark (info, rsec, gc_mark_hook))
- {
- ret = FALSE;
- goto out2;
- }
- }
- }
-
- out2:
- if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
- out1:
- if (isym != NULL && symtab_hdr->contents != (unsigned char *) isym)
- {
- if (! info->keep_memory)
- free (isym);
- else
- symtab_hdr->contents = (unsigned char *) isym;
- }
- }
-
- return ret;
-}
-
-/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */
-
-static bfd_boolean
-elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *idxptr)
-{
- int *idx = idxptr;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx != -1
- && ((h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || h->root.u.def.section->gc_mark))
- h->dynindx = (*idx)++;
-
- return TRUE;
-}
-
-/* The sweep phase of garbage collection. Remove all garbage sections. */
-
-typedef bfd_boolean (*gc_sweep_hook_fn)
- (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
-
-static bfd_boolean
-elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook)
-{
- bfd *sub;
-
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- asection *o;
-
- if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
- continue;
-
- for (o = sub->sections; o != NULL; o = o->next)
- {
- /* Keep special sections. Keep .debug sections. */
- if ((o->flags & SEC_LINKER_CREATED)
- || (o->flags & SEC_DEBUGGING))
- o->gc_mark = 1;
-
- if (o->gc_mark)
- continue;
-
- /* Skip sweeping sections already excluded. */
- if (o->flags & SEC_EXCLUDE)
- continue;
-
- /* Since this is early in the link process, it is simple
- to remove a section from the output. */
- o->flags |= SEC_EXCLUDE;
-
- /* But we also have to update some of the relocation
- info we collected before. */
- if (gc_sweep_hook
- && (o->flags & SEC_RELOC) && o->reloc_count > 0)
- {
- Elf_Internal_Rela *internal_relocs;
- bfd_boolean r;
-
- internal_relocs
- = _bfd_elf_link_read_relocs (o->owner, o, NULL, NULL,
- info->keep_memory);
- if (internal_relocs == NULL)
- return FALSE;
-
- r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs);
-
- if (elf_section_data (o)->relocs != internal_relocs)
- free (internal_relocs);
-
- if (!r)
- return FALSE;
- }
- }
- }
-
- /* Remove the symbols that were in the swept sections from the dynamic
- symbol table. GCFIXME: Anyone know how to get them out of the
- static symbol table as well? */
- {
- int i = 0;
-
- elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol, &i);
-
- elf_hash_table (info)->dynsymcount = i;
- }
-
- return TRUE;
-}
-
-/* Propagate collected vtable information. This is called through
- elf_link_hash_traverse. */
-
-static bfd_boolean
-elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
-{
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Those that are not vtables. */
- if (h->vtable_parent == NULL)
- return TRUE;
-
- /* Those vtables that do not have parents, we cannot merge. */
- if (h->vtable_parent == (struct elf_link_hash_entry *) -1)
- return TRUE;
-
- /* If we've already been done, exit. */
- if (h->vtable_entries_used && h->vtable_entries_used[-1])
- return TRUE;
-
- /* Make sure the parent's table is up to date. */
- elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp);
-
- if (h->vtable_entries_used == NULL)
- {
- /* None of this table's entries were referenced. Re-use the
- parent's table. */
- h->vtable_entries_used = h->vtable_parent->vtable_entries_used;
- h->vtable_entries_size = h->vtable_parent->vtable_entries_size;
- }
- else
- {
- size_t n;
- bfd_boolean *cu, *pu;
-
- /* Or the parent's entries into ours. */
- cu = h->vtable_entries_used;
- cu[-1] = TRUE;
- pu = h->vtable_parent->vtable_entries_used;
- if (pu != NULL)
- {
- const struct elf_backend_data *bed;
- unsigned int log_file_align;
-
- bed = get_elf_backend_data (h->root.u.def.section->owner);
- log_file_align = bed->s->log_file_align;
- n = h->vtable_parent->vtable_entries_size >> log_file_align;
- while (n--)
- {
- if (*pu)
- *cu = TRUE;
- pu++;
- cu++;
- }
- }
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
-{
- asection *sec;
- bfd_vma hstart, hend;
- Elf_Internal_Rela *relstart, *relend, *rel;
- const struct elf_backend_data *bed;
- unsigned int log_file_align;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Take care of both those symbols that do not describe vtables as
- well as those that are not loaded. */
- if (h->vtable_parent == NULL)
- return TRUE;
-
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak);
-
- sec = h->root.u.def.section;
- hstart = h->root.u.def.value;
- hend = hstart + h->size;
-
- relstart = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, TRUE);
- if (!relstart)
- return *(bfd_boolean *) okp = FALSE;
- bed = get_elf_backend_data (sec->owner);
- log_file_align = bed->s->log_file_align;
-
- relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
-
- for (rel = relstart; rel < relend; ++rel)
- if (rel->r_offset >= hstart && rel->r_offset < hend)
- {
- /* If the entry is in use, do nothing. */
- if (h->vtable_entries_used
- && (rel->r_offset - hstart) < h->vtable_entries_size)
- {
- bfd_vma entry = (rel->r_offset - hstart) >> log_file_align;
- if (h->vtable_entries_used[entry])
- continue;
- }
- /* Otherwise, kill it. */
- rel->r_offset = rel->r_info = rel->r_addend = 0;
- }
-
- return TRUE;
-}
-
-/* Do mark and sweep of unused sections. */
-
-bfd_boolean
-bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
-{
- bfd_boolean ok = TRUE;
- bfd *sub;
- asection * (*gc_mark_hook)
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *);
-
- if (!get_elf_backend_data (abfd)->can_gc_sections
- || info->relocatable
- || info->emitrelocations
- || !is_elf_hash_table (info->hash)
- || elf_hash_table (info)->dynamic_sections_created)
- {
- (*_bfd_error_handler)(_("Warning: gc-sections option ignored"));
- return TRUE;
- }
-
- /* Apply transitive closure to the vtable entry usage info. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_propagate_vtable_entries_used,
- &ok);
- if (!ok)
- return FALSE;
-
- /* Kill the vtable relocations that were not used. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_smash_unused_vtentry_relocs,
- &ok);
- if (!ok)
- return FALSE;
-
- /* Grovel through relocs to find out who stays ... */
-
- gc_mark_hook = get_elf_backend_data (abfd)->gc_mark_hook;
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- asection *o;
-
- if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
- continue;
-
- for (o = sub->sections; o != NULL; o = o->next)
- {
- if (o->flags & SEC_KEEP)
- if (!elf_gc_mark (info, o, gc_mark_hook))
- return FALSE;
- }
- }
-
- /* ... and mark SEC_EXCLUDE for those that go. */
- if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook))
- return FALSE;
-
- return TRUE;
-}
-
-/* Called from check_relocs to record the existence of a VTINHERIT reloc. */
-
-bfd_boolean
-bfd_elf_gc_record_vtinherit (bfd *abfd,
- asection *sec,
- struct elf_link_hash_entry *h,
- bfd_vma offset)
-{
- struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
- struct elf_link_hash_entry **search, *child;
- bfd_size_type extsymcount;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- /* The sh_info field of the symtab header tells us where the
- external symbols start. We don't care about the local symbols at
- this point. */
- extsymcount = elf_tdata (abfd)->symtab_hdr.sh_size / bed->s->sizeof_sym;
- if (!elf_bad_symtab (abfd))
- extsymcount -= elf_tdata (abfd)->symtab_hdr.sh_info;
-
- sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = sym_hashes + extsymcount;
-
- /* Hunt down the child symbol, which is in this section at the same
- offset as the relocation. */
- for (search = sym_hashes; search != sym_hashes_end; ++search)
- {
- if ((child = *search) != NULL
- && (child->root.type == bfd_link_hash_defined
- || child->root.type == bfd_link_hash_defweak)
- && child->root.u.def.section == sec
- && child->root.u.def.value == offset)
- goto win;
- }
-
- (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT",
- bfd_archive_filename (abfd), sec->name,
- (unsigned long) offset);
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
-
- win:
- if (!h)
- {
- /* This *should* only be the absolute section. It could potentially
- be that someone has defined a non-global vtable though, which
- would be bad. It isn't worth paging in the local symbols to be
- sure though; that case should simply be handled by the assembler. */
-
- child->vtable_parent = (struct elf_link_hash_entry *) -1;
- }
- else
- child->vtable_parent = h;
-
- return TRUE;
-}
-
-/* Called from check_relocs to record the existence of a VTENTRY reloc. */
-
-bfd_boolean
-bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry *h,
- bfd_vma addend)
-{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- unsigned int log_file_align = bed->s->log_file_align;
-
- if (addend >= h->vtable_entries_size)
- {
- size_t size, bytes, file_align;
- bfd_boolean *ptr = h->vtable_entries_used;
-
- /* While the symbol is undefined, we have to be prepared to handle
- a zero size. */
- file_align = 1 << log_file_align;
- if (h->root.type == bfd_link_hash_undefined)
- size = addend + file_align;
- else
- {
- size = h->size;
- if (addend >= size)
- {
- /* Oops! We've got a reference past the defined end of
- the table. This is probably a bug -- shall we warn? */
- size = addend + file_align;
- }
- }
- size = (size + file_align - 1) & -file_align;
-
- /* Allocate one extra entry for use as a "done" flag for the
- consolidation pass. */
- bytes = ((size >> log_file_align) + 1) * sizeof (bfd_boolean);
-
- if (ptr)
- {
- ptr = bfd_realloc (ptr - 1, bytes);
-
- if (ptr != NULL)
- {
- size_t oldbytes;
-
- oldbytes = (((h->vtable_entries_size >> log_file_align) + 1)
- * sizeof (bfd_boolean));
- memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
- }
- }
- else
- ptr = bfd_zmalloc (bytes);
-
- if (ptr == NULL)
- return FALSE;
-
- /* And arrange for that done flag to be at index -1. */
- h->vtable_entries_used = ptr + 1;
- h->vtable_entries_size = size;
- }
-
- h->vtable_entries_used[addend >> log_file_align] = TRUE;
-
- return TRUE;
-}
-
-struct alloc_got_off_arg {
- bfd_vma gotoff;
- unsigned int got_elt_size;
-};
-
-/* We need a special top-level link routine to convert got reference counts
- to real got offsets. */
-
-static bfd_boolean
-elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg)
-{
- struct alloc_got_off_arg *gofarg = arg;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->got.refcount > 0)
- {
- h->got.offset = gofarg->gotoff;
- gofarg->gotoff += gofarg->got_elt_size;
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- return TRUE;
-}
-
-/* And an accompanying bit to work out final got entry offsets once
- we're done. Should be called from final_link. */
-
-bfd_boolean
-bfd_elf_gc_common_finalize_got_offsets (bfd *abfd,
- struct bfd_link_info *info)
-{
- bfd *i;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_vma gotoff;
- unsigned int got_elt_size = bed->s->arch_size / 8;
- struct alloc_got_off_arg gofarg;
-
- if (! is_elf_hash_table (info->hash))
- return FALSE;
-
- /* The GOT offset is relative to the .got section, but the GOT header is
- put into the .got.plt section, if the backend uses it. */
- if (bed->want_got_plt)
- gotoff = 0;
- else
- gotoff = bed->got_header_size;
-
- /* Do the local .got entries first. */
- for (i = info->input_bfds; i; i = i->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_size_type j, locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
-
- if (bfd_get_flavour (i) != bfd_target_elf_flavour)
- continue;
-
- local_got = elf_local_got_refcounts (i);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (i)->symtab_hdr;
- if (elf_bad_symtab (i))
- locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
- else
- locsymcount = symtab_hdr->sh_info;
-
- for (j = 0; j < locsymcount; ++j)
- {
- if (local_got[j] > 0)
- {
- local_got[j] = gotoff;
- gotoff += got_elt_size;
- }
- else
- local_got[j] = (bfd_vma) -1;
- }
- }
-
- /* Then the global .got entries. .plt refcounts are handled by
- adjust_dynamic_symbol */
- gofarg.gotoff = gotoff;
- gofarg.got_elt_size = got_elt_size;
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_allocate_got_offsets,
- &gofarg);
- return TRUE;
-}
-
-/* Many folk need no more in the way of final link than this, once
- got entry reference counting is enabled. */
-
-bfd_boolean
-bfd_elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
-{
- if (!bfd_elf_gc_common_finalize_got_offsets (abfd, info))
- return FALSE;
-
- /* Invoke the regular ELF backend linker to do all the work. */
- return bfd_elf_final_link (abfd, info);
-}
-
-bfd_boolean
-bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
-{
- struct elf_reloc_cookie *rcookie = cookie;
-
- if (rcookie->bad_symtab)
- rcookie->rel = rcookie->rels;
-
- for (; rcookie->rel < rcookie->relend; rcookie->rel++)
- {
- unsigned long r_symndx;
-
- if (! rcookie->bad_symtab)
- if (rcookie->rel->r_offset > offset)
- return FALSE;
- if (rcookie->rel->r_offset != offset)
- continue;
-
- r_symndx = rcookie->rel->r_info >> rcookie->r_sym_shift;
- if (r_symndx == SHN_UNDEF)
- return TRUE;
-
- if (r_symndx >= rcookie->locsymcount
- || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL)
- {
- struct elf_link_hash_entry *h;
-
- h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff];
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && elf_discarded_section (h->root.u.def.section))
- return TRUE;
- else
- return FALSE;
- }
- else
- {
- /* It's not a relocation against a global symbol,
- but it could be a relocation against a local
- symbol for a discarded section. */
- asection *isec;
- Elf_Internal_Sym *isym;
-
- /* Need to: get the symbol; get the section. */
- isym = &rcookie->locsyms[r_symndx];
- if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
- {
- isec = bfd_section_from_elf_index (rcookie->abfd, isym->st_shndx);
- if (isec != NULL && elf_discarded_section (isec))
- return TRUE;
- }
- }
- return FALSE;
- }
- return FALSE;
-}
-
-/* Discard unneeded references to discarded sections.
- Returns TRUE if any section's size was changed. */
-/* This function assumes that the relocations are in sorted order,
- which is true for all known assemblers. */
-
-bfd_boolean
-bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
-{
- struct elf_reloc_cookie cookie;
- asection *stab, *eh;
- Elf_Internal_Shdr *symtab_hdr;
- const struct elf_backend_data *bed;
- bfd *abfd;
- unsigned int count;
- bfd_boolean ret = FALSE;
-
- if (info->traditional_format
- || !is_elf_hash_table (info->hash))
- return FALSE;
-
- for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
- {
- if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
- continue;
-
- bed = get_elf_backend_data (abfd);
-
- if ((abfd->flags & DYNAMIC) != 0)
- continue;
-
- eh = bfd_get_section_by_name (abfd, ".eh_frame");
- if (info->relocatable
- || (eh != NULL
- && (eh->_raw_size == 0
- || bfd_is_abs_section (eh->output_section))))
- eh = NULL;
-
- stab = bfd_get_section_by_name (abfd, ".stab");
- if (stab != NULL
- && (stab->_raw_size == 0
- || bfd_is_abs_section (stab->output_section)
- || stab->sec_info_type != ELF_INFO_TYPE_STABS))
- stab = NULL;
-
- if (stab == NULL
- && eh == NULL
- && bed->elf_backend_discard_info == NULL)
- continue;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- cookie.abfd = abfd;
- cookie.sym_hashes = elf_sym_hashes (abfd);
- cookie.bad_symtab = elf_bad_symtab (abfd);
- if (cookie.bad_symtab)
- {
- cookie.locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
- cookie.extsymoff = 0;
- }
- else
- {
- cookie.locsymcount = symtab_hdr->sh_info;
- cookie.extsymoff = symtab_hdr->sh_info;
- }
-
- if (bed->s->arch_size == 32)
- cookie.r_sym_shift = 8;
- else
- cookie.r_sym_shift = 32;
-
- cookie.locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (cookie.locsyms == NULL && cookie.locsymcount != 0)
- {
- cookie.locsyms = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- cookie.locsymcount, 0,
- NULL, NULL, NULL);
- if (cookie.locsyms == NULL)
- return FALSE;
- }
-
- if (stab != NULL)
- {
- cookie.rels = NULL;
- count = stab->reloc_count;
- if (count != 0)
- cookie.rels = _bfd_elf_link_read_relocs (abfd, stab, NULL, NULL,
- info->keep_memory);
- if (cookie.rels != NULL)
- {
- cookie.rel = cookie.rels;
- cookie.relend = cookie.rels;
- cookie.relend += count * bed->s->int_rels_per_ext_rel;
- if (_bfd_discard_section_stabs (abfd, stab,
- elf_section_data (stab)->sec_info,
- bfd_elf_reloc_symbol_deleted_p,
- &cookie))
- ret = TRUE;
- if (elf_section_data (stab)->relocs != cookie.rels)
- free (cookie.rels);
- }
- }
-
- if (eh != NULL)
- {
- cookie.rels = NULL;
- count = eh->reloc_count;
- if (count != 0)
- cookie.rels = _bfd_elf_link_read_relocs (abfd, eh, NULL, NULL,
- info->keep_memory);
- cookie.rel = cookie.rels;
- cookie.relend = cookie.rels;
- if (cookie.rels != NULL)
- cookie.relend += count * bed->s->int_rels_per_ext_rel;
-
- if (_bfd_elf_discard_section_eh_frame (abfd, info, eh,
- bfd_elf_reloc_symbol_deleted_p,
- &cookie))
- ret = TRUE;
-
- if (cookie.rels != NULL
- && elf_section_data (eh)->relocs != cookie.rels)
- free (cookie.rels);
- }
-
- if (bed->elf_backend_discard_info != NULL
- && (*bed->elf_backend_discard_info) (abfd, &cookie, info))
- ret = TRUE;
-
- if (cookie.locsyms != NULL
- && symtab_hdr->contents != (unsigned char *) cookie.locsyms)
- {
- if (! info->keep_memory)
- free (cookie.locsyms);
- else
- symtab_hdr->contents = (unsigned char *) cookie.locsyms;
- }
- }
-
- if (info->eh_frame_hdr
- && !info->relocatable
- && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info))
- ret = TRUE;
-
- return ret;
-}
diff --git a/contrib/binutils/bfd/elflink.h b/contrib/binutils/bfd/elflink.h
deleted file mode 100644
index 6887e50..0000000
--- a/contrib/binutils/bfd/elflink.h
+++ /dev/null
@@ -1,8532 +0,0 @@
-/* ELF linker support.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* ELF linker code. */
-
-/* This struct is used to pass information to routines called via
- elf_link_hash_traverse which must return failure. */
-
-struct elf_info_failed
-{
- boolean failed;
- struct bfd_link_info *info;
- struct bfd_elf_version_tree *verdefs;
-};
-
-static boolean is_global_data_symbol_definition
- PARAMS ((bfd *, Elf_Internal_Sym *));
-static boolean elf_link_is_defined_archive_symbol
- PARAMS ((bfd *, carsym *));
-static boolean elf_link_add_object_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_link_add_archive_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_merge_symbol
- PARAMS ((bfd *, struct bfd_link_info *, const char *,
- Elf_Internal_Sym *, asection **, bfd_vma *,
- struct elf_link_hash_entry **, boolean *, boolean *,
- boolean *, boolean));
-static boolean elf_add_default_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
- boolean *, boolean, boolean));
-static boolean elf_export_symbol
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_finalize_dynstr
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_fix_symbol_flags
- PARAMS ((struct elf_link_hash_entry *, struct elf_info_failed *));
-static boolean elf_adjust_dynamic_symbol
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_find_version_dependencies
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_assign_sym_version
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_collect_hash_codes
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_read_relocs_from_section
- PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *));
-static size_t compute_bucket_count
- PARAMS ((struct bfd_link_info *));
-static boolean elf_link_output_relocs
- PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
-static boolean elf_link_size_reloc_section
- PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
-static void elf_link_adjust_relocs
- PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned int,
- struct elf_link_hash_entry **));
-static int elf_link_sort_cmp1
- PARAMS ((const void *, const void *));
-static int elf_link_sort_cmp2
- PARAMS ((const void *, const void *));
-static size_t elf_link_sort_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection **));
-static boolean elf_section_ignore_discarded_relocs
- PARAMS ((asection *));
-
-/* Given an ELF BFD, add symbols to the global hash table as
- appropriate. */
-
-boolean
-elf_bfd_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
- return elf_link_add_object_symbols (abfd, info);
- case bfd_archive:
- return elf_link_add_archive_symbols (abfd, info);
- default:
- bfd_set_error (bfd_error_wrong_format);
- return false;
- }
-}
-
-/* Return true iff this is a non-common, definition of a non-function symbol. */
-static boolean
-is_global_data_symbol_definition (abfd, sym)
- bfd * abfd ATTRIBUTE_UNUSED;
- Elf_Internal_Sym * sym;
-{
- /* Local symbols do not count, but target specific ones might. */
- if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL
- && ELF_ST_BIND (sym->st_info) < STB_LOOS)
- return false;
-
- /* Function symbols do not count. */
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
- return false;
-
- /* If the section is undefined, then so is the symbol. */
- if (sym->st_shndx == SHN_UNDEF)
- return false;
-
- /* If the symbol is defined in the common section, then
- it is a common definition and so does not count. */
- if (sym->st_shndx == SHN_COMMON)
- return false;
-
- /* If the symbol is in a target specific section then we
- must rely upon the backend to tell us what it is. */
- if (sym->st_shndx >= SHN_LORESERVE && sym->st_shndx < SHN_ABS)
- /* FIXME - this function is not coded yet:
-
- return _bfd_is_global_symbol_definition (abfd, sym);
-
- Instead for now assume that the definition is not global,
- Even if this is wrong, at least the linker will behave
- in the same way that it used to do. */
- return false;
-
- return true;
-}
-
-/* Search the symbol table of the archive element of the archive ABFD
- whose archive map contains a mention of SYMDEF, and determine if
- the symbol is defined in this element. */
-static boolean
-elf_link_is_defined_archive_symbol (abfd, symdef)
- bfd * abfd;
- carsym * symdef;
-{
- Elf_Internal_Shdr * hdr;
- bfd_size_type symcount;
- bfd_size_type extsymcount;
- bfd_size_type extsymoff;
- Elf_Internal_Sym *isymbuf;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- boolean result;
-
- abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
- if (abfd == (bfd *) NULL)
- return false;
-
- if (! bfd_check_format (abfd, bfd_object))
- return false;
-
- /* If we have already included the element containing this symbol in the
- link then we do not need to include it again. Just claim that any symbol
- it contains is not a definition, so that our caller will not decide to
- (re)include this element. */
- if (abfd->archive_pass)
- return false;
-
- /* Select the appropriate symbol table. */
- if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
- hdr = &elf_tdata (abfd)->symtab_hdr;
- else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
-
- symcount = hdr->sh_size / sizeof (Elf_External_Sym);
-
- /* The sh_info field of the symtab header tells us where the
- external symbols start. We don't care about the local symbols. */
- if (elf_bad_symtab (abfd))
- {
- extsymcount = symcount;
- extsymoff = 0;
- }
- else
- {
- extsymcount = symcount - hdr->sh_info;
- extsymoff = hdr->sh_info;
- }
-
- if (extsymcount == 0)
- return false;
-
- /* Read in the symbol table. */
- isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- return false;
-
- /* Scan the symbol table looking for SYMDEF. */
- result = false;
- for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; isym++)
- {
- const char *name;
-
- name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- isym->st_name);
- if (name == (const char *) NULL)
- break;
-
- if (strcmp (name, symdef->name) == 0)
- {
- result = is_global_data_symbol_definition (abfd, isym);
- break;
- }
- }
-
- free (isymbuf);
-
- return result;
-}
-
-/* Add symbols from an ELF archive file to the linker hash table. We
- don't use _bfd_generic_link_add_archive_symbols because of a
- problem which arises on UnixWare. The UnixWare libc.so is an
- archive which includes an entry libc.so.1 which defines a bunch of
- symbols. The libc.so archive also includes a number of other
- object files, which also define symbols, some of which are the same
- as those defined in libc.so.1. Correct linking requires that we
- consider each object file in turn, and include it if it defines any
- symbols we need. _bfd_generic_link_add_archive_symbols does not do
- this; it looks through the list of undefined symbols, and includes
- any object file which defines them. When this algorithm is used on
- UnixWare, it winds up pulling in libc.so.1 early and defining a
- bunch of symbols. This means that some of the other objects in the
- archive are not included in the link, which is incorrect since they
- precede libc.so.1 in the archive.
-
- Fortunately, ELF archive handling is simpler than that done by
- _bfd_generic_link_add_archive_symbols, which has to allow for a.out
- oddities. In ELF, if we find a symbol in the archive map, and the
- symbol is currently undefined, we know that we must pull in that
- object file.
-
- Unfortunately, we do have to make multiple passes over the symbol
- table until nothing further is resolved. */
-
-static boolean
-elf_link_add_archive_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- symindex c;
- boolean *defined = NULL;
- boolean *included = NULL;
- carsym *symdefs;
- boolean loop;
- bfd_size_type amt;
-
- if (! bfd_has_map (abfd))
- {
- /* An empty archive is a special case. */
- if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
- return true;
- bfd_set_error (bfd_error_no_armap);
- return false;
- }
-
- /* Keep track of all symbols we know to be already defined, and all
- files we know to be already included. This is to speed up the
- second and subsequent passes. */
- c = bfd_ardata (abfd)->symdef_count;
- if (c == 0)
- return true;
- amt = c;
- amt *= sizeof (boolean);
- defined = (boolean *) bfd_zmalloc (amt);
- included = (boolean *) bfd_zmalloc (amt);
- if (defined == (boolean *) NULL || included == (boolean *) NULL)
- goto error_return;
-
- symdefs = bfd_ardata (abfd)->symdefs;
-
- do
- {
- file_ptr last;
- symindex i;
- carsym *symdef;
- carsym *symdefend;
-
- loop = false;
- last = -1;
-
- symdef = symdefs;
- symdefend = symdef + c;
- for (i = 0; symdef < symdefend; symdef++, i++)
- {
- struct elf_link_hash_entry *h;
- bfd *element;
- struct bfd_link_hash_entry *undefs_tail;
- symindex mark;
-
- if (defined[i] || included[i])
- continue;
- if (symdef->file_offset == last)
- {
- included[i] = true;
- continue;
- }
-
- h = elf_link_hash_lookup (elf_hash_table (info), symdef->name,
- false, false, false);
-
- if (h == NULL)
- {
- char *p, *copy;
- size_t len, first;
-
- /* If this is a default version (the name contains @@),
- look up the symbol again with only one `@' as well
- as without the version. The effect is that references
- to the symbol with and without the version will be
- matched by the default symbol in the archive. */
-
- p = strchr (symdef->name, ELF_VER_CHR);
- if (p == NULL || p[1] != ELF_VER_CHR)
- continue;
-
- /* First check with only one `@'. */
- len = strlen (symdef->name);
- copy = bfd_alloc (abfd, (bfd_size_type) len);
- if (copy == NULL)
- goto error_return;
- first = p - symdef->name + 1;
- memcpy (copy, symdef->name, first);
- memcpy (copy + first, symdef->name + first + 1, len - first);
-
- h = elf_link_hash_lookup (elf_hash_table (info), copy,
- false, false, false);
-
- if (h == NULL)
- {
- /* We also need to check references to the symbol
- without the version. */
-
- copy[first - 1] = '\0';
- h = elf_link_hash_lookup (elf_hash_table (info),
- copy, false, false, false);
- }
-
- bfd_release (abfd, copy);
- }
-
- if (h == NULL)
- continue;
-
- if (h->root.type == bfd_link_hash_common)
- {
- /* We currently have a common symbol. The archive map contains
- a reference to this symbol, so we may want to include it. We
- only want to include it however, if this archive element
- contains a definition of the symbol, not just another common
- declaration of it.
-
- Unfortunately some archivers (including GNU ar) will put
- declarations of common symbols into their archive maps, as
- well as real definitions, so we cannot just go by the archive
- map alone. Instead we must read in the element's symbol
- table and check that to see what kind of symbol definition
- this is. */
- if (! elf_link_is_defined_archive_symbol (abfd, symdef))
- continue;
- }
- else if (h->root.type != bfd_link_hash_undefined)
- {
- if (h->root.type != bfd_link_hash_undefweak)
- defined[i] = true;
- continue;
- }
-
- /* We need to include this archive member. */
- element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
- if (element == (bfd *) NULL)
- goto error_return;
-
- if (! bfd_check_format (element, bfd_object))
- goto error_return;
-
- /* Doublecheck that we have not included this object
- already--it should be impossible, but there may be
- something wrong with the archive. */
- if (element->archive_pass != 0)
- {
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- element->archive_pass = 1;
-
- undefs_tail = info->hash->undefs_tail;
-
- if (! (*info->callbacks->add_archive_element) (info, element,
- symdef->name))
- goto error_return;
- if (! elf_link_add_object_symbols (element, info))
- goto error_return;
-
- /* If there are any new undefined symbols, we need to make
- another pass through the archive in order to see whether
- they can be defined. FIXME: This isn't perfect, because
- common symbols wind up on undefs_tail and because an
- undefined symbol which is defined later on in this pass
- does not require another pass. This isn't a bug, but it
- does make the code less efficient than it could be. */
- if (undefs_tail != info->hash->undefs_tail)
- loop = true;
-
- /* Look backward to mark all symbols from this object file
- which we have already seen in this pass. */
- mark = i;
- do
- {
- included[mark] = true;
- if (mark == 0)
- break;
- --mark;
- }
- while (symdefs[mark].file_offset == symdef->file_offset);
-
- /* We mark subsequent symbols from this object file as we go
- on through the loop. */
- last = symdef->file_offset;
- }
- }
- while (loop);
-
- free (defined);
- free (included);
-
- return true;
-
- error_return:
- if (defined != (boolean *) NULL)
- free (defined);
- if (included != (boolean *) NULL)
- free (included);
- return false;
-}
-
-/* This function is called when we want to define a new symbol. It
- handles the various cases which arise when we find a definition in
- a dynamic object, or when there is already a definition in a
- dynamic object. The new symbol is described by NAME, SYM, PSEC,
- and PVALUE. We set SYM_HASH to the hash table entry. We set
- OVERRIDE if the old symbol is overriding a new definition. We set
- TYPE_CHANGE_OK if it is OK for the type to change. We set
- SIZE_CHANGE_OK if it is OK for the size to change. By OK to
- change, we mean that we shouldn't warn if the type or size does
- change. DT_NEEDED indicates if it comes from a DT_NEEDED entry of
- a shared object. */
-
-static boolean
-elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
- override, type_change_ok, size_change_ok, dt_needed)
- bfd *abfd;
- struct bfd_link_info *info;
- const char *name;
- Elf_Internal_Sym *sym;
- asection **psec;
- bfd_vma *pvalue;
- struct elf_link_hash_entry **sym_hash;
- boolean *override;
- boolean *type_change_ok;
- boolean *size_change_ok;
- boolean dt_needed;
-{
- asection *sec;
- struct elf_link_hash_entry *h;
- int bind;
- bfd *oldbfd;
- boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon;
-
- *override = false;
-
- sec = *psec;
- bind = ELF_ST_BIND (sym->st_info);
-
- if (! bfd_is_und_section (sec))
- h = elf_link_hash_lookup (elf_hash_table (info), name, true, false, false);
- else
- h = ((struct elf_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info, name, true, false, false));
- if (h == NULL)
- return false;
- *sym_hash = h;
-
- /* This code is for coping with dynamic objects, and is only useful
- if we are doing an ELF link. */
- if (info->hash->creator != abfd->xvec)
- return true;
-
- /* For merging, we only care about real symbols. */
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* If we just created the symbol, mark it as being an ELF symbol.
- Other than that, there is nothing to do--there is no merge issue
- with a newly defined symbol--so we just return. */
-
- if (h->root.type == bfd_link_hash_new)
- {
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
- return true;
- }
-
- /* OLDBFD is a BFD associated with the existing symbol. */
-
- switch (h->root.type)
- {
- default:
- oldbfd = NULL;
- break;
-
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- oldbfd = h->root.u.undef.abfd;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- oldbfd = h->root.u.def.section->owner;
- break;
-
- case bfd_link_hash_common:
- oldbfd = h->root.u.c.p->section->owner;
- break;
- }
-
- /* In cases involving weak versioned symbols, we may wind up trying
- to merge a symbol with itself. Catch that here, to avoid the
- confusion that results if we try to override a symbol with
- itself. The additional tests catch cases like
- _GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a
- dynamic object, which we do want to handle here. */
- if (abfd == oldbfd
- && ((abfd->flags & DYNAMIC) == 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
- return true;
-
- /* NEWDYN and OLDDYN indicate whether the new or old symbol,
- respectively, is from a dynamic object. */
-
- if ((abfd->flags & DYNAMIC) != 0)
- newdyn = true;
- else
- newdyn = false;
-
- if (oldbfd != NULL)
- olddyn = (oldbfd->flags & DYNAMIC) != 0;
- else
- {
- asection *hsec;
-
- /* This code handles the special SHN_MIPS_{TEXT,DATA} section
- indices used by MIPS ELF. */
- switch (h->root.type)
- {
- default:
- hsec = NULL;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- hsec = h->root.u.def.section;
- break;
-
- case bfd_link_hash_common:
- hsec = h->root.u.c.p->section;
- break;
- }
-
- if (hsec == NULL)
- olddyn = false;
- else
- olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0;
- }
-
- /* NEWDEF and OLDDEF indicate whether the new or old symbol,
- respectively, appear to be a definition rather than reference. */
-
- if (bfd_is_und_section (sec) || bfd_is_com_section (sec))
- newdef = false;
- else
- newdef = true;
-
- if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_common)
- olddef = false;
- else
- olddef = true;
-
- /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old
- symbol, respectively, appears to be a common symbol in a dynamic
- object. If a symbol appears in an uninitialized section, and is
- not weak, and is not a function, then it may be a common symbol
- which was resolved when the dynamic object was created. We want
- to treat such symbols specially, because they raise special
- considerations when setting the symbol size: if the symbol
- appears as a common symbol in a regular object, and the size in
- the regular object is larger, we must make sure that we use the
- larger size. This problematic case can always be avoided in C,
- but it must be handled correctly when using Fortran shared
- libraries.
-
- Note that if NEWDYNCOMMON is set, NEWDEF will be set, and
- likewise for OLDDYNCOMMON and OLDDEF.
-
- Note that this test is just a heuristic, and that it is quite
- possible to have an uninitialized symbol in a shared object which
- is really a definition, rather than a common symbol. This could
- lead to some minor confusion when the symbol really is a common
- symbol in some regular object. However, I think it will be
- harmless. */
-
- if (newdyn
- && newdef
- && (sec->flags & SEC_ALLOC) != 0
- && (sec->flags & SEC_LOAD) == 0
- && sym->st_size > 0
- && bind != STB_WEAK
- && ELF_ST_TYPE (sym->st_info) != STT_FUNC)
- newdyncommon = true;
- else
- newdyncommon = false;
-
- if (olddyn
- && olddef
- && h->root.type == bfd_link_hash_defined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->root.u.def.section->flags & SEC_ALLOC) != 0
- && (h->root.u.def.section->flags & SEC_LOAD) == 0
- && h->size > 0
- && h->type != STT_FUNC)
- olddyncommon = true;
- else
- olddyncommon = false;
-
- /* It's OK to change the type if either the existing symbol or the
- new symbol is weak unless it comes from a DT_NEEDED entry of
- a shared object, in which case, the DT_NEEDED entry may not be
- required at the run time. */
-
- if ((! dt_needed && h->root.type == bfd_link_hash_defweak)
- || h->root.type == bfd_link_hash_undefweak
- || bind == STB_WEAK)
- *type_change_ok = true;
-
- /* It's OK to change the size if either the existing symbol or the
- new symbol is weak, or if the old symbol is undefined. */
-
- if (*type_change_ok
- || h->root.type == bfd_link_hash_undefined)
- *size_change_ok = true;
-
- /* If both the old and the new symbols look like common symbols in a
- dynamic object, set the size of the symbol to the larger of the
- two. */
-
- if (olddyncommon
- && newdyncommon
- && sym->st_size != h->size)
- {
- /* Since we think we have two common symbols, issue a multiple
- common warning if desired. Note that we only warn if the
- size is different. If the size is the same, we simply let
- the old symbol override the new one as normally happens with
- symbols defined in dynamic objects. */
-
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.root.string, oldbfd, bfd_link_hash_common,
- h->size, abfd, bfd_link_hash_common, sym->st_size)))
- return false;
-
- if (sym->st_size > h->size)
- h->size = sym->st_size;
-
- *size_change_ok = true;
- }
-
- /* If we are looking at a dynamic object, and we have found a
- definition, we need to see if the symbol was already defined by
- some other object. If so, we want to use the existing
- definition, and we do not want to report a multiple symbol
- definition error; we do this by clobbering *PSEC to be
- bfd_und_section_ptr.
-
- We treat a common symbol as a definition if the symbol in the
- shared library is a function, since common symbols always
- represent variables; this can cause confusion in principle, but
- any such confusion would seem to indicate an erroneous program or
- shared library. We also permit a common symbol in a regular
- object to override a weak symbol in a shared object.
-
- We prefer a non-weak definition in a shared library to a weak
- definition in the executable unless it comes from a DT_NEEDED
- entry of a shared object, in which case, the DT_NEEDED entry
- may not be required at the run time. */
-
- if (newdyn
- && newdef
- && (olddef
- || (h->root.type == bfd_link_hash_common
- && (bind == STB_WEAK
- || ELF_ST_TYPE (sym->st_info) == STT_FUNC)))
- && (h->root.type != bfd_link_hash_defweak
- || dt_needed
- || bind == STB_WEAK))
- {
- *override = true;
- newdef = false;
- newdyncommon = false;
-
- *psec = sec = bfd_und_section_ptr;
- *size_change_ok = true;
-
- /* If we get here when the old symbol is a common symbol, then
- we are explicitly letting it override a weak symbol or
- function in a dynamic object, and we don't want to warn about
- a type change. If the old symbol is a defined symbol, a type
- change warning may still be appropriate. */
-
- if (h->root.type == bfd_link_hash_common)
- *type_change_ok = true;
- }
-
- /* Handle the special case of an old common symbol merging with a
- new symbol which looks like a common symbol in a shared object.
- We change *PSEC and *PVALUE to make the new symbol look like a
- common symbol, and let _bfd_generic_link_add_one_symbol will do
- the right thing. */
-
- if (newdyncommon
- && h->root.type == bfd_link_hash_common)
- {
- *override = true;
- newdef = false;
- newdyncommon = false;
- *pvalue = sym->st_size;
- *psec = sec = bfd_com_section_ptr;
- *size_change_ok = true;
- }
-
- /* If the old symbol is from a dynamic object, and the new symbol is
- a definition which is not from a dynamic object, then the new
- symbol overrides the old symbol. Symbols from regular files
- always take precedence over symbols from dynamic objects, even if
- they are defined after the dynamic object in the link.
-
- As above, we again permit a common symbol in a regular object to
- override a definition in a shared object if the shared object
- symbol is a function or is weak.
-
- As above, we permit a non-weak definition in a shared object to
- override a weak definition in a regular object. */
-
- if (! newdyn
- && (newdef
- || (bfd_is_com_section (sec)
- && (h->root.type == bfd_link_hash_defweak
- || h->type == STT_FUNC)))
- && olddyn
- && olddef
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (bind != STB_WEAK
- || h->root.type == bfd_link_hash_defweak))
- {
- /* Change the hash table entry to undefined, and let
- _bfd_generic_link_add_one_symbol do the right thing with the
- new definition. */
-
- h->root.type = bfd_link_hash_undefined;
- h->root.u.undef.abfd = h->root.u.def.section->owner;
- *size_change_ok = true;
-
- olddef = false;
- olddyncommon = false;
-
- /* We again permit a type change when a common symbol may be
- overriding a function. */
-
- if (bfd_is_com_section (sec))
- *type_change_ok = true;
-
- /* This union may have been set to be non-NULL when this symbol
- was seen in a dynamic object. We must force the union to be
- NULL, so that it is correct for a regular symbol. */
-
- h->verinfo.vertree = NULL;
-
- /* In this special case, if H is the target of an indirection,
- we want the caller to frob with H rather than with the
- indirect symbol. That will permit the caller to redefine the
- target of the indirection, rather than the indirect symbol
- itself. FIXME: This will break the -y option if we store a
- symbol with a different name. */
- *sym_hash = h;
- }
-
- /* Handle the special case of a new common symbol merging with an
- old symbol that looks like it might be a common symbol defined in
- a shared object. Note that we have already handled the case in
- which a new common symbol should simply override the definition
- in the shared library. */
-
- if (! newdyn
- && bfd_is_com_section (sec)
- && olddyncommon)
- {
- /* It would be best if we could set the hash table entry to a
- common symbol, but we don't know what to use for the section
- or the alignment. */
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.root.string, oldbfd, bfd_link_hash_common,
- h->size, abfd, bfd_link_hash_common, sym->st_size)))
- return false;
-
- /* If the predumed common symbol in the dynamic object is
- larger, pretend that the new symbol has its size. */
-
- if (h->size > *pvalue)
- *pvalue = h->size;
-
- /* FIXME: We no longer know the alignment required by the symbol
- in the dynamic object, so we just wind up using the one from
- the regular object. */
-
- olddef = false;
- olddyncommon = false;
-
- h->root.type = bfd_link_hash_undefined;
- h->root.u.undef.abfd = h->root.u.def.section->owner;
-
- *size_change_ok = true;
- *type_change_ok = true;
-
- h->verinfo.vertree = NULL;
- }
-
- /* Handle the special case of a weak definition in a regular object
- followed by a non-weak definition in a shared object. In this
- case, we prefer the definition in the shared object unless it
- comes from a DT_NEEDED entry of a shared object, in which case,
- the DT_NEEDED entry may not be required at the run time. */
- if (olddef
- && ! dt_needed
- && h->root.type == bfd_link_hash_defweak
- && newdef
- && newdyn
- && bind != STB_WEAK)
- {
- /* To make this work we have to frob the flags so that the rest
- of the code does not think we are using the regular
- definition. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
- h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
- else if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
- h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
- h->elf_link_hash_flags &= ~ (ELF_LINK_HASH_DEF_REGULAR
- | ELF_LINK_HASH_DEF_DYNAMIC);
-
- /* If H is the target of an indirection, we want the caller to
- use H rather than the indirect symbol. Otherwise if we are
- defining a new indirect symbol we will wind up attaching it
- to the entry we are overriding. */
- *sym_hash = h;
- }
-
- /* Handle the special case of a non-weak definition in a shared
- object followed by a weak definition in a regular object. In
- this case we prefer to definition in the shared object. To make
- this work we have to tell the caller to not treat the new symbol
- as a definition. */
- if (olddef
- && olddyn
- && h->root.type != bfd_link_hash_defweak
- && newdef
- && ! newdyn
- && bind == STB_WEAK)
- *override = true;
-
- return true;
-}
-
-/* This function is called to create an indirect symbol from the
- default for the symbol with the default version if needed. The
- symbol is described by H, NAME, SYM, PSEC, VALUE, and OVERRIDE. We
- set DYNSYM if the new indirect symbol is dynamic. DT_NEEDED
- indicates if it comes from a DT_NEEDED entry of a shared object. */
-
-static boolean
-elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
- dynsym, override, dt_needed)
- bfd *abfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- const char *name;
- Elf_Internal_Sym *sym;
- asection **psec;
- bfd_vma *value;
- boolean *dynsym;
- boolean override;
- boolean dt_needed;
-{
- boolean type_change_ok;
- boolean size_change_ok;
- char *shortname;
- struct elf_link_hash_entry *hi;
- struct bfd_link_hash_entry *bh;
- struct elf_backend_data *bed;
- boolean collect;
- boolean dynamic;
- char *p;
- size_t len, shortlen;
- asection *sec;
-
- /* If this symbol has a version, and it is the default version, we
- create an indirect symbol from the default name to the fully
- decorated name. This will cause external references which do not
- specify a version to be bound to this version of the symbol. */
- p = strchr (name, ELF_VER_CHR);
- if (p == NULL || p[1] != ELF_VER_CHR)
- return true;
-
- if (override)
- {
- /* We are overridden by an old defition. We need to check if we
- need to create the indirect symbol from the default name. */
- hi = elf_link_hash_lookup (elf_hash_table (info), name, true,
- false, false);
- BFD_ASSERT (hi != NULL);
- if (hi == h)
- return true;
- while (hi->root.type == bfd_link_hash_indirect
- || hi->root.type == bfd_link_hash_warning)
- {
- hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
- if (hi == h)
- return true;
- }
- }
-
- bed = get_elf_backend_data (abfd);
- collect = bed->collect;
- dynamic = (abfd->flags & DYNAMIC) != 0;
-
- shortlen = p - name;
- shortname = bfd_hash_allocate (&info->hash->table, shortlen + 1);
- if (shortname == NULL)
- return false;
- memcpy (shortname, name, shortlen);
- shortname[shortlen] = '\0';
-
- /* We are going to create a new symbol. Merge it with any existing
- symbol with this name. For the purposes of the merge, act as
- though we were defining the symbol we just defined, although we
- actually going to define an indirect symbol. */
- type_change_ok = false;
- size_change_ok = false;
- sec = *psec;
- if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
- &hi, &override, &type_change_ok,
- &size_change_ok, dt_needed))
- return false;
-
- if (! override)
- {
- bh = &hi->root;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
- (bfd_vma) 0, name, false, collect, &bh)))
- return false;
- hi = (struct elf_link_hash_entry *) bh;
- }
- else
- {
- /* In this case the symbol named SHORTNAME is overriding the
- indirect symbol we want to add. We were planning on making
- SHORTNAME an indirect symbol referring to NAME. SHORTNAME
- is the name without a version. NAME is the fully versioned
- name, and it is the default version.
-
- Overriding means that we already saw a definition for the
- symbol SHORTNAME in a regular object, and it is overriding
- the symbol defined in the dynamic object.
-
- When this happens, we actually want to change NAME, the
- symbol we just added, to refer to SHORTNAME. This will cause
- references to NAME in the shared object to become references
- to SHORTNAME in the regular object. This is what we expect
- when we override a function in a shared object: that the
- references in the shared object will be mapped to the
- definition in the regular object. */
-
- while (hi->root.type == bfd_link_hash_indirect
- || hi->root.type == bfd_link_hash_warning)
- hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
-
- h->root.type = bfd_link_hash_indirect;
- h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
- {
- h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC;
- hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
- if (hi->elf_link_hash_flags
- & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR))
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info, hi))
- return false;
- }
- }
-
- /* Now set HI to H, so that the following code will set the
- other fields correctly. */
- hi = h;
- }
-
- /* If there is a duplicate definition somewhere, then HI may not
- point to an indirect symbol. We will have reported an error to
- the user in that case. */
-
- if (hi->root.type == bfd_link_hash_indirect)
- {
- struct elf_link_hash_entry *ht;
-
- /* If the symbol became indirect, then we assume that we have
- not seen a definition before. */
- BFD_ASSERT ((hi->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_DEF_REGULAR)) == 0);
-
- ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
- (*bed->elf_backend_copy_indirect_symbol) (bed, ht, hi);
-
- /* See if the new flags lead us to realize that the symbol must
- be dynamic. */
- if (! *dynsym)
- {
- if (! dynamic)
- {
- if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC) != 0))
- *dynsym = true;
- }
- else
- {
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- *dynsym = true;
- }
- }
- }
-
- /* We also need to define an indirection from the nondefault version
- of the symbol. */
-
- len = strlen (name);
- shortname = bfd_hash_allocate (&info->hash->table, len);
- if (shortname == NULL)
- return false;
- memcpy (shortname, name, shortlen);
- memcpy (shortname + shortlen, p + 1, len - shortlen);
-
- /* Once again, merge with any existing symbol. */
- type_change_ok = false;
- size_change_ok = false;
- sec = *psec;
- if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
- &hi, &override, &type_change_ok,
- &size_change_ok, dt_needed))
- return false;
-
- if (override)
- {
- /* Here SHORTNAME is a versioned name, so we don't expect to see
- the type of override we do in the case above unless it is
- overridden by a versioned definiton. */
- if (hi->root.type != bfd_link_hash_defined
- && hi->root.type != bfd_link_hash_defweak)
- (*_bfd_error_handler)
- (_("%s: warning: unexpected redefinition of indirect versioned symbol `%s'"),
- bfd_archive_filename (abfd), shortname);
- }
- else
- {
- bh = &hi->root;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, shortname, BSF_INDIRECT,
- bfd_ind_section_ptr, (bfd_vma) 0, name, false, collect, &bh)))
- return false;
- hi = (struct elf_link_hash_entry *) bh;
-
- /* If there is a duplicate definition somewhere, then HI may not
- point to an indirect symbol. We will have reported an error
- to the user in that case. */
-
- if (hi->root.type == bfd_link_hash_indirect)
- {
- /* If the symbol became indirect, then we assume that we have
- not seen a definition before. */
- BFD_ASSERT ((hi->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_DEF_REGULAR)) == 0);
-
- (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
-
- /* See if the new flags lead us to realize that the symbol
- must be dynamic. */
- if (! *dynsym)
- {
- if (! dynamic)
- {
- if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC) != 0))
- *dynsym = true;
- }
- else
- {
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- *dynsym = true;
- }
- }
- }
- }
-
- return true;
-}
-
-/* Add symbols from an ELF object file to the linker hash table. */
-
-static boolean
-elf_link_add_object_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- boolean (*add_symbol_hook) PARAMS ((bfd *, struct bfd_link_info *,
- const Elf_Internal_Sym *,
- const char **, flagword *,
- asection **, bfd_vma *));
- boolean (*check_relocs) PARAMS ((bfd *, struct bfd_link_info *,
- asection *, const Elf_Internal_Rela *));
- boolean collect;
- Elf_Internal_Shdr *hdr;
- bfd_size_type symcount;
- bfd_size_type extsymcount;
- bfd_size_type extsymoff;
- struct elf_link_hash_entry **sym_hash;
- boolean dynamic;
- Elf_External_Versym *extversym = NULL;
- Elf_External_Versym *ever;
- struct elf_link_hash_entry *weaks;
- Elf_Internal_Sym *isymbuf = NULL;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- struct elf_backend_data *bed;
- boolean dt_needed;
- struct elf_link_hash_table * hash_table;
- bfd_size_type amt;
-
- hash_table = elf_hash_table (info);
-
- bed = get_elf_backend_data (abfd);
- add_symbol_hook = bed->elf_add_symbol_hook;
- collect = bed->collect;
-
- if ((abfd->flags & DYNAMIC) == 0)
- dynamic = false;
- else
- {
- dynamic = true;
-
- /* You can't use -r against a dynamic object. Also, there's no
- hope of using a dynamic object which does not exactly match
- the format of the output file. */
- if (info->relocateable || info->hash->creator != abfd->xvec)
- {
- bfd_set_error (bfd_error_invalid_operation);
- goto error_return;
- }
- }
-
- /* As a GNU extension, any input sections which are named
- .gnu.warning.SYMBOL are treated as warning symbols for the given
- symbol. This differs from .gnu.warning sections, which generate
- warnings when they are included in an output file. */
- if (! info->shared)
- {
- asection *s;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- const char *name;
-
- name = bfd_get_section_name (abfd, s);
- if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0)
- {
- char *msg;
- bfd_size_type sz;
-
- name += sizeof ".gnu.warning." - 1;
-
- /* If this is a shared object, then look up the symbol
- in the hash table. If it is there, and it is already
- been defined, then we will not be using the entry
- from this shared object, so we don't need to warn.
- FIXME: If we see the definition in a regular object
- later on, we will warn, but we shouldn't. The only
- fix is to keep track of what warnings we are supposed
- to emit, and then handle them all at the end of the
- link. */
- if (dynamic && abfd->xvec == info->hash->creator)
- {
- struct elf_link_hash_entry *h;
-
- h = elf_link_hash_lookup (hash_table, name,
- false, false, true);
-
- /* FIXME: What about bfd_link_hash_common? */
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- /* We don't want to issue this warning. Clobber
- the section size so that the warning does not
- get copied into the output file. */
- s->_raw_size = 0;
- continue;
- }
- }
-
- sz = bfd_section_size (abfd, s);
- msg = (char *) bfd_alloc (abfd, sz + 1);
- if (msg == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz))
- goto error_return;
-
- msg[sz] = '\0';
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg,
- false, collect, (struct bfd_link_hash_entry **) NULL)))
- goto error_return;
-
- if (! info->relocateable)
- {
- /* Clobber the section size so that the warning does
- not get copied into the output file. */
- s->_raw_size = 0;
- }
- }
- }
- }
-
- dt_needed = false;
- if (! dynamic)
- {
- /* If we are creating a shared library, create all the dynamic
- sections immediately. We need to attach them to something,
- so we attach them to this BFD, provided it is the right
- format. FIXME: If there are no input BFD's of the same
- format as the output, we can't make a shared library. */
- if (info->shared
- && is_elf_hash_table (info)
- && ! hash_table->dynamic_sections_created
- && abfd->xvec == info->hash->creator)
- {
- if (! elf_link_create_dynamic_sections (abfd, info))
- goto error_return;
- }
- }
- else if (! is_elf_hash_table (info))
- goto error_return;
- else
- {
- asection *s;
- boolean add_needed;
- const char *name;
- bfd_size_type oldsize;
- bfd_size_type strindex;
- struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
-
- /* ld --just-symbols and dynamic objects don't mix very well.
- Test for --just-symbols by looking at info set up by
- _bfd_elf_link_just_syms. */
- if ((s = abfd->sections) != NULL
- && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
- goto error_return;
-
- /* Find the name to use in a DT_NEEDED entry that refers to this
- object. If the object has a DT_SONAME entry, we use it.
- Otherwise, if the generic linker stuck something in
- elf_dt_name, we use that. Otherwise, we just use the file
- name. If the generic linker put a null string into
- elf_dt_name, we don't make a DT_NEEDED entry at all, even if
- there is a DT_SONAME entry. */
- add_needed = true;
- name = bfd_get_filename (abfd);
- if (elf_dt_name (abfd) != NULL)
- {
- name = elf_dt_name (abfd);
- if (*name == '\0')
- {
- if (elf_dt_soname (abfd) != NULL)
- dt_needed = true;
-
- add_needed = false;
- }
- }
- s = bfd_get_section_by_name (abfd, ".dynamic");
- if (s != NULL)
- {
- Elf_External_Dyn *dynbuf = NULL;
- Elf_External_Dyn *extdyn;
- Elf_External_Dyn *extdynend;
- int elfsec;
- unsigned long shlink;
-
- dynbuf = (Elf_External_Dyn *) bfd_malloc (s->_raw_size);
- if (dynbuf == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf,
- (file_ptr) 0, s->_raw_size))
- goto error_free_dyn;
-
- elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
- if (elfsec == -1)
- goto error_free_dyn;
- shlink = elf_elfsections (abfd)[elfsec]->sh_link;
-
- extdyn = dynbuf;
- extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn);
- for (; extdyn < extdynend; extdyn++)
- {
- Elf_Internal_Dyn dyn;
-
- elf_swap_dyn_in (abfd, extdyn, &dyn);
- if (dyn.d_tag == DT_SONAME)
- {
- unsigned int tagv = dyn.d_un.d_val;
- name = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (name == NULL)
- goto error_free_dyn;
- }
- if (dyn.d_tag == DT_NEEDED)
- {
- struct bfd_link_needed_list *n, **pn;
- char *fnm, *anm;
- unsigned int tagv = dyn.d_un.d_val;
-
- amt = sizeof (struct bfd_link_needed_list);
- n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
- fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (n == NULL || fnm == NULL)
- goto error_free_dyn;
- amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
- if (anm == NULL)
- goto error_free_dyn;
- memcpy (anm, fnm, (size_t) amt);
- n->name = anm;
- n->by = abfd;
- n->next = NULL;
- for (pn = & hash_table->needed;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = n;
- }
- if (dyn.d_tag == DT_RUNPATH)
- {
- struct bfd_link_needed_list *n, **pn;
- char *fnm, *anm;
- unsigned int tagv = dyn.d_un.d_val;
-
- amt = sizeof (struct bfd_link_needed_list);
- n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
- fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (n == NULL || fnm == NULL)
- goto error_free_dyn;
- amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
- if (anm == NULL)
- goto error_free_dyn;
- memcpy (anm, fnm, (size_t) amt);
- n->name = anm;
- n->by = abfd;
- n->next = NULL;
- for (pn = & runpath;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = n;
- }
- /* Ignore DT_RPATH if we have seen DT_RUNPATH. */
- if (!runpath && dyn.d_tag == DT_RPATH)
- {
- struct bfd_link_needed_list *n, **pn;
- char *fnm, *anm;
- unsigned int tagv = dyn.d_un.d_val;
-
- amt = sizeof (struct bfd_link_needed_list);
- n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
- fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
- if (n == NULL || fnm == NULL)
- goto error_free_dyn;
- amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
- if (anm == NULL)
- {
- error_free_dyn:
- free (dynbuf);
- goto error_return;
- }
- memcpy (anm, fnm, (size_t) amt);
- n->name = anm;
- n->by = abfd;
- n->next = NULL;
- for (pn = & rpath;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = n;
- }
- }
-
- free (dynbuf);
- }
-
- /* DT_RUNPATH overrides DT_RPATH. Do _NOT_ bfd_release, as that
- frees all more recently bfd_alloc'd blocks as well. */
- if (runpath)
- rpath = runpath;
-
- if (rpath)
- {
- struct bfd_link_needed_list **pn;
- for (pn = & hash_table->runpath;
- *pn != NULL;
- pn = &(*pn)->next)
- ;
- *pn = rpath;
- }
-
- /* We do not want to include any of the sections in a dynamic
- object in the output file. We hack by simply clobbering the
- list of sections in the BFD. This could be handled more
- cleanly by, say, a new section flag; the existing
- SEC_NEVER_LOAD flag is not the one we want, because that one
- still implies that the section takes up space in the output
- file. */
- bfd_section_list_clear (abfd);
-
- /* If this is the first dynamic object found in the link, create
- the special sections required for dynamic linking. */
- if (! hash_table->dynamic_sections_created)
- if (! elf_link_create_dynamic_sections (abfd, info))
- goto error_return;
-
- if (add_needed)
- {
- /* Add a DT_NEEDED entry for this dynamic object. */
- oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
- strindex = _bfd_elf_strtab_add (hash_table->dynstr, name, false);
- if (strindex == (bfd_size_type) -1)
- goto error_return;
-
- if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
- {
- asection *sdyn;
- Elf_External_Dyn *dyncon, *dynconend;
-
- /* The hash table size did not change, which means that
- the dynamic object name was already entered. If we
- have already included this dynamic object in the
- link, just ignore it. There is no reason to include
- a particular dynamic object more than once. */
- sdyn = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
- BFD_ASSERT (sdyn != NULL);
-
- dyncon = (Elf_External_Dyn *) sdyn->contents;
- dynconend = (Elf_External_Dyn *) (sdyn->contents +
- sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
-
- elf_swap_dyn_in (hash_table->dynobj, dyncon, & dyn);
- if (dyn.d_tag == DT_NEEDED
- && dyn.d_un.d_val == strindex)
- {
- _bfd_elf_strtab_delref (hash_table->dynstr, strindex);
- return true;
- }
- }
- }
-
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex))
- goto error_return;
- }
-
- /* Save the SONAME, if there is one, because sometimes the
- linker emulation code will need to know it. */
- if (*name == '\0')
- name = basename (bfd_get_filename (abfd));
- elf_dt_name (abfd) = name;
- }
-
- /* If this is a dynamic object, we always link against the .dynsym
- symbol table, not the .symtab symbol table. The dynamic linker
- will only see the .dynsym symbol table, so there is no reason to
- look at .symtab for a dynamic object. */
-
- if (! dynamic || elf_dynsymtab (abfd) == 0)
- hdr = &elf_tdata (abfd)->symtab_hdr;
- else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
-
- symcount = hdr->sh_size / sizeof (Elf_External_Sym);
-
- /* The sh_info field of the symtab header tells us where the
- external symbols start. We don't care about the local symbols at
- this point. */
- if (elf_bad_symtab (abfd))
- {
- extsymcount = symcount;
- extsymoff = 0;
- }
- else
- {
- extsymcount = symcount - hdr->sh_info;
- extsymoff = hdr->sh_info;
- }
-
- sym_hash = NULL;
- if (extsymcount != 0)
- {
- isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- goto error_return;
-
- /* We store a pointer to the hash table entry for each external
- symbol. */
- amt = extsymcount * sizeof (struct elf_link_hash_entry *);
- sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt);
- if (sym_hash == NULL)
- goto error_free_sym;
- elf_sym_hashes (abfd) = sym_hash;
- }
-
- if (dynamic)
- {
- /* Read in any version definitions. */
- if (! _bfd_elf_slurp_version_tables (abfd))
- goto error_free_sym;
-
- /* Read in the symbol versions, but don't bother to convert them
- to internal format. */
- if (elf_dynversym (abfd) != 0)
- {
- Elf_Internal_Shdr *versymhdr;
-
- versymhdr = &elf_tdata (abfd)->dynversym_hdr;
- extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
- if (extversym == NULL)
- goto error_free_sym;
- amt = versymhdr->sh_size;
- if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0
- || bfd_bread ((PTR) extversym, amt, abfd) != amt)
- goto error_free_vers;
- }
- }
-
- weaks = NULL;
-
- ever = extversym != NULL ? extversym + extsymoff : NULL;
- for (isym = isymbuf, isymend = isymbuf + extsymcount;
- isym < isymend;
- isym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL))
- {
- int bind;
- bfd_vma value;
- asection *sec;
- flagword flags;
- const char *name;
- struct elf_link_hash_entry *h;
- boolean definition;
- boolean size_change_ok, type_change_ok;
- boolean new_weakdef;
- unsigned int old_alignment;
- boolean override;
-
- override = false;
-
- flags = BSF_NO_FLAGS;
- sec = NULL;
- value = isym->st_value;
- *sym_hash = NULL;
-
- bind = ELF_ST_BIND (isym->st_info);
- if (bind == STB_LOCAL)
- {
- /* This should be impossible, since ELF requires that all
- global symbols follow all local symbols, and that sh_info
- point to the first global symbol. Unfortunatealy, Irix 5
- screws this up. */
- continue;
- }
- else if (bind == STB_GLOBAL)
- {
- if (isym->st_shndx != SHN_UNDEF
- && isym->st_shndx != SHN_COMMON)
- flags = BSF_GLOBAL;
- }
- else if (bind == STB_WEAK)
- flags = BSF_WEAK;
- else
- {
- /* Leave it up to the processor backend. */
- }
-
- if (isym->st_shndx == SHN_UNDEF)
- sec = bfd_und_section_ptr;
- else if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
- {
- sec = section_from_elf_index (abfd, isym->st_shndx);
- if (sec == NULL)
- sec = bfd_abs_section_ptr;
- else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
- value -= sec->vma;
- }
- else if (isym->st_shndx == SHN_ABS)
- sec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- {
- sec = bfd_com_section_ptr;
- /* What ELF calls the size we call the value. What ELF
- calls the value we call the alignment. */
- value = isym->st_size;
- }
- else
- {
- /* Leave it up to the processor backend. */
- }
-
- name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- isym->st_name);
- if (name == (const char *) NULL)
- goto error_free_vers;
-
- if (isym->st_shndx == SHN_COMMON
- && ELF_ST_TYPE (isym->st_info) == STT_TLS)
- {
- asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon");
-
- if (tcomm == NULL)
- {
- tcomm = bfd_make_section (abfd, ".tcommon");
- if (tcomm == NULL
- || !bfd_set_section_flags (abfd, tcomm, (SEC_ALLOC
- | SEC_IS_COMMON
- | SEC_LINKER_CREATED
- | SEC_THREAD_LOCAL)))
- goto error_free_vers;
- }
- sec = tcomm;
- }
- else if (add_symbol_hook)
- {
- if (! (*add_symbol_hook) (abfd, info, isym, &name, &flags, &sec,
- &value))
- goto error_free_vers;
-
- /* The hook function sets the name to NULL if this symbol
- should be skipped for some reason. */
- if (name == (const char *) NULL)
- continue;
- }
-
- /* Sanity check that all possibilities were handled. */
- if (sec == (asection *) NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- goto error_free_vers;
- }
-
- if (bfd_is_und_section (sec)
- || bfd_is_com_section (sec))
- definition = false;
- else
- definition = true;
-
- size_change_ok = false;
- type_change_ok = get_elf_backend_data (abfd)->type_change_ok;
- old_alignment = 0;
- if (info->hash->creator->flavour == bfd_target_elf_flavour)
- {
- Elf_Internal_Versym iver;
- unsigned int vernum = 0;
-
- if (ever != NULL)
- {
- _bfd_elf_swap_versym_in (abfd, ever, &iver);
- vernum = iver.vs_vers & VERSYM_VERSION;
-
- /* If this is a hidden symbol, or if it is not version
- 1, we append the version name to the symbol name.
- However, we do not modify a non-hidden absolute
- symbol, because it might be the version symbol
- itself. FIXME: What if it isn't? */
- if ((iver.vs_vers & VERSYM_HIDDEN) != 0
- || (vernum > 1 && ! bfd_is_abs_section (sec)))
- {
- const char *verstr;
- size_t namelen, verlen, newlen;
- char *newname, *p;
-
- if (isym->st_shndx != SHN_UNDEF)
- {
- if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info)
- {
- (*_bfd_error_handler)
- (_("%s: %s: invalid version %u (max %d)"),
- bfd_archive_filename (abfd), name, vernum,
- elf_tdata (abfd)->dynverdef_hdr.sh_info);
- bfd_set_error (bfd_error_bad_value);
- goto error_free_vers;
- }
- else if (vernum > 1)
- verstr =
- elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
- else
- verstr = "";
- }
- else
- {
- /* We cannot simply test for the number of
- entries in the VERNEED section since the
- numbers for the needed versions do not start
- at 0. */
- Elf_Internal_Verneed *t;
-
- verstr = NULL;
- for (t = elf_tdata (abfd)->verref;
- t != NULL;
- t = t->vn_nextref)
- {
- Elf_Internal_Vernaux *a;
-
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- {
- if (a->vna_other == vernum)
- {
- verstr = a->vna_nodename;
- break;
- }
- }
- if (a != NULL)
- break;
- }
- if (verstr == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: %s: invalid needed version %d"),
- bfd_archive_filename (abfd), name, vernum);
- bfd_set_error (bfd_error_bad_value);
- goto error_free_vers;
- }
- }
-
- namelen = strlen (name);
- verlen = strlen (verstr);
- newlen = namelen + verlen + 2;
- if ((iver.vs_vers & VERSYM_HIDDEN) == 0
- && isym->st_shndx != SHN_UNDEF)
- ++newlen;
-
- newname = (char *) bfd_alloc (abfd, (bfd_size_type) newlen);
- if (newname == NULL)
- goto error_free_vers;
- memcpy (newname, name, namelen);
- p = newname + namelen;
- *p++ = ELF_VER_CHR;
- /* If this is a defined non-hidden version symbol,
- we add another @ to the name. This indicates the
- default version of the symbol. */
- if ((iver.vs_vers & VERSYM_HIDDEN) == 0
- && isym->st_shndx != SHN_UNDEF)
- *p++ = ELF_VER_CHR;
- memcpy (p, verstr, verlen + 1);
-
- name = newname;
- }
- }
-
- if (! elf_merge_symbol (abfd, info, name, isym, &sec, &value,
- sym_hash, &override, &type_change_ok,
- &size_change_ok, dt_needed))
- goto error_free_vers;
-
- if (override)
- definition = false;
-
- h = *sym_hash;
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Remember the old alignment if this is a common symbol, so
- that we don't reduce the alignment later on. We can't
- check later, because _bfd_generic_link_add_one_symbol
- will set a default for the alignment which we want to
- override. */
- if (h->root.type == bfd_link_hash_common)
- old_alignment = h->root.u.c.p->alignment_power;
-
- if (elf_tdata (abfd)->verdef != NULL
- && ! override
- && vernum > 1
- && definition)
- h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
- }
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, flags, sec, value, (const char *) NULL,
- false, collect, (struct bfd_link_hash_entry **) sym_hash)))
- goto error_free_vers;
-
- h = *sym_hash;
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- *sym_hash = h;
-
- new_weakdef = false;
- if (dynamic
- && definition
- && (flags & BSF_WEAK) != 0
- && ELF_ST_TYPE (isym->st_info) != STT_FUNC
- && info->hash->creator->flavour == bfd_target_elf_flavour
- && h->weakdef == NULL)
- {
- /* Keep a list of all weak defined non function symbols from
- a dynamic object, using the weakdef field. Later in this
- function we will set the weakdef field to the correct
- value. We only put non-function symbols from dynamic
- objects on this list, because that happens to be the only
- time we need to know the normal symbol corresponding to a
- weak symbol, and the information is time consuming to
- figure out. If the weakdef field is not already NULL,
- then this symbol was already defined by some previous
- dynamic object, and we will be using that previous
- definition anyhow. */
-
- h->weakdef = weaks;
- weaks = h;
- new_weakdef = true;
- }
-
- /* Set the alignment of a common symbol. */
- if (isym->st_shndx == SHN_COMMON
- && h->root.type == bfd_link_hash_common)
- {
- unsigned int align;
-
- align = bfd_log2 (isym->st_value);
- if (align > old_alignment
- /* Permit an alignment power of zero if an alignment of one
- is specified and no other alignments have been specified. */
- || (isym->st_value == 1 && old_alignment == 0))
- h->root.u.c.p->alignment_power = align;
- }
-
- if (info->hash->creator->flavour == bfd_target_elf_flavour)
- {
- int old_flags;
- boolean dynsym;
- int new_flag;
-
- /* Remember the symbol size and type. */
- if (isym->st_size != 0
- && (definition || h->size == 0))
- {
- if (h->size != 0 && h->size != isym->st_size && ! size_change_ok)
- (*_bfd_error_handler)
- (_("Warning: size of symbol `%s' changed from %lu to %lu in %s"),
- name, (unsigned long) h->size,
- (unsigned long) isym->st_size, bfd_archive_filename (abfd));
-
- h->size = isym->st_size;
- }
-
- /* If this is a common symbol, then we always want H->SIZE
- to be the size of the common symbol. The code just above
- won't fix the size if a common symbol becomes larger. We
- don't warn about a size change here, because that is
- covered by --warn-common. */
- if (h->root.type == bfd_link_hash_common)
- h->size = h->root.u.c.size;
-
- if (ELF_ST_TYPE (isym->st_info) != STT_NOTYPE
- && (definition || h->type == STT_NOTYPE))
- {
- if (h->type != STT_NOTYPE
- && h->type != ELF_ST_TYPE (isym->st_info)
- && ! type_change_ok)
- (*_bfd_error_handler)
- (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
- name, h->type, ELF_ST_TYPE (isym->st_info),
- bfd_archive_filename (abfd));
-
- h->type = ELF_ST_TYPE (isym->st_info);
- }
-
- /* If st_other has a processor-specific meaning, specific code
- might be needed here. */
- if (isym->st_other != 0)
- {
- unsigned char hvis, symvis, other;
-
- /* Take the balance of OTHER from the definition. */
- other = (definition ? isym->st_other : h->other);
- other &= ~ ELF_ST_VISIBILITY (-1);
-
- /* Combine visibilities, using the most constraining one. */
- hvis = ELF_ST_VISIBILITY (h->other);
- symvis = ELF_ST_VISIBILITY (isym->st_other);
-
- h->other = other | (hvis > symvis ? hvis : symvis);
- }
-
- /* Set a flag in the hash table entry indicating the type of
- reference or definition we just found. Keep a count of
- the number of dynamic symbols we find. A dynamic symbol
- is one which is referenced or defined by both a regular
- object and a shared object. */
- old_flags = h->elf_link_hash_flags;
- dynsym = false;
- if (! dynamic)
- {
- if (! definition)
- {
- new_flag = ELF_LINK_HASH_REF_REGULAR;
- if (bind != STB_WEAK)
- new_flag |= ELF_LINK_HASH_REF_REGULAR_NONWEAK;
- }
- else
- new_flag = ELF_LINK_HASH_DEF_REGULAR;
- if (info->shared
- || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_REF_DYNAMIC)) != 0)
- dynsym = true;
- }
- else
- {
- if (! definition)
- new_flag = ELF_LINK_HASH_REF_DYNAMIC;
- else
- new_flag = ELF_LINK_HASH_DEF_DYNAMIC;
- if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR)) != 0
- || (h->weakdef != NULL
- && ! new_weakdef
- && h->weakdef->dynindx != -1))
- dynsym = true;
- }
-
- h->elf_link_hash_flags |= new_flag;
-
- /* Check to see if we need to add an indirect symbol for
- the default name. */
- if (definition || h->root.type == bfd_link_hash_common)
- if (! elf_add_default_symbol (abfd, info, h, name, isym,
- &sec, &value, &dynsym,
- override, dt_needed))
- goto error_free_vers;
-
- if (dynsym && h->dynindx == -1)
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info, h))
- goto error_free_vers;
- if (h->weakdef != NULL
- && ! new_weakdef
- && h->weakdef->dynindx == -1)
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
- goto error_free_vers;
- }
- }
- else if (dynsym && h->dynindx != -1)
- /* If the symbol already has a dynamic index, but
- visibility says it should not be visible, turn it into
- a local symbol. */
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- (*bed->elf_backend_hide_symbol) (info, h, true);
- break;
- }
-
- if (dt_needed && definition
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- {
- bfd_size_type oldsize;
- bfd_size_type strindex;
-
- if (! is_elf_hash_table (info))
- goto error_free_vers;
-
- /* The symbol from a DT_NEEDED object is referenced from
- the regular object to create a dynamic executable. We
- have to make sure there is a DT_NEEDED entry for it. */
-
- dt_needed = false;
- oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
- strindex = _bfd_elf_strtab_add (hash_table->dynstr,
- elf_dt_soname (abfd), false);
- if (strindex == (bfd_size_type) -1)
- goto error_free_vers;
-
- if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
- {
- asection *sdyn;
- Elf_External_Dyn *dyncon, *dynconend;
-
- sdyn = bfd_get_section_by_name (hash_table->dynobj,
- ".dynamic");
- BFD_ASSERT (sdyn != NULL);
-
- dyncon = (Elf_External_Dyn *) sdyn->contents;
- dynconend = (Elf_External_Dyn *) (sdyn->contents +
- sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
-
- elf_swap_dyn_in (hash_table->dynobj,
- dyncon, &dyn);
- BFD_ASSERT (dyn.d_tag != DT_NEEDED ||
- dyn.d_un.d_val != strindex);
- }
- }
-
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex))
- goto error_free_vers;
- }
- }
- }
-
- if (extversym != NULL)
- {
- free (extversym);
- extversym = NULL;
- }
-
- if (isymbuf != NULL)
- free (isymbuf);
- isymbuf = NULL;
-
- /* Now set the weakdefs field correctly for all the weak defined
- symbols we found. The only way to do this is to search all the
- symbols. Since we only need the information for non functions in
- dynamic objects, that's the only time we actually put anything on
- the list WEAKS. We need this information so that if a regular
- object refers to a symbol defined weakly in a dynamic object, the
- real symbol in the dynamic object is also put in the dynamic
- symbols; we also must arrange for both symbols to point to the
- same memory location. We could handle the general case of symbol
- aliasing, but a general symbol alias can only be generated in
- assembler code, handling it correctly would be very time
- consuming, and other ELF linkers don't handle general aliasing
- either. */
- while (weaks != NULL)
- {
- struct elf_link_hash_entry *hlook;
- asection *slook;
- bfd_vma vlook;
- struct elf_link_hash_entry **hpp;
- struct elf_link_hash_entry **hppend;
-
- hlook = weaks;
- weaks = hlook->weakdef;
- hlook->weakdef = NULL;
-
- BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
- || hlook->root.type == bfd_link_hash_defweak
- || hlook->root.type == bfd_link_hash_common
- || hlook->root.type == bfd_link_hash_indirect);
- slook = hlook->root.u.def.section;
- vlook = hlook->root.u.def.value;
-
- hpp = elf_sym_hashes (abfd);
- hppend = hpp + extsymcount;
- for (; hpp < hppend; hpp++)
- {
- struct elf_link_hash_entry *h;
-
- h = *hpp;
- if (h != NULL && h != hlook
- && h->root.type == bfd_link_hash_defined
- && h->root.u.def.section == slook
- && h->root.u.def.value == vlook)
- {
- hlook->weakdef = h;
-
- /* If the weak definition is in the list of dynamic
- symbols, make sure the real definition is put there
- as well. */
- if (hlook->dynindx != -1
- && h->dynindx == -1)
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info, h))
- goto error_return;
- }
-
- /* If the real definition is in the list of dynamic
- symbols, make sure the weak definition is put there
- as well. If we don't do this, then the dynamic
- loader might not merge the entries for the real
- definition and the weak definition. */
- if (h->dynindx != -1
- && hlook->dynindx == -1)
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info, hlook))
- goto error_return;
- }
- break;
- }
- }
- }
-
- /* If this object is the same format as the output object, and it is
- not a shared library, then let the backend look through the
- relocs.
-
- This is required to build global offset table entries and to
- arrange for dynamic relocs. It is not required for the
- particular common case of linking non PIC code, even when linking
- against shared libraries, but unfortunately there is no way of
- knowing whether an object file has been compiled PIC or not.
- Looking through the relocs is not particularly time consuming.
- The problem is that we must either (1) keep the relocs in memory,
- which causes the linker to require additional runtime memory or
- (2) read the relocs twice from the input file, which wastes time.
- This would be a good case for using mmap.
-
- I have no idea how to handle linking PIC code into a file of a
- different format. It probably can't be done. */
- check_relocs = get_elf_backend_data (abfd)->check_relocs;
- if (! dynamic
- && abfd->xvec == info->hash->creator
- && check_relocs != NULL)
- {
- asection *o;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- Elf_Internal_Rela *internal_relocs;
- boolean ok;
-
- if ((o->flags & SEC_RELOC) == 0
- || o->reloc_count == 0
- || ((info->strip == strip_all || info->strip == strip_debugger)
- && (o->flags & SEC_DEBUGGING) != 0)
- || bfd_is_abs_section (o->output_section))
- continue;
-
- internal_relocs = (NAME(_bfd_elf,link_read_relocs)
- (abfd, o, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory));
- if (internal_relocs == NULL)
- goto error_return;
-
- ok = (*check_relocs) (abfd, info, o, internal_relocs);
-
- if (elf_section_data (o)->relocs != internal_relocs)
- free (internal_relocs);
-
- if (! ok)
- goto error_return;
- }
- }
-
- /* If this is a non-traditional, non-relocateable link, try to
- optimize the handling of the .stab/.stabstr sections. */
- if (! dynamic
- && ! info->relocateable
- && ! info->traditional_format
- && info->hash->creator->flavour == bfd_target_elf_flavour
- && is_elf_hash_table (info)
- && (info->strip != strip_all && info->strip != strip_debugger))
- {
- asection *stab, *stabstr;
-
- stab = bfd_get_section_by_name (abfd, ".stab");
- if (stab != NULL
- && (stab->flags & SEC_MERGE) == 0
- && !bfd_is_abs_section (stab->output_section))
- {
- stabstr = bfd_get_section_by_name (abfd, ".stabstr");
-
- if (stabstr != NULL)
- {
- struct bfd_elf_section_data *secdata;
-
- secdata = elf_section_data (stab);
- if (! _bfd_link_section_stabs (abfd,
- & hash_table->stab_info,
- stab, stabstr,
- &secdata->sec_info))
- goto error_return;
- if (secdata->sec_info)
- secdata->sec_info_type = ELF_INFO_TYPE_STABS;
- }
- }
- }
-
- if (! info->relocateable && ! dynamic
- && is_elf_hash_table (info))
- {
- asection *s;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- if ((s->flags & SEC_MERGE) != 0
- && !bfd_is_abs_section (s->output_section))
- {
- struct bfd_elf_section_data *secdata;
-
- secdata = elf_section_data (s);
- if (! _bfd_merge_section (abfd,
- & hash_table->merge_info,
- s, &secdata->sec_info))
- goto error_return;
- else if (secdata->sec_info)
- secdata->sec_info_type = ELF_INFO_TYPE_MERGE;
- }
- }
-
- if (is_elf_hash_table (info))
- {
- /* Add this bfd to the loaded list. */
- struct elf_link_loaded_list *n;
-
- n = ((struct elf_link_loaded_list *)
- bfd_alloc (abfd, sizeof (struct elf_link_loaded_list)));
- if (n == NULL)
- goto error_return;
- n->abfd = abfd;
- n->next = hash_table->loaded;
- hash_table->loaded = n;
- }
-
- return true;
-
- error_free_vers:
- if (extversym != NULL)
- free (extversym);
- error_free_sym:
- if (isymbuf != NULL)
- free (isymbuf);
- error_return:
- return false;
-}
-
-/* Create some sections which will be filled in with dynamic linking
- information. ABFD is an input file which requires dynamic sections
- to be created. The dynamic sections take up virtual memory space
- when the final executable is run, so we need to create them before
- addresses are assigned to the output sections. We work out the
- actual contents and size of these sections later. */
-
-boolean
-elf_link_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- flagword flags;
- register asection *s;
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
- struct elf_backend_data *bed;
-
- if (! is_elf_hash_table (info))
- return false;
-
- if (elf_hash_table (info)->dynamic_sections_created)
- return true;
-
- /* Make sure that all dynamic sections use the same input BFD. */
- if (elf_hash_table (info)->dynobj == NULL)
- elf_hash_table (info)->dynobj = abfd;
- else
- abfd = elf_hash_table (info)->dynobj;
-
- /* Note that we set the SEC_IN_MEMORY flag for all of these
- sections. */
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-
- /* A dynamically linked executable has a .interp section, but a
- shared library does not. */
- if (! info->shared)
- {
- s = bfd_make_section (abfd, ".interp");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
- return false;
- }
-
- if (! info->traditional_format
- && info->hash->creator->flavour == bfd_target_elf_flavour)
- {
- s = bfd_make_section (abfd, ".eh_frame_hdr");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return false;
- }
-
- /* Create sections to hold version informations. These are removed
- if they are not needed. */
- s = bfd_make_section (abfd, ".gnu.version_d");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
- return false;
-
- s = bfd_make_section (abfd, ".gnu.version");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 1))
- return false;
-
- s = bfd_make_section (abfd, ".gnu.version_r");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
- return false;
-
- s = bfd_make_section (abfd, ".dynsym");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
- return false;
-
- s = bfd_make_section (abfd, ".dynstr");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
- return false;
-
- /* Create a strtab to hold the dynamic symbol names. */
- if (elf_hash_table (info)->dynstr == NULL)
- {
- elf_hash_table (info)->dynstr = _bfd_elf_strtab_init ();
- if (elf_hash_table (info)->dynstr == NULL)
- return false;
- }
-
- s = bfd_make_section (abfd, ".dynamic");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
- return false;
-
- /* The special symbol _DYNAMIC is always set to the start of the
- .dynamic section. This call occurs before we have processed the
- symbols for any dynamic object, so we don't have to worry about
- overriding a dynamic definition. We could set _DYNAMIC in a
- linker script, but we only want to define it if we are, in fact,
- creating a .dynamic section. We don't want to define it if there
- is no .dynamic section, since on some ELF platforms the start up
- code examines it to decide how to initialize the process. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, (bfd_vma) 0,
- (const char *) 0, false, get_elf_backend_data (abfd)->collect, &bh)))
- return false;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (info->shared
- && ! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
-
- bed = get_elf_backend_data (abfd);
-
- s = bfd_make_section (abfd, ".hash");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
- return false;
- elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
-
- /* Let the backend create the rest of the sections. This lets the
- backend set the right flags. The backend will normally create
- the .got and .plt sections. */
- if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
- return false;
-
- elf_hash_table (info)->dynamic_sections_created = true;
-
- return true;
-}
-
-/* Add an entry to the .dynamic table. */
-
-boolean
-elf_add_dynamic_entry (info, tag, val)
- struct bfd_link_info *info;
- bfd_vma tag;
- bfd_vma val;
-{
- Elf_Internal_Dyn dyn;
- bfd *dynobj;
- asection *s;
- bfd_size_type newsize;
- bfd_byte *newcontents;
-
- if (! is_elf_hash_table (info))
- return false;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- s = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (s != NULL);
-
- newsize = s->_raw_size + sizeof (Elf_External_Dyn);
- newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize);
- if (newcontents == NULL)
- return false;
-
- dyn.d_tag = tag;
- dyn.d_un.d_val = val;
- elf_swap_dyn_out (dynobj, &dyn,
- (Elf_External_Dyn *) (newcontents + s->_raw_size));
-
- s->_raw_size = newsize;
- s->contents = newcontents;
-
- return true;
-}
-
-/* Read and swap the relocs from the section indicated by SHDR. This
- may be either a REL or a RELA section. The relocations are
- translated into RELA relocations and stored in INTERNAL_RELOCS,
- which should have already been allocated to contain enough space.
- The EXTERNAL_RELOCS are a buffer where the external form of the
- relocations should be stored.
-
- Returns false if something goes wrong. */
-
-static boolean
-elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
- internal_relocs)
- bfd *abfd;
- Elf_Internal_Shdr *shdr;
- PTR external_relocs;
- Elf_Internal_Rela *internal_relocs;
-{
- struct elf_backend_data *bed;
- bfd_size_type amt;
-
- /* If there aren't any relocations, that's OK. */
- if (!shdr)
- return true;
-
- /* Position ourselves at the start of the section. */
- if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0)
- return false;
-
- /* Read the relocations. */
- if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
- return false;
-
- bed = get_elf_backend_data (abfd);
-
- /* Convert the external relocations to the internal format. */
- if (shdr->sh_entsize == sizeof (Elf_External_Rel))
- {
- Elf_External_Rel *erel;
- Elf_External_Rel *erelend;
- Elf_Internal_Rela *irela;
- Elf_Internal_Rel *irel;
-
- erel = (Elf_External_Rel *) external_relocs;
- erelend = erel + NUM_SHDR_ENTRIES (shdr);
- irela = internal_relocs;
- amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
- irel = bfd_alloc (abfd, amt);
- for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel)
- {
- unsigned int i;
-
- if (bed->s->swap_reloc_in)
- (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
- else
- elf_swap_reloc_in (abfd, erel, irel);
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; ++i)
- {
- irela[i].r_offset = irel[i].r_offset;
- irela[i].r_info = irel[i].r_info;
- irela[i].r_addend = 0;
- }
- }
- }
- else
- {
- Elf_External_Rela *erela;
- Elf_External_Rela *erelaend;
- Elf_Internal_Rela *irela;
-
- BFD_ASSERT (shdr->sh_entsize == sizeof (Elf_External_Rela));
-
- erela = (Elf_External_Rela *) external_relocs;
- erelaend = erela + NUM_SHDR_ENTRIES (shdr);
- irela = internal_relocs;
- for (; erela < erelaend; erela++, irela += bed->s->int_rels_per_ext_rel)
- {
- if (bed->s->swap_reloca_in)
- (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
- else
- elf_swap_reloca_in (abfd, erela, irela);
- }
- }
-
- return true;
-}
-
-/* Read and swap the relocs for a section O. They may have been
- cached. If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are
- not NULL, they are used as buffers to read into. They are known to
- be large enough. If the INTERNAL_RELOCS relocs argument is NULL,
- the return value is allocated using either malloc or bfd_alloc,
- according to the KEEP_MEMORY argument. If O has two relocation
- sections (both REL and RELA relocations), then the REL_HDR
- relocations will appear first in INTERNAL_RELOCS, followed by the
- REL_HDR2 relocations. */
-
-Elf_Internal_Rela *
-NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs,
- keep_memory)
- bfd *abfd;
- asection *o;
- PTR external_relocs;
- Elf_Internal_Rela *internal_relocs;
- boolean keep_memory;
-{
- Elf_Internal_Shdr *rel_hdr;
- PTR alloc1 = NULL;
- Elf_Internal_Rela *alloc2 = NULL;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- if (elf_section_data (o)->relocs != NULL)
- return elf_section_data (o)->relocs;
-
- if (o->reloc_count == 0)
- return NULL;
-
- rel_hdr = &elf_section_data (o)->rel_hdr;
-
- if (internal_relocs == NULL)
- {
- bfd_size_type size;
-
- size = o->reloc_count;
- size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
- if (keep_memory)
- internal_relocs = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
- else
- internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_malloc (size);
- if (internal_relocs == NULL)
- goto error_return;
- }
-
- if (external_relocs == NULL)
- {
- bfd_size_type size = rel_hdr->sh_size;
-
- if (elf_section_data (o)->rel_hdr2)
- size += elf_section_data (o)->rel_hdr2->sh_size;
- alloc1 = (PTR) bfd_malloc (size);
- if (alloc1 == NULL)
- goto error_return;
- external_relocs = alloc1;
- }
-
- if (!elf_link_read_relocs_from_section (abfd, rel_hdr,
- external_relocs,
- internal_relocs))
- goto error_return;
- if (!elf_link_read_relocs_from_section
- (abfd,
- elf_section_data (o)->rel_hdr2,
- ((bfd_byte *) external_relocs) + rel_hdr->sh_size,
- internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr)
- * bed->s->int_rels_per_ext_rel)))
- goto error_return;
-
- /* Cache the results for next time, if we can. */
- if (keep_memory)
- elf_section_data (o)->relocs = internal_relocs;
-
- if (alloc1 != NULL)
- free (alloc1);
-
- /* Don't free alloc2, since if it was allocated we are passing it
- back (under the name of internal_relocs). */
-
- return internal_relocs;
-
- error_return:
- if (alloc1 != NULL)
- free (alloc1);
- if (alloc2 != NULL)
- free (alloc2);
- return NULL;
-}
-
-/* Record an assignment to a symbol made by a linker script. We need
- this in case some dynamic object refers to this symbol. */
-
-boolean
-NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
- const char *name;
- boolean provide;
-{
- struct elf_link_hash_entry *h;
-
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
- return true;
-
- h = elf_link_hash_lookup (elf_hash_table (info), name, true, true, false);
- if (h == NULL)
- return false;
-
- if (h->root.type == bfd_link_hash_new)
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
-
- /* If this symbol is being provided by the linker script, and it is
- currently defined by a dynamic object, but not by a regular
- object, then mark it as undefined so that the generic linker will
- force the correct value. */
- if (provide
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- h->root.type = bfd_link_hash_undefined;
-
- /* If this symbol is not being provided by the linker script, and it is
- currently defined by a dynamic object, but not by a regular object,
- then clear out any version information because the symbol will not be
- associated with the dynamic object any more. */
- if (!provide
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- h->verinfo.verdef = NULL;
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
-
- if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_REF_DYNAMIC)) != 0
- || info->shared)
- && h->dynindx == -1)
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
-
- /* If this is a weak defined symbol, and we know a corresponding
- real symbol from the same dynamic object, make sure the real
- symbol is also made into a dynamic symbol. */
- if (h->weakdef != NULL
- && h->weakdef->dynindx == -1)
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
- return false;
- }
- }
-
- return true;
-}
-
-/* This structure is used to pass information to
- elf_link_assign_sym_version. */
-
-struct elf_assign_sym_version_info
-{
- /* Output BFD. */
- bfd *output_bfd;
- /* General link information. */
- struct bfd_link_info *info;
- /* Version tree. */
- struct bfd_elf_version_tree *verdefs;
- /* Whether we had a failure. */
- boolean failed;
-};
-
-/* This structure is used to pass information to
- elf_link_find_version_dependencies. */
-
-struct elf_find_verdep_info
-{
- /* Output BFD. */
- bfd *output_bfd;
- /* General link information. */
- struct bfd_link_info *info;
- /* The number of dependencies. */
- unsigned int vers;
- /* Whether we had a failure. */
- boolean failed;
-};
-
-/* Array used to determine the number of hash table buckets to use
- based on the number of symbols there are. If there are fewer than
- 3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets,
- fewer than 37 we use 17 buckets, and so forth. We never use more
- than 32771 buckets. */
-
-static const size_t elf_buckets[] =
-{
- 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209,
- 16411, 32771, 0
-};
-
-/* Compute bucket count for hashing table. We do not use a static set
- of possible tables sizes anymore. Instead we determine for all
- possible reasonable sizes of the table the outcome (i.e., the
- number of collisions etc) and choose the best solution. The
- weighting functions are not too simple to allow the table to grow
- without bounds. Instead one of the weighting factors is the size.
- Therefore the result is always a good payoff between few collisions
- (= short chain lengths) and table size. */
-static size_t
-compute_bucket_count (info)
- struct bfd_link_info *info;
-{
- size_t dynsymcount = elf_hash_table (info)->dynsymcount;
- size_t best_size = 0;
- unsigned long int *hashcodes;
- unsigned long int *hashcodesp;
- unsigned long int i;
- bfd_size_type amt;
-
- /* Compute the hash values for all exported symbols. At the same
- time store the values in an array so that we could use them for
- optimizations. */
- amt = dynsymcount;
- amt *= sizeof (unsigned long int);
- hashcodes = (unsigned long int *) bfd_malloc (amt);
- if (hashcodes == NULL)
- return 0;
- hashcodesp = hashcodes;
-
- /* Put all hash values in HASHCODES. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_collect_hash_codes, &hashcodesp);
-
- /* We have a problem here. The following code to optimize the table
- size requires an integer type with more the 32 bits. If
- BFD_HOST_U_64_BIT is set we know about such a type. */
-#ifdef BFD_HOST_U_64_BIT
- if (info->optimize)
- {
- unsigned long int nsyms = hashcodesp - hashcodes;
- size_t minsize;
- size_t maxsize;
- BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0);
- unsigned long int *counts ;
-
- /* Possible optimization parameters: if we have NSYMS symbols we say
- that the hashing table must at least have NSYMS/4 and at most
- 2*NSYMS buckets. */
- minsize = nsyms / 4;
- if (minsize == 0)
- minsize = 1;
- best_size = maxsize = nsyms * 2;
-
- /* Create array where we count the collisions in. We must use bfd_malloc
- since the size could be large. */
- amt = maxsize;
- amt *= sizeof (unsigned long int);
- counts = (unsigned long int *) bfd_malloc (amt);
- if (counts == NULL)
- {
- free (hashcodes);
- return 0;
- }
-
- /* Compute the "optimal" size for the hash table. The criteria is a
- minimal chain length. The minor criteria is (of course) the size
- of the table. */
- for (i = minsize; i < maxsize; ++i)
- {
- /* Walk through the array of hashcodes and count the collisions. */
- BFD_HOST_U_64_BIT max;
- unsigned long int j;
- unsigned long int fact;
-
- memset (counts, '\0', i * sizeof (unsigned long int));
-
- /* Determine how often each hash bucket is used. */
- for (j = 0; j < nsyms; ++j)
- ++counts[hashcodes[j] % i];
-
- /* For the weight function we need some information about the
- pagesize on the target. This is information need not be 100%
- accurate. Since this information is not available (so far) we
- define it here to a reasonable default value. If it is crucial
- to have a better value some day simply define this value. */
-# ifndef BFD_TARGET_PAGESIZE
-# define BFD_TARGET_PAGESIZE (4096)
-# endif
-
- /* We in any case need 2 + NSYMS entries for the size values and
- the chains. */
- max = (2 + nsyms) * (ARCH_SIZE / 8);
-
-# if 1
- /* Variant 1: optimize for short chains. We add the squares
- of all the chain lengths (which favous many small chain
- over a few long chains). */
- for (j = 0; j < i; ++j)
- max += counts[j] * counts[j];
-
- /* This adds penalties for the overall size of the table. */
- fact = i / (BFD_TARGET_PAGESIZE / (ARCH_SIZE / 8)) + 1;
- max *= fact * fact;
-# else
- /* Variant 2: Optimize a lot more for small table. Here we
- also add squares of the size but we also add penalties for
- empty slots (the +1 term). */
- for (j = 0; j < i; ++j)
- max += (1 + counts[j]) * (1 + counts[j]);
-
- /* The overall size of the table is considered, but not as
- strong as in variant 1, where it is squared. */
- fact = i / (BFD_TARGET_PAGESIZE / (ARCH_SIZE / 8)) + 1;
- max *= fact;
-# endif
-
- /* Compare with current best results. */
- if (max < best_chlen)
- {
- best_chlen = max;
- best_size = i;
- }
- }
-
- free (counts);
- }
- else
-#endif /* defined (BFD_HOST_U_64_BIT) */
- {
- /* This is the fallback solution if no 64bit type is available or if we
- are not supposed to spend much time on optimizations. We select the
- bucket count using a fixed set of numbers. */
- for (i = 0; elf_buckets[i] != 0; i++)
- {
- best_size = elf_buckets[i];
- if (dynsymcount < elf_buckets[i + 1])
- break;
- }
- }
-
- /* Free the arrays we needed. */
- free (hashcodes);
-
- return best_size;
-}
-
-/* Set up the sizes and contents of the ELF dynamic sections. This is
- called by the ELF linker emulation before_allocation routine. We
- must set the sizes of the sections before the linker sets the
- addresses of the various sections. */
-
-boolean
-NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
- filter_shlib,
- auxiliary_filters, info, sinterpptr,
- verdefs)
- bfd *output_bfd;
- const char *soname;
- const char *rpath;
- const char *filter_shlib;
- const char * const *auxiliary_filters;
- struct bfd_link_info *info;
- asection **sinterpptr;
- struct bfd_elf_version_tree *verdefs;
-{
- bfd_size_type soname_indx;
- bfd *dynobj;
- struct elf_backend_data *bed;
- struct elf_assign_sym_version_info asvinfo;
-
- *sinterpptr = NULL;
-
- soname_indx = (bfd_size_type) -1;
-
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
- return true;
-
- if (! is_elf_hash_table (info))
- return true;
-
- /* Any syms created from now on start with -1 in
- got.refcount/offset and plt.refcount/offset. */
- elf_hash_table (info)->init_refcount = -1;
-
- /* The backend may have to create some sections regardless of whether
- we're dynamic or not. */
- bed = get_elf_backend_data (output_bfd);
- if (bed->elf_backend_always_size_sections
- && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
- return false;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- /* If there were no dynamic objects in the link, there is nothing to
- do here. */
- if (dynobj == NULL)
- return true;
-
- if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
- return false;
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- struct elf_info_failed eif;
- struct elf_link_hash_entry *h;
- asection *dynstr;
- struct bfd_elf_version_tree *t;
- struct bfd_elf_version_expr *d;
- boolean all_defined;
-
- *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (*sinterpptr != NULL || info->shared);
-
- if (soname != NULL)
- {
- soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- soname, true);
- if (soname_indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SONAME,
- soname_indx))
- return false;
- }
-
- if (info->symbolic)
- {
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMBOLIC,
- (bfd_vma) 0))
- return false;
- info->flags |= DF_SYMBOLIC;
- }
-
- if (rpath != NULL)
- {
- bfd_size_type indx;
-
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
- true);
- if (info->new_dtags)
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
- if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_RPATH, indx)
- || (info->new_dtags
- && ! elf_add_dynamic_entry (info, (bfd_vma) DT_RUNPATH,
- indx)))
- return false;
- }
-
- if (filter_shlib != NULL)
- {
- bfd_size_type indx;
-
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- filter_shlib, true);
- if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_FILTER, indx))
- return false;
- }
-
- if (auxiliary_filters != NULL)
- {
- const char * const *p;
-
- for (p = auxiliary_filters; *p != NULL; p++)
- {
- bfd_size_type indx;
-
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- *p, true);
- if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_AUXILIARY,
- indx))
- return false;
- }
- }
-
- eif.info = info;
- eif.verdefs = verdefs;
- eif.failed = false;
-
- /* If we are supposed to export all symbols into the dynamic symbol
- table (this is not the normal case), then do so. */
- if (info->export_dynamic)
- {
- elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol,
- (PTR) &eif);
- if (eif.failed)
- return false;
- }
-
- /* Make all global versions with definiton. */
- for (t = verdefs; t != NULL; t = t->next)
- for (d = t->globals; d != NULL; d = d->next)
- if (!d->symver && strchr (d->pattern, '*') == NULL)
- {
- const char *verstr, *name;
- size_t namelen, verlen, newlen;
- char *newname, *p;
- struct elf_link_hash_entry *newh;
-
- name = d->pattern;
- namelen = strlen (name);
- verstr = t->name;
- verlen = strlen (verstr);
- newlen = namelen + verlen + 3;
-
- newname = (char *) bfd_malloc ((bfd_size_type) newlen);
- if (newname == NULL)
- return false;
- memcpy (newname, name, namelen);
-
- /* Check the hidden versioned definition. */
- p = newname + namelen;
- *p++ = ELF_VER_CHR;
- memcpy (p, verstr, verlen + 1);
- newh = elf_link_hash_lookup (elf_hash_table (info),
- newname, false, false,
- false);
- if (newh == NULL
- || (newh->root.type != bfd_link_hash_defined
- && newh->root.type != bfd_link_hash_defweak))
- {
- /* Check the default versioned definition. */
- *p++ = ELF_VER_CHR;
- memcpy (p, verstr, verlen + 1);
- newh = elf_link_hash_lookup (elf_hash_table (info),
- newname, false, false,
- false);
- }
- free (newname);
-
- /* Mark this version if there is a definition and it is
- not defined in a shared object. */
- if (newh != NULL
- && ((newh->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) == 0)
- && (newh->root.type == bfd_link_hash_defined
- || newh->root.type == bfd_link_hash_defweak))
- d->symver = 1;
- }
-
- /* Attach all the symbols to their version information. */
- asvinfo.output_bfd = output_bfd;
- asvinfo.info = info;
- asvinfo.verdefs = verdefs;
- asvinfo.failed = false;
-
- elf_link_hash_traverse (elf_hash_table (info),
- elf_link_assign_sym_version,
- (PTR) &asvinfo);
- if (asvinfo.failed)
- return false;
-
- if (!info->allow_undefined_version)
- {
- /* Check if all global versions have a definiton. */
- all_defined = true;
- for (t = verdefs; t != NULL; t = t->next)
- for (d = t->globals; d != NULL; d = d->next)
- if (!d->symver && !d->script
- && strchr (d->pattern, '*') == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: undefined version: %s"),
- d->pattern, t->name);
- all_defined = false;
- }
-
- if (!all_defined)
- {
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
- }
-
- /* Find all symbols which were defined in a dynamic object and make
- the backend pick a reasonable value for them. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_adjust_dynamic_symbol,
- (PTR) &eif);
- if (eif.failed)
- return false;
-
- /* Add some entries to the .dynamic section. We fill in some of the
- values later, in elf_bfd_final_link, but we must add the entries
- now so that we know the final size of the .dynamic section. */
-
- /* If there are initialization and/or finalization functions to
- call then add the corresponding DT_INIT/DT_FINI entries. */
- h = (info->init_function
- ? elf_link_hash_lookup (elf_hash_table (info),
- info->init_function, false,
- false, false)
- : NULL);
- if (h != NULL
- && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR)) != 0)
- {
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_INIT, (bfd_vma) 0))
- return false;
- }
- h = (info->fini_function
- ? elf_link_hash_lookup (elf_hash_table (info),
- info->fini_function, false,
- false, false)
- : NULL);
- if (h != NULL
- && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR)) != 0)
- {
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FINI, (bfd_vma) 0))
- return false;
- }
-
- if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL)
- {
- /* DT_PREINIT_ARRAY is not allowed in shared library. */
- if (info->shared)
- {
- bfd *sub;
- asection *o;
-
- for (sub = info->input_bfds; sub != NULL;
- sub = sub->link_next)
- for (o = sub->sections; o != NULL; o = o->next)
- if (elf_section_data (o)->this_hdr.sh_type
- == SHT_PREINIT_ARRAY)
- {
- (*_bfd_error_handler)
- (_("%s: .preinit_array section is not allowed in DSO"),
- bfd_archive_filename (sub));
- break;
- }
-
- bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
- }
-
- if (!elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAY,
- (bfd_vma) 0)
- || !elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAYSZ,
- (bfd_vma) 0))
- return false;
- }
- if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL)
- {
- if (!elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAY,
- (bfd_vma) 0)
- || !elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAYSZ,
- (bfd_vma) 0))
- return false;
- }
- if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL)
- {
- if (!elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAY,
- (bfd_vma) 0)
- || !elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAYSZ,
- (bfd_vma) 0))
- return false;
- }
-
- dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
- /* If .dynstr is excluded from the link, we don't want any of
- these tags. Strictly, we should be checking each section
- individually; This quick check covers for the case where
- someone does a /DISCARD/ : { *(*) }. */
- if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr)
- {
- bfd_size_type strsize;
-
- strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_HASH, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRTAB, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMTAB, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRSZ, strsize)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMENT,
- (bfd_vma) sizeof (Elf_External_Sym)))
- return false;
- }
- }
-
- /* The backend must work out the sizes of all the other dynamic
- sections. */
- if (bed->elf_backend_size_dynamic_sections
- && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
- return false;
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- bfd_size_type dynsymcount;
- asection *s;
- size_t bucketcount = 0;
- size_t hash_entry_size;
- unsigned int dtagcount;
-
- /* Set up the version definition section. */
- s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
- BFD_ASSERT (s != NULL);
-
- /* We may have created additional version definitions if we are
- just linking a regular application. */
- verdefs = asvinfo.verdefs;
-
- /* Skip anonymous version tag. */
- if (verdefs != NULL && verdefs->vernum == 0)
- verdefs = verdefs->next;
-
- if (verdefs == NULL)
- _bfd_strip_section_from_output (info, s);
- else
- {
- unsigned int cdefs;
- bfd_size_type size;
- struct bfd_elf_version_tree *t;
- bfd_byte *p;
- Elf_Internal_Verdef def;
- Elf_Internal_Verdaux defaux;
-
- cdefs = 0;
- size = 0;
-
- /* Make space for the base version. */
- size += sizeof (Elf_External_Verdef);
- size += sizeof (Elf_External_Verdaux);
- ++cdefs;
-
- for (t = verdefs; t != NULL; t = t->next)
- {
- struct bfd_elf_version_deps *n;
-
- size += sizeof (Elf_External_Verdef);
- size += sizeof (Elf_External_Verdaux);
- ++cdefs;
-
- for (n = t->deps; n != NULL; n = n->next)
- size += sizeof (Elf_External_Verdaux);
- }
-
- s->_raw_size = size;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return false;
-
- /* Fill in the version definition section. */
-
- p = s->contents;
-
- def.vd_version = VER_DEF_CURRENT;
- def.vd_flags = VER_FLG_BASE;
- def.vd_ndx = 1;
- def.vd_cnt = 1;
- def.vd_aux = sizeof (Elf_External_Verdef);
- def.vd_next = (sizeof (Elf_External_Verdef)
- + sizeof (Elf_External_Verdaux));
-
- if (soname_indx != (bfd_size_type) -1)
- {
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
- soname_indx);
- def.vd_hash = bfd_elf_hash (soname);
- defaux.vda_name = soname_indx;
- }
- else
- {
- const char *name;
- bfd_size_type indx;
-
- name = basename (output_bfd->filename);
- def.vd_hash = bfd_elf_hash (name);
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- name, false);
- if (indx == (bfd_size_type) -1)
- return false;
- defaux.vda_name = indx;
- }
- defaux.vda_next = 0;
-
- _bfd_elf_swap_verdef_out (output_bfd, &def,
- (Elf_External_Verdef *) p);
- p += sizeof (Elf_External_Verdef);
- _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
- (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
-
- for (t = verdefs; t != NULL; t = t->next)
- {
- unsigned int cdeps;
- struct bfd_elf_version_deps *n;
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
-
- cdeps = 0;
- for (n = t->deps; n != NULL; n = n->next)
- ++cdeps;
-
- /* Add a symbol representing this version. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
- (bfd_vma) 0, (const char *) NULL, false,
- get_elf_backend_data (dynobj)->collect, &bh)))
- return false;
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
- h->verinfo.vertree = t;
-
- if (! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
-
- def.vd_version = VER_DEF_CURRENT;
- def.vd_flags = 0;
- if (t->globals == NULL && t->locals == NULL && ! t->used)
- def.vd_flags |= VER_FLG_WEAK;
- def.vd_ndx = t->vernum + 1;
- def.vd_cnt = cdeps + 1;
- def.vd_hash = bfd_elf_hash (t->name);
- def.vd_aux = sizeof (Elf_External_Verdef);
- if (t->next != NULL)
- def.vd_next = (sizeof (Elf_External_Verdef)
- + (cdeps + 1) * sizeof (Elf_External_Verdaux));
- else
- def.vd_next = 0;
-
- _bfd_elf_swap_verdef_out (output_bfd, &def,
- (Elf_External_Verdef *) p);
- p += sizeof (Elf_External_Verdef);
-
- defaux.vda_name = h->dynstr_index;
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
- h->dynstr_index);
- if (t->deps == NULL)
- defaux.vda_next = 0;
- else
- defaux.vda_next = sizeof (Elf_External_Verdaux);
- t->name_indx = defaux.vda_name;
-
- _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
- (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
-
- for (n = t->deps; n != NULL; n = n->next)
- {
- if (n->version_needed == NULL)
- {
- /* This can happen if there was an error in the
- version script. */
- defaux.vda_name = 0;
- }
- else
- {
- defaux.vda_name = n->version_needed->name_indx;
- _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
- defaux.vda_name);
- }
- if (n->next == NULL)
- defaux.vda_next = 0;
- else
- defaux.vda_next = sizeof (Elf_External_Verdaux);
-
- _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
- (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
- }
- }
-
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEF, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEFNUM,
- (bfd_vma) cdefs))
- return false;
-
- elf_tdata (output_bfd)->cverdefs = cdefs;
- }
-
- if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
- {
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags))
- return false;
- }
-
- if (info->flags_1)
- {
- if (! info->shared)
- info->flags_1 &= ~ (DF_1_INITFIRST
- | DF_1_NODELETE
- | DF_1_NOOPEN);
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS_1,
- info->flags_1))
- return false;
- }
-
- /* Work out the size of the version reference section. */
-
- s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
- BFD_ASSERT (s != NULL);
- {
- struct elf_find_verdep_info sinfo;
-
- sinfo.output_bfd = output_bfd;
- sinfo.info = info;
- sinfo.vers = elf_tdata (output_bfd)->cverdefs;
- if (sinfo.vers == 0)
- sinfo.vers = 1;
- sinfo.failed = false;
-
- elf_link_hash_traverse (elf_hash_table (info),
- elf_link_find_version_dependencies,
- (PTR) &sinfo);
-
- if (elf_tdata (output_bfd)->verref == NULL)
- _bfd_strip_section_from_output (info, s);
- else
- {
- Elf_Internal_Verneed *t;
- unsigned int size;
- unsigned int crefs;
- bfd_byte *p;
-
- /* Build the version definition section. */
- size = 0;
- crefs = 0;
- for (t = elf_tdata (output_bfd)->verref;
- t != NULL;
- t = t->vn_nextref)
- {
- Elf_Internal_Vernaux *a;
-
- size += sizeof (Elf_External_Verneed);
- ++crefs;
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- size += sizeof (Elf_External_Vernaux);
- }
-
- s->_raw_size = size;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return false;
-
- p = s->contents;
- for (t = elf_tdata (output_bfd)->verref;
- t != NULL;
- t = t->vn_nextref)
- {
- unsigned int caux;
- Elf_Internal_Vernaux *a;
- bfd_size_type indx;
-
- caux = 0;
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- ++caux;
-
- t->vn_version = VER_NEED_CURRENT;
- t->vn_cnt = caux;
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- elf_dt_name (t->vn_bfd) != NULL
- ? elf_dt_name (t->vn_bfd)
- : basename (t->vn_bfd->filename),
- false);
- if (indx == (bfd_size_type) -1)
- return false;
- t->vn_file = indx;
- t->vn_aux = sizeof (Elf_External_Verneed);
- if (t->vn_nextref == NULL)
- t->vn_next = 0;
- else
- t->vn_next = (sizeof (Elf_External_Verneed)
- + caux * sizeof (Elf_External_Vernaux));
-
- _bfd_elf_swap_verneed_out (output_bfd, t,
- (Elf_External_Verneed *) p);
- p += sizeof (Elf_External_Verneed);
-
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- {
- a->vna_hash = bfd_elf_hash (a->vna_nodename);
- indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
- a->vna_nodename, false);
- if (indx == (bfd_size_type) -1)
- return false;
- a->vna_name = indx;
- if (a->vna_nextptr == NULL)
- a->vna_next = 0;
- else
- a->vna_next = sizeof (Elf_External_Vernaux);
-
- _bfd_elf_swap_vernaux_out (output_bfd, a,
- (Elf_External_Vernaux *) p);
- p += sizeof (Elf_External_Vernaux);
- }
- }
-
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEED,
- (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEEDNUM,
- (bfd_vma) crefs))
- return false;
-
- elf_tdata (output_bfd)->cverrefs = crefs;
- }
- }
-
- /* Assign dynsym indicies. In a shared library we generate a
- section symbol for each output section, which come first.
- Next come all of the back-end allocated local dynamic syms,
- followed by the rest of the global symbols. */
-
- dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
-
- /* Work out the size of the symbol version section. */
- s = bfd_get_section_by_name (dynobj, ".gnu.version");
- BFD_ASSERT (s != NULL);
- if (dynsymcount == 0
- || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL))
- {
- _bfd_strip_section_from_output (info, s);
- /* The DYNSYMCOUNT might have changed if we were going to
- output a dynamic symbol table entry for S. */
- dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
- }
- else
- {
- s->_raw_size = dynsymcount * sizeof (Elf_External_Versym);
- s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return false;
-
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERSYM, (bfd_vma) 0))
- return false;
- }
-
- /* Set the size of the .dynsym and .hash sections. We counted
- the number of dynamic symbols in elf_link_add_object_symbols.
- We will build the contents of .dynsym and .hash when we build
- the final symbol table, because until then we do not know the
- correct value to give the symbols. We built the .dynstr
- section as we went along in elf_link_add_object_symbols. */
- s = bfd_get_section_by_name (dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- s->_raw_size = dynsymcount * sizeof (Elf_External_Sym);
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return false;
-
- if (dynsymcount != 0)
- {
- Elf_Internal_Sym isym;
-
- /* The first entry in .dynsym is a dummy symbol. */
- isym.st_value = 0;
- isym.st_size = 0;
- isym.st_name = 0;
- isym.st_info = 0;
- isym.st_other = 0;
- isym.st_shndx = 0;
- elf_swap_symbol_out (output_bfd, &isym, (PTR) s->contents, (PTR) 0);
- }
-
- /* Compute the size of the hashing table. As a side effect this
- computes the hash values for all the names we export. */
- bucketcount = compute_bucket_count (info);
-
- s = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
- hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
- s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
- s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return false;
-
- bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount,
- s->contents);
- bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) dynsymcount,
- s->contents + hash_entry_size);
-
- elf_hash_table (info)->bucketcount = bucketcount;
-
- s = bfd_get_section_by_name (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
-
- elf_finalize_dynstr (output_bfd, info);
-
- s->_raw_size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
-
- for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NULL, (bfd_vma) 0))
- return false;
- }
-
- return true;
-}
-
-/* This function is used to adjust offsets into .dynstr for
- dynamic symbols. This is called via elf_link_hash_traverse. */
-
-static boolean elf_adjust_dynstr_offsets
-PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static boolean
-elf_adjust_dynstr_offsets (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx != -1)
- h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
- return true;
-}
-
-/* Assign string offsets in .dynstr, update all structures referencing
- them. */
-
-static boolean
-elf_finalize_dynstr (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- struct elf_link_local_dynamic_entry *entry;
- struct elf_strtab_hash *dynstr = elf_hash_table (info)->dynstr;
- bfd *dynobj = elf_hash_table (info)->dynobj;
- asection *sdyn;
- bfd_size_type size;
- Elf_External_Dyn *dyncon, *dynconend;
-
- _bfd_elf_strtab_finalize (dynstr);
- size = _bfd_elf_strtab_size (dynstr);
-
- /* Update all .dynamic entries referencing .dynstr strings. */
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (sdyn != NULL);
-
- dyncon = (Elf_External_Dyn *) sdyn->contents;
- dynconend = (Elf_External_Dyn *) (sdyn->contents +
- sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
-
- elf_swap_dyn_in (dynobj, dyncon, & dyn);
- switch (dyn.d_tag)
- {
- case DT_STRSZ:
- dyn.d_un.d_val = size;
- elf_swap_dyn_out (dynobj, & dyn, dyncon);
- break;
- case DT_NEEDED:
- case DT_SONAME:
- case DT_RPATH:
- case DT_RUNPATH:
- case DT_FILTER:
- case DT_AUXILIARY:
- dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val);
- elf_swap_dyn_out (dynobj, & dyn, dyncon);
- break;
- default:
- break;
- }
- }
-
- /* Now update local dynamic symbols. */
- for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next)
- entry->isym.st_name = _bfd_elf_strtab_offset (dynstr,
- entry->isym.st_name);
-
- /* And the rest of dynamic symbols. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_adjust_dynstr_offsets, dynstr);
-
- /* Adjust version definitions. */
- if (elf_tdata (output_bfd)->cverdefs)
- {
- asection *s;
- bfd_byte *p;
- bfd_size_type i;
- Elf_Internal_Verdef def;
- Elf_Internal_Verdaux defaux;
-
- s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
- p = (bfd_byte *) s->contents;
- do
- {
- _bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p,
- &def);
- p += sizeof (Elf_External_Verdef);
- for (i = 0; i < def.vd_cnt; ++i)
- {
- _bfd_elf_swap_verdaux_in (output_bfd,
- (Elf_External_Verdaux *) p, &defaux);
- defaux.vda_name = _bfd_elf_strtab_offset (dynstr,
- defaux.vda_name);
- _bfd_elf_swap_verdaux_out (output_bfd,
- &defaux, (Elf_External_Verdaux *) p);
- p += sizeof (Elf_External_Verdaux);
- }
- }
- while (def.vd_next);
- }
-
- /* Adjust version references. */
- if (elf_tdata (output_bfd)->verref)
- {
- asection *s;
- bfd_byte *p;
- bfd_size_type i;
- Elf_Internal_Verneed need;
- Elf_Internal_Vernaux needaux;
-
- s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
- p = (bfd_byte *) s->contents;
- do
- {
- _bfd_elf_swap_verneed_in (output_bfd, (Elf_External_Verneed *) p,
- &need);
- need.vn_file = _bfd_elf_strtab_offset (dynstr, need.vn_file);
- _bfd_elf_swap_verneed_out (output_bfd, &need,
- (Elf_External_Verneed *) p);
- p += sizeof (Elf_External_Verneed);
- for (i = 0; i < need.vn_cnt; ++i)
- {
- _bfd_elf_swap_vernaux_in (output_bfd,
- (Elf_External_Vernaux *) p, &needaux);
- needaux.vna_name = _bfd_elf_strtab_offset (dynstr,
- needaux.vna_name);
- _bfd_elf_swap_vernaux_out (output_bfd,
- &needaux,
- (Elf_External_Vernaux *) p);
- p += sizeof (Elf_External_Vernaux);
- }
- }
- while (need.vn_next);
- }
-
- return true;
-}
-
-/* Fix up the flags for a symbol. This handles various cases which
- can only be fixed after all the input files are seen. This is
- currently called by both adjust_dynamic_symbol and
- assign_sym_version, which is unnecessary but perhaps more robust in
- the face of future changes. */
-
-static boolean
-elf_fix_symbol_flags (h, eif)
- struct elf_link_hash_entry *h;
- struct elf_info_failed *eif;
-{
- /* If this symbol was mentioned in a non-ELF file, try to set
- DEF_REGULAR and REF_REGULAR correctly. This is the only way to
- permit a non-ELF file to correctly refer to a symbol defined in
- an ELF dynamic object. */
- if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) != 0)
- {
- while (h->root.type == bfd_link_hash_indirect)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK);
- else
- {
- if (h->root.u.def.section->owner != NULL
- && (bfd_get_flavour (h->root.u.def.section->owner)
- == bfd_target_elf_flavour))
- h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK);
- else
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- }
-
- if (h->dynindx == -1
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0))
- {
- if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
- {
- eif->failed = true;
- return false;
- }
- }
- }
- else
- {
- /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol
- was first seen in a non-ELF file. Fortunately, if the symbol
- was first seen in an ELF file, we're probably OK unless the
- symbol was defined in a non-ELF file. Catch that case here.
- FIXME: We're still in trouble if the symbol was first seen in
- a dynamic object, and then later in a non-ELF regular object. */
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->root.u.def.section->owner != NULL
- ? (bfd_get_flavour (h->root.u.def.section->owner)
- != bfd_target_elf_flavour)
- : (bfd_is_abs_section (h->root.u.def.section)
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) == 0)))
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- }
-
- /* If this is a final link, and the symbol was defined as a common
- symbol in a regular object file, and there was no definition in
- any dynamic object, then the linker will have allocated space for
- the symbol in a common section but the ELF_LINK_HASH_DEF_REGULAR
- flag will not have been set. */
- if (h->root.type == bfd_link_hash_defined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
-
- /* If -Bsymbolic was used (which means to bind references to global
- symbols to the definition within the shared object), and this
- symbol was defined in a regular object, then it actually doesn't
- need a PLT entry, and we can accomplish that by forcing it local.
- Likewise, if the symbol has hidden or internal visibility.
- FIXME: It might be that we also do not need a PLT for other
- non-hidden visibilities, but we would have to tell that to the
- backend specifically; we can't just clear PLT-related data here. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
- && eif->info->shared
- && is_elf_hash_table (eif->info)
- && (eif->info->symbolic
- || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
- || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
- {
- struct elf_backend_data *bed;
- boolean force_local;
-
- bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
-
- force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
- || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN);
- (*bed->elf_backend_hide_symbol) (eif->info, h, force_local);
- }
-
- /* If this is a weak defined symbol in a dynamic object, and we know
- the real definition in the dynamic object, copy interesting flags
- over to the real definition. */
- if (h->weakdef != NULL)
- {
- struct elf_link_hash_entry *weakdef;
-
- weakdef = h->weakdef;
- if (h->root.type == bfd_link_hash_indirect)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak);
- BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
- || weakdef->root.type == bfd_link_hash_defweak);
- BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC);
-
- /* If the real definition is defined by a regular object file,
- don't do anything special. See the longer description in
- elf_adjust_dynamic_symbol, below. */
- if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
- h->weakdef = NULL;
- else
- {
- struct elf_backend_data *bed;
-
- bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
- (*bed->elf_backend_copy_indirect_symbol) (bed, weakdef, h);
- }
- }
-
- return true;
-}
-
-/* Make the backend pick a good value for a dynamic symbol. This is
- called via elf_link_hash_traverse, and also calls itself
- recursively. */
-
-static boolean
-elf_adjust_dynamic_symbol (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- struct elf_info_failed *eif = (struct elf_info_failed *) data;
- bfd *dynobj;
- struct elf_backend_data *bed;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h->plt.offset = (bfd_vma) -1;
- h->got.offset = (bfd_vma) -1;
-
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- }
-
- /* Ignore indirect symbols. These are added by the versioning code. */
- if (h->root.type == bfd_link_hash_indirect)
- return true;
-
- if (! is_elf_hash_table (eif->info))
- return false;
-
- /* Fix the symbol flags. */
- if (! elf_fix_symbol_flags (h, eif))
- return false;
-
- /* If this symbol does not require a PLT entry, and it is not
- defined by a dynamic object, or is not referenced by a regular
- object, ignore it. We do have to handle a weak defined symbol,
- even if no regular object refers to it, if we decided to add it
- to the dynamic symbol table. FIXME: Do we normally need to worry
- about symbols which are defined by one dynamic object and
- referenced by another one? */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
- && (h->weakdef == NULL || h->weakdef->dynindx == -1))))
- {
- h->plt.offset = (bfd_vma) -1;
- return true;
- }
-
- /* If we've already adjusted this symbol, don't do it again. This
- can happen via a recursive call. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
- return true;
-
- /* Don't look at this symbol again. Note that we must set this
- after checking the above conditions, because we may look at a
- symbol once, decide not to do anything, and then get called
- recursively later after REF_REGULAR is set below. */
- h->elf_link_hash_flags |= ELF_LINK_HASH_DYNAMIC_ADJUSTED;
-
- /* If this is a weak definition, and we know a real definition, and
- the real symbol is not itself defined by a regular object file,
- then get a good value for the real definition. We handle the
- real symbol first, for the convenience of the backend routine.
-
- Note that there is a confusing case here. If the real definition
- is defined by a regular object file, we don't get the real symbol
- from the dynamic object, but we do get the weak symbol. If the
- processor backend uses a COPY reloc, then if some routine in the
- dynamic object changes the real symbol, we will not see that
- change in the corresponding weak symbol. This is the way other
- ELF linkers work as well, and seems to be a result of the shared
- library model.
-
- I will clarify this issue. Most SVR4 shared libraries define the
- variable _timezone and define timezone as a weak synonym. The
- tzset call changes _timezone. If you write
- extern int timezone;
- int _timezone = 5;
- int main () { tzset (); printf ("%d %d\n", timezone, _timezone); }
- you might expect that, since timezone is a synonym for _timezone,
- the same number will print both times. However, if the processor
- backend uses a COPY reloc, then actually timezone will be copied
- into your process image, and, since you define _timezone
- yourself, _timezone will not. Thus timezone and _timezone will
- wind up at different memory locations. The tzset call will set
- _timezone, leaving timezone unchanged. */
-
- if (h->weakdef != NULL)
- {
- /* If we get to this point, we know there is an implicit
- reference by a regular object file via the weak symbol H.
- FIXME: Is this really true? What if the traversal finds
- H->WEAKDEF before it finds H? */
- h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
-
- if (! elf_adjust_dynamic_symbol (h->weakdef, (PTR) eif))
- return false;
- }
-
- /* If a symbol has no type and no size and does not require a PLT
- entry, then we are probably about to do the wrong thing here: we
- are probably going to create a COPY reloc for an empty object.
- This case can arise when a shared object is built with assembly
- code, and the assembly code fails to set the symbol type. */
- if (h->size == 0
- && h->type == STT_NOTYPE
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
- (*_bfd_error_handler)
- (_("warning: type and size of dynamic symbol `%s' are not defined"),
- h->root.root.string);
-
- dynobj = elf_hash_table (eif->info)->dynobj;
- bed = get_elf_backend_data (dynobj);
- if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h))
- {
- eif->failed = true;
- return false;
- }
-
- return true;
-}
-
-/* This routine is used to export all defined symbols into the dynamic
- symbol table. It is called via elf_link_hash_traverse. */
-
-static boolean
-elf_export_symbol (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- struct elf_info_failed *eif = (struct elf_info_failed *) data;
-
- /* Ignore indirect symbols. These are added by the versioning code. */
- if (h->root.type == bfd_link_hash_indirect)
- return true;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx == -1
- && (h->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0)
- {
- struct bfd_elf_version_tree *t;
- struct bfd_elf_version_expr *d;
-
- for (t = eif->verdefs; t != NULL; t = t->next)
- {
- if (t->globals != NULL)
- {
- for (d = t->globals; d != NULL; d = d->next)
- {
- if ((*d->match) (d, h->root.root.string))
- goto doit;
- }
- }
-
- if (t->locals != NULL)
- {
- for (d = t->locals ; d != NULL; d = d->next)
- {
- if ((*d->match) (d, h->root.root.string))
- return true;
- }
- }
- }
-
- if (!eif->verdefs)
- {
- doit:
- if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
- {
- eif->failed = true;
- return false;
- }
- }
- }
-
- return true;
-}
-
-/* Look through the symbols which are defined in other shared
- libraries and referenced here. Update the list of version
- dependencies. This will be put into the .gnu.version_r section.
- This function is called via elf_link_hash_traverse. */
-
-static boolean
-elf_link_find_version_dependencies (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
- Elf_Internal_Verneed *t;
- Elf_Internal_Vernaux *a;
- bfd_size_type amt;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* We only care about symbols defined in shared objects with version
- information. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- || h->dynindx == -1
- || h->verinfo.verdef == NULL)
- return true;
-
- /* See if we already know about this version. */
- for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref)
- {
- if (t->vn_bfd != h->verinfo.verdef->vd_bfd)
- continue;
-
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
- if (a->vna_nodename == h->verinfo.verdef->vd_nodename)
- return true;
-
- break;
- }
-
- /* This is a new version. Add it to tree we are building. */
-
- if (t == NULL)
- {
- amt = sizeof *t;
- t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, amt);
- if (t == NULL)
- {
- rinfo->failed = true;
- return false;
- }
-
- t->vn_bfd = h->verinfo.verdef->vd_bfd;
- t->vn_nextref = elf_tdata (rinfo->output_bfd)->verref;
- elf_tdata (rinfo->output_bfd)->verref = t;
- }
-
- amt = sizeof *a;
- a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, amt);
-
- /* Note that we are copying a string pointer here, and testing it
- above. If bfd_elf_string_from_elf_section is ever changed to
- discard the string data when low in memory, this will have to be
- fixed. */
- a->vna_nodename = h->verinfo.verdef->vd_nodename;
-
- a->vna_flags = h->verinfo.verdef->vd_flags;
- a->vna_nextptr = t->vn_auxptr;
-
- h->verinfo.verdef->vd_exp_refno = rinfo->vers;
- ++rinfo->vers;
-
- a->vna_other = h->verinfo.verdef->vd_exp_refno + 1;
-
- t->vn_auxptr = a;
-
- return true;
-}
-
-/* Figure out appropriate versions for all the symbols. We may not
- have the version number script until we have read all of the input
- files, so until that point we don't know which symbols should be
- local. This function is called via elf_link_hash_traverse. */
-
-static boolean
-elf_link_assign_sym_version (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- struct elf_assign_sym_version_info *sinfo;
- struct bfd_link_info *info;
- struct elf_backend_data *bed;
- struct elf_info_failed eif;
- char *p;
- bfd_size_type amt;
-
- sinfo = (struct elf_assign_sym_version_info *) data;
- info = sinfo->info;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Fix the symbol flags. */
- eif.failed = false;
- eif.info = info;
- if (! elf_fix_symbol_flags (h, &eif))
- {
- if (eif.failed)
- sinfo->failed = true;
- return false;
- }
-
- /* We only need version numbers for symbols defined in regular
- objects. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- return true;
-
- bed = get_elf_backend_data (sinfo->output_bfd);
- p = strchr (h->root.root.string, ELF_VER_CHR);
- if (p != NULL && h->verinfo.vertree == NULL)
- {
- struct bfd_elf_version_tree *t;
- boolean hidden;
-
- hidden = true;
-
- /* There are two consecutive ELF_VER_CHR characters if this is
- not a hidden symbol. */
- ++p;
- if (*p == ELF_VER_CHR)
- {
- hidden = false;
- ++p;
- }
-
- /* If there is no version string, we can just return out. */
- if (*p == '\0')
- {
- if (hidden)
- h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
- return true;
- }
-
- /* Look for the version. If we find it, it is no longer weak. */
- for (t = sinfo->verdefs; t != NULL; t = t->next)
- {
- if (strcmp (t->name, p) == 0)
- {
- size_t len;
- char *alc;
- struct bfd_elf_version_expr *d;
-
- len = p - h->root.root.string;
- alc = bfd_malloc ((bfd_size_type) len);
- if (alc == NULL)
- return false;
- memcpy (alc, h->root.root.string, len - 1);
- alc[len - 1] = '\0';
- if (alc[len - 2] == ELF_VER_CHR)
- alc[len - 2] = '\0';
-
- h->verinfo.vertree = t;
- t->used = true;
- d = NULL;
-
- if (t->globals != NULL)
- {
- for (d = t->globals; d != NULL; d = d->next)
- if ((*d->match) (d, alc))
- break;
- }
-
- /* See if there is anything to force this symbol to
- local scope. */
- if (d == NULL && t->locals != NULL)
- {
- for (d = t->locals; d != NULL; d = d->next)
- {
- if ((*d->match) (d, alc))
- {
- if (h->dynindx != -1
- && info->shared
- && ! info->export_dynamic)
- {
- (*bed->elf_backend_hide_symbol) (info, h, true);
- }
-
- break;
- }
- }
- }
-
- free (alc);
- break;
- }
- }
-
- /* If we are building an application, we need to create a
- version node for this version. */
- if (t == NULL && ! info->shared)
- {
- struct bfd_elf_version_tree **pp;
- int version_index;
-
- /* If we aren't going to export this symbol, we don't need
- to worry about it. */
- if (h->dynindx == -1)
- return true;
-
- amt = sizeof *t;
- t = ((struct bfd_elf_version_tree *)
- bfd_alloc (sinfo->output_bfd, amt));
- if (t == NULL)
- {
- sinfo->failed = true;
- return false;
- }
-
- t->next = NULL;
- t->name = p;
- t->globals = NULL;
- t->locals = NULL;
- t->deps = NULL;
- t->name_indx = (unsigned int) -1;
- t->used = true;
-
- version_index = 1;
- /* Don't count anonymous version tag. */
- if (sinfo->verdefs != NULL && sinfo->verdefs->vernum == 0)
- version_index = 0;
- for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next)
- ++version_index;
- t->vernum = version_index;
-
- *pp = t;
-
- h->verinfo.vertree = t;
- }
- else if (t == NULL)
- {
- /* We could not find the version for a symbol when
- generating a shared archive. Return an error. */
- (*_bfd_error_handler)
- (_("%s: undefined versioned symbol name %s"),
- bfd_get_filename (sinfo->output_bfd), h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- sinfo->failed = true;
- return false;
- }
-
- if (hidden)
- h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
- }
-
- /* If we don't have a version for this symbol, see if we can find
- something. */
- if (h->verinfo.vertree == NULL && sinfo->verdefs != NULL)
- {
- struct bfd_elf_version_tree *t;
- struct bfd_elf_version_tree *local_ver;
- struct bfd_elf_version_expr *d;
-
- /* See if can find what version this symbol is in. If the
- symbol is supposed to be local, then don't actually register
- it. */
- local_ver = NULL;
- for (t = sinfo->verdefs; t != NULL; t = t->next)
- {
- if (t->globals != NULL)
- {
- boolean matched;
-
- matched = false;
- for (d = t->globals; d != NULL; d = d->next)
- {
- if ((*d->match) (d, h->root.root.string))
- {
- if (d->symver)
- matched = true;
- else
- {
- /* There is a version without definition. Make
- the symbol the default definition for this
- version. */
- h->verinfo.vertree = t;
- local_ver = NULL;
- d->script = 1;
- break;
- }
- }
- }
-
- if (d != NULL)
- break;
- else if (matched)
- /* There is no undefined version for this symbol. Hide the
- default one. */
- (*bed->elf_backend_hide_symbol) (info, h, true);
- }
-
- if (t->locals != NULL)
- {
- for (d = t->locals; d != NULL; d = d->next)
- {
- /* If the match is "*", keep looking for a more
- explicit, perhaps even global, match. */
- if (d->pattern[0] == '*' && d->pattern[1] == '\0')
- local_ver = t;
- else if ((*d->match) (d, h->root.root.string))
- {
- local_ver = t;
- break;
- }
- }
-
- if (d != NULL)
- break;
- }
- }
-
- if (local_ver != NULL)
- {
- h->verinfo.vertree = local_ver;
- if (h->dynindx != -1
- && info->shared
- && ! info->export_dynamic)
- {
- (*bed->elf_backend_hide_symbol) (info, h, true);
- }
- }
- }
-
- return true;
-}
-
-/* Final phase of ELF linker. */
-
-/* A structure we use to avoid passing large numbers of arguments. */
-
-struct elf_final_link_info
-{
- /* General link information. */
- struct bfd_link_info *info;
- /* Output BFD. */
- bfd *output_bfd;
- /* Symbol string table. */
- struct bfd_strtab_hash *symstrtab;
- /* .dynsym section. */
- asection *dynsym_sec;
- /* .hash section. */
- asection *hash_sec;
- /* symbol version section (.gnu.version). */
- asection *symver_sec;
- /* first SHF_TLS section (if any). */
- asection *first_tls_sec;
- /* Buffer large enough to hold contents of any section. */
- bfd_byte *contents;
- /* Buffer large enough to hold external relocs of any section. */
- PTR external_relocs;
- /* Buffer large enough to hold internal relocs of any section. */
- Elf_Internal_Rela *internal_relocs;
- /* Buffer large enough to hold external local symbols of any input
- BFD. */
- Elf_External_Sym *external_syms;
- /* And a buffer for symbol section indices. */
- Elf_External_Sym_Shndx *locsym_shndx;
- /* Buffer large enough to hold internal local symbols of any input
- BFD. */
- Elf_Internal_Sym *internal_syms;
- /* Array large enough to hold a symbol index for each local symbol
- of any input BFD. */
- long *indices;
- /* Array large enough to hold a section pointer for each local
- symbol of any input BFD. */
- asection **sections;
- /* Buffer to hold swapped out symbols. */
- Elf_External_Sym *symbuf;
- /* And one for symbol section indices. */
- Elf_External_Sym_Shndx *symshndxbuf;
- /* Number of swapped out symbols in buffer. */
- size_t symbuf_count;
- /* Number of symbols which fit in symbuf. */
- size_t symbuf_size;
-};
-
-static boolean elf_link_output_sym
- PARAMS ((struct elf_final_link_info *, const char *,
- Elf_Internal_Sym *, asection *));
-static boolean elf_link_flush_output_syms
- PARAMS ((struct elf_final_link_info *));
-static boolean elf_link_output_extsym
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_sec_merge_syms
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_check_versioned_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf_link_input_bfd
- PARAMS ((struct elf_final_link_info *, bfd *));
-static boolean elf_reloc_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
-
-/* This struct is used to pass information to elf_link_output_extsym. */
-
-struct elf_outext_info
-{
- boolean failed;
- boolean localsyms;
- struct elf_final_link_info *finfo;
-};
-
-/* Compute the size of, and allocate space for, REL_HDR which is the
- section header for a section containing relocations for O. */
-
-static boolean
-elf_link_size_reloc_section (abfd, rel_hdr, o)
- bfd *abfd;
- Elf_Internal_Shdr *rel_hdr;
- asection *o;
-{
- bfd_size_type reloc_count;
- bfd_size_type num_rel_hashes;
-
- /* Figure out how many relocations there will be. */
- if (rel_hdr == &elf_section_data (o)->rel_hdr)
- reloc_count = elf_section_data (o)->rel_count;
- else
- reloc_count = elf_section_data (o)->rel_count2;
-
- num_rel_hashes = o->reloc_count;
- if (num_rel_hashes < reloc_count)
- num_rel_hashes = reloc_count;
-
- /* That allows us to calculate the size of the section. */
- rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
-
- /* The contents field must last into write_object_contents, so we
- allocate it with bfd_alloc rather than malloc. Also since we
- cannot be sure that the contents will actually be filled in,
- we zero the allocated space. */
- rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size);
- if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
- return false;
-
- /* We only allocate one set of hash entries, so we only do it the
- first time we are called. */
- if (elf_section_data (o)->rel_hashes == NULL
- && num_rel_hashes)
- {
- struct elf_link_hash_entry **p;
-
- p = ((struct elf_link_hash_entry **)
- bfd_zmalloc (num_rel_hashes
- * sizeof (struct elf_link_hash_entry *)));
- if (p == NULL)
- return false;
-
- elf_section_data (o)->rel_hashes = p;
- }
-
- return true;
-}
-
-/* When performing a relocateable link, the input relocations are
- preserved. But, if they reference global symbols, the indices
- referenced must be updated. Update all the relocations in
- REL_HDR (there are COUNT of them), using the data in REL_HASH. */
-
-static void
-elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
- bfd *abfd;
- Elf_Internal_Shdr *rel_hdr;
- unsigned int count;
- struct elf_link_hash_entry **rel_hash;
-{
- unsigned int i;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- Elf_Internal_Rel *irel;
- Elf_Internal_Rela *irela;
- bfd_size_type amt = sizeof (Elf_Internal_Rel) * bed->s->int_rels_per_ext_rel;
-
- irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
- if (irel == NULL)
- {
- (*_bfd_error_handler) (_("Error: out of memory"));
- abort ();
- }
-
- amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
- irela = (Elf_Internal_Rela *) bfd_zmalloc (amt);
- if (irela == NULL)
- {
- (*_bfd_error_handler) (_("Error: out of memory"));
- abort ();
- }
-
- for (i = 0; i < count; i++, rel_hash++)
- {
- if (*rel_hash == NULL)
- continue;
-
- BFD_ASSERT ((*rel_hash)->indx >= 0);
-
- if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
- {
- Elf_External_Rel *erel;
- unsigned int j;
-
- erel = (Elf_External_Rel *) rel_hdr->contents + i;
- if (bed->s->swap_reloc_in)
- (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
- else
- elf_swap_reloc_in (abfd, erel, irel);
-
- for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
- irel[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
- ELF_R_TYPE (irel[j].r_info));
-
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (abfd, irel, (bfd_byte *) erel);
- else
- elf_swap_reloc_out (abfd, irel, erel);
- }
- else
- {
- Elf_External_Rela *erela;
- unsigned int j;
-
- BFD_ASSERT (rel_hdr->sh_entsize
- == sizeof (Elf_External_Rela));
-
- erela = (Elf_External_Rela *) rel_hdr->contents + i;
- if (bed->s->swap_reloca_in)
- (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
- else
- elf_swap_reloca_in (abfd, erela, irela);
-
- for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
- irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
- ELF_R_TYPE (irela[j].r_info));
-
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (abfd, irela, (bfd_byte *) erela);
- else
- elf_swap_reloca_out (abfd, irela, erela);
- }
- }
-
- free (irel);
- free (irela);
-}
-
-struct elf_link_sort_rela
-{
- bfd_vma offset;
- enum elf_reloc_type_class type;
- union
- {
- Elf_Internal_Rel rel;
- Elf_Internal_Rela rela;
- } u;
-};
-
-static int
-elf_link_sort_cmp1 (A, B)
- const PTR A;
- const PTR B;
-{
- struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
- struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
- int relativea, relativeb;
-
- relativea = a->type == reloc_class_relative;
- relativeb = b->type == reloc_class_relative;
-
- if (relativea < relativeb)
- return 1;
- if (relativea > relativeb)
- return -1;
- if (ELF_R_SYM (a->u.rel.r_info) < ELF_R_SYM (b->u.rel.r_info))
- return -1;
- if (ELF_R_SYM (a->u.rel.r_info) > ELF_R_SYM (b->u.rel.r_info))
- return 1;
- if (a->u.rel.r_offset < b->u.rel.r_offset)
- return -1;
- if (a->u.rel.r_offset > b->u.rel.r_offset)
- return 1;
- return 0;
-}
-
-static int
-elf_link_sort_cmp2 (A, B)
- const PTR A;
- const PTR B;
-{
- struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
- struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
- int copya, copyb;
-
- if (a->offset < b->offset)
- return -1;
- if (a->offset > b->offset)
- return 1;
- copya = (a->type == reloc_class_copy) * 2 + (a->type == reloc_class_plt);
- copyb = (b->type == reloc_class_copy) * 2 + (b->type == reloc_class_plt);
- if (copya < copyb)
- return -1;
- if (copya > copyb)
- return 1;
- if (a->u.rel.r_offset < b->u.rel.r_offset)
- return -1;
- if (a->u.rel.r_offset > b->u.rel.r_offset)
- return 1;
- return 0;
-}
-
-static size_t
-elf_link_sort_relocs (abfd, info, psec)
- bfd *abfd;
- struct bfd_link_info *info;
- asection **psec;
-{
- bfd *dynobj = elf_hash_table (info)->dynobj;
- asection *reldyn, *o;
- boolean rel = false;
- bfd_size_type count, size;
- size_t i, j, ret;
- struct elf_link_sort_rela *rela;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
- if (reldyn == NULL || reldyn->_raw_size == 0)
- {
- reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
- if (reldyn == NULL || reldyn->_raw_size == 0)
- return 0;
- rel = true;
- count = reldyn->_raw_size / sizeof (Elf_External_Rel);
- }
- else
- count = reldyn->_raw_size / sizeof (Elf_External_Rela);
-
- size = 0;
- for (o = dynobj->sections; o != NULL; o = o->next)
- if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
- == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
- && o->output_section == reldyn)
- size += o->_raw_size;
-
- if (size != reldyn->_raw_size)
- return 0;
-
- rela = (struct elf_link_sort_rela *) bfd_zmalloc (sizeof (*rela) * count);
- if (rela == NULL)
- {
- (*info->callbacks->warning)
- (info, _("Not enough memory to sort relocations"), 0, abfd, 0,
- (bfd_vma) 0);
- return 0;
- }
-
- for (o = dynobj->sections; o != NULL; o = o->next)
- if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
- == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
- && o->output_section == reldyn)
- {
- if (rel)
- {
- Elf_External_Rel *erel, *erelend;
- struct elf_link_sort_rela *s;
-
- erel = (Elf_External_Rel *) o->contents;
- erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
- s = rela + o->output_offset / sizeof (Elf_External_Rel);
- for (; erel < erelend; erel++, s++)
- {
- if (bed->s->swap_reloc_in)
- (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, &s->u.rel);
- else
- elf_swap_reloc_in (abfd, erel, &s->u.rel);
-
- s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
- }
- }
- else
- {
- Elf_External_Rela *erela, *erelaend;
- struct elf_link_sort_rela *s;
-
- erela = (Elf_External_Rela *) o->contents;
- erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
- s = rela + o->output_offset / sizeof (Elf_External_Rela);
- for (; erela < erelaend; erela++, s++)
- {
- if (bed->s->swap_reloca_in)
- (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela,
- &s->u.rela);
- else
- elf_swap_reloca_in (dynobj, erela, &s->u.rela);
-
- s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
- }
- }
- }
-
- qsort (rela, (size_t) count, sizeof (*rela), elf_link_sort_cmp1);
- for (ret = 0; ret < count && rela[ret].type == reloc_class_relative; ret++)
- ;
- for (i = ret, j = ret; i < count; i++)
- {
- if (ELF_R_SYM (rela[i].u.rel.r_info) != ELF_R_SYM (rela[j].u.rel.r_info))
- j = i;
- rela[i].offset = rela[j].u.rel.r_offset;
- }
- qsort (rela + ret, (size_t) count - ret, sizeof (*rela), elf_link_sort_cmp2);
-
- for (o = dynobj->sections; o != NULL; o = o->next)
- if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
- == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
- && o->output_section == reldyn)
- {
- if (rel)
- {
- Elf_External_Rel *erel, *erelend;
- struct elf_link_sort_rela *s;
-
- erel = (Elf_External_Rel *) o->contents;
- erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
- s = rela + o->output_offset / sizeof (Elf_External_Rel);
- for (; erel < erelend; erel++, s++)
- {
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (abfd, &s->u.rel,
- (bfd_byte *) erel);
- else
- elf_swap_reloc_out (abfd, &s->u.rel, erel);
- }
- }
- else
- {
- Elf_External_Rela *erela, *erelaend;
- struct elf_link_sort_rela *s;
-
- erela = (Elf_External_Rela *) o->contents;
- erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
- s = rela + o->output_offset / sizeof (Elf_External_Rela);
- for (; erela < erelaend; erela++, s++)
- {
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (dynobj, &s->u.rela,
- (bfd_byte *) erela);
- else
- elf_swap_reloca_out (dynobj, &s->u.rela, erela);
- }
- }
- }
-
- free (rela);
- *psec = reldyn;
- return ret;
-}
-
-/* Do the final step of an ELF link. */
-
-boolean
-elf_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- boolean dynamic;
- boolean emit_relocs;
- bfd *dynobj;
- struct elf_final_link_info finfo;
- register asection *o;
- register struct bfd_link_order *p;
- register bfd *sub;
- bfd_size_type max_contents_size;
- bfd_size_type max_external_reloc_size;
- bfd_size_type max_internal_reloc_count;
- bfd_size_type max_sym_count;
- bfd_size_type max_sym_shndx_count;
- file_ptr off;
- Elf_Internal_Sym elfsym;
- unsigned int i;
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Shdr *symstrtab_hdr;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- struct elf_outext_info eoinfo;
- boolean merged;
- size_t relativecount = 0;
- asection *reldyn = 0;
- bfd_size_type amt;
-
- if (! is_elf_hash_table (info))
- return false;
-
- if (info->shared)
- abfd->flags |= DYNAMIC;
-
- dynamic = elf_hash_table (info)->dynamic_sections_created;
- dynobj = elf_hash_table (info)->dynobj;
-
- emit_relocs = (info->relocateable
- || info->emitrelocations
- || bed->elf_backend_emit_relocs);
-
- finfo.info = info;
- finfo.output_bfd = abfd;
- finfo.symstrtab = elf_stringtab_init ();
- if (finfo.symstrtab == NULL)
- return false;
-
- if (! dynamic)
- {
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
- }
- else
- {
- finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
- finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
- /* Note that it is OK if symver_sec is NULL. */
- }
-
- finfo.contents = NULL;
- finfo.external_relocs = NULL;
- finfo.internal_relocs = NULL;
- finfo.external_syms = NULL;
- finfo.locsym_shndx = NULL;
- finfo.internal_syms = NULL;
- finfo.indices = NULL;
- finfo.sections = NULL;
- finfo.symbuf = NULL;
- finfo.symshndxbuf = NULL;
- finfo.symbuf_count = 0;
- finfo.first_tls_sec = NULL;
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- if ((o->flags & SEC_THREAD_LOCAL) != 0
- && (o->flags & SEC_LOAD) != 0)
- {
- finfo.first_tls_sec = o;
- break;
- }
-
- /* Count up the number of relocations we will output for each output
- section, so that we know the sizes of the reloc sections. We
- also figure out some maximum sizes. */
- max_contents_size = 0;
- max_external_reloc_size = 0;
- max_internal_reloc_count = 0;
- max_sym_count = 0;
- max_sym_shndx_count = 0;
- merged = false;
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- {
- o->reloc_count = 0;
-
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- ++o->reloc_count;
- else if (p->type == bfd_indirect_link_order)
- {
- asection *sec;
-
- sec = p->u.indirect.section;
-
- /* Mark all sections which are to be included in the
- link. This will normally be every section. We need
- to do this so that we can identify any sections which
- the linker has decided to not include. */
- sec->linker_mark = true;
-
- if (sec->flags & SEC_MERGE)
- merged = true;
-
- if (info->relocateable || info->emitrelocations)
- o->reloc_count += sec->reloc_count;
- else if (bed->elf_backend_count_relocs)
- {
- Elf_Internal_Rela * relocs;
-
- relocs = (NAME(_bfd_elf,link_read_relocs)
- (abfd, sec, (PTR) NULL,
- (Elf_Internal_Rela *) NULL, info->keep_memory));
-
- o->reloc_count
- += (*bed->elf_backend_count_relocs) (sec, relocs);
-
- if (elf_section_data (o)->relocs != relocs)
- free (relocs);
- }
-
- if (sec->_raw_size > max_contents_size)
- max_contents_size = sec->_raw_size;
- if (sec->_cooked_size > max_contents_size)
- max_contents_size = sec->_cooked_size;
-
- /* We are interested in just local symbols, not all
- symbols. */
- if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
- && (sec->owner->flags & DYNAMIC) == 0)
- {
- size_t sym_count;
-
- if (elf_bad_symtab (sec->owner))
- sym_count = (elf_tdata (sec->owner)->symtab_hdr.sh_size
- / sizeof (Elf_External_Sym));
- else
- sym_count = elf_tdata (sec->owner)->symtab_hdr.sh_info;
-
- if (sym_count > max_sym_count)
- max_sym_count = sym_count;
-
- if (sym_count > max_sym_shndx_count
- && elf_symtab_shndx (sec->owner) != 0)
- max_sym_shndx_count = sym_count;
-
- if ((sec->flags & SEC_RELOC) != 0)
- {
- size_t ext_size;
-
- ext_size = elf_section_data (sec)->rel_hdr.sh_size;
- if (ext_size > max_external_reloc_size)
- max_external_reloc_size = ext_size;
- if (sec->reloc_count > max_internal_reloc_count)
- max_internal_reloc_count = sec->reloc_count;
- }
- }
- }
- }
-
- if (o->reloc_count > 0)
- o->flags |= SEC_RELOC;
- else
- {
- /* Explicitly clear the SEC_RELOC flag. The linker tends to
- set it (this is probably a bug) and if it is set
- assign_section_numbers will create a reloc section. */
- o->flags &=~ SEC_RELOC;
- }
-
- /* If the SEC_ALLOC flag is not set, force the section VMA to
- zero. This is done in elf_fake_sections as well, but forcing
- the VMA to 0 here will ensure that relocs against these
- sections are handled correctly. */
- if ((o->flags & SEC_ALLOC) == 0
- && ! o->user_set_vma)
- o->vma = 0;
- }
-
- if (! info->relocateable && merged)
- elf_link_hash_traverse (elf_hash_table (info),
- elf_link_sec_merge_syms, (PTR) abfd);
-
- /* Figure out the file positions for everything but the symbol table
- and the relocs. We set symcount to force assign_section_numbers
- to create a symbol table. */
- bfd_get_symcount (abfd) = info->strip == strip_all ? 0 : 1;
- BFD_ASSERT (! abfd->output_has_begun);
- if (! _bfd_elf_compute_section_file_positions (abfd, info))
- goto error_return;
-
- /* Figure out how many relocations we will have in each section.
- Just using RELOC_COUNT isn't good enough since that doesn't
- maintain a separate value for REL vs. RELA relocations. */
- if (emit_relocs)
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- for (o = sub->sections; o != NULL; o = o->next)
- {
- asection *output_section;
-
- if (! o->linker_mark)
- {
- /* This section was omitted from the link. */
- continue;
- }
-
- output_section = o->output_section;
-
- if (output_section != NULL
- && (o->flags & SEC_RELOC) != 0)
- {
- struct bfd_elf_section_data *esdi
- = elf_section_data (o);
- struct bfd_elf_section_data *esdo
- = elf_section_data (output_section);
- unsigned int *rel_count;
- unsigned int *rel_count2;
- bfd_size_type entsize;
- bfd_size_type entsize2;
-
- /* We must be careful to add the relocations from the
- input section to the right output count. */
- entsize = esdi->rel_hdr.sh_entsize;
- entsize2 = esdi->rel_hdr2 ? esdi->rel_hdr2->sh_entsize : 0;
- BFD_ASSERT ((entsize == sizeof (Elf_External_Rel)
- || entsize == sizeof (Elf_External_Rela))
- && entsize2 != entsize
- && (entsize2 == 0
- || entsize2 == sizeof (Elf_External_Rel)
- || entsize2 == sizeof (Elf_External_Rela)));
- if (entsize == esdo->rel_hdr.sh_entsize)
- {
- rel_count = &esdo->rel_count;
- rel_count2 = &esdo->rel_count2;
- }
- else
- {
- rel_count = &esdo->rel_count2;
- rel_count2 = &esdo->rel_count;
- }
-
- *rel_count += NUM_SHDR_ENTRIES (& esdi->rel_hdr);
- if (esdi->rel_hdr2)
- *rel_count2 += NUM_SHDR_ENTRIES (esdi->rel_hdr2);
- output_section->flags |= SEC_RELOC;
- }
- }
-
- /* That created the reloc sections. Set their sizes, and assign
- them file positions, and allocate some buffers. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) != 0)
- {
- if (!elf_link_size_reloc_section (abfd,
- &elf_section_data (o)->rel_hdr,
- o))
- goto error_return;
-
- if (elf_section_data (o)->rel_hdr2
- && !elf_link_size_reloc_section (abfd,
- elf_section_data (o)->rel_hdr2,
- o))
- goto error_return;
- }
-
- /* Now, reset REL_COUNT and REL_COUNT2 so that we can use them
- to count upwards while actually outputting the relocations. */
- elf_section_data (o)->rel_count = 0;
- elf_section_data (o)->rel_count2 = 0;
- }
-
- _bfd_elf_assign_file_positions_for_relocs (abfd);
-
- /* We have now assigned file positions for all the sections except
- .symtab and .strtab. We start the .symtab section at the current
- file position, and write directly to it. We build the .strtab
- section in memory. */
- bfd_get_symcount (abfd) = 0;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- /* sh_name is set in prep_headers. */
- symtab_hdr->sh_type = SHT_SYMTAB;
- symtab_hdr->sh_flags = 0;
- symtab_hdr->sh_addr = 0;
- symtab_hdr->sh_size = 0;
- symtab_hdr->sh_entsize = sizeof (Elf_External_Sym);
- /* sh_link is set in assign_section_numbers. */
- /* sh_info is set below. */
- /* sh_offset is set just below. */
- symtab_hdr->sh_addralign = bed->s->file_align;
-
- off = elf_tdata (abfd)->next_file_pos;
- off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, true);
-
- /* Note that at this point elf_tdata (abfd)->next_file_pos is
- incorrect. We do not yet know the size of the .symtab section.
- We correct next_file_pos below, after we do know the size. */
-
- /* Allocate a buffer to hold swapped out symbols. This is to avoid
- continuously seeking to the right position in the file. */
- if (! info->keep_memory || max_sym_count < 20)
- finfo.symbuf_size = 20;
- else
- finfo.symbuf_size = max_sym_count;
- amt = finfo.symbuf_size;
- amt *= sizeof (Elf_External_Sym);
- finfo.symbuf = (Elf_External_Sym *) bfd_malloc (amt);
- if (finfo.symbuf == NULL)
- goto error_return;
- if (elf_numsections (abfd) > SHN_LORESERVE)
- {
- amt = finfo.symbuf_size;
- amt *= sizeof (Elf_External_Sym_Shndx);
- finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
- if (finfo.symshndxbuf == NULL)
- goto error_return;
- }
-
- /* Start writing out the symbol table. The first symbol is always a
- dummy symbol. */
- if (info->strip != strip_all
- || emit_relocs)
- {
- elfsym.st_value = 0;
- elfsym.st_size = 0;
- elfsym.st_info = 0;
- elfsym.st_other = 0;
- elfsym.st_shndx = SHN_UNDEF;
- if (! elf_link_output_sym (&finfo, (const char *) NULL,
- &elfsym, bfd_und_section_ptr))
- goto error_return;
- }
-
-#if 0
- /* Some standard ELF linkers do this, but we don't because it causes
- bootstrap comparison failures. */
- /* Output a file symbol for the output file as the second symbol.
- We output this even if we are discarding local symbols, although
- I'm not sure if this is correct. */
- elfsym.st_value = 0;
- elfsym.st_size = 0;
- elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
- elfsym.st_other = 0;
- elfsym.st_shndx = SHN_ABS;
- if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd),
- &elfsym, bfd_abs_section_ptr))
- goto error_return;
-#endif
-
- /* Output a symbol for each section. We output these even if we are
- discarding local symbols, since they are used for relocs. These
- symbols have no names. We store the index of each one in the
- index field of the section, so that we can find it again when
- outputting relocs. */
- if (info->strip != strip_all
- || emit_relocs)
- {
- elfsym.st_size = 0;
- elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
- elfsym.st_other = 0;
- for (i = 1; i < elf_numsections (abfd); i++)
- {
- o = section_from_elf_index (abfd, i);
- if (o != NULL)
- o->target_index = bfd_get_symcount (abfd);
- elfsym.st_shndx = i;
- if (info->relocateable || o == NULL)
- elfsym.st_value = 0;
- else
- elfsym.st_value = o->vma;
- if (! elf_link_output_sym (&finfo, (const char *) NULL,
- &elfsym, o))
- goto error_return;
- if (i == SHN_LORESERVE)
- i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- }
-
- /* Allocate some memory to hold information read in from the input
- files. */
- if (max_contents_size != 0)
- {
- finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
- if (finfo.contents == NULL)
- goto error_return;
- }
-
- if (max_external_reloc_size != 0)
- {
- finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size);
- if (finfo.external_relocs == NULL)
- goto error_return;
- }
-
- if (max_internal_reloc_count != 0)
- {
- amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
- amt *= sizeof (Elf_Internal_Rela);
- finfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
- if (finfo.internal_relocs == NULL)
- goto error_return;
- }
-
- if (max_sym_count != 0)
- {
- amt = max_sym_count * sizeof (Elf_External_Sym);
- finfo.external_syms = (Elf_External_Sym *) bfd_malloc (amt);
- if (finfo.external_syms == NULL)
- goto error_return;
-
- amt = max_sym_count * sizeof (Elf_Internal_Sym);
- finfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt);
- if (finfo.internal_syms == NULL)
- goto error_return;
-
- amt = max_sym_count * sizeof (long);
- finfo.indices = (long *) bfd_malloc (amt);
- if (finfo.indices == NULL)
- goto error_return;
-
- amt = max_sym_count * sizeof (asection *);
- finfo.sections = (asection **) bfd_malloc (amt);
- if (finfo.sections == NULL)
- goto error_return;
- }
-
- if (max_sym_shndx_count != 0)
- {
- amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
- finfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
- if (finfo.locsym_shndx == NULL)
- goto error_return;
- }
-
- if (finfo.first_tls_sec)
- {
- unsigned int align = 0;
- bfd_vma base = finfo.first_tls_sec->vma, end = 0;
- asection *sec;
-
- for (sec = finfo.first_tls_sec;
- sec && (sec->flags & SEC_THREAD_LOCAL);
- sec = sec->next)
- {
- bfd_vma size = sec->_raw_size;
-
- if (bfd_get_section_alignment (abfd, sec) > align)
- align = bfd_get_section_alignment (abfd, sec);
- if (sec->_raw_size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0)
- {
- struct bfd_link_order *o;
-
- size = 0;
- for (o = sec->link_order_head; o != NULL; o = o->next)
- if (size < o->offset + o->size)
- size = o->offset + o->size;
- }
- end = sec->vma + size;
- }
- elf_hash_table (info)->tls_segment
- = bfd_zalloc (abfd, sizeof (struct elf_link_tls_segment));
- if (elf_hash_table (info)->tls_segment == NULL)
- goto error_return;
- elf_hash_table (info)->tls_segment->start = base;
- elf_hash_table (info)->tls_segment->size = end - base;
- elf_hash_table (info)->tls_segment->align = align;
- }
-
- /* Since ELF permits relocations to be against local symbols, we
- must have the local symbols available when we do the relocations.
- Since we would rather only read the local symbols once, and we
- would rather not keep them in memory, we handle all the
- relocations for a single input file at the same time.
-
- Unfortunately, there is no way to know the total number of local
- symbols until we have seen all of them, and the local symbol
- indices precede the global symbol indices. This means that when
- we are generating relocateable output, and we see a reloc against
- a global symbol, we can not know the symbol index until we have
- finished examining all the local symbols to see which ones we are
- going to output. To deal with this, we keep the relocations in
- memory, and don't output them until the end of the link. This is
- an unfortunate waste of memory, but I don't see a good way around
- it. Fortunately, it only happens when performing a relocateable
- link, which is not the common case. FIXME: If keep_memory is set
- we could write the relocs out and then read them again; I don't
- know how bad the memory loss will be. */
-
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- sub->output_has_begun = false;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order
- && (bfd_get_flavour ((sub = p->u.indirect.section->owner))
- == bfd_target_elf_flavour)
- && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass)
- {
- if (! sub->output_has_begun)
- {
- if (! elf_link_input_bfd (&finfo, sub))
- goto error_return;
- sub->output_has_begun = true;
- }
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- if (! elf_reloc_link_order (abfd, info, o, p))
- goto error_return;
- }
- else
- {
- if (! _bfd_default_link_order (abfd, info, o, p))
- goto error_return;
- }
- }
- }
-
- /* Output any global symbols that got converted to local in a
- version script or due to symbol visibility. We do this in a
- separate step since ELF requires all local symbols to appear
- prior to any global symbols. FIXME: We should only do this if
- some global symbols were, in fact, converted to become local.
- FIXME: Will this work correctly with the Irix 5 linker? */
- eoinfo.failed = false;
- eoinfo.finfo = &finfo;
- eoinfo.localsyms = true;
- elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- (PTR) &eoinfo);
- if (eoinfo.failed)
- return false;
-
- /* That wrote out all the local symbols. Finish up the symbol table
- with the global symbols. Even if we want to strip everything we
- can, we still need to deal with those global symbols that got
- converted to local in a version script. */
-
- /* The sh_info field records the index of the first non local symbol. */
- symtab_hdr->sh_info = bfd_get_symcount (abfd);
-
- if (dynamic
- && finfo.dynsym_sec->output_section != bfd_abs_section_ptr)
- {
- Elf_Internal_Sym sym;
- Elf_External_Sym *dynsym =
- (Elf_External_Sym *) finfo.dynsym_sec->contents;
- long last_local = 0;
-
- /* Write out the section symbols for the output sections. */
- if (info->shared)
- {
- asection *s;
-
- sym.st_size = 0;
- sym.st_name = 0;
- sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
- sym.st_other = 0;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- int indx;
- Elf_External_Sym *dest;
-
- indx = elf_section_data (s)->this_idx;
- BFD_ASSERT (indx > 0);
- sym.st_shndx = indx;
- sym.st_value = s->vma;
- dest = dynsym + elf_section_data (s)->dynindx;
- elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
- }
-
- last_local = bfd_count_sections (abfd);
- }
-
- /* Write out the local dynsyms. */
- if (elf_hash_table (info)->dynlocal)
- {
- struct elf_link_local_dynamic_entry *e;
- for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
- {
- asection *s;
- Elf_External_Sym *dest;
-
- sym.st_size = e->isym.st_size;
- sym.st_other = e->isym.st_other;
-
- /* Copy the internal symbol as is.
- Note that we saved a word of storage and overwrote
- the original st_name with the dynstr_index. */
- sym = e->isym;
-
- if (e->isym.st_shndx != SHN_UNDEF
- && (e->isym.st_shndx < SHN_LORESERVE
- || e->isym.st_shndx > SHN_HIRESERVE))
- {
- s = bfd_section_from_elf_index (e->input_bfd,
- e->isym.st_shndx);
-
- sym.st_shndx =
- elf_section_data (s->output_section)->this_idx;
- sym.st_value = (s->output_section->vma
- + s->output_offset
- + e->isym.st_value);
- }
-
- if (last_local < e->dynindx)
- last_local = e->dynindx;
-
- dest = dynsym + e->dynindx;
- elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
- }
- }
-
- elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info =
- last_local + 1;
- }
-
- /* We get the global symbols from the hash table. */
- eoinfo.failed = false;
- eoinfo.localsyms = false;
- eoinfo.finfo = &finfo;
- elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- (PTR) &eoinfo);
- if (eoinfo.failed)
- return false;
-
- /* If backend needs to output some symbols not present in the hash
- table, do it now. */
- if (bed->elf_backend_output_arch_syms)
- {
- typedef boolean (*out_sym_func) PARAMS ((PTR, const char *,
- Elf_Internal_Sym *,
- asection *));
-
- if (! ((*bed->elf_backend_output_arch_syms)
- (abfd, info, (PTR) &finfo, (out_sym_func) elf_link_output_sym)))
- return false;
- }
-
- /* Flush all symbols to the file. */
- if (! elf_link_flush_output_syms (&finfo))
- return false;
-
- /* Now we know the size of the symtab section. */
- off += symtab_hdr->sh_size;
-
- /* Finish up and write out the symbol string table (.strtab)
- section. */
- symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
- /* sh_name was set in prep_headers. */
- symstrtab_hdr->sh_type = SHT_STRTAB;
- symstrtab_hdr->sh_flags = 0;
- symstrtab_hdr->sh_addr = 0;
- symstrtab_hdr->sh_size = _bfd_stringtab_size (finfo.symstrtab);
- symstrtab_hdr->sh_entsize = 0;
- symstrtab_hdr->sh_link = 0;
- symstrtab_hdr->sh_info = 0;
- /* sh_offset is set just below. */
- symstrtab_hdr->sh_addralign = 1;
-
- off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, true);
- elf_tdata (abfd)->next_file_pos = off;
-
- if (bfd_get_symcount (abfd) > 0)
- {
- if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
- || ! _bfd_stringtab_emit (abfd, finfo.symstrtab))
- return false;
- }
-
- /* Adjust the relocs to have the correct symbol indices. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) == 0)
- continue;
-
- elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr,
- elf_section_data (o)->rel_count,
- elf_section_data (o)->rel_hashes);
- if (elf_section_data (o)->rel_hdr2 != NULL)
- elf_link_adjust_relocs (abfd, elf_section_data (o)->rel_hdr2,
- elf_section_data (o)->rel_count2,
- (elf_section_data (o)->rel_hashes
- + elf_section_data (o)->rel_count));
-
- /* Set the reloc_count field to 0 to prevent write_relocs from
- trying to swap the relocs out itself. */
- o->reloc_count = 0;
- }
-
- if (dynamic && info->combreloc && dynobj != NULL)
- relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
-
- /* If we are linking against a dynamic object, or generating a
- shared library, finish up the dynamic linking information. */
- if (dynamic)
- {
- Elf_External_Dyn *dyncon, *dynconend;
-
- /* Fix up .dynamic entries. */
- o = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (o != NULL);
-
- dyncon = (Elf_External_Dyn *) o->contents;
- dynconend = (Elf_External_Dyn *) (o->contents + o->_raw_size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- unsigned int type;
-
- elf_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- default:
- break;
- case DT_NULL:
- if (relativecount > 0 && dyncon + 1 < dynconend)
- {
- switch (elf_section_data (reldyn)->this_hdr.sh_type)
- {
- case SHT_REL: dyn.d_tag = DT_RELCOUNT; break;
- case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break;
- default: break;
- }
- if (dyn.d_tag != DT_NULL)
- {
- dyn.d_un.d_val = relativecount;
- elf_swap_dyn_out (dynobj, &dyn, dyncon);
- relativecount = 0;
- }
- }
- break;
- case DT_INIT:
- name = info->init_function;
- goto get_sym;
- case DT_FINI:
- name = info->fini_function;
- get_sym:
- {
- struct elf_link_hash_entry *h;
-
- h = elf_link_hash_lookup (elf_hash_table (info), name,
- false, false, true);
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- dyn.d_un.d_val = h->root.u.def.value;
- o = h->root.u.def.section;
- if (o->output_section != NULL)
- dyn.d_un.d_val += (o->output_section->vma
- + o->output_offset);
- else
- {
- /* The symbol is imported from another shared
- library and does not apply to this one. */
- dyn.d_un.d_val = 0;
- }
-
- elf_swap_dyn_out (dynobj, &dyn, dyncon);
- }
- }
- break;
-
- case DT_PREINIT_ARRAYSZ:
- name = ".preinit_array";
- goto get_size;
- case DT_INIT_ARRAYSZ:
- name = ".init_array";
- goto get_size;
- case DT_FINI_ARRAYSZ:
- name = ".fini_array";
- get_size:
- o = bfd_get_section_by_name (abfd, name);
- if (o == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: could not find output section %s"),
- bfd_get_filename (abfd), name);
- goto error_return;
- }
- if (o->_raw_size == 0)
- (*_bfd_error_handler)
- (_("warning: %s section has zero size"), name);
- dyn.d_un.d_val = o->_raw_size;
- elf_swap_dyn_out (dynobj, &dyn, dyncon);
- break;
-
- case DT_PREINIT_ARRAY:
- name = ".preinit_array";
- goto get_vma;
- case DT_INIT_ARRAY:
- name = ".init_array";
- goto get_vma;
- case DT_FINI_ARRAY:
- name = ".fini_array";
- goto get_vma;
-
- case DT_HASH:
- name = ".hash";
- goto get_vma;
- case DT_STRTAB:
- name = ".dynstr";
- goto get_vma;
- case DT_SYMTAB:
- name = ".dynsym";
- goto get_vma;
- case DT_VERDEF:
- name = ".gnu.version_d";
- goto get_vma;
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
- o = bfd_get_section_by_name (abfd, name);
- if (o == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: could not find output section %s"),
- bfd_get_filename (abfd), name);
- goto error_return;
- }
- dyn.d_un.d_ptr = o->vma;
- elf_swap_dyn_out (dynobj, &dyn, dyncon);
- break;
-
- case DT_REL:
- case DT_RELA:
- case DT_RELSZ:
- case DT_RELASZ:
- if (dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ)
- type = SHT_REL;
- else
- type = SHT_RELA;
- dyn.d_un.d_val = 0;
- for (i = 1; i < elf_numsections (abfd); i++)
- {
- Elf_Internal_Shdr *hdr;
-
- hdr = elf_elfsections (abfd)[i];
- if (hdr->sh_type == type
- && (hdr->sh_flags & SHF_ALLOC) != 0)
- {
- if (dyn.d_tag == DT_RELSZ || dyn.d_tag == DT_RELASZ)
- dyn.d_un.d_val += hdr->sh_size;
- else
- {
- if (dyn.d_un.d_val == 0
- || hdr->sh_addr < dyn.d_un.d_val)
- dyn.d_un.d_val = hdr->sh_addr;
- }
- }
- }
- elf_swap_dyn_out (dynobj, &dyn, dyncon);
- break;
- }
- }
- }
-
- /* If we have created any dynamic sections, then output them. */
- if (dynobj != NULL)
- {
- if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info))
- goto error_return;
-
- for (o = dynobj->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_HAS_CONTENTS) == 0
- || o->_raw_size == 0
- || o->output_section == bfd_abs_section_ptr)
- continue;
- if ((o->flags & SEC_LINKER_CREATED) == 0)
- {
- /* At this point, we are only interested in sections
- created by elf_link_create_dynamic_sections. */
- continue;
- }
- if ((elf_section_data (o->output_section)->this_hdr.sh_type
- != SHT_STRTAB)
- || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
- {
- if (! bfd_set_section_contents (abfd, o->output_section,
- o->contents,
- (file_ptr) o->output_offset,
- o->_raw_size))
- goto error_return;
- }
- else
- {
- /* The contents of the .dynstr section are actually in a
- stringtab. */
- off = elf_section_data (o->output_section)->this_hdr.sh_offset;
- if (bfd_seek (abfd, off, SEEK_SET) != 0
- || ! _bfd_elf_strtab_emit (abfd,
- elf_hash_table (info)->dynstr))
- goto error_return;
- }
- }
- }
-
- if (info->relocateable)
- {
- boolean failed = false;
-
- bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
- if (failed)
- goto error_return;
- }
-
- /* If we have optimized stabs strings, output them. */
- if (elf_hash_table (info)->stab_info != NULL)
- {
- if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info))
- goto error_return;
- }
-
- if (info->eh_frame_hdr && elf_hash_table (info)->dynobj)
- {
- o = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
- ".eh_frame_hdr");
- if (o
- && (elf_section_data (o)->sec_info_type
- == ELF_INFO_TYPE_EH_FRAME_HDR))
- {
- if (! _bfd_elf_write_section_eh_frame_hdr (abfd, o))
- goto error_return;
- }
- }
-
- if (finfo.symstrtab != NULL)
- _bfd_stringtab_free (finfo.symstrtab);
- if (finfo.contents != NULL)
- free (finfo.contents);
- if (finfo.external_relocs != NULL)
- free (finfo.external_relocs);
- if (finfo.internal_relocs != NULL)
- free (finfo.internal_relocs);
- if (finfo.external_syms != NULL)
- free (finfo.external_syms);
- if (finfo.locsym_shndx != NULL)
- free (finfo.locsym_shndx);
- if (finfo.internal_syms != NULL)
- free (finfo.internal_syms);
- if (finfo.indices != NULL)
- free (finfo.indices);
- if (finfo.sections != NULL)
- free (finfo.sections);
- if (finfo.symbuf != NULL)
- free (finfo.symbuf);
- if (finfo.symshndxbuf != NULL)
- free (finfo.symbuf);
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) != 0
- && elf_section_data (o)->rel_hashes != NULL)
- free (elf_section_data (o)->rel_hashes);
- }
-
- elf_tdata (abfd)->linker = true;
-
- return true;
-
- error_return:
- if (finfo.symstrtab != NULL)
- _bfd_stringtab_free (finfo.symstrtab);
- if (finfo.contents != NULL)
- free (finfo.contents);
- if (finfo.external_relocs != NULL)
- free (finfo.external_relocs);
- if (finfo.internal_relocs != NULL)
- free (finfo.internal_relocs);
- if (finfo.external_syms != NULL)
- free (finfo.external_syms);
- if (finfo.locsym_shndx != NULL)
- free (finfo.locsym_shndx);
- if (finfo.internal_syms != NULL)
- free (finfo.internal_syms);
- if (finfo.indices != NULL)
- free (finfo.indices);
- if (finfo.sections != NULL)
- free (finfo.sections);
- if (finfo.symbuf != NULL)
- free (finfo.symbuf);
- if (finfo.symshndxbuf != NULL)
- free (finfo.symbuf);
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_RELOC) != 0
- && elf_section_data (o)->rel_hashes != NULL)
- free (elf_section_data (o)->rel_hashes);
- }
-
- return false;
-}
-
-/* Add a symbol to the output symbol table. */
-
-static boolean
-elf_link_output_sym (finfo, name, elfsym, input_sec)
- struct elf_final_link_info *finfo;
- const char *name;
- Elf_Internal_Sym *elfsym;
- asection *input_sec;
-{
- Elf_External_Sym *dest;
- Elf_External_Sym_Shndx *destshndx;
-
- boolean (*output_symbol_hook) PARAMS ((bfd *,
- struct bfd_link_info *info,
- const char *,
- Elf_Internal_Sym *,
- asection *));
-
- output_symbol_hook = get_elf_backend_data (finfo->output_bfd)->
- elf_backend_link_output_symbol_hook;
- if (output_symbol_hook != NULL)
- {
- if (! ((*output_symbol_hook)
- (finfo->output_bfd, finfo->info, name, elfsym, input_sec)))
- return false;
- }
-
- if (name == (const char *) NULL || *name == '\0')
- elfsym->st_name = 0;
- else if (input_sec->flags & SEC_EXCLUDE)
- elfsym->st_name = 0;
- else
- {
- elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
- name, true, false);
- if (elfsym->st_name == (unsigned long) -1)
- return false;
- }
-
- if (finfo->symbuf_count >= finfo->symbuf_size)
- {
- if (! elf_link_flush_output_syms (finfo))
- return false;
- }
-
- dest = finfo->symbuf + finfo->symbuf_count;
- destshndx = finfo->symshndxbuf;
- if (destshndx != NULL)
- destshndx += finfo->symbuf_count;
- elf_swap_symbol_out (finfo->output_bfd, elfsym, (PTR) dest, (PTR) destshndx);
- ++finfo->symbuf_count;
-
- ++ bfd_get_symcount (finfo->output_bfd);
-
- return true;
-}
-
-/* Flush the output symbols to the file. */
-
-static boolean
-elf_link_flush_output_syms (finfo)
- struct elf_final_link_info *finfo;
-{
- if (finfo->symbuf_count > 0)
- {
- Elf_Internal_Shdr *hdr;
- file_ptr pos;
- bfd_size_type amt;
-
- hdr = &elf_tdata (finfo->output_bfd)->symtab_hdr;
- pos = hdr->sh_offset + hdr->sh_size;
- amt = finfo->symbuf_count * sizeof (Elf_External_Sym);
- if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite ((PTR) finfo->symbuf, amt, finfo->output_bfd) != amt)
- return false;
-
- hdr->sh_size += amt;
-
- if (finfo->symshndxbuf != NULL)
- {
- hdr = &elf_tdata (finfo->output_bfd)->symtab_shndx_hdr;
- pos = hdr->sh_offset + hdr->sh_size;
- amt = finfo->symbuf_count * sizeof (Elf_External_Sym_Shndx);
- if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) finfo->symshndxbuf, amt, finfo->output_bfd)
- != amt))
- return false;
-
- hdr->sh_size += amt;
- }
-
- finfo->symbuf_count = 0;
- }
-
- return true;
-}
-
-/* Adjust all external symbols pointing into SEC_MERGE sections
- to reflect the object merging within the sections. */
-
-static boolean
-elf_link_sec_merge_syms (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- asection *sec;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
- && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
- {
- bfd *output_bfd = (bfd *) data;
-
- h->root.u.def.value =
- _bfd_merged_section_offset (output_bfd,
- &h->root.u.def.section,
- elf_section_data (sec)->sec_info,
- h->root.u.def.value, (bfd_vma) 0);
- }
-
- return true;
-}
-
-/* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in
- allowing an unsatisfied unversioned symbol in the DSO to match a
- versioned symbol that would normally require an explicit version. */
-
-static boolean
-elf_link_check_versioned_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
-{
- bfd *undef_bfd = h->root.u.undef.abfd;
- struct elf_link_loaded_list *loaded;
-
- if ((undef_bfd->flags & DYNAMIC) == 0
- || info->hash->creator->flavour != bfd_target_elf_flavour
- || elf_dt_soname (h->root.u.undef.abfd) == NULL)
- return false;
-
- for (loaded = elf_hash_table (info)->loaded;
- loaded != NULL;
- loaded = loaded->next)
- {
- bfd *input;
- Elf_Internal_Shdr *hdr;
- bfd_size_type symcount;
- bfd_size_type extsymcount;
- bfd_size_type extsymoff;
- Elf_Internal_Shdr *versymhdr;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- Elf_Internal_Sym *isymbuf;
- Elf_External_Versym *ever;
- Elf_External_Versym *extversym;
-
- input = loaded->abfd;
-
- /* We check each DSO for a possible hidden versioned definition. */
- if (input == undef_bfd
- || (input->flags & DYNAMIC) == 0
- || elf_dynversym (input) == 0)
- continue;
-
- hdr = &elf_tdata (input)->dynsymtab_hdr;
-
- symcount = hdr->sh_size / sizeof (Elf_External_Sym);
- if (elf_bad_symtab (input))
- {
- extsymcount = symcount;
- extsymoff = 0;
- }
- else
- {
- extsymcount = symcount - hdr->sh_info;
- extsymoff = hdr->sh_info;
- }
-
- if (extsymcount == 0)
- continue;
-
- isymbuf = bfd_elf_get_elf_syms (input, hdr, extsymcount, extsymoff,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- return false;
-
- /* Read in any version definitions. */
- versymhdr = &elf_tdata (input)->dynversym_hdr;
- extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
- if (extversym == NULL)
- goto error_ret;
-
- if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread ((PTR) extversym, versymhdr->sh_size, input)
- != versymhdr->sh_size))
- {
- free (extversym);
- error_ret:
- free (isymbuf);
- return false;
- }
-
- ever = extversym + extsymoff;
- isymend = isymbuf + extsymcount;
- for (isym = isymbuf; isym < isymend; isym++, ever++)
- {
- const char *name;
- Elf_Internal_Versym iver;
-
- if (ELF_ST_BIND (isym->st_info) == STB_LOCAL
- || isym->st_shndx == SHN_UNDEF)
- continue;
-
- name = bfd_elf_string_from_elf_section (input,
- hdr->sh_link,
- isym->st_name);
- if (strcmp (name, h->root.root.string) != 0)
- continue;
-
- _bfd_elf_swap_versym_in (input, ever, &iver);
-
- if ((iver.vs_vers & VERSYM_HIDDEN) == 0)
- {
- /* If we have a non-hidden versioned sym, then it should
- have provided a definition for the undefined sym. */
- abort ();
- }
-
- if ((iver.vs_vers & VERSYM_VERSION) == 2)
- {
- /* This is the oldest (default) sym. We can use it. */
- free (extversym);
- free (isymbuf);
- return true;
- }
- }
-
- free (extversym);
- free (isymbuf);
- }
-
- return false;
-}
-
-/* Add an external symbol to the symbol table. This is called from
- the hash table traversal routine. When generating a shared object,
- we go through the symbol table twice. The first time we output
- anything that might have been forced to local scope in a version
- script. The second time we output the symbols that are still
- global symbols. */
-
-static boolean
-elf_link_output_extsym (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
- struct elf_final_link_info *finfo = eoinfo->finfo;
- boolean strip;
- Elf_Internal_Sym sym;
- asection *input_sec;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (h->root.type == bfd_link_hash_new)
- return true;
- }
-
- /* Decide whether to output this symbol in this pass. */
- if (eoinfo->localsyms)
- {
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- return true;
- }
- else
- {
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- return true;
- }
-
- /* If we are not creating a shared library, and this symbol is
- referenced by a shared library but is not defined anywhere, then
- warn that it is undefined. If we do not do this, the runtime
- linker will complain that the symbol is undefined when the
- program is run. We don't have to worry about symbols that are
- referenced by regular files, because we will already have issued
- warnings for them. */
- if (! finfo->info->relocateable
- && ! finfo->info->allow_shlib_undefined
- && ! finfo->info->shared
- && h->root.type == bfd_link_hash_undefined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
- && ! elf_link_check_versioned_symbol (finfo->info, h))
- {
- if (! ((*finfo->info->callbacks->undefined_symbol)
- (finfo->info, h->root.root.string, h->root.u.undef.abfd,
- (asection *) NULL, (bfd_vma) 0, true)))
- {
- eoinfo->failed = true;
- return false;
- }
- }
-
- /* We don't want to output symbols that have never been mentioned by
- a regular file, or that we have been told to strip. However, if
- h->indx is set to -2, the symbol is used by a reloc and we must
- output it. */
- if (h->indx == -2)
- strip = false;
- else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
- strip = true;
- else if (finfo->info->strip == strip_all
- || (finfo->info->strip == strip_some
- && bfd_hash_lookup (finfo->info->keep_hash,
- h->root.root.string,
- false, false) == NULL))
- strip = true;
- else
- strip = false;
-
- /* If we're stripping it, and it's not a dynamic symbol, there's
- nothing else to do unless it is a forced local symbol. */
- if (strip
- && h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- return true;
-
- sym.st_value = 0;
- sym.st_size = h->size;
- sym.st_other = h->other;
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type);
- else if (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_defweak)
- sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
- else
- sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type);
-
- switch (h->root.type)
- {
- default:
- case bfd_link_hash_new:
- case bfd_link_hash_warning:
- abort ();
- return false;
-
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- input_sec = bfd_und_section_ptr;
- sym.st_shndx = SHN_UNDEF;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- {
- input_sec = h->root.u.def.section;
- if (input_sec->output_section != NULL)
- {
- sym.st_shndx =
- _bfd_elf_section_from_bfd_section (finfo->output_bfd,
- input_sec->output_section);
- if (sym.st_shndx == SHN_BAD)
- {
- (*_bfd_error_handler)
- (_("%s: could not find output section %s for input section %s"),
- bfd_get_filename (finfo->output_bfd),
- input_sec->output_section->name,
- input_sec->name);
- eoinfo->failed = true;
- return false;
- }
-
- /* ELF symbols in relocateable files are section relative,
- but in nonrelocateable files they are virtual
- addresses. */
- sym.st_value = h->root.u.def.value + input_sec->output_offset;
- if (! finfo->info->relocateable)
- {
- sym.st_value += input_sec->output_section->vma;
- if (h->type == STT_TLS)
- {
- /* STT_TLS symbols are relative to PT_TLS segment
- base. */
- BFD_ASSERT (finfo->first_tls_sec != NULL);
- sym.st_value -= finfo->first_tls_sec->vma;
- }
- }
- }
- else
- {
- BFD_ASSERT (input_sec->owner == NULL
- || (input_sec->owner->flags & DYNAMIC) != 0);
- sym.st_shndx = SHN_UNDEF;
- input_sec = bfd_und_section_ptr;
- }
- }
- break;
-
- case bfd_link_hash_common:
- input_sec = h->root.u.c.p->section;
- sym.st_shndx = SHN_COMMON;
- sym.st_value = 1 << h->root.u.c.p->alignment_power;
- break;
-
- case bfd_link_hash_indirect:
- /* These symbols are created by symbol versioning. They point
- to the decorated version of the name. For example, if the
- symbol foo@@GNU_1.2 is the default, which should be used when
- foo is used with no version, then we add an indirect symbol
- foo which points to foo@@GNU_1.2. We ignore these symbols,
- since the indirected symbol is already in the hash table. */
- return true;
- }
-
- /* Give the processor backend a chance to tweak the symbol value,
- and also to finish up anything that needs to be done for this
- symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for
- forced local syms when non-shared is due to a historical quirk. */
- if ((h->dynindx != -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- && (finfo->info->shared
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
- && elf_hash_table (finfo->info)->dynamic_sections_created)
- {
- struct elf_backend_data *bed;
-
- bed = get_elf_backend_data (finfo->output_bfd);
- if (! ((*bed->elf_backend_finish_dynamic_symbol)
- (finfo->output_bfd, finfo->info, h, &sym)))
- {
- eoinfo->failed = true;
- return false;
- }
- }
-
- /* If we are marking the symbol as undefined, and there are no
- non-weak references to this symbol from a regular object, then
- mark the symbol as weak undefined; if there are non-weak
- references, mark the symbol as strong. We can't do this earlier,
- because it might not be marked as undefined until the
- finish_dynamic_symbol routine gets through with it. */
- if (sym.st_shndx == SHN_UNDEF
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
- && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL
- || ELF_ST_BIND (sym.st_info) == STB_WEAK))
- {
- int bindtype;
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0)
- bindtype = STB_GLOBAL;
- else
- bindtype = STB_WEAK;
- sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
- }
-
- /* If a symbol is not defined locally, we clear the visibility field. */
- if (! finfo->info->relocateable
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- sym.st_other &= ~ ELF_ST_VISIBILITY (-1);
-
- /* If this symbol should be put in the .dynsym section, then put it
- there now. We already know the symbol index. We also fill in
- the entry in the .hash section. */
- if (h->dynindx != -1
- && elf_hash_table (finfo->info)->dynamic_sections_created)
- {
- size_t bucketcount;
- size_t bucket;
- size_t hash_entry_size;
- bfd_byte *bucketpos;
- bfd_vma chain;
- Elf_External_Sym *esym;
-
- sym.st_name = h->dynstr_index;
- esym = (Elf_External_Sym *) finfo->dynsym_sec->contents + h->dynindx;
- elf_swap_symbol_out (finfo->output_bfd, &sym, (PTR) esym, (PTR) 0);
-
- bucketcount = elf_hash_table (finfo->info)->bucketcount;
- bucket = h->elf_hash_value % bucketcount;
- hash_entry_size
- = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
- bucketpos = ((bfd_byte *) finfo->hash_sec->contents
- + (bucket + 2) * hash_entry_size);
- chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, (bfd_vma) h->dynindx,
- bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
- ((bfd_byte *) finfo->hash_sec->contents
- + (bucketcount + 2 + h->dynindx) * hash_entry_size));
-
- if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
- {
- Elf_Internal_Versym iversym;
- Elf_External_Versym *eversym;
-
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- if (h->verinfo.verdef == NULL)
- iversym.vs_vers = 0;
- else
- iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1;
- }
- else
- {
- if (h->verinfo.vertree == NULL)
- iversym.vs_vers = 1;
- else
- iversym.vs_vers = h->verinfo.vertree->vernum + 1;
- }
-
- if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0)
- iversym.vs_vers |= VERSYM_HIDDEN;
-
- eversym = (Elf_External_Versym *) finfo->symver_sec->contents;
- eversym += h->dynindx;
- _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
- }
- }
-
- /* If we're stripping it, then it was just a dynamic symbol, and
- there's nothing else to do. */
- if (strip || (input_sec->flags & SEC_EXCLUDE) != 0)
- return true;
-
- h->indx = bfd_get_symcount (finfo->output_bfd);
-
- if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec))
- {
- eoinfo->failed = true;
- return false;
- }
-
- return true;
-}
-
-/* Copy the relocations indicated by the INTERNAL_RELOCS (which
- originated from the section given by INPUT_REL_HDR) to the
- OUTPUT_BFD. */
-
-static boolean
-elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
- internal_relocs)
- bfd *output_bfd;
- asection *input_section;
- Elf_Internal_Shdr *input_rel_hdr;
- Elf_Internal_Rela *internal_relocs;
-{
- Elf_Internal_Rela *irela;
- Elf_Internal_Rela *irelaend;
- Elf_Internal_Shdr *output_rel_hdr;
- asection *output_section;
- unsigned int *rel_countp = NULL;
- struct elf_backend_data *bed;
- bfd_size_type amt;
-
- output_section = input_section->output_section;
- output_rel_hdr = NULL;
-
- if (elf_section_data (output_section)->rel_hdr.sh_entsize
- == input_rel_hdr->sh_entsize)
- {
- output_rel_hdr = &elf_section_data (output_section)->rel_hdr;
- rel_countp = &elf_section_data (output_section)->rel_count;
- }
- else if (elf_section_data (output_section)->rel_hdr2
- && (elf_section_data (output_section)->rel_hdr2->sh_entsize
- == input_rel_hdr->sh_entsize))
- {
- output_rel_hdr = elf_section_data (output_section)->rel_hdr2;
- rel_countp = &elf_section_data (output_section)->rel_count2;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: relocation size mismatch in %s section %s"),
- bfd_get_filename (output_bfd),
- bfd_archive_filename (input_section->owner),
- input_section->name);
- bfd_set_error (bfd_error_wrong_object_format);
- return false;
- }
-
- bed = get_elf_backend_data (output_bfd);
- irela = internal_relocs;
- irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
- * bed->s->int_rels_per_ext_rel);
-
- if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
- {
- Elf_External_Rel *erel;
- Elf_Internal_Rel *irel;
-
- amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
- irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
- if (irel == NULL)
- {
- (*_bfd_error_handler) (_("Error: out of memory"));
- abort ();
- }
-
- erel = ((Elf_External_Rel *) output_rel_hdr->contents + *rel_countp);
- for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++)
- {
- unsigned int i;
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- {
- irel[i].r_offset = irela[i].r_offset;
- irel[i].r_info = irela[i].r_info;
- BFD_ASSERT (irela[i].r_addend == 0);
- }
-
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (output_bfd, irel, (PTR) erel);
- else
- elf_swap_reloc_out (output_bfd, irel, erel);
- }
-
- free (irel);
- }
- else
- {
- Elf_External_Rela *erela;
-
- BFD_ASSERT (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela));
-
- erela = ((Elf_External_Rela *) output_rel_hdr->contents + *rel_countp);
- for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erela++)
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (output_bfd, irela, (PTR) erela);
- else
- elf_swap_reloca_out (output_bfd, irela, erela);
- }
-
- /* Bump the counter, so that we know where to add the next set of
- relocations. */
- *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr);
-
- return true;
-}
-
-/* Link an input file into the linker output file. This function
- handles all the sections and relocations of the input file at once.
- This is so that we only have to read the local symbols once, and
- don't have to keep them in memory. */
-
-static boolean
-elf_link_input_bfd (finfo, input_bfd)
- struct elf_final_link_info *finfo;
- bfd *input_bfd;
-{
- boolean (*relocate_section) PARAMS ((bfd *, struct bfd_link_info *,
- bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *,
- Elf_Internal_Sym *, asection **));
- bfd *output_bfd;
- Elf_Internal_Shdr *symtab_hdr;
- size_t locsymcount;
- size_t extsymoff;
- Elf_Internal_Sym *isymbuf;
- Elf_Internal_Sym *isym;
- Elf_Internal_Sym *isymend;
- long *pindex;
- asection **ppsection;
- asection *o;
- struct elf_backend_data *bed;
- boolean emit_relocs;
- struct elf_link_hash_entry **sym_hashes;
-
- output_bfd = finfo->output_bfd;
- bed = get_elf_backend_data (output_bfd);
- relocate_section = bed->elf_backend_relocate_section;
-
- /* If this is a dynamic object, we don't want to do anything here:
- we don't want the local symbols, and we don't want the section
- contents. */
- if ((input_bfd->flags & DYNAMIC) != 0)
- return true;
-
- emit_relocs = (finfo->info->relocateable
- || finfo->info->emitrelocations
- || bed->elf_backend_emit_relocs);
-
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- if (elf_bad_symtab (input_bfd))
- {
- locsymcount = symtab_hdr->sh_size / sizeof (Elf_External_Sym);
- extsymoff = 0;
- }
- else
- {
- locsymcount = symtab_hdr->sh_info;
- extsymoff = symtab_hdr->sh_info;
- }
-
- /* Read the local symbols. */
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL && locsymcount != 0)
- {
- isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
- finfo->internal_syms,
- finfo->external_syms,
- finfo->locsym_shndx);
- if (isymbuf == NULL)
- return false;
- }
-
- /* Find local symbol sections and adjust values of symbols in
- SEC_MERGE sections. Write out those local symbols we know are
- going into the output file. */
- isymend = isymbuf + locsymcount;
- for (isym = isymbuf, pindex = finfo->indices, ppsection = finfo->sections;
- isym < isymend;
- isym++, pindex++, ppsection++)
- {
- asection *isec;
- const char *name;
- Elf_Internal_Sym osym;
-
- *pindex = -1;
-
- if (elf_bad_symtab (input_bfd))
- {
- if (ELF_ST_BIND (isym->st_info) != STB_LOCAL)
- {
- *ppsection = NULL;
- continue;
- }
- }
-
- if (isym->st_shndx == SHN_UNDEF)
- isec = bfd_und_section_ptr;
- else if (isym->st_shndx < SHN_LORESERVE
- || isym->st_shndx > SHN_HIRESERVE)
- {
- isec = section_from_elf_index (input_bfd, isym->st_shndx);
- if (isec
- && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
- && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
- isym->st_value =
- _bfd_merged_section_offset (output_bfd, &isec,
- elf_section_data (isec)->sec_info,
- isym->st_value, (bfd_vma) 0);
- }
- else if (isym->st_shndx == SHN_ABS)
- isec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- isec = bfd_com_section_ptr;
- else
- {
- /* Who knows? */
- isec = NULL;
- }
-
- *ppsection = isec;
-
- /* Don't output the first, undefined, symbol. */
- if (ppsection == finfo->sections)
- continue;
-
- if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
- {
- /* We never output section symbols. Instead, we use the
- section symbol of the corresponding section in the output
- file. */
- continue;
- }
-
- /* If we are stripping all symbols, we don't want to output this
- one. */
- if (finfo->info->strip == strip_all)
- continue;
-
- /* If we are discarding all local symbols, we don't want to
- output this one. If we are generating a relocateable output
- file, then some of the local symbols may be required by
- relocs; we output them below as we discover that they are
- needed. */
- if (finfo->info->discard == discard_all)
- continue;
-
- /* If this symbol is defined in a section which we are
- discarding, we don't need to keep it, but note that
- linker_mark is only reliable for sections that have contents.
- For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
- as well as linker_mark. */
- if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
- && isec != NULL
- && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
- || (! finfo->info->relocateable
- && (isec->flags & SEC_EXCLUDE) != 0)))
- continue;
-
- /* Get the name of the symbol. */
- name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
- isym->st_name);
- if (name == NULL)
- return false;
-
- /* See if we are discarding symbols with this name. */
- if ((finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)
- == NULL))
- || (((finfo->info->discard == discard_sec_merge
- && (isec->flags & SEC_MERGE) && ! finfo->info->relocateable)
- || finfo->info->discard == discard_l)
- && bfd_is_local_label_name (input_bfd, name)))
- continue;
-
- /* If we get here, we are going to output this symbol. */
-
- osym = *isym;
-
- /* Adjust the section index for the output file. */
- osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
- isec->output_section);
- if (osym.st_shndx == SHN_BAD)
- return false;
-
- *pindex = bfd_get_symcount (output_bfd);
-
- /* ELF symbols in relocateable files are section relative, but
- in executable files they are virtual addresses. Note that
- this code assumes that all ELF sections have an associated
- BFD section with a reasonable value for output_offset; below
- we assume that they also have a reasonable value for
- output_section. Any special sections must be set up to meet
- these requirements. */
- osym.st_value += isec->output_offset;
- if (! finfo->info->relocateable)
- {
- osym.st_value += isec->output_section->vma;
- if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
- {
- /* STT_TLS symbols are relative to PT_TLS segment base. */
- BFD_ASSERT (finfo->first_tls_sec != NULL);
- osym.st_value -= finfo->first_tls_sec->vma;
- }
- }
-
- if (! elf_link_output_sym (finfo, name, &osym, isec))
- return false;
- }
-
- /* Relocate the contents of each section. */
- sym_hashes = elf_sym_hashes (input_bfd);
- for (o = input_bfd->sections; o != NULL; o = o->next)
- {
- bfd_byte *contents;
-
- if (! o->linker_mark)
- {
- /* This section was omitted from the link. */
- continue;
- }
-
- if ((o->flags & SEC_HAS_CONTENTS) == 0
- || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
- continue;
-
- if ((o->flags & SEC_LINKER_CREATED) != 0)
- {
- /* Section was created by elf_link_create_dynamic_sections
- or somesuch. */
- continue;
- }
-
- /* Get the contents of the section. They have been cached by a
- relaxation routine. Note that o is a section in an input
- file, so the contents field will not have been set by any of
- the routines which work on output files. */
- if (elf_section_data (o)->this_hdr.contents != NULL)
- contents = elf_section_data (o)->this_hdr.contents;
- else
- {
- contents = finfo->contents;
- if (! bfd_get_section_contents (input_bfd, o, contents,
- (file_ptr) 0, o->_raw_size))
- return false;
- }
-
- if ((o->flags & SEC_RELOC) != 0)
- {
- Elf_Internal_Rela *internal_relocs;
-
- /* Get the swapped relocs. */
- internal_relocs = (NAME(_bfd_elf,link_read_relocs)
- (input_bfd, o, finfo->external_relocs,
- finfo->internal_relocs, false));
- if (internal_relocs == NULL
- && o->reloc_count > 0)
- return false;
-
- /* Run through the relocs looking for any against symbols
- from discarded sections and section symbols from
- removed link-once sections. Complain about relocs
- against discarded sections. Zero relocs against removed
- link-once sections. We should really complain if
- anything in the final link tries to use it, but
- DWARF-based exception handling might have an entry in
- .eh_frame to describe a routine in the linkonce section,
- and it turns out to be hard to remove the .eh_frame
- entry too. FIXME. */
- if (!finfo->info->relocateable
- && !elf_section_ignore_discarded_relocs (o))
- {
- Elf_Internal_Rela *rel, *relend;
-
- rel = internal_relocs;
- relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
- for ( ; rel < relend; rel++)
- {
- unsigned long r_symndx = ELF_R_SYM (rel->r_info);
-
- if (r_symndx >= locsymcount
- || (elf_bad_symtab (input_bfd)
- && finfo->sections[r_symndx] == NULL))
- {
- struct elf_link_hash_entry *h;
-
- h = sym_hashes[r_symndx - extsymoff];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Complain if the definition comes from a
- discarded section. */
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && elf_discarded_section (h->root.u.def.section))
- {
- if ((o->flags & SEC_DEBUGGING) != 0)
- {
- BFD_ASSERT (r_symndx != 0);
- memset (rel, 0, sizeof (*rel));
- }
- else
- {
- if (! ((*finfo->info->callbacks->undefined_symbol)
- (finfo->info, h->root.root.string,
- input_bfd, o, rel->r_offset,
- true)))
- return false;
- }
- }
- }
- else
- {
- asection *sec = finfo->sections[r_symndx];
-
- if (sec != NULL && elf_discarded_section (sec))
- {
- if ((o->flags & SEC_DEBUGGING) != 0
- || (sec->flags & SEC_LINK_ONCE) != 0)
- {
- BFD_ASSERT (r_symndx != 0);
- rel->r_info
- = ELF_R_INFO (0, ELF_R_TYPE (rel->r_info));
- rel->r_addend = 0;
- }
- else
- {
- boolean ok;
- const char *msg
- = _("local symbols in discarded section %s");
- bfd_size_type amt
- = strlen (sec->name) + strlen (msg) - 1;
- char *buf = (char *) bfd_malloc (amt);
-
- if (buf != NULL)
- sprintf (buf, msg, sec->name);
- else
- buf = (char *) sec->name;
- ok = (*finfo->info->callbacks
- ->undefined_symbol) (finfo->info, buf,
- input_bfd, o,
- rel->r_offset,
- true);
- if (buf != sec->name)
- free (buf);
- if (!ok)
- return false;
- }
- }
- }
- }
- }
-
- /* Relocate the section by invoking a back end routine.
-
- The back end routine is responsible for adjusting the
- section contents as necessary, and (if using Rela relocs
- and generating a relocateable output file) adjusting the
- reloc addend as necessary.
-
- The back end routine does not have to worry about setting
- the reloc address or the reloc symbol index.
-
- The back end routine is given a pointer to the swapped in
- internal symbols, and can access the hash table entries
- for the external symbols via elf_sym_hashes (input_bfd).
-
- When generating relocateable output, the back end routine
- must handle STB_LOCAL/STT_SECTION symbols specially. The
- output symbol is going to be a section symbol
- corresponding to the output section, which will require
- the addend to be adjusted. */
-
- if (! (*relocate_section) (output_bfd, finfo->info,
- input_bfd, o, contents,
- internal_relocs,
- isymbuf,
- finfo->sections))
- return false;
-
- if (emit_relocs)
- {
- Elf_Internal_Rela *irela;
- Elf_Internal_Rela *irelaend;
- struct elf_link_hash_entry **rel_hash;
- Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2;
- unsigned int next_erel;
- boolean (*reloc_emitter) PARAMS ((bfd *, asection *,
- Elf_Internal_Shdr *,
- Elf_Internal_Rela *));
- boolean rela_normal;
-
- input_rel_hdr = &elf_section_data (o)->rel_hdr;
- rela_normal = (bed->rela_normal
- && (input_rel_hdr->sh_entsize
- == sizeof (Elf_External_Rela)));
-
- /* Adjust the reloc addresses and symbol indices. */
-
- irela = internal_relocs;
- irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel;
- rel_hash = (elf_section_data (o->output_section)->rel_hashes
- + elf_section_data (o->output_section)->rel_count
- + elf_section_data (o->output_section)->rel_count2);
- for (next_erel = 0; irela < irelaend; irela++, next_erel++)
- {
- unsigned long r_symndx;
- asection *sec;
- Elf_Internal_Sym sym;
-
- if (next_erel == bed->s->int_rels_per_ext_rel)
- {
- rel_hash++;
- next_erel = 0;
- }
-
- irela->r_offset += o->output_offset;
-
- /* Relocs in an executable have to be virtual addresses. */
- if (!finfo->info->relocateable)
- irela->r_offset += o->output_section->vma;
-
- r_symndx = ELF_R_SYM (irela->r_info);
-
- if (r_symndx == 0)
- continue;
-
- if (r_symndx >= locsymcount
- || (elf_bad_symtab (input_bfd)
- && finfo->sections[r_symndx] == NULL))
- {
- struct elf_link_hash_entry *rh;
- unsigned long indx;
-
- /* This is a reloc against a global symbol. We
- have not yet output all the local symbols, so
- we do not know the symbol index of any global
- symbol. We set the rel_hash entry for this
- reloc to point to the global hash table entry
- for this symbol. The symbol index is then
- set at the end of elf_bfd_final_link. */
- indx = r_symndx - extsymoff;
- rh = elf_sym_hashes (input_bfd)[indx];
- while (rh->root.type == bfd_link_hash_indirect
- || rh->root.type == bfd_link_hash_warning)
- rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
-
- /* Setting the index to -2 tells
- elf_link_output_extsym that this symbol is
- used by a reloc. */
- BFD_ASSERT (rh->indx < 0);
- rh->indx = -2;
-
- *rel_hash = rh;
-
- continue;
- }
-
- /* This is a reloc against a local symbol. */
-
- *rel_hash = NULL;
- sym = isymbuf[r_symndx];
- sec = finfo->sections[r_symndx];
- if (ELF_ST_TYPE (sym.st_info) == STT_SECTION)
- {
- /* I suppose the backend ought to fill in the
- section of any STT_SECTION symbol against a
- processor specific section. If we have
- discarded a section, the output_section will
- be the absolute section. */
- if (bfd_is_abs_section (sec)
- || (sec != NULL
- && bfd_is_abs_section (sec->output_section)))
- r_symndx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
- else
- {
- r_symndx = sec->output_section->target_index;
- BFD_ASSERT (r_symndx != 0);
- }
-
- /* Adjust the addend according to where the
- section winds up in the output section. */
- if (rela_normal)
- irela->r_addend += sec->output_offset;
- }
- else
- {
- if (finfo->indices[r_symndx] == -1)
- {
- unsigned long shlink;
- const char *name;
- asection *osec;
-
- if (finfo->info->strip == strip_all)
- {
- /* You can't do ld -r -s. */
- bfd_set_error (bfd_error_invalid_operation);
- return false;
- }
-
- /* This symbol was skipped earlier, but
- since it is needed by a reloc, we
- must output it now. */
- shlink = symtab_hdr->sh_link;
- name = (bfd_elf_string_from_elf_section
- (input_bfd, shlink, sym.st_name));
- if (name == NULL)
- return false;
-
- osec = sec->output_section;
- sym.st_shndx =
- _bfd_elf_section_from_bfd_section (output_bfd,
- osec);
- if (sym.st_shndx == SHN_BAD)
- return false;
-
- sym.st_value += sec->output_offset;
- if (! finfo->info->relocateable)
- {
- sym.st_value += osec->vma;
- if (ELF_ST_TYPE (sym.st_info) == STT_TLS)
- {
- /* STT_TLS symbols are relative to PT_TLS
- segment base. */
- BFD_ASSERT (finfo->first_tls_sec != NULL);
- sym.st_value -= finfo->first_tls_sec->vma;
- }
- }
-
- finfo->indices[r_symndx]
- = bfd_get_symcount (output_bfd);
-
- if (! elf_link_output_sym (finfo, name, &sym, sec))
- return false;
- }
-
- r_symndx = finfo->indices[r_symndx];
- }
-
- irela->r_info = ELF_R_INFO (r_symndx,
- ELF_R_TYPE (irela->r_info));
- }
-
- /* Swap out the relocs. */
- if (bed->elf_backend_emit_relocs
- && !(finfo->info->relocateable
- || finfo->info->emitrelocations))
- reloc_emitter = bed->elf_backend_emit_relocs;
- else
- reloc_emitter = elf_link_output_relocs;
-
- if (input_rel_hdr->sh_size != 0
- && ! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
- internal_relocs))
- return false;
-
- input_rel_hdr2 = elf_section_data (o)->rel_hdr2;
- if (input_rel_hdr2 && input_rel_hdr2->sh_size != 0)
- {
- internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
- * bed->s->int_rels_per_ext_rel);
- if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr2,
- internal_relocs))
- return false;
- }
- }
- }
-
- /* Write out the modified section contents. */
- if (bed->elf_backend_write_section
- && (*bed->elf_backend_write_section) (output_bfd, o, contents))
- {
- /* Section written out. */
- }
- else switch (elf_section_data (o)->sec_info_type)
- {
- case ELF_INFO_TYPE_STABS:
- if (! (_bfd_write_section_stabs
- (output_bfd,
- &elf_hash_table (finfo->info)->stab_info,
- o, &elf_section_data (o)->sec_info, contents)))
- return false;
- break;
- case ELF_INFO_TYPE_MERGE:
- if (! (_bfd_write_merged_section
- (output_bfd, o, elf_section_data (o)->sec_info)))
- return false;
- break;
- case ELF_INFO_TYPE_EH_FRAME:
- {
- asection *ehdrsec;
-
- ehdrsec
- = bfd_get_section_by_name (elf_hash_table (finfo->info)->dynobj,
- ".eh_frame_hdr");
- if (! (_bfd_elf_write_section_eh_frame (output_bfd, o, ehdrsec,
- contents)))
- return false;
- }
- break;
- default:
- {
- bfd_size_type sec_size;
-
- sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size);
- if (! (o->flags & SEC_EXCLUDE)
- && ! bfd_set_section_contents (output_bfd, o->output_section,
- contents,
- (file_ptr) o->output_offset,
- sec_size))
- return false;
- }
- break;
- }
- }
-
- return true;
-}
-
-/* Generate a reloc when linking an ELF file. This is a reloc
- requested by the linker, and does come from any input file. This
- is used to build constructor and destructor tables when linking
- with -Ur. */
-
-static boolean
-elf_reloc_link_order (output_bfd, info, output_section, link_order)
- bfd *output_bfd;
- struct bfd_link_info *info;
- asection *output_section;
- struct bfd_link_order *link_order;
-{
- reloc_howto_type *howto;
- long indx;
- bfd_vma offset;
- bfd_vma addend;
- struct elf_link_hash_entry **rel_hash_ptr;
- Elf_Internal_Shdr *rel_hdr;
- struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
-
- howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
- if (howto == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
-
- addend = link_order->u.reloc.p->addend;
-
- /* Figure out the symbol index. */
- rel_hash_ptr = (elf_section_data (output_section)->rel_hashes
- + elf_section_data (output_section)->rel_count
- + elf_section_data (output_section)->rel_count2);
- if (link_order->type == bfd_section_reloc_link_order)
- {
- indx = link_order->u.reloc.p->u.section->target_index;
- BFD_ASSERT (indx != 0);
- *rel_hash_ptr = NULL;
- }
- else
- {
- struct elf_link_hash_entry *h;
-
- /* Treat a reloc against a defined symbol as though it were
- actually against the section. */
- h = ((struct elf_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, info,
- link_order->u.reloc.p->u.name,
- false, false, true));
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- asection *section;
-
- section = h->root.u.def.section;
- indx = section->output_section->target_index;
- *rel_hash_ptr = NULL;
- /* It seems that we ought to add the symbol value to the
- addend here, but in practice it has already been added
- because it was passed to constructor_callback. */
- addend += section->output_section->vma + section->output_offset;
- }
- else if (h != NULL)
- {
- /* Setting the index to -2 tells elf_link_output_extsym that
- this symbol is used by a reloc. */
- h->indx = -2;
- *rel_hash_ptr = h;
- indx = 0;
- }
- else
- {
- if (! ((*info->callbacks->unattached_reloc)
- (info, link_order->u.reloc.p->u.name, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- return false;
- indx = 0;
- }
- }
-
- /* If this is an inplace reloc, we must write the addend into the
- object file. */
- if (howto->partial_inplace && addend != 0)
- {
- bfd_size_type size;
- bfd_reloc_status_type rstat;
- bfd_byte *buf;
- boolean ok;
- const char *sym_name;
-
- size = bfd_get_reloc_size (howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
- if (buf == (bfd_byte *) NULL)
- return false;
- rstat = _bfd_relocate_contents (howto, output_bfd, (bfd_vma) addend, buf);
- switch (rstat)
- {
- case bfd_reloc_ok:
- break;
-
- default:
- case bfd_reloc_outofrange:
- abort ();
-
- case bfd_reloc_overflow:
- if (link_order->type == bfd_section_reloc_link_order)
- sym_name = bfd_section_name (output_bfd,
- link_order->u.reloc.p->u.section);
- else
- sym_name = link_order->u.reloc.p->u.name;
- if (! ((*info->callbacks->reloc_overflow)
- (info, sym_name, howto->name, addend,
- (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
- {
- free (buf);
- return false;
- }
- break;
- }
- ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
- (file_ptr) link_order->offset, size);
- free (buf);
- if (! ok)
- return false;
- }
-
- /* The address of a reloc is relative to the section in a
- relocateable file, and is a virtual address in an executable
- file. */
- offset = link_order->offset;
- if (! info->relocateable)
- offset += output_section->vma;
-
- rel_hdr = &elf_section_data (output_section)->rel_hdr;
-
- if (rel_hdr->sh_type == SHT_REL)
- {
- bfd_size_type size;
- Elf_Internal_Rel *irel;
- Elf_External_Rel *erel;
- unsigned int i;
-
- size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
- irel = (Elf_Internal_Rel *) bfd_zmalloc (size);
- if (irel == NULL)
- return false;
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- irel[i].r_offset = offset;
- irel[0].r_info = ELF_R_INFO (indx, howto->type);
-
- erel = ((Elf_External_Rel *) rel_hdr->contents
- + elf_section_data (output_section)->rel_count);
-
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (output_bfd, irel, (bfd_byte *) erel);
- else
- elf_swap_reloc_out (output_bfd, irel, erel);
-
- free (irel);
- }
- else
- {
- bfd_size_type size;
- Elf_Internal_Rela *irela;
- Elf_External_Rela *erela;
- unsigned int i;
-
- size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
- irela = (Elf_Internal_Rela *) bfd_zmalloc (size);
- if (irela == NULL)
- return false;
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- irela[i].r_offset = offset;
- irela[0].r_info = ELF_R_INFO (indx, howto->type);
- irela[0].r_addend = addend;
-
- erela = ((Elf_External_Rela *) rel_hdr->contents
- + elf_section_data (output_section)->rel_count);
-
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (output_bfd, irela, (bfd_byte *) erela);
- else
- elf_swap_reloca_out (output_bfd, irela, erela);
- }
-
- ++elf_section_data (output_section)->rel_count;
-
- return true;
-}
-
-/* Allocate a pointer to live in a linker created section. */
-
-boolean
-elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
- bfd *abfd;
- struct bfd_link_info *info;
- elf_linker_section_t *lsect;
- struct elf_link_hash_entry *h;
- const Elf_Internal_Rela *rel;
-{
- elf_linker_section_pointers_t **ptr_linker_section_ptr = NULL;
- elf_linker_section_pointers_t *linker_section_ptr;
- unsigned long r_symndx = ELF_R_SYM (rel->r_info);
- bfd_size_type amt;
-
- BFD_ASSERT (lsect != NULL);
-
- /* Is this a global symbol? */
- if (h != NULL)
- {
- /* Has this symbol already been allocated? If so, our work is done. */
- if (_bfd_elf_find_pointer_linker_section (h->linker_section_pointer,
- rel->r_addend,
- lsect->which))
- return true;
-
- ptr_linker_section_ptr = &h->linker_section_pointer;
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! elf_link_record_dynamic_symbol (info, h))
- return false;
- }
-
- if (lsect->rel_section)
- lsect->rel_section->_raw_size += sizeof (Elf_External_Rela);
- }
- else
- {
- /* Allocation of a pointer to a local symbol. */
- elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd);
-
- /* Allocate a table to hold the local symbols if first time. */
- if (!ptr)
- {
- unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info;
- register unsigned int i;
-
- amt = num_symbols;
- amt *= sizeof (elf_linker_section_pointers_t *);
- ptr = (elf_linker_section_pointers_t **) bfd_alloc (abfd, amt);
-
- if (!ptr)
- return false;
-
- elf_local_ptr_offsets (abfd) = ptr;
- for (i = 0; i < num_symbols; i++)
- ptr[i] = (elf_linker_section_pointers_t *) 0;
- }
-
- /* Has this symbol already been allocated? If so, our work is done. */
- if (_bfd_elf_find_pointer_linker_section (ptr[r_symndx],
- rel->r_addend,
- lsect->which))
- return true;
-
- ptr_linker_section_ptr = &ptr[r_symndx];
-
- if (info->shared)
- {
- /* If we are generating a shared object, we need to
- output a R_<xxx>_RELATIVE reloc so that the
- dynamic linker can adjust this GOT entry. */
- BFD_ASSERT (lsect->rel_section != NULL);
- lsect->rel_section->_raw_size += sizeof (Elf_External_Rela);
- }
- }
-
- /* Allocate space for a pointer in the linker section, and allocate
- a new pointer record from internal memory. */
- BFD_ASSERT (ptr_linker_section_ptr != NULL);
- amt = sizeof (elf_linker_section_pointers_t);
- linker_section_ptr = (elf_linker_section_pointers_t *) bfd_alloc (abfd, amt);
-
- if (!linker_section_ptr)
- return false;
-
- linker_section_ptr->next = *ptr_linker_section_ptr;
- linker_section_ptr->addend = rel->r_addend;
- linker_section_ptr->which = lsect->which;
- linker_section_ptr->written_address_p = false;
- *ptr_linker_section_ptr = linker_section_ptr;
-
-#if 0
- if (lsect->hole_size && lsect->hole_offset < lsect->max_hole_offset)
- {
- linker_section_ptr->offset = (lsect->section->_raw_size
- - lsect->hole_size + (ARCH_SIZE / 8));
- lsect->hole_offset += ARCH_SIZE / 8;
- lsect->sym_offset += ARCH_SIZE / 8;
- if (lsect->sym_hash)
- {
- /* Bump up symbol value if needed. */
- lsect->sym_hash->root.u.def.value += ARCH_SIZE / 8;
-#ifdef DEBUG
- fprintf (stderr, "Bump up %s by %ld, current value = %ld\n",
- lsect->sym_hash->root.root.string,
- (long) ARCH_SIZE / 8,
- (long) lsect->sym_hash->root.u.def.value);
-#endif
- }
- }
- else
-#endif
- linker_section_ptr->offset = lsect->section->_raw_size;
-
- lsect->section->_raw_size += ARCH_SIZE / 8;
-
-#ifdef DEBUG
- fprintf (stderr,
- "Create pointer in linker section %s, offset = %ld, section size = %ld\n",
- lsect->name, (long) linker_section_ptr->offset,
- (long) lsect->section->_raw_size);
-#endif
-
- return true;
-}
-
-#if ARCH_SIZE==64
-#define bfd_put_ptr(BFD,VAL,ADDR) bfd_put_64 (BFD, VAL, ADDR)
-#endif
-#if ARCH_SIZE==32
-#define bfd_put_ptr(BFD,VAL,ADDR) bfd_put_32 (BFD, VAL, ADDR)
-#endif
-
-/* Fill in the address for a pointer generated in a linker section. */
-
-bfd_vma
-elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
- relocation, rel, relative_reloc)
- bfd *output_bfd;
- bfd *input_bfd;
- struct bfd_link_info *info;
- elf_linker_section_t *lsect;
- struct elf_link_hash_entry *h;
- bfd_vma relocation;
- const Elf_Internal_Rela *rel;
- int relative_reloc;
-{
- elf_linker_section_pointers_t *linker_section_ptr;
-
- BFD_ASSERT (lsect != NULL);
-
- if (h != NULL)
- {
- /* Handle global symbol. */
- linker_section_ptr = (_bfd_elf_find_pointer_linker_section
- (h->linker_section_pointer,
- rel->r_addend,
- lsect->which));
-
- BFD_ASSERT (linker_section_ptr != NULL);
-
- if (! elf_hash_table (info)->dynamic_sections_created
- || (info->shared
- && info->symbolic
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally. We must initialize this entry in the
- global section.
-
- When doing a dynamic link, we create a .rela.<xxx>
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if (!linker_section_ptr->written_address_p)
- {
- linker_section_ptr->written_address_p = true;
- bfd_put_ptr (output_bfd,
- relocation + linker_section_ptr->addend,
- (lsect->section->contents
- + linker_section_ptr->offset));
- }
- }
- }
- else
- {
- /* Handle local symbol. */
- unsigned long r_symndx = ELF_R_SYM (rel->r_info);
- BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL);
- BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL);
- linker_section_ptr = (_bfd_elf_find_pointer_linker_section
- (elf_local_ptr_offsets (input_bfd)[r_symndx],
- rel->r_addend,
- lsect->which));
-
- BFD_ASSERT (linker_section_ptr != NULL);
-
- /* Write out pointer if it hasn't been rewritten out before. */
- if (!linker_section_ptr->written_address_p)
- {
- linker_section_ptr->written_address_p = true;
- bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend,
- lsect->section->contents + linker_section_ptr->offset);
-
- if (info->shared)
- {
- asection *srel = lsect->rel_section;
- Elf_Internal_Rela *outrel;
- Elf_External_Rela *erel;
- struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
- unsigned int i;
- bfd_size_type amt;
-
- amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
- outrel = (Elf_Internal_Rela *) bfd_zmalloc (amt);
- if (outrel == NULL)
- {
- (*_bfd_error_handler) (_("Error: out of memory"));
- return 0;
- }
-
- /* We need to generate a relative reloc for the dynamic
- linker. */
- if (!srel)
- {
- srel = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
- lsect->rel_name);
- lsect->rel_section = srel;
- }
-
- BFD_ASSERT (srel != NULL);
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- outrel[i].r_offset = (lsect->section->output_section->vma
- + lsect->section->output_offset
- + linker_section_ptr->offset);
- outrel[0].r_info = ELF_R_INFO (0, relative_reloc);
- outrel[0].r_addend = 0;
- erel = (Elf_External_Rela *) lsect->section->contents;
- erel += elf_section_data (lsect->section)->rel_count;
- elf_swap_reloca_out (output_bfd, outrel, erel);
- ++elf_section_data (lsect->section)->rel_count;
-
- free (outrel);
- }
- }
- }
-
- relocation = (lsect->section->output_offset
- + linker_section_ptr->offset
- - lsect->hole_offset
- - lsect->sym_offset);
-
-#ifdef DEBUG
- fprintf (stderr,
- "Finish pointer in linker section %s, offset = %ld (0x%lx)\n",
- lsect->name, (long) relocation, (long) relocation);
-#endif
-
- /* Subtract out the addend, because it will get added back in by the normal
- processing. */
- return relocation - linker_section_ptr->addend;
-}
-
-/* Garbage collect unused sections. */
-
-static boolean elf_gc_mark
- PARAMS ((struct bfd_link_info *, asection *,
- asection * (*) (asection *, struct bfd_link_info *,
- Elf_Internal_Rela *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *)));
-
-static boolean elf_gc_sweep
- PARAMS ((struct bfd_link_info *,
- boolean (*) (bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *)));
-
-static boolean elf_gc_sweep_symbol
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static boolean elf_gc_allocate_got_offsets
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static boolean elf_gc_propagate_vtable_entries_used
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static boolean elf_gc_smash_unused_vtentry_relocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-/* The mark phase of garbage collection. For a given section, mark
- it and any sections in this section's group, and all the sections
- which define symbols to which it refers. */
-
-static boolean
-elf_gc_mark (info, sec, gc_mark_hook)
- struct bfd_link_info *info;
- asection *sec;
- asection * (*gc_mark_hook) PARAMS ((asection *, struct bfd_link_info *,
- Elf_Internal_Rela *,
- struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-{
- boolean ret;
- asection *group_sec;
-
- sec->gc_mark = 1;
-
- /* Mark all the sections in the group. */
- group_sec = elf_section_data (sec)->next_in_group;
- if (group_sec && !group_sec->gc_mark)
- if (!elf_gc_mark (info, group_sec, gc_mark_hook))
- return false;
-
- /* Look through the section relocs. */
- ret = true;
- if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0)
- {
- Elf_Internal_Rela *relstart, *rel, *relend;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- size_t nlocsyms;
- size_t extsymoff;
- bfd *input_bfd = sec->owner;
- struct elf_backend_data *bed = get_elf_backend_data (input_bfd);
- Elf_Internal_Sym *isym = NULL;
-
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
-
- /* Read the local symbols. */
- if (elf_bad_symtab (input_bfd))
- {
- nlocsyms = symtab_hdr->sh_size / sizeof (Elf_External_Sym);
- extsymoff = 0;
- }
- else
- extsymoff = nlocsyms = symtab_hdr->sh_info;
-
- isym = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isym == NULL && nlocsyms != 0)
- {
- isym = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, nlocsyms, 0,
- NULL, NULL, NULL);
- if (isym == NULL)
- return false;
- }
-
- /* Read the relocations. */
- relstart = (NAME(_bfd_elf,link_read_relocs)
- (input_bfd, sec, NULL, (Elf_Internal_Rela *) NULL,
- info->keep_memory));
- if (relstart == NULL)
- {
- ret = false;
- goto out1;
- }
- relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
-
- for (rel = relstart; rel < relend; rel++)
- {
- unsigned long r_symndx;
- asection *rsec;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF_R_SYM (rel->r_info);
- if (r_symndx == 0)
- continue;
-
- if (r_symndx >= nlocsyms
- || ELF_ST_BIND (isym[r_symndx].st_info) != STB_LOCAL)
- {
- h = sym_hashes[r_symndx - extsymoff];
- rsec = (*gc_mark_hook) (sec, info, rel, h, NULL);
- }
- else
- {
- rsec = (*gc_mark_hook) (sec, info, rel, NULL, &isym[r_symndx]);
- }
-
- if (rsec && !rsec->gc_mark)
- {
- if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour)
- rsec->gc_mark = 1;
- else if (!elf_gc_mark (info, rsec, gc_mark_hook))
- {
- ret = false;
- goto out2;
- }
- }
- }
-
- out2:
- if (elf_section_data (sec)->relocs != relstart)
- free (relstart);
- out1:
- if (isym != NULL && symtab_hdr->contents != (unsigned char *) isym)
- {
- if (! info->keep_memory)
- free (isym);
- else
- symtab_hdr->contents = (unsigned char *) isym;
- }
- }
-
- return ret;
-}
-
-/* The sweep phase of garbage collection. Remove all garbage sections. */
-
-static boolean
-elf_gc_sweep (info, gc_sweep_hook)
- struct bfd_link_info *info;
- boolean (*gc_sweep_hook) PARAMS ((bfd *, struct bfd_link_info *,
- asection *, const Elf_Internal_Rela *));
-{
- bfd *sub;
-
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- asection *o;
-
- if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
- continue;
-
- for (o = sub->sections; o != NULL; o = o->next)
- {
- /* Keep special sections. Keep .debug sections. */
- if ((o->flags & SEC_LINKER_CREATED)
- || (o->flags & SEC_DEBUGGING))
- o->gc_mark = 1;
-
- if (o->gc_mark)
- continue;
-
- /* Skip sweeping sections already excluded. */
- if (o->flags & SEC_EXCLUDE)
- continue;
-
- /* Since this is early in the link process, it is simple
- to remove a section from the output. */
- o->flags |= SEC_EXCLUDE;
-
- /* But we also have to update some of the relocation
- info we collected before. */
- if (gc_sweep_hook
- && (o->flags & SEC_RELOC) && o->reloc_count > 0)
- {
- Elf_Internal_Rela *internal_relocs;
- boolean r;
-
- internal_relocs = (NAME(_bfd_elf,link_read_relocs)
- (o->owner, o, NULL, NULL, info->keep_memory));
- if (internal_relocs == NULL)
- return false;
-
- r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs);
-
- if (elf_section_data (o)->relocs != internal_relocs)
- free (internal_relocs);
-
- if (!r)
- return false;
- }
- }
- }
-
- /* Remove the symbols that were in the swept sections from the dynamic
- symbol table. GCFIXME: Anyone know how to get them out of the
- static symbol table as well? */
- {
- int i = 0;
-
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_sweep_symbol,
- (PTR) &i);
-
- elf_hash_table (info)->dynsymcount = i;
- }
-
- return true;
-}
-
-/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */
-
-static boolean
-elf_gc_sweep_symbol (h, idxptr)
- struct elf_link_hash_entry *h;
- PTR idxptr;
-{
- int *idx = (int *) idxptr;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx != -1
- && ((h->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || h->root.u.def.section->gc_mark))
- h->dynindx = (*idx)++;
-
- return true;
-}
-
-/* Propogate collected vtable information. This is called through
- elf_link_hash_traverse. */
-
-static boolean
-elf_gc_propagate_vtable_entries_used (h, okp)
- struct elf_link_hash_entry *h;
- PTR okp;
-{
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Those that are not vtables. */
- if (h->vtable_parent == NULL)
- return true;
-
- /* Those vtables that do not have parents, we cannot merge. */
- if (h->vtable_parent == (struct elf_link_hash_entry *) -1)
- return true;
-
- /* If we've already been done, exit. */
- if (h->vtable_entries_used && h->vtable_entries_used[-1])
- return true;
-
- /* Make sure the parent's table is up to date. */
- elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp);
-
- if (h->vtable_entries_used == NULL)
- {
- /* None of this table's entries were referenced. Re-use the
- parent's table. */
- h->vtable_entries_used = h->vtable_parent->vtable_entries_used;
- h->vtable_entries_size = h->vtable_parent->vtable_entries_size;
- }
- else
- {
- size_t n;
- boolean *cu, *pu;
-
- /* Or the parent's entries into ours. */
- cu = h->vtable_entries_used;
- cu[-1] = true;
- pu = h->vtable_parent->vtable_entries_used;
- if (pu != NULL)
- {
- asection *sec = h->root.u.def.section;
- struct elf_backend_data *bed = get_elf_backend_data (sec->owner);
- int file_align = bed->s->file_align;
-
- n = h->vtable_parent->vtable_entries_size / file_align;
- while (n--)
- {
- if (*pu)
- *cu = true;
- pu++;
- cu++;
- }
- }
- }
-
- return true;
-}
-
-static boolean
-elf_gc_smash_unused_vtentry_relocs (h, okp)
- struct elf_link_hash_entry *h;
- PTR okp;
-{
- asection *sec;
- bfd_vma hstart, hend;
- Elf_Internal_Rela *relstart, *relend, *rel;
- struct elf_backend_data *bed;
- int file_align;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Take care of both those symbols that do not describe vtables as
- well as those that are not loaded. */
- if (h->vtable_parent == NULL)
- return true;
-
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak);
-
- sec = h->root.u.def.section;
- hstart = h->root.u.def.value;
- hend = hstart + h->size;
-
- relstart = (NAME(_bfd_elf,link_read_relocs)
- (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, true));
- if (!relstart)
- return *(boolean *) okp = false;
- bed = get_elf_backend_data (sec->owner);
- file_align = bed->s->file_align;
-
- relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
-
- for (rel = relstart; rel < relend; ++rel)
- if (rel->r_offset >= hstart && rel->r_offset < hend)
- {
- /* If the entry is in use, do nothing. */
- if (h->vtable_entries_used
- && (rel->r_offset - hstart) < h->vtable_entries_size)
- {
- bfd_vma entry = (rel->r_offset - hstart) / file_align;
- if (h->vtable_entries_used[entry])
- continue;
- }
- /* Otherwise, kill it. */
- rel->r_offset = rel->r_info = rel->r_addend = 0;
- }
-
- return true;
-}
-
-/* Do mark and sweep of unused sections. */
-
-boolean
-elf_gc_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- boolean ok = true;
- bfd *sub;
- asection * (*gc_mark_hook)
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *));
-
- if (!get_elf_backend_data (abfd)->can_gc_sections
- || info->relocateable || info->emitrelocations
- || elf_hash_table (info)->dynamic_sections_created)
- return true;
-
- /* Apply transitive closure to the vtable entry usage info. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_propagate_vtable_entries_used,
- (PTR) &ok);
- if (!ok)
- return false;
-
- /* Kill the vtable relocations that were not used. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_smash_unused_vtentry_relocs,
- (PTR) &ok);
- if (!ok)
- return false;
-
- /* Grovel through relocs to find out who stays ... */
-
- gc_mark_hook = get_elf_backend_data (abfd)->gc_mark_hook;
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- asection *o;
-
- if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
- continue;
-
- for (o = sub->sections; o != NULL; o = o->next)
- {
- if (o->flags & SEC_KEEP)
- if (!elf_gc_mark (info, o, gc_mark_hook))
- return false;
- }
- }
-
- /* ... and mark SEC_EXCLUDE for those that go. */
- if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook))
- return false;
-
- return true;
-}
-
-/* Called from check_relocs to record the existance of a VTINHERIT reloc. */
-
-boolean
-elf_gc_record_vtinherit (abfd, sec, h, offset)
- bfd *abfd;
- asection *sec;
- struct elf_link_hash_entry *h;
- bfd_vma offset;
-{
- struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
- struct elf_link_hash_entry **search, *child;
- bfd_size_type extsymcount;
-
- /* The sh_info field of the symtab header tells us where the
- external symbols start. We don't care about the local symbols at
- this point. */
- extsymcount = elf_tdata (abfd)->symtab_hdr.sh_size/sizeof (Elf_External_Sym);
- if (!elf_bad_symtab (abfd))
- extsymcount -= elf_tdata (abfd)->symtab_hdr.sh_info;
-
- sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = sym_hashes + extsymcount;
-
- /* Hunt down the child symbol, which is in this section at the same
- offset as the relocation. */
- for (search = sym_hashes; search != sym_hashes_end; ++search)
- {
- if ((child = *search) != NULL
- && (child->root.type == bfd_link_hash_defined
- || child->root.type == bfd_link_hash_defweak)
- && child->root.u.def.section == sec
- && child->root.u.def.value == offset)
- goto win;
- }
-
- (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT",
- bfd_archive_filename (abfd), sec->name,
- (unsigned long) offset);
- bfd_set_error (bfd_error_invalid_operation);
- return false;
-
- win:
- if (!h)
- {
- /* This *should* only be the absolute section. It could potentially
- be that someone has defined a non-global vtable though, which
- would be bad. It isn't worth paging in the local symbols to be
- sure though; that case should simply be handled by the assembler. */
-
- child->vtable_parent = (struct elf_link_hash_entry *) -1;
- }
- else
- child->vtable_parent = h;
-
- return true;
-}
-
-/* Called from check_relocs to record the existance of a VTENTRY reloc. */
-
-boolean
-elf_gc_record_vtentry (abfd, sec, h, addend)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- struct elf_link_hash_entry *h;
- bfd_vma addend;
-{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- int file_align = bed->s->file_align;
-
- if (addend >= h->vtable_entries_size)
- {
- size_t size, bytes;
- boolean *ptr = h->vtable_entries_used;
-
- /* While the symbol is undefined, we have to be prepared to handle
- a zero size. */
- if (h->root.type == bfd_link_hash_undefined)
- size = addend;
- else
- {
- size = h->size;
- if (size < addend)
- {
- /* Oops! We've got a reference past the defined end of
- the table. This is probably a bug -- shall we warn? */
- size = addend;
- }
- }
-
- /* Allocate one extra entry for use as a "done" flag for the
- consolidation pass. */
- bytes = (size / file_align + 1) * sizeof (boolean);
-
- if (ptr)
- {
- ptr = bfd_realloc (ptr - 1, (bfd_size_type) bytes);
-
- if (ptr != NULL)
- {
- size_t oldbytes;
-
- oldbytes = ((h->vtable_entries_size / file_align + 1)
- * sizeof (boolean));
- memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
- }
- }
- else
- ptr = bfd_zmalloc ((bfd_size_type) bytes);
-
- if (ptr == NULL)
- return false;
-
- /* And arrange for that done flag to be at index -1. */
- h->vtable_entries_used = ptr + 1;
- h->vtable_entries_size = size;
- }
-
- h->vtable_entries_used[addend / file_align] = true;
-
- return true;
-}
-
-/* And an accompanying bit to work out final got entry offsets once
- we're done. Should be called from final_link. */
-
-boolean
-elf_gc_common_finalize_got_offsets (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- bfd *i;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_vma gotoff;
-
- /* The GOT offset is relative to the .got section, but the GOT header is
- put into the .got.plt section, if the backend uses it. */
- if (bed->want_got_plt)
- gotoff = 0;
- else
- gotoff = bed->got_header_size;
-
- /* Do the local .got entries first. */
- for (i = info->input_bfds; i; i = i->link_next)
- {
- bfd_signed_vma *local_got;
- bfd_size_type j, locsymcount;
- Elf_Internal_Shdr *symtab_hdr;
-
- if (bfd_get_flavour (i) != bfd_target_elf_flavour)
- continue;
-
- local_got = elf_local_got_refcounts (i);
- if (!local_got)
- continue;
-
- symtab_hdr = &elf_tdata (i)->symtab_hdr;
- if (elf_bad_symtab (i))
- locsymcount = symtab_hdr->sh_size / sizeof (Elf_External_Sym);
- else
- locsymcount = symtab_hdr->sh_info;
-
- for (j = 0; j < locsymcount; ++j)
- {
- if (local_got[j] > 0)
- {
- local_got[j] = gotoff;
- gotoff += ARCH_SIZE / 8;
- }
- else
- local_got[j] = (bfd_vma) -1;
- }
- }
-
- /* Then the global .got entries. .plt refcounts are handled by
- adjust_dynamic_symbol */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_allocate_got_offsets,
- (PTR) &gotoff);
- return true;
-}
-
-/* We need a special top-level link routine to convert got reference counts
- to real got offsets. */
-
-static boolean
-elf_gc_allocate_got_offsets (h, offarg)
- struct elf_link_hash_entry *h;
- PTR offarg;
-{
- bfd_vma *off = (bfd_vma *) offarg;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->got.refcount > 0)
- {
- h->got.offset = off[0];
- off[0] += ARCH_SIZE / 8;
- }
- else
- h->got.offset = (bfd_vma) -1;
-
- return true;
-}
-
-/* Many folk need no more in the way of final link than this, once
- got entry reference counting is enabled. */
-
-boolean
-elf_gc_common_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- if (!elf_gc_common_finalize_got_offsets (abfd, info))
- return false;
-
- /* Invoke the regular ELF backend linker to do all the work. */
- return elf_bfd_final_link (abfd, info);
-}
-
-/* This function will be called though elf_link_hash_traverse to store
- all hash value of the exported symbols in an array. */
-
-static boolean
-elf_collect_hash_codes (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
-{
- unsigned long **valuep = (unsigned long **) data;
- const char *name;
- char *p;
- unsigned long ha;
- char *alc = NULL;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Ignore indirect symbols. These are added by the versioning code. */
- if (h->dynindx == -1)
- return true;
-
- name = h->root.root.string;
- p = strchr (name, ELF_VER_CHR);
- if (p != NULL)
- {
- alc = bfd_malloc ((bfd_size_type) (p - name + 1));
- memcpy (alc, name, (size_t) (p - name));
- alc[p - name] = '\0';
- name = alc;
- }
-
- /* Compute the hash value. */
- ha = bfd_elf_hash (name);
-
- /* Store the found hash value in the array given as the argument. */
- *(*valuep)++ = ha;
-
- /* And store it in the struct so that we can put it in the hash table
- later. */
- h->elf_hash_value = ha;
-
- if (alc != NULL)
- free (alc);
-
- return true;
-}
-
-boolean
-elf_reloc_symbol_deleted_p (offset, cookie)
- bfd_vma offset;
- PTR cookie;
-{
- struct elf_reloc_cookie *rcookie = (struct elf_reloc_cookie *) cookie;
-
- if (rcookie->bad_symtab)
- rcookie->rel = rcookie->rels;
-
- for (; rcookie->rel < rcookie->relend; rcookie->rel++)
- {
- unsigned long r_symndx = ELF_R_SYM (rcookie->rel->r_info);
-
- if (! rcookie->bad_symtab)
- if (rcookie->rel->r_offset > offset)
- return false;
- if (rcookie->rel->r_offset != offset)
- continue;
-
- if (r_symndx >= rcookie->locsymcount
- || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL)
- {
- struct elf_link_hash_entry *h;
-
- h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff];
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && elf_discarded_section (h->root.u.def.section))
- return true;
- else
- return false;
- }
- else
- {
- /* It's not a relocation against a global symbol,
- but it could be a relocation against a local
- symbol for a discarded section. */
- asection *isec;
- Elf_Internal_Sym *isym;
-
- /* Need to: get the symbol; get the section. */
- isym = &rcookie->locsyms[r_symndx];
- if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
- {
- isec = section_from_elf_index (rcookie->abfd, isym->st_shndx);
- if (isec != NULL && elf_discarded_section (isec))
- return true;
- }
- }
- return false;
- }
- return false;
-}
-
-/* Discard unneeded references to discarded sections.
- Returns true if any section's size was changed. */
-/* This function assumes that the relocations are in sorted order,
- which is true for all known assemblers. */
-
-boolean
-elf_bfd_discard_info (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- struct elf_reloc_cookie cookie;
- asection *stab, *eh, *ehdr;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_backend_data *bed;
- bfd *abfd;
- boolean ret = false;
- boolean strip = info->strip == strip_all || info->strip == strip_debugger;
-
- if (info->relocateable
- || info->traditional_format
- || info->hash->creator->flavour != bfd_target_elf_flavour
- || ! is_elf_hash_table (info))
- return false;
-
- ehdr = NULL;
- if (elf_hash_table (info)->dynobj != NULL)
- ehdr = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
- ".eh_frame_hdr");
-
- for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
- {
- if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
- continue;
-
- bed = get_elf_backend_data (abfd);
-
- if ((abfd->flags & DYNAMIC) != 0)
- continue;
-
- eh = NULL;
- if (ehdr)
- {
- eh = bfd_get_section_by_name (abfd, ".eh_frame");
- if (eh && (eh->_raw_size == 0
- || bfd_is_abs_section (eh->output_section)))
- eh = NULL;
- }
-
- stab = NULL;
- if (!strip)
- {
- stab = bfd_get_section_by_name (abfd, ".stab");
- if (stab && (stab->_raw_size == 0
- || bfd_is_abs_section (stab->output_section)))
- stab = NULL;
- }
- if ((! stab
- || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
- && ! eh
- && (strip || ! bed->elf_backend_discard_info))
- continue;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- cookie.abfd = abfd;
- cookie.sym_hashes = elf_sym_hashes (abfd);
- cookie.bad_symtab = elf_bad_symtab (abfd);
- if (cookie.bad_symtab)
- {
- cookie.locsymcount =
- symtab_hdr->sh_size / sizeof (Elf_External_Sym);
- cookie.extsymoff = 0;
- }
- else
- {
- cookie.locsymcount = symtab_hdr->sh_info;
- cookie.extsymoff = symtab_hdr->sh_info;
- }
-
- cookie.locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (cookie.locsyms == NULL && cookie.locsymcount != 0)
- {
- cookie.locsyms = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- cookie.locsymcount, 0,
- NULL, NULL, NULL);
- if (cookie.locsyms == NULL)
- return false;
- }
-
- if (stab)
- {
- cookie.rels = (NAME(_bfd_elf,link_read_relocs)
- (abfd, stab, (PTR) NULL, (Elf_Internal_Rela *) NULL,
- info->keep_memory));
- if (cookie.rels)
- {
- cookie.rel = cookie.rels;
- cookie.relend =
- cookie.rels + stab->reloc_count * bed->s->int_rels_per_ext_rel;
- if (_bfd_discard_section_stabs (abfd, stab,
- elf_section_data (stab)->sec_info,
- elf_reloc_symbol_deleted_p,
- &cookie))
- ret = true;
- if (elf_section_data (stab)->relocs != cookie.rels)
- free (cookie.rels);
- }
- }
-
- if (eh)
- {
- cookie.rels = NULL;
- cookie.rel = NULL;
- cookie.relend = NULL;
- if (eh->reloc_count)
- cookie.rels = (NAME(_bfd_elf,link_read_relocs)
- (abfd, eh, (PTR) NULL, (Elf_Internal_Rela *) NULL,
- info->keep_memory));
- if (cookie.rels)
- {
- cookie.rel = cookie.rels;
- cookie.relend =
- cookie.rels + eh->reloc_count * bed->s->int_rels_per_ext_rel;
- }
- if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, ehdr,
- elf_reloc_symbol_deleted_p,
- &cookie))
- {
- /* Relocs have been edited. Ensure edited version is
- used later in relocate_section. */
- elf_section_data (eh)->relocs = cookie.rels;
- ret = true;
- }
- if (cookie.rels && elf_section_data (eh)->relocs != cookie.rels)
- free (cookie.rels);
- }
-
- if (bed->elf_backend_discard_info)
- {
- if (bed->elf_backend_discard_info (abfd, &cookie, info))
- ret = true;
- }
-
- if (cookie.locsyms != NULL
- && symtab_hdr->contents != (unsigned char *) cookie.locsyms)
- {
- if (! info->keep_memory)
- free (cookie.locsyms);
- else
- symtab_hdr->contents = (unsigned char *) cookie.locsyms;
- }
- }
-
- if (ehdr && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info, ehdr))
- ret = true;
- return ret;
-}
-
-static boolean
-elf_section_ignore_discarded_relocs (sec)
- asection *sec;
-{
- struct elf_backend_data *bed;
-
- switch (elf_section_data (sec)->sec_info_type)
- {
- case ELF_INFO_TYPE_STABS:
- case ELF_INFO_TYPE_EH_FRAME:
- return true;
- default:
- break;
- }
-
- bed = get_elf_backend_data (sec->owner);
- if (bed->elf_backend_ignore_discarded_relocs != NULL
- && (*bed->elf_backend_ignore_discarded_relocs) (sec))
- return true;
-
- return false;
-}
diff --git a/contrib/binutils/bfd/elfn32-mips.c b/contrib/binutils/bfd/elfn32-mips.c
deleted file mode 100644
index 973edd5..0000000
--- a/contrib/binutils/bfd/elfn32-mips.c
+++ /dev/null
@@ -1,1983 +0,0 @@
-/* MIPS-specific support for 32-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
-
- Most of the information added by Ian Lance Taylor, Cygnus Support,
- <ian@cygnus.com>.
- N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
- <mark@codesourcery.com>
- Traditional MIPS targets support added by Koundinya.K, Dansk Data
- Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly
- different MIPS ELF from other targets. This matters when linking.
- This file supports both, switching at runtime. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-#include "genlink.h"
-#include "elf-bfd.h"
-#include "elfxx-mips.h"
-#include "elf/mips.h"
-
-/* Get the ECOFF swapping routines. */
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/internal.h"
-#include "coff/ecoff.h"
-#include "coff/mips.h"
-#define ECOFF_SIGNED_32
-#include "ecoffswap.h"
-
-static bfd_boolean mips_elf_assign_gp
- (bfd *, bfd_vma *);
-static bfd_reloc_status_type mips_elf_final_gp
- (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
-static bfd_reloc_status_type mips_elf_gprel16_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips_elf_literal_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips_elf_gprel32_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type gprel32_with_gp
- (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
-static bfd_reloc_status_type mips_elf_shift6_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips16_jump_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips16_gprel_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
- (bfd *, bfd_reloc_code_real_type);
-static reloc_howto_type *mips_elf_n32_rtype_to_howto
- (unsigned int, bfd_boolean);
-static void mips_info_to_howto_rel
- (bfd *, arelent *, Elf_Internal_Rela *);
-static void mips_info_to_howto_rela
- (bfd *, arelent *, Elf_Internal_Rela *);
-static bfd_boolean mips_elf_sym_is_global
- (bfd *, asymbol *);
-static bfd_boolean mips_elf_n32_object_p
- (bfd *);
-static bfd_boolean elf32_mips_grok_prstatus
- (bfd *, Elf_Internal_Note *);
-static bfd_boolean elf32_mips_grok_psinfo
- (bfd *, Elf_Internal_Note *);
-static irix_compat_t elf_n32_mips_irix_compat
- (bfd *);
-
-extern const bfd_target bfd_elf32_nbigmips_vec;
-extern const bfd_target bfd_elf32_nlittlemips_vec;
-
-/* Nonzero if ABFD is using the N32 ABI. */
-#define ABI_N32_P(abfd) \
- ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
-
-/* Whether we are trying to be compatible with IRIX at all. */
-#define SGI_COMPAT(abfd) \
- (elf_n32_mips_irix_compat (abfd) != ict_none)
-
-/* The number of local .got entries we reserve. */
-#define MIPS_RESERVED_GOTNO (2)
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-/* The relocation table used for SHT_REL sections. */
-
-static reloc_howto_type elf_mips_howto_table_rel[] =
-{
- /* No relocation. */
- HOWTO (R_MIPS_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit relocation. */
- HOWTO (R_MIPS_16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit relocation. */
- HOWTO (R_MIPS_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit symbol relative relocation. */
- HOWTO (R_MIPS_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 26 bit jump address. */
- HOWTO (R_MIPS_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC + 4. */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- TRUE, /* partial_inplace */
- 0x03ffffff, /* src_mask */
- 0x03ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
- However, the native IRIX6 tools use them, so we try our best. */
-
- /* High 16 bits of symbol value. */
- HOWTO (R_MIPS_HI16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_hi16_reloc, /* special_function */
- "R_MIPS_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of symbol value. */
- HOWTO (R_MIPS_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_lo16_reloc, /* special_function */
- "R_MIPS_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GP relative reference. */
- HOWTO (R_MIPS_GPREL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf_gprel16_reloc, /* special_function */
- "R_MIPS_GPREL16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to literal section. */
- HOWTO (R_MIPS_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf_literal_reloc, /* special_function */
- "R_MIPS_LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to global offset table. */
- HOWTO (R_MIPS_GOT16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_got16_reloc, /* special_function */
- "R_MIPS_GOT16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit PC relative reference. */
- HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_PC16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 16 bit call through global offset table. */
- HOWTO (R_MIPS_CALL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit GP relative reference. */
- HOWTO (R_MIPS_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_elf_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The remaining relocs are defined on Irix 5, although they are
- not defined by the ABI. */
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
-
- /* A 5 bit shift field. */
- HOWTO (R_MIPS_SHIFT5, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SHIFT5", /* name */
- TRUE, /* partial_inplace */
- 0x000007c0, /* src_mask */
- 0x000007c0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 6 bit shift field. */
- HOWTO (R_MIPS_SHIFT6, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 6, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_elf_shift6_reloc, /* special_function */
- "R_MIPS_SHIFT6", /* name */
- TRUE, /* partial_inplace */
- 0x000007c4, /* src_mask */
- 0x000007c4, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 64 bit relocation. */
- HOWTO (R_MIPS_64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_64", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement in the global offset table. */
- HOWTO (R_MIPS_GOT_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_DISP", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement to page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_PAGE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_PAGE", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Offset from page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_OFST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_OFST", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit subtraction. */
- HOWTO (R_MIPS_SUB, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SUB", /* name */
- TRUE, /* partial_inplace */
- MINUS_ONE, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_A, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_A", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction, and change all relocations
- to refer to the old instruction at the address. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_B, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_B", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Delete a 32 bit instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_DELETE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_DELETE", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
- We don't, because
- a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
- R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
- fallable heuristics.
- b) No other NEwABI toolchain actually emits such relocations. */
- EMPTY_HOWTO (R_MIPS_HIGHER),
- EMPTY_HOWTO (R_MIPS_HIGHEST),
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_HI16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_LO16", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Section displacement. */
- HOWTO (R_MIPS_SCN_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SCN_DISP", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_MIPS_REL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL16", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* These two are obsolete. */
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
-
- /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
- It must be used for multigot GOT's (and only there). */
- HOWTO (R_MIPS_RELGOT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_RELGOT", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Protected jump conversion. This is an optimization hint. No
- relocation is required for correctness. */
- HOWTO (R_MIPS_JALR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_JALR", /* name */
- FALSE, /* partial_inplace */
- 0x00000000, /* src_mask */
- 0x00000000, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* The relocation table used for SHT_RELA sections. */
-
-static reloc_howto_type elf_mips_howto_table_rela[] =
-{
- /* No relocation. */
- HOWTO (R_MIPS_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit relocation. */
- HOWTO (R_MIPS_16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit relocation. */
- HOWTO (R_MIPS_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit symbol relative relocation. */
- HOWTO (R_MIPS_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 26 bit jump address. */
- HOWTO (R_MIPS_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper 36
- bits must match the PC + 4. */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x03ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of symbol value. */
- HOWTO (R_MIPS_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of symbol value. */
- HOWTO (R_MIPS_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_LO16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GP relative reference. */
- HOWTO (R_MIPS_GPREL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf_gprel16_reloc, /* special_function */
- "R_MIPS_GPREL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to literal section. */
- HOWTO (R_MIPS_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips_elf_literal_reloc, /* special_function */
- "R_MIPS_LITERAL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Reference to global offset table. */
- HOWTO (R_MIPS_GOT16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit PC relative reference. */
- HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_PC16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 16 bit call through global offset table. */
- HOWTO (R_MIPS_CALL16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit GP relative reference. */
- HOWTO (R_MIPS_GPREL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- mips_elf_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
-
- /* A 5 bit shift field. */
- HOWTO (R_MIPS_SHIFT5, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SHIFT5", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x000007c0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 6 bit shift field. */
- HOWTO (R_MIPS_SHIFT6, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 6, /* bitsize */
- FALSE, /* pc_relative */
- 6, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- mips_elf_shift6_reloc, /* special_function */
- "R_MIPS_SHIFT6", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x000007c4, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit relocation. */
- HOWTO (R_MIPS_64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement in the global offset table. */
- HOWTO (R_MIPS_GOT_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_DISP", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Displacement to page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_PAGE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_PAGE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Offset from page pointer in the global offset table. */
- HOWTO (R_MIPS_GOT_OFST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_OFST", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_GOT_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_LO16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 64 bit subtraction. */
- HOWTO (R_MIPS_SUB, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SUB", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- MINUS_ONE, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_A, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_A", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Insert the addend as an instruction, and change all relocations
- to refer to the old instruction at the address. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_INSERT_B, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_INSERT_B", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Delete a 32 bit instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_DELETE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_DELETE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Get the higher value of a 64 bit addend. */
- HOWTO (R_MIPS_HIGHER, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HIGHER", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Get the highest value of a 64 bit addend. */
- HOWTO (R_MIPS_HIGHEST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_HIGHEST", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* High 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_HI16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Low 16 bits of displacement in global offset table. */
- HOWTO (R_MIPS_CALL_LO16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_CALL_LO16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Section displacement, used by an associated event location section. */
- HOWTO (R_MIPS_SCN_DISP, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_SCN_DISP", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 16 bit relocation. */
- HOWTO (R_MIPS_REL16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_REL16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* These two are obsolete. */
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
-
- /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
- It must be used for multigot GOT's (and only there). */
- HOWTO (R_MIPS_RELGOT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_RELGOT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Protected jump conversion. This is an optimization hint. No
- relocation is required for correctness. */
- HOWTO (R_MIPS_JALR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_JALR", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* The reloc used for the mips16 jump instruction. */
-static reloc_howto_type elf_mips16_jump_howto =
- HOWTO (R_MIPS16_26, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC. */
- mips16_jump_reloc, /* special_function */
- "R_MIPS16_26", /* name */
- TRUE, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* The reloc used for the mips16 gprel instruction. */
-static reloc_howto_type elf_mips16_gprel_howto =
- HOWTO (R_MIPS16_GPREL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- mips16_gprel_reloc, /* special_function */
- "R_MIPS16_GPREL", /* name */
- TRUE, /* partial_inplace */
- 0x07ff001f, /* src_mask */
- 0x07ff001f, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* GNU extension to record C++ vtable hierarchy */
-static reloc_howto_type elf_mips_gnu_vtinherit_howto =
- HOWTO (R_MIPS_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_MIPS_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* GNU extension to record C++ vtable member usage */
-static reloc_howto_type elf_mips_gnu_vtentry_howto =
- HOWTO (R_MIPS_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_MIPS_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE); /* pcrel_offset */
-
-/* 16 bit offset for pc-relative branches. */
-static reloc_howto_type elf_mips_gnu_rel16_s2 =
- HOWTO (R_MIPS_GNU_REL16_S2, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GNU_REL16_S2", /* name */
- TRUE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* 16 bit offset for pc-relative branches. */
-static reloc_howto_type elf_mips_gnu_rela16_s2 =
- HOWTO (R_MIPS_GNU_REL16_S2, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_GNU_REL16_S2", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- TRUE); /* pcrel_offset */
-
-/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
- dangerous relocation. */
-
-static bfd_boolean
-mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp)
-{
- unsigned int count;
- asymbol **sym;
- unsigned int i;
-
- /* If we've already figured out what GP will be, just return it. */
- *pgp = _bfd_get_gp_value (output_bfd);
- if (*pgp)
- return TRUE;
-
- count = bfd_get_symcount (output_bfd);
- sym = bfd_get_outsymbols (output_bfd);
-
- /* The linker script will have created a symbol named `_gp' with the
- appropriate value. */
- if (sym == NULL)
- i = count;
- else
- {
- for (i = 0; i < count; i++, sym++)
- {
- register const char *name;
-
- name = bfd_asymbol_name (*sym);
- if (*name == '_' && strcmp (name, "_gp") == 0)
- {
- *pgp = bfd_asymbol_value (*sym);
- _bfd_set_gp_value (output_bfd, *pgp);
- break;
- }
- }
- }
-
- if (i >= count)
- {
- /* Only get the error once. */
- *pgp = 4;
- _bfd_set_gp_value (output_bfd, *pgp);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We have to figure out the gp value, so that we can adjust the
- symbol value correctly. We look up the symbol _gp in the output
- BFD. If we can't find it, we're stuck. We cache it in the ELF
- target data. We don't need to adjust the symbol value for an
- external symbol if we are producing relocatable output. */
-
-static bfd_reloc_status_type
-mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
- char **error_message, bfd_vma *pgp)
-{
- if (bfd_is_und_section (symbol->section)
- && ! relocatable)
- {
- *pgp = 0;
- return bfd_reloc_undefined;
- }
-
- *pgp = _bfd_get_gp_value (output_bfd);
- if (*pgp == 0
- && (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0))
- {
- if (relocatable)
- {
- /* Make up a value. */
- *pgp = symbol->section->output_section->vma /*+ 0x4000*/;
- _bfd_set_gp_value (output_bfd, *pgp);
- }
- else if (!mips_elf_assign_gp (output_bfd, pgp))
- {
- *error_message =
- (char *) _("GP relative relocation when _gp not defined");
- return bfd_reloc_dangerous;
- }
- }
-
- return bfd_reloc_ok;
-}
-
-/* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
- become the offset from the gp register. */
-
-static bfd_reloc_status_type
-mips_elf_gprel16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
- input_section, relocatable,
- data, gp);
-}
-
-/* Do a R_MIPS_LITERAL relocation. */
-
-static bfd_reloc_status_type
-mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
-
- /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
- input_section, relocatable,
- data, gp);
-}
-
-/* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
- become the offset from the gp register. */
-
-static bfd_reloc_status_type
-mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
-
- /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (symbol->flags & BSF_LOCAL) != 0)
- {
- *error_message = (char *)
- _("32bits gp relative relocation occurs for an external symbol");
- return bfd_reloc_outofrange;
- }
-
- if (output_bfd != NULL)
- {
- relocatable = TRUE;
- gp = _bfd_get_gp_value (output_bfd);
- }
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
-
- ret = mips_elf_final_gp (output_bfd, symbol, relocatable,
- error_message, &gp);
- if (ret != bfd_reloc_ok)
- return ret;
- }
-
- return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
- relocatable, data, gp);
-}
-
-static bfd_reloc_status_type
-gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
- asection *input_section, bfd_boolean relocatable,
- void *data, bfd_vma gp)
-{
- bfd_vma relocation;
- unsigned long val;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- if (reloc_entry->howto->src_mask == 0)
- val = 0;
- else
- val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
-
- /* Set val to the offset into the section or symbol. */
- val += reloc_entry->addend;
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
-
- return bfd_reloc_ok;
-}
-
-/* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
- the rest is at bits 6-10. The bitpos already got right by the howto. */
-
-static bfd_reloc_status_type
-mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- if (reloc_entry->howto->partial_inplace)
- {
- reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
- | (reloc_entry->addend & 0x00000800) >> 9);
- }
-
- return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd,
- error_message);
-}
-
-/* Handle a mips16 jump. */
-
-static bfd_reloc_status_type
-mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *reloc_entry ATTRIBUTE_UNUSED,
- asymbol *symbol ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd ATTRIBUTE_UNUSED,
- char **error_message ATTRIBUTE_UNUSED)
-{
- static bfd_boolean warned = FALSE;
-
- /* FIXME. */
- if (! warned)
- (*_bfd_error_handler)
- (_("Linking mips16 objects into %s format is not supported"),
- bfd_get_target (input_section->output_section->owner));
- warned = TRUE;
-
- return bfd_reloc_undefined;
-}
-
-/* Handle a mips16 GP relative reloc. */
-
-static bfd_reloc_status_type
-mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section, bfd *output_bfd,
- char **error_message)
-{
- bfd_boolean relocatable;
- bfd_reloc_status_type ret;
- bfd_vma gp;
- unsigned short extend = 0;
- unsigned short insn = 0;
- bfd_signed_vma val;
- bfd_vma relocation;
-
- if (output_bfd != NULL)
- relocatable = TRUE;
- else
- {
- relocatable = FALSE;
- output_bfd = symbol->section->output_section->owner;
- }
-
- ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
- &gp);
- if (ret != bfd_reloc_ok)
- return ret;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- /* Set val to the offset into the section or symbol. */
- val = reloc_entry->addend;
-
- if (reloc_entry->howto->partial_inplace)
- {
- /* Pick up the mips16 extend instruction and the real instruction. */
- extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
- insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2);
- val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f);
- }
-
- _bfd_mips_elf_sign_extend(val, 16);
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- if (reloc_entry->howto->partial_inplace)
- {
- bfd_put_16 (abfd,
- (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0),
- (bfd_byte *) data + reloc_entry->address);
- bfd_put_16 (abfd,
- (insn & 0xffe0) | (val & 0x1f),
- (bfd_byte *) data + reloc_entry->address + 2);
- }
- else
- reloc_entry->addend = val;
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
- else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0))
- return bfd_reloc_overflow;
-
- return bfd_reloc_ok;
-}
-
-/* A mapping from BFD reloc types to MIPS ELF reloc types. */
-
-struct elf_reloc_map {
- bfd_reloc_code_real_type bfd_val;
- enum elf_mips_reloc_type elf_val;
-};
-
-static const struct elf_reloc_map mips_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_MIPS_NONE },
- { BFD_RELOC_16, R_MIPS_16 },
- { BFD_RELOC_32, R_MIPS_32 },
- /* There is no BFD reloc for R_MIPS_REL32. */
- { BFD_RELOC_CTOR, R_MIPS_32 },
- { BFD_RELOC_64, R_MIPS_64 },
- { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
- { BFD_RELOC_HI16_S, R_MIPS_HI16 },
- { BFD_RELOC_LO16, R_MIPS_LO16 },
- { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
- { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
- { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
- { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
- { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
- { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
- { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
- { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
- { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
- { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
- { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
- { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
- { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
- { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
- { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
- { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
- { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
- { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
- { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
- { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
- { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
- { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
- { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
- /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
- { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
- { BFD_RELOC_MIPS_JALR, R_MIPS_JALR }
-};
-
-/* Given a BFD reloc type, return a howto structure. */
-
-static reloc_howto_type *
-bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
-{
- unsigned int i;
- /* FIXME: We default to RELA here instead of choosing the right
- relocation variant. */
- reloc_howto_type *howto_table = elf_mips_howto_table_rela;
-
- for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
- i++)
- {
- if (mips_reloc_map[i].bfd_val == code)
- return &howto_table[(int) mips_reloc_map[i].elf_val];
- }
-
- switch (code)
- {
- case BFD_RELOC_MIPS16_JMP:
- return &elf_mips16_jump_howto;
- case BFD_RELOC_MIPS16_GPREL:
- return &elf_mips16_gprel_howto;
- case BFD_RELOC_VTABLE_INHERIT:
- return &elf_mips_gnu_vtinherit_howto;
- case BFD_RELOC_VTABLE_ENTRY:
- return &elf_mips_gnu_vtentry_howto;
- case BFD_RELOC_16_PCREL_S2:
- return &elf_mips_gnu_rela16_s2;
- default:
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-}
-
-/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
-
-static reloc_howto_type *
-mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
-{
- switch (r_type)
- {
- case R_MIPS16_26:
- return &elf_mips16_jump_howto;
- case R_MIPS16_GPREL:
- return &elf_mips16_gprel_howto;
- case R_MIPS_GNU_VTINHERIT:
- return &elf_mips_gnu_vtinherit_howto;
- case R_MIPS_GNU_VTENTRY:
- return &elf_mips_gnu_vtentry_howto;
- case R_MIPS_GNU_REL16_S2:
- if (rela_p)
- return &elf_mips_gnu_rela16_s2;
- else
- return &elf_mips_gnu_rel16_s2;
- default:
- BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
- if (rela_p)
- return &elf_mips_howto_table_rela[r_type];
- else
- return &elf_mips_howto_table_rel[r_type];
- break;
- }
-}
-
-/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
-
-static void
-mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
-{
- unsigned int r_type;
-
- r_type = ELF32_R_TYPE (dst->r_info);
- cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, FALSE);
-
- /* The addend for a GPREL16 or LITERAL relocation comes from the GP
- value for the object file. We get the addend now, rather than
- when we do the relocation, because the symbol manipulations done
- by the linker may cause us to lose track of the input BFD. */
- if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
- && (r_type == (unsigned int) R_MIPS_GPREL16
- || r_type == (unsigned int) R_MIPS_LITERAL))
- cache_ptr->addend = elf_gp (abfd);
-}
-
-/* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
-
-static void
-mips_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *cache_ptr, Elf_Internal_Rela *dst)
-{
- unsigned int r_type;
-
- r_type = ELF32_R_TYPE (dst->r_info);
- cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, TRUE);
- cache_ptr->addend = dst->r_addend;
-}
-
-/* Determine whether a symbol is global for the purposes of splitting
- the symbol table into global symbols and local symbols. At least
- on Irix 5, this split must be between section symbols and all other
- symbols. On most ELF targets the split is between static symbols
- and externally visible symbols. */
-
-static bfd_boolean
-mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
-{
- if (SGI_COMPAT (abfd))
- return (sym->flags & BSF_SECTION_SYM) == 0;
- else
- return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (sym))
- || bfd_is_com_section (bfd_get_section (sym)));
-}
-
-/* Set the right machine number for a MIPS ELF file. */
-
-static bfd_boolean
-mips_elf_n32_object_p (bfd *abfd)
-{
- unsigned long mach;
-
- /* Irix 5 and 6 are broken. Object file symbol tables are not always
- sorted correctly such that local symbols precede global symbols,
- and the sh_info field in the symbol table is not always right. */
- if (SGI_COMPAT (abfd))
- elf_bad_symtab (abfd) = TRUE;
-
- mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
- bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
-
- if (! ABI_N32_P(abfd))
- return FALSE;
-
- return TRUE;
-}
-
-/* Support for core dump NOTE sections. */
-static bfd_boolean
-elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
- int offset;
- unsigned int raw_size;
-
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 440: /* Linux/MIPS N32 */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 72;
- raw_size = 360;
-
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size,
- note->descpos + offset);
-}
-
-static bfd_boolean
-elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
-
- case 128: /* Linux/MIPS elf_prpsinfo */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return TRUE;
-}
-
-/* Depending on the target vector we generate some version of Irix
- executables or "normal" MIPS ELF ABI executables. */
-static irix_compat_t
-elf_n32_mips_irix_compat (bfd *abfd)
-{
- if ((abfd->xvec == &bfd_elf32_nbigmips_vec)
- || (abfd->xvec == &bfd_elf32_nlittlemips_vec))
- return ict_irix6;
- else
- return ict_none;
-}
-
-/* ECOFF swapping routines. These are used when dealing with the
- .mdebug section, which is in the ECOFF debugging format. */
-static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
- /* Symbol table magic number. */
- magicSym,
- /* Alignment of debugging information. E.g., 4. */
- 4,
- /* Sizes of external symbolic information. */
- sizeof (struct hdr_ext),
- sizeof (struct dnr_ext),
- sizeof (struct pdr_ext),
- sizeof (struct sym_ext),
- sizeof (struct opt_ext),
- sizeof (struct fdr_ext),
- sizeof (struct rfd_ext),
- sizeof (struct ext_ext),
- /* Functions to swap in external symbolic data. */
- ecoff_swap_hdr_in,
- ecoff_swap_dnr_in,
- ecoff_swap_pdr_in,
- ecoff_swap_sym_in,
- ecoff_swap_opt_in,
- ecoff_swap_fdr_in,
- ecoff_swap_rfd_in,
- ecoff_swap_ext_in,
- _bfd_ecoff_swap_tir_in,
- _bfd_ecoff_swap_rndx_in,
- /* Functions to swap out external symbolic data. */
- ecoff_swap_hdr_out,
- ecoff_swap_dnr_out,
- ecoff_swap_pdr_out,
- ecoff_swap_sym_out,
- ecoff_swap_opt_out,
- ecoff_swap_fdr_out,
- ecoff_swap_rfd_out,
- ecoff_swap_ext_out,
- _bfd_ecoff_swap_tir_out,
- _bfd_ecoff_swap_rndx_out,
- /* Function to read in symbolic data. */
- _bfd_mips_elf_read_ecoff_info
-};
-
-#define ELF_ARCH bfd_arch_mips
-#define ELF_MACHINE_CODE EM_MIPS
-
-#define elf_backend_collect TRUE
-#define elf_backend_type_change_ok TRUE
-#define elf_backend_can_gc_sections TRUE
-#define elf_info_to_howto mips_info_to_howto_rela
-#define elf_info_to_howto_rel mips_info_to_howto_rel
-#define elf_backend_sym_is_global mips_elf_sym_is_global
-#define elf_backend_object_p mips_elf_n32_object_p
-#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
-#define elf_backend_section_processing _bfd_mips_elf_section_processing
-#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
-#define elf_backend_fake_sections _bfd_mips_elf_fake_sections
-#define elf_backend_section_from_bfd_section \
- _bfd_mips_elf_section_from_bfd_section
-#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
-#define elf_backend_link_output_symbol_hook \
- _bfd_mips_elf_link_output_symbol_hook
-#define elf_backend_create_dynamic_sections \
- _bfd_mips_elf_create_dynamic_sections
-#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
- _bfd_mips_elf_adjust_dynamic_symbol
-#define elf_backend_always_size_sections \
- _bfd_mips_elf_always_size_sections
-#define elf_backend_size_dynamic_sections \
- _bfd_mips_elf_size_dynamic_sections
-#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- _bfd_mips_elf_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- _bfd_mips_elf_finish_dynamic_sections
-#define elf_backend_final_write_processing \
- _bfd_mips_elf_final_write_processing
-#define elf_backend_additional_program_headers \
- _bfd_mips_elf_additional_program_headers
-#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
-#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
-#define elf_backend_copy_indirect_symbol \
- _bfd_mips_elf_copy_indirect_symbol
-#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
-#define elf_backend_grok_prstatus elf32_mips_grok_prstatus
-#define elf_backend_grok_psinfo elf32_mips_grok_psinfo
-#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
-
-#define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
-
-/* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
- work better/work only in RELA, so we default to this. */
-#define elf_backend_may_use_rel_p 1
-#define elf_backend_may_use_rela_p 1
-#define elf_backend_default_use_rela_p 1
-#define elf_backend_sign_extend_vma TRUE
-
-#define elf_backend_discard_info _bfd_mips_elf_discard_info
-#define elf_backend_ignore_discarded_relocs \
- _bfd_mips_elf_ignore_discarded_relocs
-#define elf_backend_write_section _bfd_mips_elf_write_section
-#define elf_backend_mips_irix_compat elf_n32_mips_irix_compat
-#define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto
-#define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line
-#define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook
-#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
-#define bfd_elf32_bfd_get_relocated_section_contents \
- _bfd_elf_mips_get_relocated_section_contents
-#define bfd_elf32_bfd_link_hash_table_create \
- _bfd_mips_elf_link_hash_table_create
-#define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link
-#define bfd_elf32_bfd_merge_private_bfd_data \
- _bfd_mips_elf_merge_private_bfd_data
-#define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags
-#define bfd_elf32_bfd_print_private_bfd_data \
- _bfd_mips_elf_print_private_bfd_data
-#define bfd_elf32_bfd_relax_section _bfd_mips_relax_section
-
-/* Support for SGI-ish mips targets using n32 ABI. */
-
-#define TARGET_LITTLE_SYM bfd_elf32_nlittlemips_vec
-#define TARGET_LITTLE_NAME "elf32-nlittlemips"
-#define TARGET_BIG_SYM bfd_elf32_nbigmips_vec
-#define TARGET_BIG_NAME "elf32-nbigmips"
-
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible.
- FIXME: How does this affect NewABI? */
-#define ELF_MAXPAGESIZE 0x1000
-
-#include "elf32-target.h"
-
-/* Support for traditional mips targets using n32 ABI. */
-#undef TARGET_LITTLE_SYM
-#undef TARGET_LITTLE_NAME
-#undef TARGET_BIG_SYM
-#undef TARGET_BIG_NAME
-
-#undef ELF_MAXPAGESIZE
-
-#define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec
-#define TARGET_LITTLE_NAME "elf32-ntradlittlemips"
-#define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec
-#define TARGET_BIG_NAME "elf32-ntradbigmips"
-
-/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
-#define ELF_MAXPAGESIZE 0x10000
-#define elf32_bed elf32_tradbed
-
-/* Include the target file again for this target. */
-#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elfxx-ia64.c b/contrib/binutils/bfd/elfxx-ia64.c
deleted file mode 100644
index b19aac2..0000000
--- a/contrib/binutils/bfd/elfxx-ia64.c
+++ /dev/null
@@ -1,5047 +0,0 @@
-/* IA-64 support for 64-bit ELF
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "elf-bfd.h"
-#include "opcode/ia64.h"
-#include "elf/ia64.h"
-#include "objalloc.h"
-#include "hashtab.h"
-
-/* THE RULES for all the stuff the linker creates --
-
- GOT Entries created in response to LTOFF or LTOFF_FPTR
- relocations. Dynamic relocs created for dynamic
- symbols in an application; REL relocs for locals
- in a shared library.
-
- FPTR The canonical function descriptor. Created for local
- symbols in applications. Descriptors for dynamic symbols
- and local symbols in shared libraries are created by
- ld.so. Thus there are no dynamic relocs against these
- objects. The FPTR relocs for such _are_ passed through
- to the dynamic relocation tables.
-
- FULL_PLT Created for a PCREL21B relocation against a dynamic symbol.
- Requires the creation of a PLTOFF entry. This does not
- require any dynamic relocations.
-
- PLTOFF Created by PLTOFF relocations. For local symbols, this
- is an alternate function descriptor, and in shared libraries
- requires two REL relocations. Note that this cannot be
- transformed into an FPTR relocation, since it must be in
- range of the GP. For dynamic symbols, this is a function
- descriptor for a MIN_PLT entry, and requires one IPLT reloc.
-
- MIN_PLT Created by PLTOFF entries against dynamic symbols. This
- does not require dynamic relocations. */
-
-#define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
-
-typedef struct bfd_hash_entry *(*new_hash_entry_func)
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-
-/* In dynamically (linker-) created sections, we generally need to keep track
- of the place a symbol or expression got allocated to. This is done via hash
- tables that store entries of the following type. */
-
-struct elfNN_ia64_dyn_sym_info
-{
- /* The addend for which this entry is relevant. */
- bfd_vma addend;
-
- /* Next addend in the list. */
- struct elfNN_ia64_dyn_sym_info *next;
-
- bfd_vma got_offset;
- bfd_vma fptr_offset;
- bfd_vma pltoff_offset;
- bfd_vma plt_offset;
- bfd_vma plt2_offset;
- bfd_vma tprel_offset;
- bfd_vma dtpmod_offset;
- bfd_vma dtprel_offset;
-
- /* The symbol table entry, if any, that this was derived from. */
- struct elf_link_hash_entry *h;
-
- /* Used to count non-got, non-plt relocations for delayed sizing
- of relocation sections. */
- struct elfNN_ia64_dyn_reloc_entry
- {
- struct elfNN_ia64_dyn_reloc_entry *next;
- asection *srel;
- int type;
- int count;
-
- /* Is this reloc against readonly section? */
- bfd_boolean reltext;
- } *reloc_entries;
-
- /* TRUE when the section contents have been updated. */
- unsigned got_done : 1;
- unsigned fptr_done : 1;
- unsigned pltoff_done : 1;
- unsigned tprel_done : 1;
- unsigned dtpmod_done : 1;
- unsigned dtprel_done : 1;
-
- /* TRUE for the different kinds of linker data we want created. */
- unsigned want_got : 1;
- unsigned want_gotx : 1;
- unsigned want_fptr : 1;
- unsigned want_ltoff_fptr : 1;
- unsigned want_plt : 1;
- unsigned want_plt2 : 1;
- unsigned want_pltoff : 1;
- unsigned want_tprel : 1;
- unsigned want_dtpmod : 1;
- unsigned want_dtprel : 1;
-};
-
-struct elfNN_ia64_local_hash_entry
-{
- int id;
- unsigned int r_sym;
- struct elfNN_ia64_dyn_sym_info *info;
-
- /* TRUE if this hash entry's addends was translated for
- SHF_MERGE optimization. */
- unsigned sec_merge_done : 1;
-};
-
-struct elfNN_ia64_link_hash_entry
-{
- struct elf_link_hash_entry root;
- struct elfNN_ia64_dyn_sym_info *info;
-};
-
-struct elfNN_ia64_link_hash_table
-{
- /* The main hash table. */
- struct elf_link_hash_table root;
-
- asection *got_sec; /* the linkage table section (or NULL) */
- asection *rel_got_sec; /* dynamic relocation section for same */
- asection *fptr_sec; /* function descriptor table (or NULL) */
- asection *rel_fptr_sec; /* dynamic relocation section for same */
- asection *plt_sec; /* the primary plt section (or NULL) */
- asection *pltoff_sec; /* private descriptors for plt (or NULL) */
- asection *rel_pltoff_sec; /* dynamic relocation section for same */
-
- bfd_size_type minplt_entries; /* number of minplt entries */
- unsigned reltext : 1; /* are there relocs against readonly sections? */
- unsigned self_dtpmod_done : 1;/* has self DTPMOD entry been finished? */
- bfd_vma self_dtpmod_offset; /* .got offset to self DTPMOD entry */
-
- htab_t loc_hash_table;
- void *loc_hash_memory;
-};
-
-struct elfNN_ia64_allocate_data
-{
- struct bfd_link_info *info;
- bfd_size_type ofs;
-};
-
-#define elfNN_ia64_hash_table(p) \
- ((struct elfNN_ia64_link_hash_table *) ((p)->hash))
-
-static bfd_reloc_status_type elfNN_ia64_reloc
- PARAMS ((bfd *abfd, arelent *reloc, asymbol *sym, PTR data,
- asection *input_section, bfd *output_bfd, char **error_message));
-static reloc_howto_type * lookup_howto
- PARAMS ((unsigned int rtype));
-static reloc_howto_type *elfNN_ia64_reloc_type_lookup
- PARAMS ((bfd *abfd, bfd_reloc_code_real_type bfd_code));
-static void elfNN_ia64_info_to_howto
- PARAMS ((bfd *abfd, arelent *bfd_reloc, Elf_Internal_Rela *elf_reloc));
-static bfd_boolean elfNN_ia64_relax_section
- PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
- bfd_boolean *again));
-static void elfNN_ia64_relax_ldxmov
- PARAMS((bfd *abfd, bfd_byte *contents, bfd_vma off));
-static bfd_boolean is_unwind_section_name
- PARAMS ((bfd *abfd, const char *));
-static bfd_boolean elfNN_ia64_section_from_shdr
- PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
-static bfd_boolean elfNN_ia64_section_flags
- PARAMS ((flagword *, Elf_Internal_Shdr *));
-static bfd_boolean elfNN_ia64_fake_sections
- PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec));
-static void elfNN_ia64_final_write_processing
- PARAMS ((bfd *abfd, bfd_boolean linker));
-static bfd_boolean elfNN_ia64_add_symbol_hook
- PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym,
- const char **namep, flagword *flagsp, asection **secp,
- bfd_vma *valp));
-static int elfNN_ia64_additional_program_headers
- PARAMS ((bfd *abfd));
-static bfd_boolean elfNN_ia64_modify_segment_map
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elfNN_ia64_is_local_label_name
- PARAMS ((bfd *abfd, const char *name));
-static bfd_boolean elfNN_ia64_dynamic_symbol_p
- PARAMS ((struct elf_link_hash_entry *h, struct bfd_link_info *info, int));
-static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
- PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
- const char *string));
-static void elfNN_ia64_hash_copy_indirect
- PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static void elfNN_ia64_hash_hide_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
-static hashval_t elfNN_ia64_local_htab_hash PARAMS ((const void *));
-static int elfNN_ia64_local_htab_eq PARAMS ((const void *ptr1,
- const void *ptr2));
-static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
- PARAMS ((bfd *abfd));
-static void elfNN_ia64_hash_table_free
- PARAMS ((struct bfd_link_hash_table *hash));
-static bfd_boolean elfNN_ia64_global_dyn_sym_thunk
- PARAMS ((struct bfd_hash_entry *, PTR));
-static int elfNN_ia64_local_dyn_sym_thunk
- PARAMS ((void **, PTR));
-static void elfNN_ia64_dyn_sym_traverse
- PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
- bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
- PTR info));
-static bfd_boolean elfNN_ia64_create_dynamic_sections
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static struct elfNN_ia64_local_hash_entry * get_local_sym_hash
- PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
- bfd *abfd, const Elf_Internal_Rela *rel, bfd_boolean create));
-static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info
- PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
- struct elf_link_hash_entry *h,
- bfd *abfd, const Elf_Internal_Rela *rel, bfd_boolean create));
-static asection *get_got
- PARAMS ((bfd *abfd, struct bfd_link_info *info,
- struct elfNN_ia64_link_hash_table *ia64_info));
-static asection *get_fptr
- PARAMS ((bfd *abfd, struct bfd_link_info *info,
- struct elfNN_ia64_link_hash_table *ia64_info));
-static asection *get_pltoff
- PARAMS ((bfd *abfd, struct bfd_link_info *info,
- struct elfNN_ia64_link_hash_table *ia64_info));
-static asection *get_reloc_section
- PARAMS ((bfd *abfd, struct elfNN_ia64_link_hash_table *ia64_info,
- asection *sec, bfd_boolean create));
-static bfd_boolean elfNN_ia64_check_relocs
- PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec,
- const Elf_Internal_Rela *relocs));
-static bfd_boolean elfNN_ia64_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
-static long global_sym_index
- PARAMS ((struct elf_link_hash_entry *h));
-static bfd_boolean allocate_fptr
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean allocate_global_data_got
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean allocate_global_fptr_got
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean allocate_local_got
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean allocate_pltoff_entries
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean allocate_plt_entries
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean allocate_plt2_entries
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean allocate_dynrel_entries
- PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static bfd_boolean elfNN_ia64_size_dynamic_sections
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
-static bfd_reloc_status_type elfNN_ia64_install_value
- PARAMS ((bfd *abfd, bfd_byte *hit_addr, bfd_vma val, unsigned int r_type));
-static void elfNN_ia64_install_dyn_reloc
- PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec,
- asection *srel, bfd_vma offset, unsigned int type,
- long dynindx, bfd_vma addend));
-static bfd_vma set_got_entry
- PARAMS ((bfd *abfd, struct bfd_link_info *info,
- struct elfNN_ia64_dyn_sym_info *dyn_i, long dynindx,
- bfd_vma addend, bfd_vma value, unsigned int dyn_r_type));
-static bfd_vma set_fptr_entry
- PARAMS ((bfd *abfd, struct bfd_link_info *info,
- struct elfNN_ia64_dyn_sym_info *dyn_i,
- bfd_vma value));
-static bfd_vma set_pltoff_entry
- PARAMS ((bfd *abfd, struct bfd_link_info *info,
- struct elfNN_ia64_dyn_sym_info *dyn_i,
- bfd_vma value, bfd_boolean));
-static bfd_vma elfNN_ia64_tprel_base
- PARAMS ((struct bfd_link_info *info));
-static bfd_vma elfNN_ia64_dtprel_base
- PARAMS ((struct bfd_link_info *info));
-static int elfNN_ia64_unwind_entry_compare
- PARAMS ((const PTR, const PTR));
-static bfd_boolean elfNN_ia64_choose_gp
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static bfd_boolean elfNN_ia64_final_link
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static bfd_boolean elfNN_ia64_relocate_section
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd,
- asection *input_section, bfd_byte *contents,
- Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
- asection **local_sections));
-static bfd_boolean elfNN_ia64_finish_dynamic_symbol
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
-static bfd_boolean elfNN_ia64_finish_dynamic_sections
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static bfd_boolean elfNN_ia64_set_private_flags
- PARAMS ((bfd *abfd, flagword flags));
-static bfd_boolean elfNN_ia64_merge_private_bfd_data
- PARAMS ((bfd *ibfd, bfd *obfd));
-static bfd_boolean elfNN_ia64_print_private_bfd_data
- PARAMS ((bfd *abfd, PTR ptr));
-static enum elf_reloc_type_class elfNN_ia64_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static bfd_boolean elfNN_ia64_hpux_vec
- PARAMS ((const bfd_target *vec));
-static void elfNN_hpux_post_process_headers
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-bfd_boolean elfNN_hpux_backend_section_from_bfd_section
- PARAMS ((bfd *abfd, asection *sec, int *retval));
-
-/* ia64-specific relocation. */
-
-/* Perform a relocation. Not much to do here as all the hard work is
- done in elfNN_ia64_final_link_relocate. */
-static bfd_reloc_status_type
-elfNN_ia64_reloc (abfd, reloc, sym, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc;
- asymbol *sym ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- if (output_bfd)
- {
- reloc->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (input_section->flags & SEC_DEBUGGING)
- return bfd_reloc_continue;
-
- *error_message = "Unsupported call to elfNN_ia64_reloc";
- return bfd_reloc_notsupported;
-}
-
-#define IA64_HOWTO(TYPE, NAME, SIZE, PCREL, IN) \
- HOWTO (TYPE, 0, SIZE, 0, PCREL, 0, complain_overflow_signed, \
- elfNN_ia64_reloc, NAME, FALSE, 0, -1, IN)
-
-/* This table has to be sorted according to increasing number of the
- TYPE field. */
-static reloc_howto_type ia64_howto_table[] =
- {
- IA64_HOWTO (R_IA64_NONE, "NONE", 0, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_IMM14, "IMM14", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_IMM22, "IMM22", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_IMM64, "IMM64", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_DIR32MSB, "DIR32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_DIR32LSB, "DIR32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_DIR64MSB, "DIR64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_DIR64LSB, "DIR64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_GPREL22, "GPREL22", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_GPREL64I, "GPREL64I", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_GPREL32MSB, "GPREL32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_GPREL32LSB, "GPREL32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_GPREL64MSB, "GPREL64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_GPREL64LSB, "GPREL64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_LTOFF22, "LTOFF22", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTOFF64I, "LTOFF64I", 0, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_PLTOFF22, "PLTOFF22", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_PLTOFF64I, "PLTOFF64I", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_PLTOFF64MSB, "PLTOFF64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_PLTOFF64LSB, "PLTOFF64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_FPTR64I, "FPTR64I", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_FPTR32MSB, "FPTR32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_FPTR32LSB, "FPTR32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_FPTR64MSB, "FPTR64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_FPTR64LSB, "FPTR64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_PCREL60B, "PCREL60B", 0, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL21B, "PCREL21B", 0, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL21M, "PCREL21M", 0, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL21F, "PCREL21F", 0, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL32MSB, "PCREL32MSB", 2, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL32LSB, "PCREL32LSB", 2, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL64MSB, "PCREL64MSB", 4, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL64LSB, "PCREL64LSB", 4, TRUE, TRUE),
-
- IA64_HOWTO (R_IA64_LTOFF_FPTR22, "LTOFF_FPTR22", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTOFF_FPTR64I, "LTOFF_FPTR64I", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTOFF_FPTR32MSB, "LTOFF_FPTR32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTOFF_FPTR32LSB, "LTOFF_FPTR32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTOFF_FPTR64MSB, "LTOFF_FPTR64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTOFF_FPTR64LSB, "LTOFF_FPTR64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_SEGREL32MSB, "SEGREL32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_SEGREL32LSB, "SEGREL32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_SEGREL64MSB, "SEGREL64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_SEGREL64LSB, "SEGREL64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_SECREL32MSB, "SECREL32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_SECREL32LSB, "SECREL32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_SECREL64MSB, "SECREL64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_SECREL64LSB, "SECREL64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_REL32MSB, "REL32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_REL32LSB, "REL32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_REL64MSB, "REL64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_REL64LSB, "REL64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_LTV32MSB, "LTV32MSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTV32LSB, "LTV32LSB", 2, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTV64MSB, "LTV64MSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTV64LSB, "LTV64LSB", 4, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_PCREL21BI, "PCREL21BI", 0, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL22, "PCREL22", 0, TRUE, TRUE),
- IA64_HOWTO (R_IA64_PCREL64I, "PCREL64I", 0, TRUE, TRUE),
-
- IA64_HOWTO (R_IA64_IPLTMSB, "IPLTMSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_IPLTLSB, "IPLTLSB", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_COPY, "COPY", 4, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LTOFF22X, "LTOFF22X", 0, FALSE, TRUE),
- IA64_HOWTO (R_IA64_LDXMOV, "LDXMOV", 0, FALSE, TRUE),
-
- IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, FALSE, FALSE),
-
- IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, FALSE, FALSE),
-
- IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 2, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 2, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, FALSE, FALSE),
- };
-
-static unsigned char elf_code_to_howto_index[R_IA64_MAX_RELOC_CODE + 1];
-
-/* Given a BFD reloc type, return the matching HOWTO structure. */
-
-static reloc_howto_type *
-lookup_howto (rtype)
- unsigned int rtype;
-{
- static int inited = 0;
- int i;
-
- if (!inited)
- {
- inited = 1;
-
- memset (elf_code_to_howto_index, 0xff, sizeof (elf_code_to_howto_index));
- for (i = 0; i < NELEMS (ia64_howto_table); ++i)
- elf_code_to_howto_index[ia64_howto_table[i].type] = i;
- }
-
- BFD_ASSERT (rtype <= R_IA64_MAX_RELOC_CODE);
- i = elf_code_to_howto_index[rtype];
- if (i >= NELEMS (ia64_howto_table))
- return 0;
- return ia64_howto_table + i;
-}
-
-static reloc_howto_type*
-elfNN_ia64_reloc_type_lookup (abfd, bfd_code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type bfd_code;
-{
- unsigned int rtype;
-
- switch (bfd_code)
- {
- case BFD_RELOC_NONE: rtype = R_IA64_NONE; break;
-
- case BFD_RELOC_IA64_IMM14: rtype = R_IA64_IMM14; break;
- case BFD_RELOC_IA64_IMM22: rtype = R_IA64_IMM22; break;
- case BFD_RELOC_IA64_IMM64: rtype = R_IA64_IMM64; break;
-
- case BFD_RELOC_IA64_DIR32MSB: rtype = R_IA64_DIR32MSB; break;
- case BFD_RELOC_IA64_DIR32LSB: rtype = R_IA64_DIR32LSB; break;
- case BFD_RELOC_IA64_DIR64MSB: rtype = R_IA64_DIR64MSB; break;
- case BFD_RELOC_IA64_DIR64LSB: rtype = R_IA64_DIR64LSB; break;
-
- case BFD_RELOC_IA64_GPREL22: rtype = R_IA64_GPREL22; break;
- case BFD_RELOC_IA64_GPREL64I: rtype = R_IA64_GPREL64I; break;
- case BFD_RELOC_IA64_GPREL32MSB: rtype = R_IA64_GPREL32MSB; break;
- case BFD_RELOC_IA64_GPREL32LSB: rtype = R_IA64_GPREL32LSB; break;
- case BFD_RELOC_IA64_GPREL64MSB: rtype = R_IA64_GPREL64MSB; break;
- case BFD_RELOC_IA64_GPREL64LSB: rtype = R_IA64_GPREL64LSB; break;
-
- case BFD_RELOC_IA64_LTOFF22: rtype = R_IA64_LTOFF22; break;
- case BFD_RELOC_IA64_LTOFF64I: rtype = R_IA64_LTOFF64I; break;
-
- case BFD_RELOC_IA64_PLTOFF22: rtype = R_IA64_PLTOFF22; break;
- case BFD_RELOC_IA64_PLTOFF64I: rtype = R_IA64_PLTOFF64I; break;
- case BFD_RELOC_IA64_PLTOFF64MSB: rtype = R_IA64_PLTOFF64MSB; break;
- case BFD_RELOC_IA64_PLTOFF64LSB: rtype = R_IA64_PLTOFF64LSB; break;
- case BFD_RELOC_IA64_FPTR64I: rtype = R_IA64_FPTR64I; break;
- case BFD_RELOC_IA64_FPTR32MSB: rtype = R_IA64_FPTR32MSB; break;
- case BFD_RELOC_IA64_FPTR32LSB: rtype = R_IA64_FPTR32LSB; break;
- case BFD_RELOC_IA64_FPTR64MSB: rtype = R_IA64_FPTR64MSB; break;
- case BFD_RELOC_IA64_FPTR64LSB: rtype = R_IA64_FPTR64LSB; break;
-
- case BFD_RELOC_IA64_PCREL21B: rtype = R_IA64_PCREL21B; break;
- case BFD_RELOC_IA64_PCREL21BI: rtype = R_IA64_PCREL21BI; break;
- case BFD_RELOC_IA64_PCREL21M: rtype = R_IA64_PCREL21M; break;
- case BFD_RELOC_IA64_PCREL21F: rtype = R_IA64_PCREL21F; break;
- case BFD_RELOC_IA64_PCREL22: rtype = R_IA64_PCREL22; break;
- case BFD_RELOC_IA64_PCREL60B: rtype = R_IA64_PCREL60B; break;
- case BFD_RELOC_IA64_PCREL64I: rtype = R_IA64_PCREL64I; break;
- case BFD_RELOC_IA64_PCREL32MSB: rtype = R_IA64_PCREL32MSB; break;
- case BFD_RELOC_IA64_PCREL32LSB: rtype = R_IA64_PCREL32LSB; break;
- case BFD_RELOC_IA64_PCREL64MSB: rtype = R_IA64_PCREL64MSB; break;
- case BFD_RELOC_IA64_PCREL64LSB: rtype = R_IA64_PCREL64LSB; break;
-
- case BFD_RELOC_IA64_LTOFF_FPTR22: rtype = R_IA64_LTOFF_FPTR22; break;
- case BFD_RELOC_IA64_LTOFF_FPTR64I: rtype = R_IA64_LTOFF_FPTR64I; break;
- case BFD_RELOC_IA64_LTOFF_FPTR32MSB: rtype = R_IA64_LTOFF_FPTR32MSB; break;
- case BFD_RELOC_IA64_LTOFF_FPTR32LSB: rtype = R_IA64_LTOFF_FPTR32LSB; break;
- case BFD_RELOC_IA64_LTOFF_FPTR64MSB: rtype = R_IA64_LTOFF_FPTR64MSB; break;
- case BFD_RELOC_IA64_LTOFF_FPTR64LSB: rtype = R_IA64_LTOFF_FPTR64LSB; break;
-
- case BFD_RELOC_IA64_SEGREL32MSB: rtype = R_IA64_SEGREL32MSB; break;
- case BFD_RELOC_IA64_SEGREL32LSB: rtype = R_IA64_SEGREL32LSB; break;
- case BFD_RELOC_IA64_SEGREL64MSB: rtype = R_IA64_SEGREL64MSB; break;
- case BFD_RELOC_IA64_SEGREL64LSB: rtype = R_IA64_SEGREL64LSB; break;
-
- case BFD_RELOC_IA64_SECREL32MSB: rtype = R_IA64_SECREL32MSB; break;
- case BFD_RELOC_IA64_SECREL32LSB: rtype = R_IA64_SECREL32LSB; break;
- case BFD_RELOC_IA64_SECREL64MSB: rtype = R_IA64_SECREL64MSB; break;
- case BFD_RELOC_IA64_SECREL64LSB: rtype = R_IA64_SECREL64LSB; break;
-
- case BFD_RELOC_IA64_REL32MSB: rtype = R_IA64_REL32MSB; break;
- case BFD_RELOC_IA64_REL32LSB: rtype = R_IA64_REL32LSB; break;
- case BFD_RELOC_IA64_REL64MSB: rtype = R_IA64_REL64MSB; break;
- case BFD_RELOC_IA64_REL64LSB: rtype = R_IA64_REL64LSB; break;
-
- case BFD_RELOC_IA64_LTV32MSB: rtype = R_IA64_LTV32MSB; break;
- case BFD_RELOC_IA64_LTV32LSB: rtype = R_IA64_LTV32LSB; break;
- case BFD_RELOC_IA64_LTV64MSB: rtype = R_IA64_LTV64MSB; break;
- case BFD_RELOC_IA64_LTV64LSB: rtype = R_IA64_LTV64LSB; break;
-
- case BFD_RELOC_IA64_IPLTMSB: rtype = R_IA64_IPLTMSB; break;
- case BFD_RELOC_IA64_IPLTLSB: rtype = R_IA64_IPLTLSB; break;
- case BFD_RELOC_IA64_COPY: rtype = R_IA64_COPY; break;
- case BFD_RELOC_IA64_LTOFF22X: rtype = R_IA64_LTOFF22X; break;
- case BFD_RELOC_IA64_LDXMOV: rtype = R_IA64_LDXMOV; break;
-
- case BFD_RELOC_IA64_TPREL14: rtype = R_IA64_TPREL14; break;
- case BFD_RELOC_IA64_TPREL22: rtype = R_IA64_TPREL22; break;
- case BFD_RELOC_IA64_TPREL64I: rtype = R_IA64_TPREL64I; break;
- case BFD_RELOC_IA64_TPREL64MSB: rtype = R_IA64_TPREL64MSB; break;
- case BFD_RELOC_IA64_TPREL64LSB: rtype = R_IA64_TPREL64LSB; break;
- case BFD_RELOC_IA64_LTOFF_TPREL22: rtype = R_IA64_LTOFF_TPREL22; break;
-
- case BFD_RELOC_IA64_DTPMOD64MSB: rtype = R_IA64_DTPMOD64MSB; break;
- case BFD_RELOC_IA64_DTPMOD64LSB: rtype = R_IA64_DTPMOD64LSB; break;
- case BFD_RELOC_IA64_LTOFF_DTPMOD22: rtype = R_IA64_LTOFF_DTPMOD22; break;
-
- case BFD_RELOC_IA64_DTPREL14: rtype = R_IA64_DTPREL14; break;
- case BFD_RELOC_IA64_DTPREL22: rtype = R_IA64_DTPREL22; break;
- case BFD_RELOC_IA64_DTPREL64I: rtype = R_IA64_DTPREL64I; break;
- case BFD_RELOC_IA64_DTPREL32MSB: rtype = R_IA64_DTPREL32MSB; break;
- case BFD_RELOC_IA64_DTPREL32LSB: rtype = R_IA64_DTPREL32LSB; break;
- case BFD_RELOC_IA64_DTPREL64MSB: rtype = R_IA64_DTPREL64MSB; break;
- case BFD_RELOC_IA64_DTPREL64LSB: rtype = R_IA64_DTPREL64LSB; break;
- case BFD_RELOC_IA64_LTOFF_DTPREL22: rtype = R_IA64_LTOFF_DTPREL22; break;
-
- default: return 0;
- }
- return lookup_howto (rtype);
-}
-
-/* Given a ELF reloc, return the matching HOWTO structure. */
-
-static void
-elfNN_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *bfd_reloc;
- Elf_Internal_Rela *elf_reloc;
-{
- bfd_reloc->howto
- = lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info));
-}
-
-#define PLT_HEADER_SIZE (3 * 16)
-#define PLT_MIN_ENTRY_SIZE (1 * 16)
-#define PLT_FULL_ENTRY_SIZE (2 * 16)
-#define PLT_RESERVED_WORDS 3
-
-static const bfd_byte plt_header[PLT_HEADER_SIZE] =
-{
- 0x0b, 0x10, 0x00, 0x1c, 0x00, 0x21, /* [MMI] mov r2=r14;; */
- 0xe0, 0x00, 0x08, 0x00, 0x48, 0x00, /* addl r14=0,r2 */
- 0x00, 0x00, 0x04, 0x00, /* nop.i 0x0;; */
- 0x0b, 0x80, 0x20, 0x1c, 0x18, 0x14, /* [MMI] ld8 r16=[r14],8;; */
- 0x10, 0x41, 0x38, 0x30, 0x28, 0x00, /* ld8 r17=[r14],8 */
- 0x00, 0x00, 0x04, 0x00, /* nop.i 0x0;; */
- 0x11, 0x08, 0x00, 0x1c, 0x18, 0x10, /* [MIB] ld8 r1=[r14] */
- 0x60, 0x88, 0x04, 0x80, 0x03, 0x00, /* mov b6=r17 */
- 0x60, 0x00, 0x80, 0x00 /* br.few b6;; */
-};
-
-static const bfd_byte plt_min_entry[PLT_MIN_ENTRY_SIZE] =
-{
- 0x11, 0x78, 0x00, 0x00, 0x00, 0x24, /* [MIB] mov r15=0 */
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* nop.i 0x0 */
- 0x00, 0x00, 0x00, 0x40 /* br.few 0 <PLT0>;; */
-};
-
-static const bfd_byte plt_full_entry[PLT_FULL_ENTRY_SIZE] =
-{
- 0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, /* [MMI] addl r15=0,r1;; */
- 0x00, 0x41, 0x3c, 0x70, 0x29, 0xc0, /* ld8.acq r16=[r15],8*/
- 0x01, 0x08, 0x00, 0x84, /* mov r14=r1;; */
- 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, /* [MIB] ld8 r1=[r15] */
- 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, /* mov b6=r16 */
- 0x60, 0x00, 0x80, 0x00 /* br.few b6;; */
-};
-
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-
-static const bfd_byte oor_brl[16] =
-{
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MLX] nop.m 0 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* brl.sptk.few tgt;; */
- 0x00, 0x00, 0x00, 0xc0
-};
-
-static const bfd_byte oor_ip[48] =
-{
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MLX] nop.m 0 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, /* movl r15=0 */
- 0x01, 0x00, 0x00, 0x60,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MII] nop.m 0 */
- 0x00, 0x01, 0x00, 0x60, 0x00, 0x00, /* mov r16=ip;; */
- 0xf2, 0x80, 0x00, 0x80, /* add r16=r15,r16;; */
- 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MIB] nop.m 0 */
- 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, /* mov b6=r16 */
- 0x60, 0x00, 0x80, 0x00 /* br b6;; */
-};
-
-static size_t oor_branch_size = sizeof (oor_brl);
-
-void
-bfd_elfNN_ia64_after_parse (int itanium)
-{
- oor_branch_size = itanium ? sizeof (oor_ip) : sizeof (oor_brl);
-}
-
-static void
-elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off)
-{
- int template;
- bfd_byte *hit_addr;
- bfd_vma t0, t1, i0, i1, i2;
-
- hit_addr = (bfd_byte *) (contents + off);
- hit_addr -= (long) hit_addr & 0x3;
- t0 = bfd_get_64 (abfd, hit_addr);
- t1 = bfd_get_64 (abfd, hit_addr + 8);
-
- /* Keep the instruction in slot 0. */
- i0 = (t0 >> 5) & 0x1ffffffffffLL;
- /* Use nop.b for slot 1. */
- i1 = 0x4000000000LL;
- /* For slot 2, turn brl into br by masking out bit 40. */
- i2 = (t1 >> 23) & 0x0ffffffffffLL;
-
- /* Turn a MLX bundle into a MBB bundle with the same stop-bit
- variety. */
- template = 0x12;
- if ((t0 & 0x1fLL) == 5)
- template += 1;
- t0 = (i1 << 46) | (i0 << 5) | template;
- t1 = (i2 << 23) | (i1 >> 18);
-
- bfd_put_64 (abfd, t0, hit_addr);
- bfd_put_64 (abfd, t1, hit_addr + 8);
-}
-
-/* These functions do relaxation for IA-64 ELF. */
-
-static bfd_boolean
-elfNN_ia64_relax_section (abfd, sec, link_info, again)
- bfd *abfd;
- asection *sec;
- struct bfd_link_info *link_info;
- bfd_boolean *again;
-{
- struct one_fixup
- {
- struct one_fixup *next;
- asection *tsec;
- bfd_vma toff;
- bfd_vma trampoff;
- };
-
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Rela *internal_relocs;
- Elf_Internal_Rela *irel, *irelend;
- bfd_byte *contents;
- Elf_Internal_Sym *isymbuf = NULL;
- struct elfNN_ia64_link_hash_table *ia64_info;
- struct one_fixup *fixups = NULL;
- bfd_boolean changed_contents = FALSE;
- bfd_boolean changed_relocs = FALSE;
- bfd_boolean changed_got = FALSE;
- bfd_vma gp = 0;
-
- /* Assume we're not going to change any sizes, and we'll only need
- one pass. */
- *again = FALSE;
-
- /* Don't even try to relax for non-ELF outputs. */
- if (!is_elf_hash_table (link_info->hash))
- return FALSE;
-
- /* Nothing to do if there are no relocations or there is no need for
- the relax finalize pass. */
- if ((sec->flags & SEC_RELOC) == 0
- || sec->reloc_count == 0
- || (!link_info->need_relax_finalize
- && sec->need_finalize_relax == 0))
- return TRUE;
-
- /* If this is the first time we have been called for this section,
- initialize the cooked size. */
- if (sec->_cooked_size == 0)
- sec->_cooked_size = sec->_raw_size;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-
- /* Load the relocations for this section. */
- internal_relocs = (_bfd_elf_link_read_relocs
- (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
- link_info->keep_memory));
- if (internal_relocs == NULL)
- return FALSE;
-
- ia64_info = elfNN_ia64_hash_table (link_info);
- irelend = internal_relocs + sec->reloc_count;
-
- /* Get the section contents. */
- if (elf_section_data (sec)->this_hdr.contents != NULL)
- contents = elf_section_data (sec)->this_hdr.contents;
- else
- {
- contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
- if (contents == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, sec, contents,
- (file_ptr) 0, sec->_raw_size))
- goto error_return;
- }
-
- for (irel = internal_relocs; irel < irelend; irel++)
- {
- unsigned long r_type = ELFNN_R_TYPE (irel->r_info);
- bfd_vma symaddr, reladdr, trampoff, toff, roff;
- asection *tsec;
- struct one_fixup *f;
- bfd_size_type amt;
- bfd_boolean is_branch;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
-
- switch (r_type)
- {
- case R_IA64_PCREL21B:
- case R_IA64_PCREL21BI:
- case R_IA64_PCREL21M:
- case R_IA64_PCREL21F:
- /* In the finalize pass, all br relaxations are done. We can
- skip it. */
- if (!link_info->need_relax_finalize)
- continue;
- is_branch = TRUE;
- break;
-
- case R_IA64_PCREL60B:
- /* We can't optimize brl to br before the finalize pass since
- br relaxations will increase the code size. Defer it to
- the finalize pass. */
- if (link_info->need_relax_finalize)
- {
- sec->need_finalize_relax = 1;
- continue;
- }
- is_branch = TRUE;
- break;
-
- case R_IA64_LTOFF22X:
- case R_IA64_LDXMOV:
- /* We can't relax ldx/mov before the finalize pass since
- br relaxations will increase the code size. Defer it to
- the finalize pass. */
- if (link_info->need_relax_finalize)
- {
- sec->need_finalize_relax = 1;
- continue;
- }
- is_branch = FALSE;
- break;
-
- default:
- continue;
- }
-
- /* Get the value of the symbol referred to by the reloc. */
- if (ELFNN_R_SYM (irel->r_info) < symtab_hdr->sh_info)
- {
- /* A local symbol. */
- Elf_Internal_Sym *isym;
-
- /* Read this BFD's local symbols. */
- if (isymbuf == NULL)
- {
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == 0)
- goto error_return;
- }
-
- isym = isymbuf + ELFNN_R_SYM (irel->r_info);
- if (isym->st_shndx == SHN_UNDEF)
- continue; /* We can't do anything with undefined symbols. */
- else if (isym->st_shndx == SHN_ABS)
- tsec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- tsec = bfd_com_section_ptr;
- else if (isym->st_shndx == SHN_IA_64_ANSI_COMMON)
- tsec = bfd_com_section_ptr;
- else
- tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
-
- toff = isym->st_value;
- dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE);
- }
- else
- {
- unsigned long indx;
- struct elf_link_hash_entry *h;
-
- indx = ELFNN_R_SYM (irel->r_info) - symtab_hdr->sh_info;
- h = elf_sym_hashes (abfd)[indx];
- BFD_ASSERT (h != NULL);
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- dyn_i = get_dyn_sym_info (ia64_info, h, abfd, irel, FALSE);
-
- /* For branches to dynamic symbols, we're interested instead
- in a branch to the PLT entry. */
- if (is_branch && dyn_i && dyn_i->want_plt2)
- {
- /* Internal branches shouldn't be sent to the PLT.
- Leave this for now and we'll give an error later. */
- if (r_type != R_IA64_PCREL21B)
- continue;
-
- tsec = ia64_info->plt_sec;
- toff = dyn_i->plt2_offset;
- BFD_ASSERT (irel->r_addend == 0);
- }
-
- /* Can't do anything else with dynamic symbols. */
- else if (elfNN_ia64_dynamic_symbol_p (h, link_info, r_type))
- continue;
-
- else
- {
- /* We can't do anything with undefined symbols. */
- if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- continue;
-
- tsec = h->root.u.def.section;
- toff = h->root.u.def.value;
- }
- }
-
- if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE)
- toff = _bfd_merged_section_offset (abfd, &tsec,
- elf_section_data (tsec)->sec_info,
- toff + irel->r_addend,
- (bfd_vma) 0);
- else
- toff += irel->r_addend;
-
- symaddr = tsec->output_section->vma + tsec->output_offset + toff;
-
- roff = irel->r_offset;
-
- if (is_branch)
- {
- bfd_signed_vma offset;
-
- reladdr = (sec->output_section->vma
- + sec->output_offset
- + roff) & (bfd_vma) -4;
-
- /* If the branch is in range, no need to do anything. */
- if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000
- && (bfd_signed_vma) (symaddr - reladdr) <= 0x0FFFFF0)
- {
- /* If the 60-bit branch is in 21-bit range, optimize it. */
- if (r_type == R_IA64_PCREL60B)
- {
- elfNN_ia64_relax_brl (abfd, contents, roff);
-
- irel->r_info
- = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
- R_IA64_PCREL21B);
-
- /* If the original relocation offset points to slot
- 1, change it to slot 2. */
- if ((irel->r_offset & 3) == 1)
- irel->r_offset += 1;
- }
-
- continue;
- }
- else if (r_type == R_IA64_PCREL60B)
- continue;
-
- /* If the branch and target are in the same section, you've
- got one honking big section and we can't help you. You'll
- get an error message later. */
- if (tsec == sec)
- continue;
-
- /* Look for an existing fixup to this address. */
- for (f = fixups; f ; f = f->next)
- if (f->tsec == tsec && f->toff == toff)
- break;
-
- if (f == NULL)
- {
- /* Two alternatives: If it's a branch to a PLT entry, we can
- make a copy of the FULL_PLT entry. Otherwise, we'll have
- to use a `brl' insn to get where we're going. */
-
- size_t size;
-
- if (tsec == ia64_info->plt_sec)
- size = sizeof (plt_full_entry);
- else
- size = oor_branch_size;
-
- /* Resize the current section to make room for the new branch. */
- trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
-
- /* If trampoline is out of range, there is nothing we
- can do. */
- offset = trampoff - (roff & (bfd_vma) -4);
- if (offset < -0x1000000 || offset > 0x0FFFFF0)
- continue;
-
- amt = trampoff + size;
- contents = (bfd_byte *) bfd_realloc (contents, amt);
- if (contents == NULL)
- goto error_return;
- sec->_cooked_size = amt;
-
- if (tsec == ia64_info->plt_sec)
- {
- memcpy (contents + trampoff, plt_full_entry, size);
-
- /* Hijack the old relocation for use as the PLTOFF reloc. */
- irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
- R_IA64_PLTOFF22);
- irel->r_offset = trampoff;
- }
- else
- {
- if (size == sizeof (oor_ip))
- {
- memcpy (contents + trampoff, oor_ip, size);
- irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
- R_IA64_PCREL64I);
- irel->r_addend -= 16;
- irel->r_offset = trampoff + 2;
- }
- else
- {
- memcpy (contents + trampoff, oor_brl, size);
- irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
- R_IA64_PCREL60B);
- irel->r_offset = trampoff + 2;
- }
-
- }
-
- /* Record the fixup so we don't do it again this section. */
- f = (struct one_fixup *)
- bfd_malloc ((bfd_size_type) sizeof (*f));
- f->next = fixups;
- f->tsec = tsec;
- f->toff = toff;
- f->trampoff = trampoff;
- fixups = f;
- }
- else
- {
- /* If trampoline is out of range, there is nothing we
- can do. */
- offset = f->trampoff - (roff & (bfd_vma) -4);
- if (offset < -0x1000000 || offset > 0x0FFFFF0)
- continue;
-
- /* Nop out the reloc, since we're finalizing things here. */
- irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
- }
-
- /* Fix up the existing branch to hit the trampoline. */
- if (elfNN_ia64_install_value (abfd, contents + roff, offset,
- r_type) != bfd_reloc_ok)
- goto error_return;
-
- changed_contents = TRUE;
- changed_relocs = TRUE;
- }
- else
- {
- /* Fetch the gp. */
- if (gp == 0)
- {
- bfd *obfd = sec->output_section->owner;
- gp = _bfd_get_gp_value (obfd);
- if (gp == 0)
- {
- if (!elfNN_ia64_choose_gp (obfd, link_info))
- goto error_return;
- gp = _bfd_get_gp_value (obfd);
- }
- }
-
- /* If the data is out of range, do nothing. */
- if ((bfd_signed_vma) (symaddr - gp) >= 0x200000
- ||(bfd_signed_vma) (symaddr - gp) < -0x200000)
- continue;
-
- if (r_type == R_IA64_LTOFF22X)
- {
- irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
- R_IA64_GPREL22);
- changed_relocs = TRUE;
- if (dyn_i->want_gotx)
- {
- dyn_i->want_gotx = 0;
- changed_got |= !dyn_i->want_got;
- }
- }
- else
- {
- elfNN_ia64_relax_ldxmov (abfd, contents, roff);
- irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
- changed_contents = TRUE;
- changed_relocs = TRUE;
- }
- }
- }
-
- /* ??? If we created fixups, this may push the code segment large
- enough that the data segment moves, which will change the GP.
- Reset the GP so that we re-calculate next round. We need to
- do this at the _beginning_ of the next round; now will not do. */
-
- /* Clean up and go home. */
- while (fixups)
- {
- struct one_fixup *f = fixups;
- fixups = fixups->next;
- free (f);
- }
-
- if (isymbuf != NULL
- && symtab_hdr->contents != (unsigned char *) isymbuf)
- {
- if (! link_info->keep_memory)
- free (isymbuf);
- else
- {
- /* Cache the symbols for elf_link_input_bfd. */
- symtab_hdr->contents = (unsigned char *) isymbuf;
- }
- }
-
- if (contents != NULL
- && elf_section_data (sec)->this_hdr.contents != contents)
- {
- if (!changed_contents && !link_info->keep_memory)
- free (contents);
- else
- {
- /* Cache the section contents for elf_link_input_bfd. */
- elf_section_data (sec)->this_hdr.contents = contents;
- }
- }
-
- if (elf_section_data (sec)->relocs != internal_relocs)
- {
- if (!changed_relocs)
- free (internal_relocs);
- else
- elf_section_data (sec)->relocs = internal_relocs;
- }
-
- if (changed_got)
- {
- struct elfNN_ia64_allocate_data data;
- data.info = link_info;
- data.ofs = 0;
- ia64_info->self_dtpmod_offset = (bfd_vma) -1;
-
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data);
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data);
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data);
- ia64_info->got_sec->_raw_size = data.ofs;
- ia64_info->got_sec->_cooked_size = data.ofs;
-
- /* ??? Resize .rela.got too. */
- }
-
- if (!link_info->need_relax_finalize)
- sec->need_finalize_relax = 0;
-
- *again = changed_contents || changed_relocs;
- return TRUE;
-
- error_return:
- if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
- free (isymbuf);
- if (contents != NULL
- && elf_section_data (sec)->this_hdr.contents != contents)
- free (contents);
- if (internal_relocs != NULL
- && elf_section_data (sec)->relocs != internal_relocs)
- free (internal_relocs);
- return FALSE;
-}
-
-static void
-elfNN_ia64_relax_ldxmov (abfd, contents, off)
- bfd *abfd;
- bfd_byte *contents;
- bfd_vma off;
-{
- int shift, r1, r3;
- bfd_vma dword, insn;
-
- switch ((int)off & 0x3)
- {
- case 0: shift = 5; break;
- case 1: shift = 14; off += 3; break;
- case 2: shift = 23; off += 6; break;
- default:
- abort ();
- }
-
- dword = bfd_get_64 (abfd, contents + off);
- insn = (dword >> shift) & 0x1ffffffffffLL;
-
- r1 = (insn >> 6) & 127;
- r3 = (insn >> 20) & 127;
- if (r1 == r3)
- insn = 0x8000000; /* nop */
- else
- insn = (insn & 0x7f01fff) | 0x10800000000LL; /* (qp) mov r1 = r3 */
-
- dword &= ~(0x1ffffffffffLL << shift);
- dword |= (insn << shift);
- bfd_put_64 (abfd, dword, contents + off);
-}
-
-/* Return TRUE if NAME is an unwind table section name. */
-
-static inline bfd_boolean
-is_unwind_section_name (abfd, name)
- bfd *abfd;
- const char *name;
-{
- size_t len1, len2, len3;
-
- if (elfNN_ia64_hpux_vec (abfd->xvec)
- && !strcmp (name, ELF_STRING_ia64_unwind_hdr))
- return FALSE;
-
- len1 = sizeof (ELF_STRING_ia64_unwind) - 1;
- len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
- len3 = sizeof (ELF_STRING_ia64_unwind_once) - 1;
- return ((strncmp (name, ELF_STRING_ia64_unwind, len1) == 0
- && strncmp (name, ELF_STRING_ia64_unwind_info, len2) != 0)
- || strncmp (name, ELF_STRING_ia64_unwind_once, len3) == 0);
-}
-
-/* Handle an IA-64 specific section when reading an object file. This
- is called when elfcode.h finds a section with an unknown type. */
-
-static bfd_boolean
-elfNN_ia64_section_from_shdr (abfd, hdr, name)
- bfd *abfd;
- Elf_Internal_Shdr *hdr;
- const char *name;
-{
- asection *newsect;
-
- /* There ought to be a place to keep ELF backend specific flags, but
- at the moment there isn't one. We just keep track of the
- sections by their name, instead. Fortunately, the ABI gives
- suggested names for all the MIPS specific sections, so we will
- probably get away with this. */
- switch (hdr->sh_type)
- {
- case SHT_IA_64_UNWIND:
- case SHT_IA_64_HP_OPT_ANOT:
- break;
-
- case SHT_IA_64_EXT:
- if (strcmp (name, ELF_STRING_ia64_archext) != 0)
- return FALSE;
- break;
-
- default:
- return FALSE;
- }
-
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return FALSE;
- newsect = hdr->bfd_section;
-
- return TRUE;
-}
-
-/* Convert IA-64 specific section flags to bfd internal section flags. */
-
-/* ??? There is no bfd internal flag equivalent to the SHF_IA_64_NORECOV
- flag. */
-
-static bfd_boolean
-elfNN_ia64_section_flags (flags, hdr)
- flagword *flags;
- Elf_Internal_Shdr *hdr;
-{
- if (hdr->sh_flags & SHF_IA_64_SHORT)
- *flags |= SEC_SMALL_DATA;
-
- return TRUE;
-}
-
-/* Set the correct type for an IA-64 ELF section. We do this by the
- section name, which is a hack, but ought to work. */
-
-static bfd_boolean
-elfNN_ia64_fake_sections (abfd, hdr, sec)
- bfd *abfd ATTRIBUTE_UNUSED;
- Elf_Internal_Shdr *hdr;
- asection *sec;
-{
- register const char *name;
-
- name = bfd_get_section_name (abfd, sec);
-
- if (is_unwind_section_name (abfd, name))
- {
- /* We don't have the sections numbered at this point, so sh_info
- is set later, in elfNN_ia64_final_write_processing. */
- hdr->sh_type = SHT_IA_64_UNWIND;
- hdr->sh_flags |= SHF_LINK_ORDER;
- }
- else if (strcmp (name, ELF_STRING_ia64_archext) == 0)
- hdr->sh_type = SHT_IA_64_EXT;
- else if (strcmp (name, ".HP.opt_annot") == 0)
- hdr->sh_type = SHT_IA_64_HP_OPT_ANOT;
- else if (strcmp (name, ".reloc") == 0)
- /* This is an ugly, but unfortunately necessary hack that is
- needed when producing EFI binaries on IA-64. It tells
- elf.c:elf_fake_sections() not to consider ".reloc" as a section
- containing ELF relocation info. We need this hack in order to
- be able to generate ELF binaries that can be translated into
- EFI applications (which are essentially COFF objects). Those
- files contain a COFF ".reloc" section inside an ELFNN object,
- which would normally cause BFD to segfault because it would
- attempt to interpret this section as containing relocation
- entries for section "oc". With this hack enabled, ".reloc"
- will be treated as a normal data section, which will avoid the
- segfault. However, you won't be able to create an ELFNN binary
- with a section named "oc" that needs relocations, but that's
- the kind of ugly side-effects you get when detecting section
- types based on their names... In practice, this limitation is
- unlikely to bite. */
- hdr->sh_type = SHT_PROGBITS;
-
- if (sec->flags & SEC_SMALL_DATA)
- hdr->sh_flags |= SHF_IA_64_SHORT;
-
- return TRUE;
-}
-
-/* The final processing done just before writing out an IA-64 ELF
- object file. */
-
-static void
-elfNN_ia64_final_write_processing (abfd, linker)
- bfd *abfd;
- bfd_boolean linker ATTRIBUTE_UNUSED;
-{
- Elf_Internal_Shdr *hdr;
- const char *sname;
- asection *text_sect, *s;
- size_t len;
-
- for (s = abfd->sections; s; s = s->next)
- {
- hdr = &elf_section_data (s)->this_hdr;
- switch (hdr->sh_type)
- {
- case SHT_IA_64_UNWIND:
- /* See comments in gas/config/tc-ia64.c:dot_endp on why we
- have to do this. */
- sname = bfd_get_section_name (abfd, s);
- len = sizeof (ELF_STRING_ia64_unwind) - 1;
- if (sname && strncmp (sname, ELF_STRING_ia64_unwind, len) == 0)
- {
- sname += len;
-
- if (sname[0] == '\0')
- /* .IA_64.unwind -> .text */
- text_sect = bfd_get_section_by_name (abfd, ".text");
- else
- /* .IA_64.unwindFOO -> FOO */
- text_sect = bfd_get_section_by_name (abfd, sname);
- }
- else if (sname
- && (len = sizeof (ELF_STRING_ia64_unwind_once) - 1,
- strncmp (sname, ELF_STRING_ia64_unwind_once, len)) == 0)
- {
- /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.t.FOO */
- size_t len2 = sizeof (".gnu.linkonce.t.") - 1;
- char *once_name = bfd_malloc (len2 + strlen (sname + len) + 1);
-
- if (once_name != NULL)
- {
- memcpy (once_name, ".gnu.linkonce.t.", len2);
- strcpy (once_name + len2, sname + len);
- text_sect = bfd_get_section_by_name (abfd, once_name);
- free (once_name);
- }
- else
- /* Should only happen if we run out of memory, in
- which case we're probably toast anyway. Try to
- cope by finding the section the slow way. */
- for (text_sect = abfd->sections;
- text_sect != NULL;
- text_sect = text_sect->next)
- {
- if (strncmp (bfd_section_name (abfd, text_sect),
- ".gnu.linkonce.t.", len2) == 0
- && strcmp (bfd_section_name (abfd, text_sect) + len2,
- sname + len) == 0)
- break;
- }
- }
- else
- /* last resort: fall back on .text */
- text_sect = bfd_get_section_by_name (abfd, ".text");
-
- if (text_sect)
- {
- /* The IA-64 processor-specific ABI requires setting
- sh_link to the unwind section, whereas HP-UX requires
- sh_info to do so. For maximum compatibility, we'll
- set both for now... */
- hdr->sh_link = elf_section_data (text_sect)->this_idx;
- hdr->sh_info = elf_section_data (text_sect)->this_idx;
- }
- break;
- }
- }
-
- if (! elf_flags_init (abfd))
- {
- unsigned long flags = 0;
-
- if (abfd->xvec->byteorder == BFD_ENDIAN_BIG)
- flags |= EF_IA_64_BE;
- if (bfd_get_mach (abfd) == bfd_mach_ia64_elf64)
- flags |= EF_IA_64_ABI64;
-
- elf_elfheader(abfd)->e_flags = flags;
- elf_flags_init (abfd) = TRUE;
- }
-}
-
-/* Hook called by the linker routine which adds symbols from an object
- file. We use it to put .comm items in .sbss, and not .bss. */
-
-static bfd_boolean
-elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
- bfd *abfd;
- struct bfd_link_info *info;
- Elf_Internal_Sym *sym;
- const char **namep ATTRIBUTE_UNUSED;
- flagword *flagsp ATTRIBUTE_UNUSED;
- asection **secp;
- bfd_vma *valp;
-{
- if (sym->st_shndx == SHN_COMMON
- && !info->relocatable
- && sym->st_size <= elf_gp_size (abfd))
- {
- /* Common symbols less than or equal to -G nn bytes are
- automatically put into .sbss. */
-
- asection *scomm = bfd_get_section_by_name (abfd, ".scommon");
-
- if (scomm == NULL)
- {
- scomm = bfd_make_section (abfd, ".scommon");
- if (scomm == NULL
- || !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC
- | SEC_IS_COMMON
- | SEC_LINKER_CREATED)))
- return FALSE;
- }
-
- *secp = scomm;
- *valp = sym->st_size;
- }
-
- return TRUE;
-}
-
-/* Return the number of additional phdrs we will need. */
-
-static int
-elfNN_ia64_additional_program_headers (abfd)
- bfd *abfd;
-{
- asection *s;
- int ret = 0;
-
- /* See if we need a PT_IA_64_ARCHEXT segment. */
- s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_archext);
- if (s && (s->flags & SEC_LOAD))
- ++ret;
-
- /* Count how many PT_IA_64_UNWIND segments we need. */
- for (s = abfd->sections; s; s = s->next)
- if (is_unwind_section_name (abfd, s->name) && (s->flags & SEC_LOAD))
- ++ret;
-
- return ret;
-}
-
-static bfd_boolean
-elfNN_ia64_modify_segment_map (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
-{
- struct elf_segment_map *m, **pm;
- Elf_Internal_Shdr *hdr;
- asection *s;
-
- /* If we need a PT_IA_64_ARCHEXT segment, it must come before
- all PT_LOAD segments. */
- s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_archext);
- if (s && (s->flags & SEC_LOAD))
- {
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_IA_64_ARCHEXT)
- break;
- if (m == NULL)
- {
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
- if (m == NULL)
- return FALSE;
-
- m->p_type = PT_IA_64_ARCHEXT;
- m->count = 1;
- m->sections[0] = s;
-
- /* We want to put it after the PHDR and INTERP segments. */
- pm = &elf_tdata (abfd)->segment_map;
- while (*pm != NULL
- && ((*pm)->p_type == PT_PHDR
- || (*pm)->p_type == PT_INTERP))
- pm = &(*pm)->next;
-
- m->next = *pm;
- *pm = m;
- }
- }
-
- /* Install PT_IA_64_UNWIND segments, if needed. */
- for (s = abfd->sections; s; s = s->next)
- {
- hdr = &elf_section_data (s)->this_hdr;
- if (hdr->sh_type != SHT_IA_64_UNWIND)
- continue;
-
- if (s && (s->flags & SEC_LOAD))
- {
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_IA_64_UNWIND)
- {
- int i;
-
- /* Look through all sections in the unwind segment
- for a match since there may be multiple sections
- to a segment. */
- for (i = m->count - 1; i >= 0; --i)
- if (m->sections[i] == s)
- break;
-
- if (i >= 0)
- break;
- }
-
- if (m == NULL)
- {
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
- if (m == NULL)
- return FALSE;
-
- m->p_type = PT_IA_64_UNWIND;
- m->count = 1;
- m->sections[0] = s;
- m->next = NULL;
-
- /* We want to put it last. */
- pm = &elf_tdata (abfd)->segment_map;
- while (*pm != NULL)
- pm = &(*pm)->next;
- *pm = m;
- }
- }
- }
-
- /* Turn on PF_IA_64_NORECOV if needed. This involves traversing all of
- the input sections for each output section in the segment and testing
- for SHF_IA_64_NORECOV on each. */
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_LOAD)
- {
- int i;
- for (i = m->count - 1; i >= 0; --i)
- {
- struct bfd_link_order *order = m->sections[i]->link_order_head;
- while (order)
- {
- if (order->type == bfd_indirect_link_order)
- {
- asection *is = order->u.indirect.section;
- bfd_vma flags = elf_section_data(is)->this_hdr.sh_flags;
- if (flags & SHF_IA_64_NORECOV)
- {
- m->p_flags |= PF_IA_64_NORECOV;
- goto found;
- }
- }
- order = order->next;
- }
- }
- found:;
- }
-
- return TRUE;
-}
-
-/* According to the Tahoe assembler spec, all labels starting with a
- '.' are local. */
-
-static bfd_boolean
-elfNN_ia64_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
-{
- return name[0] == '.';
-}
-
-/* Should we do dynamic things to this symbol? */
-
-static bfd_boolean
-elfNN_ia64_dynamic_symbol_p (h, info, r_type)
- struct elf_link_hash_entry *h;
- struct bfd_link_info *info;
- int r_type;
-{
- bfd_boolean ignore_protected
- = ((r_type & 0xf8) == 0x40 /* FPTR relocs */
- || (r_type & 0xf8) == 0x50); /* LTOFF_FPTR relocs */
-
- return _bfd_elf_dynamic_symbol_p (h, info, ignore_protected);
-}
-
-static struct bfd_hash_entry*
-elfNN_ia64_new_elf_hash_entry (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct elfNN_ia64_link_hash_entry *ret;
- ret = (struct elfNN_ia64_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (!ret)
- ret = bfd_hash_allocate (table, sizeof (*ret));
-
- if (!ret)
- return 0;
-
- /* Initialize our local data. All zeros, and definitely easier
- than setting a handful of bit fields. */
- memset (ret, 0, sizeof (*ret));
-
- /* Call the allocation method of the superclass. */
- ret = ((struct elfNN_ia64_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
-
- return (struct bfd_hash_entry *) ret;
-}
-
-static void
-elfNN_ia64_hash_copy_indirect (bed, xdir, xind)
- const struct elf_backend_data *bed ATTRIBUTE_UNUSED;
- struct elf_link_hash_entry *xdir, *xind;
-{
- struct elfNN_ia64_link_hash_entry *dir, *ind;
-
- dir = (struct elfNN_ia64_link_hash_entry *) xdir;
- ind = (struct elfNN_ia64_link_hash_entry *) xind;
-
- /* Copy down any references that we may have already seen to the
- symbol which just became indirect. */
-
- dir->root.elf_link_hash_flags |=
- (ind->root.elf_link_hash_flags
- & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_HASH_NEEDS_PLT));
-
- if (ind->root.root.type != bfd_link_hash_indirect)
- return;
-
- /* Copy over the got and plt data. This would have been done
- by check_relocs. */
-
- if (dir->info == NULL)
- {
- struct elfNN_ia64_dyn_sym_info *dyn_i;
-
- dir->info = dyn_i = ind->info;
- ind->info = NULL;
-
- /* Fix up the dyn_sym_info pointers to the global symbol. */
- for (; dyn_i; dyn_i = dyn_i->next)
- dyn_i->h = &dir->root;
- }
- BFD_ASSERT (ind->info == NULL);
-
- /* Copy over the dynindx. */
-
- if (dir->root.dynindx == -1)
- {
- dir->root.dynindx = ind->root.dynindx;
- dir->root.dynstr_index = ind->root.dynstr_index;
- ind->root.dynindx = -1;
- ind->root.dynstr_index = 0;
- }
- BFD_ASSERT (ind->root.dynindx == -1);
-}
-
-static void
-elfNN_ia64_hash_hide_symbol (info, xh, force_local)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *xh;
- bfd_boolean force_local;
-{
- struct elfNN_ia64_link_hash_entry *h;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
-
- h = (struct elfNN_ia64_link_hash_entry *)xh;
-
- _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
-
- for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next)
- {
- dyn_i->want_plt2 = 0;
- dyn_i->want_plt = 0;
- }
-}
-
-/* Compute a hash of a local hash entry. */
-
-static hashval_t
-elfNN_ia64_local_htab_hash (ptr)
- const void *ptr;
-{
- struct elfNN_ia64_local_hash_entry *entry
- = (struct elfNN_ia64_local_hash_entry *) ptr;
-
- return (((entry->id & 0xff) << 24) | ((entry->id & 0xff00) << 8))
- ^ entry->r_sym ^ (entry->id >> 16);
-}
-
-/* Compare local hash entries. */
-
-static int
-elfNN_ia64_local_htab_eq (ptr1, ptr2)
- const void *ptr1, *ptr2;
-{
- struct elfNN_ia64_local_hash_entry *entry1
- = (struct elfNN_ia64_local_hash_entry *) ptr1;
- struct elfNN_ia64_local_hash_entry *entry2
- = (struct elfNN_ia64_local_hash_entry *) ptr2;
-
- return entry1->id == entry2->id && entry1->r_sym == entry2->r_sym;
-}
-
-/* Create the derived linker hash table. The IA-64 ELF port uses this
- derived hash table to keep information specific to the IA-64 ElF
- linker (without using static variables). */
-
-static struct bfd_link_hash_table*
-elfNN_ia64_hash_table_create (abfd)
- bfd *abfd;
-{
- struct elfNN_ia64_link_hash_table *ret;
-
- ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret));
- if (!ret)
- return 0;
-
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
- elfNN_ia64_new_elf_hash_entry))
- {
- free (ret);
- return 0;
- }
-
- ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash,
- elfNN_ia64_local_htab_eq, NULL);
- ret->loc_hash_memory = objalloc_create ();
- if (!ret->loc_hash_table || !ret->loc_hash_memory)
- {
- free (ret);
- return 0;
- }
-
- return &ret->root.root;
-}
-
-/* Destroy IA-64 linker hash table. */
-
-static void
-elfNN_ia64_hash_table_free (hash)
- struct bfd_link_hash_table *hash;
-{
- struct elfNN_ia64_link_hash_table *ia64_info
- = (struct elfNN_ia64_link_hash_table *) hash;
- if (ia64_info->loc_hash_table)
- htab_delete (ia64_info->loc_hash_table);
- if (ia64_info->loc_hash_memory)
- objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory);
- _bfd_generic_link_hash_table_free (hash);
-}
-
-/* Traverse both local and global hash tables. */
-
-struct elfNN_ia64_dyn_sym_traverse_data
-{
- bfd_boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
- PTR data;
-};
-
-static bfd_boolean
-elfNN_ia64_global_dyn_sym_thunk (xentry, xdata)
- struct bfd_hash_entry *xentry;
- PTR xdata;
-{
- struct elfNN_ia64_link_hash_entry *entry
- = (struct elfNN_ia64_link_hash_entry *) xentry;
- struct elfNN_ia64_dyn_sym_traverse_data *data
- = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
-
- if (entry->root.root.type == bfd_link_hash_warning)
- entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
-
- for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
- if (! (*data->func) (dyn_i, data->data))
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_ia64_local_dyn_sym_thunk (slot, xdata)
- void **slot;
- PTR xdata;
-{
- struct elfNN_ia64_local_hash_entry *entry
- = (struct elfNN_ia64_local_hash_entry *) *slot;
- struct elfNN_ia64_dyn_sym_traverse_data *data
- = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
-
- for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
- if (! (*data->func) (dyn_i, data->data))
- return 0;
- return 1;
-}
-
-static void
-elfNN_ia64_dyn_sym_traverse (ia64_info, func, data)
- struct elfNN_ia64_link_hash_table *ia64_info;
- bfd_boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
- PTR data;
-{
- struct elfNN_ia64_dyn_sym_traverse_data xdata;
-
- xdata.func = func;
- xdata.data = data;
-
- elf_link_hash_traverse (&ia64_info->root,
- elfNN_ia64_global_dyn_sym_thunk, &xdata);
- htab_traverse (ia64_info->loc_hash_table,
- elfNN_ia64_local_dyn_sym_thunk, &xdata);
-}
-
-static bfd_boolean
-elfNN_ia64_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- asection *s;
-
- if (! _bfd_elf_create_dynamic_sections (abfd, info))
- return FALSE;
-
- ia64_info = elfNN_ia64_hash_table (info);
-
- ia64_info->plt_sec = bfd_get_section_by_name (abfd, ".plt");
- ia64_info->got_sec = bfd_get_section_by_name (abfd, ".got");
-
- {
- flagword flags = bfd_get_section_flags (abfd, ia64_info->got_sec);
- bfd_set_section_flags (abfd, ia64_info->got_sec, SEC_SMALL_DATA | flags);
- /* The .got section is always aligned at 8 bytes. */
- bfd_set_section_alignment (abfd, ia64_info->got_sec, 3);
- }
-
- if (!get_pltoff (abfd, info, ia64_info))
- return FALSE;
-
- s = bfd_make_section(abfd, ".rela.IA_64.pltoff");
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (abfd, s, 3))
- return FALSE;
- ia64_info->rel_pltoff_sec = s;
-
- s = bfd_make_section(abfd, ".rela.got");
- if (s == NULL
- || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (abfd, s, 3))
- return FALSE;
- ia64_info->rel_got_sec = s;
-
- return TRUE;
-}
-
-/* Find and/or create a hash entry for local symbol. */
-static struct elfNN_ia64_local_hash_entry *
-get_local_sym_hash (ia64_info, abfd, rel, create)
- struct elfNN_ia64_link_hash_table *ia64_info;
- bfd *abfd;
- const Elf_Internal_Rela *rel;
- bfd_boolean create;
-{
- struct elfNN_ia64_local_hash_entry e, *ret;
- asection *sec = abfd->sections;
- hashval_t h = (((sec->id & 0xff) << 24) | ((sec->id & 0xff00) << 8))
- ^ ELFNN_R_SYM (rel->r_info) ^ (sec->id >> 16);
- void **slot;
-
- e.id = sec->id;
- e.r_sym = ELFNN_R_SYM (rel->r_info);
- slot = htab_find_slot_with_hash (ia64_info->loc_hash_table, &e, h,
- create ? INSERT : NO_INSERT);
-
- if (!slot)
- return NULL;
-
- if (*slot)
- return (struct elfNN_ia64_local_hash_entry *) *slot;
-
- ret = (struct elfNN_ia64_local_hash_entry *)
- objalloc_alloc ((struct objalloc *) ia64_info->loc_hash_memory,
- sizeof (struct elfNN_ia64_local_hash_entry));
- if (ret)
- {
- memset (ret, 0, sizeof (*ret));
- ret->id = sec->id;
- ret->r_sym = ELFNN_R_SYM (rel->r_info);
- *slot = ret;
- }
- return ret;
-}
-
-/* Find and/or create a descriptor for dynamic symbol info. This will
- vary based on global or local symbol, and the addend to the reloc. */
-
-static struct elfNN_ia64_dyn_sym_info *
-get_dyn_sym_info (ia64_info, h, abfd, rel, create)
- struct elfNN_ia64_link_hash_table *ia64_info;
- struct elf_link_hash_entry *h;
- bfd *abfd;
- const Elf_Internal_Rela *rel;
- bfd_boolean create;
-{
- struct elfNN_ia64_dyn_sym_info **pp;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- bfd_vma addend = rel ? rel->r_addend : 0;
-
- if (h)
- pp = &((struct elfNN_ia64_link_hash_entry *)h)->info;
- else
- {
- struct elfNN_ia64_local_hash_entry *loc_h;
-
- loc_h = get_local_sym_hash (ia64_info, abfd, rel, create);
- if (!loc_h)
- {
- BFD_ASSERT (!create);
- return NULL;
- }
-
- pp = &loc_h->info;
- }
-
- for (dyn_i = *pp; dyn_i && dyn_i->addend != addend; dyn_i = *pp)
- pp = &dyn_i->next;
-
- if (dyn_i == NULL && create)
- {
- dyn_i = ((struct elfNN_ia64_dyn_sym_info *)
- bfd_zalloc (abfd, (bfd_size_type) sizeof *dyn_i));
- *pp = dyn_i;
- dyn_i->addend = addend;
- }
-
- return dyn_i;
-}
-
-static asection *
-get_got (abfd, info, ia64_info)
- bfd *abfd;
- struct bfd_link_info *info;
- struct elfNN_ia64_link_hash_table *ia64_info;
-{
- asection *got;
- bfd *dynobj;
-
- got = ia64_info->got_sec;
- if (!got)
- {
- flagword flags;
-
- dynobj = ia64_info->root.dynobj;
- if (!dynobj)
- ia64_info->root.dynobj = dynobj = abfd;
- if (!_bfd_elf_create_got_section (dynobj, info))
- return 0;
-
- got = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (got);
- ia64_info->got_sec = got;
-
- /* The .got section is always aligned at 8 bytes. */
- if (!bfd_set_section_alignment (abfd, got, 3))
- return 0;
-
- flags = bfd_get_section_flags (abfd, got);
- bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags);
- }
-
- return got;
-}
-
-/* Create function descriptor section (.opd). This section is called .opd
- because it contains "official procedure descriptors". The "official"
- refers to the fact that these descriptors are used when taking the address
- of a procedure, thus ensuring a unique address for each procedure. */
-
-static asection *
-get_fptr (abfd, info, ia64_info)
- bfd *abfd;
- struct bfd_link_info *info;
- struct elfNN_ia64_link_hash_table *ia64_info;
-{
- asection *fptr;
- bfd *dynobj;
-
- fptr = ia64_info->fptr_sec;
- if (!fptr)
- {
- dynobj = ia64_info->root.dynobj;
- if (!dynobj)
- ia64_info->root.dynobj = dynobj = abfd;
-
- fptr = bfd_make_section (dynobj, ".opd");
- if (!fptr
- || !bfd_set_section_flags (dynobj, fptr,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | (info->pie ? 0 : SEC_READONLY)
- | SEC_LINKER_CREATED))
- || !bfd_set_section_alignment (abfd, fptr, 4))
- {
- BFD_ASSERT (0);
- return NULL;
- }
-
- ia64_info->fptr_sec = fptr;
-
- if (info->pie)
- {
- asection *fptr_rel;
- fptr_rel = bfd_make_section(dynobj, ".rela.opd");
- if (fptr_rel == NULL
- || !bfd_set_section_flags (dynobj, fptr_rel,
- (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (abfd, fptr_rel, 3))
- {
- BFD_ASSERT (0);
- return NULL;
- }
-
- ia64_info->rel_fptr_sec = fptr_rel;
- }
- }
-
- return fptr;
-}
-
-static asection *
-get_pltoff (abfd, info, ia64_info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- struct elfNN_ia64_link_hash_table *ia64_info;
-{
- asection *pltoff;
- bfd *dynobj;
-
- pltoff = ia64_info->pltoff_sec;
- if (!pltoff)
- {
- dynobj = ia64_info->root.dynobj;
- if (!dynobj)
- ia64_info->root.dynobj = dynobj = abfd;
-
- pltoff = bfd_make_section (dynobj, ELF_STRING_ia64_pltoff);
- if (!pltoff
- || !bfd_set_section_flags (dynobj, pltoff,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_SMALL_DATA
- | SEC_LINKER_CREATED))
- || !bfd_set_section_alignment (abfd, pltoff, 4))
- {
- BFD_ASSERT (0);
- return NULL;
- }
-
- ia64_info->pltoff_sec = pltoff;
- }
-
- return pltoff;
-}
-
-static asection *
-get_reloc_section (abfd, ia64_info, sec, create)
- bfd *abfd;
- struct elfNN_ia64_link_hash_table *ia64_info;
- asection *sec;
- bfd_boolean create;
-{
- const char *srel_name;
- asection *srel;
- bfd *dynobj;
-
- srel_name = (bfd_elf_string_from_elf_section
- (abfd, elf_elfheader(abfd)->e_shstrndx,
- elf_section_data(sec)->rel_hdr.sh_name));
- if (srel_name == NULL)
- return NULL;
-
- BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
- srel_name+5) == 0)
- || (strncmp (srel_name, ".rel", 4) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
- srel_name+4) == 0));
-
- dynobj = ia64_info->root.dynobj;
- if (!dynobj)
- ia64_info->root.dynobj = dynobj = abfd;
-
- srel = bfd_get_section_by_name (dynobj, srel_name);
- if (srel == NULL && create)
- {
- srel = bfd_make_section (dynobj, srel_name);
- if (srel == NULL
- || !bfd_set_section_flags (dynobj, srel,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (dynobj, srel, 3))
- return NULL;
- }
-
- return srel;
-}
-
-static bfd_boolean
-count_dyn_reloc (bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
- asection *srel, int type, bfd_boolean reltext)
-{
- struct elfNN_ia64_dyn_reloc_entry *rent;
-
- for (rent = dyn_i->reloc_entries; rent; rent = rent->next)
- if (rent->srel == srel && rent->type == type)
- break;
-
- if (!rent)
- {
- rent = ((struct elfNN_ia64_dyn_reloc_entry *)
- bfd_alloc (abfd, (bfd_size_type) sizeof (*rent)));
- if (!rent)
- return FALSE;
-
- rent->next = dyn_i->reloc_entries;
- rent->srel = srel;
- rent->type = type;
- rent->count = 0;
- dyn_i->reloc_entries = rent;
- }
- rent->reltext = reltext;
- rent->count++;
-
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_ia64_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- const Elf_Internal_Rela *relend;
- Elf_Internal_Shdr *symtab_hdr;
- const Elf_Internal_Rela *rel;
- asection *got, *fptr, *srel;
-
- if (info->relocatable)
- return TRUE;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- ia64_info = elfNN_ia64_hash_table (info);
-
- got = fptr = srel = NULL;
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; ++rel)
- {
- enum {
- NEED_GOT = 1,
- NEED_GOTX = 2,
- NEED_FPTR = 4,
- NEED_PLTOFF = 8,
- NEED_MIN_PLT = 16,
- NEED_FULL_PLT = 32,
- NEED_DYNREL = 64,
- NEED_LTOFF_FPTR = 128,
- NEED_TPREL = 256,
- NEED_DTPMOD = 512,
- NEED_DTPREL = 1024
- };
-
- struct elf_link_hash_entry *h = NULL;
- unsigned long r_symndx = ELFNN_R_SYM (rel->r_info);
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- int need_entry;
- bfd_boolean maybe_dynamic;
- int dynrel_type = R_IA64_NONE;
-
- if (r_symndx >= symtab_hdr->sh_info)
- {
- /* We're dealing with a global symbol -- find its hash entry
- and mark it as being referenced. */
- long indx = r_symndx - symtab_hdr->sh_info;
- h = elf_sym_hashes (abfd)[indx];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
- }
-
- /* We can only get preliminary data on whether a symbol is
- locally or externally defined, as not all of the input files
- have yet been processed. Do something with what we know, as
- this may help reduce memory usage and processing time later. */
- maybe_dynamic = FALSE;
- if (h && ((!info->executable
- && (!info->symbolic || info->unresolved_syms_in_shared_libs == RM_IGNORE))
- || ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
- || h->root.type == bfd_link_hash_defweak))
- maybe_dynamic = TRUE;
-
- need_entry = 0;
- switch (ELFNN_R_TYPE (rel->r_info))
- {
- case R_IA64_TPREL64MSB:
- case R_IA64_TPREL64LSB:
- if (info->shared || maybe_dynamic)
- need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_TPREL64LSB;
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- break;
-
- case R_IA64_LTOFF_TPREL22:
- need_entry = NEED_TPREL;
- if (info->shared)
- info->flags |= DF_STATIC_TLS;
- break;
-
- case R_IA64_DTPREL64MSB:
- case R_IA64_DTPREL64LSB:
- if (info->shared || maybe_dynamic)
- need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_DTPREL64LSB;
- break;
-
- case R_IA64_LTOFF_DTPREL22:
- need_entry = NEED_DTPREL;
- break;
-
- case R_IA64_DTPMOD64MSB:
- case R_IA64_DTPMOD64LSB:
- if (info->shared || maybe_dynamic)
- need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_DTPMOD64LSB;
- break;
-
- case R_IA64_LTOFF_DTPMOD22:
- need_entry = NEED_DTPMOD;
- break;
-
- case R_IA64_LTOFF_FPTR22:
- case R_IA64_LTOFF_FPTR64I:
- case R_IA64_LTOFF_FPTR32MSB:
- case R_IA64_LTOFF_FPTR32LSB:
- case R_IA64_LTOFF_FPTR64MSB:
- case R_IA64_LTOFF_FPTR64LSB:
- need_entry = NEED_FPTR | NEED_GOT | NEED_LTOFF_FPTR;
- break;
-
- case R_IA64_FPTR64I:
- case R_IA64_FPTR32MSB:
- case R_IA64_FPTR32LSB:
- case R_IA64_FPTR64MSB:
- case R_IA64_FPTR64LSB:
- if (info->shared || h)
- need_entry = NEED_FPTR | NEED_DYNREL;
- else
- need_entry = NEED_FPTR;
- dynrel_type = R_IA64_FPTR64LSB;
- break;
-
- case R_IA64_LTOFF22:
- case R_IA64_LTOFF64I:
- need_entry = NEED_GOT;
- break;
-
- case R_IA64_LTOFF22X:
- need_entry = NEED_GOTX;
- break;
-
- case R_IA64_PLTOFF22:
- case R_IA64_PLTOFF64I:
- case R_IA64_PLTOFF64MSB:
- case R_IA64_PLTOFF64LSB:
- need_entry = NEED_PLTOFF;
- if (h)
- {
- if (maybe_dynamic)
- need_entry |= NEED_MIN_PLT;
- }
- else
- {
- (*info->callbacks->warning)
- (info, _("@pltoff reloc against local symbol"), 0,
- abfd, 0, (bfd_vma) 0);
- }
- break;
-
- case R_IA64_PCREL21B:
- case R_IA64_PCREL60B:
- /* Depending on where this symbol is defined, we may or may not
- need a full plt entry. Only skip if we know we'll not need
- the entry -- static or symbolic, and the symbol definition
- has already been seen. */
- if (maybe_dynamic && rel->r_addend == 0)
- need_entry = NEED_FULL_PLT;
- break;
-
- case R_IA64_IMM14:
- case R_IA64_IMM22:
- case R_IA64_IMM64:
- case R_IA64_DIR32MSB:
- case R_IA64_DIR32LSB:
- case R_IA64_DIR64MSB:
- case R_IA64_DIR64LSB:
- /* Shared objects will always need at least a REL relocation. */
- if (info->shared || maybe_dynamic)
- need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_DIR64LSB;
- break;
-
- case R_IA64_IPLTMSB:
- case R_IA64_IPLTLSB:
- /* Shared objects will always need at least a REL relocation. */
- if (info->shared || maybe_dynamic)
- need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_IPLTLSB;
- break;
-
- case R_IA64_PCREL22:
- case R_IA64_PCREL64I:
- case R_IA64_PCREL32MSB:
- case R_IA64_PCREL32LSB:
- case R_IA64_PCREL64MSB:
- case R_IA64_PCREL64LSB:
- if (maybe_dynamic)
- need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_PCREL64LSB;
- break;
- }
-
- if (!need_entry)
- continue;
-
- if ((need_entry & NEED_FPTR) != 0
- && rel->r_addend)
- {
- (*info->callbacks->warning)
- (info, _("non-zero addend in @fptr reloc"), 0,
- abfd, 0, (bfd_vma) 0);
- }
-
- dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE);
-
- /* Record whether or not this is a local symbol. */
- dyn_i->h = h;
-
- /* Create what's needed. */
- if (need_entry & (NEED_GOT | NEED_GOTX | NEED_TPREL
- | NEED_DTPMOD | NEED_DTPREL))
- {
- if (!got)
- {
- got = get_got (abfd, info, ia64_info);
- if (!got)
- return FALSE;
- }
- if (need_entry & NEED_GOT)
- dyn_i->want_got = 1;
- if (need_entry & NEED_GOTX)
- dyn_i->want_gotx = 1;
- if (need_entry & NEED_TPREL)
- dyn_i->want_tprel = 1;
- if (need_entry & NEED_DTPMOD)
- dyn_i->want_dtpmod = 1;
- if (need_entry & NEED_DTPREL)
- dyn_i->want_dtprel = 1;
- }
- if (need_entry & NEED_FPTR)
- {
- if (!fptr)
- {
- fptr = get_fptr (abfd, info, ia64_info);
- if (!fptr)
- return FALSE;
- }
-
- /* FPTRs for shared libraries are allocated by the dynamic
- linker. Make sure this local symbol will appear in the
- dynamic symbol table. */
- if (!h && info->shared)
- {
- if (! (bfd_elf_link_record_local_dynamic_symbol
- (info, abfd, (long) r_symndx)))
- return FALSE;
- }
-
- dyn_i->want_fptr = 1;
- }
- if (need_entry & NEED_LTOFF_FPTR)
- dyn_i->want_ltoff_fptr = 1;
- if (need_entry & (NEED_MIN_PLT | NEED_FULL_PLT))
- {
- if (!ia64_info->root.dynobj)
- ia64_info->root.dynobj = abfd;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- dyn_i->want_plt = 1;
- }
- if (need_entry & NEED_FULL_PLT)
- dyn_i->want_plt2 = 1;
- if (need_entry & NEED_PLTOFF)
- dyn_i->want_pltoff = 1;
- if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC))
- {
- if (!srel)
- {
- srel = get_reloc_section (abfd, ia64_info, sec, TRUE);
- if (!srel)
- return FALSE;
- }
- if (!count_dyn_reloc (abfd, dyn_i, srel, dynrel_type,
- (sec->flags & SEC_READONLY) != 0))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* For cleanliness, and potentially faster dynamic loading, allocate
- external GOT entries first. */
-
-static bfd_boolean
-allocate_global_data_got (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
-
- if ((dyn_i->want_got || dyn_i->want_gotx)
- && ! dyn_i->want_fptr
- && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0))
- {
- dyn_i->got_offset = x->ofs;
- x->ofs += 8;
- }
- if (dyn_i->want_tprel)
- {
- dyn_i->tprel_offset = x->ofs;
- x->ofs += 8;
- }
- if (dyn_i->want_dtpmod)
- {
- if (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0))
- {
- dyn_i->dtpmod_offset = x->ofs;
- x->ofs += 8;
- }
- else
- {
- struct elfNN_ia64_link_hash_table *ia64_info;
-
- ia64_info = elfNN_ia64_hash_table (x->info);
- if (ia64_info->self_dtpmod_offset == (bfd_vma) -1)
- {
- ia64_info->self_dtpmod_offset = x->ofs;
- x->ofs += 8;
- }
- dyn_i->dtpmod_offset = ia64_info->self_dtpmod_offset;
- }
- }
- if (dyn_i->want_dtprel)
- {
- dyn_i->dtprel_offset = x->ofs;
- x->ofs += 8;
- }
- return TRUE;
-}
-
-/* Next, allocate all the GOT entries used by LTOFF_FPTR relocs. */
-
-static bfd_boolean
-allocate_global_fptr_got (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
-
- if (dyn_i->want_got
- && dyn_i->want_fptr
- && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTR64LSB))
- {
- dyn_i->got_offset = x->ofs;
- x->ofs += 8;
- }
- return TRUE;
-}
-
-/* Lastly, allocate all the GOT entries for local data. */
-
-static bfd_boolean
-allocate_local_got (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
-
- if ((dyn_i->want_got || dyn_i->want_gotx)
- && !elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0))
- {
- dyn_i->got_offset = x->ofs;
- x->ofs += 8;
- }
- return TRUE;
-}
-
-/* Search for the index of a global symbol in it's defining object file. */
-
-static long
-global_sym_index (h)
- struct elf_link_hash_entry *h;
-{
- struct elf_link_hash_entry **p;
- bfd *obj;
-
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak);
-
- obj = h->root.u.def.section->owner;
- for (p = elf_sym_hashes (obj); *p != h; ++p)
- continue;
-
- return p - elf_sym_hashes (obj) + elf_tdata (obj)->symtab_hdr.sh_info;
-}
-
-/* Allocate function descriptors. We can do these for every function
- in a main executable that is not exported. */
-
-static bfd_boolean
-allocate_fptr (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
-
- if (dyn_i->want_fptr)
- {
- struct elf_link_hash_entry *h = dyn_i->h;
-
- if (h)
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (!x->info->executable
- && (!h
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
- {
- if (h && h->dynindx == -1)
- {
- BFD_ASSERT ((h->root.type == bfd_link_hash_defined)
- || (h->root.type == bfd_link_hash_defweak));
-
- if (!bfd_elf_link_record_local_dynamic_symbol
- (x->info, h->root.u.def.section->owner,
- global_sym_index (h)))
- return FALSE;
- }
-
- dyn_i->want_fptr = 0;
- }
- else if (h == NULL || h->dynindx == -1)
- {
- dyn_i->fptr_offset = x->ofs;
- x->ofs += 16;
- }
- else
- dyn_i->want_fptr = 0;
- }
- return TRUE;
-}
-
-/* Allocate all the minimal PLT entries. */
-
-static bfd_boolean
-allocate_plt_entries (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
-
- if (dyn_i->want_plt)
- {
- struct elf_link_hash_entry *h = dyn_i->h;
-
- if (h)
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* ??? Versioned symbols seem to lose ELF_LINK_HASH_NEEDS_PLT. */
- if (elfNN_ia64_dynamic_symbol_p (h, x->info, 0))
- {
- bfd_size_type offset = x->ofs;
- if (offset == 0)
- offset = PLT_HEADER_SIZE;
- dyn_i->plt_offset = offset;
- x->ofs = offset + PLT_MIN_ENTRY_SIZE;
-
- dyn_i->want_pltoff = 1;
- }
- else
- {
- dyn_i->want_plt = 0;
- dyn_i->want_plt2 = 0;
- }
- }
- return TRUE;
-}
-
-/* Allocate all the full PLT entries. */
-
-static bfd_boolean
-allocate_plt2_entries (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
-
- if (dyn_i->want_plt2)
- {
- struct elf_link_hash_entry *h = dyn_i->h;
- bfd_size_type ofs = x->ofs;
-
- dyn_i->plt2_offset = ofs;
- x->ofs = ofs + PLT_FULL_ENTRY_SIZE;
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- dyn_i->h->plt.offset = ofs;
- }
- return TRUE;
-}
-
-/* Allocate all the PLTOFF entries requested by relocations and
- plt entries. We can't share space with allocated FPTR entries,
- because the latter are not necessarily addressable by the GP.
- ??? Relaxation might be able to determine that they are. */
-
-static bfd_boolean
-allocate_pltoff_entries (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
-
- if (dyn_i->want_pltoff)
- {
- dyn_i->pltoff_offset = x->ofs;
- x->ofs += 16;
- }
- return TRUE;
-}
-
-/* Allocate dynamic relocations for those symbols that turned out
- to be dynamic. */
-
-static bfd_boolean
-allocate_dynrel_entries (dyn_i, data)
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- PTR data;
-{
- struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
- struct elfNN_ia64_link_hash_table *ia64_info;
- struct elfNN_ia64_dyn_reloc_entry *rent;
- bfd_boolean dynamic_symbol, shared, resolved_zero;
-
- ia64_info = elfNN_ia64_hash_table (x->info);
-
- /* Note that this can't be used in relation to FPTR relocs below. */
- dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0);
-
- shared = x->info->shared;
- resolved_zero = (dyn_i->h
- && ELF_ST_VISIBILITY (dyn_i->h->other)
- && dyn_i->h->root.type == bfd_link_hash_undefweak);
-
- /* Take care of the normal data relocations. */
-
- for (rent = dyn_i->reloc_entries; rent; rent = rent->next)
- {
- int count = rent->count;
-
- switch (rent->type)
- {
- case R_IA64_FPTR64LSB:
- /* Allocate one iff !want_fptr and not PIE, which by this point
- will be true only if we're actually allocating one statically
- in the main executable. Position independent executables
- need a relative reloc. */
- if (dyn_i->want_fptr && !x->info->pie)
- continue;
- break;
- case R_IA64_PCREL64LSB:
- if (!dynamic_symbol)
- continue;
- break;
- case R_IA64_DIR64LSB:
- if (!dynamic_symbol && !shared)
- continue;
- break;
- case R_IA64_IPLTLSB:
- if (!dynamic_symbol && !shared)
- continue;
- /* Use two REL relocations for IPLT relocations
- against local symbols. */
- if (!dynamic_symbol)
- count *= 2;
- break;
- case R_IA64_TPREL64LSB:
- case R_IA64_DTPREL64LSB:
- case R_IA64_DTPMOD64LSB:
- break;
- default:
- abort ();
- }
- if (rent->reltext)
- ia64_info->reltext = 1;
- rent->srel->_raw_size += sizeof (ElfNN_External_Rela) * count;
- }
-
- /* Take care of the GOT and PLT relocations. */
-
- if ((!resolved_zero
- && (dynamic_symbol || shared)
- && (dyn_i->want_got || dyn_i->want_gotx))
- || (dyn_i->want_ltoff_fptr
- && dyn_i->h
- && dyn_i->h->dynindx != -1))
- {
- if (!dyn_i->want_ltoff_fptr
- || !x->info->pie
- || dyn_i->h == NULL
- || dyn_i->h->root.type != bfd_link_hash_undefweak)
- ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
- }
- if ((dynamic_symbol || shared) && dyn_i->want_tprel)
- ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
- if (dynamic_symbol && dyn_i->want_dtpmod)
- ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
- if (dynamic_symbol && dyn_i->want_dtprel)
- ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
- if (ia64_info->rel_fptr_sec && dyn_i->want_fptr)
- {
- if (dyn_i->h == NULL || dyn_i->h->root.type != bfd_link_hash_undefweak)
- ia64_info->rel_fptr_sec->_raw_size += sizeof (ElfNN_External_Rela);
- }
-
- if (!resolved_zero && dyn_i->want_pltoff)
- {
- bfd_size_type t = 0;
-
- /* Dynamic symbols get one IPLT relocation. Local symbols in
- shared libraries get two REL relocations. Local symbols in
- main applications get nothing. */
- if (dynamic_symbol)
- t = sizeof (ElfNN_External_Rela);
- else if (shared)
- t = 2 * sizeof (ElfNN_External_Rela);
-
- ia64_info->rel_pltoff_sec->_raw_size += t;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_ia64_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- struct elf_link_hash_entry *h;
-{
- /* ??? Undefined symbols with PLT entries should be re-defined
- to be the PLT entry. */
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- return TRUE;
- }
-
- /* If this is a reference to a symbol defined by a dynamic object which
- is not a function, we might allocate the symbol in our .dynbss section
- and allocate a COPY dynamic relocation.
-
- But IA-64 code is canonically PIC, so as a rule we can avoid this sort
- of hackery. */
-
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_ia64_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- struct elfNN_ia64_allocate_data data;
- struct elfNN_ia64_link_hash_table *ia64_info;
- asection *sec;
- bfd *dynobj;
- bfd_boolean relplt = FALSE;
-
- dynobj = elf_hash_table(info)->dynobj;
- ia64_info = elfNN_ia64_hash_table (info);
- ia64_info->self_dtpmod_offset = (bfd_vma) -1;
- BFD_ASSERT(dynobj != NULL);
- data.info = info;
-
- /* Set the contents of the .interp section to the interpreter. */
- if (ia64_info->root.dynamic_sections_created
- && info->executable)
- {
- sec = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (sec != NULL);
- sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
- sec->_raw_size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
- }
-
- /* Allocate the GOT entries. */
-
- if (ia64_info->got_sec)
- {
- data.ofs = 0;
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data);
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data);
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data);
- ia64_info->got_sec->_raw_size = data.ofs;
- }
-
- /* Allocate the FPTR entries. */
-
- if (ia64_info->fptr_sec)
- {
- data.ofs = 0;
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_fptr, &data);
- ia64_info->fptr_sec->_raw_size = data.ofs;
- }
-
- /* Now that we've seen all of the input files, we can decide which
- symbols need plt entries. Allocate the minimal PLT entries first.
- We do this even though dynamic_sections_created may be FALSE, because
- this has the side-effect of clearing want_plt and want_plt2. */
-
- data.ofs = 0;
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt_entries, &data);
-
- ia64_info->minplt_entries = 0;
- if (data.ofs)
- {
- ia64_info->minplt_entries
- = (data.ofs - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE;
- }
-
- /* Align the pointer for the plt2 entries. */
- data.ofs = (data.ofs + 31) & (bfd_vma) -32;
-
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data);
- if (data.ofs != 0 || ia64_info->root.dynamic_sections_created)
- {
- /* FIXME: we always reserve the memory for dynamic linker even if
- there are no PLT entries since dynamic linker may assume the
- reserved memory always exists. */
-
- BFD_ASSERT (ia64_info->root.dynamic_sections_created);
-
- ia64_info->plt_sec->_raw_size = data.ofs;
-
- /* If we've got a .plt, we need some extra memory for the dynamic
- linker. We stuff these in .got.plt. */
- sec = bfd_get_section_by_name (dynobj, ".got.plt");
- sec->_raw_size = 8 * PLT_RESERVED_WORDS;
- }
-
- /* Allocate the PLTOFF entries. */
-
- if (ia64_info->pltoff_sec)
- {
- data.ofs = 0;
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_pltoff_entries, &data);
- ia64_info->pltoff_sec->_raw_size = data.ofs;
- }
-
- if (ia64_info->root.dynamic_sections_created)
- {
- /* Allocate space for the dynamic relocations that turned out to be
- required. */
-
- if (info->shared && ia64_info->self_dtpmod_offset != (bfd_vma) -1)
- ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
- elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data);
- }
-
- /* We have now determined the sizes of the various dynamic sections.
- Allocate memory for them. */
- for (sec = dynobj->sections; sec != NULL; sec = sec->next)
- {
- bfd_boolean strip;
-
- if (!(sec->flags & SEC_LINKER_CREATED))
- continue;
-
- /* If we don't need this section, strip it from the output file.
- There were several sections primarily related to dynamic
- linking that must be create before the linker maps input
- sections to output sections. The linker does that before
- bfd_elf_size_dynamic_sections is called, and it is that
- function which decides whether anything needs to go into
- these sections. */
-
- strip = (sec->_raw_size == 0);
-
- if (sec == ia64_info->got_sec)
- strip = FALSE;
- else if (sec == ia64_info->rel_got_sec)
- {
- if (strip)
- ia64_info->rel_got_sec = NULL;
- else
- /* We use the reloc_count field as a counter if we need to
- copy relocs into the output file. */
- sec->reloc_count = 0;
- }
- else if (sec == ia64_info->fptr_sec)
- {
- if (strip)
- ia64_info->fptr_sec = NULL;
- }
- else if (sec == ia64_info->rel_fptr_sec)
- {
- if (strip)
- ia64_info->rel_fptr_sec = NULL;
- else
- /* We use the reloc_count field as a counter if we need to
- copy relocs into the output file. */
- sec->reloc_count = 0;
- }
- else if (sec == ia64_info->plt_sec)
- {
- if (strip)
- ia64_info->plt_sec = NULL;
- }
- else if (sec == ia64_info->pltoff_sec)
- {
- if (strip)
- ia64_info->pltoff_sec = NULL;
- }
- else if (sec == ia64_info->rel_pltoff_sec)
- {
- if (strip)
- ia64_info->rel_pltoff_sec = NULL;
- else
- {
- relplt = TRUE;
- /* We use the reloc_count field as a counter if we need to
- copy relocs into the output file. */
- sec->reloc_count = 0;
- }
- }
- else
- {
- const char *name;
-
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, sec);
-
- if (strcmp (name, ".got.plt") == 0)
- strip = FALSE;
- else if (strncmp (name, ".rel", 4) == 0)
- {
- if (!strip)
- {
- /* We use the reloc_count field as a counter if we need to
- copy relocs into the output file. */
- sec->reloc_count = 0;
- }
- }
- else
- continue;
- }
-
- if (strip)
- _bfd_strip_section_from_output (info, sec);
- else
- {
- /* Allocate memory for the section contents. */
- sec->contents = (bfd_byte *) bfd_zalloc (dynobj, sec->_raw_size);
- if (sec->contents == NULL && sec->_raw_size != 0)
- return FALSE;
- }
- }
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the values
- later (in finish_dynamic_sections) but we must add the entries now
- so that we get the correct size for the .dynamic section. */
-
- if (info->executable)
- {
- /* The DT_DEBUG entry is filled in by the dynamic linker and used
- by the debugger. */
-#define add_dynamic_entry(TAG, VAL) \
- _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
- if (!add_dynamic_entry (DT_DEBUG, 0))
- return FALSE;
- }
-
- if (!add_dynamic_entry (DT_IA_64_PLT_RESERVE, 0))
- return FALSE;
- if (!add_dynamic_entry (DT_PLTGOT, 0))
- return FALSE;
-
- if (relplt)
- {
- if (!add_dynamic_entry (DT_PLTRELSZ, 0)
- || !add_dynamic_entry (DT_PLTREL, DT_RELA)
- || !add_dynamic_entry (DT_JMPREL, 0))
- return FALSE;
- }
-
- if (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (ElfNN_External_Rela)))
- return FALSE;
-
- if (ia64_info->reltext)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- info->flags |= DF_TEXTREL;
- }
- }
-
- /* ??? Perhaps force __gp local. */
-
- return TRUE;
-}
-
-static bfd_reloc_status_type
-elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
- bfd *abfd;
- bfd_byte *hit_addr;
- bfd_vma v;
- unsigned int r_type;
-{
- const struct ia64_operand *op;
- int bigendian = 0, shift = 0;
- bfd_vma t0, t1, insn, dword;
- enum ia64_opnd opnd;
- const char *err;
- size_t size = 8;
-#ifdef BFD_HOST_U_64_BIT
- BFD_HOST_U_64_BIT val = (BFD_HOST_U_64_BIT) v;
-#else
- bfd_vma val = v;
-#endif
-
- opnd = IA64_OPND_NIL;
- switch (r_type)
- {
- case R_IA64_NONE:
- case R_IA64_LDXMOV:
- return bfd_reloc_ok;
-
- /* Instruction relocations. */
-
- case R_IA64_IMM14:
- case R_IA64_TPREL14:
- case R_IA64_DTPREL14:
- opnd = IA64_OPND_IMM14;
- break;
-
- case R_IA64_PCREL21F: opnd = IA64_OPND_TGT25; break;
- case R_IA64_PCREL21M: opnd = IA64_OPND_TGT25b; break;
- case R_IA64_PCREL60B: opnd = IA64_OPND_TGT64; break;
- case R_IA64_PCREL21B:
- case R_IA64_PCREL21BI:
- opnd = IA64_OPND_TGT25c;
- break;
-
- case R_IA64_IMM22:
- case R_IA64_GPREL22:
- case R_IA64_LTOFF22:
- case R_IA64_LTOFF22X:
- case R_IA64_PLTOFF22:
- case R_IA64_PCREL22:
- case R_IA64_LTOFF_FPTR22:
- case R_IA64_TPREL22:
- case R_IA64_DTPREL22:
- case R_IA64_LTOFF_TPREL22:
- case R_IA64_LTOFF_DTPMOD22:
- case R_IA64_LTOFF_DTPREL22:
- opnd = IA64_OPND_IMM22;
- break;
-
- case R_IA64_IMM64:
- case R_IA64_GPREL64I:
- case R_IA64_LTOFF64I:
- case R_IA64_PLTOFF64I:
- case R_IA64_PCREL64I:
- case R_IA64_FPTR64I:
- case R_IA64_LTOFF_FPTR64I:
- case R_IA64_TPREL64I:
- case R_IA64_DTPREL64I:
- opnd = IA64_OPND_IMMU64;
- break;
-
- /* Data relocations. */
-
- case R_IA64_DIR32MSB:
- case R_IA64_GPREL32MSB:
- case R_IA64_FPTR32MSB:
- case R_IA64_PCREL32MSB:
- case R_IA64_LTOFF_FPTR32MSB:
- case R_IA64_SEGREL32MSB:
- case R_IA64_SECREL32MSB:
- case R_IA64_LTV32MSB:
- case R_IA64_DTPREL32MSB:
- size = 4; bigendian = 1;
- break;
-
- case R_IA64_DIR32LSB:
- case R_IA64_GPREL32LSB:
- case R_IA64_FPTR32LSB:
- case R_IA64_PCREL32LSB:
- case R_IA64_LTOFF_FPTR32LSB:
- case R_IA64_SEGREL32LSB:
- case R_IA64_SECREL32LSB:
- case R_IA64_LTV32LSB:
- case R_IA64_DTPREL32LSB:
- size = 4; bigendian = 0;
- break;
-
- case R_IA64_DIR64MSB:
- case R_IA64_GPREL64MSB:
- case R_IA64_PLTOFF64MSB:
- case R_IA64_FPTR64MSB:
- case R_IA64_PCREL64MSB:
- case R_IA64_LTOFF_FPTR64MSB:
- case R_IA64_SEGREL64MSB:
- case R_IA64_SECREL64MSB:
- case R_IA64_LTV64MSB:
- case R_IA64_TPREL64MSB:
- case R_IA64_DTPMOD64MSB:
- case R_IA64_DTPREL64MSB:
- size = 8; bigendian = 1;
- break;
-
- case R_IA64_DIR64LSB:
- case R_IA64_GPREL64LSB:
- case R_IA64_PLTOFF64LSB:
- case R_IA64_FPTR64LSB:
- case R_IA64_PCREL64LSB:
- case R_IA64_LTOFF_FPTR64LSB:
- case R_IA64_SEGREL64LSB:
- case R_IA64_SECREL64LSB:
- case R_IA64_LTV64LSB:
- case R_IA64_TPREL64LSB:
- case R_IA64_DTPMOD64LSB:
- case R_IA64_DTPREL64LSB:
- size = 8; bigendian = 0;
- break;
-
- /* Unsupported / Dynamic relocations. */
- default:
- return bfd_reloc_notsupported;
- }
-
- switch (opnd)
- {
- case IA64_OPND_IMMU64:
- hit_addr -= (long) hit_addr & 0x3;
- t0 = bfd_get_64 (abfd, hit_addr);
- t1 = bfd_get_64 (abfd, hit_addr + 8);
-
- /* tmpl/s: bits 0.. 5 in t0
- slot 0: bits 5..45 in t0
- slot 1: bits 46..63 in t0, bits 0..22 in t1
- slot 2: bits 23..63 in t1 */
-
- /* First, clear the bits that form the 64 bit constant. */
- t0 &= ~(0x3ffffLL << 46);
- t1 &= ~(0x7fffffLL
- | (( (0x07fLL << 13) | (0x1ffLL << 27)
- | (0x01fLL << 22) | (0x001LL << 21)
- | (0x001LL << 36)) << 23));
-
- t0 |= ((val >> 22) & 0x03ffffLL) << 46; /* 18 lsbs of imm41 */
- t1 |= ((val >> 40) & 0x7fffffLL) << 0; /* 23 msbs of imm41 */
- t1 |= ( (((val >> 0) & 0x07f) << 13) /* imm7b */
- | (((val >> 7) & 0x1ff) << 27) /* imm9d */
- | (((val >> 16) & 0x01f) << 22) /* imm5c */
- | (((val >> 21) & 0x001) << 21) /* ic */
- | (((val >> 63) & 0x001) << 36)) << 23; /* i */
-
- bfd_put_64 (abfd, t0, hit_addr);
- bfd_put_64 (abfd, t1, hit_addr + 8);
- break;
-
- case IA64_OPND_TGT64:
- hit_addr -= (long) hit_addr & 0x3;
- t0 = bfd_get_64 (abfd, hit_addr);
- t1 = bfd_get_64 (abfd, hit_addr + 8);
-
- /* tmpl/s: bits 0.. 5 in t0
- slot 0: bits 5..45 in t0
- slot 1: bits 46..63 in t0, bits 0..22 in t1
- slot 2: bits 23..63 in t1 */
-
- /* First, clear the bits that form the 64 bit constant. */
- t0 &= ~(0x3ffffLL << 46);
- t1 &= ~(0x7fffffLL
- | ((1LL << 36 | 0xfffffLL << 13) << 23));
-
- val >>= 4;
- t0 |= ((val >> 20) & 0xffffLL) << 2 << 46; /* 16 lsbs of imm39 */
- t1 |= ((val >> 36) & 0x7fffffLL) << 0; /* 23 msbs of imm39 */
- t1 |= ((((val >> 0) & 0xfffffLL) << 13) /* imm20b */
- | (((val >> 59) & 0x1LL) << 36)) << 23; /* i */
-
- bfd_put_64 (abfd, t0, hit_addr);
- bfd_put_64 (abfd, t1, hit_addr + 8);
- break;
-
- default:
- switch ((long) hit_addr & 0x3)
- {
- case 0: shift = 5; break;
- case 1: shift = 14; hit_addr += 3; break;
- case 2: shift = 23; hit_addr += 6; break;
- case 3: return bfd_reloc_notsupported; /* shouldn't happen... */
- }
- dword = bfd_get_64 (abfd, hit_addr);
- insn = (dword >> shift) & 0x1ffffffffffLL;
-
- op = elf64_ia64_operands + opnd;
- err = (*op->insert) (op, val, (ia64_insn *)& insn);
- if (err)
- return bfd_reloc_overflow;
-
- dword &= ~(0x1ffffffffffLL << shift);
- dword |= (insn << shift);
- bfd_put_64 (abfd, dword, hit_addr);
- break;
-
- case IA64_OPND_NIL:
- /* A data relocation. */
- if (bigendian)
- if (size == 4)
- bfd_putb32 (val, hit_addr);
- else
- bfd_putb64 (val, hit_addr);
- else
- if (size == 4)
- bfd_putl32 (val, hit_addr);
- else
- bfd_putl64 (val, hit_addr);
- break;
- }
-
- return bfd_reloc_ok;
-}
-
-static void
-elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
- dynindx, addend)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- asection *srel;
- bfd_vma offset;
- unsigned int type;
- long dynindx;
- bfd_vma addend;
-{
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- BFD_ASSERT (dynindx != -1);
- outrel.r_info = ELFNN_R_INFO (dynindx, type);
- outrel.r_addend = addend;
- outrel.r_offset = _bfd_elf_section_offset (abfd, info, sec, offset);
- if (outrel.r_offset >= (bfd_vma) -2)
- {
- /* Run for the hills. We shouldn't be outputting a relocation
- for this. So do what everyone else does and output a no-op. */
- outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
- outrel.r_addend = 0;
- outrel.r_offset = 0;
- }
- else
- outrel.r_offset += sec->output_section->vma + sec->output_offset;
-
- loc = srel->contents;
- loc += srel->reloc_count++ * sizeof (ElfNN_External_Rela);
- bfd_elfNN_swap_reloca_out (abfd, &outrel, loc);
- BFD_ASSERT (sizeof (ElfNN_External_Rela) * srel->reloc_count
- <= srel->_cooked_size);
-}
-
-/* Store an entry for target address TARGET_ADDR in the linkage table
- and return the gp-relative address of the linkage table entry. */
-
-static bfd_vma
-set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
- bfd *abfd;
- struct bfd_link_info *info;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- long dynindx;
- bfd_vma addend;
- bfd_vma value;
- unsigned int dyn_r_type;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- asection *got_sec;
- bfd_boolean done;
- bfd_vma got_offset;
-
- ia64_info = elfNN_ia64_hash_table (info);
- got_sec = ia64_info->got_sec;
-
- switch (dyn_r_type)
- {
- case R_IA64_TPREL64LSB:
- done = dyn_i->tprel_done;
- dyn_i->tprel_done = TRUE;
- got_offset = dyn_i->tprel_offset;
- break;
- case R_IA64_DTPMOD64LSB:
- if (dyn_i->dtpmod_offset != ia64_info->self_dtpmod_offset)
- {
- done = dyn_i->dtpmod_done;
- dyn_i->dtpmod_done = TRUE;
- }
- else
- {
- done = ia64_info->self_dtpmod_done;
- ia64_info->self_dtpmod_done = TRUE;
- dynindx = 0;
- }
- got_offset = dyn_i->dtpmod_offset;
- break;
- case R_IA64_DTPREL64LSB:
- done = dyn_i->dtprel_done;
- dyn_i->dtprel_done = TRUE;
- got_offset = dyn_i->dtprel_offset;
- break;
- default:
- done = dyn_i->got_done;
- dyn_i->got_done = TRUE;
- got_offset = dyn_i->got_offset;
- break;
- }
-
- BFD_ASSERT ((got_offset & 7) == 0);
-
- if (! done)
- {
- /* Store the target address in the linkage table entry. */
- bfd_put_64 (abfd, value, got_sec->contents + got_offset);
-
- /* Install a dynamic relocation if needed. */
- if (((info->shared
- && (!dyn_i->h
- || ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
- || dyn_i->h->root.type != bfd_link_hash_undefweak)
- && dyn_r_type != R_IA64_DTPREL64LSB)
- || elfNN_ia64_dynamic_symbol_p (dyn_i->h, info, dyn_r_type)
- || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
- && (!dyn_i->want_ltoff_fptr
- || !info->pie
- || !dyn_i->h
- || dyn_i->h->root.type != bfd_link_hash_undefweak))
- {
- if (dynindx == -1
- && dyn_r_type != R_IA64_TPREL64LSB
- && dyn_r_type != R_IA64_DTPMOD64LSB
- && dyn_r_type != R_IA64_DTPREL64LSB)
- {
- dyn_r_type = R_IA64_REL64LSB;
- dynindx = 0;
- addend = value;
- }
-
- if (bfd_big_endian (abfd))
- {
- switch (dyn_r_type)
- {
- case R_IA64_REL64LSB:
- dyn_r_type = R_IA64_REL64MSB;
- break;
- case R_IA64_DIR64LSB:
- dyn_r_type = R_IA64_DIR64MSB;
- break;
- case R_IA64_FPTR64LSB:
- dyn_r_type = R_IA64_FPTR64MSB;
- break;
- case R_IA64_TPREL64LSB:
- dyn_r_type = R_IA64_TPREL64MSB;
- break;
- case R_IA64_DTPMOD64LSB:
- dyn_r_type = R_IA64_DTPMOD64MSB;
- break;
- case R_IA64_DTPREL64LSB:
- dyn_r_type = R_IA64_DTPREL64MSB;
- break;
- default:
- BFD_ASSERT (FALSE);
- break;
- }
- }
-
- elfNN_ia64_install_dyn_reloc (abfd, NULL, got_sec,
- ia64_info->rel_got_sec,
- got_offset, dyn_r_type,
- dynindx, addend);
- }
- }
-
- /* Return the address of the linkage table entry. */
- value = (got_sec->output_section->vma
- + got_sec->output_offset
- + got_offset);
-
- return value;
-}
-
-/* Fill in a function descriptor consisting of the function's code
- address and its global pointer. Return the descriptor's address. */
-
-static bfd_vma
-set_fptr_entry (abfd, info, dyn_i, value)
- bfd *abfd;
- struct bfd_link_info *info;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- bfd_vma value;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- asection *fptr_sec;
-
- ia64_info = elfNN_ia64_hash_table (info);
- fptr_sec = ia64_info->fptr_sec;
-
- if (!dyn_i->fptr_done)
- {
- dyn_i->fptr_done = 1;
-
- /* Fill in the function descriptor. */
- bfd_put_64 (abfd, value, fptr_sec->contents + dyn_i->fptr_offset);
- bfd_put_64 (abfd, _bfd_get_gp_value (abfd),
- fptr_sec->contents + dyn_i->fptr_offset + 8);
- if (ia64_info->rel_fptr_sec)
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
-
- if (bfd_little_endian (abfd))
- outrel.r_info = ELFNN_R_INFO (0, R_IA64_IPLTLSB);
- else
- outrel.r_info = ELFNN_R_INFO (0, R_IA64_IPLTMSB);
- outrel.r_addend = value;
- outrel.r_offset = (fptr_sec->output_section->vma
- + fptr_sec->output_offset
- + dyn_i->fptr_offset);
- loc = ia64_info->rel_fptr_sec->contents;
- loc += ia64_info->rel_fptr_sec->reloc_count++
- * sizeof (ElfNN_External_Rela);
- bfd_elfNN_swap_reloca_out (abfd, &outrel, loc);
- }
- }
-
- /* Return the descriptor's address. */
- value = (fptr_sec->output_section->vma
- + fptr_sec->output_offset
- + dyn_i->fptr_offset);
-
- return value;
-}
-
-/* Fill in a PLTOFF entry consisting of the function's code address
- and its global pointer. Return the descriptor's address. */
-
-static bfd_vma
-set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
- bfd *abfd;
- struct bfd_link_info *info;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- bfd_vma value;
- bfd_boolean is_plt;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- asection *pltoff_sec;
-
- ia64_info = elfNN_ia64_hash_table (info);
- pltoff_sec = ia64_info->pltoff_sec;
-
- /* Don't do anything if this symbol uses a real PLT entry. In
- that case, we'll fill this in during finish_dynamic_symbol. */
- if ((! dyn_i->want_plt || is_plt)
- && !dyn_i->pltoff_done)
- {
- bfd_vma gp = _bfd_get_gp_value (abfd);
-
- /* Fill in the function descriptor. */
- bfd_put_64 (abfd, value, pltoff_sec->contents + dyn_i->pltoff_offset);
- bfd_put_64 (abfd, gp, pltoff_sec->contents + dyn_i->pltoff_offset + 8);
-
- /* Install dynamic relocations if needed. */
- if (!is_plt
- && info->shared
- && (!dyn_i->h
- || ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
- || dyn_i->h->root.type != bfd_link_hash_undefweak))
- {
- unsigned int dyn_r_type;
-
- if (bfd_big_endian (abfd))
- dyn_r_type = R_IA64_REL64MSB;
- else
- dyn_r_type = R_IA64_REL64LSB;
-
- elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
- ia64_info->rel_pltoff_sec,
- dyn_i->pltoff_offset,
- dyn_r_type, 0, value);
- elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
- ia64_info->rel_pltoff_sec,
- dyn_i->pltoff_offset + 8,
- dyn_r_type, 0, gp);
- }
-
- dyn_i->pltoff_done = 1;
- }
-
- /* Return the descriptor's address. */
- value = (pltoff_sec->output_section->vma
- + pltoff_sec->output_offset
- + dyn_i->pltoff_offset);
-
- return value;
-}
-
-/* Return the base VMA address which should be subtracted from real addresses
- when resolving @tprel() relocation.
- Main program TLS (whose template starts at PT_TLS p_vaddr)
- is assigned offset round(16, PT_TLS p_align). */
-
-static bfd_vma
-elfNN_ia64_tprel_base (info)
- struct bfd_link_info *info;
-{
- asection *tls_sec = elf_hash_table (info)->tls_sec;
-
- BFD_ASSERT (tls_sec != NULL);
- return tls_sec->vma - align_power ((bfd_vma) 16, tls_sec->alignment_power);
-}
-
-/* Return the base VMA address which should be subtracted from real addresses
- when resolving @dtprel() relocation.
- This is PT_TLS segment p_vaddr. */
-
-static bfd_vma
-elfNN_ia64_dtprel_base (info)
- struct bfd_link_info *info;
-{
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- return elf_hash_table (info)->tls_sec->vma;
-}
-
-/* Called through qsort to sort the .IA_64.unwind section during a
- non-relocatable link. Set elfNN_ia64_unwind_entry_compare_bfd
- to the output bfd so we can do proper endianness frobbing. */
-
-static bfd *elfNN_ia64_unwind_entry_compare_bfd;
-
-static int
-elfNN_ia64_unwind_entry_compare (a, b)
- const PTR a;
- const PTR b;
-{
- bfd_vma av, bv;
-
- av = bfd_get_64 (elfNN_ia64_unwind_entry_compare_bfd, a);
- bv = bfd_get_64 (elfNN_ia64_unwind_entry_compare_bfd, b);
-
- return (av < bv ? -1 : av > bv ? 1 : 0);
-}
-
-/* Make sure we've got ourselves a nice fat __gp value. */
-static bfd_boolean
-elfNN_ia64_choose_gp (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- bfd_vma min_vma = (bfd_vma) -1, max_vma = 0;
- bfd_vma min_short_vma = min_vma, max_short_vma = 0;
- struct elf_link_hash_entry *gp;
- bfd_vma gp_val;
- asection *os;
- struct elfNN_ia64_link_hash_table *ia64_info;
-
- ia64_info = elfNN_ia64_hash_table (info);
-
- /* Find the min and max vma of all sections marked short. Also collect
- min and max vma of any type, for use in selecting a nice gp. */
- for (os = abfd->sections; os ; os = os->next)
- {
- bfd_vma lo, hi;
-
- if ((os->flags & SEC_ALLOC) == 0)
- continue;
-
- lo = os->vma;
- hi = os->vma + os->_raw_size;
- if (hi < lo)
- hi = (bfd_vma) -1;
-
- if (min_vma > lo)
- min_vma = lo;
- if (max_vma < hi)
- max_vma = hi;
- if (os->flags & SEC_SMALL_DATA)
- {
- if (min_short_vma > lo)
- min_short_vma = lo;
- if (max_short_vma < hi)
- max_short_vma = hi;
- }
- }
-
- /* See if the user wants to force a value. */
- gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
- FALSE, FALSE);
-
- if (gp
- && (gp->root.type == bfd_link_hash_defined
- || gp->root.type == bfd_link_hash_defweak))
- {
- asection *gp_sec = gp->root.u.def.section;
- gp_val = (gp->root.u.def.value
- + gp_sec->output_section->vma
- + gp_sec->output_offset);
- }
- else
- {
- /* Pick a sensible value. */
-
- asection *got_sec = ia64_info->got_sec;
-
- /* Start with just the address of the .got. */
- if (got_sec)
- gp_val = got_sec->output_section->vma;
- else if (max_short_vma != 0)
- gp_val = min_short_vma;
- else
- gp_val = min_vma;
-
- /* If it is possible to address the entire image, but we
- don't with the choice above, adjust. */
- if (max_vma - min_vma < 0x400000
- && max_vma - gp_val <= 0x200000
- && gp_val - min_vma > 0x200000)
- gp_val = min_vma + 0x200000;
- else if (max_short_vma != 0)
- {
- /* If we don't cover all the short data, adjust. */
- if (max_short_vma - gp_val >= 0x200000)
- gp_val = min_short_vma + 0x200000;
-
- /* If we're addressing stuff past the end, adjust back. */
- if (gp_val > max_vma)
- gp_val = max_vma - 0x200000 + 8;
- }
- }
-
- /* Validate whether all SHF_IA_64_SHORT sections are within
- range of the chosen GP. */
-
- if (max_short_vma != 0)
- {
- if (max_short_vma - min_short_vma >= 0x400000)
- {
- (*_bfd_error_handler)
- (_("%s: short data segment overflowed (0x%lx >= 0x400000)"),
- bfd_get_filename (abfd),
- (unsigned long) (max_short_vma - min_short_vma));
- return FALSE;
- }
- else if ((gp_val > min_short_vma
- && gp_val - min_short_vma > 0x200000)
- || (gp_val < max_short_vma
- && max_short_vma - gp_val >= 0x200000))
- {
- (*_bfd_error_handler)
- (_("%s: __gp does not cover short data segment"),
- bfd_get_filename (abfd));
- return FALSE;
- }
- }
-
- _bfd_set_gp_value (abfd, gp_val);
-
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_ia64_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- asection *unwind_output_sec;
-
- ia64_info = elfNN_ia64_hash_table (info);
-
- /* Make sure we've got ourselves a nice fat __gp value. */
- if (!info->relocatable)
- {
- bfd_vma gp_val = _bfd_get_gp_value (abfd);
- struct elf_link_hash_entry *gp;
-
- if (gp_val == 0)
- {
- if (! elfNN_ia64_choose_gp (abfd, info))
- return FALSE;
- gp_val = _bfd_get_gp_value (abfd);
- }
-
- gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
- FALSE, FALSE);
- if (gp)
- {
- gp->root.type = bfd_link_hash_defined;
- gp->root.u.def.value = gp_val;
- gp->root.u.def.section = bfd_abs_section_ptr;
- }
- }
-
- /* If we're producing a final executable, we need to sort the contents
- of the .IA_64.unwind section. Force this section to be relocated
- into memory rather than written immediately to the output file. */
- unwind_output_sec = NULL;
- if (!info->relocatable)
- {
- asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind);
- if (s)
- {
- unwind_output_sec = s->output_section;
- unwind_output_sec->contents
- = bfd_malloc (unwind_output_sec->_raw_size);
- if (unwind_output_sec->contents == NULL)
- return FALSE;
- }
- }
-
- /* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
- return FALSE;
-
- if (unwind_output_sec)
- {
- elfNN_ia64_unwind_entry_compare_bfd = abfd;
- qsort (unwind_output_sec->contents,
- (size_t) (unwind_output_sec->_raw_size / 24),
- 24,
- elfNN_ia64_unwind_entry_compare);
-
- if (! bfd_set_section_contents (abfd, unwind_output_sec,
- unwind_output_sec->contents, (bfd_vma) 0,
- unwind_output_sec->_raw_size))
- return FALSE;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
- asection *srel;
- bfd_boolean ret_val = TRUE; /* for non-fatal errors */
- bfd_vma gp_val;
-
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- ia64_info = elfNN_ia64_hash_table (info);
-
- /* Infect various flags from the input section to the output section. */
- if (info->relocatable)
- {
- bfd_vma flags;
-
- flags = elf_section_data(input_section)->this_hdr.sh_flags;
- flags &= SHF_IA_64_NORECOV;
-
- elf_section_data(input_section->output_section)
- ->this_hdr.sh_flags |= flags;
- return TRUE;
- }
-
- gp_val = _bfd_get_gp_value (output_bfd);
- srel = get_reloc_section (input_bfd, ia64_info, input_section, FALSE);
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; ++rel)
- {
- struct elf_link_hash_entry *h;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- bfd_reloc_status_type r;
- reloc_howto_type *howto;
- unsigned long r_symndx;
- Elf_Internal_Sym *sym;
- unsigned int r_type;
- bfd_vma value;
- asection *sym_sec;
- bfd_byte *hit_addr;
- bfd_boolean dynamic_symbol_p;
- bfd_boolean undef_weak_ref;
-
- r_type = ELFNN_R_TYPE (rel->r_info);
- if (r_type > R_IA64_MAX_RELOC_CODE)
- {
- (*_bfd_error_handler)
- (_("%s: unknown relocation type %d"),
- bfd_archive_filename (input_bfd), (int)r_type);
- bfd_set_error (bfd_error_bad_value);
- ret_val = FALSE;
- continue;
- }
-
- howto = lookup_howto (r_type);
- r_symndx = ELFNN_R_SYM (rel->r_info);
- h = NULL;
- sym = NULL;
- sym_sec = NULL;
- undef_weak_ref = FALSE;
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- /* Reloc against local symbol. */
- asection *msec;
- sym = local_syms + r_symndx;
- sym_sec = local_sections[r_symndx];
- msec = sym_sec;
- value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
- if ((sym_sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
- {
- struct elfNN_ia64_local_hash_entry *loc_h;
-
- loc_h = get_local_sym_hash (ia64_info, input_bfd, rel, FALSE);
- if (loc_h && ! loc_h->sec_merge_done)
- {
- struct elfNN_ia64_dyn_sym_info *dynent;
-
- for (dynent = loc_h->info; dynent; dynent = dynent->next)
- {
- msec = sym_sec;
- dynent->addend =
- _bfd_merged_section_offset (output_bfd, &msec,
- elf_section_data (msec)->
- sec_info,
- sym->st_value
- + dynent->addend,
- (bfd_vma) 0);
- dynent->addend -= sym->st_value;
- dynent->addend += msec->output_section->vma
- + msec->output_offset
- - sym_sec->output_section->vma
- - sym_sec->output_offset;
- }
- loc_h->sec_merge_done = 1;
- }
- }
- }
- else
- {
- bfd_boolean unresolved_reloc;
- bfd_boolean warned;
- struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sym_sec, value,
- unresolved_reloc, warned);
-
- if (h->root.type == bfd_link_hash_undefweak)
- undef_weak_ref = TRUE;
- else if (warned)
- continue;
- }
-
- hit_addr = contents + rel->r_offset;
- value += rel->r_addend;
- dynamic_symbol_p = elfNN_ia64_dynamic_symbol_p (h, info, r_type);
-
- switch (r_type)
- {
- case R_IA64_NONE:
- case R_IA64_LDXMOV:
- continue;
-
- case R_IA64_IMM14:
- case R_IA64_IMM22:
- case R_IA64_IMM64:
- case R_IA64_DIR32MSB:
- case R_IA64_DIR32LSB:
- case R_IA64_DIR64MSB:
- case R_IA64_DIR64LSB:
- /* Install a dynamic relocation for this reloc. */
- if ((dynamic_symbol_p || info->shared)
- && r_symndx != 0
- && (input_section->flags & SEC_ALLOC) != 0)
- {
- unsigned int dyn_r_type;
- long dynindx;
- bfd_vma addend;
-
- BFD_ASSERT (srel != NULL);
-
- switch (r_type)
- {
- case R_IA64_IMM14:
- case R_IA64_IMM22:
- case R_IA64_IMM64:
- /* ??? People shouldn't be doing non-pic code in
- shared libraries nor dynamic executables. */
- (*_bfd_error_handler)
- (_("%s: non-pic code with imm relocation against dynamic symbol `%s'"),
- bfd_archive_filename (input_bfd),
- h->root.root.string);
- ret_val = FALSE;
- continue;
-
- default:
- break;
- }
-
- /* If we don't need dynamic symbol lookup, find a
- matching RELATIVE relocation. */
- dyn_r_type = r_type;
- if (dynamic_symbol_p)
- {
- dynindx = h->dynindx;
- addend = rel->r_addend;
- value = 0;
- }
- else
- {
- switch (r_type)
- {
- case R_IA64_DIR32MSB:
- dyn_r_type = R_IA64_REL32MSB;
- break;
- case R_IA64_DIR32LSB:
- dyn_r_type = R_IA64_REL32LSB;
- break;
- case R_IA64_DIR64MSB:
- dyn_r_type = R_IA64_REL64MSB;
- break;
- case R_IA64_DIR64LSB:
- dyn_r_type = R_IA64_REL64LSB;
- break;
-
- default:
- break;
- }
- dynindx = 0;
- addend = value;
- }
-
- elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
- srel, rel->r_offset, dyn_r_type,
- dynindx, addend);
- }
- /* Fall through. */
-
- case R_IA64_LTV32MSB:
- case R_IA64_LTV32LSB:
- case R_IA64_LTV64MSB:
- case R_IA64_LTV64LSB:
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_GPREL22:
- case R_IA64_GPREL64I:
- case R_IA64_GPREL32MSB:
- case R_IA64_GPREL32LSB:
- case R_IA64_GPREL64MSB:
- case R_IA64_GPREL64LSB:
- if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: @gprel relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.string);
- ret_val = FALSE;
- continue;
- }
- value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_LTOFF22:
- case R_IA64_LTOFF22X:
- case R_IA64_LTOFF64I:
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
- value = set_got_entry (input_bfd, info, dyn_i, (h ? h->dynindx : -1),
- rel->r_addend, value, R_IA64_DIR64LSB);
- value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_PLTOFF22:
- case R_IA64_PLTOFF64I:
- case R_IA64_PLTOFF64MSB:
- case R_IA64_PLTOFF64LSB:
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
- value = set_pltoff_entry (output_bfd, info, dyn_i, value, FALSE);
- value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_FPTR64I:
- case R_IA64_FPTR32MSB:
- case R_IA64_FPTR32LSB:
- case R_IA64_FPTR64MSB:
- case R_IA64_FPTR64LSB:
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
- if (dyn_i->want_fptr)
- {
- if (!undef_weak_ref)
- value = set_fptr_entry (output_bfd, info, dyn_i, value);
- }
- if (!dyn_i->want_fptr || info->pie)
- {
- long dynindx;
- unsigned int dyn_r_type = r_type;
- bfd_vma addend = rel->r_addend;
-
- /* Otherwise, we expect the dynamic linker to create
- the entry. */
-
- if (dyn_i->want_fptr)
- {
- if (r_type == R_IA64_FPTR64I)
- {
- /* We can't represent this without a dynamic symbol.
- Adjust the relocation to be against an output
- section symbol, which are always present in the
- dynamic symbol table. */
- /* ??? People shouldn't be doing non-pic code in
- shared libraries. Hork. */
- (*_bfd_error_handler)
- (_("%s: linking non-pic code in a position independent executable"),
- bfd_archive_filename (input_bfd));
- ret_val = FALSE;
- continue;
- }
- dynindx = 0;
- addend = value;
- dyn_r_type = r_type + R_IA64_REL64LSB - R_IA64_FPTR64LSB;
- }
- else if (h)
- {
- if (h->dynindx != -1)
- dynindx = h->dynindx;
- else
- dynindx = (_bfd_elf_link_lookup_local_dynindx
- (info, h->root.u.def.section->owner,
- global_sym_index (h)));
- value = 0;
- }
- else
- {
- dynindx = (_bfd_elf_link_lookup_local_dynindx
- (info, input_bfd, (long) r_symndx));
- value = 0;
- }
-
- elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
- srel, rel->r_offset, dyn_r_type,
- dynindx, addend);
- }
-
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_LTOFF_FPTR22:
- case R_IA64_LTOFF_FPTR64I:
- case R_IA64_LTOFF_FPTR32MSB:
- case R_IA64_LTOFF_FPTR32LSB:
- case R_IA64_LTOFF_FPTR64MSB:
- case R_IA64_LTOFF_FPTR64LSB:
- {
- long dynindx;
-
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
- if (dyn_i->want_fptr)
- {
- BFD_ASSERT (h == NULL || h->dynindx == -1)
- if (!undef_weak_ref)
- value = set_fptr_entry (output_bfd, info, dyn_i, value);
- dynindx = -1;
- }
- else
- {
- /* Otherwise, we expect the dynamic linker to create
- the entry. */
- if (h)
- {
- if (h->dynindx != -1)
- dynindx = h->dynindx;
- else
- dynindx = (_bfd_elf_link_lookup_local_dynindx
- (info, h->root.u.def.section->owner,
- global_sym_index (h)));
- }
- else
- dynindx = (_bfd_elf_link_lookup_local_dynindx
- (info, input_bfd, (long) r_symndx));
- value = 0;
- }
-
- value = set_got_entry (output_bfd, info, dyn_i, dynindx,
- rel->r_addend, value, R_IA64_FPTR64LSB);
- value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- }
- break;
-
- case R_IA64_PCREL32MSB:
- case R_IA64_PCREL32LSB:
- case R_IA64_PCREL64MSB:
- case R_IA64_PCREL64LSB:
- /* Install a dynamic relocation for this reloc. */
- if (dynamic_symbol_p && r_symndx != 0)
- {
- BFD_ASSERT (srel != NULL);
-
- elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
- srel, rel->r_offset, r_type,
- h->dynindx, rel->r_addend);
- }
- goto finish_pcrel;
-
- case R_IA64_PCREL21B:
- case R_IA64_PCREL60B:
- /* We should have created a PLT entry for any dynamic symbol. */
- dyn_i = NULL;
- if (h)
- dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, FALSE);
-
- if (dyn_i && dyn_i->want_plt2)
- {
- /* Should have caught this earlier. */
- BFD_ASSERT (rel->r_addend == 0);
-
- value = (ia64_info->plt_sec->output_section->vma
- + ia64_info->plt_sec->output_offset
- + dyn_i->plt2_offset);
- }
- else
- {
- /* Since there's no PLT entry, Validate that this is
- locally defined. */
- BFD_ASSERT (undef_weak_ref || sym_sec->output_section != NULL);
-
- /* If the symbol is undef_weak, we shouldn't be trying
- to call it. There's every chance that we'd wind up
- with an out-of-range fixup here. Don't bother setting
- any value at all. */
- if (undef_weak_ref)
- continue;
- }
- goto finish_pcrel;
-
- case R_IA64_PCREL21BI:
- case R_IA64_PCREL21F:
- case R_IA64_PCREL21M:
- case R_IA64_PCREL22:
- case R_IA64_PCREL64I:
- /* The PCREL21BI reloc is specifically not intended for use with
- dynamic relocs. PCREL21F and PCREL21M are used for speculation
- fixup code, and thus probably ought not be dynamic. The
- PCREL22 and PCREL64I relocs aren't emitted as dynamic relocs. */
- if (dynamic_symbol_p)
- {
- const char *msg;
-
- if (r_type == R_IA64_PCREL21BI)
- msg = _("%s: @internal branch to dynamic symbol %s");
- else if (r_type == R_IA64_PCREL21F || r_type == R_IA64_PCREL21M)
- msg = _("%s: speculation fixup to dynamic symbol %s");
- else
- msg = _("%s: @pcrel relocation against dynamic symbol %s");
- (*_bfd_error_handler) (msg, bfd_archive_filename (input_bfd),
- h->root.root.string);
- ret_val = FALSE;
- continue;
- }
- goto finish_pcrel;
-
- finish_pcrel:
- /* Make pc-relative. */
- value -= (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset) & ~ (bfd_vma) 0x3;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_SEGREL32MSB:
- case R_IA64_SEGREL32LSB:
- case R_IA64_SEGREL64MSB:
- case R_IA64_SEGREL64LSB:
- if (r_symndx == 0)
- {
- /* If the input section was discarded from the output, then
- do nothing. */
- r = bfd_reloc_ok;
- }
- else
- {
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
- /* Find the segment that contains the output_section. */
- for (m = elf_tdata (output_bfd)->segment_map,
- p = elf_tdata (output_bfd)->phdr;
- m != NULL;
- m = m->next, p++)
- {
- int i;
- for (i = m->count - 1; i >= 0; i--)
- if (m->sections[i] == input_section->output_section)
- break;
- if (i >= 0)
- break;
- }
-
- if (m == NULL)
- {
- r = bfd_reloc_notsupported;
- }
- else
- {
- /* The VMA of the segment is the vaddr of the associated
- program header. */
- if (value > p->p_vaddr)
- value -= p->p_vaddr;
- else
- value = 0;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
- r_type);
- }
- break;
- }
-
- case R_IA64_SECREL32MSB:
- case R_IA64_SECREL32LSB:
- case R_IA64_SECREL64MSB:
- case R_IA64_SECREL64LSB:
- /* Make output-section relative. */
- if (value > input_section->output_section->vma)
- value -= input_section->output_section->vma;
- else
- value = 0;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_IPLTMSB:
- case R_IA64_IPLTLSB:
- /* Install a dynamic relocation for this reloc. */
- if ((dynamic_symbol_p || info->shared)
- && (input_section->flags & SEC_ALLOC) != 0)
- {
- BFD_ASSERT (srel != NULL);
-
- /* If we don't need dynamic symbol lookup, install two
- RELATIVE relocations. */
- if (!dynamic_symbol_p)
- {
- unsigned int dyn_r_type;
-
- if (r_type == R_IA64_IPLTMSB)
- dyn_r_type = R_IA64_REL64MSB;
- else
- dyn_r_type = R_IA64_REL64LSB;
-
- elfNN_ia64_install_dyn_reloc (output_bfd, info,
- input_section,
- srel, rel->r_offset,
- dyn_r_type, 0, value);
- elfNN_ia64_install_dyn_reloc (output_bfd, info,
- input_section,
- srel, rel->r_offset + 8,
- dyn_r_type, 0, gp_val);
- }
- else
- elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
- srel, rel->r_offset, r_type,
- h->dynindx, rel->r_addend);
- }
-
- if (r_type == R_IA64_IPLTMSB)
- r_type = R_IA64_DIR64MSB;
- else
- r_type = R_IA64_DIR64LSB;
- elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- r = elfNN_ia64_install_value (output_bfd, hit_addr + 8, gp_val,
- r_type);
- break;
-
- case R_IA64_TPREL14:
- case R_IA64_TPREL22:
- case R_IA64_TPREL64I:
- value -= elfNN_ia64_tprel_base (info);
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_DTPREL14:
- case R_IA64_DTPREL22:
- case R_IA64_DTPREL64I:
- case R_IA64_DTPREL64LSB:
- case R_IA64_DTPREL64MSB:
- value -= elfNN_ia64_dtprel_base (info);
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
- break;
-
- case R_IA64_LTOFF_TPREL22:
- case R_IA64_LTOFF_DTPMOD22:
- case R_IA64_LTOFF_DTPREL22:
- {
- int got_r_type;
- long dynindx = h ? h->dynindx : -1;
- bfd_vma r_addend = rel->r_addend;
-
- switch (r_type)
- {
- default:
- case R_IA64_LTOFF_TPREL22:
- if (!dynamic_symbol_p)
- {
- if (!info->shared)
- value -= elfNN_ia64_tprel_base (info);
- else
- {
- r_addend += value - elfNN_ia64_dtprel_base (info);
- dynindx = 0;
- }
- }
- got_r_type = R_IA64_TPREL64LSB;
- break;
- case R_IA64_LTOFF_DTPMOD22:
- if (!dynamic_symbol_p && !info->shared)
- value = 1;
- got_r_type = R_IA64_DTPMOD64LSB;
- break;
- case R_IA64_LTOFF_DTPREL22:
- if (!dynamic_symbol_p)
- value -= elfNN_ia64_dtprel_base (info);
- got_r_type = R_IA64_DTPREL64LSB;
- break;
- }
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
- value = set_got_entry (input_bfd, info, dyn_i, dynindx, r_addend,
- value, got_r_type);
- value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
- r_type);
- }
- break;
-
- default:
- r = bfd_reloc_notsupported;
- break;
- }
-
- switch (r)
- {
- case bfd_reloc_ok:
- break;
-
- case bfd_reloc_undefined:
- /* This can happen for global table relative relocs if
- __gp is undefined. This is a panic situation so we
- don't try to continue. */
- (*info->callbacks->undefined_symbol)
- (info, "__gp", input_bfd, input_section, rel->r_offset, 1);
- return FALSE;
-
- case bfd_reloc_notsupported:
- {
- const char *name;
-
- if (h)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, input_section);
- }
- if (!(*info->callbacks->warning) (info, _("unsupported reloc"),
- name, input_bfd,
- input_section, rel->r_offset))
- return FALSE;
- ret_val = FALSE;
- }
- break;
-
- case bfd_reloc_dangerous:
- case bfd_reloc_outofrange:
- case bfd_reloc_overflow:
- default:
- {
- const char *name;
-
- if (h)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, input_section);
- }
- if (!(*info->callbacks->reloc_overflow) (info, name,
- howto->name,
- (bfd_vma) 0,
- input_bfd,
- input_section,
- rel->r_offset))
- return FALSE;
- ret_val = FALSE;
- }
- break;
- }
- }
-
- return ret_val;
-}
-
-static bfd_boolean
-elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
-
- ia64_info = elfNN_ia64_hash_table (info);
- dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, FALSE);
-
- /* Fill in the PLT data, if required. */
- if (dyn_i && dyn_i->want_plt)
- {
- Elf_Internal_Rela outrel;
- bfd_byte *loc;
- asection *plt_sec;
- bfd_vma plt_addr, pltoff_addr, gp_val, index;
-
- gp_val = _bfd_get_gp_value (output_bfd);
-
- /* Initialize the minimal PLT entry. */
-
- index = (dyn_i->plt_offset - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE;
- plt_sec = ia64_info->plt_sec;
- loc = plt_sec->contents + dyn_i->plt_offset;
-
- memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE);
- elfNN_ia64_install_value (output_bfd, loc, index, R_IA64_IMM22);
- elfNN_ia64_install_value (output_bfd, loc+2, -dyn_i->plt_offset,
- R_IA64_PCREL21B);
-
- plt_addr = (plt_sec->output_section->vma
- + plt_sec->output_offset
- + dyn_i->plt_offset);
- pltoff_addr = set_pltoff_entry (output_bfd, info, dyn_i, plt_addr, TRUE);
-
- /* Initialize the FULL PLT entry, if needed. */
- if (dyn_i->want_plt2)
- {
- loc = plt_sec->contents + dyn_i->plt2_offset;
-
- memcpy (loc, plt_full_entry, PLT_FULL_ENTRY_SIZE);
- elfNN_ia64_install_value (output_bfd, loc, pltoff_addr - gp_val,
- R_IA64_IMM22);
-
- /* Mark the symbol as undefined, rather than as defined in the
- plt section. Leave the value alone. */
- /* ??? We didn't redefine it in adjust_dynamic_symbol in the
- first place. But perhaps elflink.c did some for us. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- sym->st_shndx = SHN_UNDEF;
- }
-
- /* Create the dynamic relocation. */
- outrel.r_offset = pltoff_addr;
- if (bfd_little_endian (output_bfd))
- outrel.r_info = ELFNN_R_INFO (h->dynindx, R_IA64_IPLTLSB);
- else
- outrel.r_info = ELFNN_R_INFO (h->dynindx, R_IA64_IPLTMSB);
- outrel.r_addend = 0;
-
- /* This is fun. In the .IA_64.pltoff section, we've got entries
- that correspond both to real PLT entries, and those that
- happened to resolve to local symbols but need to be created
- to satisfy @pltoff relocations. The .rela.IA_64.pltoff
- relocations for the real PLT should come at the end of the
- section, so that they can be indexed by plt entry at runtime.
-
- We emitted all of the relocations for the non-PLT @pltoff
- entries during relocate_section. So we can consider the
- existing sec->reloc_count to be the base of the array of
- PLT relocations. */
-
- loc = ia64_info->rel_pltoff_sec->contents;
- loc += ((ia64_info->rel_pltoff_sec->reloc_count + index)
- * sizeof (ElfNN_External_Rela));
- bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc);
- }
-
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
-
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_ia64_finish_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- struct elfNN_ia64_link_hash_table *ia64_info;
- bfd *dynobj;
-
- ia64_info = elfNN_ia64_hash_table (info);
- dynobj = ia64_info->root.dynobj;
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- ElfNN_External_Dyn *dyncon, *dynconend;
- asection *sdyn, *sgotplt;
- bfd_vma gp_val;
-
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
- sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- BFD_ASSERT (sdyn != NULL);
- dyncon = (ElfNN_External_Dyn *) sdyn->contents;
- dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
-
- gp_val = _bfd_get_gp_value (abfd);
-
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
-
- bfd_elfNN_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- case DT_PLTGOT:
- dyn.d_un.d_ptr = gp_val;
- break;
-
- case DT_PLTRELSZ:
- dyn.d_un.d_val = (ia64_info->minplt_entries
- * sizeof (ElfNN_External_Rela));
- break;
-
- case DT_JMPREL:
- /* See the comment above in finish_dynamic_symbol. */
- dyn.d_un.d_ptr = (ia64_info->rel_pltoff_sec->output_section->vma
- + ia64_info->rel_pltoff_sec->output_offset
- + (ia64_info->rel_pltoff_sec->reloc_count
- * sizeof (ElfNN_External_Rela)));
- break;
-
- case DT_IA_64_PLT_RESERVE:
- dyn.d_un.d_ptr = (sgotplt->output_section->vma
- + sgotplt->output_offset);
- break;
-
- case DT_RELASZ:
- /* Do not have RELASZ include JMPREL. This makes things
- easier on ld.so. This is not what the rest of BFD set up. */
- dyn.d_un.d_val -= (ia64_info->minplt_entries
- * sizeof (ElfNN_External_Rela));
- break;
- }
-
- bfd_elfNN_swap_dyn_out (abfd, &dyn, dyncon);
- }
-
- /* Initialize the PLT0 entry. */
- if (ia64_info->plt_sec)
- {
- bfd_byte *loc = ia64_info->plt_sec->contents;
- bfd_vma pltres;
-
- memcpy (loc, plt_header, PLT_HEADER_SIZE);
-
- pltres = (sgotplt->output_section->vma
- + sgotplt->output_offset
- - gp_val);
-
- elfNN_ia64_install_value (abfd, loc+1, pltres, R_IA64_GPREL22);
- }
- }
-
- return TRUE;
-}
-
-/* ELF file flag handling: */
-
-/* Function to keep IA-64 specific file flags. */
-static bfd_boolean
-elfNN_ia64_set_private_flags (abfd, flags)
- bfd *abfd;
- flagword flags;
-{
- BFD_ASSERT (!elf_flags_init (abfd)
- || elf_elfheader (abfd)->e_flags == flags);
-
- elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = TRUE;
- return TRUE;
-}
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
-static bfd_boolean
-elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd, *obfd;
-{
- flagword out_flags;
- flagword in_flags;
- bfd_boolean ok = TRUE;
-
- /* Don't even pretend to support mixed-format linking. */
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return FALSE;
-
- in_flags = elf_elfheader (ibfd)->e_flags;
- out_flags = elf_elfheader (obfd)->e_flags;
-
- if (! elf_flags_init (obfd))
- {
- elf_flags_init (obfd) = TRUE;
- elf_elfheader (obfd)->e_flags = in_flags;
-
- if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
- && bfd_get_arch_info (obfd)->the_default)
- {
- return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
- bfd_get_mach (ibfd));
- }
-
- return TRUE;
- }
-
- /* Check flag compatibility. */
- if (in_flags == out_flags)
- return TRUE;
-
- /* Output has EF_IA_64_REDUCEDFP set only if all inputs have it set. */
- if (!(in_flags & EF_IA_64_REDUCEDFP) && (out_flags & EF_IA_64_REDUCEDFP))
- elf_elfheader (obfd)->e_flags &= ~EF_IA_64_REDUCEDFP;
-
- if ((in_flags & EF_IA_64_TRAPNIL) != (out_flags & EF_IA_64_TRAPNIL))
- {
- (*_bfd_error_handler)
- (_("%s: linking trap-on-NULL-dereference with non-trapping files"),
- bfd_archive_filename (ibfd));
-
- bfd_set_error (bfd_error_bad_value);
- ok = FALSE;
- }
- if ((in_flags & EF_IA_64_BE) != (out_flags & EF_IA_64_BE))
- {
- (*_bfd_error_handler)
- (_("%s: linking big-endian files with little-endian files"),
- bfd_archive_filename (ibfd));
-
- bfd_set_error (bfd_error_bad_value);
- ok = FALSE;
- }
- if ((in_flags & EF_IA_64_ABI64) != (out_flags & EF_IA_64_ABI64))
- {
- (*_bfd_error_handler)
- (_("%s: linking 64-bit files with 32-bit files"),
- bfd_archive_filename (ibfd));
-
- bfd_set_error (bfd_error_bad_value);
- ok = FALSE;
- }
- if ((in_flags & EF_IA_64_CONS_GP) != (out_flags & EF_IA_64_CONS_GP))
- {
- (*_bfd_error_handler)
- (_("%s: linking constant-gp files with non-constant-gp files"),
- bfd_archive_filename (ibfd));
-
- bfd_set_error (bfd_error_bad_value);
- ok = FALSE;
- }
- if ((in_flags & EF_IA_64_NOFUNCDESC_CONS_GP)
- != (out_flags & EF_IA_64_NOFUNCDESC_CONS_GP))
- {
- (*_bfd_error_handler)
- (_("%s: linking auto-pic files with non-auto-pic files"),
- bfd_archive_filename (ibfd));
-
- bfd_set_error (bfd_error_bad_value);
- ok = FALSE;
- }
-
- return ok;
-}
-
-static bfd_boolean
-elfNN_ia64_print_private_bfd_data (abfd, ptr)
- bfd *abfd;
- PTR ptr;
-{
- FILE *file = (FILE *) ptr;
- flagword flags = elf_elfheader (abfd)->e_flags;
-
- BFD_ASSERT (abfd != NULL && ptr != NULL);
-
- fprintf (file, "private flags = %s%s%s%s%s%s%s%s\n",
- (flags & EF_IA_64_TRAPNIL) ? "TRAPNIL, " : "",
- (flags & EF_IA_64_EXT) ? "EXT, " : "",
- (flags & EF_IA_64_BE) ? "BE, " : "LE, ",
- (flags & EF_IA_64_REDUCEDFP) ? "REDUCEDFP, " : "",
- (flags & EF_IA_64_CONS_GP) ? "CONS_GP, " : "",
- (flags & EF_IA_64_NOFUNCDESC_CONS_GP) ? "NOFUNCDESC_CONS_GP, " : "",
- (flags & EF_IA_64_ABSOLUTE) ? "ABSOLUTE, " : "",
- (flags & EF_IA_64_ABI64) ? "ABI64" : "ABI32");
-
- _bfd_elf_print_private_bfd_data (abfd, ptr);
- return TRUE;
-}
-
-static enum elf_reloc_type_class
-elfNN_ia64_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
-{
- switch ((int) ELFNN_R_TYPE (rela->r_info))
- {
- case R_IA64_REL32MSB:
- case R_IA64_REL32LSB:
- case R_IA64_REL64MSB:
- case R_IA64_REL64LSB:
- return reloc_class_relative;
- case R_IA64_IPLTMSB:
- case R_IA64_IPLTLSB:
- return reloc_class_plt;
- case R_IA64_COPY:
- return reloc_class_copy;
- default:
- return reloc_class_normal;
- }
-}
-
-static struct bfd_elf_special_section const elfNN_ia64_special_sections[]=
-{
- { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
- { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
- { NULL, 0, 0, 0, 0 }
-};
-
-static bfd_boolean
-elfNN_ia64_hpux_vec (const bfd_target *vec)
-{
- extern const bfd_target bfd_elfNN_ia64_hpux_big_vec;
- return (vec == & bfd_elfNN_ia64_hpux_big_vec);
-}
-
-static void
-elfNN_hpux_post_process_headers (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
-{
- Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
-
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
- i_ehdrp->e_ident[EI_ABIVERSION] = 1;
-}
-
-bfd_boolean
-elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
- int *retval;
-{
- if (bfd_is_com_section (sec))
- {
- *retval = SHN_IA_64_ANSI_COMMON;
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
- asymbol *asym)
-{
- elf_symbol_type *elfsym = (elf_symbol_type *) asym;;
-
- switch (elfsym->internal_elf_sym.st_shndx)
- {
- case SHN_IA_64_ANSI_COMMON:
- asym->section = bfd_com_section_ptr;
- asym->value = elfsym->internal_elf_sym.st_size;
- asym->flags &= ~BSF_GLOBAL;
- break;
- }
-}
-
-
-#define TARGET_LITTLE_SYM bfd_elfNN_ia64_little_vec
-#define TARGET_LITTLE_NAME "elfNN-ia64-little"
-#define TARGET_BIG_SYM bfd_elfNN_ia64_big_vec
-#define TARGET_BIG_NAME "elfNN-ia64-big"
-#define ELF_ARCH bfd_arch_ia64
-#define ELF_MACHINE_CODE EM_IA_64
-#define ELF_MACHINE_ALT1 1999 /* EAS2.3 */
-#define ELF_MACHINE_ALT2 1998 /* EAS2.2 */
-#define ELF_MAXPAGESIZE 0x10000 /* 64KB */
-
-#define elf_backend_section_from_shdr \
- elfNN_ia64_section_from_shdr
-#define elf_backend_section_flags \
- elfNN_ia64_section_flags
-#define elf_backend_fake_sections \
- elfNN_ia64_fake_sections
-#define elf_backend_final_write_processing \
- elfNN_ia64_final_write_processing
-#define elf_backend_add_symbol_hook \
- elfNN_ia64_add_symbol_hook
-#define elf_backend_additional_program_headers \
- elfNN_ia64_additional_program_headers
-#define elf_backend_modify_segment_map \
- elfNN_ia64_modify_segment_map
-#define elf_info_to_howto \
- elfNN_ia64_info_to_howto
-
-#define bfd_elfNN_bfd_reloc_type_lookup \
- elfNN_ia64_reloc_type_lookup
-#define bfd_elfNN_bfd_is_local_label_name \
- elfNN_ia64_is_local_label_name
-#define bfd_elfNN_bfd_relax_section \
- elfNN_ia64_relax_section
-
-/* Stuff for the BFD linker: */
-#define bfd_elfNN_bfd_link_hash_table_create \
- elfNN_ia64_hash_table_create
-#define bfd_elfNN_bfd_link_hash_table_free \
- elfNN_ia64_hash_table_free
-#define elf_backend_create_dynamic_sections \
- elfNN_ia64_create_dynamic_sections
-#define elf_backend_check_relocs \
- elfNN_ia64_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
- elfNN_ia64_adjust_dynamic_symbol
-#define elf_backend_size_dynamic_sections \
- elfNN_ia64_size_dynamic_sections
-#define elf_backend_relocate_section \
- elfNN_ia64_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- elfNN_ia64_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- elfNN_ia64_finish_dynamic_sections
-#define bfd_elfNN_bfd_final_link \
- elfNN_ia64_final_link
-
-#define bfd_elfNN_bfd_merge_private_bfd_data \
- elfNN_ia64_merge_private_bfd_data
-#define bfd_elfNN_bfd_set_private_flags \
- elfNN_ia64_set_private_flags
-#define bfd_elfNN_bfd_print_private_bfd_data \
- elfNN_ia64_print_private_bfd_data
-
-#define elf_backend_plt_readonly 1
-#define elf_backend_want_plt_sym 0
-#define elf_backend_plt_alignment 5
-#define elf_backend_got_header_size 0
-#define elf_backend_want_got_plt 1
-#define elf_backend_may_use_rel_p 1
-#define elf_backend_may_use_rela_p 1
-#define elf_backend_default_use_rela_p 1
-#define elf_backend_want_dynbss 0
-#define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect
-#define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol
-#define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class
-#define elf_backend_rela_normal 1
-#define elf_backend_special_sections elfNN_ia64_special_sections
-
-#include "elfNN-target.h"
-
-/* HPUX-specific vectors. */
-
-#undef TARGET_LITTLE_SYM
-#undef TARGET_LITTLE_NAME
-#undef TARGET_BIG_SYM
-#define TARGET_BIG_SYM bfd_elfNN_ia64_hpux_big_vec
-#undef TARGET_BIG_NAME
-#define TARGET_BIG_NAME "elfNN-ia64-hpux-big"
-
-/* These are HP-UX specific functions. */
-
-#undef elf_backend_post_process_headers
-#define elf_backend_post_process_headers elfNN_hpux_post_process_headers
-
-#undef elf_backend_section_from_bfd_section
-#define elf_backend_section_from_bfd_section elfNN_hpux_backend_section_from_bfd_section
-
-#undef elf_backend_symbol_processing
-#define elf_backend_symbol_processing elfNN_hpux_backend_symbol_processing
-
-#undef elf_backend_want_p_paddr_set_to_zero
-#define elf_backend_want_p_paddr_set_to_zero 1
-
-#undef ELF_MAXPAGESIZE
-#define ELF_MAXPAGESIZE 0x1000 /* 1K */
-
-#undef elfNN_bed
-#define elfNN_bed elfNN_ia64_hpux_bed
-
-#include "elfNN-target.h"
-
-#undef elf_backend_want_p_paddr_set_to_zero
diff --git a/contrib/binutils/bfd/elfxx-mips.c b/contrib/binutils/bfd/elfxx-mips.c
deleted file mode 100644
index 8fb20d8..0000000
--- a/contrib/binutils/bfd/elfxx-mips.c
+++ /dev/null
@@ -1,9234 +0,0 @@
-/* MIPS-specific support for ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
-
- Most of the information added by Ian Lance Taylor, Cygnus Support,
- <ian@cygnus.com>.
- N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
- <mark@codesourcery.com>
- Traditional MIPS targets support added by Koundinya.K, Dansk Data
- Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file handles functionality common to the different MIPS ABI's. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libiberty.h"
-#include "elf-bfd.h"
-#include "elfxx-mips.h"
-#include "elf/mips.h"
-
-/* Get the ECOFF swapping routines. */
-#include "coff/sym.h"
-#include "coff/symconst.h"
-#include "coff/ecoff.h"
-#include "coff/mips.h"
-
-#include "hashtab.h"
-
-/* This structure is used to hold .got entries while estimating got
- sizes. */
-struct mips_got_entry
-{
- /* The input bfd in which the symbol is defined. */
- bfd *abfd;
- /* The index of the symbol, as stored in the relocation r_info, if
- we have a local symbol; -1 otherwise. */
- long symndx;
- union
- {
- /* If abfd == NULL, an address that must be stored in the got. */
- bfd_vma address;
- /* If abfd != NULL && symndx != -1, the addend of the relocation
- that should be added to the symbol value. */
- bfd_vma addend;
- /* If abfd != NULL && symndx == -1, the hash table entry
- corresponding to a global symbol in the got (or, local, if
- h->forced_local). */
- struct mips_elf_link_hash_entry *h;
- } d;
- /* The offset from the beginning of the .got section to the entry
- corresponding to this symbol+addend. If it's a global symbol
- whose offset is yet to be decided, it's going to be -1. */
- long gotidx;
-};
-
-/* This structure is used to hold .got information when linking. */
-
-struct mips_got_info
-{
- /* The global symbol in the GOT with the lowest index in the dynamic
- symbol table. */
- struct elf_link_hash_entry *global_gotsym;
- /* The number of global .got entries. */
- unsigned int global_gotno;
- /* The number of local .got entries. */
- unsigned int local_gotno;
- /* The number of local .got entries we have used. */
- unsigned int assigned_gotno;
- /* A hash table holding members of the got. */
- struct htab *got_entries;
- /* A hash table mapping input bfds to other mips_got_info. NULL
- unless multi-got was necessary. */
- struct htab *bfd2got;
- /* In multi-got links, a pointer to the next got (err, rather, most
- of the time, it points to the previous got). */
- struct mips_got_info *next;
-};
-
-/* Map an input bfd to a got in a multi-got link. */
-
-struct mips_elf_bfd2got_hash {
- bfd *bfd;
- struct mips_got_info *g;
-};
-
-/* Structure passed when traversing the bfd2got hash table, used to
- create and merge bfd's gots. */
-
-struct mips_elf_got_per_bfd_arg
-{
- /* A hashtable that maps bfds to gots. */
- htab_t bfd2got;
- /* The output bfd. */
- bfd *obfd;
- /* The link information. */
- struct bfd_link_info *info;
- /* A pointer to the primary got, i.e., the one that's going to get
- the implicit relocations from DT_MIPS_LOCAL_GOTNO and
- DT_MIPS_GOTSYM. */
- struct mips_got_info *primary;
- /* A non-primary got we're trying to merge with other input bfd's
- gots. */
- struct mips_got_info *current;
- /* The maximum number of got entries that can be addressed with a
- 16-bit offset. */
- unsigned int max_count;
- /* The number of local and global entries in the primary got. */
- unsigned int primary_count;
- /* The number of local and global entries in the current got. */
- unsigned int current_count;
-};
-
-/* Another structure used to pass arguments for got entries traversal. */
-
-struct mips_elf_set_global_got_offset_arg
-{
- struct mips_got_info *g;
- int value;
- unsigned int needed_relocs;
- struct bfd_link_info *info;
-};
-
-struct _mips_elf_section_data
-{
- struct bfd_elf_section_data elf;
- union
- {
- struct mips_got_info *got_info;
- bfd_byte *tdata;
- } u;
-};
-
-#define mips_elf_section_data(sec) \
- ((struct _mips_elf_section_data *) elf_section_data (sec))
-
-/* This structure is passed to mips_elf_sort_hash_table_f when sorting
- the dynamic symbols. */
-
-struct mips_elf_hash_sort_data
-{
- /* The symbol in the global GOT with the lowest dynamic symbol table
- index. */
- struct elf_link_hash_entry *low;
- /* The least dynamic symbol table index corresponding to a symbol
- with a GOT entry. */
- long min_got_dynindx;
- /* The greatest dynamic symbol table index corresponding to a symbol
- with a GOT entry that is not referenced (e.g., a dynamic symbol
- with dynamic relocations pointing to it from non-primary GOTs). */
- long max_unref_got_dynindx;
- /* The greatest dynamic symbol table index not corresponding to a
- symbol without a GOT entry. */
- long max_non_got_dynindx;
-};
-
-/* The MIPS ELF linker needs additional information for each symbol in
- the global hash table. */
-
-struct mips_elf_link_hash_entry
-{
- struct elf_link_hash_entry root;
-
- /* External symbol information. */
- EXTR esym;
-
- /* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against
- this symbol. */
- unsigned int possibly_dynamic_relocs;
-
- /* If the R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 reloc is against
- a readonly section. */
- bfd_boolean readonly_reloc;
-
- /* We must not create a stub for a symbol that has relocations
- related to taking the function's address, i.e. any but
- R_MIPS_CALL*16 ones -- see "MIPS ABI Supplement, 3rd Edition",
- p. 4-20. */
- bfd_boolean no_fn_stub;
-
- /* If there is a stub that 32 bit functions should use to call this
- 16 bit function, this points to the section containing the stub. */
- asection *fn_stub;
-
- /* Whether we need the fn_stub; this is set if this symbol appears
- in any relocs other than a 16 bit call. */
- bfd_boolean need_fn_stub;
-
- /* If there is a stub that 16 bit functions should use to call this
- 32 bit function, this points to the section containing the stub. */
- asection *call_stub;
-
- /* This is like the call_stub field, but it is used if the function
- being called returns a floating point value. */
- asection *call_fp_stub;
-
- /* Are we forced local? .*/
- bfd_boolean forced_local;
-};
-
-/* MIPS ELF linker hash table. */
-
-struct mips_elf_link_hash_table
-{
- struct elf_link_hash_table root;
-#if 0
- /* We no longer use this. */
- /* String section indices for the dynamic section symbols. */
- bfd_size_type dynsym_sec_strindex[SIZEOF_MIPS_DYNSYM_SECNAMES];
-#endif
- /* The number of .rtproc entries. */
- bfd_size_type procedure_count;
- /* The size of the .compact_rel section (if SGI_COMPAT). */
- bfd_size_type compact_rel_size;
- /* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic
- entry is set to the address of __rld_obj_head as in IRIX5. */
- bfd_boolean use_rld_obj_head;
- /* This is the value of the __rld_map or __rld_obj_head symbol. */
- bfd_vma rld_value;
- /* This is set if we see any mips16 stub sections. */
- bfd_boolean mips16_stubs_seen;
-};
-
-/* Structure used to pass information to mips_elf_output_extsym. */
-
-struct extsym_info
-{
- bfd *abfd;
- struct bfd_link_info *info;
- struct ecoff_debug_info *debug;
- const struct ecoff_debug_swap *swap;
- bfd_boolean failed;
-};
-
-/* The names of the runtime procedure table symbols used on IRIX5. */
-
-static const char * const mips_elf_dynsym_rtproc_names[] =
-{
- "_procedure_table",
- "_procedure_string_table",
- "_procedure_table_size",
- NULL
-};
-
-/* These structures are used to generate the .compact_rel section on
- IRIX5. */
-
-typedef struct
-{
- unsigned long id1; /* Always one? */
- unsigned long num; /* Number of compact relocation entries. */
- unsigned long id2; /* Always two? */
- unsigned long offset; /* The file offset of the first relocation. */
- unsigned long reserved0; /* Zero? */
- unsigned long reserved1; /* Zero? */
-} Elf32_compact_rel;
-
-typedef struct
-{
- bfd_byte id1[4];
- bfd_byte num[4];
- bfd_byte id2[4];
- bfd_byte offset[4];
- bfd_byte reserved0[4];
- bfd_byte reserved1[4];
-} Elf32_External_compact_rel;
-
-typedef struct
-{
- unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
- unsigned int dist2to : 8;
- unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
- unsigned long konst; /* KONST field. See below. */
- unsigned long vaddr; /* VADDR to be relocated. */
-} Elf32_crinfo;
-
-typedef struct
-{
- unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
- unsigned int dist2to : 8;
- unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
- unsigned long konst; /* KONST field. See below. */
-} Elf32_crinfo2;
-
-typedef struct
-{
- bfd_byte info[4];
- bfd_byte konst[4];
- bfd_byte vaddr[4];
-} Elf32_External_crinfo;
-
-typedef struct
-{
- bfd_byte info[4];
- bfd_byte konst[4];
-} Elf32_External_crinfo2;
-
-/* These are the constants used to swap the bitfields in a crinfo. */
-
-#define CRINFO_CTYPE (0x1)
-#define CRINFO_CTYPE_SH (31)
-#define CRINFO_RTYPE (0xf)
-#define CRINFO_RTYPE_SH (27)
-#define CRINFO_DIST2TO (0xff)
-#define CRINFO_DIST2TO_SH (19)
-#define CRINFO_RELVADDR (0x7ffff)
-#define CRINFO_RELVADDR_SH (0)
-
-/* A compact relocation info has long (3 words) or short (2 words)
- formats. A short format doesn't have VADDR field and relvaddr
- fields contains ((VADDR - vaddr of the previous entry) >> 2). */
-#define CRF_MIPS_LONG 1
-#define CRF_MIPS_SHORT 0
-
-/* There are 4 types of compact relocation at least. The value KONST
- has different meaning for each type:
-
- (type) (konst)
- CT_MIPS_REL32 Address in data
- CT_MIPS_WORD Address in word (XXX)
- CT_MIPS_GPHI_LO GP - vaddr
- CT_MIPS_JMPAD Address to jump
- */
-
-#define CRT_MIPS_REL32 0xa
-#define CRT_MIPS_WORD 0xb
-#define CRT_MIPS_GPHI_LO 0xc
-#define CRT_MIPS_JMPAD 0xd
-
-#define mips_elf_set_cr_format(x,format) ((x).ctype = (format))
-#define mips_elf_set_cr_type(x,type) ((x).rtype = (type))
-#define mips_elf_set_cr_dist2to(x,v) ((x).dist2to = (v))
-#define mips_elf_set_cr_relvaddr(x,d) ((x).relvaddr = (d)<<2)
-
-/* The structure of the runtime procedure descriptor created by the
- loader for use by the static exception system. */
-
-typedef struct runtime_pdr {
- bfd_vma adr; /* Memory address of start of procedure. */
- long regmask; /* Save register mask. */
- long regoffset; /* Save register offset. */
- long fregmask; /* Save floating point register mask. */
- long fregoffset; /* Save floating point register offset. */
- long frameoffset; /* Frame size. */
- short framereg; /* Frame pointer register. */
- short pcreg; /* Offset or reg of return pc. */
- long irpss; /* Index into the runtime string table. */
- long reserved;
- struct exception_info *exception_info;/* Pointer to exception array. */
-} RPDR, *pRPDR;
-#define cbRPDR sizeof (RPDR)
-#define rpdNil ((pRPDR) 0)
-
-static struct bfd_hash_entry *mips_elf_link_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-static void ecoff_swap_rpdr_out
- (bfd *, const RPDR *, struct rpdr_ext *);
-static bfd_boolean mips_elf_create_procedure_table
- (void *, bfd *, struct bfd_link_info *, asection *,
- struct ecoff_debug_info *);
-static bfd_boolean mips_elf_check_mips16_stubs
- (struct mips_elf_link_hash_entry *, void *);
-static void bfd_mips_elf32_swap_gptab_in
- (bfd *, const Elf32_External_gptab *, Elf32_gptab *);
-static void bfd_mips_elf32_swap_gptab_out
- (bfd *, const Elf32_gptab *, Elf32_External_gptab *);
-static void bfd_elf32_swap_compact_rel_out
- (bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *);
-static void bfd_elf32_swap_crinfo_out
- (bfd *, const Elf32_crinfo *, Elf32_External_crinfo *);
-static int sort_dynamic_relocs
- (const void *, const void *);
-static int sort_dynamic_relocs_64
- (const void *, const void *);
-static bfd_boolean mips_elf_output_extsym
- (struct mips_elf_link_hash_entry *, void *);
-static int gptab_compare
- (const void *, const void *);
-static asection *mips_elf_rel_dyn_section
- (bfd *, bfd_boolean);
-static asection *mips_elf_got_section
- (bfd *, bfd_boolean);
-static struct mips_got_info *mips_elf_got_info
- (bfd *, asection **);
-static long mips_elf_get_global_gotsym_index
- (bfd *abfd);
-static bfd_vma mips_elf_local_got_index
- (bfd *, bfd *, struct bfd_link_info *, bfd_vma);
-static bfd_vma mips_elf_global_got_index
- (bfd *, bfd *, struct elf_link_hash_entry *);
-static bfd_vma mips_elf_got_page
- (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *);
-static bfd_vma mips_elf_got16_entry
- (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_boolean);
-static bfd_vma mips_elf_got_offset_from_index
- (bfd *, bfd *, bfd *, bfd_vma);
-static struct mips_got_entry *mips_elf_create_local_got_entry
- (bfd *, bfd *, struct mips_got_info *, asection *, bfd_vma);
-static bfd_boolean mips_elf_sort_hash_table
- (struct bfd_link_info *, unsigned long);
-static bfd_boolean mips_elf_sort_hash_table_f
- (struct mips_elf_link_hash_entry *, void *);
-static bfd_boolean mips_elf_record_local_got_symbol
- (bfd *, long, bfd_vma, struct mips_got_info *);
-static bfd_boolean mips_elf_record_global_got_symbol
- (struct elf_link_hash_entry *, bfd *, struct bfd_link_info *,
- struct mips_got_info *);
-static const Elf_Internal_Rela *mips_elf_next_relocation
- (bfd *, unsigned int, const Elf_Internal_Rela *, const Elf_Internal_Rela *);
-static bfd_boolean mips_elf_local_relocation_p
- (bfd *, const Elf_Internal_Rela *, asection **, bfd_boolean);
-static bfd_boolean mips_elf_overflow_p
- (bfd_vma, int);
-static bfd_vma mips_elf_high
- (bfd_vma);
-static bfd_vma mips_elf_higher
- (bfd_vma);
-static bfd_vma mips_elf_highest
- (bfd_vma);
-static bfd_boolean mips_elf_create_compact_rel_section
- (bfd *, struct bfd_link_info *);
-static bfd_boolean mips_elf_create_got_section
- (bfd *, struct bfd_link_info *, bfd_boolean);
-static bfd_reloc_status_type mips_elf_calculate_relocation
- (bfd *, bfd *, asection *, struct bfd_link_info *,
- const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *,
- Elf_Internal_Sym *, asection **, bfd_vma *, const char **,
- bfd_boolean *, bfd_boolean);
-static bfd_vma mips_elf_obtain_contents
- (reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *);
-static bfd_boolean mips_elf_perform_relocation
- (struct bfd_link_info *, reloc_howto_type *, const Elf_Internal_Rela *,
- bfd_vma, bfd *, asection *, bfd_byte *, bfd_boolean);
-static bfd_boolean mips_elf_stub_section_p
- (bfd *, asection *);
-static void mips_elf_allocate_dynamic_relocations
- (bfd *, unsigned int);
-static bfd_boolean mips_elf_create_dynamic_relocation
- (bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
- struct mips_elf_link_hash_entry *, asection *, bfd_vma,
- bfd_vma *, asection *);
-static void mips_set_isa_flags
- (bfd *);
-static INLINE char *elf_mips_abi_name
- (bfd *);
-static void mips_elf_irix6_finish_dynamic_symbol
- (bfd *, const char *, Elf_Internal_Sym *);
-static bfd_boolean mips_mach_extends_p
- (unsigned long, unsigned long);
-static bfd_boolean mips_32bit_flags_p
- (flagword);
-static INLINE hashval_t mips_elf_hash_bfd_vma
- (bfd_vma);
-static hashval_t mips_elf_got_entry_hash
- (const void *);
-static int mips_elf_got_entry_eq
- (const void *, const void *);
-
-static bfd_boolean mips_elf_multi_got
- (bfd *, struct bfd_link_info *, struct mips_got_info *,
- asection *, bfd_size_type);
-static hashval_t mips_elf_multi_got_entry_hash
- (const void *);
-static int mips_elf_multi_got_entry_eq
- (const void *, const void *);
-static hashval_t mips_elf_bfd2got_entry_hash
- (const void *);
-static int mips_elf_bfd2got_entry_eq
- (const void *, const void *);
-static int mips_elf_make_got_per_bfd
- (void **, void *);
-static int mips_elf_merge_gots
- (void **, void *);
-static int mips_elf_set_global_got_offset
- (void **, void *);
-static int mips_elf_set_no_stub
- (void **, void *);
-static int mips_elf_resolve_final_got_entry
- (void **, void *);
-static void mips_elf_resolve_final_got_entries
- (struct mips_got_info *);
-static bfd_vma mips_elf_adjust_gp
- (bfd *, struct mips_got_info *, bfd *);
-static struct mips_got_info *mips_elf_got_for_ibfd
- (struct mips_got_info *, bfd *);
-
-/* This will be used when we sort the dynamic relocation records. */
-static bfd *reldyn_sorting_bfd;
-
-/* Nonzero if ABFD is using the N32 ABI. */
-
-#define ABI_N32_P(abfd) \
- ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
-
-/* Nonzero if ABFD is using the N64 ABI. */
-#define ABI_64_P(abfd) \
- (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
-
-/* Nonzero if ABFD is using NewABI conventions. */
-#define NEWABI_P(abfd) (ABI_N32_P (abfd) || ABI_64_P (abfd))
-
-/* The IRIX compatibility level we are striving for. */
-#define IRIX_COMPAT(abfd) \
- (get_elf_backend_data (abfd)->elf_backend_mips_irix_compat (abfd))
-
-/* Whether we are trying to be compatible with IRIX at all. */
-#define SGI_COMPAT(abfd) \
- (IRIX_COMPAT (abfd) != ict_none)
-
-/* The name of the options section. */
-#define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \
- (NEWABI_P (abfd) ? ".MIPS.options" : ".options")
-
-/* The name of the stub section. */
-#define MIPS_ELF_STUB_SECTION_NAME(abfd) ".MIPS.stubs"
-
-/* The size of an external REL relocation. */
-#define MIPS_ELF_REL_SIZE(abfd) \
- (get_elf_backend_data (abfd)->s->sizeof_rel)
-
-/* The size of an external dynamic table entry. */
-#define MIPS_ELF_DYN_SIZE(abfd) \
- (get_elf_backend_data (abfd)->s->sizeof_dyn)
-
-/* The size of a GOT entry. */
-#define MIPS_ELF_GOT_SIZE(abfd) \
- (get_elf_backend_data (abfd)->s->arch_size / 8)
-
-/* The size of a symbol-table entry. */
-#define MIPS_ELF_SYM_SIZE(abfd) \
- (get_elf_backend_data (abfd)->s->sizeof_sym)
-
-/* The default alignment for sections, as a power of two. */
-#define MIPS_ELF_LOG_FILE_ALIGN(abfd) \
- (get_elf_backend_data (abfd)->s->log_file_align)
-
-/* Get word-sized data. */
-#define MIPS_ELF_GET_WORD(abfd, ptr) \
- (ABI_64_P (abfd) ? bfd_get_64 (abfd, ptr) : bfd_get_32 (abfd, ptr))
-
-/* Put out word-sized data. */
-#define MIPS_ELF_PUT_WORD(abfd, val, ptr) \
- (ABI_64_P (abfd) \
- ? bfd_put_64 (abfd, val, ptr) \
- : bfd_put_32 (abfd, val, ptr))
-
-/* Add a dynamic symbol table-entry. */
-#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
- _bfd_elf_add_dynamic_entry (info, tag, val)
-
-#define MIPS_ELF_RTYPE_TO_HOWTO(abfd, rtype, rela) \
- (get_elf_backend_data (abfd)->elf_backend_mips_rtype_to_howto (rtype, rela))
-
-/* Determine whether the internal relocation of index REL_IDX is REL
- (zero) or RELA (non-zero). The assumption is that, if there are
- two relocation sections for this section, one of them is REL and
- the other is RELA. If the index of the relocation we're testing is
- in range for the first relocation section, check that the external
- relocation size is that for RELA. It is also assumed that, if
- rel_idx is not in range for the first section, and this first
- section contains REL relocs, then the relocation is in the second
- section, that is RELA. */
-#define MIPS_RELOC_RELA_P(abfd, sec, rel_idx) \
- ((NUM_SHDR_ENTRIES (&elf_section_data (sec)->rel_hdr) \
- * get_elf_backend_data (abfd)->s->int_rels_per_ext_rel \
- > (bfd_vma)(rel_idx)) \
- == (elf_section_data (sec)->rel_hdr.sh_entsize \
- == (ABI_64_P (abfd) ? sizeof (Elf64_External_Rela) \
- : sizeof (Elf32_External_Rela))))
-
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
-
-/* The number of local .got entries we reserve. */
-#define MIPS_RESERVED_GOTNO (2)
-
-/* The offset of $gp from the beginning of the .got section. */
-#define ELF_MIPS_GP_OFFSET(abfd) (0x7ff0)
-
-/* The maximum size of the GOT for it to be addressable using 16-bit
- offsets from $gp. */
-#define MIPS_ELF_GOT_MAX_SIZE(abfd) (ELF_MIPS_GP_OFFSET(abfd) + 0x7fff)
-
-/* Instructions which appear in a stub. */
-#define STUB_LW(abfd) \
- ((ABI_64_P (abfd) \
- ? 0xdf998010 /* ld t9,0x8010(gp) */ \
- : 0x8f998010)) /* lw t9,0x8010(gp) */
-#define STUB_MOVE(abfd) \
- ((ABI_64_P (abfd) \
- ? 0x03e0782d /* daddu t7,ra */ \
- : 0x03e07821)) /* addu t7,ra */
-#define STUB_JALR 0x0320f809 /* jalr t9,ra */
-#define STUB_LI16(abfd) \
- ((ABI_64_P (abfd) \
- ? 0x64180000 /* daddiu t8,zero,0 */ \
- : 0x24180000)) /* addiu t8,zero,0 */
-#define MIPS_FUNCTION_STUB_SIZE (16)
-
-/* The name of the dynamic interpreter. This is put in the .interp
- section. */
-
-#define ELF_DYNAMIC_INTERPRETER(abfd) \
- (ABI_N32_P (abfd) ? "/usr/lib32/libc.so.1" \
- : ABI_64_P (abfd) ? "/usr/lib64/libc.so.1" \
- : "/usr/lib/libc.so.1")
-
-#ifdef BFD64
-#define MNAME(bfd,pre,pos) \
- (ABI_64_P (bfd) ? CONCAT4 (pre,64,_,pos) : CONCAT4 (pre,32,_,pos))
-#define ELF_R_SYM(bfd, i) \
- (ABI_64_P (bfd) ? ELF64_R_SYM (i) : ELF32_R_SYM (i))
-#define ELF_R_TYPE(bfd, i) \
- (ABI_64_P (bfd) ? ELF64_MIPS_R_TYPE (i) : ELF32_R_TYPE (i))
-#define ELF_R_INFO(bfd, s, t) \
- (ABI_64_P (bfd) ? ELF64_R_INFO (s, t) : ELF32_R_INFO (s, t))
-#else
-#define MNAME(bfd,pre,pos) CONCAT4 (pre,32,_,pos)
-#define ELF_R_SYM(bfd, i) \
- (ELF32_R_SYM (i))
-#define ELF_R_TYPE(bfd, i) \
- (ELF32_R_TYPE (i))
-#define ELF_R_INFO(bfd, s, t) \
- (ELF32_R_INFO (s, t))
-#endif
-
- /* The mips16 compiler uses a couple of special sections to handle
- floating point arguments.
-
- Section names that look like .mips16.fn.FNNAME contain stubs that
- copy floating point arguments from the fp regs to the gp regs and
- then jump to FNNAME. If any 32 bit function calls FNNAME, the
- call should be redirected to the stub instead. If no 32 bit
- function calls FNNAME, the stub should be discarded. We need to
- consider any reference to the function, not just a call, because
- if the address of the function is taken we will need the stub,
- since the address might be passed to a 32 bit function.
-
- Section names that look like .mips16.call.FNNAME contain stubs
- that copy floating point arguments from the gp regs to the fp
- regs and then jump to FNNAME. If FNNAME is a 32 bit function,
- then any 16 bit function that calls FNNAME should be redirected
- to the stub instead. If FNNAME is not a 32 bit function, the
- stub should be discarded.
-
- .mips16.call.fp.FNNAME sections are similar, but contain stubs
- which call FNNAME and then copy the return value from the fp regs
- to the gp regs. These stubs store the return value in $18 while
- calling FNNAME; any function which might call one of these stubs
- must arrange to save $18 around the call. (This case is not
- needed for 32 bit functions that call 16 bit functions, because
- 16 bit functions always return floating point values in both
- $f0/$f1 and $2/$3.)
-
- Note that in all cases FNNAME might be defined statically.
- Therefore, FNNAME is not used literally. Instead, the relocation
- information will indicate which symbol the section is for.
-
- We record any stubs that we find in the symbol table. */
-
-#define FN_STUB ".mips16.fn."
-#define CALL_STUB ".mips16.call."
-#define CALL_FP_STUB ".mips16.call.fp."
-
-/* Look up an entry in a MIPS ELF linker hash table. */
-
-#define mips_elf_link_hash_lookup(table, string, create, copy, follow) \
- ((struct mips_elf_link_hash_entry *) \
- elf_link_hash_lookup (&(table)->root, (string), (create), \
- (copy), (follow)))
-
-/* Traverse a MIPS ELF linker hash table. */
-
-#define mips_elf_link_hash_traverse(table, func, info) \
- (elf_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
- (info)))
-
-/* Get the MIPS ELF linker hash table from a link_info structure. */
-
-#define mips_elf_hash_table(p) \
- ((struct mips_elf_link_hash_table *) ((p)->hash))
-
-/* Create an entry in a MIPS ELF linker hash table. */
-
-static struct bfd_hash_entry *
-mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table, const char *string)
-{
- struct mips_elf_link_hash_entry *ret =
- (struct mips_elf_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (struct mips_elf_link_hash_entry));
- if (ret == NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct mips_elf_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- /* Set local fields. */
- memset (&ret->esym, 0, sizeof (EXTR));
- /* We use -2 as a marker to indicate that the information has
- not been set. -1 means there is no associated ifd. */
- ret->esym.ifd = -2;
- ret->possibly_dynamic_relocs = 0;
- ret->readonly_reloc = FALSE;
- ret->no_fn_stub = FALSE;
- ret->fn_stub = NULL;
- ret->need_fn_stub = FALSE;
- ret->call_stub = NULL;
- ret->call_fp_stub = NULL;
- ret->forced_local = FALSE;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-bfd_boolean
-_bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec)
-{
- struct _mips_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
-
- sdata = bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = sdata;
-
- return _bfd_elf_new_section_hook (abfd, sec);
-}
-
-/* Read ECOFF debugging information from a .mdebug section into a
- ecoff_debug_info structure. */
-
-bfd_boolean
-_bfd_mips_elf_read_ecoff_info (bfd *abfd, asection *section,
- struct ecoff_debug_info *debug)
-{
- HDRR *symhdr;
- const struct ecoff_debug_swap *swap;
- char *ext_hdr;
-
- swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
- memset (debug, 0, sizeof (*debug));
-
- ext_hdr = bfd_malloc (swap->external_hdr_size);
- if (ext_hdr == NULL && swap->external_hdr_size != 0)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, section, ext_hdr, 0,
- swap->external_hdr_size))
- goto error_return;
-
- symhdr = &debug->symbolic_header;
- (*swap->swap_hdr_in) (abfd, ext_hdr, symhdr);
-
- /* The symbolic header contains absolute file offsets and sizes to
- read. */
-#define READ(ptr, offset, count, size, type) \
- if (symhdr->count == 0) \
- debug->ptr = NULL; \
- else \
- { \
- bfd_size_type amt = (bfd_size_type) size * symhdr->count; \
- debug->ptr = bfd_malloc (amt); \
- if (debug->ptr == NULL) \
- goto error_return; \
- if (bfd_seek (abfd, symhdr->offset, SEEK_SET) != 0 \
- || bfd_bread (debug->ptr, amt, abfd) != amt) \
- goto error_return; \
- }
-
- READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *);
- READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, void *);
- READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, void *);
- READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, void *);
- READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, void *);
- READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext),
- union aux_ext *);
- READ (ss, cbSsOffset, issMax, sizeof (char), char *);
- READ (ssext, cbSsExtOffset, issExtMax, sizeof (char), char *);
- READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, void *);
- READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, void *);
- READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, void *);
-#undef READ
-
- debug->fdr = NULL;
- debug->adjust = NULL;
-
- return TRUE;
-
- error_return:
- if (ext_hdr != NULL)
- free (ext_hdr);
- if (debug->line != NULL)
- free (debug->line);
- if (debug->external_dnr != NULL)
- free (debug->external_dnr);
- if (debug->external_pdr != NULL)
- free (debug->external_pdr);
- if (debug->external_sym != NULL)
- free (debug->external_sym);
- if (debug->external_opt != NULL)
- free (debug->external_opt);
- if (debug->external_aux != NULL)
- free (debug->external_aux);
- if (debug->ss != NULL)
- free (debug->ss);
- if (debug->ssext != NULL)
- free (debug->ssext);
- if (debug->external_fdr != NULL)
- free (debug->external_fdr);
- if (debug->external_rfd != NULL)
- free (debug->external_rfd);
- if (debug->external_ext != NULL)
- free (debug->external_ext);
- return FALSE;
-}
-
-/* Swap RPDR (runtime procedure table entry) for output. */
-
-static void
-ecoff_swap_rpdr_out (bfd *abfd, const RPDR *in, struct rpdr_ext *ex)
-{
- H_PUT_S32 (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);
-
- H_PUT_16 (abfd, in->framereg, ex->p_framereg);
- H_PUT_16 (abfd, in->pcreg, ex->p_pcreg);
-
- H_PUT_32 (abfd, in->irpss, ex->p_irpss);
-#if 0 /* FIXME */
- H_PUT_S32 (abfd, in->exception_info, ex->p_exception_info);
-#endif
-}
-
-/* Create a runtime procedure table from the .mdebug section. */
-
-static bfd_boolean
-mips_elf_create_procedure_table (void *handle, bfd *abfd,
- struct bfd_link_info *info, asection *s,
- struct ecoff_debug_info *debug)
-{
- const struct ecoff_debug_swap *swap;
- HDRR *hdr = &debug->symbolic_header;
- RPDR *rpdr, *rp;
- struct rpdr_ext *erp;
- void *rtproc;
- struct pdr_ext *epdr;
- struct sym_ext *esym;
- char *ss, **sv;
- char *str;
- bfd_size_type size;
- bfd_size_type count;
- unsigned long sindex;
- unsigned long i;
- PDR pdr;
- SYMR sym;
- const char *no_name_func = _("static procedure (no name)");
-
- epdr = NULL;
- rpdr = NULL;
- esym = NULL;
- ss = NULL;
- sv = NULL;
-
- swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
-
- sindex = strlen (no_name_func) + 1;
- count = hdr->ipdMax;
- if (count > 0)
- {
- size = swap->external_pdr_size;
-
- epdr = bfd_malloc (size * count);
- if (epdr == NULL)
- goto error_return;
-
- if (! _bfd_ecoff_get_accumulated_pdr (handle, (bfd_byte *) epdr))
- goto error_return;
-
- size = sizeof (RPDR);
- rp = rpdr = bfd_malloc (size * count);
- if (rpdr == NULL)
- goto error_return;
-
- size = sizeof (char *);
- sv = bfd_malloc (size * count);
- if (sv == NULL)
- goto error_return;
-
- count = hdr->isymMax;
- size = swap->external_sym_size;
- esym = bfd_malloc (size * count);
- if (esym == NULL)
- goto error_return;
-
- if (! _bfd_ecoff_get_accumulated_sym (handle, (bfd_byte *) esym))
- goto error_return;
-
- count = hdr->issMax;
- ss = bfd_malloc (count);
- if (ss == NULL)
- goto error_return;
- if (! _bfd_ecoff_get_accumulated_ss (handle, ss))
- goto error_return;
-
- count = hdr->ipdMax;
- for (i = 0; i < (unsigned long) count; i++, rp++)
- {
- (*swap->swap_pdr_in) (abfd, epdr + i, &pdr);
- (*swap->swap_sym_in) (abfd, &esym[pdr.isym], &sym);
- rp->adr = sym.value;
- rp->regmask = pdr.regmask;
- rp->regoffset = pdr.regoffset;
- rp->fregmask = pdr.fregmask;
- rp->fregoffset = pdr.fregoffset;
- rp->frameoffset = pdr.frameoffset;
- rp->framereg = pdr.framereg;
- rp->pcreg = pdr.pcreg;
- rp->irpss = sindex;
- sv[i] = ss + sym.iss;
- sindex += strlen (sv[i]) + 1;
- }
- }
-
- size = sizeof (struct rpdr_ext) * (count + 2) + sindex;
- size = BFD_ALIGN (size, 16);
- rtproc = bfd_alloc (abfd, size);
- if (rtproc == NULL)
- {
- mips_elf_hash_table (info)->procedure_count = 0;
- goto error_return;
- }
-
- mips_elf_hash_table (info)->procedure_count = count + 2;
-
- erp = rtproc;
- memset (erp, 0, sizeof (struct rpdr_ext));
- erp++;
- str = (char *) rtproc + sizeof (struct rpdr_ext) * (count + 2);
- strcpy (str, no_name_func);
- str += strlen (no_name_func) + 1;
- for (i = 0; i < count; i++)
- {
- ecoff_swap_rpdr_out (abfd, rpdr + i, erp + i);
- strcpy (str, sv[i]);
- str += strlen (sv[i]) + 1;
- }
- H_PUT_S32 (abfd, -1, (erp + count)->p_adr);
-
- /* Set the size and contents of .rtproc section. */
- s->_raw_size = size;
- s->contents = rtproc;
-
- /* Skip this section later on (I don't think this currently
- matters, but someday it might). */
- s->link_order_head = NULL;
-
- if (epdr != NULL)
- free (epdr);
- if (rpdr != NULL)
- free (rpdr);
- if (esym != NULL)
- free (esym);
- if (ss != NULL)
- free (ss);
- if (sv != NULL)
- free (sv);
-
- return TRUE;
-
- error_return:
- if (epdr != NULL)
- free (epdr);
- if (rpdr != NULL)
- free (rpdr);
- if (esym != NULL)
- free (esym);
- if (ss != NULL)
- free (ss);
- if (sv != NULL)
- free (sv);
- return FALSE;
-}
-
-/* Check the mips16 stubs for a particular symbol, and see if we can
- discard them. */
-
-static bfd_boolean
-mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h,
- void *data ATTRIBUTE_UNUSED)
-{
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- if (h->fn_stub != NULL
- && ! h->need_fn_stub)
- {
- /* We don't need the fn_stub; the only references to this symbol
- are 16 bit calls. Clobber the size to 0 to prevent it from
- being included in the link. */
- h->fn_stub->_raw_size = 0;
- h->fn_stub->_cooked_size = 0;
- h->fn_stub->flags &= ~SEC_RELOC;
- h->fn_stub->reloc_count = 0;
- h->fn_stub->flags |= SEC_EXCLUDE;
- }
-
- if (h->call_stub != NULL
- && h->root.other == STO_MIPS16)
- {
- /* We don't need the call_stub; this is a 16 bit function, so
- calls from other 16 bit functions are OK. Clobber the size
- to 0 to prevent it from being included in the link. */
- h->call_stub->_raw_size = 0;
- h->call_stub->_cooked_size = 0;
- h->call_stub->flags &= ~SEC_RELOC;
- h->call_stub->reloc_count = 0;
- h->call_stub->flags |= SEC_EXCLUDE;
- }
-
- if (h->call_fp_stub != NULL
- && h->root.other == STO_MIPS16)
- {
- /* We don't need the call_stub; this is a 16 bit function, so
- calls from other 16 bit functions are OK. Clobber the size
- to 0 to prevent it from being included in the link. */
- h->call_fp_stub->_raw_size = 0;
- h->call_fp_stub->_cooked_size = 0;
- h->call_fp_stub->flags &= ~SEC_RELOC;
- h->call_fp_stub->reloc_count = 0;
- h->call_fp_stub->flags |= SEC_EXCLUDE;
- }
-
- return TRUE;
-}
-
-bfd_reloc_status_type
-_bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol,
- arelent *reloc_entry, asection *input_section,
- bfd_boolean relocatable, void *data, bfd_vma gp)
-{
- bfd_vma relocation;
- bfd_signed_vma val;
- bfd_reloc_status_type status;
-
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- /* Set val to the offset into the section or symbol. */
- val = reloc_entry->addend;
-
- _bfd_mips_elf_sign_extend (val, 16);
-
- /* Adjust val for the final section location and GP value. If we
- are producing relocatable output, we don't want to do this for
- an external symbol. */
- if (! relocatable
- || (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - gp;
-
- if (reloc_entry->howto->partial_inplace)
- {
- status = _bfd_relocate_contents (reloc_entry->howto, abfd, val,
- (bfd_byte *) data
- + reloc_entry->address);
- if (status != bfd_reloc_ok)
- return status;
- }
- else
- reloc_entry->addend = val;
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
-
- return bfd_reloc_ok;
-}
-
-/* Used to store a REL high-part relocation such as R_MIPS_HI16 or
- R_MIPS_GOT16. REL is the relocation, INPUT_SECTION is the section
- that contains the relocation field and DATA points to the start of
- INPUT_SECTION. */
-
-struct mips_hi16
-{
- struct mips_hi16 *next;
- bfd_byte *data;
- asection *input_section;
- arelent rel;
-};
-
-/* FIXME: This should not be a static variable. */
-
-static struct mips_hi16 *mips_hi16_list;
-
-/* A howto special_function for REL *HI16 relocations. We can only
- calculate the correct value once we've seen the partnering
- *LO16 relocation, so just save the information for later.
-
- The ABI requires that the *LO16 immediately follow the *HI16.
- However, as a GNU extension, we permit an arbitrary number of
- *HI16s to be associated with a single *LO16. This significantly
- simplies the relocation handling in gcc. */
-
-bfd_reloc_status_type
-_bfd_mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- asymbol *symbol ATTRIBUTE_UNUSED, void *data,
- asection *input_section, bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- struct mips_hi16 *n;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- n = bfd_malloc (sizeof *n);
- if (n == NULL)
- return bfd_reloc_outofrange;
-
- n->next = mips_hi16_list;
- n->data = data;
- n->input_section = input_section;
- n->rel = *reloc_entry;
- mips_hi16_list = n;
-
- if (output_bfd != NULL)
- reloc_entry->address += input_section->output_offset;
-
- return bfd_reloc_ok;
-}
-
-/* A howto special_function for REL R_MIPS_GOT16 relocations. This is just
- like any other 16-bit relocation when applied to global symbols, but is
- treated in the same as R_MIPS_HI16 when applied to local symbols. */
-
-bfd_reloc_status_type
-_bfd_mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (symbol))
- || bfd_is_com_section (bfd_get_section (symbol)))
- /* The relocation is against a global symbol. */
- return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd,
- error_message);
-
- return _bfd_mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-}
-
-/* A howto special_function for REL *LO16 relocations. The *LO16 itself
- is a straightforward 16 bit inplace relocation, but we must deal with
- any partnering high-part relocations as well. */
-
-bfd_reloc_status_type
-_bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- void *data, asection *input_section,
- bfd *output_bfd, char **error_message)
-{
- bfd_vma vallo;
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- while (mips_hi16_list != NULL)
- {
- bfd_reloc_status_type ret;
- struct mips_hi16 *hi;
-
- hi = mips_hi16_list;
-
- /* R_MIPS_GOT16 relocations are something of a special case. We
- want to install the addend in the same way as for a R_MIPS_HI16
- relocation (with a rightshift of 16). However, since GOT16
- relocations can also be used with global symbols, their howto
- has a rightshift of 0. */
- if (hi->rel.howto->type == R_MIPS_GOT16)
- hi->rel.howto = MIPS_ELF_RTYPE_TO_HOWTO (abfd, R_MIPS_HI16, FALSE);
-
- /* VALLO is a signed 16-bit number. Bias it by 0x8000 so that any
- carry or borrow will induce a change of +1 or -1 in the high part. */
- hi->rel.addend += (vallo + 0x8000) & 0xffff;
-
- /* R_MIPS_GNU_REL_HI16 relocations are relative to the address of the
- lo16 relocation, not their own address. If we're calculating the
- final value, and hence subtracting the "PC", subtract the offset
- of the lo16 relocation from here. */
- if (output_bfd == NULL && hi->rel.howto->type == R_MIPS_GNU_REL_HI16)
- hi->rel.addend -= reloc_entry->address - hi->rel.address;
-
- ret = _bfd_mips_elf_generic_reloc (abfd, &hi->rel, symbol, hi->data,
- hi->input_section, output_bfd,
- error_message);
- if (ret != bfd_reloc_ok)
- return ret;
-
- mips_hi16_list = hi->next;
- free (hi);
- }
-
- return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd,
- error_message);
-}
-
-/* A generic howto special_function. This calculates and installs the
- relocation itself, thus avoiding the oft-discussed problems in
- bfd_perform_relocation and bfd_install_relocation. */
-
-bfd_reloc_status_type
-_bfd_mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- bfd_signed_vma val;
- bfd_reloc_status_type status;
- bfd_boolean relocatable;
-
- relocatable = (output_bfd != NULL);
-
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
-
- /* Build up the field adjustment in VAL. */
- val = 0;
- if (!relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)
- {
- /* Either we're calculating the final field value or we have a
- relocation against a section symbol. Add in the section's
- offset or address. */
- val += symbol->section->output_section->vma;
- val += symbol->section->output_offset;
- }
-
- if (!relocatable)
- {
- /* We're calculating the final field value. Add in the symbol's value
- and, if pc-relative, subtract the address of the field itself. */
- val += symbol->value;
- if (reloc_entry->howto->pc_relative)
- {
- val -= input_section->output_section->vma;
- val -= input_section->output_offset;
- val -= reloc_entry->address;
- }
- }
-
- /* VAL is now the final adjustment. If we're keeping this relocation
- in the output file, and if the relocation uses a separate addend,
- we just need to add VAL to that addend. Otherwise we need to add
- VAL to the relocation field itself. */
- if (relocatable && !reloc_entry->howto->partial_inplace)
- reloc_entry->addend += val;
- else
- {
- /* Add in the separate addend, if any. */
- val += reloc_entry->addend;
-
- /* Add VAL to the relocation field. */
- status = _bfd_relocate_contents (reloc_entry->howto, abfd, val,
- (bfd_byte *) data
- + reloc_entry->address);
- if (status != bfd_reloc_ok)
- return status;
- }
-
- if (relocatable)
- reloc_entry->address += input_section->output_offset;
-
- return bfd_reloc_ok;
-}
-
-/* Swap an entry in a .gptab section. Note that these routines rely
- on the equivalence of the two elements of the union. */
-
-static void
-bfd_mips_elf32_swap_gptab_in (bfd *abfd, const Elf32_External_gptab *ex,
- Elf32_gptab *in)
-{
- 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
-bfd_mips_elf32_swap_gptab_out (bfd *abfd, const Elf32_gptab *in,
- Elf32_External_gptab *ex)
-{
- 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
-bfd_elf32_swap_compact_rel_out (bfd *abfd, const Elf32_compact_rel *in,
- Elf32_External_compact_rel *ex)
-{
- 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
-bfd_elf32_swap_crinfo_out (bfd *abfd, const Elf32_crinfo *in,
- Elf32_External_crinfo *ex)
-{
- unsigned long l;
-
- l = (((in->ctype & CRINFO_CTYPE) << CRINFO_CTYPE_SH)
- | ((in->rtype & CRINFO_RTYPE) << CRINFO_RTYPE_SH)
- | ((in->dist2to & CRINFO_DIST2TO) << CRINFO_DIST2TO_SH)
- | ((in->relvaddr & CRINFO_RELVADDR) << CRINFO_RELVADDR_SH));
- H_PUT_32 (abfd, l, ex->info);
- H_PUT_32 (abfd, in->konst, ex->konst);
- H_PUT_32 (abfd, in->vaddr, ex->vaddr);
-}
-
-/* A .reginfo section holds a single Elf32_RegInfo structure. These
- routines swap this structure in and out. They are used outside of
- BFD, so they are globally visible. */
-
-void
-bfd_mips_elf32_swap_reginfo_in (bfd *abfd, const Elf32_External_RegInfo *ex,
- Elf32_RegInfo *in)
-{
- 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
-bfd_mips_elf32_swap_reginfo_out (bfd *abfd, const Elf32_RegInfo *in,
- Elf32_External_RegInfo *ex)
-{
- 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
- information in an Elf64_Reginfo structure. These routines swap
- them in and out. They are globally visible because they are used
- outside of BFD. These routines are here so that gas can call them
- without worrying about whether the 64 bit ABI has been included. */
-
-void
-bfd_mips_elf64_swap_reginfo_in (bfd *abfd, const Elf64_External_RegInfo *ex,
- Elf64_Internal_RegInfo *in)
-{
- 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
-bfd_mips_elf64_swap_reginfo_out (bfd *abfd, const Elf64_Internal_RegInfo *in,
- Elf64_External_RegInfo *ex)
-{
- 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 in an options header. */
-
-void
-bfd_mips_elf_swap_options_in (bfd *abfd, const Elf_External_Options *ex,
- Elf_Internal_Options *in)
-{
- 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. */
-
-void
-bfd_mips_elf_swap_options_out (bfd *abfd, const Elf_Internal_Options *in,
- Elf_External_Options *ex)
-{
- 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);
-}
-
-/* This function is called via qsort() to sort the dynamic relocation
- entries by increasing r_symndx value. */
-
-static int
-sort_dynamic_relocs (const void *arg1, const void *arg2)
-{
- Elf_Internal_Rela int_reloc1;
- Elf_Internal_Rela int_reloc2;
-
- bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg1, &int_reloc1);
- bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg2, &int_reloc2);
-
- return ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info);
-}
-
-/* Like sort_dynamic_relocs, but used for elf64 relocations. */
-
-static int
-sort_dynamic_relocs_64 (const void *arg1, const void *arg2)
-{
- Elf_Internal_Rela int_reloc1[3];
- Elf_Internal_Rela int_reloc2[3];
-
- (*get_elf_backend_data (reldyn_sorting_bfd)->s->swap_reloc_in)
- (reldyn_sorting_bfd, arg1, int_reloc1);
- (*get_elf_backend_data (reldyn_sorting_bfd)->s->swap_reloc_in)
- (reldyn_sorting_bfd, arg2, int_reloc2);
-
- return (ELF64_R_SYM (int_reloc1[0].r_info)
- - ELF64_R_SYM (int_reloc2[0].r_info));
-}
-
-
-/* This routine is used to write out ECOFF debugging external symbol
- information. It is called via mips_elf_link_hash_traverse. The
- ECOFF external symbol information must match the ELF external
- symbol information. Unfortunately, at this point we don't know
- whether a symbol is required by reloc information, so the two
- tables may wind up being different. We must sort out the external
- symbol information before we can set the final size of the .mdebug
- section, and we must set the size of the .mdebug section before we
- can relocate any sections, and we can't know which symbols are
- required by relocation until we relocate the sections.
- Fortunately, it is relatively unlikely that any symbol will be
- stripped but required by a reloc. In particular, it can not happen
- when generating a final executable. */
-
-static bfd_boolean
-mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data)
-{
- struct extsym_info *einfo = data;
- bfd_boolean strip;
- asection *sec, *output_section;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- if (h->root.indx == -2)
- strip = FALSE;
- else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
- strip = TRUE;
- else if (einfo->info->strip == strip_all
- || (einfo->info->strip == strip_some
- && bfd_hash_lookup (einfo->info->keep_hash,
- h->root.root.root.string,
- FALSE, FALSE) == NULL))
- strip = TRUE;
- else
- strip = FALSE;
-
- if (strip)
- return TRUE;
-
- if (h->esym.ifd == -2)
- {
- h->esym.jmptbl = 0;
- h->esym.cobol_main = 0;
- h->esym.weakext = 0;
- h->esym.reserved = 0;
- h->esym.ifd = ifdNil;
- h->esym.asym.value = 0;
- h->esym.asym.st = stGlobal;
-
- if (h->root.root.type == bfd_link_hash_undefined
- || h->root.root.type == bfd_link_hash_undefweak)
- {
- const char *name;
-
- /* Use undefined class. Also, set class and type for some
- special symbols. */
- name = h->root.root.root.string;
- if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0
- || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
- {
- h->esym.asym.sc = scData;
- h->esym.asym.st = stLabel;
- h->esym.asym.value = 0;
- }
- else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0)
- {
- h->esym.asym.sc = scAbs;
- h->esym.asym.st = stLabel;
- h->esym.asym.value =
- mips_elf_hash_table (einfo->info)->procedure_count;
- }
- else if (strcmp (name, "_gp_disp") == 0 && ! NEWABI_P (einfo->abfd))
- {
- h->esym.asym.sc = scAbs;
- h->esym.asym.st = stLabel;
- h->esym.asym.value = elf_gp (einfo->abfd);
- }
- else
- h->esym.asym.sc = scUndefined;
- }
- else if (h->root.root.type != bfd_link_hash_defined
- && h->root.root.type != bfd_link_hash_defweak)
- h->esym.asym.sc = scAbs;
- else
- {
- const char *name;
-
- sec = h->root.root.u.def.section;
- output_section = sec->output_section;
-
- /* When making a shared library and symbol h is the one from
- the another shared library, OUTPUT_SECTION may be null. */
- if (output_section == NULL)
- h->esym.asym.sc = scUndefined;
- else
- {
- name = bfd_section_name (output_section->owner, output_section);
-
- if (strcmp (name, ".text") == 0)
- h->esym.asym.sc = scText;
- else if (strcmp (name, ".data") == 0)
- h->esym.asym.sc = scData;
- else if (strcmp (name, ".sdata") == 0)
- h->esym.asym.sc = scSData;
- else if (strcmp (name, ".rodata") == 0
- || strcmp (name, ".rdata") == 0)
- h->esym.asym.sc = scRData;
- else if (strcmp (name, ".bss") == 0)
- h->esym.asym.sc = scBss;
- else if (strcmp (name, ".sbss") == 0)
- h->esym.asym.sc = scSBss;
- else if (strcmp (name, ".init") == 0)
- h->esym.asym.sc = scInit;
- else if (strcmp (name, ".fini") == 0)
- h->esym.asym.sc = scFini;
- else
- h->esym.asym.sc = scAbs;
- }
- }
-
- h->esym.asym.reserved = 0;
- h->esym.asym.index = indexNil;
- }
-
- if (h->root.root.type == bfd_link_hash_common)
- h->esym.asym.value = h->root.root.u.c.size;
- else if (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- {
- if (h->esym.asym.sc == scCommon)
- h->esym.asym.sc = scBss;
- else if (h->esym.asym.sc == scSCommon)
- h->esym.asym.sc = scSBss;
-
- sec = h->root.root.u.def.section;
- output_section = sec->output_section;
- if (output_section != NULL)
- h->esym.asym.value = (h->root.root.u.def.value
- + sec->output_offset
- + output_section->vma);
- else
- h->esym.asym.value = 0;
- }
- else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- struct mips_elf_link_hash_entry *hd = h;
- bfd_boolean no_fn_stub = h->no_fn_stub;
-
- while (hd->root.root.type == bfd_link_hash_indirect)
- {
- hd = (struct mips_elf_link_hash_entry *)h->root.root.u.i.link;
- no_fn_stub = no_fn_stub || hd->no_fn_stub;
- }
-
- if (!no_fn_stub)
- {
- /* Set type and value for a symbol with a function stub. */
- h->esym.asym.st = stProc;
- sec = hd->root.root.u.def.section;
- if (sec == NULL)
- h->esym.asym.value = 0;
- else
- {
- output_section = sec->output_section;
- if (output_section != NULL)
- h->esym.asym.value = (hd->root.plt.offset
- + sec->output_offset
- + output_section->vma);
- else
- h->esym.asym.value = 0;
- }
-#if 0 /* FIXME? */
- h->esym.ifd = 0;
-#endif
- }
- }
-
- if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,
- h->root.root.root.string,
- &h->esym))
- {
- einfo->failed = TRUE;
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* A comparison routine used to sort .gptab entries. */
-
-static int
-gptab_compare (const void *p1, const void *p2)
-{
- const Elf32_gptab *a1 = p1;
- const Elf32_gptab *a2 = p2;
-
- return a1->gt_entry.gt_g_value - a2->gt_entry.gt_g_value;
-}
-
-/* Functions to manage the got entry hash table. */
-
-/* Use all 64 bits of a bfd_vma for the computation of a 32-bit
- hash number. */
-
-static INLINE hashval_t
-mips_elf_hash_bfd_vma (bfd_vma addr)
-{
-#ifdef BFD64
- return addr + (addr >> 32);
-#else
- return addr;
-#endif
-}
-
-/* got_entries only match if they're identical, except for gotidx, so
- use all fields to compute the hash, and compare the appropriate
- union members. */
-
-static hashval_t
-mips_elf_got_entry_hash (const void *entry_)
-{
- const struct mips_got_entry *entry = (struct mips_got_entry *)entry_;
-
- return entry->symndx
- + (! entry->abfd ? mips_elf_hash_bfd_vma (entry->d.address)
- : entry->abfd->id
- + (entry->symndx >= 0 ? mips_elf_hash_bfd_vma (entry->d.addend)
- : entry->d.h->root.root.root.hash));
-}
-
-static int
-mips_elf_got_entry_eq (const void *entry1, const void *entry2)
-{
- const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1;
- const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2;
-
- return e1->abfd == e2->abfd && e1->symndx == e2->symndx
- && (! e1->abfd ? e1->d.address == e2->d.address
- : e1->symndx >= 0 ? e1->d.addend == e2->d.addend
- : e1->d.h == e2->d.h);
-}
-
-/* multi_got_entries are still a match in the case of global objects,
- even if the input bfd in which they're referenced differs, so the
- hash computation and compare functions are adjusted
- accordingly. */
-
-static hashval_t
-mips_elf_multi_got_entry_hash (const void *entry_)
-{
- const struct mips_got_entry *entry = (struct mips_got_entry *)entry_;
-
- return entry->symndx
- + (! entry->abfd
- ? mips_elf_hash_bfd_vma (entry->d.address)
- : entry->symndx >= 0
- ? (entry->abfd->id
- + mips_elf_hash_bfd_vma (entry->d.addend))
- : entry->d.h->root.root.root.hash);
-}
-
-static int
-mips_elf_multi_got_entry_eq (const void *entry1, const void *entry2)
-{
- const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1;
- const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2;
-
- return e1->symndx == e2->symndx
- && (e1->symndx >= 0 ? e1->abfd == e2->abfd && e1->d.addend == e2->d.addend
- : e1->abfd == NULL || e2->abfd == NULL
- ? e1->abfd == e2->abfd && e1->d.address == e2->d.address
- : e1->d.h == e2->d.h);
-}
-
-/* Returns the dynamic relocation section for DYNOBJ. */
-
-static asection *
-mips_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p)
-{
- static const char dname[] = ".rel.dyn";
- asection *sreloc;
-
- sreloc = bfd_get_section_by_name (dynobj, dname);
- if (sreloc == NULL && create_p)
- {
- sreloc = bfd_make_section (dynobj, dname);
- if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, sreloc,
- MIPS_ELF_LOG_FILE_ALIGN (dynobj)))
- return NULL;
- }
- return sreloc;
-}
-
-/* Returns the GOT section for ABFD. */
-
-static asection *
-mips_elf_got_section (bfd *abfd, bfd_boolean maybe_excluded)
-{
- asection *sgot = bfd_get_section_by_name (abfd, ".got");
- if (sgot == NULL
- || (! maybe_excluded && (sgot->flags & SEC_EXCLUDE) != 0))
- return NULL;
- return sgot;
-}
-
-/* Returns the GOT information associated with the link indicated by
- INFO. If SGOTP is non-NULL, it is filled in with the GOT
- section. */
-
-static struct mips_got_info *
-mips_elf_got_info (bfd *abfd, asection **sgotp)
-{
- asection *sgot;
- struct mips_got_info *g;
-
- sgot = mips_elf_got_section (abfd, TRUE);
- BFD_ASSERT (sgot != NULL);
- BFD_ASSERT (mips_elf_section_data (sgot) != NULL);
- g = mips_elf_section_data (sgot)->u.got_info;
- BFD_ASSERT (g != NULL);
-
- if (sgotp)
- *sgotp = (sgot->flags & SEC_EXCLUDE) == 0 ? sgot : NULL;
-
- return g;
-}
-
-/* Obtain the lowest dynamic index of a symbol that was assigned a
- global GOT entry. */
-static long
-mips_elf_get_global_gotsym_index (bfd *abfd)
-{
- asection *sgot;
- struct mips_got_info *g;
-
- if (abfd == NULL)
- return 0;
-
- sgot = mips_elf_got_section (abfd, TRUE);
- if (sgot == NULL || mips_elf_section_data (sgot) == NULL)
- return 0;
-
- g = mips_elf_section_data (sgot)->u.got_info;
- if (g == NULL || g->global_gotsym == NULL)
- return 0;
-
- return g->global_gotsym->dynindx;
-}
-
-/* Returns the GOT offset at which the indicated address can be found.
- If there is not yet a GOT entry for this value, create one. Returns
- -1 if no satisfactory GOT offset can be found. */
-
-static bfd_vma
-mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
- bfd_vma value)
-{
- asection *sgot;
- struct mips_got_info *g;
- struct mips_got_entry *entry;
-
- g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
-
- entry = mips_elf_create_local_got_entry (abfd, ibfd, g, sgot, value);
- if (entry)
- return entry->gotidx;
- else
- return MINUS_ONE;
-}
-
-/* Returns the GOT index for the global symbol indicated by H. */
-
-static bfd_vma
-mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h)
-{
- bfd_vma index;
- asection *sgot;
- struct mips_got_info *g, *gg;
- long global_got_dynindx = 0;
-
- gg = g = mips_elf_got_info (abfd, &sgot);
- if (g->bfd2got && ibfd)
- {
- struct mips_got_entry e, *p;
-
- BFD_ASSERT (h->dynindx >= 0);
-
- g = mips_elf_got_for_ibfd (g, ibfd);
- if (g->next != gg)
- {
- e.abfd = ibfd;
- e.symndx = -1;
- e.d.h = (struct mips_elf_link_hash_entry *)h;
-
- p = htab_find (g->got_entries, &e);
-
- BFD_ASSERT (p->gotidx > 0);
- return p->gotidx;
- }
- }
-
- if (gg->global_gotsym != NULL)
- global_got_dynindx = gg->global_gotsym->dynindx;
-
- /* Once we determine the global GOT entry with the lowest dynamic
- symbol table index, we must put all dynamic symbols with greater
- indices into the GOT. That makes it easy to calculate the GOT
- offset. */
- BFD_ASSERT (h->dynindx >= global_got_dynindx);
- index = ((h->dynindx - global_got_dynindx + g->local_gotno)
- * MIPS_ELF_GOT_SIZE (abfd));
- BFD_ASSERT (index < sgot->_raw_size);
-
- return index;
-}
-
-/* Find a GOT entry that is within 32KB of the VALUE. These entries
- are supposed to be placed at small offsets in the GOT, i.e.,
- within 32KB of GP. Return the index into the GOT for this page,
- and store the offset from this entry to the desired address in
- OFFSETP, if it is non-NULL. */
-
-static bfd_vma
-mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
- bfd_vma value, bfd_vma *offsetp)
-{
- asection *sgot;
- struct mips_got_info *g;
- bfd_vma index;
- struct mips_got_entry *entry;
-
- g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
-
- entry = mips_elf_create_local_got_entry (abfd, ibfd, g, sgot,
- (value + 0x8000)
- & (~(bfd_vma)0xffff));
-
- if (!entry)
- return MINUS_ONE;
-
- index = entry->gotidx;
-
- if (offsetp)
- *offsetp = value - entry->d.address;
-
- return index;
-}
-
-/* Find a GOT entry whose higher-order 16 bits are the same as those
- for value. Return the index into the GOT for this entry. */
-
-static bfd_vma
-mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
- bfd_vma value, bfd_boolean external)
-{
- asection *sgot;
- struct mips_got_info *g;
- struct mips_got_entry *entry;
-
- if (! external)
- {
- /* Although the ABI says that it is "the high-order 16 bits" that we
- want, it is really the %high value. The complete value is
- calculated with a `addiu' of a LO16 relocation, just as with a
- HI16/LO16 pair. */
- value = mips_elf_high (value) << 16;
- }
-
- g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
-
- entry = mips_elf_create_local_got_entry (abfd, ibfd, g, sgot, value);
- if (entry)
- return entry->gotidx;
- else
- return MINUS_ONE;
-}
-
-/* Returns the offset for the entry at the INDEXth position
- in the GOT. */
-
-static bfd_vma
-mips_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
- bfd *input_bfd, bfd_vma index)
-{
- asection *sgot;
- bfd_vma gp;
- struct mips_got_info *g;
-
- g = mips_elf_got_info (dynobj, &sgot);
- gp = _bfd_get_gp_value (output_bfd)
- + mips_elf_adjust_gp (output_bfd, g, input_bfd);
-
- return sgot->output_section->vma + sgot->output_offset + index - gp;
-}
-
-/* Create a local GOT entry for VALUE. Return the index of the entry,
- or -1 if it could not be created. */
-
-static struct mips_got_entry *
-mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd,
- struct mips_got_info *gg,
- asection *sgot, bfd_vma value)
-{
- struct mips_got_entry entry, **loc;
- struct mips_got_info *g;
-
- entry.abfd = NULL;
- entry.symndx = -1;
- entry.d.address = value;
-
- g = mips_elf_got_for_ibfd (gg, ibfd);
- if (g == NULL)
- {
- g = mips_elf_got_for_ibfd (gg, abfd);
- BFD_ASSERT (g != NULL);
- }
-
- loc = (struct mips_got_entry **) htab_find_slot (g->got_entries, &entry,
- INSERT);
- if (*loc)
- return *loc;
-
- entry.gotidx = MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
-
- *loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry);
-
- if (! *loc)
- return NULL;
-
- memcpy (*loc, &entry, sizeof entry);
-
- if (g->assigned_gotno >= g->local_gotno)
- {
- (*loc)->gotidx = -1;
- /* We didn't allocate enough space in the GOT. */
- (*_bfd_error_handler)
- (_("not enough GOT space for local GOT entries"));
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-
- MIPS_ELF_PUT_WORD (abfd, value,
- (sgot->contents + entry.gotidx));
-
- return *loc;
-}
-
-/* Sort the dynamic symbol table so that symbols that need GOT entries
- appear towards the end. This reduces the amount of GOT space
- required. MAX_LOCAL is used to set the number of local symbols
- known to be in the dynamic symbol table. During
- _bfd_mips_elf_size_dynamic_sections, this value is 1. Afterward, the
- section symbols are added and the count is higher. */
-
-static bfd_boolean
-mips_elf_sort_hash_table (struct bfd_link_info *info, unsigned long max_local)
-{
- struct mips_elf_hash_sort_data hsd;
- struct mips_got_info *g;
- bfd *dynobj;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- g = mips_elf_got_info (dynobj, NULL);
-
- hsd.low = NULL;
- hsd.max_unref_got_dynindx =
- hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount
- /* In the multi-got case, assigned_gotno of the master got_info
- indicate the number of entries that aren't referenced in the
- primary GOT, but that must have entries because there are
- dynamic relocations that reference it. Since they aren't
- referenced, we move them to the end of the GOT, so that they
- don't prevent other entries that are referenced from getting
- too large offsets. */
- - (g->next ? g->assigned_gotno : 0);
- hsd.max_non_got_dynindx = max_local;
- mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
- elf_hash_table (info)),
- mips_elf_sort_hash_table_f,
- &hsd);
-
- /* There should have been enough room in the symbol table to
- accommodate both the GOT and non-GOT symbols. */
- BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx);
- BFD_ASSERT ((unsigned long)hsd.max_unref_got_dynindx
- <= elf_hash_table (info)->dynsymcount);
-
- /* Now we know which dynamic symbol has the lowest dynamic symbol
- table index in the GOT. */
- g->global_gotsym = hsd.low;
-
- return TRUE;
-}
-
-/* If H needs a GOT entry, assign it the highest available dynamic
- index. Otherwise, assign it the lowest available dynamic
- index. */
-
-static bfd_boolean
-mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
-{
- struct mips_elf_hash_sort_data *hsd = data;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- /* Symbols without dynamic symbol table entries aren't interesting
- at all. */
- if (h->root.dynindx == -1)
- return TRUE;
-
- /* Global symbols that need GOT entries that are not explicitly
- referenced are marked with got offset 2. Those that are
- referenced get a 1, and those that don't need GOT entries get
- -1. */
- if (h->root.got.offset == 2)
- {
- if (hsd->max_unref_got_dynindx == hsd->min_got_dynindx)
- hsd->low = (struct elf_link_hash_entry *) h;
- h->root.dynindx = hsd->max_unref_got_dynindx++;
- }
- else if (h->root.got.offset != 1)
- h->root.dynindx = hsd->max_non_got_dynindx++;
- else
- {
- h->root.dynindx = --hsd->min_got_dynindx;
- hsd->low = (struct elf_link_hash_entry *) h;
- }
-
- return TRUE;
-}
-
-/* If H is a symbol that needs a global GOT entry, but has a dynamic
- symbol table index lower than any we've seen to date, record it for
- posterity. */
-
-static bfd_boolean
-mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
- bfd *abfd, struct bfd_link_info *info,
- struct mips_got_info *g)
-{
- struct mips_got_entry entry, **loc;
-
- /* A global symbol in the GOT must also be in the dynamic symbol
- table. */
- if (h->dynindx == -1)
- {
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- _bfd_mips_elf_hide_symbol (info, h, TRUE);
- break;
- }
- if (!bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- entry.abfd = abfd;
- entry.symndx = -1;
- entry.d.h = (struct mips_elf_link_hash_entry *) h;
-
- loc = (struct mips_got_entry **) htab_find_slot (g->got_entries, &entry,
- INSERT);
-
- /* If we've already marked this entry as needing GOT space, we don't
- need to do it again. */
- if (*loc)
- return TRUE;
-
- *loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry);
-
- if (! *loc)
- return FALSE;
-
- entry.gotidx = -1;
- memcpy (*loc, &entry, sizeof entry);
-
- if (h->got.offset != MINUS_ONE)
- return TRUE;
-
- /* By setting this to a value other than -1, we are indicating that
- there needs to be a GOT entry for H. Avoid using zero, as the
- generic ELF copy_indirect_symbol tests for <= 0. */
- h->got.offset = 1;
-
- return TRUE;
-}
-
-/* Reserve space in G for a GOT entry containing the value of symbol
- SYMNDX in input bfd ABDF, plus ADDEND. */
-
-static bfd_boolean
-mips_elf_record_local_got_symbol (bfd *abfd, long symndx, bfd_vma addend,
- struct mips_got_info *g)
-{
- struct mips_got_entry entry, **loc;
-
- entry.abfd = abfd;
- entry.symndx = symndx;
- entry.d.addend = addend;
- loc = (struct mips_got_entry **)
- htab_find_slot (g->got_entries, &entry, INSERT);
-
- if (*loc)
- return TRUE;
-
- entry.gotidx = g->local_gotno++;
-
- *loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry);
-
- if (! *loc)
- return FALSE;
-
- memcpy (*loc, &entry, sizeof entry);
-
- return TRUE;
-}
-
-/* Compute the hash value of the bfd in a bfd2got hash entry. */
-
-static hashval_t
-mips_elf_bfd2got_entry_hash (const void *entry_)
-{
- const struct mips_elf_bfd2got_hash *entry
- = (struct mips_elf_bfd2got_hash *)entry_;
-
- return entry->bfd->id;
-}
-
-/* Check whether two hash entries have the same bfd. */
-
-static int
-mips_elf_bfd2got_entry_eq (const void *entry1, const void *entry2)
-{
- const struct mips_elf_bfd2got_hash *e1
- = (const struct mips_elf_bfd2got_hash *)entry1;
- const struct mips_elf_bfd2got_hash *e2
- = (const struct mips_elf_bfd2got_hash *)entry2;
-
- return e1->bfd == e2->bfd;
-}
-
-/* In a multi-got link, determine the GOT to be used for IBDF. G must
- be the master GOT data. */
-
-static struct mips_got_info *
-mips_elf_got_for_ibfd (struct mips_got_info *g, bfd *ibfd)
-{
- struct mips_elf_bfd2got_hash e, *p;
-
- if (! g->bfd2got)
- return g;
-
- e.bfd = ibfd;
- p = htab_find (g->bfd2got, &e);
- return p ? p->g : NULL;
-}
-
-/* Create one separate got for each bfd that has entries in the global
- got, such that we can tell how many local and global entries each
- bfd requires. */
-
-static int
-mips_elf_make_got_per_bfd (void **entryp, void *p)
-{
- struct mips_got_entry *entry = (struct mips_got_entry *)*entryp;
- struct mips_elf_got_per_bfd_arg *arg = (struct mips_elf_got_per_bfd_arg *)p;
- htab_t bfd2got = arg->bfd2got;
- struct mips_got_info *g;
- struct mips_elf_bfd2got_hash bfdgot_entry, *bfdgot;
- void **bfdgotp;
-
- /* Find the got_info for this GOT entry's input bfd. Create one if
- none exists. */
- bfdgot_entry.bfd = entry->abfd;
- bfdgotp = htab_find_slot (bfd2got, &bfdgot_entry, INSERT);
- bfdgot = (struct mips_elf_bfd2got_hash *)*bfdgotp;
-
- if (bfdgot != NULL)
- g = bfdgot->g;
- else
- {
- bfdgot = (struct mips_elf_bfd2got_hash *)bfd_alloc
- (arg->obfd, sizeof (struct mips_elf_bfd2got_hash));
-
- if (bfdgot == NULL)
- {
- arg->obfd = 0;
- return 0;
- }
-
- *bfdgotp = bfdgot;
-
- bfdgot->bfd = entry->abfd;
- bfdgot->g = g = (struct mips_got_info *)
- bfd_alloc (arg->obfd, sizeof (struct mips_got_info));
- if (g == NULL)
- {
- arg->obfd = 0;
- return 0;
- }
-
- g->global_gotsym = NULL;
- g->global_gotno = 0;
- g->local_gotno = 0;
- g->assigned_gotno = -1;
- g->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash,
- mips_elf_multi_got_entry_eq, NULL);
- if (g->got_entries == NULL)
- {
- arg->obfd = 0;
- return 0;
- }
-
- g->bfd2got = NULL;
- g->next = NULL;
- }
-
- /* Insert the GOT entry in the bfd's got entry hash table. */
- entryp = htab_find_slot (g->got_entries, entry, INSERT);
- if (*entryp != NULL)
- return 1;
-
- *entryp = entry;
-
- if (entry->symndx >= 0 || entry->d.h->forced_local)
- ++g->local_gotno;
- else
- ++g->global_gotno;
-
- return 1;
-}
-
-/* Attempt to merge gots of different input bfds. Try to use as much
- as possible of the primary got, since it doesn't require explicit
- dynamic relocations, but don't use bfds that would reference global
- symbols out of the addressable range. Failing the primary got,
- attempt to merge with the current got, or finish the current got
- and then make make the new got current. */
-
-static int
-mips_elf_merge_gots (void **bfd2got_, void *p)
-{
- struct mips_elf_bfd2got_hash *bfd2got
- = (struct mips_elf_bfd2got_hash *)*bfd2got_;
- struct mips_elf_got_per_bfd_arg *arg = (struct mips_elf_got_per_bfd_arg *)p;
- unsigned int lcount = bfd2got->g->local_gotno;
- unsigned int gcount = bfd2got->g->global_gotno;
- unsigned int maxcnt = arg->max_count;
-
- /* If we don't have a primary GOT and this is not too big, use it as
- a starting point for the primary GOT. */
- if (! arg->primary && lcount + gcount <= maxcnt)
- {
- arg->primary = bfd2got->g;
- arg->primary_count = lcount + gcount;
- }
- /* If it looks like we can merge this bfd's entries with those of
- the primary, merge them. The heuristics is conservative, but we
- don't have to squeeze it too hard. */
- else if (arg->primary
- && (arg->primary_count + lcount + gcount) <= maxcnt)
- {
- struct mips_got_info *g = bfd2got->g;
- int old_lcount = arg->primary->local_gotno;
- int old_gcount = arg->primary->global_gotno;
-
- bfd2got->g = arg->primary;
-
- htab_traverse (g->got_entries,
- mips_elf_make_got_per_bfd,
- arg);
- if (arg->obfd == NULL)
- return 0;
-
- htab_delete (g->got_entries);
- /* We don't have to worry about releasing memory of the actual
- got entries, since they're all in the master got_entries hash
- table anyway. */
-
- BFD_ASSERT (old_lcount + lcount >= arg->primary->local_gotno);
- BFD_ASSERT (old_gcount + gcount >= arg->primary->global_gotno);
-
- arg->primary_count = arg->primary->local_gotno
- + arg->primary->global_gotno;
- }
- /* If we can merge with the last-created got, do it. */
- else if (arg->current
- && arg->current_count + lcount + gcount <= maxcnt)
- {
- struct mips_got_info *g = bfd2got->g;
- int old_lcount = arg->current->local_gotno;
- int old_gcount = arg->current->global_gotno;
-
- bfd2got->g = arg->current;
-
- htab_traverse (g->got_entries,
- mips_elf_make_got_per_bfd,
- arg);
- if (arg->obfd == NULL)
- return 0;
-
- htab_delete (g->got_entries);
-
- BFD_ASSERT (old_lcount + lcount >= arg->current->local_gotno);
- BFD_ASSERT (old_gcount + gcount >= arg->current->global_gotno);
-
- arg->current_count = arg->current->local_gotno
- + arg->current->global_gotno;
- }
- /* Well, we couldn't merge, so create a new GOT. Don't check if it
- fits; if it turns out that it doesn't, we'll get relocation
- overflows anyway. */
- else
- {
- bfd2got->g->next = arg->current;
- arg->current = bfd2got->g;
-
- arg->current_count = lcount + gcount;
- }
-
- return 1;
-}
-
-/* If passed a NULL mips_got_info in the argument, set the marker used
- to tell whether a global symbol needs a got entry (in the primary
- got) to the given VALUE.
-
- If passed a pointer G to a mips_got_info in the argument (it must
- not be the primary GOT), compute the offset from the beginning of
- the (primary) GOT section to the entry in G corresponding to the
- global symbol. G's assigned_gotno must contain the index of the
- first available global GOT entry in G. VALUE must contain the size
- of a GOT entry in bytes. For each global GOT entry that requires a
- dynamic relocation, NEEDED_RELOCS is incremented, and the symbol is
- marked as not eligible for lazy resolution through a function
- stub. */
-static int
-mips_elf_set_global_got_offset (void **entryp, void *p)
-{
- struct mips_got_entry *entry = (struct mips_got_entry *)*entryp;
- struct mips_elf_set_global_got_offset_arg *arg
- = (struct mips_elf_set_global_got_offset_arg *)p;
- struct mips_got_info *g = arg->g;
-
- if (entry->abfd != NULL && entry->symndx == -1
- && entry->d.h->root.dynindx != -1)
- {
- if (g)
- {
- BFD_ASSERT (g->global_gotsym == NULL);
-
- entry->gotidx = arg->value * (long) g->assigned_gotno++;
- if (arg->info->shared
- || (elf_hash_table (arg->info)->dynamic_sections_created
- && ((entry->d.h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
- && ((entry->d.h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- ++arg->needed_relocs;
- }
- else
- entry->d.h->root.got.offset = arg->value;
- }
-
- return 1;
-}
-
-/* Mark any global symbols referenced in the GOT we are iterating over
- as inelligible for lazy resolution stubs. */
-static int
-mips_elf_set_no_stub (void **entryp, void *p ATTRIBUTE_UNUSED)
-{
- struct mips_got_entry *entry = (struct mips_got_entry *)*entryp;
-
- if (entry->abfd != NULL
- && entry->symndx == -1
- && entry->d.h->root.dynindx != -1)
- entry->d.h->no_fn_stub = TRUE;
-
- return 1;
-}
-
-/* Follow indirect and warning hash entries so that each got entry
- points to the final symbol definition. P must point to a pointer
- to the hash table we're traversing. Since this traversal may
- modify the hash table, we set this pointer to NULL to indicate
- we've made a potentially-destructive change to the hash table, so
- the traversal must be restarted. */
-static int
-mips_elf_resolve_final_got_entry (void **entryp, void *p)
-{
- struct mips_got_entry *entry = (struct mips_got_entry *)*entryp;
- htab_t got_entries = *(htab_t *)p;
-
- if (entry->abfd != NULL && entry->symndx == -1)
- {
- struct mips_elf_link_hash_entry *h = entry->d.h;
-
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- if (entry->d.h == h)
- return 1;
-
- entry->d.h = h;
-
- /* If we can't find this entry with the new bfd hash, re-insert
- it, and get the traversal restarted. */
- if (! htab_find (got_entries, entry))
- {
- htab_clear_slot (got_entries, entryp);
- entryp = htab_find_slot (got_entries, entry, INSERT);
- if (! *entryp)
- *entryp = entry;
- /* Abort the traversal, since the whole table may have
- moved, and leave it up to the parent to restart the
- process. */
- *(htab_t *)p = NULL;
- return 0;
- }
- /* We might want to decrement the global_gotno count, but it's
- either too early or too late for that at this point. */
- }
-
- return 1;
-}
-
-/* Turn indirect got entries in a got_entries table into their final
- locations. */
-static void
-mips_elf_resolve_final_got_entries (struct mips_got_info *g)
-{
- htab_t got_entries;
-
- do
- {
- got_entries = g->got_entries;
-
- htab_traverse (got_entries,
- mips_elf_resolve_final_got_entry,
- &got_entries);
- }
- while (got_entries == NULL);
-}
-
-/* Return the offset of an input bfd IBFD's GOT from the beginning of
- the primary GOT. */
-static bfd_vma
-mips_elf_adjust_gp (bfd *abfd, struct mips_got_info *g, bfd *ibfd)
-{
- if (g->bfd2got == NULL)
- return 0;
-
- g = mips_elf_got_for_ibfd (g, ibfd);
- if (! g)
- return 0;
-
- BFD_ASSERT (g->next);
-
- g = g->next;
-
- return (g->local_gotno + g->global_gotno) * MIPS_ELF_GOT_SIZE (abfd);
-}
-
-/* Turn a single GOT that is too big for 16-bit addressing into
- a sequence of GOTs, each one 16-bit addressable. */
-
-static bfd_boolean
-mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
- struct mips_got_info *g, asection *got,
- bfd_size_type pages)
-{
- struct mips_elf_got_per_bfd_arg got_per_bfd_arg;
- struct mips_elf_set_global_got_offset_arg set_got_offset_arg;
- struct mips_got_info *gg;
- unsigned int assign;
-
- g->bfd2got = htab_try_create (1, mips_elf_bfd2got_entry_hash,
- mips_elf_bfd2got_entry_eq, NULL);
- if (g->bfd2got == NULL)
- return FALSE;
-
- got_per_bfd_arg.bfd2got = g->bfd2got;
- got_per_bfd_arg.obfd = abfd;
- got_per_bfd_arg.info = info;
-
- /* Count how many GOT entries each input bfd requires, creating a
- map from bfd to got info while at that. */
- mips_elf_resolve_final_got_entries (g);
- htab_traverse (g->got_entries, mips_elf_make_got_per_bfd, &got_per_bfd_arg);
- if (got_per_bfd_arg.obfd == NULL)
- return FALSE;
-
- got_per_bfd_arg.current = NULL;
- got_per_bfd_arg.primary = NULL;
- /* Taking out PAGES entries is a worst-case estimate. We could
- compute the maximum number of pages that each separate input bfd
- uses, but it's probably not worth it. */
- got_per_bfd_arg.max_count = ((MIPS_ELF_GOT_MAX_SIZE (abfd)
- / MIPS_ELF_GOT_SIZE (abfd))
- - MIPS_RESERVED_GOTNO - pages);
-
- /* Try to merge the GOTs of input bfds together, as long as they
- don't seem to exceed the maximum GOT size, choosing one of them
- to be the primary GOT. */
- htab_traverse (g->bfd2got, mips_elf_merge_gots, &got_per_bfd_arg);
- if (got_per_bfd_arg.obfd == NULL)
- return FALSE;
-
- /* If we find any suitable primary GOT, create an empty one. */
- if (got_per_bfd_arg.primary == NULL)
- {
- g->next = (struct mips_got_info *)
- bfd_alloc (abfd, sizeof (struct mips_got_info));
- if (g->next == NULL)
- return FALSE;
-
- g->next->global_gotsym = NULL;
- g->next->global_gotno = 0;
- g->next->local_gotno = 0;
- g->next->assigned_gotno = 0;
- g->next->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash,
- mips_elf_multi_got_entry_eq,
- NULL);
- if (g->next->got_entries == NULL)
- return FALSE;
- g->next->bfd2got = NULL;
- }
- else
- g->next = got_per_bfd_arg.primary;
- g->next->next = got_per_bfd_arg.current;
-
- /* GG is now the master GOT, and G is the primary GOT. */
- gg = g;
- g = g->next;
-
- /* Map the output bfd to the primary got. That's what we're going
- to use for bfds that use GOT16 or GOT_PAGE relocations that we
- didn't mark in check_relocs, and we want a quick way to find it.
- We can't just use gg->next because we're going to reverse the
- list. */
- {
- struct mips_elf_bfd2got_hash *bfdgot;
- void **bfdgotp;
-
- bfdgot = (struct mips_elf_bfd2got_hash *)bfd_alloc
- (abfd, sizeof (struct mips_elf_bfd2got_hash));
-
- if (bfdgot == NULL)
- return FALSE;
-
- bfdgot->bfd = abfd;
- bfdgot->g = g;
- bfdgotp = htab_find_slot (gg->bfd2got, bfdgot, INSERT);
-
- BFD_ASSERT (*bfdgotp == NULL);
- *bfdgotp = bfdgot;
- }
-
- /* The IRIX dynamic linker requires every symbol that is referenced
- in a dynamic relocation to be present in the primary GOT, so
- arrange for them to appear after those that are actually
- referenced.
-
- GNU/Linux could very well do without it, but it would slow down
- the dynamic linker, since it would have to resolve every dynamic
- symbol referenced in other GOTs more than once, without help from
- the cache. Also, knowing that every external symbol has a GOT
- helps speed up the resolution of local symbols too, so GNU/Linux
- follows IRIX's practice.
-
- The number 2 is used by mips_elf_sort_hash_table_f to count
- global GOT symbols that are unreferenced in the primary GOT, with
- an initial dynamic index computed from gg->assigned_gotno, where
- the number of unreferenced global entries in the primary GOT is
- preserved. */
- if (1)
- {
- gg->assigned_gotno = gg->global_gotno - g->global_gotno;
- g->global_gotno = gg->global_gotno;
- set_got_offset_arg.value = 2;
- }
- else
- {
- /* This could be used for dynamic linkers that don't optimize
- symbol resolution while applying relocations so as to use
- primary GOT entries or assuming the symbol is locally-defined.
- With this code, we assign lower dynamic indices to global
- symbols that are not referenced in the primary GOT, so that
- their entries can be omitted. */
- gg->assigned_gotno = 0;
- set_got_offset_arg.value = -1;
- }
-
- /* Reorder dynamic symbols as described above (which behavior
- depends on the setting of VALUE). */
- set_got_offset_arg.g = NULL;
- htab_traverse (gg->got_entries, mips_elf_set_global_got_offset,
- &set_got_offset_arg);
- set_got_offset_arg.value = 1;
- htab_traverse (g->got_entries, mips_elf_set_global_got_offset,
- &set_got_offset_arg);
- if (! mips_elf_sort_hash_table (info, 1))
- return FALSE;
-
- /* Now go through the GOTs assigning them offset ranges.
- [assigned_gotno, local_gotno[ will be set to the range of local
- entries in each GOT. We can then compute the end of a GOT by
- adding local_gotno to global_gotno. We reverse the list and make
- it circular since then we'll be able to quickly compute the
- beginning of a GOT, by computing the end of its predecessor. To
- avoid special cases for the primary GOT, while still preserving
- assertions that are valid for both single- and multi-got links,
- we arrange for the main got struct to have the right number of
- global entries, but set its local_gotno such that the initial
- offset of the primary GOT is zero. Remember that the primary GOT
- will become the last item in the circular linked list, so it
- points back to the master GOT. */
- gg->local_gotno = -g->global_gotno;
- gg->global_gotno = g->global_gotno;
- assign = 0;
- gg->next = gg;
-
- do
- {
- struct mips_got_info *gn;
-
- assign += MIPS_RESERVED_GOTNO;
- g->assigned_gotno = assign;
- g->local_gotno += assign + pages;
- assign = g->local_gotno + g->global_gotno;
-
- /* Take g out of the direct list, and push it onto the reversed
- list that gg points to. */
- gn = g->next;
- g->next = gg->next;
- gg->next = g;
- g = gn;
-
- /* Mark global symbols in every non-primary GOT as ineligible for
- stubs. */
- if (g)
- htab_traverse (g->got_entries, mips_elf_set_no_stub, NULL);
- }
- while (g);
-
- got->_raw_size = (gg->next->local_gotno
- + gg->next->global_gotno) * MIPS_ELF_GOT_SIZE (abfd);
-
- return TRUE;
-}
-
-
-/* Returns the first relocation of type r_type found, beginning with
- RELOCATION. RELEND is one-past-the-end of the relocation table. */
-
-static const Elf_Internal_Rela *
-mips_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type,
- const Elf_Internal_Rela *relocation,
- const Elf_Internal_Rela *relend)
-{
- /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be
- immediately following. However, for the IRIX6 ABI, the next
- relocation may be a composed relocation consisting of several
- relocations for the same address. In that case, the R_MIPS_LO16
- relocation may occur as one of these. We permit a similar
- extension in general, as that is useful for GCC. */
- while (relocation < relend)
- {
- if (ELF_R_TYPE (abfd, relocation->r_info) == r_type)
- return relocation;
-
- ++relocation;
- }
-
- /* We didn't find it. */
- bfd_set_error (bfd_error_bad_value);
- return NULL;
-}
-
-/* Return whether a relocation is against a local symbol. */
-
-static bfd_boolean
-mips_elf_local_relocation_p (bfd *input_bfd,
- const Elf_Internal_Rela *relocation,
- asection **local_sections,
- bfd_boolean check_forced)
-{
- unsigned long r_symndx;
- Elf_Internal_Shdr *symtab_hdr;
- struct mips_elf_link_hash_entry *h;
- size_t extsymoff;
-
- r_symndx = ELF_R_SYM (input_bfd, relocation->r_info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
-
- if (r_symndx < extsymoff)
- return TRUE;
- if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
- return TRUE;
-
- if (check_forced)
- {
- /* Look up the hash table to check whether the symbol
- was forced local. */
- h = (struct mips_elf_link_hash_entry *)
- elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
- /* Find the real hash-table entry for this symbol. */
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
- if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* Sign-extend VALUE, which has the indicated number of BITS. */
-
-bfd_vma
-_bfd_mips_elf_sign_extend (bfd_vma value, int bits)
-{
- if (value & ((bfd_vma) 1 << (bits - 1)))
- /* VALUE is negative. */
- value |= ((bfd_vma) - 1) << bits;
-
- return value;
-}
-
-/* Return non-zero if the indicated VALUE has overflowed the maximum
- range expressible by a signed number with the indicated number of
- BITS. */
-
-static bfd_boolean
-mips_elf_overflow_p (bfd_vma value, int bits)
-{
- bfd_signed_vma svalue = (bfd_signed_vma) value;
-
- if (svalue > (1 << (bits - 1)) - 1)
- /* The value is too big. */
- return TRUE;
- else if (svalue < -(1 << (bits - 1)))
- /* The value is too small. */
- return TRUE;
-
- /* All is well. */
- return FALSE;
-}
-
-/* Calculate the %high function. */
-
-static bfd_vma
-mips_elf_high (bfd_vma value)
-{
- return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff;
-}
-
-/* Calculate the %higher function. */
-
-static bfd_vma
-mips_elf_higher (bfd_vma value ATTRIBUTE_UNUSED)
-{
-#ifdef BFD64
- return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff;
-#else
- abort ();
- return (bfd_vma) -1;
-#endif
-}
-
-/* Calculate the %highest function. */
-
-static bfd_vma
-mips_elf_highest (bfd_vma value ATTRIBUTE_UNUSED)
-{
-#ifdef BFD64
- return ((value + (((bfd_vma) 0x8000 << 32) | 0x80008000)) >> 48) & 0xffff;
-#else
- abort ();
- return (bfd_vma) -1;
-#endif
-}
-
-/* Create the .compact_rel section. */
-
-static bfd_boolean
-mips_elf_create_compact_rel_section
- (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- flagword flags;
- register asection *s;
-
- if (bfd_get_section_by_name (abfd, ".compact_rel") == NULL)
- {
- flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
-
- s = bfd_make_section (abfd, ".compact_rel");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s,
- MIPS_ELF_LOG_FILE_ALIGN (abfd)))
- return FALSE;
-
- s->_raw_size = sizeof (Elf32_External_compact_rel);
- }
-
- return TRUE;
-}
-
-/* Create the .got section to hold the global offset table. */
-
-static bfd_boolean
-mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info,
- bfd_boolean maybe_exclude)
-{
- flagword flags;
- register asection *s;
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
- struct mips_got_info *g;
- bfd_size_type amt;
-
- /* This function may be called more than once. */
- s = mips_elf_got_section (abfd, TRUE);
- if (s)
- {
- if (! maybe_exclude)
- s->flags &= ~SEC_EXCLUDE;
- return TRUE;
- }
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
-
- if (maybe_exclude)
- flags |= SEC_EXCLUDE;
-
- /* We have to use an alignment of 2**4 here because this is hardcoded
- in the function stub generation and in the linker script. */
- s = bfd_make_section (abfd, ".got");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s, 4))
- return FALSE;
-
- /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the
- linker script because we don't want to define the symbol if we
- are not creating a global offset table. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
-
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (info->shared
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- amt = sizeof (struct mips_got_info);
- g = bfd_alloc (abfd, amt);
- if (g == NULL)
- return FALSE;
- g->global_gotsym = NULL;
- g->global_gotno = 0;
- g->local_gotno = MIPS_RESERVED_GOTNO;
- g->assigned_gotno = MIPS_RESERVED_GOTNO;
- g->bfd2got = NULL;
- g->next = NULL;
- g->got_entries = htab_try_create (1, mips_elf_got_entry_hash,
- mips_elf_got_entry_eq, NULL);
- if (g->got_entries == NULL)
- return FALSE;
- mips_elf_section_data (s)->u.got_info = g;
- mips_elf_section_data (s)->elf.this_hdr.sh_flags
- |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
-
- return TRUE;
-}
-
-/* Calculate the value produced by the RELOCATION (which comes from
- the INPUT_BFD). The ADDEND is the addend to use for this
- RELOCATION; RELOCATION->R_ADDEND is ignored.
-
- The result of the relocation calculation is stored in VALUEP.
- REQUIRE_JALXP indicates whether or not the opcode used with this
- relocation must be JALX.
-
- This function returns bfd_reloc_continue if the caller need take no
- further action regarding this relocation, bfd_reloc_notsupported if
- something goes dramatically wrong, bfd_reloc_overflow if an
- overflow occurs, and bfd_reloc_ok to indicate success. */
-
-static bfd_reloc_status_type
-mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
- asection *input_section,
- struct bfd_link_info *info,
- const Elf_Internal_Rela *relocation,
- bfd_vma addend, reloc_howto_type *howto,
- Elf_Internal_Sym *local_syms,
- asection **local_sections, bfd_vma *valuep,
- const char **namep, bfd_boolean *require_jalxp,
- bfd_boolean save_addend)
-{
- /* The eventual value we will return. */
- bfd_vma value;
- /* The address of the symbol against which the relocation is
- occurring. */
- bfd_vma symbol = 0;
- /* The final GP value to be used for the relocatable, executable, or
- shared object file being produced. */
- bfd_vma gp = MINUS_ONE;
- /* The place (section offset or address) of the storage unit being
- relocated. */
- bfd_vma p;
- /* The value of GP used to create the relocatable object. */
- bfd_vma gp0 = MINUS_ONE;
- /* The offset into the global offset table at which the address of
- the relocation entry symbol, adjusted by the addend, resides
- during execution. */
- bfd_vma g = MINUS_ONE;
- /* The section in which the symbol referenced by the relocation is
- located. */
- asection *sec = NULL;
- struct mips_elf_link_hash_entry *h = NULL;
- /* TRUE if the symbol referred to by this relocation is a local
- symbol. */
- bfd_boolean local_p, was_local_p;
- /* TRUE if the symbol referred to by this relocation is "_gp_disp". */
- bfd_boolean gp_disp_p = FALSE;
- Elf_Internal_Shdr *symtab_hdr;
- size_t extsymoff;
- unsigned long r_symndx;
- int r_type;
- /* TRUE if overflow occurred during the calculation of the
- relocation value. */
- bfd_boolean overflowed_p;
- /* TRUE if this relocation refers to a MIPS16 function. */
- bfd_boolean target_is_16_bit_code_p = FALSE;
-
- /* Parse the relocation. */
- r_symndx = ELF_R_SYM (input_bfd, relocation->r_info);
- r_type = ELF_R_TYPE (input_bfd, relocation->r_info);
- p = (input_section->output_section->vma
- + input_section->output_offset
- + relocation->r_offset);
-
- /* Assume that there will be no overflow. */
- overflowed_p = FALSE;
-
- /* Figure out whether or not the symbol is local, and get the offset
- used in the array of hash table entries. */
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- local_p = mips_elf_local_relocation_p (input_bfd, relocation,
- local_sections, FALSE);
- was_local_p = local_p;
- if (! elf_bad_symtab (input_bfd))
- extsymoff = symtab_hdr->sh_info;
- else
- {
- /* The symbol table does not follow the rule that local symbols
- must come before globals. */
- extsymoff = 0;
- }
-
- /* Figure out the value of the symbol. */
- if (local_p)
- {
- Elf_Internal_Sym *sym;
-
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
-
- symbol = sec->output_section->vma + sec->output_offset;
- if (ELF_ST_TYPE (sym->st_info) != STT_SECTION
- || (sec->flags & SEC_MERGE))
- symbol += sym->st_value;
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- addend = _bfd_elf_rel_local_sym (abfd, sym, &sec, addend);
- addend -= symbol;
- addend += sec->output_section->vma + sec->output_offset;
- }
-
- /* MIPS16 text labels should be treated as odd. */
- if (sym->st_other == STO_MIPS16)
- ++symbol;
-
- /* Record the name of this symbol, for our caller. */
- *namep = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (*namep == '\0')
- *namep = bfd_section_name (input_bfd, sec);
-
- target_is_16_bit_code_p = (sym->st_other == STO_MIPS16);
- }
- else
- {
- /* ??? Could we use RELOC_FOR_GLOBAL_SYMBOL here ? */
-
- /* For global symbols we look up the symbol in the hash-table. */
- h = ((struct mips_elf_link_hash_entry *)
- elf_sym_hashes (input_bfd) [r_symndx - extsymoff]);
- /* Find the real hash-table entry for this symbol. */
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- /* Record the name of this symbol, for our caller. */
- *namep = h->root.root.root.string;
-
- /* See if this is the special _gp_disp symbol. Note that such a
- symbol must always be a global symbol. */
- if (strcmp (*namep, "_gp_disp") == 0
- && ! NEWABI_P (input_bfd))
- {
- /* Relocations against _gp_disp are permitted only with
- R_MIPS_HI16 and R_MIPS_LO16 relocations. */
- if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16)
- return bfd_reloc_notsupported;
-
- gp_disp_p = TRUE;
- }
- /* If this symbol is defined, calculate its address. Note that
- _gp_disp is a magic symbol, always implicitly defined by the
- linker, so it's inappropriate to check to see whether or not
- its defined. */
- else if ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- && h->root.root.u.def.section)
- {
- sec = h->root.root.u.def.section;
- if (sec->output_section)
- symbol = (h->root.root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- else
- symbol = h->root.root.u.def.value;
- }
- else if (h->root.root.type == bfd_link_hash_undefweak)
- /* We allow relocations against undefined weak symbols, giving
- it the value zero, so that you can undefined weak functions
- and check to see if they exist by looking at their
- addresses. */
- symbol = 0;
- else if (info->unresolved_syms_in_objects == RM_IGNORE
- && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
- symbol = 0;
- else if (strcmp (*namep, "_DYNAMIC_LINK") == 0 ||
- strcmp (*namep, "_DYNAMIC_LINKING") == 0)
- {
- /* If this is a dynamic link, we should have created a
- _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
- in in _bfd_mips_elf_create_dynamic_sections.
- Otherwise, we should define the symbol with a value of 0.
- FIXME: It should probably get into the symbol table
- somehow as well. */
- BFD_ASSERT (! info->shared);
- BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL);
- symbol = 0;
- }
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.root.string, input_bfd,
- input_section, relocation->r_offset,
- (info->unresolved_syms_in_objects == RM_GENERATE_ERROR)
- || ELF_ST_VISIBILITY (h->root.other))))
- return bfd_reloc_undefined;
- symbol = 0;
- }
-
- target_is_16_bit_code_p = (h->root.other == STO_MIPS16);
- }
-
- /* If this is a 32- or 64-bit call to a 16-bit function with a stub, we
- need to redirect the call to the stub, unless we're already *in*
- a stub. */
- if (r_type != R_MIPS16_26 && !info->relocatable
- && ((h != NULL && h->fn_stub != NULL)
- || (local_p && elf_tdata (input_bfd)->local_stubs != NULL
- && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL))
- && !mips_elf_stub_section_p (input_bfd, input_section))
- {
- /* This is a 32- or 64-bit call to a 16-bit function. We should
- have already noticed that we were going to need the
- stub. */
- if (local_p)
- sec = elf_tdata (input_bfd)->local_stubs[r_symndx];
- else
- {
- BFD_ASSERT (h->need_fn_stub);
- sec = h->fn_stub;
- }
-
- symbol = sec->output_section->vma + sec->output_offset;
- }
- /* If this is a 16-bit call to a 32- or 64-bit function with a stub, we
- need to redirect the call to the stub. */
- else if (r_type == R_MIPS16_26 && !info->relocatable
- && h != NULL
- && (h->call_stub != NULL || h->call_fp_stub != NULL)
- && !target_is_16_bit_code_p)
- {
- /* If both call_stub and call_fp_stub are defined, we can figure
- out which one to use by seeing which one appears in the input
- file. */
- if (h->call_stub != NULL && h->call_fp_stub != NULL)
- {
- asection *o;
-
- sec = NULL;
- for (o = input_bfd->sections; o != NULL; o = o->next)
- {
- if (strncmp (bfd_get_section_name (input_bfd, o),
- CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
- {
- sec = h->call_fp_stub;
- break;
- }
- }
- if (sec == NULL)
- sec = h->call_stub;
- }
- else if (h->call_stub != NULL)
- sec = h->call_stub;
- else
- sec = h->call_fp_stub;
-
- BFD_ASSERT (sec->_raw_size > 0);
- symbol = sec->output_section->vma + sec->output_offset;
- }
-
- /* Calls from 16-bit code to 32-bit code and vice versa require the
- special jalx instruction. */
- *require_jalxp = (!info->relocatable
- && (((r_type == R_MIPS16_26) && !target_is_16_bit_code_p)
- || ((r_type == R_MIPS_26) && target_is_16_bit_code_p)));
-
- local_p = mips_elf_local_relocation_p (input_bfd, relocation,
- local_sections, TRUE);
-
- /* If we haven't already determined the GOT offset, or the GP value,
- and we're going to need it, get it now. */
- switch (r_type)
- {
- case R_MIPS_GOT_PAGE:
- case R_MIPS_GOT_OFST:
- /* We need to decay to GOT_DISP/addend if the symbol doesn't
- bind locally. */
- local_p = local_p || _bfd_elf_symbol_refs_local_p (&h->root, info, 1);
- if (local_p || r_type == R_MIPS_GOT_OFST)
- break;
- /* Fall through. */
-
- case R_MIPS_CALL16:
- case R_MIPS_GOT16:
- case R_MIPS_GOT_DISP:
- case R_MIPS_GOT_HI16:
- case R_MIPS_CALL_HI16:
- case R_MIPS_GOT_LO16:
- case R_MIPS_CALL_LO16:
- /* Find the index into the GOT where this value is located. */
- if (!local_p)
- {
- /* GOT_PAGE may take a non-zero addend, that is ignored in a
- GOT_PAGE relocation that decays to GOT_DISP because the
- symbol turns out to be global. The addend is then added
- as GOT_OFST. */
- BFD_ASSERT (addend == 0 || r_type == R_MIPS_GOT_PAGE);
- g = mips_elf_global_got_index (elf_hash_table (info)->dynobj,
- input_bfd,
- (struct elf_link_hash_entry *) h);
- if (! elf_hash_table(info)->dynamic_sections_created
- || (info->shared
- && (info->symbolic || h->root.dynindx == -1)
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is a static link or a -Bsymbolic link. The
- symbol is defined locally, or was forced to be local.
- We must initialize this entry in the GOT. */
- bfd *tmpbfd = elf_hash_table (info)->dynobj;
- asection *sgot = mips_elf_got_section (tmpbfd, FALSE);
- MIPS_ELF_PUT_WORD (tmpbfd, symbol, sgot->contents + g);
- }
- }
- else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16)
- /* There's no need to create a local GOT entry here; the
- calculation for a local GOT16 entry does not involve G. */
- break;
- else
- {
- g = mips_elf_local_got_index (abfd, input_bfd,
- info, symbol + addend);
- if (g == MINUS_ONE)
- return bfd_reloc_outofrange;
- }
-
- /* Convert GOT indices to actual offsets. */
- g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
- abfd, input_bfd, g);
- break;
-
- case R_MIPS_HI16:
- case R_MIPS_LO16:
- case R_MIPS16_GPREL:
- case R_MIPS_GPREL16:
- case R_MIPS_GPREL32:
- case R_MIPS_LITERAL:
- gp0 = _bfd_get_gp_value (input_bfd);
- gp = _bfd_get_gp_value (abfd);
- if (elf_hash_table (info)->dynobj)
- gp += mips_elf_adjust_gp (abfd,
- mips_elf_got_info
- (elf_hash_table (info)->dynobj, NULL),
- input_bfd);
- break;
-
- default:
- break;
- }
-
- /* Figure out what kind of relocation is being performed. */
- switch (r_type)
- {
- case R_MIPS_NONE:
- return bfd_reloc_continue;
-
- case R_MIPS_16:
- value = symbol + _bfd_mips_elf_sign_extend (addend, 16);
- overflowed_p = mips_elf_overflow_p (value, 16);
- break;
-
- case R_MIPS_32:
- case R_MIPS_REL32:
- case R_MIPS_64:
- if ((info->shared
- || (elf_hash_table (info)->dynamic_sections_created
- && h != NULL
- && ((h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
- && ((h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- && r_symndx != 0
- && (input_section->flags & SEC_ALLOC) != 0)
- {
- /* If we're creating a shared library, or this relocation is
- against a symbol in a shared library, then we can't know
- where the symbol will end up. So, we create a relocation
- record in the output, and leave the job up to the dynamic
- linker. */
- value = addend;
- if (!mips_elf_create_dynamic_relocation (abfd,
- info,
- relocation,
- h,
- sec,
- symbol,
- &value,
- input_section))
- return bfd_reloc_undefined;
- }
- else
- {
- if (r_type != R_MIPS_REL32)
- value = symbol + addend;
- else
- value = addend;
- }
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_PC32:
- case R_MIPS_PC64:
- case R_MIPS_GNU_REL_LO16:
- value = symbol + addend - p;
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_GNU_REL16_S2:
- value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p;
- overflowed_p = mips_elf_overflow_p (value, 18);
- value = (value >> 2) & howto->dst_mask;
- break;
-
- case R_MIPS_GNU_REL_HI16:
- /* Instead of subtracting 'p' here, we should be subtracting the
- equivalent value for the LO part of the reloc, since the value
- here is relative to that address. Because that's not easy to do,
- we adjust 'addend' in _bfd_mips_elf_relocate_section(). See also
- the comment there for more information. */
- value = mips_elf_high (addend + symbol - p);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS16_26:
- /* The calculation for R_MIPS16_26 is just the same as for an
- R_MIPS_26. It's only the storage of the relocated field into
- the output file that's different. That's handled in
- mips_elf_perform_relocation. So, we just fall through to the
- R_MIPS_26 case here. */
- case R_MIPS_26:
- if (local_p)
- value = ((addend | ((p + 4) & 0xf0000000)) + symbol) >> 2;
- else
- value = (_bfd_mips_elf_sign_extend (addend, 28) + symbol) >> 2;
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_HI16:
- if (!gp_disp_p)
- {
- value = mips_elf_high (addend + symbol);
- value &= howto->dst_mask;
- }
- else
- {
- value = mips_elf_high (addend + gp - p);
- overflowed_p = mips_elf_overflow_p (value, 16);
- }
- break;
-
- case R_MIPS_LO16:
- if (!gp_disp_p)
- value = (symbol + addend) & howto->dst_mask;
- else
- {
- value = addend + gp - p + 4;
- /* The MIPS ABI requires checking the R_MIPS_LO16 relocation
- for overflow. But, on, say, IRIX5, relocations against
- _gp_disp are normally generated from the .cpload
- pseudo-op. It generates code that normally looks like
- this:
-
- lui $gp,%hi(_gp_disp)
- addiu $gp,$gp,%lo(_gp_disp)
- addu $gp,$gp,$t9
-
- Here $t9 holds the address of the function being called,
- as required by the MIPS ELF ABI. The R_MIPS_LO16
- relocation can easily overflow in this situation, but the
- R_MIPS_HI16 relocation will handle the overflow.
- Therefore, we consider this a bug in the MIPS ABI, and do
- not check for overflow here. */
- }
- break;
-
- case R_MIPS_LITERAL:
- /* Because we don't merge literal sections, we can handle this
- just like R_MIPS_GPREL16. In the long run, we should merge
- shared literals, and then we will need to additional work
- here. */
-
- /* Fall through. */
-
- case R_MIPS16_GPREL:
- /* The R_MIPS16_GPREL performs the same calculation as
- R_MIPS_GPREL16, but stores the relocated bits in a different
- order. We don't need to do anything special here; the
- differences are handled in mips_elf_perform_relocation. */
- case R_MIPS_GPREL16:
- /* Only sign-extend the addend if it was extracted from the
- instruction. If the addend was separate, leave it alone,
- otherwise we may lose significant bits. */
- if (howto->partial_inplace)
- addend = _bfd_mips_elf_sign_extend (addend, 16);
- value = symbol + addend - gp;
- /* If the symbol was local, any earlier relocatable links will
- have adjusted its addend with the gp offset, so compensate
- for that now. Don't do it for symbols forced local in this
- link, though, since they won't have had the gp offset applied
- to them before. */
- if (was_local_p)
- value += gp0;
- overflowed_p = mips_elf_overflow_p (value, 16);
- break;
-
- case R_MIPS_GOT16:
- case R_MIPS_CALL16:
- if (local_p)
- {
- bfd_boolean forced;
-
- /* The special case is when the symbol is forced to be local. We
- need the full address in the GOT since no R_MIPS_LO16 relocation
- follows. */
- forced = ! mips_elf_local_relocation_p (input_bfd, relocation,
- local_sections, FALSE);
- value = mips_elf_got16_entry (abfd, input_bfd, info,
- symbol + addend, forced);
- if (value == MINUS_ONE)
- return bfd_reloc_outofrange;
- value
- = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
- abfd, input_bfd, value);
- overflowed_p = mips_elf_overflow_p (value, 16);
- break;
- }
-
- /* Fall through. */
-
- case R_MIPS_GOT_DISP:
- got_disp:
- value = g;
- overflowed_p = mips_elf_overflow_p (value, 16);
- break;
-
- case R_MIPS_GPREL32:
- value = (addend + symbol + gp0 - gp);
- if (!save_addend)
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_PC16:
- value = _bfd_mips_elf_sign_extend (addend, 16) + symbol - p;
- overflowed_p = mips_elf_overflow_p (value, 16);
- break;
-
- case R_MIPS_GOT_HI16:
- case R_MIPS_CALL_HI16:
- /* We're allowed to handle these two relocations identically.
- The dynamic linker is allowed to handle the CALL relocations
- differently by creating a lazy evaluation stub. */
- value = g;
- value = mips_elf_high (value);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_GOT_LO16:
- case R_MIPS_CALL_LO16:
- value = g & howto->dst_mask;
- break;
-
- case R_MIPS_GOT_PAGE:
- /* GOT_PAGE relocations that reference non-local symbols decay
- to GOT_DISP. The corresponding GOT_OFST relocation decays to
- 0. */
- if (! local_p)
- goto got_disp;
- value = mips_elf_got_page (abfd, input_bfd, info, symbol + addend, NULL);
- if (value == MINUS_ONE)
- return bfd_reloc_outofrange;
- value = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
- abfd, input_bfd, value);
- overflowed_p = mips_elf_overflow_p (value, 16);
- break;
-
- case R_MIPS_GOT_OFST:
- if (local_p)
- mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value);
- else
- value = addend;
- overflowed_p = mips_elf_overflow_p (value, 16);
- break;
-
- case R_MIPS_SUB:
- value = symbol - addend;
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_HIGHER:
- value = mips_elf_higher (addend + symbol);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_HIGHEST:
- value = mips_elf_highest (addend + symbol);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_SCN_DISP:
- value = symbol + addend - sec->output_offset;
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_PJUMP:
- case R_MIPS_JALR:
- /* Both of these may be ignored. R_MIPS_JALR is an optimization
- hint; we could improve performance by honoring that hint. */
- return bfd_reloc_continue;
-
- case R_MIPS_GNU_VTINHERIT:
- case R_MIPS_GNU_VTENTRY:
- /* We don't do anything with these at present. */
- return bfd_reloc_continue;
-
- default:
- /* An unrecognized relocation type. */
- return bfd_reloc_notsupported;
- }
-
- /* Store the VALUE for our caller. */
- *valuep = value;
- return overflowed_p ? bfd_reloc_overflow : bfd_reloc_ok;
-}
-
-/* Obtain the field relocated by RELOCATION. */
-
-static bfd_vma
-mips_elf_obtain_contents (reloc_howto_type *howto,
- const Elf_Internal_Rela *relocation,
- bfd *input_bfd, bfd_byte *contents)
-{
- bfd_vma x;
- bfd_byte *location = contents + relocation->r_offset;
-
- /* Obtain the bytes. */
- x = bfd_get ((8 * bfd_get_reloc_size (howto)), input_bfd, location);
-
- if ((ELF_R_TYPE (input_bfd, relocation->r_info) == R_MIPS16_26
- || ELF_R_TYPE (input_bfd, relocation->r_info) == R_MIPS16_GPREL)
- && bfd_little_endian (input_bfd))
- /* The two 16-bit words will be reversed on a little-endian system.
- See mips_elf_perform_relocation for more details. */
- x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16));
-
- return x;
-}
-
-/* It has been determined that the result of the RELOCATION is the
- VALUE. Use HOWTO to place VALUE into the output file at the
- appropriate position. The SECTION is the section to which the
- relocation applies. If REQUIRE_JALX is TRUE, then the opcode used
- for the relocation must be either JAL or JALX, and it is
- unconditionally converted to JALX.
-
- Returns FALSE if anything goes wrong. */
-
-static bfd_boolean
-mips_elf_perform_relocation (struct bfd_link_info *info,
- reloc_howto_type *howto,
- const Elf_Internal_Rela *relocation,
- bfd_vma value, bfd *input_bfd,
- asection *input_section, bfd_byte *contents,
- bfd_boolean require_jalx)
-{
- bfd_vma x;
- bfd_byte *location;
- int r_type = ELF_R_TYPE (input_bfd, relocation->r_info);
-
- /* Figure out where the relocation is occurring. */
- location = contents + relocation->r_offset;
-
- /* Obtain the current value. */
- x = mips_elf_obtain_contents (howto, relocation, input_bfd, contents);
-
- /* Clear the field we are setting. */
- x &= ~howto->dst_mask;
-
- /* If this is the R_MIPS16_26 relocation, we must store the
- value in a funny way. */
- if (r_type == R_MIPS16_26)
- {
- /* R_MIPS16_26 is used for the mips16 jal and jalx instructions.
- Most mips16 instructions are 16 bits, but these instructions
- are 32 bits.
-
- The format of these instructions is:
-
- +--------------+--------------------------------+
- ! JALX ! X! Imm 20:16 ! Imm 25:21 !
- +--------------+--------------------------------+
- ! Immediate 15:0 !
- +-----------------------------------------------+
-
- JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx.
- Note that the immediate value in the first word is swapped.
-
- When producing a relocatable object file, R_MIPS16_26 is
- handled mostly like R_MIPS_26. In particular, the addend is
- stored as a straight 26-bit value in a 32-bit instruction.
- (gas makes life simpler for itself by never adjusting a
- R_MIPS16_26 reloc to be against a section, so the addend is
- always zero). However, the 32 bit instruction is stored as 2
- 16-bit values, rather than a single 32-bit value. In a
- big-endian file, the result is the same; in a little-endian
- file, the two 16-bit halves of the 32 bit value are swapped.
- This is so that a disassembler can recognize the jal
- instruction.
-
- When doing a final link, R_MIPS16_26 is treated as a 32 bit
- instruction stored as two 16-bit values. The addend A is the
- contents of the targ26 field. The calculation is the same as
- R_MIPS_26. When storing the calculated value, reorder the
- immediate value as shown above, and don't forget to store the
- value as two 16-bit values.
-
- To put it in MIPS ABI terms, the relocation field is T-targ26-16,
- defined as
-
- big-endian:
- +--------+----------------------+
- | | |
- | | targ26-16 |
- |31 26|25 0|
- +--------+----------------------+
-
- little-endian:
- +----------+------+-------------+
- | | | |
- | sub1 | | sub2 |
- |0 9|10 15|16 31|
- +----------+--------------------+
- where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is
- ((sub1 << 16) | sub2)).
-
- When producing a relocatable object file, the calculation is
- (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2)
- When producing a fully linked file, the calculation is
- let R = (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2)
- ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */
-
- if (!info->relocatable)
- /* Shuffle the bits according to the formula above. */
- value = (((value & 0x1f0000) << 5)
- | ((value & 0x3e00000) >> 5)
- | (value & 0xffff));
- }
- else if (r_type == R_MIPS16_GPREL)
- {
- /* R_MIPS16_GPREL is used for GP-relative addressing in mips16
- mode. A typical instruction will have a format like this:
-
- +--------------+--------------------------------+
- ! EXTEND ! Imm 10:5 ! Imm 15:11 !
- +--------------+--------------------------------+
- ! Major ! rx ! ry ! Imm 4:0 !
- +--------------+--------------------------------+
-
- EXTEND is the five bit value 11110. Major is the instruction
- opcode.
-
- This is handled exactly like R_MIPS_GPREL16, except that the
- addend is retrieved and stored as shown in this diagram; that
- is, the Imm fields above replace the V-rel16 field.
-
- All we need to do here is shuffle the bits appropriately. As
- above, the two 16-bit halves must be swapped on a
- little-endian system. */
- value = (((value & 0x7e0) << 16)
- | ((value & 0xf800) << 5)
- | (value & 0x1f));
- }
-
- /* Set the field. */
- x |= (value & howto->dst_mask);
-
- /* If required, turn JAL into JALX. */
- if (require_jalx)
- {
- bfd_boolean ok;
- bfd_vma opcode = x >> 26;
- bfd_vma jalx_opcode;
-
- /* Check to see if the opcode is already JAL or JALX. */
- if (r_type == R_MIPS16_26)
- {
- ok = ((opcode == 0x6) || (opcode == 0x7));
- jalx_opcode = 0x7;
- }
- else
- {
- ok = ((opcode == 0x3) || (opcode == 0x1d));
- jalx_opcode = 0x1d;
- }
-
- /* If the opcode is not JAL or JALX, there's a problem. */
- if (!ok)
- {
- (*_bfd_error_handler)
- (_("%s: %s+0x%lx: jump to stub routine which is not jal"),
- bfd_archive_filename (input_bfd),
- input_section->name,
- (unsigned long) relocation->r_offset);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- /* Make this the JALX opcode. */
- x = (x & ~(0x3f << 26)) | (jalx_opcode << 26);
- }
-
- /* Swap the high- and low-order 16 bits on little-endian systems
- when doing a MIPS16 relocation. */
- if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26)
- && bfd_little_endian (input_bfd))
- x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16));
-
- /* Put the value into the output. */
- bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location);
- return TRUE;
-}
-
-/* Returns TRUE if SECTION is a MIPS16 stub section. */
-
-static bfd_boolean
-mips_elf_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section)
-{
- const char *name = bfd_get_section_name (abfd, section);
-
- return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0
- || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
- || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0);
-}
-
-/* Add room for N relocations to the .rel.dyn section in ABFD. */
-
-static void
-mips_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n)
-{
- asection *s;
-
- s = mips_elf_rel_dyn_section (abfd, FALSE);
- BFD_ASSERT (s != NULL);
-
- if (s->_raw_size == 0)
- {
- /* Make room for a null element. */
- s->_raw_size += MIPS_ELF_REL_SIZE (abfd);
- ++s->reloc_count;
- }
- s->_raw_size += n * MIPS_ELF_REL_SIZE (abfd);
-}
-
-/* Create a rel.dyn relocation for the dynamic linker to resolve. REL
- is the original relocation, which is now being transformed into a
- dynamic relocation. The ADDENDP is adjusted if necessary; the
- caller should store the result in place of the original addend. */
-
-static bfd_boolean
-mips_elf_create_dynamic_relocation (bfd *output_bfd,
- struct bfd_link_info *info,
- const Elf_Internal_Rela *rel,
- struct mips_elf_link_hash_entry *h,
- asection *sec, bfd_vma symbol,
- bfd_vma *addendp, asection *input_section)
-{
- Elf_Internal_Rela outrel[3];
- bfd_boolean skip;
- asection *sreloc;
- bfd *dynobj;
- int r_type;
-
- r_type = ELF_R_TYPE (output_bfd, rel->r_info);
- dynobj = elf_hash_table (info)->dynobj;
- sreloc = mips_elf_rel_dyn_section (dynobj, FALSE);
- BFD_ASSERT (sreloc != NULL);
- BFD_ASSERT (sreloc->contents != NULL);
- BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd)
- < sreloc->_raw_size);
-
- skip = FALSE;
- outrel[0].r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset);
- outrel[1].r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section, rel[1].r_offset);
- outrel[2].r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset);
-
-#if 0
- /* We begin by assuming that the offset for the dynamic relocation
- is the same as for the original relocation. We'll adjust this
- later to reflect the correct output offsets. */
- if (input_section->sec_info_type != ELF_INFO_TYPE_STABS)
- {
- outrel[1].r_offset = rel[1].r_offset;
- outrel[2].r_offset = rel[2].r_offset;
- }
- else
- {
- /* Except that in a stab section things are more complex.
- Because we compress stab information, the offset given in the
- relocation may not be the one we want; we must let the stabs
- machinery tell us the offset. */
- outrel[1].r_offset = outrel[0].r_offset;
- outrel[2].r_offset = outrel[0].r_offset;
- /* If we didn't need the relocation at all, this value will be
- -1. */
- if (outrel[0].r_offset == (bfd_vma) -1)
- skip = TRUE;
- }
-#endif
-
- if (outrel[0].r_offset == (bfd_vma) -1)
- /* The relocation field has been deleted. */
- skip = TRUE;
- else if (outrel[0].r_offset == (bfd_vma) -2)
- {
- /* The relocation field has been converted into a relative value of
- some sort. Functions like _bfd_elf_write_section_eh_frame expect
- the field to be fully relocated, so add in the symbol's value. */
- skip = TRUE;
- *addendp += symbol;
- }
-
- /* If we've decided to skip this relocation, just output an empty
- record. Note that R_MIPS_NONE == 0, so that this call to memset
- is a way of setting R_TYPE to R_MIPS_NONE. */
- if (skip)
- memset (outrel, 0, sizeof (Elf_Internal_Rela) * 3);
- else
- {
- long indx;
- bfd_boolean defined_p;
-
- /* We must now calculate the dynamic symbol table index to use
- in the relocation. */
- if (h != NULL
- && (! info->symbolic || (h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- /* h->root.dynindx may be -1 if this symbol was marked to
- become local. */
- && h->root.dynindx != -1)
- {
- indx = h->root.dynindx;
- if (SGI_COMPAT (output_bfd))
- defined_p = ((h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) != 0);
- else
- /* ??? glibc's ld.so just adds the final GOT entry to the
- relocation field. It therefore treats relocs against
- defined symbols in the same way as relocs against
- undefined symbols. */
- defined_p = FALSE;
- }
- else
- {
- if (sec != NULL && bfd_is_abs_section (sec))
- indx = 0;
- else if (sec == NULL || sec->owner == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- indx = elf_section_data (sec->output_section)->dynindx;
- if (indx == 0)
- abort ();
- }
-
- /* Instead of generating a relocation using the section
- symbol, we may as well make it a fully relative
- relocation. We want to avoid generating relocations to
- local symbols because we used to generate them
- incorrectly, without adding the original symbol value,
- which is mandated by the ABI for section symbols. In
- order to give dynamic loaders and applications time to
- phase out the incorrect use, we refrain from emitting
- section-relative relocations. It's not like they're
- useful, after all. This should be a bit more efficient
- as well. */
- /* ??? Although this behavior is compatible with glibc's ld.so,
- the ABI says that relocations against STN_UNDEF should have
- a symbol value of 0. Irix rld honors this, so relocations
- against STN_UNDEF have no effect. */
- if (!SGI_COMPAT (output_bfd))
- indx = 0;
- defined_p = TRUE;
- }
-
- /* If the relocation was previously an absolute relocation and
- this symbol will not be referred to by the relocation, we must
- adjust it by the value we give it in the dynamic symbol table.
- Otherwise leave the job up to the dynamic linker. */
- if (defined_p && r_type != R_MIPS_REL32)
- *addendp += symbol;
-
- /* The relocation is always an REL32 relocation because we don't
- know where the shared library will wind up at load-time. */
- outrel[0].r_info = ELF_R_INFO (output_bfd, (unsigned long) indx,
- R_MIPS_REL32);
- /* For strict adherence to the ABI specification, we should
- generate a R_MIPS_64 relocation record by itself before the
- _REL32/_64 record as well, such that the addend is read in as
- a 64-bit value (REL32 is a 32-bit relocation, after all).
- However, since none of the existing ELF64 MIPS dynamic
- loaders seems to care, we don't waste space with these
- artificial relocations. If this turns out to not be true,
- mips_elf_allocate_dynamic_relocation() should be tweaked so
- as to make room for a pair of dynamic relocations per
- invocation if ABI_64_P, and here we should generate an
- additional relocation record with R_MIPS_64 by itself for a
- NULL symbol before this relocation record. */
- outrel[1].r_info = ELF_R_INFO (output_bfd, 0,
- ABI_64_P (output_bfd)
- ? R_MIPS_64
- : R_MIPS_NONE);
- outrel[2].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_NONE);
-
- /* Adjust the output offset of the relocation to reference the
- correct location in the output file. */
- outrel[0].r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- outrel[1].r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- outrel[2].r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- }
-
- /* Put the relocation back out. We have to use the special
- relocation outputter in the 64-bit case since the 64-bit
- relocation format is non-standard. */
- if (ABI_64_P (output_bfd))
- {
- (*get_elf_backend_data (output_bfd)->s->swap_reloc_out)
- (output_bfd, &outrel[0],
- (sreloc->contents
- + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
- }
- else
- bfd_elf32_swap_reloc_out
- (output_bfd, &outrel[0],
- (sreloc->contents + sreloc->reloc_count * sizeof (Elf32_External_Rel)));
-
- /* We've now added another relocation. */
- ++sreloc->reloc_count;
-
- /* Make sure the output section is writable. The dynamic linker
- will be writing to it. */
- elf_section_data (input_section->output_section)->this_hdr.sh_flags
- |= SHF_WRITE;
-
- /* On IRIX5, make an entry of compact relocation info. */
- if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5)
- {
- asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
- bfd_byte *cr;
-
- if (scpt)
- {
- Elf32_crinfo cptrel;
-
- mips_elf_set_cr_format (cptrel, CRF_MIPS_LONG);
- cptrel.vaddr = (rel->r_offset
- + input_section->output_section->vma
- + input_section->output_offset);
- if (r_type == R_MIPS_REL32)
- mips_elf_set_cr_type (cptrel, CRT_MIPS_REL32);
- else
- mips_elf_set_cr_type (cptrel, CRT_MIPS_WORD);
- mips_elf_set_cr_dist2to (cptrel, 0);
- cptrel.konst = *addendp;
-
- cr = (scpt->contents
- + sizeof (Elf32_External_compact_rel));
- bfd_elf32_swap_crinfo_out (output_bfd, &cptrel,
- ((Elf32_External_crinfo *) cr
- + scpt->reloc_count));
- ++scpt->reloc_count;
- }
- }
-
- return TRUE;
-}
-
-/* Return the MACH for a MIPS e_flags value. */
-
-unsigned long
-_bfd_elf_mips_mach (flagword flags)
-{
- switch (flags & EF_MIPS_MACH)
- {
- case E_MIPS_MACH_3900:
- return bfd_mach_mips3900;
-
- case E_MIPS_MACH_4010:
- return bfd_mach_mips4010;
-
- case E_MIPS_MACH_4100:
- return bfd_mach_mips4100;
-
- case E_MIPS_MACH_4111:
- return bfd_mach_mips4111;
-
- case E_MIPS_MACH_4120:
- return bfd_mach_mips4120;
-
- case E_MIPS_MACH_4650:
- return bfd_mach_mips4650;
-
- case E_MIPS_MACH_5400:
- return bfd_mach_mips5400;
-
- case E_MIPS_MACH_5500:
- return bfd_mach_mips5500;
-
- case E_MIPS_MACH_SB1:
- return bfd_mach_mips_sb1;
-
- default:
- switch (flags & EF_MIPS_ARCH)
- {
- default:
- case E_MIPS_ARCH_1:
- return bfd_mach_mips3000;
- break;
-
- case E_MIPS_ARCH_2:
- return bfd_mach_mips6000;
- break;
-
- case E_MIPS_ARCH_3:
- return bfd_mach_mips4000;
- break;
-
- case E_MIPS_ARCH_4:
- return bfd_mach_mips8000;
- break;
-
- case E_MIPS_ARCH_5:
- return bfd_mach_mips5;
- break;
-
- case E_MIPS_ARCH_32:
- return bfd_mach_mipsisa32;
- break;
-
- case E_MIPS_ARCH_64:
- return bfd_mach_mipsisa64;
- break;
-
- case E_MIPS_ARCH_32R2:
- return bfd_mach_mipsisa32r2;
- break;
-
- case E_MIPS_ARCH_64R2:
- return bfd_mach_mipsisa64r2;
- break;
- }
- }
-
- return 0;
-}
-
-/* Return printable name for ABI. */
-
-static INLINE char *
-elf_mips_abi_name (bfd *abfd)
-{
- flagword flags;
-
- flags = elf_elfheader (abfd)->e_flags;
- switch (flags & EF_MIPS_ABI)
- {
- case 0:
- if (ABI_N32_P (abfd))
- return "N32";
- else if (ABI_64_P (abfd))
- return "64";
- else
- return "none";
- case E_MIPS_ABI_O32:
- return "O32";
- case E_MIPS_ABI_O64:
- return "O64";
- case E_MIPS_ABI_EABI32:
- return "EABI32";
- case E_MIPS_ABI_EABI64:
- return "EABI64";
- default:
- return "unknown abi";
- }
-}
-
-/* MIPS ELF uses two common sections. One is the usual one, and the
- other is for small objects. All the small objects are kept
- together, and then referenced via the gp pointer, which yields
- faster assembler code. This is what we use for the small common
- section. This approach is copied from ecoff.c. */
-static asection mips_elf_scom_section;
-static asymbol mips_elf_scom_symbol;
-static asymbol *mips_elf_scom_symbol_ptr;
-
-/* MIPS ELF also uses an acommon section, which represents an
- allocated common symbol which may be overridden by a
- definition in a shared library. */
-static asection mips_elf_acom_section;
-static asymbol mips_elf_acom_symbol;
-static asymbol *mips_elf_acom_symbol_ptr;
-
-/* Handle the special MIPS section numbers that a symbol may use.
- This is used for both the 32-bit and the 64-bit ABI. */
-
-void
-_bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym)
-{
- elf_symbol_type *elfsym;
-
- elfsym = (elf_symbol_type *) asym;
- switch (elfsym->internal_elf_sym.st_shndx)
- {
- case SHN_MIPS_ACOMMON:
- /* This section is used in a dynamically linked executable file.
- It is an allocated common section. The dynamic linker can
- either resolve these symbols to something in a shared
- library, or it can just leave them here. For our purposes,
- we can consider these symbols to be in a new section. */
- if (mips_elf_acom_section.name == NULL)
- {
- /* Initialize the acommon section. */
- mips_elf_acom_section.name = ".acommon";
- mips_elf_acom_section.flags = SEC_ALLOC;
- mips_elf_acom_section.output_section = &mips_elf_acom_section;
- mips_elf_acom_section.symbol = &mips_elf_acom_symbol;
- mips_elf_acom_section.symbol_ptr_ptr = &mips_elf_acom_symbol_ptr;
- mips_elf_acom_symbol.name = ".acommon";
- mips_elf_acom_symbol.flags = BSF_SECTION_SYM;
- mips_elf_acom_symbol.section = &mips_elf_acom_section;
- mips_elf_acom_symbol_ptr = &mips_elf_acom_symbol;
- }
- asym->section = &mips_elf_acom_section;
- break;
-
- case SHN_COMMON:
- /* Common symbols less than the GP size are automatically
- treated as SHN_MIPS_SCOMMON symbols on IRIX5. */
- if (asym->value > elf_gp_size (abfd)
- || IRIX_COMPAT (abfd) == ict_irix6)
- break;
- /* Fall through. */
- case SHN_MIPS_SCOMMON:
- if (mips_elf_scom_section.name == NULL)
- {
- /* Initialize the small common section. */
- mips_elf_scom_section.name = ".scommon";
- mips_elf_scom_section.flags = SEC_IS_COMMON;
- mips_elf_scom_section.output_section = &mips_elf_scom_section;
- mips_elf_scom_section.symbol = &mips_elf_scom_symbol;
- mips_elf_scom_section.symbol_ptr_ptr = &mips_elf_scom_symbol_ptr;
- mips_elf_scom_symbol.name = ".scommon";
- mips_elf_scom_symbol.flags = BSF_SECTION_SYM;
- mips_elf_scom_symbol.section = &mips_elf_scom_section;
- mips_elf_scom_symbol_ptr = &mips_elf_scom_symbol;
- }
- asym->section = &mips_elf_scom_section;
- asym->value = elfsym->internal_elf_sym.st_size;
- break;
-
- case SHN_MIPS_SUNDEFINED:
- asym->section = bfd_und_section_ptr;
- break;
-
-#if 0 /* for SGI_COMPAT */
- case SHN_MIPS_TEXT:
- asym->section = mips_elf_text_section_ptr;
- break;
-
- case SHN_MIPS_DATA:
- asym->section = mips_elf_data_section_ptr;
- break;
-#endif
- }
-}
-
-/* There appears to be a bug in the MIPSpro linker that causes GOT_DISP
- relocations against two unnamed section symbols to resolve to the
- same address. For example, if we have code like:
-
- lw $4,%got_disp(.data)($gp)
- lw $25,%got_disp(.text)($gp)
- jalr $25
-
- then the linker will resolve both relocations to .data and the program
- will jump there rather than to .text.
-
- We can work around this problem by giving names to local section symbols.
- This is also what the MIPSpro tools do. */
-
-bfd_boolean
-_bfd_mips_elf_name_local_section_symbols (bfd *abfd)
-{
- return SGI_COMPAT (abfd);
-}
-
-/* Work over a section just before writing it out. This routine is
- used by both the 32-bit and the 64-bit ABI. FIXME: We recognize
- sections that need the SHF_MIPS_GPREL flag by name; there has to be
- a better way. */
-
-bfd_boolean
-_bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
-{
- if (hdr->sh_type == SHT_MIPS_REGINFO
- && hdr->sh_size > 0)
- {
- bfd_byte buf[4];
-
- BFD_ASSERT (hdr->sh_size == sizeof (Elf32_External_RegInfo));
- BFD_ASSERT (hdr->contents == NULL);
-
- if (bfd_seek (abfd,
- hdr->sh_offset + sizeof (Elf32_External_RegInfo) - 4,
- SEEK_SET) != 0)
- return FALSE;
- H_PUT_32 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, 4, abfd) != 4)
- return FALSE;
- }
-
- if (hdr->sh_type == SHT_MIPS_OPTIONS
- && hdr->bfd_section != NULL
- && mips_elf_section_data (hdr->bfd_section) != NULL
- && mips_elf_section_data (hdr->bfd_section)->u.tdata != NULL)
- {
- bfd_byte *contents, *l, *lend;
-
- /* We stored the section contents in the tdata field in the
- set_section_contents routine. We save the section contents
- so that we don't have to read them again.
- At this point we know that elf_gp is set, so we can look
- through the section contents to see if there is an
- ODK_REGINFO structure. */
-
- contents = mips_elf_section_data (hdr->bfd_section)->u.tdata;
- l = contents;
- lend = contents + hdr->sh_size;
- while (l + sizeof (Elf_External_Options) <= lend)
- {
- Elf_Internal_Options intopt;
-
- bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
- &intopt);
- if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
- {
- bfd_byte buf[8];
-
- if (bfd_seek (abfd,
- (hdr->sh_offset
- + (l - contents)
- + sizeof (Elf_External_Options)
- + (sizeof (Elf64_External_RegInfo) - 8)),
- SEEK_SET) != 0)
- return FALSE;
- H_PUT_64 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, 8, abfd) != 8)
- return FALSE;
- }
- else if (intopt.kind == ODK_REGINFO)
- {
- bfd_byte buf[4];
-
- if (bfd_seek (abfd,
- (hdr->sh_offset
- + (l - contents)
- + sizeof (Elf_External_Options)
- + (sizeof (Elf32_External_RegInfo) - 4)),
- SEEK_SET) != 0)
- return FALSE;
- H_PUT_32 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, 4, abfd) != 4)
- return FALSE;
- }
- l += intopt.size;
- }
- }
-
- if (hdr->bfd_section != NULL)
- {
- const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
-
- if (strcmp (name, ".sdata") == 0
- || strcmp (name, ".lit8") == 0
- || strcmp (name, ".lit4") == 0)
- {
- hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
- hdr->sh_type = SHT_PROGBITS;
- }
- else if (strcmp (name, ".sbss") == 0)
- {
- hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
- hdr->sh_type = SHT_NOBITS;
- }
- else if (strcmp (name, ".srdata") == 0)
- {
- hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL;
- hdr->sh_type = SHT_PROGBITS;
- }
- else if (strcmp (name, ".compact_rel") == 0)
- {
- hdr->sh_flags = 0;
- hdr->sh_type = SHT_PROGBITS;
- }
- else if (strcmp (name, ".rtproc") == 0)
- {
- if (hdr->sh_addralign != 0 && hdr->sh_entsize == 0)
- {
- unsigned int adjust;
-
- adjust = hdr->sh_size % hdr->sh_addralign;
- if (adjust != 0)
- hdr->sh_size += hdr->sh_addralign - adjust;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Handle a MIPS specific section when reading an object file. This
- is called when elfcode.h finds a section with an unknown type.
- This routine supports both the 32-bit and 64-bit ELF ABI.
-
- FIXME: We need to handle the SHF_MIPS_GPREL flag, but I'm not sure
- how to. */
-
-bfd_boolean
-_bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
- const char *name)
-{
- flagword flags = 0;
-
- /* There ought to be a place to keep ELF backend specific flags, but
- at the moment there isn't one. We just keep track of the
- sections by their name, instead. Fortunately, the ABI gives
- suggested names for all the MIPS specific sections, so we will
- probably get away with this. */
- switch (hdr->sh_type)
- {
- case SHT_MIPS_LIBLIST:
- if (strcmp (name, ".liblist") != 0)
- return FALSE;
- break;
- case SHT_MIPS_MSYM:
- if (strcmp (name, ".msym") != 0)
- return FALSE;
- break;
- case SHT_MIPS_CONFLICT:
- if (strcmp (name, ".conflict") != 0)
- return FALSE;
- break;
- case SHT_MIPS_GPTAB:
- if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0)
- return FALSE;
- break;
- case SHT_MIPS_UCODE:
- if (strcmp (name, ".ucode") != 0)
- return FALSE;
- break;
- case SHT_MIPS_DEBUG:
- if (strcmp (name, ".mdebug") != 0)
- return FALSE;
- flags = SEC_DEBUGGING;
- break;
- case SHT_MIPS_REGINFO:
- if (strcmp (name, ".reginfo") != 0
- || hdr->sh_size != sizeof (Elf32_External_RegInfo))
- return FALSE;
- flags = (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_SIZE);
- break;
- case SHT_MIPS_IFACE:
- if (strcmp (name, ".MIPS.interfaces") != 0)
- return FALSE;
- break;
- case SHT_MIPS_CONTENT:
- if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0)
- return FALSE;
- break;
- case SHT_MIPS_OPTIONS:
- if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) != 0)
- return FALSE;
- break;
- case SHT_MIPS_DWARF:
- if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0)
- return FALSE;
- break;
- case SHT_MIPS_SYMBOL_LIB:
- if (strcmp (name, ".MIPS.symlib") != 0)
- return FALSE;
- break;
- case SHT_MIPS_EVENTS:
- if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0
- && strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) != 0)
- return FALSE;
- break;
- default:
- return FALSE;
- }
-
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return FALSE;
-
- if (flags)
- {
- if (! bfd_set_section_flags (abfd, hdr->bfd_section,
- (bfd_get_section_flags (abfd,
- hdr->bfd_section)
- | flags)))
- return FALSE;
- }
-
- /* FIXME: We should record sh_info for a .gptab section. */
-
- /* For a .reginfo section, set the gp value in the tdata information
- from the contents of this section. We need the gp value while
- processing relocs, so we just get it now. The .reginfo section
- is not used in the 64-bit MIPS ELF ABI. */
- if (hdr->sh_type == SHT_MIPS_REGINFO)
- {
- Elf32_External_RegInfo ext;
- Elf32_RegInfo s;
-
- if (! bfd_get_section_contents (abfd, hdr->bfd_section,
- &ext, 0, sizeof ext))
- return FALSE;
- bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s);
- elf_gp (abfd) = s.ri_gp_value;
- }
-
- /* For a SHT_MIPS_OPTIONS section, look for a ODK_REGINFO entry, and
- set the gp value based on what we find. We may see both
- SHT_MIPS_REGINFO and SHT_MIPS_OPTIONS/ODK_REGINFO; in that case,
- they should agree. */
- if (hdr->sh_type == SHT_MIPS_OPTIONS)
- {
- bfd_byte *contents, *l, *lend;
-
- contents = bfd_malloc (hdr->sh_size);
- if (contents == NULL)
- return FALSE;
- if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents,
- 0, hdr->sh_size))
- {
- free (contents);
- return FALSE;
- }
- l = contents;
- lend = contents + hdr->sh_size;
- while (l + sizeof (Elf_External_Options) <= lend)
- {
- Elf_Internal_Options intopt;
-
- bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
- &intopt);
- if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
- {
- Elf64_Internal_RegInfo intreg;
-
- bfd_mips_elf64_swap_reginfo_in
- (abfd,
- ((Elf64_External_RegInfo *)
- (l + sizeof (Elf_External_Options))),
- &intreg);
- elf_gp (abfd) = intreg.ri_gp_value;
- }
- else if (intopt.kind == ODK_REGINFO)
- {
- Elf32_RegInfo intreg;
-
- bfd_mips_elf32_swap_reginfo_in
- (abfd,
- ((Elf32_External_RegInfo *)
- (l + sizeof (Elf_External_Options))),
- &intreg);
- elf_gp (abfd) = intreg.ri_gp_value;
- }
- l += intopt.size;
- }
- free (contents);
- }
-
- return TRUE;
-}
-
-/* Set the correct type for a MIPS ELF section. We do this by the
- section name, which is a hack, but ought to work. This routine is
- used by both the 32-bit and the 64-bit ABI. */
-
-bfd_boolean
-_bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
-{
- register const char *name;
-
- name = bfd_get_section_name (abfd, sec);
-
- if (strcmp (name, ".liblist") == 0)
- {
- hdr->sh_type = SHT_MIPS_LIBLIST;
- hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib);
- /* The sh_link field is set in final_write_processing. */
- }
- else if (strcmp (name, ".conflict") == 0)
- hdr->sh_type = SHT_MIPS_CONFLICT;
- else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0)
- {
- hdr->sh_type = SHT_MIPS_GPTAB;
- hdr->sh_entsize = sizeof (Elf32_External_gptab);
- /* The sh_info field is set in final_write_processing. */
- }
- else if (strcmp (name, ".ucode") == 0)
- hdr->sh_type = SHT_MIPS_UCODE;
- else if (strcmp (name, ".mdebug") == 0)
- {
- hdr->sh_type = SHT_MIPS_DEBUG;
- /* In a shared object on IRIX 5.3, the .mdebug section has an
- entsize of 0. FIXME: Does this matter? */
- if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0)
- hdr->sh_entsize = 0;
- else
- hdr->sh_entsize = 1;
- }
- else if (strcmp (name, ".reginfo") == 0)
- {
- hdr->sh_type = SHT_MIPS_REGINFO;
- /* In a shared object on IRIX 5.3, the .reginfo section has an
- entsize of 0x18. FIXME: Does this matter? */
- if (SGI_COMPAT (abfd))
- {
- if ((abfd->flags & DYNAMIC) != 0)
- hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
- else
- hdr->sh_entsize = 1;
- }
- else
- hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
- }
- else if (SGI_COMPAT (abfd)
- && (strcmp (name, ".hash") == 0
- || strcmp (name, ".dynamic") == 0
- || strcmp (name, ".dynstr") == 0))
- {
- if (SGI_COMPAT (abfd))
- hdr->sh_entsize = 0;
-#if 0
- /* This isn't how the IRIX6 linker behaves. */
- hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES;
-#endif
- }
- else if (strcmp (name, ".got") == 0
- || strcmp (name, ".srdata") == 0
- || strcmp (name, ".sdata") == 0
- || strcmp (name, ".sbss") == 0
- || strcmp (name, ".lit4") == 0
- || strcmp (name, ".lit8") == 0)
- hdr->sh_flags |= SHF_MIPS_GPREL;
- else if (strcmp (name, ".MIPS.interfaces") == 0)
- {
- hdr->sh_type = SHT_MIPS_IFACE;
- hdr->sh_flags |= SHF_MIPS_NOSTRIP;
- }
- else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0)
- {
- hdr->sh_type = SHT_MIPS_CONTENT;
- hdr->sh_flags |= SHF_MIPS_NOSTRIP;
- /* The sh_info field is set in final_write_processing. */
- }
- else if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0)
- {
- hdr->sh_type = SHT_MIPS_OPTIONS;
- hdr->sh_entsize = 1;
- hdr->sh_flags |= SHF_MIPS_NOSTRIP;
- }
- else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0)
- hdr->sh_type = SHT_MIPS_DWARF;
- else if (strcmp (name, ".MIPS.symlib") == 0)
- {
- hdr->sh_type = SHT_MIPS_SYMBOL_LIB;
- /* The sh_link and sh_info fields are set in
- final_write_processing. */
- }
- else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0
- || strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) == 0)
- {
- hdr->sh_type = SHT_MIPS_EVENTS;
- hdr->sh_flags |= SHF_MIPS_NOSTRIP;
- /* The sh_link field is set in final_write_processing. */
- }
- else if (strcmp (name, ".msym") == 0)
- {
- hdr->sh_type = SHT_MIPS_MSYM;
- hdr->sh_flags |= SHF_ALLOC;
- hdr->sh_entsize = 8;
- }
-
- /* The generic elf_fake_sections will set up REL_HDR using the default
- kind of relocations. We used to set up a second header for the
- non-default kind of relocations here, but only NewABI would use
- these, and the IRIX ld doesn't like resulting empty RELA sections.
- Thus we create those header only on demand now. */
-
- return TRUE;
-}
-
-/* Given a BFD section, try to locate the corresponding ELF section
- index. This is used by both the 32-bit and the 64-bit ABI.
- Actually, it's not clear to me that the 64-bit ABI supports these,
- but for non-PIC objects we will certainly want support for at least
- the .scommon section. */
-
-bfd_boolean
-_bfd_mips_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec, int *retval)
-{
- if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0)
- {
- *retval = SHN_MIPS_SCOMMON;
- return TRUE;
- }
- if (strcmp (bfd_get_section_name (abfd, sec), ".acommon") == 0)
- {
- *retval = SHN_MIPS_ACOMMON;
- return TRUE;
- }
- return FALSE;
-}
-
-/* Hook called by the linker routine which adds symbols from an object
- file. We must handle the special MIPS section numbers here. */
-
-bfd_boolean
-_bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
- Elf_Internal_Sym *sym, const char **namep,
- flagword *flagsp ATTRIBUTE_UNUSED,
- asection **secp, bfd_vma *valp)
-{
- if (SGI_COMPAT (abfd)
- && (abfd->flags & DYNAMIC) != 0
- && strcmp (*namep, "_rld_new_interface") == 0)
- {
- /* Skip IRIX5 rld entry name. */
- *namep = NULL;
- return TRUE;
- }
-
- switch (sym->st_shndx)
- {
- case SHN_COMMON:
- /* Common symbols less than the GP size are automatically
- treated as SHN_MIPS_SCOMMON symbols. */
- if (sym->st_size > elf_gp_size (abfd)
- || IRIX_COMPAT (abfd) == ict_irix6)
- break;
- /* Fall through. */
- case SHN_MIPS_SCOMMON:
- *secp = bfd_make_section_old_way (abfd, ".scommon");
- (*secp)->flags |= SEC_IS_COMMON;
- *valp = sym->st_size;
- break;
-
- case SHN_MIPS_TEXT:
- /* This section is used in a shared object. */
- if (elf_tdata (abfd)->elf_text_section == NULL)
- {
- asymbol *elf_text_symbol;
- asection *elf_text_section;
- bfd_size_type amt = sizeof (asection);
-
- elf_text_section = bfd_zalloc (abfd, amt);
- if (elf_text_section == NULL)
- return FALSE;
-
- amt = sizeof (asymbol);
- elf_text_symbol = bfd_zalloc (abfd, amt);
- if (elf_text_symbol == NULL)
- return FALSE;
-
- /* Initialize the section. */
-
- elf_tdata (abfd)->elf_text_section = elf_text_section;
- elf_tdata (abfd)->elf_text_symbol = elf_text_symbol;
-
- elf_text_section->symbol = elf_text_symbol;
- elf_text_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_text_symbol;
-
- elf_text_section->name = ".text";
- elf_text_section->flags = SEC_NO_FLAGS;
- elf_text_section->output_section = NULL;
- elf_text_section->owner = abfd;
- elf_text_symbol->name = ".text";
- elf_text_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
- elf_text_symbol->section = elf_text_section;
- }
- /* This code used to do *secp = bfd_und_section_ptr if
- info->shared. I don't know why, and that doesn't make sense,
- so I took it out. */
- *secp = elf_tdata (abfd)->elf_text_section;
- break;
-
- case SHN_MIPS_ACOMMON:
- /* Fall through. XXX Can we treat this as allocated data? */
- case SHN_MIPS_DATA:
- /* This section is used in a shared object. */
- if (elf_tdata (abfd)->elf_data_section == NULL)
- {
- asymbol *elf_data_symbol;
- asection *elf_data_section;
- bfd_size_type amt = sizeof (asection);
-
- elf_data_section = bfd_zalloc (abfd, amt);
- if (elf_data_section == NULL)
- return FALSE;
-
- amt = sizeof (asymbol);
- elf_data_symbol = bfd_zalloc (abfd, amt);
- if (elf_data_symbol == NULL)
- return FALSE;
-
- /* Initialize the section. */
-
- elf_tdata (abfd)->elf_data_section = elf_data_section;
- elf_tdata (abfd)->elf_data_symbol = elf_data_symbol;
-
- elf_data_section->symbol = elf_data_symbol;
- elf_data_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_data_symbol;
-
- elf_data_section->name = ".data";
- elf_data_section->flags = SEC_NO_FLAGS;
- elf_data_section->output_section = NULL;
- elf_data_section->owner = abfd;
- elf_data_symbol->name = ".data";
- elf_data_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
- elf_data_symbol->section = elf_data_section;
- }
- /* This code used to do *secp = bfd_und_section_ptr if
- info->shared. I don't know why, and that doesn't make sense,
- so I took it out. */
- *secp = elf_tdata (abfd)->elf_data_section;
- break;
-
- case SHN_MIPS_SUNDEFINED:
- *secp = bfd_und_section_ptr;
- break;
- }
-
- if (SGI_COMPAT (abfd)
- && ! info->shared
- && info->hash->creator == abfd->xvec
- && strcmp (*namep, "__rld_obj_head") == 0)
- {
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
-
- /* Mark __rld_obj_head as dynamic. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, *namep, BSF_GLOBAL, *secp, *valp, NULL, FALSE,
- get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
-
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- mips_elf_hash_table (info)->use_rld_obj_head = TRUE;
- }
-
- /* If this is a mips16 text symbol, add 1 to the value to make it
- odd. This will cause something like .word SYM to come up with
- the right value when it is loaded into the PC. */
- if (sym->st_other == STO_MIPS16)
- ++*valp;
-
- return TRUE;
-}
-
-/* This hook function is called before the linker writes out a global
- symbol. We mark symbols as small common if appropriate. This is
- also where we undo the increment of the value for a mips16 symbol. */
-
-bfd_boolean
-_bfd_mips_elf_link_output_symbol_hook
- (struct bfd_link_info *info ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym,
- asection *input_sec, struct elf_link_hash_entry *h ATTRIBUTE_UNUSED)
-{
- /* If we see a common symbol, which implies a relocatable link, then
- if a symbol was small common in an input file, mark it as small
- common in the output file. */
- if (sym->st_shndx == SHN_COMMON
- && strcmp (input_sec->name, ".scommon") == 0)
- sym->st_shndx = SHN_MIPS_SCOMMON;
-
- if (sym->st_other == STO_MIPS16
- && (sym->st_value & 1) != 0)
- --sym->st_value;
-
- return TRUE;
-}
-
-/* Functions for the dynamic linker. */
-
-/* Create dynamic sections when linking against a dynamic object. */
-
-bfd_boolean
-_bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
-{
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
- flagword flags;
- register asection *s;
- const char * const *namep;
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED | SEC_READONLY);
-
- /* Mips ABI requests the .dynamic section to be read only. */
- s = bfd_get_section_by_name (abfd, ".dynamic");
- if (s != NULL)
- {
- if (! bfd_set_section_flags (abfd, s, flags))
- return FALSE;
- }
-
- /* We need to create .got section. */
- if (! mips_elf_create_got_section (abfd, info, FALSE))
- return FALSE;
-
- if (! mips_elf_rel_dyn_section (elf_hash_table (info)->dynobj, TRUE))
- return FALSE;
-
- /* Create .stub section. */
- if (bfd_get_section_by_name (abfd,
- MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL)
- {
- s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd));
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
- || ! bfd_set_section_alignment (abfd, s,
- MIPS_ELF_LOG_FILE_ALIGN (abfd)))
- return FALSE;
- }
-
- if ((IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none)
- && !info->shared
- && bfd_get_section_by_name (abfd, ".rld_map") == NULL)
- {
- s = bfd_make_section (abfd, ".rld_map");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags &~ (flagword) SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s,
- MIPS_ELF_LOG_FILE_ALIGN (abfd)))
- return FALSE;
- }
-
- /* On IRIX5, we adjust add some additional symbols and change the
- alignments of several sections. There is no ABI documentation
- indicating that this is necessary on IRIX6, nor any evidence that
- the linker takes such action. */
- if (IRIX_COMPAT (abfd) == ict_irix5)
- {
- for (namep = mips_elf_dynsym_rtproc_names; *namep != NULL; namep++)
- {
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, 0,
- NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
-
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_SECTION;
-
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
-
- /* We need to create a .compact_rel section. */
- if (SGI_COMPAT (abfd))
- {
- if (!mips_elf_create_compact_rel_section (abfd, info))
- return FALSE;
- }
-
- /* Change alignments of some sections. */
- s = bfd_get_section_by_name (abfd, ".hash");
- if (s != NULL)
- bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
- s = bfd_get_section_by_name (abfd, ".dynsym");
- if (s != NULL)
- bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
- s = bfd_get_section_by_name (abfd, ".dynstr");
- if (s != NULL)
- bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
- s = bfd_get_section_by_name (abfd, ".reginfo");
- if (s != NULL)
- bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
- s = bfd_get_section_by_name (abfd, ".dynamic");
- if (s != NULL)
- bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
- }
-
- if (!info->shared)
- {
- const char *name;
-
- name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING";
- bh = NULL;
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0,
- NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
-
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_SECTION;
-
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
- if (! mips_elf_hash_table (info)->use_rld_obj_head)
- {
- /* __rld_map is a four byte word located in the .data section
- and is filled in by the rtld to contain a pointer to
- the _r_debug structure. Its symbol value will be set in
- _bfd_mips_elf_finish_dynamic_symbol. */
- s = bfd_get_section_by_name (abfd, ".rld_map");
- BFD_ASSERT (s != NULL);
-
- name = SGI_COMPAT (abfd) ? "__rld_map" : "__RLD_MAP";
- bh = NULL;
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, name, BSF_GLOBAL, s, 0, NULL, FALSE,
- get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
-
- h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
-
- if (! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table. */
-
-bfd_boolean
-_bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
- asection *sec, const Elf_Internal_Rela *relocs)
-{
- const char *name;
- bfd *dynobj;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- struct mips_got_info *g;
- size_t extsymoff;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- asection *sgot;
- asection *sreloc;
- const struct elf_backend_data *bed;
-
- if (info->relocatable)
- return TRUE;
-
- dynobj = elf_hash_table (info)->dynobj;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info;
-
- /* Check for the mips16 stub sections. */
-
- name = bfd_get_section_name (abfd, sec);
- if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0)
- {
- unsigned long r_symndx;
-
- /* Look at the relocation information to figure out which symbol
- this is for. */
-
- r_symndx = ELF_R_SYM (abfd, relocs->r_info);
-
- if (r_symndx < extsymoff
- || sym_hashes[r_symndx - extsymoff] == NULL)
- {
- asection *o;
-
- /* This stub is for a local symbol. This stub will only be
- needed if there is some relocation in this BFD, other
- than a 16 bit function call, which refers to this symbol. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- Elf_Internal_Rela *sec_relocs;
- const Elf_Internal_Rela *r, *rend;
-
- /* We can ignore stub sections when looking for relocs. */
- if ((o->flags & SEC_RELOC) == 0
- || o->reloc_count == 0
- || strncmp (bfd_get_section_name (abfd, o), FN_STUB,
- sizeof FN_STUB - 1) == 0
- || strncmp (bfd_get_section_name (abfd, o), CALL_STUB,
- sizeof CALL_STUB - 1) == 0
- || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB,
- sizeof CALL_FP_STUB - 1) == 0)
- continue;
-
- sec_relocs
- = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL,
- info->keep_memory);
- if (sec_relocs == NULL)
- return FALSE;
-
- rend = sec_relocs + o->reloc_count;
- for (r = sec_relocs; r < rend; r++)
- if (ELF_R_SYM (abfd, r->r_info) == r_symndx
- && ELF_R_TYPE (abfd, r->r_info) != R_MIPS16_26)
- break;
-
- if (elf_section_data (o)->relocs != sec_relocs)
- free (sec_relocs);
-
- if (r < rend)
- break;
- }
-
- if (o == NULL)
- {
- /* There is no non-call reloc for this stub, so we do
- not need it. Since this function is called before
- the linker maps input sections to output sections, we
- can easily discard it by setting the SEC_EXCLUDE
- flag. */
- sec->flags |= SEC_EXCLUDE;
- return TRUE;
- }
-
- /* Record this stub in an array of local symbol stubs for
- this BFD. */
- if (elf_tdata (abfd)->local_stubs == NULL)
- {
- unsigned long symcount;
- asection **n;
- bfd_size_type amt;
-
- if (elf_bad_symtab (abfd))
- symcount = NUM_SHDR_ENTRIES (symtab_hdr);
- else
- symcount = symtab_hdr->sh_info;
- amt = symcount * sizeof (asection *);
- n = bfd_zalloc (abfd, amt);
- if (n == NULL)
- return FALSE;
- elf_tdata (abfd)->local_stubs = n;
- }
-
- elf_tdata (abfd)->local_stubs[r_symndx] = sec;
-
- /* We don't need to set mips16_stubs_seen in this case.
- That flag is used to see whether we need to look through
- the global symbol table for stubs. We don't need to set
- it here, because we just have a local stub. */
- }
- else
- {
- struct mips_elf_link_hash_entry *h;
-
- h = ((struct mips_elf_link_hash_entry *)
- sym_hashes[r_symndx - extsymoff]);
-
- /* H is the symbol this stub is for. */
-
- h->fn_stub = sec;
- mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
- }
- }
- else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
- || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
- {
- unsigned long r_symndx;
- struct mips_elf_link_hash_entry *h;
- asection **loc;
-
- /* Look at the relocation information to figure out which symbol
- this is for. */
-
- r_symndx = ELF_R_SYM (abfd, relocs->r_info);
-
- if (r_symndx < extsymoff
- || sym_hashes[r_symndx - extsymoff] == NULL)
- {
- /* This stub was actually built for a static symbol defined
- in the same file. We assume that all static symbols in
- mips16 code are themselves mips16, so we can simply
- discard this stub. Since this function is called before
- the linker maps input sections to output sections, we can
- easily discard it by setting the SEC_EXCLUDE flag. */
- sec->flags |= SEC_EXCLUDE;
- return TRUE;
- }
-
- h = ((struct mips_elf_link_hash_entry *)
- sym_hashes[r_symndx - extsymoff]);
-
- /* H is the symbol this stub is for. */
-
- if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
- loc = &h->call_fp_stub;
- else
- loc = &h->call_stub;
-
- /* If we already have an appropriate stub for this function, we
- don't need another one, so we can discard this one. Since
- this function is called before the linker maps input sections
- to output sections, we can easily discard it by setting the
- SEC_EXCLUDE flag. We can also discard this section if we
- happen to already know that this is a mips16 function; it is
- not necessary to check this here, as it is checked later, but
- it is slightly faster to check now. */
- if (*loc != NULL || h->root.other == STO_MIPS16)
- {
- sec->flags |= SEC_EXCLUDE;
- return TRUE;
- }
-
- *loc = sec;
- mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
- }
-
- if (dynobj == NULL)
- {
- sgot = NULL;
- g = NULL;
- }
- else
- {
- sgot = mips_elf_got_section (dynobj, FALSE);
- if (sgot == NULL)
- g = NULL;
- else
- {
- BFD_ASSERT (mips_elf_section_data (sgot) != NULL);
- g = mips_elf_section_data (sgot)->u.got_info;
- BFD_ASSERT (g != NULL);
- }
- }
-
- sreloc = NULL;
- bed = get_elf_backend_data (abfd);
- rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel;
- for (rel = relocs; rel < rel_end; ++rel)
- {
- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h;
-
- r_symndx = ELF_R_SYM (abfd, rel->r_info);
- r_type = ELF_R_TYPE (abfd, rel->r_info);
-
- if (r_symndx < extsymoff)
- h = NULL;
- else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler)
- (_("%s: Malformed reloc detected for section %s"),
- bfd_archive_filename (abfd), name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- else
- {
- h = sym_hashes[r_symndx - extsymoff];
-
- /* This may be an indirect symbol created because of a version. */
- if (h != NULL)
- {
- while (h->root.type == bfd_link_hash_indirect)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- }
- }
-
- /* Some relocs require a global offset table. */
- if (dynobj == NULL || sgot == NULL)
- {
- switch (r_type)
- {
- case R_MIPS_GOT16:
- case R_MIPS_CALL16:
- case R_MIPS_CALL_HI16:
- case R_MIPS_CALL_LO16:
- case R_MIPS_GOT_HI16:
- case R_MIPS_GOT_LO16:
- case R_MIPS_GOT_PAGE:
- case R_MIPS_GOT_OFST:
- case R_MIPS_GOT_DISP:
- if (dynobj == NULL)
- elf_hash_table (info)->dynobj = dynobj = abfd;
- if (! mips_elf_create_got_section (dynobj, info, FALSE))
- return FALSE;
- g = mips_elf_got_info (dynobj, &sgot);
- break;
-
- case R_MIPS_32:
- case R_MIPS_REL32:
- case R_MIPS_64:
- if (dynobj == NULL
- && (info->shared || h != NULL)
- && (sec->flags & SEC_ALLOC) != 0)
- elf_hash_table (info)->dynobj = dynobj = abfd;
- break;
-
- default:
- break;
- }
- }
-
- if (!h && (r_type == R_MIPS_CALL_LO16
- || r_type == R_MIPS_GOT_LO16
- || r_type == R_MIPS_GOT_DISP))
- {
- /* We may need a local GOT entry for this relocation. We
- don't count R_MIPS_GOT_PAGE because we can estimate the
- maximum number of pages needed by looking at the size of
- the segment. Similar comments apply to R_MIPS_GOT16 and
- R_MIPS_CALL16. We don't count R_MIPS_GOT_HI16, or
- R_MIPS_CALL_HI16 because these are always followed by an
- R_MIPS_GOT_LO16 or R_MIPS_CALL_LO16. */
- if (! mips_elf_record_local_got_symbol (abfd, r_symndx,
- rel->r_addend, g))
- return FALSE;
- }
-
- switch (r_type)
- {
- case R_MIPS_CALL16:
- if (h == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: CALL16 reloc at 0x%lx not against global symbol"),
- bfd_archive_filename (abfd), (unsigned long) rel->r_offset);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- /* Fall through. */
-
- case R_MIPS_CALL_HI16:
- case R_MIPS_CALL_LO16:
- if (h != NULL)
- {
- /* This symbol requires a global offset table entry. */
- if (! mips_elf_record_global_got_symbol (h, abfd, info, g))
- return FALSE;
-
- /* We need a stub, not a plt entry for the undefined
- function. But we record it as if it needs plt. See
- _bfd_elf_adjust_dynamic_symbol. */
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->type = STT_FUNC;
- }
- break;
-
- case R_MIPS_GOT_PAGE:
- /* If this is a global, overridable symbol, GOT_PAGE will
- decay to GOT_DISP, so we'll need a GOT entry for it. */
- if (h == NULL)
- break;
- else
- {
- struct mips_elf_link_hash_entry *hmips =
- (struct mips_elf_link_hash_entry *) h;
-
- while (hmips->root.root.type == bfd_link_hash_indirect
- || hmips->root.root.type == bfd_link_hash_warning)
- hmips = (struct mips_elf_link_hash_entry *)
- hmips->root.root.u.i.link;
-
- if ((hmips->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
- && ! (info->shared && ! info->symbolic
- && ! (hmips->root.elf_link_hash_flags
- & ELF_LINK_FORCED_LOCAL)))
- break;
- }
- /* Fall through. */
-
- case R_MIPS_GOT16:
- case R_MIPS_GOT_HI16:
- case R_MIPS_GOT_LO16:
- case R_MIPS_GOT_DISP:
- /* This symbol requires a global offset table entry. */
- if (h && ! mips_elf_record_global_got_symbol (h, abfd, info, g))
- return FALSE;
- break;
-
- case R_MIPS_32:
- case R_MIPS_REL32:
- case R_MIPS_64:
- if ((info->shared || h != NULL)
- && (sec->flags & SEC_ALLOC) != 0)
- {
- if (sreloc == NULL)
- {
- sreloc = mips_elf_rel_dyn_section (dynobj, TRUE);
- if (sreloc == NULL)
- return FALSE;
- }
-#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
- if (info->shared)
- {
- /* When creating a shared object, we must copy these
- reloc types into the output file as R_MIPS_REL32
- relocs. We make room for this reloc in the
- .rel.dyn reloc section. */
- mips_elf_allocate_dynamic_relocations (dynobj, 1);
- if ((sec->flags & MIPS_READONLY_SECTION)
- == MIPS_READONLY_SECTION)
- /* We tell the dynamic linker that there are
- relocations against the text segment. */
- info->flags |= DF_TEXTREL;
- }
- else
- {
- struct mips_elf_link_hash_entry *hmips;
-
- /* We only need to copy this reloc if the symbol is
- defined in a dynamic object. */
- hmips = (struct mips_elf_link_hash_entry *) h;
- ++hmips->possibly_dynamic_relocs;
- if ((sec->flags & MIPS_READONLY_SECTION)
- == MIPS_READONLY_SECTION)
- /* We need it to tell the dynamic linker if there
- are relocations against the text segment. */
- hmips->readonly_reloc = TRUE;
- }
-
- /* Even though we don't directly need a GOT entry for
- this symbol, a symbol must have a dynamic symbol
- table index greater that DT_MIPS_GOTSYM if there are
- dynamic relocations against it. */
- if (h != NULL)
- {
- if (dynobj == NULL)
- elf_hash_table (info)->dynobj = dynobj = abfd;
- if (! mips_elf_create_got_section (dynobj, info, TRUE))
- return FALSE;
- g = mips_elf_got_info (dynobj, &sgot);
- if (! mips_elf_record_global_got_symbol (h, abfd, info, g))
- return FALSE;
- }
- }
-
- if (SGI_COMPAT (abfd))
- mips_elf_hash_table (info)->compact_rel_size +=
- sizeof (Elf32_External_crinfo);
- break;
-
- case R_MIPS_26:
- case R_MIPS_GPREL16:
- case R_MIPS_LITERAL:
- case R_MIPS_GPREL32:
- if (SGI_COMPAT (abfd))
- mips_elf_hash_table (info)->compact_rel_size +=
- sizeof (Elf32_External_crinfo);
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_MIPS_GNU_VTINHERIT:
- if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
- case R_MIPS_GNU_VTENTRY:
- if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
- return FALSE;
- break;
-
- default:
- break;
- }
-
- /* We must not create a stub for a symbol that has relocations
- related to taking the function's address. */
- switch (r_type)
- {
- default:
- if (h != NULL)
- {
- struct mips_elf_link_hash_entry *mh;
-
- mh = (struct mips_elf_link_hash_entry *) h;
- mh->no_fn_stub = TRUE;
- }
- break;
- case R_MIPS_CALL16:
- case R_MIPS_CALL_HI16:
- case R_MIPS_CALL_LO16:
- case R_MIPS_JALR:
- break;
- }
-
- /* If this reloc is not a 16 bit call, and it has a global
- symbol, then we will need the fn_stub if there is one.
- References from a stub section do not count. */
- if (h != NULL
- && r_type != R_MIPS16_26
- && strncmp (bfd_get_section_name (abfd, sec), FN_STUB,
- sizeof FN_STUB - 1) != 0
- && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB,
- sizeof CALL_STUB - 1) != 0
- && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB,
- sizeof CALL_FP_STUB - 1) != 0)
- {
- struct mips_elf_link_hash_entry *mh;
-
- mh = (struct mips_elf_link_hash_entry *) h;
- mh->need_fn_stub = TRUE;
- }
- }
-
- return TRUE;
-}
-
-bfd_boolean
-_bfd_mips_relax_section (bfd *abfd, asection *sec,
- struct bfd_link_info *link_info,
- bfd_boolean *again)
-{
- Elf_Internal_Rela *internal_relocs;
- Elf_Internal_Rela *irel, *irelend;
- Elf_Internal_Shdr *symtab_hdr;
- bfd_byte *contents = NULL;
- bfd_byte *free_contents = NULL;
- size_t extsymoff;
- bfd_boolean changed_contents = FALSE;
- bfd_vma sec_start = sec->output_section->vma + sec->output_offset;
- Elf_Internal_Sym *isymbuf = NULL;
-
- /* We are not currently changing any sizes, so only one pass. */
- *again = FALSE;
-
- if (link_info->relocatable)
- return TRUE;
-
- internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
- link_info->keep_memory);
- if (internal_relocs == NULL)
- return TRUE;
-
- irelend = internal_relocs + sec->reloc_count
- * get_elf_backend_data (abfd)->s->int_rels_per_ext_rel;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info;
-
- for (irel = internal_relocs; irel < irelend; irel++)
- {
- bfd_vma symval;
- bfd_signed_vma sym_offset;
- unsigned int r_type;
- unsigned long r_symndx;
- asection *sym_sec;
- unsigned long instruction;
-
- /* Turn jalr into bgezal, and jr into beq, if they're marked
- with a JALR relocation, that indicate where they jump to.
- This saves some pipeline bubbles. */
- r_type = ELF_R_TYPE (abfd, irel->r_info);
- if (r_type != R_MIPS_JALR)
- continue;
-
- r_symndx = ELF_R_SYM (abfd, irel->r_info);
- /* Compute the address of the jump target. */
- if (r_symndx >= extsymoff)
- {
- struct mips_elf_link_hash_entry *h
- = ((struct mips_elf_link_hash_entry *)
- elf_sym_hashes (abfd) [r_symndx - extsymoff]);
-
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- /* If a symbol is undefined, or if it may be overridden,
- skip it. */
- if (! ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- && h->root.root.u.def.section)
- || (link_info->shared && ! link_info->symbolic
- && ! (h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)))
- continue;
-
- sym_sec = h->root.root.u.def.section;
- if (sym_sec->output_section)
- symval = (h->root.root.u.def.value
- + sym_sec->output_section->vma
- + sym_sec->output_offset);
- else
- symval = h->root.root.u.def.value;
- }
- else
- {
- Elf_Internal_Sym *isym;
-
- /* Read this BFD's symbols if we haven't done so already. */
- if (isymbuf == NULL && symtab_hdr->sh_info != 0)
- {
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- goto relax_return;
- }
-
- isym = isymbuf + r_symndx;
- if (isym->st_shndx == SHN_UNDEF)
- continue;
- else if (isym->st_shndx == SHN_ABS)
- sym_sec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- sym_sec = bfd_com_section_ptr;
- else
- sym_sec
- = bfd_section_from_elf_index (abfd, isym->st_shndx);
- symval = isym->st_value
- + sym_sec->output_section->vma
- + sym_sec->output_offset;
- }
-
- /* Compute branch offset, from delay slot of the jump to the
- branch target. */
- sym_offset = (symval + irel->r_addend)
- - (sec_start + irel->r_offset + 4);
-
- /* Branch offset must be properly aligned. */
- if ((sym_offset & 3) != 0)
- continue;
-
- sym_offset >>= 2;
-
- /* Check that it's in range. */
- if (sym_offset < -0x8000 || sym_offset >= 0x8000)
- continue;
-
- /* Get the section contents if we haven't done so already. */
- if (contents == NULL)
- {
- /* Get cached copy if it exists. */
- if (elf_section_data (sec)->this_hdr.contents != NULL)
- contents = elf_section_data (sec)->this_hdr.contents;
- else
- {
- contents = bfd_malloc (sec->_raw_size);
- if (contents == NULL)
- goto relax_return;
-
- free_contents = contents;
- if (! bfd_get_section_contents (abfd, sec, contents,
- 0, sec->_raw_size))
- goto relax_return;
- }
- }
-
- instruction = bfd_get_32 (abfd, contents + irel->r_offset);
-
- /* If it was jalr <reg>, turn it into bgezal $zero, <target>. */
- if ((instruction & 0xfc1fffff) == 0x0000f809)
- instruction = 0x04110000;
- /* If it was jr <reg>, turn it into b <target>. */
- else if ((instruction & 0xfc1fffff) == 0x00000008)
- instruction = 0x10000000;
- else
- continue;
-
- instruction |= (sym_offset & 0xffff);
- bfd_put_32 (abfd, instruction, contents + irel->r_offset);
- changed_contents = TRUE;
- }
-
- if (contents != NULL
- && elf_section_data (sec)->this_hdr.contents != contents)
- {
- if (!changed_contents && !link_info->keep_memory)
- free (contents);
- else
- {
- /* Cache the section contents for elf_link_input_bfd. */
- elf_section_data (sec)->this_hdr.contents = contents;
- }
- }
- return TRUE;
-
- relax_return:
- if (free_contents != NULL)
- free (free_contents);
- return FALSE;
-}
-
-/* Adjust a symbol defined by a dynamic object and referenced by a
- regular object. The current definition is in some section of the
- dynamic object, but we're not including those sections. We have to
- change the definition to something the rest of the link can
- understand. */
-
-bfd_boolean
-_bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
-{
- bfd *dynobj;
- struct mips_elf_link_hash_entry *hmips;
- asection *s;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- /* Make sure we know what is going on here. */
- BFD_ASSERT (dynobj != NULL
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
- || h->weakdef != NULL
- || ((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)));
-
- /* If this symbol is defined in a dynamic object, we need to copy
- any R_MIPS_32 or R_MIPS_REL32 relocs against it into the output
- file. */
- hmips = (struct mips_elf_link_hash_entry *) h;
- if (! info->relocatable
- && hmips->possibly_dynamic_relocs != 0
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- mips_elf_allocate_dynamic_relocations (dynobj,
- hmips->possibly_dynamic_relocs);
- if (hmips->readonly_reloc)
- /* We tell the dynamic linker that there are relocations
- against the text segment. */
- info->flags |= DF_TEXTREL;
- }
-
- /* For a function, create a stub, if allowed. */
- if (! hmips->no_fn_stub
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
- {
- if (! elf_hash_table (info)->dynamic_sections_created)
- return TRUE;
-
- /* If this symbol is not defined in a regular file, then set
- the symbol to the stub location. This is required to make
- function pointers compare as equal between the normal
- executable and the shared library. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- /* We need .stub section. */
- s = bfd_get_section_by_name (dynobj,
- MIPS_ELF_STUB_SECTION_NAME (dynobj));
- BFD_ASSERT (s != NULL);
-
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
-
- /* XXX Write this stub address somewhere. */
- h->plt.offset = s->_raw_size;
-
- /* Make room for this stub code. */
- s->_raw_size += MIPS_FUNCTION_STUB_SIZE;
-
- /* The last half word of the stub will be filled with the index
- of this symbol in .dynsym section. */
- return TRUE;
- }
- }
- else if ((h->type == STT_FUNC)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
- {
- /* This will set the entry for this symbol in the GOT to 0, and
- the dynamic linker will take care of this. */
- h->root.u.def.value = 0;
- return TRUE;
- }
-
- /* If this is a weak symbol, and there is a real definition, the
- processor independent code will have arranged for us to see the
- real definition first, and we can just use the same value. */
- if (h->weakdef != NULL)
- {
- BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
- || h->weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->weakdef->root.u.def.section;
- h->root.u.def.value = h->weakdef->root.u.def.value;
- return TRUE;
- }
-
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
- return TRUE;
-}
-
-/* This function is called after all the input files have been read,
- and the input sections have been assigned to output sections. We
- check for any mips16 stub sections that we can discard. */
-
-bfd_boolean
-_bfd_mips_elf_always_size_sections (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- asection *ri;
-
- bfd *dynobj;
- asection *s;
- struct mips_got_info *g;
- int i;
- bfd_size_type loadable_size = 0;
- bfd_size_type local_gotno;
- bfd *sub;
-
- /* The .reginfo section has a fixed size. */
- ri = bfd_get_section_by_name (output_bfd, ".reginfo");
- if (ri != NULL)
- bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo));
-
- if (! (info->relocatable
- || ! mips_elf_hash_table (info)->mips16_stubs_seen))
- mips_elf_link_hash_traverse (mips_elf_hash_table (info),
- mips_elf_check_mips16_stubs, NULL);
-
- dynobj = elf_hash_table (info)->dynobj;
- if (dynobj == NULL)
- /* Relocatable links don't have it. */
- return TRUE;
-
- g = mips_elf_got_info (dynobj, &s);
- if (s == NULL)
- return TRUE;
-
- /* Calculate the total loadable size of the output. That
- will give us the maximum number of GOT_PAGE entries
- required. */
- for (sub = info->input_bfds; sub; sub = sub->link_next)
- {
- asection *subsection;
-
- for (subsection = sub->sections;
- subsection;
- subsection = subsection->next)
- {
- if ((subsection->flags & SEC_ALLOC) == 0)
- continue;
- loadable_size += ((subsection->_raw_size + 0xf)
- &~ (bfd_size_type) 0xf);
- }
- }
-
- /* There has to be a global GOT entry for every symbol with
- a dynamic symbol table index of DT_MIPS_GOTSYM or
- higher. Therefore, it make sense to put those symbols
- that need GOT entries at the end of the symbol table. We
- do that here. */
- if (! mips_elf_sort_hash_table (info, 1))
- return FALSE;
-
- if (g->global_gotsym != NULL)
- i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
- else
- /* If there are no global symbols, or none requiring
- relocations, then GLOBAL_GOTSYM will be NULL. */
- i = 0;
-
- /* In the worst case, we'll get one stub per dynamic symbol, plus
- one to account for the dummy entry at the end required by IRIX
- rld. */
- loadable_size += MIPS_FUNCTION_STUB_SIZE * (i + 1);
-
- /* Assume there are two loadable segments consisting of
- contiguous sections. Is 5 enough? */
- local_gotno = (loadable_size >> 16) + 5;
-
- g->local_gotno += local_gotno;
- s->_raw_size += g->local_gotno * MIPS_ELF_GOT_SIZE (output_bfd);
-
- g->global_gotno = i;
- s->_raw_size += i * MIPS_ELF_GOT_SIZE (output_bfd);
-
- if (s->_raw_size > MIPS_ELF_GOT_MAX_SIZE (output_bfd)
- && ! mips_elf_multi_got (output_bfd, info, g, s, local_gotno))
- return FALSE;
-
- return TRUE;
-}
-
-/* Set the sizes of the dynamic sections. */
-
-bfd_boolean
-_bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- bfd *dynobj;
- asection *s;
- bfd_boolean reltext;
-
- dynobj = elf_hash_table (info)->dynobj;
- BFD_ASSERT (dynobj != NULL);
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
- {
- s = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (s != NULL);
- s->_raw_size
- = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1;
- s->contents
- = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd);
- }
- }
-
- /* The check_relocs and adjust_dynamic_symbol entry points have
- determined the sizes of the various dynamic sections. Allocate
- memory for them. */
- reltext = FALSE;
- for (s = dynobj->sections; s != NULL; s = s->next)
- {
- const char *name;
- bfd_boolean strip;
-
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
-
- if ((s->flags & SEC_LINKER_CREATED) == 0)
- continue;
-
- strip = FALSE;
-
- if (strncmp (name, ".rel", 4) == 0)
- {
- if (s->_raw_size == 0)
- {
- /* We only strip the section if the output section name
- has the same name. Otherwise, there might be several
- input sections for this output section. FIXME: This
- code is probably not needed these days anyhow, since
- the linker now does not create empty output sections. */
- if (s->output_section != NULL
- && strcmp (name,
- bfd_get_section_name (s->output_section->owner,
- s->output_section)) == 0)
- strip = TRUE;
- }
- else
- {
- const char *outname;
- asection *target;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry.
- If the relocation section is .rel.dyn, we always
- assert a DT_TEXTREL entry rather than testing whether
- there exists a relocation to a read only section or
- not. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 4);
- if ((target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- || strcmp (outname, ".rel.dyn") == 0)
- reltext = TRUE;
-
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- if (strcmp (name, ".rel.dyn") != 0)
- s->reloc_count = 0;
-
- /* If combreloc is enabled, elf_link_sort_relocs() will
- sort relocations, but in a different way than we do,
- and before we're done creating relocations. Also, it
- will move them around between input sections'
- relocation's contents, so our sorting would be
- broken, so don't let it run. */
- info->combreloc = 0;
- }
- }
- else if (strncmp (name, ".got", 4) == 0)
- {
- /* _bfd_mips_elf_always_size_sections() has already done
- most of the work, but some symbols may have been mapped
- to versions that we must now resolve in the got_entries
- hash tables. */
- struct mips_got_info *gg = mips_elf_got_info (dynobj, NULL);
- struct mips_got_info *g = gg;
- struct mips_elf_set_global_got_offset_arg set_got_offset_arg;
- unsigned int needed_relocs = 0;
-
- if (gg->next)
- {
- set_got_offset_arg.value = MIPS_ELF_GOT_SIZE (output_bfd);
- set_got_offset_arg.info = info;
-
- mips_elf_resolve_final_got_entries (gg);
- for (g = gg->next; g && g->next != gg; g = g->next)
- {
- unsigned int save_assign;
-
- mips_elf_resolve_final_got_entries (g);
-
- /* Assign offsets to global GOT entries. */
- save_assign = g->assigned_gotno;
- g->assigned_gotno = g->local_gotno;
- set_got_offset_arg.g = g;
- set_got_offset_arg.needed_relocs = 0;
- htab_traverse (g->got_entries,
- mips_elf_set_global_got_offset,
- &set_got_offset_arg);
- needed_relocs += set_got_offset_arg.needed_relocs;
- BFD_ASSERT (g->assigned_gotno - g->local_gotno
- <= g->global_gotno);
-
- g->assigned_gotno = save_assign;
- if (info->shared)
- {
- needed_relocs += g->local_gotno - g->assigned_gotno;
- BFD_ASSERT (g->assigned_gotno == g->next->local_gotno
- + g->next->global_gotno
- + MIPS_RESERVED_GOTNO);
- }
- }
-
- if (needed_relocs)
- mips_elf_allocate_dynamic_relocations (dynobj, needed_relocs);
- }
- }
- else if (strcmp (name, MIPS_ELF_STUB_SECTION_NAME (output_bfd)) == 0)
- {
- /* IRIX rld assumes that the function stub isn't at the end
- of .text section. So put a dummy. XXX */
- s->_raw_size += MIPS_FUNCTION_STUB_SIZE;
- }
- else if (! info->shared
- && ! mips_elf_hash_table (info)->use_rld_obj_head
- && strncmp (name, ".rld_map", 8) == 0)
- {
- /* We add a room for __rld_map. It will be filled in by the
- rtld to contain a pointer to the _r_debug structure. */
- s->_raw_size += 4;
- }
- else if (SGI_COMPAT (output_bfd)
- && strncmp (name, ".compact_rel", 12) == 0)
- s->_raw_size += mips_elf_hash_table (info)->compact_rel_size;
- else if (strncmp (name, ".init", 5) != 0)
- {
- /* It's not one of our sections, so don't allocate space. */
- continue;
- }
-
- if (strip)
- {
- _bfd_strip_section_from_output (info, s);
- continue;
- }
-
- /* Allocate memory for the section contents. */
- s->contents = bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- }
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in _bfd_mips_elf_finish_dynamic_sections, but we
- must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
- if (! info->shared)
- {
- /* SGI object has the equivalence of DT_DEBUG in the
- DT_MIPS_RLD_MAP entry. */
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
- return FALSE;
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return FALSE;
- }
- }
- else
- {
- /* Shared libraries on traditional mips have DT_DEBUG. */
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return FALSE;
- }
- }
-
- if (reltext && SGI_COMPAT (output_bfd))
- info->flags |= DF_TEXTREL;
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
- return FALSE;
- }
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))
- return FALSE;
-
- if (mips_elf_rel_dyn_section (dynobj, FALSE))
- {
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0))
- return FALSE;
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0))
- return FALSE;
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0))
- return FALSE;
- }
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_VERSION, 0))
- return FALSE;
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 0))
- return FALSE;
-
-#if 0
- /* Time stamps in executable files are a bad idea. */
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_TIME_STAMP, 0))
- return FALSE;
-#endif
-
-#if 0 /* FIXME */
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_ICHECKSUM, 0))
- return FALSE;
-#endif
-
-#if 0 /* FIXME */
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_IVERSION, 0))
- return FALSE;
-#endif
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_BASE_ADDRESS, 0))
- return FALSE;
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LOCAL_GOTNO, 0))
- return FALSE;
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_SYMTABNO, 0))
- return FALSE;
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0))
- return FALSE;
-
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
- return FALSE;
-
- if (IRIX_COMPAT (dynobj) == ict_irix5
- && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_HIPAGENO, 0))
- return FALSE;
-
- if (IRIX_COMPAT (dynobj) == ict_irix6
- && (bfd_get_section_by_name
- (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
- && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Relocate a MIPS ELF section. */
-
-bfd_boolean
-_bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
- bfd *input_bfd, asection *input_section,
- bfd_byte *contents, Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms,
- asection **local_sections)
-{
- Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *relend;
- bfd_vma addend = 0;
- bfd_boolean use_saved_addend_p = FALSE;
- const struct elf_backend_data *bed;
-
- bed = get_elf_backend_data (output_bfd);
- relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
- for (rel = relocs; rel < relend; ++rel)
- {
- const char *name;
- bfd_vma value;
- reloc_howto_type *howto;
- bfd_boolean require_jalx;
- /* TRUE if the relocation is a RELA relocation, rather than a
- REL relocation. */
- bfd_boolean rela_relocation_p = TRUE;
- unsigned int r_type = ELF_R_TYPE (output_bfd, rel->r_info);
- const char *msg;
-
- /* Find the relocation howto for this relocation. */
- if (r_type == R_MIPS_64 && ! NEWABI_P (input_bfd))
- {
- /* Some 32-bit code uses R_MIPS_64. In particular, people use
- 64-bit code, but make sure all their addresses are in the
- lowermost or uppermost 32-bit section of the 64-bit address
- space. Thus, when they use an R_MIPS_64 they mean what is
- usually meant by R_MIPS_32, with the exception that the
- stored value is sign-extended to 64 bits. */
- howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, R_MIPS_32, FALSE);
-
- /* On big-endian systems, we need to lie about the position
- of the reloc. */
- if (bfd_big_endian (input_bfd))
- rel->r_offset += 4;
- }
- else
- /* NewABI defaults to RELA relocations. */
- howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, r_type,
- NEWABI_P (input_bfd)
- && (MIPS_RELOC_RELA_P
- (input_bfd, input_section,
- rel - relocs)));
-
- if (!use_saved_addend_p)
- {
- Elf_Internal_Shdr *rel_hdr;
-
- /* If these relocations were originally of the REL variety,
- we must pull the addend out of the field that will be
- relocated. Otherwise, we simply use the contents of the
- RELA relocation. To determine which flavor or relocation
- this is, we depend on the fact that the INPUT_SECTION's
- REL_HDR is read before its REL_HDR2. */
- rel_hdr = &elf_section_data (input_section)->rel_hdr;
- if ((size_t) (rel - relocs)
- >= (NUM_SHDR_ENTRIES (rel_hdr) * bed->s->int_rels_per_ext_rel))
- rel_hdr = elf_section_data (input_section)->rel_hdr2;
- if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd))
- {
- /* Note that this is a REL relocation. */
- rela_relocation_p = FALSE;
-
- /* Get the addend, which is stored in the input file. */
- addend = mips_elf_obtain_contents (howto, rel, input_bfd,
- contents);
- addend &= howto->src_mask;
-
- /* For some kinds of relocations, the ADDEND is a
- combination of the addend stored in two different
- relocations. */
- if (r_type == R_MIPS_HI16
- || r_type == R_MIPS_GNU_REL_HI16
- || (r_type == R_MIPS_GOT16
- && mips_elf_local_relocation_p (input_bfd, rel,
- local_sections, FALSE)))
- {
- bfd_vma l;
- const Elf_Internal_Rela *lo16_relocation;
- reloc_howto_type *lo16_howto;
- unsigned int lo;
-
- /* The combined value is the sum of the HI16 addend,
- left-shifted by sixteen bits, and the LO16
- addend, sign extended. (Usually, the code does
- a `lui' of the HI16 value, and then an `addiu' of
- the LO16 value.)
-
- Scan ahead to find a matching LO16 relocation. */
- if (r_type == R_MIPS_GNU_REL_HI16)
- lo = R_MIPS_GNU_REL_LO16;
- else
- lo = R_MIPS_LO16;
- lo16_relocation = mips_elf_next_relocation (input_bfd, lo,
- rel, relend);
- if (lo16_relocation == NULL)
- return FALSE;
-
- /* Obtain the addend kept there. */
- lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, lo, FALSE);
- l = mips_elf_obtain_contents (lo16_howto, lo16_relocation,
- input_bfd, contents);
- l &= lo16_howto->src_mask;
- l <<= lo16_howto->rightshift;
- l = _bfd_mips_elf_sign_extend (l, 16);
-
- addend <<= 16;
-
- /* Compute the combined addend. */
- addend += l;
-
- /* If PC-relative, subtract the difference between the
- address of the LO part of the reloc and the address of
- the HI part. The relocation is relative to the LO
- part, but mips_elf_calculate_relocation() doesn't
- know its address or the difference from the HI part, so
- we subtract that difference here. See also the
- comment in mips_elf_calculate_relocation(). */
- if (r_type == R_MIPS_GNU_REL_HI16)
- addend -= (lo16_relocation->r_offset - rel->r_offset);
- }
- else if (r_type == R_MIPS16_GPREL)
- {
- /* The addend is scrambled in the object file. See
- mips_elf_perform_relocation for details on the
- format. */
- addend = (((addend & 0x1f0000) >> 5)
- | ((addend & 0x7e00000) >> 16)
- | (addend & 0x1f));
- }
- else
- addend <<= howto->rightshift;
- }
- else
- addend = rel->r_addend;
- }
-
- if (info->relocatable)
- {
- Elf_Internal_Sym *sym;
- unsigned long r_symndx;
-
- if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd)
- && bfd_big_endian (input_bfd))
- rel->r_offset -= 4;
-
- /* Since we're just relocating, all we need to do is copy
- the relocations back out to the object file, unless
- they're against a section symbol, in which case we need
- to adjust by the section offset, or unless they're GP
- relative in which case we need to adjust by the amount
- that we're adjusting GP in this relocatable object. */
-
- if (! mips_elf_local_relocation_p (input_bfd, rel, local_sections,
- FALSE))
- /* There's nothing to do for non-local relocations. */
- continue;
-
- if (r_type == R_MIPS16_GPREL
- || r_type == R_MIPS_GPREL16
- || r_type == R_MIPS_GPREL32
- || r_type == R_MIPS_LITERAL)
- addend -= (_bfd_get_gp_value (output_bfd)
- - _bfd_get_gp_value (input_bfd));
-
- r_symndx = ELF_R_SYM (output_bfd, rel->r_info);
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- /* Adjust the addend appropriately. */
- addend += local_sections[r_symndx]->output_offset;
-
- if (rela_relocation_p)
- /* If this is a RELA relocation, just update the addend. */
- rel->r_addend = addend;
- else
- {
- if (r_type == R_MIPS_HI16
- || r_type == R_MIPS_GOT16
- || r_type == R_MIPS_GNU_REL_HI16)
- addend = mips_elf_high (addend);
- else if (r_type == R_MIPS_HIGHER)
- addend = mips_elf_higher (addend);
- else if (r_type == R_MIPS_HIGHEST)
- addend = mips_elf_highest (addend);
- else
- addend >>= howto->rightshift;
-
- /* We use the source mask, rather than the destination
- mask because the place to which we are writing will be
- source of the addend in the final link. */
- addend &= howto->src_mask;
-
- if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd))
- /* See the comment above about using R_MIPS_64 in the 32-bit
- ABI. Here, we need to update the addend. It would be
- possible to get away with just using the R_MIPS_32 reloc
- but for endianness. */
- {
- bfd_vma sign_bits;
- bfd_vma low_bits;
- bfd_vma high_bits;
-
- if (addend & ((bfd_vma) 1 << 31))
-#ifdef BFD64
- sign_bits = ((bfd_vma) 1 << 32) - 1;
-#else
- sign_bits = -1;
-#endif
- else
- sign_bits = 0;
-
- /* If we don't know that we have a 64-bit type,
- do two separate stores. */
- if (bfd_big_endian (input_bfd))
- {
- /* Store the sign-bits (which are most significant)
- first. */
- low_bits = sign_bits;
- high_bits = addend;
- }
- else
- {
- low_bits = addend;
- high_bits = sign_bits;
- }
- bfd_put_32 (input_bfd, low_bits,
- contents + rel->r_offset);
- bfd_put_32 (input_bfd, high_bits,
- contents + rel->r_offset + 4);
- continue;
- }
-
- if (! mips_elf_perform_relocation (info, howto, rel, addend,
- input_bfd, input_section,
- contents, FALSE))
- return FALSE;
- }
-
- /* Go on to the next relocation. */
- continue;
- }
-
- /* In the N32 and 64-bit ABIs there may be multiple consecutive
- relocations for the same offset. In that case we are
- supposed to treat the output of each relocation as the addend
- for the next. */
- if (rel + 1 < relend
- && rel->r_offset == rel[1].r_offset
- && ELF_R_TYPE (input_bfd, rel[1].r_info) != R_MIPS_NONE)
- use_saved_addend_p = TRUE;
- else
- use_saved_addend_p = FALSE;
-
- /* Figure out what value we are supposed to relocate. */
- switch (mips_elf_calculate_relocation (output_bfd, input_bfd,
- input_section, info, rel,
- addend, howto, local_syms,
- local_sections, &value,
- &name, &require_jalx,
- use_saved_addend_p))
- {
- case bfd_reloc_continue:
- /* There's nothing to do. */
- continue;
-
- case bfd_reloc_undefined:
- /* mips_elf_calculate_relocation already called the
- undefined_symbol callback. There's no real point in
- trying to perform the relocation at this point, so we
- just skip ahead to the next relocation. */
- continue;
-
- case bfd_reloc_notsupported:
- msg = _("internal error: unsupported relocation error");
- info->callbacks->warning
- (info, msg, name, input_bfd, input_section, rel->r_offset);
- return FALSE;
-
- case bfd_reloc_overflow:
- if (use_saved_addend_p)
- /* Ignore overflow until we reach the last relocation for
- a given location. */
- ;
- else
- {
- BFD_ASSERT (name != NULL);
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- break;
-
- case bfd_reloc_ok:
- break;
-
- default:
- abort ();
- break;
- }
-
- /* If we've got another relocation for the address, keep going
- until we reach the last one. */
- if (use_saved_addend_p)
- {
- addend = value;
- continue;
- }
-
- if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd))
- /* See the comment above about using R_MIPS_64 in the 32-bit
- ABI. Until now, we've been using the HOWTO for R_MIPS_32;
- that calculated the right value. Now, however, we
- sign-extend the 32-bit result to 64-bits, and store it as a
- 64-bit value. We are especially generous here in that we
- go to extreme lengths to support this usage on systems with
- only a 32-bit VMA. */
- {
- bfd_vma sign_bits;
- bfd_vma low_bits;
- bfd_vma high_bits;
-
- if (value & ((bfd_vma) 1 << 31))
-#ifdef BFD64
- sign_bits = ((bfd_vma) 1 << 32) - 1;
-#else
- sign_bits = -1;
-#endif
- else
- sign_bits = 0;
-
- /* If we don't know that we have a 64-bit type,
- do two separate stores. */
- if (bfd_big_endian (input_bfd))
- {
- /* Undo what we did above. */
- rel->r_offset -= 4;
- /* Store the sign-bits (which are most significant)
- first. */
- low_bits = sign_bits;
- high_bits = value;
- }
- else
- {
- low_bits = value;
- high_bits = sign_bits;
- }
- bfd_put_32 (input_bfd, low_bits,
- contents + rel->r_offset);
- bfd_put_32 (input_bfd, high_bits,
- contents + rel->r_offset + 4);
- continue;
- }
-
- /* Actually perform the relocation. */
- if (! mips_elf_perform_relocation (info, howto, rel, value,
- input_bfd, input_section,
- contents, require_jalx))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* If NAME is one of the special IRIX6 symbols defined by the linker,
- adjust it appropriately now. */
-
-static void
-mips_elf_irix6_finish_dynamic_symbol (bfd *abfd ATTRIBUTE_UNUSED,
- const char *name, Elf_Internal_Sym *sym)
-{
- /* The linker script takes care of providing names and values for
- these, but we must place them into the right sections. */
- static const char* const text_section_symbols[] = {
- "_ftext",
- "_etext",
- "__dso_displacement",
- "__elf_header",
- "__program_header_table",
- NULL
- };
-
- static const char* const data_section_symbols[] = {
- "_fdata",
- "_edata",
- "_end",
- "_fbss",
- NULL
- };
-
- const char* const *p;
- int i;
-
- for (i = 0; i < 2; ++i)
- for (p = (i == 0) ? text_section_symbols : data_section_symbols;
- *p;
- ++p)
- if (strcmp (*p, name) == 0)
- {
- /* All of these symbols are given type STT_SECTION by the
- IRIX6 linker. */
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_other = STO_PROTECTED;
-
- /* The IRIX linker puts these symbols in special sections. */
- if (i == 0)
- sym->st_shndx = SHN_MIPS_TEXT;
- else
- sym->st_shndx = SHN_MIPS_DATA;
-
- break;
- }
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-bfd_boolean
-_bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
- struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- bfd *dynobj;
- bfd_vma gval;
- asection *sgot;
- struct mips_got_info *g, *gg;
- const char *name;
-
- dynobj = elf_hash_table (info)->dynobj;
- gval = sym->st_value;
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- asection *s;
- bfd_byte stub[MIPS_FUNCTION_STUB_SIZE];
-
- /* This symbol has a stub. Set it up. */
-
- BFD_ASSERT (h->dynindx != -1);
-
- s = bfd_get_section_by_name (dynobj,
- MIPS_ELF_STUB_SECTION_NAME (dynobj));
- BFD_ASSERT (s != NULL);
-
- /* FIXME: Can h->dynindex be more than 64K? */
- if (h->dynindx & 0xffff0000)
- return FALSE;
-
- /* Fill the stub. */
- bfd_put_32 (output_bfd, STUB_LW (output_bfd), stub);
- bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), stub + 4);
- bfd_put_32 (output_bfd, STUB_JALR, stub + 8);
- bfd_put_32 (output_bfd, STUB_LI16 (output_bfd) + h->dynindx, stub + 12);
-
- BFD_ASSERT (h->plt.offset <= s->_raw_size);
- memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE);
-
- /* Mark the symbol as undefined. plt.offset != -1 occurs
- only for the referenced symbol. */
- sym->st_shndx = SHN_UNDEF;
-
- /* The run-time linker uses the st_value field of the symbol
- to reset the global offset table entry for this external
- to its stub address when unlinking a shared object. */
- gval = s->output_section->vma + s->output_offset + h->plt.offset;
- sym->st_value = gval;
- }
-
- BFD_ASSERT (h->dynindx != -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0);
-
- sgot = mips_elf_got_section (dynobj, FALSE);
- BFD_ASSERT (sgot != NULL);
- BFD_ASSERT (mips_elf_section_data (sgot) != NULL);
- g = mips_elf_section_data (sgot)->u.got_info;
- BFD_ASSERT (g != NULL);
-
- /* Run through the global symbol table, creating GOT entries for all
- the symbols that need them. */
- if (g->global_gotsym != NULL
- && h->dynindx >= g->global_gotsym->dynindx)
- {
- bfd_vma offset;
- bfd_vma value;
-
- value = sym->st_value;
- offset = mips_elf_global_got_index (dynobj, output_bfd, h);
- MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset);
- }
-
- if (g->next && h->dynindx != -1)
- {
- struct mips_got_entry e, *p;
- bfd_vma entry;
- bfd_vma offset;
-
- gg = g;
-
- e.abfd = output_bfd;
- e.symndx = -1;
- e.d.h = (struct mips_elf_link_hash_entry *)h;
-
- for (g = g->next; g->next != gg; g = g->next)
- {
- if (g->got_entries
- && (p = (struct mips_got_entry *) htab_find (g->got_entries,
- &e)))
- {
- offset = p->gotidx;
- if (info->shared
- || (elf_hash_table (info)->dynamic_sections_created
- && p->d.h != NULL
- && ((p->d.h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
- && ((p->d.h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- {
- /* Create an R_MIPS_REL32 relocation for this entry. Due to
- the various compatibility problems, it's easier to mock
- up an R_MIPS_32 or R_MIPS_64 relocation and leave
- mips_elf_create_dynamic_relocation to calculate the
- appropriate addend. */
- Elf_Internal_Rela rel[3];
-
- memset (rel, 0, sizeof (rel));
- if (ABI_64_P (output_bfd))
- rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_64);
- else
- rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_32);
- rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset;
-
- entry = 0;
- if (! (mips_elf_create_dynamic_relocation
- (output_bfd, info, rel,
- e.d.h, NULL, sym->st_value, &entry, sgot)))
- return FALSE;
- }
- else
- entry = sym->st_value;
- MIPS_ELF_PUT_WORD (output_bfd, entry, sgot->contents + offset);
- }
- }
- }
-
- /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- name = h->root.root.string;
- if (strcmp (name, "_DYNAMIC") == 0
- || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
- sym->st_shndx = SHN_ABS;
- else if (strcmp (name, "_DYNAMIC_LINK") == 0
- || strcmp (name, "_DYNAMIC_LINKING") == 0)
- {
- sym->st_shndx = SHN_ABS;
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_value = 1;
- }
- else if (strcmp (name, "_gp_disp") == 0 && ! NEWABI_P (output_bfd))
- {
- sym->st_shndx = SHN_ABS;
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_value = elf_gp (output_bfd);
- }
- else if (SGI_COMPAT (output_bfd))
- {
- if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0
- || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
- {
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_other = STO_PROTECTED;
- sym->st_value = 0;
- sym->st_shndx = SHN_MIPS_DATA;
- }
- else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0)
- {
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_other = STO_PROTECTED;
- sym->st_value = mips_elf_hash_table (info)->procedure_count;
- sym->st_shndx = SHN_ABS;
- }
- else if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS)
- {
- if (h->type == STT_FUNC)
- sym->st_shndx = SHN_MIPS_TEXT;
- else if (h->type == STT_OBJECT)
- sym->st_shndx = SHN_MIPS_DATA;
- }
- }
-
- /* Handle the IRIX6-specific symbols. */
- if (IRIX_COMPAT (output_bfd) == ict_irix6)
- mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym);
-
- if (! info->shared)
- {
- if (! mips_elf_hash_table (info)->use_rld_obj_head
- && (strcmp (name, "__rld_map") == 0
- || strcmp (name, "__RLD_MAP") == 0))
- {
- asection *s = bfd_get_section_by_name (dynobj, ".rld_map");
- BFD_ASSERT (s != NULL);
- sym->st_value = s->output_section->vma + s->output_offset;
- bfd_put_32 (output_bfd, 0, s->contents);
- if (mips_elf_hash_table (info)->rld_value == 0)
- mips_elf_hash_table (info)->rld_value = sym->st_value;
- }
- else if (mips_elf_hash_table (info)->use_rld_obj_head
- && strcmp (name, "__rld_obj_head") == 0)
- {
- /* IRIX6 does not use a .rld_map section. */
- if (IRIX_COMPAT (output_bfd) == ict_irix5
- || IRIX_COMPAT (output_bfd) == ict_none)
- BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map")
- != NULL);
- mips_elf_hash_table (info)->rld_value = sym->st_value;
- }
- }
-
- /* If this is a mips16 symbol, force the value to be even. */
- if (sym->st_other == STO_MIPS16
- && (sym->st_value & 1) != 0)
- --sym->st_value;
-
- return TRUE;
-}
-
-/* Finish up the dynamic sections. */
-
-bfd_boolean
-_bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
-{
- bfd *dynobj;
- asection *sdyn;
- asection *sgot;
- struct mips_got_info *gg, *g;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- sgot = mips_elf_got_section (dynobj, FALSE);
- if (sgot == NULL)
- gg = g = NULL;
- else
- {
- BFD_ASSERT (mips_elf_section_data (sgot) != NULL);
- gg = mips_elf_section_data (sgot)->u.got_info;
- BFD_ASSERT (gg != NULL);
- g = mips_elf_got_for_ibfd (gg, output_bfd);
- BFD_ASSERT (g != NULL);
- }
-
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- bfd_byte *b;
-
- BFD_ASSERT (sdyn != NULL);
- BFD_ASSERT (g != NULL);
-
- for (b = sdyn->contents;
- b < sdyn->contents + sdyn->_raw_size;
- b += MIPS_ELF_DYN_SIZE (dynobj))
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- size_t elemsize;
- asection *s;
- bfd_boolean swap_out_p;
-
- /* Read in the current dynamic entry. */
- (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn);
-
- /* Assume that we're going to modify it and write it out. */
- swap_out_p = TRUE;
-
- switch (dyn.d_tag)
- {
- case DT_RELENT:
- s = mips_elf_rel_dyn_section (dynobj, FALSE);
- BFD_ASSERT (s != NULL);
- dyn.d_un.d_val = MIPS_ELF_REL_SIZE (dynobj);
- break;
-
- case DT_STRSZ:
- /* Rewrite DT_STRSZ. */
- dyn.d_un.d_val =
- _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
- break;
-
- case DT_PLTGOT:
- name = ".got";
- s = bfd_get_section_by_name (output_bfd, name);
- BFD_ASSERT (s != NULL);
- dyn.d_un.d_ptr = s->vma;
- break;
-
- case DT_MIPS_RLD_VERSION:
- dyn.d_un.d_val = 1; /* XXX */
- break;
-
- case DT_MIPS_FLAGS:
- dyn.d_un.d_val = RHF_NOTPOT; /* XXX */
- break;
-
- case DT_MIPS_TIME_STAMP:
- time ((time_t *) &dyn.d_un.d_val);
- break;
-
- case DT_MIPS_ICHECKSUM:
- /* XXX FIXME: */
- swap_out_p = FALSE;
- break;
-
- case DT_MIPS_IVERSION:
- /* XXX FIXME: */
- swap_out_p = FALSE;
- break;
-
- case DT_MIPS_BASE_ADDRESS:
- s = output_bfd->sections;
- BFD_ASSERT (s != NULL);
- dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff;
- break;
-
- case DT_MIPS_LOCAL_GOTNO:
- dyn.d_un.d_val = g->local_gotno;
- break;
-
- case DT_MIPS_UNREFEXTNO:
- /* The index into the dynamic symbol table which is the
- entry of the first external symbol that is not
- referenced within the same object. */
- dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1;
- break;
-
- case DT_MIPS_GOTSYM:
- if (gg->global_gotsym)
- {
- dyn.d_un.d_val = gg->global_gotsym->dynindx;
- break;
- }
- /* In case if we don't have global got symbols we default
- to setting DT_MIPS_GOTSYM to the same value as
- DT_MIPS_SYMTABNO, so we just fall through. */
-
- case DT_MIPS_SYMTABNO:
- name = ".dynsym";
- elemsize = MIPS_ELF_SYM_SIZE (output_bfd);
- s = bfd_get_section_by_name (output_bfd, name);
- BFD_ASSERT (s != NULL);
-
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size / elemsize;
- else
- dyn.d_un.d_val = s->_raw_size / elemsize;
- break;
-
- case DT_MIPS_HIPAGENO:
- dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO;
- break;
-
- case DT_MIPS_RLD_MAP:
- dyn.d_un.d_ptr = mips_elf_hash_table (info)->rld_value;
- break;
-
- case DT_MIPS_OPTIONS:
- s = (bfd_get_section_by_name
- (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd)));
- dyn.d_un.d_ptr = s->vma;
- break;
-
- case DT_RELSZ:
- /* Reduce DT_RELSZ to account for any relocations we
- decided not to make. This is for the n64 irix rld,
- which doesn't seem to apply any relocations if there
- are trailing null entries. */
- s = mips_elf_rel_dyn_section (dynobj, FALSE);
- dyn.d_un.d_val = (s->reloc_count
- * (ABI_64_P (output_bfd)
- ? sizeof (Elf64_Mips_External_Rel)
- : sizeof (Elf32_External_Rel)));
- break;
-
- default:
- swap_out_p = FALSE;
- break;
- }
-
- if (swap_out_p)
- (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
- (dynobj, &dyn, b);
- }
- }
-
- /* The first entry of the global offset table will be filled at
- runtime. The second entry will be used by some runtime loaders.
- This isn't the case of IRIX rld. */
- if (sgot != NULL && sgot->_raw_size > 0)
- {
- MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents);
- MIPS_ELF_PUT_WORD (output_bfd, 0x80000000,
- sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
- }
-
- if (sgot != NULL)
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize
- = MIPS_ELF_GOT_SIZE (output_bfd);
-
- /* Generate dynamic relocations for the non-primary gots. */
- if (gg != NULL && gg->next)
- {
- Elf_Internal_Rela rel[3];
- bfd_vma addend = 0;
-
- memset (rel, 0, sizeof (rel));
- rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_REL32);
-
- for (g = gg->next; g->next != gg; g = g->next)
- {
- bfd_vma index = g->next->local_gotno + g->next->global_gotno;
-
- MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents
- + index++ * MIPS_ELF_GOT_SIZE (output_bfd));
- MIPS_ELF_PUT_WORD (output_bfd, 0x80000000, sgot->contents
- + index++ * MIPS_ELF_GOT_SIZE (output_bfd));
-
- if (! info->shared)
- continue;
-
- while (index < g->assigned_gotno)
- {
- rel[0].r_offset = rel[1].r_offset = rel[2].r_offset
- = index++ * MIPS_ELF_GOT_SIZE (output_bfd);
- if (!(mips_elf_create_dynamic_relocation
- (output_bfd, info, rel, NULL,
- bfd_abs_section_ptr,
- 0, &addend, sgot)))
- return FALSE;
- BFD_ASSERT (addend == 0);
- }
- }
- }
-
- {
- asection *s;
- Elf32_compact_rel cpt;
-
- if (SGI_COMPAT (output_bfd))
- {
- /* Write .compact_rel section out. */
- s = bfd_get_section_by_name (dynobj, ".compact_rel");
- if (s != NULL)
- {
- cpt.id1 = 1;
- cpt.num = s->reloc_count;
- cpt.id2 = 2;
- cpt.offset = (s->output_section->filepos
- + sizeof (Elf32_External_compact_rel));
- cpt.reserved0 = 0;
- cpt.reserved1 = 0;
- bfd_elf32_swap_compact_rel_out (output_bfd, &cpt,
- ((Elf32_External_compact_rel *)
- s->contents));
-
- /* Clean up a dummy stub function entry in .text. */
- s = bfd_get_section_by_name (dynobj,
- MIPS_ELF_STUB_SECTION_NAME (dynobj));
- if (s != NULL)
- {
- file_ptr dummy_offset;
-
- BFD_ASSERT (s->_raw_size >= MIPS_FUNCTION_STUB_SIZE);
- dummy_offset = s->_raw_size - MIPS_FUNCTION_STUB_SIZE;
- memset (s->contents + dummy_offset, 0,
- MIPS_FUNCTION_STUB_SIZE);
- }
- }
- }
-
- /* We need to sort the entries of the dynamic relocation section. */
-
- s = mips_elf_rel_dyn_section (dynobj, FALSE);
-
- if (s != NULL
- && s->_raw_size > (bfd_vma)2 * MIPS_ELF_REL_SIZE (output_bfd))
- {
- reldyn_sorting_bfd = output_bfd;
-
- if (ABI_64_P (output_bfd))
- qsort ((Elf64_External_Rel *) s->contents + 1, s->reloc_count - 1,
- sizeof (Elf64_Mips_External_Rel), sort_dynamic_relocs_64);
- else
- qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1,
- sizeof (Elf32_External_Rel), sort_dynamic_relocs);
- }
- }
-
- return TRUE;
-}
-
-
-/* Set ABFD's EF_MIPS_ARCH and EF_MIPS_MACH flags. */
-
-static void
-mips_set_isa_flags (bfd *abfd)
-{
- flagword val;
-
- switch (bfd_get_mach (abfd))
- {
- default:
- case bfd_mach_mips3000:
- val = E_MIPS_ARCH_1;
- break;
-
- case bfd_mach_mips3900:
- val = E_MIPS_ARCH_1 | E_MIPS_MACH_3900;
- break;
-
- case bfd_mach_mips6000:
- val = E_MIPS_ARCH_2;
- break;
-
- case bfd_mach_mips4000:
- case bfd_mach_mips4300:
- case bfd_mach_mips4400:
- case bfd_mach_mips4600:
- val = E_MIPS_ARCH_3;
- break;
-
- case bfd_mach_mips4010:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4010;
- break;
-
- case bfd_mach_mips4100:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4100;
- break;
-
- case bfd_mach_mips4111:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4111;
- break;
-
- case bfd_mach_mips4120:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4120;
- break;
-
- case bfd_mach_mips4650:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4650;
- break;
-
- case bfd_mach_mips5400:
- val = E_MIPS_ARCH_4 | E_MIPS_MACH_5400;
- break;
-
- case bfd_mach_mips5500:
- val = E_MIPS_ARCH_4 | E_MIPS_MACH_5500;
- break;
-
- case bfd_mach_mips5000:
- case bfd_mach_mips7000:
- case bfd_mach_mips8000:
- case bfd_mach_mips10000:
- case bfd_mach_mips12000:
- val = E_MIPS_ARCH_4;
- break;
-
- case bfd_mach_mips5:
- val = E_MIPS_ARCH_5;
- break;
-
- case bfd_mach_mips_sb1:
- val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1;
- break;
-
- case bfd_mach_mipsisa32:
- val = E_MIPS_ARCH_32;
- break;
-
- case bfd_mach_mipsisa64:
- val = E_MIPS_ARCH_64;
- break;
-
- case bfd_mach_mipsisa32r2:
- val = E_MIPS_ARCH_32R2;
- break;
-
- case bfd_mach_mipsisa64r2:
- val = E_MIPS_ARCH_64R2;
- break;
- }
- elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
- elf_elfheader (abfd)->e_flags |= val;
-
-}
-
-
-/* The final processing done just before writing out a MIPS ELF object
- file. This gets the MIPS architecture right based on the machine
- number. This is used by both the 32-bit and the 64-bit ABI. */
-
-void
-_bfd_mips_elf_final_write_processing (bfd *abfd,
- bfd_boolean linker ATTRIBUTE_UNUSED)
-{
- unsigned int i;
- Elf_Internal_Shdr **hdrpp;
- const char *name;
- asection *sec;
-
- /* Keep the existing EF_MIPS_MACH and EF_MIPS_ARCH flags if the former
- is nonzero. This is for compatibility with old objects, which used
- a combination of a 32-bit EF_MIPS_ARCH and a 64-bit EF_MIPS_MACH. */
- if ((elf_elfheader (abfd)->e_flags & EF_MIPS_MACH) == 0)
- mips_set_isa_flags (abfd);
-
- /* Set the sh_info field for .gptab sections and other appropriate
- info for each special section. */
- for (i = 1, hdrpp = elf_elfsections (abfd) + 1;
- i < elf_numsections (abfd);
- i++, hdrpp++)
- {
- switch ((*hdrpp)->sh_type)
- {
- case SHT_MIPS_MSYM:
- case SHT_MIPS_LIBLIST:
- sec = bfd_get_section_by_name (abfd, ".dynstr");
- if (sec != NULL)
- (*hdrpp)->sh_link = elf_section_data (sec)->this_idx;
- break;
-
- case SHT_MIPS_GPTAB:
- BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
- name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
- BFD_ASSERT (name != NULL
- && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0);
- sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1);
- BFD_ASSERT (sec != NULL);
- (*hdrpp)->sh_info = elf_section_data (sec)->this_idx;
- break;
-
- case SHT_MIPS_CONTENT:
- BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
- name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
- BFD_ASSERT (name != NULL
- && strncmp (name, ".MIPS.content",
- sizeof ".MIPS.content" - 1) == 0);
- sec = bfd_get_section_by_name (abfd,
- name + sizeof ".MIPS.content" - 1);
- BFD_ASSERT (sec != NULL);
- (*hdrpp)->sh_link = elf_section_data (sec)->this_idx;
- break;
-
- case SHT_MIPS_SYMBOL_LIB:
- sec = bfd_get_section_by_name (abfd, ".dynsym");
- if (sec != NULL)
- (*hdrpp)->sh_link = elf_section_data (sec)->this_idx;
- sec = bfd_get_section_by_name (abfd, ".liblist");
- if (sec != NULL)
- (*hdrpp)->sh_info = elf_section_data (sec)->this_idx;
- break;
-
- case SHT_MIPS_EVENTS:
- BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
- name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
- BFD_ASSERT (name != NULL);
- if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0)
- sec = bfd_get_section_by_name (abfd,
- name + sizeof ".MIPS.events" - 1);
- else
- {
- BFD_ASSERT (strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) == 0);
- sec = bfd_get_section_by_name (abfd,
- (name
- + sizeof ".MIPS.post_rel" - 1));
- }
- BFD_ASSERT (sec != NULL);
- (*hdrpp)->sh_link = elf_section_data (sec)->this_idx;
- break;
-
- }
- }
-}
-
-/* When creating an IRIX5 executable, we need REGINFO and RTPROC
- segments. */
-
-int
-_bfd_mips_elf_additional_program_headers (bfd *abfd)
-{
- asection *s;
- int ret = 0;
-
- /* See if we need a PT_MIPS_REGINFO segment. */
- s = bfd_get_section_by_name (abfd, ".reginfo");
- if (s && (s->flags & SEC_LOAD))
- ++ret;
-
- /* See if we need a PT_MIPS_OPTIONS segment. */
- if (IRIX_COMPAT (abfd) == ict_irix6
- && bfd_get_section_by_name (abfd,
- MIPS_ELF_OPTIONS_SECTION_NAME (abfd)))
- ++ret;
-
- /* See if we need a PT_MIPS_RTPROC segment. */
- if (IRIX_COMPAT (abfd) == ict_irix5
- && bfd_get_section_by_name (abfd, ".dynamic")
- && bfd_get_section_by_name (abfd, ".mdebug"))
- ++ret;
-
- return ret;
-}
-
-/* Modify the segment map for an IRIX5 executable. */
-
-bfd_boolean
-_bfd_mips_elf_modify_segment_map (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- 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. */
- s = bfd_get_section_by_name (abfd, ".reginfo");
- if (s != NULL && (s->flags & SEC_LOAD) != 0)
- {
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_MIPS_REGINFO)
- break;
- if (m == NULL)
- {
- amt = sizeof *m;
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- return FALSE;
-
- m->p_type = PT_MIPS_REGINFO;
- m->count = 1;
- m->sections[0] = s;
-
- /* We want to put it after the PHDR and INTERP segments. */
- pm = &elf_tdata (abfd)->segment_map;
- while (*pm != NULL
- && ((*pm)->p_type == PT_PHDR
- || (*pm)->p_type == PT_INTERP))
- pm = &(*pm)->next;
-
- m->next = *pm;
- *pm = m;
- }
- }
-
- /* For IRIX 6, we don't have .mdebug sections, nor does anything but
- .dynamic end up in PT_DYNAMIC. However, we do have to insert a
- PT_MIPS_OPTIONS segment immediately following the program header
- table. */
- if (NEWABI_P (abfd)
- /* On non-IRIX6 new abi, we'll have already created a segment
- for this section, so don't create another. I'm not sure this
- is not also the case for IRIX 6, but I can't test it right
- now. */
- && IRIX_COMPAT (abfd) == ict_irix6)
- {
- for (s = abfd->sections; s; s = s->next)
- if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS)
- break;
-
- if (s)
- {
- struct elf_segment_map *options_segment;
-
- pm = &elf_tdata (abfd)->segment_map;
- while (*pm != NULL
- && ((*pm)->p_type == PT_PHDR
- || (*pm)->p_type == PT_INTERP))
- pm = &(*pm)->next;
-
- 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;
- options_segment->p_flags_valid = TRUE;
- options_segment->count = 1;
- options_segment->sections[0] = s;
- *pm = options_segment;
- }
- }
- else
- {
- if (IRIX_COMPAT (abfd) == ict_irix5)
- {
- /* If there are .dynamic and .mdebug sections, we make a room
- for the RTPROC header. FIXME: Rewrite without section names. */
- if (bfd_get_section_by_name (abfd, ".interp") == NULL
- && bfd_get_section_by_name (abfd, ".dynamic") != NULL
- && bfd_get_section_by_name (abfd, ".mdebug") != NULL)
- {
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_MIPS_RTPROC)
- break;
- if (m == NULL)
- {
- amt = sizeof *m;
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- return FALSE;
-
- m->p_type = PT_MIPS_RTPROC;
-
- s = bfd_get_section_by_name (abfd, ".rtproc");
- if (s == NULL)
- {
- m->count = 0;
- m->p_flags = 0;
- m->p_flags_valid = 1;
- }
- else
- {
- m->count = 1;
- m->sections[0] = s;
- }
-
- /* We want to put it after the DYNAMIC segment. */
- pm = &elf_tdata (abfd)->segment_map;
- while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC)
- pm = &(*pm)->next;
- if (*pm != NULL)
- pm = &(*pm)->next;
-
- m->next = *pm;
- *pm = m;
- }
- }
- }
- /* On IRIX5, the PT_DYNAMIC segment includes the .dynamic,
- .dynstr, .dynsym, and .hash sections, and everything in
- between. */
- for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL;
- pm = &(*pm)->next)
- if ((*pm)->p_type == PT_DYNAMIC)
- break;
- m = *pm;
- if (m != NULL && IRIX_COMPAT (abfd) == ict_none)
- {
- /* For a normal mips executable the permissions for the PT_DYNAMIC
- segment are read, write and execute. We do that here since
- the code in elf.c sets only the read permission. This matters
- sometimes for the dynamic linker. */
- if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
- {
- m->p_flags = PF_R | PF_W | PF_X;
- m->p_flags_valid = 1;
- }
- }
- if (m != NULL
- && m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0)
- {
- static const char *sec_names[] =
- {
- ".dynamic", ".dynstr", ".dynsym", ".hash"
- };
- bfd_vma low, high;
- unsigned int i, c;
- struct elf_segment_map *n;
-
- low = ~(bfd_vma) 0;
- high = 0;
- for (i = 0; i < sizeof sec_names / sizeof sec_names[0]; i++)
- {
- s = bfd_get_section_by_name (abfd, sec_names[i]);
- if (s != NULL && (s->flags & SEC_LOAD) != 0)
- {
- bfd_size_type sz;
-
- if (low > s->vma)
- low = s->vma;
- sz = s->_cooked_size;
- if (sz == 0)
- sz = s->_raw_size;
- if (high < s->vma + sz)
- high = s->vma + sz;
- }
- }
-
- c = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
- if ((s->flags & SEC_LOAD) != 0
- && s->vma >= low
- && ((s->vma
- + (s->_cooked_size !=
- 0 ? s->_cooked_size : s->_raw_size)) <= high))
- ++c;
-
- amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *);
- n = bfd_zalloc (abfd, amt);
- if (n == NULL)
- return FALSE;
- *n = *m;
- n->count = c;
-
- i = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LOAD) != 0
- && s->vma >= low
- && ((s->vma
- + (s->_cooked_size != 0 ?
- s->_cooked_size : s->_raw_size)) <= high))
- {
- n->sections[i] = s;
- ++i;
- }
- }
-
- *pm = n;
- }
- }
-
- return TRUE;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-asection *
-_bfd_mips_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- /* ??? Do mips16 stub sections need to be handled special? */
-
- if (h != NULL)
- {
- switch (ELF_R_TYPE (sec->owner, rel->r_info))
- {
- case R_MIPS_GNU_VTINHERIT:
- case R_MIPS_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-bfd_boolean
-_bfd_mips_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
-#if 0
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- switch (ELF_R_TYPE (abfd, rel->r_info))
- {
- case R_MIPS_GOT16:
- case R_MIPS_CALL16:
- case R_MIPS_CALL_HI16:
- case R_MIPS_CALL_LO16:
- case R_MIPS_GOT_HI16:
- case R_MIPS_GOT_LO16:
- case R_MIPS_GOT_DISP:
- case R_MIPS_GOT_PAGE:
- case R_MIPS_GOT_OFST:
- /* ??? It would seem that the existing MIPS code does no sort
- of reference counting or whatnot on its GOT and PLT entries,
- so it is not possible to garbage collect them at this time. */
- break;
-
- default:
- break;
- }
-#endif
-
- return TRUE;
-}
-
-/* Copy data from a MIPS ELF indirect symbol to its direct symbol,
- hiding the old indirect symbol. Process additional relocation
- information. Also called for weakdefs, in which case we just let
- _bfd_elf_link_hash_copy_indirect copy the flags for us. */
-
-void
-_bfd_mips_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
- struct elf_link_hash_entry *dir,
- struct elf_link_hash_entry *ind)
-{
- struct mips_elf_link_hash_entry *dirmips, *indmips;
-
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
-
- if (ind->root.type != bfd_link_hash_indirect)
- return;
-
- dirmips = (struct mips_elf_link_hash_entry *) dir;
- indmips = (struct mips_elf_link_hash_entry *) ind;
- dirmips->possibly_dynamic_relocs += indmips->possibly_dynamic_relocs;
- if (indmips->readonly_reloc)
- dirmips->readonly_reloc = TRUE;
- if (indmips->no_fn_stub)
- dirmips->no_fn_stub = TRUE;
-}
-
-void
-_bfd_mips_elf_hide_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *entry,
- bfd_boolean force_local)
-{
- bfd *dynobj;
- asection *got;
- struct mips_got_info *g;
- struct mips_elf_link_hash_entry *h;
-
- h = (struct mips_elf_link_hash_entry *) entry;
- if (h->forced_local)
- return;
- h->forced_local = force_local;
-
- dynobj = elf_hash_table (info)->dynobj;
- if (dynobj != NULL && force_local)
- {
- got = mips_elf_got_section (dynobj, FALSE);
- g = mips_elf_section_data (got)->u.got_info;
-
- if (g->next)
- {
- struct mips_got_entry e;
- struct mips_got_info *gg = g;
-
- /* Since we're turning what used to be a global symbol into a
- local one, bump up the number of local entries of each GOT
- that had an entry for it. This will automatically decrease
- the number of global entries, since global_gotno is actually
- the upper limit of global entries. */
- e.abfd = dynobj;
- e.symndx = -1;
- e.d.h = h;
-
- for (g = g->next; g != gg; g = g->next)
- if (htab_find (g->got_entries, &e))
- {
- BFD_ASSERT (g->global_gotno > 0);
- g->local_gotno++;
- g->global_gotno--;
- }
-
- /* If this was a global symbol forced into the primary GOT, we
- no longer need an entry for it. We can't release the entry
- at this point, but we must at least stop counting it as one
- of the symbols that required a forced got entry. */
- if (h->root.got.offset == 2)
- {
- BFD_ASSERT (gg->assigned_gotno > 0);
- gg->assigned_gotno--;
- }
- }
- else if (g->global_gotno == 0 && g->global_gotsym == NULL)
- /* If we haven't got through GOT allocation yet, just bump up the
- number of local entries, as this symbol won't be counted as
- global. */
- g->local_gotno++;
- else if (h->root.got.offset == 1)
- {
- /* If we're past non-multi-GOT allocation and this symbol had
- been marked for a global got entry, give it a local entry
- instead. */
- BFD_ASSERT (g->global_gotno > 0);
- g->local_gotno++;
- g->global_gotno--;
- }
- }
-
- _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
-}
-
-#define PDR_SIZE 32
-
-bfd_boolean
-_bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie,
- struct bfd_link_info *info)
-{
- asection *o;
- bfd_boolean ret = FALSE;
- unsigned char *tdata;
- size_t i, skip;
-
- o = bfd_get_section_by_name (abfd, ".pdr");
- if (! o)
- return FALSE;
- if (o->_raw_size == 0)
- return FALSE;
- if (o->_raw_size % PDR_SIZE != 0)
- return FALSE;
- if (o->output_section != NULL
- && bfd_is_abs_section (o->output_section))
- return FALSE;
-
- tdata = bfd_zmalloc (o->_raw_size / PDR_SIZE);
- if (! tdata)
- return FALSE;
-
- cookie->rels = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL,
- info->keep_memory);
- if (!cookie->rels)
- {
- free (tdata);
- return FALSE;
- }
-
- cookie->rel = cookie->rels;
- cookie->relend = cookie->rels + o->reloc_count;
-
- for (i = 0, skip = 0; i < o->_raw_size / PDR_SIZE; i ++)
- {
- if (bfd_elf_reloc_symbol_deleted_p (i * PDR_SIZE, cookie))
- {
- tdata[i] = 1;
- skip ++;
- }
- }
-
- if (skip != 0)
- {
- mips_elf_section_data (o)->u.tdata = tdata;
- o->_cooked_size = o->_raw_size - skip * PDR_SIZE;
- ret = TRUE;
- }
- else
- free (tdata);
-
- if (! info->keep_memory)
- free (cookie->rels);
-
- return ret;
-}
-
-bfd_boolean
-_bfd_mips_elf_ignore_discarded_relocs (asection *sec)
-{
- if (strcmp (sec->name, ".pdr") == 0)
- return TRUE;
- return FALSE;
-}
-
-bfd_boolean
-_bfd_mips_elf_write_section (bfd *output_bfd, asection *sec,
- bfd_byte *contents)
-{
- bfd_byte *to, *from, *end;
- int i;
-
- if (strcmp (sec->name, ".pdr") != 0)
- return FALSE;
-
- if (mips_elf_section_data (sec)->u.tdata == NULL)
- return FALSE;
-
- to = contents;
- end = contents + sec->_raw_size;
- for (from = contents, i = 0;
- from < end;
- from += PDR_SIZE, i++)
- {
- if ((mips_elf_section_data (sec)->u.tdata)[i] == 1)
- continue;
- if (to != from)
- memcpy (to, from, PDR_SIZE);
- to += PDR_SIZE;
- }
- bfd_set_section_contents (output_bfd, sec->output_section, contents,
- sec->output_offset, sec->_cooked_size);
- return TRUE;
-}
-
-/* MIPS ELF uses a special find_nearest_line routine in order the
- handle the ECOFF debugging information. */
-
-struct mips_elf_find_line
-{
- struct ecoff_debug_info d;
- struct ecoff_find_line i;
-};
-
-bfd_boolean
-_bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section,
- asymbol **symbols, bfd_vma offset,
- const char **filename_ptr,
- const char **functionname_ptr,
- unsigned int *line_ptr)
-{
- asection *msec;
-
- if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr))
- return TRUE;
-
- if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr, ABI_64_P (abfd) ? 8 : 0,
- &elf_tdata (abfd)->dwarf2_find_line_info))
- return TRUE;
-
- msec = bfd_get_section_by_name (abfd, ".mdebug");
- if (msec != NULL)
- {
- flagword origflags;
- struct mips_elf_find_line *fi;
- const struct ecoff_debug_swap * const swap =
- get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
-
- /* If we are called during a link, mips_elf_final_link may have
- cleared the SEC_HAS_CONTENTS field. We force it back on here
- if appropriate (which it normally will be). */
- origflags = msec->flags;
- if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS)
- msec->flags |= SEC_HAS_CONTENTS;
-
- fi = elf_tdata (abfd)->find_line_info;
- if (fi == NULL)
- {
- bfd_size_type external_fdr_size;
- char *fraw_src;
- char *fraw_end;
- struct fdr *fdr_ptr;
- bfd_size_type amt = sizeof (struct mips_elf_find_line);
-
- fi = bfd_zalloc (abfd, amt);
- if (fi == NULL)
- {
- msec->flags = origflags;
- return FALSE;
- }
-
- if (! _bfd_mips_elf_read_ecoff_info (abfd, msec, &fi->d))
- {
- msec->flags = origflags;
- return FALSE;
- }
-
- /* Swap in the FDR information. */
- amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr);
- fi->d.fdr = bfd_alloc (abfd, amt);
- if (fi->d.fdr == NULL)
- {
- msec->flags = origflags;
- return FALSE;
- }
- external_fdr_size = swap->external_fdr_size;
- fdr_ptr = fi->d.fdr;
- fraw_src = (char *) fi->d.external_fdr;
- fraw_end = (fraw_src
- + fi->d.symbolic_header.ifdMax * external_fdr_size);
- for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++)
- (*swap->swap_fdr_in) (abfd, fraw_src, fdr_ptr);
-
- elf_tdata (abfd)->find_line_info = fi;
-
- /* Note that we don't bother to ever free this information.
- find_nearest_line is either called all the time, as in
- objdump -l, so the information should be saved, or it is
- rarely called, as in ld error messages, so the memory
- wasted is unimportant. Still, it would probably be a
- good idea for free_cached_info to throw it away. */
- }
-
- if (_bfd_ecoff_locate_line (abfd, section, offset, &fi->d, swap,
- &fi->i, filename_ptr, functionname_ptr,
- line_ptr))
- {
- msec->flags = origflags;
- return TRUE;
- }
-
- msec->flags = origflags;
- }
-
- /* Fall back on the generic ELF find_nearest_line routine. */
-
- return _bfd_elf_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr);
-}
-
-/* When are writing out the .options or .MIPS.options section,
- remember the bytes we are writing out, so that we can install the
- GP value in the section_processing routine. */
-
-bfd_boolean
-_bfd_mips_elf_set_section_contents (bfd *abfd, sec_ptr section,
- const void *location,
- file_ptr offset, bfd_size_type count)
-{
- if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0)
- {
- bfd_byte *c;
-
- if (elf_section_data (section) == NULL)
- {
- bfd_size_type amt = sizeof (struct bfd_elf_section_data);
- section->used_by_bfd = bfd_zalloc (abfd, amt);
- if (elf_section_data (section) == NULL)
- return FALSE;
- }
- c = mips_elf_section_data (section)->u.tdata;
- if (c == NULL)
- {
- bfd_size_type size;
-
- if (section->_cooked_size != 0)
- size = section->_cooked_size;
- else
- size = section->_raw_size;
- c = bfd_zalloc (abfd, size);
- if (c == NULL)
- return FALSE;
- mips_elf_section_data (section)->u.tdata = c;
- }
-
- memcpy (c + offset, location, count);
- }
-
- return _bfd_elf_set_section_contents (abfd, section, location, offset,
- count);
-}
-
-/* This is almost identical to bfd_generic_get_... except that some
- MIPS relocations need to be handled specially. Sigh. */
-
-bfd_byte *
-_bfd_elf_mips_get_relocated_section_contents
- (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols)
-{
- /* Get enough memory to hold the stuff */
- bfd *input_bfd = link_order->u.indirect.section->owner;
- asection *input_section = link_order->u.indirect.section;
-
- long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
- arelent **reloc_vector = NULL;
- long reloc_count;
-
- if (reloc_size < 0)
- goto error_return;
-
- reloc_vector = bfd_malloc (reloc_size);
- if (reloc_vector == NULL && reloc_size != 0)
- goto error_return;
-
- /* read in the section */
- if (!bfd_get_section_contents (input_bfd, input_section, data, 0,
- input_section->_raw_size))
- goto error_return;
-
- /* We're not relaxing the section, so just copy the size info */
- input_section->_cooked_size = input_section->_raw_size;
- input_section->reloc_done = TRUE;
-
- reloc_count = bfd_canonicalize_reloc (input_bfd,
- input_section,
- reloc_vector,
- symbols);
- if (reloc_count < 0)
- goto error_return;
-
- if (reloc_count > 0)
- {
- arelent **parent;
- /* for mips */
- int gp_found;
- bfd_vma gp = 0x12345678; /* initialize just to shut gcc up */
-
- {
- struct bfd_hash_entry *h;
- struct bfd_link_hash_entry *lh;
- /* Skip all this stuff if we aren't mixing formats. */
- if (abfd && input_bfd
- && abfd->xvec == input_bfd->xvec)
- lh = 0;
- else
- {
- h = bfd_hash_lookup (&link_info->hash->table, "_gp", FALSE, FALSE);
- lh = (struct bfd_link_hash_entry *) h;
- }
- lookup:
- if (lh)
- {
- switch (lh->type)
- {
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- case bfd_link_hash_common:
- gp_found = 0;
- break;
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- gp_found = 1;
- gp = lh->u.def.value;
- break;
- case bfd_link_hash_indirect:
- case bfd_link_hash_warning:
- lh = lh->u.i.link;
- /* @@FIXME ignoring warning for now */
- goto lookup;
- case bfd_link_hash_new:
- default:
- abort ();
- }
- }
- else
- gp_found = 0;
- }
- /* end mips */
- for (parent = reloc_vector; *parent != NULL; parent++)
- {
- char *error_message = NULL;
- bfd_reloc_status_type r;
-
- /* Specific to MIPS: Deal with relocation types that require
- knowing the gp of the output bfd. */
- asymbol *sym = *(*parent)->sym_ptr_ptr;
- if (bfd_is_abs_section (sym->section) && abfd)
- {
- /* The special_function wouldn't get called anyway. */
- }
- else if (!gp_found)
- {
- /* The gp isn't there; let the special function code
- fall over on its own. */
- }
- else if ((*parent)->howto->special_function
- == _bfd_mips_elf32_gprel16_reloc)
- {
- /* bypass special_function call */
- r = _bfd_mips_elf_gprel16_with_gp (input_bfd, sym, *parent,
- input_section, relocatable,
- data, gp);
- goto skip_bfd_perform_relocation;
- }
- /* end mips specific stuff */
-
- r = bfd_perform_relocation (input_bfd, *parent, data, input_section,
- relocatable ? abfd : NULL,
- &error_message);
- skip_bfd_perform_relocation:
-
- if (relocatable)
- {
- asection *os = input_section->output_section;
-
- /* A partial link, so keep the relocs */
- os->orelocation[os->reloc_count] = *parent;
- os->reloc_count++;
- }
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- case bfd_reloc_undefined:
- if (!((*link_info->callbacks->undefined_symbol)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
- input_bfd, input_section, (*parent)->address,
- TRUE)))
- goto error_return;
- break;
- case bfd_reloc_dangerous:
- BFD_ASSERT (error_message != NULL);
- if (!((*link_info->callbacks->reloc_dangerous)
- (link_info, error_message, input_bfd, input_section,
- (*parent)->address)))
- goto error_return;
- break;
- case bfd_reloc_overflow:
- if (!((*link_info->callbacks->reloc_overflow)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
- (*parent)->howto->name, (*parent)->addend,
- input_bfd, input_section, (*parent)->address)))
- goto error_return;
- break;
- case bfd_reloc_outofrange:
- default:
- abort ();
- break;
- }
-
- }
- }
- }
- if (reloc_vector != NULL)
- free (reloc_vector);
- return data;
-
-error_return:
- if (reloc_vector != NULL)
- free (reloc_vector);
- return NULL;
-}
-
-/* Create a MIPS ELF linker hash table. */
-
-struct bfd_link_hash_table *
-_bfd_mips_elf_link_hash_table_create (bfd *abfd)
-{
- struct mips_elf_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct mips_elf_link_hash_table);
-
- ret = bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
- mips_elf_link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
-
-#if 0
- /* We no longer use this. */
- for (i = 0; i < SIZEOF_MIPS_DYNSYM_SECNAMES; i++)
- ret->dynsym_sec_strindex[i] = (bfd_size_type) -1;
-#endif
- ret->procedure_count = 0;
- ret->compact_rel_size = 0;
- ret->use_rld_obj_head = FALSE;
- ret->rld_value = 0;
- ret->mips16_stubs_seen = FALSE;
-
- return &ret->root.root;
-}
-
-/* We need to use a special link routine to handle the .reginfo and
- the .mdebug sections. We need to merge all instances of these
- sections together, not write them all out sequentially. */
-
-bfd_boolean
-_bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
-{
- asection **secpp;
- asection *o;
- struct bfd_link_order *p;
- asection *reginfo_sec, *mdebug_sec, *gptab_data_sec, *gptab_bss_sec;
- asection *rtproc_sec;
- Elf32_RegInfo reginfo;
- struct ecoff_debug_info debug;
- const struct ecoff_debug_swap *swap
- = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
- HDRR *symhdr = &debug.symbolic_header;
- void *mdebug_handle = NULL;
- asection *s;
- EXTR esym;
- unsigned int i;
- bfd_size_type amt;
-
- static const char * const secname[] =
- {
- ".text", ".init", ".fini", ".data",
- ".rodata", ".sdata", ".sbss", ".bss"
- };
- static const int sc[] =
- {
- scText, scInit, scFini, scData,
- scRData, scSData, scSBss, scBss
- };
-
- /* We'd carefully arranged the dynamic symbol indices, and then the
- generic size_dynamic_sections renumbered them out from under us.
- Rather than trying somehow to prevent the renumbering, just do
- the sort again. */
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- bfd *dynobj;
- asection *got;
- struct mips_got_info *g;
-
- /* When we resort, we must tell mips_elf_sort_hash_table what
- the lowest index it may use is. That's the number of section
- symbols we're going to add. The generic ELF linker only
- adds these symbols when building a shared object. Note that
- we count the sections after (possibly) removing the .options
- section above. */
- if (! mips_elf_sort_hash_table (info, (info->shared
- ? bfd_count_sections (abfd) + 1
- : 1)))
- return FALSE;
-
- /* Make sure we didn't grow the global .got region. */
- dynobj = elf_hash_table (info)->dynobj;
- got = mips_elf_got_section (dynobj, FALSE);
- g = mips_elf_section_data (got)->u.got_info;
-
- if (g->global_gotsym != NULL)
- BFD_ASSERT ((elf_hash_table (info)->dynsymcount
- - g->global_gotsym->dynindx)
- <= g->global_gotno);
- }
-
-#if 0
- /* We want to set the GP value for ld -r. */
- /* On IRIX5, we omit the .options section. On IRIX6, however, we
- include it, even though we don't process it quite right. (Some
- entries are supposed to be merged.) Empirically, we seem to be
- better off including it then not. */
- if (IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none)
- for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next)
- {
- if (strcmp ((*secpp)->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0)
- {
- for (p = (*secpp)->link_order_head; p != NULL; p = p->next)
- if (p->type == bfd_indirect_link_order)
- p->u.indirect.section->flags &= ~SEC_HAS_CONTENTS;
- (*secpp)->link_order_head = NULL;
- bfd_section_list_remove (abfd, secpp);
- --abfd->section_count;
-
- break;
- }
- }
-
- /* We include .MIPS.options, even though we don't process it quite right.
- (Some entries are supposed to be merged.) At IRIX6 empirically we seem
- to be better off including it than not. */
- for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next)
- {
- if (strcmp ((*secpp)->name, ".MIPS.options") == 0)
- {
- for (p = (*secpp)->link_order_head; p != NULL; p = p->next)
- if (p->type == bfd_indirect_link_order)
- p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS;
- (*secpp)->link_order_head = NULL;
- bfd_section_list_remove (abfd, secpp);
- --abfd->section_count;
-
- break;
- }
- }
-#endif
-
- /* Get a value for the GP register. */
- if (elf_gp (abfd) == 0)
- {
- struct bfd_link_hash_entry *h;
-
- h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE);
- if (h != NULL && h->type == bfd_link_hash_defined)
- elf_gp (abfd) = (h->u.def.value
- + h->u.def.section->output_section->vma
- + h->u.def.section->output_offset);
- else if (info->relocatable)
- {
- bfd_vma lo = MINUS_ONE;
-
- /* Find the GP-relative section with the lowest offset. */
- for (o = abfd->sections; o != NULL; o = o->next)
- if (o->vma < lo
- && (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL))
- lo = o->vma;
-
- /* And calculate GP relative to that. */
- elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (abfd);
- }
- else
- {
- /* If the relocate_section function needs to do a reloc
- involving the GP value, it should make a reloc_dangerous
- callback to warn that GP is not defined. */
- }
- }
-
- /* Go through the sections and collect the .reginfo and .mdebug
- information. */
- reginfo_sec = NULL;
- mdebug_sec = NULL;
- gptab_data_sec = NULL;
- gptab_bss_sec = NULL;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (strcmp (o->name, ".reginfo") == 0)
- {
- memset (&reginfo, 0, sizeof reginfo);
-
- /* We have found the .reginfo section in the output file.
- Look through all the link_orders comprising it and merge
- the information together. */
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- asection *input_section;
- bfd *input_bfd;
- Elf32_External_RegInfo ext;
- Elf32_RegInfo sub;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_data_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
- input_bfd = input_section->owner;
-
- /* The linker emulation code has probably clobbered the
- size to be zero bytes. */
- if (input_section->_raw_size == 0)
- input_section->_raw_size = sizeof (Elf32_External_RegInfo);
-
- if (! bfd_get_section_contents (input_bfd, input_section,
- &ext, 0, sizeof ext))
- return FALSE;
-
- bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub);
-
- reginfo.ri_gprmask |= sub.ri_gprmask;
- reginfo.ri_cprmask[0] |= sub.ri_cprmask[0];
- reginfo.ri_cprmask[1] |= sub.ri_cprmask[1];
- reginfo.ri_cprmask[2] |= sub.ri_cprmask[2];
- reginfo.ri_cprmask[3] |= sub.ri_cprmask[3];
-
- /* ri_gp_value is set by the function
- mips_elf32_section_processing when the section is
- finally written out. */
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &= ~SEC_HAS_CONTENTS;
- }
-
- /* Size has been set in _bfd_mips_elf_always_size_sections. */
- BFD_ASSERT(o->_raw_size == sizeof (Elf32_External_RegInfo));
-
- /* Skip this section later on (I don't think this currently
- matters, but someday it might). */
- o->link_order_head = NULL;
-
- reginfo_sec = o;
- }
-
- 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
- the information together. */
- symhdr->magic = swap->sym_magic;
- /* FIXME: What should the version stamp be? */
- symhdr->vstamp = 0;
- symhdr->ilineMax = 0;
- symhdr->cbLine = 0;
- symhdr->idnMax = 0;
- symhdr->ipdMax = 0;
- symhdr->isymMax = 0;
- symhdr->ioptMax = 0;
- symhdr->iauxMax = 0;
- symhdr->issMax = 0;
- symhdr->issExtMax = 0;
- symhdr->ifdMax = 0;
- symhdr->crfd = 0;
- symhdr->iextMax = 0;
-
- /* We accumulate the debugging information itself in the
- debug_info structure. */
- debug.line = NULL;
- debug.external_dnr = NULL;
- debug.external_pdr = NULL;
- debug.external_sym = NULL;
- debug.external_opt = NULL;
- debug.external_aux = NULL;
- debug.ss = NULL;
- debug.ssext = debug.ssext_end = NULL;
- debug.external_fdr = NULL;
- debug.external_rfd = NULL;
- debug.external_ext = debug.external_ext_end = NULL;
-
- mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info);
- if (mdebug_handle == NULL)
- return FALSE;
-
- esym.jmptbl = 0;
- esym.cobol_main = 0;
- esym.weakext = 0;
- esym.reserved = 0;
- esym.ifd = ifdNil;
- esym.asym.iss = issNil;
- esym.asym.st = stLocal;
- esym.asym.reserved = 0;
- esym.asym.index = indexNil;
- last = 0;
- for (i = 0; i < sizeof (secname) / sizeof (secname[0]); i++)
- {
- esym.asym.sc = sc[i];
- s = bfd_get_section_by_name (abfd, secname[i]);
- if (s != NULL)
- {
- esym.asym.value = s->vma;
- last = s->vma + s->_raw_size;
- }
- else
- esym.asym.value = last;
- if (!bfd_ecoff_debug_one_external (abfd, &debug, swap,
- secname[i], &esym))
- return FALSE;
- }
-
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- asection *input_section;
- bfd *input_bfd;
- const struct ecoff_debug_swap *input_swap;
- struct ecoff_debug_info input_debug;
- char *eraw_src;
- char *eraw_end;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_data_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
- input_bfd = input_section->owner;
-
- if (bfd_get_flavour (input_bfd) != bfd_target_elf_flavour
- || (get_elf_backend_data (input_bfd)
- ->elf_backend_ecoff_debug_swap) == NULL)
- {
- /* I don't know what a non MIPS ELF bfd would be
- doing with a .mdebug section, but I don't really
- want to deal with it. */
- continue;
- }
-
- input_swap = (get_elf_backend_data (input_bfd)
- ->elf_backend_ecoff_debug_swap);
-
- BFD_ASSERT (p->size == input_section->_raw_size);
-
- /* The ECOFF linking code expects that we have already
- read in the debugging information and set up an
- ecoff_debug_info structure, so we do that now. */
- if (! _bfd_mips_elf_read_ecoff_info (input_bfd, input_section,
- &input_debug))
- return FALSE;
-
- if (! (bfd_ecoff_debug_accumulate
- (mdebug_handle, abfd, &debug, swap, input_bfd,
- &input_debug, input_swap, info)))
- return FALSE;
-
- /* Loop through the external symbols. For each one with
- interesting information, try to find the symbol in
- the linker global hash table and save the information
- for the output external symbols. */
- eraw_src = input_debug.external_ext;
- eraw_end = (eraw_src
- + (input_debug.symbolic_header.iextMax
- * input_swap->external_ext_size));
- for (;
- eraw_src < eraw_end;
- eraw_src += input_swap->external_ext_size)
- {
- EXTR ext;
- const char *name;
- struct mips_elf_link_hash_entry *h;
-
- (*input_swap->swap_ext_in) (input_bfd, eraw_src, &ext);
- if (ext.asym.sc == scNil
- || ext.asym.sc == scUndefined
- || ext.asym.sc == scSUndefined)
- continue;
-
- name = input_debug.ssext + ext.asym.iss;
- h = mips_elf_link_hash_lookup (mips_elf_hash_table (info),
- name, FALSE, FALSE, TRUE);
- if (h == NULL || h->esym.ifd != -2)
- continue;
-
- if (ext.ifd != -1)
- {
- BFD_ASSERT (ext.ifd
- < input_debug.symbolic_header.ifdMax);
- ext.ifd = input_debug.ifdmap[ext.ifd];
- }
-
- h->esym = ext;
- }
-
- /* Free up the information we just read. */
- free (input_debug.line);
- free (input_debug.external_dnr);
- free (input_debug.external_pdr);
- free (input_debug.external_sym);
- free (input_debug.external_opt);
- free (input_debug.external_aux);
- free (input_debug.ss);
- free (input_debug.ssext);
- free (input_debug.external_fdr);
- free (input_debug.external_rfd);
- free (input_debug.external_ext);
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &= ~SEC_HAS_CONTENTS;
- }
-
- if (SGI_COMPAT (abfd) && info->shared)
- {
- /* Create .rtproc section. */
- rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc");
- if (rtproc_sec == NULL)
- {
- flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED | SEC_READONLY);
-
- rtproc_sec = bfd_make_section (abfd, ".rtproc");
- if (rtproc_sec == NULL
- || ! bfd_set_section_flags (abfd, rtproc_sec, flags)
- || ! bfd_set_section_alignment (abfd, rtproc_sec, 4))
- return FALSE;
- }
-
- if (! mips_elf_create_procedure_table (mdebug_handle, abfd,
- info, rtproc_sec,
- &debug))
- return FALSE;
- }
-
- /* Build the external symbol information. */
- einfo.abfd = abfd;
- einfo.info = info;
- einfo.debug = &debug;
- einfo.swap = swap;
- einfo.failed = FALSE;
- mips_elf_link_hash_traverse (mips_elf_hash_table (info),
- mips_elf_output_extsym, &einfo);
- if (einfo.failed)
- return FALSE;
-
- /* Set the size of the .mdebug section. */
- o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap);
-
- /* Skip this section later on (I don't think this currently
- matters, but someday it might). */
- o->link_order_head = NULL;
-
- mdebug_sec = o;
- }
-
- if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0)
- {
- const char *subname;
- unsigned int c;
- Elf32_gptab *tab;
- Elf32_External_gptab *ext_tab;
- unsigned int j;
-
- /* The .gptab.sdata and .gptab.sbss sections hold
- information describing how the small data area would
- change depending upon the -G switch. These sections
- not used in executables files. */
- if (! info->relocatable)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- asection *input_section;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_data_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &= ~SEC_HAS_CONTENTS;
- }
-
- /* Skip this section later on (I don't think this
- currently matters, but someday it might). */
- o->link_order_head = NULL;
-
- /* Really remove the section. */
- for (secpp = &abfd->sections;
- *secpp != o;
- secpp = &(*secpp)->next)
- ;
- bfd_section_list_remove (abfd, secpp);
- --abfd->section_count;
-
- continue;
- }
-
- /* There is one gptab for initialized data, and one for
- uninitialized data. */
- if (strcmp (o->name, ".gptab.sdata") == 0)
- gptab_data_sec = o;
- else if (strcmp (o->name, ".gptab.sbss") == 0)
- gptab_bss_sec = o;
- else
- {
- (*_bfd_error_handler)
- (_("%s: illegal section name `%s'"),
- bfd_get_filename (abfd), o->name);
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
-
- /* The linker script always combines .gptab.data and
- .gptab.sdata into .gptab.sdata, and likewise for
- .gptab.bss and .gptab.sbss. It is possible that there is
- no .sdata or .sbss section in the output file, in which
- case we must change the name of the output section. */
- subname = o->name + sizeof ".gptab" - 1;
- if (bfd_get_section_by_name (abfd, subname) == NULL)
- {
- if (o == gptab_data_sec)
- o->name = ".gptab.data";
- else
- o->name = ".gptab.bss";
- subname = o->name + sizeof ".gptab" - 1;
- BFD_ASSERT (bfd_get_section_by_name (abfd, subname) != NULL);
- }
-
- /* Set up the first entry. */
- c = 1;
- amt = c * sizeof (Elf32_gptab);
- tab = bfd_malloc (amt);
- if (tab == NULL)
- return FALSE;
- tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd);
- tab[0].gt_header.gt_unused = 0;
-
- /* Combine the input sections. */
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- asection *input_section;
- bfd *input_bfd;
- bfd_size_type size;
- unsigned long last;
- bfd_size_type gpentry;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_data_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
- input_bfd = input_section->owner;
-
- /* Combine the gptab entries for this input section one
- by one. We know that the input gptab entries are
- sorted by ascending -G value. */
- size = bfd_section_size (input_bfd, input_section);
- last = 0;
- for (gpentry = sizeof (Elf32_External_gptab);
- gpentry < size;
- gpentry += sizeof (Elf32_External_gptab))
- {
- Elf32_External_gptab ext_gptab;
- Elf32_gptab int_gptab;
- unsigned long val;
- unsigned long add;
- bfd_boolean exact;
- unsigned int look;
-
- if (! (bfd_get_section_contents
- (input_bfd, input_section, &ext_gptab, gpentry,
- sizeof (Elf32_External_gptab))))
- {
- free (tab);
- return FALSE;
- }
-
- bfd_mips_elf32_swap_gptab_in (input_bfd, &ext_gptab,
- &int_gptab);
- val = int_gptab.gt_entry.gt_g_value;
- add = int_gptab.gt_entry.gt_bytes - last;
-
- exact = FALSE;
- for (look = 1; look < c; look++)
- {
- if (tab[look].gt_entry.gt_g_value >= val)
- tab[look].gt_entry.gt_bytes += add;
-
- if (tab[look].gt_entry.gt_g_value == val)
- exact = TRUE;
- }
-
- if (! exact)
- {
- Elf32_gptab *new_tab;
- unsigned int max;
-
- /* We need a new table entry. */
- amt = (bfd_size_type) (c + 1) * sizeof (Elf32_gptab);
- new_tab = bfd_realloc (tab, amt);
- if (new_tab == NULL)
- {
- free (tab);
- return FALSE;
- }
- tab = new_tab;
- tab[c].gt_entry.gt_g_value = val;
- tab[c].gt_entry.gt_bytes = add;
-
- /* Merge in the size for the next smallest -G
- value, since that will be implied by this new
- value. */
- max = 0;
- for (look = 1; look < c; look++)
- {
- if (tab[look].gt_entry.gt_g_value < val
- && (max == 0
- || (tab[look].gt_entry.gt_g_value
- > tab[max].gt_entry.gt_g_value)))
- max = look;
- }
- if (max != 0)
- tab[c].gt_entry.gt_bytes +=
- tab[max].gt_entry.gt_bytes;
-
- ++c;
- }
-
- last = int_gptab.gt_entry.gt_bytes;
- }
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &= ~SEC_HAS_CONTENTS;
- }
-
- /* The table must be sorted by -G value. */
- if (c > 2)
- qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare);
-
- /* Swap out the table. */
- amt = (bfd_size_type) c * sizeof (Elf32_External_gptab);
- ext_tab = bfd_alloc (abfd, amt);
- if (ext_tab == NULL)
- {
- free (tab);
- return FALSE;
- }
-
- 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);
- o->contents = (bfd_byte *) ext_tab;
-
- /* Skip this section later on (I don't think this currently
- matters, but someday it might). */
- o->link_order_head = NULL;
- }
- }
-
- /* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
- return FALSE;
-
- /* Now write out the computed sections. */
-
- if (reginfo_sec != NULL)
- {
- Elf32_External_RegInfo ext;
-
- bfd_mips_elf32_swap_reginfo_out (abfd, &reginfo, &ext);
- if (! bfd_set_section_contents (abfd, reginfo_sec, &ext, 0, sizeof ext))
- return FALSE;
- }
-
- if (mdebug_sec != NULL)
- {
- BFD_ASSERT (abfd->output_has_begun);
- if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug,
- swap, info,
- mdebug_sec->filepos))
- return FALSE;
-
- bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info);
- }
-
- if (gptab_data_sec != NULL)
- {
- if (! bfd_set_section_contents (abfd, gptab_data_sec,
- gptab_data_sec->contents,
- 0, gptab_data_sec->_raw_size))
- return FALSE;
- }
-
- if (gptab_bss_sec != NULL)
- {
- if (! bfd_set_section_contents (abfd, gptab_bss_sec,
- gptab_bss_sec->contents,
- 0, gptab_bss_sec->_raw_size))
- return FALSE;
- }
-
- if (SGI_COMPAT (abfd))
- {
- rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc");
- if (rtproc_sec != NULL)
- {
- if (! bfd_set_section_contents (abfd, rtproc_sec,
- rtproc_sec->contents,
- 0, rtproc_sec->_raw_size))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Structure for saying that BFD machine EXTENSION extends BASE. */
-
-struct mips_mach_extension {
- unsigned long extension, base;
-};
-
-
-/* An array describing how BFD machines relate to one another. The entries
- are ordered topologically with MIPS I extensions listed last. */
-
-static const struct mips_mach_extension mips_mach_extensions[] = {
- /* MIPS64 extensions. */
- { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 },
- { bfd_mach_mips_sb1, bfd_mach_mipsisa64 },
-
- /* MIPS V extensions. */
- { bfd_mach_mipsisa64, bfd_mach_mips5 },
-
- /* R10000 extensions. */
- { bfd_mach_mips12000, bfd_mach_mips10000 },
-
- /* R5000 extensions. Note: the vr5500 ISA is an extension of the core
- vr5400 ISA, but doesn't include the multimedia stuff. It seems
- better to allow vr5400 and vr5500 code to be merged anyway, since
- many libraries will just use the core ISA. Perhaps we could add
- some sort of ASE flag if this ever proves a problem. */
- { bfd_mach_mips5500, bfd_mach_mips5400 },
- { bfd_mach_mips5400, bfd_mach_mips5000 },
-
- /* MIPS IV extensions. */
- { bfd_mach_mips5, bfd_mach_mips8000 },
- { bfd_mach_mips10000, bfd_mach_mips8000 },
- { bfd_mach_mips5000, bfd_mach_mips8000 },
- { bfd_mach_mips7000, bfd_mach_mips8000 },
-
- /* VR4100 extensions. */
- { bfd_mach_mips4120, bfd_mach_mips4100 },
- { bfd_mach_mips4111, bfd_mach_mips4100 },
-
- /* MIPS III extensions. */
- { bfd_mach_mips8000, bfd_mach_mips4000 },
- { bfd_mach_mips4650, bfd_mach_mips4000 },
- { bfd_mach_mips4600, bfd_mach_mips4000 },
- { bfd_mach_mips4400, bfd_mach_mips4000 },
- { bfd_mach_mips4300, bfd_mach_mips4000 },
- { bfd_mach_mips4100, bfd_mach_mips4000 },
- { bfd_mach_mips4010, bfd_mach_mips4000 },
-
- /* MIPS32 extensions. */
- { bfd_mach_mipsisa32r2, bfd_mach_mipsisa32 },
-
- /* MIPS II extensions. */
- { bfd_mach_mips4000, bfd_mach_mips6000 },
- { bfd_mach_mipsisa32, bfd_mach_mips6000 },
-
- /* MIPS I extensions. */
- { bfd_mach_mips6000, bfd_mach_mips3000 },
- { bfd_mach_mips3900, bfd_mach_mips3000 }
-};
-
-
-/* Return true if bfd machine EXTENSION is an extension of machine BASE. */
-
-static bfd_boolean
-mips_mach_extends_p (unsigned long base, unsigned long extension)
-{
- size_t i;
-
- for (i = 0; extension != base && i < ARRAY_SIZE (mips_mach_extensions); i++)
- if (extension == mips_mach_extensions[i].extension)
- extension = mips_mach_extensions[i].base;
-
- return extension == base;
-}
-
-
-/* Return true if the given ELF header flags describe a 32-bit binary. */
-
-static bfd_boolean
-mips_32bit_flags_p (flagword flags)
-{
- return ((flags & EF_MIPS_32BITMODE) != 0
- || (flags & EF_MIPS_ABI) == E_MIPS_ABI_O32
- || (flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32
- || (flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1
- || (flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2
- || (flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32
- || (flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32R2);
-}
-
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
-
-bfd_boolean
-_bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
-{
- flagword old_flags;
- flagword new_flags;
- bfd_boolean ok;
- bfd_boolean null_input_bfd = TRUE;
- asection *sec;
-
- /* Check if we have the same endianess */
- if (! _bfd_generic_verify_endian_match (ibfd, obfd))
- {
- (*_bfd_error_handler)
- (_("%s: endianness incompatible with that of the selected emulation"),
- bfd_archive_filename (ibfd));
- return FALSE;
- }
-
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
- if (strcmp (bfd_get_target (ibfd), bfd_get_target (obfd)) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: ABI is incompatible with that of the selected emulation"),
- bfd_archive_filename (ibfd));
- return FALSE;
- }
-
- new_flags = elf_elfheader (ibfd)->e_flags;
- elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER;
- old_flags = elf_elfheader (obfd)->e_flags;
-
- if (! elf_flags_init (obfd))
- {
- elf_flags_init (obfd) = TRUE;
- elf_elfheader (obfd)->e_flags = new_flags;
- elf_elfheader (obfd)->e_ident[EI_CLASS]
- = elf_elfheader (ibfd)->e_ident[EI_CLASS];
-
- if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
- && bfd_get_arch_info (obfd)->the_default)
- {
- if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
- bfd_get_mach (ibfd)))
- return FALSE;
- }
-
- return TRUE;
- }
-
- /* Check flag compatibility. */
-
- new_flags &= ~EF_MIPS_NOREORDER;
- old_flags &= ~EF_MIPS_NOREORDER;
-
- /* Some IRIX 6 BSD-compatibility objects have this bit set. It
- doesn't seem to matter. */
- new_flags &= ~EF_MIPS_XGOT;
- old_flags &= ~EF_MIPS_XGOT;
-
- /* MIPSpro generates ucode info in n64 objects. Again, we should
- just be able to ignore this. */
- new_flags &= ~EF_MIPS_UCODE;
- old_flags &= ~EF_MIPS_UCODE;
-
- if (new_flags == old_flags)
- return TRUE;
-
- /* Check to see if the input BFD actually contains any sections.
- If not, its flags may not have been initialised either, but it cannot
- actually cause any incompatibility. */
- for (sec = ibfd->sections; sec != NULL; sec = sec->next)
- {
- /* Ignore synthetic sections and empty .text, .data and .bss sections
- which are automatically generated by gas. */
- if (strcmp (sec->name, ".reginfo")
- && strcmp (sec->name, ".mdebug")
- && (sec->_raw_size != 0
- || (strcmp (sec->name, ".text")
- && strcmp (sec->name, ".data")
- && strcmp (sec->name, ".bss"))))
- {
- null_input_bfd = FALSE;
- break;
- }
- }
- if (null_input_bfd)
- return TRUE;
-
- ok = TRUE;
-
- if (((new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0)
- != ((old_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0))
- {
- (*_bfd_error_handler)
- (_("%s: warning: linking PIC files with non-PIC files"),
- bfd_archive_filename (ibfd));
- ok = TRUE;
- }
-
- if (new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC))
- elf_elfheader (obfd)->e_flags |= EF_MIPS_CPIC;
- if (! (new_flags & EF_MIPS_PIC))
- elf_elfheader (obfd)->e_flags &= ~EF_MIPS_PIC;
-
- new_flags &= ~ (EF_MIPS_PIC | EF_MIPS_CPIC);
- old_flags &= ~ (EF_MIPS_PIC | EF_MIPS_CPIC);
-
- /* Compare the ISAs. */
- if (mips_32bit_flags_p (old_flags) != mips_32bit_flags_p (new_flags))
- {
- (*_bfd_error_handler)
- (_("%s: linking 32-bit code with 64-bit code"),
- bfd_archive_filename (ibfd));
- ok = FALSE;
- }
- else if (!mips_mach_extends_p (bfd_get_mach (ibfd), bfd_get_mach (obfd)))
- {
- /* OBFD's ISA isn't the same as, or an extension of, IBFD's. */
- if (mips_mach_extends_p (bfd_get_mach (obfd), bfd_get_mach (ibfd)))
- {
- /* Copy the architecture info from IBFD to OBFD. Also copy
- the 32-bit flag (if set) so that we continue to recognise
- OBFD as a 32-bit binary. */
- bfd_set_arch_info (obfd, bfd_get_arch_info (ibfd));
- elf_elfheader (obfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
- elf_elfheader (obfd)->e_flags
- |= new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH | EF_MIPS_32BITMODE);
-
- /* Copy across the ABI flags if OBFD doesn't use them
- and if that was what caused us to treat IBFD as 32-bit. */
- if ((old_flags & EF_MIPS_ABI) == 0
- && mips_32bit_flags_p (new_flags)
- && !mips_32bit_flags_p (new_flags & ~EF_MIPS_ABI))
- elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_ABI;
- }
- else
- {
- /* The ISAs aren't compatible. */
- (*_bfd_error_handler)
- (_("%s: linking %s module with previous %s modules"),
- bfd_archive_filename (ibfd),
- bfd_printable_name (ibfd),
- bfd_printable_name (obfd));
- ok = FALSE;
- }
- }
-
- new_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH | EF_MIPS_32BITMODE);
- old_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH | EF_MIPS_32BITMODE);
-
- /* Compare ABIs. The 64-bit ABI does not use EF_MIPS_ABI. But, it
- does set EI_CLASS differently from any 32-bit ABI. */
- if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI)
- || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
- != elf_elfheader (obfd)->e_ident[EI_CLASS]))
- {
- /* Only error if both are set (to different values). */
- if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI))
- || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
- != elf_elfheader (obfd)->e_ident[EI_CLASS]))
- {
- (*_bfd_error_handler)
- (_("%s: ABI mismatch: linking %s module with previous %s modules"),
- bfd_archive_filename (ibfd),
- elf_mips_abi_name (ibfd),
- elf_mips_abi_name (obfd));
- ok = FALSE;
- }
- new_flags &= ~EF_MIPS_ABI;
- old_flags &= ~EF_MIPS_ABI;
- }
-
- /* For now, allow arbitrary mixing of ASEs (retain the union). */
- if ((new_flags & EF_MIPS_ARCH_ASE) != (old_flags & EF_MIPS_ARCH_ASE))
- {
- elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_ARCH_ASE;
-
- new_flags &= ~ EF_MIPS_ARCH_ASE;
- old_flags &= ~ EF_MIPS_ARCH_ASE;
- }
-
- /* Warn about any other mismatches */
- if (new_flags != old_flags)
- {
- (*_bfd_error_handler)
- (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
- bfd_archive_filename (ibfd), (unsigned long) new_flags,
- (unsigned long) old_flags);
- ok = FALSE;
- }
-
- if (! ok)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */
-
-bfd_boolean
-_bfd_mips_elf_set_private_flags (bfd *abfd, flagword flags)
-{
- BFD_ASSERT (!elf_flags_init (abfd)
- || elf_elfheader (abfd)->e_flags == flags);
-
- elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = TRUE;
- return TRUE;
-}
-
-bfd_boolean
-_bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr)
-{
- FILE *file = ptr;
-
- BFD_ASSERT (abfd != NULL && ptr != NULL);
-
- /* Print normal ELF private data. */
- _bfd_elf_print_private_bfd_data (abfd, ptr);
-
- /* xgettext:c-format */
- fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
-
- if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O32)
- fprintf (file, _(" [abi=O32]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O64)
- fprintf (file, _(" [abi=O64]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32)
- fprintf (file, _(" [abi=EABI32]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64)
- fprintf (file, _(" [abi=EABI64]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI))
- fprintf (file, _(" [abi unknown]"));
- else if (ABI_N32_P (abfd))
- fprintf (file, _(" [abi=N32]"));
- else if (ABI_64_P (abfd))
- fprintf (file, _(" [abi=64]"));
- else
- fprintf (file, _(" [no abi set]"));
-
- if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)
- fprintf (file, _(" [mips1]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2)
- fprintf (file, _(" [mips2]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3)
- fprintf (file, _(" [mips3]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)
- fprintf (file, _(" [mips4]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5)
- fprintf (file, _(" [mips5]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32)
- fprintf (file, _(" [mips32]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64)
- fprintf (file, _(" [mips64]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32R2)
- fprintf (file, _(" [mips32r2]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64R2)
- fprintf (file, _(" [mips64r2]"));
- else
- fprintf (file, _(" [unknown ISA]"));
-
- if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_MDMX)
- fprintf (file, _(" [mdmx]"));
-
- if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_M16)
- fprintf (file, _(" [mips16]"));
-
- if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE)
- fprintf (file, _(" [32bitmode]"));
- else
- fprintf (file, _(" [not 32bitmode]"));
-
- fputc ('\n', file);
-
- return TRUE;
-}
-
-struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]=
-{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 },
- { ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 },
- { NULL, 0, 0, 0, 0 }
-};
diff --git a/contrib/binutils/bfd/elfxx-mips.h b/contrib/binutils/bfd/elfxx-mips.h
deleted file mode 100644
index 0a684d9..0000000
--- a/contrib/binutils/bfd/elfxx-mips.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* MIPS ELF specific backend routines.
- Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "elf/common.h"
-#include "elf/internal.h"
-
-extern bfd_boolean _bfd_mips_elf_new_section_hook
- (bfd *, asection *);
-extern void _bfd_mips_elf_symbol_processing
- (bfd *, asymbol *);
-extern bfd_boolean _bfd_mips_elf_name_local_section_symbols
- (bfd *);
-extern bfd_boolean _bfd_mips_elf_section_processing
- (bfd *, Elf_Internal_Shdr *);
-extern bfd_boolean _bfd_mips_elf_section_from_shdr
- (bfd *, Elf_Internal_Shdr *, const char *);
-extern bfd_boolean _bfd_mips_elf_fake_sections
- (bfd *, Elf_Internal_Shdr *, asection *);
-extern bfd_boolean _bfd_mips_elf_section_from_bfd_section
- (bfd *, asection *, int *);
-extern bfd_boolean _bfd_mips_elf_add_symbol_hook
- (bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
- const char **, flagword *, asection **, bfd_vma *);
-extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook
- (struct bfd_link_info *, const char *, Elf_Internal_Sym *,
- asection *, struct elf_link_hash_entry *);
-extern bfd_boolean _bfd_mips_elf_create_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_mips_elf_check_relocs
- (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
-extern bfd_boolean _bfd_mips_elf_adjust_dynamic_symbol
- (struct bfd_link_info *, struct elf_link_hash_entry *);
-extern bfd_boolean _bfd_mips_elf_always_size_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_mips_elf_size_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_mips_elf_relocate_section
- (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
-extern bfd_boolean _bfd_mips_elf_finish_dynamic_symbol
- (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *);
-extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections
- (bfd *, struct bfd_link_info *);
-extern void _bfd_mips_elf_final_write_processing
- (bfd *, bfd_boolean);
-extern int _bfd_mips_elf_additional_program_headers
- (bfd *);
-extern bfd_boolean _bfd_mips_elf_modify_segment_map
- (bfd *, struct bfd_link_info *);
-extern asection * _bfd_mips_elf_gc_mark_hook
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *);
-extern bfd_boolean _bfd_mips_elf_gc_sweep_hook
- (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
-extern void _bfd_mips_elf_copy_indirect_symbol
- (const struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *);
-extern void _bfd_mips_elf_hide_symbol
- (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
-extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs
- (asection *);
-extern bfd_boolean _bfd_mips_elf_find_nearest_line
- (bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *);
-extern bfd_boolean _bfd_mips_elf_set_section_contents
- (bfd *, asection *, const void *, file_ptr, bfd_size_type);
-extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents
- (bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, asymbol **);
-extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
- (bfd *);
-extern bfd_boolean _bfd_mips_elf_final_link
- (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_mips_elf_merge_private_bfd_data
- (bfd *, bfd *);
-extern bfd_boolean _bfd_mips_elf_set_private_flags
- (bfd *, flagword);
-extern bfd_boolean _bfd_mips_elf_print_private_bfd_data
- (bfd *, void *);
-extern bfd_boolean _bfd_mips_elf_discard_info
- (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *);
-extern bfd_boolean _bfd_mips_elf_write_section
- (bfd *, asection *, bfd_byte *);
-
-extern bfd_boolean _bfd_mips_elf_read_ecoff_info
- (bfd *, asection *, struct ecoff_debug_info *);
-extern bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp
- (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
-extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-extern bfd_reloc_status_type _bfd_mips_elf_generic_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-extern unsigned long _bfd_elf_mips_mach
- (flagword);
-extern bfd_boolean _bfd_mips_relax_section
- (bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
-extern bfd_vma _bfd_mips_elf_sign_extend
- (bfd_vma, int);
-
-extern struct bfd_elf_special_section const _bfd_mips_elf_special_sections[];
-#define elf_backend_name_local_section_symbols \
- _bfd_mips_elf_name_local_section_symbols
-#define elf_backend_special_sections _bfd_mips_elf_special_sections
diff --git a/contrib/binutils/bfd/elfxx-target.h b/contrib/binutils/bfd/elfxx-target.h
deleted file mode 100644
index e250a97..0000000
--- a/contrib/binutils/bfd/elfxx-target.h
+++ /dev/null
@@ -1,748 +0,0 @@
-/* Target definitions for NN-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This structure contains everything that BFD knows about a target.
- It includes things like its byte order, name, what routines to call
- to do various operations, etc. Every BFD points to a target structure
- with its "xvec" member.
-
- There are two such structures here: one for big-endian machines and
- one for little-endian machines. */
-
-#define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup
-#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#ifndef bfd_elfNN_get_section_contents
-#define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
-#endif
-
-#define bfd_elfNN_canonicalize_dynamic_symtab \
- _bfd_elf_canonicalize_dynamic_symtab
-#ifndef bfd_elfNN_canonicalize_reloc
-#define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc
-#endif
-#ifndef bfd_elfNN_find_nearest_line
-#define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line
-#endif
-#define bfd_elfNN_read_minisymbols _bfd_elf_read_minisymbols
-#define bfd_elfNN_minisymbol_to_symbol _bfd_elf_minisymbol_to_symbol
-#define bfd_elfNN_get_dynamic_symtab_upper_bound \
- _bfd_elf_get_dynamic_symtab_upper_bound
-#define bfd_elfNN_get_lineno _bfd_elf_get_lineno
-#ifndef bfd_elfNN_get_reloc_upper_bound
-#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
-#endif
-#ifndef bfd_elfNN_get_symbol_info
-#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
-#endif
-#define bfd_elfNN_canonicalize_symtab _bfd_elf_canonicalize_symtab
-#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
-#define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
-#ifndef bfd_elfNN_new_section_hook
-#define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
-#endif
-#define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
-#ifndef bfd_elfNN_set_section_contents
-#define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
-#endif
-#define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
-#define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
-#define bfd_elfNN_write_corefile_contents _bfd_elf_write_corefile_contents
-
-#define bfd_elfNN_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-#ifndef elf_backend_got_symbol_offset
-#define elf_backend_got_symbol_offset (bfd_vma) 0
-#endif
-#ifndef elf_backend_can_refcount
-#define elf_backend_can_refcount 0
-#endif
-#ifndef elf_backend_want_got_plt
-#define elf_backend_want_got_plt 0
-#endif
-#ifndef elf_backend_plt_readonly
-#define elf_backend_plt_readonly 0
-#endif
-#ifndef elf_backend_want_plt_sym
-#define elf_backend_want_plt_sym 0
-#endif
-#ifndef elf_backend_plt_not_loaded
-#define elf_backend_plt_not_loaded 0
-#endif
-#ifndef elf_backend_plt_alignment
-#define elf_backend_plt_alignment 2
-#endif
-#ifndef elf_backend_want_dynbss
-#define elf_backend_want_dynbss 1
-#endif
-#ifndef elf_backend_want_p_paddr_set_to_zero
-#define elf_backend_want_p_paddr_set_to_zero 0
-#endif
-
-#define bfd_elfNN_bfd_debug_info_start bfd_void
-#define bfd_elfNN_bfd_debug_info_end bfd_void
-#define bfd_elfNN_bfd_debug_info_accumulate \
- ((void (*) (bfd*, struct bfd_section *)) bfd_void)
-
-#ifndef bfd_elfNN_bfd_get_relocated_section_contents
-#define bfd_elfNN_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#endif
-
-#ifndef bfd_elfNN_bfd_relax_section
-#define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
-#endif
-
-#ifndef elf_backend_can_gc_sections
-#define elf_backend_can_gc_sections 0
-#endif
-#ifndef elf_backend_can_refcount
-#define elf_backend_can_refcount 0
-#endif
-#ifndef elf_backend_want_got_sym
-#define elf_backend_want_got_sym 1
-#endif
-#ifndef elf_backend_gc_mark_hook
-#define elf_backend_gc_mark_hook NULL
-#endif
-#ifndef elf_backend_gc_sweep_hook
-#define elf_backend_gc_sweep_hook NULL
-#endif
-#ifndef bfd_elfNN_bfd_gc_sections
-#define bfd_elfNN_bfd_gc_sections bfd_elf_gc_sections
-#endif
-
-#ifndef bfd_elfNN_bfd_merge_sections
-#define bfd_elfNN_bfd_merge_sections \
- _bfd_elf_merge_sections
-#endif
-
-#ifndef bfd_elfNN_bfd_discard_group
-#define bfd_elfNN_bfd_discard_group bfd_elf_discard_group
-#endif
-
-#ifndef bfd_elfNN_bfd_make_debug_symbol
-#define bfd_elfNN_bfd_make_debug_symbol \
- ((asymbol * (*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
-#endif
-
-#ifndef bfd_elfNN_bfd_copy_private_symbol_data
-#define bfd_elfNN_bfd_copy_private_symbol_data \
- _bfd_elf_copy_private_symbol_data
-#endif
-
-#ifndef bfd_elfNN_bfd_copy_private_section_data
-#define bfd_elfNN_bfd_copy_private_section_data \
- _bfd_elf_copy_private_section_data
-#endif
-#ifndef bfd_elfNN_bfd_copy_private_bfd_data
-#define bfd_elfNN_bfd_copy_private_bfd_data \
- _bfd_elf_copy_private_bfd_data
-#endif
-#ifndef bfd_elfNN_bfd_print_private_bfd_data
-#define bfd_elfNN_bfd_print_private_bfd_data \
- _bfd_elf_print_private_bfd_data
-#endif
-#ifndef bfd_elfNN_bfd_merge_private_bfd_data
-#define bfd_elfNN_bfd_merge_private_bfd_data \
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
-#endif
-#ifndef bfd_elfNN_bfd_set_private_flags
-#define bfd_elfNN_bfd_set_private_flags \
- ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
-#endif
-#ifndef bfd_elfNN_bfd_is_local_label_name
-#define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name
-#endif
-
-#ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
-#define bfd_elfNN_get_dynamic_reloc_upper_bound \
- _bfd_elf_get_dynamic_reloc_upper_bound
-#endif
-#ifndef bfd_elfNN_canonicalize_dynamic_reloc
-#define bfd_elfNN_canonicalize_dynamic_reloc \
- _bfd_elf_canonicalize_dynamic_reloc
-#endif
-
-#ifndef bfd_elfNN_bfd_link_hash_table_free
-#define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#endif
-
-#ifdef elf_backend_relocate_section
-#ifndef bfd_elfNN_bfd_link_hash_table_create
-#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
-#endif
-#ifndef bfd_elfNN_bfd_link_add_symbols
-#define bfd_elfNN_bfd_link_add_symbols bfd_elf_link_add_symbols
-#endif
-#ifndef bfd_elfNN_bfd_final_link
-#define bfd_elfNN_bfd_final_link bfd_elf_final_link
-#endif
-#else /* ! defined (elf_backend_relocate_section) */
-/* If no backend relocate_section routine, use the generic linker.
- Note - this will prevent the port from being able to use some of
- the other features of the ELF linker, because the generic hash structure
- does not have the fields needed by the ELF linker. In particular it
- means that linking directly to S-records will not work. */
-#ifndef bfd_elfNN_bfd_link_hash_table_create
-#define bfd_elfNN_bfd_link_hash_table_create \
- _bfd_generic_link_hash_table_create
-#endif
-#ifndef bfd_elfNN_bfd_link_add_symbols
-#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#endif
-#ifndef bfd_elfNN_bfd_final_link
-#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
-#endif
-#endif /* ! defined (elf_backend_relocate_section) */
-
-#ifndef bfd_elfNN_bfd_link_just_syms
-#define bfd_elfNN_bfd_link_just_syms _bfd_elf_link_just_syms
-#endif
-
-#ifndef bfd_elfNN_bfd_link_split_section
-#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
-#endif
-
-#ifndef bfd_elfNN_archive_p
-#define bfd_elfNN_archive_p bfd_generic_archive_p
-#endif
-
-#ifndef bfd_elfNN_write_archive_contents
-#define bfd_elfNN_write_archive_contents _bfd_write_archive_contents
-#endif
-
-#ifndef bfd_elfNN_mkobject
-#define bfd_elfNN_mkobject bfd_elf_mkobject
-#endif
-
-#ifndef bfd_elfNN_mkcorefile
-#define bfd_elfNN_mkcorefile bfd_elf_mkcorefile
-#endif
-
-#ifndef bfd_elfNN_mkarchive
-#define bfd_elfNN_mkarchive _bfd_generic_mkarchive
-#endif
-
-#ifndef bfd_elfNN_print_symbol
-#define bfd_elfNN_print_symbol bfd_elf_print_symbol
-#endif
-
-#ifndef elf_symbol_leading_char
-#define elf_symbol_leading_char 0
-#endif
-
-#ifndef elf_info_to_howto
-#define elf_info_to_howto 0
-#endif
-
-#ifndef elf_info_to_howto_rel
-#define elf_info_to_howto_rel 0
-#endif
-
-#ifndef ELF_MAXPAGESIZE
- #error ELF_MAXPAGESIZE is not defined
-#define ELF_MAXPAGESIZE 1
-#endif
-
-#ifndef elf_backend_collect
-#define elf_backend_collect FALSE
-#endif
-#ifndef elf_backend_type_change_ok
-#define elf_backend_type_change_ok FALSE
-#endif
-
-#ifndef elf_backend_sym_is_global
-#define elf_backend_sym_is_global 0
-#endif
-#ifndef elf_backend_object_p
-#define elf_backend_object_p 0
-#endif
-#ifndef elf_backend_symbol_processing
-#define elf_backend_symbol_processing 0
-#endif
-#ifndef elf_backend_symbol_table_processing
-#define elf_backend_symbol_table_processing 0
-#endif
-#ifndef elf_backend_get_symbol_type
-#define elf_backend_get_symbol_type 0
-#endif
-#ifndef elf_backend_name_local_section_symbols
-#define elf_backend_name_local_section_symbols 0
-#endif
-#ifndef elf_backend_section_processing
-#define elf_backend_section_processing 0
-#endif
-#ifndef elf_backend_section_from_shdr
-#define elf_backend_section_from_shdr 0
-#endif
-#ifndef elf_backend_section_flags
-#define elf_backend_section_flags 0
-#endif
-#ifndef elf_backend_section_from_phdr
-#define elf_backend_section_from_phdr 0
-#endif
-#ifndef elf_backend_fake_sections
-#define elf_backend_fake_sections 0
-#endif
-#ifndef elf_backend_section_from_bfd_section
-#define elf_backend_section_from_bfd_section 0
-#endif
-#ifndef elf_backend_add_symbol_hook
-#define elf_backend_add_symbol_hook 0
-#endif
-#ifndef elf_backend_link_output_symbol_hook
-#define elf_backend_link_output_symbol_hook 0
-#endif
-#ifndef elf_backend_create_dynamic_sections
-#define elf_backend_create_dynamic_sections 0
-#endif
-#ifndef elf_backend_check_relocs
-#define elf_backend_check_relocs 0
-#endif
-#ifndef elf_backend_adjust_dynamic_symbol
-#define elf_backend_adjust_dynamic_symbol 0
-#endif
-#ifndef elf_backend_always_size_sections
-#define elf_backend_always_size_sections 0
-#endif
-#ifndef elf_backend_size_dynamic_sections
-#define elf_backend_size_dynamic_sections 0
-#endif
-#ifndef elf_backend_relocate_section
-#define elf_backend_relocate_section 0
-#endif
-#ifndef elf_backend_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_symbol 0
-#endif
-#ifndef elf_backend_finish_dynamic_sections
-#define elf_backend_finish_dynamic_sections 0
-#endif
-#ifndef elf_backend_begin_write_processing
-#define elf_backend_begin_write_processing 0
-#endif
-#ifndef elf_backend_final_write_processing
-#define elf_backend_final_write_processing 0
-#endif
-#ifndef elf_backend_additional_program_headers
-#define elf_backend_additional_program_headers 0
-#endif
-#ifndef elf_backend_modify_segment_map
-#define elf_backend_modify_segment_map 0
-#endif
-#ifndef elf_backend_ecoff_debug_swap
-#define elf_backend_ecoff_debug_swap 0
-#endif
-#ifndef elf_backend_bfd_from_remote_memory
-#define elf_backend_bfd_from_remote_memory _bfd_elfNN_bfd_from_remote_memory
-#endif
-#ifndef elf_backend_got_header_size
-#define elf_backend_got_header_size 0
-#endif
-#ifndef elf_backend_post_process_headers
-#define elf_backend_post_process_headers NULL
-#endif
-#ifndef elf_backend_print_symbol_all
-#define elf_backend_print_symbol_all NULL
-#endif
-#ifndef elf_backend_output_arch_syms
-#define elf_backend_output_arch_syms NULL
-#endif
-#ifndef elf_backend_copy_indirect_symbol
-#define elf_backend_copy_indirect_symbol _bfd_elf_link_hash_copy_indirect
-#endif
-#ifndef elf_backend_hide_symbol
-#define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol
-#endif
-#ifndef elf_backend_merge_symbol_attribute
-#define elf_backend_merge_symbol_attribute NULL
-#endif
-#ifndef elf_backend_emit_relocs
-#define elf_backend_emit_relocs NULL
-#endif
-#ifndef elf_backend_count_relocs
-#define elf_backend_count_relocs NULL
-#endif
-#ifndef elf_backend_grok_prstatus
-#define elf_backend_grok_prstatus NULL
-#endif
-#ifndef elf_backend_grok_psinfo
-#define elf_backend_grok_psinfo NULL
-#endif
-#ifndef elf_backend_sprintf_vma
-#define elf_backend_sprintf_vma _bfd_elf_sprintf_vma
-#endif
-#ifndef elf_backend_fprintf_vma
-#define elf_backend_fprintf_vma _bfd_elf_fprintf_vma
-#endif
-#ifndef elf_backend_reloc_type_class
-#define elf_backend_reloc_type_class _bfd_elf_reloc_type_class
-#endif
-#ifndef elf_backend_discard_info
-#define elf_backend_discard_info NULL
-#endif
-#ifndef elf_backend_ignore_discarded_relocs
-#define elf_backend_ignore_discarded_relocs NULL
-#endif
-#ifndef elf_backend_can_make_relative_eh_frame
-#define elf_backend_can_make_relative_eh_frame _bfd_elf_can_make_relative
-#endif
-#ifndef elf_backend_can_make_lsda_relative_eh_frame
-#define elf_backend_can_make_lsda_relative_eh_frame _bfd_elf_can_make_relative
-#endif
-#ifndef elf_backend_encode_eh_address
-#define elf_backend_encode_eh_address _bfd_elf_encode_eh_address
-#endif
-#ifndef elf_backend_write_section
-#define elf_backend_write_section NULL
-#endif
-#ifndef elf_backend_mips_irix_compat
-#define elf_backend_mips_irix_compat NULL
-#endif
-#ifndef elf_backend_mips_rtype_to_howto
-#define elf_backend_mips_rtype_to_howto NULL
-#endif
-
-/* Previously, backends could only use SHT_REL or SHT_RELA relocation
- sections, but not both. They defined USE_REL to indicate SHT_REL
- sections, and left it undefined to indicated SHT_RELA sections.
- For backwards compatibility, we still support this usage. */
-#ifndef USE_REL
-#define USE_REL 0
-#endif
-
-/* Use these in new code. */
-#ifndef elf_backend_may_use_rel_p
-#define elf_backend_may_use_rel_p USE_REL
-#endif
-#ifndef elf_backend_may_use_rela_p
-#define elf_backend_may_use_rela_p !USE_REL
-#endif
-#ifndef elf_backend_default_use_rela_p
-#define elf_backend_default_use_rela_p !USE_REL
-#endif
-
-#ifndef elf_backend_rela_normal
-#define elf_backend_rela_normal 0
-#endif
-
-#ifndef ELF_MACHINE_ALT1
-#define ELF_MACHINE_ALT1 0
-#endif
-
-#ifndef ELF_MACHINE_ALT2
-#define ELF_MACHINE_ALT2 0
-#endif
-
-#ifndef elf_backend_size_info
-#define elf_backend_size_info _bfd_elfNN_size_info
-#endif
-
-#ifndef elf_backend_special_sections
-#define elf_backend_special_sections NULL
-#endif
-
-#ifndef elf_backend_sign_extend_vma
-#define elf_backend_sign_extend_vma 0
-#endif
-
-extern const struct elf_size_info _bfd_elfNN_size_info;
-
-#ifndef INCLUDED_TARGET_FILE
-static const struct elf_backend_data elfNN_bed =
-{
- ELF_ARCH, /* arch */
- ELF_MACHINE_CODE, /* elf_machine_code */
- ELF_MAXPAGESIZE, /* maxpagesize */
- elf_info_to_howto,
- elf_info_to_howto_rel,
- elf_backend_sym_is_global,
- elf_backend_object_p,
- elf_backend_symbol_processing,
- elf_backend_symbol_table_processing,
- elf_backend_get_symbol_type,
- elf_backend_name_local_section_symbols,
- elf_backend_section_processing,
- elf_backend_section_from_shdr,
- elf_backend_section_flags,
- elf_backend_section_from_phdr,
- elf_backend_fake_sections,
- elf_backend_section_from_bfd_section,
- elf_backend_add_symbol_hook,
- elf_backend_link_output_symbol_hook,
- elf_backend_create_dynamic_sections,
- elf_backend_check_relocs,
- elf_backend_adjust_dynamic_symbol,
- elf_backend_always_size_sections,
- elf_backend_size_dynamic_sections,
- elf_backend_relocate_section,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections,
- elf_backend_begin_write_processing,
- elf_backend_final_write_processing,
- elf_backend_additional_program_headers,
- elf_backend_modify_segment_map,
- elf_backend_gc_mark_hook,
- elf_backend_gc_sweep_hook,
- elf_backend_post_process_headers,
- elf_backend_print_symbol_all,
- elf_backend_output_arch_syms,
- elf_backend_copy_indirect_symbol,
- elf_backend_hide_symbol,
- elf_backend_merge_symbol_attribute,
- elf_backend_emit_relocs,
- elf_backend_count_relocs,
- elf_backend_grok_prstatus,
- elf_backend_grok_psinfo,
- elf_backend_sprintf_vma,
- elf_backend_fprintf_vma,
- elf_backend_reloc_type_class,
- elf_backend_discard_info,
- elf_backend_ignore_discarded_relocs,
- elf_backend_can_make_relative_eh_frame,
- elf_backend_can_make_lsda_relative_eh_frame,
- elf_backend_encode_eh_address,
- elf_backend_write_section,
- elf_backend_mips_irix_compat,
- elf_backend_mips_rtype_to_howto,
- elf_backend_ecoff_debug_swap,
- elf_backend_bfd_from_remote_memory,
- ELF_MACHINE_ALT1,
- ELF_MACHINE_ALT2,
- &elf_backend_size_info,
- elf_backend_special_sections,
- elf_backend_got_symbol_offset,
- elf_backend_got_header_size,
- elf_backend_collect,
- elf_backend_type_change_ok,
- elf_backend_may_use_rel_p,
- elf_backend_may_use_rela_p,
- elf_backend_default_use_rela_p,
- elf_backend_rela_normal,
- elf_backend_sign_extend_vma,
- elf_backend_want_got_plt,
- elf_backend_plt_readonly,
- elf_backend_want_plt_sym,
- elf_backend_plt_not_loaded,
- elf_backend_plt_alignment,
- elf_backend_can_gc_sections,
- elf_backend_can_refcount,
- elf_backend_want_got_sym,
- elf_backend_want_dynbss,
- elf_backend_want_p_paddr_set_to_zero
-};
-#endif
-
-/* Forward declaration for use when initialising alternative_target field. */
-#ifdef TARGET_LITTLE_SYM
-extern const bfd_target TARGET_LITTLE_SYM;
-#endif
-
-#ifdef TARGET_BIG_SYM
-const bfd_target TARGET_BIG_SYM =
-{
- /* name: identify kind of target */
- TARGET_BIG_NAME,
-
- /* flavour: general indication about file */
- bfd_target_elf_flavour,
-
- /* byteorder: data is big endian */
- BFD_ENDIAN_BIG,
-
- /* header_byteorder: header is also big endian */
- BFD_ENDIAN_BIG,
-
- /* object_flags: mask of all file flags */
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
- | DYNAMIC | WP_TEXT | D_PAGED),
-
- /* section_flags: mask of all section flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
- | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
- | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
-
- /* leading_symbol_char: is the first char of a user symbol
- predictable, and if so what is it */
- elf_symbol_leading_char,
-
- /* ar_pad_char: pad character for filenames within an archive header
- FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and/or os and should be independently tunable */
- '/',
-
- /* ar_max_namelen: maximum number of characters in an archive header
- FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and should be independently tunable. The System V ABI,
- Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
- 15,
-
- /* Routines to byte-swap various sized integers from the data sections */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-
- /* Routines to byte-swap various sized integers from the file headers */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16,
-
- /* bfd_check_format: check the format of a file being read */
- { _bfd_dummy_target, /* unknown format */
- bfd_elfNN_object_p, /* assembler/linker output (object file) */
- bfd_elfNN_archive_p, /* an archive */
- bfd_elfNN_core_file_p /* a core file */
- },
-
- /* bfd_set_format: set the format of a file being written */
- { bfd_false,
- bfd_elfNN_mkobject,
- bfd_elfNN_mkarchive,
- bfd_elfNN_mkcorefile
- },
-
- /* bfd_write_contents: write cached information into a file being written */
- { bfd_false,
- bfd_elfNN_write_object_contents,
- bfd_elfNN_write_archive_contents,
- bfd_elfNN_write_corefile_contents,
- },
-
- BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
- BFD_JUMP_TABLE_COPY (bfd_elfNN),
- BFD_JUMP_TABLE_CORE (bfd_elfNN),
-#ifdef bfd_elfNN_archive_functions
- BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
-#else
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-#endif
- BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
- BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
- BFD_JUMP_TABLE_WRITE (bfd_elfNN),
- BFD_JUMP_TABLE_LINK (bfd_elfNN),
- BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
-
- /* Alternative endian target. */
-#ifdef TARGET_LITTLE_SYM
- & TARGET_LITTLE_SYM,
-#else
- NULL,
-#endif
-
- /* backend_data: */
- &elfNN_bed
-};
-#endif
-
-#ifdef TARGET_LITTLE_SYM
-const bfd_target TARGET_LITTLE_SYM =
-{
- /* name: identify kind of target */
- TARGET_LITTLE_NAME,
-
- /* flavour: general indication about file */
- bfd_target_elf_flavour,
-
- /* byteorder: data is little endian */
- BFD_ENDIAN_LITTLE,
-
- /* header_byteorder: header is also little endian */
- BFD_ENDIAN_LITTLE,
-
- /* object_flags: mask of all file flags */
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
- | DYNAMIC | WP_TEXT | D_PAGED),
-
- /* section_flags: mask of all section flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
- | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
- | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
-
- /* leading_symbol_char: is the first char of a user symbol
- predictable, and if so what is it */
- elf_symbol_leading_char,
-
- /* ar_pad_char: pad character for filenames within an archive header
- FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and/or os and should be independently tunable */
- '/',
-
- /* ar_max_namelen: maximum number of characters in an archive header
- FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and should be independently tunable. The System V ABI,
- Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
- 15,
-
- /* Routines to byte-swap various sized integers from the data sections */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
-
- /* Routines to byte-swap various sized integers from the file headers */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16,
-
- /* bfd_check_format: check the format of a file being read */
- { _bfd_dummy_target, /* unknown format */
- bfd_elfNN_object_p, /* assembler/linker output (object file) */
- bfd_elfNN_archive_p, /* an archive */
- bfd_elfNN_core_file_p /* a core file */
- },
-
- /* bfd_set_format: set the format of a file being written */
- { bfd_false,
- bfd_elfNN_mkobject,
- bfd_elfNN_mkarchive,
- bfd_elfNN_mkcorefile
- },
-
- /* bfd_write_contents: write cached information into a file being written */
- { bfd_false,
- bfd_elfNN_write_object_contents,
- bfd_elfNN_write_archive_contents,
- bfd_elfNN_write_corefile_contents,
- },
-
- BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
- BFD_JUMP_TABLE_COPY (bfd_elfNN),
- BFD_JUMP_TABLE_CORE (bfd_elfNN),
-#ifdef bfd_elfNN_archive_functions
- BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
-#else
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
-#endif
- BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
- BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
- BFD_JUMP_TABLE_WRITE (bfd_elfNN),
- BFD_JUMP_TABLE_LINK (bfd_elfNN),
- BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
-
- /* Alternative endian target. */
-#ifdef TARGET_BIG_SYM
- & TARGET_BIG_SYM,
-#else
- NULL,
-#endif
-
- /* backend_data: */
- &elfNN_bed
-};
-#endif
diff --git a/contrib/binutils/bfd/format.c b/contrib/binutils/bfd/format.c
deleted file mode 100644
index 9d9ee86..0000000
--- a/contrib/binutils/bfd/format.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/* Generic BFD support for file formats.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- File formats
-
- A format is a BFD concept of high level file contents type. The
- formats supported by BFD are:
-
- o <<bfd_object>>
-
- The BFD may contain data, symbols, relocations and debug info.
-
- o <<bfd_archive>>
-
- The BFD contains other BFDs and an optional index.
-
- o <<bfd_core>>
-
- The BFD contains the result of an executable core dump.
-
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-/* IMPORT from targets.c. */
-extern const size_t _bfd_target_vector_entries;
-
-/*
-FUNCTION
- bfd_check_format
-
-SYNOPSIS
- bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
-
-DESCRIPTION
- Verify if the file attached to the BFD @var{abfd} is compatible
- with the format @var{format} (i.e., one of <<bfd_object>>,
- <<bfd_archive>> or <<bfd_core>>).
-
- If the BFD has been set to a specific target before the
- call, only the named target and format combination is
- checked. If the target has not been set, or has been set to
- <<default>>, then all the known target backends is
- interrogated to determine a match. If the default target
- matches, it is used. If not, exactly one target must recognize
- the file, or an error results.
-
- The function returns <<TRUE>> on success, otherwise <<FALSE>>
- with one of the following error codes:
-
- o <<bfd_error_invalid_operation>> -
- if <<format>> is not one of <<bfd_object>>, <<bfd_archive>> or
- <<bfd_core>>.
-
- o <<bfd_error_system_call>> -
- if an error occured during a read - even some file mismatches
- can cause bfd_error_system_calls.
-
- o <<file_not_recognised>> -
- none of the backends recognised the file format.
-
- o <<bfd_error_file_ambiguously_recognized>> -
- more than one backend recognised the file format.
-*/
-
-bfd_boolean
-bfd_check_format (bfd *abfd, bfd_format format)
-{
- return bfd_check_format_matches (abfd, format, NULL);
-}
-
-/*
-FUNCTION
- bfd_check_format_matches
-
-SYNOPSIS
- bfd_boolean bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
-
-DESCRIPTION
- Like <<bfd_check_format>>, except when it returns FALSE with
- <<bfd_errno>> set to <<bfd_error_file_ambiguously_recognized>>. In that
- case, if @var{matching} is not NULL, it will be filled in with
- a NULL-terminated list of the names of the formats that matched,
- allocated with <<malloc>>.
- Then the user may choose a format and try again.
-
- When done with the list that @var{matching} points to, the caller
- should free it.
-*/
-
-bfd_boolean
-bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
-{
- extern const bfd_target binary_vec;
- const bfd_target * const *target;
- const bfd_target **matching_vector = NULL;
- const bfd_target *save_targ, *right_targ, *ar_right_targ;
- int match_count;
- int ar_match_index;
-
- if (!bfd_read_p (abfd)
- || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- if (abfd->format != bfd_unknown)
- return abfd->format == format;
-
- /* Since the target type was defaulted, check them
- all in the hope that one will be uniquely recognized. */
- save_targ = abfd->xvec;
- match_count = 0;
- ar_match_index = _bfd_target_vector_entries;
-
- if (matching)
- {
- bfd_size_type amt;
-
- *matching = NULL;
- amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries;
- matching_vector = bfd_malloc (amt);
- if (!matching_vector)
- return FALSE;
- }
-
- right_targ = 0;
- ar_right_targ = 0;
-
- /* Presume the answer is yes. */
- abfd->format = format;
-
- /* If the target type was explicitly specified, just check that target. */
- if (!abfd->target_defaulted)
- {
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */
- {
- if (matching)
- free (matching_vector);
- return FALSE;
- }
-
- right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
-
- if (right_targ)
- {
- abfd->xvec = right_targ; /* Set the target as returned. */
-
- if (matching)
- free (matching_vector);
-
- return TRUE; /* File position has moved, BTW. */
- }
-
- /* For a long time the code has dropped through to check all
- targets if the specified target was wrong. I don't know why,
- and I'm reluctant to change it. However, in the case of an
- archive, it can cause problems. If the specified target does
- not permit archives (e.g., the binary target), then we should
- not allow some other target to recognize it as an archive, but
- should instead allow the specified target to recognize it as an
- object. When I first made this change, it broke the PE target,
- because the specified pei-i386 target did not recognize the
- actual pe-i386 archive. Since there may be other problems of
- this sort, I changed this test to check only for the binary
- target. */
- if (format == bfd_archive && save_targ == &binary_vec)
- {
- abfd->xvec = save_targ;
- abfd->format = bfd_unknown;
-
- if (matching)
- free (matching_vector);
-
- bfd_set_error (bfd_error_file_not_recognized);
-
- return FALSE;
- }
- }
-
- for (target = bfd_target_vector; *target != NULL; target++)
- {
- const bfd_target *temp;
- bfd_error_type err;
-
- if (*target == &binary_vec)
- continue;
-
- abfd->xvec = *target; /* Change BFD's target temporarily. */
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- {
- if (matching)
- free (matching_vector);
- return FALSE;
- }
-
- /* If _bfd_check_format neglects to set bfd_error, assume
- bfd_error_wrong_format. We didn't used to even pay any
- attention to bfd_error, so I suspect that some
- _bfd_check_format might have this problem. */
- bfd_set_error (bfd_error_wrong_format);
-
- temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
-
- if (temp)
- {
- /* This format checks out as ok! */
- right_targ = temp;
-
- /* If this is the default target, accept it, even if other
- targets might match. People who want those other targets
- have to set the GNUTARGET variable. */
- if (temp == bfd_default_vector[0])
- {
- match_count = 1;
- break;
- }
-
- if (matching)
- matching_vector[match_count] = temp;
-
- match_count++;
-
-#ifdef GNU960
- /* Big- and little-endian b.out archives look the same, but it
- doesn't matter: there is no difference in their headers, and
- member file byte orders will (I hope) be handled appropriately
- by bfd. Ditto for big and little coff archives. And the 4
- coff/b.out object formats are unambiguous. So accept the
- first match we find. */
- break;
-#endif
- }
- else if ((err = bfd_get_error ()) == bfd_error_wrong_object_format
- || err == bfd_error_file_ambiguously_recognized)
- {
- /* An archive with objects of the wrong type, or an
- ambiguous match. We want this target to match if we get
- no better matches. */
- if (ar_right_targ != bfd_default_vector[0])
- ar_right_targ = *target;
- if (matching)
- matching_vector[ar_match_index] = *target;
- ar_match_index++;
- }
- else if (err != bfd_error_wrong_format)
- {
- abfd->xvec = save_targ;
- abfd->format = bfd_unknown;
-
- if (matching)
- free (matching_vector);
-
- return FALSE;
- }
- }
-
- if (match_count == 0)
- {
- /* Try partial matches. */
- right_targ = ar_right_targ;
-
- if (right_targ == bfd_default_vector[0])
- {
- match_count = 1;
- }
- else
- {
- match_count = ar_match_index - _bfd_target_vector_entries;
-
- if (matching && match_count > 1)
- memcpy (matching_vector,
- matching_vector + _bfd_target_vector_entries,
- sizeof (*matching_vector) * match_count);
- }
- }
-
- if (match_count > 1
- && bfd_associated_vector != NULL
- && matching)
- {
- const bfd_target * const *assoc = bfd_associated_vector;
-
- while ((right_targ = *assoc++) != NULL)
- {
- int i = match_count;
-
- while (--i >= 0)
- if (matching_vector[i] == right_targ)
- break;
-
- if (i >= 0)
- {
- match_count = 1;
- break;
- }
- }
- }
-
- if (match_count == 1)
- {
- abfd->xvec = right_targ; /* Change BFD's target permanently. */
-
- if (matching)
- free (matching_vector);
-
- return TRUE; /* File position has moved, BTW. */
- }
-
- abfd->xvec = save_targ; /* Restore original target type. */
- abfd->format = bfd_unknown; /* Restore original format. */
-
- if (match_count == 0)
- {
- bfd_set_error (bfd_error_file_not_recognized);
-
- if (matching)
- free (matching_vector);
- }
- else
- {
- bfd_set_error (bfd_error_file_ambiguously_recognized);
-
- if (matching)
- {
- *matching = (char **) matching_vector;
- matching_vector[match_count] = NULL;
- /* Return target names. This is a little nasty. Maybe we
- should do another bfd_malloc? */
- while (--match_count >= 0)
- {
- const char *name = matching_vector[match_count]->name;
- *(const char **) &matching_vector[match_count] = name;
- }
- }
- }
-
- return FALSE;
-}
-
-/*
-FUNCTION
- bfd_set_format
-
-SYNOPSIS
- bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
-
-DESCRIPTION
- This function sets the file format of the BFD @var{abfd} to the
- format @var{format}. If the target set in the BFD does not
- support the format requested, the format is invalid, or the BFD
- is not open for writing, then an error occurs.
-*/
-
-bfd_boolean
-bfd_set_format (bfd *abfd, bfd_format format)
-{
- if (bfd_read_p (abfd)
- || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- if (abfd->format != bfd_unknown)
- return abfd->format == format;
-
- /* Presume the answer is yes. */
- abfd->format = format;
-
- if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd)))
- {
- abfd->format = bfd_unknown;
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_format_string
-
-SYNOPSIS
- const char *bfd_format_string (bfd_format format);
-
-DESCRIPTION
- Return a pointer to a const string
- <<invalid>>, <<object>>, <<archive>>, <<core>>, or <<unknown>>,
- depending upon the value of @var{format}.
-*/
-
-const char *
-bfd_format_string (bfd_format format)
-{
- if (((int) format < (int) bfd_unknown)
- || ((int) format >= (int) bfd_type_end))
- return "invalid";
-
- switch (format)
- {
- case bfd_object:
- return "object"; /* Linker/assembler/compiler output. */
- case bfd_archive:
- return "archive"; /* Object archive file. */
- case bfd_core:
- return "core"; /* Core dump. */
- default:
- return "unknown";
- }
-}
diff --git a/contrib/binutils/bfd/freebsd.h b/contrib/binutils/bfd/freebsd.h
deleted file mode 100644
index 424484f..0000000
--- a/contrib/binutils/bfd/freebsd.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* BFD back-end definitions used by all FreeBSD targets.
- Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-/* FreeBSD ZMAGIC files never have the header in the text. */
-#define N_HEADER_IN_TEXT(x) 0
-
-/* ZMAGIC files start at offset 0. Does not apply to QMAGIC files. */
-#define TEXT_START_ADDR 0
-
-#define N_GETMAGIC_NET(exec) \
- ((exec).a_info & 0xffff)
-#define N_GETMID_NET(exec) \
- (((exec).a_info >> 16) & 0x3ff)
-#define N_GETFLAG_NET(ex) \
- (((exec).a_info >> 26) & 0x3f)
-
-#define N_MACHTYPE(exec) \
- ((enum machine_type) \
- ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETMID_NET (exec) : \
- ((exec).a_info >> 16) & 0x3ff))
-#define N_FLAGS(exec) \
- ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETFLAG_NET (exec) : \
- ((exec).a_info >> 26) & 0x3f)
-
-#define N_SET_INFO(exec, magic, type, flags) \
- ((exec).a_info = ((magic) & 0xffff) \
- | (((int)(type) & 0x3ff) << 16) \
- | (((flags) & 0x3f) << 26))
-#define N_SET_MACHTYPE(exec, machtype) \
- ((exec).a_info = \
- ((exec).a_info & 0xfb00ffff) | ((((int)(machtype))&0x3ff) << 16))
-#define N_SET_FLAGS(exec, flags) \
- ((exec).a_info = \
- ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h"
-
-/* On FreeBSD, the magic number is always in i386 (little-endian)
- format. I think. */
-#define SWAP_MAGIC(ext) bfd_getl32 (ext)
-
-#define MY_write_object_contents MY(write_object_contents)
-static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
-
-#include "aout-target.h"
-
-/* Write an object file.
- Section contents have already been written. We write the
- file header, symbols, and relocation. */
-
-static bfd_boolean
-MY(write_object_contents) (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- /* Magic number, maestro, please! */
- switch (bfd_get_arch(abfd)) {
- case bfd_arch_m68k:
- if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0)
- N_SET_MACHTYPE(*execp, M_68K4K_NETBSD);
- else
- N_SET_MACHTYPE(*execp, M_68K_NETBSD);
- break;
- case bfd_arch_sparc:
- N_SET_MACHTYPE(*execp, M_SPARC_NETBSD);
- break;
- case bfd_arch_i386:
- N_SET_MACHTYPE(*execp, M_386_NETBSD);
- break;
- case bfd_arch_ns32k:
- N_SET_MACHTYPE(*execp, M_532_NETBSD);
- break;
- default:
- N_SET_MACHTYPE(*execp, M_UNKNOWN);
- break;
- }
-
- WRITE_HEADERS(abfd, execp);
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/gen-aout.c b/contrib/binutils/bfd/gen-aout.c
deleted file mode 100644
index ea207db..0000000
--- a/contrib/binutils/bfd/gen-aout.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Generate parameters for an a.out system.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "/usr/include/a.out.h"
-#include <stdio.h>
-
-#ifndef _
-#define _(X) X
-#endif
-
-int
-main (argc, argv)
- int argc; char** argv;
-{
- struct exec my_exec;
- int page_size;
- char *target = "unknown", *arch = "unknown";
- FILE *file = fopen("gen-aout", "r");
-
- if (file == NULL) {
- fprintf(stderr, "Cannot open gen-aout!\n");
- return -1;
- }
- if (fread(&my_exec, sizeof(struct exec), 1, file) != 1) {
- fprintf(stderr, "Cannot read gen-aout!\n");
- return -1;
- }
-
- target = argv[1];
- if (target == NULL) {
- fprintf(stderr, "Usage: gen-aout target_name\n");
- exit (1);
- }
-
-#ifdef N_TXTOFF
- page_size = N_TXTOFF(my_exec);
- if (page_size == 0)
- printf("#define N_HEADER_IN_TEXT(x) 1\n");
- else
- printf("#define N_HEADER_IN_TEXT(x) 0\n");
-#endif
-
- printf("#define BYTES_IN_WORD %d\n", sizeof (int));
- if (my_exec.a_entry == 0) {
- printf("#define ENTRY_CAN_BE_ZERO\n");
- printf("#define N_SHARED_LIB(x) 0 /* Avoids warning */\n");
- }
- else {
- printf("/*#define ENTRY_CAN_BE_ZERO*/\n");
- printf("/*#define N_SHARED_LIB(x) 0*/\n");
- }
-
- printf("#define TEXT_START_ADDR %d\n", my_exec.a_entry);
-
-#ifdef PAGSIZ
- if (page_size == 0)
- page_size = PAGSIZ;
-#endif
- if (page_size != 0)
- printf("#define TARGET_PAGE_SIZE %d\n", page_size);
- else
- printf("/* #define TARGET_PAGE_SIZE ??? */\n");
- printf("#define SEGMENT_SIZE TARGET_PAGE_SIZE\n");
-
-#ifdef vax
- arch = "vax";
-#endif
-#ifdef m68k
- arch = "m68k";
-#endif
- if (arch[0] == '1')
- {
- fprintf (stderr, _("warning: preprocessor substituted architecture name inside string;"));
- fprintf (stderr, _(" fix DEFAULT_ARCH in the output file yourself\n"));
- arch = "unknown";
- }
- printf("#define DEFAULT_ARCH bfd_arch_%s\n\n", arch);
-
- printf("/* Do not \"beautify\" the CONCAT* macro args. Traditional C will not");
- printf(" remove whitespace added here, and thus will fail to concatenate");
- printf(" the tokens. */");
- printf("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target);
- printf("#define TARGETNAME \"a.out-%s\"\n\n", target);
-
- printf("#include \"bfd.h\"\n");
- printf("#include \"sysdep.h\"\n");
- printf("#include \"libbfd.h\"\n");
- printf("#include \"libaout.h\"\n");
- printf("\n#include \"aout-target.h\"\n");
-
- return 0;
-}
diff --git a/contrib/binutils/bfd/genlink.h b/contrib/binutils/bfd/genlink.h
deleted file mode 100644
index bcdc34b..0000000
--- a/contrib/binutils/bfd/genlink.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* genlink.h -- interface to the BFD generic linker
- Copyright 1993, 1994, 1996, 2002 Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef GENLINK_H
-#define GENLINK_H
-
-/* This header file is internal to BFD. It describes the internal
- structures and functions used by the BFD generic linker, in case
- any of the more specific linkers want to use or call them. Note
- that some functions, such as _bfd_generic_link_hash_table_create,
- are declared in libbfd.h, because they are expected to be widely
- used. The functions and structures in this file will probably only
- be used by a few files besides linker.c itself. In fact, this file
- is not particularly complete; I have only put in the interfaces I
- actually needed. */
-
-/* The generic linker uses a hash table which is a derived class of
- the standard linker hash table, just as the other backend specific
- linkers do. Do not confuse the generic linker hash table with the
- standard BFD linker hash table it is built upon. */
-
-/* Generic linker hash table entries. */
-
-struct generic_link_hash_entry
-{
- struct bfd_link_hash_entry root;
- /* Whether this symbol has been written out. */
- bfd_boolean written;
- /* Symbol from input BFD. */
- asymbol *sym;
-};
-
-/* Generic linker hash table. */
-
-struct generic_link_hash_table
-{
- struct bfd_link_hash_table root;
-};
-
-/* Look up an entry in a generic link hash table. */
-
-#define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \
- ((struct generic_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
-
-/* Traverse a generic link hash table. */
-
-#define _bfd_generic_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the generic link hash table from the info structure. This is
- just a cast. */
-
-#define _bfd_generic_hash_table(p) \
- ((struct generic_link_hash_table *) ((p)->hash))
-
-/* The generic linker reads in the asymbol structures for an input BFD
- and keeps them in the outsymbol and symcount fields. */
-
-#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols)
-#define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount)
-
-/* Add the symbols of input_bfd to the symbols being built for
- output_bfd. */
-extern bfd_boolean _bfd_generic_link_output_symbols
- PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
- size_t *psymalloc));
-
-/* This structure is used to pass information to
- _bfd_generic_link_write_global_symbol, which may be called via
- _bfd_generic_link_hash_traverse. */
-
-struct generic_write_global_symbol_info
-{
- struct bfd_link_info *info;
- bfd *output_bfd;
- size_t *psymalloc;
-};
-
-/* Write out a single global symbol. This is expected to be called
- via _bfd_generic_link_hash_traverse. The second argument must
- actually be a struct generic_write_global_symbol_info *. */
-extern bfd_boolean _bfd_generic_link_write_global_symbol
- PARAMS ((struct generic_link_hash_entry *, PTR));
-
-/* Generic link hash table entry creation routine. */
-struct bfd_hash_entry *_bfd_generic_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- const char *));
-
-#endif
diff --git a/contrib/binutils/bfd/hash.c b/contrib/binutils/bfd/hash.c
deleted file mode 100644
index 58fa532..0000000
--- a/contrib/binutils/bfd/hash.c
+++ /dev/null
@@ -1,734 +0,0 @@
-/* hash.c -- hash table routines for BFD
- Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Steve Chamberlain <sac@cygnus.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "objalloc.h"
-
-/*
-SECTION
- Hash Tables
-
-@cindex Hash tables
- BFD provides a simple set of hash table functions. Routines
- are provided to initialize a hash table, to free a hash table,
- to look up a string in a hash table and optionally create an
- entry for it, and to traverse a hash table. There is
- currently no routine to delete an string from a hash table.
-
- The basic hash table does not permit any data to be stored
- with a string. However, a hash table is designed to present a
- base class from which other types of hash tables may be
- derived. These derived types may store additional information
- with the string. Hash tables were implemented in this way,
- rather than simply providing a data pointer in a hash table
- entry, because they were designed for use by the linker back
- ends. The linker may create thousands of hash table entries,
- and the overhead of allocating private data and storing and
- following pointers becomes noticeable.
-
- The basic hash table code is in <<hash.c>>.
-
-@menu
-@* Creating and Freeing a Hash Table::
-@* Looking Up or Entering a String::
-@* Traversing a Hash Table::
-@* Deriving a New Hash Table Type::
-@end menu
-
-INODE
-Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables
-SUBSECTION
- Creating and freeing a hash table
-
-@findex bfd_hash_table_init
-@findex bfd_hash_table_init_n
- To create a hash table, create an instance of a <<struct
- bfd_hash_table>> (defined in <<bfd.h>>) and call
- <<bfd_hash_table_init>> (if you know approximately how many
- entries you will need, the function <<bfd_hash_table_init_n>>,
- which takes a @var{size} argument, may be used).
- <<bfd_hash_table_init>> returns <<FALSE>> if some sort of
- error occurs.
-
-@findex bfd_hash_newfunc
- The function <<bfd_hash_table_init>> take as an argument a
- function to use to create new entries. For a basic hash
- table, use the function <<bfd_hash_newfunc>>. @xref{Deriving
- a New Hash Table Type}, for why you would want to use a
- different value for this argument.
-
-@findex bfd_hash_allocate
- <<bfd_hash_table_init>> will create an objalloc which will be
- used to allocate new entries. You may allocate memory on this
- objalloc using <<bfd_hash_allocate>>.
-
-@findex bfd_hash_table_free
- Use <<bfd_hash_table_free>> to free up all the memory that has
- been allocated for a hash table. This will not free up the
- <<struct bfd_hash_table>> itself, which you must provide.
-
-INODE
-Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
-SUBSECTION
- Looking up or entering a string
-
-@findex bfd_hash_lookup
- The function <<bfd_hash_lookup>> is used both to look up a
- string in the hash table and to create a new entry.
-
- If the @var{create} argument is <<FALSE>>, <<bfd_hash_lookup>>
- will look up a string. If the string is found, it will
- returns a pointer to a <<struct bfd_hash_entry>>. If the
- string is not found in the table <<bfd_hash_lookup>> will
- return <<NULL>>. You should not modify any of the fields in
- the returns <<struct bfd_hash_entry>>.
-
- If the @var{create} argument is <<TRUE>>, the string will be
- entered into the hash table if it is not already there.
- Either way a pointer to a <<struct bfd_hash_entry>> will be
- returned, either to the existing structure or to a newly
- created one. In this case, a <<NULL>> return means that an
- error occurred.
-
- If the @var{create} argument is <<TRUE>>, and a new entry is
- created, the @var{copy} argument is used to decide whether to
- copy the string onto the hash table objalloc or not. If
- @var{copy} is passed as <<FALSE>>, you must be careful not to
- deallocate or modify the string as long as the hash table
- exists.
-
-INODE
-Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables
-SUBSECTION
- Traversing a hash table
-
-@findex bfd_hash_traverse
- The function <<bfd_hash_traverse>> may be used to traverse a
- hash table, calling a function on each element. The traversal
- is done in a random order.
-
- <<bfd_hash_traverse>> takes as arguments a function and a
- generic <<void *>> pointer. The function is called with a
- hash table entry (a <<struct bfd_hash_entry *>>) and the
- generic pointer passed to <<bfd_hash_traverse>>. The function
- must return a <<boolean>> value, which indicates whether to
- continue traversing the hash table. If the function returns
- <<FALSE>>, <<bfd_hash_traverse>> will stop the traversal and
- return immediately.
-
-INODE
-Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables
-SUBSECTION
- Deriving a new hash table type
-
- Many uses of hash tables want to store additional information
- which each entry in the hash table. Some also find it
- convenient to store additional information with the hash table
- itself. This may be done using a derived hash table.
-
- Since C is not an object oriented language, creating a derived
- hash table requires sticking together some boilerplate
- routines with a few differences specific to the type of hash
- table you want to create.
-
- An example of a derived hash table is the linker hash table.
- The structures for this are defined in <<bfdlink.h>>. The
- functions are in <<linker.c>>.
-
- You may also derive a hash table from an already derived hash
- table. For example, the a.out linker backend code uses a hash
- table derived from the linker hash table.
-
-@menu
-@* Define the Derived Structures::
-@* Write the Derived Creation Routine::
-@* Write Other Derived Routines::
-@end menu
-
-INODE
-Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type
-SUBSUBSECTION
- Define the derived structures
-
- You must define a structure for an entry in the hash table,
- and a structure for the hash table itself.
-
- The first field in the structure for an entry in the hash
- table must be of the type used for an entry in the hash table
- you are deriving from. If you are deriving from a basic hash
- table this is <<struct bfd_hash_entry>>, which is defined in
- <<bfd.h>>. The first field in the structure for the hash
- table itself must be of the type of the hash table you are
- deriving from itself. If you are deriving from a basic hash
- table, this is <<struct bfd_hash_table>>.
-
- For example, the linker hash table defines <<struct
- bfd_link_hash_entry>> (in <<bfdlink.h>>). The first field,
- <<root>>, is of type <<struct bfd_hash_entry>>. Similarly,
- the first field in <<struct bfd_link_hash_table>>, <<table>>,
- is of type <<struct bfd_hash_table>>.
-
-INODE
-Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type
-SUBSUBSECTION
- Write the derived creation routine
-
- You must write a routine which will create and initialize an
- entry in the hash table. This routine is passed as the
- function argument to <<bfd_hash_table_init>>.
-
- In order to permit other hash tables to be derived from the
- hash table you are creating, this routine must be written in a
- standard way.
-
- The first argument to the creation routine is a pointer to a
- hash table entry. This may be <<NULL>>, in which case the
- routine should allocate the right amount of space. Otherwise
- the space has already been allocated by a hash table type
- derived from this one.
-
- After allocating space, the creation routine must call the
- creation routine of the hash table type it is derived from,
- passing in a pointer to the space it just allocated. This
- will initialize any fields used by the base hash table.
-
- Finally the creation routine must initialize any local fields
- for the new hash table type.
-
- Here is a boilerplate example of a creation routine.
- @var{function_name} is the name of the routine.
- @var{entry_type} is the type of an entry in the hash table you
- are creating. @var{base_newfunc} is the name of the creation
- routine of the hash table type your hash table is derived
- from.
-
-EXAMPLE
-
-.struct bfd_hash_entry *
-.@var{function_name} (entry, table, string)
-. struct bfd_hash_entry *entry;
-. struct bfd_hash_table *table;
-. const char *string;
-.{
-. struct @var{entry_type} *ret = (@var{entry_type} *) entry;
-.
-. {* Allocate the structure if it has not already been allocated by a
-. derived class. *}
-. if (ret == (@var{entry_type} *) NULL)
-. {
-. ret = ((@var{entry_type} *)
-. bfd_hash_allocate (table, sizeof (@var{entry_type})));
-. if (ret == (@var{entry_type} *) NULL)
-. return NULL;
-. }
-.
-. {* Call the allocation method of the base class. *}
-. ret = ((@var{entry_type} *)
-. @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string));
-.
-. {* Initialize the local fields here. *}
-.
-. return (struct bfd_hash_entry *) ret;
-.}
-
-DESCRIPTION
- The creation routine for the linker hash table, which is in
- <<linker.c>>, looks just like this example.
- @var{function_name} is <<_bfd_link_hash_newfunc>>.
- @var{entry_type} is <<struct bfd_link_hash_entry>>.
- @var{base_newfunc} is <<bfd_hash_newfunc>>, the creation
- routine for a basic hash table.
-
- <<_bfd_link_hash_newfunc>> also initializes the local fields
- in a linker hash table entry: <<type>>, <<written>> and
- <<next>>.
-
-INODE
-Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type
-SUBSUBSECTION
- Write other derived routines
-
- You will want to write other routines for your new hash table,
- as well.
-
- You will want an initialization routine which calls the
- initialization routine of the hash table you are deriving from
- and initializes any other local fields. For the linker hash
- table, this is <<_bfd_link_hash_table_init>> in <<linker.c>>.
-
- You will want a lookup routine which calls the lookup routine
- of the hash table you are deriving from and casts the result.
- The linker hash table uses <<bfd_link_hash_lookup>> in
- <<linker.c>> (this actually takes an additional argument which
- it uses to decide how to return the looked up value).
-
- You may want a traversal routine. This should just call the
- traversal routine of the hash table you are deriving from with
- appropriate casts. The linker hash table uses
- <<bfd_link_hash_traverse>> in <<linker.c>>.
-
- These routines may simply be defined as macros. For example,
- the a.out backend linker hash table, which is derived from the
- linker hash table, uses macros for the lookup and traversal
- routines. These are <<aout_link_hash_lookup>> and
- <<aout_link_hash_traverse>> in aoutx.h.
-*/
-
-/* The default number of entries to use when creating a hash table. */
-#define DEFAULT_SIZE (4051)
-
-/* Create a new hash table, given a number of entries. */
-
-bfd_boolean
-bfd_hash_table_init_n (table, newfunc, size)
- struct bfd_hash_table *table;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
- unsigned int size;
-{
- unsigned int alloc;
-
- alloc = size * sizeof (struct bfd_hash_entry *);
-
- table->memory = (PTR) objalloc_create ();
- if (table->memory == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- table->table = ((struct bfd_hash_entry **)
- objalloc_alloc ((struct objalloc *) table->memory, alloc));
- if (table->table == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
- memset ((PTR) table->table, 0, alloc);
- table->size = size;
- table->newfunc = newfunc;
- return TRUE;
-}
-
-/* Create a new hash table with the default number of entries. */
-
-bfd_boolean
-bfd_hash_table_init (table, newfunc)
- struct bfd_hash_table *table;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
-{
- return bfd_hash_table_init_n (table, newfunc, DEFAULT_SIZE);
-}
-
-/* Free a hash table. */
-
-void
-bfd_hash_table_free (table)
- struct bfd_hash_table *table;
-{
- objalloc_free ((struct objalloc *) table->memory);
- table->memory = NULL;
-}
-
-/* Look up a string in a hash table. */
-
-struct bfd_hash_entry *
-bfd_hash_lookup (table, string, create, copy)
- struct bfd_hash_table *table;
- const char *string;
- bfd_boolean create;
- bfd_boolean copy;
-{
- register const unsigned char *s;
- register unsigned long hash;
- register unsigned int c;
- struct bfd_hash_entry *hashp;
- unsigned int len;
- unsigned int index;
-
- hash = 0;
- len = 0;
- s = (const unsigned char *) string;
- while ((c = *s++) != '\0')
- {
- hash += c + (c << 17);
- hash ^= hash >> 2;
- }
- len = (s - (const unsigned char *) string) - 1;
- hash += len + (len << 17);
- hash ^= hash >> 2;
-
- index = hash % table->size;
- for (hashp = table->table[index];
- hashp != (struct bfd_hash_entry *) NULL;
- hashp = hashp->next)
- {
- if (hashp->hash == hash
- && strcmp (hashp->string, string) == 0)
- return hashp;
- }
-
- if (! create)
- return (struct bfd_hash_entry *) NULL;
-
- hashp = (*table->newfunc) ((struct bfd_hash_entry *) NULL, table, string);
- if (hashp == (struct bfd_hash_entry *) NULL)
- return (struct bfd_hash_entry *) NULL;
- if (copy)
- {
- char *new;
-
- new = (char *) objalloc_alloc ((struct objalloc *) table->memory,
- len + 1);
- if (!new)
- {
- bfd_set_error (bfd_error_no_memory);
- return (struct bfd_hash_entry *) NULL;
- }
- memcpy (new, string, len + 1);
- string = new;
- }
- hashp->string = string;
- hashp->hash = hash;
- hashp->next = table->table[index];
- table->table[index] = hashp;
-
- return hashp;
-}
-
-/* Replace an entry in a hash table. */
-
-void
-bfd_hash_replace (table, old, nw)
- struct bfd_hash_table *table;
- struct bfd_hash_entry *old;
- struct bfd_hash_entry *nw;
-{
- unsigned int index;
- struct bfd_hash_entry **pph;
-
- index = old->hash % table->size;
- for (pph = &table->table[index];
- (*pph) != (struct bfd_hash_entry *) NULL;
- pph = &(*pph)->next)
- {
- if (*pph == old)
- {
- *pph = nw;
- return;
- }
- }
-
- abort ();
-}
-
-/* Base method for creating a new hash table entry. */
-
-struct bfd_hash_entry *
-bfd_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string ATTRIBUTE_UNUSED;
-{
- if (entry == (struct bfd_hash_entry *) NULL)
- entry = ((struct bfd_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct bfd_hash_entry)));
- return entry;
-}
-
-/* Allocate space in a hash table. */
-
-PTR
-bfd_hash_allocate (table, size)
- struct bfd_hash_table *table;
- unsigned int size;
-{
- PTR ret;
-
- ret = objalloc_alloc ((struct objalloc *) table->memory, size);
- if (ret == NULL && size != 0)
- bfd_set_error (bfd_error_no_memory);
- return ret;
-}
-
-/* Traverse a hash table. */
-
-void
-bfd_hash_traverse (table, func, info)
- struct bfd_hash_table *table;
- bfd_boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
- PTR info;
-{
- unsigned int i;
-
- for (i = 0; i < table->size; i++)
- {
- struct bfd_hash_entry *p;
-
- for (p = table->table[i]; p != NULL; p = p->next)
- {
- if (! (*func) (p, info))
- return;
- }
- }
-}
-
-/* A few different object file formats (a.out, COFF, ELF) use a string
- table. These functions support adding strings to a string table,
- returning the byte offset, and writing out the table.
-
- Possible improvements:
- + look for strings matching trailing substrings of other strings
- + better data structures? balanced trees?
- + look at reducing memory use elsewhere -- maybe if we didn't have
- to construct the entire symbol table at once, we could get by
- with smaller amounts of VM? (What effect does that have on the
- string table reductions?) */
-
-/* An entry in the strtab hash table. */
-
-struct strtab_hash_entry
-{
- struct bfd_hash_entry root;
- /* Index in string table. */
- bfd_size_type index;
- /* Next string in strtab. */
- struct strtab_hash_entry *next;
-};
-
-/* The strtab hash table. */
-
-struct bfd_strtab_hash
-{
- struct bfd_hash_table table;
- /* Size of strtab--also next available index. */
- bfd_size_type size;
- /* First string in strtab. */
- struct strtab_hash_entry *first;
- /* Last string in strtab. */
- struct strtab_hash_entry *last;
- /* Whether to precede strings with a two byte length, as in the
- XCOFF .debug section. */
- bfd_boolean xcoff;
-};
-
-static struct bfd_hash_entry *strtab_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-
-/* Routine to create an entry in a strtab. */
-
-static struct bfd_hash_entry *
-strtab_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct strtab_hash_entry *) NULL)
- ret = ((struct strtab_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct strtab_hash_entry)));
- if (ret == (struct strtab_hash_entry *) NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct strtab_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
- if (ret)
- {
- /* Initialize the local fields. */
- ret->index = (bfd_size_type) -1;
- ret->next = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Look up an entry in an strtab. */
-
-#define strtab_hash_lookup(t, string, create, copy) \
- ((struct strtab_hash_entry *) \
- bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
-
-/* Create a new strtab. */
-
-struct bfd_strtab_hash *
-_bfd_stringtab_init ()
-{
- struct bfd_strtab_hash *table;
- bfd_size_type amt = sizeof (struct bfd_strtab_hash);
-
- table = (struct bfd_strtab_hash *) bfd_malloc (amt);
- if (table == NULL)
- return NULL;
-
- if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
- {
- free (table);
- return NULL;
- }
-
- table->size = 0;
- table->first = NULL;
- table->last = NULL;
- table->xcoff = FALSE;
-
- return table;
-}
-
-/* Create a new strtab in which the strings are output in the format
- used in the XCOFF .debug section: a two byte length precedes each
- string. */
-
-struct bfd_strtab_hash *
-_bfd_xcoff_stringtab_init ()
-{
- struct bfd_strtab_hash *ret;
-
- ret = _bfd_stringtab_init ();
- if (ret != NULL)
- ret->xcoff = TRUE;
- return ret;
-}
-
-/* Free a strtab. */
-
-void
-_bfd_stringtab_free (table)
- struct bfd_strtab_hash *table;
-{
- bfd_hash_table_free (&table->table);
- free (table);
-}
-
-/* Get the index of a string in a strtab, adding it if it is not
- already present. If HASH is FALSE, we don't really use the hash
- table, and we don't eliminate duplicate strings. */
-
-bfd_size_type
-_bfd_stringtab_add (tab, str, hash, copy)
- struct bfd_strtab_hash *tab;
- const char *str;
- bfd_boolean hash;
- bfd_boolean copy;
-{
- register struct strtab_hash_entry *entry;
-
- if (hash)
- {
- entry = strtab_hash_lookup (tab, str, TRUE, copy);
- if (entry == NULL)
- return (bfd_size_type) -1;
- }
- else
- {
- entry = ((struct strtab_hash_entry *)
- bfd_hash_allocate (&tab->table,
- sizeof (struct strtab_hash_entry)));
- if (entry == NULL)
- return (bfd_size_type) -1;
- if (! copy)
- entry->root.string = str;
- else
- {
- char *n;
-
- n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
- if (n == NULL)
- return (bfd_size_type) -1;
- entry->root.string = n;
- }
- entry->index = (bfd_size_type) -1;
- entry->next = NULL;
- }
-
- if (entry->index == (bfd_size_type) -1)
- {
- entry->index = tab->size;
- tab->size += strlen (str) + 1;
- if (tab->xcoff)
- {
- entry->index += 2;
- tab->size += 2;
- }
- if (tab->first == NULL)
- tab->first = entry;
- else
- tab->last->next = entry;
- tab->last = entry;
- }
-
- return entry->index;
-}
-
-/* Get the number of bytes in a strtab. */
-
-bfd_size_type
-_bfd_stringtab_size (tab)
- struct bfd_strtab_hash *tab;
-{
- return tab->size;
-}
-
-/* Write out a strtab. ABFD must already be at the right location in
- the file. */
-
-bfd_boolean
-_bfd_stringtab_emit (abfd, tab)
- register bfd *abfd;
- struct bfd_strtab_hash *tab;
-{
- register bfd_boolean xcoff;
- register struct strtab_hash_entry *entry;
-
- xcoff = tab->xcoff;
-
- for (entry = tab->first; entry != NULL; entry = entry->next)
- {
- const char *str;
- size_t len;
-
- str = entry->root.string;
- len = strlen (str) + 1;
-
- if (xcoff)
- {
- bfd_byte buf[2];
-
- /* The output length includes the null byte. */
- bfd_put_16 (abfd, (bfd_vma) len, buf);
- if (bfd_bwrite ((PTR) buf, (bfd_size_type) 2, abfd) != 2)
- return FALSE;
- }
-
- if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/host-aout.c b/contrib/binutils/bfd/host-aout.c
deleted file mode 100644
index 5cbb5df..0000000
--- a/contrib/binutils/bfd/host-aout.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* BFD backend for local host's a.out binaries
- Copyright 1990, 1991, 1992, 1994, 1995, 2001
- Free Software Foundation, Inc.
- Written by Cygnus Support. Probably John Gilmore's fault.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#define ARCH_SIZE 32
-
-/* When porting to a new system, you must supply:
-
- HOST_PAGE_SIZE (optional)
- HOST_SEGMENT_SIZE (optional -- defaults to page size)
- HOST_MACHINE_ARCH (optional)
- HOST_MACHINE_MACHINE (optional)
- HOST_TEXT_START_ADDR (optional)
- HOST_STACK_END_ADDR (not used, except by trad-core ???)
- HOST_BIG_ENDIAN_P (required -- define if big-endian)
-
- in the ./hosts/h-systemname.h file. */
-
-#ifdef TRAD_HEADER
-#include TRAD_HEADER
-#endif
-
-#ifdef HOST_PAGE_SIZE
-#define TARGET_PAGE_SIZE HOST_PAGE_SIZE
-#endif
-
-#ifdef HOST_SEGMENT_SIZE
-#define SEGMENT_SIZE HOST_SEGMENT_SIZE
-#else
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#endif
-
-#ifdef HOST_TEXT_START_ADDR
-#define TEXT_START_ADDR HOST_TEXT_START_ADDR
-#endif
-
-#ifdef HOST_STACK_END_ADDR
-#define STACK_END_ADDR HOST_STACK_END_ADDR
-#endif
-
-#ifdef HOST_BIG_ENDIAN_P
-#define TARGET_IS_BIG_ENDIAN_P
-#else
-#undef TARGET_IS_BIG_ENDIAN_P
-#endif
-
-#include "libaout.h" /* BFD a.out internal data structures */
-#include "aout/aout64.h"
-
-#ifdef HOST_MACHINE_ARCH
-#ifdef HOST_MACHINE_MACHINE
-#define SET_ARCH_MACH(abfd, execp) \
- bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, HOST_MACHINE_MACHINE)
-#else
-#define SET_ARCH_MACH(abfd, execp) \
- bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, 0)
-#endif
-#endif /* HOST_MACHINE_ARCH */
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (host_aout_,OP)
-#define TARGETNAME "a.out"
-
-#include "aout-target.h"
diff --git a/contrib/binutils/bfd/hosts/alphalinux.h b/contrib/binutils/bfd/hosts/alphalinux.h
deleted file mode 100644
index 09b8d69..0000000
--- a/contrib/binutils/bfd/hosts/alphalinux.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Linux dumps "struct task_struct" at the end of the core-file. This
- structure is currently 1080 bytes long, but we allow up to 4096
- bytes to allow for some future growth. */
-#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096
-#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
- ((abfd)->tdata.trad_core_data->u.signal)
diff --git a/contrib/binutils/bfd/hosts/decstation.h b/contrib/binutils/bfd/hosts/decstation.h
deleted file mode 100644
index a80c143..0000000
--- a/contrib/binutils/bfd/hosts/decstation.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Hopefully this should include either machine/param.h (Ultrix) or
- machine/machparam.h (Mach), whichever is its name on this system. */
-#include <sys/param.h>
-
-#include <machine/vmparam.h>
-
-#define HOST_PAGE_SIZE NBPG
-/* #define HOST_SEGMENT_SIZE NBPG -- we use HOST_DATA_START_ADDR */
-#define HOST_MACHINE_ARCH bfd_arch_mips
-/* #define HOST_MACHINE_MACHINE */
-
-#define HOST_TEXT_START_ADDR USRTEXT
-#define HOST_DATA_START_ADDR USRDATA
-#define HOST_STACK_END_ADDR USRSTACK
-
-#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
- ((core_bfd)->tdata.trad_core_data->u.u_arg[0])
diff --git a/contrib/binutils/bfd/hosts/i386bsd.h b/contrib/binutils/bfd/hosts/i386bsd.h
deleted file mode 100644
index 8eee3d8..0000000
--- a/contrib/binutils/bfd/hosts/i386bsd.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Intel 386 running any BSD Unix */
-
-#include <machine/param.h>
-#include <machine/vmparam.h>
-
-/* Recent versions of FreeBSD don't define NBPG. */
-#ifndef NBPG
-#ifdef PAGE_SIZE
-#define NBPG PAGE_SIZE
-#endif
-#endif
-
-#define HOST_PAGE_SIZE NBPG
-#define HOST_MACHINE_ARCH bfd_arch_i386
-#define HOST_TEXT_START_ADDR USRTEXT
-
-/* Jolitz suggested defining HOST_STACK_END_ADDR to
- (u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on
- both BSDI and 386BSD, but that is believed not to work for BSD 4.4. */
-
-#ifdef __bsdi__
-/* This seems to be the right thing for BSDI. */
-#define HOST_STACK_END_ADDR USRSTACK
-#define HOST_DATA_START_ADDR ((bfd_vma)u.u_kproc.kp_eproc.e_vm.vm_daddr)
-#else
-/* This seems to be the right thing for 386BSD release 0.1. */
-#define HOST_STACK_END_ADDR (USRSTACK - MAXSSIZ)
-#endif
-
-#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
- ((core_bfd)->tdata.trad_core_data->u.u_sig)
-#define u_comm u_kproc.kp_proc.p_comm
diff --git a/contrib/binutils/bfd/hosts/i386linux.h b/contrib/binutils/bfd/hosts/i386linux.h
deleted file mode 100644
index 13a51f1..0000000
--- a/contrib/binutils/bfd/hosts/i386linux.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Linux writes the task structure at the end of the core file. Currently it
- is 2912 bytes. It is possible that this should be a pickier check, but
- we should probably not be too picky (the size of the task structure might
- vary, and if it's not the length we expect it to be, it doesn't affect
- our ability to process the core file). So allow 0-4096 extra bytes at
- the end. */
-
-#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096
diff --git a/contrib/binutils/bfd/hosts/i386sco.h b/contrib/binutils/bfd/hosts/i386sco.h
deleted file mode 100644
index ec8608c..0000000
--- a/contrib/binutils/bfd/hosts/i386sco.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Core file stuff. At least some, perhaps all, of the following
- defines work on many more systems than just SCO. */
-
-#define NBPG NBPC
-#define UPAGES USIZE
-#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg
-#define HOST_STACK_START_ADDR u.u_sub
-#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
- ((core_upage(abfd)->u_sysabort != 0) \
- ? core_upage(abfd)->u_sysabort \
- : -1)
-
-/* According to the manpage, a version 2 SCO corefile can contain
- various additional sections (it is cleverly arranged so the u area,
- data, and stack are first where we can find them). So without
- writing lots of code to parse all their headers and stuff, we can't
- know whether a corefile is bigger than it should be. */
-
-#define TRAD_CORE_ALLOW_ANY_EXTRA_SIZE 1
diff --git a/contrib/binutils/bfd/hosts/mipsbsd.h b/contrib/binutils/bfd/hosts/mipsbsd.h
deleted file mode 100644
index a2fad21..0000000
--- a/contrib/binutils/bfd/hosts/mipsbsd.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <machine/param.h>
-#include <machine/vmparam.h>
-#undef ALIGN
-
-#define HOST_PAGE_SIZE NBPG
-/* #define HOST_SEGMENT_SIZE NBPG -- we use HOST_DATA_START_ADDR */
-#define HOST_MACHINE_ARCH bfd_arch_mips
-/* #define HOST_MACHINE_MACHINE */
-
-#define HOST_TEXT_START_ADDR USRTEXT
-#define HOST_STACK_END_ADDR USRSTACK
-#define NO_CORE_COMMAND
diff --git a/contrib/binutils/bfd/hosts/mipsmach3.h b/contrib/binutils/bfd/hosts/mipsmach3.h
deleted file mode 100644
index c5c468d..0000000
--- a/contrib/binutils/bfd/hosts/mipsmach3.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <machine/vmparam.h>
-#include <machine/machparam.h>
-#include <sys/param.h>
-
-#define HOST_PAGE_SIZE NBPG
-/* #define HOST_SEGMENT_SIZE NBPG */
-#define HOST_MACHINE_ARCH bfd_arch_mips
-#define HOST_TEXT_START_ADDR USRTEXT
-#define HOST_DATA_START_ADDR USRDATA
-#define HOST_STACK_END_ADDR USRSTACK
diff --git a/contrib/binutils/bfd/hosts/news-mips.h b/contrib/binutils/bfd/hosts/news-mips.h
deleted file mode 100644
index 9e799be..0000000
--- a/contrib/binutils/bfd/hosts/news-mips.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Sony News running NewsOS 3.2. */
-
-#include <sys/param.h>
-#include <machine/vmparam.h>
-
-#define HOST_PAGE_SIZE NBPG
-
-#define HOST_MACHINE_ARCH bfd_arch_mips
-
-#define HOST_TEXT_START_ADDR USRTEXT
-#define HOST_DATA_START_ADDR USRDATA
-#define HOST_STACK_END_ADDR USRSTACK
diff --git a/contrib/binutils/bfd/i386aout.c b/contrib/binutils/bfd/i386aout.c
deleted file mode 100644
index 6b2948e..0000000
--- a/contrib/binutils/bfd/i386aout.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* BFD back-end for i386 a.out binaries.
- Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-
-/* The only 386 aout system we have here is GO32 from DJ.
- These numbers make BFD work with that. If your aout 386 system
- doesn't work with these, we'll have to split them into different
- files. Send me (sac@cygnus.com) the runes to make it work on your
- system, and I'll stick it in for the next release. */
-
-#define N_HEADER_IN_TEXT(x) 0
-
-#define N_TXTOFF(x) 0x20
-#define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0)
-
-#define N_TXTSIZE(x) ((x).a_text)
-#if 0
-#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1))))
-#define NOSUBEXECB
-
-#endif
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE 0x400000
-#define DEFAULT_ARCH bfd_arch_i386
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (i386aout_,OP)
-#define TARGETNAME "a.out-i386"
-#define NO_WRITE_HEADER_KLUDGE 1
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/aout64.h"
-#include "libaout.h"
-
-static bfd_boolean i386aout_write_object_contents PARAMS ((bfd *));
-static bfd_boolean MY (set_sizes) PARAMS ((bfd *));
-
-/* Set the machine type correctly. */
-
-static bfd_boolean
-i386aout_write_object_contents (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- N_SET_MACHTYPE (*execp, M_386);
-
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- WRITE_HEADERS (abfd, execp);
-
- return TRUE;
-}
-
-#define MY_write_object_contents i386aout_write_object_contents
-
-#define MY_backend_data &MY(backend_data)
-static const struct aout_backend_data MY(backend_data) = {
- 0, /* zmagic contiguous */
- 1, /* text incl header */
- 0, /* entry is text address */
- 0, /* exec_hdr_flags */
- 0, /* text vma? */
- MY(set_sizes),
- 1, /* exec header not counted */
- 0, /* add_dynamic_symbols */
- 0, /* add_one_symbol */
- 0, /* link_dynamic_object */
- 0, /* write_dynamic_symbol */
- 0, /* check_dynamic_reloc */
- 0 /* finish_dynamic_link */
-};
-
-#include "aout-target.h"
diff --git a/contrib/binutils/bfd/i386bsd.c b/contrib/binutils/bfd/i386bsd.c
deleted file mode 100644
index e21a9ca..0000000
--- a/contrib/binutils/bfd/i386bsd.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* BFD back-end for i386 a.out binaries under BSD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2001
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This data should be correct for the format used under all the various
- BSD ports for 386 machines. */
-
-#define BYTES_IN_WORD 4
-
-/* ZMAGIC files never have the header in the text. */
-#define N_HEADER_IN_TEXT(x) 0
-
-/* ZMAGIC files start at address 0. This does not apply to QMAGIC. */
-#define TEXT_START_ADDR 0
-#define N_SHARED_LIB(x) 0
-
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-
-#define DEFAULT_ARCH bfd_arch_i386
-#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (i386bsd_,OP)
-#define TARGETNAME "a.out-i386-bsd"
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h"
-
-#include "aout-target.h"
diff --git a/contrib/binutils/bfd/i386freebsd.c b/contrib/binutils/bfd/i386freebsd.c
deleted file mode 100644
index 73fa0ca..0000000
--- a/contrib/binutils/bfd/i386freebsd.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* BFD back-end for FreeBSD/386 a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1996, 2001 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define BYTES_IN_WORD 4
-#undef TARGET_IS_BIG_ENDIAN_P
-
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-
-#define DEFAULT_ARCH bfd_arch_i386
-#define MACHTYPE_OK(mtype) ((mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN)
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (i386freebsd_,OP)
-
-/* This needs to start with a.out so GDB knows it is an a.out variant. */
-#define TARGETNAME "a.out-i386-freebsd"
-
-#include "freebsd.h"
diff --git a/contrib/binutils/bfd/i386linux.c b/contrib/binutils/bfd/i386linux.c
deleted file mode 100644
index da36e75..0000000
--- a/contrib/binutils/bfd/i386linux.c
+++ /dev/null
@@ -1,776 +0,0 @@
-/* BFD back-end for linux flavored i386 a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_PAGE_SIZE 4096
-#define ZMAGIC_DISK_BLOCK_SIZE 1024
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define TEXT_START_ADDR 0x0
-#define N_SHARED_LIB(x) 0
-
-#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#define DEFAULT_ARCH bfd_arch_i386
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (i386linux_,OP)
-#define TARGETNAME "a.out-i386-linux"
-
-extern const bfd_target MY(vec);
-
-/* We always generate QMAGIC files in preference to ZMAGIC files. It
- would be possible to make this a linker option, if that ever
- becomes important. */
-
-static void MY_final_link_callback
- PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
-static bfd_boolean i386linux_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean i386linux_write_object_contents PARAMS ((bfd *));
-
-static bfd_boolean
-i386linux_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- obj_aout_subformat (abfd) = q_magic_format;
- return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
-}
-
-#define MY_bfd_final_link i386linux_bfd_final_link
-
-/* Set the machine type correctly. */
-
-static bfd_boolean
-i386linux_write_object_contents (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- N_SET_MACHTYPE (*execp, M_386);
-
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- WRITE_HEADERS(abfd, execp);
-
- return TRUE;
-}
-
-#define MY_write_object_contents i386linux_write_object_contents
-
-/* Code to link against Linux a.out shared libraries. */
-
-/* See if a symbol name is a reference to the global offset table. */
-
-#ifndef GOT_REF_PREFIX
-#define GOT_REF_PREFIX "__GOT_"
-#endif
-
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
-
-/* See if a symbol name is a reference to the procedure linkage table. */
-
-#ifndef PLT_REF_PREFIX
-#define PLT_REF_PREFIX "__PLT_"
-#endif
-
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
-
-/* This string is used to generate specialized error messages. */
-
-#ifndef NEEDS_SHRLIB
-#define NEEDS_SHRLIB "__NEEDS_SHRLIB_"
-#endif
-
-/* This special symbol is a set vector that contains a list of
- pointers to fixup tables. It will be present in any dynamically
- linked file. The linker generated fixup table should also be added
- to the list, and it should always appear in the second slot (the
- first one is a dummy with a magic number that is defined in
- crt0.o). */
-
-#ifndef SHARABLE_CONFLICTS
-#define SHARABLE_CONFLICTS "__SHARABLE_CONFLICTS__"
-#endif
-
-/* We keep a list of fixups. The terminology is a bit strange, but
- each fixup contains two 32 bit numbers. A regular fixup contains
- an address and a pointer, and at runtime we should store the
- address at the location pointed to by the pointer. A builtin fixup
- contains two pointers, and we should read the address using one
- pointer and store it at the location pointed to by the other
- pointer. Builtin fixups come into play when we have duplicate
- __GOT__ symbols for the same variable. The builtin fixup will copy
- the GOT pointer from one over into the other. */
-
-struct fixup
-{
- struct fixup *next;
- struct linux_link_hash_entry *h;
- bfd_vma value;
-
- /* Nonzero if this is a jump instruction that needs to be fixed,
- zero if this is just a pointer */
- char jump;
-
- char builtin;
-};
-
-/* We don't need a special hash table entry structure, but we do need
- to keep some information between linker passes, so we use a special
- hash table. */
-
-struct linux_link_hash_entry
-{
- struct aout_link_hash_entry root;
-};
-
-struct linux_link_hash_table
-{
- struct aout_link_hash_table root;
-
- /* First dynamic object found in link. */
- bfd *dynobj;
-
- /* Number of fixups. */
- size_t fixup_count;
-
- /* Number of builtin fixups. */
- size_t local_builtins;
-
- /* List of fixups. */
- struct fixup *fixup_list;
-};
-
-static struct bfd_hash_entry *linux_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *linux_link_hash_table_create
- PARAMS ((bfd *));
-static struct fixup *new_fixup
- PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *,
- bfd_vma, int));
-static bfd_boolean linux_link_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean linux_add_one_symbol
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
-static bfd_boolean linux_tally_symbols
- PARAMS ((struct linux_link_hash_entry *, PTR));
-static bfd_boolean linux_finish_dynamic_link
- PARAMS ((bfd *, struct bfd_link_info *));
-
-/* Routine to create an entry in an Linux link hash table. */
-
-static struct bfd_hash_entry *
-linux_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct linux_link_hash_entry *ret = (struct linux_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct linux_link_hash_entry *) NULL)
- ret = ((struct linux_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry)));
- if (ret == NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct linux_link_hash_entry *)
- NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- /* Set local fields; there aren't any. */
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create a Linux link hash table. */
-
-static struct bfd_link_hash_table *
-linux_link_hash_table_create (abfd)
- bfd *abfd;
-{
- struct linux_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct linux_link_hash_table);
-
- ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt);
- if (ret == (struct linux_link_hash_table *) NULL)
- return (struct bfd_link_hash_table *) NULL;
- if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
- linux_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
-
- ret->dynobj = NULL;
- ret->fixup_count = 0;
- ret->local_builtins = 0;
- ret->fixup_list = NULL;
-
- return &ret->root.root;
-}
-
-/* Look up an entry in a Linux link hash table. */
-
-#define linux_link_hash_lookup(table, string, create, copy, follow) \
- ((struct linux_link_hash_entry *) \
- aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
-
-/* Traverse a Linux link hash table. */
-
-#define linux_link_hash_traverse(table, func, info) \
- (aout_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the Linux link hash table from the info structure. This is
- just a cast. */
-
-#define linux_hash_table(p) ((struct linux_link_hash_table *) ((p)->hash))
-
-/* Store the information for a new fixup. */
-
-static struct fixup *
-new_fixup (info, h, value, builtin)
- struct bfd_link_info *info;
- struct linux_link_hash_entry *h;
- bfd_vma value;
- int builtin;
-{
- struct fixup *f;
-
- f = (struct fixup *) bfd_hash_allocate (&info->hash->table,
- sizeof (struct fixup));
- if (f == NULL)
- return f;
- f->next = linux_hash_table (info)->fixup_list;
- linux_hash_table (info)->fixup_list = f;
- f->h = h;
- f->value = value;
- f->builtin = builtin;
- f->jump = 0;
- ++linux_hash_table (info)->fixup_count;
- return f;
-}
-
-/* We come here once we realize that we are going to link to a shared
- library. We need to create a special section that contains the
- fixup table, and we ultimately need to add a pointer to this into
- the set vector for SHARABLE_CONFLICTS. At this point we do not
- know the size of the section, but that's OK - we just need to
- create it for now. */
-
-static bfd_boolean
-linux_link_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
-{
- flagword flags;
- register asection *s;
-
- /* Note that we set the SEC_IN_MEMORY flag. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
-
- /* We choose to use the name ".linux-dynamic" for the fixup table.
- Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
- s->_raw_size = 0;
- s->contents = 0;
-
- return TRUE;
-}
-
-/* Function to add a single symbol to the linker hash table. This is
- a wrapper around _bfd_generic_link_add_one_symbol which handles the
- tweaking needed for dynamic linking support. */
-
-static bfd_boolean
-linux_add_one_symbol (info, abfd, name, flags, section, value, string,
- copy, collect, hashp)
- struct bfd_link_info *info;
- bfd *abfd;
- const char *name;
- flagword flags;
- asection *section;
- bfd_vma value;
- const char *string;
- bfd_boolean copy;
- bfd_boolean collect;
- struct bfd_link_hash_entry **hashp;
-{
- struct linux_link_hash_entry *h;
- bfd_boolean insert;
-
- /* Look up and see if we already have this symbol in the hash table.
- If we do, and the defining entry is from a shared library, we
- need to create the dynamic sections.
-
- FIXME: What if abfd->xvec != info->hash->creator? We may want to
- be able to link Linux a.out and ELF objects together, but serious
- confusion is possible. */
-
- insert = FALSE;
-
- if (! info->relocatable
- && linux_hash_table (info)->dynobj == NULL
- && strcmp (name, SHARABLE_CONFLICTS) == 0
- && (flags & BSF_CONSTRUCTOR) != 0
- && abfd->xvec == info->hash->creator)
- {
- if (! linux_link_create_dynamic_sections (abfd, info))
- return FALSE;
- linux_hash_table (info)->dynobj = abfd;
- insert = TRUE;
- }
-
- if (bfd_is_abs_section (section)
- && abfd->xvec == info->hash->creator)
- {
- h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
- FALSE, FALSE);
- if (h != NULL
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
- {
- struct fixup *f;
-
- if (hashp != NULL)
- *hashp = (struct bfd_link_hash_entry *) h;
-
- f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
- if (f == NULL)
- return FALSE;
- f->jump = IS_PLT_SYM (name);
-
- return TRUE;
- }
- }
-
- /* Do the usual procedure for adding a symbol. */
- if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
- value, string, copy, collect,
- hashp))
- return FALSE;
-
- /* Insert a pointer to our table in the set vector. The dynamic
- linker requires this information */
- if (insert)
- {
- asection *s;
-
- /* Here we do our special thing to add the pointer to the
- dynamic section in the SHARABLE_CONFLICTS set vector. */
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- BFD_ASSERT (s != NULL);
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
- BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
- FALSE, FALSE, NULL)))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We will crawl the hash table and come here for every global symbol.
- We will examine each entry and see if there are indications that we
- need to add a fixup. There are two possible cases - one is where
- you have duplicate definitions of PLT or GOT symbols - these will
- have already been caught and added as "builtin" fixups. If we find
- that the corresponding non PLT/GOT symbol is also present, we
- convert it to a regular fixup instead.
-
- This function is called via linux_link_hash_traverse. */
-
-static bfd_boolean
-linux_tally_symbols (h, data)
- struct linux_link_hash_entry *h;
- PTR data;
-{
- struct bfd_link_info *info = (struct bfd_link_info *) data;
- struct fixup *f, *f1;
- int is_plt;
- struct linux_link_hash_entry *h1, *h2;
- bfd_boolean exists;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
-
- if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
- {
- const char *name;
- char *p;
- char *alloc = NULL;
-
- name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1;
- p = strrchr (name, '_');
- if (p != NULL)
- alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1);
-
- if (p == NULL || alloc == NULL)
- (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"),
- name);
- else
- {
- strcpy (alloc, name);
- p = strrchr (alloc, '_');
- *p++ = '\0';
- (*_bfd_error_handler)
- (_("Output file requires shared library `%s.so.%s'\n"),
- alloc, p);
- free (alloc);
- }
-
- abort ();
- }
-
- /* If this symbol is not a PLT/GOT, we do not even need to look at it */
- is_plt = IS_PLT_SYM (h->root.root.root.string);
-
- if (is_plt || IS_GOT_SYM (h->root.root.root.string))
- {
- /* Look up this symbol twice. Once just as a regular lookup,
- and then again following all of the indirect links until we
- reach a real symbol. */
- h1 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- FALSE, FALSE, TRUE);
- /* h2 does not follow indirect symbols. */
- h2 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- FALSE, FALSE, FALSE);
-
- /* The real symbol must exist but if it is also an ABS symbol,
- there is no need to have a fixup. This is because they both
- came from the same library. If on the other hand, we had to
- use an indirect symbol to get to the real symbol, we add the
- fixup anyway, since there are cases where these symbols come
- from different shared libraries */
- if (h1 != NULL
- && (((h1->root.root.type == bfd_link_hash_defined
- || h1->root.root.type == bfd_link_hash_defweak)
- && ! bfd_is_abs_section (h1->root.root.u.def.section))
- || h2->root.root.type == bfd_link_hash_indirect))
- {
- /* See if there is a "builtin" fixup already present
- involving this symbol. If so, convert it to a regular
- fixup. In the end, this relaxes some of the requirements
- about the order of performing fixups. */
- exists = FALSE;
- for (f1 = linux_hash_table (info)->fixup_list;
- f1 != NULL;
- f1 = f1->next)
- {
- if ((f1->h != h && f1->h != h1)
- || (! f1->builtin && ! f1->jump))
- continue;
- if (f1->h == h1)
- exists = TRUE;
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0);
- f->jump = is_plt;
- }
- f1->h = h1;
- f1->jump = is_plt;
- f1->builtin = 0;
- exists = TRUE;
- }
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, h->root.root.u.def.value, 0);
- if (f == NULL)
- {
- /* FIXME: No way to return error. */
- abort ();
- }
- f->jump = is_plt;
- }
- }
-
- /* Quick and dirty way of stripping these symbols from the
- symtab. */
- if (bfd_is_abs_section (h->root.root.u.def.section))
- h->root.written = TRUE;
- }
-
- return TRUE;
-}
-
-/* This is called to set the size of the .linux-dynamic section is.
- It is called by the Linux linker emulation before_allocation
- routine. We have finished reading all of the input files, and now
- we just scan the hash tables to find out how many additional fixups
- are required. */
-
-bfd_boolean
-bfd_i386linux_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- struct fixup *f;
- asection *s;
-
- if (output_bfd->xvec != &MY(vec))
- return TRUE;
-
- /* First find the fixups... */
- linux_link_hash_traverse (linux_hash_table (info),
- linux_tally_symbols,
- (PTR) info);
-
- /* If there are builtin fixups, leave room for a marker. This is
- used by the dynamic linker so that it knows that all that follow
- are builtin fixups instead of regular fixups. */
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (f->builtin)
- {
- ++linux_hash_table (info)->fixup_count;
- ++linux_hash_table (info)->local_builtins;
- break;
- }
- }
-
- if (linux_hash_table (info)->dynobj == NULL)
- {
- if (linux_hash_table (info)->fixup_count > 0)
- abort ();
- return TRUE;
- }
-
- /* Allocate memory for our fixup table. We will fill it in later. */
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- if (s != NULL)
- {
- s->_raw_size = linux_hash_table (info)->fixup_count + 1;
- s->_raw_size *= 8;
- s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We come here once we are ready to actually write the fixup table to
- the output file. Scan the fixup tables and so forth and generate
- the stuff we need. */
-
-static bfd_boolean
-linux_finish_dynamic_link (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- asection *s, *os, *is;
- bfd_byte *fixup_table;
- struct linux_link_hash_entry *h;
- struct fixup *f;
- unsigned int new_addr;
- int section_offset;
- unsigned int fixups_written;
-
- if (linux_hash_table (info)->dynobj == NULL)
- return TRUE;
-
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- BFD_ASSERT (s != NULL);
- os = s->output_section;
- fixups_written = 0;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup table file offset: %x VMA: %x\n",
- os->filepos + s->output_offset,
- os->vma + s->output_offset);
-#endif
-
- fixup_table = s->contents;
- bfd_put_32 (output_bfd,
- (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table);
- fixup_table += 4;
-
- /* Fill in fixup table. */
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (f->builtin)
- continue;
-
- if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- (*_bfd_error_handler)
- (_("Symbol %s not defined for fixups\n"),
- f->h->root.root.root.string);
- continue;
- }
-
- is = f->h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = f->h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup(%d) %s: %x %x\n",f->jump, f->h->root.root.string,
- new_addr, f->value);
-#endif
-
- if (f->jump)
- {
- /* Relative address */
- new_addr = new_addr - (f->value + 5);
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value + 1, fixup_table);
- fixup_table += 4;
- }
- else
- {
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- }
- ++fixups_written;
- }
-
- if (linux_hash_table (info)->local_builtins != 0)
- {
- /* Special marker so we know to switch to the other type of fixup */
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (! f->builtin)
- continue;
-
- if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- (*_bfd_error_handler)
- (_("Symbol %s not defined for fixups\n"),
- f->h->root.root.root.string);
- continue;
- }
-
- is = f->h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = f->h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string,
- new_addr, f->value);
-#endif
-
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
- }
-
- if (linux_hash_table (info)->fixup_count != fixups_written)
- {
- (*_bfd_error_handler) (_("Warning: fixup count mismatch\n"));
- while (linux_hash_table (info)->fixup_count > fixups_written)
- {
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
- }
-
- h = linux_link_hash_lookup (linux_hash_table (info),
- "__BUILTIN_FIXUPS__",
- FALSE, FALSE, FALSE);
-
- if (h != NULL
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
- {
- is = h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Builtin fixup table at %x\n", new_addr);
-#endif
-
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- }
- else
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
-
- if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset),
- SEEK_SET) != 0)
- return FALSE;
-
- if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
- return FALSE;
-
- return TRUE;
-}
-
-#define MY_bfd_link_hash_table_create linux_link_hash_table_create
-#define MY_add_one_symbol linux_add_one_symbol
-#define MY_finish_dynamic_link linux_finish_dynamic_link
-
-#define MY_zmagic_contiguous 1
-
-#include "aout-target.h"
diff --git a/contrib/binutils/bfd/i386netbsd.c b/contrib/binutils/bfd/i386netbsd.c
deleted file mode 100644
index 26fa30e..0000000
--- a/contrib/binutils/bfd/i386netbsd.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* BFD back-end for NetBSD/386 a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2001
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define BYTES_IN_WORD 4
-#undef TARGET_IS_BIG_ENDIAN_P
-
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-
-#define DEFAULT_ARCH bfd_arch_i386
-#define DEFAULT_MID M_386_NETBSD
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (i386netbsd_,OP)
-
-/* This needs to start with a.out so GDB knows it is an a.out variant. */
-#define TARGETNAME "a.out-i386-netbsd"
-
-#include "netbsd.h"
diff --git a/contrib/binutils/bfd/ieee.c b/contrib/binutils/bfd/ieee.c
deleted file mode 100644
index 8a08028..0000000
--- a/contrib/binutils/bfd/ieee.c
+++ /dev/null
@@ -1,4128 +0,0 @@
-/* BFD back-end for ieee-695 objects.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
- Written by Steve Chamberlain of Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define KEEPMINUSPCININST 0
-
-/* IEEE 695 format is a stream of records, which we parse using a simple one-
- token (which is one byte in this lexicon) lookahead recursive decent
- parser. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "ieee.h"
-#include "libieee.h"
-#include "safe-ctype.h"
-
-struct output_buffer_struct
-{
- unsigned char *ptrp;
- int buffer;
-};
-
-static bfd_boolean ieee_write_byte
- PARAMS ((bfd *, int));
-static bfd_boolean ieee_write_2bytes
- PARAMS ((bfd *, int));
-static bfd_boolean ieee_write_int
- PARAMS ((bfd *, bfd_vma));
-static bfd_boolean ieee_write_id
- PARAMS ((bfd *, const char *));
-static unsigned short read_2bytes
- PARAMS ((common_header_type *));
-static void bfd_get_string
- PARAMS ((common_header_type *, char *, size_t));
-static char *read_id
- PARAMS ((common_header_type *));
-static bfd_boolean ieee_write_expression
- PARAMS ((bfd *, bfd_vma, asymbol *, bfd_boolean, unsigned int));
-static void ieee_write_int5
- PARAMS ((bfd_byte *, bfd_vma));
-static bfd_boolean ieee_write_int5_out
- PARAMS ((bfd *, bfd_vma));
-static bfd_boolean parse_int
- PARAMS ((common_header_type *, bfd_vma *));
-static int parse_i
- PARAMS ((common_header_type *, bfd_boolean *));
-static bfd_vma must_parse_int
- PARAMS ((common_header_type *));
-static void parse_expression
- PARAMS ((ieee_data_type *, bfd_vma *, ieee_symbol_index_type *,
- bfd_boolean *, unsigned int *, asection **));
-static file_ptr ieee_part_after
- PARAMS ((ieee_data_type *, file_ptr));
-static ieee_symbol_type *get_symbol
- PARAMS ((bfd *, ieee_data_type *, ieee_symbol_type *, unsigned int *,
- ieee_symbol_type ***, unsigned int *, int));
-static bfd_boolean ieee_slurp_external_symbols
- PARAMS ((bfd *));
-static bfd_boolean ieee_slurp_symbol_table
- PARAMS ((bfd *));
-static long ieee_get_symtab_upper_bound
- PARAMS ((bfd *));
-static long ieee_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
-static asection *get_section_entry
- PARAMS ((bfd *, ieee_data_type *i, unsigned int));
-static void ieee_slurp_sections
- PARAMS ((bfd *));
-static bfd_boolean ieee_slurp_debug
- PARAMS ((bfd *));
-const bfd_target *ieee_archive_p
- PARAMS ((bfd *));
-const bfd_target *ieee_object_p
- PARAMS ((bfd *));
-static void ieee_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *));
-static void ieee_print_symbol
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-static bfd_boolean do_one
- PARAMS ((ieee_data_type *, ieee_per_section_type *, unsigned char *,
- asection *, int));
-static bfd_boolean ieee_slurp_section_data
- PARAMS ((bfd *));
-static bfd_boolean ieee_new_section_hook
- PARAMS ((bfd *, asection *));
-static long ieee_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
-static bfd_boolean ieee_get_section_contents
- PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
-static long ieee_canonicalize_reloc
- PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-static int comp
- PARAMS ((const PTR, const PTR));
-static bfd_boolean ieee_write_section_part
- PARAMS ((bfd *));
-static bfd_boolean do_with_relocs
- PARAMS ((bfd *, asection *));
-static bfd_boolean do_as_repeat
- PARAMS ((bfd *, asection *));
-static bfd_boolean do_without_relocs
- PARAMS ((bfd *, asection *));
-static bfd_boolean ieee_mkobject
- PARAMS ((bfd *));
-static void fill
- PARAMS ((void));
-static void flush
- PARAMS ((void));
-static void write_int
- PARAMS ((int));
-static void copy_id
- PARAMS ((void));
-static void copy_expression
- PARAMS ((void));
-static void fill_int
- PARAMS ((struct output_buffer_struct *));
-static void drop_int
- PARAMS ((struct output_buffer_struct *));
-static void copy_int
- PARAMS ((void));
-static void f1_record
- PARAMS ((void));
-static void f0_record
- PARAMS ((void));
-static void copy_till_end
- PARAMS ((void));
-static void f2_record
- PARAMS ((void));
-static void f8_record
- PARAMS ((void));
-static void e2_record
- PARAMS ((void));
-static void block
- PARAMS ((void));
-static void relocate_debug
- PARAMS ((bfd *, bfd *));
-static bfd_boolean ieee_write_debug_part
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_data_part
- PARAMS ((bfd *));
-static bfd_boolean init_for_output
- PARAMS ((bfd *));
-static bfd_boolean ieee_set_section_contents
- PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
-static bfd_boolean ieee_write_external_part
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_me_part
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_processor
- PARAMS ((bfd *));
-static bfd_boolean ieee_write_object_contents
- PARAMS ((bfd *));
-static asymbol *ieee_make_empty_symbol
- PARAMS ((bfd *));
-static bfd *ieee_openr_next_archived_file
- PARAMS ((bfd *, bfd *));
-static bfd_boolean ieee_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-static int ieee_generic_stat_arch_elt
- PARAMS ((bfd *, struct stat *));
-static int ieee_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-
-/* Functions for writing to ieee files in the strange way that the
- standard requires. */
-
-static bfd_boolean
-ieee_write_byte (abfd, barg)
- bfd *abfd;
- int barg;
-{
- bfd_byte byte;
-
- byte = barg;
- if (bfd_bwrite ((PTR) &byte, (bfd_size_type) 1, abfd) != 1)
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-ieee_write_2bytes (abfd, bytes)
- bfd *abfd;
- int bytes;
-{
- bfd_byte buffer[2];
-
- buffer[0] = bytes >> 8;
- buffer[1] = bytes & 0xff;
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 2, abfd) != 2)
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-ieee_write_int (abfd, value)
- bfd *abfd;
- bfd_vma value;
-{
- if (value <= 127)
- {
- if (! ieee_write_byte (abfd, (bfd_byte) value))
- return FALSE;
- }
- else
- {
- unsigned int length;
-
- /* How many significant bytes ? */
- /* FIXME FOR LONGER INTS. */
- if (value & 0xff000000)
- length = 4;
- else if (value & 0x00ff0000)
- length = 3;
- else if (value & 0x0000ff00)
- length = 2;
- else
- length = 1;
-
- if (! ieee_write_byte (abfd,
- (bfd_byte) ((int) ieee_number_repeat_start_enum
- + length)))
- return FALSE;
- switch (length)
- {
- case 4:
- if (! ieee_write_byte (abfd, (bfd_byte) (value >> 24)))
- return FALSE;
- /* Fall through. */
- case 3:
- if (! ieee_write_byte (abfd, (bfd_byte) (value >> 16)))
- return FALSE;
- /* Fall through. */
- case 2:
- if (! ieee_write_byte (abfd, (bfd_byte) (value >> 8)))
- return FALSE;
- /* Fall through. */
- case 1:
- if (! ieee_write_byte (abfd, (bfd_byte) (value)))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-ieee_write_id (abfd, id)
- bfd *abfd;
- const char *id;
-{
- size_t length = strlen (id);
-
- if (length <= 127)
- {
- if (! ieee_write_byte (abfd, (bfd_byte) length))
- return FALSE;
- }
- else if (length < 255)
- {
- if (! ieee_write_byte (abfd, ieee_extension_length_1_enum)
- || ! ieee_write_byte (abfd, (bfd_byte) length))
- return FALSE;
- }
- else if (length < 65535)
- {
- if (! ieee_write_byte (abfd, ieee_extension_length_2_enum)
- || ! ieee_write_2bytes (abfd, (int) length))
- return FALSE;
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: string too long (%d chars, max 65535)"),
- bfd_get_filename (abfd), length);
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- if (bfd_bwrite ((PTR) id, (bfd_size_type) length, abfd) != length)
- return FALSE;
- return TRUE;
-}
-
-/* Functions for reading from ieee files in the strange way that the
- standard requires. */
-
-#define this_byte(ieee) *((ieee)->input_p)
-#define next_byte(ieee) ((ieee)->input_p++)
-#define this_byte_and_next(ieee) (*((ieee)->input_p++))
-
-static unsigned short
-read_2bytes (ieee)
- common_header_type *ieee;
-{
- unsigned char c1 = this_byte_and_next (ieee);
- unsigned char c2 = this_byte_and_next (ieee);
-
- return (c1 << 8) | c2;
-}
-
-static void
-bfd_get_string (ieee, string, length)
- common_header_type *ieee;
- char *string;
- size_t length;
-{
- size_t i;
-
- for (i = 0; i < length; i++)
- string[i] = this_byte_and_next (ieee);
-}
-
-static char *
-read_id (ieee)
- common_header_type *ieee;
-{
- size_t length;
- char *string;
-
- length = this_byte_and_next (ieee);
- if (length <= 0x7f)
- {
- /* Simple string of length 0 to 127. */
- }
- else if (length == 0xde)
- {
- /* Length is next byte, allowing 0..255. */
- length = this_byte_and_next (ieee);
- }
- else if (length == 0xdf)
- {
- /* Length is next two bytes, allowing 0..65535. */
- length = this_byte_and_next (ieee);
- length = (length * 256) + this_byte_and_next (ieee);
- }
-
- /* Buy memory and read string. */
- string = bfd_alloc (ieee->abfd, (bfd_size_type) length + 1);
- if (!string)
- return NULL;
- bfd_get_string (ieee, string, length);
- string[length] = 0;
- return string;
-}
-
-static bfd_boolean
-ieee_write_expression (abfd, value, symbol, pcrel, index)
- bfd *abfd;
- bfd_vma value;
- asymbol *symbol;
- bfd_boolean pcrel;
- unsigned int index;
-{
- unsigned int term_count = 0;
-
- if (value != 0)
- {
- if (! ieee_write_int (abfd, value))
- return FALSE;
- term_count++;
- }
-
- /* Badly formatted binaries can have a missing symbol,
- so test here to prevent a seg fault. */
- if (symbol != NULL)
- {
- if (bfd_is_com_section (symbol->section)
- || bfd_is_und_section (symbol->section))
- {
- /* Def of a common symbol. */
- if (! ieee_write_byte (abfd, ieee_variable_X_enum)
- || ! ieee_write_int (abfd, symbol->value))
- return FALSE;
- term_count ++;
- }
- else if (! bfd_is_abs_section (symbol->section))
- {
- /* Ref to defined symbol - */
-
- if (symbol->flags & BSF_GLOBAL)
- {
- if (! ieee_write_byte (abfd, ieee_variable_I_enum)
- || ! ieee_write_int (abfd, symbol->value))
- return FALSE;
- term_count++;
- }
- else if (symbol->flags & (BSF_LOCAL | BSF_SECTION_SYM))
- {
- /* This is a reference to a defined local symbol. We can
- easily do a local as a section+offset. */
- if (! ieee_write_byte (abfd, ieee_variable_R_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (symbol->section->index
- + IEEE_SECTION_NUMBER_BASE)))
- return FALSE;
-
- term_count++;
- if (symbol->value != 0)
- {
- if (! ieee_write_int (abfd, symbol->value))
- return FALSE;
- term_count++;
- }
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: unrecognized symbol `%s' flags 0x%x"),
- bfd_get_filename (abfd), bfd_asymbol_name (symbol),
- symbol->flags);
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
- }
- }
-
- if (pcrel)
- {
- /* Subtract the pc from here by asking for PC of this section. */
- if (! ieee_write_byte (abfd, ieee_variable_P_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (index + IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_byte (abfd, ieee_function_minus_enum))
- return FALSE;
- }
-
- /* Handle the degenerate case of a 0 address. */
- if (term_count == 0)
- if (! ieee_write_int (abfd, (bfd_vma) 0))
- return FALSE;
-
- while (term_count > 1)
- {
- if (! ieee_write_byte (abfd, ieee_function_plus_enum))
- return FALSE;
- term_count--;
- }
-
- return TRUE;
-}
-
-/* Writes any integer into the buffer supplied and always takes 5 bytes. */
-
-static void
-ieee_write_int5 (buffer, value)
- bfd_byte *buffer;
- bfd_vma value;
-{
- buffer[0] = (bfd_byte) ieee_number_repeat_4_enum;
- buffer[1] = (value >> 24) & 0xff;
- buffer[2] = (value >> 16) & 0xff;
- buffer[3] = (value >> 8) & 0xff;
- buffer[4] = (value >> 0) & 0xff;
-}
-
-static bfd_boolean
-ieee_write_int5_out (abfd, value)
- bfd *abfd;
- bfd_vma value;
-{
- bfd_byte b[5];
-
- ieee_write_int5 (b, value);
- if (bfd_bwrite ((PTR) b, (bfd_size_type) 5, abfd) != 5)
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-parse_int (ieee, value_ptr)
- common_header_type *ieee;
- bfd_vma *value_ptr;
-{
- int value = this_byte (ieee);
- int result;
-
- if (value >= 0 && value <= 127)
- {
- *value_ptr = value;
- next_byte (ieee);
- return TRUE;
- }
- else if (value >= 0x80 && value <= 0x88)
- {
- unsigned int count = value & 0xf;
-
- result = 0;
- next_byte (ieee);
- while (count)
- {
- result = (result << 8) | this_byte_and_next (ieee);
- count--;
- }
- *value_ptr = result;
- return TRUE;
- }
- return FALSE;
-}
-
-static int
-parse_i (ieee, ok)
- common_header_type *ieee;
- bfd_boolean *ok;
-{
- bfd_vma x;
- *ok = parse_int (ieee, &x);
- return x;
-}
-
-static bfd_vma
-must_parse_int (ieee)
- common_header_type *ieee;
-{
- bfd_vma result;
- BFD_ASSERT (parse_int (ieee, &result));
- return result;
-}
-
-typedef struct
-{
- bfd_vma value;
- asection *section;
- ieee_symbol_index_type symbol;
-} ieee_value_type;
-
-
-#if KEEPMINUSPCININST
-
-#define SRC_MASK(arg) arg
-#define PCREL_OFFSET FALSE
-
-#else
-
-#define SRC_MASK(arg) 0
-#define PCREL_OFFSET TRUE
-
-#endif
-
-static reloc_howto_type abs32_howto =
- HOWTO (1,
- 0,
- 2,
- 32,
- FALSE,
- 0,
- complain_overflow_bitfield,
- 0,
- "abs32",
- TRUE,
- 0xffffffff,
- 0xffffffff,
- FALSE);
-
-static reloc_howto_type abs16_howto =
- HOWTO (1,
- 0,
- 1,
- 16,
- FALSE,
- 0,
- complain_overflow_bitfield,
- 0,
- "abs16",
- TRUE,
- 0x0000ffff,
- 0x0000ffff,
- FALSE);
-
-static reloc_howto_type abs8_howto =
- HOWTO (1,
- 0,
- 0,
- 8,
- FALSE,
- 0,
- complain_overflow_bitfield,
- 0,
- "abs8",
- TRUE,
- 0x000000ff,
- 0x000000ff,
- FALSE);
-
-static reloc_howto_type rel32_howto =
- HOWTO (1,
- 0,
- 2,
- 32,
- TRUE,
- 0,
- complain_overflow_signed,
- 0,
- "rel32",
- TRUE,
- SRC_MASK (0xffffffff),
- 0xffffffff,
- PCREL_OFFSET);
-
-static reloc_howto_type rel16_howto =
- HOWTO (1,
- 0,
- 1,
- 16,
- TRUE,
- 0,
- complain_overflow_signed,
- 0,
- "rel16",
- TRUE,
- SRC_MASK (0x0000ffff),
- 0x0000ffff,
- PCREL_OFFSET);
-
-static reloc_howto_type rel8_howto =
- HOWTO (1,
- 0,
- 0,
- 8,
- TRUE,
- 0,
- complain_overflow_signed,
- 0,
- "rel8",
- TRUE,
- SRC_MASK (0x000000ff),
- 0x000000ff,
- PCREL_OFFSET);
-
-static ieee_symbol_index_type NOSYMBOL = {0, 0};
-
-static void
-parse_expression (ieee, value, symbol, pcrel, extra, section)
- ieee_data_type *ieee;
- bfd_vma *value;
- ieee_symbol_index_type *symbol;
- bfd_boolean *pcrel;
- unsigned int *extra;
- asection **section;
-
-{
-#define POS sp[1]
-#define TOS sp[0]
-#define NOS sp[-1]
-#define INC sp++;
-#define DEC sp--;
-
- bfd_boolean loop = TRUE;
- ieee_value_type stack[10];
-
- /* The stack pointer always points to the next unused location. */
-#define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC;
-#define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value;
- ieee_value_type *sp = stack;
- asection *dummy;
-
- while (loop && ieee->h.input_p < ieee->h.last_byte)
- {
- switch (this_byte (&(ieee->h)))
- {
- case ieee_variable_P_enum:
- /* P variable, current program counter for section n. */
- {
- int section_n;
-
- next_byte (&(ieee->h));
- *pcrel = TRUE;
- section_n = must_parse_int (&(ieee->h));
- PUSH (NOSYMBOL, bfd_abs_section_ptr, 0);
- break;
- }
- case ieee_variable_L_enum:
- /* L variable address of section N. */
- next_byte (&(ieee->h));
- PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0);
- break;
- case ieee_variable_R_enum:
- /* R variable, logical address of section module. */
- /* FIXME, this should be different to L. */
- next_byte (&(ieee->h));
- PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0);
- break;
- case ieee_variable_S_enum:
- /* S variable, size in MAUS of section module. */
- next_byte (&(ieee->h));
- PUSH (NOSYMBOL,
- 0,
- ieee->section_table[must_parse_int (&(ieee->h))]->_raw_size);
- break;
- case ieee_variable_I_enum:
- /* Push the address of variable n. */
- {
- ieee_symbol_index_type sy;
- next_byte (&(ieee->h));
- sy.index = (int) must_parse_int (&(ieee->h));
- sy.letter = 'I';
-
- PUSH (sy, bfd_abs_section_ptr, 0);
- }
- break;
- case ieee_variable_X_enum:
- /* Push the address of external variable n. */
- {
- ieee_symbol_index_type sy;
- next_byte (&(ieee->h));
- sy.index = (int) (must_parse_int (&(ieee->h)));
- sy.letter = 'X';
-
- PUSH (sy, bfd_und_section_ptr, 0);
- }
- break;
- case ieee_function_minus_enum:
- {
- bfd_vma value1, value2;
- asection *section1, *section_dummy;
- ieee_symbol_index_type sy;
- next_byte (&(ieee->h));
-
- POP (sy, section1, value1);
- POP (sy, section_dummy, value2);
- PUSH (sy, section1 ? section1 : section_dummy, value2 - value1);
- }
- break;
- case ieee_function_plus_enum:
- {
- bfd_vma value1, value2;
- asection *section1;
- asection *section2;
- ieee_symbol_index_type sy1;
- ieee_symbol_index_type sy2;
- next_byte (&(ieee->h));
-
- POP (sy1, section1, value1);
- POP (sy2, section2, value2);
- PUSH (sy1.letter ? sy1 : sy2,
- bfd_is_abs_section (section1) ? section2 : section1,
- value1 + value2);
- }
- break;
- default:
- {
- bfd_vma va;
- BFD_ASSERT (this_byte (&(ieee->h)) < (int) ieee_variable_A_enum
- || this_byte (&(ieee->h)) > (int) ieee_variable_Z_enum);
- if (parse_int (&(ieee->h), &va))
- {
- PUSH (NOSYMBOL, bfd_abs_section_ptr, va);
- }
- else
- {
- /* Thats all that we can understand. */
- loop = FALSE;
- }
- }
- }
- }
-
- /* As far as I can see there is a bug in the Microtec IEEE output
- which I'm using to scan, whereby the comma operator is omitted
- sometimes in an expression, giving expressions with too many
- terms. We can tell if that's the case by ensuring that
- sp == stack here. If not, then we've pushed something too far,
- so we keep adding. */
- while (sp != stack + 1)
- {
- asection *section1;
- ieee_symbol_index_type sy1;
- POP (sy1, section1, *extra);
- }
-
- POP (*symbol, dummy, *value);
- if (section)
- *section = dummy;
-}
-
-
-#define ieee_seek(ieee, offset) \
- do \
- { \
- ieee->h.input_p = ieee->h.first_byte + offset; \
- ieee->h.last_byte = (ieee->h.first_byte \
- + ieee_part_after (ieee, offset)); \
- } \
- while (0)
-
-#define ieee_pos(ieee) \
- (ieee->h.input_p - ieee->h.first_byte)
-
-/* Find the first part of the ieee file after HERE. */
-
-static file_ptr
-ieee_part_after (ieee, here)
- ieee_data_type *ieee;
- file_ptr here;
-{
- int part;
- file_ptr after = ieee->w.r.me_record;
-
- /* File parts can come in any order, except that module end is
- guaranteed to be last (and the header first). */
- for (part = 0; part < N_W_VARIABLES; part++)
- if (ieee->w.offset[part] > here && after > ieee->w.offset[part])
- after = ieee->w.offset[part];
-
- return after;
-}
-
-static unsigned int last_index;
-static char last_type; /* Is the index for an X or a D. */
-
-static ieee_symbol_type *
-get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type)
- bfd *abfd ATTRIBUTE_UNUSED;
- ieee_data_type *ieee;
- ieee_symbol_type *last_symbol;
- unsigned int *symbol_count;
- ieee_symbol_type ***pptr;
- unsigned int *max_index;
- int this_type;
-{
- /* Need a new symbol. */
- unsigned int new_index = must_parse_int (&(ieee->h));
-
- if (new_index != last_index || this_type != last_type)
- {
- ieee_symbol_type *new_symbol;
- bfd_size_type amt = sizeof (ieee_symbol_type);
-
- new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd, amt);
- if (!new_symbol)
- return NULL;
-
- new_symbol->index = new_index;
- last_index = new_index;
- (*symbol_count)++;
- **pptr = new_symbol;
- *pptr = &new_symbol->next;
- if (new_index > *max_index)
- *max_index = new_index;
-
- last_type = this_type;
- new_symbol->symbol.section = bfd_abs_section_ptr;
- return new_symbol;
- }
- return last_symbol;
-}
-
-static bfd_boolean
-ieee_slurp_external_symbols (abfd)
- bfd *abfd;
-{
- ieee_data_type *ieee = IEEE_DATA (abfd);
- file_ptr offset = ieee->w.r.external_part;
-
- ieee_symbol_type **prev_symbols_ptr = &ieee->external_symbols;
- ieee_symbol_type **prev_reference_ptr = &ieee->external_reference;
- ieee_symbol_type *symbol = (ieee_symbol_type *) NULL;
- unsigned int symbol_count = 0;
- bfd_boolean loop = TRUE;
- last_index = 0xffffff;
- ieee->symbol_table_full = TRUE;
-
- ieee_seek (ieee, offset);
-
- while (loop)
- {
- switch (this_byte (&(ieee->h)))
- {
- case ieee_nn_record:
- next_byte (&(ieee->h));
-
- symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
- &prev_symbols_ptr,
- &ieee->external_symbol_max_index, 'I');
- if (symbol == NULL)
- return FALSE;
-
- symbol->symbol.the_bfd = abfd;
- symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
- symbol->symbol.flags = BSF_NO_FLAGS;
- break;
- case ieee_external_symbol_enum:
- next_byte (&(ieee->h));
-
- symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
- &prev_symbols_ptr,
- &ieee->external_symbol_max_index, 'D');
- if (symbol == NULL)
- return FALSE;
-
- BFD_ASSERT (symbol->index >= ieee->external_symbol_min_index);
-
- symbol->symbol.the_bfd = abfd;
- symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
- symbol->symbol.flags = BSF_NO_FLAGS;
- break;
- case ieee_attribute_record_enum >> 8:
- {
- unsigned int symbol_name_index;
- unsigned int symbol_type_index;
- unsigned int symbol_attribute_def;
- bfd_vma value;
- switch (read_2bytes (&ieee->h))
- {
- case ieee_attribute_record_enum:
- symbol_name_index = must_parse_int (&(ieee->h));
- symbol_type_index = must_parse_int (&(ieee->h));
- symbol_attribute_def = must_parse_int (&(ieee->h));
- switch (symbol_attribute_def)
- {
- case 8:
- case 19:
- parse_int (&ieee->h, &value);
- break;
- default:
- (*_bfd_error_handler)
- (_("%s: unimplemented ATI record %u for symbol %u"),
- bfd_archive_filename (abfd), symbol_attribute_def,
- symbol_name_index);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- break;
- }
- break;
- case ieee_external_reference_info_record_enum:
- /* Skip over ATX record. */
- parse_int (&(ieee->h), &value);
- parse_int (&(ieee->h), &value);
- parse_int (&(ieee->h), &value);
- parse_int (&(ieee->h), &value);
- break;
- case ieee_atn_record_enum:
- /* We may get call optimization information here,
- which we just ignore. The format is
- {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs}. */
- parse_int (&ieee->h, &value);
- parse_int (&ieee->h, &value);
- parse_int (&ieee->h, &value);
- if (value != 0x3f)
- {
- (*_bfd_error_handler)
- (_("%s: unexpected ATN type %d in external part"),
- bfd_archive_filename (abfd), (int) value);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- parse_int (&ieee->h, &value);
- parse_int (&ieee->h, &value);
- while (value > 0)
- {
- bfd_vma val1;
-
- --value;
-
- switch (read_2bytes (&ieee->h))
- {
- case ieee_asn_record_enum:
- parse_int (&ieee->h, &val1);
- parse_int (&ieee->h, &val1);
- break;
-
- default:
- (*_bfd_error_handler)
- (_("%s: unexpected type after ATN"),
- bfd_archive_filename (abfd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- }
- }
- }
- break;
- case ieee_value_record_enum >> 8:
- {
- unsigned int symbol_name_index;
- ieee_symbol_index_type symbol_ignore;
- bfd_boolean pcrel_ignore;
- unsigned int extra;
- next_byte (&(ieee->h));
- next_byte (&(ieee->h));
-
- symbol_name_index = must_parse_int (&(ieee->h));
- parse_expression (ieee,
- &symbol->symbol.value,
- &symbol_ignore,
- &pcrel_ignore,
- &extra,
- &symbol->symbol.section);
-
- /* Fully linked IEEE-695 files tend to give every symbol
- an absolute value. Try to convert that back into a
- section relative value. FIXME: This won't always to
- the right thing. */
- if (bfd_is_abs_section (symbol->symbol.section)
- && (abfd->flags & HAS_RELOC) == 0)
- {
- bfd_vma val;
- asection *s;
-
- val = symbol->symbol.value;
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if (val >= s->vma && val < s->vma + s->_raw_size)
- {
- symbol->symbol.section = s;
- symbol->symbol.value -= s->vma;
- break;
- }
- }
- }
-
- symbol->symbol.flags = BSF_GLOBAL | BSF_EXPORT;
-
- }
- break;
- case ieee_weak_external_reference_enum:
- {
- bfd_vma size;
- bfd_vma value;
- next_byte (&(ieee->h));
- /* Throw away the external reference index. */
- (void) must_parse_int (&(ieee->h));
- /* Fetch the default size if not resolved. */
- size = must_parse_int (&(ieee->h));
- /* Fetch the default value if available. */
- if (! parse_int (&(ieee->h), &value))
- {
- value = 0;
- }
- /* This turns into a common. */
- symbol->symbol.section = bfd_com_section_ptr;
- symbol->symbol.value = size;
- }
- break;
-
- case ieee_external_reference_enum:
- next_byte (&(ieee->h));
-
- symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
- &prev_reference_ptr,
- &ieee->external_reference_max_index, 'X');
- if (symbol == NULL)
- return FALSE;
-
- symbol->symbol.the_bfd = abfd;
- symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
- symbol->symbol.section = bfd_und_section_ptr;
- symbol->symbol.value = (bfd_vma) 0;
- symbol->symbol.flags = 0;
-
- BFD_ASSERT (symbol->index >= ieee->external_reference_min_index);
- break;
-
- default:
- loop = FALSE;
- }
- }
-
- if (ieee->external_symbol_max_index != 0)
- {
- ieee->external_symbol_count =
- ieee->external_symbol_max_index -
- ieee->external_symbol_min_index + 1;
- }
- else
- {
- ieee->external_symbol_count = 0;
- }
-
- if (ieee->external_reference_max_index != 0)
- {
- ieee->external_reference_count =
- ieee->external_reference_max_index -
- ieee->external_reference_min_index + 1;
- }
- else
- {
- ieee->external_reference_count = 0;
- }
-
- abfd->symcount =
- ieee->external_reference_count + ieee->external_symbol_count;
-
- if (symbol_count != abfd->symcount)
- {
- /* There are gaps in the table -- */
- ieee->symbol_table_full = FALSE;
- }
-
- *prev_symbols_ptr = (ieee_symbol_type *) NULL;
- *prev_reference_ptr = (ieee_symbol_type *) NULL;
-
- return TRUE;
-}
-
-static bfd_boolean
-ieee_slurp_symbol_table (abfd)
- bfd *abfd;
-{
- if (! IEEE_DATA (abfd)->read_symbols)
- {
- if (! ieee_slurp_external_symbols (abfd))
- return FALSE;
- IEEE_DATA (abfd)->read_symbols = TRUE;
- }
- return TRUE;
-}
-
-static long
-ieee_get_symtab_upper_bound (abfd)
- bfd *abfd;
-{
- if (! ieee_slurp_symbol_table (abfd))
- return -1;
-
- return (abfd->symcount != 0) ?
- (abfd->symcount + 1) * (sizeof (ieee_symbol_type *)) : 0;
-}
-
-/* Move from our internal lists to the canon table, and insert in
- symbol index order. */
-
-extern const bfd_target ieee_vec;
-
-static long
-ieee_canonicalize_symtab (abfd, location)
- bfd *abfd;
- asymbol **location;
-{
- ieee_symbol_type *symp;
- static bfd dummy_bfd;
- static asymbol empty_symbol =
- {
- &dummy_bfd,
- " ieee empty",
- (symvalue) 0,
- BSF_DEBUGGING,
- bfd_abs_section_ptr
-#ifdef __STDC__
- /* K&R compilers can't initialise unions. */
- , { 0 }
-#endif
- };
-
- if (abfd->symcount)
- {
- ieee_data_type *ieee = IEEE_DATA (abfd);
- dummy_bfd.xvec = &ieee_vec;
- if (! ieee_slurp_symbol_table (abfd))
- return -1;
-
- if (! ieee->symbol_table_full)
- {
- /* Arrgh - there are gaps in the table, run through and fill them
- up with pointers to a null place. */
- unsigned int i;
-
- for (i = 0; i < abfd->symcount; i++)
- location[i] = &empty_symbol;
- }
-
- ieee->external_symbol_base_offset = -ieee->external_symbol_min_index;
- for (symp = IEEE_DATA (abfd)->external_symbols;
- symp != (ieee_symbol_type *) NULL;
- symp = symp->next)
- /* Place into table at correct index locations. */
- location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol;
-
- /* The external refs are indexed in a bit. */
- ieee->external_reference_base_offset =
- -ieee->external_reference_min_index + ieee->external_symbol_count;
-
- for (symp = IEEE_DATA (abfd)->external_reference;
- symp != (ieee_symbol_type *) NULL;
- symp = symp->next)
- location[symp->index + ieee->external_reference_base_offset] =
- &symp->symbol;
- }
-
- if (abfd->symcount)
- location[abfd->symcount] = (asymbol *) NULL;
-
- return abfd->symcount;
-}
-
-static asection *
-get_section_entry (abfd, ieee, index)
- bfd *abfd;
- ieee_data_type *ieee;
- unsigned int index;
-{
- if (index >= ieee->section_table_size)
- {
- unsigned int c, i;
- asection **n;
- bfd_size_type amt;
-
- c = ieee->section_table_size;
- if (c == 0)
- c = 20;
- while (c <= index)
- c *= 2;
-
- amt = c;
- amt *= sizeof (asection *);
- n = (asection **) bfd_realloc (ieee->section_table, amt);
- if (n == NULL)
- return NULL;
-
- for (i = ieee->section_table_size; i < c; i++)
- n[i] = NULL;
-
- ieee->section_table = n;
- ieee->section_table_size = c;
- }
-
- if (ieee->section_table[index] == (asection *) NULL)
- {
- char *tmp = bfd_alloc (abfd, (bfd_size_type) 11);
- asection *section;
-
- if (!tmp)
- return NULL;
- sprintf (tmp, " fsec%4d", index);
- section = bfd_make_section (abfd, tmp);
- ieee->section_table[index] = section;
- section->flags = SEC_NO_FLAGS;
- section->target_index = index;
- ieee->section_table[index] = section;
- }
- return ieee->section_table[index];
-}
-
-static void
-ieee_slurp_sections (abfd)
- bfd *abfd;
-{
- ieee_data_type *ieee = IEEE_DATA (abfd);
- file_ptr offset = ieee->w.r.section_part;
- char *name;
-
- if (offset != 0)
- {
- bfd_byte section_type[3];
- ieee_seek (ieee, offset);
- while (TRUE)
- {
- switch (this_byte (&(ieee->h)))
- {
- case ieee_section_type_enum:
- {
- asection *section;
- unsigned int section_index;
- next_byte (&(ieee->h));
- section_index = must_parse_int (&(ieee->h));
-
- section = get_section_entry (abfd, ieee, section_index);
-
- section_type[0] = this_byte_and_next (&(ieee->h));
-
- /* Set minimal section attributes. Attributes are
- extended later, based on section contents. */
- switch (section_type[0])
- {
- case 0xC1:
- /* Normal attributes for absolute sections. */
- section_type[1] = this_byte (&(ieee->h));
- section->flags = SEC_ALLOC;
- switch (section_type[1])
- {
- case 0xD3: /* AS Absolute section attributes. */
- next_byte (&(ieee->h));
- section_type[2] = this_byte (&(ieee->h));
- switch (section_type[2])
- {
- case 0xD0:
- /* Normal code. */
- next_byte (&(ieee->h));
- section->flags |= SEC_CODE;
- break;
- case 0xC4:
- /* Normal data. */
- next_byte (&(ieee->h));
- section->flags |= SEC_DATA;
- break;
- case 0xD2:
- next_byte (&(ieee->h));
- /* Normal rom data. */
- section->flags |= SEC_ROM | SEC_DATA;
- break;
- default:
- break;
- }
- }
- break;
- case 0xC3: /* Named relocatable sections (type C). */
- section_type[1] = this_byte (&(ieee->h));
- section->flags = SEC_ALLOC;
- switch (section_type[1])
- {
- case 0xD0: /* Normal code (CP). */
- next_byte (&(ieee->h));
- section->flags |= SEC_CODE;
- break;
- case 0xC4: /* Normal data (CD). */
- next_byte (&(ieee->h));
- section->flags |= SEC_DATA;
- break;
- case 0xD2: /* Normal rom data (CR). */
- next_byte (&(ieee->h));
- section->flags |= SEC_ROM | SEC_DATA;
- break;
- default:
- break;
- }
- }
-
- /* Read section name, use it if non empty. */
- name = read_id (&ieee->h);
- if (name[0])
- section->name = name;
-
- /* Skip these fields, which we don't care about. */
- {
- bfd_vma parent, brother, context;
- parse_int (&(ieee->h), &parent);
- parse_int (&(ieee->h), &brother);
- parse_int (&(ieee->h), &context);
- }
- }
- break;
- case ieee_section_alignment_enum:
- {
- unsigned int section_index;
- bfd_vma value;
- asection *section;
- next_byte (&(ieee->h));
- section_index = must_parse_int (&ieee->h);
- section = get_section_entry (abfd, ieee, section_index);
- if (section_index > ieee->section_count)
- {
- ieee->section_count = section_index;
- }
- section->alignment_power =
- bfd_log2 (must_parse_int (&ieee->h));
- (void) parse_int (&(ieee->h), &value);
- }
- break;
- case ieee_e2_first_byte_enum:
- {
- asection *section;
- ieee_record_enum_type t;
-
- t = (ieee_record_enum_type) (read_2bytes (&(ieee->h)));
- switch (t)
- {
- case ieee_section_size_enum:
- section = ieee->section_table[must_parse_int (&(ieee->h))];
- section->_raw_size = must_parse_int (&(ieee->h));
- break;
- case ieee_physical_region_size_enum:
- section = ieee->section_table[must_parse_int (&(ieee->h))];
- section->_raw_size = must_parse_int (&(ieee->h));
- break;
- case ieee_region_base_address_enum:
- section = ieee->section_table[must_parse_int (&(ieee->h))];
- section->vma = must_parse_int (&(ieee->h));
- section->lma = section->vma;
- break;
- case ieee_mau_size_enum:
- must_parse_int (&(ieee->h));
- must_parse_int (&(ieee->h));
- break;
- case ieee_m_value_enum:
- must_parse_int (&(ieee->h));
- must_parse_int (&(ieee->h));
- break;
- case ieee_section_base_address_enum:
- section = ieee->section_table[must_parse_int (&(ieee->h))];
- section->vma = must_parse_int (&(ieee->h));
- section->lma = section->vma;
- break;
- case ieee_section_offset_enum:
- (void) must_parse_int (&(ieee->h));
- (void) must_parse_int (&(ieee->h));
- break;
- default:
- return;
- }
- }
- break;
- default:
- return;
- }
- }
- }
-}
-
-/* Make a section for the debugging information, if any. We don't try
- to interpret the debugging information; we just point the section
- at the area in the file so that program which understand can dig it
- out. */
-
-static bfd_boolean
-ieee_slurp_debug (abfd)
- bfd *abfd;
-{
- ieee_data_type *ieee = IEEE_DATA (abfd);
- asection *sec;
- file_ptr debug_end;
-
- if (ieee->w.r.debug_information_part == 0)
- return TRUE;
-
- sec = bfd_make_section (abfd, ".debug");
- if (sec == NULL)
- return FALSE;
- sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
- sec->filepos = ieee->w.r.debug_information_part;
-
- debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part);
- sec->_raw_size = debug_end - ieee->w.r.debug_information_part;
-
- return TRUE;
-}
-
-/* Archive stuff. */
-
-const bfd_target *
-ieee_archive_p (abfd)
- bfd *abfd;
-{
- char *library;
- unsigned int i;
- unsigned char buffer[512];
- file_ptr buffer_offset = 0;
- ieee_ar_data_type *save = abfd->tdata.ieee_ar_data;
- ieee_ar_data_type *ieee;
- bfd_size_type alc_elts;
- ieee_ar_obstack_type *elts = NULL;
- bfd_size_type amt = sizeof (ieee_ar_data_type);
-
- abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, amt);
- if (!abfd->tdata.ieee_ar_data)
- goto error_ret_restore;
- ieee = IEEE_AR_DATA (abfd);
-
- /* Ignore the return value here. It doesn't matter if we don't read
- the entire buffer. We might have a very small ieee file. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
-
- ieee->h.first_byte = buffer;
- ieee->h.input_p = buffer;
-
- ieee->h.abfd = abfd;
-
- if (this_byte (&(ieee->h)) != Module_Beginning)
- goto got_wrong_format_error;
-
- next_byte (&(ieee->h));
- library = read_id (&(ieee->h));
- if (strcmp (library, "LIBRARY") != 0)
- goto got_wrong_format_error;
-
- /* Throw away the filename. */
- read_id (&(ieee->h));
-
- ieee->element_count = 0;
- ieee->element_index = 0;
-
- next_byte (&(ieee->h)); /* Drop the ad part. */
- must_parse_int (&(ieee->h)); /* And the two dummy numbers. */
- must_parse_int (&(ieee->h));
-
- alc_elts = 10;
- elts = (ieee_ar_obstack_type *) bfd_malloc (alc_elts * sizeof *elts);
- if (elts == NULL)
- goto error_return;
-
- /* Read the index of the BB table. */
- while (1)
- {
- int rec;
- ieee_ar_obstack_type *t;
-
- rec = read_2bytes (&(ieee->h));
- if (rec != (int) ieee_assign_value_to_variable_enum)
- break;
-
- if (ieee->element_count >= alc_elts)
- {
- ieee_ar_obstack_type *n;
-
- alc_elts *= 2;
- n = ((ieee_ar_obstack_type *)
- bfd_realloc (elts, alc_elts * sizeof *elts));
- if (n == NULL)
- goto error_return;
- elts = n;
- }
-
- t = &elts[ieee->element_count];
- ieee->element_count++;
-
- must_parse_int (&(ieee->h));
- t->file_offset = must_parse_int (&(ieee->h));
- t->abfd = (bfd *) NULL;
-
- /* Make sure that we don't go over the end of the buffer. */
- if ((size_t) ieee_pos (IEEE_DATA (abfd)) > sizeof (buffer) / 2)
- {
- /* Past half way, reseek and reprime. */
- buffer_offset += ieee_pos (IEEE_DATA (abfd));
- if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0)
- goto error_return;
-
- /* Again ignore return value of bfd_bread. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
- ieee->h.first_byte = buffer;
- ieee->h.input_p = buffer;
- }
- }
-
- amt = ieee->element_count;
- amt *= sizeof *ieee->elements;
- ieee->elements = (ieee_ar_obstack_type *) bfd_alloc (abfd, amt);
- if (ieee->elements == NULL)
- goto error_return;
-
- memcpy (ieee->elements, elts, (size_t) amt);
- free (elts);
- elts = NULL;
-
- /* Now scan the area again, and replace BB offsets with file offsets. */
- for (i = 2; i < ieee->element_count; i++)
- {
- if (bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET) != 0)
- goto error_return;
-
- /* Again ignore return value of bfd_bread. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
- ieee->h.first_byte = buffer;
- ieee->h.input_p = buffer;
-
- next_byte (&(ieee->h)); /* Drop F8. */
- next_byte (&(ieee->h)); /* Drop 14. */
- must_parse_int (&(ieee->h)); /* Drop size of block. */
-
- if (must_parse_int (&(ieee->h)) != 0)
- /* This object has been deleted. */
- ieee->elements[i].file_offset = 0;
- else
- ieee->elements[i].file_offset = must_parse_int (&(ieee->h));
- }
-
- /* abfd->has_armap = ;*/
-
- return abfd->xvec;
-
- got_wrong_format_error:
- bfd_set_error (bfd_error_wrong_format);
- error_return:
- if (elts != NULL)
- free (elts);
- bfd_release (abfd, ieee);
- error_ret_restore:
- abfd->tdata.ieee_ar_data = save;
-
- return NULL;
-}
-
-const bfd_target *
-ieee_object_p (abfd)
- bfd *abfd;
-{
- char *processor;
- unsigned int part;
- ieee_data_type *ieee;
- unsigned char buffer[300];
- ieee_data_type *save = IEEE_DATA (abfd);
- bfd_size_type amt;
-
- abfd->tdata.ieee_data = 0;
- ieee_mkobject (abfd);
-
- ieee = IEEE_DATA (abfd);
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- goto fail;
- /* Read the first few bytes in to see if it makes sense. Ignore
- bfd_bread return value; The file might be very small. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
-
- ieee->h.input_p = buffer;
- if (this_byte_and_next (&(ieee->h)) != Module_Beginning)
- goto got_wrong_format;
-
- ieee->read_symbols = FALSE;
- ieee->read_data = FALSE;
- ieee->section_count = 0;
- ieee->external_symbol_max_index = 0;
- ieee->external_symbol_min_index = IEEE_PUBLIC_BASE;
- ieee->external_reference_min_index = IEEE_REFERENCE_BASE;
- ieee->external_reference_max_index = 0;
- ieee->h.abfd = abfd;
- ieee->section_table = NULL;
- ieee->section_table_size = 0;
-
- processor = ieee->mb.processor = read_id (&(ieee->h));
- if (strcmp (processor, "LIBRARY") == 0)
- goto got_wrong_format;
- ieee->mb.module_name = read_id (&(ieee->h));
- if (abfd->filename == (const char *) NULL)
- abfd->filename = ieee->mb.module_name;
-
- /* Determine the architecture and machine type of the object file. */
- {
- const bfd_arch_info_type *arch;
- char family[10];
-
- /* IEEE does not specify the format of the processor identification
- string, so the compiler is free to put in it whatever it wants.
- We try here to recognize different processors belonging to the
- m68k family. Code for other processors can be added here. */
- if ((processor[0] == '6') && (processor[1] == '8'))
- {
- if (processor[2] == '3') /* 683xx integrated processors */
- {
- switch (processor[3])
- {
- case '0': /* 68302, 68306, 68307 */
- case '2': /* 68322, 68328 */
- case '5': /* 68356 */
- strcpy (family, "68000"); /* MC68000-based controllers */
- break;
-
- case '3': /* 68330, 68331, 68332, 68333,
- 68334, 68335, 68336, 68338 */
- case '6': /* 68360 */
- case '7': /* 68376 */
- strcpy (family, "68332"); /* CPU32 and CPU32+ */
- break;
-
- case '4':
- if (processor[4] == '9') /* 68349 */
- strcpy (family, "68030"); /* CPU030 */
- else /* 68340, 68341 */
- strcpy (family, "68332"); /* CPU32 and CPU32+ */
- break;
-
- default: /* Does not exist yet */
- strcpy (family, "68332"); /* Guess it will be CPU32 */
- }
- }
- else if (TOUPPER (processor[3]) == 'F') /* 68F333 */
- strcpy (family, "68332"); /* CPU32 */
- else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers. */
- && ((TOUPPER (processor[2]) == 'E')
- || (TOUPPER (processor[2]) == 'H')
- || (TOUPPER (processor[2]) == 'L')))
- {
- strcpy (family, "68");
- strncat (family, processor + 4, 7);
- family[9] = '\0';
- }
- else /* "Regular" processors. */
- {
- strncpy (family, processor, 9);
- family[9] = '\0';
- }
- }
- else if ((strncmp (processor, "cpu32", 5) == 0) /* CPU32 and CPU32+ */
- || (strncmp (processor, "CPU32", 5) == 0))
- strcpy (family, "68332");
- else
- {
- strncpy (family, processor, 9);
- family[9] = '\0';
- }
-
- arch = bfd_scan_arch (family);
- if (arch == 0)
- goto got_wrong_format;
- abfd->arch_info = arch;
- }
-
- if (this_byte (&(ieee->h)) != (int) ieee_address_descriptor_enum)
- goto fail;
-
- next_byte (&(ieee->h));
-
- if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau))
- goto fail;
-
- if (! parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address))
- goto fail;
-
- /* If there is a byte order info, take it. */
- if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum
- || this_byte (&(ieee->h)) == (int) ieee_variable_M_enum)
- next_byte (&(ieee->h));
-
- for (part = 0; part < N_W_VARIABLES; part++)
- {
- bfd_boolean ok;
-
- if (read_2bytes (&(ieee->h)) != (int) ieee_assign_value_to_variable_enum)
- goto fail;
-
- if (this_byte_and_next (&(ieee->h)) != part)
- goto fail;
-
- ieee->w.offset[part] = parse_i (&(ieee->h), &ok);
- if (! ok)
- goto fail;
- }
-
- if (ieee->w.r.external_part != 0)
- abfd->flags = HAS_SYMS;
-
- /* By now we know that this is a real IEEE file, we're going to read
- the whole thing into memory so that we can run up and down it
- quickly. We can work out how big the file is from the trailer
- record. */
-
- amt = ieee->w.r.me_record + 1;
- IEEE_DATA (abfd)->h.first_byte =
- (unsigned char *) bfd_alloc (ieee->h.abfd, amt);
- if (!IEEE_DATA (abfd)->h.first_byte)
- goto fail;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- goto fail;
- /* FIXME: Check return value. I'm not sure whether it needs to read
- the entire buffer or not. */
- bfd_bread ((PTR) (IEEE_DATA (abfd)->h.first_byte),
- (bfd_size_type) ieee->w.r.me_record + 1, abfd);
-
- ieee_slurp_sections (abfd);
-
- if (! ieee_slurp_debug (abfd))
- goto fail;
-
- /* Parse section data to activate file and section flags implied by
- section contents. */
- if (! ieee_slurp_section_data (abfd))
- goto fail;
-
- return abfd->xvec;
-got_wrong_format:
- bfd_set_error (bfd_error_wrong_format);
-fail:
- bfd_release (abfd, ieee);
- abfd->tdata.ieee_data = save;
- return (const bfd_target *) NULL;
-}
-
-static void
-ieee_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
- if (symbol->name[0] == ' ')
- ret->name = "* empty table entry ";
- if (!symbol->section)
- ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A';
-}
-
-static void
-ieee_print_symbol (abfd, afile, symbol, how)
- bfd *abfd;
- PTR afile;
- asymbol *symbol;
- bfd_print_symbol_type how;
-{
- FILE *file = (FILE *) afile;
-
- switch (how)
- {
- case bfd_print_symbol_name:
- fprintf (file, "%s", symbol->name);
- break;
- case bfd_print_symbol_more:
-#if 0
- fprintf (file, "%4x %2x", aout_symbol (symbol)->desc & 0xffff,
- aout_symbol (symbol)->other & 0xff);
-#endif
- BFD_FAIL ();
- break;
- case bfd_print_symbol_all:
- {
- const char *section_name =
- (symbol->section == (asection *) NULL
- ? "*abs"
- : symbol->section->name);
-
- if (symbol->name[0] == ' ')
- {
- fprintf (file, "* empty table entry ");
- }
- else
- {
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
-
- fprintf (file, " %-5s %04x %02x %s",
- section_name,
- (unsigned) ieee_symbol (symbol)->index,
- (unsigned) 0,
- symbol->name);
- }
- }
- break;
- }
-}
-
-static bfd_boolean
-do_one (ieee, current_map, location_ptr, s, iterations)
- ieee_data_type *ieee;
- ieee_per_section_type *current_map;
- unsigned char *location_ptr;
- asection *s;
- int iterations;
-{
- switch (this_byte (&(ieee->h)))
- {
- case ieee_load_constant_bytes_enum:
- {
- unsigned int number_of_maus;
- unsigned int i;
-
- next_byte (&(ieee->h));
- number_of_maus = must_parse_int (&(ieee->h));
-
- for (i = 0; i < number_of_maus; i++)
- {
- location_ptr[current_map->pc++] = this_byte (&(ieee->h));
- next_byte (&(ieee->h));
- }
- }
- break;
-
- case ieee_load_with_relocation_enum:
- {
- bfd_boolean loop = TRUE;
-
- next_byte (&(ieee->h));
- while (loop)
- {
- switch (this_byte (&(ieee->h)))
- {
- case ieee_variable_R_enum:
-
- case ieee_function_signed_open_b_enum:
- case ieee_function_unsigned_open_b_enum:
- case ieee_function_either_open_b_enum:
- {
- unsigned int extra = 4;
- bfd_boolean pcrel = FALSE;
- asection *section;
- ieee_reloc_type *r;
- bfd_size_type amt = sizeof (ieee_reloc_type);
-
- r = (ieee_reloc_type *) bfd_alloc (ieee->h.abfd, amt);
- if (!r)
- return FALSE;
-
- *(current_map->reloc_tail_ptr) = r;
- current_map->reloc_tail_ptr = &r->next;
- r->next = (ieee_reloc_type *) NULL;
- next_byte (&(ieee->h));
-/* abort();*/
- r->relent.sym_ptr_ptr = 0;
- parse_expression (ieee,
- &r->relent.addend,
- &r->symbol,
- &pcrel, &extra, &section);
- r->relent.address = current_map->pc;
- s->flags |= SEC_RELOC;
- s->owner->flags |= HAS_RELOC;
- s->reloc_count++;
- if (r->relent.sym_ptr_ptr == NULL && section != NULL)
- r->relent.sym_ptr_ptr = section->symbol_ptr_ptr;
-
- if (this_byte (&(ieee->h)) == (int) ieee_comma)
- {
- next_byte (&(ieee->h));
- /* Fetch number of bytes to pad. */
- extra = must_parse_int (&(ieee->h));
- };
-
- switch (this_byte (&(ieee->h)))
- {
- case ieee_function_signed_close_b_enum:
- next_byte (&(ieee->h));
- break;
- case ieee_function_unsigned_close_b_enum:
- next_byte (&(ieee->h));
- break;
- case ieee_function_either_close_b_enum:
- next_byte (&(ieee->h));
- break;
- default:
- break;
- }
- /* Build a relocation entry for this type. */
- /* If pc rel then stick -ve pc into instruction
- and take out of reloc ..
-
- I've changed this. It's all too complicated. I
- keep 0 in the instruction now. */
-
- switch (extra)
- {
- case 0:
- case 4:
-
- if (pcrel)
- {
-#if KEEPMINUSPCININST
- bfd_put_32 (ieee->h.abfd, -current_map->pc,
- location_ptr + current_map->pc);
- r->relent.howto = &rel32_howto;
- r->relent.addend -= current_map->pc;
-#else
- bfd_put_32 (ieee->h.abfd, (bfd_vma) 0, location_ptr +
- current_map->pc);
- r->relent.howto = &rel32_howto;
-#endif
- }
- else
- {
- bfd_put_32 (ieee->h.abfd, (bfd_vma) 0,
- location_ptr + current_map->pc);
- r->relent.howto = &abs32_howto;
- }
- current_map->pc += 4;
- break;
- case 2:
- if (pcrel)
- {
-#if KEEPMINUSPCININST
- bfd_put_16 (ieee->h.abfd, (bfd_vma) -current_map->pc,
- location_ptr + current_map->pc);
- r->relent.addend -= current_map->pc;
- r->relent.howto = &rel16_howto;
-#else
-
- bfd_put_16 (ieee->h.abfd, (bfd_vma) 0,
- location_ptr + current_map->pc);
- r->relent.howto = &rel16_howto;
-#endif
- }
-
- else
- {
- bfd_put_16 (ieee->h.abfd, (bfd_vma) 0,
- location_ptr + current_map->pc);
- r->relent.howto = &abs16_howto;
- }
- current_map->pc += 2;
- break;
- case 1:
- if (pcrel)
- {
-#if KEEPMINUSPCININST
- bfd_put_8 (ieee->h.abfd, (int) (-current_map->pc), location_ptr + current_map->pc);
- r->relent.addend -= current_map->pc;
- r->relent.howto = &rel8_howto;
-#else
- bfd_put_8 (ieee->h.abfd, 0, location_ptr + current_map->pc);
- r->relent.howto = &rel8_howto;
-#endif
- }
- else
- {
- bfd_put_8 (ieee->h.abfd, 0, location_ptr + current_map->pc);
- r->relent.howto = &abs8_howto;
- }
- current_map->pc += 1;
- break;
-
- default:
- BFD_FAIL ();
- return FALSE;
- }
- }
- break;
- default:
- {
- bfd_vma this_size;
- if (parse_int (&(ieee->h), &this_size))
- {
- unsigned int i;
- for (i = 0; i < this_size; i++)
- {
- location_ptr[current_map->pc++] = this_byte (&(ieee->h));
- next_byte (&(ieee->h));
- }
- }
- else
- {
- loop = FALSE;
- }
- }
- }
-
- /* Prevent more than the first load-item of an LR record
- from being repeated (MRI convention). */
- if (iterations != 1)
- loop = FALSE;
- }
- }
- }
- return TRUE;
-}
-
-/* Read in all the section data and relocation stuff too. */
-
-static bfd_boolean
-ieee_slurp_section_data (abfd)
- bfd *abfd;
-{
- bfd_byte *location_ptr = (bfd_byte *) NULL;
- ieee_data_type *ieee = IEEE_DATA (abfd);
- unsigned int section_number;
-
- ieee_per_section_type *current_map = (ieee_per_section_type *) NULL;
- asection *s;
- /* Seek to the start of the data area. */
- if (ieee->read_data)
- return TRUE;
- ieee->read_data = TRUE;
- ieee_seek (ieee, ieee->w.r.data_part);
-
- /* Allocate enough space for all the section contents. */
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
- {
- ieee_per_section_type *per = ieee_per_section (s);
- if ((s->flags & SEC_DEBUGGING) != 0)
- continue;
- per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
- if (!per->data)
- return FALSE;
- per->reloc_tail_ptr =
- (ieee_reloc_type **) & (s->relocation);
- }
-
- while (TRUE)
- {
- switch (this_byte (&(ieee->h)))
- {
- /* IF we see anything strange then quit. */
- default:
- return TRUE;
-
- case ieee_set_current_section_enum:
- next_byte (&(ieee->h));
- section_number = must_parse_int (&(ieee->h));
- s = ieee->section_table[section_number];
- s->flags |= SEC_LOAD | SEC_HAS_CONTENTS;
- current_map = ieee_per_section (s);
- location_ptr = current_map->data - s->vma;
- /* The document I have says that Microtec's compilers reset
- this after a sec section, even though the standard says not
- to, SO... */
- current_map->pc = s->vma;
- break;
-
- case ieee_e2_first_byte_enum:
- next_byte (&(ieee->h));
- switch (this_byte (&(ieee->h)))
- {
- case ieee_set_current_pc_enum & 0xff:
- {
- bfd_vma value;
- ieee_symbol_index_type symbol;
- unsigned int extra;
- bfd_boolean pcrel;
-
- next_byte (&(ieee->h));
- must_parse_int (&(ieee->h)); /* Throw away section #. */
- parse_expression (ieee, &value,
- &symbol,
- &pcrel, &extra,
- 0);
- current_map->pc = value;
- BFD_ASSERT ((unsigned) (value - s->vma) <= s->_raw_size);
- }
- break;
-
- case ieee_value_starting_address_enum & 0xff:
- next_byte (&(ieee->h));
- if (this_byte (&(ieee->h)) == ieee_function_either_open_b_enum)
- next_byte (&(ieee->h));
- abfd->start_address = must_parse_int (&(ieee->h));
- /* We've got to the end of the data now - */
- return TRUE;
- default:
- BFD_FAIL ();
- return FALSE;
- }
- break;
- case ieee_repeat_data_enum:
- {
- /* Repeat the following LD or LR n times - we do this by
- remembering the stream pointer before running it and
- resetting it and running it n times. We special case
- the repetition of a repeat_data/load_constant. */
- unsigned int iterations;
- unsigned char *start;
-
- next_byte (&(ieee->h));
- iterations = must_parse_int (&(ieee->h));
- start = ieee->h.input_p;
- if (start[0] == (int) ieee_load_constant_bytes_enum
- && start[1] == 1)
- {
- while (iterations != 0)
- {
- location_ptr[current_map->pc++] = start[2];
- iterations--;
- }
- next_byte (&(ieee->h));
- next_byte (&(ieee->h));
- next_byte (&(ieee->h));
- }
- else
- {
- while (iterations != 0)
- {
- ieee->h.input_p = start;
- if (!do_one (ieee, current_map, location_ptr, s,
- (int) iterations))
- return FALSE;
- iterations--;
- }
- }
- }
- break;
- case ieee_load_constant_bytes_enum:
- case ieee_load_with_relocation_enum:
- if (!do_one (ieee, current_map, location_ptr, s, 1))
- return FALSE;
- }
- }
-}
-
-static bfd_boolean
-ieee_new_section_hook (abfd, newsect)
- bfd *abfd;
- asection *newsect;
-{
- newsect->used_by_bfd
- = (PTR) bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
- if (!newsect->used_by_bfd)
- return FALSE;
- ieee_per_section (newsect)->data = (bfd_byte *) NULL;
- ieee_per_section (newsect)->section = newsect;
- return TRUE;
-}
-
-static long
-ieee_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
-{
- if ((asect->flags & SEC_DEBUGGING) != 0)
- return 0;
- if (! ieee_slurp_section_data (abfd))
- return -1;
- return (asect->reloc_count + 1) * sizeof (arelent *);
-}
-
-static bfd_boolean
-ieee_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- ieee_per_section_type *p = ieee_per_section (section);
- if ((section->flags & SEC_DEBUGGING) != 0)
- return _bfd_generic_get_section_contents (abfd, section, location,
- offset, count);
- ieee_slurp_section_data (abfd);
- (void) memcpy ((PTR) location, (PTR) (p->data + offset), (unsigned) count);
- return TRUE;
-}
-
-static long
-ieee_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
-{
- ieee_reloc_type *src = (ieee_reloc_type *) (section->relocation);
- ieee_data_type *ieee = IEEE_DATA (abfd);
-
- if ((section->flags & SEC_DEBUGGING) != 0)
- return 0;
-
- while (src != (ieee_reloc_type *) NULL)
- {
- /* Work out which symbol to attach it this reloc to. */
- switch (src->symbol.letter)
- {
- case 'I':
- src->relent.sym_ptr_ptr =
- symbols + src->symbol.index + ieee->external_symbol_base_offset;
- break;
- case 'X':
- src->relent.sym_ptr_ptr =
- symbols + src->symbol.index + ieee->external_reference_base_offset;
- break;
- case 0:
- if (src->relent.sym_ptr_ptr != NULL)
- src->relent.sym_ptr_ptr =
- src->relent.sym_ptr_ptr[0]->section->symbol_ptr_ptr;
- break;
- default:
-
- BFD_FAIL ();
- }
- *relptr++ = &src->relent;
- src = src->next;
- }
- *relptr = (arelent *) NULL;
- return section->reloc_count;
-}
-
-static int
-comp (ap, bp)
- const PTR ap;
- const PTR bp;
-{
- arelent *a = *((arelent **) ap);
- arelent *b = *((arelent **) bp);
- return a->address - b->address;
-}
-
-/* Write the section headers. */
-
-static bfd_boolean
-ieee_write_section_part (abfd)
- bfd *abfd;
-{
- ieee_data_type *ieee = IEEE_DATA (abfd);
- asection *s;
- ieee->w.r.section_part = bfd_tell (abfd);
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
- {
- if (! bfd_is_abs_section (s)
- && (s->flags & SEC_DEBUGGING) == 0)
- {
- if (! ieee_write_byte (abfd, ieee_section_type_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (s->index
- + IEEE_SECTION_NUMBER_BASE)))
- return FALSE;
-
- if (abfd->flags & EXEC_P)
- {
- /* This image is executable, so output absolute sections. */
- if (! ieee_write_byte (abfd, ieee_variable_A_enum)
- || ! ieee_write_byte (abfd, ieee_variable_S_enum))
- return FALSE;
- }
- else
- {
- if (! ieee_write_byte (abfd, ieee_variable_C_enum))
- return FALSE;
- }
-
- switch (s->flags & (SEC_CODE | SEC_DATA | SEC_ROM))
- {
- case SEC_CODE | SEC_LOAD:
- case SEC_CODE:
- if (! ieee_write_byte (abfd, ieee_variable_P_enum))
- return FALSE;
- break;
- case SEC_DATA:
- default:
- if (! ieee_write_byte (abfd, ieee_variable_D_enum))
- return FALSE;
- break;
- case SEC_ROM:
- case SEC_ROM | SEC_DATA:
- case SEC_ROM | SEC_LOAD:
- case SEC_ROM | SEC_DATA | SEC_LOAD:
- if (! ieee_write_byte (abfd, ieee_variable_R_enum))
- return FALSE;
- }
-
-
- if (! ieee_write_id (abfd, s->name))
- return FALSE;
-#if 0
- ieee_write_int (abfd, 0); /* Parent */
- ieee_write_int (abfd, 0); /* Brother */
- ieee_write_int (abfd, 0); /* Context */
-#endif
- /* Alignment. */
- if (! ieee_write_byte (abfd, ieee_section_alignment_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (s->index
- + IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_int (abfd, (bfd_vma) 1 << s->alignment_power))
- return FALSE;
-
- /* Size. */
- if (! ieee_write_2bytes (abfd, ieee_section_size_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (s->index
- + IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_int (abfd, s->_raw_size))
- return FALSE;
- if (abfd->flags & EXEC_P)
- {
- /* Relocateable sections don't have asl records. */
- /* Vma. */
- if (! ieee_write_2bytes (abfd, ieee_section_base_address_enum)
- || ! ieee_write_byte (abfd,
- ((bfd_byte)
- (s->index
- + IEEE_SECTION_NUMBER_BASE)))
- || ! ieee_write_int (abfd, s->lma))
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-
-static bfd_boolean
-do_with_relocs (abfd, s)
- bfd *abfd;
- asection *s;
-{
- unsigned int number_of_maus_in_address =
- bfd_arch_bits_per_address (abfd) / bfd_arch_bits_per_byte (abfd);
- unsigned int relocs_to_go = s->reloc_count;
- bfd_byte *stream = ieee_per_section (s)->data;
- arelent **p = s->orelocation;
- bfd_size_type current_byte_index = 0;
-
- qsort (s->orelocation,
- relocs_to_go,
- sizeof (arelent **),
- comp);
-
- /* Output the section preheader. */
- if (! ieee_write_byte (abfd, ieee_set_current_section_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_2bytes (abfd, ieee_set_current_pc_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)))
- return FALSE;
-
- if ((abfd->flags & EXEC_P) != 0 && relocs_to_go == 0)
- {
- if (! ieee_write_int (abfd, s->lma))
- return FALSE;
- }
- else
- {
- if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0))
- return FALSE;
- }
-
- if (relocs_to_go == 0)
- {
- /* If there aren't any relocations then output the load constant
- byte opcode rather than the load with relocation opcode. */
- while (current_byte_index < s->_raw_size)
- {
- bfd_size_type run;
- unsigned int MAXRUN = 127;
-
- run = MAXRUN;
- if (run > s->_raw_size - current_byte_index)
- run = s->_raw_size - current_byte_index;
-
- if (run != 0)
- {
- if (! ieee_write_byte (abfd, ieee_load_constant_bytes_enum))
- return FALSE;
- /* Output a stream of bytes. */
- if (! ieee_write_int (abfd, run))
- return FALSE;
- if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
- != run)
- return FALSE;
- current_byte_index += run;
- }
- }
- }
- else
- {
- if (! ieee_write_byte (abfd, ieee_load_with_relocation_enum))
- return FALSE;
-
- /* Output the data stream as the longest sequence of bytes
- possible, allowing for the a reasonable packet size and
- relocation stuffs. */
-
- if ((PTR) stream == (PTR) NULL)
- {
- /* Outputting a section without data, fill it up. */
- stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size);
- if (!stream)
- return FALSE;
- }
- while (current_byte_index < s->_raw_size)
- {
- bfd_size_type run;
- unsigned int MAXRUN = 127;
-
- if (relocs_to_go)
- {
- run = (*p)->address - current_byte_index;
- if (run > MAXRUN)
- run = MAXRUN;
- }
- else
- run = MAXRUN;
-
- if (run > s->_raw_size - current_byte_index)
- run = s->_raw_size - current_byte_index;
-
- if (run != 0)
- {
- /* Output a stream of bytes. */
- if (! ieee_write_int (abfd, run))
- return FALSE;
- if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
- != run)
- return FALSE;
- current_byte_index += run;
- }
-
- /* Output any relocations here. */
- if (relocs_to_go && (*p) && (*p)->address == current_byte_index)
- {
- while (relocs_to_go
- && (*p) && (*p)->address == current_byte_index)
- {
- arelent *r = *p;
- bfd_signed_vma ov;
-#if 0
- if (r->howto->pc_relative)
- r->addend += current_byte_index;
-#endif
- switch (r->howto->size)
- {
- case 2:
-
- ov = bfd_get_signed_32 (abfd,
- stream + current_byte_index);
- current_byte_index += 4;
- break;
- case 1:
- ov = bfd_get_signed_16 (abfd,
- stream + current_byte_index);
- current_byte_index += 2;
- break;
- case 0:
- ov = bfd_get_signed_8 (abfd,
- stream + current_byte_index);
- current_byte_index++;
- break;
- default:
- ov = 0;
- BFD_FAIL ();
- return FALSE;
- }
-
- ov &= r->howto->src_mask;
-
- if (r->howto->pc_relative
- && ! r->howto->pcrel_offset)
- ov += r->address;
-
- if (! ieee_write_byte (abfd,
- ieee_function_either_open_b_enum))
- return FALSE;
-
-/* abort();*/
-
- if (r->sym_ptr_ptr != (asymbol **) NULL)
- {
- if (! ieee_write_expression (abfd, r->addend + ov,
- *(r->sym_ptr_ptr),
- r->howto->pc_relative,
- (unsigned) s->index))
- return FALSE;
- }
- else
- {
- if (! ieee_write_expression (abfd, r->addend + ov,
- (asymbol *) NULL,
- r->howto->pc_relative,
- (unsigned) s->index))
- return FALSE;
- }
-
- if (number_of_maus_in_address
- != bfd_get_reloc_size (r->howto))
- {
- bfd_vma rsize = bfd_get_reloc_size (r->howto);
- if (! ieee_write_int (abfd, rsize))
- return FALSE;
- }
- if (! ieee_write_byte (abfd,
- ieee_function_either_close_b_enum))
- return FALSE;
-
- relocs_to_go--;
- p++;
- }
-
- }
- }
- }
-
- return TRUE;
-}
-
-/* If there are no relocations in the output section then we can be
- clever about how we write. We block items up into a max of 127
- bytes. */
-
-static bfd_boolean
-do_as_repeat (abfd, s)
- bfd *abfd;
- asection *s;
-{
- if (s->_raw_size)
- {
- if (! ieee_write_byte (abfd, ieee_set_current_section_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (s->index
- + IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_byte (abfd, ieee_set_current_pc_enum >> 8)
- || ! ieee_write_byte (abfd, ieee_set_current_pc_enum & 0xff)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (s->index
- + IEEE_SECTION_NUMBER_BASE)))
- return FALSE;
-
- if ((abfd->flags & EXEC_P) != 0)
- {
- if (! ieee_write_int (abfd, s->lma))
- return FALSE;
- }
- else
- {
- if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0))
- return FALSE;
- }
-
- if (! ieee_write_byte (abfd, ieee_repeat_data_enum)
- || ! ieee_write_int (abfd, s->_raw_size)
- || ! ieee_write_byte (abfd, ieee_load_constant_bytes_enum)
- || ! ieee_write_byte (abfd, 1)
- || ! ieee_write_byte (abfd, 0))
- return FALSE;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-do_without_relocs (abfd, s)
- bfd *abfd;
- asection *s;
-{
- bfd_byte *stream = ieee_per_section (s)->data;
-
- if (stream == 0 || ((s->flags & SEC_LOAD) == 0))
- {
- if (! do_as_repeat (abfd, s))
- return FALSE;
- }
- else
- {
- unsigned int i;
-
- for (i = 0; i < s->_raw_size; i++)
- {
- if (stream[i] != 0)
- {
- if (! do_with_relocs (abfd, s))
- return FALSE;
- return TRUE;
- }
- }
- if (! do_as_repeat (abfd, s))
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static unsigned char *output_ptr_start;
-static unsigned char *output_ptr;
-static unsigned char *output_ptr_end;
-static unsigned char *input_ptr_start;
-static unsigned char *input_ptr;
-static unsigned char *input_ptr_end;
-static bfd *input_bfd;
-static bfd *output_bfd;
-static int output_buffer;
-
-static bfd_boolean
-ieee_mkobject (abfd)
- bfd *abfd;
-{
- bfd_size_type amt;
-
- output_ptr_start = NULL;
- output_ptr = NULL;
- output_ptr_end = NULL;
- input_ptr_start = NULL;
- input_ptr = NULL;
- input_ptr_end = NULL;
- input_bfd = NULL;
- output_bfd = NULL;
- output_buffer = 0;
- amt = sizeof (ieee_data_type);
- abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, amt);
- return abfd->tdata.ieee_data != NULL;
-}
-
-static void
-fill ()
-{
- bfd_size_type amt = input_ptr_end - input_ptr_start;
- /* FIXME: Check return value. I'm not sure whether it needs to read
- the entire buffer or not. */
- bfd_bread ((PTR) input_ptr_start, amt, input_bfd);
- input_ptr = input_ptr_start;
-}
-
-static void
-flush ()
-{
- bfd_size_type amt = output_ptr - output_ptr_start;
-
- if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt)
- abort ();
- output_ptr = output_ptr_start;
- output_buffer++;
-}
-
-#define THIS() ( *input_ptr )
-#define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); }
-#define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); }
-
-static void
-write_int (value)
- int value;
-{
- if (value >= 0 && value <= 127)
- {
- OUT (value);
- }
- else
- {
- unsigned int length;
- /* How many significant bytes ? */
- /* FIXME FOR LONGER INTS. */
- if (value & 0xff000000)
- length = 4;
- else if (value & 0x00ff0000)
- length = 3;
- else if (value & 0x0000ff00)
- length = 2;
- else
- length = 1;
-
- OUT ((int) ieee_number_repeat_start_enum + length);
- switch (length)
- {
- case 4:
- OUT (value >> 24);
- case 3:
- OUT (value >> 16);
- case 2:
- OUT (value >> 8);
- case 1:
- OUT (value);
- }
- }
-}
-
-static void
-copy_id ()
-{
- int length = THIS ();
- char ch;
-
- OUT (length);
- NEXT ();
- while (length--)
- {
- ch = THIS ();
- OUT (ch);
- NEXT ();
- }
-}
-
-#define VAR(x) ((x | 0x80))
-static void
-copy_expression ()
-{
- int stack[10];
- int *tos = stack;
- int value;
-
- while (1)
- {
- switch (THIS ())
- {
- case 0x84:
- NEXT ();
- value = THIS ();
- NEXT ();
- value = (value << 8) | THIS ();
- NEXT ();
- value = (value << 8) | THIS ();
- NEXT ();
- value = (value << 8) | THIS ();
- NEXT ();
- *tos++ = value;
- break;
- case 0x83:
- NEXT ();
- value = THIS ();
- NEXT ();
- value = (value << 8) | THIS ();
- NEXT ();
- value = (value << 8) | THIS ();
- NEXT ();
- *tos++ = value;
- break;
- case 0x82:
- NEXT ();
- value = THIS ();
- NEXT ();
- value = (value << 8) | THIS ();
- NEXT ();
- *tos++ = value;
- break;
- case 0x81:
- NEXT ();
- value = THIS ();
- NEXT ();
- *tos++ = value;
- break;
- case 0x80:
- NEXT ();
- *tos++ = 0;
- break;
- default:
- if (THIS () > 0x84)
- {
- /* Not a number, just bug out with the answer. */
- write_int (*(--tos));
- return;
- }
- *tos++ = THIS ();
- NEXT ();
- break;
- case 0xa5:
- /* PLUS anything. */
- value = *(--tos);
- value += *(--tos);
- *tos++ = value;
- NEXT ();
- break;
- case VAR ('R'):
- {
- int section_number;
- ieee_data_type *ieee;
- asection *s;
-
- NEXT ();
- section_number = THIS ();
-
- NEXT ();
- ieee = IEEE_DATA (input_bfd);
- s = ieee->section_table[section_number];
- value = 0;
- if (s->output_section)
- value = s->output_section->lma;
- value += s->output_offset;
- *tos++ = value;
- }
- break;
- case 0x90:
- {
- NEXT ();
- write_int (*(--tos));
- OUT (0x90);
- return;
- }
- }
- }
-}
-
-/* Drop the int in the buffer, and copy a null into the gap, which we
- will overwrite later */
-
-static void
-fill_int (buf)
- struct output_buffer_struct *buf;
-{
- if (buf->buffer == output_buffer)
- {
- /* Still a chance to output the size. */
- int value = output_ptr - buf->ptrp + 3;
- buf->ptrp[0] = value >> 24;
- buf->ptrp[1] = value >> 16;
- buf->ptrp[2] = value >> 8;
- buf->ptrp[3] = value >> 0;
- }
-}
-
-static void
-drop_int (buf)
- struct output_buffer_struct *buf;
-{
- int type = THIS ();
- int ch;
-
- if (type <= 0x84)
- {
- NEXT ();
- switch (type)
- {
- case 0x84:
- ch = THIS ();
- NEXT ();
- case 0x83:
- ch = THIS ();
- NEXT ();
- case 0x82:
- ch = THIS ();
- NEXT ();
- case 0x81:
- ch = THIS ();
- NEXT ();
- case 0x80:
- break;
- }
- }
- OUT (0x84);
- buf->ptrp = output_ptr;
- buf->buffer = output_buffer;
- OUT (0);
- OUT (0);
- OUT (0);
- OUT (0);
-}
-
-static void
-copy_int ()
-{
- int type = THIS ();
- int ch;
- if (type <= 0x84)
- {
- OUT (type);
- NEXT ();
- switch (type)
- {
- case 0x84:
- ch = THIS ();
- NEXT ();
- OUT (ch);
- case 0x83:
- ch = THIS ();
- NEXT ();
- OUT (ch);
- case 0x82:
- ch = THIS ();
- NEXT ();
- OUT (ch);
- case 0x81:
- ch = THIS ();
- NEXT ();
- OUT (ch);
- case 0x80:
- break;
- }
- }
-}
-
-#define ID copy_id()
-#define INT copy_int()
-#define EXP copy_expression()
-#define INTn(q) copy_int()
-#define EXPn(q) copy_expression()
-
-static void
-f1_record ()
-{
- int ch;
-
- /* ATN record. */
- NEXT ();
- ch = THIS ();
- switch (ch)
- {
- default:
- OUT (0xf1);
- OUT (ch);
- break;
- case 0xc9:
- NEXT ();
- OUT (0xf1);
- OUT (0xc9);
- INT;
- INT;
- ch = THIS ();
- switch (ch)
- {
- case 0x16:
- NEXT ();
- break;
- case 0x01:
- NEXT ();
- break;
- case 0x00:
- NEXT ();
- INT;
- break;
- case 0x03:
- NEXT ();
- INT;
- break;
- case 0x13:
- EXPn (instruction address);
- break;
- default:
- break;
- }
- break;
- case 0xd8:
- /* EXternal ref. */
- NEXT ();
- OUT (0xf1);
- OUT (0xd8);
- EXP;
- EXP;
- EXP;
- EXP;
- break;
- case 0xce:
- NEXT ();
- OUT (0xf1);
- OUT (0xce);
- INT;
- INT;
- ch = THIS ();
- INT;
- switch (ch)
- {
- case 0x01:
- INT;
- INT;
- break;
- case 0x02:
- INT;
- break;
- case 0x04:
- EXPn (external function);
- break;
- case 0x05:
- break;
- case 0x07:
- INTn (line number);
- INT;
- case 0x08:
- break;
- case 0x0a:
- INTn (locked register);
- INT;
- break;
- case 0x3f:
- copy_till_end ();
- break;
- case 0x3e:
- copy_till_end ();
- break;
- case 0x40:
- copy_till_end ();
- break;
- case 0x41:
- ID;
- break;
- }
- }
-}
-
-static void
-f0_record ()
-{
- /* Attribute record. */
- NEXT ();
- OUT (0xf0);
- INTn (Symbol name);
- ID;
-}
-
-static void
-copy_till_end ()
-{
- int ch = THIS ();
-
- while (1)
- {
- while (ch <= 0x80)
- {
- OUT (ch);
- NEXT ();
- ch = THIS ();
- }
- switch (ch)
- {
- case 0x84:
- OUT (THIS ());
- NEXT ();
- case 0x83:
- OUT (THIS ());
- NEXT ();
- case 0x82:
- OUT (THIS ());
- NEXT ();
- case 0x81:
- OUT (THIS ());
- NEXT ();
- OUT (THIS ());
- NEXT ();
-
- ch = THIS ();
- break;
- default:
- return;
- }
- }
-
-}
-
-static void
-f2_record ()
-{
- NEXT ();
- OUT (0xf2);
- INT;
- NEXT ();
- OUT (0xce);
- INT;
- copy_till_end ();
-}
-
-
-static void
-f8_record ()
-{
- int ch;
- NEXT ();
- ch = THIS ();
- switch (ch)
- {
- case 0x01:
- case 0x02:
- case 0x03:
- /* Unique typedefs for module. */
- /* GLobal typedefs. */
- /* High level module scope beginning. */
- {
- struct output_buffer_struct ob;
-
- NEXT ();
- OUT (0xf8);
- OUT (ch);
- drop_int (&ob);
- ID;
-
- block ();
-
- NEXT ();
- fill_int (&ob);
- OUT (0xf9);
- }
- break;
- case 0x04:
- /* Global function. */
- {
- struct output_buffer_struct ob;
-
- NEXT ();
- OUT (0xf8);
- OUT (0x04);
- drop_int (&ob);
- ID;
- INTn (stack size);
- INTn (ret val);
- EXPn (offset);
-
- block ();
-
- NEXT ();
- OUT (0xf9);
- EXPn (size of block);
- fill_int (&ob);
- }
- break;
-
- case 0x05:
- /* File name for source line numbers. */
- {
- struct output_buffer_struct ob;
-
- NEXT ();
- OUT (0xf8);
- OUT (0x05);
- drop_int (&ob);
- ID;
- INTn (year);
- INTn (month);
- INTn (day);
- INTn (hour);
- INTn (monute);
- INTn (second);
- block ();
- NEXT ();
- OUT (0xf9);
- fill_int (&ob);
- }
- break;
-
- case 0x06:
- /* Local function. */
- {
- struct output_buffer_struct ob;
-
- NEXT ();
- OUT (0xf8);
- OUT (0x06);
- drop_int (&ob);
- ID;
- INTn (stack size);
- INTn (type return);
- EXPn (offset);
- block ();
- NEXT ();
- OUT (0xf9);
- EXPn (size);
- fill_int (&ob);
- }
- break;
-
- case 0x0a:
- /* Assembler module scope beginning - */
- {
- struct output_buffer_struct ob;
-
- NEXT ();
- OUT (0xf8);
- OUT (0x0a);
- drop_int (&ob);
- ID;
- ID;
- INT;
- ID;
- INT;
- INT;
- INT;
- INT;
- INT;
- INT;
-
- block ();
-
- NEXT ();
- OUT (0xf9);
- fill_int (&ob);
- }
- break;
- case 0x0b:
- {
- struct output_buffer_struct ob;
-
- NEXT ();
- OUT (0xf8);
- OUT (0x0b);
- drop_int (&ob);
- ID;
- INT;
- INTn (section index);
- EXPn (offset);
- INTn (stuff);
-
- block ();
-
- OUT (0xf9);
- NEXT ();
- EXPn (Size in Maus);
- fill_int (&ob);
- }
- break;
- }
-}
-
-static void
-e2_record ()
-{
- OUT (0xe2);
- NEXT ();
- OUT (0xce);
- NEXT ();
- INT;
- EXP;
-}
-
-static void
-block ()
-{
- int ch;
-
- while (1)
- {
- ch = THIS ();
- switch (ch)
- {
- case 0xe1:
- case 0xe5:
- return;
- case 0xf9:
- return;
- case 0xf0:
- f0_record ();
- break;
- case 0xf1:
- f1_record ();
- break;
- case 0xf2:
- f2_record ();
- break;
- case 0xf8:
- f8_record ();
- break;
- case 0xe2:
- e2_record ();
- break;
-
- }
- }
-}
-
-
-/* Moves all the debug information from the source bfd to the output
- bfd, and relocates any expressions it finds. */
-
-static void
-relocate_debug (output, input)
- bfd *output ATTRIBUTE_UNUSED;
- bfd *input;
-{
-#define IBS 400
-#define OBS 400
- unsigned char input_buffer[IBS];
-
- input_ptr_start = input_ptr = input_buffer;
- input_ptr_end = input_buffer + IBS;
- input_bfd = input;
- /* FIXME: Check return value. I'm not sure whether it needs to read
- the entire buffer or not. */
- bfd_bread ((PTR) input_ptr_start, (bfd_size_type) IBS, input);
- block ();
-}
-
-/* Gather together all the debug information from each input BFD into
- one place, relocating it and emitting it as we go. */
-
-static bfd_boolean
-ieee_write_debug_part (abfd)
- bfd *abfd;
-{
- ieee_data_type *ieee = IEEE_DATA (abfd);
- bfd_chain_type *chain = ieee->chain_root;
- unsigned char obuff[OBS];
- bfd_boolean some_debug = FALSE;
- file_ptr here = bfd_tell (abfd);
-
- output_ptr_start = output_ptr = obuff;
- output_ptr_end = obuff + OBS;
- output_ptr = obuff;
- output_bfd = abfd;
-
- if (chain == (bfd_chain_type *) NULL)
- {
- asection *s;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- if ((s->flags & SEC_DEBUGGING) != 0)
- break;
- if (s == NULL)
- {
- ieee->w.r.debug_information_part = 0;
- return TRUE;
- }
-
- ieee->w.r.debug_information_part = here;
- if (bfd_bwrite (s->contents, s->_raw_size, abfd) != s->_raw_size)
- return FALSE;
- }
- else
- {
- while (chain != (bfd_chain_type *) NULL)
- {
- bfd *entry = chain->this;
- ieee_data_type *entry_ieee = IEEE_DATA (entry);
-
- if (entry_ieee->w.r.debug_information_part)
- {
- if (bfd_seek (entry, entry_ieee->w.r.debug_information_part,
- SEEK_SET) != 0)
- return FALSE;
- relocate_debug (abfd, entry);
- }
-
- chain = chain->next;
- }
-
- if (some_debug)
- ieee->w.r.debug_information_part = here;
- else
- ieee->w.r.debug_information_part = 0;
-
- flush ();
- }
-
- return TRUE;
-}
-
-/* Write the data in an ieee way. */
-
-static bfd_boolean
-ieee_write_data_part (abfd)
- bfd *abfd;
-{
- asection *s;
-
- ieee_data_type *ieee = IEEE_DATA (abfd);
- ieee->w.r.data_part = bfd_tell (abfd);
-
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
- {
- /* Skip sections that have no loadable contents (.bss,
- debugging, etc.) */
- if ((s->flags & SEC_LOAD) == 0)
- continue;
-
- /* Sort the reloc records so we can insert them in the correct
- places */
- if (s->reloc_count != 0)
- {
- if (! do_with_relocs (abfd, s))
- return FALSE;
- }
- else
- {
- if (! do_without_relocs (abfd, s))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-
-static bfd_boolean
-init_for_output (abfd)
- bfd *abfd;
-{
- asection *s;
-
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
- {
- if ((s->flags & SEC_DEBUGGING) != 0)
- continue;
- if (s->_raw_size != 0)
- {
- bfd_size_type size = s->_raw_size;
- ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, size));
- if (!ieee_per_section (s)->data)
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/* Exec and core file sections. */
-
-/* Set section contents is complicated with IEEE since the format is
- not a byte image, but a record stream. */
-
-static bfd_boolean
-ieee_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- if ((section->flags & SEC_DEBUGGING) != 0)
- {
- if (section->contents == NULL)
- {
- bfd_size_type size = section->_raw_size;
- section->contents = (unsigned char *) bfd_alloc (abfd, size);
- if (section->contents == NULL)
- return FALSE;
- }
- /* bfd_set_section_contents has already checked that everything
- is within range. */
- memcpy (section->contents + offset, location, (size_t) count);
- return TRUE;
- }
-
- if (ieee_per_section (section)->data == (bfd_byte *) NULL)
- {
- if (!init_for_output (abfd))
- return FALSE;
- }
- memcpy ((PTR) (ieee_per_section (section)->data + offset),
- (PTR) location,
- (unsigned int) count);
- return TRUE;
-}
-
-/* Write the external symbols of a file. IEEE considers two sorts of
- external symbols, public, and referenced. It uses to internal
- forms to index them as well. When we write them out we turn their
- symbol values into indexes from the right base. */
-
-static bfd_boolean
-ieee_write_external_part (abfd)
- bfd *abfd;
-{
- asymbol **q;
- ieee_data_type *ieee = IEEE_DATA (abfd);
- unsigned int reference_index = IEEE_REFERENCE_BASE;
- unsigned int public_index = IEEE_PUBLIC_BASE + 2;
- file_ptr here = bfd_tell (abfd);
- bfd_boolean hadone = FALSE;
-
- if (abfd->outsymbols != (asymbol **) NULL)
- {
-
- for (q = abfd->outsymbols; *q != (asymbol *) NULL; q++)
- {
- asymbol *p = *q;
-
- if (bfd_is_und_section (p->section))
- {
- /* This must be a symbol reference. */
- if (! ieee_write_byte (abfd, ieee_external_reference_enum)
- || ! ieee_write_int (abfd, (bfd_vma) reference_index)
- || ! ieee_write_id (abfd, p->name))
- return FALSE;
- p->value = reference_index;
- reference_index++;
- hadone = TRUE;
- }
- else if (bfd_is_com_section (p->section))
- {
- /* This is a weak reference. */
- if (! ieee_write_byte (abfd, ieee_external_reference_enum)
- || ! ieee_write_int (abfd, (bfd_vma) reference_index)
- || ! ieee_write_id (abfd, p->name)
- || ! ieee_write_byte (abfd,
- ieee_weak_external_reference_enum)
- || ! ieee_write_int (abfd, (bfd_vma) reference_index)
- || ! ieee_write_int (abfd, p->value))
- return FALSE;
- p->value = reference_index;
- reference_index++;
- hadone = TRUE;
- }
- else if (p->flags & BSF_GLOBAL)
- {
- /* This must be a symbol definition. */
- if (! ieee_write_byte (abfd, ieee_external_symbol_enum)
- || ! ieee_write_int (abfd, (bfd_vma) public_index)
- || ! ieee_write_id (abfd, p->name)
- || ! ieee_write_2bytes (abfd, ieee_attribute_record_enum)
- || ! ieee_write_int (abfd, (bfd_vma) public_index)
- || ! ieee_write_byte (abfd, 15) /* instruction address */
- || ! ieee_write_byte (abfd, 19) /* static symbol */
- || ! ieee_write_byte (abfd, 1)) /* one of them */
- return FALSE;
-
- /* Write out the value. */
- if (! ieee_write_2bytes (abfd, ieee_value_record_enum)
- || ! ieee_write_int (abfd, (bfd_vma) public_index))
- return FALSE;
- if (! bfd_is_abs_section (p->section))
- {
- if (abfd->flags & EXEC_P)
- {
- /* If fully linked, then output all symbols
- relocated. */
- if (! (ieee_write_int
- (abfd,
- (p->value
- + p->section->output_offset
- + p->section->output_section->vma))))
- return FALSE;
- }
- else
- {
- if (! (ieee_write_expression
- (abfd,
- p->value + p->section->output_offset,
- p->section->output_section->symbol,
- FALSE, 0)))
- return FALSE;
- }
- }
- else
- {
- if (! ieee_write_expression (abfd,
- p->value,
- bfd_abs_section_ptr->symbol,
- FALSE, 0))
- return FALSE;
- }
- p->value = public_index;
- public_index++;
- hadone = TRUE;
- }
- else
- {
- /* This can happen - when there are gaps in the symbols read
- from an input ieee file. */
- }
- }
- }
- if (hadone)
- ieee->w.r.external_part = here;
-
- return TRUE;
-}
-
-
-static const unsigned char exten[] =
-{
- 0xf0, 0x20, 0x00,
- 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3. */
- 0xf1, 0xce, 0x20, 0x00, 39, 2, /* Keep symbol in original case. */
- 0xf1, 0xce, 0x20, 0x00, 38 /* Set object type relocatable to x. */
-};
-
-static const unsigned char envi[] =
-{
- 0xf0, 0x21, 0x00,
-
-/* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11,
- 0x19, 0x2c,
-*/
- 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */
-
- 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */
-/* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */
-};
-
-static bfd_boolean
-ieee_write_me_part (abfd)
- bfd *abfd;
-{
- ieee_data_type *ieee = IEEE_DATA (abfd);
- ieee->w.r.trailer_part = bfd_tell (abfd);
- if (abfd->start_address)
- {
- if (! ieee_write_2bytes (abfd, ieee_value_starting_address_enum)
- || ! ieee_write_byte (abfd, ieee_function_either_open_b_enum)
- || ! ieee_write_int (abfd, abfd->start_address)
- || ! ieee_write_byte (abfd, ieee_function_either_close_b_enum))
- return FALSE;
- }
- ieee->w.r.me_record = bfd_tell (abfd);
- if (! ieee_write_byte (abfd, ieee_module_end_enum))
- return FALSE;
- return TRUE;
-}
-
-/* Write out the IEEE processor ID. */
-
-static bfd_boolean
-ieee_write_processor (abfd)
- bfd *abfd;
-{
- const bfd_arch_info_type *arch;
-
- arch = bfd_get_arch_info (abfd);
- switch (arch->arch)
- {
- default:
- if (! ieee_write_id (abfd, bfd_printable_name (abfd)))
- return FALSE;
- break;
-
- case bfd_arch_a29k:
- if (! ieee_write_id (abfd, "29000"))
- return FALSE;
- break;
-
- case bfd_arch_h8300:
- if (! ieee_write_id (abfd, "H8/300"))
- return FALSE;
- break;
-
- case bfd_arch_h8500:
- if (! ieee_write_id (abfd, "H8/500"))
- return FALSE;
- break;
-
- case bfd_arch_i960:
- switch (arch->mach)
- {
- default:
- case bfd_mach_i960_core:
- case bfd_mach_i960_ka_sa:
- if (! ieee_write_id (abfd, "80960KA"))
- return FALSE;
- break;
-
- case bfd_mach_i960_kb_sb:
- if (! ieee_write_id (abfd, "80960KB"))
- return FALSE;
- break;
-
- case bfd_mach_i960_ca:
- if (! ieee_write_id (abfd, "80960CA"))
- return FALSE;
- break;
-
- case bfd_mach_i960_mc:
- case bfd_mach_i960_xa:
- if (! ieee_write_id (abfd, "80960MC"))
- return FALSE;
- break;
- }
- break;
-
- case bfd_arch_m68k:
- {
- const char *id;
-
- switch (arch->mach)
- {
- default: id = "68020"; break;
- case bfd_mach_m68000: id = "68000"; break;
- case bfd_mach_m68008: id = "68008"; break;
- case bfd_mach_m68010: id = "68010"; break;
- case bfd_mach_m68020: id = "68020"; break;
- case bfd_mach_m68030: id = "68030"; break;
- case bfd_mach_m68040: id = "68040"; break;
- case bfd_mach_m68060: id = "68060"; break;
- case bfd_mach_cpu32: id = "cpu32"; break;
- case bfd_mach_mcf5200:id = "5200"; break;
- case bfd_mach_mcf5206e:id = "5206e"; break;
- case bfd_mach_mcf5307:id = "5307"; break;
- case bfd_mach_mcf5407:id = "5407"; break;
- case bfd_mach_mcf528x:id = "5282"; break;
- }
-
- if (! ieee_write_id (abfd, id))
- return FALSE;
- }
- break;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-ieee_write_object_contents (abfd)
- bfd *abfd;
-{
- ieee_data_type *ieee = IEEE_DATA (abfd);
- unsigned int i;
- file_ptr old;
-
- /* Fast forward over the header area. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
-
- if (! ieee_write_byte (abfd, ieee_module_beginning_enum)
- || ! ieee_write_processor (abfd)
- || ! ieee_write_id (abfd, abfd->filename))
- return FALSE;
-
- /* Fast forward over the variable bits. */
- if (! ieee_write_byte (abfd, ieee_address_descriptor_enum))
- return FALSE;
-
- /* Bits per MAU. */
- if (! ieee_write_byte (abfd, (bfd_byte) (bfd_arch_bits_per_byte (abfd))))
- return FALSE;
- /* MAU's per address. */
- if (! ieee_write_byte (abfd,
- (bfd_byte) (bfd_arch_bits_per_address (abfd)
- / bfd_arch_bits_per_byte (abfd))))
- return FALSE;
-
- old = bfd_tell (abfd);
- if (bfd_seek (abfd, (file_ptr) (8 * N_W_VARIABLES), SEEK_CUR) != 0)
- return FALSE;
-
- ieee->w.r.extension_record = bfd_tell (abfd);
- if (bfd_bwrite ((char *) exten, (bfd_size_type) sizeof (exten), abfd)
- != sizeof (exten))
- return FALSE;
- if (abfd->flags & EXEC_P)
- {
- if (! ieee_write_byte (abfd, 0x1)) /* Absolute */
- return FALSE;
- }
- else
- {
- if (! ieee_write_byte (abfd, 0x2)) /* Relocateable */
- return FALSE;
- }
-
- ieee->w.r.environmental_record = bfd_tell (abfd);
- if (bfd_bwrite ((char *) envi, (bfd_size_type) sizeof (envi), abfd)
- != sizeof (envi))
- return FALSE;
-
- /* The HP emulator database requires a timestamp in the file. */
- {
- time_t now;
- const struct tm *t;
-
- time (&now);
- t = (struct tm *) localtime (&now);
- if (! ieee_write_2bytes (abfd, (int) ieee_atn_record_enum)
- || ! ieee_write_byte (abfd, 0x21)
- || ! ieee_write_byte (abfd, 0)
- || ! ieee_write_byte (abfd, 50)
- || ! ieee_write_int (abfd, (bfd_vma) (t->tm_year + 1900))
- || ! ieee_write_int (abfd, (bfd_vma) (t->tm_mon + 1))
- || ! ieee_write_int (abfd, (bfd_vma) t->tm_mday)
- || ! ieee_write_int (abfd, (bfd_vma) t->tm_hour)
- || ! ieee_write_int (abfd, (bfd_vma) t->tm_min)
- || ! ieee_write_int (abfd, (bfd_vma) t->tm_sec))
- return FALSE;
- }
-
- output_bfd = abfd;
-
- flush ();
-
- if (! ieee_write_section_part (abfd))
- return FALSE;
- /* First write the symbols. This changes their values into table
- indeces so we cant use it after this point. */
- if (! ieee_write_external_part (abfd))
- return FALSE;
-
- /* Write any debugs we have been told about. */
- if (! ieee_write_debug_part (abfd))
- return FALSE;
-
- /* Can only write the data once the symbols have been written, since
- the data contains relocation information which points to the
- symbols. */
- if (! ieee_write_data_part (abfd))
- return FALSE;
-
- /* At the end we put the end! */
- if (! ieee_write_me_part (abfd))
- return FALSE;
-
- /* Generate the header. */
- if (bfd_seek (abfd, old, SEEK_SET) != 0)
- return FALSE;
-
- for (i = 0; i < N_W_VARIABLES; i++)
- {
- if (! ieee_write_2bytes (abfd, ieee_assign_value_to_variable_enum)
- || ! ieee_write_byte (abfd, (bfd_byte) i)
- || ! ieee_write_int5_out (abfd, (bfd_vma) ieee->w.offset[i]))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Native-level interface to symbols. */
-
-/* We read the symbols into a buffer, which is discarded when this
- function exits. We read the strings into a buffer large enough to
- hold them all plus all the cached symbol entries. */
-
-static asymbol *
-ieee_make_empty_symbol (abfd)
- bfd *abfd;
-{
- bfd_size_type amt = sizeof (ieee_symbol_type);
- ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt);
-
- if (!new)
- return NULL;
- new->symbol.the_bfd = abfd;
- return &new->symbol;
-}
-
-static bfd *
-ieee_openr_next_archived_file (arch, prev)
- bfd *arch;
- bfd *prev;
-{
- ieee_ar_data_type *ar = IEEE_AR_DATA (arch);
-
- /* Take the next one from the arch state, or reset. */
- if (prev == (bfd *) NULL)
- /* Reset the index - the first two entries are bogus. */
- ar->element_index = 2;
-
- while (TRUE)
- {
- ieee_ar_obstack_type *p = ar->elements + ar->element_index;
-
- ar->element_index++;
- if (ar->element_index <= ar->element_count)
- {
- if (p->file_offset != (file_ptr) 0)
- {
- if (p->abfd == (bfd *) NULL)
- {
- p->abfd = _bfd_create_empty_archive_element_shell (arch);
- p->abfd->origin = p->file_offset;
- }
- return p->abfd;
- }
- }
- else
- {
- bfd_set_error (bfd_error_no_more_archived_files);
- return (bfd *) NULL;
- }
- }
-}
-
-static bfd_boolean
-ieee_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
- functionname_ptr, line_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- asymbol **symbols ATTRIBUTE_UNUSED;
- bfd_vma offset ATTRIBUTE_UNUSED;
- const char **filename_ptr ATTRIBUTE_UNUSED;
- const char **functionname_ptr ATTRIBUTE_UNUSED;
- unsigned int *line_ptr ATTRIBUTE_UNUSED;
-{
- return FALSE;
-}
-
-static int
-ieee_generic_stat_arch_elt (abfd, buf)
- bfd *abfd;
- struct stat *buf;
-{
- ieee_ar_data_type *ar = (ieee_ar_data_type *) NULL;
- ieee_data_type *ieee;
-
- if (abfd->my_archive != NULL)
- ar = abfd->my_archive->tdata.ieee_ar_data;
- if (ar == (ieee_ar_data_type *) NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- if (IEEE_DATA (abfd) == NULL)
- {
- if (ieee_object_p (abfd) == NULL)
- {
- bfd_set_error (bfd_error_wrong_format);
- return -1;
- }
- }
-
- ieee = IEEE_DATA (abfd);
-
- buf->st_size = ieee->w.r.me_record + 1;
- buf->st_mode = 0644;
- return 0;
-}
-
-static int
-ieee_sizeof_headers (abfd, x)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean x ATTRIBUTE_UNUSED;
-{
- return 0;
-}
-
-
-/* The debug info routines are never used. */
-#if 0
-
-static void
-ieee_bfd_debug_info_start (abfd)
- bfd *abfd;
-{
-
-}
-
-static void
-ieee_bfd_debug_info_end (abfd)
- bfd *abfd;
-{
-
-}
-
-
-/* Add this section to the list of sections we have debug info for, to
- be ready to output it at close time. */
-static void
-ieee_bfd_debug_info_accumulate (abfd, section)
- bfd *abfd;
- asection *section;
-{
- ieee_data_type *ieee = IEEE_DATA (section->owner);
- ieee_data_type *output_ieee = IEEE_DATA (abfd);
-
- /* Can only accumulate data from other ieee bfds. */
- if (section->owner->xvec != abfd->xvec)
- return;
- /* Only bother once per bfd. */
- if (ieee->done_debug)
- return;
- ieee->done_debug = TRUE;
-
- /* Don't bother if there is no debug info. */
- if (ieee->w.r.debug_information_part == 0)
- return;
-
- /* Add to chain. */
- {
- bfd_size_type amt = sizeof (bfd_chain_type);
- bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, amt);
-
- if (!n)
- abort (); /* FIXME */
- n->this = section->owner;
- n->next = (bfd_chain_type *) NULL;
-
- if (output_ieee->chain_head)
- output_ieee->chain_head->next = n;
- else
- output_ieee->chain_root = n;
-
- output_ieee->chain_head = n;
- }
-}
-
-#endif
-
-#define ieee_close_and_cleanup _bfd_generic_close_and_cleanup
-#define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-
-#define ieee_slurp_armap bfd_true
-#define ieee_slurp_extended_name_table bfd_true
-#define ieee_construct_extended_name_table \
- ((bfd_boolean (*) \
- PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
- bfd_true)
-#define ieee_truncate_arname bfd_dont_truncate_arname
-#define ieee_write_armap \
- ((bfd_boolean (*) \
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
- bfd_true)
-#define ieee_read_ar_hdr bfd_nullvoidptr
-#define ieee_update_armap_timestamp bfd_true
-#define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
-
-#define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define ieee_get_lineno _bfd_nosymbols_get_lineno
-#define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define ieee_read_minisymbols _bfd_generic_read_minisymbols
-#define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-
-#define ieee_set_arch_mach _bfd_generic_set_arch_mach
-
-#define ieee_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-#define ieee_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define ieee_bfd_relax_section bfd_generic_relax_section
-#define ieee_bfd_gc_sections bfd_generic_gc_sections
-#define ieee_bfd_merge_sections bfd_generic_merge_sections
-#define ieee_bfd_discard_group bfd_generic_discard_group
-#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
-#define ieee_bfd_final_link _bfd_generic_final_link
-#define ieee_bfd_link_split_section _bfd_generic_link_split_section
-
-const bfd_target ieee_vec =
-{
- "ieee", /* name */
- bfd_target_ieee_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
- | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- '_', /* leading underscore */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target,
- ieee_object_p, /* bfd_check_format */
- ieee_archive_p,
- _bfd_dummy_target,
- },
- {
- bfd_false,
- ieee_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
- {
- bfd_false,
- ieee_write_object_contents,
- _bfd_write_archive_contents,
- bfd_false,
- },
-
- /* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
- ieee_get_section_contents, ieee_get_section_contents_in_window */
- BFD_JUMP_TABLE_GENERIC (ieee),
-
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
-
- /* ieee_slurp_armap, ieee_slurp_extended_name_table,
- ieee_construct_extended_name_table, ieee_truncate_arname,
- ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file,
- ieee_get_elt_at_index, ieee_generic_stat_arch_elt,
- ieee_update_armap_timestamp */
- BFD_JUMP_TABLE_ARCHIVE (ieee),
-
- /* ieee_get_symtab_upper_bound, ieee_canonicalize_symtab,
- ieee_make_empty_symbol, ieee_print_symbol, ieee_get_symbol_info,
- ieee_bfd_is_local_label_name, ieee_get_lineno,
- ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
- ieee_read_minisymbols, ieee_minisymbol_to_symbol */
- BFD_JUMP_TABLE_SYMBOLS (ieee),
-
- /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
- ieee_bfd_reloc_type_lookup */
- BFD_JUMP_TABLE_RELOCS (ieee),
-
- /* ieee_set_arch_mach, ieee_set_section_contents */
- BFD_JUMP_TABLE_WRITE (ieee),
-
- /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
- ieee_bfd_relax_section, ieee_bfd_link_hash_table_create,
- _bfd_generic_link_hash_table_free,
- ieee_bfd_link_add_symbols, ieee_bfd_final_link,
- ieee_bfd_link_split_section, ieee_bfd_gc_sections,
- ieee_bfd_merge_sections */
- BFD_JUMP_TABLE_LINK (ieee),
-
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0
-};
diff --git a/contrib/binutils/bfd/ihex.c b/contrib/binutils/bfd/ihex.c
deleted file mode 100644
index 5d2d47f..0000000
--- a/contrib/binutils/bfd/ihex.c
+++ /dev/null
@@ -1,1051 +0,0 @@
-/* BFD back-end for Intel Hex objects.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This is what Intel Hex files look like:
-
-1. INTEL FORMATS
-
-A. Intel 1
-
- 16-bit address-field format, for files 64k bytes in length or less.
-
- DATA RECORD
- Byte 1 Header = colon(:)
- 2..3 The number of data bytes in hex notation
- 4..5 High byte of the record load address
- 6..7 Low byte of the record load address
- 8..9 Record type, must be "00"
- 10..x Data bytes in hex notation:
- x = (number of bytes - 1) * 2 + 11
- x+1..x+2 Checksum in hex notation
- x+3..x+4 Carriage return, line feed
-
- END RECORD
- Byte 1 Header = colon (:)
- 2..3 The byte count, must be "00"
- 4..7 Transfer-address (usually "0000")
- the jump-to address, execution start address
- 8..9 Record type, must be "01"
- 10..11 Checksum, in hex notation
- 12..13 Carriage return, line feed
-
-B. INTEL 2
-
- MCS-86 format, using a 20-bit address for files larger than 64K bytes.
-
- DATA RECORD
- Byte 1 Header = colon (:)
- 2..3 The byte count of this record, hex notation
- 4..5 High byte of the record load address
- 6..7 Low byte of the record load address
- 8..9 Record type, must be "00"
- 10..x The data bytes in hex notation:
- x = (number of data bytes - 1) * 2 + 11
- x+1..x+2 Checksum in hex notation
- x+3..x+4 Carriage return, line feed
-
- EXTENDED ADDRESS RECORD
- Byte 1 Header = colon(:)
- 2..3 The byte count, must be "02"
- 4..7 Load address, must be "0000"
- 8..9 Record type, must be "02"
- 10..11 High byte of the offset address
- 12..13 Low byte of the offset address
- 14..15 Checksum in hex notation
- 16..17 Carriage return, line feed
-
- The checksums are the two's complement of the 8-bit sum
- without carry of the byte count, offset address, and the
- record type.
-
- START ADDRESS RECORD
- Byte 1 Header = colon (:)
- 2..3 The byte count, must be "04"
- 4..7 Load address, must be "0000"
- 8..9 Record type, must be "03"
- 10..13 8086 CS value
- 14..17 8086 IP value
- 18..19 Checksum in hex notation
- 20..21 Carriage return, line feed
-
-Another document reports these additional types:
-
- EXTENDED LINEAR ADDRESS RECORD
- Byte 1 Header = colon (:)
- 2..3 The byte count, must be "02"
- 4..7 Load address, must be "0000"
- 8..9 Record type, must be "04"
- 10..13 Upper 16 bits of address of subsequent records
- 14..15 Checksum in hex notation
- 16..17 Carriage return, line feed
-
- START LINEAR ADDRESS RECORD
- Byte 1 Header = colon (:)
- 2..3 The byte count, must be "02"
- 4..7 Load address, must be "0000"
- 8..9 Record type, must be "05"
- 10..13 Upper 16 bits of start address
- 14..15 Checksum in hex notation
- 16..17 Carriage return, line feed
-
-The MRI compiler uses this, which is a repeat of type 5:
-
- EXTENDED START RECORD
- Byte 1 Header = colon (:)
- 2..3 The byte count, must be "04"
- 4..7 Load address, must be "0000"
- 8..9 Record type, must be "05"
- 10..13 Upper 16 bits of start address
- 14..17 Lower 16 bits of start address
- 18..19 Checksum in hex notation
- 20..21 Carriage return, line feed
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libiberty.h"
-#include "safe-ctype.h"
-
-static void ihex_init
- PARAMS ((void));
-static bfd_boolean ihex_mkobject
- PARAMS ((bfd *));
-static INLINE int ihex_get_byte
- PARAMS ((bfd *, bfd_boolean *));
-static void ihex_bad_byte
- PARAMS ((bfd *, unsigned int, int, bfd_boolean));
-static bfd_boolean ihex_scan
- PARAMS ((bfd *));
-static const bfd_target *ihex_object_p
- PARAMS ((bfd *));
-static bfd_boolean ihex_read_section
- PARAMS ((bfd *, asection *, bfd_byte *));
-static bfd_boolean ihex_get_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static bfd_boolean ihex_set_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static bfd_boolean ihex_write_record
- PARAMS ((bfd *, size_t, unsigned int, unsigned int, bfd_byte *));
-static bfd_boolean ihex_write_object_contents
- PARAMS ((bfd *));
-static bfd_boolean ihex_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static int ihex_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-
-/* The number of bytes we put on one line during output. */
-
-#define CHUNK 16
-
-/* Macros for converting between hex and binary. */
-
-#define NIBBLE(x) (hex_value (x))
-#define HEX2(buffer) ((NIBBLE ((buffer)[0]) << 4) + NIBBLE ((buffer)[1]))
-#define HEX4(buffer) ((HEX2 (buffer) << 8) + HEX2 ((buffer) + 2))
-#define ISHEX(x) (hex_p (x))
-
-/* When we write out an ihex value, the values can not be output as
- they are seen. Instead, we hold them in memory in this structure. */
-
-struct ihex_data_list
-{
- struct ihex_data_list *next;
- bfd_byte *data;
- bfd_vma where;
- bfd_size_type size;
-};
-
-/* The ihex tdata information. */
-
-struct ihex_data_struct
-{
- struct ihex_data_list *head;
- struct ihex_data_list *tail;
-};
-
-/* Initialize by filling in the hex conversion array. */
-
-static void
-ihex_init ()
-{
- static bfd_boolean inited;
-
- if (! inited)
- {
- inited = TRUE;
- hex_init ();
- }
-}
-
-/* Create an ihex object. */
-
-static bfd_boolean
-ihex_mkobject (abfd)
- bfd *abfd;
-{
- struct ihex_data_struct *tdata;
- bfd_size_type amt = sizeof (struct ihex_data_struct);
-
- tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
- if (tdata == NULL)
- return FALSE;
-
- abfd->tdata.ihex_data = tdata;
- tdata->head = NULL;
- tdata->tail = NULL;
- return TRUE;
-}
-
-/* Read a byte from a BFD. Set *ERRORPTR if an error occurred.
- Return EOF on error or end of file. */
-
-static INLINE int
-ihex_get_byte (abfd, errorptr)
- bfd *abfd;
- bfd_boolean *errorptr;
-{
- bfd_byte c;
-
- if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
- {
- if (bfd_get_error () != bfd_error_file_truncated)
- *errorptr = TRUE;
- return EOF;
- }
-
- return (int) (c & 0xff);
-}
-
-/* Report a problem in an Intel Hex file. */
-
-static void
-ihex_bad_byte (abfd, lineno, c, error)
- bfd *abfd;
- unsigned int lineno;
- int c;
- bfd_boolean error;
-{
- if (c == EOF)
- {
- if (! error)
- bfd_set_error (bfd_error_file_truncated);
- }
- else
- {
- char buf[10];
-
- if (! ISPRINT (c))
- sprintf (buf, "\\%03o", (unsigned int) c);
- else
- {
- buf[0] = c;
- buf[1] = '\0';
- }
- (*_bfd_error_handler)
- (_("%s:%d: unexpected character `%s' in Intel Hex file\n"),
- bfd_archive_filename (abfd), lineno, buf);
- bfd_set_error (bfd_error_bad_value);
- }
-}
-
-/* Read an Intel hex file and turn it into sections. We create a new
- section for each contiguous set of bytes. */
-
-static bfd_boolean
-ihex_scan (abfd)
- bfd *abfd;
-{
- bfd_vma segbase;
- bfd_vma extbase;
- asection *sec;
- unsigned int lineno;
- bfd_boolean error;
- bfd_byte *buf = NULL;
- size_t bufsize;
- int c;
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- goto error_return;
-
- abfd->start_address = 0;
-
- segbase = 0;
- extbase = 0;
- sec = NULL;
- lineno = 1;
- error = FALSE;
- bufsize = 0;
-
- while ((c = ihex_get_byte (abfd, &error)) != EOF)
- {
- if (c == '\r')
- continue;
- else if (c == '\n')
- {
- ++lineno;
- continue;
- }
- else if (c != ':')
- {
- ihex_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
- else
- {
- file_ptr pos;
- char hdr[8];
- unsigned int i;
- unsigned int len;
- bfd_vma addr;
- unsigned int type;
- unsigned int chars;
- unsigned int chksum;
-
- /* This is a data record. */
- pos = bfd_tell (abfd) - 1;
-
- /* Read the header bytes. */
- if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
- goto error_return;
-
- for (i = 0; i < 8; i++)
- {
- if (! ISHEX (hdr[i]))
- {
- ihex_bad_byte (abfd, lineno, hdr[i], error);
- goto error_return;
- }
- }
-
- len = HEX2 (hdr);
- addr = HEX4 (hdr + 2);
- type = HEX2 (hdr + 6);
-
- /* Read the data bytes. */
- chars = len * 2 + 2;
- if (chars >= bufsize)
- {
- buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
- if (buf == NULL)
- goto error_return;
- bufsize = chars;
- }
-
- if (bfd_bread (buf, (bfd_size_type) chars, abfd) != chars)
- goto error_return;
-
- for (i = 0; i < chars; i++)
- {
- if (! ISHEX (buf[i]))
- {
- ihex_bad_byte (abfd, lineno, hdr[i], error);
- goto error_return;
- }
- }
-
- /* Check the checksum. */
- chksum = len + addr + (addr >> 8) + type;
- for (i = 0; i < len; i++)
- chksum += HEX2 (buf + 2 * i);
- if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i))
- {
- (*_bfd_error_handler)
- (_("%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"),
- bfd_archive_filename (abfd), lineno,
- (- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i));
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- switch (type)
- {
- case 0:
- /* This is a data record. */
- if (sec != NULL
- && sec->vma + sec->_raw_size == extbase + segbase + addr)
- {
- /* This data goes at the end of the section we are
- currently building. */
- sec->_raw_size += len;
- }
- else if (len > 0)
- {
- char secbuf[20];
- char *secname;
- bfd_size_type amt;
-
- sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
- amt = strlen (secbuf) + 1;
- secname = (char *) bfd_alloc (abfd, amt);
- if (secname == NULL)
- goto error_return;
- strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
- if (sec == NULL)
- goto error_return;
- sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
- sec->vma = extbase + segbase + addr;
- sec->lma = extbase + segbase + addr;
- sec->_raw_size = len;
- sec->filepos = pos;
- }
- break;
-
- case 1:
- /* An end record. */
- if (abfd->start_address == 0)
- abfd->start_address = addr;
- if (buf != NULL)
- free (buf);
- return TRUE;
-
- case 2:
- /* An extended address record. */
- if (len != 2)
- {
- (*_bfd_error_handler)
- (_("%s:%u: bad extended address record length in Intel Hex file"),
- bfd_archive_filename (abfd), lineno);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- segbase = HEX4 (buf) << 4;
-
- sec = NULL;
-
- break;
-
- case 3:
- /* An extended start address record. */
- if (len != 4)
- {
- (*_bfd_error_handler)
- (_("%s:%u: bad extended start address length in Intel Hex file"),
- bfd_archive_filename (abfd), lineno);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- abfd->start_address += (HEX4 (buf) << 4) + HEX4 (buf + 4);
-
- sec = NULL;
-
- break;
-
- case 4:
- /* An extended linear address record. */
- if (len != 2)
- {
- (*_bfd_error_handler)
- (_("%s:%u: bad extended linear address record length in Intel Hex file"),
- bfd_archive_filename (abfd), lineno);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- extbase = HEX4 (buf) << 16;
-
- sec = NULL;
-
- break;
-
- case 5:
- /* An extended linear start address record. */
- if (len != 2 && len != 4)
- {
- (*_bfd_error_handler)
- (_("%s:%u: bad extended linear start address length in Intel Hex file"),
- bfd_archive_filename (abfd), lineno);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- if (len == 2)
- abfd->start_address += HEX4 (buf) << 16;
- else
- abfd->start_address = (HEX4 (buf) << 16) + HEX4 (buf + 4);
-
- sec = NULL;
-
- break;
-
- default:
- (*_bfd_error_handler)
- (_("%s:%u: unrecognized ihex type %u in Intel Hex file\n"),
- bfd_archive_filename (abfd), lineno, type);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- }
- }
-
- if (error)
- goto error_return;
-
- if (buf != NULL)
- free (buf);
-
- return TRUE;
-
- error_return:
- if (buf != NULL)
- free (buf);
- return FALSE;
-}
-
-/* Try to recognize an Intel Hex file. */
-
-static const bfd_target *
-ihex_object_p (abfd)
- bfd *abfd;
-{
- PTR tdata_save;
- bfd_byte b[9];
- unsigned int i;
- unsigned int type;
-
- ihex_init ();
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return NULL;
- if (bfd_bread (b, (bfd_size_type) 9, abfd) != 9)
- {
- if (bfd_get_error () == bfd_error_file_truncated)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (b[0] != ':')
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- for (i = 1; i < 9; i++)
- {
- if (! ISHEX (b[i]))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- }
-
- type = HEX2 (b + 7);
- if (type > 5)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* OK, it looks like it really is an Intel Hex file. */
- tdata_save = abfd->tdata.any;
- if (! ihex_mkobject (abfd) || ! ihex_scan (abfd))
- {
- if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = tdata_save;
- return NULL;
- }
-
- return abfd->xvec;
-}
-
-/* Read the contents of a section in an Intel Hex file. */
-
-static bfd_boolean
-ihex_read_section (abfd, section, contents)
- bfd *abfd;
- asection *section;
- bfd_byte *contents;
-{
- int c;
- bfd_byte *p;
- bfd_byte *buf = NULL;
- size_t bufsize;
- bfd_boolean error;
-
- if (bfd_seek (abfd, section->filepos, SEEK_SET) != 0)
- goto error_return;
-
- p = contents;
- bufsize = 0;
- error = FALSE;
- while ((c = ihex_get_byte (abfd, &error)) != EOF)
- {
- char hdr[8];
- unsigned int len;
- bfd_vma addr;
- unsigned int type;
- unsigned int i;
-
- if (c == '\r' || c == '\n')
- continue;
-
- /* This is called after ihex_scan has succeeded, so we ought to
- know the exact format. */
- BFD_ASSERT (c == ':');
-
- if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
- goto error_return;
-
- len = HEX2 (hdr);
- addr = HEX4 (hdr + 2);
- type = HEX2 (hdr + 6);
-
- /* We should only see type 0 records here. */
- if (type != 0)
- {
- (*_bfd_error_handler)
- (_("%s: internal error in ihex_read_section"),
- bfd_archive_filename (abfd));
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- if (len * 2 > bufsize)
- {
- buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2);
- if (buf == NULL)
- goto error_return;
- bufsize = len * 2;
- }
-
- if (bfd_bread (buf, (bfd_size_type) len * 2, abfd) != len * 2)
- goto error_return;
-
- for (i = 0; i < len; i++)
- *p++ = HEX2 (buf + 2 * i);
- if ((bfd_size_type) (p - contents) >= section->_raw_size)
- {
- /* We've read everything in the section. */
- if (buf != NULL)
- free (buf);
- return TRUE;
- }
-
- /* Skip the checksum. */
- if (bfd_bread (buf, (bfd_size_type) 2, abfd) != 2)
- goto error_return;
- }
-
- if ((bfd_size_type) (p - contents) < section->_raw_size)
- {
- (*_bfd_error_handler)
- (_("%s: bad section length in ihex_read_section"),
- bfd_archive_filename (abfd));
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- if (buf != NULL)
- free (buf);
-
- return TRUE;
-
- error_return:
- if (buf != NULL)
- free (buf);
- return FALSE;
-}
-
-/* Get the contents of a section in an Intel Hex file. */
-
-static bfd_boolean
-ihex_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- if (section->used_by_bfd == NULL)
- {
- section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
- if (section->used_by_bfd == NULL)
- return FALSE;
- if (! ihex_read_section (abfd, section, section->used_by_bfd))
- return FALSE;
- }
-
- memcpy (location, (bfd_byte *) section->used_by_bfd + offset,
- (size_t) count);
-
- return TRUE;
-}
-
-/* Set the contents of a section in an Intel Hex file. */
-
-static bfd_boolean
-ihex_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- struct ihex_data_list *n;
- bfd_byte *data;
- struct ihex_data_struct *tdata;
- bfd_size_type amt;
-
- if (count == 0
- || (section->flags & SEC_ALLOC) == 0
- || (section->flags & SEC_LOAD) == 0)
- return TRUE;
-
- amt = sizeof (struct ihex_data_list);
- n = (struct ihex_data_list *) bfd_alloc (abfd, amt);
- if (n == NULL)
- return FALSE;
-
- data = (bfd_byte *) bfd_alloc (abfd, count);
- if (data == NULL)
- return FALSE;
- memcpy (data, location, (size_t) count);
-
- n->data = data;
- n->where = section->lma + offset;
- n->size = count;
-
- /* Sort the records by address. Optimize for the common case of
- adding a record to the end of the list. */
- tdata = abfd->tdata.ihex_data;
- if (tdata->tail != NULL
- && n->where >= tdata->tail->where)
- {
- tdata->tail->next = n;
- n->next = NULL;
- tdata->tail = n;
- }
- else
- {
- register struct ihex_data_list **pp;
-
- for (pp = &tdata->head;
- *pp != NULL && (*pp)->where < n->where;
- pp = &(*pp)->next)
- ;
- n->next = *pp;
- *pp = n;
- if (n->next == NULL)
- tdata->tail = n;
- }
-
- return TRUE;
-}
-
-/* Write a record out to an Intel Hex file. */
-
-static bfd_boolean
-ihex_write_record (abfd, count, addr, type, data)
- bfd *abfd;
- size_t count;
- unsigned int addr;
- unsigned int type;
- bfd_byte *data;
-{
- static const char digs[] = "0123456789ABCDEF";
- char buf[9 + CHUNK * 2 + 4];
- char *p;
- unsigned int chksum;
- unsigned int i;
- size_t total;
-
-#define TOHEX(buf, v) \
- ((buf)[0] = digs[((v) >> 4) & 0xf], (buf)[1] = digs[(v) & 0xf])
-
- buf[0] = ':';
- TOHEX (buf + 1, count);
- TOHEX (buf + 3, (addr >> 8) & 0xff);
- TOHEX (buf + 5, addr & 0xff);
- TOHEX (buf + 7, type);
-
- chksum = count + addr + (addr >> 8) + type;
-
- for (i = 0, p = buf + 9; i < count; i++, p += 2, data++)
- {
- TOHEX (p, *data);
- chksum += *data;
- }
-
- TOHEX (p, (- chksum) & 0xff);
- p[2] = '\r';
- p[3] = '\n';
-
- total = 9 + count * 2 + 4;
- if (bfd_bwrite (buf, (bfd_size_type) total, abfd) != total)
- return FALSE;
-
- return TRUE;
-}
-
-/* Write out an Intel Hex file. */
-
-static bfd_boolean
-ihex_write_object_contents (abfd)
- bfd *abfd;
-{
- bfd_vma segbase;
- bfd_vma extbase;
- struct ihex_data_list *l;
-
- segbase = 0;
- extbase = 0;
- for (l = abfd->tdata.ihex_data->head; l != NULL; l = l->next)
- {
- bfd_vma where;
- bfd_byte *p;
- bfd_size_type count;
-
- where = l->where;
- p = l->data;
- count = l->size;
- while (count > 0)
- {
- size_t now;
- unsigned int rec_addr;
-
- now = count;
- if (count > CHUNK)
- now = CHUNK;
-
- if (where > segbase + extbase + 0xffff)
- {
- bfd_byte addr[2];
-
- /* We need a new base address. */
- if (where <= 0xfffff)
- {
- /* The addresses should be sorted. */
- BFD_ASSERT (extbase == 0);
-
- segbase = where & 0xf0000;
- addr[0] = (bfd_byte)(segbase >> 12) & 0xff;
- addr[1] = (bfd_byte)(segbase >> 4) & 0xff;
- if (! ihex_write_record (abfd, 2, 0, 2, addr))
- return FALSE;
- }
- else
- {
- /* The extended address record and the extended
- linear address record are combined, at least by
- some readers. We need an extended linear address
- record here, so if we've already written out an
- extended address record, zero it out to avoid
- confusion. */
- if (segbase != 0)
- {
- addr[0] = 0;
- addr[1] = 0;
- if (! ihex_write_record (abfd, 2, 0, 2, addr))
- return FALSE;
- segbase = 0;
- }
-
- extbase = where & 0xffff0000;
- if (where > extbase + 0xffff)
- {
- char buf[20];
-
- sprintf_vma (buf, where);
- (*_bfd_error_handler)
- (_("%s: address 0x%s out of range for Intel Hex file"),
- bfd_get_filename (abfd), buf);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- addr[0] = (bfd_byte)(extbase >> 24) & 0xff;
- addr[1] = (bfd_byte)(extbase >> 16) & 0xff;
- if (! ihex_write_record (abfd, 2, 0, 4, addr))
- return FALSE;
- }
- }
-
- rec_addr = where - (extbase + segbase);
-
- /* Output records shouldn't cross 64K boundaries. */
- if (rec_addr + now > 0xffff)
- now = 0x10000 - rec_addr;
-
- if (! ihex_write_record (abfd, now, rec_addr, 0, p))
- return FALSE;
-
- where += now;
- p += now;
- count -= now;
- }
- }
-
- if (abfd->start_address != 0)
- {
- bfd_vma start;
- bfd_byte startbuf[4];
-
- start = abfd->start_address;
-
- if (start <= 0xfffff)
- {
- startbuf[0] = (bfd_byte)((start & 0xf0000) >> 12) & 0xff;
- startbuf[1] = 0;
- startbuf[2] = (bfd_byte)(start >> 8) & 0xff;
- startbuf[3] = (bfd_byte)start & 0xff;
- if (! ihex_write_record (abfd, 4, 0, 3, startbuf))
- return FALSE;
- }
- else
- {
- startbuf[0] = (bfd_byte)(start >> 24) & 0xff;
- startbuf[1] = (bfd_byte)(start >> 16) & 0xff;
- startbuf[2] = (bfd_byte)(start >> 8) & 0xff;
- startbuf[3] = (bfd_byte)start & 0xff;
- if (! ihex_write_record (abfd, 4, 0, 5, startbuf))
- return FALSE;
- }
- }
-
- if (! ihex_write_record (abfd, 0, 0, 1, NULL))
- return FALSE;
-
- return TRUE;
-}
-
-/* Set the architecture for the output file. The architecture is
- irrelevant, so we ignore errors about unknown architectures. */
-
-static bfd_boolean
-ihex_set_arch_mach (abfd, arch, mach)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long mach;
-{
- if (! bfd_default_set_arch_mach (abfd, arch, mach))
- {
- if (arch != bfd_arch_unknown)
- return FALSE;
- }
- return TRUE;
-}
-
-/* Get the size of the headers, for the linker. */
-
-static int
-ihex_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
-{
- return 0;
-}
-
-/* Some random definitions for the target vector. */
-
-#define ihex_close_and_cleanup _bfd_generic_close_and_cleanup
-#define ihex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define ihex_new_section_hook _bfd_generic_new_section_hook
-#define ihex_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-#define ihex_get_symtab_upper_bound bfd_0l
-#define ihex_canonicalize_symtab \
- ((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l)
-#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol
-#define ihex_print_symbol _bfd_nosymbols_print_symbol
-#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info
-#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
-#define ihex_get_lineno _bfd_nosymbols_get_lineno
-#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols
-#define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
-
-#define ihex_get_reloc_upper_bound \
- ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
-#define ihex_canonicalize_reloc \
- ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
-#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-
-#define ihex_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define ihex_bfd_relax_section bfd_generic_relax_section
-#define ihex_bfd_gc_sections bfd_generic_gc_sections
-#define ihex_bfd_merge_sections bfd_generic_merge_sections
-#define ihex_bfd_discard_group bfd_generic_discard_group
-#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms
-#define ihex_bfd_final_link _bfd_generic_final_link
-#define ihex_bfd_link_split_section _bfd_generic_link_split_section
-
-/* The Intel Hex target vector. */
-
-const bfd_target ihex_vec =
-{
- "ihex", /* name */
- bfd_target_ihex_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- 0, /* object flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {
- _bfd_dummy_target,
- ihex_object_p, /* bfd_check_format */
- _bfd_dummy_target,
- _bfd_dummy_target,
- },
- {
- bfd_false,
- ihex_mkobject,
- _bfd_generic_mkarchive,
- bfd_false,
- },
- { /* bfd_write_contents */
- bfd_false,
- ihex_write_object_contents,
- _bfd_write_archive_contents,
- bfd_false,
- },
-
- BFD_JUMP_TABLE_GENERIC (ihex),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (ihex),
- BFD_JUMP_TABLE_RELOCS (ihex),
- BFD_JUMP_TABLE_WRITE (ihex),
- BFD_JUMP_TABLE_LINK (ihex),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0
-};
diff --git a/contrib/binutils/bfd/init.c b/contrib/binutils/bfd/init.c
deleted file mode 100644
index 07401eb..0000000
--- a/contrib/binutils/bfd/init.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* bfd initialization stuff
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003
- Free Software Foundation, Inc.
- Written by Steve Chamberlain of Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-/*
-SECTION
- Initialization
-
- These are the functions that handle initializing a BFD.
-*/
-
-/*
-FUNCTION
- bfd_init
-
-SYNOPSIS
- void bfd_init (void);
-
-DESCRIPTION
- This routine must be called before any other BFD function to
- initialize magical internal data structures.
-*/
-
-/* Actually, there is currently nothing for this function to do.
- However, someday it may be needed, so keep it around. */
-
-void
-bfd_init (void)
-{
-}
diff --git a/contrib/binutils/bfd/libaout.h b/contrib/binutils/bfd/libaout.h
deleted file mode 100644
index 67054e3..0000000
--- a/contrib/binutils/bfd/libaout.h
+++ /dev/null
@@ -1,666 +0,0 @@
-/* BFD back-end data structures for a.out (and similar) files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef LIBAOUT_H
-#define LIBAOUT_H
-
-/* We try to encapsulate the differences in the various a.out file
- variants in a few routines, and otherwise share large masses of code.
- This means we only have to fix bugs in one place, most of the time. */
-
-#include "bfdlink.h"
-
-/* Macros for accessing components in an aout header. */
-
-#define H_PUT_64 bfd_h_put_64
-#define H_PUT_32 bfd_h_put_32
-#define H_PUT_16 bfd_h_put_16
-#define H_PUT_8 bfd_h_put_8
-#define H_PUT_S64 bfd_h_put_signed_64
-#define H_PUT_S32 bfd_h_put_signed_32
-#define H_PUT_S16 bfd_h_put_signed_16
-#define H_PUT_S8 bfd_h_put_signed_8
-#define H_GET_64 bfd_h_get_64
-#define H_GET_32 bfd_h_get_32
-#define H_GET_16 bfd_h_get_16
-#define H_GET_8 bfd_h_get_8
-#define H_GET_S64 bfd_h_get_signed_64
-#define H_GET_S32 bfd_h_get_signed_32
-#define H_GET_S16 bfd_h_get_signed_16
-#define H_GET_S8 bfd_h_get_signed_8
-
-/* Parameterize the a.out code based on whether it is being built
- for a 32-bit architecture or a 64-bit architecture. */
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#if ARCH_SIZE==64
-#define GET_WORD H_GET_64
-#define GET_SWORD H_GET_S64
-#define GET_MAGIC H_GET_32
-#define PUT_WORD H_PUT_64
-#define PUT_MAGIC H_PUT_32
-#ifndef NAME
-#define NAME(x,y) CONCAT3 (x,_64_,y)
-#endif
-#define JNAME(x) CONCAT2 (x,_64)
-#define BYTES_IN_WORD 8
-#else
-#if ARCH_SIZE==16
-#define GET_WORD H_GET_16
-#define GET_SWORD H_GET_S16
-#define GET_MAGIC H_GET_16
-#define PUT_WORD H_PUT_16
-#define PUT_MAGIC H_PUT_16
-#ifndef NAME
-#define NAME(x,y) CONCAT3 (x,_16_,y)
-#endif
-#define JNAME(x) CONCAT2 (x,_16)
-#define BYTES_IN_WORD 2
-#else /* ARCH_SIZE == 32 */
-#define GET_WORD H_GET_32
-#define GET_SWORD H_GET_S32
-#define GET_MAGIC H_GET_32
-#define PUT_WORD H_PUT_32
-#define PUT_MAGIC H_PUT_32
-#ifndef NAME
-#define NAME(x,y) CONCAT3 (x,_32_,y)
-#endif
-#define JNAME(x) CONCAT2 (x,_32)
-#define BYTES_IN_WORD 4
-#endif /* ARCH_SIZE==32 */
-#endif /* ARCH_SIZE==64 */
-
-/* Declare at file level, since used in parameter lists, which have
- weird scope. */
-struct external_exec;
-struct external_nlist;
-struct reloc_ext_external;
-struct reloc_std_external;
-
-/* a.out backend linker hash table entries. */
-
-struct aout_link_hash_entry
-{
- struct bfd_link_hash_entry root;
- /* Whether this symbol has been written out. */
- bfd_boolean written;
- /* Symbol index in output file. */
- int indx;
-};
-
-/* a.out backend linker hash table. */
-
-struct aout_link_hash_table
-{
- struct bfd_link_hash_table root;
-};
-
-/* Look up an entry in an a.out link hash table. */
-
-#define aout_link_hash_lookup(table, string, create, copy, follow) \
- ((struct aout_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
-
-/* Traverse an a.out link hash table. */
-
-#define aout_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the a.out link hash table from the info structure. This is
- just a cast. */
-
-#define aout_hash_table(p) ((struct aout_link_hash_table *) ((p)->hash))
-
-/* Back-end information for various a.out targets. */
-struct aout_backend_data
-{
- /* Are ZMAGIC files mapped contiguously? If so, the text section may
- need more padding, if the segment size (granularity for memory access
- control) is larger than the page size. */
- unsigned char zmagic_mapped_contiguous;
- /* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the
- text section, which starts immediately after the file header.
- If not, the text section starts on the next page. */
- unsigned char text_includes_header;
-
- /* If this flag is set, then if the entry address is not in the
- first SEGMENT_SIZE bytes of the text section, it is taken to be
- the address of the start of the text section. This can be useful
- for kernels. */
- unsigned char entry_is_text_address;
-
- /* The value to pass to N_SET_FLAGS. */
- unsigned char exec_hdr_flags;
-
- /* If the text section VMA isn't specified, and we need an absolute
- address, use this as the default. If we're producing a relocatable
- file, zero is always used. */
- /* ?? Perhaps a callback would be a better choice? Will this do anything
- reasonable for a format that handles multiple CPUs with different
- load addresses for each? */
- bfd_vma default_text_vma;
-
- /* Callback for setting the page and segment sizes, if they can't be
- trivially determined from the architecture. */
- bfd_boolean (*set_sizes)
- PARAMS ((bfd *));
-
- /* zmagic files only. For go32, the length of the exec header contributes
- to the size of the text section in the file for alignment purposes but
- does *not* get counted in the length of the text section. */
- unsigned char exec_header_not_counted;
-
- /* Callback from the add symbols phase of the linker code to handle
- a dynamic object. */
- bfd_boolean (*add_dynamic_symbols)
- PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **,
- bfd_size_type *, char **));
-
- /* Callback from the add symbols phase of the linker code to handle
- adding a single symbol to the global linker hash table. */
- bfd_boolean (*add_one_symbol)
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
-
- /* Called to handle linking a dynamic object. */
- bfd_boolean (*link_dynamic_object)
- PARAMS ((struct bfd_link_info *, bfd *));
-
- /* Called for each global symbol being written out by the linker.
- This should write out the dynamic symbol information. */
- bfd_boolean (*write_dynamic_symbol)
- PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *));
-
- /* If this callback is not NULL, the linker calls it for each reloc.
- RELOC is a pointer to the unswapped reloc. If *SKIP is set to
- TRUE, the reloc will be skipped. *RELOCATION may be changed to
- change the effects of the relocation. */
- bfd_boolean (*check_dynamic_reloc)
- PARAMS ((struct bfd_link_info *info, bfd *input_bfd,
- asection *input_section, struct aout_link_hash_entry *h,
- PTR reloc, bfd_byte *contents, bfd_boolean *skip,
- bfd_vma *relocation));
-
- /* Called at the end of a link to finish up any dynamic linking
- information. */
- bfd_boolean (*finish_dynamic_link)
- PARAMS ((bfd *, struct bfd_link_info *));
-};
-#define aout_backend_info(abfd) \
- ((const struct aout_backend_data *)((abfd)->xvec->backend_data))
-
-/* This is the layout in memory of a "struct exec" while we process it.
- All 'lengths' are given as a number of bytes.
- All 'alignments' are for relinkable files only; an alignment of
- 'n' indicates the corresponding segment must begin at an
- address that is a multiple of (2**n). */
-
-struct internal_exec
-{
- long a_info; /* Magic number and flags, packed */
- bfd_vma a_text; /* length of text, in bytes */
- bfd_vma a_data; /* length of data, in bytes */
- bfd_vma a_bss; /* length of uninitialized data area in mem */
- bfd_vma a_syms; /* length of symbol table data in file */
- bfd_vma a_entry; /* start address */
- bfd_vma a_trsize; /* length of text's relocation info, in bytes */
- bfd_vma a_drsize; /* length of data's relocation info, in bytes */
- /* Added for i960 */
- bfd_vma a_tload; /* Text runtime load address */
- bfd_vma a_dload; /* Data runtime load address */
- unsigned char a_talign; /* Alignment of text segment */
- unsigned char a_dalign; /* Alignment of data segment */
- unsigned char a_balign; /* Alignment of bss segment */
- char a_relaxable; /* Enough info for linker relax */
-};
-
-/* Magic number is written
-< MSB >
-3130292827262524232221201918171615141312111009080706050403020100
-< FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
-*/
-/* Magic number for NetBSD is
-<MSB >
-3130292827262524232221201918171615141312111009080706050403020100
-< FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
-*/
-
-enum machine_type {
- M_UNKNOWN = 0,
- M_68010 = 1,
- M_68020 = 2,
- M_SPARC = 3,
- /* Skip a bunch so we don't run into any of SUN's numbers. */
- /* Make these up for the ns32k. */
- M_NS32032 = (64), /* ns32032 running ? */
- M_NS32532 = (64 + 5), /* ns32532 running mach */
-
- M_386 = 100,
- M_29K = 101, /* AMD 29000 */
- M_386_DYNIX = 102, /* Sequent running dynix */
- M_ARM = 103, /* Advanced Risc Machines ARM */
- M_SPARCLET = 131, /* SPARClet = M_SPARC + 128 */
- M_386_NETBSD = 134, /* NetBSD/i386 binary */
- M_68K_NETBSD = 135, /* NetBSD/m68k binary */
- M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary */
- M_532_NETBSD = 137, /* NetBSD/ns32k binary */
- M_SPARC_NETBSD = 138, /* NetBSD/sparc binary */
- M_PMAX_NETBSD = 139, /* NetBSD/pmax (MIPS little-endian) binary */
- M_VAX_NETBSD = 140, /* NetBSD/vax binary */
- M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */
- M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary */
- M_SPARCLET_1 = 147, /* 0x93, reserved */
- M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary */
- M_MIPS1 = 151, /* MIPS R2000/R3000 binary */
- M_MIPS2 = 152, /* MIPS R4000/R6000 binary */
- M_SPARCLET_2 = 163, /* 0xa3, reserved */
- M_SPARCLET_3 = 179, /* 0xb3, reserved */
- M_SPARCLET_4 = 195, /* 0xc3, reserved */
- M_HP200 = 200, /* HP 200 (68010) BSD binary */
- M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */
- M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary */
- M_SPARCLET_5 = 211, /* 0xd3, reserved */
- M_SPARCLET_6 = 227, /* 0xe3, reserved */
- /* M_SPARCLET_7 = 243 / * 0xf3, reserved */
- M_SPARCLITE_LE = 243,
- M_CRIS = 255 /* Axis CRIS binary. */
-};
-
-#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
-
-#ifndef N_MAGIC
-# define N_MAGIC(exec) ((exec).a_info & 0xffff)
-#endif
-
-#ifndef N_MACHTYPE
-# define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
-#endif
-
-#ifndef N_FLAGS
-# define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
-#endif
-
-#ifndef N_SET_INFO
-# define N_SET_INFO(exec, magic, type, flags) \
-((exec).a_info = ((magic) & 0xffff) \
- | (((int)(type) & 0xff) << 16) \
- | (((flags) & 0xff) << 24))
-#endif
-
-#ifndef N_SET_DYNAMIC
-# define N_SET_DYNAMIC(exec, dynamic) \
-((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \
-((exec).a_info & 0x7fffffff))
-#endif
-
-#ifndef N_SET_MAGIC
-# define N_SET_MAGIC(exec, magic) \
-((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
-#endif
-
-#ifndef N_SET_MACHTYPE
-# define N_SET_MACHTYPE(exec, machtype) \
-((exec).a_info = \
- ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
-#endif
-
-#ifndef N_SET_FLAGS
-# define N_SET_FLAGS(exec, flags) \
-((exec).a_info = \
- ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
-#endif
-
-typedef struct aout_symbol {
- asymbol symbol;
- short desc;
- char other;
- unsigned char type;
-} aout_symbol_type;
-
-/* The `tdata' struct for all a.out-like object file formats.
- Various things depend on this struct being around any time an a.out
- file is being handled. An example is dbxread.c in GDB. */
-
-struct aoutdata {
- struct internal_exec *hdr; /* exec file header */
- aout_symbol_type *symbols; /* symtab for input bfd */
-
- /* For ease, we do this. */
- asection *textsec;
- asection *datasec;
- asection *bsssec;
-
- /* We remember these offsets so that after check_file_format, we have
- no dependencies on the particular format of the exec_hdr. */
- file_ptr sym_filepos;
- file_ptr str_filepos;
-
- /* Size of a relocation entry in external form. */
- unsigned reloc_entry_size;
-
- /* Size of a symbol table entry in external form. */
- unsigned symbol_entry_size;
-
- /* Page size - needed for alignment of demand paged files. */
- unsigned long page_size;
-
- /* Segment size - needed for alignment of demand paged files. */
- unsigned long segment_size;
-
- /* Zmagic disk block size - need to align the start of the text
- section in ZMAGIC binaries. Normally the same as page_size. */
- unsigned long zmagic_disk_block_size;
-
- unsigned exec_bytes_size;
- unsigned vma_adjusted : 1;
-
- /* Used when a bfd supports several highly similar formats. */
- enum
- {
- default_format = 0,
- /* Used on HP 9000/300 running HP/UX. See hp300hpux.c. */
- gnu_encap_format,
- /* Used on Linux, 386BSD, etc. See include/aout/aout64.h. */
- q_magic_format
- } subformat;
-
- enum
- {
- undecided_magic = 0,
- z_magic,
- o_magic,
- n_magic
- } magic;
-
- /* A buffer for find_nearest_line. */
- char *line_buf;
-
- /* The external symbol information. */
- struct external_nlist *external_syms;
- bfd_size_type external_sym_count;
- bfd_window sym_window;
- char *external_strings;
- bfd_size_type external_string_size;
- bfd_window string_window;
- struct aout_link_hash_entry **sym_hashes;
-
- /* A pointer for shared library information. */
- PTR dynamic_info;
-
- /* A mapping from local symbols to offsets into the global offset
- table, used when linking on SunOS. This is indexed by the symbol
- index. */
- bfd_vma *local_got_offsets;
-};
-
-struct aout_data_struct {
- struct aoutdata a;
- struct internal_exec e;
-};
-
-#define adata(bfd) ((bfd)->tdata.aout_data->a)
-#define exec_hdr(bfd) (adata(bfd).hdr)
-#define obj_aout_symbols(bfd) (adata(bfd).symbols)
-#define obj_textsec(bfd) (adata(bfd).textsec)
-#define obj_datasec(bfd) (adata(bfd).datasec)
-#define obj_bsssec(bfd) (adata(bfd).bsssec)
-#define obj_sym_filepos(bfd) (adata(bfd).sym_filepos)
-#define obj_str_filepos(bfd) (adata(bfd).str_filepos)
-#define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size)
-#define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size)
-#define obj_aout_subformat(bfd) (adata(bfd).subformat)
-#define obj_aout_external_syms(bfd) (adata(bfd).external_syms)
-#define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count)
-#define obj_aout_sym_window(bfd) (adata(bfd).sym_window)
-#define obj_aout_external_strings(bfd) (adata(bfd).external_strings)
-#define obj_aout_external_string_size(bfd) (adata(bfd).external_string_size)
-#define obj_aout_string_window(bfd) (adata(bfd).string_window)
-#define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes)
-#define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info)
-
-/* We take the address of the first element of an asymbol to ensure that the
- macro is only ever applied to an asymbol. */
-#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
-
-/* Information we keep for each a.out section. This is currently only
- used by the a.out backend linker. */
-
-struct aout_section_data_struct
-{
- /* The unswapped relocation entries for this section. */
- PTR relocs;
-};
-
-#define aout_section_data(s) \
- ((struct aout_section_data_struct *) (s)->used_by_bfd)
-
-#define set_aout_section_data(s,v) \
- ((s)->used_by_bfd = (PTR)&(v)->relocs)
-
-/* Prototype declarations for functions defined in aoutx.h. */
-
-extern bfd_boolean NAME(aout,squirt_out_relocs)
- PARAMS ((bfd *, asection *));
-
-extern bfd_boolean NAME(aout,make_sections)
- PARAMS ((bfd *));
-
-extern const bfd_target * NAME(aout,some_aout_object_p)
- PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
-
-extern bfd_boolean NAME(aout,mkobject)
- PARAMS ((bfd *));
-
-extern enum machine_type NAME(aout,machine_type)
- PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *));
-
-extern bfd_boolean NAME(aout,set_arch_mach)
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-
-extern bfd_boolean NAME(aout,new_section_hook)
- PARAMS ((bfd *, asection *));
-
-extern bfd_boolean NAME(aout,set_section_contents)
- PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
-
-extern asymbol * NAME(aout,make_empty_symbol)
- PARAMS ((bfd *));
-
-extern bfd_boolean NAME(aout,translate_symbol_table)
- PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
- char *, bfd_size_type, bfd_boolean));
-
-extern bfd_boolean NAME(aout,slurp_symbol_table)
- PARAMS ((bfd *));
-
-extern bfd_boolean NAME(aout,write_syms)
- PARAMS ((bfd *));
-
-extern void NAME(aout,reclaim_symbol_table)
- PARAMS ((bfd *));
-
-extern long NAME(aout,get_symtab_upper_bound)
- PARAMS ((bfd *));
-
-extern long NAME(aout,canonicalize_symtab)
- PARAMS ((bfd *, asymbol **));
-
-extern void NAME(aout,swap_ext_reloc_in)
- PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **,
- bfd_size_type));
-extern void NAME(aout,swap_std_reloc_in)
- PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
- bfd_size_type));
-
-extern reloc_howto_type * NAME(aout,reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-extern bfd_boolean NAME(aout,slurp_reloc_table)
- PARAMS ((bfd *, sec_ptr, asymbol **));
-
-extern long NAME(aout,canonicalize_reloc)
- PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-
-extern long NAME(aout,get_reloc_upper_bound)
- PARAMS ((bfd *, sec_ptr));
-
-extern void NAME(aout,reclaim_reloc)
- PARAMS ((bfd *, sec_ptr));
-
-extern alent * NAME(aout,get_lineno)
- PARAMS ((bfd *, asymbol *));
-
-extern void NAME(aout,print_symbol)
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-
-extern void NAME(aout,get_symbol_info)
- PARAMS ((bfd *, asymbol *, symbol_info *));
-
-extern bfd_boolean NAME(aout,find_nearest_line)
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-
-extern long NAME(aout,read_minisymbols)
- PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *));
-
-extern asymbol * NAME(aout,minisymbol_to_symbol)
- PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *));
-
-extern int NAME(aout,sizeof_headers)
- PARAMS ((bfd *, bfd_boolean));
-
-extern bfd_boolean NAME(aout,adjust_sizes_and_vmas)
- PARAMS ((bfd *, bfd_size_type *, file_ptr *));
-
-extern void NAME(aout,swap_exec_header_in)
- PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
-
-extern void NAME(aout,swap_exec_header_out)
- PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
-
-extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc)
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-
-extern bfd_boolean NAME(aout,link_hash_table_init)
- PARAMS ((struct aout_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
-
-extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create)
- PARAMS ((bfd *));
-
-extern bfd_boolean NAME(aout,link_add_symbols)
- PARAMS ((bfd *, struct bfd_link_info *));
-
-extern bfd_boolean NAME(aout,final_link)
- PARAMS ((bfd *, struct bfd_link_info *,
- void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)));
-
-extern bfd_boolean NAME(aout,bfd_free_cached_info)
- PARAMS ((bfd *));
-
-/* A.out uses the generic versions of these routines... */
-
-#define aout_16_get_section_contents _bfd_generic_get_section_contents
-
-#define aout_32_get_section_contents _bfd_generic_get_section_contents
-
-#define aout_64_get_section_contents _bfd_generic_get_section_contents
-#ifndef NO_WRITE_HEADER_KLUDGE
-#define NO_WRITE_HEADER_KLUDGE 0
-#endif
-
-#ifndef aout_32_bfd_is_local_label_name
-#define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
-#endif
-
-#ifndef WRITE_HEADERS
-#define WRITE_HEADERS(abfd, execp) \
- { \
- bfd_size_type text_size; /* dummy vars */ \
- file_ptr text_end; \
- if (adata(abfd).magic == undecided_magic) \
- NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
- \
- execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
- execp->a_entry = bfd_get_start_address (abfd); \
- \
- execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
- \
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
- || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
- abfd) != EXEC_BYTES_SIZE) \
- return FALSE; \
- /* Now write out reloc info, followed by syms and strings. */ \
- \
- if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
- && bfd_get_symcount (abfd) != 0) \
- { \
- if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
- return FALSE; \
- \
- if (! NAME(aout,write_syms) (abfd)) \
- return FALSE; \
- } \
- \
- if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
- return FALSE; \
- if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
- return FALSE; \
- \
- if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
- return FALSE; \
- if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
- return FALSE; \
- }
-#endif
-
-/* Test if a read-only section can be merged with .text. This is
- possible if:
-
- 1. Section has file contents and is read-only.
- 2. The VMA of the section is after the end of .text and before
- the start of .data.
- 3. The image is demand-pageable (otherwise, a_text in the header
- will not reflect the gap between .text and .data). */
-
-#define aout_section_merge_with_text_p(abfd, sec) \
- (((sec)->flags & (SEC_HAS_CONTENTS | SEC_READONLY)) == \
- (SEC_HAS_CONTENTS | SEC_READONLY) \
- && obj_textsec (abfd) != NULL \
- && obj_datasec (abfd) != NULL \
- && (sec)->vma >= (obj_textsec (abfd)->vma + \
- obj_textsec (abfd)->_cooked_size) \
- && ((sec)->vma + (sec)->_cooked_size) <= obj_datasec (abfd)->vma \
- && ((abfd)->flags & D_PAGED) != 0)
-
-#endif /* ! defined (LIBAOUT_H) */
diff --git a/contrib/binutils/bfd/libbfd-in.h b/contrib/binutils/bfd/libbfd-in.h
deleted file mode 100644
index 10cafef..0000000
--- a/contrib/binutils/bfd/libbfd-in.h
+++ /dev/null
@@ -1,647 +0,0 @@
-/* libbfd.h -- Declarations used by bfd library *implementation*.
- (This include file is not for users of the library.)
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Align an address upward to a boundary, expressed as a number of bytes.
- E.g. align to an 8-byte boundary with argument of 8. Take care never
- to wrap around if the address is within boundary-1 of the end of the
- address space. */
-#define BFD_ALIGN(this, boundary) \
- ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
- ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
- : ~ (bfd_vma) 0)
-
-/* If you want to read and write large blocks, you might want to do it
- in quanta of this amount */
-#define DEFAULT_BUFFERSIZE 8192
-
-/* Set a tdata field. Can't use the other macros for this, since they
- do casts, and casting to the left of assignment isn't portable. */
-#define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
-
-/* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
- to an instance of this structure. */
-
-struct bfd_in_memory
-{
- /* Size of buffer. */
- bfd_size_type size;
- /* Buffer holding contents of BFD. */
- bfd_byte *buffer;
-};
-
-/* tdata for an archive. For an input archive, cache
- needs to be free()'d. For an output archive, symdefs do. */
-
-struct artdata {
- file_ptr first_file_filepos;
- /* Speed up searching the armap */
- struct ar_cache *cache;
- bfd *archive_head; /* Only interesting in output routines */
- carsym *symdefs; /* the symdef entries */
- symindex symdef_count; /* how many there are */
- char *extended_names; /* clever intel extension */
- /* when more compilers are standard C, this can be a time_t */
- long armap_timestamp; /* Timestamp value written into armap.
- This is used for BSD archives to check
- that the timestamp is recent enough
- for the BSD linker to not complain,
- just before we finish writing an
- archive. */
- file_ptr armap_datepos; /* Position within archive to seek to
- rewrite the date field. */
- void *tdata; /* Backend specific information. */
-};
-
-#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
-
-/* Goes in bfd's arelt_data slot */
-struct areltdata {
- char * arch_header; /* it's actually a string */
- unsigned int parsed_size; /* octets of filesize not including ar_hdr */
- char *filename; /* null-terminated */
-};
-
-#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
-
-extern void *bfd_malloc
- (bfd_size_type);
-extern void *bfd_realloc
- (void *, bfd_size_type);
-extern void *bfd_zmalloc
- (bfd_size_type);
-
-extern bfd_error_handler_type _bfd_error_handler;
-
-/* These routines allocate and free things on the BFD's objalloc. */
-
-extern void *bfd_alloc
- (bfd *, bfd_size_type);
-extern void *bfd_zalloc
- (bfd *, bfd_size_type);
-extern void bfd_release
- (bfd *, void *);
-
-bfd * _bfd_create_empty_archive_element_shell
- (bfd *obfd);
-bfd * _bfd_look_for_bfd_in_cache
- (bfd *, file_ptr);
-bfd_boolean _bfd_add_bfd_to_archive_cache
- (bfd *, file_ptr, bfd *);
-bfd_boolean _bfd_generic_mkarchive
- (bfd *abfd);
-const bfd_target *bfd_generic_archive_p
- (bfd *abfd);
-bfd_boolean bfd_slurp_armap
- (bfd *abfd);
-bfd_boolean bfd_slurp_bsd_armap_f2
- (bfd *abfd);
-#define bfd_slurp_bsd_armap bfd_slurp_armap
-#define bfd_slurp_coff_armap bfd_slurp_armap
-bfd_boolean _bfd_slurp_extended_name_table
- (bfd *abfd);
-extern bfd_boolean _bfd_construct_extended_name_table
- (bfd *, bfd_boolean, char **, bfd_size_type *);
-bfd_boolean _bfd_write_archive_contents
- (bfd *abfd);
-bfd_boolean _bfd_compute_and_write_armap
- (bfd *, unsigned int elength);
-bfd *_bfd_get_elt_at_filepos
- (bfd *archive, file_ptr filepos);
-extern bfd *_bfd_generic_get_elt_at_index
- (bfd *, symindex);
-bfd * _bfd_new_bfd
- (void);
-void _bfd_delete_bfd
- (bfd *);
-
-bfd_boolean bfd_false
- (bfd *ignore);
-bfd_boolean bfd_true
- (bfd *ignore);
-void *bfd_nullvoidptr
- (bfd *ignore);
-int bfd_0
- (bfd *ignore);
-unsigned int bfd_0u
- (bfd *ignore);
-long bfd_0l
- (bfd *ignore);
-long _bfd_n1
- (bfd *ignore);
-void bfd_void
- (bfd *ignore);
-
-bfd *_bfd_new_bfd_contained_in
- (bfd *);
-const bfd_target *_bfd_dummy_target
- (bfd *abfd);
-
-void bfd_dont_truncate_arname
- (bfd *abfd, const char *filename, char *hdr);
-void bfd_bsd_truncate_arname
- (bfd *abfd, const char *filename, char *hdr);
-void bfd_gnu_truncate_arname
- (bfd *abfd, const char *filename, char *hdr);
-
-bfd_boolean bsd_write_armap
- (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
- int stridx);
-
-bfd_boolean coff_write_armap
- (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
- int stridx);
-
-extern void *_bfd_generic_read_ar_hdr
- (bfd *);
-
-extern void *_bfd_generic_read_ar_hdr_mag
- (bfd *, const char *);
-
-bfd * bfd_generic_openr_next_archived_file
- (bfd *archive, bfd *last_file);
-
-int bfd_generic_stat_arch_elt
- (bfd *, struct stat *);
-
-#define _bfd_read_ar_hdr(abfd) \
- BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
-
-/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
- BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
-
-#define _bfd_generic_close_and_cleanup bfd_true
-#define _bfd_generic_bfd_free_cached_info bfd_true
-#define _bfd_generic_new_section_hook \
- ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
-extern bfd_boolean _bfd_generic_get_section_contents
- (bfd *, asection *, void *, file_ptr, bfd_size_type);
-extern bfd_boolean _bfd_generic_get_section_contents_in_window
- (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type);
-
-/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
- BFD_JUMP_TABLE_COPY (_bfd_generic). */
-
-#define _bfd_generic_bfd_copy_private_bfd_data \
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
-#define _bfd_generic_bfd_merge_private_bfd_data \
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
-#define _bfd_generic_bfd_set_private_flags \
- ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
-#define _bfd_generic_bfd_copy_private_section_data \
- ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
-#define _bfd_generic_bfd_copy_private_symbol_data \
- ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
-#define _bfd_generic_bfd_print_private_bfd_data \
- ((bfd_boolean (*) (bfd *, void *)) bfd_true)
-
-/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
- support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
-
-extern char *_bfd_nocore_core_file_failing_command
- (bfd *);
-extern int _bfd_nocore_core_file_failing_signal
- (bfd *);
-extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
- (bfd *, bfd *);
-
-/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
- file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
-
-#define _bfd_noarchive_slurp_armap bfd_false
-#define _bfd_noarchive_slurp_extended_name_table bfd_false
-#define _bfd_noarchive_construct_extended_name_table \
- ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \
- bfd_false)
-#define _bfd_noarchive_truncate_arname \
- ((void (*) (bfd *, const char *, char *)) bfd_void)
-#define _bfd_noarchive_write_armap \
- ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
- bfd_false)
-#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
-#define _bfd_noarchive_openr_next_archived_file \
- ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
-#define _bfd_noarchive_get_elt_at_index \
- ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr)
-#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
-#define _bfd_noarchive_update_armap_timestamp bfd_false
-
-/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
- archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */
-
-#define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
-#define _bfd_archive_bsd_slurp_extended_name_table \
- _bfd_slurp_extended_name_table
-extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
- (bfd *, char **, bfd_size_type *, const char **);
-#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
-#define _bfd_archive_bsd_write_armap bsd_write_armap
-#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
-#define _bfd_archive_bsd_openr_next_archived_file \
- bfd_generic_openr_next_archived_file
-#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
-#define _bfd_archive_bsd_generic_stat_arch_elt \
- bfd_generic_stat_arch_elt
-extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp
- (bfd *);
-
-/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
- archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
-
-#define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
-#define _bfd_archive_coff_slurp_extended_name_table \
- _bfd_slurp_extended_name_table
-extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
- (bfd *, char **, bfd_size_type *, const char **);
-#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
-#define _bfd_archive_coff_write_armap coff_write_armap
-#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
-#define _bfd_archive_coff_openr_next_archived_file \
- bfd_generic_openr_next_archived_file
-#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
-#define _bfd_archive_coff_generic_stat_arch_elt \
- bfd_generic_stat_arch_elt
-#define _bfd_archive_coff_update_armap_timestamp bfd_true
-
-/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
- support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
-
-#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
-#define _bfd_nosymbols_canonicalize_symtab \
- ((long (*) (bfd *, asymbol **)) _bfd_n1)
-#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
-#define _bfd_nosymbols_print_symbol \
- ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)
-#define _bfd_nosymbols_get_symbol_info \
- ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
-#define _bfd_nosymbols_bfd_is_local_label_name \
- ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
-#define _bfd_nosymbols_get_lineno \
- ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
-#define _bfd_nosymbols_find_nearest_line \
- ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \
- const char **, unsigned int *)) \
- bfd_false)
-#define _bfd_nosymbols_bfd_make_debug_symbol \
- ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
-#define _bfd_nosymbols_read_minisymbols \
- ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)
-#define _bfd_nosymbols_minisymbol_to_symbol \
- ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \
- bfd_nullvoidptr)
-
-/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
- support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
-
-#define _bfd_norelocs_get_reloc_upper_bound \
- ((long (*) (bfd *, asection *)) _bfd_n1)
-#define _bfd_norelocs_canonicalize_reloc \
- ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1)
-#define _bfd_norelocs_bfd_reloc_type_lookup \
- ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
-
-/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
- be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
-
-#define _bfd_nowrite_set_arch_mach \
- ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \
- bfd_false)
-#define _bfd_nowrite_set_section_contents \
- ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \
- bfd_false)
-
-/* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use
- BFD_JUMP_TABLE_WRITE (_bfd_generic). */
-
-#define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
-extern bfd_boolean _bfd_generic_set_section_contents
- (bfd *, asection *, const void *, file_ptr, bfd_size_type);
-
-/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
- support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
-
-#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0)
-#define _bfd_nolink_bfd_get_relocated_section_contents \
- ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
- bfd_byte *, bfd_boolean, asymbol **)) \
- bfd_nullvoidptr)
-#define _bfd_nolink_bfd_relax_section \
- ((bfd_boolean (*) \
- (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
- bfd_false)
-#define _bfd_nolink_bfd_gc_sections \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
- bfd_false)
-#define _bfd_nolink_bfd_merge_sections \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
- bfd_false)
-#define _bfd_nolink_bfd_discard_group \
- ((bfd_boolean (*) (bfd *, struct bfd_section *)) \
- bfd_false)
-#define _bfd_nolink_bfd_link_hash_table_create \
- ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr)
-#define _bfd_nolink_bfd_link_hash_table_free \
- ((void (*) (struct bfd_link_hash_table *)) bfd_void)
-#define _bfd_nolink_bfd_link_add_symbols \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
-#define _bfd_nolink_bfd_link_just_syms \
- ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
-#define _bfd_nolink_bfd_final_link \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
-#define _bfd_nolink_bfd_link_split_section \
- ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
-
-/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
- have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
- (_bfd_nodynamic). */
-
-#define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1
-#define _bfd_nodynamic_canonicalize_dynamic_symtab \
- ((long (*) (bfd *, asymbol **)) _bfd_n1)
-#define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1
-#define _bfd_nodynamic_canonicalize_dynamic_reloc \
- ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
-
-/* Generic routine to determine of the given symbol is a local
- label. */
-extern bfd_boolean bfd_generic_is_local_label_name
- (bfd *, const char *);
-
-/* Generic minisymbol routines. */
-extern long _bfd_generic_read_minisymbols
- (bfd *, bfd_boolean, void **, unsigned int *);
-extern asymbol *_bfd_generic_minisymbol_to_symbol
- (bfd *, bfd_boolean, const void *, asymbol *);
-
-/* Find the nearest line using .stab/.stabstr sections. */
-extern bfd_boolean _bfd_stab_section_find_nearest_line
- (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *,
- const char **, const char **, unsigned int *, void **);
-
-/* Find the neaderst line using DWARF 1 debugging information. */
-extern bfd_boolean _bfd_dwarf1_find_nearest_line
- (bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *);
-
-/* Find the nearest line using DWARF 2 debugging information. */
-extern bfd_boolean _bfd_dwarf2_find_nearest_line
- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
- unsigned int *, unsigned int, void **);
-
-/* Create a new section entry. */
-extern struct bfd_hash_entry *bfd_section_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-
-/* A routine to create entries for a bfd_link_hash_table. */
-extern struct bfd_hash_entry *_bfd_link_hash_newfunc
- (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
- const char *string);
-
-/* Initialize a bfd_link_hash_table. */
-extern bfd_boolean _bfd_link_hash_table_init
- (struct bfd_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
-
-/* Generic link hash table creation routine. */
-extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
- (bfd *);
-
-/* Generic link hash table destruction routine. */
-extern void _bfd_generic_link_hash_table_free
- (struct bfd_link_hash_table *);
-
-/* Generic add symbol routine. */
-extern bfd_boolean _bfd_generic_link_add_symbols
- (bfd *, struct bfd_link_info *);
-
-/* Generic add symbol routine. This version is used by targets for
- which the linker must collect constructors and destructors by name,
- as the collect2 program does. */
-extern bfd_boolean _bfd_generic_link_add_symbols_collect
- (bfd *, struct bfd_link_info *);
-
-/* Generic archive add symbol routine. */
-extern bfd_boolean _bfd_generic_link_add_archive_symbols
- (bfd *, struct bfd_link_info *,
- bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *));
-
-/* Forward declaration to avoid prototype errors. */
-typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
-
-/* Generic routine to add a single symbol. */
-extern bfd_boolean _bfd_generic_link_add_one_symbol
- (struct bfd_link_info *, bfd *, const char *name, flagword,
- asection *, bfd_vma, const char *, bfd_boolean copy,
- bfd_boolean constructor, struct bfd_link_hash_entry **);
-
-/* Generic routine to mark section as supplying symbols only. */
-extern void _bfd_generic_link_just_syms
- (asection *, struct bfd_link_info *);
-
-/* Generic link routine. */
-extern bfd_boolean _bfd_generic_final_link
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean _bfd_generic_link_split_section
- (bfd *, struct bfd_section *);
-
-/* Generic reloc_link_order processing routine. */
-extern bfd_boolean _bfd_generic_reloc_link_order
- (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
-
-/* Default link order processing routine. */
-extern bfd_boolean _bfd_default_link_order
- (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
-
-/* Count the number of reloc entries in a link order list. */
-extern unsigned int _bfd_count_link_order_relocs
- (struct bfd_link_order *);
-
-/* Final link relocation routine. */
-extern bfd_reloc_status_type _bfd_final_link_relocate
- (reloc_howto_type *, bfd *, asection *, bfd_byte *,
- bfd_vma, bfd_vma, bfd_vma);
-
-/* Relocate a particular location by a howto and a value. */
-extern bfd_reloc_status_type _bfd_relocate_contents
- (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
-
-/* Link stabs in sections in the first pass. */
-
-extern bfd_boolean _bfd_link_section_stabs
- (bfd *, void **, asection *, asection *, void **, bfd_size_type *);
-
-/* Eliminate stabs for discarded functions and symbols. */
-extern bfd_boolean _bfd_discard_section_stabs
- (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *);
-
-/* Write out the .stab section when linking stabs in sections. */
-
-extern bfd_boolean _bfd_write_section_stabs
- (bfd *, void **, asection *, void **, bfd_byte *);
-
-/* Write out the .stabstr string table when linking stabs in sections. */
-
-extern bfd_boolean _bfd_write_stab_strings
- (bfd *, void **);
-
-/* Find an offset within a .stab section when linking stabs in
- sections. */
-
-extern bfd_vma _bfd_stab_section_offset
- (bfd *, void **, asection *, void **, bfd_vma);
-
-/* Attempt to merge a SEC_MERGE section. */
-
-extern bfd_boolean _bfd_merge_section
- (bfd *, void **, asection *, void **);
-
-/* Attempt to merge SEC_MERGE sections. */
-
-extern bfd_boolean _bfd_merge_sections
- (bfd *, void *, void (*) (bfd *, asection *));
-
-/* Write out a merged section. */
-
-extern bfd_boolean _bfd_write_merged_section
- (bfd *, asection *, void *);
-
-/* Find an offset within a modified SEC_MERGE section. */
-
-extern bfd_vma _bfd_merged_section_offset
- (bfd *, asection **, void *, bfd_vma, bfd_vma);
-
-/* Create a string table. */
-extern struct bfd_strtab_hash *_bfd_stringtab_init
- (void);
-
-/* Create an XCOFF .debug section style string table. */
-extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
- (void);
-
-/* Free a string table. */
-extern void _bfd_stringtab_free
- (struct bfd_strtab_hash *);
-
-/* Get the size of a string table. */
-extern bfd_size_type _bfd_stringtab_size
- (struct bfd_strtab_hash *);
-
-/* Add a string to a string table. */
-extern bfd_size_type _bfd_stringtab_add
- (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy);
-
-/* Write out a string table. */
-extern bfd_boolean _bfd_stringtab_emit
- (bfd *, struct bfd_strtab_hash *);
-
-/* Check that endianness of input and output file match. */
-extern bfd_boolean _bfd_generic_verify_endian_match
- (bfd *, bfd *);
-
-/* Macros to tell if bfds are read or write enabled.
-
- Note that bfds open for read may be scribbled into if the fd passed
- to bfd_fdopenr is actually open both for read and write
- simultaneously. However an output bfd will never be open for
- read. Therefore sometimes you want to check bfd_read_p or
- !bfd_read_p, and only sometimes bfd_write_p.
-*/
-
-#define bfd_read_p(abfd) \
- ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
-#define bfd_write_p(abfd) \
- ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
-
-void bfd_assert
- (const char*,int);
-
-#define BFD_ASSERT(x) \
- { if (!(x)) bfd_assert(__FILE__,__LINE__); }
-
-#define BFD_FAIL() \
- { bfd_assert(__FILE__,__LINE__); }
-
-extern void _bfd_abort
- (const char *, int, const char *) ATTRIBUTE_NORETURN;
-
-/* if gcc >= 2.6, we can give a function name, too */
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
-#define __PRETTY_FUNCTION__ ((char *) NULL)
-#endif
-
-#undef abort
-#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-/* Manipulate a system FILE but using BFD's "file_ptr", rather than
- the system "off_t" or "off64_t", as the offset. */
-extern file_ptr real_ftell (FILE *file);
-extern int real_fseek (FILE *file, file_ptr offset, int whence);
-
-FILE * bfd_cache_lookup_worker
- (bfd *);
-
-extern bfd *bfd_last_cache;
-
-/* List of supported target vectors, and the default vector (if
- bfd_default_vector[0] is NULL, there is no default). */
-extern const bfd_target * const *bfd_target_vector;
-extern const bfd_target *bfd_default_vector[];
-
-/* List of associated target vectors. */
-extern const bfd_target * const *bfd_associated_vector;
-
-/* Functions shared by the ECOFF and MIPS ELF backends, which have no
- other common header files. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_find_line;
-#endif
-
-extern bfd_boolean _bfd_ecoff_locate_line
- (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
- const struct ecoff_debug_swap * const, struct ecoff_find_line *,
- const char **, const char **, unsigned int *);
-extern bfd_boolean _bfd_ecoff_get_accumulated_pdr
- (void *, bfd_byte *);
-extern bfd_boolean _bfd_ecoff_get_accumulated_sym
- (void *, bfd_byte *);
-extern bfd_boolean _bfd_ecoff_get_accumulated_ss
- (void *, bfd_byte *);
-
-extern bfd_vma _bfd_get_gp_value
- (bfd *);
-extern void _bfd_set_gp_value
- (bfd *, bfd_vma);
-
-/* Function shared by the COFF and ELF SH backends, which have no
- other common header files. */
-
-#ifndef _bfd_sh_align_load_span
-extern bfd_boolean _bfd_sh_align_load_span
- (bfd *, asection *, bfd_byte *,
- bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
- void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
-#endif
diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c
deleted file mode 100644
index be090e9..0000000
--- a/contrib/binutils/bfd/libbfd.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/* Assorted BFD support routines, only used internally.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#ifndef HAVE_GETPAGESIZE
-#define getpagesize() 2048
-#endif
-
-/*
-SECTION
- Internal functions
-
-DESCRIPTION
- These routines are used within BFD.
- They are not intended for export, but are documented here for
- completeness.
-*/
-
-/* A routine which is used in target vectors for unsupported
- operations. */
-
-bfd_boolean
-bfd_false (bfd *ignore ATTRIBUTE_UNUSED)
-{
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
-}
-
-/* A routine which is used in target vectors for supported operations
- which do not actually do anything. */
-
-bfd_boolean
-bfd_true (bfd *ignore ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/* A routine which is used in target vectors for unsupported
- operations which return a pointer value. */
-
-void *
-bfd_nullvoidptr (bfd *ignore ATTRIBUTE_UNUSED)
-{
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
-}
-
-int
-bfd_0 (bfd *ignore ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-unsigned int
-bfd_0u (bfd *ignore ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-long
-bfd_0l (bfd *ignore ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-/* A routine which is used in target vectors for unsupported
- operations which return -1 on error. */
-
-long
-_bfd_n1 (bfd *ignore_abfd ATTRIBUTE_UNUSED)
-{
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
-}
-
-void
-bfd_void (bfd *ignore ATTRIBUTE_UNUSED)
-{
-}
-
-bfd_boolean
-_bfd_nocore_core_file_matches_executable_p
- (bfd *ignore_core_bfd ATTRIBUTE_UNUSED,
- bfd *ignore_exec_bfd ATTRIBUTE_UNUSED)
-{
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
-}
-
-/* Routine to handle core_file_failing_command entry point for targets
- without core file support. */
-
-char *
-_bfd_nocore_core_file_failing_command (bfd *ignore_abfd ATTRIBUTE_UNUSED)
-{
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
-}
-
-/* Routine to handle core_file_failing_signal entry point for targets
- without core file support. */
-
-int
-_bfd_nocore_core_file_failing_signal (bfd *ignore_abfd ATTRIBUTE_UNUSED)
-{
- bfd_set_error (bfd_error_invalid_operation);
- return 0;
-}
-
-const bfd_target *
-_bfd_dummy_target (bfd *ignore_abfd ATTRIBUTE_UNUSED)
-{
- bfd_set_error (bfd_error_wrong_format);
- return 0;
-}
-
-/* Allocate memory using malloc. */
-
-void *
-bfd_malloc (bfd_size_type size)
-{
- void *ptr;
-
- if (size != (size_t) size)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
-
- ptr = malloc ((size_t) size);
- if (ptr == NULL && (size_t) size != 0)
- bfd_set_error (bfd_error_no_memory);
-
- return ptr;
-}
-
-/* Reallocate memory using realloc. */
-
-void *
-bfd_realloc (void *ptr, bfd_size_type size)
-{
- void *ret;
-
- if (size != (size_t) size)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
-
- if (ptr == NULL)
- ret = malloc ((size_t) size);
- else
- ret = realloc (ptr, (size_t) size);
-
- if (ret == NULL && (size_t) size != 0)
- bfd_set_error (bfd_error_no_memory);
-
- return ret;
-}
-
-/* Allocate memory using malloc and clear it. */
-
-void *
-bfd_zmalloc (bfd_size_type size)
-{
- void *ptr;
-
- if (size != (size_t) size)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
-
- ptr = malloc ((size_t) size);
-
- if ((size_t) size != 0)
- {
- if (ptr == NULL)
- bfd_set_error (bfd_error_no_memory);
- else
- memset (ptr, 0, (size_t) size);
- }
-
- return ptr;
-}
-/*
-INTERNAL_FUNCTION
- bfd_write_bigendian_4byte_int
-
-SYNOPSIS
- bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
-
-DESCRIPTION
- Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
- endian order regardless of what else is going on. This is useful in
- archives.
-
-*/
-bfd_boolean
-bfd_write_bigendian_4byte_int (bfd *abfd, unsigned int i)
-{
- bfd_byte buffer[4];
- bfd_putb32 ((bfd_vma) i, buffer);
- return bfd_bwrite (buffer, (bfd_size_type) 4, abfd) == 4;
-}
-
-
-/** The do-it-yourself (byte) sex-change kit */
-
-/* The middle letter e.g. get<b>short indicates Big or Little endian
- target machine. It doesn't matter what the byte order of the host
- machine is; these routines work for either. */
-
-/* FIXME: Should these take a count argument?
- Answer (gnu@cygnus.com): No, but perhaps they should be inline
- functions in swap.h #ifdef __GNUC__.
- Gprof them later and find out. */
-
-/*
-FUNCTION
- bfd_put_size
-FUNCTION
- bfd_get_size
-
-DESCRIPTION
- These macros as used for reading and writing raw data in
- sections; each access (except for bytes) is vectored through
- the target format of the BFD and mangled accordingly. The
- mangling performs any necessary endian translations and
- removes alignment restrictions. Note that types accepted and
- returned by these macros are identical so they can be swapped
- around in macros---for example, @file{libaout.h} defines <<GET_WORD>>
- to either <<bfd_get_32>> or <<bfd_get_64>>.
-
- In the put routines, @var{val} must be a <<bfd_vma>>. If we are on a
- system without prototypes, the caller is responsible for making
- sure that is true, with a cast if necessary. We don't cast
- them in the macro definitions because that would prevent <<lint>>
- or <<gcc -Wall>> from detecting sins such as passing a pointer.
- To detect calling these with less than a <<bfd_vma>>, use
- <<gcc -Wconversion>> on a host with 64 bit <<bfd_vma>>'s.
-
-.
-.{* Byte swapping macros for user section data. *}
-.
-.#define bfd_put_8(abfd, val, ptr) \
-. ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
-.#define bfd_put_signed_8 \
-. bfd_put_8
-.#define bfd_get_8(abfd, ptr) \
-. (*(unsigned char *) (ptr) & 0xff)
-.#define bfd_get_signed_8(abfd, ptr) \
-. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-.
-.#define bfd_put_16(abfd, val, ptr) \
-. BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
-.#define bfd_put_signed_16 \
-. bfd_put_16
-.#define bfd_get_16(abfd, ptr) \
-. BFD_SEND (abfd, bfd_getx16, (ptr))
-.#define bfd_get_signed_16(abfd, ptr) \
-. BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-.
-.#define bfd_put_32(abfd, val, ptr) \
-. BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
-.#define bfd_put_signed_32 \
-. bfd_put_32
-.#define bfd_get_32(abfd, ptr) \
-. BFD_SEND (abfd, bfd_getx32, (ptr))
-.#define bfd_get_signed_32(abfd, ptr) \
-. BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
-.
-.#define bfd_put_64(abfd, val, ptr) \
-. BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
-.#define bfd_put_signed_64 \
-. bfd_put_64
-.#define bfd_get_64(abfd, ptr) \
-. BFD_SEND (abfd, bfd_getx64, (ptr))
-.#define bfd_get_signed_64(abfd, ptr) \
-. BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
-.
-.#define bfd_get(bits, abfd, ptr) \
-. ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
-. : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
-. : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
-. : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
-. : (abort (), (bfd_vma) - 1))
-.
-.#define bfd_put(bits, abfd, val, ptr) \
-. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
-. : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
-. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
-. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
-. : (abort (), (void) 0))
-.
-*/
-
-/*
-FUNCTION
- bfd_h_put_size
- bfd_h_get_size
-
-DESCRIPTION
- These macros have the same function as their <<bfd_get_x>>
- brethren, except that they are used for removing information
- for the header records of object files. Believe it or not,
- some object files keep their header records in big endian
- order and their data in little endian order.
-.
-.{* Byte swapping macros for file header data. *}
-.
-.#define bfd_h_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)
-.#define bfd_h_get_8(abfd, ptr) \
-. bfd_get_8 (abfd, ptr)
-.#define bfd_h_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))
-.#define bfd_h_put_signed_16 \
-. bfd_h_put_16
-.#define bfd_h_get_16(abfd, 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))
-.
-.#define bfd_h_put_32(abfd, val, ptr) \
-. BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
-.#define bfd_h_put_signed_32 \
-. bfd_h_put_32
-.#define bfd_h_get_32(abfd, 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))
-.
-.#define bfd_h_put_64(abfd, val, ptr) \
-. BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
-.#define bfd_h_put_signed_64 \
-. bfd_h_put_64
-.#define bfd_h_get_64(abfd, 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))
-.
-.{* Aliases for the above, which should eventually go away. *}
-.
-.#define H_PUT_64 bfd_h_put_64
-.#define H_PUT_32 bfd_h_put_32
-.#define H_PUT_16 bfd_h_put_16
-.#define H_PUT_8 bfd_h_put_8
-.#define H_PUT_S64 bfd_h_put_signed_64
-.#define H_PUT_S32 bfd_h_put_signed_32
-.#define H_PUT_S16 bfd_h_put_signed_16
-.#define H_PUT_S8 bfd_h_put_signed_8
-.#define H_GET_64 bfd_h_get_64
-.#define H_GET_32 bfd_h_get_32
-.#define H_GET_16 bfd_h_get_16
-.#define H_GET_8 bfd_h_get_8
-.#define H_GET_S64 bfd_h_get_signed_64
-.#define H_GET_S32 bfd_h_get_signed_32
-.#define H_GET_S16 bfd_h_get_signed_16
-.#define H_GET_S8 bfd_h_get_signed_8
-.
-.*/
-
-/* Sign extension to bfd_signed_vma. */
-#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
-#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
-#define EIGHT_GAZILLION ((bfd_int64_t) 1 << 63)
-#define COERCE64(x) \
- (((bfd_int64_t) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
-
-bfd_vma
-bfd_getb16 (const void *p)
-{
- const bfd_byte *addr = p;
- return (addr[0] << 8) | addr[1];
-}
-
-bfd_vma
-bfd_getl16 (const void *p)
-{
- const bfd_byte *addr = p;
- return (addr[1] << 8) | addr[0];
-}
-
-bfd_signed_vma
-bfd_getb_signed_16 (const void *p)
-{
- const bfd_byte *addr = p;
- return COERCE16 ((addr[0] << 8) | addr[1]);
-}
-
-bfd_signed_vma
-bfd_getl_signed_16 (const void *p)
-{
- const bfd_byte *addr = p;
- return COERCE16 ((addr[1] << 8) | addr[0]);
-}
-
-void
-bfd_putb16 (bfd_vma data, void *p)
-{
- bfd_byte *addr = p;
- addr[0] = (data >> 8) & 0xff;
- addr[1] = data & 0xff;
-}
-
-void
-bfd_putl16 (bfd_vma data, void *p)
-{
- bfd_byte *addr = p;
- addr[0] = data & 0xff;
- addr[1] = (data >> 8) & 0xff;
-}
-
-bfd_vma
-bfd_getb32 (const void *p)
-{
- const bfd_byte *addr = p;
- unsigned long v;
-
- v = (unsigned long) addr[0] << 24;
- v |= (unsigned long) addr[1] << 16;
- v |= (unsigned long) addr[2] << 8;
- v |= (unsigned long) addr[3];
- return v;
-}
-
-bfd_vma
-bfd_getl32 (const void *p)
-{
- const bfd_byte *addr = p;
- unsigned long v;
-
- v = (unsigned long) addr[0];
- v |= (unsigned long) addr[1] << 8;
- v |= (unsigned long) addr[2] << 16;
- v |= (unsigned long) addr[3] << 24;
- return v;
-}
-
-bfd_signed_vma
-bfd_getb_signed_32 (const void *p)
-{
- const bfd_byte *addr = p;
- unsigned long v;
-
- v = (unsigned long) addr[0] << 24;
- v |= (unsigned long) addr[1] << 16;
- v |= (unsigned long) addr[2] << 8;
- v |= (unsigned long) addr[3];
- return COERCE32 (v);
-}
-
-bfd_signed_vma
-bfd_getl_signed_32 (const void *p)
-{
- const bfd_byte *addr = p;
- unsigned long v;
-
- v = (unsigned long) addr[0];
- v |= (unsigned long) addr[1] << 8;
- v |= (unsigned long) addr[2] << 16;
- v |= (unsigned long) addr[3] << 24;
- return COERCE32 (v);
-}
-
-bfd_uint64_t
-bfd_getb64 (const void *p ATTRIBUTE_UNUSED)
-{
-#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
- bfd_uint64_t v;
-
- v = addr[0]; v <<= 8;
- v |= addr[1]; v <<= 8;
- v |= addr[2]; v <<= 8;
- v |= addr[3]; v <<= 8;
- v |= addr[4]; v <<= 8;
- v |= addr[5]; v <<= 8;
- v |= addr[6]; v <<= 8;
- v |= addr[7];
-
- return v;
-#else
- BFD_FAIL();
- return 0;
-#endif
-}
-
-bfd_uint64_t
-bfd_getl64 (const void *p ATTRIBUTE_UNUSED)
-{
-#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
- bfd_uint64_t v;
-
- v = addr[7]; v <<= 8;
- v |= addr[6]; v <<= 8;
- v |= addr[5]; v <<= 8;
- v |= addr[4]; v <<= 8;
- v |= addr[3]; v <<= 8;
- v |= addr[2]; v <<= 8;
- v |= addr[1]; v <<= 8;
- v |= addr[0];
-
- return v;
-#else
- BFD_FAIL();
- return 0;
-#endif
-
-}
-
-bfd_int64_t
-bfd_getb_signed_64 (const void *p ATTRIBUTE_UNUSED)
-{
-#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
- bfd_uint64_t v;
-
- v = addr[0]; v <<= 8;
- v |= addr[1]; v <<= 8;
- v |= addr[2]; v <<= 8;
- v |= addr[3]; v <<= 8;
- v |= addr[4]; v <<= 8;
- v |= addr[5]; v <<= 8;
- v |= addr[6]; v <<= 8;
- v |= addr[7];
-
- return COERCE64 (v);
-#else
- BFD_FAIL();
- return 0;
-#endif
-}
-
-bfd_int64_t
-bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED)
-{
-#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
- bfd_uint64_t v;
-
- v = addr[7]; v <<= 8;
- v |= addr[6]; v <<= 8;
- v |= addr[5]; v <<= 8;
- v |= addr[4]; v <<= 8;
- v |= addr[3]; v <<= 8;
- v |= addr[2]; v <<= 8;
- v |= addr[1]; v <<= 8;
- v |= addr[0];
-
- return COERCE64 (v);
-#else
- BFD_FAIL();
- return 0;
-#endif
-}
-
-void
-bfd_putb32 (bfd_vma data, void *p)
-{
- bfd_byte *addr = p;
- addr[0] = (data >> 24) & 0xff;
- addr[1] = (data >> 16) & 0xff;
- addr[2] = (data >> 8) & 0xff;
- addr[3] = data & 0xff;
-}
-
-void
-bfd_putl32 (bfd_vma data, void *p)
-{
- bfd_byte *addr = p;
- addr[0] = data & 0xff;
- addr[1] = (data >> 8) & 0xff;
- addr[2] = (data >> 16) & 0xff;
- addr[3] = (data >> 24) & 0xff;
-}
-
-void
-bfd_putb64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
-{
-#ifdef BFD_HOST_64_BIT
- bfd_byte *addr = p;
- addr[0] = (data >> (7*8)) & 0xff;
- addr[1] = (data >> (6*8)) & 0xff;
- addr[2] = (data >> (5*8)) & 0xff;
- addr[3] = (data >> (4*8)) & 0xff;
- addr[4] = (data >> (3*8)) & 0xff;
- addr[5] = (data >> (2*8)) & 0xff;
- addr[6] = (data >> (1*8)) & 0xff;
- addr[7] = (data >> (0*8)) & 0xff;
-#else
- BFD_FAIL();
-#endif
-}
-
-void
-bfd_putl64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
-{
-#ifdef BFD_HOST_64_BIT
- bfd_byte *addr = p;
- addr[7] = (data >> (7*8)) & 0xff;
- addr[6] = (data >> (6*8)) & 0xff;
- addr[5] = (data >> (5*8)) & 0xff;
- addr[4] = (data >> (4*8)) & 0xff;
- addr[3] = (data >> (3*8)) & 0xff;
- addr[2] = (data >> (2*8)) & 0xff;
- addr[1] = (data >> (1*8)) & 0xff;
- addr[0] = (data >> (0*8)) & 0xff;
-#else
- BFD_FAIL();
-#endif
-}
-
-void
-bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
-{
- bfd_byte *addr = p;
- int i;
- int bytes;
-
- if (bits % 8 != 0)
- abort ();
-
- bytes = bits / 8;
- for (i = 0; i < bytes; i++)
- {
- int index = big_p ? bytes - i - 1 : i;
-
- addr[index] = data & 0xff;
- data >>= 8;
- }
-}
-
-bfd_uint64_t
-bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
-{
- const bfd_byte *addr = p;
- bfd_uint64_t data;
- int i;
- int bytes;
-
- if (bits % 8 != 0)
- abort ();
-
- data = 0;
- bytes = bits / 8;
- for (i = 0; i < bytes; i++)
- {
- int index = big_p ? i : bytes - i - 1;
-
- data = (data << 8) | addr[index];
- }
-
- return data;
-}
-
-/* Default implementation */
-
-bfd_boolean
-_bfd_generic_get_section_contents (bfd *abfd,
- sec_ptr section,
- void *location,
- file_ptr offset,
- bfd_size_type count)
-{
- if (count == 0)
- return TRUE;
-
- if (offset + count > section->_raw_size)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bread (location, count, abfd) != count)
- return FALSE;
-
- return TRUE;
-}
-
-bfd_boolean
-_bfd_generic_get_section_contents_in_window
- (bfd *abfd ATTRIBUTE_UNUSED,
- sec_ptr section ATTRIBUTE_UNUSED,
- bfd_window *w ATTRIBUTE_UNUSED,
- file_ptr offset ATTRIBUTE_UNUSED,
- bfd_size_type count ATTRIBUTE_UNUSED)
-{
-#ifdef USE_MMAP
- if (count == 0)
- return TRUE;
- if (abfd->xvec->_bfd_get_section_contents
- != _bfd_generic_get_section_contents)
- {
- /* We don't know what changes the bfd's get_section_contents
- method may have to make. So punt trying to map the file
- window, and let get_section_contents do its thing. */
- /* @@ FIXME : If the internal window has a refcount of 1 and was
- allocated with malloc instead of mmap, just reuse it. */
- bfd_free_window (w);
- w->i = bfd_zmalloc (sizeof (bfd_window_internal));
- if (w->i == NULL)
- return FALSE;
- w->i->data = bfd_malloc (count);
- if (w->i->data == NULL)
- {
- free (w->i);
- w->i = NULL;
- return FALSE;
- }
- w->i->mapped = 0;
- w->i->refcount = 1;
- w->size = w->i->size = count;
- w->data = w->i->data;
- return bfd_get_section_contents (abfd, section, w->data, offset, count);
- }
- if (offset + count > section->_raw_size
- || ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
- TRUE))
- return FALSE;
- return TRUE;
-#else
- abort ();
-#endif
-}
-
-/* This generic function can only be used in implementations where creating
- NEW sections is disallowed. It is useful in patching existing sections
- in read-write files, though. See other set_section_contents functions
- to see why it doesn't work for new sections. */
-bfd_boolean
-_bfd_generic_set_section_contents (bfd *abfd,
- sec_ptr section,
- const void *location,
- file_ptr offset,
- bfd_size_type count)
-{
- if (count == 0)
- return TRUE;
-
- if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
- return FALSE;
-
- return TRUE;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_log2
-
-SYNOPSIS
- unsigned int bfd_log2 (bfd_vma x);
-
-DESCRIPTION
- Return the log base 2 of the value supplied, rounded up. E.g., an
- @var{x} of 1025 returns 11. A @var{x} of 0 returns 0.
-*/
-
-unsigned int
-bfd_log2 (bfd_vma x)
-{
- unsigned int result = 0;
-
- while ((x = (x >> 1)) != 0)
- ++result;
- return result;
-}
-
-bfd_boolean
-bfd_generic_is_local_label_name (bfd *abfd, const char *name)
-{
- char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.';
-
- return name[0] == locals_prefix;
-}
-
-/* Can be used from / for bfd_merge_private_bfd_data to check that
- endianness matches between input and output file. Returns
- TRUE for a match, otherwise returns FALSE and emits an error. */
-bfd_boolean
-_bfd_generic_verify_endian_match (bfd *ibfd, bfd *obfd)
-{
- if (ibfd->xvec->byteorder != obfd->xvec->byteorder
- && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
- && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
- {
- const char *msg;
-
- if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system and target is little endian");
- else
- msg = _("%s: compiled for a little endian system and target is big endian");
-
- (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
-
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Give a warning at runtime if someone compiles code which calls
- old routines. */
-
-void
-warn_deprecated (const char *what,
- const char *file,
- int line,
- const char *func)
-{
- /* Poor man's tracking of functions we've already warned about. */
- static size_t mask = 0;
-
- if (~(size_t) func & ~mask)
- {
- /* Note: separate sentences in order to allow
- for translation into other languages. */
- if (func)
- fprintf (stderr, _("Deprecated %s called at %s line %d in %s\n"),
- what, file, line, func);
- else
- fprintf (stderr, _("Deprecated %s called\n"), what);
- mask |= ~(size_t) func;
- }
-}
diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h
deleted file mode 100644
index 62043f3..0000000
--- a/contrib/binutils/bfd/libbfd.h
+++ /dev/null
@@ -1,1560 +0,0 @@
-/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
- generated from "libbfd-in.h", "init.c", "libbfd.c", "bfdio.c",
- "bfdwin.c", "cache.c", "reloc.c", "archures.c" and "elf.c".
- Run "make headers" in your build bfd/ to regenerate. */
-
-/* libbfd.h -- Declarations used by bfd library *implementation*.
- (This include file is not for users of the library.)
-
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Align an address upward to a boundary, expressed as a number of bytes.
- E.g. align to an 8-byte boundary with argument of 8. Take care never
- to wrap around if the address is within boundary-1 of the end of the
- address space. */
-#define BFD_ALIGN(this, boundary) \
- ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
- ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
- : ~ (bfd_vma) 0)
-
-/* If you want to read and write large blocks, you might want to do it
- in quanta of this amount */
-#define DEFAULT_BUFFERSIZE 8192
-
-/* Set a tdata field. Can't use the other macros for this, since they
- do casts, and casting to the left of assignment isn't portable. */
-#define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
-
-/* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
- to an instance of this structure. */
-
-struct bfd_in_memory
-{
- /* Size of buffer. */
- bfd_size_type size;
- /* Buffer holding contents of BFD. */
- bfd_byte *buffer;
-};
-
-/* tdata for an archive. For an input archive, cache
- needs to be free()'d. For an output archive, symdefs do. */
-
-struct artdata {
- file_ptr first_file_filepos;
- /* Speed up searching the armap */
- struct ar_cache *cache;
- bfd *archive_head; /* Only interesting in output routines */
- carsym *symdefs; /* the symdef entries */
- symindex symdef_count; /* how many there are */
- char *extended_names; /* clever intel extension */
- /* when more compilers are standard C, this can be a time_t */
- long armap_timestamp; /* Timestamp value written into armap.
- This is used for BSD archives to check
- that the timestamp is recent enough
- for the BSD linker to not complain,
- just before we finish writing an
- archive. */
- file_ptr armap_datepos; /* Position within archive to seek to
- rewrite the date field. */
- void *tdata; /* Backend specific information. */
-};
-
-#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
-
-/* Goes in bfd's arelt_data slot */
-struct areltdata {
- char * arch_header; /* it's actually a string */
- unsigned int parsed_size; /* octets of filesize not including ar_hdr */
- char *filename; /* null-terminated */
-};
-
-#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
-
-extern void *bfd_malloc
- (bfd_size_type);
-extern void *bfd_realloc
- (void *, bfd_size_type);
-extern void *bfd_zmalloc
- (bfd_size_type);
-
-extern bfd_error_handler_type _bfd_error_handler;
-
-/* These routines allocate and free things on the BFD's objalloc. */
-
-extern void *bfd_alloc
- (bfd *, bfd_size_type);
-extern void *bfd_zalloc
- (bfd *, bfd_size_type);
-extern void bfd_release
- (bfd *, void *);
-
-bfd * _bfd_create_empty_archive_element_shell
- (bfd *obfd);
-bfd * _bfd_look_for_bfd_in_cache
- (bfd *, file_ptr);
-bfd_boolean _bfd_add_bfd_to_archive_cache
- (bfd *, file_ptr, bfd *);
-bfd_boolean _bfd_generic_mkarchive
- (bfd *abfd);
-const bfd_target *bfd_generic_archive_p
- (bfd *abfd);
-bfd_boolean bfd_slurp_armap
- (bfd *abfd);
-bfd_boolean bfd_slurp_bsd_armap_f2
- (bfd *abfd);
-#define bfd_slurp_bsd_armap bfd_slurp_armap
-#define bfd_slurp_coff_armap bfd_slurp_armap
-bfd_boolean _bfd_slurp_extended_name_table
- (bfd *abfd);
-extern bfd_boolean _bfd_construct_extended_name_table
- (bfd *, bfd_boolean, char **, bfd_size_type *);
-bfd_boolean _bfd_write_archive_contents
- (bfd *abfd);
-bfd_boolean _bfd_compute_and_write_armap
- (bfd *, unsigned int elength);
-bfd *_bfd_get_elt_at_filepos
- (bfd *archive, file_ptr filepos);
-extern bfd *_bfd_generic_get_elt_at_index
- (bfd *, symindex);
-bfd * _bfd_new_bfd
- (void);
-void _bfd_delete_bfd
- (bfd *);
-
-bfd_boolean bfd_false
- (bfd *ignore);
-bfd_boolean bfd_true
- (bfd *ignore);
-void *bfd_nullvoidptr
- (bfd *ignore);
-int bfd_0
- (bfd *ignore);
-unsigned int bfd_0u
- (bfd *ignore);
-long bfd_0l
- (bfd *ignore);
-long _bfd_n1
- (bfd *ignore);
-void bfd_void
- (bfd *ignore);
-
-bfd *_bfd_new_bfd_contained_in
- (bfd *);
-const bfd_target *_bfd_dummy_target
- (bfd *abfd);
-
-void bfd_dont_truncate_arname
- (bfd *abfd, const char *filename, char *hdr);
-void bfd_bsd_truncate_arname
- (bfd *abfd, const char *filename, char *hdr);
-void bfd_gnu_truncate_arname
- (bfd *abfd, const char *filename, char *hdr);
-
-bfd_boolean bsd_write_armap
- (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
- int stridx);
-
-bfd_boolean coff_write_armap
- (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
- int stridx);
-
-extern void *_bfd_generic_read_ar_hdr
- (bfd *);
-
-extern void *_bfd_generic_read_ar_hdr_mag
- (bfd *, const char *);
-
-bfd * bfd_generic_openr_next_archived_file
- (bfd *archive, bfd *last_file);
-
-int bfd_generic_stat_arch_elt
- (bfd *, struct stat *);
-
-#define _bfd_read_ar_hdr(abfd) \
- BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
-
-/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
- BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
-
-#define _bfd_generic_close_and_cleanup bfd_true
-#define _bfd_generic_bfd_free_cached_info bfd_true
-#define _bfd_generic_new_section_hook \
- ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
-extern bfd_boolean _bfd_generic_get_section_contents
- (bfd *, asection *, void *, file_ptr, bfd_size_type);
-extern bfd_boolean _bfd_generic_get_section_contents_in_window
- (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type);
-
-/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
- BFD_JUMP_TABLE_COPY (_bfd_generic). */
-
-#define _bfd_generic_bfd_copy_private_bfd_data \
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
-#define _bfd_generic_bfd_merge_private_bfd_data \
- ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
-#define _bfd_generic_bfd_set_private_flags \
- ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
-#define _bfd_generic_bfd_copy_private_section_data \
- ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
-#define _bfd_generic_bfd_copy_private_symbol_data \
- ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
-#define _bfd_generic_bfd_print_private_bfd_data \
- ((bfd_boolean (*) (bfd *, void *)) bfd_true)
-
-/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
- support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
-
-extern char *_bfd_nocore_core_file_failing_command
- (bfd *);
-extern int _bfd_nocore_core_file_failing_signal
- (bfd *);
-extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
- (bfd *, bfd *);
-
-/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
- file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
-
-#define _bfd_noarchive_slurp_armap bfd_false
-#define _bfd_noarchive_slurp_extended_name_table bfd_false
-#define _bfd_noarchive_construct_extended_name_table \
- ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \
- bfd_false)
-#define _bfd_noarchive_truncate_arname \
- ((void (*) (bfd *, const char *, char *)) bfd_void)
-#define _bfd_noarchive_write_armap \
- ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
- bfd_false)
-#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
-#define _bfd_noarchive_openr_next_archived_file \
- ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
-#define _bfd_noarchive_get_elt_at_index \
- ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr)
-#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
-#define _bfd_noarchive_update_armap_timestamp bfd_false
-
-/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
- archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */
-
-#define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
-#define _bfd_archive_bsd_slurp_extended_name_table \
- _bfd_slurp_extended_name_table
-extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
- (bfd *, char **, bfd_size_type *, const char **);
-#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
-#define _bfd_archive_bsd_write_armap bsd_write_armap
-#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
-#define _bfd_archive_bsd_openr_next_archived_file \
- bfd_generic_openr_next_archived_file
-#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
-#define _bfd_archive_bsd_generic_stat_arch_elt \
- bfd_generic_stat_arch_elt
-extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp
- (bfd *);
-
-/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
- archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
-
-#define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
-#define _bfd_archive_coff_slurp_extended_name_table \
- _bfd_slurp_extended_name_table
-extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
- (bfd *, char **, bfd_size_type *, const char **);
-#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
-#define _bfd_archive_coff_write_armap coff_write_armap
-#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
-#define _bfd_archive_coff_openr_next_archived_file \
- bfd_generic_openr_next_archived_file
-#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
-#define _bfd_archive_coff_generic_stat_arch_elt \
- bfd_generic_stat_arch_elt
-#define _bfd_archive_coff_update_armap_timestamp bfd_true
-
-/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
- support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
-
-#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
-#define _bfd_nosymbols_canonicalize_symtab \
- ((long (*) (bfd *, asymbol **)) _bfd_n1)
-#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
-#define _bfd_nosymbols_print_symbol \
- ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)
-#define _bfd_nosymbols_get_symbol_info \
- ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
-#define _bfd_nosymbols_bfd_is_local_label_name \
- ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
-#define _bfd_nosymbols_get_lineno \
- ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
-#define _bfd_nosymbols_find_nearest_line \
- ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \
- const char **, unsigned int *)) \
- bfd_false)
-#define _bfd_nosymbols_bfd_make_debug_symbol \
- ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
-#define _bfd_nosymbols_read_minisymbols \
- ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)
-#define _bfd_nosymbols_minisymbol_to_symbol \
- ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \
- bfd_nullvoidptr)
-
-/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
- support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
-
-#define _bfd_norelocs_get_reloc_upper_bound \
- ((long (*) (bfd *, asection *)) _bfd_n1)
-#define _bfd_norelocs_canonicalize_reloc \
- ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1)
-#define _bfd_norelocs_bfd_reloc_type_lookup \
- ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
-
-/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
- be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
-
-#define _bfd_nowrite_set_arch_mach \
- ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \
- bfd_false)
-#define _bfd_nowrite_set_section_contents \
- ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \
- bfd_false)
-
-/* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use
- BFD_JUMP_TABLE_WRITE (_bfd_generic). */
-
-#define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
-extern bfd_boolean _bfd_generic_set_section_contents
- (bfd *, asection *, const void *, file_ptr, bfd_size_type);
-
-/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
- support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
-
-#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0)
-#define _bfd_nolink_bfd_get_relocated_section_contents \
- ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
- bfd_byte *, bfd_boolean, asymbol **)) \
- bfd_nullvoidptr)
-#define _bfd_nolink_bfd_relax_section \
- ((bfd_boolean (*) \
- (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
- bfd_false)
-#define _bfd_nolink_bfd_gc_sections \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
- bfd_false)
-#define _bfd_nolink_bfd_merge_sections \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
- bfd_false)
-#define _bfd_nolink_bfd_discard_group \
- ((bfd_boolean (*) (bfd *, struct bfd_section *)) \
- bfd_false)
-#define _bfd_nolink_bfd_link_hash_table_create \
- ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr)
-#define _bfd_nolink_bfd_link_hash_table_free \
- ((void (*) (struct bfd_link_hash_table *)) bfd_void)
-#define _bfd_nolink_bfd_link_add_symbols \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
-#define _bfd_nolink_bfd_link_just_syms \
- ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
-#define _bfd_nolink_bfd_final_link \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
-#define _bfd_nolink_bfd_link_split_section \
- ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
-
-/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
- have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
- (_bfd_nodynamic). */
-
-#define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1
-#define _bfd_nodynamic_canonicalize_dynamic_symtab \
- ((long (*) (bfd *, asymbol **)) _bfd_n1)
-#define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1
-#define _bfd_nodynamic_canonicalize_dynamic_reloc \
- ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
-
-/* Generic routine to determine of the given symbol is a local
- label. */
-extern bfd_boolean bfd_generic_is_local_label_name
- (bfd *, const char *);
-
-/* Generic minisymbol routines. */
-extern long _bfd_generic_read_minisymbols
- (bfd *, bfd_boolean, void **, unsigned int *);
-extern asymbol *_bfd_generic_minisymbol_to_symbol
- (bfd *, bfd_boolean, const void *, asymbol *);
-
-/* Find the nearest line using .stab/.stabstr sections. */
-extern bfd_boolean _bfd_stab_section_find_nearest_line
- (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *,
- const char **, const char **, unsigned int *, void **);
-
-/* Find the neaderst line using DWARF 1 debugging information. */
-extern bfd_boolean _bfd_dwarf1_find_nearest_line
- (bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *);
-
-/* Find the nearest line using DWARF 2 debugging information. */
-extern bfd_boolean _bfd_dwarf2_find_nearest_line
- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
- unsigned int *, unsigned int, void **);
-
-/* Create a new section entry. */
-extern struct bfd_hash_entry *bfd_section_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-
-/* A routine to create entries for a bfd_link_hash_table. */
-extern struct bfd_hash_entry *_bfd_link_hash_newfunc
- (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
- const char *string);
-
-/* Initialize a bfd_link_hash_table. */
-extern bfd_boolean _bfd_link_hash_table_init
- (struct bfd_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
-
-/* Generic link hash table creation routine. */
-extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
- (bfd *);
-
-/* Generic link hash table destruction routine. */
-extern void _bfd_generic_link_hash_table_free
- (struct bfd_link_hash_table *);
-
-/* Generic add symbol routine. */
-extern bfd_boolean _bfd_generic_link_add_symbols
- (bfd *, struct bfd_link_info *);
-
-/* Generic add symbol routine. This version is used by targets for
- which the linker must collect constructors and destructors by name,
- as the collect2 program does. */
-extern bfd_boolean _bfd_generic_link_add_symbols_collect
- (bfd *, struct bfd_link_info *);
-
-/* Generic archive add symbol routine. */
-extern bfd_boolean _bfd_generic_link_add_archive_symbols
- (bfd *, struct bfd_link_info *,
- bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *));
-
-/* Forward declaration to avoid prototype errors. */
-typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
-
-/* Generic routine to add a single symbol. */
-extern bfd_boolean _bfd_generic_link_add_one_symbol
- (struct bfd_link_info *, bfd *, const char *name, flagword,
- asection *, bfd_vma, const char *, bfd_boolean copy,
- bfd_boolean constructor, struct bfd_link_hash_entry **);
-
-/* Generic routine to mark section as supplying symbols only. */
-extern void _bfd_generic_link_just_syms
- (asection *, struct bfd_link_info *);
-
-/* Generic link routine. */
-extern bfd_boolean _bfd_generic_final_link
- (bfd *, struct bfd_link_info *);
-
-extern bfd_boolean _bfd_generic_link_split_section
- (bfd *, struct bfd_section *);
-
-/* Generic reloc_link_order processing routine. */
-extern bfd_boolean _bfd_generic_reloc_link_order
- (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
-
-/* Default link order processing routine. */
-extern bfd_boolean _bfd_default_link_order
- (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
-
-/* Count the number of reloc entries in a link order list. */
-extern unsigned int _bfd_count_link_order_relocs
- (struct bfd_link_order *);
-
-/* Final link relocation routine. */
-extern bfd_reloc_status_type _bfd_final_link_relocate
- (reloc_howto_type *, bfd *, asection *, bfd_byte *,
- bfd_vma, bfd_vma, bfd_vma);
-
-/* Relocate a particular location by a howto and a value. */
-extern bfd_reloc_status_type _bfd_relocate_contents
- (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
-
-/* Link stabs in sections in the first pass. */
-
-extern bfd_boolean _bfd_link_section_stabs
- (bfd *, void **, asection *, asection *, void **, bfd_size_type *);
-
-/* Eliminate stabs for discarded functions and symbols. */
-extern bfd_boolean _bfd_discard_section_stabs
- (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *);
-
-/* Write out the .stab section when linking stabs in sections. */
-
-extern bfd_boolean _bfd_write_section_stabs
- (bfd *, void **, asection *, void **, bfd_byte *);
-
-/* Write out the .stabstr string table when linking stabs in sections. */
-
-extern bfd_boolean _bfd_write_stab_strings
- (bfd *, void **);
-
-/* Find an offset within a .stab section when linking stabs in
- sections. */
-
-extern bfd_vma _bfd_stab_section_offset
- (bfd *, void **, asection *, void **, bfd_vma);
-
-/* Attempt to merge a SEC_MERGE section. */
-
-extern bfd_boolean _bfd_merge_section
- (bfd *, void **, asection *, void **);
-
-/* Attempt to merge SEC_MERGE sections. */
-
-extern bfd_boolean _bfd_merge_sections
- (bfd *, void *, void (*) (bfd *, asection *));
-
-/* Write out a merged section. */
-
-extern bfd_boolean _bfd_write_merged_section
- (bfd *, asection *, void *);
-
-/* Find an offset within a modified SEC_MERGE section. */
-
-extern bfd_vma _bfd_merged_section_offset
- (bfd *, asection **, void *, bfd_vma, bfd_vma);
-
-/* Create a string table. */
-extern struct bfd_strtab_hash *_bfd_stringtab_init
- (void);
-
-/* Create an XCOFF .debug section style string table. */
-extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
- (void);
-
-/* Free a string table. */
-extern void _bfd_stringtab_free
- (struct bfd_strtab_hash *);
-
-/* Get the size of a string table. */
-extern bfd_size_type _bfd_stringtab_size
- (struct bfd_strtab_hash *);
-
-/* Add a string to a string table. */
-extern bfd_size_type _bfd_stringtab_add
- (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy);
-
-/* Write out a string table. */
-extern bfd_boolean _bfd_stringtab_emit
- (bfd *, struct bfd_strtab_hash *);
-
-/* Check that endianness of input and output file match. */
-extern bfd_boolean _bfd_generic_verify_endian_match
- (bfd *, bfd *);
-
-/* Macros to tell if bfds are read or write enabled.
-
- Note that bfds open for read may be scribbled into if the fd passed
- to bfd_fdopenr is actually open both for read and write
- simultaneously. However an output bfd will never be open for
- read. Therefore sometimes you want to check bfd_read_p or
- !bfd_read_p, and only sometimes bfd_write_p.
-*/
-
-#define bfd_read_p(abfd) \
- ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
-#define bfd_write_p(abfd) \
- ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
-
-void bfd_assert
- (const char*,int);
-
-#define BFD_ASSERT(x) \
- { if (!(x)) bfd_assert(__FILE__,__LINE__); }
-
-#define BFD_FAIL() \
- { bfd_assert(__FILE__,__LINE__); }
-
-extern void _bfd_abort
- (const char *, int, const char *) ATTRIBUTE_NORETURN;
-
-/* if gcc >= 2.6, we can give a function name, too */
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
-#define __PRETTY_FUNCTION__ ((char *) NULL)
-#endif
-
-#undef abort
-#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-/* Manipulate a system FILE but using BFD's "file_ptr", rather than
- the system "off_t" or "off64_t", as the offset. */
-extern file_ptr real_ftell (FILE *file);
-extern int real_fseek (FILE *file, file_ptr offset, int whence);
-
-FILE * bfd_cache_lookup_worker
- (bfd *);
-
-extern bfd *bfd_last_cache;
-
-/* List of supported target vectors, and the default vector (if
- bfd_default_vector[0] is NULL, there is no default). */
-extern const bfd_target * const *bfd_target_vector;
-extern const bfd_target *bfd_default_vector[];
-
-/* List of associated target vectors. */
-extern const bfd_target * const *bfd_associated_vector;
-
-/* Functions shared by the ECOFF and MIPS ELF backends, which have no
- other common header files. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_find_line;
-#endif
-
-extern bfd_boolean _bfd_ecoff_locate_line
- (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
- const struct ecoff_debug_swap * const, struct ecoff_find_line *,
- const char **, const char **, unsigned int *);
-extern bfd_boolean _bfd_ecoff_get_accumulated_pdr
- (void *, bfd_byte *);
-extern bfd_boolean _bfd_ecoff_get_accumulated_sym
- (void *, bfd_byte *);
-extern bfd_boolean _bfd_ecoff_get_accumulated_ss
- (void *, bfd_byte *);
-
-extern bfd_vma _bfd_get_gp_value
- (bfd *);
-extern void _bfd_set_gp_value
- (bfd *, bfd_vma);
-
-/* Function shared by the COFF and ELF SH backends, which have no
- other common header files. */
-
-#ifndef _bfd_sh_align_load_span
-extern bfd_boolean _bfd_sh_align_load_span
- (bfd *, asection *, bfd_byte *,
- bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
- void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
-#endif
-/* Extracted from init.c. */
-/* Extracted from libbfd.c. */
-bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
-
-unsigned int bfd_log2 (bfd_vma x);
-
-/* Extracted from bfdio.c. */
-/* Extracted from bfdwin.c. */
-struct _bfd_window_internal {
- struct _bfd_window_internal *next;
- void *data;
- bfd_size_type size;
- int refcount : 31; /* should be enough... */
- unsigned mapped : 1; /* 1 = mmap, 0 = malloc */
-};
-/* Extracted from cache.c. */
-#define BFD_CACHE_MAX_OPEN 10
-extern bfd *bfd_last_cache;
-
-#define bfd_cache_lookup(x) \
- ((x)==bfd_last_cache? \
- (FILE*) (bfd_last_cache->iostream): \
- bfd_cache_lookup_worker(x))
-bfd_boolean bfd_cache_init (bfd *abfd);
-
-bfd_boolean bfd_cache_close (bfd *abfd);
-
-FILE* bfd_open_file (bfd *abfd);
-
-FILE *bfd_cache_lookup_worker (bfd *abfd);
-
-/* Extracted from reloc.c. */
-#ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real
-
-static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
-
- "BFD_RELOC_64",
- "BFD_RELOC_32",
- "BFD_RELOC_26",
- "BFD_RELOC_24",
- "BFD_RELOC_16",
- "BFD_RELOC_14",
- "BFD_RELOC_8",
- "BFD_RELOC_64_PCREL",
- "BFD_RELOC_32_PCREL",
- "BFD_RELOC_24_PCREL",
- "BFD_RELOC_16_PCREL",
- "BFD_RELOC_12_PCREL",
- "BFD_RELOC_8_PCREL",
- "BFD_RELOC_32_GOT_PCREL",
- "BFD_RELOC_16_GOT_PCREL",
- "BFD_RELOC_8_GOT_PCREL",
- "BFD_RELOC_32_GOTOFF",
- "BFD_RELOC_16_GOTOFF",
- "BFD_RELOC_LO16_GOTOFF",
- "BFD_RELOC_HI16_GOTOFF",
- "BFD_RELOC_HI16_S_GOTOFF",
- "BFD_RELOC_8_GOTOFF",
- "BFD_RELOC_64_PLT_PCREL",
- "BFD_RELOC_32_PLT_PCREL",
- "BFD_RELOC_24_PLT_PCREL",
- "BFD_RELOC_16_PLT_PCREL",
- "BFD_RELOC_8_PLT_PCREL",
- "BFD_RELOC_64_PLTOFF",
- "BFD_RELOC_32_PLTOFF",
- "BFD_RELOC_16_PLTOFF",
- "BFD_RELOC_LO16_PLTOFF",
- "BFD_RELOC_HI16_PLTOFF",
- "BFD_RELOC_HI16_S_PLTOFF",
- "BFD_RELOC_8_PLTOFF",
- "BFD_RELOC_68K_GLOB_DAT",
- "BFD_RELOC_68K_JMP_SLOT",
- "BFD_RELOC_68K_RELATIVE",
- "BFD_RELOC_32_BASEREL",
- "BFD_RELOC_16_BASEREL",
- "BFD_RELOC_LO16_BASEREL",
- "BFD_RELOC_HI16_BASEREL",
- "BFD_RELOC_HI16_S_BASEREL",
- "BFD_RELOC_8_BASEREL",
- "BFD_RELOC_RVA",
- "BFD_RELOC_8_FFnn",
- "BFD_RELOC_32_PCREL_S2",
- "BFD_RELOC_16_PCREL_S2",
- "BFD_RELOC_23_PCREL_S2",
- "BFD_RELOC_HI22",
- "BFD_RELOC_LO10",
- "BFD_RELOC_GPREL16",
- "BFD_RELOC_GPREL32",
- "BFD_RELOC_I960_CALLJ",
- "BFD_RELOC_NONE",
- "BFD_RELOC_SPARC_WDISP22",
- "BFD_RELOC_SPARC22",
- "BFD_RELOC_SPARC13",
- "BFD_RELOC_SPARC_GOT10",
- "BFD_RELOC_SPARC_GOT13",
- "BFD_RELOC_SPARC_GOT22",
- "BFD_RELOC_SPARC_PC10",
- "BFD_RELOC_SPARC_PC22",
- "BFD_RELOC_SPARC_WPLT30",
- "BFD_RELOC_SPARC_COPY",
- "BFD_RELOC_SPARC_GLOB_DAT",
- "BFD_RELOC_SPARC_JMP_SLOT",
- "BFD_RELOC_SPARC_RELATIVE",
- "BFD_RELOC_SPARC_UA16",
- "BFD_RELOC_SPARC_UA32",
- "BFD_RELOC_SPARC_UA64",
- "BFD_RELOC_SPARC_BASE13",
- "BFD_RELOC_SPARC_BASE22",
- "BFD_RELOC_SPARC_10",
- "BFD_RELOC_SPARC_11",
- "BFD_RELOC_SPARC_OLO10",
- "BFD_RELOC_SPARC_HH22",
- "BFD_RELOC_SPARC_HM10",
- "BFD_RELOC_SPARC_LM22",
- "BFD_RELOC_SPARC_PC_HH22",
- "BFD_RELOC_SPARC_PC_HM10",
- "BFD_RELOC_SPARC_PC_LM22",
- "BFD_RELOC_SPARC_WDISP16",
- "BFD_RELOC_SPARC_WDISP19",
- "BFD_RELOC_SPARC_7",
- "BFD_RELOC_SPARC_6",
- "BFD_RELOC_SPARC_5",
- "BFD_RELOC_SPARC_PLT32",
- "BFD_RELOC_SPARC_PLT64",
- "BFD_RELOC_SPARC_HIX22",
- "BFD_RELOC_SPARC_LOX10",
- "BFD_RELOC_SPARC_H44",
- "BFD_RELOC_SPARC_M44",
- "BFD_RELOC_SPARC_L44",
- "BFD_RELOC_SPARC_REGISTER",
- "BFD_RELOC_SPARC_REV32",
- "BFD_RELOC_SPARC_TLS_GD_HI22",
- "BFD_RELOC_SPARC_TLS_GD_LO10",
- "BFD_RELOC_SPARC_TLS_GD_ADD",
- "BFD_RELOC_SPARC_TLS_GD_CALL",
- "BFD_RELOC_SPARC_TLS_LDM_HI22",
- "BFD_RELOC_SPARC_TLS_LDM_LO10",
- "BFD_RELOC_SPARC_TLS_LDM_ADD",
- "BFD_RELOC_SPARC_TLS_LDM_CALL",
- "BFD_RELOC_SPARC_TLS_LDO_HIX22",
- "BFD_RELOC_SPARC_TLS_LDO_LOX10",
- "BFD_RELOC_SPARC_TLS_LDO_ADD",
- "BFD_RELOC_SPARC_TLS_IE_HI22",
- "BFD_RELOC_SPARC_TLS_IE_LO10",
- "BFD_RELOC_SPARC_TLS_IE_LD",
- "BFD_RELOC_SPARC_TLS_IE_LDX",
- "BFD_RELOC_SPARC_TLS_IE_ADD",
- "BFD_RELOC_SPARC_TLS_LE_HIX22",
- "BFD_RELOC_SPARC_TLS_LE_LOX10",
- "BFD_RELOC_SPARC_TLS_DTPMOD32",
- "BFD_RELOC_SPARC_TLS_DTPMOD64",
- "BFD_RELOC_SPARC_TLS_DTPOFF32",
- "BFD_RELOC_SPARC_TLS_DTPOFF64",
- "BFD_RELOC_SPARC_TLS_TPOFF32",
- "BFD_RELOC_SPARC_TLS_TPOFF64",
- "BFD_RELOC_ALPHA_GPDISP_HI16",
- "BFD_RELOC_ALPHA_GPDISP_LO16",
- "BFD_RELOC_ALPHA_GPDISP",
- "BFD_RELOC_ALPHA_LITERAL",
- "BFD_RELOC_ALPHA_ELF_LITERAL",
- "BFD_RELOC_ALPHA_LITUSE",
- "BFD_RELOC_ALPHA_HINT",
- "BFD_RELOC_ALPHA_LINKAGE",
- "BFD_RELOC_ALPHA_CODEADDR",
- "BFD_RELOC_ALPHA_GPREL_HI16",
- "BFD_RELOC_ALPHA_GPREL_LO16",
- "BFD_RELOC_ALPHA_BRSGP",
- "BFD_RELOC_ALPHA_TLSGD",
- "BFD_RELOC_ALPHA_TLSLDM",
- "BFD_RELOC_ALPHA_DTPMOD64",
- "BFD_RELOC_ALPHA_GOTDTPREL16",
- "BFD_RELOC_ALPHA_DTPREL64",
- "BFD_RELOC_ALPHA_DTPREL_HI16",
- "BFD_RELOC_ALPHA_DTPREL_LO16",
- "BFD_RELOC_ALPHA_DTPREL16",
- "BFD_RELOC_ALPHA_GOTTPREL16",
- "BFD_RELOC_ALPHA_TPREL64",
- "BFD_RELOC_ALPHA_TPREL_HI16",
- "BFD_RELOC_ALPHA_TPREL_LO16",
- "BFD_RELOC_ALPHA_TPREL16",
- "BFD_RELOC_MIPS_JMP",
- "BFD_RELOC_MIPS16_JMP",
- "BFD_RELOC_MIPS16_GPREL",
- "BFD_RELOC_HI16",
- "BFD_RELOC_HI16_S",
- "BFD_RELOC_LO16",
- "BFD_RELOC_PCREL_HI16_S",
- "BFD_RELOC_PCREL_LO16",
- "BFD_RELOC_MIPS_LITERAL",
- "BFD_RELOC_MIPS_GOT16",
- "BFD_RELOC_MIPS_CALL16",
- "BFD_RELOC_MIPS_GOT_HI16",
- "BFD_RELOC_MIPS_GOT_LO16",
- "BFD_RELOC_MIPS_CALL_HI16",
- "BFD_RELOC_MIPS_CALL_LO16",
- "BFD_RELOC_MIPS_SUB",
- "BFD_RELOC_MIPS_GOT_PAGE",
- "BFD_RELOC_MIPS_GOT_OFST",
- "BFD_RELOC_MIPS_GOT_DISP",
- "BFD_RELOC_MIPS_SHIFT5",
- "BFD_RELOC_MIPS_SHIFT6",
- "BFD_RELOC_MIPS_INSERT_A",
- "BFD_RELOC_MIPS_INSERT_B",
- "BFD_RELOC_MIPS_DELETE",
- "BFD_RELOC_MIPS_HIGHEST",
- "BFD_RELOC_MIPS_HIGHER",
- "BFD_RELOC_MIPS_SCN_DISP",
- "BFD_RELOC_MIPS_REL16",
- "BFD_RELOC_MIPS_RELGOT",
- "BFD_RELOC_MIPS_JALR",
-
- "BFD_RELOC_FRV_LABEL16",
- "BFD_RELOC_FRV_LABEL24",
- "BFD_RELOC_FRV_LO16",
- "BFD_RELOC_FRV_HI16",
- "BFD_RELOC_FRV_GPREL12",
- "BFD_RELOC_FRV_GPRELU12",
- "BFD_RELOC_FRV_GPREL32",
- "BFD_RELOC_FRV_GPRELHI",
- "BFD_RELOC_FRV_GPRELLO",
- "BFD_RELOC_FRV_GOT12",
- "BFD_RELOC_FRV_GOTHI",
- "BFD_RELOC_FRV_GOTLO",
- "BFD_RELOC_FRV_FUNCDESC",
- "BFD_RELOC_FRV_FUNCDESC_GOT12",
- "BFD_RELOC_FRV_FUNCDESC_GOTHI",
- "BFD_RELOC_FRV_FUNCDESC_GOTLO",
- "BFD_RELOC_FRV_FUNCDESC_VALUE",
- "BFD_RELOC_FRV_FUNCDESC_GOTOFF12",
- "BFD_RELOC_FRV_FUNCDESC_GOTOFFHI",
- "BFD_RELOC_FRV_FUNCDESC_GOTOFFLO",
- "BFD_RELOC_FRV_GOTOFF12",
- "BFD_RELOC_FRV_GOTOFFHI",
- "BFD_RELOC_FRV_GOTOFFLO",
-
- "BFD_RELOC_MN10300_GOTOFF24",
- "BFD_RELOC_MN10300_GOT32",
- "BFD_RELOC_MN10300_GOT24",
- "BFD_RELOC_MN10300_GOT16",
- "BFD_RELOC_MN10300_COPY",
- "BFD_RELOC_MN10300_GLOB_DAT",
- "BFD_RELOC_MN10300_JMP_SLOT",
- "BFD_RELOC_MN10300_RELATIVE",
-
- "BFD_RELOC_386_GOT32",
- "BFD_RELOC_386_PLT32",
- "BFD_RELOC_386_COPY",
- "BFD_RELOC_386_GLOB_DAT",
- "BFD_RELOC_386_JUMP_SLOT",
- "BFD_RELOC_386_RELATIVE",
- "BFD_RELOC_386_GOTOFF",
- "BFD_RELOC_386_GOTPC",
- "BFD_RELOC_386_TLS_TPOFF",
- "BFD_RELOC_386_TLS_IE",
- "BFD_RELOC_386_TLS_GOTIE",
- "BFD_RELOC_386_TLS_LE",
- "BFD_RELOC_386_TLS_GD",
- "BFD_RELOC_386_TLS_LDM",
- "BFD_RELOC_386_TLS_LDO_32",
- "BFD_RELOC_386_TLS_IE_32",
- "BFD_RELOC_386_TLS_LE_32",
- "BFD_RELOC_386_TLS_DTPMOD32",
- "BFD_RELOC_386_TLS_DTPOFF32",
- "BFD_RELOC_386_TLS_TPOFF32",
- "BFD_RELOC_X86_64_GOT32",
- "BFD_RELOC_X86_64_PLT32",
- "BFD_RELOC_X86_64_COPY",
- "BFD_RELOC_X86_64_GLOB_DAT",
- "BFD_RELOC_X86_64_JUMP_SLOT",
- "BFD_RELOC_X86_64_RELATIVE",
- "BFD_RELOC_X86_64_GOTPCREL",
- "BFD_RELOC_X86_64_32S",
- "BFD_RELOC_X86_64_DTPMOD64",
- "BFD_RELOC_X86_64_DTPOFF64",
- "BFD_RELOC_X86_64_TPOFF64",
- "BFD_RELOC_X86_64_TLSGD",
- "BFD_RELOC_X86_64_TLSLD",
- "BFD_RELOC_X86_64_DTPOFF32",
- "BFD_RELOC_X86_64_GOTTPOFF",
- "BFD_RELOC_X86_64_TPOFF32",
- "BFD_RELOC_NS32K_IMM_8",
- "BFD_RELOC_NS32K_IMM_16",
- "BFD_RELOC_NS32K_IMM_32",
- "BFD_RELOC_NS32K_IMM_8_PCREL",
- "BFD_RELOC_NS32K_IMM_16_PCREL",
- "BFD_RELOC_NS32K_IMM_32_PCREL",
- "BFD_RELOC_NS32K_DISP_8",
- "BFD_RELOC_NS32K_DISP_16",
- "BFD_RELOC_NS32K_DISP_32",
- "BFD_RELOC_NS32K_DISP_8_PCREL",
- "BFD_RELOC_NS32K_DISP_16_PCREL",
- "BFD_RELOC_NS32K_DISP_32_PCREL",
- "BFD_RELOC_PDP11_DISP_8_PCREL",
- "BFD_RELOC_PDP11_DISP_6_PCREL",
- "BFD_RELOC_PJ_CODE_HI16",
- "BFD_RELOC_PJ_CODE_LO16",
- "BFD_RELOC_PJ_CODE_DIR16",
- "BFD_RELOC_PJ_CODE_DIR32",
- "BFD_RELOC_PJ_CODE_REL16",
- "BFD_RELOC_PJ_CODE_REL32",
- "BFD_RELOC_PPC_B26",
- "BFD_RELOC_PPC_BA26",
- "BFD_RELOC_PPC_TOC16",
- "BFD_RELOC_PPC_B16",
- "BFD_RELOC_PPC_B16_BRTAKEN",
- "BFD_RELOC_PPC_B16_BRNTAKEN",
- "BFD_RELOC_PPC_BA16",
- "BFD_RELOC_PPC_BA16_BRTAKEN",
- "BFD_RELOC_PPC_BA16_BRNTAKEN",
- "BFD_RELOC_PPC_COPY",
- "BFD_RELOC_PPC_GLOB_DAT",
- "BFD_RELOC_PPC_JMP_SLOT",
- "BFD_RELOC_PPC_RELATIVE",
- "BFD_RELOC_PPC_LOCAL24PC",
- "BFD_RELOC_PPC_EMB_NADDR32",
- "BFD_RELOC_PPC_EMB_NADDR16",
- "BFD_RELOC_PPC_EMB_NADDR16_LO",
- "BFD_RELOC_PPC_EMB_NADDR16_HI",
- "BFD_RELOC_PPC_EMB_NADDR16_HA",
- "BFD_RELOC_PPC_EMB_SDAI16",
- "BFD_RELOC_PPC_EMB_SDA2I16",
- "BFD_RELOC_PPC_EMB_SDA2REL",
- "BFD_RELOC_PPC_EMB_SDA21",
- "BFD_RELOC_PPC_EMB_MRKREF",
- "BFD_RELOC_PPC_EMB_RELSEC16",
- "BFD_RELOC_PPC_EMB_RELST_LO",
- "BFD_RELOC_PPC_EMB_RELST_HI",
- "BFD_RELOC_PPC_EMB_RELST_HA",
- "BFD_RELOC_PPC_EMB_BIT_FLD",
- "BFD_RELOC_PPC_EMB_RELSDA",
- "BFD_RELOC_PPC64_HIGHER",
- "BFD_RELOC_PPC64_HIGHER_S",
- "BFD_RELOC_PPC64_HIGHEST",
- "BFD_RELOC_PPC64_HIGHEST_S",
- "BFD_RELOC_PPC64_TOC16_LO",
- "BFD_RELOC_PPC64_TOC16_HI",
- "BFD_RELOC_PPC64_TOC16_HA",
- "BFD_RELOC_PPC64_TOC",
- "BFD_RELOC_PPC64_PLTGOT16",
- "BFD_RELOC_PPC64_PLTGOT16_LO",
- "BFD_RELOC_PPC64_PLTGOT16_HI",
- "BFD_RELOC_PPC64_PLTGOT16_HA",
- "BFD_RELOC_PPC64_ADDR16_DS",
- "BFD_RELOC_PPC64_ADDR16_LO_DS",
- "BFD_RELOC_PPC64_GOT16_DS",
- "BFD_RELOC_PPC64_GOT16_LO_DS",
- "BFD_RELOC_PPC64_PLT16_LO_DS",
- "BFD_RELOC_PPC64_SECTOFF_DS",
- "BFD_RELOC_PPC64_SECTOFF_LO_DS",
- "BFD_RELOC_PPC64_TOC16_DS",
- "BFD_RELOC_PPC64_TOC16_LO_DS",
- "BFD_RELOC_PPC64_PLTGOT16_DS",
- "BFD_RELOC_PPC64_PLTGOT16_LO_DS",
- "BFD_RELOC_PPC_TLS",
- "BFD_RELOC_PPC_DTPMOD",
- "BFD_RELOC_PPC_TPREL16",
- "BFD_RELOC_PPC_TPREL16_LO",
- "BFD_RELOC_PPC_TPREL16_HI",
- "BFD_RELOC_PPC_TPREL16_HA",
- "BFD_RELOC_PPC_TPREL",
- "BFD_RELOC_PPC_DTPREL16",
- "BFD_RELOC_PPC_DTPREL16_LO",
- "BFD_RELOC_PPC_DTPREL16_HI",
- "BFD_RELOC_PPC_DTPREL16_HA",
- "BFD_RELOC_PPC_DTPREL",
- "BFD_RELOC_PPC_GOT_TLSGD16",
- "BFD_RELOC_PPC_GOT_TLSGD16_LO",
- "BFD_RELOC_PPC_GOT_TLSGD16_HI",
- "BFD_RELOC_PPC_GOT_TLSGD16_HA",
- "BFD_RELOC_PPC_GOT_TLSLD16",
- "BFD_RELOC_PPC_GOT_TLSLD16_LO",
- "BFD_RELOC_PPC_GOT_TLSLD16_HI",
- "BFD_RELOC_PPC_GOT_TLSLD16_HA",
- "BFD_RELOC_PPC_GOT_TPREL16",
- "BFD_RELOC_PPC_GOT_TPREL16_LO",
- "BFD_RELOC_PPC_GOT_TPREL16_HI",
- "BFD_RELOC_PPC_GOT_TPREL16_HA",
- "BFD_RELOC_PPC_GOT_DTPREL16",
- "BFD_RELOC_PPC_GOT_DTPREL16_LO",
- "BFD_RELOC_PPC_GOT_DTPREL16_HI",
- "BFD_RELOC_PPC_GOT_DTPREL16_HA",
- "BFD_RELOC_PPC64_TPREL16_DS",
- "BFD_RELOC_PPC64_TPREL16_LO_DS",
- "BFD_RELOC_PPC64_TPREL16_HIGHER",
- "BFD_RELOC_PPC64_TPREL16_HIGHERA",
- "BFD_RELOC_PPC64_TPREL16_HIGHEST",
- "BFD_RELOC_PPC64_TPREL16_HIGHESTA",
- "BFD_RELOC_PPC64_DTPREL16_DS",
- "BFD_RELOC_PPC64_DTPREL16_LO_DS",
- "BFD_RELOC_PPC64_DTPREL16_HIGHER",
- "BFD_RELOC_PPC64_DTPREL16_HIGHERA",
- "BFD_RELOC_PPC64_DTPREL16_HIGHEST",
- "BFD_RELOC_PPC64_DTPREL16_HIGHESTA",
- "BFD_RELOC_I370_D12",
- "BFD_RELOC_CTOR",
- "BFD_RELOC_ARM_PCREL_BRANCH",
- "BFD_RELOC_ARM_PCREL_BLX",
- "BFD_RELOC_THUMB_PCREL_BLX",
- "BFD_RELOC_ARM_IMMEDIATE",
- "BFD_RELOC_ARM_ADRL_IMMEDIATE",
- "BFD_RELOC_ARM_OFFSET_IMM",
- "BFD_RELOC_ARM_SHIFT_IMM",
- "BFD_RELOC_ARM_SWI",
- "BFD_RELOC_ARM_MULTI",
- "BFD_RELOC_ARM_CP_OFF_IMM",
- "BFD_RELOC_ARM_CP_OFF_IMM_S2",
- "BFD_RELOC_ARM_ADR_IMM",
- "BFD_RELOC_ARM_LDR_IMM",
- "BFD_RELOC_ARM_LITERAL",
- "BFD_RELOC_ARM_IN_POOL",
- "BFD_RELOC_ARM_OFFSET_IMM8",
- "BFD_RELOC_ARM_HWLITERAL",
- "BFD_RELOC_ARM_THUMB_ADD",
- "BFD_RELOC_ARM_THUMB_IMM",
- "BFD_RELOC_ARM_THUMB_SHIFT",
- "BFD_RELOC_ARM_THUMB_OFFSET",
- "BFD_RELOC_ARM_GOT12",
- "BFD_RELOC_ARM_GOT32",
- "BFD_RELOC_ARM_JUMP_SLOT",
- "BFD_RELOC_ARM_COPY",
- "BFD_RELOC_ARM_GLOB_DAT",
- "BFD_RELOC_ARM_PLT32",
- "BFD_RELOC_ARM_RELATIVE",
- "BFD_RELOC_ARM_GOTOFF",
- "BFD_RELOC_ARM_GOTPC",
- "BFD_RELOC_SH_PCDISP8BY2",
- "BFD_RELOC_SH_PCDISP12BY2",
- "BFD_RELOC_SH_IMM4",
- "BFD_RELOC_SH_IMM4BY2",
- "BFD_RELOC_SH_IMM4BY4",
- "BFD_RELOC_SH_IMM8",
- "BFD_RELOC_SH_IMM8BY2",
- "BFD_RELOC_SH_IMM8BY4",
- "BFD_RELOC_SH_PCRELIMM8BY2",
- "BFD_RELOC_SH_PCRELIMM8BY4",
- "BFD_RELOC_SH_SWITCH16",
- "BFD_RELOC_SH_SWITCH32",
- "BFD_RELOC_SH_USES",
- "BFD_RELOC_SH_COUNT",
- "BFD_RELOC_SH_ALIGN",
- "BFD_RELOC_SH_CODE",
- "BFD_RELOC_SH_DATA",
- "BFD_RELOC_SH_LABEL",
- "BFD_RELOC_SH_LOOP_START",
- "BFD_RELOC_SH_LOOP_END",
- "BFD_RELOC_SH_COPY",
- "BFD_RELOC_SH_GLOB_DAT",
- "BFD_RELOC_SH_JMP_SLOT",
- "BFD_RELOC_SH_RELATIVE",
- "BFD_RELOC_SH_GOTPC",
- "BFD_RELOC_SH_GOT_LOW16",
- "BFD_RELOC_SH_GOT_MEDLOW16",
- "BFD_RELOC_SH_GOT_MEDHI16",
- "BFD_RELOC_SH_GOT_HI16",
- "BFD_RELOC_SH_GOTPLT_LOW16",
- "BFD_RELOC_SH_GOTPLT_MEDLOW16",
- "BFD_RELOC_SH_GOTPLT_MEDHI16",
- "BFD_RELOC_SH_GOTPLT_HI16",
- "BFD_RELOC_SH_PLT_LOW16",
- "BFD_RELOC_SH_PLT_MEDLOW16",
- "BFD_RELOC_SH_PLT_MEDHI16",
- "BFD_RELOC_SH_PLT_HI16",
- "BFD_RELOC_SH_GOTOFF_LOW16",
- "BFD_RELOC_SH_GOTOFF_MEDLOW16",
- "BFD_RELOC_SH_GOTOFF_MEDHI16",
- "BFD_RELOC_SH_GOTOFF_HI16",
- "BFD_RELOC_SH_GOTPC_LOW16",
- "BFD_RELOC_SH_GOTPC_MEDLOW16",
- "BFD_RELOC_SH_GOTPC_MEDHI16",
- "BFD_RELOC_SH_GOTPC_HI16",
- "BFD_RELOC_SH_COPY64",
- "BFD_RELOC_SH_GLOB_DAT64",
- "BFD_RELOC_SH_JMP_SLOT64",
- "BFD_RELOC_SH_RELATIVE64",
- "BFD_RELOC_SH_GOT10BY4",
- "BFD_RELOC_SH_GOT10BY8",
- "BFD_RELOC_SH_GOTPLT10BY4",
- "BFD_RELOC_SH_GOTPLT10BY8",
- "BFD_RELOC_SH_GOTPLT32",
- "BFD_RELOC_SH_SHMEDIA_CODE",
- "BFD_RELOC_SH_IMMU5",
- "BFD_RELOC_SH_IMMS6",
- "BFD_RELOC_SH_IMMS6BY32",
- "BFD_RELOC_SH_IMMU6",
- "BFD_RELOC_SH_IMMS10",
- "BFD_RELOC_SH_IMMS10BY2",
- "BFD_RELOC_SH_IMMS10BY4",
- "BFD_RELOC_SH_IMMS10BY8",
- "BFD_RELOC_SH_IMMS16",
- "BFD_RELOC_SH_IMMU16",
- "BFD_RELOC_SH_IMM_LOW16",
- "BFD_RELOC_SH_IMM_LOW16_PCREL",
- "BFD_RELOC_SH_IMM_MEDLOW16",
- "BFD_RELOC_SH_IMM_MEDLOW16_PCREL",
- "BFD_RELOC_SH_IMM_MEDHI16",
- "BFD_RELOC_SH_IMM_MEDHI16_PCREL",
- "BFD_RELOC_SH_IMM_HI16",
- "BFD_RELOC_SH_IMM_HI16_PCREL",
- "BFD_RELOC_SH_PT_16",
- "BFD_RELOC_SH_TLS_GD_32",
- "BFD_RELOC_SH_TLS_LD_32",
- "BFD_RELOC_SH_TLS_LDO_32",
- "BFD_RELOC_SH_TLS_IE_32",
- "BFD_RELOC_SH_TLS_LE_32",
- "BFD_RELOC_SH_TLS_DTPMOD32",
- "BFD_RELOC_SH_TLS_DTPOFF32",
- "BFD_RELOC_SH_TLS_TPOFF32",
- "BFD_RELOC_THUMB_PCREL_BRANCH9",
- "BFD_RELOC_THUMB_PCREL_BRANCH12",
- "BFD_RELOC_THUMB_PCREL_BRANCH23",
- "BFD_RELOC_ARC_B22_PCREL",
- "BFD_RELOC_ARC_B26",
- "BFD_RELOC_D10V_10_PCREL_R",
- "BFD_RELOC_D10V_10_PCREL_L",
- "BFD_RELOC_D10V_18",
- "BFD_RELOC_D10V_18_PCREL",
- "BFD_RELOC_D30V_6",
- "BFD_RELOC_D30V_9_PCREL",
- "BFD_RELOC_D30V_9_PCREL_R",
- "BFD_RELOC_D30V_15",
- "BFD_RELOC_D30V_15_PCREL",
- "BFD_RELOC_D30V_15_PCREL_R",
- "BFD_RELOC_D30V_21",
- "BFD_RELOC_D30V_21_PCREL",
- "BFD_RELOC_D30V_21_PCREL_R",
- "BFD_RELOC_D30V_32",
- "BFD_RELOC_D30V_32_PCREL",
- "BFD_RELOC_DLX_HI16_S",
- "BFD_RELOC_DLX_LO16",
- "BFD_RELOC_DLX_JMP26",
- "BFD_RELOC_M32R_24",
- "BFD_RELOC_M32R_10_PCREL",
- "BFD_RELOC_M32R_18_PCREL",
- "BFD_RELOC_M32R_26_PCREL",
- "BFD_RELOC_M32R_HI16_ULO",
- "BFD_RELOC_M32R_HI16_SLO",
- "BFD_RELOC_M32R_LO16",
- "BFD_RELOC_M32R_SDA16",
- "BFD_RELOC_M32R_GOT24",
- "BFD_RELOC_M32R_26_PLTREL",
- "BFD_RELOC_M32R_COPY",
- "BFD_RELOC_M32R_GLOB_DAT",
- "BFD_RELOC_M32R_JMP_SLOT",
- "BFD_RELOC_M32R_RELATIVE",
- "BFD_RELOC_M32R_GOTOFF",
- "BFD_RELOC_M32R_GOTPC24",
- "BFD_RELOC_M32R_GOT16_HI_ULO",
- "BFD_RELOC_M32R_GOT16_HI_SLO",
- "BFD_RELOC_M32R_GOT16_LO",
- "BFD_RELOC_M32R_GOTPC_HI_ULO",
- "BFD_RELOC_M32R_GOTPC_HI_SLO",
- "BFD_RELOC_M32R_GOTPC_LO",
- "BFD_RELOC_V850_9_PCREL",
- "BFD_RELOC_V850_22_PCREL",
- "BFD_RELOC_V850_SDA_16_16_OFFSET",
- "BFD_RELOC_V850_SDA_15_16_OFFSET",
- "BFD_RELOC_V850_ZDA_16_16_OFFSET",
- "BFD_RELOC_V850_ZDA_15_16_OFFSET",
- "BFD_RELOC_V850_TDA_6_8_OFFSET",
- "BFD_RELOC_V850_TDA_7_8_OFFSET",
- "BFD_RELOC_V850_TDA_7_7_OFFSET",
- "BFD_RELOC_V850_TDA_16_16_OFFSET",
- "BFD_RELOC_V850_TDA_4_5_OFFSET",
- "BFD_RELOC_V850_TDA_4_4_OFFSET",
- "BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET",
- "BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET",
- "BFD_RELOC_V850_CALLT_6_7_OFFSET",
- "BFD_RELOC_V850_CALLT_16_16_OFFSET",
- "BFD_RELOC_V850_LONGCALL",
- "BFD_RELOC_V850_LONGJUMP",
- "BFD_RELOC_V850_ALIGN",
- "BFD_RELOC_MN10300_32_PCREL",
- "BFD_RELOC_MN10300_16_PCREL",
- "BFD_RELOC_TIC30_LDP",
- "BFD_RELOC_TIC54X_PARTLS7",
- "BFD_RELOC_TIC54X_PARTMS9",
- "BFD_RELOC_TIC54X_23",
- "BFD_RELOC_TIC54X_16_OF_23",
- "BFD_RELOC_TIC54X_MS7_OF_23",
- "BFD_RELOC_FR30_48",
- "BFD_RELOC_FR30_20",
- "BFD_RELOC_FR30_6_IN_4",
- "BFD_RELOC_FR30_8_IN_8",
- "BFD_RELOC_FR30_9_IN_8",
- "BFD_RELOC_FR30_10_IN_8",
- "BFD_RELOC_FR30_9_PCREL",
- "BFD_RELOC_FR30_12_PCREL",
- "BFD_RELOC_MCORE_PCREL_IMM8BY4",
- "BFD_RELOC_MCORE_PCREL_IMM11BY2",
- "BFD_RELOC_MCORE_PCREL_IMM4BY2",
- "BFD_RELOC_MCORE_PCREL_32",
- "BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2",
- "BFD_RELOC_MCORE_RVA",
- "BFD_RELOC_MMIX_GETA",
- "BFD_RELOC_MMIX_GETA_1",
- "BFD_RELOC_MMIX_GETA_2",
- "BFD_RELOC_MMIX_GETA_3",
- "BFD_RELOC_MMIX_CBRANCH",
- "BFD_RELOC_MMIX_CBRANCH_J",
- "BFD_RELOC_MMIX_CBRANCH_1",
- "BFD_RELOC_MMIX_CBRANCH_2",
- "BFD_RELOC_MMIX_CBRANCH_3",
- "BFD_RELOC_MMIX_PUSHJ",
- "BFD_RELOC_MMIX_PUSHJ_1",
- "BFD_RELOC_MMIX_PUSHJ_2",
- "BFD_RELOC_MMIX_PUSHJ_3",
- "BFD_RELOC_MMIX_PUSHJ_STUBBABLE",
- "BFD_RELOC_MMIX_JMP",
- "BFD_RELOC_MMIX_JMP_1",
- "BFD_RELOC_MMIX_JMP_2",
- "BFD_RELOC_MMIX_JMP_3",
- "BFD_RELOC_MMIX_ADDR19",
- "BFD_RELOC_MMIX_ADDR27",
- "BFD_RELOC_MMIX_REG_OR_BYTE",
- "BFD_RELOC_MMIX_REG",
- "BFD_RELOC_MMIX_BASE_PLUS_OFFSET",
- "BFD_RELOC_MMIX_LOCAL",
- "BFD_RELOC_AVR_7_PCREL",
- "BFD_RELOC_AVR_13_PCREL",
- "BFD_RELOC_AVR_16_PM",
- "BFD_RELOC_AVR_LO8_LDI",
- "BFD_RELOC_AVR_HI8_LDI",
- "BFD_RELOC_AVR_HH8_LDI",
- "BFD_RELOC_AVR_LO8_LDI_NEG",
- "BFD_RELOC_AVR_HI8_LDI_NEG",
- "BFD_RELOC_AVR_HH8_LDI_NEG",
- "BFD_RELOC_AVR_LO8_LDI_PM",
- "BFD_RELOC_AVR_HI8_LDI_PM",
- "BFD_RELOC_AVR_HH8_LDI_PM",
- "BFD_RELOC_AVR_LO8_LDI_PM_NEG",
- "BFD_RELOC_AVR_HI8_LDI_PM_NEG",
- "BFD_RELOC_AVR_HH8_LDI_PM_NEG",
- "BFD_RELOC_AVR_CALL",
- "BFD_RELOC_390_12",
- "BFD_RELOC_390_GOT12",
- "BFD_RELOC_390_PLT32",
- "BFD_RELOC_390_COPY",
- "BFD_RELOC_390_GLOB_DAT",
- "BFD_RELOC_390_JMP_SLOT",
- "BFD_RELOC_390_RELATIVE",
- "BFD_RELOC_390_GOTPC",
- "BFD_RELOC_390_GOT16",
- "BFD_RELOC_390_PC16DBL",
- "BFD_RELOC_390_PLT16DBL",
- "BFD_RELOC_390_PC32DBL",
- "BFD_RELOC_390_PLT32DBL",
- "BFD_RELOC_390_GOTPCDBL",
- "BFD_RELOC_390_GOT64",
- "BFD_RELOC_390_PLT64",
- "BFD_RELOC_390_GOTENT",
- "BFD_RELOC_390_GOTOFF64",
- "BFD_RELOC_390_GOTPLT12",
- "BFD_RELOC_390_GOTPLT16",
- "BFD_RELOC_390_GOTPLT32",
- "BFD_RELOC_390_GOTPLT64",
- "BFD_RELOC_390_GOTPLTENT",
- "BFD_RELOC_390_PLTOFF16",
- "BFD_RELOC_390_PLTOFF32",
- "BFD_RELOC_390_PLTOFF64",
- "BFD_RELOC_390_TLS_LOAD",
- "BFD_RELOC_390_TLS_GDCALL",
- "BFD_RELOC_390_TLS_LDCALL",
- "BFD_RELOC_390_TLS_GD32",
- "BFD_RELOC_390_TLS_GD64",
- "BFD_RELOC_390_TLS_GOTIE12",
- "BFD_RELOC_390_TLS_GOTIE32",
- "BFD_RELOC_390_TLS_GOTIE64",
- "BFD_RELOC_390_TLS_LDM32",
- "BFD_RELOC_390_TLS_LDM64",
- "BFD_RELOC_390_TLS_IE32",
- "BFD_RELOC_390_TLS_IE64",
- "BFD_RELOC_390_TLS_IEENT",
- "BFD_RELOC_390_TLS_LE32",
- "BFD_RELOC_390_TLS_LE64",
- "BFD_RELOC_390_TLS_LDO32",
- "BFD_RELOC_390_TLS_LDO64",
- "BFD_RELOC_390_TLS_DTPMOD",
- "BFD_RELOC_390_TLS_DTPOFF",
- "BFD_RELOC_390_TLS_TPOFF",
- "BFD_RELOC_390_20",
- "BFD_RELOC_390_GOT20",
- "BFD_RELOC_390_GOTPLT20",
- "BFD_RELOC_390_TLS_GOTIE20",
- "BFD_RELOC_IP2K_FR9",
- "BFD_RELOC_IP2K_BANK",
- "BFD_RELOC_IP2K_ADDR16CJP",
- "BFD_RELOC_IP2K_PAGE3",
- "BFD_RELOC_IP2K_LO8DATA",
- "BFD_RELOC_IP2K_HI8DATA",
- "BFD_RELOC_IP2K_EX8DATA",
- "BFD_RELOC_IP2K_LO8INSN",
- "BFD_RELOC_IP2K_HI8INSN",
- "BFD_RELOC_IP2K_PC_SKIP",
- "BFD_RELOC_IP2K_TEXT",
- "BFD_RELOC_IP2K_FR_OFFSET",
- "BFD_RELOC_VPE4KMATH_DATA",
- "BFD_RELOC_VPE4KMATH_INSN",
- "BFD_RELOC_VTABLE_INHERIT",
- "BFD_RELOC_VTABLE_ENTRY",
- "BFD_RELOC_IA64_IMM14",
- "BFD_RELOC_IA64_IMM22",
- "BFD_RELOC_IA64_IMM64",
- "BFD_RELOC_IA64_DIR32MSB",
- "BFD_RELOC_IA64_DIR32LSB",
- "BFD_RELOC_IA64_DIR64MSB",
- "BFD_RELOC_IA64_DIR64LSB",
- "BFD_RELOC_IA64_GPREL22",
- "BFD_RELOC_IA64_GPREL64I",
- "BFD_RELOC_IA64_GPREL32MSB",
- "BFD_RELOC_IA64_GPREL32LSB",
- "BFD_RELOC_IA64_GPREL64MSB",
- "BFD_RELOC_IA64_GPREL64LSB",
- "BFD_RELOC_IA64_LTOFF22",
- "BFD_RELOC_IA64_LTOFF64I",
- "BFD_RELOC_IA64_PLTOFF22",
- "BFD_RELOC_IA64_PLTOFF64I",
- "BFD_RELOC_IA64_PLTOFF64MSB",
- "BFD_RELOC_IA64_PLTOFF64LSB",
- "BFD_RELOC_IA64_FPTR64I",
- "BFD_RELOC_IA64_FPTR32MSB",
- "BFD_RELOC_IA64_FPTR32LSB",
- "BFD_RELOC_IA64_FPTR64MSB",
- "BFD_RELOC_IA64_FPTR64LSB",
- "BFD_RELOC_IA64_PCREL21B",
- "BFD_RELOC_IA64_PCREL21BI",
- "BFD_RELOC_IA64_PCREL21M",
- "BFD_RELOC_IA64_PCREL21F",
- "BFD_RELOC_IA64_PCREL22",
- "BFD_RELOC_IA64_PCREL60B",
- "BFD_RELOC_IA64_PCREL64I",
- "BFD_RELOC_IA64_PCREL32MSB",
- "BFD_RELOC_IA64_PCREL32LSB",
- "BFD_RELOC_IA64_PCREL64MSB",
- "BFD_RELOC_IA64_PCREL64LSB",
- "BFD_RELOC_IA64_LTOFF_FPTR22",
- "BFD_RELOC_IA64_LTOFF_FPTR64I",
- "BFD_RELOC_IA64_LTOFF_FPTR32MSB",
- "BFD_RELOC_IA64_LTOFF_FPTR32LSB",
- "BFD_RELOC_IA64_LTOFF_FPTR64MSB",
- "BFD_RELOC_IA64_LTOFF_FPTR64LSB",
- "BFD_RELOC_IA64_SEGREL32MSB",
- "BFD_RELOC_IA64_SEGREL32LSB",
- "BFD_RELOC_IA64_SEGREL64MSB",
- "BFD_RELOC_IA64_SEGREL64LSB",
- "BFD_RELOC_IA64_SECREL32MSB",
- "BFD_RELOC_IA64_SECREL32LSB",
- "BFD_RELOC_IA64_SECREL64MSB",
- "BFD_RELOC_IA64_SECREL64LSB",
- "BFD_RELOC_IA64_REL32MSB",
- "BFD_RELOC_IA64_REL32LSB",
- "BFD_RELOC_IA64_REL64MSB",
- "BFD_RELOC_IA64_REL64LSB",
- "BFD_RELOC_IA64_LTV32MSB",
- "BFD_RELOC_IA64_LTV32LSB",
- "BFD_RELOC_IA64_LTV64MSB",
- "BFD_RELOC_IA64_LTV64LSB",
- "BFD_RELOC_IA64_IPLTMSB",
- "BFD_RELOC_IA64_IPLTLSB",
- "BFD_RELOC_IA64_COPY",
- "BFD_RELOC_IA64_LTOFF22X",
- "BFD_RELOC_IA64_LDXMOV",
- "BFD_RELOC_IA64_TPREL14",
- "BFD_RELOC_IA64_TPREL22",
- "BFD_RELOC_IA64_TPREL64I",
- "BFD_RELOC_IA64_TPREL64MSB",
- "BFD_RELOC_IA64_TPREL64LSB",
- "BFD_RELOC_IA64_LTOFF_TPREL22",
- "BFD_RELOC_IA64_DTPMOD64MSB",
- "BFD_RELOC_IA64_DTPMOD64LSB",
- "BFD_RELOC_IA64_LTOFF_DTPMOD22",
- "BFD_RELOC_IA64_DTPREL14",
- "BFD_RELOC_IA64_DTPREL22",
- "BFD_RELOC_IA64_DTPREL64I",
- "BFD_RELOC_IA64_DTPREL32MSB",
- "BFD_RELOC_IA64_DTPREL32LSB",
- "BFD_RELOC_IA64_DTPREL64MSB",
- "BFD_RELOC_IA64_DTPREL64LSB",
- "BFD_RELOC_IA64_LTOFF_DTPREL22",
- "BFD_RELOC_M68HC11_HI8",
- "BFD_RELOC_M68HC11_LO8",
- "BFD_RELOC_M68HC11_3B",
- "BFD_RELOC_M68HC11_RL_JUMP",
- "BFD_RELOC_M68HC11_RL_GROUP",
- "BFD_RELOC_M68HC11_LO16",
- "BFD_RELOC_M68HC11_PAGE",
- "BFD_RELOC_M68HC11_24",
- "BFD_RELOC_M68HC12_5B",
- "BFD_RELOC_CRIS_BDISP8",
- "BFD_RELOC_CRIS_UNSIGNED_5",
- "BFD_RELOC_CRIS_SIGNED_6",
- "BFD_RELOC_CRIS_UNSIGNED_6",
- "BFD_RELOC_CRIS_UNSIGNED_4",
- "BFD_RELOC_CRIS_COPY",
- "BFD_RELOC_CRIS_GLOB_DAT",
- "BFD_RELOC_CRIS_JUMP_SLOT",
- "BFD_RELOC_CRIS_RELATIVE",
- "BFD_RELOC_CRIS_32_GOT",
- "BFD_RELOC_CRIS_16_GOT",
- "BFD_RELOC_CRIS_32_GOTPLT",
- "BFD_RELOC_CRIS_16_GOTPLT",
- "BFD_RELOC_CRIS_32_GOTREL",
- "BFD_RELOC_CRIS_32_PLT_GOTREL",
- "BFD_RELOC_CRIS_32_PLT_PCREL",
- "BFD_RELOC_860_COPY",
- "BFD_RELOC_860_GLOB_DAT",
- "BFD_RELOC_860_JUMP_SLOT",
- "BFD_RELOC_860_RELATIVE",
- "BFD_RELOC_860_PC26",
- "BFD_RELOC_860_PLT26",
- "BFD_RELOC_860_PC16",
- "BFD_RELOC_860_LOW0",
- "BFD_RELOC_860_SPLIT0",
- "BFD_RELOC_860_LOW1",
- "BFD_RELOC_860_SPLIT1",
- "BFD_RELOC_860_LOW2",
- "BFD_RELOC_860_SPLIT2",
- "BFD_RELOC_860_LOW3",
- "BFD_RELOC_860_LOGOT0",
- "BFD_RELOC_860_SPGOT0",
- "BFD_RELOC_860_LOGOT1",
- "BFD_RELOC_860_SPGOT1",
- "BFD_RELOC_860_LOGOTOFF0",
- "BFD_RELOC_860_SPGOTOFF0",
- "BFD_RELOC_860_LOGOTOFF1",
- "BFD_RELOC_860_SPGOTOFF1",
- "BFD_RELOC_860_LOGOTOFF2",
- "BFD_RELOC_860_LOGOTOFF3",
- "BFD_RELOC_860_LOPC",
- "BFD_RELOC_860_HIGHADJ",
- "BFD_RELOC_860_HAGOT",
- "BFD_RELOC_860_HAGOTOFF",
- "BFD_RELOC_860_HAPC",
- "BFD_RELOC_860_HIGH",
- "BFD_RELOC_860_HIGOT",
- "BFD_RELOC_860_HIGOTOFF",
- "BFD_RELOC_OPENRISC_ABS_26",
- "BFD_RELOC_OPENRISC_REL_26",
- "BFD_RELOC_H8_DIR16A8",
- "BFD_RELOC_H8_DIR16R8",
- "BFD_RELOC_H8_DIR24A8",
- "BFD_RELOC_H8_DIR24R8",
- "BFD_RELOC_H8_DIR32A16",
- "BFD_RELOC_XSTORMY16_REL_12",
- "BFD_RELOC_XSTORMY16_12",
- "BFD_RELOC_XSTORMY16_24",
- "BFD_RELOC_XSTORMY16_FPTR16",
- "BFD_RELOC_VAX_GLOB_DAT",
- "BFD_RELOC_VAX_JMP_SLOT",
- "BFD_RELOC_VAX_RELATIVE",
- "BFD_RELOC_MSP430_10_PCREL",
- "BFD_RELOC_MSP430_16_PCREL",
- "BFD_RELOC_MSP430_16",
- "BFD_RELOC_MSP430_16_PCREL_BYTE",
- "BFD_RELOC_MSP430_16_BYTE",
- "BFD_RELOC_IQ2000_OFFSET_16",
- "BFD_RELOC_IQ2000_OFFSET_21",
- "BFD_RELOC_IQ2000_UHI16",
- "BFD_RELOC_XTENSA_RTLD",
- "BFD_RELOC_XTENSA_GLOB_DAT",
- "BFD_RELOC_XTENSA_JMP_SLOT",
- "BFD_RELOC_XTENSA_RELATIVE",
- "BFD_RELOC_XTENSA_PLT",
- "BFD_RELOC_XTENSA_OP0",
- "BFD_RELOC_XTENSA_OP1",
- "BFD_RELOC_XTENSA_OP2",
- "BFD_RELOC_XTENSA_ASM_EXPAND",
- "BFD_RELOC_XTENSA_ASM_SIMPLIFY",
- "@@overflow: BFD_RELOC_UNUSED@@",
-};
-#endif
-
-reloc_howto_type *bfd_default_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-
-bfd_boolean bfd_generic_relax_section
- (bfd *abfd,
- asection *section,
- struct bfd_link_info *,
- bfd_boolean *);
-
-bfd_boolean bfd_generic_gc_sections
- (bfd *, struct bfd_link_info *);
-
-bfd_boolean bfd_generic_merge_sections
- (bfd *, struct bfd_link_info *);
-
-bfd_byte *bfd_generic_get_relocated_section_contents
- (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols);
-
-/* Extracted from archures.c. */
-extern const bfd_arch_info_type bfd_default_arch_struct;
-bfd_boolean bfd_default_set_arch_mach
- (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
-
-const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-
-bfd_boolean bfd_default_scan
- (const struct bfd_arch_info *info, const char *string);
-
-/* Extracted from elf.c. */
-struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
-
diff --git a/contrib/binutils/bfd/libcoff-in.h b/contrib/binutils/bfd/libcoff-in.h
deleted file mode 100644
index 6b5947c..0000000
--- a/contrib/binutils/bfd/libcoff-in.h
+++ /dev/null
@@ -1,600 +0,0 @@
-/* BFD COFF object file private structure.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfdlink.h"
-
-/* Object file tdata; access macros */
-
-#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
-#define exec_hdr(bfd) (coff_data(bfd)->hdr)
-#define obj_pe(bfd) (coff_data(bfd)->pe)
-#define obj_symbols(bfd) (coff_data(bfd)->symbols)
-#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
-
-#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
-#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
-#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
-#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
-#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
-
-#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
-#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
-#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
-#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
-#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
-#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
-
-#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
-
-/* `Tdata' information kept for COFF files. */
-
-typedef struct coff_tdata
-{
- struct coff_symbol_struct *symbols; /* symtab for input bfd */
- unsigned int *conversion_table;
- int conv_table_size;
- file_ptr sym_filepos;
-
- struct coff_ptr_struct *raw_syments;
- unsigned long raw_syment_count;
-
- /* These are only valid once writing has begun */
- long int relocbase;
-
- /* These members communicate important constants about the symbol table
- to GDB's symbol-reading code. These `constants' unfortunately vary
- from coff implementation to implementation... */
- unsigned local_n_btmask;
- unsigned local_n_btshft;
- unsigned local_n_tmask;
- unsigned local_n_tshift;
- unsigned local_symesz;
- unsigned local_auxesz;
- unsigned local_linesz;
-
- /* The unswapped external symbols. May be NULL. Read by
- _bfd_coff_get_external_symbols. */
- PTR external_syms;
- /* If this is TRUE, the external_syms may not be freed. */
- bfd_boolean keep_syms;
-
- /* The string table. May be NULL. Read by
- _bfd_coff_read_string_table. */
- char *strings;
- /* If this is TRUE, the strings may not be freed. */
- bfd_boolean keep_strings;
- /* If this is TRUE, the strings have been written out already. */
- bfd_boolean strings_written;
-
- /* is this a PE format coff file */
- int pe;
- /* Used by the COFF backend linker. */
- struct coff_link_hash_entry **sym_hashes;
-
- /* used by the pe linker for PowerPC */
- int *local_toc_sym_map;
-
- struct bfd_link_info *link_info;
-
- /* Used by coff_find_nearest_line. */
- PTR line_info;
-
- /* A place to stash dwarf2 info for this bfd. */
- PTR dwarf2_find_line_info;
-
- /* The timestamp from the COFF file header. */
- long timestamp;
-
- /* Copy of some of the f_flags bits in the COFF filehdr structure,
- used by ARM code. */
- flagword flags;
-
-} coff_data_type;
-
-/* Tdata for pe image files. */
-typedef struct pe_tdata
-{
- coff_data_type coff;
- struct internal_extra_pe_aouthdr pe_opthdr;
- int dll;
- int has_reloc_section;
- bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
- flagword real_flags;
- int target_subsystem;
- bfd_boolean force_minimum_alignment;
-} pe_data_type;
-
-#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
-
-/* Tdata for XCOFF files. */
-
-struct xcoff_tdata
-{
- /* Basic COFF information. */
- coff_data_type coff;
-
- /* TRUE if this is an XCOFF64 file. */
- bfd_boolean xcoff64;
-
- /* TRUE if a large a.out header should be generated. */
- bfd_boolean full_aouthdr;
-
- /* TOC value. */
- bfd_vma toc;
-
- /* Index of section holding TOC. */
- int sntoc;
-
- /* Index of section holding entry point. */
- int snentry;
-
- /* .text alignment from optional header. */
- int text_align_power;
-
- /* .data alignment from optional header. */
- int data_align_power;
-
- /* modtype from optional header. */
- short modtype;
-
- /* cputype from optional header. */
- short cputype;
-
- /* maxdata from optional header. */
- bfd_vma maxdata;
-
- /* maxstack from optional header. */
- bfd_vma maxstack;
-
- /* Used by the XCOFF backend linker. */
- asection **csects;
- unsigned long *debug_indices;
- unsigned int import_file_id;
-};
-
-#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
-
-/* We take the address of the first element of an asymbol to ensure that the
- * macro is only ever applied to an asymbol. */
-#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
-
-/* The used_by_bfd field of a section may be set to a pointer to this
- structure. */
-
-struct coff_section_tdata
-{
- /* The relocs, swapped into COFF internal form. This may be NULL. */
- struct internal_reloc *relocs;
- /* If this is TRUE, the relocs entry may not be freed. */
- bfd_boolean keep_relocs;
- /* The section contents. This may be NULL. */
- bfd_byte *contents;
- /* If this is TRUE, the contents entry may not be freed. */
- bfd_boolean keep_contents;
- /* Information cached by coff_find_nearest_line. */
- bfd_vma offset;
- unsigned int i;
- const char *function;
- int line_base;
- /* A pointer used for .stab linking optimizations. */
- PTR stab_info;
- /* Available for individual backends. */
- PTR tdata;
-};
-
-/* An accessor macro for the coff_section_tdata structure. */
-#define coff_section_data(abfd, sec) \
- ((struct coff_section_tdata *) (sec)->used_by_bfd)
-
-/* Tdata for sections in XCOFF files. This is used by the linker. */
-
-struct xcoff_section_tdata
-{
- /* Used for XCOFF csects created by the linker; points to the real
- XCOFF section which contains this csect. */
- asection *enclosing;
- /* The lineno_count field for the enclosing section, because we are
- going to clobber it there. */
- unsigned int lineno_count;
- /* The first and one past the last symbol indices for symbols used
- by this csect. */
- unsigned long first_symndx;
- unsigned long last_symndx;
-};
-
-/* An accessor macro the xcoff_section_tdata structure. */
-#define xcoff_section_data(abfd, sec) \
- ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
-
-/* Tdata for sections in PE files. */
-
-struct pei_section_tdata
-{
- /* The virtual size of the section. */
- bfd_size_type virt_size;
- /* The PE section flags. */
- long pe_flags;
-};
-
-/* An accessor macro for the pei_section_tdata structure. */
-#define pei_section_data(abfd, sec) \
- ((struct pei_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
-
-/* COFF linker hash table entries. */
-
-struct coff_link_hash_entry
-{
- struct bfd_link_hash_entry root;
-
- /* Symbol index in output file. Set to -1 initially. Set to -2 if
- there is a reloc against this symbol. */
- long indx;
-
- /* Symbol type. */
- unsigned short type;
-
- /* Symbol class. */
- unsigned char class;
-
- /* Number of auxiliary entries. */
- char numaux;
-
- /* BFD to take auxiliary entries from. */
- bfd *auxbfd;
-
- /* Pointer to array of auxiliary entries, if any. */
- union internal_auxent *aux;
-
- /* Flag word; legal values follow. */
- unsigned short coff_link_hash_flags;
- /* Symbol is a PE section symbol. */
-#define COFF_LINK_HASH_PE_SECTION_SYMBOL (01)
-};
-
-/* COFF linker hash table. */
-
-struct coff_link_hash_table
-{
- struct bfd_link_hash_table root;
- /* A pointer to information used to link stabs in sections. */
- PTR stab_info;
-};
-
-/* Look up an entry in a COFF linker hash table. */
-
-#define coff_link_hash_lookup(table, string, create, copy, follow) \
- ((struct coff_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), \
- (copy), (follow)))
-
-/* Traverse a COFF linker hash table. */
-
-#define coff_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the COFF linker hash table from a link_info structure. */
-
-#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
-
-/* Functions in coffgen.c. */
-extern const bfd_target *coff_object_p
- PARAMS ((bfd *));
-extern struct bfd_section *coff_section_from_bfd_index
- PARAMS ((bfd *, int));
-extern long coff_get_symtab_upper_bound
- PARAMS ((bfd *));
-extern long coff_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
-extern int coff_count_linenumbers
- PARAMS ((bfd *));
-extern struct coff_symbol_struct *coff_symbol_from
- PARAMS ((bfd *, asymbol *));
-extern bfd_boolean coff_renumber_symbols
- PARAMS ((bfd *, int *));
-extern void coff_mangle_symbols
- PARAMS ((bfd *));
-extern bfd_boolean coff_write_symbols
- PARAMS ((bfd *));
-extern bfd_boolean coff_write_linenumbers
- PARAMS ((bfd *));
-extern alent *coff_get_lineno
- PARAMS ((bfd *, asymbol *));
-extern asymbol *coff_section_symbol
- PARAMS ((bfd *, char *));
-extern bfd_boolean _bfd_coff_get_external_symbols
- PARAMS ((bfd *));
-extern const char *_bfd_coff_read_string_table
- PARAMS ((bfd *));
-extern bfd_boolean _bfd_coff_free_symbols
- PARAMS ((bfd *));
-extern struct coff_ptr_struct *coff_get_normalized_symtab
- PARAMS ((bfd *));
-extern long coff_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
-extern asymbol *coff_make_empty_symbol
- PARAMS ((bfd *));
-extern void coff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
-extern void coff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *ret));
-extern bfd_boolean _bfd_coff_is_local_label_name
- PARAMS ((bfd *, const char *));
-extern asymbol *coff_bfd_make_debug_symbol
- PARAMS ((bfd *, PTR, unsigned long));
-extern bfd_boolean coff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-extern int coff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-extern bfd_boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
-extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, asymbol **));
-extern bfd_vma bfd_coff_reloc16_get_value
- PARAMS ((arelent *, struct bfd_link_info *, asection *));
-extern void bfd_perform_slip
- PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
-
-/* Functions and types in cofflink.c. */
-
-#define STRING_SIZE_SIZE (4)
-
-/* We use a hash table to merge identical enum, struct, and union
- definitions in the linker. */
-
-/* Information we keep for a single element (an enum value, a
- structure or union field) in the debug merge hash table. */
-
-struct coff_debug_merge_element
-{
- /* Next element. */
- struct coff_debug_merge_element *next;
-
- /* Name. */
- const char *name;
-
- /* Type. */
- unsigned int type;
-
- /* Symbol index for complex type. */
- long tagndx;
-};
-
-/* A linked list of debug merge entries for a given name. */
-
-struct coff_debug_merge_type
-{
- /* Next type with the same name. */
- struct coff_debug_merge_type *next;
-
- /* Class of type. */
- int class;
-
- /* Symbol index where this type is defined. */
- long indx;
-
- /* List of elements. */
- struct coff_debug_merge_element *elements;
-};
-
-/* Information we store in the debug merge hash table. */
-
-struct coff_debug_merge_hash_entry
-{
- struct bfd_hash_entry root;
-
- /* A list of types with this name. */
- struct coff_debug_merge_type *types;
-};
-
-/* The debug merge hash table. */
-
-struct coff_debug_merge_hash_table
-{
- struct bfd_hash_table root;
-};
-
-/* Initialize a COFF debug merge hash table. */
-
-#define coff_debug_merge_hash_table_init(table) \
- (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc))
-
-/* Free a COFF debug merge hash table. */
-
-#define coff_debug_merge_hash_table_free(table) \
- (bfd_hash_table_free (&(table)->root))
-
-/* Look up an entry in a COFF debug merge hash table. */
-
-#define coff_debug_merge_hash_lookup(table, string, create, copy) \
- ((struct coff_debug_merge_hash_entry *) \
- bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
-
-/* Information we keep for each section in the output file when doing
- a relocatable link. */
-
-struct coff_link_section_info
-{
- /* The relocs to be output. */
- struct internal_reloc *relocs;
- /* For each reloc against a global symbol whose index was not known
- when the reloc was handled, the global hash table entry. */
- struct coff_link_hash_entry **rel_hashes;
-};
-
-/* Information that we pass around while doing the final link step. */
-
-struct coff_final_link_info
-{
- /* General link information. */
- struct bfd_link_info *info;
- /* Output BFD. */
- bfd *output_bfd;
- /* Used to indicate failure in traversal routine. */
- bfd_boolean failed;
- /* If doing "task linking" set only during the time when we want the
- global symbol writer to convert the storage class of defined global
- symbols from global to static. */
- bfd_boolean global_to_static;
- /* Hash table for long symbol names. */
- struct bfd_strtab_hash *strtab;
- /* When doing a relocatable link, an array of information kept for
- each output section, indexed by the target_index field. */
- struct coff_link_section_info *section_info;
- /* Symbol index of last C_FILE symbol (-1 if none). */
- long last_file_index;
- /* Contents of last C_FILE symbol. */
- struct internal_syment last_file;
- /* Symbol index of first aux entry of last .bf symbol with an empty
- endndx field (-1 if none). */
- long last_bf_index;
- /* Contents of last_bf_index aux entry. */
- union internal_auxent last_bf;
- /* Hash table used to merge debug information. */
- struct coff_debug_merge_hash_table debug_merge;
- /* Buffer large enough to hold swapped symbols of any input file. */
- struct internal_syment *internal_syms;
- /* Buffer large enough to hold sections of symbols of any input file. */
- asection **sec_ptrs;
- /* Buffer large enough to hold output indices of symbols of any
- input file. */
- long *sym_indices;
- /* Buffer large enough to hold output symbols for any input file. */
- bfd_byte *outsyms;
- /* Buffer large enough to hold external line numbers for any input
- section. */
- bfd_byte *linenos;
- /* Buffer large enough to hold any input section. */
- bfd_byte *contents;
- /* Buffer large enough to hold external relocs of any input section. */
- bfd_byte *external_relocs;
- /* Buffer large enough to hold swapped relocs of any input section. */
- struct internal_reloc *internal_relocs;
-};
-
-/* Most COFF variants have no way to record the alignment of a
- section. This struct is used to set a specific alignment based on
- the name of the section. */
-
-struct coff_section_alignment_entry
-{
- /* The section name. */
- const char *name;
-
- /* This is either (unsigned int) -1, indicating that the section
- name must match exactly, or it is the number of letters which
- must match at the start of the name. */
- unsigned int comparison_length;
-
- /* These macros may be used to fill in the first two fields in a
- structure initialization. */
-#define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1)
-#define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1)
-
- /* Only use this entry if the default section alignment for this
- target is at least that much (as a power of two). If this field
- is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
- unsigned int default_alignment_min;
-
- /* Only use this entry if the default section alignment for this
- target is no greater than this (as a power of two). If this
- field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
- unsigned int default_alignment_max;
-
-#define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1)
-
- /* The desired alignment for this section (as a power of two). */
- unsigned int alignment_power;
-};
-
-extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern bfd_boolean _bfd_coff_link_hash_table_init
- PARAMS ((struct coff_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
-extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
- PARAMS ((bfd *));
-extern const char *_bfd_coff_internal_syment_name
- PARAMS ((bfd *, const struct internal_syment *, char *));
-extern bfd_boolean _bfd_coff_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-extern bfd_boolean _bfd_coff_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-extern struct internal_reloc *_bfd_coff_read_internal_relocs
- PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
- struct internal_reloc *));
-extern bfd_boolean _bfd_coff_generic_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern bfd_boolean _bfd_coff_write_global_sym
- PARAMS ((struct coff_link_hash_entry *, PTR));
-extern bfd_boolean _bfd_coff_write_task_globals
- PARAMS ((struct coff_link_hash_entry *, PTR));
-extern bfd_boolean _bfd_coff_link_input_bfd
- PARAMS ((struct coff_final_link_info *, bfd *));
-extern bfd_boolean _bfd_coff_reloc_link_order
- PARAMS ((bfd *, struct coff_final_link_info *, asection *,
- struct bfd_link_order *));
-
-
-#define coff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-/* Functions in xcofflink.c. */
-
-extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *));
-extern long _bfd_xcoff_canonicalize_dynamic_symtab
- PARAMS ((bfd *, asymbol **));
-extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *));
-extern long _bfd_xcoff_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
-extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
-extern void _bfd_xcoff_bfd_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
-extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-extern bfd_boolean _bfd_xcoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-extern bfd_boolean _bfd_ppc_xcoff_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
- linker, and so should start with bfd and be declared in bfd.h. */
-
-extern bfd_boolean ppc_allocate_toc_section
- PARAMS ((struct bfd_link_info *));
-extern bfd_boolean ppc_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *));
-
diff --git a/contrib/binutils/bfd/libcoff.h b/contrib/binutils/bfd/libcoff.h
deleted file mode 100644
index 5771132..0000000
--- a/contrib/binutils/bfd/libcoff.h
+++ /dev/null
@@ -1,933 +0,0 @@
-/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
- generated from "libcoff-in.h" and "coffcode.h".
- Run "make headers" in your build bfd/ to regenerate. */
-
-/* BFD COFF object file private structure.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfdlink.h"
-
-/* Object file tdata; access macros */
-
-#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
-#define exec_hdr(bfd) (coff_data(bfd)->hdr)
-#define obj_pe(bfd) (coff_data(bfd)->pe)
-#define obj_symbols(bfd) (coff_data(bfd)->symbols)
-#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
-
-#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
-#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
-#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
-#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
-#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
-
-#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
-#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
-#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
-#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
-#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
-#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
-
-#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
-
-/* `Tdata' information kept for COFF files. */
-
-typedef struct coff_tdata
-{
- struct coff_symbol_struct *symbols; /* symtab for input bfd */
- unsigned int *conversion_table;
- int conv_table_size;
- file_ptr sym_filepos;
-
- struct coff_ptr_struct *raw_syments;
- unsigned long raw_syment_count;
-
- /* These are only valid once writing has begun */
- long int relocbase;
-
- /* These members communicate important constants about the symbol table
- to GDB's symbol-reading code. These `constants' unfortunately vary
- from coff implementation to implementation... */
- unsigned local_n_btmask;
- unsigned local_n_btshft;
- unsigned local_n_tmask;
- unsigned local_n_tshift;
- unsigned local_symesz;
- unsigned local_auxesz;
- unsigned local_linesz;
-
- /* The unswapped external symbols. May be NULL. Read by
- _bfd_coff_get_external_symbols. */
- PTR external_syms;
- /* If this is TRUE, the external_syms may not be freed. */
- bfd_boolean keep_syms;
-
- /* The string table. May be NULL. Read by
- _bfd_coff_read_string_table. */
- char *strings;
- /* If this is TRUE, the strings may not be freed. */
- bfd_boolean keep_strings;
- /* If this is TRUE, the strings have been written out already. */
- bfd_boolean strings_written;
-
- /* is this a PE format coff file */
- int pe;
- /* Used by the COFF backend linker. */
- struct coff_link_hash_entry **sym_hashes;
-
- /* used by the pe linker for PowerPC */
- int *local_toc_sym_map;
-
- struct bfd_link_info *link_info;
-
- /* Used by coff_find_nearest_line. */
- PTR line_info;
-
- /* A place to stash dwarf2 info for this bfd. */
- PTR dwarf2_find_line_info;
-
- /* The timestamp from the COFF file header. */
- long timestamp;
-
- /* Copy of some of the f_flags bits in the COFF filehdr structure,
- used by ARM code. */
- flagword flags;
-
-} coff_data_type;
-
-/* Tdata for pe image files. */
-typedef struct pe_tdata
-{
- coff_data_type coff;
- struct internal_extra_pe_aouthdr pe_opthdr;
- int dll;
- int has_reloc_section;
- bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
- flagword real_flags;
- int target_subsystem;
- bfd_boolean force_minimum_alignment;
-} pe_data_type;
-
-#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
-
-/* Tdata for XCOFF files. */
-
-struct xcoff_tdata
-{
- /* Basic COFF information. */
- coff_data_type coff;
-
- /* TRUE if this is an XCOFF64 file. */
- bfd_boolean xcoff64;
-
- /* TRUE if a large a.out header should be generated. */
- bfd_boolean full_aouthdr;
-
- /* TOC value. */
- bfd_vma toc;
-
- /* Index of section holding TOC. */
- int sntoc;
-
- /* Index of section holding entry point. */
- int snentry;
-
- /* .text alignment from optional header. */
- int text_align_power;
-
- /* .data alignment from optional header. */
- int data_align_power;
-
- /* modtype from optional header. */
- short modtype;
-
- /* cputype from optional header. */
- short cputype;
-
- /* maxdata from optional header. */
- bfd_vma maxdata;
-
- /* maxstack from optional header. */
- bfd_vma maxstack;
-
- /* Used by the XCOFF backend linker. */
- asection **csects;
- unsigned long *debug_indices;
- unsigned int import_file_id;
-};
-
-#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
-
-/* We take the address of the first element of an asymbol to ensure that the
- * macro is only ever applied to an asymbol. */
-#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
-
-/* The used_by_bfd field of a section may be set to a pointer to this
- structure. */
-
-struct coff_section_tdata
-{
- /* The relocs, swapped into COFF internal form. This may be NULL. */
- struct internal_reloc *relocs;
- /* If this is TRUE, the relocs entry may not be freed. */
- bfd_boolean keep_relocs;
- /* The section contents. This may be NULL. */
- bfd_byte *contents;
- /* If this is TRUE, the contents entry may not be freed. */
- bfd_boolean keep_contents;
- /* Information cached by coff_find_nearest_line. */
- bfd_vma offset;
- unsigned int i;
- const char *function;
- int line_base;
- /* A pointer used for .stab linking optimizations. */
- PTR stab_info;
- /* Available for individual backends. */
- PTR tdata;
-};
-
-/* An accessor macro for the coff_section_tdata structure. */
-#define coff_section_data(abfd, sec) \
- ((struct coff_section_tdata *) (sec)->used_by_bfd)
-
-/* Tdata for sections in XCOFF files. This is used by the linker. */
-
-struct xcoff_section_tdata
-{
- /* Used for XCOFF csects created by the linker; points to the real
- XCOFF section which contains this csect. */
- asection *enclosing;
- /* The lineno_count field for the enclosing section, because we are
- going to clobber it there. */
- unsigned int lineno_count;
- /* The first and one past the last symbol indices for symbols used
- by this csect. */
- unsigned long first_symndx;
- unsigned long last_symndx;
-};
-
-/* An accessor macro the xcoff_section_tdata structure. */
-#define xcoff_section_data(abfd, sec) \
- ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
-
-/* Tdata for sections in PE files. */
-
-struct pei_section_tdata
-{
- /* The virtual size of the section. */
- bfd_size_type virt_size;
- /* The PE section flags. */
- long pe_flags;
-};
-
-/* An accessor macro for the pei_section_tdata structure. */
-#define pei_section_data(abfd, sec) \
- ((struct pei_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
-
-/* COFF linker hash table entries. */
-
-struct coff_link_hash_entry
-{
- struct bfd_link_hash_entry root;
-
- /* Symbol index in output file. Set to -1 initially. Set to -2 if
- there is a reloc against this symbol. */
- long indx;
-
- /* Symbol type. */
- unsigned short type;
-
- /* Symbol class. */
- unsigned char class;
-
- /* Number of auxiliary entries. */
- char numaux;
-
- /* BFD to take auxiliary entries from. */
- bfd *auxbfd;
-
- /* Pointer to array of auxiliary entries, if any. */
- union internal_auxent *aux;
-
- /* Flag word; legal values follow. */
- unsigned short coff_link_hash_flags;
- /* Symbol is a PE section symbol. */
-#define COFF_LINK_HASH_PE_SECTION_SYMBOL (01)
-};
-
-/* COFF linker hash table. */
-
-struct coff_link_hash_table
-{
- struct bfd_link_hash_table root;
- /* A pointer to information used to link stabs in sections. */
- PTR stab_info;
-};
-
-/* Look up an entry in a COFF linker hash table. */
-
-#define coff_link_hash_lookup(table, string, create, copy, follow) \
- ((struct coff_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), \
- (copy), (follow)))
-
-/* Traverse a COFF linker hash table. */
-
-#define coff_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the COFF linker hash table from a link_info structure. */
-
-#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
-
-/* Functions in coffgen.c. */
-extern const bfd_target *coff_object_p
- PARAMS ((bfd *));
-extern struct bfd_section *coff_section_from_bfd_index
- PARAMS ((bfd *, int));
-extern long coff_get_symtab_upper_bound
- PARAMS ((bfd *));
-extern long coff_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
-extern int coff_count_linenumbers
- PARAMS ((bfd *));
-extern struct coff_symbol_struct *coff_symbol_from
- PARAMS ((bfd *, asymbol *));
-extern bfd_boolean coff_renumber_symbols
- PARAMS ((bfd *, int *));
-extern void coff_mangle_symbols
- PARAMS ((bfd *));
-extern bfd_boolean coff_write_symbols
- PARAMS ((bfd *));
-extern bfd_boolean coff_write_linenumbers
- PARAMS ((bfd *));
-extern alent *coff_get_lineno
- PARAMS ((bfd *, asymbol *));
-extern asymbol *coff_section_symbol
- PARAMS ((bfd *, char *));
-extern bfd_boolean _bfd_coff_get_external_symbols
- PARAMS ((bfd *));
-extern const char *_bfd_coff_read_string_table
- PARAMS ((bfd *));
-extern bfd_boolean _bfd_coff_free_symbols
- PARAMS ((bfd *));
-extern struct coff_ptr_struct *coff_get_normalized_symtab
- PARAMS ((bfd *));
-extern long coff_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
-extern asymbol *coff_make_empty_symbol
- PARAMS ((bfd *));
-extern void coff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
-extern void coff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *ret));
-extern bfd_boolean _bfd_coff_is_local_label_name
- PARAMS ((bfd *, const char *));
-extern asymbol *coff_bfd_make_debug_symbol
- PARAMS ((bfd *, PTR, unsigned long));
-extern bfd_boolean coff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-extern int coff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-extern bfd_boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
-extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, asymbol **));
-extern bfd_vma bfd_coff_reloc16_get_value
- PARAMS ((arelent *, struct bfd_link_info *, asection *));
-extern void bfd_perform_slip
- PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
-
-/* Functions and types in cofflink.c. */
-
-#define STRING_SIZE_SIZE (4)
-
-/* We use a hash table to merge identical enum, struct, and union
- definitions in the linker. */
-
-/* Information we keep for a single element (an enum value, a
- structure or union field) in the debug merge hash table. */
-
-struct coff_debug_merge_element
-{
- /* Next element. */
- struct coff_debug_merge_element *next;
-
- /* Name. */
- const char *name;
-
- /* Type. */
- unsigned int type;
-
- /* Symbol index for complex type. */
- long tagndx;
-};
-
-/* A linked list of debug merge entries for a given name. */
-
-struct coff_debug_merge_type
-{
- /* Next type with the same name. */
- struct coff_debug_merge_type *next;
-
- /* Class of type. */
- int class;
-
- /* Symbol index where this type is defined. */
- long indx;
-
- /* List of elements. */
- struct coff_debug_merge_element *elements;
-};
-
-/* Information we store in the debug merge hash table. */
-
-struct coff_debug_merge_hash_entry
-{
- struct bfd_hash_entry root;
-
- /* A list of types with this name. */
- struct coff_debug_merge_type *types;
-};
-
-/* The debug merge hash table. */
-
-struct coff_debug_merge_hash_table
-{
- struct bfd_hash_table root;
-};
-
-/* Initialize a COFF debug merge hash table. */
-
-#define coff_debug_merge_hash_table_init(table) \
- (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc))
-
-/* Free a COFF debug merge hash table. */
-
-#define coff_debug_merge_hash_table_free(table) \
- (bfd_hash_table_free (&(table)->root))
-
-/* Look up an entry in a COFF debug merge hash table. */
-
-#define coff_debug_merge_hash_lookup(table, string, create, copy) \
- ((struct coff_debug_merge_hash_entry *) \
- bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
-
-/* Information we keep for each section in the output file when doing
- a relocatable link. */
-
-struct coff_link_section_info
-{
- /* The relocs to be output. */
- struct internal_reloc *relocs;
- /* For each reloc against a global symbol whose index was not known
- when the reloc was handled, the global hash table entry. */
- struct coff_link_hash_entry **rel_hashes;
-};
-
-/* Information that we pass around while doing the final link step. */
-
-struct coff_final_link_info
-{
- /* General link information. */
- struct bfd_link_info *info;
- /* Output BFD. */
- bfd *output_bfd;
- /* Used to indicate failure in traversal routine. */
- bfd_boolean failed;
- /* If doing "task linking" set only during the time when we want the
- global symbol writer to convert the storage class of defined global
- symbols from global to static. */
- bfd_boolean global_to_static;
- /* Hash table for long symbol names. */
- struct bfd_strtab_hash *strtab;
- /* When doing a relocatable link, an array of information kept for
- each output section, indexed by the target_index field. */
- struct coff_link_section_info *section_info;
- /* Symbol index of last C_FILE symbol (-1 if none). */
- long last_file_index;
- /* Contents of last C_FILE symbol. */
- struct internal_syment last_file;
- /* Symbol index of first aux entry of last .bf symbol with an empty
- endndx field (-1 if none). */
- long last_bf_index;
- /* Contents of last_bf_index aux entry. */
- union internal_auxent last_bf;
- /* Hash table used to merge debug information. */
- struct coff_debug_merge_hash_table debug_merge;
- /* Buffer large enough to hold swapped symbols of any input file. */
- struct internal_syment *internal_syms;
- /* Buffer large enough to hold sections of symbols of any input file. */
- asection **sec_ptrs;
- /* Buffer large enough to hold output indices of symbols of any
- input file. */
- long *sym_indices;
- /* Buffer large enough to hold output symbols for any input file. */
- bfd_byte *outsyms;
- /* Buffer large enough to hold external line numbers for any input
- section. */
- bfd_byte *linenos;
- /* Buffer large enough to hold any input section. */
- bfd_byte *contents;
- /* Buffer large enough to hold external relocs of any input section. */
- bfd_byte *external_relocs;
- /* Buffer large enough to hold swapped relocs of any input section. */
- struct internal_reloc *internal_relocs;
-};
-
-/* Most COFF variants have no way to record the alignment of a
- section. This struct is used to set a specific alignment based on
- the name of the section. */
-
-struct coff_section_alignment_entry
-{
- /* The section name. */
- const char *name;
-
- /* This is either (unsigned int) -1, indicating that the section
- name must match exactly, or it is the number of letters which
- must match at the start of the name. */
- unsigned int comparison_length;
-
- /* These macros may be used to fill in the first two fields in a
- structure initialization. */
-#define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1)
-#define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1)
-
- /* Only use this entry if the default section alignment for this
- target is at least that much (as a power of two). If this field
- is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
- unsigned int default_alignment_min;
-
- /* Only use this entry if the default section alignment for this
- target is no greater than this (as a power of two). If this
- field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
- unsigned int default_alignment_max;
-
-#define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1)
-
- /* The desired alignment for this section (as a power of two). */
- unsigned int alignment_power;
-};
-
-extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern bfd_boolean _bfd_coff_link_hash_table_init
- PARAMS ((struct coff_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
-extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
- PARAMS ((bfd *));
-extern const char *_bfd_coff_internal_syment_name
- PARAMS ((bfd *, const struct internal_syment *, char *));
-extern bfd_boolean _bfd_coff_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-extern bfd_boolean _bfd_coff_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-extern struct internal_reloc *_bfd_coff_read_internal_relocs
- PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
- struct internal_reloc *));
-extern bfd_boolean _bfd_coff_generic_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern bfd_boolean _bfd_coff_write_global_sym
- PARAMS ((struct coff_link_hash_entry *, PTR));
-extern bfd_boolean _bfd_coff_write_task_globals
- PARAMS ((struct coff_link_hash_entry *, PTR));
-extern bfd_boolean _bfd_coff_link_input_bfd
- PARAMS ((struct coff_final_link_info *, bfd *));
-extern bfd_boolean _bfd_coff_reloc_link_order
- PARAMS ((bfd *, struct coff_final_link_info *, asection *,
- struct bfd_link_order *));
-
-
-#define coff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-/* Functions in xcofflink.c. */
-
-extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *));
-extern long _bfd_xcoff_canonicalize_dynamic_symtab
- PARAMS ((bfd *, asymbol **));
-extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *));
-extern long _bfd_xcoff_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
-extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
-extern void _bfd_xcoff_bfd_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
-extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-extern bfd_boolean _bfd_xcoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-extern bfd_boolean _bfd_ppc_xcoff_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
- linker, and so should start with bfd and be declared in bfd.h. */
-
-extern bfd_boolean ppc_allocate_toc_section
- PARAMS ((struct bfd_link_info *));
-extern bfd_boolean ppc_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *));
-
-/* Extracted from coffcode.h. */
-typedef struct coff_ptr_struct
-{
- /* Remembers the offset from the first symbol in the file for
- this symbol. Generated by coff_renumber_symbols. */
- unsigned int offset;
-
- /* Should the value of this symbol be renumbered. Used for
- XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
- unsigned int fix_value : 1;
-
- /* Should the tag field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_tag : 1;
-
- /* Should the endidx field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_end : 1;
-
- /* Should the x_csect.x_scnlen field be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_scnlen : 1;
-
- /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
- index into the line number entries. Set by coff_slurp_symbol_table. */
- unsigned int fix_line : 1;
-
- /* The container for the symbol structure as read and translated
- from the file. */
- union
- {
- union internal_auxent auxent;
- struct internal_syment syment;
- } u;
-} combined_entry_type;
-
-
-/* Each canonical asymbol really looks like this: */
-
-typedef struct coff_symbol_struct
-{
- /* The actual symbol which the rest of BFD works with */
- asymbol symbol;
-
- /* A pointer to the hidden information for this symbol */
- combined_entry_type *native;
-
- /* A pointer to the linenumber information for this symbol */
- struct lineno_cache_entry *lineno;
-
- /* Have the line numbers been relocated yet ? */
- bfd_boolean done_lineno;
-} coff_symbol_type;
-/* COFF symbol classifications. */
-
-enum coff_symbol_classification
-{
- /* Global symbol. */
- COFF_SYMBOL_GLOBAL,
- /* Common symbol. */
- COFF_SYMBOL_COMMON,
- /* Undefined symbol. */
- COFF_SYMBOL_UNDEFINED,
- /* Local symbol. */
- COFF_SYMBOL_LOCAL,
- /* PE section symbol. */
- COFF_SYMBOL_PE_SECTION
-};
-
-typedef struct
-{
- void (*_bfd_coff_swap_aux_in)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-
- void (*_bfd_coff_swap_sym_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_lineno_in)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_aux_out)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-
- unsigned int (*_bfd_coff_swap_sym_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_lineno_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_reloc_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_filehdr_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_aouthdr_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int (*_bfd_coff_swap_scnhdr_out)
- PARAMS ((bfd *, PTR, PTR));
-
- unsigned int _bfd_filhsz;
- unsigned int _bfd_aoutsz;
- unsigned int _bfd_scnhsz;
- unsigned int _bfd_symesz;
- unsigned int _bfd_auxesz;
- unsigned int _bfd_relsz;
- unsigned int _bfd_linesz;
- unsigned int _bfd_filnmlen;
- bfd_boolean _bfd_coff_long_filenames;
- bfd_boolean _bfd_coff_long_section_names;
- unsigned int _bfd_coff_default_section_alignment_power;
- bfd_boolean _bfd_coff_force_symnames_in_strings;
- unsigned int _bfd_coff_debug_string_prefix_length;
-
- void (*_bfd_coff_swap_filehdr_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_aouthdr_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_scnhdr_in)
- PARAMS ((bfd *, PTR, PTR));
-
- void (*_bfd_coff_swap_reloc_in)
- PARAMS ((bfd *abfd, PTR, PTR));
-
- bfd_boolean (*_bfd_coff_bad_format_hook)
- PARAMS ((bfd *, PTR));
-
- bfd_boolean (*_bfd_coff_set_arch_mach_hook)
- PARAMS ((bfd *, PTR));
-
- PTR (*_bfd_coff_mkobject_hook)
- PARAMS ((bfd *, PTR, PTR));
-
- bfd_boolean (*_bfd_styp_to_sec_flags_hook)
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-
- void (*_bfd_set_alignment_hook)
- PARAMS ((bfd *, asection *, PTR));
-
- bfd_boolean (*_bfd_coff_slurp_symbol_table)
- PARAMS ((bfd *));
-
- bfd_boolean (*_bfd_coff_symname_in_debug)
- PARAMS ((bfd *, struct internal_syment *));
-
- bfd_boolean (*_bfd_coff_pointerize_aux_hook)
- PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *));
-
- bfd_boolean (*_bfd_coff_print_aux)
- PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
- combined_entry_type *, unsigned int));
-
- void (*_bfd_coff_reloc16_extra_cases)
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
- bfd_byte *, unsigned int *, unsigned int *));
-
- int (*_bfd_coff_reloc16_estimate)
- PARAMS ((bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *));
-
- enum coff_symbol_classification (*_bfd_coff_classify_symbol)
- PARAMS ((bfd *, struct internal_syment *));
-
- bfd_boolean (*_bfd_coff_compute_section_file_positions)
- PARAMS ((bfd *));
-
- bfd_boolean (*_bfd_coff_start_final_link)
- PARAMS ((bfd *, struct bfd_link_info *));
-
- bfd_boolean (*_bfd_coff_relocate_section)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
- reloc_howto_type *(*_bfd_coff_rtype_to_howto)
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-
- bfd_boolean (*_bfd_coff_adjust_symndx)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, bfd_boolean *));
-
- bfd_boolean (*_bfd_coff_link_add_one_symbol)
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
-
- bfd_boolean (*_bfd_coff_link_output_has_begun)
- PARAMS ((bfd *, struct coff_final_link_info *));
-
- bfd_boolean (*_bfd_coff_final_link_postscript)
- PARAMS ((bfd *, struct coff_final_link_info *));
-
-} bfd_coff_backend_data;
-
-#define coff_backend_info(abfd) \
- ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
-
-#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
-
-#define bfd_coff_swap_sym_in(a,e,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
-
-#define bfd_coff_swap_lineno_in(a,e,i) \
- ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
-
-#define bfd_coff_swap_reloc_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
-
-#define bfd_coff_swap_lineno_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
-
-#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
-
-#define bfd_coff_swap_sym_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_filehdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
-
-#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
-#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
-#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
-#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
-#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
-#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
-#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
-#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
-#define bfd_coff_long_filenames(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_filenames)
-#define bfd_coff_long_section_names(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_section_names)
-#define bfd_coff_default_section_alignment_power(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
-#define bfd_coff_swap_filehdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_reloc_in(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
-
-#define bfd_coff_bad_format_hook(abfd, filehdr) \
- ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
-
-#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
- ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
-#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
- ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\
- (abfd, filehdr, aouthdr))
-
-#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
- ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
- (abfd, scnhdr, name, section, flags_ptr))
-
-#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
- ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
-
-#define bfd_coff_slurp_symbol_table(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
-
-#define bfd_coff_symname_in_debug(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
-
-#define bfd_coff_force_symnames_in_strings(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
-
-#define bfd_coff_debug_string_prefix_length(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
-
-#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
- ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
- (abfd, file, base, symbol, aux, indaux))
-
-#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
- reloc, data, src_ptr, dst_ptr)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
- (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
-
-#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
- (abfd, section, reloc, shrink, link_info))
-
-#define bfd_coff_classify_symbol(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
- (abfd, sym))
-
-#define bfd_coff_compute_section_file_positions(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
- (abfd))
-
-#define bfd_coff_start_final_link(obfd, info)\
- ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
- (obfd, info))
-#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
- ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
- (obfd, info, ibfd, o, con, rel, isyms, secs))
-#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
- ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
- (abfd, sec, rel, h, sym, addendp))
-#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
- ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
- (obfd, info, ibfd, sec, rel, adjustedp))
-#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
- value, string, cp, coll, hashp)\
- ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
- (info, abfd, name, flags, section, value, string, cp, coll, hashp))
-
-#define bfd_coff_link_output_has_begun(a,p) \
- ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
-#define bfd_coff_final_link_postscript(a,p) \
- ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
-
diff --git a/contrib/binutils/bfd/libecoff.h b/contrib/binutils/bfd/libecoff.h
deleted file mode 100644
index 161f06c..0000000
--- a/contrib/binutils/bfd/libecoff.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/* BFD ECOFF object file private structure.
- Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfdlink.h"
-
-#ifndef ECOFF_H
-#include "coff/ecoff.h"
-#endif
-
-/* This is the backend information kept for ECOFF files. This
- structure is constant for a particular backend. The first element
- is the COFF backend data structure, so that ECOFF targets can use
- the generic COFF code. */
-
-#define ecoff_backend(abfd) \
- ((struct ecoff_backend_data *) (abfd)->xvec->backend_data)
-
-struct ecoff_backend_data
-{
- /* COFF backend information. This must be the first field. */
- bfd_coff_backend_data coff;
- /* Supported architecture. */
- enum bfd_architecture arch;
- /* Initial portion of armap string. */
- const char *armap_start;
- /* The page boundary used to align sections in a demand-paged
- executable file. E.g., 0x1000. */
- bfd_vma round;
- /* TRUE if the .rdata section is part of the text segment, as on the
- Alpha. FALSE if .rdata is part of the data segment, as on the
- MIPS. */
- bfd_boolean rdata_in_text;
- /* Bitsize of constructor entries. */
- unsigned int constructor_bitsize;
- /* Reloc to use for constructor entries. */
- reloc_howto_type *constructor_reloc;
- /* How to swap debugging information. */
- struct ecoff_debug_swap debug_swap;
- /* External reloc size. */
- bfd_size_type external_reloc_size;
- /* Reloc swapping functions. */
- void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *));
- void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR));
- /* Backend reloc tweaking. */
- void (*adjust_reloc_in)
- PARAMS ((bfd *, const struct internal_reloc *, arelent *));
- void (*adjust_reloc_out)
- PARAMS ((bfd *, const arelent *, struct internal_reloc *));
- /* Relocate section contents while linking. */
- bfd_boolean (*relocate_section)
- PARAMS ((bfd *output_bfd, struct bfd_link_info *, bfd *input_bfd,
- asection *input_section, bfd_byte *contents,
- PTR external_relocs));
- /* Do final adjustments to filehdr and aouthdr. */
- bfd_boolean (*adjust_headers)
- PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));
- /* Read an element from an archive at a given file position. This
- is needed because OSF/1 3.2 uses a weird archive format. */
- bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr));
-};
-
-/* This is the target specific information kept for ECOFF files. */
-
-#define ecoff_data(abfd) ((abfd)->tdata.ecoff_obj_data)
-
-typedef struct ecoff_tdata
-{
- /* The reloc file position, set by
- ecoff_compute_section_file_positions. */
- file_ptr reloc_filepos;
-
- /* The symbol table file position, set by _bfd_ecoff_mkobject_hook. */
- file_ptr sym_filepos;
-
- /* The start and end of the text segment. Only valid for an
- existing file, not for one we are creating. */
- unsigned long text_start;
- unsigned long text_end;
-
- /* The cached gp value. This is used when relocating. */
- bfd_vma gp;
-
- /* The maximum size of objects to optimize using gp. This is
- typically set by the -G option to the compiler, assembler or
- linker. */
- unsigned int gp_size;
-
- /* The register masks. When linking, all the masks found in the
- input files are combined into the masks of the output file.
- These are not all used for all targets, but that's OK, because
- the relevant ones are the only ones swapped in and out. */
- unsigned long gprmask;
- unsigned long fprmask;
- unsigned long cprmask[4];
-
- /* The ECOFF symbolic debugging information. */
- struct ecoff_debug_info debug_info;
-
- /* The unswapped ECOFF symbolic information. */
- PTR raw_syments;
-
- /* The canonical BFD symbols. */
- struct ecoff_symbol_struct *canonical_symbols;
-
- /* A mapping from external symbol numbers to entries in the linker
- hash table, used when linking. */
- struct ecoff_link_hash_entry **sym_hashes;
-
- /* A mapping from reloc symbol indices to sections, used when
- linking. */
- asection **symndx_to_section;
-
- /* TRUE if this BFD was written by the backend linker. */
- bfd_boolean linker;
-
- /* TRUE if a warning that multiple global pointer values are
- needed in the output binary was issued already. */
- bfd_boolean issued_multiple_gp_warning;
-
- /* Used by find_nearest_line entry point. The structure could be
- included directly in this one, but there's no point to wasting
- the memory just for the infrequently called find_nearest_line. */
- struct ecoff_find_line *find_line_info;
-
- /* Whether the .rdata section is in the text segment for this
- particular ECOFF file. This is not valid until
- ecoff_compute_section_file_positions is called. */
- bfd_boolean rdata_in_text;
-
-} ecoff_data_type;
-
-/* Each canonical asymbol really looks like this. */
-
-typedef struct ecoff_symbol_struct
-{
- /* The actual symbol which the rest of BFD works with */
- asymbol symbol;
-
- /* The fdr for this symbol. */
- FDR *fdr;
-
- /* TRUE if this is a local symbol rather than an external one. */
- bfd_boolean local;
-
- /* A pointer to the unswapped hidden information for this symbol.
- This is either a struct sym_ext or a struct ext_ext, depending on
- the value of the local field above. */
- PTR native;
-} ecoff_symbol_type;
-
-/* We take the address of the first element of an asymbol to ensure that the
- macro is only ever applied to an asymbol. */
-#define ecoffsymbol(asymbol) ((ecoff_symbol_type *) (&((asymbol)->the_bfd)))
-
-/* We need to save the index of an external symbol when we write it
- out so that can set the symbol index correctly when we write out
- the relocs. */
-#define ecoff_get_sym_index(symbol) ((symbol)->udata.i)
-#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx))
-
-/* When generating MIPS embedded PIC code, the linker relaxes the code
- to turn PC relative branches into longer code sequences when the PC
- relative branch is out of range. This involves reading the relocs
- in bfd_relax_section as well as in bfd_final_link, and requires the
- code to keep track of which relocs have been expanded. A pointer
- to this structure is put in the used_by_bfd pointer of a section to
- keep track of this information. The user_by_bfd pointer will be
- NULL if the information was not needed. */
-
-struct ecoff_section_tdata
-{
- /* The unswapped relocs for this section. These are stored in
- memory so the input file does not have to be read twice. */
- PTR external_relocs;
-
- /* The contents of the section. These bytes may or may not be saved
- in memory, but if it is this is a pointer to them. */
- bfd_byte *contents;
-
- /* Offset adjustments for PC relative branches. A number other than
- 1 is an addend for a PC relative branch, or a switch table entry
- which is the difference of two .text locations; this addend
- arises because the branch or difference crosses one or more
- branches which were expanded into a larger code sequence. A 1
- means that this branch was itself expanded into a larger code
- sequence. 1 is not a possible offset, since all offsets must be
- multiples of the instruction size, which is 4; also, the only
- relocs with non-zero offsets will be PC relative branches or
- switch table entries within the same object file. If this field
- is NULL, no branches were expanded and no offsets are required.
- Otherwise there are as many entries as there are relocs in the
- section, and the entry for any reloc that is not PC relative is
- zero. */
- long *offsets;
-
- /* When producing an executable (i.e., final, non-relocatable link)
- on the Alpha, we may need to use multiple global pointer values
- to span the entire .lita section. In essence, we allow each
- input .lita section to have its own gp value. To support this,
- we need to keep track of the gp values that we picked for each
- input .lita section . */
- bfd_vma gp;
-};
-
-/* An accessor macro for the ecoff_section_tdata structure. */
-#define ecoff_section_data(abfd, sec) \
- ((struct ecoff_section_tdata *) (sec)->used_by_bfd)
-
-/* ECOFF linker hash table entries. */
-
-struct ecoff_link_hash_entry
-{
- struct bfd_link_hash_entry root;
- /* Symbol index in output file. */
- long indx;
- /* BFD that ext field value came from. */
- bfd *abfd;
- /* ECOFF external symbol information. */
- EXTR esym;
- /* Nonzero if this symbol has been written out. */
- char written;
- /* Nonzero if this symbol was referred to as small undefined. */
- char small;
-};
-
-/* ECOFF linker hash table. */
-
-struct ecoff_link_hash_table
-{
- struct bfd_link_hash_table root;
-};
-
-/* Make an ECOFF object. */
-extern bfd_boolean _bfd_ecoff_mkobject PARAMS ((bfd *));
-
-/* Read in the ECOFF symbolic debugging information. */
-extern bfd_boolean _bfd_ecoff_slurp_symbolic_info
- PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
-
-/* Generic ECOFF BFD backend vectors. */
-
-extern bfd_boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd));
-extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd));
-
-#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup
-#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-extern bfd_boolean _bfd_ecoff_new_section_hook
- PARAMS ((bfd *, asection *));
-extern bfd_boolean _bfd_ecoff_get_section_contents
- PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
-
-#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section
-
-extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
-#define _bfd_ecoff_bfd_copy_private_section_data \
- _bfd_generic_bfd_copy_private_section_data
-
-#define _bfd_ecoff_bfd_copy_private_symbol_data \
- _bfd_generic_bfd_copy_private_symbol_data
-
-#define _bfd_ecoff_bfd_print_private_bfd_data \
- _bfd_generic_bfd_print_private_bfd_data
-
-#define _bfd_ecoff_bfd_merge_private_bfd_data \
- _bfd_generic_bfd_merge_private_bfd_data
-
-#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
-extern bfd_boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd));
-#define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table
-#define _bfd_ecoff_construct_extended_name_table \
- _bfd_archive_bsd_construct_extended_name_table
-#define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname
-extern bfd_boolean _bfd_ecoff_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr
-#define _bfd_ecoff_openr_next_archived_file \
- bfd_generic_openr_next_archived_file
-#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index
-#define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt
-#define _bfd_ecoff_update_armap_timestamp bfd_true
-
-extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
-extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation));
-extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd));
-extern void _bfd_ecoff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
-extern void _bfd_ecoff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *));
-extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name
- PARAMS ((bfd *, const char *));
-#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno
-extern bfd_boolean _bfd_ecoff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset,
- const char **filename_ptr, const char **fnname_ptr,
- unsigned int *retline_ptr));
-#define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols
-#define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define _bfd_ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound
-extern long _bfd_ecoff_canonicalize_reloc
- PARAMS ((bfd *, asection *, arelent **, asymbol **symbols));
-/* ecoff_bfd_reloc_type_lookup defined by backend. */
-
-extern bfd_boolean _bfd_ecoff_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-extern bfd_boolean _bfd_ecoff_set_section_contents
- PARAMS ((bfd *, asection *, const PTR location, file_ptr, bfd_size_type));
-
-extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc));
-/* ecoff_bfd_get_relocated_section_contents defined by backend. */
-/* ecoff_bfd_relax_section defined by backend. */
-extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
-#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms
-extern bfd_boolean _bfd_ecoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-
-/* Hook functions for the generic COFF section reading code. */
-
-extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
-#define _bfd_ecoff_set_alignment_hook \
- ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
-extern bfd_boolean _bfd_ecoff_set_arch_mach_hook
- PARAMS ((bfd *abfd, PTR filehdr));
-extern bfd_boolean _bfd_ecoff_styp_to_sec_flags
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-extern bfd_boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
-
-/* ECOFF auxiliary information swapping routines. These are the same
- for all ECOFF targets, so they are defined in ecofflink.c. */
-
-extern void _bfd_ecoff_swap_tir_in
- PARAMS ((int, const struct tir_ext *, TIR *));
-extern void _bfd_ecoff_swap_tir_out
- PARAMS ((int, const TIR *, struct tir_ext *));
-extern void _bfd_ecoff_swap_rndx_in
- PARAMS ((int, const struct rndx_ext *, RNDXR *));
-extern void _bfd_ecoff_swap_rndx_out
- PARAMS ((int, const RNDXR *, struct rndx_ext *));
diff --git a/contrib/binutils/bfd/libieee.h b/contrib/binutils/bfd/libieee.h
deleted file mode 100644
index 56c7ce1..0000000
--- a/contrib/binutils/bfd/libieee.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* IEEE-695 object file formats: definitions internal to BFD.
- Copyright 1990, 1991, 1992, 1994, 1996, 2001, 2002
- Free Software Foundation, Inc.
- Written by Cygnus Support. Mostly Steve Chamberlain's fault.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-typedef struct {
- unsigned int index:24;
- char letter;
-} ieee_symbol_index_type;
-
-typedef struct ct {
- bfd *this;
- struct ct *next;
-} bfd_chain_type;
-
-typedef struct ieee_symbol
-{
- asymbol symbol;
- struct ieee_symbol *next;
-
- unsigned int index;
-} ieee_symbol_type;
-
-
-typedef struct ieee_reloc {
- arelent relent;
- struct ieee_reloc *next;
- ieee_symbol_index_type symbol;
-
-} ieee_reloc_type;
-
-#define ieee_symbol(x) ((ieee_symbol_type *)(x))
-
-typedef struct ieee_per_section
-{
- asection *section;
- bfd_byte *data;
- bfd_vma offset;
- bfd_vma pc;
- /* For output */
- file_ptr current_pos;
- unsigned int current_byte;
- bfd_boolean initialized;
- ieee_reloc_type **reloc_tail_ptr;
-} ieee_per_section_type;
-
-#define ieee_per_section(x) ((ieee_per_section_type *)((x)->used_by_bfd))
-
-typedef struct {
- unsigned char *input_p;
- unsigned char *first_byte;
- unsigned char *last_byte;
- bfd *abfd;
-} common_header_type ;
-
-typedef struct ieee_data_struct
-{
- common_header_type h;
- bfd_boolean read_symbols;
- bfd_boolean read_data;
- file_ptr output_cursor;
- /* Map of section indexes to section ptrs */
- asection **section_table;
- unsigned int section_table_size;
- ieee_address_descriptor_type ad;
- ieee_module_begin_type mb;
- ieee_w_variable_type w;
-
- unsigned int section_count;
-
- unsigned int map_idx;
- /* List of GLOBAL EXPORT symbols */
- ieee_symbol_type *external_symbols;
- /* List of UNDEFINED symbols */
- ieee_symbol_type *external_reference;
-
- /* When the symbols have been canonicalized, they are in a
- * special order, we remember various bases here.. */
- unsigned int external_symbol_max_index;
- unsigned int external_symbol_min_index;
- unsigned int external_symbol_count;
- int external_symbol_base_offset;
-
- unsigned int external_reference_max_index;
- unsigned int external_reference_min_index;
- unsigned int external_reference_count;
- int external_reference_base_offset;
-
-
- bfd_boolean symbol_table_full;
-
-
-bfd_boolean done_debug;
-
-
-bfd_chain_type *chain_head;
-bfd_chain_type *chain_root;
-
-} ieee_data_type;
-
-typedef struct {
- file_ptr file_offset;
- bfd *abfd;
-} ieee_ar_obstack_type;
-
-typedef struct ieee_ar_data_struct
-{
- common_header_type h;
- ieee_ar_obstack_type *elements;
-
- unsigned int element_index ;
- unsigned int element_count;
-
-} ieee_ar_data_type;
-
-#define IEEE_DATA(abfd) ((abfd)->tdata.ieee_data)
-#define IEEE_AR_DATA(abfd) ((abfd)->tdata.ieee_ar_data)
-
-#define ptr(abfd) (ieee_data(abfd)->input_p)
diff --git a/contrib/binutils/bfd/libpei.h b/contrib/binutils/bfd/libpei.h
deleted file mode 100644
index 9ed9c12..0000000
--- a/contrib/binutils/bfd/libpei.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Solutions.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Most of this hacked by Steve Chamberlain,
- sac@cygnus.com
-
- PE/PEI rearrangement (and code added): Donn Terry
- Softway Systems, Inc. */
-
-/* Hey look, some documentation [and in a place you expect to find it]!
-
- The main reference for the pei format is "Microsoft Portable Executable
- and Common Object File Format Specification 4.1". Get it if you need to
- do some serious hacking on this code.
-
- Another reference:
- "Peering Inside the PE: A Tour of the Win32 Portable Executable
- File Format", MSJ 1994, Volume 9.
-
- The *sole* difference between the pe format and the pei format is that the
- latter has an MSDOS 2.0 .exe header on the front that prints the message
- "This app must be run under Windows." (or some such).
- (FIXME: Whether that statement is *really* true or not is unknown.
- Are there more subtle differences between pe and pei formats?
- For now assume there aren't. If you find one, then for God sakes
- document it here!)
-
- The Microsoft docs use the word "image" instead of "executable" because
- the former can also refer to a DLL (shared library). Confusion can arise
- because the `i' in `pei' also refers to "image". The `pe' format can
- also create images (i.e. executables), it's just that to run on a win32
- system you need to use the pei format.
-
- FIXME: Please add more docs here so the next poor fool that has to hack
- on this code has a chance of getting something accomplished without
- wasting too much time. */
-
-#ifndef GET_FCN_LNNOPTR
-#define GET_FCN_LNNOPTR(abfd, ext) \
- H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#endif
-
-#ifndef GET_FCN_ENDNDX
-#define GET_FCN_ENDNDX(abfd, ext) \
- H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#endif
-
-#ifndef PUT_FCN_LNNOPTR
-#define PUT_FCN_LNNOPTR(abfd, in, ext) \
- H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#endif
-#ifndef PUT_FCN_ENDNDX
-#define PUT_FCN_ENDNDX(abfd, in, ext) \
- H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#endif
-#ifndef GET_LNSZ_LNNO
-#define GET_LNSZ_LNNO(abfd, ext) \
- H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
-#endif
-#ifndef GET_LNSZ_SIZE
-#define GET_LNSZ_SIZE(abfd, ext) \
- H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
-#endif
-#ifndef PUT_LNSZ_LNNO
-#define PUT_LNSZ_LNNO(abfd, in, ext) \
- H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
-#endif
-#ifndef PUT_LNSZ_SIZE
-#define PUT_LNSZ_SIZE(abfd, in, ext) \
- H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
-#endif
-#ifndef GET_SCN_SCNLEN
-#define GET_SCN_SCNLEN(abfd, ext) \
- H_GET_32 (abfd, ext->x_scn.x_scnlen)
-#endif
-#ifndef GET_SCN_NRELOC
-#define GET_SCN_NRELOC(abfd, ext) \
- H_GET_16 (abfd, ext->x_scn.x_nreloc)
-#endif
-#ifndef GET_SCN_NLINNO
-#define GET_SCN_NLINNO(abfd, ext) \
- H_GET_16 (abfd, ext->x_scn.x_nlinno)
-#endif
-#ifndef PUT_SCN_SCNLEN
-#define PUT_SCN_SCNLEN(abfd, in, ext) \
- H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
-#endif
-#ifndef PUT_SCN_NRELOC
-#define PUT_SCN_NRELOC(abfd, in, ext) \
- H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
-#endif
-#ifndef PUT_SCN_NLINNO
-#define PUT_SCN_NLINNO(abfd, in, ext) \
- H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
-#endif
-#ifndef GET_LINENO_LNNO
-#define GET_LINENO_LNNO(abfd, ext) \
- H_GET_16 (abfd, ext->l_lnno);
-#endif
-#ifndef PUT_LINENO_LNNO
-#define PUT_LINENO_LNNO(abfd, val, ext) \
- H_PUT_16(abfd,val, ext->l_lnno);
-#endif
-
-/* The f_symptr field in the filehdr is sometimes 64 bits. */
-#ifndef GET_FILEHDR_SYMPTR
-#define GET_FILEHDR_SYMPTR H_GET_32
-#endif
-#ifndef PUT_FILEHDR_SYMPTR
-#define PUT_FILEHDR_SYMPTR H_PUT_32
-#endif
-
-/* Some fields in the aouthdr are sometimes 64 bits. */
-#ifndef GET_AOUTHDR_TSIZE
-#define GET_AOUTHDR_TSIZE H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_TSIZE
-#define PUT_AOUTHDR_TSIZE H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_DSIZE
-#define GET_AOUTHDR_DSIZE H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_DSIZE
-#define PUT_AOUTHDR_DSIZE H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_BSIZE
-#define GET_AOUTHDR_BSIZE H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_BSIZE
-#define PUT_AOUTHDR_BSIZE H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_ENTRY
-#define GET_AOUTHDR_ENTRY H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_ENTRY
-#define PUT_AOUTHDR_ENTRY H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_TEXT_START
-#define GET_AOUTHDR_TEXT_START H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_TEXT_START
-#define PUT_AOUTHDR_TEXT_START H_PUT_32
-#endif
-#ifndef GET_AOUTHDR_DATA_START
-#define GET_AOUTHDR_DATA_START H_GET_32
-#endif
-#ifndef PUT_AOUTHDR_DATA_START
-#define PUT_AOUTHDR_DATA_START H_PUT_32
-#endif
-
-/* Some fields in the scnhdr are sometimes 64 bits. */
-#ifndef GET_SCNHDR_PADDR
-#define GET_SCNHDR_PADDR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_PADDR
-#define PUT_SCNHDR_PADDR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_VADDR
-#define GET_SCNHDR_VADDR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_VADDR
-#define PUT_SCNHDR_VADDR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_SIZE
-#define GET_SCNHDR_SIZE H_GET_32
-#endif
-#ifndef PUT_SCNHDR_SIZE
-#define PUT_SCNHDR_SIZE H_PUT_32
-#endif
-#ifndef GET_SCNHDR_SCNPTR
-#define GET_SCNHDR_SCNPTR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_SCNPTR
-#define PUT_SCNHDR_SCNPTR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_RELPTR
-#define GET_SCNHDR_RELPTR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_RELPTR
-#define PUT_SCNHDR_RELPTR H_PUT_32
-#endif
-#ifndef GET_SCNHDR_LNNOPTR
-#define GET_SCNHDR_LNNOPTR H_GET_32
-#endif
-#ifndef PUT_SCNHDR_LNNOPTR
-#define PUT_SCNHDR_LNNOPTR H_PUT_32
-#endif
-
-#ifdef COFF_WITH_pep
-
-#define GET_OPTHDR_IMAGE_BASE H_GET_64
-#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
-#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
-#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
-#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
-#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
-#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
-#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
-#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
-#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
-#define GET_PDATA_ENTRY bfd_get_64
-
-#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pep_bfd_copy_private_bfd_data_common
-#define _bfd_XX_bfd_copy_private_section_data _bfd_pep_bfd_copy_private_section_data
-#define _bfd_XX_get_symbol_info _bfd_pep_get_symbol_info
-#define _bfd_XX_only_swap_filehdr_out _bfd_pep_only_swap_filehdr_out
-#define _bfd_XX_print_private_bfd_data_common _bfd_pep_print_private_bfd_data_common
-#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
-#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
-#define _bfd_XXi_only_swap_filehdr_out _bfd_pepi_only_swap_filehdr_out
-#define _bfd_XXi_swap_aouthdr_in _bfd_pepi_swap_aouthdr_in
-#define _bfd_XXi_swap_aouthdr_out _bfd_pepi_swap_aouthdr_out
-#define _bfd_XXi_swap_aux_in _bfd_pepi_swap_aux_in
-#define _bfd_XXi_swap_aux_out _bfd_pepi_swap_aux_out
-#define _bfd_XXi_swap_lineno_in _bfd_pepi_swap_lineno_in
-#define _bfd_XXi_swap_lineno_out _bfd_pepi_swap_lineno_out
-#define _bfd_XXi_swap_scnhdr_out _bfd_pepi_swap_scnhdr_out
-#define _bfd_XXi_swap_sym_in _bfd_pepi_swap_sym_in
-#define _bfd_XXi_swap_sym_out _bfd_pepi_swap_sym_out
-
-#else /* !COFF_WITH_pep */
-
-#define GET_OPTHDR_IMAGE_BASE H_GET_32
-#define PUT_OPTHDR_IMAGE_BASE H_PUT_32
-#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
-#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
-#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
-#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
-#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
-#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
-#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
-#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
-#define GET_PDATA_ENTRY bfd_get_32
-
-#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pe_bfd_copy_private_bfd_data_common
-#define _bfd_XX_bfd_copy_private_section_data _bfd_pe_bfd_copy_private_section_data
-#define _bfd_XX_get_symbol_info _bfd_pe_get_symbol_info
-#define _bfd_XX_only_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
-#define _bfd_XX_print_private_bfd_data_common _bfd_pe_print_private_bfd_data_common
-#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
-#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
-#define _bfd_XXi_only_swap_filehdr_out _bfd_pei_only_swap_filehdr_out
-#define _bfd_XXi_swap_aouthdr_in _bfd_pei_swap_aouthdr_in
-#define _bfd_XXi_swap_aouthdr_out _bfd_pei_swap_aouthdr_out
-#define _bfd_XXi_swap_aux_in _bfd_pei_swap_aux_in
-#define _bfd_XXi_swap_aux_out _bfd_pei_swap_aux_out
-#define _bfd_XXi_swap_lineno_in _bfd_pei_swap_lineno_in
-#define _bfd_XXi_swap_lineno_out _bfd_pei_swap_lineno_out
-#define _bfd_XXi_swap_scnhdr_out _bfd_pei_swap_scnhdr_out
-#define _bfd_XXi_swap_sym_in _bfd_pei_swap_sym_in
-#define _bfd_XXi_swap_sym_out _bfd_pei_swap_sym_out
-
-#endif /* !COFF_WITH_pep */
-
-/* These functions are architecture dependent, and are in peicode.h:
- coff_swap_reloc_in
- int coff_swap_reloc_out
- coff_swap_filehdr_in
- coff_swap_scnhdr_in
- pe_mkobject
- pe_mkobject_hook */
-
-/* The functions described below are common across all PE/PEI
- implementations architecture types, and actually appear in
- peigen.c. */
-
-void _bfd_XXi_swap_sym_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_sym_in _bfd_XXi_swap_sym_in
-
-unsigned int _bfd_XXi_swap_sym_out PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_sym_out _bfd_XXi_swap_sym_out
-
-void _bfd_XXi_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#define coff_swap_aux_in _bfd_XXi_swap_aux_in
-
-unsigned int _bfd_XXi_swap_aux_out \
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#define coff_swap_aux_out _bfd_XXi_swap_aux_out
-
-void _bfd_XXi_swap_lineno_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in
-
-unsigned int _bfd_XXi_swap_lineno_out PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out
-
-void _bfd_XXi_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in
-
-unsigned int _bfd_XXi_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
-#define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out
-
-unsigned int _bfd_XXi_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
-#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
-
-bfd_boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
-
-bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
-
-void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-
-bfd_boolean _bfd_XXi_final_link_postscript
- PARAMS ((bfd *, struct coff_final_link_info *));
-
-#ifndef coff_final_link_postscript
-#define coff_final_link_postscript _bfd_XXi_final_link_postscript
-#endif
-/* The following are needed only for ONE of pe or pei, but don't
- otherwise vary; peicode.h fixes up ifdefs but we provide the
- prototype. */
-
-unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
-unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
-bfd_boolean _bfd_XX_bfd_copy_private_section_data
- PARAMS ((bfd *, asection *, bfd *, asection *));
-
-/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */
-#define bfd_pe_executable_p(abfd) \
- (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \
- || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0)
diff --git a/contrib/binutils/bfd/libxcoff.h b/contrib/binutils/bfd/libxcoff.h
deleted file mode 100644
index 8537617..0000000
--- a/contrib/binutils/bfd/libxcoff.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/* BFD XCOFF object file private structure.
- Copyright 2001, 2002 Free Software Foundation, Inc.
- Written by Tom Rix, Redhat.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef LIBXCOFF_H
-#define LIBXCOFF_H
-
-/* This is the backend information kept for XCOFF files. This
- structure is constant for a particular backend. The first element
- is the COFF backend data structure, so that XCOFF targets can use
- the generic COFF code. */
-
-struct xcoff_backend_data_rec
-{
- /* COFF backend information. */
- bfd_coff_backend_data coff;
-
- /* Magic number. */
- unsigned short _xcoff_magic_number;
-
- /* Architecture and machine for coff_set_arch_mach_hook. */
- enum bfd_architecture _xcoff_architecture;
- long _xcoff_machine;
-
- /* Function pointers to xcoff specific swap routines. */
- void (* _xcoff_swap_ldhdr_in)
- PARAMS ((bfd *, const PTR, struct internal_ldhdr *));
- void (* _xcoff_swap_ldhdr_out)
- PARAMS ((bfd *, const struct internal_ldhdr *, PTR));
- void (* _xcoff_swap_ldsym_in)
- PARAMS ((bfd *, const PTR, struct internal_ldsym *));
- void (* _xcoff_swap_ldsym_out)
- PARAMS ((bfd *, const struct internal_ldsym *, PTR));
- void (* _xcoff_swap_ldrel_in)
- PARAMS ((bfd *, const PTR, struct internal_ldrel *));
- void (* _xcoff_swap_ldrel_out)
- PARAMS ((bfd *, const struct internal_ldrel *, PTR));
-
- /* Size of the external struct. */
- unsigned int _xcoff_ldhdrsz;
- unsigned int _xcoff_ldsymsz;
- unsigned int _xcoff_ldrelsz;
-
- /* Size an entry in a descriptor section. */
- unsigned int _xcoff_function_descriptor_size;
-
- /* Size of the small aout file header. */
- unsigned int _xcoff_small_aout_header_size;
-
- /* Loader version
- 1 : XCOFF32
- 2 : XCOFF64. */
- unsigned long _xcoff_ldhdr_version;
-
- bfd_boolean (* _xcoff_put_symbol_name)
- PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *,
- const char *));
-
- bfd_boolean (* _xcoff_put_ldsymbol_name)
- PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
- const char *));
-
- reloc_howto_type *_xcoff_dynamic_reloc;
-
- asection * (* _xcoff_create_csect_from_smclas)
- PARAMS ((bfd *, union internal_auxent *, const char *));
-
- /* Line number and relocation overflow.
- XCOFF32 overflows to another section when the line number or the
- relocation count exceeds 0xffff. XCOFF64 does not overflow. */
- bfd_boolean (*_xcoff_is_lineno_count_overflow)
- PARAMS ((bfd *, bfd_vma));
- bfd_boolean (*_xcoff_is_reloc_count_overflow)
- PARAMS ((bfd *, bfd_vma));
-
- /* Loader section symbol and relocation table offset
- XCOFF32 is after the .loader header
- XCOFF64 is offset in .loader header. */
- bfd_vma (*_xcoff_loader_symbol_offset)
- PARAMS ((bfd *, struct internal_ldhdr *));
- bfd_vma (*_xcoff_loader_reloc_offset)
- PARAMS ((bfd *, struct internal_ldhdr *));
-
- /* Global linkage. The first word of global linkage code must be be
- modified by filling in the correct TOC offset. */
- unsigned long *_xcoff_glink_code;
-
- /* Size of the global link code in bytes of the xcoff_glink_code table. */
- unsigned long _xcoff_glink_size;
-
- /* rtinit. */
- unsigned int _xcoff_rtinit_size;
- bfd_boolean (*_xcoff_generate_rtinit)
- PARAMS ((bfd *, const char *, const char *, bfd_boolean));
-};
-
-/* Look up an entry in an XCOFF link hash table. */
-#define xcoff_link_hash_lookup(table, string, create, copy, follow) \
- ((struct xcoff_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
-
-/* Traverse an XCOFF link hash table. */
-#define xcoff_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the XCOFF link hash table from the info structure. This is
- just a cast. */
-#define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash))
-
-
-#define xcoff_backend(abfd) \
- ((struct xcoff_backend_data_rec *) (abfd)->xvec->backend_data)
-
-#define bfd_xcoff_magic_number(a) ((xcoff_backend(a)->_xcoff_magic_number))
-#define bfd_xcoff_architecture(a) ((xcoff_backend(a)->_xcoff_architecture))
-#define bfd_xcoff_machine(a) ((xcoff_backend(a)->_xcoff_machine))
-
-#define bfd_xcoff_swap_ldhdr_in(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldhdr_in) ((a), (b), (c)))
-
-#define bfd_xcoff_swap_ldhdr_out(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldhdr_out) ((a), (b), (c)))
-
-#define bfd_xcoff_swap_ldsym_in(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldsym_in) ((a), (b), (c)))
-
-#define bfd_xcoff_swap_ldsym_out(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldsym_out) ((a), (b), (c)))
-
-#define bfd_xcoff_swap_ldrel_in(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldrel_in) ((a), (b), (c)))
-
-#define bfd_xcoff_swap_ldrel_out(a, b, c) \
- ((xcoff_backend(a)->_xcoff_swap_ldrel_out) ((a), (b), (c)))
-
-#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend(a)->_xcoff_ldhdrsz))
-#define bfd_xcoff_ldsymsz(a) ((xcoff_backend(a)->_xcoff_ldsymsz))
-#define bfd_xcoff_ldrelsz(a) ((xcoff_backend(a)->_xcoff_ldrelsz))
-#define bfd_xcoff_function_descriptor_size(a) \
- ((xcoff_backend(a)->_xcoff_function_descriptor_size))
-#define bfd_xcoff_small_aout_header_size(a) \
- ((xcoff_backend(a)->_xcoff_small_aout_header_size))
-
-#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend(a)->_xcoff_ldhdr_version))
-
-#define bfd_xcoff_put_symbol_name(a, b, c, d) \
- ((xcoff_backend(a)->_xcoff_put_symbol_name) ((a), (b), (c), (d)))
-
-#define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \
- ((xcoff_backend(a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d)))
-
-/* Get the XCOFF hash table entries for a BFD. */
-#define obj_xcoff_sym_hashes(bfd) \
- ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
-
-#define bfd_xcoff_dynamic_reloc_howto(a) \
- ((xcoff_backend(a)->_xcoff_dynamic_reloc))
-
-#define bfd_xcoff_create_csect_from_smclas(a, b, c) \
- ((xcoff_backend(a)->_xcoff_create_csect_from_smclas((a), (b), (c))))
-
-#define bfd_xcoff_is_lineno_count_overflow(a, b) \
- ((xcoff_backend(a)->_xcoff_is_lineno_count_overflow((a), (b))))
-
-#define bfd_xcoff_is_reloc_count_overflow(a, b) \
- ((xcoff_backend(a)->_xcoff_is_reloc_count_overflow((a), (b))))
-
-#define bfd_xcoff_loader_symbol_offset(a, b) \
- ((xcoff_backend(a)->_xcoff_loader_symbol_offset((a), (b))))
-
-#define bfd_xcoff_loader_reloc_offset(a, b) \
- ((xcoff_backend(a)->_xcoff_loader_reloc_offset((a), (b))))
-
-#define bfd_xcoff_glink_code(a, b) ((xcoff_backend(a)->_xcoff_glink_code[(b)]))
-#define bfd_xcoff_glink_code_size(a) ((xcoff_backend(a)->_xcoff_glink_size))
-
-/* Check for the magic number U803XTOCMAGIC or U64_TOCMAGIC for 64 bit
- targets. */
-#define bfd_xcoff_is_xcoff64(a) \
- ( (0x01EF == (bfd_xcoff_magic_number(a))) \
- || (0x01F7 == (bfd_xcoff_magic_number(a))))
-
-/* Check for the magic number U802TOMAGIC for 32 bit targets. */
-#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a)))
-
-#define bfd_xcoff_rtinit_size(a) ((xcoff_backend(a)->_xcoff_rtinit_size))
-#define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend(a)->_xcoff_generate_rtinit ((a), (b), (c), (d))))
-
-/* Accessor macros for tdata. */
-#define bfd_xcoff_text_align_power(a) ((xcoff_data (a)->text_align_power))
-#define bfd_xcoff_data_align_power(a) ((xcoff_data (a)->data_align_power))
-
-/* xcoff*_ppc_relocate_section macros */
-#define XCOFF_MAX_CALCULATE_RELOCATION (0x1c)
-#define XCOFF_MAX_COMPLAIN_OVERFLOW (4)
-/* N_ONES produces N one bits, without overflowing machine arithmetic. */
-#ifdef N_ONES
-#undef N_ONES
-#endif
-#define N_ONES(n) (((((bfd_vma) 1 << ((n) - 1)) - 1) << 1) | 1)
-
-#define XCOFF_RELOC_FUNCTION_ARGS \
- bfd *, asection *, bfd *, struct internal_reloc *, \
- struct internal_syment *, struct reloc_howto_struct *, bfd_vma, bfd_vma, \
- bfd_vma *relocation, bfd_byte *contents
-
-#define XCOFF_COMPLAIN_FUNCTION_ARGS \
- bfd *, bfd_vma, bfd_vma, struct reloc_howto_struct *howto
-
-extern bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
- PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-extern bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-
-/* Relocation functions */
-bfd_boolean xcoff_reloc_type_noop PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_fail PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_pos PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_neg PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_rel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_toc PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_ba PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-bfd_boolean xcoff_reloc_type_crel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-
-#endif /* LIBXCOFF_H */
diff --git a/contrib/binutils/bfd/linker.c b/contrib/binutils/bfd/linker.c
deleted file mode 100644
index 58befc3..0000000
--- a/contrib/binutils/bfd/linker.c
+++ /dev/null
@@ -1,2827 +0,0 @@
-/* linker.c -- BFD linker routines
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
- Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-#include "genlink.h"
-
-/*
-SECTION
- Linker Functions
-
-@cindex Linker
- The linker uses three special entry points in the BFD target
- vector. It is not necessary to write special routines for
- these entry points when creating a new BFD back end, since
- generic versions are provided. However, writing them can
- speed up linking and make it use significantly less runtime
- memory.
-
- The first routine creates a hash table used by the other
- routines. The second routine adds the symbols from an object
- file to the hash table. The third routine takes all the
- object files and links them together to create the output
- file. These routines are designed so that the linker proper
- does not need to know anything about the symbols in the object
- files that it is linking. The linker merely arranges the
- sections as directed by the linker script and lets BFD handle
- the details of symbols and relocs.
-
- The second routine and third routines are passed a pointer to
- a <<struct bfd_link_info>> structure (defined in
- <<bfdlink.h>>) which holds information relevant to the link,
- including the linker hash table (which was created by the
- first routine) and a set of callback functions to the linker
- proper.
-
- The generic linker routines are in <<linker.c>>, and use the
- header file <<genlink.h>>. As of this writing, the only back
- ends which have implemented versions of these routines are
- a.out (in <<aoutx.h>>) and ECOFF (in <<ecoff.c>>). The a.out
- routines are used as examples throughout this section.
-
-@menu
-@* Creating a Linker Hash Table::
-@* Adding Symbols to the Hash Table::
-@* Performing the Final Link::
-@end menu
-
-INODE
-Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions
-SUBSECTION
- Creating a linker hash table
-
-@cindex _bfd_link_hash_table_create in target vector
-@cindex target vector (_bfd_link_hash_table_create)
- The linker routines must create a hash table, which must be
- derived from <<struct bfd_link_hash_table>> described in
- <<bfdlink.c>>. @xref{Hash Tables}, for information on how to
- create a derived hash table. This entry point is called using
- the target vector of the linker output file.
-
- The <<_bfd_link_hash_table_create>> entry point must allocate
- and initialize an instance of the desired hash table. If the
- back end does not require any additional information to be
- stored with the entries in the hash table, the entry point may
- simply create a <<struct bfd_link_hash_table>>. Most likely,
- however, some additional information will be needed.
-
- For example, with each entry in the hash table the a.out
- linker keeps the index the symbol has in the final output file
- (this index number is used so that when doing a relocatable
- link the symbol index used in the output file can be quickly
- filled in when copying over a reloc). The a.out linker code
- defines the required structures and functions for a hash table
- derived from <<struct bfd_link_hash_table>>. The a.out linker
- hash table is created by the function
- <<NAME(aout,link_hash_table_create)>>; it simply allocates
- space for the hash table, initializes it, and returns a
- pointer to it.
-
- When writing the linker routines for a new back end, you will
- generally not know exactly which fields will be required until
- you have finished. You should simply create a new hash table
- which defines no additional fields, and then simply add fields
- as they become necessary.
-
-INODE
-Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions
-SUBSECTION
- Adding symbols to the hash table
-
-@cindex _bfd_link_add_symbols in target vector
-@cindex target vector (_bfd_link_add_symbols)
- The linker proper will call the <<_bfd_link_add_symbols>>
- entry point for each object file or archive which is to be
- linked (typically these are the files named on the command
- line, but some may also come from the linker script). The
- entry point is responsible for examining the file. For an
- object file, BFD must add any relevant symbol information to
- the hash table. For an archive, BFD must determine which
- elements of the archive should be used and adding them to the
- link.
-
- The a.out version of this entry point is
- <<NAME(aout,link_add_symbols)>>.
-
-@menu
-@* Differing file formats::
-@* Adding symbols from an object file::
-@* Adding symbols from an archive::
-@end menu
-
-INODE
-Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table
-SUBSUBSECTION
- Differing file formats
-
- Normally all the files involved in a link will be of the same
- format, but it is also possible to link together different
- format object files, and the back end must support that. The
- <<_bfd_link_add_symbols>> entry point is called via the target
- vector of the file to be added. This has an important
- consequence: the function may not assume that the hash table
- is the type created by the corresponding
- <<_bfd_link_hash_table_create>> vector. All the
- <<_bfd_link_add_symbols>> function can assume about the hash
- table is that it is derived from <<struct
- bfd_link_hash_table>>.
-
- Sometimes the <<_bfd_link_add_symbols>> function must store
- some information in the hash table entry to be used by the
- <<_bfd_final_link>> function. In such a case the <<creator>>
- field of the hash table must be checked to make sure that the
- hash table was created by an object file of the same format.
-
- The <<_bfd_final_link>> routine must be prepared to handle a
- hash entry without any extra information added by the
- <<_bfd_link_add_symbols>> function. A hash entry without
- extra information will also occur when the linker script
- directs the linker to create a symbol. Note that, regardless
- of how a hash table entry is added, all the fields will be
- initialized to some sort of null value by the hash table entry
- initialization function.
-
- See <<ecoff_link_add_externals>> for an example of how to
- check the <<creator>> field before saving information (in this
- case, the ECOFF external symbol debugging information) in a
- hash table entry.
-
-INODE
-Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table
-SUBSUBSECTION
- Adding symbols from an object file
-
- When the <<_bfd_link_add_symbols>> routine is passed an object
- file, it must add all externally visible symbols in that
- object file to the hash table. The actual work of adding the
- symbol to the hash table is normally handled by the function
- <<_bfd_generic_link_add_one_symbol>>. The
- <<_bfd_link_add_symbols>> routine is responsible for reading
- all the symbols from the object file and passing the correct
- information to <<_bfd_generic_link_add_one_symbol>>.
-
- The <<_bfd_link_add_symbols>> routine should not use
- <<bfd_canonicalize_symtab>> to read the symbols. The point of
- providing this routine is to avoid the overhead of converting
- the symbols into generic <<asymbol>> structures.
-
-@findex _bfd_generic_link_add_one_symbol
- <<_bfd_generic_link_add_one_symbol>> handles the details of
- combining common symbols, warning about multiple definitions,
- and so forth. It takes arguments which describe the symbol to
- add, notably symbol flags, a section, and an offset. The
- symbol flags include such things as <<BSF_WEAK>> or
- <<BSF_INDIRECT>>. The section is a section in the object
- file, or something like <<bfd_und_section_ptr>> for an undefined
- symbol or <<bfd_com_section_ptr>> for a common symbol.
-
- If the <<_bfd_final_link>> routine is also going to need to
- read the symbol information, the <<_bfd_link_add_symbols>>
- routine should save it somewhere attached to the object file
- BFD. However, the information should only be saved if the
- <<keep_memory>> field of the <<info>> argument is TRUE, so
- that the <<-no-keep-memory>> linker switch is effective.
-
- The a.out function which adds symbols from an object file is
- <<aout_link_add_object_symbols>>, and most of the interesting
- work is in <<aout_link_add_symbols>>. The latter saves
- pointers to the hash tables entries created by
- <<_bfd_generic_link_add_one_symbol>> indexed by symbol number,
- so that the <<_bfd_final_link>> routine does not have to call
- the hash table lookup routine to locate the entry.
-
-INODE
-Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table
-SUBSUBSECTION
- Adding symbols from an archive
-
- When the <<_bfd_link_add_symbols>> routine is passed an
- archive, it must look through the symbols defined by the
- archive and decide which elements of the archive should be
- included in the link. For each such element it must call the
- <<add_archive_element>> linker callback, and it must add the
- symbols from the object file to the linker hash table.
-
-@findex _bfd_generic_link_add_archive_symbols
- In most cases the work of looking through the symbols in the
- archive should be done by the
- <<_bfd_generic_link_add_archive_symbols>> function. This
- function builds a hash table from the archive symbol table and
- looks through the list of undefined symbols to see which
- elements should be included.
- <<_bfd_generic_link_add_archive_symbols>> is passed a function
- to call to make the final decision about adding an archive
- element to the link and to do the actual work of adding the
- symbols to the linker hash table.
-
- The function passed to
- <<_bfd_generic_link_add_archive_symbols>> must read the
- symbols of the archive element and decide whether the archive
- element should be included in the link. If the element is to
- be included, the <<add_archive_element>> linker callback
- routine must be called with the element as an argument, and
- the elements symbols must be added to the linker hash table
- just as though the element had itself been passed to the
- <<_bfd_link_add_symbols>> function.
-
- When the a.out <<_bfd_link_add_symbols>> function receives an
- archive, it calls <<_bfd_generic_link_add_archive_symbols>>
- passing <<aout_link_check_archive_element>> as the function
- argument. <<aout_link_check_archive_element>> calls
- <<aout_link_check_ar_symbols>>. If the latter decides to add
- the element (an element is only added if it provides a real,
- non-common, definition for a previously undefined or common
- symbol) it calls the <<add_archive_element>> callback and then
- <<aout_link_check_archive_element>> calls
- <<aout_link_add_symbols>> to actually add the symbols to the
- linker hash table.
-
- The ECOFF back end is unusual in that it does not normally
- call <<_bfd_generic_link_add_archive_symbols>>, because ECOFF
- archives already contain a hash table of symbols. The ECOFF
- back end searches the archive itself to avoid the overhead of
- creating a new hash table.
-
-INODE
-Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions
-SUBSECTION
- Performing the final link
-
-@cindex _bfd_link_final_link in target vector
-@cindex target vector (_bfd_final_link)
- When all the input files have been processed, the linker calls
- the <<_bfd_final_link>> entry point of the output BFD. This
- routine is responsible for producing the final output file,
- which has several aspects. It must relocate the contents of
- the input sections and copy the data into the output sections.
- It must build an output symbol table including any local
- symbols from the input files and the global symbols from the
- hash table. When producing relocatable output, it must
- modify the input relocs and write them into the output file.
- There may also be object format dependent work to be done.
-
- The linker will also call the <<write_object_contents>> entry
- point when the BFD is closed. The two entry points must work
- together in order to produce the correct output file.
-
- The details of how this works are inevitably dependent upon
- the specific object file format. The a.out
- <<_bfd_final_link>> routine is <<NAME(aout,final_link)>>.
-
-@menu
-@* Information provided by the linker::
-@* Relocating the section contents::
-@* Writing the symbol table::
-@end menu
-
-INODE
-Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link
-SUBSUBSECTION
- Information provided by the linker
-
- Before the linker calls the <<_bfd_final_link>> entry point,
- it sets up some data structures for the function to use.
-
- The <<input_bfds>> field of the <<bfd_link_info>> structure
- will point to a list of all the input files included in the
- link. These files are linked through the <<link_next>> field
- of the <<bfd>> structure.
-
- Each section in the output file will have a list of
- <<link_order>> structures attached to the <<link_order_head>>
- field (the <<link_order>> structure is defined in
- <<bfdlink.h>>). These structures describe how to create the
- contents of the output section in terms of the contents of
- various input sections, fill constants, and, eventually, other
- types of information. They also describe relocs that must be
- created by the BFD backend, but do not correspond to any input
- file; this is used to support -Ur, which builds constructors
- while generating a relocatable object file.
-
-INODE
-Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link
-SUBSUBSECTION
- Relocating the section contents
-
- The <<_bfd_final_link>> function should look through the
- <<link_order>> structures attached to each section of the
- output file. Each <<link_order>> structure should either be
- handled specially, or it should be passed to the function
- <<_bfd_default_link_order>> which will do the right thing
- (<<_bfd_default_link_order>> is defined in <<linker.c>>).
-
- For efficiency, a <<link_order>> of type
- <<bfd_indirect_link_order>> whose associated section belongs
- to a BFD of the same format as the output BFD must be handled
- specially. This type of <<link_order>> describes part of an
- output section in terms of a section belonging to one of the
- input files. The <<_bfd_final_link>> function should read the
- contents of the section and any associated relocs, apply the
- relocs to the section contents, and write out the modified
- section contents. If performing a relocatable link, the
- relocs themselves must also be modified and written out.
-
-@findex _bfd_relocate_contents
-@findex _bfd_final_link_relocate
- The functions <<_bfd_relocate_contents>> and
- <<_bfd_final_link_relocate>> provide some general support for
- performing the actual relocations, notably overflow checking.
- Their arguments include information about the symbol the
- relocation is against and a <<reloc_howto_type>> argument
- which describes the relocation to perform. These functions
- are defined in <<reloc.c>>.
-
- The a.out function which handles reading, relocating, and
- writing section contents is <<aout_link_input_section>>. The
- actual relocation is done in <<aout_link_input_section_std>>
- and <<aout_link_input_section_ext>>.
-
-INODE
-Writing the symbol table, , Relocating the section contents, Performing the Final Link
-SUBSUBSECTION
- Writing the symbol table
-
- The <<_bfd_final_link>> function must gather all the symbols
- in the input files and write them out. It must also write out
- all the symbols in the global hash table. This must be
- controlled by the <<strip>> and <<discard>> fields of the
- <<bfd_link_info>> structure.
-
- The local symbols of the input files will not have been
- entered into the linker hash table. The <<_bfd_final_link>>
- routine must consider each input file and include the symbols
- in the output file. It may be convenient to do this when
- looking through the <<link_order>> structures, or it may be
- done by stepping through the <<input_bfds>> list.
-
- The <<_bfd_final_link>> routine must also traverse the global
- hash table to gather all the externally visible symbols. It
- is possible that most of the externally visible symbols may be
- written out when considering the symbols of each input file,
- but it is still necessary to traverse the hash table since the
- linker script may have defined some symbols that are not in
- any of the input files.
-
- The <<strip>> field of the <<bfd_link_info>> structure
- controls which symbols are written out. The possible values
- are listed in <<bfdlink.h>>. If the value is <<strip_some>>,
- then the <<keep_hash>> field of the <<bfd_link_info>>
- structure is a hash table of symbols to keep; each symbol
- should be looked up in this hash table, and only symbols which
- are present should be included in the output file.
-
- If the <<strip>> field of the <<bfd_link_info>> structure
- permits local symbols to be written out, the <<discard>> field
- is used to further controls which local symbols are included
- in the output file. If the value is <<discard_l>>, then all
- local symbols which begin with a certain prefix are discarded;
- this is controlled by the <<bfd_is_local_label_name>> entry point.
-
- The a.out backend handles symbols by calling
- <<aout_link_write_symbols>> on each input BFD and then
- traversing the global hash table with the function
- <<aout_link_write_other_symbol>>. It builds a string table
- while writing out the symbols, which is written to the output
- file at the end of <<NAME(aout,final_link)>>.
-*/
-
-static bfd_boolean generic_link_add_object_symbols
- (bfd *, struct bfd_link_info *, bfd_boolean collect);
-static bfd_boolean generic_link_add_symbols
- (bfd *, struct bfd_link_info *, bfd_boolean);
-static bfd_boolean generic_link_check_archive_element_no_collect
- (bfd *, struct bfd_link_info *, bfd_boolean *);
-static bfd_boolean generic_link_check_archive_element_collect
- (bfd *, struct bfd_link_info *, bfd_boolean *);
-static bfd_boolean generic_link_check_archive_element
- (bfd *, struct bfd_link_info *, bfd_boolean *, bfd_boolean);
-static bfd_boolean generic_link_add_symbol_list
- (bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **,
- bfd_boolean);
-static bfd_boolean generic_add_output_symbol
- (bfd *, size_t *psymalloc, asymbol *);
-static bfd_boolean default_data_link_order
- (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
-static bfd_boolean default_indirect_link_order
- (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *,
- bfd_boolean);
-
-/* The link hash table structure is defined in bfdlink.h. It provides
- a base hash table which the backend specific hash tables are built
- upon. */
-
-/* Routine to create an entry in the link hash table. */
-
-struct bfd_hash_entry *
-_bfd_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = bfd_hash_newfunc (entry, table, string);
- if (entry)
- {
- struct bfd_link_hash_entry *h = (struct bfd_link_hash_entry *) entry;
-
- /* Initialize the local fields. */
- h->type = bfd_link_hash_new;
- h->und_next = NULL;
- }
-
- return entry;
-}
-
-/* Initialize a link hash table. The BFD argument is the one
- responsible for creating this table. */
-
-bfd_boolean
-_bfd_link_hash_table_init
- (struct bfd_link_hash_table *table,
- bfd *abfd,
- struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *))
-{
- table->creator = abfd->xvec;
- table->undefs = NULL;
- table->undefs_tail = NULL;
- table->type = bfd_link_generic_hash_table;
-
- return bfd_hash_table_init (&table->table, newfunc);
-}
-
-/* Look up a symbol in a link hash table. If follow is TRUE, we
- follow bfd_link_hash_indirect and bfd_link_hash_warning links to
- the real symbol. */
-
-struct bfd_link_hash_entry *
-bfd_link_hash_lookup (struct bfd_link_hash_table *table,
- const char *string,
- bfd_boolean create,
- bfd_boolean copy,
- bfd_boolean follow)
-{
- struct bfd_link_hash_entry *ret;
-
- ret = ((struct bfd_link_hash_entry *)
- bfd_hash_lookup (&table->table, string, create, copy));
-
- if (follow && ret != NULL)
- {
- while (ret->type == bfd_link_hash_indirect
- || ret->type == bfd_link_hash_warning)
- ret = ret->u.i.link;
- }
-
- return ret;
-}
-
-/* Look up a symbol in the main linker hash table if the symbol might
- be wrapped. This should only be used for references to an
- undefined symbol, not for definitions of a symbol. */
-
-struct bfd_link_hash_entry *
-bfd_wrapped_link_hash_lookup (bfd *abfd,
- struct bfd_link_info *info,
- const char *string,
- bfd_boolean create,
- bfd_boolean copy,
- bfd_boolean follow)
-{
- bfd_size_type amt;
-
- if (info->wrap_hash != NULL)
- {
- const char *l;
- char prefix = '\0';
-
- l = string;
- if (*l == bfd_get_symbol_leading_char (abfd) || *l == info->wrap_char)
- {
- prefix = *l;
- ++l;
- }
-
-#undef WRAP
-#define WRAP "__wrap_"
-
- if (bfd_hash_lookup (info->wrap_hash, l, FALSE, FALSE) != NULL)
- {
- char *n;
- struct bfd_link_hash_entry *h;
-
- /* This symbol is being wrapped. We want to replace all
- references to SYM with references to __wrap_SYM. */
-
- amt = strlen (l) + sizeof WRAP + 1;
- n = bfd_malloc (amt);
- if (n == NULL)
- return NULL;
-
- n[0] = prefix;
- n[1] = '\0';
- strcat (n, WRAP);
- strcat (n, l);
- h = bfd_link_hash_lookup (info->hash, n, create, TRUE, follow);
- free (n);
- return h;
- }
-
-#undef WRAP
-
-#undef REAL
-#define REAL "__real_"
-
- if (*l == '_'
- && strncmp (l, REAL, sizeof REAL - 1) == 0
- && bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
- FALSE, FALSE) != NULL)
- {
- char *n;
- struct bfd_link_hash_entry *h;
-
- /* This is a reference to __real_SYM, where SYM is being
- wrapped. We want to replace all references to __real_SYM
- with references to SYM. */
-
- amt = strlen (l + sizeof REAL - 1) + 2;
- n = bfd_malloc (amt);
- if (n == NULL)
- return NULL;
-
- n[0] = prefix;
- n[1] = '\0';
- strcat (n, l + sizeof REAL - 1);
- h = bfd_link_hash_lookup (info->hash, n, create, TRUE, follow);
- free (n);
- return h;
- }
-
-#undef REAL
- }
-
- return bfd_link_hash_lookup (info->hash, string, create, copy, follow);
-}
-
-/* Traverse a generic link hash table. The only reason this is not a
- macro is to do better type checking. This code presumes that an
- argument passed as a struct bfd_hash_entry * may be caught as a
- struct bfd_link_hash_entry * with no explicit cast required on the
- call. */
-
-void
-bfd_link_hash_traverse
- (struct bfd_link_hash_table *table,
- bfd_boolean (*func) (struct bfd_link_hash_entry *, void *),
- void *info)
-{
- bfd_hash_traverse (&table->table,
- (bfd_boolean (*) (struct bfd_hash_entry *, void *)) func,
- info);
-}
-
-/* Add a symbol to the linker hash table undefs list. */
-
-void
-bfd_link_add_undef (struct bfd_link_hash_table *table,
- struct bfd_link_hash_entry *h)
-{
- BFD_ASSERT (h->und_next == NULL);
- if (table->undefs_tail != NULL)
- table->undefs_tail->und_next = h;
- if (table->undefs == NULL)
- table->undefs = h;
- table->undefs_tail = h;
-}
-
-/* Routine to create an entry in a generic link hash table. */
-
-struct bfd_hash_entry *
-_bfd_generic_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry =
- bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = _bfd_link_hash_newfunc (entry, table, string);
- if (entry)
- {
- struct generic_link_hash_entry *ret;
-
- /* Set local fields. */
- ret = (struct generic_link_hash_entry *) entry;
- ret->written = FALSE;
- ret->sym = NULL;
- }
-
- return entry;
-}
-
-/* Create a generic link hash table. */
-
-struct bfd_link_hash_table *
-_bfd_generic_link_hash_table_create (bfd *abfd)
-{
- struct generic_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct generic_link_hash_table);
-
- ret = bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
- if (! _bfd_link_hash_table_init (&ret->root, abfd,
- _bfd_generic_link_hash_newfunc))
- {
- free (ret);
- return NULL;
- }
- return &ret->root;
-}
-
-void
-_bfd_generic_link_hash_table_free (struct bfd_link_hash_table *hash)
-{
- struct generic_link_hash_table *ret
- = (struct generic_link_hash_table *) hash;
-
- bfd_hash_table_free (&ret->root.table);
- free (ret);
-}
-
-/* Grab the symbols for an object file when doing a generic link. We
- store the symbols in the outsymbols field. We need to keep them
- around for the entire link to ensure that we only read them once.
- If we read them multiple times, we might wind up with relocs and
- the hash table pointing to different instances of the symbol
- structure. */
-
-static bfd_boolean
-generic_link_read_symbols (bfd *abfd)
-{
- if (bfd_get_outsymbols (abfd) == NULL)
- {
- long symsize;
- long symcount;
-
- symsize = bfd_get_symtab_upper_bound (abfd);
- if (symsize < 0)
- return FALSE;
- bfd_get_outsymbols (abfd) = bfd_alloc (abfd, symsize);
- if (bfd_get_outsymbols (abfd) == NULL && symsize != 0)
- return FALSE;
- symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd));
- if (symcount < 0)
- return FALSE;
- bfd_get_symcount (abfd) = symcount;
- }
-
- return TRUE;
-}
-
-/* Generic function to add symbols to from an object file to the
- global hash table. This version does not automatically collect
- constructors by name. */
-
-bfd_boolean
-_bfd_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
-{
- return generic_link_add_symbols (abfd, info, FALSE);
-}
-
-/* Generic function to add symbols from an object file to the global
- hash table. This version automatically collects constructors by
- name, as the collect2 program does. It should be used for any
- target which does not provide some other mechanism for setting up
- constructors and destructors; these are approximately those targets
- for which gcc uses collect2 and do not support stabs. */
-
-bfd_boolean
-_bfd_generic_link_add_symbols_collect (bfd *abfd, struct bfd_link_info *info)
-{
- return generic_link_add_symbols (abfd, info, TRUE);
-}
-
-/* Indicate that we are only retrieving symbol values from this
- section. We want the symbols to act as though the values in the
- file are absolute. */
-
-void
-_bfd_generic_link_just_syms (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- sec->output_section = bfd_abs_section_ptr;
- sec->output_offset = sec->vma;
-}
-
-/* Add symbols from an object file to the global hash table. */
-
-static bfd_boolean
-generic_link_add_symbols (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean collect)
-{
- bfd_boolean ret;
-
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
- ret = generic_link_add_object_symbols (abfd, info, collect);
- break;
- case bfd_archive:
- ret = (_bfd_generic_link_add_archive_symbols
- (abfd, info,
- (collect
- ? generic_link_check_archive_element_collect
- : generic_link_check_archive_element_no_collect)));
- break;
- default:
- bfd_set_error (bfd_error_wrong_format);
- ret = FALSE;
- }
-
- return ret;
-}
-
-/* Add symbols from an object file to the global hash table. */
-
-static bfd_boolean
-generic_link_add_object_symbols (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean collect)
-{
- bfd_size_type symcount;
- struct bfd_symbol **outsyms;
-
- if (! generic_link_read_symbols (abfd))
- return FALSE;
- symcount = _bfd_generic_link_get_symcount (abfd);
- outsyms = _bfd_generic_link_get_symbols (abfd);
- return generic_link_add_symbol_list (abfd, info, symcount, outsyms, collect);
-}
-
-/* We build a hash table of all symbols defined in an archive. */
-
-/* An archive symbol may be defined by multiple archive elements.
- This linked list is used to hold the elements. */
-
-struct archive_list
-{
- struct archive_list *next;
- unsigned int indx;
-};
-
-/* An entry in an archive hash table. */
-
-struct archive_hash_entry
-{
- struct bfd_hash_entry root;
- /* Where the symbol is defined. */
- struct archive_list *defs;
-};
-
-/* An archive hash table itself. */
-
-struct archive_hash_table
-{
- struct bfd_hash_table table;
-};
-
-/* Create a new entry for an archive hash table. */
-
-static struct bfd_hash_entry *
-archive_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- struct archive_hash_entry *ret = (struct archive_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (struct archive_hash_entry));
- if (ret == NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct archive_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
- if (ret)
- {
- /* Initialize the local fields. */
- ret->defs = NULL;
- }
-
- return &ret->root;
-}
-
-/* Initialize an archive hash table. */
-
-static bfd_boolean
-archive_hash_table_init
- (struct archive_hash_table *table,
- struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *))
-{
- return bfd_hash_table_init (&table->table, newfunc);
-}
-
-/* Look up an entry in an archive hash table. */
-
-#define archive_hash_lookup(t, string, create, copy) \
- ((struct archive_hash_entry *) \
- bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
-
-/* Allocate space in an archive hash table. */
-
-#define archive_hash_allocate(t, size) bfd_hash_allocate (&(t)->table, (size))
-
-/* Free an archive hash table. */
-
-#define archive_hash_table_free(t) bfd_hash_table_free (&(t)->table)
-
-/* Generic function to add symbols from an archive file to the global
- hash file. This function presumes that the archive symbol table
- has already been read in (this is normally done by the
- bfd_check_format entry point). It looks through the undefined and
- common symbols and searches the archive symbol table for them. If
- it finds an entry, it includes the associated object file in the
- link.
-
- The old linker looked through the archive symbol table for
- undefined symbols. We do it the other way around, looking through
- undefined symbols for symbols defined in the archive. The
- advantage of the newer scheme is that we only have to look through
- the list of undefined symbols once, whereas the old method had to
- re-search the symbol table each time a new object file was added.
-
- The CHECKFN argument is used to see if an object file should be
- included. CHECKFN should set *PNEEDED to TRUE if the object file
- should be included, and must also call the bfd_link_info
- add_archive_element callback function and handle adding the symbols
- to the global hash table. CHECKFN should only return FALSE if some
- sort of error occurs.
-
- For some formats, such as a.out, it is possible to look through an
- object file but not actually include it in the link. The
- archive_pass field in a BFD is used to avoid checking the symbols
- of an object files too many times. When an object is included in
- the link, archive_pass is set to -1. If an object is scanned but
- not included, archive_pass is set to the pass number. The pass
- number is incremented each time a new object file is included. The
- pass number is used because when a new object file is included it
- may create new undefined symbols which cause a previously examined
- object file to be included. */
-
-bfd_boolean
-_bfd_generic_link_add_archive_symbols
- (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean (*checkfn) (bfd *, struct bfd_link_info *, bfd_boolean *))
-{
- carsym *arsyms;
- carsym *arsym_end;
- register carsym *arsym;
- int pass;
- struct archive_hash_table arsym_hash;
- unsigned int indx;
- struct bfd_link_hash_entry **pundef;
-
- if (! bfd_has_map (abfd))
- {
- /* An empty archive is a special case. */
- if (bfd_openr_next_archived_file (abfd, NULL) == NULL)
- return TRUE;
- bfd_set_error (bfd_error_no_armap);
- return FALSE;
- }
-
- arsyms = bfd_ardata (abfd)->symdefs;
- arsym_end = arsyms + bfd_ardata (abfd)->symdef_count;
-
- /* In order to quickly determine whether an symbol is defined in
- this archive, we build a hash table of the symbols. */
- if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc))
- return FALSE;
- for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++)
- {
- struct archive_hash_entry *arh;
- struct archive_list *l, **pp;
-
- arh = archive_hash_lookup (&arsym_hash, arsym->name, TRUE, FALSE);
- if (arh == NULL)
- goto error_return;
- l = ((struct archive_list *)
- archive_hash_allocate (&arsym_hash, sizeof (struct archive_list)));
- if (l == NULL)
- goto error_return;
- l->indx = indx;
- for (pp = &arh->defs; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = l;
- l->next = NULL;
- }
-
- /* The archive_pass field in the archive itself is used to
- initialize PASS, sine we may search the same archive multiple
- times. */
- pass = abfd->archive_pass + 1;
-
- /* New undefined symbols are added to the end of the list, so we
- only need to look through it once. */
- pundef = &info->hash->undefs;
- while (*pundef != NULL)
- {
- struct bfd_link_hash_entry *h;
- struct archive_hash_entry *arh;
- struct archive_list *l;
-
- h = *pundef;
-
- /* When a symbol is defined, it is not necessarily removed from
- the list. */
- if (h->type != bfd_link_hash_undefined
- && h->type != bfd_link_hash_common)
- {
- /* Remove this entry from the list, for general cleanliness
- and because we are going to look through the list again
- if we search any more libraries. We can't remove the
- entry if it is the tail, because that would lose any
- entries we add to the list later on (it would also cause
- us to lose track of whether the symbol has been
- referenced). */
- if (*pundef != info->hash->undefs_tail)
- *pundef = (*pundef)->und_next;
- else
- pundef = &(*pundef)->und_next;
- continue;
- }
-
- /* Look for this symbol in the archive symbol map. */
- arh = archive_hash_lookup (&arsym_hash, h->root.string, FALSE, FALSE);
- if (arh == NULL)
- {
- /* If we haven't found the exact symbol we're looking for,
- let's look for its import thunk */
- if (info->pei386_auto_import)
- {
- bfd_size_type amt = strlen (h->root.string) + 10;
- char *buf = bfd_malloc (amt);
- if (buf == NULL)
- return FALSE;
-
- sprintf (buf, "__imp_%s", h->root.string);
- arh = archive_hash_lookup (&arsym_hash, buf, FALSE, FALSE);
- free(buf);
- }
- if (arh == NULL)
- {
- pundef = &(*pundef)->und_next;
- continue;
- }
- }
- /* Look at all the objects which define this symbol. */
- for (l = arh->defs; l != NULL; l = l->next)
- {
- bfd *element;
- bfd_boolean needed;
-
- /* If the symbol has gotten defined along the way, quit. */
- if (h->type != bfd_link_hash_undefined
- && h->type != bfd_link_hash_common)
- break;
-
- element = bfd_get_elt_at_index (abfd, l->indx);
- if (element == NULL)
- goto error_return;
-
- /* If we've already included this element, or if we've
- already checked it on this pass, continue. */
- if (element->archive_pass == -1
- || element->archive_pass == pass)
- continue;
-
- /* If we can't figure this element out, just ignore it. */
- if (! bfd_check_format (element, bfd_object))
- {
- element->archive_pass = -1;
- continue;
- }
-
- /* CHECKFN will see if this element should be included, and
- go ahead and include it if appropriate. */
- if (! (*checkfn) (element, info, &needed))
- goto error_return;
-
- if (! needed)
- element->archive_pass = pass;
- else
- {
- element->archive_pass = -1;
-
- /* Increment the pass count to show that we may need to
- recheck object files which were already checked. */
- ++pass;
- }
- }
-
- pundef = &(*pundef)->und_next;
- }
-
- archive_hash_table_free (&arsym_hash);
-
- /* Save PASS in case we are called again. */
- abfd->archive_pass = pass;
-
- return TRUE;
-
- error_return:
- archive_hash_table_free (&arsym_hash);
- return FALSE;
-}
-
-/* See if we should include an archive element. This version is used
- when we do not want to automatically collect constructors based on
- the symbol name, presumably because we have some other mechanism
- for finding them. */
-
-static bfd_boolean
-generic_link_check_archive_element_no_collect (
- bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean *pneeded)
-{
- return generic_link_check_archive_element (abfd, info, pneeded, FALSE);
-}
-
-/* See if we should include an archive element. This version is used
- when we want to automatically collect constructors based on the
- symbol name, as collect2 does. */
-
-static bfd_boolean
-generic_link_check_archive_element_collect (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean *pneeded)
-{
- return generic_link_check_archive_element (abfd, info, pneeded, TRUE);
-}
-
-/* See if we should include an archive element. Optionally collect
- constructors. */
-
-static bfd_boolean
-generic_link_check_archive_element (bfd *abfd,
- struct bfd_link_info *info,
- bfd_boolean *pneeded,
- bfd_boolean collect)
-{
- asymbol **pp, **ppend;
-
- *pneeded = FALSE;
-
- if (! generic_link_read_symbols (abfd))
- return FALSE;
-
- pp = _bfd_generic_link_get_symbols (abfd);
- ppend = pp + _bfd_generic_link_get_symcount (abfd);
- for (; pp < ppend; pp++)
- {
- asymbol *p;
- struct bfd_link_hash_entry *h;
-
- p = *pp;
-
- /* We are only interested in globally visible symbols. */
- if (! bfd_is_com_section (p->section)
- && (p->flags & (BSF_GLOBAL | BSF_INDIRECT | BSF_WEAK)) == 0)
- continue;
-
- /* We are only interested if we know something about this
- symbol, and it is undefined or common. An undefined weak
- symbol (type bfd_link_hash_undefweak) is not considered to be
- a reference when pulling files out of an archive. See the
- SVR4 ABI, p. 4-27. */
- h = bfd_link_hash_lookup (info->hash, bfd_asymbol_name (p), FALSE,
- FALSE, TRUE);
- if (h == NULL
- || (h->type != bfd_link_hash_undefined
- && h->type != bfd_link_hash_common))
- continue;
-
- /* P is a symbol we are looking for. */
-
- if (! bfd_is_com_section (p->section))
- {
- bfd_size_type symcount;
- asymbol **symbols;
-
- /* This object file defines this symbol, so pull it in. */
- if (! (*info->callbacks->add_archive_element) (info, abfd,
- bfd_asymbol_name (p)))
- return FALSE;
- symcount = _bfd_generic_link_get_symcount (abfd);
- symbols = _bfd_generic_link_get_symbols (abfd);
- if (! generic_link_add_symbol_list (abfd, info, symcount,
- symbols, collect))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
-
- /* P is a common symbol. */
-
- if (h->type == bfd_link_hash_undefined)
- {
- bfd *symbfd;
- bfd_vma size;
- unsigned int power;
-
- symbfd = h->u.undef.abfd;
- if (symbfd == NULL)
- {
- /* This symbol was created as undefined from outside
- BFD. We assume that we should link in the object
- file. This is for the -u option in the linker. */
- if (! (*info->callbacks->add_archive_element)
- (info, abfd, bfd_asymbol_name (p)))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
-
- /* Turn the symbol into a common symbol but do not link in
- the object file. This is how a.out works. Object
- formats that require different semantics must implement
- this function differently. This symbol is already on the
- undefs list. We add the section to a common section
- attached to symbfd to ensure that it is in a BFD which
- will be linked in. */
- h->type = bfd_link_hash_common;
- h->u.c.p =
- bfd_hash_allocate (&info->hash->table,
- sizeof (struct bfd_link_hash_common_entry));
- if (h->u.c.p == NULL)
- return FALSE;
-
- size = bfd_asymbol_value (p);
- h->u.c.size = size;
-
- power = bfd_log2 (size);
- if (power > 4)
- power = 4;
- h->u.c.p->alignment_power = power;
-
- if (p->section == bfd_com_section_ptr)
- h->u.c.p->section = bfd_make_section_old_way (symbfd, "COMMON");
- else
- h->u.c.p->section = bfd_make_section_old_way (symbfd,
- p->section->name);
- h->u.c.p->section->flags = SEC_ALLOC;
- }
- else
- {
- /* Adjust the size of the common symbol if necessary. This
- is how a.out works. Object formats that require
- different semantics must implement this function
- differently. */
- if (bfd_asymbol_value (p) > h->u.c.size)
- h->u.c.size = bfd_asymbol_value (p);
- }
- }
-
- /* This archive element is not needed. */
- return TRUE;
-}
-
-/* Add the symbols from an object file to the global hash table. ABFD
- is the object file. INFO is the linker information. SYMBOL_COUNT
- is the number of symbols. SYMBOLS is the list of symbols. COLLECT
- is TRUE if constructors should be automatically collected by name
- as is done by collect2. */
-
-static bfd_boolean
-generic_link_add_symbol_list (bfd *abfd,
- struct bfd_link_info *info,
- bfd_size_type symbol_count,
- asymbol **symbols,
- bfd_boolean collect)
-{
- asymbol **pp, **ppend;
-
- pp = symbols;
- ppend = symbols + symbol_count;
- for (; pp < ppend; pp++)
- {
- asymbol *p;
-
- p = *pp;
-
- if ((p->flags & (BSF_INDIRECT
- | BSF_WARNING
- | BSF_GLOBAL
- | BSF_CONSTRUCTOR
- | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (p))
- || bfd_is_com_section (bfd_get_section (p))
- || bfd_is_ind_section (bfd_get_section (p)))
- {
- const char *name;
- const char *string;
- struct generic_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
-
- name = bfd_asymbol_name (p);
- if (((p->flags & BSF_INDIRECT) != 0
- || bfd_is_ind_section (p->section))
- && pp + 1 < ppend)
- {
- pp++;
- string = bfd_asymbol_name (*pp);
- }
- else if ((p->flags & BSF_WARNING) != 0
- && pp + 1 < ppend)
- {
- /* The name of P is actually the warning string, and the
- next symbol is the one to warn about. */
- string = name;
- pp++;
- name = bfd_asymbol_name (*pp);
- }
- else
- string = NULL;
-
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, p->flags, bfd_get_section (p),
- p->value, string, FALSE, collect, &bh)))
- return FALSE;
- h = (struct generic_link_hash_entry *) bh;
-
- /* If this is a constructor symbol, and the linker didn't do
- anything with it, then we want to just pass the symbol
- through to the output file. This will happen when
- linking with -r. */
- if ((p->flags & BSF_CONSTRUCTOR) != 0
- && (h == NULL || h->root.type == bfd_link_hash_new))
- {
- p->udata.p = NULL;
- continue;
- }
-
- /* Save the BFD symbol so that we don't lose any backend
- specific information that may be attached to it. We only
- want this one if it gives more information than the
- existing one; we don't want to replace a defined symbol
- with an undefined one. This routine may be called with a
- hash table other than the generic hash table, so we only
- do this if we are certain that the hash table is a
- generic one. */
- if (info->hash->creator == abfd->xvec)
- {
- if (h->sym == NULL
- || (! bfd_is_und_section (bfd_get_section (p))
- && (! bfd_is_com_section (bfd_get_section (p))
- || bfd_is_und_section (bfd_get_section (h->sym)))))
- {
- h->sym = p;
- /* BSF_OLD_COMMON is a hack to support COFF reloc
- reading, and it should go away when the COFF
- linker is switched to the new version. */
- if (bfd_is_com_section (bfd_get_section (p)))
- p->flags |= BSF_OLD_COMMON;
- }
- }
-
- /* Store a back pointer from the symbol to the hash
- table entry for the benefit of relaxation code until
- it gets rewritten to not use asymbol structures.
- Setting this is also used to check whether these
- symbols were set up by the generic linker. */
- p->udata.p = h;
- }
- }
-
- return TRUE;
-}
-
-/* We use a state table to deal with adding symbols from an object
- file. The first index into the state table describes the symbol
- from the object file. The second index into the state table is the
- type of the symbol in the hash table. */
-
-/* The symbol from the object file is turned into one of these row
- values. */
-
-enum link_row
-{
- UNDEF_ROW, /* Undefined. */
- UNDEFW_ROW, /* Weak undefined. */
- DEF_ROW, /* Defined. */
- DEFW_ROW, /* Weak defined. */
- COMMON_ROW, /* Common. */
- INDR_ROW, /* Indirect. */
- WARN_ROW, /* Warning. */
- SET_ROW /* Member of set. */
-};
-
-/* apparently needed for Hitachi 3050R(HI-UX/WE2)? */
-#undef FAIL
-
-/* The actions to take in the state table. */
-
-enum link_action
-{
- FAIL, /* Abort. */
- UND, /* Mark symbol undefined. */
- WEAK, /* Mark symbol weak undefined. */
- DEF, /* Mark symbol defined. */
- DEFW, /* Mark symbol weak defined. */
- COM, /* Mark symbol common. */
- REF, /* Mark defined symbol referenced. */
- CREF, /* Possibly warn about common reference to defined symbol. */
- CDEF, /* Define existing common symbol. */
- NOACT, /* No action. */
- BIG, /* Mark symbol common using largest size. */
- MDEF, /* Multiple definition error. */
- MIND, /* Multiple indirect symbols. */
- IND, /* Make indirect symbol. */
- CIND, /* Make indirect symbol from existing common symbol. */
- SET, /* Add value to set. */
- MWARN, /* Make warning symbol. */
- WARN, /* Issue warning. */
- CWARN, /* Warn if referenced, else MWARN. */
- CYCLE, /* Repeat with symbol pointed to. */
- REFC, /* Mark indirect symbol referenced and then CYCLE. */
- WARNC /* Issue warning and then CYCLE. */
-};
-
-/* The state table itself. The first index is a link_row and the
- second index is a bfd_link_hash_type. */
-
-static const enum link_action link_action[8][8] =
-{
- /* current\prev new undef undefw def defw com indr warn */
- /* UNDEF_ROW */ {UND, NOACT, UND, REF, REF, NOACT, REFC, WARNC },
- /* UNDEFW_ROW */ {WEAK, NOACT, NOACT, REF, REF, NOACT, REFC, WARNC },
- /* DEF_ROW */ {DEF, DEF, DEF, MDEF, DEF, CDEF, MDEF, CYCLE },
- /* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE },
- /* COMMON_ROW */ {COM, COM, COM, CREF, COM, BIG, REFC, WARNC },
- /* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE },
- /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, NOACT },
- /* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE }
-};
-
-/* Most of the entries in the LINK_ACTION table are straightforward,
- but a few are somewhat subtle.
-
- A reference to an indirect symbol (UNDEF_ROW/indr or
- UNDEFW_ROW/indr) is counted as a reference both to the indirect
- symbol and to the symbol the indirect symbol points to.
-
- A reference to a warning symbol (UNDEF_ROW/warn or UNDEFW_ROW/warn)
- causes the warning to be issued.
-
- A common definition of an indirect symbol (COMMON_ROW/indr) is
- treated as a multiple definition error. Likewise for an indirect
- definition of a common symbol (INDR_ROW/com).
-
- An indirect definition of a warning (INDR_ROW/warn) does not cause
- the warning to be issued.
-
- If a warning is created for an indirect symbol (WARN_ROW/indr) no
- warning is created for the symbol the indirect symbol points to.
-
- Adding an entry to a set does not count as a reference to a set,
- and no warning is issued (SET_ROW/warn). */
-
-/* Return the BFD in which a hash entry has been defined, if known. */
-
-static bfd *
-hash_entry_bfd (struct bfd_link_hash_entry *h)
-{
- while (h->type == bfd_link_hash_warning)
- h = h->u.i.link;
- switch (h->type)
- {
- default:
- return NULL;
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- return h->u.undef.abfd;
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->u.def.section->owner;
- case bfd_link_hash_common:
- return h->u.c.p->section->owner;
- }
- /*NOTREACHED*/
-}
-
-/* Add a symbol to the global hash table.
- ABFD is the BFD the symbol comes from.
- NAME is the name of the symbol.
- FLAGS is the BSF_* bits associated with the symbol.
- SECTION is the section in which the symbol is defined; this may be
- bfd_und_section_ptr or bfd_com_section_ptr.
- VALUE is the value of the symbol, relative to the section.
- STRING is used for either an indirect symbol, in which case it is
- the name of the symbol to indirect to, or a warning symbol, in
- which case it is the warning string.
- COPY is TRUE if NAME or STRING must be copied into locally
- allocated memory if they need to be saved.
- COLLECT is TRUE if we should automatically collect gcc constructor
- or destructor names as collect2 does.
- HASHP, if not NULL, is a place to store the created hash table
- entry; if *HASHP is not NULL, the caller has already looked up
- the hash table entry, and stored it in *HASHP. */
-
-bfd_boolean
-_bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
- bfd *abfd,
- const char *name,
- flagword flags,
- asection *section,
- bfd_vma value,
- const char *string,
- bfd_boolean copy,
- bfd_boolean collect,
- struct bfd_link_hash_entry **hashp)
-{
- enum link_row row;
- struct bfd_link_hash_entry *h;
- bfd_boolean cycle;
-
- if (bfd_is_ind_section (section)
- || (flags & BSF_INDIRECT) != 0)
- row = INDR_ROW;
- else if ((flags & BSF_WARNING) != 0)
- row = WARN_ROW;
- else if ((flags & BSF_CONSTRUCTOR) != 0)
- row = SET_ROW;
- else if (bfd_is_und_section (section))
- {
- if ((flags & BSF_WEAK) != 0)
- row = UNDEFW_ROW;
- else
- row = UNDEF_ROW;
- }
- else if ((flags & BSF_WEAK) != 0)
- row = DEFW_ROW;
- else if (bfd_is_com_section (section))
- row = COMMON_ROW;
- else
- row = DEF_ROW;
-
- if (hashp != NULL && *hashp != NULL)
- h = *hashp;
- else
- {
- if (row == UNDEF_ROW || row == UNDEFW_ROW)
- h = bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, copy, FALSE);
- else
- h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
- if (h == NULL)
- {
- if (hashp != NULL)
- *hashp = NULL;
- return FALSE;
- }
- }
-
- if (info->notice_all
- || (info->notice_hash != NULL
- && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
- {
- if (! (*info->callbacks->notice) (info, h->root.string, abfd, section,
- value))
- return FALSE;
- }
-
- if (hashp != NULL)
- *hashp = h;
-
- do
- {
- enum link_action action;
-
- cycle = FALSE;
- action = link_action[(int) row][(int) h->type];
- switch (action)
- {
- case FAIL:
- abort ();
-
- case NOACT:
- /* Do nothing. */
- break;
-
- case UND:
- /* Make a new undefined symbol. */
- h->type = bfd_link_hash_undefined;
- h->u.undef.abfd = abfd;
- bfd_link_add_undef (info->hash, h);
- break;
-
- case WEAK:
- /* Make a new weak undefined symbol. */
- h->type = bfd_link_hash_undefweak;
- h->u.undef.abfd = abfd;
- break;
-
- case CDEF:
- /* We have found a definition for a symbol which was
- previously common. */
- BFD_ASSERT (h->type == bfd_link_hash_common);
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.string,
- h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
- abfd, bfd_link_hash_defined, 0)))
- return FALSE;
- /* Fall through. */
- case DEF:
- case DEFW:
- {
- enum bfd_link_hash_type oldtype;
-
- /* Define a symbol. */
- oldtype = h->type;
- if (action == DEFW)
- h->type = bfd_link_hash_defweak;
- else
- h->type = bfd_link_hash_defined;
- h->u.def.section = section;
- h->u.def.value = value;
-
- /* If we have been asked to, we act like collect2 and
- identify all functions that might be global
- constructors and destructors and pass them up in a
- callback. We only do this for certain object file
- types, since many object file types can handle this
- automatically. */
- if (collect && name[0] == '_')
- {
- const char *s;
-
- /* A constructor or destructor name starts like this:
- _+GLOBAL_[_.$][ID][_.$] where the first [_.$] and
- the second are the same character (we accept any
- character there, in case a new object file format
- comes along with even worse naming restrictions). */
-
-#define CONS_PREFIX "GLOBAL_"
-#define CONS_PREFIX_LEN (sizeof CONS_PREFIX - 1)
-
- s = name + 1;
- while (*s == '_')
- ++s;
- if (s[0] == 'G'
- && strncmp (s, CONS_PREFIX, CONS_PREFIX_LEN - 1) == 0)
- {
- char c;
-
- c = s[CONS_PREFIX_LEN + 1];
- if ((c == 'I' || c == 'D')
- && s[CONS_PREFIX_LEN] == s[CONS_PREFIX_LEN + 2])
- {
- /* If this is a definition of a symbol which
- was previously weakly defined, we are in
- trouble. We have already added a
- constructor entry for the weak defined
- symbol, and now we are trying to add one
- for the new symbol. Fortunately, this case
- should never arise in practice. */
- if (oldtype == bfd_link_hash_defweak)
- abort ();
-
- if (! ((*info->callbacks->constructor)
- (info, c == 'I',
- h->root.string, abfd, section, value)))
- return FALSE;
- }
- }
- }
- }
-
- break;
-
- case COM:
- /* We have found a common definition for a symbol. */
- if (h->type == bfd_link_hash_new)
- bfd_link_add_undef (info->hash, h);
- h->type = bfd_link_hash_common;
- h->u.c.p =
- bfd_hash_allocate (&info->hash->table,
- sizeof (struct bfd_link_hash_common_entry));
- if (h->u.c.p == NULL)
- return FALSE;
-
- h->u.c.size = value;
-
- /* Select a default alignment based on the size. This may
- be overridden by the caller. */
- {
- unsigned int power;
-
- power = bfd_log2 (value);
- if (power > 4)
- power = 4;
- h->u.c.p->alignment_power = power;
- }
-
- /* The section of a common symbol is only used if the common
- symbol is actually allocated. It basically provides a
- hook for the linker script to decide which output section
- the common symbols should be put in. In most cases, the
- section of a common symbol will be bfd_com_section_ptr,
- the code here will choose a common symbol section named
- "COMMON", and the linker script will contain *(COMMON) in
- the appropriate place. A few targets use separate common
- sections for small symbols, and they require special
- handling. */
- if (section == bfd_com_section_ptr)
- {
- h->u.c.p->section = bfd_make_section_old_way (abfd, "COMMON");
- h->u.c.p->section->flags = SEC_ALLOC;
- }
- else if (section->owner != abfd)
- {
- h->u.c.p->section = bfd_make_section_old_way (abfd,
- section->name);
- h->u.c.p->section->flags = SEC_ALLOC;
- }
- else
- h->u.c.p->section = section;
- break;
-
- case REF:
- /* A reference to a defined symbol. */
- if (h->und_next == NULL && info->hash->undefs_tail != h)
- h->und_next = h;
- break;
-
- case BIG:
- /* We have found a common definition for a symbol which
- already had a common definition. Use the maximum of the
- two sizes, and use the section required by the larger symbol. */
- BFD_ASSERT (h->type == bfd_link_hash_common);
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.string,
- h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
- abfd, bfd_link_hash_common, value)))
- return FALSE;
- if (value > h->u.c.size)
- {
- unsigned int power;
-
- h->u.c.size = value;
-
- /* Select a default alignment based on the size. This may
- be overridden by the caller. */
- power = bfd_log2 (value);
- if (power > 4)
- power = 4;
- h->u.c.p->alignment_power = power;
-
- /* Some systems have special treatment for small commons,
- hence we want to select the section used by the larger
- symbol. This makes sure the symbol does not go in a
- small common section if it is now too large. */
- if (section == bfd_com_section_ptr)
- {
- h->u.c.p->section
- = bfd_make_section_old_way (abfd, "COMMON");
- h->u.c.p->section->flags = SEC_ALLOC;
- }
- else if (section->owner != abfd)
- {
- h->u.c.p->section
- = bfd_make_section_old_way (abfd, section->name);
- h->u.c.p->section->flags = SEC_ALLOC;
- }
- else
- h->u.c.p->section = section;
- }
- break;
-
- case CREF:
- {
- bfd *obfd;
-
- /* We have found a common definition for a symbol which
- was already defined. FIXME: It would nice if we could
- report the BFD which defined an indirect symbol, but we
- don't have anywhere to store the information. */
- if (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_defweak)
- obfd = h->u.def.section->owner;
- else
- obfd = NULL;
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.string, obfd, h->type, 0,
- abfd, bfd_link_hash_common, value)))
- return FALSE;
- }
- break;
-
- case MIND:
- /* Multiple indirect symbols. This is OK if they both point
- to the same symbol. */
- if (strcmp (h->u.i.link->root.string, string) == 0)
- break;
- /* Fall through. */
- case MDEF:
- /* Handle a multiple definition. */
- if (!info->allow_multiple_definition)
- {
- asection *msec = NULL;
- bfd_vma mval = 0;
-
- switch (h->type)
- {
- case bfd_link_hash_defined:
- msec = h->u.def.section;
- mval = h->u.def.value;
- break;
- case bfd_link_hash_indirect:
- msec = bfd_ind_section_ptr;
- mval = 0;
- break;
- default:
- abort ();
- }
-
- /* Ignore a redefinition of an absolute symbol to the
- same value; it's harmless. */
- if (h->type == bfd_link_hash_defined
- && bfd_is_abs_section (msec)
- && bfd_is_abs_section (section)
- && value == mval)
- break;
-
- if (! ((*info->callbacks->multiple_definition)
- (info, h->root.string, msec->owner, msec, mval,
- abfd, section, value)))
- return FALSE;
- }
- break;
-
- case CIND:
- /* Create an indirect symbol from an existing common symbol. */
- BFD_ASSERT (h->type == bfd_link_hash_common);
- if (! ((*info->callbacks->multiple_common)
- (info, h->root.string,
- h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
- abfd, bfd_link_hash_indirect, 0)))
- return FALSE;
- /* Fall through. */
- case IND:
- /* Create an indirect symbol. */
- {
- struct bfd_link_hash_entry *inh;
-
- /* STRING is the name of the symbol we want to indirect
- to. */
- inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE,
- copy, FALSE);
- if (inh == NULL)
- return FALSE;
- if (inh->type == bfd_link_hash_indirect
- && inh->u.i.link == h)
- {
- (*_bfd_error_handler)
- (_("%s: indirect symbol `%s' to `%s' is a loop"),
- bfd_archive_filename (abfd), name, string);
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
- if (inh->type == bfd_link_hash_new)
- {
- inh->type = bfd_link_hash_undefined;
- inh->u.undef.abfd = abfd;
- bfd_link_add_undef (info->hash, inh);
- }
-
- /* If the indirect symbol has been referenced, we need to
- push the reference down to the symbol we are
- referencing. */
- if (h->type != bfd_link_hash_new)
- {
- row = UNDEF_ROW;
- cycle = TRUE;
- }
-
- h->type = bfd_link_hash_indirect;
- h->u.i.link = inh;
- }
- break;
-
- case SET:
- /* Add an entry to a set. */
- if (! (*info->callbacks->add_to_set) (info, h, BFD_RELOC_CTOR,
- abfd, section, value))
- return FALSE;
- break;
-
- case WARNC:
- /* Issue a warning and cycle. */
- if (h->u.i.warning != NULL)
- {
- if (! (*info->callbacks->warning) (info, h->u.i.warning,
- h->root.string, abfd,
- NULL, 0))
- return FALSE;
- /* Only issue a warning once. */
- h->u.i.warning = NULL;
- }
- /* Fall through. */
- case CYCLE:
- /* Try again with the referenced symbol. */
- h = h->u.i.link;
- cycle = TRUE;
- break;
-
- case REFC:
- /* A reference to an indirect symbol. */
- if (h->und_next == NULL && info->hash->undefs_tail != h)
- h->und_next = h;
- h = h->u.i.link;
- cycle = TRUE;
- break;
-
- case WARN:
- /* Issue a warning. */
- if (! (*info->callbacks->warning) (info, string, h->root.string,
- hash_entry_bfd (h), NULL, 0))
- return FALSE;
- break;
-
- case CWARN:
- /* Warn if this symbol has been referenced already,
- otherwise add a warning. A symbol has been referenced if
- the und_next field is not NULL, or it is the tail of the
- undefined symbol list. The REF case above helps to
- ensure this. */
- if (h->und_next != NULL || info->hash->undefs_tail == h)
- {
- if (! (*info->callbacks->warning) (info, string, h->root.string,
- hash_entry_bfd (h), NULL, 0))
- return FALSE;
- break;
- }
- /* Fall through. */
- case MWARN:
- /* Make a warning symbol. */
- {
- struct bfd_link_hash_entry *sub;
-
- /* STRING is the warning to give. */
- sub = ((struct bfd_link_hash_entry *)
- ((*info->hash->table.newfunc)
- (NULL, &info->hash->table, h->root.string)));
- if (sub == NULL)
- return FALSE;
- *sub = *h;
- sub->type = bfd_link_hash_warning;
- sub->u.i.link = h;
- if (! copy)
- sub->u.i.warning = string;
- else
- {
- char *w;
- size_t len = strlen (string) + 1;
-
- w = bfd_hash_allocate (&info->hash->table, len);
- if (w == NULL)
- return FALSE;
- memcpy (w, string, len);
- sub->u.i.warning = w;
- }
-
- bfd_hash_replace (&info->hash->table,
- (struct bfd_hash_entry *) h,
- (struct bfd_hash_entry *) sub);
- if (hashp != NULL)
- *hashp = sub;
- }
- break;
- }
- }
- while (cycle);
-
- return TRUE;
-}
-
-/* Generic final link routine. */
-
-bfd_boolean
-_bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
-{
- bfd *sub;
- asection *o;
- struct bfd_link_order *p;
- size_t outsymalloc;
- struct generic_write_global_symbol_info wginfo;
-
- bfd_get_outsymbols (abfd) = NULL;
- bfd_get_symcount (abfd) = 0;
- outsymalloc = 0;
-
- /* Mark all sections which will be included in the output file. */
- for (o = abfd->sections; o != NULL; o = o->next)
- for (p = o->link_order_head; p != NULL; p = p->next)
- if (p->type == bfd_indirect_link_order)
- p->u.indirect.section->linker_mark = TRUE;
-
- /* Build the output symbol table. */
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc))
- return FALSE;
-
- /* Accumulate the global symbols. */
- wginfo.info = info;
- wginfo.output_bfd = abfd;
- wginfo.psymalloc = &outsymalloc;
- _bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info),
- _bfd_generic_link_write_global_symbol,
- &wginfo);
-
- /* Make sure we have a trailing NULL pointer on OUTSYMBOLS. We
- shouldn't really need one, since we have SYMCOUNT, but some old
- code still expects one. */
- if (! generic_add_output_symbol (abfd, &outsymalloc, NULL))
- return FALSE;
-
- if (info->relocatable)
- {
- /* Allocate space for the output relocs for each section. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- o->reloc_count = 0;
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- ++o->reloc_count;
- else if (p->type == bfd_indirect_link_order)
- {
- asection *input_section;
- bfd *input_bfd;
- long relsize;
- arelent **relocs;
- asymbol **symbols;
- long reloc_count;
-
- input_section = p->u.indirect.section;
- input_bfd = input_section->owner;
- relsize = bfd_get_reloc_upper_bound (input_bfd,
- input_section);
- if (relsize < 0)
- return FALSE;
- relocs = bfd_malloc (relsize);
- if (!relocs && relsize != 0)
- return FALSE;
- symbols = _bfd_generic_link_get_symbols (input_bfd);
- reloc_count = bfd_canonicalize_reloc (input_bfd,
- input_section,
- relocs,
- symbols);
- free (relocs);
- if (reloc_count < 0)
- return FALSE;
- BFD_ASSERT ((unsigned long) reloc_count
- == input_section->reloc_count);
- o->reloc_count += reloc_count;
- }
- }
- if (o->reloc_count > 0)
- {
- bfd_size_type amt;
-
- amt = o->reloc_count;
- amt *= sizeof (arelent *);
- o->orelocation = bfd_alloc (abfd, amt);
- if (!o->orelocation)
- return FALSE;
- o->flags |= SEC_RELOC;
- /* Reset the count so that it can be used as an index
- when putting in the output relocs. */
- o->reloc_count = 0;
- }
- }
- }
-
- /* Handle all the link order information for the sections. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- switch (p->type)
- {
- case bfd_section_reloc_link_order:
- case bfd_symbol_reloc_link_order:
- if (! _bfd_generic_reloc_link_order (abfd, info, o, p))
- return FALSE;
- break;
- case bfd_indirect_link_order:
- if (! default_indirect_link_order (abfd, info, o, p, TRUE))
- return FALSE;
- break;
- default:
- if (! _bfd_default_link_order (abfd, info, o, p))
- return FALSE;
- break;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Add an output symbol to the output BFD. */
-
-static bfd_boolean
-generic_add_output_symbol (bfd *output_bfd, size_t *psymalloc, asymbol *sym)
-{
- if (bfd_get_symcount (output_bfd) >= *psymalloc)
- {
- asymbol **newsyms;
- bfd_size_type amt;
-
- if (*psymalloc == 0)
- *psymalloc = 124;
- else
- *psymalloc *= 2;
- amt = *psymalloc;
- amt *= sizeof (asymbol *);
- newsyms = bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
- if (newsyms == NULL)
- return FALSE;
- bfd_get_outsymbols (output_bfd) = newsyms;
- }
-
- bfd_get_outsymbols (output_bfd) [bfd_get_symcount (output_bfd)] = sym;
- if (sym != NULL)
- ++ bfd_get_symcount (output_bfd);
-
- return TRUE;
-}
-
-/* Handle the symbols for an input BFD. */
-
-bfd_boolean
-_bfd_generic_link_output_symbols (bfd *output_bfd,
- bfd *input_bfd,
- struct bfd_link_info *info,
- size_t *psymalloc)
-{
- asymbol **sym_ptr;
- asymbol **sym_end;
-
- if (! generic_link_read_symbols (input_bfd))
- return FALSE;
-
- /* Create a filename symbol if we are supposed to. */
- if (info->create_object_symbols_section != NULL)
- {
- asection *sec;
-
- for (sec = input_bfd->sections; sec != NULL; sec = sec->next)
- {
- if (sec->output_section == info->create_object_symbols_section)
- {
- asymbol *newsym;
-
- newsym = bfd_make_empty_symbol (input_bfd);
- if (!newsym)
- return FALSE;
- newsym->name = input_bfd->filename;
- newsym->value = 0;
- newsym->flags = BSF_LOCAL | BSF_FILE;
- newsym->section = sec;
-
- if (! generic_add_output_symbol (output_bfd, psymalloc,
- newsym))
- return FALSE;
-
- break;
- }
- }
- }
-
- /* Adjust the values of the globally visible symbols, and write out
- local symbols. */
- sym_ptr = _bfd_generic_link_get_symbols (input_bfd);
- sym_end = sym_ptr + _bfd_generic_link_get_symcount (input_bfd);
- for (; sym_ptr < sym_end; sym_ptr++)
- {
- asymbol *sym;
- struct generic_link_hash_entry *h;
- bfd_boolean output;
-
- h = NULL;
- sym = *sym_ptr;
- if ((sym->flags & (BSF_INDIRECT
- | BSF_WARNING
- | BSF_GLOBAL
- | BSF_CONSTRUCTOR
- | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (sym))
- || bfd_is_com_section (bfd_get_section (sym))
- || bfd_is_ind_section (bfd_get_section (sym)))
- {
- if (sym->udata.p != NULL)
- h = sym->udata.p;
- else if ((sym->flags & BSF_CONSTRUCTOR) != 0)
- {
- /* This case normally means that the main linker code
- deliberately ignored this constructor symbol. We
- should just pass it through. This will screw up if
- the constructor symbol is from a different,
- non-generic, object file format, but the case will
- only arise when linking with -r, which will probably
- fail anyhow, since there will be no way to represent
- the relocs in the output format being used. */
- h = NULL;
- }
- else if (bfd_is_und_section (bfd_get_section (sym)))
- h = ((struct generic_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, info,
- bfd_asymbol_name (sym),
- FALSE, FALSE, TRUE));
- else
- h = _bfd_generic_link_hash_lookup (_bfd_generic_hash_table (info),
- bfd_asymbol_name (sym),
- FALSE, FALSE, TRUE);
-
- if (h != NULL)
- {
- /* Force all references to this symbol to point to
- the same area in memory. It is possible that
- this routine will be called with a hash table
- other than a generic hash table, so we double
- check that. */
- if (info->hash->creator == input_bfd->xvec)
- {
- if (h->sym != NULL)
- *sym_ptr = sym = h->sym;
- }
-
- switch (h->root.type)
- {
- default:
- case bfd_link_hash_new:
- abort ();
- case bfd_link_hash_undefined:
- break;
- case bfd_link_hash_undefweak:
- sym->flags |= BSF_WEAK;
- break;
- case bfd_link_hash_indirect:
- h = (struct generic_link_hash_entry *) h->root.u.i.link;
- /* fall through */
- case bfd_link_hash_defined:
- sym->flags |= BSF_GLOBAL;
- sym->flags &=~ BSF_CONSTRUCTOR;
- sym->value = h->root.u.def.value;
- sym->section = h->root.u.def.section;
- break;
- case bfd_link_hash_defweak:
- sym->flags |= BSF_WEAK;
- sym->flags &=~ BSF_CONSTRUCTOR;
- sym->value = h->root.u.def.value;
- sym->section = h->root.u.def.section;
- break;
- case bfd_link_hash_common:
- sym->value = h->root.u.c.size;
- sym->flags |= BSF_GLOBAL;
- if (! bfd_is_com_section (sym->section))
- {
- BFD_ASSERT (bfd_is_und_section (sym->section));
- sym->section = bfd_com_section_ptr;
- }
- /* We do not set the section of the symbol to
- h->root.u.c.p->section. That value was saved so
- that we would know where to allocate the symbol
- if it was defined. In this case the type is
- still bfd_link_hash_common, so we did not define
- it, so we do not want to use that section. */
- break;
- }
- }
- }
-
- /* This switch is straight from the old code in
- write_file_locals in ldsym.c. */
- if (info->strip == strip_all
- || (info->strip == strip_some
- && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
- FALSE, FALSE) == NULL))
- output = FALSE;
- else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
- {
- /* If this symbol is marked as occurring now, rather
- than at the end, output it now. This is used for
- COFF C_EXT FCN symbols. FIXME: There must be a
- better way. */
- if (bfd_asymbol_bfd (sym) == input_bfd
- && (sym->flags & BSF_NOT_AT_END) != 0)
- output = TRUE;
- else
- output = FALSE;
- }
- else if (bfd_is_ind_section (sym->section))
- output = FALSE;
- else if ((sym->flags & BSF_DEBUGGING) != 0)
- {
- if (info->strip == strip_none)
- output = TRUE;
- else
- output = FALSE;
- }
- else if (bfd_is_und_section (sym->section)
- || bfd_is_com_section (sym->section))
- output = FALSE;
- else if ((sym->flags & BSF_LOCAL) != 0)
- {
- if ((sym->flags & BSF_WARNING) != 0)
- output = FALSE;
- else
- {
- switch (info->discard)
- {
- default:
- case discard_all:
- output = FALSE;
- break;
- case discard_sec_merge:
- output = TRUE;
- if (info->relocatable
- || ! (sym->section->flags & SEC_MERGE))
- break;
- /* FALLTHROUGH */
- case discard_l:
- if (bfd_is_local_label (input_bfd, sym))
- output = FALSE;
- else
- output = TRUE;
- break;
- case discard_none:
- output = TRUE;
- break;
- }
- }
- }
- else if ((sym->flags & BSF_CONSTRUCTOR))
- {
- if (info->strip != strip_all)
- output = TRUE;
- else
- output = FALSE;
- }
- else
- abort ();
-
- /* If this symbol is in a section which is not being included
- in the output file, then we don't want to output the symbol.
-
- Gross. .bss and similar sections won't have the linker_mark
- field set. */
- if ((sym->section->flags & SEC_HAS_CONTENTS) != 0
- && ! sym->section->linker_mark)
- output = FALSE;
-
- if (output)
- {
- if (! generic_add_output_symbol (output_bfd, psymalloc, sym))
- return FALSE;
- if (h != NULL)
- h->written = TRUE;
- }
- }
-
- return TRUE;
-}
-
-/* Set the section and value of a generic BFD symbol based on a linker
- hash table entry. */
-
-static void
-set_symbol_from_hash (asymbol *sym, struct bfd_link_hash_entry *h)
-{
- switch (h->type)
- {
- default:
- abort ();
- break;
- case bfd_link_hash_new:
- /* This can happen when a constructor symbol is seen but we are
- not building constructors. */
- if (sym->section != NULL)
- {
- BFD_ASSERT ((sym->flags & BSF_CONSTRUCTOR) != 0);
- }
- else
- {
- sym->flags |= BSF_CONSTRUCTOR;
- sym->section = bfd_abs_section_ptr;
- sym->value = 0;
- }
- break;
- case bfd_link_hash_undefined:
- sym->section = bfd_und_section_ptr;
- sym->value = 0;
- break;
- case bfd_link_hash_undefweak:
- sym->section = bfd_und_section_ptr;
- sym->value = 0;
- sym->flags |= BSF_WEAK;
- break;
- case bfd_link_hash_defined:
- sym->section = h->u.def.section;
- sym->value = h->u.def.value;
- break;
- case bfd_link_hash_defweak:
- sym->flags |= BSF_WEAK;
- sym->section = h->u.def.section;
- sym->value = h->u.def.value;
- break;
- case bfd_link_hash_common:
- sym->value = h->u.c.size;
- if (sym->section == NULL)
- sym->section = bfd_com_section_ptr;
- else if (! bfd_is_com_section (sym->section))
- {
- BFD_ASSERT (bfd_is_und_section (sym->section));
- sym->section = bfd_com_section_ptr;
- }
- /* Do not set the section; see _bfd_generic_link_output_symbols. */
- break;
- case bfd_link_hash_indirect:
- case bfd_link_hash_warning:
- /* FIXME: What should we do here? */
- break;
- }
-}
-
-/* Write out a global symbol, if it hasn't already been written out.
- This is called for each symbol in the hash table. */
-
-bfd_boolean
-_bfd_generic_link_write_global_symbol (struct generic_link_hash_entry *h,
- void *data)
-{
- struct generic_write_global_symbol_info *wginfo = data;
- asymbol *sym;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct generic_link_hash_entry *) h->root.u.i.link;
-
- if (h->written)
- return TRUE;
-
- h->written = TRUE;
-
- if (wginfo->info->strip == strip_all
- || (wginfo->info->strip == strip_some
- && bfd_hash_lookup (wginfo->info->keep_hash, h->root.root.string,
- FALSE, FALSE) == NULL))
- return TRUE;
-
- if (h->sym != NULL)
- sym = h->sym;
- else
- {
- sym = bfd_make_empty_symbol (wginfo->output_bfd);
- if (!sym)
- return FALSE;
- sym->name = h->root.root.string;
- sym->flags = 0;
- }
-
- set_symbol_from_hash (sym, &h->root);
-
- sym->flags |= BSF_GLOBAL;
-
- if (! generic_add_output_symbol (wginfo->output_bfd, wginfo->psymalloc,
- sym))
- {
- /* FIXME: No way to return failure. */
- abort ();
- }
-
- return TRUE;
-}
-
-/* Create a relocation. */
-
-bfd_boolean
-_bfd_generic_reloc_link_order (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- struct bfd_link_order *link_order)
-{
- arelent *r;
-
- if (! info->relocatable)
- abort ();
- if (sec->orelocation == NULL)
- abort ();
-
- r = bfd_alloc (abfd, sizeof (arelent));
- if (r == NULL)
- return FALSE;
-
- r->address = link_order->offset;
- r->howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
- if (r->howto == 0)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- /* Get the symbol to use for the relocation. */
- if (link_order->type == bfd_section_reloc_link_order)
- r->sym_ptr_ptr = link_order->u.reloc.p->u.section->symbol_ptr_ptr;
- else
- {
- struct generic_link_hash_entry *h;
-
- h = ((struct generic_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info,
- link_order->u.reloc.p->u.name,
- FALSE, FALSE, TRUE));
- if (h == NULL
- || ! h->written)
- {
- if (! ((*info->callbacks->unattached_reloc)
- (info, link_order->u.reloc.p->u.name, NULL, NULL, 0)))
- return FALSE;
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- r->sym_ptr_ptr = &h->sym;
- }
-
- /* If this is an inplace reloc, write the addend to the object file.
- Otherwise, store it in the reloc addend. */
- if (! r->howto->partial_inplace)
- r->addend = link_order->u.reloc.p->addend;
- else
- {
- bfd_size_type size;
- bfd_reloc_status_type rstat;
- bfd_byte *buf;
- bfd_boolean ok;
- file_ptr loc;
-
- size = bfd_get_reloc_size (r->howto);
- buf = bfd_zmalloc (size);
- if (buf == NULL)
- return FALSE;
- rstat = _bfd_relocate_contents (r->howto, abfd,
- (bfd_vma) link_order->u.reloc.p->addend,
- buf);
- switch (rstat)
- {
- case bfd_reloc_ok:
- break;
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- if (! ((*info->callbacks->reloc_overflow)
- (info,
- (link_order->type == bfd_section_reloc_link_order
- ? bfd_section_name (abfd, link_order->u.reloc.p->u.section)
- : link_order->u.reloc.p->u.name),
- r->howto->name, link_order->u.reloc.p->addend,
- NULL, NULL, 0)))
- {
- free (buf);
- return FALSE;
- }
- break;
- }
- loc = link_order->offset * bfd_octets_per_byte (abfd);
- ok = bfd_set_section_contents (abfd, sec, buf, loc, size);
- free (buf);
- if (! ok)
- return FALSE;
-
- r->addend = 0;
- }
-
- sec->orelocation[sec->reloc_count] = r;
- ++sec->reloc_count;
-
- return TRUE;
-}
-
-/* Allocate a new link_order for a section. */
-
-struct bfd_link_order *
-bfd_new_link_order (bfd *abfd, asection *section)
-{
- bfd_size_type amt = sizeof (struct bfd_link_order);
- struct bfd_link_order *new;
-
- new = bfd_zalloc (abfd, amt);
- if (!new)
- return NULL;
-
- new->type = bfd_undefined_link_order;
-
- if (section->link_order_tail != NULL)
- section->link_order_tail->next = new;
- else
- section->link_order_head = new;
- section->link_order_tail = new;
-
- return new;
-}
-
-/* Default link order processing routine. Note that we can not handle
- the reloc_link_order types here, since they depend upon the details
- of how the particular backends generates relocs. */
-
-bfd_boolean
-_bfd_default_link_order (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- struct bfd_link_order *link_order)
-{
- switch (link_order->type)
- {
- case bfd_undefined_link_order:
- case bfd_section_reloc_link_order:
- case bfd_symbol_reloc_link_order:
- default:
- abort ();
- case bfd_indirect_link_order:
- return default_indirect_link_order (abfd, info, sec, link_order,
- FALSE);
- case bfd_data_link_order:
- return default_data_link_order (abfd, info, sec, link_order);
- }
-}
-
-/* Default routine to handle a bfd_data_link_order. */
-
-static bfd_boolean
-default_data_link_order (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec,
- struct bfd_link_order *link_order)
-{
- bfd_size_type size;
- size_t fill_size;
- bfd_byte *fill;
- file_ptr loc;
- bfd_boolean result;
-
- BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0);
-
- size = link_order->size;
- if (size == 0)
- return TRUE;
-
- fill = link_order->u.data.contents;
- fill_size = link_order->u.data.size;
- if (fill_size != 0 && fill_size < size)
- {
- bfd_byte *p;
- fill = bfd_malloc (size);
- if (fill == NULL)
- return FALSE;
- p = fill;
- if (fill_size == 1)
- memset (p, (int) link_order->u.data.contents[0], (size_t) size);
- else
- {
- do
- {
- memcpy (p, link_order->u.data.contents, fill_size);
- p += fill_size;
- size -= fill_size;
- }
- while (size >= fill_size);
- if (size != 0)
- memcpy (p, link_order->u.data.contents, (size_t) size);
- size = link_order->size;
- }
- }
-
- loc = link_order->offset * bfd_octets_per_byte (abfd);
- result = bfd_set_section_contents (abfd, sec, fill, loc, size);
-
- if (fill != link_order->u.data.contents)
- free (fill);
- return result;
-}
-
-/* Default routine to handle a bfd_indirect_link_order. */
-
-static bfd_boolean
-default_indirect_link_order (bfd *output_bfd,
- struct bfd_link_info *info,
- asection *output_section,
- struct bfd_link_order *link_order,
- bfd_boolean generic_linker)
-{
- asection *input_section;
- bfd *input_bfd;
- bfd_byte *contents = NULL;
- bfd_byte *new_contents;
- bfd_size_type sec_size;
- file_ptr loc;
-
- BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
-
- if (link_order->size == 0)
- return TRUE;
-
- input_section = link_order->u.indirect.section;
- input_bfd = input_section->owner;
-
- BFD_ASSERT (input_section->output_section == output_section);
- BFD_ASSERT (input_section->output_offset == link_order->offset);
- BFD_ASSERT (input_section->_cooked_size == link_order->size);
-
- if (info->relocatable
- && input_section->reloc_count > 0
- && output_section->orelocation == NULL)
- {
- /* Space has not been allocated for the output relocations.
- This can happen when we are called by a specific backend
- because somebody is attempting to link together different
- types of object files. Handling this case correctly is
- difficult, and sometimes impossible. */
- (*_bfd_error_handler)
- (_("Attempt to do relocatable link with %s input and %s output"),
- bfd_get_target (input_bfd), bfd_get_target (output_bfd));
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- if (! generic_linker)
- {
- asymbol **sympp;
- asymbol **symppend;
-
- /* Get the canonical symbols. The generic linker will always
- have retrieved them by this point, but we are being called by
- a specific linker, presumably because we are linking
- different types of object files together. */
- if (! generic_link_read_symbols (input_bfd))
- return FALSE;
-
- /* Since we have been called by a specific linker, rather than
- the generic linker, the values of the symbols will not be
- right. They will be the values as seen in the input file,
- not the values of the final link. We need to fix them up
- before we can relocate the section. */
- sympp = _bfd_generic_link_get_symbols (input_bfd);
- symppend = sympp + _bfd_generic_link_get_symcount (input_bfd);
- for (; sympp < symppend; sympp++)
- {
- asymbol *sym;
- struct bfd_link_hash_entry *h;
-
- sym = *sympp;
-
- if ((sym->flags & (BSF_INDIRECT
- | BSF_WARNING
- | BSF_GLOBAL
- | BSF_CONSTRUCTOR
- | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (sym))
- || bfd_is_com_section (bfd_get_section (sym))
- || bfd_is_ind_section (bfd_get_section (sym)))
- {
- /* sym->udata may have been set by
- generic_link_add_symbol_list. */
- if (sym->udata.p != NULL)
- h = sym->udata.p;
- else if (bfd_is_und_section (bfd_get_section (sym)))
- h = bfd_wrapped_link_hash_lookup (output_bfd, info,
- bfd_asymbol_name (sym),
- FALSE, FALSE, TRUE);
- else
- h = bfd_link_hash_lookup (info->hash,
- bfd_asymbol_name (sym),
- FALSE, FALSE, TRUE);
- if (h != NULL)
- set_symbol_from_hash (sym, h);
- }
- }
- }
-
- /* Get and relocate the section contents. */
- sec_size = bfd_section_size (input_bfd, input_section);
- contents = bfd_malloc (sec_size);
- if (contents == NULL && sec_size != 0)
- goto error_return;
- new_contents = (bfd_get_relocated_section_contents
- (output_bfd, info, link_order, contents, info->relocatable,
- _bfd_generic_link_get_symbols (input_bfd)));
- if (!new_contents)
- goto error_return;
-
- /* Output the section contents. */
- loc = link_order->offset * bfd_octets_per_byte (output_bfd);
- if (! bfd_set_section_contents (output_bfd, output_section,
- new_contents, loc, link_order->size))
- goto error_return;
-
- if (contents != NULL)
- free (contents);
- return TRUE;
-
- error_return:
- if (contents != NULL)
- free (contents);
- return FALSE;
-}
-
-/* A little routine to count the number of relocs in a link_order
- list. */
-
-unsigned int
-_bfd_count_link_order_relocs (struct bfd_link_order *link_order)
-{
- register unsigned int c;
- register struct bfd_link_order *l;
-
- c = 0;
- for (l = link_order; l != NULL; l = l->next)
- {
- if (l->type == bfd_section_reloc_link_order
- || l->type == bfd_symbol_reloc_link_order)
- ++c;
- }
-
- return c;
-}
-
-/*
-FUNCTION
- bfd_link_split_section
-
-SYNOPSIS
- bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
-
-DESCRIPTION
- Return nonzero if @var{sec} should be split during a
- reloceatable or final link.
-
-.#define bfd_link_split_section(abfd, sec) \
-. BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-.
-
-*/
-
-bfd_boolean
-_bfd_generic_link_split_section (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED)
-{
- return FALSE;
-}
diff --git a/contrib/binutils/bfd/merge.c b/contrib/binutils/bfd/merge.c
deleted file mode 100644
index 89f45cd..0000000
--- a/contrib/binutils/bfd/merge.c
+++ /dev/null
@@ -1,855 +0,0 @@
-/* SEC_MERGE support.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
- Written by Jakub Jelinek <jakub@redhat.com>.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file contains support for merging duplicate entities within sections,
- as used in ELF SHF_MERGE. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "hashtab.h"
-#include "libiberty.h"
-
-struct sec_merge_sec_info;
-
-/* An entry in the section merge hash table. */
-
-struct sec_merge_hash_entry
-{
- struct bfd_hash_entry root;
- /* Length of this entry. This includes the zero terminator. */
- unsigned int len;
- /* Start of this string needs to be aligned to
- alignment octets (not 1 << align). */
- unsigned int alignment;
- union
- {
- /* Index within the merged section. */
- bfd_size_type index;
- /* Entry this is a suffix of (if alignment is 0). */
- struct sec_merge_hash_entry *suffix;
- } u;
- /* Which section is it in. */
- struct sec_merge_sec_info *secinfo;
- /* Next entity in the hash table. */
- struct sec_merge_hash_entry *next;
-};
-
-/* The section merge hash table. */
-
-struct sec_merge_hash
-{
- struct bfd_hash_table table;
- /* Next available index. */
- bfd_size_type size;
- /* First entity in the SEC_MERGE sections of this type. */
- struct sec_merge_hash_entry *first;
- /* Last entity in the SEC_MERGE sections of this type. */
- struct sec_merge_hash_entry *last;
- /* Entity size. */
- unsigned int entsize;
- /* Are entries fixed size or zero terminated strings? */
- bfd_boolean strings;
-};
-
-struct sec_merge_info
-{
- /* Chain of sec_merge_infos. */
- struct sec_merge_info *next;
- /* Chain of sec_merge_sec_infos. */
- struct sec_merge_sec_info *chain;
- /* A hash table used to hold section content. */
- struct sec_merge_hash *htab;
-};
-
-struct sec_merge_sec_info
-{
- /* Chain of sec_merge_sec_infos. */
- struct sec_merge_sec_info *next;
- /* The corresponding section. */
- asection *sec;
- /* Pointer to merge_info pointing to us. */
- void **psecinfo;
- /* A hash table used to hold section content. */
- struct sec_merge_hash *htab;
- /* First string in this section. */
- struct sec_merge_hash_entry *first;
- /* Original section content. */
- unsigned char contents[1];
-};
-
-
-/* Routine to create an entry in a section merge hashtab. */
-
-static struct bfd_hash_entry *
-sec_merge_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table, const char *string)
-{
- struct sec_merge_hash_entry *ret = (struct sec_merge_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct sec_merge_hash_entry *) NULL)
- ret = ((struct sec_merge_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry)));
- if (ret == (struct sec_merge_hash_entry *) NULL)
- return NULL;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct sec_merge_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
- if (ret)
- {
- /* Initialize the local fields. */
- ret->u.suffix = NULL;
- ret->alignment = 0;
- ret->secinfo = NULL;
- ret->next = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Look up an entry in a section merge hash table. */
-
-static struct sec_merge_hash_entry *
-sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
- unsigned int alignment, bfd_boolean create)
-{
- register const unsigned char *s;
- register unsigned long hash;
- register unsigned int c;
- struct sec_merge_hash_entry *hashp;
- unsigned int len, i;
- unsigned int index;
-
- hash = 0;
- len = 0;
- s = (const unsigned char *) string;
- if (table->strings)
- {
- if (table->entsize == 1)
- {
- while ((c = *s++) != '\0')
- {
- hash += c + (c << 17);
- hash ^= hash >> 2;
- ++len;
- }
- hash += len + (len << 17);
- }
- else
- {
- for (;;)
- {
- for (i = 0; i < table->entsize; ++i)
- if (s[i] != '\0')
- break;
- if (i == table->entsize)
- break;
- for (i = 0; i < table->entsize; ++i)
- {
- c = *s++;
- hash += c + (c << 17);
- hash ^= hash >> 2;
- }
- ++len;
- }
- hash += len + (len << 17);
- len *= table->entsize;
- }
- hash ^= hash >> 2;
- len += table->entsize;
- }
- else
- {
- for (i = 0; i < table->entsize; ++i)
- {
- c = *s++;
- hash += c + (c << 17);
- hash ^= hash >> 2;
- }
- len = table->entsize;
- }
-
- index = hash % table->table.size;
- for (hashp = (struct sec_merge_hash_entry *) table->table.table[index];
- hashp != (struct sec_merge_hash_entry *) NULL;
- hashp = (struct sec_merge_hash_entry *) hashp->root.next)
- {
- if (hashp->root.hash == hash
- && len == hashp->len
- && memcmp (hashp->root.string, string, len) == 0)
- {
- /* If the string we found does not have at least the required
- alignment, we need to insert another copy. */
- if (hashp->alignment < alignment)
- {
- if (create)
- {
- /* Mark the less aligned copy as deleted. */
- hashp->len = 0;
- hashp->alignment = 0;
- }
- break;
- }
- return hashp;
- }
- }
-
- if (! create)
- return (struct sec_merge_hash_entry *) NULL;
-
- hashp = (struct sec_merge_hash_entry *)
- sec_merge_hash_newfunc ((struct bfd_hash_entry *) NULL,
- (struct bfd_hash_table *) table, string);
- if (hashp == (struct sec_merge_hash_entry *) NULL)
- return (struct sec_merge_hash_entry *) NULL;
- hashp->root.string = string;
- hashp->root.hash = hash;
- hashp->len = len;
- hashp->alignment = alignment;
- hashp->root.next = table->table.table[index];
- table->table.table[index] = (struct bfd_hash_entry *) hashp;
-
- return hashp;
-}
-
-/* Create a new hash table. */
-
-static struct sec_merge_hash *
-sec_merge_init (unsigned int entsize, bfd_boolean strings)
-{
- struct sec_merge_hash *table;
- bfd_size_type amt = sizeof (struct sec_merge_hash);
-
- table = (struct sec_merge_hash *) bfd_malloc (amt);
- if (table == NULL)
- return NULL;
-
- if (! bfd_hash_table_init (&table->table, sec_merge_hash_newfunc))
- {
- free (table);
- return NULL;
- }
-
- table->size = 0;
- table->first = NULL;
- table->last = NULL;
- table->entsize = entsize;
- table->strings = strings;
-
- return table;
-}
-
-/* Get the index of an entity in a hash table, adding it if it is not
- already present. */
-
-static struct sec_merge_hash_entry *
-sec_merge_add (struct sec_merge_hash *tab, const char *str,
- unsigned int alignment, struct sec_merge_sec_info *secinfo)
-{
- register struct sec_merge_hash_entry *entry;
-
- entry = sec_merge_hash_lookup (tab, str, alignment, TRUE);
- if (entry == NULL)
- return NULL;
-
- if (entry->secinfo == NULL)
- {
- tab->size++;
- entry->secinfo = secinfo;
- if (tab->first == NULL)
- tab->first = entry;
- else
- tab->last->next = entry;
- tab->last = entry;
- }
-
- return entry;
-}
-
-static bfd_boolean
-sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry)
-{
- struct sec_merge_sec_info *secinfo = entry->secinfo;
- asection *sec = secinfo->sec;
- char *pad = "";
- bfd_size_type off = 0;
- int alignment_power = bfd_get_section_alignment (abfd, sec->output_section);
-
- if (alignment_power)
- pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
-
- for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next)
- {
- register const char *str;
- register size_t len;
-
- len = off & (entry->alignment - 1);
- if (len)
- {
- len = entry->alignment - len;
- if (bfd_bwrite (pad, (bfd_size_type) len, abfd) != len)
- break;
- off += len;
- }
-
- str = entry->root.string;
- len = entry->len;
-
- if (bfd_bwrite (str, (bfd_size_type) len, abfd) != len)
- break;
-
- off += len;
- }
-
- if (alignment_power)
- free (pad);
-
- return entry == NULL || entry->secinfo != secinfo;
-}
-
-/* This function is called for each input file from the add_symbols
- pass of the linker. */
-
-bfd_boolean
-_bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo)
-{
- struct sec_merge_info *sinfo;
- struct sec_merge_sec_info *secinfo;
- unsigned int align;
- bfd_size_type amt;
-
- if (sec->_raw_size == 0
- || (sec->flags & SEC_EXCLUDE)
- || (sec->flags & SEC_MERGE) == 0
- || sec->entsize == 0)
- return TRUE;
-
- if ((sec->flags & SEC_RELOC) != 0)
- {
- /* We aren't prepared to handle relocations in merged sections. */
- return TRUE;
- }
-
- align = bfd_get_section_alignment (sec->owner, sec);
- if ((sec->entsize < (unsigned int)(1 << align)
- && ((sec->entsize & (sec->entsize - 1))
- || !(sec->flags & SEC_STRINGS)))
- || (sec->entsize > (unsigned int)(1 << align)
- && (sec->entsize & ((1 << align) - 1))))
- {
- /* Sanity check. If string character size is smaller than
- alignment, then we require character size to be a power
- of 2, otherwise character size must be integer multiple
- of alignment. For non-string constants, alignment must
- be smaller than or equal to entity size and entity size
- must be integer multiple of alignment. */
- return TRUE;
- }
-
- for (sinfo = (struct sec_merge_info *) *psinfo; sinfo; sinfo = sinfo->next)
- if ((secinfo = sinfo->chain)
- && ! ((secinfo->sec->flags ^ sec->flags) & (SEC_MERGE | SEC_STRINGS))
- && secinfo->sec->entsize == sec->entsize
- && ! strcmp (secinfo->sec->name, sec->name))
- break;
-
- if (sinfo == NULL)
- {
- /* Initialize the information we need to keep track of. */
- amt = sizeof (struct sec_merge_info);
- sinfo = (struct sec_merge_info *) bfd_alloc (abfd, amt);
- if (sinfo == NULL)
- goto error_return;
- sinfo->next = (struct sec_merge_info *) *psinfo;
- sinfo->chain = NULL;
- *psinfo = sinfo;
- sinfo->htab = sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
- if (sinfo->htab == NULL)
- goto error_return;
- }
-
- /* Read the section from abfd. */
-
- amt = sizeof (struct sec_merge_sec_info) + sec->_raw_size - 1;
- *psecinfo = bfd_alloc (abfd, amt);
- if (*psecinfo == NULL)
- goto error_return;
-
- secinfo = (struct sec_merge_sec_info *)*psecinfo;
- if (sinfo->chain)
- {
- secinfo->next = sinfo->chain->next;
- sinfo->chain->next = secinfo;
- }
- else
- secinfo->next = secinfo;
- sinfo->chain = secinfo;
- secinfo->sec = sec;
- secinfo->psecinfo = psecinfo;
- secinfo->htab = sinfo->htab;
- secinfo->first = NULL;
-
- if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents,
- (bfd_vma) 0, sec->_raw_size))
- goto error_return;
-
- return TRUE;
-
- error_return:
- *psecinfo = NULL;
- return FALSE;
-}
-
-/* Record one section into the hash table. */
-static bfd_boolean
-record_section (struct sec_merge_info *sinfo,
- struct sec_merge_sec_info *secinfo)
-{
- asection *sec = secinfo->sec;
- struct sec_merge_hash_entry *entry;
- bfd_boolean nul;
- unsigned char *p, *end;
- bfd_vma mask, eltalign;
- unsigned int align, i;
-
- align = bfd_get_section_alignment (sec->owner, sec);
- end = secinfo->contents + sec->_raw_size;
- nul = FALSE;
- mask = ((bfd_vma) 1 << align) - 1;
- if (sec->flags & SEC_STRINGS)
- {
- for (p = secinfo->contents; p < end; )
- {
- eltalign = p - secinfo->contents;
- eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1;
- if (!eltalign || eltalign > mask)
- eltalign = mask + 1;
- entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo);
- if (! entry)
- goto error_return;
- p += entry->len;
- if (sec->entsize == 1)
- {
- while (p < end && *p == 0)
- {
- if (!nul && !((p - secinfo->contents) & mask))
- {
- nul = TRUE;
- entry = sec_merge_add (sinfo->htab, "",
- (unsigned) mask + 1, secinfo);
- if (! entry)
- goto error_return;
- }
- p++;
- }
- }
- else
- {
- while (p < end)
- {
- for (i = 0; i < sec->entsize; i++)
- if (p[i] != '\0')
- break;
- if (i != sec->entsize)
- break;
- if (!nul && !((p - secinfo->contents) & mask))
- {
- nul = TRUE;
- entry = sec_merge_add (sinfo->htab, p,
- (unsigned) mask + 1, secinfo);
- if (! entry)
- goto error_return;
- }
- p += sec->entsize;
- }
- }
- }
- }
- else
- {
- for (p = secinfo->contents; p < end; p += sec->entsize)
- {
- entry = sec_merge_add (sinfo->htab, p, 1, secinfo);
- if (! entry)
- goto error_return;
- }
- }
-
- return TRUE;
-
-error_return:
- for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
- *secinfo->psecinfo = NULL;
- return FALSE;
-}
-
-static int
-strrevcmp (const void *a, const void *b)
-{
- struct sec_merge_hash_entry *A = *(struct sec_merge_hash_entry **) a;
- struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b;
- unsigned int lenA = A->len;
- unsigned int lenB = B->len;
- const unsigned char *s = A->root.string + lenA - 1;
- const unsigned char *t = B->root.string + lenB - 1;
- int l = lenA < lenB ? lenA : lenB;
-
- while (l)
- {
- if (*s != *t)
- return (int) *s - (int) *t;
- s--;
- t--;
- l--;
- }
- return lenA - lenB;
-}
-
-/* Like strrevcmp, but for the case where all strings have the same
- alignment > entsize. */
-
-static int
-strrevcmp_align (const void *a, const void *b)
-{
- struct sec_merge_hash_entry *A = *(struct sec_merge_hash_entry **) a;
- struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b;
- unsigned int lenA = A->len;
- unsigned int lenB = B->len;
- const unsigned char *s = A->root.string + lenA - 1;
- const unsigned char *t = B->root.string + lenB - 1;
- int l = lenA < lenB ? lenA : lenB;
- int tail_align = (lenA & (A->alignment - 1)) - (lenB & (A->alignment - 1));
-
- if (tail_align != 0)
- return tail_align;
-
- while (l)
- {
- if (*s != *t)
- return (int) *s - (int) *t;
- s--;
- t--;
- l--;
- }
- return lenA - lenB;
-}
-
-static inline int
-is_suffix (const struct sec_merge_hash_entry *A,
- const struct sec_merge_hash_entry *B)
-{
- if (A->len <= B->len)
- /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
- not to be equal by the hash table. */
- return 0;
-
- return memcmp (A->root.string + (A->len - B->len),
- B->root.string, B->len) == 0;
-}
-
-/* This is a helper function for _bfd_merge_sections. It attempts to
- merge strings matching suffixes of longer strings. */
-static void
-merge_strings (struct sec_merge_info *sinfo)
-{
- struct sec_merge_hash_entry **array, **a, *e;
- struct sec_merge_sec_info *secinfo;
- bfd_size_type size, amt;
- unsigned int alignment = 0;
-
- /* Now sort the strings */
- amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
- array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
- if (array == NULL)
- goto alloc_failure;
-
- for (e = sinfo->htab->first, a = array; e; e = e->next)
- if (e->alignment)
- {
- *a++ = e;
- /* Adjust the length to not include the zero terminator. */
- e->len -= sinfo->htab->entsize;
- if (alignment != e->alignment)
- {
- if (alignment == 0)
- alignment = e->alignment;
- else
- alignment = (unsigned) -1;
- }
- }
-
- sinfo->htab->size = a - array;
- if (sinfo->htab->size != 0)
- {
- qsort (array, (size_t) sinfo->htab->size,
- sizeof (struct sec_merge_hash_entry *),
- (alignment != (unsigned) -1 && alignment > sinfo->htab->entsize
- ? strrevcmp_align : strrevcmp));
-
- /* Loop over the sorted array and merge suffixes */
- e = *--a;
- e->len += sinfo->htab->entsize;
- while (--a >= array)
- {
- struct sec_merge_hash_entry *cmp = *a;
-
- cmp->len += sinfo->htab->entsize;
- if (e->alignment >= cmp->alignment
- && !((e->len - cmp->len) & (cmp->alignment - 1))
- && is_suffix (e, cmp))
- {
- cmp->u.suffix = e;
- cmp->alignment = 0;
- }
- else
- e = cmp;
- }
- }
-
-alloc_failure:
- if (array)
- free (array);
-
- /* Now assign positions to the strings we want to keep. */
- size = 0;
- secinfo = sinfo->htab->first->secinfo;
- for (e = sinfo->htab->first; e; e = e->next)
- {
- if (e->secinfo != secinfo)
- {
- secinfo->sec->_cooked_size = size;
- secinfo = e->secinfo;
- }
- if (e->alignment)
- {
- if (e->secinfo->first == NULL)
- {
- e->secinfo->first = e;
- size = 0;
- }
- size = (size + e->alignment - 1) & ~((bfd_vma) e->alignment - 1);
- e->u.index = size;
- size += e->len;
- }
- }
- secinfo->sec->_cooked_size = size;
-
- /* And now adjust the rest, removing them from the chain (but not hashtable)
- at the same time. */
- for (a = &sinfo->htab->first, e = *a; e; e = e->next)
- if (e->alignment)
- a = &e->next;
- else
- {
- *a = e->next;
- if (e->len)
- {
- e->secinfo = e->u.suffix->secinfo;
- e->alignment = e->u.suffix->alignment;
- e->u.index = e->u.suffix->u.index + (e->u.suffix->len - e->len);
- }
- }
-}
-
-/* This function is called once after all SEC_MERGE sections are registered
- with _bfd_merge_section. */
-
-bfd_boolean
-_bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo,
- void (*remove_hook) (bfd *, asection *))
-{
- struct sec_merge_info *sinfo;
-
- for (sinfo = (struct sec_merge_info *) xsinfo; sinfo; sinfo = sinfo->next)
- {
- struct sec_merge_sec_info * secinfo;
-
- if (! sinfo->chain)
- continue;
-
- /* Move sinfo->chain to head of the chain, terminate it. */
- secinfo = sinfo->chain;
- sinfo->chain = secinfo->next;
- secinfo->next = NULL;
-
- /* Record the sections into the hash table. */
- for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
- if (secinfo->sec->flags & SEC_EXCLUDE)
- {
- *secinfo->psecinfo = NULL;
- if (remove_hook)
- (*remove_hook) (abfd, secinfo->sec);
- }
- else if (! record_section (sinfo, secinfo))
- break;
-
- if (secinfo)
- continue;
-
- if (sinfo->htab->first == NULL)
- continue;
-
- if (sinfo->htab->strings)
- merge_strings (sinfo);
- else
- {
- struct sec_merge_hash_entry *e;
- bfd_size_type size = 0;
-
- /* Things are much simpler for non-strings.
- Just assign them slots in the section. */
- secinfo = NULL;
- for (e = sinfo->htab->first; e; e = e->next)
- {
- if (e->secinfo->first == NULL)
- {
- if (secinfo)
- secinfo->sec->_cooked_size = size;
- e->secinfo->first = e;
- size = 0;
- }
- size = (size + e->alignment - 1)
- & ~((bfd_vma) e->alignment - 1);
- e->u.index = size;
- size += e->len;
- secinfo = e->secinfo;
- }
- secinfo->sec->_cooked_size = size;
- }
-
- /* Finally remove all input sections which have not made it into
- the hash table at all. */
- for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
- if (secinfo->first == NULL)
- {
- secinfo->sec->_cooked_size = 0;
- secinfo->sec->flags |= SEC_EXCLUDE;
- }
- }
-
- return TRUE;
-}
-
-/* Write out the merged section. */
-
-bfd_boolean
-_bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo)
-{
- struct sec_merge_sec_info *secinfo;
- file_ptr pos;
-
- secinfo = (struct sec_merge_sec_info *) psecinfo;
-
- if (!secinfo->first)
- return TRUE;
-
- pos = sec->output_section->filepos + sec->output_offset;
- if (bfd_seek (output_bfd, pos, SEEK_SET) != 0)
- return FALSE;
-
- if (! sec_merge_emit (output_bfd, secinfo->first))
- return FALSE;
-
- return TRUE;
-}
-
-/* Adjust an address in the SEC_MERGE section. Given OFFSET within
- *PSEC, this returns the new offset in the adjusted SEC_MERGE
- section and writes the new section back into *PSEC. */
-
-bfd_vma
-_bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
- void *psecinfo, bfd_vma offset, bfd_vma addend)
-{
- struct sec_merge_sec_info *secinfo;
- struct sec_merge_hash_entry *entry;
- unsigned char *p;
- asection *sec = *psec;
-
- secinfo = (struct sec_merge_sec_info *) psecinfo;
-
- if (offset + addend >= sec->_raw_size)
- {
- if (offset + addend > sec->_raw_size)
- {
- (*_bfd_error_handler)
- (_("%s: access beyond end of merged section (%ld + %ld)"),
- bfd_get_filename (sec->owner), (long) offset, (long) addend);
- }
- return (secinfo->first ? sec->_cooked_size : 0);
- }
-
- if (secinfo->htab->strings)
- {
- if (sec->entsize == 1)
- {
- p = secinfo->contents + offset + addend - 1;
- while (p >= secinfo->contents && *p)
- --p;
- ++p;
- }
- else
- {
- p = secinfo->contents
- + ((offset + addend) / sec->entsize) * sec->entsize;
- p -= sec->entsize;
- while (p >= secinfo->contents)
- {
- unsigned int i;
-
- for (i = 0; i < sec->entsize; ++i)
- if (p[i] != '\0')
- break;
- if (i == sec->entsize)
- break;
- p -= sec->entsize;
- }
- p += sec->entsize;
- }
- }
- else
- {
- p = secinfo->contents
- + ((offset + addend) / sec->entsize) * sec->entsize;
- }
- entry = sec_merge_hash_lookup (secinfo->htab, p, 0, FALSE);
- if (!entry)
- {
- if (! secinfo->htab->strings)
- abort ();
- /* This should only happen if somebody points into the padding
- after a NUL character but before next entity. */
- if (*p)
- abort ();
- if (! secinfo->htab->first)
- abort ();
- entry = secinfo->htab->first;
- p = secinfo->contents
- + ((offset + addend) / sec->entsize + 1) * sec->entsize
- - entry->len;
- }
-
- *psec = entry->secinfo->sec;
- return entry->u.index + (secinfo->contents + offset - p);
-}
diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c
deleted file mode 100644
index cb2050f..0000000
--- a/contrib/binutils/bfd/mipsbsd.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/* BFD backend for MIPS BSD (a.out) binaries.
- Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Ralph Campbell.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* #define ENTRY_CAN_BE_ZERO */
-#define N_HEADER_IN_TEXT(x) 1
-#define N_SHARED_LIB(x) 0
-#define N_TXTADDR(x) \
- (N_MAGIC(x) != ZMAGIC ? (x).a_entry : /* object file or NMAGIC */\
- TEXT_START_ADDR + EXEC_BYTES_SIZE /* no padding */\
- )
-#define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x))
-#define TEXT_START_ADDR 4096
-#define TARGET_PAGE_SIZE 4096
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define DEFAULT_ARCH bfd_arch_mips
-#define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \
- || (mtype) == M_MIPS1 || (mtype) == M_MIPS2)
-#define MY_symbol_leading_char '\0'
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (mipsbsd_,OP)
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h"
-
-#define SET_ARCH_MACH(ABFD, EXEC) \
- MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
- MY(choose_reloc_size) (ABFD);
-static void MY(set_arch_mach) PARAMS ((bfd *abfd, unsigned long machtype));
-static void MY(choose_reloc_size) PARAMS ((bfd *abfd));
-
-#define MY_write_object_contents MY(write_object_contents)
-static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
-
-/* We can't use MY(x) here because it leads to a recursive call to CONCAT2
- when expanded inside JUMP_TABLE. */
-#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup
-#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
-
-#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define MY_final_link_callback unused
-#define MY_bfd_final_link _bfd_generic_final_link
-
-#define MY_backend_data &MY(backend_data)
-#define MY_BFD_TARGET
-
-#include "aout-target.h"
-
-static bfd_reloc_status_type mips_fix_jmp_addr
- PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *,
- bfd *, char **));
-static reloc_howto_type *MY(reloc_howto_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-
-static void
-MY(set_arch_mach) (abfd, machtype)
- bfd *abfd;
- unsigned long machtype;
-{
- enum bfd_architecture arch;
- unsigned int machine;
-
- /* Determine the architecture and machine type of the object file. */
- switch (machtype)
- {
- case M_MIPS1:
- arch = bfd_arch_mips;
- machine = bfd_mach_mips3000;
- break;
-
- case M_MIPS2:
- arch = bfd_arch_mips;
- machine = bfd_mach_mips4000;
- break;
-
- default:
- arch = bfd_arch_obscure;
- machine = 0;
- break;
- }
-
- bfd_set_arch_mach (abfd, arch, machine);
-}
-
-/* Determine the size of a relocation entry, based on the architecture */
-static void
-MY (choose_reloc_size) (abfd)
- bfd *abfd;
-{
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_sparc:
- case bfd_arch_a29k:
- case bfd_arch_mips:
- obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
- break;
- default:
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- break;
- }
-}
-
-/* Write an object file in BSD a.out format.
- Section contents have already been written. We write the
- file header, symbols, and relocation. */
-
-static bfd_boolean
-MY (write_object_contents) (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- /* Magic number, maestro, please! */
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_m68k:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_m68010:
- N_SET_MACHTYPE (*execp, M_68010);
- break;
- default:
- case bfd_mach_m68020:
- N_SET_MACHTYPE (*execp, M_68020);
- break;
- }
- break;
- case bfd_arch_sparc:
- N_SET_MACHTYPE (*execp, M_SPARC);
- break;
- case bfd_arch_i386:
- N_SET_MACHTYPE (*execp, M_386);
- break;
- case bfd_arch_a29k:
- N_SET_MACHTYPE (*execp, M_29K);
- break;
- case bfd_arch_mips:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_mips4000:
- case bfd_mach_mips6000:
- N_SET_MACHTYPE (*execp, M_MIPS2);
- break;
- default:
- N_SET_MACHTYPE (*execp, M_MIPS1);
- break;
- }
- break;
- default:
- N_SET_MACHTYPE (*execp, M_UNKNOWN);
- }
-
- MY (choose_reloc_size) (abfd);
-
- WRITE_HEADERS (abfd, execp);
-
- return TRUE;
-}
-
-/* MIPS relocation types. */
-#define MIPS_RELOC_32 0
-#define MIPS_RELOC_JMP 1
-#define MIPS_RELOC_WDISP16 2
-#define MIPS_RELOC_HI16 3
-#define MIPS_RELOC_HI16_S 4
-#define MIPS_RELOC_LO16 5
-
-/* This is only called when performing a BFD_RELOC_MIPS_JMP relocation.
- The jump destination address is formed from the upper 4 bits of the
- "current" program counter concatenated with the jump instruction's
- 26 bit field and two trailing zeros.
- If the destination address is not in the same segment as the "current"
- program counter, then we need to signal an error. */
-
-static bfd_reloc_status_type
-mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- struct bfd_symbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation, pc;
-
- /* If this is a partial relocation, just continue. */
- if (output_bfd != (bfd *)NULL)
- return bfd_reloc_continue;
-
- /* If this is an undefined symbol, return error */
- if (bfd_is_und_section (symbol->section)
- && (symbol->flags & BSF_WEAK) == 0)
- return bfd_reloc_undefined;
-
- /* Work out which section the relocation is targeted at and the
- initial relocation command value. */
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
-
- pc = input_section->output_section->vma + input_section->output_offset +
- reloc_entry->address + 4;
-
- if ((relocation & 0xF0000000) != (pc & 0xF0000000))
- return bfd_reloc_overflow;
-
- return bfd_reloc_continue;
-}
-
-/* This is only called when performing a BFD_RELOC_HI16_S relocation.
- We need to see if bit 15 is set in the result. If it is, we add
- 0x10000 and continue normally. This will compensate for the sign extension
- when the low bits are added at run time. */
-
-static bfd_reloc_status_type
-mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
- asection *, bfd *, char **));
-
-static bfd_reloc_status_type
-mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
-
- /* If this is a partial relocation, just continue. */
- if (output_bfd != (bfd *)NULL)
- return bfd_reloc_continue;
-
- /* If this is an undefined symbol, return error. */
- if (bfd_is_und_section (symbol->section)
- && (symbol->flags & BSF_WEAK) == 0)
- return bfd_reloc_undefined;
-
- /* Work out which section the relocation is targeted at and the
- initial relocation command value. */
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- relocation += symbol->section->output_section->vma;
- relocation += symbol->section->output_offset;
- relocation += reloc_entry->addend;
-
- if (relocation & 0x8000)
- reloc_entry->addend += 0x10000;
-
- return bfd_reloc_continue;
-}
-
-static reloc_howto_type mips_howto_table_ext[] = {
- {MIPS_RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0,
- "32", FALSE, 0, 0xffffffff, FALSE},
- {MIPS_RELOC_JMP, 2, 2, 26, FALSE, 0, complain_overflow_dont,
- mips_fix_jmp_addr,
- "MIPS_JMP", FALSE, 0, 0x03ffffff, FALSE},
- {MIPS_RELOC_WDISP16, 2, 2, 16, TRUE, 0, complain_overflow_signed, 0,
- "WDISP16", FALSE, 0, 0x0000ffff, FALSE},
- {MIPS_RELOC_HI16, 16, 2, 16, FALSE, 0, complain_overflow_bitfield, 0,
- "HI16", FALSE, 0, 0x0000ffff, FALSE},
- {MIPS_RELOC_HI16_S, 16, 2, 16, FALSE, 0, complain_overflow_bitfield,
- mips_fix_hi16_s,
- "HI16_S", FALSE, 0, 0x0000ffff, FALSE},
- {MIPS_RELOC_LO16, 0, 2, 16, FALSE, 0, complain_overflow_dont, 0,
- "LO16", FALSE, 0, 0x0000ffff, FALSE},
-};
-
-static reloc_howto_type *
-MY(reloc_howto_type_lookup) (abfd, code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
-{
-
- if (bfd_get_arch (abfd) != bfd_arch_mips)
- return 0;
-
- switch (code)
- {
- case BFD_RELOC_CTOR:
- case BFD_RELOC_32:
- return (&mips_howto_table_ext[MIPS_RELOC_32]);
- case BFD_RELOC_MIPS_JMP:
- return (&mips_howto_table_ext[MIPS_RELOC_JMP]);
- case BFD_RELOC_16_PCREL_S2:
- return (&mips_howto_table_ext[MIPS_RELOC_WDISP16]);
- case BFD_RELOC_HI16:
- return (&mips_howto_table_ext[MIPS_RELOC_HI16]);
- case BFD_RELOC_HI16_S:
- return (&mips_howto_table_ext[MIPS_RELOC_HI16_S]);
- case BFD_RELOC_LO16:
- return (&mips_howto_table_ext[MIPS_RELOC_LO16]);
- default:
- return 0;
- }
-}
-
-/* This is just like the standard aoutx.h version but we need to do our
- own mapping of external reloc type values to howto entries. */
-long
-MY(canonicalize_reloc) (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
-{
- arelent *tblptr = section->relocation;
- unsigned int count, c;
- extern reloc_howto_type NAME(aout,ext_howto_table)[];
-
- /* If we have already read in the relocation table, return the values. */
- if (section->flags & SEC_CONSTRUCTOR)
- {
- arelent_chain *chain = section->constructor_chain;
-
- for (count = 0; count < section->reloc_count; count++)
- {
- *relptr++ = &chain->relent;
- chain = chain->next;
- }
- *relptr = 0;
- return section->reloc_count;
- }
-
- if (tblptr && section->reloc_count)
- {
- for (count = 0; count++ < section->reloc_count;)
- *relptr++ = tblptr++;
- *relptr = 0;
- return section->reloc_count;
- }
-
- if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
- return -1;
- tblptr = section->relocation;
-
- /* fix up howto entries. */
- for (count = 0; count++ < section->reloc_count;)
- {
- c = tblptr->howto - NAME(aout,ext_howto_table);
- tblptr->howto = &mips_howto_table_ext[c];
-
- *relptr++ = tblptr++;
- }
- *relptr = 0;
- return section->reloc_count;
-}
-
-static const struct aout_backend_data MY(backend_data) = {
- 0, /* zmagic contiguous */
- 1, /* text incl header */
- 0, /* entry is text address */
- 0, /* exec_hdr_flags */
- TARGET_PAGE_SIZE, /* text vma */
- MY_set_sizes,
- 0, /* text size includes exec header */
- 0, /* add_dynamic_symbols */
- 0, /* add_one_symbol */
- 0, /* link_dynamic_object */
- 0, /* write_dynamic_symbol */
- 0, /* check_dynamic_reloc */
- 0 /* finish_dynamic_link */
-};
-
-extern const bfd_target aout_mips_big_vec;
-
-const bfd_target aout_mips_little_vec =
- {
- "a.out-mips-little", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order (little) */
- BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & aout_mips_big_vec,
-
- (PTR) MY_backend_data
- };
-
-const bfd_target aout_mips_big_vec =
- {
- "a.out-mips-big", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_BIG, /* target byte order (big) */
- BFD_ENDIAN_BIG, /* target headers byte order (big) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & aout_mips_little_vec,
-
- (PTR) MY_backend_data
- };
diff --git a/contrib/binutils/bfd/netbsd-core.c b/contrib/binutils/bfd/netbsd-core.c
deleted file mode 100644
index 84f2ad7..0000000
--- a/contrib/binutils/bfd/netbsd-core.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/* BFD back end for NetBSD style core files
- Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Paul Kranenburg, EUR
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-#include <sys/core.h>
-
-/*
- * FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof (struct trapframe))
- */
-
-/* Offset of StackGhost cookie within `struct md_coredump' on
- OpenBSD/sparc. */
-#define CORE_WCOOKIE_OFFSET 344
-
-struct netbsd_core_struct {
- struct core core;
-} *rawptr;
-
-/* forward declarations */
-
-static const bfd_target *netbsd_core_file_p
- PARAMS ((bfd *abfd));
-static char *netbsd_core_file_failing_command
- PARAMS ((bfd *abfd));
-static int netbsd_core_file_failing_signal
- PARAMS ((bfd *abfd));
-static bfd_boolean netbsd_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-static void swap_abort
- PARAMS ((void));
-
-/* Handle NetBSD-style core dump file. */
-
-static const bfd_target *
-netbsd_core_file_p (abfd)
- bfd *abfd;
-
-{
- int i, val;
- file_ptr offset;
- asection *asect, *asect2;
- struct core core;
- struct coreseg coreseg;
- bfd_size_type amt = sizeof core;
-
- val = bfd_bread ((void *) &core, amt, abfd);
- if (val != sizeof core)
- {
- /* Too small to be a core file */
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- if (CORE_GETMAGIC (core) != COREMAGIC)
- {
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- amt = sizeof (struct netbsd_core_struct);
- rawptr = (struct netbsd_core_struct *) bfd_zalloc (abfd, amt);
- if (rawptr == NULL)
- return 0;
-
- rawptr->core = core;
- abfd->tdata.netbsd_core_data = rawptr;
-
- offset = core.c_hdrsize;
- for (i = 0; i < core.c_nseg; i++)
- {
- const char *sname;
- flagword flags;
-
- if (bfd_seek (abfd, offset, SEEK_SET) != 0)
- goto punt;
-
- val = bfd_bread ((void *) &coreseg, (bfd_size_type) sizeof coreseg, abfd);
- if (val != sizeof coreseg)
- {
- bfd_set_error (bfd_error_file_truncated);
- goto punt;
- }
- if (CORE_GETMAGIC (coreseg) != CORESEGMAGIC)
- {
- bfd_set_error (bfd_error_wrong_format);
- goto punt;
- }
-
- offset += core.c_seghdrsize;
-
- switch (CORE_GETFLAG (coreseg))
- {
- case CORE_CPU:
- sname = ".reg";
- flags = SEC_ALLOC + SEC_HAS_CONTENTS;
- break;
- case CORE_DATA:
- sname = ".data";
- flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- break;
- case CORE_STACK:
- sname = ".stack";
- flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- break;
- default:
- sname = ".unknown";
- flags = SEC_ALLOC + SEC_HAS_CONTENTS;
- break;
- }
- asect = bfd_make_section_anyway (abfd, sname);
- if (asect == NULL)
- goto punt;
-
- asect->flags = flags;
- asect->_raw_size = coreseg.c_size;
- asect->vma = coreseg.c_addr;
- asect->filepos = offset;
- asect->alignment_power = 2;
-
- if (CORE_GETMID (core) == M_SPARC_NETBSD
- && CORE_GETFLAG (coreseg) == CORE_CPU
- && coreseg.c_size > CORE_WCOOKIE_OFFSET)
- {
- /* Truncate the .reg section. */
- asect->_raw_size = CORE_WCOOKIE_OFFSET;
-
- /* And create the .wcookie section. */
- asect = bfd_make_section_anyway (abfd, ".wcookie");
- if (asect == NULL)
- goto punt;
-
- asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
- asect->_raw_size = 4;
- asect->vma = 0;
- asect->filepos = offset + CORE_WCOOKIE_OFFSET;
- asect->alignment_power = 2;
- }
-
- offset += coreseg.c_size;
-
-#ifdef CORE_FPU_OFFSET
- switch (CORE_GETFLAG (coreseg))
- {
- case CORE_CPU:
- /* Hackish... */
- asect->_raw_size = CORE_FPU_OFFSET;
- asect2 = bfd_make_section_anyway (abfd, ".reg2");
- if (asect2 == NULL)
- goto punt;
- asect2->_raw_size = coreseg.c_size - CORE_FPU_OFFSET;
- asect2->vma = 0;
- asect2->filepos = asect->filepos + CORE_FPU_OFFSET;
- asect2->alignment_power = 2;
- asect2->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
- break;
- }
-#endif
- }
-
- /* OK, we believe you. You're a core file (sure, sure). */
- return abfd->xvec;
-
- punt:
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = NULL;
- bfd_section_list_clear (abfd);
- return 0;
-}
-
-static char*
-netbsd_core_file_failing_command (abfd)
- bfd *abfd;
-{
- /*return core_command (abfd);*/
- return abfd->tdata.netbsd_core_data->core.c_name;
-}
-
-static int
-netbsd_core_file_failing_signal (abfd)
- bfd *abfd;
-{
- /*return core_signal (abfd);*/
- return abfd->tdata.netbsd_core_data->core.c_signo;
-}
-
-static bfd_boolean
-netbsd_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd ATTRIBUTE_UNUSED;
- bfd *exec_bfd ATTRIBUTE_UNUSED;
-{
- return TRUE; /* FIXME, We have no way of telling at this point */
-}
-
-/* If somebody calls any byte-swapping routines, shoot them. */
-static void
-swap_abort ()
-{
- abort (); /* This way doesn't require any declaration for ANSI to fuck up */
-}
-
-#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
-#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
-#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
-#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
-#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
-#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
-
-const bfd_target netbsd_core_vec =
- {
- "netbsd-core",
- bfd_target_unknown_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* symbol prefix */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data. */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit data. */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit data. */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs. */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs. */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs. */
-
- { /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- netbsd_core_file_p /* a core file */
- },
- { /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
- { /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
-
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (netbsd),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0 /* backend_data */
- };
diff --git a/contrib/binutils/bfd/netbsd.h b/contrib/binutils/bfd/netbsd.h
deleted file mode 100644
index 04a4eab..0000000
--- a/contrib/binutils/bfd/netbsd.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* BFD back-end definitions used by all NetBSD targets.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA. */
-
-/* Check for our machine type (part of magic number). */
-#ifndef MACHTYPE_OK
-#define MACHTYPE_OK(m) ((m) == DEFAULT_MID || (m) == M_UNKNOWN)
-#endif
-
-/* This is the normal load address for executables. */
-#define TEXT_START_ADDR TARGET_PAGE_SIZE
-
-/* NetBSD ZMAGIC has its header in the text segment. */
-#define N_HEADER_IN_TEXT(x) 1
-
-/* Determine if this is a shared library using the flags. */
-#define N_SHARED_LIB(x) (N_DYNAMIC(x))
-
-/* We have 6 bits of flags and 10 bits of machine ID. */
-#define N_MACHTYPE(exec) \
- ((enum machine_type) (((exec).a_info >> 16) & 0x03ff))
-#define N_FLAGS(exec) \
- (((exec).a_info >> 26) & 0x3f)
-
-#define N_SET_INFO(exec, magic, type, flags) \
- ((exec).a_info = ((magic) & 0xffff) \
- | (((int) (type) & 0x3ff) << 16) \
- | (((flags) & 0x3f) << 24))
-#define N_SET_MACHTYPE(exec, machtype) \
- ((exec).a_info = \
- ((exec).a_info & 0xfb00ffff) | ((((int) (machtype))&0x3ff) << 16))
-#define N_SET_FLAGS(exec, flags) \
- ((exec).a_info = \
- ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h"
-
-/* On NetBSD, the magic number is always in ntohl's "network" (big-endian)
- format. */
-#define SWAP_MAGIC(ext) bfd_getb32 (ext)
-
-/* On NetBSD, the entry point may be taken to be the start of the text
- section. */
-#define MY_entry_is_text_address 1
-
-#define MY_write_object_contents MY(write_object_contents)
-static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
-#define MY_text_includes_header 1
-
-#include "aout-target.h"
-
-/* Write an object file.
- Section contents have already been written. We write the
- file header, symbols, and relocation. */
-
-static bfd_boolean
-MY(write_object_contents) (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- /* We must make certain that the magic number has been set. This
- will normally have been done by set_section_contents, but only if
- there actually are some section contents. */
- if (! abfd->output_has_begun)
- {
- bfd_size_type text_size;
- file_ptr text_end;
-
- NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
- }
-
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- /* Magic number, maestro, please! */
- switch (bfd_get_arch(abfd)) {
- case DEFAULT_ARCH:
- N_SET_MACHTYPE(*execp, DEFAULT_MID);
- break;
- default:
- N_SET_MACHTYPE(*execp, M_UNKNOWN);
- break;
- }
-
- /* The NetBSD magic number is always big-endian */
-#ifndef TARGET_IS_BIG_ENDIAN_P
- /* XXX aren't there any macro to change byteorder of a word independent of
- the host's or target's endianesses? */
- execp->a_info
- = (execp->a_info & 0xff) << 24 | (execp->a_info & 0xff00) << 8
- | (execp->a_info & 0xff0000) >> 8 | (execp->a_info & 0xff000000) >> 24;
-#endif
-
- WRITE_HEADERS(abfd, execp);
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/opncls.c b/contrib/binutils/bfd/opncls.c
deleted file mode 100644
index 6abd405..0000000
--- a/contrib/binutils/bfd/opncls.c
+++ /dev/null
@@ -1,1175 +0,0 @@
-/* opncls.c -- open and close a BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003
- Free Software Foundation, Inc.
-
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "objalloc.h"
-#include "libbfd.h"
-#include "libiberty.h"
-
-#ifndef S_IXUSR
-#define S_IXUSR 0100 /* Execute by owner. */
-#endif
-#ifndef S_IXGRP
-#define S_IXGRP 0010 /* Execute by group. */
-#endif
-#ifndef S_IXOTH
-#define S_IXOTH 0001 /* Execute by others. */
-#endif
-
-/* Counter used to initialize the bfd identifier. */
-
-static unsigned int _bfd_id_counter = 0;
-
-/* fdopen is a loser -- we should use stdio exclusively. Unfortunately
- if we do that we can't use fcntl. */
-
-/* Return a new BFD. All BFD's are allocated through this routine. */
-
-bfd *
-_bfd_new_bfd (void)
-{
- bfd *nbfd;
-
- nbfd = bfd_zmalloc (sizeof (bfd));
- if (nbfd == NULL)
- return NULL;
-
- nbfd->id = _bfd_id_counter++;
-
- nbfd->memory = objalloc_create ();
- if (nbfd->memory == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- free (nbfd);
- return NULL;
- }
-
- nbfd->arch_info = &bfd_default_arch_struct;
-
- nbfd->direction = no_direction;
- nbfd->iostream = NULL;
- nbfd->where = 0;
- if (!bfd_hash_table_init_n (& nbfd->section_htab, bfd_section_hash_newfunc,
- 251))
- {
- free (nbfd);
- return NULL;
- }
- nbfd->sections = NULL;
- nbfd->section_tail = &nbfd->sections;
- nbfd->format = bfd_unknown;
- nbfd->my_archive = NULL;
- nbfd->origin = 0;
- nbfd->opened_once = FALSE;
- nbfd->output_has_begun = FALSE;
- nbfd->section_count = 0;
- nbfd->usrdata = NULL;
- nbfd->cacheable = FALSE;
- nbfd->flags = BFD_NO_FLAGS;
- nbfd->mtime_set = FALSE;
-
- return nbfd;
-}
-
-/* Allocate a new BFD as a member of archive OBFD. */
-
-bfd *
-_bfd_new_bfd_contained_in (bfd *obfd)
-{
- bfd *nbfd;
-
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
- return NULL;
- nbfd->xvec = obfd->xvec;
- nbfd->my_archive = obfd;
- nbfd->direction = read_direction;
- nbfd->target_defaulted = obfd->target_defaulted;
- return nbfd;
-}
-
-/* Delete a BFD. */
-
-void
-_bfd_delete_bfd (bfd *abfd)
-{
- bfd_hash_table_free (&abfd->section_htab);
- objalloc_free ((struct objalloc *) abfd->memory);
- free (abfd);
-}
-
-/*
-SECTION
- Opening and closing BFDs
-
-*/
-
-/*
-FUNCTION
- bfd_openr
-
-SYNOPSIS
- bfd *bfd_openr (const char *filename, const char *target);
-
-DESCRIPTION
- Open the file @var{filename} (using <<fopen>>) with the target
- @var{target}. Return a pointer to the created BFD.
-
- Calls <<bfd_find_target>>, so @var{target} is interpreted as by
- that function.
-
- If <<NULL>> is returned then an error has occured. Possible errors
- are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> or
- <<system_call>> error.
-*/
-
-bfd *
-bfd_openr (const char *filename, const char *target)
-{
- bfd *nbfd;
- const bfd_target *target_vec;
-
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
- return NULL;
-
- target_vec = bfd_find_target (target, nbfd);
- if (target_vec == NULL)
- {
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
- nbfd->filename = filename;
- nbfd->direction = read_direction;
-
- if (bfd_open_file (nbfd) == NULL)
- {
- /* File didn't exist, or some such. */
- bfd_set_error (bfd_error_system_call);
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
- return nbfd;
-}
-
-/* Don't try to `optimize' this function:
-
- o - We lock using stack space so that interrupting the locking
- won't cause a storage leak.
- o - We open the file stream last, since we don't want to have to
- close it if anything goes wrong. Closing the stream means closing
- the file descriptor too, even though we didn't open it. */
-/*
-FUNCTION
- bfd_fdopenr
-
-SYNOPSIS
- bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
-
-DESCRIPTION
- <<bfd_fdopenr>> is to <<bfd_fopenr>> much like <<fdopen>> is to
- <<fopen>>. It opens a BFD on a file already described by the
- @var{fd} supplied.
-
- When the file is later <<bfd_close>>d, the file descriptor will
- be closed. If the caller desires that this file descriptor be
- cached by BFD (opened as needed, closed as needed to free
- descriptors for other opens), with the supplied @var{fd} used as
- an initial file descriptor (but subject to closure at any time),
- call bfd_set_cacheable(bfd, 1) on the returned BFD. The default
- is to assume no caching; the file descriptor will remain open
- until <<bfd_close>>, and will not be affected by BFD operations
- on other files.
-
- Possible errors are <<bfd_error_no_memory>>,
- <<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
-*/
-
-bfd *
-bfd_fdopenr (const char *filename, const char *target, int fd)
-{
- bfd *nbfd;
- const bfd_target *target_vec;
- int fdflags;
-
- bfd_set_error (bfd_error_system_call);
-#if ! defined(HAVE_FCNTL) || ! defined(F_GETFL)
- fdflags = O_RDWR; /* Assume full access. */
-#else
- fdflags = fcntl (fd, F_GETFL, NULL);
-#endif
- if (fdflags == -1)
- return NULL;
-
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
- return NULL;
-
- target_vec = bfd_find_target (target, nbfd);
- if (target_vec == NULL)
- {
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
-#ifndef HAVE_FDOPEN
- nbfd->iostream = fopen (filename, FOPEN_RB);
-#else
- /* (O_ACCMODE) parens are to avoid Ultrix header file bug. */
- switch (fdflags & (O_ACCMODE))
- {
- case O_RDONLY: nbfd->iostream = fdopen (fd, FOPEN_RB); break;
- case O_WRONLY: nbfd->iostream = fdopen (fd, FOPEN_RUB); break;
- case O_RDWR: nbfd->iostream = fdopen (fd, FOPEN_RUB); break;
- default: abort ();
- }
-#endif
-
- if (nbfd->iostream == NULL)
- {
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
- /* OK, put everything where it belongs. */
- nbfd->filename = filename;
-
- /* As a special case we allow a FD open for read/write to
- be written through, although doing so requires that we end
- the previous clause with a preposition. */
- /* (O_ACCMODE) parens are to avoid Ultrix header file bug. */
- switch (fdflags & (O_ACCMODE))
- {
- case O_RDONLY: nbfd->direction = read_direction; break;
- case O_WRONLY: nbfd->direction = write_direction; break;
- case O_RDWR: nbfd->direction = both_direction; break;
- default: abort ();
- }
-
- if (! bfd_cache_init (nbfd))
- {
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
- nbfd->opened_once = TRUE;
-
- return nbfd;
-}
-
-/*
-FUNCTION
- bfd_openstreamr
-
-SYNOPSIS
- bfd *bfd_openstreamr (const char *, const char *, void *);
-
-DESCRIPTION
-
- Open a BFD for read access on an existing stdio stream. When
- the BFD is passed to <<bfd_close>>, the stream will be closed.
-*/
-
-bfd *
-bfd_openstreamr (const char *filename, const char *target, void *streamarg)
-{
- FILE *stream = streamarg;
- bfd *nbfd;
- const bfd_target *target_vec;
-
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
- return NULL;
-
- target_vec = bfd_find_target (target, nbfd);
- if (target_vec == NULL)
- {
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
- nbfd->iostream = stream;
- nbfd->filename = filename;
- nbfd->direction = read_direction;
-
- if (! bfd_cache_init (nbfd))
- {
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
- return nbfd;
-}
-
-/* bfd_openw -- open for writing.
- Returns a pointer to a freshly-allocated BFD on success, or NULL.
-
- See comment by bfd_fdopenr before you try to modify this function. */
-
-/*
-FUNCTION
- bfd_openw
-
-SYNOPSIS
- bfd *bfd_openw (const char *filename, const char *target);
-
-DESCRIPTION
- Create a BFD, associated with file @var{filename}, using the
- file format @var{target}, and return a pointer to it.
-
- Possible errors are <<bfd_error_system_call>>, <<bfd_error_no_memory>>,
- <<bfd_error_invalid_target>>.
-*/
-
-bfd *
-bfd_openw (const char *filename, const char *target)
-{
- bfd *nbfd;
- const bfd_target *target_vec;
-
- /* nbfd has to point to head of malloc'ed block so that bfd_close may
- reclaim it correctly. */
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
- return NULL;
-
- target_vec = bfd_find_target (target, nbfd);
- if (target_vec == NULL)
- {
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
- nbfd->filename = filename;
- nbfd->direction = write_direction;
-
- if (bfd_open_file (nbfd) == NULL)
- {
- /* File not writeable, etc. */
- bfd_set_error (bfd_error_system_call);
- _bfd_delete_bfd (nbfd);
- return NULL;
- }
-
- return nbfd;
-}
-
-/*
-
-FUNCTION
- bfd_close
-
-SYNOPSIS
- bfd_boolean bfd_close (bfd *abfd);
-
-DESCRIPTION
-
- Close a BFD. If the BFD was open for writing, then pending
- operations are completed and the file written out and closed.
- If the created file is executable, then <<chmod>> is called
- to mark it as such.
-
- All memory attached to the BFD is released.
-
- The file descriptor associated with the BFD is closed (even
- if it was passed in to BFD by <<bfd_fdopenr>>).
-
-RETURNS
- <<TRUE>> is returned if all is ok, otherwise <<FALSE>>.
-*/
-
-
-bfd_boolean
-bfd_close (bfd *abfd)
-{
- bfd_boolean ret;
-
- if (bfd_write_p (abfd))
- {
- if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
- return FALSE;
- }
-
- if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
- return FALSE;
-
- ret = bfd_cache_close (abfd);
-
- /* If the file was open for writing and is now executable,
- make it so. */
- if (ret
- && abfd->direction == write_direction
- && abfd->flags & EXEC_P)
- {
- struct stat buf;
-
- if (stat (abfd->filename, &buf) == 0)
- {
- unsigned int mask = umask (0);
-
- umask (mask);
- chmod (abfd->filename,
- (0777
- & (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask))));
- }
- }
-
- _bfd_delete_bfd (abfd);
-
- return ret;
-}
-
-/*
-FUNCTION
- bfd_close_all_done
-
-SYNOPSIS
- bfd_boolean bfd_close_all_done (bfd *);
-
-DESCRIPTION
- Close a BFD. Differs from <<bfd_close>> since it does not
- complete any pending operations. This routine would be used
- if the application had just used BFD for swapping and didn't
- want to use any of the writing code.
-
- If the created file is executable, then <<chmod>> is called
- to mark it as such.
-
- All memory attached to the BFD is released.
-
-RETURNS
- <<TRUE>> is returned if all is ok, otherwise <<FALSE>>.
-*/
-
-bfd_boolean
-bfd_close_all_done (bfd *abfd)
-{
- bfd_boolean ret;
-
- ret = bfd_cache_close (abfd);
-
- /* If the file was open for writing and is now executable,
- make it so. */
- if (ret
- && abfd->direction == write_direction
- && abfd->flags & EXEC_P)
- {
- struct stat buf;
-
- if (stat (abfd->filename, &buf) == 0)
- {
- unsigned int mask = umask (0);
-
- umask (mask);
- chmod (abfd->filename,
- (0777
- & (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask))));
- }
- }
-
- _bfd_delete_bfd (abfd);
-
- return ret;
-}
-
-/*
-FUNCTION
- bfd_create
-
-SYNOPSIS
- bfd *bfd_create (const char *filename, bfd *templ);
-
-DESCRIPTION
- Create a new BFD in the manner of <<bfd_openw>>, but without
- opening a file. The new BFD takes the target from the target
- used by @var{template}. The format is always set to <<bfd_object>>.
-*/
-
-bfd *
-bfd_create (const char *filename, bfd *templ)
-{
- bfd *nbfd;
-
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
- return NULL;
- nbfd->filename = filename;
- if (templ)
- nbfd->xvec = templ->xvec;
- nbfd->direction = no_direction;
- bfd_set_format (nbfd, bfd_object);
-
- return nbfd;
-}
-
-/*
-FUNCTION
- bfd_make_writable
-
-SYNOPSIS
- bfd_boolean bfd_make_writable (bfd *abfd);
-
-DESCRIPTION
- Takes a BFD as created by <<bfd_create>> and converts it
- into one like as returned by <<bfd_openw>>. It does this
- by converting the BFD to BFD_IN_MEMORY. It's assumed that
- you will call <<bfd_make_readable>> on this bfd later.
-
-RETURNS
- <<TRUE>> is returned if all is ok, otherwise <<FALSE>>.
-*/
-
-bfd_boolean
-bfd_make_writable (bfd *abfd)
-{
- struct bfd_in_memory *bim;
-
- if (abfd->direction != no_direction)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- bim = bfd_malloc (sizeof (struct bfd_in_memory));
- abfd->iostream = bim;
- /* bfd_bwrite will grow these as needed. */
- bim->size = 0;
- bim->buffer = 0;
-
- abfd->flags |= BFD_IN_MEMORY;
- abfd->direction = write_direction;
- abfd->where = 0;
-
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_make_readable
-
-SYNOPSIS
- bfd_boolean bfd_make_readable (bfd *abfd);
-
-DESCRIPTION
- Takes a BFD as created by <<bfd_create>> and
- <<bfd_make_writable>> and converts it into one like as
- returned by <<bfd_openr>>. It does this by writing the
- contents out to the memory buffer, then reversing the
- direction.
-
-RETURNS
- <<TRUE>> is returned if all is ok, otherwise <<FALSE>>. */
-
-bfd_boolean
-bfd_make_readable (bfd *abfd)
-{
- if (abfd->direction != write_direction || !(abfd->flags & BFD_IN_MEMORY))
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
- return FALSE;
-
- if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
- return FALSE;
-
-
- abfd->arch_info = &bfd_default_arch_struct;
-
- abfd->where = 0;
- abfd->format = bfd_unknown;
- abfd->my_archive = NULL;
- abfd->origin = 0;
- abfd->opened_once = FALSE;
- abfd->output_has_begun = FALSE;
- abfd->section_count = 0;
- abfd->usrdata = NULL;
- abfd->cacheable = FALSE;
- abfd->flags = BFD_IN_MEMORY;
- abfd->mtime_set = FALSE;
-
- abfd->target_defaulted = TRUE;
- abfd->direction = read_direction;
- abfd->sections = 0;
- abfd->symcount = 0;
- abfd->outsymbols = 0;
- abfd->tdata.any = 0;
-
- bfd_section_list_clear (abfd);
- bfd_check_format (abfd, bfd_object);
-
- return TRUE;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_alloc
-
-SYNOPSIS
- void *bfd_alloc (bfd *abfd, size_t wanted);
-
-DESCRIPTION
- Allocate a block of @var{wanted} bytes of memory attached to
- <<abfd>> and return a pointer to it.
-*/
-
-
-void *
-bfd_alloc (bfd *abfd, bfd_size_type size)
-{
- void *ret;
-
- if (size != (unsigned long) size)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
-
- ret = objalloc_alloc (abfd->memory, (unsigned long) size);
- if (ret == NULL)
- bfd_set_error (bfd_error_no_memory);
- return ret;
-}
-
-void *
-bfd_zalloc (bfd *abfd, bfd_size_type size)
-{
- void *res;
-
- res = bfd_alloc (abfd, size);
- if (res)
- memset (res, 0, (size_t) size);
- return res;
-}
-
-/* Free a block allocated for a BFD.
- Note: Also frees all more recently allocated blocks! */
-
-void
-bfd_release (bfd *abfd, void *block)
-{
- objalloc_free_block ((struct objalloc *) abfd->memory, block);
-}
-
-
-/*
- GNU Extension: separate debug-info files
-
- The idea here is that a special section called .gnu_debuglink might be
- embedded in a binary file, which indicates that some *other* file
- contains the real debugging information. This special section contains a
- filename and CRC32 checksum, which we read and resolve to another file,
- if it exists.
-
- This facilitates "optional" provision of debugging information, without
- having to provide two complete copies of every binary object (with and
- without debug symbols).
-*/
-
-#define GNU_DEBUGLINK ".gnu_debuglink"
-/*
-FUNCTION
- bfd_calc_gnu_debuglink_crc32
-
-SYNOPSIS
- unsigned long bfd_calc_gnu_debuglink_crc32
- (unsigned long crc, const unsigned char *buf, bfd_size_type len);
-
-DESCRIPTION
- Computes a CRC value as used in the .gnu_debuglink section.
- Advances the previously computed @var{crc} value by computing
- and adding in the crc32 for @var{len} bytes of @var{buf}.
-
-RETURNS
- Return the updated CRC32 value.
-*/
-
-unsigned long
-bfd_calc_gnu_debuglink_crc32 (unsigned long crc,
- const unsigned char *buf,
- bfd_size_type len)
-{
- static const unsigned long crc32_table[256] =
- {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
- 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
- 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
- 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
- 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
- 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
- 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
- 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
- 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
- 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
- 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
- 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
- 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
- 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
- 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
- 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
- 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
- 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
- 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
- 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
- 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
- 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
- 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
- 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
- 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
- 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
- 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
- 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
- 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
- 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
- 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
- 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
- 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
- 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
- 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
- 0x2d02ef8d
- };
- const unsigned char *end;
-
- crc = ~crc & 0xffffffff;
- for (end = buf + len; buf < end; ++ buf)
- crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
- return ~crc & 0xffffffff;;
-}
-
-
-/*
-INTERNAL_FUNCTION
- get_debug_link_info
-
-SYNOPSIS
- char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out);
-
-DESCRIPTION
- fetch the filename and CRC32 value for any separate debuginfo
- associated with @var{abfd}. Return NULL if no such info found,
- otherwise return filename and update @var{crc32_out}.
-*/
-
-static char *
-get_debug_link_info (bfd *abfd, unsigned long *crc32_out)
-{
- asection * sect;
- bfd_size_type debuglink_size;
- unsigned long crc32;
- char * contents;
- int crc_offset;
- bfd_boolean ret;
-
- BFD_ASSERT (abfd);
- BFD_ASSERT (crc32_out);
-
- sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
-
- if (sect == NULL)
- return NULL;
-
- debuglink_size = bfd_section_size (abfd, sect);
-
- contents = malloc (debuglink_size);
- if (contents == NULL)
- return NULL;
-
- ret = bfd_get_section_contents (abfd, sect, contents, 0, debuglink_size);
- if (! ret)
- {
- free (contents);
- return NULL;
- }
-
- /* Crc value is stored after the filename, aligned up to 4 bytes. */
- crc_offset = strlen (contents) + 1;
- crc_offset = (crc_offset + 3) & ~3;
-
- crc32 = bfd_get_32 (abfd, contents + crc_offset);
-
- *crc32_out = crc32;
- return contents;
-}
-
-/*
-INTERNAL_FUNCTION
- separate_debug_file_exists
-
-SYNOPSIS
- bfd_boolean separate_debug_file_exists
- (char *name, unsigned long crc32);
-
-DESCRIPTION
- Checks to see if @var{name} is a file and if its contents
- match @var{crc32}.
-*/
-
-static bfd_boolean
-separate_debug_file_exists (const char *name, const unsigned long crc)
-{
- static char buffer [8 * 1024];
- unsigned long file_crc = 0;
- int fd;
- bfd_size_type count;
-
- BFD_ASSERT (name);
-
- fd = open (name, O_RDONLY);
- if (fd < 0)
- return FALSE;
-
- while ((count = read (fd, buffer, sizeof (buffer))) > 0)
- file_crc = bfd_calc_gnu_debuglink_crc32 (file_crc, buffer, count);
-
- close (fd);
-
- return crc == file_crc;
-}
-
-
-/*
-INTERNAL_FUNCTION
- find_separate_debug_file
-
-SYNOPSIS
- char *find_separate_debug_file (bfd *abfd);
-
-DESCRIPTION
- Searches @var{abfd} for a reference to separate debugging
- information, scans various locations in the filesystem, including
- the file tree rooted at @var{debug_file_directory}, and returns a
- filename of such debugging information if the file is found and has
- matching CRC32. Returns NULL if no reference to debugging file
- exists, or file cannot be found.
-*/
-
-static char *
-find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
-{
- char *basename;
- char *dir;
- char *debugfile;
- unsigned long crc32;
- int i;
-
- BFD_ASSERT (abfd);
- if (debug_file_directory == NULL)
- debug_file_directory = ".";
-
- /* BFD may have been opened from a stream. */
- if (! abfd->filename)
- return NULL;
-
- basename = get_debug_link_info (abfd, & crc32);
- if (basename == NULL)
- return NULL;
-
- if (strlen (basename) < 1)
- {
- free (basename);
- return NULL;
- }
-
- dir = strdup (abfd->filename);
- if (dir == NULL)
- {
- free (basename);
- return NULL;
- }
- BFD_ASSERT (strlen (dir) != 0);
-
- /* Strip off filename part. */
- for (i = strlen (dir) - 1; i >= 0; i--)
- if (IS_DIR_SEPARATOR (dir[i]))
- break;
-
- dir[i + 1] = '\0';
- BFD_ASSERT (dir[i] == '/' || dir[0] == '\0')
-
- debugfile = malloc (strlen (debug_file_directory) + 1
- + strlen (dir)
- + strlen (".debug/")
- + strlen (basename)
- + 1);
- if (debugfile == NULL)
- {
- free (basename);
- free (dir);
- return NULL;
- }
-
- /* First try in the same directory as the original file: */
- strcpy (debugfile, dir);
- strcat (debugfile, basename);
-
- if (separate_debug_file_exists (debugfile, crc32))
- {
- free (basename);
- free (dir);
- return debugfile;
- }
-
- /* Then try in a subdirectory called .debug. */
- strcpy (debugfile, dir);
- strcat (debugfile, ".debug/");
- strcat (debugfile, basename);
-
- if (separate_debug_file_exists (debugfile, crc32))
- {
- free (basename);
- free (dir);
- return debugfile;
- }
-
- /* Then try in the global debugfile directory. */
- strcpy (debugfile, debug_file_directory);
- i = strlen (debug_file_directory) - 1;
- if (i > 0
- && debug_file_directory[i] != '/'
- && dir[0] != '/')
- strcat (debugfile, "/");
- strcat (debugfile, dir);
- strcat (debugfile, basename);
-
- if (separate_debug_file_exists (debugfile, crc32))
- {
- free (basename);
- free (dir);
- return debugfile;
- }
-
- free (debugfile);
- free (basename);
- free (dir);
- return NULL;
-}
-
-
-/*
-FUNCTION
- bfd_follow_gnu_debuglink
-
-SYNOPSIS
- char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
-
-DESCRIPTION
-
- Takes a BFD and searches it for a .gnu_debuglink section. If this
- section is found, it examines the section for the name and checksum
- of a '.debug' file containing auxiliary debugging information. It
- then searches the filesystem for this .debug file in some standard
- locations, including the directory tree rooted at @var{dir}, and if
- found returns the full filename.
-
- If @var{dir} is NULL, it will search a default path configured into
- libbfd at build time. [XXX this feature is not currently
- implemented].
-
-RETURNS
- <<NULL>> on any errors or failure to locate the .debug file,
- otherwise a pointer to a heap-allocated string containing the
- filename. The caller is responsible for freeing this string.
-*/
-
-char *
-bfd_follow_gnu_debuglink (bfd *abfd, const char *dir)
-{
-#if 0 /* Disabled until DEBUGDIR can be defined by configure.in. */
- if (dir == NULL)
- dir = DEBUGDIR;
-#endif
- return find_separate_debug_file (abfd, dir);
-}
-
-/*
-FUNCTION
- bfd_create_gnu_debuglink_section
-
-SYNOPSIS
- struct bfd_section *bfd_create_gnu_debuglink_section
- (bfd *abfd, const char *filename);
-
-DESCRIPTION
-
- Takes a @var{BFD} and adds a .gnu_debuglink section to it. The section is sized
- to be big enough to contain a link to the specified @var{filename}.
-
-RETURNS
- A pointer to the new section is returned if all is ok. Otherwise <<NULL>> is
- returned and bfd_error is set.
-*/
-
-asection *
-bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
-{
- asection *sect;
- bfd_size_type debuglink_size;
-
- if (abfd == NULL || filename == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- /* Strip off any path components in filename. */
- filename = lbasename (filename);
-
- sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
- if (sect)
- {
- /* Section already exists. */
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- sect = bfd_make_section (abfd, GNU_DEBUGLINK);
- if (sect == NULL)
- return NULL;
-
- if (! bfd_set_section_flags (abfd, sect,
- SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING))
- /* XXX Should we delete the section from the bfd ? */
- return NULL;
-
-
- debuglink_size = strlen (filename) + 1;
- debuglink_size += 3;
- debuglink_size &= ~3;
- debuglink_size += 4;
-
- if (! bfd_set_section_size (abfd, sect, debuglink_size))
- /* XXX Should we delete the section from the bfd ? */
- return NULL;
-
- return sect;
-}
-
-
-/*
-FUNCTION
- bfd_fill_in_gnu_debuglink_section
-
-SYNOPSIS
- bfd_boolean bfd_fill_in_gnu_debuglink_section
- (bfd *abfd, struct bfd_section *sect, const char *filename);
-
-DESCRIPTION
-
- Takes a @var{BFD} and containing a .gnu_debuglink section @var{SECT}
- and fills in the contents of the section to contain a link to the
- specified @var{filename}. The filename should be relative to the
- current directory.
-
-RETURNS
- <<TRUE>> is returned if all is ok. Otherwise <<FALSE>> is returned
- and bfd_error is set.
-*/
-
-bfd_boolean
-bfd_fill_in_gnu_debuglink_section (bfd *abfd,
- struct bfd_section *sect,
- const char *filename)
-{
- bfd_size_type debuglink_size;
- unsigned long crc32;
- char * contents;
- bfd_size_type crc_offset;
- FILE * handle;
- static char buffer[8 * 1024];
- size_t count;
-
- if (abfd == NULL || sect == NULL || filename == NULL)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- /* Make sure that we can read the file.
- XXX - Should we attempt to locate the debug info file using the same
- algorithm as gdb ? At the moment, since we are creating the
- .gnu_debuglink section, we insist upon the user providing us with a
- correct-for-section-creation-time path, but this need not conform to
- the gdb location algorithm. */
- handle = fopen (filename, FOPEN_RB);
- if (handle == NULL)
- {
- bfd_set_error (bfd_error_system_call);
- return FALSE;
- }
-
- crc32 = 0;
- while ((count = fread (buffer, 1, sizeof buffer, handle)) > 0)
- crc32 = bfd_calc_gnu_debuglink_crc32 (crc32, buffer, count);
- fclose (handle);
-
- /* Strip off any path components in filename,
- now that we no longer need them. */
- filename = lbasename (filename);
-
- debuglink_size = strlen (filename) + 1;
- debuglink_size += 3;
- debuglink_size &= ~3;
- debuglink_size += 4;
-
- contents = malloc (debuglink_size);
- if (contents == NULL)
- {
- /* XXX Should we delete the section from the bfd ? */
- bfd_set_error (bfd_error_no_memory);
- return FALSE;
- }
-
- strcpy (contents, filename);
- crc_offset = debuglink_size - 4;
-
- bfd_put_32 (abfd, crc32, contents + crc_offset);
-
- if (! bfd_set_section_contents (abfd, sect, contents, 0, debuglink_size))
- {
- /* XXX Should we delete the section from the bfd ? */
- free (contents);
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/osf-core.c b/contrib/binutils/bfd/osf-core.c
deleted file mode 100644
index 8273504..0000000
--- a/contrib/binutils/bfd/osf-core.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/* BFD back-end for OSF/1 core files.
- Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file can only be compiled on systems which use OSF/1 style
- core files. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#include <sys/user.h>
-#include <sys/core.h>
-
-/* forward declarations */
-
-static asection *make_bfd_asection
- PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr));
-static const bfd_target *osf_core_core_file_p
- PARAMS ((bfd *));
-static char *osf_core_core_file_failing_command
- PARAMS ((bfd *));
-static int osf_core_core_file_failing_signal
- PARAMS ((bfd *));
-static bfd_boolean osf_core_core_file_matches_executable_p
- PARAMS ((bfd *, bfd *));
-static void swap_abort
- PARAMS ((void));
-
-/* These are stored in the bfd's tdata */
-
-struct osf_core_struct
-{
- int sig;
- char cmd[MAXCOMLEN + 1];
-};
-
-#define core_hdr(bfd) ((bfd)->tdata.osf_core_data)
-#define core_signal(bfd) (core_hdr(bfd)->sig)
-#define core_command(bfd) (core_hdr(bfd)->cmd)
-
-static asection *
-make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
- bfd *abfd;
- const char *name;
- flagword flags;
- bfd_size_type _raw_size;
- bfd_vma vma;
- file_ptr filepos;
-{
- asection *asect;
-
- asect = bfd_make_section_anyway (abfd, name);
- if (!asect)
- return NULL;
-
- asect->flags = flags;
- asect->_raw_size = _raw_size;
- asect->vma = vma;
- asect->filepos = filepos;
- asect->alignment_power = 8;
-
- return asect;
-}
-
-static const bfd_target *
-osf_core_core_file_p (abfd)
- bfd *abfd;
-{
- int val;
- int i;
- char *secname;
- struct core_filehdr core_header;
- bfd_size_type amt;
-
- amt = sizeof core_header;
- val = bfd_bread ((PTR) &core_header, amt, abfd);
- if (val != sizeof core_header)
- return NULL;
-
- if (strncmp (core_header.magic, "Core", 4) != 0)
- return NULL;
-
- core_hdr (abfd) = (struct osf_core_struct *)
- bfd_zalloc (abfd, (bfd_size_type) sizeof (struct osf_core_struct));
- if (!core_hdr (abfd))
- return NULL;
-
- strncpy (core_command (abfd), core_header.name, MAXCOMLEN + 1);
- core_signal (abfd) = core_header.signo;
-
- for (i = 0; i < core_header.nscns; i++)
- {
- struct core_scnhdr core_scnhdr;
- flagword flags;
-
- amt = sizeof core_scnhdr;
- val = bfd_bread ((PTR) &core_scnhdr, amt, abfd);
- if (val != sizeof core_scnhdr)
- break;
-
- /* Skip empty sections. */
- if (core_scnhdr.size == 0 || core_scnhdr.scnptr == 0)
- continue;
-
- switch (core_scnhdr.scntype)
- {
- case SCNRGN:
- secname = ".data";
- flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- break;
- case SCNSTACK:
- secname = ".stack";
- flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- break;
- case SCNREGS:
- secname = ".reg";
- flags = SEC_HAS_CONTENTS;
- break;
- default:
- (*_bfd_error_handler) (_("Unhandled OSF/1 core file section type %d\n"),
- core_scnhdr.scntype);
- continue;
- }
-
- if (!make_bfd_asection (abfd, secname, flags,
- (bfd_size_type) core_scnhdr.size,
- (bfd_vma) core_scnhdr.vaddr,
- (file_ptr) core_scnhdr.scnptr))
- goto fail;
- }
-
- /* OK, we believe you. You're a core file (sure, sure). */
-
- return abfd->xvec;
-
- fail:
- bfd_release (abfd, core_hdr (abfd));
- core_hdr (abfd) = NULL;
- bfd_section_list_clear (abfd);
- return NULL;
-}
-
-static char *
-osf_core_core_file_failing_command (abfd)
- bfd *abfd;
-{
- return core_command (abfd);
-}
-
-static int
-osf_core_core_file_failing_signal (abfd)
- bfd *abfd;
-{
- return core_signal (abfd);
-}
-
-static bfd_boolean
-osf_core_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd ATTRIBUTE_UNUSED;
- bfd *exec_bfd ATTRIBUTE_UNUSED;
-{
- return TRUE; /* FIXME, We have no way of telling at this point */
-}
-
-/* If somebody calls any byte-swapping routines, shoot them. */
-static void
-swap_abort()
-{
- abort(); /* This way doesn't require any declaration for ANSI to fuck up */
-}
-
-#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
-#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
-#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
-#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
-#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
-#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
-
-const bfd_target osf_core_vec =
- {
- "osf-core",
- bfd_target_unknown_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order */
- BFD_ENDIAN_LITTLE, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* symbol prefix */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
-
- { /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- osf_core_core_file_p /* a core file */
- },
- { /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
- { /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
-
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (osf_core),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0 /* backend_data */
- };
diff --git a/contrib/binutils/bfd/pe-arm.c b/contrib/binutils/bfd/pe-arm.c
deleted file mode 100644
index 8b5d1c7..0000000
--- a/contrib/binutils/bfd/pe-arm.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* BFD back-end for ARM PECOFF files.
- Copyright 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#ifndef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM armpe_little_vec
-#define TARGET_LITTLE_NAME "pe-arm-little"
-#define TARGET_BIG_SYM armpe_big_vec
-#define TARGET_BIG_NAME "pe-arm-big"
-#endif
-
-#define COFF_WITH_PE
-#define PCRELOFFSET TRUE
-#define COFF_LONG_SECTION_NAMES
-
-#ifndef bfd_arm_allocate_interworking_sections
-#define bfd_arm_allocate_interworking_sections \
- bfd_arm_pe_allocate_interworking_sections
-#define bfd_arm_get_bfd_for_interworking \
- bfd_arm_pe_get_bfd_for_interworking
-#define bfd_arm_process_before_allocation \
- bfd_arm_pe_process_before_allocation
-#endif
-
-#ifdef ARM_WINCE
-#define TARGET_UNDERSCORE 0
-#endif
-
-#include "coff-arm.c"
diff --git a/contrib/binutils/bfd/pe-i386.c b/contrib/binutils/bfd/pe-i386.c
deleted file mode 100644
index a912cff..0000000
--- a/contrib/binutils/bfd/pe-i386.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* BFD back-end for Intel 386 PECOFF files.
- Copyright 1995, 1996, 1999, 2001, 2002 Free Software Foundation, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#define TARGET_SYM i386pe_vec
-#define TARGET_NAME "pe-i386"
-#define COFF_WITH_PE
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-#define COFF_LONG_SECTION_NAMES
-#define COFF_LONG_FILENAMES
-
-#define COFF_SECTION_ALIGNMENT_ENTRIES \
-{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
-{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
- COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }
-
-#include "coff-i386.c"
diff --git a/contrib/binutils/bfd/pe-mips.c b/contrib/binutils/bfd/pe-mips.c
deleted file mode 100644
index 3066aaa..0000000
--- a/contrib/binutils/bfd/pe-mips.c
+++ /dev/null
@@ -1,1000 +0,0 @@
-/* BFD back-end for MIPS PE COFF files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
- Modified from coff-i386.c by DJ Delorie, dj@cygnus.com
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define COFF_WITH_PE
-#define COFF_LONG_SECTION_NAMES
-#define PCRELOFFSET TRUE
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#include "coff/mipspe.h"
-
-#include "coff/internal.h"
-
-#include "coff/pe.h"
-
-#include "libcoff.h"
-
-static bfd_reloc_status_type coff_mips_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static reloc_howto_type *coff_mips_rtype_to_howto
- PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
-#if 0
-static void mips_ecoff_swap_reloc_in
- PARAMS ((bfd *, PTR, struct internal_reloc *));
-static void mips_ecoff_swap_reloc_out
- PARAMS ((bfd *, const struct internal_reloc *, PTR));
-static void mips_adjust_reloc_in
- PARAMS ((bfd *, const struct internal_reloc *, arelent *));
-static void mips_adjust_reloc_out
- PARAMS ((bfd *, const arelent *, struct internal_reloc *));
-#endif
-
-static bfd_boolean in_reloc_p
- PARAMS ((bfd *, reloc_howto_type *));
-static reloc_howto_type * coff_mips_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void mips_swap_reloc_in
- PARAMS ((bfd *, PTR, PTR));
-static unsigned int mips_swap_reloc_out
- PARAMS ((bfd *, PTR, PTR));
-static bfd_boolean coff_pe_mips_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
-/* The page size is a guess based on ELF. */
-
-#define COFF_PAGE_SIZE 0x1000
-
-/* For some reason when using mips COFF the value stored in the .text
- section for a reference to a common symbol is the value itself plus
- any desired offset. Ian Taylor, Cygnus Support. */
-
-/* If we are producing relocatable output, we need to do some
- adjustments to the object file that are not done by the
- bfd_perform_relocation function. This function is called by every
- reloc type to make any required adjustments. */
-
-static bfd_reloc_status_type
-coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- symvalue diff;
-
- if (output_bfd == (bfd *) NULL)
- return bfd_reloc_continue;
-
- if (bfd_is_com_section (symbol->section))
- {
-#ifndef COFF_WITH_PE
- /* We are relocating a common symbol. The current value in the
- object file is ORIG + OFFSET, where ORIG is the value of the
- common symbol as seen by the object file when it was compiled
- (this may be zero if the symbol was undefined) and OFFSET is
- the offset into the common symbol (normally zero, but may be
- non-zero when referring to a field in a common structure).
- ORIG is the negative of reloc_entry->addend, which is set by
- the CALC_ADDEND macro below. We want to replace the value in
- the object file with NEW + OFFSET, where NEW is the value of
- the common symbol which we are going to put in the final
- object file. NEW is symbol->value. */
- diff = symbol->value + reloc_entry->addend;
-#else
- /* In PE mode, we do not offset the common symbol. */
- diff = reloc_entry->addend;
-#endif
- }
- else
- {
- /* For some reason bfd_perform_relocation always effectively
- ignores the addend for a COFF target when producing
- relocatable output. This seems to be always wrong for 386
- COFF, so we handle the addend here instead. */
- diff = reloc_entry->addend;
- }
-
-#ifdef COFF_WITH_PE
-#if 0
- /* dj - handle it like any other reloc? */
- /* FIXME: How should this case be handled? */
- if (reloc_entry->howto->type == MIPS_R_RVA && diff != 0)
- abort ();
-#endif
-#endif
-
-#define DOIT(x) \
- x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask))
-
- if (diff != 0)
- {
- reloc_howto_type *howto = reloc_entry->howto;
- unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-
- switch (howto->size)
- {
- case 0:
- {
- char x = bfd_get_8 (abfd, addr);
- DOIT (x);
- bfd_put_8 (abfd, x, addr);
- }
- break;
-
- case 1:
- {
- short x = bfd_get_16 (abfd, addr);
- DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- case 2:
- {
- long x = bfd_get_32 (abfd, addr);
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- default:
- abort ();
- }
- }
-
- /* Now let bfd_perform_relocation finish everything up. */
- return bfd_reloc_continue;
-}
-
-#ifdef COFF_WITH_PE
-/* Return TRUE if this relocation should
- appear in the output .reloc section. */
-
-static bfd_boolean
-in_reloc_p (abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type *howto;
-{
- return ! howto->pc_relative && howto->type != MIPS_R_RVA;
-}
-#endif
-
-#ifndef PCRELOFFSET
-#define PCRELOFFSET FALSE
-#endif
-
-static reloc_howto_type howto_table[] =
-{
- /* Reloc type 0 is ignored. The reloc reading code ensures that
- this is a reference to the .abs section, which will cause
- bfd_perform_relocation to do nothing. */
- HOWTO (MIPS_R_ABSOLUTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "IGNORE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 16 bit reference to a symbol, normally from a data section. */
- HOWTO (MIPS_R_REFHALF, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFHALF", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 32 bit reference to a symbol, normally from a data section. */
- HOWTO (MIPS_R_REFWORD, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFWORD", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A 26 bit absolute jump address. */
- HOWTO (MIPS_R_JMPADDR, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC. */
- coff_mips_reloc, /* special_function */
- "JMPADDR", /* name */
- TRUE, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The high 16 bits of a symbol value. Handled by the function
- mips_refhi_reloc. */
- HOWTO (MIPS_R_REFHI, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFHI", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The low 16 bits of a symbol value. */
- HOWTO (MIPS_R_REFLO, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "REFLO", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A reference to an offset from the gp register. Handled by the
- function mips_gprel_reloc. */
- HOWTO (MIPS_R_GPREL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "GPREL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A reference to a literal using an offset from the gp register.
- Handled by the function mips_gprel_reloc. */
- HOWTO (MIPS_R_LITERAL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "LITERAL", /* name */
- TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (8),
- EMPTY_HOWTO (9),
- EMPTY_HOWTO (10),
- EMPTY_HOWTO (11),
- EMPTY_HOWTO (12),
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
- EMPTY_HOWTO (16),
- EMPTY_HOWTO (17),
- EMPTY_HOWTO (18),
- EMPTY_HOWTO (19),
- EMPTY_HOWTO (20),
- EMPTY_HOWTO (21),
- EMPTY_HOWTO (22),
- EMPTY_HOWTO (23),
- EMPTY_HOWTO (24),
- EMPTY_HOWTO (25),
- EMPTY_HOWTO (26),
- EMPTY_HOWTO (27),
- EMPTY_HOWTO (28),
- EMPTY_HOWTO (29),
- EMPTY_HOWTO (30),
- EMPTY_HOWTO (31),
- EMPTY_HOWTO (32),
- EMPTY_HOWTO (33),
- HOWTO (MIPS_R_RVA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "rva32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
- EMPTY_HOWTO (35),
- EMPTY_HOWTO (36),
- HOWTO (MIPS_R_PAIR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "PAIR", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* Turn a howto into a reloc nunmber */
-
-#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
-#define BADMAG(x) MIPSBADMAG(x)
-#define MIPS 1 /* Customize coffcode.h */
-
-#define RTYPE2HOWTO(cache_ptr, dst) \
- (cache_ptr)->howto = howto_table + (dst)->r_type;
-
-/* Compute the addend of a reloc. If the reloc is to a common symbol,
- the object file contains the value of the common symbol. By the
- time this is called, the linker may be using a different symbol
- from a different object file with a different value. Therefore, we
- hack wildly to locate the original symbol from this file so that we
- can make the correct adjustment. This macro sets coffsym to the
- symbol from the original file, and uses it to set the addend value
- correctly. If this is not a common symbol, the usual addend
- calculation is done, except that an additional tweak is needed for
- PC relative relocs.
- FIXME: This macro refers to symbols and asect; these are from the
- calling function, not the macro arguments. */
-
-#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
- { \
- coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
- if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
- coffsym = (obj_symbols (abfd) \
- + (cache_ptr->sym_ptr_ptr - symbols)); \
- else if (ptr) \
- coffsym = coff_symbol_from (abfd, ptr); \
- if (coffsym != (coff_symbol_type *) NULL \
- && coffsym->native->u.syment.n_scnum == 0) \
- cache_ptr->addend = - coffsym->native->u.syment.n_value; \
- else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
- && ptr->section != (asection *) NULL) \
- cache_ptr->addend = - (ptr->section->vma + ptr->value); \
- else \
- cache_ptr->addend = 0; \
- if (ptr && howto_table[reloc.r_type].pc_relative) \
- cache_ptr->addend += asect->vma; \
- }
-
-/* Convert an rtype to howto for the COFF backend linker. */
-
-static reloc_howto_type *
-coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
- struct internal_reloc *rel;
- struct coff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma *addendp;
-{
-
- reloc_howto_type *howto;
-
- howto = howto_table + rel->r_type;
-
-#ifdef COFF_WITH_PE
- *addendp = 0;
-#endif
-
- if (howto->pc_relative)
- *addendp += sec->vma;
-
- if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
- {
- /* This is a common symbol. The section contents include the
- size (sym->n_value) as an addend. The relocate_section
- function will be adding in the final value of the symbol. We
- need to subtract out the current size in order to get the
- correct result. */
-
- BFD_ASSERT (h != NULL);
-
-#ifndef COFF_WITH_PE
- /* I think we *do* want to bypass this. If we don't, I have
- seen some data parameters get the wrong relocation address.
- If I link two versions with and without this section bypassed
- and then do a binary comparison, the addresses which are
- different can be looked up in the map. The case in which
- this section has been bypassed has addresses which correspond
- to values I can find in the map. */
- *addendp -= sym->n_value;
-#endif
- }
-
-#ifndef COFF_WITH_PE
- /* If the output symbol is common (in which case this must be a
- relocatable link), we need to add in the final size of the
- common symbol. */
- if (h != NULL && h->root.type == bfd_link_hash_common)
- *addendp += h->root.u.c.size;
-#endif
-
-#ifdef COFF_WITH_PE
- if (howto->pc_relative)
- {
- *addendp -= 4;
-
- /* If the symbol is defined, then the generic code is going to
- add back the symbol value in order to cancel out an
- adjustment it made to the addend. However, we set the addend
- to 0 at the start of this function. We need to adjust here,
- to avoid the adjustment the generic code will make. FIXME:
- This is getting a bit hackish. */
- if (sym != NULL && sym->n_scnum != 0)
- *addendp -= sym->n_value;
- }
-
- if (rel->r_type == MIPS_R_RVA)
- {
- *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
- }
-#endif
-
- return howto;
-}
-
-#define coff_rtype_to_howto coff_mips_rtype_to_howto
-
-#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
-
-/* Get the howto structure for a generic reloc type. */
-
-static reloc_howto_type *
-coff_mips_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- int mips_type;
-
- switch (code)
- {
- case BFD_RELOC_16:
- mips_type = MIPS_R_REFHALF;
- break;
- case BFD_RELOC_32:
- case BFD_RELOC_CTOR:
- mips_type = MIPS_R_REFWORD;
- break;
- case BFD_RELOC_MIPS_JMP:
- mips_type = MIPS_R_JMPADDR;
- break;
- case BFD_RELOC_HI16_S:
- mips_type = MIPS_R_REFHI;
- break;
- case BFD_RELOC_LO16:
- mips_type = MIPS_R_REFLO;
- break;
- case BFD_RELOC_GPREL16:
- mips_type = MIPS_R_GPREL;
- break;
- case BFD_RELOC_MIPS_LITERAL:
- mips_type = MIPS_R_LITERAL;
- break;
-/* FIXME?
- case BFD_RELOC_16_PCREL_S2:
- mips_type = MIPS_R_PCREL16;
- break;
- case BFD_RELOC_PCREL_HI16_S:
- mips_type = MIPS_R_RELHI;
- break;
- case BFD_RELOC_PCREL_LO16:
- mips_type = MIPS_R_RELLO;
- break;
- case BFD_RELOC_GPREL32:
- mips_type = MIPS_R_SWITCH;
- break;
-*/
- case BFD_RELOC_RVA:
- mips_type = MIPS_R_RVA;
- break;
- default:
- return (reloc_howto_type *) NULL;
- }
-
- return &howto_table[mips_type];
-}
-
-static void
-mips_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- static struct internal_reloc pair_prev;
- RELOC *reloc_src = (RELOC *) src;
- struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
-
- reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr);
- reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
- reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
- reloc_dst->r_size = 0;
- reloc_dst->r_extern = 0;
- reloc_dst->r_offset = 0;
-
- switch (reloc_dst->r_type)
- {
- case MIPS_R_REFHI:
- pair_prev = *reloc_dst;
- break;
- case MIPS_R_PAIR:
- reloc_dst->r_offset = reloc_dst->r_symndx;
- if (reloc_dst->r_offset & 0x8000)
- reloc_dst->r_offset -= 0x10000;
- /*printf ("dj: pair offset is %08x\n", reloc_dst->r_offset);*/
- reloc_dst->r_symndx = pair_prev.r_symndx;
- break;
- }
-}
-
-static unsigned int
-mips_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- static int prev_offset = 1;
- static bfd_vma prev_addr = 0;
- struct internal_reloc *reloc_src = (struct internal_reloc *)src;
- struct external_reloc *reloc_dst = (struct external_reloc *)dst;
-
- switch (reloc_src->r_type)
- {
- case MIPS_R_REFHI:
- prev_addr = reloc_src->r_vaddr;
- prev_offset = reloc_src->r_offset;
- break;
- case MIPS_R_REFLO:
- if (reloc_src->r_vaddr == prev_addr)
- {
- /* FIXME: only slightly hackish. If we see a REFLO pointing to
- the same address as a REFHI, we assume this is the matching
- PAIR reloc and output it accordingly. The symndx is really
- the low 16 bits of the addend */
- H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
- H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
- H_PUT_16 (abfd, MIPS_R_PAIR, reloc_dst->r_type);
- return RELSZ;
- }
- break;
- }
-
- H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
- H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
-
- H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
- return RELSZ;
-}
-
-#define coff_swap_reloc_in mips_swap_reloc_in
-#define coff_swap_reloc_out mips_swap_reloc_out
-#define NO_COFF_RELOCS
-
-static bfd_boolean
-coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
- input_section, contents, relocs, syms,
- sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
-{
- bfd_vma gp;
- bfd_boolean gp_undefined;
- size_t adjust;
- struct internal_reloc *rel;
- struct internal_reloc *rel_end;
- unsigned int i;
- bfd_boolean got_lo;
-
- if (info->relocatable)
- {
- (*_bfd_error_handler) (_("\
-%s: `ld -r' not supported with PE MIPS objects\n"),
- bfd_archive_filename (input_bfd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- BFD_ASSERT (input_bfd->xvec->byteorder
- == output_bfd->xvec->byteorder);
-
-#if 0
- printf ("dj: relocate %s(%s) %08x\n",
- input_bfd->filename, input_section->name,
- input_section->output_section->vma + input_section->output_offset);
-#endif
-
- gp = _bfd_get_gp_value (output_bfd);
- if (gp == 0)
- gp_undefined = TRUE;
- else
- gp_undefined = FALSE;
-
- got_lo = FALSE;
-
- adjust = 0;
-
- rel = relocs;
- rel_end = rel + input_section->reloc_count;
- for (i = 0; rel < rel_end; rel++, i++)
- {
- long symndx;
- struct coff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma addend = 0;
- bfd_vma val, tmp, targ, src, low;
- reloc_howto_type *howto;
- unsigned char *mem = contents + rel->r_vaddr;
-
- symndx = rel->r_symndx;
-
- if (symndx == -1)
- {
- h = NULL;
- sym = NULL;
- }
- else
- {
- h = obj_coff_sym_hashes (input_bfd)[symndx];
- sym = syms + symndx;
- }
-
- /* COFF treats common symbols in one of two ways. Either the
- size of the symbol is included in the section contents, or it
- is not. We assume that the size is not included, and force
- the rtype_to_howto function to adjust the addend as needed. */
-
- if (sym != NULL && sym->n_scnum != 0)
- addend = - sym->n_value;
- else
- addend = 0;
-
- howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
- sym, &addend);
- if (howto == NULL)
- return FALSE;
-
- /* If we are doing a relocatable link, then we can just ignore
- a PC relative reloc that is pcrel_offset. It will already
- have the correct value. If this is not a relocatable link,
- then we should ignore the symbol value. */
- if (howto->pc_relative && howto->pcrel_offset)
- {
- if (info->relocatable)
- continue;
- if (sym != NULL && sym->n_scnum != 0)
- addend += sym->n_value;
- }
-
- val = 0;
-
- if (h == NULL)
- {
- asection *sec;
-
- if (symndx == -1)
- {
- sec = bfd_abs_section_ptr;
- val = 0;
- }
- else
- {
- sec = sections[symndx];
- val = (sec->output_section->vma
- + sec->output_offset
- + sym->n_value);
- if (! obj_pe (input_bfd))
- val -= sec->vma;
- }
- }
- else
- {
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *sec;
-
- sec = h->root.u.def.section;
- val = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
-
- else if (! info->relocatable)
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, TRUE)))
- return FALSE;
- }
- }
-
- src = rel->r_vaddr + input_section->output_section->vma
- + input_section->output_offset;
-#if 0
- printf ("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n",
- rel->r_type, howto_table[rel->r_type].name,
- src, rel->r_vaddr, *(unsigned long *)mem, val, rel->r_offset,
- h?h->root.root.string:"(none)");
-#endif
-
- /* OK, at this point the following variables are set up:
- src = VMA of the memory we're fixing up
- mem = pointer to memory we're fixing up
- val = VMA of what we need to refer to
- */
-
-#define UI(x) (*_bfd_error_handler) (_("%s: unimplemented %s\n"), \
- bfd_archive_filename (input_bfd), x); \
- bfd_set_error (bfd_error_bad_value);
-
- switch (rel->r_type)
- {
- case MIPS_R_ABSOLUTE:
- /* ignore these */
- break;
-
- case MIPS_R_REFHALF:
- UI("refhalf");
- break;
-
- case MIPS_R_REFWORD:
- tmp = bfd_get_32(input_bfd, mem);
- /* printf ("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */
- tmp += val;
- bfd_put_32(input_bfd, tmp, mem);
- break;
-
- case MIPS_R_JMPADDR:
- tmp = bfd_get_32(input_bfd, mem);
- targ = val + (tmp&0x03ffffff)*4;
- if ((src & 0xf0000000) != (targ & 0xf0000000))
- {
- (*_bfd_error_handler) (_("%s: jump too far away\n"),
- bfd_archive_filename (input_bfd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- tmp &= 0xfc000000;
- tmp |= (targ/4) & 0x3ffffff;
- bfd_put_32(input_bfd, tmp, mem);
- break;
-
- case MIPS_R_REFHI:
- tmp = bfd_get_32(input_bfd, mem);
- switch (rel[1].r_type)
- {
- case MIPS_R_PAIR:
- /* MS PE object */
- targ = val + rel[1].r_offset + ((tmp & 0xffff) << 16);
- break;
- case MIPS_R_REFLO:
- /* GNU COFF object */
- low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr);
- low &= 0xffff;
- if (low & 0x8000)
- low -= 0x10000;
- targ = val + low + ((tmp & 0xffff) << 16);
- break;
- default:
- (*_bfd_error_handler) (_("%s: bad pair/reflo after refhi\n"),
- bfd_archive_filename (input_bfd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- tmp &= 0xffff0000;
- tmp |= (targ >> 16) & 0xffff;
- bfd_put_32(input_bfd, tmp, mem);
- break;
-
- case MIPS_R_REFLO:
- tmp = bfd_get_32(input_bfd, mem);
- targ = val + (tmp & 0xffff);
- /* printf ("refword: src=%08x targ=%08x\n", src, targ); */
- tmp &= 0xffff0000;
- tmp |= targ & 0xffff;
- bfd_put_32(input_bfd, tmp, mem);
- break;
-
- case MIPS_R_GPREL:
- case MIPS_R_LITERAL:
- UI("gprel");
- break;
-
- case MIPS_R_SECTION:
- UI("section");
- break;
-
- case MIPS_R_SECREL:
- UI("secrel");
- break;
-
- case MIPS_R_SECRELLO:
- UI("secrello");
- break;
-
- case MIPS_R_SECRELHI:
- UI("secrelhi");
- break;
-
- case MIPS_R_RVA:
- tmp = bfd_get_32 (input_bfd, mem);
- /* printf ("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */
- tmp += val
- - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
- bfd_put_32 (input_bfd, tmp, mem);
- break;
-
- case MIPS_R_PAIR:
- /* ignore these */
- break;
- }
- }
-
- return TRUE;
-}
-
-#define coff_relocate_section coff_pe_mips_relocate_section
-
-#ifdef TARGET_UNDERSCORE
-
-/* If mips gcc uses underscores for symbol names, then it does not use
- a leading dot for local labels, so if TARGET_UNDERSCORE is defined
- we treat all symbols starting with L as local. */
-
-static bfd_boolean coff_mips_is_local_label_name
- PARAMS ((bfd *, const char *));
-
-static bfd_boolean
-coff_mips_is_local_label_name (abfd, name)
- bfd *abfd;
- const char *name;
-{
- if (name[0] == 'L')
- return TRUE;
-
- return _bfd_coff_is_local_label_name (abfd, name);
-}
-
-#define coff_bfd_is_local_label_name coff_mips_is_local_label_name
-
-#endif /* TARGET_UNDERSCORE */
-
-#define COFF_NO_HACK_SCNHDR_SIZE
-
-#include "coffcode.h"
-
-const bfd_target
-#ifdef TARGET_SYM
- TARGET_SYM =
-#else
- mipslpe_vec =
-#endif
-{
-#ifdef TARGET_NAME
- TARGET_NAME,
-#else
- "pe-mips", /* name */
-#endif
- bfd_target_coff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-
-#ifndef COFF_WITH_PE
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
- | SEC_CODE | SEC_DATA),
-#else
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
- | SEC_CODE | SEC_DATA
- | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
-#endif
-
-#ifdef TARGET_UNDERSCORE
- TARGET_UNDERSCORE, /* leading underscore */
-#else
- 0, /* leading underscore */
-#endif
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
-
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-/* Note that we allow an object file to be treated as a core file as well. */
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- bfd_generic_archive_p, coff_object_p},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
- bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (coff),
- BFD_JUMP_TABLE_COPY (coff),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
- BFD_JUMP_TABLE_SYMBOLS (coff),
- BFD_JUMP_TABLE_RELOCS (coff),
- BFD_JUMP_TABLE_WRITE (coff),
- BFD_JUMP_TABLE_LINK (coff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- COFF_SWAP_TABLE
-};
diff --git a/contrib/binutils/bfd/pe-ppc.c b/contrib/binutils/bfd/pe-ppc.c
deleted file mode 100644
index adbf317..0000000
--- a/contrib/binutils/bfd/pe-ppc.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* BFD back-end for PowerPC PECOFF files.
- Copyright 1995, 1996, 2001 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#define E_FILENMLEN 18
-
-#define PPC_PE
-
-#define TARGET_LITTLE_SYM bfd_powerpcle_pe_vec
-#define TARGET_LITTLE_NAME "pe-powerpcle"
-
-#define TARGET_BIG_SYM bfd_powerpc_pe_vec
-#define TARGET_BIG_NAME "pe-powerpc"
-
-#define COFF_WITH_PE
-
-#define COFF_LONG_SECTION_NAMES
-
-/* FIXME: verify PCRELOFFSET is always false */
-
-/* FIXME: This target no longer works. Search for POWERPC_LE_PE in
- coff-ppc.c and peigen.c. */
-
-#include "coff-ppc.c"
diff --git a/contrib/binutils/bfd/peXXigen.c b/contrib/binutils/bfd/peXXigen.c
deleted file mode 100644
index 598aa7c..0000000
--- a/contrib/binutils/bfd/peXXigen.c
+++ /dev/null
@@ -1,2089 +0,0 @@
-/* Support for the generic parts of PE/PEI; the common executable parts.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Cygnus Solutions.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.
-
- PE/PEI rearrangement (and code added): Donn Terry
- Softway Systems, Inc. */
-
-/* Hey look, some documentation [and in a place you expect to find it]!
-
- The main reference for the pei format is "Microsoft Portable Executable
- and Common Object File Format Specification 4.1". Get it if you need to
- do some serious hacking on this code.
-
- Another reference:
- "Peering Inside the PE: A Tour of the Win32 Portable Executable
- File Format", MSJ 1994, Volume 9.
-
- The *sole* difference between the pe format and the pei format is that the
- latter has an MSDOS 2.0 .exe header on the front that prints the message
- "This app must be run under Windows." (or some such).
- (FIXME: Whether that statement is *really* true or not is unknown.
- Are there more subtle differences between pe and pei formats?
- For now assume there aren't. If you find one, then for God sakes
- document it here!)
-
- The Microsoft docs use the word "image" instead of "executable" because
- the former can also refer to a DLL (shared library). Confusion can arise
- because the `i' in `pei' also refers to "image". The `pe' format can
- also create images (i.e. executables), it's just that to run on a win32
- system you need to use the pei format.
-
- FIXME: Please add more docs here so the next poor fool that has to hack
- on this code has a chance of getting something accomplished without
- wasting too much time. */
-
-/* This expands into COFF_WITH_pe or COFF_WITH_pep depending on whether
- we're compiling for straight PE or PE+. */
-#define COFF_WITH_XX
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-
-/* NOTE: it's strange to be including an architecture specific header
- in what's supposed to be general (to PE/PEI) code. However, that's
- where the definitions are, and they don't vary per architecture
- within PE/PEI, so we get them from there. FIXME: The lack of
- variance is an assumption which may prove to be incorrect if new
- PE/PEI targets are created. */
-#ifdef COFF_WITH_pep
-# include "coff/ia64.h"
-#else
-# include "coff/i386.h"
-#endif
-
-#include "coff/pe.h"
-#include "libcoff.h"
-#include "libpei.h"
-
-#ifdef COFF_WITH_pep
-# undef AOUTSZ
-# define AOUTSZ PEPAOUTSZ
-# define PEAOUTHDR PEPAOUTHDR
-#endif
-
-/* FIXME: This file has various tests of POWERPC_LE_PE. Those tests
- worked when the code was in peicode.h, but no longer work now that
- the code is in peigen.c. PowerPC NT is said to be dead. If
- anybody wants to revive the code, you will have to figure out how
- to handle those issues. */
-
-static void add_data_entry
- PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma));
-static bfd_boolean pe_print_pdata PARAMS ((bfd *, PTR));
-static bfd_boolean pe_print_reloc PARAMS ((bfd *, PTR));
-static bfd_boolean pe_print_idata PARAMS ((bfd *, PTR));
-static bfd_boolean pe_print_edata PARAMS ((bfd *, PTR));
-
-
-void
-_bfd_XXi_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
-{
- SYMENT *ext = (SYMENT *) ext1;
- struct internal_syment *in = (struct internal_syment *) in1;
-
- if (ext->e.e_name[0] == 0)
- {
- in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset);
- }
- else
- memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
-
- in->n_value = H_GET_32 (abfd, ext->e_value);
- in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
-
- if (sizeof (ext->e_type) == 2)
- in->n_type = H_GET_16 (abfd, ext->e_type);
- else
- in->n_type = H_GET_32 (abfd, ext->e_type);
-
- in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
- in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
-
-#ifndef STRICT_PE_FORMAT
- /* This is for Gnu-created DLLs. */
-
- /* The section symbols for the .idata$ sections have class 0x68
- (C_SECTION), which MS documentation indicates is a section
- symbol. Unfortunately, the value field in the symbol is simply a
- copy of the .idata section's flags rather than something useful.
- When these symbols are encountered, change the value to 0 so that
- they will be handled somewhat correctly in the bfd code. */
- if (in->n_sclass == C_SECTION)
- {
- in->n_value = 0x0;
-
-#if 0
- /* FIXME: This is clearly wrong. The problem seems to be that
- undefined C_SECTION symbols appear in the first object of a
- MS generated .lib file, and the symbols are not defined
- anywhere. */
- in->n_scnum = 1;
-
- /* I have tried setting the class to 3 and using the following
- to set the section number. This will put the address of the
- pointer to the string kernel32.dll at addresses 0 and 0x10
- off start of idata section which is not correct. */
-#if 0
- if (strcmp (in->_n._n_name, ".idata$4") == 0)
- in->n_scnum = 3;
- else
- in->n_scnum = 2;
-#endif
-#else
- /* Create synthetic empty sections as needed. DJ */
- if (in->n_scnum == 0)
- {
- asection *sec;
-
- for (sec = abfd->sections; sec; sec = sec->next)
- {
- if (strcmp (sec->name, in->n_name) == 0)
- {
- in->n_scnum = sec->target_index;
- break;
- }
- }
- }
-
- if (in->n_scnum == 0)
- {
- int unused_section_number = 0;
- asection *sec;
- char *name;
-
- for (sec = abfd->sections; sec; sec = sec->next)
- if (unused_section_number <= sec->target_index)
- unused_section_number = sec->target_index + 1;
-
- name = bfd_alloc (abfd, (bfd_size_type) strlen (in->n_name) + 10);
- if (name == NULL)
- return;
- strcpy (name, in->n_name);
- sec = bfd_make_section_anyway (abfd, name);
-
- sec->vma = 0;
- sec->lma = 0;
- sec->_cooked_size = 0;
- sec->_raw_size = 0;
- sec->filepos = 0;
- sec->rel_filepos = 0;
- sec->reloc_count = 0;
- sec->line_filepos = 0;
- sec->lineno_count = 0;
- sec->userdata = NULL;
- sec->next = (asection *) NULL;
- sec->flags = 0;
- sec->alignment_power = 2;
- sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
-
- sec->target_index = unused_section_number;
-
- in->n_scnum = unused_section_number;
- }
- in->n_sclass = C_STAT;
-#endif
- }
-#endif
-
-#ifdef coff_swap_sym_in_hook
- /* This won't work in peigen.c, but since it's for PPC PE, it's not
- worth fixing. */
- coff_swap_sym_in_hook (abfd, ext1, in1);
-#endif
-}
-
-unsigned int
-_bfd_XXi_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
-{
- struct internal_syment *in = (struct internal_syment *) inp;
- SYMENT *ext = (SYMENT *) extp;
-
- if (in->_n._n_name[0] == 0)
- {
- H_PUT_32 (abfd, 0, ext->e.e.e_zeroes);
- H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
- }
- else
- memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
-
- H_PUT_32 (abfd, in->n_value, ext->e_value);
- H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
-
- if (sizeof (ext->e_type) == 2)
- H_PUT_16 (abfd, in->n_type, ext->e_type);
- else
- H_PUT_32 (abfd, in->n_type, ext->e_type);
-
- H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
- H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
-
- return SYMESZ;
-}
-
-void
-_bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR in1;
-{
- AUXENT *ext = (AUXENT *) ext1;
- union internal_auxent *in = (union internal_auxent *) in1;
-
- switch (class)
- {
- case C_FILE:
- if (ext->x_file.x_fname[0] == 0)
- {
- in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
- }
- else
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- return;
-
- case C_STAT:
- case C_LEAFSTAT:
- case C_HIDDEN:
- if (type == T_NULL)
- {
- in->x_scn.x_scnlen = GET_SCN_SCNLEN (abfd, ext);
- in->x_scn.x_nreloc = GET_SCN_NRELOC (abfd, ext);
- in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext);
- in->x_scn.x_checksum = H_GET_32 (abfd, ext->x_scn.x_checksum);
- in->x_scn.x_associated = H_GET_16 (abfd, ext->x_scn.x_associated);
- in->x_scn.x_comdat = H_GET_8 (abfd, ext->x_scn.x_comdat);
- return;
- }
- break;
- }
-
- in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx);
- in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext);
- in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext);
- }
- else
- {
- in->x_sym.x_fcnary.x_ary.x_dimen[0] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- in->x_sym.x_fcnary.x_ary.x_dimen[1] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- in->x_sym.x_fcnary.x_ary.x_dimen[2] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- in->x_sym.x_fcnary.x_ary.x_dimen[3] =
- H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
- }
-
- if (ISFCN (type))
- {
- in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
- }
- else
- {
- in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext);
- in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE (abfd, ext);
- }
-}
-
-unsigned int
-_bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd *abfd;
- PTR inp;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR extp;
-{
- union internal_auxent *in = (union internal_auxent *) inp;
- AUXENT *ext = (AUXENT *) extp;
-
- memset ((PTR) ext, 0, AUXESZ);
- switch (class)
- {
- case C_FILE:
- if (in->x_file.x_fname[0] == 0)
- {
- H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
- H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
- }
- else
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
-
- return AUXESZ;
-
- case C_STAT:
- case C_LEAFSTAT:
- case C_HIDDEN:
- if (type == T_NULL)
- {
- PUT_SCN_SCNLEN (abfd, in->x_scn.x_scnlen, ext);
- PUT_SCN_NRELOC (abfd, in->x_scn.x_nreloc, ext);
- PUT_SCN_NLINNO (abfd, in->x_scn.x_nlinno, ext);
- H_PUT_32 (abfd, in->x_scn.x_checksum, ext->x_scn.x_checksum);
- H_PUT_16 (abfd, in->x_scn.x_associated, ext->x_scn.x_associated);
- H_PUT_8 (abfd, in->x_scn.x_comdat, ext->x_scn.x_comdat);
- return AUXESZ;
- }
- break;
- }
-
- H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx);
- H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
-
- if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
- {
- PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
- PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
- }
- else
- {
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
- ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
- ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
- ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
- ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
- }
-
- if (ISFCN (type))
- H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
- else
- {
- PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext);
- PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext);
- }
-
- return AUXESZ;
-}
-
-void
-_bfd_XXi_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
-{
- LINENO *ext = (LINENO *) ext1;
- struct internal_lineno *in = (struct internal_lineno *) in1;
-
- in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx);
- in->l_lnno = GET_LINENO_LNNO (abfd, ext);
-}
-
-unsigned int
-_bfd_XXi_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
-{
- struct internal_lineno *in = (struct internal_lineno *) inp;
- struct external_lineno *ext = (struct external_lineno *) outp;
- H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
-
- PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
- return LINESZ;
-}
-
-void
-_bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
- bfd *abfd;
- PTR aouthdr_ext1;
- PTR aouthdr_int1;
-{
- struct internal_extra_pe_aouthdr *a;
- PEAOUTHDR *src = (PEAOUTHDR *) (aouthdr_ext1);
- AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
- struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
-
- aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
- aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp);
- aouthdr_int->tsize = GET_AOUTHDR_TSIZE (abfd, aouthdr_ext->tsize);
- aouthdr_int->dsize = GET_AOUTHDR_DSIZE (abfd, aouthdr_ext->dsize);
- aouthdr_int->bsize = GET_AOUTHDR_BSIZE (abfd, aouthdr_ext->bsize);
- aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry);
- aouthdr_int->text_start =
- GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start);
-#ifndef COFF_WITH_pep
- /* PE32+ does not have data_start member! */
- aouthdr_int->data_start =
- GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
-#endif
-
- a = &aouthdr_int->pe;
- a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, src->ImageBase);
- a->SectionAlignment = H_GET_32 (abfd, src->SectionAlignment);
- a->FileAlignment = H_GET_32 (abfd, src->FileAlignment);
- a->MajorOperatingSystemVersion =
- H_GET_16 (abfd, src->MajorOperatingSystemVersion);
- a->MinorOperatingSystemVersion =
- H_GET_16 (abfd, src->MinorOperatingSystemVersion);
- a->MajorImageVersion = H_GET_16 (abfd, src->MajorImageVersion);
- a->MinorImageVersion = H_GET_16 (abfd, src->MinorImageVersion);
- a->MajorSubsystemVersion = H_GET_16 (abfd, src->MajorSubsystemVersion);
- a->MinorSubsystemVersion = H_GET_16 (abfd, src->MinorSubsystemVersion);
- a->Reserved1 = H_GET_32 (abfd, src->Reserved1);
- a->SizeOfImage = H_GET_32 (abfd, src->SizeOfImage);
- a->SizeOfHeaders = H_GET_32 (abfd, src->SizeOfHeaders);
- a->CheckSum = H_GET_32 (abfd, src->CheckSum);
- a->Subsystem = H_GET_16 (abfd, src->Subsystem);
- a->DllCharacteristics = H_GET_16 (abfd, src->DllCharacteristics);
- a->SizeOfStackReserve =
- GET_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, src->SizeOfStackReserve);
- a->SizeOfStackCommit =
- GET_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, src->SizeOfStackCommit);
- a->SizeOfHeapReserve =
- GET_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, src->SizeOfHeapReserve);
- a->SizeOfHeapCommit =
- GET_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, src->SizeOfHeapCommit);
- a->LoaderFlags = H_GET_32 (abfd, src->LoaderFlags);
- a->NumberOfRvaAndSizes = H_GET_32 (abfd, src->NumberOfRvaAndSizes);
-
- {
- int idx;
-
- for (idx = 0; idx < 16; idx++)
- {
- /* If data directory is empty, rva also should be 0. */
- int size =
- H_GET_32 (abfd, src->DataDirectory[idx][1]);
- a->DataDirectory[idx].Size = size;
-
- if (size)
- a->DataDirectory[idx].VirtualAddress =
- H_GET_32 (abfd, src->DataDirectory[idx][0]);
- else
- a->DataDirectory[idx].VirtualAddress = 0;
- }
- }
-
- if (aouthdr_int->entry)
- {
- aouthdr_int->entry += a->ImageBase;
-#ifndef COFF_WITH_pep
- aouthdr_int->entry &= 0xffffffff;
-#endif
- }
-
- if (aouthdr_int->tsize)
- {
- aouthdr_int->text_start += a->ImageBase;
-#ifndef COFF_WITH_pep
- aouthdr_int->text_start &= 0xffffffff;
-#endif
- }
-
-#ifndef COFF_WITH_pep
- /* PE32+ does not have data_start member! */
- if (aouthdr_int->dsize)
- {
- aouthdr_int->data_start += a->ImageBase;
- aouthdr_int->data_start &= 0xffffffff;
- }
-#endif
-
-#ifdef POWERPC_LE_PE
- /* These three fields are normally set up by ppc_relocate_section.
- In the case of reading a file in, we can pick them up from the
- DataDirectory. */
- first_thunk_address = a->DataDirectory[12].VirtualAddress;
- thunk_size = a->DataDirectory[12].Size;
- import_table_size = a->DataDirectory[1].Size;
-#endif
-}
-
-/* A support function for below. */
-
-static void
-add_data_entry (abfd, aout, idx, name, base)
- bfd *abfd;
- struct internal_extra_pe_aouthdr *aout;
- int idx;
- char *name;
- bfd_vma base;
-{
- asection *sec = bfd_get_section_by_name (abfd, name);
-
- /* Add import directory information if it exists. */
- if ((sec != NULL)
- && (coff_section_data (abfd, sec) != NULL)
- && (pei_section_data (abfd, sec) != NULL))
- {
- /* If data directory is empty, rva also should be 0. */
- int size = pei_section_data (abfd, sec)->virt_size;
- aout->DataDirectory[idx].Size = size;
-
- if (size)
- {
- aout->DataDirectory[idx].VirtualAddress =
- (sec->vma - base) & 0xffffffff;
- sec->flags |= SEC_DATA;
- }
- }
-}
-
-unsigned int
-_bfd_XXi_swap_aouthdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
-{
- struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
- pe_data_type *pe = pe_data (abfd);
- struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
- PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out;
- bfd_vma sa, fa, ib;
- IMAGE_DATA_DIRECTORY idata2, idata5, tls;
-
- if (pe->force_minimum_alignment)
- {
- if (!extra->FileAlignment)
- extra->FileAlignment = PE_DEF_FILE_ALIGNMENT;
- if (!extra->SectionAlignment)
- extra->SectionAlignment = PE_DEF_SECTION_ALIGNMENT;
- }
-
- if (extra->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
- extra->Subsystem = pe->target_subsystem;
-
- sa = extra->SectionAlignment;
- fa = extra->FileAlignment;
- ib = extra->ImageBase;
-
- idata2 = pe->pe_opthdr.DataDirectory[1];
- idata5 = pe->pe_opthdr.DataDirectory[12];
- tls = pe->pe_opthdr.DataDirectory[9];
-
- if (aouthdr_in->tsize)
- {
- aouthdr_in->text_start -= ib;
-#ifndef COFF_WITH_pep
- aouthdr_in->text_start &= 0xffffffff;
-#endif
- }
-
- if (aouthdr_in->dsize)
- {
- aouthdr_in->data_start -= ib;
-#ifndef COFF_WITH_pep
- aouthdr_in->data_start &= 0xffffffff;
-#endif
- }
-
- if (aouthdr_in->entry)
- {
- aouthdr_in->entry -= ib;
-#ifndef COFF_WITH_pep
- aouthdr_in->entry &= 0xffffffff;
-#endif
- }
-
-#define FA(x) (((x) + fa -1 ) & (- fa))
-#define SA(x) (((x) + sa -1 ) & (- sa))
-
- /* We like to have the sizes aligned. */
- aouthdr_in->bsize = FA (aouthdr_in->bsize);
-
- extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES;
-
- /* First null out all data directory entries. */
- memset (extra->DataDirectory, 0, sizeof (extra->DataDirectory));
-
- add_data_entry (abfd, extra, 0, ".edata", ib);
- add_data_entry (abfd, extra, 2, ".rsrc", ib);
- add_data_entry (abfd, extra, 3, ".pdata", ib);
-
- /* In theory we do not need to call add_data_entry for .idata$2 or
- .idata$5. It will be done in bfd_coff_final_link where all the
- required information is available. If however, we are not going
- to perform a final link, eg because we have been invoked by objcopy
- or strip, then we need to make sure that these Data Directory
- entries are initialised properly.
-
- So - we copy the input values into the output values, and then, if
- a final link is going to be performed, it can overwrite them. */
- extra->DataDirectory[1] = idata2;
- extra->DataDirectory[12] = idata5;
- extra->DataDirectory[9] = tls;
-
- if (extra->DataDirectory[1].VirtualAddress == 0)
- /* Until other .idata fixes are made (pending patch), the entry for
- .idata is needed for backwards compatibility. FIXME. */
- add_data_entry (abfd, extra, 1, ".idata", ib);
-
- /* For some reason, the virtual size (which is what's set by
- add_data_entry) for .reloc is not the same as the size recorded
- in this slot by MSVC; it doesn't seem to cause problems (so far),
- but since it's the best we've got, use it. It does do the right
- thing for .pdata. */
- if (pe->has_reloc_section)
- add_data_entry (abfd, extra, 5, ".reloc", ib);
-
- {
- asection *sec;
- bfd_vma dsize = 0;
- bfd_vma isize = SA(abfd->sections->filepos);
- bfd_vma tsize = 0;
-
- for (sec = abfd->sections; sec; sec = sec->next)
- {
- int rounded = FA(sec->_raw_size);
-
- if (sec->flags & SEC_DATA)
- dsize += rounded;
- if (sec->flags & SEC_CODE)
- tsize += rounded;
- /* The image size is the total VIRTUAL size (which is what is
- in the virt_size field). Files have been seen (from MSVC
- 5.0 link.exe) where the file size of the .data segment is
- quite small compared to the virtual size. Without this
- fix, strip munges the file. */
- if (coff_section_data (abfd, sec) != NULL
- && pei_section_data (abfd, sec) != NULL)
- isize += SA (FA (pei_section_data (abfd, sec)->virt_size));
- }
-
- aouthdr_in->dsize = dsize;
- aouthdr_in->tsize = tsize;
- extra->SizeOfImage = isize;
- }
-
- extra->SizeOfHeaders = abfd->sections->filepos;
- H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic);
-
-#define LINKER_VERSION 256 /* That is, 2.56 */
-
- /* This piece of magic sets the "linker version" field to
- LINKER_VERSION. */
- H_PUT_16 (abfd, (LINKER_VERSION / 100 + (LINKER_VERSION % 100) * 256),
- aouthdr_out->standard.vstamp);
-
- PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, aouthdr_out->standard.tsize);
- PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, aouthdr_out->standard.dsize);
- PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, aouthdr_out->standard.bsize);
- PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, aouthdr_out->standard.entry);
- PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
- aouthdr_out->standard.text_start);
-
-#ifndef COFF_WITH_pep
- /* PE32+ does not have data_start member! */
- PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
- aouthdr_out->standard.data_start);
-#endif
-
- PUT_OPTHDR_IMAGE_BASE (abfd, extra->ImageBase, aouthdr_out->ImageBase);
- H_PUT_32 (abfd, extra->SectionAlignment, aouthdr_out->SectionAlignment);
- H_PUT_32 (abfd, extra->FileAlignment, aouthdr_out->FileAlignment);
- H_PUT_16 (abfd, extra->MajorOperatingSystemVersion,
- aouthdr_out->MajorOperatingSystemVersion);
- H_PUT_16 (abfd, extra->MinorOperatingSystemVersion,
- aouthdr_out->MinorOperatingSystemVersion);
- H_PUT_16 (abfd, extra->MajorImageVersion, aouthdr_out->MajorImageVersion);
- H_PUT_16 (abfd, extra->MinorImageVersion, aouthdr_out->MinorImageVersion);
- H_PUT_16 (abfd, extra->MajorSubsystemVersion,
- aouthdr_out->MajorSubsystemVersion);
- H_PUT_16 (abfd, extra->MinorSubsystemVersion,
- aouthdr_out->MinorSubsystemVersion);
- H_PUT_32 (abfd, extra->Reserved1, aouthdr_out->Reserved1);
- H_PUT_32 (abfd, extra->SizeOfImage, aouthdr_out->SizeOfImage);
- H_PUT_32 (abfd, extra->SizeOfHeaders, aouthdr_out->SizeOfHeaders);
- H_PUT_32 (abfd, extra->CheckSum, aouthdr_out->CheckSum);
- H_PUT_16 (abfd, extra->Subsystem, aouthdr_out->Subsystem);
- H_PUT_16 (abfd, extra->DllCharacteristics, aouthdr_out->DllCharacteristics);
- PUT_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, extra->SizeOfStackReserve,
- aouthdr_out->SizeOfStackReserve);
- PUT_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, extra->SizeOfStackCommit,
- aouthdr_out->SizeOfStackCommit);
- PUT_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, extra->SizeOfHeapReserve,
- aouthdr_out->SizeOfHeapReserve);
- PUT_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, extra->SizeOfHeapCommit,
- aouthdr_out->SizeOfHeapCommit);
- H_PUT_32 (abfd, extra->LoaderFlags, aouthdr_out->LoaderFlags);
- H_PUT_32 (abfd, extra->NumberOfRvaAndSizes,
- aouthdr_out->NumberOfRvaAndSizes);
- {
- int idx;
-
- for (idx = 0; idx < 16; idx++)
- {
- H_PUT_32 (abfd, extra->DataDirectory[idx].VirtualAddress,
- aouthdr_out->DataDirectory[idx][0]);
- H_PUT_32 (abfd, extra->DataDirectory[idx].Size,
- aouthdr_out->DataDirectory[idx][1]);
- }
- }
-
- return AOUTSZ;
-}
-
-unsigned int
-_bfd_XXi_only_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
-{
- int idx;
- struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
- struct external_PEI_filehdr *filehdr_out = (struct external_PEI_filehdr *) out;
-
- if (pe_data (abfd)->has_reloc_section)
- filehdr_in->f_flags &= ~F_RELFLG;
-
- if (pe_data (abfd)->dll)
- filehdr_in->f_flags |= F_DLL;
-
- filehdr_in->pe.e_magic = DOSMAGIC;
- filehdr_in->pe.e_cblp = 0x90;
- filehdr_in->pe.e_cp = 0x3;
- filehdr_in->pe.e_crlc = 0x0;
- filehdr_in->pe.e_cparhdr = 0x4;
- filehdr_in->pe.e_minalloc = 0x0;
- filehdr_in->pe.e_maxalloc = 0xffff;
- filehdr_in->pe.e_ss = 0x0;
- filehdr_in->pe.e_sp = 0xb8;
- filehdr_in->pe.e_csum = 0x0;
- filehdr_in->pe.e_ip = 0x0;
- filehdr_in->pe.e_cs = 0x0;
- filehdr_in->pe.e_lfarlc = 0x40;
- filehdr_in->pe.e_ovno = 0x0;
-
- for (idx = 0; idx < 4; idx++)
- filehdr_in->pe.e_res[idx] = 0x0;
-
- filehdr_in->pe.e_oemid = 0x0;
- filehdr_in->pe.e_oeminfo = 0x0;
-
- for (idx = 0; idx < 10; idx++)
- filehdr_in->pe.e_res2[idx] = 0x0;
-
- filehdr_in->pe.e_lfanew = 0x80;
-
- /* This next collection of data are mostly just characters. It
- appears to be constant within the headers put on NT exes. */
- filehdr_in->pe.dos_message[0] = 0x0eba1f0e;
- filehdr_in->pe.dos_message[1] = 0xcd09b400;
- filehdr_in->pe.dos_message[2] = 0x4c01b821;
- filehdr_in->pe.dos_message[3] = 0x685421cd;
- filehdr_in->pe.dos_message[4] = 0x70207369;
- filehdr_in->pe.dos_message[5] = 0x72676f72;
- filehdr_in->pe.dos_message[6] = 0x63206d61;
- filehdr_in->pe.dos_message[7] = 0x6f6e6e61;
- filehdr_in->pe.dos_message[8] = 0x65622074;
- filehdr_in->pe.dos_message[9] = 0x6e757220;
- filehdr_in->pe.dos_message[10] = 0x206e6920;
- filehdr_in->pe.dos_message[11] = 0x20534f44;
- filehdr_in->pe.dos_message[12] = 0x65646f6d;
- filehdr_in->pe.dos_message[13] = 0x0a0d0d2e;
- filehdr_in->pe.dos_message[14] = 0x24;
- filehdr_in->pe.dos_message[15] = 0x0;
- filehdr_in->pe.nt_signature = NT_SIGNATURE;
-
- H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic);
- H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns);
-
- H_PUT_32 (abfd, time (0), filehdr_out->f_timdat);
- PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr,
- filehdr_out->f_symptr);
- H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
- H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
- H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
-
- /* Put in extra dos header stuff. This data remains essentially
- constant, it just has to be tacked on to the beginning of all exes
- for NT. */
- H_PUT_16 (abfd, filehdr_in->pe.e_magic, filehdr_out->e_magic);
- H_PUT_16 (abfd, filehdr_in->pe.e_cblp, filehdr_out->e_cblp);
- H_PUT_16 (abfd, filehdr_in->pe.e_cp, filehdr_out->e_cp);
- H_PUT_16 (abfd, filehdr_in->pe.e_crlc, filehdr_out->e_crlc);
- H_PUT_16 (abfd, filehdr_in->pe.e_cparhdr, filehdr_out->e_cparhdr);
- H_PUT_16 (abfd, filehdr_in->pe.e_minalloc, filehdr_out->e_minalloc);
- H_PUT_16 (abfd, filehdr_in->pe.e_maxalloc, filehdr_out->e_maxalloc);
- H_PUT_16 (abfd, filehdr_in->pe.e_ss, filehdr_out->e_ss);
- H_PUT_16 (abfd, filehdr_in->pe.e_sp, filehdr_out->e_sp);
- H_PUT_16 (abfd, filehdr_in->pe.e_csum, filehdr_out->e_csum);
- H_PUT_16 (abfd, filehdr_in->pe.e_ip, filehdr_out->e_ip);
- H_PUT_16 (abfd, filehdr_in->pe.e_cs, filehdr_out->e_cs);
- H_PUT_16 (abfd, filehdr_in->pe.e_lfarlc, filehdr_out->e_lfarlc);
- H_PUT_16 (abfd, filehdr_in->pe.e_ovno, filehdr_out->e_ovno);
-
- for (idx = 0; idx < 4; idx++)
- H_PUT_16 (abfd, filehdr_in->pe.e_res[idx], filehdr_out->e_res[idx]);
-
- H_PUT_16 (abfd, filehdr_in->pe.e_oemid, filehdr_out->e_oemid);
- H_PUT_16 (abfd, filehdr_in->pe.e_oeminfo, filehdr_out->e_oeminfo);
-
- for (idx = 0; idx < 10; idx++)
- H_PUT_16 (abfd, filehdr_in->pe.e_res2[idx], filehdr_out->e_res2[idx]);
-
- H_PUT_32 (abfd, filehdr_in->pe.e_lfanew, filehdr_out->e_lfanew);
-
- for (idx = 0; idx < 16; idx++)
- H_PUT_32 (abfd, filehdr_in->pe.dos_message[idx],
- filehdr_out->dos_message[idx]);
-
- /* Also put in the NT signature. */
- H_PUT_32 (abfd, filehdr_in->pe.nt_signature, filehdr_out->nt_signature);
-
- return FILHSZ;
-}
-
-unsigned int
-_bfd_XX_only_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
-{
- struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
- FILHDR *filehdr_out = (FILHDR *) out;
-
- H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic);
- H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns);
- H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->f_timdat);
- PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, filehdr_out->f_symptr);
- H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
- H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
- H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
-
- return FILHSZ;
-}
-
-unsigned int
-_bfd_XXi_swap_scnhdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
-{
- struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
- SCNHDR *scnhdr_ext = (SCNHDR *) out;
- unsigned int ret = SCNHSZ;
- bfd_vma ps;
- bfd_vma ss;
-
- memcpy (scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
-
- PUT_SCNHDR_VADDR (abfd,
- ((scnhdr_int->s_vaddr
- - pe_data (abfd)->pe_opthdr.ImageBase)
- & 0xffffffff),
- scnhdr_ext->s_vaddr);
-
- /* NT wants the size data to be rounded up to the next
- NT_FILE_ALIGNMENT, but zero if it has no content (as in .bss,
- sometimes). */
- if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
- {
- if (bfd_pe_executable_p (abfd))
- {
- ps = scnhdr_int->s_size;
- ss = 0;
- }
- else
- {
- ps = 0;
- ss = scnhdr_int->s_size;
- }
- }
- else
- {
- if (bfd_pe_executable_p (abfd))
- ps = scnhdr_int->s_paddr;
- else
- ps = 0;
-
- ss = scnhdr_int->s_size;
- }
-
- PUT_SCNHDR_SIZE (abfd, ss,
- scnhdr_ext->s_size);
-
- /* s_paddr in PE is really the virtual size. */
- PUT_SCNHDR_PADDR (abfd, ps, scnhdr_ext->s_paddr);
-
- PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr,
- scnhdr_ext->s_scnptr);
- PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr,
- scnhdr_ext->s_relptr);
- PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr,
- scnhdr_ext->s_lnnoptr);
-
- {
- /* Extra flags must be set when dealing with PE. All sections should also
- have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the
- .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data
- sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set
- (this is especially important when dealing with the .idata section since
- the addresses for routines from .dlls must be overwritten). If .reloc
- section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE
- (0x02000000). Also, the resource data should also be read and
- writable. */
-
- /* FIXME: Alignment is also encoded in this field, at least on PPC and
- ARM-WINCE. Although - how do we get the original alignment field
- back ? */
-
- typedef struct
- {
- const char * section_name;
- unsigned long must_have;
- }
- pe_required_section_flags;
-
- pe_required_section_flags known_sections [] =
- {
- { ".arch", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_ALIGN_8BYTES },
- { ".bss", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
- { ".data", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
- { ".edata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
- { ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
- { ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
- { ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
- { ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE },
- { ".rsrc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
- { ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE },
- { ".tls", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
- { ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
- { NULL, 0}
- };
-
- pe_required_section_flags * p;
- int flags = scnhdr_int->s_flags;
-
- /* We have defaulted to adding the IMAGE_SCN_MEM_WRITE flag, but now
- we know exactly what this specific section wants so we remove it
- and then allow the must_have field to add it back in if necessary.
- However, we don't remove IMAGE_SCN_MEM_WRITE flag from .text if the
- default WP_TEXT file flag has been cleared. WP_TEXT may be cleared
- by ld --enable-auto-import (if auto-import is actually needed),
- by ld --omagic, or by obcopy --writable-text. */
-
- for (p = known_sections; p->section_name; p++)
- if (strcmp (scnhdr_int->s_name, p->section_name) == 0)
- {
- if (strcmp (scnhdr_int->s_name, ".text")
- || (bfd_get_file_flags (abfd) & WP_TEXT))
- flags &= ~IMAGE_SCN_MEM_WRITE;
- flags |= p->must_have;
- break;
- }
-
- H_PUT_32 (abfd, flags, scnhdr_ext->s_flags);
- }
-
- if (coff_data (abfd)->link_info
- && ! coff_data (abfd)->link_info->relocatable
- && ! coff_data (abfd)->link_info->shared
- && strcmp (scnhdr_int->s_name, ".text") == 0)
- {
- /* By inference from looking at MS output, the 32 bit field
- which is the combination of the number_of_relocs and
- number_of_linenos is used for the line number count in
- executables. A 16-bit field won't do for cc1. The MS
- document says that the number of relocs is zero for
- executables, but the 17-th bit has been observed to be there.
- Overflow is not an issue: a 4G-line program will overflow a
- bunch of other fields long before this! */
- H_PUT_16 (abfd, (scnhdr_int->s_nlnno & 0xffff), scnhdr_ext->s_nlnno);
- H_PUT_16 (abfd, (scnhdr_int->s_nlnno >> 16), scnhdr_ext->s_nreloc);
- }
- else
- {
- if (scnhdr_int->s_nlnno <= 0xffff)
- H_PUT_16 (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
- else
- {
- (*_bfd_error_handler) (_("%s: line number overflow: 0x%lx > 0xffff"),
- bfd_get_filename (abfd),
- scnhdr_int->s_nlnno);
- bfd_set_error (bfd_error_file_truncated);
- H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nlnno);
- ret = 0;
- }
-
- /* Although we could encode 0xffff relocs here, we do not, to be
- consistent with other parts of bfd. Also it lets us warn, as
- we should never see 0xffff here w/o having the overflow flag
- set. */
- if (scnhdr_int->s_nreloc < 0xffff)
- H_PUT_16 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
- else
- {
- /* PE can deal with large #s of relocs, but not here. */
- H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc);
- scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL;
- H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
-#if 0
- (*_bfd_error_handler) (_("%s: reloc overflow 1: 0x%lx > 0xffff"),
- bfd_get_filename (abfd),
- scnhdr_int->s_nreloc);
- bfd_set_error (bfd_error_file_truncated);
- H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc);
- ret = 0;
-#endif
- }
- }
- return ret;
-}
-
-static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
- {
- N_("Export Directory [.edata (or where ever we found it)]"),
- N_("Import Directory [parts of .idata]"),
- N_("Resource Directory [.rsrc]"),
- N_("Exception Directory [.pdata]"),
- N_("Security Directory"),
- N_("Base Relocation Directory [.reloc]"),
- N_("Debug Directory"),
- N_("Description Directory"),
- N_("Special Directory"),
- N_("Thread Storage Directory [.tls]"),
- N_("Load Configuration Directory"),
- N_("Bound Import Directory"),
- N_("Import Address Table Directory"),
- N_("Delay Import Directory"),
- N_("Reserved"),
- N_("Reserved")
- };
-
-#ifdef POWERPC_LE_PE
-/* The code for the PPC really falls in the "architecture dependent"
- category. However, it's not clear that anyone will ever care, so
- we're ignoring the issue for now; if/when PPC matters, some of this
- may need to go into peicode.h, or arguments passed to enable the
- PPC- specific code. */
-#endif
-
-static bfd_boolean
-pe_print_idata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
-{
- FILE *file = (FILE *) vfile;
- bfd_byte *data;
- asection *section;
- bfd_signed_vma adj;
-
-#ifdef POWERPC_LE_PE
- asection *rel_section = bfd_get_section_by_name (abfd, ".reldata");
-#endif
-
- bfd_size_type datasize = 0;
- bfd_size_type dataoff;
- bfd_size_type i;
- bfd_size_type amt;
- int onaline = 20;
-
- pe_data_type *pe = pe_data (abfd);
- struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
-
- bfd_vma addr;
-
- addr = extra->DataDirectory[1].VirtualAddress;
-
- if (addr == 0 && extra->DataDirectory[1].Size == 0)
- {
- /* Maybe the extra header isn't there. Look for the section. */
- section = bfd_get_section_by_name (abfd, ".idata");
- if (section == NULL)
- return TRUE;
-
- addr = section->vma;
- datasize = bfd_section_size (abfd, section);
- if (datasize == 0)
- return TRUE;
- }
- else
- {
- addr += extra->ImageBase;
- for (section = abfd->sections; section != NULL; section = section->next)
- {
- datasize = bfd_section_size (abfd, section);
- if (addr >= section->vma && addr < section->vma + datasize)
- break;
- }
-
- if (section == NULL)
- {
- fprintf (file,
- _("\nThere is an import table, but the section containing it could not be found\n"));
- return TRUE;
- }
- }
-
- fprintf (file, _("\nThere is an import table in %s at 0x%lx\n"),
- section->name, (unsigned long) addr);
-
- dataoff = addr - section->vma;
- datasize -= dataoff;
-
-#ifdef POWERPC_LE_PE
- if (rel_section != 0 && bfd_section_size (abfd, rel_section) != 0)
- {
- /* The toc address can be found by taking the starting address,
- which on the PPC locates a function descriptor. The
- descriptor consists of the function code starting address
- followed by the address of the toc. The starting address we
- get from the bfd, and the descriptor is supposed to be in the
- .reldata section. */
-
- bfd_vma loadable_toc_address;
- bfd_vma toc_address;
- bfd_vma start_address;
- bfd_byte *data = 0;
- int offset;
-
- amt = bfd_section_size (abfd, rel_section);
- data = (bfd_byte *) bfd_malloc (amt);
- if (data == NULL && amt != 0)
- return FALSE;
-
- bfd_get_section_contents (abfd, rel_section, (PTR) data, (bfd_vma) 0,
- amt);
-
- offset = abfd->start_address - rel_section->vma;
-
- start_address = bfd_get_32 (abfd, data + offset);
- loadable_toc_address = bfd_get_32 (abfd, data + offset + 4);
- toc_address = loadable_toc_address - 32768;
-
- fprintf (file,
- _("\nFunction descriptor located at the start address: %04lx\n"),
- (unsigned long int) (abfd->start_address));
- fprintf (file,
- _("\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"),
- start_address, loadable_toc_address, toc_address);
- }
- else
- {
- fprintf (file,
- _("\nNo reldata section! Function descriptor not decoded.\n"));
- }
-#endif
-
- fprintf (file,
- _("\nThe Import Tables (interpreted %s section contents)\n"),
- section->name);
- fprintf (file,
- _("\
- vma: Hint Time Forward DLL First\n\
- Table Stamp Chain Name Thunk\n"));
-
- amt = dataoff + datasize;
- data = (bfd_byte *) bfd_malloc (amt);
- if (data == NULL)
- return FALSE;
-
- /* Read the whole section. Some of the fields might be before dataoff. */
- if (! bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, amt))
- return FALSE;
-
- adj = section->vma - extra->ImageBase;
-
- /* Print all image import descriptors. */
- for (i = 0; i < datasize; i += onaline)
- {
- bfd_vma hint_addr;
- bfd_vma time_stamp;
- bfd_vma forward_chain;
- bfd_vma dll_name;
- bfd_vma first_thunk;
- int idx = 0;
- bfd_size_type j;
- char *dll;
-
- /* Print (i + extra->DataDirectory[1].VirtualAddress). */
- fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff));
-#if 0
- if (i + 20 > datasize)
- /* Check stuff. */
- ;
-#endif
- hint_addr = bfd_get_32 (abfd, data + i + dataoff);
- time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff);
- forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff);
- dll_name = bfd_get_32 (abfd, data + i + 12 + dataoff);
- first_thunk = bfd_get_32 (abfd, data + i + 16 + dataoff);
-
- fprintf (file, "%08lx %08lx %08lx %08lx %08lx\n",
- (unsigned long) hint_addr,
- (unsigned long) time_stamp,
- (unsigned long) forward_chain,
- (unsigned long) dll_name,
- (unsigned long) first_thunk);
-
- if (hint_addr == 0 && first_thunk == 0)
- break;
-
- dll = (char *) data + dll_name - adj;
- fprintf (file, _("\n\tDLL Name: %s\n"), dll);
-
- if (hint_addr != 0)
- {
- bfd_byte *ft_data;
- asection *ft_section;
- bfd_vma ft_addr;
- bfd_size_type ft_datasize;
- int ft_idx;
- int ft_allocated = 0;
-
- fprintf (file, _("\tvma: Hint/Ord Member-Name Bound-To\n"));
-
- idx = hint_addr - adj;
-
- ft_addr = first_thunk + extra->ImageBase;
- ft_data = data;
- ft_idx = first_thunk - adj;
- ft_allocated = 0;
-
- if (first_thunk != hint_addr)
- {
- /* Find the section which contains the first thunk. */
- for (ft_section = abfd->sections;
- ft_section != NULL;
- ft_section = ft_section->next)
- {
- ft_datasize = bfd_section_size (abfd, ft_section);
- if (ft_addr >= ft_section->vma
- && ft_addr < ft_section->vma + ft_datasize)
- break;
- }
-
- if (ft_section == NULL)
- {
- fprintf (file,
- _("\nThere is a first thunk, but the section containing it could not be found\n"));
- continue;
- }
-
- /* Now check to see if this section is the same as our current
- section. If it is not then we will have to load its data in. */
- if (ft_section == section)
- {
- ft_data = data;
- ft_idx = first_thunk - adj;
- }
- else
- {
- ft_idx = first_thunk - (ft_section->vma - extra->ImageBase);
- ft_data = (bfd_byte *) bfd_malloc (datasize);
- if (ft_data == NULL)
- continue;
-
- /* Read datasize bfd_bytes starting at offset ft_idx. */
- if (! bfd_get_section_contents (abfd, ft_section,
- (PTR) ft_data,
- (bfd_vma) ft_idx,
- datasize))
- {
- free (ft_data);
- continue;
- }
-
- ft_idx = 0;
- ft_allocated = 1;
- }
- }
-
- /* Print HintName vector entries. */
- for (j = 0; j < datasize; j += 4)
- {
- unsigned long member = bfd_get_32 (abfd, data + idx + j);
-
- /* Print single IMAGE_IMPORT_BY_NAME vector. */
- if (member == 0)
- break;
-
- if (member & 0x80000000)
- fprintf (file, "\t%04lx\t %4lu <none>",
- member, member & 0x7fffffff);
- else
- {
- int ordinal;
- char *member_name;
-
- ordinal = bfd_get_16 (abfd, data + member - adj);
- member_name = (char *) data + member - adj + 2;
- fprintf (file, "\t%04lx\t %4d %s",
- member, ordinal, member_name);
- }
-
- /* If the time stamp is not zero, the import address
- table holds actual addresses. */
- if (time_stamp != 0
- && first_thunk != 0
- && first_thunk != hint_addr)
- fprintf (file, "\t%04lx",
- (long) bfd_get_32 (abfd, ft_data + ft_idx + j));
-
- fprintf (file, "\n");
- }
-
- if (ft_allocated)
- free (ft_data);
- }
-
- fprintf (file, "\n");
- }
-
- free (data);
-
- return TRUE;
-}
-
-static bfd_boolean
-pe_print_edata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
-{
- FILE *file = (FILE *) vfile;
- bfd_byte *data;
- asection *section;
- bfd_size_type datasize = 0;
- bfd_size_type dataoff;
- bfd_size_type i;
- bfd_signed_vma adj;
- struct EDT_type
- {
- long export_flags; /* reserved - should be zero */
- long time_stamp;
- short major_ver;
- short minor_ver;
- bfd_vma name; /* rva - relative to image base */
- long base; /* ordinal base */
- unsigned long num_functions;/* Number in the export address table */
- unsigned long num_names; /* Number in the name pointer table */
- bfd_vma eat_addr; /* rva to the export address table */
- bfd_vma npt_addr; /* rva to the Export Name Pointer Table */
- bfd_vma ot_addr; /* rva to the Ordinal Table */
- } edt;
-
- pe_data_type *pe = pe_data (abfd);
- struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
-
- bfd_vma addr;
-
- addr = extra->DataDirectory[0].VirtualAddress;
-
- if (addr == 0 && extra->DataDirectory[0].Size == 0)
- {
- /* Maybe the extra header isn't there. Look for the section. */
- section = bfd_get_section_by_name (abfd, ".edata");
- if (section == NULL)
- return TRUE;
-
- addr = section->vma;
- datasize = bfd_section_size (abfd, section);
- if (datasize == 0)
- return TRUE;
- }
- else
- {
- addr += extra->ImageBase;
-
- for (section = abfd->sections; section != NULL; section = section->next)
- {
- datasize = bfd_section_size (abfd, section);
-
- if (addr >= section->vma && addr < section->vma + datasize)
- break;
- }
-
- if (section == NULL)
- {
- fprintf (file,
- _("\nThere is an export table, but the section containing it could not be found\n"));
- return TRUE;
- }
- }
-
- fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"),
- section->name, (unsigned long) addr);
-
- dataoff = addr - section->vma;
- datasize -= dataoff;
-
- data = (bfd_byte *) bfd_malloc (datasize);
- if (data == NULL)
- return FALSE;
-
- if (! bfd_get_section_contents (abfd, section, (PTR) data,
- (file_ptr) dataoff, datasize))
- return FALSE;
-
- /* Go get Export Directory Table. */
- edt.export_flags = bfd_get_32 (abfd, data + 0);
- edt.time_stamp = bfd_get_32 (abfd, data + 4);
- edt.major_ver = bfd_get_16 (abfd, data + 8);
- edt.minor_ver = bfd_get_16 (abfd, data + 10);
- edt.name = bfd_get_32 (abfd, data + 12);
- edt.base = bfd_get_32 (abfd, data + 16);
- edt.num_functions = bfd_get_32 (abfd, data + 20);
- edt.num_names = bfd_get_32 (abfd, data + 24);
- edt.eat_addr = bfd_get_32 (abfd, data + 28);
- edt.npt_addr = bfd_get_32 (abfd, data + 32);
- edt.ot_addr = bfd_get_32 (abfd, data + 36);
-
- adj = section->vma - extra->ImageBase + dataoff;
-
- /* Dump the EDT first. */
- fprintf (file,
- _("\nThe Export Tables (interpreted %s section contents)\n\n"),
- section->name);
-
- fprintf (file,
- _("Export Flags \t\t\t%lx\n"), (unsigned long) edt.export_flags);
-
- fprintf (file,
- _("Time/Date stamp \t\t%lx\n"), (unsigned long) edt.time_stamp);
-
- fprintf (file,
- _("Major/Minor \t\t\t%d/%d\n"), edt.major_ver, edt.minor_ver);
-
- fprintf (file,
- _("Name \t\t\t\t"));
- fprintf_vma (file, edt.name);
- fprintf (file,
- " %s\n", data + edt.name - adj);
-
- fprintf (file,
- _("Ordinal Base \t\t\t%ld\n"), edt.base);
-
- fprintf (file,
- _("Number in:\n"));
-
- fprintf (file,
- _("\tExport Address Table \t\t%08lx\n"),
- edt.num_functions);
-
- fprintf (file,
- _("\t[Name Pointer/Ordinal] Table\t%08lx\n"), edt.num_names);
-
- fprintf (file,
- _("Table Addresses\n"));
-
- fprintf (file,
- _("\tExport Address Table \t\t"));
- fprintf_vma (file, edt.eat_addr);
- fprintf (file, "\n");
-
- fprintf (file,
- _("\tName Pointer Table \t\t"));
- fprintf_vma (file, edt.npt_addr);
- fprintf (file, "\n");
-
- fprintf (file,
- _("\tOrdinal Table \t\t\t"));
- fprintf_vma (file, edt.ot_addr);
- fprintf (file, "\n");
-
- /* The next table to find is the Export Address Table. It's basically
- a list of pointers that either locate a function in this dll, or
- forward the call to another dll. Something like:
- typedef union
- {
- long export_rva;
- long forwarder_rva;
- } export_address_table_entry;
- */
-
- fprintf (file,
- _("\nExport Address Table -- Ordinal Base %ld\n"),
- edt.base);
-
- for (i = 0; i < edt.num_functions; ++i)
- {
- bfd_vma eat_member = bfd_get_32 (abfd,
- data + edt.eat_addr + (i * 4) - adj);
- if (eat_member == 0)
- continue;
-
- if (eat_member - adj <= datasize)
- {
- /* This rva is to a name (forwarding function) in our section. */
- /* Should locate a function descriptor. */
- fprintf (file,
- "\t[%4ld] +base[%4ld] %04lx %s -- %s\n",
- (long) i,
- (long) (i + edt.base),
- (unsigned long) eat_member,
- _("Forwarder RVA"),
- data + eat_member - adj);
- }
- else
- {
- /* Should locate a function descriptor in the reldata section. */
- fprintf (file,
- "\t[%4ld] +base[%4ld] %04lx %s\n",
- (long) i,
- (long) (i + edt.base),
- (unsigned long) eat_member,
- _("Export RVA"));
- }
- }
-
- /* The Export Name Pointer Table is paired with the Export Ordinal Table. */
- /* Dump them in parallel for clarity. */
- fprintf (file,
- _("\n[Ordinal/Name Pointer] Table\n"));
-
- for (i = 0; i < edt.num_names; ++i)
- {
- bfd_vma name_ptr = bfd_get_32 (abfd,
- data +
- edt.npt_addr
- + (i*4) - adj);
-
- char *name = (char *) data + name_ptr - adj;
-
- bfd_vma ord = bfd_get_16 (abfd,
- data +
- edt.ot_addr
- + (i*2) - adj);
- fprintf (file,
- "\t[%4ld] %s\n", (long) ord, name);
- }
-
- free (data);
-
- return TRUE;
-}
-
-/* This really is architecture dependent. On IA-64, a .pdata entry
- consists of three dwords containing relative virtual addresses that
- specify the start and end address of the code range the entry
- covers and the address of the corresponding unwind info data. */
-
-static bfd_boolean
-pe_print_pdata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
-{
-#ifdef COFF_WITH_pep
-# define PDATA_ROW_SIZE (3*8)
-#else
-# define PDATA_ROW_SIZE (5*4)
-#endif
- FILE *file = (FILE *) vfile;
- bfd_byte *data = 0;
- asection *section = bfd_get_section_by_name (abfd, ".pdata");
- bfd_size_type datasize = 0;
- bfd_size_type i;
- bfd_size_type start, stop;
- int onaline = PDATA_ROW_SIZE;
-
- if (section == NULL
- || coff_section_data (abfd, section) == NULL
- || pei_section_data (abfd, section) == NULL)
- return TRUE;
-
- stop = pei_section_data (abfd, section)->virt_size;
- if ((stop % onaline) != 0)
- fprintf (file,
- _("Warning, .pdata section size (%ld) is not a multiple of %d\n"),
- (long) stop, onaline);
-
- fprintf (file,
- _("\nThe Function Table (interpreted .pdata section contents)\n"));
-#ifdef COFF_WITH_pep
- fprintf (file,
- _(" vma:\t\t\tBegin Address End Address Unwind Info\n"));
-#else
- fprintf (file, _("\
- vma:\t\tBegin End EH EH PrologEnd Exception\n\
- \t\tAddress Address Handler Data Address Mask\n"));
-#endif
-
- datasize = bfd_section_size (abfd, section);
- if (datasize == 0)
- return TRUE;
-
- data = (bfd_byte *) bfd_malloc (datasize);
- if (data == NULL && datasize != 0)
- return FALSE;
-
- bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0,
- datasize);
-
- start = 0;
-
- for (i = start; i < stop; i += onaline)
- {
- bfd_vma begin_addr;
- bfd_vma end_addr;
- bfd_vma eh_handler;
- bfd_vma eh_data;
- bfd_vma prolog_end_addr;
- int em_data;
-
- if (i + PDATA_ROW_SIZE > stop)
- break;
-
- begin_addr = GET_PDATA_ENTRY (abfd, data + i );
- end_addr = GET_PDATA_ENTRY (abfd, data + i + 4);
- eh_handler = GET_PDATA_ENTRY (abfd, data + i + 8);
- eh_data = GET_PDATA_ENTRY (abfd, data + i + 12);
- prolog_end_addr = GET_PDATA_ENTRY (abfd, data + i + 16);
-
- if (begin_addr == 0 && end_addr == 0 && eh_handler == 0
- && eh_data == 0 && prolog_end_addr == 0)
- /* We are probably into the padding of the section now. */
- break;
-
- em_data = ((eh_handler & 0x1) << 2) | (prolog_end_addr & 0x3);
- eh_handler &= ~(bfd_vma) 0x3;
- prolog_end_addr &= ~(bfd_vma) 0x3;
-
- fputc (' ', file);
- fprintf_vma (file, i + section->vma); fputc ('\t', file);
- fprintf_vma (file, begin_addr); fputc (' ', file);
- fprintf_vma (file, end_addr); fputc (' ', file);
- fprintf_vma (file, eh_handler);
-#ifndef COFF_WITH_pep
- fputc (' ', file);
- fprintf_vma (file, eh_data); fputc (' ', file);
- fprintf_vma (file, prolog_end_addr);
- fprintf (file, " %x", em_data);
-#endif
-
-#ifdef POWERPC_LE_PE
- if (eh_handler == 0 && eh_data != 0)
- {
- /* Special bits here, although the meaning may be a little
- mysterious. The only one I know for sure is 0x03. */
- /* Code Significance */
- /* 0x00 None */
- /* 0x01 Register Save Millicode */
- /* 0x02 Register Restore Millicode */
- /* 0x03 Glue Code Sequence */
- switch (eh_data)
- {
- case 0x01:
- fprintf (file, _(" Register save millicode"));
- break;
- case 0x02:
- fprintf (file, _(" Register restore millicode"));
- break;
- case 0x03:
- fprintf (file, _(" Glue code sequence"));
- break;
- default:
- break;
- }
- }
-#endif
- fprintf (file, "\n");
- }
-
- free (data);
-
- return TRUE;
-}
-
-#define IMAGE_REL_BASED_HIGHADJ 4
-static const char * const tbl[] =
- {
- "ABSOLUTE",
- "HIGH",
- "LOW",
- "HIGHLOW",
- "HIGHADJ",
- "MIPS_JMPADDR",
- "SECTION",
- "REL32",
- "RESERVED1",
- "MIPS_JMPADDR16",
- "DIR64",
- "HIGH3ADJ"
- "UNKNOWN", /* MUST be last */
- };
-
-static bfd_boolean
-pe_print_reloc (abfd, vfile)
- bfd *abfd;
- PTR vfile;
-{
- FILE *file = (FILE *) vfile;
- bfd_byte *data = 0;
- asection *section = bfd_get_section_by_name (abfd, ".reloc");
- bfd_size_type datasize;
- bfd_size_type i;
- bfd_size_type start, stop;
-
- if (section == NULL)
- return TRUE;
-
- if (bfd_section_size (abfd, section) == 0)
- return TRUE;
-
- fprintf (file,
- _("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
-
- datasize = bfd_section_size (abfd, section);
- data = (bfd_byte *) bfd_malloc (datasize);
- if (data == NULL && datasize != 0)
- return FALSE;
-
- bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0,
- datasize);
-
- start = 0;
-
- stop = bfd_section_size (abfd, section);
-
- for (i = start; i < stop;)
- {
- int j;
- bfd_vma virtual_address;
- long number, size;
-
- /* The .reloc section is a sequence of blocks, with a header consisting
- of two 32 bit quantities, followed by a number of 16 bit entries. */
- virtual_address = bfd_get_32 (abfd, data+i);
- size = bfd_get_32 (abfd, data+i+4);
- number = (size - 8) / 2;
-
- if (size == 0)
- break;
-
- fprintf (file,
- _("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"),
- (unsigned long) virtual_address, size, size, number);
-
- for (j = 0; j < number; ++j)
- {
- unsigned short e = bfd_get_16 (abfd, data + i + 8 + j * 2);
- unsigned int t = (e & 0xF000) >> 12;
- int off = e & 0x0FFF;
-
- if (t >= sizeof (tbl) / sizeof (tbl[0]))
- t = (sizeof (tbl) / sizeof (tbl[0])) - 1;
-
- fprintf (file,
- _("\treloc %4d offset %4x [%4lx] %s"),
- j, off, (long) (off + virtual_address), tbl[t]);
-
- /* HIGHADJ takes an argument, - the next record *is* the
- low 16 bits of addend. */
- if (t == IMAGE_REL_BASED_HIGHADJ)
- {
- fprintf (file, " (%4x)",
- ((unsigned int)
- bfd_get_16 (abfd, data + i + 8 + j * 2 + 2)));
- j++;
- }
-
- fprintf (file, "\n");
- }
-
- i += size;
- }
-
- free (data);
-
- return TRUE;
-}
-
-/* Print out the program headers. */
-
-bfd_boolean
-_bfd_XX_print_private_bfd_data_common (abfd, vfile)
- bfd *abfd;
- PTR vfile;
-{
- FILE *file = (FILE *) vfile;
- int j;
- pe_data_type *pe = pe_data (abfd);
- struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
- const char *subsystem_name = NULL;
-
- /* The MS dumpbin program reportedly ands with 0xff0f before
- printing the characteristics field. Not sure why. No reason to
- emulate it here. */
- fprintf (file, _("\nCharacteristics 0x%x\n"), pe->real_flags);
-#undef PF
-#define PF(x, y) if (pe->real_flags & x) { fprintf (file, "\t%s\n", y); }
- PF (F_RELFLG, "relocations stripped");
- PF (F_EXEC, "executable");
- PF (F_LNNO, "line numbers stripped");
- PF (F_LSYMS, "symbols stripped");
- PF (0x80, "little endian");
- PF (F_AR32WR, "32 bit words");
- PF (0x200, "debugging information removed");
- PF (0x1000, "system file");
- PF (F_DLL, "DLL");
- PF (0x8000, "big endian");
-#undef PF
-
- /* ctime implies '\n'. */
- {
- time_t t = pe->coff.timestamp;
- fprintf (file, "\nTime/Date\t\t%s", ctime (&t));
- }
- fprintf (file, "\nImageBase\t\t");
- fprintf_vma (file, i->ImageBase);
- fprintf (file, "\nSectionAlignment\t");
- fprintf_vma (file, i->SectionAlignment);
- fprintf (file, "\nFileAlignment\t\t");
- fprintf_vma (file, i->FileAlignment);
- fprintf (file, "\nMajorOSystemVersion\t%d\n", i->MajorOperatingSystemVersion);
- fprintf (file, "MinorOSystemVersion\t%d\n", i->MinorOperatingSystemVersion);
- fprintf (file, "MajorImageVersion\t%d\n", i->MajorImageVersion);
- fprintf (file, "MinorImageVersion\t%d\n", i->MinorImageVersion);
- fprintf (file, "MajorSubsystemVersion\t%d\n", i->MajorSubsystemVersion);
- fprintf (file, "MinorSubsystemVersion\t%d\n", i->MinorSubsystemVersion);
- fprintf (file, "Win32Version\t\t%08lx\n", i->Reserved1);
- fprintf (file, "SizeOfImage\t\t%08lx\n", i->SizeOfImage);
- fprintf (file, "SizeOfHeaders\t\t%08lx\n", i->SizeOfHeaders);
- fprintf (file, "CheckSum\t\t%08lx\n", i->CheckSum);
-
- switch (i->Subsystem)
- {
- case IMAGE_SUBSYSTEM_UNKNOWN:
- subsystem_name = "unspecified";
- break;
- case IMAGE_SUBSYSTEM_NATIVE:
- subsystem_name = "NT native";
- break;
- case IMAGE_SUBSYSTEM_WINDOWS_GUI:
- subsystem_name = "Windows GUI";
- break;
- case IMAGE_SUBSYSTEM_WINDOWS_CUI:
- subsystem_name = "Windows CUI";
- break;
- case IMAGE_SUBSYSTEM_POSIX_CUI:
- subsystem_name = "POSIX CUI";
- break;
- case IMAGE_SUBSYSTEM_WINDOWS_CE_GUI:
- subsystem_name = "Wince CUI";
- break;
- case IMAGE_SUBSYSTEM_EFI_APPLICATION:
- subsystem_name = "EFI application";
- break;
- case IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
- subsystem_name = "EFI boot service driver";
- break;
- case IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
- subsystem_name = "EFI runtime driver";
- break;
- }
-
- fprintf (file, "Subsystem\t\t%08x", i->Subsystem);
- if (subsystem_name)
- fprintf (file, "\t(%s)", subsystem_name);
- fprintf (file, "\nDllCharacteristics\t%08x\n", i->DllCharacteristics);
- fprintf (file, "SizeOfStackReserve\t");
- fprintf_vma (file, i->SizeOfStackReserve);
- fprintf (file, "\nSizeOfStackCommit\t");
- fprintf_vma (file, i->SizeOfStackCommit);
- fprintf (file, "\nSizeOfHeapReserve\t");
- fprintf_vma (file, i->SizeOfHeapReserve);
- fprintf (file, "\nSizeOfHeapCommit\t");
- fprintf_vma (file, i->SizeOfHeapCommit);
- fprintf (file, "\nLoaderFlags\t\t%08lx\n", i->LoaderFlags);
- fprintf (file, "NumberOfRvaAndSizes\t%08lx\n", i->NumberOfRvaAndSizes);
-
- fprintf (file, "\nThe Data Directory\n");
- for (j = 0; j < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; j++)
- {
- fprintf (file, "Entry %1x ", j);
- fprintf_vma (file, i->DataDirectory[j].VirtualAddress);
- fprintf (file, " %08lx ", i->DataDirectory[j].Size);
- fprintf (file, "%s\n", dir_names[j]);
- }
-
- pe_print_idata (abfd, vfile);
- pe_print_edata (abfd, vfile);
- pe_print_pdata (abfd, vfile);
- pe_print_reloc (abfd, vfile);
-
- return TRUE;
-}
-
-/* Copy any private info we understand from the input bfd
- to the output bfd. */
-
-bfd_boolean
-_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
- bfd *ibfd, *obfd;
-{
- /* One day we may try to grok other private data. */
- if (ibfd->xvec->flavour != bfd_target_coff_flavour
- || obfd->xvec->flavour != bfd_target_coff_flavour)
- return TRUE;
-
- pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr;
- pe_data (obfd)->dll = pe_data (ibfd)->dll;
-
- /* For strip: if we removed .reloc, we'll make a real mess of things
- if we don't remove this entry as well. */
- if (! pe_data (obfd)->has_reloc_section)
- {
- pe_data (obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0;
- pe_data (obfd)->pe_opthdr.DataDirectory[5].Size = 0;
- }
- return TRUE;
-}
-
-/* Copy private section data. */
-
-bfd_boolean
-_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
- bfd *ibfd;
- asection *isec;
- bfd *obfd;
- asection *osec;
-{
- if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour
- || bfd_get_flavour (obfd) != bfd_target_coff_flavour)
- return TRUE;
-
- if (coff_section_data (ibfd, isec) != NULL
- && pei_section_data (ibfd, isec) != NULL)
- {
- if (coff_section_data (obfd, osec) == NULL)
- {
- bfd_size_type amt = sizeof (struct coff_section_tdata);
- osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt);
- if (osec->used_by_bfd == NULL)
- return FALSE;
- }
-
- if (pei_section_data (obfd, osec) == NULL)
- {
- bfd_size_type amt = sizeof (struct pei_section_tdata);
- coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt);
- if (coff_section_data (obfd, osec)->tdata == NULL)
- return FALSE;
- }
-
- pei_section_data (obfd, osec)->virt_size =
- pei_section_data (ibfd, isec)->virt_size;
- pei_section_data (obfd, osec)->pe_flags =
- pei_section_data (ibfd, isec)->pe_flags;
- }
-
- return TRUE;
-}
-
-void
-_bfd_XX_get_symbol_info (abfd, symbol, ret)
- bfd *abfd;
- asymbol *symbol;
- symbol_info *ret;
-{
- coff_get_symbol_info (abfd, symbol, ret);
-#if 0 /* This code no longer appears to be necessary.
- ImageBase has already been added in by coff_swap_scnhdr_in. */
- if (pe_data (abfd) != NULL
- && ((symbol->flags & BSF_DEBUGGING) == 0
- || (symbol->flags & BSF_DEBUGGING_RELOC) != 0)
- && ! bfd_is_abs_section (symbol->section))
- ret->value += pe_data (abfd)->pe_opthdr.ImageBase;
-#endif
-}
-
-/* Handle the .idata section and other things that need symbol table
- access. */
-
-bfd_boolean
-_bfd_XXi_final_link_postscript (abfd, pfinfo)
- bfd *abfd;
- struct coff_final_link_info *pfinfo;
-{
- struct coff_link_hash_entry *h1;
- struct bfd_link_info *info = pfinfo->info;
-
- /* There are a few fields that need to be filled in now while we
- have symbol table access.
-
- The .idata subsections aren't directly available as sections, but
- they are in the symbol table, so get them from there. */
-
- /* The import directory. This is the address of .idata$2, with size
- of .idata$2 + .idata$3. */
- h1 = coff_link_hash_lookup (coff_hash_table (info),
- ".idata$2", FALSE, FALSE, TRUE);
- if (h1 != NULL)
- {
- pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
- (h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset);
- h1 = coff_link_hash_lookup (coff_hash_table (info),
- ".idata$4", FALSE, FALSE, TRUE);
- pe_data (abfd)->pe_opthdr.DataDirectory[1].Size =
- ((h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset)
- - pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
-
- /* The import address table. This is the size/address of
- .idata$5. */
- h1 = coff_link_hash_lookup (coff_hash_table (info),
- ".idata$5", FALSE, FALSE, TRUE);
- pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
- (h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset);
- h1 = coff_link_hash_lookup (coff_hash_table (info),
- ".idata$6", FALSE, FALSE, TRUE);
- pe_data (abfd)->pe_opthdr.DataDirectory[12].Size =
- ((h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset)
- - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
- }
-
- h1 = coff_link_hash_lookup (coff_hash_table (info),
- "__tls_used", FALSE, FALSE, TRUE);
- if (h1 != NULL)
- {
- pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
- (h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset
- - pe_data (abfd)->pe_opthdr.ImageBase);
- pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18;
- }
-
- /* If we couldn't find idata$2, we either have an excessively
- trivial program or are in DEEP trouble; we have to assume trivial
- program.... */
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/pei-mips.c b/contrib/binutils/bfd/pei-mips.c
deleted file mode 100644
index 976b2f9..0000000
--- a/contrib/binutils/bfd/pei-mips.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* BFD back-end for MIPS PE IMAGE COFF files.
- Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#define TARGET_SYM mipslpei_vec
-#define TARGET_NAME "pei-mips"
-#define COFF_IMAGE_WITH_PE
-#define PCRELOFFSET TRUE
-#define COFF_LONG_SECTION_NAMES
-
-#include "pe-mips.c"
-
diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h
deleted file mode 100644
index 41445e5..0000000
--- a/contrib/binutils/bfd/peicode.h
+++ /dev/null
@@ -1,1347 +0,0 @@
-/* Support for the generic parts of PE/PEI, for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Solutions.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Most of this hacked by Steve Chamberlain,
- sac@cygnus.com
-
- PE/PEI rearrangement (and code added): Donn Terry
- Softway Systems, Inc. */
-
-/* Hey look, some documentation [and in a place you expect to find it]!
-
- The main reference for the pei format is "Microsoft Portable Executable
- and Common Object File Format Specification 4.1". Get it if you need to
- do some serious hacking on this code.
-
- Another reference:
- "Peering Inside the PE: A Tour of the Win32 Portable Executable
- File Format", MSJ 1994, Volume 9.
-
- The *sole* difference between the pe format and the pei format is that the
- latter has an MSDOS 2.0 .exe header on the front that prints the message
- "This app must be run under Windows." (or some such).
- (FIXME: Whether that statement is *really* true or not is unknown.
- Are there more subtle differences between pe and pei formats?
- For now assume there aren't. If you find one, then for God sakes
- document it here!)
-
- The Microsoft docs use the word "image" instead of "executable" because
- the former can also refer to a DLL (shared library). Confusion can arise
- because the `i' in `pei' also refers to "image". The `pe' format can
- also create images (i.e. executables), it's just that to run on a win32
- system you need to use the pei format.
-
- FIXME: Please add more docs here so the next poor fool that has to hack
- on this code has a chance of getting something accomplished without
- wasting too much time. */
-
-#include "libpei.h"
-
-static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data)
- PARAMS ((bfd *, PTR)) =
-#ifndef coff_bfd_print_private_bfd_data
- NULL;
-#else
- coff_bfd_print_private_bfd_data;
-#undef coff_bfd_print_private_bfd_data
-#endif
-
-static bfd_boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR));
-#define coff_bfd_print_private_bfd_data pe_print_private_bfd_data
-
-static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
- PARAMS ((bfd *, bfd *)) =
-#ifndef coff_bfd_copy_private_bfd_data
- NULL;
-#else
- coff_bfd_copy_private_bfd_data;
-#undef coff_bfd_copy_private_bfd_data
-#endif
-
-static bfd_boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
-#define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data
-
-#define coff_mkobject pe_mkobject
-#define coff_mkobject_hook pe_mkobject_hook
-
-#ifndef NO_COFF_RELOCS
-static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
-#endif
-static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR));
-static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR));
-static bfd_boolean pe_mkobject PARAMS ((bfd *));
-static PTR pe_mkobject_hook PARAMS ((bfd *, PTR, PTR));
-
-#ifdef COFF_IMAGE_WITH_PE
-/* This structure contains static variables used by the ILF code. */
-typedef asection * asection_ptr;
-
-typedef struct
-{
- bfd * abfd;
- bfd_byte * data;
- struct bfd_in_memory * bim;
- unsigned short magic;
-
- arelent * reltab;
- unsigned int relcount;
-
- coff_symbol_type * sym_cache;
- coff_symbol_type * sym_ptr;
- unsigned int sym_index;
-
- unsigned int * sym_table;
- unsigned int * table_ptr;
-
- combined_entry_type * native_syms;
- combined_entry_type * native_ptr;
-
- coff_symbol_type ** sym_ptr_table;
- coff_symbol_type ** sym_ptr_ptr;
-
- unsigned int sec_index;
-
- char * string_table;
- char * string_ptr;
- char * end_string_ptr;
-
- SYMENT * esym_table;
- SYMENT * esym_ptr;
-
- struct internal_reloc * int_reltab;
-}
-pe_ILF_vars;
-
-static asection_ptr pe_ILF_make_a_section PARAMS ((pe_ILF_vars *, const char *, unsigned int, flagword));
-static void pe_ILF_make_a_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, asection_ptr));
-static void pe_ILF_make_a_symbol PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword));
-static void pe_ILF_save_relocs PARAMS ((pe_ILF_vars *, asection_ptr));
-static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct bfd_symbol **, unsigned int));
-static bfd_boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned int, bfd_byte *, bfd_byte *, unsigned int, unsigned int));
-static const bfd_target * pe_ILF_object_p PARAMS ((bfd *));
-static const bfd_target * pe_bfd_object_p PARAMS ((bfd *));
-#endif /* COFF_IMAGE_WITH_PE */
-
-/**********************************************************************/
-
-#ifndef NO_COFF_RELOCS
-static void
-coff_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- RELOC *reloc_src = (RELOC *) src;
- struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
-
- reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr);
- reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
-
- reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
-
-#ifdef SWAP_IN_RELOC_OFFSET
- reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
-#endif
-}
-
-static unsigned int
-coff_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- struct internal_reloc *reloc_src = (struct internal_reloc *)src;
- struct external_reloc *reloc_dst = (struct external_reloc *)dst;
- H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
- H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
-
- H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
-
-#ifdef SWAP_OUT_RELOC_OFFSET
- SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset);
-#endif
-#ifdef SWAP_OUT_RELOC_EXTRA
- SWAP_OUT_RELOC_EXTRA(abfd, reloc_src, reloc_dst);
-#endif
- return RELSZ;
-}
-#endif /* not NO_COFF_RELOCS */
-
-static void
-coff_swap_filehdr_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
-{
- FILHDR *filehdr_src = (FILHDR *) src;
- struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
- filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
- filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src-> f_nscns);
- filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src-> f_timdat);
-
- filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src-> f_nsyms);
- filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src-> f_flags);
- filehdr_dst->f_symptr = H_GET_32 (abfd, filehdr_src->f_symptr);
-
- /* Other people's tools sometimes generate headers with an nsyms but
- a zero symptr. */
- if (filehdr_dst->f_nsyms != 0 && filehdr_dst->f_symptr == 0)
- {
- filehdr_dst->f_nsyms = 0;
- filehdr_dst->f_flags |= F_LSYMS;
- }
-
- filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src-> f_opthdr);
-}
-
-#ifdef COFF_IMAGE_WITH_PE
-# define coff_swap_filehdr_out _bfd_XXi_only_swap_filehdr_out
-#else
-# define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
-#endif
-
-static void
-coff_swap_scnhdr_in (abfd, ext, in)
- bfd *abfd;
- PTR ext;
- PTR in;
-{
- SCNHDR *scnhdr_ext = (SCNHDR *) ext;
- struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
-
- memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
- scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
- scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
- scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
- scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
- scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
- scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr);
- scnhdr_int->s_flags = H_GET_32 (abfd, scnhdr_ext->s_flags);
-
- /* MS handles overflow of line numbers by carrying into the reloc
- field (it appears). Since it's supposed to be zero for PE
- *IMAGE* format, that's safe. This is still a bit iffy. */
-#ifdef COFF_IMAGE_WITH_PE
- scnhdr_int->s_nlnno = (H_GET_16 (abfd, scnhdr_ext->s_nlnno)
- + (H_GET_16 (abfd, scnhdr_ext->s_nreloc) << 16));
- scnhdr_int->s_nreloc = 0;
-#else
- scnhdr_int->s_nreloc = H_GET_16 (abfd, scnhdr_ext->s_nreloc);
- scnhdr_int->s_nlnno = H_GET_16 (abfd, scnhdr_ext->s_nlnno);
-#endif
-
- if (scnhdr_int->s_vaddr != 0)
- {
- scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase;
- scnhdr_int->s_vaddr &= 0xffffffff;
- }
-
-#ifndef COFF_NO_HACK_SCNHDR_SIZE
- /* If this section holds uninitialized data and is from an object file
- or from an executable image that has not initialized the field,
- or if the image is an executable file and the physical size is padded,
- use the virtual size (stored in s_paddr) instead. */
- if (scnhdr_int->s_paddr > 0
- && (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
- && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0))
- || (bfd_pe_executable_p (abfd) && scnhdr_int->s_size > scnhdr_int->s_paddr)))
- {
- scnhdr_int->s_size = scnhdr_int->s_paddr;
-
- /* This code used to set scnhdr_int->s_paddr to 0. However,
- coff_set_alignment_hook stores s_paddr in virt_size, which
- only works if it correctly holds the virtual size of the
- section. */
- }
-#endif
-}
-
-static bfd_boolean
-pe_mkobject (abfd)
- bfd * abfd;
-{
- pe_data_type *pe;
- bfd_size_type amt = sizeof (pe_data_type);
-
- abfd->tdata.pe_obj_data = (struct pe_tdata *) bfd_zalloc (abfd, amt);
-
- if (abfd->tdata.pe_obj_data == 0)
- return FALSE;
-
- pe = pe_data (abfd);
-
- pe->coff.pe = 1;
-
- /* in_reloc_p is architecture dependent. */
- pe->in_reloc_p = in_reloc_p;
-
-#ifdef PEI_FORCE_MINIMUM_ALIGNMENT
- pe->force_minimum_alignment = 1;
-#endif
-#ifdef PEI_TARGET_SUBSYSTEM
- pe->target_subsystem = PEI_TARGET_SUBSYSTEM;
-#endif
-
- return TRUE;
-}
-
-/* Create the COFF backend specific information. */
-static PTR
-pe_mkobject_hook (abfd, filehdr, aouthdr)
- bfd * abfd;
- PTR filehdr;
- PTR aouthdr ATTRIBUTE_UNUSED;
-{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
- pe_data_type *pe;
-
- if (! pe_mkobject (abfd))
- return NULL;
-
- pe = pe_data (abfd);
- pe->coff.sym_filepos = internal_f->f_symptr;
- /* These members communicate important constants about the symbol
- table to GDB's symbol-reading code. These `constants'
- unfortunately vary among coff implementations... */
- pe->coff.local_n_btmask = N_BTMASK;
- pe->coff.local_n_btshft = N_BTSHFT;
- pe->coff.local_n_tmask = N_TMASK;
- pe->coff.local_n_tshift = N_TSHIFT;
- pe->coff.local_symesz = SYMESZ;
- pe->coff.local_auxesz = AUXESZ;
- pe->coff.local_linesz = LINESZ;
-
- pe->coff.timestamp = internal_f->f_timdat;
-
- obj_raw_syment_count (abfd) =
- obj_conv_table_size (abfd) =
- internal_f->f_nsyms;
-
- pe->real_flags = internal_f->f_flags;
-
- if ((internal_f->f_flags & F_DLL) != 0)
- pe->dll = 1;
-
- if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0)
- abfd->flags |= HAS_DEBUG;
-
-#ifdef COFF_IMAGE_WITH_PE
- if (aouthdr)
- pe->pe_opthdr = ((struct internal_aouthdr *)aouthdr)->pe;
-#endif
-
-#ifdef ARM
- if (! _bfd_coff_arm_set_private_flags (abfd, internal_f->f_flags))
- coff_data (abfd) ->flags = 0;
-#endif
-
- return (PTR) pe;
-}
-
-static bfd_boolean
-pe_print_private_bfd_data (abfd, vfile)
- bfd *abfd;
- PTR vfile;
-{
- FILE *file = (FILE *) vfile;
-
- if (!_bfd_XX_print_private_bfd_data_common (abfd, vfile))
- return FALSE;
-
- if (pe_saved_coff_bfd_print_private_bfd_data != NULL)
- {
- fputc ('\n', file);
-
- return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
- }
-
- return TRUE;
-}
-
-/* Copy any private info we understand from the input bfd
- to the output bfd. */
-
-static bfd_boolean
-pe_bfd_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd, *obfd;
-{
- if (!_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd))
- return FALSE;
-
- if (pe_saved_coff_bfd_copy_private_bfd_data)
- return pe_saved_coff_bfd_copy_private_bfd_data (ibfd, obfd);
-
- return TRUE;
-}
-
-#define coff_bfd_copy_private_section_data \
- _bfd_XX_bfd_copy_private_section_data
-
-#define coff_get_symbol_info _bfd_XX_get_symbol_info
-
-#ifdef COFF_IMAGE_WITH_PE
-
-/* Code to handle Microsoft's Image Library Format.
- Also known as LINK6 format.
- Documentation about this format can be found at:
-
- http://msdn.microsoft.com/library/specs/pecoff_section8.htm */
-
-/* The following constants specify the sizes of the various data
- structures that we have to create in order to build a bfd describing
- an ILF object file. The final "+ 1" in the definitions of SIZEOF_IDATA6
- and SIZEOF_IDATA7 below is to allow for the possibility that we might
- need a padding byte in order to ensure 16 bit alignment for the section's
- contents.
-
- The value for SIZEOF_ILF_STRINGS is computed as follows:
-
- There will be NUM_ILF_SECTIONS section symbols. Allow 9 characters
- per symbol for their names (longest section name is .idata$x).
-
- There will be two symbols for the imported value, one the symbol name
- and one with _imp__ prefixed. Allowing for the terminating nul's this
- is strlen (symbol_name) * 2 + 8 + 21 + strlen (source_dll).
-
- The strings in the string table must start STRING__SIZE_SIZE bytes into
- the table in order to for the string lookup code in coffgen/coffcode to
- work. */
-#define NUM_ILF_RELOCS 8
-#define NUM_ILF_SECTIONS 6
-#define NUM_ILF_SYMS (2 + NUM_ILF_SECTIONS)
-
-#define SIZEOF_ILF_SYMS (NUM_ILF_SYMS * sizeof (* vars.sym_cache))
-#define SIZEOF_ILF_SYM_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_table))
-#define SIZEOF_ILF_NATIVE_SYMS (NUM_ILF_SYMS * sizeof (* vars.native_syms))
-#define SIZEOF_ILF_SYM_PTR_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_ptr_table))
-#define SIZEOF_ILF_EXT_SYMS (NUM_ILF_SYMS * sizeof (* vars.esym_table))
-#define SIZEOF_ILF_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.reltab))
-#define SIZEOF_ILF_INT_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.int_reltab))
-#define SIZEOF_ILF_STRINGS (strlen (symbol_name) * 2 + 8 \
- + 21 + strlen (source_dll) \
- + NUM_ILF_SECTIONS * 9 \
- + STRING_SIZE_SIZE)
-#define SIZEOF_IDATA2 (5 * 4)
-#define SIZEOF_IDATA4 (1 * 4)
-#define SIZEOF_IDATA5 (1 * 4)
-#define SIZEOF_IDATA6 (2 + strlen (symbol_name) + 1 + 1)
-#define SIZEOF_IDATA7 (strlen (source_dll) + 1 + 1)
-#define SIZEOF_ILF_SECTIONS (NUM_ILF_SECTIONS * sizeof (struct coff_section_tdata))
-
-#define ILF_DATA_SIZE \
- sizeof (* vars.bim) \
- + SIZEOF_ILF_SYMS \
- + SIZEOF_ILF_SYM_TABLE \
- + SIZEOF_ILF_NATIVE_SYMS \
- + SIZEOF_ILF_SYM_PTR_TABLE \
- + SIZEOF_ILF_EXT_SYMS \
- + SIZEOF_ILF_RELOCS \
- + SIZEOF_ILF_INT_RELOCS \
- + SIZEOF_ILF_STRINGS \
- + SIZEOF_IDATA2 \
- + SIZEOF_IDATA4 \
- + SIZEOF_IDATA5 \
- + SIZEOF_IDATA6 \
- + SIZEOF_IDATA7 \
- + SIZEOF_ILF_SECTIONS \
- + MAX_TEXT_SECTION_SIZE
-
-/* Create an empty relocation against the given symbol. */
-static void
-pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars,
- bfd_vma address,
- bfd_reloc_code_real_type reloc,
- struct bfd_symbol ** sym,
- unsigned int sym_index)
-{
- arelent * entry;
- struct internal_reloc * internal;
-
- entry = vars->reltab + vars->relcount;
- internal = vars->int_reltab + vars->relcount;
-
- entry->address = address;
- entry->addend = 0;
- entry->howto = bfd_reloc_type_lookup (vars->abfd, reloc);
- entry->sym_ptr_ptr = sym;
-
- internal->r_vaddr = address;
- internal->r_symndx = sym_index;
- internal->r_type = entry->howto->type;
-#if 0 /* These fields do not need to be initialised. */
- internal->r_size = 0;
- internal->r_extern = 0;
- internal->r_offset = 0;
-#endif
-
- vars->relcount ++;
-
- BFD_ASSERT (vars->relcount <= NUM_ILF_RELOCS);
-}
-
-/* Create an empty relocation against the given section. */
-static void
-pe_ILF_make_a_reloc (pe_ILF_vars * vars,
- bfd_vma address,
- bfd_reloc_code_real_type reloc,
- asection_ptr sec)
-{
- pe_ILF_make_a_symbol_reloc (vars, address, reloc, sec->symbol_ptr_ptr,
- coff_section_data (vars->abfd, sec)->i);
-}
-
-/* Move the queued relocs into the given section. */
-static void
-pe_ILF_save_relocs (pe_ILF_vars * vars,
- asection_ptr sec)
-{
- /* Make sure that there is somewhere to store the internal relocs. */
- if (coff_section_data (vars->abfd, sec) == NULL)
- /* We should probably return an error indication here. */
- abort ();
-
- coff_section_data (vars->abfd, sec)->relocs = vars->int_reltab;
- coff_section_data (vars->abfd, sec)->keep_relocs = TRUE;
-
- sec->relocation = vars->reltab;
- sec->reloc_count = vars->relcount;
- sec->flags |= SEC_RELOC;
-
- vars->reltab += vars->relcount;
- vars->int_reltab += vars->relcount;
- vars->relcount = 0;
-
- BFD_ASSERT ((bfd_byte *) vars->int_reltab < (bfd_byte *) vars->string_table);
-}
-
-/* Create a global symbol and add it to the relevant tables. */
-static void
-pe_ILF_make_a_symbol (pe_ILF_vars * vars,
- const char * prefix,
- const char * symbol_name,
- asection_ptr section,
- flagword extra_flags)
-{
- coff_symbol_type * sym;
- combined_entry_type * ent;
- SYMENT * esym;
- unsigned short sclass;
-
- if (extra_flags & BSF_LOCAL)
- sclass = C_STAT;
- else
- sclass = C_EXT;
-
-#ifdef THUMBPEMAGIC
- if (vars->magic == THUMBPEMAGIC)
- {
- if (extra_flags & BSF_FUNCTION)
- sclass = C_THUMBEXTFUNC;
- else if (extra_flags & BSF_LOCAL)
- sclass = C_THUMBSTAT;
- else
- sclass = C_THUMBEXT;
- }
-#endif
-
- BFD_ASSERT (vars->sym_index < NUM_ILF_SYMS);
-
- sym = vars->sym_ptr;
- ent = vars->native_ptr;
- esym = vars->esym_ptr;
-
- /* Copy the symbol's name into the string table. */
- sprintf (vars->string_ptr, "%s%s", prefix, symbol_name);
-
- if (section == NULL)
- section = (asection_ptr) & bfd_und_section;
-
- /* Initialise the external symbol. */
- H_PUT_32 (vars->abfd, vars->string_ptr - vars->string_table,
- esym->e.e.e_offset);
- H_PUT_16 (vars->abfd, section->target_index, esym->e_scnum);
- esym->e_sclass[0] = sclass;
-
- /* The following initialisations are unnecessary - the memory is
- zero initialised. They are just kept here as reminders. */
-#if 0
- esym->e.e.e_zeroes = 0;
- esym->e_value = 0;
- esym->e_type = T_NULL;
- esym->e_numaux = 0;
-#endif
-
- /* Initialise the internal symbol structure. */
- ent->u.syment.n_sclass = sclass;
- ent->u.syment.n_scnum = section->target_index;
- ent->u.syment._n._n_n._n_offset = (long) sym;
-
-#if 0 /* See comment above. */
- ent->u.syment.n_value = 0;
- ent->u.syment.n_flags = 0;
- ent->u.syment.n_type = T_NULL;
- ent->u.syment.n_numaux = 0;
- ent->fix_value = 0;
-#endif
-
- sym->symbol.the_bfd = vars->abfd;
- sym->symbol.name = vars->string_ptr;
- sym->symbol.flags = BSF_EXPORT | BSF_GLOBAL | extra_flags;
- sym->symbol.section = section;
- sym->native = ent;
-
-#if 0 /* See comment above. */
- sym->symbol.value = 0;
- sym->symbol.udata.i = 0;
- sym->done_lineno = FALSE;
- sym->lineno = NULL;
-#endif
-
- * vars->table_ptr = vars->sym_index;
- * vars->sym_ptr_ptr = sym;
-
- /* Adjust pointers for the next symbol. */
- vars->sym_index ++;
- vars->sym_ptr ++;
- vars->sym_ptr_ptr ++;
- vars->table_ptr ++;
- vars->native_ptr ++;
- vars->esym_ptr ++;
- vars->string_ptr += strlen (symbol_name) + strlen (prefix) + 1;
-
- BFD_ASSERT (vars->string_ptr < vars->end_string_ptr);
-}
-
-/* Create a section. */
-static asection_ptr
-pe_ILF_make_a_section (pe_ILF_vars * vars,
- const char * name,
- unsigned int size,
- flagword extra_flags)
-{
- asection_ptr sec;
- flagword flags;
-
- sec = bfd_make_section_old_way (vars->abfd, name);
- if (sec == NULL)
- return NULL;
-
- flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_IN_MEMORY;
-
- bfd_set_section_flags (vars->abfd, sec, flags | extra_flags);
-
- bfd_set_section_alignment (vars->abfd, sec, 2);
-
- /* Check that we will not run out of space. */
- BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size);
-
- /* Set the section size and contents. The actual
- contents are filled in by our parent. */
- bfd_set_section_size (vars->abfd, sec, (bfd_size_type) size);
- sec->contents = vars->data;
- sec->target_index = vars->sec_index ++;
-
- /* Advance data pointer in the vars structure. */
- vars->data += size;
-
- /* Skip the padding byte if it was not needed.
- The logic here is that if the string length is odd,
- then the entire string length, including the null byte,
- is even and so the extra, padding byte, is not needed. */
- if (size & 1)
- vars->data --;
-
- /* Create a coff_section_tdata structure for our use. */
- sec->used_by_bfd = (struct coff_section_tdata *) vars->data;
- vars->data += sizeof (struct coff_section_tdata);
-
- BFD_ASSERT (vars->data <= vars->bim->buffer + vars->bim->size);
-
- /* Create a symbol to refer to this section. */
- pe_ILF_make_a_symbol (vars, "", name, sec, BSF_LOCAL);
-
- /* Cache the index to the symbol in the coff_section_data structure. */
- coff_section_data (vars->abfd, sec)->i = vars->sym_index - 1;
-
- return sec;
-}
-
-/* This structure contains the code that goes into the .text section
- in order to perform a jump into the DLL lookup table. The entries
- in the table are index by the magic number used to represent the
- machine type in the PE file. The contents of the data[] arrays in
- these entries are stolen from the jtab[] arrays in ld/pe-dll.c.
- The SIZE field says how many bytes in the DATA array are actually
- used. The OFFSET field says where in the data array the address
- of the .idata$5 section should be placed. */
-#define MAX_TEXT_SECTION_SIZE 32
-
-typedef struct
-{
- unsigned short magic;
- unsigned char data[MAX_TEXT_SECTION_SIZE];
- unsigned int size;
- unsigned int offset;
-}
-jump_table;
-
-static jump_table jtab[] =
-{
-#ifdef I386MAGIC
- { I386MAGIC,
- { 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 },
- 8, 2
- },
-#endif
-
-#ifdef MC68MAGIC
- { MC68MAGIC, { /* XXX fill me in */ }, 0, 0 },
-#endif
-#ifdef MIPS_ARCH_MAGIC_WINCE
- { MIPS_ARCH_MAGIC_WINCE,
- { 0x00, 0x00, 0x08, 0x3c, 0x00, 0x00, 0x08, 0x8d,
- 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 },
- 16, 0
- },
-#endif
-
-#ifdef SH_ARCH_MAGIC_WINCE
- { SH_ARCH_MAGIC_WINCE,
- { 0x01, 0xd0, 0x02, 0x60, 0x2b, 0x40,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00 },
- 12, 8
- },
-#endif
-
-#ifdef ARMPEMAGIC
- { ARMPEMAGIC,
- { 0x00, 0xc0, 0x9f, 0xe5, 0x00, 0xf0,
- 0x9c, 0xe5, 0x00, 0x00, 0x00, 0x00},
- 12, 8
- },
-#endif
-
-#ifdef THUMBPEMAGIC
- { THUMBPEMAGIC,
- { 0x40, 0xb4, 0x02, 0x4e, 0x36, 0x68, 0xb4, 0x46,
- 0x40, 0xbc, 0x60, 0x47, 0x00, 0x00, 0x00, 0x00 },
- 16, 12
- },
-#endif
- { 0, { 0 }, 0, 0 }
-};
-
-#ifndef NUM_ENTRIES
-#define NUM_ENTRIES(a) (sizeof (a) / sizeof (a)[0])
-#endif
-
-/* Build a full BFD from the information supplied in a ILF object. */
-static bfd_boolean
-pe_ILF_build_a_bfd (bfd * abfd,
- unsigned int magic,
- bfd_byte * symbol_name,
- bfd_byte * source_dll,
- unsigned int ordinal,
- unsigned int types)
-{
- bfd_byte * ptr;
- pe_ILF_vars vars;
- struct internal_filehdr internal_f;
- unsigned int import_type;
- unsigned int import_name_type;
- asection_ptr id4, id5, id6 = NULL, text = NULL;
- coff_symbol_type ** imp_sym;
- unsigned int imp_index;
-
- /* Decode and verify the types field of the ILF structure. */
- import_type = types & 0x3;
- import_name_type = (types & 0x1c) >> 2;
-
- switch (import_type)
- {
- case IMPORT_CODE:
- case IMPORT_DATA:
- break;
-
- case IMPORT_CONST:
- /* XXX code yet to be written. */
- _bfd_error_handler (_("%s: Unhandled import type; %x"),
- bfd_archive_filename (abfd), import_type);
- return FALSE;
-
- default:
- _bfd_error_handler (_("%s: Unrecognised import type; %x"),
- bfd_archive_filename (abfd), import_type);
- return FALSE;
- }
-
- switch (import_name_type)
- {
- case IMPORT_ORDINAL:
- case IMPORT_NAME:
- case IMPORT_NAME_NOPREFIX:
- case IMPORT_NAME_UNDECORATE:
- break;
-
- default:
- _bfd_error_handler (_("%s: Unrecognised import name type; %x"),
- bfd_archive_filename (abfd), import_name_type);
- return FALSE;
- }
-
- /* Initialise local variables.
-
- Note these are kept in a structure rather than being
- declared as statics since bfd frowns on global variables.
-
- We are going to construct the contents of the BFD in memory,
- so allocate all the space that we will need right now. */
- ptr = bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE);
- if (ptr == NULL)
- return FALSE;
-
- /* Create a bfd_in_memory structure. */
- vars.bim = (struct bfd_in_memory *) ptr;
- vars.bim->buffer = ptr;
- vars.bim->size = ILF_DATA_SIZE;
- ptr += sizeof (* vars.bim);
-
- /* Initialise the pointers to regions of the memory and the
- other contents of the pe_ILF_vars structure as well. */
- vars.sym_cache = (coff_symbol_type *) ptr;
- vars.sym_ptr = (coff_symbol_type *) ptr;
- vars.sym_index = 0;
- ptr += SIZEOF_ILF_SYMS;
-
- vars.sym_table = (unsigned int *) ptr;
- vars.table_ptr = (unsigned int *) ptr;
- ptr += SIZEOF_ILF_SYM_TABLE;
-
- vars.native_syms = (combined_entry_type *) ptr;
- vars.native_ptr = (combined_entry_type *) ptr;
- ptr += SIZEOF_ILF_NATIVE_SYMS;
-
- vars.sym_ptr_table = (coff_symbol_type **) ptr;
- vars.sym_ptr_ptr = (coff_symbol_type **) ptr;
- ptr += SIZEOF_ILF_SYM_PTR_TABLE;
-
- vars.esym_table = (SYMENT *) ptr;
- vars.esym_ptr = (SYMENT *) ptr;
- ptr += SIZEOF_ILF_EXT_SYMS;
-
- vars.reltab = (arelent *) ptr;
- vars.relcount = 0;
- ptr += SIZEOF_ILF_RELOCS;
-
- vars.int_reltab = (struct internal_reloc *) ptr;
- ptr += SIZEOF_ILF_INT_RELOCS;
-
- vars.string_table = ptr;
- vars.string_ptr = ptr + STRING_SIZE_SIZE;
- ptr += SIZEOF_ILF_STRINGS;
- vars.end_string_ptr = ptr;
-
- /* The remaining space in bim->buffer is used
- by the pe_ILF_make_a_section() function. */
- vars.data = ptr;
- vars.abfd = abfd;
- vars.sec_index = 0;
- vars.magic = magic;
-
- /* Create the initial .idata$<n> sections:
- [.idata$2: Import Directory Table -- not needed]
- .idata$4: Import Lookup Table
- .idata$5: Import Address Table
-
- Note we do not create a .idata$3 section as this is
- created for us by the linker script. */
- id4 = pe_ILF_make_a_section (& vars, ".idata$4", SIZEOF_IDATA4, 0);
- id5 = pe_ILF_make_a_section (& vars, ".idata$5", SIZEOF_IDATA5, 0);
- if (id4 == NULL || id5 == NULL)
- return FALSE;
-
- /* Fill in the contents of these sections. */
- if (import_name_type == IMPORT_ORDINAL)
- {
- if (ordinal == 0)
- /* XXX - treat as IMPORT_NAME ??? */
- abort ();
-
- * (unsigned int *) id4->contents = ordinal | 0x80000000;
- * (unsigned int *) id5->contents = ordinal | 0x80000000;
- }
- else
- {
- char * symbol;
-
- /* Create .idata$6 - the Hint Name Table. */
- id6 = pe_ILF_make_a_section (& vars, ".idata$6", SIZEOF_IDATA6, 0);
- if (id6 == NULL)
- return FALSE;
-
- /* If necessary, trim the import symbol name. */
- symbol = symbol_name;
-
- if (import_name_type != IMPORT_NAME)
- {
- bfd_boolean skipped_leading_underscore = FALSE;
- bfd_boolean skipped_leading_at = FALSE;
- bfd_boolean skipped_leading_question_mark = FALSE;
- bfd_boolean check_again;
-
- /* Skip any prefix in symbol_name. */
- -- symbol;
- do
- {
- check_again = FALSE;
- ++ symbol;
-
- switch (*symbol)
- {
- case '@':
- if (! skipped_leading_at)
- check_again = skipped_leading_at = TRUE;
- break;
- case '?':
- if (! skipped_leading_question_mark)
- check_again = skipped_leading_question_mark = TRUE;
- break;
- case '_':
- if (! skipped_leading_underscore)
- check_again = skipped_leading_underscore = TRUE;
- break;
- default:
- break;
- }
- }
- while (check_again);
- }
-
- if (import_name_type == IMPORT_NAME_UNDECORATE)
- {
- /* Truncate at the first '@' */
- while (* symbol != 0 && * symbol != '@')
- symbol ++;
-
- * symbol = 0;
- }
-
- id6->contents[0] = ordinal & 0xff;
- id6->contents[1] = ordinal >> 8;
-
- strcpy (id6->contents + 2, symbol);
- }
-
- if (import_name_type != IMPORT_ORDINAL)
- {
- pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_RVA, id6);
- pe_ILF_save_relocs (&vars, id4);
-
- pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_RVA, id6);
- pe_ILF_save_relocs (&vars, id5);
- }
-
- /* Create extra sections depending upon the type of import we are dealing with. */
- switch (import_type)
- {
- int i;
-
- case IMPORT_CODE:
- /* Create a .text section.
- First we need to look up its contents in the jump table. */
- for (i = NUM_ENTRIES (jtab); i--;)
- {
- if (jtab[i].size == 0)
- continue;
- if (jtab[i].magic == magic)
- break;
- }
- /* If we did not find a matching entry something is wrong. */
- if (i < 0)
- abort ();
-
- /* Create the .text section. */
- text = pe_ILF_make_a_section (& vars, ".text", jtab[i].size, SEC_CODE);
- if (text == NULL)
- return FALSE;
-
- /* Copy in the jump code. */
- memcpy (text->contents, jtab[i].data, jtab[i].size);
-
- /* Create an import symbol. */
- pe_ILF_make_a_symbol (& vars, "__imp_", symbol_name, id5, 0);
- imp_sym = vars.sym_ptr_ptr - 1;
- imp_index = vars.sym_index - 1;
-
- /* Create a reloc for the data in the text section. */
-#ifdef MIPS_ARCH_MAGIC_WINCE
- if (magic == MIPS_ARCH_MAGIC_WINCE)
- {
- pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 0, BFD_RELOC_HI16_S,
- (struct bfd_symbol **) imp_sym,
- imp_index);
- pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_LO16, text);
- pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 4, BFD_RELOC_LO16,
- (struct bfd_symbol **) imp_sym,
- imp_index);
- }
- else
-#endif
- pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) jtab[i].offset,
- BFD_RELOC_32, (asymbol **) imp_sym,
- imp_index);
-
- pe_ILF_save_relocs (& vars, text);
- break;
-
- case IMPORT_DATA:
- break;
-
- default:
- /* XXX code not yet written. */
- abort ();
- }
-
- /* Initialise the bfd. */
- memset (& internal_f, 0, sizeof (internal_f));
-
- internal_f.f_magic = magic;
- internal_f.f_symptr = 0;
- internal_f.f_nsyms = 0;
- internal_f.f_flags = F_AR32WR | F_LNNO; /* XXX is this correct ? */
-
- if ( ! bfd_set_start_address (abfd, (bfd_vma) 0)
- || ! bfd_coff_set_arch_mach_hook (abfd, & internal_f))
- return FALSE;
-
- if (bfd_coff_mkobject_hook (abfd, (PTR) & internal_f, NULL) == NULL)
- return FALSE;
-
- coff_data (abfd)->pe = 1;
-#ifdef THUMBPEMAGIC
- if (vars.magic == THUMBPEMAGIC)
- /* Stop some linker warnings about thumb code not supporting interworking. */
- coff_data (abfd)->flags |= F_INTERWORK | F_INTERWORK_SET;
-#endif
-
- /* Switch from file contents to memory contents. */
- bfd_cache_close (abfd);
-
- abfd->iostream = (PTR) vars.bim;
- abfd->flags |= BFD_IN_MEMORY /* | HAS_LOCALS */;
- abfd->where = 0;
- obj_sym_filepos (abfd) = 0;
-
- /* Now create a symbol describing the imported value. */
- switch (import_type)
- {
- case IMPORT_CODE:
- pe_ILF_make_a_symbol (& vars, "", symbol_name, text,
- BSF_NOT_AT_END | BSF_FUNCTION);
-
- /* Create an import symbol for the DLL, without the
- .dll suffix. */
- ptr = strrchr (source_dll, '.');
- if (ptr)
- * ptr = 0;
- pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0);
- if (ptr)
- * ptr = '.';
- break;
-
- case IMPORT_DATA:
- /* Nothing to do here. */
- break;
-
- default:
- /* XXX code not yet written. */
- abort ();
- }
-
- /* Point the bfd at the symbol table. */
- obj_symbols (abfd) = vars.sym_cache;
- bfd_get_symcount (abfd) = vars.sym_index;
-
- obj_raw_syments (abfd) = vars.native_syms;
- obj_raw_syment_count (abfd) = vars.sym_index;
-
- obj_coff_external_syms (abfd) = (PTR) vars.esym_table;
- obj_coff_keep_syms (abfd) = TRUE;
-
- obj_convert (abfd) = vars.sym_table;
- obj_conv_table_size (abfd) = vars.sym_index;
-
- obj_coff_strings (abfd) = vars.string_table;
- obj_coff_keep_strings (abfd) = TRUE;
-
- abfd->flags |= HAS_SYMS;
-
- return TRUE;
-}
-
-/* We have detected a Image Library Format archive element.
- Decode the element and return the appropriate target. */
-static const bfd_target *
-pe_ILF_object_p (bfd * abfd)
-{
- bfd_byte buffer[16];
- bfd_byte * ptr;
- bfd_byte * symbol_name;
- bfd_byte * source_dll;
- unsigned int machine;
- bfd_size_type size;
- unsigned int ordinal;
- unsigned int types;
- unsigned int magic;
-
- /* Upon entry the first four buyes of the ILF header have
- already been read. Now read the rest of the header. */
- if (bfd_bread (buffer, (bfd_size_type) 16, abfd) != 16)
- return NULL;
-
- ptr = buffer;
-
- /* We do not bother to check the version number.
- version = H_GET_16 (abfd, ptr); */
- ptr += 2;
-
- machine = H_GET_16 (abfd, ptr);
- ptr += 2;
-
- /* Check that the machine type is recognised. */
- magic = 0;
-
- switch (machine)
- {
- case IMAGE_FILE_MACHINE_UNKNOWN:
- case IMAGE_FILE_MACHINE_ALPHA:
- case IMAGE_FILE_MACHINE_ALPHA64:
- case IMAGE_FILE_MACHINE_IA64:
- break;
-
- case IMAGE_FILE_MACHINE_I386:
-#ifdef I386MAGIC
- magic = I386MAGIC;
-#endif
- break;
-
- case IMAGE_FILE_MACHINE_M68K:
-#ifdef MC68AGIC
- magic = MC68MAGIC;
-#endif
- break;
-
- case IMAGE_FILE_MACHINE_R3000:
- case IMAGE_FILE_MACHINE_R4000:
- case IMAGE_FILE_MACHINE_R10000:
-
- case IMAGE_FILE_MACHINE_MIPS16:
- case IMAGE_FILE_MACHINE_MIPSFPU:
- case IMAGE_FILE_MACHINE_MIPSFPU16:
-#ifdef MIPS_ARCH_MAGIC_WINCE
- magic = MIPS_ARCH_MAGIC_WINCE;
-#endif
- break;
-
- case IMAGE_FILE_MACHINE_SH3:
- case IMAGE_FILE_MACHINE_SH4:
-#ifdef SH_ARCH_MAGIC_WINCE
- magic = SH_ARCH_MAGIC_WINCE;
-#endif
- break;
-
- case IMAGE_FILE_MACHINE_ARM:
-#ifdef ARMPEMAGIC
- magic = ARMPEMAGIC;
-#endif
- break;
-
- case IMAGE_FILE_MACHINE_THUMB:
-#ifdef THUMBPEMAGIC
- {
- extern const bfd_target TARGET_LITTLE_SYM;
-
- if (abfd->xvec == & TARGET_LITTLE_SYM)
- magic = THUMBPEMAGIC;
- }
-#endif
- break;
-
- case IMAGE_FILE_MACHINE_POWERPC:
- /* We no longer support PowerPC. */
- default:
- _bfd_error_handler
- (
-_("%s: Unrecognised machine type (0x%x) in Import Library Format archive"),
- bfd_archive_filename (abfd), machine);
- bfd_set_error (bfd_error_malformed_archive);
-
- return NULL;
- break;
- }
-
- if (magic == 0)
- {
- _bfd_error_handler
- (
-_("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"),
- bfd_archive_filename (abfd), machine);
- bfd_set_error (bfd_error_wrong_format);
-
- return NULL;
- }
-
- /* We do not bother to check the date.
- date = H_GET_32 (abfd, ptr); */
- ptr += 4;
-
- size = H_GET_32 (abfd, ptr);
- ptr += 4;
-
- if (size == 0)
- {
- _bfd_error_handler
- (_("%s: size field is zero in Import Library Format header"),
- bfd_archive_filename (abfd));
- bfd_set_error (bfd_error_malformed_archive);
-
- return NULL;
- }
-
- ordinal = H_GET_16 (abfd, ptr);
- ptr += 2;
-
- types = H_GET_16 (abfd, ptr);
- /* ptr += 2; */
-
- /* Now read in the two strings that follow. */
- ptr = bfd_alloc (abfd, size);
- if (ptr == NULL)
- return NULL;
-
- if (bfd_bread (ptr, size, abfd) != size)
- {
- bfd_release (abfd, ptr);
- return NULL;
- }
-
- symbol_name = ptr;
- source_dll = ptr + strlen (ptr) + 1;
-
- /* Verify that the strings are null terminated. */
- if (ptr[size - 1] != 0 || ((unsigned long) (source_dll - ptr) >= size))
- {
- _bfd_error_handler
- (_("%s: string not null terminated in ILF object file."),
- bfd_archive_filename (abfd));
- bfd_set_error (bfd_error_malformed_archive);
- bfd_release (abfd, ptr);
- return NULL;
- }
-
- /* Now construct the bfd. */
- if (! pe_ILF_build_a_bfd (abfd, magic, symbol_name,
- source_dll, ordinal, types))
- {
- bfd_release (abfd, ptr);
- return NULL;
- }
-
- return abfd->xvec;
-}
-
-static const bfd_target *
-pe_bfd_object_p (bfd * abfd)
-{
- bfd_byte buffer[4];
- struct external_PEI_DOS_hdr dos_hdr;
- struct external_PEI_IMAGE_hdr image_hdr;
- file_ptr offset;
-
- /* Detect if this a Microsoft Import Library Format element. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (buffer, (bfd_size_type) 4, abfd) != 4)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (H_GET_32 (abfd, buffer) == 0xffff0000)
- return pe_ILF_object_p (abfd);
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd)
- != sizeof (dos_hdr))
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* There are really two magic numbers involved; the magic number
- that says this is a NT executable (PEI) and the magic number that
- determines the architecture. The former is DOSMAGIC, stored in
- the e_magic field. The latter is stored in the f_magic field.
- If the NT magic number isn't valid, the architecture magic number
- could be mimicked by some other field (specifically, the number
- of relocs in section 3). Since 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 (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- 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 (H_GET_32 (abfd, image_hdr.nt_signature) != 0x4550)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* 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_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- return coff_object_p (abfd);
-}
-
-#define coff_object_p pe_bfd_object_p
-#endif /* COFF_IMAGE_WITH_PE */
diff --git a/contrib/binutils/bfd/po/BLD-POTFILES.in b/contrib/binutils/bfd/po/BLD-POTFILES.in
deleted file mode 100644
index 2dbe723..0000000
--- a/contrib/binutils/bfd/po/BLD-POTFILES.in
+++ /dev/null
@@ -1,8 +0,0 @@
-bfdver.h
-elf32-ia64.c
-elf32-target.h
-elf64-ia64.c
-elf64-target.h
-peigen.c
-pepigen.c
-targmatch.h
diff --git a/contrib/binutils/bfd/po/Make-in b/contrib/binutils/bfd/po/Make-in
deleted file mode 100644
index 1608b2d..0000000
--- a/contrib/binutils/bfd/po/Make-in
+++ /dev/null
@@ -1,292 +0,0 @@
-# Makefile for program source directory in GNU NLS utilities package.
-# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
-#
-# This file file be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU Public License
-# but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
-
-PACKAGE = @PACKAGE@
-VERSION = @VERSION@
-
-SHELL = /bin/sh
-@SET_MAKE@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-datadir = $(prefix)/@DATADIRNAME@
-localedir = $(datadir)/locale
-gnulocaledir = $(prefix)/share/locale
-gettextsrcdir = $(prefix)/share/gettext/po
-subdir = po
-
-DESTDIR =
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-
-CC = @CC@
-GENCAT = @GENCAT@
-GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
-MSGFMT = @MSGFMT@
-XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
-MSGMERGE = PATH=../src:$$PATH msgmerge
-
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-
-INCLUDES = -I.. -I$(top_srcdir)/intl
-
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
-
-SOURCES = cat-id-tbl.c
-POFILES = @POFILES@
-GMOFILES = @GMOFILES@
-DISTFILES = ChangeLog Makefile.in.in SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \
-stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
-
-# Note - the following line gets processed by bfd/configure and amended
-# to contain the full list of source dir POTFILES.
-SRC-POTFILES = \
-
-# Note - the following line gets processed by bfd/configure and amended
-# to contain the full list of build dir POTFILES.
-BLD-POTFILES = \
-
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
-INSTOBJEXT = @INSTOBJEXT@
-
-.SUFFIXES:
-.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
-
-.c.o:
- $(COMPILE) $<
-
-.po.pox:
- $(MAKE) $(PACKAGE).pot
- $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
-
-.po.mo:
- $(MSGFMT) -o $@ $<
-
-.po.gmo:
- file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
- && rm -f $$file && $(GMSGFMT) -o $$file $<
-
-.po.cat:
- sed -f ../intl/po2msg.sed < $< > $*.msg \
- && rm -f $@ && $(GENCAT) $@ $*.msg
-
-
-all: all-@USE_NLS@
-
-all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
-all-no:
-
-$(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
- $(XGETTEXT) --default-domain=$(PACKAGE) \
- --directory=$(top_srcdir) \
- --add-comments --keyword=_ --keyword=N_ \
- --files-from=$(srcdir)/SRC-POTFILES.in
- $(XGETTEXT) --default-domain=$(PACKAGE) \
- --directory=.. \
- --directory=. \
- --add-comments --keyword=_ --keyword=N_ \
- --join-existing \
- --files-from=$(srcdir)/BLD-POTFILES.in
- rm -f $(srcdir)/$(PACKAGE).pot
- mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
-
-$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
-$(srcdir)/stamp-cat-id: $(PACKAGE).pot
- rm -f cat-id-tbl.tmp
- sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
- | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
- if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
- rm cat-id-tbl.tmp; \
- else \
- echo cat-id-tbl.c changed; \
- rm -f $(srcdir)/cat-id-tbl.c; \
- mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
- fi
- cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
-
-
-install: install-exec install-data
-install-exec:
-install-info:
-install-data: install-data-@USE_NLS@
-install-data-no: all
-install-data-yes: all
- if test -r $(MKINSTALLDIRS); then \
- $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
- else \
- $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
- fi
- @catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- case "$$cat" in \
- *.gmo) destdir=$(gnulocaledir);; \
- *) destdir=$(localedir);; \
- esac; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
- if test -r $(MKINSTALLDIRS); then \
- $(MKINSTALLDIRS) $$dir; \
- else \
- $(top_srcdir)/mkinstalldirs $$dir; \
- fi; \
- if test -r $$cat; then \
- $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
- echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
- else \
- $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
- echo "installing $(srcdir)/$$cat as" \
- "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
- fi; \
- if test -r $$cat.m; then \
- $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
- echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
- else \
- if test -r $(srcdir)/$$cat.m ; then \
- $(INSTALL_DATA) $(srcdir)/$$cat.m \
- $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
- echo "installing $(srcdir)/$$cat as" \
- "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
- else \
- true; \
- fi; \
- fi; \
- done
- if test "$(PACKAGE)" = "gettext"; then \
- if test -r $(MKINSTALLDIRS); then \
- $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
- else \
- $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
- fi; \
- $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
- $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
- else \
- : ; \
- fi
-
-# Define this as empty until I found a useful application.
-installcheck:
-
-uninstall:
- catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
- rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
- done
- rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
-
-check: all
-
-cat-id-tbl.o: ../intl/libgettext.h
-
-dvi info tags TAGS ID:
-
-mostlyclean:
- rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
- rm -fr *.o
-
-clean: mostlyclean
-
-distclean: clean
- rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
- rm -f SRC-POTFILES BLD-POTFILES
-
-maintainer-clean: distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
- rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in
-
-distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
-dist distdir: update-po $(DISTFILES)
- dists="$(DISTFILES)"; \
- for file in $$dists; do \
- ln $(srcdir)/$$file $(distdir) 2> /dev/null \
- || cp -p $(srcdir)/$$file $(distdir); \
- done
-
-update-po: Makefile
- $(MAKE) $(PACKAGE).pot
- PATH=`pwd`/../src:$$PATH; \
- cd $(srcdir); \
- catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- mv $$lang.po $$lang.old.po; \
- echo "$$lang:"; \
- if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
- rm -f $$lang.old.po; \
- else \
- echo "msgmerge for $$cat failed!"; \
- rm -f $$lang.po; \
- mv $$lang.old.po $$lang.po; \
- fi; \
- done
-
-SRC-POTFILES: SRC-POTFILES.in
- ( if test 'x$(srcdir)' != 'x.'; then \
- posrcprefix='$(top_srcdir)/'; \
- else \
- posrcprefix="../"; \
- fi; \
- rm -f $@-t $@ \
- && (sed -e '/^#/d' \
- -e '/^[ ]*$$/d' \
- -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
- | sed -e '$$s/\\$$//') > $@-t \
- && chmod a-w $@-t \
- && mv $@-t $@ )
-
-BLD-POTFILES: BLD-POTFILES.in
- ( rm -f $@-t $@ \
- && (sed -e '/^#/d' \
- -e '/^[ ]*$$/d' \
- -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \
- | sed -e '$$s/\\$$//') > $@-t \
- && chmod a-w $@-t \
- && mv $@-t $@ )
-
-SRC-POTFILES.in: @MAINT@ ../Makefile
- cd .. && $(MAKE) po/SRC-POTFILES.in
-
-BLD-POTFILES.in: @MAINT@ ../Makefile
- cd .. && $(MAKE) po/BLD-POTFILES.in
-
-# Note - The presence of SRC-POTFILES and BLD-POTFILES as dependencies
-# here breaks the implementation of the 'distclean' rule for maintainers.
-# This is because if 'make distclean' is run in the BFD directory, the
-# Makefile there will be deleted before 'distclean' is made here, and so
-# the dependency SRC-POTFILES -> SRC-POTFILES.in -> ../Makefile cannot
-# be satisfied.
-#
-# The SRC-POTFILES and BLD-POTFILES dependencies cannot be removed,
-# however since it is necessary that these files be built during
-# *configure* time, so that configure can insert them into the
-# po/Makefile that it is creating, so that the Makefile will have
-# the correct dependencies.
-Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES
- cd .. \
- && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
- CONFIG_HEADERS= $(SHELL) ./config.status
-
-# Tell versions [3.59,3.63) of GNU make not to export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/contrib/binutils/bfd/po/POTFILES.in b/contrib/binutils/bfd/po/POTFILES.in
deleted file mode 100644
index f75b4ca..0000000
--- a/contrib/binutils/bfd/po/POTFILES.in
+++ /dev/null
@@ -1,255 +0,0 @@
-aix386-core.c
-aout0.c
-aout32.c
-aout64.c
-aout-adobe.c
-aout-arm.c
-aout-cris.c
-aoutf1.h
-aout-ns32k.c
-aout-sparcle.c
-aout-target.h
-aout-tic30.c
-aoutx.h
-archive.c
-archures.c
-armnetbsd.c
-bfd.c
-binary.c
-bout.c
-cache.c
-cf-i386lynx.c
-cf-m68klynx.c
-cf-sparclynx.c
-cisco-core.c
-coff64-rs6000.c
-coff-a29k.c
-coff-alpha.c
-coff-apollo.c
-coff-arm.c
-coff-aux.c
-coffcode.h
-coffgen.c
-coff-go32.c
-coff-h8300.c
-coff-h8500.c
-coff-i386.c
-coff-i860.c
-coff-i960.c
-cofflink.c
-coff-m68k.c
-coff-m88k.c
-coff-mips.c
-coff-pmac.c
-coff-rs6000.c
-coff-sh.c
-coff-sparc.c
-coff-stgo32.c
-coff-svm68k.c
-coffswap.h
-coff-tic30.c
-coff-tic54x.c
-coff-tic80.c
-coff-u68k.c
-coff-w65.c
-coff-we32k.c
-coff-z8k.c
-corefile.c
-cpu-a29k.c
-cpu-alpha.c
-cpu-arc.c
-cpu-arm.c
-cpu-avr.c
-cpu-cris.c
-cpu-d10v.c
-cpu-d30v.c
-cpu-fr30.c
-cpu-h8300.c
-cpu-h8500.c
-cpu-hppa.c
-cpu-i370.c
-cpu-i386.c
-cpu-i860.c
-cpu-i960.c
-cpu-ia64.c
-cpu-m10200.c
-cpu-m10300.c
-cpu-m32r.c
-cpu-m68hc11.c
-cpu-m68hc12.c
-cpu-m68k.c
-cpu-m88k.c
-cpu-mcore.c
-cpu-mips.c
-cpu-ns32k.c
-cpu-pj.c
-cpu-powerpc.c
-cpu-rs6000.c
-cpu-sh.c
-cpu-sparc.c
-cpu-tic30.c
-cpu-tic54x.c
-cpu-tic80.c
-cpu-v850.c
-cpu-vax.c
-cpu-w65.c
-cpu-we32k.c
-cpu-z8k.c
-demo64.c
-dwarf1.c
-dwarf2.c
-ecoff.c
-ecofflink.c
-ecoffswap.h
-efi-app-ia32.c
-efi-app-ia64.c
-elf32-arc.c
-elf32-arm.h
-elf32-avr.c
-elf32.c
-elf32-cris.c
-elf32-d10v.c
-elf32-d30v.c
-elf32-fr30.c
-elf32-gen.c
-elf32-hppa.c
-elf32-hppa.h
-elf32-i370.c
-elf32-i386.c
-elf32-i860.c
-elf32-i960.c
-elf32-m32r.c
-elf32-m68hc11.c
-elf32-m68hc12.c
-elf32-m68k.c
-elf32-m88k.c
-elf32-mcore.c
-elf32-mips.c
-elf32-pj.c
-elf32-ppc.c
-elf32-sh.c
-elf32-sh-lin.c
-elf32-sparc.c
-elf32-v850.c
-elf64-alpha.c
-elf64.c
-elf64-gen.c
-elf64-hppa.c
-elf64-hppa.h
-elf64-mips.c
-elf64-sparc.c
-elf64-x86-64.c
-elfarm-nabi.c
-elfarm-oabi.c
-elf-bfd.h
-elf.c
-elfcode.h
-elfcore.h
-elf-hppa.h
-elflink.c
-elflink.h
-elf-m10200.c
-elf-m10300.c
-epoc-pe-arm.c
-epoc-pei-arm.c
-format.c
-freebsd.h
-genlink.h
-go32stub.h
-hash.c
-hp300bsd.c
-hp300hpux.c
-hpux-core.c
-i386aout.c
-i386bsd.c
-i386dynix.c
-i386freebsd.c
-i386linux.c
-i386lynx.c
-i386mach3.c
-i386msdos.c
-i386netbsd.c
-i386os9k.c
-ieee.c
-ihex.c
-init.c
-irix-core.c
-libaout.h
-libbfd.c
-libbfd.h
-libcoff.h
-libecoff.h
-libhppa.h
-libieee.h
-libnlm.h
-liboasys.h
-libpei.h
-linker.c
-lynx-core.c
-m68k4knetbsd.c
-m68klinux.c
-m68klynx.c
-m68knetbsd.c
-m88kmach3.c
-mipsbsd.c
-netbsd.h
-newsos3.c
-nlm32-alpha.c
-nlm32.c
-nlm32-i386.c
-nlm32-ppc.c
-nlm32-sparc.c
-nlm64.c
-nlm.c
-nlmcode.h
-nlmswap.h
-nlm-target.h
-ns32k.h
-ns32knetbsd.c
-oasys.c
-opncls.c
-osf-core.c
-pc532-mach.c
-pe-arm.c
-pe-i386.c
-pei-arm.c
-peicode.h
-peigen.c
-pei-i386.c
-pei-mcore.c
-pei-mips.c
-pei-ppc.c
-pei-sh.c
-pe-mcore.c
-pe-mips.c
-pe-ppc.c
-pe-sh.c
-ppcboot.c
-reloc16.c
-reloc.c
-riscix.c
-sco5-core.c
-section.c
-som.c
-som.h
-sparclinux.c
-sparclynx.c
-sparcnetbsd.c
-srec.c
-stabs.c
-stab-syms.c
-sunos.c
-syms.c
-targets.c
-tekhex.c
-trad-core.c
-vaxnetbsd.c
-versados.c
-vms.c
-vms-gsd.c
-vms.h
-vms-hdr.c
-vms-misc.c
-vms-tir.c
-xcofflink.c
-xcoff-target.h
diff --git a/contrib/binutils/bfd/po/SRC-POTFILES.in b/contrib/binutils/bfd/po/SRC-POTFILES.in
deleted file mode 100644
index d29593d..0000000
--- a/contrib/binutils/bfd/po/SRC-POTFILES.in
+++ /dev/null
@@ -1,311 +0,0 @@
-aix386-core.c
-aix5ppc-core.c
-aout0.c
-aout32.c
-aout64.c
-aout-adobe.c
-aout-arm.c
-aout-cris.c
-aoutf1.h
-aout-ns32k.c
-aout-sparcle.c
-aout-target.h
-aout-tic30.c
-aoutx.h
-archive64.c
-archive.c
-archures.c
-armnetbsd.c
-bfd.c
-bfdio.c
-bfdwin.c
-binary.c
-bout.c
-cache.c
-cf-i386lynx.c
-cf-m68klynx.c
-cf-sparclynx.c
-cisco-core.c
-coff64-rs6000.c
-coff-a29k.c
-coff-alpha.c
-coff-apollo.c
-coff-arm.c
-coff-aux.c
-coffcode.h
-coffgen.c
-coff-go32.c
-coff-h8300.c
-coff-h8500.c
-coff-i386.c
-coff-i860.c
-coff-i960.c
-cofflink.c
-coff-m68k.c
-coff-m88k.c
-coff-mips.c
-coff-or32.c
-coff-rs6000.c
-coff-sh.c
-coff-sparc.c
-coff-stgo32.c
-coff-svm68k.c
-coffswap.h
-coff-tic30.c
-coff-tic4x.c
-coff-tic54x.c
-coff-tic80.c
-coff-u68k.c
-coff-w65.c
-coff-we32k.c
-coff-z8k.c
-corefile.c
-cpu-a29k.c
-cpu-alpha.c
-cpu-arc.c
-cpu-arm.c
-cpu-avr.c
-cpu-cris.c
-cpu-d10v.c
-cpu-d30v.c
-cpu-dlx.c
-cpu-fr30.c
-cpu-frv.c
-cpu-h8300.c
-cpu-h8500.c
-cpu-hppa.c
-cpu-i370.c
-cpu-i386.c
-cpu-i860.c
-cpu-i960.c
-cpu-ia64.c
-cpu-ip2k.c
-cpu-iq2000.c
-cpu-m10200.c
-cpu-m10300.c
-cpu-m32r.c
-cpu-m68hc11.c
-cpu-m68hc12.c
-cpu-m68k.c
-cpu-m88k.c
-cpu-mcore.c
-cpu-mips.c
-cpu-mmix.c
-cpu-msp430.c
-cpu-ns32k.c
-cpu-openrisc.c
-cpu-or32.c
-cpu-pdp11.c
-cpu-pj.c
-cpu-powerpc.c
-cpu-rs6000.c
-cpu-s390.c
-cpu-sh.c
-cpu-sparc.c
-cpu-tic30.c
-cpu-tic4x.c
-cpu-tic54x.c
-cpu-tic80.c
-cpu-v850.c
-cpu-vax.c
-cpu-w65.c
-cpu-we32k.c
-cpu-xstormy16.c
-cpu-xtensa.c
-cpu-z8k.c
-demo64.c
-dwarf1.c
-dwarf2.c
-ecoff.c
-ecofflink.c
-ecoffswap.h
-efi-app-ia32.c
-efi-app-ia64.c
-elf32-am33lin.c
-elf32-arc.c
-elf32-arm.h
-elf32-avr.c
-elf32.c
-elf32-cris.c
-elf32-d10v.c
-elf32-d30v.c
-elf32-dlx.c
-elf32-fr30.c
-elf32-frv.c
-elf32-gen.c
-elf32-h8300.c
-elf32-hppa.c
-elf32-hppa.h
-elf32-i370.c
-elf32-i386.c
-elf32-i860.c
-elf32-i960.c
-elf32-ip2k.c
-elf32-iq2000.c
-elf32-m32r.c
-elf32-m68hc11.c
-elf32-m68hc12.c
-elf32-m68hc1x.c
-elf32-m68k.c
-elf32-m88k.c
-elf32-mcore.c
-elf32-mips.c
-elf32-msp430.c
-elf32-openrisc.c
-elf32-or32.c
-elf32-pj.c
-elf32-ppc.c
-elf32-s390.c
-elf32-sh64.c
-elf32-sh64-com.c
-elf32-sh.c
-elf32-sparc.c
-elf32-v850.c
-elf32-vax.c
-elf32-xstormy16.c
-elf32-xtensa.c
-elf64-alpha.c
-elf64.c
-elf64-gen.c
-elf64-hppa.c
-elf64-hppa.h
-elf64-mips.c
-elf64-mmix.c
-elf64-ppc.c
-elf64-s390.c
-elf64-sh64.c
-elf64-sparc.c
-elf64-x86-64.c
-elfarm-nabi.c
-elfarm-oabi.c
-elf-bfd.h
-elf.c
-elfcode.h
-elfcore.h
-elf-eh-frame.c
-elf-hppa.h
-elflink.c
-elf-m10200.c
-elf-m10300.c
-elfn32-mips.c
-elf-strtab.c
-elfxx-mips.c
-epoc-pe-arm.c
-epoc-pei-arm.c
-format.c
-freebsd.h
-genlink.h
-go32stub.h
-hash.c
-hp300bsd.c
-hp300hpux.c
-hpux-core.c
-i386aout.c
-i386bsd.c
-i386dynix.c
-i386freebsd.c
-i386linux.c
-i386lynx.c
-i386mach3.c
-i386msdos.c
-i386netbsd.c
-i386os9k.c
-ieee.c
-ihex.c
-init.c
-irix-core.c
-libaout.h
-libbfd.c
-libbfd.h
-libcoff.h
-libecoff.h
-libhppa.h
-libieee.h
-libnlm.h
-liboasys.h
-libpei.h
-libxcoff.h
-linker.c
-lynx-core.c
-m68k4knetbsd.c
-m68klinux.c
-m68klynx.c
-m68knetbsd.c
-m88kmach3.c
-mach-o.c
-mach-o.h
-merge.c
-mipsbsd.c
-mmo.c
-netbsd.h
-newsos3.c
-nlm32-alpha.c
-nlm32.c
-nlm32-i386.c
-nlm32-ppc.c
-nlm32-sparc.c
-nlm64.c
-nlm.c
-nlmcode.h
-nlmswap.h
-nlm-target.h
-ns32k.h
-ns32knetbsd.c
-oasys.c
-opncls.c
-osf-core.c
-pc532-mach.c
-pdp11.c
-pe-arm.c
-pef.c
-pef.h
-pef-traceback.h
-pe-i386.c
-pei-arm.c
-peicode.h
-pei-i386.c
-pei-mcore.c
-pei-mips.c
-pei-ppc.c
-pei-sh.c
-pe-mcore.c
-pe-mips.c
-pe-ppc.c
-pe-sh.c
-ppcboot.c
-reloc16.c
-reloc.c
-riscix.c
-sco5-core.c
-section.c
-simple.c
-som.c
-som.h
-sparclinux.c
-sparclynx.c
-sparcnetbsd.c
-srec.c
-stabs.c
-stab-syms.c
-sunos.c
-syms.c
-targets.c
-tekhex.c
-trad-core.c
-vax1knetbsd.c
-vaxbsd.c
-vaxnetbsd.c
-versados.c
-version.h
-vms.c
-vms-gsd.c
-vms.h
-vms-hdr.c
-vms-misc.c
-vms-tir.c
-xcofflink.c
-xcoff-target.h
-xsym.c
-xsym.h
-xtensa-isa.c
-xtensa-modules.c
diff --git a/contrib/binutils/bfd/po/bfd.pot b/contrib/binutils/bfd/po/bfd.pot
deleted file mode 100644
index 5d4f234..0000000
--- a/contrib/binutils/bfd/po/bfd.pot
+++ /dev/null
@@ -1,3005 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR Free Software Foundation, Inc.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2003-07-17 14:52+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: aout-adobe.c:204
-#, c-format
-msgid "%s: Unknown section type in a.out.adobe file: %x\n"
-msgstr ""
-
-#: aout-cris.c:207
-#, c-format
-msgid "%s: Invalid relocation type exported: %d"
-msgstr ""
-
-#: aout-cris.c:251
-#, c-format
-msgid "%s: Invalid relocation type imported: %d"
-msgstr ""
-
-#: aout-cris.c:262
-#, c-format
-msgid "%s: Bad relocation record imported: %d"
-msgstr ""
-
-#: aoutx.h:1295 aoutx.h:1716
-#, c-format
-msgid "%s: can not represent section `%s' in a.out object file format"
-msgstr ""
-
-#: aoutx.h:1682
-#, c-format
-msgid ""
-"%s: can not represent section for symbol `%s' in a.out object file format"
-msgstr ""
-
-#: aoutx.h:1684
-msgid "*unknown*"
-msgstr ""
-
-#: aoutx.h:3776
-#, c-format
-msgid "%s: relocatable link from %s to %s not supported"
-msgstr ""
-
-#: archive.c:1751
-msgid "Warning: writing archive was slow: rewriting timestamp\n"
-msgstr ""
-
-#: archive.c:2014
-msgid "Reading archive file mod timestamp"
-msgstr ""
-
-#: archive.c:2040
-msgid "Writing updated armap timestamp"
-msgstr ""
-
-#: bfd.c:280
-msgid "No error"
-msgstr ""
-
-#: bfd.c:281
-msgid "System call error"
-msgstr ""
-
-#: bfd.c:282
-msgid "Invalid bfd target"
-msgstr ""
-
-#: bfd.c:283
-msgid "File in wrong format"
-msgstr ""
-
-#: bfd.c:284
-msgid "Archive object file in wrong format"
-msgstr ""
-
-#: bfd.c:285
-msgid "Invalid operation"
-msgstr ""
-
-#: bfd.c:286
-msgid "Memory exhausted"
-msgstr ""
-
-#: bfd.c:287
-msgid "No symbols"
-msgstr ""
-
-#: bfd.c:288
-msgid "Archive has no index; run ranlib to add one"
-msgstr ""
-
-#: bfd.c:289
-msgid "No more archived files"
-msgstr ""
-
-#: bfd.c:290
-msgid "Malformed archive"
-msgstr ""
-
-#: bfd.c:291
-msgid "File format not recognized"
-msgstr ""
-
-#: bfd.c:292
-msgid "File format is ambiguous"
-msgstr ""
-
-#: bfd.c:293
-msgid "Section has no contents"
-msgstr ""
-
-#: bfd.c:294
-msgid "Nonrepresentable section on output"
-msgstr ""
-
-#: bfd.c:295
-msgid "Symbol needs debug section which does not exist"
-msgstr ""
-
-#: bfd.c:296
-msgid "Bad value"
-msgstr ""
-
-#: bfd.c:297
-msgid "File truncated"
-msgstr ""
-
-#: bfd.c:298
-msgid "File too big"
-msgstr ""
-
-#: bfd.c:299
-msgid "#<Invalid error code>"
-msgstr ""
-
-#: bfd.c:687
-#, c-format
-msgid "BFD %s assertion fail %s:%d"
-msgstr ""
-
-#: bfd.c:703
-#, c-format
-msgid "BFD %s internal error, aborting at %s line %d in %s\n"
-msgstr ""
-
-#: bfd.c:707
-#, c-format
-msgid "BFD %s internal error, aborting at %s line %d\n"
-msgstr ""
-
-#: bfd.c:709
-msgid "Please report this bug.\n"
-msgstr ""
-
-#: bfdwin.c:202
-#, c-format
-msgid "not mapping: data=%lx mapped=%d\n"
-msgstr ""
-
-#: bfdwin.c:205
-msgid "not mapping: env var not set\n"
-msgstr ""
-
-#: binary.c:306
-#, c-format
-msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."
-msgstr ""
-
-#: coff-rs6000.c:3616 coff64-rs6000.c:2109
-#, c-format
-msgid "%s: symbol `%s' has unrecognized smclas %d"
-msgstr ""
-
-#: coff-a29k.c:120
-msgid "Missing IHCONST"
-msgstr ""
-
-#: coff-a29k.c:181
-msgid "Missing IHIHALF"
-msgstr ""
-
-#: coff-a29k.c:213 coff-or32.c:236
-msgid "Unrecognized reloc"
-msgstr ""
-
-#: coff-a29k.c:409
-msgid "missing IHCONST reloc"
-msgstr ""
-
-#: coff-a29k.c:499
-msgid "missing IHIHALF reloc"
-msgstr ""
-
-#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397
-msgid "GP relative relocation used when GP not defined"
-msgstr ""
-
-#: coff-alpha.c:1488
-msgid "using multiple gp values"
-msgstr ""
-
-#: coff-arm.c:1066 elf32-arm.h:294
-#, c-format
-msgid "%s: unable to find THUMB glue '%s' for `%s'"
-msgstr ""
-
-#: coff-arm.c:1096 elf32-arm.h:329
-#, c-format
-msgid "%s: unable to find ARM glue '%s' for `%s'"
-msgstr ""
-
-#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999
-#, c-format
-msgid "%s(%s): warning: interworking not enabled."
-msgstr ""
-
-#: coff-arm.c:1398 elf32-arm.h:1002
-#, c-format
-msgid " first occurrence: %s: arm call to thumb"
-msgstr ""
-
-#: coff-arm.c:1493 elf32-arm.h:895
-#, c-format
-msgid " first occurrence: %s: thumb call to arm"
-msgstr ""
-
-#: coff-arm.c:1496
-msgid " consider relinking with --support-old-code enabled"
-msgstr ""
-
-#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038
-#, c-format
-msgid "%s: bad reloc address 0x%lx in section `%s'"
-msgstr ""
-
-#: coff-arm.c:2132
-#, c-format
-msgid "%s: illegal symbol index in reloc: %d"
-msgstr ""
-
-#: coff-arm.c:2265
-#, c-format
-msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d"
-msgstr ""
-
-#: coff-arm.c:2280 elf32-arm.h:2328
-#, c-format
-msgid ""
-"ERROR: %s passes floats in float registers, whereas %s passes them in "
-"integer registers"
-msgstr ""
-
-#: coff-arm.c:2283 elf32-arm.h:2333
-#, c-format
-msgid ""
-"ERROR: %s passes floats in integer registers, whereas %s passes them in "
-"float registers"
-msgstr ""
-
-#: coff-arm.c:2298
-#, c-format
-msgid ""
-"ERROR: %s is compiled as position independent code, whereas target %s is "
-"absolute position"
-msgstr ""
-
-#: coff-arm.c:2301
-#, c-format
-msgid ""
-"ERROR: %s is compiled as absolute position code, whereas target %s is "
-"position independent"
-msgstr ""
-
-#: coff-arm.c:2330 elf32-arm.h:2405
-#, c-format
-msgid "Warning: %s supports interworking, whereas %s does not"
-msgstr ""
-
-#: coff-arm.c:2333 elf32-arm.h:2412
-#, c-format
-msgid "Warning: %s does not support interworking, whereas %s does"
-msgstr ""
-
-#: coff-arm.c:2360
-#, c-format
-msgid "private flags = %x:"
-msgstr ""
-
-#: coff-arm.c:2368 elf32-arm.h:2467
-msgid " [floats passed in float registers]"
-msgstr ""
-
-#: coff-arm.c:2370
-msgid " [floats passed in integer registers]"
-msgstr ""
-
-#: coff-arm.c:2373 elf32-arm.h:2470
-msgid " [position independent]"
-msgstr ""
-
-#: coff-arm.c:2375
-msgid " [absolute position]"
-msgstr ""
-
-#: coff-arm.c:2379
-msgid " [interworking flag not initialised]"
-msgstr ""
-
-#: coff-arm.c:2381
-msgid " [interworking supported]"
-msgstr ""
-
-#: coff-arm.c:2383
-msgid " [interworking not supported]"
-msgstr ""
-
-#: coff-arm.c:2431 elf32-arm.h:2150
-#, c-format
-msgid ""
-"Warning: Not setting interworking flag of %s since it has already been "
-"specified as non-interworking"
-msgstr ""
-
-#: coff-arm.c:2435 elf32-arm.h:2154
-#, c-format
-msgid "Warning: Clearing the interworking flag of %s due to outside request"
-msgstr ""
-
-#: coffcode.h:1108
-#, c-format
-msgid "%s (%s): Section flag %s (0x%x) ignored"
-msgstr ""
-
-#: coffcode.h:2214
-#, c-format
-msgid "Unrecognized TI COFF target id '0x%x'"
-msgstr ""
-
-#: coffcode.h:4439
-#, c-format
-msgid "%s: warning: illegal symbol index %ld in line numbers"
-msgstr ""
-
-#: coffcode.h:4453
-#, c-format
-msgid "%s: warning: duplicate line number information for `%s'"
-msgstr ""
-
-#: coffcode.h:4807
-#, c-format
-msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
-msgstr ""
-
-#: coffcode.h:4940
-#, c-format
-msgid "warning: %s: local symbol `%s' has no section"
-msgstr ""
-
-#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5047
-#, c-format
-msgid "%s: warning: illegal symbol index %ld in relocs"
-msgstr ""
-
-#: coffcode.h:5085
-#, c-format
-msgid "%s: illegal relocation type %d at address 0x%lx"
-msgstr ""
-
-#: coffgen.c:1666
-#, c-format
-msgid "%s: bad string table size %lu"
-msgstr ""
-
-#: coff-h8300.c:1047
-#, c-format
-msgid "cannot handle R_MEM_INDIRECT reloc when using %s output"
-msgstr ""
-
-#: coff-i960.c:137 coff-i960.c:486
-msgid "uncertain calling convention for non-COFF symbol"
-msgstr ""
-
-#: cofflink.c:538 elflink.h:1276
-#, c-format
-msgid "Warning: type of symbol `%s' changed from %d to %d in %s"
-msgstr ""
-
-#: cofflink.c:2328
-#, c-format
-msgid "%s: relocs in section `%s', but it has no contents"
-msgstr ""
-
-#: cofflink.c:2671 coffswap.h:890
-#, c-format
-msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
-msgstr ""
-
-#: cofflink.c:2680 coffswap.h:876
-#, c-format
-msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
-msgstr ""
-
-#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783
-msgid "unsupported reloc type"
-msgstr ""
-
-#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554
-msgid "GP relative relocation when _gp not defined"
-msgstr ""
-
-#. No other sections should appear in -membedded-pic
-#. code.
-#: coff-mips.c:2431
-msgid "reloc against unsupported section"
-msgstr ""
-
-#: coff-mips.c:2439
-msgid "reloc not properly aligned"
-msgstr ""
-
-#: coff-rs6000.c:2790
-#, c-format
-msgid "%s: unsupported relocation type 0x%02x"
-msgstr ""
-
-#: coff-rs6000.c:2883
-#, c-format
-msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
-msgstr ""
-
-#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450
-#, c-format
-msgid "Unrecognized reloc type 0x%x"
-msgstr ""
-
-#: coff-w65.c:364
-#, c-format
-msgid "ignoring reloc %s\n"
-msgstr ""
-
-#: cpu-arm.c:196 cpu-arm.c:206
-#, c-format
-msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"
-msgstr ""
-
-#: cpu-arm.c:344
-#, c-format
-msgid "warning: unable to update contents of %s section in %s"
-msgstr ""
-
-#: dwarf2.c:380
-msgid "Dwarf Error: Can't find .debug_str section."
-msgstr ""
-
-#: dwarf2.c:397
-#, c-format
-msgid ""
-"Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str "
-"size (%lu)."
-msgstr ""
-
-#: dwarf2.c:541
-msgid "Dwarf Error: Can't find .debug_abbrev section."
-msgstr ""
-
-#: dwarf2.c:556
-#, c-format
-msgid ""
-"Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size "
-"(%lu)."
-msgstr ""
-
-#: dwarf2.c:756
-#, c-format
-msgid "Dwarf Error: Invalid or unhandled FORM value: %u."
-msgstr ""
-
-#: dwarf2.c:933
-msgid "Dwarf Error: mangled line number section (bad file number)."
-msgstr ""
-
-#: dwarf2.c:1032
-msgid "Dwarf Error: Can't find .debug_line section."
-msgstr ""
-
-#: dwarf2.c:1049
-#, c-format
-msgid ""
-"Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%"
-"lu)."
-msgstr ""
-
-#: dwarf2.c:1255
-msgid "Dwarf Error: mangled line number section."
-msgstr ""
-
-#: dwarf2.c:1470 dwarf2.c:1620
-#, c-format
-msgid "Dwarf Error: Could not find abbrev number %u."
-msgstr ""
-
-#: dwarf2.c:1581
-#, c-format
-msgid ""
-"Dwarf Error: found dwarf version '%u', this reader only handles version 2 "
-"information."
-msgstr ""
-
-#: dwarf2.c:1588
-#, c-format
-msgid ""
-"Dwarf Error: found address size '%u', this reader can not handle sizes "
-"greater than '%u'."
-msgstr ""
-
-#: dwarf2.c:1611
-#, c-format
-msgid "Dwarf Error: Bad abbrev number: %u."
-msgstr ""
-
-#: ecoff.c:1339
-#, c-format
-msgid "Unknown basic type %d"
-msgstr ""
-
-#: ecoff.c:1599
-#, c-format
-msgid ""
-"\n"
-" End+1 symbol: %ld"
-msgstr ""
-
-#: ecoff.c:1606 ecoff.c:1609
-#, c-format
-msgid ""
-"\n"
-" First symbol: %ld"
-msgstr ""
-
-#: ecoff.c:1621
-#, c-format
-msgid ""
-"\n"
-" End+1 symbol: %-7ld Type: %s"
-msgstr ""
-
-#: ecoff.c:1628
-#, c-format
-msgid ""
-"\n"
-" Local symbol: %ld"
-msgstr ""
-
-#: ecoff.c:1636
-#, c-format
-msgid ""
-"\n"
-" struct; End+1 symbol: %ld"
-msgstr ""
-
-#: ecoff.c:1641
-#, c-format
-msgid ""
-"\n"
-" union; End+1 symbol: %ld"
-msgstr ""
-
-#: ecoff.c:1646
-#, c-format
-msgid ""
-"\n"
-" enum; End+1 symbol: %ld"
-msgstr ""
-
-#: ecoff.c:1652
-#, c-format
-msgid ""
-"\n"
-" Type: %s"
-msgstr ""
-
-#: elf32-arm.h:1228
-#, c-format
-msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'."
-msgstr ""
-
-#: elf32-arm.h:1424
-#, c-format
-msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'."
-msgstr ""
-
-#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613
-#, c-format
-msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section"
-msgstr ""
-
-#: elf32-arm.h:2012
-#, c-format
-msgid ""
-"%s: warning: unresolvable relocation %d against symbol `%s' from %s section"
-msgstr ""
-
-#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812
-#: elf32-cris.c:1390 elf32-d10v.c:482 elf32-fr30.c:634 elf32-frv.c:815
-#: elf32-h8300.c:509 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699
-#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510
-#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976
-#: elf64-mmix.c:1332
-msgid "internal error: out of range error"
-msgstr ""
-
-#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816
-#: elf32-cris.c:1394 elf32-d10v.c:486 elf32-fr30.c:638 elf32-frv.c:819
-#: elf32-h8300.c:513 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287
-#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440
-#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452
-msgid "internal error: unsupported relocation error"
-msgstr ""
-
-#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:490
-#: elf32-h8300.c:517 elf32-m32r.c:1291 elf32-m68hc1x.c:1313
-msgid "internal error: dangerous error"
-msgstr ""
-
-#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824
-#: elf32-cris.c:1402 elf32-d10v.c:494 elf32-fr30.c:646 elf32-frv.c:827
-#: elf32-h8300.c:521 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711
-#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522
-#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988
-#: elf64-mmix.c:1344
-msgid "internal error: unknown error"
-msgstr ""
-
-#: elf32-arm.h:2202
-#, c-format
-msgid ""
-"Warning: Clearing the interworking flag of %s because non-interworking code "
-"in %s has been linked with it"
-msgstr ""
-
-#: elf32-arm.h:2302
-#, c-format
-msgid ""
-"ERROR: %s is compiled for EABI version %d, whereas %s is compiled for "
-"version %d"
-msgstr ""
-
-#: elf32-arm.h:2316
-#, c-format
-msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"
-msgstr ""
-
-#: elf32-arm.h:2344
-#, c-format
-msgid "ERROR: %s uses VFP instructions, whereas %s does not"
-msgstr ""
-
-#: elf32-arm.h:2349
-#, c-format
-msgid "ERROR: %s uses FPA instructions, whereas %s does not"
-msgstr ""
-
-#: elf32-arm.h:2360 elf32-arm.h:2365
-#, c-format
-msgid "ERROR: %s uses Maverick instructions, whereas %s does not"
-msgstr ""
-
-#: elf32-arm.h:2385
-#, c-format
-msgid "ERROR: %s uses software FP, whereas %s uses hardware FP"
-msgstr ""
-
-#: elf32-arm.h:2390
-#, c-format
-msgid "ERROR: %s uses hardware FP, whereas %s uses software FP"
-msgstr ""
-
-#. Ignore init flag - it may not be set, despite the flags field
-#. containing valid data.
-#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397
-#: elf32-vax.c:546 elfxx-mips.c:9240
-#, c-format
-msgid "private flags = %lx:"
-msgstr ""
-
-#: elf32-arm.h:2452
-msgid " [interworking enabled]"
-msgstr ""
-
-#: elf32-arm.h:2460
-msgid " [VFP float format]"
-msgstr ""
-
-#: elf32-arm.h:2462
-msgid " [Maverick float format]"
-msgstr ""
-
-#: elf32-arm.h:2464
-msgid " [FPA float format]"
-msgstr ""
-
-#: elf32-arm.h:2473
-msgid " [new ABI]"
-msgstr ""
-
-#: elf32-arm.h:2476
-msgid " [old ABI]"
-msgstr ""
-
-#: elf32-arm.h:2479
-msgid " [software FP]"
-msgstr ""
-
-#: elf32-arm.h:2488
-msgid " [Version1 EABI]"
-msgstr ""
-
-#: elf32-arm.h:2491 elf32-arm.h:2502
-msgid " [sorted symbol table]"
-msgstr ""
-
-#: elf32-arm.h:2493 elf32-arm.h:2504
-msgid " [unsorted symbol table]"
-msgstr ""
-
-#: elf32-arm.h:2499
-msgid " [Version2 EABI]"
-msgstr ""
-
-#: elf32-arm.h:2507
-msgid " [dynamic symbols use segment index]"
-msgstr ""
-
-#: elf32-arm.h:2510
-msgid " [mapping symbols precede others]"
-msgstr ""
-
-#: elf32-arm.h:2517
-msgid " <EABI version unrecognised>"
-msgstr ""
-
-#: elf32-arm.h:2524
-msgid " [relocatable executable]"
-msgstr ""
-
-#: elf32-arm.h:2527
-msgid " [has entry point]"
-msgstr ""
-
-#: elf32-arm.h:2532
-msgid "<Unrecognised flag bits set>"
-msgstr ""
-
-#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823
-#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518
-#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984
-#: elf64-mmix.c:1340
-msgid "internal error: dangerous relocation"
-msgstr ""
-
-#: elf32-cris.c:931
-#, c-format
-msgid "%s: unresolvable relocation %s against symbol `%s' from %s section"
-msgstr ""
-
-#: elf32-cris.c:993
-#, c-format
-msgid ""
-"%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section"
-msgstr ""
-
-#: elf32-cris.c:996 elf32-cris.c:1122
-msgid "[whose name is lost]"
-msgstr ""
-
-#: elf32-cris.c:1111
-#, c-format
-msgid ""
-"%s: relocation %s with non-zero addend %d against local symbol from %s "
-"section"
-msgstr ""
-
-#: elf32-cris.c:1118
-#, c-format
-msgid ""
-"%s: relocation %s with non-zero addend %d against symbol `%s' from %s section"
-msgstr ""
-
-#: elf32-cris.c:1143
-#, c-format
-msgid ""
-"%s: relocation %s is not allowed for global symbol: `%s' from %s section"
-msgstr ""
-
-#: elf32-cris.c:1158
-#, c-format
-msgid "%s: relocation %s in section %s with no GOT created"
-msgstr ""
-
-#: elf32-cris.c:1277
-#, c-format
-msgid "%s: Internal inconsistency; no relocation section %s"
-msgstr ""
-
-#: elf32-cris.c:2500
-#, c-format
-msgid ""
-"%s, section %s:\n"
-" relocation %s should not be used in a shared object; recompile with -fPIC"
-msgstr ""
-
-#: elf32-cris.c:2978
-msgid " [symbols have a _ prefix]"
-msgstr ""
-
-#: elf32-cris.c:3017
-#, c-format
-msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols"
-msgstr ""
-
-#: elf32-cris.c:3018
-#, c-format
-msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"
-msgstr ""
-
-#: elf32-frv.c:1223
-#, c-format
-msgid ""
-"%s: compiled with %s and linked with modules that use non-pic relocations"
-msgstr ""
-
-#: elf32-frv.c:1273 elf32-iq2000.c:895
-#, c-format
-msgid "%s: compiled with %s and linked with modules compiled with %s"
-msgstr ""
-
-#: elf32-frv.c:1285
-#, c-format
-msgid ""
-"%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%"
-"lx)"
-msgstr ""
-
-#: elf32-frv.c:1321 elf32-iq2000.c:933
-#, c-format
-msgid "private flags = 0x%lx:"
-msgstr ""
-
-#: elf32-gen.c:83 elf64-gen.c:82
-#, c-format
-msgid "%s: Relocations in generic ELF (EM: %d)"
-msgstr ""
-
-#: elf32-hppa.c:672 elf32-m68hc1x.c:176 elf64-ppc.c:3118
-#, c-format
-msgid "%s: cannot create stub entry %s"
-msgstr ""
-
-#: elf32-hppa.c:957 elf32-hppa.c:3538
-#, c-format
-msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"
-msgstr ""
-
-#: elf32-hppa.c:1340 elf64-x86-64.c:672 elf64-x86-64.c:797
-#, c-format
-msgid ""
-"%s: relocation %s can not be used when making a shared object; recompile "
-"with -fPIC"
-msgstr ""
-
-#: elf32-hppa.c:1360
-#, c-format
-msgid ""
-"%s: relocation %s should not be used when making a shared object; recompile "
-"with -fPIC"
-msgstr ""
-
-#: elf32-hppa.c:1553
-#, c-format
-msgid "Could not find relocation section for %s"
-msgstr ""
-
-#: elf32-hppa.c:2828
-#, c-format
-msgid "%s: duplicate export stub %s"
-msgstr ""
-
-#: elf32-hppa.c:3416
-#, c-format
-msgid "%s(%s+0x%lx): fixing %s"
-msgstr ""
-
-#: elf32-hppa.c:4039
-#, c-format
-msgid "%s(%s+0x%lx): cannot handle %s for %s"
-msgstr ""
-
-#: elf32-hppa.c:4357
-msgid ".got section not immediately after .plt section"
-msgstr ""
-
-#: elf32-i386.c:326
-#, c-format
-msgid "%s: invalid relocation type %d"
-msgstr ""
-
-#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637
-#: elf64-s390.c:943 elf64-x86-64.c:650
-#, c-format
-msgid "%s: bad symbol index: %d"
-msgstr ""
-
-#: elf32-i386.c:949 elf32-s390.c:1168 elf32-sh.c:6426 elf32-sparc.c:1011
-#: elf64-s390.c:1129
-#, c-format
-msgid "%s: `%s' accessed both as normal and thread local symbol"
-msgstr ""
-
-#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243
-#: elf64-x86-64.c:886
-#, c-format
-msgid "%s: bad relocation section name `%s'"
-msgstr ""
-
-#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879
-#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664
-#: elf64-x86-64.c:2452
-#, c-format
-msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'"
-msgstr ""
-
-#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068
-#: elf64-x86-64.c:2490
-#, c-format
-msgid "%s(%s+0x%lx): reloc against `%s': error %d"
-msgstr ""
-
-#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740
-msgid ""
-"ip2k relaxer: switch table without complete matching relocation information."
-msgstr ""
-
-#: elf32-ip2k.c:588 elf32-ip2k.c:767
-msgid "ip2k relaxer: switch table header corrupt."
-msgstr ""
-
-#: elf32-ip2k.c:1395
-#, c-format
-msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)."
-msgstr ""
-
-#: elf32-ip2k.c:1409
-#, c-format
-msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)."
-msgstr ""
-
-#. Only if it's not an unresolved symbol.
-#: elf32-ip2k.c:1593
-msgid "unsupported relocation between data/insn address spaces"
-msgstr ""
-
-#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072
-#: elfxx-mips.c:9197
-#, c-format
-msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
-msgstr ""
-
-#: elf32-m32r.c:930
-msgid "SDA relocation when _SDA_BASE_ not defined"
-msgstr ""
-
-#: elf32-ia64.c:3817 elf32-m32r.c:1018 elf64-alpha.c:4279 elf64-alpha.c:4407
-#: elf64-ia64.c:3817
-#, c-format
-msgid "%s: unknown relocation type %d"
-msgstr ""
-
-#: elf32-m32r.c:1226
-#, c-format
-msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)"
-msgstr ""
-
-#: elf32-m32r.c:1952
-#, c-format
-msgid "%s: Instruction set mismatch with previous modules"
-msgstr ""
-
-#: elf32-m32r.c:1975
-#, c-format
-msgid "private flags = %lx"
-msgstr ""
-
-#: elf32-m32r.c:1980
-msgid ": m32r instructions"
-msgstr ""
-
-#: elf32-m32r.c:1981
-msgid ": m32rx instructions"
-msgstr ""
-
-#: elf32-m68hc1x.c:1217
-#, c-format
-msgid ""
-"Reference to the far symbol `%s' using a wrong relocation may result in "
-"incorrect execution"
-msgstr ""
-
-#: elf32-m68hc1x.c:1240
-#, c-format
-msgid ""
-"banked address [%lx:%04lx] (%lx) is not in the same bank as current banked "
-"address [%lx:%04lx] (%lx)"
-msgstr ""
-
-#: elf32-m68hc1x.c:1259
-#, c-format
-msgid ""
-"reference to a banked address [%lx:%04lx] in the normal address space at %"
-"04lx"
-msgstr ""
-
-#: elf32-m68hc1x.c:1396
-#, c-format
-msgid ""
-"%s: linking files compiled for 16-bit integers (-mshort) and others for 32-"
-"bit integers"
-msgstr ""
-
-#: elf32-m68hc1x.c:1404
-#, c-format
-msgid ""
-"%s: linking files compiled for 32-bit double (-fshort-double) and others for "
-"64-bit double"
-msgstr ""
-
-#: elf32-m68hc1x.c:1414
-#, c-format
-msgid "%s: linking files compiled for HCS12 with others compiled for HC12"
-msgstr ""
-
-#: elf32-m68hc1x.c:1462
-msgid "[abi=32-bit int, "
-msgstr ""
-
-#: elf32-m68hc1x.c:1464
-msgid "[abi=16-bit int, "
-msgstr ""
-
-#: elf32-m68hc1x.c:1467
-msgid "64-bit double, "
-msgstr ""
-
-#: elf32-m68hc1x.c:1469
-msgid "32-bit double, "
-msgstr ""
-
-#: elf32-m68hc1x.c:1472
-msgid "cpu=HC11]"
-msgstr ""
-
-#: elf32-m68hc1x.c:1474
-msgid "cpu=HCS12]"
-msgstr ""
-
-#: elf32-m68hc1x.c:1476
-msgid "cpu=HC12]"
-msgstr ""
-
-#: elf32-m68hc1x.c:1479
-msgid " [memory=bank-model]"
-msgstr ""
-
-#: elf32-m68hc1x.c:1481
-msgid " [memory=flat]"
-msgstr ""
-
-#: elf32-m68k.c:400
-msgid " [cpu32]"
-msgstr ""
-
-#: elf32-m68k.c:403
-msgid " [m68000]"
-msgstr ""
-
-#: elf32-mcore.c:353 elf32-mcore.c:456
-#, c-format
-msgid "%s: Relocation %s (%d) is not currently supported.\n"
-msgstr ""
-
-#: elf32-mcore.c:441
-#, c-format
-msgid "%s: Unknown relocation type %d\n"
-msgstr ""
-
-#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664
-msgid "32bits gp relative relocation occurs for an external symbol"
-msgstr ""
-
-#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783
-#, c-format
-msgid "Linking mips16 objects into %s format is not supported"
-msgstr ""
-
-#: elf32-ppc.c:2056
-#, c-format
-msgid "generic linker can't handle %s"
-msgstr ""
-
-#: elf32-ppc.c:2138
-#, c-format
-msgid ""
-"%s: compiled with -mrelocatable and linked with modules compiled normally"
-msgstr ""
-
-#: elf32-ppc.c:2147
-#, c-format
-msgid ""
-"%s: compiled normally and linked with modules compiled with -mrelocatable"
-msgstr ""
-
-#: elf32-ppc.c:3413
-#, c-format
-msgid "%s: relocation %s cannot be used when making a shared object"
-msgstr ""
-
-#. It does not make sense to have a procedure linkage
-#. table entry for a local symbol.
-#: elf32-ppc.c:3619
-#, c-format
-msgid "%s(%s+0x%lx): %s reloc against local symbol"
-msgstr ""
-
-#: elf32-ppc.c:4862 elf64-ppc.c:7789
-#, c-format
-msgid "%s: unknown relocation type %d for symbol %s"
-msgstr ""
-
-#: elf32-ppc.c:5113
-#, c-format
-msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"
-msgstr ""
-
-#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484
-#, c-format
-msgid ""
-"%s: the target (%s) of a %s relocation is in the wrong output section (%s)"
-msgstr ""
-
-#: elf32-ppc.c:5539
-#, c-format
-msgid "%s: relocation %s is not yet supported for symbol %s."
-msgstr ""
-
-#: elf32-ppc.c:5594 elf64-ppc.c:8461
-#, c-format
-msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"
-msgstr ""
-
-#: elf32-ppc.c:5644 elf64-ppc.c:8507
-#, c-format
-msgid "%s(%s+0x%lx): %s reloc against `%s': error %d"
-msgstr ""
-
-#: elf32-ppc.c:5888
-#, c-format
-msgid "corrupt or empty %s section in %s"
-msgstr ""
-
-#: elf32-ppc.c:5895
-#, c-format
-msgid "unable to read in %s section from %s"
-msgstr ""
-
-#: elf32-ppc.c:5901
-#, c-format
-msgid "corrupt %s section in %s"
-msgstr ""
-
-#: elf32-ppc.c:5944
-#, c-format
-msgid "warning: unable to set size of %s section in %s"
-msgstr ""
-
-#: elf32-ppc.c:5994
-msgid "failed to allocate space for new APUinfo section."
-msgstr ""
-
-#: elf32-ppc.c:6013
-msgid "failed to compute new APUinfo section."
-msgstr ""
-
-#: elf32-ppc.c:6016
-msgid "failed to install new APUinfo section."
-msgstr ""
-
-#: elf32-s390.c:2256 elf64-s390.c:2226
-#, c-format
-msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s"
-msgstr ""
-
-#: elf32-sh64.c:221 elf64-sh64.c:2407
-#, c-format
-msgid "%s: compiled as 32-bit object and %s is 64-bit"
-msgstr ""
-
-#: elf32-sh64.c:224 elf64-sh64.c:2410
-#, c-format
-msgid "%s: compiled as 64-bit object and %s is 32-bit"
-msgstr ""
-
-#: elf32-sh64.c:226 elf64-sh64.c:2412
-#, c-format
-msgid "%s: object size does not match that of target %s"
-msgstr ""
-
-#: elf32-sh64.c:461 elf64-sh64.c:2990
-#, c-format
-msgid "%s: encountered datalabel symbol in input"
-msgstr ""
-
-#: elf32-sh64.c:544
-msgid "PTB mismatch: a SHmedia address (bit 0 == 1)"
-msgstr ""
-
-#: elf32-sh64.c:547
-msgid "PTA mismatch: a SHcompact address (bit 0 == 0)"
-msgstr ""
-
-#: elf32-sh64.c:565
-#, c-format
-msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16"
-msgstr ""
-
-#: elf32-sh64.c:614 elf64-sh64.c:1748
-#, c-format
-msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n"
-msgstr ""
-
-#: elf32-sh64.c:698
-#, c-format
-msgid "%s: could not write out added .cranges entries"
-msgstr ""
-
-#: elf32-sh64.c:760
-#, c-format
-msgid "%s: could not write out sorted .cranges entries"
-msgstr ""
-
-#: elf32-sh.c:2103
-#, c-format
-msgid "%s: 0x%lx: warning: bad R_SH_USES offset"
-msgstr ""
-
-#: elf32-sh.c:2115
-#, c-format
-msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"
-msgstr ""
-
-#: elf32-sh.c:2132
-#, c-format
-msgid "%s: 0x%lx: warning: bad R_SH_USES load offset"
-msgstr ""
-
-#: elf32-sh.c:2147
-#, c-format
-msgid "%s: 0x%lx: warning: could not find expected reloc"
-msgstr ""
-
-#: elf32-sh.c:2175
-#, c-format
-msgid "%s: 0x%lx: warning: symbol in unexpected section"
-msgstr ""
-
-#: elf32-sh.c:2300
-#, c-format
-msgid "%s: 0x%lx: warning: could not find expected COUNT reloc"
-msgstr ""
-
-#: elf32-sh.c:2309
-#, c-format
-msgid "%s: 0x%lx: warning: bad count"
-msgstr ""
-
-#: elf32-sh.c:2712 elf32-sh.c:3088
-#, c-format
-msgid "%s: 0x%lx: fatal: reloc overflow while relaxing"
-msgstr ""
-
-#: elf32-sh.c:4654 elf64-sh64.c:1585
-msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled"
-msgstr ""
-
-#: elf32-sh.c:4809
-#, c-format
-msgid "%s: unresolvable relocation against symbol `%s' from %s section"
-msgstr ""
-
-#: elf32-sh.c:4881
-#, c-format
-msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"
-msgstr ""
-
-#: elf32-sh.c:6627 elf64-alpha.c:4848
-#, c-format
-msgid "%s: TLS local exec code cannot be linked into shared objects"
-msgstr ""
-
-#: elf32-sparc.c:2521 elf64-sparc.c:2314
-#, c-format
-msgid "%s: probably compiled without -fPIC?"
-msgstr ""
-
-#: elf32-sparc.c:3348
-#, c-format
-msgid "%s: compiled for a 64 bit system and target is 32 bit"
-msgstr ""
-
-#: elf32-sparc.c:3362
-#, c-format
-msgid "%s: linking little endian files with big endian files"
-msgstr ""
-
-#: elf32-v850.c:753
-#, c-format
-msgid "Variable `%s' cannot occupy in multiple small data regions"
-msgstr ""
-
-#: elf32-v850.c:756
-#, c-format
-msgid ""
-"Variable `%s' can only be in one of the small, zero, and tiny data regions"
-msgstr ""
-
-#: elf32-v850.c:759
-#, c-format
-msgid ""
-"Variable `%s' cannot be in both small and zero data regions simultaneously"
-msgstr ""
-
-#: elf32-v850.c:762
-#, c-format
-msgid ""
-"Variable `%s' cannot be in both small and tiny data regions simultaneously"
-msgstr ""
-
-#: elf32-v850.c:765
-#, c-format
-msgid ""
-"Variable `%s' cannot be in both zero and tiny data regions simultaneously"
-msgstr ""
-
-#: elf32-v850.c:1144
-msgid "FAILED to find previous HI16 reloc\n"
-msgstr ""
-
-#: elf32-v850.c:1789
-msgid "could not locate special linker symbol __gp"
-msgstr ""
-
-#: elf32-v850.c:1793
-msgid "could not locate special linker symbol __ep"
-msgstr ""
-
-#: elf32-v850.c:1797
-msgid "could not locate special linker symbol __ctbp"
-msgstr ""
-
-#: elf32-v850.c:1963
-#, c-format
-msgid "%s: Architecture mismatch with previous modules"
-msgstr ""
-
-#: elf32-v850.c:1983
-#, c-format
-msgid "private flags = %lx: "
-msgstr ""
-
-#: elf32-v850.c:1988
-msgid "v850 architecture"
-msgstr ""
-
-#: elf32-v850.c:1989
-msgid "v850e architecture"
-msgstr ""
-
-#: elf32-vax.c:549
-msgid " [nonpic]"
-msgstr ""
-
-#: elf32-vax.c:552
-msgid " [d-float]"
-msgstr ""
-
-#: elf32-vax.c:555
-msgid " [g-float]"
-msgstr ""
-
-#: elf32-vax.c:663
-#, c-format
-msgid ""
-"%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of "
-"%ld"
-msgstr ""
-
-#: elf32-vax.c:1667
-#, c-format
-msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored"
-msgstr ""
-
-#: elf32-vax.c:1802
-#, c-format
-msgid "%s: warning: %s relocation against symbol `%s' from %s section"
-msgstr ""
-
-#: elf32-vax.c:1808
-#, c-format
-msgid "%s: warning: %s relocation to 0x%x from %s section"
-msgstr ""
-
-#: elf32-ia64.c:2326 elf32-xstormy16.c:462 elf64-ia64.c:2326
-msgid "non-zero addend in @fptr reloc"
-msgstr ""
-
-#: elf64-alpha.c:1108
-msgid "GPDISP relocation did not find ldah and lda instructions"
-msgstr ""
-
-#: elf64-alpha.c:3731
-#, c-format
-msgid "%s: .got subsegment exceeds 64K (size %d)"
-msgstr ""
-
-#: elf64-alpha.c:4602 elf64-alpha.c:4614
-#, c-format
-msgid "%s: gp-relative relocation against dynamic symbol %s"
-msgstr ""
-
-#: elf64-alpha.c:4640 elf64-alpha.c:4773
-#, c-format
-msgid "%s: pc-relative relocation against dynamic symbol %s"
-msgstr ""
-
-#: elf64-alpha.c:4668
-#, c-format
-msgid "%s: change in gp: BRSGP %s"
-msgstr ""
-
-#: elf64-alpha.c:4693
-msgid "<unknown>"
-msgstr ""
-
-#: elf64-alpha.c:4698
-#, c-format
-msgid "%s: !samegp reloc against symbol without .prologue: %s"
-msgstr ""
-
-#: elf64-alpha.c:4749
-#, c-format
-msgid "%s: unhandled dynamic relocation against %s"
-msgstr ""
-
-#: elf64-alpha.c:4832
-#, c-format
-msgid "%s: dtp-relative relocation against dynamic symbol %s"
-msgstr ""
-
-#: elf64-alpha.c:4855
-#, c-format
-msgid "%s: tp-relative relocation against dynamic symbol %s"
-msgstr ""
-
-#: elf64-hppa.c:2086
-#, c-format
-msgid "stub entry for %s cannot load .plt, dp offset = %ld"
-msgstr ""
-
-#: elf64-mmix.c:1032
-#, c-format
-msgid ""
-"%s: Internal inconsistency error for value for\n"
-" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%"
-"08lx\n"
-msgstr ""
-
-#: elf64-mmix.c:1416
-#, c-format
-msgid ""
-"%s: base-plus-offset relocation against register symbol: (unknown) in %s"
-msgstr ""
-
-#: elf64-mmix.c:1421
-#, c-format
-msgid "%s: base-plus-offset relocation against register symbol: %s in %s"
-msgstr ""
-
-#: elf64-mmix.c:1465
-#, c-format
-msgid "%s: register relocation against non-register symbol: (unknown) in %s"
-msgstr ""
-
-#: elf64-mmix.c:1470
-#, c-format
-msgid "%s: register relocation against non-register symbol: %s in %s"
-msgstr ""
-
-#: elf64-mmix.c:1507
-#, c-format
-msgid "%s: directive LOCAL valid only with a register or absolute value"
-msgstr ""
-
-#: elf64-mmix.c:1535
-#, c-format
-msgid ""
-"%s: LOCAL directive: Register $%ld is not a local register. First global "
-"register is $%ld."
-msgstr ""
-
-#: elf64-mmix.c:1994
-#, c-format
-msgid ""
-"%s: Error: multiple definition of `%s'; start of %s is set in a earlier "
-"linked file\n"
-msgstr ""
-
-#: elf64-mmix.c:2053
-msgid "Register section has contents\n"
-msgstr ""
-
-#: elf64-mmix.c:2216
-#, c-format
-msgid ""
-"Internal inconsistency: remaining %u != max %u.\n"
-" Please report this bug."
-msgstr ""
-
-#: elf64-ppc.c:2388 libbfd.c:831
-#, c-format
-msgid "%s: compiled for a big endian system and target is little endian"
-msgstr ""
-
-#: elf64-ppc.c:2391 libbfd.c:833
-#, c-format
-msgid "%s: compiled for a little endian system and target is big endian"
-msgstr ""
-
-#: elf64-ppc.c:4857
-#, c-format
-msgid "%s: unexpected reloc type %u in .opd section"
-msgstr ""
-
-#: elf64-ppc.c:4877
-#, c-format
-msgid "%s: .opd is not a regular array of opd entries"
-msgstr ""
-
-#: elf64-ppc.c:4897
-#, c-format
-msgid "%s: undefined sym `%s' in .opd section"
-msgstr ""
-
-#: elf64-ppc.c:6136
-#, c-format
-msgid "can't find branch stub `%s'"
-msgstr ""
-
-#: elf64-ppc.c:6175 elf64-ppc.c:6250
-#, c-format
-msgid "linkage table error against `%s'"
-msgstr ""
-
-#: elf64-ppc.c:6340
-#, c-format
-msgid "can't build branch stub `%s'"
-msgstr ""
-
-#: elf64-ppc.c:7047
-msgid ".glink and .plt too far apart"
-msgstr ""
-
-#: elf64-ppc.c:7135
-msgid "stubs don't match calculated size"
-msgstr ""
-
-#: elf64-ppc.c:7147
-#, c-format
-msgid ""
-"linker stubs in %u groups\n"
-" branch %lu\n"
-" toc adjust %lu\n"
-" long branch %lu\n"
-" long toc adj %lu\n"
-" plt call %lu"
-msgstr ""
-
-#: elf64-ppc.c:7723
-#, c-format
-msgid ""
-"%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; "
-"recompile with -mminimal-toc or upgrade gcc"
-msgstr ""
-
-#: elf64-ppc.c:7731
-#, c-format
-msgid ""
-"%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic "
-"multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, "
-"or make `%s' extern"
-msgstr ""
-
-#: elf64-ppc.c:8329
-#, c-format
-msgid "%s: relocation %s is not supported for symbol %s."
-msgstr ""
-
-#: elf64-ppc.c:8408
-#, c-format
-msgid "%s: error: relocation %s not a multiple of %d"
-msgstr ""
-
-#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704
-#, c-format
-msgid ""
-"%s: warning: unresolvable relocation against symbol `%s' from %s section"
-msgstr ""
-
-#: elf64-sparc.c:1370
-#, c-format
-msgid "%s: check_relocs: unhandled reloc type %d"
-msgstr ""
-
-#: elf64-sparc.c:1407
-#, c-format
-msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER"
-msgstr ""
-
-#: elf64-sparc.c:1427
-#, c-format
-msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s"
-msgstr ""
-
-#: elf64-sparc.c:1450
-#, c-format
-msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"
-msgstr ""
-
-#: elf64-sparc.c:1496
-#, c-format
-msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"
-msgstr ""
-
-#: elf64-sparc.c:3053
-#, c-format
-msgid "%s: linking UltraSPARC specific with HAL specific code"
-msgstr ""
-
-#: elf64-x86-64.c:739
-#, c-format
-msgid "%s: %s' accessed both as normal and thread local symbol"
-msgstr ""
-
-#: elf.c:372
-#, c-format
-msgid "%s: invalid string offset %u >= %lu for section `%s'"
-msgstr ""
-
-#: elf.c:624
-#, c-format
-msgid "%s: invalid SHT_GROUP entry"
-msgstr ""
-
-#: elf.c:695
-#, c-format
-msgid "%s: no group info for section %s"
-msgstr ""
-
-#: elf.c:1055
-msgid ""
-"\n"
-"Program Header:\n"
-msgstr ""
-
-#: elf.c:1106
-msgid ""
-"\n"
-"Dynamic Section:\n"
-msgstr ""
-
-#: elf.c:1235
-msgid ""
-"\n"
-"Version definitions:\n"
-msgstr ""
-
-#: elf.c:1258
-msgid ""
-"\n"
-"Version References:\n"
-msgstr ""
-
-#: elf.c:1263
-#, c-format
-msgid " required from %s:\n"
-msgstr ""
-
-#: elf.c:1944
-#, c-format
-msgid "%s: invalid link %lu for reloc section %s (index %u)"
-msgstr ""
-
-#: elf.c:3686
-#, c-format
-msgid "%s: Not enough room for program headers (allocated %u, need %u)"
-msgstr ""
-
-#: elf.c:3791
-#, c-format
-msgid "%s: Not enough room for program headers, try linking with -N"
-msgstr ""
-
-#: elf.c:3922
-#, c-format
-msgid ""
-"Error: First section in segment (%s) starts at 0x%x whereas the segment "
-"starts at 0x%x"
-msgstr ""
-
-#: elf.c:4242
-#, c-format
-msgid "%s: warning: allocated section `%s' not in segment"
-msgstr ""
-
-#: elf.c:4566
-#, c-format
-msgid "%s: symbol `%s' required but not present"
-msgstr ""
-
-#: elf.c:4854
-#, c-format
-msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n"
-msgstr ""
-
-#: elf.c:5485
-#, c-format
-msgid ""
-"Unable to find equivalent output section for symbol '%s' from section '%s'"
-msgstr ""
-
-#: elf.c:6298
-#, c-format
-msgid "%s: unsupported relocation type %s"
-msgstr ""
-
-#: elfcode.h:1113
-#, c-format
-msgid "%s: version count (%ld) does not match symbol count (%ld)"
-msgstr ""
-
-#: elfcode.h:1342
-#, c-format
-msgid "%s(%s): relocation %d has invalid symbol index %ld"
-msgstr ""
-
-#: elflink.c:1456
-#, c-format
-msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'"
-msgstr ""
-
-#: elflink.c:1807
-#, c-format
-msgid "%s: undefined versioned symbol name %s"
-msgstr ""
-
-#: elflink.c:2142
-#, c-format
-msgid "%s: relocation size mismatch in %s section %s"
-msgstr ""
-
-#: elflink.c:2434
-#, c-format
-msgid "warning: type and size of dynamic symbol `%s' are not defined"
-msgstr ""
-
-#: elflink.h:1022
-#, c-format
-msgid "%s: %s: invalid version %u (max %d)"
-msgstr ""
-
-#: elflink.h:1063
-#, c-format
-msgid "%s: %s: invalid needed version %d"
-msgstr ""
-
-#: elflink.h:1238
-#, c-format
-msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"
-msgstr ""
-
-#: elflink.h:1252
-#, c-format
-msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"
-msgstr ""
-
-#: elflink.h:2160
-#, c-format
-msgid "%s: undefined version: %s"
-msgstr ""
-
-#: elflink.h:2226
-#, c-format
-msgid "%s: .preinit_array section is not allowed in DSO"
-msgstr ""
-
-#: elflink.h:3078
-msgid "Not enough memory to sort relocations"
-msgstr ""
-
-#: elflink.h:3958 elflink.h:4001
-#, c-format
-msgid "%s: could not find output section %s"
-msgstr ""
-
-#: elflink.h:3964
-#, c-format
-msgid "warning: %s section has zero size"
-msgstr ""
-
-#: elflink.h:4483
-#, c-format
-msgid "%s: %s symbol `%s' in %s is referenced by DSO"
-msgstr ""
-
-#: elflink.h:4564
-#, c-format
-msgid "%s: could not find output section %s for input section %s"
-msgstr ""
-
-#: elflink.h:4666
-#, c-format
-msgid "%s: %s symbol `%s' isn't defined"
-msgstr ""
-
-#: elflink.h:5053 elflink.h:5095
-msgid "%T: discarded in section `%s' from %s\n"
-msgstr ""
-
-#: elfxx-mips.c:887
-msgid "static procedure (no name)"
-msgstr ""
-
-#: elfxx-mips.c:1897
-msgid "not enough GOT space for local GOT entries"
-msgstr ""
-
-#: elfxx-mips.c:3691
-#, c-format
-msgid "%s: %s+0x%lx: jump to stub routine which is not jal"
-msgstr ""
-
-#: elfxx-mips.c:5192
-#, c-format
-msgid "%s: Malformed reloc detected for section %s"
-msgstr ""
-
-#: elfxx-mips.c:5266
-#, c-format
-msgid "%s: CALL16 reloc at 0x%lx not against global symbol"
-msgstr ""
-
-#: elfxx-mips.c:8693
-#, c-format
-msgid "%s: illegal section name `%s'"
-msgstr ""
-
-#: elfxx-mips.c:9027
-#, c-format
-msgid "%s: endianness incompatible with that of the selected emulation"
-msgstr ""
-
-#: elfxx-mips.c:9039
-#, c-format
-msgid "%s: ABI is incompatible with that of the selected emulation"
-msgstr ""
-
-#: elfxx-mips.c:9106
-#, c-format
-msgid "%s: warning: linking PIC files with non-PIC files"
-msgstr ""
-
-#: elfxx-mips.c:9123
-#, c-format
-msgid "%s: linking 32-bit code with 64-bit code"
-msgstr ""
-
-#: elfxx-mips.c:9151
-#, c-format
-msgid "%s: linking %s module with previous %s modules"
-msgstr ""
-
-#: elfxx-mips.c:9174
-#, c-format
-msgid "%s: ABI mismatch: linking %s module with previous %s modules"
-msgstr ""
-
-#: elfxx-mips.c:9243
-msgid " [abi=O32]"
-msgstr ""
-
-#: elfxx-mips.c:9245
-msgid " [abi=O64]"
-msgstr ""
-
-#: elfxx-mips.c:9247
-msgid " [abi=EABI32]"
-msgstr ""
-
-#: elfxx-mips.c:9249
-msgid " [abi=EABI64]"
-msgstr ""
-
-#: elfxx-mips.c:9251
-msgid " [abi unknown]"
-msgstr ""
-
-#: elfxx-mips.c:9253
-msgid " [abi=N32]"
-msgstr ""
-
-#: elfxx-mips.c:9255
-msgid " [abi=64]"
-msgstr ""
-
-#: elfxx-mips.c:9257
-msgid " [no abi set]"
-msgstr ""
-
-#: elfxx-mips.c:9260
-msgid " [mips1]"
-msgstr ""
-
-#: elfxx-mips.c:9262
-msgid " [mips2]"
-msgstr ""
-
-#: elfxx-mips.c:9264
-msgid " [mips3]"
-msgstr ""
-
-#: elfxx-mips.c:9266
-msgid " [mips4]"
-msgstr ""
-
-#: elfxx-mips.c:9268
-msgid " [mips5]"
-msgstr ""
-
-#: elfxx-mips.c:9270
-msgid " [mips32]"
-msgstr ""
-
-#: elfxx-mips.c:9272
-msgid " [mips64]"
-msgstr ""
-
-#: elfxx-mips.c:9274
-msgid " [mips32r2]"
-msgstr ""
-
-#: elfxx-mips.c:9276
-msgid " [unknown ISA]"
-msgstr ""
-
-#: elfxx-mips.c:9279
-msgid " [mdmx]"
-msgstr ""
-
-#: elfxx-mips.c:9282
-msgid " [mips16]"
-msgstr ""
-
-#: elfxx-mips.c:9285
-msgid " [32bitmode]"
-msgstr ""
-
-#: elfxx-mips.c:9287
-msgid " [not 32bitmode]"
-msgstr ""
-
-#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458
-#, c-format
-msgid "Output file requires shared library `%s'\n"
-msgstr ""
-
-#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466
-#, c-format
-msgid "Output file requires shared library `%s.so.%s'\n"
-msgstr ""
-
-#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709
-#: sparclinux.c:656 sparclinux.c:706
-#, c-format
-msgid "Symbol %s not defined for fixups\n"
-msgstr ""
-
-#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730
-msgid "Warning: fixup count mismatch\n"
-msgstr ""
-
-#: ieee.c:293
-#, c-format
-msgid "%s: string too long (%d chars, max 65535)"
-msgstr ""
-
-#: ieee.c:428
-#, c-format
-msgid "%s: unrecognized symbol `%s' flags 0x%x"
-msgstr ""
-
-#: ieee.c:938
-#, c-format
-msgid "%s: unimplemented ATI record %u for symbol %u"
-msgstr ""
-
-#: ieee.c:963
-#, c-format
-msgid "%s: unexpected ATN type %d in external part"
-msgstr ""
-
-#: ieee.c:985
-#, c-format
-msgid "%s: unexpected type after ATN"
-msgstr ""
-
-#: ihex.c:264
-#, c-format
-msgid "%s:%d: unexpected character `%s' in Intel Hex file\n"
-msgstr ""
-
-#: ihex.c:372
-#, c-format
-msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"
-msgstr ""
-
-#: ihex.c:426
-#, c-format
-msgid "%s:%u: bad extended address record length in Intel Hex file"
-msgstr ""
-
-#: ihex.c:443
-#, c-format
-msgid "%s:%u: bad extended start address length in Intel Hex file"
-msgstr ""
-
-#: ihex.c:460
-#, c-format
-msgid "%s:%u: bad extended linear address record length in Intel Hex file"
-msgstr ""
-
-#: ihex.c:477
-#, c-format
-msgid "%s:%u: bad extended linear start address length in Intel Hex file"
-msgstr ""
-
-#: ihex.c:494
-#, c-format
-msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n"
-msgstr ""
-
-#: ihex.c:619
-#, c-format
-msgid "%s: internal error in ihex_read_section"
-msgstr ""
-
-#: ihex.c:654
-#, c-format
-msgid "%s: bad section length in ihex_read_section"
-msgstr ""
-
-#: ihex.c:872
-#, c-format
-msgid "%s: address 0x%s out of range for Intel Hex file"
-msgstr ""
-
-#: libbfd.c:861
-#, c-format
-msgid "Deprecated %s called at %s line %d in %s\n"
-msgstr ""
-
-#: libbfd.c:864
-#, c-format
-msgid "Deprecated %s called\n"
-msgstr ""
-
-#: linker.c:1829
-#, c-format
-msgid "%s: indirect symbol `%s' to `%s' is a loop"
-msgstr ""
-
-#: linker.c:2697
-#, c-format
-msgid "Attempt to do relocatable link with %s input and %s output"
-msgstr ""
-
-#: merge.c:896
-#, c-format
-msgid "%s: access beyond end of merged section (%ld + %ld)"
-msgstr ""
-
-#: mmo.c:503
-#, c-format
-msgid "%s: No core to allocate section name %s\n"
-msgstr ""
-
-#: mmo.c:579
-#, c-format
-msgid "%s: No core to allocate a symbol %d bytes long\n"
-msgstr ""
-
-#: mmo.c:1287
-#, c-format
-msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n"
-msgstr ""
-
-#: mmo.c:1433
-#, c-format
-msgid ""
-"%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name "
-"starting with `%s'\n"
-msgstr ""
-
-#: mmo.c:1674
-#, c-format
-msgid "%s: invalid mmo file: unsupported lopcode `%d'\n"
-msgstr ""
-
-#: mmo.c:1684
-#, c-format
-msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n"
-msgstr ""
-
-#: mmo.c:1720
-#, c-format
-msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n"
-msgstr ""
-
-#: mmo.c:1766
-#, c-format
-msgid ""
-"%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n"
-msgstr ""
-
-#: mmo.c:1805
-#, c-format
-msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n"
-msgstr ""
-
-#: mmo.c:1814
-#, c-format
-msgid ""
-"%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n"
-msgstr ""
-
-#: mmo.c:1837
-#, c-format
-msgid ""
-"%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d "
-"for lop_fixrx\n"
-msgstr ""
-
-#: mmo.c:1860
-#, c-format
-msgid "%s: cannot allocate file name for file number %d, %d bytes\n"
-msgstr ""
-
-#: mmo.c:1880
-#, c-format
-msgid ""
-"%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n"
-msgstr ""
-
-#: mmo.c:1893
-#, c-format
-msgid ""
-"%s: invalid mmo file: file name for number %d was not specified before use\n"
-msgstr ""
-
-#: mmo.c:1999
-#, c-format
-msgid ""
-"%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n"
-msgstr ""
-
-#: mmo.c:2035
-#, c-format
-msgid "%s: invalid mmo file: lop_end not last item in file\n"
-msgstr ""
-
-#: mmo.c:2048
-#, c-format
-msgid ""
-"%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras "
-"to the preceding lop_stab (%ld)\n"
-msgstr ""
-
-#: mmo.c:2698
-#, c-format
-msgid "%s: invalid symbol table: duplicate symbol `%s'\n"
-msgstr ""
-
-#: mmo.c:2949
-#, c-format
-msgid ""
-"%s: Bad symbol definition: `Main' set to %s rather than the start address %"
-"s\n"
-msgstr ""
-
-#: mmo.c:3039
-#, c-format
-msgid ""
-"%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: "
-"%d. Only `Main' will be emitted.\n"
-msgstr ""
-
-#: mmo.c:3084
-#, c-format
-msgid "%s: internal error, symbol table changed size from %d to %d words\n"
-msgstr ""
-
-#: mmo.c:3139
-#, c-format
-msgid "%s: internal error, internal register section %s had contents\n"
-msgstr ""
-
-#: mmo.c:3191
-#, c-format
-msgid "%s: no initialized registers; section length 0\n"
-msgstr ""
-
-#: mmo.c:3197
-#, c-format
-msgid "%s: too many initialized registers; section length %ld\n"
-msgstr ""
-
-#: mmo.c:3202
-#, c-format
-msgid ""
-"%s: invalid start address for initialized registers of length %ld: 0x%lx%"
-"08lx\n"
-msgstr ""
-
-#: oasys.c:1052
-#, c-format
-msgid "%s: can not represent section `%s' in oasys"
-msgstr ""
-
-#: osf-core.c:137
-#, c-format
-msgid "Unhandled OSF/1 core file section type %d\n"
-msgstr ""
-
-#. XXX code yet to be written.
-#: peicode.h:787
-#, c-format
-msgid "%s: Unhandled import type; %x"
-msgstr ""
-
-#: peicode.h:792
-#, c-format
-msgid "%s: Unrecognised import type; %x"
-msgstr ""
-
-#: peicode.h:806
-#, c-format
-msgid "%s: Unrecognised import name type; %x"
-msgstr ""
-
-#: peicode.h:1164
-#, c-format
-msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive"
-msgstr ""
-
-#: peicode.h:1176
-#, c-format
-msgid ""
-"%s: Recognised but unhandled machine type (0x%x) in Import Library Format "
-"archive"
-msgstr ""
-
-#: peicode.h:1193
-#, c-format
-msgid "%s: size field is zero in Import Library Format header"
-msgstr ""
-
-#: peicode.h:1224
-#, c-format
-msgid "%s: string not null terminated in ILF object file."
-msgstr ""
-
-#: pe-mips.c:659
-#, c-format
-msgid "%s: `ld -r' not supported with PE MIPS objects\n"
-msgstr ""
-
-#. OK, at this point the following variables are set up:
-#. src = VMA of the memory we're fixing up
-#. mem = pointer to memory we're fixing up
-#. val = VMA of what we need to refer to
-#.
-#: pe-mips.c:795
-#, c-format
-msgid "%s: unimplemented %s\n"
-msgstr ""
-
-#: pe-mips.c:821
-#, c-format
-msgid "%s: jump too far away\n"
-msgstr ""
-
-#: pe-mips.c:848
-#, c-format
-msgid "%s: bad pair/reflo after refhi\n"
-msgstr ""
-
-#: ppcboot.c:416
-msgid ""
-"\n"
-"ppcboot header:\n"
-msgstr ""
-
-#: ppcboot.c:417
-#, c-format
-msgid "Entry offset = 0x%.8lx (%ld)\n"
-msgstr ""
-
-#: ppcboot.c:418
-#, c-format
-msgid "Length = 0x%.8lx (%ld)\n"
-msgstr ""
-
-#: ppcboot.c:421
-#, c-format
-msgid "Flag field = 0x%.2x\n"
-msgstr ""
-
-#: ppcboot.c:427
-#, c-format
-msgid "Partition name = \"%s\"\n"
-msgstr ""
-
-#: ppcboot.c:446
-#, c-format
-msgid ""
-"\n"
-"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
-msgstr ""
-
-#: ppcboot.c:452
-#, c-format
-msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
-msgstr ""
-
-#: ppcboot.c:458
-#, c-format
-msgid "Partition[%d] sector = 0x%.8lx (%ld)\n"
-msgstr ""
-
-#: ppcboot.c:459
-#, c-format
-msgid "Partition[%d] length = 0x%.8lx (%ld)\n"
-msgstr ""
-
-#: som.c:5422
-msgid "som_sizeof_headers unimplemented"
-msgstr ""
-
-#: srec.c:302
-#, c-format
-msgid "%s:%d: Unexpected character `%s' in S-record file\n"
-msgstr ""
-
-#: stabs.c:319
-#, c-format
-msgid "%s(%s+0x%lx): Stabs entry has invalid string index."
-msgstr ""
-
-#: syms.c:1019
-msgid "Unsupported .stab relocation"
-msgstr ""
-
-#: vms-gsd.c:356
-#, c-format
-msgid "bfd_make_section (%s) failed"
-msgstr ""
-
-#: vms-gsd.c:371
-#, c-format
-msgid "bfd_set_section_flags (%s, %x) failed"
-msgstr ""
-
-#: vms-gsd.c:407
-#, c-format
-msgid "Size mismatch section %s=%lx, %s=%lx"
-msgstr ""
-
-#: vms-gsd.c:704
-#, c-format
-msgid "unknown gsd/egsd subtype %d"
-msgstr ""
-
-#: vms-hdr.c:408
-msgid "Object module NOT error-free !\n"
-msgstr ""
-
-#: vms-misc.c:541
-#, c-format
-msgid "Stack overflow (%d) in _bfd_vms_push"
-msgstr ""
-
-#: vms-misc.c:559
-msgid "Stack underflow in _bfd_vms_pop"
-msgstr ""
-
-#: vms-misc.c:918
-msgid "_bfd_vms_output_counted called with zero bytes"
-msgstr ""
-
-#: vms-misc.c:923
-msgid "_bfd_vms_output_counted called with too many bytes"
-msgstr ""
-
-#: vms-misc.c:1054
-#, c-format
-msgid "Symbol %s replaced by %s\n"
-msgstr ""
-
-#: vms-misc.c:1117
-#, c-format
-msgid "failed to enter %s"
-msgstr ""
-
-#: vms-tir.c:102
-msgid "No Mem !"
-msgstr ""
-
-#: vms-tir.c:383
-#, c-format
-msgid "bad section index in %s"
-msgstr ""
-
-#: vms-tir.c:396
-#, c-format
-msgid "unsupported STA cmd %s"
-msgstr ""
-
-#: vms-tir.c:401 vms-tir.c:1261
-#, c-format
-msgid "reserved STA cmd %d"
-msgstr ""
-
-#: vms-tir.c:512 vms-tir.c:535
-#, c-format
-msgid "%s: no symbol \"%s\""
-msgstr ""
-
-#. unsigned shift
-#. rotate
-#. Redefine symbol to current location.
-#. Define a literal.
-#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850
-#: vms-tir.c:859 vms-tir.c:1584
-#, c-format
-msgid "%s: not supported"
-msgstr ""
-
-#: vms-tir.c:607 vms-tir.c:1439
-#, c-format
-msgid "%s: not implemented"
-msgstr ""
-
-#: vms-tir.c:611 vms-tir.c:1443
-#, c-format
-msgid "reserved STO cmd %d"
-msgstr ""
-
-#: vms-tir.c:729 vms-tir.c:1589
-#, c-format
-msgid "reserved OPR cmd %d"
-msgstr ""
-
-#: vms-tir.c:797 vms-tir.c:1653
-#, c-format
-msgid "reserved CTL cmd %d"
-msgstr ""
-
-#. stack byte from image
-#. arg: none.
-#: vms-tir.c:1169
-msgid "stack-from-image not implemented"
-msgstr ""
-
-#: vms-tir.c:1187
-msgid "stack-entry-mask not fully implemented"
-msgstr ""
-
-#. compare procedure argument
-#. arg: cs symbol name
-#. by argument index
-#. da argument descriptor
-#.
-#. compare argument descriptor with symbol argument (ARG$V_PASSMECH)
-#. and stack TRUE (args match) or FALSE (args dont match) value.
-#: vms-tir.c:1201
-msgid "PASSMECH not fully implemented"
-msgstr ""
-
-#: vms-tir.c:1220
-msgid "stack-local-symbol not fully implemented"
-msgstr ""
-
-#: vms-tir.c:1233
-msgid "stack-literal not fully implemented"
-msgstr ""
-
-#: vms-tir.c:1254
-msgid "stack-local-symbol-entry-point-mask not fully implemented"
-msgstr ""
-
-#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632
-#: vms-tir.c:1640 vms-tir.c:1648
-#, c-format
-msgid "%s: not fully implemented"
-msgstr ""
-
-#: vms-tir.c:1705
-#, c-format
-msgid "obj code %d not found"
-msgstr ""
-
-#: vms-tir.c:2043
-#, c-format
-msgid "SEC_RELOC with no relocs in section %s"
-msgstr ""
-
-#: vms-tir.c:2331
-#, c-format
-msgid "Unhandled relocation %s"
-msgstr ""
-
-#: xcofflink.c:1244
-#, c-format
-msgid "%s: `%s' has line numbers but no enclosing section"
-msgstr ""
-
-#: xcofflink.c:1297
-#, c-format
-msgid "%s: class %d symbol `%s' has no aux entries"
-msgstr ""
-
-#: xcofflink.c:1320
-#, c-format
-msgid "%s: symbol `%s' has unrecognized csect type %d"
-msgstr ""
-
-#: xcofflink.c:1332
-#, c-format
-msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
-msgstr ""
-
-#: xcofflink.c:1368
-#, c-format
-msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d"
-msgstr ""
-
-#: xcofflink.c:1520
-#, c-format
-msgid "%s: csect `%s' not in enclosing section"
-msgstr ""
-
-#: xcofflink.c:1627
-#, c-format
-msgid "%s: misplaced XTY_LD `%s'"
-msgstr ""
-
-#: xcofflink.c:1958
-#, c-format
-msgid "%s: reloc %s:%d not in csect"
-msgstr ""
-
-#: xcofflink.c:2095
-#, c-format
-msgid "%s: XCOFF shared object when not producing XCOFF output"
-msgstr ""
-
-#: xcofflink.c:2116
-#, c-format
-msgid "%s: dynamic object with no .loader section"
-msgstr ""
-
-#: xcofflink.c:2761
-#, c-format
-msgid "%s: no such symbol"
-msgstr ""
-
-#: xcofflink.c:2894
-msgid "error: undefined symbol __rtinit"
-msgstr ""
-
-#: xcofflink.c:3455
-#, c-format
-msgid "warning: attempt to export undefined symbol `%s'"
-msgstr ""
-
-#: xcofflink.c:4448
-#, c-format
-msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"
-msgstr ""
-
-#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119
-#, c-format
-msgid "%s: loader reloc in unrecognized section `%s'"
-msgstr ""
-
-#: xcofflink.c:5310 xcofflink.c:6130
-#, c-format
-msgid "%s: `%s' in loader reloc but not loader sym"
-msgstr ""
-
-#: xcofflink.c:5325
-#, c-format
-msgid "%s: loader reloc in read-only section %s"
-msgstr ""
-
-#: elf32-ia64.c:2271 elf64-ia64.c:2271
-msgid "@pltoff reloc against local symbol"
-msgstr ""
-
-#: elf32-ia64.c:3663 elf64-ia64.c:3663
-#, c-format
-msgid "%s: short data segment overflowed (0x%lx >= 0x400000)"
-msgstr ""
-
-#: elf32-ia64.c:3674 elf64-ia64.c:3674
-#, c-format
-msgid "%s: __gp does not cover short data segment"
-msgstr ""
-
-#: elf32-ia64.c:3986 elf64-ia64.c:3986
-#, c-format
-msgid "%s: linking non-pic code in a shared library"
-msgstr ""
-
-#: elf32-ia64.c:4017 elf64-ia64.c:4017
-#, c-format
-msgid "%s: @gprel relocation against dynamic symbol %s"
-msgstr ""
-
-#: elf32-ia64.c:4077 elf64-ia64.c:4077
-#, c-format
-msgid "%s: linking non-pic code in a position independent executable"
-msgstr ""
-
-#: elf32-ia64.c:4214 elf64-ia64.c:4214
-#, c-format
-msgid "%s: @internal branch to dynamic symbol %s"
-msgstr ""
-
-#: elf32-ia64.c:4216 elf64-ia64.c:4216
-#, c-format
-msgid "%s: speculation fixup to dynamic symbol %s"
-msgstr ""
-
-#: elf32-ia64.c:4218 elf64-ia64.c:4218
-#, c-format
-msgid "%s: @pcrel relocation against dynamic symbol %s"
-msgstr ""
-
-#: elf32-ia64.c:4430 elf64-ia64.c:4430
-msgid "unsupported reloc"
-msgstr ""
-
-#: elf32-ia64.c:4709 elf64-ia64.c:4709
-#, c-format
-msgid "%s: linking trap-on-NULL-dereference with non-trapping files"
-msgstr ""
-
-#: elf32-ia64.c:4718 elf64-ia64.c:4718
-#, c-format
-msgid "%s: linking big-endian files with little-endian files"
-msgstr ""
-
-#: elf32-ia64.c:4727 elf64-ia64.c:4727
-#, c-format
-msgid "%s: linking 64-bit files with 32-bit files"
-msgstr ""
-
-#: elf32-ia64.c:4736 elf64-ia64.c:4736
-#, c-format
-msgid "%s: linking constant-gp files with non-constant-gp files"
-msgstr ""
-
-#: elf32-ia64.c:4746 elf64-ia64.c:4746
-#, c-format
-msgid "%s: linking auto-pic files with non-auto-pic files"
-msgstr ""
-
-#: peigen.c:985 pepigen.c:985
-#, c-format
-msgid "%s: line number overflow: 0x%lx > 0xffff"
-msgstr ""
-
-#: peigen.c:1002 pepigen.c:1002
-#, c-format
-msgid "%s: reloc overflow 1: 0x%lx > 0xffff"
-msgstr ""
-
-#: peigen.c:1016 pepigen.c:1016
-msgid "Export Directory [.edata (or where ever we found it)]"
-msgstr ""
-
-#: peigen.c:1017 pepigen.c:1017
-msgid "Import Directory [parts of .idata]"
-msgstr ""
-
-#: peigen.c:1018 pepigen.c:1018
-msgid "Resource Directory [.rsrc]"
-msgstr ""
-
-#: peigen.c:1019 pepigen.c:1019
-msgid "Exception Directory [.pdata]"
-msgstr ""
-
-#: peigen.c:1020 pepigen.c:1020
-msgid "Security Directory"
-msgstr ""
-
-#: peigen.c:1021 pepigen.c:1021
-msgid "Base Relocation Directory [.reloc]"
-msgstr ""
-
-#: peigen.c:1022 pepigen.c:1022
-msgid "Debug Directory"
-msgstr ""
-
-#: peigen.c:1023 pepigen.c:1023
-msgid "Description Directory"
-msgstr ""
-
-#: peigen.c:1024 pepigen.c:1024
-msgid "Special Directory"
-msgstr ""
-
-#: peigen.c:1025 pepigen.c:1025
-msgid "Thread Storage Directory [.tls]"
-msgstr ""
-
-#: peigen.c:1026 pepigen.c:1026
-msgid "Load Configuration Directory"
-msgstr ""
-
-#: peigen.c:1027 pepigen.c:1027
-msgid "Bound Import Directory"
-msgstr ""
-
-#: peigen.c:1028 pepigen.c:1028
-msgid "Import Address Table Directory"
-msgstr ""
-
-#: peigen.c:1029 pepigen.c:1029
-msgid "Delay Import Directory"
-msgstr ""
-
-#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031
-msgid "Reserved"
-msgstr ""
-
-#: peigen.c:1094 pepigen.c:1094
-msgid ""
-"\n"
-"There is an import table, but the section containing it could not be found\n"
-msgstr ""
-
-#: peigen.c:1099 pepigen.c:1099
-#, c-format
-msgid ""
-"\n"
-"There is an import table in %s at 0x%lx\n"
-msgstr ""
-
-#: peigen.c:1136 pepigen.c:1136
-#, c-format
-msgid ""
-"\n"
-"Function descriptor located at the start address: %04lx\n"
-msgstr ""
-
-#: peigen.c:1139 pepigen.c:1139
-#, c-format
-msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
-msgstr ""
-
-#: peigen.c:1145 pepigen.c:1145
-msgid ""
-"\n"
-"No reldata section! Function descriptor not decoded.\n"
-msgstr ""
-
-#: peigen.c:1150 pepigen.c:1150
-#, c-format
-msgid ""
-"\n"
-"The Import Tables (interpreted %s section contents)\n"
-msgstr ""
-
-#: peigen.c:1153 pepigen.c:1153
-msgid ""
-" vma: Hint Time Forward DLL First\n"
-" Table Stamp Chain Name Thunk\n"
-msgstr ""
-
-#: peigen.c:1204 pepigen.c:1204
-#, c-format
-msgid ""
-"\n"
-"\tDLL Name: %s\n"
-msgstr ""
-
-#: peigen.c:1215 pepigen.c:1215
-msgid "\tvma: Hint/Ord Member-Name Bound-To\n"
-msgstr ""
-
-#: peigen.c:1240 pepigen.c:1240
-msgid ""
-"\n"
-"There is a first thunk, but the section containing it could not be found\n"
-msgstr ""
-
-#: peigen.c:1380 pepigen.c:1380
-msgid ""
-"\n"
-"There is an export table, but the section containing it could not be found\n"
-msgstr ""
-
-#: peigen.c:1385 pepigen.c:1385
-#, c-format
-msgid ""
-"\n"
-"There is an export table in %s at 0x%lx\n"
-msgstr ""
-
-#: peigen.c:1416 pepigen.c:1416
-#, c-format
-msgid ""
-"\n"
-"The Export Tables (interpreted %s section contents)\n"
-"\n"
-msgstr ""
-
-#: peigen.c:1420 pepigen.c:1420
-#, c-format
-msgid "Export Flags \t\t\t%lx\n"
-msgstr ""
-
-#: peigen.c:1423 pepigen.c:1423
-#, c-format
-msgid "Time/Date stamp \t\t%lx\n"
-msgstr ""
-
-#: peigen.c:1426 pepigen.c:1426
-#, c-format
-msgid "Major/Minor \t\t\t%d/%d\n"
-msgstr ""
-
-#: peigen.c:1429 pepigen.c:1429
-msgid "Name \t\t\t\t"
-msgstr ""
-
-#: peigen.c:1435 pepigen.c:1435
-#, c-format
-msgid "Ordinal Base \t\t\t%ld\n"
-msgstr ""
-
-#: peigen.c:1438 pepigen.c:1438
-msgid "Number in:\n"
-msgstr ""
-
-#: peigen.c:1441 pepigen.c:1441
-#, c-format
-msgid "\tExport Address Table \t\t%08lx\n"
-msgstr ""
-
-#: peigen.c:1445 pepigen.c:1445
-#, c-format
-msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n"
-msgstr ""
-
-#: peigen.c:1448 pepigen.c:1448
-msgid "Table Addresses\n"
-msgstr ""
-
-#: peigen.c:1451 pepigen.c:1451
-msgid "\tExport Address Table \t\t"
-msgstr ""
-
-#: peigen.c:1456 pepigen.c:1456
-msgid "\tName Pointer Table \t\t"
-msgstr ""
-
-#: peigen.c:1461 pepigen.c:1461
-msgid "\tOrdinal Table \t\t\t"
-msgstr ""
-
-#: peigen.c:1476 pepigen.c:1476
-#, c-format
-msgid ""
-"\n"
-"Export Address Table -- Ordinal Base %ld\n"
-msgstr ""
-
-#: peigen.c:1495 pepigen.c:1495
-msgid "Forwarder RVA"
-msgstr ""
-
-#: peigen.c:1506 pepigen.c:1506
-msgid "Export RVA"
-msgstr ""
-
-#: peigen.c:1513 pepigen.c:1513
-msgid ""
-"\n"
-"[Ordinal/Name Pointer] Table\n"
-msgstr ""
-
-#: peigen.c:1568 pepigen.c:1568
-#, c-format
-msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
-msgstr ""
-
-#: peigen.c:1572 pepigen.c:1572
-msgid ""
-"\n"
-"The Function Table (interpreted .pdata section contents)\n"
-msgstr ""
-
-#: peigen.c:1575 pepigen.c:1575
-msgid " vma:\t\t\tBegin Address End Address Unwind Info\n"
-msgstr ""
-
-#: peigen.c:1577 pepigen.c:1577
-msgid ""
-" vma:\t\tBegin End EH EH PrologEnd Exception\n"
-" \t\tAddress Address Handler Data Address Mask\n"
-msgstr ""
-
-#: peigen.c:1647 pepigen.c:1647
-msgid " Register save millicode"
-msgstr ""
-
-#: peigen.c:1650 pepigen.c:1650
-msgid " Register restore millicode"
-msgstr ""
-
-#: peigen.c:1653 pepigen.c:1653
-msgid " Glue code sequence"
-msgstr ""
-
-#: peigen.c:1705 pepigen.c:1705
-msgid ""
-"\n"
-"\n"
-"PE File Base Relocations (interpreted .reloc section contents)\n"
-msgstr ""
-
-#: peigen.c:1735 pepigen.c:1735
-#, c-format
-msgid ""
-"\n"
-"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
-msgstr ""
-
-#: peigen.c:1748 pepigen.c:1748
-#, c-format
-msgid "\treloc %4d offset %4x [%4lx] %s"
-msgstr ""
-
-#. The MS dumpbin program reportedly ands with 0xff0f before
-#. printing the characteristics field. Not sure why. No reason to
-#. emulate it here.
-#: peigen.c:1788 pepigen.c:1788
-#, c-format
-msgid ""
-"\n"
-"Characteristics 0x%x\n"
-msgstr ""
diff --git a/contrib/binutils/bfd/ppcboot.c b/contrib/binutils/bfd/ppcboot.c
deleted file mode 100644
index 05fb7de..0000000
--- a/contrib/binutils/bfd/ppcboot.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/* BFD back-end for PPCbug boot records.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This is a BFD backend which may be used to write PowerPCBug boot objects.
- It may only be used for output, not input. The intention is that this may
- be used as an output format for objcopy in order to generate raw binary
- data.
-
- This is very simple. The only complication is that the real data
- will start at some address X, and in some cases we will not want to
- include X zeroes just to get to that point. Since the start
- address is not meaningful for this object file format, we use it
- instead to indicate the number of zeroes to skip at the start of
- the file. objcopy cooperates by specially setting the start
- address to zero by default. */
-
-#include "safe-ctype.h"
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-/* PPCbug location structure */
-typedef struct ppcboot_location {
- bfd_byte ind;
- bfd_byte head;
- bfd_byte sector;
- bfd_byte cylinder;
-} ppcboot_location_t;
-
-/* PPCbug partition table layout */
-typedef struct ppcboot_partition {
- ppcboot_location_t partition_begin; /* partition begin */
- ppcboot_location_t partition_end; /* partition end */
- bfd_byte sector_begin[4]; /* 32-bit start RBA (zero-based), little endian */
- bfd_byte sector_length[4]; /* 32-bit RBA count (one-based), little endian */
-} ppcboot_partition_t;
-
-/* PPCbug boot layout. */
-typedef struct ppcboot_hdr {
- bfd_byte pc_compatibility[446]; /* x86 instruction field */
- ppcboot_partition_t partition[4]; /* partition information */
- bfd_byte signature[2]; /* 0x55 and 0xaa */
- bfd_byte entry_offset[4]; /* entry point offset, little endian */
- bfd_byte length[4]; /* load image length, little endian */
- bfd_byte flags; /* flag field */
- bfd_byte os_id; /* OS_ID */
- char partition_name[32]; /* partition name */
- bfd_byte reserved1[470]; /* reserved */
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-ppcboot_hdr_t;
-
-/* Signature bytes for last 2 bytes of the 512 byte record */
-#define SIGNATURE0 0x55
-#define SIGNATURE1 0xaa
-
-/* PowerPC boot type */
-#define PPC_IND 0x41
-
-/* Information needed for ppcboot header */
-typedef struct ppcboot_data {
- ppcboot_hdr_t header; /* raw header */
- asection *sec; /* single section */
-} ppcboot_data_t;
-
-/* Any bfd we create by reading a ppcboot file has three symbols:
- a start symbol, an end symbol, and an absolute length symbol. */
-#define PPCBOOT_SYMS 3
-
-static bfd_boolean ppcboot_mkobject PARAMS ((bfd *));
-static const bfd_target *ppcboot_object_p PARAMS ((bfd *));
-static bfd_boolean ppcboot_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static bfd_boolean ppcboot_get_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static long ppcboot_get_symtab_upper_bound PARAMS ((bfd *));
-static char *mangle_name PARAMS ((bfd *, char *));
-static long ppcboot_canonicalize_symtab PARAMS ((bfd *, asymbol **));
-static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-static bfd_boolean ppcboot_set_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static int ppcboot_sizeof_headers PARAMS ((bfd *, bfd_boolean));
-static bfd_boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR));
-
-#define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (PTR) (ptr))
-#define ppcboot_get_tdata(abfd) ((ppcboot_data_t *) ((abfd)->tdata.any))
-
-/* Create a ppcboot object. Invoked via bfd_set_format. */
-
-static bfd_boolean
-ppcboot_mkobject (abfd)
- bfd *abfd;
-{
- if (!ppcboot_get_tdata (abfd))
- {
- bfd_size_type amt = sizeof (ppcboot_data_t);
- ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt));
- }
-
- return TRUE;
-}
-
-
-/* Set the architecture to PowerPC */
-static bfd_boolean
-ppcboot_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
-{
- if (arch == bfd_arch_unknown)
- arch = bfd_arch_powerpc;
-
- else if (arch != bfd_arch_powerpc)
- return FALSE;
-
- return bfd_default_set_arch_mach (abfd, arch, machine);
-}
-
-
-/* Any file may be considered to be a ppcboot file, provided the target
- was not defaulted. That is, it must be explicitly specified as
- being ppcboot. */
-
-static const bfd_target *
-ppcboot_object_p (abfd)
- bfd *abfd;
-{
- struct stat statbuf;
- asection *sec;
- ppcboot_hdr_t hdr;
- size_t i;
- ppcboot_data_t *tdata;
-
- BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024);
-
- if (abfd->target_defaulted)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Find the file size. */
- if (bfd_stat (abfd, &statbuf) < 0)
- {
- bfd_set_error (bfd_error_system_call);
- return NULL;
- }
-
- if ((size_t) statbuf.st_size < sizeof (ppcboot_hdr_t))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (bfd_bread ((PTR) &hdr, (bfd_size_type) sizeof (hdr), abfd)
- != sizeof (hdr))
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
-
- return NULL;
- }
-
- /* Now do some basic checks. */
- for (i = 0; i < sizeof (hdr.pc_compatibility); i++)
- if (hdr.pc_compatibility[i])
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (hdr.signature[0] != SIGNATURE0 || hdr.signature[1] != SIGNATURE1)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (hdr.partition[0].partition_end.ind != PPC_IND)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- abfd->symcount = PPCBOOT_SYMS;
-
- /* One data section. */
- sec = bfd_make_section (abfd, ".data");
- if (sec == NULL)
- return NULL;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS;
- sec->vma = 0;
- sec->_raw_size = statbuf.st_size - sizeof (ppcboot_hdr_t);
- sec->filepos = sizeof (ppcboot_hdr_t);
-
- ppcboot_mkobject (abfd);
- tdata = ppcboot_get_tdata (abfd);
- tdata->sec = sec;
- memcpy ((PTR) &tdata->header, (PTR) &hdr, sizeof (ppcboot_hdr_t));
-
- ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0L);
- return abfd->xvec;
-}
-
-#define ppcboot_close_and_cleanup _bfd_generic_close_and_cleanup
-#define ppcboot_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define ppcboot_new_section_hook _bfd_generic_new_section_hook
-
-
-/* Get contents of the only section. */
-
-static bfd_boolean
-ppcboot_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section ATTRIBUTE_UNUSED;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0
- || bfd_bread (location, count, abfd) != count)
- return FALSE;
- return TRUE;
-}
-
-
-/* Return the amount of memory needed to read the symbol table. */
-
-static long
-ppcboot_get_symtab_upper_bound (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
-{
- return (PPCBOOT_SYMS + 1) * sizeof (asymbol *);
-}
-
-
-/* Create a symbol name based on the bfd's filename. */
-
-static char *
-mangle_name (abfd, suffix)
- bfd *abfd;
- char *suffix;
-{
- bfd_size_type size;
- char *buf;
- char *p;
-
- size = (strlen (bfd_get_filename (abfd))
- + strlen (suffix)
- + sizeof "_ppcboot__");
-
- buf = (char *) bfd_alloc (abfd, size);
- if (buf == NULL)
- return "";
-
- sprintf (buf, "_ppcboot_%s_%s", bfd_get_filename (abfd), suffix);
-
- /* Change any non-alphanumeric characters to underscores. */
- for (p = buf; *p; p++)
- if (! ISALNUM (*p))
- *p = '_';
-
- return buf;
-}
-
-
-/* Return the symbol table. */
-
-static long
-ppcboot_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
-{
- asection *sec = ppcboot_get_tdata (abfd)->sec;
- asymbol *syms;
- unsigned int i;
- bfd_size_type amt = PPCBOOT_SYMS * sizeof (asymbol);
-
- syms = (asymbol *) bfd_alloc (abfd, amt);
- if (syms == NULL)
- return FALSE;
-
- /* Start symbol. */
- syms[0].the_bfd = abfd;
- syms[0].name = mangle_name (abfd, "start");
- syms[0].value = 0;
- syms[0].flags = BSF_GLOBAL;
- syms[0].section = sec;
- syms[0].udata.p = NULL;
-
- /* End symbol. */
- syms[1].the_bfd = abfd;
- syms[1].name = mangle_name (abfd, "end");
- syms[1].value = sec->_raw_size;
- syms[1].flags = BSF_GLOBAL;
- syms[1].section = sec;
- syms[1].udata.p = NULL;
-
- /* Size symbol. */
- syms[2].the_bfd = abfd;
- syms[2].name = mangle_name (abfd, "size");
- syms[2].value = sec->_raw_size;
- syms[2].flags = BSF_GLOBAL;
- syms[2].section = bfd_abs_section_ptr;
- syms[2].udata.p = NULL;
-
- for (i = 0; i < PPCBOOT_SYMS; i++)
- *alocation++ = syms++;
- *alocation = NULL;
-
- return PPCBOOT_SYMS;
-}
-
-#define ppcboot_make_empty_symbol _bfd_generic_make_empty_symbol
-#define ppcboot_print_symbol _bfd_nosymbols_print_symbol
-
-/* Get information about a symbol. */
-
-static void
-ppcboot_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
-}
-
-#define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define ppcboot_get_lineno _bfd_nosymbols_get_lineno
-#define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define ppcboot_read_minisymbols _bfd_generic_read_minisymbols
-#define ppcboot_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define ppcboot_get_reloc_upper_bound \
- ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
-#define ppcboot_canonicalize_reloc \
- ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
-#define ppcboot_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-
-/* Write section contents of a ppcboot file. */
-
-static bfd_boolean
-ppcboot_set_section_contents (abfd, sec, data, offset, size)
- bfd *abfd;
- asection *sec;
- const PTR data;
- file_ptr offset;
- bfd_size_type size;
-{
- if (! abfd->output_has_begun)
- {
- bfd_vma low;
- asection *s;
-
- /* The lowest section VMA sets the virtual address of the start
- of the file. We use the set the file position of all the
- sections. */
- low = abfd->sections->vma;
- for (s = abfd->sections->next; s != NULL; s = s->next)
- if (s->vma < low)
- low = s->vma;
-
- for (s = abfd->sections; s != NULL; s = s->next)
- s->filepos = s->vma - low;
-
- abfd->output_has_begun = TRUE;
- }
-
- return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
-}
-
-
-static int
-ppcboot_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
-{
- return sizeof (ppcboot_hdr_t);
-}
-
-
-/* Print out the program headers. */
-
-static bfd_boolean
-ppcboot_bfd_print_private_bfd_data (abfd, farg)
- bfd *abfd;
- PTR farg;
-{
- FILE *f = (FILE *)farg;
- ppcboot_data_t *tdata = ppcboot_get_tdata (abfd);
- long entry_offset = bfd_getl_signed_32 ((PTR) tdata->header.entry_offset);
- long length = bfd_getl_signed_32 ((PTR) tdata->header.length);
- int i;
-
- fprintf (f, _("\nppcboot header:\n"));
- fprintf (f, _("Entry offset = 0x%.8lx (%ld)\n"), entry_offset, entry_offset);
- fprintf (f, _("Length = 0x%.8lx (%ld)\n"), length, length);
-
- if (tdata->header.flags)
- fprintf (f, _("Flag field = 0x%.2x\n"), tdata->header.flags);
-
- if (tdata->header.os_id)
- fprintf (f, "OS_ID = 0x%.2x\n", tdata->header.os_id);
-
- if (tdata->header.partition_name)
- fprintf (f, _("Partition name = \"%s\"\n"), tdata->header.partition_name);
-
- for (i = 0; i < 4; i++)
- {
- long sector_begin = bfd_getl_signed_32 ((PTR) tdata->header.partition[i].sector_begin);
- long sector_length = bfd_getl_signed_32 ((PTR) tdata->header.partition[i].sector_length);
-
- /* Skip all 0 entries */
- if (!tdata->header.partition[i].partition_begin.ind
- && !tdata->header.partition[i].partition_begin.head
- && !tdata->header.partition[i].partition_begin.sector
- && !tdata->header.partition[i].partition_begin.cylinder
- && !tdata->header.partition[i].partition_end.ind
- && !tdata->header.partition[i].partition_end.head
- && !tdata->header.partition[i].partition_end.sector
- && !tdata->header.partition[i].partition_end.cylinder
- && !sector_begin && !sector_length)
- continue;
-
- fprintf (f, _("\nPartition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"), i,
- tdata->header.partition[i].partition_begin.ind,
- tdata->header.partition[i].partition_begin.head,
- tdata->header.partition[i].partition_begin.sector,
- tdata->header.partition[i].partition_begin.cylinder);
-
- fprintf (f, _("Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"), i,
- tdata->header.partition[i].partition_end.ind,
- tdata->header.partition[i].partition_end.head,
- tdata->header.partition[i].partition_end.sector,
- tdata->header.partition[i].partition_end.cylinder);
-
- fprintf (f, _("Partition[%d] sector = 0x%.8lx (%ld)\n"), i, sector_begin, sector_begin);
- fprintf (f, _("Partition[%d] length = 0x%.8lx (%ld)\n"), i, sector_length, sector_length);
- }
-
- fprintf (f, "\n");
- return TRUE;
-}
-
-
-#define ppcboot_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define ppcboot_bfd_relax_section bfd_generic_relax_section
-#define ppcboot_bfd_gc_sections bfd_generic_gc_sections
-#define ppcboot_bfd_merge_sections bfd_generic_merge_sections
-#define ppcboot_bfd_discard_group bfd_generic_discard_group
-#define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms
-#define ppcboot_bfd_final_link _bfd_generic_final_link
-#define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
-#define ppcboot_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-#define ppcboot_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
-#define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
-#define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
-#define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
-#define ppcboot_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
-#define ppcboot_bfd_print_private_bfd_dat ppcboot_bfd_print_private_bfd_data
-
-const bfd_target ppcboot_vec =
-{
- "ppcboot", /* name */
- bfd_target_unknown_flavour, /* flavour */
- BFD_ENDIAN_BIG, /* byteorder is big endian for code */
- BFD_ENDIAN_LITTLE, /* header_byteorder */
- EXEC_P, /* object_flags */
- (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
- | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */
- 0, /* symbol_leading_char */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
- { /* bfd_check_format */
- _bfd_dummy_target,
- ppcboot_object_p, /* bfd_check_format */
- _bfd_dummy_target,
- _bfd_dummy_target,
- },
- { /* bfd_set_format */
- bfd_false,
- ppcboot_mkobject,
- bfd_false,
- bfd_false,
- },
- { /* bfd_write_contents */
- bfd_false,
- bfd_true,
- bfd_false,
- bfd_false,
- },
-
- BFD_JUMP_TABLE_GENERIC (ppcboot),
- BFD_JUMP_TABLE_COPY (ppcboot),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (ppcboot),
- BFD_JUMP_TABLE_RELOCS (ppcboot),
- BFD_JUMP_TABLE_WRITE (ppcboot),
- BFD_JUMP_TABLE_LINK (ppcboot),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- NULL
-};
diff --git a/contrib/binutils/bfd/ptrace-core.c b/contrib/binutils/bfd/ptrace-core.c
deleted file mode 100644
index 15b6777..0000000
--- a/contrib/binutils/bfd/ptrace-core.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/* BFD backend for core files which use the ptrace_user structure
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- The structure of this file is based on trad-core.c written by John Gilmore
- of Cygnus Support.
- Modified to work with the ptrace_user structure by Kevin A. Buettner.
- (Longterm it may be better to merge this file with trad-core.c)
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifdef PTRACE_CORE
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-#include <sys/ptrace.h>
-
-struct trad_core_struct
- {
- asection *data_section;
- asection *stack_section;
- asection *reg_section;
- struct ptrace_user u;
- };
-
-#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
-#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
-#define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section)
-#define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section)
-
-/* forward declarations */
-
-const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd));
-char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd));
-int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd));
-bfd_boolean ptrace_unix_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-static void swap_abort PARAMS ((void));
-
-const bfd_target *
-ptrace_unix_core_file_p (abfd)
- bfd *abfd;
-
-{
- int val;
- struct ptrace_user u;
- struct trad_core_struct *rawptr;
- bfd_size_type amt;
-
- val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
- if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
- || u.pt_rev != _BCS_PTRACE_REV)
- {
- /* Too small to be a core file */
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- /* OK, we believe you. You're a core file (sure, sure). */
-
- /* Allocate both the upage and the struct core_data at once, so
- a single free() will free them both. */
- amt = sizeof (struct trad_core_struct);
- rawptr = (struct trad_core_struct *) bfd_zalloc (abfd, amt);
-
- if (rawptr == NULL)
- return 0;
-
- abfd->tdata.trad_core_data = rawptr;
-
- rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
-
- /* Create the sections. */
-
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
- if (core_stacksec (abfd) == NULL)
- goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
- if (core_datasec (abfd) == NULL)
- goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
- if (core_regsec (abfd) == NULL)
- goto fail;
-
- /* FIXME: Need to worry about shared memory, library data, and library
- text. I don't think that any of these things are supported on the
- system on which I am developing this for though. */
-
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
-
- core_datasec (abfd)->_raw_size = u.pt_dsize;
- core_stacksec (abfd)->_raw_size = u.pt_ssize;
- core_regsec (abfd)->_raw_size = sizeof (u);
-
- core_datasec (abfd)->vma = u.pt_o_data_start;
- core_stacksec (abfd)->vma = USRSTACK - u.pt_ssize;
- core_regsec (abfd)->vma = 0 - sizeof (u); /* see trad-core.c */
-
- core_datasec (abfd)->filepos = (int) u.pt_dataptr;
- core_stacksec (abfd)->filepos = (int) (u.pt_dataptr + u.pt_dsize);
- core_regsec (abfd)->filepos = 0; /* Register segment is ptrace_user */
-
- /* Align to word at least */
- core_stacksec (abfd)->alignment_power = 2;
- core_datasec (abfd)->alignment_power = 2;
- core_regsec (abfd)->alignment_power = 2;
-
- return abfd->xvec;
-
- fail:
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = NULL;
- bfd_section_list_clear (abfd);
- return NULL;
-}
-
-char *
-ptrace_unix_core_file_failing_command (abfd)
- bfd *abfd;
-{
- char *com = abfd->tdata.trad_core_data->u.pt_comm;
- if (*com)
- return com;
- else
- return 0;
-}
-
-int
-ptrace_unix_core_file_failing_signal (abfd)
- bfd *abfd;
-{
- return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num;
-}
-
-bfd_boolean
-ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd, *exec_bfd;
-{
- /* FIXME: Use pt_timdat field of the ptrace_user structure to match
- the date of the executable */
- return TRUE;
-}
-
-/* If somebody calls any byte-swapping routines, shoot them. */
-static void
-swap_abort ()
-{
- abort (); /* This way doesn't require any declaration for ANSI to fuck up */
-}
-
-#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
-#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
-#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
-#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
-#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
-#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
-
-const bfd_target ptrace_core_vec =
- {
- "trad-core",
- bfd_target_unknown_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* symbol prefix */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
-
- { /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- ptrace_unix_core_file_p /* a core file */
- },
- { /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
- { /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
-
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (ptrace_unix),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0 /* backend_data */
- };
-
-#endif /* PTRACE_CORE */
diff --git a/contrib/binutils/bfd/reloc.c b/contrib/binutils/bfd/reloc.c
deleted file mode 100644
index 9bffaa3..0000000
--- a/contrib/binutils/bfd/reloc.c
+++ /dev/null
@@ -1,4289 +0,0 @@
-/* BFD support for handling relocation entries.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- Relocations
-
- BFD maintains relocations in much the same way it maintains
- symbols: they are left alone until required, then read in
- en-masse and translated into an internal form. A common
- routine <<bfd_perform_relocation>> acts upon the
- canonical form to do the fixup.
-
- Relocations are maintained on a per section basis,
- while symbols are maintained on a per BFD basis.
-
- All that a back end has to do to fit the BFD interface is to create
- a <<struct reloc_cache_entry>> for each relocation
- in a particular section, and fill in the right bits of the structures.
-
-@menu
-@* typedef arelent::
-@* howto manager::
-@end menu
-
-*/
-
-/* DO compile in the reloc_code name table from libbfd.h. */
-#define _BFD_MAKE_TABLE_bfd_reloc_code_real
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-/*
-DOCDD
-INODE
- typedef arelent, howto manager, Relocations, Relocations
-
-SUBSECTION
- typedef arelent
-
- This is the structure of a relocation entry:
-
-CODE_FRAGMENT
-.
-.typedef enum bfd_reloc_status
-.{
-. {* No errors detected. *}
-. bfd_reloc_ok,
-.
-. {* The relocation was performed, but there was an overflow. *}
-. bfd_reloc_overflow,
-.
-. {* The address to relocate was not within the section supplied. *}
-. bfd_reloc_outofrange,
-.
-. {* Used by special functions. *}
-. bfd_reloc_continue,
-.
-. {* Unsupported relocation size requested. *}
-. bfd_reloc_notsupported,
-.
-. {* Unused. *}
-. bfd_reloc_other,
-.
-. {* 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. *}
-. bfd_reloc_dangerous
-. }
-. bfd_reloc_status_type;
-.
-.
-.typedef struct reloc_cache_entry
-.{
-. {* A pointer into the canonical table of pointers. *}
-. struct bfd_symbol **sym_ptr_ptr;
-.
-. {* offset in section. *}
-. bfd_size_type address;
-.
-. {* addend for relocation value. *}
-. bfd_vma addend;
-.
-. {* Pointer to how to perform the required relocation. *}
-. reloc_howto_type *howto;
-.
-.}
-.arelent;
-.
-*/
-
-/*
-DESCRIPTION
-
- Here is a description of each of the fields within an <<arelent>>:
-
- o <<sym_ptr_ptr>>
-
- The symbol table pointer points to a pointer to the symbol
- associated with the relocation request. It is the pointer
- into the table returned by the back end's
- <<canonicalize_symtab>> action. @xref{Symbols}. The symbol is
- referenced through a pointer to a pointer so that tools like
- the linker can fix up all the symbols of the same name by
- modifying only one pointer. The relocation routine looks in
- the symbol and uses the base of the section the symbol is
- attached to and the value of the symbol as the initial
- relocation offset. If the symbol pointer is zero, then the
- section provided is looked up.
-
- o <<address>>
-
- The <<address>> field gives the offset in bytes from the base of
- the section data which owns the relocation record to the first
- byte of relocatable information. The actual data relocated
- will be relative to this point; for example, a relocation
- type which modifies the bottom two bytes of a four byte word
- would not touch the first byte pointed to in a big endian
- world.
-
- o <<addend>>
-
- The <<addend>> is a value provided by the back end to be added (!)
- to the relocation offset. Its interpretation is dependent upon
- the howto. For example, on the 68k the code:
-
-| char foo[];
-| main()
-| {
-| return foo[0x12345678];
-| }
-
- Could be compiled into:
-
-| linkw fp,#-4
-| moveb @@#12345678,d0
-| extbl d0
-| unlk fp
-| rts
-
- This could create a reloc pointing to <<foo>>, but leave the
- offset in the data, something like:
-
-|RELOCATION RECORDS FOR [.text]:
-|offset type value
-|00000006 32 _foo
-|
-|00000000 4e56 fffc ; linkw fp,#-4
-|00000004 1039 1234 5678 ; moveb @@#12345678,d0
-|0000000a 49c0 ; extbl d0
-|0000000c 4e5e ; unlk fp
-|0000000e 4e75 ; rts
-
- Using coff and an 88k, some instructions don't have enough
- space in them to represent the full address range, and
- pointers have to be loaded in two parts. So you'd get something like:
-
-| or.u r13,r0,hi16(_foo+0x12345678)
-| ld.b r2,r13,lo16(_foo+0x12345678)
-| jmp r1
-
- This should create two relocs, both pointing to <<_foo>>, and with
- 0x12340000 in their addend field. The data would consist of:
-
-|RELOCATION RECORDS FOR [.text]:
-|offset type value
-|00000002 HVRT16 _foo+0x12340000
-|00000006 LVRT16 _foo+0x12340000
-|
-|00000000 5da05678 ; or.u r13,r0,0x5678
-|00000004 1c4d5678 ; ld.b r2,r13,0x5678
-|00000008 f400c001 ; jmp r1
-
- The relocation routine digs out the value from the data, adds
- it to the addend to get the original offset, and then adds the
- value of <<_foo>>. Note that all 32 bits have to be kept around
- somewhere, to cope with carry from bit 15 to bit 16.
-
- One further example is the sparc and the a.out format. The
- sparc has a similar problem to the 88k, in that some
- instructions don't have room for an entire offset, but on the
- sparc the parts are created in odd sized lumps. The designers of
- the a.out format chose to not use the data within the section
- for storing part of the offset; all the offset is kept within
- the reloc. Anything in the data should be ignored.
-
-| save %sp,-112,%sp
-| sethi %hi(_foo+0x12345678),%g2
-| ldsb [%g2+%lo(_foo+0x12345678)],%i0
-| ret
-| restore
-
- Both relocs contain a pointer to <<foo>>, and the offsets
- contain junk.
-
-|RELOCATION RECORDS FOR [.text]:
-|offset type value
-|00000004 HI22 _foo+0x12345678
-|00000008 LO10 _foo+0x12345678
-|
-|00000000 9de3bf90 ; save %sp,-112,%sp
-|00000004 05000000 ; sethi %hi(_foo+0),%g2
-|00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0
-|0000000c 81c7e008 ; ret
-|00000010 81e80000 ; restore
-
- o <<howto>>
-
- The <<howto>> field can be imagined as a
- relocation instruction. It is a pointer to a structure which
- contains information on what to do with all of the other
- information in the reloc record and data section. A back end
- would normally have a relocation instruction set and turn
- relocations into pointers to the correct structure on input -
- but it would be possible to create each howto field on demand.
-
-*/
-
-/*
-SUBSUBSECTION
- <<enum complain_overflow>>
-
- Indicates what sort of overflow checking should be done when
- performing a relocation.
-
-CODE_FRAGMENT
-.
-.enum complain_overflow
-.{
-. {* Do not complain on overflow. *}
-. complain_overflow_dont,
-.
-. {* 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_overflow_signed,
-.
-. {* Complain if the value overflows when considered as an
-. unsigned number. *}
-. complain_overflow_unsigned
-.};
-
-*/
-
-/*
-SUBSUBSECTION
- <<reloc_howto_type>>
-
- The <<reloc_howto_type>> is a structure which contains all the
- information that libbfd needs to know to tie up a back end's data.
-
-CODE_FRAGMENT
-.struct bfd_symbol; {* Forward declaration. *}
-.
-.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. *}
-. unsigned int type;
-.
-. {* 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. *}
-. int size;
-.
-. {* 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. *}
-. bfd_boolean pc_relative;
-.
-. {* 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. *}
-. 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 accommodated (e.g., i960 callj
-. instructions). *}
-. bfd_reloc_status_type (*special_function)
-. (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
-. bfd *, char **);
-.
-. {* 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. *}
-. bfd_boolean partial_inplace;
-.
-. {* src_mask selects the part of the instruction (or data) to be used
-. in the relocation sum. If the target relocations don't have an
-. addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
-. dst_mask to extract the addend from the section contents. If
-. relocations do have an addend in the reloc, eg. ELF USE_RELA, this
-. field should be zero. Non-zero values for ELF USE_RELA targets are
-. bogus as in those cases the value in the dst_mask part of the
-. section contents should be treated as garbage. *}
-. bfd_vma src_mask;
-.
-. {* dst_mask selects which parts of the instruction (or data) are
-. replaced with a relocated value. *}
-. 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. *}
-. bfd_boolean pcrel_offset;
-.};
-.
-*/
-
-/*
-FUNCTION
- The HOWTO Macro
-
-DESCRIPTION
- The HOWTO define is horrible and will go away.
-
-.#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
-. { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
-
-DESCRIPTION
- And will be replaced with the totally magic way. But for the
- moment, we are compatible, so do it this way.
-
-.#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
-. HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
-. NAME, FALSE, 0, 0, IN)
-.
-
-DESCRIPTION
- This is used to fill in an empty howto entry in an array.
-
-.#define EMPTY_HOWTO(C) \
-. HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
-. NULL, FALSE, 0, 0, FALSE)
-.
-
-DESCRIPTION
- Helper routine to turn a symbol into a relocation value.
-
-.#define HOWTO_PREPARE(relocation, symbol) \
-. { \
-. if (symbol != NULL) \
-. { \
-. if (bfd_is_com_section (symbol->section)) \
-. { \
-. relocation = 0; \
-. } \
-. else \
-. { \
-. relocation = symbol->value; \
-. } \
-. } \
-. }
-.
-*/
-
-/*
-FUNCTION
- bfd_get_reloc_size
-
-SYNOPSIS
- unsigned int bfd_get_reloc_size (reloc_howto_type *);
-
-DESCRIPTION
- For a reloc_howto_type that operates on a fixed number of bytes,
- this returns the number of bytes operated on.
- */
-
-unsigned int
-bfd_get_reloc_size (reloc_howto_type *howto)
-{
- switch (howto->size)
- {
- case 0: return 1;
- case 1: return 2;
- case 2: return 4;
- case 3: return 0;
- case 4: return 8;
- case 8: return 16;
- case -2: return 4;
- default: abort ();
- }
-}
-
-/*
-TYPEDEF
- arelent_chain
-
-DESCRIPTION
-
- How relocs are tied together in an <<asection>>:
-
-.typedef struct relent_chain
-.{
-. arelent relent;
-. struct relent_chain *next;
-.}
-.arelent_chain;
-.
-*/
-
-/* N_ONES produces N one bits, without overflowing machine arithmetic. */
-#define N_ONES(n) (((((bfd_vma) 1 << ((n) - 1)) - 1) << 1) | 1)
-
-/*
-FUNCTION
- bfd_check_overflow
-
-SYNOPSIS
- bfd_reloc_status_type bfd_check_overflow
- (enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
- bfd_vma relocation);
-
-DESCRIPTION
- Perform overflow checking on @var{relocation} which has
- @var{bitsize} significant bits and will be shifted right by
- @var{rightshift} bits, on a machine with addresses containing
- @var{addrsize} significant bits. The result is either of
- @code{bfd_reloc_ok} or @code{bfd_reloc_overflow}.
-
-*/
-
-bfd_reloc_status_type
-bfd_check_overflow (enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
- bfd_vma relocation)
-{
- bfd_vma fieldmask, addrmask, signmask, ss, a;
- bfd_reloc_status_type flag = bfd_reloc_ok;
-
- a = relocation;
-
- /* Note: BITSIZE should always be <= ADDRSIZE, but in case it's not,
- we'll be permissive: extra bits in the field mask will
- automatically extend the address mask for purposes of the
- overflow check. */
- fieldmask = N_ONES (bitsize);
- addrmask = N_ONES (addrsize) | fieldmask;
-
- switch (how)
- {
- case complain_overflow_dont:
- break;
-
- case complain_overflow_signed:
- /* If any sign bits are set, all sign bits must be set. That
- is, A must be a valid negative address after shifting. */
- a = (a & addrmask) >> rightshift;
- signmask = ~ (fieldmask >> 1);
- ss = a & signmask;
- if (ss != 0 && ss != ((addrmask >> rightshift) & signmask))
- flag = bfd_reloc_overflow;
- break;
-
- case complain_overflow_unsigned:
- /* We have an overflow if the address does not fit in the field. */
- a = (a & addrmask) >> rightshift;
- if ((a & ~ fieldmask) != 0)
- flag = bfd_reloc_overflow;
- break;
-
- case complain_overflow_bitfield:
- /* Bitfields are sometimes signed, sometimes unsigned. We
- explicitly allow an address wrap too, which means a bitfield
- of n bits is allowed to store -2**n to 2**n-1. Thus overflow
- if the value has some, but not all, bits set outside the
- field. */
- a >>= rightshift;
- ss = a & ~ fieldmask;
- if (ss != 0 && ss != (((bfd_vma) -1 >> rightshift) & ~ fieldmask))
- flag = bfd_reloc_overflow;
- break;
-
- default:
- abort ();
- }
-
- return flag;
-}
-
-/*
-FUNCTION
- bfd_perform_relocation
-
-SYNOPSIS
- bfd_reloc_status_type bfd_perform_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message);
-
-DESCRIPTION
- If @var{output_bfd} is supplied to this function, the
- generated image will be relocatable; the relocations are
- copied to the output file after they have been changed to
- reflect the new state of the world. There are two ways of
- reflecting the results of partial linkage in an output file:
- by modifying the output data in place, and by modifying the
- relocation record. Some native formats (e.g., basic a.out and
- basic coff) have no way of specifying an addend in the
- relocation type, so the addend has to go in the output data.
- This is no big deal since in these formats the output data
- slot will always be big enough for the addend. Complex reloc
- types with addends were invented to solve just this problem.
- The @var{error_message} argument is set to an error message if
- this return @code{bfd_reloc_dangerous}.
-
-*/
-
-bfd_reloc_status_type
-bfd_perform_relocation (bfd *abfd,
- arelent *reloc_entry,
- void *data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message)
-{
- bfd_vma relocation;
- bfd_reloc_status_type flag = bfd_reloc_ok;
- bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
- bfd_vma output_base = 0;
- reloc_howto_type *howto = reloc_entry->howto;
- asection *reloc_target_output_section;
- asymbol *symbol;
-
- symbol = *(reloc_entry->sym_ptr_ptr);
- if (bfd_is_abs_section (symbol->section)
- && output_bfd != NULL)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* If we are not producing relocatable output, return an error if
- the symbol is not defined. An undefined weak symbol is
- considered to have a value of zero (SVR4 ABI, p. 4-27). */
- if (bfd_is_und_section (symbol->section)
- && (symbol->flags & BSF_WEAK) == 0
- && output_bfd == NULL)
- flag = bfd_reloc_undefined;
-
- /* If there is a function supplied to handle this relocation type,
- call it. It'll return `bfd_reloc_continue' if further processing
- can be done. */
- if (howto->special_function)
- {
- bfd_reloc_status_type cont;
- cont = howto->special_function (abfd, reloc_entry, symbol, data,
- input_section, output_bfd,
- error_message);
- if (cont != bfd_reloc_continue)
- return cont;
- }
-
- /* Is the address of the relocation really within the section? */
- if (reloc_entry->address > (input_section->_cooked_size
- / bfd_octets_per_byte (abfd)))
- return bfd_reloc_outofrange;
-
- /* Work out which section the relocation is targeted at and the
- initial relocation command value. */
-
- /* Get symbol value. (Common symbols are special.) */
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- reloc_target_output_section = symbol->section->output_section;
-
- /* Convert input-section-relative symbol value to absolute. */
- if ((output_bfd && ! howto->partial_inplace)
- || reloc_target_output_section == NULL)
- output_base = 0;
- else
- output_base = reloc_target_output_section->vma;
-
- relocation += output_base + symbol->section->output_offset;
-
- /* Add in supplied addend. */
- relocation += reloc_entry->addend;
-
- /* Here the variable relocation holds the final address of the
- symbol we are relocating against, plus any addend. */
-
- if (howto->pc_relative)
- {
- /* This is a PC relative relocation. We want to set RELOCATION
- to the distance between the address of the symbol and the
- location. RELOCATION is already the address of the symbol.
-
- We start by subtracting the address of the section containing
- the location.
-
- If pcrel_offset is set, we must further subtract the position
- of the location within the section. Some targets arrange for
- the addend to be the negative of the position of the location
- within the section; for example, i386-aout does this. For
- i386-aout, pcrel_offset is FALSE. Some other targets do not
- include the position of the location; for example, m88kbcs,
- or ELF. For those targets, pcrel_offset is TRUE.
-
- If we are producing relocatable output, then we must ensure
- that this reloc will be correctly computed when the final
- relocation is done. If pcrel_offset is FALSE we want to wind
- up with the negative of the location within the section,
- which means we must adjust the existing addend by the change
- in the location within the section. If pcrel_offset is TRUE
- we do not want to adjust the existing addend at all.
-
- FIXME: This seems logical to me, but for the case of
- producing relocatable output it is not what the code
- actually does. I don't want to change it, because it seems
- far too likely that something will break. */
-
- relocation -=
- input_section->output_section->vma + input_section->output_offset;
-
- if (howto->pcrel_offset)
- relocation -= reloc_entry->address;
- }
-
- if (output_bfd != NULL)
- {
- if (! howto->partial_inplace)
- {
- /* This is a partial relocation, and we want to apply the relocation
- to the reloc entry rather than the raw data. Modify the reloc
- inplace to reflect what we now know. */
- reloc_entry->addend = relocation;
- reloc_entry->address += input_section->output_offset;
- return flag;
- }
- else
- {
- /* This is a partial relocation, but inplace, so modify the
- reloc record a bit.
-
- If we've relocated with a symbol with a section, change
- into a ref to the section belonging to the symbol. */
-
- reloc_entry->address += input_section->output_offset;
-
- /* WTF?? */
- if (abfd->xvec->flavour == bfd_target_coff_flavour
- && strcmp (abfd->xvec->name, "coff-Intel-little") != 0
- && strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
- {
-#if 1
- /* For m68k-coff, the addend was being subtracted twice during
- relocation with -r. Removing the line below this comment
- fixes that problem; see PR 2953.
-
-However, Ian wrote the following, regarding removing the line below,
-which explains why it is still enabled: --djm
-
-If you put a patch like that into BFD you need to check all the COFF
-linkers. I am fairly certain that patch will break coff-i386 (e.g.,
-SCO); see coff_i386_reloc in coff-i386.c where I worked around the
-problem in a different way. There may very well be a reason that the
-code works as it does.
-
-Hmmm. The first obvious point is that bfd_perform_relocation should
-not have any tests that depend upon the flavour. It's seem like
-entirely the wrong place for such a thing. The second obvious point
-is that the current code ignores the reloc addend when producing
-relocatable output for COFF. That's peculiar. In fact, I really
-have no idea what the point of the line you want to remove is.
-
-A typical COFF reloc subtracts the old value of the symbol and adds in
-the new value to the location in the object file (if it's a pc
-relative reloc it adds the difference between the symbol value and the
-location). When relocating we need to preserve that property.
-
-BFD handles this by setting the addend to the negative of the old
-value of the symbol. Unfortunately it handles common symbols in a
-non-standard way (it doesn't subtract the old value) but that's a
-different story (we can't change it without losing backward
-compatibility with old object files) (coff-i386 does subtract the old
-value, to be compatible with existing coff-i386 targets, like SCO).
-
-So everything works fine when not producing relocatable output. When
-we are producing relocatable output, logically we should do exactly
-what we do when not producing relocatable output. Therefore, your
-patch is correct. In fact, it should probably always just set
-reloc_entry->addend to 0 for all cases, since it is, in fact, going to
-add the value into the object file. This won't hurt the COFF code,
-which doesn't use the addend; I'm not sure what it will do to other
-formats (the thing to check for would be whether any formats both use
-the addend and set partial_inplace).
-
-When I wanted to make coff-i386 produce relocatable output, I ran
-into the problem that you are running into: I wanted to remove that
-line. Rather than risk it, I made the coff-i386 relocs use a special
-function; it's coff_i386_reloc in coff-i386.c. The function
-specifically adds the addend field into the object file, knowing that
-bfd_perform_relocation is not going to. If you remove that line, then
-coff-i386.c will wind up adding the addend field in twice. It's
-trivial to fix; it just needs to be done.
-
-The problem with removing the line is just that it may break some
-working code. With BFD it's hard to be sure of anything. The right
-way to deal with this is simply to build and test at least all the
-supported COFF targets. It should be straightforward if time and disk
-space consuming. For each target:
- 1) build the linker
- 2) generate some executable, and link it using -r (I would
- probably use paranoia.o and link against newlib/libc.a, which
- for all the supported targets would be available in
- /usr/cygnus/progressive/H-host/target/lib/libc.a).
- 3) make the change to reloc.c
- 4) rebuild the linker
- 5) repeat step 2
- 6) if the resulting object files are the same, you have at least
- made it no worse
- 7) if they are different you have to figure out which version is
- right
-*/
- relocation -= reloc_entry->addend;
-#endif
- reloc_entry->addend = 0;
- }
- else
- {
- reloc_entry->addend = relocation;
- }
- }
- }
- else
- {
- reloc_entry->addend = 0;
- }
-
- /* FIXME: This overflow checking is incomplete, because the value
- might have overflowed before we get here. For a correct check we
- need to compute the value in a size larger than bitsize, but we
- can't reasonably do that for a reloc the same size as a host
- machine word.
- FIXME: We should also do overflow checking on the result after
- adding in the value contained in the object file. */
- if (howto->complain_on_overflow != complain_overflow_dont
- && flag == bfd_reloc_ok)
- flag = bfd_check_overflow (howto->complain_on_overflow,
- howto->bitsize,
- howto->rightshift,
- bfd_arch_bits_per_address (abfd),
- relocation);
-
- /* Either we are relocating all the way, or we don't want to apply
- the relocation to the reloc entry (probably because there isn't
- any room in the output format to describe addends to relocs). */
-
- /* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler
- (OSF version 1.3, compiler version 3.11). It miscompiles the
- following program:
-
- struct str
- {
- unsigned int i0;
- } s = { 0 };
-
- int
- main ()
- {
- unsigned long x;
-
- x = 0x100000000;
- x <<= (unsigned long) s.i0;
- if (x == 0)
- printf ("failed\n");
- else
- printf ("succeeded (%lx)\n", x);
- }
- */
-
- relocation >>= (bfd_vma) howto->rightshift;
-
- /* Shift everything up to where it's going to be used. */
- relocation <<= (bfd_vma) howto->bitpos;
-
- /* Wait for the day when all have the mask in them. */
-
- /* What we do:
- i instruction to be left alone
- o offset within instruction
- r relocation offset to apply
- S src mask
- D dst mask
- N ~dst mask
- A part 1
- B part 2
- R result
-
- Do this:
- (( i i i i i o o o o o from bfd_get<size>
- and S S S S S) to get the size offset we want
- + r r r r r r r r r r) to get the final value to place
- and D D D D D to chop to right size
- -----------------------
- = A A A A A
- And this:
- ( i i i i i o o o o o from bfd_get<size>
- and N N N N N ) get instruction
- -----------------------
- = B B B B B
-
- And then:
- ( B B B B B
- or A A A A A)
- -----------------------
- = R R R R R R R R R R put into bfd_put<size>
- */
-
-#define DOIT(x) \
- x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask))
-
- switch (howto->size)
- {
- case 0:
- {
- char x = bfd_get_8 (abfd, (char *) data + octets);
- DOIT (x);
- bfd_put_8 (abfd, x, (unsigned char *) data + octets);
- }
- break;
-
- case 1:
- {
- short x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
- DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, (unsigned char *) data + octets);
- }
- break;
- case 2:
- {
- long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data + octets);
- }
- break;
- case -2:
- {
- long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
- relocation = -relocation;
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data + octets);
- }
- break;
-
- case -1:
- {
- long x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
- relocation = -relocation;
- DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, (bfd_byte *) data + octets);
- }
- break;
-
- case 3:
- /* Do nothing */
- break;
-
- case 4:
-#ifdef BFD64
- {
- bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + octets);
- DOIT (x);
- bfd_put_64 (abfd, x, (bfd_byte *) data + octets);
- }
-#else
- abort ();
-#endif
- break;
- default:
- return bfd_reloc_other;
- }
-
- return flag;
-}
-
-/*
-FUNCTION
- bfd_install_relocation
-
-SYNOPSIS
- bfd_reloc_status_type bfd_install_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data, bfd_vma data_start,
- asection *input_section,
- char **error_message);
-
-DESCRIPTION
- This looks remarkably like <<bfd_perform_relocation>>, except it
- does not expect that the section contents have been filled in.
- I.e., it's suitable for use when creating, rather than applying
- a relocation.
-
- For now, this function should be considered reserved for the
- assembler.
-*/
-
-bfd_reloc_status_type
-bfd_install_relocation (bfd *abfd,
- arelent *reloc_entry,
- void *data_start,
- bfd_vma data_start_offset,
- asection *input_section,
- char **error_message)
-{
- bfd_vma relocation;
- bfd_reloc_status_type flag = bfd_reloc_ok;
- bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
- bfd_vma output_base = 0;
- reloc_howto_type *howto = reloc_entry->howto;
- asection *reloc_target_output_section;
- asymbol *symbol;
- bfd_byte *data;
-
- symbol = *(reloc_entry->sym_ptr_ptr);
- if (bfd_is_abs_section (symbol->section))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* If there is a function supplied to handle this relocation type,
- call it. It'll return `bfd_reloc_continue' if further processing
- can be done. */
- if (howto->special_function)
- {
- bfd_reloc_status_type cont;
-
- /* XXX - The special_function calls haven't been fixed up to deal
- with creating new relocations and section contents. */
- cont = howto->special_function (abfd, reloc_entry, symbol,
- /* XXX - Non-portable! */
- ((bfd_byte *) data_start
- - data_start_offset),
- input_section, abfd, error_message);
- if (cont != bfd_reloc_continue)
- return cont;
- }
-
- /* Is the address of the relocation really within the section? */
- if (reloc_entry->address > (input_section->_cooked_size
- / bfd_octets_per_byte (abfd)))
- return bfd_reloc_outofrange;
-
- /* Work out which section the relocation is targeted at and the
- initial relocation command value. */
-
- /* Get symbol value. (Common symbols are special.) */
- if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
- relocation = symbol->value;
-
- reloc_target_output_section = symbol->section->output_section;
-
- /* Convert input-section-relative symbol value to absolute. */
- if (! howto->partial_inplace)
- output_base = 0;
- else
- output_base = reloc_target_output_section->vma;
-
- relocation += output_base + symbol->section->output_offset;
-
- /* Add in supplied addend. */
- relocation += reloc_entry->addend;
-
- /* Here the variable relocation holds the final address of the
- symbol we are relocating against, plus any addend. */
-
- if (howto->pc_relative)
- {
- /* This is a PC relative relocation. We want to set RELOCATION
- to the distance between the address of the symbol and the
- location. RELOCATION is already the address of the symbol.
-
- We start by subtracting the address of the section containing
- the location.
-
- If pcrel_offset is set, we must further subtract the position
- of the location within the section. Some targets arrange for
- the addend to be the negative of the position of the location
- within the section; for example, i386-aout does this. For
- i386-aout, pcrel_offset is FALSE. Some other targets do not
- include the position of the location; for example, m88kbcs,
- or ELF. For those targets, pcrel_offset is TRUE.
-
- If we are producing relocatable output, then we must ensure
- that this reloc will be correctly computed when the final
- relocation is done. If pcrel_offset is FALSE we want to wind
- up with the negative of the location within the section,
- which means we must adjust the existing addend by the change
- in the location within the section. If pcrel_offset is TRUE
- we do not want to adjust the existing addend at all.
-
- FIXME: This seems logical to me, but for the case of
- producing relocatable output it is not what the code
- actually does. I don't want to change it, because it seems
- far too likely that something will break. */
-
- relocation -=
- input_section->output_section->vma + input_section->output_offset;
-
- if (howto->pcrel_offset && howto->partial_inplace)
- relocation -= reloc_entry->address;
- }
-
- if (! howto->partial_inplace)
- {
- /* This is a partial relocation, and we want to apply the relocation
- to the reloc entry rather than the raw data. Modify the reloc
- inplace to reflect what we now know. */
- reloc_entry->addend = relocation;
- reloc_entry->address += input_section->output_offset;
- return flag;
- }
- else
- {
- /* This is a partial relocation, but inplace, so modify the
- reloc record a bit.
-
- If we've relocated with a symbol with a section, change
- into a ref to the section belonging to the symbol. */
- reloc_entry->address += input_section->output_offset;
-
- /* WTF?? */
- if (abfd->xvec->flavour == bfd_target_coff_flavour
- && strcmp (abfd->xvec->name, "coff-Intel-little") != 0
- && strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
- {
-#if 1
-/* For m68k-coff, the addend was being subtracted twice during
- relocation with -r. Removing the line below this comment
- fixes that problem; see PR 2953.
-
-However, Ian wrote the following, regarding removing the line below,
-which explains why it is still enabled: --djm
-
-If you put a patch like that into BFD you need to check all the COFF
-linkers. I am fairly certain that patch will break coff-i386 (e.g.,
-SCO); see coff_i386_reloc in coff-i386.c where I worked around the
-problem in a different way. There may very well be a reason that the
-code works as it does.
-
-Hmmm. The first obvious point is that bfd_install_relocation should
-not have any tests that depend upon the flavour. It's seem like
-entirely the wrong place for such a thing. The second obvious point
-is that the current code ignores the reloc addend when producing
-relocatable output for COFF. That's peculiar. In fact, I really
-have no idea what the point of the line you want to remove is.
-
-A typical COFF reloc subtracts the old value of the symbol and adds in
-the new value to the location in the object file (if it's a pc
-relative reloc it adds the difference between the symbol value and the
-location). When relocating we need to preserve that property.
-
-BFD handles this by setting the addend to the negative of the old
-value of the symbol. Unfortunately it handles common symbols in a
-non-standard way (it doesn't subtract the old value) but that's a
-different story (we can't change it without losing backward
-compatibility with old object files) (coff-i386 does subtract the old
-value, to be compatible with existing coff-i386 targets, like SCO).
-
-So everything works fine when not producing relocatable output. When
-we are producing relocatable output, logically we should do exactly
-what we do when not producing relocatable output. Therefore, your
-patch is correct. In fact, it should probably always just set
-reloc_entry->addend to 0 for all cases, since it is, in fact, going to
-add the value into the object file. This won't hurt the COFF code,
-which doesn't use the addend; I'm not sure what it will do to other
-formats (the thing to check for would be whether any formats both use
-the addend and set partial_inplace).
-
-When I wanted to make coff-i386 produce relocatable output, I ran
-into the problem that you are running into: I wanted to remove that
-line. Rather than risk it, I made the coff-i386 relocs use a special
-function; it's coff_i386_reloc in coff-i386.c. The function
-specifically adds the addend field into the object file, knowing that
-bfd_install_relocation is not going to. If you remove that line, then
-coff-i386.c will wind up adding the addend field in twice. It's
-trivial to fix; it just needs to be done.
-
-The problem with removing the line is just that it may break some
-working code. With BFD it's hard to be sure of anything. The right
-way to deal with this is simply to build and test at least all the
-supported COFF targets. It should be straightforward if time and disk
-space consuming. For each target:
- 1) build the linker
- 2) generate some executable, and link it using -r (I would
- probably use paranoia.o and link against newlib/libc.a, which
- for all the supported targets would be available in
- /usr/cygnus/progressive/H-host/target/lib/libc.a).
- 3) make the change to reloc.c
- 4) rebuild the linker
- 5) repeat step 2
- 6) if the resulting object files are the same, you have at least
- made it no worse
- 7) if they are different you have to figure out which version is
- right. */
- relocation -= reloc_entry->addend;
-#endif
- reloc_entry->addend = 0;
- }
- else
- {
- reloc_entry->addend = relocation;
- }
- }
-
- /* FIXME: This overflow checking is incomplete, because the value
- might have overflowed before we get here. For a correct check we
- need to compute the value in a size larger than bitsize, but we
- can't reasonably do that for a reloc the same size as a host
- machine word.
- FIXME: We should also do overflow checking on the result after
- adding in the value contained in the object file. */
- if (howto->complain_on_overflow != complain_overflow_dont)
- flag = bfd_check_overflow (howto->complain_on_overflow,
- howto->bitsize,
- howto->rightshift,
- bfd_arch_bits_per_address (abfd),
- relocation);
-
- /* Either we are relocating all the way, or we don't want to apply
- the relocation to the reloc entry (probably because there isn't
- any room in the output format to describe addends to relocs). */
-
- /* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler
- (OSF version 1.3, compiler version 3.11). It miscompiles the
- following program:
-
- struct str
- {
- unsigned int i0;
- } s = { 0 };
-
- int
- main ()
- {
- unsigned long x;
-
- x = 0x100000000;
- x <<= (unsigned long) s.i0;
- if (x == 0)
- printf ("failed\n");
- else
- printf ("succeeded (%lx)\n", x);
- }
- */
-
- relocation >>= (bfd_vma) howto->rightshift;
-
- /* Shift everything up to where it's going to be used. */
- relocation <<= (bfd_vma) howto->bitpos;
-
- /* Wait for the day when all have the mask in them. */
-
- /* What we do:
- i instruction to be left alone
- o offset within instruction
- r relocation offset to apply
- S src mask
- D dst mask
- N ~dst mask
- A part 1
- B part 2
- R result
-
- Do this:
- (( i i i i i o o o o o from bfd_get<size>
- and S S S S S) to get the size offset we want
- + r r r r r r r r r r) to get the final value to place
- and D D D D D to chop to right size
- -----------------------
- = A A A A A
- And this:
- ( i i i i i o o o o o from bfd_get<size>
- and N N N N N ) get instruction
- -----------------------
- = B B B B B
-
- And then:
- ( B B B B B
- or A A A A A)
- -----------------------
- = R R R R R R R R R R put into bfd_put<size>
- */
-
-#define DOIT(x) \
- x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask))
-
- data = (bfd_byte *) data_start + (octets - data_start_offset);
-
- switch (howto->size)
- {
- case 0:
- {
- char x = bfd_get_8 (abfd, data);
- DOIT (x);
- bfd_put_8 (abfd, x, data);
- }
- break;
-
- case 1:
- {
- short x = bfd_get_16 (abfd, data);
- DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, data);
- }
- break;
- case 2:
- {
- long x = bfd_get_32 (abfd, data);
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, data);
- }
- break;
- case -2:
- {
- long x = bfd_get_32 (abfd, data);
- relocation = -relocation;
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, data);
- }
- break;
-
- case 3:
- /* Do nothing */
- break;
-
- case 4:
- {
- bfd_vma x = bfd_get_64 (abfd, data);
- DOIT (x);
- bfd_put_64 (abfd, x, data);
- }
- break;
- default:
- return bfd_reloc_other;
- }
-
- return flag;
-}
-
-/* This relocation routine is used by some of the backend linkers.
- They do not construct asymbol or arelent structures, so there is no
- reason for them to use bfd_perform_relocation. Also,
- bfd_perform_relocation is so hacked up it is easier to write a new
- function than to try to deal with it.
-
- This routine does a final relocation. Whether it is useful for a
- relocatable link depends upon how the object format defines
- relocations.
-
- FIXME: This routine ignores any special_function in the HOWTO,
- since the existing special_function values have been written for
- bfd_perform_relocation.
-
- HOWTO is the reloc howto information.
- INPUT_BFD is the BFD which the reloc applies to.
- INPUT_SECTION is the section which the reloc applies to.
- CONTENTS is the contents of the section.
- ADDRESS is the address of the reloc within INPUT_SECTION.
- VALUE is the value of the symbol the reloc refers to.
- ADDEND is the addend of the reloc. */
-
-bfd_reloc_status_type
-_bfd_final_link_relocate (reloc_howto_type *howto,
- bfd *input_bfd,
- asection *input_section,
- bfd_byte *contents,
- bfd_vma address,
- bfd_vma value,
- bfd_vma addend)
-{
- bfd_vma relocation;
-
- /* Sanity check the address. */
- if (address > input_section->_raw_size)
- return bfd_reloc_outofrange;
-
- /* This function assumes that we are dealing with a basic relocation
- against a symbol. We want to compute the value of the symbol to
- relocate to. This is just VALUE, the value of the symbol, plus
- ADDEND, any addend associated with the reloc. */
- relocation = value + addend;
-
- /* If the relocation is PC relative, we want to set RELOCATION to
- the distance between the symbol (currently in RELOCATION) and the
- location we are relocating. Some targets (e.g., i386-aout)
- arrange for the contents of the section to be the negative of the
- offset of the location within the section; for such targets
- pcrel_offset is FALSE. Other targets (e.g., m88kbcs or ELF)
- simply leave the contents of the section as zero; for such
- targets pcrel_offset is TRUE. If pcrel_offset is FALSE we do not
- need to subtract out the offset of the location within the
- section (which is just ADDRESS). */
- if (howto->pc_relative)
- {
- relocation -= (input_section->output_section->vma
- + input_section->output_offset);
- if (howto->pcrel_offset)
- relocation -= address;
- }
-
- return _bfd_relocate_contents (howto, input_bfd, relocation,
- contents + address);
-}
-
-/* Relocate a given location using a given value and howto. */
-
-bfd_reloc_status_type
-_bfd_relocate_contents (reloc_howto_type *howto,
- bfd *input_bfd,
- bfd_vma relocation,
- bfd_byte *location)
-{
- int size;
- bfd_vma x = 0;
- bfd_reloc_status_type flag;
- unsigned int rightshift = howto->rightshift;
- unsigned int bitpos = howto->bitpos;
-
- /* If the size is negative, negate RELOCATION. This isn't very
- general. */
- if (howto->size < 0)
- relocation = -relocation;
-
- /* Get the value we are going to relocate. */
- size = bfd_get_reloc_size (howto);
- switch (size)
- {
- default:
- case 0:
- abort ();
- case 1:
- x = bfd_get_8 (input_bfd, location);
- break;
- case 2:
- x = bfd_get_16 (input_bfd, location);
- break;
- case 4:
- x = bfd_get_32 (input_bfd, location);
- break;
- case 8:
-#ifdef BFD64
- x = bfd_get_64 (input_bfd, location);
-#else
- abort ();
-#endif
- break;
- }
-
- /* Check for overflow. FIXME: We may drop bits during the addition
- which we don't check for. We must either check at every single
- operation, which would be tedious, or we must do the computations
- in a type larger than bfd_vma, which would be inefficient. */
- flag = bfd_reloc_ok;
- if (howto->complain_on_overflow != complain_overflow_dont)
- {
- bfd_vma addrmask, fieldmask, signmask, ss;
- bfd_vma a, b, sum;
-
- /* Get the values to be added together. For signed and unsigned
- relocations, we assume that all values should be truncated to
- the size of an address. For bitfields, all the bits matter.
- See also bfd_check_overflow. */
- fieldmask = N_ONES (howto->bitsize);
- addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
- a = relocation;
- b = x & howto->src_mask;
-
- switch (howto->complain_on_overflow)
- {
- case complain_overflow_signed:
- a = (a & addrmask) >> rightshift;
-
- /* If any sign bits are set, all sign bits must be set.
- That is, A must be a valid negative address after
- shifting. */
- signmask = ~ (fieldmask >> 1);
- ss = a & signmask;
- if (ss != 0 && ss != ((addrmask >> rightshift) & signmask))
- flag = bfd_reloc_overflow;
-
- /* We only need this next bit of code if the sign bit of B
- is below the sign bit of A. This would only happen if
- SRC_MASK had fewer bits than BITSIZE. Note that if
- SRC_MASK has more bits than BITSIZE, we can get into
- trouble; we would need to verify that B is in range, as
- we do for A above. */
- signmask = ((~ howto->src_mask) >> 1) & howto->src_mask;
-
- /* Set all the bits above the sign bit. */
- b = (b ^ signmask) - signmask;
-
- b = (b & addrmask) >> bitpos;
-
- /* Now we can do the addition. */
- sum = a + b;
-
- /* See if the result has the correct sign. Bits above the
- sign bit are junk now; ignore them. If the sum is
- positive, make sure we did not have all negative inputs;
- if the sum is negative, make sure we did not have all
- positive inputs. The test below looks only at the sign
- bits, and it really just
- SIGN (A) == SIGN (B) && SIGN (A) != SIGN (SUM)
- */
- signmask = (fieldmask >> 1) + 1;
- if (((~ (a ^ b)) & (a ^ sum)) & signmask)
- flag = bfd_reloc_overflow;
-
- break;
-
- case complain_overflow_unsigned:
- /* Checking for an unsigned overflow is relatively easy:
- trim the addresses and add, and trim the result as well.
- Overflow is normally indicated when the result does not
- fit in the field. However, we also need to consider the
- case when, e.g., fieldmask is 0x7fffffff or smaller, an
- input is 0x80000000, and bfd_vma is only 32 bits; then we
- will get sum == 0, but there is an overflow, since the
- inputs did not fit in the field. Instead of doing a
- separate test, we can check for this by or-ing in the
- operands when testing for the sum overflowing its final
- field. */
- a = (a & addrmask) >> rightshift;
- b = (b & addrmask) >> bitpos;
- sum = (a + b) & addrmask;
- if ((a | b | sum) & ~ fieldmask)
- flag = bfd_reloc_overflow;
-
- break;
-
- case complain_overflow_bitfield:
- /* Much like the signed check, but for a field one bit
- wider, and no trimming inputs with addrmask. We allow a
- bitfield to represent numbers in the range -2**n to
- 2**n-1, where n is the number of bits in the field.
- Note that when bfd_vma is 32 bits, a 32-bit reloc can't
- overflow, which is exactly what we want. */
- a >>= rightshift;
-
- signmask = ~ fieldmask;
- ss = a & signmask;
- if (ss != 0 && ss != (((bfd_vma) -1 >> rightshift) & signmask))
- flag = bfd_reloc_overflow;
-
- signmask = ((~ howto->src_mask) >> 1) & howto->src_mask;
- b = (b ^ signmask) - signmask;
-
- b >>= bitpos;
-
- sum = a + b;
-
- /* We mask with addrmask here to explicitly allow an address
- wrap-around. The Linux kernel relies on it, and it is
- the only way to write assembler code which can run when
- loaded at a location 0x80000000 away from the location at
- which it is linked. */
- signmask = fieldmask + 1;
- if (((~ (a ^ b)) & (a ^ sum)) & signmask & addrmask)
- flag = bfd_reloc_overflow;
-
- break;
-
- default:
- abort ();
- }
- }
-
- /* Put RELOCATION in the right bits. */
- relocation >>= (bfd_vma) rightshift;
- relocation <<= (bfd_vma) bitpos;
-
- /* Add RELOCATION to the right bits of X. */
- x = ((x & ~howto->dst_mask)
- | (((x & howto->src_mask) + relocation) & howto->dst_mask));
-
- /* Put the relocated value back in the object file. */
- switch (size)
- {
- default:
- case 0:
- abort ();
- case 1:
- bfd_put_8 (input_bfd, x, location);
- break;
- case 2:
- bfd_put_16 (input_bfd, x, location);
- break;
- case 4:
- bfd_put_32 (input_bfd, x, location);
- break;
- case 8:
-#ifdef BFD64
- bfd_put_64 (input_bfd, x, location);
-#else
- abort ();
-#endif
- break;
- }
-
- return flag;
-}
-
-/*
-DOCDD
-INODE
- howto manager, , typedef arelent, Relocations
-
-SECTION
- The howto manager
-
- When an application wants to create a relocation, but doesn't
- know what the target machine might call it, it can find out by
- using this bit of code.
-
-*/
-
-/*
-TYPEDEF
- bfd_reloc_code_type
-
-DESCRIPTION
- The insides of a reloc code. The idea is that, eventually, there
- will be one enumerator for every type of relocation we ever do.
- Pass one of these values to <<bfd_reloc_type_lookup>>, and it'll
- return a howto pointer.
-
- This does mean that the application must determine the correct
- enumerator value; you can't get a howto pointer from a random set
- of attributes.
-
-SENUM
- bfd_reloc_code_real
-
-ENUM
- BFD_RELOC_64
-ENUMX
- BFD_RELOC_32
-ENUMX
- BFD_RELOC_26
-ENUMX
- BFD_RELOC_24
-ENUMX
- BFD_RELOC_16
-ENUMX
- BFD_RELOC_14
-ENUMX
- BFD_RELOC_8
-ENUMDOC
- Basic absolute relocations of N bits.
-
-ENUM
- BFD_RELOC_64_PCREL
-ENUMX
- BFD_RELOC_32_PCREL
-ENUMX
- BFD_RELOC_24_PCREL
-ENUMX
- BFD_RELOC_16_PCREL
-ENUMX
- BFD_RELOC_12_PCREL
-ENUMX
- BFD_RELOC_8_PCREL
-ENUMDOC
- PC-relative relocations. Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation. It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations.
-
-ENUM
- BFD_RELOC_32_GOT_PCREL
-ENUMX
- BFD_RELOC_16_GOT_PCREL
-ENUMX
- BFD_RELOC_8_GOT_PCREL
-ENUMX
- BFD_RELOC_32_GOTOFF
-ENUMX
- BFD_RELOC_16_GOTOFF
-ENUMX
- BFD_RELOC_LO16_GOTOFF
-ENUMX
- BFD_RELOC_HI16_GOTOFF
-ENUMX
- BFD_RELOC_HI16_S_GOTOFF
-ENUMX
- BFD_RELOC_8_GOTOFF
-ENUMX
- BFD_RELOC_64_PLT_PCREL
-ENUMX
- BFD_RELOC_32_PLT_PCREL
-ENUMX
- BFD_RELOC_24_PLT_PCREL
-ENUMX
- BFD_RELOC_16_PLT_PCREL
-ENUMX
- BFD_RELOC_8_PLT_PCREL
-ENUMX
- BFD_RELOC_64_PLTOFF
-ENUMX
- BFD_RELOC_32_PLTOFF
-ENUMX
- BFD_RELOC_16_PLTOFF
-ENUMX
- BFD_RELOC_LO16_PLTOFF
-ENUMX
- BFD_RELOC_HI16_PLTOFF
-ENUMX
- BFD_RELOC_HI16_S_PLTOFF
-ENUMX
- BFD_RELOC_8_PLTOFF
-ENUMDOC
- For ELF.
-
-ENUM
- BFD_RELOC_68K_GLOB_DAT
-ENUMX
- BFD_RELOC_68K_JMP_SLOT
-ENUMX
- BFD_RELOC_68K_RELATIVE
-ENUMDOC
- Relocations used by 68K ELF.
-
-ENUM
- BFD_RELOC_32_BASEREL
-ENUMX
- BFD_RELOC_16_BASEREL
-ENUMX
- BFD_RELOC_LO16_BASEREL
-ENUMX
- BFD_RELOC_HI16_BASEREL
-ENUMX
- BFD_RELOC_HI16_S_BASEREL
-ENUMX
- BFD_RELOC_8_BASEREL
-ENUMX
- BFD_RELOC_RVA
-ENUMDOC
- Linkage-table relative.
-
-ENUM
- BFD_RELOC_8_FFnn
-ENUMDOC
- Absolute 8-bit relocation, but used to form an address like 0xFFnn.
-
-ENUM
- BFD_RELOC_32_PCREL_S2
-ENUMX
- BFD_RELOC_16_PCREL_S2
-ENUMX
- BFD_RELOC_23_PCREL_S2
-ENUMDOC
- These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits. The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha.
-
-ENUM
- BFD_RELOC_HI22
-ENUMX
- BFD_RELOC_LO10
-ENUMDOC
- High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word. These are used on the SPARC.
-
-ENUM
- BFD_RELOC_GPREL16
-ENUMX
- BFD_RELOC_GPREL32
-ENUMDOC
- For systems that allocate a Global Pointer register, these are
-displacements off that register. These relocation types are
-handled specially, because the value the register will have is
-decided relatively late.
-
-ENUM
- BFD_RELOC_I960_CALLJ
-ENUMDOC
- Reloc types used for i960/b.out.
-
-ENUM
- BFD_RELOC_NONE
-ENUMX
- BFD_RELOC_SPARC_WDISP22
-ENUMX
- BFD_RELOC_SPARC22
-ENUMX
- BFD_RELOC_SPARC13
-ENUMX
- BFD_RELOC_SPARC_GOT10
-ENUMX
- BFD_RELOC_SPARC_GOT13
-ENUMX
- BFD_RELOC_SPARC_GOT22
-ENUMX
- BFD_RELOC_SPARC_PC10
-ENUMX
- BFD_RELOC_SPARC_PC22
-ENUMX
- BFD_RELOC_SPARC_WPLT30
-ENUMX
- BFD_RELOC_SPARC_COPY
-ENUMX
- BFD_RELOC_SPARC_GLOB_DAT
-ENUMX
- BFD_RELOC_SPARC_JMP_SLOT
-ENUMX
- BFD_RELOC_SPARC_RELATIVE
-ENUMX
- BFD_RELOC_SPARC_UA16
-ENUMX
- BFD_RELOC_SPARC_UA32
-ENUMX
- BFD_RELOC_SPARC_UA64
-ENUMDOC
- SPARC ELF relocations. There is probably some overlap with other
- relocation types already defined.
-
-ENUM
- BFD_RELOC_SPARC_BASE13
-ENUMX
- BFD_RELOC_SPARC_BASE22
-ENUMDOC
- I think these are specific to SPARC a.out (e.g., Sun 4).
-
-ENUMEQ
- BFD_RELOC_SPARC_64
- BFD_RELOC_64
-ENUMX
- BFD_RELOC_SPARC_10
-ENUMX
- BFD_RELOC_SPARC_11
-ENUMX
- BFD_RELOC_SPARC_OLO10
-ENUMX
- BFD_RELOC_SPARC_HH22
-ENUMX
- BFD_RELOC_SPARC_HM10
-ENUMX
- BFD_RELOC_SPARC_LM22
-ENUMX
- BFD_RELOC_SPARC_PC_HH22
-ENUMX
- BFD_RELOC_SPARC_PC_HM10
-ENUMX
- BFD_RELOC_SPARC_PC_LM22
-ENUMX
- BFD_RELOC_SPARC_WDISP16
-ENUMX
- BFD_RELOC_SPARC_WDISP19
-ENUMX
- BFD_RELOC_SPARC_7
-ENUMX
- BFD_RELOC_SPARC_6
-ENUMX
- BFD_RELOC_SPARC_5
-ENUMEQX
- BFD_RELOC_SPARC_DISP64
- BFD_RELOC_64_PCREL
-ENUMX
- BFD_RELOC_SPARC_PLT32
-ENUMX
- BFD_RELOC_SPARC_PLT64
-ENUMX
- BFD_RELOC_SPARC_HIX22
-ENUMX
- BFD_RELOC_SPARC_LOX10
-ENUMX
- BFD_RELOC_SPARC_H44
-ENUMX
- BFD_RELOC_SPARC_M44
-ENUMX
- BFD_RELOC_SPARC_L44
-ENUMX
- BFD_RELOC_SPARC_REGISTER
-ENUMDOC
- SPARC64 relocations
-
-ENUM
- BFD_RELOC_SPARC_REV32
-ENUMDOC
- SPARC little endian relocation
-ENUM
- BFD_RELOC_SPARC_TLS_GD_HI22
-ENUMX
- BFD_RELOC_SPARC_TLS_GD_LO10
-ENUMX
- BFD_RELOC_SPARC_TLS_GD_ADD
-ENUMX
- BFD_RELOC_SPARC_TLS_GD_CALL
-ENUMX
- BFD_RELOC_SPARC_TLS_LDM_HI22
-ENUMX
- BFD_RELOC_SPARC_TLS_LDM_LO10
-ENUMX
- BFD_RELOC_SPARC_TLS_LDM_ADD
-ENUMX
- BFD_RELOC_SPARC_TLS_LDM_CALL
-ENUMX
- BFD_RELOC_SPARC_TLS_LDO_HIX22
-ENUMX
- BFD_RELOC_SPARC_TLS_LDO_LOX10
-ENUMX
- BFD_RELOC_SPARC_TLS_LDO_ADD
-ENUMX
- BFD_RELOC_SPARC_TLS_IE_HI22
-ENUMX
- BFD_RELOC_SPARC_TLS_IE_LO10
-ENUMX
- BFD_RELOC_SPARC_TLS_IE_LD
-ENUMX
- BFD_RELOC_SPARC_TLS_IE_LDX
-ENUMX
- BFD_RELOC_SPARC_TLS_IE_ADD
-ENUMX
- BFD_RELOC_SPARC_TLS_LE_HIX22
-ENUMX
- BFD_RELOC_SPARC_TLS_LE_LOX10
-ENUMX
- BFD_RELOC_SPARC_TLS_DTPMOD32
-ENUMX
- BFD_RELOC_SPARC_TLS_DTPMOD64
-ENUMX
- BFD_RELOC_SPARC_TLS_DTPOFF32
-ENUMX
- BFD_RELOC_SPARC_TLS_DTPOFF64
-ENUMX
- BFD_RELOC_SPARC_TLS_TPOFF32
-ENUMX
- BFD_RELOC_SPARC_TLS_TPOFF64
-ENUMDOC
- SPARC TLS relocations
-
-ENUM
- BFD_RELOC_ALPHA_GPDISP_HI16
-ENUMDOC
- Alpha ECOFF and ELF relocations. Some of these treat the symbol or
- "addend" in some special way.
- For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
- writing; when reading, it will be the absolute section symbol. The
- addend is the displacement in bytes of the "lda" instruction from
- the "ldah" instruction (which is at the address of this reloc).
-ENUM
- BFD_RELOC_ALPHA_GPDISP_LO16
-ENUMDOC
- For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
- with GPDISP_HI16 relocs. The addend is ignored when writing the
- relocations out, and is filled in with the file's GP value on
- reading, for convenience.
-
-ENUM
- BFD_RELOC_ALPHA_GPDISP
-ENUMDOC
- The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
- relocation except that there is no accompanying GPDISP_LO16
- relocation.
-
-ENUM
- BFD_RELOC_ALPHA_LITERAL
-ENUMX
- BFD_RELOC_ALPHA_ELF_LITERAL
-ENUMX
- BFD_RELOC_ALPHA_LITUSE
-ENUMDOC
- The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
- the assembler turns it into a LDQ instruction to load the address of
- the symbol, and then fills in a register in the real instruction.
-
- The LITERAL reloc, at the LDQ instruction, refers to the .lita
- section symbol. The addend is ignored when writing, but is filled
- in with the file's GP value on reading, for convenience, as with the
- GPDISP_LO16 reloc.
-
- The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
- It should refer to the symbol to be referenced, as with 16_GOTOFF,
- but it generates output not based on the position within the .got
- section, but relative to the GP value chosen for the file during the
- final link stage.
-
- The LITUSE reloc, on the instruction using the loaded address, gives
- information to the linker that it might be able to use to optimize
- away some literal section references. The symbol is ignored (read
- as the absolute section symbol), and the "addend" indicates the type
- of instruction using the register:
- 1 - "memory" fmt insn
- 2 - byte-manipulation (byte offset reg)
- 3 - jsr (target of branch)
-
-ENUM
- BFD_RELOC_ALPHA_HINT
-ENUMDOC
- The HINT relocation indicates a value that should be filled into the
- "hint" field of a jmp/jsr/ret instruction, for possible branch-
- prediction logic which may be provided on some processors.
-
-ENUM
- BFD_RELOC_ALPHA_LINKAGE
-ENUMDOC
- The LINKAGE relocation outputs a linkage pair in the object file,
- which is filled by the linker.
-
-ENUM
- BFD_RELOC_ALPHA_CODEADDR
-ENUMDOC
- The CODEADDR relocation outputs a STO_CA in the object file,
- which is filled by the linker.
-
-ENUM
- BFD_RELOC_ALPHA_GPREL_HI16
-ENUMX
- BFD_RELOC_ALPHA_GPREL_LO16
-ENUMDOC
- The GPREL_HI/LO relocations together form a 32-bit offset from the
- GP register.
-
-ENUM
- BFD_RELOC_ALPHA_BRSGP
-ENUMDOC
- Like BFD_RELOC_23_PCREL_S2, except that the source and target must
- share a common GP, and the target address is adjusted for
- STO_ALPHA_STD_GPLOAD.
-
-ENUM
- BFD_RELOC_ALPHA_TLSGD
-ENUMX
- BFD_RELOC_ALPHA_TLSLDM
-ENUMX
- BFD_RELOC_ALPHA_DTPMOD64
-ENUMX
- BFD_RELOC_ALPHA_GOTDTPREL16
-ENUMX
- BFD_RELOC_ALPHA_DTPREL64
-ENUMX
- BFD_RELOC_ALPHA_DTPREL_HI16
-ENUMX
- BFD_RELOC_ALPHA_DTPREL_LO16
-ENUMX
- BFD_RELOC_ALPHA_DTPREL16
-ENUMX
- BFD_RELOC_ALPHA_GOTTPREL16
-ENUMX
- BFD_RELOC_ALPHA_TPREL64
-ENUMX
- BFD_RELOC_ALPHA_TPREL_HI16
-ENUMX
- BFD_RELOC_ALPHA_TPREL_LO16
-ENUMX
- BFD_RELOC_ALPHA_TPREL16
-ENUMDOC
- Alpha thread-local storage relocations.
-
-ENUM
- BFD_RELOC_MIPS_JMP
-ENUMDOC
- Bits 27..2 of the relocation address shifted right 2 bits;
- simple reloc otherwise.
-
-ENUM
- BFD_RELOC_MIPS16_JMP
-ENUMDOC
- The MIPS16 jump instruction.
-
-ENUM
- BFD_RELOC_MIPS16_GPREL
-ENUMDOC
- MIPS16 GP relative reloc.
-
-ENUM
- BFD_RELOC_HI16
-ENUMDOC
- High 16 bits of 32-bit value; simple reloc.
-ENUM
- BFD_RELOC_HI16_S
-ENUMDOC
- High 16 bits of 32-bit value but the low 16 bits will be sign
- extended and added to form the final result. If the low 16
- bits form a negative number, we need to add one to the high value
- to compensate for the borrow when the low bits are added.
-ENUM
- BFD_RELOC_LO16
-ENUMDOC
- Low 16 bits.
-ENUM
- BFD_RELOC_PCREL_HI16_S
-ENUMDOC
- Like BFD_RELOC_HI16_S, but PC relative.
-ENUM
- BFD_RELOC_PCREL_LO16
-ENUMDOC
- Like BFD_RELOC_LO16, but PC relative.
-
-ENUM
- BFD_RELOC_MIPS_LITERAL
-ENUMDOC
- Relocation against a MIPS literal section.
-
-ENUM
- BFD_RELOC_MIPS_GOT16
-ENUMX
- BFD_RELOC_MIPS_CALL16
-ENUMX
- BFD_RELOC_MIPS_GOT_HI16
-ENUMX
- BFD_RELOC_MIPS_GOT_LO16
-ENUMX
- BFD_RELOC_MIPS_CALL_HI16
-ENUMX
- BFD_RELOC_MIPS_CALL_LO16
-ENUMX
- BFD_RELOC_MIPS_SUB
-ENUMX
- BFD_RELOC_MIPS_GOT_PAGE
-ENUMX
- BFD_RELOC_MIPS_GOT_OFST
-ENUMX
- BFD_RELOC_MIPS_GOT_DISP
-ENUMX
- BFD_RELOC_MIPS_SHIFT5
-ENUMX
- BFD_RELOC_MIPS_SHIFT6
-ENUMX
- BFD_RELOC_MIPS_INSERT_A
-ENUMX
- BFD_RELOC_MIPS_INSERT_B
-ENUMX
- BFD_RELOC_MIPS_DELETE
-ENUMX
- BFD_RELOC_MIPS_HIGHEST
-ENUMX
- BFD_RELOC_MIPS_HIGHER
-ENUMX
- BFD_RELOC_MIPS_SCN_DISP
-ENUMX
- BFD_RELOC_MIPS_REL16
-ENUMX
- BFD_RELOC_MIPS_RELGOT
-ENUMX
- BFD_RELOC_MIPS_JALR
-ENUMDOC
- MIPS ELF relocations.
-COMMENT
-
-ENUM
- BFD_RELOC_FRV_LABEL16
-ENUMX
- BFD_RELOC_FRV_LABEL24
-ENUMX
- BFD_RELOC_FRV_LO16
-ENUMX
- BFD_RELOC_FRV_HI16
-ENUMX
- BFD_RELOC_FRV_GPREL12
-ENUMX
- BFD_RELOC_FRV_GPRELU12
-ENUMX
- BFD_RELOC_FRV_GPREL32
-ENUMX
- BFD_RELOC_FRV_GPRELHI
-ENUMX
- BFD_RELOC_FRV_GPRELLO
-ENUMX
- BFD_RELOC_FRV_GOT12
-ENUMX
- BFD_RELOC_FRV_GOTHI
-ENUMX
- BFD_RELOC_FRV_GOTLO
-ENUMX
- BFD_RELOC_FRV_FUNCDESC
-ENUMX
- BFD_RELOC_FRV_FUNCDESC_GOT12
-ENUMX
- BFD_RELOC_FRV_FUNCDESC_GOTHI
-ENUMX
- BFD_RELOC_FRV_FUNCDESC_GOTLO
-ENUMX
- BFD_RELOC_FRV_FUNCDESC_VALUE
-ENUMX
- BFD_RELOC_FRV_FUNCDESC_GOTOFF12
-ENUMX
- BFD_RELOC_FRV_FUNCDESC_GOTOFFHI
-ENUMX
- BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
-ENUMX
- BFD_RELOC_FRV_GOTOFF12
-ENUMX
- BFD_RELOC_FRV_GOTOFFHI
-ENUMX
- BFD_RELOC_FRV_GOTOFFLO
-ENUMDOC
- Fujitsu Frv Relocations.
-COMMENT
-
-ENUM
- BFD_RELOC_MN10300_GOTOFF24
-ENUMDOC
- This is a 24bit GOT-relative reloc for the mn10300.
-ENUM
- BFD_RELOC_MN10300_GOT32
-ENUMDOC
- This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
- in the instruction.
-ENUM
- BFD_RELOC_MN10300_GOT24
-ENUMDOC
- This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
- in the instruction.
-ENUM
- BFD_RELOC_MN10300_GOT16
-ENUMDOC
- This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
- in the instruction.
-ENUM
- BFD_RELOC_MN10300_COPY
-ENUMDOC
- Copy symbol at runtime.
-ENUM
- BFD_RELOC_MN10300_GLOB_DAT
-ENUMDOC
- Create GOT entry.
-ENUM
- BFD_RELOC_MN10300_JMP_SLOT
-ENUMDOC
- Create PLT entry.
-ENUM
- BFD_RELOC_MN10300_RELATIVE
-ENUMDOC
- Adjust by program base.
-COMMENT
-
-ENUM
- BFD_RELOC_386_GOT32
-ENUMX
- BFD_RELOC_386_PLT32
-ENUMX
- BFD_RELOC_386_COPY
-ENUMX
- BFD_RELOC_386_GLOB_DAT
-ENUMX
- BFD_RELOC_386_JUMP_SLOT
-ENUMX
- BFD_RELOC_386_RELATIVE
-ENUMX
- BFD_RELOC_386_GOTOFF
-ENUMX
- BFD_RELOC_386_GOTPC
-ENUMX
- BFD_RELOC_386_TLS_TPOFF
-ENUMX
- BFD_RELOC_386_TLS_IE
-ENUMX
- BFD_RELOC_386_TLS_GOTIE
-ENUMX
- BFD_RELOC_386_TLS_LE
-ENUMX
- BFD_RELOC_386_TLS_GD
-ENUMX
- BFD_RELOC_386_TLS_LDM
-ENUMX
- BFD_RELOC_386_TLS_LDO_32
-ENUMX
- BFD_RELOC_386_TLS_IE_32
-ENUMX
- BFD_RELOC_386_TLS_LE_32
-ENUMX
- BFD_RELOC_386_TLS_DTPMOD32
-ENUMX
- BFD_RELOC_386_TLS_DTPOFF32
-ENUMX
- BFD_RELOC_386_TLS_TPOFF32
-ENUMDOC
- i386/elf relocations
-
-ENUM
- BFD_RELOC_X86_64_GOT32
-ENUMX
- BFD_RELOC_X86_64_PLT32
-ENUMX
- BFD_RELOC_X86_64_COPY
-ENUMX
- BFD_RELOC_X86_64_GLOB_DAT
-ENUMX
- BFD_RELOC_X86_64_JUMP_SLOT
-ENUMX
- BFD_RELOC_X86_64_RELATIVE
-ENUMX
- BFD_RELOC_X86_64_GOTPCREL
-ENUMX
- BFD_RELOC_X86_64_32S
-ENUMX
- BFD_RELOC_X86_64_DTPMOD64
-ENUMX
- BFD_RELOC_X86_64_DTPOFF64
-ENUMX
- BFD_RELOC_X86_64_TPOFF64
-ENUMX
- BFD_RELOC_X86_64_TLSGD
-ENUMX
- BFD_RELOC_X86_64_TLSLD
-ENUMX
- BFD_RELOC_X86_64_DTPOFF32
-ENUMX
- BFD_RELOC_X86_64_GOTTPOFF
-ENUMX
- BFD_RELOC_X86_64_TPOFF32
-ENUMDOC
- x86-64/elf relocations
-
-ENUM
- BFD_RELOC_NS32K_IMM_8
-ENUMX
- BFD_RELOC_NS32K_IMM_16
-ENUMX
- BFD_RELOC_NS32K_IMM_32
-ENUMX
- BFD_RELOC_NS32K_IMM_8_PCREL
-ENUMX
- BFD_RELOC_NS32K_IMM_16_PCREL
-ENUMX
- BFD_RELOC_NS32K_IMM_32_PCREL
-ENUMX
- BFD_RELOC_NS32K_DISP_8
-ENUMX
- BFD_RELOC_NS32K_DISP_16
-ENUMX
- BFD_RELOC_NS32K_DISP_32
-ENUMX
- BFD_RELOC_NS32K_DISP_8_PCREL
-ENUMX
- BFD_RELOC_NS32K_DISP_16_PCREL
-ENUMX
- BFD_RELOC_NS32K_DISP_32_PCREL
-ENUMDOC
- ns32k relocations
-
-ENUM
- BFD_RELOC_PDP11_DISP_8_PCREL
-ENUMX
- BFD_RELOC_PDP11_DISP_6_PCREL
-ENUMDOC
- PDP11 relocations
-
-ENUM
- BFD_RELOC_PJ_CODE_HI16
-ENUMX
- BFD_RELOC_PJ_CODE_LO16
-ENUMX
- BFD_RELOC_PJ_CODE_DIR16
-ENUMX
- BFD_RELOC_PJ_CODE_DIR32
-ENUMX
- BFD_RELOC_PJ_CODE_REL16
-ENUMX
- BFD_RELOC_PJ_CODE_REL32
-ENUMDOC
- Picojava relocs. Not all of these appear in object files.
-
-ENUM
- BFD_RELOC_PPC_B26
-ENUMX
- BFD_RELOC_PPC_BA26
-ENUMX
- BFD_RELOC_PPC_TOC16
-ENUMX
- BFD_RELOC_PPC_B16
-ENUMX
- BFD_RELOC_PPC_B16_BRTAKEN
-ENUMX
- BFD_RELOC_PPC_B16_BRNTAKEN
-ENUMX
- BFD_RELOC_PPC_BA16
-ENUMX
- BFD_RELOC_PPC_BA16_BRTAKEN
-ENUMX
- BFD_RELOC_PPC_BA16_BRNTAKEN
-ENUMX
- BFD_RELOC_PPC_COPY
-ENUMX
- BFD_RELOC_PPC_GLOB_DAT
-ENUMX
- BFD_RELOC_PPC_JMP_SLOT
-ENUMX
- BFD_RELOC_PPC_RELATIVE
-ENUMX
- BFD_RELOC_PPC_LOCAL24PC
-ENUMX
- BFD_RELOC_PPC_EMB_NADDR32
-ENUMX
- BFD_RELOC_PPC_EMB_NADDR16
-ENUMX
- BFD_RELOC_PPC_EMB_NADDR16_LO
-ENUMX
- BFD_RELOC_PPC_EMB_NADDR16_HI
-ENUMX
- BFD_RELOC_PPC_EMB_NADDR16_HA
-ENUMX
- BFD_RELOC_PPC_EMB_SDAI16
-ENUMX
- BFD_RELOC_PPC_EMB_SDA2I16
-ENUMX
- BFD_RELOC_PPC_EMB_SDA2REL
-ENUMX
- BFD_RELOC_PPC_EMB_SDA21
-ENUMX
- BFD_RELOC_PPC_EMB_MRKREF
-ENUMX
- BFD_RELOC_PPC_EMB_RELSEC16
-ENUMX
- BFD_RELOC_PPC_EMB_RELST_LO
-ENUMX
- BFD_RELOC_PPC_EMB_RELST_HI
-ENUMX
- BFD_RELOC_PPC_EMB_RELST_HA
-ENUMX
- BFD_RELOC_PPC_EMB_BIT_FLD
-ENUMX
- BFD_RELOC_PPC_EMB_RELSDA
-ENUMX
- BFD_RELOC_PPC64_HIGHER
-ENUMX
- BFD_RELOC_PPC64_HIGHER_S
-ENUMX
- BFD_RELOC_PPC64_HIGHEST
-ENUMX
- BFD_RELOC_PPC64_HIGHEST_S
-ENUMX
- BFD_RELOC_PPC64_TOC16_LO
-ENUMX
- BFD_RELOC_PPC64_TOC16_HI
-ENUMX
- BFD_RELOC_PPC64_TOC16_HA
-ENUMX
- BFD_RELOC_PPC64_TOC
-ENUMX
- BFD_RELOC_PPC64_PLTGOT16
-ENUMX
- BFD_RELOC_PPC64_PLTGOT16_LO
-ENUMX
- BFD_RELOC_PPC64_PLTGOT16_HI
-ENUMX
- BFD_RELOC_PPC64_PLTGOT16_HA
-ENUMX
- BFD_RELOC_PPC64_ADDR16_DS
-ENUMX
- BFD_RELOC_PPC64_ADDR16_LO_DS
-ENUMX
- BFD_RELOC_PPC64_GOT16_DS
-ENUMX
- BFD_RELOC_PPC64_GOT16_LO_DS
-ENUMX
- BFD_RELOC_PPC64_PLT16_LO_DS
-ENUMX
- BFD_RELOC_PPC64_SECTOFF_DS
-ENUMX
- BFD_RELOC_PPC64_SECTOFF_LO_DS
-ENUMX
- BFD_RELOC_PPC64_TOC16_DS
-ENUMX
- BFD_RELOC_PPC64_TOC16_LO_DS
-ENUMX
- BFD_RELOC_PPC64_PLTGOT16_DS
-ENUMX
- BFD_RELOC_PPC64_PLTGOT16_LO_DS
-ENUMDOC
- Power(rs6000) and PowerPC relocations.
-
-ENUM
- BFD_RELOC_PPC_TLS
-ENUMX
- BFD_RELOC_PPC_DTPMOD
-ENUMX
- BFD_RELOC_PPC_TPREL16
-ENUMX
- BFD_RELOC_PPC_TPREL16_LO
-ENUMX
- BFD_RELOC_PPC_TPREL16_HI
-ENUMX
- BFD_RELOC_PPC_TPREL16_HA
-ENUMX
- BFD_RELOC_PPC_TPREL
-ENUMX
- BFD_RELOC_PPC_DTPREL16
-ENUMX
- BFD_RELOC_PPC_DTPREL16_LO
-ENUMX
- BFD_RELOC_PPC_DTPREL16_HI
-ENUMX
- BFD_RELOC_PPC_DTPREL16_HA
-ENUMX
- BFD_RELOC_PPC_DTPREL
-ENUMX
- BFD_RELOC_PPC_GOT_TLSGD16
-ENUMX
- BFD_RELOC_PPC_GOT_TLSGD16_LO
-ENUMX
- BFD_RELOC_PPC_GOT_TLSGD16_HI
-ENUMX
- BFD_RELOC_PPC_GOT_TLSGD16_HA
-ENUMX
- BFD_RELOC_PPC_GOT_TLSLD16
-ENUMX
- BFD_RELOC_PPC_GOT_TLSLD16_LO
-ENUMX
- BFD_RELOC_PPC_GOT_TLSLD16_HI
-ENUMX
- BFD_RELOC_PPC_GOT_TLSLD16_HA
-ENUMX
- BFD_RELOC_PPC_GOT_TPREL16
-ENUMX
- BFD_RELOC_PPC_GOT_TPREL16_LO
-ENUMX
- BFD_RELOC_PPC_GOT_TPREL16_HI
-ENUMX
- BFD_RELOC_PPC_GOT_TPREL16_HA
-ENUMX
- BFD_RELOC_PPC_GOT_DTPREL16
-ENUMX
- BFD_RELOC_PPC_GOT_DTPREL16_LO
-ENUMX
- BFD_RELOC_PPC_GOT_DTPREL16_HI
-ENUMX
- BFD_RELOC_PPC_GOT_DTPREL16_HA
-ENUMX
- BFD_RELOC_PPC64_TPREL16_DS
-ENUMX
- BFD_RELOC_PPC64_TPREL16_LO_DS
-ENUMX
- BFD_RELOC_PPC64_TPREL16_HIGHER
-ENUMX
- BFD_RELOC_PPC64_TPREL16_HIGHERA
-ENUMX
- BFD_RELOC_PPC64_TPREL16_HIGHEST
-ENUMX
- BFD_RELOC_PPC64_TPREL16_HIGHESTA
-ENUMX
- BFD_RELOC_PPC64_DTPREL16_DS
-ENUMX
- BFD_RELOC_PPC64_DTPREL16_LO_DS
-ENUMX
- BFD_RELOC_PPC64_DTPREL16_HIGHER
-ENUMX
- BFD_RELOC_PPC64_DTPREL16_HIGHERA
-ENUMX
- BFD_RELOC_PPC64_DTPREL16_HIGHEST
-ENUMX
- BFD_RELOC_PPC64_DTPREL16_HIGHESTA
-ENUMDOC
- PowerPC and PowerPC64 thread-local storage relocations.
-
-ENUM
- BFD_RELOC_I370_D12
-ENUMDOC
- IBM 370/390 relocations
-
-ENUM
- BFD_RELOC_CTOR
-ENUMDOC
- The type of reloc used to build a constructor table - at the moment
- probably a 32 bit wide absolute relocation, but the target can choose.
- It generally does map to one of the other relocation types.
-
-ENUM
- BFD_RELOC_ARM_PCREL_BRANCH
-ENUMDOC
- ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
- not stored in the instruction.
-ENUM
- BFD_RELOC_ARM_PCREL_BLX
-ENUMDOC
- ARM 26 bit pc-relative branch. The lowest bit must be zero and is
- not stored in the instruction. The 2nd lowest bit comes from a 1 bit
- field in the instruction.
-ENUM
- BFD_RELOC_THUMB_PCREL_BLX
-ENUMDOC
- Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
- not stored in the instruction. The 2nd lowest bit comes from a 1 bit
- field in the instruction.
-ENUM
- BFD_RELOC_ARM_IMMEDIATE
-ENUMX
- BFD_RELOC_ARM_ADRL_IMMEDIATE
-ENUMX
- BFD_RELOC_ARM_OFFSET_IMM
-ENUMX
- BFD_RELOC_ARM_SHIFT_IMM
-ENUMX
- BFD_RELOC_ARM_SWI
-ENUMX
- BFD_RELOC_ARM_MULTI
-ENUMX
- BFD_RELOC_ARM_CP_OFF_IMM
-ENUMX
- BFD_RELOC_ARM_CP_OFF_IMM_S2
-ENUMX
- BFD_RELOC_ARM_ADR_IMM
-ENUMX
- BFD_RELOC_ARM_LDR_IMM
-ENUMX
- BFD_RELOC_ARM_LITERAL
-ENUMX
- BFD_RELOC_ARM_IN_POOL
-ENUMX
- BFD_RELOC_ARM_OFFSET_IMM8
-ENUMX
- BFD_RELOC_ARM_HWLITERAL
-ENUMX
- BFD_RELOC_ARM_THUMB_ADD
-ENUMX
- BFD_RELOC_ARM_THUMB_IMM
-ENUMX
- BFD_RELOC_ARM_THUMB_SHIFT
-ENUMX
- BFD_RELOC_ARM_THUMB_OFFSET
-ENUMX
- BFD_RELOC_ARM_GOT12
-ENUMX
- BFD_RELOC_ARM_GOT32
-ENUMX
- BFD_RELOC_ARM_JUMP_SLOT
-ENUMX
- BFD_RELOC_ARM_COPY
-ENUMX
- BFD_RELOC_ARM_GLOB_DAT
-ENUMX
- BFD_RELOC_ARM_PLT32
-ENUMX
- BFD_RELOC_ARM_RELATIVE
-ENUMX
- BFD_RELOC_ARM_GOTOFF
-ENUMX
- BFD_RELOC_ARM_GOTPC
-ENUMDOC
- These relocs are only used within the ARM assembler. They are not
- (at present) written to any object files.
-
-ENUM
- BFD_RELOC_SH_PCDISP8BY2
-ENUMX
- BFD_RELOC_SH_PCDISP12BY2
-ENUMX
- BFD_RELOC_SH_IMM4
-ENUMX
- BFD_RELOC_SH_IMM4BY2
-ENUMX
- BFD_RELOC_SH_IMM4BY4
-ENUMX
- BFD_RELOC_SH_IMM8
-ENUMX
- BFD_RELOC_SH_IMM8BY2
-ENUMX
- BFD_RELOC_SH_IMM8BY4
-ENUMX
- BFD_RELOC_SH_PCRELIMM8BY2
-ENUMX
- BFD_RELOC_SH_PCRELIMM8BY4
-ENUMX
- BFD_RELOC_SH_SWITCH16
-ENUMX
- BFD_RELOC_SH_SWITCH32
-ENUMX
- BFD_RELOC_SH_USES
-ENUMX
- BFD_RELOC_SH_COUNT
-ENUMX
- BFD_RELOC_SH_ALIGN
-ENUMX
- BFD_RELOC_SH_CODE
-ENUMX
- BFD_RELOC_SH_DATA
-ENUMX
- BFD_RELOC_SH_LABEL
-ENUMX
- BFD_RELOC_SH_LOOP_START
-ENUMX
- BFD_RELOC_SH_LOOP_END
-ENUMX
- BFD_RELOC_SH_COPY
-ENUMX
- BFD_RELOC_SH_GLOB_DAT
-ENUMX
- BFD_RELOC_SH_JMP_SLOT
-ENUMX
- BFD_RELOC_SH_RELATIVE
-ENUMX
- BFD_RELOC_SH_GOTPC
-ENUMX
- BFD_RELOC_SH_GOT_LOW16
-ENUMX
- BFD_RELOC_SH_GOT_MEDLOW16
-ENUMX
- BFD_RELOC_SH_GOT_MEDHI16
-ENUMX
- BFD_RELOC_SH_GOT_HI16
-ENUMX
- BFD_RELOC_SH_GOTPLT_LOW16
-ENUMX
- BFD_RELOC_SH_GOTPLT_MEDLOW16
-ENUMX
- BFD_RELOC_SH_GOTPLT_MEDHI16
-ENUMX
- BFD_RELOC_SH_GOTPLT_HI16
-ENUMX
- BFD_RELOC_SH_PLT_LOW16
-ENUMX
- BFD_RELOC_SH_PLT_MEDLOW16
-ENUMX
- BFD_RELOC_SH_PLT_MEDHI16
-ENUMX
- BFD_RELOC_SH_PLT_HI16
-ENUMX
- BFD_RELOC_SH_GOTOFF_LOW16
-ENUMX
- BFD_RELOC_SH_GOTOFF_MEDLOW16
-ENUMX
- BFD_RELOC_SH_GOTOFF_MEDHI16
-ENUMX
- BFD_RELOC_SH_GOTOFF_HI16
-ENUMX
- BFD_RELOC_SH_GOTPC_LOW16
-ENUMX
- BFD_RELOC_SH_GOTPC_MEDLOW16
-ENUMX
- BFD_RELOC_SH_GOTPC_MEDHI16
-ENUMX
- BFD_RELOC_SH_GOTPC_HI16
-ENUMX
- BFD_RELOC_SH_COPY64
-ENUMX
- BFD_RELOC_SH_GLOB_DAT64
-ENUMX
- BFD_RELOC_SH_JMP_SLOT64
-ENUMX
- BFD_RELOC_SH_RELATIVE64
-ENUMX
- BFD_RELOC_SH_GOT10BY4
-ENUMX
- BFD_RELOC_SH_GOT10BY8
-ENUMX
- BFD_RELOC_SH_GOTPLT10BY4
-ENUMX
- BFD_RELOC_SH_GOTPLT10BY8
-ENUMX
- BFD_RELOC_SH_GOTPLT32
-ENUMX
- BFD_RELOC_SH_SHMEDIA_CODE
-ENUMX
- BFD_RELOC_SH_IMMU5
-ENUMX
- BFD_RELOC_SH_IMMS6
-ENUMX
- BFD_RELOC_SH_IMMS6BY32
-ENUMX
- BFD_RELOC_SH_IMMU6
-ENUMX
- BFD_RELOC_SH_IMMS10
-ENUMX
- BFD_RELOC_SH_IMMS10BY2
-ENUMX
- BFD_RELOC_SH_IMMS10BY4
-ENUMX
- BFD_RELOC_SH_IMMS10BY8
-ENUMX
- BFD_RELOC_SH_IMMS16
-ENUMX
- BFD_RELOC_SH_IMMU16
-ENUMX
- BFD_RELOC_SH_IMM_LOW16
-ENUMX
- BFD_RELOC_SH_IMM_LOW16_PCREL
-ENUMX
- BFD_RELOC_SH_IMM_MEDLOW16
-ENUMX
- BFD_RELOC_SH_IMM_MEDLOW16_PCREL
-ENUMX
- BFD_RELOC_SH_IMM_MEDHI16
-ENUMX
- BFD_RELOC_SH_IMM_MEDHI16_PCREL
-ENUMX
- BFD_RELOC_SH_IMM_HI16
-ENUMX
- BFD_RELOC_SH_IMM_HI16_PCREL
-ENUMX
- BFD_RELOC_SH_PT_16
-ENUMX
- BFD_RELOC_SH_TLS_GD_32
-ENUMX
- BFD_RELOC_SH_TLS_LD_32
-ENUMX
- BFD_RELOC_SH_TLS_LDO_32
-ENUMX
- BFD_RELOC_SH_TLS_IE_32
-ENUMX
- BFD_RELOC_SH_TLS_LE_32
-ENUMX
- BFD_RELOC_SH_TLS_DTPMOD32
-ENUMX
- BFD_RELOC_SH_TLS_DTPOFF32
-ENUMX
- BFD_RELOC_SH_TLS_TPOFF32
-ENUMDOC
- Renesas / SuperH SH relocs. Not all of these appear in object files.
-
-ENUM
- BFD_RELOC_THUMB_PCREL_BRANCH9
-ENUMX
- BFD_RELOC_THUMB_PCREL_BRANCH12
-ENUMX
- BFD_RELOC_THUMB_PCREL_BRANCH23
-ENUMDOC
- Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must
- be zero and is not stored in the instruction.
-
-ENUM
- BFD_RELOC_ARC_B22_PCREL
-ENUMDOC
- ARC Cores relocs.
- ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
- not stored in the instruction. The high 20 bits are installed in bits 26
- through 7 of the instruction.
-ENUM
- BFD_RELOC_ARC_B26
-ENUMDOC
- ARC 26 bit absolute branch. The lowest two bits must be zero and are not
- stored in the instruction. The high 24 bits are installed in bits 23
- through 0.
-
-ENUM
- BFD_RELOC_D10V_10_PCREL_R
-ENUMDOC
- Mitsubishi D10V relocs.
- This is a 10-bit reloc with the right 2 bits
- assumed to be 0.
-ENUM
- BFD_RELOC_D10V_10_PCREL_L
-ENUMDOC
- Mitsubishi D10V relocs.
- This is a 10-bit reloc with the right 2 bits
- assumed to be 0. This is the same as the previous reloc
- except it is in the left container, i.e.,
- shifted left 15 bits.
-ENUM
- BFD_RELOC_D10V_18
-ENUMDOC
- This is an 18-bit reloc with the right 2 bits
- assumed to be 0.
-ENUM
- BFD_RELOC_D10V_18_PCREL
-ENUMDOC
- This is an 18-bit reloc with the right 2 bits
- assumed to be 0.
-
-ENUM
- BFD_RELOC_D30V_6
-ENUMDOC
- Mitsubishi D30V relocs.
- This is a 6-bit absolute reloc.
-ENUM
- BFD_RELOC_D30V_9_PCREL
-ENUMDOC
- This is a 6-bit pc-relative reloc with
- the right 3 bits assumed to be 0.
-ENUM
- BFD_RELOC_D30V_9_PCREL_R
-ENUMDOC
- This is a 6-bit pc-relative reloc with
- the right 3 bits assumed to be 0. Same
- as the previous reloc but on the right side
- of the container.
-ENUM
- BFD_RELOC_D30V_15
-ENUMDOC
- This is a 12-bit absolute reloc with the
- right 3 bitsassumed to be 0.
-ENUM
- BFD_RELOC_D30V_15_PCREL
-ENUMDOC
- This is a 12-bit pc-relative reloc with
- the right 3 bits assumed to be 0.
-ENUM
- BFD_RELOC_D30V_15_PCREL_R
-ENUMDOC
- This is a 12-bit pc-relative reloc with
- the right 3 bits assumed to be 0. Same
- as the previous reloc but on the right side
- of the container.
-ENUM
- BFD_RELOC_D30V_21
-ENUMDOC
- This is an 18-bit absolute reloc with
- the right 3 bits assumed to be 0.
-ENUM
- BFD_RELOC_D30V_21_PCREL
-ENUMDOC
- This is an 18-bit pc-relative reloc with
- the right 3 bits assumed to be 0.
-ENUM
- BFD_RELOC_D30V_21_PCREL_R
-ENUMDOC
- This is an 18-bit pc-relative reloc with
- the right 3 bits assumed to be 0. Same
- as the previous reloc but on the right side
- of the container.
-ENUM
- BFD_RELOC_D30V_32
-ENUMDOC
- This is a 32-bit absolute reloc.
-ENUM
- BFD_RELOC_D30V_32_PCREL
-ENUMDOC
- This is a 32-bit pc-relative reloc.
-
-ENUM
- BFD_RELOC_DLX_HI16_S
-ENUMDOC
- DLX relocs
-ENUM
- BFD_RELOC_DLX_LO16
-ENUMDOC
- DLX relocs
-ENUM
- BFD_RELOC_DLX_JMP26
-ENUMDOC
- DLX relocs
-
-ENUM
- BFD_RELOC_M32R_24
-ENUMDOC
- Renesas M32R (formerly Mitsubishi M32R) relocs.
- This is a 24 bit absolute address.
-ENUM
- BFD_RELOC_M32R_10_PCREL
-ENUMDOC
- This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.
-ENUM
- BFD_RELOC_M32R_18_PCREL
-ENUMDOC
- This is an 18-bit reloc with the right 2 bits assumed to be 0.
-ENUM
- BFD_RELOC_M32R_26_PCREL
-ENUMDOC
- This is a 26-bit reloc with the right 2 bits assumed to be 0.
-ENUM
- BFD_RELOC_M32R_HI16_ULO
-ENUMDOC
- This is a 16-bit reloc containing the high 16 bits of an address
- used when the lower 16 bits are treated as unsigned.
-ENUM
- BFD_RELOC_M32R_HI16_SLO
-ENUMDOC
- This is a 16-bit reloc containing the high 16 bits of an address
- used when the lower 16 bits are treated as signed.
-ENUM
- BFD_RELOC_M32R_LO16
-ENUMDOC
- This is a 16-bit reloc containing the lower 16 bits of an address.
-ENUM
- BFD_RELOC_M32R_SDA16
-ENUMDOC
- This is a 16-bit reloc containing the small data area offset for use in
- add3, load, and store instructions.
-ENUM
- BFD_RELOC_M32R_GOT24
-ENUMX
- BFD_RELOC_M32R_26_PLTREL
-ENUMX
- BFD_RELOC_M32R_COPY
-ENUMX
- BFD_RELOC_M32R_GLOB_DAT
-ENUMX
- BFD_RELOC_M32R_JMP_SLOT
-ENUMX
- BFD_RELOC_M32R_RELATIVE
-ENUMX
- BFD_RELOC_M32R_GOTOFF
-ENUMX
- BFD_RELOC_M32R_GOTPC24
-ENUMX
- BFD_RELOC_M32R_GOT16_HI_ULO
-ENUMX
- BFD_RELOC_M32R_GOT16_HI_SLO
-ENUMX
- BFD_RELOC_M32R_GOT16_LO
-ENUMX
- BFD_RELOC_M32R_GOTPC_HI_ULO
-ENUMX
- BFD_RELOC_M32R_GOTPC_HI_SLO
-ENUMX
- BFD_RELOC_M32R_GOTPC_LO
-ENUMDOC
- For PIC.
-
-
-ENUM
- BFD_RELOC_V850_9_PCREL
-ENUMDOC
- This is a 9-bit reloc
-ENUM
- BFD_RELOC_V850_22_PCREL
-ENUMDOC
- This is a 22-bit reloc
-
-ENUM
- BFD_RELOC_V850_SDA_16_16_OFFSET
-ENUMDOC
- This is a 16 bit offset from the short data area pointer.
-ENUM
- BFD_RELOC_V850_SDA_15_16_OFFSET
-ENUMDOC
- This is a 16 bit offset (of which only 15 bits are used) from the
- short data area pointer.
-ENUM
- BFD_RELOC_V850_ZDA_16_16_OFFSET
-ENUMDOC
- This is a 16 bit offset from the zero data area pointer.
-ENUM
- BFD_RELOC_V850_ZDA_15_16_OFFSET
-ENUMDOC
- This is a 16 bit offset (of which only 15 bits are used) from the
- zero data area pointer.
-ENUM
- BFD_RELOC_V850_TDA_6_8_OFFSET
-ENUMDOC
- This is an 8 bit offset (of which only 6 bits are used) from the
- tiny data area pointer.
-ENUM
- BFD_RELOC_V850_TDA_7_8_OFFSET
-ENUMDOC
- This is an 8bit offset (of which only 7 bits are used) from the tiny
- data area pointer.
-ENUM
- BFD_RELOC_V850_TDA_7_7_OFFSET
-ENUMDOC
- This is a 7 bit offset from the tiny data area pointer.
-ENUM
- BFD_RELOC_V850_TDA_16_16_OFFSET
-ENUMDOC
- This is a 16 bit offset from the tiny data area pointer.
-COMMENT
-ENUM
- BFD_RELOC_V850_TDA_4_5_OFFSET
-ENUMDOC
- This is a 5 bit offset (of which only 4 bits are used) from the tiny
- data area pointer.
-ENUM
- BFD_RELOC_V850_TDA_4_4_OFFSET
-ENUMDOC
- This is a 4 bit offset from the tiny data area pointer.
-ENUM
- BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
-ENUMDOC
- This is a 16 bit offset from the short data area pointer, with the
- bits placed non-contiguously in the instruction.
-ENUM
- BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
-ENUMDOC
- This is a 16 bit offset from the zero data area pointer, with the
- bits placed non-contiguously in the instruction.
-ENUM
- BFD_RELOC_V850_CALLT_6_7_OFFSET
-ENUMDOC
- This is a 6 bit offset from the call table base pointer.
-ENUM
- BFD_RELOC_V850_CALLT_16_16_OFFSET
-ENUMDOC
- This is a 16 bit offset from the call table base pointer.
-ENUM
- BFD_RELOC_V850_LONGCALL
-ENUMDOC
- Used for relaxing indirect function calls.
-ENUM
- BFD_RELOC_V850_LONGJUMP
-ENUMDOC
- Used for relaxing indirect jumps.
-ENUM
- BFD_RELOC_V850_ALIGN
-ENUMDOC
- Used to maintain alignment whilst relaxing.
-ENUM
- BFD_RELOC_MN10300_32_PCREL
-ENUMDOC
- This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
- instruction.
-ENUM
- BFD_RELOC_MN10300_16_PCREL
-ENUMDOC
- This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
- instruction.
-
-ENUM
- BFD_RELOC_TIC30_LDP
-ENUMDOC
- This is a 8bit DP reloc for the tms320c30, where the most
- significant 8 bits of a 24 bit word are placed into the least
- significant 8 bits of the opcode.
-
-ENUM
- BFD_RELOC_TIC54X_PARTLS7
-ENUMDOC
- This is a 7bit reloc for the tms320c54x, where the least
- significant 7 bits of a 16 bit word are placed into the least
- significant 7 bits of the opcode.
-
-ENUM
- BFD_RELOC_TIC54X_PARTMS9
-ENUMDOC
- This is a 9bit DP reloc for the tms320c54x, where the most
- significant 9 bits of a 16 bit word are placed into the least
- significant 9 bits of the opcode.
-
-ENUM
- BFD_RELOC_TIC54X_23
-ENUMDOC
- This is an extended address 23-bit reloc for the tms320c54x.
-
-ENUM
- BFD_RELOC_TIC54X_16_OF_23
-ENUMDOC
- This is a 16-bit reloc for the tms320c54x, where the least
- significant 16 bits of a 23-bit extended address are placed into
- the opcode.
-
-ENUM
- BFD_RELOC_TIC54X_MS7_OF_23
-ENUMDOC
- This is a reloc for the tms320c54x, where the most
- significant 7 bits of a 23-bit extended address are placed into
- the opcode.
-
-ENUM
- BFD_RELOC_FR30_48
-ENUMDOC
- This is a 48 bit reloc for the FR30 that stores 32 bits.
-ENUM
- BFD_RELOC_FR30_20
-ENUMDOC
- This is a 32 bit reloc for the FR30 that stores 20 bits split up into
- two sections.
-ENUM
- BFD_RELOC_FR30_6_IN_4
-ENUMDOC
- This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
- 4 bits.
-ENUM
- BFD_RELOC_FR30_8_IN_8
-ENUMDOC
- This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
- into 8 bits.
-ENUM
- BFD_RELOC_FR30_9_IN_8
-ENUMDOC
- This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
- into 8 bits.
-ENUM
- BFD_RELOC_FR30_10_IN_8
-ENUMDOC
- This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
- into 8 bits.
-ENUM
- BFD_RELOC_FR30_9_PCREL
-ENUMDOC
- This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
- short offset into 8 bits.
-ENUM
- BFD_RELOC_FR30_12_PCREL
-ENUMDOC
- This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
- short offset into 11 bits.
-
-ENUM
- BFD_RELOC_MCORE_PCREL_IMM8BY4
-ENUMX
- BFD_RELOC_MCORE_PCREL_IMM11BY2
-ENUMX
- BFD_RELOC_MCORE_PCREL_IMM4BY2
-ENUMX
- BFD_RELOC_MCORE_PCREL_32
-ENUMX
- BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2
-ENUMX
- BFD_RELOC_MCORE_RVA
-ENUMDOC
- Motorola Mcore relocations.
-
-ENUM
- BFD_RELOC_MMIX_GETA
-ENUMX
- BFD_RELOC_MMIX_GETA_1
-ENUMX
- BFD_RELOC_MMIX_GETA_2
-ENUMX
- BFD_RELOC_MMIX_GETA_3
-ENUMDOC
- These are relocations for the GETA instruction.
-ENUM
- BFD_RELOC_MMIX_CBRANCH
-ENUMX
- BFD_RELOC_MMIX_CBRANCH_J
-ENUMX
- BFD_RELOC_MMIX_CBRANCH_1
-ENUMX
- BFD_RELOC_MMIX_CBRANCH_2
-ENUMX
- BFD_RELOC_MMIX_CBRANCH_3
-ENUMDOC
- These are relocations for a conditional branch instruction.
-ENUM
- BFD_RELOC_MMIX_PUSHJ
-ENUMX
- BFD_RELOC_MMIX_PUSHJ_1
-ENUMX
- BFD_RELOC_MMIX_PUSHJ_2
-ENUMX
- BFD_RELOC_MMIX_PUSHJ_3
-ENUMX
- BFD_RELOC_MMIX_PUSHJ_STUBBABLE
-ENUMDOC
- These are relocations for the PUSHJ instruction.
-ENUM
- BFD_RELOC_MMIX_JMP
-ENUMX
- BFD_RELOC_MMIX_JMP_1
-ENUMX
- BFD_RELOC_MMIX_JMP_2
-ENUMX
- BFD_RELOC_MMIX_JMP_3
-ENUMDOC
- These are relocations for the JMP instruction.
-ENUM
- BFD_RELOC_MMIX_ADDR19
-ENUMDOC
- This is a relocation for a relative address as in a GETA instruction or
- a branch.
-ENUM
- BFD_RELOC_MMIX_ADDR27
-ENUMDOC
- This is a relocation for a relative address as in a JMP instruction.
-ENUM
- BFD_RELOC_MMIX_REG_OR_BYTE
-ENUMDOC
- This is a relocation for an instruction field that may be a general
- register or a value 0..255.
-ENUM
- BFD_RELOC_MMIX_REG
-ENUMDOC
- This is a relocation for an instruction field that may be a general
- register.
-ENUM
- BFD_RELOC_MMIX_BASE_PLUS_OFFSET
-ENUMDOC
- This is a relocation for two instruction fields holding a register and
- an offset, the equivalent of the relocation.
-ENUM
- BFD_RELOC_MMIX_LOCAL
-ENUMDOC
- This relocation is an assertion that the expression is not allocated as
- a global register. It does not modify contents.
-
-ENUM
- BFD_RELOC_AVR_7_PCREL
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 8 bit pc relative
- short offset into 7 bits.
-ENUM
- BFD_RELOC_AVR_13_PCREL
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 13 bit pc relative
- short offset into 12 bits.
-ENUM
- BFD_RELOC_AVR_16_PM
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 17 bit value (usually
- program memory address) into 16 bits.
-ENUM
- BFD_RELOC_AVR_LO8_LDI
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 8 bit value (usually
- data memory address) into 8 bit immediate value of LDI insn.
-ENUM
- BFD_RELOC_AVR_HI8_LDI
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
- of data memory address) into 8 bit immediate value of LDI insn.
-ENUM
- BFD_RELOC_AVR_HH8_LDI
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
- of program memory address) into 8 bit immediate value of LDI insn.
-ENUM
- BFD_RELOC_AVR_LO8_LDI_NEG
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (usually data memory address) into 8 bit immediate value of SUBI insn.
-ENUM
- BFD_RELOC_AVR_HI8_LDI_NEG
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (high 8 bit of data memory address) into 8 bit immediate value of
- SUBI insn.
-ENUM
- BFD_RELOC_AVR_HH8_LDI_NEG
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (most high 8 bit of program memory address) into 8 bit immediate value
- of LDI or SUBI insn.
-ENUM
- BFD_RELOC_AVR_LO8_LDI_PM
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 8 bit value (usually
- command address) into 8 bit immediate value of LDI insn.
-ENUM
- BFD_RELOC_AVR_HI8_LDI_PM
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
- of command address) into 8 bit immediate value of LDI insn.
-ENUM
- BFD_RELOC_AVR_HH8_LDI_PM
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
- of command address) into 8 bit immediate value of LDI insn.
-ENUM
- BFD_RELOC_AVR_LO8_LDI_PM_NEG
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (usually command address) into 8 bit immediate value of SUBI insn.
-ENUM
- BFD_RELOC_AVR_HI8_LDI_PM_NEG
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (high 8 bit of 16 bit command address) into 8 bit immediate value
- of SUBI insn.
-ENUM
- BFD_RELOC_AVR_HH8_LDI_PM_NEG
-ENUMDOC
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (high 6 bit of 22 bit command address) into 8 bit immediate
- value of SUBI insn.
-ENUM
- BFD_RELOC_AVR_CALL
-ENUMDOC
- This is a 32 bit reloc for the AVR that stores 23 bit value
- into 22 bits.
-
-ENUM
- BFD_RELOC_390_12
-ENUMDOC
- Direct 12 bit.
-ENUM
- BFD_RELOC_390_GOT12
-ENUMDOC
- 12 bit GOT offset.
-ENUM
- BFD_RELOC_390_PLT32
-ENUMDOC
- 32 bit PC relative PLT address.
-ENUM
- BFD_RELOC_390_COPY
-ENUMDOC
- Copy symbol at runtime.
-ENUM
- BFD_RELOC_390_GLOB_DAT
-ENUMDOC
- Create GOT entry.
-ENUM
- BFD_RELOC_390_JMP_SLOT
-ENUMDOC
- Create PLT entry.
-ENUM
- BFD_RELOC_390_RELATIVE
-ENUMDOC
- Adjust by program base.
-ENUM
- BFD_RELOC_390_GOTPC
-ENUMDOC
- 32 bit PC relative offset to GOT.
-ENUM
- BFD_RELOC_390_GOT16
-ENUMDOC
- 16 bit GOT offset.
-ENUM
- BFD_RELOC_390_PC16DBL
-ENUMDOC
- PC relative 16 bit shifted by 1.
-ENUM
- BFD_RELOC_390_PLT16DBL
-ENUMDOC
- 16 bit PC rel. PLT shifted by 1.
-ENUM
- BFD_RELOC_390_PC32DBL
-ENUMDOC
- PC relative 32 bit shifted by 1.
-ENUM
- BFD_RELOC_390_PLT32DBL
-ENUMDOC
- 32 bit PC rel. PLT shifted by 1.
-ENUM
- BFD_RELOC_390_GOTPCDBL
-ENUMDOC
- 32 bit PC rel. GOT shifted by 1.
-ENUM
- BFD_RELOC_390_GOT64
-ENUMDOC
- 64 bit GOT offset.
-ENUM
- BFD_RELOC_390_PLT64
-ENUMDOC
- 64 bit PC relative PLT address.
-ENUM
- BFD_RELOC_390_GOTENT
-ENUMDOC
- 32 bit rel. offset to GOT entry.
-ENUM
- BFD_RELOC_390_GOTOFF64
-ENUMDOC
- 64 bit offset to GOT.
-ENUM
- BFD_RELOC_390_GOTPLT12
-ENUMDOC
- 12-bit offset to symbol-entry within GOT, with PLT handling.
-ENUM
- BFD_RELOC_390_GOTPLT16
-ENUMDOC
- 16-bit offset to symbol-entry within GOT, with PLT handling.
-ENUM
- BFD_RELOC_390_GOTPLT32
-ENUMDOC
- 32-bit offset to symbol-entry within GOT, with PLT handling.
-ENUM
- BFD_RELOC_390_GOTPLT64
-ENUMDOC
- 64-bit offset to symbol-entry within GOT, with PLT handling.
-ENUM
- BFD_RELOC_390_GOTPLTENT
-ENUMDOC
- 32-bit rel. offset to symbol-entry within GOT, with PLT handling.
-ENUM
- BFD_RELOC_390_PLTOFF16
-ENUMDOC
- 16-bit rel. offset from the GOT to a PLT entry.
-ENUM
- BFD_RELOC_390_PLTOFF32
-ENUMDOC
- 32-bit rel. offset from the GOT to a PLT entry.
-ENUM
- BFD_RELOC_390_PLTOFF64
-ENUMDOC
- 64-bit rel. offset from the GOT to a PLT entry.
-
-ENUM
- BFD_RELOC_390_TLS_LOAD
-ENUMX
- BFD_RELOC_390_TLS_GDCALL
-ENUMX
- BFD_RELOC_390_TLS_LDCALL
-ENUMX
- BFD_RELOC_390_TLS_GD32
-ENUMX
- BFD_RELOC_390_TLS_GD64
-ENUMX
- BFD_RELOC_390_TLS_GOTIE12
-ENUMX
- BFD_RELOC_390_TLS_GOTIE32
-ENUMX
- BFD_RELOC_390_TLS_GOTIE64
-ENUMX
- BFD_RELOC_390_TLS_LDM32
-ENUMX
- BFD_RELOC_390_TLS_LDM64
-ENUMX
- BFD_RELOC_390_TLS_IE32
-ENUMX
- BFD_RELOC_390_TLS_IE64
-ENUMX
- BFD_RELOC_390_TLS_IEENT
-ENUMX
- BFD_RELOC_390_TLS_LE32
-ENUMX
- BFD_RELOC_390_TLS_LE64
-ENUMX
- BFD_RELOC_390_TLS_LDO32
-ENUMX
- BFD_RELOC_390_TLS_LDO64
-ENUMX
- BFD_RELOC_390_TLS_DTPMOD
-ENUMX
- BFD_RELOC_390_TLS_DTPOFF
-ENUMX
- BFD_RELOC_390_TLS_TPOFF
-ENUMDOC
- s390 tls relocations.
-
-ENUM
- BFD_RELOC_390_20
-ENUMX
- BFD_RELOC_390_GOT20
-ENUMX
- BFD_RELOC_390_GOTPLT20
-ENUMX
- BFD_RELOC_390_TLS_GOTIE20
-ENUMDOC
- Long displacement extension.
-
-ENUM
- BFD_RELOC_IP2K_FR9
-ENUMDOC
- Scenix IP2K - 9-bit register number / data address
-ENUM
- BFD_RELOC_IP2K_BANK
-ENUMDOC
- Scenix IP2K - 4-bit register/data bank number
-ENUM
- BFD_RELOC_IP2K_ADDR16CJP
-ENUMDOC
- Scenix IP2K - low 13 bits of instruction word address
-ENUM
- BFD_RELOC_IP2K_PAGE3
-ENUMDOC
- Scenix IP2K - high 3 bits of instruction word address
-ENUM
- BFD_RELOC_IP2K_LO8DATA
-ENUMX
- BFD_RELOC_IP2K_HI8DATA
-ENUMX
- BFD_RELOC_IP2K_EX8DATA
-ENUMDOC
- Scenix IP2K - ext/low/high 8 bits of data address
-ENUM
- BFD_RELOC_IP2K_LO8INSN
-ENUMX
- BFD_RELOC_IP2K_HI8INSN
-ENUMDOC
- Scenix IP2K - low/high 8 bits of instruction word address
-ENUM
- BFD_RELOC_IP2K_PC_SKIP
-ENUMDOC
- Scenix IP2K - even/odd PC modifier to modify snb pcl.0
-ENUM
- BFD_RELOC_IP2K_TEXT
-ENUMDOC
- Scenix IP2K - 16 bit word address in text section.
-ENUM
- BFD_RELOC_IP2K_FR_OFFSET
-ENUMDOC
- Scenix IP2K - 7-bit sp or dp offset
-ENUM
- BFD_RELOC_VPE4KMATH_DATA
-ENUMX
- BFD_RELOC_VPE4KMATH_INSN
-ENUMDOC
- Scenix VPE4K coprocessor - data/insn-space addressing
-
-ENUM
- BFD_RELOC_VTABLE_INHERIT
-ENUMX
- BFD_RELOC_VTABLE_ENTRY
-ENUMDOC
- These two relocations are used by the linker to determine which of
- the entries in a C++ virtual function table are actually used. When
- the --gc-sections option is given, the linker will zero out the entries
- that are not used, so that the code for those functions need not be
- included in the output.
-
- VTABLE_INHERIT is a zero-space relocation used to describe to the
- linker the inheritance tree of a C++ virtual function table. The
- relocation's symbol should be the parent class' vtable, and the
- relocation should be located at the child vtable.
-
- VTABLE_ENTRY is a zero-space relocation that describes the use of a
- virtual function table entry. The reloc's symbol should refer to the
- table of the class mentioned in the code. Off of that base, an offset
- describes the entry that is being used. For Rela hosts, this offset
- is stored in the reloc's addend. For Rel hosts, we are forced to put
- this offset in the reloc's section offset.
-
-ENUM
- BFD_RELOC_IA64_IMM14
-ENUMX
- BFD_RELOC_IA64_IMM22
-ENUMX
- BFD_RELOC_IA64_IMM64
-ENUMX
- BFD_RELOC_IA64_DIR32MSB
-ENUMX
- BFD_RELOC_IA64_DIR32LSB
-ENUMX
- BFD_RELOC_IA64_DIR64MSB
-ENUMX
- BFD_RELOC_IA64_DIR64LSB
-ENUMX
- BFD_RELOC_IA64_GPREL22
-ENUMX
- BFD_RELOC_IA64_GPREL64I
-ENUMX
- BFD_RELOC_IA64_GPREL32MSB
-ENUMX
- BFD_RELOC_IA64_GPREL32LSB
-ENUMX
- BFD_RELOC_IA64_GPREL64MSB
-ENUMX
- BFD_RELOC_IA64_GPREL64LSB
-ENUMX
- BFD_RELOC_IA64_LTOFF22
-ENUMX
- BFD_RELOC_IA64_LTOFF64I
-ENUMX
- BFD_RELOC_IA64_PLTOFF22
-ENUMX
- BFD_RELOC_IA64_PLTOFF64I
-ENUMX
- BFD_RELOC_IA64_PLTOFF64MSB
-ENUMX
- BFD_RELOC_IA64_PLTOFF64LSB
-ENUMX
- BFD_RELOC_IA64_FPTR64I
-ENUMX
- BFD_RELOC_IA64_FPTR32MSB
-ENUMX
- BFD_RELOC_IA64_FPTR32LSB
-ENUMX
- BFD_RELOC_IA64_FPTR64MSB
-ENUMX
- BFD_RELOC_IA64_FPTR64LSB
-ENUMX
- BFD_RELOC_IA64_PCREL21B
-ENUMX
- BFD_RELOC_IA64_PCREL21BI
-ENUMX
- BFD_RELOC_IA64_PCREL21M
-ENUMX
- BFD_RELOC_IA64_PCREL21F
-ENUMX
- BFD_RELOC_IA64_PCREL22
-ENUMX
- BFD_RELOC_IA64_PCREL60B
-ENUMX
- BFD_RELOC_IA64_PCREL64I
-ENUMX
- BFD_RELOC_IA64_PCREL32MSB
-ENUMX
- BFD_RELOC_IA64_PCREL32LSB
-ENUMX
- BFD_RELOC_IA64_PCREL64MSB
-ENUMX
- BFD_RELOC_IA64_PCREL64LSB
-ENUMX
- BFD_RELOC_IA64_LTOFF_FPTR22
-ENUMX
- BFD_RELOC_IA64_LTOFF_FPTR64I
-ENUMX
- BFD_RELOC_IA64_LTOFF_FPTR32MSB
-ENUMX
- BFD_RELOC_IA64_LTOFF_FPTR32LSB
-ENUMX
- BFD_RELOC_IA64_LTOFF_FPTR64MSB
-ENUMX
- BFD_RELOC_IA64_LTOFF_FPTR64LSB
-ENUMX
- BFD_RELOC_IA64_SEGREL32MSB
-ENUMX
- BFD_RELOC_IA64_SEGREL32LSB
-ENUMX
- BFD_RELOC_IA64_SEGREL64MSB
-ENUMX
- BFD_RELOC_IA64_SEGREL64LSB
-ENUMX
- BFD_RELOC_IA64_SECREL32MSB
-ENUMX
- BFD_RELOC_IA64_SECREL32LSB
-ENUMX
- BFD_RELOC_IA64_SECREL64MSB
-ENUMX
- BFD_RELOC_IA64_SECREL64LSB
-ENUMX
- BFD_RELOC_IA64_REL32MSB
-ENUMX
- BFD_RELOC_IA64_REL32LSB
-ENUMX
- BFD_RELOC_IA64_REL64MSB
-ENUMX
- BFD_RELOC_IA64_REL64LSB
-ENUMX
- BFD_RELOC_IA64_LTV32MSB
-ENUMX
- BFD_RELOC_IA64_LTV32LSB
-ENUMX
- BFD_RELOC_IA64_LTV64MSB
-ENUMX
- BFD_RELOC_IA64_LTV64LSB
-ENUMX
- BFD_RELOC_IA64_IPLTMSB
-ENUMX
- BFD_RELOC_IA64_IPLTLSB
-ENUMX
- BFD_RELOC_IA64_COPY
-ENUMX
- BFD_RELOC_IA64_LTOFF22X
-ENUMX
- BFD_RELOC_IA64_LDXMOV
-ENUMX
- BFD_RELOC_IA64_TPREL14
-ENUMX
- BFD_RELOC_IA64_TPREL22
-ENUMX
- BFD_RELOC_IA64_TPREL64I
-ENUMX
- BFD_RELOC_IA64_TPREL64MSB
-ENUMX
- BFD_RELOC_IA64_TPREL64LSB
-ENUMX
- BFD_RELOC_IA64_LTOFF_TPREL22
-ENUMX
- BFD_RELOC_IA64_DTPMOD64MSB
-ENUMX
- BFD_RELOC_IA64_DTPMOD64LSB
-ENUMX
- BFD_RELOC_IA64_LTOFF_DTPMOD22
-ENUMX
- BFD_RELOC_IA64_DTPREL14
-ENUMX
- BFD_RELOC_IA64_DTPREL22
-ENUMX
- BFD_RELOC_IA64_DTPREL64I
-ENUMX
- BFD_RELOC_IA64_DTPREL32MSB
-ENUMX
- BFD_RELOC_IA64_DTPREL32LSB
-ENUMX
- BFD_RELOC_IA64_DTPREL64MSB
-ENUMX
- BFD_RELOC_IA64_DTPREL64LSB
-ENUMX
- BFD_RELOC_IA64_LTOFF_DTPREL22
-ENUMDOC
- Intel IA64 Relocations.
-
-ENUM
- BFD_RELOC_M68HC11_HI8
-ENUMDOC
- Motorola 68HC11 reloc.
- This is the 8 bit high part of an absolute address.
-ENUM
- BFD_RELOC_M68HC11_LO8
-ENUMDOC
- Motorola 68HC11 reloc.
- This is the 8 bit low part of an absolute address.
-ENUM
- BFD_RELOC_M68HC11_3B
-ENUMDOC
- Motorola 68HC11 reloc.
- This is the 3 bit of a value.
-ENUM
- BFD_RELOC_M68HC11_RL_JUMP
-ENUMDOC
- Motorola 68HC11 reloc.
- This reloc marks the beginning of a jump/call instruction.
- It is used for linker relaxation to correctly identify beginning
- of instruction and change some branches to use PC-relative
- addressing mode.
-ENUM
- BFD_RELOC_M68HC11_RL_GROUP
-ENUMDOC
- Motorola 68HC11 reloc.
- This reloc marks a group of several instructions that gcc generates
- and for which the linker relaxation pass can modify and/or remove
- some of them.
-ENUM
- BFD_RELOC_M68HC11_LO16
-ENUMDOC
- Motorola 68HC11 reloc.
- This is the 16-bit lower part of an address. It is used for 'call'
- instruction to specify the symbol address without any special
- transformation (due to memory bank window).
-ENUM
- BFD_RELOC_M68HC11_PAGE
-ENUMDOC
- Motorola 68HC11 reloc.
- This is a 8-bit reloc that specifies the page number of an address.
- It is used by 'call' instruction to specify the page number of
- the symbol.
-ENUM
- BFD_RELOC_M68HC11_24
-ENUMDOC
- Motorola 68HC11 reloc.
- This is a 24-bit reloc that represents the address with a 16-bit
- value and a 8-bit page number. The symbol address is transformed
- to follow the 16K memory bank of 68HC12 (seen as mapped in the window).
-ENUM
- BFD_RELOC_M68HC12_5B
-ENUMDOC
- Motorola 68HC12 reloc.
- This is the 5 bits of a value.
-
-ENUM
- BFD_RELOC_CRIS_BDISP8
-ENUMX
- BFD_RELOC_CRIS_UNSIGNED_5
-ENUMX
- BFD_RELOC_CRIS_SIGNED_6
-ENUMX
- BFD_RELOC_CRIS_UNSIGNED_6
-ENUMX
- BFD_RELOC_CRIS_UNSIGNED_4
-ENUMDOC
- These relocs are only used within the CRIS assembler. They are not
- (at present) written to any object files.
-ENUM
- BFD_RELOC_CRIS_COPY
-ENUMX
- BFD_RELOC_CRIS_GLOB_DAT
-ENUMX
- BFD_RELOC_CRIS_JUMP_SLOT
-ENUMX
- BFD_RELOC_CRIS_RELATIVE
-ENUMDOC
- Relocs used in ELF shared libraries for CRIS.
-ENUM
- BFD_RELOC_CRIS_32_GOT
-ENUMDOC
- 32-bit offset to symbol-entry within GOT.
-ENUM
- BFD_RELOC_CRIS_16_GOT
-ENUMDOC
- 16-bit offset to symbol-entry within GOT.
-ENUM
- BFD_RELOC_CRIS_32_GOTPLT
-ENUMDOC
- 32-bit offset to symbol-entry within GOT, with PLT handling.
-ENUM
- BFD_RELOC_CRIS_16_GOTPLT
-ENUMDOC
- 16-bit offset to symbol-entry within GOT, with PLT handling.
-ENUM
- BFD_RELOC_CRIS_32_GOTREL
-ENUMDOC
- 32-bit offset to symbol, relative to GOT.
-ENUM
- BFD_RELOC_CRIS_32_PLT_GOTREL
-ENUMDOC
- 32-bit offset to symbol with PLT entry, relative to GOT.
-ENUM
- BFD_RELOC_CRIS_32_PLT_PCREL
-ENUMDOC
- 32-bit offset to symbol with PLT entry, relative to this relocation.
-
-ENUM
- BFD_RELOC_860_COPY
-ENUMX
- BFD_RELOC_860_GLOB_DAT
-ENUMX
- BFD_RELOC_860_JUMP_SLOT
-ENUMX
- BFD_RELOC_860_RELATIVE
-ENUMX
- BFD_RELOC_860_PC26
-ENUMX
- BFD_RELOC_860_PLT26
-ENUMX
- BFD_RELOC_860_PC16
-ENUMX
- BFD_RELOC_860_LOW0
-ENUMX
- BFD_RELOC_860_SPLIT0
-ENUMX
- BFD_RELOC_860_LOW1
-ENUMX
- BFD_RELOC_860_SPLIT1
-ENUMX
- BFD_RELOC_860_LOW2
-ENUMX
- BFD_RELOC_860_SPLIT2
-ENUMX
- BFD_RELOC_860_LOW3
-ENUMX
- BFD_RELOC_860_LOGOT0
-ENUMX
- BFD_RELOC_860_SPGOT0
-ENUMX
- BFD_RELOC_860_LOGOT1
-ENUMX
- BFD_RELOC_860_SPGOT1
-ENUMX
- BFD_RELOC_860_LOGOTOFF0
-ENUMX
- BFD_RELOC_860_SPGOTOFF0
-ENUMX
- BFD_RELOC_860_LOGOTOFF1
-ENUMX
- BFD_RELOC_860_SPGOTOFF1
-ENUMX
- BFD_RELOC_860_LOGOTOFF2
-ENUMX
- BFD_RELOC_860_LOGOTOFF3
-ENUMX
- BFD_RELOC_860_LOPC
-ENUMX
- BFD_RELOC_860_HIGHADJ
-ENUMX
- BFD_RELOC_860_HAGOT
-ENUMX
- BFD_RELOC_860_HAGOTOFF
-ENUMX
- BFD_RELOC_860_HAPC
-ENUMX
- BFD_RELOC_860_HIGH
-ENUMX
- BFD_RELOC_860_HIGOT
-ENUMX
- BFD_RELOC_860_HIGOTOFF
-ENUMDOC
- Intel i860 Relocations.
-
-ENUM
- BFD_RELOC_OPENRISC_ABS_26
-ENUMX
- BFD_RELOC_OPENRISC_REL_26
-ENUMDOC
- OpenRISC Relocations.
-
-ENUM
- BFD_RELOC_H8_DIR16A8
-ENUMX
- BFD_RELOC_H8_DIR16R8
-ENUMX
- BFD_RELOC_H8_DIR24A8
-ENUMX
- BFD_RELOC_H8_DIR24R8
-ENUMX
- BFD_RELOC_H8_DIR32A16
-ENUMDOC
- H8 elf Relocations.
-
-ENUM
- BFD_RELOC_XSTORMY16_REL_12
-ENUMX
- BFD_RELOC_XSTORMY16_12
-ENUMX
- BFD_RELOC_XSTORMY16_24
-ENUMX
- BFD_RELOC_XSTORMY16_FPTR16
-ENUMDOC
- Sony Xstormy16 Relocations.
-
-ENUM
- BFD_RELOC_VAX_GLOB_DAT
-ENUMX
- BFD_RELOC_VAX_JMP_SLOT
-ENUMX
- BFD_RELOC_VAX_RELATIVE
-ENUMDOC
- Relocations used by VAX ELF.
-
-ENUM
- BFD_RELOC_MSP430_10_PCREL
-ENUMX
- BFD_RELOC_MSP430_16_PCREL
-ENUMX
- BFD_RELOC_MSP430_16
-ENUMX
- BFD_RELOC_MSP430_16_PCREL_BYTE
-ENUMX
- BFD_RELOC_MSP430_16_BYTE
-ENUMDOC
- msp430 specific relocation codes
-
-ENUM
- BFD_RELOC_IQ2000_OFFSET_16
-ENUMX
- BFD_RELOC_IQ2000_OFFSET_21
-ENUMX
- BFD_RELOC_IQ2000_UHI16
-ENUMDOC
- IQ2000 Relocations.
-
-ENUM
- BFD_RELOC_XTENSA_RTLD
-ENUMDOC
- Special Xtensa relocation used only by PLT entries in ELF shared
- objects to indicate that the runtime linker should set the value
- to one of its own internal functions or data structures.
-ENUM
- BFD_RELOC_XTENSA_GLOB_DAT
-ENUMX
- BFD_RELOC_XTENSA_JMP_SLOT
-ENUMX
- BFD_RELOC_XTENSA_RELATIVE
-ENUMDOC
- Xtensa relocations for ELF shared objects.
-ENUM
- BFD_RELOC_XTENSA_PLT
-ENUMDOC
- Xtensa relocation used in ELF object files for symbols that may require
- PLT entries. Otherwise, this is just a generic 32-bit relocation.
-ENUM
- BFD_RELOC_XTENSA_OP0
-ENUMX
- BFD_RELOC_XTENSA_OP1
-ENUMX
- BFD_RELOC_XTENSA_OP2
-ENUMDOC
- Generic Xtensa relocations. Only the operand number is encoded
- in the relocation. The details are determined by extracting the
- instruction opcode.
-ENUM
- BFD_RELOC_XTENSA_ASM_EXPAND
-ENUMDOC
- Xtensa relocation to mark that the assembler expanded the
- instructions from an original target. The expansion size is
- encoded in the reloc size.
-ENUM
- BFD_RELOC_XTENSA_ASM_SIMPLIFY
-ENUMDOC
- Xtensa relocation to mark that the linker should simplify
- assembler-expanded instructions. This is commonly used
- internally by the linker after analysis of a
- BFD_RELOC_XTENSA_ASM_EXPAND.
-
-ENDSENUM
- BFD_RELOC_UNUSED
-CODE_FRAGMENT
-.
-.typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-*/
-
-/*
-FUNCTION
- bfd_reloc_type_lookup
-
-SYNOPSIS
- reloc_howto_type *bfd_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-
-DESCRIPTION
- Return a pointer to a howto structure which, when
- invoked, will perform the relocation @var{code} on data from the
- architecture noted.
-
-*/
-
-reloc_howto_type *
-bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
-{
- return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
-}
-
-static reloc_howto_type bfd_howto_32 =
-HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE);
-
-/*
-INTERNAL_FUNCTION
- bfd_default_reloc_type_lookup
-
-SYNOPSIS
- reloc_howto_type *bfd_default_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-
-DESCRIPTION
- Provides a default relocation lookup routine for any architecture.
-
-*/
-
-reloc_howto_type *
-bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
-{
- switch (code)
- {
- case BFD_RELOC_CTOR:
- /* The type of reloc used in a ctor, which will be as wide as the
- address - so either a 64, 32, or 16 bitter. */
- switch (bfd_get_arch_info (abfd)->bits_per_address)
- {
- case 64:
- BFD_FAIL ();
- case 32:
- return &bfd_howto_32;
- case 16:
- BFD_FAIL ();
- default:
- BFD_FAIL ();
- }
- default:
- BFD_FAIL ();
- }
- return NULL;
-}
-
-/*
-FUNCTION
- bfd_get_reloc_code_name
-
-SYNOPSIS
- const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
-
-DESCRIPTION
- Provides a printable name for the supplied relocation code.
- Useful mainly for printing error messages.
-*/
-
-const char *
-bfd_get_reloc_code_name (bfd_reloc_code_real_type code)
-{
- if (code > BFD_RELOC_UNUSED)
- return 0;
- return bfd_reloc_code_real_names[code];
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_generic_relax_section
-
-SYNOPSIS
- bfd_boolean bfd_generic_relax_section
- (bfd *abfd,
- asection *section,
- struct bfd_link_info *,
- bfd_boolean *);
-
-DESCRIPTION
- Provides default handling for relaxing for back ends which
- don't do relaxing -- i.e., does nothing except make sure that the
- final size of the section is set.
-*/
-
-bfd_boolean
-bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- bfd_boolean *again)
-{
- /* We're not relaxing the section, so just copy the size info if it's
- zero. Someone else, like bfd_merge_sections, might have set it, so
- don't overwrite a non-zero value. */
- if (section->_cooked_size == 0)
- section->_cooked_size = section->_raw_size;
- *again = FALSE;
- return TRUE;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_generic_gc_sections
-
-SYNOPSIS
- bfd_boolean bfd_generic_gc_sections
- (bfd *, struct bfd_link_info *);
-
-DESCRIPTION
- Provides default handling for relaxing for back ends which
- don't do section gc -- i.e., does nothing.
-*/
-
-bfd_boolean
-bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_generic_merge_sections
-
-SYNOPSIS
- bfd_boolean bfd_generic_merge_sections
- (bfd *, struct bfd_link_info *);
-
-DESCRIPTION
- Provides default handling for SEC_MERGE section merging for back ends
- which don't have SEC_MERGE support -- i.e., does nothing.
-*/
-
-bfd_boolean
-bfd_generic_merge_sections (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-/*
-INTERNAL_FUNCTION
- bfd_generic_get_relocated_section_contents
-
-SYNOPSIS
- bfd_byte *bfd_generic_get_relocated_section_contents
- (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols);
-
-DESCRIPTION
- Provides default handling of relocation effort for back ends
- which can't be bothered to do it efficiently.
-
-*/
-
-bfd_byte *
-bfd_generic_get_relocated_section_contents (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols)
-{
- /* Get enough memory to hold the stuff. */
- bfd *input_bfd = link_order->u.indirect.section->owner;
- asection *input_section = link_order->u.indirect.section;
-
- long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
- arelent **reloc_vector = NULL;
- long reloc_count;
-
- if (reloc_size < 0)
- goto error_return;
-
- reloc_vector = bfd_malloc (reloc_size);
- if (reloc_vector == NULL && reloc_size != 0)
- goto error_return;
-
- /* Read in the section. */
- if (!bfd_get_section_contents (input_bfd,
- input_section,
- data,
- 0,
- input_section->_raw_size))
- goto error_return;
-
- /* Don't set input_section->_cooked_size here. The caller has set
- _cooked_size or called bfd_relax_section, which sets _cooked_size.
- Despite using this generic relocation function, some targets perform
- target-specific relaxation or string merging, which happens before
- this function is called. We do not want to clobber the _cooked_size
- they computed. */
-
- input_section->reloc_done = TRUE;
-
- reloc_count = bfd_canonicalize_reloc (input_bfd,
- input_section,
- reloc_vector,
- symbols);
- if (reloc_count < 0)
- goto error_return;
-
- if (reloc_count > 0)
- {
- arelent **parent;
- for (parent = reloc_vector; *parent != NULL; parent++)
- {
- char *error_message = NULL;
- bfd_reloc_status_type r =
- bfd_perform_relocation (input_bfd,
- *parent,
- data,
- input_section,
- relocatable ? abfd : NULL,
- &error_message);
-
- if (relocatable)
- {
- asection *os = input_section->output_section;
-
- /* A partial link, so keep the relocs. */
- os->orelocation[os->reloc_count] = *parent;
- os->reloc_count++;
- }
-
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- case bfd_reloc_undefined:
- if (!((*link_info->callbacks->undefined_symbol)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
- input_bfd, input_section, (*parent)->address,
- TRUE)))
- goto error_return;
- break;
- case bfd_reloc_dangerous:
- BFD_ASSERT (error_message != NULL);
- if (!((*link_info->callbacks->reloc_dangerous)
- (link_info, error_message, input_bfd, input_section,
- (*parent)->address)))
- goto error_return;
- break;
- case bfd_reloc_overflow:
- if (!((*link_info->callbacks->reloc_overflow)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
- (*parent)->howto->name, (*parent)->addend,
- input_bfd, input_section, (*parent)->address)))
- goto error_return;
- break;
- case bfd_reloc_outofrange:
- default:
- abort ();
- break;
- }
-
- }
- }
- }
- if (reloc_vector != NULL)
- free (reloc_vector);
- return data;
-
-error_return:
- if (reloc_vector != NULL)
- free (reloc_vector);
- return NULL;
-}
diff --git a/contrib/binutils/bfd/reloc16.c b/contrib/binutils/bfd/reloc16.c
deleted file mode 100644
index 720e2d6..0000000
--- a/contrib/binutils/bfd/reloc16.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/* 8 and 16 bit COFF relocation functions, for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>. */
-
-/* These routines are used by coff-h8300 and coff-z8k to do
- relocation.
-
- FIXME: This code should be rewritten to support the new COFF
- linker. Basically, they need to deal with COFF relocs rather than
- BFD generic relocs. They should store the relocs in some location
- where coff_link_input_bfd can find them (and coff_link_input_bfd
- should be changed to use this location rather than rereading the
- file) (unless info->keep_memory is FALSE, in which case they should
- free up the relocs after dealing with them). */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-#include "genlink.h"
-#include "coff/internal.h"
-#include "libcoff.h"
-
-bfd_vma
-bfd_coff_reloc16_get_value (reloc, link_info, input_section)
- arelent *reloc;
- struct bfd_link_info *link_info;
- asection *input_section;
-{
- bfd_vma value;
- asymbol *symbol = *(reloc->sym_ptr_ptr);
- /* A symbol holds a pointer to a section, and an offset from the
- base of the section. To relocate, we find where the section will
- live in the output and add that in. */
-
- if (bfd_is_und_section (symbol->section)
- || bfd_is_com_section (symbol->section))
- {
- struct bfd_link_hash_entry *h;
-
- /* The symbol is undefined in this BFD. Look it up in the
- global linker hash table. FIXME: This should be changed when
- we convert this stuff to use a specific final_link function
- and change the interface to bfd_relax_section to not require
- the generic symbols. */
- h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info,
- bfd_asymbol_name (symbol),
- FALSE, FALSE, TRUE);
- if (h != (struct bfd_link_hash_entry *) NULL
- && (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_defweak))
- value = (h->u.def.value
- + h->u.def.section->output_section->vma
- + h->u.def.section->output_offset);
- else if (h != (struct bfd_link_hash_entry *) NULL
- && h->type == bfd_link_hash_common)
- value = h->u.c.size;
- else
- {
- if (!((*link_info->callbacks->undefined_symbol)
- (link_info, bfd_asymbol_name (symbol),
- input_section->owner, input_section, reloc->address,
- TRUE)))
- abort ();
- value = 0;
- }
- }
- else
- {
- value = symbol->value
- + symbol->section->output_offset
- + symbol->section->output_section->vma;
- }
-
- /* Add the value contained in the relocation. */
- value += reloc->addend;
-
- return value;
-}
-
-void
-bfd_perform_slip (abfd, slip, input_section, value)
- bfd *abfd;
- unsigned int slip;
- asection *input_section;
- bfd_vma value;
-{
- asymbol **s;
-
- s = _bfd_generic_link_get_symbols (abfd);
- BFD_ASSERT (s != (asymbol **) NULL);
-
- /* Find all symbols past this point, and make them know
- what's happened. */
- while (*s)
- {
- asymbol *p = *s;
- if (p->section == input_section)
- {
- /* This was pointing into this section, so mangle it. */
- if (p->value > value)
- {
- p->value -= slip;
- if (p->udata.p != NULL)
- {
- struct generic_link_hash_entry *h;
-
- h = (struct generic_link_hash_entry *) p->udata.p;
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak);
- h->root.u.def.value -= slip;
- BFD_ASSERT (h->root.u.def.value == p->value);
- }
- }
- }
- s++;
- }
-}
-
-bfd_boolean
-bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
- bfd *abfd;
- asection *input_section;
- struct bfd_link_info *link_info;
- bfd_boolean *again;
-{
- /* Get enough memory to hold the stuff. */
- bfd *input_bfd = input_section->owner;
- unsigned *shrinks;
- unsigned shrink = 0;
- long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
- arelent **reloc_vector = NULL;
- long reloc_count;
-
- /* We only do global relaxation once. It is not safe to do it multiple
- times (see discussion of the "shrinks" array below). */
- *again = FALSE;
-
- if (reloc_size < 0)
- return FALSE;
-
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
- if (!reloc_vector && reloc_size > 0)
- return FALSE;
-
- /* Get the relocs and think about them. */
- reloc_count =
- bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
- _bfd_generic_link_get_symbols (input_bfd));
- if (reloc_count < 0)
- {
- free (reloc_vector);
- return FALSE;
- }
-
- /* The reloc16.c and related relaxing code is very simple, the price
- for that simplicity is we can only call this function once for
- each section.
-
- So, to get the best results within that limitation, we do multiple
- relaxing passes over each section here. That involves keeping track
- of the "shrink" at each reloc in the section. This allows us to
- accurately determine the relative location of two relocs within
- this section.
-
- In theory, if we kept the "shrinks" array for each section for the
- entire link, we could use the generic relaxing code in the linker
- and get better results, particularly for jsr->bsr and 24->16 bit
- memory reference relaxations. */
-
- if (reloc_count > 0)
- {
- int another_pass = 0;
- bfd_size_type amt;
-
- /* Allocate and initialize the shrinks array for this section.
- The last element is used as an accumulator of shrinks. */
- amt = reloc_count + 1;
- amt *= sizeof (unsigned);
- shrinks = (unsigned *) bfd_zmalloc (amt);
-
- /* Loop until nothing changes in this section. */
- do
- {
- arelent **parent;
- unsigned int i;
- long j;
-
- another_pass = 0;
-
- for (i = 0, parent = reloc_vector; *parent; parent++, i++)
- {
- /* Let the target/machine dependent code examine each reloc
- in this section and attempt to shrink it. */
- shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent,
- shrinks[i], link_info);
-
- /* If it shrunk, note it in the shrinks array and set up for
- another pass. */
- if (shrink != shrinks[i])
- {
- another_pass = 1;
- for (j = i + 1; j <= reloc_count; j++)
- shrinks[j] += shrink - shrinks[i];
- }
- }
- }
- while (another_pass);
-
- shrink = shrinks[reloc_count];
- free ((char *) shrinks);
- }
-
- input_section->_cooked_size -= shrink;
- free ((char *) reloc_vector);
- return TRUE;
-}
-
-bfd_byte *
-bfd_coff_reloc16_get_relocated_section_contents (in_abfd,
- link_info,
- link_order,
- data,
- relocatable,
- symbols)
- bfd *in_abfd;
- struct bfd_link_info *link_info;
- struct bfd_link_order *link_order;
- bfd_byte *data;
- bfd_boolean relocatable;
- asymbol **symbols;
-{
- /* Get enough memory to hold the stuff. */
- bfd *input_bfd = link_order->u.indirect.section->owner;
- asection *input_section = link_order->u.indirect.section;
- long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
- arelent **reloc_vector;
- long reloc_count;
-
- if (reloc_size < 0)
- return NULL;
-
- /* If producing relocatable output, don't bother to relax. */
- if (relocatable)
- return bfd_generic_get_relocated_section_contents (in_abfd, link_info,
- link_order,
- data, relocatable,
- symbols);
-
- /* Read in the section. */
- if (!bfd_get_section_contents (input_bfd,
- input_section,
- data,
- (bfd_vma) 0,
- input_section->_raw_size))
- return NULL;
-
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
- if (!reloc_vector && reloc_size != 0)
- return NULL;
-
- reloc_count = bfd_canonicalize_reloc (input_bfd,
- input_section,
- reloc_vector,
- symbols);
- if (reloc_count < 0)
- {
- free (reloc_vector);
- return NULL;
- }
-
- if (reloc_count > 0)
- {
- arelent **parent = reloc_vector;
- arelent *reloc;
- unsigned int dst_address = 0;
- unsigned int src_address = 0;
- unsigned int run;
- unsigned int idx;
-
- /* Find how long a run we can do. */
- while (dst_address < link_order->size)
- {
- reloc = *parent;
- if (reloc)
- {
- /* Note that the relaxing didn't tie up the addresses in the
- relocation, so we use the original address to work out the
- run of non-relocated data. */
- run = reloc->address - src_address;
- parent++;
- }
- else
- {
- run = link_order->size - dst_address;
- }
-
- /* Copy the bytes. */
- for (idx = 0; idx < run; idx++)
- data[dst_address++] = data[src_address++];
-
- /* Now do the relocation. */
- if (reloc)
- {
- bfd_coff_reloc16_extra_cases (input_bfd, link_info, link_order,
- reloc, data, &src_address,
- &dst_address);
- }
- }
- }
- free ((char *) reloc_vector);
- return data;
-}
diff --git a/contrib/binutils/bfd/rs6000-core.c b/contrib/binutils/bfd/rs6000-core.c
deleted file mode 100644
index 3fa0975..0000000
--- a/contrib/binutils/bfd/rs6000-core.c
+++ /dev/null
@@ -1,735 +0,0 @@
-/* IBM RS/6000 "XCOFF" back-end for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002
- Free Software Foundation, Inc.
- FIXME: Can someone provide a transliteration of this name into ASCII?
- Using the following chars caused a compiler warning on HIUX (so I replaced
- them with octal escapes), and isn't useful without an understanding of what
- character set it is.
- Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
- and John Gilmore.
- Archive support from Damon A. Permezel.
- Contributed by IBM Corporation and Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This port currently only handles reading object files, except when
- compiled on an RS/6000 host. -- no archive support, no core files.
- In all cases, it does not support writing.
-
- This is in a separate file from coff-rs6000.c, because it includes
- system include files that conflict with coff/rs6000.h. */
-
-/* Internalcoff.h and coffcode.h modify themselves based on this flag. */
-#define RS6000COFF_C 1
-
-/* The AIX 4.1 kernel is obviously compiled with -D_LONG_LONG, so
- we have to define _LONG_LONG for older versions of gcc to get the
- proper alignments in the user structure. */
-#if defined(_AIX41) && !defined(_LONG_LONG)
-#define _LONG_LONG
-#endif
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-
-#ifdef AIX_CORE
-
-/* AOUTHDR is defined by the above. We need another defn of it, from the
- system include files. Punt the old one and get us a new name for the
- typedef in the system include files. */
-#ifdef AOUTHDR
-#undef AOUTHDR
-#endif
-#define AOUTHDR second_AOUTHDR
-
-#undef SCNHDR
-
-/* ------------------------------------------------------------------------ */
-/* Support for core file stuff.. */
-/* ------------------------------------------------------------------------ */
-
-#include <sys/user.h>
-#define __LDINFO_PTRACE32__ /* for __ld_info32 */
-#define __LDINFO_PTRACE64__ /* for __ld_info64 */
-#include <sys/ldr.h>
-#include <sys/core.h>
-#include <sys/systemcfg.h>
-
-#define core_hdr(bfd) ((CoreHdr *) bfd->tdata.any)
-
-/* AIX 4.1 changed the names and locations of a few items in the core file.
- AIX 4.3 defined an entirely new structure, core_dumpx, but kept support for
- the previous 4.1 structure, core_dump.
-
- AIX_CORE_DUMPX_CORE is defined (by configure) on AIX 4.3+, and
- CORE_VERSION_1 is defined (by AIX core.h) as 2 on AIX 4.3+ and as 1 on AIX
- 4.1 and 4.2. AIX pre-4.1 (aka 3.x) either doesn't define CORE_VERSION_1
- or else defines it as 0. */
-
-#if defined(CORE_VERSION_1) && !CORE_VERSION_1
-# undef CORE_VERSION_1
-#endif
-
-/* The following union and macros allow this module to compile on all AIX
- versions and to handle both core_dumpx and core_dump on 4.3+. CNEW_*()
- and COLD_*() macros respectively retrieve core_dumpx and core_dump
- values. */
-
-/* Union of 32-bit and 64-bit versions of ld_info. */
-
-typedef union {
-#ifdef __ld_info32
- struct __ld_info32 l32;
- struct __ld_info64 l64;
-#else
- struct ld_info l32;
- struct ld_info l64;
-#endif
-} LdInfo;
-
-/* Union of old and new core dump structures. */
-
-typedef union {
-#ifdef AIX_CORE_DUMPX_CORE
- struct core_dumpx new; /* new AIX 4.3+ core dump */
-#else
- struct core_dump new; /* for simpler coding */
-#endif
- struct core_dump old; /* old AIX 4.2- core dump, still used on
- 4.3+ with appropriate SMIT config */
-} CoreHdr;
-
-/* Union of old and new vm_info structures. */
-
-#ifdef CORE_VERSION_1
-typedef union {
-#ifdef AIX_CORE_DUMPX_CORE
- struct vm_infox new;
-#else
- struct vm_info new;
-#endif
- struct vm_info old;
-} VmInfo;
-#endif
-
-/* Return whether CoreHdr C is in new or old format. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CORE_NEW(c) (!(c).old.c_entries)
-#else
-# define CORE_NEW(c) 0
-#endif
-
-/* Return the c_stackorg field from struct core_dumpx C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_STACKORG(c) (c).c_stackorg
-#else
-# define CNEW_STACKORG(c) 0
-#endif
-
-/* Return the offset to the loader region from struct core_dump C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_LOADER(c) (c).c_loader
-#else
-# define CNEW_LOADER(c) 0
-#endif
-
-/* Return the offset to the loader region from struct core_dump C. */
-
-#define COLD_LOADER(c) (c).c_tab
-
-/* Return the c_lsize field from struct core_dumpx C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_LSIZE(c) (c).c_lsize
-#else
-# define CNEW_LSIZE(c) 0
-#endif
-
-/* Return the c_dataorg field from struct core_dumpx C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_DATAORG(c) (c).c_dataorg
-#else
-# define CNEW_DATAORG(c) 0
-#endif
-
-/* Return the c_datasize field from struct core_dumpx C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_DATASIZE(c) (c).c_datasize
-#else
-# define CNEW_DATASIZE(c) 0
-#endif
-
-/* Return the c_impl field from struct core_dumpx C. */
-
-#if defined (HAVE_ST_C_IMPL) || defined (AIX_5_CORE)
-# define CNEW_IMPL(c) (c).c_impl
-#else
-# define CNEW_IMPL(c) 0
-#endif
-
-/* Return the command string from struct core_dumpx C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_COMM(c) (c).c_u.U_proc.pi_comm
-#else
-# define CNEW_COMM(c) 0
-#endif
-
-/* Return the command string from struct core_dump C. */
-
-#ifdef CORE_VERSION_1
-# define COLD_COMM(c) (c).c_u.U_comm
-#else
-# define COLD_COMM(c) (c).c_u.u_comm
-#endif
-
-/* Return the struct __context64 pointer from struct core_dumpx C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_CONTEXT64(c) (c).c_flt.hctx.r64
-#else
-# define CNEW_CONTEXT64(c) c
-#endif
-
-/* Return the struct mstsave pointer from struct core_dumpx C. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_MSTSAVE(c) (c).c_flt.hctx.r32
-#else
-# define CNEW_MSTSAVE(c) c
-#endif
-
-/* Return the struct mstsave pointer from struct core_dump C. */
-
-#ifdef CORE_VERSION_1
-# define COLD_MSTSAVE(c) (c).c_mst
-#else
-# define COLD_MSTSAVE(c) (c).c_u.u_save
-#endif
-
-/* Return whether struct core_dumpx is from a 64-bit process. */
-
-#ifdef AIX_CORE_DUMPX_CORE
-# define CNEW_PROC64(c) IS_PROC64(&(c).c_u.U_proc)
-#else
-# define CNEW_PROC64(c) 0
-#endif
-
-/* Magic end-of-stack addresses for old core dumps. This is _very_ fragile,
- but I don't see any easy way to get that info right now. */
-
-#ifdef CORE_VERSION_1
-# define COLD_STACKEND 0x2ff23000
-#else
-# define COLD_STACKEND 0x2ff80000
-#endif
-
-/* Size of the leading portion that old and new core dump structures have in
- common. */
-#define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \
- + sizeof (((struct core_dump *) 0)->c_entries))
-
-/* Try to read into CORE the header from the core file associated with ABFD.
- Return success. */
-
-static bfd_boolean
-read_hdr (bfd *abfd, CoreHdr *core)
-{
- bfd_size_type size;
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
-
- /* Read the leading portion that old and new core dump structures have in
- common. */
- size = CORE_COMMONSZ;
- if (bfd_bread (core, size, abfd) != size)
- return FALSE;
-
- /* Read the trailing portion of the structure. */
- if (CORE_NEW (*core))
- size = sizeof (core->new);
- else
- size = sizeof (core->old);
- size -= CORE_COMMONSZ;
- return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) == size;
-}
-
-static asection *
-make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
- bfd *abfd;
- const char *name;
- flagword flags;
- bfd_size_type _raw_size;
- bfd_vma vma;
- file_ptr filepos;
-{
- asection *asect;
-
- asect = bfd_make_section_anyway (abfd, name);
- if (!asect)
- return NULL;
-
- asect->flags = flags;
- asect->_raw_size = _raw_size;
- asect->vma = vma;
- asect->filepos = filepos;
- asect->alignment_power = 8;
-
- return asect;
-}
-
-/* Decide if a given bfd represents a `core' file or not. There really is no
- magic number or anything like, in rs6000coff. */
-
-const bfd_target *
-rs6000coff_core_p (abfd)
- bfd *abfd;
-{
- CoreHdr core;
- struct stat statbuf;
- bfd_size_type size;
- char *tmpptr;
-
- /* Values from new and old core structures. */
- int c_flag;
- file_ptr c_stack, c_regoff, c_loader;
- bfd_size_type c_size, c_regsize, c_lsize;
- bfd_vma c_stackend;
- void *c_regptr;
- int proc64;
-
- if (!read_hdr (abfd, &core))
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Copy fields from new or old core structure. */
- if (CORE_NEW (core))
- {
- c_flag = core.new.c_flag;
- c_stack = (file_ptr) core.new.c_stack;
- c_size = core.new.c_size;
- c_stackend = CNEW_STACKORG (core.new) + c_size;
- c_lsize = CNEW_LSIZE (core.new);
- c_loader = CNEW_LOADER (core.new);
- proc64 = CNEW_PROC64 (core.new);
- }
- else
- {
- c_flag = core.old.c_flag;
- c_stack = (file_ptr) core.old.c_stack;
- c_size = core.old.c_size;
- c_stackend = COLD_STACKEND;
- c_lsize = 0x7ffffff;
- c_loader = (file_ptr) COLD_LOADER (core.old);
- proc64 = 0;
- }
-
- if (proc64)
- {
- c_regsize = sizeof (CNEW_CONTEXT64 (core.new));
- c_regptr = &CNEW_CONTEXT64 (core.new);
- }
- else if (CORE_NEW (core))
- {
- c_regsize = sizeof (CNEW_MSTSAVE (core.new));
- c_regptr = &CNEW_MSTSAVE (core.new);
- }
- else
- {
- c_regsize = sizeof (COLD_MSTSAVE (core.old));
- c_regptr = &COLD_MSTSAVE (core.old);
- }
- c_regoff = (char *) c_regptr - (char *) &core;
-
- if (bfd_stat (abfd, &statbuf) < 0)
- {
- bfd_set_error (bfd_error_system_call);
- return NULL;
- }
-
- /* If the core file ulimit is too small, the system will first
- omit the data segment, then omit the stack, then decline to
- dump core altogether (as far as I know UBLOCK_VALID and LE_VALID
- are always set) (this is based on experimentation on AIX 3.2).
- Now, the thing is that GDB users will be surprised
- if segments just silently don't appear (well, maybe they would
- think to check "info files", I don't know).
-
- For the data segment, we have no choice but to keep going if it's
- not there, since the default behavior is not to dump it (regardless
- of the ulimit, it's based on SA_FULLDUMP). But for the stack segment,
- if it's not there, we refuse to have anything to do with this core
- file. The usefulness of a core dump without a stack segment is pretty
- limited anyway. */
-
- if (!(c_flag & UBLOCK_VALID)
- || !(c_flag & LE_VALID))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (!(c_flag & USTACK_VALID))
- {
- bfd_set_error (bfd_error_file_truncated);
- return NULL;
- }
-
- /* Don't check the core file size for a full core, AIX 4.1 includes
- additional shared library sections in a full core. */
- if (!(c_flag & (FULL_CORE | CORE_TRUNC)))
- {
- /* If the size is wrong, it means we're misinterpreting something. */
- if (c_stack + (file_ptr) c_size != statbuf.st_size)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- }
-
- /* Sanity check on the c_tab field. */
- if (!CORE_NEW (core) && (c_loader < (file_ptr) sizeof core.old ||
- c_loader >= statbuf.st_size ||
- c_loader >= c_stack))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Issue warning if the core file was truncated during writing. */
- if (c_flag & CORE_TRUNC)
- (*_bfd_error_handler) (_("%s: warning core file truncated"),
- bfd_get_filename (abfd));
-
- /* Allocate core file header. */
- size = CORE_NEW (core) ? sizeof (core.new) : sizeof (core.old);
- tmpptr = (char *) bfd_zalloc (abfd, (bfd_size_type) size);
- if (!tmpptr)
- return NULL;
-
- /* Copy core file header. */
- memcpy (tmpptr, &core, size);
- set_tdata (abfd, tmpptr);
-
- /* Set architecture. */
- if (CORE_NEW (core))
- {
- enum bfd_architecture arch;
- unsigned long mach;
-
- switch (CNEW_IMPL (core.new))
- {
- case POWER_RS1:
- case POWER_RSC:
- case POWER_RS2:
- arch = bfd_arch_rs6000;
- mach = bfd_mach_rs6k;
- break;
- default:
- arch = bfd_arch_powerpc;
- mach = bfd_mach_ppc;
- break;
- }
- bfd_default_set_arch_mach (abfd, arch, mach);
- }
-
- /* .stack section. */
- if (!make_bfd_asection (abfd, ".stack",
- SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
- c_size, c_stackend - c_size, c_stack))
- goto fail;
-
- /* .reg section for all registers. */
- if (!make_bfd_asection (abfd, ".reg",
- SEC_HAS_CONTENTS,
- c_regsize, (bfd_vma) 0, c_regoff))
- goto fail;
-
- /* .ldinfo section.
- To actually find out how long this section is in this particular
- core dump would require going down the whole list of struct ld_info's.
- See if we can just fake it. */
- if (!make_bfd_asection (abfd, ".ldinfo",
- SEC_HAS_CONTENTS,
- c_lsize, (bfd_vma) 0, c_loader))
- goto fail;
-
-#ifndef CORE_VERSION_1
- /* .data section if present.
- AIX 3 dumps the complete data section and sets FULL_CORE if the
- ulimit is large enough, otherwise the data section is omitted.
- AIX 4 sets FULL_CORE even if the core file is truncated, we have
- to examine core.c_datasize below to find out the actual size of
- the .data section. */
- if (c_flag & FULL_CORE)
- {
- if (!make_bfd_asection (abfd, ".data",
- SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
- (bfd_size_type) core.old.c_u.u_dsize,
- (bfd_vma)
- CDATA_ADDR (core.old.c_u.u_dsize),
- c_stack + c_size))
- goto fail;
- }
-#endif
-
-#ifdef CORE_VERSION_1
- /* AIX 4 adds data sections from loaded objects to the core file,
- which can be found by examining ldinfo, and anonymously mmapped
- regions. */
- {
- LdInfo ldinfo;
- bfd_size_type ldi_datasize;
- file_ptr ldi_core;
- uint ldi_next;
- bfd_vma ldi_dataorg;
-
- /* Fields from new and old core structures. */
- bfd_size_type c_datasize, c_vmregions;
- file_ptr c_data, c_vmm;
-
- if (CORE_NEW (core))
- {
- c_datasize = CNEW_DATASIZE (core.new);
- c_data = (file_ptr) core.new.c_data;
- c_vmregions = core.new.c_vmregions;
- c_vmm = (file_ptr) core.new.c_vmm;
- }
- else
- {
- c_datasize = core.old.c_datasize;
- c_data = (file_ptr) core.old.c_data;
- c_vmregions = core.old.c_vmregions;
- c_vmm = (file_ptr) core.old.c_vmm;
- }
-
- /* .data section from executable. */
- if (c_datasize)
- {
- if (!make_bfd_asection (abfd, ".data",
- SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
- c_datasize,
- (bfd_vma) CDATA_ADDR (c_datasize),
- c_data))
- goto fail;
- }
-
- /* .data sections from loaded objects. */
- if (proc64)
- size = (int) ((LdInfo *) 0)->l64.ldinfo_filename;
- else
- size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;
-
- while (1)
- {
- if (bfd_seek (abfd, c_loader, SEEK_SET) != 0)
- goto fail;
- if (bfd_bread (&ldinfo, size, abfd) != size)
- goto fail;
-
- if (proc64)
- {
- ldi_core = ldinfo.l64.ldinfo_core;
- ldi_datasize = ldinfo.l64.ldinfo_datasize;
- ldi_dataorg = (bfd_vma) ldinfo.l64.ldinfo_dataorg;
- ldi_next = ldinfo.l64.ldinfo_next;
- }
- else
- {
- ldi_core = ldinfo.l32.ldinfo_core;
- ldi_datasize = ldinfo.l32.ldinfo_datasize;
- ldi_dataorg = (bfd_vma) (long) ldinfo.l32.ldinfo_dataorg;
- ldi_next = ldinfo.l32.ldinfo_next;
- }
-
- if (ldi_core)
- if (!make_bfd_asection (abfd, ".data",
- SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
- ldi_datasize, ldi_dataorg, ldi_core))
- goto fail;
-
- if (ldi_next == 0)
- break;
- c_loader += ldi_next;
- }
-
- /* .vmdata sections from anonymously mmapped regions. */
- if (c_vmregions)
- {
- bfd_size_type i;
-
- if (bfd_seek (abfd, c_vmm, SEEK_SET) != 0)
- goto fail;
-
- for (i = 0; i < c_vmregions; i++)
- {
- VmInfo vminfo;
- bfd_size_type vminfo_size;
- file_ptr vminfo_offset;
- bfd_vma vminfo_addr;
-
- size = CORE_NEW (core) ? sizeof (vminfo.new) : sizeof (vminfo.old);
- if (bfd_bread (&vminfo, size, abfd) != size)
- goto fail;
-
- if (CORE_NEW (core))
- {
- vminfo_addr = (bfd_vma) vminfo.new.vminfo_addr;
- vminfo_size = vminfo.new.vminfo_size;
- vminfo_offset = vminfo.new.vminfo_offset;
- }
- else
- {
- vminfo_addr = (bfd_vma) (long) vminfo.old.vminfo_addr;
- vminfo_size = vminfo.old.vminfo_size;
- vminfo_offset = vminfo.old.vminfo_offset;
- }
-
- if (vminfo_offset)
- if (!make_bfd_asection (abfd, ".vmdata",
- SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
- vminfo_size, vminfo_addr,
- vminfo_offset))
- goto fail;
- }
- }
- }
-#endif
-
- return abfd->xvec; /* This is garbage for now. */
-
- fail:
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = NULL;
- bfd_section_list_clear (abfd);
- return NULL;
-}
-
-/* Return `TRUE' if given core is from the given executable. */
-
-bfd_boolean
-rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd;
- bfd *exec_bfd;
-{
- CoreHdr core;
- bfd_size_type size;
- char *path, *s;
- size_t alloc;
- const char *str1, *str2;
- bfd_boolean ret;
- file_ptr c_loader;
-
- if (!read_hdr (core_bfd, &core))
- return FALSE;
-
- if (CORE_NEW (core))
- c_loader = CNEW_LOADER (core.new);
- else
- c_loader = (file_ptr) COLD_LOADER (core.old);
-
- if (CORE_NEW (core) && CNEW_PROC64 (core.new))
- size = (int) ((LdInfo *) 0)->l64.ldinfo_filename;
- else
- size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;
-
- if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
- return FALSE;
-
- alloc = 100;
- path = bfd_malloc ((bfd_size_type) alloc);
- if (path == NULL)
- return FALSE;
- s = path;
-
- while (1)
- {
- if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1)
- {
- free (path);
- return FALSE;
- }
- if (*s == '\0')
- break;
- ++s;
- if (s == path + alloc)
- {
- char *n;
-
- alloc *= 2;
- n = bfd_realloc (path, (bfd_size_type) alloc);
- if (n == NULL)
- {
- free (path);
- return FALSE;
- }
- s = n + (path - s);
- path = n;
- }
- }
-
- str1 = strrchr (path, '/');
- str2 = strrchr (exec_bfd->filename, '/');
-
- /* step over character '/' */
- str1 = str1 != NULL ? str1 + 1 : path;
- str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
-
- if (strcmp (str1, str2) == 0)
- ret = TRUE;
- else
- ret = FALSE;
-
- free (path);
-
- return ret;
-}
-
-char *
-rs6000coff_core_file_failing_command (abfd)
- bfd *abfd;
-{
- CoreHdr *core = core_hdr (abfd);
- char *com = CORE_NEW (*core) ?
- CNEW_COMM (core->new) : COLD_COMM (core->old);
-
- if (*com)
- return com;
- else
- return 0;
-}
-
-int
-rs6000coff_core_file_failing_signal (abfd)
- bfd *abfd;
-{
- CoreHdr *core = core_hdr (abfd);
- return CORE_NEW (*core) ? core->new.c_signo : core->old.c_signo;
-}
-
-#endif /* AIX_CORE */
diff --git a/contrib/binutils/bfd/sco5-core.c b/contrib/binutils/bfd/sco5-core.c
deleted file mode 100644
index 5c34ff1..0000000
--- a/contrib/binutils/bfd/sco5-core.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/* BFD back end for SCO5 core files (U-area and raw sections)
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Jouke Numan <jnuman@hiscom.nl>
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-
-#include <sys/user.h> /* After a.out.h */
-#include <sys/paccess.h>
-#include <sys/region.h>
-
-struct sco5_core_struct
-{
- struct user u;
-};
-
-/* forward declarations */
-
-static asection *make_bfd_asection
- PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr));
-static struct user *read_uarea PARAMS ((bfd *, int));
-const bfd_target *sco5_core_file_p PARAMS ((bfd *abfd));
-char *sco5_core_file_failing_command PARAMS ((bfd *abfd));
-int sco5_core_file_failing_signal PARAMS ((bfd *abfd));
-bfd_boolean sco5_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-static void swap_abort PARAMS ((void));
-
-static asection *
-make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
- bfd *abfd;
- const char *name;
- flagword flags;
- bfd_size_type _raw_size;
- bfd_vma vma;
- file_ptr filepos;
-{
- asection *asect;
-
- asect = bfd_make_section_anyway (abfd, name);
- if (!asect)
- return NULL;
- asect->flags = flags;
- asect->_raw_size = _raw_size;
- asect->vma = vma;
- asect->filepos = filepos;
- asect->alignment_power = 2;
-
- return asect;
-}
-
-static struct user *
-read_uarea(abfd, filepos)
- bfd *abfd;
- int filepos;
-
-{
- struct sco5_core_struct *rawptr;
- bfd_size_type amt = sizeof (struct sco5_core_struct);
-
- rawptr = (struct sco5_core_struct *) bfd_zmalloc (amt);
- if (rawptr == NULL)
- return NULL;
-
- abfd->tdata.sco5_core_data = rawptr;
-
- if (bfd_seek (abfd, (file_ptr) filepos, SEEK_SET) != 0
- || bfd_bread ((void *) &rawptr->u, (bfd_size_type) sizeof rawptr->u,
- abfd) != sizeof rawptr->u)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Sanity check perhaps??? */
- if (rawptr->u.u_dsize > 0x1000000) /* Remember, it's in pages... */
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- if (rawptr->u.u_ssize > 0x1000000)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- return &rawptr->u;
-}
-
-const bfd_target *
-sco5_core_file_p (abfd)
- bfd *abfd;
-{
- int coffset_siz, val, nsecs, cheadoffs;
- int coresize;
- struct user *u;
- struct coreoffsets coffsets;
- struct coresecthead chead;
- char *secname;
- flagword flags;
-
- /* Read coreoffsets region at end of core (see core(FP)) */
-
- {
- FILE *stream = bfd_cache_lookup (abfd);
- struct stat statbuf;
- if (stream == NULL)
- return NULL;
- if (fstat (fileno (stream), &statbuf) < 0)
- {
- bfd_set_error (bfd_error_system_call);
- return NULL;
- }
- coresize = statbuf.st_size;
- }
- /* Last long in core is sizeof struct coreoffsets, read it */
- if ((bfd_seek (abfd, (file_ptr) (coresize - sizeof coffset_siz),
- SEEK_SET) != 0)
- || bfd_bread ((void *) &coffset_siz, (bfd_size_type) sizeof coffset_siz,
- abfd) != sizeof coffset_siz)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Use it to seek start of coreoffsets region, read it and determine
- validity */
- if ((bfd_seek (abfd, (file_ptr) (coresize - coffset_siz), SEEK_SET) != 0)
- || (bfd_bread ((void *) &coffsets, (bfd_size_type) sizeof coffsets, abfd)
- != sizeof coffsets)
- || ((coffsets.u_info != 1) && (coffsets.u_info != C_VERSION)))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- if (coffsets.u_info == 1)
- {
- /* Old version, no section heads, read info from user struct */
-
- u = read_uarea (abfd, coffsets.u_user);
- if (! u)
- goto fail;
-
- if (!make_bfd_asection (abfd, ".reg", SEC_HAS_CONTENTS,
- (bfd_size_type) coffsets.u_usize,
- 0 - (bfd_vma) u->u_ar0,
- (file_ptr) coffsets.u_user))
- goto fail;
-
- if (!make_bfd_asection (abfd, ".data",
- SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
- ((bfd_size_type) u->u_exdata.ux_dsize
- + u->u_exdata.ux_bsize),
- (bfd_vma) u->u_exdata.ux_datorg,
- (file_ptr) coffsets.u_data))
- goto fail;
-
- if (!make_bfd_asection (abfd, ".stack",
- SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
- (bfd_size_type) u->u_ssize * NBPC,
- (bfd_vma) u->u_sub,
- (file_ptr) coffsets.u_stack))
- goto fail;
-
- return abfd->xvec; /* Done for version 1 */
- }
-
- /* Immediately before coreoffsets region is a long with offset in core
- to first coresecthead (CORES_OFFSETS), the long before this is the
- number of section heads in the list. Read both longs and read the
- coresecthead and check its validity */
-
- if ((bfd_seek (abfd,
- (file_ptr) (coresize - coffset_siz - 2 * sizeof coffset_siz),
- SEEK_SET) != 0)
- || (bfd_bread ((void *) &nsecs, (bfd_size_type) sizeof nsecs, abfd)
- != sizeof nsecs)
- || (bfd_bread ((void *) &cheadoffs, (bfd_size_type) sizeof cheadoffs,
- abfd) != sizeof cheadoffs)
- || (bfd_seek (abfd, (file_ptr) cheadoffs, SEEK_SET) != 0)
- || (bfd_bread ((void *) &chead, (bfd_size_type) sizeof chead, abfd)
- != sizeof chead)
- || (chead.cs_stype != CORES_OFFSETS)
- || (chead.cs_x.csx_magic != COREMAGIC_NUMBER))
- {
- bfd_set_error (bfd_error_wrong_format);
- goto fail;
- }
-
- /* OK, we believe you. You're a core file (sure, sure). */
-
- /* Now loop over all regions and map them */
- nsecs--; /* We've seen CORES_OFFSETS already */
- for (; nsecs; nsecs--)
- {
- if ((bfd_seek (abfd, (file_ptr) chead.cs_hseek, SEEK_SET) != 0)
- || (bfd_bread ((void *) &chead, (bfd_size_type) sizeof chead, abfd)
- != sizeof chead))
- {
- bfd_set_error (bfd_error_wrong_format);
- goto fail;
- }
-
- switch (chead.cs_stype)
- {
- case CORES_MAGIC: /* Core header, check magic */
- if (chead.cs_x.csx_magic != COREMAGIC_NUMBER)
- {
- bfd_set_error (bfd_error_wrong_format);
- goto fail;
- }
- secname = NULL;
- nsecs++; /* MAGIC not in section cnt!*/
- break;
- case CORES_UAREA: /* U-area, read in tdata */
- u = read_uarea (abfd, chead.cs_sseek);
- if (! u)
- goto fail;
-
- /* This is tricky. As the "register section", we give them
- the entire upage and stack. u.u_ar0 points to where
- "register 0" is stored. There are two tricks with this,
- though. One is that the rest of the registers might be
- at positive or negative (or both) displacements from
- *u_ar0. The other is that u_ar0 is sometimes an absolute
- address in kernel memory, and on other systems it is an
- offset from the beginning of the `struct user'.
-
- As a practical matter, we don't know where the registers
- actually are, so we have to pass the whole area to GDB.
- We encode the value of u_ar0 by setting the .regs section
- up so that its virtual memory address 0 is at the place
- pointed to by u_ar0 (by setting the vma of the start of
- the section to -u_ar0). GDB uses this info to locate the
- regs, using minor trickery to get around the
- offset-or-absolute-addr problem. */
-
- chead.cs_vaddr = 0 - (bfd_vma) u->u_ar0;
-
- secname = ".reg";
- flags = SEC_HAS_CONTENTS;
-
- break;
- case CORES_PREGION: /* A program region, map it */
- switch (chead.cs_x.csx_preg.csxp_rtyp)
- {
- case PT_DATA:
- secname = ".data"; /* Data region. */
- break;
- case PT_STACK:
- secname = ".stack"; /* Stack region. */
- break;
- case PT_SHMEM:
- secname = ".shmem"; /* Shared memory */
- break;
- case PT_LIBDAT:
- secname = ".libdat"; /* Shared library data */
- break;
- case PT_V86:
- secname = ".virt86"; /* Virtual 8086 mode */
- break;
- case PT_SHFIL:
- secname = ".mmfile"; /* Memory mapped file */
- break;
- case PT_XDATA0:
- secname = ".Xdat0"; /* XENIX data region, virtual 0 */
- break;
- default:
- secname = "";
- }
- flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- break;
- case CORES_PROC: /* struct proc */
- case CORES_ITIMER: /* interval timers */
- case CORES_SCOUTSNAME: /* struct scoutsname */
- secname = NULL; /* Ignore these */
- break;
- default:
- (*_bfd_error_handler) ("Unhandled SCO core file section type %d\n",
- chead.cs_stype);
- continue;
- }
-
- if (secname
- && !make_bfd_asection (abfd, secname, flags,
- (bfd_size_type) chead.cs_vsize,
- (bfd_vma) chead.cs_vaddr,
- (file_ptr) chead.cs_sseek))
- goto fail;
-
- }
-
- return abfd->xvec;
-
- fail:
- if (abfd->tdata.any)
- {
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = NULL;
- }
- bfd_section_list_clear (abfd);
- return NULL;
-}
-
-char *
-sco5_core_file_failing_command (abfd)
- bfd *abfd;
-{
- char *com = abfd->tdata.sco5_core_data->u.u_comm;
- if (*com)
- return com;
- else
- return NULL;
-}
-
-int
-sco5_core_file_failing_signal (ignore_abfd)
- bfd *ignore_abfd;
-{
- return ((ignore_abfd->tdata.sco5_core_data->u.u_sysabort != 0)
- ? ignore_abfd->tdata.sco5_core_data->u.u_sysabort
- : -1);
-}
-
-bfd_boolean
-sco5_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd ATTRIBUTE_UNUSED;
- bfd *exec_bfd ATTRIBUTE_UNUSED;
-{
- return TRUE; /* FIXME, We have no way of telling at this point */
-}
-
-/* If somebody calls any byte-swapping routines, shoot them. */
-static void
-swap_abort ()
-{
- abort (); /* This way doesn't require any declaration for ANSI to fuck up */
-}
-
-#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
-#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
-#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
-#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
-#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
-#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
-
-const bfd_target sco5_core_vec =
- {
- "sco5-core",
- bfd_target_unknown_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order */
- BFD_ENDIAN_LITTLE, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* symbol prefix */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
-
- { /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- sco5_core_file_p /* a core file */
- },
- { /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
- { /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
-
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (sco5),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0 /* backend_data */
- };
diff --git a/contrib/binutils/bfd/section.c b/contrib/binutils/bfd/section.c
deleted file mode 100644
index fce8e1e..0000000
--- a/contrib/binutils/bfd/section.c
+++ /dev/null
@@ -1,1368 +0,0 @@
-/* Object file "section" support for the BFD library.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- Sections
-
- The raw data contained within a BFD is maintained through the
- section abstraction. A single BFD may have any number of
- sections. It keeps hold of them by pointing to the first;
- each one points to the next in the list.
-
- Sections are supported in BFD in <<section.c>>.
-
-@menu
-@* Section Input::
-@* Section Output::
-@* typedef asection::
-@* section prototypes::
-@end menu
-
-INODE
-Section Input, Section Output, Sections, Sections
-SUBSECTION
- Section input
-
- When a BFD is opened for reading, the section structures are
- created and attached to the BFD.
-
- Each section has a name which describes the section in the
- outside world---for example, <<a.out>> would contain at least
- three sections, called <<.text>>, <<.data>> and <<.bss>>.
-
- Names need not be unique; for example a COFF file may have several
- sections named <<.data>>.
-
- Sometimes a BFD will contain more than the ``natural'' number of
- sections. A back end may attach other sections containing
- constructor data, or an application may add a section (using
- <<bfd_make_section>>) to the sections attached to an already open
- BFD. For example, the linker creates an extra section
- <<COMMON>> for each input file's BFD to hold information about
- common storage.
-
- The raw data is not necessarily read in when
- the section descriptor is created. Some targets may leave the
- data in place until a <<bfd_get_section_contents>> call is
- made. Other back ends may read in all the data at once. For
- example, an S-record file has to be read once to determine the
- size of the data. An IEEE-695 file doesn't contain raw data in
- sections, but data and relocation expressions intermixed, so
- the data area has to be parsed to get out the data and
- relocations.
-
-INODE
-Section Output, typedef asection, Section Input, Sections
-
-SUBSECTION
- Section output
-
- To write a new object style BFD, the various sections to be
- written have to be created. They are attached to the BFD in
- the same way as input sections; data is written to the
- sections using <<bfd_set_section_contents>>.
-
- Any program that creates or combines sections (e.g., the assembler
- and linker) must use the <<asection>> fields <<output_section>> and
- <<output_offset>> to indicate the file sections to which each
- section must be written. (If the section is being created from
- scratch, <<output_section>> should probably point to the section
- itself and <<output_offset>> should probably be zero.)
-
- The data to be written comes from input sections attached
- (via <<output_section>> pointers) to
- the output sections. The output section structure can be
- considered a filter for the input section: the output section
- determines the vma of the output data and the name, but the
- input section determines the offset into the output section of
- the data to be written.
-
- E.g., to create a section "O", starting at 0x100, 0x123 long,
- containing two subsections, "A" at offset 0x0 (i.e., at vma
- 0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the <<asection>>
- structures would look like:
-
-| section name "A"
-| output_offset 0x00
-| size 0x20
-| output_section -----------> section name "O"
-| | vma 0x100
-| section name "B" | size 0x123
-| output_offset 0x20 |
-| size 0x103 |
-| output_section --------|
-
-SUBSECTION
- Link orders
-
- The data within a section is stored in a @dfn{link_order}.
- These are much like the fixups in <<gas>>. The link_order
- abstraction allows a section to grow and shrink within itself.
-
- A link_order knows how big it is, and which is the next
- link_order and where the raw data for it is; it also points to
- a list of relocations which apply to it.
-
- The link_order is used by the linker to perform relaxing on
- final code. The compiler creates code which is as big as
- necessary to make it work without relaxing, and the user can
- select whether to relax. Sometimes relaxing takes a lot of
- time. The linker runs around the relocations to see if any
- are attached to data which can be shrunk, if so it does it on
- a link_order by link_order basis.
-
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-
-/*
-DOCDD
-INODE
-typedef asection, section prototypes, Section Output, Sections
-SUBSECTION
- typedef asection
-
- Here is the section structure:
-
-CODE_FRAGMENT
-.
-.{* This structure is used for a comdat section, as in PE. A comdat
-. section is associated with a particular symbol. When the linker
-. sees a comdat section, it keeps only one of the sections with a
-. given name and associated with a given symbol. *}
-.
-.struct bfd_comdat_info
-.{
-. {* The name of the symbol associated with a comdat section. *}
-. const char *name;
-.
-. {* The local symbol table index of the symbol associated with a
-. comdat section. This is only meaningful to the object file format
-. specific code; it is not an index into the list returned by
-. bfd_canonicalize_symtab. *}
-. long symbol;
-.};
-.
-.typedef struct bfd_section
-.{
-. {* The name of the section; the name isn't a copy, the pointer is
-. the same as that passed to bfd_make_section. *}
-. const char *name;
-.
-. {* A unique sequence number. *}
-. int id;
-.
-. {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *}
-. int index;
-.
-. {* The next section in the list belonging to the BFD, or NULL. *}
-. struct bfd_section *next;
-.
-. {* The field flags contains attributes of the section. Some
-. flags are read in from the object file, and some are
-. synthesized from other information. *}
-. flagword flags;
-.
-.#define SEC_NO_FLAGS 0x000
-.
-. {* Tells the OS to allocate space for this section when loading.
-. This is clear for a section containing debug information only. *}
-.#define SEC_ALLOC 0x001
-.
-. {* Tells the OS to load the section from the file when loading.
-. This is clear for a .bss section. *}
-.#define SEC_LOAD 0x002
-.
-. {* The section contains data still to be relocated, so there is
-. some relocation information too. *}
-.#define SEC_RELOC 0x004
-.
-. {* ELF reserves 4 processor specific bits and 8 operating system
-. specific bits in sh_flags; at present we can get away with just
-. one in communicating between the assembler and BFD, but this
-. isn't a good long-term solution. *}
-.#define SEC_ARCH_BIT_0 0x008
-.
-. {* A signal to the OS that the section contains read only data. *}
-.#define SEC_READONLY 0x010
-.
-. {* The section contains code only. *}
-.#define SEC_CODE 0x020
-.
-. {* The section contains data only. *}
-.#define SEC_DATA 0x040
-.
-. {* The section will reside in ROM. *}
-.#define SEC_ROM 0x080
-.
-. {* The section contains constructor information. This section
-. type is used by the linker to create lists of constructors and
-. destructors used by <<g++>>. When a back end sees a symbol
-. which should be used in a constructor list, it creates a new
-. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
-. the symbol to it, and builds a relocation. To build the lists
-. of constructors, all the linker has to do is catenate all the
-. sections called <<__CTOR_LIST__>> and relocate the data
-. contained within - exactly the operations it would peform on
-. standard data. *}
-.#define SEC_CONSTRUCTOR 0x100
-.
-. {* The section has contents - a data section could be
-. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
-. <<SEC_HAS_CONTENTS>> *}
-.#define SEC_HAS_CONTENTS 0x200
-.
-. {* An instruction to the linker to not output the section
-. even if it has information which would normally be written. *}
-.#define SEC_NEVER_LOAD 0x400
-.
-. {* The section is a COFF shared library section. This flag is
-. only for the linker. If this type of section appears in
-. the input file, the linker must copy it to the output file
-. without changing the vma or size. FIXME: Although this
-. was originally intended to be general, it really is COFF
-. specific (and the flag was renamed to indicate this). It
-. might be cleaner to have some more general mechanism to
-. allow the back end to control what the linker does with
-. sections. *}
-.#define SEC_COFF_SHARED_LIBRARY 0x800
-.
-. {* The section contains thread local data. *}
-.#define SEC_THREAD_LOCAL 0x1000
-.
-. {* The section has GOT references. This flag is only for the
-. linker, and is currently only used by the elf32-hppa back end.
-. It will be set if global offset table references were detected
-. in this section, which indicate to the linker that the section
-. contains PIC code, and must be handled specially when doing a
-. static link. *}
-.#define SEC_HAS_GOT_REF 0x4000
-.
-. {* The section contains common symbols (symbols may be defined
-. multiple times, the value of a symbol is the amount of
-. space it requires, and the largest symbol value is the one
-. used). Most targets have exactly one of these (which we
-. translate to bfd_com_section_ptr), but ECOFF has two. *}
-.#define SEC_IS_COMMON 0x8000
-.
-. {* The section contains only debugging information. For
-. example, this is set for ELF .debug and .stab sections.
-. strip tests this flag to see if a section can be
-. discarded. *}
-.#define SEC_DEBUGGING 0x10000
-.
-. {* The contents of this section are held in memory pointed to
-. by the contents field. This is checked by bfd_get_section_contents,
-. and the data is retrieved from memory if appropriate. *}
-.#define SEC_IN_MEMORY 0x20000
-.
-. {* The contents of this section are to be excluded by the
-. linker for executable and shared objects unless those
-. objects are to be further relocated. *}
-.#define SEC_EXCLUDE 0x40000
-.
-. {* The contents of this section are to be sorted based on the sum of
-. the symbol and addend values specified by the associated relocation
-. entries. Entries without associated relocation entries will be
-. appended to the end of the section in an unspecified order. *}
-.#define SEC_SORT_ENTRIES 0x80000
-.
-. {* When linking, duplicate sections of the same name should be
-. discarded, rather than being combined into a single section as
-. is usually done. This is similar to how common symbols are
-. handled. See SEC_LINK_DUPLICATES below. *}
-.#define SEC_LINK_ONCE 0x100000
-.
-. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker
-. should handle duplicate sections. *}
-.#define SEC_LINK_DUPLICATES 0x600000
-.
-. {* This value for SEC_LINK_DUPLICATES means that duplicate
-. sections with the same name should simply be discarded. *}
-.#define SEC_LINK_DUPLICATES_DISCARD 0x0
-.
-. {* This value for SEC_LINK_DUPLICATES means that the linker
-. should warn if there are any duplicate sections, although
-. it should still only link one copy. *}
-.#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
-.
-. {* This value for SEC_LINK_DUPLICATES means that the linker
-. should warn if any duplicate sections are a different size. *}
-.#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
-.
-. {* This value for SEC_LINK_DUPLICATES means that the linker
-. should warn if any duplicate sections contain different
-. contents. *}
-.#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
-.
-. {* This section was created by the linker as part of dynamic
-. relocation or other arcane processing. It is skipped when
-. going through the first-pass output, trusting that someone
-. else up the line will take care of it later. *}
-.#define SEC_LINKER_CREATED 0x800000
-.
-. {* This section should not be subject to garbage collection. *}
-.#define SEC_KEEP 0x1000000
-.
-. {* This section contains "short" data, and should be placed
-. "near" the GP. *}
-.#define SEC_SMALL_DATA 0x2000000
-.
-. {* This section contains data which may be shared with other
-. executables or shared objects. *}
-.#define SEC_SHARED 0x4000000
-.
-. {* When a section with this flag is being linked, then if the size of
-. the input section is less than a page, it should not cross a page
-. boundary. If the size of the input section is one page or more, it
-. should be aligned on a page boundary. *}
-.#define SEC_BLOCK 0x8000000
-.
-. {* Conditionally link this section; do not link if there are no
-. references found to any symbol in the section. *}
-.#define SEC_CLINK 0x10000000
-.
-. {* Attempt to merge identical entities in the section.
-. Entity size is given in the entsize field. *}
-.#define SEC_MERGE 0x20000000
-.
-. {* If given with SEC_MERGE, entities to merge are zero terminated
-. strings where entsize specifies character size instead of fixed
-. size entries. *}
-.#define SEC_STRINGS 0x40000000
-.
-. {* This section contains data about section groups. *}
-.#define SEC_GROUP 0x80000000
-.
-. {* End of section flags. *}
-.
-. {* Some internal packed boolean fields. *}
-.
-. {* See the vma field. *}
-. unsigned int user_set_vma : 1;
-.
-. {* Whether relocations have been processed. *}
-. unsigned int reloc_done : 1;
-.
-. {* A mark flag used by some of the linker backends. *}
-. unsigned int linker_mark : 1;
-.
-. {* Another mark flag used by some of the linker backends. Set for
-. output sections that have an input section. *}
-. unsigned int linker_has_input : 1;
-.
-. {* A mark flag used by some linker backends for garbage collection. *}
-. unsigned int gc_mark : 1;
-.
-. {* The following flags are used by the ELF linker. *}
-.
-. {* Mark sections which have been allocated to segments. *}
-. unsigned int segment_mark : 1;
-.
-. {* Type of sec_info information. *}
-. unsigned int sec_info_type:3;
-.#define ELF_INFO_TYPE_NONE 0
-.#define ELF_INFO_TYPE_STABS 1
-.#define ELF_INFO_TYPE_MERGE 2
-.#define ELF_INFO_TYPE_EH_FRAME 3
-.#define ELF_INFO_TYPE_JUST_SYMS 4
-.
-. {* Nonzero if this section uses RELA relocations, rather than REL. *}
-. unsigned int use_rela_p:1;
-.
-. {* Bits used by various backends. *}
-. unsigned int has_tls_reloc:1;
-.
-. {* Nonzero if this section needs the relax finalize pass. *}
-. unsigned int need_finalize_relax:1;
-.
-. {* Nonzero if this section has a gp reloc. *}
-. unsigned int has_gp_reloc:1;
-.
-. {* Unused bits. *}
-. unsigned int flag13:1;
-. unsigned int flag14:1;
-. unsigned int flag15:1;
-. unsigned int flag16:4;
-. unsigned int flag20:4;
-. unsigned int flag24:8;
-.
-. {* End of internal packed boolean fields. *}
-.
-. {* The virtual memory address of the section - where it will be
-. at run time. The symbols are relocated against this. The
-. user_set_vma flag is maintained by bfd; if it's not set, the
-. backend can assign addresses (for example, in <<a.out>>, where
-. the default address for <<.data>> is dependent on the specific
-. target and various flags). *}
-. bfd_vma vma;
-.
-. {* The load address of the section - where it would be in a
-. rom image; really only used for writing section header
-. information. *}
-. bfd_vma lma;
-.
-. {* The size of the section in octets, as it will be output.
-. Contains a value even if the section has no contents (e.g., the
-. size of <<.bss>>). This will be filled in after relocation. *}
-. bfd_size_type _cooked_size;
-.
-. {* The original size on disk of the section, in octets. Normally this
-. value is the same as the size, but if some relaxing has
-. been done, then this value will be bigger. *}
-. bfd_size_type _raw_size;
-.
-. {* If this section is going to be output, then this value is the
-. offset in *bytes* into the output section of the first byte in the
-. input section (byte ==> smallest addressable unit on the
-. target). In most cases, if this was going to start at the
-. 100th octet (8-bit quantity) in the output section, this value
-. would be 100. However, if the target byte size is 16 bits
-. (bfd_octets_per_byte is "2"), this value would be 50. *}
-. bfd_vma output_offset;
-.
-. {* The output section through which to map on output. *}
-. struct bfd_section *output_section;
-.
-. {* The alignment requirement of the section, as an exponent of 2 -
-. e.g., 3 aligns to 2^3 (or 8). *}
-. unsigned int alignment_power;
-.
-. {* If an input section, a pointer to a vector of relocation
-. records for the data in this section. *}
-. struct reloc_cache_entry *relocation;
-.
-. {* If an output section, a pointer to a vector of pointers to
-. relocation records for the data in this section. *}
-. struct reloc_cache_entry **orelocation;
-.
-. {* The number of relocation records in one of the above. *}
-. unsigned reloc_count;
-.
-. {* Information below is back end specific - and not always used
-. or updated. *}
-.
-. {* File position of section data. *}
-. file_ptr filepos;
-.
-. {* File position of relocation info. *}
-. file_ptr rel_filepos;
-.
-. {* File position of line data. *}
-. file_ptr line_filepos;
-.
-. {* Pointer to data for applications. *}
-. void *userdata;
-.
-. {* If the SEC_IN_MEMORY flag is set, this points to the actual
-. contents. *}
-. unsigned char *contents;
-.
-. {* Attached line number information. *}
-. alent *lineno;
-.
-. {* Number of line number records. *}
-. unsigned int lineno_count;
-.
-. {* Entity size for merging purposes. *}
-. unsigned int entsize;
-.
-. {* Optional information about a COMDAT entry; NULL if not COMDAT. *}
-. struct bfd_comdat_info *comdat;
-.
-. {* Points to the kept section if this section is a link-once section,
-. and is discarded. *}
-. struct bfd_section *kept_section;
-.
-. {* When a section is being output, this value changes as more
-. linenumbers are written out. *}
-. file_ptr moving_line_filepos;
-.
-. {* What the section number is in the target world. *}
-. int target_index;
-.
-. void *used_by_bfd;
-.
-. {* If this is a constructor section then here is a list of the
-. relocations created to relocate items within it. *}
-. struct relent_chain *constructor_chain;
-.
-. {* The BFD which owns the section. *}
-. bfd *owner;
-.
-. {* A symbol which points at this section only. *}
-. struct bfd_symbol *symbol;
-. struct bfd_symbol **symbol_ptr_ptr;
-.
-. struct bfd_link_order *link_order_head;
-. struct bfd_link_order *link_order_tail;
-.} asection;
-.
-.{* These sections are global, and are managed by BFD. The application
-. and target back end are not permitted to change the values in
-. these sections. New code should use the section_ptr macros rather
-. than referring directly to the const sections. The const sections
-. may eventually vanish. *}
-.#define BFD_ABS_SECTION_NAME "*ABS*"
-.#define BFD_UND_SECTION_NAME "*UND*"
-.#define BFD_COM_SECTION_NAME "*COM*"
-.#define BFD_IND_SECTION_NAME "*IND*"
-.
-.{* The absolute section. *}
-.extern asection bfd_abs_section;
-.#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-.{* Pointer to the undefined section. *}
-.extern asection bfd_und_section;
-.#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-.{* Pointer to the common section. *}
-.extern asection bfd_com_section;
-.#define bfd_com_section_ptr ((asection *) &bfd_com_section)
-.{* Pointer to the indirect section. *}
-.extern asection bfd_ind_section;
-.#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
-.#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-.
-.#define bfd_is_const_section(SEC) \
-. ( ((SEC) == bfd_abs_section_ptr) \
-. || ((SEC) == bfd_und_section_ptr) \
-. || ((SEC) == bfd_com_section_ptr) \
-. || ((SEC) == bfd_ind_section_ptr))
-.
-.extern const struct bfd_symbol * const bfd_abs_symbol;
-.extern const struct bfd_symbol * const bfd_com_symbol;
-.extern const struct bfd_symbol * const bfd_und_symbol;
-.extern const struct bfd_symbol * const bfd_ind_symbol;
-.#define bfd_get_section_size_before_reloc(section) \
-. ((section)->_raw_size)
-.#define bfd_get_section_size_after_reloc(section) \
-. ((section)->reloc_done ? (section)->_cooked_size \
-. : (abort (), (bfd_size_type) 1))
-.
-.{* Macros to handle insertion and deletion of a bfd's sections. These
-. only handle the list pointers, ie. do not adjust section_count,
-. target_index etc. *}
-.#define bfd_section_list_remove(ABFD, PS) \
-. do \
-. { \
-. asection **_ps = PS; \
-. asection *_s = *_ps; \
-. *_ps = _s->next; \
-. if (_s->next == NULL) \
-. (ABFD)->section_tail = _ps; \
-. } \
-. while (0)
-.#define bfd_section_list_insert(ABFD, PS, S) \
-. do \
-. { \
-. asection **_ps = PS; \
-. asection *_s = S; \
-. _s->next = *_ps; \
-. *_ps = _s; \
-. if (_s->next == NULL) \
-. (ABFD)->section_tail = &_s->next; \
-. } \
-. while (0)
-.
-*/
-
-/* We use a macro to initialize the static asymbol structures because
- traditional C does not permit us to initialize a union member while
- gcc warns if we don't initialize it. */
- /* the_bfd, name, value, attr, section [, udata] */
-#ifdef __STDC__
-#define GLOBAL_SYM_INIT(NAME, SECTION) \
- { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }}
-#else
-#define GLOBAL_SYM_INIT(NAME, SECTION) \
- { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION }
-#endif
-
-/* These symbols are global, not specific to any BFD. Therefore, anything
- that tries to change them is broken, and should be repaired. */
-
-static const asymbol global_syms[] =
-{
- GLOBAL_SYM_INIT (BFD_COM_SECTION_NAME, &bfd_com_section),
- GLOBAL_SYM_INIT (BFD_UND_SECTION_NAME, &bfd_und_section),
- GLOBAL_SYM_INIT (BFD_ABS_SECTION_NAME, &bfd_abs_section),
- GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
-};
-
-#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
- const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
- asection SEC = \
- /* name, id, index, next, flags, user_set_vma, reloc_done, */ \
- { NAME, IDX, 0, NULL, FLAGS, 0, 0, \
- \
- /* linker_mark, linker_has_input, gc_mark, segment_mark, */ \
- 0, 0, 1, 0, \
- \
- /* sec_info_type, use_rela_p, has_tls_reloc, */ \
- 0, 0, 0, \
- \
- /* need_finalize_relax, has_gp_reloc, */ \
- 0, 0, \
- \
- /* flag13, flag14, flag15, flag16, flag20, flag24, */ \
- 0, 0, 0, 0, 0, 0, \
- \
- /* vma, lma, _cooked_size, _raw_size, */ \
- 0, 0, 0, 0, \
- \
- /* output_offset, output_section, alignment_power, */ \
- 0, (struct bfd_section *) &SEC, 0, \
- \
- /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
- NULL, NULL, 0, 0, 0, \
- \
- /* line_filepos, userdata, contents, lineno, lineno_count, */ \
- 0, NULL, NULL, NULL, 0, \
- \
- /* entsize, comdat, kept_section, moving_line_filepos, */ \
- 0, NULL, NULL, 0, \
- \
- /* target_index, used_by_bfd, constructor_chain, owner, */ \
- 0, NULL, NULL, NULL, \
- \
- /* symbol, */ \
- (struct bfd_symbol *) &global_syms[IDX], \
- \
- /* symbol_ptr_ptr, */ \
- (struct bfd_symbol **) &SYM, \
- \
- /* link_order_head, link_order_tail */ \
- NULL, NULL \
- }
-
-STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
- BFD_COM_SECTION_NAME, 0);
-STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1);
-STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
-STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
-#undef STD_SECTION
-
-struct section_hash_entry
-{
- struct bfd_hash_entry root;
- asection section;
-};
-
-/* Initialize an entry in the section hash table. */
-
-struct bfd_hash_entry *
-bfd_section_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (entry == NULL)
- {
- entry = (struct bfd_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct section_hash_entry));
- if (entry == NULL)
- return entry;
- }
-
- /* Call the allocation method of the superclass. */
- entry = bfd_hash_newfunc (entry, table, string);
- if (entry != NULL)
- memset (&((struct section_hash_entry *) entry)->section, 0,
- sizeof (asection));
-
- return entry;
-}
-
-#define section_hash_lookup(table, string, create, copy) \
- ((struct section_hash_entry *) \
- bfd_hash_lookup ((table), (string), (create), (copy)))
-
-/* Initializes a new section. NEWSECT->NAME is already set. */
-
-static asection *
-bfd_section_init (bfd *abfd, asection *newsect)
-{
- static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
-
- newsect->id = section_id;
- newsect->index = abfd->section_count;
- newsect->owner = abfd;
-
- /* Create a symbol whose only job is to point to this section. This
- is useful for things like relocs which are relative to the base
- of a section. */
- newsect->symbol = bfd_make_empty_symbol (abfd);
- if (newsect->symbol == NULL)
- return NULL;
-
- newsect->symbol->name = newsect->name;
- newsect->symbol->value = 0;
- newsect->symbol->section = newsect;
- newsect->symbol->flags = BSF_SECTION_SYM;
-
- newsect->symbol_ptr_ptr = &newsect->symbol;
-
- if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
- return NULL;
-
- section_id++;
- abfd->section_count++;
- *abfd->section_tail = newsect;
- abfd->section_tail = &newsect->next;
- return newsect;
-}
-
-/*
-DOCDD
-INODE
-section prototypes, , typedef asection, Sections
-SUBSECTION
- Section prototypes
-
-These are the functions exported by the section handling part of BFD.
-*/
-
-/*
-FUNCTION
- bfd_section_list_clear
-
-SYNOPSIS
- void bfd_section_list_clear (bfd *);
-
-DESCRIPTION
- Clears the section list, and also resets the section count and
- hash table entries.
-*/
-
-void
-bfd_section_list_clear (bfd *abfd)
-{
- abfd->sections = NULL;
- abfd->section_tail = &abfd->sections;
- abfd->section_count = 0;
- memset (abfd->section_htab.table, 0,
- abfd->section_htab.size * sizeof (struct bfd_hash_entry *));
-}
-
-/*
-FUNCTION
- bfd_get_section_by_name
-
-SYNOPSIS
- asection *bfd_get_section_by_name (bfd *abfd, const char *name);
-
-DESCRIPTION
- Run through @var{abfd} and return the one of the
- <<asection>>s whose name matches @var{name}, otherwise <<NULL>>.
- @xref{Sections}, for more information.
-
- This should only be used in special cases; the normal way to process
- all sections of a given name is to use <<bfd_map_over_sections>> and
- <<strcmp>> on the name (or better yet, base it on the section flags
- or something else) for each section.
-*/
-
-asection *
-bfd_get_section_by_name (bfd *abfd, const char *name)
-{
- struct section_hash_entry *sh;
-
- sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
- if (sh != NULL)
- return &sh->section;
-
- return NULL;
-}
-
-/*
-FUNCTION
- bfd_get_unique_section_name
-
-SYNOPSIS
- char *bfd_get_unique_section_name
- (bfd *abfd, const char *templat, int *count);
-
-DESCRIPTION
- Invent a section name that is unique in @var{abfd} by tacking
- a dot and a digit suffix onto the original @var{templat}. If
- @var{count} is non-NULL, then it specifies the first number
- tried as a suffix to generate a unique name. The value
- pointed to by @var{count} will be incremented in this case.
-*/
-
-char *
-bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count)
-{
- int num;
- unsigned int len;
- char *sname;
-
- len = strlen (templat);
- sname = bfd_malloc (len + 8);
- if (sname == NULL)
- return NULL;
- memcpy (sname, templat, len);
- num = 1;
- if (count != NULL)
- num = *count;
-
- do
- {
- /* If we have a million sections, something is badly wrong. */
- if (num > 999999)
- abort ();
- sprintf (sname + len, ".%d", num++);
- }
- while (section_hash_lookup (&abfd->section_htab, sname, FALSE, FALSE));
-
- if (count != NULL)
- *count = num;
- return sname;
-}
-
-/*
-FUNCTION
- bfd_make_section_old_way
-
-SYNOPSIS
- asection *bfd_make_section_old_way (bfd *abfd, const char *name);
-
-DESCRIPTION
- Create a new empty section called @var{name}
- and attach it to the end of the chain of sections for the
- BFD @var{abfd}. An attempt to create a section with a name which
- is already in use returns its pointer without changing the
- section chain.
-
- It has the funny name since this is the way it used to be
- before it was rewritten....
-
- Possible errors are:
- o <<bfd_error_invalid_operation>> -
- If output has already started for this BFD.
- o <<bfd_error_no_memory>> -
- If memory allocation fails.
-
-*/
-
-asection *
-bfd_make_section_old_way (bfd *abfd, const char *name)
-{
- struct section_hash_entry *sh;
- asection *newsect;
-
- if (abfd->output_has_begun)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- if (strcmp (name, BFD_ABS_SECTION_NAME) == 0)
- return bfd_abs_section_ptr;
-
- if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
- return bfd_com_section_ptr;
-
- if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
- return bfd_und_section_ptr;
-
- if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
- return bfd_ind_section_ptr;
-
- sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
- if (sh == NULL)
- return NULL;
-
- newsect = &sh->section;
- if (newsect->name != NULL)
- {
- /* Section already exists. */
- return newsect;
- }
-
- newsect->name = name;
- return bfd_section_init (abfd, newsect);
-}
-
-/*
-FUNCTION
- bfd_make_section_anyway
-
-SYNOPSIS
- asection *bfd_make_section_anyway (bfd *abfd, const char *name);
-
-DESCRIPTION
- Create a new empty section called @var{name} and attach it to the end of
- the chain of sections for @var{abfd}. Create a new section even if there
- is already a section with that name.
-
- Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
- o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
- o <<bfd_error_no_memory>> - If memory allocation fails.
-*/
-
-sec_ptr
-bfd_make_section_anyway (bfd *abfd, const char *name)
-{
- struct section_hash_entry *sh;
- asection *newsect;
-
- if (abfd->output_has_begun)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
- if (sh == NULL)
- return NULL;
-
- newsect = &sh->section;
- if (newsect->name != NULL)
- {
- /* We are making a section of the same name. It can't go in
- section_htab without generating a unique section name and
- that would be pointless; We don't need to traverse the
- hash table. */
- newsect = bfd_zalloc (abfd, sizeof (asection));
- if (newsect == NULL)
- return NULL;
- }
-
- newsect->name = name;
- return bfd_section_init (abfd, newsect);
-}
-
-/*
-FUNCTION
- bfd_make_section
-
-SYNOPSIS
- asection *bfd_make_section (bfd *, const char *name);
-
-DESCRIPTION
- Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
- bfd_set_error ()) without changing the section chain if there is already a
- section named @var{name}. If there is an error, return <<NULL>> and set
- <<bfd_error>>.
-*/
-
-asection *
-bfd_make_section (bfd *abfd, const char *name)
-{
- struct section_hash_entry *sh;
- asection *newsect;
-
- if (abfd->output_has_begun)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
-
- if (strcmp (name, BFD_ABS_SECTION_NAME) == 0
- || strcmp (name, BFD_COM_SECTION_NAME) == 0
- || strcmp (name, BFD_UND_SECTION_NAME) == 0
- || strcmp (name, BFD_IND_SECTION_NAME) == 0)
- return NULL;
-
- sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
- if (sh == NULL)
- return NULL;
-
- newsect = &sh->section;
- if (newsect->name != NULL)
- {
- /* Section already exists. */
- return NULL;
- }
-
- newsect->name = name;
- return bfd_section_init (abfd, newsect);
-}
-
-/*
-FUNCTION
- bfd_set_section_flags
-
-SYNOPSIS
- bfd_boolean bfd_set_section_flags
- (bfd *abfd, asection *sec, flagword flags);
-
-DESCRIPTION
- Set the attributes of the section @var{sec} in the BFD
- @var{abfd} to the value @var{flags}. Return <<TRUE>> on success,
- <<FALSE>> on error. Possible error returns are:
-
- o <<bfd_error_invalid_operation>> -
- The section cannot have one or more of the attributes
- requested. For example, a .bss section in <<a.out>> may not
- have the <<SEC_HAS_CONTENTS>> field set.
-
-*/
-
-bfd_boolean
-bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED,
- sec_ptr section,
- flagword flags)
-{
-#if 0
- /* If you try to copy a text section from an input file (where it
- has the SEC_CODE flag set) to an output file, this loses big if
- the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE
- set - which it doesn't, at least not for a.out. FIXME */
-
- if ((flags & bfd_applicable_section_flags (abfd)) != flags)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-#endif
-
- section->flags = flags;
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_map_over_sections
-
-SYNOPSIS
- void bfd_map_over_sections
- (bfd *abfd,
- void (*func) (bfd *abfd, asection *sect, void *obj),
- void *obj);
-
-DESCRIPTION
- Call the provided function @var{func} for each section
- attached to the BFD @var{abfd}, passing @var{obj} as an
- argument. The function will be called as if by
-
-| func (abfd, the_section, obj);
-
- This is the preferred method for iterating over sections; an
- alternative would be to use a loop:
-
-| section *p;
-| for (p = abfd->sections; p != NULL; p = p->next)
-| func (abfd, p, ...)
-
-*/
-
-void
-bfd_map_over_sections (bfd *abfd,
- void (*operation) (bfd *, asection *, void *),
- void *user_storage)
-{
- asection *sect;
- unsigned int i = 0;
-
- for (sect = abfd->sections; sect != NULL; i++, sect = sect->next)
- (*operation) (abfd, sect, user_storage);
-
- if (i != abfd->section_count) /* Debugging */
- abort ();
-}
-
-/*
-FUNCTION
- bfd_set_section_size
-
-SYNOPSIS
- bfd_boolean bfd_set_section_size
- (bfd *abfd, asection *sec, bfd_size_type val);
-
-DESCRIPTION
- Set @var{sec} to the size @var{val}. If the operation is
- ok, then <<TRUE>> is returned, else <<FALSE>>.
-
- Possible error returns:
- o <<bfd_error_invalid_operation>> -
- Writing has started to the BFD, so setting the size is invalid.
-
-*/
-
-bfd_boolean
-bfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val)
-{
- /* Once you've started writing to any section you cannot create or change
- the size of any others. */
-
- if (abfd->output_has_begun)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- ptr->_cooked_size = val;
- ptr->_raw_size = val;
-
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_set_section_contents
-
-SYNOPSIS
- bfd_boolean bfd_set_section_contents
- (bfd *abfd, asection *section, const void *data,
- file_ptr offset, bfd_size_type count);
-
-DESCRIPTION
- Sets the contents of the section @var{section} in BFD
- @var{abfd} to the data starting in memory at @var{data}. The
- data is written to the output section starting at offset
- @var{offset} for @var{count} octets.
-
- Normally <<TRUE>> is returned, else <<FALSE>>. Possible error
- returns are:
- o <<bfd_error_no_contents>> -
- The output section does not have the <<SEC_HAS_CONTENTS>>
- attribute, so nothing can be written to it.
- o and some more too
-
- This routine is front end to the back end function
- <<_bfd_set_section_contents>>.
-
-*/
-
-#define bfd_get_section_size_now(abfd, sec) \
- (sec->reloc_done \
- ? bfd_get_section_size_after_reloc (sec) \
- : bfd_get_section_size_before_reloc (sec))
-
-bfd_boolean
-bfd_set_section_contents (bfd *abfd,
- sec_ptr section,
- const void *location,
- file_ptr offset,
- bfd_size_type count)
-{
- bfd_size_type sz;
-
- if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS))
- {
- bfd_set_error (bfd_error_no_contents);
- return FALSE;
- }
-
- sz = bfd_get_section_size_now (abfd, section);
- if ((bfd_size_type) offset > sz
- || count > sz
- || offset + count > sz
- || count != (size_t) count)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- switch (abfd->direction)
- {
- case read_direction:
- case no_direction:
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
-
- case write_direction:
- break;
-
- case both_direction:
- /* File is opened for update. `output_has_begun' some time ago when
- the file was created. Do not recompute sections sizes or alignments
- in _bfd_set_section_content. */
- abfd->output_has_begun = TRUE;
- break;
- }
-
- /* Record a copy of the data in memory if desired. */
- if (section->contents
- && location != section->contents + offset)
- memcpy (section->contents + offset, location, (size_t) count);
-
- if (BFD_SEND (abfd, _bfd_set_section_contents,
- (abfd, section, location, offset, count)))
- {
- abfd->output_has_begun = TRUE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
-FUNCTION
- bfd_get_section_contents
-
-SYNOPSIS
- bfd_boolean bfd_get_section_contents
- (bfd *abfd, asection *section, void *location, file_ptr offset,
- bfd_size_type count);
-
-DESCRIPTION
- Read data from @var{section} in BFD @var{abfd}
- into memory starting at @var{location}. The data is read at an
- offset of @var{offset} from the start of the input section,
- and is read for @var{count} bytes.
-
- If the contents of a constructor with the <<SEC_CONSTRUCTOR>>
- flag set are requested or if the section does not have the
- <<SEC_HAS_CONTENTS>> flag set, then the @var{location} is filled
- with zeroes. If no errors occur, <<TRUE>> is returned, else
- <<FALSE>>.
-
-*/
-bfd_boolean
-bfd_get_section_contents (bfd *abfd,
- sec_ptr section,
- void *location,
- file_ptr offset,
- bfd_size_type count)
-{
- bfd_size_type sz;
-
- if (section->flags & SEC_CONSTRUCTOR)
- {
- memset (location, 0, (size_t) count);
- return TRUE;
- }
-
- /* Even if reloc_done is TRUE, this function reads unrelocated
- contents, so we want the raw size. */
- sz = section->_raw_size;
- if ((bfd_size_type) offset > sz
- || count > sz
- || offset + count > sz
- || count != (size_t) count)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (count == 0)
- /* Don't bother. */
- return TRUE;
-
- if ((section->flags & SEC_HAS_CONTENTS) == 0)
- {
- memset (location, 0, (size_t) count);
- return TRUE;
- }
-
- if ((section->flags & SEC_IN_MEMORY) != 0)
- {
- memcpy (location, section->contents + offset, (size_t) count);
- return TRUE;
- }
-
- return BFD_SEND (abfd, _bfd_get_section_contents,
- (abfd, section, location, offset, count));
-}
-
-/*
-FUNCTION
- bfd_copy_private_section_data
-
-SYNOPSIS
- bfd_boolean bfd_copy_private_section_data
- (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
-
-DESCRIPTION
- Copy private section information from @var{isec} in the BFD
- @var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
- Return <<TRUE>> on success, <<FALSE>> on error. Possible error
- returns are:
-
- o <<bfd_error_no_memory>> -
- Not enough memory exists to create private data for @var{osec}.
-
-.#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
-. BFD_SEND (obfd, _bfd_copy_private_section_data, \
-. (ibfd, isection, obfd, osection))
-*/
-
-/*
-FUNCTION
- _bfd_strip_section_from_output
-
-SYNOPSIS
- void _bfd_strip_section_from_output
- (struct bfd_link_info *info, asection *section);
-
-DESCRIPTION
- Remove @var{section} from the output. If the output section
- becomes empty, remove it from the output bfd.
-
- This function won't actually do anything except twiddle flags
- if called too late in the linking process, when it's not safe
- to remove sections.
-*/
-void
-_bfd_strip_section_from_output (struct bfd_link_info *info, asection *s)
-{
- asection *os;
- asection *is;
- bfd *abfd;
-
- s->flags |= SEC_EXCLUDE;
-
- /* If the section wasn't assigned to an output section, or the
- section has been discarded by the linker script, there's nothing
- more to do. */
- os = s->output_section;
- if (os == NULL || os->owner == NULL)
- return;
-
- /* If the output section has other (non-excluded) input sections, we
- can't remove it. */
- for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
- for (is = abfd->sections; is != NULL; is = is->next)
- if (is->output_section == os && (is->flags & SEC_EXCLUDE) == 0)
- return;
-
- /* If the output section is empty, flag it for removal too.
- See ldlang.c:strip_excluded_output_sections for the action. */
- os->flags |= SEC_EXCLUDE;
-}
-
-/*
-FUNCTION
- bfd_generic_discard_group
-
-SYNOPSIS
- bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
-
-DESCRIPTION
- Remove all members of @var{group} from the output.
-*/
-
-bfd_boolean
-bfd_generic_discard_group (bfd *abfd ATTRIBUTE_UNUSED,
- asection *group ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/simple.c b/contrib/binutils/bfd/simple.c
deleted file mode 100644
index fc2472e..0000000
--- a/contrib/binutils/bfd/simple.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* simple.c -- BFD simple client routines
- Copyright 2002, 2003, 2004
- Free Software Foundation, Inc.
- Contributed by MontaVista Software, Inc.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-
-static bfd_boolean
-simple_dummy_warning (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *warning ATTRIBUTE_UNUSED,
- const char *symbol ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-static bfd_boolean
-simple_dummy_undefined_symbol (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED,
- bfd_boolean fatal ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-static bfd_boolean
-simple_dummy_reloc_overflow (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED,
- const char *reloc_name ATTRIBUTE_UNUSED,
- bfd_vma addend ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-static bfd_boolean
-simple_dummy_reloc_dangerous (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *message ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-static bfd_boolean
-simple_dummy_unattached_reloc (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
-struct saved_output_info
-{
- bfd_vma offset;
- asection *section;
-};
-
-static void
-simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED,
- asection *section,
- void *ptr)
-{
- struct saved_output_info *output_info = ptr;
- output_info[section->index].offset = section->output_offset;
- output_info[section->index].section = section->output_section;
- section->output_offset = 0;
- section->output_section = section;
-}
-
-static void
-simple_restore_output_info (bfd *abfd ATTRIBUTE_UNUSED,
- asection *section,
- void *ptr)
-{
- struct saved_output_info *output_info = ptr;
- section->output_offset = output_info[section->index].offset;
- section->output_section = output_info[section->index].section;
-}
-
-/*
-FUNCTION
- bfd_simple_relocate_secton
-
-SYNOPSIS
- bfd_byte *bfd_simple_get_relocated_section_contents
- (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
-
-DESCRIPTION
- Returns the relocated contents of section @var{sec}. The symbols in
- @var{symbol_table} will be used, or the symbols from @var{abfd} if
- @var{symbol_table} is NULL. The output offsets for all sections will
- be temporarily reset to 0. The result will be stored at @var{outbuf}
- or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}.
-
- Generally all sections in @var{abfd} should have their
- @code{output_section} pointing back to the original section.
-
- Returns @code{NULL} on a fatal error; ignores errors applying
- particular relocations.
-*/
-
-bfd_byte *
-bfd_simple_get_relocated_section_contents (bfd *abfd,
- asection *sec,
- bfd_byte *outbuf,
- asymbol **symbol_table)
-{
- struct bfd_link_info link_info;
- struct bfd_link_order link_order;
- struct bfd_link_callbacks callbacks;
- bfd_byte *contents, *data;
- int storage_needed;
- void *saved_offsets;
- bfd_size_type old_cooked_size;
-
- if (! (sec->flags & SEC_RELOC))
- {
- bfd_size_type size = bfd_section_size (abfd, sec);
-
- if (outbuf == NULL)
- contents = bfd_malloc (size);
- else
- contents = outbuf;
-
- if (contents)
- bfd_get_section_contents (abfd, sec, contents, 0, size);
-
- return contents;
- }
-
- /* In order to use bfd_get_relocated_section_contents, we need
- to forge some data structures that it expects. */
-
- /* Fill in the bare minimum number of fields for our purposes. */
- memset (&link_info, 0, sizeof (link_info));
- link_info.input_bfds = abfd;
-
- link_info.hash = _bfd_generic_link_hash_table_create (abfd);
- link_info.callbacks = &callbacks;
- callbacks.warning = simple_dummy_warning;
- callbacks.undefined_symbol = simple_dummy_undefined_symbol;
- callbacks.reloc_overflow = simple_dummy_reloc_overflow;
- callbacks.reloc_dangerous = simple_dummy_reloc_dangerous;
- callbacks.unattached_reloc = simple_dummy_unattached_reloc;
-
- memset (&link_order, 0, sizeof (link_order));
- link_order.next = NULL;
- link_order.type = bfd_indirect_link_order;
- link_order.offset = 0;
- link_order.size = bfd_section_size (abfd, sec);
- link_order.u.indirect.section = sec;
-
- data = NULL;
- if (outbuf == NULL)
- {
- data = bfd_malloc (bfd_section_size (abfd, sec));
- if (data == NULL)
- return NULL;
- outbuf = data;
- }
-
- /* The sections in ABFD may already have output sections and offsets set.
- Because this function is primarily for debug sections, and GCC uses the
- knowledge that debug sections will generally have VMA 0 when emitting
- relocations between DWARF-2 sections (which are supposed to be
- section-relative offsets anyway), we need to reset the output offsets
- to zero. We also need to arrange for section->output_section->vma plus
- section->output_offset to equal section->vma, which we do by setting
- section->output_section to point back to section. Save the original
- output offset and output section to restore later. */
- saved_offsets = malloc (sizeof (struct saved_output_info)
- * abfd->section_count);
- if (saved_offsets == NULL)
- {
- if (data)
- free (data);
- return NULL;
- }
- bfd_map_over_sections (abfd, simple_save_output_info, saved_offsets);
-
- if (symbol_table == NULL)
- {
- _bfd_generic_link_add_symbols (abfd, &link_info);
-
- storage_needed = bfd_get_symtab_upper_bound (abfd);
- symbol_table = bfd_malloc (storage_needed);
- bfd_canonicalize_symtab (abfd, symbol_table);
- }
- else
- storage_needed = 0;
-
- /* This function might be called before _cooked_size has been set, and
- bfd_perform_relocation needs _cooked_size to be valid. */
- old_cooked_size = sec->_cooked_size;
- if (old_cooked_size == 0)
- sec->_cooked_size = sec->_raw_size;
-
- contents = bfd_get_relocated_section_contents (abfd,
- &link_info,
- &link_order,
- outbuf,
- 0,
- symbol_table);
- if (contents == NULL && data != NULL)
- free (data);
-
-#if 0
- /* NOTE: cagney/2003-04-05: This free, which was introduced on
- 2003-03-31 to stop a memory leak, caused a memory corruption
- between GDB and BFD. The problem, which is stabs specific, can
- be identified by a bunch of failures in relocate.exp vis:
-
- gdb.base/relocate.exp: get address of static_bar
-
- Details of the problem can be found on the binutils@ mailing
- list, see the discussion thread: "gdb.mi/mi-cli.exp failures". */
- if (storage_needed != 0)
- free (symbol_table);
-#endif
-
- sec->_cooked_size = old_cooked_size;
- bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets);
- free (saved_offsets);
-
- _bfd_generic_link_hash_table_free (link_info.hash);
-
- return contents;
-}
diff --git a/contrib/binutils/bfd/sparclinux.c b/contrib/binutils/bfd/sparclinux.c
deleted file mode 100644
index ecaaa0f..0000000
--- a/contrib/binutils/bfd/sparclinux.c
+++ /dev/null
@@ -1,778 +0,0 @@
-/* BFD back-end for linux flavored sparc a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA. */
-
-#define TARGET_PAGE_SIZE 4096
-#define ZMAGIC_DISK_BLOCK_SIZE 1024
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define TEXT_START_ADDR 0x0
-#define N_SHARED_LIB(x) 0
-
-#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN)
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/aout64.h"
-#include "aout/stab_gnu.h"
-#include "aout/ar.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#define DEFAULT_ARCH bfd_arch_sparc
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparclinux_,OP)
-#define TARGETNAME "a.out-sparc-linux"
-
-extern const bfd_target MY(vec);
-
-/* We always generate QMAGIC files in preference to ZMAGIC files. It
- would be possible to make this a linker option, if that ever
- becomes important. */
-
-static void MY_final_link_callback
- PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
-
-static bfd_boolean sparclinux_bfd_final_link
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-
-static bfd_boolean
-sparclinux_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- obj_aout_subformat (abfd) = q_magic_format;
- return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
-}
-
-#define MY_bfd_final_link sparclinux_bfd_final_link
-
-/* Set the machine type correctly. */
-
-static bfd_boolean sparclinux_write_object_contents PARAMS ((bfd *abfd));
-
-static bfd_boolean
-sparclinux_write_object_contents (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
- N_SET_MACHTYPE (*execp, M_SPARC);
-
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-
- WRITE_HEADERS(abfd, execp);
-
- return TRUE;
-}
-
-#define MY_write_object_contents sparclinux_write_object_contents
-/* Code to link against Linux a.out shared libraries. */
-
-/* See if a symbol name is a reference to the global offset table. */
-
-#ifndef GOT_REF_PREFIX
-#define GOT_REF_PREFIX "__GOT_"
-#endif
-
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
-
-/* See if a symbol name is a reference to the procedure linkage table. */
-
-#ifndef PLT_REF_PREFIX
-#define PLT_REF_PREFIX "__PLT_"
-#endif
-
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
-
-/* This string is used to generate specialized error messages. */
-
-#ifndef NEEDS_SHRLIB
-#define NEEDS_SHRLIB "__NEEDS_SHRLIB_"
-#endif
-
-/* This special symbol is a set vector that contains a list of
- pointers to fixup tables. It will be present in any dynamically
- linked file. The linker generated fixup table should also be added
- to the list, and it should always appear in the second slot (the
- first one is a dummy with a magic number that is defined in
- crt0.o). */
-
-#ifndef SHARABLE_CONFLICTS
-#define SHARABLE_CONFLICTS "__SHARABLE_CONFLICTS__"
-#endif
-
-/* We keep a list of fixups. The terminology is a bit strange, but
- each fixup contains two 32 bit numbers. A regular fixup contains
- an address and a pointer, and at runtime we should store the
- address at the location pointed to by the pointer. A builtin fixup
- contains two pointers, and we should read the address using one
- pointer and store it at the location pointed to by the other
- pointer. Builtin fixups come into play when we have duplicate
- __GOT__ symbols for the same variable. The builtin fixup will copy
- the GOT pointer from one over into the other. */
-
-struct fixup
-{
- struct fixup *next;
- struct linux_link_hash_entry *h;
- bfd_vma value;
-
- /* Nonzero if this is a jump instruction that needs to be fixed,
- zero if this is just a pointer */
- char jump;
-
- char builtin;
-};
-
-/* We don't need a special hash table entry structure, but we do need
- to keep some information between linker passes, so we use a special
- hash table. */
-
-struct linux_link_hash_entry
-{
- struct aout_link_hash_entry root;
-};
-
-struct linux_link_hash_table
-{
- struct aout_link_hash_table root;
-
- /* First dynamic object found in link. */
- bfd *dynobj;
-
- /* Number of fixups. */
- size_t fixup_count;
-
- /* Number of builtin fixups. */
- size_t local_builtins;
-
- /* List of fixups. */
- struct fixup *fixup_list;
-};
-
-static struct bfd_hash_entry *linux_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *linux_link_hash_table_create
- PARAMS ((bfd *));
-static struct fixup *new_fixup
- PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *,
- bfd_vma, int));
-static bfd_boolean linux_link_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean linux_add_one_symbol
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
-static bfd_boolean linux_tally_symbols
- PARAMS ((struct linux_link_hash_entry *, PTR));
-static bfd_boolean linux_finish_dynamic_link
- PARAMS ((bfd *, struct bfd_link_info *));
-
-/* Routine to create an entry in an Linux link hash table. */
-
-static struct bfd_hash_entry *
-linux_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct linux_link_hash_entry *ret = (struct linux_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct linux_link_hash_entry *) NULL)
- ret = ((struct linux_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry)));
- if (ret == NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct linux_link_hash_entry *)
- NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- /* Set local fields; there aren't any. */
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create a Linux link hash table. */
-
-static struct bfd_link_hash_table *
-linux_link_hash_table_create (abfd)
- bfd *abfd;
-{
- struct linux_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct linux_link_hash_table);
-
- ret = (struct linux_link_hash_table *) bfd_malloc (amt);
- if (ret == (struct linux_link_hash_table *) NULL)
- return (struct bfd_link_hash_table *) NULL;
- if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
- linux_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
-
- ret->dynobj = NULL;
- ret->fixup_count = 0;
- ret->local_builtins = 0;
- ret->fixup_list = NULL;
-
- return &ret->root.root;
-}
-
-/* Look up an entry in a Linux link hash table. */
-
-#define linux_link_hash_lookup(table, string, create, copy, follow) \
- ((struct linux_link_hash_entry *) \
- aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
-
-/* Traverse a Linux link hash table. */
-
-#define linux_link_hash_traverse(table, func, info) \
- (aout_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the Linux link hash table from the info structure. This is
- just a cast. */
-
-#define linux_hash_table(p) ((struct linux_link_hash_table *) ((p)->hash))
-
-/* Store the information for a new fixup. */
-
-static struct fixup *
-new_fixup (info, h, value, builtin)
- struct bfd_link_info *info;
- struct linux_link_hash_entry *h;
- bfd_vma value;
- int builtin;
-{
- struct fixup *f;
-
- f = (struct fixup *) bfd_hash_allocate (&info->hash->table,
- sizeof (struct fixup));
- if (f == NULL)
- return f;
- f->next = linux_hash_table (info)->fixup_list;
- linux_hash_table (info)->fixup_list = f;
- f->h = h;
- f->value = value;
- f->builtin = builtin;
- f->jump = 0;
- ++linux_hash_table (info)->fixup_count;
- return f;
-}
-
-/* We come here once we realize that we are going to link to a shared
- library. We need to create a special section that contains the
- fixup table, and we ultimately need to add a pointer to this into
- the set vector for SHARABLE_CONFLICTS. At this point we do not
- know the size of the section, but that's OK - we just need to
- create it for now. */
-
-static bfd_boolean
-linux_link_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
-{
- flagword flags;
- register asection *s;
-
- /* Note that we set the SEC_IN_MEMORY flag. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
-
- /* We choose to use the name ".linux-dynamic" for the fixup table.
- Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
- s->_raw_size = 0;
- s->contents = 0;
-
- return TRUE;
-}
-
-/* Function to add a single symbol to the linker hash table. This is
- a wrapper around _bfd_generic_link_add_one_symbol which handles the
- tweaking needed for dynamic linking support. */
-
-static bfd_boolean
-linux_add_one_symbol (info, abfd, name, flags, section, value, string,
- copy, collect, hashp)
- struct bfd_link_info *info;
- bfd *abfd;
- const char *name;
- flagword flags;
- asection *section;
- bfd_vma value;
- const char *string;
- bfd_boolean copy;
- bfd_boolean collect;
- struct bfd_link_hash_entry **hashp;
-{
- struct linux_link_hash_entry *h;
- bfd_boolean insert;
-
- /* Look up and see if we already have this symbol in the hash table.
- If we do, and the defining entry is from a shared library, we
- need to create the dynamic sections.
-
- FIXME: What if abfd->xvec != info->hash->creator? We may want to
- be able to link Linux a.out and ELF objects together, but serious
- confusion is possible. */
-
- insert = FALSE;
-
- if (! info->relocatable
- && linux_hash_table (info)->dynobj == NULL
- && strcmp (name, SHARABLE_CONFLICTS) == 0
- && (flags & BSF_CONSTRUCTOR) != 0
- && abfd->xvec == info->hash->creator)
- {
- if (! linux_link_create_dynamic_sections (abfd, info))
- return FALSE;
- linux_hash_table (info)->dynobj = abfd;
- insert = TRUE;
- }
-
- if (bfd_is_abs_section (section)
- && abfd->xvec == info->hash->creator)
- {
- h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
- FALSE, FALSE);
- if (h != NULL
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
- {
- struct fixup *f;
-
- if (hashp != NULL)
- *hashp = (struct bfd_link_hash_entry *) h;
-
- f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
- if (f == NULL)
- return FALSE;
- f->jump = IS_PLT_SYM (name);
-
- return TRUE;
- }
- }
-
- /* Do the usual procedure for adding a symbol. */
- if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
- value, string, copy, collect,
- hashp))
- return FALSE;
-
- /* Insert a pointer to our table in the set vector. The dynamic
- linker requires this information. */
- if (insert)
- {
- asection *s;
-
- /* Here we do our special thing to add the pointer to the
- dynamic section in the SHARABLE_CONFLICTS set vector. */
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- BFD_ASSERT (s != NULL);
-
- if (! (_bfd_generic_link_add_one_symbol
- (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
- BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
- FALSE, FALSE, NULL)))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We will crawl the hash table and come here for every global symbol.
- We will examine each entry and see if there are indications that we
- need to add a fixup. There are two possible cases - one is where
- you have duplicate definitions of PLT or GOT symbols - these will
- have already been caught and added as "builtin" fixups. If we find
- that the corresponding non PLT/GOT symbol is also present, we
- convert it to a regular fixup instead.
-
- This function is called via linux_link_hash_traverse. */
-
-static bfd_boolean
-linux_tally_symbols (h, data)
- struct linux_link_hash_entry *h;
- PTR data;
-{
- struct bfd_link_info *info = (struct bfd_link_info *) data;
- struct fixup *f, *f1;
- int is_plt;
- struct linux_link_hash_entry *h1, *h2;
- bfd_boolean exists;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
-
- if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
- {
- const char *name;
- char *p;
- char *alloc = NULL;
-
- name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1;
- p = strrchr (name, '_');
- if (p != NULL)
- alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1);
-
- if (p == NULL || alloc == NULL)
- (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"),
- name);
- else
- {
- strcpy (alloc, name);
- p = strrchr (alloc, '_');
- *p++ = '\0';
- (*_bfd_error_handler)
- (_("Output file requires shared library `%s.so.%s'\n"),
- alloc, p);
- free (alloc);
- }
-
- abort ();
- }
-
- /* If this symbol is not a PLT/GOT, we do not even need to look at
- it. */
- is_plt = IS_PLT_SYM (h->root.root.root.string);
-
- if (is_plt || IS_GOT_SYM (h->root.root.root.string))
- {
- /* Look up this symbol twice. Once just as a regular lookup,
- and then again following all of the indirect links until we
- reach a real symbol. */
- h1 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- FALSE, FALSE, TRUE);
- /* h2 does not follow indirect symbols. */
- h2 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- FALSE, FALSE, FALSE);
-
- /* The real symbol must exist but if it is also an ABS symbol,
- there is no need to have a fixup. This is because they both
- came from the same library. If on the other hand, we had to
- use an indirect symbol to get to the real symbol, we add the
- fixup anyway, since there are cases where these symbols come
- from different shared libraries */
- if (h1 != NULL
- && (((h1->root.root.type == bfd_link_hash_defined
- || h1->root.root.type == bfd_link_hash_defweak)
- && ! bfd_is_abs_section (h1->root.root.u.def.section))
- || h2->root.root.type == bfd_link_hash_indirect))
- {
- /* See if there is a "builtin" fixup already present
- involving this symbol. If so, convert it to a regular
- fixup. In the end, this relaxes some of the requirements
- about the order of performing fixups. */
- exists = FALSE;
- for (f1 = linux_hash_table (info)->fixup_list;
- f1 != NULL;
- f1 = f1->next)
- {
- if ((f1->h != h && f1->h != h1)
- || (! f1->builtin && ! f1->jump))
- continue;
- if (f1->h == h1)
- exists = TRUE;
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0);
- f->jump = is_plt;
- }
- f1->h = h1;
- f1->jump = is_plt;
- f1->builtin = 0;
- exists = TRUE;
- }
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, h->root.root.u.def.value, 0);
- if (f == NULL)
- {
- /* FIXME: No way to return error. */
- abort ();
- }
- f->jump = is_plt;
- }
- }
-
- /* Quick and dirty way of stripping these symbols from the
- symtab. */
- if (bfd_is_abs_section (h->root.root.u.def.section))
- h->root.written = TRUE;
- }
-
- return TRUE;
-}
-
-/* This is called to set the size of the .linux-dynamic section is.
- It is called by the Linux linker emulation before_allocation
- routine. We have finished reading all of the input files, and now
- we just scan the hash tables to find out how many additional fixups
- are required. */
-
-bfd_boolean
-bfd_sparclinux_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- struct fixup *f;
- asection *s;
-
- if (output_bfd->xvec != &MY(vec))
- return TRUE;
-
- /* First find the fixups... */
- linux_link_hash_traverse (linux_hash_table (info),
- linux_tally_symbols,
- (PTR) info);
-
- /* If there are builtin fixups, leave room for a marker. This is
- used by the dynamic linker so that it knows that all that follow
- are builtin fixups instead of regular fixups. */
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (f->builtin)
- {
- ++linux_hash_table (info)->fixup_count;
- ++linux_hash_table (info)->local_builtins;
- break;
- }
- }
-
- if (linux_hash_table (info)->dynobj == NULL)
- {
- if (linux_hash_table (info)->fixup_count > 0)
- abort ();
- return TRUE;
- }
-
- /* Allocate memory for our fixup table. We will fill it in later. */
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- if (s != NULL)
- {
- s->_raw_size = linux_hash_table (info)->fixup_count + 1;
- s->_raw_size *= 8;
- s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* We come here once we are ready to actually write the fixup table to
- the output file. Scan the fixup tables and so forth and generate
- the stuff we need. */
-
-static bfd_boolean
-linux_finish_dynamic_link (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- asection *s, *os, *is;
- bfd_byte *fixup_table;
- struct linux_link_hash_entry *h;
- struct fixup *f;
- unsigned int new_addr;
- int section_offset;
- unsigned int fixups_written;
-
- if (linux_hash_table (info)->dynobj == NULL)
- return TRUE;
-
- s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
- BFD_ASSERT (s != NULL);
- os = s->output_section;
- fixups_written = 0;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup table file offset: %x VMA: %x\n",
- os->filepos + s->output_offset,
- os->vma + s->output_offset);
-#endif
-
- fixup_table = s->contents;
- bfd_put_32 (output_bfd,
- (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table);
- fixup_table += 4;
-
- /* Fill in fixup table. */
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (f->builtin)
- continue;
-
- if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- (*_bfd_error_handler)
- (_("Symbol %s not defined for fixups\n"),
- f->h->root.root.root.string);
- continue;
- }
-
- is = f->h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = f->h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup(%d) %s: %x %x\n",f->jump, f->h->root.root.string,
- new_addr, f->value);
-#endif
-
- if (f->jump)
- {
- /* Relative address */
- new_addr = new_addr - (f->value + 5);
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value + 1, fixup_table);
- fixup_table += 4;
- }
- else
- {
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- }
- ++fixups_written;
- }
-
- if (linux_hash_table (info)->local_builtins != 0)
- {
- /* Special marker so we know to switch to the other type of fixup */
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (! f->builtin)
- continue;
-
- if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- (*_bfd_error_handler)
- (_("Symbol %s not defined for fixups\n"),
- f->h->root.root.root.string);
- continue;
- }
-
- is = f->h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = f->h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string,
- new_addr, f->value);
-#endif
-
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
- }
-
- if (linux_hash_table (info)->fixup_count != fixups_written)
- {
- (*_bfd_error_handler) (_("Warning: fixup count mismatch\n"));
- while (linux_hash_table (info)->fixup_count > fixups_written)
- {
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
- }
-
- h = linux_link_hash_lookup (linux_hash_table (info),
- "__BUILTIN_FIXUPS__",
- FALSE, FALSE, FALSE);
-
- if (h != NULL
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
- {
- is = h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = h->root.root.u.def.value + section_offset;
-
-#ifdef LINUX_LINK_DEBUG
- printf ("Builtin fixup table at %x\n", new_addr);
-#endif
-
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- }
- else
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
-
- if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset),
- SEEK_SET) != 0)
- return FALSE;
-
- if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
- return FALSE;
-
- return TRUE;
-}
-
-#define MY_bfd_link_hash_table_create linux_link_hash_table_create
-#define MY_add_one_symbol linux_add_one_symbol
-#define MY_finish_dynamic_link linux_finish_dynamic_link
-
-#define MY_zmagic_contiguous 1
-
-#include "aout-target.h"
diff --git a/contrib/binutils/bfd/sparcnetbsd.c b/contrib/binutils/bfd/sparcnetbsd.c
deleted file mode 100644
index be8e536..0000000
--- a/contrib/binutils/bfd/sparcnetbsd.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* BFD back-end for NetBSD/sparc a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_BIG_ENDIAN_P
-
-/* SPARC chips use either 4K or 8K pages, but object files always
- assume 8K page alignment so they will work on either one. */
-#define TARGET_PAGE_SIZE 0x2000
-
-#define DEFAULT_ARCH bfd_arch_sparc
-#define DEFAULT_MID M_SPARC_NETBSD
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sparcnetbsd_,OP)
-
-/* This needs to start with a.out so GDB knows it is an a.out variant. */
-#define TARGETNAME "a.out-sparc-netbsd"
-
-#include "netbsd.h"
diff --git a/contrib/binutils/bfd/srec.c b/contrib/binutils/bfd/srec.c
deleted file mode 100644
index c0a3d58..0000000
--- a/contrib/binutils/bfd/srec.c
+++ /dev/null
@@ -1,1403 +0,0 @@
-/* BFD back-end for s-record objects.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SUBSECTION
- S-Record handling
-
-DESCRIPTION
-
- Ordinary S-Records cannot hold anything but addresses and
- data, so that's all that we implement.
-
- The only interesting thing is that S-Records may come out of
- order and there is no header, so an initial scan is required
- to discover the minimum and maximum addresses used to create
- the vma and size of the only section we create. We
- arbitrarily call this section ".text".
-
- When bfd_get_section_contents is called the file is read
- again, and this time the data is placed into a bfd_alloc'd
- area.
-
- Any number of sections may be created for output, we save them
- up and output them when it's time to close the bfd.
-
- An s record looks like:
-
-EXAMPLE
- S<type><length><address><data><checksum>
-
-DESCRIPTION
- Where
- o length
- is the number of bytes following upto the checksum. Note that
- this is not the number of chars following, since it takes two
- chars to represent a byte.
- o type
- is one of:
- 0) header record
- 1) two byte address data record
- 2) three byte address data record
- 3) four byte address data record
- 7) four byte address termination record
- 8) three byte address termination record
- 9) two byte address termination record
-
- o address
- is the start address of the data following, or in the case of
- a termination record, the start address of the image
- o data
- is the data.
- o checksum
- is the sum of all the raw byte data in the record, from the length
- upwards, modulo 256 and subtracted from 255.
-
-SUBSECTION
- Symbol S-Record handling
-
-DESCRIPTION
- Some ICE equipment understands an addition to the standard
- S-Record format; symbols and their addresses can be sent
- before the data.
-
- The format of this is:
- ($$ <modulename>
- (<space> <symbol> <address>)*)
- $$
-
- so a short symbol table could look like:
-
-EXAMPLE
- $$ flash.x
- $$ flash.c
- _port6 $0
- _delay $4
- _start $14
- _etext $8036
- _edata $8036
- _end $8036
- $$
-
-DESCRIPTION
- We allow symbols to be anywhere in the data stream - the module names
- are always ignored.
-
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libiberty.h"
-#include "safe-ctype.h"
-
-static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-static void srec_print_symbol
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-static void srec_init PARAMS ((void));
-static bfd_boolean srec_mkobject PARAMS ((bfd *));
-static int srec_get_byte PARAMS ((bfd *, bfd_boolean *));
-static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, bfd_boolean));
-static bfd_boolean srec_scan PARAMS ((bfd *));
-static const bfd_target *srec_object_p PARAMS ((bfd *));
-static const bfd_target *symbolsrec_object_p PARAMS ((bfd *));
-static bfd_boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *));
-
-static bfd_boolean srec_write_record
- PARAMS ((bfd *, unsigned int, bfd_vma, const bfd_byte *, const bfd_byte *));
-static bfd_boolean srec_write_header PARAMS ((bfd *));
-static bfd_boolean srec_write_symbols PARAMS ((bfd *));
-static bfd_boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma));
-static bfd_boolean srec_get_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static bfd_boolean srec_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static bfd_boolean srec_set_section_contents
- PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
-static bfd_boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
-static bfd_boolean srec_write_object_contents PARAMS ((bfd *));
-static bfd_boolean symbolsrec_write_object_contents PARAMS ((bfd *));
-static int srec_sizeof_headers PARAMS ((bfd *, bfd_boolean));
-static long srec_get_symtab_upper_bound PARAMS ((bfd *));
-static long srec_canonicalize_symtab PARAMS ((bfd *, asymbol **));
-
-/* Macros for converting between hex and binary. */
-
-static const char digs[] = "0123456789ABCDEF";
-
-#define NIBBLE(x) hex_value(x)
-#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
-#define TOHEX(d, x, ch) \
- d[1] = digs[(x) & 0xf]; \
- d[0] = digs[((x)>>4)&0xf]; \
- ch += ((x) & 0xff);
-#define ISHEX(x) hex_p(x)
-
-/* Initialize by filling in the hex conversion array. */
-
-static void
-srec_init ()
-{
- static bfd_boolean inited = FALSE;
-
- if (! inited)
- {
- inited = TRUE;
- hex_init ();
- }
-}
-
-/* The maximum number of address+data+crc bytes on a line is FF. */
-#define MAXCHUNK 0xff
-
-/* Default size for a CHUNK. */
-#define DEFAULT_CHUNK 16
-
-/* The number of data bytes we actually fit onto a line on output.
- This variable can be modified by objcopy's --srec-len parameter.
- For a 0x75 byte record you should set --srec-len=0x70. */
-unsigned int Chunk = DEFAULT_CHUNK;
-
-/* The type of srec output (free or forced to S3).
- This variable can be modified by objcopy's --srec-forceS3
- parameter. */
-bfd_boolean S3Forced = FALSE;
-
-/* When writing an S-record file, the S-records can not be output as
- they are seen. This structure is used to hold them in memory. */
-
-struct srec_data_list_struct
-{
- struct srec_data_list_struct *next;
- bfd_byte *data;
- bfd_vma where;
- bfd_size_type size;
-};
-
-typedef struct srec_data_list_struct srec_data_list_type;
-
-/* When scanning the S-record file, a linked list of srec_symbol
- structures is built to represent the symbol table (if there is
- one). */
-
-struct srec_symbol
-{
- struct srec_symbol *next;
- const char *name;
- bfd_vma val;
-};
-
-/* The S-record tdata information. */
-
-typedef struct srec_data_struct
- {
- srec_data_list_type *head;
- srec_data_list_type *tail;
- unsigned int type;
- struct srec_symbol *symbols;
- struct srec_symbol *symtail;
- asymbol *csymbols;
- }
-tdata_type;
-
-static bfd_boolean srec_write_section
- PARAMS ((bfd *, tdata_type *, srec_data_list_type *));
-static bfd_boolean srec_write_terminator
- PARAMS ((bfd *, tdata_type *));
-
-/* Set up the S-record tdata information. */
-
-static bfd_boolean
-srec_mkobject (abfd)
- bfd *abfd;
-{
- bfd_size_type amt;
- tdata_type *tdata;
-
- srec_init ();
-
- amt = sizeof (tdata_type);
- tdata = (tdata_type *) bfd_alloc (abfd, amt);
- if (tdata == NULL)
- return FALSE;
-
- abfd->tdata.srec_data = tdata;
- tdata->type = 1;
- tdata->head = NULL;
- tdata->tail = NULL;
- tdata->symbols = NULL;
- tdata->symtail = NULL;
- tdata->csymbols = NULL;
-
- return TRUE;
-}
-
-/* Read a byte from an S record file. Set *ERRORPTR if an error
- occurred. Return EOF on error or end of file. */
-
-static int
-srec_get_byte (abfd, errorptr)
- bfd *abfd;
- bfd_boolean *errorptr;
-{
- bfd_byte c;
-
- if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
- {
- if (bfd_get_error () != bfd_error_file_truncated)
- *errorptr = TRUE;
- return EOF;
- }
-
- return (int) (c & 0xff);
-}
-
-/* Report a problem in an S record file. FIXME: This probably should
- not call fprintf, but we really do need some mechanism for printing
- error messages. */
-
-static void
-srec_bad_byte (abfd, lineno, c, error)
- bfd *abfd;
- unsigned int lineno;
- int c;
- bfd_boolean error;
-{
- if (c == EOF)
- {
- if (! error)
- bfd_set_error (bfd_error_file_truncated);
- }
- else
- {
- char buf[10];
-
- if (! ISPRINT (c))
- sprintf (buf, "\\%03o", (unsigned int) c);
- else
- {
- buf[0] = c;
- buf[1] = '\0';
- }
- (*_bfd_error_handler)
- (_("%s:%d: Unexpected character `%s' in S-record file\n"),
- bfd_archive_filename (abfd), lineno, buf);
- bfd_set_error (bfd_error_bad_value);
- }
-}
-
-/* Add a new symbol found in an S-record file. */
-
-static bfd_boolean
-srec_new_symbol (abfd, name, val)
- bfd *abfd;
- const char *name;
- bfd_vma val;
-{
- struct srec_symbol *n;
- bfd_size_type amt = sizeof (struct srec_symbol);
-
- n = (struct srec_symbol *) bfd_alloc (abfd, amt);
- if (n == NULL)
- return FALSE;
-
- n->name = name;
- n->val = val;
-
- if (abfd->tdata.srec_data->symbols == NULL)
- abfd->tdata.srec_data->symbols = n;
- else
- abfd->tdata.srec_data->symtail->next = n;
- abfd->tdata.srec_data->symtail = n;
- n->next = NULL;
-
- ++abfd->symcount;
-
- return TRUE;
-}
-
-/* Read the S record file and turn it into sections. We create a new
- section for each contiguous set of bytes. */
-
-static bfd_boolean
-srec_scan (abfd)
- bfd *abfd;
-{
- int c;
- unsigned int lineno = 1;
- bfd_boolean error = FALSE;
- bfd_byte *buf = NULL;
- size_t bufsize = 0;
- asection *sec = NULL;
- char *symbuf = NULL;
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- goto error_return;
-
- while ((c = srec_get_byte (abfd, &error)) != EOF)
- {
- /* We only build sections from contiguous S-records, so if this
- is not an S-record, then stop building a section. */
- if (c != 'S' && c != '\r' && c != '\n')
- sec = NULL;
-
- switch (c)
- {
- default:
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
-
- case '\n':
- ++lineno;
- break;
-
- case '\r':
- break;
-
- case '$':
- /* Starting a module name, which we ignore. */
- while ((c = srec_get_byte (abfd, &error)) != '\n'
- && c != EOF)
- ;
- if (c == EOF)
- {
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
-
- ++lineno;
-
- break;
-
- case ' ':
- do
- {
- bfd_size_type alc;
- char *p, *symname;
- bfd_vma symval;
-
- /* Starting a symbol definition. */
- while ((c = srec_get_byte (abfd, &error)) != EOF
- && (c == ' ' || c == '\t'))
- ;
-
- if (c == '\n' || c == '\r')
- break;
-
- if (c == EOF)
- {
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
-
- alc = 10;
- symbuf = (char *) bfd_malloc (alc + 1);
- if (symbuf == NULL)
- goto error_return;
-
- p = symbuf;
-
- *p++ = c;
- while ((c = srec_get_byte (abfd, &error)) != EOF
- && ! ISSPACE (c))
- {
- if ((bfd_size_type) (p - symbuf) >= alc)
- {
- char *n;
-
- alc *= 2;
- n = (char *) bfd_realloc (symbuf, alc + 1);
- if (n == NULL)
- goto error_return;
- p = n + (p - symbuf);
- symbuf = n;
- }
-
- *p++ = c;
- }
-
- if (c == EOF)
- {
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
-
- *p++ = '\0';
- symname = bfd_alloc (abfd, (bfd_size_type) (p - symbuf));
- if (symname == NULL)
- goto error_return;
- strcpy (symname, symbuf);
- free (symbuf);
- symbuf = NULL;
-
- while ((c = srec_get_byte (abfd, &error)) != EOF
- && (c == ' ' || c == '\t'))
- ;
- if (c == EOF)
- {
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
-
- /* Skip a dollar sign before the hex value. */
- if (c == '$')
- {
- c = srec_get_byte (abfd, &error);
- if (c == EOF)
- {
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
- }
-
- symval = 0;
- while (ISHEX (c))
- {
- symval <<= 4;
- symval += NIBBLE (c);
- c = srec_get_byte (abfd, &error);
- }
-
- if (! srec_new_symbol (abfd, symname, symval))
- goto error_return;
- }
- while (c == ' ' || c == '\t')
- ;
-
- if (c == '\n')
- ++lineno;
- else if (c != '\r')
- {
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
-
- break;
-
- case 'S':
- {
- file_ptr pos;
- char hdr[3];
- unsigned int bytes;
- bfd_vma address;
- bfd_byte *data;
-
- /* Starting an S-record. */
-
- pos = bfd_tell (abfd) - 1;
-
- if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
- goto error_return;
-
- if (! ISHEX (hdr[1]) || ! ISHEX (hdr[2]))
- {
- if (! ISHEX (hdr[1]))
- c = hdr[1];
- else
- c = hdr[2];
- srec_bad_byte (abfd, lineno, c, error);
- goto error_return;
- }
-
- bytes = HEX (hdr + 1);
- if (bytes * 2 > bufsize)
- {
- if (buf != NULL)
- free (buf);
- buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
- if (buf == NULL)
- goto error_return;
- bufsize = bytes * 2;
- }
-
- if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
- goto error_return;
-
- /* Ignore the checksum byte. */
- --bytes;
-
- address = 0;
- data = buf;
- switch (hdr[0])
- {
- case '0':
- case '5':
- /* Prologue--ignore the file name, but stop building a
- section at this point. */
- sec = NULL;
- break;
-
- case '3':
- address = HEX (data);
- data += 2;
- --bytes;
- /* Fall through. */
- case '2':
- address = (address << 8) | HEX (data);
- data += 2;
- --bytes;
- /* Fall through. */
- case '1':
- address = (address << 8) | HEX (data);
- data += 2;
- address = (address << 8) | HEX (data);
- data += 2;
- bytes -= 2;
-
- if (sec != NULL
- && sec->vma + sec->_raw_size == address)
- {
- /* This data goes at the end of the section we are
- currently building. */
- sec->_raw_size += bytes;
- }
- else
- {
- char secbuf[20];
- char *secname;
- bfd_size_type amt;
-
- sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
- amt = strlen (secbuf) + 1;
- secname = (char *) bfd_alloc (abfd, amt);
- strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
- if (sec == NULL)
- goto error_return;
- sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
- sec->vma = address;
- sec->lma = address;
- sec->_raw_size = bytes;
- sec->filepos = pos;
- }
-
- break;
-
- case '7':
- address = HEX (data);
- data += 2;
- /* Fall through. */
- case '8':
- address = (address << 8) | HEX (data);
- data += 2;
- /* Fall through. */
- case '9':
- address = (address << 8) | HEX (data);
- data += 2;
- address = (address << 8) | HEX (data);
- data += 2;
-
- /* This is a termination record. */
- abfd->start_address = address;
-
- if (buf != NULL)
- free (buf);
-
- return TRUE;
- }
- }
- break;
- }
- }
-
- if (error)
- goto error_return;
-
- if (buf != NULL)
- free (buf);
-
- return TRUE;
-
- error_return:
- if (symbuf != NULL)
- free (symbuf);
- if (buf != NULL)
- free (buf);
- return FALSE;
-}
-
-/* Check whether an existing file is an S-record file. */
-
-static const bfd_target *
-srec_object_p (abfd)
- bfd *abfd;
-{
- PTR tdata_save;
- bfd_byte b[4];
-
- srec_init ();
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (b, (bfd_size_type) 4, abfd) != 4)
- return NULL;
-
- if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- tdata_save = abfd->tdata.any;
- if (! srec_mkobject (abfd) || ! srec_scan (abfd))
- {
- if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = tdata_save;
- return NULL;
- }
-
- if (abfd->symcount > 0)
- abfd->flags |= HAS_SYMS;
-
- return abfd->xvec;
-}
-
-/* Check whether an existing file is an S-record file with symbols. */
-
-static const bfd_target *
-symbolsrec_object_p (abfd)
- bfd *abfd;
-{
- PTR tdata_save;
- char b[2];
-
- srec_init ();
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (b, (bfd_size_type) 2, abfd) != 2)
- return NULL;
-
- if (b[0] != '$' || b[1] != '$')
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- tdata_save = abfd->tdata.any;
- if (! srec_mkobject (abfd) || ! srec_scan (abfd))
- {
- if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = tdata_save;
- return NULL;
- }
-
- if (abfd->symcount > 0)
- abfd->flags |= HAS_SYMS;
-
- return abfd->xvec;
-}
-
-/* Read in the contents of a section in an S-record file. */
-
-static bfd_boolean
-srec_read_section (abfd, section, contents)
- bfd *abfd;
- asection *section;
- bfd_byte *contents;
-{
- int c;
- bfd_size_type sofar = 0;
- bfd_boolean error = FALSE;
- bfd_byte *buf = NULL;
- size_t bufsize = 0;
-
- if (bfd_seek (abfd, section->filepos, SEEK_SET) != 0)
- goto error_return;
-
- while ((c = srec_get_byte (abfd, &error)) != EOF)
- {
- bfd_byte hdr[3];
- unsigned int bytes;
- bfd_vma address;
- bfd_byte *data;
-
- if (c == '\r' || c == '\n')
- continue;
-
- /* This is called after srec_scan has already been called, so we
- ought to know the exact format. */
- BFD_ASSERT (c == 'S');
-
- if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
- goto error_return;
-
- BFD_ASSERT (ISHEX (hdr[1]) && ISHEX (hdr[2]));
-
- bytes = HEX (hdr + 1);
-
- if (bytes * 2 > bufsize)
- {
- if (buf != NULL)
- free (buf);
- buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
- if (buf == NULL)
- goto error_return;
- bufsize = bytes * 2;
- }
-
- if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
- goto error_return;
-
- address = 0;
- data = buf;
- switch (hdr[0])
- {
- default:
- BFD_ASSERT (sofar == section->_raw_size);
- if (buf != NULL)
- free (buf);
- return TRUE;
-
- case '3':
- address = HEX (data);
- data += 2;
- --bytes;
- /* Fall through. */
- case '2':
- address = (address << 8) | HEX (data);
- data += 2;
- --bytes;
- /* Fall through. */
- case '1':
- address = (address << 8) | HEX (data);
- data += 2;
- address = (address << 8) | HEX (data);
- data += 2;
- bytes -= 2;
-
- if (address != section->vma + sofar)
- {
- /* We've come to the end of this section. */
- BFD_ASSERT (sofar == section->_raw_size);
- if (buf != NULL)
- free (buf);
- return TRUE;
- }
-
- /* Don't consider checksum. */
- --bytes;
-
- while (bytes-- != 0)
- {
- contents[sofar] = HEX (data);
- data += 2;
- ++sofar;
- }
-
- break;
- }
- }
-
- if (error)
- goto error_return;
-
- BFD_ASSERT (sofar == section->_raw_size);
-
- if (buf != NULL)
- free (buf);
-
- return TRUE;
-
- error_return:
- if (buf != NULL)
- free (buf);
- return FALSE;
-}
-
-/* Get the contents of a section in an S-record file. */
-
-static bfd_boolean
-srec_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- asection *section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
-{
- if (section->used_by_bfd == NULL)
- {
- section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
- if (section->used_by_bfd == NULL && section->_raw_size != 0)
- return FALSE;
-
- if (! srec_read_section (abfd, section, section->used_by_bfd))
- return FALSE;
- }
-
- memcpy (location, (bfd_byte *) section->used_by_bfd + offset,
- (size_t) count);
-
- return TRUE;
-}
-
-/* Set the architecture. We accept an unknown architecture here. */
-
-static bfd_boolean
-srec_set_arch_mach (abfd, arch, mach)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long mach;
-{
- if (arch == bfd_arch_unknown)
- {
- abfd->arch_info = &bfd_default_arch_struct;
- return TRUE;
- }
- return bfd_default_set_arch_mach (abfd, arch, mach);
-}
-
-/* We have to save up all the Srecords for a splurge before output. */
-
-static bfd_boolean
-srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
- bfd *abfd;
- sec_ptr section;
- const PTR location;
- file_ptr offset;
- bfd_size_type bytes_to_do;
-{
- tdata_type *tdata = abfd->tdata.srec_data;
- register srec_data_list_type *entry;
-
- entry = ((srec_data_list_type *)
- bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type)));
- if (entry == NULL)
- return FALSE;
-
- if (bytes_to_do
- && (section->flags & SEC_ALLOC)
- && (section->flags & SEC_LOAD))
- {
- bfd_byte *data;
-
- data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
- if (data == NULL)
- return FALSE;
- memcpy ((PTR) data, location, (size_t) bytes_to_do);
-
- /* Ff S3Forced is TRUE then always select S3 records,
- regardless of the siez of the addresses. */
- if (S3Forced)
- tdata->type = 3;
- else if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
- ; /* The default, S1, is OK. */
- else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
- && tdata->type <= 2)
- tdata->type = 2;
- else
- tdata->type = 3;
-
- entry->data = data;
- entry->where = section->lma + offset;
- entry->size = bytes_to_do;
-
- /* Sort the records by address. Optimize for the common case of
- adding a record to the end of the list. */
- if (tdata->tail != NULL
- && entry->where >= tdata->tail->where)
- {
- tdata->tail->next = entry;
- entry->next = NULL;
- tdata->tail = entry;
- }
- else
- {
- register srec_data_list_type **look;
-
- for (look = &tdata->head;
- *look != NULL && (*look)->where < entry->where;
- look = &(*look)->next)
- ;
- entry->next = *look;
- *look = entry;
- if (entry->next == NULL)
- tdata->tail = entry;
- }
- }
- return TRUE;
-}
-
-/* Write a record of type, of the supplied number of bytes. The
- supplied bytes and length don't have a checksum. That's worked out
- here. */
-
-static bfd_boolean
-srec_write_record (abfd, type, address, data, end)
- bfd *abfd;
- unsigned int type;
- bfd_vma address;
- const bfd_byte *data;
- const bfd_byte *end;
-{
- char buffer[2 * MAXCHUNK + 6];
- unsigned int check_sum = 0;
- const bfd_byte *src = data;
- char *dst = buffer;
- char *length;
- bfd_size_type wrlen;
-
- *dst++ = 'S';
- *dst++ = '0' + type;
-
- length = dst;
- dst += 2; /* Leave room for dst. */
-
- switch (type)
- {
- case 3:
- case 7:
- TOHEX (dst, (address >> 24), check_sum);
- dst += 2;
- case 8:
- case 2:
- TOHEX (dst, (address >> 16), check_sum);
- dst += 2;
- case 9:
- case 1:
- case 0:
- TOHEX (dst, (address >> 8), check_sum);
- dst += 2;
- TOHEX (dst, (address), check_sum);
- dst += 2;
- break;
-
- }
- for (src = data; src < end; src++)
- {
- TOHEX (dst, *src, check_sum);
- dst += 2;
- }
-
- /* Fill in the length. */
- TOHEX (length, (dst - length) / 2, check_sum);
- check_sum &= 0xff;
- check_sum = 255 - check_sum;
- TOHEX (dst, check_sum, check_sum);
- dst += 2;
-
- *dst++ = '\r';
- *dst++ = '\n';
- wrlen = dst - buffer;
- if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
- return FALSE;
- return TRUE;
-}
-
-static bfd_boolean
-srec_write_header (abfd)
- bfd *abfd;
-{
- unsigned int len = strlen (abfd->filename);
-
- /* I'll put an arbitrary 40 char limit on header size. */
- if (len > 40)
- len = 40;
-
- return srec_write_record (abfd, 0, (bfd_vma) 0,
- abfd->filename, abfd->filename + len);
-}
-
-static bfd_boolean
-srec_write_section (abfd, tdata, list)
- bfd *abfd;
- tdata_type *tdata;
- srec_data_list_type *list;
-{
- unsigned int octets_written = 0;
- bfd_byte *location = list->data;
-
- /* Validate number of data bytes to write. The srec length byte
- counts the address, data and crc bytes. S1 (tdata->type == 1)
- records have two address bytes, S2 (tdata->type == 2) records
- have three, and S3 (tdata->type == 3) records have four.
- The total length can't exceed 255, and a zero data length will
- spin for a long time. */
- if (Chunk == 0)
- Chunk = 1;
- else if (Chunk > MAXCHUNK - tdata->type - 2)
- Chunk = MAXCHUNK - tdata->type - 2;
-
- while (octets_written < list->size)
- {
- bfd_vma address;
- unsigned int octets_this_chunk = list->size - octets_written;
-
- if (octets_this_chunk > Chunk)
- octets_this_chunk = Chunk;
-
- address = list->where + octets_written / bfd_octets_per_byte (abfd);
-
- if (! srec_write_record (abfd,
- tdata->type,
- address,
- location,
- location + octets_this_chunk))
- return FALSE;
-
- octets_written += octets_this_chunk;
- location += octets_this_chunk;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-srec_write_terminator (abfd, tdata)
- bfd *abfd;
- tdata_type *tdata;
-{
- return srec_write_record (abfd, 10 - tdata->type,
- abfd->start_address, NULL, NULL);
-}
-
-static bfd_boolean
-srec_write_symbols (abfd)
- bfd *abfd;
-{
- /* Dump out the symbols of a bfd. */
- int i;
- int count = bfd_get_symcount (abfd);
-
- if (count)
- {
- bfd_size_type len;
- asymbol **table = bfd_get_outsymbols (abfd);
- len = strlen (abfd->filename);
- if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
- || bfd_bwrite (abfd->filename, len, abfd) != len
- || bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2)
- return FALSE;
-
- for (i = 0; i < count; i++)
- {
- asymbol *s = table[i];
- if (! bfd_is_local_label (abfd, s)
- && (s->flags & BSF_DEBUGGING) == 0)
- {
- /* Just dump out non debug symbols. */
- char buf[43], *p;
-
- len = strlen (s->name);
- if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) != 2
- || bfd_bwrite (s->name, len, abfd) != len)
- return FALSE;
-
- sprintf_vma (buf + 2, (s->value
- + s->section->output_section->lma
- + s->section->output_offset));
- p = buf + 2;
- while (p[0] == '0' && p[1] != 0)
- p++;
- len = strlen (p);
- p[len] = '\r';
- p[len + 1] = '\n';
- *--p = '$';
- *--p = ' ';
- len += 4;
- if (bfd_bwrite (p, len, abfd) != len)
- return FALSE;
- }
- }
- if (bfd_bwrite ("$$ \r\n", (bfd_size_type) 5, abfd) != 5)
- return FALSE;
- }
-
- return TRUE;
-}
-
-static bfd_boolean
-internal_srec_write_object_contents (abfd, symbols)
- bfd *abfd;
- int symbols;
-{
- tdata_type *tdata = abfd->tdata.srec_data;
- srec_data_list_type *list;
-
- if (symbols)
- {
- if (! srec_write_symbols (abfd))
- return FALSE;
- }
-
- if (! srec_write_header (abfd))
- return FALSE;
-
- /* Now wander though all the sections provided and output them. */
- list = tdata->head;
-
- while (list != (srec_data_list_type *) NULL)
- {
- if (! srec_write_section (abfd, tdata, list))
- return FALSE;
- list = list->next;
- }
- return srec_write_terminator (abfd, tdata);
-}
-
-static bfd_boolean
-srec_write_object_contents (abfd)
- bfd *abfd;
-{
- return internal_srec_write_object_contents (abfd, 0);
-}
-
-static bfd_boolean
-symbolsrec_write_object_contents (abfd)
- bfd *abfd;
-{
- return internal_srec_write_object_contents (abfd, 1);
-}
-
-static int
-srec_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
-{
- return 0;
-}
-
-/* Return the amount of memory needed to read the symbol table. */
-
-static long
-srec_get_symtab_upper_bound (abfd)
- bfd *abfd;
-{
- return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *);
-}
-
-/* Return the symbol table. */
-
-static long
-srec_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
-{
- bfd_size_type symcount = bfd_get_symcount (abfd);
- asymbol *csymbols;
- unsigned int i;
-
- csymbols = abfd->tdata.srec_data->csymbols;
- if (csymbols == NULL)
- {
- asymbol *c;
- struct srec_symbol *s;
-
- csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
- if (csymbols == NULL && symcount != 0)
- return 0;
- abfd->tdata.srec_data->csymbols = csymbols;
-
- for (s = abfd->tdata.srec_data->symbols, c = csymbols;
- s != NULL;
- s = s->next, ++c)
- {
- c->the_bfd = abfd;
- c->name = s->name;
- c->value = s->val;
- c->flags = BSF_GLOBAL;
- c->section = bfd_abs_section_ptr;
- c->udata.p = NULL;
- }
- }
-
- for (i = 0; i < symcount; i++)
- *alocation++ = csymbols++;
- *alocation = NULL;
-
- return symcount;
-}
-
-static void
-srec_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
-}
-
-static void
-srec_print_symbol (abfd, afile, symbol, how)
- bfd *abfd;
- PTR afile;
- asymbol *symbol;
- bfd_print_symbol_type how;
-{
- FILE *file = (FILE *) afile;
- switch (how)
- {
- case bfd_print_symbol_name:
- fprintf (file, "%s", symbol->name);
- break;
- default:
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
- fprintf (file, " %-5s %s",
- symbol->section->name,
- symbol->name);
-
- }
-}
-
-#define srec_close_and_cleanup _bfd_generic_close_and_cleanup
-#define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define srec_new_section_hook _bfd_generic_new_section_hook
-
-#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define srec_get_lineno _bfd_nosymbols_get_lineno
-#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define srec_make_empty_symbol _bfd_generic_make_empty_symbol
-#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define srec_read_minisymbols _bfd_generic_read_minisymbols
-#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define srec_get_reloc_upper_bound \
- ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
-#define srec_canonicalize_reloc \
- ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
-#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-
-#define srec_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-#define srec_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define srec_bfd_relax_section bfd_generic_relax_section
-#define srec_bfd_gc_sections bfd_generic_gc_sections
-#define srec_bfd_merge_sections bfd_generic_merge_sections
-#define srec_bfd_discard_group bfd_generic_discard_group
-#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define srec_bfd_link_just_syms _bfd_generic_link_just_syms
-#define srec_bfd_final_link _bfd_generic_final_link
-#define srec_bfd_link_split_section _bfd_generic_link_split_section
-
-const bfd_target srec_vec =
-{
- "srec", /* name */
- bfd_target_srec_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
- | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {
- _bfd_dummy_target,
- srec_object_p, /* bfd_check_format */
- _bfd_dummy_target,
- _bfd_dummy_target,
- },
- {
- bfd_false,
- srec_mkobject,
- _bfd_generic_mkarchive,
- bfd_false,
- },
- { /* bfd_write_contents */
- bfd_false,
- srec_write_object_contents,
- _bfd_write_archive_contents,
- bfd_false,
- },
-
- BFD_JUMP_TABLE_GENERIC (srec),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (srec),
- BFD_JUMP_TABLE_RELOCS (srec),
- BFD_JUMP_TABLE_WRITE (srec),
- BFD_JUMP_TABLE_LINK (srec),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0
-};
-
-const bfd_target symbolsrec_vec =
-{
- "symbolsrec", /* name */
- bfd_target_srec_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
- | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {
- _bfd_dummy_target,
- symbolsrec_object_p, /* bfd_check_format */
- _bfd_dummy_target,
- _bfd_dummy_target,
- },
- {
- bfd_false,
- srec_mkobject,
- _bfd_generic_mkarchive,
- bfd_false,
- },
- { /* bfd_write_contents */
- bfd_false,
- symbolsrec_write_object_contents,
- _bfd_write_archive_contents,
- bfd_false,
- },
-
- BFD_JUMP_TABLE_GENERIC (srec),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (srec),
- BFD_JUMP_TABLE_RELOCS (srec),
- BFD_JUMP_TABLE_WRITE (srec),
- BFD_JUMP_TABLE_LINK (srec),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0
-};
diff --git a/contrib/binutils/bfd/stab-syms.c b/contrib/binutils/bfd/stab-syms.c
deleted file mode 100644
index a685e31..0000000
--- a/contrib/binutils/bfd/stab-syms.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Table of stab names for the BFD library.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 2000
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-
-#define ARCH_SIZE 32 /* Value doesn't matter. */
-#include "libaout.h"
-#include "aout/aout64.h"
-
-/* Ignore duplicate stab codes; just return the string for the first
- one. */
-#define __define_stab(NAME, CODE, STRING) __define_name(CODE, STRING)
-#define __define_stab_duplicate(NAME, CODE, STRING)
-
-/* These are not really stab symbols, but it is
- convenient to have them here for the sake of nm.
- For completeness, we could also add N_TEXT etc, but those
- are never needed, since nm treats those specially. */
-#define EXTRA_SYMBOLS \
- __define_name (N_SETA, "SETA")/* Absolute set element symbol */ \
- __define_name (N_SETT, "SETT")/* Text set element symbol */ \
- __define_name (N_SETD, "SETD")/* Data set element symbol */ \
- __define_name (N_SETB, "SETB")/* Bss set element symbol */ \
- __define_name (N_SETV, "SETV")/* Pointer to set vector in data area. */ \
- __define_name (N_INDR, "INDR") \
- __define_name (N_WARNING, "WARNING")
-
-const char *
-bfd_get_stab_name (code)
- int code;
-{
- switch (code)
- {
-#define __define_name(val, str) case val: return str;
-#include "aout/stab.def"
- EXTRA_SYMBOLS
- }
-
- return (const char *) 0;
-}
diff --git a/contrib/binutils/bfd/stabs.c b/contrib/binutils/bfd/stabs.c
deleted file mode 100644
index 04b91f6..0000000
--- a/contrib/binutils/bfd/stabs.c
+++ /dev/null
@@ -1,880 +0,0 @@
-/* Stabs in sections linking support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* This file contains support for linking stabs in sections, as used
- on COFF and ELF. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "aout/stab_gnu.h"
-#include "safe-ctype.h"
-
-/* Stabs entries use a 12 byte format:
- 4 byte string table index
- 1 byte stab type
- 1 byte stab other field
- 2 byte stab desc field
- 4 byte stab value
- FIXME: This will have to change for a 64 bit object format.
-
- The stabs symbols are divided into compilation units. For the
- first entry in each unit, the type of 0, the value is the length of
- the string table for this unit, and the desc field is the number of
- stabs symbols for this unit. */
-
-#define STRDXOFF (0)
-#define TYPEOFF (4)
-#define OTHEROFF (5)
-#define DESCOFF (6)
-#define VALOFF (8)
-#define STABSIZE (12)
-
-/* A hash table used for header files with N_BINCL entries. */
-
-struct stab_link_includes_table
-{
- struct bfd_hash_table root;
-};
-
-/* A linked list of totals that we have found for a particular header
- file. A total is a unique identifier for a particular BINCL...EINCL
- sequence of STABs that can be used to identify duplicate sequences.
- It consists of three fields, 'sum_chars' which is the sum of all the
- STABS characters; 'num_chars' which is the number of these charactes
- and 'symb' which is a buffer of all the symbols in the sequence. This
- buffer is only checked as a last resort. */
-
-struct stab_link_includes_totals
-{
- struct stab_link_includes_totals *next;
- bfd_vma sum_chars; /* Accumulated sum of STABS characters. */
- bfd_vma num_chars; /* Number of STABS characters. */
- const char* symb; /* The STABS characters themselves. */
-};
-
-/* An entry in the header file hash table. */
-
-struct stab_link_includes_entry
-{
- struct bfd_hash_entry root;
- /* List of totals we have found for this file. */
- struct stab_link_includes_totals *totals;
-};
-
-/* Look up an entry in an the header file hash table. */
-
-#define stab_link_includes_lookup(table, string, create, copy) \
- ((struct stab_link_includes_entry *) \
- bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
-
-/* This structure is used to hold a list of N_BINCL symbols, some of
- which might be converted into N_EXCL symbols. */
-
-struct stab_excl_list
-{
- /* The next symbol to convert. */
- struct stab_excl_list *next;
- /* The offset to this symbol in the section contents. */
- bfd_size_type offset;
- /* The value to use for the symbol. */
- bfd_vma val;
- /* The type of this symbol (N_BINCL or N_EXCL). */
- int type;
-};
-
-/* This structure is stored with each .stab section. */
-
-struct stab_section_info
-{
- /* This is a linked list of N_BINCL symbols which should be
- converted into N_EXCL symbols. */
- struct stab_excl_list *excls;
-
- /* This is used to map input stab offsets within their sections
- to output stab offsets, to take into account stabs that have
- been deleted. If it is NULL, the output offsets are the same
- as the input offsets, because no stabs have been deleted from
- this section. Otherwise the i'th entry is the number of
- bytes of stabs that have been deleted prior to the i'th
- stab. */
- bfd_size_type *cumulative_skips;
-
- /* This is an array of string indices. For each stab symbol, we
- store the string index here. If a stab symbol should not be
- included in the final output, the string index is -1. */
- bfd_size_type stridxs[1];
-};
-
-/* This structure is used to keep track of stabs in sections
- information while linking. */
-
-struct stab_info
-{
- /* A hash table used to hold stabs strings. */
- struct bfd_strtab_hash *strings;
- /* The header file hash table. */
- struct stab_link_includes_table includes;
- /* The first .stabstr section. */
- asection *stabstr;
-};
-
-static struct bfd_hash_entry *stab_link_includes_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-
-/* The function to create a new entry in the header file hash table. */
-
-static struct bfd_hash_entry *
-stab_link_includes_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct stab_link_includes_entry *ret =
- (struct stab_link_includes_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct stab_link_includes_entry *) NULL)
- ret = ((struct stab_link_includes_entry *)
- bfd_hash_allocate (table,
- sizeof (struct stab_link_includes_entry)));
- if (ret == (struct stab_link_includes_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct stab_link_includes_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
- if (ret)
- {
- /* Set local fields. */
- ret->totals = NULL;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* This function is called for each input file from the add_symbols
- pass of the linker. */
-
-bfd_boolean
-_bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_offset)
- bfd *abfd;
- PTR *psinfo;
- asection *stabsec;
- asection *stabstrsec;
- PTR *psecinfo;
- bfd_size_type *pstring_offset;
-{
- bfd_boolean first;
- struct stab_info *sinfo;
- bfd_size_type count, amt;
- struct stab_section_info *secinfo;
- bfd_byte *stabbuf = NULL;
- bfd_byte *stabstrbuf = NULL;
- bfd_byte *sym, *symend;
- bfd_size_type stroff, next_stroff, skip;
- bfd_size_type *pstridx;
-
- if (stabsec->_raw_size == 0
- || stabstrsec->_raw_size == 0)
- {
- /* This file does not contain stabs debugging information. */
- return TRUE;
- }
-
- if (stabsec->_raw_size % STABSIZE != 0)
- {
- /* Something is wrong with the format of these stab symbols.
- Don't try to optimize them. */
- return TRUE;
- }
-
- if ((stabstrsec->flags & SEC_RELOC) != 0)
- {
- /* We shouldn't see relocations in the strings, and we aren't
- prepared to handle them. */
- return TRUE;
- }
-
- if ((stabsec->output_section != NULL
- && bfd_is_abs_section (stabsec->output_section))
- || (stabstrsec->output_section != NULL
- && bfd_is_abs_section (stabstrsec->output_section)))
- {
- /* At least one of the sections is being discarded from the
- link, so we should just ignore them. */
- return TRUE;
- }
-
- first = FALSE;
-
- if (*psinfo == NULL)
- {
- /* Initialize the stabs information we need to keep track of. */
- first = TRUE;
- amt = sizeof (struct stab_info);
- *psinfo = (PTR) bfd_alloc (abfd, amt);
- if (*psinfo == NULL)
- goto error_return;
- sinfo = (struct stab_info *) *psinfo;
- sinfo->strings = _bfd_stringtab_init ();
- if (sinfo->strings == NULL)
- goto error_return;
- /* Make sure the first byte is zero. */
- (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE);
- if (! bfd_hash_table_init_n (&sinfo->includes.root,
- stab_link_includes_newfunc,
- 251))
- goto error_return;
- sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr");
- sinfo->stabstr->flags |= SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING;
- }
-
- sinfo = (struct stab_info *) *psinfo;
-
- /* Initialize the information we are going to store for this .stab
- section. */
-
- count = stabsec->_raw_size / STABSIZE;
-
- amt = sizeof (struct stab_section_info);
- amt += (count - 1) * sizeof (bfd_size_type);
- *psecinfo = bfd_alloc (abfd, amt);
- if (*psecinfo == NULL)
- goto error_return;
-
- secinfo = (struct stab_section_info *) *psecinfo;
- secinfo->excls = NULL;
- secinfo->cumulative_skips = NULL;
- memset (secinfo->stridxs, 0, (size_t) count * sizeof (bfd_size_type));
-
- /* Read the stabs information from abfd. */
-
- stabbuf = (bfd_byte *) bfd_malloc (stabsec->_raw_size);
- stabstrbuf = (bfd_byte *) bfd_malloc (stabstrsec->_raw_size);
- if (stabbuf == NULL || stabstrbuf == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, stabsec, stabbuf, (bfd_vma) 0,
- stabsec->_raw_size)
- || ! bfd_get_section_contents (abfd, stabstrsec, stabstrbuf, (bfd_vma) 0,
- stabstrsec->_raw_size))
- goto error_return;
-
- /* Look through the stabs symbols, work out the new string indices,
- and identify N_BINCL symbols which can be eliminated. */
-
- stroff = 0;
- /* The stabs sections can be split when
- -split-by-reloc/-split-by-file is used. We must keep track of
- each stab section's place in the single concatenated string
- table. */
- next_stroff = pstring_offset ? *pstring_offset : 0;
- skip = 0;
-
- symend = stabbuf + stabsec->_raw_size;
- for (sym = stabbuf, pstridx = secinfo->stridxs;
- sym < symend;
- sym += STABSIZE, ++pstridx)
- {
- bfd_size_type symstroff;
- int type;
- const char *string;
-
- if (*pstridx != 0)
- {
- /* This symbol has already been handled by an N_BINCL pass. */
- continue;
- }
-
- type = sym[TYPEOFF];
-
- if (type == 0)
- {
- /* Special type 0 stabs indicate the offset to the next
- string table. We only copy the very first one. */
- stroff = next_stroff;
- next_stroff += bfd_get_32 (abfd, sym + 8);
- if (pstring_offset)
- *pstring_offset = next_stroff;
- if (! first)
- {
- *pstridx = (bfd_size_type) -1;
- ++skip;
- continue;
- }
- first = FALSE;
- }
-
- /* Store the string in the hash table, and record the index. */
- symstroff = stroff + bfd_get_32 (abfd, sym + STRDXOFF);
- if (symstroff >= stabstrsec->_raw_size)
- {
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): Stabs entry has invalid string index."),
- bfd_archive_filename (abfd),
- bfd_get_section_name (abfd, stabsec),
- (long) (sym - stabbuf));
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- string = (char *) stabstrbuf + symstroff;
- *pstridx = _bfd_stringtab_add (sinfo->strings, string, TRUE, TRUE);
-
- /* An N_BINCL symbol indicates the start of the stabs entries
- for a header file. We need to scan ahead to the next N_EINCL
- symbol, ignoring nesting, adding up all the characters in the
- symbol names, not including the file numbers in types (the
- first number after an open parenthesis). */
- if (type == (int) N_BINCL)
- {
- bfd_vma sum_chars;
- bfd_vma num_chars;
- bfd_vma buf_len = 0;
- char * symb;
- char * symb_rover;
- int nest;
- bfd_byte * incl_sym;
- struct stab_link_includes_entry * incl_entry;
- struct stab_link_includes_totals * t;
- struct stab_excl_list * ne;
-
- symb = symb_rover = NULL;
- sum_chars = num_chars = 0;
- nest = 0;
-
- for (incl_sym = sym + STABSIZE;
- incl_sym < symend;
- incl_sym += STABSIZE)
- {
- int incl_type;
-
- incl_type = incl_sym[TYPEOFF];
- if (incl_type == 0)
- break;
- else if (incl_type == (int) N_EXCL)
- continue;
- else if (incl_type == (int) N_EINCL)
- {
- if (nest == 0)
- break;
- --nest;
- }
- else if (incl_type == (int) N_BINCL)
- ++nest;
- else if (nest == 0)
- {
- const char *str;
-
- str = ((char *) stabstrbuf
- + stroff
- + bfd_get_32 (abfd, incl_sym + STRDXOFF));
- for (; *str != '\0'; str++)
- {
- if (num_chars >= buf_len)
- {
- buf_len += 32 * 1024;
- symb = bfd_realloc (symb, buf_len);
- if (symb == NULL)
- goto error_return;
- symb_rover = symb + num_chars;
- }
- * symb_rover ++ = * str;
- sum_chars += *str;
- num_chars ++;
- if (*str == '(')
- {
- /* Skip the file number. */
- ++str;
- while (ISDIGIT (*str))
- ++str;
- --str;
- }
- }
- }
- }
-
- BFD_ASSERT (num_chars == (bfd_vma) (symb_rover - symb));
-
- /* If we have already included a header file with the same
- value, then replaced this one with an N_EXCL symbol. */
- incl_entry = stab_link_includes_lookup (&sinfo->includes, string,
- TRUE, TRUE);
- if (incl_entry == NULL)
- goto error_return;
-
- for (t = incl_entry->totals; t != NULL; t = t->next)
- if (t->sum_chars == sum_chars
- && t->num_chars == num_chars
- && memcmp (t->symb, symb, num_chars) == 0)
- break;
-
- /* Record this symbol, so that we can set the value
- correctly. */
- amt = sizeof *ne;
- ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
- if (ne == NULL)
- goto error_return;
- ne->offset = sym - stabbuf;
- ne->val = sum_chars;
- ne->type = (int) N_BINCL;
- ne->next = secinfo->excls;
- secinfo->excls = ne;
-
- if (t == NULL)
- {
- /* This is the first time we have seen this header file
- with this set of stabs strings. */
- t = ((struct stab_link_includes_totals *)
- bfd_hash_allocate (&sinfo->includes.root, sizeof *t));
- if (t == NULL)
- goto error_return;
- t->sum_chars = sum_chars;
- t->num_chars = num_chars;
- t->symb = bfd_realloc (symb, num_chars); /* Trim data down. */
- t->next = incl_entry->totals;
- incl_entry->totals = t;
- }
- else
- {
- bfd_size_type *incl_pstridx;
-
- /* We have seen this header file before. Tell the final
- pass to change the type to N_EXCL. */
- ne->type = (int) N_EXCL;
-
- /* Free off superfluous symbols. */
- free (symb);
-
- /* Mark the skipped symbols. */
-
- nest = 0;
- for (incl_sym = sym + STABSIZE, incl_pstridx = pstridx + 1;
- incl_sym < symend;
- incl_sym += STABSIZE, ++incl_pstridx)
- {
- int incl_type;
-
- incl_type = incl_sym[TYPEOFF];
-
- if (incl_type == (int) N_EINCL)
- {
- if (nest == 0)
- {
- *incl_pstridx = (bfd_size_type) -1;
- ++skip;
- break;
- }
- --nest;
- }
- else if (incl_type == (int) N_BINCL)
- ++nest;
- else if (incl_type == (int) N_EXCL)
- /* Keep existing exclusion marks. */
- continue;
- else if (nest == 0)
- {
- *incl_pstridx = (bfd_size_type) -1;
- ++skip;
- }
- }
- }
- }
- }
-
- free (stabbuf);
- stabbuf = NULL;
- free (stabstrbuf);
- stabstrbuf = NULL;
-
- /* We need to set the section sizes such that the linker will
- compute the output section sizes correctly. We set the .stab
- size to not include the entries we don't want. We set
- SEC_EXCLUDE for the .stabstr section, so that it will be dropped
- from the link. We record the size of the strtab in the first
- .stabstr section we saw, and make sure we don't set SEC_EXCLUDE
- for that section. */
- stabsec->_cooked_size = (count - skip) * STABSIZE;
- if (stabsec->_cooked_size == 0)
- stabsec->flags |= SEC_EXCLUDE;
- stabstrsec->flags |= SEC_EXCLUDE;
- sinfo->stabstr->_cooked_size = _bfd_stringtab_size (sinfo->strings);
-
- /* Calculate the `cumulative_skips' array now that stabs have been
- deleted for this section. */
-
- if (skip != 0)
- {
- bfd_size_type i, offset;
- bfd_size_type *pskips;
-
- amt = count * sizeof (bfd_size_type);
- secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
- if (secinfo->cumulative_skips == NULL)
- goto error_return;
-
- pskips = secinfo->cumulative_skips;
- pstridx = secinfo->stridxs;
- offset = 0;
-
- for (i = 0; i < count; i++, pskips++, pstridx++)
- {
- *pskips = offset;
- if (*pstridx == (bfd_size_type) -1)
- offset += STABSIZE;
- }
-
- BFD_ASSERT (offset != 0);
- }
-
- return TRUE;
-
- error_return:
- if (stabbuf != NULL)
- free (stabbuf);
- if (stabstrbuf != NULL)
- free (stabstrbuf);
- return FALSE;
-}
-
-
-/* This function is called for each input file before the stab
- section is relocated. It discards stab entries for discarded
- functions and variables. The function returns TRUE iff
- any entries have been deleted.
-*/
-
-bfd_boolean
-_bfd_discard_section_stabs (abfd, stabsec, psecinfo,
- reloc_symbol_deleted_p, cookie)
- bfd *abfd;
- asection *stabsec;
- PTR psecinfo;
- bfd_boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR));
- PTR cookie;
-{
- bfd_size_type count, amt;
- struct stab_section_info *secinfo;
- bfd_byte *stabbuf = NULL;
- bfd_byte *sym, *symend;
- bfd_size_type skip;
- bfd_size_type *pstridx;
- int deleting;
-
- if (stabsec->_raw_size == 0)
- {
- /* This file does not contain stabs debugging information. */
- return FALSE;
- }
-
- if (stabsec->_raw_size % STABSIZE != 0)
- {
- /* Something is wrong with the format of these stab symbols.
- Don't try to optimize them. */
- return FALSE;
- }
-
- if ((stabsec->output_section != NULL
- && bfd_is_abs_section (stabsec->output_section)))
- {
- /* At least one of the sections is being discarded from the
- link, so we should just ignore them. */
- return FALSE;
- }
-
- /* We should have initialized our data in _bfd_link_stab_sections.
- If there was some bizarre error reading the string sections, though,
- we might not have. Bail rather than asserting. */
- if (psecinfo == NULL)
- return FALSE;
-
- count = stabsec->_raw_size / STABSIZE;
- secinfo = (struct stab_section_info *) psecinfo;
-
- /* Read the stabs information from abfd. */
-
- stabbuf = (bfd_byte *) bfd_malloc (stabsec->_raw_size);
- if (stabbuf == NULL)
- goto error_return;
-
- if (! bfd_get_section_contents (abfd, stabsec, stabbuf, (bfd_vma) 0,
- stabsec->_raw_size))
- goto error_return;
-
- /* Look through the stabs symbols and discard any information for
- discarded functions. */
-
- skip = 0;
- deleting = -1;
-
- symend = stabbuf + stabsec->_raw_size;
- for (sym = stabbuf, pstridx = secinfo->stridxs;
- sym < symend;
- sym += STABSIZE, ++pstridx)
- {
- int type;
-
- if (*pstridx == (bfd_size_type) -1)
- {
- /* This stab was deleted in a previous pass. */
- continue;
- }
-
- type = sym[TYPEOFF];
-
- if (type == (int) N_FUN)
- {
- int strx = bfd_get_32 (abfd, sym + STRDXOFF);
-
- if (strx == 0)
- {
- if (deleting)
- {
- skip++;
- *pstridx = -1;
- }
- deleting = -1;
- continue;
- }
- deleting = 0;
- if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie))
- deleting = 1;
- }
-
- if (deleting == 1)
- {
- *pstridx = -1;
- skip++;
- }
- else if (deleting == -1)
- {
- /* Outside of a function. Check for deleted variables. */
- if (type == (int) N_STSYM || type == (int) N_LCSYM)
- if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie))
- {
- *pstridx = -1;
- skip ++;
- }
- /* We should also check for N_GSYM entries which reference a
- deleted global, but those are less harmful to debuggers
- and would require parsing the stab strings. */
- }
- }
-
- free (stabbuf);
- stabbuf = NULL;
-
- /* Shrink the stabsec as needed. */
- stabsec->_cooked_size -= skip * STABSIZE;
- if (stabsec->_cooked_size == 0)
- stabsec->flags |= SEC_EXCLUDE;
-
- /* Recalculate the `cumulative_skips' array now that stabs have been
- deleted for this section. */
-
- if (skip != 0)
- {
- bfd_size_type i, offset;
- bfd_size_type *pskips;
-
- if (secinfo->cumulative_skips == NULL)
- {
- amt = count * sizeof (bfd_size_type);
- secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
- if (secinfo->cumulative_skips == NULL)
- goto error_return;
- }
-
- pskips = secinfo->cumulative_skips;
- pstridx = secinfo->stridxs;
- offset = 0;
-
- for (i = 0; i < count; i++, pskips++, pstridx++)
- {
- *pskips = offset;
- if (*pstridx == (bfd_size_type) -1)
- offset += STABSIZE;
- }
-
- BFD_ASSERT (offset != 0);
- }
-
- return skip > 0;
-
- error_return:
- if (stabbuf != NULL)
- free (stabbuf);
- return FALSE;
-}
-
-/* Write out the stab section. This is called with the relocated
- contents. */
-
-bfd_boolean
-_bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
- bfd *output_bfd;
- PTR *psinfo;
- asection *stabsec;
- PTR *psecinfo;
- bfd_byte *contents;
-{
- struct stab_info *sinfo;
- struct stab_section_info *secinfo;
- struct stab_excl_list *e;
- bfd_byte *sym, *tosym, *symend;
- bfd_size_type *pstridx;
-
- sinfo = (struct stab_info *) *psinfo;
- secinfo = (struct stab_section_info *) *psecinfo;
-
- if (secinfo == NULL)
- return bfd_set_section_contents (output_bfd, stabsec->output_section,
- contents,
- (file_ptr) stabsec->output_offset,
- stabsec->_raw_size);
-
- /* Handle each N_BINCL entry. */
- for (e = secinfo->excls; e != NULL; e = e->next)
- {
- bfd_byte *excl_sym;
-
- BFD_ASSERT (e->offset < stabsec->_raw_size);
- excl_sym = contents + e->offset;
- bfd_put_32 (output_bfd, e->val, excl_sym + VALOFF);
- excl_sym[TYPEOFF] = e->type;
- }
-
- /* Copy over all the stabs symbols, omitting the ones we don't want,
- and correcting the string indices for those we do want. */
- tosym = contents;
- symend = contents + stabsec->_raw_size;
- for (sym = contents, pstridx = secinfo->stridxs;
- sym < symend;
- sym += STABSIZE, ++pstridx)
- {
- if (*pstridx != (bfd_size_type) -1)
- {
- if (tosym != sym)
- memcpy (tosym, sym, STABSIZE);
- bfd_put_32 (output_bfd, *pstridx, tosym + STRDXOFF);
-
- if (sym[TYPEOFF] == 0)
- {
- /* This is the header symbol for the stabs section. We
- don't really need one, since we have merged all the
- input stabs sections into one, but we generate one
- for the benefit of readers which expect to see one. */
- BFD_ASSERT (sym == contents);
- bfd_put_32 (output_bfd, _bfd_stringtab_size (sinfo->strings),
- tosym + VALOFF);
- bfd_put_16 (output_bfd,
- stabsec->output_section->_raw_size / STABSIZE - 1,
- tosym + DESCOFF);
- }
-
- tosym += STABSIZE;
- }
- }
-
- BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->_cooked_size);
-
- return bfd_set_section_contents (output_bfd, stabsec->output_section,
- contents, (file_ptr) stabsec->output_offset,
- stabsec->_cooked_size);
-}
-
-/* Write out the .stabstr section. */
-
-bfd_boolean
-_bfd_write_stab_strings (output_bfd, psinfo)
- bfd *output_bfd;
- PTR *psinfo;
-{
- struct stab_info *sinfo;
-
- sinfo = (struct stab_info *) *psinfo;
-
- if (sinfo == NULL)
- return TRUE;
-
- if (bfd_is_abs_section (sinfo->stabstr->output_section))
- {
- /* The section was discarded from the link. */
- return TRUE;
- }
-
- BFD_ASSERT ((sinfo->stabstr->output_offset
- + _bfd_stringtab_size (sinfo->strings))
- <= sinfo->stabstr->output_section->_raw_size);
-
- if (bfd_seek (output_bfd,
- (file_ptr) (sinfo->stabstr->output_section->filepos
- + sinfo->stabstr->output_offset),
- SEEK_SET) != 0)
- return FALSE;
-
- if (! _bfd_stringtab_emit (output_bfd, sinfo->strings))
- return FALSE;
-
- /* We no longer need the stabs information. */
- _bfd_stringtab_free (sinfo->strings);
- bfd_hash_table_free (&sinfo->includes.root);
-
- return TRUE;
-}
-
-/* Adjust an address in the .stab section. Given OFFSET within
- STABSEC, this returns the new offset in the adjusted stab section,
- or -1 if the address refers to a stab which has been removed. */
-
-bfd_vma
-_bfd_stab_section_offset (output_bfd, psinfo, stabsec, psecinfo, offset)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- PTR *psinfo ATTRIBUTE_UNUSED;
- asection *stabsec;
- PTR *psecinfo;
- bfd_vma offset;
-{
- struct stab_section_info *secinfo;
-
- secinfo = (struct stab_section_info *) *psecinfo;
-
- if (secinfo == NULL)
- return offset;
-
- if (offset >= stabsec->_raw_size)
- return offset - (stabsec->_cooked_size - stabsec->_raw_size);
-
- if (secinfo->cumulative_skips)
- {
- bfd_vma i;
-
- i = offset / STABSIZE;
-
- if (secinfo->stridxs [i] == (bfd_size_type) -1)
- return (bfd_vma) -1;
-
- return offset - secinfo->cumulative_skips [i];
- }
-
- return offset;
-}
diff --git a/contrib/binutils/bfd/stamp-h.in b/contrib/binutils/bfd/stamp-h.in
deleted file mode 100644
index 9788f70..0000000
--- a/contrib/binutils/bfd/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c
deleted file mode 100644
index 5b1b18b..0000000
--- a/contrib/binutils/bfd/sunos.c
+++ /dev/null
@@ -1,2939 +0,0 @@
-/* BFD backend for SunOS binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGETNAME "a.out-sunos-big"
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (sunos_big_,OP)
-
-#include "bfd.h"
-#include "bfdlink.h"
-#include "libaout.h"
-
-/* Static routines defined in this file. */
-
-static bfd_boolean sunos_read_dynamic_info PARAMS ((bfd *));
-static long sunos_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
-static bfd_boolean sunos_slurp_dynamic_symtab PARAMS ((bfd *));
-static long sunos_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
-static long sunos_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
-static long sunos_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
-static struct bfd_hash_entry *sunos_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *sunos_link_hash_table_create
- PARAMS ((bfd *));
-static bfd_boolean sunos_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean));
-static bfd_boolean sunos_add_dynamic_symbols
- PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **,
- bfd_size_type *, char **));
-static bfd_boolean sunos_add_one_symbol
- PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
-static bfd_boolean sunos_scan_relocs
- PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_size_type));
-static bfd_boolean sunos_scan_std_relocs
- PARAMS ((struct bfd_link_info *, bfd *, asection *,
- const struct reloc_std_external *, bfd_size_type));
-static bfd_boolean sunos_scan_ext_relocs
- PARAMS ((struct bfd_link_info *, bfd *, asection *,
- const struct reloc_ext_external *, bfd_size_type));
-static bfd_boolean sunos_link_dynamic_object
- PARAMS ((struct bfd_link_info *, bfd *));
-static bfd_boolean sunos_write_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *));
-static bfd_boolean sunos_check_dynamic_reloc
- PARAMS ((struct bfd_link_info *, bfd *, asection *,
- struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
- bfd_vma *));
-static bfd_boolean sunos_finish_dynamic_link
- PARAMS ((bfd *, struct bfd_link_info *));
-
-#define MY_get_dynamic_symtab_upper_bound sunos_get_dynamic_symtab_upper_bound
-#define MY_canonicalize_dynamic_symtab sunos_canonicalize_dynamic_symtab
-#define MY_get_dynamic_reloc_upper_bound sunos_get_dynamic_reloc_upper_bound
-#define MY_canonicalize_dynamic_reloc sunos_canonicalize_dynamic_reloc
-#define MY_bfd_link_hash_table_create sunos_link_hash_table_create
-#define MY_add_dynamic_symbols sunos_add_dynamic_symbols
-#define MY_add_one_symbol sunos_add_one_symbol
-#define MY_link_dynamic_object sunos_link_dynamic_object
-#define MY_write_dynamic_symbol sunos_write_dynamic_symbol
-#define MY_check_dynamic_reloc sunos_check_dynamic_reloc
-#define MY_finish_dynamic_link sunos_finish_dynamic_link
-
-/* ??? Where should this go? */
-#define MACHTYPE_OK(mtype) \
- (((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \
- || ((mtype) == M_SPARCLET \
- && bfd_lookup_arch (bfd_arch_sparc, bfd_mach_sparc_sparclet) != NULL) \
- || ((mtype) == M_SPARCLITE_LE \
- && bfd_lookup_arch (bfd_arch_sparc, bfd_mach_sparc_sparclet) != NULL) \
- || (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \
- && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
-
-/* Include the usual a.out support. */
-#include "aoutf1.h"
-
-/* The SunOS 4.1.4 /usr/include/locale.h defines valid as a macro. */
-#undef valid
-
-/* SunOS shared library support. We store a pointer to this structure
- in obj_aout_dynamic_info (abfd). */
-
-struct sunos_dynamic_info
-{
- /* Whether we found any dynamic information. */
- bfd_boolean valid;
- /* Dynamic information. */
- struct internal_sun4_dynamic_link dyninfo;
- /* Number of dynamic symbols. */
- unsigned long dynsym_count;
- /* Read in nlists for dynamic symbols. */
- struct external_nlist *dynsym;
- /* asymbol structures for dynamic symbols. */
- aout_symbol_type *canonical_dynsym;
- /* Read in dynamic string table. */
- char *dynstr;
- /* Number of dynamic relocs. */
- unsigned long dynrel_count;
- /* Read in dynamic relocs. This may be reloc_std_external or
- reloc_ext_external. */
- PTR dynrel;
- /* arelent structures for dynamic relocs. */
- arelent *canonical_dynrel;
-};
-
-/* The hash table of dynamic symbols is composed of two word entries.
- See include/aout/sun4.h for details. */
-
-#define HASH_ENTRY_SIZE (2 * BYTES_IN_WORD)
-
-/* Read in the basic dynamic information. This locates the __DYNAMIC
- structure and uses it to find the dynamic_link structure. It
- creates and saves a sunos_dynamic_info structure. If it can't find
- __DYNAMIC, it sets the valid field of the sunos_dynamic_info
- structure to FALSE to avoid doing this work again. */
-
-static bfd_boolean
-sunos_read_dynamic_info (abfd)
- bfd *abfd;
-{
- struct sunos_dynamic_info *info;
- asection *dynsec;
- bfd_vma dynoff;
- struct external_sun4_dynamic dyninfo;
- unsigned long dynver;
- struct external_sun4_dynamic_link linkinfo;
- bfd_size_type amt;
-
- if (obj_aout_dynamic_info (abfd) != (PTR) NULL)
- return TRUE;
-
- if ((abfd->flags & DYNAMIC) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- amt = sizeof (struct sunos_dynamic_info);
- info = (struct sunos_dynamic_info *) bfd_zalloc (abfd, amt);
- if (!info)
- return FALSE;
- info->valid = FALSE;
- info->dynsym = NULL;
- info->dynstr = NULL;
- info->canonical_dynsym = NULL;
- info->dynrel = NULL;
- info->canonical_dynrel = NULL;
- obj_aout_dynamic_info (abfd) = (PTR) info;
-
- /* This code used to look for the __DYNAMIC symbol to locate the dynamic
- linking information.
- However this inhibits recovering the dynamic symbols from a
- stripped object file, so blindly assume that the dynamic linking
- information is located at the start of the data section.
- We could verify this assumption later by looking through the dynamic
- symbols for the __DYNAMIC symbol. */
- if ((abfd->flags & DYNAMIC) == 0)
- return TRUE;
- if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo,
- (file_ptr) 0,
- (bfd_size_type) sizeof dyninfo))
- return TRUE;
-
- dynver = GET_WORD (abfd, dyninfo.ld_version);
- if (dynver != 2 && dynver != 3)
- return TRUE;
-
- dynoff = GET_WORD (abfd, dyninfo.ld);
-
- /* dynoff is a virtual address. It is probably always in the .data
- section, but this code should work even if it moves. */
- if (dynoff < bfd_get_section_vma (abfd, obj_datasec (abfd)))
- dynsec = obj_textsec (abfd);
- else
- dynsec = obj_datasec (abfd);
- dynoff -= bfd_get_section_vma (abfd, dynsec);
- if (dynoff > bfd_section_size (abfd, dynsec))
- return TRUE;
-
- /* This executable appears to be dynamically linked in a way that we
- can understand. */
- if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo,
- (file_ptr) dynoff,
- (bfd_size_type) sizeof linkinfo))
- return TRUE;
-
- /* Swap in the dynamic link information. */
- info->dyninfo.ld_loaded = GET_WORD (abfd, linkinfo.ld_loaded);
- info->dyninfo.ld_need = GET_WORD (abfd, linkinfo.ld_need);
- info->dyninfo.ld_rules = GET_WORD (abfd, linkinfo.ld_rules);
- info->dyninfo.ld_got = GET_WORD (abfd, linkinfo.ld_got);
- info->dyninfo.ld_plt = GET_WORD (abfd, linkinfo.ld_plt);
- info->dyninfo.ld_rel = GET_WORD (abfd, linkinfo.ld_rel);
- info->dyninfo.ld_hash = GET_WORD (abfd, linkinfo.ld_hash);
- info->dyninfo.ld_stab = GET_WORD (abfd, linkinfo.ld_stab);
- info->dyninfo.ld_stab_hash = GET_WORD (abfd, linkinfo.ld_stab_hash);
- info->dyninfo.ld_buckets = GET_WORD (abfd, linkinfo.ld_buckets);
- info->dyninfo.ld_symbols = GET_WORD (abfd, linkinfo.ld_symbols);
- info->dyninfo.ld_symb_size = GET_WORD (abfd, linkinfo.ld_symb_size);
- info->dyninfo.ld_text = GET_WORD (abfd, linkinfo.ld_text);
- info->dyninfo.ld_plt_sz = GET_WORD (abfd, linkinfo.ld_plt_sz);
-
- /* Reportedly the addresses need to be offset by the size of the
- exec header in an NMAGIC file. */
- if (adata (abfd).magic == n_magic)
- {
- unsigned long exec_bytes_size = adata (abfd).exec_bytes_size;
-
- info->dyninfo.ld_need += exec_bytes_size;
- info->dyninfo.ld_rules += exec_bytes_size;
- info->dyninfo.ld_rel += exec_bytes_size;
- info->dyninfo.ld_hash += exec_bytes_size;
- info->dyninfo.ld_stab += exec_bytes_size;
- info->dyninfo.ld_symbols += exec_bytes_size;
- }
-
- /* The only way to get the size of the symbol information appears to
- be to determine the distance between it and the string table. */
- info->dynsym_count = ((info->dyninfo.ld_symbols - info->dyninfo.ld_stab)
- / EXTERNAL_NLIST_SIZE);
- BFD_ASSERT (info->dynsym_count * EXTERNAL_NLIST_SIZE
- == (unsigned long) (info->dyninfo.ld_symbols
- - info->dyninfo.ld_stab));
-
- /* Similarly, the relocs end at the hash table. */
- info->dynrel_count = ((info->dyninfo.ld_hash - info->dyninfo.ld_rel)
- / obj_reloc_entry_size (abfd));
- BFD_ASSERT (info->dynrel_count * obj_reloc_entry_size (abfd)
- == (unsigned long) (info->dyninfo.ld_hash
- - info->dyninfo.ld_rel));
-
- info->valid = TRUE;
-
- return TRUE;
-}
-
-/* Return the amount of memory required for the dynamic symbols. */
-
-static long
-sunos_get_dynamic_symtab_upper_bound (abfd)
- bfd *abfd;
-{
- struct sunos_dynamic_info *info;
-
- if (! sunos_read_dynamic_info (abfd))
- return -1;
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- return (info->dynsym_count + 1) * sizeof (asymbol *);
-}
-
-/* Read the external dynamic symbols. */
-
-static bfd_boolean
-sunos_slurp_dynamic_symtab (abfd)
- bfd *abfd;
-{
- struct sunos_dynamic_info *info;
- bfd_size_type amt;
-
- /* Get the general dynamic information. */
- if (obj_aout_dynamic_info (abfd) == NULL)
- {
- if (! sunos_read_dynamic_info (abfd))
- return FALSE;
- }
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return FALSE;
- }
-
- /* Get the dynamic nlist structures. */
- if (info->dynsym == (struct external_nlist *) NULL)
- {
- amt = (bfd_size_type) info->dynsym_count * EXTERNAL_NLIST_SIZE;
- info->dynsym = (struct external_nlist *) bfd_alloc (abfd, amt);
- if (info->dynsym == NULL && info->dynsym_count != 0)
- return FALSE;
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_stab, SEEK_SET) != 0
- || bfd_bread ((PTR) info->dynsym, amt, abfd) != amt)
- {
- if (info->dynsym != NULL)
- {
- bfd_release (abfd, info->dynsym);
- info->dynsym = NULL;
- }
- return FALSE;
- }
- }
-
- /* Get the dynamic strings. */
- if (info->dynstr == (char *) NULL)
- {
- amt = info->dyninfo.ld_symb_size;
- info->dynstr = (char *) bfd_alloc (abfd, amt);
- if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0)
- return FALSE;
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_symbols, SEEK_SET) != 0
- || bfd_bread ((PTR) info->dynstr, amt, abfd) != amt)
- {
- if (info->dynstr != NULL)
- {
- bfd_release (abfd, info->dynstr);
- info->dynstr = NULL;
- }
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Read in the dynamic symbols. */
-
-static long
-sunos_canonicalize_dynamic_symtab (abfd, storage)
- bfd *abfd;
- asymbol **storage;
-{
- struct sunos_dynamic_info *info;
- unsigned long i;
-
- if (! sunos_slurp_dynamic_symtab (abfd))
- return -1;
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
-
-#ifdef CHECK_DYNAMIC_HASH
- /* Check my understanding of the dynamic hash table by making sure
- that each symbol can be located in the hash table. */
- {
- bfd_size_type table_size;
- bfd_byte *table;
- bfd_size_type i;
-
- if (info->dyninfo.ld_buckets > info->dynsym_count)
- abort ();
- table_size = info->dyninfo.ld_stab - info->dyninfo.ld_hash;
- table = (bfd_byte *) bfd_malloc (table_size);
- if (table == NULL && table_size != 0)
- abort ();
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_hash, SEEK_SET) != 0
- || bfd_bread ((PTR) table, table_size, abfd) != table_size)
- abort ();
- for (i = 0; i < info->dynsym_count; i++)
- {
- unsigned char *name;
- unsigned long hash;
-
- name = ((unsigned char *) info->dynstr
- + GET_WORD (abfd, info->dynsym[i].e_strx));
- hash = 0;
- while (*name != '\0')
- hash = (hash << 1) + *name++;
- hash &= 0x7fffffff;
- hash %= info->dyninfo.ld_buckets;
- while (GET_WORD (abfd, table + hash * HASH_ENTRY_SIZE) != i)
- {
- hash = GET_WORD (abfd,
- table + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD);
- if (hash == 0 || hash >= table_size / HASH_ENTRY_SIZE)
- abort ();
- }
- }
- free (table);
- }
-#endif /* CHECK_DYNAMIC_HASH */
-
- /* Get the asymbol structures corresponding to the dynamic nlist
- structures. */
- if (info->canonical_dynsym == (aout_symbol_type *) NULL)
- {
- bfd_size_type size;
- bfd_size_type strsize = info->dyninfo.ld_symb_size;
-
- size = (bfd_size_type) info->dynsym_count * sizeof (aout_symbol_type);
- info->canonical_dynsym = (aout_symbol_type *) bfd_alloc (abfd, size);
- if (info->canonical_dynsym == NULL && info->dynsym_count != 0)
- return -1;
-
- if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym,
- info->dynsym,
- (bfd_size_type) info->dynsym_count,
- info->dynstr, strsize, TRUE))
- {
- if (info->canonical_dynsym != NULL)
- {
- bfd_release (abfd, info->canonical_dynsym);
- info->canonical_dynsym = NULL;
- }
- return -1;
- }
- }
-
- /* Return pointers to the dynamic asymbol structures. */
- for (i = 0; i < info->dynsym_count; i++)
- *storage++ = (asymbol *) (info->canonical_dynsym + i);
- *storage = NULL;
-
- return info->dynsym_count;
-}
-
-/* Return the amount of memory required for the dynamic relocs. */
-
-static long
-sunos_get_dynamic_reloc_upper_bound (abfd)
- bfd *abfd;
-{
- struct sunos_dynamic_info *info;
-
- if (! sunos_read_dynamic_info (abfd))
- return -1;
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- return (info->dynrel_count + 1) * sizeof (arelent *);
-}
-
-/* Read in the dynamic relocs. */
-
-static long
-sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
- bfd *abfd;
- arelent **storage;
- asymbol **syms;
-{
- struct sunos_dynamic_info *info;
- unsigned long i;
- bfd_size_type size;
-
- /* Get the general dynamic information. */
- if (obj_aout_dynamic_info (abfd) == (PTR) NULL)
- {
- if (! sunos_read_dynamic_info (abfd))
- return -1;
- }
-
- info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- if (! info->valid)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- /* Get the dynamic reloc information. */
- if (info->dynrel == NULL)
- {
- size = (bfd_size_type) info->dynrel_count * obj_reloc_entry_size (abfd);
- info->dynrel = (PTR) bfd_alloc (abfd, size);
- if (info->dynrel == NULL && size != 0)
- return -1;
- if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_rel, SEEK_SET) != 0
- || bfd_bread ((PTR) info->dynrel, size, abfd) != size)
- {
- if (info->dynrel != NULL)
- {
- bfd_release (abfd, info->dynrel);
- info->dynrel = NULL;
- }
- return -1;
- }
- }
-
- /* Get the arelent structures corresponding to the dynamic reloc
- information. */
- if (info->canonical_dynrel == (arelent *) NULL)
- {
- arelent *to;
-
- size = (bfd_size_type) info->dynrel_count * sizeof (arelent);
- info->canonical_dynrel = (arelent *) bfd_alloc (abfd, size);
- if (info->canonical_dynrel == NULL && info->dynrel_count != 0)
- return -1;
-
- to = info->canonical_dynrel;
-
- if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE)
- {
- register struct reloc_ext_external *p;
- struct reloc_ext_external *pend;
-
- p = (struct reloc_ext_external *) info->dynrel;
- pend = p + info->dynrel_count;
- for (; p < pend; p++, to++)
- NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms,
- (bfd_size_type) info->dynsym_count);
- }
- else
- {
- register struct reloc_std_external *p;
- struct reloc_std_external *pend;
-
- p = (struct reloc_std_external *) info->dynrel;
- pend = p + info->dynrel_count;
- for (; p < pend; p++, to++)
- NAME(aout,swap_std_reloc_in) (abfd, p, to, syms,
- (bfd_size_type) info->dynsym_count);
- }
- }
-
- /* Return pointers to the dynamic arelent structures. */
- for (i = 0; i < info->dynrel_count; i++)
- *storage++ = info->canonical_dynrel + i;
- *storage = NULL;
-
- return info->dynrel_count;
-}
-
-/* Code to handle linking of SunOS shared libraries. */
-
-/* A SPARC procedure linkage table entry is 12 bytes. The first entry
- in the table is a jump which is filled in by the runtime linker.
- The remaining entries are branches back to the first entry,
- followed by an index into the relocation table encoded to look like
- a sethi of %g0. */
-
-#define SPARC_PLT_ENTRY_SIZE (12)
-
-static const bfd_byte sparc_plt_first_entry[SPARC_PLT_ENTRY_SIZE] =
-{
- /* sethi %hi(0),%g1; address filled in by runtime linker. */
- 0x3, 0, 0, 0,
- /* jmp %g1; offset filled in by runtime linker. */
- 0x81, 0xc0, 0x60, 0,
- /* nop */
- 0x1, 0, 0, 0
-};
-
-/* save %sp, -96, %sp */
-#define SPARC_PLT_ENTRY_WORD0 ((bfd_vma) 0x9de3bfa0)
-/* call; address filled in later. */
-#define SPARC_PLT_ENTRY_WORD1 ((bfd_vma) 0x40000000)
-/* sethi; reloc index filled in later. */
-#define SPARC_PLT_ENTRY_WORD2 ((bfd_vma) 0x01000000)
-
-/* This sequence is used when for the jump table entry to a defined
- symbol in a complete executable. It is used when linking PIC
- compiled code which is not being put into a shared library. */
-/* sethi <address to be filled in later>, %g1 */
-#define SPARC_PLT_PIC_WORD0 ((bfd_vma) 0x03000000)
-/* jmp %g1 + <address to be filled in later> */
-#define SPARC_PLT_PIC_WORD1 ((bfd_vma) 0x81c06000)
-/* nop */
-#define SPARC_PLT_PIC_WORD2 ((bfd_vma) 0x01000000)
-
-/* An m68k procedure linkage table entry is 8 bytes. The first entry
- in the table is a jump which is filled in the by the runtime
- linker. The remaining entries are branches back to the first
- entry, followed by a two byte index into the relocation table. */
-
-#define M68K_PLT_ENTRY_SIZE (8)
-
-static const bfd_byte m68k_plt_first_entry[M68K_PLT_ENTRY_SIZE] =
-{
- /* jmps @# */
- 0x4e, 0xf9,
- /* Filled in by runtime linker with a magic address. */
- 0, 0, 0, 0,
- /* Not used? */
- 0, 0
-};
-
-/* bsrl */
-#define M68K_PLT_ENTRY_WORD0 ((bfd_vma) 0x61ff)
-/* Remaining words filled in later. */
-
-/* An entry in the SunOS linker hash table. */
-
-struct sunos_link_hash_entry
-{
- struct aout_link_hash_entry root;
-
- /* If this is a dynamic symbol, this is its index into the dynamic
- symbol table. This is initialized to -1. As the linker looks at
- the input files, it changes this to -2 if it will be added to the
- dynamic symbol table. After all the input files have been seen,
- the linker will know whether to build a dynamic symbol table; if
- it does build one, this becomes the index into the table. */
- long dynindx;
-
- /* If this is a dynamic symbol, this is the index of the name in the
- dynamic symbol string table. */
- long dynstr_index;
-
- /* The offset into the global offset table used for this symbol. If
- the symbol does not require a GOT entry, this is 0. */
- bfd_vma got_offset;
-
- /* The offset into the procedure linkage table used for this symbol.
- If the symbol does not require a PLT entry, this is 0. */
- bfd_vma plt_offset;
-
- /* Some linker flags. */
- unsigned char flags;
- /* Symbol is referenced by a regular object. */
-#define SUNOS_REF_REGULAR 01
- /* Symbol is defined by a regular object. */
-#define SUNOS_DEF_REGULAR 02
- /* Symbol is referenced by a dynamic object. */
-#define SUNOS_REF_DYNAMIC 04
- /* Symbol is defined by a dynamic object. */
-#define SUNOS_DEF_DYNAMIC 010
- /* Symbol is a constructor symbol in a regular object. */
-#define SUNOS_CONSTRUCTOR 020
-};
-
-/* The SunOS linker hash table. */
-
-struct sunos_link_hash_table
-{
- struct aout_link_hash_table root;
-
- /* The object which holds the dynamic sections. */
- bfd *dynobj;
-
- /* Whether we have created the dynamic sections. */
- bfd_boolean dynamic_sections_created;
-
- /* Whether we need the dynamic sections. */
- bfd_boolean dynamic_sections_needed;
-
- /* Whether we need the .got table. */
- bfd_boolean got_needed;
-
- /* The number of dynamic symbols. */
- size_t dynsymcount;
-
- /* The number of buckets in the hash table. */
- size_t bucketcount;
-
- /* The list of dynamic objects needed by dynamic objects included in
- the link. */
- struct bfd_link_needed_list *needed;
-
- /* The offset of __GLOBAL_OFFSET_TABLE_ into the .got section. */
- bfd_vma got_base;
-};
-
-/* Routine to create an entry in an SunOS link hash table. */
-
-static struct bfd_hash_entry *
-sunos_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct sunos_link_hash_entry *ret = (struct sunos_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct sunos_link_hash_entry *) NULL)
- ret = ((struct sunos_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct sunos_link_hash_entry)));
- if (ret == (struct sunos_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct sunos_link_hash_entry *)
- NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- /* Set local fields. */
- ret->dynindx = -1;
- ret->dynstr_index = -1;
- ret->got_offset = 0;
- ret->plt_offset = 0;
- ret->flags = 0;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create a SunOS link hash table. */
-
-static struct bfd_link_hash_table *
-sunos_link_hash_table_create (abfd)
- bfd *abfd;
-{
- struct sunos_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct sunos_link_hash_table);
-
- ret = (struct sunos_link_hash_table *) bfd_malloc (amt);
- if (ret == (struct sunos_link_hash_table *) NULL)
- return (struct bfd_link_hash_table *) NULL;
- if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
- sunos_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
-
- ret->dynobj = NULL;
- ret->dynamic_sections_created = FALSE;
- ret->dynamic_sections_needed = FALSE;
- ret->got_needed = FALSE;
- ret->dynsymcount = 0;
- ret->bucketcount = 0;
- ret->needed = NULL;
- ret->got_base = 0;
-
- return &ret->root.root;
-}
-
-/* Look up an entry in an SunOS link hash table. */
-
-#define sunos_link_hash_lookup(table, string, create, copy, follow) \
- ((struct sunos_link_hash_entry *) \
- aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
-
-/* Traverse a SunOS link hash table. */
-
-#define sunos_link_hash_traverse(table, func, info) \
- (aout_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the SunOS link hash table from the info structure. This is
- just a cast. */
-
-#define sunos_hash_table(p) ((struct sunos_link_hash_table *) ((p)->hash))
-
-static bfd_boolean sunos_scan_dynamic_symbol
- PARAMS ((struct sunos_link_hash_entry *, PTR));
-
-/* Create the dynamic sections needed if we are linking against a
- dynamic object, or if we are linking PIC compiled code. ABFD is a
- bfd we can attach the dynamic sections to. The linker script will
- look for these special sections names and put them in the right
- place in the output file. See include/aout/sun4.h for more details
- of the dynamic linking information. */
-
-static bfd_boolean
-sunos_create_dynamic_sections (abfd, info, needed)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean needed;
-{
- asection *s;
-
- if (! sunos_hash_table (info)->dynamic_sections_created)
- {
- flagword flags;
-
- sunos_hash_table (info)->dynobj = abfd;
-
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
-
- /* The .dynamic section holds the basic dynamic information: the
- sun4_dynamic structure, the dynamic debugger information, and
- the sun4_dynamic_link structure. */
- s = bfd_make_section (abfd, ".dynamic");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .got section holds the global offset table. The address
- is put in the ld_got field. */
- s = bfd_make_section (abfd, ".got");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .plt section holds the procedure linkage table. The
- address is put in the ld_plt field. */
- s = bfd_make_section (abfd, ".plt");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .dynrel section holds the dynamic relocs. The address is
- put in the ld_rel field. */
- s = bfd_make_section (abfd, ".dynrel");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .hash section holds the dynamic hash table. The address
- is put in the ld_hash field. */
- s = bfd_make_section (abfd, ".hash");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .dynsym section holds the dynamic symbols. The address
- is put in the ld_stab field. */
- s = bfd_make_section (abfd, ".dynsym");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- /* The .dynstr section holds the dynamic symbol string table.
- The address is put in the ld_symbols field. */
- s = bfd_make_section (abfd, ".dynstr");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
-
- sunos_hash_table (info)->dynamic_sections_created = TRUE;
- }
-
- if ((needed && ! sunos_hash_table (info)->dynamic_sections_needed)
- || info->shared)
- {
- bfd *dynobj;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- s = bfd_get_section_by_name (dynobj, ".got");
- if (s->_raw_size == 0)
- s->_raw_size = BYTES_IN_WORD;
-
- sunos_hash_table (info)->dynamic_sections_needed = TRUE;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- return TRUE;
-}
-
-/* Add dynamic symbols during a link. This is called by the a.out
- backend linker for each object it encounters. */
-
-static bfd_boolean
-sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
- bfd *abfd;
- struct bfd_link_info *info;
- struct external_nlist **symsp;
- bfd_size_type *sym_countp;
- char **stringsp;
-{
- bfd *dynobj;
- struct sunos_dynamic_info *dinfo;
- unsigned long need;
- asection **ps;
-
- /* Make sure we have all the required sections. */
- if (info->hash->creator == abfd->xvec)
- {
- if (! sunos_create_dynamic_sections (abfd, info,
- ((abfd->flags & DYNAMIC) != 0
- && !info->relocatable)))
- return FALSE;
- }
-
- /* There is nothing else to do for a normal object. */
- if ((abfd->flags & DYNAMIC) == 0)
- return TRUE;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- /* We do not want to include the sections in a dynamic object in the
- output file. We hack by simply clobbering the list of sections
- in the BFD. This could be handled more cleanly by, say, a new
- section flag; the existing SEC_NEVER_LOAD flag is not the one we
- want, because that one still implies that the section takes up
- space in the output file. If this is the first object we have
- seen, we must preserve the dynamic sections we just created. */
- for (ps = &abfd->sections; *ps != NULL; )
- {
- if (abfd != dynobj || ((*ps)->flags & SEC_LINKER_CREATED) == 0)
- bfd_section_list_remove (abfd, ps);
- else
- ps = &(*ps)->next;
- }
-
- /* The native linker seems to just ignore dynamic objects when -r is
- used. */
- if (info->relocatable)
- return TRUE;
-
- /* There's no hope of using a dynamic object which does not exactly
- match the format of the output file. */
- if (info->hash->creator != abfd->xvec)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- /* Make sure we have a .need and a .rules sections. These are only
- needed if there really is a dynamic object in the link, so they
- are not added by sunos_create_dynamic_sections. */
- if (bfd_get_section_by_name (dynobj, ".need") == NULL)
- {
- /* The .need section holds the list of names of shared objets
- which must be included at runtime. The address of this
- section is put in the ld_need field. */
- asection *s = bfd_make_section (dynobj, ".need");
- if (s == NULL
- || ! bfd_set_section_flags (dynobj, s,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, s, 2))
- return FALSE;
- }
-
- if (bfd_get_section_by_name (dynobj, ".rules") == NULL)
- {
- /* The .rules section holds the path to search for shared
- objects. The address of this section is put in the ld_rules
- field. */
- asection *s = bfd_make_section (dynobj, ".rules");
- if (s == NULL
- || ! bfd_set_section_flags (dynobj, s,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, s, 2))
- return FALSE;
- }
-
- /* Pick up the dynamic symbols and return them to the caller. */
- if (! sunos_slurp_dynamic_symtab (abfd))
- return FALSE;
-
- dinfo = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
- *symsp = dinfo->dynsym;
- *sym_countp = dinfo->dynsym_count;
- *stringsp = dinfo->dynstr;
-
- /* Record information about any other objects needed by this one. */
- need = dinfo->dyninfo.ld_need;
- while (need != 0)
- {
- bfd_byte buf[16];
- unsigned long name, flags;
- unsigned short major_vno, minor_vno;
- struct bfd_link_needed_list *needed, **pp;
- char *namebuf, *p;
- bfd_size_type alc;
- bfd_byte b;
- char *namecopy;
-
- if (bfd_seek (abfd, (file_ptr) need, SEEK_SET) != 0
- || bfd_bread (buf, (bfd_size_type) 16, abfd) != 16)
- return FALSE;
-
- /* For the format of an ld_need entry, see aout/sun4.h. We
- should probably define structs for this manipulation. */
-
- name = bfd_get_32 (abfd, buf);
- flags = bfd_get_32 (abfd, buf + 4);
- major_vno = (unsigned short) bfd_get_16 (abfd, buf + 8);
- minor_vno = (unsigned short) bfd_get_16 (abfd, buf + 10);
- need = bfd_get_32 (abfd, buf + 12);
-
- alc = sizeof (struct bfd_link_needed_list);
- needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, alc);
- if (needed == NULL)
- return FALSE;
- needed->by = abfd;
-
- /* We return the name as [-l]name[.maj][.min]. */
- alc = 30;
- namebuf = (char *) bfd_malloc (alc + 1);
- if (namebuf == NULL)
- return FALSE;
- p = namebuf;
-
- if ((flags & 0x80000000) != 0)
- {
- *p++ = '-';
- *p++ = 'l';
- }
- if (bfd_seek (abfd, (file_ptr) name, SEEK_SET) != 0)
- {
- free (namebuf);
- return FALSE;
- }
-
- do
- {
- if (bfd_bread (&b, (bfd_size_type) 1, abfd) != 1)
- {
- free (namebuf);
- return FALSE;
- }
-
- if ((bfd_size_type) (p - namebuf) >= alc)
- {
- char *n;
-
- alc *= 2;
- n = (char *) bfd_realloc (namebuf, alc + 1);
- if (n == NULL)
- {
- free (namebuf);
- return FALSE;
- }
- p = n + (p - namebuf);
- namebuf = n;
- }
-
- *p++ = b;
- }
- while (b != '\0');
-
- if (major_vno == 0)
- *p = '\0';
- else
- {
- char majbuf[30];
- char minbuf[30];
-
- sprintf (majbuf, ".%d", major_vno);
- if (minor_vno == 0)
- minbuf[0] = '\0';
- else
- sprintf (minbuf, ".%d", minor_vno);
-
- if ((p - namebuf) + strlen (majbuf) + strlen (minbuf) >= alc)
- {
- char *n;
-
- alc = (p - namebuf) + strlen (majbuf) + strlen (minbuf);
- n = (char *) bfd_realloc (namebuf, alc + 1);
- if (n == NULL)
- {
- free (namebuf);
- return FALSE;
- }
- p = n + (p - namebuf);
- namebuf = n;
- }
-
- strcpy (p, majbuf);
- strcat (p, minbuf);
- }
-
- namecopy = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1);
- if (namecopy == NULL)
- {
- free (namebuf);
- return FALSE;
- }
- strcpy (namecopy, namebuf);
- free (namebuf);
- needed->name = namecopy;
-
- needed->next = NULL;
-
- for (pp = &sunos_hash_table (info)->needed;
- *pp != NULL;
- pp = &(*pp)->next)
- ;
- *pp = needed;
- }
-
- return TRUE;
-}
-
-/* Function to add a single symbol to the linker hash table. This is
- a wrapper around _bfd_generic_link_add_one_symbol which handles the
- tweaking needed for dynamic linking support. */
-
-static bfd_boolean
-sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
- copy, collect, hashp)
- struct bfd_link_info *info;
- bfd *abfd;
- const char *name;
- flagword flags;
- asection *section;
- bfd_vma value;
- const char *string;
- bfd_boolean copy;
- bfd_boolean collect;
- struct bfd_link_hash_entry **hashp;
-{
- struct sunos_link_hash_entry *h;
- int new_flag;
-
- if ((flags & (BSF_INDIRECT | BSF_WARNING | BSF_CONSTRUCTOR)) != 0
- || ! bfd_is_und_section (section))
- h = sunos_link_hash_lookup (sunos_hash_table (info), name, TRUE, copy,
- FALSE);
- else
- h = ((struct sunos_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, copy, FALSE));
- if (h == NULL)
- return FALSE;
-
- if (hashp != NULL)
- *hashp = (struct bfd_link_hash_entry *) h;
-
- /* Treat a common symbol in a dynamic object as defined in the .bss
- section of the dynamic object. We don't want to allocate space
- for it in our process image. */
- if ((abfd->flags & DYNAMIC) != 0
- && bfd_is_com_section (section))
- section = obj_bsssec (abfd);
-
- if (! bfd_is_und_section (section)
- && h->root.root.type != bfd_link_hash_new
- && h->root.root.type != bfd_link_hash_undefined
- && h->root.root.type != bfd_link_hash_defweak)
- {
- /* We are defining the symbol, and it is already defined. This
- is a potential multiple definition error. */
- if ((abfd->flags & DYNAMIC) != 0)
- {
- /* The definition we are adding is from a dynamic object.
- We do not want this new definition to override the
- existing definition, so we pretend it is just a
- reference. */
- section = bfd_und_section_ptr;
- }
- else if (h->root.root.type == bfd_link_hash_defined
- && h->root.root.u.def.section->owner != NULL
- && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0)
- {
- /* The existing definition is from a dynamic object. We
- want to override it with the definition we just found.
- Clobber the existing definition. */
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = h->root.root.u.def.section->owner;
- }
- else if (h->root.root.type == bfd_link_hash_common
- && (h->root.root.u.c.p->section->owner->flags & DYNAMIC) != 0)
- {
- /* The existing definition is from a dynamic object. We
- want to override it with the definition we just found.
- Clobber the existing definition. We can't set it to new,
- because it is on the undefined list. */
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = h->root.root.u.c.p->section->owner;
- }
- }
-
- if ((abfd->flags & DYNAMIC) != 0
- && abfd->xvec == info->hash->creator
- && (h->flags & SUNOS_CONSTRUCTOR) != 0)
- {
- /* The existing symbol is a constructor symbol, and this symbol
- is from a dynamic object. A constructor symbol is actually a
- definition, although the type will be bfd_link_hash_undefined
- at this point. We want to ignore the definition from the
- dynamic object. */
- section = bfd_und_section_ptr;
- }
- else if ((flags & BSF_CONSTRUCTOR) != 0
- && (abfd->flags & DYNAMIC) == 0
- && h->root.root.type == bfd_link_hash_defined
- && h->root.root.u.def.section->owner != NULL
- && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0)
- {
- /* The existing symbol is defined by a dynamic object, and this
- is a constructor symbol. As above, we want to force the use
- of the constructor symbol from the regular object. */
- h->root.root.type = bfd_link_hash_new;
- }
-
- /* Do the usual procedure for adding a symbol. */
- if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
- value, string, copy, collect,
- hashp))
- return FALSE;
-
- if (abfd->xvec == info->hash->creator)
- {
- /* Set a flag in the hash table entry indicating the type of
- reference or definition we just found. Keep a count of the
- number of dynamic symbols we find. A dynamic symbol is one
- which is referenced or defined by both a regular object and a
- shared object. */
- if ((abfd->flags & DYNAMIC) == 0)
- {
- if (bfd_is_und_section (section))
- new_flag = SUNOS_REF_REGULAR;
- else
- new_flag = SUNOS_DEF_REGULAR;
- }
- else
- {
- if (bfd_is_und_section (section))
- new_flag = SUNOS_REF_DYNAMIC;
- else
- new_flag = SUNOS_DEF_DYNAMIC;
- }
- h->flags |= new_flag;
-
- if (h->dynindx == -1
- && (h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0)
- {
- ++sunos_hash_table (info)->dynsymcount;
- h->dynindx = -2;
- }
-
- if ((flags & BSF_CONSTRUCTOR) != 0
- && (abfd->flags & DYNAMIC) == 0)
- h->flags |= SUNOS_CONSTRUCTOR;
- }
-
- return TRUE;
-}
-
-/* Return the list of objects needed by BFD. */
-
-struct bfd_link_needed_list *
-bfd_sunos_get_needed_list (abfd, info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
-{
- if (info->hash->creator != &MY(vec))
- return NULL;
- return sunos_hash_table (info)->needed;
-}
-
-/* Record an assignment made to a symbol by a linker script. We need
- this in case some dynamic object refers to this symbol. */
-
-bfd_boolean
-bfd_sunos_record_link_assignment (output_bfd, info, name)
- bfd *output_bfd;
- struct bfd_link_info *info;
- const char *name;
-{
- struct sunos_link_hash_entry *h;
-
- if (output_bfd->xvec != &MY(vec))
- return TRUE;
-
- /* This is called after we have examined all the input objects. If
- the symbol does not exist, it merely means that no object refers
- to it, and we can just ignore it at this point. */
- h = sunos_link_hash_lookup (sunos_hash_table (info), name,
- FALSE, FALSE, FALSE);
- if (h == NULL)
- return TRUE;
-
- /* In a shared library, the __DYNAMIC symbol does not appear in the
- dynamic symbol table. */
- if (! info->shared || strcmp (name, "__DYNAMIC") != 0)
- {
- h->flags |= SUNOS_DEF_REGULAR;
-
- if (h->dynindx == -1)
- {
- ++sunos_hash_table (info)->dynsymcount;
- h->dynindx = -2;
- }
- }
-
- return TRUE;
-}
-
-/* Set up the sizes and contents of the dynamic sections created in
- sunos_add_dynamic_symbols. This is called by the SunOS linker
- emulation before_allocation routine. We must set the sizes of the
- sections before the linker sets the addresses of the various
- sections. This unfortunately requires reading all the relocs so
- that we can work out which ones need to become dynamic relocs. If
- info->keep_memory is TRUE, we keep the relocs in memory; otherwise,
- we discard them, and will read them again later. */
-
-bfd_boolean
-bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
- srulesptr)
- bfd *output_bfd;
- struct bfd_link_info *info;
- asection **sdynptr;
- asection **sneedptr;
- asection **srulesptr;
-{
- bfd *dynobj;
- bfd_size_type dynsymcount;
- struct sunos_link_hash_entry *h;
- asection *s;
- size_t bucketcount;
- bfd_size_type hashalloc;
- size_t i;
- bfd *sub;
-
- *sdynptr = NULL;
- *sneedptr = NULL;
- *srulesptr = NULL;
-
- if (info->relocatable)
- return TRUE;
-
- if (output_bfd->xvec != &MY(vec))
- return TRUE;
-
- /* Look through all the input BFD's and read their relocs. It would
- be better if we didn't have to do this, but there is no other way
- to determine the number of dynamic relocs we need, and, more
- importantly, there is no other way to know which symbols should
- get an entry in the procedure linkage table. */
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- if ((sub->flags & DYNAMIC) == 0
- && sub->xvec == output_bfd->xvec)
- {
- if (! sunos_scan_relocs (info, sub, obj_textsec (sub),
- exec_hdr (sub)->a_trsize)
- || ! sunos_scan_relocs (info, sub, obj_datasec (sub),
- exec_hdr (sub)->a_drsize))
- return FALSE;
- }
- }
-
- dynobj = sunos_hash_table (info)->dynobj;
- dynsymcount = sunos_hash_table (info)->dynsymcount;
-
- /* If there were no dynamic objects in the link, and we don't need
- to build a global offset table, there is nothing to do here. */
- if (! sunos_hash_table (info)->dynamic_sections_needed
- && ! sunos_hash_table (info)->got_needed)
- return TRUE;
-
- /* If __GLOBAL_OFFSET_TABLE_ was mentioned, define it. */
- h = sunos_link_hash_lookup (sunos_hash_table (info),
- "__GLOBAL_OFFSET_TABLE_", FALSE, FALSE, FALSE);
- if (h != NULL && (h->flags & SUNOS_REF_REGULAR) != 0)
- {
- h->flags |= SUNOS_DEF_REGULAR;
- if (h->dynindx == -1)
- {
- ++sunos_hash_table (info)->dynsymcount;
- h->dynindx = -2;
- }
- h->root.root.type = bfd_link_hash_defined;
- h->root.root.u.def.section = bfd_get_section_by_name (dynobj, ".got");
-
- /* If the .got section is more than 0x1000 bytes, we set
- __GLOBAL_OFFSET_TABLE_ to be 0x1000 bytes into the section,
- so that 13 bit relocations have a greater chance of working. */
- s = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (s != NULL);
- if (s->_raw_size >= 0x1000)
- h->root.root.u.def.value = 0x1000;
- else
- h->root.root.u.def.value = 0;
-
- sunos_hash_table (info)->got_base = h->root.root.u.def.value;
- }
-
- /* If there are any shared objects in the link, then we need to set
- up the dynamic linking information. */
- if (sunos_hash_table (info)->dynamic_sections_needed)
- {
- *sdynptr = bfd_get_section_by_name (dynobj, ".dynamic");
-
- /* The .dynamic section is always the same size. */
- s = *sdynptr;
- BFD_ASSERT (s != NULL);
- s->_raw_size = (sizeof (struct external_sun4_dynamic)
- + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE
- + sizeof (struct external_sun4_dynamic_link));
-
- /* Set the size of the .dynsym and .hash sections. We counted
- the number of dynamic symbols as we read the input files. We
- will build the dynamic symbol table (.dynsym) and the hash
- table (.hash) when we build the final symbol table, because
- until then we do not know the correct value to give the
- symbols. We build the dynamic symbol string table (.dynstr)
- in a traversal of the symbol table using
- sunos_scan_dynamic_symbol. */
- s = bfd_get_section_by_name (dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- s->_raw_size = dynsymcount * sizeof (struct external_nlist);
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
- return FALSE;
-
- /* The number of buckets is just the number of symbols divided
- by four. To compute the final size of the hash table, we
- must actually compute the hash table. Normally we need
- exactly as many entries in the hash table as there are
- dynamic symbols, but if some of the buckets are not used we
- will need additional entries. In the worst case, every
- symbol will hash to the same bucket, and we will need
- BUCKETCOUNT - 1 extra entries. */
- if (dynsymcount >= 4)
- bucketcount = dynsymcount / 4;
- else if (dynsymcount > 0)
- bucketcount = dynsymcount;
- else
- bucketcount = 1;
- s = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
- hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, hashalloc);
- if (s->contents == NULL && dynsymcount > 0)
- return FALSE;
- for (i = 0; i < bucketcount; i++)
- PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
- s->_raw_size = bucketcount * HASH_ENTRY_SIZE;
-
- sunos_hash_table (info)->bucketcount = bucketcount;
-
- /* Scan all the symbols, place them in the dynamic symbol table,
- and build the dynamic hash table. We reuse dynsymcount as a
- counter for the number of symbols we have added so far. */
- sunos_hash_table (info)->dynsymcount = 0;
- sunos_link_hash_traverse (sunos_hash_table (info),
- sunos_scan_dynamic_symbol,
- (PTR) info);
- BFD_ASSERT (sunos_hash_table (info)->dynsymcount == dynsymcount);
-
- /* The SunOS native linker seems to align the total size of the
- symbol strings to a multiple of 8. I don't know if this is
- important, but it can't hurt much. */
- s = bfd_get_section_by_name (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
- if ((s->_raw_size & 7) != 0)
- {
- bfd_size_type add;
- bfd_byte *contents;
-
- add = 8 - (s->_raw_size & 7);
- contents = (bfd_byte *) bfd_realloc (s->contents,
- s->_raw_size + add);
- if (contents == NULL)
- return FALSE;
- memset (contents + s->_raw_size, 0, (size_t) add);
- s->contents = contents;
- s->_raw_size += add;
- }
- }
-
- /* Now that we have worked out the sizes of the procedure linkage
- table and the dynamic relocs, allocate storage for them. */
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
- if (s->_raw_size != 0)
- {
- s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
-
- /* Fill in the first entry in the table. */
- switch (bfd_get_arch (dynobj))
- {
- case bfd_arch_sparc:
- memcpy (s->contents, sparc_plt_first_entry, SPARC_PLT_ENTRY_SIZE);
- break;
-
- case bfd_arch_m68k:
- memcpy (s->contents, m68k_plt_first_entry, M68K_PLT_ENTRY_SIZE);
- break;
-
- default:
- abort ();
- }
- }
-
- s = bfd_get_section_by_name (dynobj, ".dynrel");
- if (s->_raw_size != 0)
- {
- s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
- }
- /* We use the reloc_count field to keep track of how many of the
- relocs we have output so far. */
- s->reloc_count = 0;
-
- /* Make space for the global offset table. */
- s = bfd_get_section_by_name (dynobj, ".got");
- s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
-
- *sneedptr = bfd_get_section_by_name (dynobj, ".need");
- *srulesptr = bfd_get_section_by_name (dynobj, ".rules");
-
- return TRUE;
-}
-
-/* Scan the relocs for an input section. */
-
-static bfd_boolean
-sunos_scan_relocs (info, abfd, sec, rel_size)
- struct bfd_link_info *info;
- bfd *abfd;
- asection *sec;
- bfd_size_type rel_size;
-{
- PTR relocs;
- PTR free_relocs = NULL;
-
- if (rel_size == 0)
- return TRUE;
-
- if (! info->keep_memory)
- relocs = free_relocs = bfd_malloc (rel_size);
- else
- {
- struct aout_section_data_struct *n;
- bfd_size_type amt = sizeof (struct aout_section_data_struct);
-
- n = (struct aout_section_data_struct *) bfd_alloc (abfd, amt);
- if (n == NULL)
- relocs = NULL;
- else
- {
- set_aout_section_data (sec, n);
- relocs = bfd_malloc (rel_size);
- aout_section_data (sec)->relocs = relocs;
- }
- }
- if (relocs == NULL)
- return FALSE;
-
- if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
- || bfd_bread (relocs, rel_size, abfd) != rel_size)
- goto error_return;
-
- if (obj_reloc_entry_size (abfd) == RELOC_STD_SIZE)
- {
- if (! sunos_scan_std_relocs (info, abfd, sec,
- (struct reloc_std_external *) relocs,
- rel_size))
- goto error_return;
- }
- else
- {
- if (! sunos_scan_ext_relocs (info, abfd, sec,
- (struct reloc_ext_external *) relocs,
- rel_size))
- goto error_return;
- }
-
- if (free_relocs != NULL)
- free (free_relocs);
-
- return TRUE;
-
- error_return:
- if (free_relocs != NULL)
- free (free_relocs);
- return FALSE;
-}
-
-/* Scan the relocs for an input section using standard relocs. We
- need to figure out what to do for each reloc against a dynamic
- symbol. If the symbol is in the .text section, an entry is made in
- the procedure linkage table. Note that this will do the wrong
- thing if the symbol is actually data; I don't think the Sun 3
- native linker handles this case correctly either. If the symbol is
- not in the .text section, we must preserve the reloc as a dynamic
- reloc. FIXME: We should also handle the PIC relocs here by
- building global offset table entries. */
-
-static bfd_boolean
-sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
- struct bfd_link_info *info;
- bfd *abfd;
- asection *sec ATTRIBUTE_UNUSED;
- const struct reloc_std_external *relocs;
- bfd_size_type rel_size;
-{
- bfd *dynobj;
- asection *splt = NULL;
- asection *srel = NULL;
- struct sunos_link_hash_entry **sym_hashes;
- const struct reloc_std_external *rel, *relend;
-
- /* We only know how to handle m68k plt entries. */
- if (bfd_get_arch (abfd) != bfd_arch_m68k)
- {
- bfd_set_error (bfd_error_invalid_target);
- return FALSE;
- }
-
- dynobj = NULL;
-
- sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd);
-
- relend = relocs + rel_size / RELOC_STD_SIZE;
- for (rel = relocs; rel < relend; rel++)
- {
- int r_index;
- struct sunos_link_hash_entry *h;
-
- /* We only want relocs against external symbols. */
- if (bfd_header_big_endian (abfd))
- {
- if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG) == 0)
- continue;
- }
- else
- {
- if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE) == 0)
- continue;
- }
-
- /* Get the symbol index. */
- if (bfd_header_big_endian (abfd))
- r_index = ((rel->r_index[0] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[2]);
- else
- r_index = ((rel->r_index[2] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[0]);
-
- /* Get the hash table entry. */
- h = sym_hashes[r_index];
- if (h == NULL)
- {
- /* This should not normally happen, but it will in any case
- be caught in the relocation phase. */
- continue;
- }
-
- /* At this point common symbols have already been allocated, so
- we don't have to worry about them. We need to consider that
- we may have already seen this symbol and marked it undefined;
- if the symbol is really undefined, then SUNOS_DEF_DYNAMIC
- will be zero. */
- if (h->root.root.type != bfd_link_hash_defined
- && h->root.root.type != bfd_link_hash_defweak
- && h->root.root.type != bfd_link_hash_undefined)
- continue;
-
- if ((h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->flags & SUNOS_DEF_REGULAR) != 0)
- continue;
-
- if (dynobj == NULL)
- {
- asection *sgot;
-
- if (! sunos_create_dynamic_sections (abfd, info, FALSE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_section_by_name (dynobj, ".plt");
- srel = bfd_get_section_by_name (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && srel != NULL);
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- if (sgot->_raw_size == 0)
- sgot->_raw_size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0);
- BFD_ASSERT (h->plt_offset != 0
- || ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- ? (h->root.root.u.def.section->owner->flags
- & DYNAMIC) != 0
- : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0));
-
- /* This reloc is against a symbol defined only by a dynamic
- object. */
-
- if (h->root.root.type == bfd_link_hash_undefined)
- {
- /* Presumably this symbol was marked as being undefined by
- an earlier reloc. */
- srel->_raw_size += RELOC_STD_SIZE;
- }
- else if ((h->root.root.u.def.section->flags & SEC_CODE) == 0)
- {
- bfd *sub;
-
- /* This reloc is not in the .text section. It must be
- copied into the dynamic relocs. We mark the symbol as
- being undefined. */
- srel->_raw_size += RELOC_STD_SIZE;
- sub = h->root.root.u.def.section->owner;
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = sub;
- }
- else
- {
- /* This symbol is in the .text section. We must give it an
- entry in the procedure linkage table, if we have not
- already done so. We change the definition of the symbol
- to the .plt section; this will cause relocs against it to
- be handled correctly. */
- if (h->plt_offset == 0)
- {
- if (splt->_raw_size == 0)
- splt->_raw_size = M68K_PLT_ENTRY_SIZE;
- h->plt_offset = splt->_raw_size;
-
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- h->root.root.u.def.section = splt;
- h->root.root.u.def.value = splt->_raw_size;
- }
-
- splt->_raw_size += M68K_PLT_ENTRY_SIZE;
-
- /* We may also need a dynamic reloc entry. */
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- srel->_raw_size += RELOC_STD_SIZE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Scan the relocs for an input section using extended relocs. We
- need to figure out what to do for each reloc against a dynamic
- symbol. If the reloc is a WDISP30, and the symbol is in the .text
- section, an entry is made in the procedure linkage table.
- Otherwise, we must preserve the reloc as a dynamic reloc. */
-
-static bfd_boolean
-sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
- struct bfd_link_info *info;
- bfd *abfd;
- asection *sec ATTRIBUTE_UNUSED;
- const struct reloc_ext_external *relocs;
- bfd_size_type rel_size;
-{
- bfd *dynobj;
- struct sunos_link_hash_entry **sym_hashes;
- const struct reloc_ext_external *rel, *relend;
- asection *splt = NULL;
- asection *sgot = NULL;
- asection *srel = NULL;
- bfd_size_type amt;
-
- /* We only know how to handle SPARC plt entries. */
- if (bfd_get_arch (abfd) != bfd_arch_sparc)
- {
- bfd_set_error (bfd_error_invalid_target);
- return FALSE;
- }
-
- dynobj = NULL;
-
- sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd);
-
- relend = relocs + rel_size / RELOC_EXT_SIZE;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned int r_index;
- int r_extern;
- int r_type;
- struct sunos_link_hash_entry *h = NULL;
-
- /* Swap in the reloc information. */
- if (bfd_header_big_endian (abfd))
- {
- r_index = ((rel->r_index[0] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[2]);
- r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
- r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
- >> RELOC_EXT_BITS_TYPE_SH_BIG);
- }
- else
- {
- r_index = ((rel->r_index[2] << 16)
- | (rel->r_index[1] << 8)
- | rel->r_index[0]);
- r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
- r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
- >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
- }
-
- if (r_extern)
- {
- h = sym_hashes[r_index];
- if (h == NULL)
- {
- /* This should not normally happen, but it will in any
- case be caught in the relocation phase. */
- continue;
- }
- }
-
- /* If this is a base relative reloc, we need to make an entry in
- the .got section. */
- if (r_type == RELOC_BASE10
- || r_type == RELOC_BASE13
- || r_type == RELOC_BASE22)
- {
- if (dynobj == NULL)
- {
- if (! sunos_create_dynamic_sections (abfd, info, FALSE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srel = bfd_get_section_by_name (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
-
- /* Make sure we have an initial entry in the .got table. */
- if (sgot->_raw_size == 0)
- sgot->_raw_size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- if (r_extern)
- {
- if (h->got_offset != 0)
- continue;
-
- h->got_offset = sgot->_raw_size;
- }
- else
- {
- if (r_index >= bfd_get_symcount (abfd))
- {
- /* This is abnormal, but should be caught in the
- relocation phase. */
- continue;
- }
-
- if (adata (abfd).local_got_offsets == NULL)
- {
- amt = bfd_get_symcount (abfd);
- amt *= sizeof (bfd_vma);
- adata (abfd).local_got_offsets =
- (bfd_vma *) bfd_zalloc (abfd, amt);
- if (adata (abfd).local_got_offsets == NULL)
- return FALSE;
- }
-
- if (adata (abfd).local_got_offsets[r_index] != 0)
- continue;
-
- adata (abfd).local_got_offsets[r_index] = sgot->_raw_size;
- }
-
- sgot->_raw_size += BYTES_IN_WORD;
-
- /* If we are making a shared library, or if the symbol is
- defined by a dynamic object, we will need a dynamic reloc
- entry. */
- if (info->shared
- || (h != NULL
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0))
- srel->_raw_size += RELOC_EXT_SIZE;
-
- continue;
- }
-
- /* Otherwise, we are only interested in relocs against symbols
- defined in dynamic objects but not in regular objects. We
- only need to consider relocs against external symbols. */
- if (! r_extern)
- {
- /* But, if we are creating a shared library, we need to
- generate an absolute reloc. */
- if (info->shared)
- {
- if (dynobj == NULL)
- {
- if (! sunos_create_dynamic_sections (abfd, info, TRUE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srel = bfd_get_section_by_name (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
- }
-
- srel->_raw_size += RELOC_EXT_SIZE;
- }
-
- continue;
- }
-
- /* At this point common symbols have already been allocated, so
- we don't have to worry about them. We need to consider that
- we may have already seen this symbol and marked it undefined;
- if the symbol is really undefined, then SUNOS_DEF_DYNAMIC
- will be zero. */
- if (h->root.root.type != bfd_link_hash_defined
- && h->root.root.type != bfd_link_hash_defweak
- && h->root.root.type != bfd_link_hash_undefined)
- continue;
-
- if (r_type != RELOC_JMP_TBL
- && ! info->shared
- && ((h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->flags & SUNOS_DEF_REGULAR) != 0))
- continue;
-
- if (r_type == RELOC_JMP_TBL
- && ! info->shared
- && (h->flags & SUNOS_DEF_DYNAMIC) == 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- /* This symbol is apparently undefined. Don't do anything
- here; just let the relocation routine report an undefined
- symbol. */
- continue;
- }
-
- if (strcmp (h->root.root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
- continue;
-
- if (dynobj == NULL)
- {
- if (! sunos_create_dynamic_sections (abfd, info, FALSE))
- return FALSE;
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srel = bfd_get_section_by_name (dynobj, ".dynrel");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
-
- /* Make sure we have an initial entry in the .got table. */
- if (sgot->_raw_size == 0)
- sgot->_raw_size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = TRUE;
- }
-
- BFD_ASSERT (r_type == RELOC_JMP_TBL
- || info->shared
- || (h->flags & SUNOS_REF_REGULAR) != 0);
- BFD_ASSERT (r_type == RELOC_JMP_TBL
- || info->shared
- || h->plt_offset != 0
- || ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- ? (h->root.root.u.def.section->owner->flags
- & DYNAMIC) != 0
- : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0));
-
- /* This reloc is against a symbol defined only by a dynamic
- object, or it is a jump table reloc from PIC compiled code. */
-
- if (r_type != RELOC_JMP_TBL
- && h->root.root.type == bfd_link_hash_undefined)
- {
- /* Presumably this symbol was marked as being undefined by
- an earlier reloc. */
- srel->_raw_size += RELOC_EXT_SIZE;
- }
- else if (r_type != RELOC_JMP_TBL
- && (h->root.root.u.def.section->flags & SEC_CODE) == 0)
- {
- bfd *sub;
-
- /* This reloc is not in the .text section. It must be
- copied into the dynamic relocs. We mark the symbol as
- being undefined. */
- srel->_raw_size += RELOC_EXT_SIZE;
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- sub = h->root.root.u.def.section->owner;
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = sub;
- }
- }
- else
- {
- /* This symbol is in the .text section. We must give it an
- entry in the procedure linkage table, if we have not
- already done so. We change the definition of the symbol
- to the .plt section; this will cause relocs against it to
- be handled correctly. */
- if (h->plt_offset == 0)
- {
- if (splt->_raw_size == 0)
- splt->_raw_size = SPARC_PLT_ENTRY_SIZE;
- h->plt_offset = splt->_raw_size;
-
- if ((h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- if (h->root.root.type == bfd_link_hash_undefined)
- h->root.root.type = bfd_link_hash_defined;
- h->root.root.u.def.section = splt;
- h->root.root.u.def.value = splt->_raw_size;
- }
-
- splt->_raw_size += SPARC_PLT_ENTRY_SIZE;
-
- /* We will also need a dynamic reloc entry, unless this
- is a JMP_TBL reloc produced by linking PIC compiled
- code, and we are not making a shared library. */
- if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
- srel->_raw_size += RELOC_EXT_SIZE;
- }
-
- /* If we are creating a shared library, we need to copy over
- any reloc other than a jump table reloc. */
- if (info->shared && r_type != RELOC_JMP_TBL)
- srel->_raw_size += RELOC_EXT_SIZE;
- }
- }
-
- return TRUE;
-}
-
-/* Build the hash table of dynamic symbols, and to mark as written all
- symbols from dynamic objects which we do not plan to write out. */
-
-static bfd_boolean
-sunos_scan_dynamic_symbol (h, data)
- struct sunos_link_hash_entry *h;
- PTR data;
-{
- struct bfd_link_info *info = (struct bfd_link_info *) data;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct sunos_link_hash_entry *) h->root.root.u.i.link;
-
- /* Set the written flag for symbols we do not want to write out as
- part of the regular symbol table. This is all symbols which are
- not defined in a regular object file. For some reason symbols
- which are referenced by a regular object and defined by a dynamic
- object do not seem to show up in the regular symbol table. It is
- possible for a symbol to have only SUNOS_REF_REGULAR set here, it
- is an undefined symbol which was turned into a common symbol
- because it was found in an archive object which was not included
- in the link. */
- if ((h->flags & SUNOS_DEF_REGULAR) == 0
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && strcmp (h->root.root.root.string, "__DYNAMIC") != 0)
- h->root.written = TRUE;
-
- /* If this symbol is defined by a dynamic object and referenced by a
- regular object, see whether we gave it a reasonable value while
- scanning the relocs. */
-
- if ((h->flags & SUNOS_DEF_REGULAR) == 0
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && (h->flags & SUNOS_REF_REGULAR) != 0)
- {
- if ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- && ((h->root.root.u.def.section->owner->flags & DYNAMIC) != 0)
- && h->root.root.u.def.section->output_section == NULL)
- {
- bfd *sub;
-
- /* This symbol is currently defined in a dynamic section
- which is not being put into the output file. This
- implies that there is no reloc against the symbol. I'm
- not sure why this case would ever occur. In any case, we
- change the symbol to be undefined. */
- sub = h->root.root.u.def.section->owner;
- h->root.root.type = bfd_link_hash_undefined;
- h->root.root.u.undef.abfd = sub;
- }
- }
-
- /* If this symbol is defined or referenced by a regular file, add it
- to the dynamic symbols. */
- if ((h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0)
- {
- asection *s;
- size_t len;
- bfd_byte *contents;
- unsigned char *name;
- unsigned long hash;
- bfd *dynobj;
-
- BFD_ASSERT (h->dynindx == -2);
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- h->dynindx = sunos_hash_table (info)->dynsymcount;
- ++sunos_hash_table (info)->dynsymcount;
-
- len = strlen (h->root.root.root.string);
-
- /* We don't bother to construct a BFD hash table for the strings
- which are the names of the dynamic symbols. Using a hash
- table for the regular symbols is beneficial, because the
- regular symbols includes the debugging symbols, which have
- long names and are often duplicated in several object files.
- There are no debugging symbols in the dynamic symbols. */
- s = bfd_get_section_by_name (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
- contents = (bfd_byte *) bfd_realloc (s->contents,
- s->_raw_size + len + 1);
- if (contents == NULL)
- return FALSE;
- s->contents = contents;
-
- h->dynstr_index = s->_raw_size;
- strcpy ((char *) contents + s->_raw_size, h->root.root.root.string);
- s->_raw_size += len + 1;
-
- /* Add it to the dynamic hash table. */
- name = (unsigned char *) h->root.root.root.string;
- hash = 0;
- while (*name != '\0')
- hash = (hash << 1) + *name++;
- hash &= 0x7fffffff;
- hash %= sunos_hash_table (info)->bucketcount;
-
- s = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
-
- if (GET_SWORD (dynobj, s->contents + hash * HASH_ENTRY_SIZE) == -1)
- PUT_WORD (dynobj, h->dynindx, s->contents + hash * HASH_ENTRY_SIZE);
- else
- {
- bfd_vma next;
-
- next = GET_WORD (dynobj,
- (s->contents
- + hash * HASH_ENTRY_SIZE
- + BYTES_IN_WORD));
- PUT_WORD (dynobj, s->_raw_size / HASH_ENTRY_SIZE,
- s->contents + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD);
- PUT_WORD (dynobj, h->dynindx, s->contents + s->_raw_size);
- PUT_WORD (dynobj, next, s->contents + s->_raw_size + BYTES_IN_WORD);
- s->_raw_size += HASH_ENTRY_SIZE;
- }
- }
-
- return TRUE;
-}
-
-/* Link a dynamic object. We actually don't have anything to do at
- this point. This entry point exists to prevent the regular linker
- code from doing anything with the object. */
-
-static bfd_boolean
-sunos_link_dynamic_object (info, abfd)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- bfd *abfd ATTRIBUTE_UNUSED;
-{
- return TRUE;
-}
-
-/* Write out a dynamic symbol. This is called by the final traversal
- over the symbol table. */
-
-static bfd_boolean
-sunos_write_dynamic_symbol (output_bfd, info, harg)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct aout_link_hash_entry *harg;
-{
- struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg;
- int type;
- bfd_vma val;
- asection *s;
- struct external_nlist *outsym;
-
- /* If this symbol is in the procedure linkage table, fill in the
- table entry. */
- if (h->plt_offset != 0)
- {
- bfd *dynobj;
- asection *splt;
- bfd_byte *p;
- bfd_vma r_address;
-
- dynobj = sunos_hash_table (info)->dynobj;
- splt = bfd_get_section_by_name (dynobj, ".plt");
- p = splt->contents + h->plt_offset;
-
- s = bfd_get_section_by_name (dynobj, ".dynrel");
-
- r_address = (splt->output_section->vma
- + splt->output_offset
- + h->plt_offset);
-
- switch (bfd_get_arch (output_bfd))
- {
- case bfd_arch_sparc:
- if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD0, p);
- bfd_put_32 (output_bfd,
- (SPARC_PLT_ENTRY_WORD1
- + (((- (h->plt_offset + 4) >> 2)
- & 0x3fffffff))),
- p + 4);
- bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD2 + s->reloc_count,
- p + 8);
- }
- else
- {
- val = (h->root.root.u.def.section->output_section->vma
- + h->root.root.u.def.section->output_offset
- + h->root.root.u.def.value);
- bfd_put_32 (output_bfd,
- SPARC_PLT_PIC_WORD0 + ((val >> 10) & 0x3fffff),
- p);
- bfd_put_32 (output_bfd,
- SPARC_PLT_PIC_WORD1 + (val & 0x3ff),
- p + 4);
- bfd_put_32 (output_bfd, SPARC_PLT_PIC_WORD2, p + 8);
- }
- break;
-
- case bfd_arch_m68k:
- if (! info->shared && (h->flags & SUNOS_DEF_REGULAR) != 0)
- abort ();
- bfd_put_16 (output_bfd, M68K_PLT_ENTRY_WORD0, p);
- bfd_put_32 (output_bfd, (- (h->plt_offset + 2)), p + 2);
- bfd_put_16 (output_bfd, (bfd_vma) s->reloc_count, p + 6);
- r_address += 2;
- break;
-
- default:
- abort ();
- }
-
- /* We also need to add a jump table reloc, unless this is the
- result of a JMP_TBL reloc from PIC compiled code. */
- if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- BFD_ASSERT (h->dynindx >= 0);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
- < s->_raw_size);
- p = s->contents + s->reloc_count * obj_reloc_entry_size (output_bfd);
- if (obj_reloc_entry_size (output_bfd) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) p;
- PUT_WORD (output_bfd, r_address, srel->r_address);
- if (bfd_header_big_endian (output_bfd))
- {
- srel->r_index[0] = (bfd_byte) (h->dynindx >> 16);
- srel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- srel->r_index[2] = (bfd_byte) (h->dynindx);
- srel->r_type[0] = (RELOC_STD_BITS_EXTERN_BIG
- | RELOC_STD_BITS_JMPTABLE_BIG);
- }
- else
- {
- srel->r_index[2] = (bfd_byte) (h->dynindx >> 16);
- srel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- srel->r_index[0] = (bfd_byte)h->dynindx;
- srel->r_type[0] = (RELOC_STD_BITS_EXTERN_LITTLE
- | RELOC_STD_BITS_JMPTABLE_LITTLE);
- }
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) p;
- PUT_WORD (output_bfd, r_address, erel->r_address);
- if (bfd_header_big_endian (output_bfd))
- {
- erel->r_index[0] = (bfd_byte) (h->dynindx >> 16);
- erel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- erel->r_index[2] = (bfd_byte)h->dynindx;
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_BIG
- | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_BIG));
- }
- else
- {
- erel->r_index[2] = (bfd_byte) (h->dynindx >> 16);
- erel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
- erel->r_index[0] = (bfd_byte)h->dynindx;
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_LITTLE
- | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_LITTLE));
- }
- PUT_WORD (output_bfd, (bfd_vma) 0, erel->r_addend);
- }
-
- ++s->reloc_count;
- }
- }
-
- /* If this is not a dynamic symbol, we don't have to do anything
- else. We only check this after handling the PLT entry, because
- we can have a PLT entry for a nondynamic symbol when linking PIC
- compiled code from a regular object. */
- if (h->dynindx < 0)
- return TRUE;
-
- switch (h->root.root.type)
- {
- default:
- case bfd_link_hash_new:
- abort ();
- /* Avoid variable not initialized warnings. */
- return TRUE;
- case bfd_link_hash_undefined:
- type = N_UNDF | N_EXT;
- val = 0;
- break;
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- {
- asection *sec;
- asection *output_section;
-
- sec = h->root.root.u.def.section;
- output_section = sec->output_section;
- BFD_ASSERT (bfd_is_abs_section (output_section)
- || output_section->owner == output_bfd);
- if (h->plt_offset != 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0)
- {
- type = N_UNDF | N_EXT;
- val = 0;
- }
- else
- {
- if (output_section == obj_textsec (output_bfd))
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_TEXT
- : N_WEAKT);
- else if (output_section == obj_datasec (output_bfd))
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_DATA
- : N_WEAKD);
- else if (output_section == obj_bsssec (output_bfd))
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_BSS
- : N_WEAKB);
- else
- type = (h->root.root.type == bfd_link_hash_defined
- ? N_ABS
- : N_WEAKA);
- type |= N_EXT;
- val = (h->root.root.u.def.value
- + output_section->vma
- + sec->output_offset);
- }
- }
- break;
- case bfd_link_hash_common:
- type = N_UNDF | N_EXT;
- val = h->root.root.u.c.size;
- break;
- case bfd_link_hash_undefweak:
- type = N_WEAKU;
- val = 0;
- break;
- case bfd_link_hash_indirect:
- case bfd_link_hash_warning:
- /* FIXME: Ignore these for now. The circumstances under which
- they should be written out are not clear to me. */
- return TRUE;
- }
-
- s = bfd_get_section_by_name (sunos_hash_table (info)->dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- outsym = ((struct external_nlist *)
- (s->contents + h->dynindx * EXTERNAL_NLIST_SIZE));
-
- H_PUT_8 (output_bfd, type, outsym->e_type);
- H_PUT_8 (output_bfd, 0, outsym->e_other);
-
- /* FIXME: The native linker doesn't use 0 for desc. It seems to use
- one less than the desc value in the shared library, although that
- seems unlikely. */
- H_PUT_16 (output_bfd, 0, outsym->e_desc);
-
- PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx);
- PUT_WORD (output_bfd, val, outsym->e_value);
-
- return TRUE;
-}
-
-/* This is called for each reloc against an external symbol. If this
- is a reloc which are are going to copy as a dynamic reloc, then
- copy it over, and tell the caller to not bother processing this
- reloc. */
-
-static bfd_boolean
-sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
- contents, skip, relocationp)
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- struct aout_link_hash_entry *harg;
- PTR reloc;
- bfd_byte *contents ATTRIBUTE_UNUSED;
- bfd_boolean *skip;
- bfd_vma *relocationp;
-{
- struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg;
- bfd *dynobj;
- bfd_boolean baserel;
- bfd_boolean jmptbl;
- bfd_boolean pcrel;
- asection *s;
- bfd_byte *p;
- long indx;
-
- *skip = FALSE;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- if (h != NULL
- && h->plt_offset != 0
- && (info->shared
- || (h->flags & SUNOS_DEF_REGULAR) == 0))
- {
- asection *splt;
-
- /* Redirect the relocation to the PLT entry. */
- splt = bfd_get_section_by_name (dynobj, ".plt");
- *relocationp = (splt->output_section->vma
- + splt->output_offset
- + h->plt_offset);
- }
-
- if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) reloc;
- if (bfd_header_big_endian (input_bfd))
- {
- baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
- jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG));
- pcrel = (0 != (srel->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
- }
- else
- {
- baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE));
- jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE));
- pcrel = (0 != (srel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
- }
- }
- else
- {
- struct reloc_ext_external *erel;
- int r_type;
-
- erel = (struct reloc_ext_external *) reloc;
- if (bfd_header_big_endian (input_bfd))
- r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
- >> RELOC_EXT_BITS_TYPE_SH_BIG);
- else
- r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
- >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
- baserel = (r_type == RELOC_BASE10
- || r_type == RELOC_BASE13
- || r_type == RELOC_BASE22);
- jmptbl = r_type == RELOC_JMP_TBL;
- pcrel = (r_type == RELOC_DISP8
- || r_type == RELOC_DISP16
- || r_type == RELOC_DISP32
- || r_type == RELOC_WDISP30
- || r_type == RELOC_WDISP22);
- /* We don't consider the PC10 and PC22 types to be PC relative,
- because they are pcrel_offset. */
- }
-
- if (baserel)
- {
- bfd_vma *got_offsetp;
- asection *sgot;
-
- if (h != NULL)
- got_offsetp = &h->got_offset;
- else if (adata (input_bfd).local_got_offsets == NULL)
- got_offsetp = NULL;
- else
- {
- struct reloc_std_external *srel;
- int r_index;
-
- srel = (struct reloc_std_external *) reloc;
- if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE)
- {
- if (bfd_header_big_endian (input_bfd))
- r_index = ((srel->r_index[0] << 16)
- | (srel->r_index[1] << 8)
- | srel->r_index[2]);
- else
- r_index = ((srel->r_index[2] << 16)
- | (srel->r_index[1] << 8)
- | srel->r_index[0]);
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) reloc;
- if (bfd_header_big_endian (input_bfd))
- r_index = ((erel->r_index[0] << 16)
- | (erel->r_index[1] << 8)
- | erel->r_index[2]);
- else
- r_index = ((erel->r_index[2] << 16)
- | (erel->r_index[1] << 8)
- | erel->r_index[0]);
- }
-
- got_offsetp = adata (input_bfd).local_got_offsets + r_index;
- }
-
- BFD_ASSERT (got_offsetp != NULL && *got_offsetp != 0);
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
-
- /* We set the least significant bit to indicate whether we have
- already initialized the GOT entry. */
- if ((*got_offsetp & 1) == 0)
- {
- if (h == NULL
- || (! info->shared
- && ((h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->flags & SUNOS_DEF_REGULAR) != 0)))
- PUT_WORD (dynobj, *relocationp, sgot->contents + *got_offsetp);
- else
- PUT_WORD (dynobj, 0, sgot->contents + *got_offsetp);
-
- if (info->shared
- || (h != NULL
- && (h->flags & SUNOS_DEF_DYNAMIC) != 0
- && (h->flags & SUNOS_DEF_REGULAR) == 0))
- {
- /* We need to create a GLOB_DAT or 32 reloc to tell the
- dynamic linker to fill in this entry in the table. */
-
- s = bfd_get_section_by_name (dynobj, ".dynrel");
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
- < s->_raw_size);
-
- p = (s->contents
- + s->reloc_count * obj_reloc_entry_size (dynobj));
-
- if (h != NULL)
- indx = h->dynindx;
- else
- indx = 0;
-
- if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) p;
- PUT_WORD (dynobj,
- (*got_offsetp
- + sgot->output_section->vma
- + sgot->output_offset),
- srel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- srel->r_index[0] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[2] = (bfd_byte)indx;
- if (h == NULL)
- srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_BIG;
- else
- srel->r_type[0] =
- (RELOC_STD_BITS_EXTERN_BIG
- | RELOC_STD_BITS_BASEREL_BIG
- | RELOC_STD_BITS_RELATIVE_BIG
- | (2 << RELOC_STD_BITS_LENGTH_SH_BIG));
- }
- else
- {
- srel->r_index[2] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[0] = (bfd_byte)indx;
- if (h == NULL)
- srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_LITTLE;
- else
- srel->r_type[0] =
- (RELOC_STD_BITS_EXTERN_LITTLE
- | RELOC_STD_BITS_BASEREL_LITTLE
- | RELOC_STD_BITS_RELATIVE_LITTLE
- | (2 << RELOC_STD_BITS_LENGTH_SH_LITTLE));
- }
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) p;
- PUT_WORD (dynobj,
- (*got_offsetp
- + sgot->output_section->vma
- + sgot->output_offset),
- erel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- erel->r_index[0] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[2] = (bfd_byte)indx;
- if (h == NULL)
- erel->r_type[0] =
- RELOC_32 << RELOC_EXT_BITS_TYPE_SH_BIG;
- else
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_BIG
- | (RELOC_GLOB_DAT << RELOC_EXT_BITS_TYPE_SH_BIG));
- }
- else
- {
- erel->r_index[2] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[0] = (bfd_byte)indx;
- if (h == NULL)
- erel->r_type[0] =
- RELOC_32 << RELOC_EXT_BITS_TYPE_SH_LITTLE;
- else
- erel->r_type[0] =
- (RELOC_EXT_BITS_EXTERN_LITTLE
- | (RELOC_GLOB_DAT
- << RELOC_EXT_BITS_TYPE_SH_LITTLE));
- }
- PUT_WORD (dynobj, 0, erel->r_addend);
- }
-
- ++s->reloc_count;
- }
-
- *got_offsetp |= 1;
- }
-
- *relocationp = (sgot->vma
- + (*got_offsetp &~ (bfd_vma) 1)
- - sunos_hash_table (info)->got_base);
-
- /* There is nothing else to do for a base relative reloc. */
- return TRUE;
- }
-
- if (! sunos_hash_table (info)->dynamic_sections_needed)
- return TRUE;
- if (! info->shared)
- {
- if (h == NULL
- || h->dynindx == -1
- || h->root.root.type != bfd_link_hash_undefined
- || (h->flags & SUNOS_DEF_REGULAR) != 0
- || (h->flags & SUNOS_DEF_DYNAMIC) == 0
- || (h->root.root.u.undef.abfd->flags & DYNAMIC) == 0)
- return TRUE;
- }
- else
- {
- if (h != NULL
- && (h->dynindx == -1
- || jmptbl
- || strcmp (h->root.root.root.string,
- "__GLOBAL_OFFSET_TABLE_") == 0))
- return TRUE;
- }
-
- /* It looks like this is a reloc we are supposed to copy. */
-
- s = bfd_get_section_by_name (dynobj, ".dynrel");
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) < s->_raw_size);
-
- p = s->contents + s->reloc_count * obj_reloc_entry_size (dynobj);
-
- /* Copy the reloc over. */
- memcpy (p, reloc, obj_reloc_entry_size (dynobj));
-
- if (h != NULL)
- indx = h->dynindx;
- else
- indx = 0;
-
- /* Adjust the address and symbol index. */
- if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE)
- {
- struct reloc_std_external *srel;
-
- srel = (struct reloc_std_external *) p;
- PUT_WORD (dynobj,
- (GET_WORD (dynobj, srel->r_address)
- + input_section->output_section->vma
- + input_section->output_offset),
- srel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- srel->r_index[0] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[2] = (bfd_byte)indx;
- }
- else
- {
- srel->r_index[2] = (bfd_byte) (indx >> 16);
- srel->r_index[1] = (bfd_byte) (indx >> 8);
- srel->r_index[0] = (bfd_byte)indx;
- }
- /* FIXME: We may have to change the addend for a PC relative
- reloc. */
- }
- else
- {
- struct reloc_ext_external *erel;
-
- erel = (struct reloc_ext_external *) p;
- PUT_WORD (dynobj,
- (GET_WORD (dynobj, erel->r_address)
- + input_section->output_section->vma
- + input_section->output_offset),
- erel->r_address);
- if (bfd_header_big_endian (dynobj))
- {
- erel->r_index[0] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[2] = (bfd_byte)indx;
- }
- else
- {
- erel->r_index[2] = (bfd_byte) (indx >> 16);
- erel->r_index[1] = (bfd_byte) (indx >> 8);
- erel->r_index[0] = (bfd_byte)indx;
- }
- if (pcrel && h != NULL)
- {
- /* Adjust the addend for the change in address. */
- PUT_WORD (dynobj,
- (GET_WORD (dynobj, erel->r_addend)
- - (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma)),
- erel->r_addend);
- }
- }
-
- ++s->reloc_count;
-
- if (h != NULL)
- *skip = TRUE;
-
- return TRUE;
-}
-
-/* Finish up the dynamic linking information. */
-
-static bfd_boolean
-sunos_finish_dynamic_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- asection *o;
- asection *s;
- asection *sdyn;
-
- if (! sunos_hash_table (info)->dynamic_sections_needed
- && ! sunos_hash_table (info)->got_needed)
- return TRUE;
-
- dynobj = sunos_hash_table (info)->dynobj;
-
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (sdyn != NULL);
-
- /* Finish up the .need section. The linker emulation code filled it
- in, but with offsets from the start of the section instead of
- real addresses. Now that we know the section location, we can
- fill in the final values. */
- s = bfd_get_section_by_name (dynobj, ".need");
- if (s != NULL && s->_raw_size != 0)
- {
- file_ptr filepos;
- bfd_byte *p;
-
- filepos = s->output_section->filepos + s->output_offset;
- p = s->contents;
- while (1)
- {
- bfd_vma val;
-
- PUT_WORD (dynobj, GET_WORD (dynobj, p) + filepos, p);
- val = GET_WORD (dynobj, p + 12);
- if (val == 0)
- break;
- PUT_WORD (dynobj, val + filepos, p + 12);
- p += 16;
- }
- }
-
- /* The first entry in the .got section is the address of the
- dynamic information, unless this is a shared library. */
- s = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (s != NULL);
- if (info->shared || sdyn->_raw_size == 0)
- PUT_WORD (dynobj, 0, s->contents);
- else
- PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset,
- s->contents);
-
- for (o = dynobj->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_HAS_CONTENTS) != 0
- && o->contents != NULL)
- {
- BFD_ASSERT (o->output_section != NULL
- && o->output_section->owner == abfd);
- if (! bfd_set_section_contents (abfd, o->output_section,
- o->contents,
- (file_ptr) o->output_offset,
- o->_raw_size))
- return FALSE;
- }
- }
-
- if (sdyn->_raw_size > 0)
- {
- struct external_sun4_dynamic esd;
- struct external_sun4_dynamic_link esdl;
- file_ptr pos;
-
- /* Finish up the dynamic link information. */
- PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version);
- PUT_WORD (dynobj,
- sdyn->output_section->vma + sdyn->output_offset + sizeof esd,
- esd.ldd);
- PUT_WORD (dynobj,
- (sdyn->output_section->vma
- + sdyn->output_offset
- + sizeof esd
- + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE),
- esd.ld);
-
- if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd,
- (file_ptr) sdyn->output_offset,
- (bfd_size_type) sizeof esd))
- return FALSE;
-
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded);
-
- s = bfd_get_section_by_name (dynobj, ".need");
- if (s == NULL || s->_raw_size == 0)
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_need);
- else
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_need);
-
- s = bfd_get_section_by_name (dynobj, ".rules");
- if (s == NULL || s->_raw_size == 0)
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules);
- else
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_rules);
-
- s = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->vma + s->output_offset,
- esdl.ld_got);
-
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->vma + s->output_offset,
- esdl.ld_plt);
- PUT_WORD (dynobj, s->_raw_size, esdl.ld_plt_sz);
-
- s = bfd_get_section_by_name (dynobj, ".dynrel");
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
- == s->_raw_size);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_rel);
-
- s = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_hash);
-
- s = bfd_get_section_by_name (dynobj, ".dynsym");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_stab);
-
- PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_stab_hash);
-
- PUT_WORD (dynobj, (bfd_vma) sunos_hash_table (info)->bucketcount,
- esdl.ld_buckets);
-
- s = bfd_get_section_by_name (dynobj, ".dynstr");
- BFD_ASSERT (s != NULL);
- PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
- esdl.ld_symbols);
- PUT_WORD (dynobj, s->_raw_size, esdl.ld_symb_size);
-
- /* The size of the text area is the size of the .text section
- rounded up to a page boundary. FIXME: Should the page size be
- conditional on something? */
- PUT_WORD (dynobj,
- BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000),
- esdl.ld_text);
-
- pos = sdyn->output_offset;
- pos += sizeof esd + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE;
- if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl,
- pos, (bfd_size_type) sizeof esdl))
- return FALSE;
-
- abfd->flags |= DYNAMIC;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/syms.c b/contrib/binutils/bfd/syms.c
deleted file mode 100644
index c07f48b..0000000
--- a/contrib/binutils/bfd/syms.c
+++ /dev/null
@@ -1,1362 +0,0 @@
-/* Generic symbol-table support for the BFD library.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SECTION
- Symbols
-
- BFD tries to maintain as much symbol information as it can when
- it moves information from file to file. BFD passes information
- to applications though the <<asymbol>> structure. When the
- application requests the symbol table, BFD reads the table in
- the native form and translates parts of it into the internal
- format. To maintain more than the information passed to
- applications, some targets keep some information ``behind the
- scenes'' in a structure only the particular back end knows
- about. For example, the coff back end keeps the original
- symbol table structure as well as the canonical structure when
- a BFD is read in. On output, the coff back end can reconstruct
- the output symbol table so that no information is lost, even
- information unique to coff which BFD doesn't know or
- understand. If a coff symbol table were read, but were written
- through an a.out back end, all the coff specific information
- would be lost. The symbol table of a BFD
- is not necessarily read in until a canonicalize request is
- made. Then the BFD back end fills in a table provided by the
- application with pointers to the canonical information. To
- output symbols, the application provides BFD with a table of
- pointers to pointers to <<asymbol>>s. This allows applications
- like the linker to output a symbol as it was read, since the ``behind
- the scenes'' information will be still available.
-@menu
-@* Reading Symbols::
-@* Writing Symbols::
-@* Mini Symbols::
-@* typedef asymbol::
-@* symbol handling functions::
-@end menu
-
-INODE
-Reading Symbols, Writing Symbols, Symbols, Symbols
-SUBSECTION
- Reading symbols
-
- There are two stages to reading a symbol table from a BFD:
- allocating storage, and the actual reading process. This is an
- excerpt from an application which reads the symbol table:
-
-| long storage_needed;
-| asymbol **symbol_table;
-| long number_of_symbols;
-| long i;
-|
-| storage_needed = bfd_get_symtab_upper_bound (abfd);
-|
-| if (storage_needed < 0)
-| FAIL
-|
-| if (storage_needed == 0)
-| return;
-|
-| symbol_table = xmalloc (storage_needed);
-| ...
-| number_of_symbols =
-| bfd_canonicalize_symtab (abfd, symbol_table);
-|
-| if (number_of_symbols < 0)
-| FAIL
-|
-| for (i = 0; i < number_of_symbols; i++)
-| process_symbol (symbol_table[i]);
-
- All storage for the symbols themselves is in an objalloc
- connected to the BFD; it is freed when the BFD is closed.
-
-INODE
-Writing Symbols, Mini Symbols, Reading Symbols, Symbols
-SUBSECTION
- Writing symbols
-
- Writing of a symbol table is automatic when a BFD open for
- writing is closed. The application attaches a vector of
- pointers to pointers to symbols to the BFD being written, and
- fills in the symbol count. The close and cleanup code reads
- through the table provided and performs all the necessary
- operations. The BFD output code must always be provided with an
- ``owned'' symbol: one which has come from another BFD, or one
- which has been created using <<bfd_make_empty_symbol>>. Here is an
- example showing the creation of a symbol table with only one element:
-
-| #include "bfd.h"
-| int main (void)
-| {
-| bfd *abfd;
-| asymbol *ptrs[2];
-| asymbol *new;
-|
-| abfd = bfd_openw ("foo","a.out-sunos-big");
-| bfd_set_format (abfd, bfd_object);
-| new = bfd_make_empty_symbol (abfd);
-| new->name = "dummy_symbol";
-| new->section = bfd_make_section_old_way (abfd, ".text");
-| new->flags = BSF_GLOBAL;
-| new->value = 0x12345;
-|
-| ptrs[0] = new;
-| ptrs[1] = 0;
-|
-| bfd_set_symtab (abfd, ptrs, 1);
-| bfd_close (abfd);
-| return 0;
-| }
-|
-| ./makesym
-| nm foo
-| 00012345 A dummy_symbol
-
- Many formats cannot represent arbitrary symbol information; for
- instance, the <<a.out>> object format does not allow an
- arbitrary number of sections. A symbol pointing to a section
- which is not one of <<.text>>, <<.data>> or <<.bss>> cannot
- be described.
-
-INODE
-Mini Symbols, typedef asymbol, Writing Symbols, Symbols
-SUBSECTION
- Mini Symbols
-
- Mini symbols provide read-only access to the symbol table.
- They use less memory space, but require more time to access.
- They can be useful for tools like nm or objdump, which may
- have to handle symbol tables of extremely large executables.
-
- The <<bfd_read_minisymbols>> function will read the symbols
- into memory in an internal form. It will return a <<void *>>
- pointer to a block of memory, a symbol count, and the size of
- each symbol. The pointer is allocated using <<malloc>>, and
- should be freed by the caller when it is no longer needed.
-
- The function <<bfd_minisymbol_to_symbol>> will take a pointer
- to a minisymbol, and a pointer to a structure returned by
- <<bfd_make_empty_symbol>>, and return a <<asymbol>> structure.
- The return value may or may not be the same as the value from
- <<bfd_make_empty_symbol>> which was passed in.
-
-*/
-
-/*
-DOCDD
-INODE
-typedef asymbol, symbol handling functions, Mini Symbols, Symbols
-
-*/
-/*
-SUBSECTION
- typedef asymbol
-
- An <<asymbol>> has the form:
-
-*/
-
-/*
-CODE_FRAGMENT
-
-.
-.typedef struct bfd_symbol
-.{
-. {* A pointer to the BFD which owns the symbol. This information
-. is necessary so that a back end can work out what additional
-. information (invisible to the application writer) is carried
-. with the symbol.
-.
-. This field is *almost* redundant, since you can use section->owner
-. instead, except that some symbols point to the global sections
-. bfd_{abs,com,und}_section. This could be fixed by making
-. these globals be per-bfd (or per-target-flavor). FIXME. *}
-. struct bfd *the_bfd; {* Use bfd_asymbol_bfd(sym) to access this field. *}
-.
-. {* The text of the symbol. The name is left alone, and not copied; the
-. application may not alter it. *}
-. 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
-. a pointer to another symbol is stored here. *}
-. symvalue value;
-.
-. {* Attributes of a symbol. *}
-.#define BSF_NO_FLAGS 0x00
-.
-. {* The symbol has local scope; <<static>> in <<C>>. The value
-. is the offset into the section of the data. *}
-.#define BSF_LOCAL 0x01
-.
-. {* The symbol has global scope; initialized data in <<C>>. The
-. value is the offset into the section of the data. *}
-.#define BSF_GLOBAL 0x02
-.
-. {* The symbol has global scope and is exported. The value is
-. the offset into the section of the data. *}
-.#define BSF_EXPORT BSF_GLOBAL {* No real difference. *}
-.
-. {* A normal C symbol would be one of:
-. <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
-. <<BSF_GLOBAL>>. *}
-.
-. {* The symbol is a debugging record. The value has an arbitrary
-. meaning, unless BSF_DEBUGGING_RELOC is also set. *}
-.#define BSF_DEBUGGING 0x08
-.
-. {* The symbol denotes a function entry point. Used in ELF,
-. perhaps others someday. *}
-.#define BSF_FUNCTION 0x10
-.
-. {* Used by the linker. *}
-.#define BSF_KEEP 0x20
-.#define BSF_KEEP_G 0x40
-.
-. {* A weak global symbol, overridable without warnings by
-. a regular global symbol of the same name. *}
-.#define BSF_WEAK 0x80
-.
-. {* This symbol was created to point to a section, e.g. ELF's
-. STT_SECTION symbols. *}
-.#define BSF_SECTION_SYM 0x100
-.
-. {* The symbol used to be a common symbol, but now it is
-. allocated. *}
-.#define BSF_OLD_COMMON 0x200
-.
-. {* The default value for common data. *}
-.#define BFD_FORT_COMM_DEFAULT_VALUE 0
-.
-. {* In some files the type of a symbol sometimes alters its
-. location in an output file - ie in coff a <<ISFCN>> symbol
-. which is also <<C_EXT>> symbol appears where it was
-. declared and not at the end of a section. This bit is set
-. by the target BFD part to convey this information. *}
-.#define BSF_NOT_AT_END 0x400
-.
-. {* Signal that the symbol is the label of constructor section. *}
-.#define BSF_CONSTRUCTOR 0x800
-.
-. {* Signal that the symbol is a warning symbol. The name is a
-. warning. The name of the next symbol is the one to warn about;
-. if a reference is made to a symbol with the same name as the next
-. symbol, a warning is issued by the linker. *}
-.#define BSF_WARNING 0x1000
-.
-. {* Signal that the symbol is indirect. This symbol is an indirect
-. pointer to the symbol with the same name as the next symbol. *}
-.#define BSF_INDIRECT 0x2000
-.
-. {* BSF_FILE marks symbols that contain a file name. This is used
-. for ELF STT_FILE symbols. *}
-.#define BSF_FILE 0x4000
-.
-. {* Symbol is from dynamic linking information. *}
-.#define BSF_DYNAMIC 0x8000
-.
-. {* The symbol denotes a data object. Used in ELF, and perhaps
-. others someday. *}
-.#define BSF_OBJECT 0x10000
-.
-. {* This symbol is a debugging symbol. The value is the offset
-. into the section of the data. BSF_DEBUGGING should be set
-. as well. *}
-.#define BSF_DEBUGGING_RELOC 0x20000
-.
-. {* This symbol is thread local. Used in ELF. *}
-.#define BSF_THREAD_LOCAL 0x40000
-.
-. flagword flags;
-.
-. {* A pointer to the section to which this symbol is
-. relative. This will always be non NULL, there are special
-. sections for undefined and absolute symbols. *}
-. struct bfd_section *section;
-.
-. {* Back end special data. *}
-. union
-. {
-. void *p;
-. bfd_vma i;
-. }
-. udata;
-.}
-.asymbol;
-.
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "safe-ctype.h"
-#include "bfdlink.h"
-#include "aout/stab_gnu.h"
-
-/*
-DOCDD
-INODE
-symbol handling functions, , typedef asymbol, Symbols
-SUBSECTION
- Symbol handling functions
-*/
-
-/*
-FUNCTION
- bfd_get_symtab_upper_bound
-
-DESCRIPTION
- Return the number of bytes required to store a vector of pointers
- to <<asymbols>> for all the symbols in the BFD @var{abfd},
- including a terminal NULL pointer. If there are no symbols in
- the BFD, then return 0. If an error occurs, return -1.
-
-.#define bfd_get_symtab_upper_bound(abfd) \
-. BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-.
-*/
-
-/*
-FUNCTION
- bfd_is_local_label
-
-SYNOPSIS
- bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
-
-DESCRIPTION
- Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is
- a compiler generated local label, else return FALSE.
-*/
-
-bfd_boolean
-bfd_is_local_label (bfd *abfd, asymbol *sym)
-{
- /* The BSF_SECTION_SYM check is needed for IA-64, where every label that
- starts with '.' is local. This would accidentally catch section names
- if we didn't reject them here. */
- if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_SECTION_SYM)) != 0)
- return FALSE;
- if (sym->name == NULL)
- return FALSE;
- return bfd_is_local_label_name (abfd, sym->name);
-}
-
-/*
-FUNCTION
- bfd_is_local_label_name
-
-SYNOPSIS
- bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
-
-DESCRIPTION
- Return TRUE if a symbol with the name @var{name} in the BFD
- @var{abfd} is a compiler generated local label, else return
- FALSE. This just checks whether the name has the form of a
- local label.
-
-.#define bfd_is_local_label_name(abfd, name) \
-. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-.
-*/
-
-/*
-FUNCTION
- bfd_canonicalize_symtab
-
-DESCRIPTION
- Read the symbols from the BFD @var{abfd}, and fills in
- the vector @var{location} with pointers to the symbols and
- a trailing NULL.
- Return the actual number of symbol pointers, not
- including the NULL.
-
-.#define bfd_canonicalize_symtab(abfd, location) \
-. BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-.
-*/
-
-/*
-FUNCTION
- bfd_set_symtab
-
-SYNOPSIS
- bfd_boolean bfd_set_symtab
- (bfd *abfd, asymbol **location, unsigned int count);
-
-DESCRIPTION
- Arrange that when the output BFD @var{abfd} is closed,
- the table @var{location} of @var{count} pointers to symbols
- will be written.
-*/
-
-bfd_boolean
-bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int symcount)
-{
- if (abfd->format != bfd_object || bfd_read_p (abfd))
- {
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- bfd_get_outsymbols (abfd) = location;
- bfd_get_symcount (abfd) = symcount;
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_print_symbol_vandf
-
-SYNOPSIS
- void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
-
-DESCRIPTION
- Print the value and flags of the @var{symbol} supplied to the
- stream @var{file}.
-*/
-void
-bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
-{
- FILE *file = arg;
-
- flagword type = symbol->flags;
-
- if (symbol->section != NULL)
- bfd_fprintf_vma (abfd, file, symbol->value + symbol->section->vma);
- else
- bfd_fprintf_vma (abfd, file, symbol->value);
-
- /* This presumes that a symbol can not be both BSF_DEBUGGING and
- BSF_DYNAMIC, nor more than one of BSF_FUNCTION, BSF_FILE, and
- BSF_OBJECT. */
- fprintf (file, " %c%c%c%c%c%c%c",
- ((type & BSF_LOCAL)
- ? (type & BSF_GLOBAL) ? '!' : 'l'
- : (type & BSF_GLOBAL) ? 'g' : ' '),
- (type & BSF_WEAK) ? 'w' : ' ',
- (type & BSF_CONSTRUCTOR) ? 'C' : ' ',
- (type & BSF_WARNING) ? 'W' : ' ',
- (type & BSF_INDIRECT) ? 'I' : ' ',
- (type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ',
- ((type & BSF_FUNCTION)
- ? 'F'
- : ((type & BSF_FILE)
- ? 'f'
- : ((type & BSF_OBJECT) ? 'O' : ' '))));
-}
-
-/*
-FUNCTION
- bfd_make_empty_symbol
-
-DESCRIPTION
- Create a new <<asymbol>> structure for the BFD @var{abfd}
- and return a pointer to it.
-
- This routine is necessary because each back end has private
- information surrounding the <<asymbol>>. Building your own
- <<asymbol>> and pointing to it will not create the private
- information, and will cause problems later on.
-
-.#define bfd_make_empty_symbol(abfd) \
-. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-.
-*/
-
-/*
-FUNCTION
- _bfd_generic_make_empty_symbol
-
-SYNOPSIS
- asymbol *_bfd_generic_make_empty_symbol (bfd *);
-
-DESCRIPTION
- Create a new <<asymbol>> structure for the BFD @var{abfd}
- and return a pointer to it. Used by core file routines,
- binary back-end and anywhere else where no private info
- is needed.
-*/
-
-asymbol *
-_bfd_generic_make_empty_symbol (bfd *abfd)
-{
- bfd_size_type amt = sizeof (asymbol);
- asymbol *new = bfd_zalloc (abfd, amt);
- if (new)
- new->the_bfd = abfd;
- return new;
-}
-
-/*
-FUNCTION
- bfd_make_debug_symbol
-
-DESCRIPTION
- Create a new <<asymbol>> structure for the BFD @var{abfd},
- to be used as a debugging symbol. Further details of its use have
- yet to be worked out.
-
-.#define bfd_make_debug_symbol(abfd,ptr,size) \
-. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-.
-*/
-
-struct section_to_type
-{
- const char *section;
- char type;
-};
-
-/* Map section names to POSIX/BSD single-character symbol types.
- This table is probably incomplete. It is sorted for convenience of
- adding entries. Since it is so short, a linear search is used. */
-static const struct section_to_type stt[] =
-{
- {".bss", 'b'},
- {"code", 't'}, /* MRI .text */
- {".data", 'd'},
- {"*DEBUG*", 'N'},
- {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */
- {".drectve", 'i'}, /* MSVC's .drective section */
- {".edata", 'e'}, /* MSVC's .edata (export) section */
- {".fini", 't'}, /* ELF fini section */
- {".idata", 'i'}, /* MSVC's .idata (import) section */
- {".init", 't'}, /* ELF init section */
- {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */
- {".rdata", 'r'}, /* Read only data. */
- {".rodata", 'r'}, /* Read only data. */
- {".sbss", 's'}, /* Small BSS (uninitialized data). */
- {".scommon", 'c'}, /* Small common. */
- {".sdata", 'g'}, /* Small initialized data. */
- {".text", 't'},
- {"vars", 'd'}, /* MRI .data */
- {"zerovars", 'b'}, /* MRI .bss */
- {0, 0}
-};
-
-/* Return the single-character symbol type corresponding to
- section S, or '?' for an unknown COFF section.
-
- Check for any leading string which matches, so .text5 returns
- 't' as well as .text */
-
-static char
-coff_section_type (const char *s)
-{
- const struct section_to_type *t;
-
- for (t = &stt[0]; t->section; t++)
- if (!strncmp (s, t->section, strlen (t->section)))
- return t->type;
-
- return '?';
-}
-
-/* Return the single-character symbol type corresponding to section
- SECTION, or '?' for an unknown section. This uses section flags to
- identify sections.
-
- FIXME These types are unhandled: c, i, e, p. If we handled these also,
- we could perhaps obsolete coff_section_type. */
-
-static char
-decode_section_type (const struct bfd_section *section)
-{
- if (section->flags & SEC_CODE)
- return 't';
- if (section->flags & SEC_DATA)
- {
- if (section->flags & SEC_READONLY)
- return 'r';
- else if (section->flags & SEC_SMALL_DATA)
- return 'g';
- else
- return 'd';
- }
- if ((section->flags & SEC_HAS_CONTENTS) == 0)
- {
- if (section->flags & SEC_SMALL_DATA)
- return 's';
- else
- return 'b';
- }
- if (section->flags & SEC_DEBUGGING)
- return 'N';
- if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_READONLY))
- return 'n';
-
- return '?';
-}
-
-/*
-FUNCTION
- bfd_decode_symclass
-
-DESCRIPTION
- Return a character corresponding to the symbol
- class of @var{symbol}, or '?' for an unknown class.
-
-SYNOPSIS
- int bfd_decode_symclass (asymbol *symbol);
-*/
-int
-bfd_decode_symclass (asymbol *symbol)
-{
- char c;
-
- if (bfd_is_com_section (symbol->section))
- return 'C';
- if (bfd_is_und_section (symbol->section))
- {
- if (symbol->flags & BSF_WEAK)
- {
- /* If weak, determine if it's specifically an object
- or non-object weak. */
- if (symbol->flags & BSF_OBJECT)
- return 'v';
- else
- return 'w';
- }
- else
- return 'U';
- }
- if (bfd_is_ind_section (symbol->section))
- return 'I';
- if (symbol->flags & BSF_WEAK)
- {
- /* If weak, determine if it's specifically an object
- or non-object weak. */
- if (symbol->flags & BSF_OBJECT)
- return 'V';
- else
- return 'W';
- }
- if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
- return '?';
-
- if (bfd_is_abs_section (symbol->section))
- c = 'a';
- else if (symbol->section)
- {
- c = coff_section_type (symbol->section->name);
- if (c == '?')
- c = decode_section_type (symbol->section);
- }
- else
- return '?';
- if (symbol->flags & BSF_GLOBAL)
- c = TOUPPER (c);
- return c;
-
- /* We don't have to handle these cases just yet, but we will soon:
- N_SETV: 'v';
- N_SETA: 'l';
- N_SETT: 'x';
- N_SETD: 'z';
- N_SETB: 's';
- N_INDR: 'i';
- */
-}
-
-/*
-FUNCTION
- bfd_is_undefined_symclass
-
-DESCRIPTION
- Returns non-zero if the class symbol returned by
- bfd_decode_symclass represents an undefined symbol.
- Returns zero otherwise.
-
-SYNOPSIS
- bfd_boolean bfd_is_undefined_symclass (int symclass);
-*/
-
-bfd_boolean
-bfd_is_undefined_symclass (int symclass)
-{
- return symclass == 'U' || symclass == 'w' || symclass == 'v';
-}
-
-/*
-FUNCTION
- bfd_symbol_info
-
-DESCRIPTION
- Fill in the basic info about symbol that nm needs.
- Additional info may be added by the back-ends after
- calling this function.
-
-SYNOPSIS
- void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-*/
-
-void
-bfd_symbol_info (asymbol *symbol, symbol_info *ret)
-{
- ret->type = bfd_decode_symclass (symbol);
-
- if (bfd_is_undefined_symclass (ret->type))
- ret->value = 0;
- else
- ret->value = symbol->value + symbol->section->vma;
-
- ret->name = symbol->name;
-}
-
-/*
-FUNCTION
- bfd_copy_private_symbol_data
-
-SYNOPSIS
- bfd_boolean bfd_copy_private_symbol_data
- (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
-
-DESCRIPTION
- Copy private symbol information from @var{isym} in the BFD
- @var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
- Return <<TRUE>> on success, <<FALSE>> on error. Possible error
- returns are:
-
- o <<bfd_error_no_memory>> -
- Not enough memory exists to create private data for @var{osec}.
-
-.#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
-. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
-. (ibfd, isymbol, obfd, osymbol))
-.
-*/
-
-/* The generic version of the function which returns mini symbols.
- This is used when the backend does not provide a more efficient
- version. It just uses BFD asymbol structures as mini symbols. */
-
-long
-_bfd_generic_read_minisymbols (bfd *abfd,
- bfd_boolean dynamic,
- void **minisymsp,
- unsigned int *sizep)
-{
- long storage;
- asymbol **syms = NULL;
- long symcount;
-
- if (dynamic)
- storage = bfd_get_dynamic_symtab_upper_bound (abfd);
- else
- storage = bfd_get_symtab_upper_bound (abfd);
- if (storage < 0)
- goto error_return;
- if (storage == 0)
- return 0;
-
- syms = bfd_malloc (storage);
- if (syms == NULL)
- goto error_return;
-
- if (dynamic)
- symcount = bfd_canonicalize_dynamic_symtab (abfd, syms);
- else
- symcount = bfd_canonicalize_symtab (abfd, syms);
- if (symcount < 0)
- goto error_return;
-
- *minisymsp = syms;
- *sizep = sizeof (asymbol *);
- return symcount;
-
- error_return:
- bfd_set_error (bfd_error_no_symbols);
- if (syms != NULL)
- free (syms);
- return -1;
-}
-
-/* The generic version of the function which converts a minisymbol to
- an asymbol. We don't worry about the sym argument we are passed;
- we just return the asymbol the minisymbol points to. */
-
-asymbol *
-_bfd_generic_minisymbol_to_symbol (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean dynamic ATTRIBUTE_UNUSED,
- const void *minisym,
- asymbol *sym ATTRIBUTE_UNUSED)
-{
- return *(asymbol **) minisym;
-}
-
-/* Look through stabs debugging information in .stab and .stabstr
- sections to find the source file and line closest to a desired
- location. This is used by COFF and ELF targets. It sets *pfound
- to TRUE if it finds some information. The *pinfo field is used to
- pass cached information in and out of this routine; this first time
- the routine is called for a BFD, *pinfo should be NULL. The value
- placed in *pinfo should be saved with the BFD, and passed back each
- time this function is called. */
-
-/* We use a cache by default. */
-
-#define ENABLE_CACHING
-
-/* We keep an array of indexentry structures to record where in the
- stabs section we should look to find line number information for a
- particular address. */
-
-struct indexentry
-{
- bfd_vma val;
- bfd_byte *stab;
- bfd_byte *str;
- char *directory_name;
- char *file_name;
- char *function_name;
-};
-
-/* Compare two indexentry structures. This is called via qsort. */
-
-static int
-cmpindexentry (const void *a, const void *b)
-{
- const struct indexentry *contestantA = a;
- const struct indexentry *contestantB = b;
-
- if (contestantA->val < contestantB->val)
- return -1;
- else if (contestantA->val > contestantB->val)
- return 1;
- else
- return 0;
-}
-
-/* A pointer to this structure is stored in *pinfo. */
-
-struct stab_find_info
-{
- /* The .stab section. */
- asection *stabsec;
- /* The .stabstr section. */
- asection *strsec;
- /* The contents of the .stab section. */
- bfd_byte *stabs;
- /* The contents of the .stabstr section. */
- bfd_byte *strs;
-
- /* A table that indexes stabs by memory address. */
- struct indexentry *indextable;
- /* The number of entries in indextable. */
- int indextablesize;
-
-#ifdef ENABLE_CACHING
- /* Cached values to restart quickly. */
- struct indexentry *cached_indexentry;
- bfd_vma cached_offset;
- bfd_byte *cached_stab;
- char *cached_file_name;
-#endif
-
- /* Saved ptr to malloc'ed filename. */
- char *filename;
-};
-
-bfd_boolean
-_bfd_stab_section_find_nearest_line (bfd *abfd,
- asymbol **symbols,
- asection *section,
- bfd_vma offset,
- bfd_boolean *pfound,
- const char **pfilename,
- const char **pfnname,
- unsigned int *pline,
- void **pinfo)
-{
- struct stab_find_info *info;
- bfd_size_type stabsize, strsize;
- bfd_byte *stab, *str;
- bfd_byte *last_stab = NULL;
- bfd_size_type stroff;
- struct indexentry *indexentry;
- char *file_name;
- char *directory_name;
- int saw_fun;
- bfd_boolean saw_line, saw_func;
-
- *pfound = FALSE;
- *pfilename = bfd_get_filename (abfd);
- *pfnname = NULL;
- *pline = 0;
-
- /* Stabs entries use a 12 byte format:
- 4 byte string table index
- 1 byte stab type
- 1 byte stab other field
- 2 byte stab desc field
- 4 byte stab value
- FIXME: This will have to change for a 64 bit object format.
-
- The stabs symbols are divided into compilation units. For the
- first entry in each unit, the type of 0, the value is the length
- of the string table for this unit, and the desc field is the
- number of stabs symbols for this unit. */
-
-#define STRDXOFF (0)
-#define TYPEOFF (4)
-#define OTHEROFF (5)
-#define DESCOFF (6)
-#define VALOFF (8)
-#define STABSIZE (12)
-
- info = *pinfo;
- if (info != NULL)
- {
- if (info->stabsec == NULL || info->strsec == NULL)
- {
- /* No stabs debugging information. */
- return TRUE;
- }
-
- stabsize = info->stabsec->_raw_size;
- strsize = info->strsec->_raw_size;
- }
- else
- {
- long reloc_size, reloc_count;
- arelent **reloc_vector;
- int i;
- char *name;
- char *function_name;
- bfd_size_type amt = sizeof *info;
-
- info = bfd_zalloc (abfd, amt);
- if (info == NULL)
- return FALSE;
-
- /* FIXME: When using the linker --split-by-file or
- --split-by-reloc options, it is possible for the .stab and
- .stabstr sections to be split. We should handle that. */
-
- info->stabsec = bfd_get_section_by_name (abfd, ".stab");
- info->strsec = bfd_get_section_by_name (abfd, ".stabstr");
-
- if (info->stabsec == NULL || info->strsec == NULL)
- {
- /* No stabs debugging information. Set *pinfo so that we
- can return quickly in the info != NULL case above. */
- *pinfo = info;
- return TRUE;
- }
-
- stabsize = info->stabsec->_raw_size;
- strsize = info->strsec->_raw_size;
-
- info->stabs = bfd_alloc (abfd, stabsize);
- info->strs = bfd_alloc (abfd, strsize);
- if (info->stabs == NULL || info->strs == NULL)
- return FALSE;
-
- if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs,
- (bfd_vma) 0, stabsize)
- || ! bfd_get_section_contents (abfd, info->strsec, info->strs,
- (bfd_vma) 0, strsize))
- return FALSE;
-
- /* If this is a relocatable object file, we have to relocate
- the entries in .stab. This should always be simple 32 bit
- relocations against symbols defined in this object file, so
- this should be no big deal. */
- reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
- if (reloc_size < 0)
- return FALSE;
- reloc_vector = bfd_malloc (reloc_size);
- if (reloc_vector == NULL && reloc_size != 0)
- return FALSE;
- reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
- symbols);
- if (reloc_count < 0)
- {
- if (reloc_vector != NULL)
- free (reloc_vector);
- return FALSE;
- }
- if (reloc_count > 0)
- {
- arelent **pr;
-
- for (pr = reloc_vector; *pr != NULL; pr++)
- {
- arelent *r;
- unsigned long val;
- asymbol *sym;
-
- r = *pr;
- if (r->howto->rightshift != 0
- || r->howto->size != 2
- || r->howto->bitsize != 32
- || r->howto->pc_relative
- || r->howto->bitpos != 0
- || r->howto->dst_mask != 0xffffffff)
- {
- (*_bfd_error_handler)
- (_("Unsupported .stab relocation"));
- bfd_set_error (bfd_error_invalid_operation);
- if (reloc_vector != NULL)
- free (reloc_vector);
- return FALSE;
- }
-
- val = bfd_get_32 (abfd, info->stabs + r->address);
- val &= r->howto->src_mask;
- sym = *r->sym_ptr_ptr;
- val += sym->value + sym->section->vma + r->addend;
- bfd_put_32 (abfd, (bfd_vma) val, info->stabs + r->address);
- }
- }
-
- if (reloc_vector != NULL)
- free (reloc_vector);
-
- /* First time through this function, build a table matching
- function VM addresses to stabs, then sort based on starting
- VM address. Do this in two passes: once to count how many
- table entries we'll need, and a second to actually build the
- table. */
-
- info->indextablesize = 0;
- saw_fun = 1;
- for (stab = info->stabs; stab < info->stabs + stabsize; stab += STABSIZE)
- {
- if (stab[TYPEOFF] == (bfd_byte) N_SO)
- {
- /* N_SO with null name indicates EOF */
- if (bfd_get_32 (abfd, stab + STRDXOFF) == 0)
- continue;
-
- /* if we did not see a function def, leave space for one. */
- if (saw_fun == 0)
- ++info->indextablesize;
-
- saw_fun = 0;
-
- /* two N_SO's in a row is a filename and directory. Skip */
- if (stab + STABSIZE < info->stabs + stabsize
- && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO)
- {
- stab += STABSIZE;
- }
- }
- else if (stab[TYPEOFF] == (bfd_byte) N_FUN)
- {
- saw_fun = 1;
- ++info->indextablesize;
- }
- }
-
- if (saw_fun == 0)
- ++info->indextablesize;
-
- if (info->indextablesize == 0)
- return TRUE;
- ++info->indextablesize;
-
- amt = info->indextablesize;
- amt *= sizeof (struct indexentry);
- info->indextable = bfd_alloc (abfd, amt);
- if (info->indextable == NULL)
- return FALSE;
-
- file_name = NULL;
- directory_name = NULL;
- saw_fun = 1;
-
- for (i = 0, stroff = 0, stab = info->stabs, str = info->strs;
- i < info->indextablesize && stab < info->stabs + stabsize;
- stab += STABSIZE)
- {
- switch (stab[TYPEOFF])
- {
- case 0:
- /* This is the first entry in a compilation unit. */
- if ((bfd_size_type) ((info->strs + strsize) - str) < stroff)
- break;
- str += stroff;
- stroff = bfd_get_32 (abfd, stab + VALOFF);
- break;
-
- case N_SO:
- /* The main file name. */
-
- /* The following code creates a new indextable entry with
- a NULL function name if there were no N_FUNs in a file.
- Note that a N_SO without a file name is an EOF and
- there could be 2 N_SO following it with the new filename
- and directory. */
- if (saw_fun == 0)
- {
- info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
- info->indextable[i].stab = last_stab;
- info->indextable[i].str = str;
- info->indextable[i].directory_name = directory_name;
- info->indextable[i].file_name = file_name;
- info->indextable[i].function_name = NULL;
- ++i;
- }
- saw_fun = 0;
-
- file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
- if (*file_name == '\0')
- {
- directory_name = NULL;
- file_name = NULL;
- saw_fun = 1;
- }
- else
- {
- last_stab = stab;
- if (stab + STABSIZE >= info->stabs + stabsize
- || *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO)
- {
- directory_name = NULL;
- }
- else
- {
- /* Two consecutive N_SOs are a directory and a
- file name. */
- stab += STABSIZE;
- directory_name = file_name;
- file_name = ((char *) str
- + bfd_get_32 (abfd, stab + STRDXOFF));
- }
- }
- break;
-
- case N_SOL:
- /* The name of an include file. */
- file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
- break;
-
- case N_FUN:
- /* A function name. */
- saw_fun = 1;
- name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
-
- if (*name == '\0')
- name = NULL;
-
- function_name = name;
-
- if (name == NULL)
- continue;
-
- info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF);
- info->indextable[i].stab = stab;
- info->indextable[i].str = str;
- info->indextable[i].directory_name = directory_name;
- info->indextable[i].file_name = file_name;
- info->indextable[i].function_name = function_name;
- ++i;
- break;
- }
- }
-
- if (saw_fun == 0)
- {
- info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
- info->indextable[i].stab = last_stab;
- info->indextable[i].str = str;
- info->indextable[i].directory_name = directory_name;
- info->indextable[i].file_name = file_name;
- info->indextable[i].function_name = NULL;
- ++i;
- }
-
- info->indextable[i].val = (bfd_vma) -1;
- info->indextable[i].stab = info->stabs + stabsize;
- info->indextable[i].str = str;
- info->indextable[i].directory_name = NULL;
- info->indextable[i].file_name = NULL;
- info->indextable[i].function_name = NULL;
- ++i;
-
- info->indextablesize = i;
- qsort (info->indextable, (size_t) i, sizeof (struct indexentry),
- cmpindexentry);
-
- *pinfo = info;
- }
-
- /* We are passed a section relative offset. The offsets in the
- stabs information are absolute. */
- offset += bfd_get_section_vma (abfd, section);
-
-#ifdef ENABLE_CACHING
- if (info->cached_indexentry != NULL
- && offset >= info->cached_offset
- && offset < (info->cached_indexentry + 1)->val)
- {
- stab = info->cached_stab;
- indexentry = info->cached_indexentry;
- file_name = info->cached_file_name;
- }
- else
-#endif
- {
- long low, high;
- long mid = -1;
-
- /* Cache non-existent or invalid. Do binary search on
- indextable. */
- indexentry = NULL;
-
- low = 0;
- high = info->indextablesize - 1;
- while (low != high)
- {
- mid = (high + low) / 2;
- if (offset >= info->indextable[mid].val
- && offset < info->indextable[mid + 1].val)
- {
- indexentry = &info->indextable[mid];
- break;
- }
-
- if (info->indextable[mid].val > offset)
- high = mid;
- else
- low = mid + 1;
- }
-
- if (indexentry == NULL)
- return TRUE;
-
- stab = indexentry->stab + STABSIZE;
- file_name = indexentry->file_name;
- }
-
- directory_name = indexentry->directory_name;
- str = indexentry->str;
-
- saw_line = FALSE;
- saw_func = FALSE;
- for (; stab < (indexentry+1)->stab; stab += STABSIZE)
- {
- bfd_boolean done;
- bfd_vma val;
-
- done = FALSE;
-
- switch (stab[TYPEOFF])
- {
- case N_SOL:
- /* The name of an include file. */
- val = bfd_get_32 (abfd, stab + VALOFF);
- if (val <= offset)
- {
- file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
- *pline = 0;
- }
- break;
-
- case N_SLINE:
- case N_DSLINE:
- case N_BSLINE:
- /* A line number. If the function was specified, then the value
- is relative to the start of the function. Otherwise, the
- value is an absolute address. */
- val = ((indexentry->function_name ? indexentry->val : 0)
- + bfd_get_32 (abfd, stab + VALOFF));
- /* If this line starts before our desired offset, or if it's
- the first line we've been able to find, use it. The
- !saw_line check works around a bug in GCC 2.95.3, which emits
- the first N_SLINE late. */
- if (!saw_line || val <= offset)
- {
- *pline = bfd_get_16 (abfd, stab + DESCOFF);
-
-#ifdef ENABLE_CACHING
- info->cached_stab = stab;
- info->cached_offset = val;
- info->cached_file_name = file_name;
- info->cached_indexentry = indexentry;
-#endif
- }
- if (val > offset)
- done = TRUE;
- saw_line = TRUE;
- break;
-
- case N_FUN:
- case N_SO:
- if (saw_func || saw_line)
- done = TRUE;
- saw_func = TRUE;
- break;
- }
-
- if (done)
- break;
- }
-
- *pfound = TRUE;
-
- if (file_name == NULL || IS_ABSOLUTE_PATH (file_name)
- || directory_name == NULL)
- *pfilename = file_name;
- else
- {
- size_t dirlen;
-
- dirlen = strlen (directory_name);
- if (info->filename == NULL
- || strncmp (info->filename, directory_name, dirlen) != 0
- || strcmp (info->filename + dirlen, file_name) != 0)
- {
- size_t len;
-
- if (info->filename != NULL)
- free (info->filename);
- len = strlen (file_name) + 1;
- info->filename = bfd_malloc (dirlen + len);
- if (info->filename == NULL)
- return FALSE;
- memcpy (info->filename, directory_name, dirlen);
- memcpy (info->filename + dirlen, file_name, len);
- }
-
- *pfilename = info->filename;
- }
-
- if (indexentry->function_name != NULL)
- {
- char *s;
-
- /* This will typically be something like main:F(0,1), so we want
- to clobber the colon. It's OK to change the name, since the
- string is in our own local storage anyhow. */
- s = strchr (indexentry->function_name, ':');
- if (s != NULL)
- *s = '\0';
-
- *pfnname = indexentry->function_name;
- }
-
- return TRUE;
-}
diff --git a/contrib/binutils/bfd/sysdep.h b/contrib/binutils/bfd/sysdep.h
deleted file mode 100644
index 1954470..0000000
--- a/contrib/binutils/bfd/sysdep.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* sysdep.h -- handle host dependencies for the BFD library
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef BFD_SYSDEP_H
-#define BFD_SYSDEP_H
-
-#include "ansidecl.h"
-
-#include "config.h"
-
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
-extern int errno;
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#else
-extern char *strchr ();
-extern char *strrchr ();
-#endif
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef USE_BINARY_FOPEN
-#include "fopen-bin.h"
-#else
-#include "fopen-same.h"
-#endif
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#else
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-#endif
-
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-#ifndef O_WRONLY
-#define O_WRONLY 1
-#endif
-#ifndef O_RDWR
-#define O_RDWR 2
-#endif
-#ifndef O_ACCMODE
-#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-
-#include "filenames.h"
-
-#ifdef NEED_DECLARATION_STRSTR
-extern char *strstr ();
-#endif
-
-#ifdef NEED_DECLARATION_MALLOC
-extern PTR malloc ();
-#endif
-
-#ifdef NEED_DECLARATION_REALLOC
-extern PTR realloc ();
-#endif
-
-#ifdef NEED_DECLARATION_FREE
-extern void free ();
-#endif
-
-#ifdef NEED_DECLARATION_GETENV
-extern char *getenv ();
-#endif
-
-/* Define offsetof for those systems which lack it */
-
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
-#ifdef ENABLE_NLS
-#include <libintl.h>
-/* Note the use of dgetext() and PACKAGE here, rather than gettext().
-
- This is because the code in this directory is used to build a library which
- will be linked with code in other directories to form programs. We want to
- maintain a seperate translation file for this directory however, rather
- than being forced to merge it with that of any program linked to libbfd.
- This is a library, so it cannot depend on the catalog currently loaded.
-
- In order to do this, we have to make sure that when we extract messages we
- use the OPCODES domain rather than the domain of the program that included
- the bfd library, (eg OBJDUMP). Hence we use dgettext (PACKAGE, String)
- and define PACKAGE to be 'bfd'. (See the code in configure). */
-#define _(String) dgettext (PACKAGE, String)
-#ifdef gettext_noop
-#define N_(String) gettext_noop (String)
-#else
-#define N_(String) (String)
-#endif
-#else
-# define gettext(Msgid) (Msgid)
-# define dgettext(Domainname, Msgid) (Msgid)
-# define dcgettext(Domainname, Msgid, Category) (Msgid)
-# define textdomain(Domainname) while (0) /* nothing */
-# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
-# define _(String) (String)
-# define N_(String) (String)
-#endif
-
-#endif /* ! defined (BFD_SYSDEP_H) */
diff --git a/contrib/binutils/bfd/targets.c b/contrib/binutils/bfd/targets.c
deleted file mode 100644
index cec339c..0000000
--- a/contrib/binutils/bfd/targets.c
+++ /dev/null
@@ -1,1349 +0,0 @@
-/* Generic target-file-type support for the BFD library.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "fnmatch.h"
-
-/*
-SECTION
- Targets
-
-DESCRIPTION
- Each port of BFD to a different machine requires the creation
- of a target back end. All the back end provides to the root
- part of BFD is a structure containing pointers to functions
- which perform certain low level operations on files. BFD
- translates the applications's requests through a pointer into
- calls to the back end routines.
-
- When a file is opened with <<bfd_openr>>, its format and
- target are unknown. BFD uses various mechanisms to determine
- how to interpret the file. The operations performed are:
-
- o Create a BFD by calling the internal routine
- <<_bfd_new_bfd>>, then call <<bfd_find_target>> with the
- target string supplied to <<bfd_openr>> and the new BFD pointer.
-
- o If a null target string was provided to <<bfd_find_target>>,
- look up the environment variable <<GNUTARGET>> and use
- that as the target string.
-
- o If the target string is still <<NULL>>, or the target string is
- <<default>>, then use the first item in the target vector
- as the target type, and set <<target_defaulted>> in the BFD to
- cause <<bfd_check_format>> to loop through all the targets.
- @xref{bfd_target}. @xref{Formats}.
-
- o Otherwise, inspect the elements in the target vector
- one by one, until a match on target name is found. When found,
- use it.
-
- o Otherwise return the error <<bfd_error_invalid_target>> to
- <<bfd_openr>>.
-
- o <<bfd_openr>> attempts to open the file using
- <<bfd_open_file>>, and returns the BFD.
-
- Once the BFD has been opened and the target selected, the file
- format may be determined. This is done by calling
- <<bfd_check_format>> on the BFD with a suggested format.
- If <<target_defaulted>> has been set, each possible target
- type is tried to see if it recognizes the specified format.
- <<bfd_check_format>> returns <<TRUE>> when the caller guesses right.
-@menu
-@* bfd_target::
-@end menu
-*/
-
-/*
-
-INODE
- bfd_target, , Targets, Targets
-DOCDD
-SUBSECTION
- bfd_target
-
-DESCRIPTION
- This structure contains everything that BFD knows about a
- target. It includes things like its byte order, name, and which
- routines to call to do various operations.
-
- Every BFD points to a target structure with its <<xvec>>
- member.
-
- The macros below are used to dispatch to functions through the
- <<bfd_target>> vector. They are used in a number of macros further
- down in @file{bfd.h}, and are also used when calling various
- routines by hand inside the BFD implementation. The @var{arglist}
- argument must be parenthesized; it contains all the arguments
- to the called function.
-
- They make the documentation (more) unpleasant to read, so if
- someone wants to fix this and not break the above, please do.
-
-.#define BFD_SEND(bfd, message, arglist) \
-. ((*((bfd)->xvec->message)) arglist)
-.
-.#ifdef DEBUG_BFD_SEND
-.#undef BFD_SEND
-.#define BFD_SEND(bfd, message, arglist) \
-. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-. ((*((bfd)->xvec->message)) arglist) : \
-. (bfd_assert (__FILE__,__LINE__), NULL))
-.#endif
-
- For operations which index on the BFD format:
-
-.#define BFD_SEND_FMT(bfd, message, arglist) \
-. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-.
-.#ifdef DEBUG_BFD_SEND
-.#undef BFD_SEND_FMT
-.#define BFD_SEND_FMT(bfd, message, arglist) \
-. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
-. (bfd_assert (__FILE__,__LINE__), NULL))
-.#endif
-.
- This is the structure which defines the type of BFD this is. The
- <<xvec>> member of the struct <<bfd>> itself points here. Each
- module that implements access to a different target under BFD,
- defines one of these.
-
- FIXME, these names should be rationalised with the names of
- the entry points which call them. Too bad we can't have one
- macro to define them both!
-
-.enum bfd_flavour
-.{
-. bfd_target_unknown_flavour,
-. bfd_target_aout_flavour,
-. bfd_target_coff_flavour,
-. bfd_target_ecoff_flavour,
-. bfd_target_xcoff_flavour,
-. bfd_target_elf_flavour,
-. bfd_target_ieee_flavour,
-. bfd_target_nlm_flavour,
-. bfd_target_oasys_flavour,
-. bfd_target_tekhex_flavour,
-. bfd_target_srec_flavour,
-. bfd_target_ihex_flavour,
-. bfd_target_som_flavour,
-. bfd_target_os9k_flavour,
-. bfd_target_versados_flavour,
-. bfd_target_msdos_flavour,
-. bfd_target_ovax_flavour,
-. bfd_target_evax_flavour,
-. bfd_target_mmo_flavour,
-. bfd_target_mach_o_flavour,
-. bfd_target_pef_flavour,
-. bfd_target_pef_xlib_flavour,
-. bfd_target_sym_flavour
-.};
-.
-.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-.
-.{* Forward declaration. *}
-.typedef struct bfd_link_info _bfd_link_info;
-.
-.typedef struct bfd_target
-.{
-. {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. *}
-. char *name;
-.
-. {* The "flavour" of a back end is a general indication about
-. the contents of a file. *}
-. enum bfd_flavour flavour;
-.
-. {* The order of bytes within the data area of a file. *}
-. enum bfd_endian byteorder;
-.
-. {* The order of bytes within the header parts of a file. *}
-. enum bfd_endian header_byteorder;
-.
-. {* A mask of all the flags which an executable may have set -
-. from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>. *}
-. flagword object_flags;
-.
-. {* A mask of all the flags which a section may have set - from
-. the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>. *}
-. flagword section_flags;
-.
-. {* The character normally found at the front of a symbol.
-. (if any), perhaps `_'. *}
-. char symbol_leading_char;
-.
-. {* The pad character for file names within an archive header. *}
-. char ar_pad_char;
-.
-. {* The maximum number of characters in an archive header. *}
-. unsigned short ar_max_namelen;
-.
-. {* Entries for byte swapping for data. These are different from the
-. other entry points, since they don't take a BFD asthe first argument.
-. Certain other handlers could do the same. *}
-. bfd_uint64_t (*bfd_getx64) (const void *);
-. bfd_int64_t (*bfd_getx_signed_64) (const void *);
-. void (*bfd_putx64) (bfd_uint64_t, void *);
-. bfd_vma (*bfd_getx32) (const void *);
-. bfd_signed_vma (*bfd_getx_signed_32) (const void *);
-. void (*bfd_putx32) (bfd_vma, void *);
-. bfd_vma (*bfd_getx16) (const void *);
-. bfd_signed_vma (*bfd_getx_signed_16) (const void *);
-. void (*bfd_putx16) (bfd_vma, void *);
-.
-. {* Byte swapping for the headers. *}
-. bfd_uint64_t (*bfd_h_getx64) (const void *);
-. bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
-. void (*bfd_h_putx64) (bfd_uint64_t, void *);
-. bfd_vma (*bfd_h_getx32) (const void *);
-. bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
-. void (*bfd_h_putx32) (bfd_vma, void *);
-. bfd_vma (*bfd_h_getx16) (const void *);
-. bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
-. void (*bfd_h_putx16) (bfd_vma, void *);
-.
-. {* Format dependent routines: these are vectors of entry points
-. within the target vector structure, one for each format to check. *}
-.
-. {* Check the format of a file being read. Return a <<bfd_target *>> or zero. *}
-. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
-.
-. {* Set the format of a file being written. *}
-. bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
-.
-. {* Write cached information into a file being written, at <<bfd_close>>. *}
-. bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
-.
-The general target vector. These vectors are initialized using the
-BFD_JUMP_TABLE macros.
-.
-. {* Generic entry points. *}
-.#define BFD_JUMP_TABLE_GENERIC(NAME) \
-. NAME##_close_and_cleanup, \
-. NAME##_bfd_free_cached_info, \
-. NAME##_new_section_hook, \
-. NAME##_get_section_contents, \
-. NAME##_get_section_contents_in_window
-.
-. {* Called when the BFD is being closed to do any necessary cleanup. *}
-. bfd_boolean (*_close_and_cleanup) (bfd *);
-. {* Ask the BFD to free all cached information. *}
-. bfd_boolean (*_bfd_free_cached_info) (bfd *);
-. {* Called when a new section is created. *}
-. bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
-. {* Read the contents of a section. *}
-. bfd_boolean (*_bfd_get_section_contents)
-. (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
-. bfd_boolean (*_bfd_get_section_contents_in_window)
-. (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
-.
-. {* Entry points to copy private data. *}
-.#define BFD_JUMP_TABLE_COPY(NAME) \
-. NAME##_bfd_copy_private_bfd_data, \
-. NAME##_bfd_merge_private_bfd_data, \
-. NAME##_bfd_copy_private_section_data, \
-. NAME##_bfd_copy_private_symbol_data, \
-. NAME##_bfd_set_private_flags, \
-. NAME##_bfd_print_private_bfd_data
-.
-. {* Called to copy BFD general private data from one object file
-. to another. *}
-. bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
-. {* Called to merge BFD general private data from one object file
-. to a common output file when linking. *}
-. bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
-. {* Called to copy BFD private section data from one object file
-. to another. *}
-. bfd_boolean (*_bfd_copy_private_section_data)
-. (bfd *, sec_ptr, bfd *, sec_ptr);
-. {* Called to copy BFD private symbol data from one symbol
-. to another. *}
-. bfd_boolean (*_bfd_copy_private_symbol_data)
-. (bfd *, asymbol *, bfd *, asymbol *);
-. {* Called to set private backend flags. *}
-. bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
-.
-. {* Called to print private BFD data. *}
-. bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
-.
-. {* Core file entry points. *}
-.#define BFD_JUMP_TABLE_CORE(NAME) \
-. NAME##_core_file_failing_command, \
-. NAME##_core_file_failing_signal, \
-. NAME##_core_file_matches_executable_p
-.
-. char * (*_core_file_failing_command) (bfd *);
-. int (*_core_file_failing_signal) (bfd *);
-. bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
-.
-. {* Archive entry points. *}
-.#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
-. NAME##_slurp_armap, \
-. NAME##_slurp_extended_name_table, \
-. NAME##_construct_extended_name_table, \
-. NAME##_truncate_arname, \
-. NAME##_write_armap, \
-. NAME##_read_ar_hdr, \
-. NAME##_openr_next_archived_file, \
-. NAME##_get_elt_at_index, \
-. NAME##_generic_stat_arch_elt, \
-. NAME##_update_armap_timestamp
-.
-. bfd_boolean (*_bfd_slurp_armap) (bfd *);
-. bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
-. bfd_boolean (*_bfd_construct_extended_name_table)
-. (bfd *, char **, bfd_size_type *, const char **);
-. void (*_bfd_truncate_arname) (bfd *, const char *, char *);
-. bfd_boolean (*write_armap)
-. (bfd *, unsigned int, struct orl *, unsigned int, int);
-. void * (*_bfd_read_ar_hdr_fn) (bfd *);
-. bfd * (*openr_next_archived_file) (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) (bfd *, symindex);
-. int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
-. bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
-.
-. {* Entry points used for symbols. *}
-.#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
-. NAME##_get_symtab_upper_bound, \
-. NAME##_canonicalize_symtab, \
-. NAME##_make_empty_symbol, \
-. NAME##_print_symbol, \
-. NAME##_get_symbol_info, \
-. NAME##_bfd_is_local_label_name, \
-. NAME##_get_lineno, \
-. NAME##_find_nearest_line, \
-. NAME##_bfd_make_debug_symbol, \
-. NAME##_read_minisymbols, \
-. NAME##_minisymbol_to_symbol
-.
-. long (*_bfd_get_symtab_upper_bound) (bfd *);
-. long (*_bfd_canonicalize_symtab)
-. (bfd *, struct bfd_symbol **);
-. struct bfd_symbol *
-. (*_bfd_make_empty_symbol) (bfd *);
-. void (*_bfd_print_symbol)
-. (bfd *, void *, struct bfd_symbol *, 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)
-. (bfd *, struct bfd_symbol *, symbol_info *);
-.#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
-. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
-.
-. alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
-. bfd_boolean (*_bfd_find_nearest_line)
-. (bfd *, struct bfd_section *, struct bfd_symbol **, 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)
-. (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)
-. (bfd *, bfd_boolean, void **, 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)
-. (bfd *, bfd_boolean, const void *, asymbol *);
-.
-. {* Routines for relocs. *}
-.#define BFD_JUMP_TABLE_RELOCS(NAME) \
-. NAME##_get_reloc_upper_bound, \
-. NAME##_canonicalize_reloc, \
-. NAME##_bfd_reloc_type_lookup
-.
-. long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
-. long (*_bfd_canonicalize_reloc)
-. (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
-. {* See documentation on reloc types. *}
-. reloc_howto_type *
-. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
-.
-. {* Routines used when writing an object file. *}
-.#define BFD_JUMP_TABLE_WRITE(NAME) \
-. NAME##_set_arch_mach, \
-. NAME##_set_section_contents
-.
-. bfd_boolean (*_bfd_set_arch_mach)
-. (bfd *, enum bfd_architecture, unsigned long);
-. bfd_boolean (*_bfd_set_section_contents)
-. (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-.
-. {* Routines used by the linker. *}
-.#define BFD_JUMP_TABLE_LINK(NAME) \
-. NAME##_sizeof_headers, \
-. NAME##_bfd_get_relocated_section_contents, \
-. NAME##_bfd_relax_section, \
-. NAME##_bfd_link_hash_table_create, \
-. NAME##_bfd_link_hash_table_free, \
-. NAME##_bfd_link_add_symbols, \
-. NAME##_bfd_link_just_syms, \
-. NAME##_bfd_final_link, \
-. NAME##_bfd_link_split_section, \
-. NAME##_bfd_gc_sections, \
-. NAME##_bfd_merge_sections, \
-. NAME##_bfd_discard_group
-.
-. int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
-. bfd_byte * (*_bfd_get_relocated_section_contents)
-. (bfd *, struct bfd_link_info *, struct bfd_link_order *,
-. bfd_byte *, bfd_boolean, struct bfd_symbol **);
-.
-. bfd_boolean (*_bfd_relax_section)
-. (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_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) (bfd *);
-.
-. {* Release the memory associated with the linker hash table. *}
-. void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
-.
-. {* Add symbols from this object file into the hash table. *}
-. bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
-.
-. {* Indicate that we are only retrieving symbol values from this section. *}
-. void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
-.
-. {* Do a link based on the link_order structures attached to each
-. section of the BFD. *}
-. bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
-.
-. {* Should this section be split up into smaller pieces during linking. *}
-. bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
-.
-. {* Remove sections that are not referenced from the output. *}
-. bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
-.
-. {* Attempt to merge SEC_MERGE sections. *}
-. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
-.
-. {* Discard members of a group. *}
-. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
-.
-. {* Routines to handle dynamic symbols and relocs. *}
-.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
-. NAME##_get_dynamic_symtab_upper_bound, \
-. NAME##_canonicalize_dynamic_symtab, \
-. NAME##_get_dynamic_reloc_upper_bound, \
-. NAME##_canonicalize_dynamic_reloc
-.
-. {* Get the amount of memory required to hold the dynamic symbols. *}
-. long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
-. {* Read in the dynamic symbols. *}
-. long (*_bfd_canonicalize_dynamic_symtab)
-. (bfd *, struct bfd_symbol **);
-. {* Get the amount of memory required to hold the dynamic relocs. *}
-. long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
-. {* Read in the dynamic relocs. *}
-. long (*_bfd_canonicalize_dynamic_reloc)
-. (bfd *, arelent **, struct bfd_symbol **);
-.
-
-A pointer to an alternative bfd_target in case the current one is not
-satisfactory. This can happen when the target cpu supports both big
-and little endian code, and target chosen by the linker has the wrong
-endianness. The function open_output() in ld/ldlang.c uses this field
-to find an alternative output format that is suitable.
-
-. {* Opposite endian version of this target. *}
-. const struct bfd_target * alternative_target;
-.
-
-. {* Data for use by back-end routines, which isn't
-. generic enough to belong in this structure. *}
-. const void *backend_data;
-.
-.} bfd_target;
-.
-*/
-
-/* All known xvecs (even those that don't compile on all systems).
- Alphabetized for easy reference.
- They are listed a second time below, since
- we can't intermix extern's and initializers. */
-extern const bfd_target a29kcoff_big_vec;
-extern const bfd_target a_out_adobe_vec;
-extern const bfd_target aix5coff64_vec;
-extern const bfd_target aout0_big_vec;
-extern const bfd_target aout_arm_big_vec;
-extern const bfd_target aout_arm_little_vec;
-extern const bfd_target aout_mips_big_vec;
-extern const bfd_target aout_mips_little_vec;
-extern const bfd_target apollocoff_vec;
-extern const bfd_target arm_epoc_pe_big_vec;
-extern const bfd_target arm_epoc_pe_little_vec;
-extern const bfd_target arm_epoc_pei_big_vec;
-extern const bfd_target arm_epoc_pei_little_vec;
-extern const bfd_target armcoff_big_vec;
-extern const bfd_target armcoff_little_vec;
-extern const bfd_target armnetbsd_vec;
-extern const bfd_target armpe_big_vec;
-extern const bfd_target armpe_little_vec;
-extern const bfd_target armpei_big_vec;
-extern const bfd_target armpei_little_vec;
-extern const bfd_target b_out_vec_big_host;
-extern const bfd_target b_out_vec_little_host;
-extern const bfd_target bfd_efi_app_ia32_vec;
-extern const bfd_target bfd_efi_app_ia64_vec;
-extern const bfd_target bfd_elf32_avr_vec;
-extern const bfd_target bfd_elf32_big_generic_vec;
-extern const bfd_target bfd_elf32_bigarc_vec;
-extern const bfd_target bfd_elf32_bigarm_oabi_vec;
-extern const bfd_target bfd_elf32_bigarm_vec;
-extern const bfd_target bfd_elf32_bigmips_vec;
-extern const bfd_target bfd_elf32_cris_vec;
-extern const bfd_target bfd_elf32_d10v_vec;
-extern const bfd_target bfd_elf32_d30v_vec;
-extern const bfd_target bfd_elf32_dlx_big_vec;
-extern const bfd_target bfd_elf32_fr30_vec;
-extern const bfd_target bfd_elf32_frv_vec;
-extern const bfd_target bfd_elf32_frvfdpic_vec;
-extern const bfd_target bfd_elf32_h8300_vec;
-extern const bfd_target bfd_elf32_hppa_linux_vec;
-extern const bfd_target bfd_elf32_hppa_vec;
-extern const bfd_target bfd_elf32_i370_vec;
-extern const bfd_target bfd_elf32_i386_freebsd_vec;
-extern const bfd_target bfd_elf32_i386_vec;
-extern const bfd_target bfd_elf32_i860_little_vec;
-extern const bfd_target bfd_elf32_i860_vec;
-extern const bfd_target bfd_elf32_i960_vec;
-extern const bfd_target bfd_elf32_ia64_big_vec;
-extern const bfd_target bfd_elf32_ia64_hpux_big_vec;
-extern const bfd_target bfd_elf32_ip2k_vec;
-extern const bfd_target bfd_elf32_iq2000_vec;
-extern const bfd_target bfd_elf32_little_generic_vec;
-extern const bfd_target bfd_elf32_littlearc_vec;
-extern const bfd_target bfd_elf32_littlearm_oabi_vec;
-extern const bfd_target bfd_elf32_littlearm_vec;
-extern const bfd_target bfd_elf32_littlemips_vec;
-extern const bfd_target bfd_elf32_m32r_vec;
-extern const bfd_target bfd_elf32_m32rle_vec;
-extern const bfd_target bfd_elf32_m32rlin_vec;
-extern const bfd_target bfd_elf32_m32rlelin_vec;
-extern const bfd_target bfd_elf32_m68hc11_vec;
-extern const bfd_target bfd_elf32_m68hc12_vec;
-extern const bfd_target bfd_elf32_m68k_vec;
-extern const bfd_target bfd_elf32_m88k_vec;
-extern const bfd_target bfd_elf32_mcore_big_vec;
-extern const bfd_target bfd_elf32_mcore_little_vec;
-extern const bfd_target bfd_elf32_mn10200_vec;
-extern const bfd_target bfd_elf32_mn10300_vec;
-extern const bfd_target bfd_elf32_msp430_vec;
-extern const bfd_target bfd_elf32_nbigmips_vec;
-extern const bfd_target bfd_elf32_nlittlemips_vec;
-extern const bfd_target bfd_elf32_ntradbigmips_vec;
-extern const bfd_target bfd_elf32_ntradlittlemips_vec;
-extern const bfd_target bfd_elf32_openrisc_vec;
-extern const bfd_target bfd_elf32_or32_big_vec;
-extern const bfd_target bfd_elf32_pj_vec;
-extern const bfd_target bfd_elf32_pjl_vec;
-extern const bfd_target bfd_elf32_powerpc_vec;
-extern const bfd_target bfd_elf32_powerpcle_vec;
-extern const bfd_target bfd_elf32_s390_vec;
-extern const bfd_target bfd_elf32_sh64_vec;
-extern const bfd_target bfd_elf32_sh64l_vec;
-extern const bfd_target bfd_elf32_sh64lin_vec;
-extern const bfd_target bfd_elf32_sh64blin_vec;
-extern const bfd_target bfd_elf32_sh64lnbsd_vec;
-extern const bfd_target bfd_elf32_sh64nbsd_vec;
-extern const bfd_target bfd_elf32_sh_vec;
-extern const bfd_target bfd_elf32_shblin_vec;
-extern const bfd_target bfd_elf32_shl_vec;
-extern const bfd_target bfd_elf32_shlin_vec;
-extern const bfd_target bfd_elf32_shlnbsd_vec;
-extern const bfd_target bfd_elf32_shnbsd_vec;
-extern const bfd_target bfd_elf32_sparc_vec;
-extern const bfd_target bfd_elf32_tradbigmips_vec;
-extern const bfd_target bfd_elf32_tradlittlemips_vec;
-extern const bfd_target bfd_elf32_us_cris_vec;
-extern const bfd_target bfd_elf32_v850_vec;
-extern const bfd_target bfd_elf32_vax_vec;
-extern const bfd_target bfd_elf32_xstormy16_vec;
-extern const bfd_target bfd_elf32_xtensa_be_vec;
-extern const bfd_target bfd_elf32_xtensa_le_vec;
-extern const bfd_target bfd_elf64_alpha_freebsd_vec;
-extern const bfd_target bfd_elf64_alpha_vec;
-extern const bfd_target bfd_elf64_big_generic_vec;
-extern const bfd_target bfd_elf64_bigmips_vec;
-extern const bfd_target bfd_elf64_hppa_linux_vec;
-extern const bfd_target bfd_elf64_hppa_vec;
-extern const bfd_target bfd_elf64_ia64_big_vec;
-extern const bfd_target bfd_elf64_ia64_hpux_big_vec;
-extern const bfd_target bfd_elf64_ia64_little_vec;
-extern const bfd_target bfd_elf64_little_generic_vec;
-extern const bfd_target bfd_elf64_littlemips_vec;
-extern const bfd_target bfd_elf64_mmix_vec;
-extern const bfd_target bfd_elf64_powerpc_vec;
-extern const bfd_target bfd_elf64_powerpcle_vec;
-extern const bfd_target bfd_elf64_s390_vec;
-extern const bfd_target bfd_elf64_sh64_vec;
-extern const bfd_target bfd_elf64_sh64l_vec;
-extern const bfd_target bfd_elf64_sh64lin_vec;
-extern const bfd_target bfd_elf64_sh64blin_vec;
-extern const bfd_target bfd_elf64_sh64lnbsd_vec;
-extern const bfd_target bfd_elf64_sh64nbsd_vec;
-extern const bfd_target bfd_elf64_sparc_vec;
-extern const bfd_target bfd_elf64_tradbigmips_vec;
-extern const bfd_target bfd_elf64_tradlittlemips_vec;
-extern const bfd_target bfd_elf64_x86_64_vec;
-extern const bfd_target bfd_mmo_vec;
-extern const bfd_target bfd_powerpc_pe_vec;
-extern const bfd_target bfd_powerpc_pei_vec;
-extern const bfd_target bfd_powerpcle_pe_vec;
-extern const bfd_target bfd_powerpcle_pei_vec;
-extern const bfd_target cris_aout_vec;
-extern const bfd_target demo_64_vec;
-extern const bfd_target ecoff_big_vec;
-extern const bfd_target ecoff_biglittle_vec;
-extern const bfd_target ecoff_little_vec;
-extern const bfd_target ecoffalpha_little_vec;
-extern const bfd_target go32coff_vec;
-extern const bfd_target go32stubbedcoff_vec;
-extern const bfd_target h8300coff_vec;
-extern const bfd_target h8500coff_vec;
-extern const bfd_target host_aout_vec;
-extern const bfd_target hp300bsd_vec;
-extern const bfd_target hp300hpux_vec;
-extern const bfd_target i386aout_vec;
-extern const bfd_target i386bsd_vec;
-extern const bfd_target i386coff_vec;
-extern const bfd_target i386dynix_vec;
-extern const bfd_target i386freebsd_vec;
-extern const bfd_target i386linux_vec;
-extern const bfd_target i386lynx_aout_vec;
-extern const bfd_target i386lynx_coff_vec;
-extern const bfd_target i386mach3_vec;
-extern const bfd_target i386msdos_vec;
-extern const bfd_target i386netbsd_vec;
-extern const bfd_target i386os9k_vec;
-extern const bfd_target i386pe_vec;
-extern const bfd_target i386pei_vec;
-extern const bfd_target i860coff_vec;
-extern const bfd_target icoff_big_vec;
-extern const bfd_target icoff_little_vec;
-extern const bfd_target ieee_vec;
-extern const bfd_target m68k4knetbsd_vec;
-extern const bfd_target m68kaux_coff_vec;
-extern const bfd_target m68kcoff_vec;
-extern const bfd_target m68kcoffun_vec;
-extern const bfd_target m68klinux_vec;
-extern const bfd_target m68klynx_aout_vec;
-extern const bfd_target m68klynx_coff_vec;
-extern const bfd_target m68knetbsd_vec;
-extern const bfd_target m68ksysvcoff_vec;
-extern const bfd_target m88kbcs_vec;
-extern const bfd_target m88kmach3_vec;
-extern const bfd_target mach_o_be_vec;
-extern const bfd_target mach_o_le_vec;
-extern const bfd_target mach_o_fat_vec;
-extern const bfd_target mcore_pe_big_vec;
-extern const bfd_target mcore_pe_little_vec;
-extern const bfd_target mcore_pei_big_vec;
-extern const bfd_target mcore_pei_little_vec;
-extern const bfd_target mipslpe_vec;
-extern const bfd_target mipslpei_vec;
-extern const bfd_target newsos3_vec;
-extern const bfd_target nlm32_alpha_vec;
-extern const bfd_target nlm32_i386_vec;
-extern const bfd_target nlm32_powerpc_vec;
-extern const bfd_target nlm32_sparc_vec;
-extern const bfd_target oasys_vec;
-extern const bfd_target or32coff_big_vec;
-extern const bfd_target pc532machaout_vec;
-extern const bfd_target pc532netbsd_vec;
-extern const bfd_target pdp11_aout_vec;
-extern const bfd_target pef_vec;
-extern const bfd_target pef_xlib_vec;
-extern const bfd_target pmac_xcoff_vec;
-extern const bfd_target ppcboot_vec;
-extern const bfd_target riscix_vec;
-extern const bfd_target rs6000coff64_vec;
-extern const bfd_target rs6000coff_vec;
-extern const bfd_target shcoff_small_vec;
-extern const bfd_target shcoff_vec;
-extern const bfd_target shlcoff_small_vec;
-extern const bfd_target shlcoff_vec;
-extern const bfd_target shlpe_vec;
-extern const bfd_target shlpei_vec;
-extern const bfd_target som_vec;
-extern const bfd_target sparccoff_vec;
-extern const bfd_target sparcle_aout_vec;
-extern const bfd_target sparclinux_vec;
-extern const bfd_target sparclynx_aout_vec;
-extern const bfd_target sparclynx_coff_vec;
-extern const bfd_target sparcnetbsd_vec;
-extern const bfd_target sunos_big_vec;
-extern const bfd_target sym_vec;
-extern const bfd_target tic30_aout_vec;
-extern const bfd_target tic30_coff_vec;
-extern const bfd_target tic4x_coff0_beh_vec;
-extern const bfd_target tic4x_coff0_vec;
-extern const bfd_target tic4x_coff1_beh_vec;
-extern const bfd_target tic4x_coff1_vec;
-extern const bfd_target tic4x_coff2_beh_vec;
-extern const bfd_target tic4x_coff2_vec;
-extern const bfd_target tic54x_coff0_beh_vec;
-extern const bfd_target tic54x_coff0_vec;
-extern const bfd_target tic54x_coff1_beh_vec;
-extern const bfd_target tic54x_coff1_vec;
-extern const bfd_target tic54x_coff2_beh_vec;
-extern const bfd_target tic54x_coff2_vec;
-extern const bfd_target tic80coff_vec;
-extern const bfd_target vaxbsd_vec;
-extern const bfd_target vaxnetbsd_vec;
-extern const bfd_target vax1knetbsd_vec;
-extern const bfd_target versados_vec;
-extern const bfd_target vms_alpha_vec;
-extern const bfd_target vms_vax_vec;
-extern const bfd_target w65_vec;
-extern const bfd_target we32kcoff_vec;
-extern const bfd_target z8kcoff_vec;
-
-/* These are always included. */
-extern const bfd_target srec_vec;
-extern const bfd_target symbolsrec_vec;
-extern const bfd_target tekhex_vec;
-extern const bfd_target binary_vec;
-extern const bfd_target ihex_vec;
-
-/* All of the xvecs for core files. */
-extern const bfd_target aix386_core_vec;
-extern const bfd_target cisco_core_big_vec;
-extern const bfd_target cisco_core_little_vec;
-extern const bfd_target hppabsd_core_vec;
-extern const bfd_target hpux_core_vec;
-extern const bfd_target irix_core_vec;
-extern const bfd_target netbsd_core_vec;
-extern const bfd_target osf_core_vec;
-extern const bfd_target ptrace_core_vec;
-extern const bfd_target sco5_core_vec;
-extern const bfd_target trad_core_vec;
-
-extern const bfd_target bfd_elf32_am33lin_vec;
-static const bfd_target * const _bfd_target_vector[] = {
-
-#ifdef SELECT_VECS
-
- SELECT_VECS,
-
-#else /* not SELECT_VECS */
-
-#ifdef DEFAULT_VECTOR
- &DEFAULT_VECTOR,
-#endif
- /* This list is alphabetized to make it easy to compare
- with other vector lists -- the decls above and
- the case statement in configure.in.
- Vectors that don't compile on all systems, or aren't finished,
- should have an entry here with #if 0 around it, to show that
- it wasn't omitted by mistake. */
- &a29kcoff_big_vec,
- &a_out_adobe_vec,
-#ifdef BFD64
- &aix5coff64_vec,
-#endif
- &aout0_big_vec,
-#if 0
- /* We have no way of distinguishing these from other a.out variants. */
- &aout_arm_big_vec,
- &aout_arm_little_vec,
- /* No one seems to use this. */
- &aout_mips_big_vec,
-#endif
- &aout_mips_little_vec,
-#if 0
- &apollocoff_vec,
-#endif
- &arm_epoc_pe_big_vec,
- &arm_epoc_pe_little_vec,
- &arm_epoc_pei_big_vec,
- &arm_epoc_pei_little_vec,
- &armcoff_big_vec,
- &armcoff_little_vec,
- &armnetbsd_vec,
- &armpe_big_vec,
- &armpe_little_vec,
- &armpei_big_vec,
- &armpei_little_vec,
- &b_out_vec_big_host,
- &b_out_vec_little_host,
- &bfd_efi_app_ia32_vec,
-#ifdef BFD64
- &bfd_efi_app_ia64_vec,
-#endif
- &bfd_elf32_avr_vec,
-
- /* This, and other vectors, may not be used in any *.mt configuration.
- But that does not mean they are unnecessary. If configured with
- --enable-targets=all, objdump or gdb should be able to examine
- the file even if we don't recognize the machine type. */
- &bfd_elf32_big_generic_vec,
- &bfd_elf32_bigarc_vec,
- &bfd_elf32_bigarm_oabi_vec,
- &bfd_elf32_bigarm_vec,
- &bfd_elf32_bigmips_vec,
- &bfd_elf32_cris_vec,
- &bfd_elf32_d10v_vec,
- &bfd_elf32_d30v_vec,
- &bfd_elf32_dlx_big_vec,
- &bfd_elf32_fr30_vec,
- &bfd_elf32_frv_vec,
- &bfd_elf32_frvfdpic_vec,
- &bfd_elf32_h8300_vec,
- &bfd_elf32_hppa_linux_vec,
- &bfd_elf32_hppa_vec,
- &bfd_elf32_i370_vec,
- &bfd_elf32_i386_freebsd_vec,
- &bfd_elf32_i386_vec,
- &bfd_elf32_i860_little_vec,
- &bfd_elf32_i860_vec,
- &bfd_elf32_i960_vec,
-#if 0
- &bfd_elf32_ia64_big_vec,
-#endif
- &bfd_elf32_ia64_hpux_big_vec,
- &bfd_elf32_ip2k_vec,
- &bfd_elf32_iq2000_vec,
- &bfd_elf32_little_generic_vec,
- &bfd_elf32_littlearc_vec,
- &bfd_elf32_littlearm_oabi_vec,
- &bfd_elf32_littlearm_vec,
- &bfd_elf32_littlemips_vec,
- &bfd_elf32_m32r_vec,
- &bfd_elf32_m32rle_vec,
- &bfd_elf32_m32rlin_vec,
- &bfd_elf32_m32rlelin_vec,
- &bfd_elf32_m68hc11_vec,
- &bfd_elf32_m68hc12_vec,
- &bfd_elf32_m68k_vec,
- &bfd_elf32_m88k_vec,
- &bfd_elf32_mcore_big_vec,
- &bfd_elf32_mcore_little_vec,
- &bfd_elf32_mn10200_vec,
- &bfd_elf32_mn10300_vec,
- &bfd_elf32_msp430_vec,
-#ifdef BFD64
- &bfd_elf32_nbigmips_vec,
- &bfd_elf32_nlittlemips_vec,
- &bfd_elf32_ntradbigmips_vec,
- &bfd_elf32_ntradlittlemips_vec,
-#endif
- &bfd_elf32_openrisc_vec,
- &bfd_elf32_or32_big_vec,
- &bfd_elf32_pj_vec,
- &bfd_elf32_pjl_vec,
- &bfd_elf32_powerpc_vec,
- &bfd_elf32_powerpcle_vec,
- &bfd_elf32_s390_vec,
- &bfd_elf32_sh_vec,
- &bfd_elf32_shblin_vec,
- &bfd_elf32_shl_vec,
- &bfd_elf32_shlin_vec,
- &bfd_elf32_shlnbsd_vec,
- &bfd_elf32_shnbsd_vec,
-#ifdef BFD64
- &bfd_elf32_sh64_vec,
- &bfd_elf32_sh64l_vec,
- &bfd_elf32_sh64lnbsd_vec,
- &bfd_elf32_sh64nbsd_vec,
- &bfd_elf32_sh64lin_vec,
- &bfd_elf32_sh64blin_vec,
-#endif
- &bfd_elf32_sparc_vec,
- &bfd_elf32_tradbigmips_vec,
- &bfd_elf32_tradlittlemips_vec,
- &bfd_elf32_us_cris_vec,
- &bfd_elf32_v850_vec,
- &bfd_elf32_vax_vec,
- &bfd_elf32_xstormy16_vec,
- &bfd_elf32_xtensa_be_vec,
- &bfd_elf32_xtensa_le_vec,
-#ifdef BFD64
- &bfd_elf64_alpha_freebsd_vec,
- &bfd_elf64_alpha_vec,
- &bfd_elf64_big_generic_vec,
- &bfd_elf64_bigmips_vec,
- &bfd_elf64_hppa_linux_vec,
- &bfd_elf64_hppa_vec,
- &bfd_elf64_ia64_big_vec,
- &bfd_elf64_ia64_hpux_big_vec,
- &bfd_elf64_ia64_little_vec,
- &bfd_elf64_little_generic_vec,
- &bfd_elf64_littlemips_vec,
- &bfd_elf64_mmix_vec,
- &bfd_elf64_powerpc_vec,
- &bfd_elf64_powerpcle_vec,
- &bfd_elf64_s390_vec,
- &bfd_elf64_sh64_vec,
- &bfd_elf64_sh64l_vec,
- &bfd_elf64_sh64lnbsd_vec,
- &bfd_elf64_sh64nbsd_vec,
- &bfd_elf64_sh64lin_vec,
- &bfd_elf64_sh64blin_vec,
- &bfd_elf64_sparc_vec,
- &bfd_elf64_tradbigmips_vec,
- &bfd_elf64_tradlittlemips_vec,
- &bfd_elf64_x86_64_vec,
- &bfd_mmo_vec,
-#endif
- &bfd_powerpc_pe_vec,
- &bfd_powerpc_pei_vec,
- &bfd_powerpcle_pe_vec,
- &bfd_powerpcle_pei_vec,
- &cris_aout_vec,
-#ifdef BFD64
- &demo_64_vec, /* Only compiled if host has long-long support. */
-#endif
- &ecoff_big_vec,
- &ecoff_biglittle_vec,
- &ecoff_little_vec,
-#ifdef BFD64
- &ecoffalpha_little_vec,
-#endif
- &go32coff_vec,
- &go32stubbedcoff_vec,
- &h8300coff_vec,
- &h8500coff_vec,
-#if 0
- /* Since a.out files lack decent magic numbers, no way to recognize
- which kind of a.out file it is. */
- &host_aout_vec,
- /* Clashes with sunos_big_vec magic no. */
- &hp300bsd_vec,
-#endif
- &hp300hpux_vec,
- &i386aout_vec,
- &i386bsd_vec,
- &i386coff_vec,
-#if 0
- &i386dynix_vec,
-#endif
- &i386freebsd_vec,
-#if 0
- /* Since a.out files lack decent magic numbers, no way to recognize
- which kind of a.out file it is. */
- &i386linux_vec,
-#endif
- &i386lynx_aout_vec,
- &i386lynx_coff_vec,
-#if 0
- /* No distinguishing features for Mach 3 executables. */
- &i386mach3_vec,
-#endif
- &i386msdos_vec,
- &i386netbsd_vec,
- &i386os9k_vec,
- &i386pe_vec,
- &i386pei_vec,
- &i860coff_vec,
- &icoff_big_vec,
- &icoff_little_vec,
- &ieee_vec,
-#if 0
- &m68k4knetbsd_vec,
- &m68kaux_coff_vec,
-#endif
- &m68kcoff_vec,
- &m68kcoffun_vec,
-#if 0
- /* Since a.out files lack decent magic numbers, no way to recognize
- which kind of a.out file it is. */
- &m68klinux_vec,
-#endif
- &m68klynx_aout_vec,
- &m68klynx_coff_vec,
- &m68knetbsd_vec,
- &m68ksysvcoff_vec,
- &m88kbcs_vec,
- &m88kmach3_vec,
- &mach_o_be_vec,
- &mach_o_le_vec,
- &mach_o_fat_vec,
- &mcore_pe_big_vec,
- &mcore_pe_little_vec,
- &mcore_pei_big_vec,
- &mcore_pei_little_vec,
- &mipslpe_vec,
- &mipslpei_vec,
- &newsos3_vec,
-#ifdef BFD64
- &nlm32_alpha_vec,
-#endif
- &nlm32_i386_vec,
- &nlm32_powerpc_vec,
- &nlm32_sparc_vec,
-#if 0
- /* We have no oasys tools anymore, so we can't test any of this
- anymore. If you want to test the stuff yourself, go ahead...
- steve@cygnus.com
- Worse, since there is no magic number for archives, there
- can be annoying target mis-matches. */
- &oasys_vec,
-#endif
- /* Entry for the OpenRISC family. */
- &or32coff_big_vec,
-
- &pc532machaout_vec,
- &pc532netbsd_vec,
- &pdp11_aout_vec,
- &pef_vec,
- &pef_xlib_vec,
-#if 0
- /* This has the same magic number as RS/6000. */
- &pmac_xcoff_vec,
-#endif
- &ppcboot_vec,
-#if 0
- /* We have no way of distinguishing these from other a.out variants. */
- &riscix_vec,
-#endif
-#ifdef BFD64
- &rs6000coff64_vec,
-#endif
- &rs6000coff_vec,
- &shcoff_small_vec,
- &shcoff_vec,
- &shlcoff_small_vec,
- &shlcoff_vec,
- &shlpe_vec,
- &shlpei_vec,
-#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
- &som_vec,
-#endif
- &sparccoff_vec,
- &sparcle_aout_vec,
- &sparclinux_vec,
- &sparclynx_aout_vec,
- &sparclynx_coff_vec,
- &sparcnetbsd_vec,
- &sunos_big_vec,
- &sym_vec,
- &tic30_aout_vec,
- &tic30_coff_vec,
- &tic54x_coff0_beh_vec,
- &tic54x_coff0_vec,
- &tic54x_coff1_beh_vec,
- &tic54x_coff1_vec,
- &tic54x_coff2_beh_vec,
- &tic54x_coff2_vec,
- &tic80coff_vec,
- &vaxbsd_vec,
- &vaxnetbsd_vec,
- &vax1knetbsd_vec,
- &versados_vec,
-#ifdef BFD64
- &vms_alpha_vec,
-#endif
- &vms_vax_vec,
- &w65_vec,
- &we32kcoff_vec,
- &z8kcoff_vec,
- &bfd_elf32_am33lin_vec,
-#endif /* not SELECT_VECS */
-
-/* Always support S-records, for convenience. */
- &srec_vec,
- &symbolsrec_vec,
-/* And tekhex */
- &tekhex_vec,
-/* Likewise for binary output. */
- &binary_vec,
-/* Likewise for ihex. */
- &ihex_vec,
-
-/* Add any required traditional-core-file-handler. */
-
-#ifdef AIX386_CORE
- &aix386_core_vec,
-#endif
-#if 0
- /* We don't include cisco_core_*_vec. Although it has a magic number,
- the magic number isn't at the beginning of the file, and thus
- might spuriously match other kinds of files. */
- &cisco_core_big_vec,
- &cisco_core_little_vec,
-#endif
-#ifdef HPPABSD_CORE
- &hppabsd_core_vec,
-#endif
-#ifdef HPUX_CORE
- &hpux_core_vec,
-#endif
-#ifdef IRIX_CORE
- &irix_core_vec,
-#endif
-#ifdef NETBSD_CORE
- &netbsd_core_vec,
-#endif
-#ifdef OSF_CORE
- &osf_core_vec,
-#endif
-#ifdef PTRACE_CORE
- &ptrace_core_vec,
-#endif
-#ifdef SCO5_CORE
- &sco5_core_vec,
-#endif
-#ifdef TRAD_CORE
- &trad_core_vec,
-#endif
-
- NULL /* end of list marker */
-};
-const bfd_target * const *bfd_target_vector = _bfd_target_vector;
-
-/* bfd_default_vector[0] contains either the address of the default vector,
- if there is one, or zero if there isn't. */
-
-const bfd_target *bfd_default_vector[] = {
-#ifdef DEFAULT_VECTOR
- &DEFAULT_VECTOR,
-#endif
- NULL
-};
-
-/* bfd_associated_vector[] contains the associated target vectors used
- to reduce the ambiguity in bfd_check_format_matches. */
-
-static const bfd_target *_bfd_associated_vector[] = {
-#ifdef ASSOCIATED_VECS
- ASSOCIATED_VECS,
-#endif
- NULL
-};
-const bfd_target * const *bfd_associated_vector = _bfd_associated_vector;
-
-/* When there is an ambiguous match, bfd_check_format_matches puts the
- names of the matching targets in an array. This variable is the maximum
- number of entries that the array could possibly need. */
-const size_t _bfd_target_vector_entries = sizeof (_bfd_target_vector)/sizeof (*_bfd_target_vector);
-
-/* This array maps configuration triplets onto BFD vectors. */
-
-struct targmatch
-{
- /* The configuration triplet. */
- const char *triplet;
- /* The BFD vector. If this is NULL, then the vector is found by
- searching forward for the next structure with a non NULL vector
- field. */
- const bfd_target *vector;
-};
-
-/* targmatch.h is built by Makefile out of config.bfd. */
-static const struct targmatch bfd_target_match[] = {
-#include "targmatch.h"
- { NULL, NULL }
-};
-
-/* Find a target vector, given a name or configuration triplet. */
-
-static const bfd_target *
-find_target (const char *name)
-{
- const bfd_target * const *target;
- const struct targmatch *match;
-
- for (target = &bfd_target_vector[0]; *target != NULL; target++)
- if (strcmp (name, (*target)->name) == 0)
- return *target;
-
- /* If we couldn't match on the exact name, try matching on the
- configuration triplet. FIXME: We should run the triplet through
- config.sub first, but that is hard. */
- for (match = &bfd_target_match[0]; match->triplet != NULL; match++)
- {
- if (fnmatch (match->triplet, name, 0) == 0)
- {
- while (match->vector == NULL)
- ++match;
- return match->vector;
- break;
- }
- }
-
- bfd_set_error (bfd_error_invalid_target);
- return NULL;
-}
-
-/*
-FUNCTION
- bfd_set_default_target
-
-SYNOPSIS
- bfd_boolean bfd_set_default_target (const char *name);
-
-DESCRIPTION
- Set the default target vector to use when recognizing a BFD.
- This takes the name of the target, which may be a BFD target
- name or a configuration triplet.
-*/
-
-bfd_boolean
-bfd_set_default_target (const char *name)
-{
- const bfd_target *target;
-
- if (bfd_default_vector[0] != NULL
- && strcmp (name, bfd_default_vector[0]->name) == 0)
- return TRUE;
-
- target = find_target (name);
- if (target == NULL)
- return FALSE;
-
- bfd_default_vector[0] = target;
- return TRUE;
-}
-
-/*
-FUNCTION
- bfd_find_target
-
-SYNOPSIS
- const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
-
-DESCRIPTION
- Return a pointer to the transfer vector for the object target
- named @var{target_name}. If @var{target_name} is <<NULL>>, choose the
- one in the environment variable <<GNUTARGET>>; if that is null or not
- defined, then choose the first entry in the target list.
- Passing in the string "default" or setting the environment
- variable to "default" will cause the first entry in the target
- list to be returned, and "target_defaulted" will be set in the
- BFD. This causes <<bfd_check_format>> to loop over all the
- targets to find the one that matches the file being read.
-*/
-
-const bfd_target *
-bfd_find_target (const char *target_name, bfd *abfd)
-{
- const char *targname;
- const bfd_target *target;
-
- if (target_name != NULL)
- targname = target_name;
- else
- targname = getenv ("GNUTARGET");
-
- /* This is safe; the vector cannot be null. */
- if (targname == NULL || strcmp (targname, "default") == 0)
- {
- abfd->target_defaulted = TRUE;
- if (bfd_default_vector[0] != NULL)
- abfd->xvec = bfd_default_vector[0];
- else
- abfd->xvec = bfd_target_vector[0];
- return abfd->xvec;
- }
-
- abfd->target_defaulted = FALSE;
-
- target = find_target (targname);
- if (target == NULL)
- return NULL;
-
- abfd->xvec = target;
- return target;
-}
-
-/*
-FUNCTION
- bfd_target_list
-
-SYNOPSIS
- const char ** bfd_target_list (void);
-
-DESCRIPTION
- Return a freshly malloced NULL-terminated
- vector of the names of all the valid BFD targets. Do not
- modify the names.
-
-*/
-
-const char **
-bfd_target_list (void)
-{
- int vec_length = 0;
- bfd_size_type amt;
-#if defined (HOST_HPPAHPUX) && ! defined (__STDC__)
- /* The native compiler on the HP9000/700 has a bug which causes it
- to loop endlessly when compiling this file. This avoids it. */
- volatile
-#endif
- const bfd_target * const *target;
- const char **name_list, **name_ptr;
-
- for (target = &bfd_target_vector[0]; *target != NULL; target++)
- vec_length++;
-
- amt = (vec_length + 1) * sizeof (char **);
- name_ptr = name_list = bfd_malloc (amt);
-
- if (name_list == NULL)
- return NULL;
-
- for (target = &bfd_target_vector[0]; *target != NULL; target++)
- if (target == &bfd_target_vector[0]
- || *target != bfd_target_vector[0])
- *name_ptr++ = (*target)->name;
-
- *name_ptr = NULL;
- return name_list;
-}
-
-/*
-FUNCTION
- bfd_seach_for_target
-
-SYNOPSIS
- const bfd_target *bfd_search_for_target
- (int (*search_func) (const bfd_target *, void *),
- void *);
-
-DESCRIPTION
- Return a pointer to the first transfer vector in the list of
- transfer vectors maintained by BFD that produces a non-zero
- result when passed to the function @var{search_func}. The
- parameter @var{data} is passed, unexamined, to the search
- function.
-*/
-
-const bfd_target *
-bfd_search_for_target (int (*search_func) (const bfd_target *, void *),
- void *data)
-{
- const bfd_target * const *target;
-
- for (target = bfd_target_vector; *target != NULL; target ++)
- if (search_func (*target, data))
- return *target;
-
- return NULL;
-}
diff --git a/contrib/binutils/bfd/targmatch.sed b/contrib/binutils/bfd/targmatch.sed
deleted file mode 100644
index 2716876..0000000
--- a/contrib/binutils/bfd/targmatch.sed
+++ /dev/null
@@ -1,33 +0,0 @@
-1,/START OF targmatch.h/ d
-/END OF targmatch.h/,$ d
-/^[ ]*case/,/^[ ]*esac/ d
-s/^#if/KEEP #if/
-s/^#endif/KEEP #endif/
-s/^[ ]*#.*$//
-s/^KEEP #/#/
-s/[ ]*\\$//
-t lab1
- :lab1
-s/[| ][| ]*\([^|() ][^|() ]*\)[ ]*|/{ "\1", NULL },/g
-s/[| ][| ]*\([^|() ][^|() ]*\)[ ]*)/{ "\1",/g
-t lab2
-s/^[ ]*targ_defvec=\([^ ]*\)/#if !defined (SELECT_VECS) || defined (HAVE_\1)/
-t lab3
-s/.*=.*//
-s/;;//
-b
- :lab2
-H
-d
- :lab3
-G
-s/\n/%EOL%/g
-s/\(defined (HAVE_\)\([^)]*\)\(.*\)/\1\2\3\
-\&\2 },\
-#endif/
-s/%EOL%/\
-/g
-p
-s/.*//g
-s/\n//g
-h
diff --git a/contrib/binutils/bfd/tekhex.c b/contrib/binutils/bfd/tekhex.c
deleted file mode 100644
index f828fe7..0000000
--- a/contrib/binutils/bfd/tekhex.c
+++ /dev/null
@@ -1,1068 +0,0 @@
-/* BFD backend for Extended Tektronix Hex Format objects.
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-SUBSECTION
- Tektronix Hex Format handling
-
-DESCRIPTION
-
- Tek Hex records can hold symbols and data, but not
- relocations. Their main application is communication with
- devices like PROM programmers and ICE equipment.
-
- It seems that the sections are described as being really big,
- the example I have says that the text section is 0..ffffffff.
- BFD would barf with this, many apps would try to alloc 4GB to
- read in the file.
-
- Tex Hex may contain many sections, but the data which comes in
- has no tag saying which section it belongs to, so we create
- one section for each block of data, called "blknnnn" which we
- stick all the data into.
-
- TekHex may come out of order and there is no header, so an
- initial scan is required to discover the minimum and maximum
- addresses used to create the vma and size of the sections we
- create.
- We read in the data into pages of CHUNK_MASK+1 size and read
- them out from that whenever we need to.
-
- Any number of sections may be created for output, we save them
- up and output them when it's time to close the bfd.
-
- A TekHex record looks like:
-EXAMPLE
- %<block length><type><checksum><stuff><cr>
-
-DESCRIPTION
- Where
- o length
- is the number of bytes in the record not including the % sign.
- o type
- is one of:
- 3) symbol record
- 6) data record
- 8) termination record
-
-The data can come out of order, and may be discontigous. This is a
-serial protocol, so big files are unlikely, so we keep a list of 8k chunks
-*/
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libiberty.h"
-
-typedef struct
- {
- bfd_vma low;
- bfd_vma high;
- } addr_range_type;
-
-typedef struct tekhex_symbol_struct
- {
-
- asymbol symbol;
- struct tekhex_symbol_struct *prev;
-
- } tekhex_symbol_type;
-
-static const char digs[] = "0123456789ABCDEF";
-
-static char sum_block[256];
-
-#define NOT_HEX 20
-#define NIBBLE(x) hex_value(x)
-#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
-#define TOHEX(d,x) \
-(d)[1] = digs[(x) & 0xf]; \
-(d)[0] = digs[((x)>>4)&0xf];
-#define ISHEX(x) hex_p(x)
-
-static void tekhex_init PARAMS ((void));
-static bfd_vma getvalue PARAMS ((char **));
-static void tekhex_print_symbol
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-static void tekhex_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-static asymbol *tekhex_make_empty_symbol PARAMS ((bfd *));
-static int tekhex_sizeof_headers PARAMS ((bfd *, bfd_boolean));
-static bfd_boolean tekhex_write_object_contents PARAMS ((bfd *));
-static void out PARAMS ((bfd *, int, char *, char *));
-static void writesym PARAMS ((char **, const char *));
-static void writevalue PARAMS ((char **, bfd_vma));
-static bfd_boolean tekhex_set_section_contents
- PARAMS ((bfd*, sec_ptr, const PTR, file_ptr, bfd_size_type));
-static bfd_boolean tekhex_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static bfd_boolean tekhex_get_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static void move_section_contents
- PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type, bfd_boolean));
-static const bfd_target *tekhex_object_p PARAMS ((bfd *));
-static bfd_boolean tekhex_mkobject PARAMS ((bfd *));
-static long tekhex_get_symtab_upper_bound PARAMS ((bfd *));
-static long tekhex_canonicalize_symtab PARAMS ((bfd *, asymbol **));
-static void pass_over PARAMS ((bfd *, void (*) (bfd*, int, char *)));
-static void first_phase PARAMS ((bfd *, int, char *));
-static void insert_byte PARAMS ((bfd *, int, bfd_vma));
-static struct data_struct *find_chunk PARAMS ((bfd *, bfd_vma));
-static unsigned int getsym PARAMS ((char *, char **));
-
-/*
-Here's an example
-%3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75
-%1B3709T_SEGMENT1108FFFFFFFF
-%2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10
-%373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710
-%373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10
-%373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10
-%373049T_SEGMENT80long$long$int$t71080short$unsigned$i10
-%373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10
-%373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010
-%373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10
-%2734D9T_SEGMENT8Bvoid$t15$151035_main10
-%2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110
-%2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214
-%07 8 10 10
-
-explanation:
-%3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75
- ^ ^^ ^ ^-data
- | || +------ 4 char integer 0x8000
- | |+-------- checksum
- | +--------- type 6 (data record)
- +----------- length 3a chars
- <---------------------- 3a (58 chars) ------------------->
-
-%1B3709T_SEGMENT1108FFFFFFFF
- ^ ^^ ^- 8 character integer 0xffffffff
- | |+- 1 character integer 0
- | +-- type 1 symbol (section definition)
- +------------ 9 char symbol T_SEGMENT
-
-%2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10
-%373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710
-%373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10
-%373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10
-%373049T_SEGMENT80long$long$int$t71080short$unsigned$i10
-%373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10
-%373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010
-%373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10
-%2734D9T_SEGMENT8Bvoid$t15$151035_main10
-%2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110
-%2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214
-%0781010
-
-Turns into
-sac@thepub$ ./objdump -dx -m m68k f
-
-f: file format tekhex
------x--- 9/55728 -134219416 Sep 29 15:13 1995 f
-architecture: UNKNOWN!, flags 0x00000010:
-HAS_SYMS
-start address 0x00000000
-SECTION 0 [D00000000] : size 00020000 vma 00000000 align 2**0
- ALLOC, LOAD
-SECTION 1 [D00008000] : size 00002001 vma 00008000 align 2**0
-
-SECTION 2 [T_SEGMENT] : size ffffffff vma 00000000 align 2**0
-
-SYMBOL TABLE:
-00000000 g T_SEGMENT gcc_compiled$
-00000000 g T_SEGMENT hello$c
-00000000 g T_SEGMENT int$t1$r1$$21474
-00000000 g T_SEGMENT char$t2$r2$0$127
-00000000 g T_SEGMENT long$int$t3$r1$$
-00000000 g T_SEGMENT unsigned$int$t4$
-00000000 g T_SEGMENT long$unsigned$in
-00000000 g T_SEGMENT short$int$t6$r1$
-00000000 g T_SEGMENT long$long$int$t7
-00000000 g T_SEGMENT short$unsigned$i
-00000000 g T_SEGMENT long$long$unsign
-00000000 g T_SEGMENT signed$char$t10$
-00000000 g T_SEGMENT unsigned$char$t1
-00000000 g T_SEGMENT float$t12$r1$4$0
-00000000 g T_SEGMENT double$t13$r1$8$
-00000000 g T_SEGMENT long$double$t14$
-00000000 g T_SEGMENT void$t15$15
-00000000 g T_SEGMENT _main
-00000000 g T_SEGMENT $
-00000000 g T_SEGMENT $
-00000000 g T_SEGMENT $
-00000010 g T_SEGMENT $
-00000000 g T_SEGMENT main$F1
-fcffffff g T_SEGMENT i$1
-00000000 g T_SEGMENT $
-00000010 g T_SEGMENT $
-
-RELOCATION RECORDS FOR [D00000000]: (none)
-
-RELOCATION RECORDS FOR [D00008000]: (none)
-
-RELOCATION RECORDS FOR [T_SEGMENT]: (none)
-
-Disassembly of section D00000000:
-...
-00008000 ($+)7ff0 linkw fp,#-4
-00008004 ($+)7ff4 nop
-00008006 ($+)7ff6 movel #99,d0
-00008008 ($+)7ff8 cmpl fp@(-4),d0
-0000800c ($+)7ffc blts 00008014 ($+)8004
-0000800e ($+)7ffe addql #1,fp@(-4)
-00008012 ($+)8002 bras 00008006 ($+)7ff6
-00008014 ($+)8004 unlk fp
-00008016 ($+)8006 rts
-...
-
-*/
-
-static void
-tekhex_init ()
-{
- unsigned int i;
- static bfd_boolean inited = FALSE;
- int val;
-
- if (! inited)
- {
- inited = TRUE;
- hex_init ();
- val = 0;
- for (i = 0; i < 10; i++)
- {
- sum_block[i + '0'] = val++;
- }
- for (i = 'A'; i <= 'Z'; i++)
- {
- sum_block[i] = val++;
- }
- sum_block['$'] = val++;
- sum_block['%'] = val++;
- sum_block['.'] = val++;
- sum_block['_'] = val++;
- for (i = 'a'; i <= 'z'; i++)
- {
- sum_block[i] = val++;
- }
- }
-}
-
-/* The maximum number of bytes on a line is FF */
-#define MAXCHUNK 0xff
-/* The number of bytes we fit onto a line on output */
-#define CHUNK 21
-
-/* We cannot output our tekhexords as we see them, we have to glue them
- together, this is done in this structure : */
-
-struct tekhex_data_list_struct
-{
- unsigned char *data;
- bfd_vma where;
- bfd_size_type size;
- struct tekhex_data_list_struct *next;
-
-};
-typedef struct tekhex_data_list_struct tekhex_data_list_type;
-
-#define CHUNK_MASK 0x1fff
-
-struct data_struct
- {
- char chunk_data[CHUNK_MASK + 1];
- char chunk_init[CHUNK_MASK + 1];
- bfd_vma vma;
- struct data_struct *next;
- };
-
-typedef struct tekhex_data_struct
-{
- tekhex_data_list_type *head;
- unsigned int type;
- struct tekhex_symbol_struct *symbols;
- struct data_struct *data;
-} tdata_type;
-
-#define enda(x) (x->vma + x->size)
-
-static bfd_vma
-getvalue (srcp)
- char **srcp;
-{
- char *src = *srcp;
- bfd_vma value = 0;
- unsigned int len = hex_value(*src++);
-
- if (len == 0)
- len = 16;
- while (len--)
- {
- value = value << 4 | hex_value(*src++);
- }
- *srcp = src;
- return value;
-}
-
-static unsigned int
-getsym (dstp, srcp)
- char *dstp;
- char **srcp;
-{
- char *src = *srcp;
- unsigned int i;
- unsigned int len = hex_value(*src++);
-
- if (len == 0)
- len = 16;
- for (i = 0; i < len; i++)
- dstp[i] = src[i];
- dstp[i] = 0;
- *srcp = src + i;
- return len;
-}
-
-static struct data_struct *
-find_chunk (abfd, vma)
- bfd *abfd;
- bfd_vma vma;
-{
- struct data_struct *d = abfd->tdata.tekhex_data->data;
-
- vma &= ~CHUNK_MASK;
- while (d && (d->vma) != vma)
- {
- d = d->next;
- }
- if (!d)
- {
- /* No chunk for this address, so make one up */
- d = ((struct data_struct *)
- bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct)));
-
- if (!d)
- return NULL;
-
- d->next = abfd->tdata.tekhex_data->data;
- d->vma = vma;
- abfd->tdata.tekhex_data->data = d;
- }
- return d;
-}
-
-static void
-insert_byte (abfd, value, addr)
- bfd *abfd;
- int value;
- bfd_vma addr;
-{
- /* Find the chunk that this byte needs and put it in */
- struct data_struct *d = find_chunk (abfd, addr);
-
- d->chunk_data[addr & CHUNK_MASK] = value;
- d->chunk_init[addr & CHUNK_MASK] = 1;
-}
-
-/* The first pass is to find the names of all the sections, and see
- how big the data is */
-static void
-first_phase (abfd, type, src)
- bfd *abfd;
- int type;
- char *src;
-{
- asection *section = bfd_abs_section_ptr;
- unsigned int len;
- char sym[17]; /* A symbol can only be 16chars long */
-
- switch (type)
- {
- case '6':
- /* Data record - read it and store it */
- {
- bfd_vma addr = getvalue (&src);
-
- while (*src)
- {
- insert_byte (abfd, HEX (src), addr);
- src += 2;
- addr++;
- }
- }
-
- return;
- case '3':
- /* Symbol record, read the segment */
- len = getsym (sym, &src);
- section = bfd_get_section_by_name (abfd, sym);
- if (section == (asection *) NULL)
- {
- char *n = bfd_alloc (abfd, (bfd_size_type) len + 1);
-
- if (!n)
- abort (); /* FIXME */
- memcpy (n, sym, len + 1);
- section = bfd_make_section (abfd, n);
- }
- while (*src)
- {
- switch (*src)
- {
- case '1': /* section range */
- src++;
- section->vma = getvalue (&src);
- section->_raw_size = getvalue (&src) - section->vma;
- section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
- break;
- case '0':
- case '2':
- case '3':
- case '4':
- case '6':
- case '7':
- case '8':
- /* Symbols, add to section */
- {
- bfd_size_type amt = sizeof (tekhex_symbol_type);
- tekhex_symbol_type *new =
- (tekhex_symbol_type *) bfd_alloc (abfd, amt);
- char stype = (*src);
-
- if (!new)
- abort (); /* FIXME */
- new->symbol.the_bfd = abfd;
- src++;
- abfd->symcount++;
- abfd->flags |= HAS_SYMS;
- new->prev = abfd->tdata.tekhex_data->symbols;
- abfd->tdata.tekhex_data->symbols = new;
- len = getsym (sym, &src);
- new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1);
- if (!new->symbol.name)
- abort (); /* FIXME */
- memcpy ((char *) (new->symbol.name), sym, len + 1);
- new->symbol.section = section;
- if (stype <= '4')
- new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT);
- else
- new->symbol.flags = BSF_LOCAL;
- new->symbol.value = getvalue (&src) - section->vma;
- }
- }
- }
- }
-}
-
-/* Pass over a tekhex, calling one of the above functions on each
- record. */
-
-static void
-pass_over (abfd, func)
- bfd *abfd;
- void (*func) PARAMS ((bfd *, int, char *));
-{
- unsigned int chars_on_line;
- bfd_boolean eof = FALSE;
-
- /* To the front of the file */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- abort ();
- while (! eof)
- {
- char buffer[MAXCHUNK];
- char *src = buffer;
- char type;
-
- /* Find first '%' */
- eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
- while (*src != '%' && !eof)
- {
- eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
- }
- if (eof)
- break;
- src++;
-
- /* Fetch the type and the length and the checksum */
- if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5)
- abort (); /* FIXME */
-
- type = src[2];
-
- if (!ISHEX (src[0]) || !ISHEX (src[1]))
- break;
-
- chars_on_line = HEX (src) - 5; /* Already read five char */
-
- if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line)
- abort (); /* FIXME */
- src[chars_on_line] = 0; /* put a null at the end */
-
- func (abfd, type, src);
- }
-
-}
-
-static long
-tekhex_canonicalize_symtab (abfd, table)
- bfd *abfd;
- asymbol **table;
-{
- tekhex_symbol_type *p = abfd->tdata.tekhex_data->symbols;
- unsigned int c = bfd_get_symcount (abfd);
-
- table[c] = 0;
- while (p)
- {
- table[--c] = &(p->symbol);
- p = p->prev;
- }
-
- return bfd_get_symcount (abfd);
-}
-
-static long
-tekhex_get_symtab_upper_bound (abfd)
- bfd *abfd;
-{
- return (abfd->symcount + 1) * (sizeof (struct tekhex_asymbol_struct *));
-
-}
-
-static bfd_boolean
-tekhex_mkobject (abfd)
- bfd *abfd;
-{
- tdata_type *tdata;
-
- tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
- if (!tdata)
- return FALSE;
- abfd->tdata.tekhex_data = tdata;
- tdata->type = 1;
- tdata->head = (tekhex_data_list_type *) NULL;
- tdata->symbols = (struct tekhex_symbol_struct *) NULL;
- tdata->data = (struct data_struct *) NULL;
- return TRUE;
-}
-
-/*
- Return TRUE if the file looks like it's in TekHex format. Just look
- for a percent sign and some hex digits */
-
-static const bfd_target *
-tekhex_object_p (abfd)
- bfd *abfd;
-{
- char b[4];
-
- tekhex_init ();
-
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (b, (bfd_size_type) 4, abfd) != 4)
- return NULL;
-
- if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
- return (const bfd_target *) NULL;
-
- tekhex_mkobject (abfd);
-
- pass_over (abfd, first_phase);
- return abfd->xvec;
-}
-
-static void
-move_section_contents (abfd, section, locationp, offset, count, get)
- bfd *abfd;
- asection *section;
- const PTR locationp;
- file_ptr offset;
- bfd_size_type count;
- bfd_boolean get;
-{
- bfd_vma addr;
- char *location = (char *) locationp;
- bfd_vma prev_number = 1; /* Nothing can have this as a high bit*/
- struct data_struct *d = (struct data_struct *) NULL;
-
- BFD_ASSERT (offset == 0);
- for (addr = section->vma; count != 0; count--, addr++)
- {
- /* Get high bits of address. */
- bfd_vma chunk_number = addr & ~(bfd_vma) CHUNK_MASK;
- bfd_vma low_bits = addr & CHUNK_MASK;
-
- if (chunk_number != prev_number)
- {
- /* Different chunk, so move pointer */
- d = find_chunk (abfd, chunk_number);
- }
-
- if (get)
- {
- if (d->chunk_init[low_bits])
- {
- *location = d->chunk_data[low_bits];
- }
- else
- {
- *location = 0;
- }
- }
- else
- {
- d->chunk_data[low_bits] = *location;
- d->chunk_init[low_bits] = (*location != 0);
- }
-
- location++;
-
- }
-
-}
-
-static bfd_boolean
-tekhex_get_section_contents (abfd, section, locationp, offset, count)
- bfd *abfd;
- asection *section;
- PTR locationp;
- file_ptr offset;
- bfd_size_type count;
-{
- if (section->flags & (SEC_LOAD | SEC_ALLOC))
- {
- move_section_contents (abfd, section, locationp, offset, count, TRUE);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static bfd_boolean
-tekhex_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
-{
- return bfd_default_set_arch_mach (abfd, arch, machine);
-}
-
-/* we have to save up all the Tekhexords for a splurge before output,
- */
-
-static bfd_boolean
-tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do)
- bfd *abfd;
- sec_ptr section;
- const PTR locationp;
- file_ptr offset;
- bfd_size_type bytes_to_do;
-{
-
- if (! abfd->output_has_begun)
- {
- /* The first time around, allocate enough sections to hold all the chunks */
- asection *s = abfd->sections;
- bfd_vma vma;
-
- for (s = abfd->sections; s; s = s->next)
- {
- if (s->flags & SEC_LOAD)
- {
- for (vma = s->vma & ~(bfd_vma) CHUNK_MASK;
- vma < s->vma + s->_raw_size;
- vma += CHUNK_MASK)
- find_chunk (abfd, vma);
- }
- }
-
- }
- if (section->flags & (SEC_LOAD | SEC_ALLOC))
- {
- move_section_contents (abfd, section, locationp, offset, bytes_to_do,
- FALSE);
- return TRUE;
- }
- else
- return FALSE;
-
-}
-
-static void
-writevalue (dst, value)
- char **dst;
- bfd_vma value;
-{
- char *p = *dst;
- int len;
- int shift;
-
- for (len = 8, shift = 28; shift; shift -= 4, len--)
- {
- if ((value >> shift) & 0xf)
- {
- *p++ = len + '0';
- while (len)
- {
- *p++ = digs[(value >> shift) & 0xf];
- shift -= 4;
- len--;
- }
- *dst = p;
- return;
-
- }
- }
- *p++ = '1';
- *p++ = '0';
- *dst = p;
-}
-
-static void
-writesym (dst, sym)
- char **dst;
- const char *sym;
-{
- char *p = *dst;
- int len = (sym ? strlen (sym) : 0);
-
- if (len >= 16)
- {
- *p++ = '0';
- len = 16;
- }
-
- else
- {
- if (len == 0)
- {
- *p++ = '1';
- sym = "$";
- len = 1;
- }
- else
- {
- *p++ = digs[len];
- }
- }
-
- while (len--)
- {
- *p++ = *sym++;
- }
- *dst = p;
-}
-
-static void
-out (abfd, type, start, end)
- bfd *abfd;
- int type;
- char *start;
- char *end;
-{
- int sum = 0;
- char *s;
- char front[6];
- bfd_size_type wrlen;
-
- front[0] = '%';
- TOHEX (front + 1, end - start + 5);
- front[3] = type;
-
- for (s = start; s < end; s++)
- {
- sum += sum_block[(unsigned char) *s];
- }
-
- sum += sum_block[(unsigned char) front[1]]; /* length */
- sum += sum_block[(unsigned char) front[2]];
- sum += sum_block[(unsigned char) front[3]]; /* type */
- TOHEX (front + 4, sum);
- if (bfd_bwrite (front, (bfd_size_type) 6, abfd) != 6)
- abort ();
- end[0] = '\n';
- wrlen = end - start + 1;
- if (bfd_bwrite (start, wrlen, abfd) != wrlen)
- abort ();
-}
-
-static bfd_boolean
-tekhex_write_object_contents (abfd)
- bfd *abfd;
-{
- int bytes_written;
- char buffer[100];
- asymbol **p;
- asection *s;
- struct data_struct *d;
-
- tekhex_init ();
-
- bytes_written = 0;
-
- /* And the raw data */
- for (d = abfd->tdata.tekhex_data->data;
- d != (struct data_struct *) NULL;
- d = d->next)
- {
- int low;
-
- const int span = 32;
- int addr;
-
- /* Write it in blocks of 32 bytes */
-
- for (addr = 0; addr < CHUNK_MASK + 1; addr += span)
- {
- int need = 0;
-
- /* Check to see if necessary */
- for (low = 0; !need && low < span; low++)
- {
- if (d->chunk_init[addr + low])
- need = 1;
- }
- if (need)
- {
- char *dst = buffer;
-
- writevalue (&dst, addr + d->vma);
- for (low = 0; low < span; low++)
- {
- TOHEX (dst, d->chunk_data[addr + low]);
- dst += 2;
- }
- out (abfd, '6', buffer, dst);
- }
- }
- }
- /* write all the section headers for the sections */
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
- {
- char *dst = buffer;
-
- writesym (&dst, s->name);
- *dst++ = '1';
- writevalue (&dst, s->vma);
- writevalue (&dst, s->vma + s->_raw_size);
- out (abfd, '3', buffer, dst);
- }
-
- /* And the symbols */
- if (abfd->outsymbols)
- {
- for (p = abfd->outsymbols; *p; p++)
- {
- int section_code = bfd_decode_symclass (*p);
-
- if (section_code != '?')
- { /* do not include debug symbols */
- asymbol *sym = *p;
- char *dst = buffer;
-
- writesym (&dst, sym->section->name);
-
- switch (section_code)
- {
- case 'A':
- *dst++ = '2';
- break;
- case 'a':
- *dst++ = '6';
- break;
- case 'D':
- case 'B':
- case 'O':
- *dst++ = '4';
- break;
- case 'd':
- case 'b':
- case 'o':
- *dst++ = '8';
- break;
- case 'T':
- *dst++ = '3';
- break;
- case 't':
- *dst++ = '7';
- break;
- case 'C':
- case 'U':
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-
- writesym (&dst, sym->name);
- writevalue (&dst, sym->value + sym->section->vma);
- out (abfd, '3', buffer, dst);
- }
- }
- }
-
- /* And the terminator */
- if (bfd_bwrite ("%0781010\n", (bfd_size_type) 9, abfd) != 9)
- abort ();
- return TRUE;
-}
-
-static int
-tekhex_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
-
-{
- return 0;
-}
-
-static asymbol *
-tekhex_make_empty_symbol (abfd)
- bfd *abfd;
-{
- bfd_size_type amt = sizeof (struct tekhex_symbol_struct);
- tekhex_symbol_type *new = (tekhex_symbol_type *) bfd_zalloc (abfd, amt);
-
- if (!new)
- return NULL;
- new->symbol.the_bfd = abfd;
- new->prev = (struct tekhex_symbol_struct *) NULL;
- return &(new->symbol);
-}
-
-static void
-tekhex_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
-{
- bfd_symbol_info (symbol, ret);
-}
-
-static void
-tekhex_print_symbol (abfd, filep, symbol, how)
- bfd *abfd;
- PTR filep;
- asymbol *symbol;
- bfd_print_symbol_type how;
-{
- FILE *file = (FILE *) filep;
-
- switch (how)
- {
- case bfd_print_symbol_name:
- fprintf (file, "%s", symbol->name);
- break;
- case bfd_print_symbol_more:
- break;
-
- case bfd_print_symbol_all:
- {
- const char *section_name = symbol->section->name;
-
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
-
- fprintf (file, " %-5s %s",
- section_name,
- symbol->name);
- }
- }
-}
-
-#define tekhex_close_and_cleanup _bfd_generic_close_and_cleanup
-#define tekhex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define tekhex_new_section_hook _bfd_generic_new_section_hook
-
-#define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define tekhex_get_lineno _bfd_nosymbols_get_lineno
-#define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define tekhex_read_minisymbols _bfd_generic_read_minisymbols
-#define tekhex_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define tekhex_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
-#define tekhex_bfd_relax_section bfd_generic_relax_section
-#define tekhex_bfd_gc_sections bfd_generic_gc_sections
-#define tekhex_bfd_merge_sections bfd_generic_merge_sections
-#define tekhex_bfd_discard_group bfd_generic_discard_group
-#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms
-#define tekhex_bfd_final_link _bfd_generic_final_link
-#define tekhex_bfd_link_split_section _bfd_generic_link_split_section
-
-#define tekhex_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
-const bfd_target tekhex_vec =
-{
- "tekhex", /* name */
- bfd_target_tekhex_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- (EXEC_P | /* object flags */
- HAS_SYMS | HAS_LINENO | HAS_DEBUG | HAS_RELOC | HAS_LOCALS |
- WP_TEXT | D_PAGED),
- (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
- | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* leading underscore */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {
- _bfd_dummy_target,
- tekhex_object_p, /* bfd_check_format */
- _bfd_dummy_target,
- _bfd_dummy_target,
- },
- {
- bfd_false,
- tekhex_mkobject,
- _bfd_generic_mkarchive,
- bfd_false,
- },
- { /* bfd_write_contents */
- bfd_false,
- tekhex_write_object_contents,
- _bfd_write_archive_contents,
- bfd_false,
- },
-
- BFD_JUMP_TABLE_GENERIC (tekhex),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (_bfd_nocore),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (tekhex),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (tekhex),
- BFD_JUMP_TABLE_LINK (tekhex),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0
-};
diff --git a/contrib/binutils/bfd/trad-core.c b/contrib/binutils/bfd/trad-core.c
deleted file mode 100644
index f8c03d7..0000000
--- a/contrib/binutils/bfd/trad-core.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/* BFD back end for traditional Unix core files (U-area and raw sections)
- Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Written by John Gilmore of Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h" /* BFD a.out internal data structures */
-
-#include <sys/param.h>
-#ifdef HAVE_DIRENT_H
-# include <dirent.h>
-#else
-# ifdef HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# ifdef HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# ifdef HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif
-#include <signal.h>
-
-#include <sys/user.h> /* After a.out.h */
-
-#ifdef TRAD_HEADER
-#include TRAD_HEADER
-#endif
-
-struct trad_core_struct
-{
- asection *data_section;
- asection *stack_section;
- asection *reg_section;
- struct user u;
-};
-
-#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
-#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
-#define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section)
-#define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section)
-
-/* forward declarations */
-
-const bfd_target *trad_unix_core_file_p PARAMS ((bfd *abfd));
-char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd));
-int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd));
-bfd_boolean trad_unix_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-static void swap_abort PARAMS ((void));
-
-/* Handle 4.2-style (and perhaps also sysV-style) core dump file. */
-
-const bfd_target *
-trad_unix_core_file_p (abfd)
- bfd *abfd;
-
-{
- int val;
- struct user u;
- struct trad_core_struct *rawptr;
- bfd_size_type amt;
-
-#ifdef TRAD_CORE_USER_OFFSET
- /* If defined, this macro is the file position of the user struct. */
- if (bfd_seek (abfd, (file_ptr) TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
- return 0;
-#endif
-
- val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd);
- if (val != sizeof u)
- {
- /* Too small to be a core file */
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- /* Sanity check perhaps??? */
- if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */
- {
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
- if (u.u_ssize > 0x1000000)
- {
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- /* Check that the size claimed is no greater than the file size. */
- {
- FILE *stream = bfd_cache_lookup (abfd);
- struct stat statbuf;
- if (stream == NULL)
- return 0;
- if (fstat (fileno (stream), &statbuf) < 0)
- {
- bfd_set_error (bfd_error_system_call);
- return 0;
- }
- if ((unsigned long) (NBPG * (UPAGES + u.u_dsize
-#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- - u.u_tsize
-#endif
- + u.u_ssize))
- > (unsigned long) statbuf.st_size)
- {
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-#ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE
- if ((unsigned long) (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
-#ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED
- /* Some systems write the file too big. */
- + TRAD_CORE_EXTRA_SIZE_ALLOWED
-#endif
- )
- < (unsigned long) statbuf.st_size)
- {
- /* The file is too big. Maybe it's not a core file
- or we otherwise have bad values for u_dsize and u_ssize). */
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-#endif
- }
-
- /* OK, we believe you. You're a core file (sure, sure). */
-
- /* Allocate both the upage and the struct core_data at once, so
- a single free() will free them both. */
- amt = sizeof (struct trad_core_struct);
- rawptr = (struct trad_core_struct *) bfd_zmalloc (amt);
- if (rawptr == NULL)
- return 0;
-
- abfd->tdata.trad_core_data = rawptr;
-
- rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
-
- /* Create the sections. */
-
- core_stacksec(abfd) = bfd_make_section_anyway (abfd, ".stack");
- if (core_stacksec (abfd) == NULL)
- goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
- if (core_datasec (abfd) == NULL)
- goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
- if (core_regsec (abfd) == NULL)
- goto fail;
-
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
-
- core_datasec (abfd)->_raw_size = NBPG * u.u_dsize
-#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- - NBPG * u.u_tsize
-#endif
- ;
- core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize;
- core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */
-
- /* What a hack... we'd like to steal it from the exec file,
- since the upage does not seem to provide it. FIXME. */
-#ifdef HOST_DATA_START_ADDR
- core_datasec (abfd)->vma = HOST_DATA_START_ADDR;
-#else
- core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize);
-#endif
-
-#ifdef HOST_STACK_START_ADDR
- core_stacksec (abfd)->vma = HOST_STACK_START_ADDR;
-#else
- core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize);
-#endif
-
- /* This is tricky. As the "register section", we give them the entire
- upage and stack. u.u_ar0 points to where "register 0" is stored.
- There are two tricks with this, though. One is that the rest of the
- registers might be at positive or negative (or both) displacements
- from *u_ar0. The other is that u_ar0 is sometimes an absolute address
- in kernel memory, and on other systems it is an offset from the beginning
- of the `struct user'.
-
- As a practical matter, we don't know where the registers actually are,
- so we have to pass the whole area to GDB. We encode the value of u_ar0
- by setting the .regs section up so that its virtual memory address
- 0 is at the place pointed to by u_ar0 (by setting the vma of the start
- of the section to -u_ar0). GDB uses this info to locate the regs,
- using minor trickery to get around the offset-or-absolute-addr problem. */
- core_regsec (abfd)->vma = - (bfd_vma) (unsigned long) u.u_ar0;
-
- core_datasec (abfd)->filepos = NBPG * UPAGES;
- core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize
-#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- - NBPG * u.u_tsize
-#endif
- ;
- core_regsec (abfd)->filepos = 0; /* Register segment is the upage */
-
- /* Align to word at least */
- core_stacksec (abfd)->alignment_power = 2;
- core_datasec (abfd)->alignment_power = 2;
- core_regsec (abfd)->alignment_power = 2;
-
- return abfd->xvec;
-
- fail:
- bfd_release (abfd, abfd->tdata.any);
- abfd->tdata.any = NULL;
- bfd_section_list_clear (abfd);
- return NULL;
-}
-
-char *
-trad_unix_core_file_failing_command (abfd)
- bfd *abfd;
-{
-#ifndef NO_CORE_COMMAND
- char *com = abfd->tdata.trad_core_data->u.u_comm;
- if (*com)
- return com;
- else
-#endif
- return 0;
-}
-
-int
-trad_unix_core_file_failing_signal (ignore_abfd)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
-{
-#ifdef TRAD_UNIX_CORE_FILE_FAILING_SIGNAL
- return TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(ignore_abfd);
-#else
- return -1; /* FIXME, where is it? */
-#endif
-}
-
-bfd_boolean
-trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd ATTRIBUTE_UNUSED;
- bfd *exec_bfd ATTRIBUTE_UNUSED;
-{
- return TRUE; /* FIXME, We have no way of telling at this point */
-}
-
-/* If somebody calls any byte-swapping routines, shoot them. */
-static void
-swap_abort ()
-{
- abort (); /* This way doesn't require any declaration for ANSI to fuck up */
-}
-
-#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
-#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
-#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
-#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
-#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
-#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
-
-const bfd_target trad_core_vec =
- {
- "trad-core",
- bfd_target_unknown_flavour,
- BFD_ENDIAN_UNKNOWN, /* target byte order */
- BFD_ENDIAN_UNKNOWN, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* symbol prefix */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
- NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
-
- { /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- trad_unix_core_file_p /* a core file */
- },
- { /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
- { /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
- },
-
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (trad_unix),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- NULL,
-
- (PTR) 0 /* backend_data */
- };
diff --git a/contrib/binutils/bfd/version.h b/contrib/binutils/bfd/version.h
deleted file mode 100644
index ab4618d..0000000
--- a/contrib/binutils/bfd/version.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define BFD_VERSION_DATE 20040523
-#define BFD_VERSION @bfd_version@
-#define BFD_VERSION_STRING @bfd_version_string@
diff --git a/contrib/binutils/bfd/xcoff-target.h b/contrib/binutils/bfd/xcoff-target.h
deleted file mode 100644
index 7bf3de7..0000000
--- a/contrib/binutils/bfd/xcoff-target.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
- Copyright 2000, 2001, 2002
- Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Internalcoff.h and coffcode.h modify themselves based on this flag. */
-#define RS6000COFF_C 1
-
-#define SELECT_RELOC(internal, howto) \
- { \
- internal.r_type = howto->type; \
- internal.r_size = \
- ((howto->complain_on_overflow == complain_overflow_signed \
- ? 0x80 \
- : 0) \
- | (howto->bitsize - 1)); \
- }
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
-
-#define COFF_LONG_FILENAMES
-
-#define NO_COFF_SYMBOLS
-
-#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst)
-
-#define coff_mkobject _bfd_xcoff_mkobject
-#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
-#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
-#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
-#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
-
-#define CORE_FILE_P _bfd_dummy_target
-
-#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
-#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
-#define coff_core_file_matches_executable_p \
- _bfd_nocore_core_file_matches_executable_p
-
-#ifdef AIX_CORE
-#undef CORE_FILE_P
-#define CORE_FILE_P rs6000coff_core_p
-extern const bfd_target * rs6000coff_core_p ();
-extern bfd_boolean rs6000coff_core_file_matches_executable_p ();
-
-#undef coff_core_file_matches_executable_p
-#define coff_core_file_matches_executable_p \
- rs6000coff_core_file_matches_executable_p
-
-extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
-#undef coff_core_file_failing_command
-#define coff_core_file_failing_command rs6000coff_core_file_failing_command
-
-extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
-#undef coff_core_file_failing_signal
-#define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
-#endif /* AIX_CORE */
-
-#ifdef LYNX_CORE
-
-#undef CORE_FILE_P
-#define CORE_FILE_P lynx_core_file_p
-extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd));
-
-extern bfd_boolean lynx_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-#undef coff_core_file_matches_executable_p
-#define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
-
-extern char *lynx_core_file_failing_command PARAMS ((bfd *abfd));
-#undef coff_core_file_failing_command
-#define coff_core_file_failing_command lynx_core_file_failing_command
-
-extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
-#undef coff_core_file_failing_signal
-#define coff_core_file_failing_signal lynx_core_file_failing_signal
-
-#endif /* LYNX_CORE */
-
-#define _bfd_xcoff_bfd_get_relocated_section_contents \
- coff_bfd_get_relocated_section_contents
-#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
-#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
-#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
-#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
-#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
-
-/* XCOFF archives do not have anything which corresponds to an
- extended name table. */
-
-#define _bfd_xcoff_slurp_extended_name_table bfd_false
-#define _bfd_xcoff_construct_extended_name_table \
- ((bfd_boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
- bfd_false)
-#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname
-
-/* We can use the standard get_elt_at_index routine. */
-
-#define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index
-
-/* XCOFF archives do not have a timestamp. */
-
-#define _bfd_xcoff_update_armap_timestamp bfd_true
-
-extern bfd_boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
-extern bfd_boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
-extern bfd_boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
-extern void _bfd_xcoff_rtype2howto
- PARAMS ((arelent *, struct internal_reloc *));
-extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-extern bfd_boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
-extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *));
-extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
-extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
-extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
-extern bfd_boolean _bfd_xcoff_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
-extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, bfd_boolean));
-extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
-extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-
-#ifndef coff_SWAP_sym_in
-#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
-#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
-#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
-#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
-#endif
-
-#include "coffcode.h"
-
-/* The transfer vector that leads the outside world to all of the above. */
-
-const bfd_target TARGET_SYM =
-{
- TARGET_NAME,
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
-
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG | DYNAMIC |
- HAS_SYMS | HAS_LOCALS | WP_TEXT),
-
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* leading char */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen??? FIXMEmgo */
-
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
- _bfd_xcoff_archive_p, CORE_FILE_P},
- {bfd_false, coff_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
- _bfd_xcoff_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (coff),
- BFD_JUMP_TABLE_COPY (coff),
- BFD_JUMP_TABLE_CORE (coff),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff),
- BFD_JUMP_TABLE_SYMBOLS (coff),
- BFD_JUMP_TABLE_RELOCS (coff),
- BFD_JUMP_TABLE_WRITE (coff),
- BFD_JUMP_TABLE_LINK (_bfd_xcoff),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
-
- NULL,
-
- COFF_SWAP_TABLE
-};
diff --git a/contrib/binutils/bfd/xcofflink.c b/contrib/binutils/bfd/xcofflink.c
deleted file mode 100644
index ccd82be..0000000
--- a/contrib/binutils/bfd/xcofflink.c
+++ /dev/null
@@ -1,6167 +0,0 @@
-/* POWER/PowerPC XCOFF linker support.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-#include "libbfd.h"
-#include "coff/internal.h"
-#include "coff/xcoff.h"
-#include "libcoff.h"
-#include "libxcoff.h"
-
-/* This file holds the XCOFF linker code. */
-
-#define STRING_SIZE_SIZE (4)
-
-/* We reuse the SEC_ROM flag as a mark flag for garbage collection.
- This flag will only be used on input sections. */
-
-#define SEC_MARK (SEC_ROM)
-
-/* The list of import files. */
-
-struct xcoff_import_file
-{
- /* The next entry in the list. */
- struct xcoff_import_file *next;
- /* The path. */
- const char *path;
- /* The file name. */
- const char *file;
- /* The member name. */
- const char *member;
-};
-
-/* Information we keep for each section in the output file during the
- final link phase. */
-
-struct xcoff_link_section_info
-{
- /* The relocs to be output. */
- struct internal_reloc *relocs;
- /* For each reloc against a global symbol whose index was not known
- when the reloc was handled, the global hash table entry. */
- struct xcoff_link_hash_entry **rel_hashes;
- /* If there is a TOC relative reloc against a global symbol, and the
- index of the TOC symbol is not known when the reloc was handled,
- an entry is added to this linked list. This is not an array,
- like rel_hashes, because this case is quite uncommon. */
- struct xcoff_toc_rel_hash {
- struct xcoff_toc_rel_hash *next;
- struct xcoff_link_hash_entry *h;
- struct internal_reloc *rel;
- } *toc_rel_hashes;
-};
-
-/* Information that we pass around while doing the final link step. */
-
-struct xcoff_final_link_info
-{
- /* General link information. */
- struct bfd_link_info *info;
- /* Output BFD. */
- bfd *output_bfd;
- /* Hash table for long symbol names. */
- struct bfd_strtab_hash *strtab;
- /* Array of information kept for each output section, indexed by the
- target_index field. */
- struct xcoff_link_section_info *section_info;
- /* Symbol index of last C_FILE symbol (-1 if none). */
- long last_file_index;
- /* Contents of last C_FILE symbol. */
- struct internal_syment last_file;
- /* Symbol index of TOC symbol. */
- long toc_symindx;
- /* Start of .loader symbols. */
- bfd_byte *ldsym;
- /* Next .loader reloc to swap out. */
- bfd_byte *ldrel;
- /* File position of start of line numbers. */
- file_ptr line_filepos;
- /* Buffer large enough to hold swapped symbols of any input file. */
- struct internal_syment *internal_syms;
- /* Buffer large enough to hold output indices of symbols of any
- input file. */
- long *sym_indices;
- /* Buffer large enough to hold output symbols for any input file. */
- bfd_byte *outsyms;
- /* Buffer large enough to hold external line numbers for any input
- section. */
- bfd_byte *linenos;
- /* Buffer large enough to hold any input section. */
- bfd_byte *contents;
- /* Buffer large enough to hold external relocs of any input section. */
- bfd_byte *external_relocs;
-};
-
-static struct bfd_hash_entry *xcoff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static bfd_boolean xcoff_get_section_contents PARAMS ((bfd *, asection *));
-static struct internal_reloc *xcoff_read_internal_relocs
- PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
- struct internal_reloc *));
-static bfd_boolean xcoff_link_add_object_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean xcoff_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *));
-static bfd_boolean xcoff_link_check_ar_symbols
- PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *));
-static bfd_boolean xcoff_link_check_dynamic_ar_symbols
- PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *));
-static bfd_size_type xcoff_find_reloc
- PARAMS ((struct internal_reloc *, bfd_size_type, bfd_vma));
-static bfd_boolean xcoff_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean xcoff_link_add_dynamic_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean xcoff_mark_symbol
- PARAMS ((struct bfd_link_info *, struct xcoff_link_hash_entry *));
-static bfd_boolean xcoff_mark PARAMS ((struct bfd_link_info *, asection *));
-static void xcoff_sweep PARAMS ((struct bfd_link_info *));
-static bfd_boolean xcoff_build_ldsyms
- PARAMS ((struct xcoff_link_hash_entry *, PTR));
-static bfd_boolean xcoff_link_input_bfd
- PARAMS ((struct xcoff_final_link_info *, bfd *));
-static bfd_boolean xcoff_write_global_symbol
- PARAMS ((struct xcoff_link_hash_entry *, PTR));
-static bfd_boolean xcoff_reloc_link_order
- PARAMS ((bfd *, struct xcoff_final_link_info *, asection *,
- struct bfd_link_order *));
-static int xcoff_sort_relocs PARAMS ((const PTR, const PTR));
-
-
-/* Routines to read XCOFF dynamic information. This don't really
- belong here, but we already have the ldsym manipulation routines
- here. */
-
-/* Read the contents of a section. */
-
-static bfd_boolean
-xcoff_get_section_contents (abfd, sec)
- bfd *abfd;
- asection *sec;
-{
-
- if (coff_section_data (abfd, sec) == NULL)
- {
- bfd_size_type amt = sizeof (struct coff_section_tdata);
- sec->used_by_bfd = bfd_zalloc (abfd, amt);
- if (sec->used_by_bfd == NULL)
- return FALSE;
- }
-
- if (coff_section_data (abfd, sec)->contents == NULL)
- {
- coff_section_data (abfd, sec)->contents = ((bfd_byte *)
- bfd_malloc (sec->_raw_size));
- if (coff_section_data (abfd, sec)->contents == NULL)
- return FALSE;
-
- if (! bfd_get_section_contents (abfd, sec,
- coff_section_data (abfd, sec)->contents,
- (file_ptr) 0, sec->_raw_size))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Get the size required to hold the dynamic symbols. */
-
-long
-_bfd_xcoff_get_dynamic_symtab_upper_bound (abfd)
- bfd *abfd;
-{
- asection *lsec;
- bfd_byte *contents;
- struct internal_ldhdr ldhdr;
-
- if ((abfd->flags & DYNAMIC) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- lsec = bfd_get_section_by_name (abfd, ".loader");
- if (lsec == NULL)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- if (! xcoff_get_section_contents (abfd, lsec))
- return -1;
- contents = coff_section_data (abfd, lsec)->contents;
-
- bfd_xcoff_swap_ldhdr_in (abfd, (PTR) contents, &ldhdr);
-
- return (ldhdr.l_nsyms + 1) * sizeof (asymbol *);
-}
-
-/* Get the dynamic symbols. */
-
-long
-_bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
- bfd *abfd;
- asymbol **psyms;
-{
- asection *lsec;
- bfd_byte *contents;
- struct internal_ldhdr ldhdr;
- const char *strings;
- bfd_byte *elsym, *elsymend;
- coff_symbol_type *symbuf;
-
- if ((abfd->flags & DYNAMIC) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- lsec = bfd_get_section_by_name (abfd, ".loader");
- if (lsec == NULL)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- if (! xcoff_get_section_contents (abfd, lsec))
- return -1;
- contents = coff_section_data (abfd, lsec)->contents;
-
- coff_section_data (abfd, lsec)->keep_contents = TRUE;
-
- bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
-
- strings = (char *) contents + ldhdr.l_stoff;
-
- symbuf = ((coff_symbol_type *)
- bfd_zalloc (abfd, ldhdr.l_nsyms * sizeof (coff_symbol_type)));
- if (symbuf == NULL)
- return -1;
-
- elsym = contents + bfd_xcoff_loader_symbol_offset(abfd, &ldhdr);
-
- elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd);
- for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd), symbuf++, psyms++)
- {
- struct internal_ldsym ldsym;
-
- bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
-
- symbuf->symbol.the_bfd = abfd;
-
- if (ldsym._l._l_l._l_zeroes == 0)
- symbuf->symbol.name = strings + ldsym._l._l_l._l_offset;
- else
- {
- char *c;
-
- c = bfd_alloc (abfd, (bfd_size_type) SYMNMLEN + 1);
- if (c == NULL)
- return -1;
- memcpy (c, ldsym._l._l_name, SYMNMLEN);
- c[SYMNMLEN] = '\0';
- symbuf->symbol.name = c;
- }
-
- if (ldsym.l_smclas == XMC_XO)
- symbuf->symbol.section = bfd_abs_section_ptr;
- else
- symbuf->symbol.section = coff_section_from_bfd_index (abfd,
- ldsym.l_scnum);
- symbuf->symbol.value = ldsym.l_value - symbuf->symbol.section->vma;
-
- symbuf->symbol.flags = BSF_NO_FLAGS;
- if ((ldsym.l_smtype & L_EXPORT) != 0)
- symbuf->symbol.flags |= BSF_GLOBAL;
-
- /* FIXME: We have no way to record the other information stored
- with the loader symbol. */
-
- *psyms = (asymbol *) symbuf;
- }
-
- *psyms = NULL;
-
- return ldhdr.l_nsyms;
-}
-
-/* Get the size required to hold the dynamic relocs. */
-
-long
-_bfd_xcoff_get_dynamic_reloc_upper_bound (abfd)
- bfd *abfd;
-{
- asection *lsec;
- bfd_byte *contents;
- struct internal_ldhdr ldhdr;
-
- if ((abfd->flags & DYNAMIC) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- lsec = bfd_get_section_by_name (abfd, ".loader");
- if (lsec == NULL)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- if (! xcoff_get_section_contents (abfd, lsec))
- return -1;
- contents = coff_section_data (abfd, lsec)->contents;
-
- bfd_xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr);
-
- return (ldhdr.l_nreloc + 1) * sizeof (arelent *);
-}
-
-/* Get the dynamic relocs. */
-
-long
-_bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
- bfd *abfd;
- arelent **prelocs;
- asymbol **syms;
-{
- asection *lsec;
- bfd_byte *contents;
- struct internal_ldhdr ldhdr;
- arelent *relbuf;
- bfd_byte *elrel, *elrelend;
-
- if ((abfd->flags & DYNAMIC) == 0)
- {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
-
- lsec = bfd_get_section_by_name (abfd, ".loader");
- if (lsec == NULL)
- {
- bfd_set_error (bfd_error_no_symbols);
- return -1;
- }
-
- if (! xcoff_get_section_contents (abfd, lsec))
- return -1;
- contents = coff_section_data (abfd, lsec)->contents;
-
- bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
-
- relbuf = (arelent *) bfd_alloc (abfd, ldhdr.l_nreloc * sizeof (arelent));
- if (relbuf == NULL)
- return -1;
-
- elrel = contents + bfd_xcoff_loader_reloc_offset(abfd, &ldhdr);
-
- elrelend = elrel + ldhdr.l_nreloc * bfd_xcoff_ldrelsz(abfd);
- for (; elrel < elrelend; elrel += bfd_xcoff_ldrelsz(abfd), relbuf++,
- prelocs++)
- {
- struct internal_ldrel ldrel;
-
- bfd_xcoff_swap_ldrel_in (abfd, elrel, &ldrel);
-
- if (ldrel.l_symndx >= 3)
- relbuf->sym_ptr_ptr = syms + (ldrel.l_symndx - 3);
- else
- {
- const char *name;
- asection *sec;
-
- switch (ldrel.l_symndx)
- {
- case 0:
- name = ".text";
- break;
- case 1:
- name = ".data";
- break;
- case 2:
- name = ".bss";
- break;
- default:
- abort ();
- break;
- }
-
- sec = bfd_get_section_by_name (abfd, name);
- if (sec == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return -1;
- }
-
- relbuf->sym_ptr_ptr = sec->symbol_ptr_ptr;
- }
-
- relbuf->address = ldrel.l_vaddr;
- relbuf->addend = 0;
-
- /* Most dynamic relocs have the same type. FIXME: This is only
- correct if ldrel.l_rtype == 0. In other cases, we should use
- a different howto. */
- relbuf->howto = bfd_xcoff_dynamic_reloc_howto(abfd);
-
- /* FIXME: We have no way to record the l_rsecnm field. */
-
- *prelocs = relbuf;
- }
-
- *prelocs = NULL;
-
- return ldhdr.l_nreloc;
-}
-
-/* Routine to create an entry in an XCOFF link hash table. */
-
-static struct bfd_hash_entry *
-xcoff_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct xcoff_link_hash_entry *ret = (struct xcoff_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct xcoff_link_hash_entry *) NULL)
- ret = ((struct xcoff_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct xcoff_link_hash_entry)));
- if (ret == (struct xcoff_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct xcoff_link_hash_entry *)
- _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != NULL)
- {
- /* Set local fields. */
- ret->indx = -1;
- ret->toc_section = NULL;
- ret->u.toc_indx = -1;
- ret->descriptor = NULL;
- ret->ldsym = NULL;
- ret->ldindx = -1;
- ret->flags = 0;
- ret->smclas = XMC_UA;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-/* Create a XCOFF link hash table. */
-
-struct bfd_link_hash_table *
-_bfd_xcoff_bfd_link_hash_table_create (abfd)
- bfd *abfd;
-{
- struct xcoff_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct xcoff_link_hash_table);
-
- ret = (struct xcoff_link_hash_table *) bfd_malloc (amt);
- if (ret == (struct xcoff_link_hash_table *) NULL)
- return (struct bfd_link_hash_table *) NULL;
- if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc))
- {
- free (ret);
- return (struct bfd_link_hash_table *) NULL;
- }
-
- ret->debug_strtab = _bfd_xcoff_stringtab_init ();
- ret->debug_section = NULL;
- ret->loader_section = NULL;
- ret->ldrel_count = 0;
- memset (&ret->ldhdr, 0, sizeof (struct internal_ldhdr));
- ret->linkage_section = NULL;
- ret->toc_section = NULL;
- ret->descriptor_section = NULL;
- ret->imports = NULL;
- ret->file_align = 0;
- ret->textro = FALSE;
- ret->gc = FALSE;
- memset (ret->special_sections, 0, sizeof ret->special_sections);
-
- /* The linker will always generate a full a.out header. We need to
- record that fact now, before the sizeof_headers routine could be
- called. */
- xcoff_data (abfd)->full_aouthdr = TRUE;
-
- return &ret->root;
-}
-
-/* Free a XCOFF link hash table. */
-
-void
-_bfd_xcoff_bfd_link_hash_table_free (hash)
- struct bfd_link_hash_table *hash;
-{
- struct xcoff_link_hash_table *ret = (struct xcoff_link_hash_table *) hash;
-
- _bfd_stringtab_free (ret->debug_strtab);
- bfd_hash_table_free (&ret->root.table);
- free (ret);
-}
-
-/* Read internal relocs for an XCOFF csect. This is a wrapper around
- _bfd_coff_read_internal_relocs which tries to take advantage of any
- relocs which may have been cached for the enclosing section. */
-
-static struct internal_reloc *
-xcoff_read_internal_relocs (abfd, sec, cache, external_relocs,
- require_internal, internal_relocs)
- bfd *abfd;
- asection *sec;
- bfd_boolean cache;
- bfd_byte *external_relocs;
- bfd_boolean require_internal;
- struct internal_reloc *internal_relocs;
-{
-
- if (coff_section_data (abfd, sec) != NULL
- && coff_section_data (abfd, sec)->relocs == NULL
- && xcoff_section_data (abfd, sec) != NULL)
- {
- asection *enclosing;
-
- enclosing = xcoff_section_data (abfd, sec)->enclosing;
-
- if (enclosing != NULL
- && (coff_section_data (abfd, enclosing) == NULL
- || coff_section_data (abfd, enclosing)->relocs == NULL)
- && cache
- && enclosing->reloc_count > 0)
- {
- if (_bfd_coff_read_internal_relocs (abfd, enclosing, TRUE,
- external_relocs, FALSE,
- (struct internal_reloc *) NULL)
- == NULL)
- return NULL;
- }
-
- if (enclosing != NULL
- && coff_section_data (abfd, enclosing) != NULL
- && coff_section_data (abfd, enclosing)->relocs != NULL)
- {
- size_t off;
-
- off = ((sec->rel_filepos - enclosing->rel_filepos)
- / bfd_coff_relsz (abfd));
-
- if (! require_internal)
- return coff_section_data (abfd, enclosing)->relocs + off;
- memcpy (internal_relocs,
- coff_section_data (abfd, enclosing)->relocs + off,
- sec->reloc_count * sizeof (struct internal_reloc));
- return internal_relocs;
- }
- }
-
- return _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
- require_internal, internal_relocs);
-}
-
-/* Given an XCOFF BFD, add symbols to the global hash table as
- appropriate. */
-
-bfd_boolean
-_bfd_xcoff_bfd_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
-
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
- return xcoff_link_add_object_symbols (abfd, info);
-
- case bfd_archive:
- /* If the archive has a map, do the usual search. We then need
- to check the archive for dynamic objects, because they may not
- appear in the archive map even though they should, perhaps, be
- included. If the archive has no map, we just consider each object
- file in turn, since that apparently is what the AIX native linker
- does. */
- if (bfd_has_map (abfd))
- {
- if (! (_bfd_generic_link_add_archive_symbols
- (abfd, info, xcoff_link_check_archive_element)))
- return FALSE;
- }
-
- {
- bfd *member;
-
- member = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
- while (member != NULL)
- {
- if (bfd_check_format (member, bfd_object)
- && (info->hash->creator == member->xvec)
- && (! bfd_has_map (abfd) || (member->flags & DYNAMIC) != 0))
- {
- bfd_boolean needed;
-
- if (! xcoff_link_check_archive_element (member, info,
- &needed))
- return FALSE;
- if (needed)
- member->archive_pass = -1;
- }
- member = bfd_openr_next_archived_file (abfd, member);
- }
- }
-
- return TRUE;
-
- default:
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
-}
-
-/* Add symbols from an XCOFF object file. */
-
-static bfd_boolean
-xcoff_link_add_object_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
-
- if (! _bfd_coff_get_external_symbols (abfd))
- return FALSE;
- if (! xcoff_link_add_symbols (abfd, info))
- return FALSE;
- if (! info->keep_memory)
- {
- if (! _bfd_coff_free_symbols (abfd))
- return FALSE;
- }
- return TRUE;
-}
-
-/* Check a single archive element to see if we need to include it in
- the link. *PNEEDED is set according to whether this element is
- needed in the link or not. This is called via
- _bfd_generic_link_add_archive_symbols. */
-
-static bfd_boolean
-xcoff_link_check_archive_element (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean *pneeded;
-{
-
- if (! _bfd_coff_get_external_symbols (abfd))
- return FALSE;
-
- if (! xcoff_link_check_ar_symbols (abfd, info, pneeded))
- return FALSE;
-
- if (*pneeded)
- {
- if (! xcoff_link_add_symbols (abfd, info))
- return FALSE;
- }
-
- if (! info->keep_memory || ! *pneeded)
- {
- if (! _bfd_coff_free_symbols (abfd))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Look through the symbols to see if this object file should be
- included in the link. */
-
-static bfd_boolean
-xcoff_link_check_ar_symbols (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean *pneeded;
-{
- bfd_size_type symesz;
- bfd_byte *esym;
- bfd_byte *esym_end;
-
- *pneeded = FALSE;
-
- if ((abfd->flags & DYNAMIC) != 0
- && ! info->static_link
- && info->hash->creator == abfd->xvec)
- return xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded);
-
- symesz = bfd_coff_symesz (abfd);
- esym = (bfd_byte *) obj_coff_external_syms (abfd);
- esym_end = esym + obj_raw_syment_count (abfd) * symesz;
- while (esym < esym_end)
- {
- struct internal_syment sym;
-
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
-
- if (sym.n_sclass == C_EXT && sym.n_scnum != N_UNDEF)
- {
- const char *name;
- char buf[SYMNMLEN + 1];
- struct bfd_link_hash_entry *h;
-
- /* This symbol is externally visible, and is defined by this
- object file. */
-
- name = _bfd_coff_internal_syment_name (abfd, &sym, buf);
-
- if (name == NULL)
- return FALSE;
- h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
-
- /* We are only interested in symbols that are currently
- undefined. If a symbol is currently known to be common,
- XCOFF linkers do not bring in an object file which
- defines it. We also don't bring in symbols to satisfy
- undefined references in shared objects. */
- if (h != (struct bfd_link_hash_entry *) NULL
- && h->type == bfd_link_hash_undefined
- && (info->hash->creator != abfd->xvec
- || (((struct xcoff_link_hash_entry *) h)->flags
- & XCOFF_DEF_DYNAMIC) == 0))
- {
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
- }
-
- esym += (sym.n_numaux + 1) * symesz;
- }
-
- /* We do not need this object file. */
- return TRUE;
-}
-
-/* Look through the loader symbols to see if this dynamic object
- should be included in the link. The native linker uses the loader
- symbols, not the normal symbol table, so we do too. */
-
-static bfd_boolean
-xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean *pneeded;
-{
- asection *lsec;
- bfd_byte *contents;
- struct internal_ldhdr ldhdr;
- const char *strings;
- bfd_byte *elsym, *elsymend;
-
- *pneeded = FALSE;
-
- lsec = bfd_get_section_by_name (abfd, ".loader");
- if (lsec == NULL)
- {
- /* There are no symbols, so don't try to include it. */
- return TRUE;
- }
-
- if (! xcoff_get_section_contents (abfd, lsec))
- return FALSE;
- contents = coff_section_data (abfd, lsec)->contents;
-
- bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
-
- strings = (char *) contents + ldhdr.l_stoff;
-
- elsym = contents + bfd_xcoff_loader_symbol_offset(abfd, &ldhdr);
-
- elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd);
- for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd))
- {
- struct internal_ldsym ldsym;
- char nambuf[SYMNMLEN + 1];
- const char *name;
- struct bfd_link_hash_entry *h;
-
- bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
-
- /* We are only interested in exported symbols. */
- if ((ldsym.l_smtype & L_EXPORT) == 0)
- continue;
-
- if (ldsym._l._l_l._l_zeroes == 0)
- name = strings + ldsym._l._l_l._l_offset;
- else
- {
- memcpy (nambuf, ldsym._l._l_name, SYMNMLEN);
- nambuf[SYMNMLEN] = '\0';
- name = nambuf;
- }
-
- h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
-
- /* We are only interested in symbols that are currently
- undefined. At this point we know that we are using an XCOFF
- hash table. */
- if (h != NULL
- && h->type == bfd_link_hash_undefined
- && (((struct xcoff_link_hash_entry *) h)->flags
- & XCOFF_DEF_DYNAMIC) == 0)
- {
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
- }
- }
-
- /* We do not need this shared object. */
-
- if (contents != NULL && ! coff_section_data (abfd, lsec)->keep_contents)
- {
- free (coff_section_data (abfd, lsec)->contents);
- coff_section_data (abfd, lsec)->contents = NULL;
- }
-
- return TRUE;
-}
-
-/* Returns the index of reloc in RELOCS with the least address greater
- than or equal to ADDRESS. The relocs are sorted by address. */
-
-static bfd_size_type
-xcoff_find_reloc (relocs, count, address)
- struct internal_reloc *relocs;
- bfd_size_type count;
- bfd_vma address;
-{
- bfd_size_type min, max, this;
-
- if (count < 2)
- {
- if (count == 1 && relocs[0].r_vaddr < address)
- return 1;
- else
- return 0;
- }
-
- min = 0;
- max = count;
-
- /* Do a binary search over (min,max]. */
- while (min + 1 < max)
- {
- bfd_vma raddr;
-
- this = (max + min) / 2;
- raddr = relocs[this].r_vaddr;
- if (raddr > address)
- max = this;
- else if (raddr < address)
- min = this;
- else
- {
- min = this;
- break;
- }
- }
-
- if (relocs[min].r_vaddr < address)
- return min + 1;
-
- while (min > 0
- && relocs[min - 1].r_vaddr == address)
- --min;
-
- return min;
-}
-
-
-/* xcoff_link_create_extra_sections
-
- Takes care of creating the .loader, .gl, .ds, .debug and sections. */
-
-static bfd_boolean
-xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
-{
-
- bfd_boolean return_value = FALSE;
-
- if (info->hash->creator == abfd->xvec)
- {
-
- /* We need to build a .loader section, so we do it here. This
- won't work if we're producing an XCOFF output file with no
- XCOFF input files. FIXME. */
-
- if (xcoff_hash_table (info)->loader_section == NULL)
- {
- asection *lsec;
-
- lsec = bfd_make_section_anyway (abfd, ".loader");
- if (lsec == NULL)
- {
- goto end_return;
- }
- xcoff_hash_table (info)->loader_section = lsec;
- lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- }
-
- /* Likewise for the linkage section. */
- if (xcoff_hash_table (info)->linkage_section == NULL)
- {
- asection *lsec;
-
- lsec = bfd_make_section_anyway (abfd, ".gl");
- if (lsec == NULL)
- {
- goto end_return;
- }
-
- xcoff_hash_table (info)->linkage_section = lsec;
- lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
- lsec->alignment_power = 2;
- }
-
- /* Likewise for the TOC section. */
- if (xcoff_hash_table (info)->toc_section == NULL)
- {
- asection *tsec;
-
- tsec = bfd_make_section_anyway (abfd, ".tc");
- if (tsec == NULL)
- {
- goto end_return;
- }
-
- xcoff_hash_table (info)->toc_section = tsec;
- tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
- tsec->alignment_power = 2;
- }
-
- /* Likewise for the descriptor section. */
- if (xcoff_hash_table (info)->descriptor_section == NULL)
- {
- asection *dsec;
-
- dsec = bfd_make_section_anyway (abfd, ".ds");
- if (dsec == NULL)
- {
- goto end_return;
- }
-
- xcoff_hash_table (info)->descriptor_section = dsec;
- dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
- dsec->alignment_power = 2;
- }
-
- /* Likewise for the .debug section. */
- if (xcoff_hash_table (info)->debug_section == NULL
- && info->strip != strip_all)
- {
- asection *dsec;
-
- dsec = bfd_make_section_anyway (abfd, ".debug");
- if (dsec == NULL)
- {
- goto end_return;
- }
- xcoff_hash_table (info)->debug_section = dsec;
- dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- }
- }
-
- return_value = TRUE;
-
- end_return:
-
- return return_value;
-}
-
-/* Add all the symbols from an object file to the hash table.
-
- XCOFF is a weird format. A normal XCOFF .o files will have three
- COFF sections--.text, .data, and .bss--but each COFF section will
- contain many csects. These csects are described in the symbol
- table. From the linker's point of view, each csect must be
- considered a section in its own right. For example, a TOC entry is
- handled as a small XMC_TC csect. The linker must be able to merge
- different TOC entries together, which means that it must be able to
- extract the XMC_TC csects from the .data section of the input .o
- file.
-
- From the point of view of our linker, this is, of course, a hideous
- nightmare. We cope by actually creating sections for each csect,
- and discarding the original sections. We then have to handle the
- relocation entries carefully, since the only way to tell which
- csect they belong to is to examine the address. */
-
-static bfd_boolean
-xcoff_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- unsigned int n_tmask;
- unsigned int n_btshft;
- bfd_boolean default_copy;
- bfd_size_type symcount;
- struct xcoff_link_hash_entry **sym_hash;
- asection **csect_cache;
- bfd_size_type linesz;
- asection *o;
- asection *last_real;
- bfd_boolean keep_syms;
- asection *csect;
- unsigned int csect_index;
- asection *first_csect;
- bfd_size_type symesz;
- bfd_byte *esym;
- bfd_byte *esym_end;
- struct reloc_info_struct
- {
- struct internal_reloc *relocs;
- asection **csects;
- bfd_byte *linenos;
- } *reloc_info = NULL;
- bfd_size_type amt;
-
- keep_syms = obj_coff_keep_syms (abfd);
-
- if ((abfd->flags & DYNAMIC) != 0
- && ! info->static_link)
- {
- if (! xcoff_link_add_dynamic_symbols (abfd, info))
- return FALSE;
- }
-
- /* create the loader, toc, gl, ds and debug sections, if needed */
- if (! xcoff_link_create_extra_sections (abfd, info))
- goto error_return;
-
- if ((abfd->flags & DYNAMIC) != 0
- && ! info->static_link)
- return TRUE;
-
- n_tmask = coff_data (abfd)->local_n_tmask;
- n_btshft = coff_data (abfd)->local_n_btshft;
-
- /* Define macros so that ISFCN, et. al., macros work correctly. */
-#define N_TMASK n_tmask
-#define N_BTSHFT n_btshft
-
- if (info->keep_memory)
- default_copy = FALSE;
- else
- default_copy = TRUE;
-
- symcount = obj_raw_syment_count (abfd);
-
- /* We keep a list of the linker hash table entries that correspond
- to each external symbol. */
- amt = symcount * sizeof (struct xcoff_link_hash_entry *);
- sym_hash = (struct xcoff_link_hash_entry **) bfd_zalloc (abfd, amt);
- if (sym_hash == NULL && symcount != 0)
- goto error_return;
- coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash;
-
- /* Because of the weird stuff we are doing with XCOFF csects, we can
- not easily determine which section a symbol is in, so we store
- the information in the tdata for the input file. */
- amt = symcount * sizeof (asection *);
- csect_cache = (asection **) bfd_zalloc (abfd, amt);
- if (csect_cache == NULL && symcount != 0)
- goto error_return;
- xcoff_data (abfd)->csects = csect_cache;
-
- /* While splitting sections into csects, we need to assign the
- relocs correctly. The relocs and the csects must both be in
- order by VMA within a given section, so we handle this by
- scanning along the relocs as we process the csects. We index
- into reloc_info using the section target_index. */
- amt = abfd->section_count + 1;
- amt *= sizeof (struct reloc_info_struct);
- reloc_info = (struct reloc_info_struct *) bfd_zmalloc (amt);
- if (reloc_info == NULL)
- goto error_return;
-
- /* Read in the relocs and line numbers for each section. */
- linesz = bfd_coff_linesz (abfd);
- last_real = NULL;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
-
- last_real = o;
- if ((o->flags & SEC_RELOC) != 0)
- {
-
- reloc_info[o->target_index].relocs =
- xcoff_read_internal_relocs (abfd, o, TRUE, (bfd_byte *) NULL,
- FALSE, (struct internal_reloc *) NULL);
- amt = o->reloc_count;
- amt *= sizeof (asection *);
- reloc_info[o->target_index].csects = (asection **) bfd_zmalloc (amt);
- if (reloc_info[o->target_index].csects == NULL)
- goto error_return;
- }
-
- if ((info->strip == strip_none || info->strip == strip_some)
- && o->lineno_count > 0)
- {
-
- bfd_byte *linenos;
-
- amt = linesz * o->lineno_count;
- linenos = (bfd_byte *) bfd_malloc (amt);
- if (linenos == NULL)
- goto error_return;
- reloc_info[o->target_index].linenos = linenos;
- if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0
- || bfd_bread (linenos, amt, abfd) != amt)
- goto error_return;
-
- }
- }
-
- /* Don't let the linker relocation routines discard the symbols. */
- obj_coff_keep_syms (abfd) = TRUE;
-
- csect = NULL;
- csect_index = 0;
- first_csect = NULL;
-
- symesz = bfd_coff_symesz (abfd);
- BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));
- esym = (bfd_byte *) obj_coff_external_syms (abfd);
- esym_end = esym + symcount * symesz;
-
- while (esym < esym_end)
- {
- struct internal_syment sym;
- union internal_auxent aux;
- const char *name;
- char buf[SYMNMLEN + 1];
- int smtyp;
- flagword flags;
- asection *section;
- bfd_vma value;
- struct xcoff_link_hash_entry *set_toc;
-
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
-
- /* In this pass we are only interested in symbols with csect
- information. */
- if (sym.n_sclass != C_EXT && sym.n_sclass != C_HIDEXT)
- {
-
- /* Set csect_cache,
- Normally csect is a .pr, .rw etc. created in the loop
- If C_FILE or first time, handle special
-
- Advance esym, sym_hash, csect_hash ptr's
- Keep track of the last_symndx for the current file. */
- if (sym.n_sclass == C_FILE && csect != NULL)
- {
- xcoff_section_data (abfd, csect)->last_symndx =
- ((esym
- - (bfd_byte *) obj_coff_external_syms (abfd))
- / symesz);
- csect = NULL;
- }
-
- if (csect != NULL)
- *csect_cache = csect;
- else if (first_csect == NULL || sym.n_sclass == C_FILE)
- *csect_cache = coff_section_from_bfd_index (abfd, sym.n_scnum);
- else
- *csect_cache = NULL;
- esym += (sym.n_numaux + 1) * symesz;
- sym_hash += sym.n_numaux + 1;
- csect_cache += sym.n_numaux + 1;
-
- continue;
- }
-
- name = _bfd_coff_internal_syment_name (abfd, &sym, buf);
-
- if (name == NULL)
- goto error_return;
-
- /* If this symbol has line number information attached to it,
- and we're not stripping it, count the number of entries and
- add them to the count for this csect. In the final link pass
- we are going to attach line number information by symbol,
- rather than by section, in order to more easily handle
- garbage collection. */
- if ((info->strip == strip_none || info->strip == strip_some)
- && sym.n_numaux > 1
- && csect != NULL
- && ISFCN (sym.n_type))
- {
-
- union internal_auxent auxlin;
-
- bfd_coff_swap_aux_in (abfd, (PTR) (esym + symesz),
- sym.n_type, sym.n_sclass,
- 0, sym.n_numaux, (PTR) &auxlin);
-
- if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0)
- {
- asection *enclosing;
- bfd_signed_vma linoff;
-
- enclosing = xcoff_section_data (abfd, csect)->enclosing;
- if (enclosing == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: `%s' has line numbers but no enclosing section"),
- bfd_archive_filename (abfd), name);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr
- - enclosing->line_filepos);
- /* explicit cast to bfd_signed_vma for compiler */
- if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz))
- {
- struct internal_lineno lin;
- bfd_byte *linpstart;
-
- linpstart = (reloc_info[enclosing->target_index].linenos
- + linoff);
- bfd_coff_swap_lineno_in (abfd, (PTR) linpstart, (PTR) &lin);
- if (lin.l_lnno == 0
- && ((bfd_size_type) lin.l_addr.l_symndx
- == ((esym
- - (bfd_byte *) obj_coff_external_syms (abfd))
- / symesz)))
- {
- bfd_byte *linpend, *linp;
-
- linpend = (reloc_info[enclosing->target_index].linenos
- + enclosing->lineno_count * linesz);
- for (linp = linpstart + linesz;
- linp < linpend;
- linp += linesz)
- {
- bfd_coff_swap_lineno_in (abfd, (PTR) linp,
- (PTR) &lin);
- if (lin.l_lnno == 0)
- break;
- }
- csect->lineno_count += (linp - linpstart) / linesz;
- /* The setting of line_filepos will only be
- useful if all the line number entries for a
- csect are contiguous; this only matters for
- error reporting. */
- if (csect->line_filepos == 0)
- csect->line_filepos =
- auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr;
- }
- }
- }
- }
-
- /* Pick up the csect auxiliary information. */
-
- if (sym.n_numaux == 0)
- {
- (*_bfd_error_handler)
- (_("%s: class %d symbol `%s' has no aux entries"),
- bfd_archive_filename (abfd), sym.n_sclass, name);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- bfd_coff_swap_aux_in (abfd,
- (PTR) (esym + symesz * sym.n_numaux),
- sym.n_type, sym.n_sclass,
- sym.n_numaux - 1, sym.n_numaux,
- (PTR) &aux);
-
- smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp);
-
- flags = BSF_GLOBAL;
- section = NULL;
- value = 0;
- set_toc = NULL;
-
- switch (smtyp)
- {
- default:
- (*_bfd_error_handler)
- (_("%s: symbol `%s' has unrecognized csect type %d"),
- bfd_archive_filename (abfd), name, smtyp);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
-
- case XTY_ER:
- /* This is an external reference. */
- if (sym.n_sclass == C_HIDEXT
- || sym.n_scnum != N_UNDEF
- || aux.x_csect.x_scnlen.l != 0)
- {
- (*_bfd_error_handler)
- (_("%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"),
- bfd_archive_filename (abfd), name, sym.n_sclass, sym.n_scnum,
- aux.x_csect.x_scnlen.l);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- /* An XMC_XO external reference is actually a reference to
- an absolute location. */
- if (aux.x_csect.x_smclas != XMC_XO)
- section = bfd_und_section_ptr;
- else
- {
- section = bfd_abs_section_ptr;
- value = sym.n_value;
- }
- break;
-
- case XTY_SD:
- /* This is a csect definition. */
- if (csect != NULL)
- {
- xcoff_section_data (abfd, csect)->last_symndx =
- ((esym - (bfd_byte *) obj_coff_external_syms (abfd)) / symesz);
- }
-
- csect = NULL;
- csect_index = -(unsigned) 1;
-
- /* When we see a TOC anchor, we record the TOC value. */
- if (aux.x_csect.x_smclas == XMC_TC0)
- {
- if (sym.n_sclass != C_HIDEXT
- || aux.x_csect.x_scnlen.l != 0)
- {
- (*_bfd_error_handler)
- (_("%s: XMC_TC0 symbol `%s' is class %d scnlen %d"),
- bfd_archive_filename (abfd), name, sym.n_sclass,
- aux.x_csect.x_scnlen.l);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- xcoff_data (abfd)->toc = sym.n_value;
- }
-
- /* We must merge TOC entries for the same symbol. We can
- merge two TOC entries if they are both C_HIDEXT, they
- both have the same name, they are both 4 or 8 bytes long, and
- they both have a relocation table entry for an external
- symbol with the same name. Unfortunately, this means
- that we must look through the relocations. Ick.
-
- Logic for 32 bit vs 64 bit.
- 32 bit has a csect length of 4 for TOC
- 64 bit has a csect length of 8 for TOC
-
- The conditions to get past the if-check are not that bad.
- They are what is used to create the TOC csects in the first
- place. */
- if (aux.x_csect.x_smclas == XMC_TC
- && sym.n_sclass == C_HIDEXT
- && info->hash->creator == abfd->xvec
- && ((bfd_xcoff_is_xcoff32 (abfd)
- && aux.x_csect.x_scnlen.l == 4)
- || (bfd_xcoff_is_xcoff64 (abfd)
- && aux.x_csect.x_scnlen.l == 8)))
- {
- asection *enclosing;
- struct internal_reloc *relocs;
- bfd_size_type relindx;
- struct internal_reloc *rel;
-
- enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum);
- if (enclosing == NULL)
- goto error_return;
-
- relocs = reloc_info[enclosing->target_index].relocs;
- amt = enclosing->reloc_count;
- relindx = xcoff_find_reloc (relocs, amt, sym.n_value);
- rel = relocs + relindx;
-
- /* 32 bit R_POS r_size is 31
- 64 bit R_POS r_size is 63 */
- if (relindx < enclosing->reloc_count
- && rel->r_vaddr == (bfd_vma) sym.n_value
- && rel->r_type == R_POS
- && ((bfd_xcoff_is_xcoff32 (abfd)
- && rel->r_size == 31)
- || (bfd_xcoff_is_xcoff64 (abfd)
- && rel->r_size == 63)))
- {
- bfd_byte *erelsym;
-
- struct internal_syment relsym;
-
- erelsym = ((bfd_byte *) obj_coff_external_syms (abfd)
- + rel->r_symndx * symesz);
- bfd_coff_swap_sym_in (abfd, (PTR) erelsym, (PTR) &relsym);
- if (relsym.n_sclass == C_EXT)
- {
- const char *relname;
- char relbuf[SYMNMLEN + 1];
- bfd_boolean copy;
- struct xcoff_link_hash_entry *h;
-
- /* At this point we know that the TOC entry is
- for an externally visible symbol. */
-
- relname = _bfd_coff_internal_syment_name (abfd, &relsym,
- relbuf);
- if (relname == NULL)
- goto error_return;
-
- /* We only merge TOC entries if the TC name is
- the same as the symbol name. This handles
- the normal case, but not common cases like
- SYM.P4 which gcc generates to store SYM + 4
- in the TOC. FIXME. */
-
- if (strcmp (name, relname) == 0)
- {
- copy = (! info->keep_memory
- || relsym._n._n_n._n_zeroes != 0
- || relsym._n._n_n._n_offset == 0);
- h = xcoff_link_hash_lookup (xcoff_hash_table (info),
- relname, TRUE, copy,
- FALSE);
- if (h == NULL)
- goto error_return;
-
- /* At this point h->root.type could be
- bfd_link_hash_new. That should be OK,
- since we know for sure that we will come
- across this symbol as we step through the
- file. */
-
- /* We store h in *sym_hash for the
- convenience of the relocate_section
- function. */
- *sym_hash = h;
-
- if (h->toc_section != NULL)
- {
- asection **rel_csects;
-
- /* We already have a TOC entry for this
- symbol, so we can just ignore this
- one. */
- rel_csects =
- reloc_info[enclosing->target_index].csects;
- rel_csects[relindx] = bfd_und_section_ptr;
- break;
- }
-
- /* We are about to create a TOC entry for
- this symbol. */
- set_toc = h;
- } /* merge toc reloc */
- } /* c_ext */
- } /* reloc */
- } /* merge toc */
-
- {
-
- asection *enclosing;
-
- /* We need to create a new section. We get the name from
- the csect storage mapping class, so that the linker can
- accumulate similar csects together. */
-
- csect = bfd_xcoff_create_csect_from_smclas(abfd, &aux, name);
- if (NULL == csect)
- {
- goto error_return;
- }
-
- /* The enclosing section is the main section : .data, .text
- or .bss that the csect is coming from. */
- enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum);
- if (enclosing == NULL)
- goto error_return;
-
- if (! bfd_is_abs_section (enclosing)
- && ((bfd_vma) sym.n_value < enclosing->vma
- || ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l
- > enclosing->vma + enclosing->_raw_size)))
- {
- (*_bfd_error_handler)
- (_("%s: csect `%s' not in enclosing section"),
- bfd_archive_filename (abfd), name);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- csect->vma = sym.n_value;
- csect->filepos = (enclosing->filepos
- + sym.n_value
- - enclosing->vma);
- csect->_raw_size = aux.x_csect.x_scnlen.l;
- csect->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
- csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp);
-
- /* Record the enclosing section in the tdata for this new
- section. */
- amt = sizeof (struct coff_section_tdata);
- csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
- if (csect->used_by_bfd == NULL)
- goto error_return;
- amt = sizeof (struct xcoff_section_tdata);
- coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt);
- if (coff_section_data (abfd, csect)->tdata == NULL)
- goto error_return;
- xcoff_section_data (abfd, csect)->enclosing = enclosing;
- xcoff_section_data (abfd, csect)->lineno_count =
- enclosing->lineno_count;
-
- if (enclosing->owner == abfd)
- {
- struct internal_reloc *relocs;
- bfd_size_type relindx;
- struct internal_reloc *rel;
- asection **rel_csect;
-
- relocs = reloc_info[enclosing->target_index].relocs;
- amt = enclosing->reloc_count;
- relindx = xcoff_find_reloc (relocs, amt, csect->vma);
-
- rel = relocs + relindx;
- rel_csect = (reloc_info[enclosing->target_index].csects
- + relindx);
-
- csect->rel_filepos = (enclosing->rel_filepos
- + relindx * bfd_coff_relsz (abfd));
- while (relindx < enclosing->reloc_count
- && *rel_csect == NULL
- && rel->r_vaddr < csect->vma + csect->_raw_size)
- {
-
- *rel_csect = csect;
- csect->flags |= SEC_RELOC;
- ++csect->reloc_count;
- ++relindx;
- ++rel;
- ++rel_csect;
- }
- }
-
- /* There are a number of other fields and section flags
- which we do not bother to set. */
-
- csect_index = ((esym
- - (bfd_byte *) obj_coff_external_syms (abfd))
- / symesz);
-
- xcoff_section_data (abfd, csect)->first_symndx = csect_index;
-
- if (first_csect == NULL)
- first_csect = csect;
-
- /* If this symbol is C_EXT, we treat it as starting at the
- beginning of the newly created section. */
- if (sym.n_sclass == C_EXT)
- {
- section = csect;
- value = 0;
- }
-
- /* If this is a TOC section for a symbol, record it. */
- if (set_toc != NULL)
- set_toc->toc_section = csect;
- }
- break;
-
- case XTY_LD:
- /* This is a label definition. The x_scnlen field is the
- symbol index of the csect. Usually the XTY_LD symbol will
- follow its appropriate XTY_SD symbol. The .set pseudo op can
- cause the XTY_LD to not follow the XTY_SD symbol. */
- {
- bfd_boolean bad;
-
- bad = FALSE;
- if (aux.x_csect.x_scnlen.l < 0
- || (aux.x_csect.x_scnlen.l
- >= esym - (bfd_byte *) obj_coff_external_syms (abfd)))
- bad = TRUE;
- if (! bad)
- {
- section = xcoff_data (abfd)->csects[aux.x_csect.x_scnlen.l];
- if (section == NULL
- || (section->flags & SEC_HAS_CONTENTS) == 0)
- bad = TRUE;
- }
- if (bad)
- {
- (*_bfd_error_handler)
- (_("%s: misplaced XTY_LD `%s'"),
- bfd_archive_filename (abfd), name);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- csect = section;
- value = sym.n_value - csect->vma;
- }
- break;
-
- case XTY_CM:
- /* This is an unitialized csect. We could base the name on
- the storage mapping class, but we don't bother except for
- an XMC_TD symbol. If this csect is externally visible,
- it is a common symbol. We put XMC_TD symbols in sections
- named .tocbss, and rely on the linker script to put that
- in the TOC area. */
-
- if (csect != NULL)
- {
- xcoff_section_data (abfd, csect)->last_symndx =
- ((esym
- - (bfd_byte *) obj_coff_external_syms (abfd))
- / symesz);
- }
-
- if (aux.x_csect.x_smclas == XMC_TD)
- {
- /* The linker script puts the .td section in the data
- section after the .tc section. */
- csect = bfd_make_section_anyway (abfd, ".td");
-
- }
- else
- {
- csect = bfd_make_section_anyway (abfd, ".bss");
- }
- if (csect == NULL)
- goto error_return;
- csect->vma = sym.n_value;
- csect->_raw_size = aux.x_csect.x_scnlen.l;
- csect->flags |= SEC_ALLOC;
- csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp);
- /* There are a number of other fields and section flags
- which we do not bother to set. */
-
- csect_index = ((esym
- - (bfd_byte *) obj_coff_external_syms (abfd))
- / symesz);
-
- amt = sizeof (struct coff_section_tdata);
- csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
- if (csect->used_by_bfd == NULL)
- goto error_return;
- amt = sizeof (struct xcoff_section_tdata);
- coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt);
- if (coff_section_data (abfd, csect)->tdata == NULL)
- goto error_return;
- xcoff_section_data (abfd, csect)->first_symndx = csect_index;
-
- if (first_csect == NULL)
- first_csect = csect;
-
- if (sym.n_sclass == C_EXT)
- {
- csect->flags |= SEC_IS_COMMON;
- csect->_raw_size = 0;
- section = csect;
- value = aux.x_csect.x_scnlen.l;
- }
-
- break;
- }
-
- /* Check for magic symbol names. */
- if ((smtyp == XTY_SD || smtyp == XTY_CM)
- && aux.x_csect.x_smclas != XMC_TC
- && aux.x_csect.x_smclas != XMC_TD)
- {
-
- int i = -1;
-
- if (name[0] == '_')
- {
- if (strcmp (name, "_text") == 0)
- i = XCOFF_SPECIAL_SECTION_TEXT;
- else if (strcmp (name, "_etext") == 0)
- i = XCOFF_SPECIAL_SECTION_ETEXT;
- else if (strcmp (name, "_data") == 0)
- i = XCOFF_SPECIAL_SECTION_DATA;
- else if (strcmp (name, "_edata") == 0)
- i = XCOFF_SPECIAL_SECTION_EDATA;
- else if (strcmp (name, "_end") == 0)
- i = XCOFF_SPECIAL_SECTION_END;
- }
- else if (name[0] == 'e' && strcmp (name, "end") == 0)
- {
- i = XCOFF_SPECIAL_SECTION_END2;
- }
-
- if (i != -1)
- {
- xcoff_hash_table (info)->special_sections[i] = csect;
- }
- }
-
- /* Now we have enough information to add the symbol to the
- linker hash table. */
-
- if (sym.n_sclass == C_EXT)
- {
- bfd_boolean copy;
-
- BFD_ASSERT (section != NULL);
-
- /* We must copy the name into memory if we got it from the
- syment itself, rather than the string table. */
- copy = default_copy;
- if (sym._n._n_n._n_zeroes != 0
- || sym._n._n_n._n_offset == 0)
- copy = TRUE;
-
- /* The AIX linker appears to only detect multiple symbol
- definitions when there is a reference to the symbol. If
- a symbol is defined multiple times, and the only
- references are from the same object file, the AIX linker
- appears to permit it. It does not merge the different
- definitions, but handles them independently. On the
- other hand, if there is a reference, the linker reports
- an error.
-
- This matters because the AIX <net/net_globals.h> header
- file actually defines an initialized array, so we have to
- actually permit that to work.
-
- Just to make matters even more confusing, the AIX linker
- appears to permit multiple symbol definitions whenever
- the second definition is in an archive rather than an
- object file. This may be a consequence of the manner in
- which it handles archives: I think it may load the entire
- archive in as separate csects, and then let garbage
- collection discard symbols.
-
- We also have to handle the case of statically linking a
- shared object, which will cause symbol redefinitions,
- although this is an easier case to detect. */
-
- if (info->hash->creator == abfd->xvec)
- {
- if (! bfd_is_und_section (section))
- {
- *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info),
- name, TRUE, copy, FALSE);
- }
- else
- {
- /* Make a copy of the symbol name to prevent problems with
- merging symbols. */
- *sym_hash = ((struct xcoff_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info, name,
- TRUE, TRUE,
- FALSE));
- }
- if (*sym_hash == NULL)
- goto error_return;
- if (((*sym_hash)->root.type == bfd_link_hash_defined
- || (*sym_hash)->root.type == bfd_link_hash_defweak)
- && ! bfd_is_und_section (section)
- && ! bfd_is_com_section (section))
- {
- /* This is a second definition of a defined symbol. */
- if ((abfd->flags & DYNAMIC) != 0
- && ((*sym_hash)->smclas != XMC_GL
- || aux.x_csect.x_smclas == XMC_GL
- || ((*sym_hash)->root.u.def.section->owner->flags
- & DYNAMIC) == 0))
- {
- /* The new symbol is from a shared library, and
- either the existing symbol is not global
- linkage code or this symbol is global linkage
- code. If the existing symbol is global
- linkage code and the new symbol is not, then
- we want to use the new symbol. */
- section = bfd_und_section_ptr;
- value = 0;
- }
- else if (((*sym_hash)->root.u.def.section->owner->flags
- & DYNAMIC) != 0)
- {
- /* The existing symbol is from a shared library.
- Replace it. */
- (*sym_hash)->root.type = bfd_link_hash_undefined;
- (*sym_hash)->root.u.undef.abfd =
- (*sym_hash)->root.u.def.section->owner;
- }
- else if (abfd->my_archive != NULL)
- {
- /* This is a redefinition in an object contained
- in an archive. Just ignore it. See the
- comment above. */
- section = bfd_und_section_ptr;
- value = 0;
- }
- else if ((*sym_hash)->root.und_next != NULL
- || info->hash->undefs_tail == &(*sym_hash)->root)
- {
- /* This symbol has been referenced. In this
- case, we just continue and permit the
- multiple definition error. See the comment
- above about the behaviour of the AIX linker. */
- }
- else if ((*sym_hash)->smclas == aux.x_csect.x_smclas)
- {
- /* The symbols are both csects of the same
- class. There is at least a chance that this
- is a semi-legitimate redefinition. */
- section = bfd_und_section_ptr;
- value = 0;
- (*sym_hash)->flags |= XCOFF_MULTIPLY_DEFINED;
- }
- }
- else if (((*sym_hash)->flags & XCOFF_MULTIPLY_DEFINED) != 0
- && ((*sym_hash)->root.type == bfd_link_hash_defined
- || (*sym_hash)->root.type == bfd_link_hash_defweak)
- && (bfd_is_und_section (section)
- || bfd_is_com_section (section)))
- {
- /* This is a reference to a multiply defined symbol.
- Report the error now. See the comment above
- about the behaviour of the AIX linker. We could
- also do this with warning symbols, but I'm not
- sure the XCOFF linker is wholly prepared to
- handle them, and that would only be a warning,
- not an error. */
- if (! ((*info->callbacks->multiple_definition)
- (info, (*sym_hash)->root.root.string,
- (bfd *) NULL, (asection *) NULL, (bfd_vma) 0,
- (*sym_hash)->root.u.def.section->owner,
- (*sym_hash)->root.u.def.section,
- (*sym_hash)->root.u.def.value)))
- goto error_return;
- /* Try not to give this error too many times. */
- (*sym_hash)->flags &= ~XCOFF_MULTIPLY_DEFINED;
- }
- }
-
- /* _bfd_generic_link_add_one_symbol may call the linker to
- generate an error message, and the linker may try to read
- the symbol table to give a good error. Right now, the
- line numbers are in an inconsistent state, since they are
- counted both in the real sections and in the new csects.
- We need to leave the count in the real sections so that
- the linker can report the line number of the error
- correctly, so temporarily clobber the link to the csects
- so that the linker will not try to read the line numbers
- a second time from the csects. */
- BFD_ASSERT (last_real->next == first_csect);
- last_real->next = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, flags, section, value,
- (const char *) NULL, copy, TRUE,
- (struct bfd_link_hash_entry **) sym_hash)))
- goto error_return;
- last_real->next = first_csect;
-
- if (smtyp == XTY_CM)
- {
- if ((*sym_hash)->root.type != bfd_link_hash_common
- || (*sym_hash)->root.u.c.p->section != csect)
- {
- /* We don't need the common csect we just created. */
- csect->_raw_size = 0;
- }
- else
- {
- (*sym_hash)->root.u.c.p->alignment_power
- = csect->alignment_power;
- }
- }
-
- if (info->hash->creator == abfd->xvec)
- {
- int flag;
-
- if (smtyp == XTY_ER || smtyp == XTY_CM)
- flag = XCOFF_REF_REGULAR;
- else
- flag = XCOFF_DEF_REGULAR;
- (*sym_hash)->flags |= flag;
-
- if ((*sym_hash)->smclas == XMC_UA
- || flag == XCOFF_DEF_REGULAR)
- (*sym_hash)->smclas = aux.x_csect.x_smclas;
- }
- }
-
- *csect_cache = csect;
-
- esym += (sym.n_numaux + 1) * symesz;
- sym_hash += sym.n_numaux + 1;
- csect_cache += sym.n_numaux + 1;
- }
-
- BFD_ASSERT (last_real == NULL || last_real->next == first_csect);
-
- /* Make sure that we have seen all the relocs. */
- for (o = abfd->sections; o != first_csect; o = o->next)
- {
- /* Reset the section size and the line number count, since the
- data is now attached to the csects. Don't reset the size of
- the .debug section, since we need to read it below in
- bfd_xcoff_size_dynamic_sections. */
- if (strcmp (bfd_get_section_name (abfd, o), ".debug") != 0)
- o->_raw_size = 0;
- o->lineno_count = 0;
-
- if ((o->flags & SEC_RELOC) != 0)
- {
- bfd_size_type i;
- struct internal_reloc *rel;
- asection **rel_csect;
-
- rel = reloc_info[o->target_index].relocs;
- rel_csect = reloc_info[o->target_index].csects;
-
- for (i = 0; i < o->reloc_count; i++, rel++, rel_csect++)
- {
-
- if (*rel_csect == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: reloc %s:%d not in csect"),
- bfd_archive_filename (abfd), o->name, i);
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
-
- /* We identify all symbols which are called, so that we
- can create glue code for calls to functions imported
- from dynamic objects. */
- if (info->hash->creator == abfd->xvec
- && *rel_csect != bfd_und_section_ptr
- && (rel->r_type == R_BR
- || rel->r_type == R_RBR)
- && obj_xcoff_sym_hashes (abfd)[rel->r_symndx] != NULL)
- {
- struct xcoff_link_hash_entry *h;
-
- h = obj_xcoff_sym_hashes (abfd)[rel->r_symndx];
- h->flags |= XCOFF_CALLED;
- /* If the symbol name starts with a period, it is
- the code of a function. If the symbol is
- currently undefined, then add an undefined symbol
- for the function descriptor. This should do no
- harm, because any regular object that defines the
- function should also define the function
- descriptor. It helps, because it means that we
- will identify the function descriptor with a
- dynamic object if a dynamic object defines it. */
- if (h->root.root.string[0] == '.'
- && h->descriptor == NULL)
- {
- struct xcoff_link_hash_entry *hds;
- struct bfd_link_hash_entry *bh;
-
- hds = xcoff_link_hash_lookup (xcoff_hash_table (info),
- h->root.root.string + 1,
- TRUE, FALSE, TRUE);
- if (hds == NULL)
- goto error_return;
- if (hds->root.type == bfd_link_hash_new)
- {
- bh = &hds->root;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, hds->root.root.string,
- (flagword) 0, bfd_und_section_ptr,
- (bfd_vma) 0, (const char *) NULL, FALSE,
- TRUE, &bh)))
- goto error_return;
- hds = (struct xcoff_link_hash_entry *) bh;
- }
- hds->flags |= XCOFF_DESCRIPTOR;
- BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0
- && (h->flags & XCOFF_DESCRIPTOR) == 0);
- hds->descriptor = h;
- h->descriptor = hds;
- }
- }
- }
-
- free (reloc_info[o->target_index].csects);
- reloc_info[o->target_index].csects = NULL;
-
- /* Reset SEC_RELOC and the reloc_count, since the reloc
- information is now attached to the csects. */
- o->flags &=~ SEC_RELOC;
- o->reloc_count = 0;
-
- /* If we are not keeping memory, free the reloc information. */
- if (! info->keep_memory
- && coff_section_data (abfd, o) != NULL
- && coff_section_data (abfd, o)->relocs != NULL
- && ! coff_section_data (abfd, o)->keep_relocs)
- {
- free (coff_section_data (abfd, o)->relocs);
- coff_section_data (abfd, o)->relocs = NULL;
- }
- }
-
- /* Free up the line numbers. FIXME: We could cache these
- somewhere for the final link, to avoid reading them again. */
- if (reloc_info[o->target_index].linenos != NULL)
- {
- free (reloc_info[o->target_index].linenos);
- reloc_info[o->target_index].linenos = NULL;
- }
- }
-
- free (reloc_info);
-
- obj_coff_keep_syms (abfd) = keep_syms;
-
- return TRUE;
-
- error_return:
- if (reloc_info != NULL)
- {
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (reloc_info[o->target_index].csects != NULL)
- free (reloc_info[o->target_index].csects);
- if (reloc_info[o->target_index].linenos != NULL)
- free (reloc_info[o->target_index].linenos);
- }
- free (reloc_info);
- }
- obj_coff_keep_syms (abfd) = keep_syms;
- return FALSE;
-}
-
-#undef N_TMASK
-#undef N_BTSHFT
-
-/* This function is used to add symbols from a dynamic object to the
- global symbol table. */
-
-static bfd_boolean
-xcoff_link_add_dynamic_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- asection *lsec;
- bfd_byte *contents;
- struct internal_ldhdr ldhdr;
- const char *strings;
- bfd_byte *elsym, *elsymend;
- struct xcoff_import_file *n;
- const char *bname;
- const char *mname;
- const char *s;
- unsigned int c;
- struct xcoff_import_file **pp;
-
- /* We can only handle a dynamic object if we are generating an XCOFF
- output file. */
- if (info->hash->creator != abfd->xvec)
- {
- (*_bfd_error_handler)
- (_("%s: XCOFF shared object when not producing XCOFF output"),
- bfd_get_filename (abfd));
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
-
- /* The symbols we use from a dynamic object are not the symbols in
- the normal symbol table, but, rather, the symbols in the export
- table. If there is a global symbol in a dynamic object which is
- not in the export table, the loader will not be able to find it,
- so we don't want to find it either. Also, on AIX 4.1.3, shr.o in
- libc.a has symbols in the export table which are not in the
- symbol table. */
-
- /* Read in the .loader section. FIXME: We should really use the
- o_snloader field in the a.out header, rather than grabbing the
- section by name. */
- lsec = bfd_get_section_by_name (abfd, ".loader");
- if (lsec == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: dynamic object with no .loader section"),
- bfd_get_filename (abfd));
- bfd_set_error (bfd_error_no_symbols);
- return FALSE;
- }
-
-
- if (! xcoff_get_section_contents (abfd, lsec))
- return FALSE;
- contents = coff_section_data (abfd, lsec)->contents;
-
- /* Remove the sections from this object, so that they do not get
- included in the link. */
- bfd_section_list_clear (abfd);
-
- bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
-
- strings = (char *) contents + ldhdr.l_stoff;
-
- elsym = contents + bfd_xcoff_loader_symbol_offset(abfd, &ldhdr);
-
- elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd);
-
- for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd))
- {
- struct internal_ldsym ldsym;
- char nambuf[SYMNMLEN + 1];
- const char *name;
- struct xcoff_link_hash_entry *h;
-
- bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
-
- /* We are only interested in exported symbols. */
- if ((ldsym.l_smtype & L_EXPORT) == 0)
- continue;
-
- if (ldsym._l._l_l._l_zeroes == 0)
- name = strings + ldsym._l._l_l._l_offset;
- else
- {
- memcpy (nambuf, ldsym._l._l_name, SYMNMLEN);
- nambuf[SYMNMLEN] = '\0';
- name = nambuf;
- }
-
- /* Normally we could not call xcoff_link_hash_lookup in an add
- symbols routine, since we might not be using an XCOFF hash
- table. However, we verified above that we are using an XCOFF
- hash table. */
-
- h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, TRUE,
- TRUE, TRUE);
- if (h == NULL)
- return FALSE;
-
- h->flags |= XCOFF_DEF_DYNAMIC;
-
- /* If the symbol is undefined, and the BFD it was found in is
- not a dynamic object, change the BFD to this dynamic object,
- so that we can get the correct import file ID. */
- if ((h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- && (h->root.u.undef.abfd == NULL
- || (h->root.u.undef.abfd->flags & DYNAMIC) == 0))
- h->root.u.undef.abfd = abfd;
-
- if (h->root.type == bfd_link_hash_new)
- {
- h->root.type = bfd_link_hash_undefined;
- h->root.u.undef.abfd = abfd;
- /* We do not want to add this to the undefined symbol list. */
- }
-
- if (h->smclas == XMC_UA
- || h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- h->smclas = ldsym.l_smclas;
-
- /* Unless this is an XMC_XO symbol, we don't bother to actually
- define it, since we don't have a section to put it in anyhow.
- Instead, the relocation routines handle the DEF_DYNAMIC flag
- correctly. */
-
- if (h->smclas == XMC_XO
- && (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak))
- {
- /* This symbol has an absolute value. */
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = bfd_abs_section_ptr;
- h->root.u.def.value = ldsym.l_value;
- }
-
- /* If this symbol defines a function descriptor, then it
- implicitly defines the function code as well. */
- if (h->smclas == XMC_DS
- || (h->smclas == XMC_XO && name[0] != '.'))
- h->flags |= XCOFF_DESCRIPTOR;
- if ((h->flags & XCOFF_DESCRIPTOR) != 0)
- {
- struct xcoff_link_hash_entry *hds;
-
- hds = h->descriptor;
- if (hds == NULL)
- {
- char *dsnm;
-
- dsnm = bfd_malloc ((bfd_size_type) strlen (name) + 2);
- if (dsnm == NULL)
- return FALSE;
- dsnm[0] = '.';
- strcpy (dsnm + 1, name);
- hds = xcoff_link_hash_lookup (xcoff_hash_table (info), dsnm,
- TRUE, TRUE, TRUE);
- free (dsnm);
- if (hds == NULL)
- return FALSE;
-
- if (hds->root.type == bfd_link_hash_new)
- {
- hds->root.type = bfd_link_hash_undefined;
- hds->root.u.undef.abfd = abfd;
- /* We do not want to add this to the undefined
- symbol list. */
- }
-
- hds->descriptor = h;
- h->descriptor = hds;
- }
-
- hds->flags |= XCOFF_DEF_DYNAMIC;
- if (hds->smclas == XMC_UA)
- hds->smclas = XMC_PR;
-
- /* An absolute symbol appears to actually define code, not a
- function descriptor. This is how some math functions are
- implemented on AIX 4.1. */
- if (h->smclas == XMC_XO
- && (hds->root.type == bfd_link_hash_undefined
- || hds->root.type == bfd_link_hash_undefweak))
- {
- hds->smclas = XMC_XO;
- hds->root.type = bfd_link_hash_defined;
- hds->root.u.def.section = bfd_abs_section_ptr;
- hds->root.u.def.value = ldsym.l_value;
- }
- }
- }
-
- if (contents != NULL && ! coff_section_data (abfd, lsec)->keep_contents)
- {
- free (coff_section_data (abfd, lsec)->contents);
- coff_section_data (abfd, lsec)->contents = NULL;
- }
-
- /* Record this file in the import files. */
-
- n = ((struct xcoff_import_file *)
- bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file)));
- if (n == NULL)
- return FALSE;
- n->next = NULL;
-
- /* For some reason, the path entry in the import file list for a
- shared object appears to always be empty. The file name is the
- base name. */
- n->path = "";
- if (abfd->my_archive == NULL)
- {
- bname = bfd_get_filename (abfd);
- mname = "";
- }
- else
- {
- bname = bfd_get_filename (abfd->my_archive);
- mname = bfd_get_filename (abfd);
- }
- s = strrchr (bname, '/');
- if (s != NULL)
- bname = s + 1;
- n->file = bname;
- n->member = mname;
-
- /* We start c at 1 because the first import file number is reserved
- for LIBPATH. */
- for (pp = &xcoff_hash_table (info)->imports, c = 1;
- *pp != NULL;
- pp = &(*pp)->next, ++c)
- ;
- *pp = n;
-
- xcoff_data (abfd)->import_file_id = c;
-
- return TRUE;
-}
-
-/* Routines that are called after all the input files have been
- handled, but before the sections are laid out in memory. */
-
-/* Mark a symbol as not being garbage, including the section in which
- it is defined. */
-
-static INLINE bfd_boolean
-xcoff_mark_symbol (info, h)
- struct bfd_link_info *info;
- struct xcoff_link_hash_entry *h;
-{
-
- if ((h->flags & XCOFF_MARK) != 0)
- return TRUE;
-
- h->flags |= XCOFF_MARK;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *hsec;
-
- hsec = h->root.u.def.section;
- if (! bfd_is_abs_section (hsec)
- && (hsec->flags & SEC_MARK) == 0)
- {
- if (! xcoff_mark (info, hsec))
- return FALSE;
- }
- }
-
- if (h->toc_section != NULL
- && (h->toc_section->flags & SEC_MARK) == 0)
- {
- if (! xcoff_mark (info, h->toc_section))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* The mark phase of garbage collection. For a given section, mark
- it, and all the sections which define symbols to which it refers.
- Because this function needs to look at the relocs, we also count
- the number of relocs which need to be copied into the .loader
- section. */
-
-static bfd_boolean
-xcoff_mark (info, sec)
- struct bfd_link_info *info;
- asection *sec;
-{
- if (bfd_is_abs_section (sec)
- || (sec->flags & SEC_MARK) != 0)
- return TRUE;
-
- sec->flags |= SEC_MARK;
-
- if (sec->owner->xvec == info->hash->creator
- && coff_section_data (sec->owner, sec) != NULL
- && xcoff_section_data (sec->owner, sec) != NULL)
- {
- register struct xcoff_link_hash_entry **hp, **hpend;
- struct internal_reloc *rel, *relend;
-
- /* Mark all the symbols in this section. */
-
- hp = (obj_xcoff_sym_hashes (sec->owner)
- + xcoff_section_data (sec->owner, sec)->first_symndx);
- hpend = (obj_xcoff_sym_hashes (sec->owner)
- + xcoff_section_data (sec->owner, sec)->last_symndx);
- for (; hp < hpend; hp++)
- {
- register struct xcoff_link_hash_entry *h;
-
- h = *hp;
- if (h != NULL
- && (h->flags & XCOFF_MARK) == 0)
- {
- if (! xcoff_mark_symbol (info, h))
- return FALSE;
- }
- }
-
- /* Look through the section relocs. */
-
- if ((sec->flags & SEC_RELOC) != 0
- && sec->reloc_count > 0)
- {
- rel = xcoff_read_internal_relocs (sec->owner, sec, TRUE,
- (bfd_byte *) NULL, FALSE,
- (struct internal_reloc *) NULL);
- if (rel == NULL)
- return FALSE;
- relend = rel + sec->reloc_count;
- for (; rel < relend; rel++)
- {
- asection *rsec;
- struct xcoff_link_hash_entry *h;
-
- if ((unsigned int) rel->r_symndx
- > obj_raw_syment_count (sec->owner))
- continue;
-
- h = obj_xcoff_sym_hashes (sec->owner)[rel->r_symndx];
- if (h != NULL
- && (h->flags & XCOFF_MARK) == 0)
- {
- if (! xcoff_mark_symbol (info, h))
- return FALSE;
- }
-
- rsec = xcoff_data (sec->owner)->csects[rel->r_symndx];
- if (rsec != NULL
- && (rsec->flags & SEC_MARK) == 0)
- {
- if (! xcoff_mark (info, rsec))
- return FALSE;
- }
-
- /* See if this reloc needs to be copied into the .loader
- section. */
- switch (rel->r_type)
- {
- default:
- if (h == NULL
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak
- || h->root.type == bfd_link_hash_common
- || ((h->flags & XCOFF_CALLED) != 0
- && (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- && h->root.root.string[0] == '.'
- && h->descriptor != NULL
- && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0
- || ((h->descriptor->flags & XCOFF_IMPORT) != 0
- && (h->descriptor->flags
- & XCOFF_DEF_REGULAR) == 0))))
- break;
- /* Fall through. */
- case R_POS:
- case R_NEG:
- case R_RL:
- case R_RLA:
- ++xcoff_hash_table (info)->ldrel_count;
- if (h != NULL)
- h->flags |= XCOFF_LDREL;
- break;
- case R_TOC:
- case R_GL:
- case R_TCL:
- case R_TRL:
- case R_TRLA:
- /* We should never need a .loader reloc for a TOC
- relative reloc. */
- break;
- }
- }
-
- if (! info->keep_memory
- && coff_section_data (sec->owner, sec) != NULL
- && coff_section_data (sec->owner, sec)->relocs != NULL
- && ! coff_section_data (sec->owner, sec)->keep_relocs)
- {
- free (coff_section_data (sec->owner, sec)->relocs);
- coff_section_data (sec->owner, sec)->relocs = NULL;
- }
- }
- }
-
- return TRUE;
-}
-
-/* The sweep phase of garbage collection. Remove all garbage
- sections. */
-
-static void
-xcoff_sweep (info)
- struct bfd_link_info *info;
-{
- bfd *sub;
-
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- asection *o;
-
- for (o = sub->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_MARK) == 0)
- {
- /* Keep all sections from non-XCOFF input files. Keep
- special sections. Keep .debug sections for the
- moment. */
- if (sub->xvec != info->hash->creator
- || o == xcoff_hash_table (info)->debug_section
- || o == xcoff_hash_table (info)->loader_section
- || o == xcoff_hash_table (info)->linkage_section
- || o == xcoff_hash_table (info)->toc_section
- || o == xcoff_hash_table (info)->descriptor_section
- || strcmp (o->name, ".debug") == 0)
- o->flags |= SEC_MARK;
- else
- {
- o->_raw_size = 0;
- o->reloc_count = 0;
- o->lineno_count = 0;
- }
- }
- }
- }
-}
-
-/* Record the number of elements in a set. This is used to output the
- correct csect length. */
-
-bfd_boolean
-bfd_xcoff_link_record_set (output_bfd, info, harg, size)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct bfd_link_hash_entry *harg;
- bfd_size_type size;
-{
- struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
- struct xcoff_link_size_list *n;
- bfd_size_type amt;
-
- if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return TRUE;
-
- /* This will hardly ever be called. I don't want to burn four bytes
- per global symbol, so instead the size is kept on a linked list
- attached to the hash table. */
-
- amt = sizeof (struct xcoff_link_size_list);
- n = (struct xcoff_link_size_list *) bfd_alloc (output_bfd, amt);
- if (n == NULL)
- return FALSE;
- n->next = xcoff_hash_table (info)->size_list;
- n->h = h;
- n->size = size;
- xcoff_hash_table (info)->size_list = n;
-
- h->flags |= XCOFF_HAS_SIZE;
-
- return TRUE;
-}
-
-/* Import a symbol. */
-
-bfd_boolean
-bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
- impmember, syscall_flag)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct bfd_link_hash_entry *harg;
- bfd_vma val;
- const char *imppath;
- const char *impfile;
- const char *impmember;
- unsigned int syscall_flag;
-{
- struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
-
- if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return TRUE;
-
- /* A symbol name which starts with a period is the code for a
- function. If the symbol is undefined, then add an undefined
- symbol for the function descriptor, and import that instead. */
- if (h->root.root.string[0] == '.'
- && h->root.type == bfd_link_hash_undefined
- && val == (bfd_vma) -1)
- {
- struct xcoff_link_hash_entry *hds;
-
- hds = h->descriptor;
- if (hds == NULL)
- {
- hds = xcoff_link_hash_lookup (xcoff_hash_table (info),
- h->root.root.string + 1,
- TRUE, FALSE, TRUE);
- if (hds == NULL)
- return FALSE;
- if (hds->root.type == bfd_link_hash_new)
- {
- hds->root.type = bfd_link_hash_undefined;
- hds->root.u.undef.abfd = h->root.u.undef.abfd;
- }
- hds->flags |= XCOFF_DESCRIPTOR;
- BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0
- && (h->flags & XCOFF_DESCRIPTOR) == 0);
- hds->descriptor = h;
- h->descriptor = hds;
- }
-
- /* Now, if the descriptor is undefined, import the descriptor
- rather than the symbol we were told to import. FIXME: Is
- this correct in all cases? */
- if (hds->root.type == bfd_link_hash_undefined)
- h = hds;
- }
-
- h->flags |= (XCOFF_IMPORT | syscall_flag);
-
- if (val != (bfd_vma) -1)
- {
- if (h->root.type == bfd_link_hash_defined
- && (! bfd_is_abs_section (h->root.u.def.section)
- || h->root.u.def.value != val))
- {
- if (! ((*info->callbacks->multiple_definition)
- (info, h->root.root.string, h->root.u.def.section->owner,
- h->root.u.def.section, h->root.u.def.value,
- output_bfd, bfd_abs_section_ptr, val)))
- return FALSE;
- }
-
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = bfd_abs_section_ptr;
- h->root.u.def.value = val;
- }
-
- /* We overload the ldindx field to hold the l_ifile value for this
- symbol. */
- BFD_ASSERT (h->ldsym == NULL);
- BFD_ASSERT ((h->flags & XCOFF_BUILT_LDSYM) == 0);
- if (imppath == NULL)
- h->ldindx = -1;
- else
- {
- unsigned int c;
- struct xcoff_import_file **pp;
-
- /* We start c at 1 because the first entry in the import list is
- reserved for the library search path. */
- for (pp = &xcoff_hash_table (info)->imports, c = 1;
- *pp != NULL;
- pp = &(*pp)->next, ++c)
- {
- if (strcmp ((*pp)->path, imppath) == 0
- && strcmp ((*pp)->file, impfile) == 0
- && strcmp ((*pp)->member, impmember) == 0)
- break;
- }
-
- if (*pp == NULL)
- {
- struct xcoff_import_file *n;
- bfd_size_type amt = sizeof (struct xcoff_import_file);
-
- n = (struct xcoff_import_file *) bfd_alloc (output_bfd, amt);
- if (n == NULL)
- return FALSE;
- n->next = NULL;
- n->path = imppath;
- n->file = impfile;
- n->member = impmember;
- *pp = n;
- }
-
- h->ldindx = c;
- }
-
- return TRUE;
-}
-
-/* Export a symbol. */
-
-bfd_boolean
-bfd_xcoff_export_symbol (output_bfd, info, harg)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct bfd_link_hash_entry *harg;
-{
- struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
-
- if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return TRUE;
-
- h->flags |= XCOFF_EXPORT;
-
- /* FIXME: I'm not at all sure what syscall is supposed to mean, so
- I'm just going to ignore it until somebody explains it. */
-
- /* See if this is a function descriptor. It may be one even though
- it is not so marked. */
- if ((h->flags & XCOFF_DESCRIPTOR) == 0
- && h->root.root.string[0] != '.')
- {
- char *fnname;
- struct xcoff_link_hash_entry *hfn;
- bfd_size_type amt = strlen (h->root.root.string) + 2;
-
- fnname = (char *) bfd_malloc (amt);
- if (fnname == NULL)
- return FALSE;
- fnname[0] = '.';
- strcpy (fnname + 1, h->root.root.string);
- hfn = xcoff_link_hash_lookup (xcoff_hash_table (info),
- fnname, FALSE, FALSE, TRUE);
- free (fnname);
- if (hfn != NULL
- && hfn->smclas == XMC_PR
- && (hfn->root.type == bfd_link_hash_defined
- || hfn->root.type == bfd_link_hash_defweak))
- {
- h->flags |= XCOFF_DESCRIPTOR;
- h->descriptor = hfn;
- hfn->descriptor = h;
- }
- }
-
- /* Make sure we don't garbage collect this symbol. */
- if (! xcoff_mark_symbol (info, h))
- return FALSE;
-
- /* If this is a function descriptor, make sure we don't garbage
- collect the associated function code. We normally don't have to
- worry about this, because the descriptor will be attached to a
- section with relocs, but if we are creating the descriptor
- ourselves those relocs will not be visible to the mark code. */
- if ((h->flags & XCOFF_DESCRIPTOR) != 0)
- {
- if (! xcoff_mark_symbol (info, h->descriptor))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Count a reloc against a symbol. This is called for relocs
- generated by the linker script, typically for global constructors
- and destructors. */
-
-bfd_boolean
-bfd_xcoff_link_count_reloc (output_bfd, info, name)
- bfd *output_bfd;
- struct bfd_link_info *info;
- const char *name;
-{
- struct xcoff_link_hash_entry *h;
-
- if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return TRUE;
-
- h = ((struct xcoff_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, info, name, FALSE, FALSE,
- FALSE));
- if (h == NULL)
- {
- (*_bfd_error_handler) (_("%s: no such symbol"), name);
- bfd_set_error (bfd_error_no_symbols);
- return FALSE;
- }
-
- h->flags |= XCOFF_REF_REGULAR | XCOFF_LDREL;
- ++xcoff_hash_table (info)->ldrel_count;
-
- /* Mark the symbol to avoid garbage collection. */
- if (! xcoff_mark_symbol (info, h))
- return FALSE;
-
- return TRUE;
-}
-
-/* This function is called for each symbol to which the linker script
- assigns a value. */
-
-bfd_boolean
-bfd_xcoff_record_link_assignment (output_bfd, info, name)
- bfd *output_bfd;
- struct bfd_link_info *info;
- const char *name;
-{
- struct xcoff_link_hash_entry *h;
-
- if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return TRUE;
-
- h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, TRUE, TRUE,
- FALSE);
- if (h == NULL)
- return FALSE;
-
- h->flags |= XCOFF_DEF_REGULAR;
-
- return TRUE;
-}
-
-/* Build the .loader section. This is called by the XCOFF linker
- emulation before_allocation routine. We must set the size of the
- .loader section before the linker lays out the output file.
- LIBPATH is the library path to search for shared objects; this is
- normally built from the -L arguments passed to the linker. ENTRY
- is the name of the entry point symbol (the -e linker option).
- FILE_ALIGN is the alignment to use for sections within the file
- (the -H linker option). MAXSTACK is the maximum stack size (the
- -bmaxstack linker option). MAXDATA is the maximum data size (the
- -bmaxdata linker option). GC is whether to do garbage collection
- (the -bgc linker option). MODTYPE is the module type (the
- -bmodtype linker option). TEXTRO is whether the text section must
- be read only (the -btextro linker option). EXPORT_DEFINEDS is
- whether all defined symbols should be exported (the -unix linker
- option). SPECIAL_SECTIONS is set by this routine to csects with
- magic names like _end. */
-
-bfd_boolean
-bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
- file_align, maxstack, maxdata, gc,
- modtype, textro, export_defineds,
- special_sections, rtld)
- bfd *output_bfd;
- struct bfd_link_info *info;
- const char *libpath;
- const char *entry;
- unsigned long file_align;
- unsigned long maxstack;
- unsigned long maxdata;
- bfd_boolean gc;
- int modtype;
- bfd_boolean textro;
- bfd_boolean export_defineds;
- asection **special_sections;
- bfd_boolean rtld;
-{
- struct xcoff_link_hash_entry *hentry;
- asection *lsec;
- struct xcoff_loader_info ldinfo;
- int i;
- size_t impsize, impcount;
- struct xcoff_import_file *fl;
- struct internal_ldhdr *ldhdr;
- bfd_size_type stoff;
- register char *out;
- asection *sec;
- bfd *sub;
- struct bfd_strtab_hash *debug_strtab;
- bfd_byte *debug_contents = NULL;
- bfd_size_type amt;
-
- if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- {
- for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++)
- special_sections[i] = NULL;
- return TRUE;
- }
-
- ldinfo.failed = FALSE;
- ldinfo.output_bfd = output_bfd;
- ldinfo.info = info;
- ldinfo.export_defineds = export_defineds;
- ldinfo.ldsym_count = 0;
- ldinfo.string_size = 0;
- ldinfo.strings = NULL;
- ldinfo.string_alc = 0;
-
- xcoff_data (output_bfd)->maxstack = maxstack;
- xcoff_data (output_bfd)->maxdata = maxdata;
- xcoff_data (output_bfd)->modtype = modtype;
-
- xcoff_hash_table (info)->file_align = file_align;
- xcoff_hash_table (info)->textro = textro;
-
- hentry = NULL;
- if (entry != NULL)
- {
- hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry,
- FALSE, FALSE, TRUE);
- if (hentry != NULL)
- hentry->flags |= XCOFF_ENTRY;
- }
-
- /* __rtinit */
- if (info->init_function || info->fini_function || rtld)
- {
- struct xcoff_link_hash_entry *hsym;
- struct internal_ldsym *ldsym;
-
- hsym = xcoff_link_hash_lookup (xcoff_hash_table (info),
- "__rtinit", FALSE, FALSE, TRUE);
- if (hsym == NULL)
- {
- (*_bfd_error_handler)
- (_("error: undefined symbol __rtinit"));
- return FALSE;
- }
-
- xcoff_mark_symbol (info, hsym);
- hsym->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT);
-
- /* __rtinit initialized */
- amt = sizeof (struct internal_ldsym);
- ldsym = (struct internal_ldsym *) bfd_malloc (amt);
-
- ldsym->l_value = 0; /* will be filled in later */
- ldsym->l_scnum = 2; /* data section */
- ldsym->l_smtype = XTY_SD; /* csect section definition */
- ldsym->l_smclas = 5; /* .rw */
- ldsym->l_ifile = 0; /* special system loader symbol */
- ldsym->l_parm = 0; /* NA */
-
- /* Force __rtinit to be the first symbol in the loader symbol table
- See xcoff_build_ldsyms
-
- The first 3 symbol table indices are reserved to indicate the data,
- text and bss sections. */
- BFD_ASSERT (0 == ldinfo.ldsym_count);
-
- hsym->ldindx = 3;
- ldinfo.ldsym_count = 1;
- hsym->ldsym = ldsym;
-
- if (! bfd_xcoff_put_ldsymbol_name (ldinfo.output_bfd, &ldinfo,
- hsym->ldsym, hsym->root.root.string))
- return FALSE;
-
- /* This symbol is written out by xcoff_write_global_symbol
- Set stuff up so xcoff_write_global_symbol logic works. */
- hsym->flags |= XCOFF_DEF_REGULAR | XCOFF_MARK;
- hsym->root.type = bfd_link_hash_defined;
- hsym->root.u.def.value = 0;
- }
-
- /* Garbage collect unused sections. */
- if (info->relocatable
- || ! gc
- || hentry == NULL
- || (hentry->root.type != bfd_link_hash_defined
- && hentry->root.type != bfd_link_hash_defweak))
- {
- gc = FALSE;
- xcoff_hash_table (info)->gc = FALSE;
-
- /* We still need to call xcoff_mark, in order to set ldrel_count
- correctly. */
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- asection *o;
-
- for (o = sub->sections; o != NULL; o = o->next)
- {
- if ((o->flags & SEC_MARK) == 0)
- {
- if (! xcoff_mark (info, o))
- goto error_return;
- }
- }
- }
- }
- else
- {
- if (! xcoff_mark (info, hentry->root.u.def.section))
- goto error_return;
- xcoff_sweep (info);
- xcoff_hash_table (info)->gc = TRUE;
- }
-
- /* Return special sections to the caller. */
- for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++)
- {
- sec = xcoff_hash_table (info)->special_sections[i];
-
- if (sec != NULL
- && gc
- && (sec->flags & SEC_MARK) == 0)
- {
- sec = NULL;
- }
- special_sections[i] = sec;
- }
-
- if (info->input_bfds == NULL)
- {
- /* I'm not sure what to do in this bizarre case. */
- return TRUE;
- }
-
- xcoff_link_hash_traverse (xcoff_hash_table (info), xcoff_build_ldsyms,
- (PTR) &ldinfo);
- if (ldinfo.failed)
- goto error_return;
-
- /* Work out the size of the import file names. Each import file ID
- consists of three null terminated strings: the path, the file
- name, and the archive member name. The first entry in the list
- of names is the path to use to find objects, which the linker has
- passed in as the libpath argument. For some reason, the path
- entry in the other import file names appears to always be empty. */
- impsize = strlen (libpath) + 3;
- impcount = 1;
- for (fl = xcoff_hash_table (info)->imports; fl != NULL; fl = fl->next)
- {
- ++impcount;
- impsize += (strlen (fl->path)
- + strlen (fl->file)
- + strlen (fl->member)
- + 3);
- }
-
- /* Set up the .loader section header. */
- ldhdr = &xcoff_hash_table (info)->ldhdr;
- ldhdr->l_version = bfd_xcoff_ldhdr_version(output_bfd);
- ldhdr->l_nsyms = ldinfo.ldsym_count;
- ldhdr->l_nreloc = xcoff_hash_table (info)->ldrel_count;
- ldhdr->l_istlen = impsize;
- ldhdr->l_nimpid = impcount;
- ldhdr->l_impoff = (bfd_xcoff_ldhdrsz(output_bfd)
- + ldhdr->l_nsyms * bfd_xcoff_ldsymsz(output_bfd)
- + ldhdr->l_nreloc * bfd_xcoff_ldrelsz(output_bfd));
- ldhdr->l_stlen = ldinfo.string_size;
- stoff = ldhdr->l_impoff + impsize;
- if (ldinfo.string_size == 0)
- ldhdr->l_stoff = 0;
- else
- ldhdr->l_stoff = stoff;
-
- /* 64 bit elements to ldhdr
- The swap out routine for 32 bit will ignore them.
- Nothing fancy, symbols come after the header and relocs come
- after symbols. */
- ldhdr->l_symoff = bfd_xcoff_ldhdrsz (output_bfd);
- ldhdr->l_rldoff = (bfd_xcoff_ldhdrsz (output_bfd)
- + ldhdr->l_nsyms * bfd_xcoff_ldsymsz (output_bfd));
-
- /* We now know the final size of the .loader section. Allocate
- space for it. */
- lsec = xcoff_hash_table (info)->loader_section;
- lsec->_raw_size = stoff + ldhdr->l_stlen;
- lsec->contents = (bfd_byte *) bfd_zalloc (output_bfd, lsec->_raw_size);
- if (lsec->contents == NULL)
- goto error_return;
-
- /* Set up the header. */
- bfd_xcoff_swap_ldhdr_out (output_bfd, ldhdr, lsec->contents);
-
- /* Set up the import file names. */
- out = (char *) lsec->contents + ldhdr->l_impoff;
- strcpy (out, libpath);
- out += strlen (libpath) + 1;
- *out++ = '\0';
- *out++ = '\0';
- for (fl = xcoff_hash_table (info)->imports; fl != NULL; fl = fl->next)
- {
- register const char *s;
-
- s = fl->path;
- while ((*out++ = *s++) != '\0')
- ;
- s = fl->file;
- while ((*out++ = *s++) != '\0')
- ;
- s = fl->member;
- while ((*out++ = *s++) != '\0')
- ;
- }
-
- BFD_ASSERT ((bfd_size_type) ((bfd_byte *) out - lsec->contents) == stoff);
-
- /* Set up the symbol string table. */
- if (ldinfo.string_size > 0)
- {
- memcpy (out, ldinfo.strings, ldinfo.string_size);
- free (ldinfo.strings);
- ldinfo.strings = NULL;
- }
-
- /* We can't set up the symbol table or the relocs yet, because we
- don't yet know the final position of the various sections. The
- .loader symbols are written out when the corresponding normal
- symbols are written out in xcoff_link_input_bfd or
- xcoff_write_global_symbol. The .loader relocs are written out
- when the corresponding normal relocs are handled in
- xcoff_link_input_bfd.
- */
-
- /* Allocate space for the magic sections. */
- sec = xcoff_hash_table (info)->linkage_section;
- if (sec->_raw_size > 0)
- {
- sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
- if (sec->contents == NULL)
- goto error_return;
- }
- sec = xcoff_hash_table (info)->toc_section;
- if (sec->_raw_size > 0)
- {
- sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
- if (sec->contents == NULL)
- goto error_return;
- }
- sec = xcoff_hash_table (info)->descriptor_section;
- if (sec->_raw_size > 0)
- {
- sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
- if (sec->contents == NULL)
- goto error_return;
- }
-
- /* Now that we've done garbage collection, figure out the contents
- of the .debug section. */
- debug_strtab = xcoff_hash_table (info)->debug_strtab;
-
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- asection *subdeb;
- bfd_size_type symcount;
- unsigned long *debug_index;
- asection **csectpp;
- bfd_byte *esym, *esymend;
- bfd_size_type symesz;
-
- if (sub->xvec != info->hash->creator)
- continue;
- subdeb = bfd_get_section_by_name (sub, ".debug");
- if (subdeb == NULL || subdeb->_raw_size == 0)
- continue;
-
- if (info->strip == strip_all
- || info->strip == strip_debugger
- || info->discard == discard_all)
- {
- subdeb->_raw_size = 0;
- continue;
- }
-
- if (! _bfd_coff_get_external_symbols (sub))
- goto error_return;
-
- symcount = obj_raw_syment_count (sub);
- debug_index = ((unsigned long *)
- bfd_zalloc (sub, symcount * sizeof (unsigned long)));
- if (debug_index == NULL)
- goto error_return;
- xcoff_data (sub)->debug_indices = debug_index;
-
- /* Grab the contents of the .debug section. We use malloc and
- copy the names into the debug stringtab, rather than
- bfd_alloc, because I expect that, when linking many files
- together, many of the strings will be the same. Storing the
- strings in the hash table should save space in this case. */
- debug_contents = (bfd_byte *) bfd_malloc (subdeb->_raw_size);
- if (debug_contents == NULL)
- goto error_return;
- if (! bfd_get_section_contents (sub, subdeb, (PTR) debug_contents,
- (file_ptr) 0, subdeb->_raw_size))
- goto error_return;
-
- csectpp = xcoff_data (sub)->csects;
-
- /* Dynamic object do not have csectpp's. */
- if (NULL != csectpp)
- {
- symesz = bfd_coff_symesz (sub);
- esym = (bfd_byte *) obj_coff_external_syms (sub);
- esymend = esym + symcount * symesz;
-
- while (esym < esymend)
- {
- struct internal_syment sym;
-
- bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym);
-
- *debug_index = (unsigned long) -1;
-
- if (sym._n._n_n._n_zeroes == 0
- && *csectpp != NULL
- && (! gc
- || ((*csectpp)->flags & SEC_MARK) != 0
- || *csectpp == bfd_abs_section_ptr)
- && bfd_coff_symname_in_debug (sub, &sym))
- {
- char *name;
- bfd_size_type indx;
-
- name = (char *) debug_contents + sym._n._n_n._n_offset;
- indx = _bfd_stringtab_add (debug_strtab, name, TRUE, TRUE);
- if (indx == (bfd_size_type) -1)
- goto error_return;
- *debug_index = indx;
- }
-
- esym += (sym.n_numaux + 1) * symesz;
- csectpp += sym.n_numaux + 1;
- debug_index += sym.n_numaux + 1;
- }
- }
-
- free (debug_contents);
- debug_contents = NULL;
-
- /* Clear the size of subdeb, so that it is not included directly
- in the output file. */
- subdeb->_raw_size = 0;
-
- if (! info->keep_memory)
- {
- if (! _bfd_coff_free_symbols (sub))
- goto error_return;
- }
- }
-
- if (info->strip != strip_all)
- xcoff_hash_table (info)->debug_section->_raw_size =
- _bfd_stringtab_size (debug_strtab);
-
- return TRUE;
-
- error_return:
- if (ldinfo.strings != NULL)
- free (ldinfo.strings);
- if (debug_contents != NULL)
- free (debug_contents);
- return FALSE;
-}
-
-bfd_boolean
-bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld)
- bfd *abfd;
- const char *init;
- const char *fini;
- bfd_boolean rtld;
-{
- struct bfd_in_memory *bim;
-
- bim = ((struct bfd_in_memory *)
- bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
- if (bim == NULL)
- return FALSE;
-
- bim->size = 0;
- bim->buffer = 0;
-
- abfd->link_next = 0;
- abfd->format = bfd_object;
- abfd->iostream = (PTR) bim;
- abfd->flags = BFD_IN_MEMORY;
- abfd->direction = write_direction;
- abfd->where = 0;
-
- if (! bfd_xcoff_generate_rtinit (abfd, init, fini, rtld))
- return FALSE;
-
- /* need to reset to unknown or it will not be read back in correctly */
- abfd->format = bfd_unknown;
- abfd->direction = read_direction;
- abfd->where = 0;
-
- return TRUE;
-}
-
-
-/* Add a symbol to the .loader symbols, if necessary. */
-
-static bfd_boolean
-xcoff_build_ldsyms (h, p)
- struct xcoff_link_hash_entry *h;
- PTR p;
-{
- struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p;
- bfd_size_type amt;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct xcoff_link_hash_entry *) h->root.u.i.link;
-
- /* __rtinit, this symbol has special handling. */
- if (h->flags & XCOFF_RTINIT)
- return TRUE;
-
- /* If this is a final link, and the symbol was defined as a common
- symbol in a regular object file, and there was no definition in
- any dynamic object, then the linker will have allocated space for
- the symbol in a common section but the XCOFF_DEF_REGULAR flag
- will not have been set. */
- if (h->root.type == bfd_link_hash_defined
- && (h->flags & XCOFF_DEF_REGULAR) == 0
- && (h->flags & XCOFF_REF_REGULAR) != 0
- && (h->flags & XCOFF_DEF_DYNAMIC) == 0
- && (bfd_is_abs_section (h->root.u.def.section)
- || (h->root.u.def.section->owner->flags & DYNAMIC) == 0))
- h->flags |= XCOFF_DEF_REGULAR;
-
- /* If all defined symbols should be exported, mark them now. We
- don't want to export the actual functions, just the function
- descriptors. */
- if (ldinfo->export_defineds
- && (h->flags & XCOFF_DEF_REGULAR) != 0
- && h->root.root.string[0] != '.')
- {
- bfd_boolean export;
-
- /* We don't export a symbol which is being defined by an object
- included from an archive which contains a shared object. The
- rationale is that if an archive contains both an unshared and
- a shared object, then there must be some reason that the
- unshared object is unshared, and we don't want to start
- providing a shared version of it. In particular, this solves
- a bug involving the _savefNN set of functions. gcc will call
- those functions without providing a slot to restore the TOC,
- so it is essential that these functions be linked in directly
- and not from a shared object, which means that a shared
- object which also happens to link them in must not export
- them. This is confusing, but I haven't been able to think of
- a different approach. Note that the symbols can, of course,
- be exported explicitly. */
- export = TRUE;
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section->owner != NULL
- && h->root.u.def.section->owner->my_archive != NULL)
- {
- bfd *arbfd, *member;
-
- arbfd = h->root.u.def.section->owner->my_archive;
- member = bfd_openr_next_archived_file (arbfd, (bfd *) NULL);
- while (member != NULL)
- {
- if ((member->flags & DYNAMIC) != 0)
- {
- export = FALSE;
- break;
- }
- member = bfd_openr_next_archived_file (arbfd, member);
- }
- }
-
- if (export)
- h->flags |= XCOFF_EXPORT;
- }
-
- /* We don't want to garbage collect symbols which are not defined in
- XCOFF files. This is a convenient place to mark them. */
- if (xcoff_hash_table (ldinfo->info)->gc
- && (h->flags & XCOFF_MARK) == 0
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->root.u.def.section->owner == NULL
- || (h->root.u.def.section->owner->xvec
- != ldinfo->info->hash->creator)))
- h->flags |= XCOFF_MARK;
-
- /* If this symbol is called and defined in a dynamic object, or it
- is imported, then we need to set up global linkage code for it.
- (Unless we did garbage collection and we didn't need this
- symbol.) */
- if ((h->flags & XCOFF_CALLED) != 0
- && (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- && h->root.root.string[0] == '.'
- && h->descriptor != NULL
- && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0
- || ((h->descriptor->flags & XCOFF_IMPORT) != 0
- && (h->descriptor->flags & XCOFF_DEF_REGULAR) == 0))
- && (! xcoff_hash_table (ldinfo->info)->gc
- || (h->flags & XCOFF_MARK) != 0))
- {
- asection *sec;
- struct xcoff_link_hash_entry *hds;
-
- sec = xcoff_hash_table (ldinfo->info)->linkage_section;
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = sec;
- h->root.u.def.value = sec->_raw_size;
- h->smclas = XMC_GL;
- h->flags |= XCOFF_DEF_REGULAR;
- sec->_raw_size += bfd_xcoff_glink_code_size(ldinfo->output_bfd);
-
- /* The global linkage code requires a TOC entry for the
- descriptor. */
- hds = h->descriptor;
- BFD_ASSERT ((hds->root.type == bfd_link_hash_undefined
- || hds->root.type == bfd_link_hash_undefweak)
- && (hds->flags & XCOFF_DEF_REGULAR) == 0);
- hds->flags |= XCOFF_MARK;
- if (hds->toc_section == NULL)
- {
- int byte_size;
-
- /* 32 vs 64
- xcoff32 uses 4 bytes in the toc.
- xcoff64 uses 8 bytes in the toc. */
- if (bfd_xcoff_is_xcoff64 (ldinfo->output_bfd))
- byte_size = 8;
- else if (bfd_xcoff_is_xcoff32 (ldinfo->output_bfd))
- byte_size = 4;
- else
- return FALSE;
-
- hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section;
- hds->u.toc_offset = hds->toc_section->_raw_size;
- hds->toc_section->_raw_size += byte_size;
- ++xcoff_hash_table (ldinfo->info)->ldrel_count;
- ++hds->toc_section->reloc_count;
- hds->indx = -2;
- hds->flags |= XCOFF_SET_TOC | XCOFF_LDREL;
-
- /* We need to call xcoff_build_ldsyms recursively here,
- because we may already have passed hds on the traversal. */
- xcoff_build_ldsyms (hds, p);
- }
- }
-
- /* If this symbol is exported, but not defined, we need to try to
- define it. */
- if ((h->flags & XCOFF_EXPORT) != 0
- && (h->flags & XCOFF_IMPORT) == 0
- && (h->flags & XCOFF_DEF_REGULAR) == 0
- && (h->flags & XCOFF_DEF_DYNAMIC) == 0
- && (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak))
- {
- if ((h->flags & XCOFF_DESCRIPTOR) != 0
- && (h->descriptor->root.type == bfd_link_hash_defined
- || h->descriptor->root.type == bfd_link_hash_defweak))
- {
- asection *sec;
-
- /* This is an undefined function descriptor associated with
- a defined entry point. We can build up a function
- descriptor ourselves. Believe it or not, the AIX linker
- actually does this, and there are cases where we need to
- do it as well. */
- sec = xcoff_hash_table (ldinfo->info)->descriptor_section;
- h->root.type = bfd_link_hash_defined;
- h->root.u.def.section = sec;
- h->root.u.def.value = sec->_raw_size;
- h->smclas = XMC_DS;
- h->flags |= XCOFF_DEF_REGULAR;
-
- /* The size of the function descriptor depends if this is an
- xcoff32 (12) or xcoff64 (24). */
- sec->_raw_size +=
- bfd_xcoff_function_descriptor_size(ldinfo->output_bfd);
-
- /* A function descriptor uses two relocs: one for the
- associated code, and one for the TOC address. */
- xcoff_hash_table (ldinfo->info)->ldrel_count += 2;
- sec->reloc_count += 2;
-
- /* We handle writing out the contents of the descriptor in
- xcoff_write_global_symbol. */
- }
- else
- {
- (*_bfd_error_handler)
- (_("warning: attempt to export undefined symbol `%s'"),
- h->root.root.string);
- h->ldsym = NULL;
- return TRUE;
- }
- }
-
- /* If this is still a common symbol, and it wasn't garbage
- collected, we need to actually allocate space for it in the .bss
- section. */
- if (h->root.type == bfd_link_hash_common
- && (! xcoff_hash_table (ldinfo->info)->gc
- || (h->flags & XCOFF_MARK) != 0)
- && h->root.u.c.p->section->_raw_size == 0)
- {
- BFD_ASSERT (bfd_is_com_section (h->root.u.c.p->section));
- h->root.u.c.p->section->_raw_size = h->root.u.c.size;
- }
-
- /* We need to add a symbol to the .loader section if it is mentioned
- in a reloc which we are copying to the .loader section and it was
- not defined or common, or if it is the entry point, or if it is
- being exported. */
-
- if (((h->flags & XCOFF_LDREL) == 0
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak
- || h->root.type == bfd_link_hash_common)
- && (h->flags & XCOFF_ENTRY) == 0
- && (h->flags & XCOFF_EXPORT) == 0)
- {
- h->ldsym = NULL;
- return TRUE;
- }
-
- /* We don't need to add this symbol if we did garbage collection and
- we did not mark this symbol. */
- if (xcoff_hash_table (ldinfo->info)->gc
- && (h->flags & XCOFF_MARK) == 0)
- {
- h->ldsym = NULL;
- return TRUE;
- }
-
- /* We may have already processed this symbol due to the recursive
- call above. */
- if ((h->flags & XCOFF_BUILT_LDSYM) != 0)
- return TRUE;
-
- /* We need to add this symbol to the .loader symbols. */
-
- BFD_ASSERT (h->ldsym == NULL);
- amt = sizeof (struct internal_ldsym);
- h->ldsym = (struct internal_ldsym *) bfd_zalloc (ldinfo->output_bfd, amt);
- if (h->ldsym == NULL)
- {
- ldinfo->failed = TRUE;
- return FALSE;
- }
-
- if ((h->flags & XCOFF_IMPORT) != 0)
- h->ldsym->l_ifile = h->ldindx;
-
- /* The first 3 symbol table indices are reserved to indicate the
- data, text and bss sections. */
- h->ldindx = ldinfo->ldsym_count + 3;
-
- ++ldinfo->ldsym_count;
-
- if (! bfd_xcoff_put_ldsymbol_name (ldinfo->output_bfd, ldinfo,
- h->ldsym, h->root.root.string))
- {
- return FALSE;
- }
-
- h->flags |= XCOFF_BUILT_LDSYM;
-
- return TRUE;
-}
-
-/* Do the final link step. */
-
-bfd_boolean
-_bfd_xcoff_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- bfd_size_type symesz;
- struct xcoff_final_link_info finfo;
- asection *o;
- struct bfd_link_order *p;
- bfd_size_type max_contents_size;
- bfd_size_type max_sym_count;
- bfd_size_type max_lineno_count;
- bfd_size_type max_reloc_count;
- bfd_size_type max_output_reloc_count;
- file_ptr rel_filepos;
- unsigned int relsz;
- file_ptr line_filepos;
- unsigned int linesz;
- bfd *sub;
- bfd_byte *external_relocs = NULL;
- char strbuf[STRING_SIZE_SIZE];
- file_ptr pos;
- bfd_size_type amt;
-
- if (info->shared)
- abfd->flags |= DYNAMIC;
-
- symesz = bfd_coff_symesz (abfd);
-
- finfo.info = info;
- finfo.output_bfd = abfd;
- finfo.strtab = NULL;
- finfo.section_info = NULL;
- finfo.last_file_index = -1;
- finfo.toc_symindx = -1;
- finfo.internal_syms = NULL;
- finfo.sym_indices = NULL;
- finfo.outsyms = NULL;
- finfo.linenos = NULL;
- finfo.contents = NULL;
- finfo.external_relocs = NULL;
-
- finfo.ldsym = (xcoff_hash_table (info)->loader_section->contents
- + bfd_xcoff_ldhdrsz (abfd));
- finfo.ldrel = (xcoff_hash_table (info)->loader_section->contents
- + bfd_xcoff_ldhdrsz(abfd)
- + (xcoff_hash_table (info)->ldhdr.l_nsyms
- * bfd_xcoff_ldsymsz(abfd)));
-
- xcoff_data (abfd)->coff.link_info = info;
-
- finfo.strtab = _bfd_stringtab_init ();
- if (finfo.strtab == NULL)
- goto error_return;
-
- /* Count the line number and relocation entries required for the
- output file. Determine a few maximum sizes. */
- max_contents_size = 0;
- max_lineno_count = 0;
- max_reloc_count = 0;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- o->reloc_count = 0;
- o->lineno_count = 0;
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order)
- {
- asection *sec;
-
- sec = p->u.indirect.section;
-
- /* Mark all sections which are to be included in the
- link. This will normally be every section. We need
- to do this so that we can identify any sections which
- the linker has decided to not include. */
- sec->linker_mark = TRUE;
-
- if (info->strip == strip_none
- || info->strip == strip_some)
- o->lineno_count += sec->lineno_count;
-
- o->reloc_count += sec->reloc_count;
-
- if (sec->_raw_size > max_contents_size)
- max_contents_size = sec->_raw_size;
- if (sec->lineno_count > max_lineno_count)
- max_lineno_count = sec->lineno_count;
- if (coff_section_data (sec->owner, sec) != NULL
- && xcoff_section_data (sec->owner, sec) != NULL
- && (xcoff_section_data (sec->owner, sec)->lineno_count
- > max_lineno_count))
- max_lineno_count =
- xcoff_section_data (sec->owner, sec)->lineno_count;
- if (sec->reloc_count > max_reloc_count)
- max_reloc_count = sec->reloc_count;
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- ++o->reloc_count;
- }
- }
-
- /* Compute the file positions for all the sections. */
- if (abfd->output_has_begun)
- {
- if (xcoff_hash_table (info)->file_align != 0)
- abort ();
- }
- else
- {
- bfd_vma file_align;
-
- file_align = xcoff_hash_table (info)->file_align;
- if (file_align != 0)
- {
- bfd_boolean saw_contents;
- int indx;
- asection **op;
- file_ptr sofar;
-
- /* Insert .pad sections before every section which has
- contents and is loaded, if it is preceded by some other
- section which has contents and is loaded. */
- saw_contents = TRUE;
- for (op = &abfd->sections; *op != NULL; op = &(*op)->next)
- {
- if (strcmp ((*op)->name, ".pad") == 0)
- saw_contents = FALSE;
- else if (((*op)->flags & SEC_HAS_CONTENTS) != 0
- && ((*op)->flags & SEC_LOAD) != 0)
- {
- if (! saw_contents)
- saw_contents = TRUE;
- else
- {
- asection *n, **st;
-
- /* Create a pad section and place it before the section
- that needs padding. This requires unlinking and
- relinking the bfd's section list. */
-
- st = abfd->section_tail;
- n = bfd_make_section_anyway (abfd, ".pad");
- n->flags = SEC_HAS_CONTENTS;
- n->alignment_power = 0;
-
- BFD_ASSERT (*st == n);
- bfd_section_list_remove (abfd, st);
- bfd_section_list_insert (abfd, op, n);
-
- op = &n->next;
- saw_contents = FALSE;
- }
- }
- }
-
- /* Reset the section indices after inserting the new
- sections. */
- indx = 0;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- ++indx;
- o->target_index = indx;
- }
- BFD_ASSERT ((unsigned int) indx == abfd->section_count);
-
- /* Work out appropriate sizes for the .pad sections to force
- each section to land on a page boundary. This bit of
- code knows what compute_section_file_positions is going
- to do. */
- sofar = bfd_coff_filhsz (abfd);
- sofar += bfd_coff_aoutsz (abfd);
- sofar += abfd->section_count * bfd_coff_scnhsz (abfd);
- for (o = abfd->sections; o != NULL; o = o->next)
- if ((bfd_xcoff_is_reloc_count_overflow
- (abfd, (bfd_vma) o->reloc_count))
- || (bfd_xcoff_is_lineno_count_overflow
- (abfd, (bfd_vma) o->lineno_count)))
- /* 64 does not overflow, need to check if 32 does */
- sofar += bfd_coff_scnhsz (abfd);
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (strcmp (o->name, ".pad") == 0)
- {
- bfd_vma pageoff;
-
- BFD_ASSERT (o->_raw_size == 0);
- pageoff = sofar & (file_align - 1);
- if (pageoff != 0)
- {
- o->_raw_size = file_align - pageoff;
- sofar += file_align - pageoff;
- o->flags |= SEC_HAS_CONTENTS;
- }
- }
- else
- {
- if ((o->flags & SEC_HAS_CONTENTS) != 0)
- sofar += BFD_ALIGN (o->_raw_size,
- 1 << o->alignment_power);
- }
- }
- }
-
- if (! bfd_coff_compute_section_file_positions (abfd))
- goto error_return;
- }
-
- /* Allocate space for the pointers we need to keep for the relocs. */
- {
- unsigned int i;
-
- /* We use section_count + 1, rather than section_count, because
- the target_index fields are 1 based. */
- amt = abfd->section_count + 1;
- amt *= sizeof (struct xcoff_link_section_info);
- finfo.section_info = (struct xcoff_link_section_info *) bfd_malloc (amt);
- if (finfo.section_info == NULL)
- goto error_return;
- for (i = 0; i <= abfd->section_count; i++)
- {
- finfo.section_info[i].relocs = NULL;
- finfo.section_info[i].rel_hashes = NULL;
- finfo.section_info[i].toc_rel_hashes = NULL;
- }
- }
-
- /* Set the file positions for the relocs. */
- rel_filepos = obj_relocbase (abfd);
- relsz = bfd_coff_relsz (abfd);
- max_output_reloc_count = 0;
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (o->reloc_count == 0)
- o->rel_filepos = 0;
- else
- {
- /* A stripped file has no relocs. However, we still
- allocate the buffers, so that later code doesn't have to
- worry about whether we are stripping or not. */
- if (info->strip == strip_all)
- o->rel_filepos = 0;
- else
- {
- o->flags |= SEC_RELOC;
- o->rel_filepos = rel_filepos;
- rel_filepos += o->reloc_count * relsz;
- }
-
- /* We don't know the indices of global symbols until we have
- written out all the local symbols. For each section in
- the output file, we keep an array of pointers to hash
- table entries. Each entry in the array corresponds to a
- reloc. When we find a reloc against a global symbol, we
- set the corresponding entry in this array so that we can
- fix up the symbol index after we have written out all the
- local symbols.
-
- Because of this problem, we also keep the relocs in
- memory until the end of the link. This wastes memory.
- We could backpatch the file later, I suppose, although it
- would be slow. */
- amt = o->reloc_count;
- amt *= sizeof (struct internal_reloc);
- finfo.section_info[o->target_index].relocs =
- (struct internal_reloc *) bfd_malloc (amt);
-
- amt = o->reloc_count;
- amt *= sizeof (struct xcoff_link_hash_entry *);
- finfo.section_info[o->target_index].rel_hashes =
- (struct xcoff_link_hash_entry **) bfd_malloc (amt);
-
- if (finfo.section_info[o->target_index].relocs == NULL
- || finfo.section_info[o->target_index].rel_hashes == NULL)
- goto error_return;
-
- if (o->reloc_count > max_output_reloc_count)
- max_output_reloc_count = o->reloc_count;
- }
- }
-
- /* We now know the size of the relocs, so we can determine the file
- positions of the line numbers. */
- line_filepos = rel_filepos;
- finfo.line_filepos = line_filepos;
- linesz = bfd_coff_linesz (abfd);
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (o->lineno_count == 0)
- o->line_filepos = 0;
- else
- {
- o->line_filepos = line_filepos;
- line_filepos += o->lineno_count * linesz;
- }
-
- /* Reset the reloc and lineno counts, so that we can use them to
- count the number of entries we have output so far. */
- o->reloc_count = 0;
- o->lineno_count = 0;
- }
-
- obj_sym_filepos (abfd) = line_filepos;
-
- /* Figure out the largest number of symbols in an input BFD. Take
- the opportunity to clear the output_has_begun fields of all the
- input BFD's. We want at least 6 symbols, since that is the
- number which xcoff_write_global_symbol may need. */
- max_sym_count = 6;
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
- {
- bfd_size_type sz;
-
- sub->output_has_begun = FALSE;
- sz = obj_raw_syment_count (sub);
- if (sz > max_sym_count)
- max_sym_count = sz;
- }
-
- /* Allocate some buffers used while linking. */
- amt = max_sym_count * sizeof (struct internal_syment);
- finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
-
- amt = max_sym_count * sizeof (long);
- finfo.sym_indices = (long *) bfd_malloc (amt);
-
- amt = (max_sym_count + 1) * symesz;
- finfo.outsyms = (bfd_byte *) bfd_malloc (amt);
-
- amt = max_lineno_count * bfd_coff_linesz (abfd);
- finfo.linenos = (bfd_byte *) bfd_malloc (amt);
-
- amt = max_contents_size;
- finfo.contents = (bfd_byte *) bfd_malloc (amt);
-
- amt = max_reloc_count * relsz;
- finfo.external_relocs = (bfd_byte *) bfd_malloc (amt);
-
- if ((finfo.internal_syms == NULL && max_sym_count > 0)
- || (finfo.sym_indices == NULL && max_sym_count > 0)
- || finfo.outsyms == NULL
- || (finfo.linenos == NULL && max_lineno_count > 0)
- || (finfo.contents == NULL && max_contents_size > 0)
- || (finfo.external_relocs == NULL && max_reloc_count > 0))
- goto error_return;
-
- obj_raw_syment_count (abfd) = 0;
- xcoff_data (abfd)->toc = (bfd_vma) -1;
-
- /* We now know the position of everything in the file, except that
- we don't know the size of the symbol table and therefore we don't
- know where the string table starts. We just build the string
- table in memory as we go along. We process all the relocations
- for a single input file at once. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order
- && p->u.indirect.section->owner->xvec == abfd->xvec)
- {
- sub = p->u.indirect.section->owner;
- if (! sub->output_has_begun)
- {
- if (! xcoff_link_input_bfd (&finfo, sub))
- goto error_return;
- sub->output_has_begun = TRUE;
- }
- }
- else if (p->type == bfd_section_reloc_link_order
- || p->type == bfd_symbol_reloc_link_order)
- {
- if (! xcoff_reloc_link_order (abfd, &finfo, o, p))
- goto error_return;
- }
- else
- {
- if (! _bfd_default_link_order (abfd, info, o, p))
- goto error_return;
- }
- }
- }
-
-
- /* Free up the buffers used by xcoff_link_input_bfd. */
-
- if (finfo.internal_syms != NULL)
- {
- free (finfo.internal_syms);
- finfo.internal_syms = NULL;
- }
- if (finfo.sym_indices != NULL)
- {
- free (finfo.sym_indices);
- finfo.sym_indices = NULL;
- }
- if (finfo.linenos != NULL)
- {
- free (finfo.linenos);
- finfo.linenos = NULL;
- }
- if (finfo.contents != NULL)
- {
- free (finfo.contents);
- finfo.contents = NULL;
- }
- if (finfo.external_relocs != NULL)
- {
- free (finfo.external_relocs);
- finfo.external_relocs = NULL;
- }
-
- /* The value of the last C_FILE symbol is supposed to be -1. Write
- it out again. */
- if (finfo.last_file_index != -1)
- {
- finfo.last_file.n_value = -(bfd_vma) 1;
- bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file,
- (PTR) finfo.outsyms);
- pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
- goto error_return;
- }
-
- /* Write out all the global symbols which do not come from XCOFF
- input files. */
- xcoff_link_hash_traverse (xcoff_hash_table (info),
- xcoff_write_global_symbol,
- (PTR) &finfo);
-
- if (finfo.outsyms != NULL)
- {
- free (finfo.outsyms);
- finfo.outsyms = NULL;
- }
-
- /* 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. */
- amt = max_output_reloc_count * relsz;
- external_relocs = (bfd_byte *) bfd_malloc (amt);
- if (external_relocs == NULL && max_output_reloc_count != 0)
- goto error_return;
-
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct internal_reloc *irel;
- struct internal_reloc *irelend;
- struct xcoff_link_hash_entry **rel_hash;
- struct xcoff_toc_rel_hash *toc_rel_hash;
- bfd_byte *erel;
- bfd_size_type rel_size;
-
- /* A stripped file has no relocs. */
- if (info->strip == strip_all)
- {
- o->reloc_count = 0;
- continue;
- }
-
- if (o->reloc_count == 0)
- continue;
-
- irel = finfo.section_info[o->target_index].relocs;
- irelend = irel + o->reloc_count;
- rel_hash = finfo.section_info[o->target_index].rel_hashes;
- for (; irel < irelend; irel++, rel_hash++, erel += relsz)
- {
- if (*rel_hash != NULL)
- {
- if ((*rel_hash)->indx < 0)
- {
- if (! ((*info->callbacks->unattached_reloc)
- (info, (*rel_hash)->root.root.string,
- (bfd *) NULL, o, irel->r_vaddr)))
- goto error_return;
- (*rel_hash)->indx = 0;
- }
- irel->r_symndx = (*rel_hash)->indx;
- }
- }
-
- for (toc_rel_hash = finfo.section_info[o->target_index].toc_rel_hashes;
- toc_rel_hash != NULL;
- toc_rel_hash = toc_rel_hash->next)
- {
- if (toc_rel_hash->h->u.toc_indx < 0)
- {
- if (! ((*info->callbacks->unattached_reloc)
- (info, toc_rel_hash->h->root.root.string,
- (bfd *) NULL, o, toc_rel_hash->rel->r_vaddr)))
- goto error_return;
- toc_rel_hash->h->u.toc_indx = 0;
- }
- toc_rel_hash->rel->r_symndx = toc_rel_hash->h->u.toc_indx;
- }
-
- /* XCOFF requires that the relocs be sorted by address. We tend
- to produce them in the order in which their containing csects
- appear in the symbol table, which is not necessarily by
- address. So we sort them here. There may be a better way to
- do this. */
- qsort ((PTR) finfo.section_info[o->target_index].relocs,
- o->reloc_count, sizeof (struct internal_reloc),
- xcoff_sort_relocs);
-
- irel = finfo.section_info[o->target_index].relocs;
- irelend = irel + o->reloc_count;
- erel = external_relocs;
- for (; irel < irelend; irel++, rel_hash++, erel += relsz)
- bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel);
-
- rel_size = relsz * o->reloc_count;
- if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0
- || bfd_bwrite ((PTR) external_relocs, rel_size, abfd) != rel_size)
- goto error_return;
- }
-
- if (external_relocs != NULL)
- {
- free (external_relocs);
- external_relocs = NULL;
- }
-
- /* Free up the section information. */
- if (finfo.section_info != NULL)
- {
- unsigned int i;
-
- for (i = 0; i < abfd->section_count; i++)
- {
- if (finfo.section_info[i].relocs != NULL)
- free (finfo.section_info[i].relocs);
- if (finfo.section_info[i].rel_hashes != NULL)
- free (finfo.section_info[i].rel_hashes);
- }
- free (finfo.section_info);
- finfo.section_info = NULL;
- }
-
- /* Write out the loader section contents. */
- BFD_ASSERT ((bfd_byte *) finfo.ldrel
- == (xcoff_hash_table (info)->loader_section->contents
- + xcoff_hash_table (info)->ldhdr.l_impoff));
- o = xcoff_hash_table (info)->loader_section;
- if (! bfd_set_section_contents (abfd, o->output_section, o->contents,
- (file_ptr) o->output_offset, o->_raw_size))
- goto error_return;
-
- /* Write out the magic sections. */
- o = xcoff_hash_table (info)->linkage_section;
- if (o->_raw_size > 0
- && ! bfd_set_section_contents (abfd, o->output_section, o->contents,
- (file_ptr) o->output_offset,
- o->_raw_size))
- goto error_return;
- o = xcoff_hash_table (info)->toc_section;
- if (o->_raw_size > 0
- && ! bfd_set_section_contents (abfd, o->output_section, o->contents,
- (file_ptr) o->output_offset,
- o->_raw_size))
- goto error_return;
- o = xcoff_hash_table (info)->descriptor_section;
- if (o->_raw_size > 0
- && ! bfd_set_section_contents (abfd, o->output_section, o->contents,
- (file_ptr) o->output_offset,
- o->_raw_size))
- goto error_return;
-
- /* Write out the string table. */
- pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0)
- goto error_return;
- H_PUT_32 (abfd,
- _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
- strbuf);
- amt = STRING_SIZE_SIZE;
- if (bfd_bwrite (strbuf, amt, abfd) != amt)
- goto error_return;
- if (! _bfd_stringtab_emit (abfd, finfo.strtab))
- goto error_return;
-
- _bfd_stringtab_free (finfo.strtab);
-
- /* Write out the debugging string table. */
- o = xcoff_hash_table (info)->debug_section;
- if (o != NULL)
- {
- struct bfd_strtab_hash *debug_strtab;
-
- debug_strtab = xcoff_hash_table (info)->debug_strtab;
- BFD_ASSERT (o->output_section->_raw_size - o->output_offset
- >= _bfd_stringtab_size (debug_strtab));
- pos = o->output_section->filepos + o->output_offset;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0)
- goto error_return;
- if (! _bfd_stringtab_emit (abfd, debug_strtab))
- goto error_return;
- }
-
- /* Setting bfd_get_symcount to 0 will cause write_object_contents to
- not try to write out the symbols. */
- bfd_get_symcount (abfd) = 0;
-
- return TRUE;
-
- error_return:
- if (finfo.strtab != NULL)
- _bfd_stringtab_free (finfo.strtab);
-
- if (finfo.section_info != NULL)
- {
- unsigned int i;
-
- for (i = 0; i < abfd->section_count; i++)
- {
- if (finfo.section_info[i].relocs != NULL)
- free (finfo.section_info[i].relocs);
- if (finfo.section_info[i].rel_hashes != NULL)
- free (finfo.section_info[i].rel_hashes);
- }
- free (finfo.section_info);
- }
-
- if (finfo.internal_syms != NULL)
- free (finfo.internal_syms);
- if (finfo.sym_indices != NULL)
- free (finfo.sym_indices);
- if (finfo.outsyms != NULL)
- free (finfo.outsyms);
- if (finfo.linenos != NULL)
- free (finfo.linenos);
- if (finfo.contents != NULL)
- free (finfo.contents);
- if (finfo.external_relocs != NULL)
- free (finfo.external_relocs);
- if (external_relocs != NULL)
- free (external_relocs);
- return FALSE;
-}
-
-/* Link an input file into the linker output file. This function
- handles all the sections and relocations of the input file at once. */
-
-static bfd_boolean
-xcoff_link_input_bfd (finfo, input_bfd)
- struct xcoff_final_link_info *finfo;
- bfd *input_bfd;
-{
- bfd *output_bfd;
- const char *strings;
- bfd_size_type syment_base;
- unsigned int n_tmask;
- unsigned int n_btshft;
- bfd_boolean copy, hash;
- bfd_size_type isymesz;
- bfd_size_type osymesz;
- bfd_size_type linesz;
- bfd_byte *esym;
- bfd_byte *esym_end;
- struct xcoff_link_hash_entry **sym_hash;
- struct internal_syment *isymp;
- asection **csectpp;
- unsigned long *debug_index;
- long *indexp;
- unsigned long output_index;
- bfd_byte *outsym;
- unsigned int incls;
- asection *oline;
- bfd_boolean keep_syms;
- asection *o;
-
- /* We can just skip DYNAMIC files, unless this is a static link. */
- if ((input_bfd->flags & DYNAMIC) != 0
- && ! finfo->info->static_link)
- return TRUE;
-
- /* Move all the symbols to the output file. */
-
- output_bfd = finfo->output_bfd;
- strings = NULL;
- syment_base = obj_raw_syment_count (output_bfd);
- isymesz = bfd_coff_symesz (input_bfd);
- osymesz = bfd_coff_symesz (output_bfd);
- linesz = bfd_coff_linesz (input_bfd);
- BFD_ASSERT (linesz == bfd_coff_linesz (output_bfd));
-
- n_tmask = coff_data (input_bfd)->local_n_tmask;
- n_btshft = coff_data (input_bfd)->local_n_btshft;
-
- /* Define macros so that ISFCN, et. al., macros work correctly. */
-#define N_TMASK n_tmask
-#define N_BTSHFT n_btshft
-
- copy = FALSE;
- if (! finfo->info->keep_memory)
- copy = TRUE;
- hash = TRUE;
- if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = FALSE;
-
- if (! _bfd_coff_get_external_symbols (input_bfd))
- return FALSE;
-
- esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
- esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
- sym_hash = obj_xcoff_sym_hashes (input_bfd);
- csectpp = xcoff_data (input_bfd)->csects;
- debug_index = xcoff_data (input_bfd)->debug_indices;
- isymp = finfo->internal_syms;
- indexp = finfo->sym_indices;
- output_index = syment_base;
- outsym = finfo->outsyms;
- incls = 0;
- oline = NULL;
-
- while (esym < esym_end)
- {
-
- struct internal_syment isym;
- union internal_auxent aux;
- int smtyp = 0;
- bfd_boolean skip;
- bfd_boolean require;
- int add;
-
- bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp);
-
- /* If this is a C_EXT or C_HIDEXT symbol, we need the csect
- information. */
- if (isymp->n_sclass == C_EXT || isymp->n_sclass == C_HIDEXT)
- {
- BFD_ASSERT (isymp->n_numaux > 0);
- bfd_coff_swap_aux_in (input_bfd,
- (PTR) (esym + isymesz * isymp->n_numaux),
- isymp->n_type, isymp->n_sclass,
- isymp->n_numaux - 1, isymp->n_numaux,
- (PTR) &aux);
-
- smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp);
- }
-
- /* Make a copy of *isymp so that the relocate_section function
- always sees the original values. This is more reliable than
- always recomputing the symbol value even if we are stripping
- the symbol. */
- isym = *isymp;
-
- /* If this symbol is in the .loader section, swap out the
- .loader symbol information. If this is an external symbol
- reference to a defined symbol, though, then wait until we get
- to the definition. */
- if (isym.n_sclass == C_EXT
- && *sym_hash != NULL
- && (*sym_hash)->ldsym != NULL
- && (smtyp != XTY_ER
- || (*sym_hash)->root.type == bfd_link_hash_undefined))
- {
- struct xcoff_link_hash_entry *h;
- struct internal_ldsym *ldsym;
-
- h = *sym_hash;
- ldsym = h->ldsym;
- if (isym.n_scnum > 0)
- {
- ldsym->l_scnum = (*csectpp)->output_section->target_index;
- ldsym->l_value = (isym.n_value
- + (*csectpp)->output_section->vma
- + (*csectpp)->output_offset
- - (*csectpp)->vma);
- }
- else
- {
- ldsym->l_scnum = isym.n_scnum;
- ldsym->l_value = isym.n_value;
- }
-
- ldsym->l_smtype = smtyp;
- if (((h->flags & XCOFF_DEF_REGULAR) == 0
- && (h->flags & XCOFF_DEF_DYNAMIC) != 0)
- || (h->flags & XCOFF_IMPORT) != 0)
- ldsym->l_smtype |= L_IMPORT;
- if (((h->flags & XCOFF_DEF_REGULAR) != 0
- && (h->flags & XCOFF_DEF_DYNAMIC) != 0)
- || (h->flags & XCOFF_EXPORT) != 0)
- ldsym->l_smtype |= L_EXPORT;
- if ((h->flags & XCOFF_ENTRY) != 0)
- ldsym->l_smtype |= L_ENTRY;
-
- ldsym->l_smclas = aux.x_csect.x_smclas;
-
- if (ldsym->l_ifile == (bfd_size_type) -1)
- ldsym->l_ifile = 0;
- else if (ldsym->l_ifile == 0)
- {
- if ((ldsym->l_smtype & L_IMPORT) == 0)
- ldsym->l_ifile = 0;
- else
- {
- bfd *impbfd;
-
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- impbfd = h->root.u.def.section->owner;
- else if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- impbfd = h->root.u.undef.abfd;
- else
- impbfd = NULL;
-
- if (impbfd == NULL)
- ldsym->l_ifile = 0;
- else
- {
- BFD_ASSERT (impbfd->xvec == finfo->output_bfd->xvec);
- ldsym->l_ifile = xcoff_data (impbfd)->import_file_id;
- }
- }
- }
-
- ldsym->l_parm = 0;
-
- BFD_ASSERT (h->ldindx >= 0);
- bfd_xcoff_swap_ldsym_out (finfo->output_bfd, ldsym,
- (finfo->ldsym
- + ((h->ldindx - 3)
- * bfd_xcoff_ldsymsz (finfo->output_bfd))));
- h->ldsym = NULL;
-
- /* Fill in snentry now that we know the target_index. */
- if ((h->flags & XCOFF_ENTRY) != 0
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- xcoff_data (output_bfd)->snentry =
- h->root.u.def.section->output_section->target_index;
- }
- }
-
- *indexp = -1;
-
- skip = FALSE;
- require = FALSE;
- add = 1 + isym.n_numaux;
-
- /* If we are skipping this csect, we want to skip this symbol. */
- if (*csectpp == NULL)
- skip = TRUE;
-
- /* If we garbage collected this csect, we want to skip this
- symbol. */
- if (! skip
- && xcoff_hash_table (finfo->info)->gc
- && ((*csectpp)->flags & SEC_MARK) == 0
- && *csectpp != bfd_abs_section_ptr)
- skip = TRUE;
-
- /* An XCOFF linker always skips C_STAT symbols. */
- if (! skip
- && isymp->n_sclass == C_STAT)
- skip = TRUE;
-
- /* We skip all but the first TOC anchor. */
- if (! skip
- && isymp->n_sclass == C_HIDEXT
- && aux.x_csect.x_smclas == XMC_TC0)
- {
- if (finfo->toc_symindx != -1)
- skip = TRUE;
- else
- {
- bfd_vma tocval, tocend;
- bfd *inp;
-
- tocval = ((*csectpp)->output_section->vma
- + (*csectpp)->output_offset
- + isym.n_value
- - (*csectpp)->vma);
-
- /* We want to find out if tocval is a good value to use
- as the TOC anchor--that is, whether we can access all
- of the TOC using a 16 bit offset from tocval. This
- test assumes that the TOC comes at the end of the
- output section, as it does in the default linker
- script. */
- tocend = ((*csectpp)->output_section->vma
- + (*csectpp)->output_section->_raw_size);
- for (inp = finfo->info->input_bfds;
- inp != NULL;
- inp = inp->link_next)
- {
-
- for (o = inp->sections; o != NULL; o = o->next)
- if (strcmp (o->name, ".tocbss") == 0)
- {
- bfd_vma new_toc_end;
- new_toc_end = (o->output_section->vma
- + o->output_offset
- + o->_cooked_size);
- if (new_toc_end > tocend)
- tocend = new_toc_end;
- }
-
- }
-
- if (tocval + 0x10000 < tocend)
- {
- (*_bfd_error_handler)
- (_("TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"),
- (unsigned long) (tocend - tocval));
- bfd_set_error (bfd_error_file_too_big);
- return FALSE;
- }
-
- if (tocval + 0x8000 < tocend)
- {
- bfd_vma tocadd;
-
- tocadd = tocend - (tocval + 0x8000);
- tocval += tocadd;
- isym.n_value += tocadd;
- }
-
- finfo->toc_symindx = output_index;
- xcoff_data (finfo->output_bfd)->toc = tocval;
- xcoff_data (finfo->output_bfd)->sntoc =
- (*csectpp)->output_section->target_index;
- require = TRUE;
-
- }
- }
-
- /* If we are stripping all symbols, we want to skip this one. */
- if (! skip
- && finfo->info->strip == strip_all)
- skip = TRUE;
-
- /* We can skip resolved external references. */
- if (! skip
- && isym.n_sclass == C_EXT
- && smtyp == XTY_ER
- && (*sym_hash)->root.type != bfd_link_hash_undefined)
- skip = TRUE;
-
- /* We can skip common symbols if they got defined somewhere
- else. */
- if (! skip
- && isym.n_sclass == C_EXT
- && smtyp == XTY_CM
- && ((*sym_hash)->root.type != bfd_link_hash_common
- || (*sym_hash)->root.u.c.p->section != *csectpp)
- && ((*sym_hash)->root.type != bfd_link_hash_defined
- || (*sym_hash)->root.u.def.section != *csectpp))
- skip = TRUE;
-
- /* Skip local symbols if we are discarding them. */
- if (! skip
- && finfo->info->discard == discard_all
- && isym.n_sclass != C_EXT
- && (isym.n_sclass != C_HIDEXT
- || smtyp != XTY_SD))
- skip = TRUE;
-
- /* If we stripping debugging symbols, and this is a debugging
- symbol, then skip it. */
- if (! skip
- && finfo->info->strip == strip_debugger
- && isym.n_scnum == N_DEBUG)
- skip = TRUE;
-
- /* If some symbols are stripped based on the name, work out the
- name and decide whether to skip this symbol. We don't handle
- this correctly for symbols whose names are in the .debug
- section; to get it right we would need a new bfd_strtab_hash
- function to return the string given the index. */
- if (! skip
- && (finfo->info->strip == strip_some
- || finfo->info->discard == discard_l)
- && (debug_index == NULL || *debug_index == (unsigned long) -1))
- {
- const char *name;
- char buf[SYMNMLEN + 1];
-
- name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
-
- if (name == NULL)
- return FALSE;
-
- if ((finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE,
- FALSE) == NULL))
- || (finfo->info->discard == discard_l
- && (isym.n_sclass != C_EXT
- && (isym.n_sclass != C_HIDEXT
- || smtyp != XTY_SD))
- && bfd_is_local_label_name (input_bfd, name)))
- skip = TRUE;
- }
-
- /* We can not skip the first TOC anchor. */
- if (skip
- && require
- && finfo->info->strip != strip_all)
- skip = FALSE;
-
- /* We now know whether we are to skip this symbol or not. */
- if (! skip)
- {
- /* Adjust the symbol in order to output it. */
-
- if (isym._n._n_n._n_zeroes == 0
- && isym._n._n_n._n_offset != 0)
- {
- /* This symbol has a long name. Enter it in the string
- table we are building. If *debug_index != -1, the
- name has already been entered in the .debug section. */
- if (debug_index != NULL && *debug_index != (unsigned long) -1)
- isym._n._n_n._n_offset = *debug_index;
- else
- {
- const char *name;
- bfd_size_type indx;
-
- name = _bfd_coff_internal_syment_name (input_bfd, &isym,
- (char *) NULL);
-
- if (name == NULL)
- return FALSE;
- indx = _bfd_stringtab_add (finfo->strtab, name, hash, copy);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
- }
- }
-
- if (isym.n_sclass != C_BSTAT
- && isym.n_sclass != C_ESTAT
- && isym.n_sclass != C_DECL
- && isym.n_scnum > 0)
- {
- isym.n_scnum = (*csectpp)->output_section->target_index;
- isym.n_value += ((*csectpp)->output_section->vma
- + (*csectpp)->output_offset
- - (*csectpp)->vma);
- }
-
- /* The value of a C_FILE symbol is the symbol index of the
- next C_FILE symbol. The value of the last C_FILE symbol
- is -1. We try to get this right, below, just before we
- write the symbols out, but in the general case we may
- have to write the symbol out twice. */
- if (isym.n_sclass == C_FILE)
- {
- if (finfo->last_file_index != -1
- && finfo->last_file.n_value != (bfd_vma) output_index)
- {
- /* We must correct the value of the last C_FILE entry. */
- finfo->last_file.n_value = output_index;
- if ((bfd_size_type) finfo->last_file_index >= syment_base)
- {
- /* The last C_FILE symbol is in this input file. */
- bfd_coff_swap_sym_out (output_bfd,
- (PTR) &finfo->last_file,
- (PTR) (finfo->outsyms
- + ((finfo->last_file_index
- - syment_base)
- * osymesz)));
- }
- else
- {
- /* We have already written out the last C_FILE
- symbol. We need to write it out again. We
- borrow *outsym temporarily. */
- file_ptr pos;
-
- bfd_coff_swap_sym_out (output_bfd,
- (PTR) &finfo->last_file,
- (PTR) outsym);
-
- 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;
- }
- }
-
- finfo->last_file_index = output_index;
- finfo->last_file = isym;
- }
-
- /* The value of a C_BINCL or C_EINCL symbol is a file offset
- into the line numbers. We update the symbol values when
- we handle the line numbers. */
- if (isym.n_sclass == C_BINCL
- || isym.n_sclass == C_EINCL)
- {
- isym.n_value = finfo->line_filepos;
- ++incls;
- }
-
- /* Output the symbol. */
-
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym);
-
- *indexp = output_index;
-
- if (isym.n_sclass == C_EXT)
- {
- long indx;
- struct xcoff_link_hash_entry *h;
-
- indx = ((esym - (bfd_byte *) obj_coff_external_syms (input_bfd))
- / isymesz);
- h = obj_xcoff_sym_hashes (input_bfd)[indx];
- BFD_ASSERT (h != NULL);
- h->indx = output_index;
- }
-
- /* If this is a symbol in the TOC which we may have merged
- (class XMC_TC), remember the symbol index of the TOC
- symbol. */
- if (isym.n_sclass == C_HIDEXT
- && aux.x_csect.x_smclas == XMC_TC
- && *sym_hash != NULL)
- {
- BFD_ASSERT (((*sym_hash)->flags & XCOFF_SET_TOC) == 0);
- BFD_ASSERT ((*sym_hash)->toc_section != NULL);
- (*sym_hash)->u.toc_indx = output_index;
- }
-
- output_index += add;
- outsym += add * osymesz;
- }
-
- esym += add * isymesz;
- isymp += add;
- csectpp += add;
- sym_hash += add;
- if (debug_index != NULL)
- debug_index += add;
- ++indexp;
- for (--add; add > 0; --add)
- *indexp++ = -1;
- }
-
- /* Fix up the aux entries and the C_BSTAT symbols. This must be
- done in a separate pass, because we don't know the correct symbol
- indices until we have already decided which symbols we are going
- to keep. */
-
- esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
- esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
- isymp = finfo->internal_syms;
- indexp = finfo->sym_indices;
- csectpp = xcoff_data (input_bfd)->csects;
- outsym = finfo->outsyms;
- while (esym < esym_end)
- {
- int add;
-
- add = 1 + isymp->n_numaux;
-
- if (*indexp < 0)
- esym += add * isymesz;
- else
- {
- int i;
-
- if (isymp->n_sclass == C_BSTAT)
- {
- struct internal_syment isym;
-
- bfd_vma indx;
-
- /* The value of a C_BSTAT symbol is the symbol table
- index of the containing csect. */
- bfd_coff_swap_sym_in (output_bfd, (PTR) outsym, (PTR) &isym);
- indx = isym.n_value;
- if (indx < obj_raw_syment_count (input_bfd))
- {
- long symindx;
-
- symindx = finfo->sym_indices[indx];
- if (symindx < 0)
- isym.n_value = 0;
- else
- isym.n_value = symindx;
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym,
- (PTR) outsym);
- }
- }
-
- esym += isymesz;
- outsym += osymesz;
-
- for (i = 0; i < isymp->n_numaux && esym < esym_end; i++)
- {
- union internal_auxent aux;
-
- bfd_coff_swap_aux_in (input_bfd, (PTR) esym, isymp->n_type,
- isymp->n_sclass, i, isymp->n_numaux,
- (PTR) &aux);
-
- if (isymp->n_sclass == C_FILE)
- {
- /* This is the file name (or some comment put in by
- the compiler). If it is long, we must put it in
- the string table. */
- if (aux.x_file.x_n.x_zeroes == 0
- && aux.x_file.x_n.x_offset != 0)
- {
- const char *filename;
- bfd_size_type indx;
-
- BFD_ASSERT (aux.x_file.x_n.x_offset
- >= STRING_SIZE_SIZE);
- if (strings == NULL)
- {
- strings = _bfd_coff_read_string_table (input_bfd);
- if (strings == NULL)
- return FALSE;
- }
- filename = strings + aux.x_file.x_n.x_offset;
- indx = _bfd_stringtab_add (finfo->strtab, filename,
- hash, copy);
- if (indx == (bfd_size_type) -1)
- return FALSE;
- aux.x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
- }
- }
- else if ((isymp->n_sclass == C_EXT
- || isymp->n_sclass == C_HIDEXT)
- && i + 1 == isymp->n_numaux)
- {
-
- /* We don't support type checking. I don't know if
- anybody does. */
- aux.x_csect.x_parmhash = 0;
- /* I don't think anybody uses these fields, but we'd
- better clobber them just in case. */
- aux.x_csect.x_stab = 0;
- aux.x_csect.x_snstab = 0;
-
- if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_LD)
- {
- unsigned long indx;
-
- indx = aux.x_csect.x_scnlen.l;
- if (indx < obj_raw_syment_count (input_bfd))
- {
- long symindx;
-
- symindx = finfo->sym_indices[indx];
- if (symindx < 0)
- {
- aux.x_csect.x_scnlen.l = 0;
- }
- else
- {
- aux.x_csect.x_scnlen.l = symindx;
- }
- }
- }
- }
- else if (isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
- {
- unsigned long indx;
-
- if (ISFCN (isymp->n_type)
- || ISTAG (isymp->n_sclass)
- || isymp->n_sclass == C_BLOCK
- || isymp->n_sclass == C_FCN)
- {
- indx = aux.x_sym.x_fcnary.x_fcn.x_endndx.l;
- if (indx > 0
- && indx < obj_raw_syment_count (input_bfd))
- {
- /* We look forward through the symbol for
- the index of the next symbol we are going
- to include. I don't know if this is
- entirely right. */
- while (finfo->sym_indices[indx] < 0
- && indx < obj_raw_syment_count (input_bfd))
- ++indx;
- if (indx >= obj_raw_syment_count (input_bfd))
- indx = output_index;
- else
- indx = finfo->sym_indices[indx];
- aux.x_sym.x_fcnary.x_fcn.x_endndx.l = indx;
-
- }
- }
-
- indx = aux.x_sym.x_tagndx.l;
- if (indx > 0 && indx < obj_raw_syment_count (input_bfd))
- {
- long symindx;
-
- symindx = finfo->sym_indices[indx];
- if (symindx < 0)
- aux.x_sym.x_tagndx.l = 0;
- else
- aux.x_sym.x_tagndx.l = symindx;
- }
-
- }
-
- /* Copy over the line numbers, unless we are stripping
- them. We do this on a symbol by symbol basis in
- order to more easily handle garbage collection. */
- if ((isymp->n_sclass == C_EXT
- || isymp->n_sclass == C_HIDEXT)
- && i == 0
- && isymp->n_numaux > 1
- && ISFCN (isymp->n_type)
- && aux.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0)
- {
- if (finfo->info->strip != strip_none
- && finfo->info->strip != strip_some)
- aux.x_sym.x_fcnary.x_fcn.x_lnnoptr = 0;
- else
- {
- asection *enclosing;
- unsigned int enc_count;
- bfd_signed_vma linoff;
- struct internal_lineno lin;
-
- o = *csectpp;
- enclosing = xcoff_section_data (abfd, o)->enclosing;
- enc_count = xcoff_section_data (abfd, o)->lineno_count;
- if (oline != enclosing)
- {
- file_ptr pos = enclosing->line_filepos;
- bfd_size_type amt = linesz * enc_count;
- if (bfd_seek (input_bfd, pos, SEEK_SET) != 0
- || (bfd_bread (finfo->linenos, amt, input_bfd)
- != amt))
- return FALSE;
- oline = enclosing;
- }
-
- linoff = (aux.x_sym.x_fcnary.x_fcn.x_lnnoptr
- - enclosing->line_filepos);
-
- bfd_coff_swap_lineno_in (input_bfd,
- (PTR) (finfo->linenos + linoff),
- (PTR) &lin);
- if (lin.l_lnno != 0
- || ((bfd_size_type) lin.l_addr.l_symndx
- != ((esym
- - isymesz
- - ((bfd_byte *)
- obj_coff_external_syms (input_bfd)))
- / isymesz)))
- aux.x_sym.x_fcnary.x_fcn.x_lnnoptr = 0;
- else
- {
- bfd_byte *linpend, *linp;
- bfd_vma offset;
- bfd_size_type count;
-
- lin.l_addr.l_symndx = *indexp;
- bfd_coff_swap_lineno_out (output_bfd, (PTR) &lin,
- (PTR) (finfo->linenos
- + linoff));
-
- linpend = (finfo->linenos
- + enc_count * linesz);
- offset = (o->output_section->vma
- + o->output_offset
- - o->vma);
- for (linp = finfo->linenos + linoff + linesz;
- linp < linpend;
- linp += linesz)
- {
- bfd_coff_swap_lineno_in (input_bfd, (PTR) linp,
- (PTR) &lin);
- if (lin.l_lnno == 0)
- break;
- lin.l_addr.l_paddr += offset;
- bfd_coff_swap_lineno_out (output_bfd,
- (PTR) &lin,
- (PTR) linp);
- }
-
- count = (linp - (finfo->linenos + linoff)) / linesz;
-
- aux.x_sym.x_fcnary.x_fcn.x_lnnoptr =
- (o->output_section->line_filepos
- + o->output_section->lineno_count * linesz);
-
- if (bfd_seek (output_bfd,
- aux.x_sym.x_fcnary.x_fcn.x_lnnoptr,
- SEEK_SET) != 0
- || (bfd_bwrite (finfo->linenos + linoff,
- linesz * count, output_bfd)
- != linesz * count))
- return FALSE;
-
- o->output_section->lineno_count += count;
-
- if (incls > 0)
- {
- struct internal_syment *iisp, *iispend;
- long *iindp;
- bfd_byte *oos;
- int iiadd;
-
- /* Update any C_BINCL or C_EINCL symbols
- that refer to a line number in the
- range we just output. */
- iisp = finfo->internal_syms;
- iispend = (iisp
- + obj_raw_syment_count (input_bfd));
- iindp = finfo->sym_indices;
- oos = finfo->outsyms;
- while (iisp < iispend)
- {
- if (*iindp >= 0
- && (iisp->n_sclass == C_BINCL
- || iisp->n_sclass == C_EINCL)
- && ((bfd_size_type) iisp->n_value
- >= (bfd_size_type)(enclosing->line_filepos + linoff))
- && ((bfd_size_type) iisp->n_value
- < (enclosing->line_filepos
- + enc_count * linesz)))
- {
- struct internal_syment iis;
-
- bfd_coff_swap_sym_in (output_bfd,
- (PTR) oos,
- (PTR) &iis);
- iis.n_value =
- (iisp->n_value
- - enclosing->line_filepos
- - linoff
- + aux.x_sym.x_fcnary.x_fcn.x_lnnoptr);
- bfd_coff_swap_sym_out (output_bfd,
- (PTR) &iis,
- (PTR) oos);
- --incls;
- }
-
- iiadd = 1 + iisp->n_numaux;
- if (*iindp >= 0)
- oos += iiadd * osymesz;
- iisp += iiadd;
- iindp += iiadd;
- }
- }
- }
- }
- }
-
- bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, isymp->n_type,
- isymp->n_sclass, i, isymp->n_numaux,
- (PTR) outsym);
- outsym += osymesz;
- esym += isymesz;
- }
- }
-
- indexp += add;
- isymp += add;
- csectpp += add;
- }
-
- /* If we swapped out a C_FILE symbol, guess that the next C_FILE
- symbol will be the first symbol in the next input file. In the
- normal case, this will save us from writing out the C_FILE symbol
- again. */
- if (finfo->last_file_index != -1
- && (bfd_size_type) finfo->last_file_index >= syment_base)
- {
- finfo->last_file.n_value = output_index;
- bfd_coff_swap_sym_out (output_bfd, (PTR) &finfo->last_file,
- (PTR) (finfo->outsyms
- + ((finfo->last_file_index - syment_base)
- * osymesz)));
- }
-
- /* Write the modified symbols to the output file. */
- if (outsym > finfo->outsyms)
- {
- file_ptr pos = obj_sym_filepos (output_bfd) + syment_base * osymesz;
- bfd_size_type amt = outsym - finfo->outsyms;
- if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
- return FALSE;
-
- BFD_ASSERT ((obj_raw_syment_count (output_bfd)
- + (outsym - finfo->outsyms) / osymesz)
- == output_index);
-
- obj_raw_syment_count (output_bfd) = output_index;
- }
-
- /* Don't let the linker relocation routines discard the symbols. */
- keep_syms = obj_coff_keep_syms (input_bfd);
- obj_coff_keep_syms (input_bfd) = TRUE;
-
- /* Relocate the contents of each section. */
- for (o = input_bfd->sections; o != NULL; o = o->next)
- {
-
- bfd_byte *contents;
-
- if (! o->linker_mark)
- {
- /* This section was omitted from the link. */
- continue;
- }
-
- if ((o->flags & SEC_HAS_CONTENTS) == 0
- || o->_raw_size == 0
- || (o->flags & SEC_IN_MEMORY) != 0)
- continue;
-
- /* We have set filepos correctly for the sections we created to
- represent csects, so bfd_get_section_contents should work. */
- if (coff_section_data (input_bfd, o) != NULL
- && coff_section_data (input_bfd, o)->contents != NULL)
- contents = coff_section_data (input_bfd, o)->contents;
- else {
- if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
- (file_ptr) 0, o->_raw_size))
- return FALSE;
- contents = finfo->contents;
- }
-
- if ((o->flags & SEC_RELOC) != 0)
- {
- int target_index;
- struct internal_reloc *internal_relocs;
- struct internal_reloc *irel;
- bfd_vma offset;
- struct internal_reloc *irelend;
- struct xcoff_link_hash_entry **rel_hash;
- long r_symndx;
-
- /* Read in the relocs. */
- target_index = o->output_section->target_index;
- internal_relocs = (xcoff_read_internal_relocs
- (input_bfd, o, FALSE, finfo->external_relocs,
- TRUE,
- (finfo->section_info[target_index].relocs
- + o->output_section->reloc_count)));
- if (internal_relocs == NULL)
- return FALSE;
-
- /* Call processor specific code to relocate the section
- contents. */
- if (! bfd_coff_relocate_section (output_bfd, finfo->info,
- input_bfd, o,
- contents,
- internal_relocs,
- finfo->internal_syms,
- xcoff_data (input_bfd)->csects))
- return FALSE;
-
- offset = o->output_section->vma + o->output_offset - o->vma;
- irel = internal_relocs;
- irelend = irel + o->reloc_count;
- rel_hash = (finfo->section_info[target_index].rel_hashes
- + o->output_section->reloc_count);
- for (; irel < irelend; irel++, rel_hash++)
- {
- struct xcoff_link_hash_entry *h = NULL;
- struct internal_ldrel ldrel;
- bfd_boolean quiet;
-
- *rel_hash = NULL;
-
- /* Adjust the reloc address and symbol index. */
-
- irel->r_vaddr += offset;
-
- r_symndx = irel->r_symndx;
-
- if (r_symndx == -1)
- h = NULL;
- else
- h = obj_xcoff_sym_hashes (input_bfd)[r_symndx];
-
- if (r_symndx != -1 && finfo->info->strip != strip_all)
- {
- if (h != NULL
- && h->smclas != XMC_TD
- && (irel->r_type == R_TOC
- || irel->r_type == R_GL
- || irel->r_type == R_TCL
- || irel->r_type == R_TRL
- || irel->r_type == R_TRLA))
- {
- /* This is a TOC relative reloc with a symbol
- attached. The symbol should be the one which
- this reloc is for. We want to make this
- reloc against the TOC address of the symbol,
- not the symbol itself. */
- BFD_ASSERT (h->toc_section != NULL);
- BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0);
- if (h->u.toc_indx != -1)
- irel->r_symndx = h->u.toc_indx;
- else
- {
- struct xcoff_toc_rel_hash *n;
- struct xcoff_link_section_info *si;
- bfd_size_type amt;
-
- amt = sizeof (struct xcoff_toc_rel_hash);
- n = ((struct xcoff_toc_rel_hash *)
- bfd_alloc (finfo->output_bfd, amt));
- if (n == NULL)
- return FALSE;
- si = finfo->section_info + target_index;
- n->next = si->toc_rel_hashes;
- n->h = h;
- n->rel = irel;
- si->toc_rel_hashes = n;
- }
- }
- else if (h != NULL)
- {
- /* This is a global symbol. */
- if (h->indx >= 0)
- irel->r_symndx = h->indx;
- else
- {
- /* This symbol is being written at the end
- of the file, and we do not yet know the
- symbol index. We save the pointer to the
- hash table entry in the rel_hash list.
- We set the indx field to -2 to indicate
- that this symbol must not be stripped. */
- *rel_hash = h;
- h->indx = -2;
- }
- }
- else
- {
- long indx;
-
- indx = finfo->sym_indices[r_symndx];
-
- if (indx == -1)
- {
- struct internal_syment *is;
-
- /* Relocations against a TC0 TOC anchor are
- automatically transformed to be against
- the TOC anchor in the output file. */
- is = finfo->internal_syms + r_symndx;
- if (is->n_sclass == C_HIDEXT
- && is->n_numaux > 0)
- {
- PTR auxptr;
- union internal_auxent aux;
-
- auxptr = ((PTR)
- (((bfd_byte *)
- obj_coff_external_syms (input_bfd))
- + ((r_symndx + is->n_numaux)
- * isymesz)));
- bfd_coff_swap_aux_in (input_bfd, auxptr,
- is->n_type, is->n_sclass,
- is->n_numaux - 1,
- is->n_numaux,
- (PTR) &aux);
- if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_SD
- && aux.x_csect.x_smclas == XMC_TC0)
- indx = finfo->toc_symindx;
- }
- }
-
- if (indx != -1)
- irel->r_symndx = indx;
- else
- {
-
- struct internal_syment *is;
-
- const char *name;
- char buf[SYMNMLEN + 1];
-
- /* This reloc is against a symbol we are
- stripping. It would be possible to handle
- this case, but I don't think it's worth it. */
- is = finfo->internal_syms + r_symndx;
-
- name = (_bfd_coff_internal_syment_name
- (input_bfd, is, buf));
-
- if (name == NULL)
- return FALSE;
-
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, name, input_bfd, o,
- irel->r_vaddr)))
- return FALSE;
- }
- }
- }
-
- quiet = FALSE;
- switch (irel->r_type)
- {
- default:
- if (h == NULL
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak
- || h->root.type == bfd_link_hash_common)
- break;
- /* Fall through. */
- case R_POS:
- case R_NEG:
- case R_RL:
- case R_RLA:
- /* This reloc needs to be copied into the .loader
- section. */
- ldrel.l_vaddr = irel->r_vaddr;
- if (r_symndx == -1)
- ldrel.l_symndx = -(bfd_size_type ) 1;
- else if (h == NULL
- || (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak
- || h->root.type == bfd_link_hash_common))
- {
- asection *sec;
-
- if (h == NULL)
- sec = xcoff_data (input_bfd)->csects[r_symndx];
- else if (h->root.type == bfd_link_hash_common)
- sec = h->root.u.c.p->section;
- else
- sec = h->root.u.def.section;
- sec = sec->output_section;
-
- if (strcmp (sec->name, ".text") == 0)
- ldrel.l_symndx = 0;
- else if (strcmp (sec->name, ".data") == 0)
- ldrel.l_symndx = 1;
- else if (strcmp (sec->name, ".bss") == 0)
- ldrel.l_symndx = 2;
- else
- {
- (*_bfd_error_handler)
- (_("%s: loader reloc in unrecognized section `%s'"),
- bfd_archive_filename (input_bfd),
- sec->name);
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
- }
- else
- {
- if (! finfo->info->relocatable
- && (h->flags & XCOFF_DEF_DYNAMIC) == 0
- && (h->flags & XCOFF_IMPORT) == 0)
- {
- /* We already called the undefined_symbol
- callback for this relocation, in
- _bfd_ppc_xcoff_relocate_section. Don't
- issue any more warnings. */
- quiet = TRUE;
- }
- if (h->ldindx < 0 && ! quiet)
- {
- (*_bfd_error_handler)
- (_("%s: `%s' in loader reloc but not loader sym"),
- bfd_archive_filename (input_bfd),
- h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- ldrel.l_symndx = h->ldindx;
- }
- ldrel.l_rtype = (irel->r_size << 8) | irel->r_type;
- ldrel.l_rsecnm = o->output_section->target_index;
- if (xcoff_hash_table (finfo->info)->textro
- && strcmp (o->output_section->name, ".text") == 0
- && ! quiet)
- {
- (*_bfd_error_handler)
- (_("%s: loader reloc in read-only section %s"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (finfo->output_bfd,
- o->output_section));
- bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
- }
- bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel,
- finfo->ldrel);
-
- finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
- break;
-
- case R_TOC:
- case R_GL:
- case R_TCL:
- case R_TRL:
- case R_TRLA:
- /* We should never need a .loader reloc for a TOC
- relative reloc. */
- break;
- }
- }
-
- o->output_section->reloc_count += o->reloc_count;
- }
-
- /* Write out the modified section contents. */
- if (! bfd_set_section_contents (output_bfd, o->output_section,
- contents, (file_ptr) o->output_offset,
- (o->_cooked_size != 0
- ? o->_cooked_size
- : o->_raw_size)))
- return FALSE;
- }
-
- obj_coff_keep_syms (input_bfd) = keep_syms;
-
- if (! finfo->info->keep_memory)
- {
- if (! _bfd_coff_free_symbols (input_bfd))
- return FALSE;
- }
-
- return TRUE;
-}
-
-#undef N_TMASK
-#undef N_BTSHFT
-
-/* Write out a non-XCOFF global symbol. */
-
-
-static bfd_boolean
-xcoff_write_global_symbol (h, inf)
- struct xcoff_link_hash_entry *h;
- PTR inf;
-{
- struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) inf;
- bfd *output_bfd;
- bfd_byte *outsym;
- struct internal_syment isym;
- union internal_auxent aux;
- bfd_boolean result;
- file_ptr pos;
- bfd_size_type amt;
-
- output_bfd = finfo->output_bfd;
- outsym = finfo->outsyms;
-
- if (h->root.type == bfd_link_hash_warning)
- {
- h = (struct xcoff_link_hash_entry *) h->root.u.i.link;
- if (h->root.type == bfd_link_hash_new)
- return TRUE;
- }
-
- /* If this symbol was garbage collected, just skip it. */
- if (xcoff_hash_table (finfo->info)->gc
- && (h->flags & XCOFF_MARK) == 0)
- return TRUE;
-
- /* If we need a .loader section entry, write it out. */
- if (h->ldsym != NULL)
- {
- struct internal_ldsym *ldsym;
- bfd *impbfd;
-
- ldsym = h->ldsym;
-
- if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- {
-
- ldsym->l_value = 0;
- ldsym->l_scnum = N_UNDEF;
- ldsym->l_smtype = XTY_ER;
- impbfd = h->root.u.undef.abfd;
-
- }
- else if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
-
- asection *sec;
-
- sec = h->root.u.def.section;
- ldsym->l_value = (sec->output_section->vma
- + sec->output_offset
- + h->root.u.def.value);
- ldsym->l_scnum = sec->output_section->target_index;
- ldsym->l_smtype = XTY_SD;
- impbfd = sec->owner;
-
- }
- else
- abort ();
-
- if (((h->flags & XCOFF_DEF_REGULAR) == 0
- && (h->flags & XCOFF_DEF_DYNAMIC) != 0)
- || (h->flags & XCOFF_IMPORT) != 0)
- {
- /* Clear l_smtype
- Import symbols are defined so the check above will make
- the l_smtype XTY_SD. But this is not correct, it should
- be cleared. */
- ldsym->l_smtype |= L_IMPORT;
- }
-
- if (((h->flags & XCOFF_DEF_REGULAR) != 0
- && (h->flags & XCOFF_DEF_DYNAMIC) != 0)
- || (h->flags & XCOFF_EXPORT) != 0)
- {
- ldsym->l_smtype |= L_EXPORT;
- }
-
- if ((h->flags & XCOFF_ENTRY) != 0)
- {
- ldsym->l_smtype |= L_ENTRY;
- }
-
- if ((h->flags & XCOFF_RTINIT) != 0)
- {
- ldsym->l_smtype = XTY_SD;
- }
-
- ldsym->l_smclas = h->smclas;
-
- if (ldsym->l_smtype & L_IMPORT)
- {
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->root.u.def.value != 0))
- {
- ldsym->l_smclas = XMC_XO;
- }
- else if ((h->flags & (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) ==
- (XCOFF_SYSCALL32 | XCOFF_SYSCALL64))
- {
- ldsym->l_smclas = XMC_SV3264;
- }
- else if (h->flags & XCOFF_SYSCALL32)
- {
- ldsym->l_smclas = XMC_SV;
- }
- else if (h->flags & XCOFF_SYSCALL64)
- {
- ldsym->l_smclas = XMC_SV64;
- }
- }
-
- if (ldsym->l_ifile == -(bfd_size_type) 1)
- {
- ldsym->l_ifile = 0;
- }
- else if (ldsym->l_ifile == 0)
- {
- if ((ldsym->l_smtype & L_IMPORT) == 0)
- {
- ldsym->l_ifile = 0;
- }
- else if (impbfd == NULL)
- {
- ldsym->l_ifile = 0;
- }
- else
- {
- BFD_ASSERT (impbfd->xvec == output_bfd->xvec);
- ldsym->l_ifile = xcoff_data (impbfd)->import_file_id;
- }
- }
-
- ldsym->l_parm = 0;
-
- BFD_ASSERT (h->ldindx >= 0);
-
- bfd_xcoff_swap_ldsym_out (output_bfd, ldsym,
- (finfo->ldsym +
- (h->ldindx - 3)
- * bfd_xcoff_ldsymsz(finfo->output_bfd)));
- h->ldsym = NULL;
- }
-
- /* If this symbol needs global linkage code, write it out. */
- if (h->root.type == bfd_link_hash_defined
- && (h->root.u.def.section
- == xcoff_hash_table (finfo->info)->linkage_section))
- {
- bfd_byte *p;
- bfd_vma tocoff;
- unsigned int i;
-
- p = h->root.u.def.section->contents + h->root.u.def.value;
-
- /* The first instruction in the global linkage code loads a
- specific TOC element. */
- tocoff = (h->descriptor->toc_section->output_section->vma
- + h->descriptor->toc_section->output_offset
- - xcoff_data (output_bfd)->toc);
-
- if ((h->descriptor->flags & XCOFF_SET_TOC) != 0)
- {
- tocoff += h->descriptor->u.toc_offset;
- }
-
-
- /* The first instruction in the glink code needs to be
- cooked to to hold the correct offset in the toc. The
- rest are just output raw. */
- bfd_put_32 (output_bfd,
- bfd_xcoff_glink_code(output_bfd, 0) | (tocoff & 0xffff), p);
-
- /* Start with i == 1 to get past the first instruction done above
- The /4 is because the glink code is in bytes and we are going
- 4 at a pop. */
- for (i = 1; i < bfd_xcoff_glink_code_size(output_bfd) / 4; i++)
- {
- bfd_put_32 (output_bfd,
- (bfd_vma) bfd_xcoff_glink_code(output_bfd, i),
- &p[4 * i]);
- }
- }
-
- /* If we created a TOC entry for this symbol, write out the required
- relocs. */
- if ((h->flags & XCOFF_SET_TOC) != 0)
- {
- asection *tocsec;
- asection *osec;
- int oindx;
- struct internal_reloc *irel;
- struct internal_ldrel ldrel;
- struct internal_syment irsym;
- union internal_auxent iraux;
-
- tocsec = h->toc_section;
- osec = tocsec->output_section;
- oindx = osec->target_index;
- irel = finfo->section_info[oindx].relocs + osec->reloc_count;
- irel->r_vaddr = (osec->vma
- + tocsec->output_offset
- + h->u.toc_offset);
-
-
- if (h->indx >= 0)
- {
- irel->r_symndx = h->indx;
- }
- else
- {
- h->indx = -2;
- irel->r_symndx = obj_raw_syment_count (output_bfd);
- }
-
- BFD_ASSERT (h->ldindx >= 0);
-
- /* Initialize the aux union here instead of closer to when it is
- written out below because the length of the csect depends on
- whether the output is 32 or 64 bit. */
- memset (&iraux, 0, sizeof iraux);
- iraux.x_csect.x_smtyp = XTY_SD;
- /* iraux.x_csect.x_scnlen.l = 4 or 8, see below */
- iraux.x_csect.x_smclas = XMC_TC;
-
- /* 32 bit uses a 32 bit R_POS to do the relocations
- 64 bit uses a 64 bit R_POS to do the relocations
-
- Also needs to change the csect size : 4 for 32 bit, 8 for 64 bit
-
- Which one is determined by the backend. */
- if (bfd_xcoff_is_xcoff64 (output_bfd))
- {
- irel->r_size = 63;
- iraux.x_csect.x_scnlen.l = 8;
- }
- else if (bfd_xcoff_is_xcoff32 (output_bfd))
- {
- irel->r_size = 31;
- iraux.x_csect.x_scnlen.l = 4;
- }
- else
- {
- return FALSE;
- }
- irel->r_type = R_POS;
- finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
- ++osec->reloc_count;
-
- ldrel.l_vaddr = irel->r_vaddr;
- ldrel.l_symndx = h->ldindx;
- ldrel.l_rtype = (irel->r_size << 8) | R_POS;
- ldrel.l_rsecnm = oindx;
- bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
-
- /* We need to emit a symbol to define a csect which holds
- the reloc. */
- if (finfo->info->strip != strip_all)
- {
-
- result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab,
- &irsym, h->root.root.string);
- if (!result)
- return FALSE;
-
- irsym.n_value = irel->r_vaddr;
- irsym.n_scnum = osec->target_index;
- irsym.n_sclass = C_HIDEXT;
- irsym.n_type = T_NULL;
- irsym.n_numaux = 1;
-
- bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym);
- outsym += bfd_coff_symesz (output_bfd);
-
- /* note : iraux is initialized above */
- bfd_coff_swap_aux_out (output_bfd, (PTR) &iraux, T_NULL, C_HIDEXT,
- 0, 1, (PTR) outsym);
- outsym += bfd_coff_auxesz (output_bfd);
-
- if (h->indx >= 0)
- {
- /* We aren't going to write out the symbols below, so we
- need to write them out now. */
- pos = obj_sym_filepos (output_bfd);
- pos += (obj_raw_syment_count (output_bfd)
- * bfd_coff_symesz (output_bfd));
- amt = outsym - finfo->outsyms;
- if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
- return FALSE;
- obj_raw_syment_count (output_bfd) +=
- (outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd);
-
- outsym = finfo->outsyms;
- }
- }
- }
-
- /* If this symbol is a specially defined function descriptor, write
- it out. The first word is the address of the function code
- itself, the second word is the address of the TOC, and the third
- word is zero.
-
- 32 bit vs 64 bit
- The addresses for the 32 bit will take 4 bytes and the addresses
- for 64 bit will take 8 bytes. Similar for the relocs. This type
- of logic was also done above to create a TOC entry in
- xcoff_write_global_symbol. */
- if ((h->flags & XCOFF_DESCRIPTOR) != 0
- && h->root.type == bfd_link_hash_defined
- && (h->root.u.def.section
- == xcoff_hash_table (finfo->info)->descriptor_section))
- {
- asection *sec;
- asection *osec;
- int oindx;
- bfd_byte *p;
- struct xcoff_link_hash_entry *hentry;
- asection *esec;
- struct internal_reloc *irel;
- struct internal_ldrel ldrel;
- asection *tsec;
- unsigned int reloc_size, byte_size;
-
- if (bfd_xcoff_is_xcoff64 (output_bfd))
- {
- reloc_size = 63;
- byte_size = 8;
- }
- else if (bfd_xcoff_is_xcoff32 (output_bfd))
- {
- reloc_size = 31;
- byte_size = 4;
- }
- else
- {
- return FALSE;
- }
-
- sec = h->root.u.def.section;
- osec = sec->output_section;
- oindx = osec->target_index;
- p = sec->contents + h->root.u.def.value;
-
- hentry = h->descriptor;
- BFD_ASSERT (hentry != NULL
- && (hentry->root.type == bfd_link_hash_defined
- || hentry->root.type == bfd_link_hash_defweak));
- esec = hentry->root.u.def.section;
-
- irel = finfo->section_info[oindx].relocs + osec->reloc_count;
- irel->r_vaddr = (osec->vma
- + sec->output_offset
- + h->root.u.def.value);
- irel->r_symndx = esec->output_section->target_index;
- irel->r_type = R_POS;
- irel->r_size = reloc_size;
- finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
- ++osec->reloc_count;
-
- ldrel.l_vaddr = irel->r_vaddr;
- if (strcmp (esec->output_section->name, ".text") == 0)
- ldrel.l_symndx = 0;
- else if (strcmp (esec->output_section->name, ".data") == 0)
- ldrel.l_symndx = 1;
- else if (strcmp (esec->output_section->name, ".bss") == 0)
- ldrel.l_symndx = 2;
- else
- {
- (*_bfd_error_handler)
- (_("%s: loader reloc in unrecognized section `%s'"),
- bfd_get_filename (output_bfd),
- esec->output_section->name);
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
- ldrel.l_rtype = (reloc_size << 8) | R_POS;
- ldrel.l_rsecnm = oindx;
- bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
-
- /* There are three items to write out,
- the address of the code
- the address of the toc anchor
- the environment pointer.
- We are ignoring the environment pointer. So set it to zero. */
- if (bfd_xcoff_is_xcoff64 (output_bfd))
- {
- bfd_put_64 (output_bfd,
- (esec->output_section->vma + esec->output_offset
- + hentry->root.u.def.value),
- p);
- bfd_put_64 (output_bfd, xcoff_data (output_bfd)->toc, p + 8);
- bfd_put_64 (output_bfd, (bfd_vma) 0, p + 16);
- }
- else
- {
- /* 32 bit backend
- This logic was already called above so the error case where
- the backend is neither has already been checked. */
- bfd_put_32 (output_bfd,
- (esec->output_section->vma + esec->output_offset
- + hentry->root.u.def.value),
- p);
- bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4);
- bfd_put_32 (output_bfd, (bfd_vma) 0, p + 8);
- }
-
- tsec = coff_section_from_bfd_index (output_bfd,
- xcoff_data (output_bfd)->sntoc);
-
- ++irel;
- irel->r_vaddr = (osec->vma
- + sec->output_offset
- + h->root.u.def.value
- + byte_size);
- irel->r_symndx = tsec->output_section->target_index;
- irel->r_type = R_POS;
- irel->r_size = reloc_size;
- finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
- ++osec->reloc_count;
-
- ldrel.l_vaddr = irel->r_vaddr;
- if (strcmp (tsec->output_section->name, ".text") == 0)
- ldrel.l_symndx = 0;
- else if (strcmp (tsec->output_section->name, ".data") == 0)
- ldrel.l_symndx = 1;
- else if (strcmp (tsec->output_section->name, ".bss") == 0)
- ldrel.l_symndx = 2;
- else
- {
- (*_bfd_error_handler)
- (_("%s: loader reloc in unrecognized section `%s'"),
- bfd_get_filename (output_bfd),
- tsec->output_section->name);
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
- ldrel.l_rtype = (reloc_size << 8) | R_POS;
- ldrel.l_rsecnm = oindx;
- bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
- }
-
- if (h->indx >= 0 || finfo->info->strip == strip_all)
- {
- BFD_ASSERT (outsym == finfo->outsyms);
- return TRUE;
- }
-
- if (h->indx != -2
- && (finfo->info->strip == strip_all
- || (finfo->info->strip == strip_some
- && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
- FALSE, FALSE) == NULL)))
- {
- BFD_ASSERT (outsym == finfo->outsyms);
- return TRUE;
- }
-
- if (h->indx != -2
- && (h->flags & (XCOFF_REF_REGULAR | XCOFF_DEF_REGULAR)) == 0)
- {
- BFD_ASSERT (outsym == finfo->outsyms);
- return TRUE;
- }
-
- memset (&aux, 0, sizeof aux);
-
- h->indx = obj_raw_syment_count (output_bfd);
-
- result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, &isym,
- h->root.root.string);
- if (!result)
- return FALSE;
-
- if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- {
- isym.n_value = 0;
- isym.n_scnum = N_UNDEF;
- isym.n_sclass = C_EXT;
- aux.x_csect.x_smtyp = XTY_ER;
- }
- else if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->smclas == XMC_XO)
- {
- BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section));
- isym.n_value = h->root.u.def.value;
- isym.n_scnum = N_UNDEF;
- isym.n_sclass = C_EXT;
- aux.x_csect.x_smtyp = XTY_ER;
- }
- else if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- struct xcoff_link_size_list *l;
-
- isym.n_value = (h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset
- + h->root.u.def.value);
- if (bfd_is_abs_section (h->root.u.def.section->output_section))
- isym.n_scnum = N_ABS;
- else
- isym.n_scnum = h->root.u.def.section->output_section->target_index;
- isym.n_sclass = C_HIDEXT;
- aux.x_csect.x_smtyp = XTY_SD;
-
- if ((h->flags & XCOFF_HAS_SIZE) != 0)
- {
- for (l = xcoff_hash_table (finfo->info)->size_list;
- l != NULL;
- l = l->next)
- {
- if (l->h == h)
- {
- aux.x_csect.x_scnlen.l = l->size;
- break;
- }
- }
- }
- }
- else if (h->root.type == bfd_link_hash_common)
- {
- isym.n_value = (h->root.u.c.p->section->output_section->vma
- + h->root.u.c.p->section->output_offset);
- isym.n_scnum = h->root.u.c.p->section->output_section->target_index;
- isym.n_sclass = C_EXT;
- aux.x_csect.x_smtyp = XTY_CM;
- aux.x_csect.x_scnlen.l = h->root.u.c.size;
- }
- else
- abort ();
-
- isym.n_type = T_NULL;
- isym.n_numaux = 1;
-
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym);
- outsym += bfd_coff_symesz (output_bfd);
-
- aux.x_csect.x_smclas = h->smclas;
- bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, isym.n_sclass, 0, 1,
- (PTR) outsym);
- outsym += bfd_coff_auxesz (output_bfd);
-
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->smclas != XMC_XO)
- {
- /* We just output an SD symbol. Now output an LD symbol. */
-
- h->indx += 2;
-
- isym.n_sclass = C_EXT;
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym);
- outsym += bfd_coff_symesz (output_bfd);
-
- aux.x_csect.x_smtyp = XTY_LD;
- aux.x_csect.x_scnlen.l = obj_raw_syment_count (output_bfd);
- bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, C_EXT, 0, 1,
- (PTR) outsym);
- outsym += bfd_coff_auxesz (output_bfd);
- }
-
- pos = obj_sym_filepos (output_bfd);
- pos += obj_raw_syment_count (output_bfd) * bfd_coff_symesz (output_bfd);
- amt = outsym - finfo->outsyms;
- if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
- return FALSE;
- obj_raw_syment_count (output_bfd) +=
- (outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd);
-
- return TRUE;
-}
-
-/* Handle a link order which is supposed to generate a reloc. */
-
-static bfd_boolean
-xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
- bfd *output_bfd;
- struct xcoff_final_link_info *finfo;
- asection *output_section;
- struct bfd_link_order *link_order;
-{
- reloc_howto_type *howto;
- struct xcoff_link_hash_entry *h;
- asection *hsec;
- bfd_vma hval;
- bfd_vma addend;
- struct internal_reloc *irel;
- struct xcoff_link_hash_entry **rel_hash_ptr;
- struct internal_ldrel ldrel;
-
- if (link_order->type == bfd_section_reloc_link_order)
- {
- /* We need to somehow locate a symbol in the right section. The
- symbol must either have a value of zero, or we must adjust
- the addend by the value of the symbol. FIXME: Write this
- when we need it. The old linker couldn't handle this anyhow. */
- abort ();
- }
-
- howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
- if (howto == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- h = ((struct xcoff_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, finfo->info,
- link_order->u.reloc.p->u.name,
- FALSE, FALSE, TRUE));
- if (h == NULL)
- {
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, link_order->u.reloc.p->u.name, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- return FALSE;
- return TRUE;
- }
-
- if (h->root.type == bfd_link_hash_common)
- {
- hsec = h->root.u.c.p->section;
- hval = 0;
- }
- else if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- hsec = h->root.u.def.section;
- hval = h->root.u.def.value;
- }
- else
- {
- hsec = NULL;
- hval = 0;
- }
-
- addend = link_order->u.reloc.p->addend;
- if (hsec != NULL)
- addend += (hsec->output_section->vma
- + hsec->output_offset
- + hval);
-
- if (addend != 0)
- {
- bfd_size_type size;
- bfd_byte *buf;
- bfd_reloc_status_type rstat;
- bfd_boolean ok;
-
- size = bfd_get_reloc_size (howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
- if (buf == NULL)
- return FALSE;
-
- rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
- switch (rstat)
- {
- case bfd_reloc_ok:
- break;
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- if (! ((*finfo->info->callbacks->reloc_overflow)
- (finfo->info, link_order->u.reloc.p->u.name,
- howto->name, addend, (bfd *) NULL, (asection *) NULL,
- (bfd_vma) 0)))
- {
- free (buf);
- return FALSE;
- }
- break;
- }
- ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
- (file_ptr) link_order->offset, size);
- free (buf);
- if (! ok)
- return FALSE;
- }
-
- /* Store the reloc information in the right place. It will get
- swapped and written out at the end of the final_link routine. */
-
- irel = (finfo->section_info[output_section->target_index].relocs
- + output_section->reloc_count);
- rel_hash_ptr = (finfo->section_info[output_section->target_index].rel_hashes
- + output_section->reloc_count);
-
- memset (irel, 0, sizeof (struct internal_reloc));
- *rel_hash_ptr = NULL;
-
- irel->r_vaddr = output_section->vma + link_order->offset;
-
- if (h->indx >= 0)
- irel->r_symndx = h->indx;
- else
- {
- /* Set the index to -2 to force this symbol to get written out. */
- h->indx = -2;
- *rel_hash_ptr = h;
- irel->r_symndx = 0;
- }
-
- irel->r_type = howto->type;
- irel->r_size = howto->bitsize - 1;
- if (howto->complain_on_overflow == complain_overflow_signed)
- irel->r_size |= 0x80;
-
- ++output_section->reloc_count;
-
- /* Now output the reloc to the .loader section. */
-
- ldrel.l_vaddr = irel->r_vaddr;
-
- if (hsec != NULL)
- {
- const char *secname;
-
- secname = hsec->output_section->name;
-
- if (strcmp (secname, ".text") == 0)
- ldrel.l_symndx = 0;
- else if (strcmp (secname, ".data") == 0)
- ldrel.l_symndx = 1;
- else if (strcmp (secname, ".bss") == 0)
- ldrel.l_symndx = 2;
- else
- {
- (*_bfd_error_handler)
- (_("%s: loader reloc in unrecognized section `%s'"),
- bfd_get_filename (output_bfd), secname);
- bfd_set_error (bfd_error_nonrepresentable_section);
- return FALSE;
- }
- }
- else
- {
- if (h->ldindx < 0)
- {
- (*_bfd_error_handler)
- (_("%s: `%s' in loader reloc but not loader sym"),
- bfd_get_filename (output_bfd),
- h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- ldrel.l_symndx = h->ldindx;
- }
-
- ldrel.l_rtype = (irel->r_size << 8) | irel->r_type;
- ldrel.l_rsecnm = output_section->target_index;
- bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
-
- return TRUE;
-}
-
-/* Sort relocs by VMA. This is called via qsort. */
-
-static int
-xcoff_sort_relocs (p1, p2)
- const PTR p1;
- const PTR p2;
-{
- const struct internal_reloc *r1 = (const struct internal_reloc *) p1;
- const struct internal_reloc *r2 = (const struct internal_reloc *) p2;
-
- if (r1->r_vaddr > r2->r_vaddr)
- return 1;
- else if (r1->r_vaddr < r2->r_vaddr)
- return -1;
- else
- return 0;
-}
-
-
-
-
OpenPOWER on IntegriCloud